@cotype/core
<h2 align="center"> <img src="https://cotype.dev/logo.svg" alt="cotype" /> </h2>
Last updated 18 hours ago by cotype-bot .
SEE LICENSE IN LICENSE.md · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @cotype/core 
SYNC missed versions from official npm registry.

cotype

CircleCI npm package Codecov semantic-release Greenkeeper

 

Cotype manages structured content that can accessed via APIs. The system itself is not concerned with the actual rendering of the data - this is left completely to the consumer which could be a server that generates HTML, a client-rendered web app or a native app that reads the data via HTTP.


Cotype is not free software.
In order to run cotype on a public server you must purchase a valid license.
Please contact info@cellular.de for inquiries.


Install

npm install @cotype/core

Usage

// server.ts
import { init, Opts /* ... */ } from "@cotype/core";

const port = 1337;
const opts: Opts = {
  /* ...see https://github.com/cotype/core#options */
};

/* Init cotype and receive express app */
init(opts).then(({ app }) => {
  /* Make the app listen on a specific port
   * see https://nodejs.org/api/net.html#net_server_listen */
  app.listen(port, () =>
    console.log(`Cotype listening on http://localhost:${port}!`)
  );
}, console.error);

Options

*required

  • *models: ModelOpts[]

    Describes what content types exist, which fields they have and how they are edited.

  • *persistenceAdapter: Promise<PersistenceAdapter>

    Adapter providing the database connection of the server.

    Cotype provides a Knex.js adapter that can be configured with a Knex configuration object.

    import { init, knexAdapter } from "@cotype/core";
    
    init({
      /* ... */
      persistenceAdapter: knexAdapter({
        /* see https://knexjs.org/#Installation-client */
      })
    });
    
  • *storage: Storage

    When files are uploaded, the meta data is stored in the database while the binary data is stored using this adapter.

    Cotype comes with an adapter that stores all data on the local file system.

    import { init, FsStorage } from "@cotype/core";
    
    init({
      /* ... */
      storage: new FsStorage("./uploads")
    });
    
  • *thumbnailProvider: ThumbnailProvider

    Thumbnail creator for uploaded image files.
    Cotype does not come with a default provider for size-reasons.

    Please see @cotype/local-thumbnail-provider for a straight-forward implementation.

  • basePath: string

    Default: /

    Can be used to mount the app on a sub-path. For example http://localhost:3000/cms.

    import { init } from "@cotype/core";
    
    init({
      /* ... */
      basePath: "/cms"
    });
    
  • sessionOpts: SessionOpts

    The server uses a cookie-session that holds nothing but the user's id.

    See cookie-session#options for details.

    The cookie is signed to prevent any sort of tampering. Therefore a secret must be provided using sessionOpts.secret or via the SESSION_SECRET env var. If omitted, a random string will be generated, which means that sessions will become invalid once the server is restarted.

How it works

Content APIs

The data can be accessed via REST. The server provides an interactive API explorer that developers can use to browse the content model.

NOTE: THe content API is read-only. Modifying content is only possible via the management API that is used by the UI.

Content Model

The content model is defined using only primitives, so it can be serialized into JSON. It describes what content types exist, which fields they have and how they are edited.

For a list of available content models check out the typings file.

Currently the content model is part of the server and changes require a re-deployment/restart in order to take effect. But since the model is plain JSON it would be pretty easy to manage content types directly in the CMS and store is alongside the data.

Data Storage

The data is stored in a Database. Built-In entities (like users, roles, etc.) live in a traditional relational model, whereas all content is stored as JSON in a common table. Content is immutable and each change creates a new revision. If the publish/draft system is enabled for a given content type, API clients won't see the changes until they are published (or a preview is requested).

There are two materialized views (one for all published, one for the latest versions) that have indexes on the JSON data as well as a full-text index for searching.

Contributing

Pull-Requests, Issues, Feedback, Coffee and positive thoughts are very welcome!

If you want to work on this project locally using the development environment or want to know more about what we consider "internal stuff", please refer to the contribution guidelines

Current Tags

  • 1.6.3-beta.77ca433                                ...           content-search-offset-limit (2 months ago)
  • 1.13.0-debug-4                                ...           content-update-error (2 months ago)
  • 1.9.0-debug-5                                ...           debug-media-routes (2 months ago)
  • 1.17.0-speed-debug                                ...           debug-query-speed (3 days ago)
  • 1.16.6-beta.a35459f                                ...           dependabot/npm_and_yarn/client (7 days ago)
  • 1.7.0-beta.8bfe65a                                ...           description-in-search-results (2 months ago)
  • 1.7.4-beta.00916d9                                ...           docs/be-more-welcoming (2 months ago)
  • 1.7.1-beta.066c37a                                ...           dropdown-ui-fix (2 months ago)
  • 1.3.0-beta.a6e500b                                ...           external-search-linkableOnly-f (2 months ago)
  • 1.0.2-beta.241dd70                                ...           false (2 months ago)
  • 1.12.0-beta.9de9ff4                                ...           feat/add-search-to-list-route (2 months ago)
  • 1.15.0-beta.727879a                                ...           feat/allow-longer-text (a month ago)
  • 1.13.0-beta.ba96040                                ...           feat/error-boundaries (2 months ago)
  • 1.8.0-beta.436c5b4                                ...           feat/expose-get-rest-api-build (2 months ago)
  • 1.9.0-beta.2f37ce8                                ...           feat/media-metadata (2 months ago)
  • 1.18.0-beta.4d1bd66                                ...           feat/regex-ref-validation (2 days ago)
  • 1.17.0-beta.afa209f                                ...           feat/regex-validation-for-text (4 days ago)
  • 1.19.0-beta.d0ea1ec                                ...           feat/select-fields-from-data (21 hours ago)
  • 1.16.4-beta.2cdfb0f                                ...           fix-empty-position (22 days ago)
  • 1.13.1-beta.abb1de7                                ...           fix-type-errors (2 months ago)
  • 1.9.1-beta.4da4667                                ...           fix/admin-media-routes (2 months ago)
  • 1.7.4-beta.f145916                                ...           fix/basepath (2 months ago)
  • 1.16.6-beta.9648bd9                                ...           fix/media-gallery (7 days ago)
  • 1.18.1-beta.8f4a3f3                                ...           fix/ref-validation (2 days ago)
  • 1.18.2-beta.2212197                                ...           fix/reference-validation (21 hours ago)
  • 1.16.3-beta.a53bd7a                                ...           greenkeeper/@types/fs-extra-8. (23 days ago)
  • 1.12.4-beta.c91e3bf                                ...           greenkeeper/@types/lodash-pin- (2 months ago)
  • 1.18.2-beta.6b33196                                ...           greenkeeper/@types/temp-write- (a day ago)
  • 1.16.4-beta.ade7828                                ...           greenkeeper/cypress-file-uploa (20 days ago)
  • 1.9.1-beta.4f086c4                                ...           greenkeeper/cypress-pin-3.3.0 (2 months ago)
  • 1.16.4-beta.b7dd1fe                                ...           greenkeeper/cypress-pin-3.3.1 (21 days ago)
  • 1.1.2-beta.91e58c1                                ...           greenkeeper/default/react-circ (2 months ago)
  • 1.1.2-beta.a2ef84a                                ...           greenkeeper/fs-extra-8.0.0 (2 months ago)
  • 1.10.1-beta.2c75481                                ...           greenkeeper/pluralize-8.0.0 (2 months ago)
  • 1.19.1                                ...           latest (18 hours ago)
  • 1.2.0-beta.e22faf3                                ...           limit-external-search-models (2 months ago)
  • 1.14.6-beta.ad54ae6                                ...           media-uploads (a month ago)
  • 1.1.0-beta.02a9c84                                ...           multiple-eq-nq-paramters (2 months ago)
  • 1.6.4-beta.6c0afbf                                ...           openapi-content-search (2 months ago)
  • 1.6.2-beta.b230ec2                                ...           openapi-external-content-searc (2 months ago)
  • 1.6.1-beta.012ab14                                ...           openapi-external-search (2 months ago)
  • 1.19.2-beta.2c34ece                                ...           query-performance (18 hours ago)
  • 1.16.2-beta.f2dd69d                                ...           quill-delta-data (23 days ago)
  • 0.0.0-development                                ...           speed-optimization.0 (3 days ago)
  • 1.12.2-beta.36fca88                                ...           stabilize-cms-base-url (2 months ago)

154 Versions

  • 1.19.2-beta.2c34ece                                ...           18 hours ago
  • 1.19.1                                ...           18 hours ago
  • 1.19.1-beta.fe365c3                                ...           18 hours ago
  • 1.19.1-beta.e47b0d3                                ...           20 hours ago
  • 1.19.0                                ...           20 hours ago
  • 1.18.2-beta.2212197                                ...           21 hours ago
  • 1.19.0-beta.d0ea1ec                                ...           21 hours ago
  • 1.18.2-beta.6b33196                                ...           a day ago
  • 1.18.2-beta.0c70a3e                                ...           2 days ago
  • 1.18.1                                ...           2 days ago
  • 1.18.1-beta.8f4a3f3                                ...           2 days ago
  • 1.18.0                                ...           2 days ago
  • 1.18.0-beta.4d1bd66                                ...           2 days ago
  • 1.18.0-beta.d08c1df                                ...           2 days ago
  • 1.18.0-beta.fec01c7                                ...           3 days ago
  • 1.17.0-speed-debug                                ...           3 days ago
  • 1.18.0-beta.36b2230                                ...           3 days ago
  • 0.0.0-development                                ...           3 days ago
  • 1.17.1-beta.476885d                                ...           4 days ago
  • 1.17.0                                ...           4 days ago
  • 1.17.0-beta.afa209f                                ...           4 days ago
  • 1.16.7-beta.1aa6f69                                ...           5 days ago
  • 1.16.7-beta.994dc45                                ...           7 days ago
  • 1.16.6-beta.531b9f3                                ...           7 days ago
  • 1.16.6                                ...           7 days ago
  • 1.16.6-beta.a35459f                                ...           7 days ago
  • 1.16.6-beta.5ed2bb5                                ...           7 days ago
  • 1.16.6-beta.9648bd9                                ...           7 days ago
  • 1.16.6-beta.675bd84                                ...           7 days ago
  • 1.16.6-beta.ae45261                                ...           10 days ago
  • 1.16.6-beta.219e5e1                                ...           14 days ago
  • 1.16.5                                ...           14 days ago
  • 1.16.5-beta.74a7a54                                ...           18 days ago
  • 1.16.5-beta.c69de64                                ...           18 days ago
  • 1.16.4                                ...           18 days ago
  • 1.16.4-beta.9991220                                ...           18 days ago
  • 1.16.4-beta.ade7828                                ...           20 days ago
  • 1.16.4-beta.b7dd1fe                                ...           21 days ago
  • 1.16.4-beta.2cdfb0f                                ...           22 days ago
  • 1.16.4-beta.7641a1a                                ...           22 days ago
  • 1.16.4-beta.c04adcc                                ...           22 days ago
  • 1.16.3                                ...           22 days ago
  • 1.16.3-beta.a53bd7a                                ...           23 days ago
  • 1.16.2                                ...           23 days ago
  • 1.16.2-beta.f2dd69d                                ...           23 days ago
  • 1.16.2-beta.8ecba89                                ...           23 days ago
  • 1.16.1                                ...           25 days ago
  • 1.16.0                                ...           a month ago
  • 1.15.0                                ...           a month ago
  • 1.14.7                                ...           a month ago
  • 1.15.0-beta.727879a                                ...           a month ago
  • 1.14.6                                ...           a month ago
  • 1.15.0-beta.84d2d27                                ...           a month ago
  • 1.14.6-beta.ad54ae6                                ...           a month ago
  • 1.15.0-beta.85f1245                                ...           a month ago
  • 1.14.6-beta.cf8d712                                ...           a month ago
  • 1.14.6-beta.b8a320c                                ...           a month ago
  • 1.14.5                                ...           a month ago
  • 1.14.4                                ...           a month ago
  • 1.14.2-beta.470c927                                ...           a month ago
  • 1.14.3                                ...           a month ago
  • 1.14.2                                ...           a month ago
  • 1.14.1                                ...           a month ago
  • 1.14.0                                ...           a month ago
  • 1.13.4                                ...           a month ago
  • 1.13.3                                ...           a month ago
  • 1.13.2                                ...           a month ago
  • 1.13.0-debug-4                                ...           2 months ago
  • 1.13.1                                ...           2 months ago
  • 1.13.0-debug-3                                ...           2 months ago
  • 1.13.0-debug-2                                ...           2 months ago
  • 1.13.1-beta.abb1de7                                ...           2 months ago
  • 1.13.0                                ...           2 months ago
  • 1.13.0-beta.ba96040                                ...           2 months ago
  • 1.12.6-beta.22f3a9b                                ...           2 months ago
  • 1.12.5                                ...           2 months ago
  • 1.12.4                                ...           2 months ago
  • 1.12.4-beta.c91e3bf                                ...           2 months ago
  • 1.13.0-debug-1                                ...           2 months ago
  • 1.13.0-debug-0                                ...           2 months ago
  • 1.13.0-beta.2e9ef01                                ...           2 months ago
  • 1.13.0-beta.38cc71d                                ...           2 months ago
  • 1.12.3                                ...           2 months ago
  • 1.12.2-beta.36fca88                                ...           2 months ago
  • 1.12.2                                ...           2 months ago
  • 1.12.1                                ...           2 months ago
  • 1.12.0                                ...           2 months ago
  • 1.12.0-beta.9de9ff4                                ...           2 months ago
  • 1.12.0-beta.bba56d3                                ...           2 months ago
  • 1.11.1                                ...           2 months ago
  • 1.10.1-beta.2c75481                                ...           2 months ago
  • 1.12.0-beta.efc2a3b                                ...           2 months ago
  • 1.11.0                                ...           2 months ago
  • 1.11.0-beta.227af52                                ...           2 months ago
  • 1.10.0                                ...           2 months ago
  • 1.10.0-beta.99f911b                                ...           2 months ago
  • 1.9.2                                ...           2 months ago
  • 1.10.0-beta.3ff7040                                ...           2 months ago
  • 1.9.1                                ...           2 months ago
  • 1.10.0-beta.98ff58f                                ...           2 months ago
  • 1.9.1-beta.4da4667                                ...           2 months ago
  • 1.9.0-debug-5                                ...           2 months ago
  • 1.9.0-debug-4                                ...           2 months ago
  • 1.9.0-debug-3                                ...           2 months ago
  • 1.9.0-debug-2                                ...           2 months ago
  • 1.9.0-debug-1                                ...           2 months ago
  • 1.9.0-debug-0                                ...           2 months ago
  • 1.9.1-beta.4f086c4                                ...           2 months ago
  • 1.9.0                                ...           2 months ago
  • 1.9.0-beta.2f37ce8                                ...           2 months ago
  • 1.8.0-beta.801ec10                                ...           2 months ago
  • 1.8.0                                ...           2 months ago
  • 1.8.0-beta.be806f4                                ...           2 months ago
  • 1.7.4                                ...           2 months ago
  • 1.8.0-beta.436c5b4                                ...           2 months ago
  • 1.7.4-beta.f145916                                ...           2 months ago
  • 1.7.4-beta.00916d9                                ...           2 months ago
  • 1.7.3                                ...           2 months ago
  • 1.7.2                                ...           2 months ago
  • 1.7.1                                ...           2 months ago
  • 1.7.1-beta.066c37a                                ...           2 months ago
  • 1.7.0                                ...           2 months ago
  • 1.7.0-beta.8bfe65a                                ...           2 months ago
  • 1.7.0-beta.bcce427                                ...           2 months ago
  • 1.6.4                                ...           2 months ago
  • 1.7.0-beta.cc285e4                                ...           2 months ago
  • 1.6.4-beta.6c0afbf                                ...           2 months ago
  • 1.6.3                                ...           2 months ago
  • 1.6.3-beta.77ca433                                ...           2 months ago
  • 1.6.3-beta.8a53ab3                                ...           2 months ago
  • 1.6.2                                ...           2 months ago
  • 1.6.2-beta.b230ec2                                ...           2 months ago
  • 1.6.1                                ...           2 months ago
  • 1.6.1-beta.012ab14                                ...           2 months ago
  • 1.3.0-beta.a6e500b                                ...           2 months ago
  • 1.5.0                                ...           2 months ago
  • 1.4.0                                ...           2 months ago
  • 1.3.0                                ...           2 months ago
  • 1.2.0                                ...           2 months ago
  • 1.2.0-beta.e22faf3                                ...           2 months ago
  • 1.1.2                                ...           2 months ago
  • 1.2.0-beta.2e2f667                                ...           2 months ago
  • 1.1.2-beta.91e58c1                                ...           2 months ago
  • 1.1.2-beta.a2ef84a                                ...           2 months ago
  • 1.1.1                                ...           2 months ago
  • 1.1.0                                ...           2 months ago
  • 1.1.0-beta.02a9c84                                ...           2 months ago
  • 1.0.3                                ...           2 months ago
  • 1.0.2                                ...           2 months ago
  • 1.0.2-beta.241dd70                                ...           2 months ago
  • 1.0.1                                ...           2 months ago
  • 1.0.1-beta.41c621d                                ...           2 months ago
  • 1.0.1-beta.7ef1a3c                                ...           2 months ago
  • 1.0.0                                ...           2 months ago
Downloads
Today 3
This Week 350
This Month 862
Last Day 143
Last Week 413
Last Month 968
Dependencies (42)
Dev Dependencies (34)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |