@resourcexjs/cli 2.15.0 → 2.16.1

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 CHANGED
@@ -1,13 +1,17 @@
1
1
  #!/usr/bin/env bun
2
2
  // @bun
3
3
  var __defProp = Object.defineProperty;
4
+ var __returnValue = (v) => v;
5
+ function __exportSetter(name, newValue) {
6
+ this[name] = __returnValue.bind(null, newValue);
7
+ }
4
8
  var __export = (target, all) => {
5
9
  for (var name in all)
6
10
  __defProp(target, name, {
7
11
  get: all[name],
8
12
  enumerable: true,
9
13
  configurable: true,
10
- set: (newValue) => all[name] = () => newValue
14
+ set: __exportSetter.bind(all, name)
11
15
  });
12
16
  };
13
17
  var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
@@ -777,6 +781,9 @@ import { gunzip } from "zlib";
777
781
  import { readdir as readdir2, readFile as readFile2, stat as stat2 } from "fs/promises";
778
782
  import { join as join2, relative as relative2 } from "path";
779
783
  import { createHash } from "crypto";
784
+ function __exportSetter2(name, newValue) {
785
+ this[name] = __returnValue2.bind(null, newValue);
786
+ }
780
787
  function $constructor(name, initializer, params) {
781
788
  function init2(inst, def) {
782
789
  if (!inst._zod) {
@@ -4674,13 +4681,13 @@ class TypeHandlerChain {
4674
4681
  this.handlers.clear();
4675
4682
  }
4676
4683
  }
4677
- var __defProp2, __export2 = (target, all) => {
4684
+ var __defProp2, __returnValue2 = (v2) => v2, __export2 = (target, all) => {
4678
4685
  for (var name in all)
4679
4686
  __defProp2(target, name, {
4680
4687
  get: all[name],
4681
4688
  enumerable: true,
4682
4689
  configurable: true,
4683
- set: (newValue) => all[name] = () => newValue
4690
+ set: __exportSetter2.bind(all, name)
4684
4691
  });
4685
4692
  }, BLOCK_SIZE = 512, ZERO_BLOCK, EMPTY, encoder, decoder, EOF_BUFFER, gzipAsync, exports_external, exports_core2, NEVER, $brand, $ZodAsyncError, $ZodEncodeError, globalConfig, exports_util, EVALUATING, captureStackTrace, allowsEval, getParsedType = (data) => {
4686
4693
  const t2 = typeof data;
@@ -10360,7 +10367,7 @@ var __defProp2, __export2 = (target, all) => {
10360
10367
  Codec: ZodCodec,
10361
10368
  Boolean: ZodBoolean,
10362
10369
  String: ZodString
10363
- }, ...args), ZodIssueCode, ZodFirstPartyTypeKind, z2, RECOGNIZED_KEYS, exports_coerce, ResourceXError, RXDSchema, gunzipAsync, RegistryError, textType, jsonType, binaryType, skillType, builtinTypes, ResourceTypeError;
10370
+ }, ...args), ZodIssueCode, ZodFirstPartyTypeKind, z2, RECOGNIZED_KEYS, exports_coerce, ResourceXError, RXDSchema, gunzipAsync, RegistryError, textType, jsonType, binaryType, skillType, prototypeType, builtinTypes, ResourceTypeError;
10364
10371
  var init_dist = __esm(() => {
10365
10372
  __defProp2 = Object.defineProperty;
10366
10373
  ZERO_BLOCK = new Uint8Array(BLOCK_SIZE);
@@ -14441,7 +14448,47 @@ var skill_type_default = {
14441
14448
  }
14442
14449
  }
14443
14450
  };
14444
- builtinTypes = [textType, jsonType, binaryType, skillType];
14451
+ prototypeType = {
14452
+ name: "prototype",
14453
+ description: "Instruction set for materializing roles and organizations",
14454
+ code: `// @resolver: prototype_type_default
14455
+ var prototype_type_default = {
14456
+ async resolve(ctx) {
14457
+ var protoFile = ctx.files["prototype.json"];
14458
+ if (!protoFile) throw new Error("Prototype resource must contain a prototype.json file");
14459
+ var decoder = new TextDecoder();
14460
+ var instructions = JSON.parse(decoder.decode(protoFile));
14461
+ if (!Array.isArray(instructions)) {
14462
+ throw new Error("prototype.json must be a JSON array of instructions");
14463
+ }
14464
+ var resolved = instructions.map(function(instr) {
14465
+ var resolvedArgs = {};
14466
+ var keys = Object.keys(instr.args || {});
14467
+ for (var i = 0; i < keys.length; i++) {
14468
+ var key = keys[i];
14469
+ var value = instr.args[key];
14470
+ if (typeof value === "string" && value.startsWith("@")) {
14471
+ var filename = value.slice(1);
14472
+ var file = ctx.files[filename];
14473
+ if (!file) throw new Error("Referenced file not found: " + filename);
14474
+ resolvedArgs[key] = decoder.decode(file);
14475
+ } else {
14476
+ resolvedArgs[key] = value;
14477
+ }
14478
+ }
14479
+ return { op: instr.op, args: resolvedArgs };
14480
+ });
14481
+ return { id: ctx.manifest.name, instructions: resolved };
14482
+ }
14483
+ };`
14484
+ };
14485
+ builtinTypes = [
14486
+ textType,
14487
+ jsonType,
14488
+ binaryType,
14489
+ skillType,
14490
+ prototypeType
14491
+ ];
14445
14492
  ResourceTypeError = class ResourceTypeError extends ResourceXError {
14446
14493
  constructor(message) {
14447
14494
  super(message);
@@ -17460,4 +17507,4 @@ var main = defineCommand({
17460
17507
  });
17461
17508
  runMain(main);
17462
17509
 
17463
- //# debugId=17116DDBA925B5B364756E2164756E21
17510
+ //# debugId=E7512FDD8523B92864756E2164756E21