@01.software/sdk 0.32.0 → 0.33.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 (46) hide show
  1. package/README.md +43 -20
  2. package/dist/client.cjs +31 -2
  3. package/dist/client.cjs.map +1 -1
  4. package/dist/client.d.cts +6 -6
  5. package/dist/client.d.ts +6 -6
  6. package/dist/client.js +31 -2
  7. package/dist/client.js.map +1 -1
  8. package/dist/{collection-client-DPGXnhoF.d.ts → collection-client-B6SlhzIP.d.ts} +3 -3
  9. package/dist/{collection-client-CORhppPb.d.cts → collection-client-De6eKW1J.d.cts} +3 -3
  10. package/dist/{const-Brk2Ff0q.d.cts → const-DwmSDeWq.d.ts} +2 -2
  11. package/dist/{const-DcY2_z9O.d.ts → const-sPR2IkCe.d.cts} +2 -2
  12. package/dist/index.cjs +256 -90
  13. package/dist/index.cjs.map +1 -1
  14. package/dist/index.d.cts +7 -7
  15. package/dist/index.d.ts +7 -7
  16. package/dist/index.js +256 -90
  17. package/dist/index.js.map +1 -1
  18. package/dist/{payload-types-DVK1QCeU.d.cts → payload-types-dkeQyrDC.d.cts} +1562 -1436
  19. package/dist/{payload-types-DVK1QCeU.d.ts → payload-types-dkeQyrDC.d.ts} +1562 -1436
  20. package/dist/query.cjs.map +1 -1
  21. package/dist/query.d.cts +9 -9
  22. package/dist/query.d.ts +9 -9
  23. package/dist/query.js.map +1 -1
  24. package/dist/realtime.d.cts +2 -2
  25. package/dist/realtime.d.ts +2 -2
  26. package/dist/server.cjs +37 -6
  27. package/dist/server.cjs.map +1 -1
  28. package/dist/server.d.cts +7 -7
  29. package/dist/server.d.ts +7 -7
  30. package/dist/server.js +37 -6
  31. package/dist/server.js.map +1 -1
  32. package/dist/{types-ByMrR_Z_.d.cts → types-B3YT092I.d.cts} +1 -1
  33. package/dist/{types-CYMSBkJC.d.ts → types-BHh0YLmq.d.ts} +27 -10
  34. package/dist/{types-CAkWqIr6.d.cts → types-BZKxss8Y.d.cts} +27 -10
  35. package/dist/{types-DUPC7Xn6.d.ts → types-Cel_4L9t.d.ts} +1 -1
  36. package/dist/ui/form.d.cts +1 -1
  37. package/dist/ui/form.d.ts +1 -1
  38. package/dist/ui/video.d.cts +1 -1
  39. package/dist/ui/video.d.ts +1 -1
  40. package/dist/webhook.cjs +94 -0
  41. package/dist/webhook.cjs.map +1 -1
  42. package/dist/webhook.d.cts +82 -7
  43. package/dist/webhook.d.ts +82 -7
  44. package/dist/webhook.js +94 -0
  45. package/dist/webhook.js.map +1 -1
  46. package/package.json +1 -1
package/dist/client.d.cts CHANGED
@@ -1,10 +1,10 @@
1
- import { R as ReadOnlyCollectionClient } from './collection-client-CORhppPb.cjs';
2
- import { C as CommerceClient, a as CommunityClient, b as CustomerNamespace, c as ClientState, d as ClientConfig } from './types-CAkWqIr6.cjs';
3
- export { A as ApiQueryOptions, e as ClientMetadata, D as DebugConfig, f as DeepPartial, E as ExtractArrayType, P as PayloadFindResponse, g as PayloadMutationResponse, R as RetryConfig, h as RootClient, h as RootClientType, i as RootCollectionClient, j as RootReadOnlyQueryBuilder, S as Sort, W as Where } from './types-CAkWqIr6.cjs';
4
- export { C as Collection, P as PublicCollection } from './const-Brk2Ff0q.cjs';
1
+ import { R as ReadOnlyCollectionClient } from './collection-client-De6eKW1J.cjs';
2
+ import { C as CommerceClient, a as CommunityClient, b as CustomerNamespace, c as ClientState, d as ClientConfig } from './types-BZKxss8Y.cjs';
3
+ export { A as ApiQueryOptions, e as ClientMetadata, D as DebugConfig, f as DeepPartial, E as ExtractArrayType, P as PayloadFindResponse, g as PayloadMutationResponse, R as RetryConfig, h as RootClient, h as RootClientType, i as RootCollectionClient, j as RootReadOnlyQueryBuilder, S as Sort, W as Where } from './types-BZKxss8Y.cjs';
4
+ export { C as Collection, P as PublicCollection } from './const-sPR2IkCe.cjs';
5
5
  import './metadata.cjs';
6
- import './types-ByMrR_Z_.cjs';
7
- import './payload-types-DVK1QCeU.cjs';
6
+ import './types-B3YT092I.cjs';
7
+ import './payload-types-dkeQyrDC.cjs';
8
8
 
9
9
  declare class Client {
10
10
  commerce: CommerceClient;
package/dist/client.d.ts CHANGED
@@ -1,10 +1,10 @@
1
- import { R as ReadOnlyCollectionClient } from './collection-client-DPGXnhoF.js';
2
- import { C as CommerceClient, a as CommunityClient, b as CustomerNamespace, c as ClientState, d as ClientConfig } from './types-CYMSBkJC.js';
3
- export { A as ApiQueryOptions, e as ClientMetadata, D as DebugConfig, f as DeepPartial, E as ExtractArrayType, P as PayloadFindResponse, g as PayloadMutationResponse, R as RetryConfig, h as RootClient, h as RootClientType, i as RootCollectionClient, j as RootReadOnlyQueryBuilder, S as Sort, W as Where } from './types-CYMSBkJC.js';
4
- export { C as Collection, P as PublicCollection } from './const-DcY2_z9O.js';
1
+ import { R as ReadOnlyCollectionClient } from './collection-client-B6SlhzIP.js';
2
+ import { C as CommerceClient, a as CommunityClient, b as CustomerNamespace, c as ClientState, d as ClientConfig } from './types-BHh0YLmq.js';
3
+ export { A as ApiQueryOptions, e as ClientMetadata, D as DebugConfig, f as DeepPartial, E as ExtractArrayType, P as PayloadFindResponse, g as PayloadMutationResponse, R as RetryConfig, h as RootClient, h as RootClientType, i as RootCollectionClient, j as RootReadOnlyQueryBuilder, S as Sort, W as Where } from './types-BHh0YLmq.js';
4
+ export { C as Collection, P as PublicCollection } from './const-DwmSDeWq.js';
5
5
  import './metadata.js';
6
- import './types-DUPC7Xn6.js';
7
- import './payload-types-DVK1QCeU.js';
6
+ import './types-Cel_4L9t.js';
7
+ import './payload-types-dkeQyrDC.js';
8
8
 
9
9
  declare class Client {
10
10
  commerce: CommerceClient;
package/dist/client.js CHANGED
@@ -1348,6 +1348,30 @@ var CartApi = class {
1348
1348
  }
1349
1349
  };
1350
1350
 
1351
+ // src/core/api/product-api.ts
1352
+ var PRODUCT_DETAIL_UNAVAILABLE_REASONS = /* @__PURE__ */ new Set([
1353
+ "not_found",
1354
+ "not_published",
1355
+ "feature_disabled"
1356
+ ]);
1357
+ function isRecord(value) {
1358
+ return typeof value === "object" && value !== null;
1359
+ }
1360
+ function readProductDetailUnavailableReason(value) {
1361
+ if (!isRecord(value)) return void 0;
1362
+ const directReason = value.reason ?? value.code;
1363
+ if (typeof directReason === "string" && PRODUCT_DETAIL_UNAVAILABLE_REASONS.has(directReason)) {
1364
+ return directReason;
1365
+ }
1366
+ return readProductDetailUnavailableReason(value.body);
1367
+ }
1368
+ function productDetailResultFromError(error) {
1369
+ if (!(error instanceof SDKError) || error.status !== 404) return void 0;
1370
+ const reason = readProductDetailUnavailableReason(error.details);
1371
+ if (!reason) return void 0;
1372
+ return { found: false, reason };
1373
+ }
1374
+
1351
1375
  // src/core/commerce/commerce-client.ts
1352
1376
  var CommerceClient = class {
1353
1377
  constructor(options) {
@@ -1382,9 +1406,14 @@ var CommerceClient = class {
1382
1406
  listingGroups: (params) => execute("/api/products/listing-groups", params),
1383
1407
  detail: async (params) => {
1384
1408
  try {
1385
- return await execute("/api/products/detail", params);
1409
+ const product = await execute(
1410
+ "/api/products/detail",
1411
+ params
1412
+ );
1413
+ return { found: true, product };
1386
1414
  } catch (err) {
1387
- if (err instanceof NotFoundError) return null;
1415
+ const notFoundResult = productDetailResultFromError(err);
1416
+ if (notFoundResult) return notFoundResult;
1388
1417
  throw err;
1389
1418
  }
1390
1419
  }