@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 CHANGED
@@ -172,7 +172,14 @@ declare class RateLimitError extends AugurError {
172
172
  endpoint: string;
173
173
  });
174
174
  }
175
+ declare class InvalidArgumentError extends AugurError {
176
+ constructor(params: {
177
+ message: string;
178
+ service: string;
179
+ endpoint: string;
180
+ });
181
+ }
175
182
 
176
- declare const VERSION = "2026.5.5";
183
+ declare const VERSION = "2026.5.6";
177
184
 
178
- export { AugurAPI, type AugurAPIError, AugurError, AuthenticationError, type CrossSiteAuthParams, type CrossSiteAuthResult, NotFoundError, RateLimitError, VERSION, ValidationError, authenticateUserForSite, createCrossSiteAuthenticator };
185
+ export { AugurAPI, type AugurAPIError, AugurError, AuthenticationError, type CrossSiteAuthParams, type CrossSiteAuthResult, InvalidArgumentError, NotFoundError, RateLimitError, VERSION, ValidationError, authenticateUserForSite, createCrossSiteAuthenticator };
package/dist/index.d.ts CHANGED
@@ -172,7 +172,14 @@ declare class RateLimitError extends AugurError {
172
172
  endpoint: string;
173
173
  });
174
174
  }
175
+ declare class InvalidArgumentError extends AugurError {
176
+ constructor(params: {
177
+ message: string;
178
+ service: string;
179
+ endpoint: string;
180
+ });
181
+ }
175
182
 
176
- declare const VERSION = "2026.5.5";
183
+ declare const VERSION = "2026.5.6";
177
184
 
178
- export { AugurAPI, type AugurAPIError, AugurError, AuthenticationError, type CrossSiteAuthParams, type CrossSiteAuthResult, NotFoundError, RateLimitError, VERSION, ValidationError, authenticateUserForSite, createCrossSiteAuthenticator };
185
+ export { AugurAPI, type AugurAPIError, AugurError, AuthenticationError, type CrossSiteAuthParams, type CrossSiteAuthResult, InvalidArgumentError, NotFoundError, RateLimitError, VERSION, ValidationError, authenticateUserForSite, createCrossSiteAuthenticator };
package/dist/index.js CHANGED
@@ -45,6 +45,7 @@ __export(index_exports, {
45
45
  CustomersClient: () => CustomersClient,
46
46
  GregorovichClient: () => GregorovichClient,
47
47
  HealthCheckDataSchema: () => HealthCheckDataSchema,
48
+ InvalidArgumentError: () => InvalidArgumentError,
48
49
  ItemsClient: () => ItemsClient,
49
50
  JoomlaClient: () => JoomlaClient,
50
51
  LegacyClient: () => LegacyClient,
@@ -184,6 +185,15 @@ var RateLimitError = class extends AugurError {
184
185
  });
185
186
  }
186
187
  };
188
+ var InvalidArgumentError = class extends AugurError {
189
+ constructor(params) {
190
+ super({
191
+ ...params,
192
+ code: "INVALID_ARGUMENT",
193
+ statusCode: 400
194
+ });
195
+ }
196
+ };
187
197
 
188
198
  // src/core/client.ts
189
199
  function generateRequestKey(method, url, params) {
@@ -506,6 +516,39 @@ var HTTPClient = class {
506
516
  }
507
517
  };
508
518
 
519
+ // src/core/path-validation.ts
520
+ var normalise = (name) => name.replace(/[-_]/g, "").toLowerCase();
521
+ var NUMERIC_EXACT = /* @__PURE__ */ new Set(["id", "linenumber"]);
522
+ var NUMERIC_SUFFIX_RE = /(?:id|uid|no|num|number)$/;
523
+ var STRING_OVERRIDES = /* @__PURE__ */ new Set(["siteid", "pono", "importuid", "scheduledimportmasteruid"]);
524
+ var isNumericPlaceholder = (placeholder) => {
525
+ const normalised = normalise(placeholder);
526
+ if (STRING_OVERRIDES.has(normalised)) return false;
527
+ if (NUMERIC_EXACT.has(normalised)) return true;
528
+ return NUMERIC_SUFFIX_RE.test(normalised);
529
+ };
530
+ var INTEGER_RE = /^-?\d+$/;
531
+ var validatePathSegment = (pathTemplate, placeholder, value) => {
532
+ const isNumeric = isNumericPlaceholder(placeholder);
533
+ if (isNumeric) {
534
+ if (!INTEGER_RE.test(value)) {
535
+ throw new InvalidArgumentError({
536
+ message: `Invalid path parameter '${placeholder}': expected an integer, received ${JSON.stringify(value)}`,
537
+ service: "http-client",
538
+ endpoint: pathTemplate
539
+ });
540
+ }
541
+ return;
542
+ }
543
+ if (value === "") {
544
+ throw new InvalidArgumentError({
545
+ message: `Invalid path parameter '${placeholder}': expected a non-empty string, received ${JSON.stringify(value)}`,
546
+ service: "http-client",
547
+ endpoint: pathTemplate
548
+ });
549
+ }
550
+ };
551
+
509
552
  // src/core/schemas.ts
510
553
  var v = __toESM(require("valibot"));
511
554
  var logNormalizationWarning = (message) => {
@@ -1053,16 +1096,19 @@ Provided parameters: ${JSON.stringify(params, null, 2)}`;
1053
1096
  if (!pathParams) {
1054
1097
  return pathTemplate;
1055
1098
  }
1056
- const normalise = (s) => s.replace(/[-_]/g, "").toLowerCase();
1099
+ const normalise2 = (s) => s.replace(/[-_]/g, "").toLowerCase();
1057
1100
  let path = pathTemplate;
1058
1101
  for (const [key, value] of Object.entries(pathParams)) {
1102
+ const stringValue = String(value);
1059
1103
  if (path.includes(`{${key}}`)) {
1060
- path = path.replace(`{${key}}`, String(value));
1104
+ validatePathSegment(pathTemplate, key, stringValue);
1105
+ path = path.replace(`{${key}}`, stringValue);
1061
1106
  } else {
1062
- const normKey = normalise(key);
1107
+ const normKey = normalise2(key);
1063
1108
  path = path.replace(/\{([^}]+)\}/g, (match, placeholder) => {
1064
- if (normalise(placeholder) === normKey) {
1065
- return String(value);
1109
+ if (normalise2(placeholder) === normKey) {
1110
+ validatePathSegment(pathTemplate, placeholder, stringValue);
1111
+ return stringValue;
1066
1112
  }
1067
1113
  return match;
1068
1114
  });
@@ -14276,7 +14322,7 @@ function createCrossSiteAuthenticator(augurInfoToken) {
14276
14322
  }
14277
14323
 
14278
14324
  // src/index.ts
14279
- var VERSION = "2026.5.5";
14325
+ var VERSION = "2026.5.6";
14280
14326
  // Annotate the CommonJS export names for ESM import in node:
14281
14327
  0 && (module.exports = {
14282
14328
  AgrInfoClient,
@@ -14294,6 +14340,7 @@ var VERSION = "2026.5.5";
14294
14340
  CustomersClient,
14295
14341
  GregorovichClient,
14296
14342
  HealthCheckDataSchema,
14343
+ InvalidArgumentError,
14297
14344
  ItemsClient,
14298
14345
  JoomlaClient,
14299
14346
  LegacyClient,