@imbricate/core 3.5.0 → 3.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -28,6 +28,16 @@ export type DatabaseEditOperation = {
28
28
  export type DatabaseEditRecord = {
29
29
  readonly uniqueIdentifier: string;
30
30
  readonly editAt: Date;
31
- readonly author: ImbricateAuthor;
32
31
  readonly operations: DatabaseEditOperation[];
32
+ readonly author?: ImbricateAuthor;
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;
33
43
  };
@@ -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 noEditRecord do not add edit record, optional
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, noEditRecord?: boolean): PromiseLike<void>;
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 uniqueIdentifier unique identifier of the document, optional
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, uniqueIdentifier?: string): PromiseLike<IImbricateDocument>;
44
+ createDocument(properties: DocumentProperties, auditOptions?: ImbricateDatabaseAuditOptions): PromiseLike<IImbricateDocument>;
46
45
  /**
47
46
  * Get one document from the database
48
47
  *
@@ -13,6 +13,16 @@ export type DocumentEditOperation = {
13
13
  export type DocumentEditRecord = {
14
14
  readonly uniqueIdentifier: string;
15
15
  readonly editAt: Date;
16
- readonly author: ImbricateAuthor;
17
16
  readonly operations: DocumentEditOperation[];
17
+ readonly author?: ImbricateAuthor;
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;
18
28
  };
@@ -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 noEditRecord do not add edit record, optional
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>, noEditRecord?: boolean): PromiseLike<DocumentEditRecord[]>;
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 noEditRecord do not add edit record, optional
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, noEditRecord?: boolean): PromiseLike<DocumentEditRecord[]>;
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
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@imbricate/core",
3
3
  "main": "index.js",
4
- "version": "3.5.0",
4
+ "version": "3.6.1",
5
5
  "description": "Imbricate Core, Notebook for Engineers",
6
6
  "repository": {
7
7
  "type": "git",