@imbricate/core 1.6.3 → 1.7.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.
@@ -6,6 +6,9 @@
6
6
  import { PromiseOr } from "../definition/promise";
7
7
  import { ImbricatePageMetadata, ImbricatePageSearchResult, ImbricatePageSnapshot } from "../page/definition";
8
8
  import { IImbricatePage } from "../page/interface";
9
+ export type ImbricateSearchPageConfig = {
10
+ readonly exact?: boolean;
11
+ };
9
12
  export interface IImbricateOriginCollection {
10
13
  readonly collectionName: string;
11
14
  readonly description?: string;
@@ -16,5 +19,5 @@ export interface IImbricateOriginCollection {
16
19
  hasPage(title: string): PromiseOr<boolean>;
17
20
  getPage(identifier: string): PromiseOr<IImbricatePage | null>;
18
21
  listPages(): PromiseOr<ImbricatePageSnapshot[]>;
19
- searchPages(keyword: string): PromiseOr<ImbricatePageSearchResult[]>;
22
+ searchPages(keyword: string, config: ImbricateSearchPageConfig): PromiseOr<ImbricatePageSearchResult[]>;
20
23
  }
@@ -8,6 +8,9 @@ import { PromiseOr } from "../definition/promise";
8
8
  import { ImbricateScriptMetadata, ImbricateScriptSearchResult, ImbricateScriptSnapshot } from "../script/definition";
9
9
  import { IImbricateScript } from "../script/interface";
10
10
  import { ImbricateOriginMetadata } from "./definition";
11
+ export type ImbricateSearchScriptConfig = {
12
+ readonly exact?: boolean;
13
+ };
11
14
  export interface IImbricateOrigin {
12
15
  readonly metadata: ImbricateOriginMetadata;
13
16
  readonly payloads: Record<string, any>;
@@ -24,5 +27,5 @@ export interface IImbricateOrigin {
24
27
  hasScript(scriptName: string): PromiseOr<boolean>;
25
28
  getScript(identifier: string): PromiseOr<IImbricateScript | null>;
26
29
  listScripts(): PromiseOr<ImbricateScriptSnapshot[]>;
27
- searchScripts(keyword: string): PromiseOr<ImbricateScriptSearchResult[]>;
30
+ searchScripts(keyword: string, config: ImbricateSearchScriptConfig): PromiseOr<ImbricateScriptSearchResult[]>;
28
31
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@imbricate/core",
3
3
  "main": "index.js",
4
- "version": "1.6.3",
4
+ "version": "1.7.1",
5
5
  "description": "Core for Imbricate",
6
6
  "repository": {
7
7
  "type": "git",
@@ -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 fromScratch(): SandboxFeatureBuilder;
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 fromScratch() {
12
- return new SandboxFeatureBuilder();
11
+ static providedByOrigin() {
12
+ return new SandboxFeatureBuilder("origin");
13
13
  }
14
- constructor() {
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, this._methodName, this._implementation);
42
+ return feature_1.SandboxFeature.create(`${this._provideBy}:${this._packageName}`, this._methodName, this._implementation);
33
43
  }
34
44
  }
35
45
  exports.SandboxFeatureBuilder = SandboxFeatureBuilder;
@@ -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, config: SandboxExecuteConfig) => Promise<MarkedResult>;
11
+ export declare const executeSandboxScript: (script: string, features: SandboxFeature[], environment: SandboxEnvironment, configuration: SandboxExecuteConfig, parameters: SandboxExecuteParameter) => Promise<MarkedResult>;
@@ -33,10 +33,11 @@ const createSandbox = (features) => {
33
33
  return sandbox;
34
34
  };
35
35
  exports.createSandbox = createSandbox;
36
- const executeSandboxScript = (script, features, environment, config) => __awaiter(void 0, void 0, void 0, function* () {
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("config", config);
39
+ sandbox.inject("configuration", configuration);
40
+ sandbox.inject("parameters", parameters);
40
41
  return yield sandbox.evaluate(script);
41
42
  });
42
43
  exports.executeSandboxScript = executeSandboxScript;