UNPKG

@worldbrain/storex-sync

Version:

Offline-first syncing between multiple databases using Storex

279 lines 10.5 kB
"use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var storex_pattern_modules_1 = require("@worldbrain/storex-pattern-modules"); var PageStorage = (function (_super) { __extends(PageStorage, _super); function PageStorage() { return _super !== null && _super.apply(this, arguments) || this; } PageStorage.prototype.getConfig = function () { return { collections: { pages: { version: new Date(2018, 1, 1), fields: { url: { type: 'string' }, text: { type: 'text' }, domain: { type: 'string' }, hostname: { type: 'string' }, screenshot: { type: 'media' }, }, indices: [ { field: 'url', pk: true }, { field: 'text', fullTextIndexName: 'terms' }, { field: 'domain' }, ], }, }, operations: {} }; }; return PageStorage; }(storex_pattern_modules_1.StorageModule)); exports.PageStorage = PageStorage; var VisitsStorage = (function (_super) { __extends(VisitsStorage, _super); function VisitsStorage() { return _super !== null && _super.apply(this, arguments) || this; } VisitsStorage.prototype.getConfig = function () { return { collections: { visits: { version: new Date(2018, 1, 1), fields: { url: { type: 'string' }, time: { type: 'timestamp' }, duration: { type: 'int' }, scrollMaxPerc: { type: 'float' }, }, indices: [ { field: ['time', 'url'], pk: true }, { field: 'url' } ], }, }, operations: {} }; }; return VisitsStorage; }(storex_pattern_modules_1.StorageModule)); exports.VisitsStorage = VisitsStorage; var BookmarksStorage = (function (_super) { __extends(BookmarksStorage, _super); function BookmarksStorage() { return _super !== null && _super.apply(this, arguments) || this; } BookmarksStorage.prototype.getConfig = function () { return { collections: { bookmarks: { version: new Date(2018, 1, 1), fields: { url: { type: 'string' }, time: { type: 'timestamp' }, }, indices: [{ field: 'url', pk: true }, { field: 'time' }], }, }, operations: {} }; }; return BookmarksStorage; }(storex_pattern_modules_1.StorageModule)); exports.BookmarksStorage = BookmarksStorage; var TagsStorage = (function (_super) { __extends(TagsStorage, _super); function TagsStorage() { return _super !== null && _super.apply(this, arguments) || this; } TagsStorage.prototype.getConfig = function () { return { collections: { tags: { version: new Date(2018, 1, 1), fields: { url: { type: 'string' }, name: { type: 'string' }, }, indices: [ { field: ['name', 'url'], pk: true }, { field: 'name' }, { field: 'url' }, ], }, }, operations: {} }; }; return TagsStorage; }(storex_pattern_modules_1.StorageModule)); exports.TagsStorage = TagsStorage; var FavIconsStorage = (function (_super) { __extends(FavIconsStorage, _super); function FavIconsStorage() { return _super !== null && _super.apply(this, arguments) || this; } FavIconsStorage.prototype.getConfig = function () { return { collections: { favIcons: { version: new Date(2018, 1, 1), fields: { hostname: { type: 'string' }, favIcon: { type: 'media' }, }, indices: [{ field: 'hostname', pk: true }], }, }, operations: {} }; }; return FavIconsStorage; }(storex_pattern_modules_1.StorageModule)); exports.FavIconsStorage = FavIconsStorage; var NotificationStorage = (function (_super) { __extends(NotificationStorage, _super); function NotificationStorage() { return _super !== null && _super.apply(this, arguments) || this; } NotificationStorage.prototype.getConfig = function () { return { collections: { notifications: { version: new Date(2018, 7, 4), fields: { id: { type: 'string' }, title: { type: 'string' }, message: { type: 'string' }, buttonText: { type: 'string' }, link: { type: 'string' }, sentTime: { type: 'datetime' }, deliveredTime: { type: 'datetime' }, readTime: { type: 'datetime' }, }, indices: [{ field: 'id', pk: true }], }, }, operations: {} }; }; return NotificationStorage; }(storex_pattern_modules_1.StorageModule)); exports.NotificationStorage = NotificationStorage; var CustomListsStorage = (function (_super) { __extends(CustomListsStorage, _super); function CustomListsStorage() { return _super !== null && _super.apply(this, arguments) || this; } CustomListsStorage.prototype.getConfig = function () { return { collections: { customLists: { version: new Date(2018, 6, 12), fields: { id: { type: 'string', pk: true }, name: { type: 'string' }, isDeletable: { type: 'boolean' }, isNestable: { type: 'boolean' }, createdAt: { type: 'datetime' }, }, indices: [ { field: 'id', pk: true }, { field: 'name', unique: true }, { field: 'isDeletable' }, { field: 'isNestable' }, { field: 'createdAt' }, ], }, pageListEntries: { version: new Date(2018, 6, 12), fields: { listId: { type: 'string' }, pageUrl: { type: 'string' }, fullUrl: { type: 'string' }, createdAt: { type: 'datetime' }, }, indices: [ { field: ['listId', 'pageUrl'], pk: true }, { field: 'listId' }, { field: 'pageUrl' }, ], }, }, operations: {} }; }; return CustomListsStorage; }(storex_pattern_modules_1.StorageModule)); exports.CustomListsStorage = CustomListsStorage; var AnnotationsStorage = (function (_super) { __extends(AnnotationsStorage, _super); function AnnotationsStorage() { return _super !== null && _super.apply(this, arguments) || this; } AnnotationsStorage.prototype.getConfig = function () { return { collections: { annotations: { version: new Date(2018, 7, 26), fields: { pageTitle: { type: 'text' }, pageUrl: { type: 'url' }, body: { type: 'text' }, comment: { type: 'text' }, selector: { type: 'json' }, createdWhen: { type: 'datetime' }, lastEdited: { type: 'datetime' }, url: { type: 'string' }, }, indices: [ { field: 'url', pk: true }, { field: 'pageTitle' }, { field: 'body' }, { field: 'createdWhen' }, { field: 'comment' }, ], }, annotationListEntries: { version: new Date(2019, 0, 4), fields: { listId: { type: 'string' }, url: { type: 'string' }, createdAt: { type: 'datetime' }, }, indices: [ { field: ['listId', 'url'], pk: true }, { field: 'listId' }, { field: 'url' }, ], }, annotationBookmarks: { version: new Date(2019, 0, 5), fields: { url: { type: 'string' }, createdAt: { type: 'datetime' }, }, indices: [{ field: 'url', pk: true }, { field: 'createdAt' }], } }, operations: {} }; }; return AnnotationsStorage; }(storex_pattern_modules_1.StorageModule)); exports.AnnotationsStorage = AnnotationsStorage; //# sourceMappingURL=memex-schema.tests.js.map