resourcexjs 2.4.1 → 2.5.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.d.ts +3 -17
- package/dist/arp.js +2301 -20355
- package/dist/arp.js.map +9 -7
- package/dist/index.d.ts +119 -19
- package/dist/index.js +2554 -6943
- package/dist/index.js.map +11 -8
- package/package.json +8 -6
package/dist/index.d.ts
CHANGED
|
@@ -1,21 +1,121 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { BundledType, IsolatorType } from "@resourcexjs/type";
|
|
2
|
+
/**
|
|
3
|
+
* ResourceX configuration.
|
|
4
|
+
*/
|
|
5
|
+
interface ResourceXConfig {
|
|
6
|
+
/**
|
|
7
|
+
* Base path for local storage.
|
|
8
|
+
* Default: ~/.resourcex
|
|
9
|
+
*/
|
|
10
|
+
path?: string;
|
|
11
|
+
domain?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Central registry URL.
|
|
14
|
+
* Required for push/pull operations.
|
|
15
|
+
*/
|
|
16
|
+
registry?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Additional custom resource types.
|
|
19
|
+
* Built-in types (text, json, binary) are always included.
|
|
20
|
+
*/
|
|
21
|
+
types?: BundledType[];
|
|
22
|
+
/**
|
|
23
|
+
* Isolator type for resolver execution.
|
|
24
|
+
* - "none": No isolation (default)
|
|
25
|
+
* - "srt": OS-level isolation
|
|
26
|
+
* - "cloudflare": Container isolation
|
|
27
|
+
* - "e2b": MicroVM isolation
|
|
28
|
+
*/
|
|
29
|
+
isolator?: IsolatorType;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Executable resource - result of resolve().
|
|
33
|
+
*/
|
|
34
|
+
interface Executable<T = unknown> {
|
|
35
|
+
/**
|
|
36
|
+
* Execute the resource resolver.
|
|
37
|
+
*/
|
|
38
|
+
execute: (args?: unknown) => Promise<T>;
|
|
39
|
+
/**
|
|
40
|
+
* JSON schema for arguments (if any).
|
|
41
|
+
*/
|
|
42
|
+
schema?: unknown;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* ResourceX interface - unified API for resource management.
|
|
46
|
+
*
|
|
47
|
+
* Users interact only with:
|
|
48
|
+
* - path: local directory
|
|
49
|
+
* - locator: resource identifier string (e.g., "hello.text@1.0.0")
|
|
50
|
+
*/
|
|
51
|
+
interface ResourceX {
|
|
52
|
+
/**
|
|
53
|
+
* Add resource from directory to local storage.
|
|
54
|
+
*/
|
|
55
|
+
add(path: string): Promise<void>;
|
|
56
|
+
/**
|
|
57
|
+
* Link development directory (symlink for live editing).
|
|
58
|
+
*/
|
|
59
|
+
link(path: string): Promise<void>;
|
|
60
|
+
/**
|
|
61
|
+
* Check if resource exists locally.
|
|
62
|
+
*/
|
|
63
|
+
has(locator: string): Promise<boolean>;
|
|
64
|
+
/**
|
|
65
|
+
* Remove resource from local storage.
|
|
66
|
+
*/
|
|
67
|
+
remove(locator: string): Promise<void>;
|
|
68
|
+
/**
|
|
69
|
+
* Resolve resource and return executable.
|
|
70
|
+
* Checks: linked → hosted → cache → remote
|
|
71
|
+
*/
|
|
72
|
+
resolve<T = unknown>(locator: string): Promise<Executable<T>>;
|
|
73
|
+
/**
|
|
74
|
+
* Search local resources.
|
|
75
|
+
* @returns Array of locator strings
|
|
76
|
+
*/
|
|
77
|
+
search(query?: string): Promise<string[]>;
|
|
78
|
+
/**
|
|
79
|
+
* Push resource from directory to remote registry.
|
|
80
|
+
*/
|
|
81
|
+
push(path: string): Promise<void>;
|
|
82
|
+
/**
|
|
83
|
+
* Pull resource from remote to local cache.
|
|
84
|
+
*/
|
|
85
|
+
pull(locator: string): Promise<void>;
|
|
86
|
+
/**
|
|
87
|
+
* Add support for custom resource type.
|
|
88
|
+
*/
|
|
89
|
+
supportType(type: BundledType): void;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Create a ResourceX client instance.
|
|
93
|
+
*
|
|
94
|
+
* @example
|
|
95
|
+
* ```typescript
|
|
96
|
+
* const rx = createResourceX({
|
|
97
|
+
* domain: "mycompany.com",
|
|
98
|
+
* registry: "https://registry.mycompany.com"
|
|
99
|
+
* });
|
|
100
|
+
*
|
|
101
|
+
* // Add from directory to local
|
|
102
|
+
* await rx.add("./my-prompt");
|
|
103
|
+
*
|
|
104
|
+
* // Resolve and execute
|
|
105
|
+
* const result = await rx.resolve("my-prompt.text@1.0.0");
|
|
106
|
+
* await result.execute();
|
|
107
|
+
*
|
|
108
|
+
* // Push to remote registry
|
|
109
|
+
* await rx.push("./my-prompt");
|
|
110
|
+
*
|
|
111
|
+
* // Pull from remote registry
|
|
112
|
+
* await rx.pull("my-prompt.text@1.0.0");
|
|
113
|
+
* ```
|
|
114
|
+
*/
|
|
115
|
+
declare function createResourceX(config?: ResourceXConfig): ResourceX;
|
|
3
116
|
import { RegistryError } from "@resourcexjs/registry";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { createRXM } from "@resourcexjs/core";
|
|
8
|
-
import { RXA, RXP, RXAInput, PathNode } from "@resourcexjs/core";
|
|
9
|
-
import { createRXA } from "@resourcexjs/core";
|
|
10
|
-
import { RXR } from "@resourcexjs/core";
|
|
11
|
-
import { ResourceType, ResourceResolver, ResolvedResource, JSONSchema, BundledType, IsolatorType } from "@resourcexjs/type";
|
|
12
|
-
import { TypeHandlerChain, bundleResourceType } from "@resourcexjs/type";
|
|
13
|
-
import { textType, jsonType, binaryType, builtinTypes } from "@resourcexjs/type";
|
|
14
|
-
import { ResourceLoader } from "@resourcexjs/loader";
|
|
15
|
-
import { loadResource, FolderLoader } from "@resourcexjs/loader";
|
|
16
|
-
import { LoadResourceConfig } from "@resourcexjs/loader";
|
|
17
|
-
import { Registry, RegistryConfig, ClientRegistryConfig, ServerRegistryConfig, CreateRegistryConfig, DiscoveryResult, WellKnownResponse, Storage, SearchOptions } from "@resourcexjs/registry";
|
|
18
|
-
import { DefaultRegistry, createRegistry, discoverRegistry, LocalStorage } from "@resourcexjs/registry";
|
|
19
|
-
import { RegistryMiddleware, DomainValidation, withDomainValidation } from "@resourcexjs/registry";
|
|
117
|
+
import { ResourceTypeError } from "@resourcexjs/type";
|
|
118
|
+
import { BundledType as BundledType2, IsolatorType as IsolatorType2 } from "@resourcexjs/type";
|
|
119
|
+
import { bundleResourceType } from "@resourcexjs/type";
|
|
20
120
|
declare const VERSION: string;
|
|
21
|
-
export {
|
|
121
|
+
export { createResourceX, bundleResourceType, VERSION, ResourceXConfig, ResourceX, ResourceTypeError, RegistryError, IsolatorType2 as IsolatorType, Executable, BundledType2 as BundledType };
|