@resourcexjs/core 2.8.0 → 2.9.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 +53 -7
- package/dist/index.js +46 -24
- package/dist/index.js.map +6 -6
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -92,15 +92,56 @@ declare function format(rxl: RXL): string;
|
|
|
92
92
|
/**
|
|
93
93
|
* RXM - ResourceX Manifest
|
|
94
94
|
*
|
|
95
|
-
* Resource
|
|
95
|
+
* Resource context representation organized by RX primitives.
|
|
96
|
+
* Structure: definition (RXD) + archive (RXA) + source (RXS)
|
|
96
97
|
*/
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
98
|
+
/**
|
|
99
|
+
* RXM Definition — what the resource IS.
|
|
100
|
+
* Sourced from RXD (resource.json).
|
|
101
|
+
*/
|
|
102
|
+
interface RXMDefinition {
|
|
100
103
|
readonly name: string;
|
|
101
104
|
readonly type: string;
|
|
102
105
|
readonly tag: string;
|
|
103
|
-
readonly
|
|
106
|
+
readonly registry?: string;
|
|
107
|
+
readonly path?: string;
|
|
108
|
+
readonly description?: string;
|
|
109
|
+
readonly author?: string;
|
|
110
|
+
readonly license?: string;
|
|
111
|
+
readonly keywords?: string[];
|
|
112
|
+
readonly repository?: string;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* RXM Archive — packaging metadata.
|
|
116
|
+
* Placeholder for future fields (digest, size, md5, etc.)
|
|
117
|
+
*/
|
|
118
|
+
type RXMArchive = {};
|
|
119
|
+
/**
|
|
120
|
+
* File entry with metadata.
|
|
121
|
+
*/
|
|
122
|
+
interface FileEntry {
|
|
123
|
+
readonly size: number;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Recursive file tree structure.
|
|
127
|
+
* Keys ending with '/' are directories containing nested FileTree.
|
|
128
|
+
* Other keys are files with FileEntry metadata.
|
|
129
|
+
*/
|
|
130
|
+
type FileTree = {
|
|
131
|
+
readonly [key: string]: FileEntry | FileTree
|
|
132
|
+
};
|
|
133
|
+
/**
|
|
134
|
+
* RXM Source — what's IN the resource.
|
|
135
|
+
* File structure and content preview.
|
|
136
|
+
*/
|
|
137
|
+
interface RXMSource {
|
|
138
|
+
readonly files?: FileTree;
|
|
139
|
+
readonly preview?: string;
|
|
140
|
+
}
|
|
141
|
+
interface RXM {
|
|
142
|
+
readonly definition: RXMDefinition;
|
|
143
|
+
readonly archive: RXMArchive;
|
|
144
|
+
readonly source: RXMSource;
|
|
104
145
|
}
|
|
105
146
|
/**
|
|
106
147
|
* Create RXL from RXM.
|
|
@@ -111,7 +152,7 @@ interface RXM {
|
|
|
111
152
|
declare function locate(rxm: RXM): RXL;
|
|
112
153
|
/**
|
|
113
154
|
* Create RXM from RXD.
|
|
114
|
-
*
|
|
155
|
+
* Maps RXD fields into the structured RXM format.
|
|
115
156
|
*
|
|
116
157
|
* @param rxd - Resource definition
|
|
117
158
|
* @returns RXM manifest object
|
|
@@ -590,6 +631,11 @@ interface StoredRXM {
|
|
|
590
631
|
readonly name: string;
|
|
591
632
|
readonly type: string;
|
|
592
633
|
readonly tag: string;
|
|
634
|
+
readonly description?: string;
|
|
635
|
+
readonly author?: string;
|
|
636
|
+
readonly license?: string;
|
|
637
|
+
readonly keywords?: string[];
|
|
638
|
+
readonly repository?: string;
|
|
593
639
|
readonly files: Record<string, string>;
|
|
594
640
|
readonly createdAt?: Date;
|
|
595
641
|
readonly updatedAt?: Date;
|
|
@@ -1196,4 +1242,4 @@ declare class TypeHandlerChain {
|
|
|
1196
1242
|
*/
|
|
1197
1243
|
clear(): void;
|
|
1198
1244
|
}
|
|
1199
|
-
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, RXMSearchOptions, RXM, RXL, RXD, RXAStore, RXA, ProviderStores, ProviderConfig, MemoryRXMStore, MemoryRXAStore, ManifestError, LocatorError, LoadResourceConfig, LinkedRegistry, JSONSchemaProperty, JSONSchema, IsolatorType, GitHubSourceLoader, FolderSourceLoader, FolderLoader, DomainValidation, DiscoveryResult, DefinitionError, ContentError, CASRegistry, BundledType };
|
|
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 };
|
package/dist/index.js
CHANGED
|
@@ -14664,20 +14664,29 @@ function format(rxl) {
|
|
|
14664
14664
|
// src/model/locate.ts
|
|
14665
14665
|
function locate(rxm) {
|
|
14666
14666
|
return {
|
|
14667
|
-
registry: rxm.registry,
|
|
14668
|
-
path: rxm.path,
|
|
14669
|
-
name: rxm.name,
|
|
14670
|
-
tag: rxm.tag
|
|
14667
|
+
registry: rxm.definition.registry,
|
|
14668
|
+
path: rxm.definition.path,
|
|
14669
|
+
name: rxm.definition.name,
|
|
14670
|
+
tag: rxm.definition.tag
|
|
14671
14671
|
};
|
|
14672
14672
|
}
|
|
14673
14673
|
// src/model/manifest.ts
|
|
14674
14674
|
function manifest(rxd) {
|
|
14675
14675
|
return {
|
|
14676
|
-
|
|
14677
|
-
|
|
14678
|
-
|
|
14679
|
-
|
|
14680
|
-
|
|
14676
|
+
definition: {
|
|
14677
|
+
name: rxd.name,
|
|
14678
|
+
type: rxd.type,
|
|
14679
|
+
tag: rxd.tag ?? "latest",
|
|
14680
|
+
registry: rxd.registry,
|
|
14681
|
+
path: rxd.path,
|
|
14682
|
+
description: rxd.description,
|
|
14683
|
+
author: rxd.author,
|
|
14684
|
+
license: rxd.license,
|
|
14685
|
+
keywords: rxd.keywords,
|
|
14686
|
+
repository: rxd.repository
|
|
14687
|
+
},
|
|
14688
|
+
archive: {},
|
|
14689
|
+
source: {}
|
|
14681
14690
|
};
|
|
14682
14691
|
}
|
|
14683
14692
|
// src/model/parse.ts
|
|
@@ -15218,8 +15227,8 @@ class RegistryValidation extends RegistryMiddleware {
|
|
|
15218
15227
|
this.trustedRegistry = trustedRegistry;
|
|
15219
15228
|
}
|
|
15220
15229
|
validateRegistry(rxr) {
|
|
15221
|
-
if (rxr.manifest.registry !== this.trustedRegistry) {
|
|
15222
|
-
throw new RegistryError(`Untrusted registry: resource claims "${rxr.manifest.registry}" but registry only trusts "${this.trustedRegistry}"`);
|
|
15230
|
+
if (rxr.manifest.definition.registry !== this.trustedRegistry) {
|
|
15231
|
+
throw new RegistryError(`Untrusted registry: resource claims "${rxr.manifest.definition.registry}" but registry only trusts "${this.trustedRegistry}"`);
|
|
15223
15232
|
}
|
|
15224
15233
|
}
|
|
15225
15234
|
async get(rxl) {
|
|
@@ -15263,12 +15272,20 @@ class CASRegistry {
|
|
|
15263
15272
|
files[filename] = await this.rxaStore.get(digest);
|
|
15264
15273
|
}
|
|
15265
15274
|
const rxm = {
|
|
15266
|
-
|
|
15267
|
-
|
|
15268
|
-
|
|
15269
|
-
|
|
15270
|
-
|
|
15271
|
-
|
|
15275
|
+
definition: {
|
|
15276
|
+
registry: storedRxm.registry,
|
|
15277
|
+
path: storedRxm.path,
|
|
15278
|
+
name: storedRxm.name,
|
|
15279
|
+
type: storedRxm.type,
|
|
15280
|
+
tag: storedRxm.tag,
|
|
15281
|
+
description: storedRxm.description,
|
|
15282
|
+
author: storedRxm.author,
|
|
15283
|
+
license: storedRxm.license,
|
|
15284
|
+
keywords: storedRxm.keywords,
|
|
15285
|
+
repository: storedRxm.repository
|
|
15286
|
+
},
|
|
15287
|
+
archive: {},
|
|
15288
|
+
source: {}
|
|
15272
15289
|
};
|
|
15273
15290
|
const rxa = await archive(files);
|
|
15274
15291
|
return resource(rxm, rxa);
|
|
@@ -15281,17 +15298,22 @@ class CASRegistry {
|
|
|
15281
15298
|
fileDigests[filename] = digest;
|
|
15282
15299
|
}
|
|
15283
15300
|
const storedRxm = {
|
|
15284
|
-
registry: rxr.manifest.registry,
|
|
15285
|
-
path: rxr.manifest.path,
|
|
15286
|
-
name: rxr.manifest.name,
|
|
15287
|
-
type: rxr.manifest.type,
|
|
15288
|
-
tag: rxr.manifest.tag,
|
|
15301
|
+
registry: rxr.manifest.definition.registry,
|
|
15302
|
+
path: rxr.manifest.definition.path,
|
|
15303
|
+
name: rxr.manifest.definition.name,
|
|
15304
|
+
type: rxr.manifest.definition.type,
|
|
15305
|
+
tag: rxr.manifest.definition.tag,
|
|
15306
|
+
description: rxr.manifest.definition.description,
|
|
15307
|
+
author: rxr.manifest.definition.author,
|
|
15308
|
+
license: rxr.manifest.definition.license,
|
|
15309
|
+
keywords: rxr.manifest.definition.keywords,
|
|
15310
|
+
repository: rxr.manifest.definition.repository,
|
|
15289
15311
|
files: fileDigests,
|
|
15290
15312
|
createdAt: new Date,
|
|
15291
15313
|
updatedAt: new Date
|
|
15292
15314
|
};
|
|
15293
15315
|
await this.rxmStore.put(storedRxm);
|
|
15294
|
-
await this.rxmStore.setLatest(rxr.manifest.name, rxr.manifest.tag, rxr.manifest.registry);
|
|
15316
|
+
await this.rxmStore.setLatest(rxr.manifest.definition.name, rxr.manifest.definition.tag, rxr.manifest.definition.registry);
|
|
15295
15317
|
}
|
|
15296
15318
|
async has(rxl) {
|
|
15297
15319
|
const tag = await this.resolveTag(rxl.name, rxl.tag ?? "latest", rxl.registry);
|
|
@@ -15842,4 +15864,4 @@ export {
|
|
|
15842
15864
|
CASRegistry
|
|
15843
15865
|
};
|
|
15844
15866
|
|
|
15845
|
-
//# debugId=
|
|
15867
|
+
//# debugId=83E83041460190BD64756E2164756E21
|