@minipim/sdk 0.1.0 → 0.2.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/LICENSE ADDED
@@ -0,0 +1,15 @@
1
+ GNU AFFERO GENERAL PUBLIC LICENSE
2
+ Version 3, 19 November 2007
3
+
4
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
5
+ Everyone is permitted to copy and distribute verbatim copies
6
+ of this license document, but changing it is not allowed.
7
+
8
+ This project is licensed under the GNU Affero General Public License v3.0.
9
+ The full text of the license is available at:
10
+ https://www.gnu.org/licenses/agpl-3.0.txt
11
+
12
+ Copyright (c) 2026 Epic Design Labs
13
+
14
+ You should have received a copy of the GNU Affero General Public License
15
+ along with this program. If not, see <https://www.gnu.org/licenses/>.
package/README.md CHANGED
@@ -8,7 +8,9 @@ Typed TypeScript client for the [MiniPim](https://github.com/Epic-Design-Labs/mi
8
8
  pnpm add @minipim/sdk
9
9
  ```
10
10
 
11
- Requires Node 18+ (for native `fetch`) or a fetch polyfill.
11
+ Requires Node 18+ (for native `fetch`) or a fetch polyfill. **ESM-only** (`"type": "module"`) — no CommonJS build; use `import`, not `require`. The root entry imports no `node:` modules, so `createMinipimClient` and the attribute/pagination helpers are safe in Edge runtimes.
12
+
13
+ `baseUrl` is the **origin** (`https://api.minipim.com`); every endpoint path already includes `/v1/...`, so you pass `pim.GET('/v1/products')`, not a pre-joined URL.
12
14
 
13
15
  ## Quick start
14
16
 
@@ -74,7 +76,8 @@ import { verifyMinipimWebhook } from '@minipim/sdk/webhook';
74
76
  export async function POST(req: Request) {
75
77
  const raw = await req.text();
76
78
  const sig = req.headers.get('x-minipim-signature-256') ?? '';
77
- const ok = await verifyMinipimWebhook({
79
+ // Node verifier is synchronous — no await.
80
+ const ok = verifyMinipimWebhook({
78
81
  rawBody: raw,
79
82
  signature: sig,
80
83
  secret: process.env.MINIPIM_WEBHOOK_SECRET!,
@@ -92,36 +95,74 @@ export async function POST(req: Request) {
92
95
  ### Edge / Cloudflare Workers / Vercel Edge
93
96
 
94
97
  ```ts
95
- import { verifyMinipimWebhookEdge } from '@minipim/sdk/webhook';
98
+ import { verifyMinipimWebhookEdge } from '@minipim/sdk/webhook-edge';
96
99
 
97
100
  const ok = await verifyMinipimWebhookEdge({ rawBody, signature, secret });
101
+ if (!ok) return new Response('invalid signature', { status: 401 });
98
102
  ```
99
103
 
100
104
  Both functions:
101
105
  - Constant-time comparison (safe against timing attacks).
102
106
  - Return `false` on malformed signatures (don't throw).
103
- - Same interface; the only difference is which crypto API they use under the hood.
107
+
108
+ **Node verifier is synchronous; Edge verifier is async.** The Node one (`@minipim/sdk/webhook`) returns `boolean` — use it directly in `if (!verifyMinipimWebhook(...))`. The Edge one (`@minipim/sdk/webhook-edge`) returns `Promise<boolean>` — you must `await` it. They live on separate entry points so the Node `node:crypto` import never lands in an Edge bundle.
104
109
 
105
110
  ## Pagination
106
111
 
107
- Every list endpoint returns `{ data, limit, offset, hasMore, total? }`. Iterate via `hasMore`:
112
+ Don't hand-roll the `hasMore` loop — the SDK ships `paginate`, a generic async iterator over any list endpoint:
108
113
 
109
114
  ```ts
110
- async function* allProducts() {
111
- let offset = 0;
112
- for (;;) {
113
- const { data, error } = await pim.GET('/v1/products', {
114
- params: { query: { limit: 200, offset } },
115
- });
116
- if (error) throw new Error(error.error.message);
117
- for (const p of data.data) yield p;
118
- if (!data.hasMore) return;
119
- offset += 200;
120
- }
115
+ import { paginate, collectAll } from '@minipim/sdk';
116
+ import type { components } from '@minipim/sdk';
117
+
118
+ type Product = components['schemas']['ProductSelect'];
119
+
120
+ // stream
121
+ for await (const p of paginate<Product>(pim, '/v1/products', { query: { status: 'active' } })) {
122
+ await ingest(p);
121
123
  }
124
+
125
+ // or collect everything
126
+ const all = await collectAll<Product>(pim, '/v1/products');
122
127
  ```
123
128
 
124
- Pass `withTotal: true` if you need `data.total` — adds one `COUNT(*)` query, so leave it off on hot reads.
129
+ `paginate` manages `limit`/`offset`, honors the server's `hasMore`, and defaults to the 200-row max page size (override with `pageSize`). Pass `withTotal: true` in `query` if you need `total` — it adds one `COUNT(*)`, so leave it off on hot reads.
130
+
131
+ ## Attribute helpers
132
+
133
+ Attribute values are `unknown` and keyed by `(locale, channel)`. List responses return the raw `{ code: [{ locale, channel, value }] }` shape (only product *detail* with `?locale=&channel=` returns a flat `resolvedAttributes`). The SDK ships the flatten + coercion helpers so you don't reimplement them:
134
+
135
+ ```ts
136
+ import {
137
+ flattenAttributes, getAttribute, asMoney, asMeasurement, formatMoney,
138
+ } from '@minipim/sdk';
139
+
140
+ // resolve one code for a (locale, channel), with server-matching fallback
141
+ const desc = getAttribute(product.attributes, 'description', { locale: 'en_US', channel: 'headless-main' });
142
+
143
+ // flatten the whole bag (client-side equivalent of resolvedAttributes, for lists)
144
+ const flat = flattenAttributes(product.attributes, { locale: 'en_US', channel: 'headless-main' });
145
+
146
+ // coerce money / measurement shapes
147
+ const price = asMoney(getAttribute(product.attributes, 'price')); // { amount_cents, currency } | null
148
+ if (price) console.log(formatMoney(price)); // "$18.99"
149
+ const weight = asMeasurement(getAttribute(product.attributes, 'weight')); // { amount, unit } | null
150
+ ```
151
+
152
+ Also available at the `@minipim/sdk/attributes` subpath.
153
+
154
+ ## Error handling
155
+
156
+ `res.error` is a per-path union that's awkward to narrow. Use the shared guard:
157
+
158
+ ```ts
159
+ import { isMinipimError, getErrorMessage } from '@minipim/sdk';
160
+
161
+ const { data, error } = await pim.GET('/v1/products/{id}', { params: { path: { id } } });
162
+ if (error) {
163
+ throw new Error(getErrorMessage(error, 'fetch failed')); // pulls error.error.message
164
+ }
165
+ ```
125
166
 
126
167
  ## Reconciliation after downtime
127
168
 
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Attribute helpers. MiniPim stores attribute values keyed by
3
+ * `(locale, channel)` — list responses always return the raw
4
+ * `{ code: [{ locale, channel, value }] }` shape (only product *detail*
5
+ * with `?locale=&channel=` returns a flat `resolvedAttributes`). So every
6
+ * consumer ends up writing the same flatten + money/measurement coercions.
7
+ * These are those helpers, typed.
8
+ */
9
+ export interface AttributeValueRecord {
10
+ locale: string | null;
11
+ channel: string | null;
12
+ value: unknown;
13
+ }
14
+ export type AttributesPayload = Record<string, AttributeValueRecord[]>;
15
+ export interface Money {
16
+ amount_cents: number;
17
+ currency: string;
18
+ }
19
+ export interface Measurement {
20
+ amount: number;
21
+ unit: string;
22
+ }
23
+ export interface ResolveOptions {
24
+ locale?: string | null;
25
+ channel?: string | null;
26
+ }
27
+ /**
28
+ * Resolve a single attribute code to its value for a (locale, channel).
29
+ * Fallback order mirrors the server: exact `(locale, channel)` →
30
+ * `(locale, null)` → `(null, channel)` → `(null, null)`. Returns
31
+ * `undefined` when nothing matches.
32
+ */
33
+ export declare function getAttribute(attributes: AttributesPayload, code: string, opts?: ResolveOptions): unknown;
34
+ /**
35
+ * Flatten an entire attribute payload to a `{ code: value }` map for a
36
+ * (locale, channel) — the client-side equivalent of the server's
37
+ * `resolvedAttributes`, for use on list responses where the server doesn't
38
+ * flatten. Codes with no matching value are omitted.
39
+ */
40
+ export declare function flattenAttributes(attributes: AttributesPayload, opts?: ResolveOptions): Record<string, unknown>;
41
+ /** Narrow an attribute value to Money, or null if it isn't money-shaped. */
42
+ export declare function asMoney(value: unknown): Money | null;
43
+ /** Narrow an attribute value to Measurement, or null if it isn't measurement-shaped. */
44
+ export declare function asMeasurement(value: unknown): Measurement | null;
45
+ /** Format integer-cents Money as a localized currency string. */
46
+ export declare function formatMoney(money: Money, locale?: string): string;
47
+ //# sourceMappingURL=attributes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attributes.d.ts","sourceRoot":"","sources":["../src/attributes.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,KAAK,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,oBAAoB,EAAE,CAAC,CAAC;AAEvE,MAAM,WAAW,KAAK;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,cAAc;IAC7B,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAC1B,UAAU,EAAE,iBAAiB,EAC7B,IAAI,EAAE,MAAM,EACZ,IAAI,GAAE,cAAmB,GACxB,OAAO,CAgBT;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,iBAAiB,EAC7B,IAAI,GAAE,cAAmB,GACxB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAOzB;AAED,4EAA4E;AAC5E,wBAAgB,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,GAAG,IAAI,CAUpD;AAED,wFAAwF;AACxF,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,WAAW,GAAG,IAAI,CAUhE;AAED,iEAAiE;AACjE,wBAAgB,WAAW,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,SAAU,GAAG,MAAM,CAKlE"}
@@ -0,0 +1,76 @@
1
+ /**
2
+ * Attribute helpers. MiniPim stores attribute values keyed by
3
+ * `(locale, channel)` — list responses always return the raw
4
+ * `{ code: [{ locale, channel, value }] }` shape (only product *detail*
5
+ * with `?locale=&channel=` returns a flat `resolvedAttributes`). So every
6
+ * consumer ends up writing the same flatten + money/measurement coercions.
7
+ * These are those helpers, typed.
8
+ */
9
+ /**
10
+ * Resolve a single attribute code to its value for a (locale, channel).
11
+ * Fallback order mirrors the server: exact `(locale, channel)` →
12
+ * `(locale, null)` → `(null, channel)` → `(null, null)`. Returns
13
+ * `undefined` when nothing matches.
14
+ */
15
+ export function getAttribute(attributes, code, opts = {}) {
16
+ const records = attributes[code];
17
+ if (!records || records.length === 0)
18
+ return undefined;
19
+ const locale = opts.locale ?? null;
20
+ const channel = opts.channel ?? null;
21
+ const layers = [
22
+ [locale, channel],
23
+ [locale, null],
24
+ [null, channel],
25
+ [null, null],
26
+ ];
27
+ for (const [l, c] of layers) {
28
+ const hit = records.find((r) => r.locale === l && r.channel === c);
29
+ if (hit)
30
+ return hit.value;
31
+ }
32
+ return undefined;
33
+ }
34
+ /**
35
+ * Flatten an entire attribute payload to a `{ code: value }` map for a
36
+ * (locale, channel) — the client-side equivalent of the server's
37
+ * `resolvedAttributes`, for use on list responses where the server doesn't
38
+ * flatten. Codes with no matching value are omitted.
39
+ */
40
+ export function flattenAttributes(attributes, opts = {}) {
41
+ const out = {};
42
+ for (const code of Object.keys(attributes)) {
43
+ const v = getAttribute(attributes, code, opts);
44
+ if (v !== undefined)
45
+ out[code] = v;
46
+ }
47
+ return out;
48
+ }
49
+ /** Narrow an attribute value to Money, or null if it isn't money-shaped. */
50
+ export function asMoney(value) {
51
+ if (value &&
52
+ typeof value === 'object' &&
53
+ typeof value.amount_cents === 'number' &&
54
+ typeof value.currency === 'string') {
55
+ return value;
56
+ }
57
+ return null;
58
+ }
59
+ /** Narrow an attribute value to Measurement, or null if it isn't measurement-shaped. */
60
+ export function asMeasurement(value) {
61
+ if (value &&
62
+ typeof value === 'object' &&
63
+ typeof value.amount === 'number' &&
64
+ typeof value.unit === 'string') {
65
+ return value;
66
+ }
67
+ return null;
68
+ }
69
+ /** Format integer-cents Money as a localized currency string. */
70
+ export function formatMoney(money, locale = 'en-US') {
71
+ return new Intl.NumberFormat(locale, {
72
+ style: 'currency',
73
+ currency: money.currency,
74
+ }).format(money.amount_cents / 100);
75
+ }
76
+ //# sourceMappingURL=attributes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attributes.js","sourceRoot":"","sources":["../src/attributes.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAyBH;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAC1B,UAA6B,EAC7B,IAAY,EACZ,OAAuB,EAAE;IAEzB,MAAM,OAAO,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC;IACjC,IAAI,CAAC,OAAO,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,SAAS,CAAC;IACvD,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC;IACnC,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC;IACrC,MAAM,MAAM,GAA0C;QACpD,CAAC,MAAM,EAAE,OAAO,CAAC;QACjB,CAAC,MAAM,EAAE,IAAI,CAAC;QACd,CAAC,IAAI,EAAE,OAAO,CAAC;QACf,CAAC,IAAI,EAAE,IAAI,CAAC;KACb,CAAC;IACF,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,MAAM,EAAE,CAAC;QAC5B,MAAM,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,CAAC,OAAO,KAAK,CAAC,CAAC,CAAC;QACnE,IAAI,GAAG;YAAE,OAAO,GAAG,CAAC,KAAK,CAAC;IAC5B,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAC/B,UAA6B,EAC7B,OAAuB,EAAE;IAEzB,MAAM,GAAG,GAA4B,EAAE,CAAC;IACxC,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;QAC3C,MAAM,CAAC,GAAG,YAAY,CAAC,UAAU,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;QAC/C,IAAI,CAAC,KAAK,SAAS;YAAE,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACrC,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,4EAA4E;AAC5E,MAAM,UAAU,OAAO,CAAC,KAAc;IACpC,IACE,KAAK;QACL,OAAO,KAAK,KAAK,QAAQ;QACzB,OAAQ,KAAe,CAAC,YAAY,KAAK,QAAQ;QACjD,OAAQ,KAAe,CAAC,QAAQ,KAAK,QAAQ,EAC7C,CAAC;QACD,OAAO,KAAc,CAAC;IACxB,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,wFAAwF;AACxF,MAAM,UAAU,aAAa,CAAC,KAAc;IAC1C,IACE,KAAK;QACL,OAAO,KAAK,KAAK,QAAQ;QACzB,OAAQ,KAAqB,CAAC,MAAM,KAAK,QAAQ;QACjD,OAAQ,KAAqB,CAAC,IAAI,KAAK,QAAQ,EAC/C,CAAC;QACD,OAAO,KAAoB,CAAC;IAC9B,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,iEAAiE;AACjE,MAAM,UAAU,WAAW,CAAC,KAAY,EAAE,MAAM,GAAG,OAAO;IACxD,OAAO,IAAI,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE;QACnC,KAAK,EAAE,UAAU;QACjB,QAAQ,EAAE,KAAK,CAAC,QAAQ;KACzB,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,YAAY,GAAG,GAAG,CAAC,CAAC;AACtC,CAAC"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Error envelope + type guard. Every MiniPim 4xx/5xx returns
3
+ * `{ error: { code, message, details? } }`. openapi-fetch types `res.error`
4
+ * as a union across a path's declared error responses, which is awkward to
5
+ * narrow to `.error.message`. This guard collapses that to a single shape.
6
+ */
7
+ export interface MinipimError {
8
+ error: {
9
+ code: string;
10
+ message: string;
11
+ details?: unknown;
12
+ };
13
+ }
14
+ /** True when `value` is a MiniPim `{ error: { code, message } }` envelope. */
15
+ export declare function isMinipimError(value: unknown): value is MinipimError;
16
+ /**
17
+ * Pull a human-readable message out of an openapi-fetch `error` value,
18
+ * whatever its declared union shape. Falls back to `fallback`.
19
+ *
20
+ * @example
21
+ * ```ts
22
+ * const { data, error } = await pim.GET('/v1/products');
23
+ * if (error) throw new Error(getErrorMessage(error, 'request failed'));
24
+ * ```
25
+ */
26
+ export declare function getErrorMessage(error: unknown, fallback?: string): string;
27
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE;QACL,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,CAAC,EAAE,OAAO,CAAC;KACnB,CAAC;CACH;AAED,8EAA8E;AAC9E,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,YAAY,CASpE;AAED;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,SAAmB,GAAG,MAAM,CAEnF"}
package/dist/errors.js ADDED
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Error envelope + type guard. Every MiniPim 4xx/5xx returns
3
+ * `{ error: { code, message, details? } }`. openapi-fetch types `res.error`
4
+ * as a union across a path's declared error responses, which is awkward to
5
+ * narrow to `.error.message`. This guard collapses that to a single shape.
6
+ */
7
+ /** True when `value` is a MiniPim `{ error: { code, message } }` envelope. */
8
+ export function isMinipimError(value) {
9
+ if (!value || typeof value !== 'object')
10
+ return false;
11
+ const e = value.error;
12
+ return (!!e &&
13
+ typeof e === 'object' &&
14
+ typeof e.code === 'string' &&
15
+ typeof e.message === 'string');
16
+ }
17
+ /**
18
+ * Pull a human-readable message out of an openapi-fetch `error` value,
19
+ * whatever its declared union shape. Falls back to `fallback`.
20
+ *
21
+ * @example
22
+ * ```ts
23
+ * const { data, error } = await pim.GET('/v1/products');
24
+ * if (error) throw new Error(getErrorMessage(error, 'request failed'));
25
+ * ```
26
+ */
27
+ export function getErrorMessage(error, fallback = 'request failed') {
28
+ return isMinipimError(error) ? error.error.message : fallback;
29
+ }
30
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAUH,8EAA8E;AAC9E,MAAM,UAAU,cAAc,CAAC,KAAc;IAC3C,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IACtD,MAAM,CAAC,GAAI,KAA6B,CAAC,KAAK,CAAC;IAC/C,OAAO,CACL,CAAC,CAAC,CAAC;QACH,OAAO,CAAC,KAAK,QAAQ;QACrB,OAAQ,CAAwB,CAAC,IAAI,KAAK,QAAQ;QAClD,OAAQ,CAA2B,CAAC,OAAO,KAAK,QAAQ,CACzD,CAAC;AACJ,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,eAAe,CAAC,KAAc,EAAE,QAAQ,GAAG,gBAAgB;IACzE,OAAO,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC;AAChE,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,11 +1,17 @@
1
1
  /**
2
2
  * @minipim/sdk — typed TypeScript client for the MiniPim API.
3
3
  *
4
- * See https://github.com/Epic-Design-Labs/minipim/blob/main/packages/sdk/README.md
5
- * for examples; the canonical narrative integration guide lives at
6
- * https://github.com/Epic-Design-Labs/minipim/blob/main/docs/DEVELOPERS.md.
4
+ * Edge-safe: this entry point imports no `node:` modules. The Node webhook
5
+ * verifier lives at `@minipim/sdk/webhook` (imports node:crypto); the Edge
6
+ * verifier at `@minipim/sdk/webhook-edge`. Keeping them off the root means
7
+ * `createMinipimClient` can be imported in Edge runtimes without pulling
8
+ * node:crypto into the bundle.
9
+ *
10
+ * See packages/sdk/README.md for examples.
7
11
  */
8
12
  export { createMinipimClient, type CreateMinipimClientOptions, type MinipimClient, } from './client.js';
9
- export { verifyMinipimWebhook, verifyMinipimWebhookEdge, type VerifyWebhookOptions, } from './webhook.js';
13
+ export { paginate, collectAll, type PaginateOptions, } from './paginate.js';
14
+ export { isMinipimError, getErrorMessage, type MinipimError, } from './errors.js';
15
+ export { getAttribute, flattenAttributes, asMoney, asMeasurement, formatMoney, type AttributeValueRecord, type AttributesPayload, type Money, type Measurement, type ResolveOptions, } from './attributes.js';
10
16
  export type { paths, components, operations } from './openapi.js';
11
17
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EACL,mBAAmB,EACnB,KAAK,0BAA0B,EAC/B,KAAK,aAAa,GACnB,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,oBAAoB,EACpB,wBAAwB,EACxB,KAAK,oBAAoB,GAC1B,MAAM,cAAc,CAAC;AAItB,YAAY,EAAE,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EACL,mBAAmB,EACnB,KAAK,0BAA0B,EAC/B,KAAK,aAAa,GACnB,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,QAAQ,EACR,UAAU,EACV,KAAK,eAAe,GACrB,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,cAAc,EACd,eAAe,EACf,KAAK,YAAY,GAClB,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,OAAO,EACP,aAAa,EACb,WAAW,EACX,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,EACtB,KAAK,KAAK,EACV,KAAK,WAAW,EAChB,KAAK,cAAc,GACpB,MAAM,iBAAiB,CAAC;AAOzB,YAAY,EAAE,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC"}
package/dist/index.js CHANGED
@@ -1,10 +1,16 @@
1
1
  /**
2
2
  * @minipim/sdk — typed TypeScript client for the MiniPim API.
3
3
  *
4
- * See https://github.com/Epic-Design-Labs/minipim/blob/main/packages/sdk/README.md
5
- * for examples; the canonical narrative integration guide lives at
6
- * https://github.com/Epic-Design-Labs/minipim/blob/main/docs/DEVELOPERS.md.
4
+ * Edge-safe: this entry point imports no `node:` modules. The Node webhook
5
+ * verifier lives at `@minipim/sdk/webhook` (imports node:crypto); the Edge
6
+ * verifier at `@minipim/sdk/webhook-edge`. Keeping them off the root means
7
+ * `createMinipimClient` can be imported in Edge runtimes without pulling
8
+ * node:crypto into the bundle.
9
+ *
10
+ * See packages/sdk/README.md for examples.
7
11
  */
8
12
  export { createMinipimClient, } from './client.js';
9
- export { verifyMinipimWebhook, verifyMinipimWebhookEdge, } from './webhook.js';
13
+ export { paginate, collectAll, } from './paginate.js';
14
+ export { isMinipimError, getErrorMessage, } from './errors.js';
15
+ export { getAttribute, flattenAttributes, asMoney, asMeasurement, formatMoney, } from './attributes.js';
10
16
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EACL,mBAAmB,GAGpB,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,oBAAoB,EACpB,wBAAwB,GAEzB,MAAM,cAAc,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EACL,mBAAmB,GAGpB,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,QAAQ,EACR,UAAU,GAEX,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,cAAc,EACd,eAAe,GAEhB,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,OAAO,EACP,aAAa,EACb,WAAW,GAMZ,MAAM,iBAAiB,CAAC"}
package/dist/openapi.d.ts CHANGED
@@ -3223,10 +3223,16 @@ export interface paths {
3223
3223
  * To get a single category's full ancestor path, walk `parentId` upwards
3224
3224
  * client-side, or hit `GET /v1/categories/{id}` which returns the same row
3225
3225
  * shape with the resolved path included in `path`.
3226
+ *
3227
+ * Returns the full tree by default. `?limit=` / `?offset=` are supported
3228
+ * for large taxonomies (ordered by `position`); omit them to get everything.
3226
3229
  */
3227
3230
  get: {
3228
3231
  parameters: {
3229
- query?: never;
3232
+ query?: {
3233
+ limit?: number;
3234
+ offset?: number;
3235
+ };
3230
3236
  header?: never;
3231
3237
  path?: never;
3232
3238
  cookie?: never;