@imbricate/core 3.2.1 → 3.3.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.
- package/database/schema.d.ts +14 -2
- package/document/property.d.ts +11 -1
- package/document/property.js +10 -0
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/origin/interface.d.ts +8 -0
- package/origin/search.d.ts +33 -0
- package/origin/search.js +14 -0
- package/package.json +1 -1
package/database/schema.d.ts
CHANGED
|
@@ -11,7 +11,18 @@ export type ImbricateDatabaseSchemaPropertyOptionsReferenceDatabase = {
|
|
|
11
11
|
readonly originUniqueIdentifier: string;
|
|
12
12
|
readonly databaseUniqueIdentifier: string;
|
|
13
13
|
};
|
|
14
|
-
export type
|
|
14
|
+
export type ImbricateDatabaseSchemaPropertyOptionsLabelOption = {
|
|
15
|
+
readonly labelIdentifier: string;
|
|
16
|
+
readonly labelName: string;
|
|
17
|
+
};
|
|
18
|
+
export type ImbricateDatabaseSchemaPropertyOptionsLabel = {
|
|
19
|
+
/**
|
|
20
|
+
* Allow multiple labels
|
|
21
|
+
*/
|
|
22
|
+
readonly allowMultiple: boolean;
|
|
23
|
+
readonly labelOptions: ImbricateDatabaseSchemaPropertyOptionsLabelOption[];
|
|
24
|
+
};
|
|
25
|
+
export type ImbricateDatabaseSchemaPropertyOptionsReference = {
|
|
15
26
|
/**
|
|
16
27
|
* Allow multiple references
|
|
17
28
|
*/
|
|
@@ -21,7 +32,8 @@ export type ImbricateDatabaseSchemaPropertyOptions<T extends IMBRICATE_PROPERTY_
|
|
|
21
32
|
* If empty, allow references from all databases
|
|
22
33
|
*/
|
|
23
34
|
readonly databases: ImbricateDatabaseSchemaPropertyOptionsReferenceDatabase[];
|
|
24
|
-
}
|
|
35
|
+
};
|
|
36
|
+
export type ImbricateDatabaseSchemaPropertyOptions<T extends IMBRICATE_PROPERTY_TYPE> = T extends IMBRICATE_PROPERTY_TYPE.BOOLEAN ? {} : T extends IMBRICATE_PROPERTY_TYPE.STRING ? {} : T extends IMBRICATE_PROPERTY_TYPE.NUMBER ? {} : T extends IMBRICATE_PROPERTY_TYPE.MARKDOWN ? {} : T extends IMBRICATE_PROPERTY_TYPE.DATE ? {} : T extends IMBRICATE_PROPERTY_TYPE.LABEL ? ImbricateDatabaseSchemaPropertyOptionsLabel : T extends IMBRICATE_PROPERTY_TYPE.REFERENCE ? ImbricateDatabaseSchemaPropertyOptionsReference : never;
|
|
25
37
|
export type ImbricateDatabaseSchemaPropertyForCreation<T extends IMBRICATE_PROPERTY_TYPE> = {
|
|
26
38
|
readonly propertyName: string;
|
|
27
39
|
readonly propertyType: T;
|
package/document/property.d.ts
CHANGED
|
@@ -23,6 +23,16 @@ export declare enum IMBRICATE_PROPERTY_TYPE {
|
|
|
23
23
|
* MARKDOWN - markdown, store as text object unique identifier. Display as markdown
|
|
24
24
|
*/
|
|
25
25
|
MARKDOWN = "MARKDOWN",
|
|
26
|
+
/**
|
|
27
|
+
* DATE - date, store as string in ISO format
|
|
28
|
+
* For example - 2000-01-01T00:00:00.000Z
|
|
29
|
+
*/
|
|
30
|
+
DATE = "DATE",
|
|
31
|
+
/**
|
|
32
|
+
* LABEL - label, store as a list of label id
|
|
33
|
+
* Note: Label is always stored as an array, even if it is a single label
|
|
34
|
+
*/
|
|
35
|
+
LABEL = "LABEL",
|
|
26
36
|
/**
|
|
27
37
|
* REFERENCE - reference, store as a list of other document unique identifier
|
|
28
38
|
* Note: Reference is always stored as an array, even if it is a single reference
|
|
@@ -49,7 +59,7 @@ export type DocumentPropertyValueObjectReference = {
|
|
|
49
59
|
readonly databaseUniqueIdentifier: string;
|
|
50
60
|
readonly documentUniqueIdentifier: string;
|
|
51
61
|
};
|
|
52
|
-
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.REFERENCE ? DocumentPropertyValueObjectReference[] : never;
|
|
62
|
+
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.DATE ? string : T extends IMBRICATE_PROPERTY_TYPE.LABEL ? string[] : T extends IMBRICATE_PROPERTY_TYPE.REFERENCE ? DocumentPropertyValueObjectReference[] : never;
|
|
53
63
|
/**
|
|
54
64
|
* Edit record type of the document
|
|
55
65
|
*/
|
package/document/property.js
CHANGED
|
@@ -27,6 +27,16 @@ var IMBRICATE_PROPERTY_TYPE;
|
|
|
27
27
|
* MARKDOWN - markdown, store as text object unique identifier. Display as markdown
|
|
28
28
|
*/
|
|
29
29
|
IMBRICATE_PROPERTY_TYPE["MARKDOWN"] = "MARKDOWN";
|
|
30
|
+
/**
|
|
31
|
+
* DATE - date, store as string in ISO format
|
|
32
|
+
* For example - 2000-01-01T00:00:00.000Z
|
|
33
|
+
*/
|
|
34
|
+
IMBRICATE_PROPERTY_TYPE["DATE"] = "DATE";
|
|
35
|
+
/**
|
|
36
|
+
* LABEL - label, store as a list of label id
|
|
37
|
+
* Note: Label is always stored as an array, even if it is a single label
|
|
38
|
+
*/
|
|
39
|
+
IMBRICATE_PROPERTY_TYPE["LABEL"] = "LABEL";
|
|
30
40
|
/**
|
|
31
41
|
* REFERENCE - reference, store as a list of other document unique identifier
|
|
32
42
|
* Note: Reference is always stored as an array, even if it is a single reference
|
package/index.d.ts
CHANGED
|
@@ -19,6 +19,7 @@ export * from "./loader/origin-loader";
|
|
|
19
19
|
export * from "./loader/persistence";
|
|
20
20
|
export * from "./origin/definition";
|
|
21
21
|
export * from "./origin/interface";
|
|
22
|
+
export * from "./origin/search";
|
|
22
23
|
export * from "./static/interface";
|
|
23
24
|
export * from "./static/manager";
|
|
24
25
|
export * from "./text/interface";
|
package/index.js
CHANGED
|
@@ -35,6 +35,7 @@ __exportStar(require("./loader/origin-loader"), exports);
|
|
|
35
35
|
__exportStar(require("./loader/persistence"), exports);
|
|
36
36
|
__exportStar(require("./origin/definition"), exports);
|
|
37
37
|
__exportStar(require("./origin/interface"), exports);
|
|
38
|
+
__exportStar(require("./origin/search"), exports);
|
|
38
39
|
__exportStar(require("./static/interface"), exports);
|
|
39
40
|
__exportStar(require("./static/manager"), exports);
|
|
40
41
|
__exportStar(require("./text/interface"), exports);
|
package/origin/interface.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ import { IImbricateDatabaseManager } from "../database/manager";
|
|
|
7
7
|
import { IImbricateStaticManager } from "../static/manager";
|
|
8
8
|
import { IImbricateTextManager } from "../text/manager";
|
|
9
9
|
import { OriginPayload } from "./definition";
|
|
10
|
+
import { ImbricateSearchResult } from "./search";
|
|
10
11
|
export interface IImbricateOrigin {
|
|
11
12
|
/**
|
|
12
13
|
* Unique identifier of the origin
|
|
@@ -46,4 +47,11 @@ export interface IImbricateOrigin {
|
|
|
46
47
|
* Example: close database connection, or close file system
|
|
47
48
|
*/
|
|
48
49
|
dispose?(): PromiseLike<void>;
|
|
50
|
+
/**
|
|
51
|
+
* Search for items in the origin
|
|
52
|
+
*
|
|
53
|
+
* @param keyword the keyword to search
|
|
54
|
+
* @returns the search
|
|
55
|
+
*/
|
|
56
|
+
search(keyword: string): PromiseLike<ImbricateSearchResult>;
|
|
49
57
|
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author WMXPY
|
|
3
|
+
* @namespace Origin
|
|
4
|
+
* @description Search
|
|
5
|
+
*/
|
|
6
|
+
export declare enum IMBRICATE_SEARCH_TARGET_TYPE {
|
|
7
|
+
DATABASE = "DATABASE",
|
|
8
|
+
DOCUMENT = "DOCUMENT",
|
|
9
|
+
MARKDOWN = "MARKDOWN"
|
|
10
|
+
}
|
|
11
|
+
export type ImbricateSearchTargetSwitch<T extends IMBRICATE_SEARCH_TARGET_TYPE> = T extends IMBRICATE_SEARCH_TARGET_TYPE.DATABASE ? {
|
|
12
|
+
databaseUniqueIdentifier: string;
|
|
13
|
+
} : T extends IMBRICATE_SEARCH_TARGET_TYPE.DOCUMENT ? {
|
|
14
|
+
databaseUniqueIdentifier: string;
|
|
15
|
+
documentUniqueIdentifier: string;
|
|
16
|
+
} : T extends IMBRICATE_SEARCH_TARGET_TYPE.MARKDOWN ? {
|
|
17
|
+
databaseUniqueIdentifier: string;
|
|
18
|
+
documentUniqueIdentifier: string;
|
|
19
|
+
propertyUniqueIdentifier: string;
|
|
20
|
+
lineNumber: number;
|
|
21
|
+
} : never;
|
|
22
|
+
export type ImbricateSearchTarget<T extends IMBRICATE_SEARCH_TARGET_TYPE> = {
|
|
23
|
+
readonly type: T;
|
|
24
|
+
readonly target: ImbricateSearchTargetSwitch<T>;
|
|
25
|
+
};
|
|
26
|
+
export type ImbricateSearchItem = {
|
|
27
|
+
readonly target: ImbricateSearchTarget<IMBRICATE_SEARCH_TARGET_TYPE>;
|
|
28
|
+
readonly primary: string;
|
|
29
|
+
readonly secondary: string;
|
|
30
|
+
};
|
|
31
|
+
export type ImbricateSearchResult = {
|
|
32
|
+
readonly items: ImbricateSearchItem[];
|
|
33
|
+
};
|
package/origin/search.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @author WMXPY
|
|
4
|
+
* @namespace Origin
|
|
5
|
+
* @description Search
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.IMBRICATE_SEARCH_TARGET_TYPE = void 0;
|
|
9
|
+
var IMBRICATE_SEARCH_TARGET_TYPE;
|
|
10
|
+
(function (IMBRICATE_SEARCH_TARGET_TYPE) {
|
|
11
|
+
IMBRICATE_SEARCH_TARGET_TYPE["DATABASE"] = "DATABASE";
|
|
12
|
+
IMBRICATE_SEARCH_TARGET_TYPE["DOCUMENT"] = "DOCUMENT";
|
|
13
|
+
IMBRICATE_SEARCH_TARGET_TYPE["MARKDOWN"] = "MARKDOWN";
|
|
14
|
+
})(IMBRICATE_SEARCH_TARGET_TYPE || (exports.IMBRICATE_SEARCH_TARGET_TYPE = IMBRICATE_SEARCH_TARGET_TYPE = {}));
|