@imbricate/core 1.7.0 → 1.7.2
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/package.json
CHANGED
|
@@ -6,7 +6,11 @@
|
|
|
6
6
|
import { SandboxImplementation } from "../definition/implementation";
|
|
7
7
|
import { SandboxFeature } from "./feature";
|
|
8
8
|
export declare class SandboxFeatureBuilder {
|
|
9
|
-
static
|
|
9
|
+
static providedByOrigin(): SandboxFeatureBuilder;
|
|
10
|
+
static providedBySandbox(): SandboxFeatureBuilder;
|
|
11
|
+
static providedByInterface(): SandboxFeatureBuilder;
|
|
12
|
+
static providedBy(providedBy: string): SandboxFeatureBuilder;
|
|
13
|
+
private readonly _provideBy;
|
|
10
14
|
private _packageName;
|
|
11
15
|
private _methodName;
|
|
12
16
|
private _implementation;
|
|
@@ -8,10 +8,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
8
8
|
exports.SandboxFeatureBuilder = void 0;
|
|
9
9
|
const feature_1 = require("./feature");
|
|
10
10
|
class SandboxFeatureBuilder {
|
|
11
|
-
static
|
|
12
|
-
return new SandboxFeatureBuilder();
|
|
11
|
+
static providedByOrigin() {
|
|
12
|
+
return new SandboxFeatureBuilder("origin");
|
|
13
13
|
}
|
|
14
|
-
|
|
14
|
+
static providedBySandbox() {
|
|
15
|
+
return new SandboxFeatureBuilder("sandbox");
|
|
16
|
+
}
|
|
17
|
+
static providedByInterface() {
|
|
18
|
+
return new SandboxFeatureBuilder("interface");
|
|
19
|
+
}
|
|
20
|
+
static providedBy(providedBy) {
|
|
21
|
+
return new SandboxFeatureBuilder(providedBy);
|
|
22
|
+
}
|
|
23
|
+
constructor(provideBy) {
|
|
24
|
+
this._provideBy = provideBy;
|
|
15
25
|
this._packageName = "";
|
|
16
26
|
this._methodName = "";
|
|
17
27
|
this._implementation = () => null;
|
|
@@ -29,7 +39,7 @@ class SandboxFeatureBuilder {
|
|
|
29
39
|
return this;
|
|
30
40
|
}
|
|
31
41
|
build() {
|
|
32
|
-
return feature_1.SandboxFeature.create(this._packageName
|
|
42
|
+
return feature_1.SandboxFeature.create(`${this._provideBy}:${this._packageName}`, this._methodName, this._implementation);
|
|
33
43
|
}
|
|
34
44
|
}
|
|
35
45
|
exports.SandboxFeatureBuilder = SandboxFeatureBuilder;
|
package/sandbox/sandbox.d.ts
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* @description Sandbox
|
|
5
5
|
*/
|
|
6
6
|
import { MarkedResult, Sandbox } from "@sudoo/marked";
|
|
7
|
-
import { SandboxExecuteConfig } from "./definition/config";
|
|
7
|
+
import { SandboxExecuteConfig, SandboxExecuteParameter } from "./definition/config";
|
|
8
8
|
import { SandboxEnvironment } from "./definition/environment";
|
|
9
9
|
import { SandboxFeature } from "./feature/feature";
|
|
10
10
|
export declare const createSandbox: (features: SandboxFeature[]) => Sandbox;
|
|
11
|
-
export declare const executeSandboxScript: (script: string, features: SandboxFeature[], environment: SandboxEnvironment,
|
|
11
|
+
export declare const executeSandboxScript: (script: string, features: SandboxFeature[], environment: SandboxEnvironment, configuration: SandboxExecuteConfig, parameters: SandboxExecuteParameter) => Promise<MarkedResult>;
|
package/sandbox/sandbox.js
CHANGED
|
@@ -33,10 +33,11 @@ const createSandbox = (features) => {
|
|
|
33
33
|
return sandbox;
|
|
34
34
|
};
|
|
35
35
|
exports.createSandbox = createSandbox;
|
|
36
|
-
const executeSandboxScript = (script, features, environment,
|
|
36
|
+
const executeSandboxScript = (script, features, environment, configuration, parameters) => __awaiter(void 0, void 0, void 0, function* () {
|
|
37
37
|
const sandbox = (0, exports.createSandbox)(features);
|
|
38
38
|
sandbox.inject("environment", environment);
|
|
39
|
-
sandbox.inject("
|
|
39
|
+
sandbox.inject("configuration", configuration);
|
|
40
|
+
sandbox.inject("parameters", parameters);
|
|
40
41
|
return yield sandbox.evaluate(script);
|
|
41
42
|
});
|
|
42
43
|
exports.executeSandboxScript = executeSandboxScript;
|
package/script/interface.d.ts
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
import { MarkedResult } from "@sudoo/marked";
|
|
7
7
|
import { PromiseOr } from "../definition/promise";
|
|
8
8
|
import { SandboxExecuteConfig, SandboxExecuteParameter } from "../sandbox/definition/config";
|
|
9
|
+
import { SandboxFeature } from "../sandbox/feature/feature";
|
|
9
10
|
export interface IImbricateScript {
|
|
10
11
|
readonly scriptName: string;
|
|
11
12
|
readonly identifier: string;
|
|
@@ -14,5 +15,5 @@ export interface IImbricateScript {
|
|
|
14
15
|
readScript(): PromiseOr<string>;
|
|
15
16
|
writeScript(script: string): PromiseOr<void>;
|
|
16
17
|
refreshUpdatedAt(updatedAt: Date): PromiseOr<void>;
|
|
17
|
-
execute(config: SandboxExecuteConfig, parameter: SandboxExecuteParameter): PromiseOr<MarkedResult>;
|
|
18
|
+
execute(features: SandboxFeature[], config: SandboxExecuteConfig, parameter: SandboxExecuteParameter): PromiseOr<MarkedResult>;
|
|
18
19
|
}
|