@imbricate/core 3.19.1 → 3.20.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 (50) hide show
  1. package/database/base-class/essential-readonly.d.ts +2 -2
  2. package/database/base-class/full-feature-readonly.d.ts +2 -2
  3. package/database/base-class/full-feature-with-action.d.ts +2 -2
  4. package/database/base-class/full-feature.d.ts +2 -2
  5. package/database/interface.d.ts +2 -2
  6. package/database/schema.d.ts +1 -1
  7. package/database/schema.js +3 -3
  8. package/document/base-class/essential-readonly.d.ts +3 -3
  9. package/document/base-class/full-feature-readonly.d.ts +3 -3
  10. package/document/base-class/full-feature-with-action.d.ts +7 -5
  11. package/document/base-class/full-feature.d.ts +1 -10
  12. package/document/definition.d.ts +5 -3
  13. package/document/export.d.ts +0 -2
  14. package/document/export.js +0 -2
  15. package/document/interface.d.ts +17 -8
  16. package/document/outcome.d.ts +18 -0
  17. package/document/outcome.js +15 -1
  18. package/document/property/default-value.d.ts +2 -2
  19. package/document/property/default-value.js +10 -10
  20. package/document/property/definition.d.ts +4 -2
  21. package/document/property/primary.d.ts +4 -2
  22. package/document/property/triage-base.d.ts +15 -13
  23. package/document/property/triage-base.js +11 -11
  24. package/document/property/triage-manager.d.ts +5 -4
  25. package/document/property/triage.d.ts +2 -2
  26. package/error/property/feature-not-supported.d.ts +12 -0
  27. package/error/property/feature-not-supported.js +20 -0
  28. package/error/property/property-error.d.ts +9 -0
  29. package/error/property/property-error.js +16 -0
  30. package/index.d.ts +1 -0
  31. package/index.js +1 -0
  32. package/package.json +1 -1
  33. package/property/base-class/full-feature-with-action.d.ts +18 -0
  34. package/property/base-class/full-feature-with-action.js +18 -0
  35. package/property/base-class/full-feature.d.ts +15 -0
  36. package/property/base-class/full-feature.js +24 -0
  37. package/property/definition.d.ts +9 -0
  38. package/property/definition.js +7 -0
  39. package/property/export.d.ts +13 -0
  40. package/property/export.js +29 -0
  41. package/property/feature.d.ts +10 -0
  42. package/property/feature.js +17 -0
  43. package/property/interface.d.ts +45 -0
  44. package/property/interface.js +7 -0
  45. package/property/map.d.ts +9 -0
  46. package/property/map.js +7 -0
  47. package/{document/property.d.ts → property/type.d.ts} +5 -20
  48. package/{document/property.js → property/type.js} +3 -3
  49. package/{document → property}/validate.d.ts +3 -3
  50. package/{document → property}/validate.js +33 -30
@@ -3,7 +3,7 @@
3
3
  * @namespace Database
4
4
  * @description Essential Readonly
5
5
  */
6
- import { DocumentProperties } from "../../document/property";
6
+ import { ImbricatePropertyRecord } from "../../property/map";
7
7
  import { ImbricateDatabaseAuditOptions } from "../definition";
8
8
  import { IMBRICATE_DATABASE_FEATURE } from "../feature";
9
9
  import { IImbricateDatabase } from "../interface";
@@ -13,6 +13,6 @@ import { ImbricateDatabaseEssentialBase } from "./essential";
13
13
  export declare abstract class ImbricateDatabaseEssentialReadOnlyBase extends ImbricateDatabaseEssentialBase implements IImbricateDatabase {
14
14
  readonly supportedFeatures: IMBRICATE_DATABASE_FEATURE[];
15
15
  putSchema(_schema: ImbricateDatabaseSchema, _auditOptions?: ImbricateDatabaseAuditOptions): PromiseLike<ImbricateDatabasePutSchemaOutcome>;
16
- createDocument(_properties: DocumentProperties, _auditOptions?: ImbricateDatabaseAuditOptions): PromiseLike<ImbricateDatabaseCreateDocumentOutcome>;
16
+ createDocument(_properties: ImbricatePropertyRecord, _auditOptions?: ImbricateDatabaseAuditOptions): PromiseLike<ImbricateDatabaseCreateDocumentOutcome>;
17
17
  removeDocument(_uniqueIdentifier: string, _auditOptions?: ImbricateDatabaseAuditOptions): PromiseLike<ImbricateDatabaseRemoveDocumentOutcome>;
18
18
  }
@@ -3,7 +3,7 @@
3
3
  * @namespace Database_BaseClass
4
4
  * @description Full Feature Readonly
5
5
  */
6
- import { DocumentProperties } from "../../document/property";
6
+ import { ImbricatePropertyRecord } from "../../property/map";
7
7
  import { DatabaseAnnotationValue, DatabaseEditRecord, ImbricateDatabaseAuditOptions } from "../definition";
8
8
  import { IMBRICATE_DATABASE_FEATURE } from "../feature";
9
9
  import { IImbricateDatabase } from "../interface";
@@ -13,7 +13,7 @@ import { ImbricateDatabaseFullFeatureBase } from "./full-feature";
13
13
  export declare abstract class ImbricateDatabaseFullFeatureReadOnlyBase extends ImbricateDatabaseFullFeatureBase implements IImbricateDatabase {
14
14
  readonly supportedFeatures: IMBRICATE_DATABASE_FEATURE[];
15
15
  putSchema(_schema: ImbricateDatabaseSchema, _auditOptions?: ImbricateDatabaseAuditOptions): PromiseLike<ImbricateDatabasePutSchemaOutcome>;
16
- createDocument(_properties: DocumentProperties, _auditOptions?: ImbricateDatabaseAuditOptions): PromiseLike<ImbricateDatabaseCreateDocumentOutcome>;
16
+ createDocument(_properties: ImbricatePropertyRecord, _auditOptions?: ImbricateDatabaseAuditOptions): PromiseLike<ImbricateDatabaseCreateDocumentOutcome>;
17
17
  removeDocument(_uniqueIdentifier: string, _auditOptions?: ImbricateDatabaseAuditOptions): PromiseLike<ImbricateDatabaseRemoveDocumentOutcome>;
18
18
  putAnnotation(_namespace: string, _identifier: string, _value: DatabaseAnnotationValue, _auditOptions?: ImbricateDatabaseAuditOptions): PromiseLike<ImbricateDatabasePutAnnotationOutcome>;
19
19
  deleteAnnotation(_namespace: string, _identifier: string, _auditOptions?: ImbricateDatabaseAuditOptions): PromiseLike<ImbricateDatabaseDeleteAnnotationOutcome>;
@@ -4,7 +4,7 @@
4
4
  * @description Full Feature With Action
5
5
  */
6
6
  import { ImbricateCommonQueryOriginActionsOutcome, ImbricateCommonQueryOriginActionsQuery, ImbricateOriginActionInput, ImbricateOriginActionOutcome } from "../../common/action";
7
- import { DocumentProperties } from "../../document/property";
7
+ import { ImbricatePropertyRecord } from "../../property/map";
8
8
  import { DatabaseAnnotationValue, DatabaseAnnotations, DatabaseEditRecord, ImbricateDatabaseAuditOptions, ImbricateDocumentQuery } from "../definition";
9
9
  import { IMBRICATE_DATABASE_FEATURE } from "../feature";
10
10
  import { IImbricateDatabase } from "../interface";
@@ -18,7 +18,7 @@ export declare abstract class ImbricateDatabaseFullFeatureWithActionBase impleme
18
18
  abstract readonly annotations: DatabaseAnnotations;
19
19
  readonly supportedFeatures: IMBRICATE_DATABASE_FEATURE[];
20
20
  abstract putSchema(schema: ImbricateDatabaseSchema, auditOptions?: ImbricateDatabaseAuditOptions): PromiseLike<ImbricateDatabasePutSchemaOutcome>;
21
- abstract createDocument(properties: DocumentProperties, auditOptions?: ImbricateDatabaseAuditOptions): PromiseLike<ImbricateDatabaseCreateDocumentOutcome>;
21
+ abstract createDocument(properties: ImbricatePropertyRecord, auditOptions?: ImbricateDatabaseAuditOptions): PromiseLike<ImbricateDatabaseCreateDocumentOutcome>;
22
22
  abstract getDocument(uniqueIdentifier: string): PromiseLike<ImbricateDatabaseGetDocumentOutcome>;
23
23
  abstract queryDocuments(query: ImbricateDocumentQuery): PromiseLike<ImbricateDatabaseQueryDocumentsOutcome>;
24
24
  abstract countDocuments(query: ImbricateDocumentQuery): PromiseLike<ImbricateDatabaseCountDocumentsOutcome>;
@@ -4,7 +4,7 @@
4
4
  * @description Full Feature
5
5
  */
6
6
  import { ImbricateCommonQueryOriginActionsOutcome, ImbricateCommonQueryOriginActionsQuery, ImbricateOriginActionInput, ImbricateOriginActionOutcome } from "../../common/action";
7
- import { DocumentProperties } from "../../document/property";
7
+ import { ImbricatePropertyRecord } from "../../property/map";
8
8
  import { DatabaseAnnotationValue, DatabaseAnnotations, DatabaseEditRecord, ImbricateDatabaseAuditOptions, ImbricateDocumentQuery } from "../definition";
9
9
  import { IMBRICATE_DATABASE_FEATURE } from "../feature";
10
10
  import { IImbricateDatabase } from "../interface";
@@ -19,7 +19,7 @@ export declare abstract class ImbricateDatabaseFullFeatureBase extends Imbricate
19
19
  abstract readonly annotations: DatabaseAnnotations;
20
20
  readonly supportedFeatures: IMBRICATE_DATABASE_FEATURE[];
21
21
  abstract putSchema(schema: ImbricateDatabaseSchema, auditOptions?: ImbricateDatabaseAuditOptions): PromiseLike<ImbricateDatabasePutSchemaOutcome>;
22
- abstract createDocument(properties: DocumentProperties, auditOptions?: ImbricateDatabaseAuditOptions): PromiseLike<ImbricateDatabaseCreateDocumentOutcome>;
22
+ abstract createDocument(properties: ImbricatePropertyRecord, auditOptions?: ImbricateDatabaseAuditOptions): PromiseLike<ImbricateDatabaseCreateDocumentOutcome>;
23
23
  abstract getDocument(uniqueIdentifier: string): PromiseLike<ImbricateDatabaseGetDocumentOutcome>;
24
24
  abstract queryDocuments(query: ImbricateDocumentQuery): PromiseLike<ImbricateDatabaseQueryDocumentsOutcome>;
25
25
  abstract countDocuments(query: ImbricateDocumentQuery): PromiseLike<ImbricateDatabaseCountDocumentsOutcome>;
@@ -4,7 +4,7 @@
4
4
  * @description Interface
5
5
  */
6
6
  import { ImbricateCommonQueryOriginActionsOutcome, ImbricateCommonQueryOriginActionsQuery, ImbricateOriginActionInput, ImbricateOriginActionOutcome } from "../common/action";
7
- import { DocumentProperties } from "../document/property";
7
+ import { ImbricatePropertyRecord } from "../property/map";
8
8
  import { DatabaseAnnotationValue, DatabaseAnnotations, DatabaseEditRecord, ImbricateDatabaseAuditOptions, ImbricateDocumentQuery } from "./definition";
9
9
  import { IMBRICATE_DATABASE_FEATURE } from "./feature";
10
10
  import { ImbricateDatabaseAddEditRecordsOutcome, ImbricateDatabaseCountDocumentsOutcome, ImbricateDatabaseCreateDocumentOutcome, ImbricateDatabaseDeleteAnnotationOutcome, ImbricateDatabaseGetDocumentOutcome, ImbricateDatabaseGetEditRecordsOutcome, ImbricateDatabasePutAnnotationOutcome, ImbricateDatabasePutSchemaOutcome, ImbricateDatabaseQueryDocumentsOutcome, ImbricateDatabaseRemoveDocumentOutcome } from "./outcome";
@@ -59,7 +59,7 @@ export interface IImbricateDatabase {
59
59
  * @returns a promise of the outcome of the create document
60
60
  * Symbol: S_CreateDocument_IdentifierDuplicated - if the identifier is duplicated
61
61
  */
62
- createDocument(properties: DocumentProperties, auditOptions?: ImbricateDatabaseAuditOptions): PromiseLike<ImbricateDatabaseCreateDocumentOutcome>;
62
+ createDocument(properties: ImbricatePropertyRecord, auditOptions?: ImbricateDatabaseAuditOptions): PromiseLike<ImbricateDatabaseCreateDocumentOutcome>;
63
63
  /**
64
64
  * Get one document from the database
65
65
  *
@@ -3,7 +3,7 @@
3
3
  * @namespace Database
4
4
  * @description Schema
5
5
  */
6
- import { IMBRICATE_PROPERTY_TYPE } from "../document/property";
6
+ import { IMBRICATE_PROPERTY_TYPE } from "../property/type";
7
7
  export type ImbricateDatabaseSchemaProperty<T extends IMBRICATE_PROPERTY_TYPE> = {
8
8
  readonly propertyIdentifier: string;
9
9
  } & ImbricateDatabaseSchemaPropertyForCreation<T>;
@@ -6,7 +6,7 @@
6
6
  */
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
8
  exports.validateImbricateSchema = exports.validateImbricateSchemaProperty = void 0;
9
- const property_1 = require("../document/property");
9
+ const type_1 = require("../property/type");
10
10
  /**
11
11
  * Validate a schema property
12
12
  *
@@ -22,11 +22,11 @@ const validateImbricateSchemaProperty = (property) => {
22
22
  if (typeof property.propertyName !== "string") {
23
23
  return "Property name must be a string";
24
24
  }
25
- if (!Object.values(property_1.IMBRICATE_PROPERTY_TYPE).includes(property.propertyType)) {
25
+ if (!Object.values(type_1.IMBRICATE_PROPERTY_TYPE).includes(property.propertyType)) {
26
26
  return "Property type must be a valid type";
27
27
  }
28
28
  switch (property.propertyType) {
29
- case property_1.IMBRICATE_PROPERTY_TYPE.REFERENCE: {
29
+ case type_1.IMBRICATE_PROPERTY_TYPE.REFERENCE: {
30
30
  if (typeof property.propertyOptions !== "object") {
31
31
  return "Property options must be an object";
32
32
  }
@@ -3,15 +3,15 @@
3
3
  * @namespace Document
4
4
  * @description Essential Readonly
5
5
  */
6
+ import { ImbricatePropertyRecord } from "../../property/map";
6
7
  import { DocumentAnnotations, ImbricateDocumentAuditOptions } from "../definition";
7
8
  import { IMBRICATE_DOCUMENT_FEATURE } from "../feature";
8
9
  import { IImbricateDocument } from "../interface";
9
10
  import { ImbricateDocumentPutPropertyOutcome } from "../outcome";
10
- import { DocumentProperties } from "../property";
11
11
  import { ImbricateDocumentEssentialBase } from "./essential";
12
12
  export declare abstract class ImbricateDocumentEssentialReadonlyBase extends ImbricateDocumentEssentialBase implements IImbricateDocument {
13
13
  readonly annotations: DocumentAnnotations;
14
14
  readonly supportedFeatures: IMBRICATE_DOCUMENT_FEATURE[];
15
- mergeProperty(_properties: DocumentProperties, _auditOptions?: ImbricateDocumentAuditOptions): Promise<ImbricateDocumentPutPropertyOutcome>;
16
- replaceProperties(_properties: DocumentProperties, _auditOptions?: ImbricateDocumentAuditOptions): Promise<ImbricateDocumentPutPropertyOutcome>;
15
+ mergeProperty(_properties: ImbricatePropertyRecord, _auditOptions?: ImbricateDocumentAuditOptions): Promise<ImbricateDocumentPutPropertyOutcome>;
16
+ replaceProperties(_properties: ImbricatePropertyRecord, _auditOptions?: ImbricateDocumentAuditOptions): Promise<ImbricateDocumentPutPropertyOutcome>;
17
17
  }
@@ -3,16 +3,16 @@
3
3
  * @namespace Document
4
4
  * @description Full Feature Readonly
5
5
  */
6
+ import { ImbricatePropertyRecord } from "../../property/map";
6
7
  import { DocumentAnnotationValue, DocumentEditRecord, ImbricateDocumentAuditOptions } from "../definition";
7
8
  import { IMBRICATE_DOCUMENT_FEATURE } from "../feature";
8
9
  import { IImbricateDocument } from "../interface";
9
10
  import { ImbricateDocumentAddEditRecordsOutcome, ImbricateDocumentDeleteAnnotationOutcome, ImbricateDocumentPutAnnotationOutcome, ImbricateDocumentPutPropertyOutcome } from "../outcome";
10
- import { DocumentProperties } from "../property";
11
11
  import { ImbricateDocumentFullFeatureBase } from "./full-feature";
12
12
  export declare abstract class ImbricateDocumentFullFeatureReadonlyBase extends ImbricateDocumentFullFeatureBase implements IImbricateDocument {
13
13
  readonly supportedFeatures: IMBRICATE_DOCUMENT_FEATURE[];
14
- mergeProperties(_properties: DocumentProperties, _auditOptions?: ImbricateDocumentAuditOptions): Promise<ImbricateDocumentPutPropertyOutcome>;
15
- replaceProperties(_properties: DocumentProperties, _auditOptions?: ImbricateDocumentAuditOptions): Promise<ImbricateDocumentPutPropertyOutcome>;
14
+ mergeProperties(_properties: ImbricatePropertyRecord, _auditOptions?: ImbricateDocumentAuditOptions): Promise<ImbricateDocumentPutPropertyOutcome>;
15
+ replaceProperties(_properties: ImbricatePropertyRecord, _auditOptions?: ImbricateDocumentAuditOptions): Promise<ImbricateDocumentPutPropertyOutcome>;
16
16
  putAnnotation(_namespace: string, _identifier: string, _value: DocumentAnnotationValue, _auditOptions?: ImbricateDocumentAuditOptions): Promise<ImbricateDocumentPutAnnotationOutcome>;
17
17
  deleteAnnotation(_namespace: string, _identifier: string, _auditOptions?: ImbricateDocumentAuditOptions): Promise<ImbricateDocumentDeleteAnnotationOutcome>;
18
18
  addEditRecords(_records: DocumentEditRecord[]): Promise<ImbricateDocumentAddEditRecordsOutcome>;
@@ -4,19 +4,21 @@
4
4
  * @description Full Feature
5
5
  */
6
6
  import { ImbricateCommonQueryOriginActionsOutcome, ImbricateCommonQueryOriginActionsQuery, ImbricateOriginActionInput, ImbricateOriginActionOutcome } from "../../common/action";
7
+ import { ImbricatePropertyKey } from "../../property/definition";
8
+ import { ImbricatePropertyRecord } from "../../property/map";
7
9
  import { DocumentAnnotationValue, DocumentAnnotations, DocumentEditRecord, ImbricateDocumentAuditOptions } from "../definition";
8
10
  import { IMBRICATE_DOCUMENT_FEATURE } from "../feature";
9
11
  import { IImbricateDocument } from "../interface";
10
- import { ImbricateDocumentAddEditRecordsOutcome, ImbricateDocumentDeleteAnnotationOutcome, ImbricateDocumentGetEditRecordsOutcome, ImbricateDocumentPutAnnotationOutcome, ImbricateDocumentPutPropertyOutcome } from "../outcome";
11
- import { DocumentProperties } from "../property";
12
+ import { ImbricateDocumentAddEditRecordsOutcome, ImbricateDocumentDeleteAnnotationOutcome, ImbricateDocumentGetEditRecordsOutcome, ImbricateDocumentGetPropertiesOutcome, ImbricateDocumentGetPropertyOutcome, ImbricateDocumentPutAnnotationOutcome, ImbricateDocumentPutPropertyOutcome } from "../outcome";
12
13
  export declare abstract class ImbricateDocumentFullFeatureWithActionBase implements IImbricateDocument {
13
14
  abstract readonly uniqueIdentifier: string;
14
15
  abstract readonly documentVersion: string;
15
- abstract readonly properties: DocumentProperties;
16
16
  abstract readonly annotations: DocumentAnnotations;
17
17
  readonly supportedFeatures: IMBRICATE_DOCUMENT_FEATURE[];
18
- abstract mergeProperties(properties: DocumentProperties, auditOptions?: ImbricateDocumentAuditOptions): Promise<ImbricateDocumentPutPropertyOutcome>;
19
- abstract replaceProperties(properties: DocumentProperties, auditOptions?: ImbricateDocumentAuditOptions): Promise<ImbricateDocumentPutPropertyOutcome>;
18
+ abstract getProperties(): ImbricateDocumentGetPropertiesOutcome;
19
+ abstract getProperty(key: ImbricatePropertyKey): ImbricateDocumentGetPropertyOutcome;
20
+ abstract mergeProperties(properties: ImbricatePropertyRecord, auditOptions?: ImbricateDocumentAuditOptions): Promise<ImbricateDocumentPutPropertyOutcome>;
21
+ abstract replaceProperties(properties: ImbricatePropertyRecord, auditOptions?: ImbricateDocumentAuditOptions): Promise<ImbricateDocumentPutPropertyOutcome>;
20
22
  abstract putAnnotation(namespace: string, identifier: string, value: DocumentAnnotationValue, auditOptions?: ImbricateDocumentAuditOptions): Promise<ImbricateDocumentPutAnnotationOutcome>;
21
23
  abstract deleteAnnotation(namespace: string, identifier: string, auditOptions?: ImbricateDocumentAuditOptions): Promise<ImbricateDocumentDeleteAnnotationOutcome>;
22
24
  abstract addEditRecords(records: DocumentEditRecord[]): Promise<ImbricateDocumentAddEditRecordsOutcome>;
@@ -4,24 +4,15 @@
4
4
  * @description Full Feature
5
5
  */
6
6
  import { ImbricateCommonQueryOriginActionsOutcome, ImbricateCommonQueryOriginActionsQuery, ImbricateOriginActionInput, ImbricateOriginActionOutcome } from "../../common/action";
7
- import { DocumentAnnotationValue, DocumentAnnotations, DocumentEditRecord, ImbricateDocumentAuditOptions } from "../definition";
7
+ import { DocumentAnnotations } from "../definition";
8
8
  import { IMBRICATE_DOCUMENT_FEATURE } from "../feature";
9
9
  import { IImbricateDocument } from "../interface";
10
- import { ImbricateDocumentAddEditRecordsOutcome, ImbricateDocumentDeleteAnnotationOutcome, ImbricateDocumentGetEditRecordsOutcome, ImbricateDocumentPutAnnotationOutcome, ImbricateDocumentPutPropertyOutcome } from "../outcome";
11
- import { DocumentProperties } from "../property";
12
10
  import { ImbricateDocumentFullFeatureWithActionBase } from "./full-feature-with-action";
13
11
  export declare abstract class ImbricateDocumentFullFeatureBase extends ImbricateDocumentFullFeatureWithActionBase implements IImbricateDocument {
14
12
  abstract readonly uniqueIdentifier: string;
15
13
  abstract readonly documentVersion: string;
16
- abstract readonly properties: DocumentProperties;
17
14
  abstract readonly annotations: DocumentAnnotations;
18
15
  readonly supportedFeatures: IMBRICATE_DOCUMENT_FEATURE[];
19
- abstract mergeProperties(properties: DocumentProperties, auditOptions?: ImbricateDocumentAuditOptions): Promise<ImbricateDocumentPutPropertyOutcome>;
20
- abstract replaceProperties(properties: DocumentProperties, auditOptions?: ImbricateDocumentAuditOptions): Promise<ImbricateDocumentPutPropertyOutcome>;
21
- abstract putAnnotation(namespace: string, identifier: string, value: DocumentAnnotationValue, auditOptions?: ImbricateDocumentAuditOptions): Promise<ImbricateDocumentPutAnnotationOutcome>;
22
- abstract deleteAnnotation(namespace: string, identifier: string, auditOptions?: ImbricateDocumentAuditOptions): Promise<ImbricateDocumentDeleteAnnotationOutcome>;
23
- abstract addEditRecords(records: DocumentEditRecord[]): Promise<ImbricateDocumentAddEditRecordsOutcome>;
24
- abstract getEditRecords(): Promise<ImbricateDocumentGetEditRecordsOutcome>;
25
16
  queryOriginActions(_query: ImbricateCommonQueryOriginActionsQuery): PromiseLike<ImbricateCommonQueryOriginActionsOutcome>;
26
17
  executeOriginAction(_input: ImbricateOriginActionInput): Promise<ImbricateOriginActionOutcome>;
27
18
  }
@@ -4,7 +4,9 @@
4
4
  * @description Definition
5
5
  */
6
6
  import { ImbricateAuthor } from "../author/definition";
7
- import { DocumentPropertyKey, DocumentPropertyValue, IMBRICATE_PROPERTY_TYPE } from "./property";
7
+ import { ImbricatePropertyKey } from "../property/definition";
8
+ import { IImbricateProperty } from "../property/interface";
9
+ import { IMBRICATE_PROPERTY_TYPE } from "../property/type";
8
10
  /**
9
11
  * Edit record type of the document
10
12
  */
@@ -15,8 +17,8 @@ export declare enum IMBRICATE_DOCUMENT_EDIT_TYPE {
15
17
  RESOLVE_CONFLICT = "RESOLVE_CONFLICT"
16
18
  }
17
19
  export type DocumentEditOperationValuePutProperty = {
18
- readonly key: DocumentPropertyKey;
19
- readonly value: DocumentPropertyValue<IMBRICATE_PROPERTY_TYPE>;
20
+ readonly key: ImbricatePropertyKey;
21
+ readonly value: IImbricateProperty<IMBRICATE_PROPERTY_TYPE>;
20
22
  };
21
23
  export type DocumentEditOperationPutAnnotation = {
22
24
  readonly annotationNamespace: string;
@@ -14,10 +14,8 @@ export * from "./definition";
14
14
  export * from "./feature";
15
15
  export * from "./interface";
16
16
  export * from "./outcome";
17
- export * from "./property";
18
17
  export * from "./property/default-value";
19
18
  export * from "./property/definition";
20
19
  export * from "./property/primary";
21
20
  export * from "./property/triage";
22
21
  export * from "./property/triage-manager";
23
- export * from "./validate";
@@ -30,10 +30,8 @@ __exportStar(require("./definition"), exports);
30
30
  __exportStar(require("./feature"), exports);
31
31
  __exportStar(require("./interface"), exports);
32
32
  __exportStar(require("./outcome"), exports);
33
- __exportStar(require("./property"), exports);
34
33
  __exportStar(require("./property/default-value"), exports);
35
34
  __exportStar(require("./property/definition"), exports);
36
35
  __exportStar(require("./property/primary"), exports);
37
36
  __exportStar(require("./property/triage"), exports);
38
37
  __exportStar(require("./property/triage-manager"), exports);
39
- __exportStar(require("./validate"), exports);
@@ -4,10 +4,11 @@
4
4
  * @description Interface
5
5
  */
6
6
  import { ImbricateCommonQueryOriginActionsOutcome, ImbricateCommonQueryOriginActionsQuery, ImbricateOriginActionInput, ImbricateOriginActionOutcome } from "../common/action";
7
+ import { ImbricatePropertyKey } from "../property/definition";
8
+ import { ImbricatePropertyRecord } from "../property/map";
7
9
  import { DocumentAnnotationValue, DocumentAnnotations, DocumentEditRecord, ImbricateDocumentAuditOptions } from "./definition";
8
10
  import { IMBRICATE_DOCUMENT_FEATURE } from "./feature";
9
- import { ImbricateDocumentAddEditRecordsOutcome, ImbricateDocumentDeleteAnnotationOutcome, ImbricateDocumentGetEditRecordsOutcome, ImbricateDocumentPutAnnotationOutcome, ImbricateDocumentPutPropertyOutcome } from "./outcome";
10
- import { DocumentProperties } from "./property";
11
+ import { ImbricateDocumentAddEditRecordsOutcome, ImbricateDocumentDeleteAnnotationOutcome, ImbricateDocumentGetEditRecordsOutcome, ImbricateDocumentGetPropertiesOutcome, ImbricateDocumentGetPropertyOutcome, ImbricateDocumentPutAnnotationOutcome, ImbricateDocumentPutPropertyOutcome } from "./outcome";
11
12
  export interface IImbricateDocument {
12
13
  /**
13
14
  * Unique identifier of the database
@@ -17,10 +18,6 @@ export interface IImbricateDocument {
17
18
  * Version of the document draft
18
19
  */
19
20
  readonly documentVersion: string;
20
- /**
21
- * Properties of the document
22
- */
23
- readonly properties: DocumentProperties;
24
21
  /**
25
22
  * Annotations of the database
26
23
  */
@@ -29,6 +26,18 @@ export interface IImbricateDocument {
29
26
  * Supported features of the document
30
27
  */
31
28
  readonly supportedFeatures: IMBRICATE_DOCUMENT_FEATURE[];
29
+ /**
30
+ * Get properties of the document
31
+ */
32
+ getProperties(): ImbricateDocumentGetPropertiesOutcome;
33
+ /**
34
+ * Get a property of the document
35
+ *
36
+ * @param propertyKey the key of the property
37
+ *
38
+ * @returns the property of the document
39
+ */
40
+ getProperty(propertyKey: ImbricatePropertyKey): ImbricateDocumentGetPropertyOutcome;
32
41
  /**
33
42
  * Merge a property to the document
34
43
  *
@@ -40,7 +49,7 @@ export interface IImbricateDocument {
40
49
  * @returns a promise of the outcome of the put property
41
50
  * Symbol: S_Document_PutProperty_InvalidKey - if the key is invalid
42
51
  */
43
- mergeProperties(properties: DocumentProperties, auditOptions?: ImbricateDocumentAuditOptions): PromiseLike<ImbricateDocumentPutPropertyOutcome>;
52
+ mergeProperties(properties: ImbricatePropertyRecord, auditOptions?: ImbricateDocumentAuditOptions): PromiseLike<ImbricateDocumentPutPropertyOutcome>;
44
53
  /**
45
54
  * Replace all properties of the document
46
55
  *
@@ -52,7 +61,7 @@ export interface IImbricateDocument {
52
61
  * @returns a promise of the outcome of the put properties
53
62
  * Symbol: S_Document_PutProperty_InvalidKey - if the key is invalid
54
63
  */
55
- replaceProperties(properties: DocumentProperties, auditOptions?: ImbricateDocumentAuditOptions): PromiseLike<ImbricateDocumentPutPropertyOutcome>;
64
+ replaceProperties(properties: ImbricatePropertyRecord, auditOptions?: ImbricateDocumentAuditOptions): PromiseLike<ImbricateDocumentPutPropertyOutcome>;
56
65
  /**
57
66
  * Put annotation to the document, optional
58
67
  *
@@ -4,7 +4,25 @@
4
4
  * @description Outcome
5
5
  */
6
6
  import { CommonOutcomeSymbol } from "../common/outcome";
7
+ import { IImbricateProperty } from "../property/interface";
8
+ import { ImbricatePropertyRecord } from "../property/map";
9
+ import { IMBRICATE_PROPERTY_TYPE } from "../property/type";
7
10
  import { DocumentEditRecord } from "./definition";
11
+ export declare const S_Document_GetProperties_Unknown: unique symbol;
12
+ export type ImbricateDocumentGetPropertiesOutcomeSymbol = typeof S_Document_GetProperties_Unknown;
13
+ export declare const ImbricateDocumentGetPropertiesOutcomeSymbolList: ImbricateDocumentGetPropertiesOutcomeSymbol[];
14
+ export declare const rebuildImbricateDocumentGetPropertiesSymbol: (symbolDescription: string) => CommonOutcomeSymbol | typeof S_Document_GetProperties_Unknown;
15
+ export type ImbricateDocumentGetPropertiesOutcome = {
16
+ readonly properties: ImbricatePropertyRecord;
17
+ } | CommonOutcomeSymbol | ImbricateDocumentGetPropertiesOutcomeSymbol;
18
+ export declare const S_Document_GetProperty_NotFound: unique symbol;
19
+ export declare const S_Document_GetProperty_Unknown: unique symbol;
20
+ export type ImbricateDocumentGetPropertyOutcomeSymbol = typeof S_Document_GetProperty_NotFound | typeof S_Document_GetProperty_Unknown;
21
+ export declare const ImbricateDocumentGetPropertyOutcomeSymbolList: ImbricateDocumentGetPropertyOutcomeSymbol[];
22
+ export declare const rebuildImbricateDocumentGetPropertySymbol: (symbolDescription: string) => CommonOutcomeSymbol | ImbricateDocumentGetPropertyOutcomeSymbol;
23
+ export type ImbricateDocumentGetPropertyOutcome = {
24
+ readonly property: IImbricateProperty<IMBRICATE_PROPERTY_TYPE>;
25
+ } | CommonOutcomeSymbol | ImbricateDocumentGetPropertyOutcomeSymbol;
8
26
  export declare const S_Document_PutProperty_InvalidKey: unique symbol;
9
27
  export declare const S_Document_PutProperty_InvalidValue: unique symbol;
10
28
  export declare const S_Document_PutProperty_Unknown: unique symbol;
@@ -5,8 +5,22 @@
5
5
  * @description Outcome
6
6
  */
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.rebuildImbricateDocumentGetEditRecordsSymbol = exports.ImbricateDocumentGetEditRecordsOutcomeSymbolList = exports.S_Document_GetEditRecords_Unknown = exports.S_Document_GetEditRecords_NotFound = exports.rebuildImbricateDocumentAddEditRecordsSymbol = exports.ImbricateDocumentAddEditRecordsOutcomeSymbolList = exports.S_Document_AddEditRecords_Unknown = exports.S_Document_AddEditRecords_InvalidRecord = exports.rebuildImbricateDocumentDeleteAnnotationSymbol = exports.ImbricateDocumentDeleteAnnotationOutcomeSymbolList = exports.S_Document_DeleteAnnotation_Unknown = exports.S_Document_DeleteAnnotation_NotFound = exports.rebuildImbricateDocumentPutAnnotationSymbol = exports.ImbricateDocumentPutAnnotationOutcomeSymbolList = exports.S_Document_PutAnnotation_Unknown = exports.S_Document_PutAnnotation_InvalidIdentifier = exports.S_Document_PutAnnotation_InvalidNamespace = exports.rebuildImbricateDocumentPutPropertySymbol = exports.ImbricateDocumentPutPropertyOutcomeSymbolList = exports.S_Document_PutProperty_Unknown = exports.S_Document_PutProperty_InvalidValue = exports.S_Document_PutProperty_InvalidKey = void 0;
8
+ exports.rebuildImbricateDocumentGetEditRecordsSymbol = exports.ImbricateDocumentGetEditRecordsOutcomeSymbolList = exports.S_Document_GetEditRecords_Unknown = exports.S_Document_GetEditRecords_NotFound = exports.rebuildImbricateDocumentAddEditRecordsSymbol = exports.ImbricateDocumentAddEditRecordsOutcomeSymbolList = exports.S_Document_AddEditRecords_Unknown = exports.S_Document_AddEditRecords_InvalidRecord = exports.rebuildImbricateDocumentDeleteAnnotationSymbol = exports.ImbricateDocumentDeleteAnnotationOutcomeSymbolList = exports.S_Document_DeleteAnnotation_Unknown = exports.S_Document_DeleteAnnotation_NotFound = exports.rebuildImbricateDocumentPutAnnotationSymbol = exports.ImbricateDocumentPutAnnotationOutcomeSymbolList = exports.S_Document_PutAnnotation_Unknown = exports.S_Document_PutAnnotation_InvalidIdentifier = exports.S_Document_PutAnnotation_InvalidNamespace = exports.rebuildImbricateDocumentPutPropertySymbol = exports.ImbricateDocumentPutPropertyOutcomeSymbolList = exports.S_Document_PutProperty_Unknown = exports.S_Document_PutProperty_InvalidValue = exports.S_Document_PutProperty_InvalidKey = exports.rebuildImbricateDocumentGetPropertySymbol = exports.ImbricateDocumentGetPropertyOutcomeSymbolList = exports.S_Document_GetProperty_Unknown = exports.S_Document_GetProperty_NotFound = exports.rebuildImbricateDocumentGetPropertiesSymbol = exports.ImbricateDocumentGetPropertiesOutcomeSymbolList = exports.S_Document_GetProperties_Unknown = void 0;
9
9
  const rebuild_symbol_1 = require("../util/rebuild-symbol");
10
+ // Get Properties
11
+ exports.S_Document_GetProperties_Unknown = Symbol("Document_GetProperties_Unknown");
12
+ exports.ImbricateDocumentGetPropertiesOutcomeSymbolList = [
13
+ exports.S_Document_GetProperties_Unknown,
14
+ ];
15
+ exports.rebuildImbricateDocumentGetPropertiesSymbol = (0, rebuild_symbol_1.createRebuildImbricateSymbolFunction)(exports.ImbricateDocumentGetPropertiesOutcomeSymbolList, exports.S_Document_GetProperties_Unknown);
16
+ // Get Property
17
+ exports.S_Document_GetProperty_NotFound = Symbol("Document_GetProperty_NotFound");
18
+ exports.S_Document_GetProperty_Unknown = Symbol("Document_GetProperty_Unknown");
19
+ exports.ImbricateDocumentGetPropertyOutcomeSymbolList = [
20
+ exports.S_Document_GetProperty_NotFound,
21
+ exports.S_Document_GetProperty_Unknown,
22
+ ];
23
+ exports.rebuildImbricateDocumentGetPropertySymbol = (0, rebuild_symbol_1.createRebuildImbricateSymbolFunction)(exports.ImbricateDocumentGetPropertyOutcomeSymbolList, exports.S_Document_GetProperty_Unknown);
10
24
  // Put Property
11
25
  exports.S_Document_PutProperty_InvalidKey = Symbol("Document_PutProperty_InvalidKey");
12
26
  exports.S_Document_PutProperty_InvalidValue = Symbol("Document_PutProperty_InvalidValue");
@@ -3,5 +3,5 @@
3
3
  * @namespace Document_Property
4
4
  * @description Default Value
5
5
  */
6
- import { DocumentPropertyValueObject, IMBRICATE_PROPERTY_TYPE } from "../property";
7
- export declare const getImbricateDefaultValueOfProperty: (type: IMBRICATE_PROPERTY_TYPE) => DocumentPropertyValueObject<IMBRICATE_PROPERTY_TYPE>;
6
+ import { IMBRICATE_PROPERTY_TYPE, ImbricatePropertyValueObject } from "../../property/type";
7
+ export declare const getImbricateDefaultValueOfProperty: (type: IMBRICATE_PROPERTY_TYPE) => ImbricatePropertyValueObject<IMBRICATE_PROPERTY_TYPE>;
@@ -6,19 +6,19 @@
6
6
  */
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
8
  exports.getImbricateDefaultValueOfProperty = void 0;
9
- const property_1 = require("../property");
9
+ const type_1 = require("../../property/type");
10
10
  // IMBRICATE_PROPERTY_TYPE SWITCH
11
11
  const getImbricateDefaultValueOfProperty = (type) => {
12
12
  switch (type) {
13
- case property_1.IMBRICATE_PROPERTY_TYPE.BOOLEAN: return false;
14
- case property_1.IMBRICATE_PROPERTY_TYPE.STRING: return "";
15
- case property_1.IMBRICATE_PROPERTY_TYPE.NUMBER: return 0;
16
- case property_1.IMBRICATE_PROPERTY_TYPE.MARKDOWN: return "";
17
- case property_1.IMBRICATE_PROPERTY_TYPE.JSON: return "";
18
- case property_1.IMBRICATE_PROPERTY_TYPE.IMBRISCRIPT: return "";
19
- case property_1.IMBRICATE_PROPERTY_TYPE.DATE: return new Date().toISOString();
20
- case property_1.IMBRICATE_PROPERTY_TYPE.LABEL: return [];
21
- case property_1.IMBRICATE_PROPERTY_TYPE.REFERENCE: return [];
13
+ case type_1.IMBRICATE_PROPERTY_TYPE.BOOLEAN: return false;
14
+ case type_1.IMBRICATE_PROPERTY_TYPE.STRING: return "";
15
+ case type_1.IMBRICATE_PROPERTY_TYPE.NUMBER: return 0;
16
+ case type_1.IMBRICATE_PROPERTY_TYPE.MARKDOWN: return "";
17
+ case type_1.IMBRICATE_PROPERTY_TYPE.JSON: return "";
18
+ case type_1.IMBRICATE_PROPERTY_TYPE.IMBRISCRIPT: return "";
19
+ case type_1.IMBRICATE_PROPERTY_TYPE.DATE: return new Date().toISOString();
20
+ case type_1.IMBRICATE_PROPERTY_TYPE.LABEL: return [];
21
+ case type_1.IMBRICATE_PROPERTY_TYPE.REFERENCE: return [];
22
22
  }
23
23
  return null;
24
24
  };
@@ -3,5 +3,7 @@
3
3
  * @namespace Document_Property
4
4
  * @description Definition
5
5
  */
6
- import { DocumentPropertyKey, DocumentPropertyValue, IMBRICATE_PROPERTY_TYPE } from "../property";
7
- export type DocumentPropertyTriageFunction<T extends IMBRICATE_PROPERTY_TYPE, Result> = (propertyKey: DocumentPropertyKey, value: DocumentPropertyValue<T>) => Result;
6
+ import { ImbricatePropertyKey } from "../../property/definition";
7
+ import { IImbricateProperty } from "../../property/interface";
8
+ import { IMBRICATE_PROPERTY_TYPE } from "../../property/type";
9
+ export type ImbricatePropertyTriageFunction<T extends IMBRICATE_PROPERTY_TYPE, Result> = (propertyKey: ImbricatePropertyKey, value: IImbricateProperty<T>) => Result;
@@ -4,5 +4,7 @@
4
4
  * @description Primary
5
5
  */
6
6
  import { ImbricateDatabaseSchema } from "../../database/schema";
7
- import { DocumentProperties, DocumentPropertyValue, IMBRICATE_PROPERTY_TYPE } from "../property";
8
- export declare const findPrimaryProperty: (schema: ImbricateDatabaseSchema, properties: DocumentProperties) => DocumentPropertyValue<IMBRICATE_PROPERTY_TYPE> | null;
7
+ import { IImbricateProperty } from "../../property/interface";
8
+ import { ImbricatePropertyRecord } from "../../property/map";
9
+ import { IMBRICATE_PROPERTY_TYPE } from "../../property/type";
10
+ export declare const findPrimaryProperty: (schema: ImbricateDatabaseSchema, properties: ImbricatePropertyRecord) => IImbricateProperty<IMBRICATE_PROPERTY_TYPE> | null;
@@ -3,8 +3,10 @@
3
3
  * @namespace Document_Property
4
4
  * @description Triage Base
5
5
  */
6
- import { DocumentProperties, DocumentPropertyKey, IMBRICATE_PROPERTY_TYPE } from "../property";
7
- import { DocumentPropertyTriageFunction } from "./definition";
6
+ import { ImbricatePropertyKey } from "../../property/definition";
7
+ import { ImbricatePropertyRecord } from "../../property/map";
8
+ import { IMBRICATE_PROPERTY_TYPE } from "../../property/type";
9
+ import { ImbricatePropertyTriageFunction } from "./definition";
8
10
  export declare class ImbricateDocumentPropertyTriageBase<Result> {
9
11
  private readonly _triageFunctionsByKey;
10
12
  private readonly _triageFunctionsByType;
@@ -17,15 +19,15 @@ export declare class ImbricateDocumentPropertyTriageBase<Result> {
17
19
  * @param triageFunction triage function
18
20
  * @returns triage manager
19
21
  */
20
- forPropertyKey<T extends IMBRICATE_PROPERTY_TYPE>(propertyKey: DocumentPropertyKey, triageFunction: DocumentPropertyTriageFunction<T, Result>): this;
21
- forBoolean(triageFunction: DocumentPropertyTriageFunction<IMBRICATE_PROPERTY_TYPE.BOOLEAN, Result>): this;
22
- forString(triageFunction: DocumentPropertyTriageFunction<IMBRICATE_PROPERTY_TYPE.STRING, Result>): this;
23
- forNumber(triageFunction: DocumentPropertyTriageFunction<IMBRICATE_PROPERTY_TYPE.NUMBER, Result>): this;
24
- forMarkdown(triageFunction: DocumentPropertyTriageFunction<IMBRICATE_PROPERTY_TYPE.MARKDOWN, Result>): this;
25
- forJson(triageFunction: DocumentPropertyTriageFunction<IMBRICATE_PROPERTY_TYPE.JSON, Result>): this;
26
- forImbriscript(triageFunction: DocumentPropertyTriageFunction<IMBRICATE_PROPERTY_TYPE.IMBRISCRIPT, Result>): this;
27
- forDate(triageFunction: DocumentPropertyTriageFunction<IMBRICATE_PROPERTY_TYPE.DATE, Result>): this;
28
- forLabel(triageFunction: DocumentPropertyTriageFunction<IMBRICATE_PROPERTY_TYPE.LABEL, Result>): this;
29
- forReference(triageFunction: DocumentPropertyTriageFunction<IMBRICATE_PROPERTY_TYPE.REFERENCE, Result>): this;
30
- protected _collect(properties: DocumentProperties): Map<DocumentPropertyKey, Result>;
22
+ forPropertyKey<T extends IMBRICATE_PROPERTY_TYPE>(propertyKey: ImbricatePropertyKey, triageFunction: ImbricatePropertyTriageFunction<T, Result>): this;
23
+ forBoolean(triageFunction: ImbricatePropertyTriageFunction<IMBRICATE_PROPERTY_TYPE.BOOLEAN, Result>): this;
24
+ forString(triageFunction: ImbricatePropertyTriageFunction<IMBRICATE_PROPERTY_TYPE.STRING, Result>): this;
25
+ forNumber(triageFunction: ImbricatePropertyTriageFunction<IMBRICATE_PROPERTY_TYPE.NUMBER, Result>): this;
26
+ forMarkdown(triageFunction: ImbricatePropertyTriageFunction<IMBRICATE_PROPERTY_TYPE.MARKDOWN, Result>): this;
27
+ forJson(triageFunction: ImbricatePropertyTriageFunction<IMBRICATE_PROPERTY_TYPE.JSON, Result>): this;
28
+ forImbriscript(triageFunction: ImbricatePropertyTriageFunction<IMBRICATE_PROPERTY_TYPE.IMBRISCRIPT, Result>): this;
29
+ forDate(triageFunction: ImbricatePropertyTriageFunction<IMBRICATE_PROPERTY_TYPE.DATE, Result>): this;
30
+ forLabel(triageFunction: ImbricatePropertyTriageFunction<IMBRICATE_PROPERTY_TYPE.LABEL, Result>): this;
31
+ forReference(triageFunction: ImbricatePropertyTriageFunction<IMBRICATE_PROPERTY_TYPE.REFERENCE, Result>): this;
32
+ protected _collect(properties: ImbricatePropertyRecord): Map<ImbricatePropertyKey, Result>;
31
33
  }
@@ -6,7 +6,7 @@
6
6
  */
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
8
  exports.ImbricateDocumentPropertyTriageBase = void 0;
9
- const property_1 = require("../property");
9
+ const type_1 = require("../../property/type");
10
10
  // IMBRICATE_PROPERTY_TYPE SWITCH
11
11
  class ImbricateDocumentPropertyTriageBase {
12
12
  constructor() {
@@ -26,39 +26,39 @@ class ImbricateDocumentPropertyTriageBase {
26
26
  return this;
27
27
  }
28
28
  forBoolean(triageFunction) {
29
- this._triageFunctionsByType.set(property_1.IMBRICATE_PROPERTY_TYPE.BOOLEAN, triageFunction);
29
+ this._triageFunctionsByType.set(type_1.IMBRICATE_PROPERTY_TYPE.BOOLEAN, triageFunction);
30
30
  return this;
31
31
  }
32
32
  forString(triageFunction) {
33
- this._triageFunctionsByType.set(property_1.IMBRICATE_PROPERTY_TYPE.STRING, triageFunction);
33
+ this._triageFunctionsByType.set(type_1.IMBRICATE_PROPERTY_TYPE.STRING, triageFunction);
34
34
  return this;
35
35
  }
36
36
  forNumber(triageFunction) {
37
- this._triageFunctionsByType.set(property_1.IMBRICATE_PROPERTY_TYPE.NUMBER, triageFunction);
37
+ this._triageFunctionsByType.set(type_1.IMBRICATE_PROPERTY_TYPE.NUMBER, triageFunction);
38
38
  return this;
39
39
  }
40
40
  forMarkdown(triageFunction) {
41
- this._triageFunctionsByType.set(property_1.IMBRICATE_PROPERTY_TYPE.MARKDOWN, triageFunction);
41
+ this._triageFunctionsByType.set(type_1.IMBRICATE_PROPERTY_TYPE.MARKDOWN, triageFunction);
42
42
  return this;
43
43
  }
44
44
  forJson(triageFunction) {
45
- this._triageFunctionsByType.set(property_1.IMBRICATE_PROPERTY_TYPE.JSON, triageFunction);
45
+ this._triageFunctionsByType.set(type_1.IMBRICATE_PROPERTY_TYPE.JSON, triageFunction);
46
46
  return this;
47
47
  }
48
48
  forImbriscript(triageFunction) {
49
- this._triageFunctionsByType.set(property_1.IMBRICATE_PROPERTY_TYPE.IMBRISCRIPT, triageFunction);
49
+ this._triageFunctionsByType.set(type_1.IMBRICATE_PROPERTY_TYPE.IMBRISCRIPT, triageFunction);
50
50
  return this;
51
51
  }
52
52
  forDate(triageFunction) {
53
- this._triageFunctionsByType.set(property_1.IMBRICATE_PROPERTY_TYPE.DATE, triageFunction);
53
+ this._triageFunctionsByType.set(type_1.IMBRICATE_PROPERTY_TYPE.DATE, triageFunction);
54
54
  return this;
55
55
  }
56
56
  forLabel(triageFunction) {
57
- this._triageFunctionsByType.set(property_1.IMBRICATE_PROPERTY_TYPE.LABEL, triageFunction);
57
+ this._triageFunctionsByType.set(type_1.IMBRICATE_PROPERTY_TYPE.LABEL, triageFunction);
58
58
  return this;
59
59
  }
60
60
  forReference(triageFunction) {
61
- this._triageFunctionsByType.set(property_1.IMBRICATE_PROPERTY_TYPE.REFERENCE, triageFunction);
61
+ this._triageFunctionsByType.set(type_1.IMBRICATE_PROPERTY_TYPE.REFERENCE, triageFunction);
62
62
  return this;
63
63
  }
64
64
  _collect(properties) {
@@ -72,7 +72,7 @@ class ImbricateDocumentPropertyTriageBase {
72
72
  result.set(key, value);
73
73
  continue;
74
74
  }
75
- const typeFunction = this._triageFunctionsByType.get(property.type);
75
+ const typeFunction = this._triageFunctionsByType.get(property.propertyType);
76
76
  if (typeof typeFunction === "function") {
77
77
  const value = typeFunction(key, property);
78
78
  result.set(key, value);
@@ -3,10 +3,11 @@
3
3
  * @namespace Document_Property
4
4
  * @description Triage Manager
5
5
  */
6
- import { DocumentProperties, DocumentPropertyKey } from "../property";
6
+ import { ImbricatePropertyKey } from "../../property/definition";
7
+ import { ImbricatePropertyRecord } from "../../property/map";
7
8
  import { ImbricateDocumentPropertyTriageBase } from "./triage-base";
8
9
  export declare class ImbricateDocumentPropertyTriageManager<Result> extends ImbricateDocumentPropertyTriageBase<Result> {
9
- static create<Result>(properties: DocumentProperties): ImbricateDocumentPropertyTriageManager<Result>;
10
+ static create<Result>(properties: ImbricatePropertyRecord): ImbricateDocumentPropertyTriageManager<Result>;
10
11
  private readonly _properties;
11
12
  private constructor();
12
13
  /**
@@ -20,11 +21,11 @@ export declare class ImbricateDocumentPropertyTriageManager<Result> extends Imbr
20
21
  *
21
22
  * @returns collected result as map
22
23
  */
23
- collectAsMap(): Map<DocumentPropertyKey, Result>;
24
+ collectAsMap(): Map<ImbricatePropertyKey, Result>;
24
25
  /**
25
26
  * Collect the result as object
26
27
  *
27
28
  * @returns collected result as object
28
29
  */
29
- collectAsObject(): Record<DocumentPropertyKey, Result>;
30
+ collectAsObject(): Record<ImbricatePropertyKey, Result>;
30
31
  }
@@ -3,6 +3,6 @@
3
3
  * @namespace Document_Property
4
4
  * @description Triage
5
5
  */
6
- import { DocumentProperties } from "../property";
6
+ import { ImbricatePropertyRecord } from "../../property/map";
7
7
  import { ImbricateDocumentPropertyTriageManager } from "./triage-manager";
8
- export declare const triageImbricateDocumentProperties: <Result>(properties: DocumentProperties) => ImbricateDocumentPropertyTriageManager<Result>;
8
+ export declare const triageImbricateDocumentProperties: <Result>(properties: ImbricatePropertyRecord) => ImbricateDocumentPropertyTriageManager<Result>;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @author WMXPY
3
+ * @namespace Error
4
+ * @description Property Feature Not Supported
5
+ */
6
+ import { IMBRICATE_PROPERTY_FEATURE } from "../../property/feature";
7
+ import { PropertyError } from "./property-error";
8
+ export declare class PropertyFeatureNotSupportedError extends PropertyError {
9
+ static withFeature(feature: IMBRICATE_PROPERTY_FEATURE): PropertyFeatureNotSupportedError;
10
+ static readonly TYPE: string;
11
+ protected constructor(message: string, reason?: any);
12
+ }
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ /**
3
+ * @author WMXPY
4
+ * @namespace Error
5
+ * @description Property Feature Not Supported
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.PropertyFeatureNotSupportedError = void 0;
9
+ const property_error_1 = require("./property-error");
10
+ class PropertyFeatureNotSupportedError extends property_error_1.PropertyError {
11
+ static withFeature(feature) {
12
+ return new PropertyFeatureNotSupportedError(`Feature ${feature} is not supported`, feature);
13
+ }
14
+ constructor(message, reason) {
15
+ super(message, PropertyFeatureNotSupportedError.TYPE, reason);
16
+ Object.setPrototypeOf(this, PropertyFeatureNotSupportedError.prototype);
17
+ }
18
+ }
19
+ exports.PropertyFeatureNotSupportedError = PropertyFeatureNotSupportedError;
20
+ PropertyFeatureNotSupportedError.TYPE = "IMBRICATE_PROPERTY_FEATURE_NOT_SUPPORTED";
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @author WMXPY
3
+ * @namespace Error
4
+ * @description Property Error
5
+ */
6
+ import { ImbricateError } from "../imbricate-error";
7
+ export declare class PropertyError extends ImbricateError {
8
+ protected constructor(message: string, type: string, reason?: any);
9
+ }
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ /**
3
+ * @author WMXPY
4
+ * @namespace Error
5
+ * @description Property Error
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.PropertyError = void 0;
9
+ const imbricate_error_1 = require("../imbricate-error");
10
+ class PropertyError extends imbricate_error_1.ImbricateError {
11
+ constructor(message, type, reason) {
12
+ super(message, type, reason);
13
+ Object.setPrototypeOf(this, PropertyError.prototype);
14
+ }
15
+ }
16
+ exports.PropertyError = PropertyError;
package/index.d.ts CHANGED
@@ -10,6 +10,7 @@ export * from "./document/export";
10
10
  export * from "./error/export";
11
11
  export * from "./loader/export";
12
12
  export * from "./origin/export";
13
+ export * from "./property/export";
13
14
  export * from "./static-manager/export";
14
15
  export * from "./static/export";
15
16
  export * from "./text-manager/export";
package/index.js CHANGED
@@ -26,6 +26,7 @@ __exportStar(require("./document/export"), exports);
26
26
  __exportStar(require("./error/export"), exports);
27
27
  __exportStar(require("./loader/export"), exports);
28
28
  __exportStar(require("./origin/export"), exports);
29
+ __exportStar(require("./property/export"), exports);
29
30
  __exportStar(require("./static-manager/export"), exports);
30
31
  __exportStar(require("./static/export"), exports);
31
32
  __exportStar(require("./text-manager/export"), exports);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@imbricate/core",
3
3
  "main": "index.js",
4
- "version": "3.19.1",
4
+ "version": "3.20.0",
5
5
  "description": "Imbricate Core, Notebook for Engineers",
6
6
  "repository": {
7
7
  "type": "git",
@@ -0,0 +1,18 @@
1
+ /**
2
+ * @author WMXPY
3
+ * @namespace Property
4
+ * @description Full Feature
5
+ */
6
+ import { ImbricateCommonQueryOriginActionsOutcome, ImbricateCommonQueryOriginActionsQuery, ImbricateOriginActionInput, ImbricateOriginActionOutcome } from "../../common/action";
7
+ import { ImbricatePropertyKey } from "../definition";
8
+ import { IMBRICATE_PROPERTY_FEATURE } from "../feature";
9
+ import { IImbricateProperty } from "../interface";
10
+ import { IMBRICATE_PROPERTY_TYPE, ImbricatePropertyValueObject } from "../type";
11
+ export declare abstract class ImbricatePropertyFullFeatureWithActionBase<T extends IMBRICATE_PROPERTY_TYPE> implements IImbricateProperty<T> {
12
+ abstract readonly propertyKey: ImbricatePropertyKey;
13
+ abstract readonly propertyType: T;
14
+ abstract readonly propertyValue: ImbricatePropertyValueObject<T>;
15
+ readonly supportedFeatures: IMBRICATE_PROPERTY_FEATURE[];
16
+ abstract queryOriginActions(query: ImbricateCommonQueryOriginActionsQuery): PromiseLike<ImbricateCommonQueryOriginActionsOutcome>;
17
+ abstract executeOriginAction(input: ImbricateOriginActionInput): PromiseLike<ImbricateOriginActionOutcome>;
18
+ }
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ /**
3
+ * @author WMXPY
4
+ * @namespace Property
5
+ * @description Full Feature
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.ImbricatePropertyFullFeatureWithActionBase = void 0;
9
+ const feature_1 = require("../feature");
10
+ class ImbricatePropertyFullFeatureWithActionBase {
11
+ constructor() {
12
+ this.supportedFeatures = [
13
+ feature_1.IMBRICATE_PROPERTY_FEATURE.PROPERTY_GET_ORIGIN_ACTIONS,
14
+ feature_1.IMBRICATE_PROPERTY_FEATURE.PROPERTY_EXECUTE_ORIGIN_ACTION,
15
+ ];
16
+ }
17
+ }
18
+ exports.ImbricatePropertyFullFeatureWithActionBase = ImbricatePropertyFullFeatureWithActionBase;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * @author WMXPY
3
+ * @namespace Property
4
+ * @description Full Feature
5
+ */
6
+ import { ImbricateCommonQueryOriginActionsOutcome, ImbricateCommonQueryOriginActionsQuery, ImbricateOriginActionInput, ImbricateOriginActionOutcome } from "../../common/action";
7
+ import { IMBRICATE_PROPERTY_FEATURE } from "../feature";
8
+ import { IImbricateProperty } from "../interface";
9
+ import { IMBRICATE_PROPERTY_TYPE } from "../type";
10
+ import { ImbricatePropertyFullFeatureWithActionBase } from "./full-feature-with-action";
11
+ export declare abstract class ImbricatePropertyFullFeatureBase<T extends IMBRICATE_PROPERTY_TYPE> extends ImbricatePropertyFullFeatureWithActionBase<T> implements IImbricateProperty<T> {
12
+ readonly supportedFeatures: IMBRICATE_PROPERTY_FEATURE[];
13
+ queryOriginActions(_query: ImbricateCommonQueryOriginActionsQuery): PromiseLike<ImbricateCommonQueryOriginActionsOutcome>;
14
+ executeOriginAction(_input: ImbricateOriginActionInput): PromiseLike<ImbricateOriginActionOutcome>;
15
+ }
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ /**
3
+ * @author WMXPY
4
+ * @namespace Property
5
+ * @description Full Feature
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.ImbricatePropertyFullFeatureBase = void 0;
9
+ const feature_not_supported_1 = require("../../error/property/feature-not-supported");
10
+ const feature_1 = require("../feature");
11
+ const full_feature_with_action_1 = require("./full-feature-with-action");
12
+ class ImbricatePropertyFullFeatureBase extends full_feature_with_action_1.ImbricatePropertyFullFeatureWithActionBase {
13
+ constructor() {
14
+ super(...arguments);
15
+ this.supportedFeatures = [];
16
+ }
17
+ queryOriginActions(_query) {
18
+ throw feature_not_supported_1.PropertyFeatureNotSupportedError.withFeature(feature_1.IMBRICATE_PROPERTY_FEATURE.PROPERTY_GET_ORIGIN_ACTIONS);
19
+ }
20
+ executeOriginAction(_input) {
21
+ throw feature_not_supported_1.PropertyFeatureNotSupportedError.withFeature(feature_1.IMBRICATE_PROPERTY_FEATURE.PROPERTY_EXECUTE_ORIGIN_ACTION);
22
+ }
23
+ }
24
+ exports.ImbricatePropertyFullFeatureBase = ImbricatePropertyFullFeatureBase;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @author WMXPY
3
+ * @namespace Property
4
+ * @description Definition
5
+ */
6
+ /**
7
+ * Imbricate property key, which should match schema properties unique identifier
8
+ */
9
+ export type ImbricatePropertyKey = string;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ /**
3
+ * @author WMXPY
4
+ * @namespace Property
5
+ * @description Definition
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @author WMXPY
3
+ * @namespace Property
4
+ * @description Export
5
+ */
6
+ export * from "./base-class/full-feature";
7
+ export * from "./base-class/full-feature-with-action";
8
+ export * from "./definition";
9
+ export * from "./feature";
10
+ export * from "./interface";
11
+ export * from "./map";
12
+ export * from "./type";
13
+ export * from "./validate";
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ /**
3
+ * @author WMXPY
4
+ * @namespace Property
5
+ * @description Export
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
19
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
20
+ };
21
+ Object.defineProperty(exports, "__esModule", { value: true });
22
+ __exportStar(require("./base-class/full-feature"), exports);
23
+ __exportStar(require("./base-class/full-feature-with-action"), exports);
24
+ __exportStar(require("./definition"), exports);
25
+ __exportStar(require("./feature"), exports);
26
+ __exportStar(require("./interface"), exports);
27
+ __exportStar(require("./map"), exports);
28
+ __exportStar(require("./type"), exports);
29
+ __exportStar(require("./validate"), exports);
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @author WMXPY
3
+ * @namespace Property
4
+ * @description Feature
5
+ */
6
+ export declare enum IMBRICATE_PROPERTY_FEATURE {
7
+ PROPERTY_GET_ORIGIN_ACTIONS = "PROPERTY_GET_ORIGIN_ACTIONS",
8
+ PROPERTY_EXECUTE_ORIGIN_ACTION = "PROPERTY_EXECUTE_ORIGIN_ACTION"
9
+ }
10
+ export declare const checkImbricatePropertyFeatureSupported: (features: IMBRICATE_PROPERTY_FEATURE[], feature: IMBRICATE_PROPERTY_FEATURE) => boolean;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ /**
3
+ * @author WMXPY
4
+ * @namespace Property
5
+ * @description Feature
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.checkImbricatePropertyFeatureSupported = exports.IMBRICATE_PROPERTY_FEATURE = void 0;
9
+ var IMBRICATE_PROPERTY_FEATURE;
10
+ (function (IMBRICATE_PROPERTY_FEATURE) {
11
+ IMBRICATE_PROPERTY_FEATURE["PROPERTY_GET_ORIGIN_ACTIONS"] = "PROPERTY_GET_ORIGIN_ACTIONS";
12
+ IMBRICATE_PROPERTY_FEATURE["PROPERTY_EXECUTE_ORIGIN_ACTION"] = "PROPERTY_EXECUTE_ORIGIN_ACTION";
13
+ })(IMBRICATE_PROPERTY_FEATURE || (exports.IMBRICATE_PROPERTY_FEATURE = IMBRICATE_PROPERTY_FEATURE = {}));
14
+ const checkImbricatePropertyFeatureSupported = (features, feature) => {
15
+ return features.includes(feature);
16
+ };
17
+ exports.checkImbricatePropertyFeatureSupported = checkImbricatePropertyFeatureSupported;
@@ -0,0 +1,45 @@
1
+ /**
2
+ * @author WMXPY
3
+ * @namespace Property
4
+ * @description Interface
5
+ */
6
+ import { ImbricateCommonQueryOriginActionsOutcome, ImbricateCommonQueryOriginActionsQuery, ImbricateOriginActionInput, ImbricateOriginActionOutcome } from "../common/action";
7
+ import { ImbricatePropertyKey } from "./definition";
8
+ import { IMBRICATE_PROPERTY_FEATURE } from "./feature";
9
+ import { IMBRICATE_PROPERTY_TYPE, ImbricatePropertyValueObject } from "./type";
10
+ export interface IImbricateProperty<T extends IMBRICATE_PROPERTY_TYPE> {
11
+ /**
12
+ * Property key, reference to the property key from documents
13
+ */
14
+ readonly propertyKey: ImbricatePropertyKey;
15
+ /**
16
+ * Property type
17
+ */
18
+ readonly propertyType: T;
19
+ /**
20
+ * Property value
21
+ */
22
+ readonly propertyValue: ImbricatePropertyValueObject<T>;
23
+ /**
24
+ * Supported features of the property
25
+ */
26
+ readonly supportedFeatures: IMBRICATE_PROPERTY_FEATURE[];
27
+ /**
28
+ * Query the property actions
29
+ *
30
+ * @param query the query of the property actions
31
+ *
32
+ * @returns the property actions
33
+ * Symbol: S_Common_QueryOriginActions_Stale - if the property actions are stale
34
+ * Symbol: S_Common_QueryOriginActions_Unknown - if the property actions are unknown
35
+ */
36
+ queryOriginActions(query: ImbricateCommonQueryOriginActionsQuery): PromiseLike<ImbricateCommonQueryOriginActionsOutcome>;
37
+ /**
38
+ * Execute the property action
39
+ *
40
+ * @param input the input of the action
41
+ *
42
+ * @returns the result of the action
43
+ */
44
+ executeOriginAction(input: ImbricateOriginActionInput): PromiseLike<ImbricateOriginActionOutcome>;
45
+ }
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ /**
3
+ * @author WMXPY
4
+ * @namespace Property
5
+ * @description Interface
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @author WMXPY
3
+ * @namespace Property
4
+ * @description Map
5
+ */
6
+ import { ImbricatePropertyKey } from "./definition";
7
+ import { IImbricateProperty } from "./interface";
8
+ import { IMBRICATE_PROPERTY_TYPE } from "./type";
9
+ export type ImbricatePropertyRecord = Record<ImbricatePropertyKey, IImbricateProperty<IMBRICATE_PROPERTY_TYPE>>;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ /**
3
+ * @author WMXPY
4
+ * @namespace Property
5
+ * @description Map
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,10 +1,10 @@
1
1
  /**
2
2
  * @author WMXPY
3
- * @namespace Document
4
- * @description Property
3
+ * @namespace Property
4
+ * @description Type
5
5
  */
6
6
  /**
7
- * Document properties
7
+ * Property type
8
8
  */
9
9
  export declare enum IMBRICATE_PROPERTY_TYPE {
10
10
  /**
@@ -48,24 +48,9 @@ export declare enum IMBRICATE_PROPERTY_TYPE {
48
48
  */
49
49
  REFERENCE = "REFERENCE"
50
50
  }
51
- /**
52
- * Document properties
53
- *
54
- * Key - Property key, which should match schema properties unique identifier
55
- * Value - Property value, which should match schema properties type
56
- */
57
- export type DocumentProperties = Record<DocumentPropertyKey, DocumentPropertyValue<IMBRICATE_PROPERTY_TYPE>>;
58
- /**
59
- * Document property key, which should match schema properties unique identifier
60
- */
61
- export type DocumentPropertyKey = string;
62
- export type DocumentPropertyValue<T extends IMBRICATE_PROPERTY_TYPE> = {
63
- readonly type: T;
64
- readonly value: DocumentPropertyValueObject<T>;
65
- };
66
- export type DocumentPropertyValueObjectReference = {
51
+ export type ImbricatePropertyValueObjectReference = {
67
52
  readonly originUniqueIdentifier: string;
68
53
  readonly databaseUniqueIdentifier: string;
69
54
  readonly documentUniqueIdentifier: string;
70
55
  };
71
- export type DocumentPropertyValueObject<T extends IMBRICATE_PROPERTY_TYPE> = T extends IMBRICATE_PROPERTY_TYPE.BOOLEAN ? boolean : T extends IMBRICATE_PROPERTY_TYPE.STRING ? string : T extends IMBRICATE_PROPERTY_TYPE.NUMBER ? number : T extends IMBRICATE_PROPERTY_TYPE.MARKDOWN ? string : T extends IMBRICATE_PROPERTY_TYPE.JSON ? string : T extends IMBRICATE_PROPERTY_TYPE.IMBRISCRIPT ? string : T extends IMBRICATE_PROPERTY_TYPE.DATE ? string : T extends IMBRICATE_PROPERTY_TYPE.LABEL ? string[] : T extends IMBRICATE_PROPERTY_TYPE.REFERENCE ? DocumentPropertyValueObjectReference[] : never;
56
+ export type ImbricatePropertyValueObject<T extends IMBRICATE_PROPERTY_TYPE> = T extends IMBRICATE_PROPERTY_TYPE.BOOLEAN ? boolean : T extends IMBRICATE_PROPERTY_TYPE.STRING ? string : T extends IMBRICATE_PROPERTY_TYPE.NUMBER ? number : T extends IMBRICATE_PROPERTY_TYPE.MARKDOWN ? string : T extends IMBRICATE_PROPERTY_TYPE.JSON ? string : T extends IMBRICATE_PROPERTY_TYPE.IMBRISCRIPT ? string : T extends IMBRICATE_PROPERTY_TYPE.DATE ? string : T extends IMBRICATE_PROPERTY_TYPE.LABEL ? string[] : T extends IMBRICATE_PROPERTY_TYPE.REFERENCE ? ImbricatePropertyValueObjectReference[] : never;
@@ -1,13 +1,13 @@
1
1
  "use strict";
2
2
  /**
3
3
  * @author WMXPY
4
- * @namespace Document
5
- * @description Property
4
+ * @namespace Property
5
+ * @description Type
6
6
  */
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
8
  exports.IMBRICATE_PROPERTY_TYPE = void 0;
9
9
  /**
10
- * Document properties
10
+ * Property type
11
11
  */
12
12
  var IMBRICATE_PROPERTY_TYPE;
13
13
  (function (IMBRICATE_PROPERTY_TYPE) {
@@ -1,10 +1,10 @@
1
1
  /**
2
2
  * @author WMXPY
3
- * @namespace Document
3
+ * @namespace Property
4
4
  * @description Validate
5
5
  */
6
6
  import { ImbricateDatabaseSchema } from "../database/schema";
7
- import { DocumentProperties } from "./property";
7
+ import { ImbricatePropertyRecord } from "./map";
8
8
  /**
9
9
  * Validate properties with schema
10
10
  *
@@ -15,4 +15,4 @@ import { DocumentProperties } from "./property";
15
15
  * @returns a string error message if validation failed
16
16
  * null if validation passed
17
17
  */
18
- export declare const validateImbricateProperties: (properties: DocumentProperties, schema: ImbricateDatabaseSchema, allowExtraProperties?: boolean) => string | null;
18
+ export declare const validateImbricateProperties: (properties: ImbricatePropertyRecord, schema: ImbricateDatabaseSchema, allowExtraProperties?: boolean) => string | null;
@@ -1,12 +1,12 @@
1
1
  "use strict";
2
2
  /**
3
3
  * @author WMXPY
4
- * @namespace Document
4
+ * @namespace Property
5
5
  * @description Validate
6
6
  */
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
8
  exports.validateImbricateProperties = void 0;
9
- const property_1 = require("./property");
9
+ const type_1 = require("./type");
10
10
  /**
11
11
  * Validate properties with schema
12
12
  *
@@ -23,86 +23,86 @@ const validateImbricateProperties = (properties, schema, allowExtraProperties =
23
23
  }
24
24
  const keys = Object.keys(properties);
25
25
  for (const key of keys) {
26
- const property = schema.properties.find((each) => {
26
+ const schemaProperty = schema.properties.find((each) => {
27
27
  return each.propertyIdentifier === key;
28
28
  });
29
- if (!property) {
29
+ if (!schemaProperty) {
30
30
  if (allowExtraProperties) {
31
31
  continue;
32
32
  }
33
33
  return `Property ${key} not found in schema`;
34
34
  }
35
- const value = properties[key];
36
- if (typeof value.type !== "string") {
35
+ const property = properties[key];
36
+ if (typeof property.propertyType !== "string") {
37
37
  return `Property ${key} type must be a string`;
38
38
  }
39
- if (value.type !== property.propertyType) {
40
- return `Property ${key} type must be ${property.propertyType}, but got ${value.type}`;
39
+ if (property.propertyType !== property.propertyType) {
40
+ return `Property ${key} type must be ${property.propertyType}, but got ${property.propertyType}`;
41
41
  }
42
42
  // IMBRICATE_PROPERTY_TYPE SWITCH
43
- switch (value.type) {
44
- case property_1.IMBRICATE_PROPERTY_TYPE.BOOLEAN: {
45
- if (typeof value.value !== "boolean") {
43
+ switch (property.propertyType) {
44
+ case type_1.IMBRICATE_PROPERTY_TYPE.BOOLEAN: {
45
+ if (typeof property.propertyValue !== "boolean") {
46
46
  return `Property ${key} value must be a boolean`;
47
47
  }
48
48
  break;
49
49
  }
50
- case property_1.IMBRICATE_PROPERTY_TYPE.STRING: {
51
- if (typeof value.value !== "string") {
50
+ case type_1.IMBRICATE_PROPERTY_TYPE.STRING: {
51
+ if (typeof property.propertyValue !== "string") {
52
52
  return `Property ${key} value must be a string`;
53
53
  }
54
54
  break;
55
55
  }
56
- case property_1.IMBRICATE_PROPERTY_TYPE.NUMBER: {
57
- if (typeof value.value !== "number") {
56
+ case type_1.IMBRICATE_PROPERTY_TYPE.NUMBER: {
57
+ if (typeof property.propertyValue !== "number") {
58
58
  return `Property ${key} value must be a number`;
59
59
  }
60
60
  break;
61
61
  }
62
- case property_1.IMBRICATE_PROPERTY_TYPE.MARKDOWN: {
63
- if (typeof value.value !== "string") {
62
+ case type_1.IMBRICATE_PROPERTY_TYPE.MARKDOWN: {
63
+ if (typeof property.propertyValue !== "string") {
64
64
  return `Property ${key} value must be a string`;
65
65
  }
66
66
  break;
67
67
  }
68
- case property_1.IMBRICATE_PROPERTY_TYPE.JSON: {
69
- if (typeof value.value !== "string") {
68
+ case type_1.IMBRICATE_PROPERTY_TYPE.JSON: {
69
+ if (typeof property.propertyValue !== "string") {
70
70
  return `Property ${key} value must be a string`;
71
71
  }
72
72
  break;
73
73
  }
74
- case property_1.IMBRICATE_PROPERTY_TYPE.IMBRISCRIPT: {
75
- if (typeof value.value !== "string") {
74
+ case type_1.IMBRICATE_PROPERTY_TYPE.IMBRISCRIPT: {
75
+ if (typeof property.propertyValue !== "string") {
76
76
  return `Property ${key} value must be a string`;
77
77
  }
78
78
  break;
79
79
  }
80
- case property_1.IMBRICATE_PROPERTY_TYPE.DATE: {
81
- if (typeof value.value !== "string") {
80
+ case type_1.IMBRICATE_PROPERTY_TYPE.DATE: {
81
+ if (typeof property.propertyValue !== "string") {
82
82
  return `Property ${key} value must be a string of date in ISO format`;
83
83
  }
84
- const date = new Date(value.value);
84
+ const date = new Date(property.propertyValue);
85
85
  if (isNaN(date.getTime())) {
86
86
  return `Property ${key} value must be a string of date in ISO format`;
87
87
  }
88
88
  break;
89
89
  }
90
- case property_1.IMBRICATE_PROPERTY_TYPE.LABEL: {
91
- if (!Array.isArray(value.value)) {
90
+ case type_1.IMBRICATE_PROPERTY_TYPE.LABEL: {
91
+ if (!Array.isArray(property.propertyValue)) {
92
92
  return `Property ${key} value must be an array of string`;
93
93
  }
94
- for (const label of value.value) {
94
+ for (const label of property.propertyValue) {
95
95
  if (typeof label !== "string") {
96
96
  return `Property ${key} label must be a string`;
97
97
  }
98
98
  }
99
99
  break;
100
100
  }
101
- case property_1.IMBRICATE_PROPERTY_TYPE.REFERENCE: {
102
- if (!Array.isArray(value.value)) {
101
+ case type_1.IMBRICATE_PROPERTY_TYPE.REFERENCE: {
102
+ if (!Array.isArray(property.propertyValue)) {
103
103
  return `Property ${key} value must be an array of string`;
104
104
  }
105
- for (const reference of value.value) {
105
+ for (const reference of property.propertyValue) {
106
106
  if (typeof reference !== "object") {
107
107
  return `Property ${key} reference must be an object`;
108
108
  }
@@ -118,6 +118,9 @@ const validateImbricateProperties = (properties, schema, allowExtraProperties =
118
118
  }
119
119
  break;
120
120
  }
121
+ default: {
122
+ return `Property ${key} type ${property.propertyType} is not supported`;
123
+ }
121
124
  }
122
125
  }
123
126
  return null;