@relyio/sdk 0.18.0 → 0.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/automations/index.cjs +18 -17
  3. package/dist/automations/index.d.cts +289 -8
  4. package/dist/automations/index.d.ts +289 -8
  5. package/dist/automations/index.js +3 -2
  6. package/dist/{chunk-ZHTJ7GXH.js → chunk-356SF5Y2.js} +84 -26
  7. package/dist/{chunk-ZAMAR3X2.cjs → chunk-5F3YYPLZ.cjs} +11249 -10771
  8. package/dist/{chunk-LSI26ZN2.cjs → chunk-DBYMG6MQ.cjs} +5 -5
  9. package/dist/{chunk-SHSK7UUY.cjs → chunk-NN45CSPZ.cjs} +177 -11
  10. package/dist/{chunk-IFKF72VJ.cjs → chunk-P23G5NXD.cjs} +122 -63
  11. package/dist/{chunk-W7JFHSFM.js → chunk-PZCDJFMA.js} +11249 -10772
  12. package/dist/{chunk-EDE2H37D.js → chunk-T7LGREB3.js} +174 -12
  13. package/dist/{chunk-R6E4HE7R.js → chunk-W2GRVXDG.js} +3 -3
  14. package/dist/client/index.cjs +4 -4
  15. package/dist/client/index.d.cts +4 -4
  16. package/dist/client/index.d.ts +4 -4
  17. package/dist/client/index.js +2 -2
  18. package/dist/{define-content-type-NEQDrvdq.d.cts → define-content-type-BZ6X8GvL.d.cts} +1324 -156
  19. package/dist/{define-content-type-fb-WCD5e.d.ts → define-content-type-C12jh8cY.d.ts} +1324 -156
  20. package/dist/{define-schema-Dlwh6l_J.d.ts → define-schema-BPlZl4a2.d.cts} +104 -3
  21. package/dist/{define-schema-DZhtvLiK.d.cts → define-schema-CK7TtYot.d.ts} +104 -3
  22. package/dist/extensions/index.cjs +26 -6
  23. package/dist/extensions/index.d.cts +5 -791
  24. package/dist/extensions/index.d.ts +5 -791
  25. package/dist/extensions/index.js +24 -4
  26. package/dist/functions/index.cjs +7 -4
  27. package/dist/functions/index.d.cts +4 -4
  28. package/dist/functions/index.d.ts +4 -4
  29. package/dist/functions/index.js +5 -2
  30. package/dist/{index-M3luH06A.d.ts → index-BxNnlc5D.d.ts} +91 -73
  31. package/dist/{index-C4LqrNd1.d.ts → index-C-MymZTe.d.ts} +1 -1
  32. package/dist/{index-DwHcL6x5.d.cts → index-D5jyIeQ5.d.cts} +91 -73
  33. package/dist/{index-Dnmt_UOo.d.cts → index-DN0l8RHw.d.cts} +1 -1
  34. package/dist/index.cjs +88 -84
  35. package/dist/index.d.cts +64 -14
  36. package/dist/index.d.ts +64 -14
  37. package/dist/index.js +4 -4
  38. package/dist/preview/index.cjs +3 -3
  39. package/dist/preview/index.js +1 -1
  40. package/dist/{register-B53i97A9.d.ts → register-BiMQKVp-.d.ts} +24 -8
  41. package/dist/{register-BYCs0FpF.d.cts → register-DeMsaurp.d.cts} +24 -8
  42. package/dist/rich-text/index.d.cts +2 -2
  43. package/dist/rich-text/index.d.ts +2 -2
  44. package/dist/schema/index.cjs +41 -40
  45. package/dist/schema/index.d.cts +7 -120
  46. package/dist/schema/index.d.ts +7 -120
  47. package/dist/schema/index.js +2 -1
  48. package/dist/types/index.d.cts +1 -1
  49. package/dist/types/index.d.ts +1 -1
  50. package/package.json +2 -2
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkZAMAR3X2_cjs = require('./chunk-ZAMAR3X2.cjs');
3
+ var chunk5F3YYPLZ_cjs = require('./chunk-5F3YYPLZ.cjs');
4
4
  var chunkL6DXCKVQ_cjs = require('./chunk-L6DXCKVQ.cjs');
5
5
 
6
6
  /* RelyIO SDK - Built with ❤️ by the RelyIO Team */
@@ -30,7 +30,7 @@ function refAt(root, path, becomes) {
30
30
  get(_target, key) {
31
31
  if (key === REF) return { kind: "ref", root, path };
32
32
  if (typeof key !== "string" || key === "then") return void 0;
33
- if (TESTS.has(key)) return chunkZAMAR3X2_cjs.conditionRoot(root, path)[key];
33
+ if (TESTS.has(key)) return chunk5F3YYPLZ_cjs.conditionRoot(root, path)[key];
34
34
  if (becomes && key === "becomes") {
35
35
  return (value) => ({
36
36
  root: "event",
@@ -362,7 +362,7 @@ var STEP_BUILDER = {
362
362
  ...config.agent === void 0 ? {} : { agent: config.agent },
363
363
  instructions: valueOf(config.instructions, `${name}.instructions`),
364
364
  context: inputOf(config.context ?? {}, `${name}.context`),
365
- output: chunkZAMAR3X2_cjs.compileKeyedMembers(config.output),
365
+ output: chunk5F3YYPLZ_cjs.compileKeyedMembers(config.output),
366
366
  ...propose === void 0 ? {} : {
367
367
  propose: propose.map(
368
368
  (type, index) => proposeTargetOf(type, `${name}.propose[${index}]`)
@@ -531,5 +531,5 @@ exports.records = records;
531
531
  exports.resolveAutomation = resolveAutomation;
532
532
  exports.schedule = schedule;
533
533
  exports.tpl = tpl;
534
- //# sourceMappingURL=chunk-LSI26ZN2.cjs.map
535
- //# sourceMappingURL=chunk-LSI26ZN2.cjs.map
534
+ //# sourceMappingURL=chunk-DBYMG6MQ.cjs.map
535
+ //# sourceMappingURL=chunk-DBYMG6MQ.cjs.map
@@ -53,6 +53,26 @@ function refuseMismatchedAlternate(route, stream) {
53
53
  }
54
54
  chunkL6DXCKVQ_cjs.__name(refuseMismatchedAlternate, "refuseMismatchedAlternate");
55
55
 
56
+ // ../../platform/api-contract/dist/chunk-WT7DXIEW.js
57
+ var HEADER_END_USER = {
58
+ name: "X-RelyIO-End-User",
59
+ in: "request",
60
+ required: false
61
+ };
62
+ var END_USER_TOKEN_REFUSAL_REASONS = [
63
+ "missing",
64
+ "no-identity-source",
65
+ "malformed",
66
+ "unsupported-algorithm",
67
+ "wrong-issuer",
68
+ "unknown-key",
69
+ "bad-signature",
70
+ "wrong-audience",
71
+ "expired",
72
+ "not-yet-valid",
73
+ "missing-subject"
74
+ ];
75
+
56
76
  // ../../platform/api-contract/dist/index.js
57
77
  var HEADER_RETRY_AFTER = { name: "Retry-After" };
58
78
  var HEADER_IF_MATCH = {
@@ -400,6 +420,26 @@ var STRIPE_EVENT_FIELDS = [
400
420
  { path: "data.object.object", type: "string", required: true },
401
421
  { path: "data.object.metadata", type: "object", required: false, values: "string" }
402
422
  ];
423
+ var STRIPE_SUBSCRIPTION_FIELDS = [
424
+ ...STRIPE_EVENT_FIELDS,
425
+ { path: "data.object.status", type: "string", required: true },
426
+ { path: "data.object.customer", type: "string", required: true },
427
+ { path: "data.object.cancel_at_period_end", type: "boolean", required: false },
428
+ { path: "data.object.cancel_at", type: "number", required: false },
429
+ { path: "data.object.canceled_at", type: "number", required: false },
430
+ { path: "data.object.ended_at", type: "number", required: false },
431
+ { path: "data.object.start_date", type: "number", required: false },
432
+ { path: "data.object.trial_end", type: "number", required: false }
433
+ ];
434
+ var IDENTITY_CLAIMS_SETTING = "claims";
435
+ var IDENTITY_CLAIMS_SETTING_FIELD = {
436
+ key: IDENTITY_CLAIMS_SETTING,
437
+ label: "Claims",
438
+ type: "text",
439
+ maxLength: 512,
440
+ required: false,
441
+ helpText: "The Claims your Policies read off an End user\u2019s token, by name, separated by commas: `plan, role`. A Claim not named here is never read; one named and missing from a token is absent."
442
+ };
403
443
  var EXTENSION_SURFACES = {
404
444
  webhook: {
405
445
  settings: [],
@@ -449,7 +489,9 @@ var EXTENSION_SURFACES = {
449
489
  }
450
490
  }
451
491
  },
452
- triggers: {}
492
+ triggers: {},
493
+ fieldKinds: {},
494
+ recordTypes: {}
453
495
  },
454
496
  vercel: {
455
497
  settings: [],
@@ -468,7 +510,9 @@ var EXTENSION_SURFACES = {
468
510
  { path: "payload.target", type: "string", required: false }
469
511
  ]
470
512
  }
471
- }
513
+ },
514
+ fieldKinds: {},
515
+ recordTypes: {}
472
516
  },
473
517
  netlify: {
474
518
  settings: [],
@@ -488,11 +532,14 @@ var EXTENSION_SURFACES = {
488
532
  { path: "deploy_ssl_url", type: "string", required: false }
489
533
  ]
490
534
  }
491
- }
535
+ },
536
+ fieldKinds: {},
537
+ recordTypes: {}
492
538
  },
493
- // Triggers only in slice one (spec 3, REL-3853): Stripe tells RelyIO a payment succeeded, failed, a
494
- // Checkout completed or a charge was refunded. No Action: checkout keeps calling Stripe from a
495
- // Function with its own Secret (spec 2).
539
+ // Triggers only (spec 3, REL-3853): Stripe tells RelyIO a payment succeeded, failed, a Checkout
540
+ // completed or a charge was refunded — and, since spec 4 (REL-3893), that a subscription was
541
+ // created, changed or ended. No Action: checkout keeps calling Stripe from a Function with its own
542
+ // Secret (spec 2).
496
543
  stripe: {
497
544
  settings: [],
498
545
  actions: {},
@@ -546,8 +593,26 @@ var EXTENSION_SURFACES = {
546
593
  { path: "data.object.refunded", type: "boolean", required: true },
547
594
  { path: "data.object.payment_intent", type: "string", required: false }
548
595
  ]
596
+ },
597
+ customerSubscriptionCreated: {
598
+ trigger: "customer.subscription.created",
599
+ payload: STRIPE_SUBSCRIPTION_FIELDS
600
+ },
601
+ customerSubscriptionUpdated: {
602
+ trigger: "customer.subscription.updated",
603
+ payload: [
604
+ ...STRIPE_SUBSCRIPTION_FIELDS,
605
+ // The status it had before this change, when the change was to its status
606
+ { path: "data.previous_attributes.status", type: "string", required: false }
607
+ ]
608
+ },
609
+ customerSubscriptionDeleted: {
610
+ trigger: "customer.subscription.deleted",
611
+ payload: STRIPE_SUBSCRIPTION_FIELDS
549
612
  }
550
- }
613
+ },
614
+ fieldKinds: {},
615
+ recordTypes: {}
551
616
  },
552
617
  slack: {
553
618
  settings: [
@@ -611,7 +676,9 @@ var EXTENSION_SURFACES = {
611
676
  }
612
677
  }
613
678
  },
614
- triggers: {}
679
+ triggers: {},
680
+ fieldKinds: {},
681
+ recordTypes: {}
615
682
  },
616
683
  // Resend (spec 3, REL-3854): an email, its Files attached. The sender is the step's, else the
617
684
  // Project's `from`; `html` or `text` is the body, at least one of them.
@@ -679,12 +746,110 @@ var EXTENSION_SURFACES = {
679
746
  }
680
747
  }
681
748
  },
682
- triggers: {}
749
+ triggers: {},
750
+ fieldKinds: {},
751
+ recordTypes: {}
752
+ },
753
+ /**
754
+ * The plain OIDC identity source (spec 4, REL-3880): any issuer that publishes a discovery
755
+ * document — Auth0, Supabase Auth, an own one. Its Connection, per Environment, holds the issuer
756
+ * and the audience; it has no Action and no Trigger. Its one setting is the Claims the Project
757
+ * relies on ({@link IDENTITY_CLAIMS_SETTING}).
758
+ */
759
+ oidc: {
760
+ settings: [IDENTITY_CLAIMS_SETTING_FIELD],
761
+ actions: {},
762
+ triggers: {},
763
+ fieldKinds: {},
764
+ recordTypes: {}
765
+ },
766
+ /**
767
+ * Clerk as an identity source (spec 4, REL-3881): its Connection, per Environment, holds the
768
+ * instance's publishable key — which encodes the Frontend API, and so the issuer — its secret key,
769
+ * its webhook signing secret and the origins its tokens may be minted for. Its one setting so far
770
+ * is the Claims the Project relies on, as `oidc`'s; its Triggers come with its users (spec 4, E3).
771
+ *
772
+ * Its Action, `updateUserMetadata` (REL-3893), merges `publicMetadata` into a Clerk user's public
773
+ * metadata with the Connection's secret key — the newsletter's `syncPlan` sets `{ plan: 'paid' }` —
774
+ * and a session token carries it once the customer adds the Claim to Clerk's session token
775
+ * (`"plan": "{{user.public_metadata.plan}}"`, the Clerk Extension's guide).
776
+ */
777
+ clerk: {
778
+ settings: [IDENTITY_CLAIMS_SETTING_FIELD],
779
+ actions: {
780
+ updateUserMetadata: {
781
+ action: "updateUserMetadata",
782
+ step: {
783
+ input: [
784
+ {
785
+ key: "userId",
786
+ type: "text",
787
+ required: true,
788
+ description: "The Clerk user\u2019s id, `user_\u2026`: a token\u2019s `sub`."
789
+ },
790
+ {
791
+ key: "publicMetadata",
792
+ type: "json",
793
+ required: true,
794
+ description: "An object merged into the user\u2019s public metadata: each key given replaces theirs, a nested object is merged, and a key set to `null` is removed. Keys not given are kept."
795
+ }
796
+ ],
797
+ output: [
798
+ {
799
+ key: "id",
800
+ type: "text",
801
+ required: true,
802
+ description: "The id of the user Clerk updated."
803
+ }
804
+ ],
805
+ sample: { id: "user_sample" },
806
+ // Clerk's Backend API keys nothing to dedupe a request on: an update that succeeded is never
807
+ // sent again, and one whose outcome is unknown is not either.
808
+ idempotencyHeader: null
809
+ }
810
+ }
811
+ },
812
+ triggers: {},
813
+ /**
814
+ * Its one field kind (REL-3894): `clerk.userRef()`, a reference to `clerkUser` that the Studio
815
+ * picks by name or email rather than by pasting an id.
816
+ */
817
+ fieldKinds: {
818
+ userRef: {
819
+ base: { type: "reference", to: "clerkUser" },
820
+ picker: {
821
+ search: ["email", "firstName", "lastName"],
822
+ title: ["firstName", "lastName"],
823
+ description: "email",
824
+ image: "imageUrl"
825
+ }
826
+ }
827
+ },
828
+ /** Its Managed user type (REL-3888): `clerk.user`, the Record kept for each Clerk user. */
829
+ recordTypes: { user: "clerkUser" }
683
830
  }
684
831
  };
832
+ var CONTRIBUTED_FIELD_KIND_OPTION = "fieldKind";
833
+ function contributedFieldKindName(extension, kind) {
834
+ return `${extension}.${kind}`;
835
+ }
836
+ chunkL6DXCKVQ_cjs.__name(contributedFieldKindName, "contributedFieldKindName");
837
+ var EXTENSION_BACKFILL_REFUSALS = [
838
+ "connection-gone",
839
+ "connection-inactive",
840
+ "connection-unreadable",
841
+ "vendor-refused",
842
+ "vendor-unavailable",
843
+ "vendor-answer-unreadable",
844
+ "extension-not-backfilled"
845
+ ];
846
+ new Set(EXTENSION_BACKFILL_REFUSALS);
685
847
 
848
+ exports.CONTRIBUTED_FIELD_KIND_OPTION = CONTRIBUTED_FIELD_KIND_OPTION;
849
+ exports.END_USER_TOKEN_REFUSAL_REASONS = END_USER_TOKEN_REFUSAL_REASONS;
686
850
  exports.EXTENSION_SURFACES = EXTENSION_SURFACES;
687
851
  exports.FRESH_PARAMETER = FRESH_PARAMETER;
852
+ exports.HEADER_END_USER = HEADER_END_USER;
688
853
  exports.HEADER_IDEMPOTENCY_KEY = HEADER_IDEMPOTENCY_KEY;
689
854
  exports.HEADER_IF_MATCH = HEADER_IF_MATCH;
690
855
  exports.HEADER_RETRY_AFTER = HEADER_RETRY_AFTER;
@@ -698,9 +863,10 @@ exports.VISITOR_LIVE_PATH = VISITOR_LIVE_PATH;
698
863
  exports.VISITOR_POLL_INTERVAL_MS = VISITOR_POLL_INTERVAL_MS;
699
864
  exports.VISITOR_POLL_RETRY = VISITOR_POLL_RETRY;
700
865
  exports.VISITOR_QUERY = VISITOR_QUERY;
866
+ exports.contributedFieldKindName = contributedFieldKindName;
701
867
  exports.entityTag = entityTag;
702
868
  exports.parseVisitorFrame = parseVisitorFrame;
703
869
  exports.previewDatasetSlug = previewDatasetSlug;
704
870
  exports.readVisitorPollAnswer = readVisitorPollAnswer;
705
- //# sourceMappingURL=chunk-SHSK7UUY.cjs.map
706
- //# sourceMappingURL=chunk-SHSK7UUY.cjs.map
871
+ //# sourceMappingURL=chunk-NN45CSPZ.cjs.map
872
+ //# sourceMappingURL=chunk-NN45CSPZ.cjs.map