@imbricate/core 3.7.2 → 3.8.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 (82) hide show
  1. package/.editorconfig +10 -0
  2. package/.gitattributes +4 -0
  3. package/.github/dependabot.yml +8 -0
  4. package/.github/workflows/ci.yml +48 -0
  5. package/.vscode/settings.json +8 -0
  6. package/.yarn/releases/yarn-4.4.0.cjs +925 -0
  7. package/.yarnrc.yml +3 -0
  8. package/babel.config.js +14 -0
  9. package/docs/README.md +70 -0
  10. package/eslint.config.mjs +64 -0
  11. package/jest.config.ts +14 -0
  12. package/package.json +27 -3
  13. package/{author/definition.d.ts → src/author/definition.ts} +4 -0
  14. package/{database/definition.d.ts → src/database/definition.ts} +67 -4
  15. package/{database/interface.d.ts → src/database/interface.ts} +69 -27
  16. package/{database/manager.d.ts → src/database/manager.ts} +24 -9
  17. package/src/database/schema.ts +165 -0
  18. package/src/database/validate.ts +77 -0
  19. package/{document/definition.d.ts → src/document/definition.ts} +31 -3
  20. package/{document/interface.d.ts → src/document/interface.ts} +44 -15
  21. package/src/document/property/default-value.ts +26 -0
  22. package/{document/property/definition.d.ts → src/document/property/definition.ts} +6 -1
  23. package/src/document/property/primary.ts +29 -0
  24. package/src/document/property/triage-base.ts +138 -0
  25. package/src/document/property/triage-manager.ts +68 -0
  26. package/src/document/property/triage.ts +15 -0
  27. package/{document/property.d.ts → src/document/property.ts} +23 -4
  28. package/{document/validate.js → src/document/validate.ts} +33 -21
  29. package/{index.d.ts → src/index.ts} +3 -0
  30. package/{loader/definition.d.ts → src/loader/definition.ts} +5 -1
  31. package/src/loader/origin-loader.ts +88 -0
  32. package/{loader/persistence.d.ts → src/loader/persistence.ts} +12 -3
  33. package/{origin/definition.d.ts → src/origin/definition.ts} +1 -0
  34. package/{origin/interface.d.ts → src/origin/interface.ts} +18 -7
  35. package/{origin/search.d.ts → src/origin/search.ts} +29 -13
  36. package/{static/definition.d.ts → src/static/definition.ts} +3 -0
  37. package/{static/interface.d.ts → src/static/interface.ts} +6 -1
  38. package/{static/manager.d.ts → src/static/manager.ts} +11 -4
  39. package/{text/definition.d.ts → src/text/definition.ts} +3 -0
  40. package/{text/interface.d.ts → src/text/interface.ts} +6 -1
  41. package/{text/manager.d.ts → src/text/manager.ts} +11 -4
  42. package/test/unit/database/schema.test.ts +95 -0
  43. package/test/unit/document/property/primary.test.ts +87 -0
  44. package/test/unit/document/property/triage.test.ts +64 -0
  45. package/test/unit/document/validate.test.ts +138 -0
  46. package/test/unit/loader/definition.test.ts +55 -0
  47. package/typescript/tsconfig.build.json +23 -0
  48. package/author/definition.js +0 -7
  49. package/database/definition.js +0 -17
  50. package/database/interface.js +0 -7
  51. package/database/manager.js +0 -7
  52. package/database/schema.d.ts +0 -69
  53. package/database/schema.js +0 -78
  54. package/document/definition.js +0 -17
  55. package/document/interface.js +0 -7
  56. package/document/property/default-value.d.ts +0 -7
  57. package/document/property/default-value.js +0 -25
  58. package/document/property/definition.js +0 -7
  59. package/document/property/primary.d.ts +0 -8
  60. package/document/property/primary.js +0 -20
  61. package/document/property/triage-base.d.ts +0 -31
  62. package/document/property/triage-base.js +0 -85
  63. package/document/property/triage-manager.d.ts +0 -30
  64. package/document/property/triage-manager.js +0 -50
  65. package/document/property/triage.d.ts +0 -8
  66. package/document/property/triage.js +0 -13
  67. package/document/property.js +0 -54
  68. package/document/validate.d.ts +0 -18
  69. package/index.js +0 -46
  70. package/loader/definition.js +0 -7
  71. package/loader/origin-loader.d.ts +0 -29
  72. package/loader/origin-loader.js +0 -104
  73. package/loader/persistence.js +0 -19
  74. package/origin/definition.js +0 -7
  75. package/origin/interface.js +0 -7
  76. package/origin/search.js +0 -14
  77. package/static/definition.js +0 -7
  78. package/static/interface.js +0 -7
  79. package/static/manager.js +0 -7
  80. package/text/definition.js +0 -7
  81. package/text/interface.js +0 -7
  82. package/text/manager.js +0 -7
package/.yarnrc.yml ADDED
@@ -0,0 +1,3 @@
1
+ nodeLinker: node-modules
2
+
3
+ yarnPath: .yarn/releases/yarn-4.4.0.cjs
@@ -0,0 +1,14 @@
1
+ module.exports = {
2
+ presets: [
3
+ [
4
+ "@babel/preset-env",
5
+ {
6
+ targets:
7
+ {
8
+ node: "current",
9
+ },
10
+ },
11
+ ],
12
+ "@babel/preset-typescript",
13
+ ],
14
+ };
package/docs/README.md ADDED
@@ -0,0 +1,70 @@
1
+ # Imbricate ▦
2
+
3
+ ```
4
+ ┌───────┐
5
+ │ I M B │
6
+ │ R I C │
7
+ │ A T E │
8
+ └───────┘
9
+ ```
10
+
11
+ [![Continuous Integration](https://github.com/Imbricate/Imbricate/actions/workflows/ci.yml/badge.svg)](https://github.com/Imbricate/Imbricate/actions/workflows/ci.yml)
12
+ [![codecov](https://codecov.io/gh/Imbricate/Imbricate/branch/main/graph/badge.svg)](https://codecov.io/gh/Imbricate/Imbricate)
13
+ [![npm version](https://badge.fury.io/js/%40imbricate%2Fcore.svg)](https://badge.fury.io/js/%40imbricate%2Fcore)
14
+ [![downloads](https://img.shields.io/npm/dm/@imbricate/core.svg)](https://www.npmjs.com/package/@imbricate/core)
15
+
16
+ Yes to accountable notes, no to external hosting. Free, for everyone.
17
+
18
+ ## Install
19
+
20
+ ```sh
21
+ yarn add @imbricate/core
22
+ # Or
23
+ npm install @imbricate/core --save
24
+ ```
25
+
26
+ ## Documentation
27
+
28
+ Visit [imbricate.io](https://imbricate.io/).
29
+
30
+ ## Quick Start with Imbricate VSCode Extension
31
+
32
+ Imbricate VSCode Extension is available through the Visual Studio Code Marketplace. See [Imbricate VSCode Extension](https://marketplace.visualstudio.com/items?itemName=imbricate.imbricate).
33
+
34
+ ## Quick Start with Imbricate CLI
35
+
36
+ Imbricate CLI is available through NPM for package management. See https://github.com/imbricate/Imbricate-CLI.
37
+
38
+ To install Imbricate CLI:
39
+
40
+ ### Using Yarn
41
+
42
+ Yarn 1.x
43
+
44
+ ```sh
45
+ yarn global add imbricate
46
+ ```
47
+
48
+ Yarn 2.x
49
+
50
+ ```sh
51
+ yarn dlx imbricate
52
+ ```
53
+
54
+ ### Using NPM
55
+
56
+ ```sh
57
+ npm install -g imbricate
58
+ ```
59
+
60
+ ## Usage
61
+
62
+ ```sh
63
+ imbricate --help
64
+ ```
65
+
66
+ ```
67
+ ┌─────────────────────┐
68
+ │ I M B R I C A T E ▦ │
69
+ └─────────────────────┘
70
+ ```
@@ -0,0 +1,64 @@
1
+ import typescriptEslint from "@typescript-eslint/eslint-plugin";
2
+ import typescriptParser from "@typescript-eslint/parser";
3
+
4
+ export default [
5
+ {
6
+ files: ["**/*.{ts,tsx}"],
7
+ languageOptions: {
8
+ parser: typescriptParser,
9
+ parserOptions: {
10
+ sourceType: "module",
11
+ },
12
+ },
13
+ },
14
+ {
15
+ plugins: {
16
+ "@typescript-eslint": typescriptEslint,
17
+ },
18
+ rules: {
19
+ "@typescript-eslint/no-explicit-any": "off",
20
+ "@typescript-eslint/no-unused-vars": [
21
+ "error",
22
+ {
23
+ "argsIgnorePattern": "^_",
24
+ },
25
+ ],
26
+ "comma-dangle": [
27
+ "error",
28
+ {
29
+ arrays: "always-multiline",
30
+ objects: "always-multiline",
31
+ functions: "always-multiline",
32
+ imports: "always-multiline",
33
+ exports: "always-multiline",
34
+ },
35
+ ],
36
+ "sort-imports": [
37
+ "error",
38
+ {
39
+ ignoreCase: false,
40
+ ignoreDeclarationSort: true,
41
+ ignoreMemberSort: false,
42
+ allowSeparatedGroups: false,
43
+ memberSyntaxSortOrder: [
44
+ "none",
45
+ "all",
46
+ "multiple",
47
+ "single",
48
+ ],
49
+ },
50
+ ],
51
+ quotes: [
52
+ "error",
53
+ "double",
54
+ {
55
+ avoidEscape: true,
56
+ },
57
+ ],
58
+ semi: [
59
+ "error",
60
+ "always",
61
+ ],
62
+ },
63
+ },
64
+ ];
package/jest.config.ts ADDED
@@ -0,0 +1,14 @@
1
+ import type { Config } from "jest";
2
+
3
+ export default async (): Promise<Config> => {
4
+ return {
5
+ verbose: true,
6
+ collectCoverageFrom: [
7
+ "src/**/*.ts",
8
+ ],
9
+ coverageReporters: [
10
+ "json",
11
+ "text-summary",
12
+ ],
13
+ };
14
+ };
package/package.json CHANGED
@@ -1,8 +1,19 @@
1
1
  {
2
2
  "name": "@imbricate/core",
3
- "main": "index.js",
4
- "version": "3.7.2",
3
+ "packageManager": "yarn@4.4.0",
4
+ "version": "3.8.0",
5
5
  "description": "Imbricate Core, Notebook for Engineers",
6
+ "scripts": {
7
+ "clean": "rm -rf app",
8
+ "test": "jest",
9
+ "coverage": "jest --coverage",
10
+ "lint": "eslint src",
11
+ "build": "tsc --project typescript/tsconfig.build.json",
12
+ "license": "sdb license",
13
+ "release": "yarn lint && yarn test && yarn license && yarn build",
14
+ "publish-dry-run": "yarn release && sdb --only publish-dry-run",
15
+ "publish": "yarn release && sdb --only publish"
16
+ },
6
17
  "repository": {
7
18
  "type": "git",
8
19
  "url": "git+https://github.com/Imbricate/Imbricate.git"
@@ -17,5 +28,18 @@
17
28
  "bugs": {
18
29
  "url": "https://github.com/Imbricate/Imbricate/issues"
19
30
  },
20
- "homepage": "https://imbricate.io"
31
+ "homepage": "https://imbricate.io",
32
+ "devDependencies": {
33
+ "@babel/core": "^7.26.0",
34
+ "@babel/preset-env": "^7.26.0",
35
+ "@babel/preset-typescript": "^7.26.0",
36
+ "@types/jest": "^29.5.14",
37
+ "@typescript-eslint/eslint-plugin": "^8.16.0",
38
+ "@typescript-eslint/parser": "^8.16.0",
39
+ "babel-jest": "^29.7.0",
40
+ "eslint": "^9.15.0",
41
+ "jest": "^29.7.0",
42
+ "ts-node": "^10.9.2",
43
+ "typescript": "^5.7.2"
44
+ }
21
45
  }
@@ -3,9 +3,13 @@
3
3
  * @namespace Author
4
4
  * @description Definition
5
5
  */
6
+
6
7
  export type ImbricateAuthor = {
8
+
7
9
  readonly category: string;
8
10
  readonly identifier: string;
11
+
9
12
  readonly isAutomation: boolean;
13
+
10
14
  readonly onBehalfOf?: ImbricateAuthor;
11
15
  };
@@ -3,54 +3,117 @@
3
3
  * @namespace Database
4
4
  * @description Definition
5
5
  */
6
+
6
7
  import { ImbricateAuthor } from "../author/definition";
7
8
  import { ImbricateDatabaseSchema } from "./schema";
9
+
10
+ export enum IMBRICATE_QUERY_COMPARE_CONDITION {
11
+
12
+ EQUAL = "EQUAL",
13
+ }
14
+
15
+ export enum IMBRICATE_QUERY_PROPERTY_CONDITION_TARGET {
16
+
17
+ PROPERTY_TYPE = "PROPERTY_TYPE",
18
+ PROPERTY_VALUE = "PROPERTY_VALUE",
19
+ }
20
+
21
+ export type ImbricateDocumentQueryPropertyFilterCondition = {
22
+
23
+ readonly target: IMBRICATE_QUERY_PROPERTY_CONDITION_TARGET;
24
+ readonly condition: IMBRICATE_QUERY_COMPARE_CONDITION;
25
+ readonly value: any;
26
+ };
27
+
28
+ export type ImbricateDocumentQueryPropertyFilter = {
29
+
30
+ readonly propertyIdentifier: string;
31
+ readonly conditions: ImbricateDocumentQueryPropertyFilterCondition[];
32
+ };
33
+
34
+ export type ImbricateDocumentQueryAnnotationFilter = {
35
+
36
+ readonly namespace: string;
37
+ readonly identifier: string;
38
+ readonly condition: IMBRICATE_QUERY_COMPARE_CONDITION;
39
+ readonly value: any;
40
+ };
41
+
8
42
  /**
9
43
  * Query of the document
10
- *
44
+ *
11
45
  * @param limit limit of the query
12
46
  * @param skip skip of the query
13
47
  */
14
48
  export type ImbricateDocumentQuery = {
49
+
15
50
  readonly limit?: number;
16
51
  readonly skip?: number;
52
+
53
+ readonly propertyFilters?: ImbricateDocumentQueryPropertyFilter[];
54
+ readonly annotationFilters?: ImbricateDocumentQueryAnnotationFilter[];
17
55
  };
56
+
18
57
  /**
19
58
  * Edit record type of the document
20
59
  */
21
- export declare enum IMBRICATE_DATABASE_EDIT_TYPE {
60
+ export enum IMBRICATE_DATABASE_EDIT_TYPE {
61
+
22
62
  PUT_SCHEMA = "PUT_SCHEMA",
23
63
  PUT_ANNOTATION = "PUT_ANNOTATION",
24
- DELETE_ANNOTATION = "DELETE_ANNOTATION"
64
+ DELETE_ANNOTATION = "DELETE_ANNOTATION",
25
65
  }
66
+
26
67
  export type DatabaseEditOperationPutAnnotation = {
68
+
27
69
  readonly annotationNamespace: string;
28
70
  readonly annotationIdentifier: string;
71
+
29
72
  readonly data: any;
30
73
  };
74
+
31
75
  export type DatabaseEditOperationDeleteAnnotation = {
76
+
32
77
  readonly annotationNamespace: string;
33
78
  readonly annotationIdentifier: string;
34
79
  };
35
- export type DatabaseEditOperationValue<T extends IMBRICATE_DATABASE_EDIT_TYPE> = T extends IMBRICATE_DATABASE_EDIT_TYPE.PUT_SCHEMA ? ImbricateDatabaseSchema : T extends IMBRICATE_DATABASE_EDIT_TYPE.PUT_ANNOTATION ? DatabaseEditOperationPutAnnotation : T extends IMBRICATE_DATABASE_EDIT_TYPE.DELETE_ANNOTATION ? DatabaseEditOperationDeleteAnnotation : never;
80
+
81
+ // IMBRICATE_DATABASE_EDIT_TYPE SWITCH
82
+ export type DatabaseEditOperationValue<T extends IMBRICATE_DATABASE_EDIT_TYPE> =
83
+ T extends IMBRICATE_DATABASE_EDIT_TYPE.PUT_SCHEMA ? ImbricateDatabaseSchema :
84
+ T extends IMBRICATE_DATABASE_EDIT_TYPE.PUT_ANNOTATION ? DatabaseEditOperationPutAnnotation :
85
+ T extends IMBRICATE_DATABASE_EDIT_TYPE.DELETE_ANNOTATION ? DatabaseEditOperationDeleteAnnotation :
86
+ never;
87
+
36
88
  export type DatabaseEditOperation<T extends IMBRICATE_DATABASE_EDIT_TYPE> = {
89
+
37
90
  readonly action: T;
38
91
  readonly value: DatabaseEditOperationValue<T>;
39
92
  };
93
+
40
94
  export type DatabaseEditRecord = {
95
+
41
96
  readonly uniqueIdentifier: string;
42
97
  readonly editAt: Date;
98
+
43
99
  readonly operations: Array<DatabaseEditOperation<IMBRICATE_DATABASE_EDIT_TYPE>>;
100
+
44
101
  readonly author?: ImbricateAuthor;
45
102
  };
103
+
46
104
  export type DatabaseAnnotations = Record<DatabaseAnnotationKey, DatabaseAnnotationValue>;
105
+
47
106
  export type DatabaseAnnotationKey = string;
48
107
  export type DatabaseAnnotationValue = {
108
+
49
109
  readonly namespace: string;
50
110
  readonly identifier: string;
111
+
51
112
  readonly data: any;
52
113
  };
114
+
53
115
  export type ImbricateDatabaseAuditOptions = {
116
+
54
117
  /**
55
118
  * Do not add edit record, this is controlled an function may vary by origin
56
119
  */
@@ -3,120 +3,162 @@
3
3
  * @namespace Database
4
4
  * @description Interface
5
5
  */
6
+
6
7
  import { IImbricateDocument } from "../document/interface";
7
8
  import { DocumentProperties } from "../document/property";
8
9
  import { DatabaseAnnotationValue, DatabaseAnnotations, DatabaseEditRecord, ImbricateDatabaseAuditOptions, ImbricateDocumentQuery } from "./definition";
9
10
  import { ImbricateDatabaseSchema } from "./schema";
11
+
10
12
  export interface IImbricateDatabase {
13
+
11
14
  /**
12
15
  * Unique identifier of the database
13
16
  */
14
17
  readonly uniqueIdentifier: string;
18
+
15
19
  /**
16
20
  * Name of the database
17
21
  */
18
22
  readonly databaseName: string;
23
+
19
24
  /**
20
25
  * Schema of the database
21
26
  */
22
27
  readonly schema: ImbricateDatabaseSchema;
28
+
23
29
  /**
24
30
  * Annotations of the database
25
31
  */
26
32
  readonly annotations: DatabaseAnnotations;
33
+
27
34
  /**
28
35
  * Put and replace the schema of the database
29
36
  * Existing documents will still be kept, and stays unchanged
30
- *
37
+ *
31
38
  * @param schema schema of the database
32
- * @param auditOptions audit options of the database
33
- *
39
+ * @param auditOptions audit options of the database
40
+ *
34
41
  * @returns a promise of the edit records of the database
35
42
  * Note: if the origin supports Document Edit Record, the edit record will be added by default
36
43
  * If you do not want to add the edit record, set `noEditRecord` to true
37
44
  */
38
- putSchema(schema: ImbricateDatabaseSchema, auditOptions?: ImbricateDatabaseAuditOptions): PromiseLike<DatabaseEditRecord[]>;
45
+ putSchema(
46
+ schema: ImbricateDatabaseSchema,
47
+ auditOptions?: ImbricateDatabaseAuditOptions,
48
+ ): PromiseLike<DatabaseEditRecord[]>;
49
+
39
50
  /**
40
51
  * Create a new document in the database
41
52
  * If origin supports Document Edit Record, the edit record will be added by default
42
- *
53
+ *
43
54
  * @param properties properties of the document
44
55
  * @param auditOptions audit options of the document
45
- *
56
+ *
46
57
  * @returns a promise of the created document
47
58
  */
48
- createDocument(properties: DocumentProperties, auditOptions?: ImbricateDatabaseAuditOptions): PromiseLike<IImbricateDocument>;
59
+ createDocument(
60
+ properties: DocumentProperties,
61
+ auditOptions?: ImbricateDatabaseAuditOptions,
62
+ ): PromiseLike<IImbricateDocument>;
63
+
49
64
  /**
50
65
  * Get one document from the database
51
- *
66
+ *
52
67
  * @param uniqueIdentifier unique identifier of the document
53
- *
68
+ *
54
69
  * @returns a promise of the documents in the database, null if not found
55
70
  */
56
- getDocument(uniqueIdentifier: string): PromiseLike<IImbricateDocument | null>;
71
+ getDocument(
72
+ uniqueIdentifier: string,
73
+ ): PromiseLike<IImbricateDocument | null>;
74
+
57
75
  /**
58
76
  * Query documents from the database
59
- *
77
+ *
60
78
  * @param query query of the documents
61
- *
79
+ *
62
80
  * @returns a promise of the documents in the database
63
81
  */
64
- queryDocuments(query: ImbricateDocumentQuery): PromiseLike<IImbricateDocument[]>;
82
+ queryDocuments(
83
+ query: ImbricateDocumentQuery,
84
+ ): PromiseLike<IImbricateDocument[]>;
85
+
65
86
  /**
66
87
  * Count documents in the database
67
- *
88
+ *
68
89
  * @param query query of the documents
69
- *
90
+ *
70
91
  * @returns a promise of the count of the documents in the database
71
92
  */
72
- countDocuments(query: ImbricateDocumentQuery): PromiseLike<number>;
93
+ countDocuments(
94
+ query: ImbricateDocumentQuery,
95
+ ): PromiseLike<number>;
96
+
73
97
  /**
74
98
  * Remove a document from the database
75
- *
99
+ *
76
100
  * @param uniqueIdentifier unique identifier of the document
77
101
  * @param auditOptions audit options of the document
78
102
  */
79
- removeDocument(uniqueIdentifier: string, auditOptions?: ImbricateDatabaseAuditOptions): PromiseLike<void>;
103
+ removeDocument(
104
+ uniqueIdentifier: string,
105
+ auditOptions?: ImbricateDatabaseAuditOptions,
106
+ ): PromiseLike<void>;
107
+
80
108
  /**
81
109
  * put annotation to the database
82
- *
110
+ *
83
111
  * @param namespace namespace of the annotation
84
112
  * @param identifier identifier of the annotation
85
113
  * @param value value of the annotation
86
114
  * @param auditOptions audit options of the database
87
- *
115
+ *
88
116
  * @returns a promise of the edit records of the database
89
117
  * Note: if the origin supports Document Edit Record, the edit record will be added by default
90
118
  * If you do not want to add the edit record, set `noEditRecord` to true in audit options
91
119
  */
92
- putAnnotation(namespace: string, identifier: string, value: DatabaseAnnotationValue, auditOptions?: ImbricateDatabaseAuditOptions): PromiseLike<DatabaseEditRecord[]>;
120
+ putAnnotation(
121
+ namespace: string,
122
+ identifier: string,
123
+ value: DatabaseAnnotationValue,
124
+ auditOptions?: ImbricateDatabaseAuditOptions,
125
+ ): PromiseLike<DatabaseEditRecord[]>;
126
+
93
127
  /**
94
128
  * Delete annotation from the database
95
- *
129
+ *
96
130
  * @param namespace namespace of the annotation
97
131
  * @param identifier identifier of the annotation
98
132
  * @param auditOptions audit options of the database
99
- *
133
+ *
100
134
  * @returns a promise of the edit records of the database
101
135
  * Note: if the origin supports Document Edit Record, the edit record will be added by default
102
136
  * If you do not want to add the edit record, set `noEditRecord` to true in audit options
103
137
  */
104
- deleteAnnotation(namespace: string, identifier: string, auditOptions?: ImbricateDatabaseAuditOptions): PromiseLike<DatabaseEditRecord[]>;
138
+ deleteAnnotation(
139
+ namespace: string,
140
+ identifier: string,
141
+ auditOptions?: ImbricateDatabaseAuditOptions,
142
+ ): PromiseLike<DatabaseEditRecord[]>;
143
+
105
144
  /**
106
145
  * Add edit records to the database, optional
107
146
  * This method is optional, if not implemented, means the origin
108
147
  * 1. The origin does not support edit records
109
148
  * 2. The origin force to add edit records when put properties
110
- *
149
+ *
111
150
  * @param records database edit records
112
151
  */
113
- addEditRecords?(records: DatabaseEditRecord[]): PromiseLike<void>;
152
+ addEditRecords?(
153
+ records: DatabaseEditRecord[],
154
+ ): PromiseLike<void>;
155
+
114
156
  /**
115
157
  * Get edit records of the database, optional
116
158
  * This method is optional, if not implemented, means the origin
117
159
  * 1. The origin does not support edit records
118
160
  * 2. The origin force to add edit records when put properties
119
- *
161
+ *
120
162
  * @returns a promise of the edit records of the database
121
163
  */
122
164
  getEditRecords?(): PromiseLike<DatabaseEditRecord[]>;
@@ -3,39 +3,54 @@
3
3
  * @namespace Database
4
4
  * @description Manager
5
5
  */
6
+
6
7
  import { ImbricateDatabaseAuditOptions } from "./definition";
7
8
  import { IImbricateDatabase } from "./interface";
8
9
  import { ImbricateDatabaseSchemaForCreation } from "./schema";
10
+
9
11
  export interface IImbricateDatabaseManager {
12
+
10
13
  /**
11
14
  * List all databases in the origin
12
- *
15
+ *
13
16
  * @returns a promise of the databases in the origin
14
17
  */
15
18
  listDatabases(): PromiseLike<IImbricateDatabase[]>;
19
+
16
20
  /**
17
21
  * Get one database from the origin
18
- *
22
+ *
19
23
  * @param uniqueIdentifier unique identifier of the database
20
- *
24
+ *
21
25
  * @returns a promise of the database, null if not found
22
26
  */
23
- getDatabase(uniqueIdentifier: string): PromiseLike<IImbricateDatabase | null>;
27
+ getDatabase(
28
+ uniqueIdentifier: string,
29
+ ): PromiseLike<IImbricateDatabase | null>;
30
+
24
31
  /**
25
32
  * Create a new database
26
- *
33
+ *
27
34
  * @param databaseName name of the database
28
35
  * @param schema schema of the database
29
36
  * @param auditOptions audit options of the database
30
- *
37
+ *
31
38
  * @returns a promise of the created database
32
39
  */
33
- createDatabase(databaseName: string, schema: ImbricateDatabaseSchemaForCreation, auditOptions?: ImbricateDatabaseAuditOptions): PromiseLike<IImbricateDatabase>;
40
+ createDatabase(
41
+ databaseName: string,
42
+ schema: ImbricateDatabaseSchemaForCreation,
43
+ auditOptions?: ImbricateDatabaseAuditOptions,
44
+ ): PromiseLike<IImbricateDatabase>;
45
+
34
46
  /**
35
47
  * Remove a database from the origin
36
- *
48
+ *
37
49
  * @param uniqueIdentifier unique identifier of the database
38
50
  * @param auditOptions audit options of deletion
39
51
  */
40
- removeDatabase(uniqueIdentifier: string, auditOptions?: ImbricateDatabaseAuditOptions): PromiseLike<void>;
52
+ removeDatabase(
53
+ uniqueIdentifier: string,
54
+ auditOptions?: ImbricateDatabaseAuditOptions,
55
+ ): PromiseLike<void>;
41
56
  }