@imbricate/core 1.16.1 → 1.17.0

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,12 @@
1
+ /**
2
+ * @author WMXPY
3
+ * @namespace Capability
4
+ * @description Definition
5
+ */
6
+ export declare enum IMBRICATE_CAPABILITY_EFFECT {
7
+ ALLOW = "ALLOW",
8
+ DENY = "DENY"
9
+ }
10
+ export type ImbricateCapability = {
11
+ readonly effect: IMBRICATE_CAPABILITY_EFFECT;
12
+ };
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ /**
3
+ * @author WMXPY
4
+ * @namespace Capability
5
+ * @description Definition
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.IMBRICATE_CAPABILITY_EFFECT = void 0;
9
+ var IMBRICATE_CAPABILITY_EFFECT;
10
+ (function (IMBRICATE_CAPABILITY_EFFECT) {
11
+ IMBRICATE_CAPABILITY_EFFECT["ALLOW"] = "ALLOW";
12
+ IMBRICATE_CAPABILITY_EFFECT["DENY"] = "DENY";
13
+ })(IMBRICATE_CAPABILITY_EFFECT || (exports.IMBRICATE_CAPABILITY_EFFECT = IMBRICATE_CAPABILITY_EFFECT = {}));
@@ -0,0 +1,15 @@
1
+ /**
2
+ * @author WMXPY
3
+ * @namespace Collection
4
+ * @description Definition
5
+ */
6
+ import { ImbricateCapability } from "../capability/definition";
7
+ export type ImbricateCollectionCapability = Record<IMBRICATE_COLLECTION_CAPABILITY_KEY, ImbricateCapability>;
8
+ export declare enum IMBRICATE_COLLECTION_CAPABILITY_KEY {
9
+ CREATE_PAGE = "imbricate.collection.page.create",
10
+ PUT_PAGE = "imbricate.collection.page.put",
11
+ RETITLE_PAGE = "imbricate.collection.page.retitle",
12
+ DELETE_PAGE = "imbricate.collection.page.delete",
13
+ GET_PAGE = "imbricate.collection.page.get",
14
+ LIST_PAGES = "imbricate.collection.page.list"
15
+ }
@@ -0,0 +1,17 @@
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_CAPABILITY_KEY = void 0;
9
+ var IMBRICATE_COLLECTION_CAPABILITY_KEY;
10
+ (function (IMBRICATE_COLLECTION_CAPABILITY_KEY) {
11
+ IMBRICATE_COLLECTION_CAPABILITY_KEY["CREATE_PAGE"] = "imbricate.collection.page.create";
12
+ IMBRICATE_COLLECTION_CAPABILITY_KEY["PUT_PAGE"] = "imbricate.collection.page.put";
13
+ IMBRICATE_COLLECTION_CAPABILITY_KEY["RETITLE_PAGE"] = "imbricate.collection.page.retitle";
14
+ IMBRICATE_COLLECTION_CAPABILITY_KEY["DELETE_PAGE"] = "imbricate.collection.page.delete";
15
+ IMBRICATE_COLLECTION_CAPABILITY_KEY["GET_PAGE"] = "imbricate.collection.page.get";
16
+ IMBRICATE_COLLECTION_CAPABILITY_KEY["LIST_PAGES"] = "imbricate.collection.page.list";
17
+ })(IMBRICATE_COLLECTION_CAPABILITY_KEY || (exports.IMBRICATE_COLLECTION_CAPABILITY_KEY = IMBRICATE_COLLECTION_CAPABILITY_KEY = {}));
@@ -7,10 +7,11 @@ import { PromiseOr } from "../definition/promise";
7
7
  import { ImbricatePageMetadata, ImbricatePageSearchResult, ImbricatePageSnapshot } from "../page/definition";
8
8
  import { IImbricatePage } from "../page/interface";
9
9
  import { ImbricatePageQuery, ImbricatePageQueryConfig, ImbricateSearchPageConfig } from "../query/page";
10
+ import { ImbricateCollectionCapability } from "./definition";
10
11
  export interface IImbricateOriginCollection {
11
12
  readonly collectionName: string;
12
13
  readonly description?: string;
13
- readonly includeInSearch: boolean;
14
+ readonly capabilities: ImbricateCollectionCapability;
14
15
  createPage(directories: string[], title: string, initialContent: string): PromiseOr<IImbricatePage>;
15
16
  putPage(pageMetadata: ImbricatePageMetadata, content: string): PromiseOr<IImbricatePage>;
16
17
  retitlePage(identifier: string, newTitle: string): PromiseOr<void>;
package/index.d.ts CHANGED
@@ -2,6 +2,8 @@
2
2
  * @author WMXPY
3
3
  * @description Index
4
4
  */
5
+ export * from "./capability/definition";
6
+ export * from "./collection/definition";
5
7
  export * from "./collection/interface";
6
8
  export * from "./collection/least-common-identifier";
7
9
  export * from "./definition/listable";
package/index.js CHANGED
@@ -18,6 +18,8 @@ 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("./capability/definition"), exports);
22
+ __exportStar(require("./collection/definition"), exports);
21
23
  __exportStar(require("./collection/interface"), exports);
22
24
  __exportStar(require("./collection/least-common-identifier"), exports);
23
25
  __exportStar(require("./definition/listable"), exports);
@@ -3,6 +3,21 @@
3
3
  * @namespace Origin
4
4
  * @description Definition
5
5
  */
6
+ import { ImbricateCapability } from "../capability/definition";
7
+ export type ImbricateOriginCapability = Record<IMBRICATE_ORIGIN_CAPABILITY_KEY, ImbricateCapability>;
8
+ export declare enum IMBRICATE_ORIGIN_CAPABILITY_KEY {
9
+ CREATE_COLLECTION = "imbricate.origin.collection.create",
10
+ RENAME_COLLECTION = "imbricate.origin.collection.rename",
11
+ DELETE_COLLECTION = "imbricate.origin.collection.delete",
12
+ GET_COLLECTION = "imbricate.origin.collection.get",
13
+ LIST_COLLECTIONS = "imbricate.origin.collection.list",
14
+ CREATE_SCRIPT = "imbricate.origin.script.create",
15
+ PUT_SCRIPT = "imbricate.origin.script.put",
16
+ RENAME_SCRIPT = "imbricate.origin.script.rename",
17
+ DELETE_SCRIPT = "imbricate.origin.script.delete",
18
+ GET_SCRIPT = "imbricate.origin.script.get",
19
+ LIST_SCRIPTS = "imbricate.origin.script.list"
20
+ }
6
21
  export declare enum IMBRICATE_DIGEST_ALGORITHM {
7
22
  MD5 = "MD5",
8
23
  SHA1 = "SHA1",
@@ -5,7 +5,21 @@
5
5
  * @description Definition
6
6
  */
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.IMBRICATE_DIGEST_ALGORITHM = void 0;
8
+ exports.IMBRICATE_DIGEST_ALGORITHM = exports.IMBRICATE_ORIGIN_CAPABILITY_KEY = void 0;
9
+ var IMBRICATE_ORIGIN_CAPABILITY_KEY;
10
+ (function (IMBRICATE_ORIGIN_CAPABILITY_KEY) {
11
+ IMBRICATE_ORIGIN_CAPABILITY_KEY["CREATE_COLLECTION"] = "imbricate.origin.collection.create";
12
+ IMBRICATE_ORIGIN_CAPABILITY_KEY["RENAME_COLLECTION"] = "imbricate.origin.collection.rename";
13
+ IMBRICATE_ORIGIN_CAPABILITY_KEY["DELETE_COLLECTION"] = "imbricate.origin.collection.delete";
14
+ IMBRICATE_ORIGIN_CAPABILITY_KEY["GET_COLLECTION"] = "imbricate.origin.collection.get";
15
+ IMBRICATE_ORIGIN_CAPABILITY_KEY["LIST_COLLECTIONS"] = "imbricate.origin.collection.list";
16
+ IMBRICATE_ORIGIN_CAPABILITY_KEY["CREATE_SCRIPT"] = "imbricate.origin.script.create";
17
+ IMBRICATE_ORIGIN_CAPABILITY_KEY["PUT_SCRIPT"] = "imbricate.origin.script.put";
18
+ IMBRICATE_ORIGIN_CAPABILITY_KEY["RENAME_SCRIPT"] = "imbricate.origin.script.rename";
19
+ IMBRICATE_ORIGIN_CAPABILITY_KEY["DELETE_SCRIPT"] = "imbricate.origin.script.delete";
20
+ IMBRICATE_ORIGIN_CAPABILITY_KEY["GET_SCRIPT"] = "imbricate.origin.script.get";
21
+ IMBRICATE_ORIGIN_CAPABILITY_KEY["LIST_SCRIPTS"] = "imbricate.origin.script.list";
22
+ })(IMBRICATE_ORIGIN_CAPABILITY_KEY || (exports.IMBRICATE_ORIGIN_CAPABILITY_KEY = IMBRICATE_ORIGIN_CAPABILITY_KEY = {}));
9
23
  var IMBRICATE_DIGEST_ALGORITHM;
10
24
  (function (IMBRICATE_DIGEST_ALGORITHM) {
11
25
  IMBRICATE_DIGEST_ALGORITHM["MD5"] = "MD5";
@@ -9,18 +9,17 @@ import { IImbricateFunctionManager } from "../function/interface";
9
9
  import { ImbricateScriptQuery, ImbricateScriptQueryConfig, ImbricateSearchScriptConfig } from "../query/script";
10
10
  import { ImbricateScriptMetadata, ImbricateScriptSearchResult, ImbricateScriptSnapshot } from "../script/definition";
11
11
  import { IImbricateScript } from "../script/interface";
12
- import { ImbricateOriginMetadata } from "./definition";
12
+ import { ImbricateOriginCapability, ImbricateOriginMetadata } from "./definition";
13
13
  export interface IImbricateOrigin {
14
14
  readonly metadata: ImbricateOriginMetadata;
15
15
  readonly payloads: Record<string, any>;
16
+ readonly capabilities: ImbricateOriginCapability;
16
17
  getFunctionManger(): IImbricateFunctionManager;
17
18
  createCollection(collectionName: string, description?: string): PromiseOr<void>;
18
19
  renameCollection(collectionName: string, newCollectionName: string): PromiseOr<void>;
19
20
  deleteCollection(collectionName: string): PromiseOr<void>;
20
21
  hasCollection(collectionName: string): PromiseOr<boolean>;
21
22
  getCollection(collectionName: string): PromiseOr<IImbricateOriginCollection | null>;
22
- includeCollectionInSearch(collectionName: string): PromiseOr<void>;
23
- excludeCollectionInSearch(collectionName: string): PromiseOr<void>;
24
23
  listCollections(): PromiseOr<IImbricateOriginCollection[]>;
25
24
  createScript(scriptName: string, initialScript: string, description?: string): PromiseOr<IImbricateScript>;
26
25
  putScript(scriptMetadata: ImbricateScriptMetadata, script: string): PromiseOr<IImbricateScript>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@imbricate/core",
3
3
  "main": "index.js",
4
- "version": "1.16.1",
4
+ "version": "1.17.0",
5
5
  "description": "Core for Imbricate",
6
6
  "repository": {
7
7
  "type": "git",
@@ -3,7 +3,17 @@
3
3
  * @namespace Page
4
4
  * @description Definition
5
5
  */
6
+ import { ImbricateCapability } from "../capability/definition";
6
7
  import { IMBRICATE_SEARCH_RESULT_TYPE, ImbricateSearchResult, ImbricateSearchSnippet } from "../search/snippet";
8
+ export type ImbricatePageCapability = Record<IMBRICATE_PAGE_CAPABILITY_KEY, ImbricateCapability>;
9
+ export declare enum IMBRICATE_PAGE_CAPABILITY_KEY {
10
+ READ = "imbricate.page.read",
11
+ WRITE = "imbricate.page.write",
12
+ READ_ATTRIBUTE = "imbricate.page.attribute.read",
13
+ WRITE_ATTRIBUTE = "imbricate.page.attribute.write",
14
+ UPDATE_METADATA = "imbricate.page.metadata.update",
15
+ UPDATE_HISTORY_RECORD = "imbricate.page.history.update"
16
+ }
7
17
  export type ImbricatePageAttributes = Record<string, string>;
8
18
  export type ImbricatePageSearchResult = ImbricateSearchResult<IMBRICATE_SEARCH_RESULT_TYPE.PAGE>;
9
19
  export type ImbricatePageSearchSnippet = ImbricateSearchSnippet<IMBRICATE_SEARCH_RESULT_TYPE.PAGE>;
@@ -5,3 +5,13 @@
5
5
  * @description Definition
6
6
  */
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.IMBRICATE_PAGE_CAPABILITY_KEY = void 0;
9
+ var IMBRICATE_PAGE_CAPABILITY_KEY;
10
+ (function (IMBRICATE_PAGE_CAPABILITY_KEY) {
11
+ IMBRICATE_PAGE_CAPABILITY_KEY["READ"] = "imbricate.page.read";
12
+ IMBRICATE_PAGE_CAPABILITY_KEY["WRITE"] = "imbricate.page.write";
13
+ IMBRICATE_PAGE_CAPABILITY_KEY["READ_ATTRIBUTE"] = "imbricate.page.attribute.read";
14
+ IMBRICATE_PAGE_CAPABILITY_KEY["WRITE_ATTRIBUTE"] = "imbricate.page.attribute.write";
15
+ IMBRICATE_PAGE_CAPABILITY_KEY["UPDATE_METADATA"] = "imbricate.page.metadata.update";
16
+ IMBRICATE_PAGE_CAPABILITY_KEY["UPDATE_HISTORY_RECORD"] = "imbricate.page.history.update";
17
+ })(IMBRICATE_PAGE_CAPABILITY_KEY || (exports.IMBRICATE_PAGE_CAPABILITY_KEY = IMBRICATE_PAGE_CAPABILITY_KEY = {}));
@@ -4,7 +4,7 @@
4
4
  * @description Interface
5
5
  */
6
6
  import { PromiseOr } from "../definition/promise";
7
- import { ImbricatePageAttributes, ImbricatePageHistoryRecord } from "./definition";
7
+ import { ImbricatePageAttributes, ImbricatePageCapability, ImbricatePageHistoryRecord } from "./definition";
8
8
  export interface IImbricatePage {
9
9
  readonly title: string;
10
10
  readonly directories: string[];
@@ -14,6 +14,7 @@ export interface IImbricatePage {
14
14
  readonly description?: string;
15
15
  readonly createdAt: Date;
16
16
  readonly updatedAt: Date;
17
+ readonly capabilities: ImbricatePageCapability;
17
18
  readContent(): PromiseOr<string>;
18
19
  writeContent(content: string): PromiseOr<void>;
19
20
  readAttributes(): PromiseOr<ImbricatePageAttributes>;
@@ -3,7 +3,18 @@
3
3
  * @namespace Script
4
4
  * @description Definition
5
5
  */
6
+ import { ImbricateCapability } from "../capability/definition";
6
7
  import { IMBRICATE_SEARCH_RESULT_TYPE, ImbricateSearchResult, ImbricateSearchSnippet } from "../search/snippet";
8
+ export type ImbricateScriptCapability = Record<IMBRICATE_SCRIPT_CAPABILITY_KEY, ImbricateCapability>;
9
+ export declare enum IMBRICATE_SCRIPT_CAPABILITY_KEY {
10
+ READ = "imbricate.script.read",
11
+ WRITE = "imbricate.script.write",
12
+ READ_ATTRIBUTE = "imbricate.script.attribute.read",
13
+ WRITE_ATTRIBUTE = "imbricate.script.attribute.write",
14
+ UPDATE_METADATA = "imbricate.script.metadata.update",
15
+ UPDATE_HISTORY_RECORD = "imbricate.script.history.update",
16
+ EXECUTE = "imbricate.script.execute"
17
+ }
7
18
  export type ImbricateScriptAttributes = Record<string, string>;
8
19
  export type ImbricateScriptSearchResult = ImbricateSearchResult<IMBRICATE_SEARCH_RESULT_TYPE.SCRIPT>;
9
20
  export type ImbricateScriptSearchSnippet = ImbricateSearchSnippet<IMBRICATE_SEARCH_RESULT_TYPE.SCRIPT>;
@@ -5,3 +5,14 @@
5
5
  * @description Definition
6
6
  */
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.IMBRICATE_SCRIPT_CAPABILITY_KEY = void 0;
9
+ var IMBRICATE_SCRIPT_CAPABILITY_KEY;
10
+ (function (IMBRICATE_SCRIPT_CAPABILITY_KEY) {
11
+ IMBRICATE_SCRIPT_CAPABILITY_KEY["READ"] = "imbricate.script.read";
12
+ IMBRICATE_SCRIPT_CAPABILITY_KEY["WRITE"] = "imbricate.script.write";
13
+ IMBRICATE_SCRIPT_CAPABILITY_KEY["READ_ATTRIBUTE"] = "imbricate.script.attribute.read";
14
+ IMBRICATE_SCRIPT_CAPABILITY_KEY["WRITE_ATTRIBUTE"] = "imbricate.script.attribute.write";
15
+ IMBRICATE_SCRIPT_CAPABILITY_KEY["UPDATE_METADATA"] = "imbricate.script.metadata.update";
16
+ IMBRICATE_SCRIPT_CAPABILITY_KEY["UPDATE_HISTORY_RECORD"] = "imbricate.script.history.update";
17
+ IMBRICATE_SCRIPT_CAPABILITY_KEY["EXECUTE"] = "imbricate.script.execute";
18
+ })(IMBRICATE_SCRIPT_CAPABILITY_KEY || (exports.IMBRICATE_SCRIPT_CAPABILITY_KEY = IMBRICATE_SCRIPT_CAPABILITY_KEY = {}));
@@ -7,7 +7,7 @@ import { MarkedResult } from "@sudoo/marked";
7
7
  import { PromiseOr } from "../definition/promise";
8
8
  import { SandboxExecuteConfig, SandboxExecuteParameter } from "../sandbox/definition/config";
9
9
  import { SandboxFeature } from "../sandbox/feature/feature";
10
- import { ImbricateScriptAttributes, ImbricateScriptHistoryRecord } from "./definition";
10
+ import { ImbricateScriptAttributes, ImbricateScriptCapability, ImbricateScriptHistoryRecord } from "./definition";
11
11
  export interface IImbricateScript {
12
12
  readonly scriptName: string;
13
13
  readonly identifier: string;
@@ -16,6 +16,7 @@ export interface IImbricateScript {
16
16
  readonly description?: string;
17
17
  readonly createdAt: Date;
18
18
  readonly updatedAt: Date;
19
+ readonly capabilities: ImbricateScriptCapability;
19
20
  readScript(): PromiseOr<string>;
20
21
  writeScript(script: string): PromiseOr<void>;
21
22
  readAttributes(): PromiseOr<ImbricateScriptAttributes>;