@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.
- package/README.md +43 -20
- package/dist/client.cjs +31 -2
- 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 +31 -2
- package/dist/client.js.map +1 -1
- package/dist/{collection-client-DPGXnhoF.d.ts → collection-client-B6SlhzIP.d.ts} +3 -3
- package/dist/{collection-client-CORhppPb.d.cts → collection-client-De6eKW1J.d.cts} +3 -3
- package/dist/{const-Brk2Ff0q.d.cts → const-DwmSDeWq.d.ts} +2 -2
- package/dist/{const-DcY2_z9O.d.ts → const-sPR2IkCe.d.cts} +2 -2
- package/dist/index.cjs +256 -90
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -7
- package/dist/index.d.ts +7 -7
- package/dist/index.js +256 -90
- package/dist/index.js.map +1 -1
- package/dist/{payload-types-DVK1QCeU.d.cts → payload-types-dkeQyrDC.d.cts} +1562 -1436
- package/dist/{payload-types-DVK1QCeU.d.ts → payload-types-dkeQyrDC.d.ts} +1562 -1436
- package/dist/query.cjs.map +1 -1
- package/dist/query.d.cts +9 -9
- package/dist/query.d.ts +9 -9
- package/dist/query.js.map +1 -1
- package/dist/realtime.d.cts +2 -2
- package/dist/realtime.d.ts +2 -2
- package/dist/server.cjs +37 -6
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.cts +7 -7
- package/dist/server.d.ts +7 -7
- package/dist/server.js +37 -6
- package/dist/server.js.map +1 -1
- package/dist/{types-ByMrR_Z_.d.cts → types-B3YT092I.d.cts} +1 -1
- package/dist/{types-CYMSBkJC.d.ts → types-BHh0YLmq.d.ts} +27 -10
- package/dist/{types-CAkWqIr6.d.cts → types-BZKxss8Y.d.cts} +27 -10
- package/dist/{types-DUPC7Xn6.d.ts → types-Cel_4L9t.d.ts} +1 -1
- 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.cjs +94 -0
- package/dist/webhook.cjs.map +1 -1
- package/dist/webhook.d.cts +82 -7
- package/dist/webhook.d.ts +82 -7
- package/dist/webhook.js +94 -0
- package/dist/webhook.js.map +1 -1
- package/package.json +1 -1
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-sPR2IkCe.cjs';
|
|
4
|
+
import './payload-types-dkeQyrDC.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-DwmSDeWq.js';
|
|
4
|
+
import './payload-types-dkeQyrDC.js';
|
|
5
5
|
|
|
6
6
|
interface UseRealtimeQueryOptions {
|
|
7
7
|
/** Filter events to specific collections. Empty/undefined = all collections. */
|
package/dist/server.cjs
CHANGED
|
@@ -1435,6 +1435,28 @@ var CartApi = class {
|
|
|
1435
1435
|
};
|
|
1436
1436
|
|
|
1437
1437
|
// src/core/api/product-api.ts
|
|
1438
|
+
var PRODUCT_DETAIL_UNAVAILABLE_REASONS = /* @__PURE__ */ new Set([
|
|
1439
|
+
"not_found",
|
|
1440
|
+
"not_published",
|
|
1441
|
+
"feature_disabled"
|
|
1442
|
+
]);
|
|
1443
|
+
function isRecord(value) {
|
|
1444
|
+
return typeof value === "object" && value !== null;
|
|
1445
|
+
}
|
|
1446
|
+
function readProductDetailUnavailableReason(value) {
|
|
1447
|
+
if (!isRecord(value)) return void 0;
|
|
1448
|
+
const directReason = value.reason ?? value.code;
|
|
1449
|
+
if (typeof directReason === "string" && PRODUCT_DETAIL_UNAVAILABLE_REASONS.has(directReason)) {
|
|
1450
|
+
return directReason;
|
|
1451
|
+
}
|
|
1452
|
+
return readProductDetailUnavailableReason(value.body);
|
|
1453
|
+
}
|
|
1454
|
+
function productDetailResultFromError(error) {
|
|
1455
|
+
if (!(error instanceof SDKError) || error.status !== 404) return void 0;
|
|
1456
|
+
const reason = readProductDetailUnavailableReason(error.details);
|
|
1457
|
+
if (!reason) return void 0;
|
|
1458
|
+
return { found: false, reason };
|
|
1459
|
+
}
|
|
1438
1460
|
var ProductApi = class extends BaseApi {
|
|
1439
1461
|
constructor(options) {
|
|
1440
1462
|
super("ProductApi", options);
|
|
@@ -1455,15 +1477,24 @@ var ProductApi = class extends BaseApi {
|
|
|
1455
1477
|
}
|
|
1456
1478
|
/**
|
|
1457
1479
|
* Fetch full product detail by slug or id.
|
|
1458
|
-
* Returns
|
|
1459
|
-
*
|
|
1460
|
-
*
|
|
1480
|
+
* Returns a discriminated result so storefronts can distinguish missing,
|
|
1481
|
+
* unpublished, and feature-disabled products.
|
|
1482
|
+
*
|
|
1483
|
+
* Only product-detail 404 responses carrying one of those allowlisted reasons
|
|
1484
|
+
* are mapped to `{ found: false, reason }`. Unknown or uncoded 404s, plus
|
|
1485
|
+
* permission/auth errors such as tenant mismatch, continue to throw typed SDK
|
|
1486
|
+
* errors instead of being collapsed into a storefront absence result.
|
|
1461
1487
|
*/
|
|
1462
1488
|
async detail(params) {
|
|
1463
1489
|
try {
|
|
1464
|
-
|
|
1490
|
+
const product = await this.request(
|
|
1491
|
+
"/api/products/detail",
|
|
1492
|
+
params
|
|
1493
|
+
);
|
|
1494
|
+
return { found: true, product };
|
|
1465
1495
|
} catch (err) {
|
|
1466
|
-
|
|
1496
|
+
const notFoundResult = productDetailResultFromError(err);
|
|
1497
|
+
if (notFoundResult) return notFoundResult;
|
|
1467
1498
|
throw err;
|
|
1468
1499
|
}
|
|
1469
1500
|
}
|
|
@@ -1530,7 +1561,7 @@ var OrderApi = class extends BaseApi {
|
|
|
1530
1561
|
}
|
|
1531
1562
|
bulkImportFulfillments(params) {
|
|
1532
1563
|
return this.request(
|
|
1533
|
-
"/api/
|
|
1564
|
+
"/api/fulfillments/bulk-import",
|
|
1534
1565
|
params
|
|
1535
1566
|
);
|
|
1536
1567
|
}
|