@imbricate/core 3.0.0 → 3.0.2

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.
@@ -3,8 +3,8 @@
3
3
  * @namespace Database
4
4
  * @description Interface
5
5
  */
6
- import { DocumentProperties } from "../document/definition";
7
6
  import { IImbricateDocument } from "../document/interface";
7
+ import { DocumentProperties } from "../document/property";
8
8
  import { ImbricateDocumentQuery } from "./definition";
9
9
  import { ImbricateDatabaseSchema } from "./schema";
10
10
  export interface IImbricateDatabase {
@@ -12,10 +12,17 @@ export interface IImbricateDatabase {
12
12
  * Unique identifier of the database
13
13
  */
14
14
  readonly uniqueIdentifier: string;
15
+ /**
16
+ * Name of the database
17
+ */
15
18
  readonly databaseName: string;
19
+ /**
20
+ * Schema of the database
21
+ */
16
22
  readonly schema: ImbricateDatabaseSchema;
17
23
  /**
18
24
  * Create a new document in the database
25
+ * If origin supports Document Edit Record, the edit record will be added by default
19
26
  *
20
27
  * @param properties properties of the document
21
28
  * @param uniqueIdentifier unique identifier of the document, optional
@@ -27,6 +34,8 @@ export interface IImbricateDatabase {
27
34
  /**
28
35
  * Get one document from the database
29
36
  *
37
+ * @param uniqueIdentifier unique identifier of the document
38
+ *
30
39
  * @returns a promise of the documents in the database, null if not found
31
40
  */
32
41
  getDocument(uniqueIdentifier: string): PromiseLike<IImbricateDocument | null>;
@@ -4,14 +4,22 @@
4
4
  * @description Manager
5
5
  */
6
6
  import { IImbricateDatabase } from "./interface";
7
- import { ImbricateDatabaseSchema } from "./schema";
7
+ import { ImbricateDatabaseSchemaForCreation } from "./schema";
8
8
  export interface IImbricateDatabaseManager {
9
9
  /**
10
- * Get databases from the origin
10
+ * List all databases in the origin
11
11
  *
12
12
  * @returns a promise of the databases in the origin
13
13
  */
14
- getDatabases(): PromiseLike<IImbricateDatabase[]>;
14
+ listDatabases(): PromiseLike<IImbricateDatabase[]>;
15
+ /**
16
+ * Get one database from the origin
17
+ *
18
+ * @param uniqueIdentifier unique identifier of the database
19
+ *
20
+ * @returns a promise of the database, null if not found
21
+ */
22
+ getDatabase(uniqueIdentifier: string): PromiseLike<IImbricateDatabase | null>;
15
23
  /**
16
24
  * Create a new database
17
25
  *
@@ -22,5 +30,5 @@ export interface IImbricateDatabaseManager {
22
30
  *
23
31
  * @returns a promise of the created database
24
32
  */
25
- createDatabase(databaseName: string, schema: ImbricateDatabaseSchema, uniqueIdentifier?: string): PromiseLike<IImbricateDatabase>;
33
+ createDatabase(databaseName: string, schema: ImbricateDatabaseSchemaForCreation, uniqueIdentifier?: string): PromiseLike<IImbricateDatabase>;
26
34
  }
@@ -3,12 +3,35 @@
3
3
  * @namespace Database
4
4
  * @description Schema
5
5
  */
6
- import { IMBRICATE_PROPERTY_TYPE } from "../document/definition";
6
+ import { IMBRICATE_PROPERTY_TYPE } from "../document/property";
7
7
  export type ImbricateDatabaseSchemaProperty = {
8
8
  readonly propertyIdentifier: string;
9
+ } & ImbricateDatabaseSchemaPropertyForCreation;
10
+ export type ImbricateDatabaseSchemaPropertyForCreation = {
9
11
  readonly propertyName: string;
10
12
  readonly propertyType: IMBRICATE_PROPERTY_TYPE;
11
13
  };
12
14
  export type ImbricateDatabaseSchema = {
13
15
  readonly properties: ImbricateDatabaseSchemaProperty[];
14
16
  };
17
+ export type ImbricateDatabaseSchemaForCreation = {
18
+ readonly properties: ImbricateDatabaseSchemaPropertyForCreation[];
19
+ };
20
+ /**
21
+ * Validate a schema property
22
+ *
23
+ * @param property property to validate
24
+ *
25
+ * @returns a string error message if validation failed
26
+ * null if validation passed
27
+ */
28
+ export declare const validateImbricateSchemaProperty: (property: ImbricateDatabaseSchemaProperty) => string | null;
29
+ /**
30
+ * Validate a schema
31
+ *
32
+ * @param schema database schema to validate
33
+ *
34
+ * @returns a string error message if validation failed
35
+ * null if validation passed
36
+ */
37
+ export declare const validateImbricateSchema: (schema: ImbricateDatabaseSchema) => string | null;
@@ -5,3 +5,52 @@
5
5
  * @description Schema
6
6
  */
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.validateImbricateSchema = exports.validateImbricateSchemaProperty = void 0;
9
+ const property_1 = require("../document/property");
10
+ /**
11
+ * Validate a schema property
12
+ *
13
+ * @param property property to validate
14
+ *
15
+ * @returns a string error message if validation failed
16
+ * null if validation passed
17
+ */
18
+ const validateImbricateSchemaProperty = (property) => {
19
+ if (typeof property.propertyIdentifier !== "string") {
20
+ return "Property identifier must be a string";
21
+ }
22
+ if (typeof property.propertyName !== "string") {
23
+ return "Property name must be a string";
24
+ }
25
+ if (!Object.values(property_1.IMBRICATE_PROPERTY_TYPE).includes(property.propertyType)) {
26
+ return "Property type must be a valid type";
27
+ }
28
+ return null;
29
+ };
30
+ exports.validateImbricateSchemaProperty = validateImbricateSchemaProperty;
31
+ /**
32
+ * Validate a schema
33
+ *
34
+ * @param schema database schema to validate
35
+ *
36
+ * @returns a string error message if validation failed
37
+ * null if validation passed
38
+ */
39
+ const validateImbricateSchema = (schema) => {
40
+ if (!Array.isArray(schema.properties)) {
41
+ return "Properties must be an array";
42
+ }
43
+ const propertyNames = new Set();
44
+ for (const property of schema.properties) {
45
+ const propertyValidationResult = (0, exports.validateImbricateSchemaProperty)(property);
46
+ if (typeof propertyValidationResult === "string") {
47
+ return `Invalid property ${property.propertyName}, ${propertyValidationResult}`;
48
+ }
49
+ if (propertyNames.has(property.propertyName)) {
50
+ return `Duplicated property name ${property.propertyName}`;
51
+ }
52
+ propertyNames.add(property.propertyName);
53
+ }
54
+ return null;
55
+ };
56
+ exports.validateImbricateSchema = validateImbricateSchema;
@@ -4,19 +4,7 @@
4
4
  * @description Definition
5
5
  */
6
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
- }
7
+ import { DocumentPropertyKey, DocumentPropertyValue, IMBRICATE_DOCUMENT_EDIT_TYPE } from "./property";
20
8
  export type DocumentEditOperation = {
21
9
  readonly key: DocumentPropertyKey;
22
10
  readonly action: IMBRICATE_DOCUMENT_EDIT_TYPE;
@@ -5,13 +5,3 @@
5
5
  * @description Definition
6
6
  */
7
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 = {}));
@@ -3,7 +3,8 @@
3
3
  * @namespace Document
4
4
  * @description Interface
5
5
  */
6
- import { DocumentEditRecord, DocumentProperties, DocumentPropertyKey, DocumentPropertyValue } from "./definition";
6
+ import { DocumentEditRecord } from "./definition";
7
+ import { DocumentProperties, DocumentPropertyKey, DocumentPropertyValue } from "./property";
7
8
  export interface IImbricateDocument {
8
9
  /**
9
10
  * Unique identifier of the database
@@ -14,20 +15,26 @@ export interface IImbricateDocument {
14
15
  *
15
16
  * @param key key of the property
16
17
  * @param value value of the property
18
+ * @param noEditRecord do not add edit record, optional
19
+ * Default to false, if set to true, the edit record will not be added to the document
17
20
  *
18
21
  * @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.
22
+ * Note: the edit records will not be added to the document if `noEditRecord` is true,
23
+ * Call `addEditRecords` to add the edit records manually.
20
24
  */
21
- putProperty(key: DocumentPropertyKey, value: DocumentPropertyValue): PromiseLike<DocumentEditRecord[]>;
25
+ putProperty(key: DocumentPropertyKey, value: DocumentPropertyValue, noEditRecord?: boolean): PromiseLike<DocumentEditRecord[]>;
22
26
  /**
23
27
  * Put and replace all properties of the document
24
28
  *
25
29
  * @param properties properties of the document
30
+ * @param noEditRecord do not add edit record, optional
31
+ * Default to false, if set to true, the edit record will not be added to the document
26
32
  *
27
33
  * @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.
34
+ * Note: the edit records will not be added to the document if `noEditRecord` is true,
35
+ * Call `addEditRecords` to add the edit records manually.
29
36
  */
30
- putProperties(properties: DocumentProperties): PromiseLike<DocumentEditRecord[]>;
37
+ putProperties(properties: DocumentProperties, noEditRecord?: boolean): PromiseLike<DocumentEditRecord[]>;
31
38
  /**
32
39
  * Get properties from the document
33
40
  *
@@ -35,15 +42,21 @@ export interface IImbricateDocument {
35
42
  */
36
43
  getProperties(): PromiseLike<DocumentProperties>;
37
44
  /**
38
- * Add edit records to the document
45
+ * Add edit records to the document, optional
46
+ * This method is optional, if not implemented, means the origin
47
+ * 1. The origin does not support edit records
48
+ * 2. The origin force to add edit records when put properties
39
49
  *
40
50
  * @param records document edit records
41
51
  */
42
- addEditRecords(records: DocumentEditRecord[]): PromiseLike<void>;
52
+ addEditRecords?(records: DocumentEditRecord[]): PromiseLike<void>;
43
53
  /**
44
- * Get edit records of the document
54
+ * Get edit records of the document, optional
55
+ * This method is optional, if not implemented, means the origin
56
+ * 1. The origin does not support edit records
57
+ * 2. The origin force to add edit records when put properties
45
58
  *
46
59
  * @returns a promise of the edit records of the document
47
60
  */
48
- getEditRecords(): PromiseLike<DocumentEditRecord[]>;
61
+ getEditRecords?(): PromiseLike<DocumentEditRecord[]>;
49
62
  }
@@ -0,0 +1,30 @@
1
+ /**
2
+ * @author WMXPY
3
+ * @namespace Document
4
+ * @description Property
5
+ */
6
+ /**
7
+ * Document properties
8
+ *
9
+ * STRING - string, store as plain text
10
+ * MARKDOWN - markdown, store as text object unique identifier. Display as markdown
11
+ */
12
+ export declare enum IMBRICATE_PROPERTY_TYPE {
13
+ STRING = "STRING",
14
+ MARKDOWN = "MARKDOWN"
15
+ }
16
+ /**
17
+ * Document properties
18
+ */
19
+ export type DocumentProperties = Record<DocumentPropertyKey, DocumentPropertyValue>;
20
+ export type DocumentPropertyKey = string;
21
+ export type DocumentPropertyValue = {
22
+ readonly type: IMBRICATE_PROPERTY_TYPE;
23
+ readonly value: any;
24
+ };
25
+ /**
26
+ * Edit record type of the document
27
+ */
28
+ export declare enum IMBRICATE_DOCUMENT_EDIT_TYPE {
29
+ PUT = "PUT"
30
+ }
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ /**
3
+ * @author WMXPY
4
+ * @namespace Document
5
+ * @description Property
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.IMBRICATE_DOCUMENT_EDIT_TYPE = exports.IMBRICATE_PROPERTY_TYPE = void 0;
9
+ /**
10
+ * Document properties
11
+ *
12
+ * STRING - string, store as plain text
13
+ * MARKDOWN - markdown, store as text object unique identifier. Display as markdown
14
+ */
15
+ var IMBRICATE_PROPERTY_TYPE;
16
+ (function (IMBRICATE_PROPERTY_TYPE) {
17
+ IMBRICATE_PROPERTY_TYPE["STRING"] = "STRING";
18
+ IMBRICATE_PROPERTY_TYPE["MARKDOWN"] = "MARKDOWN";
19
+ })(IMBRICATE_PROPERTY_TYPE || (exports.IMBRICATE_PROPERTY_TYPE = IMBRICATE_PROPERTY_TYPE = {}));
20
+ /**
21
+ * Edit record type of the document
22
+ */
23
+ var IMBRICATE_DOCUMENT_EDIT_TYPE;
24
+ (function (IMBRICATE_DOCUMENT_EDIT_TYPE) {
25
+ IMBRICATE_DOCUMENT_EDIT_TYPE["PUT"] = "PUT";
26
+ })(IMBRICATE_DOCUMENT_EDIT_TYPE || (exports.IMBRICATE_DOCUMENT_EDIT_TYPE = IMBRICATE_DOCUMENT_EDIT_TYPE = {}));
@@ -0,0 +1,17 @@
1
+ /**
2
+ * @author WMXPY
3
+ * @namespace Document
4
+ * @description Validate
5
+ */
6
+ import { ImbricateDatabaseSchema } from "../database/schema";
7
+ import { DocumentProperties } from "./property";
8
+ /**
9
+ * Validate properties with schema
10
+ *
11
+ * @param properties properties to validate
12
+ * @param schema database schema to validate
13
+ *
14
+ * @returns a string error message if validation failed
15
+ * null if validation passed
16
+ */
17
+ export declare const validateImbricateProperties: (properties: DocumentProperties, schema: ImbricateDatabaseSchema) => string | null;
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ /**
3
+ * @author WMXPY
4
+ * @namespace Document
5
+ * @description Validate
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.validateImbricateProperties = void 0;
9
+ const property_1 = require("./property");
10
+ /**
11
+ * Validate properties with schema
12
+ *
13
+ * @param properties properties to validate
14
+ * @param schema database schema to validate
15
+ *
16
+ * @returns a string error message if validation failed
17
+ * null if validation passed
18
+ */
19
+ const validateImbricateProperties = (properties, schema) => {
20
+ if (typeof properties !== "object") {
21
+ return "Properties must be an object";
22
+ }
23
+ const keys = Object.keys(properties);
24
+ for (const key of keys) {
25
+ const property = schema.properties.find((each) => {
26
+ return each.propertyName === key;
27
+ });
28
+ if (!property) {
29
+ return `Property ${key} not found in schema`;
30
+ }
31
+ const value = properties[key];
32
+ if (typeof value.type !== "string") {
33
+ return `Property ${key} type must be a string`;
34
+ }
35
+ if (value.type !== property.propertyType) {
36
+ return `Property ${key} type must be ${property.propertyType}, but got ${value.type}`;
37
+ }
38
+ switch (value.type) {
39
+ case property_1.IMBRICATE_PROPERTY_TYPE.STRING: {
40
+ if (typeof value.value !== "string") {
41
+ return `Property ${key} value must be a string`;
42
+ }
43
+ break;
44
+ }
45
+ case property_1.IMBRICATE_PROPERTY_TYPE.MARKDOWN: {
46
+ if (typeof value.value !== "string") {
47
+ return `Property ${key} value must be a string of text object reference`;
48
+ }
49
+ break;
50
+ }
51
+ }
52
+ }
53
+ return null;
54
+ };
55
+ exports.validateImbricateProperties = validateImbricateProperties;
package/index.d.ts CHANGED
@@ -9,6 +9,8 @@ export * from "./database/manager";
9
9
  export * from "./database/schema";
10
10
  export * from "./document/definition";
11
11
  export * from "./document/interface";
12
+ export * from "./document/property";
13
+ export * from "./document/validate";
12
14
  export * from "./loader/definition";
13
15
  export * from "./loader/origin-loader";
14
16
  export * from "./loader/persistance";
package/index.js CHANGED
@@ -25,6 +25,8 @@ __exportStar(require("./database/manager"), exports);
25
25
  __exportStar(require("./database/schema"), exports);
26
26
  __exportStar(require("./document/definition"), exports);
27
27
  __exportStar(require("./document/interface"), exports);
28
+ __exportStar(require("./document/property"), exports);
29
+ __exportStar(require("./document/validate"), exports);
28
30
  __exportStar(require("./loader/definition"), exports);
29
31
  __exportStar(require("./loader/origin-loader"), exports);
30
32
  __exportStar(require("./loader/persistance"), exports);
@@ -4,5 +4,26 @@
4
4
  * @description Origin Loader
5
5
  */
6
6
  import { IImbricateOrigin } from "../origin/interface";
7
- import { ImbricateOriginPersistance } from "./persistance";
7
+ import { ImbricateOriginPersistance, ImbricateOriginPersistanceOrigin } from "./persistance";
8
+ /**
9
+ * Load imbricate origin from persistance origin
10
+ * This function will load the origin from the persistance origin
11
+ * and initialize the origin with the payloads
12
+ *
13
+ * @param origin origin to persistance to load
14
+ *
15
+ * @returns a promise of the loaded origin
16
+ * if the origin is not found, return null
17
+ */
18
+ export declare const loadImbricateOriginFromPersistanceOrigin: (origin: ImbricateOriginPersistanceOrigin) => Promise<IImbricateOrigin | null>;
19
+ /**
20
+ * Load imbricate origins from persistance
21
+ * This function will load all origins from the persistance
22
+ * and initialize the origins with the payloads
23
+ * If the origin is not found, it will be ignored
24
+ *
25
+ * @param persistance persistance to load origins
26
+ *
27
+ * @returns a promise of the loaded origins, if the origin is not found, return empty array
28
+ */
8
29
  export declare const loadImbricateOriginsFromPersistance: (persistance: ImbricateOriginPersistance) => Promise<IImbricateOrigin[]>;
@@ -37,28 +37,56 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
37
37
  });
38
38
  };
39
39
  Object.defineProperty(exports, "__esModule", { value: true });
40
- exports.loadImbricateOriginsFromPersistance = void 0;
40
+ exports.loadImbricateOriginsFromPersistance = exports.loadImbricateOriginFromPersistanceOrigin = void 0;
41
41
  const persistance_1 = require("./persistance");
42
+ /**
43
+ * Load imbricate origin from persistance origin
44
+ * This function will load the origin from the persistance origin
45
+ * and initialize the origin with the payloads
46
+ *
47
+ * @param origin origin to persistance to load
48
+ *
49
+ * @returns a promise of the loaded origin
50
+ * if the origin is not found, return null
51
+ */
52
+ const loadImbricateOriginFromPersistanceOrigin = (origin) => __awaiter(void 0, void 0, void 0, function* () {
53
+ switch (origin.originLoadType) {
54
+ case persistance_1.IMBRICATE_ORIGIN_LOAD_TYPE.NPM_PACKAGE: {
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
+ return initialized;
59
+ }
60
+ break;
61
+ }
62
+ case persistance_1.IMBRICATE_ORIGIN_LOAD_TYPE.FILE_SYSTEM: {
63
+ const originPackage = yield Promise.resolve(`${origin.originLoadValue}`).then(s => __importStar(require(s)));
64
+ if (typeof originPackage.default === "function") {
65
+ const initialized = originPackage.default.call(null, origin.originPayloads);
66
+ return initialized;
67
+ }
68
+ break;
69
+ }
70
+ }
71
+ return null;
72
+ });
73
+ exports.loadImbricateOriginFromPersistanceOrigin = loadImbricateOriginFromPersistanceOrigin;
74
+ /**
75
+ * Load imbricate origins from persistance
76
+ * This function will load all origins from the persistance
77
+ * and initialize the origins with the payloads
78
+ * If the origin is not found, it will be ignored
79
+ *
80
+ * @param persistance persistance to load origins
81
+ *
82
+ * @returns a promise of the loaded origins, if the origin is not found, return empty array
83
+ */
42
84
  const loadImbricateOriginsFromPersistance = (persistance) => __awaiter(void 0, void 0, void 0, function* () {
43
85
  const origins = [];
44
86
  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
- }
87
+ const originInstance = yield (0, exports.loadImbricateOriginFromPersistanceOrigin)(origin);
88
+ if (originInstance) {
89
+ origins.push(originInstance);
62
90
  }
63
91
  }
64
92
  return origins;
@@ -4,6 +4,12 @@
4
4
  * @description Persistance
5
5
  */
6
6
  import { OriginPayload } from "../origin/definition";
7
+ /**
8
+ * Imbricate Origin Load Type
9
+ *
10
+ * NPM_PACKAGE - load origin from npm package, as package name
11
+ * FILE_SYSTEM - load origin from file system, as file path
12
+ */
7
13
  export declare enum IMBRICATE_ORIGIN_LOAD_TYPE {
8
14
  NPM_PACKAGE = "NPM_PACKAGE",
9
15
  FILE_SYSTEM = "FILE_SYSTEM"
@@ -6,6 +6,12 @@
6
6
  */
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
8
  exports.IMBRICATE_ORIGIN_LOAD_TYPE = void 0;
9
+ /**
10
+ * Imbricate Origin Load Type
11
+ *
12
+ * NPM_PACKAGE - load origin from npm package, as package name
13
+ * FILE_SYSTEM - load origin from file system, as file path
14
+ */
9
15
  var IMBRICATE_ORIGIN_LOAD_TYPE;
10
16
  (function (IMBRICATE_ORIGIN_LOAD_TYPE) {
11
17
  IMBRICATE_ORIGIN_LOAD_TYPE["NPM_PACKAGE"] = "NPM_PACKAGE";
@@ -39,6 +39,11 @@ export interface IImbricateOrigin {
39
39
  /**
40
40
  * Dispose the origin, optional
41
41
  * This method will be called when the origin is no longer needed
42
+ *
43
+ * If the origin needs to dispose resources, override this method
44
+ * else, do not implement this method
45
+ *
46
+ * Example: close database connection, or close file system
42
47
  */
43
48
  dispose?(): PromiseLike<void>;
44
49
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@imbricate/core",
3
3
  "main": "index.js",
4
- "version": "3.0.0",
4
+ "version": "3.0.2",
5
5
  "description": "Imbricate Core, Notebook for Engineers",
6
6
  "repository": {
7
7
  "type": "git",