@imbricate/core 2.6.1 → 3.0.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 (133) hide show
  1. package/author/definition.d.ts +1 -4
  2. package/database/definition.d.ts +15 -0
  3. package/{definition/promise.js → database/definition.js} +2 -2
  4. package/database/interface.d.ts +41 -0
  5. package/{function → database}/interface.js +1 -1
  6. package/database/manager.d.ts +26 -0
  7. package/database/manager.js +7 -0
  8. package/database/schema.d.ts +14 -0
  9. package/database/schema.js +7 -0
  10. package/document/definition.d.ts +30 -0
  11. package/document/definition.js +17 -0
  12. package/document/interface.d.ts +49 -0
  13. package/{trash → document}/interface.js +1 -1
  14. package/index.d.ts +13 -53
  15. package/index.js +13 -53
  16. package/loader/definition.d.ts +8 -0
  17. package/{query → loader}/definition.js +1 -1
  18. package/loader/origin-loader.d.ts +8 -0
  19. package/loader/origin-loader.js +66 -0
  20. package/loader/persistance.d.ts +19 -0
  21. package/loader/persistance.js +13 -0
  22. package/origin/definition.d.ts +1 -19
  23. package/origin/definition.js +0 -24
  24. package/origin/interface.d.ts +18 -43
  25. package/package.json +1 -1
  26. package/static/interface.d.ts +17 -0
  27. package/{script → static}/interface.js +1 -1
  28. package/static/manager.d.ts +26 -0
  29. package/{query/script.js → static/manager.js} +2 -2
  30. package/text/interface.d.ts +17 -0
  31. package/{page → text}/interface.js +1 -1
  32. package/text/manager.d.ts +26 -0
  33. package/{query/page.js → text/manager.js} +2 -2
  34. package/binary-storage/base.d.ts +0 -18
  35. package/binary-storage/base.js +0 -30
  36. package/binary-storage/definition.d.ts +0 -11
  37. package/binary-storage/definition.js +0 -15
  38. package/binary-storage/interface.d.ts +0 -26
  39. package/binary-storage/interface.js +0 -7
  40. package/capability/builder.d.ts +0 -15
  41. package/capability/builder.js +0 -37
  42. package/capability/create.d.ts +0 -7
  43. package/capability/create.js +0 -16
  44. package/capability/definition.d.ts +0 -16
  45. package/capability/definition.js +0 -25
  46. package/capability/validate.d.ts +0 -19
  47. package/capability/validate.js +0 -36
  48. package/collection/base.d.ts +0 -36
  49. package/collection/base.js +0 -60
  50. package/collection/definition.d.ts +0 -18
  51. package/collection/definition.js +0 -29
  52. package/collection/interface.d.ts +0 -43
  53. package/collection/interface.js +0 -7
  54. package/collection/least-common-identifier.d.ts +0 -10
  55. package/collection/least-common-identifier.js +0 -54
  56. package/collection-manager/base.d.ts +0 -26
  57. package/collection-manager/base.js +0 -59
  58. package/collection-manager/definition.d.ts +0 -15
  59. package/collection-manager/definition.js +0 -23
  60. package/collection-manager/interface.d.ts +0 -38
  61. package/collection-manager/interface.js +0 -7
  62. package/collection-operation-manager/base.d.ts +0 -18
  63. package/collection-operation-manager/base.js +0 -43
  64. package/collection-operation-manager/definition.d.ts +0 -12
  65. package/collection-operation-manager/definition.js +0 -17
  66. package/collection-operation-manager/interface.d.ts +0 -34
  67. package/collection-operation-manager/interface.js +0 -7
  68. package/definition/listable.d.ts +0 -6
  69. package/definition/listable.js +0 -7
  70. package/definition/promise.d.ts +0 -6
  71. package/error/imbricate-error.d.ts +0 -15
  72. package/error/imbricate-error.js +0 -30
  73. package/error/not-implemented.d.ts +0 -10
  74. package/error/not-implemented.js +0 -19
  75. package/executable-manager/base.d.ts +0 -21
  76. package/executable-manager/base.js +0 -44
  77. package/executable-manager/definition.d.ts +0 -12
  78. package/executable-manager/definition.js +0 -17
  79. package/executable-manager/interface.d.ts +0 -44
  80. package/executable-manager/interface.js +0 -7
  81. package/execute/definition.d.ts +0 -17
  82. package/execute/definition.js +0 -16
  83. package/function/base.d.ts +0 -19
  84. package/function/base.js +0 -30
  85. package/function/definition.d.ts +0 -18
  86. package/function/definition.js +0 -15
  87. package/function/interface.d.ts +0 -26
  88. package/operation/definition.d.ts +0 -28
  89. package/operation/definition.js +0 -14
  90. package/origin/base.d.ts +0 -29
  91. package/origin/base.js +0 -39
  92. package/origin-operation-manager/base.d.ts +0 -18
  93. package/origin-operation-manager/base.js +0 -43
  94. package/origin-operation-manager/definition.d.ts +0 -12
  95. package/origin-operation-manager/definition.js +0 -17
  96. package/origin-operation-manager/interface.d.ts +0 -34
  97. package/origin-operation-manager/interface.js +0 -7
  98. package/page/base.d.ts +0 -35
  99. package/page/base.js +0 -48
  100. package/page/definition.d.ts +0 -41
  101. package/page/definition.js +0 -25
  102. package/page/interface.d.ts +0 -55
  103. package/page-variant/definition.d.ts +0 -16
  104. package/page-variant/definition.js +0 -33
  105. package/page-variant/extension.d.ts +0 -7
  106. package/page-variant/extension.js +0 -24
  107. package/query/definition.d.ts +0 -14
  108. package/query/page.d.ts +0 -21
  109. package/query/script.d.ts +0 -21
  110. package/script/base.d.ts +0 -34
  111. package/script/base.js +0 -48
  112. package/script/definition.d.ts +0 -41
  113. package/script/definition.js +0 -27
  114. package/script/interface.d.ts +0 -54
  115. package/script-manager/base.d.ts +0 -31
  116. package/script-manager/base.js +0 -54
  117. package/script-manager/definition.d.ts +0 -18
  118. package/script-manager/definition.js +0 -29
  119. package/script-manager/interface.d.ts +0 -47
  120. package/script-manager/interface.js +0 -7
  121. package/script-variant/definition.d.ts +0 -22
  122. package/script-variant/definition.js +0 -39
  123. package/script-variant/extension.d.ts +0 -7
  124. package/script-variant/extension.js +0 -23
  125. package/search/prefix.d.ts +0 -7
  126. package/search/prefix.js +0 -37
  127. package/search/snippet.d.ts +0 -38
  128. package/search/snippet.js +0 -23
  129. package/trash/base.d.ts +0 -20
  130. package/trash/base.js +0 -36
  131. package/trash/definition.d.ts +0 -25
  132. package/trash/definition.js +0 -21
  133. package/trash/interface.d.ts +0 -17
@@ -3,67 +3,42 @@
3
3
  * @namespace Origin
4
4
  * @description Interface
5
5
  */
6
- import { IImbricateBinaryStorage } from "../binary-storage/interface";
7
- import { IImbricateCollectionManager } from "../collection-manager/interface";
8
- import { PromiseOr } from "../definition/promise";
9
- import { IImbricateFunctionManager } from "../function/interface";
10
- import { IImbricateOriginOperationManager } from "../origin-operation-manager/interface";
11
- import { IImbricateScriptManager } from "../script-manager/interface";
12
- import { ImbricateOriginCapability, ImbricateOriginMetadata } from "./definition";
6
+ import { IImbricateDatabaseManager } from "../database/manager";
7
+ import { IImbricateStaticManager } from "../static/manager";
8
+ import { IImbricateTextManager } from "../text/manager";
9
+ import { OriginPayload } from "./definition";
13
10
  export interface IImbricateOrigin {
14
- /**
15
- * Origin type
16
- */
17
- readonly originType: string;
18
11
  /**
19
12
  * Unique identifier of the origin
20
13
  */
21
14
  readonly uniqueIdentifier: string;
22
15
  /**
23
- * Metadata of the origin
24
- */
25
- readonly metadata: ImbricateOriginMetadata;
26
- /**
27
- * Payloads of the origin
28
- */
29
- readonly payloads: Record<string, any>;
30
- /**
31
- * Capabilities of the origin
32
- */
33
- readonly capabilities: ImbricateOriginCapability;
34
- /**
35
- * Get function manager
36
- *
37
- * @returns Function manager
38
- */
39
- getFunctionManager(): IImbricateFunctionManager;
40
- /**
41
- * Get binary storage
42
- *
43
- * @returns Binary storage
16
+ * Payloads to initialize the origin
44
17
  */
45
- getBinaryStorage(): IImbricateBinaryStorage;
18
+ readonly payloads: OriginPayload;
46
19
  /**
47
- * Get Script manager
20
+ * Get the database manager of the origin
48
21
  *
49
- * @returns Script manager
22
+ * @returns the database manager
50
23
  */
51
- getScriptManager(): IImbricateScriptManager;
24
+ getDatabaseManager(): IImbricateDatabaseManager;
52
25
  /**
53
- * Get collection manager
26
+ * Get the text manager of the origin
27
+ * The text manager is used to manage text objects
54
28
  *
55
- * @returns Collection manager
29
+ * @returns the text manager
56
30
  */
57
- getCollectionManager(): IImbricateCollectionManager;
31
+ getTextManager(): IImbricateTextManager;
58
32
  /**
59
- * Get operation manager
33
+ * Get the static manager of the origin
34
+ * The static manager is used to manage static objects
60
35
  *
61
- * @returns Operation manager
36
+ * @returns the static manager
62
37
  */
63
- getOperationManager(): IImbricateOriginOperationManager;
38
+ getStaticManager(): IImbricateStaticManager;
64
39
  /**
65
40
  * Dispose the origin, optional
66
41
  * This method will be called when the origin is no longer needed
67
42
  */
68
- dispose?(): PromiseOr<void>;
43
+ dispose?(): PromiseLike<void>;
69
44
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@imbricate/core",
3
3
  "main": "index.js",
4
- "version": "2.6.1",
4
+ "version": "3.0.0",
5
5
  "description": "Imbricate Core, Notebook for Engineers",
6
6
  "repository": {
7
7
  "type": "git",
@@ -0,0 +1,17 @@
1
+ /**
2
+ * @author WMXPY
3
+ * @namespace Static
4
+ * @description Interface
5
+ */
6
+ export interface IImbricateStatic {
7
+ /**
8
+ * Unique identifier of the static object
9
+ */
10
+ readonly uniqueIdentifier: string;
11
+ /**
12
+ * Get the content of the static object
13
+ *
14
+ * @returns a promise of the content of the text, encoded in base64
15
+ */
16
+ getContentInBase64(): PromiseLike<string>;
17
+ }
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  /**
3
3
  * @author WMXPY
4
- * @namespace Script
4
+ * @namespace Static
5
5
  * @description Interface
6
6
  */
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,26 @@
1
+ /**
2
+ * @author WMXPY
3
+ * @namespace Static
4
+ * @description Manager
5
+ */
6
+ import { IImbricateStatic } from "./interface";
7
+ export interface IImbricateStaticManager {
8
+ /**
9
+ * Get the static object from the origin
10
+ *
11
+ * @returns a promise of the static object, null if not found
12
+ */
13
+ getStatic(uniqueIdentifier: string): PromiseLike<IImbricateStatic | null>;
14
+ /**
15
+ * Create a new static object in the origin, encoded in base64
16
+ * Static object is immutable, once created, it cannot be changed
17
+ * Patch a new static object if you want to change the content
18
+ *
19
+ * @param content content of the static object, encoded in base64
20
+ * @param uniqueIdentifier unique identifier of the static object, optional
21
+ * if not provided, a unique identifier will be generated
22
+ *
23
+ * @returns a promise of the created static object
24
+ */
25
+ createInBase64(content: string, uniqueIdentifier?: string): PromiseLike<IImbricateStatic>;
26
+ }
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  /**
3
3
  * @author WMXPY
4
- * @namespace Query
5
- * @description Script
4
+ * @namespace Static
5
+ * @description Manager
6
6
  */
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,17 @@
1
+ /**
2
+ * @author WMXPY
3
+ * @namespace Text
4
+ * @description Interface
5
+ */
6
+ export interface IImbricateText {
7
+ /**
8
+ * Unique identifier of the text object
9
+ */
10
+ readonly uniqueIdentifier: string;
11
+ /**
12
+ * Get the content of the text object
13
+ *
14
+ * @returns a promise of the content of the text object
15
+ */
16
+ getContent(): PromiseLike<string>;
17
+ }
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  /**
3
3
  * @author WMXPY
4
- * @namespace Page
4
+ * @namespace Text
5
5
  * @description Interface
6
6
  */
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,26 @@
1
+ /**
2
+ * @author WMXPY
3
+ * @namespace Text
4
+ * @description Manager
5
+ */
6
+ import { IImbricateText } from "./interface";
7
+ export interface IImbricateTextManager {
8
+ /**
9
+ * Get the text object from the origin
10
+ *
11
+ * @returns a promise of the text object, null if not found
12
+ */
13
+ getText(uniqueIdentifier: string): PromiseLike<IImbricateText | null>;
14
+ /**
15
+ * Create a new text object in the origin
16
+ * Text object is immutable, once created, it cannot be changed
17
+ * Patch a new text object if you want to change the content
18
+ *
19
+ * @param content content of the text
20
+ * @param uniqueIdentifier unique identifier of the text object, optional
21
+ * if not provided, a unique identifier will be generated
22
+ *
23
+ * @returns a promise of the text object
24
+ */
25
+ createText(content: string, uniqueIdentifier?: string): PromiseLike<IImbricateText>;
26
+ }
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  /**
3
3
  * @author WMXPY
4
- * @namespace Query
5
- * @description Page
4
+ * @namespace Text
5
+ * @description Manager
6
6
  */
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,18 +0,0 @@
1
- /**
2
- * @author WMXPY
3
- * @namespace BinaryStorage
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_BINARY_STORAGE_CAPABILITY_KEY, ImbricateBinaryStorageCapability } from "./definition";
10
- import type { IImbricateBinaryStorage } from "./interface";
11
- export declare abstract class ImbricateBinaryStorageBase implements IImbricateBinaryStorage {
12
- static buildCapability(initial?: ImbricateCapability): ImbricateCapabilityBuilder<IMBRICATE_BINARY_STORAGE_CAPABILITY_KEY>;
13
- static allAllowCapability(): ImbricateBinaryStorageCapability;
14
- static allDenyCapability(): ImbricateBinaryStorageCapability;
15
- abstract readonly capabilities: ImbricateBinaryStorageCapability;
16
- putBinaryBase64(_binary: string, _fileName: string): PromiseOr<string>;
17
- validateBinaryBase64(_binary: string): PromiseOr<boolean>;
18
- }
@@ -1,30 +0,0 @@
1
- "use strict";
2
- /**
3
- * @author WMXPY
4
- * @namespace BinaryStorage
5
- * @description Base
6
- */
7
- Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.ImbricateBinaryStorageBase = 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 ImbricateBinaryStorageBase {
14
- static buildCapability(initial = (0, definition_1.createDenyImbricateCapability)()) {
15
- return builder_1.ImbricateCapabilityBuilder.create(definition_2.ImbricateBinaryStorageCapabilityList, 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
- putBinaryBase64(_binary, _fileName) {
24
- throw not_implemented_1.ImbricateNotImplemented.create("PutBinaryBase64", definition_2.IMBRICATE_BINARY_STORAGE_CAPABILITY_KEY.UPLOAD_FILE);
25
- }
26
- validateBinaryBase64(_binary) {
27
- throw not_implemented_1.ImbricateNotImplemented.create("ValidateBinaryBase64", definition_2.IMBRICATE_BINARY_STORAGE_CAPABILITY_KEY.UPLOAD_FILE);
28
- }
29
- }
30
- exports.ImbricateBinaryStorageBase = ImbricateBinaryStorageBase;
@@ -1,11 +0,0 @@
1
- /**
2
- * @author WMXPY
3
- * @namespace BinaryStorage
4
- * @description Definition
5
- */
6
- import type { ImbricateCapabilityRecord } from "../capability/definition";
7
- export type ImbricateBinaryStorageCapability = ImbricateCapabilityRecord<IMBRICATE_BINARY_STORAGE_CAPABILITY_KEY>;
8
- export declare enum IMBRICATE_BINARY_STORAGE_CAPABILITY_KEY {
9
- UPLOAD_FILE = "imbricate.binary.storage.upload"
10
- }
11
- export declare const ImbricateBinaryStorageCapabilityList: IMBRICATE_BINARY_STORAGE_CAPABILITY_KEY[];
@@ -1,15 +0,0 @@
1
- "use strict";
2
- /**
3
- * @author WMXPY
4
- * @namespace BinaryStorage
5
- * @description Definition
6
- */
7
- Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.ImbricateBinaryStorageCapabilityList = exports.IMBRICATE_BINARY_STORAGE_CAPABILITY_KEY = void 0;
9
- var IMBRICATE_BINARY_STORAGE_CAPABILITY_KEY;
10
- (function (IMBRICATE_BINARY_STORAGE_CAPABILITY_KEY) {
11
- IMBRICATE_BINARY_STORAGE_CAPABILITY_KEY["UPLOAD_FILE"] = "imbricate.binary.storage.upload";
12
- })(IMBRICATE_BINARY_STORAGE_CAPABILITY_KEY || (exports.IMBRICATE_BINARY_STORAGE_CAPABILITY_KEY = IMBRICATE_BINARY_STORAGE_CAPABILITY_KEY = {}));
13
- exports.ImbricateBinaryStorageCapabilityList = [
14
- IMBRICATE_BINARY_STORAGE_CAPABILITY_KEY.UPLOAD_FILE,
15
- ];
@@ -1,26 +0,0 @@
1
- /**
2
- * @author WMXPY
3
- * @namespace BinaryStorage
4
- * @description Interface
5
- */
6
- import { PromiseOr } from "../definition/promise";
7
- import { ImbricateBinaryStorageCapability } from "./definition";
8
- export interface IImbricateBinaryStorage {
9
- /**
10
- * Capabilities of the binary storage
11
- */
12
- readonly capabilities: ImbricateBinaryStorageCapability;
13
- /**
14
- * Store a binary file
15
- *
16
- * @param binary Base64 encoded binary
17
- * @param fileName File name
18
- */
19
- putBinaryBase64(binary: string, fileName: string): PromiseOr<string>;
20
- /**
21
- * Validate if the binary is a valid base64 to be stored
22
- *
23
- * @param binary Base64 encoded binary
24
- */
25
- validateBinaryBase64(binary: string): PromiseOr<boolean>;
26
- }
@@ -1,7 +0,0 @@
1
- "use strict";
2
- /**
3
- * @author WMXPY
4
- * @namespace BinaryStorage
5
- * @description Interface
6
- */
7
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,15 +0,0 @@
1
- /**
2
- * @author WMXPY
3
- * @namespace Capability
4
- * @description Builder
5
- */
6
- import { ImbricateCapability, ImbricateCapabilityKey, ImbricateCapabilityRecord } from "./definition";
7
- export declare class ImbricateCapabilityBuilder<T extends ImbricateCapabilityKey> {
8
- static create<T extends ImbricateCapabilityKey>(list: T[], initialValue: ImbricateCapability): ImbricateCapabilityBuilder<T>;
9
- private readonly _capabilities;
10
- private constructor();
11
- set(key: T, value: ImbricateCapability): this;
12
- allow(key: T): this;
13
- deny(key: T): this;
14
- build(): ImbricateCapabilityRecord<T>;
15
- }
@@ -1,37 +0,0 @@
1
- "use strict";
2
- /**
3
- * @author WMXPY
4
- * @namespace Capability
5
- * @description Builder
6
- */
7
- Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.ImbricateCapabilityBuilder = void 0;
9
- const create_1 = require("./create");
10
- const definition_1 = require("./definition");
11
- class ImbricateCapabilityBuilder {
12
- static create(list, initialValue) {
13
- const capabilities = (0, create_1.createImbricateCapabilityRecord)(list, initialValue);
14
- return new ImbricateCapabilityBuilder(capabilities);
15
- }
16
- constructor(capabilities) {
17
- this._capabilities = capabilities;
18
- }
19
- set(key, value) {
20
- this._capabilities[key] = value;
21
- return this;
22
- }
23
- allow(key) {
24
- this._capabilities[key] = (0, definition_1.createAllowImbricateCapability)();
25
- return this;
26
- }
27
- deny(key) {
28
- this._capabilities[key] = (0, definition_1.createDenyImbricateCapability)();
29
- return this;
30
- }
31
- build() {
32
- return Object.keys(this._capabilities).reduce((previous, current) => {
33
- return Object.assign(Object.assign({}, previous), { [current]: this._capabilities[current] });
34
- }, {});
35
- }
36
- }
37
- exports.ImbricateCapabilityBuilder = ImbricateCapabilityBuilder;
@@ -1,7 +0,0 @@
1
- /**
2
- * @author WMXPY
3
- * @namespace Capability
4
- * @description Create
5
- */
6
- import type { ImbricateCapability, ImbricateCapabilityKey, ImbricateCapabilityRecord } from "./definition";
7
- export declare const createImbricateCapabilityRecord: <T extends ImbricateCapabilityKey>(list: T[], initialValue: ImbricateCapability) => ImbricateCapabilityRecord<T>;
@@ -1,16 +0,0 @@
1
- "use strict";
2
- /**
3
- * @author WMXPY
4
- * @namespace Capability
5
- * @description Create
6
- */
7
- Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.createImbricateCapabilityRecord = void 0;
9
- const createImbricateCapabilityRecord = (list, initialValue) => {
10
- const record = {};
11
- for (const key of list) {
12
- record[key] = Object.assign({}, initialValue);
13
- }
14
- return record;
15
- };
16
- exports.createImbricateCapabilityRecord = createImbricateCapabilityRecord;
@@ -1,16 +0,0 @@
1
- /**
2
- * @author WMXPY
3
- * @namespace Capability
4
- * @description Definition
5
- */
6
- export type ImbricateCapabilityKey = string;
7
- export declare enum IMBRICATE_CAPABILITY_EFFECT {
8
- ALLOW = "ALLOW",
9
- DENY = "DENY"
10
- }
11
- export type ImbricateCapability = {
12
- readonly effect: IMBRICATE_CAPABILITY_EFFECT;
13
- };
14
- export type ImbricateCapabilityRecord<T extends ImbricateCapabilityKey> = Record<T, ImbricateCapability>;
15
- export declare const createAllowImbricateCapability: () => ImbricateCapability;
16
- export declare const createDenyImbricateCapability: () => ImbricateCapability;
@@ -1,25 +0,0 @@
1
- "use strict";
2
- /**
3
- * @author WMXPY
4
- * @namespace Capability
5
- * @description Definition
6
- */
7
- Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.createDenyImbricateCapability = exports.createAllowImbricateCapability = 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 = {}));
14
- const createAllowImbricateCapability = () => {
15
- return {
16
- effect: IMBRICATE_CAPABILITY_EFFECT.ALLOW,
17
- };
18
- };
19
- exports.createAllowImbricateCapability = createAllowImbricateCapability;
20
- const createDenyImbricateCapability = () => {
21
- return {
22
- effect: IMBRICATE_CAPABILITY_EFFECT.DENY,
23
- };
24
- };
25
- exports.createDenyImbricateCapability = createDenyImbricateCapability;
@@ -1,19 +0,0 @@
1
- /**
2
- * @author WMXPY
3
- * @namespace Capability
4
- * @description Validate
5
- */
6
- import { IMBRICATE_COLLECTION_CAPABILITY_KEY } from "../collection/definition";
7
- import type { IImbricateCollection } from "../collection/interface";
8
- import { IMBRICATE_ORIGIN_CAPABILITY_KEY } from "../origin/definition";
9
- import { IImbricateOrigin } from "../origin/interface";
10
- import { IMBRICATE_PAGE_CAPABILITY_KEY } from "../page/definition";
11
- import { IImbricatePage } from "../page/interface";
12
- import { IMBRICATE_SCRIPT_CAPABILITY_KEY } from "../script/definition";
13
- import { IImbricateScript } from "../script/interface";
14
- import { ImbricateCapability } from "./definition";
15
- export declare const validateImbricateCapability: <CapabilityRecords extends Record<string, ImbricateCapability>, KeySet extends keyof CapabilityRecords>(capabilities: CapabilityRecords, capability: KeySet) => boolean;
16
- export declare const validateImbricateOriginCapability: (origin: IImbricateOrigin, capability: IMBRICATE_ORIGIN_CAPABILITY_KEY) => boolean;
17
- export declare const validateImbricateCollectionCapability: (collection: IImbricateCollection, capability: IMBRICATE_COLLECTION_CAPABILITY_KEY) => boolean;
18
- export declare const validateImbricatePageCapability: (page: IImbricatePage, capability: IMBRICATE_PAGE_CAPABILITY_KEY) => boolean;
19
- export declare const validateImbricateScriptCapability: (script: IImbricateScript, capability: IMBRICATE_SCRIPT_CAPABILITY_KEY) => boolean;
@@ -1,36 +0,0 @@
1
- "use strict";
2
- /**
3
- * @author WMXPY
4
- * @namespace Capability
5
- * @description Validate
6
- */
7
- Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.validateImbricateScriptCapability = exports.validateImbricatePageCapability = exports.validateImbricateCollectionCapability = exports.validateImbricateOriginCapability = exports.validateImbricateCapability = void 0;
9
- const definition_1 = require("./definition");
10
- const validateImbricateCapability = (capabilities, capability) => {
11
- if (!capabilities) {
12
- return false;
13
- }
14
- const capabilityValue = capabilities[capability];
15
- if (!capabilityValue) {
16
- return false;
17
- }
18
- return capabilityValue.effect === definition_1.IMBRICATE_CAPABILITY_EFFECT.ALLOW;
19
- };
20
- exports.validateImbricateCapability = validateImbricateCapability;
21
- const validateImbricateOriginCapability = (origin, capability) => {
22
- return (0, exports.validateImbricateCapability)(origin.capabilities, capability);
23
- };
24
- exports.validateImbricateOriginCapability = validateImbricateOriginCapability;
25
- const validateImbricateCollectionCapability = (collection, capability) => {
26
- return (0, exports.validateImbricateCapability)(collection.capabilities, capability);
27
- };
28
- exports.validateImbricateCollectionCapability = validateImbricateCollectionCapability;
29
- const validateImbricatePageCapability = (page, capability) => {
30
- return (0, exports.validateImbricateCapability)(page.capabilities, capability);
31
- };
32
- exports.validateImbricatePageCapability = validateImbricatePageCapability;
33
- const validateImbricateScriptCapability = (script, capability) => {
34
- return (0, exports.validateImbricateCapability)(script.capabilities, capability);
35
- };
36
- exports.validateImbricateScriptCapability = validateImbricateScriptCapability;
@@ -1,36 +0,0 @@
1
- /**
2
- * @author WMXPY
3
- * @namespace Collection
4
- * @description Base
5
- */
6
- import { ImbricateAuthor } from "../author/definition";
7
- import { ImbricateCapabilityBuilder } from "../capability/builder";
8
- import { ImbricateCapability } from "../capability/definition";
9
- import { IImbricateCollectionOperationManager } from "../collection-operation-manager/interface";
10
- import type { PromiseOr } from "../definition/promise";
11
- import { ImbricatePageVariant } from "../page-variant/definition";
12
- import type { ImbricatePageMetadata, ImbricatePageSearchResult, ImbricatePageSnapshot } from "../page/definition";
13
- import type { IImbricatePage } from "../page/interface";
14
- import type { ImbricatePageQuery, ImbricatePageQueryConfig, ImbricateSearchPageConfig } from "../query/page";
15
- import { IMBRICATE_COLLECTION_CAPABILITY_KEY, ImbricateCollectionCapability } from "./definition";
16
- import type { IImbricateCollection } from "./interface";
17
- export declare abstract class ImbricateCollectionBase implements IImbricateCollection {
18
- static buildCapability(initial?: ImbricateCapability): ImbricateCapabilityBuilder<IMBRICATE_COLLECTION_CAPABILITY_KEY>;
19
- static allAllowCapability(): ImbricateCollectionCapability;
20
- static allDenyCapability(): ImbricateCollectionCapability;
21
- abstract readonly collectionName: string;
22
- abstract readonly uniqueIdentifier: string;
23
- abstract readonly capabilities: ImbricateCollectionCapability;
24
- createPage(_directories: string[], _title: string, _variant: ImbricatePageVariant, _author: ImbricateAuthor, _initialContent: string, _description?: string): PromiseOr<IImbricatePage>;
25
- putPage(_pageMetadata: ImbricatePageMetadata, _content: string): PromiseOr<IImbricatePage>;
26
- retitlePage(_identifier: string, _newTitle: string): PromiseOr<void>;
27
- deletePage(_identifier: string): PromiseOr<void>;
28
- hasPage(_directories: string[], _title: string): PromiseOr<boolean>;
29
- getPage(_identifier: string): PromiseOr<IImbricatePage | null>;
30
- listPages(_directories: string[], _recursive: boolean): PromiseOr<ImbricatePageSnapshot[]>;
31
- listDirectories(_directories: string[]): PromiseOr<string[]>;
32
- searchPages(_keyword: string, _config: ImbricateSearchPageConfig): PromiseOr<ImbricatePageSearchResult[]>;
33
- queryPages(_query: ImbricatePageQuery, _config: ImbricatePageQueryConfig): PromiseOr<IImbricatePage[]>;
34
- listSupportedVariants(): Promise<ImbricatePageVariant[]>;
35
- getOperationManager(): IImbricateCollectionOperationManager;
36
- }
@@ -1,60 +0,0 @@
1
- "use strict";
2
- /**
3
- * @author WMXPY
4
- * @namespace Collection
5
- * @description Base
6
- */
7
- Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.ImbricateCollectionBase = 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 ImbricateCollectionBase {
14
- static buildCapability(initial = (0, definition_1.createDenyImbricateCapability)()) {
15
- return builder_1.ImbricateCapabilityBuilder.create(definition_2.ImbricateCollectionCapabilityList, 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
- createPage(_directories, _title, _variant, _author, _initialContent, _description) {
24
- throw not_implemented_1.ImbricateNotImplemented.create("CreatePage", definition_2.IMBRICATE_COLLECTION_CAPABILITY_KEY.CREATE_PAGE);
25
- }
26
- putPage(_pageMetadata, _content) {
27
- throw not_implemented_1.ImbricateNotImplemented.create("PutPage", definition_2.IMBRICATE_COLLECTION_CAPABILITY_KEY.PUT_PAGE);
28
- }
29
- retitlePage(_identifier, _newTitle) {
30
- throw not_implemented_1.ImbricateNotImplemented.create("RetitlePage", definition_2.IMBRICATE_COLLECTION_CAPABILITY_KEY.RETITLE_PAGE);
31
- }
32
- deletePage(_identifier) {
33
- throw not_implemented_1.ImbricateNotImplemented.create("DeletePage", definition_2.IMBRICATE_COLLECTION_CAPABILITY_KEY.DELETE_PAGE);
34
- }
35
- hasPage(_directories, _title) {
36
- throw not_implemented_1.ImbricateNotImplemented.create("HasPage", definition_2.IMBRICATE_COLLECTION_CAPABILITY_KEY.GET_PAGE);
37
- }
38
- getPage(_identifier) {
39
- throw not_implemented_1.ImbricateNotImplemented.create("GetPage", definition_2.IMBRICATE_COLLECTION_CAPABILITY_KEY.GET_PAGE);
40
- }
41
- listPages(_directories, _recursive) {
42
- throw not_implemented_1.ImbricateNotImplemented.create("ListPages", definition_2.IMBRICATE_COLLECTION_CAPABILITY_KEY.LIST_PAGES);
43
- }
44
- listDirectories(_directories) {
45
- throw not_implemented_1.ImbricateNotImplemented.create("ListDirectories", definition_2.IMBRICATE_COLLECTION_CAPABILITY_KEY.LIST_PAGES);
46
- }
47
- searchPages(_keyword, _config) {
48
- throw not_implemented_1.ImbricateNotImplemented.create("SearchPages", definition_2.IMBRICATE_COLLECTION_CAPABILITY_KEY.LIST_PAGES);
49
- }
50
- queryPages(_query, _config) {
51
- throw not_implemented_1.ImbricateNotImplemented.create("QueryPages", definition_2.IMBRICATE_COLLECTION_CAPABILITY_KEY.LIST_PAGES);
52
- }
53
- listSupportedVariants() {
54
- throw not_implemented_1.ImbricateNotImplemented.create("ListSupportedVariants", definition_2.IMBRICATE_COLLECTION_CAPABILITY_KEY.LIST_SUPPORTED_VARIANTS);
55
- }
56
- getOperationManager() {
57
- throw not_implemented_1.ImbricateNotImplemented.create("GetOperationManager", definition_2.IMBRICATE_COLLECTION_CAPABILITY_KEY.COLLECTION_OPERATION_MANAGER);
58
- }
59
- }
60
- exports.ImbricateCollectionBase = ImbricateCollectionBase;
@@ -1,18 +0,0 @@
1
- /**
2
- * @author WMXPY
3
- * @namespace Collection
4
- * @description Definition
5
- */
6
- import type { 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
- LIST_SUPPORTED_VARIANTS = "imbricate.collection.page.list-supported-variants",
16
- COLLECTION_OPERATION_MANAGER = "imbricate.collection.operation-manager"
17
- }
18
- export declare const ImbricateCollectionCapabilityList: IMBRICATE_COLLECTION_CAPABILITY_KEY[];