@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.
- package/CHANGELOG.md +118 -0
- package/README.md +71 -1
- package/dist/client.cjs +83 -9
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.cts +6 -6
- package/dist/client.d.ts +6 -6
- package/dist/client.js +83 -9
- package/dist/client.js.map +1 -1
- package/dist/{collection-client-D18xyUq_.d.cts → collection-client-BH4dIZ6c.d.cts} +4 -4
- package/dist/{collection-client-CUGJcTpl.d.ts → collection-client-lLAl3xCZ.d.ts} +4 -4
- package/dist/{const-oGEoxCXZ.d.cts → const-BS2EaIp4.d.cts} +1 -1
- package/dist/{const-Dlu0mXmj.d.ts → const-CCvoknRY.d.ts} +1 -1
- package/dist/{index-HHVtIKXs.d.cts → index-CHdrzJ8-.d.cts} +3 -3
- package/dist/{index-Ccd4NYTL.d.ts → index-DVqNpmsc.d.ts} +3 -3
- package/dist/index.cjs +84 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +14 -11
- package/dist/index.d.ts +14 -11
- package/dist/index.js +84 -10
- package/dist/index.js.map +1 -1
- package/dist/{payload-types-BgOEk6Y9.d.cts → payload-types-PXkmefhZ.d.cts} +267 -185
- package/dist/{payload-types-BgOEk6Y9.d.ts → payload-types-PXkmefhZ.d.ts} +267 -185
- package/dist/query.d.cts +5 -5
- package/dist/query.d.ts +5 -5
- package/dist/realtime.d.cts +2 -2
- package/dist/realtime.d.ts +2 -2
- package/dist/server.cjs +113 -17
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.cts +8 -7
- package/dist/server.d.ts +8 -7
- package/dist/server.js +113 -17
- package/dist/server.js.map +1 -1
- package/dist/{types-CSvp2fJ_.d.ts → types-CQRsG6sA.d.ts} +2 -2
- package/dist/{types-DLHEIsAx.d.cts → types-Chwgg4CQ.d.cts} +63 -7
- package/dist/{types-BzG3NO7R.d.cts → types-CyMz0Kzc.d.cts} +2 -2
- package/dist/{types-nyOvcO0K.d.ts → types-lbzbJSZh.d.ts} +63 -7
- package/dist/ui/form.d.cts +1 -1
- package/dist/ui/form.d.ts +1 -1
- package/dist/ui/video.d.cts +1 -1
- package/dist/ui/video.d.ts +1 -1
- package/dist/webhook.d.cts +5 -5
- package/dist/webhook.d.ts +5 -5
- 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 {
|
|
4
|
-
import './payload-types-
|
|
5
|
-
import { S as ServerCollection, P as PublicCollection } from './const-
|
|
6
|
-
import { C as CollectionClient } from './collection-client-
|
|
7
|
-
import { C as CollectionType } from './types-
|
|
3
|
+
import { d8 as ApiQueryOptions, di as PayloadFindResponse, dD as PublicReadQueryOptions, dj as PayloadMutationResponse, dE as CustomerAuth, dF as CustomerProfile, dG as CustomerAuthResponse, dH as CustomerLoginData, dI as CustomerRegisterResponse, dJ as CustomerRegisterData, dK as CustomerRefreshResponse, dL as UpdateProfileData, dM as ProductListingPageParams, dN as ProductListingPageBaseParams, dO as ProductDetailParams, dP as ProductDetailCatalogResult, dQ as ProductListingPageCatalogParams, dR as ProductListingPageResult, dS as ProductListingGroupsCatalogItem, dT as ProductListingPageFullParams, dU as ProductListingGroupsItem, dm as RootClient, cp as RootServerClient } from './types-Chwgg4CQ.cjs';
|
|
4
|
+
import './payload-types-PXkmefhZ.cjs';
|
|
5
|
+
import { S as ServerCollection, P as PublicCollection } from './const-BS2EaIp4.cjs';
|
|
6
|
+
import { C as CollectionClient } from './collection-client-BH4dIZ6c.cjs';
|
|
7
|
+
import { C as CollectionType } from './types-CyMz0Kzc.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 {
|
|
4
|
-
import './payload-types-
|
|
5
|
-
import { S as ServerCollection, P as PublicCollection } from './const-
|
|
6
|
-
import { C as CollectionClient } from './collection-client-
|
|
7
|
-
import { C as CollectionType } from './types-
|
|
3
|
+
import { d8 as ApiQueryOptions, di as PayloadFindResponse, dD as PublicReadQueryOptions, dj as PayloadMutationResponse, dE as CustomerAuth, dF as CustomerProfile, dG as CustomerAuthResponse, dH as CustomerLoginData, dI as CustomerRegisterResponse, dJ as CustomerRegisterData, dK as CustomerRefreshResponse, dL as UpdateProfileData, dM as ProductListingPageParams, dN as ProductListingPageBaseParams, dO as ProductDetailParams, dP as ProductDetailCatalogResult, dQ as ProductListingPageCatalogParams, dR as ProductListingPageResult, dS as ProductListingGroupsCatalogItem, dT as ProductListingPageFullParams, dU as ProductListingGroupsItem, dm as RootClient, cp as RootServerClient } from './types-lbzbJSZh.js';
|
|
4
|
+
import './payload-types-PXkmefhZ.js';
|
|
5
|
+
import { S as ServerCollection, P as PublicCollection } from './const-CCvoknRY.js';
|
|
6
|
+
import { C as CollectionClient } from './collection-client-lLAl3xCZ.js';
|
|
7
|
+
import { C as CollectionType } from './types-CQRsG6sA.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';
|
package/dist/realtime.d.cts
CHANGED
|
@@ -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-
|
|
4
|
-
import './payload-types-
|
|
3
|
+
import { P as PublicCollection } from './const-BS2EaIp4.cjs';
|
|
4
|
+
import './payload-types-PXkmefhZ.cjs';
|
|
5
5
|
|
|
6
6
|
interface UseRealtimeQueryOptions {
|
|
7
7
|
/** Filter events to specific collections. Empty/undefined = all collections. */
|
package/dist/realtime.d.ts
CHANGED
|
@@ -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-
|
|
4
|
-
import './payload-types-
|
|
3
|
+
import { P as PublicCollection } from './const-CCvoknRY.js';
|
|
4
|
+
import './payload-types-PXkmefhZ.js';
|
|
5
5
|
|
|
6
6
|
interface UseRealtimeQueryOptions {
|
|
7
7
|
/** Filter events to specific collections. Empty/undefined = all collections. */
|
package/dist/server.cjs
CHANGED
|
@@ -911,7 +911,7 @@ async function httpFetch(url, options) {
|
|
|
911
911
|
);
|
|
912
912
|
const usageError = attachRequestId(
|
|
913
913
|
createUsageLimitError(
|
|
914
|
-
`Monthly API usage limit exceeded (${current.toLocaleString()}/${limit.toLocaleString()})`,
|
|
914
|
+
`Monthly API usage limit exceeded (${current.toLocaleString("en-US")}/${limit.toLocaleString("en-US")})`,
|
|
915
915
|
{ limit, current, remaining },
|
|
916
916
|
{
|
|
917
917
|
url,
|
|
@@ -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([
|
|
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
|
-
|
|
3055
|
-
|
|
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",
|
|
@@ -4901,6 +4968,11 @@ function getRelationID(value) {
|
|
|
4901
4968
|
}
|
|
4902
4969
|
return void 0;
|
|
4903
4970
|
}
|
|
4971
|
+
function compareOrdinal(left, right) {
|
|
4972
|
+
if (left < right) return -1;
|
|
4973
|
+
if (left > right) return 1;
|
|
4974
|
+
return 0;
|
|
4975
|
+
}
|
|
4904
4976
|
function extractEntityId(value) {
|
|
4905
4977
|
if (typeof value === "string") return value;
|
|
4906
4978
|
if (typeof value === "number") return String(value);
|
|
@@ -5513,7 +5585,7 @@ function compareVariantOrder(a, b) {
|
|
|
5513
5585
|
}
|
|
5514
5586
|
const aId = String(getRelationID(a.id) ?? "");
|
|
5515
5587
|
const bId = String(getRelationID(b.id) ?? "");
|
|
5516
|
-
return aId
|
|
5588
|
+
return compareOrdinal(aId, bId);
|
|
5517
5589
|
}
|
|
5518
5590
|
function getVariantAvailableForSale(variant) {
|
|
5519
5591
|
if (variant.isActive === false) return false;
|
|
@@ -6720,6 +6792,8 @@ function buildRangeEndpoint(params) {
|
|
|
6720
6792
|
function buildAdmissionAvailabilityEndpoint(params) {
|
|
6721
6793
|
const urlParams = new URLSearchParams();
|
|
6722
6794
|
urlParams.set("occurrence", params.occurrence);
|
|
6795
|
+
const normalizedMarket2 = params.market?.trim();
|
|
6796
|
+
if (normalizedMarket2) urlParams.set("market", normalizedMarket2);
|
|
6723
6797
|
return resolveOperationPath(
|
|
6724
6798
|
EVENTS_ENDPOINT_OPERATIONS.occurrences.admissionAvailability,
|
|
6725
6799
|
{ query: urlParams }
|
|
@@ -6922,16 +6996,37 @@ var MembershipApi = class extends BaseApi {
|
|
|
6922
6996
|
}
|
|
6923
6997
|
/**
|
|
6924
6998
|
* Store/read only app-encrypted billing ciphertext for the Membership's
|
|
6925
|
-
* method.
|
|
6926
|
-
*
|
|
6927
|
-
*
|
|
6999
|
+
* method. Obtain generation from billingCustodyContext before a new upload
|
|
7000
|
+
* or read, and retain that same generation for every mutation based on the
|
|
7001
|
+
* read. Never rediscover and retry a mutation after a generation mismatch.
|
|
6928
7002
|
*/
|
|
6929
7003
|
async billingCustody(params) {
|
|
6930
7004
|
const { webhookSecret, ...input } = params;
|
|
6931
|
-
|
|
6932
|
-
|
|
6933
|
-
|
|
6934
|
-
|
|
7005
|
+
return this.requestBillingCustody(
|
|
7006
|
+
{
|
|
7007
|
+
kind: "billing-custody.v1",
|
|
7008
|
+
...input
|
|
7009
|
+
},
|
|
7010
|
+
webhookSecret
|
|
7011
|
+
);
|
|
7012
|
+
}
|
|
7013
|
+
/** Requires the same server key, Membership and delegated HMAC as custody. */
|
|
7014
|
+
async billingCustodyContext(params) {
|
|
7015
|
+
const result = await this.requestBillingCustody(
|
|
7016
|
+
{
|
|
7017
|
+
kind: "billing-custody.v1",
|
|
7018
|
+
action: "context",
|
|
7019
|
+
membershipId: params.membershipId
|
|
7020
|
+
},
|
|
7021
|
+
params.webhookSecret
|
|
7022
|
+
);
|
|
7023
|
+
if (!result || typeof result !== "object" || Array.isArray(result) || Object.keys(result).length !== 2 || !("action" in result) || result.action !== "context" || !("generation" in result) || typeof result.generation !== "string" || !/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(
|
|
7024
|
+
result.generation
|
|
7025
|
+
))
|
|
7026
|
+
throw new Error("Invalid billing custody context response");
|
|
7027
|
+
return { action: "context", generation: result.generation };
|
|
7028
|
+
}
|
|
7029
|
+
async requestBillingCustody(body, webhookSecret) {
|
|
6935
7030
|
const timestamp2 = Date.now().toString();
|
|
6936
7031
|
const deliveryId = crypto.randomUUID();
|
|
6937
7032
|
const signature = await custodySignature(
|
|
@@ -7295,7 +7390,8 @@ var ServerClient = class _ServerClient {
|
|
|
7295
7390
|
subscribe: membershipApi.subscribe.bind(membershipApi),
|
|
7296
7391
|
endSubscribeIntent: membershipApi.endSubscribeIntent.bind(membershipApi),
|
|
7297
7392
|
cancel: membershipApi.cancel.bind(membershipApi),
|
|
7298
|
-
billingCustody: membershipApi.billingCustody.bind(membershipApi)
|
|
7393
|
+
billingCustody: membershipApi.billingCustody.bind(membershipApi),
|
|
7394
|
+
billingCustodyContext: membershipApi.billingCustodyContext.bind(membershipApi)
|
|
7299
7395
|
};
|
|
7300
7396
|
this.customerGroups = new CustomerGroupApi(serverOptions);
|
|
7301
7397
|
this.externalEffectClaims = new ExternalEffectClaimsApi(serverOptions);
|