@simpleapps-com/augur-api 2026.5.5 → 2026.5.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +9 -2
- package/dist/index.d.ts +9 -2
- package/dist/index.js +53 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +52 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -109,6 +109,15 @@ var RateLimitError = class extends AugurError {
|
|
|
109
109
|
});
|
|
110
110
|
}
|
|
111
111
|
};
|
|
112
|
+
var InvalidArgumentError = class extends AugurError {
|
|
113
|
+
constructor(params) {
|
|
114
|
+
super({
|
|
115
|
+
...params,
|
|
116
|
+
code: "INVALID_ARGUMENT",
|
|
117
|
+
statusCode: 400
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
};
|
|
112
121
|
|
|
113
122
|
// src/core/client.ts
|
|
114
123
|
function generateRequestKey(method, url, params) {
|
|
@@ -431,6 +440,39 @@ var HTTPClient = class {
|
|
|
431
440
|
}
|
|
432
441
|
};
|
|
433
442
|
|
|
443
|
+
// src/core/path-validation.ts
|
|
444
|
+
var normalise = (name) => name.replace(/[-_]/g, "").toLowerCase();
|
|
445
|
+
var NUMERIC_EXACT = /* @__PURE__ */ new Set(["id", "linenumber"]);
|
|
446
|
+
var NUMERIC_SUFFIX_RE = /(?:id|uid|no|num|number)$/;
|
|
447
|
+
var STRING_OVERRIDES = /* @__PURE__ */ new Set(["siteid", "pono", "importuid", "scheduledimportmasteruid"]);
|
|
448
|
+
var isNumericPlaceholder = (placeholder) => {
|
|
449
|
+
const normalised = normalise(placeholder);
|
|
450
|
+
if (STRING_OVERRIDES.has(normalised)) return false;
|
|
451
|
+
if (NUMERIC_EXACT.has(normalised)) return true;
|
|
452
|
+
return NUMERIC_SUFFIX_RE.test(normalised);
|
|
453
|
+
};
|
|
454
|
+
var INTEGER_RE = /^-?\d+$/;
|
|
455
|
+
var validatePathSegment = (pathTemplate, placeholder, value) => {
|
|
456
|
+
const isNumeric = isNumericPlaceholder(placeholder);
|
|
457
|
+
if (isNumeric) {
|
|
458
|
+
if (!INTEGER_RE.test(value)) {
|
|
459
|
+
throw new InvalidArgumentError({
|
|
460
|
+
message: `Invalid path parameter '${placeholder}': expected an integer, received ${JSON.stringify(value)}`,
|
|
461
|
+
service: "http-client",
|
|
462
|
+
endpoint: pathTemplate
|
|
463
|
+
});
|
|
464
|
+
}
|
|
465
|
+
return;
|
|
466
|
+
}
|
|
467
|
+
if (value === "") {
|
|
468
|
+
throw new InvalidArgumentError({
|
|
469
|
+
message: `Invalid path parameter '${placeholder}': expected a non-empty string, received ${JSON.stringify(value)}`,
|
|
470
|
+
service: "http-client",
|
|
471
|
+
endpoint: pathTemplate
|
|
472
|
+
});
|
|
473
|
+
}
|
|
474
|
+
};
|
|
475
|
+
|
|
434
476
|
// src/core/schemas.ts
|
|
435
477
|
import * as v from "valibot";
|
|
436
478
|
var logNormalizationWarning = (message) => {
|
|
@@ -978,16 +1020,19 @@ Provided parameters: ${JSON.stringify(params, null, 2)}`;
|
|
|
978
1020
|
if (!pathParams) {
|
|
979
1021
|
return pathTemplate;
|
|
980
1022
|
}
|
|
981
|
-
const
|
|
1023
|
+
const normalise2 = (s) => s.replace(/[-_]/g, "").toLowerCase();
|
|
982
1024
|
let path = pathTemplate;
|
|
983
1025
|
for (const [key, value] of Object.entries(pathParams)) {
|
|
1026
|
+
const stringValue = String(value);
|
|
984
1027
|
if (path.includes(`{${key}}`)) {
|
|
985
|
-
|
|
1028
|
+
validatePathSegment(pathTemplate, key, stringValue);
|
|
1029
|
+
path = path.replace(`{${key}}`, stringValue);
|
|
986
1030
|
} else {
|
|
987
|
-
const normKey =
|
|
1031
|
+
const normKey = normalise2(key);
|
|
988
1032
|
path = path.replace(/\{([^}]+)\}/g, (match, placeholder) => {
|
|
989
|
-
if (
|
|
990
|
-
|
|
1033
|
+
if (normalise2(placeholder) === normKey) {
|
|
1034
|
+
validatePathSegment(pathTemplate, placeholder, stringValue);
|
|
1035
|
+
return stringValue;
|
|
991
1036
|
}
|
|
992
1037
|
return match;
|
|
993
1038
|
});
|
|
@@ -14201,7 +14246,7 @@ function createCrossSiteAuthenticator(augurInfoToken) {
|
|
|
14201
14246
|
}
|
|
14202
14247
|
|
|
14203
14248
|
// src/index.ts
|
|
14204
|
-
var VERSION = "2026.5.
|
|
14249
|
+
var VERSION = "2026.5.6";
|
|
14205
14250
|
export {
|
|
14206
14251
|
AgrInfoClient,
|
|
14207
14252
|
AgrSiteClient,
|
|
@@ -14218,6 +14263,7 @@ export {
|
|
|
14218
14263
|
CustomersClient,
|
|
14219
14264
|
GregorovichClient,
|
|
14220
14265
|
HealthCheckDataSchema,
|
|
14266
|
+
InvalidArgumentError,
|
|
14221
14267
|
ItemsClient,
|
|
14222
14268
|
JoomlaClient,
|
|
14223
14269
|
LegacyClient,
|