@simpleapps-com/augur-api 2026.11.4 → 2026.11.5
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/core/base-client.d.ts.map +1 -1
- package/dist/core/call-rules.d.ts +35 -0
- package/dist/core/call-rules.d.ts.map +1 -1
- package/dist/core/call.d.ts.map +1 -1
- package/dist/core/client-rules.d.ts +66 -36
- package/dist/core/client-rules.d.ts.map +1 -1
- package/dist/core/client.d.ts +12 -2
- package/dist/core/client.d.ts.map +1 -1
- package/dist/core/encoded-segment.d.ts +7 -1
- package/dist/core/encoded-segment.d.ts.map +1 -1
- package/dist/core/errors.d.ts.map +1 -1
- package/dist/core/http-rules.d.ts +0 -32
- package/dist/core/http-rules.d.ts.map +1 -1
- package/dist/core/proxy-rules.d.ts +53 -0
- package/dist/core/proxy-rules.d.ts.map +1 -1
- package/dist/core/registry-rules.d.ts +7 -0
- package/dist/core/registry-rules.d.ts.map +1 -1
- package/dist/core/registry.d.ts.map +1 -1
- package/dist/core/response-rules.d.ts +15 -0
- package/dist/core/response-rules.d.ts.map +1 -1
- package/dist/core/schemas.d.ts.map +1 -1
- package/dist/core/service-proxy.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +434 -233
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +434 -233
- package/dist/index.mjs.map +1 -1
- package/dist/services/goog-mc/generated/schemas.d.ts +8 -0
- package/dist/services/goog-mc/generated/schemas.d.ts.map +1 -1
- package/dist/services/goog-mc/generated/types.d.ts +8 -0
- package/dist/services/goog-mc/generated/types.d.ts.map +1 -1
- package/dist/services/items/client.d.ts +1 -1
- package/dist/services/items/generated/endpoints.d.ts.map +1 -1
- package/dist/services/items/generated/schemas.d.ts +8 -0
- package/dist/services/items/generated/schemas.d.ts.map +1 -1
- package/dist/services/items/generated/types.d.ts +13 -4
- package/dist/services/items/generated/types.d.ts.map +1 -1
- package/dist/services/joomla/generated/endpoints.d.ts.map +1 -1
- package/dist/services/joomla/generated/schemas.d.ts +5 -0
- package/dist/services/joomla/generated/schemas.d.ts.map +1 -1
- package/dist/services/joomla/generated/types.d.ts +18 -2
- package/dist/services/joomla/generated/types.d.ts.map +1 -1
- package/dist/services/legacy/generated/endpoints.d.ts.map +1 -1
- package/dist/services/legacy/generated/schemas.d.ts +2 -0
- package/dist/services/legacy/generated/schemas.d.ts.map +1 -1
- package/dist/services/legacy/generated/types.d.ts +4 -0
- package/dist/services/legacy/generated/types.d.ts.map +1 -1
- package/dist/services/open-search/generated/endpoints.d.ts.map +1 -1
- package/dist/services/open-search/generated/schemas.d.ts +2 -0
- package/dist/services/open-search/generated/schemas.d.ts.map +1 -1
- package/dist/services/open-search/generated/types.d.ts +4 -0
- package/dist/services/open-search/generated/types.d.ts.map +1 -1
- package/dist/testing.d.ts.map +1 -1
- package/dist/testing.js +22 -9
- package/dist/testing.js.map +1 -1
- package/dist/testing.mjs +20 -9
- package/dist/testing.mjs.map +1 -1
- package/dist/utils/cross-site-auth.d.ts.map +1 -1
- package/package.json +2 -1
package/dist/index.mjs
CHANGED
|
@@ -57,6 +57,9 @@ function joinFrom(xs, sep, i) {
|
|
|
57
57
|
if (i >= xs.length) return "";
|
|
58
58
|
return joinRange(xs, sep, i, xs.length);
|
|
59
59
|
}
|
|
60
|
+
function joinOr(xs, sep, fallback) {
|
|
61
|
+
return xs.length === 0 ? fallback : joinFrom(xs, sep, 0);
|
|
62
|
+
}
|
|
60
63
|
function joinRange(xs, sep, lo, hi) {
|
|
61
64
|
if (hi - lo === 1) return xs[lo];
|
|
62
65
|
const mid = lo + Math.floor((hi - lo) / 2);
|
|
@@ -73,6 +76,13 @@ function notInFrom(xs, allowed, i) {
|
|
|
73
76
|
return hasItemFrom(allowed, xs[i], 0) ? rest : [xs[i], ...rest];
|
|
74
77
|
}
|
|
75
78
|
|
|
79
|
+
// ../utils/src/pairs.ts
|
|
80
|
+
function allFrom(xs, i) {
|
|
81
|
+
if (i === xs.length) return true;
|
|
82
|
+
if (!xs[i]) return false;
|
|
83
|
+
return allFrom(xs, i + 1);
|
|
84
|
+
}
|
|
85
|
+
|
|
76
86
|
// ../utils/src/uri.ts
|
|
77
87
|
function isHigh(c) {
|
|
78
88
|
return c >= 55296 && c <= 56319;
|
|
@@ -121,6 +131,25 @@ function isEncoded(s) {
|
|
|
121
131
|
}
|
|
122
132
|
return true;
|
|
123
133
|
}
|
|
134
|
+
function pcharOf(hex) {
|
|
135
|
+
if (hex === "24") return "$";
|
|
136
|
+
if (hex === "26") return "&";
|
|
137
|
+
if (hex === "2B") return "+";
|
|
138
|
+
if (hex === "2C") return ",";
|
|
139
|
+
if (hex === "3B") return ";";
|
|
140
|
+
if (hex === "3D") return "=";
|
|
141
|
+
if (hex === "3A") return ":";
|
|
142
|
+
if (hex === "40") return "@";
|
|
143
|
+
return "";
|
|
144
|
+
}
|
|
145
|
+
function restorePcharFrom(s, i) {
|
|
146
|
+
if (i >= s.length) return "";
|
|
147
|
+
if (s.slice(i, i + 1) === "%" && i + 3 <= s.length) {
|
|
148
|
+
const ch = pcharOf(s.slice(i + 1, i + 3));
|
|
149
|
+
if (ch !== "") return ch + restorePcharFrom(s, i + 3);
|
|
150
|
+
}
|
|
151
|
+
return s.slice(i, i + 1) + restorePcharFrom(s, i + 1);
|
|
152
|
+
}
|
|
124
153
|
|
|
125
154
|
// ../utils/src/replace.ts
|
|
126
155
|
function replaceText(s, find, put) {
|
|
@@ -132,6 +161,21 @@ function replaceText(s, find, put) {
|
|
|
132
161
|
}
|
|
133
162
|
|
|
134
163
|
// src/core/call-rules.ts
|
|
164
|
+
function isEnvelopeBody(isPlainObject, allKeys) {
|
|
165
|
+
return isPlainObject && allKeys;
|
|
166
|
+
}
|
|
167
|
+
function callBodyKind(isJson) {
|
|
168
|
+
return isJson ? "json" : "text";
|
|
169
|
+
}
|
|
170
|
+
function validationMessageOf(kind) {
|
|
171
|
+
return kind === "params" ? "Invalid request parameters" : "Invalid API response structure\nThis appears to be a response validation error. The API returned data in an unexpected format.";
|
|
172
|
+
}
|
|
173
|
+
function issueCodeOf(type) {
|
|
174
|
+
return type !== void 0 ? type : "unknown";
|
|
175
|
+
}
|
|
176
|
+
function appendsIssues(count) {
|
|
177
|
+
return count > 0;
|
|
178
|
+
}
|
|
135
179
|
function isQueryKeyAllowed(declared, edgeCache, key) {
|
|
136
180
|
return declared || edgeCache && key === "edgeCache";
|
|
137
181
|
}
|
|
@@ -194,12 +238,35 @@ var ContextCreationError = class extends Error {
|
|
|
194
238
|
field;
|
|
195
239
|
};
|
|
196
240
|
|
|
241
|
+
// ../foundation/src/optional.ts
|
|
242
|
+
function nonEmptyOr(s, fallback) {
|
|
243
|
+
return s !== "" ? s : fallback;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
// ../foundation/src/decimal.ts
|
|
247
|
+
function decimal(n) {
|
|
248
|
+
const last = "0123456789".slice(n % 10, n % 10 + 1);
|
|
249
|
+
return n < 10 ? last : decimal(Math.floor(n / 10)) + last;
|
|
250
|
+
}
|
|
251
|
+
|
|
197
252
|
// ../json-values/src/index.ts
|
|
198
253
|
function isRecord(value) {
|
|
199
254
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
200
255
|
}
|
|
201
256
|
|
|
202
|
-
// src/
|
|
257
|
+
// ../utils/src/http.ts
|
|
258
|
+
function isPostOrPut(method) {
|
|
259
|
+
return method === "POST" || method === "PUT";
|
|
260
|
+
}
|
|
261
|
+
function querySeparator(url) {
|
|
262
|
+
return includesFrom(url, "?", 0) ? "&" : "?";
|
|
263
|
+
}
|
|
264
|
+
function queryValueSent(isUndefined, isNull) {
|
|
265
|
+
return !isUndefined && !isNull;
|
|
266
|
+
}
|
|
267
|
+
function urlWithQuery(url, query) {
|
|
268
|
+
return query === "" ? url : url + querySeparator(url) + query;
|
|
269
|
+
}
|
|
203
270
|
function isRetryableStatus(status) {
|
|
204
271
|
return !(status >= 400 && status < 500 && status !== 429);
|
|
205
272
|
}
|
|
@@ -207,30 +274,24 @@ function exponentialDelay(base, attempt) {
|
|
|
207
274
|
if (attempt === 0) return base;
|
|
208
275
|
return 2 * exponentialDelay(base, attempt - 1);
|
|
209
276
|
}
|
|
210
|
-
function
|
|
211
|
-
return Math.min(d,
|
|
212
|
-
}
|
|
213
|
-
function timeoutOf(hasRequest, request, hasClient, client, fallback) {
|
|
214
|
-
if (hasRequest) return request;
|
|
215
|
-
return hasClient ? client : fallback;
|
|
216
|
-
}
|
|
217
|
-
function isPublicEndpoint(url) {
|
|
218
|
-
return endsWith(url, "/health-check") || endsWith(url, "/ping");
|
|
277
|
+
function cappedAt(d, cap) {
|
|
278
|
+
return Math.min(d, cap);
|
|
219
279
|
}
|
|
220
|
-
function
|
|
221
|
-
|
|
280
|
+
function firstGiven(hasA, a, hasB, b, fallback) {
|
|
281
|
+
if (hasA) return a;
|
|
282
|
+
return hasB ? b : fallback;
|
|
222
283
|
}
|
|
223
|
-
function
|
|
224
|
-
return
|
|
284
|
+
function isAbortName(name) {
|
|
285
|
+
return name === "AbortError" || name === "TimeoutError";
|
|
225
286
|
}
|
|
226
|
-
function
|
|
227
|
-
return
|
|
287
|
+
function remainingOf(deadline, elapsed) {
|
|
288
|
+
return elapsed < deadline ? deadline - elapsed : 0;
|
|
228
289
|
}
|
|
229
|
-
function
|
|
230
|
-
return
|
|
290
|
+
function cutToRemaining(value, hasDeadline, remaining) {
|
|
291
|
+
return hasDeadline && remaining < value ? remaining : value;
|
|
231
292
|
}
|
|
232
|
-
function
|
|
233
|
-
return
|
|
293
|
+
function startsAttempt(hasDeadline, remaining) {
|
|
294
|
+
return !hasDeadline || remaining > 0;
|
|
234
295
|
}
|
|
235
296
|
|
|
236
297
|
// src/core/client-rules.ts
|
|
@@ -246,18 +307,6 @@ function retryableError(isAugurError, status) {
|
|
|
246
307
|
function retryAfterCall(attempt, retries, retryable, callAborted) {
|
|
247
308
|
return !callAborted && attempt < retries && retryable;
|
|
248
309
|
}
|
|
249
|
-
function isAbortName(name) {
|
|
250
|
-
return name === "AbortError" || name === "TimeoutError";
|
|
251
|
-
}
|
|
252
|
-
function remainingOf(deadline, elapsed) {
|
|
253
|
-
return elapsed < deadline ? deadline - elapsed : 0;
|
|
254
|
-
}
|
|
255
|
-
function attemptTimeoutOf(perAttempt, hasDeadline, remaining) {
|
|
256
|
-
return hasDeadline && remaining < perAttempt ? remaining : perAttempt;
|
|
257
|
-
}
|
|
258
|
-
function waitOf(backoff, hasDeadline, remaining) {
|
|
259
|
-
return hasDeadline && remaining < backoff ? remaining : backoff;
|
|
260
|
-
}
|
|
261
310
|
function needsAttemptTimer(perAttempt, hasDeadline, remaining) {
|
|
262
311
|
return !(hasDeadline && remaining <= perAttempt);
|
|
263
312
|
}
|
|
@@ -281,19 +330,53 @@ function mergedDeadlineOf(hasOuter, outer, hasInner, inner) {
|
|
|
281
330
|
function hasMergedDeadline(hasOuter, hasInner) {
|
|
282
331
|
return hasOuter || hasInner;
|
|
283
332
|
}
|
|
284
|
-
function edgeCacheKindOf(text
|
|
333
|
+
function edgeCacheKindOf(text) {
|
|
285
334
|
if (text === "30s" || text === "1m" || text === "5m") return "sub-hour";
|
|
286
|
-
const hourly =
|
|
335
|
+
const hourly = text === "1" || text === "2" || text === "3" || text === "4" || text === "5" || text === "8";
|
|
287
336
|
return hourly ? "hourly" : "invalid";
|
|
288
337
|
}
|
|
338
|
+
function edgeCacheKeyOf(kind, text) {
|
|
339
|
+
return kind === "invalid" ? "" : "cacheSiteId" + text;
|
|
340
|
+
}
|
|
341
|
+
function errorClassOf(status) {
|
|
342
|
+
if (status === 400) return "validation";
|
|
343
|
+
if (status === 401) return "authentication";
|
|
344
|
+
if (status === 404) return "notFound";
|
|
345
|
+
if (status === 429) return "rateLimit";
|
|
346
|
+
return "augur";
|
|
347
|
+
}
|
|
348
|
+
function detailMessageOf(isJson, isObject, isText, message) {
|
|
349
|
+
if (isJson && isObject && isText && message !== "") return message;
|
|
350
|
+
return void 0;
|
|
351
|
+
}
|
|
352
|
+
function defaultMessageOf(kind, status) {
|
|
353
|
+
if (kind === "validation") return "Validation failed";
|
|
354
|
+
if (kind === "authentication") return "Authentication failed";
|
|
355
|
+
if (kind === "notFound") return "Resource not found";
|
|
356
|
+
if (kind === "rateLimit") return "Rate limit exceeded";
|
|
357
|
+
return "Request failed with status " + decimal(status);
|
|
358
|
+
}
|
|
359
|
+
function errorMessageOf(given, kind, status) {
|
|
360
|
+
return given !== void 0 ? given : defaultMessageOf(kind, status);
|
|
361
|
+
}
|
|
362
|
+
function crossSiteUserIdOf(isId, id) {
|
|
363
|
+
return isId ? decimal(id) : void 0;
|
|
364
|
+
}
|
|
365
|
+
function responseHookOf(ok, hasOnError, hasOnResponse) {
|
|
366
|
+
if (ok) return hasOnResponse ? "onResponse" : "noHook";
|
|
367
|
+
return hasOnError ? "onError" : "noHook";
|
|
368
|
+
}
|
|
369
|
+
function crossSiteOutcomeOf(isVerified, tokenIsText, token) {
|
|
370
|
+
if (!isVerified) return "notVerified";
|
|
371
|
+
if (!tokenIsText || token === "") return "noToken";
|
|
372
|
+
return "signedIn";
|
|
373
|
+
}
|
|
289
374
|
function rawRetries(method) {
|
|
290
375
|
return method === "GET";
|
|
291
376
|
}
|
|
292
|
-
function startsAttempt(hasDeadline, remaining) {
|
|
293
|
-
return !hasDeadline || remaining > 0;
|
|
294
|
-
}
|
|
295
377
|
|
|
296
378
|
// src/core/errors.ts
|
|
379
|
+
var ROOT_PATH = "root";
|
|
297
380
|
var AugurError = class _AugurError extends Error {
|
|
298
381
|
code;
|
|
299
382
|
statusCode;
|
|
@@ -332,8 +415,7 @@ var ValidationError = class extends AugurError {
|
|
|
332
415
|
return [];
|
|
333
416
|
}
|
|
334
417
|
return this.validationErrors.map((error) => {
|
|
335
|
-
|
|
336
|
-
return `${path}: ${error.message}`;
|
|
418
|
+
return `${joinOr(error.path.map(String), ".", ROOT_PATH)}: ${error.message}`;
|
|
337
419
|
});
|
|
338
420
|
}
|
|
339
421
|
/**
|
|
@@ -345,7 +427,7 @@ var ValidationError = class extends AugurError {
|
|
|
345
427
|
return [];
|
|
346
428
|
}
|
|
347
429
|
return this.validationErrors.map((error) => ({
|
|
348
|
-
path: error.path.
|
|
430
|
+
path: joinOr(error.path.map(String), ".", ROOT_PATH),
|
|
349
431
|
message: error.message,
|
|
350
432
|
code: error.code,
|
|
351
433
|
received: "received" in error ? error.received : void 0,
|
|
@@ -359,7 +441,7 @@ var ValidationError = class extends AugurError {
|
|
|
359
441
|
toString() {
|
|
360
442
|
const baseMessage = super.toString();
|
|
361
443
|
const formattedErrors = this.getFormattedErrors();
|
|
362
|
-
if (formattedErrors.length
|
|
444
|
+
if (appendsIssues(formattedErrors.length)) {
|
|
363
445
|
return `${baseMessage}
|
|
364
446
|
Validation errors:
|
|
365
447
|
${formattedErrors.map((err) => ` - ${err}`).join("\n")}`;
|
|
@@ -404,7 +486,57 @@ var InvalidArgumentError = class extends AugurError {
|
|
|
404
486
|
}
|
|
405
487
|
};
|
|
406
488
|
|
|
489
|
+
// ../auth-core/src/site.ts
|
|
490
|
+
function isSiteChar(c) {
|
|
491
|
+
return c >= 97 && c <= 122 || c >= 48 && c <= 57 || c === 95 || c === 45;
|
|
492
|
+
}
|
|
493
|
+
function siteCharsFrom(s, i) {
|
|
494
|
+
return i >= s.length || isSiteChar(s.charCodeAt(i)) && siteCharsFrom(s, i + 1);
|
|
495
|
+
}
|
|
496
|
+
function isSiteId(s) {
|
|
497
|
+
return s.length > 0 && siteCharsFrom(s, 0);
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
// src/core/site-id-check.ts
|
|
501
|
+
function isSiteId2(s) {
|
|
502
|
+
return isSiteId(s);
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
// src/core/site-id.ts
|
|
506
|
+
function parseSiteId(value) {
|
|
507
|
+
return isSiteId2(value) ? value : void 0;
|
|
508
|
+
}
|
|
509
|
+
function assertSiteId(value) {
|
|
510
|
+
const site = parseSiteId(value);
|
|
511
|
+
if (site === void 0) {
|
|
512
|
+
throw new InvalidArgumentError({
|
|
513
|
+
message: "Invalid siteId: expected lowercase letters, digits, '_' and '-' (e.g. example-site)",
|
|
514
|
+
service: "",
|
|
515
|
+
endpoint: ""
|
|
516
|
+
});
|
|
517
|
+
}
|
|
518
|
+
return site;
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
// src/core/http-rules.ts
|
|
522
|
+
function isPublicEndpoint(url) {
|
|
523
|
+
return endsWith(url, "/health-check") || endsWith(url, "/ping");
|
|
524
|
+
}
|
|
525
|
+
function sendsBearer(url, hasToken) {
|
|
526
|
+
return hasToken && !isPublicEndpoint(url);
|
|
527
|
+
}
|
|
528
|
+
function sendsJsonBody(hasData, method) {
|
|
529
|
+
return hasData && method !== "GET";
|
|
530
|
+
}
|
|
531
|
+
function requestKey(method, url, params) {
|
|
532
|
+
return method + ":" + url + ":" + params;
|
|
533
|
+
}
|
|
534
|
+
function isEdgeCacheParam(key) {
|
|
535
|
+
return key === "edgeCache";
|
|
536
|
+
}
|
|
537
|
+
|
|
407
538
|
// src/core/client.ts
|
|
539
|
+
var MAX_RETRY_DELAY_MS = 3e4;
|
|
408
540
|
function parseJson(text) {
|
|
409
541
|
try {
|
|
410
542
|
return { json: true, value: JSON.parse(String(text)) };
|
|
@@ -418,16 +550,29 @@ function errorDetail(text) {
|
|
|
418
550
|
return { detail: {} };
|
|
419
551
|
}
|
|
420
552
|
const body = parsed.value;
|
|
421
|
-
const
|
|
422
|
-
const
|
|
553
|
+
const isObject = typeof body === "object" && body !== null;
|
|
554
|
+
const detail = isObject ? body : {};
|
|
555
|
+
const given = detail.message;
|
|
556
|
+
const isText = typeof given === "string";
|
|
557
|
+
const message = detailMessageOf(true, isObject, isText, isText ? given : "");
|
|
423
558
|
return { detail, message };
|
|
424
559
|
}
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
};
|
|
560
|
+
function statusError(status, message, ctx, detail) {
|
|
561
|
+
const kind = errorClassOf(status);
|
|
562
|
+
const text = errorMessageOf(message, kind, status);
|
|
563
|
+
if (kind === "validation")
|
|
564
|
+
return new ValidationError({ message: text, ...ctx, validationErrors: [] });
|
|
565
|
+
if (kind === "authentication") return new AuthenticationError({ message: text, ...ctx });
|
|
566
|
+
if (kind === "notFound") return new NotFoundError({ message: text, ...ctx });
|
|
567
|
+
if (kind === "rateLimit") return new RateLimitError({ message: text, ...ctx });
|
|
568
|
+
return new AugurError({
|
|
569
|
+
message: text,
|
|
570
|
+
code: nonEmptyOr(detail.code ?? "", "API_ERROR"),
|
|
571
|
+
statusCode: status,
|
|
572
|
+
...ctx,
|
|
573
|
+
requestId: detail.requestId
|
|
574
|
+
});
|
|
575
|
+
}
|
|
431
576
|
function generateRequestKey(method, url, params) {
|
|
432
577
|
const paramsStr = params ? JSON.stringify(params, Object.keys(params).sort()) : "";
|
|
433
578
|
return requestKey(method, url, paramsStr);
|
|
@@ -435,7 +580,7 @@ function generateRequestKey(method, url, params) {
|
|
|
435
580
|
function calculateBackoffDelay(attempt, baseDelay) {
|
|
436
581
|
const exponential = exponentialDelay(baseDelay, attempt);
|
|
437
582
|
const jitter = Math.random() * 0.3 * exponential;
|
|
438
|
-
return
|
|
583
|
+
return cappedAt(exponential + jitter, MAX_RETRY_DELAY_MS);
|
|
439
584
|
}
|
|
440
585
|
function isRetryableError(error) {
|
|
441
586
|
const isAugurError = error instanceof AugurError;
|
|
@@ -513,15 +658,11 @@ function buildUrlWithParams(url, params) {
|
|
|
513
658
|
const searchParams = new URLSearchParams();
|
|
514
659
|
const paramsObj = params;
|
|
515
660
|
for (const [key, value] of Object.entries(paramsObj)) {
|
|
516
|
-
if (value
|
|
661
|
+
if (queryValueSent(value === void 0, value === null)) {
|
|
517
662
|
searchParams.append(key, String(value));
|
|
518
663
|
}
|
|
519
664
|
}
|
|
520
|
-
|
|
521
|
-
if (!queryString) {
|
|
522
|
-
return url;
|
|
523
|
-
}
|
|
524
|
-
return `${url}${querySeparator(url)}${queryString}`;
|
|
665
|
+
return urlWithQuery(url, searchParams.toString());
|
|
525
666
|
}
|
|
526
667
|
function headersToRecord(headers) {
|
|
527
668
|
const record32 = {};
|
|
@@ -535,10 +676,21 @@ var HTTPClient = class {
|
|
|
535
676
|
serviceName;
|
|
536
677
|
inflightRequests = /* @__PURE__ */ new Map();
|
|
537
678
|
bounds;
|
|
538
|
-
/**
|
|
679
|
+
/**
|
|
680
|
+
* The siteId this client sends (`x-site-id`, and the value of every `cacheSiteId` edge
|
|
681
|
+
* directive): a `SiteId`, so only a proved `isSiteId` string reaches the header or Cloudflare's
|
|
682
|
+
* cache key (AugurApiClient.EdgeDirectiveCarriesASiteId; owner 2026-11-10).
|
|
683
|
+
*/
|
|
684
|
+
siteId;
|
|
685
|
+
/**
|
|
686
|
+
* `bounds` bound every call this client makes (a view's, from `AugurAPI.withRequest`).
|
|
687
|
+
*
|
|
688
|
+
* @throws InvalidArgumentError when `config.siteId` is not a siteId (as `AugurAPI` does)
|
|
689
|
+
*/
|
|
539
690
|
constructor(serviceName, config, bounds = NO_BOUNDS) {
|
|
540
691
|
this.serviceName = serviceName;
|
|
541
692
|
this.config = { ...DEFAULT_CONFIG, ...config };
|
|
693
|
+
this.siteId = assertSiteId(this.config.siteId);
|
|
542
694
|
this.bounds = bounds;
|
|
543
695
|
}
|
|
544
696
|
/**
|
|
@@ -549,7 +701,7 @@ var HTTPClient = class {
|
|
|
549
701
|
const headers = {
|
|
550
702
|
"Content-Type": "application/json",
|
|
551
703
|
...requestConfig?.headers,
|
|
552
|
-
"x-site-id": this.
|
|
704
|
+
"x-site-id": this.siteId
|
|
553
705
|
};
|
|
554
706
|
if (sendsBearer(url, Boolean(this.config.bearerToken))) {
|
|
555
707
|
headers["Authorization"] = `Bearer ${this.config.bearerToken}`;
|
|
@@ -566,9 +718,10 @@ var HTTPClient = class {
|
|
|
566
718
|
} catch {
|
|
567
719
|
}
|
|
568
720
|
const { detail, message } = errorDetail(text);
|
|
569
|
-
|
|
721
|
+
const { onError, onResponse } = this.config;
|
|
722
|
+
if (responseHookOf(response.ok, onError !== void 0, onResponse !== void 0) === "onError") {
|
|
570
723
|
const augurError = {
|
|
571
|
-
message: message
|
|
724
|
+
message: errorMessageOf(message, "augur", response.status),
|
|
572
725
|
config: augurConfig,
|
|
573
726
|
response: {
|
|
574
727
|
data: detail,
|
|
@@ -578,7 +731,7 @@ var HTTPClient = class {
|
|
|
578
731
|
config: augurConfig
|
|
579
732
|
}
|
|
580
733
|
};
|
|
581
|
-
await
|
|
734
|
+
await onError(augurError);
|
|
582
735
|
}
|
|
583
736
|
this.handleHttpError(response.status, { ...detail, message }, endpoint);
|
|
584
737
|
}
|
|
@@ -594,8 +747,9 @@ var HTTPClient = class {
|
|
|
594
747
|
headers: headersToRecord(response.headers),
|
|
595
748
|
config: augurConfig
|
|
596
749
|
};
|
|
597
|
-
|
|
598
|
-
|
|
750
|
+
const { onError, onResponse } = this.config;
|
|
751
|
+
if (responseHookOf(response.ok, onError !== void 0, onResponse !== void 0) === "onResponse") {
|
|
752
|
+
const modified = await onResponse(augurResponse);
|
|
599
753
|
return modified.data;
|
|
600
754
|
}
|
|
601
755
|
return responseData;
|
|
@@ -605,8 +759,9 @@ var HTTPClient = class {
|
|
|
605
759
|
*/
|
|
606
760
|
async readRaw(response, augurConfig) {
|
|
607
761
|
let text = await response.text();
|
|
608
|
-
|
|
609
|
-
|
|
762
|
+
const { onError, onResponse } = this.config;
|
|
763
|
+
if (responseHookOf(response.ok, onError !== void 0, onResponse !== void 0) === "onResponse") {
|
|
764
|
+
const modified = await onResponse({
|
|
610
765
|
data: text,
|
|
611
766
|
status: response.status,
|
|
612
767
|
statusText: response.statusText,
|
|
@@ -659,7 +814,7 @@ var HTTPClient = class {
|
|
|
659
814
|
const perAttempt = this.timeoutFor(requestConfig);
|
|
660
815
|
const remaining = call.remaining();
|
|
661
816
|
return {
|
|
662
|
-
timeout:
|
|
817
|
+
timeout: cutToRemaining(perAttempt, call.hasDeadline, remaining),
|
|
663
818
|
ownTimer: needsAttemptTimer(perAttempt, call.hasDeadline, remaining)
|
|
664
819
|
};
|
|
665
820
|
}
|
|
@@ -677,11 +832,11 @@ var HTTPClient = class {
|
|
|
677
832
|
}
|
|
678
833
|
};
|
|
679
834
|
}
|
|
680
|
-
/** The request's timeout: per request, else the client's, else the default (
|
|
835
|
+
/** The request's timeout: per request, else the client's, else the default (firstGiven). */
|
|
681
836
|
timeoutFor(requestConfig) {
|
|
682
837
|
const request = requestConfig?.timeout;
|
|
683
838
|
const client = this.config.timeout;
|
|
684
|
-
return
|
|
839
|
+
return firstGiven(
|
|
685
840
|
request !== void 0,
|
|
686
841
|
request ?? 0,
|
|
687
842
|
client !== void 0,
|
|
@@ -724,18 +879,7 @@ var HTTPClient = class {
|
|
|
724
879
|
* @ensures thrown.endpoint = endpoint (callers pass the path template, so no param values leak)
|
|
725
880
|
*/
|
|
726
881
|
handleHttpError(status, data, endpoint) {
|
|
727
|
-
|
|
728
|
-
const specific = STATUS_ERRORS[status];
|
|
729
|
-
if (specific) {
|
|
730
|
-
throw specific(data.message, ctx);
|
|
731
|
-
}
|
|
732
|
-
throw new AugurError({
|
|
733
|
-
message: data.message ?? `Request failed with status ${status}`,
|
|
734
|
-
code: data.code || "API_ERROR",
|
|
735
|
-
statusCode: status,
|
|
736
|
-
...ctx,
|
|
737
|
-
requestId: data.requestId
|
|
738
|
-
});
|
|
882
|
+
throw statusError(status, data.message, { service: this.serviceName, endpoint }, data);
|
|
739
883
|
}
|
|
740
884
|
/**
|
|
741
885
|
* Re-throw known error types or wrap as network error
|
|
@@ -751,7 +895,7 @@ var HTTPClient = class {
|
|
|
751
895
|
}
|
|
752
896
|
handleNetworkError(error, endpoint) {
|
|
753
897
|
throw new AugurError({
|
|
754
|
-
message: error.message
|
|
898
|
+
message: nonEmptyOr(error.message ?? "", "Network error"),
|
|
755
899
|
code: "NETWORK_ERROR",
|
|
756
900
|
statusCode: 0,
|
|
757
901
|
service: this.serviceName,
|
|
@@ -768,7 +912,7 @@ var HTTPClient = class {
|
|
|
768
912
|
if (!retryAfterCall(attempt, maxRetries, isRetryableError(error), call.signal?.aborted === true)) {
|
|
769
913
|
throw error;
|
|
770
914
|
}
|
|
771
|
-
const backoffDelay =
|
|
915
|
+
const backoffDelay = cutToRemaining(
|
|
772
916
|
calculateBackoffDelay(attempt, baseDelay),
|
|
773
917
|
call.hasDeadline,
|
|
774
918
|
call.remaining()
|
|
@@ -831,17 +975,14 @@ var HTTPClient = class {
|
|
|
831
975
|
return params;
|
|
832
976
|
}
|
|
833
977
|
const edgeCacheStr = String(edgeCache);
|
|
834
|
-
const
|
|
835
|
-
const kind = edgeCacheKindOf(edgeCacheStr, cacheHours);
|
|
978
|
+
const kind = edgeCacheKindOf(edgeCacheStr);
|
|
836
979
|
if (kind === "invalid") {
|
|
837
980
|
return withoutEdgeCache(paramsObj);
|
|
838
981
|
}
|
|
839
|
-
const
|
|
840
|
-
const restParams = withoutEdgeCache(paramsObj);
|
|
841
|
-
const cacheKey = `cacheSiteId${cacheSuffix}`;
|
|
982
|
+
const cacheKey = edgeCacheKeyOf(kind, edgeCacheStr);
|
|
842
983
|
return {
|
|
843
|
-
...
|
|
844
|
-
[cacheKey]: this.
|
|
984
|
+
...withoutEdgeCache(paramsObj),
|
|
985
|
+
[cacheKey]: this.siteId
|
|
845
986
|
};
|
|
846
987
|
}
|
|
847
988
|
async get(url, params, config) {
|
|
@@ -914,9 +1055,8 @@ var HTTPClient = class {
|
|
|
914
1055
|
};
|
|
915
1056
|
|
|
916
1057
|
// src/core/encoded-segment.ts
|
|
917
|
-
var PCHAR_RESTORE_RE = /%(?:24|26|2B|2C|3B|3D|3A|40)/g;
|
|
918
1058
|
function encodePathSegment(value) {
|
|
919
|
-
const encoded = encodeURIComponent(value)
|
|
1059
|
+
const encoded = restorePcharFrom(encodeURIComponent(value), 0);
|
|
920
1060
|
if (!isEncoded(encoded)) {
|
|
921
1061
|
throw new InvalidArgumentError({
|
|
922
1062
|
message: "Encoded path segment has an unexpected shape",
|
|
@@ -930,17 +1070,20 @@ function fillPlaceholder(path, placeholder, segment) {
|
|
|
930
1070
|
return placeholderFilled(path, placeholder, segment);
|
|
931
1071
|
}
|
|
932
1072
|
function renderPath(template, segments) {
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
1073
|
+
const names = templateNames(template, 0);
|
|
1074
|
+
const missing = notInFrom(names, Object.keys(segments), 0);
|
|
1075
|
+
if (missing.length > 0) {
|
|
1076
|
+
throw new InvalidArgumentError({
|
|
1077
|
+
message: `No path value for {${missing[0]}}`,
|
|
1078
|
+
service: "",
|
|
1079
|
+
endpoint: template
|
|
1080
|
+
});
|
|
1081
|
+
}
|
|
1082
|
+
let path = template;
|
|
1083
|
+
for (const name of names) {
|
|
1084
|
+
path = fillPlaceholder(path, name, segments[name]);
|
|
1085
|
+
}
|
|
1086
|
+
return path;
|
|
944
1087
|
}
|
|
945
1088
|
|
|
946
1089
|
// src/core/path-validation.ts
|
|
@@ -957,6 +1100,17 @@ var validatePathSegment = (pathTemplate, name, value, pattern, service = "http-c
|
|
|
957
1100
|
}
|
|
958
1101
|
};
|
|
959
1102
|
|
|
1103
|
+
// ../utils/src/slices.ts
|
|
1104
|
+
function beforeLastCode(s, code) {
|
|
1105
|
+
return s.slice(0, endBefore(lastIndexOfCode(s, code, s.length), s.length));
|
|
1106
|
+
}
|
|
1107
|
+
function withLastSegment(id, segment) {
|
|
1108
|
+
return beforeLastCode(id, 46) + "." + segment;
|
|
1109
|
+
}
|
|
1110
|
+
function endBefore(k, len) {
|
|
1111
|
+
return k >= 0 ? k : Math.max(len - 1, 0);
|
|
1112
|
+
}
|
|
1113
|
+
|
|
960
1114
|
// ../utils/src/case-spec.ts
|
|
961
1115
|
var UPPER = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
|
962
1116
|
function upperFirst(s) {
|
|
@@ -978,6 +1132,13 @@ function foldName(s) {
|
|
|
978
1132
|
if (c === 45 || c === 95) return foldName(s.slice(1));
|
|
979
1133
|
return lowerAscii(s.slice(0, 1)) + foldName(s.slice(1));
|
|
980
1134
|
}
|
|
1135
|
+
function foldMatchesFrom(names, key, k) {
|
|
1136
|
+
if (k === names.length) return [];
|
|
1137
|
+
const name = names[k];
|
|
1138
|
+
const rest = foldMatchesFrom(names, key, k + 1);
|
|
1139
|
+
if (foldName(name) !== foldName(key)) return rest;
|
|
1140
|
+
return [name, ...rest];
|
|
1141
|
+
}
|
|
981
1142
|
function snakeCamel(s) {
|
|
982
1143
|
if (codeAt(s, 0) === 95) {
|
|
983
1144
|
const c = codeAt(s, 1);
|
|
@@ -991,20 +1152,10 @@ function kebabCamel(s) {
|
|
|
991
1152
|
return kebabCamelFrom(s, false);
|
|
992
1153
|
}
|
|
993
1154
|
|
|
994
|
-
// ../utils/src/slices.ts
|
|
995
|
-
function beforeLastCode(s, code) {
|
|
996
|
-
return s.slice(0, endBefore(lastIndexOfCode(s, code, s.length), s.length));
|
|
997
|
-
}
|
|
998
|
-
function endBefore(k, len) {
|
|
999
|
-
return k >= 0 ? k : Math.max(len - 1, 0);
|
|
1000
|
-
}
|
|
1001
|
-
|
|
1002
|
-
// ../utils/src/http.ts
|
|
1003
|
-
function isPostOrPut(method) {
|
|
1004
|
-
return method === "POST" || method === "PUT";
|
|
1005
|
-
}
|
|
1006
|
-
|
|
1007
1155
|
// src/core/registry-rules.ts
|
|
1156
|
+
function endpointIdOf(service, chain, action) {
|
|
1157
|
+
return kebabCamel(service) + "." + chain + "." + action;
|
|
1158
|
+
}
|
|
1008
1159
|
function hasBodyFor(method) {
|
|
1009
1160
|
return isPostOrPut(method);
|
|
1010
1161
|
}
|
|
@@ -1028,6 +1179,14 @@ function syncedTotal(total, totalResults) {
|
|
|
1028
1179
|
function syncedTotalResults(total, totalResults) {
|
|
1029
1180
|
return totalResults === 0 ? Math.max(total, 0) : totalResults;
|
|
1030
1181
|
}
|
|
1182
|
+
function countChanged(count, dataLength) {
|
|
1183
|
+
return normalCount(count, dataLength) !== count;
|
|
1184
|
+
}
|
|
1185
|
+
function totalsChangeOf(total, totalResults) {
|
|
1186
|
+
if (syncedTotal(total, totalResults) !== total) return "total";
|
|
1187
|
+
if (syncedTotalResults(total, totalResults) !== totalResults) return "totalResults";
|
|
1188
|
+
return "kept";
|
|
1189
|
+
}
|
|
1031
1190
|
function warnsOnNormalization(hasEnv, env) {
|
|
1032
1191
|
return hasEnv && env !== "production";
|
|
1033
1192
|
}
|
|
@@ -1041,23 +1200,23 @@ var logNormalizationWarning = (message) => {
|
|
|
1041
1200
|
}
|
|
1042
1201
|
};
|
|
1043
1202
|
var normalizeCount = (count, actualDataLength) => {
|
|
1044
|
-
|
|
1045
|
-
if (normal !== count) {
|
|
1203
|
+
if (countChanged(count, actualDataLength)) {
|
|
1046
1204
|
logNormalizationWarning(`'count' was 0 but data has ${actualDataLength} items`);
|
|
1047
1205
|
}
|
|
1048
|
-
return
|
|
1206
|
+
return normalCount(count, actualDataLength);
|
|
1049
1207
|
};
|
|
1050
1208
|
var normalizeTotals = (total, totalResults) => {
|
|
1051
|
-
const
|
|
1052
|
-
|
|
1053
|
-
totalResults: syncedTotalResults(total, totalResults)
|
|
1054
|
-
};
|
|
1055
|
-
if (synced.total !== total) {
|
|
1209
|
+
const change = totalsChangeOf(total, totalResults);
|
|
1210
|
+
if (change === "total") {
|
|
1056
1211
|
logNormalizationWarning(`'total' was 0 but 'totalResults' is ${totalResults}`);
|
|
1057
|
-
}
|
|
1212
|
+
}
|
|
1213
|
+
if (change === "totalResults") {
|
|
1058
1214
|
logNormalizationWarning(`'totalResults' was 0 but 'total' is ${total}`);
|
|
1059
1215
|
}
|
|
1060
|
-
return
|
|
1216
|
+
return {
|
|
1217
|
+
total: syncedTotal(total, totalResults),
|
|
1218
|
+
totalResults: syncedTotalResults(total, totalResults)
|
|
1219
|
+
};
|
|
1061
1220
|
};
|
|
1062
1221
|
var BaseResponseSchema = (dataSchema) => v.pipe(
|
|
1063
1222
|
v.looseObject({
|
|
@@ -8883,7 +9042,11 @@ var ProductsListDataSchema = v11.array(
|
|
|
8883
9042
|
dateLastBuilt: v11.nullable(v11.string()),
|
|
8884
9043
|
checkoutLinkTemplate: v11.nullable(v11.string()),
|
|
8885
9044
|
dateLastStatus: v11.nullable(v11.string()),
|
|
8886
|
-
dateLastChanged: v11.nullable(v11.string())
|
|
9045
|
+
dateLastChanged: v11.nullable(v11.string()),
|
|
9046
|
+
imageWidth: v11.nullable(v11.number()),
|
|
9047
|
+
imageHeight: v11.nullable(v11.number()),
|
|
9048
|
+
additionalImageWidth: v11.nullable(v11.number()),
|
|
9049
|
+
additionalImageHeight: v11.nullable(v11.number())
|
|
8887
9050
|
})
|
|
8888
9051
|
);
|
|
8889
9052
|
var ProductsGetDataSchema = v11.looseObject({
|
|
@@ -8934,7 +9097,11 @@ var ProductsGetDataSchema = v11.looseObject({
|
|
|
8934
9097
|
dateLastBuilt: v11.nullable(v11.string()),
|
|
8935
9098
|
checkoutLinkTemplate: v11.nullable(v11.string()),
|
|
8936
9099
|
dateLastStatus: v11.nullable(v11.string()),
|
|
8937
|
-
dateLastChanged: v11.nullable(v11.string())
|
|
9100
|
+
dateLastChanged: v11.nullable(v11.string()),
|
|
9101
|
+
imageWidth: v11.nullable(v11.number()),
|
|
9102
|
+
imageHeight: v11.nullable(v11.number()),
|
|
9103
|
+
additionalImageWidth: v11.nullable(v11.number()),
|
|
9104
|
+
additionalImageHeight: v11.nullable(v11.number())
|
|
8938
9105
|
});
|
|
8939
9106
|
var SitemapsItemsListDataSchema = v11.array(
|
|
8940
9107
|
v11.looseObject({ id: v11.string(), link: v11.string(), lastModified: v11.nullable(v11.string()) })
|
|
@@ -9547,6 +9714,8 @@ var InvMastFaqListParamsSchema = v13.looseObject({
|
|
|
9547
9714
|
});
|
|
9548
9715
|
var InvMastInvAccessoryListParamsSchema = v13.looseObject({
|
|
9549
9716
|
...EdgeCacheParamsSchema.entries,
|
|
9717
|
+
classId5ExcludeList: v13.optional(v13.string()),
|
|
9718
|
+
classId5List: v13.optional(v13.string()),
|
|
9550
9719
|
limit: v13.optional(v13.pipe(v13.unknown(), v13.transform(Number))),
|
|
9551
9720
|
offset: v13.optional(v13.pipe(v13.unknown(), v13.transform(Number))),
|
|
9552
9721
|
orderBy: v13.optional(v13.string()),
|
|
@@ -9583,6 +9752,11 @@ var InvMastPromotionalGroupsListParamsSchema = v13.looseObject({
|
|
|
9583
9752
|
])
|
|
9584
9753
|
)
|
|
9585
9754
|
});
|
|
9755
|
+
var InvMastSimilarListParamsSchema = v13.looseObject({
|
|
9756
|
+
...EdgeCacheParamsSchema.entries,
|
|
9757
|
+
classId5ExcludeList: v13.optional(v13.string()),
|
|
9758
|
+
classId5List: v13.optional(v13.string())
|
|
9759
|
+
});
|
|
9586
9760
|
var InvPeriodUsageListParamsSchema = v13.looseObject({
|
|
9587
9761
|
...EdgeCacheParamsSchema.entries,
|
|
9588
9762
|
demandPeriodUid: v13.optional(v13.pipe(v13.unknown(), v13.transform(Number))),
|
|
@@ -15301,11 +15475,13 @@ var endpoints12 = [
|
|
|
15301
15475
|
aliases: [],
|
|
15302
15476
|
pathParams: ["invMastUid"],
|
|
15303
15477
|
pathPatterns: { invMastUid: "^\\d+$" },
|
|
15304
|
-
queryParams: ["limit", "offset", "orderBy", "statusCd"],
|
|
15478
|
+
queryParams: ["classId5ExcludeList", "classId5List", "limit", "offset", "orderBy", "statusCd"],
|
|
15305
15479
|
edgeCache: true,
|
|
15306
15480
|
summary: "List accessory items",
|
|
15307
15481
|
params: {
|
|
15308
15482
|
invMastUid: { in: "path", type: "integer", required: true },
|
|
15483
|
+
classId5ExcludeList: { in: "query", type: "string", required: false },
|
|
15484
|
+
classId5List: { in: "query", type: "string", required: false },
|
|
15309
15485
|
limit: { in: "query", type: "integer", required: false },
|
|
15310
15486
|
offset: { in: "query", type: "integer", required: false },
|
|
15311
15487
|
orderBy: { in: "query", type: "string", required: false },
|
|
@@ -15405,10 +15581,14 @@ var endpoints12 = [
|
|
|
15405
15581
|
aliases: [],
|
|
15406
15582
|
pathParams: ["invMastUid"],
|
|
15407
15583
|
pathPatterns: { invMastUid: "^\\d+$" },
|
|
15408
|
-
queryParams: [],
|
|
15584
|
+
queryParams: ["classId5ExcludeList", "classId5List"],
|
|
15409
15585
|
edgeCache: true,
|
|
15410
15586
|
summary: "List similar items",
|
|
15411
|
-
params: {
|
|
15587
|
+
params: {
|
|
15588
|
+
invMastUid: { in: "path", type: "integer", required: true },
|
|
15589
|
+
classId5ExcludeList: { in: "query", type: "string", required: false },
|
|
15590
|
+
classId5List: { in: "query", type: "string", required: false }
|
|
15591
|
+
},
|
|
15412
15592
|
responseSchema: InvMastSimilarListDataSchema,
|
|
15413
15593
|
responseType: "array"
|
|
15414
15594
|
},
|
|
@@ -16968,12 +17148,14 @@ var ContentListParamsSchema = v14.looseObject({
|
|
|
16968
17148
|
var ContentGetParamsSchema = v14.looseObject({
|
|
16969
17149
|
...EdgeCacheParamsSchema.entries,
|
|
16970
17150
|
alias: v14.optional(v14.string()),
|
|
16971
|
-
catid: v14.optional(v14.pipe(v14.unknown(), v14.transform(Number)))
|
|
17151
|
+
catid: v14.optional(v14.pipe(v14.unknown(), v14.transform(Number))),
|
|
17152
|
+
includeUnpublished: v14.optional(v14.string())
|
|
16972
17153
|
});
|
|
16973
17154
|
var ContentDocListParamsSchema = v14.looseObject({
|
|
16974
17155
|
...EdgeCacheParamsSchema.entries,
|
|
16975
17156
|
alias: v14.optional(v14.string()),
|
|
16976
|
-
catid: v14.optional(v14.pipe(v14.unknown(), v14.transform(Number)))
|
|
17157
|
+
catid: v14.optional(v14.pipe(v14.unknown(), v14.transform(Number))),
|
|
17158
|
+
includeUnpublished: v14.optional(v14.string())
|
|
16977
17159
|
});
|
|
16978
17160
|
var MenuListParamsSchema = v14.looseObject({
|
|
16979
17161
|
...EdgeCacheParamsSchema.entries,
|
|
@@ -17138,7 +17320,8 @@ var ContentListDataSchema = v14.array(
|
|
|
17138
17320
|
images: v14.union([v14.record(v14.string(), v14.unknown()), v14.array(v14.unknown())]),
|
|
17139
17321
|
fields: v14.array(
|
|
17140
17322
|
v14.looseObject({ value: v14.string(), title: v14.string(), name: v14.string(), label: v14.string() })
|
|
17141
|
-
)
|
|
17323
|
+
),
|
|
17324
|
+
state: v14.number()
|
|
17142
17325
|
})
|
|
17143
17326
|
);
|
|
17144
17327
|
var ContentGetDataSchema = v14.looseObject({
|
|
@@ -17147,7 +17330,8 @@ var ContentGetDataSchema = v14.looseObject({
|
|
|
17147
17330
|
alias: v14.string(),
|
|
17148
17331
|
introtext: v14.nullable(v14.string()),
|
|
17149
17332
|
fulltext: v14.nullable(v14.string()),
|
|
17150
|
-
catid: v14.number()
|
|
17333
|
+
catid: v14.number(),
|
|
17334
|
+
state: v14.number()
|
|
17151
17335
|
});
|
|
17152
17336
|
var ContentDocListDataSchema = v14.looseObject({
|
|
17153
17337
|
id: v14.number(),
|
|
@@ -17160,7 +17344,8 @@ var ContentDocListDataSchema = v14.looseObject({
|
|
|
17160
17344
|
images: v14.union([v14.record(v14.string(), v14.unknown()), v14.array(v14.unknown())]),
|
|
17161
17345
|
fields: v14.array(
|
|
17162
17346
|
v14.looseObject({ value: v14.string(), title: v14.string(), name: v14.string(), label: v14.string() })
|
|
17163
|
-
)
|
|
17347
|
+
),
|
|
17348
|
+
state: v14.number()
|
|
17164
17349
|
});
|
|
17165
17350
|
var MenuListDataSchema = v14.array(
|
|
17166
17351
|
v14.looseObject({
|
|
@@ -17571,13 +17756,14 @@ var endpoints13 = [
|
|
|
17571
17756
|
aliases: [],
|
|
17572
17757
|
pathParams: ["id"],
|
|
17573
17758
|
pathPatterns: { id: "^\\d+$" },
|
|
17574
|
-
queryParams: ["alias", "catid"],
|
|
17759
|
+
queryParams: ["alias", "catid", "includeUnpublished"],
|
|
17575
17760
|
edgeCache: true,
|
|
17576
17761
|
summary: "Get Content Detail",
|
|
17577
17762
|
params: {
|
|
17578
17763
|
id: { in: "path", type: "integer", required: true },
|
|
17579
17764
|
alias: { in: "query", type: "string", required: false },
|
|
17580
|
-
catid: { in: "query", type: "integer", required: false }
|
|
17765
|
+
catid: { in: "query", type: "integer", required: false },
|
|
17766
|
+
includeUnpublished: { in: "query", type: "string", required: false }
|
|
17581
17767
|
},
|
|
17582
17768
|
responseSchema: ContentGetDataSchema,
|
|
17583
17769
|
responseType: "object"
|
|
@@ -17590,13 +17776,14 @@ var endpoints13 = [
|
|
|
17590
17776
|
aliases: ["get"],
|
|
17591
17777
|
pathParams: ["id"],
|
|
17592
17778
|
pathPatterns: { id: "^\\d+$" },
|
|
17593
|
-
queryParams: ["alias", "catid"],
|
|
17779
|
+
queryParams: ["alias", "catid", "includeUnpublished"],
|
|
17594
17780
|
edgeCache: true,
|
|
17595
17781
|
summary: "Get Content Doc",
|
|
17596
17782
|
params: {
|
|
17597
17783
|
id: { in: "path", type: "integer", required: true },
|
|
17598
17784
|
alias: { in: "query", type: "string", required: false },
|
|
17599
|
-
catid: { in: "query", type: "integer", required: false }
|
|
17785
|
+
catid: { in: "query", type: "integer", required: false },
|
|
17786
|
+
includeUnpublished: { in: "query", type: "string", required: false }
|
|
17600
17787
|
},
|
|
17601
17788
|
responseSchema: ContentDocListDataSchema,
|
|
17602
17789
|
responseType: "object"
|
|
@@ -17949,6 +18136,8 @@ var endpoints13 = [
|
|
|
17949
18136
|
import * as v15 from "valibot";
|
|
17950
18137
|
var InvMastAlsoBoughtListParamsSchema = v15.looseObject({
|
|
17951
18138
|
...EdgeCacheParamsSchema.entries,
|
|
18139
|
+
classId5ExcludeList: v15.optional(v15.string()),
|
|
18140
|
+
classId5List: v15.optional(v15.string()),
|
|
17952
18141
|
statusCd: v15.optional(
|
|
17953
18142
|
v15.union([
|
|
17954
18143
|
v15.array(v15.pipe(v15.unknown(), v15.transform(Number))),
|
|
@@ -18452,11 +18641,13 @@ var endpoints14 = [
|
|
|
18452
18641
|
aliases: [],
|
|
18453
18642
|
pathParams: ["invMastUid"],
|
|
18454
18643
|
pathPatterns: { invMastUid: "^\\d+$" },
|
|
18455
|
-
queryParams: ["statusCd"],
|
|
18644
|
+
queryParams: ["classId5ExcludeList", "classId5List", "statusCd"],
|
|
18456
18645
|
edgeCache: true,
|
|
18457
18646
|
summary: "List item Also Bought",
|
|
18458
18647
|
params: {
|
|
18459
18648
|
invMastUid: { in: "path", type: "integer", required: true },
|
|
18649
|
+
classId5ExcludeList: { in: "query", type: "string", required: false },
|
|
18650
|
+
classId5List: { in: "query", type: "string", required: false },
|
|
18460
18651
|
statusCd: { in: "query", type: "integer|integer[]", required: false }
|
|
18461
18652
|
},
|
|
18462
18653
|
responseSchema: InvMastAlsoBoughtListDataSchema,
|
|
@@ -20242,6 +20433,7 @@ var ItemSearchListParamsSchema = v19.looseObject({
|
|
|
20242
20433
|
jobNumbers: v19.optional(v19.string()),
|
|
20243
20434
|
operator: v19.optional(v19.string()),
|
|
20244
20435
|
parentCategoryUid: v19.optional(v19.pipe(v19.unknown(), v19.transform(Number))),
|
|
20436
|
+
productGroupIdList: v19.optional(v19.string()),
|
|
20245
20437
|
q: v19.string(),
|
|
20246
20438
|
searchType: v19.string(),
|
|
20247
20439
|
size: v19.optional(v19.pipe(v19.unknown(), v19.transform(Number))),
|
|
@@ -20264,6 +20456,7 @@ var ItemSearchFacetsListParamsSchema = v19.looseObject({
|
|
|
20264
20456
|
jobNumbers: v19.optional(v19.string()),
|
|
20265
20457
|
operator: v19.optional(v19.string()),
|
|
20266
20458
|
parentCategoryUid: v19.optional(v19.pipe(v19.unknown(), v19.transform(Number))),
|
|
20459
|
+
productGroupIdList: v19.optional(v19.string()),
|
|
20267
20460
|
q: v19.string(),
|
|
20268
20461
|
searchType: v19.optional(v19.string()),
|
|
20269
20462
|
size: v19.optional(v19.pipe(v19.unknown(), v19.transform(Number))),
|
|
@@ -20579,6 +20772,7 @@ var endpoints18 = [
|
|
|
20579
20772
|
"jobNumbers",
|
|
20580
20773
|
"operator",
|
|
20581
20774
|
"parentCategoryUid",
|
|
20775
|
+
"productGroupIdList",
|
|
20582
20776
|
"q",
|
|
20583
20777
|
"searchType",
|
|
20584
20778
|
"size",
|
|
@@ -20602,6 +20796,7 @@ var endpoints18 = [
|
|
|
20602
20796
|
jobNumbers: { in: "query", type: "string", required: false },
|
|
20603
20797
|
operator: { in: "query", type: "string", required: false },
|
|
20604
20798
|
parentCategoryUid: { in: "query", type: "integer", required: false },
|
|
20799
|
+
productGroupIdList: { in: "query", type: "string", required: false },
|
|
20605
20800
|
q: { in: "query", type: "string", required: true },
|
|
20606
20801
|
searchType: { in: "query", type: "string", required: true },
|
|
20607
20802
|
size: { in: "query", type: "integer", required: false },
|
|
@@ -20634,6 +20829,7 @@ var endpoints18 = [
|
|
|
20634
20829
|
"jobNumbers",
|
|
20635
20830
|
"operator",
|
|
20636
20831
|
"parentCategoryUid",
|
|
20832
|
+
"productGroupIdList",
|
|
20637
20833
|
"q",
|
|
20638
20834
|
"searchType",
|
|
20639
20835
|
"size",
|
|
@@ -20657,6 +20853,7 @@ var endpoints18 = [
|
|
|
20657
20853
|
jobNumbers: { in: "query", type: "string", required: false },
|
|
20658
20854
|
operator: { in: "query", type: "string", required: false },
|
|
20659
20855
|
parentCategoryUid: { in: "query", type: "integer", required: false },
|
|
20856
|
+
productGroupIdList: { in: "query", type: "string", required: false },
|
|
20660
20857
|
q: { in: "query", type: "string", required: true },
|
|
20661
20858
|
searchType: { in: "query", type: "string", required: false },
|
|
20662
20859
|
size: { in: "query", type: "integer", required: false },
|
|
@@ -39723,9 +39920,9 @@ function frozenParams(params) {
|
|
|
39723
39920
|
}
|
|
39724
39921
|
function fromRow(service, row) {
|
|
39725
39922
|
return Object.freeze({
|
|
39726
|
-
// the
|
|
39727
|
-
//
|
|
39728
|
-
id:
|
|
39923
|
+
// the generator's rule too (proved endpointIdOf, the model's EndpointId), so an id is the
|
|
39924
|
+
// same whichever side built it: open-search → openSearch
|
|
39925
|
+
id: endpointIdOf(service, row.chain, row.action),
|
|
39729
39926
|
service,
|
|
39730
39927
|
method: row.method,
|
|
39731
39928
|
path: row.path,
|
|
@@ -39744,7 +39941,7 @@ function fromRow(service, row) {
|
|
|
39744
39941
|
function baseEntries(service) {
|
|
39745
39942
|
return BASE_ENDPOINTS.map(
|
|
39746
39943
|
([chain, path, auth, summary]) => Object.freeze({
|
|
39747
|
-
id:
|
|
39944
|
+
id: endpointIdOf(service, chain, "get"),
|
|
39748
39945
|
service,
|
|
39749
39946
|
method: "GET",
|
|
39750
39947
|
path,
|
|
@@ -39778,9 +39975,8 @@ function buildIndex() {
|
|
|
39778
39975
|
const map = /* @__PURE__ */ new Map();
|
|
39779
39976
|
for (const entry of registryEntries()) {
|
|
39780
39977
|
map.set(entry.id, entry);
|
|
39781
|
-
const chain = beforeLastCode(entry.id, 46);
|
|
39782
39978
|
for (const alias of entry.aliases) {
|
|
39783
|
-
map.set(
|
|
39979
|
+
map.set(withLastSegment(entry.id, alias), entry);
|
|
39784
39980
|
}
|
|
39785
39981
|
}
|
|
39786
39982
|
return map;
|
|
@@ -39819,7 +40015,7 @@ function rejectUnknown(entry, kind, keys, allowed) {
|
|
|
39819
40015
|
}
|
|
39820
40016
|
function checkArgs(entry, args) {
|
|
39821
40017
|
const pathKeys = Object.keys(args.pathParams ?? {});
|
|
39822
|
-
const missing = entry.pathParams
|
|
40018
|
+
const missing = notInFrom([...entry.pathParams], pathKeys, 0);
|
|
39823
40019
|
if (missing.length > 0) {
|
|
39824
40020
|
throw invalid(missingPathMessage(entry.id, joinFrom(missing, ", ", 0)), entry);
|
|
39825
40021
|
}
|
|
@@ -39843,11 +40039,10 @@ function fillPath(entry, pathParams) {
|
|
|
39843
40039
|
return renderPath(entry.path, segments);
|
|
39844
40040
|
}
|
|
39845
40041
|
function toEnvelope(body) {
|
|
39846
|
-
|
|
39847
|
-
|
|
39848
|
-
|
|
39849
|
-
|
|
39850
|
-
if (!ENVELOPE_KEYS.every((key) => key in record32)) {
|
|
40042
|
+
const isPlainObject = typeof body === "object" && body !== null && !Array.isArray(body);
|
|
40043
|
+
const record32 = isPlainObject ? body : {};
|
|
40044
|
+
const present = ENVELOPE_KEYS.map((key) => key in record32);
|
|
40045
|
+
if (!isEnvelopeBody(isPlainObject, allFrom(present, 0))) {
|
|
39851
40046
|
return null;
|
|
39852
40047
|
}
|
|
39853
40048
|
return Object.fromEntries(ENVELOPE_KEYS.map((key) => [key, record32[key]]));
|
|
@@ -39865,40 +40060,41 @@ async function callEndpoint(config, id, args = {}, bounds = NO_BOUNDS) {
|
|
|
39865
40060
|
config: { endpoint: entry.path }
|
|
39866
40061
|
});
|
|
39867
40062
|
const parsed = parseJson(raw.text);
|
|
39868
|
-
const body = parsed.json ? parsed.value : raw.text;
|
|
40063
|
+
const body = callBodyKind(parsed.json) === "json" ? parsed.value : raw.text;
|
|
39869
40064
|
return { httpStatus: raw.status, envelope: toEnvelope(body), body };
|
|
39870
40065
|
}
|
|
39871
40066
|
|
|
39872
|
-
//
|
|
39873
|
-
function
|
|
39874
|
-
return
|
|
40067
|
+
// src/core/proxy-rules.ts
|
|
40068
|
+
function renamesWireParams(method) {
|
|
40069
|
+
return method === "GET";
|
|
39875
40070
|
}
|
|
39876
|
-
function
|
|
39877
|
-
return
|
|
40071
|
+
function defaultsEmptyBody(hasQueryParams, hasBody) {
|
|
40072
|
+
return !hasQueryParams && !hasBody;
|
|
39878
40073
|
}
|
|
39879
|
-
function
|
|
39880
|
-
|
|
40074
|
+
function dataProxyRoute(isFunction, isObject) {
|
|
40075
|
+
if (isFunction) return "unwrap";
|
|
40076
|
+
return isObject ? "nest" : "copy";
|
|
39881
40077
|
}
|
|
39882
|
-
|
|
39883
|
-
|
|
39884
|
-
|
|
39885
|
-
return isSiteId(s);
|
|
40078
|
+
function requestShapeOf(hasPathParams, hasQueryParams, hasBody) {
|
|
40079
|
+
if (hasPathParams) return "withPathParams";
|
|
40080
|
+
return hasQueryParams || hasBody ? "paramsOnly" : "noParams";
|
|
39886
40081
|
}
|
|
39887
|
-
|
|
39888
|
-
|
|
39889
|
-
function parseSiteId(value) {
|
|
39890
|
-
return isSiteId2(value) ? value : void 0;
|
|
40082
|
+
function copiesLegacyValue(camelGiven) {
|
|
40083
|
+
return !camelGiven;
|
|
39891
40084
|
}
|
|
39892
|
-
function
|
|
39893
|
-
|
|
39894
|
-
|
|
39895
|
-
|
|
39896
|
-
|
|
39897
|
-
|
|
39898
|
-
|
|
39899
|
-
|
|
39900
|
-
|
|
39901
|
-
return
|
|
40085
|
+
function pathParamTargets(path, key) {
|
|
40086
|
+
if (includesFrom(path, braced(key), 0)) return [key];
|
|
40087
|
+
return foldMatchesFrom(templateNames(path, 0), key, 0);
|
|
40088
|
+
}
|
|
40089
|
+
function bodySlot(method) {
|
|
40090
|
+
return method === "DELETE" ? -1 : 0;
|
|
40091
|
+
}
|
|
40092
|
+
function querySlot(method) {
|
|
40093
|
+
if (method === "POST" || method === "PUT") return 1;
|
|
40094
|
+
return method === "DELETE" ? 0 : -1;
|
|
40095
|
+
}
|
|
40096
|
+
function isLegacyAlias(changed, declared) {
|
|
40097
|
+
return changed && declared;
|
|
39902
40098
|
}
|
|
39903
40099
|
|
|
39904
40100
|
// src/core/common-schemas.ts
|
|
@@ -40033,16 +40229,15 @@ var BaseServiceClient = class {
|
|
|
40033
40229
|
* describe the expected type, and `received` is not copied)
|
|
40034
40230
|
*/
|
|
40035
40231
|
createValidationError(valibotError, config, errorType) {
|
|
40036
|
-
const message = errorType === "params" ? "Invalid request parameters" : "Invalid API response structure\nThis appears to be a response validation error. The API returned data in an unexpected format.";
|
|
40037
40232
|
return new ValidationError({
|
|
40038
|
-
message,
|
|
40233
|
+
message: validationMessageOf(errorType),
|
|
40039
40234
|
service: this.serviceName,
|
|
40040
40235
|
endpoint: config.path,
|
|
40041
40236
|
validationErrors: valibotError.issues.map((issue) => ({
|
|
40042
40237
|
path: (issue.path ?? []).map((segment) => segment.key),
|
|
40043
40238
|
message: issue.message,
|
|
40044
40239
|
// Typed as always present, but issues built outside valibot can lack it
|
|
40045
|
-
code: issue.type
|
|
40240
|
+
code: issueCodeOf(issue.type)
|
|
40046
40241
|
}))
|
|
40047
40242
|
});
|
|
40048
40243
|
}
|
|
@@ -40070,45 +40265,28 @@ var BaseServiceClient = class {
|
|
|
40070
40265
|
let path = pathTemplate;
|
|
40071
40266
|
for (const [key, value] of Object.entries(pathParams)) {
|
|
40072
40267
|
const stringValue = String(value);
|
|
40073
|
-
|
|
40074
|
-
validatePathSegment(
|
|
40075
|
-
|
|
40076
|
-
|
|
40077
|
-
|
|
40078
|
-
|
|
40079
|
-
|
|
40080
|
-
|
|
40081
|
-
|
|
40082
|
-
placeholder,
|
|
40083
|
-
stringValue,
|
|
40084
|
-
pathPatterns[placeholder],
|
|
40085
|
-
this.serviceName
|
|
40086
|
-
);
|
|
40087
|
-
path = fillPlaceholder(path, placeholder, encodePathSegment(stringValue));
|
|
40088
|
-
}
|
|
40089
|
-
}
|
|
40268
|
+
for (const placeholder of pathParamTargets(path, key)) {
|
|
40269
|
+
validatePathSegment(
|
|
40270
|
+
pathTemplate,
|
|
40271
|
+
placeholder,
|
|
40272
|
+
stringValue,
|
|
40273
|
+
pathPatterns[placeholder],
|
|
40274
|
+
this.serviceName
|
|
40275
|
+
);
|
|
40276
|
+
path = fillPlaceholder(path, placeholder, encodePathSegment(stringValue));
|
|
40090
40277
|
}
|
|
40091
40278
|
}
|
|
40092
40279
|
return path;
|
|
40093
40280
|
}
|
|
40094
40281
|
};
|
|
40095
40282
|
|
|
40096
|
-
// src/
|
|
40097
|
-
|
|
40098
|
-
|
|
40099
|
-
// src/core/proxy-rules.ts
|
|
40100
|
-
function bodySlot(method) {
|
|
40101
|
-
return method === "DELETE" ? -1 : 0;
|
|
40102
|
-
}
|
|
40103
|
-
function querySlot(method) {
|
|
40104
|
-
if (method === "POST" || method === "PUT") return 1;
|
|
40105
|
-
return method === "DELETE" ? 0 : -1;
|
|
40106
|
-
}
|
|
40107
|
-
function isLegacyAlias(changed, declared) {
|
|
40108
|
-
return changed && declared;
|
|
40283
|
+
// ../utils/src/distance.ts
|
|
40284
|
+
function min2(x, y) {
|
|
40285
|
+
return Math.min(x, y);
|
|
40109
40286
|
}
|
|
40110
40287
|
|
|
40111
40288
|
// src/core/service-proxy.ts
|
|
40289
|
+
import * as v33 from "valibot";
|
|
40112
40290
|
var PassthroughResponseSchema = v33.looseObject({
|
|
40113
40291
|
count: v33.number(),
|
|
40114
40292
|
data: v33.unknown(),
|
|
@@ -40153,16 +40331,12 @@ function createNodeObject(serviceName, executeRequest, node) {
|
|
|
40153
40331
|
return obj;
|
|
40154
40332
|
}
|
|
40155
40333
|
function splitPathArgs(pathParams, args) {
|
|
40334
|
+
const taken = min2(pathParams.length, args.length);
|
|
40156
40335
|
const pathParamMap = {};
|
|
40157
|
-
let index2 = 0;
|
|
40158
|
-
|
|
40159
|
-
if (index2 >= args.length) {
|
|
40160
|
-
break;
|
|
40161
|
-
}
|
|
40162
|
-
pathParamMap[name] = String(args[index2]);
|
|
40163
|
-
index2++;
|
|
40336
|
+
for (let index2 = 0; index2 < taken; index2++) {
|
|
40337
|
+
pathParamMap[pathParams[index2]] = String(args[index2]);
|
|
40164
40338
|
}
|
|
40165
|
-
return { pathParamMap, rest: args.slice(
|
|
40339
|
+
return { pathParamMap, rest: args.slice(taken) };
|
|
40166
40340
|
}
|
|
40167
40341
|
function splitBodyAndQuery(method, rest) {
|
|
40168
40342
|
const at = (slot) => rest[slot];
|
|
@@ -40183,7 +40357,7 @@ function normaliseLegacyParamCase(params, declared) {
|
|
|
40183
40357
|
}
|
|
40184
40358
|
renamed = true;
|
|
40185
40359
|
delete out[key];
|
|
40186
|
-
if (
|
|
40360
|
+
if (copiesLegacyValue(camel in source)) {
|
|
40187
40361
|
out[camel] = value;
|
|
40188
40362
|
}
|
|
40189
40363
|
}
|
|
@@ -40200,7 +40374,7 @@ function createActionFunction(_serviceName, executeRequest, endpoint) {
|
|
|
40200
40374
|
hasQueryParams ? trailing : void 0,
|
|
40201
40375
|
endpoint.queryParams
|
|
40202
40376
|
);
|
|
40203
|
-
const wireParams = (value) => method
|
|
40377
|
+
const wireParams = (value) => renamesWireParams(method) ? normaliseLegacyParamCase(value, endpoint.queryParams) : value;
|
|
40204
40378
|
const config = {
|
|
40205
40379
|
method,
|
|
40206
40380
|
path,
|
|
@@ -40208,11 +40382,17 @@ function createActionFunction(_serviceName, executeRequest, endpoint) {
|
|
|
40208
40382
|
...hasQueryParams ? { paramsSchema: PassthroughParamsSchema } : {},
|
|
40209
40383
|
responseSchema: PassthroughResponseSchema
|
|
40210
40384
|
};
|
|
40211
|
-
|
|
40212
|
-
|
|
40385
|
+
const shape = requestShapeOf(
|
|
40386
|
+
Object.keys(pathParamMap).length > 0,
|
|
40387
|
+
hasQueryParams,
|
|
40388
|
+
body !== void 0
|
|
40389
|
+
);
|
|
40390
|
+
if (shape === "withPathParams") {
|
|
40391
|
+
const hasBody = body !== void 0 && body !== null;
|
|
40392
|
+
const params = wireParams(defaultsEmptyBody(hasQueryParams, hasBody) ? {} : body);
|
|
40213
40393
|
return query === void 0 ? executeRequest(config, params, pathParamMap) : executeRequest(config, params, pathParamMap, query);
|
|
40214
40394
|
}
|
|
40215
|
-
if (
|
|
40395
|
+
if (shape === "paramsOnly") {
|
|
40216
40396
|
return query === void 0 ? executeRequest(config, wireParams(body)) : executeRequest(config, wireParams(body), void 0, query);
|
|
40217
40397
|
}
|
|
40218
40398
|
return executeRequest(config);
|
|
@@ -40223,14 +40403,18 @@ function createDataProxy(resource) {
|
|
|
40223
40403
|
const src = resource;
|
|
40224
40404
|
for (const key of Object.keys(src)) {
|
|
40225
40405
|
const value = src[key];
|
|
40226
|
-
|
|
40406
|
+
const route = dataProxyRoute(
|
|
40407
|
+
typeof value === "function",
|
|
40408
|
+
typeof value === "object" && value !== null
|
|
40409
|
+
);
|
|
40410
|
+
if (route === "unwrap") {
|
|
40227
40411
|
const propKey = key;
|
|
40228
40412
|
obj[key] = async (...args) => {
|
|
40229
40413
|
const fn = src[propKey];
|
|
40230
40414
|
const response = await fn(...args);
|
|
40231
40415
|
return response?.data;
|
|
40232
40416
|
};
|
|
40233
|
-
} else if (
|
|
40417
|
+
} else if (route === "nest") {
|
|
40234
40418
|
obj[key] = createDataProxy(value);
|
|
40235
40419
|
} else {
|
|
40236
40420
|
obj[key] = value;
|
|
@@ -42449,6 +42633,11 @@ var AugurAPI = class _AugurAPI {
|
|
|
42449
42633
|
}
|
|
42450
42634
|
};
|
|
42451
42635
|
|
|
42636
|
+
// ../foundation/src/pos-int.ts
|
|
42637
|
+
function posIntOf(n) {
|
|
42638
|
+
return Math.floor(n) === n && n >= 1 && n <= 9007199254740991 ? n : null;
|
|
42639
|
+
}
|
|
42640
|
+
|
|
42452
42641
|
// src/utils/cross-site-auth.ts
|
|
42453
42642
|
async function authenticateUserForSite(params) {
|
|
42454
42643
|
const { targetSiteId, username, password, augurInfoToken } = params;
|
|
@@ -42463,23 +42652,35 @@ async function authenticateUserForSite(params) {
|
|
|
42463
42652
|
siteId: targetSiteId
|
|
42464
42653
|
// This tells the API to authenticate against the target site
|
|
42465
42654
|
});
|
|
42466
|
-
|
|
42655
|
+
const token = data.token;
|
|
42656
|
+
const tokenIsText = typeof token === "string";
|
|
42657
|
+
const outcome = crossSiteOutcomeOf(
|
|
42658
|
+
Boolean(data.isVerified),
|
|
42659
|
+
tokenIsText,
|
|
42660
|
+
tokenIsText ? token : ""
|
|
42661
|
+
);
|
|
42662
|
+
if (outcome === "notVerified") {
|
|
42467
42663
|
return { success: false, targetSiteId, error: "Invalid username or password" };
|
|
42468
42664
|
}
|
|
42469
|
-
if (
|
|
42665
|
+
if (outcome === "noToken") {
|
|
42470
42666
|
return { success: false, targetSiteId, error: "Password verified, but no token was issued" };
|
|
42471
42667
|
}
|
|
42668
|
+
const bearer = token;
|
|
42669
|
+
const rawId = data.id;
|
|
42670
|
+
const userId = posIntOf(typeof rawId === "number" ? rawId : Number.NaN);
|
|
42472
42671
|
const targetSiteAPI = new AugurAPI({
|
|
42473
42672
|
siteId: targetSiteId,
|
|
42474
|
-
bearerToken:
|
|
42673
|
+
bearerToken: bearer
|
|
42475
42674
|
});
|
|
42476
42675
|
return {
|
|
42477
42676
|
success: true,
|
|
42478
|
-
// `data` is typed, not validated at runtime
|
|
42479
|
-
|
|
42677
|
+
// `data` is typed, not validated at runtime. A user id is an integer at least 1: it enters
|
|
42678
|
+
// as a PosInt (foundation's posIntOf; not a number reads as NaN, which it refuses) and the
|
|
42679
|
+
// proved crossSiteUserIdOf writes it, so 0, -1, 1.5 or a missing id report no id
|
|
42680
|
+
userId: crossSiteUserIdOf(userId !== null, userId ?? 0),
|
|
42480
42681
|
username: data.username,
|
|
42481
42682
|
email: data.email,
|
|
42482
|
-
token:
|
|
42683
|
+
token: bearer,
|
|
42483
42684
|
targetSiteId,
|
|
42484
42685
|
targetSiteAPI
|
|
42485
42686
|
};
|
|
@@ -42503,7 +42704,7 @@ function createCrossSiteAuthenticator(augurInfoToken) {
|
|
|
42503
42704
|
}
|
|
42504
42705
|
|
|
42505
42706
|
// src/index.ts
|
|
42506
|
-
var VERSION = "2026.11.
|
|
42707
|
+
var VERSION = "2026.11.5";
|
|
42507
42708
|
export {
|
|
42508
42709
|
AgrInfoClient,
|
|
42509
42710
|
AgrIntClient,
|