@imbricate/core 1.20.1 → 1.24.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.
Files changed (47) hide show
  1. package/binary-storage/base.d.ts +18 -0
  2. package/binary-storage/base.js +30 -0
  3. package/binary-storage/definition.d.ts +3 -3
  4. package/binary-storage/definition.js +4 -10
  5. package/binary-storage/interface.d.ts +5 -0
  6. package/capability/builder.d.ts +12 -0
  7. package/capability/builder.js +26 -0
  8. package/capability/create.d.ts +7 -0
  9. package/capability/create.js +16 -0
  10. package/capability/definition.d.ts +4 -0
  11. package/capability/definition.js +13 -1
  12. package/capability/validate.d.ts +2 -2
  13. package/collection/base.d.ts +31 -0
  14. package/collection/base.js +54 -0
  15. package/collection/definition.d.ts +2 -2
  16. package/collection/definition.js +9 -25
  17. package/collection/interface.d.ts +7 -7
  18. package/collection/interface.js +1 -1
  19. package/error/not-implemented.d.ts +2 -2
  20. package/error/not-implemented.js +7 -7
  21. package/function/base.d.ts +18 -0
  22. package/function/base.js +30 -0
  23. package/function/definition.d.ts +7 -0
  24. package/function/definition.js +17 -0
  25. package/function/interface.d.ts +5 -1
  26. package/index.d.ts +11 -0
  27. package/index.js +11 -0
  28. package/origin/base.d.ts +44 -0
  29. package/origin/base.js +78 -0
  30. package/origin/definition.d.ts +4 -0
  31. package/origin/definition.js +29 -1
  32. package/origin/interface.d.ts +6 -6
  33. package/package.json +1 -1
  34. package/page/base.d.ts +32 -0
  35. package/page/base.js +48 -0
  36. package/page/definition.d.ts +1 -0
  37. package/page/definition.js +9 -1
  38. package/script/base.d.ts +35 -0
  39. package/script/base.js +51 -0
  40. package/script/definition.d.ts +1 -0
  41. package/script/definition.js +10 -1
  42. package/trash/base.d.ts +20 -0
  43. package/trash/base.js +36 -0
  44. package/trash/definition.d.ts +26 -0
  45. package/trash/definition.js +39 -0
  46. package/trash/interface.d.ts +17 -0
  47. package/trash/interface.js +7 -0
@@ -0,0 +1,44 @@
1
+ /**
2
+ * @author WMXPY
3
+ * @namespace Origin
4
+ * @description Base
5
+ */
6
+ import type { IImbricateBinaryStorage } from "../binary-storage/interface";
7
+ import { ImbricateCapabilityBuilder } from "../capability/builder";
8
+ import { ImbricateCapability } from "../capability/definition";
9
+ import type { IImbricateCollection } from "../collection/interface";
10
+ import type { PromiseOr } from "../definition/promise";
11
+ import type { IImbricateFunctionManager } from "../function/interface";
12
+ import type { IImbricateOrigin } from "../origin/interface";
13
+ import { ImbricateScriptQuery, ImbricateScriptQueryConfig, ImbricateSearchScriptConfig } from "../query/script";
14
+ import { ImbricateScriptMetadata } from "../script/definition";
15
+ import type { IImbricateScript } from "../script/interface";
16
+ import { IMBRICATE_ORIGIN_CAPABILITY_KEY, ImbricateOriginCapability, ImbricateOriginMetadata } from "./definition";
17
+ export declare abstract class ImbricateOriginBase implements IImbricateOrigin {
18
+ static buildCapability(initial?: ImbricateCapability): ImbricateCapabilityBuilder<IMBRICATE_ORIGIN_CAPABILITY_KEY>;
19
+ static allAllowCapability(): ImbricateOriginCapability;
20
+ static allDenyCapability(): ImbricateOriginCapability;
21
+ abstract readonly originType: string;
22
+ abstract readonly uniqueIdentifier: string;
23
+ abstract readonly metadata: ImbricateOriginMetadata;
24
+ abstract readonly payloads: Record<string, any>;
25
+ abstract readonly capabilities: ImbricateOriginCapability;
26
+ getFunctionManager(): IImbricateFunctionManager;
27
+ getBinaryStorage(): IImbricateBinaryStorage;
28
+ createCollection(_collectionName: string, _description?: string): PromiseOr<IImbricateCollection>;
29
+ renameCollection(_collectionUniqueIdentifier: string, _newCollectionName: string): PromiseOr<void>;
30
+ deleteCollection(_collectionUniqueIdentifier: string): PromiseOr<void>;
31
+ hasCollection(_collectionName: string): PromiseOr<boolean>;
32
+ findCollection(_collectionName: string): PromiseOr<IImbricateCollection | null>;
33
+ getCollection(_collectionUniqueIdentifier: string): PromiseOr<IImbricateCollection | null>;
34
+ listCollections(): PromiseOr<IImbricateCollection[]>;
35
+ createScript(_scriptName: string, _initialScript: string, _description?: string): PromiseOr<IImbricateScript>;
36
+ putScript(_scriptMetadata: ImbricateScriptMetadata, _script: string): PromiseOr<IImbricateScript>;
37
+ renameScript(_identifier: string, _newScriptName: string): PromiseOr<void>;
38
+ deleteScript(_identifier: string): PromiseOr<void>;
39
+ hasScript(_scriptName: string): PromiseOr<boolean>;
40
+ getScript(_identifier: string): PromiseOr<IImbricateScript | null>;
41
+ listScripts(): PromiseOr<IImbricateScript[]>;
42
+ searchScripts(_keyword: string, _config: ImbricateSearchScriptConfig): PromiseOr<any[]>;
43
+ queryScripts(_query: ImbricateScriptQuery, _config: ImbricateScriptQueryConfig): PromiseOr<IImbricateScript[]>;
44
+ }
package/origin/base.js ADDED
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+ /**
3
+ * @author WMXPY
4
+ * @namespace Origin
5
+ * @description Base
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.ImbricateOriginBase = void 0;
9
+ const builder_1 = require("../capability/builder");
10
+ const definition_1 = require("../capability/definition");
11
+ const not_implemented_1 = require("../error/not-implemented");
12
+ const definition_2 = require("./definition");
13
+ class ImbricateOriginBase {
14
+ static buildCapability(initial = (0, definition_1.createDenyImbricateCapability)()) {
15
+ return builder_1.ImbricateCapabilityBuilder.create(definition_2.ImbricateOriginCapabilityList, initial);
16
+ }
17
+ static allAllowCapability() {
18
+ return this.buildCapability((0, definition_1.createAllowImbricateCapability)()).build();
19
+ }
20
+ static allDenyCapability() {
21
+ return this.buildCapability((0, definition_1.createDenyImbricateCapability)()).build();
22
+ }
23
+ getFunctionManager() {
24
+ throw not_implemented_1.ImbricateNotImplemented.create("GetFunctionManager", definition_2.IMBRICATE_ORIGIN_CAPABILITY_KEY.ORIGIN_FUNCTION);
25
+ }
26
+ getBinaryStorage() {
27
+ throw not_implemented_1.ImbricateNotImplemented.create("GetBinaryStorage", definition_2.IMBRICATE_ORIGIN_CAPABILITY_KEY.ORIGIN_BINARY_STORAGE);
28
+ }
29
+ createCollection(_collectionName, _description) {
30
+ throw not_implemented_1.ImbricateNotImplemented.create("CreateCollection", definition_2.IMBRICATE_ORIGIN_CAPABILITY_KEY.CREATE_COLLECTION);
31
+ }
32
+ renameCollection(_collectionUniqueIdentifier, _newCollectionName) {
33
+ throw not_implemented_1.ImbricateNotImplemented.create("RenameCollection", definition_2.IMBRICATE_ORIGIN_CAPABILITY_KEY.RENAME_COLLECTION);
34
+ }
35
+ deleteCollection(_collectionUniqueIdentifier) {
36
+ throw not_implemented_1.ImbricateNotImplemented.create("DeleteCollection", definition_2.IMBRICATE_ORIGIN_CAPABILITY_KEY.DELETE_COLLECTION);
37
+ }
38
+ hasCollection(_collectionName) {
39
+ throw not_implemented_1.ImbricateNotImplemented.create("HasCollection", definition_2.IMBRICATE_ORIGIN_CAPABILITY_KEY.LIST_COLLECTIONS);
40
+ }
41
+ findCollection(_collectionName) {
42
+ throw not_implemented_1.ImbricateNotImplemented.create("FindCollection", definition_2.IMBRICATE_ORIGIN_CAPABILITY_KEY.LIST_COLLECTIONS);
43
+ }
44
+ getCollection(_collectionUniqueIdentifier) {
45
+ throw not_implemented_1.ImbricateNotImplemented.create("GetCollection", definition_2.IMBRICATE_ORIGIN_CAPABILITY_KEY.GET_COLLECTION);
46
+ }
47
+ listCollections() {
48
+ throw not_implemented_1.ImbricateNotImplemented.create("ListCollections", definition_2.IMBRICATE_ORIGIN_CAPABILITY_KEY.LIST_COLLECTIONS);
49
+ }
50
+ createScript(_scriptName, _initialScript, _description) {
51
+ throw not_implemented_1.ImbricateNotImplemented.create("CreateScript", definition_2.IMBRICATE_ORIGIN_CAPABILITY_KEY.CREATE_SCRIPT);
52
+ }
53
+ putScript(_scriptMetadata, _script) {
54
+ throw not_implemented_1.ImbricateNotImplemented.create("PutScript", definition_2.IMBRICATE_ORIGIN_CAPABILITY_KEY.PUT_SCRIPT);
55
+ }
56
+ renameScript(_identifier, _newScriptName) {
57
+ throw not_implemented_1.ImbricateNotImplemented.create("RenameScript", definition_2.IMBRICATE_ORIGIN_CAPABILITY_KEY.RENAME_SCRIPT);
58
+ }
59
+ deleteScript(_identifier) {
60
+ throw not_implemented_1.ImbricateNotImplemented.create("DeleteScript", definition_2.IMBRICATE_ORIGIN_CAPABILITY_KEY.DELETE_SCRIPT);
61
+ }
62
+ hasScript(_scriptName) {
63
+ throw not_implemented_1.ImbricateNotImplemented.create("HasScript", definition_2.IMBRICATE_ORIGIN_CAPABILITY_KEY.LIST_SCRIPTS);
64
+ }
65
+ getScript(_identifier) {
66
+ throw not_implemented_1.ImbricateNotImplemented.create("GetScript", definition_2.IMBRICATE_ORIGIN_CAPABILITY_KEY.GET_SCRIPT);
67
+ }
68
+ listScripts() {
69
+ throw not_implemented_1.ImbricateNotImplemented.create("ListScripts", definition_2.IMBRICATE_ORIGIN_CAPABILITY_KEY.LIST_SCRIPTS);
70
+ }
71
+ searchScripts(_keyword, _config) {
72
+ throw not_implemented_1.ImbricateNotImplemented.create("SearchScripts", definition_2.IMBRICATE_ORIGIN_CAPABILITY_KEY.LIST_SCRIPTS);
73
+ }
74
+ queryScripts(_query, _config) {
75
+ throw not_implemented_1.ImbricateNotImplemented.create("QueryScripts", definition_2.IMBRICATE_ORIGIN_CAPABILITY_KEY.LIST_SCRIPTS);
76
+ }
77
+ }
78
+ exports.ImbricateOriginBase = ImbricateOriginBase;
@@ -14,6 +14,9 @@ export type ImbricateOriginMetadata = {
14
14
  };
15
15
  export type ImbricateOriginCapability = Record<IMBRICATE_ORIGIN_CAPABILITY_KEY, ImbricateCapability>;
16
16
  export declare enum IMBRICATE_ORIGIN_CAPABILITY_KEY {
17
+ ORIGIN_FUNCTION = "imbricate.origin.function",
18
+ ORIGIN_BINARY_STORAGE = "imbricate.origin.binary-storage",
19
+ ORIGIN_TRASH_STASH = "imbricate.origin.trash-stash",
17
20
  CREATE_COLLECTION = "imbricate.origin.collection.create",
18
21
  RENAME_COLLECTION = "imbricate.origin.collection.rename",
19
22
  DELETE_COLLECTION = "imbricate.origin.collection.delete",
@@ -26,4 +29,5 @@ export declare enum IMBRICATE_ORIGIN_CAPABILITY_KEY {
26
29
  GET_SCRIPT = "imbricate.origin.script.get",
27
30
  LIST_SCRIPTS = "imbricate.origin.script.list"
28
31
  }
32
+ export declare const ImbricateOriginCapabilityList: IMBRICATE_ORIGIN_CAPABILITY_KEY[];
29
33
  export declare const createAllAllowImbricateOriginCapability: () => ImbricateOriginCapability;
@@ -5,7 +5,7 @@
5
5
  * @description Definition
6
6
  */
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.createAllAllowImbricateOriginCapability = exports.IMBRICATE_ORIGIN_CAPABILITY_KEY = exports.IMBRICATE_DIGEST_ALGORITHM = void 0;
8
+ exports.createAllAllowImbricateOriginCapability = exports.ImbricateOriginCapabilityList = exports.IMBRICATE_ORIGIN_CAPABILITY_KEY = exports.IMBRICATE_DIGEST_ALGORITHM = void 0;
9
9
  const definition_1 = require("../capability/definition");
10
10
  var IMBRICATE_DIGEST_ALGORITHM;
11
11
  (function (IMBRICATE_DIGEST_ALGORITHM) {
@@ -15,6 +15,9 @@ var IMBRICATE_DIGEST_ALGORITHM;
15
15
  })(IMBRICATE_DIGEST_ALGORITHM || (exports.IMBRICATE_DIGEST_ALGORITHM = IMBRICATE_DIGEST_ALGORITHM = {}));
16
16
  var IMBRICATE_ORIGIN_CAPABILITY_KEY;
17
17
  (function (IMBRICATE_ORIGIN_CAPABILITY_KEY) {
18
+ IMBRICATE_ORIGIN_CAPABILITY_KEY["ORIGIN_FUNCTION"] = "imbricate.origin.function";
19
+ IMBRICATE_ORIGIN_CAPABILITY_KEY["ORIGIN_BINARY_STORAGE"] = "imbricate.origin.binary-storage";
20
+ IMBRICATE_ORIGIN_CAPABILITY_KEY["ORIGIN_TRASH_STASH"] = "imbricate.origin.trash-stash";
18
21
  IMBRICATE_ORIGIN_CAPABILITY_KEY["CREATE_COLLECTION"] = "imbricate.origin.collection.create";
19
22
  IMBRICATE_ORIGIN_CAPABILITY_KEY["RENAME_COLLECTION"] = "imbricate.origin.collection.rename";
20
23
  IMBRICATE_ORIGIN_CAPABILITY_KEY["DELETE_COLLECTION"] = "imbricate.origin.collection.delete";
@@ -27,8 +30,33 @@ var IMBRICATE_ORIGIN_CAPABILITY_KEY;
27
30
  IMBRICATE_ORIGIN_CAPABILITY_KEY["GET_SCRIPT"] = "imbricate.origin.script.get";
28
31
  IMBRICATE_ORIGIN_CAPABILITY_KEY["LIST_SCRIPTS"] = "imbricate.origin.script.list";
29
32
  })(IMBRICATE_ORIGIN_CAPABILITY_KEY || (exports.IMBRICATE_ORIGIN_CAPABILITY_KEY = IMBRICATE_ORIGIN_CAPABILITY_KEY = {}));
33
+ exports.ImbricateOriginCapabilityList = [
34
+ IMBRICATE_ORIGIN_CAPABILITY_KEY.ORIGIN_FUNCTION,
35
+ IMBRICATE_ORIGIN_CAPABILITY_KEY.ORIGIN_BINARY_STORAGE,
36
+ IMBRICATE_ORIGIN_CAPABILITY_KEY.ORIGIN_TRASH_STASH,
37
+ IMBRICATE_ORIGIN_CAPABILITY_KEY.CREATE_COLLECTION,
38
+ IMBRICATE_ORIGIN_CAPABILITY_KEY.RENAME_COLLECTION,
39
+ IMBRICATE_ORIGIN_CAPABILITY_KEY.DELETE_COLLECTION,
40
+ IMBRICATE_ORIGIN_CAPABILITY_KEY.GET_COLLECTION,
41
+ IMBRICATE_ORIGIN_CAPABILITY_KEY.LIST_COLLECTIONS,
42
+ IMBRICATE_ORIGIN_CAPABILITY_KEY.CREATE_SCRIPT,
43
+ IMBRICATE_ORIGIN_CAPABILITY_KEY.PUT_SCRIPT,
44
+ IMBRICATE_ORIGIN_CAPABILITY_KEY.RENAME_SCRIPT,
45
+ IMBRICATE_ORIGIN_CAPABILITY_KEY.DELETE_SCRIPT,
46
+ IMBRICATE_ORIGIN_CAPABILITY_KEY.GET_SCRIPT,
47
+ IMBRICATE_ORIGIN_CAPABILITY_KEY.LIST_SCRIPTS,
48
+ ];
30
49
  const createAllAllowImbricateOriginCapability = () => {
31
50
  return {
51
+ [IMBRICATE_ORIGIN_CAPABILITY_KEY.ORIGIN_FUNCTION]: {
52
+ effect: definition_1.IMBRICATE_CAPABILITY_EFFECT.ALLOW,
53
+ },
54
+ [IMBRICATE_ORIGIN_CAPABILITY_KEY.ORIGIN_BINARY_STORAGE]: {
55
+ effect: definition_1.IMBRICATE_CAPABILITY_EFFECT.ALLOW,
56
+ },
57
+ [IMBRICATE_ORIGIN_CAPABILITY_KEY.ORIGIN_TRASH_STASH]: {
58
+ effect: definition_1.IMBRICATE_CAPABILITY_EFFECT.ALLOW,
59
+ },
32
60
  [IMBRICATE_ORIGIN_CAPABILITY_KEY.CREATE_COLLECTION]: {
33
61
  effect: definition_1.IMBRICATE_CAPABILITY_EFFECT.ALLOW,
34
62
  },
@@ -4,7 +4,7 @@
4
4
  * @description Interface
5
5
  */
6
6
  import { IImbricateBinaryStorage } from "../binary-storage/interface";
7
- import { IImbricateOriginCollection } from "../collection/interface";
7
+ import type { IImbricateCollection } from "../collection/interface";
8
8
  import { PromiseOr } from "../definition/promise";
9
9
  import { IImbricateFunctionManager } from "../function/interface";
10
10
  import { ImbricateScriptQuery, ImbricateScriptQueryConfig, ImbricateSearchScriptConfig } from "../query/script";
@@ -37,7 +37,7 @@ export interface IImbricateOrigin {
37
37
  *
38
38
  * @returns Function manager
39
39
  */
40
- getFunctionManger(): IImbricateFunctionManager;
40
+ getFunctionManager(): IImbricateFunctionManager;
41
41
  /**
42
42
  * Get binary storage
43
43
  *
@@ -52,13 +52,13 @@ export interface IImbricateOrigin {
52
52
  *
53
53
  * @returns Created collection
54
54
  */
55
- createCollection(collectionName: string, description?: string): PromiseOr<IImbricateOriginCollection>;
55
+ createCollection(collectionName: string, description?: string): PromiseOr<IImbricateCollection>;
56
56
  renameCollection(collectionUniqueIdentifier: string, newCollectionName: string): PromiseOr<void>;
57
57
  deleteCollection(collectionUniqueIdentifier: string): PromiseOr<void>;
58
58
  hasCollection(collectionName: string): PromiseOr<boolean>;
59
- findCollection(collectionName: string): PromiseOr<IImbricateOriginCollection | null>;
60
- getCollection(collectionUniqueIdentifier: string): PromiseOr<IImbricateOriginCollection | null>;
61
- listCollections(): PromiseOr<IImbricateOriginCollection[]>;
59
+ findCollection(collectionName: string): PromiseOr<IImbricateCollection | null>;
60
+ getCollection(collectionUniqueIdentifier: string): PromiseOr<IImbricateCollection | null>;
61
+ listCollections(): PromiseOr<IImbricateCollection[]>;
62
62
  /**
63
63
  * Create a script
64
64
  *
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@imbricate/core",
3
3
  "main": "index.js",
4
- "version": "1.20.1",
4
+ "version": "1.24.0",
5
5
  "description": "Imbricate Core, Notebook for Engineers",
6
6
  "repository": {
7
7
  "type": "git",
package/page/base.d.ts ADDED
@@ -0,0 +1,32 @@
1
+ /**
2
+ * @author WMXPY
3
+ * @namespace Page
4
+ * @description Base
5
+ */
6
+ import { ImbricateCapabilityBuilder } from "../capability/builder";
7
+ import { ImbricateCapability } from "../capability/definition";
8
+ import type { PromiseOr } from "../definition/promise";
9
+ import { IMBRICATE_PAGE_CAPABILITY_KEY, ImbricatePageCapability, ImbricatePageHistoryRecord } from "./definition";
10
+ import type { IImbricatePage } from "./interface";
11
+ export declare abstract class ImbricatePageBase implements IImbricatePage {
12
+ static buildCapability(initial?: ImbricateCapability): ImbricateCapabilityBuilder<IMBRICATE_PAGE_CAPABILITY_KEY>;
13
+ static allAllowCapability(): ImbricatePageCapability;
14
+ static allDenyCapability(): ImbricatePageCapability;
15
+ abstract readonly title: string;
16
+ abstract readonly directories: string[];
17
+ abstract readonly identifier: string;
18
+ abstract readonly digest: string;
19
+ abstract readonly historyRecords: ImbricatePageHistoryRecord[];
20
+ abstract readonly description?: string;
21
+ abstract readonly createdAt: Date;
22
+ abstract readonly updatedAt: Date;
23
+ abstract readonly capabilities: ImbricatePageCapability;
24
+ readContent(): PromiseOr<string>;
25
+ writeContent(_content: string): PromiseOr<void>;
26
+ readAttributes(): PromiseOr<Record<string, string>>;
27
+ writeAttribute(_key: string, _value: string): PromiseOr<void>;
28
+ refreshUpdateMetadata(_updatedAt: Date, _digest: string): PromiseOr<void>;
29
+ refreshUpdatedAt(_updatedAt: Date): PromiseOr<void>;
30
+ refreshDigest(_digest: string): PromiseOr<void>;
31
+ addHistoryRecord(_record: ImbricatePageHistoryRecord): PromiseOr<void>;
32
+ }
package/page/base.js ADDED
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ /**
3
+ * @author WMXPY
4
+ * @namespace Page
5
+ * @description Base
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.ImbricatePageBase = void 0;
9
+ const builder_1 = require("../capability/builder");
10
+ const definition_1 = require("../capability/definition");
11
+ const not_implemented_1 = require("../error/not-implemented");
12
+ const definition_2 = require("./definition");
13
+ class ImbricatePageBase {
14
+ static buildCapability(initial = (0, definition_1.createDenyImbricateCapability)()) {
15
+ return builder_1.ImbricateCapabilityBuilder.create(definition_2.ImbricatePageCapabilityList, initial);
16
+ }
17
+ static allAllowCapability() {
18
+ return this.buildCapability((0, definition_1.createAllowImbricateCapability)()).build();
19
+ }
20
+ static allDenyCapability() {
21
+ return this.buildCapability((0, definition_1.createDenyImbricateCapability)()).build();
22
+ }
23
+ readContent() {
24
+ throw not_implemented_1.ImbricateNotImplemented.create("ReadContent", definition_2.IMBRICATE_PAGE_CAPABILITY_KEY.READ);
25
+ }
26
+ writeContent(_content) {
27
+ throw not_implemented_1.ImbricateNotImplemented.create("WriteContent", definition_2.IMBRICATE_PAGE_CAPABILITY_KEY.WRITE);
28
+ }
29
+ readAttributes() {
30
+ throw not_implemented_1.ImbricateNotImplemented.create("ReadAttributes", definition_2.IMBRICATE_PAGE_CAPABILITY_KEY.READ_ATTRIBUTE);
31
+ }
32
+ writeAttribute(_key, _value) {
33
+ throw not_implemented_1.ImbricateNotImplemented.create("WriteAttribute", definition_2.IMBRICATE_PAGE_CAPABILITY_KEY.WRITE_ATTRIBUTE);
34
+ }
35
+ refreshUpdateMetadata(_updatedAt, _digest) {
36
+ throw not_implemented_1.ImbricateNotImplemented.create("RefreshUpdateMetadata", definition_2.IMBRICATE_PAGE_CAPABILITY_KEY.UPDATE_METADATA);
37
+ }
38
+ refreshUpdatedAt(_updatedAt) {
39
+ throw not_implemented_1.ImbricateNotImplemented.create("RefreshUpdatedAt", definition_2.IMBRICATE_PAGE_CAPABILITY_KEY.UPDATE_METADATA);
40
+ }
41
+ refreshDigest(_digest) {
42
+ throw not_implemented_1.ImbricateNotImplemented.create("RefreshDigest", definition_2.IMBRICATE_PAGE_CAPABILITY_KEY.UPDATE_METADATA);
43
+ }
44
+ addHistoryRecord(_record) {
45
+ throw not_implemented_1.ImbricateNotImplemented.create("AddHistoryRecord", definition_2.IMBRICATE_PAGE_CAPABILITY_KEY.UPDATE_HISTORY_RECORD);
46
+ }
47
+ }
48
+ exports.ImbricatePageBase = ImbricatePageBase;
@@ -33,4 +33,5 @@ export declare enum IMBRICATE_PAGE_CAPABILITY_KEY {
33
33
  UPDATE_METADATA = "imbricate.page.metadata.update",
34
34
  UPDATE_HISTORY_RECORD = "imbricate.page.history.update"
35
35
  }
36
+ export declare const ImbricatePageCapabilityList: IMBRICATE_PAGE_CAPABILITY_KEY[];
36
37
  export declare const createAllAllowImbricatePageCapability: () => ImbricatePageCapability;
@@ -5,7 +5,7 @@
5
5
  * @description Definition
6
6
  */
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.createAllAllowImbricatePageCapability = exports.IMBRICATE_PAGE_CAPABILITY_KEY = void 0;
8
+ exports.createAllAllowImbricatePageCapability = exports.ImbricatePageCapabilityList = exports.IMBRICATE_PAGE_CAPABILITY_KEY = void 0;
9
9
  const definition_1 = require("../capability/definition");
10
10
  var IMBRICATE_PAGE_CAPABILITY_KEY;
11
11
  (function (IMBRICATE_PAGE_CAPABILITY_KEY) {
@@ -16,6 +16,14 @@ var IMBRICATE_PAGE_CAPABILITY_KEY;
16
16
  IMBRICATE_PAGE_CAPABILITY_KEY["UPDATE_METADATA"] = "imbricate.page.metadata.update";
17
17
  IMBRICATE_PAGE_CAPABILITY_KEY["UPDATE_HISTORY_RECORD"] = "imbricate.page.history.update";
18
18
  })(IMBRICATE_PAGE_CAPABILITY_KEY || (exports.IMBRICATE_PAGE_CAPABILITY_KEY = IMBRICATE_PAGE_CAPABILITY_KEY = {}));
19
+ exports.ImbricatePageCapabilityList = [
20
+ IMBRICATE_PAGE_CAPABILITY_KEY.READ,
21
+ IMBRICATE_PAGE_CAPABILITY_KEY.WRITE,
22
+ IMBRICATE_PAGE_CAPABILITY_KEY.READ_ATTRIBUTE,
23
+ IMBRICATE_PAGE_CAPABILITY_KEY.WRITE_ATTRIBUTE,
24
+ IMBRICATE_PAGE_CAPABILITY_KEY.UPDATE_METADATA,
25
+ IMBRICATE_PAGE_CAPABILITY_KEY.UPDATE_HISTORY_RECORD,
26
+ ];
19
27
  const createAllAllowImbricatePageCapability = () => {
20
28
  return {
21
29
  [IMBRICATE_PAGE_CAPABILITY_KEY.READ]: {
@@ -0,0 +1,35 @@
1
+ /**
2
+ * @author WMXPY
3
+ * @namespace Script
4
+ * @description Base
5
+ */
6
+ import type { MarkedResult } from "@sudoo/marked";
7
+ import { ImbricateCapabilityBuilder } from "../capability/builder";
8
+ import { ImbricateCapability } from "../capability/definition";
9
+ import type { PromiseOr } from "../definition/promise";
10
+ import type { SandboxExecuteConfig, SandboxExecuteParameter } from "../sandbox/definition/config";
11
+ import type { SandboxFeature } from "../sandbox/feature/feature";
12
+ import { IMBRICATE_SCRIPT_CAPABILITY_KEY, ImbricateScriptAttributes, ImbricateScriptCapability, ImbricateScriptHistoryRecord } from "./definition";
13
+ import type { IImbricateScript } from "./interface";
14
+ export declare abstract class ImbricateScriptBase implements IImbricateScript {
15
+ static buildCapability(initial?: ImbricateCapability): ImbricateCapabilityBuilder<IMBRICATE_SCRIPT_CAPABILITY_KEY>;
16
+ static allAllowCapability(): ImbricateScriptCapability;
17
+ static allDenyCapability(): ImbricateScriptCapability;
18
+ abstract readonly scriptName: string;
19
+ abstract readonly identifier: string;
20
+ abstract readonly digest: string;
21
+ abstract readonly historyRecords: ImbricateScriptHistoryRecord[];
22
+ abstract readonly description?: string;
23
+ abstract readonly createdAt: Date;
24
+ abstract readonly updatedAt: Date;
25
+ abstract readonly capabilities: ImbricateScriptCapability;
26
+ readScript(): PromiseOr<string>;
27
+ writeScript(_script: string): PromiseOr<void>;
28
+ readAttributes(): PromiseOr<ImbricateScriptAttributes>;
29
+ writeAttribute(_key: string, _value: string): PromiseOr<void>;
30
+ refreshUpdateMetadata(_updatedAt: Date, _digest: string): PromiseOr<void>;
31
+ refreshUpdatedAt(_updatedAt: Date): PromiseOr<void>;
32
+ refreshDigest(_digest: string): PromiseOr<void>;
33
+ addHistoryRecord(_record: ImbricateScriptHistoryRecord): PromiseOr<void>;
34
+ execute(_features: SandboxFeature[], _config: SandboxExecuteConfig, _parameter: SandboxExecuteParameter): PromiseOr<MarkedResult>;
35
+ }
package/script/base.js ADDED
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ /**
3
+ * @author WMXPY
4
+ * @namespace Script
5
+ * @description Base
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.ImbricateScriptBase = void 0;
9
+ const builder_1 = require("../capability/builder");
10
+ const definition_1 = require("../capability/definition");
11
+ const not_implemented_1 = require("../error/not-implemented");
12
+ const definition_2 = require("./definition");
13
+ class ImbricateScriptBase {
14
+ static buildCapability(initial = (0, definition_1.createDenyImbricateCapability)()) {
15
+ return builder_1.ImbricateCapabilityBuilder.create(definition_2.ImbricateScriptCapabilityList, initial);
16
+ }
17
+ static allAllowCapability() {
18
+ return this.buildCapability((0, definition_1.createAllowImbricateCapability)()).build();
19
+ }
20
+ static allDenyCapability() {
21
+ return this.buildCapability((0, definition_1.createDenyImbricateCapability)()).build();
22
+ }
23
+ readScript() {
24
+ throw not_implemented_1.ImbricateNotImplemented.create("ReadScript", definition_2.IMBRICATE_SCRIPT_CAPABILITY_KEY.READ);
25
+ }
26
+ writeScript(_script) {
27
+ throw not_implemented_1.ImbricateNotImplemented.create("WriteScript", definition_2.IMBRICATE_SCRIPT_CAPABILITY_KEY.WRITE);
28
+ }
29
+ readAttributes() {
30
+ throw not_implemented_1.ImbricateNotImplemented.create("ReadAttributes", definition_2.IMBRICATE_SCRIPT_CAPABILITY_KEY.READ_ATTRIBUTE);
31
+ }
32
+ writeAttribute(_key, _value) {
33
+ throw not_implemented_1.ImbricateNotImplemented.create("WriteAttribute", definition_2.IMBRICATE_SCRIPT_CAPABILITY_KEY.WRITE_ATTRIBUTE);
34
+ }
35
+ refreshUpdateMetadata(_updatedAt, _digest) {
36
+ throw not_implemented_1.ImbricateNotImplemented.create("RefreshUpdateMetadata", definition_2.IMBRICATE_SCRIPT_CAPABILITY_KEY.UPDATE_METADATA);
37
+ }
38
+ refreshUpdatedAt(_updatedAt) {
39
+ throw not_implemented_1.ImbricateNotImplemented.create("RefreshUpdatedAt", definition_2.IMBRICATE_SCRIPT_CAPABILITY_KEY.UPDATE_METADATA);
40
+ }
41
+ refreshDigest(_digest) {
42
+ throw not_implemented_1.ImbricateNotImplemented.create("RefreshDigest", definition_2.IMBRICATE_SCRIPT_CAPABILITY_KEY.UPDATE_METADATA);
43
+ }
44
+ addHistoryRecord(_record) {
45
+ throw not_implemented_1.ImbricateNotImplemented.create("AddHistoryRecord", definition_2.IMBRICATE_SCRIPT_CAPABILITY_KEY.UPDATE_HISTORY_RECORD);
46
+ }
47
+ execute(_features, _config, _parameter) {
48
+ throw not_implemented_1.ImbricateNotImplemented.create("Execute", definition_2.IMBRICATE_SCRIPT_CAPABILITY_KEY.EXECUTE);
49
+ }
50
+ }
51
+ exports.ImbricateScriptBase = ImbricateScriptBase;
@@ -33,4 +33,5 @@ export declare enum IMBRICATE_SCRIPT_CAPABILITY_KEY {
33
33
  UPDATE_HISTORY_RECORD = "imbricate.script.history.update",
34
34
  EXECUTE = "imbricate.script.execute"
35
35
  }
36
+ export declare const ImbricateScriptCapabilityList: IMBRICATE_SCRIPT_CAPABILITY_KEY[];
36
37
  export declare const createAllAllowImbricateScriptCapability: () => ImbricateScriptCapability;
@@ -5,7 +5,7 @@
5
5
  * @description Definition
6
6
  */
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.createAllAllowImbricateScriptCapability = exports.IMBRICATE_SCRIPT_CAPABILITY_KEY = void 0;
8
+ exports.createAllAllowImbricateScriptCapability = exports.ImbricateScriptCapabilityList = exports.IMBRICATE_SCRIPT_CAPABILITY_KEY = void 0;
9
9
  const definition_1 = require("../capability/definition");
10
10
  var IMBRICATE_SCRIPT_CAPABILITY_KEY;
11
11
  (function (IMBRICATE_SCRIPT_CAPABILITY_KEY) {
@@ -17,6 +17,15 @@ var IMBRICATE_SCRIPT_CAPABILITY_KEY;
17
17
  IMBRICATE_SCRIPT_CAPABILITY_KEY["UPDATE_HISTORY_RECORD"] = "imbricate.script.history.update";
18
18
  IMBRICATE_SCRIPT_CAPABILITY_KEY["EXECUTE"] = "imbricate.script.execute";
19
19
  })(IMBRICATE_SCRIPT_CAPABILITY_KEY || (exports.IMBRICATE_SCRIPT_CAPABILITY_KEY = IMBRICATE_SCRIPT_CAPABILITY_KEY = {}));
20
+ exports.ImbricateScriptCapabilityList = [
21
+ IMBRICATE_SCRIPT_CAPABILITY_KEY.READ,
22
+ IMBRICATE_SCRIPT_CAPABILITY_KEY.WRITE,
23
+ IMBRICATE_SCRIPT_CAPABILITY_KEY.READ_ATTRIBUTE,
24
+ IMBRICATE_SCRIPT_CAPABILITY_KEY.WRITE_ATTRIBUTE,
25
+ IMBRICATE_SCRIPT_CAPABILITY_KEY.UPDATE_METADATA,
26
+ IMBRICATE_SCRIPT_CAPABILITY_KEY.UPDATE_HISTORY_RECORD,
27
+ IMBRICATE_SCRIPT_CAPABILITY_KEY.EXECUTE,
28
+ ];
20
29
  const createAllAllowImbricateScriptCapability = () => {
21
30
  return {
22
31
  [IMBRICATE_SCRIPT_CAPABILITY_KEY.READ]: {
@@ -0,0 +1,20 @@
1
+ /**
2
+ * @author WMXPY
3
+ * @namespace Trash
4
+ * @description Base
5
+ */
6
+ import { ImbricateCapabilityBuilder } from "../capability/builder";
7
+ import { ImbricateCapability } from "../capability/definition";
8
+ import type { PromiseOr } from "../definition/promise";
9
+ import { IMBRICATE_TRASH_STASH_CAPABILITY_KEY, ImbricateTrashStashCapability, ImbricateVacantPage, ImbricateVacantScript } from "./definition";
10
+ import type { IImbricateTrashStash } from "./interface";
11
+ export declare abstract class ImbricateTrashStashBase implements IImbricateTrashStash {
12
+ static buildCapability(initial?: ImbricateCapability): ImbricateCapabilityBuilder<IMBRICATE_TRASH_STASH_CAPABILITY_KEY>;
13
+ static allAllowCapability(): ImbricateTrashStashCapability;
14
+ static allDenyCapability(): ImbricateTrashStashCapability;
15
+ abstract readonly capabilities: ImbricateTrashStashCapability;
16
+ tossPage(_page: ImbricateVacantPage): PromiseOr<void>;
17
+ retrievePage(_collectionUniqueIdentifier: string, _pageIdentifier: string): PromiseOr<ImbricateVacantPage | null>;
18
+ tossScript(_script: ImbricateVacantScript): PromiseOr<void>;
19
+ retrieveScript(_scriptIdentifier: string): PromiseOr<ImbricateVacantScript | null>;
20
+ }
package/trash/base.js ADDED
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ /**
3
+ * @author WMXPY
4
+ * @namespace Trash
5
+ * @description Base
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.ImbricateTrashStashBase = void 0;
9
+ const builder_1 = require("../capability/builder");
10
+ const definition_1 = require("../capability/definition");
11
+ const not_implemented_1 = require("../error/not-implemented");
12
+ const definition_2 = require("./definition");
13
+ class ImbricateTrashStashBase {
14
+ static buildCapability(initial = (0, definition_1.createDenyImbricateCapability)()) {
15
+ return builder_1.ImbricateCapabilityBuilder.create(definition_2.ImbricateTrashStashCapabilityList, initial);
16
+ }
17
+ static allAllowCapability() {
18
+ return this.buildCapability((0, definition_1.createAllowImbricateCapability)()).build();
19
+ }
20
+ static allDenyCapability() {
21
+ return this.buildCapability((0, definition_1.createDenyImbricateCapability)()).build();
22
+ }
23
+ tossPage(_page) {
24
+ throw not_implemented_1.ImbricateNotImplemented.create("TossPage", definition_2.IMBRICATE_TRASH_STASH_CAPABILITY_KEY.TOSS_PAGE);
25
+ }
26
+ retrievePage(_collectionUniqueIdentifier, _pageIdentifier) {
27
+ throw not_implemented_1.ImbricateNotImplemented.create("RetrievePage", definition_2.IMBRICATE_TRASH_STASH_CAPABILITY_KEY.RETRIEVE_PAGE);
28
+ }
29
+ tossScript(_script) {
30
+ throw not_implemented_1.ImbricateNotImplemented.create("TossScript", definition_2.IMBRICATE_TRASH_STASH_CAPABILITY_KEY.TOSS_SCRIPT);
31
+ }
32
+ retrieveScript(_scriptIdentifier) {
33
+ throw not_implemented_1.ImbricateNotImplemented.create("RetrieveScript", definition_2.IMBRICATE_TRASH_STASH_CAPABILITY_KEY.RETRIEVE_SCRIPT);
34
+ }
35
+ }
36
+ exports.ImbricateTrashStashBase = ImbricateTrashStashBase;
@@ -0,0 +1,26 @@
1
+ /**
2
+ * @author WMXPY
3
+ * @namespace Trash
4
+ * @description Definition
5
+ */
6
+ import { ImbricateCapabilityRecord } from "../capability/definition";
7
+ export type ImbricateVacantPage = {
8
+ readonly collectionUniqueIdentifier: string;
9
+ readonly pageIdentifier: string;
10
+ readonly contentDigest: string;
11
+ readonly content: string;
12
+ };
13
+ export type ImbricateVacantScript = {
14
+ readonly scriptIdentifier: string;
15
+ readonly scriptDigest: string;
16
+ readonly script: string;
17
+ };
18
+ export type ImbricateTrashStashCapability = ImbricateCapabilityRecord<IMBRICATE_TRASH_STASH_CAPABILITY_KEY>;
19
+ export declare enum IMBRICATE_TRASH_STASH_CAPABILITY_KEY {
20
+ TOSS_PAGE = "imbricate.trash-stash.page.toss",
21
+ RETRIEVE_PAGE = "imbricate.trash-stash.page.retrieve",
22
+ TOSS_SCRIPT = "imbricate.trash-stash.script.toss",
23
+ RETRIEVE_SCRIPT = "imbricate.trash-stash.script.retrieve"
24
+ }
25
+ export declare const ImbricateTrashStashCapabilityList: IMBRICATE_TRASH_STASH_CAPABILITY_KEY[];
26
+ export declare const createAllAllowImbricateTrashStashCapability: () => ImbricateTrashStashCapability;
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ /**
3
+ * @author WMXPY
4
+ * @namespace Trash
5
+ * @description Definition
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.createAllAllowImbricateTrashStashCapability = exports.ImbricateTrashStashCapabilityList = exports.IMBRICATE_TRASH_STASH_CAPABILITY_KEY = void 0;
9
+ const definition_1 = require("../capability/definition");
10
+ var IMBRICATE_TRASH_STASH_CAPABILITY_KEY;
11
+ (function (IMBRICATE_TRASH_STASH_CAPABILITY_KEY) {
12
+ IMBRICATE_TRASH_STASH_CAPABILITY_KEY["TOSS_PAGE"] = "imbricate.trash-stash.page.toss";
13
+ IMBRICATE_TRASH_STASH_CAPABILITY_KEY["RETRIEVE_PAGE"] = "imbricate.trash-stash.page.retrieve";
14
+ IMBRICATE_TRASH_STASH_CAPABILITY_KEY["TOSS_SCRIPT"] = "imbricate.trash-stash.script.toss";
15
+ IMBRICATE_TRASH_STASH_CAPABILITY_KEY["RETRIEVE_SCRIPT"] = "imbricate.trash-stash.script.retrieve";
16
+ })(IMBRICATE_TRASH_STASH_CAPABILITY_KEY || (exports.IMBRICATE_TRASH_STASH_CAPABILITY_KEY = IMBRICATE_TRASH_STASH_CAPABILITY_KEY = {}));
17
+ exports.ImbricateTrashStashCapabilityList = [
18
+ IMBRICATE_TRASH_STASH_CAPABILITY_KEY.TOSS_PAGE,
19
+ IMBRICATE_TRASH_STASH_CAPABILITY_KEY.RETRIEVE_PAGE,
20
+ IMBRICATE_TRASH_STASH_CAPABILITY_KEY.TOSS_SCRIPT,
21
+ IMBRICATE_TRASH_STASH_CAPABILITY_KEY.RETRIEVE_SCRIPT,
22
+ ];
23
+ const createAllAllowImbricateTrashStashCapability = () => {
24
+ return {
25
+ [IMBRICATE_TRASH_STASH_CAPABILITY_KEY.TOSS_PAGE]: {
26
+ effect: definition_1.IMBRICATE_CAPABILITY_EFFECT.ALLOW,
27
+ },
28
+ [IMBRICATE_TRASH_STASH_CAPABILITY_KEY.RETRIEVE_PAGE]: {
29
+ effect: definition_1.IMBRICATE_CAPABILITY_EFFECT.ALLOW,
30
+ },
31
+ [IMBRICATE_TRASH_STASH_CAPABILITY_KEY.TOSS_SCRIPT]: {
32
+ effect: definition_1.IMBRICATE_CAPABILITY_EFFECT.ALLOW,
33
+ },
34
+ [IMBRICATE_TRASH_STASH_CAPABILITY_KEY.RETRIEVE_SCRIPT]: {
35
+ effect: definition_1.IMBRICATE_CAPABILITY_EFFECT.ALLOW,
36
+ },
37
+ };
38
+ };
39
+ exports.createAllAllowImbricateTrashStashCapability = createAllAllowImbricateTrashStashCapability;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * @author WMXPY
3
+ * @namespace Trash
4
+ * @description Interface
5
+ */
6
+ import { PromiseOr } from "../definition/promise";
7
+ import { ImbricateTrashStashCapability, ImbricateVacantPage, ImbricateVacantScript } from "./definition";
8
+ export interface IImbricateTrashStash {
9
+ /**
10
+ * Capabilities of the trash stash
11
+ */
12
+ readonly capabilities: ImbricateTrashStashCapability;
13
+ tossPage(page: ImbricateVacantPage): PromiseOr<void>;
14
+ retrievePage(collectionUniqueIdentifier: string, pageIdentifier: string): PromiseOr<ImbricateVacantPage | null>;
15
+ tossScript(script: ImbricateVacantScript): PromiseOr<void>;
16
+ retrieveScript(scriptIdentifier: string): PromiseOr<ImbricateVacantScript | null>;
17
+ }
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ /**
3
+ * @author WMXPY
4
+ * @namespace Trash
5
+ * @description Interface
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });