@imbricate/core 1.34.2 → 2.1.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/collection/base.d.ts +3 -2
- package/collection/interface.d.ts +3 -2
- package/executable-manager/base.d.ts +20 -0
- package/executable-manager/base.js +30 -0
- package/executable-manager/definition.d.ts +12 -0
- package/executable-manager/definition.js +17 -0
- package/executable-manager/interface.d.ts +36 -0
- package/executable-manager/interface.js +7 -0
- package/execute/definition.d.ts +0 -6
- package/execute/definition.js +1 -14
- package/index.d.ts +6 -1
- package/index.js +6 -1
- package/package.json +1 -1
- package/page/base.d.ts +3 -2
- package/page/definition.d.ts +5 -9
- package/page/definition.js +1 -14
- package/page/interface.d.ts +28 -2
- package/page-variant/definition.d.ts +16 -0
- package/page-variant/definition.js +33 -0
- package/script/base.d.ts +2 -3
- package/script/base.js +0 -3
- package/script/definition.d.ts +5 -4
- package/script/interface.d.ts +27 -3
- package/script-manager/base.d.ts +2 -3
- package/script-manager/base.js +0 -3
- package/script-manager/interface.d.ts +10 -3
- package/script-variant/definition.d.ts +17 -0
- package/script-variant/definition.js +34 -0
- package/script-variant/extension.d.ts +7 -0
- package/script-variant/extension.js +23 -0
- package/execute/extension.d.ts +0 -7
- package/execute/extension.js +0 -23
package/collection/base.d.ts
CHANGED
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
import { ImbricateCapabilityBuilder } from "../capability/builder";
|
|
7
7
|
import { ImbricateCapability } from "../capability/definition";
|
|
8
8
|
import type { PromiseOr } from "../definition/promise";
|
|
9
|
-
import
|
|
9
|
+
import { ImbricatePageVariant } from "../page-variant/definition";
|
|
10
|
+
import type { ImbricatePageMetadata, ImbricatePageSearchResult, ImbricatePageSnapshot } from "../page/definition";
|
|
10
11
|
import type { IImbricatePage } from "../page/interface";
|
|
11
12
|
import type { ImbricatePageQuery, ImbricatePageQueryConfig, ImbricateSearchPageConfig } from "../query/page";
|
|
12
13
|
import { IMBRICATE_COLLECTION_CAPABILITY_KEY, ImbricateCollectionCapability } from "./definition";
|
|
@@ -18,7 +19,7 @@ export declare abstract class ImbricateCollectionBase implements IImbricateColle
|
|
|
18
19
|
abstract readonly collectionName: string;
|
|
19
20
|
abstract readonly uniqueIdentifier: string;
|
|
20
21
|
abstract readonly capabilities: ImbricateCollectionCapability;
|
|
21
|
-
createPage(_directories: string[], _title: string, _variant:
|
|
22
|
+
createPage(_directories: string[], _title: string, _variant: ImbricatePageVariant, _initialContent: string, _description?: string): PromiseOr<IImbricatePage>;
|
|
22
23
|
putPage(_pageMetadata: ImbricatePageMetadata, _content: string): PromiseOr<IImbricatePage>;
|
|
23
24
|
retitlePage(_identifier: string, _newTitle: string): PromiseOr<void>;
|
|
24
25
|
deletePage(_identifier: string): PromiseOr<void>;
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
* @description Interface
|
|
5
5
|
*/
|
|
6
6
|
import type { PromiseOr } from "../definition/promise";
|
|
7
|
-
import
|
|
7
|
+
import { ImbricatePageVariant } from "../page-variant/definition";
|
|
8
|
+
import type { ImbricatePageMetadata, ImbricatePageSearchResult, ImbricatePageSnapshot } from "../page/definition";
|
|
8
9
|
import type { IImbricatePage } from "../page/interface";
|
|
9
10
|
import type { ImbricatePageQuery, ImbricatePageQueryConfig, ImbricateSearchPageConfig } from "../query/page";
|
|
10
11
|
import type { ImbricateCollectionCapability } from "./definition";
|
|
@@ -13,7 +14,7 @@ export interface IImbricateCollection {
|
|
|
13
14
|
readonly uniqueIdentifier: string;
|
|
14
15
|
readonly description?: string;
|
|
15
16
|
readonly capabilities: ImbricateCollectionCapability;
|
|
16
|
-
createPage(directories: string[], title: string, variant:
|
|
17
|
+
createPage(directories: string[], title: string, variant: ImbricatePageVariant, initialContent: string, description?: string): PromiseOr<IImbricatePage>;
|
|
17
18
|
putPage(pageMetadata: ImbricatePageMetadata, content: string): PromiseOr<IImbricatePage>;
|
|
18
19
|
retitlePage(identifier: string, newTitle: string): PromiseOr<void>;
|
|
19
20
|
deletePage(identifier: string): PromiseOr<void>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author WMXPY
|
|
3
|
+
* @namespace ExecutableManager
|
|
4
|
+
* @description Base
|
|
5
|
+
*/
|
|
6
|
+
import { ImbricateCapabilityBuilder } from "../capability/builder";
|
|
7
|
+
import { ImbricateCapability } from "../capability/definition";
|
|
8
|
+
import { ImbricateExecuteEnvironment, ImbricateExecuteParameters, ImbricateExecuteResult } from "../execute/definition";
|
|
9
|
+
import { ImbricateScriptVariant } from "../script-variant/definition";
|
|
10
|
+
import { IImbricateScript } from "../script/interface";
|
|
11
|
+
import { IMBRICATE_EXECUTABLE_MANAGER_CAPABILITY_KEY, ImbricateExecutableManagerCapability } from "./definition";
|
|
12
|
+
import { IImbricateExecutableManager } from "./interface";
|
|
13
|
+
export declare abstract class ImbricateExecutableManagerBase implements IImbricateExecutableManager {
|
|
14
|
+
static buildCapability(initial?: ImbricateCapability): ImbricateCapabilityBuilder<IMBRICATE_EXECUTABLE_MANAGER_CAPABILITY_KEY>;
|
|
15
|
+
static allAllowCapability(): ImbricateExecutableManagerCapability;
|
|
16
|
+
static allDenyCapability(): ImbricateExecutableManagerCapability;
|
|
17
|
+
abstract readonly capabilities: ImbricateExecutableManagerCapability;
|
|
18
|
+
executeScript(_script: IImbricateScript, _parameters: ImbricateExecuteParameters, _environment: ImbricateExecuteEnvironment): Promise<ImbricateExecuteResult>;
|
|
19
|
+
executeSnippet(_snippet: string, _variant: ImbricateScriptVariant, _parameters: ImbricateExecuteParameters, _environment: ImbricateExecuteEnvironment): Promise<ImbricateExecuteResult>;
|
|
20
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @author WMXPY
|
|
4
|
+
* @namespace ExecutableManager
|
|
5
|
+
* @description Base
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.ImbricateExecutableManagerBase = void 0;
|
|
9
|
+
const builder_1 = require("../capability/builder");
|
|
10
|
+
const definition_1 = require("../capability/definition");
|
|
11
|
+
const not_implemented_1 = require("../error/not-implemented");
|
|
12
|
+
const definition_2 = require("./definition");
|
|
13
|
+
class ImbricateExecutableManagerBase {
|
|
14
|
+
static buildCapability(initial = (0, definition_1.createDenyImbricateCapability)()) {
|
|
15
|
+
return builder_1.ImbricateCapabilityBuilder.create(definition_2.ImbricateExecutableManagerCapabilityList, initial);
|
|
16
|
+
}
|
|
17
|
+
static allAllowCapability() {
|
|
18
|
+
return this.buildCapability((0, definition_1.createAllowImbricateCapability)()).build();
|
|
19
|
+
}
|
|
20
|
+
static allDenyCapability() {
|
|
21
|
+
return this.buildCapability((0, definition_1.createDenyImbricateCapability)()).build();
|
|
22
|
+
}
|
|
23
|
+
executeScript(_script, _parameters, _environment) {
|
|
24
|
+
throw not_implemented_1.ImbricateNotImplemented.create("ExecuteScript", definition_2.IMBRICATE_EXECUTABLE_MANAGER_CAPABILITY_KEY.EXECUTE_SCRIPT);
|
|
25
|
+
}
|
|
26
|
+
executeSnippet(_snippet, _variant, _parameters, _environment) {
|
|
27
|
+
throw not_implemented_1.ImbricateNotImplemented.create("ExecuteSnippet", definition_2.IMBRICATE_EXECUTABLE_MANAGER_CAPABILITY_KEY.EXECUTE_SNIPPET);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.ImbricateExecutableManagerBase = ImbricateExecutableManagerBase;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author WMXPY
|
|
3
|
+
* @namespace ExecutableManager
|
|
4
|
+
* @description Definition
|
|
5
|
+
*/
|
|
6
|
+
import { ImbricateCapability } from "../capability/definition";
|
|
7
|
+
export type ImbricateExecutableManagerCapability = Record<IMBRICATE_EXECUTABLE_MANAGER_CAPABILITY_KEY, ImbricateCapability>;
|
|
8
|
+
export declare enum IMBRICATE_EXECUTABLE_MANAGER_CAPABILITY_KEY {
|
|
9
|
+
EXECUTE_SCRIPT = "imbricate.executable-manager.execute-script",
|
|
10
|
+
EXECUTE_SNIPPET = "imbricate.executable-manager.execute-snippet"
|
|
11
|
+
}
|
|
12
|
+
export declare const ImbricateExecutableManagerCapabilityList: IMBRICATE_EXECUTABLE_MANAGER_CAPABILITY_KEY[];
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @author WMXPY
|
|
4
|
+
* @namespace ExecutableManager
|
|
5
|
+
* @description Definition
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.ImbricateExecutableManagerCapabilityList = exports.IMBRICATE_EXECUTABLE_MANAGER_CAPABILITY_KEY = void 0;
|
|
9
|
+
var IMBRICATE_EXECUTABLE_MANAGER_CAPABILITY_KEY;
|
|
10
|
+
(function (IMBRICATE_EXECUTABLE_MANAGER_CAPABILITY_KEY) {
|
|
11
|
+
IMBRICATE_EXECUTABLE_MANAGER_CAPABILITY_KEY["EXECUTE_SCRIPT"] = "imbricate.executable-manager.execute-script";
|
|
12
|
+
IMBRICATE_EXECUTABLE_MANAGER_CAPABILITY_KEY["EXECUTE_SNIPPET"] = "imbricate.executable-manager.execute-snippet";
|
|
13
|
+
})(IMBRICATE_EXECUTABLE_MANAGER_CAPABILITY_KEY || (exports.IMBRICATE_EXECUTABLE_MANAGER_CAPABILITY_KEY = IMBRICATE_EXECUTABLE_MANAGER_CAPABILITY_KEY = {}));
|
|
14
|
+
exports.ImbricateExecutableManagerCapabilityList = [
|
|
15
|
+
IMBRICATE_EXECUTABLE_MANAGER_CAPABILITY_KEY.EXECUTE_SCRIPT,
|
|
16
|
+
IMBRICATE_EXECUTABLE_MANAGER_CAPABILITY_KEY.EXECUTE_SNIPPET,
|
|
17
|
+
];
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author WMXPY
|
|
3
|
+
* @namespace ExecutableManager
|
|
4
|
+
* @description Interface
|
|
5
|
+
*/
|
|
6
|
+
import { PromiseOr } from "../definition/promise";
|
|
7
|
+
import { ImbricateExecuteEnvironment, ImbricateExecuteParameters, ImbricateExecuteResult } from "../execute/definition";
|
|
8
|
+
import { ImbricateScriptVariant } from "../script-variant/definition";
|
|
9
|
+
import { IImbricateScript } from "../script/interface";
|
|
10
|
+
import { ImbricateExecutableManagerCapability } from "./definition";
|
|
11
|
+
export interface IImbricateExecutableManager {
|
|
12
|
+
/**
|
|
13
|
+
* Capabilities of the executable manager
|
|
14
|
+
*/
|
|
15
|
+
readonly capabilities: ImbricateExecutableManagerCapability;
|
|
16
|
+
/**
|
|
17
|
+
* Execute a script
|
|
18
|
+
*
|
|
19
|
+
* @param script
|
|
20
|
+
* @param parameters
|
|
21
|
+
* @param environment
|
|
22
|
+
*
|
|
23
|
+
* @returns result of the execution
|
|
24
|
+
*/
|
|
25
|
+
executeScript(script: IImbricateScript, parameters: ImbricateExecuteParameters, environment: ImbricateExecuteEnvironment): PromiseOr<ImbricateExecuteResult>;
|
|
26
|
+
/**
|
|
27
|
+
* Execute a snippet
|
|
28
|
+
*
|
|
29
|
+
* @param snippet
|
|
30
|
+
* @param parameters
|
|
31
|
+
* @param environment
|
|
32
|
+
*
|
|
33
|
+
* @returns result of the execution
|
|
34
|
+
*/
|
|
35
|
+
executeSnippet(snippet: string, variant: ImbricateScriptVariant, parameters: ImbricateExecuteParameters, environment: ImbricateExecuteEnvironment): PromiseOr<ImbricateExecuteResult>;
|
|
36
|
+
}
|
package/execute/definition.d.ts
CHANGED
|
@@ -3,12 +3,6 @@
|
|
|
3
3
|
* @namespace Execute
|
|
4
4
|
* @description Definition
|
|
5
5
|
*/
|
|
6
|
-
export declare enum IMBRICATE_EXECUTABLE_VARIANT {
|
|
7
|
-
JAVASCRIPT_NODE = "javascript-node",
|
|
8
|
-
TYPESCRIPT_NODE = "typescript-node"
|
|
9
|
-
}
|
|
10
|
-
export declare const IMBRICATE_SCRIPT_VARIANT_LIST: IMBRICATE_EXECUTABLE_VARIANT[];
|
|
11
|
-
export declare const isValidImbricateExecutableVariant: (variant: unknown) => variant is IMBRICATE_EXECUTABLE_VARIANT;
|
|
12
6
|
export declare enum IMBRICATE_EXECUTE_RESULT_CODE {
|
|
13
7
|
NOT_SUPPORT = "NOT_SUPPORT",
|
|
14
8
|
SUCCESS = "SUCCESS",
|
package/execute/definition.js
CHANGED
|
@@ -5,20 +5,7 @@
|
|
|
5
5
|
* @description Definition
|
|
6
6
|
*/
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.IMBRICATE_EXECUTE_RESULT_CODE =
|
|
9
|
-
var IMBRICATE_EXECUTABLE_VARIANT;
|
|
10
|
-
(function (IMBRICATE_EXECUTABLE_VARIANT) {
|
|
11
|
-
IMBRICATE_EXECUTABLE_VARIANT["JAVASCRIPT_NODE"] = "javascript-node";
|
|
12
|
-
IMBRICATE_EXECUTABLE_VARIANT["TYPESCRIPT_NODE"] = "typescript-node";
|
|
13
|
-
})(IMBRICATE_EXECUTABLE_VARIANT || (exports.IMBRICATE_EXECUTABLE_VARIANT = IMBRICATE_EXECUTABLE_VARIANT = {}));
|
|
14
|
-
exports.IMBRICATE_SCRIPT_VARIANT_LIST = [
|
|
15
|
-
IMBRICATE_EXECUTABLE_VARIANT.JAVASCRIPT_NODE,
|
|
16
|
-
IMBRICATE_EXECUTABLE_VARIANT.TYPESCRIPT_NODE,
|
|
17
|
-
];
|
|
18
|
-
const isValidImbricateExecutableVariant = (variant) => {
|
|
19
|
-
return exports.IMBRICATE_SCRIPT_VARIANT_LIST.includes(variant);
|
|
20
|
-
};
|
|
21
|
-
exports.isValidImbricateExecutableVariant = isValidImbricateExecutableVariant;
|
|
8
|
+
exports.IMBRICATE_EXECUTE_RESULT_CODE = void 0;
|
|
22
9
|
var IMBRICATE_EXECUTE_RESULT_CODE;
|
|
23
10
|
(function (IMBRICATE_EXECUTE_RESULT_CODE) {
|
|
24
11
|
IMBRICATE_EXECUTE_RESULT_CODE["NOT_SUPPORT"] = "NOT_SUPPORT";
|
package/index.d.ts
CHANGED
|
@@ -20,14 +20,17 @@ export * from "./definition/listable";
|
|
|
20
20
|
export * from "./definition/promise";
|
|
21
21
|
export * from "./error/imbricate-error";
|
|
22
22
|
export * from "./error/not-implemented";
|
|
23
|
+
export * from "./executable-manager/base";
|
|
24
|
+
export * from "./executable-manager/definition";
|
|
25
|
+
export * from "./executable-manager/interface";
|
|
23
26
|
export * from "./execute/definition";
|
|
24
|
-
export * from "./execute/extension";
|
|
25
27
|
export * from "./function/base";
|
|
26
28
|
export * from "./function/definition";
|
|
27
29
|
export * from "./function/interface";
|
|
28
30
|
export * from "./origin/base";
|
|
29
31
|
export * from "./origin/definition";
|
|
30
32
|
export * from "./origin/interface";
|
|
33
|
+
export * from "./page-variant/definition";
|
|
31
34
|
export * from "./page/base";
|
|
32
35
|
export * from "./page/definition";
|
|
33
36
|
export * from "./page/interface";
|
|
@@ -37,6 +40,8 @@ export * from "./query/script";
|
|
|
37
40
|
export * from "./script-manager/base";
|
|
38
41
|
export * from "./script-manager/definition";
|
|
39
42
|
export * from "./script-manager/interface";
|
|
43
|
+
export * from "./script-variant/definition";
|
|
44
|
+
export * from "./script-variant/extension";
|
|
40
45
|
export * from "./script/base";
|
|
41
46
|
export * from "./script/definition";
|
|
42
47
|
export * from "./script/interface";
|
package/index.js
CHANGED
|
@@ -36,14 +36,17 @@ __exportStar(require("./definition/listable"), exports);
|
|
|
36
36
|
__exportStar(require("./definition/promise"), exports);
|
|
37
37
|
__exportStar(require("./error/imbricate-error"), exports);
|
|
38
38
|
__exportStar(require("./error/not-implemented"), exports);
|
|
39
|
+
__exportStar(require("./executable-manager/base"), exports);
|
|
40
|
+
__exportStar(require("./executable-manager/definition"), exports);
|
|
41
|
+
__exportStar(require("./executable-manager/interface"), exports);
|
|
39
42
|
__exportStar(require("./execute/definition"), exports);
|
|
40
|
-
__exportStar(require("./execute/extension"), exports);
|
|
41
43
|
__exportStar(require("./function/base"), exports);
|
|
42
44
|
__exportStar(require("./function/definition"), exports);
|
|
43
45
|
__exportStar(require("./function/interface"), exports);
|
|
44
46
|
__exportStar(require("./origin/base"), exports);
|
|
45
47
|
__exportStar(require("./origin/definition"), exports);
|
|
46
48
|
__exportStar(require("./origin/interface"), exports);
|
|
49
|
+
__exportStar(require("./page-variant/definition"), exports);
|
|
47
50
|
__exportStar(require("./page/base"), exports);
|
|
48
51
|
__exportStar(require("./page/definition"), exports);
|
|
49
52
|
__exportStar(require("./page/interface"), exports);
|
|
@@ -53,6 +56,8 @@ __exportStar(require("./query/script"), exports);
|
|
|
53
56
|
__exportStar(require("./script-manager/base"), exports);
|
|
54
57
|
__exportStar(require("./script-manager/definition"), exports);
|
|
55
58
|
__exportStar(require("./script-manager/interface"), exports);
|
|
59
|
+
__exportStar(require("./script-variant/definition"), exports);
|
|
60
|
+
__exportStar(require("./script-variant/extension"), exports);
|
|
56
61
|
__exportStar(require("./script/base"), exports);
|
|
57
62
|
__exportStar(require("./script/definition"), exports);
|
|
58
63
|
__exportStar(require("./script/interface"), exports);
|
package/package.json
CHANGED
package/page/base.d.ts
CHANGED
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
import { ImbricateCapabilityBuilder } from "../capability/builder";
|
|
7
7
|
import { ImbricateCapability } from "../capability/definition";
|
|
8
8
|
import type { PromiseOr } from "../definition/promise";
|
|
9
|
-
import {
|
|
9
|
+
import { ImbricatePageVariant } from "../page-variant/definition";
|
|
10
|
+
import { IMBRICATE_PAGE_CAPABILITY_KEY, ImbricatePageCapability, ImbricatePageHistoryRecord } from "./definition";
|
|
10
11
|
import type { IImbricatePage } from "./interface";
|
|
11
12
|
export declare abstract class ImbricatePageBase implements IImbricatePage {
|
|
12
13
|
static buildCapability(initial?: ImbricateCapability): ImbricateCapabilityBuilder<IMBRICATE_PAGE_CAPABILITY_KEY>;
|
|
@@ -15,7 +16,7 @@ export declare abstract class ImbricatePageBase implements IImbricatePage {
|
|
|
15
16
|
abstract readonly title: string;
|
|
16
17
|
abstract readonly directories: string[];
|
|
17
18
|
abstract readonly identifier: string;
|
|
18
|
-
abstract readonly variant:
|
|
19
|
+
abstract readonly variant: ImbricatePageVariant;
|
|
19
20
|
abstract readonly digest: string;
|
|
20
21
|
abstract readonly historyRecords: ImbricatePageHistoryRecord[];
|
|
21
22
|
abstract readonly description?: string;
|
package/page/definition.d.ts
CHANGED
|
@@ -4,30 +4,26 @@
|
|
|
4
4
|
* @description Definition
|
|
5
5
|
*/
|
|
6
6
|
import { ImbricateCapability } from "../capability/definition";
|
|
7
|
+
import { ImbricatePageVariant } from "../page-variant/definition";
|
|
7
8
|
import { IMBRICATE_SEARCH_RESULT_TYPE, ImbricateSearchResult, ImbricateSearchSnippet } from "../search/snippet";
|
|
8
9
|
export type ImbricatePageAttributes = Record<string, string>;
|
|
9
10
|
export type ImbricatePageSearchResult = ImbricateSearchResult<IMBRICATE_SEARCH_RESULT_TYPE.PAGE>;
|
|
10
11
|
export type ImbricatePageSearchSnippet = ImbricateSearchSnippet<IMBRICATE_SEARCH_RESULT_TYPE.PAGE>;
|
|
11
|
-
export declare enum IMBRICATE_PAGE_VARIANT {
|
|
12
|
-
PLAIN_TEXT = "plain-text",
|
|
13
|
-
MARKDOWN = "markdown"
|
|
14
|
-
}
|
|
15
|
-
export declare const IMBRICATE_PAGE_VARIANT_LIST: IMBRICATE_PAGE_VARIANT[];
|
|
16
|
-
export declare const isValidImbricatePageVariant: (variant: unknown) => variant is IMBRICATE_PAGE_VARIANT;
|
|
17
12
|
export type ImbricatePageSnapshot = {
|
|
18
13
|
readonly title: string;
|
|
19
14
|
readonly directories: string[];
|
|
20
15
|
readonly identifier: string;
|
|
21
|
-
readonly variant:
|
|
16
|
+
readonly variant: ImbricatePageVariant;
|
|
22
17
|
};
|
|
23
18
|
export type ImbricatePageHistoryRecord = {
|
|
24
|
-
readonly
|
|
19
|
+
readonly author: string;
|
|
25
20
|
readonly digest: string;
|
|
21
|
+
readonly updatedAt: Date;
|
|
26
22
|
};
|
|
27
23
|
export type ImbricatePageMetadata = {
|
|
28
24
|
readonly createdAt: Date;
|
|
29
|
-
readonly updatedAt: Date;
|
|
30
25
|
readonly digest: string;
|
|
26
|
+
readonly updatedAt: Date;
|
|
31
27
|
readonly attributes: ImbricatePageAttributes;
|
|
32
28
|
readonly historyRecords: ImbricatePageHistoryRecord[];
|
|
33
29
|
readonly description?: string;
|
package/page/definition.js
CHANGED
|
@@ -5,20 +5,7 @@
|
|
|
5
5
|
* @description Definition
|
|
6
6
|
*/
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.ImbricatePageCapabilityList = exports.IMBRICATE_PAGE_CAPABILITY_KEY =
|
|
9
|
-
var IMBRICATE_PAGE_VARIANT;
|
|
10
|
-
(function (IMBRICATE_PAGE_VARIANT) {
|
|
11
|
-
IMBRICATE_PAGE_VARIANT["PLAIN_TEXT"] = "plain-text";
|
|
12
|
-
IMBRICATE_PAGE_VARIANT["MARKDOWN"] = "markdown";
|
|
13
|
-
})(IMBRICATE_PAGE_VARIANT || (exports.IMBRICATE_PAGE_VARIANT = IMBRICATE_PAGE_VARIANT = {}));
|
|
14
|
-
exports.IMBRICATE_PAGE_VARIANT_LIST = [
|
|
15
|
-
IMBRICATE_PAGE_VARIANT.PLAIN_TEXT,
|
|
16
|
-
IMBRICATE_PAGE_VARIANT.MARKDOWN,
|
|
17
|
-
];
|
|
18
|
-
const isValidImbricatePageVariant = (variant) => {
|
|
19
|
-
return exports.IMBRICATE_PAGE_VARIANT_LIST.includes(variant);
|
|
20
|
-
};
|
|
21
|
-
exports.isValidImbricatePageVariant = isValidImbricatePageVariant;
|
|
8
|
+
exports.ImbricatePageCapabilityList = exports.IMBRICATE_PAGE_CAPABILITY_KEY = void 0;
|
|
22
9
|
var IMBRICATE_PAGE_CAPABILITY_KEY;
|
|
23
10
|
(function (IMBRICATE_PAGE_CAPABILITY_KEY) {
|
|
24
11
|
IMBRICATE_PAGE_CAPABILITY_KEY["READ"] = "imbricate.page.read";
|
package/page/interface.d.ts
CHANGED
|
@@ -4,12 +4,13 @@
|
|
|
4
4
|
* @description Interface
|
|
5
5
|
*/
|
|
6
6
|
import { PromiseOr } from "../definition/promise";
|
|
7
|
-
import {
|
|
7
|
+
import { ImbricatePageVariant } from "../page-variant/definition";
|
|
8
|
+
import { ImbricatePageAttributes, ImbricatePageCapability, ImbricatePageHistoryRecord } from "./definition";
|
|
8
9
|
export interface IImbricatePage {
|
|
9
10
|
readonly title: string;
|
|
10
11
|
readonly directories: string[];
|
|
11
12
|
readonly identifier: string;
|
|
12
|
-
readonly variant:
|
|
13
|
+
readonly variant: ImbricatePageVariant;
|
|
13
14
|
readonly digest: string;
|
|
14
15
|
readonly historyRecords: ImbricatePageHistoryRecord[];
|
|
15
16
|
readonly description?: string;
|
|
@@ -20,8 +21,33 @@ export interface IImbricatePage {
|
|
|
20
21
|
writeContent(content: string): PromiseOr<void>;
|
|
21
22
|
readAttributes(): PromiseOr<ImbricatePageAttributes>;
|
|
22
23
|
writeAttribute(key: string, value: string): PromiseOr<void>;
|
|
24
|
+
/**
|
|
25
|
+
* Refresh Updated At and Digest, and add a history record
|
|
26
|
+
* Recommended to use this method when updating the page
|
|
27
|
+
*
|
|
28
|
+
* @param updatedAt Updated At
|
|
29
|
+
* @param digest Content Digest
|
|
30
|
+
*/
|
|
23
31
|
refreshUpdateMetadata(updatedAt: Date, digest: string): PromiseOr<void>;
|
|
32
|
+
/**
|
|
33
|
+
* Refresh Updated At
|
|
34
|
+
* Prefer `refreshUpdateMetadata` in most cases
|
|
35
|
+
*
|
|
36
|
+
* @param updatedAt Updated At
|
|
37
|
+
*/
|
|
24
38
|
refreshUpdatedAt(updatedAt: Date): PromiseOr<void>;
|
|
39
|
+
/**
|
|
40
|
+
* Refresh Digest
|
|
41
|
+
* Prefer `refreshUpdateMetadata` in most cases
|
|
42
|
+
*
|
|
43
|
+
* @param digest Content Digest
|
|
44
|
+
*/
|
|
25
45
|
refreshDigest(digest: string): PromiseOr<void>;
|
|
46
|
+
/**
|
|
47
|
+
* Add a history record
|
|
48
|
+
* Prefer `refreshUpdateMetadata` in most cases
|
|
49
|
+
*
|
|
50
|
+
* @param record History Record
|
|
51
|
+
*/
|
|
26
52
|
addHistoryRecord(record: ImbricatePageHistoryRecord): PromiseOr<void>;
|
|
27
53
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author WMXPY
|
|
3
|
+
* @namespace PageVariant
|
|
4
|
+
* @description Definition
|
|
5
|
+
*/
|
|
6
|
+
export declare enum IMBRICATE_PAGE_VARIANT_LANGUAGE {
|
|
7
|
+
TEXT = "text",
|
|
8
|
+
MARKDOWN = "markdown",
|
|
9
|
+
LATEX = "latex"
|
|
10
|
+
}
|
|
11
|
+
export declare const IMBRICATE_PAGE_VARIANT_LANGUAGE_LIST: IMBRICATE_PAGE_VARIANT_LANGUAGE[];
|
|
12
|
+
export declare const isValidImbricatePageVariantLanguage: (language: unknown) => language is IMBRICATE_PAGE_VARIANT_LANGUAGE;
|
|
13
|
+
export type ImbricatePageVariant = {
|
|
14
|
+
readonly language: IMBRICATE_PAGE_VARIANT_LANGUAGE;
|
|
15
|
+
};
|
|
16
|
+
export declare const isImbricatePageVariant: (variant: unknown) => variant is ImbricatePageVariant;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @author WMXPY
|
|
4
|
+
* @namespace PageVariant
|
|
5
|
+
* @description Definition
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.isImbricatePageVariant = exports.isValidImbricatePageVariantLanguage = exports.IMBRICATE_PAGE_VARIANT_LANGUAGE_LIST = exports.IMBRICATE_PAGE_VARIANT_LANGUAGE = void 0;
|
|
9
|
+
var IMBRICATE_PAGE_VARIANT_LANGUAGE;
|
|
10
|
+
(function (IMBRICATE_PAGE_VARIANT_LANGUAGE) {
|
|
11
|
+
IMBRICATE_PAGE_VARIANT_LANGUAGE["TEXT"] = "text";
|
|
12
|
+
IMBRICATE_PAGE_VARIANT_LANGUAGE["MARKDOWN"] = "markdown";
|
|
13
|
+
IMBRICATE_PAGE_VARIANT_LANGUAGE["LATEX"] = "latex";
|
|
14
|
+
})(IMBRICATE_PAGE_VARIANT_LANGUAGE || (exports.IMBRICATE_PAGE_VARIANT_LANGUAGE = IMBRICATE_PAGE_VARIANT_LANGUAGE = {}));
|
|
15
|
+
exports.IMBRICATE_PAGE_VARIANT_LANGUAGE_LIST = [
|
|
16
|
+
IMBRICATE_PAGE_VARIANT_LANGUAGE.TEXT,
|
|
17
|
+
IMBRICATE_PAGE_VARIANT_LANGUAGE.MARKDOWN,
|
|
18
|
+
IMBRICATE_PAGE_VARIANT_LANGUAGE.LATEX,
|
|
19
|
+
];
|
|
20
|
+
const isValidImbricatePageVariantLanguage = (language) => {
|
|
21
|
+
return exports.IMBRICATE_PAGE_VARIANT_LANGUAGE_LIST.includes(language);
|
|
22
|
+
};
|
|
23
|
+
exports.isValidImbricatePageVariantLanguage = isValidImbricatePageVariantLanguage;
|
|
24
|
+
const isImbricatePageVariant = (variant) => {
|
|
25
|
+
if (typeof variant !== "object") {
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
if (!(0, exports.isValidImbricatePageVariantLanguage)(variant.language)) {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
return true;
|
|
32
|
+
};
|
|
33
|
+
exports.isImbricatePageVariant = isImbricatePageVariant;
|
package/script/base.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import { ImbricateCapabilityBuilder } from "../capability/builder";
|
|
7
7
|
import { ImbricateCapability } from "../capability/definition";
|
|
8
8
|
import type { PromiseOr } from "../definition/promise";
|
|
9
|
-
import {
|
|
9
|
+
import { ImbricateScriptVariant } from "../script-variant/definition";
|
|
10
10
|
import { IMBRICATE_SCRIPT_CAPABILITY_KEY, ImbricateScriptAttributes, ImbricateScriptCapability, ImbricateScriptHistoryRecord } from "./definition";
|
|
11
11
|
import type { IImbricateScript } from "./interface";
|
|
12
12
|
export declare abstract class ImbricateScriptBase implements IImbricateScript {
|
|
@@ -15,7 +15,7 @@ export declare abstract class ImbricateScriptBase implements IImbricateScript {
|
|
|
15
15
|
static allDenyCapability(): ImbricateScriptCapability;
|
|
16
16
|
abstract readonly scriptName: string;
|
|
17
17
|
abstract readonly identifier: string;
|
|
18
|
-
abstract readonly variant:
|
|
18
|
+
abstract readonly variant: ImbricateScriptVariant;
|
|
19
19
|
abstract readonly digest: string;
|
|
20
20
|
abstract readonly historyRecords: ImbricateScriptHistoryRecord[];
|
|
21
21
|
abstract readonly description?: string;
|
|
@@ -30,5 +30,4 @@ export declare abstract class ImbricateScriptBase implements IImbricateScript {
|
|
|
30
30
|
refreshUpdatedAt(_updatedAt: Date): PromiseOr<void>;
|
|
31
31
|
refreshDigest(_digest: string): PromiseOr<void>;
|
|
32
32
|
addHistoryRecord(_record: ImbricateScriptHistoryRecord): PromiseOr<void>;
|
|
33
|
-
execute(_parameters: ImbricateExecuteParameters, _environment: ImbricateExecuteEnvironment): PromiseOr<ImbricateExecuteResult>;
|
|
34
33
|
}
|
package/script/base.js
CHANGED
|
@@ -44,8 +44,5 @@ class ImbricateScriptBase {
|
|
|
44
44
|
addHistoryRecord(_record) {
|
|
45
45
|
throw not_implemented_1.ImbricateNotImplemented.create("AddHistoryRecord", definition_2.IMBRICATE_SCRIPT_CAPABILITY_KEY.UPDATE_HISTORY_RECORD);
|
|
46
46
|
}
|
|
47
|
-
execute(_parameters, _environment) {
|
|
48
|
-
throw not_implemented_1.ImbricateNotImplemented.create("Execute", definition_2.IMBRICATE_SCRIPT_CAPABILITY_KEY.EXECUTE);
|
|
49
|
-
}
|
|
50
47
|
}
|
|
51
48
|
exports.ImbricateScriptBase = ImbricateScriptBase;
|
package/script/definition.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* @description Definition
|
|
5
5
|
*/
|
|
6
6
|
import { ImbricateCapability } from "../capability/definition";
|
|
7
|
-
import {
|
|
7
|
+
import { ImbricateScriptVariant } from "../script-variant/definition";
|
|
8
8
|
import { IMBRICATE_SEARCH_RESULT_TYPE, ImbricateSearchResult, ImbricateSearchSnippet } from "../search/snippet";
|
|
9
9
|
export type ImbricateScriptAttributes = Record<string, string>;
|
|
10
10
|
export type ImbricateScriptSearchResult = ImbricateSearchResult<IMBRICATE_SEARCH_RESULT_TYPE.SCRIPT>;
|
|
@@ -12,16 +12,17 @@ export type ImbricateScriptSearchSnippet = ImbricateSearchSnippet<IMBRICATE_SEAR
|
|
|
12
12
|
export type ImbricateScriptSnapshot = {
|
|
13
13
|
readonly scriptName: string;
|
|
14
14
|
readonly identifier: string;
|
|
15
|
-
readonly variant:
|
|
15
|
+
readonly variant: ImbricateScriptVariant;
|
|
16
16
|
};
|
|
17
17
|
export type ImbricateScriptHistoryRecord = {
|
|
18
|
-
readonly
|
|
18
|
+
readonly author: string;
|
|
19
19
|
readonly digest: string;
|
|
20
|
+
readonly updatedAt: Date;
|
|
20
21
|
};
|
|
21
22
|
export type ImbricateScriptMetadata = {
|
|
22
23
|
readonly createdAt: Date;
|
|
23
|
-
readonly updatedAt: Date;
|
|
24
24
|
readonly digest: string;
|
|
25
|
+
readonly updatedAt: Date;
|
|
25
26
|
readonly attributes: ImbricateScriptAttributes;
|
|
26
27
|
readonly historyRecords: ImbricateScriptHistoryRecord[];
|
|
27
28
|
readonly description?: string;
|
package/script/interface.d.ts
CHANGED
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
* @description Interface
|
|
5
5
|
*/
|
|
6
6
|
import { PromiseOr } from "../definition/promise";
|
|
7
|
-
import {
|
|
7
|
+
import { ImbricateScriptVariant } from "../script-variant/definition";
|
|
8
8
|
import { ImbricateScriptAttributes, ImbricateScriptCapability, ImbricateScriptHistoryRecord } from "./definition";
|
|
9
9
|
export interface IImbricateScript {
|
|
10
10
|
readonly scriptName: string;
|
|
11
11
|
readonly identifier: string;
|
|
12
|
-
readonly variant:
|
|
12
|
+
readonly variant: ImbricateScriptVariant;
|
|
13
13
|
readonly digest: string;
|
|
14
14
|
readonly historyRecords: ImbricateScriptHistoryRecord[];
|
|
15
15
|
readonly description?: string;
|
|
@@ -20,9 +20,33 @@ export interface IImbricateScript {
|
|
|
20
20
|
writeScript(script: string): PromiseOr<void>;
|
|
21
21
|
readAttributes(): PromiseOr<ImbricateScriptAttributes>;
|
|
22
22
|
writeAttribute(key: string, value: string): PromiseOr<void>;
|
|
23
|
+
/**
|
|
24
|
+
* Refresh Updated At and Digest, and add a history record
|
|
25
|
+
* Recommended to use this method when updating the script
|
|
26
|
+
*
|
|
27
|
+
* @param updatedAt Updated At
|
|
28
|
+
* @param digest Content Digest
|
|
29
|
+
*/
|
|
23
30
|
refreshUpdateMetadata(updatedAt: Date, digest: string): PromiseOr<void>;
|
|
31
|
+
/**
|
|
32
|
+
* Refresh Updated At
|
|
33
|
+
* Prefer `refreshUpdateMetadata` in most cases
|
|
34
|
+
*
|
|
35
|
+
* @param updatedAt Updated At
|
|
36
|
+
*/
|
|
24
37
|
refreshUpdatedAt(updatedAt: Date): PromiseOr<void>;
|
|
38
|
+
/**
|
|
39
|
+
* Refresh Digest
|
|
40
|
+
* Prefer `refreshUpdateMetadata` in most cases
|
|
41
|
+
*
|
|
42
|
+
* @param digest Content Digest
|
|
43
|
+
*/
|
|
25
44
|
refreshDigest(digest: string): PromiseOr<void>;
|
|
45
|
+
/**
|
|
46
|
+
* Add a history record
|
|
47
|
+
* Prefer `refreshUpdateMetadata` in most cases
|
|
48
|
+
*
|
|
49
|
+
* @param record History Record
|
|
50
|
+
*/
|
|
26
51
|
addHistoryRecord(record: ImbricateScriptHistoryRecord): PromiseOr<void>;
|
|
27
|
-
execute(parameters: ImbricateExecuteParameters, environment: ImbricateExecuteEnvironment): PromiseOr<ImbricateExecuteResult>;
|
|
28
52
|
}
|
package/script-manager/base.d.ts
CHANGED
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
import { ImbricateCapabilityBuilder } from "../capability/builder";
|
|
7
7
|
import { ImbricateCapability } from "../capability/definition";
|
|
8
8
|
import type { PromiseOr } from "../definition/promise";
|
|
9
|
-
import { IMBRICATE_EXECUTABLE_VARIANT, ImbricateExecuteEnvironment, ImbricateExecuteParameters, ImbricateExecuteResult } from "../execute/definition";
|
|
10
9
|
import { ImbricateScriptQuery, ImbricateScriptQueryConfig, ImbricateSearchScriptConfig } from "../query/script";
|
|
11
10
|
import { IImbricateScriptManager } from "../script-manager/interface";
|
|
11
|
+
import { ImbricateScriptVariant } from "../script-variant/definition";
|
|
12
12
|
import { ImbricateScriptMetadata, ImbricateScriptSearchResult, ImbricateScriptSnapshot } from "../script/definition";
|
|
13
13
|
import { IImbricateScript } from "../script/interface";
|
|
14
14
|
import { IMBRICATE_SCRIPT_MANAGER_CAPABILITY_KEY, ImbricateScriptManagerCapability } from "./definition";
|
|
@@ -17,7 +17,7 @@ export declare abstract class ImbricateScriptManagerBase implements IImbricateSc
|
|
|
17
17
|
static allAllowCapability(): ImbricateScriptManagerCapability;
|
|
18
18
|
static allDenyCapability(): ImbricateScriptManagerCapability;
|
|
19
19
|
abstract readonly capabilities: ImbricateScriptManagerCapability;
|
|
20
|
-
createScript(_scriptName: string, _variant:
|
|
20
|
+
createScript(_scriptName: string, _variant: ImbricateScriptVariant, _initialScript: string, _description?: string): PromiseOr<IImbricateScript>;
|
|
21
21
|
putScript(_scriptMetadata: ImbricateScriptMetadata, _script: string): PromiseOr<IImbricateScript>;
|
|
22
22
|
renameScript(_identifier: string, _newScriptName: string): PromiseOr<void>;
|
|
23
23
|
deleteScript(_identifier: string): PromiseOr<void>;
|
|
@@ -26,5 +26,4 @@ export declare abstract class ImbricateScriptManagerBase implements IImbricateSc
|
|
|
26
26
|
listScripts(): PromiseOr<ImbricateScriptSnapshot[]>;
|
|
27
27
|
searchScripts(_keyword: string, _config: ImbricateSearchScriptConfig): PromiseOr<ImbricateScriptSearchResult[]>;
|
|
28
28
|
queryScripts(_query: ImbricateScriptQuery, _config: ImbricateScriptQueryConfig): PromiseOr<IImbricateScript[]>;
|
|
29
|
-
executeScriptSnippet(_snippet: string, _variant: IMBRICATE_EXECUTABLE_VARIANT, _parameters: ImbricateExecuteParameters, _environment: ImbricateExecuteEnvironment): PromiseOr<ImbricateExecuteResult>;
|
|
30
29
|
}
|
package/script-manager/base.js
CHANGED
|
@@ -47,8 +47,5 @@ class ImbricateScriptManagerBase {
|
|
|
47
47
|
queryScripts(_query, _config) {
|
|
48
48
|
throw not_implemented_1.ImbricateNotImplemented.create("QueryScripts", definition_2.IMBRICATE_SCRIPT_MANAGER_CAPABILITY_KEY.LIST_SCRIPTS);
|
|
49
49
|
}
|
|
50
|
-
executeScriptSnippet(_snippet, _variant, _parameters, _environment) {
|
|
51
|
-
throw not_implemented_1.ImbricateNotImplemented.create("ExecuteScriptSnippet", definition_2.IMBRICATE_SCRIPT_MANAGER_CAPABILITY_KEY.EXECUTE_SCRIPT_SNIPPET);
|
|
52
|
-
}
|
|
53
50
|
}
|
|
54
51
|
exports.ImbricateScriptManagerBase = ImbricateScriptManagerBase;
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* @description Interface
|
|
5
5
|
*/
|
|
6
6
|
import { PromiseOr } from "../definition/promise";
|
|
7
|
-
import { IMBRICATE_EXECUTABLE_VARIANT, ImbricateExecuteEnvironment, ImbricateExecuteParameters, ImbricateExecuteResult } from "../execute/definition";
|
|
8
7
|
import { ImbricateScriptQuery, ImbricateScriptQueryConfig, ImbricateSearchScriptConfig } from "../query/script";
|
|
8
|
+
import { ImbricateScriptVariant } from "../script-variant/definition";
|
|
9
9
|
import { ImbricateScriptMetadata, ImbricateScriptSearchResult, ImbricateScriptSnapshot } from "../script/definition";
|
|
10
10
|
import { IImbricateScript } from "../script/interface";
|
|
11
11
|
import { ImbricateScriptManagerCapability } from "./definition";
|
|
@@ -23,7 +23,15 @@ export interface IImbricateScriptManager {
|
|
|
23
23
|
*
|
|
24
24
|
* @returns Created script
|
|
25
25
|
*/
|
|
26
|
-
createScript(scriptName: string, variant:
|
|
26
|
+
createScript(scriptName: string, variant: ImbricateScriptVariant, initialScript: string, description?: string): PromiseOr<IImbricateScript>;
|
|
27
|
+
/**
|
|
28
|
+
* Put a script
|
|
29
|
+
*
|
|
30
|
+
* @param scriptMetadata the metadata of the script
|
|
31
|
+
* @param script the script content
|
|
32
|
+
*
|
|
33
|
+
* @returns the script
|
|
34
|
+
*/
|
|
27
35
|
putScript(scriptMetadata: ImbricateScriptMetadata, script: string): PromiseOr<IImbricateScript>;
|
|
28
36
|
renameScript(identifier: string, newScriptName: string): PromiseOr<void>;
|
|
29
37
|
deleteScript(identifier: string): PromiseOr<void>;
|
|
@@ -32,5 +40,4 @@ export interface IImbricateScriptManager {
|
|
|
32
40
|
listScripts(): PromiseOr<ImbricateScriptSnapshot[]>;
|
|
33
41
|
searchScripts(keyword: string, config: ImbricateSearchScriptConfig): PromiseOr<ImbricateScriptSearchResult[]>;
|
|
34
42
|
queryScripts(query: ImbricateScriptQuery, config: ImbricateScriptQueryConfig): PromiseOr<IImbricateScript[]>;
|
|
35
|
-
executeScriptSnippet(snippet: string, variant: IMBRICATE_EXECUTABLE_VARIANT, parameters: ImbricateExecuteParameters, environment: ImbricateExecuteEnvironment): PromiseOr<ImbricateExecuteResult>;
|
|
36
43
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author WMXPY
|
|
3
|
+
* @namespace ScriptVariant
|
|
4
|
+
* @description Definition
|
|
5
|
+
*/
|
|
6
|
+
export declare enum IMBRICATE_SCRIPT_LANGUAGE {
|
|
7
|
+
JAVASCRIPT = "javascript",
|
|
8
|
+
TYPESCRIPT = "typescript"
|
|
9
|
+
}
|
|
10
|
+
export declare const IMBRICATE_SCRIPT_LANGUAGE_LIST: IMBRICATE_SCRIPT_LANGUAGE[];
|
|
11
|
+
export declare const isValidImbricateScriptLanguage: (language: unknown) => language is IMBRICATE_SCRIPT_LANGUAGE;
|
|
12
|
+
export type ImbricateScriptVariant = {
|
|
13
|
+
readonly language: IMBRICATE_SCRIPT_LANGUAGE;
|
|
14
|
+
readonly engine: string;
|
|
15
|
+
readonly version: string;
|
|
16
|
+
};
|
|
17
|
+
export declare const isImbricateScriptVariant: (variant: unknown) => variant is ImbricateScriptVariant;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @author WMXPY
|
|
4
|
+
* @namespace ScriptVariant
|
|
5
|
+
* @description Definition
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.isImbricateScriptVariant = exports.isValidImbricateScriptLanguage = exports.IMBRICATE_SCRIPT_LANGUAGE_LIST = exports.IMBRICATE_SCRIPT_LANGUAGE = void 0;
|
|
9
|
+
var IMBRICATE_SCRIPT_LANGUAGE;
|
|
10
|
+
(function (IMBRICATE_SCRIPT_LANGUAGE) {
|
|
11
|
+
IMBRICATE_SCRIPT_LANGUAGE["JAVASCRIPT"] = "javascript";
|
|
12
|
+
IMBRICATE_SCRIPT_LANGUAGE["TYPESCRIPT"] = "typescript";
|
|
13
|
+
})(IMBRICATE_SCRIPT_LANGUAGE || (exports.IMBRICATE_SCRIPT_LANGUAGE = IMBRICATE_SCRIPT_LANGUAGE = {}));
|
|
14
|
+
exports.IMBRICATE_SCRIPT_LANGUAGE_LIST = [
|
|
15
|
+
IMBRICATE_SCRIPT_LANGUAGE.JAVASCRIPT,
|
|
16
|
+
IMBRICATE_SCRIPT_LANGUAGE.TYPESCRIPT,
|
|
17
|
+
];
|
|
18
|
+
const isValidImbricateScriptLanguage = (language) => {
|
|
19
|
+
return exports.IMBRICATE_SCRIPT_LANGUAGE_LIST.includes(language);
|
|
20
|
+
};
|
|
21
|
+
exports.isValidImbricateScriptLanguage = isValidImbricateScriptLanguage;
|
|
22
|
+
const isImbricateScriptVariant = (variant) => {
|
|
23
|
+
if (typeof variant !== "object") {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
if (!(0, exports.isValidImbricateScriptLanguage)(variant.language)) {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
if (typeof variant.engine !== "string") {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
return true;
|
|
33
|
+
};
|
|
34
|
+
exports.isImbricateScriptVariant = isImbricateScriptVariant;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author WMXPY
|
|
3
|
+
* @namespace ScriptVariant
|
|
4
|
+
* @description Extension
|
|
5
|
+
*/
|
|
6
|
+
import { IMBRICATE_SCRIPT_LANGUAGE } from "./definition";
|
|
7
|
+
export declare const getImbricateScriptLanguageExtension: (language: IMBRICATE_SCRIPT_LANGUAGE, withDot?: boolean) => string;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @author WMXPY
|
|
4
|
+
* @namespace ScriptVariant
|
|
5
|
+
* @description Extension
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.getImbricateScriptLanguageExtension = void 0;
|
|
9
|
+
const definition_1 = require("./definition");
|
|
10
|
+
const fixExtension = (extension, withDot) => {
|
|
11
|
+
if (withDot) {
|
|
12
|
+
return `.${extension}`;
|
|
13
|
+
}
|
|
14
|
+
return extension;
|
|
15
|
+
};
|
|
16
|
+
const getImbricateScriptLanguageExtension = (language, withDot = true) => {
|
|
17
|
+
switch (language) {
|
|
18
|
+
case definition_1.IMBRICATE_SCRIPT_LANGUAGE.JAVASCRIPT: return fixExtension("js", withDot);
|
|
19
|
+
case definition_1.IMBRICATE_SCRIPT_LANGUAGE.TYPESCRIPT: return fixExtension("ts", withDot);
|
|
20
|
+
}
|
|
21
|
+
return fixExtension("unknown", withDot);
|
|
22
|
+
};
|
|
23
|
+
exports.getImbricateScriptLanguageExtension = getImbricateScriptLanguageExtension;
|
package/execute/extension.d.ts
DELETED
package/execute/extension.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* @author WMXPY
|
|
4
|
-
* @namespace Execute
|
|
5
|
-
* @description Extension
|
|
6
|
-
*/
|
|
7
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.getImbricateExecutableExtension = void 0;
|
|
9
|
-
const definition_1 = require("./definition");
|
|
10
|
-
const fixExtension = (extension, withDot) => {
|
|
11
|
-
if (withDot) {
|
|
12
|
-
return `.${extension}`;
|
|
13
|
-
}
|
|
14
|
-
return extension;
|
|
15
|
-
};
|
|
16
|
-
const getImbricateExecutableExtension = (variant, withDot = true) => {
|
|
17
|
-
switch (variant) {
|
|
18
|
-
case definition_1.IMBRICATE_EXECUTABLE_VARIANT.JAVASCRIPT_NODE: return fixExtension("js", withDot);
|
|
19
|
-
case definition_1.IMBRICATE_EXECUTABLE_VARIANT.TYPESCRIPT_NODE: return fixExtension("ts", withDot);
|
|
20
|
-
}
|
|
21
|
-
return fixExtension("unknown", withDot);
|
|
22
|
-
};
|
|
23
|
-
exports.getImbricateExecutableExtension = getImbricateExecutableExtension;
|