@lovable.dev/workflows-sdk 0.0.0-dev.59 → 0.0.0-dev.60

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.
@@ -1,196 +1,3 @@
1
- import { createMiddleware, createWorkflow } from "@tanstack/workflow-core";
2
- //#region src/core/identifier.ts
3
- const WORKFLOW_ID_PATTERN = /^[a-z0-9][a-z0-9_-]{0,127}$/;
4
- function assertIdentifier(kind, id) {
5
- if (typeof id !== "string" || id.trim() === "" || id !== id.trim()) throw new Error(`@lovable.dev/workflows-sdk: ${kind} IDs must be non-empty and have no surrounding whitespace`);
6
- }
7
- //#endregion
8
- //#region src/core/cadence.ts
9
- const WEEKDAYS = [
10
- "mon",
11
- "tue",
12
- "wed",
13
- "thu",
14
- "fri",
15
- "sat",
16
- "sun"
17
- ];
18
- const MINUTE_INTERVALS = [
19
- 5,
20
- 10,
21
- 15,
22
- 20,
23
- 30
24
- ];
25
- const WEEKDAY_NAMES = {
26
- mon: "mon",
27
- monday: "mon",
28
- tue: "tue",
29
- tuesday: "tue",
30
- wed: "wed",
31
- wednesday: "wed",
32
- thu: "thu",
33
- thursday: "thu",
34
- fri: "fri",
35
- friday: "fri",
36
- sat: "sat",
37
- saturday: "sat",
38
- sun: "sun",
39
- sunday: "sun"
40
- };
41
- function fail$1(message) {
42
- throw new Error(`@lovable.dev/workflows-sdk: ${message}`);
43
- }
44
- function parseWeekday(value, label) {
45
- const day = typeof value === "string" ? WEEKDAY_NAMES[value.toLowerCase()] : void 0;
46
- if (day === void 0) fail$1(`${label} names an unknown day "${String(value)}"; use ${WEEKDAYS.join(", ")}`);
47
- return day;
48
- }
49
- function parseWeekdays(value, label) {
50
- if (!Array.isArray(value) || value.length === 0) fail$1(`${label} must be a non-empty list of days`);
51
- return [...new Set(value.map((entry) => parseWeekday(entry, label)))].sort((a, b) => WEEKDAYS.indexOf(a) - WEEKDAYS.indexOf(b));
52
- }
53
- function parseHoursOfDay(value, label) {
54
- if (!Array.isArray(value) || value.length === 0) fail$1(`${label} must be a non-empty list of hours`);
55
- const entries = value;
56
- for (const entry of entries) if (!Number.isInteger(entry) || entry < 0 || entry > 23) fail$1(`${label}: ${JSON.stringify(entry)} must be a whole hour from 0 to 23; the platform picks the minute`);
57
- return [...new Set(entries)].sort((a, b) => a - b);
58
- }
59
- function hourly(options) {
60
- if (options !== void 0) fail$1(`hourly() takes no options; the platform decides where in the hour a schedule runs`);
61
- return { kind: "hourly" };
62
- }
63
- function every(options) {
64
- if (typeof options === "string") fail$1(`every(${JSON.stringify(options)}) takes an object; write every({ minutes: 5 })`);
65
- const intervals = MINUTE_INTERVALS.join(", ");
66
- if (typeof options !== "object" || options === null || Object.keys(options).length !== 1 || !MINUTE_INTERVALS.includes(options.minutes)) fail$1(`every({ minutes }) takes exactly { minutes: ${intervals} }, got ${JSON.stringify(options)}; use hourly() or daily({ at }) for longer intervals`);
67
- return {
68
- kind: "minutes",
69
- interval: options.minutes
70
- };
71
- }
72
- function daily(options) {
73
- if (typeof options !== "object" || options === null || options.at === void 0) fail$1(`daily() requires { at: [9] }`);
74
- return {
75
- kind: "daily",
76
- at: parseHoursOfDay(options.at, "daily({ at })")
77
- };
78
- }
79
- function weekly(options) {
80
- if (typeof options !== "object" || options === null || options.on === void 0 || options.at === void 0) fail$1(`weekly() requires { on: ["mon"], at: [9] }`);
81
- return {
82
- kind: "weekly",
83
- on: parseWeekdays(options.on, "weekly({ on })"),
84
- at: parseHoursOfDay(options.at, "weekly({ at })")
85
- };
86
- }
87
- function isHourSet(value) {
88
- if (!Array.isArray(value) || value.length === 0) return false;
89
- return value.every((hour, index) => Number.isInteger(hour) && hour >= 0 && hour <= 23 && (index === 0 || hour > value[index - 1]));
90
- }
91
- function isWeekdaySet(value) {
92
- if (!Array.isArray(value) || value.length === 0) return false;
93
- return value.every((day, index) => WEEKDAYS.includes(day) && (index === 0 || WEEKDAYS.indexOf(day) > WEEKDAYS.indexOf(value[index - 1])));
94
- }
95
- function isCadence(value) {
96
- if (typeof value !== "object" || value === null) return false;
97
- const cadence = value;
98
- if (cadence.kind === "hourly") return Object.keys(cadence).length === 1;
99
- if (cadence.kind === "minutes") return Object.keys(cadence).length === 2 && MINUTE_INTERVALS.includes(cadence.interval);
100
- if (cadence.kind === "daily") return Object.keys(cadence).length === 2 && isHourSet(cadence.at);
101
- if (cadence.kind === "weekly") return Object.keys(cadence).length === 3 && isWeekdaySet(cadence.on) && isHourSet(cadence.at);
102
- return false;
103
- }
104
- //#endregion
105
- //#region src/core/schedule.ts
106
- const OVERLAP_POLICIES = [
107
- "skip",
108
- "allow",
109
- "buffer-one"
110
- ];
111
- function fail(message) {
112
- throw new Error(`@lovable.dev/workflows-sdk: ${message}`);
113
- }
114
- const CANONICAL_ZONES = new Set(typeof Intl.supportedValuesOf === "function" ? Intl.supportedValuesOf("timeZone") : []);
115
- function resolveTimeZone(schedule) {
116
- const timeZone = schedule.timeZone;
117
- if (typeof timeZone !== "string" || timeZone === "") fail(`schedule "${schedule.id}" needs a timeZone, such as "Europe/Stockholm" or "UTC"`);
118
- if (timeZone !== "UTC" && CANONICAL_ZONES.size > 0 && !CANONICAL_ZONES.has(timeZone)) fail(`schedule "${schedule.id}" timeZone "${timeZone}" must be "UTC" or a canonical IANA name such as "Europe/Stockholm"; fixed offsets and aliases such as "EST", "GMT", "Etc/GMT+5", and "US/Pacific" are not accepted`);
119
- new Intl.DateTimeFormat("en", { timeZone });
120
- return timeZone;
121
- }
122
- function defineSchedule(schedule) {
123
- assertIdentifier("schedule", schedule.id);
124
- if (!isCadence(schedule.cadence)) fail(`schedule "${schedule.id}" cadence must come from every({ minutes }), hourly(), daily({ at }), or weekly({ on, at })`);
125
- const cadence = schedule.cadence;
126
- const timeZone = resolveTimeZone(schedule);
127
- const overlapPolicy = schedule.overlapPolicy ?? "skip";
128
- if (!OVERLAP_POLICIES.includes(overlapPolicy)) fail(`schedule "${schedule.id}" overlapPolicy must be one of ${OVERLAP_POLICIES.join(", ")}`);
129
- const enabled = schedule.enabled ?? true;
130
- if (typeof enabled !== "boolean") fail(`schedule "${schedule.id}" enabled must be a boolean`);
131
- return {
132
- ...schedule,
133
- type: "schedule",
134
- cadence,
135
- timeZone,
136
- overlapPolicy,
137
- enabled
138
- };
139
- }
140
- //#endregion
141
- //#region src/core/workflow.ts
142
- function createWorkflow$1(config) {
143
- return createWorkflow(config);
144
- }
145
- function workflowVersions(current) {
146
- const versions = /* @__PURE__ */ new Map();
147
- const visiting = /* @__PURE__ */ new Set();
148
- const visit = (workflow) => {
149
- if (visiting.has(workflow)) throw new Error(`@lovable.dev/workflows-sdk: workflow "${current.id}" has cyclic previousVersions`);
150
- if (workflow.__kind !== "workflow" || typeof workflow.handler !== "function" || workflow.id !== current.id) throw new Error(`@lovable.dev/workflows-sdk: previousVersions must be completed definitions of workflow "${current.id}"`);
151
- if (typeof workflow.version !== "string" || !/^[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}$/.test(workflow.version)) throw new Error(`@lovable.dev/workflows-sdk: workflow "${current.id}" version must be 1–128 letters, digits, dots, hyphens or underscores, starting with a letter or digit`);
152
- if (`${workflow.id}.${workflow.version}.json`.length > 255) throw new Error(`@lovable.dev/workflows-sdk: workflow "${current.id}" and version exceed the 255-character manifest filename limit`);
153
- const version = workflow.version;
154
- const existing = versions.get(version);
155
- if (existing === workflow) return;
156
- if (existing) throw new Error(`@lovable.dev/workflows-sdk: duplicate workflow version "${version}" for "${current.id}"`);
157
- versions.set(version, workflow);
158
- visiting.add(workflow);
159
- for (const previous of workflow.previousVersions ?? []) visit(previous);
160
- visiting.delete(workflow);
161
- };
162
- visit(current);
163
- return [...versions.values()];
164
- }
165
- function registerWorkflows(definition) {
166
- for (const key of Object.keys(definition)) {
167
- if (key === "workflows" || key === "triggers") continue;
168
- throw new Error(key === "schedules" ? `@lovable.dev/workflows-sdk: registerWorkflows() no longer takes "schedules"; rename the key to "triggers"` : `@lovable.dev/workflows-sdk: registerWorkflows() does not take "${key}"`);
169
- }
170
- const { workflows, triggers = [] } = definition;
171
- const ids = /* @__PURE__ */ new Set();
172
- for (const workflow of workflows) {
173
- if (workflow.__kind !== "workflow" || typeof workflow.handler !== "function") throw new Error("@lovable.dev/workflows-sdk: expected a completed createWorkflow().handler() definition");
174
- assertIdentifier("workflow", workflow.id);
175
- if (!WORKFLOW_ID_PATTERN.test(workflow.id)) throw new Error("@lovable.dev/workflows-sdk: workflow names must be 1–128 lowercase letters, digits, hyphens or underscores, starting with a letter or digit");
176
- if (ids.has(workflow.id)) throw new Error(`@lovable.dev/workflows-sdk: duplicate workflow ID "${workflow.id}"`);
177
- ids.add(workflow.id);
178
- workflowVersions(workflow);
179
- }
180
- const scheduleIds = /* @__PURE__ */ new Set();
181
- const registeredTriggers = triggers.map((trigger) => {
182
- const definition = defineSchedule(trigger);
183
- if (scheduleIds.has(definition.id)) throw new Error(`@lovable.dev/workflows-sdk: duplicate schedule ID "${definition.id}"`);
184
- if (!workflows.includes(definition.workflow)) throw new Error(`@lovable.dev/workflows-sdk: schedule "${definition.id}" references an unregistered workflow`);
185
- scheduleIds.add(definition.id);
186
- return definition;
187
- });
188
- return {
189
- workflows: [...workflows],
190
- triggers: registeredTriggers
191
- };
192
- }
193
- //#endregion
194
1
  //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@bufbuild/protobuf/2.10.1/b0955b226816adda68977638196f96a6e65cec2605734621338f49f7ea29042e/node_modules/@bufbuild/protobuf/dist/esm/is-message.js
195
2
  /**
196
3
  * Determine whether the given `arg` is a message.
@@ -581,7 +388,7 @@ function isScalarZeroValue(type, value) {
581
388
  }
582
389
  //#endregion
583
390
  //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@bufbuild/protobuf/2.10.1/b0955b226816adda68977638196f96a6e65cec2605734621338f49f7ea29042e/node_modules/@bufbuild/protobuf/dist/esm/reflect/unsafe.js
584
- const IMPLICIT$3 = 2;
391
+ const IMPLICIT$2 = 2;
585
392
  const unsafeLocal = Symbol.for("reflect unsafe local");
586
393
  /**
587
394
  * Return the selected field of a oneof group.
@@ -601,7 +408,7 @@ function unsafeOneofCase(target, oneof) {
601
408
  function unsafeIsSet(target, field) {
602
409
  const name = field.localName;
603
410
  if (field.oneof) return target[field.oneof.localName].case === name;
604
- if (field.presence != IMPLICIT$3) return target[name] !== void 0 && Object.prototype.hasOwnProperty.call(target, name);
411
+ if (field.presence != IMPLICIT$2) return target[name] !== void 0 && Object.prototype.hasOwnProperty.call(target, name);
605
412
  switch (field.fieldKind) {
606
413
  case "list": return target[name].length > 0;
607
414
  case "map": return Object.keys(target[name]).length > 0;
@@ -654,7 +461,7 @@ function unsafeClear(target, field) {
654
461
  if (field.oneof) {
655
462
  const oneofLocalName = field.oneof.localName;
656
463
  if (target[oneofLocalName].case === name) target[oneofLocalName] = { case: void 0 };
657
- } else if (field.presence != IMPLICIT$3) delete target[name];
464
+ } else if (field.presence != IMPLICIT$2) delete target[name];
658
465
  else switch (field.fieldKind) {
659
466
  case "map":
660
467
  target[name] = {};
@@ -727,7 +534,7 @@ function isWrapperTypeName(name) {
727
534
  //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@bufbuild/protobuf/2.10.1/b0955b226816adda68977638196f96a6e65cec2605734621338f49f7ea29042e/node_modules/@bufbuild/protobuf/dist/esm/create.js
728
535
  const EDITION_PROTO3$1 = 999;
729
536
  const EDITION_PROTO2$1 = 998;
730
- const IMPLICIT$2 = 2;
537
+ const IMPLICIT$1 = 2;
731
538
  /**
732
539
  * Create a new message instance.
733
540
  *
@@ -815,7 +622,7 @@ function createZeroMessage(desc) {
815
622
  let msg;
816
623
  if (!needsPrototypeChain(desc)) {
817
624
  msg = { $typeName: desc.typeName };
818
- for (const member of desc.members) if (member.kind == "oneof" || member.presence == IMPLICIT$2) msg[member.localName] = createZeroField(member);
625
+ for (const member of desc.members) if (member.kind == "oneof" || member.presence == IMPLICIT$1) msg[member.localName] = createZeroField(member);
819
626
  } else {
820
627
  const cached = messagePrototypes.get(desc);
821
628
  let prototype;
@@ -827,7 +634,7 @@ function createZeroMessage(desc) {
827
634
  for (const member of desc.members) {
828
635
  if (member.kind == "oneof") continue;
829
636
  if (member.fieldKind != "scalar" && member.fieldKind != "enum") continue;
830
- if (member.presence == IMPLICIT$2) continue;
637
+ if (member.presence == IMPLICIT$1) continue;
831
638
  members.add(member);
832
639
  prototype[member.localName] = createZeroField(member);
833
640
  }
@@ -843,7 +650,7 @@ function createZeroMessage(desc) {
843
650
  if (member.kind == "field") {
844
651
  if (member.fieldKind == "message") continue;
845
652
  if (member.fieldKind == "scalar" || member.fieldKind == "enum") {
846
- if (member.presence != IMPLICIT$2) continue;
653
+ if (member.presence != IMPLICIT$1) continue;
847
654
  }
848
655
  }
849
656
  msg[member.localName] = createZeroField(member);
@@ -858,7 +665,7 @@ function needsPrototypeChain(desc) {
858
665
  switch (desc.file.edition) {
859
666
  case EDITION_PROTO3$1: return false;
860
667
  case EDITION_PROTO2$1: return true;
861
- default: return desc.fields.some((f) => f.presence != IMPLICIT$2 && f.fieldKind != "message" && !f.oneof);
668
+ default: return desc.fields.some((f) => f.presence != IMPLICIT$1 && f.fieldKind != "message" && !f.oneof);
862
669
  }
863
670
  }
864
671
  /**
@@ -2309,8 +2116,8 @@ const LABEL_REQUIRED = 2;
2309
2116
  const JS_STRING = 1;
2310
2117
  const IDEMPOTENCY_UNKNOWN = 0;
2311
2118
  const EXPLICIT = 1;
2312
- const IMPLICIT$1 = 2;
2313
- const LEGACY_REQUIRED$2 = 3;
2119
+ const IMPLICIT = 2;
2120
+ const LEGACY_REQUIRED = 3;
2314
2121
  const PACKED = 1;
2315
2122
  const DELIMITED = 2;
2316
2123
  const OPEN = 1;
@@ -2800,15 +2607,15 @@ function findOneof(proto, allOneofs) {
2800
2607
  * See https://protobuf.dev/programming-guides/field_presence/
2801
2608
  */
2802
2609
  function getFieldPresence(proto, oneof, isExtension, parent) {
2803
- if (proto.label == LABEL_REQUIRED) return LEGACY_REQUIRED$2;
2804
- if (proto.label == LABEL_REPEATED) return IMPLICIT$1;
2610
+ if (proto.label == LABEL_REQUIRED) return LEGACY_REQUIRED;
2611
+ if (proto.label == LABEL_REPEATED) return IMPLICIT;
2805
2612
  if (!!oneof || proto.proto3Optional) return EXPLICIT;
2806
2613
  if (isExtension) return EXPLICIT;
2807
2614
  const resolved = resolveFeature("fieldPresence", {
2808
2615
  proto,
2809
2616
  parent
2810
2617
  });
2811
- if (resolved == IMPLICIT$1 && (proto.type == TYPE_MESSAGE || proto.type == TYPE_GROUP)) return EXPLICIT;
2618
+ if (resolved == IMPLICIT && (proto.type == TYPE_MESSAGE || proto.type == TYPE_GROUP)) return EXPLICIT;
2812
2619
  return resolved;
2813
2620
  }
2814
2621
  /**
@@ -5555,7 +5362,7 @@ var SymbolVisibility;
5555
5362
  //#endregion
5556
5363
  //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@bufbuild/protobuf/2.10.1/b0955b226816adda68977638196f96a6e65cec2605734621338f49f7ea29042e/node_modules/@bufbuild/protobuf/dist/esm/from-binary.js
5557
5364
  const readDefaults = { readUnknownFields: true };
5558
- function makeReadOptions$1(options) {
5365
+ function makeReadOptions(options) {
5559
5366
  return options ? Object.assign(Object.assign({}, readDefaults), options) : readDefaults;
5560
5367
  }
5561
5368
  /**
@@ -5563,7 +5370,7 @@ function makeReadOptions$1(options) {
5563
5370
  */
5564
5371
  function fromBinary(schema, bytes, options) {
5565
5372
  const msg = reflect(schema, void 0, false);
5566
- readMessage$1(msg, new BinaryReader(bytes), makeReadOptions$1(options), false, bytes.byteLength);
5373
+ readMessage(msg, new BinaryReader(bytes), makeReadOptions(options), false, bytes.byteLength);
5567
5374
  return msg.message;
5568
5375
  }
5569
5376
  /**
@@ -5574,7 +5381,7 @@ function fromBinary(schema, bytes, options) {
5574
5381
  *
5575
5382
  * @private
5576
5383
  */
5577
- function readMessage$1(message, reader, options, delimited, lengthOrDelimitedFieldNo) {
5384
+ function readMessage(message, reader, options, delimited, lengthOrDelimitedFieldNo) {
5578
5385
  var _a;
5579
5386
  const end = delimited ? reader.len : reader.pos + lengthOrDelimitedFieldNo;
5580
5387
  let fieldNo;
@@ -5593,7 +5400,7 @@ function readMessage$1(message, reader, options, delimited, lengthOrDelimitedFie
5593
5400
  });
5594
5401
  continue;
5595
5402
  }
5596
- readField$1(message, reader, field, wireType, options);
5403
+ readField(message, reader, field, wireType, options);
5597
5404
  }
5598
5405
  if (delimited) {
5599
5406
  if (wireType != WireType.EndGroup || fieldNo !== lengthOrDelimitedFieldNo) throw new Error("invalid end group tag");
@@ -5603,7 +5410,7 @@ function readMessage$1(message, reader, options, delimited, lengthOrDelimitedFie
5603
5410
  /**
5604
5411
  * @private
5605
5412
  */
5606
- function readField$1(message, reader, field, wireType, options) {
5413
+ function readField(message, reader, field, wireType, options) {
5607
5414
  var _a;
5608
5415
  switch (field.fieldKind) {
5609
5416
  case "scalar":
@@ -5626,10 +5433,10 @@ function readField$1(message, reader, field, wireType, options) {
5626
5433
  }
5627
5434
  break;
5628
5435
  case "message":
5629
- message.set(field, readMessageField$1(reader, options, field, message.get(field)));
5436
+ message.set(field, readMessageField(reader, options, field, message.get(field)));
5630
5437
  break;
5631
5438
  case "list":
5632
- readListField$1(reader, wireType, message.get(field), options);
5439
+ readListField(reader, wireType, message.get(field), options);
5633
5440
  break;
5634
5441
  case "map":
5635
5442
  readMapEntry(reader, message.get(field), options);
@@ -5657,7 +5464,7 @@ function readMapEntry(reader, map, options) {
5657
5464
  val = reader.int32();
5658
5465
  break;
5659
5466
  case "message":
5660
- val = readMessageField$1(reader, options, field);
5467
+ val = readMessageField(reader, options, field);
5661
5468
  break;
5662
5469
  }
5663
5470
  break;
@@ -5677,11 +5484,11 @@ function readMapEntry(reader, map, options) {
5677
5484
  }
5678
5485
  map.set(key, val);
5679
5486
  }
5680
- function readListField$1(reader, wireType, list, options) {
5487
+ function readListField(reader, wireType, list, options) {
5681
5488
  var _a;
5682
5489
  const field = list.field();
5683
5490
  if (field.listKind === "message") {
5684
- list.add(readMessageField$1(reader, options, field));
5491
+ list.add(readMessageField(reader, options, field));
5685
5492
  return;
5686
5493
  }
5687
5494
  const scalarType = (_a = field.scalar) !== null && _a !== void 0 ? _a : ScalarType.INT32;
@@ -5692,10 +5499,10 @@ function readListField$1(reader, wireType, list, options) {
5692
5499
  const e = reader.uint32() + reader.pos;
5693
5500
  while (reader.pos < e) list.add(readScalar(reader, scalarType));
5694
5501
  }
5695
- function readMessageField$1(reader, options, field, mergeMessage) {
5502
+ function readMessageField(reader, options, field, mergeMessage) {
5696
5503
  const delimited = field.delimitedEncoding;
5697
5504
  const message = mergeMessage !== null && mergeMessage !== void 0 ? mergeMessage : reflect(field.message, void 0, false);
5698
- readMessage$1(message, reader, options, delimited, delimited ? field.number : reader.uint32());
5505
+ readMessage(message, reader, options, delimited, delimited ? field.number : reader.uint32());
5699
5506
  return message;
5700
5507
  }
5701
5508
  function readScalar(reader, type) {
@@ -5731,190 +5538,6 @@ function fileDesc(b64, imports) {
5731
5538
  root.dependency = (_a = imports === null || imports === void 0 ? void 0 : imports.map((f) => f.proto.name)) !== null && _a !== void 0 ? _a : [];
5732
5539
  return createFileRegistry(root, (protoFileName) => imports === null || imports === void 0 ? void 0 : imports.find((f) => f.proto.name === protoFileName)).getFile(root.name);
5733
5540
  }
5734
- /**
5735
- * Describes the message google.protobuf.Any.
5736
- * Use `create(AnySchema)` to create a new message.
5737
- */
5738
- const AnySchema = /*@__PURE__*/ messageDesc(/* @__PURE__ */ fileDesc("Chlnb29nbGUvcHJvdG9idWYvYW55LnByb3RvEg9nb29nbGUucHJvdG9idWYiJgoDQW55EhAKCHR5cGVfdXJsGAEgASgJEg0KBXZhbHVlGAIgASgMQnYKE2NvbS5nb29nbGUucHJvdG9idWZCCEFueVByb3RvUAFaLGdvb2dsZS5nb2xhbmcub3JnL3Byb3RvYnVmL3R5cGVzL2tub3duL2FueXBiogIDR1BCqgIeR29vZ2xlLlByb3RvYnVmLldlbGxLbm93blR5cGVzYgZwcm90bzM"), 0);
5739
- //#endregion
5740
- //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@bufbuild/protobuf/2.10.1/b0955b226816adda68977638196f96a6e65cec2605734621338f49f7ea29042e/node_modules/@bufbuild/protobuf/dist/esm/to-binary.js
5741
- const LEGACY_REQUIRED$1 = 3;
5742
- const writeDefaults = { writeUnknownFields: true };
5743
- function makeWriteOptions$1(options) {
5744
- return options ? Object.assign(Object.assign({}, writeDefaults), options) : writeDefaults;
5745
- }
5746
- function toBinary(schema, message, options) {
5747
- return writeFields(new BinaryWriter(), makeWriteOptions$1(options), reflect(schema, message)).finish();
5748
- }
5749
- function writeFields(writer, opts, msg) {
5750
- var _a;
5751
- for (const f of msg.sortedFields) {
5752
- if (!msg.isSet(f)) {
5753
- if (f.presence == LEGACY_REQUIRED$1) throw new Error(`cannot encode ${f} to binary: required field not set`);
5754
- continue;
5755
- }
5756
- writeField(writer, opts, msg, f);
5757
- }
5758
- if (opts.writeUnknownFields) for (const { no, wireType, data } of (_a = msg.getUnknown()) !== null && _a !== void 0 ? _a : []) writer.tag(no, wireType).raw(data);
5759
- return writer;
5760
- }
5761
- /**
5762
- * @private
5763
- */
5764
- function writeField(writer, opts, msg, field) {
5765
- var _a;
5766
- switch (field.fieldKind) {
5767
- case "scalar":
5768
- case "enum":
5769
- writeScalar(writer, msg.desc.typeName, field.name, (_a = field.scalar) !== null && _a !== void 0 ? _a : ScalarType.INT32, field.number, msg.get(field));
5770
- break;
5771
- case "list":
5772
- writeListField(writer, opts, field, msg.get(field));
5773
- break;
5774
- case "message":
5775
- writeMessageField(writer, opts, field, msg.get(field));
5776
- break;
5777
- case "map":
5778
- for (const [key, val] of msg.get(field)) writeMapEntry(writer, opts, field, key, val);
5779
- break;
5780
- }
5781
- }
5782
- function writeScalar(writer, msgName, fieldName, scalarType, fieldNo, value) {
5783
- writeScalarValue(writer.tag(fieldNo, writeTypeOfScalar(scalarType)), msgName, fieldName, scalarType, value);
5784
- }
5785
- function writeMessageField(writer, opts, field, message) {
5786
- if (field.delimitedEncoding) writeFields(writer.tag(field.number, WireType.StartGroup), opts, message).tag(field.number, WireType.EndGroup);
5787
- else writeFields(writer.tag(field.number, WireType.LengthDelimited).fork(), opts, message).join();
5788
- }
5789
- function writeListField(writer, opts, field, list) {
5790
- var _a;
5791
- if (field.listKind == "message") {
5792
- for (const item of list) writeMessageField(writer, opts, field, item);
5793
- return;
5794
- }
5795
- const scalarType = (_a = field.scalar) !== null && _a !== void 0 ? _a : ScalarType.INT32;
5796
- if (field.packed) {
5797
- if (!list.size) return;
5798
- writer.tag(field.number, WireType.LengthDelimited).fork();
5799
- for (const item of list) writeScalarValue(writer, field.parent.typeName, field.name, scalarType, item);
5800
- writer.join();
5801
- return;
5802
- }
5803
- for (const item of list) writeScalar(writer, field.parent.typeName, field.name, scalarType, field.number, item);
5804
- }
5805
- function writeMapEntry(writer, opts, field, key, value) {
5806
- var _a;
5807
- writer.tag(field.number, WireType.LengthDelimited).fork();
5808
- writeScalar(writer, field.parent.typeName, field.name, field.mapKey, 1, key);
5809
- switch (field.mapKind) {
5810
- case "scalar":
5811
- case "enum":
5812
- writeScalar(writer, field.parent.typeName, field.name, (_a = field.scalar) !== null && _a !== void 0 ? _a : ScalarType.INT32, 2, value);
5813
- break;
5814
- case "message":
5815
- writeFields(writer.tag(2, WireType.LengthDelimited).fork(), opts, value).join();
5816
- break;
5817
- }
5818
- writer.join();
5819
- }
5820
- function writeScalarValue(writer, msgName, fieldName, type, value) {
5821
- try {
5822
- switch (type) {
5823
- case ScalarType.STRING:
5824
- writer.string(value);
5825
- break;
5826
- case ScalarType.BOOL:
5827
- writer.bool(value);
5828
- break;
5829
- case ScalarType.DOUBLE:
5830
- writer.double(value);
5831
- break;
5832
- case ScalarType.FLOAT:
5833
- writer.float(value);
5834
- break;
5835
- case ScalarType.INT32:
5836
- writer.int32(value);
5837
- break;
5838
- case ScalarType.INT64:
5839
- writer.int64(value);
5840
- break;
5841
- case ScalarType.UINT64:
5842
- writer.uint64(value);
5843
- break;
5844
- case ScalarType.FIXED64:
5845
- writer.fixed64(value);
5846
- break;
5847
- case ScalarType.BYTES:
5848
- writer.bytes(value);
5849
- break;
5850
- case ScalarType.FIXED32:
5851
- writer.fixed32(value);
5852
- break;
5853
- case ScalarType.SFIXED32:
5854
- writer.sfixed32(value);
5855
- break;
5856
- case ScalarType.SFIXED64:
5857
- writer.sfixed64(value);
5858
- break;
5859
- case ScalarType.SINT64:
5860
- writer.sint64(value);
5861
- break;
5862
- case ScalarType.UINT32:
5863
- writer.uint32(value);
5864
- break;
5865
- case ScalarType.SINT32:
5866
- writer.sint32(value);
5867
- break;
5868
- }
5869
- } catch (e) {
5870
- if (e instanceof Error) throw new Error(`cannot encode field ${msgName}.${fieldName} to binary: ${e.message}`);
5871
- throw e;
5872
- }
5873
- }
5874
- function writeTypeOfScalar(type) {
5875
- switch (type) {
5876
- case ScalarType.BYTES:
5877
- case ScalarType.STRING: return WireType.LengthDelimited;
5878
- case ScalarType.DOUBLE:
5879
- case ScalarType.FIXED64:
5880
- case ScalarType.SFIXED64: return WireType.Bit64;
5881
- case ScalarType.FIXED32:
5882
- case ScalarType.SFIXED32:
5883
- case ScalarType.FLOAT: return WireType.Bit32;
5884
- default: return WireType.Varint;
5885
- }
5886
- }
5887
- //#endregion
5888
- //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@bufbuild/protobuf/2.10.1/b0955b226816adda68977638196f96a6e65cec2605734621338f49f7ea29042e/node_modules/@bufbuild/protobuf/dist/esm/wkt/any.js
5889
- function anyPack(schema, message, into) {
5890
- let ret = false;
5891
- if (!into) {
5892
- into = create(AnySchema);
5893
- ret = true;
5894
- }
5895
- into.value = toBinary(schema, message);
5896
- into.typeUrl = typeNameToUrl(message.$typeName);
5897
- return ret ? into : void 0;
5898
- }
5899
- function anyIs(any, descOrTypeName) {
5900
- if (any.typeUrl === "") return false;
5901
- return (typeof descOrTypeName == "string" ? descOrTypeName : descOrTypeName.typeName) === typeUrlToName(any.typeUrl);
5902
- }
5903
- function anyUnpack(any, registryOrMessageDesc) {
5904
- if (any.typeUrl === "") return;
5905
- const desc = registryOrMessageDesc.kind == "message" ? registryOrMessageDesc : registryOrMessageDesc.getMessage(typeUrlToName(any.typeUrl));
5906
- if (!desc || !anyIs(any, desc)) return;
5907
- return fromBinary(desc, any.value);
5908
- }
5909
- function typeNameToUrl(name) {
5910
- return `type.googleapis.com/${name}`;
5911
- }
5912
- function typeUrlToName(url) {
5913
- const slash = url.lastIndexOf("/");
5914
- const name = slash >= 0 ? url.substring(slash + 1) : url;
5915
- if (!name.length) throw new Error(`invalid type url: ${url}`);
5916
- return name;
5917
- }
5918
5541
  //#endregion
5919
5542
  //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@bufbuild/protobuf/2.10.1/b0955b226816adda68977638196f96a6e65cec2605734621338f49f7ea29042e/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/struct_pb.js
5920
5543
  /**
@@ -5954,698 +5577,6 @@ var NullValue;
5954
5577
  NullValue[NullValue["NULL_VALUE"] = 0] = "NULL_VALUE";
5955
5578
  })(NullValue || (NullValue = {}));
5956
5579
  //#endregion
5957
- //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@bufbuild/protobuf/2.10.1/b0955b226816adda68977638196f96a6e65cec2605734621338f49f7ea29042e/node_modules/@bufbuild/protobuf/dist/esm/extensions.js
5958
- /**
5959
- * Retrieve an extension value from a message.
5960
- *
5961
- * The function never returns undefined. Use hasExtension() to check whether an
5962
- * extension is set. If the extension is not set, this function returns the
5963
- * default value (if one was specified in the protobuf source), or the zero value
5964
- * (for example `0` for numeric types, `[]` for repeated extension fields, and
5965
- * an empty message instance for message fields).
5966
- *
5967
- * Extensions are stored as unknown fields on a message. To mutate an extension
5968
- * value, make sure to store the new value with setExtension() after mutating.
5969
- *
5970
- * If the extension does not extend the given message, an error is raised.
5971
- */
5972
- function getExtension(message, extension) {
5973
- assertExtendee(extension, message);
5974
- const ufs = filterUnknownFields(message.$unknown, extension);
5975
- const [container, field, get] = createExtensionContainer(extension);
5976
- for (const uf of ufs) readField$1(container, new BinaryReader(uf.data), field, uf.wireType, { readUnknownFields: true });
5977
- return get();
5978
- }
5979
- /**
5980
- * Set an extension value on a message. If the message already has a value for
5981
- * this extension, the value is replaced.
5982
- *
5983
- * If the extension does not extend the given message, an error is raised.
5984
- */
5985
- function setExtension(message, extension, value) {
5986
- var _a;
5987
- assertExtendee(extension, message);
5988
- const ufs = ((_a = message.$unknown) !== null && _a !== void 0 ? _a : []).filter((uf) => uf.no !== extension.number);
5989
- const [container, field] = createExtensionContainer(extension, value);
5990
- const writer = new BinaryWriter();
5991
- writeField(writer, { writeUnknownFields: true }, container, field);
5992
- const reader = new BinaryReader(writer.finish());
5993
- while (reader.pos < reader.len) {
5994
- const [no, wireType] = reader.tag();
5995
- const data = reader.skip(wireType, no);
5996
- ufs.push({
5997
- no,
5998
- wireType,
5999
- data
6000
- });
6001
- }
6002
- message.$unknown = ufs;
6003
- }
6004
- function filterUnknownFields(unknownFields, extension) {
6005
- if (unknownFields === void 0) return [];
6006
- if (extension.fieldKind === "enum" || extension.fieldKind === "scalar") {
6007
- for (let i = unknownFields.length - 1; i >= 0; --i) if (unknownFields[i].no == extension.number) return [unknownFields[i]];
6008
- return [];
6009
- }
6010
- return unknownFields.filter((uf) => uf.no === extension.number);
6011
- }
6012
- /**
6013
- * @private
6014
- */
6015
- function createExtensionContainer(extension, value) {
6016
- const localName = extension.typeName;
6017
- const field = Object.assign(Object.assign({}, extension), {
6018
- kind: "field",
6019
- parent: extension.extendee,
6020
- localName
6021
- });
6022
- const desc = Object.assign(Object.assign({}, extension.extendee), {
6023
- fields: [field],
6024
- members: [field],
6025
- oneofs: []
6026
- });
6027
- const container = create(desc, value !== void 0 ? { [localName]: value } : void 0);
6028
- return [
6029
- reflect(desc, container),
6030
- field,
6031
- () => {
6032
- const value = container[localName];
6033
- if (value === void 0) {
6034
- const desc = extension.message;
6035
- if (isWrapperDesc(desc)) return scalarZeroValue(desc.fields[0].scalar, desc.fields[0].longAsString);
6036
- return create(desc);
6037
- }
6038
- return value;
6039
- }
6040
- ];
6041
- }
6042
- function assertExtendee(extension, message) {
6043
- if (extension.extendee.typeName != message.$typeName) throw new Error(`extension ${extension.typeName} can only be applied to message ${extension.extendee.typeName}`);
6044
- }
6045
- //#endregion
6046
- //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@bufbuild/protobuf/2.10.1/b0955b226816adda68977638196f96a6e65cec2605734621338f49f7ea29042e/node_modules/@bufbuild/protobuf/dist/esm/to-json.js
6047
- const LEGACY_REQUIRED = 3;
6048
- const IMPLICIT = 2;
6049
- const jsonWriteDefaults = {
6050
- alwaysEmitImplicit: false,
6051
- enumAsInteger: false,
6052
- useProtoFieldName: false
6053
- };
6054
- function makeWriteOptions(options) {
6055
- return options ? Object.assign(Object.assign({}, jsonWriteDefaults), options) : jsonWriteDefaults;
6056
- }
6057
- /**
6058
- * Serialize the message to a JSON value, a JavaScript value that can be
6059
- * passed to JSON.stringify().
6060
- */
6061
- function toJson$1(schema, message, options) {
6062
- return reflectToJson(reflect(schema, message), makeWriteOptions(options));
6063
- }
6064
- function reflectToJson(msg, opts) {
6065
- var _a;
6066
- const wktJson = tryWktToJson(msg, opts);
6067
- if (wktJson !== void 0) return wktJson;
6068
- const json = {};
6069
- for (const f of msg.sortedFields) {
6070
- if (!msg.isSet(f)) {
6071
- if (f.presence == LEGACY_REQUIRED) throw new Error(`cannot encode ${f} to JSON: required field not set`);
6072
- if (!opts.alwaysEmitImplicit || f.presence !== IMPLICIT) continue;
6073
- }
6074
- const jsonValue = fieldToJson(f, msg.get(f), opts);
6075
- if (jsonValue !== void 0) json[jsonName(f, opts)] = jsonValue;
6076
- }
6077
- if (opts.registry) {
6078
- const tagSeen = /* @__PURE__ */ new Set();
6079
- for (const { no } of (_a = msg.getUnknown()) !== null && _a !== void 0 ? _a : []) if (!tagSeen.has(no)) {
6080
- tagSeen.add(no);
6081
- const extension = opts.registry.getExtensionFor(msg.desc, no);
6082
- if (!extension) continue;
6083
- const [container, field] = createExtensionContainer(extension, getExtension(msg.message, extension));
6084
- const jsonValue = fieldToJson(field, container.get(field), opts);
6085
- if (jsonValue !== void 0) json[extension.jsonName] = jsonValue;
6086
- }
6087
- }
6088
- return json;
6089
- }
6090
- function fieldToJson(f, val, opts) {
6091
- switch (f.fieldKind) {
6092
- case "scalar": return scalarToJson(f, val);
6093
- case "message": return reflectToJson(val, opts);
6094
- case "enum": return enumToJsonInternal(f.enum, val, opts.enumAsInteger);
6095
- case "list": return listToJson(val, opts);
6096
- case "map": return mapToJson(val, opts);
6097
- }
6098
- }
6099
- function mapToJson(map, opts) {
6100
- const f = map.field();
6101
- const jsonObj = {};
6102
- switch (f.mapKind) {
6103
- case "scalar":
6104
- for (const [entryKey, entryValue] of map) jsonObj[entryKey] = scalarToJson(f, entryValue);
6105
- break;
6106
- case "message":
6107
- for (const [entryKey, entryValue] of map) jsonObj[entryKey] = reflectToJson(entryValue, opts);
6108
- break;
6109
- case "enum":
6110
- for (const [entryKey, entryValue] of map) jsonObj[entryKey] = enumToJsonInternal(f.enum, entryValue, opts.enumAsInteger);
6111
- break;
6112
- }
6113
- return opts.alwaysEmitImplicit || map.size > 0 ? jsonObj : void 0;
6114
- }
6115
- function listToJson(list, opts) {
6116
- const f = list.field();
6117
- const jsonArr = [];
6118
- switch (f.listKind) {
6119
- case "scalar":
6120
- for (const item of list) jsonArr.push(scalarToJson(f, item));
6121
- break;
6122
- case "enum":
6123
- for (const item of list) jsonArr.push(enumToJsonInternal(f.enum, item, opts.enumAsInteger));
6124
- break;
6125
- case "message":
6126
- for (const item of list) jsonArr.push(reflectToJson(item, opts));
6127
- break;
6128
- }
6129
- return opts.alwaysEmitImplicit || jsonArr.length > 0 ? jsonArr : void 0;
6130
- }
6131
- function enumToJsonInternal(desc, value, enumAsInteger) {
6132
- var _a;
6133
- if (typeof value != "number") throw new Error(`cannot encode ${desc} to JSON: expected number, got ${formatVal(value)}`);
6134
- if (desc.typeName == "google.protobuf.NullValue") return null;
6135
- if (enumAsInteger) return value;
6136
- const val = desc.value[value];
6137
- return (_a = val === null || val === void 0 ? void 0 : val.name) !== null && _a !== void 0 ? _a : value;
6138
- }
6139
- function scalarToJson(field, value) {
6140
- var _a, _b, _c, _d, _e, _f;
6141
- switch (field.scalar) {
6142
- case ScalarType.INT32:
6143
- case ScalarType.SFIXED32:
6144
- case ScalarType.SINT32:
6145
- case ScalarType.FIXED32:
6146
- case ScalarType.UINT32:
6147
- if (typeof value != "number") throw new Error(`cannot encode ${field} to JSON: ${(_a = checkField(field, value)) === null || _a === void 0 ? void 0 : _a.message}`);
6148
- return value;
6149
- case ScalarType.FLOAT:
6150
- case ScalarType.DOUBLE:
6151
- if (typeof value != "number") throw new Error(`cannot encode ${field} to JSON: ${(_b = checkField(field, value)) === null || _b === void 0 ? void 0 : _b.message}`);
6152
- if (Number.isNaN(value)) return "NaN";
6153
- if (value === Number.POSITIVE_INFINITY) return "Infinity";
6154
- if (value === Number.NEGATIVE_INFINITY) return "-Infinity";
6155
- return value;
6156
- case ScalarType.STRING:
6157
- if (typeof value != "string") throw new Error(`cannot encode ${field} to JSON: ${(_c = checkField(field, value)) === null || _c === void 0 ? void 0 : _c.message}`);
6158
- return value;
6159
- case ScalarType.BOOL:
6160
- if (typeof value != "boolean") throw new Error(`cannot encode ${field} to JSON: ${(_d = checkField(field, value)) === null || _d === void 0 ? void 0 : _d.message}`);
6161
- return value;
6162
- case ScalarType.UINT64:
6163
- case ScalarType.FIXED64:
6164
- case ScalarType.INT64:
6165
- case ScalarType.SFIXED64:
6166
- case ScalarType.SINT64:
6167
- if (typeof value != "bigint" && typeof value != "string") throw new Error(`cannot encode ${field} to JSON: ${(_e = checkField(field, value)) === null || _e === void 0 ? void 0 : _e.message}`);
6168
- return value.toString();
6169
- case ScalarType.BYTES:
6170
- if (value instanceof Uint8Array) return base64Encode(value);
6171
- throw new Error(`cannot encode ${field} to JSON: ${(_f = checkField(field, value)) === null || _f === void 0 ? void 0 : _f.message}`);
6172
- }
6173
- }
6174
- function jsonName(f, opts) {
6175
- return opts.useProtoFieldName ? f.name : f.jsonName;
6176
- }
6177
- function tryWktToJson(msg, opts) {
6178
- if (!msg.desc.typeName.startsWith("google.protobuf.")) return;
6179
- switch (msg.desc.typeName) {
6180
- case "google.protobuf.Any": return anyToJson(msg.message, opts);
6181
- case "google.protobuf.Timestamp": return timestampToJson(msg.message);
6182
- case "google.protobuf.Duration": return durationToJson(msg.message);
6183
- case "google.protobuf.FieldMask": return fieldMaskToJson(msg.message);
6184
- case "google.protobuf.Struct": return structToJson(msg.message);
6185
- case "google.protobuf.Value": return valueToJson(msg.message);
6186
- case "google.protobuf.ListValue": return listValueToJson(msg.message);
6187
- default:
6188
- if (isWrapperDesc(msg.desc)) {
6189
- const valueField = msg.desc.fields[0];
6190
- return scalarToJson(valueField, msg.get(valueField));
6191
- }
6192
- return;
6193
- }
6194
- }
6195
- function anyToJson(val, opts) {
6196
- if (val.typeUrl === "") return {};
6197
- const { registry } = opts;
6198
- let message;
6199
- let desc;
6200
- if (registry) {
6201
- message = anyUnpack(val, registry);
6202
- if (message) desc = registry.getMessage(message.$typeName);
6203
- }
6204
- if (!desc || !message) throw new Error(`cannot encode message ${val.$typeName} to JSON: "${val.typeUrl}" is not in the type registry`);
6205
- let json = reflectToJson(reflect(desc, message), opts);
6206
- if (desc.typeName.startsWith("google.protobuf.") || json === null || Array.isArray(json) || typeof json !== "object") json = { value: json };
6207
- json["@type"] = val.typeUrl;
6208
- return json;
6209
- }
6210
- function durationToJson(val) {
6211
- const seconds = Number(val.seconds);
6212
- const nanos = val.nanos;
6213
- if (seconds > 315576e6 || seconds < -315576e6) throw new Error(`cannot encode message ${val.$typeName} to JSON: value out of range`);
6214
- if (seconds > 0 && nanos < 0 || seconds < 0 && nanos > 0) throw new Error(`cannot encode message ${val.$typeName} to JSON: nanos sign must match seconds sign`);
6215
- let text = val.seconds.toString();
6216
- if (nanos !== 0) {
6217
- let nanosStr = Math.abs(nanos).toString();
6218
- nanosStr = "0".repeat(9 - nanosStr.length) + nanosStr;
6219
- if (nanosStr.substring(3) === "000000") nanosStr = nanosStr.substring(0, 3);
6220
- else if (nanosStr.substring(6) === "000") nanosStr = nanosStr.substring(0, 6);
6221
- text += "." + nanosStr;
6222
- if (nanos < 0 && seconds == 0) text = "-" + text;
6223
- }
6224
- return text + "s";
6225
- }
6226
- function fieldMaskToJson(val) {
6227
- return val.paths.map((p) => {
6228
- if (p.match(/_[0-9]?_/g) || p.match(/[A-Z]/g)) throw new Error(`cannot encode message ${val.$typeName} to JSON: lowerCamelCase of path name "` + p + "\" is irreversible");
6229
- return protoCamelCase(p);
6230
- }).join(",");
6231
- }
6232
- function structToJson(val) {
6233
- const json = {};
6234
- for (const [k, v] of Object.entries(val.fields)) json[k] = valueToJson(v);
6235
- return json;
6236
- }
6237
- function valueToJson(val) {
6238
- switch (val.kind.case) {
6239
- case "nullValue": return null;
6240
- case "numberValue":
6241
- if (!Number.isFinite(val.kind.value)) throw new Error(`${val.$typeName} cannot be NaN or Infinity`);
6242
- return val.kind.value;
6243
- case "boolValue": return val.kind.value;
6244
- case "stringValue": return val.kind.value;
6245
- case "structValue": return structToJson(val.kind.value);
6246
- case "listValue": return listValueToJson(val.kind.value);
6247
- default: throw new Error(`${val.$typeName} must have a value`);
6248
- }
6249
- }
6250
- function listValueToJson(val) {
6251
- return val.values.map(valueToJson);
6252
- }
6253
- function timestampToJson(val) {
6254
- const ms = Number(val.seconds) * 1e3;
6255
- if (ms < Date.parse("0001-01-01T00:00:00Z") || ms > Date.parse("9999-12-31T23:59:59Z")) throw new Error(`cannot encode message ${val.$typeName} to JSON: must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive`);
6256
- if (val.nanos < 0) throw new Error(`cannot encode message ${val.$typeName} to JSON: nanos must not be negative`);
6257
- if (val.nanos > 999999999) throw new Error(`cannot encode message ${val.$typeName} to JSON: nanos must not be greater than 99999999`);
6258
- let z = "Z";
6259
- if (val.nanos > 0) {
6260
- const nanosStr = (val.nanos + 1e9).toString().substring(1);
6261
- if (nanosStr.substring(3) === "000000") z = "." + nanosStr.substring(0, 3) + "Z";
6262
- else if (nanosStr.substring(6) === "000") z = "." + nanosStr.substring(0, 6) + "Z";
6263
- else z = "." + nanosStr + "Z";
6264
- }
6265
- return new Date(ms).toISOString().replace(".000Z", z);
6266
- }
6267
- //#endregion
6268
- //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@bufbuild/protobuf/2.10.1/b0955b226816adda68977638196f96a6e65cec2605734621338f49f7ea29042e/node_modules/@bufbuild/protobuf/dist/esm/from-json.js
6269
- const jsonReadDefaults = { ignoreUnknownFields: false };
6270
- function makeReadOptions(options) {
6271
- return options ? Object.assign(Object.assign({}, jsonReadDefaults), options) : jsonReadDefaults;
6272
- }
6273
- /**
6274
- * Parse a message from a JSON value.
6275
- */
6276
- function fromJson(schema, json, options) {
6277
- const msg = reflect(schema);
6278
- try {
6279
- readMessage(msg, json, makeReadOptions(options));
6280
- } catch (e) {
6281
- if (isFieldError(e)) throw new Error(`cannot decode ${e.field()} from JSON: ${e.message}`, { cause: e });
6282
- throw e;
6283
- }
6284
- return msg.message;
6285
- }
6286
- function readMessage(msg, json, opts) {
6287
- var _a;
6288
- if (tryWktFromJson(msg, json, opts)) return;
6289
- if (json == null || Array.isArray(json) || typeof json != "object") throw new Error(`cannot decode ${msg.desc} from JSON: ${formatVal(json)}`);
6290
- const oneofSeen = /* @__PURE__ */ new Map();
6291
- const jsonNames = /* @__PURE__ */ new Map();
6292
- for (const field of msg.desc.fields) jsonNames.set(field.name, field).set(field.jsonName, field);
6293
- for (const [jsonKey, jsonValue] of Object.entries(json)) {
6294
- const field = jsonNames.get(jsonKey);
6295
- if (field) {
6296
- if (field.oneof) {
6297
- if (jsonValue === null && field.fieldKind == "scalar") continue;
6298
- const seen = oneofSeen.get(field.oneof);
6299
- if (seen !== void 0) throw new FieldError(field.oneof, `oneof set multiple times by ${seen.name} and ${field.name}`);
6300
- oneofSeen.set(field.oneof, field);
6301
- }
6302
- readField(msg, field, jsonValue, opts);
6303
- } else {
6304
- let extension = void 0;
6305
- if (jsonKey.startsWith("[") && jsonKey.endsWith("]") && (extension = (_a = opts.registry) === null || _a === void 0 ? void 0 : _a.getExtension(jsonKey.substring(1, jsonKey.length - 1))) && extension.extendee.typeName === msg.desc.typeName) {
6306
- const [container, field, get] = createExtensionContainer(extension);
6307
- readField(container, field, jsonValue, opts);
6308
- setExtension(msg.message, extension, get());
6309
- }
6310
- if (!extension && !opts.ignoreUnknownFields) throw new Error(`cannot decode ${msg.desc} from JSON: key "${jsonKey}" is unknown`);
6311
- }
6312
- }
6313
- }
6314
- function readField(msg, field, json, opts) {
6315
- switch (field.fieldKind) {
6316
- case "scalar":
6317
- readScalarField(msg, field, json);
6318
- break;
6319
- case "enum":
6320
- readEnumField(msg, field, json, opts);
6321
- break;
6322
- case "message":
6323
- readMessageField(msg, field, json, opts);
6324
- break;
6325
- case "list":
6326
- readListField(msg.get(field), json, opts);
6327
- break;
6328
- case "map":
6329
- readMapField(msg.get(field), json, opts);
6330
- break;
6331
- }
6332
- }
6333
- function readMapField(map, json, opts) {
6334
- if (json === null) return;
6335
- const field = map.field();
6336
- if (typeof json != "object" || Array.isArray(json)) throw new FieldError(field, "expected object, got " + formatVal(json));
6337
- for (const [jsonMapKey, jsonMapValue] of Object.entries(json)) {
6338
- if (jsonMapValue === null) throw new FieldError(field, "map value must not be null");
6339
- let value;
6340
- switch (field.mapKind) {
6341
- case "message":
6342
- const msgValue = reflect(field.message);
6343
- readMessage(msgValue, jsonMapValue, opts);
6344
- value = msgValue;
6345
- break;
6346
- case "enum":
6347
- value = readEnum(field.enum, jsonMapValue, opts.ignoreUnknownFields, true);
6348
- if (value === tokenIgnoredUnknownEnum) return;
6349
- break;
6350
- case "scalar":
6351
- value = scalarFromJson(field, jsonMapValue, true);
6352
- break;
6353
- }
6354
- const key = mapKeyFromJson(field.mapKey, jsonMapKey);
6355
- map.set(key, value);
6356
- }
6357
- }
6358
- function readListField(list, json, opts) {
6359
- if (json === null) return;
6360
- const field = list.field();
6361
- if (!Array.isArray(json)) throw new FieldError(field, "expected Array, got " + formatVal(json));
6362
- for (const jsonItem of json) {
6363
- if (jsonItem === null) throw new FieldError(field, "list item must not be null");
6364
- switch (field.listKind) {
6365
- case "message":
6366
- const msgValue = reflect(field.message);
6367
- readMessage(msgValue, jsonItem, opts);
6368
- list.add(msgValue);
6369
- break;
6370
- case "enum":
6371
- const enumValue = readEnum(field.enum, jsonItem, opts.ignoreUnknownFields, true);
6372
- if (enumValue !== tokenIgnoredUnknownEnum) list.add(enumValue);
6373
- break;
6374
- case "scalar":
6375
- list.add(scalarFromJson(field, jsonItem, true));
6376
- break;
6377
- }
6378
- }
6379
- }
6380
- function readMessageField(msg, field, json, opts) {
6381
- if (json === null && field.message.typeName != "google.protobuf.Value") {
6382
- msg.clear(field);
6383
- return;
6384
- }
6385
- const msgValue = msg.isSet(field) ? msg.get(field) : reflect(field.message);
6386
- readMessage(msgValue, json, opts);
6387
- msg.set(field, msgValue);
6388
- }
6389
- function readEnumField(msg, field, json, opts) {
6390
- const enumValue = readEnum(field.enum, json, opts.ignoreUnknownFields, false);
6391
- if (enumValue === tokenNull) msg.clear(field);
6392
- else if (enumValue !== tokenIgnoredUnknownEnum) msg.set(field, enumValue);
6393
- }
6394
- function readScalarField(msg, field, json) {
6395
- const scalarValue = scalarFromJson(field, json, false);
6396
- if (scalarValue === tokenNull) msg.clear(field);
6397
- else msg.set(field, scalarValue);
6398
- }
6399
- const tokenIgnoredUnknownEnum = Symbol();
6400
- function readEnum(desc, json, ignoreUnknownFields, nullAsZeroValue) {
6401
- if (json === null) {
6402
- if (desc.typeName == "google.protobuf.NullValue") return 0;
6403
- return nullAsZeroValue ? desc.values[0].number : tokenNull;
6404
- }
6405
- switch (typeof json) {
6406
- case "number":
6407
- if (Number.isInteger(json)) return json;
6408
- break;
6409
- case "string":
6410
- const value = desc.values.find((ev) => ev.name === json);
6411
- if (value !== void 0) return value.number;
6412
- if (ignoreUnknownFields) return tokenIgnoredUnknownEnum;
6413
- break;
6414
- }
6415
- throw new Error(`cannot decode ${desc} from JSON: ${formatVal(json)}`);
6416
- }
6417
- const tokenNull = Symbol();
6418
- function scalarFromJson(field, json, nullAsZeroValue) {
6419
- if (json === null) {
6420
- if (nullAsZeroValue) return scalarZeroValue(field.scalar, false);
6421
- return tokenNull;
6422
- }
6423
- switch (field.scalar) {
6424
- case ScalarType.DOUBLE:
6425
- case ScalarType.FLOAT:
6426
- if (json === "NaN") return NaN;
6427
- if (json === "Infinity") return Number.POSITIVE_INFINITY;
6428
- if (json === "-Infinity") return Number.NEGATIVE_INFINITY;
6429
- if (typeof json == "number") {
6430
- if (Number.isNaN(json)) throw new FieldError(field, "unexpected NaN number");
6431
- if (!Number.isFinite(json)) throw new FieldError(field, "unexpected infinite number");
6432
- break;
6433
- }
6434
- if (typeof json == "string") {
6435
- if (json === "") break;
6436
- if (json.trim().length !== json.length) break;
6437
- const float = Number(json);
6438
- if (!Number.isFinite(float)) break;
6439
- return float;
6440
- }
6441
- break;
6442
- case ScalarType.INT32:
6443
- case ScalarType.FIXED32:
6444
- case ScalarType.SFIXED32:
6445
- case ScalarType.SINT32:
6446
- case ScalarType.UINT32: return int32FromJson(json);
6447
- case ScalarType.BYTES:
6448
- if (typeof json == "string") {
6449
- if (json === "") return /* @__PURE__ */ new Uint8Array(0);
6450
- try {
6451
- return base64Decode(json);
6452
- } catch (e) {
6453
- throw new FieldError(field, e instanceof Error ? e.message : String(e));
6454
- }
6455
- }
6456
- break;
6457
- }
6458
- return json;
6459
- }
6460
- /**
6461
- * Try to parse a JSON value to a map key for the reflect API.
6462
- *
6463
- * Returns the input if the JSON value cannot be converted.
6464
- */
6465
- function mapKeyFromJson(type, json) {
6466
- switch (type) {
6467
- case ScalarType.BOOL:
6468
- switch (json) {
6469
- case "true": return true;
6470
- case "false": return false;
6471
- }
6472
- return json;
6473
- case ScalarType.INT32:
6474
- case ScalarType.FIXED32:
6475
- case ScalarType.UINT32:
6476
- case ScalarType.SFIXED32:
6477
- case ScalarType.SINT32: return int32FromJson(json);
6478
- default: return json;
6479
- }
6480
- }
6481
- /**
6482
- * Try to parse a JSON value to a 32-bit integer for the reflect API.
6483
- *
6484
- * Returns the input if the JSON value cannot be converted.
6485
- */
6486
- function int32FromJson(json) {
6487
- if (typeof json == "string") {
6488
- if (json === "") return json;
6489
- if (json.trim().length !== json.length) return json;
6490
- const num = Number(json);
6491
- if (Number.isNaN(num)) return json;
6492
- return num;
6493
- }
6494
- return json;
6495
- }
6496
- function tryWktFromJson(msg, jsonValue, opts) {
6497
- if (!msg.desc.typeName.startsWith("google.protobuf.")) return false;
6498
- switch (msg.desc.typeName) {
6499
- case "google.protobuf.Any":
6500
- anyFromJson(msg.message, jsonValue, opts);
6501
- return true;
6502
- case "google.protobuf.Timestamp":
6503
- timestampFromJson(msg.message, jsonValue);
6504
- return true;
6505
- case "google.protobuf.Duration":
6506
- durationFromJson(msg.message, jsonValue);
6507
- return true;
6508
- case "google.protobuf.FieldMask":
6509
- fieldMaskFromJson(msg.message, jsonValue);
6510
- return true;
6511
- case "google.protobuf.Struct":
6512
- structFromJson(msg.message, jsonValue);
6513
- return true;
6514
- case "google.protobuf.Value":
6515
- valueFromJson(msg.message, jsonValue);
6516
- return true;
6517
- case "google.protobuf.ListValue":
6518
- listValueFromJson(msg.message, jsonValue);
6519
- return true;
6520
- default:
6521
- if (isWrapperDesc(msg.desc)) {
6522
- const valueField = msg.desc.fields[0];
6523
- if (jsonValue === null) msg.clear(valueField);
6524
- else msg.set(valueField, scalarFromJson(valueField, jsonValue, true));
6525
- return true;
6526
- }
6527
- return false;
6528
- }
6529
- }
6530
- function anyFromJson(any, json, opts) {
6531
- var _a;
6532
- if (json === null || Array.isArray(json) || typeof json != "object") throw new Error(`cannot decode message ${any.$typeName} from JSON: expected object but got ${formatVal(json)}`);
6533
- if (Object.keys(json).length == 0) return;
6534
- const typeUrl = json["@type"];
6535
- if (typeof typeUrl != "string" || typeUrl == "") throw new Error(`cannot decode message ${any.$typeName} from JSON: "@type" is empty`);
6536
- const typeName = typeUrl.includes("/") ? typeUrl.substring(typeUrl.lastIndexOf("/") + 1) : typeUrl;
6537
- if (!typeName.length) throw new Error(`cannot decode message ${any.$typeName} from JSON: "@type" is invalid`);
6538
- const desc = (_a = opts.registry) === null || _a === void 0 ? void 0 : _a.getMessage(typeName);
6539
- if (!desc) throw new Error(`cannot decode message ${any.$typeName} from JSON: ${typeUrl} is not in the type registry`);
6540
- const msg = reflect(desc);
6541
- if (typeName.startsWith("google.protobuf.") && Object.prototype.hasOwnProperty.call(json, "value")) {
6542
- const value = json.value;
6543
- readMessage(msg, value, opts);
6544
- } else {
6545
- const copy = Object.assign({}, json);
6546
- delete copy["@type"];
6547
- readMessage(msg, copy, opts);
6548
- }
6549
- anyPack(msg.desc, msg.message, any);
6550
- }
6551
- function timestampFromJson(timestamp, json) {
6552
- if (typeof json !== "string") throw new Error(`cannot decode message ${timestamp.$typeName} from JSON: ${formatVal(json)}`);
6553
- const matches = json.match(/^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(?:\.([0-9]{1,9}))?(?:Z|([+-][0-9][0-9]:[0-9][0-9]))$/);
6554
- if (!matches) throw new Error(`cannot decode message ${timestamp.$typeName} from JSON: invalid RFC 3339 string`);
6555
- const ms = Date.parse(matches[1] + "-" + matches[2] + "-" + matches[3] + "T" + matches[4] + ":" + matches[5] + ":" + matches[6] + (matches[8] ? matches[8] : "Z"));
6556
- if (Number.isNaN(ms)) throw new Error(`cannot decode message ${timestamp.$typeName} from JSON: invalid RFC 3339 string`);
6557
- if (ms < Date.parse("0001-01-01T00:00:00Z") || ms > Date.parse("9999-12-31T23:59:59Z")) throw new Error(`cannot decode message ${timestamp.$typeName} from JSON: must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive`);
6558
- timestamp.seconds = protoInt64.parse(ms / 1e3);
6559
- timestamp.nanos = 0;
6560
- if (matches[7]) timestamp.nanos = parseInt("1" + matches[7] + "0".repeat(9 - matches[7].length)) - 1e9;
6561
- }
6562
- function durationFromJson(duration, json) {
6563
- if (typeof json !== "string") throw new Error(`cannot decode message ${duration.$typeName} from JSON: ${formatVal(json)}`);
6564
- const match = json.match(/^(-?[0-9]+)(?:\.([0-9]+))?s/);
6565
- if (match === null) throw new Error(`cannot decode message ${duration.$typeName} from JSON: ${formatVal(json)}`);
6566
- const longSeconds = Number(match[1]);
6567
- if (longSeconds > 315576e6 || longSeconds < -315576e6) throw new Error(`cannot decode message ${duration.$typeName} from JSON: ${formatVal(json)}`);
6568
- duration.seconds = protoInt64.parse(longSeconds);
6569
- if (typeof match[2] !== "string") return;
6570
- const nanosStr = match[2] + "0".repeat(9 - match[2].length);
6571
- duration.nanos = parseInt(nanosStr);
6572
- if (longSeconds < 0 || Object.is(longSeconds, -0)) duration.nanos = -duration.nanos;
6573
- }
6574
- function fieldMaskFromJson(fieldMask, json) {
6575
- if (typeof json !== "string") throw new Error(`cannot decode message ${fieldMask.$typeName} from JSON: ${formatVal(json)}`);
6576
- if (json === "") return;
6577
- function camelToSnake(str) {
6578
- if (str.includes("_")) throw new Error(`cannot decode message ${fieldMask.$typeName} from JSON: path names must be lowerCamelCase`);
6579
- const sc = str.replace(/[A-Z]/g, (letter) => "_" + letter.toLowerCase());
6580
- return sc[0] === "_" ? sc.substring(1) : sc;
6581
- }
6582
- fieldMask.paths = json.split(",").map(camelToSnake);
6583
- }
6584
- function structFromJson(struct, json) {
6585
- if (typeof json != "object" || json == null || Array.isArray(json)) throw new Error(`cannot decode message ${struct.$typeName} from JSON ${formatVal(json)}`);
6586
- for (const [k, v] of Object.entries(json)) {
6587
- const parsedV = create(ValueSchema);
6588
- valueFromJson(parsedV, v);
6589
- struct.fields[k] = parsedV;
6590
- }
6591
- }
6592
- function valueFromJson(value, json) {
6593
- switch (typeof json) {
6594
- case "number":
6595
- value.kind = {
6596
- case: "numberValue",
6597
- value: json
6598
- };
6599
- break;
6600
- case "string":
6601
- value.kind = {
6602
- case: "stringValue",
6603
- value: json
6604
- };
6605
- break;
6606
- case "boolean":
6607
- value.kind = {
6608
- case: "boolValue",
6609
- value: json
6610
- };
6611
- break;
6612
- case "object":
6613
- if (json === null) value.kind = {
6614
- case: "nullValue",
6615
- value: NullValue.NULL_VALUE
6616
- };
6617
- else if (Array.isArray(json)) {
6618
- const listValue = create(ListValueSchema);
6619
- listValueFromJson(listValue, json);
6620
- value.kind = {
6621
- case: "listValue",
6622
- value: listValue
6623
- };
6624
- } else {
6625
- const struct = create(StructSchema);
6626
- structFromJson(struct, json);
6627
- value.kind = {
6628
- case: "structValue",
6629
- value: struct
6630
- };
6631
- }
6632
- break;
6633
- default: throw new Error(`cannot decode message ${value.$typeName} from JSON ${formatVal(json)}`);
6634
- }
6635
- return value;
6636
- }
6637
- function listValueFromJson(listValue, json) {
6638
- if (!Array.isArray(json)) throw new Error(`cannot decode message ${listValue.$typeName} from JSON ${formatVal(json)}`);
6639
- for (const e of json) {
6640
- const value = create(ValueSchema);
6641
- valueFromJson(value, e);
6642
- listValue.values.push(value);
6643
- }
6644
- }
6645
- //#endregion
6646
- //#region package.json
6647
- var version = "0.0.0-dev.59";
6648
- //#endregion
6649
5580
  //#region src/proto/lovable/appworkflows/v1/workflow_manifest_pb.ts
6650
5581
  /**
6651
5582
  * Describes the file lovable/appworkflows/v1/workflow_manifest.proto.
@@ -6802,184 +5733,4 @@ const WorkflowManifestConnectorNodeV1Schema = /*@__PURE__*/ messageDesc(file_lov
6802
5733
  */
6803
5734
  const WorkflowManifestRepeatedConnectorV1Schema = /*@__PURE__*/ messageDesc(file_lovable_appworkflows_v1_workflow_manifest, 29);
6804
5735
  //#endregion
6805
- //#region src/manifests/json.ts
6806
- function toJson(value, jsonPath, ancestors = /* @__PURE__ */ new Set()) {
6807
- if (value === null || typeof value === "string" || typeof value === "boolean") return value;
6808
- if (typeof value === "number" && Number.isFinite(value)) return value;
6809
- if (typeof value !== "object" || ancestors.has(value)) throw new Error(`@lovable.dev/workflows-sdk: ${jsonPath} must contain finite, acyclic JSON values`);
6810
- ancestors.add(value);
6811
- try {
6812
- if (Object.getOwnPropertySymbols(value).length > 0) throw new Error(`@lovable.dev/workflows-sdk: ${jsonPath} must not contain symbol keys`);
6813
- if (Array.isArray(value)) {
6814
- if (Object.keys(value).length !== value.length) throw new Error(`@lovable.dev/workflows-sdk: ${jsonPath} must be a dense JSON array without extra properties`);
6815
- return Array.from(value, (item, index) => toJson(item, `${jsonPath}[${index}]`, ancestors));
6816
- }
6817
- if (Object.getPrototypeOf(value) !== Object.prototype && Object.getPrototypeOf(value) !== null) throw new Error(`@lovable.dev/workflows-sdk: ${jsonPath} must contain plain JSON objects`);
6818
- return Object.fromEntries(Object.keys(value).sort().map((key) => [key, toJson(value[key], `${jsonPath}.${key}`, ancestors)]));
6819
- } finally {
6820
- ancestors.delete(value);
6821
- }
6822
- }
6823
- //#endregion
6824
- //#region src/manifests/generate.ts
6825
- function protoValue(value) {
6826
- return fromJson(ValueSchema, value);
6827
- }
6828
- const MANIFEST_WEEKDAYS = {
6829
- mon: 1,
6830
- tue: 2,
6831
- wed: 3,
6832
- thu: 4,
6833
- fri: 5,
6834
- sat: 6,
6835
- sun: 7
6836
- };
6837
- function manifestCadence(cadence) {
6838
- if (cadence.kind === "hourly") return create(WorkflowManifestCadenceV1Schema, { kind: {
6839
- case: "hourly",
6840
- value: create(WorkflowManifestHourlyCadenceV1Schema)
6841
- } });
6842
- if (cadence.kind === "minutes") return create(WorkflowManifestCadenceV1Schema, { kind: {
6843
- case: "minutes",
6844
- value: create(WorkflowManifestMinutesCadenceV1Schema, { interval: cadence.interval })
6845
- } });
6846
- if (cadence.kind === "daily") return create(WorkflowManifestCadenceV1Schema, { kind: {
6847
- case: "daily",
6848
- value: create(WorkflowManifestDailyCadenceV1Schema, { hours: [...cadence.at] })
6849
- } });
6850
- return create(WorkflowManifestCadenceV1Schema, { kind: {
6851
- case: "weekly",
6852
- value: create(WorkflowManifestWeeklyCadenceV1Schema, {
6853
- days: cadence.on.map((day) => MANIFEST_WEEKDAYS[day]),
6854
- hours: [...cadence.at]
6855
- })
6856
- } });
6857
- }
6858
- function serializeSchema(schema, direction, label) {
6859
- if (!schema) return void 0;
6860
- const standard = schema["~standard"];
6861
- if (typeof standard.jsonSchema?.[direction] !== "function") throw new Error(`@lovable.dev/workflows-sdk: ${label} must support Standard JSON Schema conversion`);
6862
- try {
6863
- return protoValue(toJson(standard.jsonSchema[direction]({ target: "draft-2020-12" }), label));
6864
- } catch (cause) {
6865
- throw new Error(`@lovable.dev/workflows-sdk: cannot serialize ${label}`, { cause });
6866
- }
6867
- }
6868
- async function generateManifests(definition, options = {}) {
6869
- const { extractWorkflowGraph } = await import("./graph-CwRl2SGh.js");
6870
- const { findBranchMetadataIssues } = await import("./branch-metadata-D1b9OmsG.js");
6871
- const { findWorkflowContextEscapes } = await import("./context-escapes-CcYvmmKH.js");
6872
- const { findDuplicateOperationIds } = await import("./duplicate-ids-BZhMnS7n.js");
6873
- const { DURABLE_ID_REQUIRED } = await import("./durable-ids-Cx341nJQ.js").then((n) => n.n);
6874
- const { findNestedDurableOperations } = await import("./nested-operations-CoaLLZl0.js");
6875
- const { findOperationDescriptionIssues } = await import("./operation-descriptions-DlYyD27h.js");
6876
- const { findStepMetadataIssues } = await import("./step-metadata-CCsEws4V.js");
6877
- const { findWaitDeadlineIssues } = await import("./wait-deadlines-CCgWwxqQ.js");
6878
- const { WAIT_DEADLINE_REQUIRED } = await import("./wait-deadlines-DpK-Fgnd.js");
6879
- const collection = registerWorkflows(definition);
6880
- const manifests = [];
6881
- for (const workflow of collection.workflows.flatMap(workflowVersions)) {
6882
- const contextEscape = (await findWorkflowContextEscapes(workflow.handler))[0];
6883
- if (contextEscape?.kind === "destructured") throw new Error(`@lovable.dev/workflows-sdk: workflow "${workflow.id}" destructures its workflow context parameter; accept one context identifier and read its properties directly in the workflow handler`);
6884
- if (contextEscape?.kind === "method") throw new Error(`@lovable.dev/workflows-sdk: workflow "${workflow.id}" uses ${contextEscape.context}.${contextEscape.method} as a value; durable context methods must be called directly in the workflow handler`);
6885
- if (contextEscape?.kind === "context") throw new Error(`@lovable.dev/workflows-sdk: workflow "${workflow.id}" uses ${contextEscape.context} as a value; the workflow context cannot be passed or aliased, so pass only extracted values such as ${contextEscape.context}.input to helpers`);
6886
- const nested = (await findNestedDurableOperations(workflow.handler))[0];
6887
- if (nested) {
6888
- const parent = `ctx.${nested.parentMethod}(${nested.parentStepId ? JSON.stringify(nested.parentStepId) : ""})`;
6889
- throw new Error(`@lovable.dev/workflows-sdk: workflow "${workflow.id}" calls ctx.${nested.method}() inside ${parent}; step bodies are atomic and cannot contain durable operations`);
6890
- }
6891
- const duplicates = await findDuplicateOperationIds(workflow.handler);
6892
- if (!Array.isArray(duplicates)) {
6893
- const remedy = duplicates.unchecked === "typescript" ? "install the \"typescript\" peer dependency" : "define the workflow handler as a function in the workflow file";
6894
- throw new Error(`@lovable.dev/workflows-sdk: workflow "${workflow.id}" could not be checked for durable operation ids; ${remedy}, because ${DURABLE_ID_REQUIRED}`);
6895
- }
6896
- for (const duplicate of duplicates) {
6897
- if (duplicate.reason === "missing") throw new Error(`@lovable.dev/workflows-sdk: workflow "${workflow.id}" calls ctx.${duplicate.method}() without an id; ${DURABLE_ID_REQUIRED}`);
6898
- const where = duplicate.reason === "loop" ? "inside a loop or callback" : "more than once";
6899
- throw new Error(`@lovable.dev/workflows-sdk: workflow "${workflow.id}" uses id ${JSON.stringify(duplicate.id)} ${where}; every durable operation id must be unique within a workflow`);
6900
- }
6901
- const deadlineIssue = (await findWaitDeadlineIssues(workflow.handler))[0];
6902
- if (deadlineIssue) {
6903
- const call = `ctx.${deadlineIssue.method}()`;
6904
- const fault = deadlineIssue.reason === "missing" ? "without timeoutMs" : deadlineIssue.reason === "dynamic" ? "with a timeoutMs the manifest cannot record" : deadlineIssue.reason === "absolute" ? "with the unsupported absolute deadline option" : "with a timeoutMs that is not a finite duration of at least 60000 milliseconds (one minute)";
6905
- throw new Error(`@lovable.dev/workflows-sdk: workflow "${workflow.id}" calls ${call} ${fault}; ${WAIT_DEADLINE_REQUIRED}`);
6906
- }
6907
- const metadataIssue = (await findStepMetadataIssues(workflow.handler))[0];
6908
- if (metadataIssue?.kind === "description") {
6909
- const step = metadataIssue.method === "llm" ? "ctx.llm()" : metadataIssue.stepId ? `ctx.${metadataIssue.method}(${JSON.stringify(metadataIssue.stepId)})` : `ctx.${metadataIssue.method}()`;
6910
- throw new Error(`@lovable.dev/workflows-sdk: workflow "${workflow.id}" ${step} must include a static { meta: { description: "..." } }`);
6911
- }
6912
- if (metadataIssue?.kind === "group") {
6913
- const step = metadataIssue.method === "llm" ? "ctx.llm()" : metadataIssue.stepId ? `ctx.${metadataIssue.method}(${JSON.stringify(metadataIssue.stepId)})` : `ctx.${metadataIssue.method}()`;
6914
- throw new Error(`@lovable.dev/workflows-sdk: workflow "${workflow.id}" ${step} is declared in a loop or callback and must include a static { meta: { group: { id: "...", label: "..." } } }`);
6915
- }
6916
- if (metadataIssue?.kind === "loop-form") {
6917
- const step = metadataIssue.method === "llm" ? "ctx.llm()" : metadataIssue.stepId ? `ctx.${metadataIssue.method}(${JSON.stringify(metadataIssue.stepId)})` : `ctx.${metadataIssue.method}()`;
6918
- throw new Error(`@lovable.dev/workflows-sdk: workflow "${workflow.id}" ${step} uses an unsupported loop form; await the operation directly as the only statement in a for...of loop for sequential execution, or use Promise.all(items.map(...)) for parallel execution`);
6919
- }
6920
- if (metadataIssue?.kind === "duplicate-group") throw new Error(`@lovable.dev/workflows-sdk: workflow "${workflow.id}" uses group id ${JSON.stringify(metadataIssue.groupId)} at more than one repeated step callsite; every group id must identify one callsite`);
6921
- const operationDescriptionIssue = (await findOperationDescriptionIssues(workflow.handler))[0];
6922
- if (operationDescriptionIssue) {
6923
- const { method } = operationDescriptionIssue;
6924
- const description = method === "approve" ? "{ description: \"...\" }" : "{ meta: { description: \"...\" } }";
6925
- throw new Error(`@lovable.dev/workflows-sdk: workflow "${workflow.id}" ctx.${method}() must include a static ${description}`);
6926
- }
6927
- const branchMetadataIssue = (await findBranchMetadataIssues(workflow.handler))[0];
6928
- if (branchMetadataIssue?.kind === "path") {
6929
- const operation = branchMetadataIssue.stepId ? `ctx.${branchMetadataIssue.method}(${JSON.stringify(branchMetadataIssue.stepId)})` : `ctx.${branchMetadataIssue.method}()`;
6930
- throw new Error(`@lovable.dev/workflows-sdk: workflow "${workflow.id}" ${operation} must include a static meta.branches path matching its enclosing if/else branches; each entry needs { id, description }`);
6931
- }
6932
- if (branchMetadataIssue?.kind === "inconsistent") throw new Error(`@lovable.dev/workflows-sdk: workflow "${workflow.id}" uses inconsistent metadata for branch ${JSON.stringify(branchMetadataIssue.branchId)}; every operation under one if statement must use the same branch id and description`);
6933
- if (branchMetadataIssue?.kind === "duplicate-id") throw new Error(`@lovable.dev/workflows-sdk: workflow "${workflow.id}" uses branch id ${JSON.stringify(branchMetadataIssue.branchId)} for more than one if statement; every branch id must identify one condition`);
6934
- const metadata = {
6935
- workflowId: workflow.id,
6936
- ...workflow.description === void 0 ? {} : { description: workflow.description },
6937
- workflowVersion: workflow.version,
6938
- ...workflow.inputSchema ? { inputSchema: serializeSchema(workflow.inputSchema, "input", `${workflow.id}.input`) } : {},
6939
- ...workflow.outputSchema ? { outputSchema: serializeSchema(workflow.outputSchema, "output", `${workflow.id}.output`) } : {},
6940
- ...workflow.stateSchema ? { stateSchema: serializeSchema(workflow.stateSchema, "output", `${workflow.id}.state`) } : {}
6941
- };
6942
- const triggers = [];
6943
- for (const schedule of collection.triggers.filter((trigger) => trigger.workflow === workflow)) {
6944
- const input = toJson(schedule.input, `schedule "${schedule.id}" input`);
6945
- const schema = schedule.workflow.inputSchema;
6946
- if (schema) {
6947
- const result = await schema["~standard"].validate(input);
6948
- if (result.issues) throw new Error(`@lovable.dev/workflows-sdk: schedule "${schedule.id}" input is invalid: ${result.issues.map((issue) => issue.message).join("; ")}`);
6949
- }
6950
- triggers.push(create(WorkflowManifestTriggerV1Schema, {
6951
- id: schedule.id,
6952
- kind: {
6953
- case: "schedule",
6954
- value: create(WorkflowManifestScheduleTriggerV1Schema, {
6955
- cadence: manifestCadence(schedule.cadence),
6956
- timeZone: schedule.timeZone,
6957
- enabled: schedule.enabled,
6958
- overlapPolicy: schedule.overlapPolicy,
6959
- input: protoValue(input)
6960
- })
6961
- }
6962
- }));
6963
- }
6964
- triggers.sort((a, b) => {
6965
- return a.id < b.id ? -1 : a.id > b.id ? 1 : 0;
6966
- });
6967
- const manifest = toJson$1(WorkflowManifestV1Schema, create(WorkflowManifestV1Schema, {
6968
- manifestVersion: 1,
6969
- sdkVersion: version,
6970
- current: collection.workflows.includes(workflow),
6971
- ...options.routePath === void 0 ? {} : { routePath: options.routePath },
6972
- ...metadata,
6973
- triggers,
6974
- graph: await extractWorkflowGraph(workflow)
6975
- }), { alwaysEmitImplicit: true });
6976
- manifests.push(manifest);
6977
- }
6978
- return manifests.sort((a, b) => {
6979
- const left = `${a.workflowId}.${a.workflowVersion}`;
6980
- const right = `${b.workflowId}.${b.workflowVersion}`;
6981
- return left < right ? -1 : left > right ? 1 : 0;
6982
- });
6983
- }
6984
- //#endregion
6985
- export { daily as A, WorkflowManifestWaitForEventNodeV1Schema as C, registerWorkflows as D, createWorkflow$1 as E, hourly as M, weekly as N, workflowVersions as O, WORKFLOW_ID_PATTERN as P, WorkflowManifestUuidNodeV1Schema as S, createMiddleware as T, WorkflowManifestSleepNodeV1Schema as _, WorkflowManifestConnectorNodeV1Schema as a, WorkflowManifestStepNodeV1Schema as b, WorkflowManifestGraphV1Schema as c, WorkflowManifestNowNodeV1Schema as d, WorkflowManifestOrderEdgeV1Schema as f, WorkflowManifestRepeatedStepV1Schema as g, WorkflowManifestRepeatedLlmV1Schema as h, WorkflowManifestBranchNodeV1Schema as i, every as j, defineSchedule as k, WorkflowManifestLlmNodeV1Schema as l, WorkflowManifestRepeatedConnectorV1Schema as m, WorkflowManifestApproveNodeV1Schema as n, WorkflowManifestGraphEdgeV1Schema as o, WorkflowManifestParallelNodeV1Schema as p, WorkflowManifestBranchEdgeV1Schema as r, WorkflowManifestGraphNodeV1Schema as s, generateManifests as t, WorkflowManifestLoopNodeV1Schema as u, WorkflowManifestSleepUntilNodeV1Schema as v, create as w, WorkflowManifestUnknownNodeV1Schema as x, WorkflowManifestStepExecutionPolicyV1Schema as y };
5736
+ export { protoInt64 as $, WorkflowManifestWeeklyCadenceV1Schema as A, base64Decode as B, WorkflowManifestStepExecutionPolicyV1Schema as C, WorkflowManifestUuidNodeV1Schema as D, WorkflowManifestUnknownNodeV1Schema as E, fileDesc as F, BinaryReader as G, reflect as H, fromBinary as I, FieldError as J, BinaryWriter as K, readField as L, NullValue as M, StructSchema as N, WorkflowManifestV1Schema as O, ValueSchema as P, scalarZeroValue as Q, messageDesc as R, WorkflowManifestSleepUntilNodeV1Schema as S, WorkflowManifestTriggerV1Schema as T, checkField as U, base64Encode as V, formatVal as W, create as X, isFieldError as Y, isWrapperDesc as Z, WorkflowManifestRepeatedConnectorV1Schema as _, WorkflowManifestConnectorNodeV1Schema as a, WorkflowManifestScheduleTriggerV1Schema as b, WorkflowManifestGraphNodeV1Schema as c, WorkflowManifestLlmNodeV1Schema as d, ScalarType as et, WorkflowManifestLoopNodeV1Schema as f, WorkflowManifestParallelNodeV1Schema as g, WorkflowManifestOrderEdgeV1Schema as h, WorkflowManifestCadenceV1Schema as i, ListValueSchema as j, WorkflowManifestWaitForEventNodeV1Schema as k, WorkflowManifestGraphV1Schema as l, WorkflowManifestNowNodeV1Schema as m, WorkflowManifestBranchEdgeV1Schema as n, WorkflowManifestDailyCadenceV1Schema as o, WorkflowManifestMinutesCadenceV1Schema as p, WireType as q, WorkflowManifestBranchNodeV1Schema as r, WorkflowManifestGraphEdgeV1Schema as s, WorkflowManifestApproveNodeV1Schema as t, WorkflowManifestHourlyCadenceV1Schema as u, WorkflowManifestRepeatedLlmV1Schema as v, WorkflowManifestStepNodeV1Schema as w, WorkflowManifestSleepNodeV1Schema as x, WorkflowManifestRepeatedStepV1Schema as y, protoCamelCase as z };