@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/dist/rules.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { AddressId } from "./address-id";
|
|
1
2
|
import type { Millis, Seconds } from "./duration";
|
|
2
3
|
/**
|
|
3
4
|
* The siteId of a bearer's client_id claim (`<n>|<siteId>`): the text after the first "|", when
|
|
@@ -141,12 +142,6 @@ export declare function recordFailureOf(c: Circuit, now: Millis): Circuit;
|
|
|
141
142
|
* @ensures exactly the model's RecordSuccess
|
|
142
143
|
*/
|
|
143
144
|
export declare function recordSuccessOf(c: Circuit): Circuit;
|
|
144
|
-
/**
|
|
145
|
-
* authorize's verified flag: exactly the text "true".
|
|
146
|
-
*
|
|
147
|
-
* @ensures result ⟺ s = "true"
|
|
148
|
-
*/
|
|
149
|
-
export declare function verifiedFlag(s: string): boolean;
|
|
150
145
|
/**
|
|
151
146
|
* reCAPTCHA passes only with a secret, an ok response and the reply's optional `success` exactly
|
|
152
147
|
* true (the score is not read).
|
|
@@ -155,24 +150,28 @@ export declare function verifiedFlag(s: string): boolean;
|
|
|
155
150
|
*/
|
|
156
151
|
export declare function recaptchaOk(hasSecret: boolean, httpOk: boolean, success: boolean | undefined): boolean;
|
|
157
152
|
/**
|
|
158
|
-
*
|
|
153
|
+
* Whether the session's cart header is looked up: a lookup to call, the user's id and a usable
|
|
154
|
+
* customer (`customerId`, resolved by augur-utils `resolveAddressId`; null when none is), so no
|
|
155
|
+
* cart is ever looked up for customer 0 (atlas#95).
|
|
159
156
|
*
|
|
160
|
-
* @ensures
|
|
157
|
+
* @ensures exactly the model's CartLookupRuns, a customer being customerId ≠ null
|
|
161
158
|
*/
|
|
162
|
-
export declare function
|
|
159
|
+
export declare function cartLookupRuns(hasLookup: boolean, hasUserId: boolean, customerId: AddressId | null): boolean;
|
|
163
160
|
/**
|
|
164
|
-
*
|
|
161
|
+
* Why a call scoped to one customer is refused: the caller's `refusal` when no usable customer
|
|
162
|
+
* resolved (`customerId` null), else null and the call is asked (atlas#95). Pricing (a price, a
|
|
163
|
+
* tax estimate, a whole batch, refused once before any item) and the customers actions use it,
|
|
164
|
+
* so none is ever asked for customer 0.
|
|
165
165
|
*
|
|
166
|
-
* @ensures exactly the model's
|
|
166
|
+
* @ensures exactly the model's CustomerRefusal
|
|
167
167
|
*/
|
|
168
|
-
export declare function
|
|
168
|
+
export declare function customerRefusalOf(customerId: AddressId | null, refusal: string): string | null;
|
|
169
169
|
/**
|
|
170
|
-
* The
|
|
171
|
-
* that says nothing stays off (atlas#105).
|
|
170
|
+
* The category page size: 24 when none (or 0) is given.
|
|
172
171
|
*
|
|
173
|
-
* @ensures exactly the model's
|
|
172
|
+
* @ensures exactly the model's ItemsLimit, a missing limit as 0
|
|
174
173
|
*/
|
|
175
|
-
export declare function
|
|
174
|
+
export declare function itemsLimitOf(limit: number | undefined): number;
|
|
176
175
|
/**
|
|
177
176
|
* Whether queryAction looks for a cross-site session (imports next/headers and reads the
|
|
178
177
|
* cookie): only on a site that opted in and has a secret. Every other site never reads cookies
|
|
@@ -183,7 +182,8 @@ export declare function crossSiteOf(flag: boolean | undefined): boolean;
|
|
|
183
182
|
export declare function readsSession(crossSite: boolean, hasSecret: boolean): boolean;
|
|
184
183
|
/**
|
|
185
184
|
* The target siteId authorize writes into the session: the sign-in's `siteId` only on an
|
|
186
|
-
* opted-in site, and only when it is not empty (atlas#105)
|
|
185
|
+
* opted-in site, and only when it is not empty (atlas#105), ASCII-lowercased (owner 2026-11-16:
|
|
186
|
+
* every siteId is made lowercase; models/Platform.dfy SiteIdFrom).
|
|
187
187
|
*
|
|
188
188
|
* @ensures exactly the model's SignInTarget
|
|
189
189
|
*/
|
package/dist/rules.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rules.d.ts","sourceRoot":"","sources":["../src/rules.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAMlD;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAShE;AAED,kEAAkE;AAClE,MAAM,MAAM,IAAI,GAAG;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE,CAAC;AAE3F;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,OAAO,EACjB,YAAY,EAAE,MAAM,EACpB,KAAK,EAAE,MAAM,EACb,YAAY,EAAE,MAAM,GACnB,IAAI,CAQN;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CACvB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,SAAS,EAAE,MAAM,GAChB,OAAO,CAMT;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CA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C,MAAM,EAAE,MAAM,GAAG,MAAM,CAInD;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAIjD;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,OAAO,GAAG,OAAO,CAIlE;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAMxD;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAIhE;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAIlE;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAMvE"}
|
|
@@ -108,9 +108,10 @@ export declare function registerAuthSecret(secret: string): void;
|
|
|
108
108
|
/** Returns the registered auth secret, or null if not registered. */
|
|
109
109
|
export declare function getAuthSecret(): string | null;
|
|
110
110
|
/**
|
|
111
|
-
* Register the cross-site
|
|
112
|
-
* createServerSite(). The ONE source
|
|
113
|
-
* target read (models/AugurServer.dfy,
|
|
111
|
+
* Register whether this is the cross-site site: the augur_info client's own siteId
|
|
112
|
+
* (session-rules `crossSiteSite`, owner 2026-11-16). Called by createServerSite(). The ONE source
|
|
113
|
+
* both queryAction's session read and authorize's sign-in target read (models/AugurServer.dfy,
|
|
114
|
+
* atlas#105; models/AugurServerSecurity.dfy, cross-site).
|
|
114
115
|
*/
|
|
115
116
|
export declare function registerCrossSite(on: boolean): void;
|
|
116
117
|
/** Whether this site opted in to cross-site sessions; false unless registered. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk-client-store.d.ts","sourceRoot":"","sources":["../src/sdk-client-store.ts"],"names":[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,EAAE,MAAM,GAAG,IAAI,CAGvD;AAED,qEAAqE;AACrE,wBAAgB,aAAa,IAAI,MAAM,GAAG,IAAI,CAE7C;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,OAAO,GAAG,IAAI,CAGnD;AAED,kFAAkF;AAClF,wBAAgB,YAAY,IAAI,OAAO,CAEtC;AAED,wFAAwF;AACxF,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI,CAGlE;AAED,wEAAwE;AACxE,wBAAgB,gBAAgB,IAAI,aAAa,GAAG,IAAI,CAEvD;AAED,2FAA2F;AAC3F,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,kBAAkB,GAAG,IAAI,CAG5E;AAED,8EAA8E;AAC9E,wBAAgB,qBAAqB,IAAI,kBAAkB,GAAG,IAAI,CAEjE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0FG;AACH,wBAAgB,uBAAuB,CAAC,WAAW,EAAE,kBAAkB,GAAG,OAAO,CAWhF;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI,CAMzE;AAED;;;;GAIG;AACH,wBAAgB,+BAA+B,IAAI,OAAO,CAEzD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAAC,SAAS,EAAE,OAAO,GAAG,kBAAkB,GAAG,IAAI,CAM7E;AAED,mGAAmG;AACnG,wBAAgB,cAAc,IAAI,IAAI,CAgBrC"}
|
package/dist/server-site.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { SiteActionsConfig, SiteActions } from "./actions/site";
|
|
2
|
-
import type { AugurAuthCallbacks } from "./auth";
|
|
2
|
+
import type { AugurAuthCallbacks, WithoutCustomer } from "./auth";
|
|
3
3
|
import type { NextAuthConfig } from "next-auth";
|
|
4
4
|
/** Auth options forwarded to NextAuth when creating a server site. */
|
|
5
5
|
export interface ServerSiteAuthConfig {
|
|
@@ -8,13 +8,11 @@ export interface ServerSiteAuthConfig {
|
|
|
8
8
|
callbacks?: Partial<AugurAuthCallbacks>;
|
|
9
9
|
debug?: boolean;
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
12
|
-
* `
|
|
13
|
-
*
|
|
14
|
-
* site that does not set it never reads cookies in `queryAction`, so its pages can render
|
|
15
|
-
* statically (atlas#105). A multi-tenant site MUST set it.
|
|
11
|
+
* A signed-in user with no usable customer of their own (atlas#212): `"default"` acts as
|
|
12
|
+
* `defaultCustomerId` (and gets its cart), `"none"` gets no customer. Required: a B2B portal
|
|
13
|
+
* MUST say `"none"`, a site whose shoppers buy as the default customer `"default"`.
|
|
16
14
|
*/
|
|
17
|
-
|
|
15
|
+
withoutCustomer: WithoutCustomer;
|
|
18
16
|
}
|
|
19
17
|
/** Configuration for {@link createServerSite}, combining action config and auth. */
|
|
20
18
|
export interface ServerSiteConfig extends SiteActionsConfig {
|
|
@@ -38,7 +36,7 @@ export interface ServerSite<TApi extends object> {
|
|
|
38
36
|
* const api = new AugurAPI({ siteId: process.env.AUGUR_SITE_ID!, bearerToken: process.env.AUGUR_JWT! });
|
|
39
37
|
* export const site = createServerSite(api, {
|
|
40
38
|
* defaultCustomerId: "12345",
|
|
41
|
-
* auth: { secret: process.env.AUTH_SECRET },
|
|
39
|
+
* auth: { secret: process.env.AUTH_SECRET, withoutCustomer: "default" },
|
|
42
40
|
* });
|
|
43
41
|
* ```
|
|
44
42
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-site.d.ts","sourceRoot":"","sources":["../src/server-site.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAErE,OAAO,KAAK,EAAE,kBAAkB,EAAmB,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"server-site.d.ts","sourceRoot":"","sources":["../src/server-site.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAErE,OAAO,KAAK,EAAE,kBAAkB,EAAmB,eAAe,EAAE,MAAM,QAAQ,CAAC;AACnF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAehD,sEAAsE;AACtE,MAAM,WAAW,oBAAoB;IACnC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAC;IACxC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;;;OAIG;IACH,eAAe,EAAE,eAAe,CAAC;CAClC;AAED,oFAAoF;AACpF,MAAM,WAAW,gBAAiB,SAAQ,iBAAiB;IACzD,IAAI,CAAC,EAAE,oBAAoB,CAAC;CAC7B;AAED,uDAAuD;AACvD,MAAM,WAAW,UAAU,CAAC,IAAI,SAAS,MAAM;IAC7C,MAAM,EAAE,IAAI,CAAC;IACb,OAAO,EAAE,WAAW,CAAC;IACrB,IAAI,EAAE,cAAc,GAAG,SAAS,CAAC;CAClC;AAeD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,SAAS,MAAM,EAClD,MAAM,EAAE,IAAI,EACZ,MAAM,GAAE,gBAAqB,GAC5B,UAAU,CAAC,IAAI,CAAC,CAqElB"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import type { AddressId } from "./address-id";
|
|
2
|
+
/**
|
|
3
|
+
* The keys the `session` callback adds to the session the browser gets: the user's fields and
|
|
4
|
+
* the cross-site target. Never `token`: the user's Augur bearer stays in the encrypted JWT, where
|
|
5
|
+
* queryAction reads it (model `SessionHasNoBearer`, `ServerKeepsTheBearer`).
|
|
6
|
+
*
|
|
7
|
+
* @ensures exactly the model's SessionFields
|
|
8
|
+
*/
|
|
9
|
+
export declare function sessionKeys(): string[];
|
|
10
|
+
/**
|
|
11
|
+
* A site's `withoutCustomer` as configured: true for `"default"` (a signed-in user with no
|
|
12
|
+
* usable customer acts as the site's default customer), false for `"none"` (they get no
|
|
13
|
+
* customer), and null for anything else, which `createAuthConfig` refuses: the choice is the
|
|
14
|
+
* site's and has no default (model `NoSilentChoice`).
|
|
15
|
+
*
|
|
16
|
+
* @ensures exactly the model's AuthConfigBuilt and WithoutCustomer
|
|
17
|
+
*/
|
|
18
|
+
export declare function actsAsDefaultOf(choice: string | undefined): boolean | null;
|
|
19
|
+
/**
|
|
20
|
+
* A sign-in's outcome (atlas#97), from Joomla's answer to `verifyPassword`, asked by the server:
|
|
21
|
+
* "wrong-password" when a field is blank (Joomla is not asked) or the answer names no user;
|
|
22
|
+
* "not-activated" for a match on an unverified account (augur never answers so; kept because the
|
|
23
|
+
* answer is not validated at run time); "no-token" for a cross-site sign-in without a token;
|
|
24
|
+
* else "signed-in", as the answer's user. Nothing the browser posts besides the username and
|
|
25
|
+
* password reaches it.
|
|
26
|
+
*
|
|
27
|
+
* @ensures exactly the model's Authorize (AsksJoomla, SignInOf)
|
|
28
|
+
*/
|
|
29
|
+
export declare function signInOutcomeOf(asks: boolean, answerId: number, verified: boolean, hasToken: boolean, crossSite: boolean): string;
|
|
30
|
+
/**
|
|
31
|
+
* Whether a session is kept on this read: the account was found and is not blocked
|
|
32
|
+
* (owner 2026-11-16: a blocked account "can't have a session").
|
|
33
|
+
*
|
|
34
|
+
* @ensures exactly the model's SessionKept
|
|
35
|
+
*/
|
|
36
|
+
export declare function sessionKept(hasProfile: boolean, blocked: boolean): boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Cross-site sign-in is on exactly for the system site, augur_info (owner 2026-11-16: it
|
|
39
|
+
* "REQUIRES the site_id to be augur_info", and only then is a target siteId processed). The
|
|
40
|
+
* system site is the repo's one proved definition, auth-core's `systemSiteId()`
|
|
41
|
+
* (models: Platform.SystemSite). The siteId is lowercased first (owner 2026-11-16: every siteId
|
|
42
|
+
* is made lowercase), so a config's "AUGUR_INFO" is the system site too.
|
|
43
|
+
*
|
|
44
|
+
* @ensures exactly the model's CrossSiteSite
|
|
45
|
+
*/
|
|
46
|
+
export declare function crossSiteSite(siteId: string): boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Whether queryAction follows a segment of a method path: the object's own property, or, for the
|
|
49
|
+
* first segment only, an accessor (the SDK's services are getters on the client). The client's
|
|
50
|
+
* own members (`setAuthToken`, `call`, `withRequest`, `constructor`) are prototype methods, so a
|
|
51
|
+
* caller never reaches them.
|
|
52
|
+
*
|
|
53
|
+
* @ensures exactly the model's SegmentReachable
|
|
54
|
+
*/
|
|
55
|
+
/**
|
|
56
|
+
* Whether the site's SDK registry refuses a `queryAction` path (atlas#104): the client has a
|
|
57
|
+
* registry (`AugurAPI.hasEndpoint`) and the path is not in it. A client without one (an SDK
|
|
58
|
+
* before it, a test double) leaves the path to the walk alone.
|
|
59
|
+
*
|
|
60
|
+
* @ensures exactly the model's RegistryRefuses
|
|
61
|
+
*/
|
|
62
|
+
export declare function registryRefuses(hasRegistry: boolean, inRegistry: boolean): boolean;
|
|
63
|
+
/**
|
|
64
|
+
* A chain segment's route chain when it is a data proxy (`invMastData` → `invMast`), or "" when
|
|
65
|
+
* it is not one.
|
|
66
|
+
*
|
|
67
|
+
* @ensures exactly the model's DataChainOf
|
|
68
|
+
*/
|
|
69
|
+
export declare function dataChainOf(segment: string): string;
|
|
70
|
+
/**
|
|
71
|
+
* Whether a path is in the registry: it is an id, or its data chain makes one.
|
|
72
|
+
*
|
|
73
|
+
* @ensures exactly the model's InRegistry
|
|
74
|
+
*/
|
|
75
|
+
export declare function inRegistry(isId: boolean, dataChainIsId: boolean): boolean;
|
|
76
|
+
export declare function segmentReachable(isFirst: boolean, isOwn: boolean, isAccessor: boolean): boolean;
|
|
77
|
+
/**
|
|
78
|
+
* Where a callback comes from: the site's own (`callbacks.getUserProfile`, `.cartHdrLookup`)
|
|
79
|
+
* when given, else the package's SDK call when it has a client, else none.
|
|
80
|
+
*
|
|
81
|
+
* @ensures exactly the model's CallbackSourceOf
|
|
82
|
+
*/
|
|
83
|
+
export declare function callbackSourceOf(hasOverride: boolean, hasClient: boolean): string;
|
|
84
|
+
/**
|
|
85
|
+
* Whether `createAuthConfig` refuses a config: no client, and not both a profile callback and a
|
|
86
|
+
* password check, so a user could not be loaded or a sign-in could not be verified (atlas#97).
|
|
87
|
+
*
|
|
88
|
+
* @ensures exactly the model's ConfigRefused
|
|
89
|
+
*/
|
|
90
|
+
export declare function configRefused(hasClient: boolean, hasProfileOverride: boolean, hasVerifyOverride: boolean): boolean;
|
|
91
|
+
/**
|
|
92
|
+
* Whether Joomla is asked at all: only with both a username and a password (a blank one is a
|
|
93
|
+
* wrong password at once, with no call).
|
|
94
|
+
*
|
|
95
|
+
* @ensures exactly the model's AsksJoomla
|
|
96
|
+
*/
|
|
97
|
+
export declare function asksJoomla(username: string, password: string): boolean;
|
|
98
|
+
/**
|
|
99
|
+
* The JWT's verified flag as read for the session: verified only when present and true.
|
|
100
|
+
*
|
|
101
|
+
* @ensures exactly the model's ClaimVerified
|
|
102
|
+
*/
|
|
103
|
+
export declare function claimVerified(present: boolean, flag: boolean): boolean;
|
|
104
|
+
/**
|
|
105
|
+
* A number the cart lookup sends: the value when it is a number, else 0 (the SDK's "none").
|
|
106
|
+
*
|
|
107
|
+
* @ensures exactly the model's LookupNumberOf
|
|
108
|
+
*/
|
|
109
|
+
export declare function lookupNumberOf(isNumber: boolean, n: number): number;
|
|
110
|
+
/**
|
|
111
|
+
* The session's customer, and the one the sign-in cart is looked up for: the user's own usable
|
|
112
|
+
* customer always; else the site's default only on a site that chose `"default"`; else none.
|
|
113
|
+
* Both ids come through augur-utils' `addressIdOf`, so "", "0" and 0 are already none (atlas#95).
|
|
114
|
+
*
|
|
115
|
+
* @ensures exactly the model's SessionCustomer (and CartCustomer, the same function)
|
|
116
|
+
*/
|
|
117
|
+
export declare function sessionCustomerOf(own: AddressId | null, siteDefault: AddressId | null, actsAsDefault: boolean): AddressId | null;
|
|
118
|
+
//# sourceMappingURL=session-rules.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-rules.d.ts","sourceRoot":"","sources":["../src/session-rules.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C;;;;;;GAMG;AACH,wBAAgB,WAAW,IAAI,MAAM,EAAE,CAKtC;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,GAAG,IAAI,CAS1E;AAED;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,OAAO,EACb,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,OAAO,EACjB,QAAQ,EAAE,OAAO,EACjB,SAAS,EAAE,OAAO,GACjB,MAAM,CAYR;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAI1E;AAED;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAIrD;AAED;;;;;;;GAOG;AACH;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,WAAW,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,GAAG,OAAO,CAIlF;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAOnD;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO,GAAG,OAAO,CAIzE;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,GAAG,OAAO,CAI/F;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,GAAG,MAAM,CAQjF;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAC3B,SAAS,EAAE,OAAO,EAClB,kBAAkB,EAAE,OAAO,EAC3B,iBAAiB,EAAE,OAAO,GACzB,OAAO,CAIT;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAItE;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,GAAG,OAAO,CAItE;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,OAAO,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAMnE;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,GAAG,EAAE,SAAS,GAAG,IAAI,EACrB,WAAW,EAAE,SAAS,GAAG,IAAI,EAC7B,aAAa,EAAE,OAAO,GACrB,SAAS,GAAG,IAAI,CAQlB"}
|
package/dist/site.js
CHANGED
|
@@ -1,33 +1,35 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createAuthConfig
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-M35O5JDZ.js";
|
|
4
|
+
import {
|
|
5
|
+
crossSiteSite
|
|
6
|
+
} from "./chunk-ILXNFJVM.js";
|
|
4
7
|
import {
|
|
5
8
|
createSiteActions,
|
|
6
9
|
registerSiteActions,
|
|
7
10
|
serverTtlOf,
|
|
8
11
|
withRawSdkCache
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
12
|
+
} from "./chunk-GKT4MAWC.js";
|
|
13
|
+
import "./chunk-IM7FDRER.js";
|
|
11
14
|
import {
|
|
12
|
-
crossSiteOf,
|
|
13
15
|
registerAuthSecret,
|
|
14
16
|
registerClientFactory,
|
|
15
17
|
registerCrossSite,
|
|
16
18
|
registerScopedCacheWrapper,
|
|
17
19
|
registerSdkCallWrapper,
|
|
18
20
|
registerSdkClient
|
|
19
|
-
} from "./chunk-
|
|
20
|
-
import "./chunk-
|
|
21
|
+
} from "./chunk-5DBFTSWY.js";
|
|
22
|
+
import "./chunk-HGJF667G.js";
|
|
21
23
|
|
|
22
24
|
// src/server-site.ts
|
|
23
25
|
import { hours } from "@simpleapps-com/augur-utils";
|
|
24
26
|
import { getCacheTier, isP21Path } from "@simpleapps-com/augur-core";
|
|
25
|
-
function registerSessionAuth(auth) {
|
|
27
|
+
function registerSessionAuth(auth, siteId) {
|
|
26
28
|
const authSecret = auth?.secret ?? process.env["AUTH_SECRET"];
|
|
27
29
|
if (authSecret) {
|
|
28
30
|
registerAuthSecret(authSecret);
|
|
29
31
|
}
|
|
30
|
-
registerCrossSite(
|
|
32
|
+
registerCrossSite(crossSiteSite(siteId));
|
|
31
33
|
}
|
|
32
34
|
function createServerSite(client, config = {}) {
|
|
33
35
|
const actions = createSiteActions(client, config);
|
|
@@ -59,7 +61,10 @@ function createServerSite(client, config = {}) {
|
|
|
59
61
|
return new Ctor({ ...baseConfig, siteId, bearerToken });
|
|
60
62
|
});
|
|
61
63
|
}
|
|
62
|
-
registerSessionAuth(
|
|
64
|
+
registerSessionAuth(
|
|
65
|
+
config.auth,
|
|
66
|
+
baseConfig?.["siteId"] === void 0 ? "" : String(baseConfig["siteId"])
|
|
67
|
+
);
|
|
63
68
|
const auth = config.auth ? createAuthConfig({
|
|
64
69
|
augurClient: client,
|
|
65
70
|
defaultCustomerId: config.defaultCustomerId,
|
package/dist/site.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/server-site.ts"],"sourcesContent":["import { hours } from \"@simpleapps-com/augur-utils\";\nimport { createSiteActions } from \"./actions/site\";\nimport type { SiteActionsConfig, SiteActions } from \"./actions/site\";\nimport { createAuthConfig } from \"./auth\";\nimport type { AugurAuthCallbacks, AugurAuthClient } from \"./auth\";\nimport type { NextAuthConfig } from \"next-auth\";\nimport { registerSiteActions } from \"./server-site-registry\";\nimport {\n registerSdkClient,\n registerSdkCallWrapper,\n registerAuthSecret,\n registerClientFactory,\n registerCrossSite,\n registerScopedCacheWrapper,\n} from \"./sdk-client-store\";\nimport { withRawSdkCache } from \"./cache/with-cache\";\nimport {
|
|
1
|
+
{"version":3,"sources":["../src/server-site.ts"],"sourcesContent":["import { hours } from \"@simpleapps-com/augur-utils\";\nimport { createSiteActions } from \"./actions/site\";\nimport type { SiteActionsConfig, SiteActions } from \"./actions/site\";\nimport { createAuthConfig } from \"./auth\";\nimport type { AugurAuthCallbacks, AugurAuthClient, WithoutCustomer } from \"./auth\";\nimport type { NextAuthConfig } from \"next-auth\";\nimport { registerSiteActions } from \"./server-site-registry\";\nimport {\n registerSdkClient,\n registerSdkCallWrapper,\n registerAuthSecret,\n registerClientFactory,\n registerCrossSite,\n registerScopedCacheWrapper,\n} from \"./sdk-client-store\";\nimport { withRawSdkCache } from \"./cache/with-cache\";\nimport { crossSiteSite } from \"./session-rules\";\nimport { serverTtlOf } from \"./read-rules\";\nimport { getCacheTier, isP21Path } from \"@simpleapps-com/augur-core\";\n\n/** Auth options forwarded to NextAuth when creating a server site. */\nexport interface ServerSiteAuthConfig {\n secret?: string;\n maxAge?: number;\n callbacks?: Partial<AugurAuthCallbacks>;\n debug?: boolean;\n /**\n * A signed-in user with no usable customer of their own (atlas#212): `\"default\"` acts as\n * `defaultCustomerId` (and gets its cart), `\"none\"` gets no customer. Required: a B2B portal\n * MUST say `\"none\"`, a site whose shoppers buy as the default customer `\"default\"`.\n */\n withoutCustomer: WithoutCustomer;\n}\n\n/** Configuration for {@link createServerSite}, combining action config and auth. */\nexport interface ServerSiteConfig extends SiteActionsConfig {\n auth?: ServerSiteAuthConfig;\n}\n\n/** The object returned by {@link createServerSite}. */\nexport interface ServerSite<TApi extends object> {\n client: TApi;\n actions: SiteActions;\n auth: NextAuthConfig | undefined;\n}\n\n/**\n * Register what queryAction and sign-in need: the secret (`auth.secret`, else `AUTH_SECRET`) and\n * whether this is the cross-site (augur_info) site, the one source both read (atlas#105). Cross-site\n * sign-in is on exactly when the client's own siteId is augur_info (owner 2026-11-16).\n */\nfunction registerSessionAuth(auth: ServerSiteAuthConfig | undefined, siteId: string): void {\n const authSecret = auth?.secret ?? process.env[\"AUTH_SECRET\"];\n if (authSecret) {\n registerAuthSecret(authSecret);\n }\n registerCrossSite(crossSiteSite(siteId));\n}\n\n/**\n * Create a server-side site instance that bundles the SDK client, server\n * actions, and (optional) NextAuth configuration.\n *\n * @example\n * ```ts\n * import { AugurAPI } from \"@simpleapps-com/augur-api\";\n * import { createServerSite } from \"@simpleapps-com/augur-server/site\";\n *\n * const api = new AugurAPI({ siteId: process.env.AUGUR_SITE_ID!, bearerToken: process.env.AUGUR_JWT! });\n * export const site = createServerSite(api, {\n * defaultCustomerId: \"12345\",\n * auth: { secret: process.env.AUTH_SECRET, withoutCustomer: \"default\" },\n * });\n * ```\n */\nexport function createServerSite<TApi extends object>(\n client: TApi,\n config: ServerSiteConfig = {},\n): ServerSite<TApi> {\n const actions = createSiteActions(client, config);\n registerSiteActions(actions);\n registerSdkClient(client);\n\n // Register a cache wrapper that captures the site's Redis config.\n // queryAction uses this to wrap read methods in Redis caching without\n // importing the cache directly (which would pull ioredis into the client\n // bundle via tsup code splitting). The SDK's raw result is cached, in its\n // own key space (withRawSdkCache, #98); queryAction unwraps after the read.\n const { cachePrefix = \"\", redisTtl = hours(1), longRedisTtl = hours(8) } = config;\n // No Redis TTL on the tier (no-cache, user): no caching; else an hour of staleTime or more,\n // the long TTL; any other, the standard (proved serverTtlOf, atlas#102).\n const cachedRaw = <T>(\n prefix: string,\n methodPath: string,\n sdkCall: () => Promise<T>,\n keyArgs: unknown[],\n ): Promise<T> => {\n const tier = getCacheTier(methodPath);\n const ttl = serverTtlOf(\n tier.redisTtl !== undefined,\n isP21Path(methodPath),\n tier.staleTime,\n redisTtl,\n longRedisTtl,\n );\n if (ttl === null) return sdkCall();\n return withRawSdkCache(prefix, ttl, methodPath, sdkCall, ...keyArgs);\n };\n registerSdkCallWrapper((methodPath, sdkCall, ...keyArgs) =>\n cachedRaw(cachePrefix, methodPath, sdkCall, keyArgs),\n );\n\n // Register scoped cache wrapper for per-request session credentials.\n // queryAction uses this to wrap scoped client calls with Redis caching\n // using the targetSiteId as the cache prefix.\n registerScopedCacheWrapper((prefix, methodPath, sdkCall, ...keyArgs) =>\n cachedRaw(prefix, methodPath, sdkCall, keyArgs),\n );\n\n // Register client factory for creating scoped SDK clients with\n // per-request credentials. Uses the same constructor + base config\n // (baseUrl, timeout, retries) but different siteId/bearerToken.\n const baseConfig = (client as Record<string, unknown>)[\"config\"] as\n Record<string, unknown> | undefined;\n if (baseConfig) {\n const Ctor = client.constructor as new (cfg: Record<string, unknown>) => object;\n registerClientFactory((siteId: string, bearerToken: string) => {\n return new Ctor({ ...baseConfig, siteId, bearerToken });\n });\n }\n\n // The client's own siteId (private config, read the same way createSiteActions reads it).\n registerSessionAuth(\n config.auth,\n baseConfig?.[\"siteId\"] === undefined ? \"\" : String(baseConfig[\"siteId\"]),\n );\n\n const auth = config.auth\n ? createAuthConfig({\n augurClient: client as unknown as AugurAuthClient,\n defaultCustomerId: config.defaultCustomerId,\n defaultContactId: config.defaultContactId,\n ...config.auth,\n })\n : undefined;\n\n return { client, actions, auth };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,aAAa;AAkBtB,SAAS,cAAc,iBAAiB;AAiCxC,SAAS,oBAAoB,MAAwC,QAAsB;AACzF,QAAM,aAAa,MAAM,UAAU,QAAQ,IAAI,aAAa;AAC5D,MAAI,YAAY;AACd,uBAAmB,UAAU;AAAA,EAC/B;AACA,oBAAkB,cAAc,MAAM,CAAC;AACzC;AAkBO,SAAS,iBACd,QACA,SAA2B,CAAC,GACV;AAClB,QAAM,UAA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
} from "./chunk-
|
|
3
|
+
} from "./chunk-IM7FDRER.js";
|
|
4
4
|
import {
|
|
5
5
|
canonicalNatValue,
|
|
6
6
|
endsWith,
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
lineFeed,
|
|
9
9
|
rStripCode,
|
|
10
10
|
startsWithAt
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-HGJF667G.js";
|
|
12
12
|
|
|
13
13
|
// ../utils/src/replace.ts
|
|
14
14
|
function codeIndex(codes, c, i) {
|
package/dist/testing.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
clearSiteActions
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-GKT4MAWC.js";
|
|
4
|
+
import "./chunk-IM7FDRER.js";
|
|
5
|
+
import "./chunk-5DBFTSWY.js";
|
|
6
|
+
import "./chunk-HGJF667G.js";
|
|
7
7
|
|
|
8
8
|
// src/testing.ts
|
|
9
9
|
import { createMockClient } from "@simpleapps-com/augur-core/testing";
|
package/llms.txt
CHANGED
|
@@ -117,6 +117,8 @@ const result = await sdkCall(
|
|
|
117
117
|
- type: AugurSession
|
|
118
118
|
- type: AugurUser
|
|
119
119
|
- type: CreateAuthConfigOptions
|
|
120
|
+
- type: PasswordAnswer
|
|
121
|
+
- type: WithoutCustomer
|
|
120
122
|
|
|
121
123
|
## @simpleapps-com/augur-server/query
|
|
122
124
|
|
|
@@ -170,7 +172,7 @@ import { createServerSite } from "@simpleapps-com/augur-server/site";
|
|
|
170
172
|
const api = new AugurAPI({ siteId: process.env.AUGUR_SITE_ID!, bearerToken: process.env.AUGUR_JWT! });
|
|
171
173
|
export const site = createServerSite(api, {
|
|
172
174
|
defaultCustomerId: "12345",
|
|
173
|
-
auth: { secret: process.env.AUTH_SECRET },
|
|
175
|
+
auth: { secret: process.env.AUTH_SECRET, withoutCustomer: "default" },
|
|
174
176
|
});
|
|
175
177
|
```
|
|
176
178
|
|
|
@@ -216,7 +218,7 @@ const addToCart = useMutation(q.commerce.cartLine.add.create());
|
|
|
216
218
|
- function: queryActionRawWith - `queryActionRaw`, bounded: the same options as {@link queryActionWith}.
|
|
217
219
|
- function: queryActionWith - `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.
|
|
218
220
|
- function: resetSessionImports - Reset lazy-loaded imports. Used in tests only. @internal
|
|
219
|
-
- function: resolveMethod
|
|
221
|
+
- function: resolveMethod
|
|
220
222
|
- value: unwrapBaseResponse
|
|
221
223
|
|
|
222
224
|
### Examples
|
package/next-auth.d.ts
CHANGED
|
@@ -33,9 +33,9 @@ declare module "next-auth" {
|
|
|
33
33
|
customerId?: string | number;
|
|
34
34
|
contactId?: string | number;
|
|
35
35
|
cartHdrUid?: number;
|
|
36
|
-
token?: string;
|
|
37
36
|
} & DefaultSession["user"];
|
|
38
|
-
token
|
|
37
|
+
// No `token`: the session reaches the browser, so the Augur token stays in the JWT (atlas#212).
|
|
38
|
+
targetSiteId?: string;
|
|
39
39
|
expires: string;
|
|
40
40
|
}
|
|
41
41
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@simpleapps-com/augur-server",
|
|
3
|
-
"version": "2026.11.
|
|
3
|
+
"version": "2026.11.12",
|
|
4
4
|
"description": "Server-side utilities for Augur ecommerce sites (Redis caching, SDK helpers, auth)",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -63,11 +63,11 @@
|
|
|
63
63
|
],
|
|
64
64
|
"dependencies": {
|
|
65
65
|
"@simpleapps-com/augur-core": "^2026.11.5",
|
|
66
|
-
"@simpleapps-com/augur-hooks": "^2026.11.
|
|
67
|
-
"@simpleapps-com/augur-utils": "^2026.11.
|
|
66
|
+
"@simpleapps-com/augur-hooks": "^2026.11.9",
|
|
67
|
+
"@simpleapps-com/augur-utils": "^2026.11.6"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
70
|
-
"@simpleapps-com/augur-api": "^2026.11.
|
|
70
|
+
"@simpleapps-com/augur-api": "^2026.11.10",
|
|
71
71
|
"@tanstack/react-query": "^5.80.0",
|
|
72
72
|
"ioredis": "^5.9.0",
|
|
73
73
|
"jose": "^5.0.0 || ^6.0.0",
|
|
@@ -99,13 +99,14 @@
|
|
|
99
99
|
"tsup": "^9.0.0",
|
|
100
100
|
"typescript": "~6.0.3",
|
|
101
101
|
"vitest": "~5.0.3",
|
|
102
|
+
"@atlas/auth-core": "0.0.0",
|
|
102
103
|
"@atlas/eslint-config": "0.0.0",
|
|
103
104
|
"@atlas/tsconfig": "0.0.0",
|
|
104
105
|
"@atlas/tsup-config": "0.0.0",
|
|
105
106
|
"@atlas/foundation": "0.0.0",
|
|
106
107
|
"@atlas/utils": "0.0.0",
|
|
107
108
|
"@atlas/vitest-config": "0.0.0",
|
|
108
|
-
"@simpleapps-com/augur-api": "2026.11.
|
|
109
|
+
"@simpleapps-com/augur-api": "2026.11.10"
|
|
109
110
|
},
|
|
110
111
|
"engines": {
|
|
111
112
|
"node": ">=22.0.0"
|