@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
@@ -51,6 +51,26 @@ function refuseMismatchedAlternate(route, stream) {
51
51
  }
52
52
  __name(refuseMismatchedAlternate, "refuseMismatchedAlternate");
53
53
 
54
+ // ../../platform/api-contract/dist/chunk-WT7DXIEW.js
55
+ var HEADER_END_USER = {
56
+ name: "X-RelyIO-End-User",
57
+ in: "request",
58
+ required: false
59
+ };
60
+ var END_USER_TOKEN_REFUSAL_REASONS = [
61
+ "missing",
62
+ "no-identity-source",
63
+ "malformed",
64
+ "unsupported-algorithm",
65
+ "wrong-issuer",
66
+ "unknown-key",
67
+ "bad-signature",
68
+ "wrong-audience",
69
+ "expired",
70
+ "not-yet-valid",
71
+ "missing-subject"
72
+ ];
73
+
54
74
  // ../../platform/api-contract/dist/index.js
55
75
  var HEADER_RETRY_AFTER = { name: "Retry-After" };
56
76
  var HEADER_IF_MATCH = {
@@ -398,6 +418,26 @@ var STRIPE_EVENT_FIELDS = [
398
418
  { path: "data.object.object", type: "string", required: true },
399
419
  { path: "data.object.metadata", type: "object", required: false, values: "string" }
400
420
  ];
421
+ var STRIPE_SUBSCRIPTION_FIELDS = [
422
+ ...STRIPE_EVENT_FIELDS,
423
+ { path: "data.object.status", type: "string", required: true },
424
+ { path: "data.object.customer", type: "string", required: true },
425
+ { path: "data.object.cancel_at_period_end", type: "boolean", required: false },
426
+ { path: "data.object.cancel_at", type: "number", required: false },
427
+ { path: "data.object.canceled_at", type: "number", required: false },
428
+ { path: "data.object.ended_at", type: "number", required: false },
429
+ { path: "data.object.start_date", type: "number", required: false },
430
+ { path: "data.object.trial_end", type: "number", required: false }
431
+ ];
432
+ var IDENTITY_CLAIMS_SETTING = "claims";
433
+ var IDENTITY_CLAIMS_SETTING_FIELD = {
434
+ key: IDENTITY_CLAIMS_SETTING,
435
+ label: "Claims",
436
+ type: "text",
437
+ maxLength: 512,
438
+ required: false,
439
+ 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."
440
+ };
401
441
  var EXTENSION_SURFACES = {
402
442
  webhook: {
403
443
  settings: [],
@@ -447,7 +487,9 @@ var EXTENSION_SURFACES = {
447
487
  }
448
488
  }
449
489
  },
450
- triggers: {}
490
+ triggers: {},
491
+ fieldKinds: {},
492
+ recordTypes: {}
451
493
  },
452
494
  vercel: {
453
495
  settings: [],
@@ -466,7 +508,9 @@ var EXTENSION_SURFACES = {
466
508
  { path: "payload.target", type: "string", required: false }
467
509
  ]
468
510
  }
469
- }
511
+ },
512
+ fieldKinds: {},
513
+ recordTypes: {}
470
514
  },
471
515
  netlify: {
472
516
  settings: [],
@@ -486,11 +530,14 @@ var EXTENSION_SURFACES = {
486
530
  { path: "deploy_ssl_url", type: "string", required: false }
487
531
  ]
488
532
  }
489
- }
533
+ },
534
+ fieldKinds: {},
535
+ recordTypes: {}
490
536
  },
491
- // Triggers only in slice one (spec 3, REL-3853): Stripe tells RelyIO a payment succeeded, failed, a
492
- // Checkout completed or a charge was refunded. No Action: checkout keeps calling Stripe from a
493
- // Function with its own Secret (spec 2).
537
+ // Triggers only (spec 3, REL-3853): Stripe tells RelyIO a payment succeeded, failed, a Checkout
538
+ // completed or a charge was refunded — and, since spec 4 (REL-3893), that a subscription was
539
+ // created, changed or ended. No Action: checkout keeps calling Stripe from a Function with its own
540
+ // Secret (spec 2).
494
541
  stripe: {
495
542
  settings: [],
496
543
  actions: {},
@@ -544,8 +591,26 @@ var EXTENSION_SURFACES = {
544
591
  { path: "data.object.refunded", type: "boolean", required: true },
545
592
  { path: "data.object.payment_intent", type: "string", required: false }
546
593
  ]
594
+ },
595
+ customerSubscriptionCreated: {
596
+ trigger: "customer.subscription.created",
597
+ payload: STRIPE_SUBSCRIPTION_FIELDS
598
+ },
599
+ customerSubscriptionUpdated: {
600
+ trigger: "customer.subscription.updated",
601
+ payload: [
602
+ ...STRIPE_SUBSCRIPTION_FIELDS,
603
+ // The status it had before this change, when the change was to its status
604
+ { path: "data.previous_attributes.status", type: "string", required: false }
605
+ ]
606
+ },
607
+ customerSubscriptionDeleted: {
608
+ trigger: "customer.subscription.deleted",
609
+ payload: STRIPE_SUBSCRIPTION_FIELDS
547
610
  }
548
- }
611
+ },
612
+ fieldKinds: {},
613
+ recordTypes: {}
549
614
  },
550
615
  slack: {
551
616
  settings: [
@@ -609,7 +674,9 @@ var EXTENSION_SURFACES = {
609
674
  }
610
675
  }
611
676
  },
612
- triggers: {}
677
+ triggers: {},
678
+ fieldKinds: {},
679
+ recordTypes: {}
613
680
  },
614
681
  // Resend (spec 3, REL-3854): an email, its Files attached. The sender is the step's, else the
615
682
  // Project's `from`; `html` or `text` is the body, at least one of them.
@@ -677,10 +744,105 @@ var EXTENSION_SURFACES = {
677
744
  }
678
745
  }
679
746
  },
680
- triggers: {}
747
+ triggers: {},
748
+ fieldKinds: {},
749
+ recordTypes: {}
750
+ },
751
+ /**
752
+ * The plain OIDC identity source (spec 4, REL-3880): any issuer that publishes a discovery
753
+ * document — Auth0, Supabase Auth, an own one. Its Connection, per Environment, holds the issuer
754
+ * and the audience; it has no Action and no Trigger. Its one setting is the Claims the Project
755
+ * relies on ({@link IDENTITY_CLAIMS_SETTING}).
756
+ */
757
+ oidc: {
758
+ settings: [IDENTITY_CLAIMS_SETTING_FIELD],
759
+ actions: {},
760
+ triggers: {},
761
+ fieldKinds: {},
762
+ recordTypes: {}
763
+ },
764
+ /**
765
+ * Clerk as an identity source (spec 4, REL-3881): its Connection, per Environment, holds the
766
+ * instance's publishable key — which encodes the Frontend API, and so the issuer — its secret key,
767
+ * its webhook signing secret and the origins its tokens may be minted for. Its one setting so far
768
+ * is the Claims the Project relies on, as `oidc`'s; its Triggers come with its users (spec 4, E3).
769
+ *
770
+ * Its Action, `updateUserMetadata` (REL-3893), merges `publicMetadata` into a Clerk user's public
771
+ * metadata with the Connection's secret key — the newsletter's `syncPlan` sets `{ plan: 'paid' }` —
772
+ * and a session token carries it once the customer adds the Claim to Clerk's session token
773
+ * (`"plan": "{{user.public_metadata.plan}}"`, the Clerk Extension's guide).
774
+ */
775
+ clerk: {
776
+ settings: [IDENTITY_CLAIMS_SETTING_FIELD],
777
+ actions: {
778
+ updateUserMetadata: {
779
+ action: "updateUserMetadata",
780
+ step: {
781
+ input: [
782
+ {
783
+ key: "userId",
784
+ type: "text",
785
+ required: true,
786
+ description: "The Clerk user\u2019s id, `user_\u2026`: a token\u2019s `sub`."
787
+ },
788
+ {
789
+ key: "publicMetadata",
790
+ type: "json",
791
+ required: true,
792
+ 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."
793
+ }
794
+ ],
795
+ output: [
796
+ {
797
+ key: "id",
798
+ type: "text",
799
+ required: true,
800
+ description: "The id of the user Clerk updated."
801
+ }
802
+ ],
803
+ sample: { id: "user_sample" },
804
+ // Clerk's Backend API keys nothing to dedupe a request on: an update that succeeded is never
805
+ // sent again, and one whose outcome is unknown is not either.
806
+ idempotencyHeader: null
807
+ }
808
+ }
809
+ },
810
+ triggers: {},
811
+ /**
812
+ * Its one field kind (REL-3894): `clerk.userRef()`, a reference to `clerkUser` that the Studio
813
+ * picks by name or email rather than by pasting an id.
814
+ */
815
+ fieldKinds: {
816
+ userRef: {
817
+ base: { type: "reference", to: "clerkUser" },
818
+ picker: {
819
+ search: ["email", "firstName", "lastName"],
820
+ title: ["firstName", "lastName"],
821
+ description: "email",
822
+ image: "imageUrl"
823
+ }
824
+ }
825
+ },
826
+ /** Its Managed user type (REL-3888): `clerk.user`, the Record kept for each Clerk user. */
827
+ recordTypes: { user: "clerkUser" }
681
828
  }
682
829
  };
830
+ var CONTRIBUTED_FIELD_KIND_OPTION = "fieldKind";
831
+ function contributedFieldKindName(extension, kind) {
832
+ return `${extension}.${kind}`;
833
+ }
834
+ __name(contributedFieldKindName, "contributedFieldKindName");
835
+ var EXTENSION_BACKFILL_REFUSALS = [
836
+ "connection-gone",
837
+ "connection-inactive",
838
+ "connection-unreadable",
839
+ "vendor-refused",
840
+ "vendor-unavailable",
841
+ "vendor-answer-unreadable",
842
+ "extension-not-backfilled"
843
+ ];
844
+ new Set(EXTENSION_BACKFILL_REFUSALS);
683
845
 
684
- export { EXTENSION_SURFACES, FRESH_PARAMETER, HEADER_IDEMPOTENCY_KEY, HEADER_IF_MATCH, HEADER_RETRY_AFTER, PREVIEW_DATASET_PREFIX, VISITOR_ADMISSION_RETRY_AFTER_SECONDS, VISITOR_CLOSE_CODES, VISITOR_CLOSE_RETRY, VISITOR_FRAMES, VISITOR_KEEPALIVE, VISITOR_LIVE_PATH, VISITOR_POLL_INTERVAL_MS, VISITOR_POLL_RETRY, VISITOR_QUERY, entityTag, parseVisitorFrame, previewDatasetSlug, readVisitorPollAnswer };
685
- //# sourceMappingURL=chunk-EDE2H37D.js.map
686
- //# sourceMappingURL=chunk-EDE2H37D.js.map
846
+ export { CONTRIBUTED_FIELD_KIND_OPTION, END_USER_TOKEN_REFUSAL_REASONS, EXTENSION_SURFACES, FRESH_PARAMETER, HEADER_END_USER, HEADER_IDEMPOTENCY_KEY, HEADER_IF_MATCH, HEADER_RETRY_AFTER, PREVIEW_DATASET_PREFIX, VISITOR_ADMISSION_RETRY_AFTER_SECONDS, VISITOR_CLOSE_CODES, VISITOR_CLOSE_RETRY, VISITOR_FRAMES, VISITOR_KEEPALIVE, VISITOR_LIVE_PATH, VISITOR_POLL_INTERVAL_MS, VISITOR_POLL_RETRY, VISITOR_QUERY, contributedFieldKindName, entityTag, parseVisitorFrame, previewDatasetSlug, readVisitorPollAnswer };
847
+ //# sourceMappingURL=chunk-T7LGREB3.js.map
848
+ //# sourceMappingURL=chunk-T7LGREB3.js.map
@@ -1,4 +1,4 @@
1
- import { conditionRoot, compileKeyedMembers } from './chunk-W7JFHSFM.js';
1
+ import { conditionRoot, compileKeyedMembers } from './chunk-PZCDJFMA.js';
2
2
  import { __name } from './chunk-DI6KFDBO.js';
3
3
 
4
4
  /* RelyIO SDK - Built with ❤️ by the RelyIO Team */
@@ -516,5 +516,5 @@ function resolveAutomation(file, nameOf) {
516
516
  __name(resolveAutomation, "resolveAutomation");
517
517
 
518
518
  export { and, anyEntry, automations, defineAutomation, entries, extensionTrigger, isAutomationFile, not, on, or, records, resolveAutomation, schedule, tpl };
519
- //# sourceMappingURL=chunk-R6E4HE7R.js.map
520
- //# sourceMappingURL=chunk-R6E4HE7R.js.map
519
+ //# sourceMappingURL=chunk-W2GRVXDG.js.map
520
+ //# sourceMappingURL=chunk-W2GRVXDG.js.map
@@ -1,21 +1,21 @@
1
1
  'use strict';
2
2
 
3
- var chunkIFKF72VJ_cjs = require('../chunk-IFKF72VJ.cjs');
3
+ var chunkP23G5NXD_cjs = require('../chunk-P23G5NXD.cjs');
4
4
  require('../chunk-M7MWNV3Q.cjs');
5
5
  require('../chunk-ZO6QDYJG.cjs');
6
6
  require('../chunk-7I3SC7SV.cjs');
7
- require('../chunk-SHSK7UUY.cjs');
7
+ require('../chunk-NN45CSPZ.cjs');
8
8
  require('../chunk-L6DXCKVQ.cjs');
9
9
 
10
10
 
11
11
 
12
12
  Object.defineProperty(exports, "TypedRelyIOClient", {
13
13
  enumerable: true,
14
- get: function () { return chunkIFKF72VJ_cjs.TypedRelyIOClient; }
14
+ get: function () { return chunkP23G5NXD_cjs.TypedRelyIOClient; }
15
15
  });
16
16
  Object.defineProperty(exports, "createClient", {
17
17
  enumerable: true,
18
- get: function () { return chunkIFKF72VJ_cjs.createClient; }
18
+ get: function () { return chunkP23G5NXD_cjs.createClient; }
19
19
  });
20
20
  //# sourceMappingURL=index.cjs.map
21
21
  //# sourceMappingURL=index.cjs.map
@@ -1,6 +1,6 @@
1
- export { e as ClientDefaults, f as ClientSchema, d as TypedClientConfig, T as TypedRelyIOClient, c as createClient } from '../index-DwHcL6x5.cjs';
2
- export { d as Register, R as RegisteredSchema } from '../register-BYCs0FpF.cjs';
3
- import '../define-content-type-NEQDrvdq.cjs';
1
+ export { e as ClientDefaults, f as ClientSchema, d as TypedClientConfig, T as TypedRelyIOClient, c as createClient } from '../index-D5jyIeQ5.cjs';
2
+ export { c as Register, R as RegisteredSchema } from '../register-DeMsaurp.cjs';
3
+ import '../define-content-type-BZ6X8GvL.cjs';
4
4
  import '../rich-text.d-BWc-5gX1.cjs';
5
- import '../define-schema-DZhtvLiK.cjs';
5
+ import '../define-schema-BPlZl4a2.cjs';
6
6
  import '../dev-handshake/index.cjs';
@@ -1,6 +1,6 @@
1
- export { e as ClientDefaults, f as ClientSchema, d as TypedClientConfig, T as TypedRelyIOClient, c as createClient } from '../index-M3luH06A.js';
2
- export { d as Register, R as RegisteredSchema } from '../register-B53i97A9.js';
3
- import '../define-content-type-fb-WCD5e.js';
1
+ export { e as ClientDefaults, f as ClientSchema, d as TypedClientConfig, T as TypedRelyIOClient, c as createClient } from '../index-BxNnlc5D.js';
2
+ export { c as Register, R as RegisteredSchema } from '../register-BiMQKVp-.js';
3
+ import '../define-content-type-C12jh8cY.js';
4
4
  import '../rich-text.d-BWc-5gX1.js';
5
- import '../define-schema-Dlwh6l_J.js';
5
+ import '../define-schema-CK7TtYot.js';
6
6
  import '../dev-handshake/index.js';
@@ -1,8 +1,8 @@
1
- export { TypedRelyIOClient, createClient } from '../chunk-ZHTJ7GXH.js';
1
+ export { TypedRelyIOClient, createClient } from '../chunk-356SF5Y2.js';
2
2
  import '../chunk-NJQK5STK.js';
3
3
  import '../chunk-W2A4OTCI.js';
4
4
  import '../chunk-HDHBYYEY.js';
5
- import '../chunk-EDE2H37D.js';
5
+ import '../chunk-T7LGREB3.js';
6
6
  import '../chunk-DI6KFDBO.js';
7
7
  //# sourceMappingURL=index.js.map
8
8
  //# sourceMappingURL=index.js.map