resourcexjs 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/arp.js +2 -2
- package/dist/arp.js.map +2 -2
- package/dist/index.d.ts +7 -9
- package/dist/index.js +113 -54
- package/dist/index.js.map +5 -5
- package/package.json +3 -3
package/dist/arp.js
CHANGED
|
@@ -526,7 +526,7 @@ class ARP {
|
|
|
526
526
|
function createARP(config) {
|
|
527
527
|
return new ARP(config);
|
|
528
528
|
}
|
|
529
|
-
var VERSION = "2.
|
|
529
|
+
var VERSION = "2.9.0";
|
|
530
530
|
export {
|
|
531
531
|
textSemantic,
|
|
532
532
|
httpsTransport,
|
|
@@ -546,4 +546,4 @@ export {
|
|
|
546
546
|
ARP
|
|
547
547
|
};
|
|
548
548
|
|
|
549
|
-
//# debugId=
|
|
549
|
+
//# debugId=41987E49544A3B4264756E2164756E21
|
package/dist/arp.js.map
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../arp/dist/index.js"],
|
|
4
4
|
"sourcesContent": [
|
|
5
|
-
"// src/errors.ts\nclass ARPError extends Error {\n constructor(message, options) {\n super(message, options);\n this.name = \"ARPError\";\n }\n}\n\nclass ParseError extends ARPError {\n url;\n constructor(message, url) {\n super(message);\n this.url = url;\n this.name = \"ParseError\";\n }\n}\n\nclass TransportError extends ARPError {\n transport;\n constructor(message, transport, options) {\n super(message, options);\n this.transport = transport;\n this.name = \"TransportError\";\n }\n}\n\nclass SemanticError extends ARPError {\n semantic;\n constructor(message, semantic, options) {\n super(message, options);\n this.semantic = semantic;\n this.name = \"SemanticError\";\n }\n}\n\n// src/ARL.ts\nclass ARL {\n semantic;\n transport;\n location;\n resolver;\n constructor(semantic, transport, location, resolver) {\n this.semantic = semantic;\n this.transport = transport;\n this.location = location;\n this.resolver = resolver;\n }\n createContext(params) {\n return {\n url: this.toString(),\n semantic: this.semantic,\n transport: this.transport,\n location: this.location,\n timestamp: new Date,\n params\n };\n }\n async resolve(params) {\n const transport = this.resolver.getTransportHandler(this.transport);\n const semantic = this.resolver.getSemanticHandler(this.semantic);\n const context = this.createContext(params);\n return semantic.resolve(transport, this.location, context);\n }\n async deposit(data, params) {\n const transport = this.resolver.getTransportHandler(this.transport);\n const semantic = this.resolver.getSemanticHandler(this.semantic);\n const context = this.createContext(params);\n if (!semantic.deposit) {\n throw new SemanticError(`Semantic \"${semantic.name}\" does not support deposit operation`, this.semantic);\n }\n await semantic.deposit(transport, this.location, data, context);\n }\n async exists() {\n const transport = this.resolver.getTransportHandler(this.transport);\n const semantic = this.resolver.getSemanticHandler(this.semantic);\n const context = this.createContext();\n if (semantic.exists) {\n return semantic.exists(transport, this.location, context);\n }\n return transport.exists(this.location);\n }\n async delete() {\n const transport = this.resolver.getTransportHandler(this.transport);\n const semantic = this.resolver.getSemanticHandler(this.semantic);\n const context = this.createContext();\n if (semantic.delete) {\n return semantic.delete(transport, this.location, context);\n }\n await transport.delete(this.location);\n }\n async list(options) {\n const transport = this.resolver.getTransportHandler(this.transport);\n if (!transport.list) {\n throw new TransportError(`Transport \"${transport.name}\" does not support list operation`, this.transport);\n }\n return transport.list(this.location, options);\n }\n async mkdir() {\n const transport = this.resolver.getTransportHandler(this.transport);\n if (!transport.mkdir) {\n throw new TransportError(`Transport \"${transport.name}\" does not support mkdir operation`, this.transport);\n }\n await transport.mkdir(this.location);\n }\n toString() {\n return `arp:${this.semantic}:${this.transport}://${this.location}`;\n }\n}\n\n// src/semantic/binary.ts\nfunction toBuffer(data) {\n if (Buffer.isBuffer(data)) {\n return data;\n }\n if (data instanceof Uint8Array) {\n return Buffer.from(data);\n }\n if (data instanceof ArrayBuffer) {\n return Buffer.from(data);\n }\n if (Array.isArray(data)) {\n return Buffer.from(data);\n }\n throw new SemanticError(`Unsupported binary input type`, \"binary\");\n}\n\nclass BinarySemanticHandler {\n name = \"binary\";\n async resolve(transport, location, context) {\n const result = await transport.get(location, context.params);\n const meta = {\n url: context.url,\n semantic: context.semantic,\n transport: context.transport,\n location: context.location,\n size: result.metadata?.size ?? result.content.length,\n resolvedAt: context.timestamp.toISOString(),\n type: result.metadata?.type\n };\n return {\n type: \"binary\",\n content: result.content,\n meta\n };\n }\n async deposit(transport, location, data, context) {\n const buffer = toBuffer(data);\n try {\n await transport.set(location, buffer, context.params);\n } catch (error) {\n throw new SemanticError(`Failed to deposit binary to \"${location}\": ${error.message}`, this.name, { cause: error });\n }\n }\n async exists(transport, location, _context) {\n return transport.exists(location);\n }\n async delete(transport, location, _context) {\n try {\n await transport.delete(location);\n } catch (error) {\n throw new SemanticError(`Failed to delete \"${location}\": ${error.message}`, this.name, { cause: error });\n }\n }\n}\nvar binarySemantic = new BinarySemanticHandler;\n// src/semantic/text.ts\nclass TextSemanticHandler {\n name = \"text\";\n async resolve(transport, location, context) {\n const result = await transport.get(location, context.params);\n if (result.metadata?.type === \"directory\") {\n const meta2 = {\n url: context.url,\n semantic: context.semantic,\n transport: context.transport,\n location: context.location,\n size: result.content.length,\n encoding: \"utf-8\",\n mimeType: \"application/json\",\n resolvedAt: context.timestamp.toISOString(),\n type: \"directory\"\n };\n return {\n type: \"text\",\n content: result.content.toString(\"utf-8\"),\n meta: meta2\n };\n }\n const text = result.content.toString(\"utf-8\");\n const meta = {\n url: context.url,\n semantic: context.semantic,\n transport: context.transport,\n location: context.location,\n size: result.metadata?.size ?? result.content.length,\n encoding: \"utf-8\",\n mimeType: \"text/plain\",\n resolvedAt: context.timestamp.toISOString(),\n type: \"file\"\n };\n return {\n type: \"text\",\n content: text,\n meta\n };\n }\n async deposit(transport, location, data, context) {\n const buffer = Buffer.from(data, \"utf-8\");\n try {\n await transport.set(location, buffer, context.params);\n } catch (error) {\n throw new SemanticError(`Failed to deposit text to \"${location}\": ${error.message}`, this.name, { cause: error });\n }\n }\n async exists(transport, location, _context) {\n return transport.exists(location);\n }\n async delete(transport, location, _context) {\n try {\n await transport.delete(location);\n } catch (error) {\n throw new SemanticError(`Failed to delete \"${location}\": ${error.message}`, this.name, { cause: error });\n }\n }\n}\nvar textSemantic = new TextSemanticHandler;\n// src/transport/file.ts\nimport { access, mkdir, readdir, readFile, rm, stat, writeFile } from \"node:fs/promises\";\nimport { dirname, join, resolve } from \"node:path\";\nclass FileTransportHandler {\n name = \"file\";\n resolvePath(location) {\n return resolve(process.cwd(), location);\n }\n async get(location, params) {\n const filePath = this.resolvePath(location);\n try {\n const stats = await stat(filePath);\n if (stats.isDirectory()) {\n return this.getDirectory(filePath, stats, params);\n } else {\n return this.getFile(filePath, stats);\n }\n } catch (error) {\n const err = error;\n throw new TransportError(`File get error: ${err.code} - ${filePath}`, this.name, {\n cause: err\n });\n }\n }\n async getFile(filePath, stats) {\n const content = await readFile(filePath);\n return {\n content,\n metadata: {\n type: \"file\",\n size: Number(stats.size),\n modifiedAt: stats.mtime\n }\n };\n }\n async getDirectory(dirPath, stats, params) {\n const recursive = params?.recursive === \"true\";\n const pattern = params?.pattern;\n let entries;\n if (recursive) {\n entries = await this.listRecursive(dirPath, dirPath);\n } else {\n entries = await readdir(dirPath);\n }\n if (pattern) {\n entries = this.filterByPattern(entries, pattern);\n }\n const content = Buffer.from(JSON.stringify(entries));\n return {\n content,\n metadata: {\n type: \"directory\",\n modifiedAt: stats.mtime\n }\n };\n }\n async listRecursive(basePath, currentPath) {\n const entries = await readdir(currentPath, { withFileTypes: true });\n const results = [];\n for (const entry of entries) {\n const fullPath = join(currentPath, entry.name);\n const relativePath = fullPath.substring(basePath.length + 1);\n if (entry.isDirectory()) {\n const subEntries = await this.listRecursive(basePath, fullPath);\n results.push(...subEntries);\n } else {\n results.push(relativePath);\n }\n }\n return results;\n }\n filterByPattern(entries, pattern) {\n const regexPattern = pattern.replace(/\\./g, \"\\\\.\").replace(/\\*/g, \".*\").replace(/\\?/g, \".\");\n const regex = new RegExp(`^${regexPattern}$`);\n return entries.filter((entry) => {\n const filename = entry.split(\"/\").pop() || entry;\n return regex.test(filename);\n });\n }\n async set(location, content, _params) {\n const filePath = this.resolvePath(location);\n try {\n await mkdir(dirname(filePath), { recursive: true });\n await writeFile(filePath, content);\n } catch (error) {\n const err = error;\n throw new TransportError(`File set error: ${err.code} - ${filePath}`, this.name, {\n cause: err\n });\n }\n }\n async exists(location) {\n const filePath = this.resolvePath(location);\n try {\n await access(filePath);\n return true;\n } catch {\n return false;\n }\n }\n async delete(location) {\n const filePath = this.resolvePath(location);\n try {\n await rm(filePath, { recursive: true });\n } catch (error) {\n const err = error;\n if (err.code === \"ENOENT\") {\n return;\n }\n throw new TransportError(`File delete error: ${err.code} - ${filePath}`, this.name, {\n cause: err\n });\n }\n }\n async list(location, options) {\n const dirPath = this.resolvePath(location);\n try {\n let entries;\n if (options?.recursive) {\n entries = await this.listRecursive(dirPath, dirPath);\n } else {\n entries = await readdir(dirPath);\n }\n if (options?.pattern) {\n entries = this.filterByPattern(entries, options.pattern);\n }\n return entries;\n } catch (error) {\n const err = error;\n throw new TransportError(`File list error: ${err.code} - ${dirPath}`, this.name, {\n cause: err\n });\n }\n }\n async mkdir(location) {\n const dirPath = this.resolvePath(location);\n try {\n await mkdir(dirPath, { recursive: true });\n } catch (error) {\n const err = error;\n throw new TransportError(`File mkdir error: ${err.code} - ${dirPath}`, this.name, {\n cause: err\n });\n }\n }\n}\nvar fileTransport = new FileTransportHandler;\n// src/transport/http.ts\nclass HttpTransportHandler {\n name;\n protocol;\n constructor(protocol = \"https\") {\n this.protocol = protocol;\n this.name = protocol;\n }\n async get(location, params) {\n const url = this.buildUrl(location, params);\n try {\n const response = await fetch(url);\n if (!response.ok) {\n throw new TransportError(`HTTP ${response.status}: ${response.statusText} - ${url}`, this.name);\n }\n const arrayBuffer = await response.arrayBuffer();\n const content = Buffer.from(arrayBuffer);\n const contentType = response.headers.get(\"content-type\");\n const contentLength = response.headers.get(\"content-length\");\n const lastModified = response.headers.get(\"last-modified\");\n return {\n content,\n metadata: {\n type: \"file\",\n size: contentLength ? parseInt(contentLength, 10) : content.length,\n modifiedAt: lastModified ? new Date(lastModified) : undefined,\n contentType\n }\n };\n } catch (error) {\n if (error instanceof TransportError) {\n throw error;\n }\n throw new TransportError(`Network error: ${url}`, this.name, {\n cause: error\n });\n }\n }\n buildUrl(location, params) {\n const url = new URL(`${this.protocol}://${location}`);\n if (params) {\n for (const [key, value] of Object.entries(params)) {\n url.searchParams.set(key, value);\n }\n }\n return url.toString();\n }\n async set(_location, _content, _params) {\n throw new TransportError(\"HTTP transport is read-only, set not supported\", this.name);\n }\n async exists(location) {\n const url = `${this.protocol}://${location}`;\n try {\n const response = await fetch(url, { method: \"HEAD\" });\n return response.ok;\n } catch {\n return false;\n }\n }\n async delete(_location) {\n throw new TransportError(\"HTTP transport is read-only, delete not supported\", this.name);\n }\n}\nvar httpsTransport = new HttpTransportHandler(\"https\");\nvar httpTransport = new HttpTransportHandler(\"http\");\n// src/ARP.ts\nclass ARP {\n transports;\n semantics;\n constructor(config = {}) {\n this.transports = new Map;\n this.semantics = new Map;\n const defaultTransports = [fileTransport, httpTransport, httpsTransport];\n const defaultSemantics = [textSemantic, binarySemantic];\n for (const handler of defaultTransports) {\n this.transports.set(handler.name, handler);\n }\n for (const handler of defaultSemantics) {\n this.semantics.set(handler.name, handler);\n }\n if (config.transports) {\n for (const handler of config.transports) {\n this.transports.set(handler.name, handler);\n }\n }\n if (config.semantics) {\n for (const handler of config.semantics) {\n this.semantics.set(handler.name, handler);\n }\n }\n }\n registerTransport(handler) {\n this.transports.set(handler.name, handler);\n }\n registerSemantic(handler) {\n this.semantics.set(handler.name, handler);\n }\n getTransportHandler(name) {\n const handler = this.transports.get(name);\n if (!handler) {\n throw new TransportError(`Unsupported transport type: ${name}`, name);\n }\n return handler;\n }\n getSemanticHandler(name) {\n const handler = this.semantics.get(name);\n if (!handler) {\n throw new SemanticError(`Unsupported semantic type: ${name}`, name);\n }\n return handler;\n }\n parse(url) {\n if (!url.startsWith(\"arp:\")) {\n throw new ParseError(`Invalid ARP URL: must start with \"arp:\"`, url);\n }\n const content = url.substring(4);\n const separatorIndex = content.indexOf(\"://\");\n if (separatorIndex === -1) {\n throw new ParseError(`Invalid ARP URL: missing \"://\"`, url);\n }\n const typePart = content.substring(0, separatorIndex);\n const location = content.substring(separatorIndex + 3);\n const colonIndex = typePart.indexOf(\":\");\n if (colonIndex === -1) {\n throw new ParseError(`Invalid ARP URL: must have exactly 2 types (semantic:transport)`, url);\n }\n const semantic = typePart.substring(0, colonIndex);\n const transport = typePart.substring(colonIndex + 1);\n if (!semantic) {\n throw new ParseError(`Invalid ARP URL: semantic type cannot be empty`, url);\n }\n if (!transport) {\n throw new ParseError(`Invalid ARP URL: transport type cannot be empty`, url);\n }\n if (!location) {\n throw new ParseError(`Invalid ARP URL: location cannot be empty`, url);\n }\n this.getTransportHandler(transport);\n this.getSemanticHandler(semantic);\n return new ARL(semantic, transport, location, this);\n }\n}\nfunction createARP(config) {\n return new ARP(config);\n}\n\n// src/index.ts\nvar VERSION = \"2.8.0\";\nexport {\n textSemantic,\n httpsTransport,\n httpTransport,\n fileTransport,\n createARP,\n binarySemantic,\n VERSION,\n TransportError,\n TextSemanticHandler,\n SemanticError,\n ParseError,\n HttpTransportHandler,\n FileTransportHandler,\n BinarySemanticHandler,\n ARPError,\n ARP\n};\n\n//# debugId=A29CE647E53652E264756E2164756E21\n"
|
|
5
|
+
"// src/errors.ts\nclass ARPError extends Error {\n constructor(message, options) {\n super(message, options);\n this.name = \"ARPError\";\n }\n}\n\nclass ParseError extends ARPError {\n url;\n constructor(message, url) {\n super(message);\n this.url = url;\n this.name = \"ParseError\";\n }\n}\n\nclass TransportError extends ARPError {\n transport;\n constructor(message, transport, options) {\n super(message, options);\n this.transport = transport;\n this.name = \"TransportError\";\n }\n}\n\nclass SemanticError extends ARPError {\n semantic;\n constructor(message, semantic, options) {\n super(message, options);\n this.semantic = semantic;\n this.name = \"SemanticError\";\n }\n}\n\n// src/ARL.ts\nclass ARL {\n semantic;\n transport;\n location;\n resolver;\n constructor(semantic, transport, location, resolver) {\n this.semantic = semantic;\n this.transport = transport;\n this.location = location;\n this.resolver = resolver;\n }\n createContext(params) {\n return {\n url: this.toString(),\n semantic: this.semantic,\n transport: this.transport,\n location: this.location,\n timestamp: new Date,\n params\n };\n }\n async resolve(params) {\n const transport = this.resolver.getTransportHandler(this.transport);\n const semantic = this.resolver.getSemanticHandler(this.semantic);\n const context = this.createContext(params);\n return semantic.resolve(transport, this.location, context);\n }\n async deposit(data, params) {\n const transport = this.resolver.getTransportHandler(this.transport);\n const semantic = this.resolver.getSemanticHandler(this.semantic);\n const context = this.createContext(params);\n if (!semantic.deposit) {\n throw new SemanticError(`Semantic \"${semantic.name}\" does not support deposit operation`, this.semantic);\n }\n await semantic.deposit(transport, this.location, data, context);\n }\n async exists() {\n const transport = this.resolver.getTransportHandler(this.transport);\n const semantic = this.resolver.getSemanticHandler(this.semantic);\n const context = this.createContext();\n if (semantic.exists) {\n return semantic.exists(transport, this.location, context);\n }\n return transport.exists(this.location);\n }\n async delete() {\n const transport = this.resolver.getTransportHandler(this.transport);\n const semantic = this.resolver.getSemanticHandler(this.semantic);\n const context = this.createContext();\n if (semantic.delete) {\n return semantic.delete(transport, this.location, context);\n }\n await transport.delete(this.location);\n }\n async list(options) {\n const transport = this.resolver.getTransportHandler(this.transport);\n if (!transport.list) {\n throw new TransportError(`Transport \"${transport.name}\" does not support list operation`, this.transport);\n }\n return transport.list(this.location, options);\n }\n async mkdir() {\n const transport = this.resolver.getTransportHandler(this.transport);\n if (!transport.mkdir) {\n throw new TransportError(`Transport \"${transport.name}\" does not support mkdir operation`, this.transport);\n }\n await transport.mkdir(this.location);\n }\n toString() {\n return `arp:${this.semantic}:${this.transport}://${this.location}`;\n }\n}\n\n// src/semantic/binary.ts\nfunction toBuffer(data) {\n if (Buffer.isBuffer(data)) {\n return data;\n }\n if (data instanceof Uint8Array) {\n return Buffer.from(data);\n }\n if (data instanceof ArrayBuffer) {\n return Buffer.from(data);\n }\n if (Array.isArray(data)) {\n return Buffer.from(data);\n }\n throw new SemanticError(`Unsupported binary input type`, \"binary\");\n}\n\nclass BinarySemanticHandler {\n name = \"binary\";\n async resolve(transport, location, context) {\n const result = await transport.get(location, context.params);\n const meta = {\n url: context.url,\n semantic: context.semantic,\n transport: context.transport,\n location: context.location,\n size: result.metadata?.size ?? result.content.length,\n resolvedAt: context.timestamp.toISOString(),\n type: result.metadata?.type\n };\n return {\n type: \"binary\",\n content: result.content,\n meta\n };\n }\n async deposit(transport, location, data, context) {\n const buffer = toBuffer(data);\n try {\n await transport.set(location, buffer, context.params);\n } catch (error) {\n throw new SemanticError(`Failed to deposit binary to \"${location}\": ${error.message}`, this.name, { cause: error });\n }\n }\n async exists(transport, location, _context) {\n return transport.exists(location);\n }\n async delete(transport, location, _context) {\n try {\n await transport.delete(location);\n } catch (error) {\n throw new SemanticError(`Failed to delete \"${location}\": ${error.message}`, this.name, { cause: error });\n }\n }\n}\nvar binarySemantic = new BinarySemanticHandler;\n// src/semantic/text.ts\nclass TextSemanticHandler {\n name = \"text\";\n async resolve(transport, location, context) {\n const result = await transport.get(location, context.params);\n if (result.metadata?.type === \"directory\") {\n const meta2 = {\n url: context.url,\n semantic: context.semantic,\n transport: context.transport,\n location: context.location,\n size: result.content.length,\n encoding: \"utf-8\",\n mimeType: \"application/json\",\n resolvedAt: context.timestamp.toISOString(),\n type: \"directory\"\n };\n return {\n type: \"text\",\n content: result.content.toString(\"utf-8\"),\n meta: meta2\n };\n }\n const text = result.content.toString(\"utf-8\");\n const meta = {\n url: context.url,\n semantic: context.semantic,\n transport: context.transport,\n location: context.location,\n size: result.metadata?.size ?? result.content.length,\n encoding: \"utf-8\",\n mimeType: \"text/plain\",\n resolvedAt: context.timestamp.toISOString(),\n type: \"file\"\n };\n return {\n type: \"text\",\n content: text,\n meta\n };\n }\n async deposit(transport, location, data, context) {\n const buffer = Buffer.from(data, \"utf-8\");\n try {\n await transport.set(location, buffer, context.params);\n } catch (error) {\n throw new SemanticError(`Failed to deposit text to \"${location}\": ${error.message}`, this.name, { cause: error });\n }\n }\n async exists(transport, location, _context) {\n return transport.exists(location);\n }\n async delete(transport, location, _context) {\n try {\n await transport.delete(location);\n } catch (error) {\n throw new SemanticError(`Failed to delete \"${location}\": ${error.message}`, this.name, { cause: error });\n }\n }\n}\nvar textSemantic = new TextSemanticHandler;\n// src/transport/file.ts\nimport { access, mkdir, readdir, readFile, rm, stat, writeFile } from \"node:fs/promises\";\nimport { dirname, join, resolve } from \"node:path\";\nclass FileTransportHandler {\n name = \"file\";\n resolvePath(location) {\n return resolve(process.cwd(), location);\n }\n async get(location, params) {\n const filePath = this.resolvePath(location);\n try {\n const stats = await stat(filePath);\n if (stats.isDirectory()) {\n return this.getDirectory(filePath, stats, params);\n } else {\n return this.getFile(filePath, stats);\n }\n } catch (error) {\n const err = error;\n throw new TransportError(`File get error: ${err.code} - ${filePath}`, this.name, {\n cause: err\n });\n }\n }\n async getFile(filePath, stats) {\n const content = await readFile(filePath);\n return {\n content,\n metadata: {\n type: \"file\",\n size: Number(stats.size),\n modifiedAt: stats.mtime\n }\n };\n }\n async getDirectory(dirPath, stats, params) {\n const recursive = params?.recursive === \"true\";\n const pattern = params?.pattern;\n let entries;\n if (recursive) {\n entries = await this.listRecursive(dirPath, dirPath);\n } else {\n entries = await readdir(dirPath);\n }\n if (pattern) {\n entries = this.filterByPattern(entries, pattern);\n }\n const content = Buffer.from(JSON.stringify(entries));\n return {\n content,\n metadata: {\n type: \"directory\",\n modifiedAt: stats.mtime\n }\n };\n }\n async listRecursive(basePath, currentPath) {\n const entries = await readdir(currentPath, { withFileTypes: true });\n const results = [];\n for (const entry of entries) {\n const fullPath = join(currentPath, entry.name);\n const relativePath = fullPath.substring(basePath.length + 1);\n if (entry.isDirectory()) {\n const subEntries = await this.listRecursive(basePath, fullPath);\n results.push(...subEntries);\n } else {\n results.push(relativePath);\n }\n }\n return results;\n }\n filterByPattern(entries, pattern) {\n const regexPattern = pattern.replace(/\\./g, \"\\\\.\").replace(/\\*/g, \".*\").replace(/\\?/g, \".\");\n const regex = new RegExp(`^${regexPattern}$`);\n return entries.filter((entry) => {\n const filename = entry.split(\"/\").pop() || entry;\n return regex.test(filename);\n });\n }\n async set(location, content, _params) {\n const filePath = this.resolvePath(location);\n try {\n await mkdir(dirname(filePath), { recursive: true });\n await writeFile(filePath, content);\n } catch (error) {\n const err = error;\n throw new TransportError(`File set error: ${err.code} - ${filePath}`, this.name, {\n cause: err\n });\n }\n }\n async exists(location) {\n const filePath = this.resolvePath(location);\n try {\n await access(filePath);\n return true;\n } catch {\n return false;\n }\n }\n async delete(location) {\n const filePath = this.resolvePath(location);\n try {\n await rm(filePath, { recursive: true });\n } catch (error) {\n const err = error;\n if (err.code === \"ENOENT\") {\n return;\n }\n throw new TransportError(`File delete error: ${err.code} - ${filePath}`, this.name, {\n cause: err\n });\n }\n }\n async list(location, options) {\n const dirPath = this.resolvePath(location);\n try {\n let entries;\n if (options?.recursive) {\n entries = await this.listRecursive(dirPath, dirPath);\n } else {\n entries = await readdir(dirPath);\n }\n if (options?.pattern) {\n entries = this.filterByPattern(entries, options.pattern);\n }\n return entries;\n } catch (error) {\n const err = error;\n throw new TransportError(`File list error: ${err.code} - ${dirPath}`, this.name, {\n cause: err\n });\n }\n }\n async mkdir(location) {\n const dirPath = this.resolvePath(location);\n try {\n await mkdir(dirPath, { recursive: true });\n } catch (error) {\n const err = error;\n throw new TransportError(`File mkdir error: ${err.code} - ${dirPath}`, this.name, {\n cause: err\n });\n }\n }\n}\nvar fileTransport = new FileTransportHandler;\n// src/transport/http.ts\nclass HttpTransportHandler {\n name;\n protocol;\n constructor(protocol = \"https\") {\n this.protocol = protocol;\n this.name = protocol;\n }\n async get(location, params) {\n const url = this.buildUrl(location, params);\n try {\n const response = await fetch(url);\n if (!response.ok) {\n throw new TransportError(`HTTP ${response.status}: ${response.statusText} - ${url}`, this.name);\n }\n const arrayBuffer = await response.arrayBuffer();\n const content = Buffer.from(arrayBuffer);\n const contentType = response.headers.get(\"content-type\");\n const contentLength = response.headers.get(\"content-length\");\n const lastModified = response.headers.get(\"last-modified\");\n return {\n content,\n metadata: {\n type: \"file\",\n size: contentLength ? parseInt(contentLength, 10) : content.length,\n modifiedAt: lastModified ? new Date(lastModified) : undefined,\n contentType\n }\n };\n } catch (error) {\n if (error instanceof TransportError) {\n throw error;\n }\n throw new TransportError(`Network error: ${url}`, this.name, {\n cause: error\n });\n }\n }\n buildUrl(location, params) {\n const url = new URL(`${this.protocol}://${location}`);\n if (params) {\n for (const [key, value] of Object.entries(params)) {\n url.searchParams.set(key, value);\n }\n }\n return url.toString();\n }\n async set(_location, _content, _params) {\n throw new TransportError(\"HTTP transport is read-only, set not supported\", this.name);\n }\n async exists(location) {\n const url = `${this.protocol}://${location}`;\n try {\n const response = await fetch(url, { method: \"HEAD\" });\n return response.ok;\n } catch {\n return false;\n }\n }\n async delete(_location) {\n throw new TransportError(\"HTTP transport is read-only, delete not supported\", this.name);\n }\n}\nvar httpsTransport = new HttpTransportHandler(\"https\");\nvar httpTransport = new HttpTransportHandler(\"http\");\n// src/ARP.ts\nclass ARP {\n transports;\n semantics;\n constructor(config = {}) {\n this.transports = new Map;\n this.semantics = new Map;\n const defaultTransports = [fileTransport, httpTransport, httpsTransport];\n const defaultSemantics = [textSemantic, binarySemantic];\n for (const handler of defaultTransports) {\n this.transports.set(handler.name, handler);\n }\n for (const handler of defaultSemantics) {\n this.semantics.set(handler.name, handler);\n }\n if (config.transports) {\n for (const handler of config.transports) {\n this.transports.set(handler.name, handler);\n }\n }\n if (config.semantics) {\n for (const handler of config.semantics) {\n this.semantics.set(handler.name, handler);\n }\n }\n }\n registerTransport(handler) {\n this.transports.set(handler.name, handler);\n }\n registerSemantic(handler) {\n this.semantics.set(handler.name, handler);\n }\n getTransportHandler(name) {\n const handler = this.transports.get(name);\n if (!handler) {\n throw new TransportError(`Unsupported transport type: ${name}`, name);\n }\n return handler;\n }\n getSemanticHandler(name) {\n const handler = this.semantics.get(name);\n if (!handler) {\n throw new SemanticError(`Unsupported semantic type: ${name}`, name);\n }\n return handler;\n }\n parse(url) {\n if (!url.startsWith(\"arp:\")) {\n throw new ParseError(`Invalid ARP URL: must start with \"arp:\"`, url);\n }\n const content = url.substring(4);\n const separatorIndex = content.indexOf(\"://\");\n if (separatorIndex === -1) {\n throw new ParseError(`Invalid ARP URL: missing \"://\"`, url);\n }\n const typePart = content.substring(0, separatorIndex);\n const location = content.substring(separatorIndex + 3);\n const colonIndex = typePart.indexOf(\":\");\n if (colonIndex === -1) {\n throw new ParseError(`Invalid ARP URL: must have exactly 2 types (semantic:transport)`, url);\n }\n const semantic = typePart.substring(0, colonIndex);\n const transport = typePart.substring(colonIndex + 1);\n if (!semantic) {\n throw new ParseError(`Invalid ARP URL: semantic type cannot be empty`, url);\n }\n if (!transport) {\n throw new ParseError(`Invalid ARP URL: transport type cannot be empty`, url);\n }\n if (!location) {\n throw new ParseError(`Invalid ARP URL: location cannot be empty`, url);\n }\n this.getTransportHandler(transport);\n this.getSemanticHandler(semantic);\n return new ARL(semantic, transport, location, this);\n }\n}\nfunction createARP(config) {\n return new ARP(config);\n}\n\n// src/index.ts\nvar VERSION = \"2.9.0\";\nexport {\n textSemantic,\n httpsTransport,\n httpTransport,\n fileTransport,\n createARP,\n binarySemantic,\n VERSION,\n TransportError,\n TextSemanticHandler,\n SemanticError,\n ParseError,\n HttpTransportHandler,\n FileTransportHandler,\n BinarySemanticHandler,\n ARPError,\n ARP\n};\n\n//# debugId=197EBCEB7581CB0E64756E2164756E21\n"
|
|
6
6
|
],
|
|
7
7
|
"mappings": ";;;;;;;;;;;;;AAmOA;AACA;AAAA;AAnOA,MAAM,iBAAiB,MAAM;AAAA,EAC3B,WAAW,CAAC,SAAS,SAAS;AAAA,IAC5B,MAAM,SAAS,OAAO;AAAA,IACtB,KAAK,OAAO;AAAA;AAEhB;AAAA;AAEA,MAAM,mBAAmB,SAAS;AAAA,EAChC;AAAA,EACA,WAAW,CAAC,S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Y,SAAS,UAAU,aAAa,CAAC;AAAA,IACnD,IAAI,CAAC,UAAU;AAAA,MACb,MAAM,IAAI,WAAW,kDAAkD,GAAG;AAAA,IAC5E;AAAA,IACA,IAAI,CAAC,WAAW;AAAA,MACd,MAAM,IAAI,WAAW,mDAAmD,GAAG;AAAA,IAC7E;AAAA,IACA,IAAI,CAAC,UAAU;AAAA,MACb,MAAM,IAAI,WAAW,6CAA6C,GAAG;AAAA,IACvE;AAAA,IACA,KAAK,oBAAoB,SAAS;AAAA,IAClC,KAAK,mBAAmB,QAAQ;AAAA,IAChC,OAAO,IAAI,IAAI,UAAU,WAAW,UAAU,IAAI;AAAA;AAEtD;AACA,SAAS,SAAS,CAAC,QAAQ;AAAA,EACzB,OAAO,IAAI,IAAI,MAAM;AAAA;AAIvB,IAAI,UAAU;",
|
|
8
|
-
"debugId": "
|
|
8
|
+
"debugId": "41987E49544A3B4264756E2164756E21",
|
|
9
9
|
"names": []
|
|
10
10
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BundledType as BundledType2, IsolatorType as IsolatorType2, ProviderConfig, ProviderStores, ResolveSourceConfig, ResourceXProvider as ResourceXProvider2, RXA, RXD, RXL, RXM, RXR, RXS, SourceLoader, TypeDetectionResult, TypeDetector as TypeDetector2 } from "@resourcexjs/core";
|
|
1
|
+
import { BundledType as BundledType2, FileEntry, FileTree, IsolatorType as IsolatorType2, ProviderConfig, ProviderStores, ResolveSourceConfig, ResourceXProvider as ResourceXProvider2, RXA, RXD, RXL, RXM, RXMArchive as RXMArchive2, RXMDefinition as RXMDefinition2, RXMSource as RXMSource2, RXR, RXS, SourceLoader, TypeDetectionResult, TypeDetector as TypeDetector2 } from "@resourcexjs/core";
|
|
2
2
|
import { archive, bundleResourceType, extract, FolderSourceLoader, format, GitHubSourceLoader, generateDefinition, manifest, parse, RegistryError, ResourceJsonDetector, ResourceTypeError, resolveSource, resource, SkillDetector, SourceLoaderChain, TypeDetectorChain, wrap } from "@resourcexjs/core";
|
|
3
3
|
import { ResourceXProvider } from "@resourcexjs/core";
|
|
4
4
|
/**
|
|
@@ -30,7 +30,7 @@ declare function hasProvider(): boolean;
|
|
|
30
30
|
* Clear the provider (for testing).
|
|
31
31
|
*/
|
|
32
32
|
declare function clearProvider(): void;
|
|
33
|
-
import { BundledType, IsolatorType, TypeDetector } from "@resourcexjs/core";
|
|
33
|
+
import { BundledType, IsolatorType, RXMArchive, RXMDefinition, RXMSource, TypeDetector } from "@resourcexjs/core";
|
|
34
34
|
/**
|
|
35
35
|
* ResourceX configuration.
|
|
36
36
|
*/
|
|
@@ -62,15 +62,13 @@ interface ResourceXConfig {
|
|
|
62
62
|
}
|
|
63
63
|
/**
|
|
64
64
|
* Resource - user-facing resource object.
|
|
65
|
+
* Structured by RX primitives: definition, archive, source.
|
|
65
66
|
*/
|
|
66
67
|
interface Resource {
|
|
67
68
|
locator: string;
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
type: string;
|
|
72
|
-
tag: string;
|
|
73
|
-
files?: string[];
|
|
69
|
+
definition: RXMDefinition;
|
|
70
|
+
archive: RXMArchive;
|
|
71
|
+
source: RXMSource;
|
|
74
72
|
}
|
|
75
73
|
/**
|
|
76
74
|
* ResourceX interface - unified API for resource management.
|
|
@@ -96,4 +94,4 @@ interface ResourceX {
|
|
|
96
94
|
*/
|
|
97
95
|
declare function createResourceX(config?: ResourceXConfig): ResourceX;
|
|
98
96
|
declare const VERSION: string;
|
|
99
|
-
export { wrap, setProvider, resource, resolveSource, parse, manifest, hasProvider, getProvider, generateDefinition, format, extract, createResourceX, clearProvider, bundleResourceType, archive, VERSION, TypeDetectorChain, TypeDetector2 as TypeDetector, TypeDetectionResult, SourceLoaderChain, SourceLoader, SkillDetector, ResourceXProvider2 as ResourceXProvider, ResourceXConfig, ResourceX, ResourceTypeError, ResourceJsonDetector, Resource, ResolveSourceConfig, RegistryError, RXS, RXR, RXM, RXL, RXD, RXA, ProviderStores, ProviderConfig, IsolatorType2 as IsolatorType, GitHubSourceLoader, FolderSourceLoader, BundledType2 as BundledType };
|
|
97
|
+
export { wrap, setProvider, resource, resolveSource, parse, manifest, hasProvider, getProvider, generateDefinition, format, extract, createResourceX, clearProvider, bundleResourceType, archive, VERSION, TypeDetectorChain, TypeDetector2 as TypeDetector, TypeDetectionResult, SourceLoaderChain, SourceLoader, SkillDetector, ResourceXProvider2 as ResourceXProvider, ResourceXConfig, ResourceX, ResourceTypeError, ResourceJsonDetector, Resource, ResolveSourceConfig, RegistryError, RXS, RXR, RXMSource2 as RXMSource, RXMDefinition2 as RXMDefinition, RXMArchive2 as RXMArchive, RXM, RXL, RXD, RXA, ProviderStores, ProviderConfig, IsolatorType2 as IsolatorType, GitHubSourceLoader, FolderSourceLoader, FileTree, FileEntry, BundledType2 as BundledType };
|
package/dist/index.js
CHANGED
|
@@ -4725,19 +4725,28 @@ function format(rxl) {
|
|
|
4725
4725
|
}
|
|
4726
4726
|
function locate(rxm) {
|
|
4727
4727
|
return {
|
|
4728
|
-
registry: rxm.registry,
|
|
4729
|
-
path: rxm.path,
|
|
4730
|
-
name: rxm.name,
|
|
4731
|
-
tag: rxm.tag
|
|
4728
|
+
registry: rxm.definition.registry,
|
|
4729
|
+
path: rxm.definition.path,
|
|
4730
|
+
name: rxm.definition.name,
|
|
4731
|
+
tag: rxm.definition.tag
|
|
4732
4732
|
};
|
|
4733
4733
|
}
|
|
4734
4734
|
function manifest(rxd) {
|
|
4735
4735
|
return {
|
|
4736
|
-
|
|
4737
|
-
|
|
4738
|
-
|
|
4739
|
-
|
|
4740
|
-
|
|
4736
|
+
definition: {
|
|
4737
|
+
name: rxd.name,
|
|
4738
|
+
type: rxd.type,
|
|
4739
|
+
tag: rxd.tag ?? "latest",
|
|
4740
|
+
registry: rxd.registry,
|
|
4741
|
+
path: rxd.path,
|
|
4742
|
+
description: rxd.description,
|
|
4743
|
+
author: rxd.author,
|
|
4744
|
+
license: rxd.license,
|
|
4745
|
+
keywords: rxd.keywords,
|
|
4746
|
+
repository: rxd.repository
|
|
4747
|
+
},
|
|
4748
|
+
archive: {},
|
|
4749
|
+
source: {}
|
|
4741
4750
|
};
|
|
4742
4751
|
}
|
|
4743
4752
|
function validateLocatorSecurity(locator) {
|
|
@@ -5277,12 +5286,20 @@ class CASRegistry {
|
|
|
5277
5286
|
files2[filename] = await this.rxaStore.get(digest);
|
|
5278
5287
|
}
|
|
5279
5288
|
const rxm = {
|
|
5280
|
-
|
|
5281
|
-
|
|
5282
|
-
|
|
5283
|
-
|
|
5284
|
-
|
|
5285
|
-
|
|
5289
|
+
definition: {
|
|
5290
|
+
registry: storedRxm.registry,
|
|
5291
|
+
path: storedRxm.path,
|
|
5292
|
+
name: storedRxm.name,
|
|
5293
|
+
type: storedRxm.type,
|
|
5294
|
+
tag: storedRxm.tag,
|
|
5295
|
+
description: storedRxm.description,
|
|
5296
|
+
author: storedRxm.author,
|
|
5297
|
+
license: storedRxm.license,
|
|
5298
|
+
keywords: storedRxm.keywords,
|
|
5299
|
+
repository: storedRxm.repository
|
|
5300
|
+
},
|
|
5301
|
+
archive: {},
|
|
5302
|
+
source: {}
|
|
5286
5303
|
};
|
|
5287
5304
|
const rxa = await archive(files2);
|
|
5288
5305
|
return resource(rxm, rxa);
|
|
@@ -5295,17 +5312,22 @@ class CASRegistry {
|
|
|
5295
5312
|
fileDigests[filename] = digest;
|
|
5296
5313
|
}
|
|
5297
5314
|
const storedRxm = {
|
|
5298
|
-
registry: rxr2.manifest.registry,
|
|
5299
|
-
path: rxr2.manifest.path,
|
|
5300
|
-
name: rxr2.manifest.name,
|
|
5301
|
-
type: rxr2.manifest.type,
|
|
5302
|
-
tag: rxr2.manifest.tag,
|
|
5315
|
+
registry: rxr2.manifest.definition.registry,
|
|
5316
|
+
path: rxr2.manifest.definition.path,
|
|
5317
|
+
name: rxr2.manifest.definition.name,
|
|
5318
|
+
type: rxr2.manifest.definition.type,
|
|
5319
|
+
tag: rxr2.manifest.definition.tag,
|
|
5320
|
+
description: rxr2.manifest.definition.description,
|
|
5321
|
+
author: rxr2.manifest.definition.author,
|
|
5322
|
+
license: rxr2.manifest.definition.license,
|
|
5323
|
+
keywords: rxr2.manifest.definition.keywords,
|
|
5324
|
+
repository: rxr2.manifest.definition.repository,
|
|
5303
5325
|
files: fileDigests,
|
|
5304
5326
|
createdAt: new Date,
|
|
5305
5327
|
updatedAt: new Date
|
|
5306
5328
|
};
|
|
5307
5329
|
await this.rxmStore.put(storedRxm);
|
|
5308
|
-
await this.rxmStore.setLatest(rxr2.manifest.name, rxr2.manifest.tag, rxr2.manifest.registry);
|
|
5330
|
+
await this.rxmStore.setLatest(rxr2.manifest.definition.name, rxr2.manifest.definition.tag, rxr2.manifest.definition.registry);
|
|
5309
5331
|
}
|
|
5310
5332
|
async has(rxl) {
|
|
5311
5333
|
const tag = await this.resolveTag(rxl.name, rxl.tag ?? "latest", rxl.registry);
|
|
@@ -15462,8 +15484,8 @@ var init_dist = __esm(() => {
|
|
|
15462
15484
|
this.trustedRegistry = trustedRegistry;
|
|
15463
15485
|
}
|
|
15464
15486
|
validateRegistry(rxr2) {
|
|
15465
|
-
if (rxr2.manifest.registry !== this.trustedRegistry) {
|
|
15466
|
-
throw new RegistryError(`Untrusted registry: resource claims "${rxr2.manifest.registry}" but registry only trusts "${this.trustedRegistry}"`);
|
|
15487
|
+
if (rxr2.manifest.definition.registry !== this.trustedRegistry) {
|
|
15488
|
+
throw new RegistryError(`Untrusted registry: resource claims "${rxr2.manifest.definition.registry}" but registry only trusts "${this.trustedRegistry}"`);
|
|
15467
15489
|
}
|
|
15468
15490
|
}
|
|
15469
15491
|
async get(rxl) {
|
|
@@ -31067,6 +31089,45 @@ function clearProvider() {
|
|
|
31067
31089
|
}
|
|
31068
31090
|
// src/ResourceX.ts
|
|
31069
31091
|
init_dist();
|
|
31092
|
+
function buildFileTree(files2) {
|
|
31093
|
+
const tree = {};
|
|
31094
|
+
for (const [filePath, buffer] of Object.entries(files2)) {
|
|
31095
|
+
const parts = filePath.split("/");
|
|
31096
|
+
let current = tree;
|
|
31097
|
+
for (let i2 = 0;i2 < parts.length - 1; i2++) {
|
|
31098
|
+
const dirKey = `${parts[i2]}/`;
|
|
31099
|
+
if (!current[dirKey]) {
|
|
31100
|
+
current[dirKey] = {};
|
|
31101
|
+
}
|
|
31102
|
+
current = current[dirKey];
|
|
31103
|
+
}
|
|
31104
|
+
const fileName = parts[parts.length - 1];
|
|
31105
|
+
current[fileName] = { size: buffer.length };
|
|
31106
|
+
}
|
|
31107
|
+
return tree;
|
|
31108
|
+
}
|
|
31109
|
+
var PRIMARY_FILES = ["SKILL.md", "content", "README.md", "index.md"];
|
|
31110
|
+
var PREVIEW_MAX_LENGTH = 500;
|
|
31111
|
+
function extractPreview(files2) {
|
|
31112
|
+
for (const name of PRIMARY_FILES) {
|
|
31113
|
+
const buffer = files2[name];
|
|
31114
|
+
if (buffer) {
|
|
31115
|
+
const text = buffer.toString("utf-8");
|
|
31116
|
+
if (text.length <= PREVIEW_MAX_LENGTH)
|
|
31117
|
+
return text;
|
|
31118
|
+
return text.slice(0, PREVIEW_MAX_LENGTH);
|
|
31119
|
+
}
|
|
31120
|
+
}
|
|
31121
|
+
for (const [name, buffer] of Object.entries(files2)) {
|
|
31122
|
+
if (/\.(md|txt|feature|json|ya?ml|toml)$/i.test(name) || !name.includes(".")) {
|
|
31123
|
+
const text = buffer.toString("utf-8");
|
|
31124
|
+
if (text.length <= PREVIEW_MAX_LENGTH)
|
|
31125
|
+
return text;
|
|
31126
|
+
return text.slice(0, PREVIEW_MAX_LENGTH);
|
|
31127
|
+
}
|
|
31128
|
+
}
|
|
31129
|
+
return null;
|
|
31130
|
+
}
|
|
31070
31131
|
function normalizeRegistryUrl(url2) {
|
|
31071
31132
|
try {
|
|
31072
31133
|
const parsed = new URL(url2);
|
|
@@ -31115,12 +31176,9 @@ class DefaultResourceX {
|
|
|
31115
31176
|
toResource(rxr2) {
|
|
31116
31177
|
return {
|
|
31117
31178
|
locator: format(rxr2.locator),
|
|
31118
|
-
|
|
31119
|
-
|
|
31120
|
-
|
|
31121
|
-
type: rxr2.manifest.type,
|
|
31122
|
-
tag: rxr2.manifest.tag,
|
|
31123
|
-
files: rxr2.manifest.files
|
|
31179
|
+
definition: rxr2.manifest.definition,
|
|
31180
|
+
archive: rxr2.manifest.archive,
|
|
31181
|
+
source: rxr2.manifest.source
|
|
31124
31182
|
};
|
|
31125
31183
|
}
|
|
31126
31184
|
async add(path11) {
|
|
@@ -31128,14 +31186,14 @@ class DefaultResourceX {
|
|
|
31128
31186
|
loaderChain: this.loaderChain,
|
|
31129
31187
|
detectors: this.customDetectors
|
|
31130
31188
|
});
|
|
31131
|
-
if (rxr2.manifest.registry) {
|
|
31189
|
+
if (rxr2.manifest.definition.registry) {
|
|
31132
31190
|
const { manifest: createManifest, resource: createResource } = await Promise.resolve().then(() => (init_dist(), exports_dist));
|
|
31133
31191
|
const newManifest = createManifest({
|
|
31134
31192
|
registry: undefined,
|
|
31135
|
-
path: rxr2.manifest.path,
|
|
31136
|
-
name: rxr2.manifest.name,
|
|
31137
|
-
type: rxr2.manifest.type,
|
|
31138
|
-
version: rxr2.manifest.tag
|
|
31193
|
+
path: rxr2.manifest.definition.path,
|
|
31194
|
+
name: rxr2.manifest.definition.name,
|
|
31195
|
+
type: rxr2.manifest.definition.type,
|
|
31196
|
+
version: rxr2.manifest.definition.tag
|
|
31139
31197
|
});
|
|
31140
31198
|
const newRxr = createResource(newManifest, rxr2.archive);
|
|
31141
31199
|
await this.cas.put(newRxr);
|
|
@@ -31152,15 +31210,16 @@ class DefaultResourceX {
|
|
|
31152
31210
|
const rxl = parse5(locator);
|
|
31153
31211
|
const rxr2 = await this.cas.get(rxl);
|
|
31154
31212
|
const filesRecord2 = await extract(rxr2.archive);
|
|
31155
|
-
const
|
|
31213
|
+
const fileTree = buildFileTree(filesRecord2);
|
|
31214
|
+
const preview = extractPreview(filesRecord2);
|
|
31156
31215
|
return {
|
|
31157
31216
|
locator: format(rxr2.locator),
|
|
31158
|
-
|
|
31159
|
-
|
|
31160
|
-
|
|
31161
|
-
|
|
31162
|
-
|
|
31163
|
-
|
|
31217
|
+
definition: rxr2.manifest.definition,
|
|
31218
|
+
archive: rxr2.manifest.archive,
|
|
31219
|
+
source: {
|
|
31220
|
+
files: fileTree,
|
|
31221
|
+
preview: preview ?? undefined
|
|
31222
|
+
}
|
|
31164
31223
|
};
|
|
31165
31224
|
}
|
|
31166
31225
|
async remove(locator) {
|
|
@@ -31209,7 +31268,7 @@ class DefaultResourceX {
|
|
|
31209
31268
|
throw error48;
|
|
31210
31269
|
}
|
|
31211
31270
|
}
|
|
31212
|
-
const handler = this.typeHandler.getHandler(rxr2.manifest.type);
|
|
31271
|
+
const handler = this.typeHandler.getHandler(rxr2.manifest.definition.type);
|
|
31213
31272
|
return {
|
|
31214
31273
|
schema: handler.schema,
|
|
31215
31274
|
execute: async (args2) => {
|
|
@@ -31259,11 +31318,11 @@ class DefaultResourceX {
|
|
|
31259
31318
|
formData.append("locator", format(rxr2.locator));
|
|
31260
31319
|
formData.append("manifest", new Blob([
|
|
31261
31320
|
JSON.stringify({
|
|
31262
|
-
registry: rxr2.manifest.registry,
|
|
31263
|
-
path: rxr2.manifest.path,
|
|
31264
|
-
name: rxr2.manifest.name,
|
|
31265
|
-
type: rxr2.manifest.type,
|
|
31266
|
-
tag: rxr2.manifest.tag
|
|
31321
|
+
registry: rxr2.manifest.definition.registry,
|
|
31322
|
+
path: rxr2.manifest.definition.path,
|
|
31323
|
+
name: rxr2.manifest.definition.name,
|
|
31324
|
+
type: rxr2.manifest.definition.type,
|
|
31325
|
+
tag: rxr2.manifest.definition.tag
|
|
31267
31326
|
})
|
|
31268
31327
|
], { type: "application/json" }), "manifest.json");
|
|
31269
31328
|
const archiveBuffer = await rxr2.archive.buffer();
|
|
@@ -31317,11 +31376,11 @@ class DefaultResourceX {
|
|
|
31317
31376
|
}
|
|
31318
31377
|
const context = {
|
|
31319
31378
|
manifest: {
|
|
31320
|
-
registry: rxr.manifest.registry,
|
|
31321
|
-
path: rxr.manifest.path,
|
|
31322
|
-
name: rxr.manifest.name,
|
|
31323
|
-
type: rxr.manifest.type,
|
|
31324
|
-
version: rxr.manifest.tag
|
|
31379
|
+
registry: rxr.manifest.definition.registry,
|
|
31380
|
+
path: rxr.manifest.definition.path,
|
|
31381
|
+
name: rxr.manifest.definition.name,
|
|
31382
|
+
type: rxr.manifest.definition.type,
|
|
31383
|
+
version: rxr.manifest.definition.tag
|
|
31325
31384
|
},
|
|
31326
31385
|
files
|
|
31327
31386
|
};
|
|
@@ -31370,7 +31429,7 @@ function createResourceX2(config3) {
|
|
|
31370
31429
|
}
|
|
31371
31430
|
|
|
31372
31431
|
// src/index.ts
|
|
31373
|
-
var VERSION = "2.
|
|
31432
|
+
var VERSION = "2.9.0";
|
|
31374
31433
|
export {
|
|
31375
31434
|
wrap,
|
|
31376
31435
|
setProvider,
|
|
@@ -31398,4 +31457,4 @@ export {
|
|
|
31398
31457
|
FolderSourceLoader
|
|
31399
31458
|
};
|
|
31400
31459
|
|
|
31401
|
-
//# debugId=
|
|
31460
|
+
//# debugId=C3CC99EA772701FD64756E2164756E21
|