@imbricate/core 2.6.2 → 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,10 +3,7 @@
3
3
  * @namespace Author
4
4
  * @description Definition
5
5
  */
6
- export type ImbricateAuthorAttributes = Record<string, string>;
7
6
  export type ImbricateAuthor = {
8
- readonly avatar?: string;
9
- readonly displayName?: string;
7
+ readonly category: string;
10
8
  readonly identifier: string;
11
- readonly attributes: ImbricateAuthorAttributes;
12
9
  };
@@ -0,0 +1,15 @@
1
+ /**
2
+ * @author WMXPY
3
+ * @namespace Database
4
+ * @description Definition
5
+ */
6
+ /**
7
+ * Query of the document
8
+ *
9
+ * @param limit limit of the query
10
+ * @param skip skip of the query
11
+ */
12
+ export type ImbricateDocumentQuery = {
13
+ readonly limit?: number;
14
+ readonly skip?: number;
15
+ };
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  /**
3
3
  * @author WMXPY
4
- * @namespace Definition
5
- * @description Promise
4
+ * @namespace Database
5
+ * @description Definition
6
6
  */
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,41 @@
1
+ /**
2
+ * @author WMXPY
3
+ * @namespace Database
4
+ * @description Interface
5
+ */
6
+ import { DocumentProperties } from "../document/definition";
7
+ import { IImbricateDocument } from "../document/interface";
8
+ import { ImbricateDocumentQuery } from "./definition";
9
+ import { ImbricateDatabaseSchema } from "./schema";
10
+ export interface IImbricateDatabase {
11
+ /**
12
+ * Unique identifier of the database
13
+ */
14
+ readonly uniqueIdentifier: string;
15
+ readonly databaseName: string;
16
+ readonly schema: ImbricateDatabaseSchema;
17
+ /**
18
+ * Create a new document in the database
19
+ *
20
+ * @param properties properties of the document
21
+ * @param uniqueIdentifier unique identifier of the document, optional
22
+ * if not provided, a unique identifier will be generated
23
+ *
24
+ * @returns a promise of the created document
25
+ */
26
+ createDocument(properties: DocumentProperties, uniqueIdentifier?: string): PromiseLike<IImbricateDocument>;
27
+ /**
28
+ * Get one document from the database
29
+ *
30
+ * @returns a promise of the documents in the database, null if not found
31
+ */
32
+ getDocument(uniqueIdentifier: string): PromiseLike<IImbricateDocument | null>;
33
+ /**
34
+ * Query documents from the database
35
+ *
36
+ * @param query query of the documents
37
+ *
38
+ * @returns a promise of the documents in the database
39
+ */
40
+ queryDocuments(query: ImbricateDocumentQuery): PromiseLike<IImbricateDocument[]>;
41
+ }
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  /**
3
3
  * @author WMXPY
4
- * @namespace Function
4
+ * @namespace Database
5
5
  * @description Interface
6
6
  */
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,26 @@
1
+ /**
2
+ * @author WMXPY
3
+ * @namespace Database
4
+ * @description Manager
5
+ */
6
+ import { IImbricateDatabase } from "./interface";
7
+ import { ImbricateDatabaseSchema } from "./schema";
8
+ export interface IImbricateDatabaseManager {
9
+ /**
10
+ * Get databases from the origin
11
+ *
12
+ * @returns a promise of the databases in the origin
13
+ */
14
+ getDatabases(): PromiseLike<IImbricateDatabase[]>;
15
+ /**
16
+ * Create a new database
17
+ *
18
+ * @param databaseName name of the database
19
+ * @param schema schema of the database
20
+ * @param uniqueIdentifier unique identifier of the database, optional
21
+ * if not provided, a unique identifier will be generated
22
+ *
23
+ * @returns a promise of the created database
24
+ */
25
+ createDatabase(databaseName: string, schema: ImbricateDatabaseSchema, uniqueIdentifier?: string): PromiseLike<IImbricateDatabase>;
26
+ }
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ /**
3
+ * @author WMXPY
4
+ * @namespace Database
5
+ * @description Manager
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,14 @@
1
+ /**
2
+ * @author WMXPY
3
+ * @namespace Database
4
+ * @description Schema
5
+ */
6
+ import { IMBRICATE_PROPERTY_TYPE } from "../document/definition";
7
+ export type ImbricateDatabaseSchemaProperty = {
8
+ readonly propertyIdentifier: string;
9
+ readonly propertyName: string;
10
+ readonly propertyType: IMBRICATE_PROPERTY_TYPE;
11
+ };
12
+ export type ImbricateDatabaseSchema = {
13
+ readonly properties: ImbricateDatabaseSchemaProperty[];
14
+ };
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ /**
3
+ * @author WMXPY
4
+ * @namespace Database
5
+ * @description Schema
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,30 @@
1
+ /**
2
+ * @author WMXPY
3
+ * @namespace Document
4
+ * @description Definition
5
+ */
6
+ import { ImbricateAuthor } from "../author/definition";
7
+ export declare enum IMBRICATE_PROPERTY_TYPE {
8
+ STRING = "STRING",
9
+ MARKDOWN = "MARKDOWN"
10
+ }
11
+ export type DocumentProperties = Record<DocumentPropertyKey, DocumentPropertyValue>;
12
+ export type DocumentPropertyKey = string;
13
+ export type DocumentPropertyValue = {
14
+ readonly type: IMBRICATE_PROPERTY_TYPE;
15
+ readonly value: any;
16
+ };
17
+ export declare enum IMBRICATE_DOCUMENT_EDIT_TYPE {
18
+ PUT = "PUT"
19
+ }
20
+ export type DocumentEditOperation = {
21
+ readonly key: DocumentPropertyKey;
22
+ readonly action: IMBRICATE_DOCUMENT_EDIT_TYPE;
23
+ readonly value: DocumentPropertyValue;
24
+ };
25
+ export type DocumentEditRecord = {
26
+ readonly uniqueIdentifier: string;
27
+ readonly editAt: Date;
28
+ readonly author: ImbricateAuthor;
29
+ readonly operations: DocumentEditOperation[];
30
+ };
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ /**
3
+ * @author WMXPY
4
+ * @namespace Document
5
+ * @description Definition
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.IMBRICATE_DOCUMENT_EDIT_TYPE = exports.IMBRICATE_PROPERTY_TYPE = void 0;
9
+ var IMBRICATE_PROPERTY_TYPE;
10
+ (function (IMBRICATE_PROPERTY_TYPE) {
11
+ IMBRICATE_PROPERTY_TYPE["STRING"] = "STRING";
12
+ IMBRICATE_PROPERTY_TYPE["MARKDOWN"] = "MARKDOWN";
13
+ })(IMBRICATE_PROPERTY_TYPE || (exports.IMBRICATE_PROPERTY_TYPE = IMBRICATE_PROPERTY_TYPE = {}));
14
+ var IMBRICATE_DOCUMENT_EDIT_TYPE;
15
+ (function (IMBRICATE_DOCUMENT_EDIT_TYPE) {
16
+ IMBRICATE_DOCUMENT_EDIT_TYPE["PUT"] = "PUT";
17
+ })(IMBRICATE_DOCUMENT_EDIT_TYPE || (exports.IMBRICATE_DOCUMENT_EDIT_TYPE = IMBRICATE_DOCUMENT_EDIT_TYPE = {}));
@@ -0,0 +1,49 @@
1
+ /**
2
+ * @author WMXPY
3
+ * @namespace Document
4
+ * @description Interface
5
+ */
6
+ import { DocumentEditRecord, DocumentProperties, DocumentPropertyKey, DocumentPropertyValue } from "./definition";
7
+ export interface IImbricateDocument {
8
+ /**
9
+ * Unique identifier of the database
10
+ */
11
+ readonly uniqueIdentifier: string;
12
+ /**
13
+ * Update a property from the document
14
+ *
15
+ * @param key key of the property
16
+ * @param value value of the property
17
+ *
18
+ * @returns a promise of the edit records of the document
19
+ * Note: the edit records will not be added to the document, the best practice is to call addEditRecords to add the edit records.
20
+ */
21
+ putProperty(key: DocumentPropertyKey, value: DocumentPropertyValue): PromiseLike<DocumentEditRecord[]>;
22
+ /**
23
+ * Put and replace all properties of the document
24
+ *
25
+ * @param properties properties of the document
26
+ *
27
+ * @returns a promise of the edit records of the document
28
+ * Note: the edit records will not be added to the document, the best practice is to call addEditRecords to add the edit records.
29
+ */
30
+ putProperties(properties: DocumentProperties): PromiseLike<DocumentEditRecord[]>;
31
+ /**
32
+ * Get properties from the document
33
+ *
34
+ * @returns a promise of the properties of the document
35
+ */
36
+ getProperties(): PromiseLike<DocumentProperties>;
37
+ /**
38
+ * Add edit records to the document
39
+ *
40
+ * @param records document edit records
41
+ */
42
+ addEditRecords(records: DocumentEditRecord[]): PromiseLike<void>;
43
+ /**
44
+ * Get edit records of the document
45
+ *
46
+ * @returns a promise of the edit records of the document
47
+ */
48
+ getEditRecords(): PromiseLike<DocumentEditRecord[]>;
49
+ }
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  /**
3
3
  * @author WMXPY
4
- * @namespace Trash
4
+ * @namespace Document
5
5
  * @description Interface
6
6
  */
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
package/index.d.ts CHANGED
@@ -3,58 +3,18 @@
3
3
  * @description Index
4
4
  */
5
5
  export * from "./author/definition";
6
- export * from "./binary-storage/base";
7
- export * from "./binary-storage/definition";
8
- export * from "./binary-storage/interface";
9
- export * from "./capability/builder";
10
- export * from "./capability/create";
11
- export * from "./capability/definition";
12
- export * from "./capability/validate";
13
- export * from "./collection-manager/base";
14
- export * from "./collection-manager/definition";
15
- export * from "./collection-manager/interface";
16
- export * from "./collection-operation-manager/base";
17
- export * from "./collection-operation-manager/definition";
18
- export * from "./collection-operation-manager/interface";
19
- export * from "./collection/base";
20
- export * from "./collection/definition";
21
- export * from "./collection/interface";
22
- export * from "./collection/least-common-identifier";
23
- export * from "./definition/listable";
24
- export * from "./definition/promise";
25
- export * from "./error/imbricate-error";
26
- export * from "./error/not-implemented";
27
- export * from "./executable-manager/base";
28
- export * from "./executable-manager/definition";
29
- export * from "./executable-manager/interface";
30
- export * from "./execute/definition";
31
- export * from "./function/base";
32
- export * from "./function/definition";
33
- export * from "./function/interface";
34
- export * from "./operation/definition";
35
- export * from "./origin-operation-manager/base";
36
- export * from "./origin-operation-manager/definition";
37
- export * from "./origin-operation-manager/interface";
38
- export * from "./origin/base";
6
+ export * from "./database/definition";
7
+ export * from "./database/interface";
8
+ export * from "./database/manager";
9
+ export * from "./database/schema";
10
+ export * from "./document/definition";
11
+ export * from "./document/interface";
12
+ export * from "./loader/definition";
13
+ export * from "./loader/origin-loader";
14
+ export * from "./loader/persistance";
39
15
  export * from "./origin/definition";
40
16
  export * from "./origin/interface";
41
- export * from "./page-variant/definition";
42
- export * from "./page-variant/extension";
43
- export * from "./page/base";
44
- export * from "./page/definition";
45
- export * from "./page/interface";
46
- export * from "./query/definition";
47
- export * from "./query/page";
48
- export * from "./query/script";
49
- export * from "./script-manager/base";
50
- export * from "./script-manager/definition";
51
- export * from "./script-manager/interface";
52
- export * from "./script-variant/definition";
53
- export * from "./script/base";
54
- export * from "./script/definition";
55
- export * from "./script/interface";
56
- export * from "./search/prefix";
57
- export * from "./search/snippet";
58
- export * from "./trash/base";
59
- export * from "./trash/definition";
60
- export * from "./trash/interface";
17
+ export * from "./static/interface";
18
+ export * from "./static/manager";
19
+ export * from "./text/interface";
20
+ export * from "./text/manager";
package/index.js CHANGED
@@ -19,58 +19,18 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
19
19
  };
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
21
  __exportStar(require("./author/definition"), exports);
22
- __exportStar(require("./binary-storage/base"), exports);
23
- __exportStar(require("./binary-storage/definition"), exports);
24
- __exportStar(require("./binary-storage/interface"), exports);
25
- __exportStar(require("./capability/builder"), exports);
26
- __exportStar(require("./capability/create"), exports);
27
- __exportStar(require("./capability/definition"), exports);
28
- __exportStar(require("./capability/validate"), exports);
29
- __exportStar(require("./collection-manager/base"), exports);
30
- __exportStar(require("./collection-manager/definition"), exports);
31
- __exportStar(require("./collection-manager/interface"), exports);
32
- __exportStar(require("./collection-operation-manager/base"), exports);
33
- __exportStar(require("./collection-operation-manager/definition"), exports);
34
- __exportStar(require("./collection-operation-manager/interface"), exports);
35
- __exportStar(require("./collection/base"), exports);
36
- __exportStar(require("./collection/definition"), exports);
37
- __exportStar(require("./collection/interface"), exports);
38
- __exportStar(require("./collection/least-common-identifier"), exports);
39
- __exportStar(require("./definition/listable"), exports);
40
- __exportStar(require("./definition/promise"), exports);
41
- __exportStar(require("./error/imbricate-error"), exports);
42
- __exportStar(require("./error/not-implemented"), exports);
43
- __exportStar(require("./executable-manager/base"), exports);
44
- __exportStar(require("./executable-manager/definition"), exports);
45
- __exportStar(require("./executable-manager/interface"), exports);
46
- __exportStar(require("./execute/definition"), exports);
47
- __exportStar(require("./function/base"), exports);
48
- __exportStar(require("./function/definition"), exports);
49
- __exportStar(require("./function/interface"), exports);
50
- __exportStar(require("./operation/definition"), exports);
51
- __exportStar(require("./origin-operation-manager/base"), exports);
52
- __exportStar(require("./origin-operation-manager/definition"), exports);
53
- __exportStar(require("./origin-operation-manager/interface"), exports);
54
- __exportStar(require("./origin/base"), exports);
22
+ __exportStar(require("./database/definition"), exports);
23
+ __exportStar(require("./database/interface"), exports);
24
+ __exportStar(require("./database/manager"), exports);
25
+ __exportStar(require("./database/schema"), exports);
26
+ __exportStar(require("./document/definition"), exports);
27
+ __exportStar(require("./document/interface"), exports);
28
+ __exportStar(require("./loader/definition"), exports);
29
+ __exportStar(require("./loader/origin-loader"), exports);
30
+ __exportStar(require("./loader/persistance"), exports);
55
31
  __exportStar(require("./origin/definition"), exports);
56
32
  __exportStar(require("./origin/interface"), exports);
57
- __exportStar(require("./page-variant/definition"), exports);
58
- __exportStar(require("./page-variant/extension"), exports);
59
- __exportStar(require("./page/base"), exports);
60
- __exportStar(require("./page/definition"), exports);
61
- __exportStar(require("./page/interface"), exports);
62
- __exportStar(require("./query/definition"), exports);
63
- __exportStar(require("./query/page"), exports);
64
- __exportStar(require("./query/script"), exports);
65
- __exportStar(require("./script-manager/base"), exports);
66
- __exportStar(require("./script-manager/definition"), exports);
67
- __exportStar(require("./script-manager/interface"), exports);
68
- __exportStar(require("./script-variant/definition"), exports);
69
- __exportStar(require("./script/base"), exports);
70
- __exportStar(require("./script/definition"), exports);
71
- __exportStar(require("./script/interface"), exports);
72
- __exportStar(require("./search/prefix"), exports);
73
- __exportStar(require("./search/snippet"), exports);
74
- __exportStar(require("./trash/base"), exports);
75
- __exportStar(require("./trash/definition"), exports);
76
- __exportStar(require("./trash/interface"), exports);
33
+ __exportStar(require("./static/interface"), exports);
34
+ __exportStar(require("./static/manager"), exports);
35
+ __exportStar(require("./text/interface"), exports);
36
+ __exportStar(require("./text/manager"), exports);
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @author WMXPY
3
+ * @namespace Loader
4
+ * @description Definition
5
+ */
6
+ import { OriginPayload } from "../origin/definition";
7
+ import { IImbricateOrigin } from "../origin/interface";
8
+ export type ImbricateOriginLoader = (payload: OriginPayload) => IImbricateOrigin;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  /**
3
3
  * @author WMXPY
4
- * @namespace Query
4
+ * @namespace Loader
5
5
  * @description Definition
6
6
  */
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @author WMXPY
3
+ * @namespace Loader
4
+ * @description Origin Loader
5
+ */
6
+ import { IImbricateOrigin } from "../origin/interface";
7
+ import { ImbricateOriginPersistance } from "./persistance";
8
+ export declare const loadImbricateOriginsFromPersistance: (persistance: ImbricateOriginPersistance) => Promise<IImbricateOrigin[]>;
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ /**
3
+ * @author WMXPY
4
+ * @namespace Loader
5
+ * @description Origin Loader
6
+ */
7
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
8
+ if (k2 === undefined) k2 = k;
9
+ var desc = Object.getOwnPropertyDescriptor(m, k);
10
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
11
+ desc = { enumerable: true, get: function() { return m[k]; } };
12
+ }
13
+ Object.defineProperty(o, k2, desc);
14
+ }) : (function(o, m, k, k2) {
15
+ if (k2 === undefined) k2 = k;
16
+ o[k2] = m[k];
17
+ }));
18
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
19
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
20
+ }) : function(o, v) {
21
+ o["default"] = v;
22
+ });
23
+ var __importStar = (this && this.__importStar) || function (mod) {
24
+ if (mod && mod.__esModule) return mod;
25
+ var result = {};
26
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
27
+ __setModuleDefault(result, mod);
28
+ return result;
29
+ };
30
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
31
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
32
+ return new (P || (P = Promise))(function (resolve, reject) {
33
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
34
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
35
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
36
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
37
+ });
38
+ };
39
+ Object.defineProperty(exports, "__esModule", { value: true });
40
+ exports.loadImbricateOriginsFromPersistance = void 0;
41
+ const persistance_1 = require("./persistance");
42
+ const loadImbricateOriginsFromPersistance = (persistance) => __awaiter(void 0, void 0, void 0, function* () {
43
+ const origins = [];
44
+ for (const origin of persistance.origins) {
45
+ switch (origin.originLoadType) {
46
+ case persistance_1.IMBRICATE_ORIGIN_LOAD_TYPE.NPM_PACKAGE: {
47
+ const originPackage = yield Promise.resolve(`${origin.originLoadValue}`).then(s => __importStar(require(s)));
48
+ if (typeof originPackage.default === "function") {
49
+ const initialized = originPackage.default.call(null, origin.originPayloads);
50
+ origins.push(initialized);
51
+ }
52
+ break;
53
+ }
54
+ case persistance_1.IMBRICATE_ORIGIN_LOAD_TYPE.FILE_SYSTEM: {
55
+ const originPackage = yield Promise.resolve(`${origin.originLoadValue}`).then(s => __importStar(require(s)));
56
+ if (typeof originPackage.default === "function") {
57
+ const initialized = originPackage.default.call(null, origin.originPayloads);
58
+ origins.push(initialized);
59
+ }
60
+ break;
61
+ }
62
+ }
63
+ }
64
+ return origins;
65
+ });
66
+ exports.loadImbricateOriginsFromPersistance = loadImbricateOriginsFromPersistance;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * @author WMXPY
3
+ * @namespace Loader
4
+ * @description Persistance
5
+ */
6
+ import { OriginPayload } from "../origin/definition";
7
+ export declare enum IMBRICATE_ORIGIN_LOAD_TYPE {
8
+ NPM_PACKAGE = "NPM_PACKAGE",
9
+ FILE_SYSTEM = "FILE_SYSTEM"
10
+ }
11
+ export type ImbricateOriginPersistanceOrigin = {
12
+ readonly originLoadType: IMBRICATE_ORIGIN_LOAD_TYPE;
13
+ readonly originLoadValue: string;
14
+ readonly originName: string;
15
+ readonly originPayloads: OriginPayload;
16
+ };
17
+ export type ImbricateOriginPersistance = {
18
+ readonly origins: ImbricateOriginPersistanceOrigin[];
19
+ };
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ /**
3
+ * @author WMXPY
4
+ * @namespace Loader
5
+ * @description Persistance
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.IMBRICATE_ORIGIN_LOAD_TYPE = void 0;
9
+ var IMBRICATE_ORIGIN_LOAD_TYPE;
10
+ (function (IMBRICATE_ORIGIN_LOAD_TYPE) {
11
+ IMBRICATE_ORIGIN_LOAD_TYPE["NPM_PACKAGE"] = "NPM_PACKAGE";
12
+ IMBRICATE_ORIGIN_LOAD_TYPE["FILE_SYSTEM"] = "FILE_SYSTEM";
13
+ })(IMBRICATE_ORIGIN_LOAD_TYPE || (exports.IMBRICATE_ORIGIN_LOAD_TYPE = IMBRICATE_ORIGIN_LOAD_TYPE = {}));
@@ -3,22 +3,4 @@
3
3
  * @namespace Origin
4
4
  * @description Definition
5
5
  */
6
- import { ImbricateCapability } from "../capability/definition";
7
- export declare enum IMBRICATE_DIGEST_ALGORITHM {
8
- MD5 = "MD5",
9
- SHA1 = "SHA1",
10
- SHA256 = "SHA256"
11
- }
12
- export type ImbricateOriginMetadata = {
13
- readonly digestAlgorithm: IMBRICATE_DIGEST_ALGORITHM;
14
- };
15
- export type ImbricateOriginCapability = Record<IMBRICATE_ORIGIN_CAPABILITY_KEY, ImbricateCapability>;
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",
20
- ORIGIN_SCRIPT_MANAGER = "imbricate.origin.script-manager",
21
- ORIGIN_COLLECTION_MANAGER = "imbricate.origin.collection-manager",
22
- ORIGIN_OPERATION_MANAGER = "imbricate.origin.operation-manager"
23
- }
24
- export declare const ImbricateOriginCapabilityList: IMBRICATE_ORIGIN_CAPABILITY_KEY[];
6
+ export type OriginPayload = Record<string, any>;
@@ -5,27 +5,3 @@
5
5
  * @description Definition
6
6
  */
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.ImbricateOriginCapabilityList = exports.IMBRICATE_ORIGIN_CAPABILITY_KEY = exports.IMBRICATE_DIGEST_ALGORITHM = void 0;
9
- var IMBRICATE_DIGEST_ALGORITHM;
10
- (function (IMBRICATE_DIGEST_ALGORITHM) {
11
- IMBRICATE_DIGEST_ALGORITHM["MD5"] = "MD5";
12
- IMBRICATE_DIGEST_ALGORITHM["SHA1"] = "SHA1";
13
- IMBRICATE_DIGEST_ALGORITHM["SHA256"] = "SHA256";
14
- })(IMBRICATE_DIGEST_ALGORITHM || (exports.IMBRICATE_DIGEST_ALGORITHM = IMBRICATE_DIGEST_ALGORITHM = {}));
15
- var IMBRICATE_ORIGIN_CAPABILITY_KEY;
16
- (function (IMBRICATE_ORIGIN_CAPABILITY_KEY) {
17
- IMBRICATE_ORIGIN_CAPABILITY_KEY["ORIGIN_FUNCTION"] = "imbricate.origin.function";
18
- IMBRICATE_ORIGIN_CAPABILITY_KEY["ORIGIN_BINARY_STORAGE"] = "imbricate.origin.binary-storage";
19
- IMBRICATE_ORIGIN_CAPABILITY_KEY["ORIGIN_TRASH_STASH"] = "imbricate.origin.trash-stash";
20
- IMBRICATE_ORIGIN_CAPABILITY_KEY["ORIGIN_SCRIPT_MANAGER"] = "imbricate.origin.script-manager";
21
- IMBRICATE_ORIGIN_CAPABILITY_KEY["ORIGIN_COLLECTION_MANAGER"] = "imbricate.origin.collection-manager";
22
- IMBRICATE_ORIGIN_CAPABILITY_KEY["ORIGIN_OPERATION_MANAGER"] = "imbricate.origin.operation-manager";
23
- })(IMBRICATE_ORIGIN_CAPABILITY_KEY || (exports.IMBRICATE_ORIGIN_CAPABILITY_KEY = IMBRICATE_ORIGIN_CAPABILITY_KEY = {}));
24
- exports.ImbricateOriginCapabilityList = [
25
- IMBRICATE_ORIGIN_CAPABILITY_KEY.ORIGIN_FUNCTION,
26
- IMBRICATE_ORIGIN_CAPABILITY_KEY.ORIGIN_BINARY_STORAGE,
27
- IMBRICATE_ORIGIN_CAPABILITY_KEY.ORIGIN_TRASH_STASH,
28
- IMBRICATE_ORIGIN_CAPABILITY_KEY.ORIGIN_SCRIPT_MANAGER,
29
- IMBRICATE_ORIGIN_CAPABILITY_KEY.ORIGIN_COLLECTION_MANAGER,
30
- IMBRICATE_ORIGIN_CAPABILITY_KEY.ORIGIN_OPERATION_MANAGER,
31
- ];