@simpleapps-com/augur-api 2026.10.16 → 2026.10.17

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 CHANGED
@@ -62,7 +62,7 @@ Each `llms.txt` lists all other available services for discovery.
62
62
  ## Authentication
63
63
 
64
64
  All endpoints require:
65
- - `siteId` - Site identifier
65
+ - `siteId` - Site identifier: lowercase letters, digits, `_` and `-` (the constructor and `setSiteId` throw `InvalidArgumentError` otherwise)
66
66
  - `bearerToken` - Bearer authentication token
67
67
 
68
68
  ```typescript
package/SKILL.md CHANGED
@@ -158,7 +158,7 @@ Every client also inherits `healthCheck`, `ping`, and `whoami` (each with a `…
158
158
 
159
159
  All endpoints require:
160
160
  - `bearerToken` - Bearer authentication token
161
- - `siteId` - Site identifier
161
+ - `siteId` - Site identifier: lowercase letters, digits, `_` and `-` (the constructor and `setSiteId` throw `InvalidArgumentError` otherwise; `isSiteId`, `parseSiteId` and the `SiteId` type are exported)
162
162
 
163
163
  The client handles headers automatically.
164
164
 
@@ -248,13 +248,3 @@ result.envelope?.data; // null envelope means the body isn't the 8-key envelope;
248
248
  - Arguments are checked before any request (`InvalidArgumentError`). A 2xx never fails validation.
249
249
  - Errors: 400 → `ValidationError`, 401 → `AuthenticationError`, 404 → `NotFoundError`, 429 → `RateLimitError`, anything else → `AugurError`. `error.endpoint` is the path template.
250
250
  - Path values are percent-encoded per segment (`D/S` → `D%2FS`; letters, digits and `-._~!$&'()*+,;=:@` stay as they are). Pass raw values, never pre-encoded ones. Only routes whose backend decodes path values find values like `D/S`; elsewhere use the query param.
251
-
252
- ## Key Differences from Python Client
253
-
254
- | Aspect | TypeScript | Python |
255
- |--------|------------|--------|
256
- | Naming | camelCase | snake_case |
257
- | Service: brand-folder | api.brandFolder | api.brand_folder |
258
- | Resource: inv-mast | .invMast | .inv_mast |
259
- | Method: invMastUid | invMastUid | inv_mast_uid |
260
- | Validation | Valibot | Pydantic v2 |
@@ -67,43 +67,6 @@ declare class ContextCreationError extends Error {
67
67
  constructor(message: string, field?: string | undefined);
68
68
  }
69
69
 
70
- /**
71
- * `call()`: reach any registry endpoint by id, with no per-endpoint code.
72
- *
73
- * Arguments are checked against the registry entry before any I/O. The
74
- * response is returned as-is: no schema validation, no JSON assumption, and a
75
- * 2xx never fails. The contract is shared/REGISTRY.md.
76
- */
77
-
78
- /** What `call()` sends. Keys are sent as given; there is no case renaming. */
79
- interface CallArgs {
80
- /** Exactly the entry's `pathParams` */
81
- pathParams?: Record<string, string | number>;
82
- /** A subset of the entry's `queryParams`, plus `edgeCache` where the entry allows it */
83
- query?: Record<string, unknown>;
84
- /** Only for entries with `hasBody` */
85
- body?: unknown;
86
- }
87
- /** The standard 8-key response envelope. Values are passed through unchecked. */
88
- interface Envelope {
89
- count: unknown;
90
- data: unknown;
91
- message: unknown;
92
- options: unknown;
93
- params: unknown;
94
- status: unknown;
95
- total: unknown;
96
- totalResults: unknown;
97
- }
98
- /** A 2xx response. */
99
- interface CallResult {
100
- httpStatus: number;
101
- /** Set when `body` is an object with all 8 envelope keys, otherwise `null` */
102
- envelope: Envelope | null;
103
- /** Parsed JSON, or the raw text when the body isn't JSON (`''` when empty) */
104
- body: unknown;
105
- }
106
-
107
70
  /** One path or query param of an endpoint. */
108
71
  interface EndpointParam {
109
72
  /** Where the value goes */
@@ -140,6 +103,49 @@ interface EndpointEntry {
140
103
  /** Omitted unless set; a read is `readOnly ?? method === 'GET'` */
141
104
  readonly readOnly?: boolean;
142
105
  }
106
+ /**
107
+ * Whether an entry is a read: `readOnly ?? method === 'GET'` (shared/REGISTRY.md → `readOnly` and
108
+ * `isReadOnly`). `readOnly` marks query-style POSTs (searches, lookups, quotes); the generator sets it
109
+ * only on a POST, and then to true. Consumers MUST route reads through this, never through `method`.
110
+ */
111
+ declare function isReadOnly(entry: Pick<EndpointEntry, 'method' | 'readOnly'>): boolean;
112
+
113
+ /**
114
+ * `call()`: reach any registry endpoint by id, with no per-endpoint code.
115
+ *
116
+ * Arguments are checked against the registry entry before any I/O. The
117
+ * response is returned as-is: no schema validation, no JSON assumption, and a
118
+ * 2xx never fails. The contract is shared/REGISTRY.md.
119
+ */
120
+
121
+ /** What `call()` sends. Keys are sent as given; there is no case renaming. */
122
+ interface CallArgs {
123
+ /** Exactly the entry's `pathParams` */
124
+ pathParams?: Record<string, string | number>;
125
+ /** A subset of the entry's `queryParams`, plus `edgeCache` where the entry allows it */
126
+ query?: Record<string, unknown>;
127
+ /** Only for entries with `hasBody` */
128
+ body?: unknown;
129
+ }
130
+ /** The standard 8-key response envelope. Values are passed through unchecked. */
131
+ interface Envelope {
132
+ count: unknown;
133
+ data: unknown;
134
+ message: unknown;
135
+ options: unknown;
136
+ params: unknown;
137
+ status: unknown;
138
+ total: unknown;
139
+ totalResults: unknown;
140
+ }
141
+ /** A 2xx response. */
142
+ interface CallResult {
143
+ httpStatus: number;
144
+ /** Set when `body` is an object with all 8 envelope keys, otherwise `null` */
145
+ envelope: Envelope | null;
146
+ /** Parsed JSON, or the raw text when the body isn't JSON (`''` when empty) */
147
+ body: unknown;
148
+ }
143
149
 
144
150
  /** A response as text, before any JSON parsing (what `call()` builds its result from). */
145
151
  interface RawResponse {
@@ -35613,6 +35619,11 @@ declare class AugurAPI {
35613
35619
  private _basecamp2?;
35614
35620
  /** Endpoint registry contract version (see shared/REGISTRY.md). */
35615
35621
  static readonly registryVersion = 1;
35622
+ /**
35623
+ * @throws InvalidArgumentError when `config.siteId` is not a siteId (`isSiteId`: lowercase
35624
+ * letters, digits, `_` and `-`). The config is copied, so changing the caller's object
35625
+ * afterwards cannot put an empty or malformed one into `x-site-id`; use `setSiteId`.
35626
+ */
35616
35627
  constructor(config: AugurAPIConfig);
35617
35628
  /**
35618
35629
  * Every endpoint the SDK exposes, one language-neutral entry each, sorted by id.
@@ -35775,8 +35786,9 @@ declare class AugurAPI {
35775
35786
  /**
35776
35787
  * Update site ID
35777
35788
  * @param siteId New site ID
35789
+ * @throws InvalidArgumentError when it is not a siteId (see the constructor)
35778
35790
  */
35779
35791
  setSiteId(siteId: string): void;
35780
35792
  }
35781
35793
 
35782
- export { types$5 as $, AugurAPI as A, type BaseResponse$1 as B, type CallArgs as C, type Envelope as D, type EndpointEntry as E, types$9 as F, GoogMcClient as G, GregorovichClient as H, types$8 as I, type HealthCheckData as J, HealthCheckDataSchema as K, ItemsClient as L, types$k as M, JoomlaClient as N, types$p as O, type Known as P, LegacyClient as Q, types$j as R, LogisticsClient as S, types$7 as T, OpenSearchClient as U, types$l as V, OrdersClient as W, types$g as X, P21ApisClient as Y, types$6 as Z, P21CoreClient as _, AgrInfoClient as a, P21PimClient as a0, types$f as a1, P21SismClient as a2, types$4 as a3, PaginationParamsSchema as a4, PaymentsClient as a5, types$e as a6, type PingData as a7, PricingClient as a8, types$n as a9, type RequestConfig as aa, ShippingClient as ab, types$3 as ac, SmartyStreetsClient as ad, types$2 as ae, UPSClient as af, types$1 as ag, VMIClient as ah, types$m as ai, type WhoamiData as aj, WhoamiDataSchema as ak, AgrIntClient as b, types$c as c, AgrSiteClient as d, types$i as e, AgrWorkClient as f, type AugurAPIConfig as g, type AugurContext as h, type AugurRequestConfig as i, type AugurRequestError as j, type AugurResponse as k, AvalaraClient as l, types$b as m, BaseResponseSchema as n, Basecamp2Client as o, types as p, BrandFolderClient as q, types$a as r, type CallResult as s, types$d as t, CommerceClient as u, types$o as v, ContextCreationError as w, CustomersClient as x, types$h as y, type EndpointParam as z };
35794
+ export { types$5 as $, AugurAPI as A, type BaseResponse$1 as B, type CallArgs as C, type Envelope as D, type EndpointEntry as E, types$9 as F, GoogMcClient as G, GregorovichClient as H, types$8 as I, type HealthCheckData as J, HealthCheckDataSchema as K, ItemsClient as L, types$k as M, JoomlaClient as N, types$p as O, type Known as P, LegacyClient as Q, types$j as R, LogisticsClient as S, types$7 as T, OpenSearchClient as U, types$l as V, OrdersClient as W, types$g as X, P21ApisClient as Y, types$6 as Z, P21CoreClient as _, AgrInfoClient as a, P21PimClient as a0, types$f as a1, P21SismClient as a2, types$4 as a3, PaginationParamsSchema as a4, PaymentsClient as a5, types$e as a6, type PingData as a7, PricingClient as a8, types$n as a9, type RequestConfig as aa, ShippingClient as ab, types$3 as ac, SmartyStreetsClient as ad, types$2 as ae, UPSClient as af, types$1 as ag, VMIClient as ah, types$m as ai, type WhoamiData as aj, WhoamiDataSchema as ak, isReadOnly as al, AgrIntClient as b, types$c as c, AgrSiteClient as d, types$i as e, AgrWorkClient as f, type AugurAPIConfig as g, type AugurContext as h, type AugurRequestConfig as i, type AugurRequestError as j, type AugurResponse as k, AvalaraClient as l, types$b as m, BaseResponseSchema as n, Basecamp2Client as o, types as p, BrandFolderClient as q, types$a as r, type CallResult as s, types$d as t, CommerceClient as u, types$o as v, ContextCreationError as w, CustomersClient as x, types$h as y, type EndpointParam as z };
@@ -67,43 +67,6 @@ declare class ContextCreationError extends Error {
67
67
  constructor(message: string, field?: string | undefined);
68
68
  }
69
69
 
70
- /**
71
- * `call()`: reach any registry endpoint by id, with no per-endpoint code.
72
- *
73
- * Arguments are checked against the registry entry before any I/O. The
74
- * response is returned as-is: no schema validation, no JSON assumption, and a
75
- * 2xx never fails. The contract is shared/REGISTRY.md.
76
- */
77
-
78
- /** What `call()` sends. Keys are sent as given; there is no case renaming. */
79
- interface CallArgs {
80
- /** Exactly the entry's `pathParams` */
81
- pathParams?: Record<string, string | number>;
82
- /** A subset of the entry's `queryParams`, plus `edgeCache` where the entry allows it */
83
- query?: Record<string, unknown>;
84
- /** Only for entries with `hasBody` */
85
- body?: unknown;
86
- }
87
- /** The standard 8-key response envelope. Values are passed through unchecked. */
88
- interface Envelope {
89
- count: unknown;
90
- data: unknown;
91
- message: unknown;
92
- options: unknown;
93
- params: unknown;
94
- status: unknown;
95
- total: unknown;
96
- totalResults: unknown;
97
- }
98
- /** A 2xx response. */
99
- interface CallResult {
100
- httpStatus: number;
101
- /** Set when `body` is an object with all 8 envelope keys, otherwise `null` */
102
- envelope: Envelope | null;
103
- /** Parsed JSON, or the raw text when the body isn't JSON (`''` when empty) */
104
- body: unknown;
105
- }
106
-
107
70
  /** One path or query param of an endpoint. */
108
71
  interface EndpointParam {
109
72
  /** Where the value goes */
@@ -140,6 +103,49 @@ interface EndpointEntry {
140
103
  /** Omitted unless set; a read is `readOnly ?? method === 'GET'` */
141
104
  readonly readOnly?: boolean;
142
105
  }
106
+ /**
107
+ * Whether an entry is a read: `readOnly ?? method === 'GET'` (shared/REGISTRY.md → `readOnly` and
108
+ * `isReadOnly`). `readOnly` marks query-style POSTs (searches, lookups, quotes); the generator sets it
109
+ * only on a POST, and then to true. Consumers MUST route reads through this, never through `method`.
110
+ */
111
+ declare function isReadOnly(entry: Pick<EndpointEntry, 'method' | 'readOnly'>): boolean;
112
+
113
+ /**
114
+ * `call()`: reach any registry endpoint by id, with no per-endpoint code.
115
+ *
116
+ * Arguments are checked against the registry entry before any I/O. The
117
+ * response is returned as-is: no schema validation, no JSON assumption, and a
118
+ * 2xx never fails. The contract is shared/REGISTRY.md.
119
+ */
120
+
121
+ /** What `call()` sends. Keys are sent as given; there is no case renaming. */
122
+ interface CallArgs {
123
+ /** Exactly the entry's `pathParams` */
124
+ pathParams?: Record<string, string | number>;
125
+ /** A subset of the entry's `queryParams`, plus `edgeCache` where the entry allows it */
126
+ query?: Record<string, unknown>;
127
+ /** Only for entries with `hasBody` */
128
+ body?: unknown;
129
+ }
130
+ /** The standard 8-key response envelope. Values are passed through unchecked. */
131
+ interface Envelope {
132
+ count: unknown;
133
+ data: unknown;
134
+ message: unknown;
135
+ options: unknown;
136
+ params: unknown;
137
+ status: unknown;
138
+ total: unknown;
139
+ totalResults: unknown;
140
+ }
141
+ /** A 2xx response. */
142
+ interface CallResult {
143
+ httpStatus: number;
144
+ /** Set when `body` is an object with all 8 envelope keys, otherwise `null` */
145
+ envelope: Envelope | null;
146
+ /** Parsed JSON, or the raw text when the body isn't JSON (`''` when empty) */
147
+ body: unknown;
148
+ }
143
149
 
144
150
  /** A response as text, before any JSON parsing (what `call()` builds its result from). */
145
151
  interface RawResponse {
@@ -35613,6 +35619,11 @@ declare class AugurAPI {
35613
35619
  private _basecamp2?;
35614
35620
  /** Endpoint registry contract version (see shared/REGISTRY.md). */
35615
35621
  static readonly registryVersion = 1;
35622
+ /**
35623
+ * @throws InvalidArgumentError when `config.siteId` is not a siteId (`isSiteId`: lowercase
35624
+ * letters, digits, `_` and `-`). The config is copied, so changing the caller's object
35625
+ * afterwards cannot put an empty or malformed one into `x-site-id`; use `setSiteId`.
35626
+ */
35616
35627
  constructor(config: AugurAPIConfig);
35617
35628
  /**
35618
35629
  * Every endpoint the SDK exposes, one language-neutral entry each, sorted by id.
@@ -35775,8 +35786,9 @@ declare class AugurAPI {
35775
35786
  /**
35776
35787
  * Update site ID
35777
35788
  * @param siteId New site ID
35789
+ * @throws InvalidArgumentError when it is not a siteId (see the constructor)
35778
35790
  */
35779
35791
  setSiteId(siteId: string): void;
35780
35792
  }
35781
35793
 
35782
- export { types$5 as $, AugurAPI as A, type BaseResponse$1 as B, type CallArgs as C, type Envelope as D, type EndpointEntry as E, types$9 as F, GoogMcClient as G, GregorovichClient as H, types$8 as I, type HealthCheckData as J, HealthCheckDataSchema as K, ItemsClient as L, types$k as M, JoomlaClient as N, types$p as O, type Known as P, LegacyClient as Q, types$j as R, LogisticsClient as S, types$7 as T, OpenSearchClient as U, types$l as V, OrdersClient as W, types$g as X, P21ApisClient as Y, types$6 as Z, P21CoreClient as _, AgrInfoClient as a, P21PimClient as a0, types$f as a1, P21SismClient as a2, types$4 as a3, PaginationParamsSchema as a4, PaymentsClient as a5, types$e as a6, type PingData as a7, PricingClient as a8, types$n as a9, type RequestConfig as aa, ShippingClient as ab, types$3 as ac, SmartyStreetsClient as ad, types$2 as ae, UPSClient as af, types$1 as ag, VMIClient as ah, types$m as ai, type WhoamiData as aj, WhoamiDataSchema as ak, AgrIntClient as b, types$c as c, AgrSiteClient as d, types$i as e, AgrWorkClient as f, type AugurAPIConfig as g, type AugurContext as h, type AugurRequestConfig as i, type AugurRequestError as j, type AugurResponse as k, AvalaraClient as l, types$b as m, BaseResponseSchema as n, Basecamp2Client as o, types as p, BrandFolderClient as q, types$a as r, type CallResult as s, types$d as t, CommerceClient as u, types$o as v, ContextCreationError as w, CustomersClient as x, types$h as y, type EndpointParam as z };
35794
+ export { types$5 as $, AugurAPI as A, type BaseResponse$1 as B, type CallArgs as C, type Envelope as D, type EndpointEntry as E, types$9 as F, GoogMcClient as G, GregorovichClient as H, types$8 as I, type HealthCheckData as J, HealthCheckDataSchema as K, ItemsClient as L, types$k as M, JoomlaClient as N, types$p as O, type Known as P, LegacyClient as Q, types$j as R, LogisticsClient as S, types$7 as T, OpenSearchClient as U, types$l as V, OrdersClient as W, types$g as X, P21ApisClient as Y, types$6 as Z, P21CoreClient as _, AgrInfoClient as a, P21PimClient as a0, types$f as a1, P21SismClient as a2, types$4 as a3, PaginationParamsSchema as a4, PaymentsClient as a5, types$e as a6, type PingData as a7, PricingClient as a8, types$n as a9, type RequestConfig as aa, ShippingClient as ab, types$3 as ac, SmartyStreetsClient as ad, types$2 as ae, UPSClient as af, types$1 as ag, VMIClient as ah, types$m as ai, type WhoamiData as aj, WhoamiDataSchema as ak, isReadOnly as al, AgrIntClient as b, types$c as c, AgrSiteClient as d, types$i as e, AgrWorkClient as f, type AugurAPIConfig as g, type AugurContext as h, type AugurRequestConfig as i, type AugurRequestError as j, type AugurResponse as k, AvalaraClient as l, types$b as m, BaseResponseSchema as n, Basecamp2Client as o, types as p, BrandFolderClient as q, types$a as r, type CallResult as s, types$d as t, CommerceClient as u, types$o as v, ContextCreationError as w, CustomersClient as x, types$h as y, type EndpointParam as z };
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { A as AugurAPI } from './client-BtWVFwso.mjs';
2
- export { a as AgrInfoClient, t as AgrInfoTypes, b as AgrIntClient, c as AgrIntTypes, d as AgrSiteClient, e as AgrSiteTypes, f as AgrWorkClient, g as AugurAPIConfig, h as AugurContext, i as AugurRequestConfig, j as AugurRequestError, k as AugurResponse, l as AvalaraClient, m as AvalaraTypes, B as BaseResponse, n as BaseResponseSchema, o as Basecamp2Client, p as Basecamp2Types, q as BrandFolderClient, r as BrandFolderTypes, C as CallArgs, s as CallResult, u as CommerceClient, v as CommerceTypes, w as ContextCreationError, x as CustomersClient, y as CustomersTypes, E as EndpointEntry, z as EndpointParam, D as Envelope, G as GoogMcClient, F as GoogMcTypes, H as GregorovichClient, I as GregorovichTypes, J as HealthCheckData, K as HealthCheckDataSchema, L as ItemsClient, M as ItemsTypes, N as JoomlaClient, O as JoomlaTypes, P as Known, Q as LegacyClient, R as LegacyTypes, S as LogisticsClient, T as LogisticsTypes, U as OpenSearchClient, V as OpenSearchTypes, W as OrdersClient, X as OrdersTypes, Y as P21ApisClient, Z as P21ApisTypes, _ as P21CoreClient, $ as P21CoreTypes, a0 as P21PimClient, a1 as P21PimTypes, a2 as P21SismClient, a3 as P21SismTypes, a4 as PaginationParamsSchema, a5 as PaymentsClient, a6 as PaymentsTypes, a7 as PingData, a8 as PricingClient, a9 as PricingTypes, aa as RequestConfig, ab as ShippingClient, ac as ShippingTypes, ad as SmartyStreetsClient, ae as SmartyStreetsTypes, af as UPSClient, ag as UPSTypes, ah as VMIClient, ai as VMITypes, aj as WhoamiData, ak as WhoamiDataSchema } from './client-BtWVFwso.mjs';
1
+ import { A as AugurAPI } from './client-CgfYhvRm.mjs';
2
+ export { a as AgrInfoClient, t as AgrInfoTypes, b as AgrIntClient, c as AgrIntTypes, d as AgrSiteClient, e as AgrSiteTypes, f as AgrWorkClient, g as AugurAPIConfig, h as AugurContext, i as AugurRequestConfig, j as AugurRequestError, k as AugurResponse, l as AvalaraClient, m as AvalaraTypes, B as BaseResponse, n as BaseResponseSchema, o as Basecamp2Client, p as Basecamp2Types, q as BrandFolderClient, r as BrandFolderTypes, C as CallArgs, s as CallResult, u as CommerceClient, v as CommerceTypes, w as ContextCreationError, x as CustomersClient, y as CustomersTypes, E as EndpointEntry, z as EndpointParam, D as Envelope, G as GoogMcClient, F as GoogMcTypes, H as GregorovichClient, I as GregorovichTypes, J as HealthCheckData, K as HealthCheckDataSchema, L as ItemsClient, M as ItemsTypes, N as JoomlaClient, O as JoomlaTypes, P as Known, Q as LegacyClient, R as LegacyTypes, S as LogisticsClient, T as LogisticsTypes, U as OpenSearchClient, V as OpenSearchTypes, W as OrdersClient, X as OrdersTypes, Y as P21ApisClient, Z as P21ApisTypes, _ as P21CoreClient, $ as P21CoreTypes, a0 as P21PimClient, a1 as P21PimTypes, a2 as P21SismClient, a3 as P21SismTypes, a4 as PaginationParamsSchema, a5 as PaymentsClient, a6 as PaymentsTypes, a7 as PingData, a8 as PricingClient, a9 as PricingTypes, aa as RequestConfig, ab as ShippingClient, ac as ShippingTypes, ad as SmartyStreetsClient, ae as SmartyStreetsTypes, af as UPSClient, ag as UPSTypes, ah as VMIClient, ai as VMITypes, aj as WhoamiData, ak as WhoamiDataSchema, al as isReadOnly } from './client-CgfYhvRm.mjs';
3
3
  import 'valibot';
4
4
 
5
5
  /**
@@ -180,6 +180,33 @@ declare class InvalidArgumentError extends AugurError {
180
180
  });
181
181
  }
182
182
 
183
+ /**
184
+ * Is `s` a siteId as the backend issues them: one or more of lowercase letters, digits, `_`, `-`?
185
+ *
186
+ * Machine-checked in part: the `//@` annotations are proved by Dafny from `repo/verify` (local only,
187
+ * `uv run repo/bin/gates.py --only verify`) and are about THIS file. The proof says `isSiteId` is
188
+ * true exactly when `s` is non-empty and every character is in that set. It does NOT prove the set
189
+ * is what the backend accepts: that is the registry's and the backend's, tested in
190
+ * tests/core/site-id.test.ts. Edit this file only together with its proof and the refreshed
191
+ * `repo/verify/proofs.lock.json` (`repo/verify/README.md`). The annotations are comments and cost
192
+ * nothing at runtime.
193
+ *
194
+ * The branded `SiteId` type and `parseSiteId` are in site-id.ts, which the prover never reads.
195
+ */
196
+ declare function isSiteId(s: string): boolean;
197
+
198
+ declare const siteIdBrand: unique symbol;
199
+ /**
200
+ * A siteId that passed `isSiteId`. The only ways to get one are `parseSiteId` and `assertSiteId`
201
+ * below, so a function that takes a `SiteId` cannot be handed a raw, empty or malformed string.
202
+ * The compiler checks that. (`AugurAPIConfig.siteId` stays a plain `string`, validated at runtime.)
203
+ */
204
+ type SiteId = string & {
205
+ readonly [siteIdBrand]: true;
206
+ };
207
+ /** The branded siteId, or `undefined` when `value` is not one. The one cast in the package is here. */
208
+ declare function parseSiteId(value: string): SiteId | undefined;
209
+
183
210
  /**
184
211
  * Generated types for the agr-work service.
185
212
  * Work tracking and task management for internal operations and job scheduling
@@ -204,6 +231,6 @@ declare namespace types {
204
231
  export type { types_AgrWorkClientSpec as AgrWorkClientSpec };
205
232
  }
206
233
 
207
- declare const VERSION = "2026.10.16";
234
+ declare const VERSION = "2026.10.17";
208
235
 
209
- export { types as AgrWorkTypes, AugurAPI, type AugurAPIError, AugurError, AuthenticationError, type CrossSiteAuthParams, type CrossSiteAuthResult, InvalidArgumentError, NotFoundError, RateLimitError, VERSION, ValidationError, authenticateUserForSite, createCrossSiteAuthenticator };
236
+ export { types as AgrWorkTypes, AugurAPI, type AugurAPIError, AugurError, AuthenticationError, type CrossSiteAuthParams, type CrossSiteAuthResult, InvalidArgumentError, NotFoundError, RateLimitError, type SiteId, VERSION, ValidationError, authenticateUserForSite, createCrossSiteAuthenticator, isSiteId, parseSiteId };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { A as AugurAPI } from './client-BtWVFwso.js';
2
- export { a as AgrInfoClient, t as AgrInfoTypes, b as AgrIntClient, c as AgrIntTypes, d as AgrSiteClient, e as AgrSiteTypes, f as AgrWorkClient, g as AugurAPIConfig, h as AugurContext, i as AugurRequestConfig, j as AugurRequestError, k as AugurResponse, l as AvalaraClient, m as AvalaraTypes, B as BaseResponse, n as BaseResponseSchema, o as Basecamp2Client, p as Basecamp2Types, q as BrandFolderClient, r as BrandFolderTypes, C as CallArgs, s as CallResult, u as CommerceClient, v as CommerceTypes, w as ContextCreationError, x as CustomersClient, y as CustomersTypes, E as EndpointEntry, z as EndpointParam, D as Envelope, G as GoogMcClient, F as GoogMcTypes, H as GregorovichClient, I as GregorovichTypes, J as HealthCheckData, K as HealthCheckDataSchema, L as ItemsClient, M as ItemsTypes, N as JoomlaClient, O as JoomlaTypes, P as Known, Q as LegacyClient, R as LegacyTypes, S as LogisticsClient, T as LogisticsTypes, U as OpenSearchClient, V as OpenSearchTypes, W as OrdersClient, X as OrdersTypes, Y as P21ApisClient, Z as P21ApisTypes, _ as P21CoreClient, $ as P21CoreTypes, a0 as P21PimClient, a1 as P21PimTypes, a2 as P21SismClient, a3 as P21SismTypes, a4 as PaginationParamsSchema, a5 as PaymentsClient, a6 as PaymentsTypes, a7 as PingData, a8 as PricingClient, a9 as PricingTypes, aa as RequestConfig, ab as ShippingClient, ac as ShippingTypes, ad as SmartyStreetsClient, ae as SmartyStreetsTypes, af as UPSClient, ag as UPSTypes, ah as VMIClient, ai as VMITypes, aj as WhoamiData, ak as WhoamiDataSchema } from './client-BtWVFwso.js';
1
+ import { A as AugurAPI } from './client-CgfYhvRm.js';
2
+ export { a as AgrInfoClient, t as AgrInfoTypes, b as AgrIntClient, c as AgrIntTypes, d as AgrSiteClient, e as AgrSiteTypes, f as AgrWorkClient, g as AugurAPIConfig, h as AugurContext, i as AugurRequestConfig, j as AugurRequestError, k as AugurResponse, l as AvalaraClient, m as AvalaraTypes, B as BaseResponse, n as BaseResponseSchema, o as Basecamp2Client, p as Basecamp2Types, q as BrandFolderClient, r as BrandFolderTypes, C as CallArgs, s as CallResult, u as CommerceClient, v as CommerceTypes, w as ContextCreationError, x as CustomersClient, y as CustomersTypes, E as EndpointEntry, z as EndpointParam, D as Envelope, G as GoogMcClient, F as GoogMcTypes, H as GregorovichClient, I as GregorovichTypes, J as HealthCheckData, K as HealthCheckDataSchema, L as ItemsClient, M as ItemsTypes, N as JoomlaClient, O as JoomlaTypes, P as Known, Q as LegacyClient, R as LegacyTypes, S as LogisticsClient, T as LogisticsTypes, U as OpenSearchClient, V as OpenSearchTypes, W as OrdersClient, X as OrdersTypes, Y as P21ApisClient, Z as P21ApisTypes, _ as P21CoreClient, $ as P21CoreTypes, a0 as P21PimClient, a1 as P21PimTypes, a2 as P21SismClient, a3 as P21SismTypes, a4 as PaginationParamsSchema, a5 as PaymentsClient, a6 as PaymentsTypes, a7 as PingData, a8 as PricingClient, a9 as PricingTypes, aa as RequestConfig, ab as ShippingClient, ac as ShippingTypes, ad as SmartyStreetsClient, ae as SmartyStreetsTypes, af as UPSClient, ag as UPSTypes, ah as VMIClient, ai as VMITypes, aj as WhoamiData, ak as WhoamiDataSchema, al as isReadOnly } from './client-CgfYhvRm.js';
3
3
  import 'valibot';
4
4
 
5
5
  /**
@@ -180,6 +180,33 @@ declare class InvalidArgumentError extends AugurError {
180
180
  });
181
181
  }
182
182
 
183
+ /**
184
+ * Is `s` a siteId as the backend issues them: one or more of lowercase letters, digits, `_`, `-`?
185
+ *
186
+ * Machine-checked in part: the `//@` annotations are proved by Dafny from `repo/verify` (local only,
187
+ * `uv run repo/bin/gates.py --only verify`) and are about THIS file. The proof says `isSiteId` is
188
+ * true exactly when `s` is non-empty and every character is in that set. It does NOT prove the set
189
+ * is what the backend accepts: that is the registry's and the backend's, tested in
190
+ * tests/core/site-id.test.ts. Edit this file only together with its proof and the refreshed
191
+ * `repo/verify/proofs.lock.json` (`repo/verify/README.md`). The annotations are comments and cost
192
+ * nothing at runtime.
193
+ *
194
+ * The branded `SiteId` type and `parseSiteId` are in site-id.ts, which the prover never reads.
195
+ */
196
+ declare function isSiteId(s: string): boolean;
197
+
198
+ declare const siteIdBrand: unique symbol;
199
+ /**
200
+ * A siteId that passed `isSiteId`. The only ways to get one are `parseSiteId` and `assertSiteId`
201
+ * below, so a function that takes a `SiteId` cannot be handed a raw, empty or malformed string.
202
+ * The compiler checks that. (`AugurAPIConfig.siteId` stays a plain `string`, validated at runtime.)
203
+ */
204
+ type SiteId = string & {
205
+ readonly [siteIdBrand]: true;
206
+ };
207
+ /** The branded siteId, or `undefined` when `value` is not one. The one cast in the package is here. */
208
+ declare function parseSiteId(value: string): SiteId | undefined;
209
+
183
210
  /**
184
211
  * Generated types for the agr-work service.
185
212
  * Work tracking and task management for internal operations and job scheduling
@@ -204,6 +231,6 @@ declare namespace types {
204
231
  export type { types_AgrWorkClientSpec as AgrWorkClientSpec };
205
232
  }
206
233
 
207
- declare const VERSION = "2026.10.16";
234
+ declare const VERSION = "2026.10.17";
208
235
 
209
- export { types as AgrWorkTypes, AugurAPI, type AugurAPIError, AugurError, AuthenticationError, type CrossSiteAuthParams, type CrossSiteAuthResult, InvalidArgumentError, NotFoundError, RateLimitError, VERSION, ValidationError, authenticateUserForSite, createCrossSiteAuthenticator };
236
+ export { types as AgrWorkTypes, AugurAPI, type AugurAPIError, AugurError, AuthenticationError, type CrossSiteAuthParams, type CrossSiteAuthResult, InvalidArgumentError, NotFoundError, RateLimitError, type SiteId, VERSION, ValidationError, authenticateUserForSite, createCrossSiteAuthenticator, isSiteId, parseSiteId };
package/dist/index.js CHANGED
@@ -71,7 +71,10 @@ __export(index_exports, {
71
71
  ValidationError: () => ValidationError,
72
72
  WhoamiDataSchema: () => WhoamiDataSchema,
73
73
  authenticateUserForSite: () => authenticateUserForSite,
74
- createCrossSiteAuthenticator: () => createCrossSiteAuthenticator
74
+ createCrossSiteAuthenticator: () => createCrossSiteAuthenticator,
75
+ isReadOnly: () => isReadOnly,
76
+ isSiteId: () => isSiteId,
77
+ parseSiteId: () => parseSiteId
75
78
  });
76
79
  module.exports = __toCommonJS(index_exports);
77
80
 
@@ -576,16 +579,99 @@ var HTTPClient = class {
576
579
  }
577
580
  };
578
581
 
579
- // src/core/path-validation.ts
582
+ // src/core/path-encode.ts
583
+ function isHigh(c) {
584
+ return c >= 55296 && c <= 56319;
585
+ }
586
+ function isLow(c) {
587
+ return c >= 56320 && c <= 57343;
588
+ }
589
+ function isUpperHex(c) {
590
+ return c >= 48 && c <= 57 || c >= 65 && c <= 70;
591
+ }
592
+ function isAlnum(c) {
593
+ return c >= 65 && c <= 90 || c >= 97 && c <= 122 || c >= 48 && c <= 57;
594
+ }
595
+ function isMark(c) {
596
+ return c === 45 || c === 46 || c === 95 || c === 126;
597
+ }
598
+ function isDelimOrAt(c) {
599
+ return c === 33 || c === 36 || c >= 38 && c <= 44 || c === 58 || c === 59 || c === 61 || c === 64;
600
+ }
601
+ function isPchar(c) {
602
+ return isAlnum(c) || isMark(c) || isDelimOrAt(c);
603
+ }
604
+ function loneAt(s, k) {
605
+ return isHigh(s.charCodeAt(k)) && !(k + 1 < s.length && isLow(s.charCodeAt(k + 1))) || isLow(s.charCodeAt(k)) && !(k > 0 && isHigh(s.charCodeAt(k - 1)));
606
+ }
607
+ function isPairAt(s, i) {
608
+ return isHigh(s.charCodeAt(i)) && i + 1 < s.length && isLow(s.charCodeAt(i + 1));
609
+ }
610
+ function okAt(s, k) {
611
+ return isPchar(s.charCodeAt(k)) || s.charCodeAt(k) === 37 && k + 2 < s.length && isUpperHex(s.charCodeAt(k + 1)) && isUpperHex(s.charCodeAt(k + 2));
612
+ }
613
+ function hasLoneSurrogate(value) {
614
+ let i = 0;
615
+ while (i < value.length) {
616
+ if (loneAt(value, i)) return true;
617
+ if (isPairAt(value, i)) {
618
+ i = i + 2;
619
+ } else {
620
+ i = i + 1;
621
+ }
622
+ }
623
+ return false;
624
+ }
625
+ function isEncoded(s) {
626
+ let i = 0;
627
+ while (i < s.length) {
628
+ if (!okAt(s, i)) return false;
629
+ if (s.charCodeAt(i) === 37) {
630
+ i = i + 3;
631
+ } else {
632
+ i = i + 1;
633
+ }
634
+ }
635
+ return true;
636
+ }
637
+
638
+ // src/core/encoded-segment.ts
580
639
  var PCHAR_RESTORE_RE = /%(?:24|26|2B|2C|3B|3D|3A|40)/g;
581
- var LONE_SURROGATE_RE = /[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/;
582
- var encodePathSegment = (value) => encodeURIComponent(value).replace(PCHAR_RESTORE_RE, decodeURIComponent);
640
+ function encodePathSegment(value) {
641
+ const encoded = encodeURIComponent(value).replace(PCHAR_RESTORE_RE, decodeURIComponent);
642
+ if (!isEncoded(encoded)) {
643
+ throw new InvalidArgumentError({
644
+ message: "Encoded path segment has an unexpected shape",
645
+ service: "",
646
+ endpoint: ""
647
+ });
648
+ }
649
+ return encoded;
650
+ }
651
+ function fillPlaceholder(path, placeholder, segment) {
652
+ return path.split(`{${placeholder}}`).join(segment);
653
+ }
654
+ function renderPath(template, segments) {
655
+ return template.replace(/\{([^}]+)\}/g, (_, name) => {
656
+ const segment = segments[name];
657
+ if (segment === void 0) {
658
+ throw new InvalidArgumentError({
659
+ message: `No path value for {${name}}`,
660
+ service: "",
661
+ endpoint: template
662
+ });
663
+ }
664
+ return segment;
665
+ });
666
+ }
667
+
668
+ // src/core/path-validation.ts
583
669
  var pathValueProblem = (value, pattern) => {
584
670
  if (pattern !== void 0 && !new RegExp(pattern).test(value)) {
585
671
  return `expected a value matching ${pattern}`;
586
672
  }
587
673
  if (value === "") return "expected a non-empty string";
588
- return LONE_SURROGATE_RE.test(value) ? "expected a well-formed string" : void 0;
674
+ return hasLoneSurrogate(value) ? "expected a well-formed string" : void 0;
589
675
  };
590
676
  var validatePathSegment = (pathTemplate, name, value, pattern, service = "http-client") => {
591
677
  const problem = pathValueProblem(value, pattern);
@@ -22146,6 +22232,9 @@ function resolveEndpoint(id) {
22146
22232
  index ?? (index = buildIndex());
22147
22233
  return index.get(id);
22148
22234
  }
22235
+ function isReadOnly(entry) {
22236
+ return entry.readOnly ?? entry.method === "GET";
22237
+ }
22149
22238
 
22150
22239
  // src/core/call.ts
22151
22240
  var ENVELOPE_KEYS = [
@@ -22186,11 +22275,14 @@ function checkArgs(entry, args) {
22186
22275
  }
22187
22276
  }
22188
22277
  function fillPath(entry, pathParams) {
22189
- return entry.path.replace(/\{([^}]+)\}/g, (_, name) => {
22278
+ const segments = {};
22279
+ for (const match of entry.path.matchAll(/\{([^}]+)\}/g)) {
22280
+ const name = match[1];
22190
22281
  const value = String(pathParams[name]);
22191
22282
  validatePathSegment(entry.path, name, value, entry.pathPatterns[name], entry.service);
22192
- return encodePathSegment(value);
22193
- });
22283
+ segments[name] = encodePathSegment(value);
22284
+ }
22285
+ return renderPath(entry.path, segments);
22194
22286
  }
22195
22287
  function toEnvelope(body) {
22196
22288
  if (typeof body !== "object" || body === null || Array.isArray(body)) {
@@ -22219,6 +22311,36 @@ async function callEndpoint(config, id, args = {}) {
22219
22311
  return { httpStatus: raw.status, envelope: toEnvelope(body), body };
22220
22312
  }
22221
22313
 
22314
+ // src/core/site-id-check.ts
22315
+ function isSiteChar(c) {
22316
+ return c >= 97 && c <= 122 || c >= 48 && c <= 57 || c === 95 || c === 45;
22317
+ }
22318
+ function isSiteId(s) {
22319
+ if (s.length === 0) return false;
22320
+ let i = 0;
22321
+ while (i < s.length) {
22322
+ if (!isSiteChar(s.charCodeAt(i))) return false;
22323
+ i = i + 1;
22324
+ }
22325
+ return true;
22326
+ }
22327
+
22328
+ // src/core/site-id.ts
22329
+ function parseSiteId(value) {
22330
+ return isSiteId(value) ? value : void 0;
22331
+ }
22332
+ function assertSiteId(value) {
22333
+ const site = parseSiteId(value);
22334
+ if (site === void 0) {
22335
+ throw new InvalidArgumentError({
22336
+ message: "Invalid siteId: expected lowercase letters, digits, '_' and '-' (e.g. ampro-online)",
22337
+ service: "",
22338
+ endpoint: ""
22339
+ });
22340
+ }
22341
+ return site;
22342
+ }
22343
+
22222
22344
  // src/core/common-schemas.ts
22223
22345
  var CommonHealthCheckResponseSchema = BaseResponseSchema(HealthCheckDataSchema);
22224
22346
  var CommonPingResponseSchema = BaseResponseSchema(PingDataSchema);
@@ -22388,11 +22510,11 @@ var BaseServiceClient = class {
22388
22510
  const stringValue = String(value);
22389
22511
  if (path.includes(`{${key}}`)) {
22390
22512
  validatePathSegment(pathTemplate, key, stringValue, pathPatterns[key], this.serviceName);
22391
- const encoded = encodePathSegment(stringValue);
22392
- path = path.replace(`{${key}}`, () => encoded);
22513
+ path = fillPlaceholder(path, key, encodePathSegment(stringValue));
22393
22514
  } else {
22394
22515
  const normKey = normalise(key);
22395
- path = path.replace(/\{([^}]+)\}/g, (match, placeholder) => {
22516
+ for (const match of new Set(path.matchAll(/\{([^}]+)\}/g))) {
22517
+ const placeholder = match[1];
22396
22518
  if (normalise(placeholder) === normKey) {
22397
22519
  validatePathSegment(
22398
22520
  pathTemplate,
@@ -22401,10 +22523,9 @@ var BaseServiceClient = class {
22401
22523
  pathPatterns[placeholder],
22402
22524
  this.serviceName
22403
22525
  );
22404
- return encodePathSegment(stringValue);
22526
+ path = fillPlaceholder(path, placeholder, encodePathSegment(stringValue));
22405
22527
  }
22406
- return match;
22407
- });
22528
+ }
22408
22529
  }
22409
22530
  }
22410
22531
  return path;
@@ -23165,8 +23286,14 @@ var Basecamp2Client = class extends BaseServiceClient {
23165
23286
 
23166
23287
  // src/client.ts
23167
23288
  var _AugurAPI = class _AugurAPI {
23289
+ /**
23290
+ * @throws InvalidArgumentError when `config.siteId` is not a siteId (`isSiteId`: lowercase
23291
+ * letters, digits, `_` and `-`). The config is copied, so changing the caller's object
23292
+ * afterwards cannot put an empty or malformed one into `x-site-id`; use `setSiteId`.
23293
+ */
23168
23294
  constructor(config) {
23169
- this.config = config;
23295
+ assertSiteId(config.siteId);
23296
+ this.config = { ...config };
23170
23297
  }
23171
23298
  /**
23172
23299
  * Every endpoint the SDK exposes, one language-neutral entry each, sorted by id.
@@ -23545,9 +23672,10 @@ var _AugurAPI = class _AugurAPI {
23545
23672
  /**
23546
23673
  * Update site ID
23547
23674
  * @param siteId New site ID
23675
+ * @throws InvalidArgumentError when it is not a siteId (see the constructor)
23548
23676
  */
23549
23677
  setSiteId(siteId) {
23550
- this.config.siteId = siteId;
23678
+ this.config.siteId = assertSiteId(siteId);
23551
23679
  this._joomla = void 0;
23552
23680
  this._commerce = void 0;
23553
23681
  this._pricing = void 0;
@@ -23635,7 +23763,7 @@ function createCrossSiteAuthenticator(augurInfoToken) {
23635
23763
  }
23636
23764
 
23637
23765
  // src/index.ts
23638
- var VERSION = "2026.10.16";
23766
+ var VERSION = "2026.10.17";
23639
23767
  // Annotate the CommonJS export names for ESM import in node:
23640
23768
  0 && (module.exports = {
23641
23769
  AgrInfoClient,
@@ -23679,6 +23807,9 @@ var VERSION = "2026.10.16";
23679
23807
  ValidationError,
23680
23808
  WhoamiDataSchema,
23681
23809
  authenticateUserForSite,
23682
- createCrossSiteAuthenticator
23810
+ createCrossSiteAuthenticator,
23811
+ isReadOnly,
23812
+ isSiteId,
23813
+ parseSiteId
23683
23814
  });
23684
23815
  //# sourceMappingURL=index.js.map