@imbricate/core 1.20.0 → 1.21.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.
@@ -4,7 +4,12 @@
4
4
  * @description Interface
5
5
  */
6
6
  import { PromiseOr } from "../definition/promise";
7
+ import { ImbricateBinaryStorageCapability } from "./definition";
7
8
  export interface IImbricateBinaryStorage {
9
+ /**
10
+ * Capabilities of the binary storage
11
+ */
12
+ readonly capabilities: ImbricateBinaryStorageCapability;
8
13
  /**
9
14
  * Store a binary file
10
15
  *
@@ -3,6 +3,7 @@
3
3
  * @namespace Function
4
4
  * @description Definition
5
5
  */
6
+ import { ImbricateCapability } from "../capability/definition";
6
7
  import { PromiseOr } from "../definition/promise";
7
8
  export type ImbricateFunction<Target> = {
8
9
  readonly title: string;
@@ -10,3 +11,8 @@ export type ImbricateFunction<Target> = {
10
11
  readonly execute: ImbricateFunctionExecute<Target>;
11
12
  };
12
13
  export type ImbricateFunctionExecute<Target> = (target: Target) => PromiseOr<void>;
14
+ export type ImbricateFunctionCapability = Record<IMBRICATE_FUNCTION_CAPABILITY_KEY, ImbricateCapability>;
15
+ export declare enum IMBRICATE_FUNCTION_CAPABILITY_KEY {
16
+ FIND_ORIGIN_FUNCTIONS = "imbricate.function.origin.find"
17
+ }
18
+ export declare const createAllAllowImbricateFunctionCapability: () => ImbricateFunctionCapability;
@@ -5,3 +5,17 @@
5
5
  * @description Definition
6
6
  */
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.createAllAllowImbricateFunctionCapability = exports.IMBRICATE_FUNCTION_CAPABILITY_KEY = void 0;
9
+ const definition_1 = require("../capability/definition");
10
+ var IMBRICATE_FUNCTION_CAPABILITY_KEY;
11
+ (function (IMBRICATE_FUNCTION_CAPABILITY_KEY) {
12
+ IMBRICATE_FUNCTION_CAPABILITY_KEY["FIND_ORIGIN_FUNCTIONS"] = "imbricate.function.origin.find";
13
+ })(IMBRICATE_FUNCTION_CAPABILITY_KEY || (exports.IMBRICATE_FUNCTION_CAPABILITY_KEY = IMBRICATE_FUNCTION_CAPABILITY_KEY = {}));
14
+ const createAllAllowImbricateFunctionCapability = () => {
15
+ return {
16
+ [IMBRICATE_FUNCTION_CAPABILITY_KEY.FIND_ORIGIN_FUNCTIONS]: {
17
+ effect: definition_1.IMBRICATE_CAPABILITY_EFFECT.ALLOW,
18
+ },
19
+ };
20
+ };
21
+ exports.createAllAllowImbricateFunctionCapability = createAllAllowImbricateFunctionCapability;
@@ -5,8 +5,12 @@
5
5
  */
6
6
  import { PromiseOr } from "../definition/promise";
7
7
  import { IImbricateOrigin } from "../origin/interface";
8
- import { ImbricateFunction } from "./definition";
8
+ import { ImbricateFunction, ImbricateFunctionCapability } from "./definition";
9
9
  export interface IImbricateFunctionManager {
10
+ /**
11
+ * Capabilities of the function manager
12
+ */
13
+ readonly capabilities: ImbricateFunctionCapability;
10
14
  findSynchronousOriginFunctions(): Array<ImbricateFunction<IImbricateOrigin>>;
11
15
  findAllOriginFunctions(): PromiseOr<Array<ImbricateFunction<IImbricateOrigin>>>;
12
16
  }
package/index.d.ts CHANGED
@@ -32,3 +32,5 @@ export * from "./script/definition";
32
32
  export * from "./script/interface";
33
33
  export * from "./search/prefix";
34
34
  export * from "./search/snippet";
35
+ export * from "./trash/definition";
36
+ export * from "./trash/interface";
package/index.js CHANGED
@@ -48,3 +48,5 @@ __exportStar(require("./script/definition"), exports);
48
48
  __exportStar(require("./script/interface"), exports);
49
49
  __exportStar(require("./search/prefix"), exports);
50
50
  __exportStar(require("./search/snippet"), exports);
51
+ __exportStar(require("./trash/definition"), exports);
52
+ __exportStar(require("./trash/interface"), exports);
@@ -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",
@@ -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";
@@ -29,6 +32,15 @@ var IMBRICATE_ORIGIN_CAPABILITY_KEY;
29
32
  })(IMBRICATE_ORIGIN_CAPABILITY_KEY || (exports.IMBRICATE_ORIGIN_CAPABILITY_KEY = IMBRICATE_ORIGIN_CAPABILITY_KEY = {}));
30
33
  const createAllAllowImbricateOriginCapability = () => {
31
34
  return {
35
+ [IMBRICATE_ORIGIN_CAPABILITY_KEY.ORIGIN_FUNCTION]: {
36
+ effect: definition_1.IMBRICATE_CAPABILITY_EFFECT.ALLOW,
37
+ },
38
+ [IMBRICATE_ORIGIN_CAPABILITY_KEY.ORIGIN_BINARY_STORAGE]: {
39
+ effect: definition_1.IMBRICATE_CAPABILITY_EFFECT.ALLOW,
40
+ },
41
+ [IMBRICATE_ORIGIN_CAPABILITY_KEY.ORIGIN_TRASH_STASH]: {
42
+ effect: definition_1.IMBRICATE_CAPABILITY_EFFECT.ALLOW,
43
+ },
32
44
  [IMBRICATE_ORIGIN_CAPABILITY_KEY.CREATE_COLLECTION]: {
33
45
  effect: definition_1.IMBRICATE_CAPABILITY_EFFECT.ALLOW,
34
46
  },
@@ -12,26 +12,62 @@ import { ImbricateScriptMetadata, ImbricateScriptSearchResult, ImbricateScriptSn
12
12
  import { IImbricateScript } from "../script/interface";
13
13
  import { ImbricateOriginCapability, ImbricateOriginMetadata } from "./definition";
14
14
  export interface IImbricateOrigin {
15
+ /**
16
+ * Origin type
17
+ */
15
18
  readonly originType: string;
19
+ /**
20
+ * Unique identifier of the origin
21
+ */
16
22
  readonly uniqueIdentifier: string;
23
+ /**
24
+ * Metadata of the origin
25
+ */
17
26
  readonly metadata: ImbricateOriginMetadata;
27
+ /**
28
+ * Payloads of the origin
29
+ */
18
30
  readonly payloads: Record<string, any>;
31
+ /**
32
+ * Capabilities of the origin
33
+ */
19
34
  readonly capabilities: ImbricateOriginCapability;
35
+ /**
36
+ * Get function manager
37
+ *
38
+ * @returns Function manager
39
+ */
20
40
  getFunctionManger(): IImbricateFunctionManager;
41
+ /**
42
+ * Get binary storage
43
+ *
44
+ * @returns Binary storage
45
+ */
21
46
  getBinaryStorage(): IImbricateBinaryStorage;
22
47
  /**
23
48
  * Create a collection
24
49
  *
25
50
  * @param collectionName Collection name
26
51
  * @param description Collection description
52
+ *
53
+ * @returns Created collection
27
54
  */
28
- createCollection(collectionName: string, description?: string): PromiseOr<void>;
55
+ createCollection(collectionName: string, description?: string): PromiseOr<IImbricateOriginCollection>;
29
56
  renameCollection(collectionUniqueIdentifier: string, newCollectionName: string): PromiseOr<void>;
30
57
  deleteCollection(collectionUniqueIdentifier: string): PromiseOr<void>;
31
58
  hasCollection(collectionName: string): PromiseOr<boolean>;
32
59
  findCollection(collectionName: string): PromiseOr<IImbricateOriginCollection | null>;
33
60
  getCollection(collectionUniqueIdentifier: string): PromiseOr<IImbricateOriginCollection | null>;
34
61
  listCollections(): PromiseOr<IImbricateOriginCollection[]>;
62
+ /**
63
+ * Create a script
64
+ *
65
+ * @param scriptName Script name
66
+ * @param initialScript Initial script content
67
+ * @param description Script description
68
+ *
69
+ * @returns Created script
70
+ */
35
71
  createScript(scriptName: string, initialScript: string, description?: string): PromiseOr<IImbricateScript>;
36
72
  putScript(scriptMetadata: ImbricateScriptMetadata, script: string): PromiseOr<IImbricateScript>;
37
73
  renameScript(identifier: string, newScriptName: string): PromiseOr<void>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@imbricate/core",
3
3
  "main": "index.js",
4
- "version": "1.20.0",
4
+ "version": "1.21.0",
5
5
  "description": "Imbricate Core, Notebook for Engineers",
6
6
  "repository": {
7
7
  "type": "git",
@@ -0,0 +1,25 @@
1
+ /**
2
+ * @author WMXPY
3
+ * @namespace Trash
4
+ * @description Definition
5
+ */
6
+ import { ImbricateCapability } 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 = Record<IMBRICATE_TRASH_STASH_CAPABILITY_KEY, ImbricateCapability>;
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 createAllAllowImbricateTrashStashCapability: () => ImbricateTrashStashCapability;
@@ -0,0 +1,33 @@
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.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
+ const createAllAllowImbricateTrashStashCapability = () => {
18
+ return {
19
+ [IMBRICATE_TRASH_STASH_CAPABILITY_KEY.TOSS_PAGE]: {
20
+ effect: definition_1.IMBRICATE_CAPABILITY_EFFECT.ALLOW,
21
+ },
22
+ [IMBRICATE_TRASH_STASH_CAPABILITY_KEY.RETRIEVE_PAGE]: {
23
+ effect: definition_1.IMBRICATE_CAPABILITY_EFFECT.ALLOW,
24
+ },
25
+ [IMBRICATE_TRASH_STASH_CAPABILITY_KEY.TOSS_SCRIPT]: {
26
+ effect: definition_1.IMBRICATE_CAPABILITY_EFFECT.ALLOW,
27
+ },
28
+ [IMBRICATE_TRASH_STASH_CAPABILITY_KEY.RETRIEVE_SCRIPT]: {
29
+ effect: definition_1.IMBRICATE_CAPABILITY_EFFECT.ALLOW,
30
+ },
31
+ };
32
+ };
33
+ 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 });