@resourcexjs/core 2.9.0 → 2.10.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/README.md +31 -22
- package/dist/index.d.ts +51 -38
- package/dist/index.js +57 -57
- package/dist/index.js.map +10 -10
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -14,15 +14,16 @@ bun add @resourcexjs/core
|
|
|
14
14
|
|
|
15
15
|
## Core Concepts
|
|
16
16
|
|
|
17
|
-
ResourceX uses a layered architecture with
|
|
17
|
+
ResourceX uses a layered architecture with six core primitives:
|
|
18
18
|
|
|
19
19
|
| Primitive | Description |
|
|
20
20
|
| --------- | -------------------------------------------------------- |
|
|
21
21
|
| **RXD** | Resource Definition - content of `resource.json` |
|
|
22
|
-
| **
|
|
22
|
+
| **RXI** | Resource Identifier - structured identifier `{ registry?, path?, name, tag }` |
|
|
23
|
+
| **RXL** | Resource Locator - unified locator string (RXI string, directory path, or URL) |
|
|
23
24
|
| **RXM** | Resource Manifest - metadata stored within the resource |
|
|
24
25
|
| **RXA** | Resource Archive - tar.gz container for storage/transfer |
|
|
25
|
-
| **RXR** | Resource - complete resource (
|
|
26
|
+
| **RXR** | Resource - complete resource (RXI + RXM + RXA) |
|
|
26
27
|
|
|
27
28
|
### Locator Format
|
|
28
29
|
|
|
@@ -38,14 +39,14 @@ registry.example.com/org/hello -> registry=registry.example.com, path=org, name
|
|
|
38
39
|
|
|
39
40
|
## API
|
|
40
41
|
|
|
41
|
-
### `parse(locator: string):
|
|
42
|
+
### `parse(locator: string): RXI`
|
|
42
43
|
|
|
43
|
-
Parse a locator string into an
|
|
44
|
+
Parse a locator string into an RXI object.
|
|
44
45
|
|
|
45
46
|
```typescript
|
|
46
47
|
import { parse } from "@resourcexjs/core";
|
|
47
48
|
|
|
48
|
-
const
|
|
49
|
+
const rxi = parse("registry.example.com/prompts/hello:1.0.0");
|
|
49
50
|
// {
|
|
50
51
|
// registry: "registry.example.com",
|
|
51
52
|
// path: "prompts",
|
|
@@ -57,9 +58,9 @@ const simple = parse("hello");
|
|
|
57
58
|
// { registry: undefined, path: undefined, name: "hello", tag: "latest" }
|
|
58
59
|
```
|
|
59
60
|
|
|
60
|
-
### `format(
|
|
61
|
+
### `format(rxi: RXI): string`
|
|
61
62
|
|
|
62
|
-
Format an
|
|
63
|
+
Format an RXI object back to a locator string.
|
|
63
64
|
|
|
64
65
|
```typescript
|
|
65
66
|
import { format } from "@resourcexjs/core";
|
|
@@ -121,14 +122,14 @@ const rxm = manifest(rxd);
|
|
|
121
122
|
// { name: "my-prompt", type: "text", tag: "1.0.0" }
|
|
122
123
|
```
|
|
123
124
|
|
|
124
|
-
### `locate(rxm: RXM):
|
|
125
|
+
### `locate(rxm: RXM): RXI`
|
|
125
126
|
|
|
126
|
-
Create
|
|
127
|
+
Create an identifier from a manifest.
|
|
127
128
|
|
|
128
129
|
```typescript
|
|
129
130
|
import { locate } from "@resourcexjs/core";
|
|
130
131
|
|
|
131
|
-
const
|
|
132
|
+
const rxi = locate({
|
|
132
133
|
registry: "example.com",
|
|
133
134
|
path: "prompts",
|
|
134
135
|
name: "hello",
|
|
@@ -212,7 +213,7 @@ const rxm = manifest(rxd);
|
|
|
212
213
|
const rxa = await archive({ content: Buffer.from("Hello!") });
|
|
213
214
|
const rxr = resource(rxm, rxa);
|
|
214
215
|
// {
|
|
215
|
-
//
|
|
216
|
+
// identifier: { name: "hello", tag: "1.0.0" },
|
|
216
217
|
// manifest: { name: "hello", type: "text", tag: "1.0.0" },
|
|
217
218
|
// archive: RXA
|
|
218
219
|
// }
|
|
@@ -240,12 +241,12 @@ interface RXD {
|
|
|
240
241
|
}
|
|
241
242
|
```
|
|
242
243
|
|
|
243
|
-
###
|
|
244
|
+
### RXI - Resource Identifier
|
|
244
245
|
|
|
245
|
-
|
|
246
|
+
Structured identifier for a resource.
|
|
246
247
|
|
|
247
248
|
```typescript
|
|
248
|
-
interface
|
|
249
|
+
interface RXI {
|
|
249
250
|
readonly registry?: string; // e.g., "localhost:3098", "registry.example.com"
|
|
250
251
|
readonly path?: string; // e.g., "org", "prompts"
|
|
251
252
|
readonly name: string; // Resource name
|
|
@@ -253,6 +254,14 @@ interface RXL {
|
|
|
253
254
|
}
|
|
254
255
|
```
|
|
255
256
|
|
|
257
|
+
### RXL - Resource Locator
|
|
258
|
+
|
|
259
|
+
Unified locator string. Can be an RXI string, directory path, or URL.
|
|
260
|
+
|
|
261
|
+
```typescript
|
|
262
|
+
type RXL = string;
|
|
263
|
+
```
|
|
264
|
+
|
|
256
265
|
### RXM - Resource Manifest
|
|
257
266
|
|
|
258
267
|
Resource metadata stored within the resource.
|
|
@@ -281,11 +290,11 @@ interface RXA {
|
|
|
281
290
|
|
|
282
291
|
### RXR - Resource
|
|
283
292
|
|
|
284
|
-
Complete resource object combining
|
|
293
|
+
Complete resource object combining identifier, manifest, and archive.
|
|
285
294
|
|
|
286
295
|
```typescript
|
|
287
296
|
interface RXR {
|
|
288
|
-
readonly
|
|
297
|
+
readonly identifier: RXI;
|
|
289
298
|
readonly manifest: RXM;
|
|
290
299
|
readonly archive: RXA;
|
|
291
300
|
}
|
|
@@ -324,7 +333,7 @@ try {
|
|
|
324
333
|
|
|
325
334
|
```
|
|
326
335
|
ResourceXError (base)
|
|
327
|
-
├── LocatorError -
|
|
336
|
+
├── LocatorError - RXI parsing errors
|
|
328
337
|
├── ManifestError - RXM validation errors
|
|
329
338
|
├── ContentError - RXA operations errors
|
|
330
339
|
└── DefinitionError - RXD validation errors
|
|
@@ -357,7 +366,7 @@ const rxa = await archive({
|
|
|
357
366
|
const rxr: RXR = resource(rxm, rxa);
|
|
358
367
|
|
|
359
368
|
// 5. Access locator string
|
|
360
|
-
const locatorStr = format(rxr.
|
|
369
|
+
const locatorStr = format(rxr.identifier);
|
|
361
370
|
console.log(locatorStr); // "assistant-prompt:1.0.0"
|
|
362
371
|
|
|
363
372
|
// 6. Extract files when needed
|
|
@@ -381,13 +390,13 @@ const cas = new CASRegistry(new MemoryRXAStore(), new MemoryRXMStore());
|
|
|
381
390
|
await cas.put(rxr);
|
|
382
391
|
|
|
383
392
|
// Get a resource
|
|
384
|
-
const rxr = await cas.get(
|
|
393
|
+
const rxr = await cas.get(rxi);
|
|
385
394
|
|
|
386
395
|
// Check existence
|
|
387
|
-
const exists = await cas.has(
|
|
396
|
+
const exists = await cas.has(rxi);
|
|
388
397
|
|
|
389
398
|
// Remove a resource
|
|
390
|
-
await cas.remove(
|
|
399
|
+
await cas.remove(rxi);
|
|
391
400
|
|
|
392
401
|
// List resources
|
|
393
402
|
const results = await cas.list({ query: "prompt", limit: 10 });
|
package/dist/index.d.ts
CHANGED
|
@@ -51,9 +51,9 @@ declare function define(input: unknown): RXD;
|
|
|
51
51
|
*/
|
|
52
52
|
declare function extract(rxa: RXA): Promise<Record<string, Buffer>>;
|
|
53
53
|
/**
|
|
54
|
-
*
|
|
54
|
+
* RXI - ResourceX Identifier
|
|
55
55
|
*
|
|
56
|
-
*
|
|
56
|
+
* Structured identifier for a resource (pure data object).
|
|
57
57
|
* Docker-style format with optional tag.
|
|
58
58
|
*
|
|
59
59
|
* Format: [registry/][path/]name[:tag]
|
|
@@ -65,7 +65,7 @@ declare function extract(rxa: RXA): Promise<Record<string, Buffer>>;
|
|
|
65
65
|
* - localhost:3098/hello:1.0.0 → registry=localhost:3098, name=hello, tag=1.0.0
|
|
66
66
|
* - registry.example.com/org/hello:latest → registry=registry.example.com, path=org, name=hello, tag=latest
|
|
67
67
|
*/
|
|
68
|
-
interface
|
|
68
|
+
interface RXI {
|
|
69
69
|
/** Registry host:port (e.g., "localhost:3098", "registry.example.com") */
|
|
70
70
|
readonly registry?: string;
|
|
71
71
|
/** Path within registry (e.g., "org", "prompts") */
|
|
@@ -76,7 +76,7 @@ interface RXL {
|
|
|
76
76
|
readonly tag: string;
|
|
77
77
|
}
|
|
78
78
|
/**
|
|
79
|
-
* Format
|
|
79
|
+
* Format RXI to locator string.
|
|
80
80
|
*
|
|
81
81
|
* Docker-style format: [registry/][path/]name[:tag]
|
|
82
82
|
*
|
|
@@ -85,10 +85,10 @@ interface RXL {
|
|
|
85
85
|
* - { name: "hello", tag: "1.0.0" } → "hello:1.0.0"
|
|
86
86
|
* - { registry: "localhost:3098", name: "hello", tag: "1.0.0" } → "localhost:3098/hello:1.0.0"
|
|
87
87
|
*
|
|
88
|
-
* @param
|
|
88
|
+
* @param rxi - Resource identifier
|
|
89
89
|
* @returns Locator string
|
|
90
90
|
*/
|
|
91
|
-
declare function format(
|
|
91
|
+
declare function format(rxi: RXI): string;
|
|
92
92
|
/**
|
|
93
93
|
* RXM - ResourceX Manifest
|
|
94
94
|
*
|
|
@@ -144,12 +144,12 @@ interface RXM {
|
|
|
144
144
|
readonly source: RXMSource;
|
|
145
145
|
}
|
|
146
146
|
/**
|
|
147
|
-
* Create
|
|
147
|
+
* Create RXI from RXM.
|
|
148
148
|
*
|
|
149
149
|
* @param rxm - Resource manifest
|
|
150
|
-
* @returns
|
|
150
|
+
* @returns RXI identifier object (pure data)
|
|
151
151
|
*/
|
|
152
|
-
declare function locate(rxm: RXM):
|
|
152
|
+
declare function locate(rxm: RXM): RXI;
|
|
153
153
|
/**
|
|
154
154
|
* Create RXM from RXD.
|
|
155
155
|
* Maps RXD fields into the structured RXM format.
|
|
@@ -159,7 +159,7 @@ declare function locate(rxm: RXM): RXL;
|
|
|
159
159
|
*/
|
|
160
160
|
declare function manifest(rxd: RXD): RXM;
|
|
161
161
|
/**
|
|
162
|
-
* Parse locator string to
|
|
162
|
+
* Parse locator string to RXI.
|
|
163
163
|
*
|
|
164
164
|
* Docker-style format: [registry/][path/]name[:tag]
|
|
165
165
|
*
|
|
@@ -170,17 +170,17 @@ declare function manifest(rxd: RXD): RXM;
|
|
|
170
170
|
* - localhost:3098/hello:1.0.0 → registry=localhost:3098, name=hello, tag=1.0.0
|
|
171
171
|
*
|
|
172
172
|
* @param locator - Locator string
|
|
173
|
-
* @returns
|
|
173
|
+
* @returns RXI object
|
|
174
174
|
* @throws LocatorError if parsing fails
|
|
175
175
|
*/
|
|
176
|
-
declare function parse(locator: string):
|
|
176
|
+
declare function parse(locator: string): RXI;
|
|
177
177
|
/**
|
|
178
178
|
* RXR - ResourceX Resource
|
|
179
179
|
*
|
|
180
|
-
* Complete resource object combining
|
|
180
|
+
* Complete resource object combining identifier, manifest, and archive.
|
|
181
181
|
*/
|
|
182
182
|
interface RXR {
|
|
183
|
-
readonly
|
|
183
|
+
readonly identifier: RXI;
|
|
184
184
|
readonly manifest: RXM;
|
|
185
185
|
readonly archive: RXA;
|
|
186
186
|
}
|
|
@@ -193,6 +193,19 @@ interface RXR {
|
|
|
193
193
|
*/
|
|
194
194
|
declare function resource(rxm: RXM, rxa: RXA): RXR;
|
|
195
195
|
/**
|
|
196
|
+
* RXL - ResourceX Locator
|
|
197
|
+
*
|
|
198
|
+
* Unified locator type for any resource reference.
|
|
199
|
+
* An RXL can be:
|
|
200
|
+
* - An RXI identifier string (e.g., "hello:1.0.0", "deepractice/skill-creator:0.1.0")
|
|
201
|
+
* - A local directory path (e.g., "/home/user/skills/my-skill")
|
|
202
|
+
* - A URL (e.g., "https://github.com/org/repo/tree/main/skills/my-skill")
|
|
203
|
+
*
|
|
204
|
+
* RXL is the input type for `ingest()` — the unified entry point that
|
|
205
|
+
* accepts any form of resource reference and resolves it.
|
|
206
|
+
*/
|
|
207
|
+
type RXL = string;
|
|
208
|
+
/**
|
|
196
209
|
* RXS - ResourceX Source
|
|
197
210
|
*
|
|
198
211
|
* Intermediate representation of raw files from any source.
|
|
@@ -819,10 +832,10 @@ interface SearchOptions {
|
|
|
819
832
|
*/
|
|
820
833
|
interface Registry {
|
|
821
834
|
/**
|
|
822
|
-
* Get resource by
|
|
835
|
+
* Get resource by identifier.
|
|
823
836
|
* @throws RegistryError if not found
|
|
824
837
|
*/
|
|
825
|
-
get(
|
|
838
|
+
get(rxi: RXI): Promise<RXR>;
|
|
826
839
|
/**
|
|
827
840
|
* Store resource.
|
|
828
841
|
*/
|
|
@@ -830,26 +843,26 @@ interface Registry {
|
|
|
830
843
|
/**
|
|
831
844
|
* Check if resource exists.
|
|
832
845
|
*/
|
|
833
|
-
has(
|
|
846
|
+
has(rxi: RXI): Promise<boolean>;
|
|
834
847
|
/**
|
|
835
848
|
* Delete resource.
|
|
836
849
|
*/
|
|
837
|
-
remove(
|
|
850
|
+
remove(rxi: RXI): Promise<void>;
|
|
838
851
|
/**
|
|
839
852
|
* List resources matching options.
|
|
840
853
|
*/
|
|
841
|
-
list(options?: SearchOptions): Promise<
|
|
854
|
+
list(options?: SearchOptions): Promise<RXI[]>;
|
|
842
855
|
}
|
|
843
856
|
declare class CASRegistry implements Registry {
|
|
844
857
|
private readonly rxaStore;
|
|
845
858
|
private readonly rxmStore;
|
|
846
859
|
constructor(rxaStore: RXAStore, rxmStore: RXMStore);
|
|
847
860
|
private resolveTag;
|
|
848
|
-
get(
|
|
861
|
+
get(rxi: RXI): Promise<RXR>;
|
|
849
862
|
put(rxr: RXR): Promise<void>;
|
|
850
|
-
has(
|
|
851
|
-
remove(
|
|
852
|
-
list(options?: SearchOptions): Promise<
|
|
863
|
+
has(rxi: RXI): Promise<boolean>;
|
|
864
|
+
remove(rxi: RXI): Promise<void>;
|
|
865
|
+
list(options?: SearchOptions): Promise<RXI[]>;
|
|
853
866
|
/**
|
|
854
867
|
* Clear cached resources (resources with registry).
|
|
855
868
|
* @param registry - If provided, only clear resources from this registry
|
|
@@ -894,37 +907,37 @@ declare class LinkedRegistry implements Registry {
|
|
|
894
907
|
* Check if a path is a symlink.
|
|
895
908
|
*/
|
|
896
909
|
private isSymlink;
|
|
897
|
-
get(
|
|
910
|
+
get(rxi: RXI): Promise<RXR>;
|
|
898
911
|
/**
|
|
899
912
|
* Put is not typically used for LinkedRegistry.
|
|
900
913
|
* Use link() instead to create symlinks.
|
|
901
914
|
*/
|
|
902
915
|
put(_rxr: RXR): Promise<void>;
|
|
903
|
-
has(
|
|
904
|
-
remove(
|
|
905
|
-
list(options?: SearchOptions): Promise<
|
|
916
|
+
has(rxi: RXI): Promise<boolean>;
|
|
917
|
+
remove(rxi: RXI): Promise<void>;
|
|
918
|
+
list(options?: SearchOptions): Promise<RXI[]>;
|
|
906
919
|
/**
|
|
907
920
|
* Link a development directory.
|
|
908
921
|
* Creates a symlink so changes are reflected immediately.
|
|
909
922
|
*
|
|
910
923
|
* @param devPath - Path to development directory (must contain resource.json)
|
|
911
|
-
* @returns The
|
|
924
|
+
* @returns The RXI of the linked resource
|
|
912
925
|
*/
|
|
913
|
-
link(devPath: string): Promise<
|
|
926
|
+
link(devPath: string): Promise<RXI>;
|
|
914
927
|
/**
|
|
915
928
|
* Unlink a development directory.
|
|
916
929
|
* Alias for remove().
|
|
917
930
|
*/
|
|
918
|
-
unlink(
|
|
931
|
+
unlink(rxi: RXI): Promise<void>;
|
|
919
932
|
/**
|
|
920
933
|
* Recursively scan for symlinks.
|
|
921
934
|
*/
|
|
922
935
|
private scanSymlinks;
|
|
923
936
|
/**
|
|
924
|
-
* Parse relative path to
|
|
937
|
+
* Parse relative path to RXI.
|
|
925
938
|
* Path format: {registry}/{path}/{name}/{tag}
|
|
926
939
|
*/
|
|
927
|
-
private
|
|
940
|
+
private parsePathToRXI;
|
|
928
941
|
}
|
|
929
942
|
/**
|
|
930
943
|
* Base class for Registry middleware.
|
|
@@ -934,11 +947,11 @@ declare class LinkedRegistry implements Registry {
|
|
|
934
947
|
declare abstract class RegistryMiddleware implements Registry {
|
|
935
948
|
protected readonly inner: Registry;
|
|
936
949
|
constructor(inner: Registry);
|
|
937
|
-
get(
|
|
950
|
+
get(rxi: RXI): Promise<RXR>;
|
|
938
951
|
put(rxr: RXR): Promise<void>;
|
|
939
|
-
has(
|
|
940
|
-
remove(
|
|
941
|
-
list(options?: SearchOptions): Promise<
|
|
952
|
+
has(rxi: RXI): Promise<boolean>;
|
|
953
|
+
remove(rxi: RXI): Promise<void>;
|
|
954
|
+
list(options?: SearchOptions): Promise<RXI[]>;
|
|
942
955
|
}
|
|
943
956
|
/**
|
|
944
957
|
* Registry validation middleware.
|
|
@@ -954,7 +967,7 @@ declare class RegistryValidation extends RegistryMiddleware {
|
|
|
954
967
|
/**
|
|
955
968
|
* Get resource and validate registry.
|
|
956
969
|
*/
|
|
957
|
-
get(
|
|
970
|
+
get(rxi: RXI): Promise<RXR>;
|
|
958
971
|
}
|
|
959
972
|
/**
|
|
960
973
|
* Factory function to create registry validation middleware.
|
|
@@ -1242,4 +1255,4 @@ declare class TypeHandlerChain {
|
|
|
1242
1255
|
*/
|
|
1243
1256
|
clear(): void;
|
|
1244
1257
|
}
|
|
1245
|
-
export { wrap, withDomainValidation, textType, resource, resolveSource, parse, manifest, locate, loadResource, jsonType, isValidDigest, generateDefinition, format, extract, discoverRegistry, define, computeDigest, bundleResourceType, builtinTypes, binaryType, archive, WellKnownResponse, TypeHandlerChain, TypeDetectorChain, TypeDetector, TypeDetectionResult, StoredRXM, SourceLoaderChain, SourceLoader, SkillDetector, SearchOptions, ResourceXProvider, ResourceXError, ResourceTypeError, ResourceType, ResourceResolver, ResourceLoader, ResourceJsonDetector, ResolvedResource, ResolveSourceConfig, ResolveContext, RegistryMiddleware, RegistryError, Registry, RXS, RXR, RXMStore, RXMSource, RXMSearchOptions, RXMDefinition, RXMArchive, RXM, RXL, RXD, RXAStore, RXA, ProviderStores, ProviderConfig, MemoryRXMStore, MemoryRXAStore, ManifestError, LocatorError, LoadResourceConfig, LinkedRegistry, JSONSchemaProperty, JSONSchema, IsolatorType, GitHubSourceLoader, FolderSourceLoader, FolderLoader, FileTree, FileEntry, DomainValidation, DiscoveryResult, DefinitionError, ContentError, CASRegistry, BundledType };
|
|
1258
|
+
export { wrap, withDomainValidation, textType, resource, resolveSource, parse, manifest, locate, loadResource, jsonType, isValidDigest, generateDefinition, format, extract, discoverRegistry, define, computeDigest, bundleResourceType, builtinTypes, binaryType, archive, WellKnownResponse, TypeHandlerChain, TypeDetectorChain, TypeDetector, TypeDetectionResult, StoredRXM, SourceLoaderChain, SourceLoader, SkillDetector, SearchOptions, ResourceXProvider, ResourceXError, ResourceTypeError, ResourceType, ResourceResolver, ResourceLoader, ResourceJsonDetector, ResolvedResource, ResolveSourceConfig, ResolveContext, RegistryMiddleware, RegistryError, Registry, RXS, RXR, RXMStore, RXMSource, RXMSearchOptions, RXMDefinition, RXMArchive, RXM, RXL, RXI, RXD, RXAStore, RXA, ProviderStores, ProviderConfig, MemoryRXMStore, MemoryRXAStore, ManifestError, LocatorError, LoadResourceConfig, LinkedRegistry, JSONSchemaProperty, JSONSchema, IsolatorType, GitHubSourceLoader, FolderSourceLoader, FolderLoader, FileTree, FileEntry, DomainValidation, DiscoveryResult, DefinitionError, ContentError, CASRegistry, BundledType };
|
package/dist/index.js
CHANGED
|
@@ -14647,17 +14647,17 @@ async function extract(rxa) {
|
|
|
14647
14647
|
return files;
|
|
14648
14648
|
}
|
|
14649
14649
|
// src/model/format.ts
|
|
14650
|
-
function format(
|
|
14650
|
+
function format(rxi) {
|
|
14651
14651
|
let result = "";
|
|
14652
|
-
if (
|
|
14653
|
-
result += `${
|
|
14652
|
+
if (rxi.registry) {
|
|
14653
|
+
result += `${rxi.registry}/`;
|
|
14654
14654
|
}
|
|
14655
|
-
if (
|
|
14656
|
-
result += `${
|
|
14655
|
+
if (rxi.path) {
|
|
14656
|
+
result += `${rxi.path}/`;
|
|
14657
14657
|
}
|
|
14658
|
-
result +=
|
|
14659
|
-
if (
|
|
14660
|
-
result += `:${
|
|
14658
|
+
result += rxi.name;
|
|
14659
|
+
if (rxi.tag && rxi.tag !== "latest") {
|
|
14660
|
+
result += `:${rxi.tag}`;
|
|
14661
14661
|
}
|
|
14662
14662
|
return result;
|
|
14663
14663
|
}
|
|
@@ -14791,9 +14791,9 @@ function parse5(locator) {
|
|
|
14791
14791
|
}
|
|
14792
14792
|
// src/model/resource.ts
|
|
14793
14793
|
function resource(rxm, rxa) {
|
|
14794
|
-
const
|
|
14794
|
+
const rxi = locate(rxm);
|
|
14795
14795
|
return {
|
|
14796
|
-
|
|
14796
|
+
identifier: rxi,
|
|
14797
14797
|
manifest: rxm,
|
|
14798
14798
|
archive: rxa
|
|
14799
14799
|
};
|
|
@@ -15202,17 +15202,17 @@ class RegistryMiddleware {
|
|
|
15202
15202
|
constructor(inner) {
|
|
15203
15203
|
this.inner = inner;
|
|
15204
15204
|
}
|
|
15205
|
-
get(
|
|
15206
|
-
return this.inner.get(
|
|
15205
|
+
get(rxi) {
|
|
15206
|
+
return this.inner.get(rxi);
|
|
15207
15207
|
}
|
|
15208
15208
|
put(rxr) {
|
|
15209
15209
|
return this.inner.put(rxr);
|
|
15210
15210
|
}
|
|
15211
|
-
has(
|
|
15212
|
-
return this.inner.has(
|
|
15211
|
+
has(rxi) {
|
|
15212
|
+
return this.inner.has(rxi);
|
|
15213
15213
|
}
|
|
15214
|
-
remove(
|
|
15215
|
-
return this.inner.remove(
|
|
15214
|
+
remove(rxi) {
|
|
15215
|
+
return this.inner.remove(rxi);
|
|
15216
15216
|
}
|
|
15217
15217
|
list(options) {
|
|
15218
15218
|
return this.inner.list(options);
|
|
@@ -15231,8 +15231,8 @@ class RegistryValidation extends RegistryMiddleware {
|
|
|
15231
15231
|
throw new RegistryError(`Untrusted registry: resource claims "${rxr.manifest.definition.registry}" but registry only trusts "${this.trustedRegistry}"`);
|
|
15232
15232
|
}
|
|
15233
15233
|
}
|
|
15234
|
-
async get(
|
|
15235
|
-
const rxr = await this.inner.get(
|
|
15234
|
+
async get(rxi) {
|
|
15235
|
+
const rxr = await this.inner.get(rxi);
|
|
15236
15236
|
this.validateRegistry(rxr);
|
|
15237
15237
|
return rxr;
|
|
15238
15238
|
}
|
|
@@ -15261,11 +15261,11 @@ class CASRegistry {
|
|
|
15261
15261
|
}
|
|
15262
15262
|
return tag;
|
|
15263
15263
|
}
|
|
15264
|
-
async get(
|
|
15265
|
-
const tag = await this.resolveTag(
|
|
15266
|
-
const storedRxm = await this.rxmStore.get(
|
|
15264
|
+
async get(rxi) {
|
|
15265
|
+
const tag = await this.resolveTag(rxi.name, rxi.tag ?? "latest", rxi.registry);
|
|
15266
|
+
const storedRxm = await this.rxmStore.get(rxi.name, tag, rxi.registry);
|
|
15267
15267
|
if (!storedRxm) {
|
|
15268
|
-
throw new RegistryError(`Resource not found: ${format(
|
|
15268
|
+
throw new RegistryError(`Resource not found: ${format(rxi)}`);
|
|
15269
15269
|
}
|
|
15270
15270
|
const files = {};
|
|
15271
15271
|
for (const [filename, digest] of Object.entries(storedRxm.files)) {
|
|
@@ -15315,13 +15315,13 @@ class CASRegistry {
|
|
|
15315
15315
|
await this.rxmStore.put(storedRxm);
|
|
15316
15316
|
await this.rxmStore.setLatest(rxr.manifest.definition.name, rxr.manifest.definition.tag, rxr.manifest.definition.registry);
|
|
15317
15317
|
}
|
|
15318
|
-
async has(
|
|
15319
|
-
const tag = await this.resolveTag(
|
|
15320
|
-
return this.rxmStore.has(
|
|
15318
|
+
async has(rxi) {
|
|
15319
|
+
const tag = await this.resolveTag(rxi.name, rxi.tag ?? "latest", rxi.registry);
|
|
15320
|
+
return this.rxmStore.has(rxi.name, tag, rxi.registry);
|
|
15321
15321
|
}
|
|
15322
|
-
async remove(
|
|
15323
|
-
const tag =
|
|
15324
|
-
await this.rxmStore.delete(
|
|
15322
|
+
async remove(rxi) {
|
|
15323
|
+
const tag = rxi.tag ?? "latest";
|
|
15324
|
+
await this.rxmStore.delete(rxi.name, tag, rxi.registry);
|
|
15325
15325
|
}
|
|
15326
15326
|
async list(options) {
|
|
15327
15327
|
const { query, limit, offset = 0 } = options ?? {};
|
|
@@ -15385,14 +15385,14 @@ class LinkedRegistry {
|
|
|
15385
15385
|
constructor(basePath) {
|
|
15386
15386
|
this.basePath = basePath;
|
|
15387
15387
|
}
|
|
15388
|
-
buildLinkPath(
|
|
15389
|
-
const registry2 =
|
|
15390
|
-
const tag =
|
|
15388
|
+
buildLinkPath(rxi) {
|
|
15389
|
+
const registry2 = rxi.registry ?? "localhost";
|
|
15390
|
+
const tag = rxi.tag ?? "latest";
|
|
15391
15391
|
let linkPath = join3(this.basePath, registry2);
|
|
15392
|
-
if (
|
|
15393
|
-
linkPath = join3(linkPath,
|
|
15392
|
+
if (rxi.path) {
|
|
15393
|
+
linkPath = join3(linkPath, rxi.path);
|
|
15394
15394
|
}
|
|
15395
|
-
return join3(linkPath,
|
|
15395
|
+
return join3(linkPath, rxi.name, tag);
|
|
15396
15396
|
}
|
|
15397
15397
|
async isSymlink(path) {
|
|
15398
15398
|
try {
|
|
@@ -15402,10 +15402,10 @@ class LinkedRegistry {
|
|
|
15402
15402
|
return false;
|
|
15403
15403
|
}
|
|
15404
15404
|
}
|
|
15405
|
-
async get(
|
|
15406
|
-
const linkPath = this.buildLinkPath(
|
|
15405
|
+
async get(rxi) {
|
|
15406
|
+
const linkPath = this.buildLinkPath(rxi);
|
|
15407
15407
|
if (!await this.isSymlink(linkPath)) {
|
|
15408
|
-
throw new RegistryError(`Linked resource not found: ${format(
|
|
15408
|
+
throw new RegistryError(`Linked resource not found: ${format(rxi)}`);
|
|
15409
15409
|
}
|
|
15410
15410
|
const targetPath = await readlink(linkPath);
|
|
15411
15411
|
return loadResource(targetPath);
|
|
@@ -15413,29 +15413,29 @@ class LinkedRegistry {
|
|
|
15413
15413
|
async put(_rxr) {
|
|
15414
15414
|
throw new RegistryError("LinkedRegistry does not support put(). Use link() instead.");
|
|
15415
15415
|
}
|
|
15416
|
-
async has(
|
|
15417
|
-
const linkPath = this.buildLinkPath(
|
|
15416
|
+
async has(rxi) {
|
|
15417
|
+
const linkPath = this.buildLinkPath(rxi);
|
|
15418
15418
|
return this.isSymlink(linkPath);
|
|
15419
15419
|
}
|
|
15420
|
-
async remove(
|
|
15421
|
-
const linkPath = this.buildLinkPath(
|
|
15420
|
+
async remove(rxi) {
|
|
15421
|
+
const linkPath = this.buildLinkPath(rxi);
|
|
15422
15422
|
if (await this.isSymlink(linkPath)) {
|
|
15423
15423
|
await rm(linkPath);
|
|
15424
15424
|
}
|
|
15425
15425
|
}
|
|
15426
15426
|
async list(options) {
|
|
15427
15427
|
const { query, limit, offset = 0 } = options ?? {};
|
|
15428
|
-
const
|
|
15428
|
+
const identifiers = [];
|
|
15429
15429
|
try {
|
|
15430
|
-
await this.scanSymlinks(this.basePath, "",
|
|
15430
|
+
await this.scanSymlinks(this.basePath, "", identifiers);
|
|
15431
15431
|
} catch {
|
|
15432
15432
|
return [];
|
|
15433
15433
|
}
|
|
15434
|
-
let filtered =
|
|
15434
|
+
let filtered = identifiers;
|
|
15435
15435
|
if (query) {
|
|
15436
15436
|
const lowerQuery = query.toLowerCase();
|
|
15437
|
-
filtered =
|
|
15438
|
-
const searchText = `${
|
|
15437
|
+
filtered = identifiers.filter((rxi) => {
|
|
15438
|
+
const searchText = `${rxi.registry ?? ""} ${rxi.path ?? ""} ${rxi.name}`.toLowerCase();
|
|
15439
15439
|
return searchText.includes(lowerQuery);
|
|
15440
15440
|
});
|
|
15441
15441
|
}
|
|
@@ -15447,7 +15447,7 @@ class LinkedRegistry {
|
|
|
15447
15447
|
}
|
|
15448
15448
|
async link(devPath) {
|
|
15449
15449
|
const rxr = await loadResource(devPath);
|
|
15450
|
-
const linkPath = this.buildLinkPath(rxr.
|
|
15450
|
+
const linkPath = this.buildLinkPath(rxr.identifier);
|
|
15451
15451
|
try {
|
|
15452
15452
|
const stats = await lstat(linkPath);
|
|
15453
15453
|
if (stats.isSymbolicLink() || stats.isDirectory()) {
|
|
@@ -15458,12 +15458,12 @@ class LinkedRegistry {
|
|
|
15458
15458
|
await mkdir(parentPath, { recursive: true });
|
|
15459
15459
|
const absolutePath = resolvePath(devPath);
|
|
15460
15460
|
await symlink(absolutePath, linkPath);
|
|
15461
|
-
return rxr.
|
|
15461
|
+
return rxr.identifier;
|
|
15462
15462
|
}
|
|
15463
|
-
async unlink(
|
|
15464
|
-
return this.remove(
|
|
15463
|
+
async unlink(rxi) {
|
|
15464
|
+
return this.remove(rxi);
|
|
15465
15465
|
}
|
|
15466
|
-
async scanSymlinks(dirPath, relativePath,
|
|
15466
|
+
async scanSymlinks(dirPath, relativePath, identifiers) {
|
|
15467
15467
|
let entries;
|
|
15468
15468
|
try {
|
|
15469
15469
|
entries = await readdir3(dirPath);
|
|
@@ -15476,17 +15476,17 @@ class LinkedRegistry {
|
|
|
15476
15476
|
try {
|
|
15477
15477
|
const stats = await lstat(fullPath);
|
|
15478
15478
|
if (stats.isSymbolicLink()) {
|
|
15479
|
-
const
|
|
15480
|
-
if (
|
|
15481
|
-
|
|
15479
|
+
const rxi = this.parsePathToRXI(relPath);
|
|
15480
|
+
if (rxi) {
|
|
15481
|
+
identifiers.push(rxi);
|
|
15482
15482
|
}
|
|
15483
15483
|
} else if (stats.isDirectory()) {
|
|
15484
|
-
await this.scanSymlinks(fullPath, relPath,
|
|
15484
|
+
await this.scanSymlinks(fullPath, relPath, identifiers);
|
|
15485
15485
|
}
|
|
15486
15486
|
} catch {}
|
|
15487
15487
|
}
|
|
15488
15488
|
}
|
|
15489
|
-
|
|
15489
|
+
parsePathToRXI(relPath) {
|
|
15490
15490
|
const parts = relPath.split("/");
|
|
15491
15491
|
if (parts.length < 3) {
|
|
15492
15492
|
return null;
|
|
@@ -15864,4 +15864,4 @@ export {
|
|
|
15864
15864
|
CASRegistry
|
|
15865
15865
|
};
|
|
15866
15866
|
|
|
15867
|
-
//# debugId=
|
|
15867
|
+
//# debugId=8AF33945E518861764756E2164756E21
|