@imbricate/core 1.4.1 → 1.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ /**
2
+ * @author WMXPY
3
+ * @namespace Collection
4
+ * @description Definition
5
+ */
6
+ export declare enum IMBRICATE_COLLECTION_EVENT_TYPE {
7
+ PAGE_CREATED = "PAGE_CREATED"
8
+ }
9
+ export declare enum IMBRICATE_COLLECTION_TRIGGER_TYPE {
10
+ SCRIPT = "SCRIPT"
11
+ }
12
+ export type ImbricateCollectionEventScriptPayload = {
13
+ readonly scriptIdentifier: string;
14
+ readonly fixedParameters: Record<string, any>;
15
+ };
16
+ export type ImbricateCollectionEventPayload<T extends IMBRICATE_COLLECTION_TRIGGER_TYPE> = T extends IMBRICATE_COLLECTION_TRIGGER_TYPE.SCRIPT ? ImbricateCollectionEventScriptPayload : never;
17
+ export type ImbricateCollectionEvent<T extends IMBRICATE_COLLECTION_TRIGGER_TYPE> = {
18
+ readonly eventType: IMBRICATE_COLLECTION_EVENT_TYPE;
19
+ readonly triggerType: T;
20
+ readonly payload: ImbricateCollectionEventPayload<T>;
21
+ };
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ /**
3
+ * @author WMXPY
4
+ * @namespace Collection
5
+ * @description Definition
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.IMBRICATE_COLLECTION_TRIGGER_TYPE = exports.IMBRICATE_COLLECTION_EVENT_TYPE = void 0;
9
+ var IMBRICATE_COLLECTION_EVENT_TYPE;
10
+ (function (IMBRICATE_COLLECTION_EVENT_TYPE) {
11
+ IMBRICATE_COLLECTION_EVENT_TYPE["PAGE_CREATED"] = "PAGE_CREATED";
12
+ })(IMBRICATE_COLLECTION_EVENT_TYPE || (exports.IMBRICATE_COLLECTION_EVENT_TYPE = IMBRICATE_COLLECTION_EVENT_TYPE = {}));
13
+ var IMBRICATE_COLLECTION_TRIGGER_TYPE;
14
+ (function (IMBRICATE_COLLECTION_TRIGGER_TYPE) {
15
+ IMBRICATE_COLLECTION_TRIGGER_TYPE["SCRIPT"] = "SCRIPT";
16
+ })(IMBRICATE_COLLECTION_TRIGGER_TYPE || (exports.IMBRICATE_COLLECTION_TRIGGER_TYPE = IMBRICATE_COLLECTION_TRIGGER_TYPE = {}));
@@ -4,17 +4,22 @@
4
4
  * @description Interface
5
5
  */
6
6
  import { PromiseOr } from "../definition/promise";
7
- import { ImbricatePageSnapshot } from "../page/definition";
7
+ import { ImbricatePageMetadata, ImbricatePageSearchSnippet, ImbricatePageSnapshot } from "../page/definition";
8
8
  import { IImbricatePage } from "../page/interface";
9
- import { IMBRICATE_SEARCH_SNIPPET_TYPE, ImbricateSearchSnippet } from "../search/snippet";
10
- export type ImbricatePageSearchSnippet = ImbricateSearchSnippet<IMBRICATE_SEARCH_SNIPPET_TYPE.PAGE>;
9
+ import { IMBRICATE_COLLECTION_EVENT_TYPE, IMBRICATE_COLLECTION_TRIGGER_TYPE, ImbricateCollectionEvent } from "./definition";
11
10
  export interface IImbricateOriginCollection {
12
11
  readonly collectionName: string;
13
12
  readonly description?: string;
14
- listPages(): PromiseOr<ImbricatePageSnapshot[]>;
13
+ readonly events: Array<ImbricateCollectionEvent<IMBRICATE_COLLECTION_TRIGGER_TYPE>>;
14
+ attachEvent(event: ImbricateCollectionEvent<IMBRICATE_COLLECTION_TRIGGER_TYPE>): PromiseOr<void>;
15
+ getEventsByEventType(eventType: IMBRICATE_COLLECTION_EVENT_TYPE): PromiseOr<Array<ImbricateCollectionEvent<IMBRICATE_COLLECTION_TRIGGER_TYPE>>>;
16
+ triggerEvent(eventType: IMBRICATE_COLLECTION_EVENT_TYPE, payload: any): PromiseOr<void>;
15
17
  createPage(title: string, initialContent?: string): PromiseOr<IImbricatePage>;
18
+ putPage(pageMetadata: ImbricatePageMetadata, content: string): PromiseOr<IImbricatePage>;
19
+ retitlePage(identifier: string, newTitle: string): PromiseOr<void>;
16
20
  deletePage(identifier: string, title: string): PromiseOr<void>;
17
21
  hasPage(title: string): PromiseOr<boolean>;
18
22
  getPage(identifier: string): PromiseOr<IImbricatePage | null>;
23
+ listPages(): PromiseOr<ImbricatePageSnapshot[]>;
19
24
  searchPages(keyword: string): PromiseOr<ImbricatePageSearchSnippet[]>;
20
25
  }
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @author WMXPY
3
- * @namespace Origin_Collection
3
+ * @namespace Collection
4
4
  * @description Least Common Identifier
5
5
  */
6
6
  export type LeastCommonIdentifierItem = {
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  /**
3
3
  * @author WMXPY
4
- * @namespace Origin_Collection
4
+ * @namespace Collection
5
5
  * @description Least Common Identifier
6
6
  */
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
package/index.d.ts CHANGED
@@ -2,10 +2,12 @@
2
2
  * @author WMXPY
3
3
  * @description Index
4
4
  */
5
+ export * from "./collection/definition";
5
6
  export * from "./collection/interface";
6
7
  export * from "./collection/least-common-identifier";
7
8
  export * from "./definition/listable";
8
9
  export * from "./definition/promise";
10
+ export * from "./origin/definition";
9
11
  export * from "./origin/interface";
10
12
  export * from "./page/definition";
11
13
  export * from "./page/interface";
package/index.js CHANGED
@@ -18,10 +18,12 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
18
18
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
19
19
  };
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
+ __exportStar(require("./collection/definition"), exports);
21
22
  __exportStar(require("./collection/interface"), exports);
22
23
  __exportStar(require("./collection/least-common-identifier"), exports);
23
24
  __exportStar(require("./definition/listable"), exports);
24
25
  __exportStar(require("./definition/promise"), exports);
26
+ __exportStar(require("./origin/definition"), exports);
25
27
  __exportStar(require("./origin/interface"), exports);
26
28
  __exportStar(require("./page/definition"), exports);
27
29
  __exportStar(require("./page/interface"), exports);
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @author WMXPY
3
+ * @namespace Origin
4
+ * @description Definition
5
+ */
6
+ import { IMBRICATE_SEARCH_SNIPPET_TYPE, ImbricateSearchSnippet } from "../search/snippet";
7
+ export type ImbricateScriptSearchSnippet = ImbricateSearchSnippet<IMBRICATE_SEARCH_SNIPPET_TYPE.SCRIPT>;
8
+ export type ImbricateOriginMetadata = {
9
+ readonly type: string;
10
+ };
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ /**
3
+ * @author WMXPY
4
+ * @namespace Origin
5
+ * @description Definition
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -5,22 +5,24 @@
5
5
  */
6
6
  import { IImbricateOriginCollection } from "../collection/interface";
7
7
  import { PromiseOr } from "../definition/promise";
8
- import { ImbricateScriptSnapshot } from "../script/definition";
8
+ import { ImbricateScriptMetadata, ImbricateScriptSnapshot } from "../script/definition";
9
9
  import { IImbricateScript } from "../script/interface";
10
- export type ImbricateOriginMetadata = {
11
- readonly type: string;
12
- };
10
+ import { ImbricateOriginMetadata, ImbricateScriptSearchSnippet } from "./definition";
13
11
  export interface IImbricateOrigin {
14
12
  readonly metadata: ImbricateOriginMetadata;
15
13
  readonly payloads: Record<string, any>;
16
14
  createCollection(collectionName: string, description?: string): PromiseOr<void>;
15
+ renameCollection(collectionName: string, newCollectionName: string): PromiseOr<void>;
17
16
  deleteCollection(collectionName: string): PromiseOr<void>;
18
17
  hasCollection(collectionName: string): PromiseOr<boolean>;
19
18
  getCollection(collectionName: string): PromiseOr<IImbricateOriginCollection | null>;
20
19
  listCollections(): PromiseOr<IImbricateOriginCollection[]>;
21
20
  createScript(scriptName: string, description?: string): PromiseOr<IImbricateScript>;
21
+ putScript(scriptMetadata: ImbricateScriptMetadata, script: string): PromiseOr<IImbricateScript>;
22
+ renameScript(identifier: string, newScriptName: string): PromiseOr<void>;
22
23
  deleteScript(identifier: string, scriptName: string): PromiseOr<void>;
23
24
  hasScript(scriptName: string): PromiseOr<boolean>;
24
25
  getScript(identifier: string): PromiseOr<IImbricateScript | null>;
25
26
  listScripts(): PromiseOr<ImbricateScriptSnapshot[]>;
27
+ searchPages(keyword: string): PromiseOr<ImbricateScriptSearchSnippet[]>;
26
28
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@imbricate/core",
3
3
  "main": "index.js",
4
- "version": "1.4.1",
4
+ "version": "1.5.1",
5
5
  "description": "Core for Imbricate",
6
6
  "repository": {
7
7
  "type": "git",
@@ -3,7 +3,14 @@
3
3
  * @namespace Page
4
4
  * @description Definition
5
5
  */
6
+ import { IMBRICATE_SEARCH_SNIPPET_TYPE, ImbricateSearchSnippet } from "../search/snippet";
7
+ export type ImbricatePageSearchSnippet = ImbricateSearchSnippet<IMBRICATE_SEARCH_SNIPPET_TYPE.PAGE>;
6
8
  export type ImbricatePageSnapshot = {
7
9
  readonly title: string;
8
10
  readonly identifier: string;
11
+ readonly description?: string;
9
12
  };
13
+ export type ImbricatePageMetadata = {
14
+ readonly createdAt: Date;
15
+ readonly updatedAt: Date;
16
+ } & ImbricatePageSnapshot;
@@ -6,4 +6,9 @@
6
6
  export type ImbricateScriptSnapshot = {
7
7
  readonly scriptName: string;
8
8
  readonly identifier: string;
9
+ readonly description?: string;
9
10
  };
11
+ export type ImbricateScriptMetadata = {
12
+ readonly createdAt: Date;
13
+ readonly updatedAt: Date;
14
+ } & ImbricateScriptSnapshot;
@@ -4,13 +4,18 @@
4
4
  * @description Snippet
5
5
  */
6
6
  export declare enum IMBRICATE_SEARCH_SNIPPET_TYPE {
7
- PAGE = "PAGE"
7
+ PAGE = "PAGE",
8
+ SCRIPT = "SCRIPT"
8
9
  }
9
10
  export declare enum IMBRICATE_SEARCH_SNIPPET_PAGE_SNIPPET_SOURCE {
10
11
  TITLE = "TITLE",
11
12
  CONTENT = "CONTENT"
12
13
  }
13
- type IMBRICATE_SEARCH_SNIPPET_SNIPPET_SOURCE<T extends IMBRICATE_SEARCH_SNIPPET_TYPE> = T extends IMBRICATE_SEARCH_SNIPPET_TYPE.PAGE ? IMBRICATE_SEARCH_SNIPPET_PAGE_SNIPPET_SOURCE : never;
14
+ export declare enum IMBRICATE_SEARCH_SNIPPET_SCRIPT_SNIPPET_SOURCE {
15
+ NAME = "NAME",
16
+ SCRIPT = "DESCRIPTION"
17
+ }
18
+ type IMBRICATE_SEARCH_SNIPPET_SNIPPET_SOURCE<T extends IMBRICATE_SEARCH_SNIPPET_TYPE> = T extends IMBRICATE_SEARCH_SNIPPET_TYPE.PAGE ? IMBRICATE_SEARCH_SNIPPET_PAGE_SNIPPET_SOURCE : T extends IMBRICATE_SEARCH_SNIPPET_TYPE.SCRIPT ? IMBRICATE_SEARCH_SNIPPET_SCRIPT_SNIPPET_SOURCE : never;
14
19
  export type ImbricateSearchSnippet<T extends IMBRICATE_SEARCH_SNIPPET_TYPE> = {
15
20
  readonly type: T;
16
21
  readonly scope: string;
package/search/snippet.js CHANGED
@@ -5,13 +5,19 @@
5
5
  * @description Snippet
6
6
  */
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.IMBRICATE_SEARCH_SNIPPET_PAGE_SNIPPET_SOURCE = exports.IMBRICATE_SEARCH_SNIPPET_TYPE = void 0;
8
+ exports.IMBRICATE_SEARCH_SNIPPET_SCRIPT_SNIPPET_SOURCE = exports.IMBRICATE_SEARCH_SNIPPET_PAGE_SNIPPET_SOURCE = exports.IMBRICATE_SEARCH_SNIPPET_TYPE = void 0;
9
9
  var IMBRICATE_SEARCH_SNIPPET_TYPE;
10
10
  (function (IMBRICATE_SEARCH_SNIPPET_TYPE) {
11
11
  IMBRICATE_SEARCH_SNIPPET_TYPE["PAGE"] = "PAGE";
12
+ IMBRICATE_SEARCH_SNIPPET_TYPE["SCRIPT"] = "SCRIPT";
12
13
  })(IMBRICATE_SEARCH_SNIPPET_TYPE || (exports.IMBRICATE_SEARCH_SNIPPET_TYPE = IMBRICATE_SEARCH_SNIPPET_TYPE = {}));
13
14
  var IMBRICATE_SEARCH_SNIPPET_PAGE_SNIPPET_SOURCE;
14
15
  (function (IMBRICATE_SEARCH_SNIPPET_PAGE_SNIPPET_SOURCE) {
15
16
  IMBRICATE_SEARCH_SNIPPET_PAGE_SNIPPET_SOURCE["TITLE"] = "TITLE";
16
17
  IMBRICATE_SEARCH_SNIPPET_PAGE_SNIPPET_SOURCE["CONTENT"] = "CONTENT";
17
18
  })(IMBRICATE_SEARCH_SNIPPET_PAGE_SNIPPET_SOURCE || (exports.IMBRICATE_SEARCH_SNIPPET_PAGE_SNIPPET_SOURCE = IMBRICATE_SEARCH_SNIPPET_PAGE_SNIPPET_SOURCE = {}));
19
+ var IMBRICATE_SEARCH_SNIPPET_SCRIPT_SNIPPET_SOURCE;
20
+ (function (IMBRICATE_SEARCH_SNIPPET_SCRIPT_SNIPPET_SOURCE) {
21
+ IMBRICATE_SEARCH_SNIPPET_SCRIPT_SNIPPET_SOURCE["NAME"] = "NAME";
22
+ IMBRICATE_SEARCH_SNIPPET_SCRIPT_SNIPPET_SOURCE["SCRIPT"] = "DESCRIPTION";
23
+ })(IMBRICATE_SEARCH_SNIPPET_SCRIPT_SNIPPET_SOURCE || (exports.IMBRICATE_SEARCH_SNIPPET_SCRIPT_SNIPPET_SOURCE = IMBRICATE_SEARCH_SNIPPET_SCRIPT_SNIPPET_SOURCE = {}));