@simpleapps-com/augur-server 2.2.3 → 2.2.4

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/hooks.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/hooks.ts"],"sourcesContent":["// \"use client\" banner is injected by tsup at build time.\n// Client-side proxy that generates React Query options backed by server actions.\n\nimport {\n createDeepProxy,\n isReadMethod,\n getCacheTier,\n buildQueryKey,\n stableArgs,\n} from \"@simpleapps-com/augur-core\";\nimport type {\n DeepQueryOptions,\n OptionsProxyConfig,\n ProxyQueryOptions,\n ProxyMutationOptions,\n} from \"@simpleapps-com/augur-core\";\nimport { queryAction } from \"./server-actions\";\n\n/**\n * Creates a client-side proxy that mirrors the SDK namespace and routes\n * every method call through a generic server action.\n *\n * Read methods (get, list, lookup, search, suggest) return TanStack Query\n * options with queryKey, queryFn, staleTime, gcTime. Write methods return\n * mutation options with mutationKey and mutationFn.\n *\n * queryFn calls the generic `queryAction` server function, which resolves\n * the method through `getSiteActions()` on the server. No SDK instance is\n * needed on the client.\n *\n * QueryKeys are identical to `createOptionsProxy` and `createKeysOnlyProxy`,\n * so SSR hydration via `createAugurOptions()` works automatically.\n *\n * @param config Optional cache configuration overrides\n *\n * @example\n * ```tsx\n * import { createServerQueryProxy } from \"@simpleapps-com/augur-server/hooks\";\n *\n * const q = createServerQueryProxy();\n *\n * // Reads — any SDK method, routed through server actions\n * const { data: item } = useQuery(q.items.invMast.doc.get(42));\n * const { data: price } = useQuery(q.pricing.priceEngine.get({ itemId, customerId }));\n *\n * // Infinite queries — spread and add infinite-specific options\n * const { data, fetchNextPage } = useInfiniteQuery({\n * ...q.items.itemCategory.categoryItems.get(uid, filters),\n * getNextPageParam: (lastPage) => lastPage.nextCursor,\n * initialPageParam: 0,\n * });\n *\n * // Mutations — write methods return mutation options\n * const addToCart = useMutation(q.commerce.cartLine.add.create());\n * ```\n */\nexport function createServerQueryProxy<TApi extends object = object>(\n config?: OptionsProxyConfig,\n): DeepQueryOptions<TApi> {\n return createDeepProxy(\n (\n path: string[],\n args: unknown[],\n ): ProxyQueryOptions<unknown> | ProxyMutationOptions<unknown, unknown[]> => {\n const methodName = path[path.length - 1]!;\n const methodPath = path.join(\".\");\n const normalizedArgs = stableArgs(args);\n\n if (isReadMethod(methodName)) {\n const tier = getCacheTier(methodPath, config?.cache);\n return {\n queryKey: buildQueryKey(path, normalizedArgs),\n queryFn: () => queryAction(methodPath, ...args),\n staleTime: tier.staleTime,\n gcTime: tier.gcTime,\n };\n }\n\n return {\n mutationKey: path,\n mutationFn: (...mutationArgs: unknown[]) => queryAction(methodPath, ...mutationArgs),\n };\n },\n ) as DeepQueryOptions<TApi>;\n}\n"],"mappings":";;;;;;;AAGA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AA+CA,SAAS,uBACd,QACwB;AACxB,SAAO;AAAA,IACL,CACE,MACA,SAC0E;AAC1E,YAAM,aAAa,KAAK,KAAK,SAAS,CAAC;AACvC,YAAM,aAAa,KAAK,KAAK,GAAG;AAChC,YAAM,iBAAiB,WAAW,IAAI;AAEtC,UAAI,aAAa,UAAU,GAAG;AAC5B,cAAM,OAAO,aAAa,YAAY,QAAQ,KAAK;AACnD,eAAO;AAAA,UACL,UAAU,cAAc,MAAM,cAAc;AAAA,UAC5C,SAAS,MAAM,YAAY,YAAY,GAAG,IAAI;AAAA,UAC9C,WAAW,KAAK;AAAA,UAChB,QAAQ,KAAK;AAAA,QACf;AAAA,MACF;AAEA,aAAO;AAAA,QACL,aAAa;AAAA,QACb,YAAY,IAAI,iBAA4B,YAAY,YAAY,GAAG,YAAY;AAAA,MACrF;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"sources":["../src/hooks.ts"],"sourcesContent":["// \"use client\" banner is injected by tsup at build time.\n// Client-side proxy that generates React Query options backed by server actions.\n//\n// IMPORTANT: This file MUST NOT import from any augur-server internal module.\n// All server-side dependencies must be injected via the queryAction parameter.\n// This prevents ioredis and other Node.js modules from leaking into the\n// client bundle via tsup code splitting.\n\nimport {\n createDeepProxy,\n isReadMethod,\n getCacheTier,\n buildQueryKey,\n stableArgs,\n} from \"@simpleapps-com/augur-core\";\nimport type {\n DeepQueryOptions,\n OptionsProxyConfig,\n ProxyQueryOptions,\n ProxyMutationOptions,\n} from \"@simpleapps-com/augur-core\";\n\n/** Server action function signature accepted by createServerQueryProxy. */\nexport type QueryActionFn = (methodPath: string, ...args: unknown[]) => Promise<unknown>;\n\n/**\n * Creates a client-side proxy that mirrors the SDK namespace and routes\n * every method call through a server action function.\n *\n * The `queryAction` parameter is the server action that bridges client\n * and server. Import it from `@simpleapps-com/augur-server/actions`:\n *\n * @example\n * ```tsx\n * import { queryAction } from \"@simpleapps-com/augur-server/actions\";\n * import { createServerQueryProxy } from \"@simpleapps-com/augur-server/hooks\";\n *\n * const q = createServerQueryProxy(queryAction);\n *\n * // Reads — any SDK method, routed through server actions\n * const { data: item } = useQuery(q.items.invMast.doc.get(42));\n * const { data: price } = useQuery(q.pricing.priceEngine.get({ itemId, customerId }));\n *\n * // Infinite queries — spread and add infinite-specific options\n * const { data, fetchNextPage } = useInfiniteQuery({\n * ...q.items.itemCategory.categoryItems.get(uid, filters),\n * getNextPageParam: (lastPage) => lastPage.nextCursor,\n * initialPageParam: 0,\n * });\n *\n * // Mutations — write methods return mutation options\n * const addToCart = useMutation(q.commerce.cartLine.add.create());\n * ```\n */\nexport function createServerQueryProxy<TApi extends object = object>(\n queryAction: QueryActionFn,\n config?: OptionsProxyConfig,\n): DeepQueryOptions<TApi> {\n return createDeepProxy(\n (\n path: string[],\n args: unknown[],\n ): ProxyQueryOptions<unknown> | ProxyMutationOptions<unknown, unknown[]> => {\n const methodName = path[path.length - 1]!;\n const methodPath = path.join(\".\");\n const normalizedArgs = stableArgs(args);\n\n if (isReadMethod(methodName)) {\n const tier = getCacheTier(methodPath, config?.cache);\n return {\n queryKey: buildQueryKey(path, normalizedArgs),\n queryFn: () => queryAction(methodPath, ...args),\n staleTime: tier.staleTime,\n gcTime: tier.gcTime,\n };\n }\n\n return {\n mutationKey: path,\n mutationFn: (...mutationArgs: unknown[]) => queryAction(methodPath, ...mutationArgs),\n };\n },\n ) as DeepQueryOptions<TApi>;\n}\n"],"mappings":";;;AAQA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAwCA,SAAS,uBACd,aACA,QACwB;AACxB,SAAO;AAAA,IACL,CACE,MACA,SAC0E;AAC1E,YAAM,aAAa,KAAK,KAAK,SAAS,CAAC;AACvC,YAAM,aAAa,KAAK,KAAK,GAAG;AAChC,YAAM,iBAAiB,WAAW,IAAI;AAEtC,UAAI,aAAa,UAAU,GAAG;AAC5B,cAAM,OAAO,aAAa,YAAY,QAAQ,KAAK;AACnD,eAAO;AAAA,UACL,UAAU,cAAc,MAAM,cAAc;AAAA,UAC5C,SAAS,MAAM,YAAY,YAAY,GAAG,IAAI;AAAA,UAC9C,WAAW,KAAK;AAAA,UAChB,QAAQ,KAAK;AAAA,QACf;AAAA,MACF;AAEA,aAAO;AAAA,QACL,aAAa;AAAA,QACb,YAAY,IAAI,iBAA4B,YAAY,YAAY,GAAG,YAAY;AAAA,MACrF;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
package/dist/index.js CHANGED
@@ -21,7 +21,7 @@ import {
21
21
  unwrap,
22
22
  unwrapOr,
23
23
  withServerCache
24
- } from "./chunk-MUTPMHZW.js";
24
+ } from "./chunk-HFAU6EOX.js";
25
25
  import "./chunk-DGUM43GV.js";
26
26
 
27
27
  // src/server-query-client.ts
package/dist/site.js CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  createSiteActions,
6
6
  registerSiteActions
7
- } from "./chunk-MUTPMHZW.js";
7
+ } from "./chunk-HFAU6EOX.js";
8
8
  import "./chunk-DGUM43GV.js";
9
9
 
10
10
  // src/server-site.ts
package/dist/testing.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  clearSiteActions
3
- } from "./chunk-MUTPMHZW.js";
3
+ } from "./chunk-HFAU6EOX.js";
4
4
  import "./chunk-DGUM43GV.js";
5
5
 
6
6
  // src/testing.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@simpleapps-com/augur-server",
3
- "version": "2.2.3",
3
+ "version": "2.2.4",
4
4
  "description": "Server-side utilities for Augur ecommerce sites (Redis caching, SDK helpers, auth)",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -50,9 +50,9 @@
50
50
  "llms.txt"
51
51
  ],
52
52
  "dependencies": {
53
- "@simpleapps-com/augur-core": "2.2.3",
54
- "@simpleapps-com/augur-hooks": "2.2.3",
55
- "@simpleapps-com/augur-utils": "2.2.3"
53
+ "@simpleapps-com/augur-core": "2.2.4",
54
+ "@simpleapps-com/augur-hooks": "2.2.4",
55
+ "@simpleapps-com/augur-utils": "2.2.4"
56
56
  },
57
57
  "peerDependencies": {
58
58
  "@simpleapps-com/augur-api": "^2026.3.5",
@@ -80,7 +80,7 @@
80
80
  "tsup": "^8.5.0",
81
81
  "vitest": "^3.2.0",
82
82
  "@augur-packages/tsconfig": "0.0.0",
83
- "@simpleapps-com/augur-hooks": "2.2.3"
83
+ "@simpleapps-com/augur-hooks": "2.2.4"
84
84
  },
85
85
  "scripts": {
86
86
  "build": "tsup",