@imbricate/core 3.0.4 → 3.1.1

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.
@@ -15,11 +15,17 @@ export declare enum IMBRICATE_PROPERTY_TYPE {
15
15
  }
16
16
  /**
17
17
  * Document properties
18
+ *
19
+ * Key - Property key, which should match schema properties unique identifier
20
+ * Value - Property value, which should match schema properties type
18
21
  */
19
22
  export type DocumentProperties = Record<DocumentPropertyKey, DocumentPropertyValue<IMBRICATE_PROPERTY_TYPE>>;
23
+ /**
24
+ * Document property key, which should match schema properties unique identifier
25
+ */
20
26
  export type DocumentPropertyKey = string;
21
27
  export type DocumentPropertyValue<T extends IMBRICATE_PROPERTY_TYPE> = {
22
- readonly type: IMBRICATE_PROPERTY_TYPE;
28
+ readonly type: T;
23
29
  readonly value: DocumentPropertyValueObject<T>;
24
30
  };
25
31
  export type DocumentPropertyValueObject<T extends IMBRICATE_PROPERTY_TYPE> = T extends IMBRICATE_PROPERTY_TYPE.STRING ? string : T extends IMBRICATE_PROPERTY_TYPE.MARKDOWN ? string : never;
@@ -23,7 +23,7 @@ const validateImbricateProperties = (properties, schema) => {
23
23
  const keys = Object.keys(properties);
24
24
  for (const key of keys) {
25
25
  const property = schema.properties.find((each) => {
26
- return each.propertyName === key;
26
+ return each.propertyIdentifier === key;
27
27
  });
28
28
  if (!property) {
29
29
  return `Property ${key} not found in schema`;
package/index.d.ts CHANGED
@@ -16,7 +16,7 @@ export * from "./document/property/triage-manager";
16
16
  export * from "./document/validate";
17
17
  export * from "./loader/definition";
18
18
  export * from "./loader/origin-loader";
19
- export * from "./loader/persistance";
19
+ export * from "./loader/persistence";
20
20
  export * from "./origin/definition";
21
21
  export * from "./origin/interface";
22
22
  export * from "./static/interface";
package/index.js CHANGED
@@ -32,7 +32,7 @@ __exportStar(require("./document/property/triage-manager"), exports);
32
32
  __exportStar(require("./document/validate"), exports);
33
33
  __exportStar(require("./loader/definition"), exports);
34
34
  __exportStar(require("./loader/origin-loader"), exports);
35
- __exportStar(require("./loader/persistance"), exports);
35
+ __exportStar(require("./loader/persistence"), exports);
36
36
  __exportStar(require("./origin/definition"), exports);
37
37
  __exportStar(require("./origin/interface"), exports);
38
38
  __exportStar(require("./static/interface"), exports);
@@ -4,26 +4,26 @@
4
4
  * @description Origin Loader
5
5
  */
6
6
  import { IImbricateOrigin } from "../origin/interface";
7
- import { ImbricateOriginPersistance, ImbricateOriginPersistanceOrigin } from "./persistance";
7
+ import { ImbricateOriginPersistence, ImbricateOriginPersistenceOrigin } from "./persistence";
8
8
  /**
9
- * Load imbricate origin from persistance origin
10
- * This function will load the origin from the persistance origin
9
+ * Load imbricate origin from persistence origin
10
+ * This function will load the origin from the persistence origin
11
11
  * and initialize the origin with the payloads
12
12
  *
13
- * @param origin origin to persistance to load
13
+ * @param origin origin to persistence to load
14
14
  *
15
15
  * @returns a promise of the loaded origin
16
16
  * if the origin is not found, return null
17
17
  */
18
- export declare const loadImbricateOriginFromPersistanceOrigin: (origin: ImbricateOriginPersistanceOrigin) => Promise<IImbricateOrigin | null>;
18
+ export declare const loadImbricateOriginFromPersistenceOrigin: (origin: ImbricateOriginPersistenceOrigin) => Promise<IImbricateOrigin | null>;
19
19
  /**
20
- * Load imbricate origins from persistance
21
- * This function will load all origins from the persistance
20
+ * Load imbricate origins from persistence
21
+ * This function will load all origins from the persistence
22
22
  * and initialize the origins with the payloads
23
23
  * If the origin is not found, it will be ignored
24
24
  *
25
- * @param persistance persistance to load origins
25
+ * @param persistence persistence to load origins
26
26
  *
27
27
  * @returns a promise of the loaded origins, if the origin is not found, return empty array
28
28
  */
29
- export declare const loadImbricateOriginsFromPersistance: (persistance: ImbricateOriginPersistance) => Promise<IImbricateOrigin[]>;
29
+ export declare const loadImbricateOriginsFromPersistence: (persistence: ImbricateOriginPersistence) => Promise<IImbricateOrigin[]>;
@@ -37,21 +37,21 @@ 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 = exports.loadImbricateOriginFromPersistanceOrigin = void 0;
41
- const persistance_1 = require("./persistance");
40
+ exports.loadImbricateOriginsFromPersistence = exports.loadImbricateOriginFromPersistenceOrigin = void 0;
41
+ const persistence_1 = require("./persistence");
42
42
  /**
43
- * Load imbricate origin from persistance origin
44
- * This function will load the origin from the persistance origin
43
+ * Load imbricate origin from persistence origin
44
+ * This function will load the origin from the persistence origin
45
45
  * and initialize the origin with the payloads
46
46
  *
47
- * @param origin origin to persistance to load
47
+ * @param origin origin to persistence to load
48
48
  *
49
49
  * @returns a promise of the loaded origin
50
50
  * if the origin is not found, return null
51
51
  */
52
- const loadImbricateOriginFromPersistanceOrigin = (origin) => __awaiter(void 0, void 0, void 0, function* () {
52
+ const loadImbricateOriginFromPersistenceOrigin = (origin) => __awaiter(void 0, void 0, void 0, function* () {
53
53
  switch (origin.originLoadType) {
54
- case persistance_1.IMBRICATE_ORIGIN_LOAD_TYPE.NPM_PACKAGE: {
54
+ case persistence_1.IMBRICATE_ORIGIN_LOAD_TYPE.NPM_PACKAGE: {
55
55
  const originPackage = yield Promise.resolve(`${origin.originLoadValue}`).then(s => __importStar(require(s)));
56
56
  if (typeof originPackage.default === "function") {
57
57
  const initialized = originPackage.default.call(null, origin.originPayloads);
@@ -59,7 +59,7 @@ const loadImbricateOriginFromPersistanceOrigin = (origin) => __awaiter(void 0, v
59
59
  }
60
60
  break;
61
61
  }
62
- case persistance_1.IMBRICATE_ORIGIN_LOAD_TYPE.FILE_SYSTEM: {
62
+ case persistence_1.IMBRICATE_ORIGIN_LOAD_TYPE.FILE_SYSTEM: {
63
63
  const originPackage = yield Promise.resolve(`${origin.originLoadValue}`).then(s => __importStar(require(s)));
64
64
  if (typeof originPackage.default === "function") {
65
65
  const initialized = originPackage.default.call(null, origin.originPayloads);
@@ -70,25 +70,25 @@ const loadImbricateOriginFromPersistanceOrigin = (origin) => __awaiter(void 0, v
70
70
  }
71
71
  return null;
72
72
  });
73
- exports.loadImbricateOriginFromPersistanceOrigin = loadImbricateOriginFromPersistanceOrigin;
73
+ exports.loadImbricateOriginFromPersistenceOrigin = loadImbricateOriginFromPersistenceOrigin;
74
74
  /**
75
- * Load imbricate origins from persistance
76
- * This function will load all origins from the persistance
75
+ * Load imbricate origins from persistence
76
+ * This function will load all origins from the persistence
77
77
  * and initialize the origins with the payloads
78
78
  * If the origin is not found, it will be ignored
79
79
  *
80
- * @param persistance persistance to load origins
80
+ * @param persistence persistence to load origins
81
81
  *
82
82
  * @returns a promise of the loaded origins, if the origin is not found, return empty array
83
83
  */
84
- const loadImbricateOriginsFromPersistance = (persistance) => __awaiter(void 0, void 0, void 0, function* () {
84
+ const loadImbricateOriginsFromPersistence = (persistence) => __awaiter(void 0, void 0, void 0, function* () {
85
85
  const origins = [];
86
- for (const origin of persistance.origins) {
87
- const originInstance = yield (0, exports.loadImbricateOriginFromPersistanceOrigin)(origin);
86
+ for (const origin of persistence.origins) {
87
+ const originInstance = yield (0, exports.loadImbricateOriginFromPersistenceOrigin)(origin);
88
88
  if (originInstance) {
89
89
  origins.push(originInstance);
90
90
  }
91
91
  }
92
92
  return origins;
93
93
  });
94
- exports.loadImbricateOriginsFromPersistance = loadImbricateOriginsFromPersistance;
94
+ exports.loadImbricateOriginsFromPersistence = loadImbricateOriginsFromPersistence;
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @author WMXPY
3
3
  * @namespace Loader
4
- * @description Persistance
4
+ * @description Persistence
5
5
  */
6
6
  import { OriginPayload } from "../origin/definition";
7
7
  /**
@@ -14,12 +14,12 @@ export declare enum IMBRICATE_ORIGIN_LOAD_TYPE {
14
14
  NPM_PACKAGE = "NPM_PACKAGE",
15
15
  FILE_SYSTEM = "FILE_SYSTEM"
16
16
  }
17
- export type ImbricateOriginPersistanceOrigin = {
17
+ export type ImbricateOriginPersistenceOrigin = {
18
18
  readonly originLoadType: IMBRICATE_ORIGIN_LOAD_TYPE;
19
19
  readonly originLoadValue: string;
20
20
  readonly originName: string;
21
21
  readonly originPayloads: OriginPayload;
22
22
  };
23
- export type ImbricateOriginPersistance = {
24
- readonly origins: ImbricateOriginPersistanceOrigin[];
23
+ export type ImbricateOriginPersistence = {
24
+ readonly origins: ImbricateOriginPersistenceOrigin[];
25
25
  };
@@ -2,7 +2,7 @@
2
2
  /**
3
3
  * @author WMXPY
4
4
  * @namespace Loader
5
- * @description Persistance
5
+ * @description Persistence
6
6
  */
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
8
  exports.IMBRICATE_ORIGIN_LOAD_TYPE = void 0;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@imbricate/core",
3
3
  "main": "index.js",
4
- "version": "3.0.4",
4
+ "version": "3.1.1",
5
5
  "description": "Imbricate Core, Notebook for Engineers",
6
6
  "repository": {
7
7
  "type": "git",