@neetru/sdk 3.7.0 → 3.8.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/CHANGELOG.md +55 -0
- package/README.md +66 -1
- package/dist/ai.cjs +221 -177
- package/dist/ai.d.cts +1 -1
- package/dist/ai.d.ts +1 -1
- package/dist/ai.mjs +221 -177
- package/dist/auth.cjs +1227 -1064
- package/dist/auth.d.cts +1 -1
- package/dist/auth.d.ts +1 -1
- package/dist/auth.mjs +1224 -1061
- package/dist/catalog.cjs +164 -97
- package/dist/catalog.d.cts +1 -1
- package/dist/catalog.d.ts +1 -1
- package/dist/catalog.mjs +164 -97
- package/dist/checkout.cjs +182 -115
- package/dist/checkout.d.cts +1 -1
- package/dist/checkout.d.ts +1 -1
- package/dist/checkout.mjs +181 -114
- package/dist/db-react.d.cts +1 -1
- package/dist/db-react.d.ts +1 -1
- package/dist/db.cjs +370 -298
- package/dist/db.d.cts +1 -1
- package/dist/db.d.ts +1 -1
- package/dist/db.mjs +362 -290
- package/dist/entitlements.cjs +17 -10
- package/dist/entitlements.d.cts +1 -1
- package/dist/entitlements.d.ts +1 -1
- package/dist/entitlements.mjs +17 -10
- package/dist/errors.cjs +15 -8
- package/dist/errors.d.cts +24 -3
- package/dist/errors.d.ts +24 -3
- package/dist/errors.mjs +14 -7
- package/dist/firestore-compat.d.cts +1 -1
- package/dist/firestore-compat.d.ts +1 -1
- package/dist/index.cjs +1409 -1075
- package/dist/index.d.cts +177 -3
- package/dist/index.d.ts +177 -3
- package/dist/index.mjs +1544 -1217
- package/dist/mobile.cjs +400 -181
- package/dist/mobile.d.cts +59 -4
- package/dist/mobile.d.ts +59 -4
- package/dist/mobile.mjs +400 -181
- package/dist/mocks.cjs +9 -2
- package/dist/mocks.d.cts +1 -1
- package/dist/mocks.d.ts +1 -1
- package/dist/mocks.mjs +9 -2
- package/dist/notifications.cjs +197 -130
- package/dist/notifications.d.cts +1 -1
- package/dist/notifications.d.ts +1 -1
- package/dist/notifications.mjs +196 -129
- package/dist/react.cjs +303 -282
- package/dist/react.d.cts +1 -1
- package/dist/react.d.ts +1 -1
- package/dist/react.mjs +295 -274
- package/dist/support.cjs +299 -229
- package/dist/support.d.cts +8 -4
- package/dist/support.d.ts +8 -4
- package/dist/support.mjs +298 -228
- package/dist/telemetry.cjs +234 -167
- package/dist/telemetry.d.cts +1 -1
- package/dist/telemetry.d.ts +1 -1
- package/dist/telemetry.mjs +234 -167
- package/dist/{types-Bx4kTLmk.d.cts → types-D-9bjlM0.d.cts} +48 -1
- package/dist/{types-Dx0IrOSF.d.ts → types-bVztFQTI.d.ts} +48 -1
- package/dist/usage.cjs +183 -116
- package/dist/usage.d.cts +1 -1
- package/dist/usage.d.ts +1 -1
- package/dist/usage.mjs +183 -116
- package/dist/webhooks.cjs +215 -148
- package/dist/webhooks.d.cts +1 -1
- package/dist/webhooks.d.ts +1 -1
- package/dist/webhooks.mjs +212 -145
- package/package.json +2 -1
package/dist/catalog.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
// src/errors.ts
|
|
4
|
-
var
|
|
4
|
+
var a = class t extends Error {
|
|
5
5
|
code;
|
|
6
6
|
status;
|
|
7
7
|
requestId;
|
|
@@ -14,98 +14,161 @@ var i = class t extends Error {
|
|
|
14
14
|
* para um `NeetruDbErrorCode` mais específico (recuperável vs não).
|
|
15
15
|
*/
|
|
16
16
|
reason;
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
/**
|
|
18
|
+
* 3.8.0: `x-correlation-id` da requisição que falhou. O SDK gera um UUID por
|
|
19
|
+
* chamada (ou usa o que o chamador passou) e manda no header; o Core grava o
|
|
20
|
+
* mesmo id nos logs/auditoria — cite-o ao abrir um ticket de suporte.
|
|
21
|
+
* `undefined` em erros que acontecem antes de qualquer requisição.
|
|
22
|
+
*/
|
|
23
|
+
correlationId;
|
|
24
|
+
constructor(e, r, n, o, s, u) {
|
|
25
|
+
super(r), this.name = "NeetruError", this.code = e, this.status = n, this.requestId = o, this.reason = s, this.correlationId = u, Object.setPrototypeOf(this, t.prototype);
|
|
19
26
|
}
|
|
20
27
|
};
|
|
21
28
|
|
|
22
29
|
// src/idempotency.ts
|
|
23
|
-
function
|
|
30
|
+
function C() {
|
|
24
31
|
let t = typeof globalThis < "u" && "crypto" in globalThis ? globalThis.crypto : void 0;
|
|
25
32
|
if (t && typeof t.randomUUID == "function")
|
|
26
33
|
return t.randomUUID();
|
|
27
|
-
throw new
|
|
34
|
+
throw new a(
|
|
28
35
|
"runtime_unsupported",
|
|
29
36
|
"crypto.randomUUID not available in this runtime. SDK 3.0 requires Node \u226520 or modern browser/Edge."
|
|
30
37
|
);
|
|
31
38
|
}
|
|
32
39
|
|
|
40
|
+
// src/correlation.ts
|
|
41
|
+
var T = "x-correlation-id";
|
|
42
|
+
var $ = /^[A-Za-z0-9._:\-]+$/;
|
|
43
|
+
function I(t) {
|
|
44
|
+
return typeof t == "string" && t.length > 0 && t.length <= 128 && $.test(t);
|
|
45
|
+
}
|
|
46
|
+
function j() {
|
|
47
|
+
let t = globalThis.crypto;
|
|
48
|
+
try {
|
|
49
|
+
if (t && typeof t.randomUUID == "function") return t.randomUUID();
|
|
50
|
+
} catch {
|
|
51
|
+
}
|
|
52
|
+
let e = new Uint8Array(16), r = false;
|
|
53
|
+
try {
|
|
54
|
+
t && typeof t.getRandomValues == "function" && (t.getRandomValues(e), r = !0);
|
|
55
|
+
} catch {
|
|
56
|
+
r = false;
|
|
57
|
+
}
|
|
58
|
+
if (!r)
|
|
59
|
+
for (let o = 0; o < e.length; o++) e[o] = Math.floor(Math.random() * 256);
|
|
60
|
+
e[6] = e[6] & 15 | 64, e[8] = e[8] & 63 | 128;
|
|
61
|
+
let n = Array.from(e, (o) => o.toString(16).padStart(2, "0")).join("");
|
|
62
|
+
return `${n.slice(0, 8)}-${n.slice(8, 12)}-${n.slice(12, 16)}-${n.slice(16, 20)}-${n.slice(20)}`;
|
|
63
|
+
}
|
|
64
|
+
function N(t, e) {
|
|
65
|
+
let r, n = {};
|
|
66
|
+
for (let [s, u] of Object.entries(t)) {
|
|
67
|
+
if (s.toLowerCase() === T) {
|
|
68
|
+
I(u) && (r = u);
|
|
69
|
+
continue;
|
|
70
|
+
}
|
|
71
|
+
n[s] = u;
|
|
72
|
+
}
|
|
73
|
+
let o = r ?? (I(e) ? e : void 0) ?? j();
|
|
74
|
+
return n[T] = o, { headers: n, correlationId: o };
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// src/server-only-key.ts
|
|
78
|
+
function S() {
|
|
79
|
+
try {
|
|
80
|
+
let t = globalThis.navigator;
|
|
81
|
+
if (t && t.product === "ReactNative") return "react-native";
|
|
82
|
+
} catch {
|
|
83
|
+
}
|
|
84
|
+
try {
|
|
85
|
+
let t = globalThis;
|
|
86
|
+
if (typeof t.window < "u" && typeof t.document < "u") return "browser";
|
|
87
|
+
} catch {
|
|
88
|
+
}
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
|
|
33
92
|
// src/http.ts
|
|
34
|
-
var
|
|
93
|
+
var H = {
|
|
35
94
|
// SDK major 3.x requer Core ≥ 2026.05.1 (suporte a X-Neetru-Version header,
|
|
36
95
|
// runTransaction write-after-read, verifyWebhookRequest, webhooks 3.0+)
|
|
37
96
|
3: "2026.05.1"
|
|
38
97
|
};
|
|
39
|
-
function
|
|
98
|
+
function b(t) {
|
|
40
99
|
return t.split("+")[0] ?? t;
|
|
41
100
|
}
|
|
42
|
-
function
|
|
43
|
-
let r =
|
|
44
|
-
for (let s = 0; s <
|
|
45
|
-
let
|
|
46
|
-
if (
|
|
101
|
+
function G(t, e) {
|
|
102
|
+
let r = b(t).split(".").map(Number), n = b(e).split(".").map(Number), o = Math.max(r.length, n.length);
|
|
103
|
+
for (let s = 0; s < o; s++) {
|
|
104
|
+
let u = r[s] ?? 0, c = n[s] ?? 0;
|
|
105
|
+
if (u !== c) return u - c;
|
|
47
106
|
}
|
|
48
107
|
return 0;
|
|
49
108
|
}
|
|
50
|
-
function
|
|
109
|
+
function M() {
|
|
51
110
|
try {
|
|
52
|
-
return "3.
|
|
111
|
+
return "3.8.0";
|
|
53
112
|
} catch {
|
|
54
113
|
return;
|
|
55
114
|
}
|
|
56
115
|
}
|
|
57
|
-
function
|
|
58
|
-
let t =
|
|
116
|
+
function V() {
|
|
117
|
+
let t = M();
|
|
59
118
|
return t ? parseInt(t.split(".")[0] ?? "3", 10) : 3;
|
|
60
119
|
}
|
|
61
|
-
var
|
|
62
|
-
function
|
|
120
|
+
var D = /* @__PURE__ */ new Set();
|
|
121
|
+
function F(t) {
|
|
63
122
|
if (!t) return;
|
|
64
|
-
let e =
|
|
123
|
+
let e = V(), r = H[e];
|
|
65
124
|
if (!r) return;
|
|
66
|
-
let n =
|
|
67
|
-
if (
|
|
68
|
-
let
|
|
69
|
-
|
|
125
|
+
let n = b(t);
|
|
126
|
+
if (G(n, r) < 0) {
|
|
127
|
+
let o = `${e}:${n}`;
|
|
128
|
+
D.has(o) || (D.add(o), console.warn(
|
|
70
129
|
`[Neetru SDK] Aten\xE7\xE3o: Core vers\xE3o "${t}" \xE9 anterior ao m\xEDnimo recomendado "${r}" para SDK major ${e}. Alguns recursos podem n\xE3o funcionar corretamente. Atualize o Core para a vers\xE3o mais recente.`
|
|
71
130
|
));
|
|
72
131
|
}
|
|
73
132
|
}
|
|
74
|
-
|
|
133
|
+
function z() {
|
|
134
|
+
let t = "This operation requires an apiKey. Pass it to createNeetruClient({ apiKey }) or set NEETRU_API_KEY env var.";
|
|
135
|
+
return S() ? "Esta opera\xE7\xE3o exige a credencial nrt_ do produto, que \xE9 S\xD3 DE SERVIDOR. No navegador/app, chame a API do seu produto (ex.: https://<produto>.neetru.com/api/v1) com o token do usu\xE1rio \u2014 o backend do produto faz esta chamada com o SDK e a chave. (" + t + ")" : t;
|
|
136
|
+
}
|
|
137
|
+
var B = 2, X = 0, Y = /* @__PURE__ */ new Set(["GET", "HEAD"]), J = /* @__PURE__ */ new Set([
|
|
75
138
|
"rate_limited",
|
|
76
139
|
"server_error",
|
|
77
140
|
"network_error"
|
|
78
141
|
]);
|
|
79
|
-
function
|
|
142
|
+
function x(t) {
|
|
80
143
|
let e = 200 * Math.pow(4, t), r = e * 0.2 * (Math.random() * 2 - 1);
|
|
81
144
|
return Math.max(50, Math.round(e + r));
|
|
82
145
|
}
|
|
83
|
-
var
|
|
84
|
-
function
|
|
146
|
+
var O = 6e4;
|
|
147
|
+
function W(t) {
|
|
85
148
|
if (!t) return null;
|
|
86
149
|
let e = Number(t);
|
|
87
|
-
if (Number.isFinite(e) && e >= 0) return Math.min(Math.round(e * 1e3),
|
|
150
|
+
if (Number.isFinite(e) && e >= 0) return Math.min(Math.round(e * 1e3), O);
|
|
88
151
|
let r = Date.parse(t);
|
|
89
152
|
if (Number.isFinite(r)) {
|
|
90
153
|
let n = r - Date.now();
|
|
91
|
-
if (n > 0) return Math.min(n,
|
|
154
|
+
if (n > 0) return Math.min(n, O);
|
|
92
155
|
}
|
|
93
156
|
return null;
|
|
94
157
|
}
|
|
95
|
-
function
|
|
158
|
+
function P(t) {
|
|
96
159
|
return new Promise((e) => setTimeout(e, t));
|
|
97
160
|
}
|
|
98
|
-
function
|
|
161
|
+
function Z(t) {
|
|
99
162
|
return t === 401 ? "unauthorized" : t === 403 ? "forbidden" : t === 404 ? "not_found" : t === 409 ? "conflict" : t === 410 ? "gone" : t === 422 || t === 400 ? "validation_failed" : t === 429 ? "rate_limited" : t >= 500 ? "server_error" : "unknown";
|
|
100
163
|
}
|
|
101
|
-
function
|
|
102
|
-
let n = t.replace(/\/+$/, ""),
|
|
164
|
+
function Q(t, e, r) {
|
|
165
|
+
let n = t.replace(/\/+$/, ""), o = e.startsWith("/") ? e : `/${e}`, s = new URL(`${n}${o}`);
|
|
103
166
|
if (r)
|
|
104
|
-
for (let [
|
|
105
|
-
|
|
167
|
+
for (let [u, c] of Object.entries(r))
|
|
168
|
+
c !== void 0 && s.searchParams.set(u, String(c));
|
|
106
169
|
return s.toString();
|
|
107
170
|
}
|
|
108
|
-
async function
|
|
171
|
+
async function K(t) {
|
|
109
172
|
let e = await t.text();
|
|
110
173
|
if (e)
|
|
111
174
|
try {
|
|
@@ -115,82 +178,86 @@ async function D(t) {
|
|
|
115
178
|
}
|
|
116
179
|
}
|
|
117
180
|
async function E(t, e) {
|
|
118
|
-
let r = e.method ?? "GET", n =
|
|
119
|
-
accept: "application/json",
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
if (
|
|
181
|
+
let r = e.method ?? "GET", n = Q(t.baseUrl, e.path, e.query), o = Y.has(r) ? B : X, s = e.retries ?? o, { headers: u, correlationId: c } = N(
|
|
182
|
+
{ accept: "application/json", ...e.headers },
|
|
183
|
+
e.correlationId
|
|
184
|
+
), v = M();
|
|
185
|
+
if (v && (u["x-neetru-sdk-version"] = v), e.requireAuth) {
|
|
123
186
|
if (!t.apiKey)
|
|
124
|
-
throw new
|
|
125
|
-
|
|
126
|
-
"This operation requires an apiKey. Pass it to createNeetruClient({ apiKey }) or set NEETRU_API_KEY env var."
|
|
127
|
-
);
|
|
128
|
-
d.authorization = `Bearer ${t.apiKey}`;
|
|
187
|
+
throw new a("missing_api_key", z());
|
|
188
|
+
u.authorization = `Bearer ${t.apiKey}`;
|
|
129
189
|
}
|
|
130
190
|
if (e.idempotencyKey) {
|
|
131
|
-
let
|
|
132
|
-
|
|
191
|
+
let p = typeof e.idempotencyKey == "string" ? e.idempotencyKey : C();
|
|
192
|
+
u["idempotency-key"] = p;
|
|
133
193
|
}
|
|
134
|
-
let
|
|
135
|
-
|
|
136
|
-
let
|
|
137
|
-
for (let
|
|
138
|
-
if (
|
|
139
|
-
throw
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
194
|
+
let _ = e.body !== void 0 && r !== "GET" && r !== "DELETE" ? JSON.stringify(e.body) : void 0;
|
|
195
|
+
_ !== void 0 && (u["content-type"] = "application/json");
|
|
196
|
+
let g = null, l = e.deadlineMs != null ? Date.now() + e.deadlineMs : null;
|
|
197
|
+
for (let p = 0; p <= s; p++) {
|
|
198
|
+
if (l != null && Date.now() >= l)
|
|
199
|
+
throw g ?? new a(
|
|
200
|
+
"network_error",
|
|
201
|
+
"Deadline excedido antes de completar a request",
|
|
202
|
+
void 0,
|
|
203
|
+
void 0,
|
|
204
|
+
void 0,
|
|
205
|
+
c
|
|
206
|
+
);
|
|
207
|
+
let w = { method: r, headers: u };
|
|
208
|
+
_ !== void 0 && (w.body = _);
|
|
209
|
+
let L = l != null ? Math.max(1, Math.min(3e4, l - Date.now())) : 3e4;
|
|
210
|
+
w.signal = AbortSignal.timeout(L);
|
|
211
|
+
let d;
|
|
145
212
|
try {
|
|
146
|
-
|
|
147
|
-
} catch (
|
|
148
|
-
let y =
|
|
149
|
-
if (
|
|
150
|
-
let
|
|
151
|
-
if (
|
|
152
|
-
await
|
|
213
|
+
d = await t.fetch(n, w);
|
|
214
|
+
} catch (i) {
|
|
215
|
+
let y = i instanceof DOMException && i.name === "TimeoutError" ? "Network error: timeout after 30s" : `Network error: ${i instanceof Error ? i.message : "fetch failed"}`;
|
|
216
|
+
if (g = new a("network_error", y, void 0, void 0, void 0, c), p < s) {
|
|
217
|
+
let A = x(p);
|
|
218
|
+
if (l == null || Date.now() + A < l) {
|
|
219
|
+
await P(A);
|
|
153
220
|
continue;
|
|
154
221
|
}
|
|
155
222
|
}
|
|
156
|
-
throw
|
|
223
|
+
throw g;
|
|
157
224
|
}
|
|
158
|
-
let
|
|
159
|
-
if (
|
|
160
|
-
let
|
|
161
|
-
return
|
|
225
|
+
let q = d.headers.get("x-request-id") ?? d.headers.get("x-correlation-id") ?? void 0;
|
|
226
|
+
if (d.ok) {
|
|
227
|
+
let i = d.headers.get("x-neetru-version");
|
|
228
|
+
return i && F(i), await K(d);
|
|
162
229
|
}
|
|
163
|
-
let
|
|
164
|
-
if (
|
|
165
|
-
let
|
|
166
|
-
typeof
|
|
230
|
+
let f = await K(d), h = Z(d.status), m = `HTTP ${d.status}`, R;
|
|
231
|
+
if (f && typeof f == "object") {
|
|
232
|
+
let i = f.error;
|
|
233
|
+
typeof i == "string" ? m = i : i && typeof i == "object" ? (typeof i.code == "string" && (h = i.code), typeof i.message == "string" && (m = i.message), typeof i.reason == "string" && (R = i.reason)) : (typeof f.code == "string" && (h = f.code), typeof f.message == "string" && (m = f.message)), typeof f.reason == "string" && (R = f.reason);
|
|
167
234
|
}
|
|
168
|
-
if (
|
|
169
|
-
let
|
|
170
|
-
|
|
235
|
+
if (d.status === 410) {
|
|
236
|
+
let i = d.headers.get("x-neetru-replacement");
|
|
237
|
+
m === `HTTP ${d.status}` && (m = `Endpoint ${e.path} foi removido do Core (HTTP 410 Gone) \u2014 atualize o @neetru/sdk e migre para a API substituta.`), i && !m.includes(i) && (m += ` Substituto: ${i}.`);
|
|
171
238
|
}
|
|
172
|
-
let k = new
|
|
173
|
-
if (
|
|
174
|
-
let y =
|
|
175
|
-
if (
|
|
176
|
-
await
|
|
239
|
+
let k = new a(h, m, d.status, q, R, c);
|
|
240
|
+
if (g = k, J.has(h) && p < s) {
|
|
241
|
+
let y = W(d.headers.get("retry-after")) ?? x(p);
|
|
242
|
+
if (l == null || Date.now() + y < l) {
|
|
243
|
+
await P(y);
|
|
177
244
|
continue;
|
|
178
245
|
}
|
|
179
246
|
}
|
|
180
247
|
throw k;
|
|
181
248
|
}
|
|
182
|
-
throw
|
|
249
|
+
throw g ?? new a("unknown", "unexpected httpRequest exit", void 0, void 0, void 0, c);
|
|
183
250
|
}
|
|
184
251
|
|
|
185
252
|
// src/catalog.ts
|
|
186
|
-
function
|
|
253
|
+
function U(t) {
|
|
187
254
|
if (!t || typeof t != "object")
|
|
188
|
-
throw new
|
|
255
|
+
throw new a("invalid_response", "Catalog response item is not an object");
|
|
189
256
|
let e = t;
|
|
190
257
|
if (typeof e.slug != "string" || !e.slug)
|
|
191
|
-
throw new
|
|
258
|
+
throw new a("invalid_response", "Catalog product missing slug");
|
|
192
259
|
if (typeof e.name != "string" || !e.name)
|
|
193
|
-
throw new
|
|
260
|
+
throw new a("invalid_response", "Catalog product missing name");
|
|
194
261
|
let r = {
|
|
195
262
|
slug: e.slug,
|
|
196
263
|
name: e.name
|
|
@@ -198,11 +265,11 @@ function S(t) {
|
|
|
198
265
|
return typeof e.tagline == "string" && (r.tagline = e.tagline), typeof e.description == "string" && (r.description = e.description), (e.status === "live" || e.status === "soon" || e.status === "beta") && (r.status = e.status), typeof e.iconKey == "string" && (r.iconKey = e.iconKey), typeof e.ctaHref == "string" && (r.ctaHref = e.ctaHref), typeof e.ctaLabel == "string" && (r.ctaLabel = e.ctaLabel), Array.isArray(e.plans) && (r.plans = e.plans.filter(
|
|
199
266
|
(n) => typeof n == "object" && n !== null && typeof n.id == "string" && typeof n.name == "string"
|
|
200
267
|
).map((n) => {
|
|
201
|
-
let
|
|
202
|
-
return typeof n.amountCents == "number" && (
|
|
268
|
+
let o = { id: n.id, name: n.name };
|
|
269
|
+
return typeof n.amountCents == "number" && (o.amountCents = n.amountCents), Array.isArray(n.features) && n.features.every((s) => typeof s == "string") && (o.features = n.features), o;
|
|
203
270
|
})), r;
|
|
204
271
|
}
|
|
205
|
-
function
|
|
272
|
+
function pe(t) {
|
|
206
273
|
return {
|
|
207
274
|
/**
|
|
208
275
|
* Lista produtos publicados. Por default só `published=true`; staff
|
|
@@ -214,12 +281,12 @@ function te(t) {
|
|
|
214
281
|
path: "/api/sdk/v1/catalog"
|
|
215
282
|
});
|
|
216
283
|
if (!r || !Array.isArray(r.products))
|
|
217
|
-
throw new
|
|
284
|
+
throw new a(
|
|
218
285
|
"invalid_response",
|
|
219
286
|
"Catalog list response missing products array"
|
|
220
287
|
);
|
|
221
288
|
return {
|
|
222
|
-
products: r.products.map(
|
|
289
|
+
products: r.products.map(U),
|
|
223
290
|
fetchedAt: typeof r.fetchedAt == "string" ? r.fetchedAt : (/* @__PURE__ */ new Date()).toISOString()
|
|
224
291
|
};
|
|
225
292
|
},
|
|
@@ -230,19 +297,19 @@ function te(t) {
|
|
|
230
297
|
*/
|
|
231
298
|
async get(e) {
|
|
232
299
|
if (!e || typeof e != "string")
|
|
233
|
-
throw new
|
|
300
|
+
throw new a("validation_failed", "slug is required");
|
|
234
301
|
let r = await E(t, {
|
|
235
302
|
method: "GET",
|
|
236
303
|
path: `/api/sdk/v1/catalog/${encodeURIComponent(e)}`
|
|
237
304
|
});
|
|
238
305
|
if (!r || !r.product)
|
|
239
|
-
throw new
|
|
306
|
+
throw new a(
|
|
240
307
|
"invalid_response",
|
|
241
308
|
"Catalog get response missing product"
|
|
242
309
|
);
|
|
243
|
-
return
|
|
310
|
+
return U(r.product);
|
|
244
311
|
}
|
|
245
312
|
};
|
|
246
313
|
}
|
|
247
314
|
|
|
248
|
-
exports.createCatalogNamespace =
|
|
315
|
+
exports.createCatalogNamespace = pe;
|
package/dist/catalog.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ah as ResolvedConfig, C as CatalogListOptions, n as CatalogListResponse, a9 as Product } from './types-D-9bjlM0.cjs';
|
|
2
2
|
import 'drizzle-orm/node-postgres';
|
|
3
3
|
import './errors.cjs';
|
|
4
4
|
|
package/dist/catalog.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ah as ResolvedConfig, C as CatalogListOptions, n as CatalogListResponse, a9 as Product } from './types-bVztFQTI.js';
|
|
2
2
|
import 'drizzle-orm/node-postgres';
|
|
3
3
|
import './errors.js';
|
|
4
4
|
|