@resourcexjs/cli 2.15.0 → 2.16.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.js +58 -3
- package/dist/index.js.map +3 -3
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1,6 +1,21 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
// @bun
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
3
5
|
var __defProp = Object.defineProperty;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __toESM = (mod, isNodeMode, target) => {
|
|
9
|
+
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
10
|
+
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
11
|
+
for (let key of __getOwnPropNames(mod))
|
|
12
|
+
if (!__hasOwnProp.call(to, key))
|
|
13
|
+
__defProp(to, key, {
|
|
14
|
+
get: () => mod[key],
|
|
15
|
+
enumerable: true
|
|
16
|
+
});
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
4
19
|
var __export = (target, all) => {
|
|
5
20
|
for (var name in all)
|
|
6
21
|
__defProp(target, name, {
|
|
@@ -10360,7 +10375,7 @@ var __defProp2, __export2 = (target, all) => {
|
|
|
10360
10375
|
Codec: ZodCodec,
|
|
10361
10376
|
Boolean: ZodBoolean,
|
|
10362
10377
|
String: ZodString
|
|
10363
|
-
}, ...args), ZodIssueCode, ZodFirstPartyTypeKind, z2, RECOGNIZED_KEYS, exports_coerce, ResourceXError, RXDSchema, gunzipAsync, RegistryError, textType, jsonType, binaryType, skillType, builtinTypes, ResourceTypeError;
|
|
10378
|
+
}, ...args), ZodIssueCode, ZodFirstPartyTypeKind, z2, RECOGNIZED_KEYS, exports_coerce, ResourceXError, RXDSchema, gunzipAsync, RegistryError, textType, jsonType, binaryType, skillType, prototypeType, builtinTypes, ResourceTypeError;
|
|
10364
10379
|
var init_dist = __esm(() => {
|
|
10365
10380
|
__defProp2 = Object.defineProperty;
|
|
10366
10381
|
ZERO_BLOCK = new Uint8Array(BLOCK_SIZE);
|
|
@@ -14441,7 +14456,47 @@ var skill_type_default = {
|
|
|
14441
14456
|
}
|
|
14442
14457
|
}
|
|
14443
14458
|
};
|
|
14444
|
-
|
|
14459
|
+
prototypeType = {
|
|
14460
|
+
name: "prototype",
|
|
14461
|
+
description: "Instruction set for materializing roles and organizations",
|
|
14462
|
+
code: `// @resolver: prototype_type_default
|
|
14463
|
+
var prototype_type_default = {
|
|
14464
|
+
async resolve(ctx) {
|
|
14465
|
+
var protoFile = ctx.files["prototype.json"];
|
|
14466
|
+
if (!protoFile) throw new Error("Prototype resource must contain a prototype.json file");
|
|
14467
|
+
var decoder = new TextDecoder();
|
|
14468
|
+
var instructions = JSON.parse(decoder.decode(protoFile));
|
|
14469
|
+
if (!Array.isArray(instructions)) {
|
|
14470
|
+
throw new Error("prototype.json must be a JSON array of instructions");
|
|
14471
|
+
}
|
|
14472
|
+
var resolved = instructions.map(function(instr) {
|
|
14473
|
+
var resolvedArgs = {};
|
|
14474
|
+
var keys = Object.keys(instr.args || {});
|
|
14475
|
+
for (var i = 0; i < keys.length; i++) {
|
|
14476
|
+
var key = keys[i];
|
|
14477
|
+
var value = instr.args[key];
|
|
14478
|
+
if (typeof value === "string" && value.startsWith("@")) {
|
|
14479
|
+
var filename = value.slice(1);
|
|
14480
|
+
var file = ctx.files[filename];
|
|
14481
|
+
if (!file) throw new Error("Referenced file not found: " + filename);
|
|
14482
|
+
resolvedArgs[key] = decoder.decode(file);
|
|
14483
|
+
} else {
|
|
14484
|
+
resolvedArgs[key] = value;
|
|
14485
|
+
}
|
|
14486
|
+
}
|
|
14487
|
+
return { op: instr.op, args: resolvedArgs };
|
|
14488
|
+
});
|
|
14489
|
+
return { id: ctx.manifest.name, instructions: resolved };
|
|
14490
|
+
}
|
|
14491
|
+
};`
|
|
14492
|
+
};
|
|
14493
|
+
builtinTypes = [
|
|
14494
|
+
textType,
|
|
14495
|
+
jsonType,
|
|
14496
|
+
binaryType,
|
|
14497
|
+
skillType,
|
|
14498
|
+
prototypeType
|
|
14499
|
+
];
|
|
14445
14500
|
ResourceTypeError = class ResourceTypeError extends ResourceXError {
|
|
14446
14501
|
constructor(message) {
|
|
14447
14502
|
super(message);
|
|
@@ -17460,4 +17515,4 @@ var main = defineCommand({
|
|
|
17460
17515
|
});
|
|
17461
17516
|
runMain(main);
|
|
17462
17517
|
|
|
17463
|
-
//# debugId=
|
|
17518
|
+
//# debugId=AA7C8D804CBA334B64756E2164756E21
|