resourcexjs 2.5.4 → 2.5.6

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/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { BundledType, IsolatorType } from "@resourcexjs/type";
1
+ import { BundledType, IsolatorType } from "@resourcexjs/core";
2
2
  /**
3
3
  * ResourceX configuration.
4
4
  */
@@ -20,141 +20,85 @@ interface ResourceXConfig {
20
20
  types?: BundledType[];
21
21
  /**
22
22
  * Isolator type for resolver execution.
23
- * - "none": No isolation (default)
24
- * - "srt": OS-level isolation
25
- * - "cloudflare": Container isolation
26
- * - "e2b": MicroVM isolation
27
23
  */
28
24
  isolator?: IsolatorType;
29
25
  }
30
26
  /**
31
27
  * Resource - user-facing resource object.
32
- *
33
- * Three forms of resource reference:
34
- * - path: local directory (e.g., "./my-prompt")
35
- * - locator: identifier string (e.g., "hello.text@1.0.0")
36
- * - resource: this object with full metadata
37
28
  */
38
29
  interface Resource {
39
- /** Full locator string (e.g., "registry.example.com/hello.text@1.0.0") */
40
30
  locator: string;
41
- /** Resource registry (optional for local resources) */
42
31
  registry?: string;
43
- /** Resource path within registry (optional) */
44
32
  path?: string;
45
- /** Resource name */
46
33
  name: string;
47
- /** Resource type (e.g., "text", "json") */
48
34
  type: string;
49
- /** Tag (e.g., "1.0.0", "latest", "stable") */
50
35
  tag: string;
51
- /** File list in the resource archive */
52
36
  files?: string[];
53
37
  }
54
38
  /**
55
39
  * Executable resource - result of use().
56
40
  */
57
41
  interface Executable<T = unknown> {
58
- /**
59
- * Execute the resource resolver.
60
- */
61
42
  execute: (args?: unknown) => Promise<T>;
62
- /**
63
- * JSON schema for arguments (if any).
64
- */
65
43
  schema?: unknown;
66
44
  }
67
45
  /**
68
46
  * ResourceX interface - unified API for resource management.
69
- *
70
- * Users interact only with:
71
- * - path: local directory
72
- * - locator: resource identifier string (e.g., "hello.text@1.0.0")
73
47
  */
74
48
  interface ResourceX {
75
- /**
76
- * Add resource from directory to local storage.
77
- * @returns The added resource
78
- */
79
49
  add(path: string): Promise<Resource>;
80
- /**
81
- * Link development directory (symlink for live editing).
82
- */
83
- link(path: string): Promise<void>;
84
- /**
85
- * Unlink development directory.
86
- */
87
- unlink(locator: string): Promise<void>;
88
- /**
89
- * Check if resource exists locally.
90
- */
91
50
  has(locator: string): Promise<boolean>;
92
- /**
93
- * Get detailed resource information.
94
- * @returns Resource with files list
95
- */
96
51
  info(locator: string): Promise<Resource>;
97
- /**
98
- * Remove resource from local storage.
99
- */
100
52
  remove(locator: string): Promise<void>;
101
- /**
102
- * Use resource and return executable.
103
- * Checks: linked → local → cache → remote
104
- */
105
53
  use<T = unknown>(locator: string): Promise<Executable<T>>;
106
- /**
107
- * Search local resources.
108
- * @returns Array of locator strings
109
- */
110
54
  search(query?: string): Promise<string[]>;
111
- /**
112
- * Push local resource to remote registry.
113
- */
114
55
  push(locator: string): Promise<void>;
115
- /**
116
- * Pull resource from remote to local cache.
117
- */
118
56
  pull(locator: string): Promise<void>;
119
- /**
120
- * Clear cached resources.
121
- * @param registry - If provided, only clear resources from this registry
122
- */
123
57
  clearCache(registry?: string): Promise<void>;
124
- /**
125
- * Add support for custom resource type.
126
- */
127
58
  supportType(type: BundledType): void;
128
59
  }
129
60
  /**
130
61
  * Create a ResourceX client instance.
131
62
  *
132
- * @example
133
- * ```typescript
134
- * const rx = createResourceX({
135
- * registry: "https://registry.mycompany.com"
136
- * });
137
- *
138
- * // Add from directory to local
139
- * await rx.add("./my-prompt");
63
+ * Requires a provider to be set first via setProvider() or by importing
64
+ * a platform entry point like 'resourcexjs/node'.
65
+ */
66
+ declare function createResourceX(config?: ResourceXConfig): ResourceX;
67
+ import { ResourceXProvider } from "@resourcexjs/core";
68
+ /**
69
+ * Set the global ResourceX provider.
140
70
  *
141
- * // Use and execute
142
- * const result = await rx.use("my-prompt.text@1.0.0");
143
- * await result.execute();
71
+ * This should be called once at application startup, typically by
72
+ * importing a platform-specific entry point like 'resourcexjs/node'.
144
73
  *
145
- * // Push to remote registry
146
- * await rx.push("./my-prompt");
74
+ * @example
75
+ * ```typescript
76
+ * import { setProvider } from 'resourcexjs';
77
+ * import { NodeProvider } from 'resourcexjs/providers/node';
147
78
  *
148
- * // Pull from remote registry
149
- * await rx.pull("my-prompt.text@1.0.0");
79
+ * setProvider(new NodeProvider());
150
80
  * ```
151
81
  */
152
- declare function createResourceX(config?: ResourceXConfig): ResourceX;
82
+ declare function setProvider(provider: ResourceXProvider): void;
83
+ /**
84
+ * Get the current global provider.
85
+ *
86
+ * @throws Error if no provider has been set.
87
+ */
88
+ declare function getProvider(): ResourceXProvider;
89
+ /**
90
+ * Check if a provider has been set.
91
+ */
92
+ declare function hasProvider(): boolean;
93
+ /**
94
+ * Clear the provider (for testing).
95
+ */
96
+ declare function clearProvider(): void;
97
+ import { ResourceXProvider as ResourceXProvider2, ProviderConfig, ProviderStores } from "@resourcexjs/core";
153
98
  import { parse, format, manifest, archive, resource, extract, wrap } from "@resourcexjs/core";
154
99
  import { RXL, RXM, RXA, RXR, RXD } from "@resourcexjs/core";
155
- import { RegistryError } from "@resourcexjs/registry";
156
- import { ResourceTypeError } from "@resourcexjs/type";
157
- import { BundledType as BundledType2, IsolatorType as IsolatorType2 } from "@resourcexjs/type";
158
- import { bundleResourceType } from "@resourcexjs/type";
100
+ import { RegistryError, ResourceTypeError } from "@resourcexjs/core";
101
+ import { BundledType as BundledType2, IsolatorType as IsolatorType2 } from "@resourcexjs/core";
102
+ import { bundleResourceType } from "@resourcexjs/core";
159
103
  declare const VERSION: string;
160
- export { wrap, resource, parse, manifest, format, extract, createResourceX, bundleResourceType, archive, VERSION, ResourceXConfig, ResourceX, ResourceTypeError, Resource, RegistryError, RXR, RXM, RXL, RXD, RXA, IsolatorType2 as IsolatorType, Executable, BundledType2 as BundledType };
104
+ export { wrap, setProvider, resource, parse, manifest, hasProvider, getProvider, format, extract, createResourceX, clearProvider, bundleResourceType, archive, VERSION, ResourceXProvider2 as ResourceXProvider, ResourceXConfig, ResourceX, ResourceTypeError, Resource, RegistryError, RXR, RXM, RXL, RXD, RXA, ProviderStores, ProviderConfig, IsolatorType2 as IsolatorType, Executable, BundledType2 as BundledType };