resourcexjs 2.19.0 → 2.21.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/dist/arp.js CHANGED
@@ -13,13 +13,6 @@ var __export = (target, all) => {
13
13
  });
14
14
  };
15
15
  var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
16
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
17
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
18
- }) : x)(function(x) {
19
- if (typeof require !== "undefined")
20
- return require.apply(this, arguments);
21
- throw Error('Dynamic require of "' + x + '" is not supported');
22
- });
23
16
 
24
17
  // src/arp.ts
25
18
  import {
@@ -59,4 +52,4 @@ export {
59
52
  ARP
60
53
  };
61
54
 
62
- //# debugId=C5D905594912983064756E2164756E21
55
+ //# debugId=E08126650720F16B64756E2164756E21
package/dist/arp.js.map CHANGED
@@ -4,7 +4,7 @@
4
4
  "sourcesContent": [
5
5
  "/**\n * ARP (Agent Resource Protocol) - Re-exported from @resourcexjs/arp\n *\n * @example\n * ```typescript\n * import { createARP } from \"resourcexjs/arp\";\n *\n * const arp = createARP();\n * const arl = arp.parse(\"arp:text:file:///path/to/file.txt\");\n * const resource = await arl.resolve();\n * ```\n *\n * For more details, see @resourcexjs/arp documentation.\n */\n\n// Re-export everything from @resourcexjs/arp\nexport {\n type ARI,\n type ARL,\n ARP,\n type ARPConfig,\n ARPError,\n type BinaryInput,\n type BinaryResource,\n BinarySemanticHandler,\n binarySemantic,\n createARP,\n FileTransportHandler,\n fileTransport,\n HttpTransportHandler,\n httpsTransport,\n httpTransport,\n ParseError,\n type Resource,\n type ResourceMeta,\n type SemanticContext,\n SemanticError,\n type SemanticHandler,\n type TextResource,\n TextSemanticHandler,\n TransportError,\n type TransportHandler,\n type TransportParams,\n type TransportResult,\n textSemantic,\n VERSION,\n} from \"@resourcexjs/arp\";\n"
6
6
  ],
7
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAgBA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;",
8
- "debugId": "C5D905594912983064756E2164756E21",
7
+ "mappings": ";;;;;;;;;;;;;;;;;AAgBA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;",
8
+ "debugId": "E08126650720F16B64756E2164756E21",
9
9
  "names": []
10
10
  }
package/dist/index.d.ts CHANGED
@@ -96,6 +96,7 @@ interface ResourceX {
96
96
  resolve<T = unknown>(locator: string, args?: unknown): Promise<T>;
97
97
  ingest<T = unknown>(locator: RXL, args?: unknown): Promise<T>;
98
98
  search(query?: string): Promise<string[]>;
99
+ getFile(locator: string, file: string): Promise<Buffer | null>;
99
100
  push(locator: string, options?: RegistryOptions): Promise<RXM>;
100
101
  pull(locator: string, options?: RegistryOptions): Promise<void>;
101
102
  clearCache(registry?: string): Promise<void>;
package/dist/index.js CHANGED
@@ -13,13 +13,6 @@ var __export = (target, all) => {
13
13
  });
14
14
  };
15
15
  var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
16
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
17
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
18
- }) : x)(function(x) {
19
- if (typeof require !== "undefined")
20
- return require.apply(this, arguments);
21
- throw Error('Dynamic require of "' + x + '" is not supported');
22
- });
23
16
 
24
17
  // ../core/dist/index.js
25
18
  var exports_dist = {};
@@ -5370,6 +5363,16 @@ class CASRegistry {
5370
5363
  tag: m.tag
5371
5364
  }));
5372
5365
  }
5366
+ async getFile(rxi, file2) {
5367
+ const tag = await this.resolveTag(rxi.name, rxi.tag ?? "latest", rxi.registry);
5368
+ const storedRxm = await this.rxmStore.get(rxi.name, tag, rxi.registry);
5369
+ if (!storedRxm)
5370
+ return null;
5371
+ const digest = storedRxm.files[file2];
5372
+ if (!digest)
5373
+ return null;
5374
+ return this.rxaStore.get(digest);
5375
+ }
5373
5376
  async getStoredManifest(rxi) {
5374
5377
  const tag = await this.resolveTag(rxi.name, rxi.tag ?? "latest", rxi.registry);
5375
5378
  return this.rxmStore.get(rxi.name, tag, rxi.registry);
@@ -15649,6 +15652,10 @@ class DefaultResourceX {
15649
15652
  const rxl = parse5(locator);
15650
15653
  await this.cas.remove(rxl);
15651
15654
  }
15655
+ async getFile(locator, file2) {
15656
+ const rxl = parse5(locator);
15657
+ return this.cas.getFile(rxl, file2);
15658
+ }
15652
15659
  async resolve(locator, args2) {
15653
15660
  const executable = await this.prepareExecutable(locator);
15654
15661
  return executable.execute(args2);
@@ -15889,40 +15896,18 @@ class DefaultResourceX {
15889
15896
  if (this.isolator === "custom" && this.executor) {
15890
15897
  return this.executor(code, context, args);
15891
15898
  }
15892
- if (this.isolator === "none") {
15893
- const resolverMatch = code.match(/\/\/ @resolver: (\w+)/);
15894
- if (resolverMatch) {
15895
- const resolverName = resolverMatch[1];
15896
- const evalCode = `
15899
+ const resolverMatch = code.match(/\/\/ @resolver: (\w+)/);
15900
+ if (resolverMatch) {
15901
+ const resolverName = resolverMatch[1];
15902
+ const evalCode = `
15897
15903
  ${code}
15898
15904
  ${resolverName};
15899
15905
  `;
15900
- const resolver = eval(evalCode);
15901
- return resolver.resolve(context, args);
15902
- } else {
15903
- const resolver = eval(`(${code})`);
15904
- return resolver.resolve(context, args);
15905
- }
15906
+ const resolver = eval(evalCode);
15907
+ return resolver.resolve(context, args);
15906
15908
  } else {
15907
- const { createSandbox } = await import("sandboxxjs");
15908
- const sandbox = createSandbox({ type: this.isolator });
15909
- const resolverMatch2 = code.match(/\/\/ @resolver: (\w+)/);
15910
- const resolverName2 = resolverMatch2 ? resolverMatch2[1] : "resolver";
15911
- const script = resolverMatch2 ? `
15912
- ${code}
15913
- const ctx = ${JSON.stringify(context)};
15914
- const args = ${JSON.stringify(args)};
15915
- const result = await ${resolverName2}.resolve(ctx, args);
15916
- console.log(JSON.stringify(result));
15917
- ` : `
15918
- const resolver = ${code};
15919
- const ctx = ${JSON.stringify(context)};
15920
- const args = ${JSON.stringify(args)};
15921
- const result = await resolver.resolve(ctx, args);
15922
- console.log(JSON.stringify(result));
15923
- `;
15924
- const result = await sandbox.execute(script);
15925
- return JSON.parse(result.stdout);
15909
+ const resolver = eval(`(${code})`);
15910
+ return resolver.resolve(context, args);
15926
15911
  }
15927
15912
  }
15928
15913
  }
@@ -15941,7 +15926,7 @@ function createResourceX(config2) {
15941
15926
  }
15942
15927
 
15943
15928
  // src/index.ts
15944
- var VERSION = "2.19.0";
15929
+ var VERSION = "2.21.0";
15945
15930
  export {
15946
15931
  wrap,
15947
15932
  setProvider,
@@ -15967,4 +15952,4 @@ export {
15967
15952
  GitHubSourceLoader
15968
15953
  };
15969
15954
 
15970
- //# debugId=AF30FD388973382E64756E2164756E21
15955
+ //# debugId=157DD7F95579016964756E2164756E21