@synergenius/flow-weaver 0.11.0 → 0.12.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.
@@ -936,7 +936,7 @@ var require_command = __commonJS({
936
936
  var EventEmitter2 = __require("events").EventEmitter;
937
937
  var childProcess = __require("child_process");
938
938
  var path51 = __require("path");
939
- var fs50 = __require("fs");
939
+ var fs51 = __require("fs");
940
940
  var process6 = __require("process");
941
941
  var { Argument: Argument2, humanReadableArgName } = require_argument();
942
942
  var { CommanderError: CommanderError2 } = require_error();
@@ -1760,9 +1760,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
1760
1760
  const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
1761
1761
  function findFile(baseDir, baseName) {
1762
1762
  const localBin = path51.resolve(baseDir, baseName);
1763
- if (fs50.existsSync(localBin)) return localBin;
1763
+ if (fs51.existsSync(localBin)) return localBin;
1764
1764
  if (sourceExt.includes(path51.extname(baseName))) return void 0;
1765
- const foundExt = sourceExt.find((ext2) => fs50.existsSync(`${localBin}${ext2}`));
1765
+ const foundExt = sourceExt.find((ext2) => fs51.existsSync(`${localBin}${ext2}`));
1766
1766
  if (foundExt) return `${localBin}${foundExt}`;
1767
1767
  return void 0;
1768
1768
  }
@@ -1773,7 +1773,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
1773
1773
  if (this._scriptPath) {
1774
1774
  let resolvedScriptPath;
1775
1775
  try {
1776
- resolvedScriptPath = fs50.realpathSync(this._scriptPath);
1776
+ resolvedScriptPath = fs51.realpathSync(this._scriptPath);
1777
1777
  } catch (err) {
1778
1778
  resolvedScriptPath = this._scriptPath;
1779
1779
  }
@@ -3127,13 +3127,39 @@ var init_unescape = __esm({
3127
3127
  });
3128
3128
 
3129
3129
  // node_modules/minimatch/dist/esm/ast.js
3130
- var types, isExtglobType, startNoTraversal, startNoDot, addPatternStart, justDots, reSpecials, regExpEscape, qmark, star, starNoEmpty, AST;
3130
+ var _a, types, isExtglobType, isExtglobAST, adoptionMap, adoptionWithSpaceMap, adoptionAnyMap, usurpMap, startNoTraversal, startNoDot, addPatternStart, justDots, reSpecials, regExpEscape, qmark, star, starNoEmpty, AST;
3131
3131
  var init_ast = __esm({
3132
3132
  "node_modules/minimatch/dist/esm/ast.js"() {
3133
3133
  init_brace_expressions();
3134
3134
  init_unescape();
3135
3135
  types = /* @__PURE__ */ new Set(["!", "?", "+", "*", "@"]);
3136
3136
  isExtglobType = (c) => types.has(c);
3137
+ isExtglobAST = (c) => isExtglobType(c.type);
3138
+ adoptionMap = /* @__PURE__ */ new Map([
3139
+ ["!", ["@"]],
3140
+ ["?", ["?", "@"]],
3141
+ ["@", ["@"]],
3142
+ ["*", ["*", "+", "?", "@"]],
3143
+ ["+", ["+", "@"]]
3144
+ ]);
3145
+ adoptionWithSpaceMap = /* @__PURE__ */ new Map([
3146
+ ["!", ["?"]],
3147
+ ["@", ["?"]],
3148
+ ["+", ["?", "*"]]
3149
+ ]);
3150
+ adoptionAnyMap = /* @__PURE__ */ new Map([
3151
+ ["!", ["?", "@"]],
3152
+ ["?", ["?", "@"]],
3153
+ ["@", ["?", "@"]],
3154
+ ["*", ["*", "+", "?", "@"]],
3155
+ ["+", ["+", "@", "?", "*"]]
3156
+ ]);
3157
+ usurpMap = /* @__PURE__ */ new Map([
3158
+ ["!", /* @__PURE__ */ new Map([["!", "@"]])],
3159
+ ["?", /* @__PURE__ */ new Map([["*", "*"], ["+", "*"]])],
3160
+ ["@", /* @__PURE__ */ new Map([["!", "!"], ["?", "?"], ["@", "@"], ["*", "*"], ["+", "+"]])],
3161
+ ["+", /* @__PURE__ */ new Map([["?", "*"], ["*", "*"]])]
3162
+ ]);
3137
3163
  startNoTraversal = "(?!(?:^|/)\\.\\.?(?:$|/))";
3138
3164
  startNoDot = "(?!\\.)";
3139
3165
  addPatternStart = /* @__PURE__ */ new Set(["[", "."]);
@@ -3143,7 +3169,7 @@ var init_ast = __esm({
3143
3169
  qmark = "[^/]";
3144
3170
  star = qmark + "*?";
3145
3171
  starNoEmpty = qmark + "+?";
3146
- AST = class _AST {
3172
+ AST = class {
3147
3173
  type;
3148
3174
  #root;
3149
3175
  #hasMagic;
@@ -3223,7 +3249,7 @@ var init_ast = __esm({
3223
3249
  for (const p of parts2) {
3224
3250
  if (p === "")
3225
3251
  continue;
3226
- if (typeof p !== "string" && !(p instanceof _AST && p.#parent === this)) {
3252
+ if (typeof p !== "string" && !(p instanceof _a && p.#parent === this)) {
3227
3253
  throw new Error("invalid part: " + p);
3228
3254
  }
3229
3255
  this.#parts.push(p);
@@ -3248,7 +3274,7 @@ var init_ast = __esm({
3248
3274
  const p = this.#parent;
3249
3275
  for (let i = 0; i < this.#parentIndex; i++) {
3250
3276
  const pp = p.#parts[i];
3251
- if (!(pp instanceof _AST && pp.type === "!")) {
3277
+ if (!(pp instanceof _a && pp.type === "!")) {
3252
3278
  return false;
3253
3279
  }
3254
3280
  }
@@ -3273,13 +3299,14 @@ var init_ast = __esm({
3273
3299
  this.push(part.clone(this));
3274
3300
  }
3275
3301
  clone(parent) {
3276
- const c = new _AST(this.type, parent);
3302
+ const c = new _a(this.type, parent);
3277
3303
  for (const p of this.#parts) {
3278
3304
  c.copyIn(p);
3279
3305
  }
3280
3306
  return c;
3281
3307
  }
3282
- static #parseAST(str2, ast, pos, opt) {
3308
+ static #parseAST(str2, ast, pos, opt, extDepth) {
3309
+ const maxDepth = opt.maxExtglobRecursion ?? 2;
3283
3310
  let escaping = false;
3284
3311
  let inBrace = false;
3285
3312
  let braceStart = -1;
@@ -3311,11 +3338,12 @@ var init_ast = __esm({
3311
3338
  acc2 += c;
3312
3339
  continue;
3313
3340
  }
3314
- if (!opt.noext && isExtglobType(c) && str2.charAt(i2) === "(") {
3341
+ const doRecurse = !opt.noext && isExtglobType(c) && str2.charAt(i2) === "(" && extDepth <= maxDepth;
3342
+ if (doRecurse) {
3315
3343
  ast.push(acc2);
3316
3344
  acc2 = "";
3317
- const ext2 = new _AST(c, ast);
3318
- i2 = _AST.#parseAST(str2, ext2, i2, opt);
3345
+ const ext2 = new _a(c, ast);
3346
+ i2 = _a.#parseAST(str2, ext2, i2, opt, extDepth + 1);
3319
3347
  ast.push(ext2);
3320
3348
  continue;
3321
3349
  }
@@ -3325,7 +3353,7 @@ var init_ast = __esm({
3325
3353
  return i2;
3326
3354
  }
3327
3355
  let i = pos + 1;
3328
- let part = new _AST(null, ast);
3356
+ let part = new _a(null, ast);
3329
3357
  const parts2 = [];
3330
3358
  let acc = "";
3331
3359
  while (i < str2.length) {
@@ -3352,19 +3380,22 @@ var init_ast = __esm({
3352
3380
  acc += c;
3353
3381
  continue;
3354
3382
  }
3355
- if (isExtglobType(c) && str2.charAt(i) === "(") {
3383
+ const doRecurse = isExtglobType(c) && str2.charAt(i) === "(" && /* c8 ignore start - the maxDepth is sufficient here */
3384
+ (extDepth <= maxDepth || ast && ast.#canAdoptType(c));
3385
+ if (doRecurse) {
3386
+ const depthAdd = ast && ast.#canAdoptType(c) ? 0 : 1;
3356
3387
  part.push(acc);
3357
3388
  acc = "";
3358
- const ext2 = new _AST(c, part);
3389
+ const ext2 = new _a(c, part);
3359
3390
  part.push(ext2);
3360
- i = _AST.#parseAST(str2, ext2, i, opt);
3391
+ i = _a.#parseAST(str2, ext2, i, opt, extDepth + depthAdd);
3361
3392
  continue;
3362
3393
  }
3363
3394
  if (c === "|") {
3364
3395
  part.push(acc);
3365
3396
  acc = "";
3366
3397
  parts2.push(part);
3367
- part = new _AST(null, ast);
3398
+ part = new _a(null, ast);
3368
3399
  continue;
3369
3400
  }
3370
3401
  if (c === ")") {
@@ -3383,9 +3414,101 @@ var init_ast = __esm({
3383
3414
  ast.#parts = [str2.substring(pos - 1)];
3384
3415
  return i;
3385
3416
  }
3417
+ #canAdoptWithSpace(child) {
3418
+ return this.#canAdopt(child, adoptionWithSpaceMap);
3419
+ }
3420
+ #canAdopt(child, map3 = adoptionMap) {
3421
+ if (!child || typeof child !== "object" || child.type !== null || child.#parts.length !== 1 || this.type === null) {
3422
+ return false;
3423
+ }
3424
+ const gc = child.#parts[0];
3425
+ if (!gc || typeof gc !== "object" || gc.type === null) {
3426
+ return false;
3427
+ }
3428
+ return this.#canAdoptType(gc.type, map3);
3429
+ }
3430
+ #canAdoptType(c, map3 = adoptionAnyMap) {
3431
+ return !!map3.get(this.type)?.includes(c);
3432
+ }
3433
+ #adoptWithSpace(child, index) {
3434
+ const gc = child.#parts[0];
3435
+ const blank = new _a(null, gc, this.options);
3436
+ blank.#parts.push("");
3437
+ gc.push(blank);
3438
+ this.#adopt(child, index);
3439
+ }
3440
+ #adopt(child, index) {
3441
+ const gc = child.#parts[0];
3442
+ this.#parts.splice(index, 1, ...gc.#parts);
3443
+ for (const p of gc.#parts) {
3444
+ if (typeof p === "object")
3445
+ p.#parent = this;
3446
+ }
3447
+ this.#toString = void 0;
3448
+ }
3449
+ #canUsurpType(c) {
3450
+ const m = usurpMap.get(this.type);
3451
+ return !!m?.has(c);
3452
+ }
3453
+ #canUsurp(child) {
3454
+ if (!child || typeof child !== "object" || child.type !== null || child.#parts.length !== 1 || this.type === null || this.#parts.length !== 1) {
3455
+ return false;
3456
+ }
3457
+ const gc = child.#parts[0];
3458
+ if (!gc || typeof gc !== "object" || gc.type === null) {
3459
+ return false;
3460
+ }
3461
+ return this.#canUsurpType(gc.type);
3462
+ }
3463
+ #usurp(child) {
3464
+ const m = usurpMap.get(this.type);
3465
+ const gc = child.#parts[0];
3466
+ const nt = m?.get(gc.type);
3467
+ if (!nt)
3468
+ return false;
3469
+ this.#parts = gc.#parts;
3470
+ for (const p of this.#parts) {
3471
+ if (typeof p === "object")
3472
+ p.#parent = this;
3473
+ }
3474
+ this.type = nt;
3475
+ this.#toString = void 0;
3476
+ this.#emptyExt = false;
3477
+ }
3478
+ #flatten() {
3479
+ if (!isExtglobAST(this)) {
3480
+ for (const p of this.#parts) {
3481
+ if (typeof p === "object")
3482
+ p.#flatten();
3483
+ }
3484
+ } else {
3485
+ let iterations = 0;
3486
+ let done = false;
3487
+ do {
3488
+ done = true;
3489
+ for (let i = 0; i < this.#parts.length; i++) {
3490
+ const c = this.#parts[i];
3491
+ if (typeof c === "object") {
3492
+ c.#flatten();
3493
+ if (this.#canAdopt(c)) {
3494
+ done = false;
3495
+ this.#adopt(c, i);
3496
+ } else if (this.#canAdoptWithSpace(c)) {
3497
+ done = false;
3498
+ this.#adoptWithSpace(c, i);
3499
+ } else if (this.#canUsurp(c)) {
3500
+ done = false;
3501
+ this.#usurp(c);
3502
+ }
3503
+ }
3504
+ }
3505
+ } while (!done && ++iterations < 10);
3506
+ }
3507
+ this.#toString = void 0;
3508
+ }
3386
3509
  static fromGlob(pattern, options = {}) {
3387
- const ast = new _AST(null, void 0, options);
3388
- _AST.#parseAST(pattern, ast, 0, options);
3510
+ const ast = new _a(null, void 0, options);
3511
+ _a.#parseAST(pattern, ast, 0, options, 0);
3389
3512
  return ast;
3390
3513
  }
3391
3514
  // returns the regular expression if there's magic, or the unescaped
@@ -3479,12 +3602,14 @@ var init_ast = __esm({
3479
3602
  // or start or whatever) and prepend ^ or / at the Regexp construction.
3480
3603
  toRegExpSource(allowDot) {
3481
3604
  const dot = allowDot ?? !!this.#options.dot;
3482
- if (this.#root === this)
3605
+ if (this.#root === this) {
3606
+ this.#flatten();
3483
3607
  this.#fillNegs();
3484
- if (!this.type) {
3608
+ }
3609
+ if (!isExtglobAST(this)) {
3485
3610
  const noEmpty = this.isStart() && this.isEnd();
3486
3611
  const src = this.#parts.map((p) => {
3487
- const [re2, _, hasMagic2, uflag] = typeof p === "string" ? _AST.#parseGlob(p, this.#hasMagic, noEmpty) : p.toRegExpSource(allowDot);
3612
+ const [re2, _, hasMagic2, uflag] = typeof p === "string" ? _a.#parseGlob(p, this.#hasMagic, noEmpty) : p.toRegExpSource(allowDot);
3488
3613
  this.#hasMagic = this.#hasMagic || hasMagic2;
3489
3614
  this.#uflag = this.#uflag || uflag;
3490
3615
  return re2;
@@ -3523,9 +3648,10 @@ var init_ast = __esm({
3523
3648
  let body = this.#partsToRegExp(dot);
3524
3649
  if (this.isStart() && this.isEnd() && !body && this.type !== "!") {
3525
3650
  const s = this.toString();
3526
- this.#parts = [s];
3527
- this.type = null;
3528
- this.#hasMagic = void 0;
3651
+ const me = this;
3652
+ me.#parts = [s];
3653
+ me.type = null;
3654
+ me.#hasMagic = void 0;
3529
3655
  return [s, unescape2(this.toString()), false, false];
3530
3656
  }
3531
3657
  let bodyDotAllowed = !repeated || allowDot || dot || !startNoDot ? "" : this.#partsToRegExp(true);
@@ -3566,11 +3692,13 @@ var init_ast = __esm({
3566
3692
  let escaping = false;
3567
3693
  let re2 = "";
3568
3694
  let uflag = false;
3695
+ let inStar = false;
3569
3696
  for (let i = 0; i < glob2.length; i++) {
3570
3697
  const c = glob2.charAt(i);
3571
3698
  if (escaping) {
3572
3699
  escaping = false;
3573
3700
  re2 += (reSpecials.has(c) ? "\\" : "") + c;
3701
+ inStar = false;
3574
3702
  continue;
3575
3703
  }
3576
3704
  if (c === "\\") {
@@ -3588,16 +3716,19 @@ var init_ast = __esm({
3588
3716
  uflag = uflag || needUflag;
3589
3717
  i += consumed - 1;
3590
3718
  hasMagic2 = hasMagic2 || magic;
3719
+ inStar = false;
3591
3720
  continue;
3592
3721
  }
3593
3722
  }
3594
3723
  if (c === "*") {
3595
- if (noEmpty && glob2 === "*")
3596
- re2 += starNoEmpty;
3597
- else
3598
- re2 += star;
3724
+ if (inStar)
3725
+ continue;
3726
+ inStar = true;
3727
+ re2 += noEmpty && /^[*]+$/.test(glob2) ? starNoEmpty : star;
3599
3728
  hasMagic2 = true;
3600
3729
  continue;
3730
+ } else {
3731
+ inStar = false;
3601
3732
  }
3602
3733
  if (c === "?") {
3603
3734
  re2 += qmark;
@@ -3609,6 +3740,7 @@ var init_ast = __esm({
3609
3740
  return [re2, unescape2(glob2), !!hasMagic2, uflag];
3610
3741
  }
3611
3742
  };
3743
+ _a = AST;
3612
3744
  }
3613
3745
  });
3614
3746
 
@@ -3782,11 +3914,13 @@ var init_esm = __esm({
3782
3914
  isWindows;
3783
3915
  platform;
3784
3916
  windowsNoMagicRoot;
3917
+ maxGlobstarRecursion;
3785
3918
  regexp;
3786
3919
  constructor(pattern, options = {}) {
3787
3920
  assertValidPattern(pattern);
3788
3921
  options = options || {};
3789
3922
  this.options = options;
3923
+ this.maxGlobstarRecursion = options.maxGlobstarRecursion ?? 200;
3790
3924
  this.pattern = pattern;
3791
3925
  this.platform = options.platform || defaultPlatform;
3792
3926
  this.isWindows = this.platform === "win32";
@@ -4119,7 +4253,8 @@ var init_esm = __esm({
4119
4253
  // out of pattern, then that's fine, as long as all
4120
4254
  // the parts match.
4121
4255
  matchOne(file, pattern, partial2 = false) {
4122
- const options = this.options;
4256
+ let fileStartIndex = 0;
4257
+ let patternStartIndex = 0;
4123
4258
  if (this.isWindows) {
4124
4259
  const fileDrive = typeof file[0] === "string" && /^[a-z]:$/i.test(file[0]);
4125
4260
  const fileUNC = !fileDrive && file[0] === "" && file[1] === "" && file[2] === "?" && /^[a-z]:$/i.test(file[3]);
@@ -4128,14 +4263,14 @@ var init_esm = __esm({
4128
4263
  const fdi = fileUNC ? 3 : fileDrive ? 0 : void 0;
4129
4264
  const pdi = patternUNC ? 3 : patternDrive ? 0 : void 0;
4130
4265
  if (typeof fdi === "number" && typeof pdi === "number") {
4131
- const [fd, pd] = [file[fdi], pattern[pdi]];
4266
+ const [fd, pd] = [
4267
+ file[fdi],
4268
+ pattern[pdi]
4269
+ ];
4132
4270
  if (fd.toLowerCase() === pd.toLowerCase()) {
4133
4271
  pattern[pdi] = fd;
4134
- if (pdi > fdi) {
4135
- pattern = pattern.slice(pdi);
4136
- } else if (fdi > pdi) {
4137
- file = file.slice(fdi);
4138
- }
4272
+ patternStartIndex = pdi;
4273
+ fileStartIndex = fdi;
4139
4274
  }
4140
4275
  }
4141
4276
  }
@@ -4143,51 +4278,118 @@ var init_esm = __esm({
4143
4278
  if (optimizationLevel >= 2) {
4144
4279
  file = this.levelTwoFileOptimize(file);
4145
4280
  }
4146
- this.debug("matchOne", this, { file, pattern });
4147
- this.debug("matchOne", file.length, pattern.length);
4148
- for (var fi = 0, pi = 0, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
4149
- this.debug("matchOne loop");
4150
- var p = pattern[pi];
4151
- var f = file[fi];
4152
- this.debug(pattern, p, f);
4153
- if (p === false) {
4281
+ if (pattern.includes(GLOBSTAR)) {
4282
+ return this.#matchGlobstar(file, pattern, partial2, fileStartIndex, patternStartIndex);
4283
+ }
4284
+ return this.#matchOne(file, pattern, partial2, fileStartIndex, patternStartIndex);
4285
+ }
4286
+ #matchGlobstar(file, pattern, partial2, fileIndex, patternIndex) {
4287
+ const firstgs = pattern.indexOf(GLOBSTAR, patternIndex);
4288
+ const lastgs = pattern.lastIndexOf(GLOBSTAR);
4289
+ const [head2, body, tail] = partial2 ? [
4290
+ pattern.slice(patternIndex, firstgs),
4291
+ pattern.slice(firstgs + 1),
4292
+ []
4293
+ ] : [
4294
+ pattern.slice(patternIndex, firstgs),
4295
+ pattern.slice(firstgs + 1, lastgs),
4296
+ pattern.slice(lastgs + 1)
4297
+ ];
4298
+ if (head2.length) {
4299
+ const fileHead = file.slice(fileIndex, fileIndex + head2.length);
4300
+ if (!this.#matchOne(fileHead, head2, partial2, 0, 0))
4154
4301
  return false;
4155
- }
4156
- if (p === GLOBSTAR) {
4157
- this.debug("GLOBSTAR", [pattern, p, f]);
4158
- var fr = fi;
4159
- var pr = pi + 1;
4160
- if (pr === pl) {
4161
- this.debug("** at the end");
4162
- for (; fi < fl; fi++) {
4163
- if (file[fi] === "." || file[fi] === ".." || !options.dot && file[fi].charAt(0) === ".")
4164
- return false;
4165
- }
4166
- return true;
4302
+ fileIndex += head2.length;
4303
+ }
4304
+ let fileTailMatch = 0;
4305
+ if (tail.length) {
4306
+ if (tail.length + fileIndex > file.length)
4307
+ return false;
4308
+ let tailStart = file.length - tail.length;
4309
+ if (this.#matchOne(file, tail, partial2, tailStart, 0)) {
4310
+ fileTailMatch = tail.length;
4311
+ } else {
4312
+ if (file[file.length - 1] !== "" || fileIndex + tail.length === file.length) {
4313
+ return false;
4167
4314
  }
4168
- while (fr < fl) {
4169
- var swallowee = file[fr];
4170
- this.debug("\nglobstar while", file, fr, pattern, pr, swallowee);
4171
- if (this.matchOne(file.slice(fr), pattern.slice(pr), partial2)) {
4172
- this.debug("globstar found match!", fr, fl, swallowee);
4173
- return true;
4174
- } else {
4175
- if (swallowee === "." || swallowee === ".." || !options.dot && swallowee.charAt(0) === ".") {
4176
- this.debug("dot detected!", file, fr, pattern, pr);
4177
- break;
4178
- }
4179
- this.debug("globstar swallow a segment, and continue");
4180
- fr++;
4181
- }
4315
+ tailStart--;
4316
+ if (!this.#matchOne(file, tail, partial2, tailStart, 0))
4317
+ return false;
4318
+ fileTailMatch = tail.length + 1;
4319
+ }
4320
+ }
4321
+ if (!body.length) {
4322
+ let sawSome = !!fileTailMatch;
4323
+ for (let i2 = fileIndex; i2 < file.length - fileTailMatch; i2++) {
4324
+ const f = String(file[i2]);
4325
+ sawSome = true;
4326
+ if (f === "." || f === ".." || !this.options.dot && f.startsWith(".")) {
4327
+ return false;
4182
4328
  }
4183
- if (partial2) {
4184
- this.debug("\n>>> no match, partial?", file, fr, pattern, pr);
4185
- if (fr === fl) {
4186
- return true;
4187
- }
4329
+ }
4330
+ return partial2 || sawSome;
4331
+ }
4332
+ const bodySegments = [[[], 0]];
4333
+ let currentBody = bodySegments[0];
4334
+ let nonGsParts = 0;
4335
+ const nonGsPartsSums = [0];
4336
+ for (const b of body) {
4337
+ if (b === GLOBSTAR) {
4338
+ nonGsPartsSums.push(nonGsParts);
4339
+ currentBody = [[], 0];
4340
+ bodySegments.push(currentBody);
4341
+ } else {
4342
+ currentBody[0].push(b);
4343
+ nonGsParts++;
4344
+ }
4345
+ }
4346
+ let i = bodySegments.length - 1;
4347
+ const fileLength = file.length - fileTailMatch;
4348
+ for (const b of bodySegments) {
4349
+ b[1] = fileLength - (nonGsPartsSums[i--] + b[0].length);
4350
+ }
4351
+ return !!this.#matchGlobStarBodySections(file, bodySegments, fileIndex, 0, partial2, 0, !!fileTailMatch);
4352
+ }
4353
+ #matchGlobStarBodySections(file, bodySegments, fileIndex, bodyIndex, partial2, globStarDepth, sawTail) {
4354
+ const bs = bodySegments[bodyIndex];
4355
+ if (!bs) {
4356
+ for (let i = fileIndex; i < file.length; i++) {
4357
+ sawTail = true;
4358
+ const f = file[i];
4359
+ if (f === "." || f === ".." || !this.options.dot && f.startsWith(".")) {
4360
+ return false;
4188
4361
  }
4362
+ }
4363
+ return sawTail;
4364
+ }
4365
+ const [body, after] = bs;
4366
+ while (fileIndex <= after) {
4367
+ const m = this.#matchOne(file.slice(0, fileIndex + body.length), body, partial2, fileIndex, 0);
4368
+ if (m && globStarDepth < this.maxGlobstarRecursion) {
4369
+ const sub = this.#matchGlobStarBodySections(file, bodySegments, fileIndex + body.length, bodyIndex + 1, partial2, globStarDepth + 1, sawTail);
4370
+ if (sub !== false)
4371
+ return sub;
4372
+ }
4373
+ const f = file[fileIndex];
4374
+ if (f === "." || f === ".." || !this.options.dot && f.startsWith(".")) {
4189
4375
  return false;
4190
4376
  }
4377
+ fileIndex++;
4378
+ }
4379
+ return partial2 || null;
4380
+ }
4381
+ #matchOne(file, pattern, partial2, fileIndex, patternIndex) {
4382
+ let fi;
4383
+ let pi;
4384
+ let pl;
4385
+ let fl;
4386
+ for (fi = fileIndex, pi = patternIndex, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
4387
+ this.debug("matchOne loop");
4388
+ let p = pattern[pi];
4389
+ let f = file[fi];
4390
+ this.debug(pattern, p, f);
4391
+ if (p === false || p === GLOBSTAR)
4392
+ return false;
4191
4393
  let hit;
4192
4394
  if (typeof p === "string") {
4193
4395
  hit = f === p;
@@ -7740,8 +7942,8 @@ var init_esm4 = __esm({
7740
7942
  *
7741
7943
  * @internal
7742
7944
  */
7743
- constructor(cwd = process.cwd(), pathImpl, sep3, { nocase, childrenCacheSize = 16 * 1024, fs: fs50 = defaultFS } = {}) {
7744
- this.#fs = fsFromOption(fs50);
7945
+ constructor(cwd = process.cwd(), pathImpl, sep3, { nocase, childrenCacheSize = 16 * 1024, fs: fs51 = defaultFS } = {}) {
7946
+ this.#fs = fsFromOption(fs51);
7745
7947
  if (cwd instanceof URL || cwd.startsWith("file://")) {
7746
7948
  cwd = fileURLToPath(cwd);
7747
7949
  }
@@ -8299,8 +8501,8 @@ var init_esm4 = __esm({
8299
8501
  /**
8300
8502
  * @internal
8301
8503
  */
8302
- newRoot(fs50) {
8303
- return new PathWin32(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs: fs50 });
8504
+ newRoot(fs51) {
8505
+ return new PathWin32(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs: fs51 });
8304
8506
  }
8305
8507
  /**
8306
8508
  * Return true if the provided path string is an absolute path
@@ -8328,8 +8530,8 @@ var init_esm4 = __esm({
8328
8530
  /**
8329
8531
  * @internal
8330
8532
  */
8331
- newRoot(fs50) {
8332
- return new PathPosix(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs: fs50 });
8533
+ newRoot(fs51) {
8534
+ return new PathPosix(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs: fs51 });
8333
8535
  }
8334
8536
  /**
8335
8537
  * Return true if the provided path string is an absolute path
@@ -9464,6 +9666,15 @@ var init_esm5 = __esm({
9464
9666
  }
9465
9667
  });
9466
9668
 
9669
+ // src/generated-version.ts
9670
+ var VERSION;
9671
+ var init_generated_version = __esm({
9672
+ "src/generated-version.ts"() {
9673
+ "use strict";
9674
+ VERSION = "0.12.1";
9675
+ }
9676
+ });
9677
+
9467
9678
  // src/constants.ts
9468
9679
  function isReservedNodeName(name) {
9469
9680
  return Object.values(RESERVED_NODE_NAMES).includes(name);
@@ -13168,12 +13379,12 @@ var require_binary_search = __commonJS({
13168
13379
  var require_read_wasm = __commonJS({
13169
13380
  "node_modules/source-map/lib/read-wasm.js"(exports2, module2) {
13170
13381
  "use strict";
13171
- var fs50 = __require("fs");
13382
+ var fs51 = __require("fs");
13172
13383
  var path51 = __require("path");
13173
13384
  module2.exports = function readWasm() {
13174
13385
  return new Promise((resolve35, reject2) => {
13175
13386
  const wasmPath = path51.join(__dirname, "mappings.wasm");
13176
- fs50.readFile(wasmPath, null, (error2, data) => {
13387
+ fs51.readFile(wasmPath, null, (error2, data) => {
13177
13388
  if (error2) {
13178
13389
  reject2(error2);
13179
13390
  return;
@@ -17576,10 +17787,10 @@ var init_string_distance = __esm({
17576
17787
  });
17577
17788
 
17578
17789
  // node_modules/chevrotain/lib/src/version.js
17579
- var VERSION;
17790
+ var VERSION2;
17580
17791
  var init_version = __esm({
17581
17792
  "node_modules/chevrotain/lib/src/version.js"() {
17582
- VERSION = "11.1.1";
17793
+ VERSION2 = "11.1.1";
17583
17794
  }
17584
17795
  });
17585
17796
 
@@ -26896,8 +27107,8 @@ var init_llk_lookahead = __esm({
26896
27107
  init_lookahead();
26897
27108
  LLkLookaheadStrategy = class {
26898
27109
  constructor(options) {
26899
- var _a;
26900
- this.maxLookahead = (_a = options === null || options === void 0 ? void 0 : options.maxLookahead) !== null && _a !== void 0 ? _a : DEFAULT_PARSER_CONFIG.maxLookahead;
27110
+ var _a2;
27111
+ this.maxLookahead = (_a2 = options === null || options === void 0 ? void 0 : options.maxLookahead) !== null && _a2 !== void 0 ? _a2 : DEFAULT_PARSER_CONFIG.maxLookahead;
26901
27112
  }
26902
27113
  validate(options) {
26903
27114
  const leftRecursionErrors = this.validateNoLeftRecursion(options.rules);
@@ -28766,8 +28977,8 @@ var init_parser = __esm({
28766
28977
  });
28767
28978
  }
28768
28979
  this.TRACE_INIT("ComputeLookaheadFunctions", () => {
28769
- var _a, _b;
28770
- (_b = (_a = this.lookaheadStrategy).initialize) === null || _b === void 0 ? void 0 : _b.call(_a, {
28980
+ var _a2, _b;
28981
+ (_b = (_a2 = this.lookaheadStrategy).initialize) === null || _b === void 0 ? void 0 : _b.call(_a2, {
28771
28982
  rules: values_default(this.gastProductionsCache)
28772
28983
  });
28773
28984
  this.preComputeLookaheadFunctions(values_default(this.gastProductionsCache));
@@ -28844,7 +29055,7 @@ var init_api4 = __esm({
28844
29055
  });
28845
29056
 
28846
29057
  // node_modules/chevrotain/lib/src/diagrams/render_public.js
28847
- function createSyntaxDiagramsCode(grammar, { resourceBase = `https://unpkg.com/chevrotain@${VERSION}/diagrams/`, css = `https://unpkg.com/chevrotain@${VERSION}/diagrams/diagrams.css` } = {}) {
29058
+ function createSyntaxDiagramsCode(grammar, { resourceBase = `https://unpkg.com/chevrotain@${VERSION2}/diagrams/`, css = `https://unpkg.com/chevrotain@${VERSION2}/diagrams/diagrams.css` } = {}) {
28848
29059
  const header = `
28849
29060
  <!-- This is a generated file -->
28850
29061
  <!DOCTYPE html>
@@ -36948,7 +37159,6 @@ var init_serialization_node = __esm({
36948
37159
 
36949
37160
  // src/api/compile.ts
36950
37161
  import * as fs8 from "node:fs/promises";
36951
- import { createRequire } from "node:module";
36952
37162
  import * as path7 from "node:path";
36953
37163
  async function compileWorkflow(filePath, options = {}) {
36954
37164
  const startTime = Date.now();
@@ -37010,7 +37220,7 @@ ${errorMessages.join("\n")}`);
37010
37220
  sourceFile: filePath,
37011
37221
  outputFile,
37012
37222
  compiledAt: (/* @__PURE__ */ new Date()).toISOString(),
37013
- compilerVersion: COMPILER_VERSION,
37223
+ compilerVersion: VERSION,
37014
37224
  generationTime: Date.now() - startTime
37015
37225
  }
37016
37226
  };
@@ -37021,15 +37231,13 @@ function getDefaultOutputFile(sourceFile) {
37021
37231
  const basename19 = path7.basename(sourceFile, ".ts");
37022
37232
  return path7.join(dir, `${basename19}.generated.ts`);
37023
37233
  }
37024
- var require2, COMPILER_VERSION;
37025
37234
  var init_compile = __esm({
37026
37235
  "src/api/compile.ts"() {
37027
37236
  "use strict";
37237
+ init_generated_version();
37028
37238
  init_generate();
37029
37239
  init_generate_in_place();
37030
37240
  init_parse();
37031
- require2 = createRequire(import.meta.url);
37032
- ({ version: COMPILER_VERSION } = require2("../../package.json"));
37033
37241
  }
37034
37242
  });
37035
37243
 
@@ -49111,7 +49319,7 @@ var init_workflow_executor = __esm({
49111
49319
  // node_modules/xmlhttprequest-ssl/lib/XMLHttpRequest.js
49112
49320
  var require_XMLHttpRequest = __commonJS({
49113
49321
  "node_modules/xmlhttprequest-ssl/lib/XMLHttpRequest.js"(exports2, module2) {
49114
- var fs50 = __require("fs");
49322
+ var fs51 = __require("fs");
49115
49323
  var Url = __require("url");
49116
49324
  var spawn2 = __require("child_process").spawn;
49117
49325
  module2.exports = XMLHttpRequest3;
@@ -49269,7 +49477,7 @@ var require_XMLHttpRequest = __commonJS({
49269
49477
  throw new Error("XMLHttpRequest: Only GET method is supported");
49270
49478
  }
49271
49479
  if (settings.async) {
49272
- fs50.readFile(unescape(url2.pathname), function(error2, data2) {
49480
+ fs51.readFile(unescape(url2.pathname), function(error2, data2) {
49273
49481
  if (error2) {
49274
49482
  self2.handleError(error2, error2.errno || -1);
49275
49483
  } else {
@@ -49281,7 +49489,7 @@ var require_XMLHttpRequest = __commonJS({
49281
49489
  });
49282
49490
  } else {
49283
49491
  try {
49284
- this.response = fs50.readFileSync(unescape(url2.pathname));
49492
+ this.response = fs51.readFileSync(unescape(url2.pathname));
49285
49493
  this.responseText = this.response.toString("utf8");
49286
49494
  this.status = 200;
49287
49495
  setState(self2.DONE);
@@ -49407,15 +49615,15 @@ var require_XMLHttpRequest = __commonJS({
49407
49615
  } else {
49408
49616
  var contentFile = ".node-xmlhttprequest-content-" + process.pid;
49409
49617
  var syncFile = ".node-xmlhttprequest-sync-" + process.pid;
49410
- fs50.writeFileSync(syncFile, "", "utf8");
49618
+ fs51.writeFileSync(syncFile, "", "utf8");
49411
49619
  var execString = "var http = require('http'), https = require('https'), fs = require('fs');var doRequest = http" + (ssl ? "s" : "") + ".request;var options = " + JSON.stringify(options) + ";var responseText = '';var responseData = Buffer.alloc(0);var req = doRequest(options, function(response) {response.on('data', function(chunk) { var data = Buffer.from(chunk); responseText += data.toString('utf8'); responseData = Buffer.concat([responseData, data]);});response.on('end', function() {fs.writeFileSync('" + contentFile + "', JSON.stringify({err: null, data: {statusCode: response.statusCode, headers: response.headers, text: responseText, data: responseData.toString('base64')}}), 'utf8');fs.unlinkSync('" + syncFile + "');});response.on('error', function(error) {fs.writeFileSync('" + contentFile + "', 'NODE-XMLHTTPREQUEST-ERROR:' + JSON.stringify(error), 'utf8');fs.unlinkSync('" + syncFile + "');});}).on('error', function(error) {fs.writeFileSync('" + contentFile + "', 'NODE-XMLHTTPREQUEST-ERROR:' + JSON.stringify(error), 'utf8');fs.unlinkSync('" + syncFile + "');});" + (data ? "req.write('" + JSON.stringify(data).slice(1, -1).replace(/'/g, "\\'") + "');" : "") + "req.end();";
49412
49620
  var syncProc = spawn2(process.argv[0], ["-e", execString]);
49413
49621
  var statusText;
49414
- while (fs50.existsSync(syncFile)) {
49622
+ while (fs51.existsSync(syncFile)) {
49415
49623
  }
49416
- self2.responseText = fs50.readFileSync(contentFile, "utf8");
49624
+ self2.responseText = fs51.readFileSync(contentFile, "utf8");
49417
49625
  syncProc.stdin.end();
49418
- fs50.unlinkSync(contentFile);
49626
+ fs51.unlinkSync(contentFile);
49419
49627
  if (self2.responseText.match(/^NODE-XMLHTTPREQUEST-ERROR:/)) {
49420
49628
  var errorObj = JSON.parse(self2.responseText.replace(/^NODE-XMLHTTPREQUEST-ERROR:/, ""));
49421
49629
  self2.handleError(errorObj, 503);
@@ -57618,12 +57826,12 @@ var require_code = __commonJS({
57618
57826
  return item === "" || item === '""';
57619
57827
  }
57620
57828
  get str() {
57621
- var _a;
57622
- return (_a = this._str) !== null && _a !== void 0 ? _a : this._str = this._items.reduce((s, c) => `${s}${c}`, "");
57829
+ var _a2;
57830
+ return (_a2 = this._str) !== null && _a2 !== void 0 ? _a2 : this._str = this._items.reduce((s, c) => `${s}${c}`, "");
57623
57831
  }
57624
57832
  get names() {
57625
- var _a;
57626
- return (_a = this._names) !== null && _a !== void 0 ? _a : this._names = this._items.reduce((names, c) => {
57833
+ var _a2;
57834
+ return (_a2 = this._names) !== null && _a2 !== void 0 ? _a2 : this._names = this._items.reduce((names, c) => {
57627
57835
  if (c instanceof Name)
57628
57836
  names[c.str] = (names[c.str] || 0) + 1;
57629
57837
  return names;
@@ -57769,8 +57977,8 @@ var require_scope = __commonJS({
57769
57977
  return `${prefix}${ng.index++}`;
57770
57978
  }
57771
57979
  _nameGroup(prefix) {
57772
- var _a, _b;
57773
- if (((_b = (_a = this._parent) === null || _a === void 0 ? void 0 : _a._prefixes) === null || _b === void 0 ? void 0 : _b.has(prefix)) || this._prefixes && !this._prefixes.has(prefix)) {
57980
+ var _a2, _b;
57981
+ if (((_b = (_a2 = this._parent) === null || _a2 === void 0 ? void 0 : _a2._prefixes) === null || _b === void 0 ? void 0 : _b.has(prefix)) || this._prefixes && !this._prefixes.has(prefix)) {
57774
57982
  throw new Error(`CodeGen: prefix "${prefix}" is not allowed in this scope`);
57775
57983
  }
57776
57984
  return this._names[prefix] = { prefix, index: 0 };
@@ -57803,12 +58011,12 @@ var require_scope = __commonJS({
57803
58011
  return new ValueScopeName(prefix, this._newName(prefix));
57804
58012
  }
57805
58013
  value(nameOrPrefix, value2) {
57806
- var _a;
58014
+ var _a2;
57807
58015
  if (value2.ref === void 0)
57808
58016
  throw new Error("CodeGen: ref must be passed in value");
57809
58017
  const name = this.toName(nameOrPrefix);
57810
58018
  const { prefix } = name;
57811
- const valueKey = (_a = value2.key) !== null && _a !== void 0 ? _a : value2.ref;
58019
+ const valueKey = (_a2 = value2.key) !== null && _a2 !== void 0 ? _a2 : value2.ref;
57812
58020
  let vs = this._values[prefix];
57813
58021
  if (vs) {
57814
58022
  const _name = vs.get(valueKey);
@@ -58126,8 +58334,8 @@ var require_codegen = __commonJS({
58126
58334
  return this;
58127
58335
  }
58128
58336
  optimizeNames(names, constants) {
58129
- var _a;
58130
- this.else = (_a = this.else) === null || _a === void 0 ? void 0 : _a.optimizeNames(names, constants);
58337
+ var _a2;
58338
+ this.else = (_a2 = this.else) === null || _a2 === void 0 ? void 0 : _a2.optimizeNames(names, constants);
58131
58339
  if (!(super.optimizeNames(names, constants) || this.else))
58132
58340
  return;
58133
58341
  this.condition = optimizeExpr(this.condition, names, constants);
@@ -58231,16 +58439,16 @@ var require_codegen = __commonJS({
58231
58439
  return code;
58232
58440
  }
58233
58441
  optimizeNodes() {
58234
- var _a, _b;
58442
+ var _a2, _b;
58235
58443
  super.optimizeNodes();
58236
- (_a = this.catch) === null || _a === void 0 ? void 0 : _a.optimizeNodes();
58444
+ (_a2 = this.catch) === null || _a2 === void 0 ? void 0 : _a2.optimizeNodes();
58237
58445
  (_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNodes();
58238
58446
  return this;
58239
58447
  }
58240
58448
  optimizeNames(names, constants) {
58241
- var _a, _b;
58449
+ var _a2, _b;
58242
58450
  super.optimizeNames(names, constants);
58243
- (_a = this.catch) === null || _a === void 0 ? void 0 : _a.optimizeNames(names, constants);
58451
+ (_a2 = this.catch) === null || _a2 === void 0 ? void 0 : _a2.optimizeNames(names, constants);
58244
58452
  (_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNames(names, constants);
58245
58453
  return this;
58246
58454
  }
@@ -59020,8 +59228,8 @@ var require_applicability = __commonJS({
59020
59228
  }
59021
59229
  exports2.shouldUseGroup = shouldUseGroup;
59022
59230
  function shouldUseRule(schema2, rule) {
59023
- var _a;
59024
- return schema2[rule.keyword] !== void 0 || ((_a = rule.definition.implements) === null || _a === void 0 ? void 0 : _a.some((kwd) => schema2[kwd] !== void 0));
59231
+ var _a2;
59232
+ return schema2[rule.keyword] !== void 0 || ((_a2 = rule.definition.implements) === null || _a2 === void 0 ? void 0 : _a2.some((kwd) => schema2[kwd] !== void 0));
59025
59233
  }
59026
59234
  exports2.shouldUseRule = shouldUseRule;
59027
59235
  }
@@ -59409,14 +59617,14 @@ var require_keyword = __commonJS({
59409
59617
  }
59410
59618
  exports2.macroKeywordCode = macroKeywordCode;
59411
59619
  function funcKeywordCode(cxt, def) {
59412
- var _a;
59620
+ var _a2;
59413
59621
  const { gen, keyword, schema: schema2, parentSchema, $data, it } = cxt;
59414
59622
  checkAsyncKeyword(it, def);
59415
59623
  const validate = !$data && def.compile ? def.compile.call(it.self, schema2, parentSchema, it) : def.validate;
59416
59624
  const validateRef = useKeyword(gen, keyword, validate);
59417
59625
  const valid = gen.let("valid");
59418
59626
  cxt.block$data(valid, validateKeyword);
59419
- cxt.ok((_a = def.valid) !== null && _a !== void 0 ? _a : valid);
59627
+ cxt.ok((_a2 = def.valid) !== null && _a2 !== void 0 ? _a2 : valid);
59420
59628
  function validateKeyword() {
59421
59629
  if (def.errors === false) {
59422
59630
  assignValid();
@@ -59447,8 +59655,8 @@ var require_keyword = __commonJS({
59447
59655
  gen.assign(valid, (0, codegen_1._)`${_await}${(0, code_1.callValidateCode)(cxt, validateRef, passCxt, passSchema)}`, def.modifying);
59448
59656
  }
59449
59657
  function reportErrs(errors2) {
59450
- var _a2;
59451
- gen.if((0, codegen_1.not)((_a2 = def.valid) !== null && _a2 !== void 0 ? _a2 : valid), errors2);
59658
+ var _a3;
59659
+ gen.if((0, codegen_1.not)((_a3 = def.valid) !== null && _a3 !== void 0 ? _a3 : valid), errors2);
59452
59660
  }
59453
59661
  }
59454
59662
  exports2.funcKeywordCode = funcKeywordCode;
@@ -60416,7 +60624,7 @@ var require_compile = __commonJS({
60416
60624
  var validate_1 = require_validate();
60417
60625
  var SchemaEnv = class {
60418
60626
  constructor(env) {
60419
- var _a;
60627
+ var _a2;
60420
60628
  this.refs = {};
60421
60629
  this.dynamicAnchors = {};
60422
60630
  let schema2;
@@ -60425,7 +60633,7 @@ var require_compile = __commonJS({
60425
60633
  this.schema = env.schema;
60426
60634
  this.schemaId = env.schemaId;
60427
60635
  this.root = env.root || this;
60428
- this.baseId = (_a = env.baseId) !== null && _a !== void 0 ? _a : (0, resolve_1.normalizeId)(schema2 === null || schema2 === void 0 ? void 0 : schema2[env.schemaId || "$id"]);
60636
+ this.baseId = (_a2 = env.baseId) !== null && _a2 !== void 0 ? _a2 : (0, resolve_1.normalizeId)(schema2 === null || schema2 === void 0 ? void 0 : schema2[env.schemaId || "$id"]);
60429
60637
  this.schemaPath = env.schemaPath;
60430
60638
  this.localRefs = env.localRefs;
60431
60639
  this.meta = env.meta;
@@ -60521,14 +60729,14 @@ var require_compile = __commonJS({
60521
60729
  }
60522
60730
  exports2.compileSchema = compileSchema;
60523
60731
  function resolveRef(root2, baseId, ref) {
60524
- var _a;
60732
+ var _a2;
60525
60733
  ref = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, ref);
60526
60734
  const schOrFunc = root2.refs[ref];
60527
60735
  if (schOrFunc)
60528
60736
  return schOrFunc;
60529
60737
  let _sch = resolve35.call(this, root2, ref);
60530
60738
  if (_sch === void 0) {
60531
- const schema2 = (_a = root2.localRefs) === null || _a === void 0 ? void 0 : _a[ref];
60739
+ const schema2 = (_a2 = root2.localRefs) === null || _a2 === void 0 ? void 0 : _a2[ref];
60532
60740
  const { schemaId } = this.opts;
60533
60741
  if (schema2)
60534
60742
  _sch = new SchemaEnv({ schema: schema2, schemaId, root: root2, baseId });
@@ -60597,8 +60805,8 @@ var require_compile = __commonJS({
60597
60805
  "definitions"
60598
60806
  ]);
60599
60807
  function getJsonPointer(parsedRef, { baseId, schema: schema2, root: root2 }) {
60600
- var _a;
60601
- if (((_a = parsedRef.fragment) === null || _a === void 0 ? void 0 : _a[0]) !== "/")
60808
+ var _a2;
60809
+ if (((_a2 = parsedRef.fragment) === null || _a2 === void 0 ? void 0 : _a2[0]) !== "/")
60602
60810
  return;
60603
60811
  for (const part of parsedRef.fragment.slice(1).split("/")) {
60604
60812
  if (typeof schema2 === "boolean")
@@ -61459,9 +61667,9 @@ var require_core = __commonJS({
61459
61667
  };
61460
61668
  var MAX_EXPRESSION = 200;
61461
61669
  function requiredOptions(o) {
61462
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0;
61670
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0;
61463
61671
  const s = o.strict;
61464
- const _optz = (_a = o.code) === null || _a === void 0 ? void 0 : _a.optimize;
61672
+ const _optz = (_a2 = o.code) === null || _a2 === void 0 ? void 0 : _a2.optimize;
61465
61673
  const optimize = _optz === true || _optz === void 0 ? 1 : _optz || 0;
61466
61674
  const regExp = (_c = (_b = o.code) === null || _b === void 0 ? void 0 : _b.regExp) !== null && _c !== void 0 ? _c : defaultRegExp;
61467
61675
  const uriResolver = (_d = o.uriResolver) !== null && _d !== void 0 ? _d : uri_1.default;
@@ -61935,7 +62143,7 @@ var require_core = __commonJS({
61935
62143
  }
61936
62144
  }
61937
62145
  function addRule(keyword, definition, dataType) {
61938
- var _a;
62146
+ var _a2;
61939
62147
  const post = definition === null || definition === void 0 ? void 0 : definition.post;
61940
62148
  if (dataType && post)
61941
62149
  throw new Error('keyword with "post" flag cannot have "type"');
@@ -61961,7 +62169,7 @@ var require_core = __commonJS({
61961
62169
  else
61962
62170
  ruleGroup.rules.push(rule);
61963
62171
  RULES.all[keyword] = rule;
61964
- (_a = definition.implements) === null || _a === void 0 ? void 0 : _a.forEach((kwd) => this.addKeyword(kwd));
62172
+ (_a2 = definition.implements) === null || _a2 === void 0 ? void 0 : _a2.forEach((kwd) => this.addKeyword(kwd));
61965
62173
  }
61966
62174
  function addBeforeRule(ruleGroup, rule, before) {
61967
62175
  const i = ruleGroup.rules.findIndex((_rule) => _rule.keyword === before);
@@ -62095,10 +62303,10 @@ var require_ref = __commonJS({
62095
62303
  gen.assign(names_1.default.errors, (0, codegen_1._)`${names_1.default.vErrors}.length`);
62096
62304
  }
62097
62305
  function addEvaluatedFrom(source) {
62098
- var _a;
62306
+ var _a2;
62099
62307
  if (!it.opts.unevaluated)
62100
62308
  return;
62101
- const schEvaluated = (_a = sch === null || sch === void 0 ? void 0 : sch.validate) === null || _a === void 0 ? void 0 : _a.evaluated;
62309
+ const schEvaluated = (_a2 = sch === null || sch === void 0 ? void 0 : sch.validate) === null || _a2 === void 0 ? void 0 : _a2.evaluated;
62102
62310
  if (it.props !== true) {
62103
62311
  if (schEvaluated && !schEvaluated.dynamicProps) {
62104
62312
  if (schEvaluated.props !== void 0) {
@@ -63749,7 +63957,7 @@ var require_discriminator = __commonJS({
63749
63957
  return _valid;
63750
63958
  }
63751
63959
  function getMapping() {
63752
- var _a;
63960
+ var _a2;
63753
63961
  const oneOfMapping = {};
63754
63962
  const topRequired = hasRequired(parentSchema);
63755
63963
  let tagRequired = true;
@@ -63763,7 +63971,7 @@ var require_discriminator = __commonJS({
63763
63971
  if (sch === void 0)
63764
63972
  throw new ref_error_1.default(it.opts.uriResolver, it.baseId, ref);
63765
63973
  }
63766
- const propSch = (_a = sch === null || sch === void 0 ? void 0 : sch.properties) === null || _a === void 0 ? void 0 : _a[tagName];
63974
+ const propSch = (_a2 = sch === null || sch === void 0 ? void 0 : sch.properties) === null || _a2 === void 0 ? void 0 : _a2[tagName];
63767
63975
  if (typeof propSch != "object") {
63768
63976
  throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${tagName}"`);
63769
63977
  }
@@ -64331,12 +64539,12 @@ var require_dist = __commonJS({
64331
64539
  throw new Error(`Unknown format "${name}"`);
64332
64540
  return f;
64333
64541
  };
64334
- function addFormats(ajv, list, fs50, exportName) {
64335
- var _a;
64542
+ function addFormats(ajv, list, fs51, exportName) {
64543
+ var _a2;
64336
64544
  var _b;
64337
- (_a = (_b = ajv.opts.code).formats) !== null && _a !== void 0 ? _a : _b.formats = (0, codegen_1._)`require("ajv-formats/dist/formats").${exportName}`;
64545
+ (_a2 = (_b = ajv.opts.code).formats) !== null && _a2 !== void 0 ? _a2 : _b.formats = (0, codegen_1._)`require("ajv-formats/dist/formats").${exportName}`;
64338
64546
  for (const f of list)
64339
- ajv.addFormat(f, fs50[f]);
64547
+ ajv.addFormat(f, fs51[f]);
64340
64548
  }
64341
64549
  module2.exports = exports2 = formatsPlugin;
64342
64550
  Object.defineProperty(exports2, "__esModule", { value: true });
@@ -75294,8 +75502,8 @@ var CookieJar = class {
75294
75502
  get cookies() {
75295
75503
  const now = Date.now();
75296
75504
  this._cookies.forEach((cookie, name) => {
75297
- var _a;
75298
- if (((_a = cookie.expires) === null || _a === void 0 ? void 0 : _a.getTime()) < now) {
75505
+ var _a2;
75506
+ if (((_a2 = cookie.expires) === null || _a2 === void 0 ? void 0 : _a2.getTime()) < now) {
75299
75507
  this._cookies.delete(name);
75300
75508
  }
75301
75509
  });
@@ -75756,7 +75964,7 @@ var Request = class _Request extends import_component_emitter2.Emitter {
75756
75964
  * @private
75757
75965
  */
75758
75966
  _create() {
75759
- var _a;
75967
+ var _a2;
75760
75968
  const opts = pick(this._opts, "agent", "pfx", "key", "passphrase", "cert", "ca", "ciphers", "rejectUnauthorized", "autoUnref");
75761
75969
  opts.xdomain = !!this._opts.xd;
75762
75970
  const xhr = this._xhr = this.createRequest(opts);
@@ -75784,7 +75992,7 @@ var Request = class _Request extends import_component_emitter2.Emitter {
75784
75992
  xhr.setRequestHeader("Accept", "*/*");
75785
75993
  } catch (e) {
75786
75994
  }
75787
- (_a = this._opts.cookieJar) === null || _a === void 0 ? void 0 : _a.addCookies(xhr);
75995
+ (_a2 = this._opts.cookieJar) === null || _a2 === void 0 ? void 0 : _a2.addCookies(xhr);
75788
75996
  if ("withCredentials" in xhr) {
75789
75997
  xhr.withCredentials = this._opts.withCredentials;
75790
75998
  }
@@ -75792,9 +76000,9 @@ var Request = class _Request extends import_component_emitter2.Emitter {
75792
76000
  xhr.timeout = this._opts.requestTimeout;
75793
76001
  }
75794
76002
  xhr.onreadystatechange = () => {
75795
- var _a2;
76003
+ var _a3;
75796
76004
  if (xhr.readyState === 3) {
75797
- (_a2 = this._opts.cookieJar) === null || _a2 === void 0 ? void 0 : _a2.parseCookies(
76005
+ (_a3 = this._opts.cookieJar) === null || _a3 === void 0 ? void 0 : _a3.parseCookies(
75798
76006
  // @ts-ignore
75799
76007
  xhr.getResponseHeader("set-cookie")
75800
76008
  );
@@ -75917,8 +76125,8 @@ function newRequest(opts) {
75917
76125
  var XMLHttpRequest2 = XMLHttpRequestModule.default || XMLHttpRequestModule;
75918
76126
  var XHR = class extends BaseXHR {
75919
76127
  request(opts = {}) {
75920
- var _a;
75921
- Object.assign(opts, { xd: this.xd, cookieJar: (_a = this.socket) === null || _a === void 0 ? void 0 : _a._cookieJar }, this.opts);
76128
+ var _a2;
76129
+ Object.assign(opts, { xd: this.xd, cookieJar: (_a2 = this.socket) === null || _a2 === void 0 ? void 0 : _a2._cookieJar }, this.opts);
75922
76130
  return new Request((opts2) => new XMLHttpRequest2(opts2), this.uri(), opts);
75923
76131
  }
75924
76132
  };
@@ -76022,8 +76230,8 @@ var WebSocketCtor = globalThisShim.WebSocket || globalThisShim.MozWebSocket;
76022
76230
  // node_modules/engine.io-client/build/esm-debug/transports/websocket.node.js
76023
76231
  var WS = class extends BaseWS {
76024
76232
  createSocket(uri, protocols, opts) {
76025
- var _a;
76026
- if ((_a = this.socket) === null || _a === void 0 ? void 0 : _a._cookieJar) {
76233
+ var _a2;
76234
+ if ((_a2 = this.socket) === null || _a2 === void 0 ? void 0 : _a2._cookieJar) {
76027
76235
  opts.headers = opts.headers || {};
76028
76236
  opts.headers.cookie = typeof opts.headers.cookie === "string" ? [opts.headers.cookie] : opts.headers.cookie || [];
76029
76237
  for (const [name, cookie] of this.socket._cookieJar.cookies) {
@@ -76115,8 +76323,8 @@ var WT = class extends Transport {
76115
76323
  }
76116
76324
  }
76117
76325
  doClose() {
76118
- var _a;
76119
- (_a = this._transport) === null || _a === void 0 ? void 0 : _a.close();
76326
+ var _a2;
76327
+ (_a2 = this._transport) === null || _a2 === void 0 ? void 0 : _a2.close();
76120
76328
  }
76121
76329
  };
76122
76330
 
@@ -77395,7 +77603,7 @@ var Socket2 = class extends import_component_emitter5.Emitter {
77395
77603
  * @return self
77396
77604
  */
77397
77605
  emit(ev, ...args) {
77398
- var _a, _b, _c;
77606
+ var _a2, _b, _c;
77399
77607
  if (RESERVED_EVENTS2.hasOwnProperty(ev)) {
77400
77608
  throw new Error('"' + ev.toString() + '" is a reserved event name');
77401
77609
  }
@@ -77417,7 +77625,7 @@ var Socket2 = class extends import_component_emitter5.Emitter {
77417
77625
  this._registerAckCallback(id, ack);
77418
77626
  packet.id = id;
77419
77627
  }
77420
- const isTransportWritable = (_b = (_a = this.io.engine) === null || _a === void 0 ? void 0 : _a.transport) === null || _b === void 0 ? void 0 : _b.writable;
77628
+ const isTransportWritable = (_b = (_a2 = this.io.engine) === null || _a2 === void 0 ? void 0 : _a2.transport) === null || _b === void 0 ? void 0 : _b.writable;
77421
77629
  const isConnected = this.connected && !((_c = this.io.engine) === null || _c === void 0 ? void 0 : _c._hasPingExpired());
77422
77630
  const discardPacket = this.flags.volatile && !isTransportWritable;
77423
77631
  if (discardPacket) {
@@ -77435,8 +77643,8 @@ var Socket2 = class extends import_component_emitter5.Emitter {
77435
77643
  * @private
77436
77644
  */
77437
77645
  _registerAckCallback(id, ack) {
77438
- var _a;
77439
- const timeout = (_a = this.flags.timeout) !== null && _a !== void 0 ? _a : this._opts.ackTimeout;
77646
+ var _a2;
77647
+ const timeout = (_a2 = this.flags.timeout) !== null && _a2 !== void 0 ? _a2 : this._opts.ackTimeout;
77440
77648
  if (timeout === void 0) {
77441
77649
  this.acks[id] = ack;
77442
77650
  return;
@@ -78074,7 +78282,7 @@ var import_debug10 = __toESM(require_src(), 1);
78074
78282
  var debug10 = (0, import_debug10.default)("socket.io-client:manager");
78075
78283
  var Manager = class extends import_component_emitter6.Emitter {
78076
78284
  constructor(uri, opts) {
78077
- var _a;
78285
+ var _a2;
78078
78286
  super();
78079
78287
  this.nsps = {};
78080
78288
  this.subs = [];
@@ -78090,7 +78298,7 @@ var Manager = class extends import_component_emitter6.Emitter {
78090
78298
  this.reconnectionAttempts(opts.reconnectionAttempts || Infinity);
78091
78299
  this.reconnectionDelay(opts.reconnectionDelay || 1e3);
78092
78300
  this.reconnectionDelayMax(opts.reconnectionDelayMax || 5e3);
78093
- this.randomizationFactor((_a = opts.randomizationFactor) !== null && _a !== void 0 ? _a : 0.5);
78301
+ this.randomizationFactor((_a2 = opts.randomizationFactor) !== null && _a2 !== void 0 ? _a2 : 0.5);
78094
78302
  this.backoff = new Backoff({
78095
78303
  min: this.reconnectionDelay(),
78096
78304
  max: this.reconnectionDelayMax(),
@@ -78122,27 +78330,27 @@ var Manager = class extends import_component_emitter6.Emitter {
78122
78330
  return this;
78123
78331
  }
78124
78332
  reconnectionDelay(v) {
78125
- var _a;
78333
+ var _a2;
78126
78334
  if (v === void 0)
78127
78335
  return this._reconnectionDelay;
78128
78336
  this._reconnectionDelay = v;
78129
- (_a = this.backoff) === null || _a === void 0 ? void 0 : _a.setMin(v);
78337
+ (_a2 = this.backoff) === null || _a2 === void 0 ? void 0 : _a2.setMin(v);
78130
78338
  return this;
78131
78339
  }
78132
78340
  randomizationFactor(v) {
78133
- var _a;
78341
+ var _a2;
78134
78342
  if (v === void 0)
78135
78343
  return this._randomizationFactor;
78136
78344
  this._randomizationFactor = v;
78137
- (_a = this.backoff) === null || _a === void 0 ? void 0 : _a.setJitter(v);
78345
+ (_a2 = this.backoff) === null || _a2 === void 0 ? void 0 : _a2.setJitter(v);
78138
78346
  return this;
78139
78347
  }
78140
78348
  reconnectionDelayMax(v) {
78141
- var _a;
78349
+ var _a2;
78142
78350
  if (v === void 0)
78143
78351
  return this._reconnectionDelayMax;
78144
78352
  this._reconnectionDelayMax = v;
78145
- (_a = this.backoff) === null || _a === void 0 ? void 0 : _a.setMax(v);
78353
+ (_a2 = this.backoff) === null || _a2 === void 0 ? void 0 : _a2.setMax(v);
78146
78354
  return this;
78147
78355
  }
78148
78356
  timeout(v) {
@@ -78369,10 +78577,10 @@ var Manager = class extends import_component_emitter6.Emitter {
78369
78577
  * @private
78370
78578
  */
78371
78579
  onclose(reason, description) {
78372
- var _a;
78580
+ var _a2;
78373
78581
  debug10("closed due to %s", reason);
78374
78582
  this.cleanup();
78375
- (_a = this.engine) === null || _a === void 0 ? void 0 : _a.close();
78583
+ (_a2 = this.engine) === null || _a2 === void 0 ? void 0 : _a2.close();
78376
78584
  this.backoff.reset();
78377
78585
  this._readyState = "closed";
78378
78586
  this.emitReserved("close", reason, description);
@@ -83735,12 +83943,12 @@ var NEVER2 = Object.freeze({
83735
83943
  // @__NO_SIDE_EFFECTS__
83736
83944
  function $constructor(name, initializer3, params) {
83737
83945
  function init(inst, def) {
83738
- var _a;
83946
+ var _a2;
83739
83947
  Object.defineProperty(inst, "_zod", {
83740
83948
  value: inst._zod ?? {},
83741
83949
  enumerable: false
83742
83950
  });
83743
- (_a = inst._zod).traits ?? (_a.traits = /* @__PURE__ */ new Set());
83951
+ (_a2 = inst._zod).traits ?? (_a2.traits = /* @__PURE__ */ new Set());
83744
83952
  inst._zod.traits.add(name);
83745
83953
  initializer3(inst, def);
83746
83954
  for (const k in _.prototype) {
@@ -83755,10 +83963,10 @@ function $constructor(name, initializer3, params) {
83755
83963
  }
83756
83964
  Object.defineProperty(Definition, "name", { value: name });
83757
83965
  function _(def) {
83758
- var _a;
83966
+ var _a2;
83759
83967
  const inst = params?.Parent ? new Definition() : this;
83760
83968
  init(inst, def);
83761
- (_a = inst._zod).deferred ?? (_a.deferred = []);
83969
+ (_a2 = inst._zod).deferred ?? (_a2.deferred = []);
83762
83970
  for (const fn of inst._zod.deferred) {
83763
83971
  fn();
83764
83972
  }
@@ -84248,8 +84456,8 @@ function aborted(x, startIndex = 0) {
84248
84456
  }
84249
84457
  function prefixIssues(path51, issues) {
84250
84458
  return issues.map((iss) => {
84251
- var _a;
84252
- (_a = iss).path ?? (_a.path = []);
84459
+ var _a2;
84460
+ (_a2 = iss).path ?? (_a2.path = []);
84253
84461
  iss.path.unshift(path51);
84254
84462
  return iss;
84255
84463
  });
@@ -84495,10 +84703,10 @@ var uppercase = /^[^a-z]*$/;
84495
84703
 
84496
84704
  // node_modules/zod/v4/core/checks.js
84497
84705
  var $ZodCheck = /* @__PURE__ */ $constructor("$ZodCheck", (inst, def) => {
84498
- var _a;
84706
+ var _a2;
84499
84707
  inst._zod ?? (inst._zod = {});
84500
84708
  inst._zod.def = def;
84501
- (_a = inst._zod).onattach ?? (_a.onattach = []);
84709
+ (_a2 = inst._zod).onattach ?? (_a2.onattach = []);
84502
84710
  });
84503
84711
  var numericOriginMap = {
84504
84712
  number: "number",
@@ -84564,8 +84772,8 @@ var $ZodCheckGreaterThan = /* @__PURE__ */ $constructor("$ZodCheckGreaterThan",
84564
84772
  var $ZodCheckMultipleOf = /* @__PURE__ */ $constructor("$ZodCheckMultipleOf", (inst, def) => {
84565
84773
  $ZodCheck.init(inst, def);
84566
84774
  inst._zod.onattach.push((inst2) => {
84567
- var _a;
84568
- (_a = inst2._zod.bag).multipleOf ?? (_a.multipleOf = def.value);
84775
+ var _a2;
84776
+ (_a2 = inst2._zod.bag).multipleOf ?? (_a2.multipleOf = def.value);
84569
84777
  });
84570
84778
  inst._zod.check = (payload) => {
84571
84779
  if (typeof payload.value !== typeof def.value)
@@ -84658,9 +84866,9 @@ var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat"
84658
84866
  };
84659
84867
  });
84660
84868
  var $ZodCheckMaxLength = /* @__PURE__ */ $constructor("$ZodCheckMaxLength", (inst, def) => {
84661
- var _a;
84869
+ var _a2;
84662
84870
  $ZodCheck.init(inst, def);
84663
- (_a = inst._zod.def).when ?? (_a.when = (payload) => {
84871
+ (_a2 = inst._zod.def).when ?? (_a2.when = (payload) => {
84664
84872
  const val = payload.value;
84665
84873
  return !nullish(val) && val.length !== void 0;
84666
84874
  });
@@ -84687,9 +84895,9 @@ var $ZodCheckMaxLength = /* @__PURE__ */ $constructor("$ZodCheckMaxLength", (ins
84687
84895
  };
84688
84896
  });
84689
84897
  var $ZodCheckMinLength = /* @__PURE__ */ $constructor("$ZodCheckMinLength", (inst, def) => {
84690
- var _a;
84898
+ var _a2;
84691
84899
  $ZodCheck.init(inst, def);
84692
- (_a = inst._zod.def).when ?? (_a.when = (payload) => {
84900
+ (_a2 = inst._zod.def).when ?? (_a2.when = (payload) => {
84693
84901
  const val = payload.value;
84694
84902
  return !nullish(val) && val.length !== void 0;
84695
84903
  });
@@ -84716,9 +84924,9 @@ var $ZodCheckMinLength = /* @__PURE__ */ $constructor("$ZodCheckMinLength", (ins
84716
84924
  };
84717
84925
  });
84718
84926
  var $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEquals", (inst, def) => {
84719
- var _a;
84927
+ var _a2;
84720
84928
  $ZodCheck.init(inst, def);
84721
- (_a = inst._zod.def).when ?? (_a.when = (payload) => {
84929
+ (_a2 = inst._zod.def).when ?? (_a2.when = (payload) => {
84722
84930
  const val = payload.value;
84723
84931
  return !nullish(val) && val.length !== void 0;
84724
84932
  });
@@ -84747,7 +84955,7 @@ var $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEquals"
84747
84955
  };
84748
84956
  });
84749
84957
  var $ZodCheckStringFormat = /* @__PURE__ */ $constructor("$ZodCheckStringFormat", (inst, def) => {
84750
- var _a, _b;
84958
+ var _a2, _b;
84751
84959
  $ZodCheck.init(inst, def);
84752
84960
  inst._zod.onattach.push((inst2) => {
84753
84961
  const bag = inst2._zod.bag;
@@ -84758,7 +84966,7 @@ var $ZodCheckStringFormat = /* @__PURE__ */ $constructor("$ZodCheckStringFormat"
84758
84966
  }
84759
84967
  });
84760
84968
  if (def.pattern)
84761
- (_a = inst._zod).check ?? (_a.check = (payload) => {
84969
+ (_a2 = inst._zod).check ?? (_a2.check = (payload) => {
84762
84970
  def.pattern.lastIndex = 0;
84763
84971
  if (def.pattern.test(payload.value))
84764
84972
  return;
@@ -84923,7 +85131,7 @@ var version = {
84923
85131
 
84924
85132
  // node_modules/zod/v4/core/schemas.js
84925
85133
  var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
84926
- var _a;
85134
+ var _a2;
84927
85135
  inst ?? (inst = {});
84928
85136
  inst._zod.def = def;
84929
85137
  inst._zod.bag = inst._zod.bag || {};
@@ -84938,7 +85146,7 @@ var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
84938
85146
  }
84939
85147
  }
84940
85148
  if (checks.length === 0) {
84941
- (_a = inst._zod).deferred ?? (_a.deferred = []);
85149
+ (_a2 = inst._zod).deferred ?? (_a2.deferred = []);
84942
85150
  inst._zod.deferred?.push(() => {
84943
85151
  inst._zod.run = inst._zod.parse;
84944
85152
  });
@@ -86777,7 +86985,7 @@ var JSONSchemaGenerator = class {
86777
86985
  this.seen = /* @__PURE__ */ new Map();
86778
86986
  }
86779
86987
  process(schema2, _params = { path: [], schemaPath: [] }) {
86780
- var _a;
86988
+ var _a2;
86781
86989
  const def = schema2._zod.def;
86782
86990
  const formatMap = {
86783
86991
  guid: "uuid",
@@ -87239,7 +87447,7 @@ var JSONSchemaGenerator = class {
87239
87447
  delete result.schema.default;
87240
87448
  }
87241
87449
  if (this.io === "input" && result.schema._prefault)
87242
- (_a = result.schema).default ?? (_a.default = result.schema._prefault);
87450
+ (_a2 = result.schema).default ?? (_a2.default = result.schema._prefault);
87243
87451
  delete result.schema._prefault;
87244
87452
  const _result = this.seen.get(schema2);
87245
87453
  return _result.schema;
@@ -94673,8 +94881,8 @@ ${parseResult.errors.join("\n")}`);
94673
94881
  });
94674
94882
  const outputFile = filePath.replace(/\.ts$/, ".inngest.ts");
94675
94883
  if (args.write !== false) {
94676
- const fs50 = await import("fs");
94677
- fs50.writeFileSync(outputFile, code, "utf8");
94884
+ const fs51 = await import("fs");
94885
+ fs51.writeFileSync(outputFile, code, "utf8");
94678
94886
  }
94679
94887
  return makeToolResult({
94680
94888
  target: "inngest",
@@ -103162,6 +103370,199 @@ function registerDebugTools(mcp) {
103162
103370
  );
103163
103371
  }
103164
103372
 
103373
+ // src/context/index.ts
103374
+ init_grammar_diagrams();
103375
+ var PRESETS = {
103376
+ core: ["concepts", "jsdoc-grammar", "tutorial"],
103377
+ authoring: [
103378
+ "concepts",
103379
+ "jsdoc-grammar",
103380
+ "advanced-annotations",
103381
+ "built-in-nodes",
103382
+ "scaffold",
103383
+ "node-conversion",
103384
+ "patterns"
103385
+ ],
103386
+ ops: [
103387
+ "cli-reference",
103388
+ "compilation",
103389
+ "deployment",
103390
+ "export-interface",
103391
+ "debugging",
103392
+ "error-codes"
103393
+ ],
103394
+ full: [
103395
+ "concepts",
103396
+ "tutorial",
103397
+ "jsdoc-grammar",
103398
+ "advanced-annotations",
103399
+ "built-in-nodes",
103400
+ "cli-reference",
103401
+ "compilation",
103402
+ "debugging",
103403
+ "deployment",
103404
+ "error-codes",
103405
+ "export-interface",
103406
+ "iterative-development",
103407
+ "marketplace",
103408
+ "node-conversion",
103409
+ "patterns",
103410
+ "scaffold"
103411
+ ]
103412
+ };
103413
+ var PRESET_NAMES = Object.keys(PRESETS);
103414
+ var STANDALONE_PREAMBLE = `# Flow Weaver Reference
103415
+
103416
+ Flow Weaver is a TypeScript workflow compiler. You write plain .ts files with
103417
+ JSDoc annotations (@flowWeaver nodeType, @flowWeaver workflow, @input, @output,
103418
+ @connect, @node, @scope). The compiler parses these annotations, validates the
103419
+ graph, and generates executable code inline. The source file is the workflow:
103420
+ no JSON configs, no YAML, no separate graph files.
103421
+
103422
+ Key concepts: node types define reusable processing steps with typed input/output
103423
+ ports. Workflows instantiate nodes and connect their ports. Start and Exit are
103424
+ implicit boundary nodes. The compiler handles execution ordering, type checking,
103425
+ and code generation.`;
103426
+ function buildAssistantPreamble() {
103427
+ const allSlugs = listTopics().map((t) => t.slug);
103428
+ return `# Flow Weaver Context
103429
+
103430
+ You have Flow Weaver MCP tools available (fw_ prefix). Use them to create,
103431
+ modify, validate, compile, and inspect workflows without manual file editing.
103432
+
103433
+ For documentation not included below, call fw_docs(action="read", topic="<slug>").
103434
+ Available topic slugs: ${allSlugs.join(", ")}.
103435
+
103436
+ Tool quick reference:
103437
+ - fw_create_model: Build workflow from structured description (steps + flow path)
103438
+ - fw_implement_node: Replace a declare stub with a real function body
103439
+ - fw_modify / fw_modify_batch: Add/remove nodes, connections, rename, reposition
103440
+ - fw_validate: Check for errors after any change
103441
+ - fw_describe: Inspect structure. Use format "text" for readable, "json" for data
103442
+ - fw_diagram: Visualize. Prefer format "ascii-compact" in chat contexts
103443
+ - fw_compile: Generate executable TypeScript from annotations
103444
+ - fw_docs: Look up reference docs by topic slug
103445
+ - fw_scaffold: Create from templates (sequential, foreach, ai-agent, etc.)
103446
+
103447
+ File conventions: .ts extension, camelCase node names, PascalCase workflow names.`;
103448
+ }
103449
+ function resolveTopics(preset, explicit, add) {
103450
+ const base = explicit ?? PRESETS[preset];
103451
+ const combined = add ? [...base, ...add] : base;
103452
+ return [...new Set(combined)];
103453
+ }
103454
+ function buildGrammarSection() {
103455
+ const grammars = getAllGrammars();
103456
+ const allProductions = [
103457
+ ...grammars.port,
103458
+ ...grammars.node,
103459
+ ...grammars.connect,
103460
+ ...grammars.position,
103461
+ ...grammars.scope
103462
+ ];
103463
+ const ebnf = serializedToEBNF(allProductions);
103464
+ return `## JSDoc Annotation Grammar (EBNF)
103465
+
103466
+ \`\`\`ebnf
103467
+ ${ebnf}
103468
+ \`\`\``;
103469
+ }
103470
+ function buildContext(options = {}) {
103471
+ const profile = options.profile ?? "standalone";
103472
+ const preset = options.preset ?? "core";
103473
+ const includeGrammar = options.includeGrammar ?? true;
103474
+ const topicSlugs = resolveTopics(preset, options.topics, options.addTopics);
103475
+ const sections = [];
103476
+ if (profile === "standalone") {
103477
+ sections.push(STANDALONE_PREAMBLE);
103478
+ } else {
103479
+ sections.push(buildAssistantPreamble());
103480
+ }
103481
+ if (includeGrammar) {
103482
+ sections.push(buildGrammarSection());
103483
+ }
103484
+ let topicCount = 0;
103485
+ const includedSlugs = [];
103486
+ for (const slug of topicSlugs) {
103487
+ const doc = readTopic(slug, true);
103488
+ if (!doc) continue;
103489
+ let body = doc.content;
103490
+ if (body.startsWith("# ")) {
103491
+ const lines = body.split("\n");
103492
+ let startLine = 1;
103493
+ if (lines.length > 1 && lines[1].trim() && !lines[1].startsWith("#")) {
103494
+ startLine = 2;
103495
+ }
103496
+ body = lines.slice(startLine).join("\n").replace(/^\n+/, "");
103497
+ }
103498
+ const bodyLines = body.split("\n");
103499
+ let inCode = false;
103500
+ for (let i = 0; i < bodyLines.length; i++) {
103501
+ if (bodyLines[i].trimStart().startsWith("```")) {
103502
+ inCode = !inCode;
103503
+ continue;
103504
+ }
103505
+ if (!inCode && bodyLines[i].match(/^#{1,5}\s/)) {
103506
+ bodyLines[i] = "##" + bodyLines[i];
103507
+ }
103508
+ }
103509
+ body = bodyLines.join("\n");
103510
+ const heading = doc.name || slug;
103511
+ sections.push(`## ${heading}
103512
+
103513
+ ${body}`);
103514
+ topicCount++;
103515
+ includedSlugs.push(slug);
103516
+ }
103517
+ const content = sections.join("\n\n---\n\n");
103518
+ const lineCount = content.split("\n").length;
103519
+ return {
103520
+ content,
103521
+ topicCount,
103522
+ lineCount,
103523
+ topicSlugs: includedSlugs,
103524
+ profile
103525
+ };
103526
+ }
103527
+
103528
+ // src/mcp/tools-context.ts
103529
+ function registerContextTools(mcp) {
103530
+ mcp.tool(
103531
+ "fw_context",
103532
+ 'Generate a self-contained LLM context bundle with Flow Weaver documentation, grammar, and conventions. Use preset="core" for basics, "authoring" for writing workflows, "full" for everything, "ops" for CLI/deployment reference.',
103533
+ {
103534
+ preset: external_exports.enum(["core", "authoring", "full", "ops"]).optional().default("core").describe("Topic preset"),
103535
+ profile: external_exports.enum(["standalone", "assistant"]).optional().default("assistant").describe("standalone = full self-contained dump, assistant = assumes MCP tools available"),
103536
+ topics: external_exports.string().optional().describe("Comma-separated topic slugs (overrides preset)"),
103537
+ addTopics: external_exports.string().optional().describe("Comma-separated slugs to add to preset"),
103538
+ includeGrammar: external_exports.boolean().optional().default(true).describe("Include EBNF annotation grammar section")
103539
+ },
103540
+ async (args) => {
103541
+ try {
103542
+ const result = buildContext({
103543
+ preset: args.preset,
103544
+ profile: args.profile,
103545
+ topics: args.topics ? args.topics.split(",").map((s) => s.trim()) : void 0,
103546
+ addTopics: args.addTopics ? args.addTopics.split(",").map((s) => s.trim()) : void 0,
103547
+ includeGrammar: args.includeGrammar
103548
+ });
103549
+ return makeToolResult({
103550
+ profile: result.profile,
103551
+ topicCount: result.topicCount,
103552
+ lineCount: result.lineCount,
103553
+ topicSlugs: result.topicSlugs,
103554
+ content: result.content
103555
+ });
103556
+ } catch (err) {
103557
+ return makeErrorResult(
103558
+ "CONTEXT_ERROR",
103559
+ `fw_context failed: ${err instanceof Error ? err.message : String(err)}`
103560
+ );
103561
+ }
103562
+ }
103563
+ );
103564
+ }
103565
+
103165
103566
  // src/mcp/resources.ts
103166
103567
  function registerResources(mcp, connection, buffer) {
103167
103568
  mcp.resource(
@@ -103336,6 +103737,7 @@ async function startMcpServer(options) {
103336
103737
  registerDocsTools(mcp);
103337
103738
  registerModelTools(mcp);
103338
103739
  registerDebugTools(mcp);
103740
+ registerContextTools(mcp);
103339
103741
  registerResources(mcp, connection, buffer);
103340
103742
  registerPrompts(mcp);
103341
103743
  if (!options._testDeps && options.stdio) {
@@ -106445,10 +106847,56 @@ async function docsSearchCommand(query, options) {
106445
106847
  logger.newline();
106446
106848
  }
106447
106849
 
106850
+ // src/cli/commands/context.ts
106851
+ import * as fs46 from "fs";
106852
+ async function contextCommand(preset, options) {
106853
+ if (options.list) {
106854
+ logger.section("Context Presets");
106855
+ logger.newline();
106856
+ const maxName = Math.max(...PRESET_NAMES.map((n) => n.length));
106857
+ for (const name of PRESET_NAMES) {
106858
+ const topics = PRESETS[name];
106859
+ logger.log(` ${name.padEnd(maxName + 2)} ${topics.join(", ")}`);
106860
+ }
106861
+ logger.newline();
106862
+ logger.log(" Usage: flow-weaver context [preset] [options]");
106863
+ logger.newline();
106864
+ return;
106865
+ }
106866
+ const presetName = preset ?? "core";
106867
+ if (!PRESET_NAMES.includes(presetName) && !options.topics) {
106868
+ logger.error(
106869
+ `Unknown preset "${preset}". Available: ${PRESET_NAMES.join(", ")}. Or use --topics to specify topics directly.`
106870
+ );
106871
+ process.exit(1);
106872
+ }
106873
+ const profile = options.profile ?? "standalone";
106874
+ if (profile !== "standalone" && profile !== "assistant") {
106875
+ logger.error(`Unknown profile "${profile}". Use "standalone" or "assistant".`);
106876
+ process.exit(1);
106877
+ }
106878
+ const result = buildContext({
106879
+ preset: PRESET_NAMES.includes(presetName) ? presetName : "core",
106880
+ profile,
106881
+ topics: options.topics ? options.topics.split(",").map((s) => s.trim()) : void 0,
106882
+ addTopics: options.add ? options.add.split(",").map((s) => s.trim()) : void 0,
106883
+ includeGrammar: options.grammar !== false
106884
+ });
106885
+ if (options.output) {
106886
+ fs46.writeFileSync(options.output, result.content, "utf-8");
106887
+ logger.success(`Context written to ${options.output}`);
106888
+ } else {
106889
+ process.stdout.write(result.content);
106890
+ }
106891
+ const stats = `${result.topicCount} topics, ${result.lineCount} lines (${result.profile} profile)`;
106892
+ process.stderr.write(`flow-weaver context: ${stats}
106893
+ `);
106894
+ }
106895
+
106448
106896
  // src/cli/commands/status.ts
106449
106897
  init_api6();
106450
106898
  init_validator();
106451
- import * as fs46 from "fs";
106899
+ import * as fs47 from "fs";
106452
106900
  import * as path47 from "path";
106453
106901
  init_error_utils();
106454
106902
  function formatPortList(ports) {
@@ -106458,7 +106906,7 @@ async function statusCommand(input, options = {}) {
106458
106906
  const { workflowName, json: json2 = false } = options;
106459
106907
  try {
106460
106908
  const filePath = path47.resolve(input);
106461
- if (!fs46.existsSync(filePath)) {
106909
+ if (!fs47.existsSync(filePath)) {
106462
106910
  if (json2) {
106463
106911
  console.log(JSON.stringify({ error: `File not found: ${input}` }));
106464
106912
  } else {
@@ -106550,7 +106998,7 @@ async function statusCommand(input, options = {}) {
106550
106998
  // src/cli/commands/implement.ts
106551
106999
  init_api6();
106552
107000
  init_annotation_generator();
106553
- import * as fs47 from "fs";
107001
+ import * as fs48 from "fs";
106554
107002
  import * as path48 from "path";
106555
107003
  init_error_utils();
106556
107004
  function findDeclareFunction2(source, functionName) {
@@ -106575,7 +107023,7 @@ async function implementCommand(input, nodeName, options = {}) {
106575
107023
  const { workflowName, preview = false } = options;
106576
107024
  try {
106577
107025
  const filePath = path48.resolve(input);
106578
- if (!fs47.existsSync(filePath)) {
107026
+ if (!fs48.existsSync(filePath)) {
106579
107027
  logger.error(`File not found: ${input}`);
106580
107028
  process.exit(1);
106581
107029
  }
@@ -106605,7 +107053,7 @@ async function implementCommand(input, nodeName, options = {}) {
106605
107053
  }
106606
107054
  process.exit(1);
106607
107055
  }
106608
- const source = fs47.readFileSync(filePath, "utf8");
107056
+ const source = fs48.readFileSync(filePath, "utf8");
106609
107057
  const found = findDeclareFunction2(source, stubNodeType.functionName);
106610
107058
  if (!found) {
106611
107059
  logger.error(`Could not find "declare function ${stubNodeType.functionName}" in source file.`);
@@ -106620,7 +107068,7 @@ async function implementCommand(input, nodeName, options = {}) {
106620
107068
  console.log(replacement);
106621
107069
  } else {
106622
107070
  const updated = source.replace(found.match, replacement);
106623
- fs47.writeFileSync(filePath, updated, "utf8");
107071
+ fs48.writeFileSync(filePath, updated, "utf8");
106624
107072
  logger.success(`Implemented ${stubNodeType.functionName} in ${path48.basename(filePath)}`);
106625
107073
  }
106626
107074
  } catch (error2) {
@@ -106630,7 +107078,7 @@ async function implementCommand(input, nodeName, options = {}) {
106630
107078
  }
106631
107079
 
106632
107080
  // src/cli/commands/market.ts
106633
- import * as fs48 from "fs";
107081
+ import * as fs49 from "fs";
106634
107082
  import * as path49 from "path";
106635
107083
  import { execSync as execSync5 } from "child_process";
106636
107084
  init_error_utils();
@@ -106641,10 +107089,10 @@ async function marketInitCommand(name, options = {}) {
106641
107089
  name = suggested;
106642
107090
  }
106643
107091
  const targetDir = path49.resolve(name);
106644
- if (fs48.existsSync(targetDir)) {
106645
- const stat2 = fs48.statSync(targetDir);
107092
+ if (fs49.existsSync(targetDir)) {
107093
+ const stat2 = fs49.statSync(targetDir);
106646
107094
  if (stat2.isDirectory()) {
106647
- const contents = fs48.readdirSync(targetDir);
107095
+ const contents = fs49.readdirSync(targetDir);
106648
107096
  if (contents.length > 0) {
106649
107097
  logger.error(`Directory "${name}" already exists and is not empty`);
106650
107098
  process.exit(1);
@@ -106665,7 +107113,7 @@ async function marketInitCommand(name, options = {}) {
106665
107113
  path49.join(targetDir, "src", "patterns")
106666
107114
  ];
106667
107115
  for (const dir of dirs) {
106668
- fs48.mkdirSync(dir, { recursive: true });
107116
+ fs49.mkdirSync(dir, { recursive: true });
106669
107117
  }
106670
107118
  const shortName = name.replace(/^flowweaver-pack-/, "");
106671
107119
  const pkg = {
@@ -106696,7 +107144,7 @@ async function marketInitCommand(name, options = {}) {
106696
107144
  },
106697
107145
  files: ["dist", "flowweaver.manifest.json", "README.md", "LICENSE"]
106698
107146
  };
106699
- fs48.writeFileSync(
107147
+ fs49.writeFileSync(
106700
107148
  path49.join(targetDir, "package.json"),
106701
107149
  JSON.stringify(pkg, null, 2) + "\n"
106702
107150
  );
@@ -106715,7 +107163,7 @@ async function marketInitCommand(name, options = {}) {
106715
107163
  include: ["src"],
106716
107164
  exclude: ["node_modules", "dist"]
106717
107165
  };
106718
- fs48.writeFileSync(
107166
+ fs49.writeFileSync(
106719
107167
  path49.join(targetDir, "tsconfig.json"),
106720
107168
  JSON.stringify(tsconfig, null, 2) + "\n"
106721
107169
  );
@@ -106734,20 +107182,20 @@ export function sample(execute: () => void, data: string): { result: string } {
106734
107182
  return { result: data.toUpperCase() };
106735
107183
  }
106736
107184
  `;
106737
- fs48.writeFileSync(path49.join(targetDir, "src", "node-types", "sample.ts"), sampleNodeType);
106738
- fs48.writeFileSync(
107185
+ fs49.writeFileSync(path49.join(targetDir, "src", "node-types", "sample.ts"), sampleNodeType);
107186
+ fs49.writeFileSync(
106739
107187
  path49.join(targetDir, "src", "node-types", "index.ts"),
106740
107188
  "export { sample } from './sample.js';\n"
106741
107189
  );
106742
- fs48.writeFileSync(
107190
+ fs49.writeFileSync(
106743
107191
  path49.join(targetDir, "src", "workflows", "index.ts"),
106744
107192
  "// Export workflows here\n"
106745
107193
  );
106746
- fs48.writeFileSync(
107194
+ fs49.writeFileSync(
106747
107195
  path49.join(targetDir, "src", "patterns", "index.ts"),
106748
107196
  "// Export patterns here\n"
106749
107197
  );
106750
- fs48.writeFileSync(
107198
+ fs49.writeFileSync(
106751
107199
  path49.join(targetDir, "src", "index.ts"),
106752
107200
  [
106753
107201
  "export * from './node-types/index.js';",
@@ -106781,8 +107229,8 @@ npm run pack # Generate flowweaver.manifest.json
106781
107229
  npm publish # Publish to npm
106782
107230
  \`\`\`
106783
107231
  `;
106784
- fs48.writeFileSync(path49.join(targetDir, "README.md"), readme);
106785
- fs48.writeFileSync(
107232
+ fs49.writeFileSync(path49.join(targetDir, "README.md"), readme);
107233
+ fs49.writeFileSync(
106786
107234
  path49.join(targetDir, ".gitignore"),
106787
107235
  ["node_modules", "dist", "*.tgz", ""].join("\n")
106788
107236
  );
@@ -106853,10 +107301,10 @@ async function marketPublishCommand(directory, options = {}) {
106853
107301
  const { dryRun = false, tag } = options;
106854
107302
  logger.section("Publishing Marketplace Package");
106855
107303
  await marketPackCommand(dir, { json: false });
106856
- if (!fs48.existsSync(path49.join(dir, "LICENSE"))) {
107304
+ if (!fs49.existsSync(path49.join(dir, "LICENSE"))) {
106857
107305
  logger.warn("LICENSE file not found \u2014 consider adding one");
106858
107306
  }
106859
- const pkg = JSON.parse(fs48.readFileSync(path49.join(dir, "package.json"), "utf-8"));
107307
+ const pkg = JSON.parse(fs49.readFileSync(path49.join(dir, "package.json"), "utf-8"));
106860
107308
  logger.info(`Publishing ${pkg.name}@${pkg.version}`);
106861
107309
  const npmArgs = ["publish"];
106862
107310
  if (dryRun) npmArgs.push("--dry-run");
@@ -107025,7 +107473,7 @@ function displayInstalledPackage(pkg) {
107025
107473
 
107026
107474
  // src/cli/commands/mcp-setup.ts
107027
107475
  import { execSync as execSync6 } from "child_process";
107028
- import * as fs49 from "fs";
107476
+ import * as fs50 from "fs";
107029
107477
  import * as path50 from "path";
107030
107478
  import * as os3 from "os";
107031
107479
  var MCP_COMMAND = "npx";
@@ -107043,7 +107491,7 @@ function defaultDeps() {
107043
107491
  },
107044
107492
  fileExists: async (filePath) => {
107045
107493
  try {
107046
- await fs49.promises.access(filePath);
107494
+ await fs50.promises.access(filePath);
107047
107495
  return true;
107048
107496
  } catch {
107049
107497
  return false;
@@ -107051,16 +107499,16 @@ function defaultDeps() {
107051
107499
  },
107052
107500
  readFile: async (filePath) => {
107053
107501
  try {
107054
- return await fs49.promises.readFile(filePath, "utf8");
107502
+ return await fs50.promises.readFile(filePath, "utf8");
107055
107503
  } catch {
107056
107504
  return null;
107057
107505
  }
107058
107506
  },
107059
107507
  writeFile: async (filePath, content) => {
107060
- await fs49.promises.writeFile(filePath, content, "utf8");
107508
+ await fs50.promises.writeFile(filePath, content, "utf8");
107061
107509
  },
107062
107510
  mkdir: async (dirPath) => {
107063
- await fs49.promises.mkdir(dirPath, { recursive: true });
107511
+ await fs50.promises.mkdir(dirPath, { recursive: true });
107064
107512
  },
107065
107513
  cwd: () => process.cwd(),
107066
107514
  homedir: () => os3.homedir(),
@@ -107350,7 +107798,7 @@ async function mcpSetupCommand(options, deps) {
107350
107798
 
107351
107799
  // src/cli/index.ts
107352
107800
  init_error_utils();
107353
- var version2 = true ? "0.11.0" : "0.0.0-dev";
107801
+ var version2 = true ? "0.12.1" : "0.0.0-dev";
107354
107802
  var program2 = new Command();
107355
107803
  program2.name("flow-weaver").description("Flow Weaver Annotations - Compile and validate workflow files").version(version2, "-v, --version", "Output the current version");
107356
107804
  program2.configureOutput({
@@ -107678,6 +108126,14 @@ program2.command("docs [args...]").description("Browse reference documentation")
107678
108126
  process.exit(1);
107679
108127
  }
107680
108128
  });
108129
+ program2.command("context [preset]").description("Generate LLM context bundle from documentation and grammar").option("--profile <profile>", "Output profile: standalone or assistant", "standalone").option("--topics <slugs>", "Comma-separated topic slugs (overrides preset)").option("--add <slugs>", "Comma-separated topic slugs to add to preset").option("--no-grammar", "Omit EBNF grammar section").option("-o, --output <path>", "Write to file instead of stdout").option("--list", "List available presets and exit").action(async (preset, options) => {
108130
+ try {
108131
+ await contextCommand(preset, options);
108132
+ } catch (error2) {
108133
+ logger.error(`Command failed: ${getErrorMessage(error2)}`);
108134
+ process.exit(1);
108135
+ }
108136
+ });
107681
108137
  var marketCmd = program2.command("market").description("Discover, install, and publish marketplace packages");
107682
108138
  marketCmd.command("init <name>").description("Scaffold a new marketplace package").option("-d, --description <desc>", "Package description").option("-a, --author <author>", "Author name").option("-y, --yes", "Skip prompts and use defaults", false).action(async (name, options) => {
107683
108139
  try {