@imbricate/core 2.6.2 → 3.0.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/author/definition.d.ts +1 -4
- package/database/definition.d.ts +15 -0
- package/{definition/promise.js → database/definition.js} +2 -2
- package/database/interface.d.ts +41 -0
- package/{function → database}/interface.js +1 -1
- package/database/manager.d.ts +34 -0
- package/database/manager.js +7 -0
- package/database/schema.d.ts +37 -0
- package/database/schema.js +56 -0
- package/document/definition.d.ts +18 -0
- package/{definition/listable.js → document/definition.js} +2 -2
- package/document/interface.d.ts +50 -0
- package/{trash → document}/interface.js +1 -1
- package/document/property.d.ts +18 -0
- package/document/property.js +17 -0
- package/document/validate.d.ts +17 -0
- package/document/validate.js +55 -0
- package/index.d.ts +15 -53
- package/index.js +15 -53
- package/loader/definition.d.ts +8 -0
- package/{query → loader}/definition.js +1 -1
- package/loader/origin-loader.d.ts +9 -0
- package/loader/origin-loader.js +74 -0
- package/loader/persistance.d.ts +19 -0
- package/loader/persistance.js +13 -0
- package/origin/definition.d.ts +1 -19
- package/origin/definition.js +0 -24
- package/origin/interface.d.ts +18 -43
- package/package.json +1 -1
- package/static/interface.d.ts +17 -0
- package/{script → static}/interface.js +1 -1
- package/static/manager.d.ts +26 -0
- package/{query/script.js → static/manager.js} +2 -2
- package/text/interface.d.ts +17 -0
- package/{page → text}/interface.js +1 -1
- package/text/manager.d.ts +26 -0
- package/{query/page.js → text/manager.js} +2 -2
- package/binary-storage/base.d.ts +0 -18
- package/binary-storage/base.js +0 -30
- package/binary-storage/definition.d.ts +0 -11
- package/binary-storage/definition.js +0 -15
- package/binary-storage/interface.d.ts +0 -26
- package/binary-storage/interface.js +0 -7
- package/capability/builder.d.ts +0 -15
- package/capability/builder.js +0 -37
- package/capability/create.d.ts +0 -7
- package/capability/create.js +0 -16
- package/capability/definition.d.ts +0 -16
- package/capability/definition.js +0 -25
- package/capability/validate.d.ts +0 -19
- package/capability/validate.js +0 -36
- package/collection/base.d.ts +0 -36
- package/collection/base.js +0 -60
- package/collection/definition.d.ts +0 -18
- package/collection/definition.js +0 -29
- package/collection/interface.d.ts +0 -43
- package/collection/interface.js +0 -7
- package/collection/least-common-identifier.d.ts +0 -10
- package/collection/least-common-identifier.js +0 -54
- package/collection-manager/base.d.ts +0 -26
- package/collection-manager/base.js +0 -59
- package/collection-manager/definition.d.ts +0 -15
- package/collection-manager/definition.js +0 -23
- package/collection-manager/interface.d.ts +0 -38
- package/collection-manager/interface.js +0 -7
- package/collection-operation-manager/base.d.ts +0 -18
- package/collection-operation-manager/base.js +0 -43
- package/collection-operation-manager/definition.d.ts +0 -12
- package/collection-operation-manager/definition.js +0 -17
- package/collection-operation-manager/interface.d.ts +0 -34
- package/collection-operation-manager/interface.js +0 -7
- package/definition/listable.d.ts +0 -6
- package/definition/promise.d.ts +0 -6
- package/error/imbricate-error.d.ts +0 -15
- package/error/imbricate-error.js +0 -30
- package/error/not-implemented.d.ts +0 -10
- package/error/not-implemented.js +0 -19
- package/executable-manager/base.d.ts +0 -21
- package/executable-manager/base.js +0 -44
- package/executable-manager/definition.d.ts +0 -12
- package/executable-manager/definition.js +0 -17
- package/executable-manager/interface.d.ts +0 -44
- package/executable-manager/interface.js +0 -7
- package/execute/definition.d.ts +0 -17
- package/execute/definition.js +0 -16
- package/function/base.d.ts +0 -19
- package/function/base.js +0 -30
- package/function/definition.d.ts +0 -18
- package/function/definition.js +0 -15
- package/function/interface.d.ts +0 -26
- package/operation/definition.d.ts +0 -28
- package/operation/definition.js +0 -14
- package/origin/base.d.ts +0 -29
- package/origin/base.js +0 -39
- package/origin-operation-manager/base.d.ts +0 -18
- package/origin-operation-manager/base.js +0 -43
- package/origin-operation-manager/definition.d.ts +0 -12
- package/origin-operation-manager/definition.js +0 -17
- package/origin-operation-manager/interface.d.ts +0 -34
- package/origin-operation-manager/interface.js +0 -7
- package/page/base.d.ts +0 -35
- package/page/base.js +0 -48
- package/page/definition.d.ts +0 -41
- package/page/definition.js +0 -25
- package/page/interface.d.ts +0 -55
- package/page-variant/definition.d.ts +0 -16
- package/page-variant/definition.js +0 -33
- package/page-variant/extension.d.ts +0 -7
- package/page-variant/extension.js +0 -24
- package/query/definition.d.ts +0 -14
- package/query/page.d.ts +0 -21
- package/query/script.d.ts +0 -21
- package/script/base.d.ts +0 -34
- package/script/base.js +0 -48
- package/script/definition.d.ts +0 -41
- package/script/definition.js +0 -27
- package/script/interface.d.ts +0 -54
- package/script-manager/base.d.ts +0 -31
- package/script-manager/base.js +0 -54
- package/script-manager/definition.d.ts +0 -18
- package/script-manager/definition.js +0 -29
- package/script-manager/interface.d.ts +0 -47
- package/script-manager/interface.js +0 -7
- package/script-variant/definition.d.ts +0 -22
- package/script-variant/definition.js +0 -39
- package/script-variant/extension.d.ts +0 -7
- package/script-variant/extension.js +0 -23
- package/search/prefix.d.ts +0 -7
- package/search/prefix.js +0 -37
- package/search/snippet.d.ts +0 -38
- package/search/snippet.js +0 -23
- package/trash/base.d.ts +0 -20
- package/trash/base.js +0 -36
- package/trash/definition.d.ts +0 -25
- package/trash/definition.js +0 -21
- package/trash/interface.d.ts +0 -17
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @author WMXPY
|
|
4
|
+
* @namespace Loader
|
|
5
|
+
* @description Origin Loader
|
|
6
|
+
*/
|
|
7
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
8
|
+
if (k2 === undefined) k2 = k;
|
|
9
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
10
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
11
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
12
|
+
}
|
|
13
|
+
Object.defineProperty(o, k2, desc);
|
|
14
|
+
}) : (function(o, m, k, k2) {
|
|
15
|
+
if (k2 === undefined) k2 = k;
|
|
16
|
+
o[k2] = m[k];
|
|
17
|
+
}));
|
|
18
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
19
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
20
|
+
}) : function(o, v) {
|
|
21
|
+
o["default"] = v;
|
|
22
|
+
});
|
|
23
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
24
|
+
if (mod && mod.__esModule) return mod;
|
|
25
|
+
var result = {};
|
|
26
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
27
|
+
__setModuleDefault(result, mod);
|
|
28
|
+
return result;
|
|
29
|
+
};
|
|
30
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
31
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
32
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
33
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
34
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
35
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
36
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
+
exports.loadImbricateOriginsFromPersistance = exports.loadImbricateOriginFromPersistanceOrigin = void 0;
|
|
41
|
+
const persistance_1 = require("./persistance");
|
|
42
|
+
const loadImbricateOriginFromPersistanceOrigin = (origin) => __awaiter(void 0, void 0, void 0, function* () {
|
|
43
|
+
switch (origin.originLoadType) {
|
|
44
|
+
case persistance_1.IMBRICATE_ORIGIN_LOAD_TYPE.NPM_PACKAGE: {
|
|
45
|
+
const originPackage = yield Promise.resolve(`${origin.originLoadValue}`).then(s => __importStar(require(s)));
|
|
46
|
+
if (typeof originPackage.default === "function") {
|
|
47
|
+
const initialized = originPackage.default.call(null, origin.originPayloads);
|
|
48
|
+
return initialized;
|
|
49
|
+
}
|
|
50
|
+
break;
|
|
51
|
+
}
|
|
52
|
+
case persistance_1.IMBRICATE_ORIGIN_LOAD_TYPE.FILE_SYSTEM: {
|
|
53
|
+
const originPackage = yield Promise.resolve(`${origin.originLoadValue}`).then(s => __importStar(require(s)));
|
|
54
|
+
if (typeof originPackage.default === "function") {
|
|
55
|
+
const initialized = originPackage.default.call(null, origin.originPayloads);
|
|
56
|
+
return initialized;
|
|
57
|
+
}
|
|
58
|
+
break;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return null;
|
|
62
|
+
});
|
|
63
|
+
exports.loadImbricateOriginFromPersistanceOrigin = loadImbricateOriginFromPersistanceOrigin;
|
|
64
|
+
const loadImbricateOriginsFromPersistance = (persistance) => __awaiter(void 0, void 0, void 0, function* () {
|
|
65
|
+
const origins = [];
|
|
66
|
+
for (const origin of persistance.origins) {
|
|
67
|
+
const originInstance = yield (0, exports.loadImbricateOriginFromPersistanceOrigin)(origin);
|
|
68
|
+
if (originInstance) {
|
|
69
|
+
origins.push(originInstance);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return origins;
|
|
73
|
+
});
|
|
74
|
+
exports.loadImbricateOriginsFromPersistance = loadImbricateOriginsFromPersistance;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author WMXPY
|
|
3
|
+
* @namespace Loader
|
|
4
|
+
* @description Persistance
|
|
5
|
+
*/
|
|
6
|
+
import { OriginPayload } from "../origin/definition";
|
|
7
|
+
export declare enum IMBRICATE_ORIGIN_LOAD_TYPE {
|
|
8
|
+
NPM_PACKAGE = "NPM_PACKAGE",
|
|
9
|
+
FILE_SYSTEM = "FILE_SYSTEM"
|
|
10
|
+
}
|
|
11
|
+
export type ImbricateOriginPersistanceOrigin = {
|
|
12
|
+
readonly originLoadType: IMBRICATE_ORIGIN_LOAD_TYPE;
|
|
13
|
+
readonly originLoadValue: string;
|
|
14
|
+
readonly originName: string;
|
|
15
|
+
readonly originPayloads: OriginPayload;
|
|
16
|
+
};
|
|
17
|
+
export type ImbricateOriginPersistance = {
|
|
18
|
+
readonly origins: ImbricateOriginPersistanceOrigin[];
|
|
19
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @author WMXPY
|
|
4
|
+
* @namespace Loader
|
|
5
|
+
* @description Persistance
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.IMBRICATE_ORIGIN_LOAD_TYPE = void 0;
|
|
9
|
+
var IMBRICATE_ORIGIN_LOAD_TYPE;
|
|
10
|
+
(function (IMBRICATE_ORIGIN_LOAD_TYPE) {
|
|
11
|
+
IMBRICATE_ORIGIN_LOAD_TYPE["NPM_PACKAGE"] = "NPM_PACKAGE";
|
|
12
|
+
IMBRICATE_ORIGIN_LOAD_TYPE["FILE_SYSTEM"] = "FILE_SYSTEM";
|
|
13
|
+
})(IMBRICATE_ORIGIN_LOAD_TYPE || (exports.IMBRICATE_ORIGIN_LOAD_TYPE = IMBRICATE_ORIGIN_LOAD_TYPE = {}));
|
package/origin/definition.d.ts
CHANGED
|
@@ -3,22 +3,4 @@
|
|
|
3
3
|
* @namespace Origin
|
|
4
4
|
* @description Definition
|
|
5
5
|
*/
|
|
6
|
-
|
|
7
|
-
export declare enum IMBRICATE_DIGEST_ALGORITHM {
|
|
8
|
-
MD5 = "MD5",
|
|
9
|
-
SHA1 = "SHA1",
|
|
10
|
-
SHA256 = "SHA256"
|
|
11
|
-
}
|
|
12
|
-
export type ImbricateOriginMetadata = {
|
|
13
|
-
readonly digestAlgorithm: IMBRICATE_DIGEST_ALGORITHM;
|
|
14
|
-
};
|
|
15
|
-
export type ImbricateOriginCapability = Record<IMBRICATE_ORIGIN_CAPABILITY_KEY, ImbricateCapability>;
|
|
16
|
-
export declare enum IMBRICATE_ORIGIN_CAPABILITY_KEY {
|
|
17
|
-
ORIGIN_FUNCTION = "imbricate.origin.function",
|
|
18
|
-
ORIGIN_BINARY_STORAGE = "imbricate.origin.binary-storage",
|
|
19
|
-
ORIGIN_TRASH_STASH = "imbricate.origin.trash-stash",
|
|
20
|
-
ORIGIN_SCRIPT_MANAGER = "imbricate.origin.script-manager",
|
|
21
|
-
ORIGIN_COLLECTION_MANAGER = "imbricate.origin.collection-manager",
|
|
22
|
-
ORIGIN_OPERATION_MANAGER = "imbricate.origin.operation-manager"
|
|
23
|
-
}
|
|
24
|
-
export declare const ImbricateOriginCapabilityList: IMBRICATE_ORIGIN_CAPABILITY_KEY[];
|
|
6
|
+
export type OriginPayload = Record<string, any>;
|
package/origin/definition.js
CHANGED
|
@@ -5,27 +5,3 @@
|
|
|
5
5
|
* @description Definition
|
|
6
6
|
*/
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.ImbricateOriginCapabilityList = exports.IMBRICATE_ORIGIN_CAPABILITY_KEY = exports.IMBRICATE_DIGEST_ALGORITHM = void 0;
|
|
9
|
-
var IMBRICATE_DIGEST_ALGORITHM;
|
|
10
|
-
(function (IMBRICATE_DIGEST_ALGORITHM) {
|
|
11
|
-
IMBRICATE_DIGEST_ALGORITHM["MD5"] = "MD5";
|
|
12
|
-
IMBRICATE_DIGEST_ALGORITHM["SHA1"] = "SHA1";
|
|
13
|
-
IMBRICATE_DIGEST_ALGORITHM["SHA256"] = "SHA256";
|
|
14
|
-
})(IMBRICATE_DIGEST_ALGORITHM || (exports.IMBRICATE_DIGEST_ALGORITHM = IMBRICATE_DIGEST_ALGORITHM = {}));
|
|
15
|
-
var IMBRICATE_ORIGIN_CAPABILITY_KEY;
|
|
16
|
-
(function (IMBRICATE_ORIGIN_CAPABILITY_KEY) {
|
|
17
|
-
IMBRICATE_ORIGIN_CAPABILITY_KEY["ORIGIN_FUNCTION"] = "imbricate.origin.function";
|
|
18
|
-
IMBRICATE_ORIGIN_CAPABILITY_KEY["ORIGIN_BINARY_STORAGE"] = "imbricate.origin.binary-storage";
|
|
19
|
-
IMBRICATE_ORIGIN_CAPABILITY_KEY["ORIGIN_TRASH_STASH"] = "imbricate.origin.trash-stash";
|
|
20
|
-
IMBRICATE_ORIGIN_CAPABILITY_KEY["ORIGIN_SCRIPT_MANAGER"] = "imbricate.origin.script-manager";
|
|
21
|
-
IMBRICATE_ORIGIN_CAPABILITY_KEY["ORIGIN_COLLECTION_MANAGER"] = "imbricate.origin.collection-manager";
|
|
22
|
-
IMBRICATE_ORIGIN_CAPABILITY_KEY["ORIGIN_OPERATION_MANAGER"] = "imbricate.origin.operation-manager";
|
|
23
|
-
})(IMBRICATE_ORIGIN_CAPABILITY_KEY || (exports.IMBRICATE_ORIGIN_CAPABILITY_KEY = IMBRICATE_ORIGIN_CAPABILITY_KEY = {}));
|
|
24
|
-
exports.ImbricateOriginCapabilityList = [
|
|
25
|
-
IMBRICATE_ORIGIN_CAPABILITY_KEY.ORIGIN_FUNCTION,
|
|
26
|
-
IMBRICATE_ORIGIN_CAPABILITY_KEY.ORIGIN_BINARY_STORAGE,
|
|
27
|
-
IMBRICATE_ORIGIN_CAPABILITY_KEY.ORIGIN_TRASH_STASH,
|
|
28
|
-
IMBRICATE_ORIGIN_CAPABILITY_KEY.ORIGIN_SCRIPT_MANAGER,
|
|
29
|
-
IMBRICATE_ORIGIN_CAPABILITY_KEY.ORIGIN_COLLECTION_MANAGER,
|
|
30
|
-
IMBRICATE_ORIGIN_CAPABILITY_KEY.ORIGIN_OPERATION_MANAGER,
|
|
31
|
-
];
|
package/origin/interface.d.ts
CHANGED
|
@@ -3,67 +3,42 @@
|
|
|
3
3
|
* @namespace Origin
|
|
4
4
|
* @description Interface
|
|
5
5
|
*/
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { IImbricateOriginOperationManager } from "../origin-operation-manager/interface";
|
|
11
|
-
import { IImbricateScriptManager } from "../script-manager/interface";
|
|
12
|
-
import { ImbricateOriginCapability, ImbricateOriginMetadata } from "./definition";
|
|
6
|
+
import { IImbricateDatabaseManager } from "../database/manager";
|
|
7
|
+
import { IImbricateStaticManager } from "../static/manager";
|
|
8
|
+
import { IImbricateTextManager } from "../text/manager";
|
|
9
|
+
import { OriginPayload } from "./definition";
|
|
13
10
|
export interface IImbricateOrigin {
|
|
14
|
-
/**
|
|
15
|
-
* Origin type
|
|
16
|
-
*/
|
|
17
|
-
readonly originType: string;
|
|
18
11
|
/**
|
|
19
12
|
* Unique identifier of the origin
|
|
20
13
|
*/
|
|
21
14
|
readonly uniqueIdentifier: string;
|
|
22
15
|
/**
|
|
23
|
-
*
|
|
24
|
-
*/
|
|
25
|
-
readonly metadata: ImbricateOriginMetadata;
|
|
26
|
-
/**
|
|
27
|
-
* Payloads of the origin
|
|
28
|
-
*/
|
|
29
|
-
readonly payloads: Record<string, any>;
|
|
30
|
-
/**
|
|
31
|
-
* Capabilities of the origin
|
|
32
|
-
*/
|
|
33
|
-
readonly capabilities: ImbricateOriginCapability;
|
|
34
|
-
/**
|
|
35
|
-
* Get function manager
|
|
36
|
-
*
|
|
37
|
-
* @returns Function manager
|
|
38
|
-
*/
|
|
39
|
-
getFunctionManager(): IImbricateFunctionManager;
|
|
40
|
-
/**
|
|
41
|
-
* Get binary storage
|
|
42
|
-
*
|
|
43
|
-
* @returns Binary storage
|
|
16
|
+
* Payloads to initialize the origin
|
|
44
17
|
*/
|
|
45
|
-
|
|
18
|
+
readonly payloads: OriginPayload;
|
|
46
19
|
/**
|
|
47
|
-
* Get
|
|
20
|
+
* Get the database manager of the origin
|
|
48
21
|
*
|
|
49
|
-
* @returns
|
|
22
|
+
* @returns the database manager
|
|
50
23
|
*/
|
|
51
|
-
|
|
24
|
+
getDatabaseManager(): IImbricateDatabaseManager;
|
|
52
25
|
/**
|
|
53
|
-
* Get
|
|
26
|
+
* Get the text manager of the origin
|
|
27
|
+
* The text manager is used to manage text objects
|
|
54
28
|
*
|
|
55
|
-
* @returns
|
|
29
|
+
* @returns the text manager
|
|
56
30
|
*/
|
|
57
|
-
|
|
31
|
+
getTextManager(): IImbricateTextManager;
|
|
58
32
|
/**
|
|
59
|
-
* Get
|
|
33
|
+
* Get the static manager of the origin
|
|
34
|
+
* The static manager is used to manage static objects
|
|
60
35
|
*
|
|
61
|
-
* @returns
|
|
36
|
+
* @returns the static manager
|
|
62
37
|
*/
|
|
63
|
-
|
|
38
|
+
getStaticManager(): IImbricateStaticManager;
|
|
64
39
|
/**
|
|
65
40
|
* Dispose the origin, optional
|
|
66
41
|
* This method will be called when the origin is no longer needed
|
|
67
42
|
*/
|
|
68
|
-
dispose?():
|
|
43
|
+
dispose?(): PromiseLike<void>;
|
|
69
44
|
}
|
package/package.json
CHANGED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author WMXPY
|
|
3
|
+
* @namespace Static
|
|
4
|
+
* @description Interface
|
|
5
|
+
*/
|
|
6
|
+
export interface IImbricateStatic {
|
|
7
|
+
/**
|
|
8
|
+
* Unique identifier of the static object
|
|
9
|
+
*/
|
|
10
|
+
readonly uniqueIdentifier: string;
|
|
11
|
+
/**
|
|
12
|
+
* Get the content of the static object
|
|
13
|
+
*
|
|
14
|
+
* @returns a promise of the content of the text, encoded in base64
|
|
15
|
+
*/
|
|
16
|
+
getContentInBase64(): PromiseLike<string>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author WMXPY
|
|
3
|
+
* @namespace Static
|
|
4
|
+
* @description Manager
|
|
5
|
+
*/
|
|
6
|
+
import { IImbricateStatic } from "./interface";
|
|
7
|
+
export interface IImbricateStaticManager {
|
|
8
|
+
/**
|
|
9
|
+
* Get the static object from the origin
|
|
10
|
+
*
|
|
11
|
+
* @returns a promise of the static object, null if not found
|
|
12
|
+
*/
|
|
13
|
+
getStatic(uniqueIdentifier: string): PromiseLike<IImbricateStatic | null>;
|
|
14
|
+
/**
|
|
15
|
+
* Create a new static object in the origin, encoded in base64
|
|
16
|
+
* Static object is immutable, once created, it cannot be changed
|
|
17
|
+
* Patch a new static object if you want to change the content
|
|
18
|
+
*
|
|
19
|
+
* @param content content of the static object, encoded in base64
|
|
20
|
+
* @param uniqueIdentifier unique identifier of the static object, optional
|
|
21
|
+
* if not provided, a unique identifier will be generated
|
|
22
|
+
*
|
|
23
|
+
* @returns a promise of the created static object
|
|
24
|
+
*/
|
|
25
|
+
createInBase64(content: string, uniqueIdentifier?: string): PromiseLike<IImbricateStatic>;
|
|
26
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author WMXPY
|
|
3
|
+
* @namespace Text
|
|
4
|
+
* @description Interface
|
|
5
|
+
*/
|
|
6
|
+
export interface IImbricateText {
|
|
7
|
+
/**
|
|
8
|
+
* Unique identifier of the text object
|
|
9
|
+
*/
|
|
10
|
+
readonly uniqueIdentifier: string;
|
|
11
|
+
/**
|
|
12
|
+
* Get the content of the text object
|
|
13
|
+
*
|
|
14
|
+
* @returns a promise of the content of the text object
|
|
15
|
+
*/
|
|
16
|
+
getContent(): PromiseLike<string>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author WMXPY
|
|
3
|
+
* @namespace Text
|
|
4
|
+
* @description Manager
|
|
5
|
+
*/
|
|
6
|
+
import { IImbricateText } from "./interface";
|
|
7
|
+
export interface IImbricateTextManager {
|
|
8
|
+
/**
|
|
9
|
+
* Get the text object from the origin
|
|
10
|
+
*
|
|
11
|
+
* @returns a promise of the text object, null if not found
|
|
12
|
+
*/
|
|
13
|
+
getText(uniqueIdentifier: string): PromiseLike<IImbricateText | null>;
|
|
14
|
+
/**
|
|
15
|
+
* Create a new text object in the origin
|
|
16
|
+
* Text object is immutable, once created, it cannot be changed
|
|
17
|
+
* Patch a new text object if you want to change the content
|
|
18
|
+
*
|
|
19
|
+
* @param content content of the text
|
|
20
|
+
* @param uniqueIdentifier unique identifier of the text object, optional
|
|
21
|
+
* if not provided, a unique identifier will be generated
|
|
22
|
+
*
|
|
23
|
+
* @returns a promise of the text object
|
|
24
|
+
*/
|
|
25
|
+
createText(content: string, uniqueIdentifier?: string): PromiseLike<IImbricateText>;
|
|
26
|
+
}
|
package/binary-storage/base.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @author WMXPY
|
|
3
|
-
* @namespace BinaryStorage
|
|
4
|
-
* @description Base
|
|
5
|
-
*/
|
|
6
|
-
import { ImbricateCapabilityBuilder } from "../capability/builder";
|
|
7
|
-
import { ImbricateCapability } from "../capability/definition";
|
|
8
|
-
import type { PromiseOr } from "../definition/promise";
|
|
9
|
-
import { IMBRICATE_BINARY_STORAGE_CAPABILITY_KEY, ImbricateBinaryStorageCapability } from "./definition";
|
|
10
|
-
import type { IImbricateBinaryStorage } from "./interface";
|
|
11
|
-
export declare abstract class ImbricateBinaryStorageBase implements IImbricateBinaryStorage {
|
|
12
|
-
static buildCapability(initial?: ImbricateCapability): ImbricateCapabilityBuilder<IMBRICATE_BINARY_STORAGE_CAPABILITY_KEY>;
|
|
13
|
-
static allAllowCapability(): ImbricateBinaryStorageCapability;
|
|
14
|
-
static allDenyCapability(): ImbricateBinaryStorageCapability;
|
|
15
|
-
abstract readonly capabilities: ImbricateBinaryStorageCapability;
|
|
16
|
-
putBinaryBase64(_binary: string, _fileName: string): PromiseOr<string>;
|
|
17
|
-
validateBinaryBase64(_binary: string): PromiseOr<boolean>;
|
|
18
|
-
}
|
package/binary-storage/base.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* @author WMXPY
|
|
4
|
-
* @namespace BinaryStorage
|
|
5
|
-
* @description Base
|
|
6
|
-
*/
|
|
7
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.ImbricateBinaryStorageBase = 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 ImbricateBinaryStorageBase {
|
|
14
|
-
static buildCapability(initial = (0, definition_1.createDenyImbricateCapability)()) {
|
|
15
|
-
return builder_1.ImbricateCapabilityBuilder.create(definition_2.ImbricateBinaryStorageCapabilityList, 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
|
-
putBinaryBase64(_binary, _fileName) {
|
|
24
|
-
throw not_implemented_1.ImbricateNotImplemented.create("PutBinaryBase64", definition_2.IMBRICATE_BINARY_STORAGE_CAPABILITY_KEY.UPLOAD_FILE);
|
|
25
|
-
}
|
|
26
|
-
validateBinaryBase64(_binary) {
|
|
27
|
-
throw not_implemented_1.ImbricateNotImplemented.create("ValidateBinaryBase64", definition_2.IMBRICATE_BINARY_STORAGE_CAPABILITY_KEY.UPLOAD_FILE);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
exports.ImbricateBinaryStorageBase = ImbricateBinaryStorageBase;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @author WMXPY
|
|
3
|
-
* @namespace BinaryStorage
|
|
4
|
-
* @description Definition
|
|
5
|
-
*/
|
|
6
|
-
import type { ImbricateCapabilityRecord } from "../capability/definition";
|
|
7
|
-
export type ImbricateBinaryStorageCapability = ImbricateCapabilityRecord<IMBRICATE_BINARY_STORAGE_CAPABILITY_KEY>;
|
|
8
|
-
export declare enum IMBRICATE_BINARY_STORAGE_CAPABILITY_KEY {
|
|
9
|
-
UPLOAD_FILE = "imbricate.binary.storage.upload"
|
|
10
|
-
}
|
|
11
|
-
export declare const ImbricateBinaryStorageCapabilityList: IMBRICATE_BINARY_STORAGE_CAPABILITY_KEY[];
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* @author WMXPY
|
|
4
|
-
* @namespace BinaryStorage
|
|
5
|
-
* @description Definition
|
|
6
|
-
*/
|
|
7
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.ImbricateBinaryStorageCapabilityList = exports.IMBRICATE_BINARY_STORAGE_CAPABILITY_KEY = void 0;
|
|
9
|
-
var IMBRICATE_BINARY_STORAGE_CAPABILITY_KEY;
|
|
10
|
-
(function (IMBRICATE_BINARY_STORAGE_CAPABILITY_KEY) {
|
|
11
|
-
IMBRICATE_BINARY_STORAGE_CAPABILITY_KEY["UPLOAD_FILE"] = "imbricate.binary.storage.upload";
|
|
12
|
-
})(IMBRICATE_BINARY_STORAGE_CAPABILITY_KEY || (exports.IMBRICATE_BINARY_STORAGE_CAPABILITY_KEY = IMBRICATE_BINARY_STORAGE_CAPABILITY_KEY = {}));
|
|
13
|
-
exports.ImbricateBinaryStorageCapabilityList = [
|
|
14
|
-
IMBRICATE_BINARY_STORAGE_CAPABILITY_KEY.UPLOAD_FILE,
|
|
15
|
-
];
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @author WMXPY
|
|
3
|
-
* @namespace BinaryStorage
|
|
4
|
-
* @description Interface
|
|
5
|
-
*/
|
|
6
|
-
import { PromiseOr } from "../definition/promise";
|
|
7
|
-
import { ImbricateBinaryStorageCapability } from "./definition";
|
|
8
|
-
export interface IImbricateBinaryStorage {
|
|
9
|
-
/**
|
|
10
|
-
* Capabilities of the binary storage
|
|
11
|
-
*/
|
|
12
|
-
readonly capabilities: ImbricateBinaryStorageCapability;
|
|
13
|
-
/**
|
|
14
|
-
* Store a binary file
|
|
15
|
-
*
|
|
16
|
-
* @param binary Base64 encoded binary
|
|
17
|
-
* @param fileName File name
|
|
18
|
-
*/
|
|
19
|
-
putBinaryBase64(binary: string, fileName: string): PromiseOr<string>;
|
|
20
|
-
/**
|
|
21
|
-
* Validate if the binary is a valid base64 to be stored
|
|
22
|
-
*
|
|
23
|
-
* @param binary Base64 encoded binary
|
|
24
|
-
*/
|
|
25
|
-
validateBinaryBase64(binary: string): PromiseOr<boolean>;
|
|
26
|
-
}
|
package/capability/builder.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @author WMXPY
|
|
3
|
-
* @namespace Capability
|
|
4
|
-
* @description Builder
|
|
5
|
-
*/
|
|
6
|
-
import { ImbricateCapability, ImbricateCapabilityKey, ImbricateCapabilityRecord } from "./definition";
|
|
7
|
-
export declare class ImbricateCapabilityBuilder<T extends ImbricateCapabilityKey> {
|
|
8
|
-
static create<T extends ImbricateCapabilityKey>(list: T[], initialValue: ImbricateCapability): ImbricateCapabilityBuilder<T>;
|
|
9
|
-
private readonly _capabilities;
|
|
10
|
-
private constructor();
|
|
11
|
-
set(key: T, value: ImbricateCapability): this;
|
|
12
|
-
allow(key: T): this;
|
|
13
|
-
deny(key: T): this;
|
|
14
|
-
build(): ImbricateCapabilityRecord<T>;
|
|
15
|
-
}
|
package/capability/builder.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* @author WMXPY
|
|
4
|
-
* @namespace Capability
|
|
5
|
-
* @description Builder
|
|
6
|
-
*/
|
|
7
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.ImbricateCapabilityBuilder = void 0;
|
|
9
|
-
const create_1 = require("./create");
|
|
10
|
-
const definition_1 = require("./definition");
|
|
11
|
-
class ImbricateCapabilityBuilder {
|
|
12
|
-
static create(list, initialValue) {
|
|
13
|
-
const capabilities = (0, create_1.createImbricateCapabilityRecord)(list, initialValue);
|
|
14
|
-
return new ImbricateCapabilityBuilder(capabilities);
|
|
15
|
-
}
|
|
16
|
-
constructor(capabilities) {
|
|
17
|
-
this._capabilities = capabilities;
|
|
18
|
-
}
|
|
19
|
-
set(key, value) {
|
|
20
|
-
this._capabilities[key] = value;
|
|
21
|
-
return this;
|
|
22
|
-
}
|
|
23
|
-
allow(key) {
|
|
24
|
-
this._capabilities[key] = (0, definition_1.createAllowImbricateCapability)();
|
|
25
|
-
return this;
|
|
26
|
-
}
|
|
27
|
-
deny(key) {
|
|
28
|
-
this._capabilities[key] = (0, definition_1.createDenyImbricateCapability)();
|
|
29
|
-
return this;
|
|
30
|
-
}
|
|
31
|
-
build() {
|
|
32
|
-
return Object.keys(this._capabilities).reduce((previous, current) => {
|
|
33
|
-
return Object.assign(Object.assign({}, previous), { [current]: this._capabilities[current] });
|
|
34
|
-
}, {});
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
exports.ImbricateCapabilityBuilder = ImbricateCapabilityBuilder;
|
package/capability/create.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @author WMXPY
|
|
3
|
-
* @namespace Capability
|
|
4
|
-
* @description Create
|
|
5
|
-
*/
|
|
6
|
-
import type { ImbricateCapability, ImbricateCapabilityKey, ImbricateCapabilityRecord } from "./definition";
|
|
7
|
-
export declare const createImbricateCapabilityRecord: <T extends ImbricateCapabilityKey>(list: T[], initialValue: ImbricateCapability) => ImbricateCapabilityRecord<T>;
|
package/capability/create.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* @author WMXPY
|
|
4
|
-
* @namespace Capability
|
|
5
|
-
* @description Create
|
|
6
|
-
*/
|
|
7
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.createImbricateCapabilityRecord = void 0;
|
|
9
|
-
const createImbricateCapabilityRecord = (list, initialValue) => {
|
|
10
|
-
const record = {};
|
|
11
|
-
for (const key of list) {
|
|
12
|
-
record[key] = Object.assign({}, initialValue);
|
|
13
|
-
}
|
|
14
|
-
return record;
|
|
15
|
-
};
|
|
16
|
-
exports.createImbricateCapabilityRecord = createImbricateCapabilityRecord;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @author WMXPY
|
|
3
|
-
* @namespace Capability
|
|
4
|
-
* @description Definition
|
|
5
|
-
*/
|
|
6
|
-
export type ImbricateCapabilityKey = string;
|
|
7
|
-
export declare enum IMBRICATE_CAPABILITY_EFFECT {
|
|
8
|
-
ALLOW = "ALLOW",
|
|
9
|
-
DENY = "DENY"
|
|
10
|
-
}
|
|
11
|
-
export type ImbricateCapability = {
|
|
12
|
-
readonly effect: IMBRICATE_CAPABILITY_EFFECT;
|
|
13
|
-
};
|
|
14
|
-
export type ImbricateCapabilityRecord<T extends ImbricateCapabilityKey> = Record<T, ImbricateCapability>;
|
|
15
|
-
export declare const createAllowImbricateCapability: () => ImbricateCapability;
|
|
16
|
-
export declare const createDenyImbricateCapability: () => ImbricateCapability;
|
package/capability/definition.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* @author WMXPY
|
|
4
|
-
* @namespace Capability
|
|
5
|
-
* @description Definition
|
|
6
|
-
*/
|
|
7
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.createDenyImbricateCapability = exports.createAllowImbricateCapability = exports.IMBRICATE_CAPABILITY_EFFECT = void 0;
|
|
9
|
-
var IMBRICATE_CAPABILITY_EFFECT;
|
|
10
|
-
(function (IMBRICATE_CAPABILITY_EFFECT) {
|
|
11
|
-
IMBRICATE_CAPABILITY_EFFECT["ALLOW"] = "ALLOW";
|
|
12
|
-
IMBRICATE_CAPABILITY_EFFECT["DENY"] = "DENY";
|
|
13
|
-
})(IMBRICATE_CAPABILITY_EFFECT || (exports.IMBRICATE_CAPABILITY_EFFECT = IMBRICATE_CAPABILITY_EFFECT = {}));
|
|
14
|
-
const createAllowImbricateCapability = () => {
|
|
15
|
-
return {
|
|
16
|
-
effect: IMBRICATE_CAPABILITY_EFFECT.ALLOW,
|
|
17
|
-
};
|
|
18
|
-
};
|
|
19
|
-
exports.createAllowImbricateCapability = createAllowImbricateCapability;
|
|
20
|
-
const createDenyImbricateCapability = () => {
|
|
21
|
-
return {
|
|
22
|
-
effect: IMBRICATE_CAPABILITY_EFFECT.DENY,
|
|
23
|
-
};
|
|
24
|
-
};
|
|
25
|
-
exports.createDenyImbricateCapability = createDenyImbricateCapability;
|
package/capability/validate.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @author WMXPY
|
|
3
|
-
* @namespace Capability
|
|
4
|
-
* @description Validate
|
|
5
|
-
*/
|
|
6
|
-
import { IMBRICATE_COLLECTION_CAPABILITY_KEY } from "../collection/definition";
|
|
7
|
-
import type { IImbricateCollection } from "../collection/interface";
|
|
8
|
-
import { IMBRICATE_ORIGIN_CAPABILITY_KEY } from "../origin/definition";
|
|
9
|
-
import { IImbricateOrigin } from "../origin/interface";
|
|
10
|
-
import { IMBRICATE_PAGE_CAPABILITY_KEY } from "../page/definition";
|
|
11
|
-
import { IImbricatePage } from "../page/interface";
|
|
12
|
-
import { IMBRICATE_SCRIPT_CAPABILITY_KEY } from "../script/definition";
|
|
13
|
-
import { IImbricateScript } from "../script/interface";
|
|
14
|
-
import { ImbricateCapability } from "./definition";
|
|
15
|
-
export declare const validateImbricateCapability: <CapabilityRecords extends Record<string, ImbricateCapability>, KeySet extends keyof CapabilityRecords>(capabilities: CapabilityRecords, capability: KeySet) => boolean;
|
|
16
|
-
export declare const validateImbricateOriginCapability: (origin: IImbricateOrigin, capability: IMBRICATE_ORIGIN_CAPABILITY_KEY) => boolean;
|
|
17
|
-
export declare const validateImbricateCollectionCapability: (collection: IImbricateCollection, capability: IMBRICATE_COLLECTION_CAPABILITY_KEY) => boolean;
|
|
18
|
-
export declare const validateImbricatePageCapability: (page: IImbricatePage, capability: IMBRICATE_PAGE_CAPABILITY_KEY) => boolean;
|
|
19
|
-
export declare const validateImbricateScriptCapability: (script: IImbricateScript, capability: IMBRICATE_SCRIPT_CAPABILITY_KEY) => boolean;
|