@imbricate/core 3.10.1 → 3.12.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 (51) hide show
  1. package/database/base-class/essential-readonly.d.ts +18 -0
  2. package/database/base-class/essential-readonly.js +29 -0
  3. package/database/base-class/essential.d.ts +18 -0
  4. package/database/base-class/essential.js +36 -0
  5. package/database/base-class/exclude-annotation.d.ts +16 -0
  6. package/database/base-class/exclude-annotation.js +32 -0
  7. package/database/base-class/exclude-edit-records.d.ts +15 -0
  8. package/database/base-class/exclude-edit-records.js +31 -0
  9. package/database/base-class/full-feature-readonly.d.ts +21 -0
  10. package/database/base-class/full-feature-readonly.js +39 -0
  11. package/database/base-class/full-feature.d.ts +29 -0
  12. package/database/base-class/full-feature.js +24 -0
  13. package/database/definition.d.ts +15 -0
  14. package/database/feature.d.ts +16 -0
  15. package/database/feature.js +23 -0
  16. package/database/interface.d.ts +64 -30
  17. package/database/outcome.d.ts +58 -0
  18. package/database/outcome.js +28 -0
  19. package/document/base-class/essential-readonly.d.ts +17 -0
  20. package/document/base-class/essential-readonly.js +25 -0
  21. package/document/base-class/essential.d.ts +18 -0
  22. package/document/base-class/essential.js +33 -0
  23. package/document/base-class/exclude-annotation.d.ts +16 -0
  24. package/document/base-class/exclude-annotation.js +29 -0
  25. package/document/base-class/exclude-edit-records.d.ts +15 -0
  26. package/document/base-class/exclude-edit-records.js +28 -0
  27. package/document/base-class/full-feature-readonly.d.ts +19 -0
  28. package/document/base-class/full-feature-readonly.js +35 -0
  29. package/document/base-class/full-feature.d.ts +23 -0
  30. package/document/base-class/full-feature.js +21 -0
  31. package/document/feature.d.ts +13 -0
  32. package/document/feature.js +20 -0
  33. package/document/interface.d.ts +41 -22
  34. package/document/outcome.d.ts +32 -0
  35. package/document/outcome.js +19 -0
  36. package/document/property/default-value.js +3 -3
  37. package/document/property.d.ts +1 -1
  38. package/document/validate.js +21 -6
  39. package/error/database/database-error.d.ts +9 -0
  40. package/error/database/database-error.js +16 -0
  41. package/error/database/feature-not-supported.d.ts +12 -0
  42. package/error/database/feature-not-supported.js +19 -0
  43. package/error/document/document-error.d.ts +9 -0
  44. package/error/document/document-error.js +16 -0
  45. package/error/document/feature-not-supported.d.ts +12 -0
  46. package/error/document/feature-not-supported.js +20 -0
  47. package/error/imbricate-error.d.ts +14 -0
  48. package/error/imbricate-error.js +27 -0
  49. package/index.d.ts +15 -0
  50. package/index.js +15 -0
  51. package/package.json +1 -1
@@ -0,0 +1,58 @@
1
+ /**
2
+ * @author WMXPY
3
+ * @namespace Database
4
+ * @description Outcome
5
+ */
6
+ import { IImbricateDocument } from "../document/interface";
7
+ import { DatabaseEditRecord } from "./definition";
8
+ export declare const S_Database_PutSchema_VersionConflict: unique symbol;
9
+ export type ImbricateDatabasePutSchemaOutcomeSymbol = typeof S_Database_PutSchema_VersionConflict;
10
+ export type ImbricateDatabasePutSchemaOutcome = {
11
+ readonly editRecords: DatabaseEditRecord[];
12
+ } | ImbricateDatabasePutSchemaOutcomeSymbol;
13
+ export declare const S_Database_CreateDocument_IdentifierDuplicated: unique symbol;
14
+ export type ImbricateDatabaseCreateDocumentOutcomeSymbol = typeof S_Database_CreateDocument_IdentifierDuplicated;
15
+ export type ImbricateDatabaseCreateDocumentOutcome = {
16
+ readonly document: IImbricateDocument;
17
+ } | ImbricateDatabaseCreateDocumentOutcomeSymbol;
18
+ export declare const S_Database_GetDocument_NotFound: unique symbol;
19
+ export type ImbricateDatabaseGetDocumentOutcomeSymbol = typeof S_Database_GetDocument_NotFound;
20
+ export type ImbricateDatabaseGetDocumentOutcome = {
21
+ readonly document: IImbricateDocument;
22
+ } | ImbricateDatabaseGetDocumentOutcomeSymbol;
23
+ export declare const S_Database_QueryDocuments_Stale: unique symbol;
24
+ export type ImbricateDatabaseQueryDocumentsOutcomeSymbol = typeof S_Database_QueryDocuments_Stale;
25
+ export type ImbricateDatabaseQueryDocumentsOutcome = {
26
+ readonly documents: IImbricateDocument[];
27
+ } | ImbricateDatabaseQueryDocumentsOutcomeSymbol;
28
+ export declare const S_Database_CountDocuments_Stale: unique symbol;
29
+ export type ImbricateDatabaseCountDocumentsOutcomeSymbol = typeof S_Database_CountDocuments_Stale;
30
+ export type ImbricateDatabaseCountDocumentsOutcome = {
31
+ readonly count: number;
32
+ } | ImbricateDatabaseCountDocumentsOutcomeSymbol;
33
+ export declare const S_Database_RemoveDocument_NotFound: unique symbol;
34
+ export type ImbricateDatabaseRemoveDocumentOutcomeSymbol = typeof S_Database_RemoveDocument_NotFound;
35
+ export type ImbricateDatabaseRemoveDocumentOutcome = {
36
+ readonly success: boolean;
37
+ } | ImbricateDatabaseRemoveDocumentOutcomeSymbol;
38
+ export declare const S_Database_PutAnnotation_InvalidNamespace: unique symbol;
39
+ export declare const S_Database_PutAnnotation_InvalidIdentifier: unique symbol;
40
+ export type ImbricateDatabasePutAnnotationOutcomeSymbol = typeof S_Database_PutAnnotation_InvalidNamespace | typeof S_Database_PutAnnotation_InvalidIdentifier;
41
+ export type ImbricateDatabasePutAnnotationOutcome = {
42
+ readonly editRecords: DatabaseEditRecord[];
43
+ } | ImbricateDatabasePutAnnotationOutcomeSymbol;
44
+ export declare const S_Database_DeleteAnnotation_NotFound: unique symbol;
45
+ export type ImbricateDatabaseDeleteAnnotationOutcomeSymbol = typeof S_Database_DeleteAnnotation_NotFound;
46
+ export type ImbricateDatabaseDeleteAnnotationOutcome = {
47
+ readonly editRecords: DatabaseEditRecord[];
48
+ } | ImbricateDatabaseDeleteAnnotationOutcomeSymbol;
49
+ export declare const S_Database_AddEditRecords_InvalidEditRecord: unique symbol;
50
+ export type ImbricateDatabaseAddEditRecordsOutcomeSymbol = typeof S_Database_AddEditRecords_InvalidEditRecord;
51
+ export type ImbricateDatabaseAddEditRecordsOutcome = {
52
+ readonly editRecords: DatabaseEditRecord[];
53
+ } | ImbricateDatabaseAddEditRecordsOutcomeSymbol;
54
+ export declare const S_Database_GetEditRecords_NotFound: unique symbol;
55
+ export type ImbricateDatabaseGetEditRecordsOutcomeSymbol = typeof S_Database_GetEditRecords_NotFound;
56
+ export type ImbricateDatabaseGetEditRecordsOutcome = {
57
+ readonly editRecords: DatabaseEditRecord[];
58
+ } | ImbricateDatabaseGetEditRecordsOutcomeSymbol;
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ /**
3
+ * @author WMXPY
4
+ * @namespace Database
5
+ * @description Outcome
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.S_Database_GetEditRecords_NotFound = exports.S_Database_AddEditRecords_InvalidEditRecord = exports.S_Database_DeleteAnnotation_NotFound = exports.S_Database_PutAnnotation_InvalidIdentifier = exports.S_Database_PutAnnotation_InvalidNamespace = exports.S_Database_RemoveDocument_NotFound = exports.S_Database_CountDocuments_Stale = exports.S_Database_QueryDocuments_Stale = exports.S_Database_GetDocument_NotFound = exports.S_Database_CreateDocument_IdentifierDuplicated = exports.S_Database_PutSchema_VersionConflict = void 0;
9
+ // Put Schema
10
+ exports.S_Database_PutSchema_VersionConflict = Symbol("Database_PutSchema_VersionConflict");
11
+ // Create Document
12
+ exports.S_Database_CreateDocument_IdentifierDuplicated = Symbol("Database_CreateDocument_IdentifierDuplicated");
13
+ // Get Document
14
+ exports.S_Database_GetDocument_NotFound = Symbol("Database_GetDocument_NotFound");
15
+ // Query Documents
16
+ exports.S_Database_QueryDocuments_Stale = Symbol("Database_QueryDocuments_Stale");
17
+ exports.S_Database_CountDocuments_Stale = Symbol("Database_CountDocuments_Stale");
18
+ // Remove Document
19
+ exports.S_Database_RemoveDocument_NotFound = Symbol("Database_RemoveDocument_NotFound");
20
+ // Put Annotation
21
+ exports.S_Database_PutAnnotation_InvalidNamespace = Symbol("Database_PutAnnotation_InvalidNamespace");
22
+ exports.S_Database_PutAnnotation_InvalidIdentifier = Symbol("Database_PutAnnotation_InvalidIdentifier");
23
+ // Delete Annotation
24
+ exports.S_Database_DeleteAnnotation_NotFound = Symbol("Database_DeleteAnnotation_NotFound");
25
+ // Add Edit Records
26
+ exports.S_Database_AddEditRecords_InvalidEditRecord = Symbol("Database_AddEditRecords_InvalidEditRecord");
27
+ // Get Edit Records
28
+ exports.S_Database_GetEditRecords_NotFound = Symbol("Database_GetEditRecords_NotFound");
@@ -0,0 +1,17 @@
1
+ /**
2
+ * @author WMXPY
3
+ * @namespace Document
4
+ * @description Essential Readonly
5
+ */
6
+ import { DocumentAnnotations, ImbricateDocumentAuditOptions } from "../definition";
7
+ import { IMBRICATE_DOCUMENT_FEATURE } from "../feature";
8
+ import { IImbricateDocument } from "../interface";
9
+ import { ImbricateDocumentPutPropertyOutcome } from "../outcome";
10
+ import { DocumentProperties, DocumentPropertyKey, DocumentPropertyValue, IMBRICATE_PROPERTY_TYPE } from "../property";
11
+ import { ImbricateDocumentEssentialBase } from "./essential";
12
+ export declare abstract class ImbricateDocumentEssentialReadonlyBase extends ImbricateDocumentEssentialBase implements IImbricateDocument {
13
+ readonly annotations: DocumentAnnotations;
14
+ readonly supportedFeatures: IMBRICATE_DOCUMENT_FEATURE[];
15
+ putProperty(_key: DocumentPropertyKey, _value: DocumentPropertyValue<IMBRICATE_PROPERTY_TYPE>, _auditOptions?: ImbricateDocumentAuditOptions): Promise<ImbricateDocumentPutPropertyOutcome>;
16
+ putProperties(_properties: DocumentProperties, _auditOptions?: ImbricateDocumentAuditOptions): Promise<ImbricateDocumentPutPropertyOutcome>;
17
+ }
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ /**
3
+ * @author WMXPY
4
+ * @namespace Document
5
+ * @description Essential Readonly
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.ImbricateDocumentEssentialReadonlyBase = void 0;
9
+ const feature_not_supported_1 = require("../../error/document/feature-not-supported");
10
+ const feature_1 = require("../feature");
11
+ const essential_1 = require("./essential");
12
+ class ImbricateDocumentEssentialReadonlyBase extends essential_1.ImbricateDocumentEssentialBase {
13
+ constructor() {
14
+ super(...arguments);
15
+ this.annotations = {};
16
+ this.supportedFeatures = [];
17
+ }
18
+ putProperty(_key, _value, _auditOptions) {
19
+ throw feature_not_supported_1.ImbricateDocumentFeatureNotSupportedError.withFeature(feature_1.IMBRICATE_DOCUMENT_FEATURE.DOCUMENT_PUT_PROPERTY);
20
+ }
21
+ putProperties(_properties, _auditOptions) {
22
+ throw feature_not_supported_1.ImbricateDocumentFeatureNotSupportedError.withFeature(feature_1.IMBRICATE_DOCUMENT_FEATURE.DOCUMENT_PUT_PROPERTY);
23
+ }
24
+ }
25
+ exports.ImbricateDocumentEssentialReadonlyBase = ImbricateDocumentEssentialReadonlyBase;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * @author WMXPY
3
+ * @namespace Document
4
+ * @description Essential
5
+ */
6
+ import { DocumentAnnotationValue, DocumentAnnotations, DocumentEditRecord, ImbricateDocumentAuditOptions } from "../definition";
7
+ import { IMBRICATE_DOCUMENT_FEATURE } from "../feature";
8
+ import { IImbricateDocument } from "../interface";
9
+ import { ImbricateDocumentAddEditRecordsOutcome, ImbricateDocumentDeleteAnnotationOutcome, ImbricateDocumentGetEditRecordsOutcome, ImbricateDocumentPutAnnotationOutcome } from "../outcome";
10
+ import { ImbricateDocumentFullFeatureBase } from "./full-feature";
11
+ export declare abstract class ImbricateDocumentEssentialBase extends ImbricateDocumentFullFeatureBase implements IImbricateDocument {
12
+ readonly annotations: DocumentAnnotations;
13
+ readonly supportedFeatures: IMBRICATE_DOCUMENT_FEATURE[];
14
+ putAnnotation(_namespace: string, _identifier: string, _value: DocumentAnnotationValue, _auditOptions?: ImbricateDocumentAuditOptions): Promise<ImbricateDocumentPutAnnotationOutcome>;
15
+ deleteAnnotation(_namespace: string, _identifier: string, _auditOptions?: ImbricateDocumentAuditOptions): Promise<ImbricateDocumentDeleteAnnotationOutcome>;
16
+ addEditRecords(_records: DocumentEditRecord[]): Promise<ImbricateDocumentAddEditRecordsOutcome>;
17
+ getEditRecords(): Promise<ImbricateDocumentGetEditRecordsOutcome>;
18
+ }
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ /**
3
+ * @author WMXPY
4
+ * @namespace Document
5
+ * @description Essential
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.ImbricateDocumentEssentialBase = void 0;
9
+ const feature_not_supported_1 = require("../../error/document/feature-not-supported");
10
+ const feature_1 = require("../feature");
11
+ const full_feature_1 = require("./full-feature");
12
+ class ImbricateDocumentEssentialBase extends full_feature_1.ImbricateDocumentFullFeatureBase {
13
+ constructor() {
14
+ super(...arguments);
15
+ this.annotations = {};
16
+ this.supportedFeatures = [
17
+ feature_1.IMBRICATE_DOCUMENT_FEATURE.DOCUMENT_PUT_PROPERTY,
18
+ ];
19
+ }
20
+ putAnnotation(_namespace, _identifier, _value, _auditOptions) {
21
+ throw feature_not_supported_1.ImbricateDocumentFeatureNotSupportedError.withFeature(feature_1.IMBRICATE_DOCUMENT_FEATURE.DOCUMENT_PUT_ANNOTATION);
22
+ }
23
+ deleteAnnotation(_namespace, _identifier, _auditOptions) {
24
+ throw feature_not_supported_1.ImbricateDocumentFeatureNotSupportedError.withFeature(feature_1.IMBRICATE_DOCUMENT_FEATURE.DOCUMENT_DELETE_ANNOTATION);
25
+ }
26
+ addEditRecords(_records) {
27
+ throw feature_not_supported_1.ImbricateDocumentFeatureNotSupportedError.withFeature(feature_1.IMBRICATE_DOCUMENT_FEATURE.DOCUMENT_PUT_EDIT_RECORD);
28
+ }
29
+ getEditRecords() {
30
+ throw feature_not_supported_1.ImbricateDocumentFeatureNotSupportedError.withFeature(feature_1.IMBRICATE_DOCUMENT_FEATURE.DOCUMENT_GET_EDIT_RECORD);
31
+ }
32
+ }
33
+ exports.ImbricateDocumentEssentialBase = ImbricateDocumentEssentialBase;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * @author WMXPY
3
+ * @namespace Document
4
+ * @description Exclude Annotation
5
+ */
6
+ import { DocumentAnnotationValue, DocumentAnnotations, ImbricateDocumentAuditOptions } from "../definition";
7
+ import { IMBRICATE_DOCUMENT_FEATURE } from "../feature";
8
+ import { IImbricateDocument } from "../interface";
9
+ import { ImbricateDocumentDeleteAnnotationOutcome, ImbricateDocumentPutAnnotationOutcome } from "../outcome";
10
+ import { ImbricateDocumentFullFeatureBase } from "./full-feature";
11
+ export declare abstract class ImbricateDocumentExcludeAnnotationBase extends ImbricateDocumentFullFeatureBase implements IImbricateDocument {
12
+ readonly annotations: DocumentAnnotations;
13
+ readonly supportedFeatures: IMBRICATE_DOCUMENT_FEATURE[];
14
+ putAnnotation(_namespace: string, _identifier: string, _value: DocumentAnnotationValue, _auditOptions?: ImbricateDocumentAuditOptions): Promise<ImbricateDocumentPutAnnotationOutcome>;
15
+ deleteAnnotation(_namespace: string, _identifier: string, _auditOptions?: ImbricateDocumentAuditOptions): Promise<ImbricateDocumentDeleteAnnotationOutcome>;
16
+ }
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ /**
3
+ * @author WMXPY
4
+ * @namespace Document
5
+ * @description Exclude Annotation
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.ImbricateDocumentExcludeAnnotationBase = void 0;
9
+ const feature_not_supported_1 = require("../../error/document/feature-not-supported");
10
+ const feature_1 = require("../feature");
11
+ const full_feature_1 = require("./full-feature");
12
+ class ImbricateDocumentExcludeAnnotationBase extends full_feature_1.ImbricateDocumentFullFeatureBase {
13
+ constructor() {
14
+ super(...arguments);
15
+ this.annotations = {};
16
+ this.supportedFeatures = [
17
+ feature_1.IMBRICATE_DOCUMENT_FEATURE.DOCUMENT_PUT_PROPERTY,
18
+ feature_1.IMBRICATE_DOCUMENT_FEATURE.DOCUMENT_PUT_EDIT_RECORD,
19
+ feature_1.IMBRICATE_DOCUMENT_FEATURE.DOCUMENT_GET_EDIT_RECORD,
20
+ ];
21
+ }
22
+ putAnnotation(_namespace, _identifier, _value, _auditOptions) {
23
+ throw feature_not_supported_1.ImbricateDocumentFeatureNotSupportedError.withFeature(feature_1.IMBRICATE_DOCUMENT_FEATURE.DOCUMENT_PUT_ANNOTATION);
24
+ }
25
+ deleteAnnotation(_namespace, _identifier, _auditOptions) {
26
+ throw feature_not_supported_1.ImbricateDocumentFeatureNotSupportedError.withFeature(feature_1.IMBRICATE_DOCUMENT_FEATURE.DOCUMENT_DELETE_ANNOTATION);
27
+ }
28
+ }
29
+ exports.ImbricateDocumentExcludeAnnotationBase = ImbricateDocumentExcludeAnnotationBase;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * @author WMXPY
3
+ * @namespace Document
4
+ * @description Exclude Edit Records
5
+ */
6
+ import { DocumentEditRecord } from "../definition";
7
+ import { IMBRICATE_DOCUMENT_FEATURE } from "../feature";
8
+ import { IImbricateDocument } from "../interface";
9
+ import { ImbricateDocumentAddEditRecordsOutcome, ImbricateDocumentGetEditRecordsOutcome } from "../outcome";
10
+ import { ImbricateDocumentFullFeatureBase } from "./full-feature";
11
+ export declare abstract class ImbricateDocumentExcludeEditRecordsBase extends ImbricateDocumentFullFeatureBase implements IImbricateDocument {
12
+ readonly supportedFeatures: IMBRICATE_DOCUMENT_FEATURE[];
13
+ addEditRecords(_records: DocumentEditRecord[]): Promise<ImbricateDocumentAddEditRecordsOutcome>;
14
+ getEditRecords(): Promise<ImbricateDocumentGetEditRecordsOutcome>;
15
+ }
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ /**
3
+ * @author WMXPY
4
+ * @namespace Document
5
+ * @description Exclude Edit Records
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.ImbricateDocumentExcludeEditRecordsBase = void 0;
9
+ const feature_not_supported_1 = require("../../error/document/feature-not-supported");
10
+ const feature_1 = require("../feature");
11
+ const full_feature_1 = require("./full-feature");
12
+ class ImbricateDocumentExcludeEditRecordsBase extends full_feature_1.ImbricateDocumentFullFeatureBase {
13
+ constructor() {
14
+ super(...arguments);
15
+ this.supportedFeatures = [
16
+ feature_1.IMBRICATE_DOCUMENT_FEATURE.DOCUMENT_PUT_PROPERTY,
17
+ feature_1.IMBRICATE_DOCUMENT_FEATURE.DOCUMENT_PUT_ANNOTATION,
18
+ feature_1.IMBRICATE_DOCUMENT_FEATURE.DOCUMENT_DELETE_ANNOTATION,
19
+ ];
20
+ }
21
+ addEditRecords(_records) {
22
+ throw feature_not_supported_1.ImbricateDocumentFeatureNotSupportedError.withFeature(feature_1.IMBRICATE_DOCUMENT_FEATURE.DOCUMENT_PUT_EDIT_RECORD);
23
+ }
24
+ getEditRecords() {
25
+ throw feature_not_supported_1.ImbricateDocumentFeatureNotSupportedError.withFeature(feature_1.IMBRICATE_DOCUMENT_FEATURE.DOCUMENT_GET_EDIT_RECORD);
26
+ }
27
+ }
28
+ exports.ImbricateDocumentExcludeEditRecordsBase = ImbricateDocumentExcludeEditRecordsBase;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * @author WMXPY
3
+ * @namespace Document
4
+ * @description Full Feature Readonly
5
+ */
6
+ import { DocumentAnnotationValue, DocumentEditRecord, ImbricateDocumentAuditOptions } from "../definition";
7
+ import { IMBRICATE_DOCUMENT_FEATURE } from "../feature";
8
+ import { IImbricateDocument } from "../interface";
9
+ import { ImbricateDocumentAddEditRecordsOutcome, ImbricateDocumentDeleteAnnotationOutcome, ImbricateDocumentPutAnnotationOutcome, ImbricateDocumentPutPropertyOutcome } from "../outcome";
10
+ import { DocumentProperties, DocumentPropertyKey, DocumentPropertyValue, IMBRICATE_PROPERTY_TYPE } from "../property";
11
+ import { ImbricateDocumentFullFeatureBase } from "./full-feature";
12
+ export declare abstract class ImbricateDocumentFullFeatureReadonlyBase extends ImbricateDocumentFullFeatureBase implements IImbricateDocument {
13
+ readonly supportedFeatures: IMBRICATE_DOCUMENT_FEATURE[];
14
+ putProperty(_key: DocumentPropertyKey, _value: DocumentPropertyValue<IMBRICATE_PROPERTY_TYPE>, _auditOptions?: ImbricateDocumentAuditOptions): Promise<ImbricateDocumentPutPropertyOutcome>;
15
+ putProperties(_properties: DocumentProperties, _auditOptions?: ImbricateDocumentAuditOptions): Promise<ImbricateDocumentPutPropertyOutcome>;
16
+ putAnnotation(_namespace: string, _identifier: string, _value: DocumentAnnotationValue, _auditOptions?: ImbricateDocumentAuditOptions): Promise<ImbricateDocumentPutAnnotationOutcome>;
17
+ deleteAnnotation(_namespace: string, _identifier: string, _auditOptions?: ImbricateDocumentAuditOptions): Promise<ImbricateDocumentDeleteAnnotationOutcome>;
18
+ addEditRecords(_records: DocumentEditRecord[]): Promise<ImbricateDocumentAddEditRecordsOutcome>;
19
+ }
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ /**
3
+ * @author WMXPY
4
+ * @namespace Document
5
+ * @description Full Feature Readonly
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.ImbricateDocumentFullFeatureReadonlyBase = void 0;
9
+ const feature_not_supported_1 = require("../../error/document/feature-not-supported");
10
+ const feature_1 = require("../feature");
11
+ const full_feature_1 = require("./full-feature");
12
+ class ImbricateDocumentFullFeatureReadonlyBase extends full_feature_1.ImbricateDocumentFullFeatureBase {
13
+ constructor() {
14
+ super(...arguments);
15
+ this.supportedFeatures = [
16
+ feature_1.IMBRICATE_DOCUMENT_FEATURE.DOCUMENT_GET_EDIT_RECORD,
17
+ ];
18
+ }
19
+ putProperty(_key, _value, _auditOptions) {
20
+ throw feature_not_supported_1.ImbricateDocumentFeatureNotSupportedError.withFeature(feature_1.IMBRICATE_DOCUMENT_FEATURE.DOCUMENT_PUT_PROPERTY);
21
+ }
22
+ putProperties(_properties, _auditOptions) {
23
+ throw feature_not_supported_1.ImbricateDocumentFeatureNotSupportedError.withFeature(feature_1.IMBRICATE_DOCUMENT_FEATURE.DOCUMENT_PUT_PROPERTY);
24
+ }
25
+ putAnnotation(_namespace, _identifier, _value, _auditOptions) {
26
+ throw feature_not_supported_1.ImbricateDocumentFeatureNotSupportedError.withFeature(feature_1.IMBRICATE_DOCUMENT_FEATURE.DOCUMENT_PUT_ANNOTATION);
27
+ }
28
+ deleteAnnotation(_namespace, _identifier, _auditOptions) {
29
+ throw feature_not_supported_1.ImbricateDocumentFeatureNotSupportedError.withFeature(feature_1.IMBRICATE_DOCUMENT_FEATURE.DOCUMENT_DELETE_ANNOTATION);
30
+ }
31
+ addEditRecords(_records) {
32
+ throw feature_not_supported_1.ImbricateDocumentFeatureNotSupportedError.withFeature(feature_1.IMBRICATE_DOCUMENT_FEATURE.DOCUMENT_PUT_EDIT_RECORD);
33
+ }
34
+ }
35
+ exports.ImbricateDocumentFullFeatureReadonlyBase = ImbricateDocumentFullFeatureReadonlyBase;
@@ -0,0 +1,23 @@
1
+ /**
2
+ * @author WMXPY
3
+ * @namespace Document
4
+ * @description Full Feature
5
+ */
6
+ import { DocumentAnnotationValue, DocumentAnnotations, DocumentEditRecord, ImbricateDocumentAuditOptions } from "../definition";
7
+ import { IMBRICATE_DOCUMENT_FEATURE } from "../feature";
8
+ import { IImbricateDocument } from "../interface";
9
+ import { ImbricateDocumentAddEditRecordsOutcome, ImbricateDocumentDeleteAnnotationOutcome, ImbricateDocumentGetEditRecordsOutcome, ImbricateDocumentPutAnnotationOutcome, ImbricateDocumentPutPropertyOutcome } from "../outcome";
10
+ import { DocumentProperties, DocumentPropertyKey, DocumentPropertyValue, IMBRICATE_PROPERTY_TYPE } from "../property";
11
+ export declare abstract class ImbricateDocumentFullFeatureBase implements IImbricateDocument {
12
+ abstract readonly uniqueIdentifier: string;
13
+ abstract readonly documentVersion: string;
14
+ abstract readonly properties: DocumentProperties;
15
+ abstract readonly annotations: DocumentAnnotations;
16
+ readonly supportedFeatures: IMBRICATE_DOCUMENT_FEATURE[];
17
+ abstract putProperty(key: DocumentPropertyKey, value: DocumentPropertyValue<IMBRICATE_PROPERTY_TYPE>, auditOptions?: ImbricateDocumentAuditOptions): Promise<ImbricateDocumentPutPropertyOutcome>;
18
+ abstract putProperties(properties: DocumentProperties, auditOptions?: ImbricateDocumentAuditOptions): Promise<ImbricateDocumentPutPropertyOutcome>;
19
+ abstract putAnnotation(namespace: string, identifier: string, value: DocumentAnnotationValue, auditOptions?: ImbricateDocumentAuditOptions): Promise<ImbricateDocumentPutAnnotationOutcome>;
20
+ abstract deleteAnnotation(namespace: string, identifier: string, auditOptions?: ImbricateDocumentAuditOptions): Promise<ImbricateDocumentDeleteAnnotationOutcome>;
21
+ abstract addEditRecords(records: DocumentEditRecord[]): Promise<ImbricateDocumentAddEditRecordsOutcome>;
22
+ abstract getEditRecords(): Promise<ImbricateDocumentGetEditRecordsOutcome>;
23
+ }
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ /**
3
+ * @author WMXPY
4
+ * @namespace Document
5
+ * @description Full Feature
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.ImbricateDocumentFullFeatureBase = void 0;
9
+ const feature_1 = require("../feature");
10
+ class ImbricateDocumentFullFeatureBase {
11
+ constructor() {
12
+ this.supportedFeatures = [
13
+ feature_1.IMBRICATE_DOCUMENT_FEATURE.DOCUMENT_PUT_PROPERTY,
14
+ feature_1.IMBRICATE_DOCUMENT_FEATURE.DOCUMENT_PUT_ANNOTATION,
15
+ feature_1.IMBRICATE_DOCUMENT_FEATURE.DOCUMENT_DELETE_ANNOTATION,
16
+ feature_1.IMBRICATE_DOCUMENT_FEATURE.DOCUMENT_PUT_EDIT_RECORD,
17
+ feature_1.IMBRICATE_DOCUMENT_FEATURE.DOCUMENT_GET_EDIT_RECORD,
18
+ ];
19
+ }
20
+ }
21
+ exports.ImbricateDocumentFullFeatureBase = ImbricateDocumentFullFeatureBase;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @author WMXPY
3
+ * @namespace Document
4
+ * @description Feature
5
+ */
6
+ export declare enum IMBRICATE_DOCUMENT_FEATURE {
7
+ DOCUMENT_PUT_PROPERTY = "DOCUMENT_PUT_PROPERTY",
8
+ DOCUMENT_PUT_ANNOTATION = "DOCUMENT_PUT_ANNOTATION",
9
+ DOCUMENT_DELETE_ANNOTATION = "DOCUMENT_DELETE_ANNOTATION",
10
+ DOCUMENT_PUT_EDIT_RECORD = "DOCUMENT_PUT_EDIT_RECORD",
11
+ DOCUMENT_GET_EDIT_RECORD = "DOCUMENT_GET_EDIT_RECORD"
12
+ }
13
+ export declare const checkImbricateDocumentFeatureSupported: (features: IMBRICATE_DOCUMENT_FEATURE[], feature: IMBRICATE_DOCUMENT_FEATURE) => boolean;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ /**
3
+ * @author WMXPY
4
+ * @namespace Document
5
+ * @description Feature
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.checkImbricateDocumentFeatureSupported = exports.IMBRICATE_DOCUMENT_FEATURE = void 0;
9
+ var IMBRICATE_DOCUMENT_FEATURE;
10
+ (function (IMBRICATE_DOCUMENT_FEATURE) {
11
+ IMBRICATE_DOCUMENT_FEATURE["DOCUMENT_PUT_PROPERTY"] = "DOCUMENT_PUT_PROPERTY";
12
+ IMBRICATE_DOCUMENT_FEATURE["DOCUMENT_PUT_ANNOTATION"] = "DOCUMENT_PUT_ANNOTATION";
13
+ IMBRICATE_DOCUMENT_FEATURE["DOCUMENT_DELETE_ANNOTATION"] = "DOCUMENT_DELETE_ANNOTATION";
14
+ IMBRICATE_DOCUMENT_FEATURE["DOCUMENT_PUT_EDIT_RECORD"] = "DOCUMENT_PUT_EDIT_RECORD";
15
+ IMBRICATE_DOCUMENT_FEATURE["DOCUMENT_GET_EDIT_RECORD"] = "DOCUMENT_GET_EDIT_RECORD";
16
+ })(IMBRICATE_DOCUMENT_FEATURE || (exports.IMBRICATE_DOCUMENT_FEATURE = IMBRICATE_DOCUMENT_FEATURE = {}));
17
+ const checkImbricateDocumentFeatureSupported = (features, feature) => {
18
+ return features.includes(feature);
19
+ };
20
+ exports.checkImbricateDocumentFeatureSupported = checkImbricateDocumentFeatureSupported;
@@ -4,6 +4,8 @@
4
4
  * @description Interface
5
5
  */
6
6
  import { DocumentAnnotationValue, DocumentAnnotations, DocumentEditRecord, ImbricateDocumentAuditOptions } from "./definition";
7
+ import { IMBRICATE_DOCUMENT_FEATURE } from "./feature";
8
+ import { ImbricateDocumentAddEditRecordsOutcome, ImbricateDocumentDeleteAnnotationOutcome, ImbricateDocumentGetEditRecordsOutcome, ImbricateDocumentPutAnnotationOutcome, ImbricateDocumentPutPropertyOutcome } from "./outcome";
7
9
  import { DocumentProperties, DocumentPropertyKey, DocumentPropertyValue, IMBRICATE_PROPERTY_TYPE } from "./property";
8
10
  export interface IImbricateDocument {
9
11
  /**
@@ -13,7 +15,7 @@ export interface IImbricateDocument {
13
15
  /**
14
16
  * Version of the document draft
15
17
  */
16
- readonly documentVersion: number;
18
+ readonly documentVersion: string;
17
19
  /**
18
20
  * Properties of the document
19
21
  */
@@ -22,70 +24,87 @@ export interface IImbricateDocument {
22
24
  * Annotations of the database
23
25
  */
24
26
  readonly annotations: DocumentAnnotations;
27
+ /**
28
+ * Supported features of the document
29
+ */
30
+ readonly supportedFeatures: IMBRICATE_DOCUMENT_FEATURE[];
25
31
  /**
26
32
  * Update a property from the document
27
33
  *
34
+ * RequireFeature: DOCUMENT_PUT_PROPERTY
35
+ *
28
36
  * @param key key of the property
29
37
  * @param value value of the property
30
38
  * @param auditOptions audit options of the document
31
39
  *
32
- * @returns a promise of the edit records of the document
33
- * Note: the edit records will not be added to the document if `noEditRecord` is true,
34
- * Call `addEditRecords` to add the edit records manually.
40
+ * @returns a promise of the outcome of the put property
41
+ * Symbol: S_Document_PutProperty_InvalidKey - if the key is invalid
35
42
  */
36
- putProperty(key: DocumentPropertyKey, value: DocumentPropertyValue<IMBRICATE_PROPERTY_TYPE>, auditOptions?: ImbricateDocumentAuditOptions): PromiseLike<DocumentEditRecord[]>;
43
+ putProperty(key: DocumentPropertyKey, value: DocumentPropertyValue<IMBRICATE_PROPERTY_TYPE>, auditOptions?: ImbricateDocumentAuditOptions): PromiseLike<ImbricateDocumentPutPropertyOutcome>;
37
44
  /**
38
- * Put and replace all properties of the document
45
+ * Put and replace all properties of the document, optional
46
+ *
47
+ * RequireFeature: DOCUMENT_PUT_PROPERTIES
39
48
  *
40
49
  * @param properties properties of the document
41
50
  * @param auditOptions audit options of the document
42
51
  *
43
- * @returns a promise of the edit records of the document
44
- * Note: the edit records will not be added to the document if `noEditRecord` is true,
45
- * Call `addEditRecords` to add the edit records manually.
52
+ * @returns a promise of the outcome of the put properties
53
+ * Symbol: S_Document_PutProperty_InvalidKey - if the key is invalid
46
54
  */
47
- putProperties(properties: DocumentProperties, auditOptions?: ImbricateDocumentAuditOptions): PromiseLike<DocumentEditRecord[]>;
55
+ putProperties(properties: DocumentProperties, auditOptions?: ImbricateDocumentAuditOptions): PromiseLike<ImbricateDocumentPutPropertyOutcome>;
48
56
  /**
49
- * put annotation to the document
57
+ * Put annotation to the document, optional
58
+ *
59
+ * RequireFeature: DOCUMENT_PUT_ANNOTATION
50
60
  *
51
61
  * @param namespace namespace of the annotation
52
62
  * @param identifier identifier of the annotation
53
63
  * @param value value of the annotation
54
64
  * @param auditOptions audit options of the document
55
65
  *
56
- * @returns a promise of the edit records of the document
57
- * Note: if the origin supports Document Edit Record, the edit record will be added by default
58
- * If you do not want to add the edit record, set `noEditRecord` to true in audit options
66
+ * @returns a promise of the outcome of the put annotation
67
+ * Symbol: S_Document_PutAnnotation_InvalidNamespace - if the namespace is invalid
68
+ * Symbol: S_Document_PutAnnotation_InvalidIdentifier - if the identifier is invalid
59
69
  */
60
- putAnnotation(namespace: string, identifier: string, value: DocumentAnnotationValue, auditOptions?: ImbricateDocumentAuditOptions): PromiseLike<DocumentEditRecord[]>;
70
+ putAnnotation(namespace: string, identifier: string, value: DocumentAnnotationValue, auditOptions?: ImbricateDocumentAuditOptions): PromiseLike<ImbricateDocumentPutAnnotationOutcome>;
61
71
  /**
62
72
  * Delete annotation from the document
63
73
  *
74
+ * RequireFeature: DOCUMENT_DELETE_ANNOTATION
75
+ *
64
76
  * @param namespace namespace of the annotation
65
77
  * @param identifier identifier of the annotation
66
78
  * @param auditOptions audit options of the document
67
79
  *
68
- * @returns a promise of the edit records of the document
69
- * Note: if the origin supports Document Edit Record, the edit record will be added by default
70
- * If you do not want to add the edit record, set `noEditRecord` to true in audit options
80
+ * @returns a promise of the outcome of the delete annotation
81
+ * Symbol: S_Document_DeleteAnnotation_NotFound - if the annotation is not found
71
82
  */
72
- deleteAnnotation(namespace: string, identifier: string, auditOptions?: ImbricateDocumentAuditOptions): PromiseLike<DocumentEditRecord[]>;
83
+ deleteAnnotation(namespace: string, identifier: string, auditOptions?: ImbricateDocumentAuditOptions): PromiseLike<ImbricateDocumentDeleteAnnotationOutcome>;
73
84
  /**
74
85
  * Add edit records to the document, optional
75
86
  * This method is optional, if not implemented, means the origin
76
87
  * 1. The origin does not support edit records
77
88
  * 2. The origin force to add edit records when put properties
78
89
  *
90
+ * RequireFeature: DOCUMENT_PUT_EDIT_RECORD
91
+ *
79
92
  * @param records document edit records
93
+ *
94
+ * @returns a promise of the outcome of the add edit records
95
+ * Symbol: S_Document_AddEditRecords_InvalidRecord - if the record is invalid
80
96
  */
81
- addEditRecords?(records: DocumentEditRecord[]): PromiseLike<void>;
97
+ addEditRecords(records: DocumentEditRecord[]): PromiseLike<ImbricateDocumentAddEditRecordsOutcome>;
82
98
  /**
83
99
  * Get edit records of the document, optional
84
100
  * This method is optional, if not implemented, means the origin
85
101
  * 1. The origin does not support edit records
86
102
  * 2. The origin force to add edit records when put properties
87
103
  *
88
- * @returns a promise of the edit records of the document
104
+ * RequireFeature: DOCUMENT_GET_EDIT_RECORD
105
+ *
106
+ * @returns a promise of the outcome of the get edit records
107
+ * Symbol: S_Document_GetEditRecords_NotFound - if the edit records are not found
89
108
  */
90
- getEditRecords?(): PromiseLike<DocumentEditRecord[]>;
109
+ getEditRecords(): PromiseLike<ImbricateDocumentGetEditRecordsOutcome>;
91
110
  }
@@ -0,0 +1,32 @@
1
+ /**
2
+ * @author WMXPY
3
+ * @namespace Document
4
+ * @description Outcome
5
+ */
6
+ import { DocumentEditRecord } from "./definition";
7
+ export declare const S_Document_PutProperty_InvalidKey: unique symbol;
8
+ export type ImbricateDocumentPutPropertyOutcomeSymbol = typeof S_Document_PutProperty_InvalidKey;
9
+ export type ImbricateDocumentPutPropertyOutcome = {
10
+ readonly editRecords: DocumentEditRecord[];
11
+ } | ImbricateDocumentPutPropertyOutcomeSymbol;
12
+ export declare const S_Document_PutAnnotation_InvalidNamespace: unique symbol;
13
+ export declare const S_Document_PutAnnotation_InvalidIdentifier: unique symbol;
14
+ export type ImbricateDocumentPutAnnotationOutcomeSymbol = typeof S_Document_PutAnnotation_InvalidNamespace | typeof S_Document_PutAnnotation_InvalidIdentifier;
15
+ export type ImbricateDocumentPutAnnotationOutcome = {
16
+ readonly editRecords: DocumentEditRecord[];
17
+ } | ImbricateDocumentPutAnnotationOutcomeSymbol;
18
+ export declare const S_Document_DeleteAnnotation_NotFound: unique symbol;
19
+ export type ImbricateDocumentDeleteAnnotationOutcomeSymbol = typeof S_Document_DeleteAnnotation_NotFound;
20
+ export type ImbricateDocumentDeleteAnnotationOutcome = {
21
+ readonly editRecords: DocumentEditRecord[];
22
+ } | ImbricateDocumentDeleteAnnotationOutcomeSymbol;
23
+ export declare const S_Document_AddEditRecords_InvalidRecord: unique symbol;
24
+ export type ImbricateDocumentAddEditRecordsOutcomeSymbol = typeof S_Document_AddEditRecords_InvalidRecord;
25
+ export type ImbricateDocumentAddEditRecordsOutcome = {
26
+ readonly editRecords: DocumentEditRecord[];
27
+ } | ImbricateDocumentAddEditRecordsOutcomeSymbol;
28
+ export declare const S_Document_GetEditRecords_NotFound: unique symbol;
29
+ export type ImbricateDocumentGetEditRecordsOutcomeSymbol = typeof S_Document_GetEditRecords_NotFound;
30
+ export type ImbricateDocumentGetEditRecordsOutcome = {
31
+ readonly editRecords: DocumentEditRecord[];
32
+ } | ImbricateDocumentGetEditRecordsOutcomeSymbol;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ /**
3
+ * @author WMXPY
4
+ * @namespace Document
5
+ * @description Outcome
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.S_Document_GetEditRecords_NotFound = exports.S_Document_AddEditRecords_InvalidRecord = exports.S_Document_DeleteAnnotation_NotFound = exports.S_Document_PutAnnotation_InvalidIdentifier = exports.S_Document_PutAnnotation_InvalidNamespace = exports.S_Document_PutProperty_InvalidKey = void 0;
9
+ // Put Property
10
+ exports.S_Document_PutProperty_InvalidKey = Symbol("Document_PutProperty_InvalidKey");
11
+ // Put Annotation
12
+ exports.S_Document_PutAnnotation_InvalidNamespace = Symbol("Document_PutAnnotation_InvalidNamespace");
13
+ exports.S_Document_PutAnnotation_InvalidIdentifier = Symbol("Document_PutAnnotation_InvalidIdentifier");
14
+ // Delete Annotation
15
+ exports.S_Document_DeleteAnnotation_NotFound = Symbol("Document_DeleteAnnotation_NotFound");
16
+ // Add Edit Records
17
+ exports.S_Document_AddEditRecords_InvalidRecord = Symbol("Document_AddEditRecords_InvalidRecord");
18
+ // Get Edit Records
19
+ exports.S_Document_GetEditRecords_NotFound = Symbol("Document_GetEditRecords_NotFound");
@@ -13,9 +13,9 @@ const getImbricateDefaultValueOfProperty = (type) => {
13
13
  case property_1.IMBRICATE_PROPERTY_TYPE.BOOLEAN: return false;
14
14
  case property_1.IMBRICATE_PROPERTY_TYPE.STRING: return "";
15
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 "";
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
19
  case property_1.IMBRICATE_PROPERTY_TYPE.DATE: return new Date().toISOString();
20
20
  case property_1.IMBRICATE_PROPERTY_TYPE.LABEL: return [];
21
21
  case property_1.IMBRICATE_PROPERTY_TYPE.REFERENCE: return [];
@@ -68,4 +68,4 @@ export type DocumentPropertyValueObjectReference = {
68
68
  readonly databaseUniqueIdentifier: string;
69
69
  readonly documentUniqueIdentifier: string;
70
70
  };
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;
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;