@01.software/sdk 0.71.0 → 0.72.1

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 (43) hide show
  1. package/CHANGELOG.md +84 -0
  2. package/README.md +31 -1
  3. package/dist/client.cjs +74 -7
  4. package/dist/client.cjs.map +1 -1
  5. package/dist/client.d.cts +6 -6
  6. package/dist/client.d.ts +6 -6
  7. package/dist/client.js +74 -7
  8. package/dist/client.js.map +1 -1
  9. package/dist/{collection-client-D18xyUq_.d.cts → collection-client-B3CnqMDQ.d.cts} +4 -4
  10. package/dist/{collection-client-CUGJcTpl.d.ts → collection-client-uOgS_1bC.d.ts} +4 -4
  11. package/dist/{const-Dlu0mXmj.d.ts → const-BJBK7jBl.d.ts} +1 -1
  12. package/dist/{const-oGEoxCXZ.d.cts → const-_ZfJjRQG.d.cts} +1 -1
  13. package/dist/{index-Ccd4NYTL.d.ts → index-CBaP4q8r.d.ts} +3 -3
  14. package/dist/{index-HHVtIKXs.d.cts → index-CI_LFWiG.d.cts} +3 -3
  15. package/dist/index.cjs +74 -7
  16. package/dist/index.cjs.map +1 -1
  17. package/dist/index.d.cts +7 -7
  18. package/dist/index.d.ts +7 -7
  19. package/dist/index.js +74 -7
  20. package/dist/index.js.map +1 -1
  21. package/dist/{payload-types-BgOEk6Y9.d.cts → payload-types-BRg8Yary.d.cts} +191 -166
  22. package/dist/{payload-types-BgOEk6Y9.d.ts → payload-types-BRg8Yary.d.ts} +191 -166
  23. package/dist/query.d.cts +5 -5
  24. package/dist/query.d.ts +5 -5
  25. package/dist/realtime.d.cts +2 -2
  26. package/dist/realtime.d.ts +2 -2
  27. package/dist/server.cjs +74 -7
  28. package/dist/server.cjs.map +1 -1
  29. package/dist/server.d.cts +7 -7
  30. package/dist/server.d.ts +7 -7
  31. package/dist/server.js +74 -7
  32. package/dist/server.js.map +1 -1
  33. package/dist/{types-nyOvcO0K.d.ts → types-Cmnxxvuv.d.ts} +46 -7
  34. package/dist/{types-DLHEIsAx.d.cts → types-CnkJQUez.d.cts} +46 -7
  35. package/dist/{types-CSvp2fJ_.d.ts → types-DLjSqL0P.d.ts} +2 -2
  36. package/dist/{types-BzG3NO7R.d.cts → types-FyklqLAk.d.cts} +2 -2
  37. package/dist/ui/form.d.cts +1 -1
  38. package/dist/ui/form.d.ts +1 -1
  39. package/dist/ui/video.d.cts +1 -1
  40. package/dist/ui/video.d.ts +1 -1
  41. package/dist/webhook.d.cts +5 -5
  42. package/dist/webhook.d.ts +5 -5
  43. package/package.json +2 -4
@@ -1,8 +1,8 @@
1
- import { dd as DebugConfig, dj as RetryConfig, d6 as ApiQueryOptions, dg as PayloadFindResponse, dh as PayloadMutationResponse, dy as ApiDocumentWriteOptions, dz as ApiWriteOptions, dA as ApiDeleteOptions, dB as PublicReadQueryOptions } from './types-DLHEIsAx.cjs';
2
- import './payload-types-BgOEk6Y9.cjs';
1
+ import { dd as DebugConfig, dj as RetryConfig, d6 as ApiQueryOptions, dg as PayloadFindResponse, dh as PayloadMutationResponse, dy as ApiDocumentWriteOptions, dz as ApiWriteOptions, dA as ApiDeleteOptions, dB as PublicReadQueryOptions } from './types-CnkJQUez.cjs';
2
+ import './payload-types-BRg8Yary.cjs';
3
3
  import { GenerateMetadataOptions, Metadata } from './metadata.cjs';
4
- import { C as Collection, S as ServerCollection, P as PublicCollection } from './const-oGEoxCXZ.cjs';
5
- import { C as CollectionType } from './types-BzG3NO7R.cjs';
4
+ import { C as Collection, S as ServerCollection, P as PublicCollection } from './const-_ZfJjRQG.cjs';
5
+ import { C as CollectionType } from './types-FyklqLAk.cjs';
6
6
 
7
7
  interface FetchOptions extends RequestInit {
8
8
  apiUrl?: string;
@@ -1,8 +1,8 @@
1
- import { dd as DebugConfig, dj as RetryConfig, d6 as ApiQueryOptions, dg as PayloadFindResponse, dh as PayloadMutationResponse, dy as ApiDocumentWriteOptions, dz as ApiWriteOptions, dA as ApiDeleteOptions, dB as PublicReadQueryOptions } from './types-nyOvcO0K.js';
2
- import './payload-types-BgOEk6Y9.js';
1
+ import { dd as DebugConfig, dj as RetryConfig, d6 as ApiQueryOptions, dg as PayloadFindResponse, dh as PayloadMutationResponse, dy as ApiDocumentWriteOptions, dz as ApiWriteOptions, dA as ApiDeleteOptions, dB as PublicReadQueryOptions } from './types-Cmnxxvuv.js';
2
+ import './payload-types-BRg8Yary.js';
3
3
  import { GenerateMetadataOptions, Metadata } from './metadata.js';
4
- import { C as Collection, S as ServerCollection, P as PublicCollection } from './const-Dlu0mXmj.js';
5
- import { C as CollectionType } from './types-CSvp2fJ_.js';
4
+ import { C as Collection, S as ServerCollection, P as PublicCollection } from './const-BJBK7jBl.js';
5
+ import { C as CollectionType } from './types-DLjSqL0P.js';
6
6
 
7
7
  interface FetchOptions extends RequestInit {
8
8
  apiUrl?: string;
@@ -1,4 +1,4 @@
1
- import './payload-types-BgOEk6Y9.js';
1
+ import './payload-types-BRg8Yary.js';
2
2
 
3
3
  /**
4
4
  * Internal collections that should not be exposed via SDK.
@@ -1,4 +1,4 @@
1
- import './payload-types-BgOEk6Y9.cjs';
1
+ import './payload-types-BRg8Yary.cjs';
2
2
 
3
3
  /**
4
4
  * Internal collections that should not be exposed via SDK.
@@ -1,6 +1,6 @@
1
- import { C as Collection } from './const-Dlu0mXmj.js';
2
- import { C as CollectionType } from './types-CSvp2fJ_.js';
3
- import './payload-types-BgOEk6Y9.js';
1
+ import { C as Collection } from './const-BJBK7jBl.js';
2
+ import { C as CollectionType } from './types-DLjSqL0P.js';
3
+ import './payload-types-BRg8Yary.js';
4
4
 
5
5
  type WebhookOperation = string;
6
6
  /**
@@ -1,6 +1,6 @@
1
- import { C as Collection } from './const-oGEoxCXZ.cjs';
2
- import { C as CollectionType } from './types-BzG3NO7R.cjs';
3
- import './payload-types-BgOEk6Y9.cjs';
1
+ import { C as Collection } from './const-_ZfJjRQG.cjs';
2
+ import { C as CollectionType } from './types-FyklqLAk.cjs';
3
+ import './payload-types-BRg8Yary.cjs';
4
4
 
5
5
  type WebhookOperation = string;
6
6
  /**
package/dist/index.cjs CHANGED
@@ -2720,7 +2720,18 @@ var ABANDONED_REASONS = ["expired", "customer", "operator"];
2720
2720
  function managedPaymentProviders(providers) {
2721
2721
  return providers;
2722
2722
  }
2723
- var PAYMENT_PROVIDERS = managedPaymentProviders(["toss", "portone"]);
2723
+ var PAYMENT_PROVIDERS = managedPaymentProviders([
2724
+ "toss",
2725
+ "portone",
2726
+ "stripe"
2727
+ ]);
2728
+ var CANCEL_RECOVERY_METHODS = {
2729
+ toss: "cancel()",
2730
+ portone: "cancelPortOne()",
2731
+ stripe: null
2732
+ };
2733
+ var STRIPE_RETURN_URL_RAW_CHARACTERS = /^[^\s\u0000-\u001F\u007F\\]+$/;
2734
+ var STRIPE_RETURN_URL_AUTHORITY = /^[A-Za-z][A-Za-z0-9+.-]*:\/\/[^/?#@]+(?:[/?#]|$)/;
2724
2735
  var PAYMENT_PROVIDER_STATUSES = [
2725
2736
  "requires_payment_method",
2726
2737
  "requires_action",
@@ -2769,11 +2780,8 @@ function fail(resource, path, expected) {
2769
2780
  invalidCanonicalResponse(resource, { path, expected });
2770
2781
  }
2771
2782
  function providerMismatch(resource, expected, actual, operation2) {
2772
- if (operation2 === "cancel") {
2773
- const method = {
2774
- toss: "cancel()",
2775
- portone: "cancelPortOne()"
2776
- }[actual];
2783
+ const method = CANCEL_RECOVERY_METHODS[actual];
2784
+ if (operation2 === "cancel" && method !== null) {
2777
2785
  throw createApiError(
2778
2786
  `Canonical ${resource} response provider mismatch: expected ${expected}, received ${actual}.`,
2779
2787
  502,
@@ -4017,6 +4025,65 @@ function validateRequiredReconciliation(value, allowed, resource, path) {
4017
4025
  }
4018
4026
  function validateNextAction(value, provider, resource, path) {
4019
4027
  const action = record(value, resource, path);
4028
+ if (provider === "stripe") {
4029
+ exact(
4030
+ action,
4031
+ ["type", "clientSecret", "publishableKey", "returnUrl"],
4032
+ [],
4033
+ resource,
4034
+ path
4035
+ );
4036
+ if (action.type !== "stripe_payment_element")
4037
+ fail(resource, `${path}.type`, "stripe_payment_element");
4038
+ const clientSecret = boundedString(
4039
+ action.clientSecret,
4040
+ 255,
4041
+ resource,
4042
+ `${path}.clientSecret`
4043
+ );
4044
+ if (!/^pi_[A-Za-z0-9]+_secret_[A-Za-z0-9]+$/.test(clientSecret)) {
4045
+ fail(
4046
+ resource,
4047
+ `${path}.clientSecret`,
4048
+ "Stripe PaymentIntent client secret"
4049
+ );
4050
+ }
4051
+ const publishableKey = boundedString(
4052
+ action.publishableKey,
4053
+ 255,
4054
+ resource,
4055
+ `${path}.publishableKey`
4056
+ );
4057
+ if (!/^pk_(?:test|live)_[A-Za-z0-9]+$/.test(publishableKey)) {
4058
+ fail(resource, `${path}.publishableKey`, "Stripe publishable key");
4059
+ }
4060
+ const returnUrl = boundedString(
4061
+ action.returnUrl,
4062
+ 2048,
4063
+ resource,
4064
+ `${path}.returnUrl`
4065
+ );
4066
+ if (!STRIPE_RETURN_URL_RAW_CHARACTERS.test(returnUrl) || !STRIPE_RETURN_URL_AUTHORITY.test(returnUrl)) {
4067
+ fail(
4068
+ resource,
4069
+ `${path}.returnUrl`,
4070
+ "HTTPS or loopback URL without embedded credentials"
4071
+ );
4072
+ }
4073
+ try {
4074
+ const parsed = new URL(returnUrl);
4075
+ const loopback = parsed.protocol === "http:" && (parsed.hostname === "localhost" || parsed.hostname === "127.0.0.1");
4076
+ if (!loopback && parsed.protocol !== "https:" || parsed.username || parsed.password)
4077
+ throw new Error("unsafe return URL");
4078
+ } catch {
4079
+ fail(
4080
+ resource,
4081
+ `${path}.returnUrl`,
4082
+ "HTTPS or loopback URL without embedded credentials"
4083
+ );
4084
+ }
4085
+ return;
4086
+ }
4020
4087
  if (provider === "portone") {
4021
4088
  if (action.type === "portone_sdk") {
4022
4089
  const hasCancelable = "cancelable" in action;
@@ -4392,7 +4459,7 @@ function validatePublicPaymentSession(value, expectedProvider, operation2) {
4392
4459
  );
4393
4460
  }
4394
4461
  if (expectedProvider !== void 0 && provider !== expectedProvider) {
4395
- if (operation2 === "cancel" && status !== "canceling" && status !== "canceled") {
4462
+ if (operation2 === "cancel" && CANCEL_RECOVERY_METHODS[provider] !== null && status !== "canceling" && status !== "canceled") {
4396
4463
  fail(
4397
4464
  resource,
4398
4465
  "$.providerStatus",