@commercengine/pos 0.4.6 → 0.5.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 +9 -5
- package/dist/index.d.mts +6471 -5020
- package/dist/index.mjs +1107 -92
- package/dist/index.mjs.map +1 -1
- package/package.json +7 -10
- package/dist/admin-types.d.mts +0 -2239
- package/dist/admin-types.mjs +0 -1
package/README.md
CHANGED
|
@@ -464,18 +464,22 @@ const pos = new PosSDK({
|
|
|
464
464
|
|
|
465
465
|
The SDK is written in TypeScript and provides full type safety with advanced schema handling:
|
|
466
466
|
|
|
467
|
-
###
|
|
468
|
-
The
|
|
467
|
+
### Single-Spec Typing
|
|
468
|
+
The SDK is generated from the dedicated POS OpenAPI spec, which describes the
|
|
469
|
+
full surface — storefront-backed and admin-proxied operations alike — in one
|
|
470
|
+
document. Every method is typed from the same `paths` schema:
|
|
469
471
|
|
|
470
472
|
```typescript
|
|
471
|
-
//
|
|
473
|
+
// Storefront-backed POS operation
|
|
472
474
|
await pos.createOrder({ cart_id: "cart-123" });
|
|
473
475
|
|
|
474
|
-
// Admin POS operation
|
|
476
|
+
// Admin-proxied POS operation, same client, same schema
|
|
475
477
|
await pos.listOrders({ page: 1, limit: 10 });
|
|
476
478
|
```
|
|
477
479
|
|
|
478
|
-
|
|
480
|
+
Where an admin operation's schema shares a name with a different storefront
|
|
481
|
+
definition, the admin one carries an `Admin` prefix (`AdminOrder`,
|
|
482
|
+
`AdminPagination`, …), so there are no type conflicts.
|
|
479
483
|
|
|
480
484
|
```typescript
|
|
481
485
|
import type {
|