@imbricate/core 3.7.3 → 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.
- package/.editorconfig +10 -0
- package/.gitattributes +4 -0
- package/.github/dependabot.yml +8 -0
- package/.github/workflows/ci.yml +48 -0
- package/.vscode/settings.json +8 -0
- package/.yarn/releases/yarn-4.4.0.cjs +925 -0
- package/.yarnrc.yml +3 -0
- package/babel.config.js +14 -0
- package/docs/README.md +70 -0
- package/eslint.config.mjs +64 -0
- package/jest.config.ts +14 -0
- package/package.json +27 -3
- package/{author/definition.d.ts → src/author/definition.ts} +4 -0
- package/{database/definition.d.ts → src/database/definition.ts} +67 -4
- package/{database/interface.d.ts → src/database/interface.ts} +69 -27
- package/{database/manager.d.ts → src/database/manager.ts} +24 -9
- package/src/database/schema.ts +165 -0
- package/src/database/validate.ts +77 -0
- package/{document/definition.d.ts → src/document/definition.ts} +31 -3
- package/{document/interface.d.ts → src/document/interface.ts} +44 -15
- package/src/document/property/default-value.ts +26 -0
- package/{document/property/definition.d.ts → src/document/property/definition.ts} +6 -1
- package/src/document/property/primary.ts +29 -0
- package/src/document/property/triage-base.ts +138 -0
- package/src/document/property/triage-manager.ts +68 -0
- package/src/document/property/triage.ts +15 -0
- package/{document/property.d.ts → src/document/property.ts} +23 -4
- package/{document/validate.js → src/document/validate.ts} +33 -21
- package/{index.d.ts → src/index.ts} +3 -0
- package/{loader/definition.d.ts → src/loader/definition.ts} +5 -1
- package/src/loader/origin-loader.ts +88 -0
- package/{loader/persistence.d.ts → src/loader/persistence.ts} +12 -3
- package/{origin/definition.d.ts → src/origin/definition.ts} +1 -0
- package/{origin/interface.d.ts → src/origin/interface.ts} +18 -7
- package/{origin/search.d.ts → src/origin/search.ts} +29 -13
- package/{static/definition.d.ts → src/static/definition.ts} +3 -0
- package/{static/interface.d.ts → src/static/interface.ts} +6 -1
- package/{static/manager.d.ts → src/static/manager.ts} +11 -4
- package/{text/definition.d.ts → src/text/definition.ts} +3 -0
- package/{text/interface.d.ts → src/text/interface.ts} +6 -1
- package/{text/manager.d.ts → src/text/manager.ts} +11 -4
- package/test/unit/database/schema.test.ts +95 -0
- package/test/unit/document/property/primary.test.ts +87 -0
- package/test/unit/document/property/triage.test.ts +64 -0
- package/test/unit/document/validate.test.ts +138 -0
- package/test/unit/loader/definition.test.ts +55 -0
- package/typescript/tsconfig.build.json +23 -0
- package/author/definition.js +0 -7
- package/database/definition.js +0 -17
- package/database/interface.js +0 -7
- package/database/manager.js +0 -7
- package/database/schema.d.ts +0 -70
- package/database/schema.js +0 -78
- package/document/definition.js +0 -17
- package/document/interface.js +0 -7
- package/document/property/default-value.d.ts +0 -7
- package/document/property/default-value.js +0 -25
- package/document/property/definition.js +0 -7
- package/document/property/primary.d.ts +0 -8
- package/document/property/primary.js +0 -20
- package/document/property/triage-base.d.ts +0 -31
- package/document/property/triage-base.js +0 -85
- package/document/property/triage-manager.d.ts +0 -30
- package/document/property/triage-manager.js +0 -50
- package/document/property/triage.d.ts +0 -8
- package/document/property/triage.js +0 -13
- package/document/property.js +0 -54
- package/document/validate.d.ts +0 -18
- package/index.js +0 -46
- package/loader/definition.js +0 -7
- package/loader/origin-loader.d.ts +0 -29
- package/loader/origin-loader.js +0 -104
- package/loader/persistence.js +0 -19
- package/origin/definition.js +0 -7
- package/origin/interface.js +0 -7
- package/origin/search.js +0 -14
- package/static/definition.js +0 -7
- package/static/interface.js +0 -7
- package/static/manager.js +0 -7
- package/text/definition.js +0 -7
- package/text/interface.js +0 -7
- package/text/manager.js +0 -7
package/.yarnrc.yml
ADDED
package/babel.config.js
ADDED
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
|
+
[](https://github.com/Imbricate/Imbricate/actions/workflows/ci.yml)
|
|
12
|
+
[](https://codecov.io/gh/Imbricate/Imbricate)
|
|
13
|
+
[](https://badge.fury.io/js/%40imbricate%2Fcore)
|
|
14
|
+
[](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
package/package.json
CHANGED
|
@@ -1,8 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@imbricate/core",
|
|
3
|
-
"
|
|
4
|
-
"version": "3.
|
|
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,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
|
|
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
|
-
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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?(
|
|
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(
|
|
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(
|
|
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(
|
|
52
|
+
removeDatabase(
|
|
53
|
+
uniqueIdentifier: string,
|
|
54
|
+
auditOptions?: ImbricateDatabaseAuditOptions,
|
|
55
|
+
): PromiseLike<void>;
|
|
41
56
|
}
|