@simpleapps-com/augur-server 2026.11.10 → 2026.11.12
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/EXPORTS.md +2 -2
- package/README.md +45 -6
- package/dist/actions/commerce.d.ts.map +1 -1
- package/dist/actions/customers.d.ts +7 -2
- package/dist/actions/customers.d.ts.map +1 -1
- package/dist/actions/joomla.d.ts +3 -2
- package/dist/actions/joomla.d.ts.map +1 -1
- package/dist/actions/pricing.d.ts.map +1 -1
- package/dist/actions/require-customer.d.ts +9 -0
- package/dist/actions/require-customer.d.ts.map +1 -0
- package/dist/address-id.d.ts +12 -0
- package/dist/address-id.d.ts.map +1 -0
- package/dist/api-handler.d.ts.map +1 -1
- package/dist/api.js +7 -5
- package/dist/api.js.map +1 -1
- package/dist/auth.d.ts +44 -6
- package/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +4 -3
- package/dist/{chunk-4KPTIVYO.js → chunk-5DBFTSWY.js} +11 -14
- package/dist/chunk-5DBFTSWY.js.map +1 -0
- package/dist/{chunk-AYHUM7SG.js → chunk-GKT4MAWC.js} +46 -64
- package/dist/chunk-GKT4MAWC.js.map +1 -0
- package/dist/{chunk-BG4G5QUQ.js → chunk-HGJF667G.js} +8 -1
- package/dist/{chunk-BG4G5QUQ.js.map → chunk-HGJF667G.js.map} +1 -1
- package/dist/chunk-ILXNFJVM.js +86 -0
- package/dist/chunk-ILXNFJVM.js.map +1 -0
- package/dist/{chunk-JIYVQWXK.js → chunk-IM7FDRER.js} +1 -1
- package/dist/chunk-IM7FDRER.js.map +1 -0
- package/dist/chunk-M35O5JDZ.js +257 -0
- package/dist/chunk-M35O5JDZ.js.map +1 -0
- package/dist/{chunk-G5P4IDK7.js → chunk-Y54RGILF.js} +35 -3
- package/dist/chunk-Y54RGILF.js.map +1 -0
- package/dist/hooks.js +4 -3
- package/dist/hooks.js.map +1 -1
- package/dist/index.js +6 -5
- package/dist/index.js.map +1 -1
- package/dist/query-action.d.ts +2 -8
- package/dist/query-action.d.ts.map +1 -1
- package/dist/query-action.js +4 -3
- package/dist/recaptcha.d.ts.map +1 -1
- package/dist/rules.d.ts +17 -17
- package/dist/rules.d.ts.map +1 -1
- package/dist/sdk-client-store.d.ts +4 -3
- package/dist/sdk-client-store.d.ts.map +1 -1
- package/dist/server-site.d.ts +6 -8
- package/dist/server-site.d.ts.map +1 -1
- package/dist/session-rules.d.ts +118 -0
- package/dist/session-rules.d.ts.map +1 -0
- package/dist/site.js +14 -9
- package/dist/site.js.map +1 -1
- package/dist/sitemap.js +2 -2
- package/dist/testing.js +4 -4
- package/llms.txt +4 -2
- package/next-auth.d.ts +2 -2
- package/package.json +6 -5
- package/dist/chunk-4KPTIVYO.js.map +0 -1
- package/dist/chunk-AUIC4HS2.js +0 -174
- package/dist/chunk-AUIC4HS2.js.map +0 -1
- package/dist/chunk-AYHUM7SG.js.map +0 -1
- package/dist/chunk-G5P4IDK7.js.map +0 -1
- package/dist/chunk-JIYVQWXK.js.map +0 -1
package/EXPORTS.md
CHANGED
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
|
|
48
48
|
### Types
|
|
49
49
|
|
|
50
|
-
`AugurAuthCallbacks`, `AugurAuthClient`, `AugurJWT`, `AugurSession`, `AugurUser`, `CreateAuthConfigOptions`
|
|
50
|
+
`AugurAuthCallbacks`, `AugurAuthClient`, `AugurJWT`, `AugurSession`, `AugurUser`, `CreateAuthConfigOptions`, `PasswordAnswer`, `WithoutCustomer`
|
|
51
51
|
|
|
52
52
|
## `@simpleapps-com/augur-server/query`
|
|
53
53
|
|
|
@@ -118,7 +118,7 @@
|
|
|
118
118
|
| `queryActionRawWith` | function | `queryActionRaw`, bounded: the same options as {@link queryActionWith}. |
|
|
119
119
|
| `queryActionWith` | function | `queryAction`, bounded (atlas#106): `options.deadline` caps the whole call in milliseconds (every retry and the waits between them), and `options.signal` lets the caller cancel it. At the deadline the call rejects with a `TimeoutError` (the request is cancelled, nothing more is retried, nothing is cached), so a server render can fall back to a client-side fetch. |
|
|
120
120
|
| `resetSessionImports` | function | Reset lazy-loaded imports. Used in tests only. @internal |
|
|
121
|
-
| `resolveMethod` | function |
|
|
121
|
+
| `resolveMethod` | function | |
|
|
122
122
|
| `unwrapBaseResponse` | value | |
|
|
123
123
|
|
|
124
124
|
## `@simpleapps-com/augur-server/api`
|
package/README.md
CHANGED
|
@@ -29,10 +29,38 @@ pnpm add @simpleapps-com/augur-server
|
|
|
29
29
|
| `@simpleapps-com/augur-server/testing` | `createMockSiteActions`, `createMockClient` |
|
|
30
30
|
| `@simpleapps-com/augur-server/next-auth` | NextAuth type augmentations |
|
|
31
31
|
|
|
32
|
-
**
|
|
33
|
-
`
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
**Sign-in** (atlas#97): a site posts the username and password to `signIn("credentials", …)`;
|
|
33
|
+
`authorize` checks them with Joomla on the server (`joomla.users.verifyPassword`, or a site's own
|
|
34
|
+
`callbacks.verifyPassword`) and the user, its id and its token come from that answer alone. A
|
|
35
|
+
posted `id`, `isVerified` or `token` is never read. A config with no client must give both
|
|
36
|
+
`callbacks.getUserProfile` and `callbacks.verifyPassword`. A Joomla or network failure propagates,
|
|
37
|
+
never reads as a wrong password. Every session read re-reads the account: a blocked (Joomla
|
|
38
|
+
`block`) or deleted account's session ends (a site's own `getUserProfile` SHOULD set `blocked`).
|
|
39
|
+
|
|
40
|
+
**Cross-site sessions** (a site signing users in for other sites, augur-support's pattern) are on
|
|
41
|
+
exactly for the augur_info site, read from the client's own siteId (owner 2026-11-16; no setting):
|
|
42
|
+
it also posts `siteId`, the site whose password Joomla checks. On every other site the posted
|
|
43
|
+
`siteId` is ignored and `queryAction` never reads the session cookie, so pages that prefetch
|
|
44
|
+
through it can render statically (atlas#105).
|
|
45
|
+
|
|
46
|
+
**Only API routes, with proper data**, reach the SDK through `queryAction` (atlas#104): a method
|
|
47
|
+
path MUST be an endpoint id in the site's own SDK registry (`api.hasEndpoint`; a data proxy such
|
|
48
|
+
as `items.invMastData.list` counts as its route `items.invMast.list`), and it is followed through
|
|
49
|
+
the client's services (getters) and their own properties only. The client's own methods
|
|
50
|
+
(`setAuthToken`, `call`, `withRequest`), its `config` hooks and a service's `http` client are
|
|
51
|
+
never reached. The SDK then refuses a sent query param that does not fit its declared type. An
|
|
52
|
+
SDK without `hasEndpoint` keeps only the walk check, so sites SHOULD upgrade both packages
|
|
53
|
+
together. Fetch mode answers a failed call with a fixed `Internal server error`, never the
|
|
54
|
+
error's message.
|
|
55
|
+
|
|
56
|
+
**The auth session** (atlas#212) never carries the user's Augur token: the session object reaches
|
|
57
|
+
the browser, so the token stays in the encrypted JWT, where server code (and `queryAction`) reads
|
|
58
|
+
it. `auth.withoutCustomer` is required and says what a signed-in user with no usable customer of
|
|
59
|
+
their own gets: `"default"` acts as `defaultCustomerId` (and its cart), `"none"` gets no customer
|
|
60
|
+
and no cart (a B2B portal MUST say `"none"`). The user's own customer always wins.
|
|
61
|
+
`createAuthConfig` sets Auth.js's `logger`: an error logs its type only, never its cause (Auth.js's
|
|
62
|
+
default prints an expired session's decrypted JWT, the token included), and debug output never
|
|
63
|
+
its metadata (augur-utils `errorLogLine`).
|
|
36
64
|
|
|
37
65
|
**Bounded calls** (atlas#106): a server render that awaits a read SHOULD bound it with
|
|
38
66
|
`queryActionWith({ deadline: 5000 }, methodPath, ...args)` (or `queryActionRawWith`). With no
|
|
@@ -75,10 +103,21 @@ keeps its untyped signature. `queryActionRaw` / `queryActionRawWith` keep their
|
|
|
75
103
|
## Development
|
|
76
104
|
|
|
77
105
|
TypeScript in `src/`, built to `dist/` (ESM) by tsup with `"use server"` and `"use client"`
|
|
78
|
-
banners per entry. The decisions are proved (`src/rules.ts`, `src/scoped-client-key.ts`, `src/sitemap-rules.ts
|
|
79
|
-
models `models/AugurServer.dfy`, `models/AugurServerSitemap.dfy`,
|
|
106
|
+
banners per entry. The decisions are proved (`src/rules.ts`, `src/scoped-client-key.ts`, `src/sitemap-rules.ts`,
|
|
107
|
+
`src/session-rules.ts`; models `models/AugurServer.dfy`, `models/AugurServerSitemap.dfy`,
|
|
108
|
+
`models/AugurServerSecurity.dfy`, links
|
|
80
109
|
`models/links/augur-server-*.dfy`); the rest is tested at 100%.
|
|
81
110
|
|
|
111
|
+
Every customer id (#95) goes through augur-utils' proved `resolveAddressId` / `addressIdOf`,
|
|
112
|
+
never `??` or `Number()`: pricing and tax (refused without one: in a price a customer is never 0;
|
|
113
|
+
a batch resolves it once and refuses before any item, never `{}`), the `customers` actions (the
|
|
114
|
+
doc, orders, invoices, quotes and ship-tos refuse 0 and any non-id, so no `customers/0/…`
|
|
115
|
+
request is made), `commerce.cartHdrLookup` (refused without one), the auth session and its cart
|
|
116
|
+
lookup (`sessionCustomerOf`, `src/session-rules.ts`: none for customer 0, the default only with
|
|
117
|
+
`withoutCustomer: "default"`; a site's `cartHdrLookup` callback gets a resolved `number`), and `joomla.getUserProfile` (`customerId: AddressId | null`).
|
|
118
|
+
Each refusal is the proved `customerRefusalOf` (`src/rules.ts`), thrown by
|
|
119
|
+
`actions/require-customer.ts`.
|
|
120
|
+
|
|
82
121
|
```bash
|
|
83
122
|
pnpm -C repo/packages/augur-server test
|
|
84
123
|
pnpm -C repo/packages/augur-server proofs
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commerce.d.ts","sourceRoot":"","sources":["../../src/actions/commerce.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AACzE,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"commerce.d.ts","sourceRoot":"","sources":["../../src/actions/commerce.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AACzE,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,eA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vB,EAAE,KACA,OAAO,CAAC,OAAO,CAAC,CAAC;IAEtB,wGAAwG;IACxG,eAAe,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAEjF,8EAA8E;IAC9E,eAAe,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAE1D,iBAAiB,EAAE,CACjB,UAAU,EAAE,MAAM,KACf,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC,CAAC;IAElE,aAAa,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,eAAe,CAAC,CAAC;CAChG;AAED;;;;;;;;;;;;;;;;;;;;SAoBS;AACT,wBAAgB,qBAAqB,CACnC,GAAG,EAAE,iBAAiB,EACtB,MAAM,GAAE,qBAA0B,GACjC,eAAe,CA0GjB"}
|
|
@@ -10,6 +10,11 @@ export type CustomersApiClient = Pick<AugurAPI, "customers">;
|
|
|
10
10
|
* cache.
|
|
11
11
|
*/
|
|
12
12
|
export type CustomersActionsConfig = SpecReadConfig;
|
|
13
|
+
/**
|
|
14
|
+
* Each `customerId` is a P21 customer's `address.id`: 0 and anything that is not a whole number at
|
|
15
|
+
* least 1 (and, from untyped callers, "" and "0") are refused before any request (augur-utils
|
|
16
|
+
* `resolveAddressId`, atlas#95). Resolve a session's text with `resolveAddressId` first.
|
|
17
|
+
*/
|
|
13
18
|
export interface CustomersActions {
|
|
14
19
|
customerLookup: (params: CustomersTypes.CustomerLookupGetParams) => Promise<ListResult<CustomersTypes.CustomerLookupGetItem>>;
|
|
15
20
|
getCustomerDoc: (customerId: number) => Promise<CustomerDocument>;
|
|
@@ -35,8 +40,8 @@ export interface CustomersActions {
|
|
|
35
40
|
* cachePrefix: "example:",
|
|
36
41
|
* });
|
|
37
42
|
*
|
|
38
|
-
* const customer = await customersActions.getCustomerDoc(
|
|
39
|
-
* const orders = await customersActions.getCustomerOrders(
|
|
43
|
+
* const customer = await customersActions.getCustomerDoc(4096);
|
|
44
|
+
* const orders = await customersActions.getCustomerOrders(4096);
|
|
40
45
|
* ``` */
|
|
41
46
|
export declare function createCustomersActions(api: CustomersApiClient, config?: CustomersActionsConfig): CustomersActions;
|
|
42
47
|
//# sourceMappingURL=customers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customers.d.ts","sourceRoot":"","sources":["../../src/actions/customers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC1E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAKL,KAAK,OAAO,EACZ,KAAK,cAAc,EACpB,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"customers.d.ts","sourceRoot":"","sources":["../../src/actions/customers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC1E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAKL,KAAK,OAAO,EACZ,KAAK,cAAc,EACpB,MAAM,oBAAoB,CAAC;AAc5B,sEAAsE;AACtE,MAAM,MAAM,kBAAkB,GAAG,IAAI,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;AAM7D;;;;GAIG;AACH,MAAM,MAAM,sBAAsB,GAAG,cAAc,CAAC;AAEpD;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAC/B,cAAc,EAAE,CACd,MAAM,EAAE,cAAc,CAAC,uBA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, TPasswordVerification } from "@simpleapps-com/augur-utils";
|
|
2
|
+
import type { AddressId, MenuItem, TJoomlaContent, TMenu, TPasswordVerification } from "@simpleapps-com/augur-utils";
|
|
3
3
|
import type { ListResult } from "../sdk-call";
|
|
4
4
|
import { type SpecReadConfig } from "../cache/spec-read";
|
|
5
5
|
/** Derived from augur-api SDK — keeps types in sync automatically. */
|
|
@@ -13,7 +13,8 @@ export interface NormalizedUserProfile {
|
|
|
13
13
|
id: string;
|
|
14
14
|
name: string;
|
|
15
15
|
email: string;
|
|
16
|
-
|
|
16
|
+
/** The user's P21 customer, or null when the profile has none ("" or "0" in Joomla; atlas#95). */
|
|
17
|
+
customerId: AddressId | null;
|
|
17
18
|
permissions: string[];
|
|
18
19
|
}
|
|
19
20
|
export interface JoomlaActions {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"joomla.d.ts","sourceRoot":"","sources":["../../src/actions/joomla.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,KAAK,EACV,QAAQ,EACR,cAAc,EACd,KAAK,EACL,qBAAqB,EAEtB,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"joomla.d.ts","sourceRoot":"","sources":["../../src/actions/joomla.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,KAAK,EACV,SAAS,EACT,QAAQ,EACR,cAAc,EACd,KAAK,EACL,qBAAqB,EAEtB,MAAM,6BAA6B,CAAC;AAErC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAML,KAAK,cAAc,EACpB,MAAM,oBAAoB,CAAC;AAiB5B,sEAAsE;AACtE,MAAM,MAAM,eAAe,GAAG,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;AAEvD;;;GAGG;AACH,MAAM,MAAM,mBAAm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;;;;;;;;;;;;;SAgBS;AACT,wBAAgB,mBAAmB,CACjC,GAAG,EAAE,eAAe,EACpB,MAAM,GAAE,mBAAwB,GAC/B,aAAa,CAyHf"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pricing.d.ts","sourceRoot":"","sources":["../../src/actions/pricing.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAgB,MAAM,2BAA2B,CAAC;AAExE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAM9E,sEAAsE;AACtE,MAAM,MAAM,gBAAgB,GAAG,IAAI,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"pricing.d.ts","sourceRoot":"","sources":["../../src/actions/pricing.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAgB,MAAM,2BAA2B,CAAC;AAExE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAM9E,sEAAsE;AACtE,MAAM,MAAM,gBAAgB,GAAG,IAAI,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;AAMzD,MAAM,WAAW,oBAAoB;IACnC,+DAA+D;IAC/D,iBAAiB,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACpC,uDAAuD;IACvD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,8DAA8D;IAC9D,SAAS,CAAC,EAAE,cAAc,CAAC;IAC3B,sEAAsE;IACtE,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,oEAAoE;IACpE,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,MAAM,WAAW,cAAc;IAC7B;;;;OAIG;IACH,YAAY,EAAE,CACZ,MAAM,EAAE,MAAM,EACd,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,EAC5B,QAAQ,CAAC,EAAE,MAAM,EACjB,aAAa,CAAC,EAAE,MAAM,KACnB,OAAO,CAAC,UAAU,CAAC,CAAC;IAEzB,kBAAkB,EAAE,CAClB,OAAO,EAAE,MAAM,EAAE,EACjB,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,EAC5B,QAAQ,CAAC,EAAE,MAAM,EACjB,aAAa,CAAC,EAAE,MAAM,KACnB,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC;IAEzC,cAAc,EAAE,CACd,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,EAC5B,UAAU,CAAC,EAAE,MAAM,EACnB,KAAK,CAAC,EAAE,QAAQ,EAAE,KACf,OAAO,CAAC,IAAI,CAAC,CAAC;CACpB;AAED;;;;;;;;;;;;;;;;;;;;SAoBS;AACT,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,gBAAgB,EACrB,MAAM,GAAE,oBAAyB,GAChC,cAAc,CAiFhB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type AddressIdInput } from "@simpleapps-com/augur-utils";
|
|
2
|
+
import type { AddressId } from "../address-id";
|
|
3
|
+
/**
|
|
4
|
+
* The customer a customer-scoped call is asked for: the first usable one of `candidates`
|
|
5
|
+
* (augur-utils `resolveAddressId`, so "", "0" and 0 are passed over), or a throw with the
|
|
6
|
+
* caller's `refusal` when none is (the proved `customerRefusalOf`, atlas#95).
|
|
7
|
+
*/
|
|
8
|
+
export declare function requireCustomer(refusal: string, ...candidates: AddressIdInput[]): AddressId;
|
|
9
|
+
//# sourceMappingURL=require-customer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"require-customer.d.ts","sourceRoot":"","sources":["../../src/actions/require-customer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,cAAc,EAAE,MAAM,6BAA6B,CAAC;AACpF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAG/C;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,UAAU,EAAE,cAAc,EAAE,GAAG,SAAS,CAM3F"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* augur-server's `AddressId`: the same brand as augur-utils' (foundation's `PosInt`), so each is
|
|
3
|
+
* the other's type; `test/rules.test.ts` pins that. Declared here, not imported, because lsc reads
|
|
4
|
+
* a type from another package out of its built `.d.ts`, where the `//@ type` line is gone
|
|
5
|
+
* (models/LSC-GAPS.md); the proved `rules.ts` imports it. Make values with augur-utils'
|
|
6
|
+
* `resolveAddressId` / `addressIdOf` (atlas#95).
|
|
7
|
+
*/
|
|
8
|
+
/** A usable P21 address id (a customer, ship-to, supplier or vendor id): a whole number ≥ 1. */
|
|
9
|
+
export type AddressId = number & {
|
|
10
|
+
readonly __posInt: true;
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=address-id.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"address-id.d.ts","sourceRoot":"","sources":["../src/address-id.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,gGAAgG;AAEhG,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAA;CAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-handler.d.ts","sourceRoot":"","sources":["../src/api-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;
|
|
1
|
+
{"version":3,"file":"api-handler.d.ts","sourceRoot":"","sources":["../src/api-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AA4BH;;;;;;;;;;;;GAYG;AACH,wBAAgB,qBAAqB,KACrB,KAAK,OAAO,KAAG,OAAO,CAAC,QAAQ,CAAC,CAoC/C"}
|
package/dist/api.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
queryAction,
|
|
3
3
|
queryActionRaw
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-Y54RGILF.js";
|
|
5
|
+
import "./chunk-ILXNFJVM.js";
|
|
5
6
|
import {
|
|
6
7
|
answersFullOf,
|
|
7
8
|
apiMessageOf,
|
|
@@ -9,10 +10,11 @@ import {
|
|
|
9
10
|
bodyOutcomeOf,
|
|
10
11
|
isCrossOrigin,
|
|
11
12
|
runsOf
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import "./chunk-
|
|
13
|
+
} from "./chunk-5DBFTSWY.js";
|
|
14
|
+
import "./chunk-HGJF667G.js";
|
|
14
15
|
|
|
15
16
|
// src/api-handler.ts
|
|
17
|
+
import { errorLogLine } from "@simpleapps-com/augur-utils";
|
|
16
18
|
function refusal(outcome) {
|
|
17
19
|
return new Response(apiMessageOf(outcome), { status: apiStatusOf(outcome) });
|
|
18
20
|
}
|
|
@@ -37,8 +39,8 @@ function createAugurApiHandler() {
|
|
|
37
39
|
const result = answersFullOf(outcome) ? await queryActionRaw(methodPath, ...args) : await queryAction(methodPath, ...args);
|
|
38
40
|
return Response.json(result);
|
|
39
41
|
} catch (error) {
|
|
40
|
-
|
|
41
|
-
return new Response(
|
|
42
|
+
console.error(errorLogLine("[augur-api] call failed", error));
|
|
43
|
+
return new Response("Internal server error", { status: 500 });
|
|
42
44
|
}
|
|
43
45
|
};
|
|
44
46
|
}
|
package/dist/api.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/api-handler.ts"],"sourcesContent":["/**\n * Generic API route handler for fetch-mode proxy.\n *\n * Exposes the existing queryAction as an HTTP POST endpoint so that\n * `createFetchQueryAction()` from augur-core can route calls through\n * fetch() instead of server actions. This is needed on platforms where\n * server actions cannot access request cookies (e.g., CF Workers via OpenNext).\n *\n * The handler validates same-origin requests via the Sec-Fetch-Site header\n * (set by browsers automatically and cannot be forged by scripts).\n */\n\nimport type { AugurAPI } from \"@simpleapps-com/augur-api\";\nimport type { MethodPath } from \"@simpleapps-com/augur-core\";\nimport { queryAction, queryActionRaw } from \"./query-action\";\nimport {\n answersFullOf,\n apiMessageOf,\n apiStatusOf,\n bodyOutcomeOf,\n isCrossOrigin,\n runsOf,\n type ApiOutcome,\n} from \"./rules\";\n\n/** A refused request's response: the outcome's text and status. */\nfunction refusal(outcome: ApiOutcome): Response {\n return new Response(apiMessageOf(outcome), { status: apiStatusOf(outcome) });\n}\n\n/** Request body shape for the API handler; `raw: true` asks for the full response. */\ninterface AugurApiRequestBody {\n methodPath: string;\n args: unknown[];\n raw?: unknown;\n}\n\n/**\n * Creates a Next.js Route Handler that routes method calls through queryAction, or through\n * queryActionRaw when the body has `raw: true` (augur-core's `createFetchQueryActionRaw`).\n *\n * @example\n * ```ts\n * // app/api/augur/route.ts\n * import { createAugurApiHandler } from \"@simpleapps-com/augur-server/api\";\n *\n * const handler = createAugurApiHandler();\n * export const POST = handler;\n * ```\n */\nexport function createAugurApiHandler() {\n return async (req: Request): Promise<Response> => {\n // Same-origin validation: Sec-Fetch-Site is set by browsers and\n // cannot be forged by JavaScript. Reject cross-origin requests.\n if (isCrossOrigin(req.headers.get(\"sec-fetch-site\") ?? \"\")) return refusal(\"forbidden\");\n\n let body: AugurApiRequestBody;\n try {\n body = (await req.json()) as AugurApiRequestBody;\n } catch {\n return refusal(\"bad-json\");\n }\n\n const { methodPath, args, raw } = body;\n const outcome = bodyOutcomeOf(\n true,\n typeof methodPath === \"string\" && methodPath !== \"\",\n Array.isArray(args),\n raw === true,\n );\n if (!runsOf(outcome)) return refusal(outcome);\n\n try {\n // The path arrives in a request, so it has no literal type: typed as any method path, its\n // arguments are unknown[] (atlas#103), and the allowlist checks it at runtime\n const result = answersFullOf(outcome)\n ? await queryActionRaw(methodPath, ...args)\n : await queryAction(methodPath as MethodPath<AugurAPI>, ...args);\n return Response.json(result);\n } catch (error) {\n
|
|
1
|
+
{"version":3,"sources":["../src/api-handler.ts"],"sourcesContent":["/**\n * Generic API route handler for fetch-mode proxy.\n *\n * Exposes the existing queryAction as an HTTP POST endpoint so that\n * `createFetchQueryAction()` from augur-core can route calls through\n * fetch() instead of server actions. This is needed on platforms where\n * server actions cannot access request cookies (e.g., CF Workers via OpenNext).\n *\n * The handler validates same-origin requests via the Sec-Fetch-Site header\n * (set by browsers automatically and cannot be forged by scripts).\n */\n\nimport type { AugurAPI } from \"@simpleapps-com/augur-api\";\nimport type { MethodPath } from \"@simpleapps-com/augur-core\";\nimport { errorLogLine } from \"@simpleapps-com/augur-utils\";\nimport { queryAction, queryActionRaw } from \"./query-action\";\nimport {\n answersFullOf,\n apiMessageOf,\n apiStatusOf,\n bodyOutcomeOf,\n isCrossOrigin,\n runsOf,\n type ApiOutcome,\n} from \"./rules\";\n\n/** A refused request's response: the outcome's text and status. */\nfunction refusal(outcome: ApiOutcome): Response {\n return new Response(apiMessageOf(outcome), { status: apiStatusOf(outcome) });\n}\n\n/** Request body shape for the API handler; `raw: true` asks for the full response. */\ninterface AugurApiRequestBody {\n methodPath: string;\n args: unknown[];\n raw?: unknown;\n}\n\n/**\n * Creates a Next.js Route Handler that routes method calls through queryAction, or through\n * queryActionRaw when the body has `raw: true` (augur-core's `createFetchQueryActionRaw`).\n *\n * @example\n * ```ts\n * // app/api/augur/route.ts\n * import { createAugurApiHandler } from \"@simpleapps-com/augur-server/api\";\n *\n * const handler = createAugurApiHandler();\n * export const POST = handler;\n * ```\n */\nexport function createAugurApiHandler() {\n return async (req: Request): Promise<Response> => {\n // Same-origin validation: Sec-Fetch-Site is set by browsers and\n // cannot be forged by JavaScript. Reject cross-origin requests.\n if (isCrossOrigin(req.headers.get(\"sec-fetch-site\") ?? \"\")) return refusal(\"forbidden\");\n\n let body: AugurApiRequestBody;\n try {\n body = (await req.json()) as AugurApiRequestBody;\n } catch {\n return refusal(\"bad-json\");\n }\n\n const { methodPath, args, raw } = body;\n const outcome = bodyOutcomeOf(\n true,\n typeof methodPath === \"string\" && methodPath !== \"\",\n Array.isArray(args),\n raw === true,\n );\n if (!runsOf(outcome)) return refusal(outcome);\n\n try {\n // The path arrives in a request, so it has no literal type: typed as any method path, its\n // arguments are unknown[] (atlas#103), and the allowlist checks it at runtime\n const result = answersFullOf(outcome)\n ? await queryActionRaw(methodPath, ...args)\n : await queryAction(methodPath as MethodPath<AugurAPI>, ...args);\n return Response.json(result);\n } catch (error) {\n // The browser gets a fixed message; the error's type goes to the server's log only. Its\n // message can carry SDK and network internals (model AugurServerSecurity,\n // ErrorsNeverCarryInternals, NoLogCarriesData).\n console.error(errorLogLine(\"[augur-api] call failed\", error));\n return new Response(\"Internal server error\", { status: 500 });\n }\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAcA,SAAS,oBAAoB;AAa7B,SAAS,QAAQ,SAA+B;AAC9C,SAAO,IAAI,SAAS,aAAa,OAAO,GAAG,EAAE,QAAQ,YAAY,OAAO,EAAE,CAAC;AAC7E;AAsBO,SAAS,wBAAwB;AACtC,SAAO,OAAO,QAAoC;AAGhD,QAAI,cAAc,IAAI,QAAQ,IAAI,gBAAgB,KAAK,EAAE,EAAG,QAAO,QAAQ,WAAW;AAEtF,QAAI;AACJ,QAAI;AACF,aAAQ,MAAM,IAAI,KAAK;AAAA,IACzB,QAAQ;AACN,aAAO,QAAQ,UAAU;AAAA,IAC3B;AAEA,UAAM,EAAE,YAAY,MAAM,IAAI,IAAI;AAClC,UAAM,UAAU;AAAA,MACd;AAAA,MACA,OAAO,eAAe,YAAY,eAAe;AAAA,MACjD,MAAM,QAAQ,IAAI;AAAA,MAClB,QAAQ;AAAA,IACV;AACA,QAAI,CAAC,OAAO,OAAO,EAAG,QAAO,QAAQ,OAAO;AAE5C,QAAI;AAGF,YAAM,SAAS,cAAc,OAAO,IAChC,MAAM,eAAe,YAAY,GAAG,IAAI,IACxC,MAAM,YAAY,YAAoC,GAAG,IAAI;AACjE,aAAO,SAAS,KAAK,MAAM;AAAA,IAC7B,SAAS,OAAO;AAId,cAAQ,MAAM,aAAa,2BAA2B,KAAK,CAAC;AAC5D,aAAO,IAAI,SAAS,yBAAyB,EAAE,QAAQ,IAAI,CAAC;AAAA,IAC9D;AAAA,EACF;AACF;","names":[]}
|
package/dist/auth.d.ts
CHANGED
|
@@ -10,17 +10,43 @@ export interface AugurUser {
|
|
|
10
10
|
customerId?: string | number;
|
|
11
11
|
contactId?: string | number;
|
|
12
12
|
cartHdrUid?: number;
|
|
13
|
-
token?: string;
|
|
14
13
|
/** Target site ID for cross-site auth sessions (augur_info + body siteId). */
|
|
15
14
|
targetSiteId?: string;
|
|
15
|
+
/**
|
|
16
|
+
* True when Joomla has blocked the account. A profile that says so ends the session on its
|
|
17
|
+
* next read (owner 2026-11-16: a blocked account "can't have a session"). A site's own
|
|
18
|
+
* `getUserProfile` SHOULD set it from the users doc's `block`.
|
|
19
|
+
*/
|
|
20
|
+
blocked?: boolean;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Joomla's answer to `joomla.users.verifyPassword`: the user's `id` (0 when the password did not
|
|
24
|
+
* match), `isVerified`, and a user `token` (null without a match). augur answers `id` and `token`
|
|
25
|
+
* only when `isVerified` (VerifyPassword.php).
|
|
26
|
+
*/
|
|
27
|
+
export interface PasswordAnswer {
|
|
28
|
+
id: number;
|
|
29
|
+
isVerified: boolean;
|
|
30
|
+
username?: string;
|
|
31
|
+
token?: string | null;
|
|
16
32
|
}
|
|
17
|
-
/**
|
|
33
|
+
/**
|
|
34
|
+
* Session shape returned by all Augur sites. It reaches the browser (`/api/auth/session`,
|
|
35
|
+
* `useSession`), so it never carries the user's Augur token: that stays in the encrypted JWT
|
|
36
|
+
* ({@link AugurJWT}), where server code reads it (atlas#212).
|
|
37
|
+
*/
|
|
18
38
|
export interface AugurSession {
|
|
19
39
|
user: AugurUser;
|
|
20
|
-
token?: string;
|
|
21
40
|
targetSiteId?: string;
|
|
22
41
|
expires: string;
|
|
23
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* What a site does for a signed-in user whose profile has no usable P21 customer (atlas#212):
|
|
45
|
+
* `"default"` acts as the site's `defaultCustomerId` (a retail site, or the legacy rule for an
|
|
46
|
+
* unapproved account); `"none"` gives them no customer and no cart (a B2B portal, where the
|
|
47
|
+
* default customer's orders are not theirs). Required: there is no safe default either way.
|
|
48
|
+
*/
|
|
49
|
+
export type WithoutCustomer = "default" | "none";
|
|
24
50
|
/** JWT token shape used by Augur auth. */
|
|
25
51
|
export interface AugurJWT {
|
|
26
52
|
id: string;
|
|
@@ -33,10 +59,20 @@ export interface AugurJWT {
|
|
|
33
59
|
export interface AugurAuthCallbacks {
|
|
34
60
|
/** Fetch user profile from the Augur API given the user's Joomla ID. */
|
|
35
61
|
getUserProfile: (userId: string) => Promise<AugurUser | null>;
|
|
36
|
-
/**
|
|
37
|
-
|
|
62
|
+
/**
|
|
63
|
+
* Look up or create a cart header for the authenticated user. `customerId` is always a usable
|
|
64
|
+
* P21 customer id (resolved by augur-utils `resolveAddressId`): without one no lookup is made
|
|
65
|
+
* (atlas#95).
|
|
66
|
+
*/
|
|
67
|
+
cartHdrLookup?: (userId: string | number, token: string, contactId: string | number, customerId: number) => Promise<{
|
|
38
68
|
cartHdrUid?: number;
|
|
39
69
|
} | null>;
|
|
70
|
+
/**
|
|
71
|
+
* Check a username and password with Joomla, on the server (atlas#97). `siteId` is passed only
|
|
72
|
+
* on the cross-site (augur_info) site: the site whose password is checked. The package's own
|
|
73
|
+
* calls `joomla.users.verifyPassword`.
|
|
74
|
+
*/
|
|
75
|
+
verifyPassword: (username: string, password: string, siteId?: string) => Promise<PasswordAnswer>;
|
|
40
76
|
}
|
|
41
77
|
/** Derived from augur-api SDK — keeps types in sync automatically. */
|
|
42
78
|
export type AugurAuthClient = Pick<AugurAPI, "joomla" | "commerce">;
|
|
@@ -49,8 +85,10 @@ export interface CreateAuthConfigOptions {
|
|
|
49
85
|
secret?: string;
|
|
50
86
|
/** Session max age in seconds (defaults to 4 hours). */
|
|
51
87
|
maxAge?: number;
|
|
52
|
-
/**
|
|
88
|
+
/** The site's default customer, used for a signed-in user only with `withoutCustomer: "default"`. */
|
|
53
89
|
defaultCustomerId?: string | number;
|
|
90
|
+
/** A signed-in user with no usable customer of their own: see {@link WithoutCustomer}. */
|
|
91
|
+
withoutCustomer: WithoutCustomer;
|
|
54
92
|
/** Default contact ID for cart header lookups. */
|
|
55
93
|
defaultContactId?: string | number;
|
|
56
94
|
/** Enable NextAuth debug logging (defaults to NODE_ENV === "development"). */
|
package/dist/auth.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAE1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAkBhD,sDAAsD;AACtD,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,OAAO,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC7B,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC5B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,8EAA8E;IAC9E,YAAY,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AED,sEAAsE;AACtE,MAAM,MAAM,eAAe,GAAG,IAAI,CAAC,QAAQ,EAAE,QAAQ,GAAG,UAAU,CAAC,CAAC;AAEpE,MAAM,WAAW,uBAAuB;IACtC,8EAA8E;IAC9E,WAAW,CAAC,EAAE,eAAe,CAAC;IAC9B,2FAA2F;IAC3F,SAAS,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAC;IACxC,yDAAyD;IACzD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,wDAAwD;IACxD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,qGAAqG;IACrG,iBAAiB,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACpC,0FAA0F;IAC1F,eAAe,EAAE,eAAe,CAAC;IACjC,kDAAkD;IAClD,gBAAgB,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACnC,8EAA8E;IAC9E,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AA0JD,8HAA8H;AAC9H,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,uBAAuB,GAAG,cAAc,CAoKjF"}
|
package/dist/auth.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createAuthConfig
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-M35O5JDZ.js";
|
|
4
|
+
import "./chunk-ILXNFJVM.js";
|
|
5
|
+
import "./chunk-5DBFTSWY.js";
|
|
6
|
+
import "./chunk-HGJF667G.js";
|
|
6
7
|
export {
|
|
7
8
|
createAuthConfig
|
|
8
9
|
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
indexOfCode,
|
|
3
|
+
lowerAscii,
|
|
3
4
|
startsWithAt
|
|
4
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-HGJF667G.js";
|
|
5
6
|
|
|
6
7
|
// ../foundation/src/duration.ts
|
|
7
8
|
function seconds(n) {
|
|
@@ -116,23 +117,20 @@ function recordFailureOf(c, now) {
|
|
|
116
117
|
function recordSuccessOf(c) {
|
|
117
118
|
return { failures: 0, openUntil: c.openUntil };
|
|
118
119
|
}
|
|
119
|
-
function verifiedFlag(s) {
|
|
120
|
-
return s === "true";
|
|
121
|
-
}
|
|
122
120
|
function recaptchaOk(hasSecret, httpOk, success) {
|
|
123
121
|
return hasSecret && httpOk && success === true;
|
|
124
122
|
}
|
|
125
|
-
function
|
|
126
|
-
return
|
|
123
|
+
function cartLookupRuns(hasLookup, hasUserId, customerId) {
|
|
124
|
+
return hasLookup && hasUserId && customerId !== null;
|
|
125
|
+
}
|
|
126
|
+
function customerRefusalOf(customerId, refusal) {
|
|
127
|
+
return customerId === null ? refusal : null;
|
|
127
128
|
}
|
|
128
129
|
function itemsLimitOf(limit) {
|
|
129
130
|
if (limit === void 0) return 24;
|
|
130
131
|
if (limit === 0) return 24;
|
|
131
132
|
return limit;
|
|
132
133
|
}
|
|
133
|
-
function crossSiteOf(flag) {
|
|
134
|
-
return flag === true;
|
|
135
|
-
}
|
|
136
134
|
function readsSession(crossSite, hasSecret) {
|
|
137
135
|
return crossSite && hasSecret;
|
|
138
136
|
}
|
|
@@ -140,7 +138,7 @@ function signInTarget(crossSite, siteId) {
|
|
|
140
138
|
if (!crossSite) return void 0;
|
|
141
139
|
if (siteId === void 0) return void 0;
|
|
142
140
|
if (siteId === "") return void 0;
|
|
143
|
-
return siteId;
|
|
141
|
+
return lowerAscii(siteId);
|
|
144
142
|
}
|
|
145
143
|
function resolutionOf(minted, scopedMade, hasGlobal) {
|
|
146
144
|
if (minted && scopedMade) return "scoped";
|
|
@@ -298,11 +296,10 @@ export {
|
|
|
298
296
|
opensAt,
|
|
299
297
|
recordFailureOf,
|
|
300
298
|
recordSuccessOf,
|
|
301
|
-
verifiedFlag,
|
|
302
299
|
recaptchaOk,
|
|
303
|
-
|
|
300
|
+
cartLookupRuns,
|
|
301
|
+
customerRefusalOf,
|
|
304
302
|
itemsLimitOf,
|
|
305
|
-
crossSiteOf,
|
|
306
303
|
readsSession,
|
|
307
304
|
signInTarget,
|
|
308
305
|
resolutionOf,
|
|
@@ -330,4 +327,4 @@ export {
|
|
|
330
327
|
getOrCreateScopedClient,
|
|
331
328
|
parseMethodPath
|
|
332
329
|
};
|
|
333
|
-
//# sourceMappingURL=chunk-
|
|
330
|
+
//# sourceMappingURL=chunk-5DBFTSWY.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../foundation/src/duration.ts","../../utils/src/includes.ts","../src/rules.ts","../src/scoped-client-key.ts","../src/sdk-client-store.ts"],"sourcesContent":["//@ backend dafny\n\n/* Seconds and milliseconds as two types (2026-11-08). Verified with LemmaScript → Dafny\n (`pnpm proofs`; model: models/Durations.dfy, where they are two datatypes; link:\n models/links/foundation-duration.dfy).\n\n Both are branded: a plain `number` is neither, and a `Seconds` is not a `Millis`, so a TTL in\n seconds can't be passed where milliseconds are meant (augur-core's `staleTime` vs\n `redisTtl`), and a JWT `exp` can't be compared with `Date.now()` unconverted. Write a\n duration in the unit people think in (`minutes(15)`) and convert with `toMillis`; read a\n clock or a millisecond count back with `floorSeconds`. Values enter through the guards\n `secondsOf` / `millisOf` (an env value, a JSON `expires_in`); the clock is `millis(Date.now())`\n (the platform's time value is a whole, non-negative number of milliseconds).\n lsc writes both aliases as `nat` (no refinement, models/LSC-GAPS.md). */\n\n/** A whole number of seconds, made only by the builders and guards below. */\n//@ type nat\nexport type Seconds = number & { readonly __seconds: true };\n\n/** A whole number of milliseconds, made only by the builders and guards below. */\n//@ type nat\nexport type Millis = number & { readonly __millis: true };\n\n/**\n * `n` seconds.\n *\n * @ensures exactly the model's Seconds(n)\n */\nexport function seconds(n: number): Seconds {\n //@ verify\n //@ type n nat\n //@ requires n >= 0\n //@ ensures \\result === n\n return n as Seconds;\n}\n\n/**\n * `n` minutes, in seconds.\n *\n * @ensures exactly the model's Minutes\n */\nexport function minutes(n: number): Seconds {\n //@ verify\n //@ type n nat\n //@ requires n >= 0\n //@ ensures \\result === n * 60\n return (n * 60) as Seconds;\n}\n\n/**\n * `n` hours, in seconds.\n *\n * @ensures exactly the model's Hours\n */\nexport function hours(n: number): Seconds {\n //@ verify\n //@ type n nat\n //@ requires n >= 0\n //@ ensures \\result === n * 3600\n return (n * 3600) as Seconds;\n}\n\n/**\n * `n` days, in seconds.\n *\n * @ensures exactly the model's Days\n */\nexport function days(n: number): Seconds {\n //@ verify\n //@ type n nat\n //@ requires n >= 0\n //@ ensures \\result === n * 86400\n return (n * 86400) as Seconds;\n}\n\n/**\n * `n` milliseconds: for a duration under a second (a retry backoff, a debounce).\n *\n * @ensures exactly the model's Millis(n)\n */\nexport function millis(n: number): Millis {\n //@ verify\n //@ type n nat\n //@ requires n >= 0\n //@ ensures \\result === n\n return n as Millis;\n}\n\n/**\n * Seconds as milliseconds, exactly.\n *\n * @ensures exactly the model's ToMillis\n */\nexport function toMillis(d: Seconds): Millis {\n //@ verify\n //@ requires d >= 0\n //@ ensures \\result === d * 1000\n return (d * 1000) as Millis;\n}\n\n/**\n * Milliseconds as whole seconds, rounded down (a JWT `exp` or `iat` from a clock).\n *\n * @ensures exactly the model's FloorSeconds\n */\nexport function floorSeconds(m: Millis): Seconds {\n //@ verify\n //@ type m nat\n //@ requires m >= 0\n //@ ensures \\result === Math.floor(m / 1000)\n return Math.floor(m / 1000) as Seconds;\n}\n\n/**\n * A clock reading plus a duration, both `Millis`: when something expires (`addMillis(now,\n * toMillis(minutes(15)))`).\n *\n * @ensures exactly the model's AddMillis\n */\nexport function addMillis(a: Millis, b: Millis): Millis {\n //@ verify\n //@ requires a >= 0 && b >= 0\n //@ ensures \\result === a + b\n return (a + b) as Millis;\n}\n\n/**\n * A reading less a duration, never below 0 (a token used until a minute before it expires). An\n * expiry clamped to 0 is no more live than the negative one it stands for (the model's\n * MinusMillisKeepsLiveness).\n *\n * @ensures exactly the model's MinusMillis\n */\nexport function minusMillis(a: Millis, b: Millis): Millis {\n //@ verify\n //@ requires a >= 0 && b >= 0\n //@ ensures \\result === (a >= b ? a - b : 0)\n return a >= b ? ((a - b) as Millis) : millis(0);\n}\n\n/**\n * `n` as `Seconds`, or null when it is not a safe integer at least 0: a fraction, NaN, a\n * negative, an infinity, or past `Number.MAX_SAFE_INTEGER`. Where a number of seconds enters.\n *\n * @ensures exactly the model's AcceptedAsDuration, and the value is kept\n */\nexport function secondsOf(n: number): Seconds | null {\n //@ verify\n //@ ensures (\\result !== null) <==> (n >= 0 && n <= 9007199254740991)\n //@ ensures \\result !== null ==> \\result === n\n return Math.floor(n) === n && n >= 0 && n <= 9007199254740991 ? (n as Seconds) : null;\n}\n\n/**\n * An outside count of seconds (a token's `expires_in`, a JWT's `exp`) as `Seconds`: rounded\n * down, and 0 when it is then no safe integer at least 0 (a negative, NaN, an infinity), so a\n * bad lifetime is no lifetime and a bad expiry is already past.\n *\n * @ensures exactly the model's WholeSeconds (the proof reads a number as an integer)\n */\nexport function wholeSeconds(n: number): Seconds {\n //@ verify\n //@ ensures (n >= 0 && n <= 9007199254740991) ==> \\result === n\n //@ ensures !(n >= 0 && n <= 9007199254740991) ==> \\result === 0\n const whole = secondsOf(Math.floor(n));\n return whole === null ? seconds(0) : whole;\n}\n\n/**\n * `n` as `Millis`, or null when it is not a safe integer at least 0 (the same rule as\n * `secondsOf`). Where a number of milliseconds enters.\n *\n * @ensures exactly the model's AcceptedAsDuration, and the value is kept\n */\nexport function millisOf(n: number): Millis | null {\n //@ verify\n //@ ensures (\\result !== null) <==> (n >= 0 && n <= 9007199254740991)\n //@ ensures \\result !== null ==> \\result === n\n return Math.floor(n) === n && n >= 0 && n <= 9007199254740991 ? (n as Millis) : null;\n}\n","//@ backend dafny\nimport { startsWithAt } from \"./strings\";\n\n/* Substring search from an index, verified with LemmaScript → Dafny (model: models/Utils.dfy\n IncludesFrom; link: models/links/utils-includes.dfy). Its own file (moved out of strings.ts,\n 2026-11-06) so its contract can name `startsWithAt`: lsc gives an importer a helper from\n another file with that helper's contract, never one from the same file (models/LSC-GAPS.md). */\n\n/**\n * Whether `x` occurs in `s` at some index ≥ `i` (JS `s.includes(x, i)`). `i` MUST be at most\n * |s|: past the end JS clamps it to |s| (Fable review 2026-11-06), so a start there is the end.\n *\n * A loop, so its depth doesn't grow with `s` (agr-entity-graphql runs it on a whole schema's JSON).\n *\n * @requires i ≤ |s|\n * @ensures result ⟺ ∃ k. i ≤ k ≤ |s| ∧ startsWithAt(s, x, k) — exactly the model's IncludesFrom\n */\nexport function includesFrom(s: string, x: string, i: number): boolean {\n //@ verify\n //@ type i nat\n //@ requires i >= 0 && i <= s.length\n //@ ensures \\result <==> exists(k: nat, i <= k && k <= s.length && startsWithAt(s, x, k))\n for (let k = i; k !== s.length + 1; k++) {\n //@ invariant i <= k && k <= s.length + 1\n //@ invariant forall(j: nat, (i <= j && j < k) ==> !startsWithAt(s, x, j))\n //@ decreases s.length + 1 - k\n if (startsWithAt(s, x, k)) return true;\n }\n return false;\n}\n","//@ backend dafny\nimport { addMillis, hours, millis, minutes, seconds, toMillis } from \"@atlas/foundation/duration\";\nimport { includesFrom } from \"@atlas/utils/includes\";\nimport { indexOfCode, lowerAscii } from \"@atlas/utils/strings\";\nimport type { AddressId } from \"./address-id\";\nimport type { Millis, Seconds } from \"./duration\";\n\n/* The server's decisions, as pure functions verified with LemmaScript → Dafny (model:\n models/AugurServer.dfy; link: models/links/augur-server-rules.dfy). Cookies, JWT decoding,\n fetch, Redis and process.env stay in the callers, which hand over plain values. */\n\n/**\n * The siteId of a bearer's client_id claim (`<n>|<siteId>`): the text after the first \"|\", when\n * there is one and it is non-empty. The prefix is not checked.\n *\n * @ensures exactly the model's ClientIdSiteId on a string claim\n */\nexport function clientIdSiteIdOf(clientId: string): string | null {\n //@ verify\n //@ ensures indexOfCode(clientId, 124, 0) < 0 ==> \\result === null\n //@ ensures indexOfCode(clientId, 124, 0) >= 0 && indexOfCode(clientId, 124, 0) + 1 >= clientId.length ==> \\result === null\n //@ ensures indexOfCode(clientId, 124, 0) >= 0 && indexOfCode(clientId, 124, 0) + 1 < clientId.length ==> \\result === clientId.slice(indexOfCode(clientId, 124, 0) + 1)\n const k = indexOfCode(clientId, 124, 0);\n if (k < 0) return null;\n if (k + 1 >= clientId.length) return null;\n return clientId.slice(k + 1);\n}\n\n/** A session's siteId and bearer token, as minted, or refused. */\nexport type Mint = { kind: \"minted\"; siteId: string; token: string } | { kind: \"refused\" };\n\n/**\n * getSessionCredentials' mint, once the secret and the decoded session are in hand: a valid\n * siteId (augur-api's `isSiteId`, checked by the caller), a non-empty token, and the bearer's\n * client_id siteId (`\"\"` for none: `clientIdSiteIdOf` never gives `\"\"`) equal to it.\n *\n * @ensures exactly the model's MintCredentials with a secret and a decoded session\n */\nexport function mintedCredentials(\n siteIdOk: boolean,\n targetSiteId: string,\n token: string,\n bearerSiteId: string,\n): Mint {\n //@ verify\n //@ ensures siteIdOk && token !== \"\" && bearerSiteId !== \"\" && bearerSiteId === targetSiteId ==> \\result.kind === \"minted\" && \\result.siteId === targetSiteId && \\result.token === token\n //@ ensures !(siteIdOk && token !== \"\" && bearerSiteId !== \"\" && bearerSiteId === targetSiteId) ==> \\result.kind === \"refused\"\n if (!siteIdOk || token === \"\" || bearerSiteId === \"\" || bearerSiteId !== targetSiteId) {\n return { kind: \"refused\" };\n }\n return { kind: \"minted\", siteId: targetSiteId, token };\n}\n\n/**\n * Whether there is another page: from the total when one is given, else a full page.\n *\n * @ensures exactly the model's HasMore\n */\nexport function hasMoreOf(\n page: number,\n limit: number,\n total: number | undefined,\n itemCount: number,\n): boolean {\n //@ verify\n //@ ensures total !== undefined ==> \\result === ((page + 1) * limit < total)\n //@ ensures total === undefined ==> \\result === (itemCount === limit)\n if (total !== undefined) return (page + 1) * limit < total;\n return itemCount === limit;\n}\n\n/**\n * The next page's cursor: page + 1 while there is more.\n *\n * @ensures exactly the model's NextCursor given HasMore\n */\nexport function nextCursorOf(hasMore: boolean, page: number): number | undefined {\n //@ verify\n //@ ensures hasMore ==> \\result === page + 1\n //@ ensures !hasMore ==> \\result === undefined\n if (hasMore) return page + 1;\n return undefined;\n}\n\n/** The deployment environment. */\nexport type Env = \"development\" | \"staging\" | \"production\";\n\n/**\n * DEPLOYMENT_ENV first; then the server's NODE_ENV; then the browser's host (substring). A missing\n * variable is \"\".\n *\n * @ensures exactly the model's EnvOf\n */\nexport function envOf(\n deploymentEnv: string,\n isServer: boolean,\n nodeEnv: string,\n host: string,\n): Env {\n //@ verify\n //@ ensures deploymentEnv === \"dev\" ==> \\result === \"staging\"\n //@ ensures deploymentEnv !== \"dev\" && deploymentEnv === \"live\" ==> \\result === \"production\"\n //@ ensures deploymentEnv !== \"dev\" && deploymentEnv !== \"live\" && isServer ==> \\result === serverEnvOf(nodeEnv)\n //@ ensures deploymentEnv !== \"dev\" && deploymentEnv !== \"live\" && !isServer ==> \\result === hostEnvOf(host)\n if (deploymentEnv === \"dev\") return \"staging\";\n if (deploymentEnv === \"live\") return \"production\";\n if (isServer) return serverEnvOf(nodeEnv);\n return hostEnvOf(host);\n}\n\n/**\n * On the server: development only for NODE_ENV \"development\".\n *\n * @ensures result = development ⟺ nodeEnv = \"development\", else production\n */\nexport function serverEnvOf(nodeEnv: string): Env {\n //@ verify\n //@ ensures nodeEnv === \"development\" ==> \\result === \"development\"\n //@ ensures nodeEnv !== \"development\" ==> \\result === \"production\"\n return nodeEnv === \"development\" ? \"development\" : \"production\";\n}\n\n/**\n * In the browser: localhost or 127.0.0.1 anywhere in the host is development, agr-hosting.dev\n * staging, anything else production.\n *\n * @ensures exactly the model's host rule\n */\nexport function hostEnvOf(host: string): Env {\n //@ verify\n //@ ensures (includesFrom(host, \"localhost\", 0) || includesFrom(host, \"127.0.0.1\", 0)) ==> \\result === \"development\"\n //@ ensures !(includesFrom(host, \"localhost\", 0) || includesFrom(host, \"127.0.0.1\", 0)) && includesFrom(host, \"agr-hosting.dev\", 0) ==> \\result === \"staging\"\n //@ ensures !(includesFrom(host, \"localhost\", 0) || includesFrom(host, \"127.0.0.1\", 0)) && !includesFrom(host, \"agr-hosting.dev\", 0) ==> \\result === \"production\"\n if (includesFrom(host, \"localhost\", 0) || includesFrom(host, \"127.0.0.1\", 0))\n return \"development\";\n if (includesFrom(host, \"agr-hosting.dev\", 0)) return \"staging\";\n return \"production\";\n}\n\n/**\n * The API route's outcome for a request: \"run\" answers queryAction's data, \"run-full\"\n * queryActionRaw's full response (atlas#107).\n */\nexport type ApiOutcome =\n \"forbidden\" | \"bad-json\" | \"bad-method-path\" | \"bad-args\" | \"run\" | \"run-full\";\n\n/**\n * A present, non-empty Sec-Fetch-Site other than same-origin is refused (a missing one, `\"\"`\n * from the caller, passes).\n *\n * @ensures result ⟺ fetchSite ∉ {\"\", \"same-origin\"}\n */\nexport function isCrossOrigin(fetchSite: string): boolean {\n //@ verify\n //@ ensures \\result === (fetchSite !== \"\" && fetchSite !== \"same-origin\")\n return fetchSite !== \"\" && fetchSite !== \"same-origin\";\n}\n\n/**\n * The body's outcome: JSON, then a non-empty methodPath string, then an args array; a valid\n * body with `raw: true` (`full`) runs for the full response, any other for its data.\n *\n * @ensures exactly the model's ApiOutcomeOf past the origin check\n */\nexport function bodyOutcomeOf(\n jsonOk: boolean,\n methodPathOk: boolean,\n argsIsArray: boolean,\n full: boolean,\n): ApiOutcome {\n //@ verify\n //@ ensures !jsonOk ==> \\result === \"bad-json\"\n //@ ensures jsonOk && !methodPathOk ==> \\result === \"bad-method-path\"\n //@ ensures jsonOk && methodPathOk && !argsIsArray ==> \\result === \"bad-args\"\n //@ ensures jsonOk && methodPathOk && argsIsArray && full ==> \\result === \"run-full\"\n //@ ensures jsonOk && methodPathOk && argsIsArray && !full ==> \\result === \"run\"\n if (!jsonOk) return \"bad-json\";\n if (!methodPathOk) return \"bad-method-path\";\n if (!argsIsArray) return \"bad-args\";\n if (full) return \"run-full\";\n return \"run\";\n}\n\n/**\n * The route runs the call: either view; any other outcome is a refusal.\n *\n * @ensures exactly the model's Runs\n */\nexport function runsOf(o: ApiOutcome): boolean {\n //@ verify\n //@ ensures \\result === (o === \"run\" || o === \"run-full\")\n return o === \"run\" || o === \"run-full\";\n}\n\n/**\n * The route answers the full response (queryActionRaw), not its data.\n *\n * @ensures exactly the model's AnswersFull\n */\nexport function answersFullOf(o: ApiOutcome): boolean {\n //@ verify\n //@ ensures \\result === (o === \"run-full\")\n return o === \"run-full\";\n}\n\n/**\n * An outcome's HTTP status: 403, 400 for a bad body, 200 to run.\n *\n * @ensures exactly the model's ApiStatus\n */\nexport function apiStatusOf(o: ApiOutcome): number {\n //@ verify\n //@ ensures o === \"forbidden\" ==> \\result === 403\n //@ ensures (o === \"bad-json\" || o === \"bad-method-path\" || o === \"bad-args\") ==> \\result === 400\n //@ ensures (o === \"run\" || o === \"run-full\") ==> \\result === 200\n if (o === \"forbidden\") return 403;\n if (o === \"run\" || o === \"run-full\") return 200;\n return 400;\n}\n\n/**\n * A refusal's response text (\"\" to run).\n *\n * @ensures each refusal has its fixed text\n */\nexport function apiMessageOf(o: ApiOutcome): string {\n //@ verify\n //@ ensures o === \"forbidden\" ==> \\result === \"Forbidden: cross-origin requests not allowed\"\n //@ ensures o === \"bad-json\" ==> \\result === \"Invalid JSON body\"\n //@ ensures o === \"bad-method-path\" ==> \\result === \"Missing or invalid methodPath\"\n //@ ensures o === \"bad-args\" ==> \\result === \"Missing or invalid args array\"\n //@ ensures (o === \"run\" || o === \"run-full\") ==> \\result === \"\"\n if (o === \"forbidden\") return \"Forbidden: cross-origin requests not allowed\";\n if (o === \"bad-json\") return \"Invalid JSON body\";\n if (o === \"bad-method-path\") return \"Missing or invalid methodPath\";\n if (o === \"bad-args\") return \"Missing or invalid args array\";\n return \"\";\n}\n\n/**\n * The Redis TTL for a cache tier: none for staleTime 0, the long TTL from an hour up, else the\n * standard one. `staleTime` is React Query's `Millis`, the TTLs Redis's `Seconds`; the hour is\n * compared in milliseconds.\n *\n * @ensures exactly the model's TtlFor\n */\nexport function ttlFor(\n staleTime: Millis,\n redisTtl: Seconds,\n longRedisTtl: Seconds,\n): Seconds | null {\n //@ verify\n //@ ensures staleTime === 0 ==> \\result === null\n //@ ensures staleTime !== 0 && staleTime >= 3600000 ==> \\result === longRedisTtl\n //@ ensures staleTime !== 0 && staleTime < 3600000 ==> \\result === redisTtl\n if (staleTime === 0) return null;\n if (staleTime >= toMillis(hours(1))) return longRedisTtl;\n return redisTtl;\n}\n\n/** The Redis circuit breaker's state: consecutive failures, and when it closes (0 = closed). */\nexport interface Circuit {\n failures: number;\n openUntil: Millis;\n}\n\n/** The circuit's answer at a time: whether it is open, and its state after the check. */\nexport interface CircuitAnswer {\n open: boolean;\n next: Circuit;\n}\n\n/**\n * isCircuitOpen at `now`: closed at openUntil 0; past it, reset and closed; else open.\n *\n * @ensures exactly the model's CircuitCheck\n */\nexport function circuitCheck(c: Circuit, now: Millis): CircuitAnswer {\n //@ verify\n //@ ensures c.openUntil === 0 ==> !\\result.open && \\result.next === c\n //@ ensures c.openUntil !== 0 && now >= c.openUntil ==> !\\result.open && \\result.next.failures === 0 && \\result.next.openUntil === 0\n //@ ensures c.openUntil !== 0 && now < c.openUntil ==> \\result.open && \\result.next === c\n if (c.openUntil === 0) return { open: false, next: c };\n if (now >= c.openUntil) return { open: false, next: { failures: 0, openUntil: millis(0) } };\n return { open: true, next: c };\n}\n\n/**\n * Whether a failure count opens the circuit: five in a row.\n *\n * @ensures result ⟺ failures ≥ 5\n */\nexport function opensAt(failures: number): boolean {\n //@ verify\n //@ ensures \\result === (failures >= 5)\n return failures >= 5;\n}\n\n/**\n * A failure counts; from the threshold on the circuit opens for a minute from now.\n *\n * @ensures exactly the model's RecordFailure\n */\nexport function recordFailureOf(c: Circuit, now: Millis): Circuit {\n //@ verify\n //@ ensures \\result.failures === c.failures + 1\n //@ ensures opensAt(c.failures + 1) ==> \\result.openUntil === now + 60000\n //@ ensures !opensAt(c.failures + 1) ==> \\result.openUntil === c.openUntil\n const failures = c.failures + 1;\n if (opensAt(failures)) return { failures, openUntil: addMillis(now, toMillis(minutes(1))) };\n return { failures, openUntil: c.openUntil };\n}\n\n/**\n * A success clears the failure count and leaves openUntil.\n *\n * @ensures exactly the model's RecordSuccess\n */\nexport function recordSuccessOf(c: Circuit): Circuit {\n //@ verify\n //@ ensures \\result.failures === 0 && \\result.openUntil === c.openUntil\n return { failures: 0, openUntil: c.openUntil };\n}\n\n/**\n * reCAPTCHA passes only with a secret, an ok response and the reply's optional `success` exactly\n * true (the score is not read).\n *\n * @ensures exactly the model's RecaptchaOk, success read as `=== true`\n */\nexport function recaptchaOk(\n hasSecret: boolean,\n httpOk: boolean,\n success: boolean | undefined,\n): boolean {\n //@ verify\n //@ ensures \\result === (hasSecret && httpOk && success === true)\n return hasSecret && httpOk && success === true;\n}\n\n/**\n * Whether the session's cart header is looked up: a lookup to call, the user's id and a usable\n * customer (`customerId`, resolved by augur-utils `resolveAddressId`; null when none is), so no\n * cart is ever looked up for customer 0 (atlas#95).\n *\n * @ensures exactly the model's CartLookupRuns, a customer being customerId ≠ null\n */\nexport function cartLookupRuns(\n hasLookup: boolean,\n hasUserId: boolean,\n customerId: AddressId | null,\n): boolean {\n //@ verify\n //@ ensures \\result === (hasLookup && hasUserId && customerId !== null)\n return hasLookup && hasUserId && customerId !== null;\n}\n\n/**\n * Why a call scoped to one customer is refused: the caller's `refusal` when no usable customer\n * resolved (`customerId` null), else null and the call is asked (atlas#95). Pricing (a price, a\n * tax estimate, a whole batch, refused once before any item) and the customers actions use it,\n * so none is ever asked for customer 0.\n *\n * @ensures exactly the model's CustomerRefusal\n */\nexport function customerRefusalOf(customerId: AddressId | null, refusal: string): string | null {\n //@ verify\n //@ ensures \\result === (customerId === null ? refusal : null)\n return customerId === null ? refusal : null;\n}\n\n/**\n * The category page size: 24 when none (or 0) is given.\n *\n * @ensures exactly the model's ItemsLimit, a missing limit as 0\n */\nexport function itemsLimitOf(limit: number | undefined): number {\n //@ verify\n //@ ensures (limit === undefined || limit === 0) ==> \\result === 24\n //@ ensures limit !== undefined && limit !== 0 ==> \\result === limit\n if (limit === undefined) return 24;\n if (limit === 0) return 24;\n return limit;\n}\n\n/**\n * Whether queryAction looks for a cross-site session (imports next/headers and reads the\n * cookie): only on a site that opted in and has a secret. Every other site never reads cookies\n * here, so its pages can render statically (atlas#105).\n *\n * @ensures exactly the model's ReadsSession\n */\nexport function readsSession(crossSite: boolean, hasSecret: boolean): boolean {\n //@ verify\n //@ ensures \\result === (crossSite && hasSecret)\n return crossSite && hasSecret;\n}\n\n/**\n * The target siteId authorize writes into the session: the sign-in's `siteId` only on an\n * opted-in site, and only when it is not empty (atlas#105), ASCII-lowercased (owner 2026-11-16:\n * every siteId is made lowercase; models/Platform.dfy SiteIdFrom).\n *\n * @ensures exactly the model's SignInTarget\n */\nexport function signInTarget(crossSite: boolean, siteId: string | undefined): string | undefined {\n //@ verify\n //@ ensures !crossSite ==> \\result === undefined\n //@ ensures crossSite && siteId === undefined ==> \\result === undefined\n //@ ensures crossSite && siteId !== undefined && siteId === \"\" ==> \\result === undefined\n //@ ensures crossSite && siteId !== undefined && siteId !== \"\" ==> \\result === lowerAscii(siteId)\n if (!crossSite) return undefined;\n if (siteId === undefined) return undefined;\n if (siteId === \"\") return undefined;\n return lowerAscii(siteId);\n}\n\n/** How queryAction resolves its client. */\nexport type Resolution = \"scoped\" | \"global\" | \"uninit\";\n\n/**\n * resolveClient: scoped when credentials minted and a scoped client was made; else the global\n * client when one is registered (also for a valid session without a factory); else none.\n *\n * @ensures exactly the model's ResolveClient\n */\nexport function resolutionOf(minted: boolean, scopedMade: boolean, hasGlobal: boolean): Resolution {\n //@ verify\n //@ ensures minted && scopedMade ==> \\result === \"scoped\"\n //@ ensures !(minted && scopedMade) && hasGlobal ==> \\result === \"global\"\n //@ ensures !(minted && scopedMade) && !hasGlobal ==> \\result === \"uninit\"\n if (minted && scopedMade) return \"scoped\";\n return hasGlobal ? \"global\" : \"uninit\";\n}\n\n/** The scoped-client slot's decision. */\nexport type SlotDecision = \"hit\" | \"mint\" | \"no-client\";\n\n/**\n * getOrCreateScopedClient's single slot: a hit when it holds this key; else a new client when a\n * factory is registered; else none. An empty slot is \"\" at the caller, which no key equals (a\n * key holds a NUL).\n *\n * @ensures exactly the model's SlotDecisionOf\n */\nexport function slotDecisionOf(slotKey: string, key: string, hasFactory: boolean): SlotDecision {\n //@ verify\n //@ ensures slotKey === key ==> \\result === \"hit\"\n //@ ensures slotKey !== key && hasFactory ==> \\result === \"mint\"\n //@ ensures slotKey !== key && !hasFactory ==> \\result === \"no-client\"\n if (slotKey === key) return \"hit\";\n return hasFactory ? \"mint\" : \"no-client\";\n}\n\n/**\n * parseMethodPath: a non-empty path, in the allowlist when one is registered (permissive by\n * default); `listed` is the caller's Set lookup.\n *\n * @ensures exactly the model's ApprovePath\n */\nexport function approvePath(path: string, hasAllowlist: boolean, listed: boolean): boolean {\n //@ verify\n //@ ensures \\result === (path !== \"\" && (!hasAllowlist || listed))\n return path !== \"\" && (!hasAllowlist || listed);\n}\n\n/**\n * queryAction caches a call only through a wrapper, and only for a read leaf (augur-core's\n * `isReadMethod`, checked by the caller).\n *\n * @ensures exactly the model's UsesCache\n */\nexport function usesCache(hasWrapper: boolean, isRead: boolean): boolean {\n //@ verify\n //@ ensures \\result === (hasWrapper && isRead)\n return hasWrapper && isRead;\n}\n\n/**\n * The Auth.js session cookie decodeSessionJwt reads, and the salt it decodes with: the HTTPS\n * cookie when the request has one, else the plain one.\n *\n * @ensures exactly the model's SessionCookieName\n */\nexport function sessionCookieName(hasSecure: boolean): string {\n //@ verify\n //@ ensures hasSecure ==> \\result === \"__Secure-authjs.session-token\"\n //@ ensures !hasSecure ==> \\result === \"authjs.session-token\"\n return hasSecure ? \"__Secure-authjs.session-token\" : \"authjs.session-token\";\n}\n\n/** Which client a bounded call runs on (atlas#106). */\nexport type ClientChoice = \"client\" | \"view\" | \"refuse\";\n\n/**\n * queryActionWith's client: today's client with no options; else the client's `withRequest`\n * view, refused when the client has none (a call asked to be bounded never runs unbounded).\n *\n * @ensures exactly the model's ClientFor\n */\nexport function clientFor(hasOptions: boolean, hasWithRequest: boolean): ClientChoice {\n //@ verify\n //@ ensures !hasOptions ==> \\result === \"client\"\n //@ ensures hasOptions && hasWithRequest ==> \\result === \"view\"\n //@ ensures hasOptions && !hasWithRequest ==> \\result === \"refuse\"\n if (!hasOptions) return \"client\";\n return hasWithRequest ? \"view\" : \"refuse\";\n}\n\n/**\n * The scoped cache prefix: the session's siteId and \":\".\n *\n * @ensures exactly the model's ScopedPrefix\n */\nexport function scopedPrefix(siteId: string): string {\n //@ verify\n //@ ensures \\result === siteId + \":\"\n return siteId + \":\";\n}\n\n/**\n * withServerCache caches when the TTL is not 0 (missing or NaN is 0 at the caller; a `Seconds`\n * is never negative).\n *\n * @ensures exactly the model's ShouldCache\n */\nexport function shouldCache(ttl: Seconds): boolean {\n //@ verify\n //@ ensures \\result === (ttl !== 0)\n return ttl !== 0;\n}\n\n/**\n * The TTL a server cache call uses: a missing one (undefined or NaN, which the caller reads) is 0,\n * as `!redisTtl` had it.\n *\n * @ensures exactly the model's CacheTtl\n */\nexport function cacheTtlOf(missing: boolean, ttl: Seconds): Seconds {\n //@ verify\n //@ ensures \\result === (missing ? 0 : ttl)\n return missing ? seconds(0) : ttl;\n}\n\n/**\n * getInvMastDoc's positional uid: kept above 0, else none.\n *\n * @ensures result = uid when uid > 0, else undefined\n */\nexport function docUidOf(uid: number): number | undefined {\n //@ verify\n //@ ensures uid > 0 ==> \\result === uid\n //@ ensures uid <= 0 ==> \\result === undefined\n if (uid > 0) return uid;\n return undefined;\n}\n\n/**\n * The positional itemId is used only at uid 0 and when non-empty (\"\" for none, at the caller).\n *\n * @ensures result ⟺ uid = 0 ∧ itemId ≠ \"\"\n */\nexport function takesItemId(uid: number, itemId: string): boolean {\n //@ verify\n //@ ensures \\result === (uid === 0 && itemId !== \"\")\n return uid === 0 && itemId !== \"\";\n}\n\n/**\n * A doc call needs a uid (truthy at the caller) or a non-empty itemId.\n *\n * @ensures result ⟺ uidSet ∨ itemId ≠ \"\"\n */\nexport function hasDocKey(uidSet: boolean, itemId: string): boolean {\n //@ verify\n //@ ensures \\result === (uidSet || itemId !== \"\")\n return uidSet || itemId !== \"\";\n}\n\n/**\n * The configured payments mode, \"live\" by default.\n *\n * @ensures result = configured ?? \"live\"\n */\nexport function configuredModeOf(configured: string | undefined): string {\n //@ verify\n //@ ensures configured === undefined ==> \\result === \"live\"\n //@ ensures configured !== undefined ==> \\result === configured\n if (configured === undefined) return \"live\";\n return configured;\n}\n","//@ backend dafny\n\n/* Cache key for the per-request scoped SDK client (`sdk-client-store.ts`\n `getOrCreateScopedClient`). Verified with LemmaScript → Dafny (`pnpm proofs`; model:\n models/AugurServer.dfy `ScopedClientKey`, whose `ScopedClientKeyInjective` proves that for two\n siteIds with no NUL character, equal keys mean equal siteIds AND equal tokens, so two\n credential pairs never share a cached client; link:\n models/links/augur-server-scoped-client-key.dfy). Only the siteId needs to be NUL-free; the\n token may contain anything. Not proved: that every siteId reaching this function is NUL-free.\n That rests on `getSessionCredentials` (query-action.ts), the only mint point, refusing any\n siteId that fails augur-api's `isSiteId` (`[a-z0-9_-]+`, proved in augur-api), which is\n tested. */\n\n/** Character code of the separator; no siteId contains it. */\nconst SEPARATOR_CODE = 0;\n\n/** `siteId` has no NUL character, so the first NUL in a key marks where the siteId ends. */\nfunction hasNoSeparator(siteId: string): boolean {\n //@ verify\n //@ ensures \\result === !siteId.includes(String.fromCharCode(0))\n return !siteId.includes(String.fromCharCode(SEPARATOR_CODE));\n}\n\n/** The key `siteId + \"\\0\" + token`, or null (the refusal) when the siteId has a NUL. */\nfunction scopedClientKeyOf(siteId: string, token: string): string | null {\n //@ verify\n //@ ensures hasNoSeparator(siteId) ==> \\result === siteId + String.fromCharCode(0) + token\n //@ ensures !hasNoSeparator(siteId) ==> \\result === null\n if (!hasNoSeparator(siteId)) return null;\n return siteId + String.fromCharCode(SEPARATOR_CODE) + token;\n}\n\n/**\n * The key `siteId + \"\\0\" + token`. Callers MUST pass a siteId with no NUL character\n * (`getSessionCredentials` enforces `isSiteId`); with that, distinct pairs give distinct keys.\n * A siteId with a NUL throws instead of returning a key that could collide.\n *\n * @throws TypeError when `siteId` contains a NUL character\n */\nexport function scopedClientKey(siteId: string, token: string): string {\n const key = scopedClientKeyOf(siteId, token);\n if (key === null) {\n throw new TypeError(\"scopedClientKey: siteId must not contain a NUL character\");\n }\n return key;\n}\n","/**\n * Lightweight getter/setter for the raw SDK client instance, cache wrapper,\n * auth secret, client factory, and scoped client cache.\n *\n * queryAction resolves method paths on the SDK client directly (not on\n * SiteActions). This ensures the proxy pattern works end-to-end: the\n * proxy generates SDK namespace paths (e.g. \"pricing.priceEngine.get\")\n * which match the SDK client structure.\n *\n * The cache wrapper is a function registered by createServerSite() that\n * wraps SDK calls with Redis caching. It captures withServerCache + config\n * in its closure, so queryAction can use it without importing heavy deps.\n *\n * The auth secret, client factory, and scoped cache wrapper support\n * per-request session credentials for multi-tenant apps. queryAction\n * decodes the JWT from request cookies and creates scoped SDK clients\n * when the session contains a targetSiteId + token.\n *\n * This module has ZERO imports from actions/site, cache/, or any factory.\n * Same isolation constraints as site-actions-store.ts.\n */\n\nimport { approvePath, slotDecisionOf } from \"./rules\";\nimport { scopedClientKey } from \"./scoped-client-key\";\n\n/** Function that wraps an SDK call with server-side caching. */\nexport type SdkCallWrapper = (\n methodPath: string,\n sdkCall: () => Promise<unknown>,\n ...keyArgs: unknown[]\n) => Promise<unknown>;\n\n/** Function that wraps an SDK call with server-side caching using a specific prefix. */\nexport type ScopedCacheWrapper = (\n prefix: string,\n methodPath: string,\n sdkCall: () => Promise<unknown>,\n ...keyArgs: unknown[]\n) => Promise<unknown>;\n\n/** Function that creates a scoped SDK client with different credentials. */\nexport type ClientFactory = (siteId: string, bearerToken: string) => unknown;\n\ndeclare const SessionSiteIdBrand: unique symbol;\ndeclare const SessionBearerTokenBrand: unique symbol;\ndeclare const SessionCredentialsBrand: unique symbol;\ndeclare const ApprovedMethodPathBrand: unique symbol;\n\n/**\n * Site identifier extracted from a validated Auth.js session JWT cookie.\n *\n * Intended to be minted only by `getSessionCredentials` in query-action.ts.\n *\n * Brand strength: code-review signal, not type-system enforcement. TypeScript\n * allows `value as SessionSiteId` casts, so audit `as SessionSiteId` usages\n * to catch unintended mints — there should be exactly one, at the JWT mint\n * point.\n */\nexport type SessionSiteId = string & { readonly [SessionSiteIdBrand]: true };\n\n/**\n * Bearer token extracted from a validated Auth.js session JWT cookie.\n * Same intended-mint and brand-strength caveat as {@link SessionSiteId}.\n */\nexport type SessionBearerToken = string & { readonly [SessionBearerTokenBrand]: true };\n\n/**\n * Paired session credentials. Bundles `siteId` and `token` from the same\n * validated session into one value so downstream functions can accept the\n * pair as a unit, instead of two separate parameters that callers might\n * accidentally mix across sessions.\n *\n * Intended to be minted only by `getSessionCredentials` in query-action.ts,\n * which performs the cross-check that the bearer's `client_id` siteId\n * matches `targetSiteId`. Anything that holds a `SessionCredentials` *was*\n * cross-checked at mint time — provided the value came through that mint\n * and not via a cast.\n *\n * Brand strength: same code-review signal as the field brands. `value as\n * SessionCredentials` compiles. Audit `as SessionCredentials` usages — there\n * should be exactly one, in `getSessionCredentials`.\n */\nexport type SessionCredentials = {\n readonly siteId: SessionSiteId;\n readonly token: SessionBearerToken;\n readonly [SessionCredentialsBrand]: true;\n};\n\n/**\n * SDK method path validated against the registered allowlist.\n *\n * Intended to be minted only by `parseMethodPath` below. Functions that walk\n * the path into the SDK client (notably `resolveMethod`) demand this type\n * so that an unvalidated string flowing into the walker is a compile error\n * for code that respects the convention.\n *\n * Brand strength: code-review signal. `value as ApprovedMethodPath` compiles.\n * Audit `as ApprovedMethodPath` usages — there should be one, in\n * `parseMethodPath`.\n *\n * Scope of validation: this is a *site-level surface restriction*, not a\n * security boundary. augur-api is the auth authority; the allowlist limits\n * what the application's proxy will forward to the SDK, not what tokens are\n * permitted to do. Useful for narrowing same-origin attack surface (XSS,\n * malicious bundled deps); not a substitute for API-level authorization.\n */\nexport type ApprovedMethodPath = string & { readonly [ApprovedMethodPathBrand]: true };\n\nconst g = globalThis as unknown as {\n __augur_sdk_client?: unknown;\n __augur_sdk_call_wrapper?: SdkCallWrapper;\n __augur_auth_secret?: string;\n __augur_cross_site?: boolean;\n __augur_client_factory?: ClientFactory;\n __augur_scoped_cache_wrapper?: ScopedCacheWrapper;\n __augur_allowed_method_paths?: Set<string>;\n};\n\nlet _cachedClient: unknown = null;\nlet _cachedWrapper: SdkCallWrapper | null = null;\nlet _cachedAuthSecret: string | null = null;\nlet _cachedCrossSite = false;\nlet _cachedClientFactory: ClientFactory | null = null;\nlet _cachedScopedCacheWrapper: ScopedCacheWrapper | null = null;\nlet _scopedClient: { key: string; client: unknown } | null = null;\nlet _allowedMethodPaths: Set<string> | null = null;\n\n/** Register the raw SDK client instance. Called by createServerSite(). */\nexport function registerSdkClient(client: unknown): void {\n _cachedClient = client;\n g.__augur_sdk_client = client;\n}\n\n/** Returns the registered SDK client, or null if not yet registered. */\nexport function getSdkClientOrNull(): unknown {\n const client = g.__augur_sdk_client ?? _cachedClient;\n if (client) {\n if (!g.__augur_sdk_client) {\n g.__augur_sdk_client = client;\n }\n return client;\n }\n return null;\n}\n\n/**\n * Register a cache wrapper for SDK calls. Called by createServerSite().\n * The wrapper captures withServerCache + config in its closure so that\n * queryAction can use Redis caching without importing heavy deps.\n */\nexport function registerSdkCallWrapper(wrapper: SdkCallWrapper): void {\n _cachedWrapper = wrapper;\n g.__augur_sdk_call_wrapper = wrapper;\n}\n\n/** Returns the registered cache wrapper, or null if not registered. */\nexport function getSdkCallWrapper(): SdkCallWrapper | null {\n return g.__augur_sdk_call_wrapper ?? _cachedWrapper ?? null;\n}\n\n/** Register the auth secret for JWT decoding. Called by createServerSite(). */\nexport function registerAuthSecret(secret: string): void {\n _cachedAuthSecret = secret;\n g.__augur_auth_secret = secret;\n}\n\n/** Returns the registered auth secret, or null if not registered. */\nexport function getAuthSecret(): string | null {\n return g.__augur_auth_secret ?? _cachedAuthSecret ?? null;\n}\n\n/**\n * Register whether this is the cross-site site: the augur_info client's own siteId\n * (session-rules `crossSiteSite`, owner 2026-11-16). Called by createServerSite(). The ONE source\n * both queryAction's session read and authorize's sign-in target read (models/AugurServer.dfy,\n * atlas#105; models/AugurServerSecurity.dfy, cross-site).\n */\nexport function registerCrossSite(on: boolean): void {\n _cachedCrossSite = on;\n g.__augur_cross_site = on;\n}\n\n/** Whether this site opted in to cross-site sessions; false unless registered. */\nexport function getCrossSite(): boolean {\n return g.__augur_cross_site ?? _cachedCrossSite;\n}\n\n/** Register a factory that creates scoped SDK clients. Called by createServerSite(). */\nexport function registerClientFactory(factory: ClientFactory): void {\n _cachedClientFactory = factory;\n g.__augur_client_factory = factory;\n}\n\n/** Returns the registered client factory, or null if not registered. */\nexport function getClientFactory(): ClientFactory | null {\n return g.__augur_client_factory ?? _cachedClientFactory ?? null;\n}\n\n/** Register a scoped cache wrapper that accepts a prefix. Called by createServerSite(). */\nexport function registerScopedCacheWrapper(wrapper: ScopedCacheWrapper): void {\n _cachedScopedCacheWrapper = wrapper;\n g.__augur_scoped_cache_wrapper = wrapper;\n}\n\n/** Returns the registered scoped cache wrapper, or null if not registered. */\nexport function getScopedCacheWrapper(): ScopedCacheWrapper | null {\n return g.__augur_scoped_cache_wrapper ?? _cachedScopedCacheWrapper ?? null;\n}\n\n/**\n * Returns a cached scoped client for the given credentials, or creates one\n * via the registered factory. Caches the last credential pair so that\n * multiple queryAction calls in the same request reuse the same client.\n *\n * Accepts `SessionCredentials` (a branded paired type) rather than two raw\n * strings: well-behaved callers pass the pair as a unit, eliminating the\n * \"siteId from session A combined with token from session B\" mistake at\n * the type level — see {@link SessionCredentials} brand-strength caveat.\n * The factory itself still receives strings (its signature is user-facing API).\n *\n * ## Trust\n *\n * @trusted credentials // the SessionCredentials brand carries the\n * // bearer/session siteId cross-check discharged at\n * // mint time by `getSessionCredentials`. This\n * // function does NOT re-validate; if a non-mint\n * // path produces a SessionCredentials value (via\n * // `as` cast), this function will materialise a\n * // client for whatever siteId + token are present\n * // in the value. Audit `as SessionCredentials`\n * // usages — there should be exactly one, in\n * // getSessionCredentials.\n *\n * ## Decision (Property)\n *\n * let key = `${credentials.siteId}\\0${credentials.token}` in\n * result(credentials) =\n * _scopedClient.client when _scopedClient?.key = key // cache hit\n * factory(siteId, token) when factory ≠ null // mint + cache\n * null when factory = null // uninitialised\n *\n * Three outcomes. Throws only if `credentials.siteId` contains a NUL\n * (`scopedClientKey`), which the mint point rules out by `isSiteId`, so it\n * is reachable only through an `as SessionCredentials` cast. Side effect on\n * the mint path only:\n * `_scopedClient` is replaced with `{key, client}` so the next call with\n * the same credentials hits the cached branch. Minting implicitly evicts\n * the previous `_scopedClient` value (single-slot semantics — see invariant).\n *\n * ## Invariant — null-byte key separator (machine-checked)\n *\n * The key is `scopedClientKey(siteId, token)` = `siteId + \"\\0\" + token`\n * (`scoped-client-key.ts`). Dafny proves (`ScopedClientKeyInjective`) that\n * for two NUL-free siteIds, equal keys mean equal siteIds and equal tokens,\n * so the cache cannot hand one credential pair another pair's client. Only\n * the siteId has to be NUL-free; the token may contain anything.\n *\n * The precondition is enforced, not assumed: `getSessionCredentials`, the\n * only mint point, refuses any `targetSiteId` that fails augur-api's\n * `isSiteId` (`[a-z0-9_-]+`, machine-checked in augur-api), and\n * `scopedClientKey` throws on a NUL rather than return a key that could\n * collide. What is NOT proved: that no other code path casts a value to\n * `SessionCredentials` (see the Trust note above).\n *\n * Do NOT change the separator to a character that could appear in a\n * siteId; the proof is stated for NUL and would have to be redone.\n *\n * ## Invariant — single-slot cache (eviction is implicit)\n *\n * `_scopedClient` holds at most one entry. Minting a client for\n * credentials A AFTER credentials B were cached evicts B unrecoverably;\n * a later request with credentials B will call the factory again rather\n * than retrieving the previously-minted client.\n *\n * This is intentional. Scoped clients are per-request shortcuts; the\n * cache exists to let multiple queryAction calls within a single request\n * share an SDK client without re-running the factory. Cross-request\n * caching is NOT a goal — Next.js may or may not preserve module state\n * across invocations, so any retention beyond the single slot is\n * best-effort and MUST NOT be relied upon for correctness.\n *\n * A future refactor to multi-slot LRU would change this contract:\n * per-credential client identity becomes ambiguous across requests, and\n * eviction policy becomes security-relevant (e.g. oldest-out could re-mint\n * a client immediately after a credential rotation, surfacing stale\n * permissions to the next caller). Do not multi-slot this without\n * re-deriving the contract — particularly the relationship to credential\n * rotation and bearer-token revocation in augur-api.\n *\n * ## Postcondition — identity, not transformation\n *\n * result ≠ null ⟹ result is referentially identical to the value the\n * factory returned for the matching credentials.\n *\n * The cache stores and serves the factory's exact return value. It does\n * not wrap, transform, proxy, or copy the client. Consumers that mutate\n * the returned client (e.g. setting per-request properties on a singleton\n * field) will observe the mutation on subsequent cache hits within the\n * same request — by design.\n */\nexport function getOrCreateScopedClient(credentials: SessionCredentials): unknown {\n const { siteId, token } = credentials;\n const key = scopedClientKey(siteId, token);\n const factory = g.__augur_client_factory ?? _cachedClientFactory;\n const decision = slotDecisionOf(_scopedClient?.key ?? \"\", key, !!factory);\n if (decision === \"hit\") return _scopedClient!.client;\n if (decision === \"no-client\") return null;\n\n const client = factory!(siteId, token);\n _scopedClient = { key, client };\n return client;\n}\n\n/**\n * Register one or more SDK method paths the application is permitted to call\n * through `queryAction`. Subsequent calls accumulate (idempotent on repeats).\n *\n * This is *site-level surface restriction*, not security. augur-api remains\n * the auth authority; this primitive lets a site narrow its proxy's surface\n * to the methods its UI actually wires up. Useful as defense-in-depth against\n * same-origin XSS or compromised bundled deps POSTing arbitrary methodPaths\n * to `/api/augur` — those calls will hit augur-api with the user's bearer\n * (which augur-api will allow if the bearer is authorized), but the allowlist\n * stops them from leaving the proxy in the first place.\n *\n * Permissive default: if `registerAllowedMethodPaths` is never called, all\n * non-empty paths pass — the proxy behaves as a transparent forwarder, which\n * is the package's design intent. Sites that want surface restriction opt in\n * by calling this function.\n */\nexport function registerAllowedMethodPaths(paths: readonly string[]): void {\n if (_allowedMethodPaths === null) {\n _allowedMethodPaths = new Set();\n g.__augur_allowed_method_paths = _allowedMethodPaths;\n }\n for (const p of paths) _allowedMethodPaths.add(p);\n}\n\n/**\n * Returns true if the application has registered an allowlist via\n * {@link registerAllowedMethodPaths}. When false, `parseMethodPath` operates\n * in permissive mode (any non-empty string passes).\n */\nexport function isMethodPathAllowlistRegistered(): boolean {\n return (g.__augur_allowed_method_paths ?? _allowedMethodPaths) !== null;\n}\n\n/**\n * Validate a candidate method path against the registered allowlist.\n *\n * - Returns the branded value if the path is a non-empty string AND\n * (no allowlist is registered OR the path is in the allowlist).\n * - Returns null if the path is not a non-empty string, or if an allowlist\n * has been registered and the path is not in it.\n *\n * The brand on the return type is the only way internal code can produce an\n * `ApprovedMethodPath`. Functions that walk the path into the SDK should\n * accept `ApprovedMethodPath`, forcing the caller to discharge the validation.\n */\nexport function parseMethodPath(candidate: unknown): ApprovedMethodPath | null {\n if (typeof candidate !== \"string\") return null;\n const allowed = g.__augur_allowed_method_paths ?? _allowedMethodPaths;\n const listed = allowed !== null && allowed.has(candidate);\n if (!approvePath(candidate, allowed !== null, listed)) return null;\n return candidate as ApprovedMethodPath;\n}\n\n/** Clears the registered SDK client, wrapper, and session stores. Used in tests only. @internal */\nexport function clearSdkClient(): void {\n _cachedClient = null;\n _cachedWrapper = null;\n _cachedAuthSecret = null;\n _cachedCrossSite = false;\n _cachedClientFactory = null;\n _cachedScopedCacheWrapper = null;\n _scopedClient = null;\n _allowedMethodPaths = null;\n g.__augur_sdk_client = undefined;\n g.__augur_sdk_call_wrapper = undefined;\n g.__augur_auth_secret = undefined;\n g.__augur_cross_site = undefined;\n g.__augur_client_factory = undefined;\n g.__augur_scoped_cache_wrapper = undefined;\n g.__augur_allowed_method_paths = undefined;\n}\n"],"mappings":";;;;;;;AA4BO,SAAS,QAAQ,GAAoB;AAK1C,SAAO;AACT;AAOO,SAAS,QAAQ,GAAoB;AAK1C,SAAQ,IAAI;AACd;AAOO,SAAS,MAAM,GAAoB;AAKxC,SAAQ,IAAI;AACd;AAoBO,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