@01.software/sdk 0.72.1 → 0.74.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 (47) hide show
  1. package/CHANGELOG.md +73 -0
  2. package/README.md +70 -3
  3. package/dist/client.cjs +21 -11
  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 +21 -11
  8. package/dist/client.js.map +1 -1
  9. package/dist/{collection-client-B3CnqMDQ.d.cts → collection-client-Bb1Wa6T6.d.cts} +4 -4
  10. package/dist/{collection-client-uOgS_1bC.d.ts → collection-client-DBrLM9RR.d.ts} +4 -4
  11. package/dist/{const-BJBK7jBl.d.ts → const-CkY2zB6J.d.ts} +1 -1
  12. package/dist/{const-_ZfJjRQG.d.cts → const-DWTSgCkn.d.cts} +1 -1
  13. package/dist/{index-CBaP4q8r.d.ts → index-Daoh-98A.d.ts} +3 -3
  14. package/dist/{index-CI_LFWiG.d.cts → index-Di5AybQN.d.cts} +3 -3
  15. package/dist/index.cjs +22 -12
  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 +22 -12
  20. package/dist/index.js.map +1 -1
  21. package/dist/{payload-types-BRg8Yary.d.cts → payload-types-zukuL1s_.d.cts} +408 -1761
  22. package/dist/{payload-types-BRg8Yary.d.ts → payload-types-zukuL1s_.d.ts} +408 -1761
  23. package/dist/query.cjs +4 -0
  24. package/dist/query.cjs.map +1 -1
  25. package/dist/query.d.cts +5 -5
  26. package/dist/query.d.ts +5 -5
  27. package/dist/query.js +4 -0
  28. package/dist/query.js.map +1 -1
  29. package/dist/realtime.d.cts +2 -2
  30. package/dist/realtime.d.ts +2 -2
  31. package/dist/server.cjs +51 -19
  32. package/dist/server.cjs.map +1 -1
  33. package/dist/server.d.cts +8 -7
  34. package/dist/server.d.ts +8 -7
  35. package/dist/server.js +51 -19
  36. package/dist/server.js.map +1 -1
  37. package/dist/{types-FyklqLAk.d.cts → types-BI7aowdu.d.cts} +4 -4
  38. package/dist/{types-Cmnxxvuv.d.ts → types-BsJokT6P.d.ts} +76 -16
  39. package/dist/{types-DLjSqL0P.d.ts → types-SsS04wGw.d.ts} +4 -4
  40. package/dist/{types-CnkJQUez.d.cts → types-evAvqRBj.d.cts} +76 -16
  41. package/dist/ui/form.d.cts +1 -1
  42. package/dist/ui/form.d.ts +1 -1
  43. package/dist/ui/video.d.cts +1 -1
  44. package/dist/ui/video.d.ts +1 -1
  45. package/dist/webhook.d.cts +5 -5
  46. package/dist/webhook.d.ts +5 -5
  47. package/package.json +1 -1
@@ -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-_ZfJjRQG.cjs';
4
- import './payload-types-BRg8Yary.cjs';
3
+ import { P as PublicCollection } from './const-DWTSgCkn.cjs';
4
+ import './payload-types-zukuL1s_.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-BJBK7jBl.js';
4
- import './payload-types-BRg8Yary.js';
3
+ import { P as PublicCollection } from './const-CkY2zB6J.js';
4
+ import './payload-types-zukuL1s_.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,
@@ -1401,6 +1401,10 @@ var EMBEDDED_ADMIN_ENDPOINT_OPERATIONS = {
1401
1401
  configure: operation("tenants", "patch", "/embedded-admin-app"),
1402
1402
  disable: operation("tenants", "delete", "/embedded-admin-app")
1403
1403
  };
1404
+ var FIELD_CONFIG_ENDPOINT_OPERATIONS = {
1405
+ list: operation("field-configs", "get", "/list"),
1406
+ save: operation("field-configs", "post", "/save")
1407
+ };
1404
1408
  var EVENTS_ENDPOINT_OPERATIONS = {
1405
1409
  registrations: {
1406
1410
  register: operation("event-registrations", "post", "/register"),
@@ -4968,6 +4972,11 @@ function getRelationID(value) {
4968
4972
  }
4969
4973
  return void 0;
4970
4974
  }
4975
+ function compareOrdinal(left, right) {
4976
+ if (left < right) return -1;
4977
+ if (left > right) return 1;
4978
+ return 0;
4979
+ }
4971
4980
  function extractEntityId(value) {
4972
4981
  if (typeof value === "string") return value;
4973
4982
  if (typeof value === "number") return String(value);
@@ -5573,14 +5582,17 @@ function buildProductHref(product, group, options = {}) {
5573
5582
  return params.size > 0 ? `${path}?${params.toString()}` : path;
5574
5583
  }
5575
5584
  function compareVariantOrder(a, b) {
5576
- const aOrder = Number(a._order ?? Number.MAX_SAFE_INTEGER);
5577
- const bOrder = Number(b._order ?? Number.MAX_SAFE_INTEGER);
5578
- if (Number.isFinite(aOrder) && Number.isFinite(bOrder) && aOrder !== bOrder) {
5579
- return aOrder - bOrder;
5585
+ const aOrder = a._order || null;
5586
+ const bOrder = b._order || null;
5587
+ if (aOrder !== bOrder) {
5588
+ if (aOrder === null) return 1;
5589
+ if (bOrder === null) return -1;
5590
+ const byOrder = compareOrdinal(aOrder, bOrder);
5591
+ if (byOrder !== 0) return byOrder;
5580
5592
  }
5581
5593
  const aId = String(getRelationID(a.id) ?? "");
5582
5594
  const bId = String(getRelationID(b.id) ?? "");
5583
- return aId.localeCompare(bId);
5595
+ return compareOrdinal(aId, bId);
5584
5596
  }
5585
5597
  function getVariantAvailableForSale(variant) {
5586
5598
  if (variant.isActive === false) return false;
@@ -5827,11 +5839,7 @@ function buildProductListingPageWhere(params) {
5827
5839
  const search = params.search?.trim();
5828
5840
  if (search) {
5829
5841
  clauses.push({
5830
- or: [
5831
- { title: { like: search } },
5832
- { slug: { like: search } },
5833
- { handle: { like: search } }
5834
- ]
5842
+ or: [{ title: { like: search } }, { slug: { like: search } }]
5835
5843
  });
5836
5844
  }
5837
5845
  const filters = params.filters;
@@ -6787,6 +6795,8 @@ function buildRangeEndpoint(params) {
6787
6795
  function buildAdmissionAvailabilityEndpoint(params) {
6788
6796
  const urlParams = new URLSearchParams();
6789
6797
  urlParams.set("occurrence", params.occurrence);
6798
+ const normalizedMarket2 = params.market?.trim();
6799
+ if (normalizedMarket2) urlParams.set("market", normalizedMarket2);
6790
6800
  return resolveOperationPath(
6791
6801
  EVENTS_ENDPOINT_OPERATIONS.occurrences.admissionAvailability,
6792
6802
  { query: urlParams }
@@ -6989,16 +6999,37 @@ var MembershipApi = class extends BaseApi {
6989
6999
  }
6990
7000
  /**
6991
7001
  * Store/read only app-encrypted billing ciphertext for the Membership's
6992
- * method. The tenant server receives the non-secret restore generation from
6993
- * its platform operator's integration configuration; it is not discovered
6994
- * from an unauthenticated endpoint.
7002
+ * method. Obtain generation from billingCustodyContext before a new upload
7003
+ * or read, and retain that same generation for every mutation based on the
7004
+ * read. Never rediscover and retry a mutation after a generation mismatch.
6995
7005
  */
6996
7006
  async billingCustody(params) {
6997
7007
  const { webhookSecret, ...input } = params;
6998
- const body = {
6999
- kind: "billing-custody.v1",
7000
- ...input
7001
- };
7008
+ return this.requestBillingCustody(
7009
+ {
7010
+ kind: "billing-custody.v1",
7011
+ ...input
7012
+ },
7013
+ webhookSecret
7014
+ );
7015
+ }
7016
+ /** Requires the same server key, Membership and delegated HMAC as custody. */
7017
+ async billingCustodyContext(params) {
7018
+ const result = await this.requestBillingCustody(
7019
+ {
7020
+ kind: "billing-custody.v1",
7021
+ action: "context",
7022
+ membershipId: params.membershipId
7023
+ },
7024
+ params.webhookSecret
7025
+ );
7026
+ 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(
7027
+ result.generation
7028
+ ))
7029
+ throw new Error("Invalid billing custody context response");
7030
+ return { action: "context", generation: result.generation };
7031
+ }
7032
+ async requestBillingCustody(body, webhookSecret) {
7002
7033
  const timestamp2 = Date.now().toString();
7003
7034
  const deliveryId = crypto.randomUUID();
7004
7035
  const signature = await custodySignature(
@@ -7362,7 +7393,8 @@ var ServerClient = class _ServerClient {
7362
7393
  subscribe: membershipApi.subscribe.bind(membershipApi),
7363
7394
  endSubscribeIntent: membershipApi.endSubscribeIntent.bind(membershipApi),
7364
7395
  cancel: membershipApi.cancel.bind(membershipApi),
7365
- billingCustody: membershipApi.billingCustody.bind(membershipApi)
7396
+ billingCustody: membershipApi.billingCustody.bind(membershipApi),
7397
+ billingCustodyContext: membershipApi.billingCustodyContext.bind(membershipApi)
7366
7398
  };
7367
7399
  this.customerGroups = new CustomerGroupApi(serverOptions);
7368
7400
  this.externalEffectClaims = new ExternalEffectClaimsApi(serverOptions);