@minipim/sdk 0.5.0 → 0.6.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/dist/index.cjs +1 -3
- package/dist/index.d.cts +7 -3
- package/dist/index.d.ts +7 -3
- package/dist/index.js +1 -3
- package/dist/openapi.d.cts +857 -98
- package/dist/openapi.d.ts +857 -98
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -80,9 +80,7 @@ async function* paginate(client, path, opts = {}) {
|
|
|
80
80
|
params: { query: { ...opts.query ?? {}, limit: pageSize, offset } }
|
|
81
81
|
});
|
|
82
82
|
if (error || !data) {
|
|
83
|
-
throw new Error(
|
|
84
|
-
`paginate ${path} failed at offset ${offset} (HTTP ${response?.status})`
|
|
85
|
-
);
|
|
83
|
+
throw new Error(`paginate ${path} failed at offset ${offset} (HTTP ${response?.status})`);
|
|
86
84
|
}
|
|
87
85
|
if (Array.isArray(data)) {
|
|
88
86
|
for (const item of data) yield item;
|
package/dist/index.d.cts
CHANGED
|
@@ -77,9 +77,13 @@ type MinipimClient = Client<paths>;
|
|
|
77
77
|
declare function createMinipimClient(opts: CreateMinipimClientOptions): MinipimClient;
|
|
78
78
|
|
|
79
79
|
/**
|
|
80
|
-
* Generic pagination helper.
|
|
81
|
-
* `{ data, limit, offset
|
|
82
|
-
*
|
|
80
|
+
* Generic pagination helper. MiniPim list endpoints return
|
|
81
|
+
* `{ data, limit, offset }`, and **only `/v1/products` also returns
|
|
82
|
+
* `hasMore`** — so this walks the pages by trusting `hasMore` when it is
|
|
83
|
+
* present and falling back to a short-page check when it isn't. That is the
|
|
84
|
+
* whole reason to use this instead of a hand-rolled `while (hasMore)` loop,
|
|
85
|
+
* which reads exactly one page from every other endpoint and stops. Yields
|
|
86
|
+
* one item at a time.
|
|
83
87
|
*
|
|
84
88
|
* Typed loosely on purpose — openapi-fetch's per-path generics don't
|
|
85
89
|
* compose into a single reusable signature without a lot of conditional-
|
package/dist/index.d.ts
CHANGED
|
@@ -77,9 +77,13 @@ type MinipimClient = Client<paths>;
|
|
|
77
77
|
declare function createMinipimClient(opts: CreateMinipimClientOptions): MinipimClient;
|
|
78
78
|
|
|
79
79
|
/**
|
|
80
|
-
* Generic pagination helper.
|
|
81
|
-
* `{ data, limit, offset
|
|
82
|
-
*
|
|
80
|
+
* Generic pagination helper. MiniPim list endpoints return
|
|
81
|
+
* `{ data, limit, offset }`, and **only `/v1/products` also returns
|
|
82
|
+
* `hasMore`** — so this walks the pages by trusting `hasMore` when it is
|
|
83
|
+
* present and falling back to a short-page check when it isn't. That is the
|
|
84
|
+
* whole reason to use this instead of a hand-rolled `while (hasMore)` loop,
|
|
85
|
+
* which reads exactly one page from every other endpoint and stops. Yields
|
|
86
|
+
* one item at a time.
|
|
83
87
|
*
|
|
84
88
|
* Typed loosely on purpose — openapi-fetch's per-path generics don't
|
|
85
89
|
* compose into a single reusable signature without a lot of conditional-
|
package/dist/index.js
CHANGED
|
@@ -28,9 +28,7 @@ async function* paginate(client, path, opts = {}) {
|
|
|
28
28
|
params: { query: { ...opts.query ?? {}, limit: pageSize, offset } }
|
|
29
29
|
});
|
|
30
30
|
if (error || !data) {
|
|
31
|
-
throw new Error(
|
|
32
|
-
`paginate ${path} failed at offset ${offset} (HTTP ${response?.status})`
|
|
33
|
-
);
|
|
31
|
+
throw new Error(`paginate ${path} failed at offset ${offset} (HTTP ${response?.status})`);
|
|
34
32
|
}
|
|
35
33
|
if (Array.isArray(data)) {
|
|
36
34
|
for (const item of data) yield item;
|