@oomol-lab/open-flow 0.1.0-beta.16 → 0.1.0-beta.18

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.
Files changed (33) hide show
  1. package/dist/browser/{createResourceDialog-DRUIXBbz.js → createResourceDialog-DlrAMxmo.js} +2 -2
  2. package/dist/browser/flow-authoring.js +1464 -1463
  3. package/dist/browser/flow-change.js +1 -0
  4. package/dist/browser/{flowChanges-iuoam3Bx.js → flowChanges-DR6bsnz-.js} +1745 -1484
  5. package/dist/browser/{flowWorkspace-B0UAQ-s7.js → flowWorkspace-fsNhVe8S.js} +32429 -29399
  6. package/dist/browser/{i18n-JtW9O5x3.js → i18n-9ypjMjOo.js} +167 -27
  7. package/dist/browser/{inputValues-DICmJoN-.js → inputValues-MIPdGucY.js} +2 -2
  8. package/dist/browser/licenses.md +48 -0
  9. package/dist/browser/{markdownContent-tWc7bRAs.js → markdownContent-BBgH9ZIV.js} +13 -13
  10. package/dist/browser/theme.css +9 -9
  11. package/dist/browser/ui.css +1 -1
  12. package/dist/browser/ui.d.ts +9 -0
  13. package/dist/browser/ui.js +1219 -1022
  14. package/dist/browser/{useValueChanged-DSookOEC.js → useValueChanged-BY05Usw-.js} +3 -3
  15. package/dist/browser/workbench.css +1 -1
  16. package/dist/browser/workbench.js +931 -629
  17. package/dist/browser/{workbenchSelect-DgxXqCAa.js → workbenchSelect-CwP6rphY.js} +4 -3
  18. package/dist/common/control-api-conformance.js +389 -394
  19. package/dist/common/control-api-errors.d.ts +5 -0
  20. package/dist/common/control-api.d.ts +1 -6
  21. package/dist/common/control-api.js +1019 -1003
  22. package/dist/common/control-requests.js +1 -0
  23. package/dist/common/engine-contract.d.ts +2 -0
  24. package/dist/common/flow-encoding.js +1 -0
  25. package/dist/common/flow-semantics.js +2802 -2767
  26. package/dist/common/integration-trigger.d.ts +23 -1
  27. package/dist/common/integration-trigger.js +188 -52
  28. package/dist/common/mcp.js +409 -391
  29. package/dist/common/provider-triggers.js +890 -842
  30. package/dist/common/runtime-contract.d.ts +2 -1
  31. package/dist/common/runtime-contract.js +99 -28
  32. package/dist/common/scheduler.js +1255 -1254
  33. package/package.json +1 -1
@@ -4466,70 +4466,451 @@ function Xs(e, t = {}) {
4466
4466
  ...f < u.length ? { nextOffset: f } : {}
4467
4467
  };
4468
4468
  }
4469
- function Zs(e, t = 0) {
4469
+ //#endregion
4470
+ //#region src/control/common/errors.ts
4471
+ var H = {
4472
+ authenticationRequired: "authentication.required",
4473
+ authorizationDenied: "authorization.denied",
4474
+ bindingUnresolved: "binding.unresolved",
4475
+ connectorActionNotFound: "connector.action-not-found",
4476
+ connectorUnconfigured: "connector.unconfigured",
4477
+ connectorUnavailable: "connector.unavailable",
4478
+ engineUnavailable: "engine.unavailable",
4479
+ engineUnsupported: "engine.unsupported",
4480
+ flowInvalid: "flow.invalid",
4481
+ flowNotFound: "flow.not-found",
4482
+ flowBusy: "flow.busy",
4483
+ flowConflict: "flow.conflict",
4484
+ flowPresentationConflict: "flow.presentation-conflict",
4485
+ flowRevisionConflict: "flow.revision-conflict",
4486
+ liveConflict: "live.conflict",
4487
+ liveNotFound: "live.not-found",
4488
+ pageInvalidCursor: "page.invalid-cursor",
4489
+ publicationConflict: "publication.conflict",
4490
+ publicationNotFound: "publication.not-found",
4491
+ publicationUnsupported: "publication.unsupported",
4492
+ publishOperationNotFound: "publication.operation-not-found",
4493
+ routeNotFound: "route.not-found",
4494
+ runConflict: "run.conflict",
4495
+ runEventsExpired: "run.events-expired",
4496
+ runInvalid: "run.invalid",
4497
+ runNotFound: "run.not-found",
4498
+ runNotTerminal: "run.not-terminal",
4499
+ runOverloaded: "run.overloaded",
4500
+ runWaitNotFound: "run.wait-not-found",
4501
+ triggerKeyInvalid: "trigger-key.invalid",
4502
+ triggerKeyNotFound: "trigger-key.not-found",
4503
+ triggerNotFound: "trigger.not-found",
4504
+ variableInvalid: "variable.invalid",
4505
+ variableLimitReached: "variable.limit-reached",
4506
+ variableNotFound: "variable.not-found"
4507
+ }, Zs = {
4508
+ [H.authenticationRequired]: { status: 401 },
4509
+ [H.authorizationDenied]: { status: 403 },
4510
+ [H.bindingUnresolved]: { status: 409 },
4511
+ [H.connectorActionNotFound]: { status: 404 },
4512
+ [H.connectorUnconfigured]: { status: 503 },
4513
+ [H.connectorUnavailable]: { status: 503 },
4514
+ [H.engineUnavailable]: { status: 503 },
4515
+ [H.engineUnsupported]: { status: 409 },
4516
+ [H.flowInvalid]: { status: 400 },
4517
+ [H.flowNotFound]: { status: 404 },
4518
+ [H.flowBusy]: { status: 409 },
4519
+ [H.flowConflict]: { status: 409 },
4520
+ [H.flowPresentationConflict]: { status: 412 },
4521
+ [H.flowRevisionConflict]: { status: 412 },
4522
+ [H.liveConflict]: { status: 412 },
4523
+ [H.liveNotFound]: { status: 404 },
4524
+ [H.pageInvalidCursor]: { status: 400 },
4525
+ [H.publicationConflict]: { status: 409 },
4526
+ [H.publicationNotFound]: { status: 404 },
4527
+ [H.publicationUnsupported]: { status: 409 },
4528
+ [H.publishOperationNotFound]: { status: 404 },
4529
+ [H.routeNotFound]: { status: 404 },
4530
+ [H.runConflict]: { status: 409 },
4531
+ [H.runEventsExpired]: { status: 410 },
4532
+ [H.runInvalid]: { status: 400 },
4533
+ [H.runNotFound]: { status: 404 },
4534
+ [H.runNotTerminal]: { status: 409 },
4535
+ [H.runOverloaded]: { status: 429 },
4536
+ [H.runWaitNotFound]: { status: 404 },
4537
+ [H.triggerKeyInvalid]: { status: 409 },
4538
+ [H.triggerKeyNotFound]: { status: 404 },
4539
+ [H.triggerNotFound]: { status: 404 },
4540
+ [H.variableInvalid]: { status: 400 },
4541
+ [H.variableLimitReached]: { status: 409 },
4542
+ [H.variableNotFound]: { status: 404 }
4543
+ }, Qs = class extends Error {
4544
+ constructor(e, t, n) {
4545
+ super(n), this.code = t, this.name = "ApiError", this.status = e;
4546
+ }
4547
+ };
4548
+ //#endregion
4549
+ //#region src/control/common/decoding.ts
4550
+ function U() {
4551
+ throw new Qs(502, "response.invalid", "The Control API returned an invalid response.");
4552
+ }
4553
+ function W(e) {
4554
+ return typeof e != "object" || !e || Array.isArray(e) ? U() : e;
4555
+ }
4556
+ function G(e) {
4557
+ return typeof e == "string" && e.length > 0 ? e : U();
4558
+ }
4559
+ function K(e, t) {
4560
+ let n = Object.keys(e);
4561
+ (n.length != t.length || n.some((e) => !t.includes(e))) && U();
4562
+ }
4563
+ function q(e) {
4564
+ return Number.isSafeInteger(e) ? e : U();
4565
+ }
4566
+ function J(e) {
4567
+ if (e === null || typeof e == "boolean" || typeof e == "string" || typeof e == "number" && Number.isFinite(e)) return e;
4568
+ if (Array.isArray(e)) return e.map(J);
4569
+ let t = W(e);
4570
+ return Object.fromEntries(Object.entries(t).map(([e, t]) => [e, J(t)]));
4571
+ }
4572
+ function $s(e) {
4573
+ if (e != null) return G(e);
4574
+ }
4575
+ //#endregion
4576
+ //#region src/control/common/checkDecoders.ts
4577
+ function ec(e) {
4578
+ let t = W(e), n = t.values == null ? void 0 : W(t.values);
4579
+ return {
4580
+ code: G(t.code),
4581
+ column: q(t.column),
4582
+ line: q(t.line),
4583
+ message: G(t.message),
4584
+ path: typeof t.path == "string" ? t.path : U(),
4585
+ ...n == null ? {} : { values: Object.fromEntries(Object.entries(n).map(([e, t]) => [e, typeof t == "string" || typeof t == "number" ? t : U()])) }
4586
+ };
4587
+ }
4588
+ function tc(e) {
4589
+ let t = W(e);
4590
+ return t.version != 1 || typeof t.valid != "boolean" || !Array.isArray(t.diagnostics) ? U() : {
4591
+ closureDigest: G(t.closureDigest),
4592
+ diagnostics: t.diagnostics.map(ec),
4593
+ engineContract: G(t.engineContract),
4594
+ flowId: G(t.flowId),
4595
+ modelVersion: q(t.modelVersion),
4596
+ revisionDigest: G(t.revisionDigest),
4597
+ revisionId: G(t.revisionId),
4598
+ valid: t.valid,
4599
+ version: 1
4600
+ };
4601
+ }
4602
+ //#endregion
4603
+ //#region src/control/common/connectorDecoders.ts
4604
+ function nc(e) {
4605
+ let t = W(e);
4606
+ K(t, [
4607
+ ...Object.hasOwn(t, "alias") ? ["alias"] : [],
4608
+ "connectionId",
4609
+ "displayName",
4610
+ "isDefault",
4611
+ "serviceId",
4612
+ "status"
4613
+ ]);
4614
+ let n = t.status;
4615
+ return n != "active" && n != "disconnected" && n != "error" && n != "reauth_required" || typeof t.isDefault != "boolean" ? U() : {
4616
+ ...t.alias === void 0 ? {} : { alias: G(t.alias) },
4617
+ connectionId: G(t.connectionId),
4618
+ displayName: G(t.displayName),
4619
+ isDefault: t.isDefault,
4620
+ serviceId: G(t.serviceId),
4621
+ status: n
4622
+ };
4623
+ }
4624
+ function rc(e, t = !1) {
4625
+ let n = W(e), r = n.description, i = t && Object.hasOwn(n, "value");
4626
+ return K(n, [
4627
+ "jsonSchema",
4628
+ "nullable",
4629
+ ...r == null ? [] : ["description"],
4630
+ ...i ? ["value"] : []
4631
+ ]), r != null && typeof r != "string" || typeof n.nullable != "boolean" ? U() : {
4632
+ ...r == null ? {} : { description: r },
4633
+ jsonSchema: J(n.jsonSchema),
4634
+ nullable: n.nullable,
4635
+ ...i ? { value: J(n.value) } : {}
4636
+ };
4637
+ }
4638
+ function ic(e) {
4639
+ return rc(e, !0);
4640
+ }
4641
+ function ac(e, t) {
4642
+ return Object.fromEntries(Object.entries(W(e)).map(([e, n]) => [e, t(n)]));
4643
+ }
4644
+ function oc(e) {
4645
+ let t = W(e), n = t.homepageUrl, r = t.icon, i = t.defaultConnection != null;
4646
+ if (K(t, [
4647
+ "actionId",
4648
+ ...Object.hasOwn(t, "inputSchema") ? ["inputSchema"] : [],
4649
+ ...Object.hasOwn(t, "outputSchema") ? ["outputSchema"] : [],
4650
+ "authenticated",
4651
+ ...i ? ["defaultConnection"] : [],
4652
+ "description",
4653
+ ...n == null ? [] : ["homepageUrl"],
4654
+ ...r == null ? [] : ["icon"],
4655
+ "inputs",
4656
+ "name",
4657
+ "outputs",
4658
+ "serviceId",
4659
+ "serviceName"
4660
+ ]), n != null && typeof n != "string" || r != null && typeof r != "string") return U();
4661
+ let a = {
4662
+ ...t.inputSchema === void 0 ? {} : { inputSchema: J(t.inputSchema) },
4663
+ ...t.outputSchema === void 0 ? {} : { outputSchema: J(t.outputSchema) },
4664
+ actionId: G(t.actionId),
4665
+ authenticated: typeof t.authenticated == "boolean" ? t.authenticated : U(),
4666
+ ...i ? { defaultConnection: nc(t.defaultConnection) } : {},
4667
+ description: typeof t.description == "string" ? t.description : U(),
4668
+ ...n == null ? {} : { homepageUrl: n },
4669
+ ...r == null ? {} : { icon: r },
4670
+ inputs: ac(t.inputs, ic),
4671
+ name: G(t.name),
4672
+ outputs: ac(t.outputs, rc),
4673
+ serviceId: G(t.serviceId),
4674
+ serviceName: G(t.serviceName)
4675
+ };
4676
+ return a.defaultConnection != null && (a.defaultConnection.serviceId != a.serviceId || a.defaultConnection.status != "active") ? U() : a;
4677
+ }
4678
+ function sc(e) {
4679
+ let t = W(e), n = t.homepageUrl, r = t.icon;
4680
+ return K(t, [
4681
+ "serviceId",
4682
+ "serviceName",
4683
+ ...n == null ? [] : ["homepageUrl"],
4684
+ ...r == null ? [] : ["icon"]
4685
+ ]), n != null && typeof n != "string" || r != null && typeof r != "string" ? U() : {
4686
+ ...n == null ? {} : { homepageUrl: n },
4687
+ ...r == null ? {} : { icon: r },
4688
+ serviceId: G(t.serviceId),
4689
+ serviceName: G(t.serviceName)
4690
+ };
4691
+ }
4692
+ //#endregion
4693
+ //#region src/control/common/flowDecoders.ts
4694
+ function cc(e) {
4695
+ let t = W(e), n = t.status;
4696
+ if (t.version != 1 || n != "active" && n != "retiring") return U();
4697
+ let r = t.live == null ? void 0 : W(t.live);
4698
+ return r != null && typeof r.enabled != "boolean" ? U() : {
4699
+ ...r == null ? {} : { live: {
4700
+ enabled: r.enabled,
4701
+ publicationId: G(r.publicationId),
4702
+ revisionId: G(r.revisionId)
4703
+ } },
4704
+ createdAt: G(t.createdAt),
4705
+ draftRevisionId: G(t.draftRevisionId),
4706
+ flowId: G(t.flowId),
4707
+ name: G(t.name),
4708
+ status: n,
4709
+ updatedAt: G(t.updatedAt),
4710
+ version: 1
4711
+ };
4712
+ }
4713
+ function lc(e) {
4714
+ let t = W(e);
4715
+ if (t.version != 1 || !Array.isArray(t.flows)) return U();
4716
+ let n = t.nextCursor, r = t.total;
4717
+ return n != null && typeof n != "string" || r != null && !Number.isSafeInteger(r) ? U() : {
4718
+ ...n == null ? {} : { nextCursor: n },
4719
+ flows: t.flows.map(cc),
4720
+ ...r == null ? {} : { total: r },
4721
+ version: 1
4722
+ };
4723
+ }
4724
+ function uc(e) {
4725
+ let t = W(e);
4726
+ if (K(t, [
4727
+ "name",
4728
+ "updatedAt",
4729
+ "value",
4730
+ "version"
4731
+ ]), t.version != 1 || typeof t.value != "string") return U();
4732
+ let n = G(t.updatedAt);
4733
+ try {
4734
+ if (new Date(n).toISOString() != n) return U();
4735
+ } catch {
4736
+ return U();
4737
+ }
4738
+ return {
4739
+ name: G(t.name),
4740
+ updatedAt: n,
4741
+ value: t.value,
4742
+ version: 1
4743
+ };
4744
+ }
4745
+ //#endregion
4746
+ //#region src/control/common/publicationDecoders.ts
4747
+ function dc(e) {
4748
+ let t = W(e), n = t.operation, r = t.sourcePublicationId;
4749
+ return t.version != 1 || n != "publish" && n != "rollback" || r != null && typeof r != "string" ? U() : {
4750
+ actorId: G(t.actorId),
4751
+ closureDigest: G(t.closureDigest),
4752
+ createdAt: G(t.createdAt),
4753
+ engineContract: G(t.engineContract),
4754
+ flowId: G(t.flowId),
4755
+ modelVersion: q(t.modelVersion),
4756
+ operation: n,
4757
+ publicationId: G(t.publicationId),
4758
+ revisionDigest: G(t.revisionDigest),
4759
+ revisionId: G(t.revisionId),
4760
+ ...r == null ? {} : { sourcePublicationId: r },
4761
+ version: 1
4762
+ };
4763
+ }
4764
+ function fc(e) {
4765
+ let t = W(e), n = t.status, r = {
4766
+ createdAt: G(t.createdAt),
4767
+ flowId: G(t.flowId),
4768
+ operationId: G(t.operationId),
4769
+ revisionId: G(t.revisionId),
4770
+ updatedAt: G(t.updatedAt),
4771
+ version: 1
4772
+ };
4773
+ if (t.version != 1) return U();
4774
+ switch (n) {
4775
+ case "pending": return K(t, [
4776
+ "createdAt",
4777
+ "flowId",
4778
+ "operationId",
4779
+ "revisionId",
4780
+ "status",
4781
+ "updatedAt",
4782
+ "version"
4783
+ ]), {
4784
+ ...r,
4785
+ status: n
4786
+ };
4787
+ case "succeeded": return K(t, [
4788
+ "createdAt",
4789
+ "flowId",
4790
+ "operationId",
4791
+ "publicationId",
4792
+ "revisionId",
4793
+ "status",
4794
+ "updatedAt",
4795
+ "version"
4796
+ ]), {
4797
+ ...r,
4798
+ publicationId: G(t.publicationId),
4799
+ status: n
4800
+ };
4801
+ case "failed": {
4802
+ K(t, [
4803
+ "createdAt",
4804
+ "flowId",
4805
+ "issue",
4806
+ "operationId",
4807
+ "revisionId",
4808
+ "status",
4809
+ "updatedAt",
4810
+ "version"
4811
+ ]);
4812
+ let e = W(t.issue), i = e.nodeId;
4813
+ return K(e, [
4814
+ "code",
4815
+ "message",
4816
+ ...i == null ? [] : ["nodeId"]
4817
+ ]), {
4818
+ ...r,
4819
+ issue: {
4820
+ code: G(e.code),
4821
+ message: G(e.message),
4822
+ ...i == null ? {} : { nodeId: G(i) }
4823
+ },
4824
+ status: n
4825
+ };
4826
+ }
4827
+ default: return U();
4828
+ }
4829
+ }
4830
+ function pc(e) {
4831
+ let t = W(e), n = t.status, r = t.publication;
4832
+ return t.version != 1 || typeof t.hasUnpublishedChanges != "boolean" || n != "not-published" && n != "runnable" && n != "suspended" || n == "not-published" && r !== null || n != "not-published" && r === null ? U() : {
4833
+ flowId: G(t.flowId),
4834
+ hasUnpublishedChanges: t.hasUnpublishedChanges,
4835
+ publication: r === null ? null : dc(r),
4836
+ revision: q(t.revision),
4837
+ status: n,
4838
+ version: 1
4839
+ };
4840
+ }
4841
+ function mc(e) {
4842
+ let t = W(e), n = t.nextCursor, r = t.total;
4843
+ return t.version != 1 || !Array.isArray(t.publications) || n != null && typeof n != "string" || r != null && !Number.isSafeInteger(r) ? U() : {
4844
+ ...n == null ? {} : { nextCursor: n },
4845
+ publications: t.publications.map(dc),
4846
+ ...r == null ? {} : { total: r },
4847
+ version: 1
4848
+ };
4849
+ }
4850
+ function hc(e, t = 0) {
4470
4851
  if (t > 64) throw TypeError("Value exceeds the maximum JSON depth.");
4471
- if (typeof e == "object" && e) for (let n of Object.values(e)) Zs(n, t + 1);
4852
+ if (typeof e == "object" && e) for (let n of Object.values(e)) hc(n, t + 1);
4472
4853
  }
4473
4854
  //#endregion
4474
4855
  //#region src/flow/common/changeSchema.ts
4475
- var H = j(), U = Is(), Qs = F(H), $s = I({
4476
- description: H.optional(),
4477
- jsonSchema: U,
4856
+ var Y = j(), X = Is(), gc = F(Y), _c = I({
4857
+ description: Y.optional(),
4858
+ jsonSchema: X,
4478
4859
  nullable: P(),
4479
- handle: H
4480
- }), W = $s.extend({ value: U.optional() }), ec = I({
4860
+ handle: Y
4861
+ }), Z = _c.extend({ value: X.optional() }), vc = I({
4481
4862
  collapsed: P().optional(),
4482
- group: H
4483
- }), tc = I({
4863
+ group: Y
4864
+ }), yc = I({
4484
4865
  kind: V("node"),
4485
- nodeId: H,
4486
- output: H
4487
- }), nc = I({
4866
+ nodeId: Y,
4867
+ output: Y
4868
+ }), bc = I({
4488
4869
  kind: V("flow"),
4489
- input: H
4490
- }), rc = R([
4491
- tc,
4492
- nc,
4870
+ input: Y
4871
+ }), xc = R([
4872
+ yc,
4873
+ bc,
4493
4874
  I({
4494
4875
  kind: V("binding"),
4495
- bindingId: H
4876
+ bindingId: Y
4496
4877
  })
4497
- ]), ic = R([I({
4878
+ ]), Sc = R([I({
4498
4879
  kind: V("value"),
4499
- value: U
4880
+ value: X
4500
4881
  }), I({
4501
4882
  kind: V("sources"),
4502
- sources: F(rc)
4503
- })]), ac = z(H, ic), oc = {
4504
- inputs: F(R([W, ec])),
4505
- outputs: F(R([$s, ec]))
4506
- }, sc = I({
4883
+ sources: F(xc)
4884
+ })]), Cc = z(Y, Sc), wc = {
4885
+ inputs: F(R([Z, vc])),
4886
+ outputs: F(R([_c, vc]))
4887
+ }, Tc = I({
4507
4888
  kind: V("connector"),
4508
- action: H,
4509
- connectionId: H.optional(),
4889
+ action: Y,
4890
+ connectionId: Y.optional(),
4510
4891
  connections: F(I({
4511
- connectionId: H,
4512
- alias: H.optional()
4892
+ connectionId: Y,
4893
+ alias: Y.optional()
4513
4894
  }))
4514
- }), cc = I({
4515
- ...oc,
4516
- name: H,
4517
- moduleId: H,
4518
- capabilities: F(sc).optional()
4519
- }), lc = R([I({
4895
+ }), Ec = I({
4896
+ ...wc,
4897
+ name: Y,
4898
+ moduleId: Y,
4899
+ capabilities: F(Tc).optional()
4900
+ }), Dc = R([I({
4520
4901
  kind: V("value"),
4521
- value: U
4902
+ value: X
4522
4903
  }), I({
4523
4904
  kind: V("input"),
4524
- input: H
4525
- })]), uc = R([lc, I({ kind: V("model") })]), dc = I({
4526
- ...oc,
4527
- name: H,
4905
+ input: Y
4906
+ })]), Oc = R([Dc, I({ kind: V("model") })]), kc = I({
4907
+ ...wc,
4908
+ name: Y,
4528
4909
  executor: R([
4529
4910
  I({
4530
4911
  kind: V("connector"),
4531
- action: H,
4532
- connectionId: H.optional()
4912
+ action: Y,
4913
+ connectionId: Y.optional()
4533
4914
  }),
4534
4915
  I({
4535
4916
  kind: V("llm"),
@@ -4538,33 +4919,33 @@ var H = j(), U = Is(), Qs = F(H), $s = I({
4538
4919
  I({
4539
4920
  kind: V("agent"),
4540
4921
  code: P().optional(),
4541
- model: H,
4542
- prompt: lc,
4543
- system: H,
4922
+ model: Y,
4923
+ prompt: Dc,
4924
+ system: Y,
4544
4925
  maxRounds: N(),
4545
4926
  tools: F(I({
4546
- id: H,
4547
- name: H,
4548
- description: H,
4549
- action: H,
4550
- connectionId: H.optional(),
4927
+ id: Y,
4928
+ name: Y,
4929
+ description: Y,
4930
+ action: Y,
4931
+ connectionId: Y.optional(),
4551
4932
  approval: P(),
4552
- inputs: F(W.extend({ source: uc }))
4933
+ inputs: F(Z.extend({ source: Oc }))
4553
4934
  })),
4554
4935
  notification: I({
4555
- taskId: H,
4556
- messageHandle: H,
4557
- inputs: z(H, lc)
4936
+ taskId: Y,
4937
+ messageHandle: Y,
4938
+ inputs: z(Y, Dc)
4558
4939
  }).optional()
4559
4940
  })
4560
4941
  ])
4561
- }), fc = {
4562
- input: W,
4942
+ }), Ac = {
4943
+ input: Z,
4563
4944
  cases: F(I({
4564
- output: H,
4945
+ output: Y,
4565
4946
  relation: B(["all", "any"]),
4566
4947
  expressions: F(I({
4567
- input: H,
4948
+ input: Y,
4568
4949
  operator: B([
4569
4950
  "!=",
4570
4951
  "<",
@@ -4587,32 +4968,32 @@ var H = j(), U = Is(), Qs = F(H), $s = I({
4587
4968
  "notHasValue",
4588
4969
  "startsWith"
4589
4970
  ]),
4590
- value: U.optional()
4971
+ value: X.optional()
4591
4972
  }))
4592
4973
  })),
4593
- defaultOutput: H.optional()
4594
- }, pc = {
4974
+ defaultOutput: Y.optional()
4975
+ }, jc = {
4595
4976
  actions: R([ss([V("continue")]), ss([V("approve"), V("reject")])]),
4596
- prompt: H,
4977
+ prompt: Y,
4597
4978
  notification: I({
4598
- inputs: ac,
4599
- messageHandle: H,
4600
- taskId: H
4979
+ inputs: Cc,
4980
+ messageHandle: Y,
4981
+ taskId: Y
4601
4982
  }).optional()
4602
- }, mc = {
4603
- inputsDef: F(W),
4983
+ }, Mc = {
4984
+ inputsDef: F(Z),
4604
4985
  options: I({
4605
- allowedMethods: Qs.optional(),
4606
- allowedOrigins: Qs.optional(),
4986
+ allowedMethods: gc.optional(),
4987
+ allowedOrigins: gc.optional(),
4607
4988
  noResponseBody: P().optional(),
4608
- responseData: H.optional(),
4609
- responseHeaders: z(H, H).optional(),
4989
+ responseData: Y.optional(),
4990
+ responseHeaders: z(Y, Y).optional(),
4610
4991
  responseStatusCode: N().optional()
4611
4992
  }).optional()
4612
- }, hc = F(R([I({
4993
+ }, Nc = F(R([I({
4613
4994
  type: V("cron"),
4614
- expression: H,
4615
- timezone: H
4995
+ expression: Y,
4996
+ timezone: Y
4616
4997
  }), I({
4617
4998
  type: V("every"),
4618
4999
  unit: B([
@@ -4623,16 +5004,16 @@ var H = j(), U = Is(), Qs = F(H), $s = I({
4623
5004
  "week"
4624
5005
  ]),
4625
5006
  value: N()
4626
- })])), gc = {
4627
- configSchema: U,
5007
+ })])), Pc = {
5008
+ configSchema: X,
4628
5009
  definitionVersion: N(),
4629
- description: H,
4630
- displayName: H,
4631
- key: H,
4632
- name: H,
4633
- payloadSchema: U,
4634
- provider: H
4635
- }, _c = I({
5010
+ description: Y,
5011
+ displayName: Y,
5012
+ key: Y,
5013
+ name: Y,
5014
+ payloadSchema: X,
5015
+ provider: Y
5016
+ }, Fc = I({
4636
5017
  body: I({
4637
5018
  allowArray: P(),
4638
5019
  allowEmpty: P(),
@@ -4652,531 +5033,536 @@ var H = j(), U = Is(), Qs = F(H), $s = I({
4652
5033
  "PUT"
4653
5034
  ])),
4654
5035
  successStatus: N()
4655
- }), vc = {
4656
- name: H,
4657
- description: H.optional(),
4658
- icon: H.optional()
4659
- }, yc = {
4660
- inputs: ac,
4661
- name: H.optional(),
4662
- description: H.optional(),
4663
- icon: H.optional(),
5036
+ }), Ic = {
5037
+ name: Y,
5038
+ description: Y.optional(),
5039
+ icon: Y.optional()
5040
+ }, Lc = {
5041
+ inputs: Cc,
5042
+ name: Y.optional(),
5043
+ description: Y.optional(),
5044
+ icon: Y.optional(),
4664
5045
  timeoutMs: N().optional()
4665
- }, bc = R([
5046
+ }, Rc = R([
4666
5047
  I({
4667
- ...yc,
5048
+ ...Lc,
4668
5049
  kind: V("condition"),
4669
- ...fc
5050
+ ...Ac
4670
5051
  }),
4671
5052
  I({
4672
- ...yc,
5053
+ ...Lc,
5054
+ inputs: Xo().transform(() => ({})).default({}),
4673
5055
  kind: V("value"),
4674
- values: F(W)
5056
+ values: F(Z)
4675
5057
  }),
4676
5058
  I({
4677
- ...yc,
5059
+ ...Lc,
4678
5060
  kind: V("subflow"),
4679
- subflowId: H
5061
+ subflowId: Y
4680
5062
  }),
4681
5063
  I({
4682
- ...yc,
5064
+ ...Lc,
4683
5065
  kind: V("task"),
4684
- task: cc,
4685
- additionalInputs: F(W).optional()
5066
+ task: Ec,
5067
+ additionalInputs: F(Z).optional()
4686
5068
  }),
4687
5069
  I({
4688
- ...yc,
5070
+ ...Lc,
4689
5071
  kind: V("task"),
4690
- taskId: H,
4691
- additionalInputs: F(W).optional()
5072
+ taskId: Y,
5073
+ additionalInputs: F(Z).optional()
4692
5074
  }),
4693
5075
  I({
4694
- ...yc,
5076
+ ...Lc,
4695
5077
  kind: V("wait"),
4696
- input: W,
4697
- ...pc
5078
+ input: Z,
5079
+ ...jc
4698
5080
  }).omit({ timeoutMs: !0 }),
4699
5081
  I({
4700
- ...vc,
5082
+ ...Ic,
4701
5083
  kind: V("manual")
4702
5084
  }),
4703
5085
  I({
4704
- ...vc,
5086
+ ...Ic,
4705
5087
  kind: V("webhook"),
4706
- ...mc
5088
+ ...Mc
4707
5089
  }),
4708
5090
  I({
4709
- ...vc,
5091
+ ...Ic,
4710
5092
  kind: V("cron"),
4711
- cronTimes: hc
5093
+ cronTimes: Nc
4712
5094
  }),
4713
5095
  I({
4714
- ...vc,
5096
+ ...Ic,
4715
5097
  kind: V("poll"),
4716
- bindingId: H,
4717
- config: z(H, U),
5098
+ bindingId: Y,
5099
+ config: z(Y, X),
4718
5100
  definition: I({
4719
- ...gc,
5101
+ ...Pc,
4720
5102
  type: V("poll")
4721
5103
  }),
4722
- pollTimes: hc
5104
+ pollTimes: Nc
4723
5105
  }),
4724
5106
  I({
4725
- ...vc,
5107
+ ...Ic,
4726
5108
  kind: V("integration"),
4727
- bindingId: H,
4728
- config: z(H, U),
5109
+ bindingId: Y,
5110
+ config: z(Y, X),
4729
5111
  definition: I({
4730
- ...gc,
5112
+ ...Pc,
4731
5113
  type: V("integration"),
4732
- endpoint: _c
5114
+ endpoint: Fc
4733
5115
  })
4734
5116
  })
4735
- ]), xc = R([I({ kind: V("flow") }), I({
5117
+ ]), zc = R([I({ kind: V("flow") }), I({
4736
5118
  kind: V("subflow"),
4737
- id: H
4738
- })]), Sc = I({
4739
- source: H,
4740
- target: H,
4741
- sourceHandle: H.optional()
4742
- }), G = {
4743
- nodeId: H,
4744
- target: xc
4745
- }, Cc = I({
4746
- name: H,
4747
- inputs: F(W),
4748
- outputs: F($s.extend({ sources: F(R([tc, nc])) }))
4749
- }), wc = I({
4750
- nodes: z(H, bc),
4751
- edges: F(Sc).default([])
4752
- }), Tc = I({
5119
+ id: Y
5120
+ })]), Bc = I({
5121
+ source: Y,
5122
+ target: Y,
5123
+ sourceHandle: Y.optional()
5124
+ }), Q = {
5125
+ nodeId: Y,
5126
+ target: zc
5127
+ }, Vc = I({
5128
+ name: Y,
5129
+ inputs: F(Z),
5130
+ outputs: F(_c.extend({ sources: F(R([yc, bc])) }))
5131
+ }), Hc = I({
5132
+ nodes: z(Y, Rc),
5133
+ edges: F(Bc).default([])
5134
+ }), Uc = I({
4753
5135
  kind: B(["connection", "variable"]),
4754
- target: H
4755
- }), Ec = I({
4756
- name: H,
4757
- imports: Qs,
4758
- source: H
4759
- }), Dc = I({
4760
- bindings: z(H, Tc),
4761
- graph: wc,
4762
- subflows: z(H, Cc.extend({ graph: wc })),
4763
- tasks: z(H, dc)
4764
- }), Oc = I({
5136
+ target: Y
5137
+ }), Wc = I({
5138
+ name: Y,
5139
+ imports: gc,
5140
+ source: Y
5141
+ }), Gc = I({
5142
+ bindings: z(Y, Uc),
5143
+ graph: Hc,
5144
+ subflows: z(Y, Vc.extend({ graph: Hc })),
5145
+ tasks: z(Y, kc)
5146
+ }), Kc = I({
4765
5147
  modelVersion: V(1),
4766
- document: Dc,
4767
- modules: z(H, Ec)
5148
+ document: Gc,
5149
+ modules: z(Y, Wc)
4768
5150
  });
4769
- Oc.extend({
5151
+ Kc.extend({
4770
5152
  kind: V("open-flow-flow-revision"),
4771
5153
  version: V(1)
4772
5154
  });
4773
- function kc(e) {
4774
- return Zs(e), Oc.parse(e);
5155
+ function qc(e) {
5156
+ return hc(e), Kc.parse(e);
4775
5157
  }
4776
- var Ac = {
5158
+ var Jc = {
4777
5159
  "binding.create": {
4778
- bindingId: H,
4779
- binding: Tc
5160
+ bindingId: Y,
5161
+ binding: Uc
4780
5162
  },
4781
- "binding.delete": { bindingId: H },
5163
+ "binding.delete": { bindingId: Y },
4782
5164
  "binding.target.set": {
4783
- bindingId: H,
4784
- before: H,
4785
- value: H
5165
+ bindingId: Y,
5166
+ before: Y,
5167
+ value: Y
4786
5168
  },
4787
5169
  "graph.edge.connect": {
4788
- target: xc,
4789
- edge: Sc
5170
+ target: zc,
5171
+ edge: Bc
4790
5172
  },
4791
5173
  "graph.edge.disconnect": {
4792
- target: xc,
4793
- edge: Sc
5174
+ target: zc,
5175
+ edge: Bc
4794
5176
  },
4795
5177
  "graph.node.create": {
4796
- ...G,
4797
- node: bc
5178
+ ...Q,
5179
+ node: Rc
4798
5180
  },
4799
- "graph.node.delete": G,
5181
+ "graph.node.delete": Q,
4800
5182
  "graph.node.field.set": R([I({
4801
- ...G,
5183
+ ...Q,
4802
5184
  kind: V("graph.node.field.set"),
4803
5185
  field: B([
4804
5186
  "description",
4805
5187
  "icon",
4806
5188
  "name"
4807
5189
  ]),
4808
- before: H.optional(),
4809
- value: H.optional()
5190
+ before: Y.optional(),
5191
+ value: Y.optional()
4810
5192
  }), I({
4811
- ...G,
5193
+ ...Q,
4812
5194
  kind: V("graph.node.field.set"),
4813
5195
  field: V("timeoutMs"),
4814
5196
  before: N().optional(),
4815
5197
  value: N().optional()
4816
5198
  })]),
4817
5199
  "graph.node.input.set": {
4818
- ...G,
4819
- handle: H,
4820
- before: ic.optional(),
4821
- value: ic.optional()
5200
+ ...Q,
5201
+ handle: Y,
5202
+ before: Sc.optional(),
5203
+ value: Sc.optional()
4822
5204
  },
4823
5205
  "graph.node.additional-inputs.set": {
4824
- ...G,
4825
- before: F(W).optional(),
4826
- value: F(W).optional()
5206
+ ...Q,
5207
+ before: F(Z).optional(),
5208
+ value: F(Z).optional()
4827
5209
  },
4828
5210
  "graph.node.condition.set": {
4829
- ...G,
4830
- before: I(fc),
4831
- value: I(fc)
5211
+ ...Q,
5212
+ before: I(Ac),
5213
+ value: I(Ac)
4832
5214
  },
4833
5215
  "graph.node.values.set": {
4834
- ...G,
4835
- before: F(W),
4836
- value: F(W)
5216
+ ...Q,
5217
+ before: F(Z),
5218
+ value: F(Z)
4837
5219
  },
4838
5220
  "graph.node.wait.set": {
4839
- ...G,
5221
+ ...Q,
4840
5222
  target: I({ kind: V("flow") }),
4841
- before: I(pc),
4842
- value: I(pc)
5223
+ before: I(jc),
5224
+ value: I(jc)
4843
5225
  },
4844
5226
  "graph.node.webhook.set": {
4845
- ...G,
5227
+ ...Q,
4846
5228
  target: I({ kind: V("flow") }),
4847
- before: I(mc),
4848
- value: I(mc)
5229
+ before: I(Mc),
5230
+ value: I(Mc)
4849
5231
  },
4850
5232
  "graph.node.task.ports.set": {
4851
- ...G,
4852
- before: I(oc),
4853
- value: I(oc)
5233
+ ...Q,
5234
+ before: I(wc),
5235
+ value: I(wc)
4854
5236
  },
4855
5237
  "graph.node.task.name.set": {
4856
- ...G,
4857
- before: H,
4858
- value: H
5238
+ ...Q,
5239
+ before: Y,
5240
+ value: Y
4859
5241
  },
4860
5242
  "graph.node.task.capabilities.set": {
4861
- ...G,
4862
- before: F(sc).optional(),
4863
- value: F(sc).optional()
5243
+ ...Q,
5244
+ before: F(Tc).optional(),
5245
+ value: F(Tc).optional()
4864
5246
  },
4865
5247
  "graph.trigger.config.set": {
4866
- nodeId: H,
4867
- name: H,
4868
- before: U.optional(),
4869
- value: U.optional()
5248
+ nodeId: Y,
5249
+ name: Y,
5250
+ before: X.optional(),
5251
+ value: X.optional()
4870
5252
  },
4871
5253
  "graph.trigger.schedule.set": {
4872
- nodeId: H,
4873
- before: hc,
4874
- value: hc
5254
+ nodeId: Y,
5255
+ before: Nc,
5256
+ value: Nc
4875
5257
  },
4876
5258
  "module.create": {
4877
- moduleId: H,
4878
- module: Ec
5259
+ moduleId: Y,
5260
+ module: Wc
4879
5261
  },
4880
- "module.delete": { moduleId: H },
5262
+ "module.delete": { moduleId: Y },
4881
5263
  "module.rename": {
4882
- moduleId: H,
4883
- before: H,
4884
- name: H
5264
+ moduleId: Y,
5265
+ before: Y,
5266
+ name: Y
4885
5267
  },
4886
5268
  "module.source.replace": {
4887
- moduleId: H,
4888
- beforeImports: Qs,
4889
- beforeSource: H,
4890
- imports: Qs,
4891
- source: H
5269
+ moduleId: Y,
5270
+ beforeImports: gc,
5271
+ beforeSource: Y,
5272
+ imports: gc,
5273
+ source: Y
4892
5274
  },
4893
5275
  "subflow.create": {
4894
- subflowId: H,
4895
- subflow: Cc.extend({ graph: wc })
5276
+ subflowId: Y,
5277
+ subflow: Vc.extend({ graph: Hc })
4896
5278
  },
4897
5279
  "subflow.definition.set": {
4898
- subflowId: H,
4899
- before: Cc,
4900
- definition: Cc
5280
+ subflowId: Y,
5281
+ before: Vc,
5282
+ definition: Vc
4901
5283
  },
4902
- "subflow.delete": { subflowId: H },
5284
+ "subflow.delete": { subflowId: Y },
4903
5285
  "task.create": {
4904
- taskId: H,
4905
- task: dc
5286
+ taskId: Y,
5287
+ task: kc
4906
5288
  },
4907
- "task.delete": { taskId: H },
5289
+ "task.delete": { taskId: Y },
4908
5290
  "task.connector.connection.set": {
4909
- taskId: H,
4910
- before: H.optional(),
4911
- value: H.optional()
5291
+ taskId: Y,
5292
+ before: Y.optional(),
5293
+ value: Y.optional()
4912
5294
  },
4913
5295
  "task.agent.set": {
4914
- taskId: H,
4915
- before: dc,
4916
- value: dc
5296
+ taskId: Y,
5297
+ before: kc,
5298
+ value: kc
4917
5299
  },
4918
5300
  "task.llm.mode.set": {
4919
- taskId: H,
5301
+ taskId: Y,
4920
5302
  before: B(["chat", "json"]),
4921
5303
  value: B(["chat", "json"])
4922
5304
  },
4923
5305
  "task.name.set": {
4924
- taskId: H,
4925
- before: H,
4926
- value: H
5306
+ taskId: Y,
5307
+ before: Y,
5308
+ value: Y
4927
5309
  }
4928
5310
  };
4929
- F(R([...new Map(Object.entries(Ac).map(([e, t]) => [e, t instanceof A ? t : I({
5311
+ F(R([...new Map(Object.entries(Jc).map(([e, t]) => [e, t instanceof A ? t : I({
4930
5312
  kind: V(e),
4931
5313
  ...t
4932
5314
  })])).values()])).min(1), new TextEncoder();
4933
5315
  //#endregion
4934
- //#region src/control/common/errors.ts
4935
- var K = {
4936
- authenticationRequired: "authentication.required",
4937
- authorizationDenied: "authorization.denied",
4938
- bindingUnresolved: "binding.unresolved",
4939
- connectorActionNotFound: "connector.action-not-found",
4940
- connectorUnconfigured: "connector.unconfigured",
4941
- connectorUnavailable: "connector.unavailable",
4942
- engineUnavailable: "engine.unavailable",
4943
- engineUnsupported: "engine.unsupported",
4944
- flowInvalid: "flow.invalid",
4945
- flowNotFound: "flow.not-found",
4946
- flowBusy: "flow.busy",
4947
- flowConflict: "flow.conflict",
4948
- flowPresentationConflict: "flow.presentation-conflict",
4949
- flowRevisionConflict: "flow.revision-conflict",
4950
- liveConflict: "live.conflict",
4951
- liveNotFound: "live.not-found",
4952
- pageInvalidCursor: "page.invalid-cursor",
4953
- publicationConflict: "publication.conflict",
4954
- publicationNotFound: "publication.not-found",
4955
- publicationUnsupported: "publication.unsupported",
4956
- publishOperationNotFound: "publication.operation-not-found",
4957
- routeNotFound: "route.not-found",
4958
- runConflict: "run.conflict",
4959
- runEventsExpired: "run.events-expired",
4960
- runInvalid: "run.invalid",
4961
- runNotFound: "run.not-found",
4962
- runNotTerminal: "run.not-terminal",
4963
- runOverloaded: "run.overloaded",
4964
- runWaitNotFound: "run.wait-not-found",
4965
- triggerKeyInvalid: "trigger-key.invalid",
4966
- triggerKeyNotFound: "trigger-key.not-found",
4967
- triggerNotFound: "trigger.not-found",
4968
- variableInvalid: "variable.invalid",
4969
- variableLimitReached: "variable.limit-reached",
4970
- variableNotFound: "variable.not-found"
4971
- }, jc = {
4972
- [K.authenticationRequired]: { status: 401 },
4973
- [K.authorizationDenied]: { status: 403 },
4974
- [K.bindingUnresolved]: { status: 409 },
4975
- [K.connectorActionNotFound]: { status: 404 },
4976
- [K.connectorUnconfigured]: { status: 503 },
4977
- [K.connectorUnavailable]: { status: 503 },
4978
- [K.engineUnavailable]: { status: 503 },
4979
- [K.engineUnsupported]: { status: 409 },
4980
- [K.flowInvalid]: { status: 400 },
4981
- [K.flowNotFound]: { status: 404 },
4982
- [K.flowBusy]: { status: 409 },
4983
- [K.flowConflict]: { status: 409 },
4984
- [K.flowPresentationConflict]: { status: 412 },
4985
- [K.flowRevisionConflict]: { status: 412 },
4986
- [K.liveConflict]: { status: 412 },
4987
- [K.liveNotFound]: { status: 404 },
4988
- [K.pageInvalidCursor]: { status: 400 },
4989
- [K.publicationConflict]: { status: 409 },
4990
- [K.publicationNotFound]: { status: 404 },
4991
- [K.publicationUnsupported]: { status: 409 },
4992
- [K.publishOperationNotFound]: { status: 404 },
4993
- [K.routeNotFound]: { status: 404 },
4994
- [K.runConflict]: { status: 409 },
4995
- [K.runEventsExpired]: { status: 410 },
4996
- [K.runInvalid]: { status: 400 },
4997
- [K.runNotFound]: { status: 404 },
4998
- [K.runNotTerminal]: { status: 409 },
4999
- [K.runOverloaded]: { status: 429 },
5000
- [K.runWaitNotFound]: { status: 404 },
5001
- [K.triggerKeyInvalid]: { status: 409 },
5002
- [K.triggerKeyNotFound]: { status: 404 },
5003
- [K.triggerNotFound]: { status: 404 },
5004
- [K.variableInvalid]: { status: 400 },
5005
- [K.variableLimitReached]: { status: 409 },
5006
- [K.variableNotFound]: { status: 404 }
5007
- }, Mc = [
5008
- "canceled",
5009
- "completed",
5010
- "failed",
5011
- "indeterminate",
5012
- "queued",
5013
- "running",
5014
- "starting",
5015
- "waiting"
5016
- ];
5017
- //#endregion
5018
- //#region src/control/common/random.ts
5019
- function Nc() {
5020
- let e = globalThis.crypto;
5021
- if (e != null) {
5022
- try {
5023
- if (typeof e.randomUUID == "function") return e.randomUUID();
5024
- } catch {}
5025
- if (typeof e.getRandomValues == "function") {
5026
- let t = e.getRandomValues(/* @__PURE__ */ new Uint8Array(16));
5027
- t[6] = (t[6] ?? 0) & 15 | 64, t[8] = (t[8] ?? 0) & 63 | 128;
5028
- let n = Array.from(t, (e) => e.toString(16).padStart(2, "0")).join("");
5029
- return `${n.slice(0, 8)}-${n.slice(8, 12)}-${n.slice(12, 16)}-${n.slice(16, 20)}-${n.slice(20)}`;
5030
- }
5031
- }
5032
- return `${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`;
5316
+ //#region src/control/common/revisionDecoders.ts
5317
+ function Yc(e) {
5318
+ let t = W(e), n = t.parentRevisionId;
5319
+ return t.version != 1 || n !== null && typeof n != "string" ? U() : {
5320
+ actorId: G(t.actorId),
5321
+ createdAt: G(t.createdAt),
5322
+ digest: G(t.digest),
5323
+ flowId: G(t.flowId),
5324
+ modelVersion: q(t.modelVersion),
5325
+ parentRevisionId: n,
5326
+ revisionId: G(t.revisionId),
5327
+ version: 1
5328
+ };
5033
5329
  }
5034
- //#endregion
5035
- //#region src/control/common/api.ts
5036
- var Pc = class extends Error {
5037
- constructor(e, t, n) {
5038
- super(n), this.code = t, this.name = "ApiError", this.status = e;
5330
+ function Xc(e) {
5331
+ let t = W(e);
5332
+ try {
5333
+ return {
5334
+ ...Yc(t),
5335
+ content: qc(t.content)
5336
+ };
5337
+ } catch {
5338
+ return U();
5039
5339
  }
5040
- };
5041
- function q() {
5042
- throw new Pc(502, "response.invalid", "The Control API returned an invalid response.");
5043
5340
  }
5044
- function J(e) {
5045
- return typeof e != "object" || !e || Array.isArray(e) ? q() : e;
5341
+ function Zc(e) {
5342
+ let t = W(e);
5343
+ return K(t, [
5344
+ "revision",
5345
+ "updatedAt",
5346
+ "value",
5347
+ "version"
5348
+ ]), t.version != 1 || q(t.revision) < 1 ? U() : {
5349
+ revision: q(t.revision),
5350
+ updatedAt: G(t.updatedAt),
5351
+ value: Object.fromEntries(Object.entries(W(t.value)).map(([e, t]) => [e, J(t)])),
5352
+ version: 1
5353
+ };
5046
5354
  }
5047
- function Y(e) {
5048
- return typeof e == "string" && e.length > 0 ? e : q();
5355
+ function Qc(e) {
5356
+ let t = W(e);
5357
+ return t.version == 1 ? {
5358
+ revision: Yc(t.revision),
5359
+ version: 1
5360
+ } : U();
5049
5361
  }
5050
- function X(e, t) {
5051
- let n = Object.keys(e);
5052
- (n.length != t.length || n.some((e) => !t.includes(e))) && q();
5362
+ function $c(e) {
5363
+ let t = W(e);
5364
+ return t.version != 1 || t.kind != "snapshot" ? U() : {
5365
+ draft: Xc(t.draft),
5366
+ kind: "snapshot",
5367
+ version: 1
5368
+ };
5053
5369
  }
5054
- function Z(e) {
5055
- return Number.isSafeInteger(e) ? e : q();
5370
+ //#endregion
5371
+ //#region src/control/common/runDecoders.ts
5372
+ var el = /* @__PURE__ */ new Set([
5373
+ "canceled",
5374
+ "completed",
5375
+ "failed",
5376
+ "indeterminate",
5377
+ "queued",
5378
+ "running",
5379
+ "starting",
5380
+ "waiting"
5381
+ ]);
5382
+ function tl(e) {
5383
+ return typeof e == "string" && el.has(e) ? e : U();
5056
5384
  }
5057
- function Q(e) {
5058
- if (e === null || typeof e == "boolean" || typeof e == "string" || typeof e == "number" && Number.isFinite(e)) return e;
5059
- if (Array.isArray(e)) return e.map(Q);
5060
- let t = J(e);
5061
- return Object.fromEntries(Object.entries(t).map(([e, t]) => [e, Q(t)]));
5385
+ function nl(e) {
5386
+ let t = W(e), n = t.source, r = t.startedAt, i = t.finishedAt;
5387
+ return t.version != 1 || n != "draft" && n != "live" && n != "trigger" || r != null && typeof r != "string" || i != null && typeof i != "string" ? U() : {
5388
+ createdAt: G(t.createdAt),
5389
+ ...i == null ? {} : { finishedAt: i },
5390
+ flowId: G(t.flowId),
5391
+ revisionId: G(t.revisionId),
5392
+ runId: G(t.runId),
5393
+ source: n,
5394
+ ...r == null ? {} : { startedAt: r },
5395
+ status: tl(t.status),
5396
+ version: 1
5397
+ };
5062
5398
  }
5063
- function Fc(e) {
5064
- let t = J(e);
5065
- X(t, [
5066
- ...Object.hasOwn(t, "alias") ? ["alias"] : [],
5067
- "connectionId",
5068
- "displayName",
5069
- "isDefault",
5070
- "serviceId",
5071
- "status"
5399
+ function rl(e) {
5400
+ let t = W(e);
5401
+ K(t, [
5402
+ "actions",
5403
+ "expiresAt",
5404
+ "nodeId",
5405
+ "prompt",
5406
+ "waitId",
5407
+ "waitingSince"
5072
5408
  ]);
5073
- let n = t.status;
5074
- return n != "active" && n != "disconnected" && n != "error" && n != "reauth_required" || typeof t.isDefault != "boolean" ? q() : {
5075
- ...t.alias === void 0 ? {} : { alias: Y(t.alias) },
5076
- connectionId: Y(t.connectionId),
5077
- displayName: Y(t.displayName),
5078
- isDefault: t.isDefault,
5079
- serviceId: Y(t.serviceId),
5080
- status: n
5409
+ let n = t.actions;
5410
+ return !Array.isArray(n) || !(n.length == 1 && n[0] == "continue" || n.length == 2 && n[0] == "approve" && n[1] == "reject") ? U() : {
5411
+ actions: n,
5412
+ expiresAt: G(t.expiresAt),
5413
+ nodeId: G(t.nodeId),
5414
+ prompt: G(t.prompt),
5415
+ waitId: G(t.waitId),
5416
+ waitingSince: G(t.waitingSince)
5081
5417
  };
5082
5418
  }
5083
- function Ic(e, t = !1) {
5084
- let n = J(e), r = n.description, i = t && Object.hasOwn(n, "value");
5085
- return X(n, [
5086
- "jsonSchema",
5087
- "nullable",
5088
- ...r == null ? [] : ["description"],
5089
- ...i ? ["value"] : []
5090
- ]), r != null && typeof r != "string" || typeof n.nullable != "boolean" ? q() : {
5091
- ...r == null ? {} : { description: r },
5092
- jsonSchema: Q(n.jsonSchema),
5093
- nullable: n.nullable,
5094
- ...i ? { value: Q(n.value) } : {}
5419
+ function il(e) {
5420
+ let t = W(e), n = nl(t), r = t.eventsExpiresAt;
5421
+ if (r != null && typeof r != "string" || n.status != "waiting" && t.waiting !== void 0) return U();
5422
+ let i = n.status == "waiting" ? {
5423
+ status: "waiting",
5424
+ waiting: rl(t.waiting)
5425
+ } : { status: n.status }, a = {
5426
+ ...n,
5427
+ closureDigest: G(t.closureDigest),
5428
+ engineContract: G(t.engineContract),
5429
+ engineDigest: G(t.engineDigest),
5430
+ ...r == null ? {} : { eventsExpiresAt: r },
5431
+ modelVersion: q(t.modelVersion),
5432
+ revisionDigest: G(t.revisionDigest),
5433
+ ...i
5095
5434
  };
5435
+ switch (n.source) {
5436
+ case "draft": return {
5437
+ ...a,
5438
+ source: "draft"
5439
+ };
5440
+ case "live": return {
5441
+ ...a,
5442
+ publicationId: G(t.publicationId),
5443
+ source: "live"
5444
+ };
5445
+ case "trigger": return {
5446
+ ...a,
5447
+ occurrenceId: G(t.occurrenceId),
5448
+ publicationId: G(t.publicationId),
5449
+ source: "trigger",
5450
+ triggerNodeId: G(t.triggerNodeId)
5451
+ };
5452
+ }
5096
5453
  }
5097
- function Lc(e) {
5098
- return Ic(e, !0);
5454
+ function al(e) {
5455
+ let t = W(e), n = t.nextCursor;
5456
+ return t.version != 1 || !Array.isArray(t.runs) || n != null && typeof n != "string" ? U() : {
5457
+ flowId: G(t.flowId),
5458
+ ...n == null ? {} : { nextCursor: n },
5459
+ runs: t.runs.map(nl),
5460
+ version: 1
5461
+ };
5099
5462
  }
5100
- function Rc(e, t) {
5101
- return Object.fromEntries(Object.entries(J(e)).map(([e, n]) => [e, t(n)]));
5463
+ function ol(e) {
5464
+ let t = W(e), n = tl(t.status);
5465
+ return t.version != 1 || typeof t.cancelAccepted != "boolean" || n == "queued" || n == "starting" || n == "running" || n == "waiting" ? U() : {
5466
+ cancelAccepted: t.cancelAccepted,
5467
+ runId: G(t.runId),
5468
+ status: n,
5469
+ version: 1
5470
+ };
5102
5471
  }
5103
- function zc(e) {
5104
- let t = J(e), n = t.homepageUrl, r = t.icon, i = t.defaultConnection != null;
5105
- if (X(t, [
5106
- "actionId",
5107
- ...Object.hasOwn(t, "inputSchema") ? ["inputSchema"] : [],
5108
- ...Object.hasOwn(t, "outputSchema") ? ["outputSchema"] : [],
5109
- "authenticated",
5110
- ...i ? ["defaultConnection"] : [],
5111
- "description",
5112
- ...n == null ? [] : ["homepageUrl"],
5113
- ...r == null ? [] : ["icon"],
5114
- "inputs",
5115
- "name",
5116
- "outputs",
5117
- "serviceId",
5118
- "serviceName"
5119
- ]), n != null && typeof n != "string" || r != null && typeof r != "string") return q();
5120
- let a = {
5121
- ...t.inputSchema === void 0 ? {} : { inputSchema: Q(t.inputSchema) },
5122
- ...t.outputSchema === void 0 ? {} : { outputSchema: Q(t.outputSchema) },
5123
- actionId: Y(t.actionId),
5124
- authenticated: typeof t.authenticated == "boolean" ? t.authenticated : q(),
5125
- ...i ? { defaultConnection: Fc(t.defaultConnection) } : {},
5126
- description: typeof t.description == "string" ? t.description : q(),
5127
- ...n == null ? {} : { homepageUrl: n },
5128
- ...r == null ? {} : { icon: r },
5129
- inputs: Rc(t.inputs, Lc),
5130
- name: Y(t.name),
5131
- outputs: Rc(t.outputs, Ic),
5132
- serviceId: Y(t.serviceId),
5133
- serviceName: Y(t.serviceName)
5472
+ function sl(e) {
5473
+ let t = W(e);
5474
+ K(t, [
5475
+ "action",
5476
+ "resolutionAccepted",
5477
+ "resolvedAt",
5478
+ "runId",
5479
+ "status",
5480
+ "version",
5481
+ "waitId"
5482
+ ]);
5483
+ let n = t.action, r = t.resolvedAt;
5484
+ return t.version != 1 || typeof t.resolutionAccepted != "boolean" || n !== null && n != "approve" && n != "continue" && n != "reject" || r !== null && typeof r != "string" || n === null != (r === null) || t.resolutionAccepted && n === null ? U() : {
5485
+ action: n,
5486
+ resolutionAccepted: t.resolutionAccepted,
5487
+ resolvedAt: r,
5488
+ runId: G(t.runId),
5489
+ status: tl(t.status),
5490
+ version: 1,
5491
+ waitId: G(t.waitId)
5134
5492
  };
5135
- return a.defaultConnection != null && (a.defaultConnection.serviceId != a.serviceId || a.defaultConnection.status != "active") ? q() : a;
5136
5493
  }
5137
- function Bc(e) {
5138
- let t = J(e), n = t.homepageUrl, r = t.icon;
5139
- return X(t, [
5140
- "serviceId",
5141
- "serviceName",
5142
- ...n == null ? [] : ["homepageUrl"],
5143
- ...r == null ? [] : ["icon"]
5144
- ]), n != null && typeof n != "string" || r != null && typeof r != "string" ? q() : {
5145
- ...n == null ? {} : { homepageUrl: n },
5146
- ...r == null ? {} : { icon: r },
5147
- serviceId: Y(t.serviceId),
5148
- serviceName: Y(t.serviceName)
5494
+ function cl(e) {
5495
+ let t = W(e), n = t.status;
5496
+ if (t.version != 1) return U();
5497
+ let r = {
5498
+ finishedAt: G(t.finishedAt),
5499
+ runId: G(t.runId),
5500
+ version: 1
5149
5501
  };
5502
+ if (n == "completed") return Object.hasOwn(t, "result") ? {
5503
+ ...r,
5504
+ result: t.result,
5505
+ status: "completed"
5506
+ } : U();
5507
+ if (n == "canceled") return {
5508
+ ...r,
5509
+ status: "canceled"
5510
+ };
5511
+ if (n == "failed") {
5512
+ let e = W(t.error);
5513
+ return {
5514
+ ...r,
5515
+ error: {
5516
+ code: G(e.code),
5517
+ message: G(e.message)
5518
+ },
5519
+ status: "failed"
5520
+ };
5521
+ }
5522
+ if (n == "indeterminate") {
5523
+ let e = W(t.error);
5524
+ return {
5525
+ ...r,
5526
+ error: {
5527
+ code: G(e.code),
5528
+ message: G(e.message)
5529
+ },
5530
+ status: "indeterminate"
5531
+ };
5532
+ }
5533
+ return U();
5150
5534
  }
5151
- function Vc(e) {
5152
- let t = J(e), n = t.type;
5153
- return n != "integration" && n != "poll" ? q() : {
5154
- description: typeof t.description == "string" ? t.description : q(),
5155
- displayName: Y(t.displayName),
5156
- key: Y(t.key),
5157
- name: Y(t.name),
5158
- provider: Y(t.provider),
5535
+ //#endregion
5536
+ //#region src/control/common/triggerDecoders.ts
5537
+ function ll(e) {
5538
+ let t = W(e), n = t.type;
5539
+ return n != "integration" && n != "poll" ? U() : {
5540
+ description: typeof t.description == "string" ? t.description : U(),
5541
+ displayName: G(t.displayName),
5542
+ key: G(t.key),
5543
+ name: G(t.name),
5544
+ provider: G(t.provider),
5159
5545
  type: n
5160
5546
  };
5161
5547
  }
5162
- function Hc(e) {
5163
- let t = J(e), n = Vc(t), r = {
5164
- configSchema: Q(t.configSchema),
5165
- definitionVersion: Z(t.definitionVersion),
5548
+ function ul(e) {
5549
+ let t = W(e), n = ll(t), r = {
5550
+ configSchema: J(t.configSchema),
5551
+ definitionVersion: q(t.definitionVersion),
5166
5552
  description: n.description,
5167
5553
  displayName: n.displayName,
5168
5554
  key: n.key,
5169
5555
  name: n.name,
5170
- payloadSchema: Q(t.payloadSchema),
5556
+ payloadSchema: J(t.payloadSchema),
5171
5557
  provider: n.provider
5172
5558
  };
5173
5559
  if (n.type == "poll") return {
5174
5560
  ...r,
5175
5561
  type: "poll"
5176
5562
  };
5177
- let i = J(t.endpoint), a = J(i.body);
5178
- if (!Array.isArray(i.methods) || !Array.isArray(a.formats) || typeof a.allowArray != "boolean" || typeof a.allowEmpty != "boolean") return q();
5179
- let o = i.methods.map(Y), s = a.formats.map(Y), c = Z(i.successStatus);
5563
+ let i = W(t.endpoint), a = W(i.body);
5564
+ if (!Array.isArray(i.methods) || !Array.isArray(a.formats) || typeof a.allowArray != "boolean" || typeof a.allowEmpty != "boolean") return U();
5565
+ let o = i.methods.map(G), s = a.formats.map(G), c = q(i.successStatus);
5180
5566
  return o.some((e) => ![
5181
5567
  "DELETE",
5182
5568
  "GET",
@@ -5189,7 +5575,7 @@ function Hc(e) {
5189
5575
  "json",
5190
5576
  "multipart",
5191
5577
  "text"
5192
- ].includes(e)) || c < 200 || c > 299 ? q() : {
5578
+ ].includes(e)) || c < 200 || c > 299 ? U() : {
5193
5579
  ...r,
5194
5580
  endpoint: {
5195
5581
  body: {
@@ -5203,18 +5589,18 @@ function Hc(e) {
5203
5589
  type: "integration"
5204
5590
  };
5205
5591
  }
5206
- var Uc = /* @__PURE__ */ new Set([
5592
+ var dl = /* @__PURE__ */ new Set([
5207
5593
  "cron",
5208
5594
  "integration",
5209
5595
  "poll",
5210
5596
  "webhook"
5211
- ]), Wc = /* @__PURE__ */ new Set([
5597
+ ]), fl = /* @__PURE__ */ new Set([
5212
5598
  "failed",
5213
5599
  "healthy",
5214
5600
  "initializing",
5215
5601
  "needs_reauth",
5216
5602
  "suspended"
5217
- ]), Gc = /* @__PURE__ */ new Set([
5603
+ ]), pl = /* @__PURE__ */ new Set([
5218
5604
  "delivery.failed",
5219
5605
  "health.failed",
5220
5606
  "health.needs_reauth",
@@ -5223,386 +5609,88 @@ var Uc = /* @__PURE__ */ new Set([
5223
5609
  "operator.paused",
5224
5610
  "operator.resumed"
5225
5611
  ]);
5226
- function Kc(e) {
5227
- if (e != null) return Y(e);
5228
- }
5229
- function qc(e) {
5230
- let t = J(e), n = t.health, r = t.kind, i = t.operatorState, a = Z(t.runtimeVersion);
5231
- return t.version != 1 || typeof n != "string" || !Wc.has(n) || typeof r != "string" || !Uc.has(r) || i != "active" && i != "paused" || a <= 0 ? q() : {
5232
- ...t.currentPublicationId == null ? {} : { currentPublicationId: Y(t.currentPublicationId) },
5233
- ...t.currentRevisionId == null ? {} : { currentRevisionId: Y(t.currentRevisionId) },
5234
- ...t.endpointUrl == null ? {} : { endpointUrl: Y(t.endpointUrl) },
5235
- flowId: Y(t.flowId),
5612
+ function ml(e) {
5613
+ let t = W(e), n = t.health, r = t.kind, i = t.operatorState, a = q(t.runtimeVersion);
5614
+ return t.version != 1 || typeof n != "string" || !fl.has(n) || typeof r != "string" || !dl.has(r) || i != "active" && i != "paused" || a <= 0 ? U() : {
5615
+ ...t.currentPublicationId == null ? {} : { currentPublicationId: G(t.currentPublicationId) },
5616
+ ...t.currentRevisionId == null ? {} : { currentRevisionId: G(t.currentRevisionId) },
5617
+ ...t.endpointUrl == null ? {} : { endpointUrl: G(t.endpointUrl) },
5618
+ flowId: G(t.flowId),
5236
5619
  health: n,
5237
5620
  kind: r,
5238
- ...t.lastErrorCode == null ? {} : { lastErrorCode: Y(t.lastErrorCode) },
5621
+ ...t.lastErrorCode == null ? {} : { lastErrorCode: G(t.lastErrorCode) },
5239
5622
  operatorState: i,
5240
5623
  runtimeVersion: a,
5241
- triggerNodeId: Y(t.triggerNodeId),
5242
- updatedAt: Y(t.updatedAt),
5624
+ triggerNodeId: G(t.triggerNodeId),
5625
+ updatedAt: G(t.updatedAt),
5243
5626
  version: 1
5244
5627
  };
5245
5628
  }
5246
- function Jc(e) {
5247
- let t = J(e);
5629
+ function hl(e) {
5630
+ let t = W(e);
5248
5631
  return t.version == 1 ? {
5249
- binding: qc(t.binding),
5632
+ binding: ml(t.binding),
5250
5633
  version: 1
5251
- } : q();
5634
+ } : U();
5252
5635
  }
5253
- function Yc(e) {
5254
- let t = J(e), n = t.kind;
5255
- if (typeof n != "string" || !Gc.has(n)) return q();
5256
- let r = Kc(t.errorCode), i = Kc(t.errorMessage);
5257
- return i != null && i.length > 512 ? q() : {
5258
- activityId: Y(t.activityId),
5259
- createdAt: Y(t.createdAt),
5636
+ function gl(e) {
5637
+ let t = W(e), n = t.kind;
5638
+ if (typeof n != "string" || !pl.has(n)) return U();
5639
+ let r = $s(t.errorCode), i = $s(t.errorMessage);
5640
+ return i != null && i.length > 512 ? U() : {
5641
+ activityId: G(t.activityId),
5642
+ createdAt: G(t.createdAt),
5260
5643
  ...r == null ? {} : { errorCode: r },
5261
5644
  ...i == null ? {} : { errorMessage: i },
5262
5645
  kind: n
5263
5646
  };
5264
5647
  }
5265
- function Xc(e) {
5266
- let t = J(e), n = Kc(t.nextCursor);
5267
- return t.version != 1 || !Array.isArray(t.activities) ? q() : {
5268
- activities: t.activities.map(Yc),
5648
+ function _l(e) {
5649
+ let t = W(e), n = $s(t.nextCursor);
5650
+ return t.version != 1 || !Array.isArray(t.activities) ? U() : {
5651
+ activities: t.activities.map(gl),
5269
5652
  ...n == null ? {} : { nextCursor: n },
5270
5653
  version: 1
5271
5654
  };
5272
5655
  }
5273
- function Zc(e) {
5274
- let t = J(e), n = Z(t.filtered);
5275
- return t.version != 1 || !Array.isArray(t.events) || typeof t.hasMore != "boolean" || n < 0 ? q() : {
5656
+ function vl(e) {
5657
+ let t = W(e), n = q(t.filtered);
5658
+ return t.version != 1 || !Array.isArray(t.events) || typeof t.hasMore != "boolean" || n < 0 ? U() : {
5276
5659
  events: t.events.map((e) => {
5277
- let t = J(e);
5278
- return Object.fromEntries(Object.entries(t).map(([e, t]) => [e, Q(t)]));
5660
+ let t = W(e);
5661
+ return Object.fromEntries(Object.entries(t).map(([e, t]) => [e, J(t)]));
5279
5662
  }),
5280
5663
  filtered: n,
5281
5664
  hasMore: t.hasMore,
5282
5665
  version: 1
5283
5666
  };
5284
5667
  }
5285
- function Qc(e) {
5286
- let t = J(e), n = t.status;
5287
- if (t.version != 1 || n != "active" && n != "retiring") return q();
5288
- let r = t.live == null ? void 0 : J(t.live);
5289
- return r != null && typeof r.enabled != "boolean" ? q() : {
5290
- ...r == null ? {} : { live: {
5291
- enabled: r.enabled,
5292
- publicationId: Y(r.publicationId),
5293
- revisionId: Y(r.revisionId)
5294
- } },
5295
- createdAt: Y(t.createdAt),
5296
- draftRevisionId: Y(t.draftRevisionId),
5297
- flowId: Y(t.flowId),
5298
- name: Y(t.name),
5299
- status: n,
5300
- updatedAt: Y(t.updatedAt),
5301
- version: 1
5302
- };
5303
- }
5304
- function $c(e) {
5305
- let t = J(e);
5306
- if (t.version != 1 || !Array.isArray(t.flows)) return q();
5307
- let n = t.nextCursor, r = t.total;
5308
- return n != null && typeof n != "string" || r != null && !Number.isSafeInteger(r) ? q() : {
5309
- ...n == null ? {} : { nextCursor: n },
5310
- flows: t.flows.map(Qc),
5311
- ...r == null ? {} : { total: r },
5312
- version: 1
5313
- };
5314
- }
5315
- function el(e) {
5316
- let t = J(e);
5317
- if (X(t, [
5318
- "name",
5319
- "updatedAt",
5320
- "value",
5321
- "version"
5322
- ]), t.version != 1 || typeof t.value != "string") return q();
5323
- let n = Y(t.updatedAt);
5324
- try {
5325
- if (new Date(n).toISOString() != n) return q();
5326
- } catch {
5327
- return q();
5328
- }
5329
- return {
5330
- name: Y(t.name),
5331
- updatedAt: n,
5332
- value: t.value,
5333
- version: 1
5334
- };
5335
- }
5336
- function tl(e) {
5337
- let t = J(e), n = t.parentRevisionId;
5338
- return t.version != 1 || n !== null && typeof n != "string" ? q() : {
5339
- actorId: Y(t.actorId),
5340
- createdAt: Y(t.createdAt),
5341
- digest: Y(t.digest),
5342
- flowId: Y(t.flowId),
5343
- modelVersion: Z(t.modelVersion),
5344
- parentRevisionId: n,
5345
- revisionId: Y(t.revisionId),
5346
- version: 1
5347
- };
5348
- }
5349
- function nl(e) {
5350
- let t = J(e);
5351
- try {
5352
- return {
5353
- ...tl(t),
5354
- content: kc(t.content)
5355
- };
5356
- } catch {
5357
- return q();
5358
- }
5359
- }
5360
- function rl(e) {
5361
- let t = J(e);
5362
- return X(t, [
5363
- "revision",
5364
- "updatedAt",
5365
- "value",
5366
- "version"
5367
- ]), t.version != 1 || Z(t.revision) < 1 ? q() : {
5368
- revision: Z(t.revision),
5369
- updatedAt: Y(t.updatedAt),
5370
- value: Object.fromEntries(Object.entries(J(t.value)).map(([e, t]) => [e, Q(t)])),
5371
- version: 1
5372
- };
5373
- }
5374
- function il(e) {
5375
- let t = J(e);
5376
- return t.version == 1 ? {
5377
- revision: tl(t.revision),
5378
- version: 1
5379
- } : q();
5380
- }
5381
- function al(e) {
5382
- let t = J(e);
5383
- return t.version != 1 || t.kind != "snapshot" ? q() : {
5384
- draft: nl(t.draft),
5385
- kind: "snapshot",
5386
- version: 1
5387
- };
5388
- }
5389
- function ol(e) {
5390
- let t = J(e), n = t.operation, r = t.sourcePublicationId;
5391
- return t.version != 1 || n != "publish" && n != "rollback" || r != null && typeof r != "string" ? q() : {
5392
- actorId: Y(t.actorId),
5393
- closureDigest: Y(t.closureDigest),
5394
- createdAt: Y(t.createdAt),
5395
- engineContract: Y(t.engineContract),
5396
- flowId: Y(t.flowId),
5397
- modelVersion: Z(t.modelVersion),
5398
- operation: n,
5399
- publicationId: Y(t.publicationId),
5400
- revisionDigest: Y(t.revisionDigest),
5401
- revisionId: Y(t.revisionId),
5402
- ...r == null ? {} : { sourcePublicationId: r },
5403
- version: 1
5404
- };
5405
- }
5406
- function sl(e) {
5407
- let t = J(e), n = t.status, r = {
5408
- createdAt: Y(t.createdAt),
5409
- flowId: Y(t.flowId),
5410
- operationId: Y(t.operationId),
5411
- revisionId: Y(t.revisionId),
5412
- updatedAt: Y(t.updatedAt),
5413
- version: 1
5414
- };
5415
- if (t.version != 1) return q();
5416
- switch (n) {
5417
- case "pending": return X(t, [
5418
- "createdAt",
5419
- "flowId",
5420
- "operationId",
5421
- "revisionId",
5422
- "status",
5423
- "updatedAt",
5424
- "version"
5425
- ]), {
5426
- ...r,
5427
- status: n
5428
- };
5429
- case "succeeded": return X(t, [
5430
- "createdAt",
5431
- "flowId",
5432
- "operationId",
5433
- "publicationId",
5434
- "revisionId",
5435
- "status",
5436
- "updatedAt",
5437
- "version"
5438
- ]), {
5439
- ...r,
5440
- publicationId: Y(t.publicationId),
5441
- status: n
5442
- };
5443
- case "failed": {
5444
- X(t, [
5445
- "createdAt",
5446
- "flowId",
5447
- "issue",
5448
- "operationId",
5449
- "revisionId",
5450
- "status",
5451
- "updatedAt",
5452
- "version"
5453
- ]);
5454
- let e = J(t.issue), i = e.nodeId;
5455
- return X(e, [
5456
- "code",
5457
- "message",
5458
- ...i == null ? [] : ["nodeId"]
5459
- ]), {
5460
- ...r,
5461
- issue: {
5462
- code: Y(e.code),
5463
- message: Y(e.message),
5464
- ...i == null ? {} : { nodeId: Y(i) }
5465
- },
5466
- status: n
5467
- };
5668
+ //#endregion
5669
+ //#region src/control/common/random.ts
5670
+ function yl() {
5671
+ let e = globalThis.crypto;
5672
+ if (e != null) {
5673
+ try {
5674
+ if (typeof e.randomUUID == "function") return e.randomUUID();
5675
+ } catch {}
5676
+ if (typeof e.getRandomValues == "function") {
5677
+ let t = e.getRandomValues(/* @__PURE__ */ new Uint8Array(16));
5678
+ t[6] = (t[6] ?? 0) & 15 | 64, t[8] = (t[8] ?? 0) & 63 | 128;
5679
+ let n = Array.from(t, (e) => e.toString(16).padStart(2, "0")).join("");
5680
+ return `${n.slice(0, 8)}-${n.slice(8, 12)}-${n.slice(12, 16)}-${n.slice(16, 20)}-${n.slice(20)}`;
5468
5681
  }
5469
- default: return q();
5470
5682
  }
5683
+ return `${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`;
5471
5684
  }
5472
- function cl(e) {
5473
- let t = J(e), n = t.values == null ? void 0 : J(t.values);
5474
- return {
5475
- code: Y(t.code),
5476
- column: Z(t.column),
5477
- line: Z(t.line),
5478
- message: Y(t.message),
5479
- path: typeof t.path == "string" ? t.path : q(),
5480
- ...n == null ? {} : { values: Object.fromEntries(Object.entries(n).map(([e, t]) => [e, typeof t == "string" || typeof t == "number" ? t : q()])) }
5481
- };
5482
- }
5483
- function ll(e) {
5484
- let t = J(e);
5485
- return t.version != 1 || typeof t.valid != "boolean" || !Array.isArray(t.diagnostics) ? q() : {
5486
- closureDigest: Y(t.closureDigest),
5487
- diagnostics: t.diagnostics.map(cl),
5488
- engineContract: Y(t.engineContract),
5489
- flowId: Y(t.flowId),
5490
- modelVersion: Z(t.modelVersion),
5491
- revisionDigest: Y(t.revisionDigest),
5492
- revisionId: Y(t.revisionId),
5493
- valid: t.valid,
5494
- version: 1
5495
- };
5496
- }
5497
- function ul(e) {
5498
- let t = J(e), n = t.status, r = t.publication;
5499
- return t.version != 1 || typeof t.hasUnpublishedChanges != "boolean" || n != "not-published" && n != "runnable" && n != "suspended" || n == "not-published" && r !== null || n != "not-published" && r === null ? q() : {
5500
- flowId: Y(t.flowId),
5501
- hasUnpublishedChanges: t.hasUnpublishedChanges,
5502
- publication: r === null ? null : ol(r),
5503
- revision: Z(t.revision),
5504
- status: n,
5505
- version: 1
5506
- };
5507
- }
5508
- function dl(e) {
5509
- let t = J(e), n = t.nextCursor, r = t.total;
5510
- return t.version != 1 || !Array.isArray(t.publications) || n != null && typeof n != "string" || r != null && !Number.isSafeInteger(r) ? q() : {
5511
- ...n == null ? {} : { nextCursor: n },
5512
- publications: t.publications.map(ol),
5513
- ...r == null ? {} : { total: r },
5514
- version: 1
5515
- };
5516
- }
5517
- var fl = new Set(Mc);
5518
- function pl(e) {
5519
- return typeof e == "string" && fl.has(e) ? e : q();
5520
- }
5521
- function ml(e) {
5522
- let t = J(e), n = t.source, r = t.startedAt, i = t.finishedAt;
5523
- return t.version != 1 || n != "draft" && n != "live" && n != "trigger" || r != null && typeof r != "string" || i != null && typeof i != "string" ? q() : {
5524
- createdAt: Y(t.createdAt),
5525
- ...i == null ? {} : { finishedAt: i },
5526
- flowId: Y(t.flowId),
5527
- revisionId: Y(t.revisionId),
5528
- runId: Y(t.runId),
5529
- source: n,
5530
- ...r == null ? {} : { startedAt: r },
5531
- status: pl(t.status),
5532
- version: 1
5533
- };
5534
- }
5535
- function hl(e) {
5536
- let t = J(e);
5537
- X(t, [
5538
- "actions",
5539
- "expiresAt",
5540
- "nodeId",
5541
- "prompt",
5542
- "waitId",
5543
- "waitingSince"
5544
- ]);
5545
- let n = t.actions;
5546
- return !Array.isArray(n) || !(n.length == 1 && n[0] == "continue" || n.length == 2 && n[0] == "approve" && n[1] == "reject") ? q() : {
5547
- actions: n,
5548
- expiresAt: Y(t.expiresAt),
5549
- nodeId: Y(t.nodeId),
5550
- prompt: Y(t.prompt),
5551
- waitId: Y(t.waitId),
5552
- waitingSince: Y(t.waitingSince)
5553
- };
5554
- }
5555
- function gl(e) {
5556
- let t = J(e), n = ml(t), r = t.eventsExpiresAt;
5557
- if (r != null && typeof r != "string" || n.status != "waiting" && t.waiting !== void 0) return q();
5558
- let i = n.status == "waiting" ? {
5559
- status: "waiting",
5560
- waiting: hl(t.waiting)
5561
- } : { status: n.status }, a = {
5562
- ...n,
5563
- closureDigest: Y(t.closureDigest),
5564
- engineContract: Y(t.engineContract),
5565
- engineDigest: Y(t.engineDigest),
5566
- ...r == null ? {} : { eventsExpiresAt: r },
5567
- modelVersion: Z(t.modelVersion),
5568
- revisionDigest: Y(t.revisionDigest),
5569
- ...i
5570
- };
5571
- switch (n.source) {
5572
- case "draft": return {
5573
- ...a,
5574
- source: "draft"
5575
- };
5576
- case "live": return {
5577
- ...a,
5578
- publicationId: Y(t.publicationId),
5579
- source: "live"
5580
- };
5581
- case "trigger": return {
5582
- ...a,
5583
- occurrenceId: Y(t.occurrenceId),
5584
- publicationId: Y(t.publicationId),
5585
- source: "trigger",
5586
- triggerNodeId: Y(t.triggerNodeId)
5587
- };
5588
- }
5589
- }
5590
- function _l(e) {
5591
- let t = J(e), n = t.nextCursor;
5592
- return t.version != 1 || !Array.isArray(t.runs) || n != null && typeof n != "string" ? q() : {
5593
- flowId: Y(t.flowId),
5594
- ...n == null ? {} : { nextCursor: n },
5595
- runs: t.runs.map(ml),
5596
- version: 1
5597
- };
5598
- }
5599
- function vl(e) {
5600
- let t = J(e), n = Z(t.sequence);
5601
- if (n < 0) return q();
5685
+ //#endregion
5686
+ //#region src/control/common/api.ts
5687
+ function bl(e) {
5688
+ let t = W(e), n = q(t.sequence);
5689
+ if (n < 0) return U();
5602
5690
  let r = {
5603
- createdAt: Y(t.createdAt),
5691
+ createdAt: G(t.createdAt),
5604
5692
  sequence: n
5605
- }, i = J(t.payload), a = t.kind;
5693
+ }, i = W(t.payload), a = t.kind;
5606
5694
  switch (a) {
5607
5695
  case "run.queued": return {
5608
5696
  ...r,
@@ -5613,39 +5701,39 @@ function vl(e) {
5613
5701
  ...r,
5614
5702
  kind: a,
5615
5703
  payload: {
5616
- flowId: Y(i.flowId),
5617
- scopeId: Y(i.scopeId),
5618
- ...i.parentScopeId === void 0 ? {} : { parentScopeId: Y(i.parentScopeId) }
5704
+ flowId: G(i.flowId),
5705
+ scopeId: G(i.scopeId),
5706
+ ...i.parentScopeId === void 0 ? {} : { parentScopeId: G(i.parentScopeId) }
5619
5707
  }
5620
5708
  };
5621
5709
  case "run.progress": return {
5622
5710
  ...r,
5623
5711
  kind: a,
5624
5712
  payload: {
5625
- flowId: Y(i.flowId),
5626
- scopeId: Y(i.scopeId),
5627
- progress: yl(i.progress)
5713
+ flowId: G(i.flowId),
5714
+ scopeId: G(i.scopeId),
5715
+ progress: xl(i.progress)
5628
5716
  }
5629
5717
  };
5630
5718
  case "run.waiting": return {
5631
5719
  ...r,
5632
5720
  kind: a,
5633
5721
  payload: {
5634
- expiresAt: Y(i.expiresAt),
5635
- nodeId: Y(i.nodeId),
5636
- waitId: Y(i.waitId),
5637
- waitingSince: Y(i.waitingSince)
5722
+ expiresAt: G(i.expiresAt),
5723
+ nodeId: G(i.nodeId),
5724
+ waitId: G(i.waitId),
5725
+ waitingSince: G(i.waitingSince)
5638
5726
  }
5639
5727
  };
5640
5728
  case "run.resolved": {
5641
5729
  let e = i.action;
5642
- return e !== "approve" && e !== "continue" && e !== "reject" ? q() : {
5730
+ return e !== "approve" && e !== "continue" && e !== "reject" ? U() : {
5643
5731
  ...r,
5644
5732
  kind: a,
5645
5733
  payload: {
5646
5734
  action: e,
5647
- resolvedAt: Y(i.resolvedAt),
5648
- waitId: Y(i.waitId)
5735
+ resolvedAt: G(i.resolvedAt),
5736
+ waitId: G(i.waitId)
5649
5737
  }
5650
5738
  };
5651
5739
  }
@@ -5655,12 +5743,12 @@ function vl(e) {
5655
5743
  case "run.indeterminate": return {
5656
5744
  ...r,
5657
5745
  kind: a,
5658
- payload: { result: Q(i.result) }
5746
+ payload: { result: J(i.result) }
5659
5747
  };
5660
5748
  case "run.events-truncated": return {
5661
5749
  ...r,
5662
5750
  kind: a,
5663
- payload: Object.fromEntries(Object.entries(i).map(([e, t]) => [e, Q(t)]))
5751
+ payload: Object.fromEntries(Object.entries(i).map(([e, t]) => [e, J(t)]))
5664
5752
  };
5665
5753
  case "node.started":
5666
5754
  case "node.completed":
@@ -5669,22 +5757,22 @@ function vl(e) {
5669
5757
  case "node.progress":
5670
5758
  case "node.artifact": {
5671
5759
  let e = {
5672
- flowId: Y(i.flowId),
5673
- scopeId: Y(i.scopeId),
5674
- nodeId: Y(i.nodeId),
5675
- executionId: Y(i.executionId)
5760
+ flowId: G(i.flowId),
5761
+ scopeId: G(i.scopeId),
5762
+ nodeId: G(i.nodeId),
5763
+ executionId: G(i.executionId)
5676
5764
  };
5677
5765
  switch (a) {
5678
5766
  case "node.started": {
5679
5767
  let t = i.nodeKind;
5680
- return t !== void 0 && t !== "condition" && t !== "connector" && t !== "javascript" && t !== "llm" && t !== "agent" && t !== "subflow" && t !== "value" && t !== "wait" ? q() : {
5768
+ return t !== void 0 && t !== "condition" && t !== "connector" && t !== "javascript" && t !== "llm" && t !== "agent" && t !== "subflow" && t !== "value" && t !== "wait" ? U() : {
5681
5769
  ...r,
5682
5770
  kind: a,
5683
5771
  payload: {
5684
5772
  ...e,
5685
5773
  ...t === void 0 ? {} : { nodeKind: t },
5686
- ...i.nodeTitle === void 0 ? {} : { nodeTitle: Y(i.nodeTitle) },
5687
- ...i.operation === void 0 ? {} : { operation: Y(i.operation) }
5774
+ ...i.nodeTitle === void 0 ? {} : { nodeTitle: G(i.nodeTitle) },
5775
+ ...i.operation === void 0 ? {} : { operation: G(i.operation) }
5688
5776
  }
5689
5777
  };
5690
5778
  }
@@ -5693,32 +5781,32 @@ function vl(e) {
5693
5781
  kind: a,
5694
5782
  payload: {
5695
5783
  ...e,
5696
- outputs: Object.fromEntries(Object.entries(J(i.outputs)).map(([e, t]) => [e, Q(t)]))
5784
+ outputs: Object.fromEntries(Object.entries(W(i.outputs)).map(([e, t]) => [e, J(t)]))
5697
5785
  }
5698
5786
  };
5699
5787
  case "node.failed": {
5700
- let t = J(i.error);
5788
+ let t = W(i.error);
5701
5789
  return {
5702
5790
  ...r,
5703
5791
  kind: a,
5704
5792
  payload: {
5705
5793
  ...e,
5706
5794
  error: {
5707
- code: Y(t.code),
5708
- message: Y(t.message)
5795
+ code: G(t.code),
5796
+ message: G(t.message)
5709
5797
  }
5710
5798
  }
5711
5799
  };
5712
5800
  }
5713
5801
  case "node.log": {
5714
5802
  let t = i.level;
5715
- return t !== "debug" && t !== "info" && t !== "warn" && t !== "error" ? q() : {
5803
+ return t !== "debug" && t !== "info" && t !== "warn" && t !== "error" ? U() : {
5716
5804
  ...r,
5717
5805
  kind: a,
5718
5806
  payload: {
5719
5807
  ...e,
5720
5808
  level: t,
5721
- message: Y(i.message)
5809
+ message: G(i.message)
5722
5810
  }
5723
5811
  };
5724
5812
  }
@@ -5727,124 +5815,52 @@ function vl(e) {
5727
5815
  kind: a,
5728
5816
  payload: {
5729
5817
  ...e,
5730
- progress: yl(i.progress)
5818
+ progress: xl(i.progress)
5731
5819
  }
5732
5820
  };
5733
5821
  case "node.artifact": {
5734
- let t = J(i.artifact), n = Z(t.size), o = Y(t.digest);
5735
- return t.kind != "artifact" || n < 0 || !/^sha256:[0-9a-f]{64}$/.test(o) ? q() : {
5822
+ let t = W(i.artifact), n = q(t.size), o = G(t.digest);
5823
+ return t.kind != "artifact" || n < 0 || !/^sha256:[0-9a-f]{64}$/.test(o) ? U() : {
5736
5824
  ...r,
5737
5825
  kind: a,
5738
5826
  payload: {
5739
5827
  ...e,
5740
5828
  artifact: {
5741
5829
  kind: "artifact",
5742
- id: Y(t.id),
5743
- name: Y(t.name),
5830
+ id: G(t.id),
5831
+ name: G(t.name),
5744
5832
  size: n,
5745
5833
  digest: o,
5746
- ...t.mediaType === void 0 ? {} : { mediaType: Y(t.mediaType) }
5834
+ ...t.mediaType === void 0 ? {} : { mediaType: G(t.mediaType) }
5747
5835
  }
5748
5836
  }
5749
5837
  };
5750
5838
  }
5751
5839
  }
5752
5840
  }
5753
- default: return q();
5841
+ default: return U();
5754
5842
  }
5755
5843
  }
5756
- function yl(e) {
5757
- return typeof e == "number" && Number.isFinite(e) && e >= 0 && e <= 100 ? e : q();
5844
+ function xl(e) {
5845
+ return typeof e == "number" && Number.isFinite(e) && e >= 0 && e <= 100 ? e : U();
5758
5846
  }
5759
- function bl(e) {
5760
- let t = J(e), n = t.eventsExpiresAt, r = Z(t.nextAfter);
5761
- return t.version != 1 || !Array.isArray(t.events) || typeof t.done != "boolean" || typeof t.historyComplete != "boolean" || n != null && typeof n != "string" || r < 0 ? q() : {
5847
+ function Sl(e) {
5848
+ let t = W(e), n = t.eventsExpiresAt, r = q(t.nextAfter);
5849
+ return t.version != 1 || !Array.isArray(t.events) || typeof t.done != "boolean" || typeof t.historyComplete != "boolean" || n != null && typeof n != "string" || r < 0 ? U() : {
5762
5850
  done: t.done,
5763
- events: t.events.map(vl),
5851
+ events: t.events.map(bl),
5764
5852
  ...n == null ? {} : { eventsExpiresAt: n },
5765
5853
  historyComplete: t.historyComplete,
5766
5854
  nextAfter: r,
5767
- runId: Y(t.runId),
5768
- version: 1
5769
- };
5770
- }
5771
- function xl(e) {
5772
- let t = J(e), n = pl(t.status);
5773
- return t.version != 1 || typeof t.cancelAccepted != "boolean" || n == "queued" || n == "starting" || n == "running" || n == "waiting" ? q() : {
5774
- cancelAccepted: t.cancelAccepted,
5775
- runId: Y(t.runId),
5776
- status: n,
5777
- version: 1
5778
- };
5779
- }
5780
- function Sl(e) {
5781
- let t = J(e);
5782
- X(t, [
5783
- "action",
5784
- "resolutionAccepted",
5785
- "resolvedAt",
5786
- "runId",
5787
- "status",
5788
- "version",
5789
- "waitId"
5790
- ]);
5791
- let n = t.action, r = t.resolvedAt;
5792
- return t.version != 1 || typeof t.resolutionAccepted != "boolean" || n !== null && n != "approve" && n != "continue" && n != "reject" || r !== null && typeof r != "string" || n === null != (r === null) || t.resolutionAccepted && n === null ? q() : {
5793
- action: n,
5794
- resolutionAccepted: t.resolutionAccepted,
5795
- resolvedAt: r,
5796
- runId: Y(t.runId),
5797
- status: pl(t.status),
5798
- version: 1,
5799
- waitId: Y(t.waitId)
5800
- };
5801
- }
5802
- function Cl(e) {
5803
- let t = J(e), n = t.status;
5804
- if (t.version != 1) return q();
5805
- let r = {
5806
- finishedAt: Y(t.finishedAt),
5807
- runId: Y(t.runId),
5855
+ runId: G(t.runId),
5808
5856
  version: 1
5809
5857
  };
5810
- if (n == "completed") return Object.hasOwn(t, "result") ? {
5811
- ...r,
5812
- result: t.result,
5813
- status: "completed"
5814
- } : q();
5815
- if (n == "canceled") return {
5816
- ...r,
5817
- status: "canceled"
5818
- };
5819
- if (n == "failed") {
5820
- let e = J(t.error);
5821
- return {
5822
- ...r,
5823
- error: {
5824
- code: Y(e.code),
5825
- message: Y(e.message)
5826
- },
5827
- status: "failed"
5828
- };
5829
- }
5830
- if (n == "indeterminate") {
5831
- let e = J(t.error);
5832
- return {
5833
- ...r,
5834
- error: {
5835
- code: Y(e.code),
5836
- message: Y(e.message)
5837
- },
5838
- status: "indeterminate"
5839
- };
5840
- }
5841
- return q();
5842
5858
  }
5843
5859
  var $ = encodeURIComponent;
5844
- function wl(e) {
5845
- return `${e}-${Nc()}`;
5860
+ function Cl(e) {
5861
+ return `${e}-${yl()}`;
5846
5862
  }
5847
- var Tl = class {
5863
+ var wl = class {
5848
5864
  constructor(e) {
5849
5865
  this.requestControl = e;
5850
5866
  }
@@ -5852,30 +5868,30 @@ var Tl = class {
5852
5868
  let t = new URLSearchParams();
5853
5869
  e.cursor != null && t.set("cursor", e.cursor), e.limit != null && t.set("limit", String(e.limit)), e.includeTotal != null && t.set("includeTotal", String(e.includeTotal));
5854
5870
  let n = t.size == 0 ? "" : `?${t}`;
5855
- return $c(await this.request(`/v1/flows${n}`));
5871
+ return lc(await this.request(`/v1/flows${n}`));
5856
5872
  }
5857
5873
  async listVariables() {
5858
- let e = J(await this.request("/v1/variables"));
5859
- return X(e, ["variables", "version"]), e.version != 1 || !Array.isArray(e.variables) ? q() : {
5860
- variables: e.variables.map(el),
5874
+ let e = W(await this.request("/v1/variables"));
5875
+ return K(e, ["variables", "version"]), e.version != 1 || !Array.isArray(e.variables) ? U() : {
5876
+ variables: e.variables.map(uc),
5861
5877
  version: 1
5862
5878
  };
5863
5879
  }
5864
5880
  async getVariable(e) {
5865
- return el(await this.request(`/v1/variables/${$(e)}`));
5881
+ return uc(await this.request(`/v1/variables/${$(e)}`));
5866
5882
  }
5867
5883
  async putVariable(e, t) {
5868
- return el(await this.request(`/v1/variables/${$(e)}`, {
5884
+ return uc(await this.request(`/v1/variables/${$(e)}`, {
5869
5885
  body: JSON.stringify({ value: t }),
5870
5886
  method: "PUT"
5871
5887
  }));
5872
5888
  }
5873
5889
  async deleteVariable(e) {
5874
- let t = J(await this.request(`/v1/variables/${$(e)}`, { method: "DELETE" }));
5875
- if (X(t, ["version"]), t.version != 1) return q();
5890
+ let t = W(await this.request(`/v1/variables/${$(e)}`, { method: "DELETE" }));
5891
+ if (K(t, ["version"]), t.version != 1) return U();
5876
5892
  }
5877
- async createFlow(e, t = `flow-${Nc()}`) {
5878
- return Qc(await this.request("/v1/flows", {
5893
+ async createFlow(e, t = `flow-${yl()}`) {
5894
+ return cc(await this.request("/v1/flows", {
5879
5895
  body: JSON.stringify({
5880
5896
  name: e,
5881
5897
  version: 1
@@ -5885,10 +5901,10 @@ var Tl = class {
5885
5901
  }));
5886
5902
  }
5887
5903
  async getFlow(e) {
5888
- return Qc(await this.request(`/v1/flows/${$(e)}`));
5904
+ return cc(await this.request(`/v1/flows/${$(e)}`));
5889
5905
  }
5890
5906
  async renameFlow(e, t) {
5891
- return Qc(await this.request(`/v1/flows/${$(e)}`, {
5907
+ return cc(await this.request(`/v1/flows/${$(e)}`, {
5892
5908
  body: JSON.stringify({
5893
5909
  name: t,
5894
5910
  version: 1
@@ -5897,84 +5913,84 @@ var Tl = class {
5897
5913
  }));
5898
5914
  }
5899
5915
  async deleteFlow(e) {
5900
- return Qc(await this.request(`/v1/flows/${$(e)}`, { method: "DELETE" }));
5916
+ return cc(await this.request(`/v1/flows/${$(e)}`, { method: "DELETE" }));
5901
5917
  }
5902
5918
  async listTriggerKeys(e) {
5903
- let t = J(await this.request("/v1/trigger-keys", { signal: e }));
5904
- return t.version != 1 || !Array.isArray(t.keys) ? q() : t.keys.map(Vc);
5919
+ let t = W(await this.request("/v1/trigger-keys", { signal: e }));
5920
+ return t.version != 1 || !Array.isArray(t.keys) ? U() : t.keys.map(ll);
5905
5921
  }
5906
5922
  async listTriggerDefinitions(e) {
5907
- let t = J(await this.request("/v1/trigger-keys/catalog", { signal: e }));
5908
- return t.version != 1 || !Array.isArray(t.definitions) ? q() : t.definitions.map(Hc);
5923
+ let t = W(await this.request("/v1/trigger-keys/catalog", { signal: e }));
5924
+ return t.version != 1 || !Array.isArray(t.definitions) ? U() : t.definitions.map(ul);
5909
5925
  }
5910
5926
  async getTriggerKey(e, t) {
5911
- let n = J(await this.request(`/v1/trigger-keys/${$(e)}`, { signal: t }));
5912
- return n.version == 1 ? Hc(n.definition) : q();
5927
+ let n = W(await this.request(`/v1/trigger-keys/${$(e)}`, { signal: t }));
5928
+ return n.version == 1 ? ul(n.definition) : U();
5913
5929
  }
5914
5930
  async listFlowTriggerBindings(e, t) {
5915
- let n = J(await this.request(`/v1/flows/${$(e)}/triggers`, { signal: t }));
5916
- return n.version != 1 || Y(n.flowId) != e || !Array.isArray(n.bindings) ? q() : n.bindings.map(qc);
5931
+ let n = W(await this.request(`/v1/flows/${$(e)}/triggers`, { signal: t }));
5932
+ return n.version != 1 || G(n.flowId) != e || !Array.isArray(n.bindings) ? U() : n.bindings.map(ml);
5917
5933
  }
5918
5934
  async getFlowTriggerBinding(e, t) {
5919
- return Jc(await this.request(`/v1/flows/${$(e)}/triggers/${$(t)}`));
5935
+ return hl(await this.request(`/v1/flows/${$(e)}/triggers/${$(t)}`));
5920
5936
  }
5921
5937
  async listFlowTriggerActivities(e, t, n = {}) {
5922
5938
  let r = new URLSearchParams();
5923
5939
  n.cursor != null && r.set("cursor", n.cursor), n.limit != null && r.set("limit", String(n.limit));
5924
5940
  let i = r.size == 0 ? "" : `?${r}`;
5925
- return Xc(await this.request(`/v1/flows/${$(e)}/triggers/${$(t)}/activities${i}`));
5941
+ return _l(await this.request(`/v1/flows/${$(e)}/triggers/${$(t)}/activities${i}`));
5926
5942
  }
5927
5943
  async pauseFlowTrigger(e, t) {
5928
- return qc(await this.request(`/v1/flows/${$(e)}/triggers/${$(t)}/pause`, {
5944
+ return ml(await this.request(`/v1/flows/${$(e)}/triggers/${$(t)}/pause`, {
5929
5945
  body: JSON.stringify({ version: 1 }),
5930
5946
  method: "POST"
5931
5947
  }));
5932
5948
  }
5933
5949
  async resumeFlowTrigger(e, t) {
5934
- return qc(await this.request(`/v1/flows/${$(e)}/triggers/${$(t)}/resume`, {
5950
+ return ml(await this.request(`/v1/flows/${$(e)}/triggers/${$(t)}/resume`, {
5935
5951
  body: JSON.stringify({ version: 1 }),
5936
5952
  method: "POST"
5937
5953
  }));
5938
5954
  }
5939
5955
  async testFlowPollTrigger(e, t) {
5940
- return Zc(await this.request(`/v1/flows/${$(e)}/triggers/${$(t)}/test`, {
5956
+ return vl(await this.request(`/v1/flows/${$(e)}/triggers/${$(t)}/test`, {
5941
5957
  body: JSON.stringify({ version: 1 }),
5942
5958
  method: "POST"
5943
5959
  }));
5944
5960
  }
5945
5961
  async getEditor(e) {
5946
- let t = J(await this.request(`/v1/flows/${$(e)}/editor`));
5947
- if (X(t, [
5962
+ let t = W(await this.request(`/v1/flows/${$(e)}/editor`));
5963
+ if (K(t, [
5948
5964
  "flow",
5949
5965
  "draft",
5950
5966
  "live",
5951
5967
  "presentation",
5952
5968
  "version"
5953
- ]), t.version != 1) return q();
5969
+ ]), t.version != 1) return U();
5954
5970
  let n = {
5955
- flow: Qc(t.flow),
5956
- draft: nl(t.draft),
5957
- live: ul(t.live),
5958
- presentation: rl(t.presentation),
5971
+ flow: cc(t.flow),
5972
+ draft: Xc(t.draft),
5973
+ live: pc(t.live),
5974
+ presentation: Zc(t.presentation),
5959
5975
  version: 1
5960
5976
  };
5961
- return n.flow.flowId != e || n.draft.flowId != e || n.live.flowId != e || n.flow.draftRevisionId != n.draft.revisionId ? q() : n;
5977
+ return n.flow.flowId != e || n.draft.flowId != e || n.live.flowId != e || n.flow.draftRevisionId != n.draft.revisionId ? U() : n;
5962
5978
  }
5963
5979
  async getPresentation(e) {
5964
- return rl(await this.request(`/v1/flows/${$(e)}/presentation`));
5980
+ return Zc(await this.request(`/v1/flows/${$(e)}/presentation`));
5965
5981
  }
5966
5982
  async getDraft(e) {
5967
- return nl(await this.request(`/v1/flows/${$(e)}/draft`));
5983
+ return Xc(await this.request(`/v1/flows/${$(e)}/draft`));
5968
5984
  }
5969
5985
  async syncDraft(e) {
5970
- return al(await this.request(`/v1/flows/${$(e)}/draft/sync`));
5986
+ return $c(await this.request(`/v1/flows/${$(e)}/draft/sync`));
5971
5987
  }
5972
5988
  async getRevision(e, t) {
5973
- return nl(await this.request(`/v1/flows/${$(e)}/revisions/${$(t)}`));
5989
+ return Xc(await this.request(`/v1/flows/${$(e)}/revisions/${$(t)}`));
5974
5990
  }
5975
5991
  async listConnectorProviders(e, t) {
5976
- let n = J(await this.request(`/v1/connector/providers${t == null ? "" : `?flowId=${$(t)}`}`, { signal: e }));
5977
- return X(n, ["providers", "version"]), n.version != 1 || !Array.isArray(n.providers) ? q() : n.providers.map(Bc);
5992
+ let n = W(await this.request(`/v1/connector/providers${t == null ? "" : `?flowId=${$(t)}`}`, { signal: e }));
5993
+ return K(n, ["providers", "version"]), n.version != 1 || !Array.isArray(n.providers) ? U() : n.providers.map(sc);
5978
5994
  }
5979
5995
  async listConnectorActions(e, t, n) {
5980
5996
  return await this.connectorActions({
@@ -5989,32 +6005,32 @@ var Tl = class {
5989
6005
  }, t);
5990
6006
  }
5991
6007
  async getConnectorAction(e, t, n) {
5992
- let r = J(await this.request(`/v1/connector/actions/${$(e)}${n == null ? "" : `?flowId=${$(n)}`}`, { signal: t }));
5993
- return X(r, ["action", "version"]), r.version == 1 ? zc(r.action) : q();
6008
+ let r = W(await this.request(`/v1/connector/actions/${$(e)}${n == null ? "" : `?flowId=${$(n)}`}`, { signal: t }));
6009
+ return K(r, ["action", "version"]), r.version == 1 ? oc(r.action) : U();
5994
6010
  }
5995
6011
  async listConnectorConnections(e, t, n) {
5996
- let r = J(await this.request(`/v1/connector/connections/${$(e)}${n == null ? "" : `?flowId=${$(n)}`}`, { signal: t }));
5997
- return X(r, [
6012
+ let r = W(await this.request(`/v1/connector/connections/${$(e)}${n == null ? "" : `?flowId=${$(n)}`}`, { signal: t }));
6013
+ return K(r, [
5998
6014
  "connections",
5999
6015
  "serviceId",
6000
6016
  "version"
6001
- ]), r.version != 1 || Y(r.serviceId) != e || !Array.isArray(r.connections) ? q() : r.connections.map(Fc);
6017
+ ]), r.version != 1 || G(r.serviceId) != e || !Array.isArray(r.connections) ? U() : r.connections.map(nc);
6002
6018
  }
6003
6019
  async createConnectorConnectionPage(e, t) {
6004
- let n = J(await this.request(`/v1/connector/connections/${$(e)}/page${t == null ? "" : `?flowId=${$(t)}`}`, {
6020
+ let n = W(await this.request(`/v1/connector/connections/${$(e)}/page${t == null ? "" : `?flowId=${$(t)}`}`, {
6005
6021
  body: JSON.stringify({ version: 1 }),
6006
6022
  method: "POST"
6007
6023
  }));
6008
- if (X(n, ["url", "version"]), n.version != 1) return q();
6024
+ if (K(n, ["url", "version"]), n.version != 1) return U();
6009
6025
  try {
6010
- let e = new URL(Y(n.url));
6011
- return e.protocol != "http:" && e.protocol != "https:" ? q() : e.href;
6026
+ let e = new URL(G(n.url));
6027
+ return e.protocol != "http:" && e.protocol != "https:" ? U() : e.href;
6012
6028
  } catch {
6013
- return q();
6029
+ return U();
6014
6030
  }
6015
6031
  }
6016
- async changeDraft(e, t, n, r = wl("change")) {
6017
- return il(await this.request(`/v1/flows/${$(e)}/draft/changes`, {
6032
+ async changeDraft(e, t, n, r = Cl("change")) {
6033
+ return Qc(await this.request(`/v1/flows/${$(e)}/draft/changes`, {
6018
6034
  body: JSON.stringify({
6019
6035
  expectedRevisionId: t,
6020
6036
  operations: n,
@@ -6025,7 +6041,7 @@ var Tl = class {
6025
6041
  }));
6026
6042
  }
6027
6043
  async checkFlow(e, t) {
6028
- return ll(await this.request(`/v1/flows/${$(e)}/revisions/${$(t)}/check`, {
6044
+ return tc(await this.request(`/v1/flows/${$(e)}/revisions/${$(t)}/check`, {
6029
6045
  body: JSON.stringify({
6030
6046
  engineContract: "open-flow-engine/v2",
6031
6047
  version: 1
@@ -6034,42 +6050,42 @@ var Tl = class {
6034
6050
  }));
6035
6051
  }
6036
6052
  async getLive(e, t) {
6037
- return ul(await this.request(`/v1/flows/${$(e)}/live`, { signal: t }));
6053
+ return pc(await this.request(`/v1/flows/${$(e)}/live`, { signal: t }));
6038
6054
  }
6039
6055
  async listPublications(e, t = {}, n) {
6040
6056
  let r = new URLSearchParams();
6041
6057
  t.cursor != null && r.set("cursor", t.cursor), t.limit != null && r.set("limit", String(t.limit)), t.includeTotal != null && r.set("includeTotal", String(t.includeTotal));
6042
6058
  let i = r.size == 0 ? "" : `?${r}`;
6043
- return dl(await this.request(`/v1/flows/${$(e)}/publications${i}`, { signal: n }));
6059
+ return mc(await this.request(`/v1/flows/${$(e)}/publications${i}`, { signal: n }));
6044
6060
  }
6045
6061
  async createDraftRun(e, t, n) {
6046
- let r = gl(await this.request(`/v1/flows/${$(e)}/revisions/${$(t)}/runs`, {
6062
+ let r = il(await this.request(`/v1/flows/${$(e)}/revisions/${$(t)}/runs`, {
6047
6063
  body: JSON.stringify({
6048
6064
  engineContract: "open-flow-engine/v2",
6049
6065
  inputs: n.inputs ?? {},
6050
6066
  trigger: n.trigger,
6051
6067
  version: 1
6052
6068
  }),
6053
- headers: { "idempotency-key": n.idempotencyKey ?? wl("run") },
6069
+ headers: { "idempotency-key": n.idempotencyKey ?? Cl("run") },
6054
6070
  method: "POST"
6055
6071
  }));
6056
- return r.source == "draft" ? r : q();
6072
+ return r.source == "draft" ? r : U();
6057
6073
  }
6058
6074
  async createLiveRun(e, t) {
6059
- let n = gl(await this.request("/v1/runs", {
6075
+ let n = il(await this.request("/v1/runs", {
6060
6076
  body: JSON.stringify({
6061
6077
  inputs: t.inputs ?? {},
6062
6078
  trigger: t.trigger,
6063
6079
  publicationId: e,
6064
6080
  version: 1
6065
6081
  }),
6066
- headers: { "idempotency-key": t.idempotencyKey ?? wl("run") },
6082
+ headers: { "idempotency-key": t.idempotencyKey ?? Cl("run") },
6067
6083
  method: "POST"
6068
6084
  }));
6069
- return n.source == "live" ? n : q();
6085
+ return n.source == "live" ? n : U();
6070
6086
  }
6071
6087
  async setFlowEnabled(e, t, n) {
6072
- return Qc(await this.request(`/v1/flows/${$(e)}/enabled`, {
6088
+ return cc(await this.request(`/v1/flows/${$(e)}/enabled`, {
6073
6089
  method: "PUT",
6074
6090
  body: JSON.stringify({
6075
6091
  enabled: n,
@@ -6079,43 +6095,43 @@ var Tl = class {
6079
6095
  }));
6080
6096
  }
6081
6097
  async publishFlow(e, t, n, r = {}) {
6082
- return sl(await this.request(`/v1/flows/${$(e)}/revisions/${$(t)}/publications`, {
6098
+ return fc(await this.request(`/v1/flows/${$(e)}/revisions/${$(t)}/publications`, {
6083
6099
  body: JSON.stringify({
6084
6100
  engineContract: "open-flow-engine/v2",
6085
6101
  expectedLivePublicationId: n,
6086
6102
  version: 1
6087
6103
  }),
6088
- headers: { "idempotency-key": r.idempotencyKey ?? wl("publication") },
6104
+ headers: { "idempotency-key": r.idempotencyKey ?? Cl("publication") },
6089
6105
  method: "POST"
6090
6106
  }));
6091
6107
  }
6092
6108
  async getPublishOperation(e, t, n) {
6093
- return sl(await this.request(`/v1/flows/${$(e)}/publish-operations/${$(t)}`, { signal: n }));
6109
+ return fc(await this.request(`/v1/flows/${$(e)}/publish-operations/${$(t)}`, { signal: n }));
6094
6110
  }
6095
6111
  async rollbackFlow(e, t, n, r = {}) {
6096
- return ol(await this.request(`/v1/flows/${$(e)}/publications/${$(t)}/rollback`, {
6112
+ return dc(await this.request(`/v1/flows/${$(e)}/publications/${$(t)}/rollback`, {
6097
6113
  body: JSON.stringify({
6098
6114
  expectedLivePublicationId: n,
6099
6115
  version: 1
6100
6116
  }),
6101
- headers: { "idempotency-key": r.idempotencyKey ?? wl("publication") },
6117
+ headers: { "idempotency-key": r.idempotencyKey ?? Cl("publication") },
6102
6118
  method: "POST"
6103
6119
  }));
6104
6120
  }
6105
6121
  async getRun(e, t) {
6106
- return gl(await this.request(`/v1/runs/${$(e)}`, { signal: t }));
6122
+ return il(await this.request(`/v1/runs/${$(e)}`, { signal: t }));
6107
6123
  }
6108
6124
  async listRuns(e, t = {}) {
6109
6125
  let n = new URLSearchParams();
6110
6126
  t.cursor != null && n.set("cursor", t.cursor), t.limit != null && n.set("limit", String(t.limit)), t.status != null && n.set("status", t.status);
6111
6127
  let r = n.size == 0 ? "" : `?${n}`;
6112
- return _l(await this.request(`/v1/flows/${$(e)}/runs${r}`));
6128
+ return al(await this.request(`/v1/flows/${$(e)}/runs${r}`));
6113
6129
  }
6114
6130
  async getRunEvents(e, t = {}, n) {
6115
6131
  let r = new URLSearchParams();
6116
6132
  t.after != null && r.set("after", String(t.after)), t.limit != null && r.set("limit", String(t.limit));
6117
6133
  let i = r.size == 0 ? "" : `?${r}`;
6118
- return bl(await this.request(`/v1/runs/${$(e)}/events${i}`, { signal: n }));
6134
+ return Sl(await this.request(`/v1/runs/${$(e)}/events${i}`, { signal: n }));
6119
6135
  }
6120
6136
  async listRunResults(e, t, n) {
6121
6137
  return Gs(await this.request(`/v1/runs/${$(e)}/results${t == null ? "" : `?after=${encodeURIComponent(t)}`}`, { signal: n }));
@@ -6128,16 +6144,16 @@ var Tl = class {
6128
6144
  return (await this.response(`/v1/runs/${$(e)}/results/${$(t)}/content`, { signal: n })).blob();
6129
6145
  }
6130
6146
  async getRunResult(e, t) {
6131
- return Cl(await this.request(`/v1/runs/${$(e)}/result`, { signal: t }));
6147
+ return cl(await this.request(`/v1/runs/${$(e)}/result`, { signal: t }));
6132
6148
  }
6133
6149
  async cancelRun(e) {
6134
- return xl(await this.request(`/v1/runs/${$(e)}/cancel`, {
6150
+ return ol(await this.request(`/v1/runs/${$(e)}/cancel`, {
6135
6151
  body: JSON.stringify({ version: 1 }),
6136
6152
  method: "POST"
6137
6153
  }));
6138
6154
  }
6139
6155
  async resolveRunWait(e, t, n) {
6140
- return Sl(await this.request(`/v1/runs/${$(e)}/waits/${$(t)}/resolve`, {
6156
+ return sl(await this.request(`/v1/runs/${$(e)}/waits/${$(t)}/resolve`, {
6141
6157
  body: JSON.stringify({
6142
6158
  action: n,
6143
6159
  version: 1
@@ -6146,8 +6162,8 @@ var Tl = class {
6146
6162
  }));
6147
6163
  }
6148
6164
  async connectorActions(e, t) {
6149
- let n = Object.entries(e).map(([e, t]) => `${$(e)}=${$(t)}`).join("&"), r = n == "" ? "" : `?${n}`, i = J(await this.request(`/v1/connector/actions${r}`, { signal: t }));
6150
- return X(i, ["actions", "version"]), i.version != 1 || !Array.isArray(i.actions) ? q() : i.actions.map(zc);
6165
+ let n = Object.entries(e).map(([e, t]) => `${$(e)}=${$(t)}`).join("&"), r = n == "" ? "" : `?${n}`, i = W(await this.request(`/v1/connector/actions${r}`, { signal: t }));
6166
+ return K(i, ["actions", "version"]), i.version != 1 || !Array.isArray(i.actions) ? U() : i.actions.map(oc);
6151
6167
  }
6152
6168
  async response(e, t) {
6153
6169
  let n = new Headers(t.headers);
@@ -6161,10 +6177,10 @@ var Tl = class {
6161
6177
  try {
6162
6178
  e = await r.json();
6163
6179
  } catch {
6164
- return q();
6180
+ return U();
6165
6181
  }
6166
- let t = J(e).error, n = t == null ? void 0 : J(t);
6167
- throw new Pc(r.status, typeof n?.code == "string" ? n.code : "request.failed", typeof n?.message == "string" ? n.message : `Request failed with status ${r.status}.`);
6182
+ let t = W(e).error, n = t == null ? void 0 : W(t);
6183
+ throw new Qs(r.status, typeof n?.code == "string" ? n.code : "request.failed", typeof n?.message == "string" ? n.message : `Request failed with status ${r.status}.`);
6168
6184
  }
6169
6185
  return r;
6170
6186
  }
@@ -6173,9 +6189,9 @@ var Tl = class {
6173
6189
  try {
6174
6190
  return await n.json();
6175
6191
  } catch {
6176
- return q();
6192
+ return U();
6177
6193
  }
6178
6194
  }
6179
6195
  };
6180
6196
  //#endregion
6181
- export { Pc as ApiError, Tl as ControlClient, K as controlErrorCode, jc as controlErrorMetadata, Gs as decodeResultList, Ks as decodeResultRead, vl as decodeRunEvent, Ws as parseResultQuery, Xs as readResult };
6197
+ export { Qs as ApiError, wl as ControlClient, H as controlErrorCode, Zs as controlErrorMetadata, Gs as decodeResultList, Ks as decodeResultRead, bl as decodeRunEvent, Ws as parseResultQuery, Xs as readResult };