@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
package/dist/query.d.cts CHANGED
@@ -1,10 +1,10 @@
1
1
  import * as _tanstack_react_query from '@tanstack/react-query';
2
2
  import { QueryClient, UseQueryResult, UseSuspenseQueryResult, InfiniteData, UseInfiniteQueryResult, UseSuspenseInfiniteQueryResult } from '@tanstack/react-query';
3
- import { d6 as ApiQueryOptions, dg as PayloadFindResponse, dB as PublicReadQueryOptions, dh as PayloadMutationResponse, dC as CustomerAuth, dD as CustomerProfile, dE as CustomerAuthResponse, dF as CustomerLoginData, dG as CustomerRegisterResponse, dH as CustomerRegisterData, dI as CustomerRefreshResponse, dJ as UpdateProfileData, dK as ProductListingPageParams, dL as ProductListingPageBaseParams, dM as ProductDetailParams, dN as ProductDetailCatalogResult, dO as ProductListingPageCatalogParams, dP as ProductListingPageResult, dQ as ProductListingGroupsCatalogItem, dR as ProductListingPageFullParams, dS as ProductListingGroupsItem, dk as RootClient, cn as RootServerClient } from './types-DLHEIsAx.cjs';
4
- import './payload-types-BgOEk6Y9.cjs';
5
- import { S as ServerCollection, P as PublicCollection } from './const-oGEoxCXZ.cjs';
6
- import { C as CollectionClient } from './collection-client-D18xyUq_.cjs';
7
- import { C as CollectionType } from './types-BzG3NO7R.cjs';
3
+ import { d6 as ApiQueryOptions, dg as PayloadFindResponse, dB as PublicReadQueryOptions, dh as PayloadMutationResponse, dC as CustomerAuth, dD as CustomerProfile, dE as CustomerAuthResponse, dF as CustomerLoginData, dG as CustomerRegisterResponse, dH as CustomerRegisterData, dI as CustomerRefreshResponse, dJ as UpdateProfileData, dK as ProductListingPageParams, dL as ProductListingPageBaseParams, dM as ProductDetailParams, dN as ProductDetailCatalogResult, dO as ProductListingPageCatalogParams, dP as ProductListingPageResult, dQ as ProductListingGroupsCatalogItem, dR as ProductListingPageFullParams, dS as ProductListingGroupsItem, dk as RootClient, cn as RootServerClient } from './types-CnkJQUez.cjs';
4
+ import './payload-types-BRg8Yary.cjs';
5
+ import { S as ServerCollection, P as PublicCollection } from './const-_ZfJjRQG.cjs';
6
+ import { C as CollectionClient } from './collection-client-B3CnqMDQ.cjs';
7
+ import { C as CollectionType } from './types-FyklqLAk.cjs';
8
8
  import { SDKError } from './errors.cjs';
9
9
  export { a as RealtimeConnection, R as RealtimeEvent, b as RealtimeListener } from './realtime-D7HtUpqt.cjs';
10
10
  import './metadata.cjs';
package/dist/query.d.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  import * as _tanstack_react_query from '@tanstack/react-query';
2
2
  import { QueryClient, UseQueryResult, UseSuspenseQueryResult, InfiniteData, UseInfiniteQueryResult, UseSuspenseInfiniteQueryResult } from '@tanstack/react-query';
3
- import { d6 as ApiQueryOptions, dg as PayloadFindResponse, dB as PublicReadQueryOptions, dh as PayloadMutationResponse, dC as CustomerAuth, dD as CustomerProfile, dE as CustomerAuthResponse, dF as CustomerLoginData, dG as CustomerRegisterResponse, dH as CustomerRegisterData, dI as CustomerRefreshResponse, dJ as UpdateProfileData, dK as ProductListingPageParams, dL as ProductListingPageBaseParams, dM as ProductDetailParams, dN as ProductDetailCatalogResult, dO as ProductListingPageCatalogParams, dP as ProductListingPageResult, dQ as ProductListingGroupsCatalogItem, dR as ProductListingPageFullParams, dS as ProductListingGroupsItem, dk as RootClient, cn as RootServerClient } from './types-nyOvcO0K.js';
4
- import './payload-types-BgOEk6Y9.js';
5
- import { S as ServerCollection, P as PublicCollection } from './const-Dlu0mXmj.js';
6
- import { C as CollectionClient } from './collection-client-CUGJcTpl.js';
7
- import { C as CollectionType } from './types-CSvp2fJ_.js';
3
+ import { d6 as ApiQueryOptions, dg as PayloadFindResponse, dB as PublicReadQueryOptions, dh as PayloadMutationResponse, dC as CustomerAuth, dD as CustomerProfile, dE as CustomerAuthResponse, dF as CustomerLoginData, dG as CustomerRegisterResponse, dH as CustomerRegisterData, dI as CustomerRefreshResponse, dJ as UpdateProfileData, dK as ProductListingPageParams, dL as ProductListingPageBaseParams, dM as ProductDetailParams, dN as ProductDetailCatalogResult, dO as ProductListingPageCatalogParams, dP as ProductListingPageResult, dQ as ProductListingGroupsCatalogItem, dR as ProductListingPageFullParams, dS as ProductListingGroupsItem, dk as RootClient, cn as RootServerClient } from './types-Cmnxxvuv.js';
4
+ import './payload-types-BRg8Yary.js';
5
+ import { S as ServerCollection, P as PublicCollection } from './const-BJBK7jBl.js';
6
+ import { C as CollectionClient } from './collection-client-uOgS_1bC.js';
7
+ import { C as CollectionType } from './types-DLjSqL0P.js';
8
8
  import { SDKError } from './errors.js';
9
9
  export { a as RealtimeConnection, R as RealtimeEvent, b as RealtimeListener } from './realtime-D7HtUpqt.js';
10
10
  import './metadata.js';
@@ -1,7 +1,7 @@
1
1
  import { R as RealtimeEvent } from './realtime-D7HtUpqt.cjs';
2
2
  export { a as RealtimeConnection, b as RealtimeListener } from './realtime-D7HtUpqt.cjs';
3
- import { P as PublicCollection } from './const-oGEoxCXZ.cjs';
4
- import './payload-types-BgOEk6Y9.cjs';
3
+ import { P as PublicCollection } from './const-_ZfJjRQG.cjs';
4
+ import './payload-types-BRg8Yary.cjs';
5
5
 
6
6
  interface UseRealtimeQueryOptions {
7
7
  /** Filter events to specific collections. Empty/undefined = all collections. */
@@ -1,7 +1,7 @@
1
1
  import { R as RealtimeEvent } from './realtime-D7HtUpqt.js';
2
2
  export { a as RealtimeConnection, b as RealtimeListener } from './realtime-D7HtUpqt.js';
3
- import { P as PublicCollection } from './const-Dlu0mXmj.js';
4
- import './payload-types-BgOEk6Y9.js';
3
+ import { P as PublicCollection } from './const-BJBK7jBl.js';
4
+ import './payload-types-BRg8Yary.js';
5
5
 
6
6
  interface UseRealtimeQueryOptions {
7
7
  /** Filter events to specific collections. Empty/undefined = all collections. */
package/dist/server.cjs CHANGED
@@ -2990,7 +2990,18 @@ var ABANDONED_REASONS = ["expired", "customer", "operator"];
2990
2990
  function managedPaymentProviders(providers) {
2991
2991
  return providers;
2992
2992
  }
2993
- var PAYMENT_PROVIDERS = managedPaymentProviders(["toss", "portone"]);
2993
+ var PAYMENT_PROVIDERS = managedPaymentProviders([
2994
+ "toss",
2995
+ "portone",
2996
+ "stripe"
2997
+ ]);
2998
+ var CANCEL_RECOVERY_METHODS = {
2999
+ toss: "cancel()",
3000
+ portone: "cancelPortOne()",
3001
+ stripe: null
3002
+ };
3003
+ var STRIPE_RETURN_URL_RAW_CHARACTERS = /^[^\s\u0000-\u001F\u007F\\]+$/;
3004
+ var STRIPE_RETURN_URL_AUTHORITY = /^[A-Za-z][A-Za-z0-9+.-]*:\/\/[^/?#@]+(?:[/?#]|$)/;
2994
3005
  var PAYMENT_PROVIDER_STATUSES = [
2995
3006
  "requires_payment_method",
2996
3007
  "requires_action",
@@ -3051,11 +3062,8 @@ function fail(resource, path, expected) {
3051
3062
  invalidCanonicalResponse(resource, { path, expected });
3052
3063
  }
3053
3064
  function providerMismatch(resource, expected, actual, operation2) {
3054
- if (operation2 === "cancel") {
3055
- const method = {
3056
- toss: "cancel()",
3057
- portone: "cancelPortOne()"
3058
- }[actual];
3065
+ const method = CANCEL_RECOVERY_METHODS[actual];
3066
+ if (operation2 === "cancel" && method !== null) {
3059
3067
  throw createApiError(
3060
3068
  `Canonical ${resource} response provider mismatch: expected ${expected}, received ${actual}.`,
3061
3069
  502,
@@ -4246,6 +4254,65 @@ function validateRequiredReconciliation(value, allowed, resource, path) {
4246
4254
  }
4247
4255
  function validateNextAction(value, provider, resource, path) {
4248
4256
  const action = record(value, resource, path);
4257
+ if (provider === "stripe") {
4258
+ exact(
4259
+ action,
4260
+ ["type", "clientSecret", "publishableKey", "returnUrl"],
4261
+ [],
4262
+ resource,
4263
+ path
4264
+ );
4265
+ if (action.type !== "stripe_payment_element")
4266
+ fail(resource, `${path}.type`, "stripe_payment_element");
4267
+ const clientSecret = boundedString(
4268
+ action.clientSecret,
4269
+ 255,
4270
+ resource,
4271
+ `${path}.clientSecret`
4272
+ );
4273
+ if (!/^pi_[A-Za-z0-9]+_secret_[A-Za-z0-9]+$/.test(clientSecret)) {
4274
+ fail(
4275
+ resource,
4276
+ `${path}.clientSecret`,
4277
+ "Stripe PaymentIntent client secret"
4278
+ );
4279
+ }
4280
+ const publishableKey = boundedString(
4281
+ action.publishableKey,
4282
+ 255,
4283
+ resource,
4284
+ `${path}.publishableKey`
4285
+ );
4286
+ if (!/^pk_(?:test|live)_[A-Za-z0-9]+$/.test(publishableKey)) {
4287
+ fail(resource, `${path}.publishableKey`, "Stripe publishable key");
4288
+ }
4289
+ const returnUrl = boundedString(
4290
+ action.returnUrl,
4291
+ 2048,
4292
+ resource,
4293
+ `${path}.returnUrl`
4294
+ );
4295
+ if (!STRIPE_RETURN_URL_RAW_CHARACTERS.test(returnUrl) || !STRIPE_RETURN_URL_AUTHORITY.test(returnUrl)) {
4296
+ fail(
4297
+ resource,
4298
+ `${path}.returnUrl`,
4299
+ "HTTPS or loopback URL without embedded credentials"
4300
+ );
4301
+ }
4302
+ try {
4303
+ const parsed = new URL(returnUrl);
4304
+ const loopback = parsed.protocol === "http:" && (parsed.hostname === "localhost" || parsed.hostname === "127.0.0.1");
4305
+ if (!loopback && parsed.protocol !== "https:" || parsed.username || parsed.password)
4306
+ throw new Error("unsafe return URL");
4307
+ } catch {
4308
+ fail(
4309
+ resource,
4310
+ `${path}.returnUrl`,
4311
+ "HTTPS or loopback URL without embedded credentials"
4312
+ );
4313
+ }
4314
+ return;
4315
+ }
4249
4316
  if (provider === "portone") {
4250
4317
  if (action.type === "portone_sdk") {
4251
4318
  const hasCancelable = "cancelable" in action;
@@ -4621,7 +4688,7 @@ function validatePublicPaymentSession(value, expectedProvider, operation2) {
4621
4688
  );
4622
4689
  }
4623
4690
  if (expectedProvider !== void 0 && provider !== expectedProvider) {
4624
- if (operation2 === "cancel" && status !== "canceling" && status !== "canceled") {
4691
+ if (operation2 === "cancel" && CANCEL_RECOVERY_METHODS[provider] !== null && status !== "canceling" && status !== "canceled") {
4625
4692
  fail(
4626
4693
  resource,
4627
4694
  "$.providerStatus",