@imbricate/core 3.5.0 → 3.6.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.
package/database/definition.d.ts
CHANGED
|
@@ -31,3 +31,13 @@ export type DatabaseEditRecord = {
|
|
|
31
31
|
readonly author: ImbricateAuthor;
|
|
32
32
|
readonly operations: DatabaseEditOperation[];
|
|
33
33
|
};
|
|
34
|
+
export type ImbricateDatabaseAuditOptions = {
|
|
35
|
+
/**
|
|
36
|
+
* Do not add edit record, this is controlled an function may vary by origin
|
|
37
|
+
*/
|
|
38
|
+
readonly noEditRecord?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Use this author to add edit record, this is controlled an function may vary by origin
|
|
41
|
+
*/
|
|
42
|
+
readonly author?: ImbricateAuthor;
|
|
43
|
+
};
|
package/database/interface.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { IImbricateDocument } from "../document/interface";
|
|
7
7
|
import { DocumentProperties } from "../document/property";
|
|
8
|
-
import { DatabaseEditRecord, ImbricateDocumentQuery } from "./definition";
|
|
8
|
+
import { DatabaseEditRecord, ImbricateDatabaseAuditOptions, ImbricateDocumentQuery } from "./definition";
|
|
9
9
|
import { ImbricateDatabaseSchema } from "./schema";
|
|
10
10
|
export interface IImbricateDatabase {
|
|
11
11
|
/**
|
|
@@ -25,24 +25,23 @@ export interface IImbricateDatabase {
|
|
|
25
25
|
* Existing documents will still be kept, and stays unchanged
|
|
26
26
|
*
|
|
27
27
|
* @param schema schema of the database
|
|
28
|
-
* @param
|
|
28
|
+
* @param auditOptions audit options of the database
|
|
29
29
|
*
|
|
30
30
|
* @returns a promise of the updated schema
|
|
31
31
|
* Note: if the origin supports Document Edit Record, the edit record will be added by default
|
|
32
32
|
* If you do not want to add the edit record, set `noEditRecord` to true
|
|
33
33
|
*/
|
|
34
|
-
putSchema(schema: ImbricateDatabaseSchema,
|
|
34
|
+
putSchema(schema: ImbricateDatabaseSchema, auditOptions?: ImbricateDatabaseAuditOptions): PromiseLike<void>;
|
|
35
35
|
/**
|
|
36
36
|
* Create a new document in the database
|
|
37
37
|
* If origin supports Document Edit Record, the edit record will be added by default
|
|
38
38
|
*
|
|
39
39
|
* @param properties properties of the document
|
|
40
|
-
* @param
|
|
41
|
-
* if not provided, a unique identifier will be generated
|
|
40
|
+
* @param auditOptions audit options of the document
|
|
42
41
|
*
|
|
43
42
|
* @returns a promise of the created document
|
|
44
43
|
*/
|
|
45
|
-
createDocument(properties: DocumentProperties,
|
|
44
|
+
createDocument(properties: DocumentProperties, auditOptions?: ImbricateDatabaseAuditOptions): PromiseLike<IImbricateDocument>;
|
|
46
45
|
/**
|
|
47
46
|
* Get one document from the database
|
|
48
47
|
*
|
package/document/definition.d.ts
CHANGED
|
@@ -16,3 +16,13 @@ export type DocumentEditRecord = {
|
|
|
16
16
|
readonly author: ImbricateAuthor;
|
|
17
17
|
readonly operations: DocumentEditOperation[];
|
|
18
18
|
};
|
|
19
|
+
export type ImbricateDocumentAuditOptions = {
|
|
20
|
+
/**
|
|
21
|
+
* Do not add edit record, this is controlled an function may vary by origin
|
|
22
|
+
*/
|
|
23
|
+
readonly noEditRecord?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Use this author to add edit record, this is controlled an function may vary by origin
|
|
26
|
+
*/
|
|
27
|
+
readonly author?: ImbricateAuthor;
|
|
28
|
+
};
|
package/document/interface.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* @namespace Document
|
|
4
4
|
* @description Interface
|
|
5
5
|
*/
|
|
6
|
-
import { DocumentEditRecord } from "./definition";
|
|
6
|
+
import { DocumentEditRecord, ImbricateDocumentAuditOptions } from "./definition";
|
|
7
7
|
import { DocumentProperties, DocumentPropertyKey, DocumentPropertyValue, IMBRICATE_PROPERTY_TYPE } from "./property";
|
|
8
8
|
export interface IImbricateDocument {
|
|
9
9
|
/**
|
|
@@ -19,26 +19,24 @@ export interface IImbricateDocument {
|
|
|
19
19
|
*
|
|
20
20
|
* @param key key of the property
|
|
21
21
|
* @param value value of the property
|
|
22
|
-
* @param
|
|
23
|
-
* Default to false, if set to true, the edit record will not be added to the document
|
|
22
|
+
* @param auditOptions audit options of the document
|
|
24
23
|
*
|
|
25
24
|
* @returns a promise of the edit records of the document
|
|
26
25
|
* Note: the edit records will not be added to the document if `noEditRecord` is true,
|
|
27
26
|
* Call `addEditRecords` to add the edit records manually.
|
|
28
27
|
*/
|
|
29
|
-
putProperty(key: DocumentPropertyKey, value: DocumentPropertyValue<IMBRICATE_PROPERTY_TYPE>,
|
|
28
|
+
putProperty(key: DocumentPropertyKey, value: DocumentPropertyValue<IMBRICATE_PROPERTY_TYPE>, auditOptions?: ImbricateDocumentAuditOptions): PromiseLike<DocumentEditRecord[]>;
|
|
30
29
|
/**
|
|
31
30
|
* Put and replace all properties of the document
|
|
32
31
|
*
|
|
33
32
|
* @param properties properties of the document
|
|
34
|
-
* @param
|
|
35
|
-
* Default to false, if set to true, the edit record will not be added to the document
|
|
33
|
+
* @param auditOptions audit options of the document
|
|
36
34
|
*
|
|
37
35
|
* @returns a promise of the edit records of the document
|
|
38
36
|
* Note: the edit records will not be added to the document if `noEditRecord` is true,
|
|
39
37
|
* Call `addEditRecords` to add the edit records manually.
|
|
40
38
|
*/
|
|
41
|
-
putProperties(properties: DocumentProperties,
|
|
39
|
+
putProperties(properties: DocumentProperties, auditOptions?: ImbricateDocumentAuditOptions): PromiseLike<DocumentEditRecord[]>;
|
|
42
40
|
/**
|
|
43
41
|
* Add edit records to the document, optional
|
|
44
42
|
* This method is optional, if not implemented, means the origin
|