@relyio/sdk 0.18.0 → 0.20.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 (58) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/dist/automations/index.cjs +18 -17
  3. package/dist/automations/index.d.cts +2 -1307
  4. package/dist/automations/index.d.ts +2 -1307
  5. package/dist/automations/index.js +3 -2
  6. package/dist/{chunk-ZAMAR3X2.cjs → chunk-5F3YYPLZ.cjs} +11249 -10771
  7. package/dist/{chunk-ZO6QDYJG.cjs → chunk-5WGMIQBH.cjs} +2 -2
  8. package/dist/{chunk-LSI26ZN2.cjs → chunk-DBYMG6MQ.cjs} +5 -5
  9. package/dist/{chunk-W2A4OTCI.js → chunk-EQUZNVAR.js} +2 -2
  10. package/dist/{chunk-IFKF72VJ.cjs → chunk-K66MBRI4.cjs} +147 -71
  11. package/dist/{chunk-ZHTJ7GXH.js → chunk-L42C4G2S.js} +106 -31
  12. package/dist/{chunk-EDE2H37D.js → chunk-OUR7OUUZ.js} +174 -12
  13. package/dist/{chunk-W7JFHSFM.js → chunk-PZCDJFMA.js} +11249 -10772
  14. package/dist/{chunk-SHSK7UUY.cjs → chunk-UO2QRYKV.cjs} +177 -11
  15. package/dist/{chunk-R6E4HE7R.js → chunk-W2GRVXDG.js} +3 -3
  16. package/dist/client/index.cjs +5 -5
  17. package/dist/client/index.d.cts +4 -4
  18. package/dist/client/index.d.ts +4 -4
  19. package/dist/client/index.js +3 -3
  20. package/dist/{define-content-type-NEQDrvdq.d.cts → define-content-type-C2HnCYYX.d.cts} +1324 -156
  21. package/dist/{define-content-type-fb-WCD5e.d.ts → define-content-type-CVLUusfx.d.ts} +1324 -156
  22. package/dist/dev-handshake/index.cjs +8 -8
  23. package/dist/dev-handshake/index.d.cts +1 -1
  24. package/dist/dev-handshake/index.d.ts +1 -1
  25. package/dist/dev-handshake/index.js +1 -1
  26. package/dist/extensions/index.cjs +26 -6
  27. package/dist/extensions/index.d.cts +3 -791
  28. package/dist/extensions/index.d.ts +3 -791
  29. package/dist/extensions/index.js +24 -4
  30. package/dist/functions/index.cjs +7 -4
  31. package/dist/functions/index.d.cts +2 -4
  32. package/dist/functions/index.d.ts +2 -4
  33. package/dist/functions/index.js +5 -2
  34. package/dist/{index-DwHcL6x5.d.cts → index-BLVNMYUU.d.cts} +142 -79
  35. package/dist/{index-C4LqrNd1.d.ts → index-BY1xU93u.d.ts} +1 -1
  36. package/dist/{index-Dnmt_UOo.d.cts → index-Cmup6HJY.d.cts} +1 -1
  37. package/dist/index-D1fiaQlK.d.ts +2284 -0
  38. package/dist/index-DImzg3ew.d.cts +2284 -0
  39. package/dist/{index-M3luH06A.d.ts → index-IjSyBr8f.d.ts} +142 -79
  40. package/dist/index.cjs +89 -85
  41. package/dist/index.d.cts +64 -15
  42. package/dist/index.d.ts +64 -15
  43. package/dist/index.js +5 -5
  44. package/dist/preview/index.cjs +3 -3
  45. package/dist/preview/index.js +1 -1
  46. package/dist/rich-text/index.d.cts +2 -2
  47. package/dist/rich-text/index.d.ts +2 -2
  48. package/dist/schema/index.cjs +41 -40
  49. package/dist/schema/index.d.cts +948 -118
  50. package/dist/schema/index.d.ts +948 -118
  51. package/dist/schema/index.js +2 -1
  52. package/dist/types/index.d.cts +1 -1
  53. package/dist/types/index.d.ts +1 -1
  54. package/package.json +5 -5
  55. package/dist/define-schema-DZhtvLiK.d.cts +0 -846
  56. package/dist/define-schema-Dlwh6l_J.d.ts +0 -846
  57. package/dist/register-B53i97A9.d.ts +0 -677
  58. package/dist/register-BYCs0FpF.d.cts +0 -677
@@ -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-4KRF3DVJ.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-UO2QRYKV.cjs.map
872
+ //# sourceMappingURL=chunk-UO2QRYKV.cjs.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 chunkK66MBRI4_cjs = require('../chunk-K66MBRI4.cjs');
4
4
  require('../chunk-M7MWNV3Q.cjs');
5
- require('../chunk-ZO6QDYJG.cjs');
5
+ require('../chunk-5WGMIQBH.cjs');
6
6
  require('../chunk-7I3SC7SV.cjs');
7
- require('../chunk-SHSK7UUY.cjs');
7
+ require('../chunk-UO2QRYKV.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 chunkK66MBRI4_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 chunkK66MBRI4_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-BLVNMYUU.cjs';
2
+ export { R as Register, a as RegisteredSchema } from '../index-DImzg3ew.cjs';
3
+ import '../define-content-type-C2HnCYYX.cjs';
4
4
  import '../rich-text.d-BWc-5gX1.cjs';
5
- import '../define-schema-DZhtvLiK.cjs';
5
+ import '../schema/index.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-IjSyBr8f.js';
2
+ export { R as Register, a as RegisteredSchema } from '../index-D1fiaQlK.js';
3
+ import '../define-content-type-CVLUusfx.js';
4
4
  import '../rich-text.d-BWc-5gX1.js';
5
- import '../define-schema-Dlwh6l_J.js';
5
+ import '../schema/index.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-L42C4G2S.js';
2
2
  import '../chunk-NJQK5STK.js';
3
- import '../chunk-W2A4OTCI.js';
3
+ import '../chunk-EQUZNVAR.js';
4
4
  import '../chunk-HDHBYYEY.js';
5
- import '../chunk-EDE2H37D.js';
5
+ import '../chunk-OUR7OUUZ.js';
6
6
  import '../chunk-DI6KFDBO.js';
7
7
  //# sourceMappingURL=index.js.map
8
8
  //# sourceMappingURL=index.js.map