@resourcexjs/registry 1.6.0 → 1.7.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/index.d.ts +81 -13
- package/dist/index.js +156 -517
- package/dist/index.js.map +7 -6
- package/package.json +3 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { RXR, RXL } from "@resourcexjs/core";
|
|
2
2
|
import { ResourceType, ResolvedResource } from "@resourcexjs/type";
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Local registry configuration.
|
|
5
|
+
* Uses filesystem for storage.
|
|
5
6
|
*/
|
|
6
|
-
interface
|
|
7
|
+
interface LocalRegistryConfig {
|
|
7
8
|
/**
|
|
8
9
|
* Local storage path. Defaults to ~/.resourcex
|
|
9
10
|
*/
|
|
@@ -15,6 +16,25 @@ interface RegistryConfig {
|
|
|
15
16
|
types?: ResourceType[];
|
|
16
17
|
}
|
|
17
18
|
/**
|
|
19
|
+
* Remote registry configuration.
|
|
20
|
+
* Uses HTTP API for access.
|
|
21
|
+
*/
|
|
22
|
+
interface RemoteRegistryConfig {
|
|
23
|
+
/**
|
|
24
|
+
* Remote registry API endpoint.
|
|
25
|
+
* Example: "https://registry.deepractice.ai/v1"
|
|
26
|
+
*/
|
|
27
|
+
endpoint: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Registry configuration - either local or remote.
|
|
31
|
+
*/
|
|
32
|
+
type RegistryConfig = LocalRegistryConfig | RemoteRegistryConfig;
|
|
33
|
+
/**
|
|
34
|
+
* Type guard to check if config is for remote registry.
|
|
35
|
+
*/
|
|
36
|
+
declare function isRemoteConfig(config?: RegistryConfig): config is RemoteRegistryConfig;
|
|
37
|
+
/**
|
|
18
38
|
* Search options for querying resources.
|
|
19
39
|
*/
|
|
20
40
|
interface SearchOptions {
|
|
@@ -49,6 +69,12 @@ interface Registry {
|
|
|
49
69
|
*/
|
|
50
70
|
link(resource: RXR): Promise<void>;
|
|
51
71
|
/**
|
|
72
|
+
* Get raw resource by locator string.
|
|
73
|
+
* Returns the RXR (locator + manifest + content) without resolving.
|
|
74
|
+
* Use this when you need access to raw resource content.
|
|
75
|
+
*/
|
|
76
|
+
get(locator: string): Promise<RXR>;
|
|
77
|
+
/**
|
|
52
78
|
* Resolve resource by locator string.
|
|
53
79
|
* Returns a ResolvedResource with execute function and original resource.
|
|
54
80
|
* Checks local first, then fetches from remote if not found.
|
|
@@ -82,23 +108,22 @@ declare class RegistryError extends ResourceXError {
|
|
|
82
108
|
import { RXR as RXR2, RXL as RXL2 } from "@resourcexjs/core";
|
|
83
109
|
import { ResourceType as ResourceType2, ResolvedResource as ResolvedResource2 } from "@resourcexjs/type";
|
|
84
110
|
/**
|
|
85
|
-
*
|
|
86
|
-
* Uses
|
|
87
|
-
* Each instance has its own TypeHandlerChain for type handling.
|
|
111
|
+
* Local filesystem-based registry implementation.
|
|
112
|
+
* Uses Node.js fs module directly for storage operations.
|
|
88
113
|
*/
|
|
89
|
-
declare class
|
|
90
|
-
private readonly arp;
|
|
114
|
+
declare class LocalRegistry implements Registry {
|
|
91
115
|
private readonly basePath;
|
|
92
116
|
private readonly typeHandler;
|
|
93
|
-
constructor(config?:
|
|
117
|
+
constructor(config?: LocalRegistryConfig);
|
|
94
118
|
supportType(type: ResourceType2): void;
|
|
95
119
|
/**
|
|
96
|
-
* Build
|
|
97
|
-
* Path structure: {basePath}/{domain}/{path}/{name}.{type}/{version}
|
|
120
|
+
* Build filesystem path for a resource.
|
|
121
|
+
* Path structure: {basePath}/{domain}/{path}/{name}.{type}/{version}
|
|
98
122
|
*/
|
|
99
|
-
private
|
|
123
|
+
private buildPath;
|
|
100
124
|
publish(_resource: RXR2): Promise<void>;
|
|
101
125
|
link(resource: RXR2): Promise<void>;
|
|
126
|
+
get(locator: string): Promise<RXR2>;
|
|
102
127
|
resolve<
|
|
103
128
|
TArgs = void,
|
|
104
129
|
TResult = unknown
|
|
@@ -107,14 +132,57 @@ declare class ARPRegistry implements Registry {
|
|
|
107
132
|
delete(locator: string): Promise<void>;
|
|
108
133
|
search(options?: SearchOptions): Promise<RXL2[]>;
|
|
109
134
|
/**
|
|
135
|
+
* Recursively list all files in a directory.
|
|
136
|
+
*/
|
|
137
|
+
private listRecursive;
|
|
138
|
+
/**
|
|
110
139
|
* Parse a file entry path to RXL.
|
|
111
140
|
* Entry format: {domain}/{path}/{name}.{type}/{version}/manifest.json
|
|
112
141
|
*/
|
|
113
142
|
private parseEntryToRXL;
|
|
114
143
|
}
|
|
144
|
+
import { RXR as RXR3, RXL as RXL3 } from "@resourcexjs/core";
|
|
145
|
+
import { ResourceType as ResourceType3, ResolvedResource as ResolvedResource3 } from "@resourcexjs/type";
|
|
146
|
+
/**
|
|
147
|
+
* Remote registry implementation.
|
|
148
|
+
* Uses HTTP API for resource access.
|
|
149
|
+
*/
|
|
150
|
+
declare class RemoteRegistry implements Registry {
|
|
151
|
+
private readonly endpoint;
|
|
152
|
+
private readonly typeHandler;
|
|
153
|
+
constructor(config: RemoteRegistryConfig);
|
|
154
|
+
supportType(type: ResourceType3): void;
|
|
155
|
+
publish(_resource: RXR3): Promise<void>;
|
|
156
|
+
link(_resource: RXR3): Promise<void>;
|
|
157
|
+
get(locator: string): Promise<RXR3>;
|
|
158
|
+
resolve<
|
|
159
|
+
TArgs = void,
|
|
160
|
+
TResult = unknown
|
|
161
|
+
>(locator: string): Promise<ResolvedResource3<TArgs, TResult>>;
|
|
162
|
+
exists(locator: string): Promise<boolean>;
|
|
163
|
+
delete(_locator: string): Promise<void>;
|
|
164
|
+
search(options?: SearchOptions): Promise<RXL3[]>;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Discover registry endpoint for a domain using well-known.
|
|
168
|
+
* @param domain - The domain to discover (e.g., "deepractice.ai")
|
|
169
|
+
* @returns The registry endpoint URL
|
|
170
|
+
*/
|
|
171
|
+
declare function discoverRegistry(domain: string): Promise<string>;
|
|
115
172
|
/**
|
|
116
173
|
* Create a registry instance.
|
|
117
|
-
*
|
|
174
|
+
*
|
|
175
|
+
* @param config - Registry configuration
|
|
176
|
+
* - No config or LocalRegistryConfig: Creates LocalRegistry (filesystem-based)
|
|
177
|
+
* - RemoteRegistryConfig: Creates RemoteRegistry (HTTP-based)
|
|
178
|
+
*
|
|
179
|
+
* @example
|
|
180
|
+
* // Local registry (default)
|
|
181
|
+
* const registry = createRegistry();
|
|
182
|
+
* const registry2 = createRegistry({ path: "./custom-path" });
|
|
183
|
+
*
|
|
184
|
+
* // Remote registry
|
|
185
|
+
* const registry3 = createRegistry({ endpoint: "https://registry.deepractice.ai/v1" });
|
|
118
186
|
*/
|
|
119
187
|
declare function createRegistry(config?: RegistryConfig): Registry;
|
|
120
|
-
export { createRegistry, SearchOptions, RegistryError, RegistryConfig, Registry,
|
|
188
|
+
export { isRemoteConfig, discoverRegistry, createRegistry, SearchOptions, RemoteRegistryConfig, RemoteRegistry, RegistryError, RegistryConfig, Registry, LocalRegistryConfig, LocalRegistry };
|