@01.software/sdk 0.71.0 → 0.73.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 +118 -0
  2. package/README.md +71 -1
  3. package/dist/client.cjs +83 -9
  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 +83 -9
  8. package/dist/client.js.map +1 -1
  9. package/dist/{collection-client-D18xyUq_.d.cts → collection-client-BH4dIZ6c.d.cts} +4 -4
  10. package/dist/{collection-client-CUGJcTpl.d.ts → collection-client-lLAl3xCZ.d.ts} +4 -4
  11. package/dist/{const-oGEoxCXZ.d.cts → const-BS2EaIp4.d.cts} +1 -1
  12. package/dist/{const-Dlu0mXmj.d.ts → const-CCvoknRY.d.ts} +1 -1
  13. package/dist/{index-HHVtIKXs.d.cts → index-CHdrzJ8-.d.cts} +3 -3
  14. package/dist/{index-Ccd4NYTL.d.ts → index-DVqNpmsc.d.ts} +3 -3
  15. package/dist/index.cjs +84 -10
  16. package/dist/index.cjs.map +1 -1
  17. package/dist/index.d.cts +14 -11
  18. package/dist/index.d.ts +14 -11
  19. package/dist/index.js +84 -10
  20. package/dist/index.js.map +1 -1
  21. package/dist/{payload-types-BgOEk6Y9.d.cts → payload-types-PXkmefhZ.d.cts} +267 -185
  22. package/dist/{payload-types-BgOEk6Y9.d.ts → payload-types-PXkmefhZ.d.ts} +267 -185
  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 +113 -17
  28. package/dist/server.cjs.map +1 -1
  29. package/dist/server.d.cts +8 -7
  30. package/dist/server.d.ts +8 -7
  31. package/dist/server.js +113 -17
  32. package/dist/server.js.map +1 -1
  33. package/dist/{types-CSvp2fJ_.d.ts → types-CQRsG6sA.d.ts} +2 -2
  34. package/dist/{types-DLHEIsAx.d.cts → types-Chwgg4CQ.d.cts} +63 -7
  35. package/dist/{types-BzG3NO7R.d.cts → types-CyMz0Kzc.d.cts} +2 -2
  36. package/dist/{types-nyOvcO0K.d.ts → types-lbzbJSZh.d.ts} +63 -7
  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 { df as DebugConfig, dl as RetryConfig, d8 as ApiQueryOptions, di as PayloadFindResponse, dj as PayloadMutationResponse, dA as ApiDocumentWriteOptions, dB as ApiWriteOptions, dC as ApiDeleteOptions, dD as PublicReadQueryOptions } from './types-Chwgg4CQ.cjs';
2
+ import './payload-types-PXkmefhZ.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-BS2EaIp4.cjs';
5
+ import { C as CollectionType } from './types-CyMz0Kzc.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 { df as DebugConfig, dl as RetryConfig, d8 as ApiQueryOptions, di as PayloadFindResponse, dj as PayloadMutationResponse, dA as ApiDocumentWriteOptions, dB as ApiWriteOptions, dC as ApiDeleteOptions, dD as PublicReadQueryOptions } from './types-lbzbJSZh.js';
2
+ import './payload-types-PXkmefhZ.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-CCvoknRY.js';
5
+ import { C as CollectionType } from './types-CQRsG6sA.js';
6
6
 
7
7
  interface FetchOptions extends RequestInit {
8
8
  apiUrl?: string;
@@ -1,4 +1,4 @@
1
- import './payload-types-BgOEk6Y9.cjs';
1
+ import './payload-types-PXkmefhZ.cjs';
2
2
 
3
3
  /**
4
4
  * Internal collections that should not be exposed via SDK.
@@ -1,4 +1,4 @@
1
- import './payload-types-BgOEk6Y9.js';
1
+ import './payload-types-PXkmefhZ.js';
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-oGEoxCXZ.cjs';
2
- import { C as CollectionType } from './types-BzG3NO7R.cjs';
3
- import './payload-types-BgOEk6Y9.cjs';
1
+ import { C as Collection } from './const-BS2EaIp4.cjs';
2
+ import { C as CollectionType } from './types-CyMz0Kzc.cjs';
3
+ import './payload-types-PXkmefhZ.cjs';
4
4
 
5
5
  type WebhookOperation = string;
6
6
  /**
@@ -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-CCvoknRY.js';
2
+ import { C as CollectionType } from './types-CQRsG6sA.js';
3
+ import './payload-types-PXkmefhZ.js';
4
4
 
5
5
  type WebhookOperation = string;
6
6
  /**
package/dist/index.cjs CHANGED
@@ -996,7 +996,7 @@ async function httpFetch(url, options) {
996
996
  );
997
997
  const usageError = attachRequestId(
998
998
  createUsageLimitError(
999
- `Monthly API usage limit exceeded (${current.toLocaleString()}/${limit.toLocaleString()})`,
999
+ `Monthly API usage limit exceeded (${current.toLocaleString("en-US")}/${limit.toLocaleString("en-US")})`,
1000
1000
  { limit, current, remaining },
1001
1001
  {
1002
1002
  url,
@@ -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",
@@ -5701,8 +5768,13 @@ function getRelationID(value) {
5701
5768
  }
5702
5769
  return void 0;
5703
5770
  }
5771
+ function compareOrdinal(left, right) {
5772
+ if (left < right) return -1;
5773
+ if (left > right) return 1;
5774
+ return 0;
5775
+ }
5704
5776
  function compareOrder(left, right) {
5705
- return (left ?? "").localeCompare(right ?? "");
5777
+ return compareOrdinal(left ?? "", right ?? "");
5706
5778
  }
5707
5779
  function isProductOptionValueDoc(value) {
5708
5780
  return typeof value === "object" && value !== null && "id" in value && ("value" in value || "slug" in value);
@@ -6914,7 +6986,7 @@ function compareVariantOrder(a, b) {
6914
6986
  }
6915
6987
  const aId = String(getRelationID(a.id) ?? "");
6916
6988
  const bId = String(getRelationID(b.id) ?? "");
6917
- return aId.localeCompare(bId);
6989
+ return compareOrdinal(aId, bId);
6918
6990
  }
6919
6991
  function getVariantAvailableForSale(variant) {
6920
6992
  if (variant.isActive === false) return false;
@@ -7590,6 +7662,8 @@ function buildRangeEndpoint(params) {
7590
7662
  function buildAdmissionAvailabilityEndpoint(params) {
7591
7663
  const urlParams = new URLSearchParams();
7592
7664
  urlParams.set("occurrence", params.occurrence);
7665
+ const normalizedMarket2 = params.market?.trim();
7666
+ if (normalizedMarket2) urlParams.set("market", normalizedMarket2);
7593
7667
  return resolveOperationPath(
7594
7668
  EVENTS_ENDPOINT_OPERATIONS.occurrences.admissionAvailability,
7595
7669
  { query: urlParams }