@simpleapps-com/augur-api 2026.9.6 → 2026.9.7
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/README.md +29 -0
- package/SKILL.md +15 -0
- package/dist/{client-BdaR6MZK.d.mts → client-BbTOVex4.d.mts} +232 -21
- package/dist/{client-BdaR6MZK.d.ts → client-BbTOVex4.d.ts} +232 -21
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +384 -146
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +384 -146
- package/dist/index.mjs.map +1 -1
- package/dist/testing.d.mts +1 -1
- package/dist/testing.d.ts +1 -1
- package/package.json +2 -3
package/dist/index.js
CHANGED
|
@@ -196,6 +196,31 @@ var InvalidArgumentError = class extends AugurError {
|
|
|
196
196
|
};
|
|
197
197
|
|
|
198
198
|
// src/core/client.ts
|
|
199
|
+
var MAX_ERROR_TEXT = 200;
|
|
200
|
+
function parseJson(text) {
|
|
201
|
+
try {
|
|
202
|
+
return { json: true, value: JSON.parse(text) };
|
|
203
|
+
} catch {
|
|
204
|
+
return { json: false };
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
function errorDetail(text) {
|
|
208
|
+
const parsed = parseJson(text);
|
|
209
|
+
if (parsed.json) {
|
|
210
|
+
const body = parsed.value;
|
|
211
|
+
const detail = typeof body === "object" && body !== null ? body : {};
|
|
212
|
+
const message = typeof detail.message === "string" && detail.message !== "" ? detail.message : void 0;
|
|
213
|
+
return { detail, message };
|
|
214
|
+
}
|
|
215
|
+
const excerpt = text.trim().slice(0, MAX_ERROR_TEXT);
|
|
216
|
+
return { detail: {}, message: excerpt === "" ? void 0 : excerpt };
|
|
217
|
+
}
|
|
218
|
+
var STATUS_ERRORS = {
|
|
219
|
+
400: (message, ctx) => new ValidationError({ message: message ?? "Validation failed", ...ctx, validationErrors: [] }),
|
|
220
|
+
401: (message, ctx) => new AuthenticationError({ message: message ?? "Authentication failed", ...ctx }),
|
|
221
|
+
404: (message, ctx) => new NotFoundError({ message: message ?? "Resource not found", ...ctx }),
|
|
222
|
+
429: (message, ctx) => new RateLimitError({ message: message ?? "Rate limit exceeded", ...ctx })
|
|
223
|
+
};
|
|
199
224
|
function generateRequestKey(method, url, params) {
|
|
200
225
|
const paramsStr = params ? JSON.stringify(params, Object.keys(params).sort()) : "";
|
|
201
226
|
return `${method}:${url}:${paramsStr}`;
|
|
@@ -266,18 +291,19 @@ var HTTPClient = class {
|
|
|
266
291
|
/**
|
|
267
292
|
* Handle non-ok fetch response: parse error, call hook, throw
|
|
268
293
|
*/
|
|
269
|
-
async handleFetchError(response, augurConfig) {
|
|
270
|
-
let
|
|
294
|
+
async handleFetchError(response, augurConfig, endpoint) {
|
|
295
|
+
let text = "";
|
|
271
296
|
try {
|
|
272
|
-
|
|
297
|
+
text = await response.text();
|
|
273
298
|
} catch {
|
|
274
299
|
}
|
|
300
|
+
const { detail, message } = errorDetail(text);
|
|
275
301
|
if (this.config.onError) {
|
|
276
302
|
const augurError = {
|
|
277
|
-
message:
|
|
303
|
+
message: message ?? `Request failed with status ${response.status}`,
|
|
278
304
|
config: augurConfig,
|
|
279
305
|
response: {
|
|
280
|
-
data:
|
|
306
|
+
data: detail,
|
|
281
307
|
status: response.status,
|
|
282
308
|
statusText: response.statusText,
|
|
283
309
|
headers: headersToRecord(response.headers),
|
|
@@ -286,7 +312,7 @@ var HTTPClient = class {
|
|
|
286
312
|
};
|
|
287
313
|
await this.config.onError(augurError);
|
|
288
314
|
}
|
|
289
|
-
this.handleHttpError(
|
|
315
|
+
this.handleHttpError(response.status, { ...detail, message }, endpoint);
|
|
290
316
|
}
|
|
291
317
|
/**
|
|
292
318
|
* Handle successful fetch response: parse, call hook, return data
|
|
@@ -307,10 +333,33 @@ var HTTPClient = class {
|
|
|
307
333
|
return responseData;
|
|
308
334
|
}
|
|
309
335
|
/**
|
|
310
|
-
*
|
|
336
|
+
* Read a successful response as text, for `raw()`. Never parses JSON.
|
|
311
337
|
*/
|
|
312
|
-
async
|
|
338
|
+
async readRaw(response, augurConfig) {
|
|
339
|
+
let text = await response.text();
|
|
340
|
+
if (this.config.onResponse) {
|
|
341
|
+
const modified = await this.config.onResponse({
|
|
342
|
+
data: text,
|
|
343
|
+
status: response.status,
|
|
344
|
+
statusText: response.statusText,
|
|
345
|
+
headers: headersToRecord(response.headers),
|
|
346
|
+
config: augurConfig
|
|
347
|
+
});
|
|
348
|
+
text = modified.data;
|
|
349
|
+
}
|
|
350
|
+
return {
|
|
351
|
+
status: response.status,
|
|
352
|
+
contentType: response.headers.get("content-type") ?? "",
|
|
353
|
+
text
|
|
354
|
+
};
|
|
355
|
+
}
|
|
356
|
+
/**
|
|
357
|
+
* Core request method using native fetch. `read` turns a 2xx response into
|
|
358
|
+
* the result, inside the same error handling and timeout as the fetch.
|
|
359
|
+
*/
|
|
360
|
+
async request(method, url, options, read = (r, c) => this.handleFetchSuccess(r, c)) {
|
|
313
361
|
const { params, data, config: requestConfig } = options;
|
|
362
|
+
const endpoint = requestConfig?.endpoint ?? url;
|
|
314
363
|
const timeout = requestConfig?.timeout ?? this.config.timeout ?? DEFAULT_CONFIG.timeout;
|
|
315
364
|
const headers = this.buildRequestHeaders(url, requestConfig);
|
|
316
365
|
let augurConfig = {
|
|
@@ -339,11 +388,11 @@ var HTTPClient = class {
|
|
|
339
388
|
}
|
|
340
389
|
const response = await fetch(fullUrl, fetchOptions);
|
|
341
390
|
if (!response.ok) {
|
|
342
|
-
await this.handleFetchError(response, augurConfig);
|
|
391
|
+
await this.handleFetchError(response, augurConfig, endpoint);
|
|
343
392
|
}
|
|
344
|
-
return
|
|
393
|
+
return await read(response, augurConfig);
|
|
345
394
|
} catch (error) {
|
|
346
|
-
this.rethrowOrWrapError(error,
|
|
395
|
+
this.rethrowOrWrapError(error, endpoint);
|
|
347
396
|
} finally {
|
|
348
397
|
clearTimeout(timeoutId);
|
|
349
398
|
}
|
|
@@ -361,37 +410,26 @@ var HTTPClient = class {
|
|
|
361
410
|
}
|
|
362
411
|
return controller.signal;
|
|
363
412
|
}
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
service: this.serviceName,
|
|
377
|
-
endpoint
|
|
378
|
-
});
|
|
379
|
-
case 429:
|
|
380
|
-
throw new RateLimitError({
|
|
381
|
-
message: data?.message || "Rate limit exceeded",
|
|
382
|
-
service: this.serviceName,
|
|
383
|
-
endpoint
|
|
384
|
-
});
|
|
385
|
-
default:
|
|
386
|
-
throw new AugurError({
|
|
387
|
-
message: data?.message || `Request failed with status ${status}`,
|
|
388
|
-
code: data?.code || "API_ERROR",
|
|
389
|
-
statusCode: status,
|
|
390
|
-
service: this.serviceName,
|
|
391
|
-
endpoint,
|
|
392
|
-
requestId: data?.requestId
|
|
393
|
-
});
|
|
413
|
+
/**
|
|
414
|
+
* The one status-to-error switch, shared by typed methods and `call()`.
|
|
415
|
+
*
|
|
416
|
+
* @ensures 400 → ValidationError, 401 → AuthenticationError, 404 → NotFoundError,
|
|
417
|
+
* 429 → RateLimitError, any other status → AugurError (the class follows the status alone)
|
|
418
|
+
* @ensures thrown.endpoint = endpoint (callers pass the path template, so no param values leak)
|
|
419
|
+
*/
|
|
420
|
+
handleHttpError(status, data, endpoint) {
|
|
421
|
+
const ctx = { service: this.serviceName, endpoint };
|
|
422
|
+
const specific = STATUS_ERRORS[status];
|
|
423
|
+
if (specific) {
|
|
424
|
+
throw specific(data.message, ctx);
|
|
394
425
|
}
|
|
426
|
+
throw new AugurError({
|
|
427
|
+
message: data.message ?? `Request failed with status ${status}`,
|
|
428
|
+
code: data.code || "API_ERROR",
|
|
429
|
+
statusCode: status,
|
|
430
|
+
...ctx,
|
|
431
|
+
requestId: data.requestId
|
|
432
|
+
});
|
|
395
433
|
}
|
|
396
434
|
/**
|
|
397
435
|
* Re-throw known error types or wrap as network error
|
|
@@ -522,6 +560,61 @@ var HTTPClient = class {
|
|
|
522
560
|
config
|
|
523
561
|
});
|
|
524
562
|
}
|
|
563
|
+
/**
|
|
564
|
+
* Send a request and return the 2xx response as text, with no schema
|
|
565
|
+
* validation and no JSON assumption. Non-2xx responses throw through the same
|
|
566
|
+
* status switch as the typed methods. GET retries like `get()` (without its
|
|
567
|
+
* in-flight deduplication); other methods make one attempt, like `post()`.
|
|
568
|
+
*/
|
|
569
|
+
async raw(method, url, options = {}) {
|
|
570
|
+
const send = () => this.request(
|
|
571
|
+
method,
|
|
572
|
+
url,
|
|
573
|
+
{ ...options, params: this.transformEdgeCacheParams(options.params) },
|
|
574
|
+
(response, augurConfig) => this.readRaw(response, augurConfig)
|
|
575
|
+
);
|
|
576
|
+
return method === "GET" ? this.executeWithRetry(send) : send();
|
|
577
|
+
}
|
|
578
|
+
};
|
|
579
|
+
|
|
580
|
+
// src/core/path-validation.ts
|
|
581
|
+
var normalise = (name) => name.replace(/[-_]/g, "").toLowerCase();
|
|
582
|
+
var NUMERIC_EXACT = /* @__PURE__ */ new Set(["id", "linenumber"]);
|
|
583
|
+
var NUMERIC_SUFFIX_RE = /(?:id|uid|no|num|number)$/;
|
|
584
|
+
var STRING_OVERRIDES = /* @__PURE__ */ new Set([
|
|
585
|
+
"siteid",
|
|
586
|
+
"pono",
|
|
587
|
+
"importuid",
|
|
588
|
+
"scheduledimportmasteruid",
|
|
589
|
+
"grantid",
|
|
590
|
+
"salesrepid"
|
|
591
|
+
]);
|
|
592
|
+
var isNumericPlaceholder = (placeholder) => {
|
|
593
|
+
const normalised = normalise(placeholder);
|
|
594
|
+
if (STRING_OVERRIDES.has(normalised)) return false;
|
|
595
|
+
if (NUMERIC_EXACT.has(normalised)) return true;
|
|
596
|
+
return NUMERIC_SUFFIX_RE.test(normalised);
|
|
597
|
+
};
|
|
598
|
+
var INTEGER_RE = /^-?\d+$/;
|
|
599
|
+
var PATH_SAFE_RE = /^[A-Za-z0-9\-._~!$&'()*+,;=:@]+$/;
|
|
600
|
+
var pathValueProblem = (placeholder, value) => {
|
|
601
|
+
if (isNumericPlaceholder(placeholder)) {
|
|
602
|
+
return INTEGER_RE.test(value) ? void 0 : "expected an integer";
|
|
603
|
+
}
|
|
604
|
+
if (value === "") {
|
|
605
|
+
return "expected a non-empty string";
|
|
606
|
+
}
|
|
607
|
+
return PATH_SAFE_RE.test(value) ? void 0 : "contains characters a URL path can't carry";
|
|
608
|
+
};
|
|
609
|
+
var validatePathSegment = (pathTemplate, placeholder, value, service = "http-client") => {
|
|
610
|
+
const problem = pathValueProblem(placeholder, value);
|
|
611
|
+
if (problem !== void 0) {
|
|
612
|
+
throw new InvalidArgumentError({
|
|
613
|
+
message: `Invalid path parameter '${placeholder}': ${problem}`,
|
|
614
|
+
service,
|
|
615
|
+
endpoint: pathTemplate
|
|
616
|
+
});
|
|
617
|
+
}
|
|
525
618
|
};
|
|
526
619
|
|
|
527
620
|
// src/services/agr-info/generated/schemas.ts
|
|
@@ -529,8 +622,10 @@ var v2 = __toESM(require("valibot"));
|
|
|
529
622
|
|
|
530
623
|
// src/core/schemas.ts
|
|
531
624
|
var v = __toESM(require("valibot"));
|
|
625
|
+
var nodeEnv = () => typeof process === "undefined" ? void 0 : process.env?.NODE_ENV;
|
|
532
626
|
var logNormalizationWarning = (message) => {
|
|
533
|
-
|
|
627
|
+
const env = nodeEnv();
|
|
628
|
+
if (env !== void 0 && env !== "production") {
|
|
534
629
|
console.warn(`[augur-api] Response normalization: ${message}`);
|
|
535
630
|
}
|
|
536
631
|
};
|
|
@@ -3773,6 +3868,7 @@ var CategoriesListDataSchema = v7.array(
|
|
|
3773
3868
|
focusCd: v7.number()
|
|
3774
3869
|
})
|
|
3775
3870
|
);
|
|
3871
|
+
var CategoriesFocusCreateDataSchema = v7.boolean();
|
|
3776
3872
|
var CategoriesGetDataSchema = v7.looseObject({
|
|
3777
3873
|
itemCategoryUid: v7.number(),
|
|
3778
3874
|
itemCategoryId: v7.string(),
|
|
@@ -3823,8 +3919,8 @@ var endpoints7 = [
|
|
|
3823
3919
|
pathParams: [],
|
|
3824
3920
|
queryParams: [],
|
|
3825
3921
|
edgeCache: false,
|
|
3826
|
-
responseSchema:
|
|
3827
|
-
responseType: "
|
|
3922
|
+
responseSchema: CategoriesFocusCreateDataSchema,
|
|
3923
|
+
responseType: "scalar"
|
|
3828
3924
|
},
|
|
3829
3925
|
{
|
|
3830
3926
|
method: "GET",
|
|
@@ -8697,6 +8793,7 @@ var ItemSearchListParamsSchema = v15.looseObject({
|
|
|
8697
8793
|
sourceFieldsList: v15.optional(v15.string()),
|
|
8698
8794
|
stockStatus: v15.optional(v15.string()),
|
|
8699
8795
|
tags: v15.optional(v15.string()),
|
|
8796
|
+
useBrandFolderDoc: v15.optional(v15.string()),
|
|
8700
8797
|
variantFilter: v15.optional(v15.string())
|
|
8701
8798
|
});
|
|
8702
8799
|
var ItemSearchFacetsListParamsSchema = v15.looseObject({
|
|
@@ -8723,11 +8820,16 @@ var ItemSearchFacetsListParamsSchema = v15.looseObject({
|
|
|
8723
8820
|
});
|
|
8724
8821
|
var ItemSearchAttributesListParamsSchema = v15.looseObject({
|
|
8725
8822
|
...EdgeCacheParamsSchema.entries,
|
|
8726
|
-
|
|
8727
|
-
|
|
8823
|
+
classId5List: v15.optional(v15.string()),
|
|
8824
|
+
fields: v15.optional(v15.string()),
|
|
8728
8825
|
filters: v15.optional(v15.string()),
|
|
8826
|
+
from: v15.optional(v15.pipe(v15.unknown(), v15.transform(Number))),
|
|
8827
|
+
operator: v15.optional(v15.string()),
|
|
8729
8828
|
q: v15.string(),
|
|
8730
|
-
searchType: v15.string()
|
|
8829
|
+
searchType: v15.string(),
|
|
8830
|
+
size: v15.optional(v15.pipe(v15.unknown(), v15.transform(Number))),
|
|
8831
|
+
sort: v15.optional(v15.string()),
|
|
8832
|
+
sourceFieldsList: v15.optional(v15.string())
|
|
8731
8833
|
});
|
|
8732
8834
|
var ItemsListParamsSchema = v15.looseObject({
|
|
8733
8835
|
...EdgeCacheParamsSchema.entries,
|
|
@@ -8735,6 +8837,7 @@ var ItemsListParamsSchema = v15.looseObject({
|
|
|
8735
8837
|
limit: v15.optional(v15.pipe(v15.unknown(), v15.transform(Number))),
|
|
8736
8838
|
offset: v15.optional(v15.pipe(v15.unknown(), v15.transform(Number))),
|
|
8737
8839
|
online: v15.optional(v15.string()),
|
|
8840
|
+
orderBy: v15.optional(v15.string()),
|
|
8738
8841
|
statusCd: v15.optional(v15.pipe(v15.unknown(), v15.transform(Number)))
|
|
8739
8842
|
});
|
|
8740
8843
|
var QueryStringRedirectListParamsSchema = v15.looseObject({
|
|
@@ -8759,6 +8862,69 @@ var SuggestionsSuggestListParamsSchema = v15.looseObject({
|
|
|
8759
8862
|
offset: v15.optional(v15.pipe(v15.unknown(), v15.transform(Number))),
|
|
8760
8863
|
q: v15.optional(v15.string())
|
|
8761
8864
|
});
|
|
8865
|
+
var ItemSearchAttributesListDataSchema = v15.looseObject({
|
|
8866
|
+
attributes: v15.array(
|
|
8867
|
+
v15.looseObject({
|
|
8868
|
+
attributeUid: v15.number(),
|
|
8869
|
+
attributeId: v15.string(),
|
|
8870
|
+
attributeDesc: v15.nullable(v15.string()),
|
|
8871
|
+
sequenceNo: v15.nullable(v15.number()),
|
|
8872
|
+
values: v15.array(
|
|
8873
|
+
v15.looseObject({
|
|
8874
|
+
attributeValueUid: v15.number(),
|
|
8875
|
+
attributeValue: v15.string(),
|
|
8876
|
+
sequenceNo: v15.number()
|
|
8877
|
+
})
|
|
8878
|
+
),
|
|
8879
|
+
valueCount: v15.number()
|
|
8880
|
+
})
|
|
8881
|
+
)
|
|
8882
|
+
});
|
|
8883
|
+
var ItemsListDataSchema = v15.array(
|
|
8884
|
+
v15.looseObject({
|
|
8885
|
+
invMastUid: v15.number(),
|
|
8886
|
+
itemId: v15.nullable(v15.string()),
|
|
8887
|
+
online: v15.string(),
|
|
8888
|
+
updateCd: v15.number(),
|
|
8889
|
+
doc: v15.nullable(v15.string()),
|
|
8890
|
+
indexCd: v15.number(),
|
|
8891
|
+
statusCd: v15.number(),
|
|
8892
|
+
processCd: v15.number(),
|
|
8893
|
+
indexStatusCd: v15.number(),
|
|
8894
|
+
dateCreated: v15.string(),
|
|
8895
|
+
dateLastModified: v15.string(),
|
|
8896
|
+
classId5: v15.nullable(v15.string()),
|
|
8897
|
+
dateLastChecked: v15.string(),
|
|
8898
|
+
embeddingCd: v15.number(),
|
|
8899
|
+
docHash: v15.nullable(v15.string()),
|
|
8900
|
+
indexHash: v15.nullable(v15.string()),
|
|
8901
|
+
location: v15.nullable(v15.string()),
|
|
8902
|
+
uuid: v15.nullable(v15.string())
|
|
8903
|
+
})
|
|
8904
|
+
);
|
|
8905
|
+
var ItemsRefreshUpdateDataSchema = v15.boolean();
|
|
8906
|
+
var ItemsGetDataSchema = v15.looseObject({
|
|
8907
|
+
invMastUid: v15.number(),
|
|
8908
|
+
itemId: v15.nullable(v15.string()),
|
|
8909
|
+
online: v15.string(),
|
|
8910
|
+
updateCd: v15.number(),
|
|
8911
|
+
doc: v15.nullable(v15.string()),
|
|
8912
|
+
indexCd: v15.number(),
|
|
8913
|
+
statusCd: v15.number(),
|
|
8914
|
+
processCd: v15.number(),
|
|
8915
|
+
indexStatusCd: v15.number(),
|
|
8916
|
+
dateCreated: v15.string(),
|
|
8917
|
+
dateLastModified: v15.string(),
|
|
8918
|
+
classId5: v15.nullable(v15.string()),
|
|
8919
|
+
dateLastChecked: v15.string(),
|
|
8920
|
+
embeddingCd: v15.number(),
|
|
8921
|
+
docHash: v15.nullable(v15.string()),
|
|
8922
|
+
indexHash: v15.nullable(v15.string()),
|
|
8923
|
+
location: v15.nullable(v15.string()),
|
|
8924
|
+
uuid: v15.nullable(v15.string())
|
|
8925
|
+
});
|
|
8926
|
+
var ItemsUpdateDataSchema = ItemsGetDataSchema;
|
|
8927
|
+
var ItemsRefreshGetDataSchema = ItemsGetDataSchema;
|
|
8762
8928
|
var QueryStringRedirectListDataSchema = v15.array(
|
|
8763
8929
|
v15.looseObject({
|
|
8764
8930
|
queryStringRedirectUid: v15.number(),
|
|
@@ -8800,6 +8966,21 @@ var SuggestionsListDataSchema = v15.array(
|
|
|
8800
8966
|
processCd: v15.number()
|
|
8801
8967
|
})
|
|
8802
8968
|
);
|
|
8969
|
+
var SuggestionsSuggestListDataSchema = v15.array(
|
|
8970
|
+
v15.looseObject({
|
|
8971
|
+
suggestionsUid: v15.number(),
|
|
8972
|
+
queryStringUid: v15.number(),
|
|
8973
|
+
suggestionsString: v15.string(),
|
|
8974
|
+
suggestionsMetaphone: v15.nullable(v15.string()),
|
|
8975
|
+
avgTotalResults: v15.number(),
|
|
8976
|
+
dateCreated: v15.string(),
|
|
8977
|
+
dateLastModified: v15.string(),
|
|
8978
|
+
updateCd: v15.number(),
|
|
8979
|
+
statusCd: v15.number(),
|
|
8980
|
+
processCd: v15.number(),
|
|
8981
|
+
score: v15.number()
|
|
8982
|
+
})
|
|
8983
|
+
);
|
|
8803
8984
|
var SuggestionsGetDataSchema = v15.looseObject({
|
|
8804
8985
|
suggestionsUid: v15.number(),
|
|
8805
8986
|
queryStringUid: v15.number(),
|
|
@@ -8841,6 +9022,7 @@ var endpoints15 = [
|
|
|
8841
9022
|
"sourceFieldsList",
|
|
8842
9023
|
"stockStatus",
|
|
8843
9024
|
"tags",
|
|
9025
|
+
"useBrandFolderDoc",
|
|
8844
9026
|
"variantFilter"
|
|
8845
9027
|
],
|
|
8846
9028
|
edgeCache: true,
|
|
@@ -8886,10 +9068,21 @@ var endpoints15 = [
|
|
|
8886
9068
|
action: "list",
|
|
8887
9069
|
aliases: [],
|
|
8888
9070
|
pathParams: [],
|
|
8889
|
-
queryParams: [
|
|
9071
|
+
queryParams: [
|
|
9072
|
+
"classId5List",
|
|
9073
|
+
"fields",
|
|
9074
|
+
"filters",
|
|
9075
|
+
"from",
|
|
9076
|
+
"operator",
|
|
9077
|
+
"q",
|
|
9078
|
+
"searchType",
|
|
9079
|
+
"size",
|
|
9080
|
+
"sort",
|
|
9081
|
+
"sourceFieldsList"
|
|
9082
|
+
],
|
|
8890
9083
|
edgeCache: true,
|
|
8891
|
-
responseSchema:
|
|
8892
|
-
responseType: "
|
|
9084
|
+
responseSchema: ItemSearchAttributesListDataSchema,
|
|
9085
|
+
responseType: "object"
|
|
8893
9086
|
},
|
|
8894
9087
|
{
|
|
8895
9088
|
method: "GET",
|
|
@@ -8898,10 +9091,10 @@ var endpoints15 = [
|
|
|
8898
9091
|
action: "list",
|
|
8899
9092
|
aliases: [],
|
|
8900
9093
|
pathParams: [],
|
|
8901
|
-
queryParams: ["itemId", "limit", "offset", "online", "statusCd"],
|
|
9094
|
+
queryParams: ["itemId", "limit", "offset", "online", "orderBy", "statusCd"],
|
|
8902
9095
|
edgeCache: true,
|
|
8903
|
-
responseSchema:
|
|
8904
|
-
responseType: "
|
|
9096
|
+
responseSchema: ItemsListDataSchema,
|
|
9097
|
+
responseType: "array"
|
|
8905
9098
|
},
|
|
8906
9099
|
{
|
|
8907
9100
|
method: "PUT",
|
|
@@ -8912,8 +9105,8 @@ var endpoints15 = [
|
|
|
8912
9105
|
pathParams: [],
|
|
8913
9106
|
queryParams: [],
|
|
8914
9107
|
edgeCache: false,
|
|
8915
|
-
responseSchema:
|
|
8916
|
-
responseType: "
|
|
9108
|
+
responseSchema: ItemsRefreshUpdateDataSchema,
|
|
9109
|
+
responseType: "scalar"
|
|
8917
9110
|
},
|
|
8918
9111
|
{
|
|
8919
9112
|
method: "GET",
|
|
@@ -8924,8 +9117,8 @@ var endpoints15 = [
|
|
|
8924
9117
|
pathParams: ["invMastUid"],
|
|
8925
9118
|
queryParams: [],
|
|
8926
9119
|
edgeCache: true,
|
|
8927
|
-
responseSchema:
|
|
8928
|
-
responseType: "
|
|
9120
|
+
responseSchema: ItemsGetDataSchema,
|
|
9121
|
+
responseType: "object"
|
|
8929
9122
|
},
|
|
8930
9123
|
{
|
|
8931
9124
|
method: "PUT",
|
|
@@ -8936,8 +9129,8 @@ var endpoints15 = [
|
|
|
8936
9129
|
pathParams: ["invMastUid"],
|
|
8937
9130
|
queryParams: [],
|
|
8938
9131
|
edgeCache: false,
|
|
8939
|
-
responseSchema:
|
|
8940
|
-
responseType: "
|
|
9132
|
+
responseSchema: ItemsUpdateDataSchema,
|
|
9133
|
+
responseType: "object"
|
|
8941
9134
|
},
|
|
8942
9135
|
{
|
|
8943
9136
|
method: "GET",
|
|
@@ -8948,8 +9141,8 @@ var endpoints15 = [
|
|
|
8948
9141
|
pathParams: ["invMastUid"],
|
|
8949
9142
|
queryParams: [],
|
|
8950
9143
|
edgeCache: true,
|
|
8951
|
-
responseSchema:
|
|
8952
|
-
responseType: "
|
|
9144
|
+
responseSchema: ItemsRefreshGetDataSchema,
|
|
9145
|
+
responseType: "object"
|
|
8953
9146
|
},
|
|
8954
9147
|
{
|
|
8955
9148
|
method: "GET",
|
|
@@ -9032,8 +9225,8 @@ var endpoints15 = [
|
|
|
9032
9225
|
pathParams: [],
|
|
9033
9226
|
queryParams: ["limit", "offset", "q"],
|
|
9034
9227
|
edgeCache: true,
|
|
9035
|
-
responseSchema:
|
|
9036
|
-
responseType: "
|
|
9228
|
+
responseSchema: SuggestionsSuggestListDataSchema,
|
|
9229
|
+
responseType: "array"
|
|
9037
9230
|
},
|
|
9038
9231
|
{
|
|
9039
9232
|
method: "GET",
|
|
@@ -13643,52 +13836,100 @@ function registryEntries() {
|
|
|
13643
13836
|
cache ?? (cache = build());
|
|
13644
13837
|
return [...cache];
|
|
13645
13838
|
}
|
|
13839
|
+
var index;
|
|
13840
|
+
function buildIndex() {
|
|
13841
|
+
const map = /* @__PURE__ */ new Map();
|
|
13842
|
+
for (const entry of registryEntries()) {
|
|
13843
|
+
map.set(entry.id, entry);
|
|
13844
|
+
const chain = entry.id.slice(0, entry.id.lastIndexOf("."));
|
|
13845
|
+
for (const alias of entry.aliases) {
|
|
13846
|
+
map.set(`${chain}.${alias}`, entry);
|
|
13847
|
+
}
|
|
13848
|
+
}
|
|
13849
|
+
return map;
|
|
13850
|
+
}
|
|
13851
|
+
function resolveEndpoint(id) {
|
|
13852
|
+
index ?? (index = buildIndex());
|
|
13853
|
+
return index.get(id);
|
|
13854
|
+
}
|
|
13855
|
+
|
|
13856
|
+
// src/core/call.ts
|
|
13857
|
+
var ENVELOPE_KEYS = [
|
|
13858
|
+
"count",
|
|
13859
|
+
"data",
|
|
13860
|
+
"message",
|
|
13861
|
+
"options",
|
|
13862
|
+
"params",
|
|
13863
|
+
"status",
|
|
13864
|
+
"total",
|
|
13865
|
+
"totalResults"
|
|
13866
|
+
];
|
|
13867
|
+
var EDGE_CACHE_KEY = "edgeCache";
|
|
13868
|
+
function invalid(message, entry) {
|
|
13869
|
+
return new InvalidArgumentError({
|
|
13870
|
+
message,
|
|
13871
|
+
service: entry?.service ?? "",
|
|
13872
|
+
endpoint: entry?.path ?? ""
|
|
13873
|
+
});
|
|
13874
|
+
}
|
|
13875
|
+
function rejectUnknown(entry, kind, keys, allowed) {
|
|
13876
|
+
const unknown28 = keys.filter((key) => !allowed.includes(key));
|
|
13877
|
+
if (unknown28.length > 0) {
|
|
13878
|
+
throw invalid(`Unknown ${kind} for ${entry.id}: ${unknown28.join(", ")}`, entry);
|
|
13879
|
+
}
|
|
13880
|
+
}
|
|
13881
|
+
function checkArgs(entry, args) {
|
|
13882
|
+
const pathKeys = Object.keys(args.pathParams ?? {});
|
|
13883
|
+
const missing = entry.pathParams.filter((name) => !pathKeys.includes(name));
|
|
13884
|
+
if (missing.length > 0) {
|
|
13885
|
+
throw invalid(`Missing path params for ${entry.id}: ${missing.join(", ")}`, entry);
|
|
13886
|
+
}
|
|
13887
|
+
rejectUnknown(entry, "path params", pathKeys, entry.pathParams);
|
|
13888
|
+
const queryAllowed = entry.edgeCache ? [...entry.queryParams, EDGE_CACHE_KEY] : entry.queryParams;
|
|
13889
|
+
rejectUnknown(entry, "query params", Object.keys(args.query ?? {}), queryAllowed);
|
|
13890
|
+
if (args.body !== void 0 && args.body !== null && !entry.hasBody) {
|
|
13891
|
+
throw invalid(`${entry.id} takes no body`, entry);
|
|
13892
|
+
}
|
|
13893
|
+
}
|
|
13894
|
+
function fillPath(entry, pathParams) {
|
|
13895
|
+
return entry.path.replace(/\{([^}]+)\}/g, (_, name) => {
|
|
13896
|
+
const value = String(pathParams[name]);
|
|
13897
|
+
validatePathSegment(entry.path, name, value, entry.service);
|
|
13898
|
+
return value;
|
|
13899
|
+
});
|
|
13900
|
+
}
|
|
13901
|
+
function toEnvelope(body) {
|
|
13902
|
+
if (typeof body !== "object" || body === null || Array.isArray(body)) {
|
|
13903
|
+
return null;
|
|
13904
|
+
}
|
|
13905
|
+
const record27 = body;
|
|
13906
|
+
if (!ENVELOPE_KEYS.every((key) => key in record27)) {
|
|
13907
|
+
return null;
|
|
13908
|
+
}
|
|
13909
|
+
return Object.fromEntries(ENVELOPE_KEYS.map((key) => [key, record27[key]]));
|
|
13910
|
+
}
|
|
13911
|
+
async function callEndpoint(config, id, args = {}) {
|
|
13912
|
+
const entry = resolveEndpoint(id);
|
|
13913
|
+
if (!entry) {
|
|
13914
|
+
throw invalid(`Unknown endpoint id: ${id}`);
|
|
13915
|
+
}
|
|
13916
|
+
checkArgs(entry, args);
|
|
13917
|
+
const url = `https://${entry.service}.augur-api.com${fillPath(entry, args.pathParams ?? {})}`;
|
|
13918
|
+
const raw = await new HTTPClient(entry.service, config).raw(entry.method, url, {
|
|
13919
|
+
params: args.query,
|
|
13920
|
+
data: args.body ?? void 0,
|
|
13921
|
+
config: { endpoint: entry.path }
|
|
13922
|
+
});
|
|
13923
|
+
const parsed = parseJson(raw.text);
|
|
13924
|
+
const body = parsed.json ? parsed.value : raw.text;
|
|
13925
|
+
return { httpStatus: raw.status, envelope: toEnvelope(body), body };
|
|
13926
|
+
}
|
|
13646
13927
|
|
|
13647
13928
|
// src/core/common-schemas.ts
|
|
13648
13929
|
var CommonHealthCheckResponseSchema = BaseResponseSchema(HealthCheckDataSchema);
|
|
13649
13930
|
var CommonPingResponseSchema = BaseResponseSchema(PingDataSchema);
|
|
13650
13931
|
var CommonWhoamiResponseSchema = BaseResponseSchema(WhoamiDataSchema);
|
|
13651
13932
|
|
|
13652
|
-
// src/core/path-validation.ts
|
|
13653
|
-
var normalise = (name) => name.replace(/[-_]/g, "").toLowerCase();
|
|
13654
|
-
var NUMERIC_EXACT = /* @__PURE__ */ new Set(["id", "linenumber"]);
|
|
13655
|
-
var NUMERIC_SUFFIX_RE = /(?:id|uid|no|num|number)$/;
|
|
13656
|
-
var STRING_OVERRIDES = /* @__PURE__ */ new Set([
|
|
13657
|
-
"siteid",
|
|
13658
|
-
"pono",
|
|
13659
|
-
"importuid",
|
|
13660
|
-
"scheduledimportmasteruid",
|
|
13661
|
-
"grantid",
|
|
13662
|
-
"salesrepid"
|
|
13663
|
-
]);
|
|
13664
|
-
var isNumericPlaceholder = (placeholder) => {
|
|
13665
|
-
const normalised = normalise(placeholder);
|
|
13666
|
-
if (STRING_OVERRIDES.has(normalised)) return false;
|
|
13667
|
-
if (NUMERIC_EXACT.has(normalised)) return true;
|
|
13668
|
-
return NUMERIC_SUFFIX_RE.test(normalised);
|
|
13669
|
-
};
|
|
13670
|
-
var INTEGER_RE = /^-?\d+$/;
|
|
13671
|
-
var validatePathSegment = (pathTemplate, placeholder, value) => {
|
|
13672
|
-
const isNumeric = isNumericPlaceholder(placeholder);
|
|
13673
|
-
if (isNumeric) {
|
|
13674
|
-
if (!INTEGER_RE.test(value)) {
|
|
13675
|
-
throw new InvalidArgumentError({
|
|
13676
|
-
message: `Invalid path parameter '${placeholder}': expected an integer, received ${JSON.stringify(value)}`,
|
|
13677
|
-
service: "http-client",
|
|
13678
|
-
endpoint: pathTemplate
|
|
13679
|
-
});
|
|
13680
|
-
}
|
|
13681
|
-
return;
|
|
13682
|
-
}
|
|
13683
|
-
if (value === "") {
|
|
13684
|
-
throw new InvalidArgumentError({
|
|
13685
|
-
message: `Invalid path parameter '${placeholder}': expected a non-empty string, received ${JSON.stringify(value)}`,
|
|
13686
|
-
service: "http-client",
|
|
13687
|
-
endpoint: pathTemplate
|
|
13688
|
-
});
|
|
13689
|
-
}
|
|
13690
|
-
};
|
|
13691
|
-
|
|
13692
13933
|
// src/core/base-client.ts
|
|
13693
13934
|
var v27 = __toESM(require("valibot"));
|
|
13694
13935
|
function toDiscoveryEndpoint(entry) {
|
|
@@ -13768,7 +14009,7 @@ var BaseServiceClient = class {
|
|
|
13768
14009
|
return validatedResponse;
|
|
13769
14010
|
} catch (error) {
|
|
13770
14011
|
if (error instanceof v27.ValiError) {
|
|
13771
|
-
throw this.createValidationError(error, config,
|
|
14012
|
+
throw this.createValidationError(error, config, "response");
|
|
13772
14013
|
}
|
|
13773
14014
|
throw error;
|
|
13774
14015
|
}
|
|
@@ -13788,7 +14029,7 @@ var BaseServiceClient = class {
|
|
|
13788
14029
|
return v27.parse(config.paramsSchema, params ?? {});
|
|
13789
14030
|
} catch (error) {
|
|
13790
14031
|
if (error instanceof v27.ValiError) {
|
|
13791
|
-
throw this.createValidationError(error, config,
|
|
14032
|
+
throw this.createValidationError(error, config, "params");
|
|
13792
14033
|
}
|
|
13793
14034
|
throw error;
|
|
13794
14035
|
}
|
|
@@ -13805,48 +14046,33 @@ var BaseServiceClient = class {
|
|
|
13805
14046
|
*/
|
|
13806
14047
|
async executeHttpRequest(config, endpoint, validatedParams, query) {
|
|
13807
14048
|
const url = `${this.baseUrl}${endpoint}`;
|
|
13808
|
-
const
|
|
14049
|
+
const requestConfig = { endpoint: config.path };
|
|
13809
14050
|
switch (config.method) {
|
|
13810
14051
|
case "GET":
|
|
13811
|
-
return await this.http.get(url, validatedParams);
|
|
14052
|
+
return await this.http.get(url, validatedParams, requestConfig);
|
|
13812
14053
|
case "POST":
|
|
13813
|
-
return await this.http.post(url, validatedParams,
|
|
14054
|
+
return await this.http.post(url, validatedParams, query, requestConfig);
|
|
13814
14055
|
case "PUT":
|
|
13815
|
-
return await this.http.put(url, validatedParams,
|
|
14056
|
+
return await this.http.put(url, validatedParams, query, requestConfig);
|
|
13816
14057
|
case "DELETE":
|
|
13817
|
-
return await this.http.delete(url,
|
|
14058
|
+
return await this.http.delete(url, query, requestConfig);
|
|
13818
14059
|
default:
|
|
13819
14060
|
throw new Error(`Unsupported HTTP method: ${config.method}`);
|
|
13820
14061
|
}
|
|
13821
14062
|
}
|
|
13822
14063
|
/**
|
|
13823
|
-
* Create a
|
|
14064
|
+
* Create a validation error for invalid params or an unexpected response.
|
|
14065
|
+
*
|
|
14066
|
+
* @ensures result.endpoint = config.path (the template; the filled path can hold param values)
|
|
14067
|
+
* @ensures result.message holds no param values (issues name fields; valibot issue messages
|
|
14068
|
+
* describe the expected type, and `received` is not copied)
|
|
13824
14069
|
*/
|
|
13825
|
-
createValidationError(valibotError, config,
|
|
13826
|
-
|
|
13827
|
-
|
|
13828
|
-
if (errorType === "params") {
|
|
13829
|
-
message = "Invalid request parameters";
|
|
13830
|
-
contextInfo = `
|
|
13831
|
-
Provided parameters: ${JSON.stringify(params, null, 2)}`;
|
|
13832
|
-
} else if (errorType === "response") {
|
|
13833
|
-
message = "Invalid API response structure";
|
|
13834
|
-
contextInfo = "\nThis appears to be a response validation error. The API returned data in an unexpected format during API refactoring.";
|
|
13835
|
-
} else {
|
|
13836
|
-
const hasParamSchema = !!config.paramsSchema;
|
|
13837
|
-
if (hasParamSchema && params !== void 0) {
|
|
13838
|
-
message = "Invalid request parameters";
|
|
13839
|
-
contextInfo = `
|
|
13840
|
-
Provided parameters: ${JSON.stringify(params, null, 2)}`;
|
|
13841
|
-
} else if (!hasParamSchema) {
|
|
13842
|
-
message = "Invalid API response structure";
|
|
13843
|
-
contextInfo = "\nThis appears to be a response validation error. The API returned data in an unexpected format.";
|
|
13844
|
-
}
|
|
13845
|
-
}
|
|
13846
|
-
const validationError = new ValidationError({
|
|
14070
|
+
createValidationError(valibotError, config, errorType) {
|
|
14071
|
+
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.";
|
|
14072
|
+
return new ValidationError({
|
|
13847
14073
|
message,
|
|
13848
14074
|
service: this.serviceName,
|
|
13849
|
-
endpoint,
|
|
14075
|
+
endpoint: config.path,
|
|
13850
14076
|
validationErrors: valibotError.issues.map((issue) => ({
|
|
13851
14077
|
path: (issue.path ?? []).map((segment) => segment.key),
|
|
13852
14078
|
message: issue.message,
|
|
@@ -13854,10 +14080,6 @@ Provided parameters: ${JSON.stringify(params, null, 2)}`;
|
|
|
13854
14080
|
code: issue.type ?? "unknown"
|
|
13855
14081
|
}))
|
|
13856
14082
|
});
|
|
13857
|
-
if (contextInfo) {
|
|
13858
|
-
validationError.message += contextInfo;
|
|
13859
|
-
}
|
|
13860
|
-
return validationError;
|
|
13861
14083
|
}
|
|
13862
14084
|
/**
|
|
13863
14085
|
* Build endpoint path with optional path parameter substitution
|
|
@@ -13881,13 +14103,13 @@ Provided parameters: ${JSON.stringify(params, null, 2)}`;
|
|
|
13881
14103
|
for (const [key, value] of Object.entries(pathParams)) {
|
|
13882
14104
|
const stringValue = String(value);
|
|
13883
14105
|
if (path.includes(`{${key}}`)) {
|
|
13884
|
-
validatePathSegment(pathTemplate, key, stringValue);
|
|
14106
|
+
validatePathSegment(pathTemplate, key, stringValue, this.serviceName);
|
|
13885
14107
|
path = path.replace(`{${key}}`, stringValue);
|
|
13886
14108
|
} else {
|
|
13887
14109
|
const normKey = normalise2(key);
|
|
13888
14110
|
path = path.replace(/\{([^}]+)\}/g, (match, placeholder) => {
|
|
13889
14111
|
if (normalise2(placeholder) === normKey) {
|
|
13890
|
-
validatePathSegment(pathTemplate, placeholder, stringValue);
|
|
14112
|
+
validatePathSegment(pathTemplate, placeholder, stringValue, this.serviceName);
|
|
13891
14113
|
return stringValue;
|
|
13892
14114
|
}
|
|
13893
14115
|
return match;
|
|
@@ -13968,15 +14190,15 @@ function createNodeObject(serviceName, executeRequest, node) {
|
|
|
13968
14190
|
}
|
|
13969
14191
|
function splitPathArgs(pathParams, args) {
|
|
13970
14192
|
const pathParamMap = {};
|
|
13971
|
-
let
|
|
14193
|
+
let index2 = 0;
|
|
13972
14194
|
for (const name of pathParams) {
|
|
13973
|
-
if (
|
|
14195
|
+
if (index2 >= args.length) {
|
|
13974
14196
|
break;
|
|
13975
14197
|
}
|
|
13976
|
-
pathParamMap[name] = String(args[
|
|
13977
|
-
|
|
14198
|
+
pathParamMap[name] = String(args[index2]);
|
|
14199
|
+
index2++;
|
|
13978
14200
|
}
|
|
13979
|
-
return { pathParamMap, rest: args.slice(
|
|
14201
|
+
return { pathParamMap, rest: args.slice(index2) };
|
|
13980
14202
|
}
|
|
13981
14203
|
function splitBodyAndQuery(method, rest) {
|
|
13982
14204
|
if (method === "POST" || method === "PUT") {
|
|
@@ -14757,6 +14979,22 @@ var _AugurAPI = class _AugurAPI {
|
|
|
14757
14979
|
static endpoints() {
|
|
14758
14980
|
return registryEntries();
|
|
14759
14981
|
}
|
|
14982
|
+
/**
|
|
14983
|
+
* Call any endpoint by registry id (canonical or alias), with no typed method.
|
|
14984
|
+
*
|
|
14985
|
+
* Arguments are checked against the entry before any request is sent. A 2xx
|
|
14986
|
+
* always resolves, with no schema validation; other statuses throw the same
|
|
14987
|
+
* errors as the typed methods.
|
|
14988
|
+
*
|
|
14989
|
+
* @example
|
|
14990
|
+
* ```typescript
|
|
14991
|
+
* const result = await api.call('items.invMast.doc.get', { pathParams: { invMastUid: 123 } });
|
|
14992
|
+
* result.envelope?.data;
|
|
14993
|
+
* ```
|
|
14994
|
+
*/
|
|
14995
|
+
call(id, args) {
|
|
14996
|
+
return callEndpoint(this.config, id, args);
|
|
14997
|
+
}
|
|
14760
14998
|
/**
|
|
14761
14999
|
* Create AugurAPI client from context object
|
|
14762
15000
|
*
|
|
@@ -15628,7 +15866,7 @@ function createCrossSiteAuthenticator(augurInfoToken) {
|
|
|
15628
15866
|
}
|
|
15629
15867
|
|
|
15630
15868
|
// src/index.ts
|
|
15631
|
-
var VERSION = "2026.9.
|
|
15869
|
+
var VERSION = "2026.9.7";
|
|
15632
15870
|
// Annotate the CommonJS export names for ESM import in node:
|
|
15633
15871
|
0 && (module.exports = {
|
|
15634
15872
|
AgrInfoClient,
|