@simpleapps-com/augur-server 2.2.7 → 2.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions.js +3 -3
- package/dist/chunk-BCS5Q2MG.js +40 -0
- package/dist/chunk-BCS5Q2MG.js.map +1 -0
- package/dist/{chunk-3N37FS5N.js → chunk-OJZBX6L4.js} +38 -6
- package/dist/chunk-OJZBX6L4.js.map +1 -0
- package/dist/chunk-XSM747FM.js +33 -0
- package/dist/chunk-XSM747FM.js.map +1 -0
- package/dist/hooks.js +2 -2
- package/dist/index.js +2 -2
- package/dist/query-action.d.ts +9 -4
- package/dist/query-action.js +2 -2
- package/dist/site.js +16 -3
- package/dist/site.js.map +1 -1
- package/dist/testing.js +2 -2
- package/package.json +5 -5
- package/dist/chunk-3N37FS5N.js.map +0 -1
- package/dist/chunk-EYMB52E5.js +0 -28
- package/dist/chunk-EYMB52E5.js.map +0 -1
- package/dist/chunk-GP6W4BV3.js +0 -32
- package/dist/chunk-GP6W4BV3.js.map +0 -1
package/dist/index.js
CHANGED
package/dist/query-action.d.ts
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Generic server action that routes any SDK method call through the
|
|
3
|
-
*
|
|
4
|
-
* bridge client-side React Query hooks
|
|
2
|
+
* Generic server action that routes any SDK method call through the raw
|
|
3
|
+
* SDK client with optional Redis caching. Used internally by
|
|
4
|
+
* `createServerQueryProxy()` to bridge client-side React Query hooks
|
|
5
|
+
* to server-side API calls.
|
|
6
|
+
*
|
|
7
|
+
* For read methods (get, list, lookup, search, suggest), the call is
|
|
8
|
+
* wrapped in the registered cache wrapper (Redis) if one was registered
|
|
9
|
+
* by createServerSite(). Write methods bypass caching.
|
|
5
10
|
*
|
|
6
11
|
* @param methodPath Dot-separated SDK method path (e.g. "items.invMast.doc.get")
|
|
7
12
|
* @param args Arguments to pass to the resolved method
|
|
8
|
-
* @returns The raw result from the
|
|
13
|
+
* @returns The raw result from the SDK method (possibly from Redis cache)
|
|
9
14
|
*/
|
|
10
15
|
declare function queryAction(methodPath: string, ...args: unknown[]): Promise<unknown>;
|
|
11
16
|
|
package/dist/query-action.js
CHANGED
package/dist/site.js
CHANGED
|
@@ -3,15 +3,28 @@ import {
|
|
|
3
3
|
} from "./chunk-DYHYL6ZS.js";
|
|
4
4
|
import {
|
|
5
5
|
createSiteActions,
|
|
6
|
-
registerSiteActions
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
registerSiteActions,
|
|
7
|
+
withServerCache
|
|
8
|
+
} from "./chunk-OJZBX6L4.js";
|
|
9
|
+
import {
|
|
10
|
+
registerSdkCallWrapper,
|
|
11
|
+
registerSdkClient
|
|
12
|
+
} from "./chunk-XSM747FM.js";
|
|
9
13
|
import "./chunk-DGUM43GV.js";
|
|
10
14
|
|
|
11
15
|
// src/server-site.ts
|
|
16
|
+
import { getCacheTier } from "@simpleapps-com/augur-core";
|
|
12
17
|
function createServerSite(client, config = {}) {
|
|
13
18
|
const actions = createSiteActions(client, config);
|
|
14
19
|
registerSiteActions(actions);
|
|
20
|
+
registerSdkClient(client);
|
|
21
|
+
const { cachePrefix = "", redisTtl = 3600, longRedisTtl = 28800 } = config;
|
|
22
|
+
registerSdkCallWrapper((methodPath, sdkCall, ...keyArgs) => {
|
|
23
|
+
const tier = getCacheTier(methodPath);
|
|
24
|
+
if (tier.staleTime === 0) return sdkCall();
|
|
25
|
+
const ttl = tier.staleTime >= 36e5 ? longRedisTtl : redisTtl;
|
|
26
|
+
return withServerCache(cachePrefix, ttl, methodPath, sdkCall, ...keyArgs);
|
|
27
|
+
});
|
|
15
28
|
const auth = config.auth ? createAuthConfig({
|
|
16
29
|
augurClient: client,
|
|
17
30
|
defaultCustomerId: config.defaultCustomerId,
|
package/dist/site.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/server-site.ts"],"sourcesContent":["import { 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\";\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\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 * 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\";\n *\n * const api = new AugurApi({ baseUrl: process.env.AUGUR_API_URL! });\n * export const site = createServerSite(api, {\n * defaultCustomerId: \"12345\",\n * auth: { secret: process.env.AUTH_SECRET },\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\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":"
|
|
1
|
+
{"version":3,"sources":["../src/server-site.ts"],"sourcesContent":["import { 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 { registerSdkClient, registerSdkCallWrapper } from \"./sdk-client-store\";\nimport { withServerCache } from \"./cache/with-cache\";\nimport { getCacheTier } 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\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 * 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\";\n *\n * const api = new AugurApi({ baseUrl: process.env.AUGUR_API_URL! });\n * export const site = createServerSite(api, {\n * defaultCustomerId: \"12345\",\n * auth: { secret: process.env.AUTH_SECRET },\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 withServerCache directly (which would pull ioredis into\n // the client bundle via tsup code splitting).\n const { cachePrefix = \"\", redisTtl = 3600, longRedisTtl = 28800 } = config;\n registerSdkCallWrapper((methodPath, sdkCall, ...keyArgs) => {\n const tier = getCacheTier(methodPath);\n // Static paths (staleTime >= 1 hour): long Redis TTL\n // SemiStatic paths (staleTime > 0): standard Redis TTL\n // None (staleTime === 0): no caching\n if (tier.staleTime === 0) return sdkCall();\n const ttl = tier.staleTime >= 3_600_000 ? longRedisTtl : redisTtl;\n return withServerCache(cachePrefix, ttl, methodPath, sdkCall, ...keyArgs);\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":";;;;;;;;;;;;;;;AAQA,SAAS,oBAAoB;AAsCtB,SAAS,iBACd,QACA,SAA2B,CAAC,GACV;AAClB,QAAM,UAAU,kBAAkB,QAAQ,MAAM;AAChD,sBAAoB,OAAO;AAC3B,oBAAkB,MAAM;AAMxB,QAAM,EAAE,cAAc,IAAI,WAAW,MAAM,eAAe,MAAM,IAAI;AACpE,yBAAuB,CAAC,YAAY,YAAY,YAAY;AAC1D,UAAM,OAAO,aAAa,UAAU;AAIpC,QAAI,KAAK,cAAc,EAAG,QAAO,QAAQ;AACzC,UAAM,MAAM,KAAK,aAAa,OAAY,eAAe;AACzD,WAAO,gBAAgB,aAAa,KAAK,YAAY,SAAS,GAAG,OAAO;AAAA,EAC1E,CAAC;AAED,QAAM,OAAO,OAAO,OAChB,iBAAiB;AAAA,IACf,aAAa;AAAA,IACb,mBAAmB,OAAO;AAAA,IAC1B,kBAAkB,OAAO;AAAA,IACzB,GAAG,OAAO;AAAA,EACZ,CAAC,IACD;AAEJ,SAAO,EAAE,QAAQ,SAAS,KAAK;AACjC;","names":[]}
|
package/dist/testing.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@simpleapps-com/augur-server",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.8",
|
|
4
4
|
"description": "Server-side utilities for Augur ecommerce sites (Redis caching, SDK helpers, auth)",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -54,9 +54,9 @@
|
|
|
54
54
|
"llms.txt"
|
|
55
55
|
],
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@simpleapps-com/augur-core": "2.2.
|
|
58
|
-
"@simpleapps-com/augur-hooks": "2.2.
|
|
59
|
-
"@simpleapps-com/augur-utils": "2.2.
|
|
57
|
+
"@simpleapps-com/augur-core": "2.2.8",
|
|
58
|
+
"@simpleapps-com/augur-hooks": "2.2.8",
|
|
59
|
+
"@simpleapps-com/augur-utils": "2.2.8"
|
|
60
60
|
},
|
|
61
61
|
"peerDependencies": {
|
|
62
62
|
"@simpleapps-com/augur-api": "^2026.3.5",
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
"tsup": "^8.5.0",
|
|
85
85
|
"vitest": "^3.2.0",
|
|
86
86
|
"@augur-packages/tsconfig": "0.0.0",
|
|
87
|
-
"@simpleapps-com/augur-hooks": "2.2.
|
|
87
|
+
"@simpleapps-com/augur-hooks": "2.2.8"
|
|
88
88
|
},
|
|
89
89
|
"scripts": {
|
|
90
90
|
"build": "tsup",
|