@marianmeres/ecsuite 2.1.0 → 2.2.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/README.md +4 -4
- package/dist/adapters/http/customer.d.ts +2 -2
- package/dist/adapters/http/customer.js +3 -3
- package/dist/adapters/http/order.d.ts +2 -2
- package/dist/adapters/http/order.js +4 -4
- package/dist/adapters/http/payment.d.ts +1 -1
- package/dist/adapters/http/payment.js +2 -2
- package/dist/adapters/http/product.d.ts +2 -2
- package/dist/adapters/http/product.js +3 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -183,10 +183,10 @@ owner-scoped reads require a JWT):
|
|
|
183
183
|
| -------- | --------------------------------------------------------------------------------------------------- |
|
|
184
184
|
| cart | `GET/POST/PUT/DELETE {baseUrl}/cart` (DELETE with optional `?product_id=` for single-item remove) |
|
|
185
185
|
| wishlist | `GET/POST/DELETE {baseUrl}/wishlist` (DELETE with optional `?product_id=` for single-item remove) |
|
|
186
|
-
| order | `GET {baseUrl}/col/order`, `GET {baseUrl}/col/order/:id`, `POST {baseUrl}/checkout/start`
|
|
187
|
-
| customer | `GET/PUT {baseUrl}/me/col/customer/:customerId`
|
|
188
|
-
| payment | `GET {baseUrl}/by-order/:orderId`, `GET {baseUrl}/col/payment/:id`, `POST {baseUrl}/initiate` (body: `{ order_id, provider, return_url, cancel_url }` — server derives amount/currency from the order record) |
|
|
189
|
-
| product | `GET {baseUrl}/col/product/:id` (`fetchMany` = parallel single fetches — no batch endpoint assumed) |
|
|
186
|
+
| order | `GET {baseUrl}/col/order/mod`, `GET {baseUrl}/col/order/mod/:id`, `POST {baseUrl}/checkout/start` |
|
|
187
|
+
| customer | `GET/PUT {baseUrl}/me/col/customer/mod/:customerId` |
|
|
188
|
+
| payment | `GET {baseUrl}/by-order/:orderId`, `GET {baseUrl}/col/payment/mod/:id`, `POST {baseUrl}/initiate` (body: `{ order_id, provider, return_url, cancel_url }` — server derives amount/currency from the order record) |
|
|
189
|
+
| product | `GET {baseUrl}/col/product/mod/:id` (`fetchMany` = parallel single fetches — no batch endpoint assumed) |
|
|
190
190
|
|
|
191
191
|
Adapters throw raw HTTP errors (`Error` with `.status` and `.body`
|
|
192
192
|
attached); the domain manager normalizes them to `DomainError`. Responses
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* Built-in {@link CustomerAdapter} targeting the owner-scoped customer
|
|
5
5
|
* REST surface:
|
|
6
6
|
*
|
|
7
|
-
* GET {baseUrl}/me/col/customer/:customerId → { model_id, data: CustomerData }
|
|
8
|
-
* PUT {baseUrl}/me/col/customer/:customerId → { model_id, data: CustomerData }
|
|
7
|
+
* GET {baseUrl}/me/col/customer/mod/:customerId → { model_id, data: CustomerData }
|
|
8
|
+
* PUT {baseUrl}/me/col/customer/mod/:customerId → { model_id, data: CustomerData }
|
|
9
9
|
*
|
|
10
10
|
* Both calls require `Authorization: Bearer <jwt>` + a `customerId` on the
|
|
11
11
|
* context (typically resolved from the login subject claim).
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* Built-in {@link CustomerAdapter} targeting the owner-scoped customer
|
|
5
5
|
* REST surface:
|
|
6
6
|
*
|
|
7
|
-
* GET {baseUrl}/me/col/customer/:customerId → { model_id, data: CustomerData }
|
|
8
|
-
* PUT {baseUrl}/me/col/customer/:customerId → { model_id, data: CustomerData }
|
|
7
|
+
* GET {baseUrl}/me/col/customer/mod/:customerId → { model_id, data: CustomerData }
|
|
8
|
+
* PUT {baseUrl}/me/col/customer/mod/:customerId → { model_id, data: CustomerData }
|
|
9
9
|
*
|
|
10
10
|
* Both calls require `Authorization: Bearer <jwt>` + a `customerId` on the
|
|
11
11
|
* context (typically resolved from the login subject claim).
|
|
@@ -19,7 +19,7 @@ import { join, requestJson, requireCustomerId, resolveFetch, } from "./_http.js"
|
|
|
19
19
|
export function createHttpCustomerAdapter(opts = {}) {
|
|
20
20
|
const base = opts.baseUrl ?? "/api/customer";
|
|
21
21
|
const doFetch = resolveFetch(opts);
|
|
22
|
-
const url = (customerId) => join(base, `/me/col/customer/${encodeURIComponent(customerId)}`);
|
|
22
|
+
const url = (customerId) => join(base, `/me/col/customer/mod/${encodeURIComponent(customerId)}`);
|
|
23
23
|
return {
|
|
24
24
|
async fetch(ctx) {
|
|
25
25
|
const customerId = requireCustomerId(ctx, "customer.fetch");
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Built-in {@link OrderAdapter} targeting a REST surface of the shape:
|
|
5
5
|
*
|
|
6
|
-
* GET {baseUrl}/col/order → { data: [{ model_id, data }, ...] }
|
|
7
|
-
* GET {baseUrl}/col/order/:id → { model_id, data: OrderData }
|
|
6
|
+
* GET {baseUrl}/col/order/mod → { data: [{ model_id, data }, ...] }
|
|
7
|
+
* GET {baseUrl}/col/order/mod/:id → { model_id, data: OrderData }
|
|
8
8
|
* POST {baseUrl}/checkout/start → { order_id, order: OrderData, ... }
|
|
9
9
|
*
|
|
10
10
|
* `create()` only starts checkout — it calls `POST /checkout/start` and
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Built-in {@link OrderAdapter} targeting a REST surface of the shape:
|
|
5
5
|
*
|
|
6
|
-
* GET {baseUrl}/col/order → { data: [{ model_id, data }, ...] }
|
|
7
|
-
* GET {baseUrl}/col/order/:id → { model_id, data: OrderData }
|
|
6
|
+
* GET {baseUrl}/col/order/mod → { data: [{ model_id, data }, ...] }
|
|
7
|
+
* GET {baseUrl}/col/order/mod/:id → { model_id, data: OrderData }
|
|
8
8
|
* POST {baseUrl}/checkout/start → { order_id, order: OrderData, ... }
|
|
9
9
|
*
|
|
10
10
|
* `create()` only starts checkout — it calls `POST /checkout/start` and
|
|
@@ -23,11 +23,11 @@ export function createHttpOrderAdapter(opts = {}) {
|
|
|
23
23
|
const doFetch = resolveFetch(opts);
|
|
24
24
|
return {
|
|
25
25
|
async fetchAll(ctx) {
|
|
26
|
-
const r = await requestJson(doFetch, join(base, "/col/order"), { method: "GET" }, ctx);
|
|
26
|
+
const r = await requestJson(doFetch, join(base, "/col/order/mod"), { method: "GET" }, ctx);
|
|
27
27
|
return r.data ?? [];
|
|
28
28
|
},
|
|
29
29
|
async fetchOne(orderId, ctx) {
|
|
30
|
-
return await requestJson(doFetch, join(base, `/col/order/${encodeURIComponent(String(orderId))}`), { method: "GET" }, ctx);
|
|
30
|
+
return await requestJson(doFetch, join(base, `/col/order/mod/${encodeURIComponent(String(orderId))}`), { method: "GET" }, ctx);
|
|
31
31
|
},
|
|
32
32
|
async create(order, ctx) {
|
|
33
33
|
requireSessionId(ctx, "order.create");
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Built-in {@link PaymentAdapter} targeting a REST surface of the shape:
|
|
5
5
|
*
|
|
6
6
|
* GET {baseUrl}/by-order/:orderId → { data: [{ model_id, data: PaymentData }, ...] }
|
|
7
|
-
* GET {baseUrl}/col/payment/:id
|
|
7
|
+
* GET {baseUrl}/col/payment/mod/:id → { model_id, data: PaymentData }
|
|
8
8
|
* POST {baseUrl}/initiate → { payment_id, redirect_url }
|
|
9
9
|
*
|
|
10
10
|
* All calls require `X-Session-ID`; read endpoints additionally take a JWT
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Built-in {@link PaymentAdapter} targeting a REST surface of the shape:
|
|
5
5
|
*
|
|
6
6
|
* GET {baseUrl}/by-order/:orderId → { data: [{ model_id, data: PaymentData }, ...] }
|
|
7
|
-
* GET {baseUrl}/col/payment/:id
|
|
7
|
+
* GET {baseUrl}/col/payment/mod/:id → { model_id, data: PaymentData }
|
|
8
8
|
* POST {baseUrl}/initiate → { payment_id, redirect_url }
|
|
9
9
|
*
|
|
10
10
|
* All calls require `X-Session-ID`; read endpoints additionally take a JWT
|
|
@@ -43,7 +43,7 @@ export function createHttpPaymentAdapter(opts = {}) {
|
|
|
43
43
|
return (r.data ?? []).map(unwrapPayment);
|
|
44
44
|
},
|
|
45
45
|
async fetchOne(paymentId, ctx) {
|
|
46
|
-
const r = await requestJson(doFetch, join(base, `/col/payment/${encodeURIComponent(String(paymentId))}`), { method: "GET" }, ctx);
|
|
46
|
+
const r = await requestJson(doFetch, join(base, `/col/payment/mod/${encodeURIComponent(String(paymentId))}`), { method: "GET" }, ctx);
|
|
47
47
|
return unwrapPayment(r);
|
|
48
48
|
},
|
|
49
49
|
async initiate(orderId, config, ctx) {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Built-in {@link ProductAdapter} targeting a generic collection REST surface:
|
|
5
5
|
*
|
|
6
|
-
* GET {baseUrl}/col/product/:id → { model_id, data: ProductData, ... }
|
|
6
|
+
* GET {baseUrl}/col/product/mod/:id → { model_id, data: ProductData, ... }
|
|
7
7
|
*
|
|
8
8
|
* The `{ model_id, data }` model envelope is unwrapped; the adapter returns
|
|
9
9
|
* bare `ProductData` / `ProductData[]` to conform to the interface.
|
|
@@ -14,5 +14,5 @@ import type { ProductAdapter } from "../../types/adapter.js";
|
|
|
14
14
|
import { type HttpAdapterOptions } from "./_http.js";
|
|
15
15
|
/** Options for {@link createHttpProductAdapter}. */
|
|
16
16
|
export type HttpProductAdapterOptions = HttpAdapterOptions;
|
|
17
|
-
/** Build a product adapter against the conventional `/col/product` REST surface. */
|
|
17
|
+
/** Build a product adapter against the conventional `/col/product/mod` REST surface. */
|
|
18
18
|
export declare function createHttpProductAdapter(opts?: HttpProductAdapterOptions): ProductAdapter;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Built-in {@link ProductAdapter} targeting a generic collection REST surface:
|
|
5
5
|
*
|
|
6
|
-
* GET {baseUrl}/col/product/:id → { model_id, data: ProductData, ... }
|
|
6
|
+
* GET {baseUrl}/col/product/mod/:id → { model_id, data: ProductData, ... }
|
|
7
7
|
*
|
|
8
8
|
* The `{ model_id, data }` model envelope is unwrapped; the adapter returns
|
|
9
9
|
* bare `ProductData` / `ProductData[]` to conform to the interface.
|
|
@@ -11,12 +11,12 @@
|
|
|
11
11
|
* There is no batch endpoint — `fetchMany` issues parallel GETs.
|
|
12
12
|
*/
|
|
13
13
|
import { join, requestJson, resolveFetch, } from "./_http.js";
|
|
14
|
-
/** Build a product adapter against the conventional `/col/product` REST surface. */
|
|
14
|
+
/** Build a product adapter against the conventional `/col/product/mod` REST surface. */
|
|
15
15
|
export function createHttpProductAdapter(opts = {}) {
|
|
16
16
|
const base = opts.baseUrl ?? "/api/product";
|
|
17
17
|
const doFetch = resolveFetch(opts);
|
|
18
18
|
async function fetchOne(productId, ctx) {
|
|
19
|
-
const r = await requestJson(doFetch, join(base, `/col/product/${encodeURIComponent(String(productId))}`), { method: "GET" }, ctx);
|
|
19
|
+
const r = await requestJson(doFetch, join(base, `/col/product/mod/${encodeURIComponent(String(productId))}`), { method: "GET" }, ctx);
|
|
20
20
|
return r.data;
|
|
21
21
|
}
|
|
22
22
|
return {
|