npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@manuscripts/manuscripts-sync

v1.1.4

Published

Sync function for Couchbase Sync Gateway

Downloads

146

Readme

manuscripts-sync

This repository provides a Dockerfile for a copy of Couchbase Sync Gateway configured for Manuscripts backend purposes, as well as an NPM published package which is baked into the Sync Gateway configuration.

Module usage

import { Project } from '@manuscripts/manuscripts-sync'

const p: Project = {
  _id: 'MPProject:id',
  owners: ['User_Foo'],
  writers: [],
  viewers: [],
  objectType: 'MPProject',
}
const { syncFn } = require('@manuscripts/manuscripts-sync')

console.log(syncFn)

Building the Sync Gateway configuration file

To build the Sync Gateway configuration file at ./docker/sync_gateway/sync-gateway-config.json with the values present in .env, do the following:

env $(cat .env | xargs) npx gulp

The environment variables in .env are defaults, and none of them at least at the time of writing are treated as build arguments in the Dockerfiles present in this repo.

Dockerfiles

This repository contains a CI build configuration which keeps the following two GitLab Docker registry published images up to date:

  • registry.gitlab.com/mpapp-private/manuscripts-sync/sync_gateway
  • registry.gitlab.com/mpapp-private/manuscripts-sync/couchbase

Both of these images are tagged with the value of the "version" field present in the package.json.

The images are published to the registry upon tagging commits (or with manual CD pipeline "prepare_images_manual" button pressing action).

Building Sync Gateway for local development

To develop manuscripts-api against a locally built manuscripts-sync flavoured Sync Gateway, do the following:

  1. Create a GitLab account if you don't already have one.
  2. docker login registry.gitlab.com with your GitLab credentials.
  3. IMAGE_NAME=your-sg-image-name ./docker/build-image.sh.
  4. Follow the local development steps for manuscripts-frontend, except before launching the services, modify docker-compose.yml to set the image name so that it matches the $IMAGE_NAME you used above.
  sync_gateway:
    image: your-sg-image-name
    …

If you want to make local changes to manuscripts-sync JavaScript code (such as manuscripts-sync-fn.js) or manuscripts-json-schema, pass COPY_LOCAL_PACKAGES=true to the ./docker/build-image.sh script, like so:

COPY_LOCAL_PACKAGES=true IMAGE_NAME=your-sg-image-name ./docker/build-image.sh

Local changes to manuscripts-json-schema

To build the image with steps described above with a locally changed manuscripts-json-schema, use npm link and a local copy of manuscripts-json-schema, for example if your working copy of the schema repository is next to your manuscripts-sync repository on your disk, do the following to link it:

npm link ../manuscripts-json-schema/

The build-image.sh script will deal with an npm linked copy of manuscripts-json-schema similarly to one that is referenced and fetched by NPM via the package.json reference, allowing you to work with unpublished versions of the schema.

Creating a release

To create a release, do the following:

  1. Decide to make a release: is the correct schema version referenced? are tests in good order? have you tested compatibility with manuscripts-api?
  2. Update version in package.json, commit and push it.
  3. Create a new tag, and enter a brief description and release notes.
  4. Watch as the CI tasks for NPM package and Docker image publishing complete.
  5. Celebrate 🎉

Channels contents and description

The following are data bucket channels:
  • {userID}-projects =>
    • contains:
      • MPProject with one of owners/writers/viewers = {userID}.
    • description:
      • contains any project in which the user with {userID} is a collaborator.
      • access granted to the user with id = {userID}.
  • {userID}-libraries =>
    • contains:
      • MPLibrary with one of owners/writers/viewers = {userID}.
    • description:
      • contains any library in which the user with {userID} is a collaborator.
      • access granted to the user with id = {userID}.
  • {userID}-library-collections =>
    • contains:
      • MPLibraryCollection with one of owners/writers/viewers = {userID}.
    • description:
      • contains any library collection in which the user with {userID} is a collaborator.
      • access granted to the user with id = {userID}.
  • {containerID}-read =>
    • contains:
      • MPProject with _id = {containerID}.
      • MPLibrary with _id = {containerID}.
      • MPLibraryCollection with _id = {containerID}.
      • MPContainerInvitations with containerID = {containerID}.
      • any other objects with containerID = {containerID}.
    • description:
      • contains all the objects related to a container with id {containerID}, including the container itself.
      • access granted to any container collaborator.
  • {containerID}-readwrite =>
    • contains:
      • MPProject with _id = {containerID}.
      • MPLibrary with _id = {containerID}.
      • MPLibraryCollection with _id = {containerID}.
      • MPContainerInvitations with containerID = {containerID}.
      • any other objects with containerID = {containerID}.
    • description:
      • contains all the objects related to a container with id {containerID}, including the container itself.
      • access granted to any container owners and writers.
  • {userID}-read =>
    • contains:
      • MPUserProfile with userID = {userID}.
    • description:
      • contains the profile of the user with {userID}.
      • access granted to the user with id = {userID}.
  • {userID}-readwrite =>
    • contains:
      • MPUserProfile with userID = {userID}.
    • description:
      • contains the profile of the user with {userID}.
      • access granted to the user with id = {userID}.
  • {userID} =>
    • contains:
      • MPCollaboration with invitingUserID = {userID} or User_ + invitedUserEmail = {userID}.
      • MPInvitation with invitingUserID = {userID} or User_ + invitedUserEmail = {userID}.
      • MPContainerInvitation with invitingUserID = {userID} or User_ + invitedUserEmail = {userID}.
    • description:
      • contains all collaborations, invitations and container invitations which are send by the user or to the user.
      • access granted to the user with id = {userID}.
  • {containerID}-owner =>
    • contains:
      • MPContainerRequest with containerID = {containerID}.
    • description:
      • contains all the objects which are only accessible to the owner of a container with {containerID}.
      • access granted to any container owners.
  • {preferenceID} without MPPreferences: prefix =>
    • contains:
      • MPPreference with _id = {preferenceID}
    • description: ?
  • {userID}-citation-alerts =>
    • contains:
      • MPMutedCitationAlert with userID = {userID}.
      • MPCitationAlert with userID = {userID}.
    • description:
      • contains all citation alert objects.
      • access granted to the user with id = {userID}.
  • {containerID}-bibitems =>
    • contains:
      • MPBibliographyItem with containerID = {containerID}.
    • description:
      • contains all the bibliography items for the container with containerID = {containerID}.
      • access granted to any container collaborator.
  • {keywordID}-read =>
    • contains:
      • MPBibliographyItem with one of keywordIDs = {keywordID}.
    • description: ?
  • {keywordID}-readwrite =>
    • contains:
      • MPBibliographyItem with one of keywordIDs = {keywordID}.
    • description: ?
  • {userID}-templates =>
    • contains:
      • MPProject with one of owners/writers/viewers = {userID} and templateContainer = true.
    • description:
      • contains projects that contain published MPManuscriptTemplate objects.
      • access granted to the user with id = {userID}.
The following are derived data bucket channels:
  • {userID}-collaborators =>
    • contains:
      • MPUserCollaborator with userID = {userID}.
    • description:
      • contains all user collaborators for the user with userID = {userID}.
      • access granted to user with id = {userID}.
  • {userID}-project-mementos =>
    • contains:
      • MPProjectMemento with userID = {userID}.
    • description:
      • contains all project mementos for the user with userID = {userID}.
      • access granted to user with id = {userID}.
  • {containerID}-summaries =>
    • contains:
      • MPProjectSummary with containerID = {containerID}.
      • MPLibrarySummary with containerID = {containerID}.
      • MPLibraryCollectionSummary with containerID = {containerID}.
    • description:
      • contains a container summary with containerID = {containerID}.
      • access granted to any container collaborator.