@revenexx/cover 0.2.5 → 0.2.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@revenexx/cover",
3
- "version": "0.2.5",
3
+ "version": "0.2.6",
4
4
  "description": "Cover — revenexx design system for Nuxt. Distributed as a Nuxt layer: generic UI components, theming tokens and stores shared by the demo shop, custom storefronts and the Blokkli theme.",
5
5
  "type": "module",
6
6
  "main": "./nuxt.config.ts",
@@ -38,7 +38,7 @@
38
38
  "@formkit/vue": "^1.6.0",
39
39
  "@iconify-json/lucide": "^1.2.111",
40
40
  "@internationalized/date": "^3.12.0",
41
- "@revenexx/sdk": "^0.0.10",
41
+ "@revenexx/sdk": "^0.0.11",
42
42
  "@revenexx/storage-model-viewer": "^0.3.0",
43
43
  "@vueuse/core": "^14.3.0",
44
44
  "typesense": "^3.0.5"
@@ -75,12 +75,12 @@ export class ApiAddressBookService implements IAddressBookService {
75
75
  return [];
76
76
  }
77
77
  try {
78
- // Raw call: the list contract does not declare query params yet.
79
- const { items } = await useRevenexxSdk().call<{ items: ApiAddressRow[] }>(
80
- "GET",
81
- "/v1/customers/addresses",
82
- { query: { contact_id, limit: 200 } },
83
- );
78
+ // Typed list filter (customers.addresses.list declares its query
79
+ // params — @revenexx/sdk >= 0.0.11).
80
+ const { items } = await useRevenexxSdk().customers.customersAddressesList({
81
+ contactId: contact_id,
82
+ limit: 200,
83
+ }) as unknown as { items: ApiAddressRow[] };
84
84
  return items.map(toAccountAddress);
85
85
  }
86
86
  catch (err) {
@@ -58,10 +58,6 @@ function resolveOwner(event: H3Event): CartOwner {
58
58
  return { contactId, sessionKey: getOrCreateCartSessionId(event) };
59
59
  }
60
60
 
61
- function ownerQuery(owner: CartOwner): Record<string, string> {
62
- return owner.contactId ? { contact_id: owner.contactId } : { session_key: owner.sessionKey };
63
- }
64
-
65
61
  /** Storefront CartItem → carts-app line. The snapshot is the loose product copy. */
66
62
  function toApiLine(item: CartItem, position: number): Record<string, unknown> {
67
63
  return {
@@ -138,16 +134,13 @@ function toSummary(cart: ApiCart): CartSummaryRow {
138
134
  */
139
135
  export class ApiCartService implements ICartService, ICartManager {
140
136
  private async listActive(owner: CartOwner): Promise<ApiCart[]> {
141
- // Raw call: carts.list does not declare its query parameters in the
142
- // contract yet, so the generated cartsList() cannot filter by owner.
143
- const { items } = await useRevenexxSdk().call<{ items: ApiCart[] }>("GET", "/v1/carts", {
144
- query: {
145
- ...ownerQuery(owner),
146
- status: "active",
147
- limit: 100,
148
- order: "updated_at.desc",
149
- },
150
- });
137
+ // Typed list filter (carts.list declares its query params — @revenexx/sdk >= 0.0.11).
138
+ const { items } = await useRevenexxSdk().carts.cartsList({
139
+ ...(owner.contactId ? { contactId: owner.contactId } : { sessionKey: owner.sessionKey }),
140
+ status: "active",
141
+ limit: 100,
142
+ order: "updated_at.desc",
143
+ }) as unknown as { items: ApiCart[] };
151
144
  return items;
152
145
  }
153
146
 
@@ -189,12 +189,13 @@ async function loadLiveCategoryRows(): Promise<LiveCategoryRow[]> {
189
189
  const rows: LiveCategoryRow[] = [];
190
190
  let offset = 0;
191
191
  // Paginate defensively — the demo tenant has a few hundred categories.
192
- // Raw call: the categories list contract does not declare limit/offset
193
- // yet, so the generated productsCategoriesList() cannot paginate.
192
+ // Typed list (products.categories.list declares limit/offset/order —
193
+ // @revenexx/sdk >= 0.0.11).
194
194
  for (let pageIndex = 0; pageIndex < 25; pageIndex++) {
195
- const page = await sdk.call<LiveCategoryPage>("GET", "/v1/products/categories", {
196
- query: { limit: CATEGORY_PAGE_LIMIT, offset },
197
- });
195
+ const page = await sdk.products.productsCategoriesList({
196
+ limit: CATEGORY_PAGE_LIMIT,
197
+ offset,
198
+ }) as unknown as LiveCategoryPage;
198
199
  rows.push(...page.items);
199
200
  if (!page.page.hasMore) {
200
201
  break;
@@ -9,9 +9,8 @@ import type { OrderList, OrderListPosition } from "../../app/interfaces/account/
9
9
  * service. Request params are camelCase (the SDK maps to the gateway's
10
10
  * snake_case); responses come back snake_case.
11
11
  *
12
- * Only the visibility-filtered LIST still uses the `sdk.call()` escape
13
- * hatch: `orderlistsList()` declares no query parameters in the contract
14
- * yet, so it cannot filter by owner/organization. Everything else is typed.
12
+ * The visibility-filtered LIST is typed too (orderlists.list declares
13
+ * owner_id/organization_id/kind since @revenexx/sdk >= 0.0.11).
15
14
  *
16
15
  * Identity: the app stores `owner_id`/`organization_id` and `GET /orderlists`
17
16
  * returns the owner's own lists ∪ the organization's shared lists. We supply
@@ -118,11 +117,12 @@ function toCoverList(row: AppList): OrderList {
118
117
  export async function listOrderLists(event: H3Event): Promise<OrderList[]> {
119
118
  const me = await actor(event);
120
119
  const sdk = useRevenexxSdk();
121
- // Escape hatch: orderlistsList() declares no query params, so it cannot
122
- // filter by owner/organization. The fan-out to full lists is typed.
123
- const { items } = await sdk.call<{ items: AppList[] }>("GET", "/v1/orderlists", {
124
- query: { owner_id: me.contactId, ...(me.organizationId ? { organization_id: me.organizationId } : {}) },
125
- });
120
+ // Typed list filter (orderlists.list declares owner_id/organization_id —
121
+ // @revenexx/sdk >= 0.0.11). The fan-out to full lists is typed too.
122
+ const { items } = await sdk.orderlists.orderlistsList({
123
+ ownerId: me.contactId,
124
+ ...(me.organizationId ? { organizationId: me.organizationId } : {}),
125
+ }) as unknown as { items: AppList[] };
126
126
  const full = await Promise.all(items.map(async row => sdk.orderlists.orderlistsGet({ id: row.id })));
127
127
  return full.map(row => toCoverList(row as unknown as AppList));
128
128
  }