@simpleapps-com/augur-server 2.3.1 → 2026.11.1
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 +29 -72
- package/README.md +29 -198
- package/dist/actions/agr-info.d.ts +43 -0
- package/dist/actions/agr-info.d.ts.map +1 -0
- package/dist/actions/agr-site.d.ts +37 -0
- package/dist/actions/agr-site.d.ts.map +1 -0
- package/dist/actions/agr-work.d.ts +29 -0
- package/dist/actions/agr-work.d.ts.map +1 -0
- package/dist/actions/avalara.d.ts +38 -0
- package/dist/actions/avalara.d.ts.map +1 -0
- package/dist/actions/basecamp2.d.ts +47 -0
- package/dist/actions/basecamp2.d.ts.map +1 -0
- package/dist/actions/brand-folder.d.ts +38 -0
- package/dist/actions/brand-folder.d.ts.map +1 -0
- package/dist/actions/commerce.d.ts +58 -0
- package/dist/actions/commerce.d.ts.map +1 -0
- package/dist/actions/customers.d.ts +44 -0
- package/dist/actions/customers.d.ts.map +1 -0
- package/dist/actions/favorites.d.ts +20 -0
- package/dist/actions/favorites.d.ts.map +1 -0
- package/dist/actions/gregorovich.d.ts +34 -0
- package/dist/actions/gregorovich.d.ts.map +1 -0
- package/dist/actions/items.d.ts +80 -0
- package/dist/actions/items.d.ts.map +1 -0
- package/dist/actions/joomla.d.ts +59 -0
- package/dist/actions/joomla.d.ts.map +1 -0
- package/dist/actions/legacy.d.ts +45 -0
- package/dist/actions/legacy.d.ts.map +1 -0
- package/dist/actions/logistics.d.ts +40 -0
- package/dist/actions/logistics.d.ts.map +1 -0
- package/dist/actions/orders.d.ts +36 -0
- package/dist/actions/orders.d.ts.map +1 -0
- package/dist/actions/p21-apis.d.ts +33 -0
- package/dist/actions/p21-apis.d.ts.map +1 -0
- package/dist/actions/p21-core.d.ts +46 -0
- package/dist/actions/p21-core.d.ts.map +1 -0
- package/dist/actions/p21-pim.d.ts +36 -0
- package/dist/actions/p21-pim.d.ts.map +1 -0
- package/dist/actions/p21-sism.d.ts +37 -0
- package/dist/actions/p21-sism.d.ts.map +1 -0
- package/dist/actions/payments.d.ts +39 -0
- package/dist/actions/payments.d.ts.map +1 -0
- package/dist/actions/pricing.d.ts +45 -0
- package/dist/actions/pricing.d.ts.map +1 -0
- package/dist/actions/search.d.ts +61 -0
- package/dist/actions/search.d.ts.map +1 -0
- package/dist/actions/shipping.d.ts +56 -0
- package/dist/actions/shipping.d.ts.map +1 -0
- package/dist/actions/site.d.ts +141 -0
- package/dist/actions/site.d.ts.map +1 -0
- package/dist/actions/smarty-streets.d.ts +45 -0
- package/dist/actions/smarty-streets.d.ts.map +1 -0
- package/dist/actions/vmi.d.ts +44 -0
- package/dist/actions/vmi.d.ts.map +1 -0
- package/dist/actions/wishlists.d.ts +28 -0
- package/dist/actions/wishlists.d.ts.map +1 -0
- package/dist/api-handler.d.ts +25 -0
- package/dist/api-handler.d.ts.map +1 -0
- package/dist/api.d.ts +2 -26
- package/dist/api.d.ts.map +1 -0
- package/dist/api.js +19 -14
- package/dist/api.js.map +1 -1
- package/dist/auth.d.ts +10 -12
- package/dist/auth.d.ts.map +1 -0
- package/dist/auth.js +2 -2
- package/dist/cache/redis-client.d.ts +16 -0
- package/dist/cache/redis-client.d.ts.map +1 -0
- package/dist/cache/with-cache.d.ts +18 -0
- package/dist/cache/with-cache.d.ts.map +1 -0
- package/dist/chunk-FWO6Q43T.js +162 -0
- package/dist/chunk-FWO6Q43T.js.map +1 -0
- package/dist/{chunk-HPQQYROJ.js → chunk-NTUPTNOI.js} +40 -7
- package/dist/chunk-NTUPTNOI.js.map +1 -0
- package/dist/{chunk-WOHZDFJF.js → chunk-PFYEMJTQ.js} +212 -642
- package/dist/chunk-PFYEMJTQ.js.map +1 -0
- package/dist/{chunk-KHFEDL47.js → chunk-SXXWBSTX.js} +18 -12
- package/dist/chunk-SXXWBSTX.js.map +1 -0
- package/dist/chunk-TVH5EONP.js +178 -0
- package/dist/chunk-TVH5EONP.js.map +1 -0
- package/dist/{chunk-TQP67TGL.js → chunk-U2BKHRJC.js} +13 -15
- package/dist/chunk-U2BKHRJC.js.map +1 -0
- package/dist/environment.d.ts +10 -0
- package/dist/environment.d.ts.map +1 -0
- package/dist/hooks.d.ts +8 -10
- package/dist/hooks.d.ts.map +1 -0
- package/dist/hooks.js +3 -3
- package/dist/hooks.js.map +1 -1
- package/dist/index.d.ts +16 -125
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +12 -8
- package/dist/index.js.map +1 -1
- package/dist/pagination.d.ts +32 -0
- package/dist/pagination.d.ts.map +1 -0
- package/dist/query-action.d.ts +156 -17
- package/dist/query-action.d.ts.map +1 -0
- package/dist/query-action.js +3 -3
- package/dist/query-options-helper.d.ts +33 -0
- package/dist/query-options-helper.d.ts.map +1 -0
- package/dist/query.js +1 -2
- package/dist/recaptcha.d.ts +6 -0
- package/dist/recaptcha.d.ts.map +1 -0
- package/dist/rules.d.ts +221 -0
- package/dist/rules.d.ts.map +1 -0
- package/dist/scoped-client-key.d.ts +9 -0
- package/dist/scoped-client-key.d.ts.map +1 -0
- package/dist/sdk-call.d.ts +66 -0
- package/dist/sdk-call.d.ts.map +1 -0
- package/dist/sdk-client-store.d.ts +250 -0
- package/dist/sdk-client-store.d.ts.map +1 -0
- package/dist/server-actions.d.ts +2 -0
- package/dist/server-actions.d.ts.map +1 -0
- package/dist/server-query-client.d.ts +19 -0
- package/dist/server-query-client.d.ts.map +1 -0
- package/dist/{server-site-registry-CdBfczOj.d.ts → server-site-registry.d.ts} +7 -9
- package/dist/server-site-registry.d.ts.map +1 -0
- package/dist/{site.d.ts → server-site.d.ts} +11 -16
- package/dist/server-site.d.ts.map +1 -0
- package/dist/site-actions-store.d.ts +27 -0
- package/dist/site-actions-store.d.ts.map +1 -0
- package/dist/site.js +10 -10
- package/dist/site.js.map +1 -1
- package/dist/testing.d.ts +9 -12
- package/dist/testing.d.ts.map +1 -0
- package/dist/testing.js +7 -27
- package/dist/testing.js.map +1 -1
- package/dist/utils/batch-fetch.d.ts +7 -0
- package/dist/utils/batch-fetch.d.ts.map +1 -0
- package/llms.txt +71 -50
- package/package.json +34 -20
- package/dist/actions.d.ts +0 -2
- package/dist/chunk-DGUM43GV.js +0 -11
- package/dist/chunk-DGUM43GV.js.map +0 -1
- package/dist/chunk-HPQQYROJ.js.map +0 -1
- package/dist/chunk-KHFEDL47.js.map +0 -1
- package/dist/chunk-TQP67TGL.js.map +0 -1
- package/dist/chunk-WOHZDFJF.js.map +0 -1
- package/dist/chunk-ZUJZDRTP.js +0 -136
- package/dist/chunk-ZUJZDRTP.js.map +0 -1
- package/dist/query.d.ts +0 -31
- package/dist/site-BjSFqufX.d.ts +0 -469
package/EXPORTS.md
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
# @simpleapps-com/augur-server exports
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
> Auto-generated from built type declarations. Do not edit manually.
|
|
6
|
-
> Regenerate with: `pnpm run generate-exports`
|
|
3
|
+
> Generated from the package's build by `pnpm -C repo/sites/augur-build generate`. Do not edit by hand.
|
|
4
|
+
> Guide: https://augur.build/docs/packages/augur-server
|
|
7
5
|
|
|
8
6
|
## `@simpleapps-com/augur-server`
|
|
9
7
|
|
|
@@ -11,41 +9,33 @@ Version: 2.2.29
|
|
|
11
9
|
|
|
12
10
|
| Export | Kind | Description |
|
|
13
11
|
|--------|------|-------------|
|
|
14
|
-
| `
|
|
15
|
-
| `
|
|
16
|
-
| `
|
|
17
|
-
| `
|
|
18
|
-
| `batchFetch` | function | Fetches data for multiple params in parallel, returning a Record keyed by |
|
|
19
|
-
| `cacheGet` | function | Read a cached value by key. |
|
|
20
|
-
| `cacheSet` | function | Write a value to cache with a TTL. Fire-and-forget semantics: no-ops |
|
|
21
|
-
| `createQueryOptions` | value | |
|
|
12
|
+
| `batchFetch` | function | Fetches data for multiple params in parallel, returning a Record keyed by `getKey(param)`. Individual failures are silently excluded from the result so one bad item never takes down the entire batch. |
|
|
13
|
+
| `cacheGet` | function | Read a cached value by key. Returns `null` on cache miss, circuit-open, connection failure, or if Redis is unavailable. Never throws. |
|
|
14
|
+
| `cacheSet` | function | Write a value to cache with a TTL. Fire-and-forget semantics: no-ops silently when the circuit is open or Redis is unavailable. Never throws. |
|
|
15
|
+
| `createQueryOptions` | const | Creates useQuery options with consistent key generation. Filters out undefined/null/empty params from the query key. |
|
|
22
16
|
| `createServerQueryClient` | function | Creates a server-side query client optimised for prefetching. |
|
|
23
|
-
| `createSiteActions` | function |
|
|
24
|
-
| `createSuspenseQueryOptions` |
|
|
17
|
+
| `createSiteActions` | function | Creates a unified site actions object with all service factories. |
|
|
18
|
+
| `createSuspenseQueryOptions` | const | Creates useSuspenseQuery options with consistent key generation. Same as createQueryOptions but without enabledFn (suspense queries cannot be disabled). |
|
|
25
19
|
| `env` | const | Resolved environment: `"development"`, `"staging"`, or `"production"`. |
|
|
26
20
|
| `getCircuitState` | function | Returns the current circuit breaker state. |
|
|
27
21
|
| `getServerQueryClient` | const | Returns a per-request singleton QueryClient for React Server Components. |
|
|
28
|
-
| `getSiteActions` | function |
|
|
22
|
+
| `getSiteActions` | function | Returns the registered site actions instance. |
|
|
29
23
|
| `isDev` | const | `true` when running locally (localhost / NODE_ENV=development). |
|
|
30
24
|
| `isProduction` | const | `true` when running on the production deployment. |
|
|
31
25
|
| `isRedisConnected` | function | Whether the Redis client is connected and ready to accept commands. |
|
|
32
26
|
| `isStaging` | const | `true` when running on the staging/dev deployment. |
|
|
33
|
-
| `paginateOffset` | function |
|
|
34
|
-
| `registerSiteActions` | function |
|
|
35
|
-
| `safeAction` | function | Wraps an async function call with error handling, returning a |
|
|
27
|
+
| `paginateOffset` | function | Wraps a list of items with offset-based pagination metadata. |
|
|
28
|
+
| `registerSiteActions` | function | Stores the site actions instance for use by server action exports. Called automatically by {@link createServerSite}. |
|
|
29
|
+
| `safeAction` | function | Wraps an async function call with error handling, returning a `SafeActionResult<T>` instead of throwing. |
|
|
36
30
|
| `sdkCall` | function | Calls an Augur SDK method, forwarding all arguments with full type safety. |
|
|
37
31
|
| `unwrap` | value | |
|
|
38
32
|
| `unwrapOr` | value | |
|
|
39
|
-
| `verifyRecaptcha` | function | Server-side Google reCAPTCHA v3 verification. |
|
|
33
|
+
| `verifyRecaptcha` | function | Server-side Google reCAPTCHA v3 verification. Used by API routes that accept public form submissions. |
|
|
40
34
|
| `withServerCache` | function | Server-side cache wrapper using augur-server's Redis client. |
|
|
41
35
|
|
|
42
36
|
### Types
|
|
43
37
|
|
|
44
|
-
`PaginatedResult`, `SiteActions`, `SiteActionsConfig`
|
|
45
|
-
|
|
46
|
-
```ts
|
|
47
|
-
import { ActionResult, EdgeCacheValue, QueryOptionsConfig } from "@simpleapps-com/augur-server";
|
|
48
|
-
```
|
|
38
|
+
`ActionResult`, `EdgeCacheValue`, `PaginatedResult`, `QueryOptionsConfig`, `SafeActionResult`, `SiteActions`, `SiteActionsConfig`
|
|
49
39
|
|
|
50
40
|
## `@simpleapps-com/augur-server/auth`
|
|
51
41
|
|
|
@@ -59,46 +49,32 @@ import { ActionResult, EdgeCacheValue, QueryOptionsConfig } from "@simpleapps-co
|
|
|
59
49
|
|
|
60
50
|
`AugurAuthCallbacks`, `AugurAuthClient`, `AugurJWT`, `AugurSession`, `AugurUser`, `CreateAuthConfigOptions`
|
|
61
51
|
|
|
62
|
-
```ts
|
|
63
|
-
import { createAuthConfig } from "@simpleapps-com/augur-server/auth";
|
|
64
|
-
```
|
|
65
|
-
|
|
66
52
|
## `@simpleapps-com/augur-server/query`
|
|
67
53
|
|
|
68
54
|
### Values
|
|
69
55
|
|
|
70
56
|
| Export | Kind | Description |
|
|
71
57
|
|--------|------|-------------|
|
|
72
|
-
| `createQueryOptions` | const | Creates useQuery options with consistent key generation. |
|
|
73
|
-
| `createSuspenseQueryOptions` | const | Creates useSuspenseQuery options with consistent key generation. |
|
|
58
|
+
| `createQueryOptions` | const | Creates useQuery options with consistent key generation. Filters out undefined/null/empty params from the query key. |
|
|
59
|
+
| `createSuspenseQueryOptions` | const | Creates useSuspenseQuery options with consistent key generation. Same as createQueryOptions but without enabledFn (suspense queries cannot be disabled). |
|
|
74
60
|
|
|
75
61
|
### Types
|
|
76
62
|
|
|
77
63
|
`QueryOptionsConfig`
|
|
78
64
|
|
|
79
|
-
```ts
|
|
80
|
-
import { createQueryOptions, createSuspenseQueryOptions } from "@simpleapps-com/augur-server/query";
|
|
81
|
-
```
|
|
82
|
-
|
|
83
65
|
## `@simpleapps-com/augur-server/testing`
|
|
84
66
|
|
|
85
67
|
### Values
|
|
86
68
|
|
|
87
69
|
| Export | Kind | Description |
|
|
88
70
|
|--------|------|-------------|
|
|
89
|
-
| `
|
|
90
|
-
| `MockClientResult` | value | |
|
|
91
|
-
| `clearSiteActions` | function | |
|
|
71
|
+
| `clearSiteActions` | function | Clears the registered site actions. Used in tests only. |
|
|
92
72
|
| `createMockClient` | value | |
|
|
93
73
|
| `createMockSiteActions` | function | Creates a fully-mocked SiteActions object for testing. |
|
|
94
74
|
|
|
95
75
|
### Types
|
|
96
76
|
|
|
97
|
-
`MockFn`, `MockSiteActions`, `MockSiteActionsResult`
|
|
98
|
-
|
|
99
|
-
```ts
|
|
100
|
-
import { DeepMockClient, MockClientResult, clearSiteActions } from "@simpleapps-com/augur-server/testing";
|
|
101
|
-
```
|
|
77
|
+
`DeepMockClient`, `MockClientResult`, `MockFn`, `MockSiteActions`, `MockSiteActionsResult`
|
|
102
78
|
|
|
103
79
|
## `@simpleapps-com/augur-server/site`
|
|
104
80
|
|
|
@@ -106,29 +82,17 @@ import { DeepMockClient, MockClientResult, clearSiteActions } from "@simpleapps-
|
|
|
106
82
|
|
|
107
83
|
| Export | Kind | Description |
|
|
108
84
|
|--------|------|-------------|
|
|
109
|
-
| `createServerSite` | function | Create a server-side site instance that bundles the SDK client, server |
|
|
85
|
+
| `createServerSite` | function | Create a server-side site instance that bundles the SDK client, server actions, and (optional) NextAuth configuration. |
|
|
110
86
|
|
|
111
87
|
### Types
|
|
112
88
|
|
|
113
89
|
`ServerSite`, `ServerSiteAuthConfig`, `ServerSiteConfig`
|
|
114
90
|
|
|
115
|
-
```ts
|
|
116
|
-
import { createServerSite } from "@simpleapps-com/augur-server/site";
|
|
117
|
-
```
|
|
118
|
-
|
|
119
91
|
## `@simpleapps-com/augur-server/actions`
|
|
120
92
|
|
|
121
|
-
###
|
|
122
|
-
|
|
123
|
-
| Export | Kind | Description |
|
|
124
|
-
|--------|------|-------------|
|
|
125
|
-
| `ApiResult` | value | |
|
|
126
|
-
| `ListResult` | value | |
|
|
127
|
-
| `SafeActionResult` | value | |
|
|
93
|
+
### Types
|
|
128
94
|
|
|
129
|
-
|
|
130
|
-
import { ApiResult, ListResult, SafeActionResult } from "@simpleapps-com/augur-server/actions";
|
|
131
|
-
```
|
|
95
|
+
`ApiResult`, `ListResult`, `SafeActionResult`
|
|
132
96
|
|
|
133
97
|
## `@simpleapps-com/augur-server/hooks`
|
|
134
98
|
|
|
@@ -136,12 +100,11 @@ import { ApiResult, ListResult, SafeActionResult } from "@simpleapps-com/augur-s
|
|
|
136
100
|
|
|
137
101
|
| Export | Kind | Description |
|
|
138
102
|
|--------|------|-------------|
|
|
139
|
-
| `
|
|
140
|
-
|
|
103
|
+
| `createServerQueryProxy` | function | Creates a client-side proxy that mirrors the SDK namespace and routes every method call through a server action function. |
|
|
104
|
+
|
|
105
|
+
### Types
|
|
141
106
|
|
|
142
|
-
|
|
143
|
-
import { QueryActionFn, createServerQueryProxy } from "@simpleapps-com/augur-server/hooks";
|
|
144
|
-
```
|
|
107
|
+
`QueryActionFn`
|
|
145
108
|
|
|
146
109
|
## `@simpleapps-com/augur-server/query-action`
|
|
147
110
|
|
|
@@ -150,14 +113,10 @@ import { QueryActionFn, createServerQueryProxy } from "@simpleapps-com/augur-ser
|
|
|
150
113
|
| Export | Kind | Description |
|
|
151
114
|
|--------|------|-------------|
|
|
152
115
|
| `getSessionCredentials` | function | Resolve session credentials from the Auth.js JWT cookie. |
|
|
153
|
-
| `queryAction` | function | Generic server action that routes any SDK method call through the raw |
|
|
116
|
+
| `queryAction` | function | Generic server action that routes any SDK method call through the raw SDK client with optional Redis caching. Used internally by `createServerQueryProxy()` to bridge client-side React Query hooks to server-side API calls. |
|
|
154
117
|
| `resetSessionImports` | function | Reset lazy-loaded imports. Used in tests only. @internal |
|
|
155
118
|
| `resolveMethod` | function | Resolve a dot-separated method path on an object, returning the leaf function. |
|
|
156
|
-
| `unwrapBaseResponse` |
|
|
157
|
-
|
|
158
|
-
```ts
|
|
159
|
-
import { getSessionCredentials, queryAction, resetSessionImports } from "@simpleapps-com/augur-server/query-action";
|
|
160
|
-
```
|
|
119
|
+
| `unwrapBaseResponse` | value | |
|
|
161
120
|
|
|
162
121
|
## `@simpleapps-com/augur-server/api`
|
|
163
122
|
|
|
@@ -167,8 +126,6 @@ import { getSessionCredentials, queryAction, resetSessionImports } from "@simple
|
|
|
167
126
|
|--------|------|-------------|
|
|
168
127
|
| `createAugurApiHandler` | function | Creates a Next.js Route Handler that routes method calls through queryAction. |
|
|
169
128
|
|
|
170
|
-
```ts
|
|
171
|
-
import { createAugurApiHandler } from "@simpleapps-com/augur-server/api";
|
|
172
|
-
```
|
|
173
|
-
|
|
174
129
|
## `@simpleapps-com/augur-server/next-auth`
|
|
130
|
+
|
|
131
|
+
No exports.
|
package/README.md
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
# @simpleapps-com/augur-server
|
|
2
2
|
|
|
3
|
-
>
|
|
3
|
+
> The server side of an Augur Next.js site: createServerSite, the server query proxy, queryAction, Redis caching, NextAuth and environment detection
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Part of the **@simpleapps-com/augur-\*** platform. Each package releases on its own CalVer
|
|
6
|
+
version; nothing requires them to share one.
|
|
6
7
|
|
|
7
|
-
|
|
8
|
+
- Guide: https://augur.build/docs/packages/augur-server
|
|
9
|
+
- Every export: [`EXPORTS.md`](EXPORTS.md) (generated from the build)
|
|
10
|
+
- Releases: https://augur.build/docs/packages/changelog
|
|
8
11
|
|
|
9
12
|
## Install
|
|
10
13
|
|
|
@@ -12,201 +15,29 @@ Part of the **@simpleapps-com/augur-\*** platform. All packages use fixed versio
|
|
|
12
15
|
pnpm add @simpleapps-com/augur-server
|
|
13
16
|
```
|
|
14
17
|
|
|
15
|
-
|
|
18
|
+
| Import | Purpose |
|
|
19
|
+
| ------------------------------------------- | ------------------------------------------------------- |
|
|
20
|
+
| `@simpleapps-com/augur-server` | Site actions, caching, `safeAction`, environment, Redis |
|
|
21
|
+
| `@simpleapps-com/augur-server/site` | `createServerSite` |
|
|
22
|
+
| `@simpleapps-com/augur-server/hooks` | `createServerQueryProxy` (registers `queryAction`) |
|
|
23
|
+
| `@simpleapps-com/augur-server/query-action` | `queryAction`, `getSessionCredentials` |
|
|
24
|
+
| `@simpleapps-com/augur-server/api` | `createAugurApiHandler` (fetch mode) |
|
|
25
|
+
| `@simpleapps-com/augur-server/auth` | `createAuthConfig` |
|
|
26
|
+
| `@simpleapps-com/augur-server/query` | `createQueryOptions`, `createSuspenseQueryOptions` |
|
|
27
|
+
| `@simpleapps-com/augur-server/actions` | Types only |
|
|
28
|
+
| `@simpleapps-com/augur-server/testing` | `createMockSiteActions`, `createMockClient` |
|
|
29
|
+
| `@simpleapps-com/augur-server/next-auth` | NextAuth type augmentations |
|
|
30
|
+
|
|
31
|
+
## Development
|
|
32
|
+
|
|
33
|
+
TypeScript in `src/`, built to `dist/` (ESM) by tsup with `"use server"` and `"use client"`
|
|
34
|
+
banners per entry. The decisions are proved (`src/rules.ts`, `src/scoped-client-key.ts`; model
|
|
35
|
+
`models/AugurServer.dfy`, links `models/links/augur-server-*.dfy`); the rest is tested at 100%.
|
|
16
36
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
| Import | Description |
|
|
22
|
-
|--------|-------------|
|
|
23
|
-
| `@simpleapps-com/augur-server` | 27 exports, 3 types |
|
|
24
|
-
| `@simpleapps-com/augur-server/auth` | 1 exports, 6 types |
|
|
25
|
-
| `@simpleapps-com/augur-server/query` | 2 exports, 1 types |
|
|
26
|
-
| `@simpleapps-com/augur-server/testing` | 5 exports, 3 types |
|
|
27
|
-
| `@simpleapps-com/augur-server/site` | 1 exports, 3 types |
|
|
28
|
-
| `@simpleapps-com/augur-server/actions` | 3 exports, 0 types |
|
|
29
|
-
| `@simpleapps-com/augur-server/hooks` | 2 exports, 0 types |
|
|
30
|
-
| `@simpleapps-com/augur-server/query-action` | 5 exports, 0 types |
|
|
31
|
-
| `@simpleapps-com/augur-server/api` | 1 exports, 0 types |
|
|
32
|
-
| `@simpleapps-com/augur-server/next-auth` | 0 exports, 0 types |
|
|
33
|
-
|
|
34
|
-
## Exports
|
|
35
|
-
|
|
36
|
-
### Auth & Context
|
|
37
|
-
|
|
38
|
-
| Export | Kind | Description |
|
|
39
|
-
|--------|------|-------------|
|
|
40
|
-
| `QueryOptionsConfig` | value | |
|
|
41
|
-
| `createQueryOptions` | value | |
|
|
42
|
-
| `createSiteActions` | function | |
|
|
43
|
-
| `createSuspenseQueryOptions` | value | |
|
|
44
|
-
| `getSiteActions` | function | |
|
|
45
|
-
| `registerSiteActions` | function | |
|
|
46
|
-
| `createAuthConfig` | function | Creates a NextAuth configuration with Joomla credential provider, session callbacks, and automatic cart initialization. |
|
|
47
|
-
| `createQueryOptions` | const | Creates useQuery options with consistent key generation. |
|
|
48
|
-
| `createSuspenseQueryOptions` | const | Creates useSuspenseQuery options with consistent key generation. |
|
|
49
|
-
| `clearSiteActions` | function | |
|
|
50
|
-
| `createMockSiteActions` | function | Creates a fully-mocked SiteActions object for testing. |
|
|
51
|
-
| `createServerSite` | function | Create a server-side site instance that bundles the SDK client, server |
|
|
52
|
-
| `getSessionCredentials` | function | Resolve session credentials from the Auth.js JWT cookie. |
|
|
53
|
-
| `resetSessionImports` | function | Reset lazy-loaded imports. Used in tests only. @internal |
|
|
54
|
-
|
|
55
|
-
### Items & Categories
|
|
56
|
-
|
|
57
|
-
| Export | Kind | Description |
|
|
58
|
-
|--------|------|-------------|
|
|
59
|
-
| `isProduction` | const | `true` when running on the production deployment. |
|
|
60
|
-
|
|
61
|
-
### Transforms
|
|
62
|
-
|
|
63
|
-
| Export | Kind | Description |
|
|
64
|
-
|--------|------|-------------|
|
|
65
|
-
| `paginateOffset` | function | |
|
|
66
|
-
|
|
67
|
-
### Utilities
|
|
68
|
-
|
|
69
|
-
| Export | Kind | Description |
|
|
70
|
-
|--------|------|-------------|
|
|
71
|
-
| `unwrap` | value | |
|
|
72
|
-
| `unwrapOr` | value | |
|
|
73
|
-
| `unwrapBaseResponse` | function | Unwrap SDK BaseResponse if the result matches the standard shape. |
|
|
74
|
-
|
|
75
|
-
### Other
|
|
76
|
-
|
|
77
|
-
| Export | Kind | Description |
|
|
78
|
-
|--------|------|-------------|
|
|
79
|
-
| `ActionResult` | value | |
|
|
80
|
-
| `EdgeCacheValue` | value | |
|
|
81
|
-
| `SafeActionResult` | value | |
|
|
82
|
-
| `batchFetch` | function | Fetches data for multiple params in parallel, returning a Record keyed by |
|
|
83
|
-
| `cacheGet` | function | Read a cached value by key. |
|
|
84
|
-
| `cacheSet` | function | Write a value to cache with a TTL. Fire-and-forget semantics: no-ops |
|
|
85
|
-
| `createServerQueryClient` | function | Creates a server-side query client optimised for prefetching. |
|
|
86
|
-
| `env` | const | Resolved environment: `"development"`, `"staging"`, or `"production"`. |
|
|
87
|
-
| `getCircuitState` | function | Returns the current circuit breaker state. |
|
|
88
|
-
| `getServerQueryClient` | const | Returns a per-request singleton QueryClient for React Server Components. |
|
|
89
|
-
| `isDev` | const | `true` when running locally (localhost / NODE_ENV=development). |
|
|
90
|
-
| `isRedisConnected` | function | Whether the Redis client is connected and ready to accept commands. |
|
|
91
|
-
| `isStaging` | const | `true` when running on the staging/dev deployment. |
|
|
92
|
-
| `safeAction` | function | Wraps an async function call with error handling, returning a |
|
|
93
|
-
| `sdkCall` | function | Calls an Augur SDK method, forwarding all arguments with full type safety. |
|
|
94
|
-
| `verifyRecaptcha` | function | Server-side Google reCAPTCHA v3 verification. |
|
|
95
|
-
| `withServerCache` | function | Server-side cache wrapper using augur-server's Redis client. |
|
|
96
|
-
| `DeepMockClient` | value | |
|
|
97
|
-
| `MockClientResult` | value | |
|
|
98
|
-
| `createMockClient` | value | |
|
|
99
|
-
| `ApiResult` | value | |
|
|
100
|
-
| `ListResult` | value | |
|
|
101
|
-
| `SafeActionResult` | value | |
|
|
102
|
-
| `QueryActionFn` | value | |
|
|
103
|
-
| `createServerQueryProxy` | function | Creates a client-side proxy that mirrors the SDK namespace and routes |
|
|
104
|
-
| `queryAction` | function | Generic server action that routes any SDK method call through the raw |
|
|
105
|
-
| `resolveMethod` | function | Resolve a dot-separated method path on an object, returning the leaf function. |
|
|
106
|
-
| `createAugurApiHandler` | function | Creates a Next.js Route Handler that routes method calls through queryAction. |
|
|
107
|
-
|
|
108
|
-
## Examples
|
|
109
|
-
|
|
110
|
-
### safeAction
|
|
111
|
-
|
|
112
|
-
```ts
|
|
113
|
-
const result = await safeAction(
|
|
114
|
-
() => actions.commerce.addToCart(cartId, items),
|
|
115
|
-
);
|
|
116
|
-
if (result.ok) {
|
|
117
|
-
// result.data is the response data (undefined for void actions)
|
|
118
|
-
} else {
|
|
119
|
-
// result.error is the error message
|
|
120
|
-
}
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
### sdkCall
|
|
124
|
-
|
|
125
|
-
```ts
|
|
126
|
-
const result = await sdkCall(
|
|
127
|
-
augurServices.items.invMast.get,
|
|
128
|
-
invMastUid,
|
|
129
|
-
{ edgeCache: 4 },
|
|
130
|
-
);
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
### createMockSiteActions
|
|
134
|
-
|
|
135
|
-
```ts
|
|
136
|
-
import { createMockSiteActions } from "@simpleapps-com/augur-server/testing";
|
|
137
|
-
|
|
138
|
-
const { actions, mocks } = createMockSiteActions();
|
|
139
|
-
|
|
140
|
-
// Setup return values
|
|
141
|
-
mocks.pricing.getItemPrice.mockResolvedValue({ price: 9.99 });
|
|
142
|
-
|
|
143
|
-
// Pass actions to your component/server action
|
|
144
|
-
const price = await actions.pricing.getItemPrice("ITEM-1");
|
|
145
|
-
|
|
146
|
-
// Assert calls
|
|
147
|
-
expect(mocks.pricing.getItemPrice.mock.calls[0]).toEqual(["ITEM-1"]);
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
### createServerSite
|
|
151
|
-
|
|
152
|
-
```ts
|
|
153
|
-
import { AugurApi } from "@simpleapps-com/augur-api";
|
|
154
|
-
import { createServerSite } from "@simpleapps-com/augur-server";
|
|
155
|
-
|
|
156
|
-
const api = new AugurApi({ baseUrl: process.env.AUGUR_API_URL! });
|
|
157
|
-
export const site = createServerSite(api, {
|
|
158
|
-
defaultCustomerId: "12345",
|
|
159
|
-
auth: { secret: process.env.AUTH_SECRET },
|
|
160
|
-
});
|
|
161
|
-
```
|
|
162
|
-
|
|
163
|
-
### createServerQueryProxy
|
|
164
|
-
|
|
165
|
-
```tsx
|
|
166
|
-
import { createServerQueryProxy } from "@simpleapps-com/augur-server/hooks";
|
|
167
|
-
|
|
168
|
-
const q = createServerQueryProxy();
|
|
169
|
-
|
|
170
|
-
// Reads — any SDK method, routed through server actions
|
|
171
|
-
const { data: item } = useQuery(q.items.invMast.doc.get(42));
|
|
172
|
-
const { data: price } = useQuery(q.pricing.priceEngine.get({ itemId, customerId }));
|
|
173
|
-
|
|
174
|
-
// Infinite queries — spread and add infinite-specific options
|
|
175
|
-
const { data, fetchNextPage } = useInfiniteQuery({
|
|
176
|
-
...q.items.itemCategory.categoryItems.get(uid, filters),
|
|
177
|
-
getNextPageParam: (lastPage) => lastPage.nextCursor,
|
|
178
|
-
initialPageParam: 0,
|
|
179
|
-
});
|
|
180
|
-
|
|
181
|
-
// Mutations — write methods return mutation options
|
|
182
|
-
const addToCart = useMutation(q.commerce.cartLine.add.create());
|
|
183
|
-
```
|
|
184
|
-
|
|
185
|
-
### createAugurApiHandler
|
|
186
|
-
|
|
187
|
-
```ts
|
|
188
|
-
// app/api/augur/route.ts
|
|
189
|
-
import { createAugurApiHandler } from "@simpleapps-com/augur-server/api";
|
|
190
|
-
|
|
191
|
-
const handler = createAugurApiHandler();
|
|
192
|
-
export const POST = handler;
|
|
37
|
+
```bash
|
|
38
|
+
pnpm -C repo/packages/augur-server test
|
|
39
|
+
pnpm -C repo/packages/augur-server proofs
|
|
193
40
|
```
|
|
194
41
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
`PaginatedResult`, `SiteActions`, `SiteActionsConfig`, `AugurAuthCallbacks`, `AugurAuthClient`, `AugurJWT`, `AugurSession`, `AugurUser`, `CreateAuthConfigOptions`, `QueryOptionsConfig`, `MockFn`, `MockSiteActions`, `MockSiteActionsResult`, `ServerSite`, `ServerSiteAuthConfig`, `ServerSiteConfig`
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
## Related Packages
|
|
201
|
-
|
|
202
|
-
All packages use fixed versioning -- same version number across the platform.
|
|
203
|
-
|
|
204
|
-
| Package | Description |
|
|
205
|
-
|---------|-------------|
|
|
206
|
-
| `@simpleapps-com/augur-config` | Shared tooling configuration presets for Augur ecommerce sites |
|
|
207
|
-
| `@simpleapps-com/augur-core` | Universal foundation for Augur packages — proxy infrastructure, cache keys, method classification, shared types |
|
|
208
|
-
| `@simpleapps-com/augur-hooks` | Cross-platform React Query hooks and Zustand stores for Augur ecommerce sites |
|
|
209
|
-
| `@simpleapps-com/augur-mobile` | React Native/Expo adapters for Augur ecommerce apps (offline sync, biometrics, push) |
|
|
210
|
-
| `@simpleapps-com/augur-tailwind` | Shared Tailwind CSS v4 theme with HSL variables for Augur ecommerce sites |
|
|
211
|
-
| `@simpleapps-com/augur-utils` | Shared types, cache configuration, and utility functions for Augur ecommerce sites |
|
|
212
|
-
| `@simpleapps-com/augur-web` | Shared React UI components for Augur ecommerce sites (Radix + Tailwind) |
|
|
42
|
+
A change to its exports MUST come with `pnpm -C repo/sites/augur-build generate` (the drift
|
|
43
|
+
test fails otherwise), and the guide changes in the same PR.
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { AugurAPI } from "@simpleapps-com/augur-api";
|
|
2
|
+
import type { EdgeCacheValue, ListResult } from "../sdk-call";
|
|
3
|
+
/** Derived from augur-api SDK — keeps types in sync automatically. */
|
|
4
|
+
export type AgrInfoApiClient = Pick<AugurAPI, "agrInfo">;
|
|
5
|
+
export interface AgrInfoActionsConfig {
|
|
6
|
+
/** Cache key prefix (e.g. "example:"). Default: "". */
|
|
7
|
+
cachePrefix?: string;
|
|
8
|
+
/** CDN edge cache value passed to SDK. Default: 1 (hour). */
|
|
9
|
+
edgeCache?: EdgeCacheValue;
|
|
10
|
+
/** CDN edge cache for rarely-changing data. Default: 8 (hours). */
|
|
11
|
+
longEdgeCache?: EdgeCacheValue;
|
|
12
|
+
/** Redis TTL in seconds. Default: 3600 (1 hour). */
|
|
13
|
+
redisTtl?: number;
|
|
14
|
+
/** Redis TTL for rarely-changing data in seconds. Default: 28800 (8 hours). */
|
|
15
|
+
longRedisTtl?: number;
|
|
16
|
+
}
|
|
17
|
+
export interface AgrInfoActions {
|
|
18
|
+
getContext: (params?: Record<string, unknown>) => Promise<ListResult>;
|
|
19
|
+
getRubrics: (params?: Record<string, unknown>) => Promise<ListResult>;
|
|
20
|
+
getMicroservices: (params?: Record<string, unknown>) => Promise<ListResult>;
|
|
21
|
+
generateAkasha: (data?: Record<string, unknown>) => Promise<unknown | undefined>;
|
|
22
|
+
generateJoomla: (data?: Record<string, unknown>) => Promise<unknown | undefined>;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Creates server-side AGR Info actions with Redis caching and edge cache support.
|
|
26
|
+
*
|
|
27
|
+
* Covers the AGR Info microservice endpoints: context, rubrics,
|
|
28
|
+
* microservices, and AI generation (akasha/joomla).
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```ts
|
|
32
|
+
* import { createAgrInfoActions } from "@simpleapps-com/augur-server";
|
|
33
|
+
* import { getAugurClient } from "./augur-client";
|
|
34
|
+
*
|
|
35
|
+
* export const agrInfoActions = createAgrInfoActions(getAugurClient(), {
|
|
36
|
+
* cachePrefix: "example:",
|
|
37
|
+
* });
|
|
38
|
+
*
|
|
39
|
+
* const rubrics = await agrInfoActions.getRubrics();
|
|
40
|
+
* const result = await agrInfoActions.generateAkasha({ prompt: "Hello" });
|
|
41
|
+
* ``` */
|
|
42
|
+
export declare function createAgrInfoActions(api: AgrInfoApiClient, config?: AgrInfoActionsConfig): AgrInfoActions;
|
|
43
|
+
//# sourceMappingURL=agr-info.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agr-info.d.ts","sourceRoot":"","sources":["../../src/actions/agr-info.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAI9D,sEAAsE;AACtE,MAAM,MAAM,gBAAgB,GAAG,IAAI,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;AAEzD,MAAM,WAAW,oBAAoB;IACnC,uDAAuD;IACvD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,6DAA6D;IAC7D,SAAS,CAAC,EAAE,cAAc,CAAC;IAC3B,mEAAmE;IACnE,aAAa,CAAC,EAAE,cAAc,CAAC;IAC/B,oDAAoD;IACpD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,+EAA+E;IAC/E,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,cAAc;IAC7B,UAAU,EAAE,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;IACtE,UAAU,EAAE,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;IACtE,gBAAgB,EAAE,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;IAC5E,cAAc,EAAE,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,OAAO,GAAG,SAAS,CAAC,CAAC;IACjF,cAAc,EAAE,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,OAAO,GAAG,SAAS,CAAC,CAAC;CAClF;AAED;;;;;;;;;;;;;;;;;SAiBS;AACT,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,gBAAgB,EACrB,MAAM,GAAE,oBAAyB,GAChC,cAAc,CAmFhB"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { AgrSiteTypes, AugurAPI } from "@simpleapps-com/augur-api";
|
|
2
|
+
import type { EdgeCacheValue, ListResult } from "../sdk-call";
|
|
3
|
+
/** Derived from augur-api SDK — keeps types in sync automatically. */
|
|
4
|
+
export type AgrSiteApiClient = Pick<AugurAPI, "agrSite">;
|
|
5
|
+
export interface AgrSiteActionsConfig {
|
|
6
|
+
/** Cache key prefix (e.g. "example:"). Default: "". */
|
|
7
|
+
cachePrefix?: string;
|
|
8
|
+
/** CDN edge cache value for rarely-changing data. Default: 8 (hours). */
|
|
9
|
+
longEdgeCache?: EdgeCacheValue;
|
|
10
|
+
/** Redis TTL for rarely-changing data in seconds. Default: 28800 (8 hours). */
|
|
11
|
+
longRedisTtl?: number;
|
|
12
|
+
}
|
|
13
|
+
export interface AgrSiteActions {
|
|
14
|
+
getSettings: (serviceName: string) => Promise<ListResult>;
|
|
15
|
+
/** The site's generated robots.txt (`{ content, contentType }`). Replaces `getMetaFiles`. */
|
|
16
|
+
getRobots: () => Promise<AgrSiteTypes.MetaFilesRobotsListData>;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Creates server-side AGR Site actions with Redis caching and edge cache support.
|
|
20
|
+
*
|
|
21
|
+
* Covers the AGR Site microservice settings and robots.txt endpoints. Uses long
|
|
22
|
+
* TTLs since site settings and meta files rarely change.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```ts
|
|
26
|
+
* import { createAgrSiteActions } from "@simpleapps-com/augur-server";
|
|
27
|
+
* import { getAugurClient } from "./augur-client";
|
|
28
|
+
*
|
|
29
|
+
* export const agrSiteActions = createAgrSiteActions(getAugurClient(), {
|
|
30
|
+
* cachePrefix: "example:",
|
|
31
|
+
* });
|
|
32
|
+
*
|
|
33
|
+
* const settings = await agrSiteActions.getSettings("my-service");
|
|
34
|
+
* const robots = await agrSiteActions.getRobots();
|
|
35
|
+
* ``` */
|
|
36
|
+
export declare function createAgrSiteActions(api: AgrSiteApiClient, config?: AgrSiteActionsConfig): AgrSiteActions;
|
|
37
|
+
//# sourceMappingURL=agr-site.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agr-site.d.ts","sourceRoot":"","sources":["../../src/actions/agr-site.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACxE,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAI9D,sEAAsE;AACtE,MAAM,MAAM,gBAAgB,GAAG,IAAI,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;AAEzD,MAAM,WAAW,oBAAoB;IACnC,uDAAuD;IACvD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,yEAAyE;IACzE,aAAa,CAAC,EAAE,cAAc,CAAC;IAC/B,+EAA+E;IAC/E,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,cAAc;IAC7B,WAAW,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;IAC1D,6FAA6F;IAC7F,SAAS,EAAE,MAAM,OAAO,CAAC,YAAY,CAAC,uBAAuB,CAAC,CAAC;CAChE;AAED;;;;;;;;;;;;;;;;;SAiBS;AACT,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,gBAAgB,EACrB,MAAM,GAAE,oBAAyB,GAChC,cAAc,CA8BhB"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { AugurAPI, HealthCheckData, PingData } from "@simpleapps-com/augur-api";
|
|
2
|
+
/** Derived from augur-api SDK — keeps types in sync automatically. */
|
|
3
|
+
export type AgrWorkApiClient = Pick<AugurAPI, "agrWork">;
|
|
4
|
+
export interface AgrWorkActionsConfig {
|
|
5
|
+
/** Cache key prefix (e.g. "example:"). Default: "". */
|
|
6
|
+
cachePrefix?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface AgrWorkActions {
|
|
9
|
+
healthCheck: () => Promise<HealthCheckData | undefined>;
|
|
10
|
+
ping: () => Promise<PingData | undefined>;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Creates server-side AGR Work actions for health monitoring and connectivity.
|
|
14
|
+
*
|
|
15
|
+
* Covers the AGR Work microservice endpoints: healthCheck and ping.
|
|
16
|
+
* These are real-time operations and do not use caching.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* import { createAgrWorkActions } from "@simpleapps-com/augur-server";
|
|
21
|
+
* import { getAugurClient } from "./augur-client";
|
|
22
|
+
*
|
|
23
|
+
* export const agrWorkActions = createAgrWorkActions(getAugurClient());
|
|
24
|
+
*
|
|
25
|
+
* const health = await agrWorkActions.healthCheck();
|
|
26
|
+
* const pong = await agrWorkActions.ping();
|
|
27
|
+
* ``` */
|
|
28
|
+
export declare function createAgrWorkActions(api: AgrWorkApiClient, _config?: AgrWorkActionsConfig): AgrWorkActions;
|
|
29
|
+
//# sourceMappingURL=agr-work.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agr-work.d.ts","sourceRoot":"","sources":["../../src/actions/agr-work.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAErF,sEAAsE;AACtE,MAAM,MAAM,gBAAgB,GAAG,IAAI,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;AAEzD,MAAM,WAAW,oBAAoB;IACnC,uDAAuD;IACvD,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,cAAc;IAC7B,WAAW,EAAE,MAAM,OAAO,CAAC,eAAe,GAAG,SAAS,CAAC,CAAC;IACxD,IAAI,EAAE,MAAM,OAAO,CAAC,QAAQ,GAAG,SAAS,CAAC,CAAC;CAC3C;AAED;;;;;;;;;;;;;;;SAeS;AACT,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,gBAAgB,EACrB,OAAO,GAAE,oBAAyB,GACjC,cAAc,CAuBhB"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { AugurAPI, AvalaraTypes } from "@simpleapps-com/augur-api";
|
|
2
|
+
/** Derived from augur-api SDK — keeps types in sync automatically. */
|
|
3
|
+
export type AvalaraApiClient = Pick<AugurAPI, "avalara">;
|
|
4
|
+
export interface AvalaraActionsConfig {
|
|
5
|
+
/** Cache key prefix (e.g. "example:"). Default: "". */
|
|
6
|
+
cachePrefix?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface AvalaraActions {
|
|
9
|
+
calculateTax: (data: AvalaraTypes.RatesCreateBody) => Promise<AvalaraTypes.RatesCreateData>;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Creates server-side Avalara actions for real-time tax calculation.
|
|
13
|
+
*
|
|
14
|
+
* Note: Tax calculation is a real-time operation and does NOT use caching.
|
|
15
|
+
* Each call hits the Avalara API directly to ensure up-to-date tax rates.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```ts
|
|
19
|
+
* import { createAvalaraActions } from "@simpleapps-com/augur-server";
|
|
20
|
+
* import { getAugurClient } from "./augur-client";
|
|
21
|
+
*
|
|
22
|
+
* export const avalaraActions = createAvalaraActions(getAugurClient());
|
|
23
|
+
*
|
|
24
|
+
* const totalTax = await avalaraActions.calculateTax({
|
|
25
|
+
* address: {
|
|
26
|
+
* line1: "123 Main St",
|
|
27
|
+
* line2: "",
|
|
28
|
+
* line3: "",
|
|
29
|
+
* city: "Irvine",
|
|
30
|
+
* region: "CA",
|
|
31
|
+
* postalCode: "92602",
|
|
32
|
+
* countryCode: "US",
|
|
33
|
+
* },
|
|
34
|
+
* items: [{ itemCode: "WIDGET", quantity: 1, amount: 100.0, taxCode: "" }],
|
|
35
|
+
* });
|
|
36
|
+
* ``` */
|
|
37
|
+
export declare function createAvalaraActions(api: AvalaraApiClient, _config?: AvalaraActionsConfig): AvalaraActions;
|
|
38
|
+
//# sourceMappingURL=avalara.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"avalara.d.ts","sourceRoot":"","sources":["../../src/actions/avalara.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAExE,sEAAsE;AACtE,MAAM,MAAM,gBAAgB,GAAG,IAAI,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;AAEzD,MAAM,WAAW,oBAAoB;IACnC,uDAAuD;IACvD,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,cAAc;IAC7B,YAAY,EAAE,CAAC,IAAI,EAAE,YAAY,CAAC,eAAe,KAAK,OAAO,CAAC,YAAY,CAAC,eAAe,CAAC,CAAC;CAC7F;AAED;;;;;;;;;;;;;;;;;;;;;;;;;SAyBS;AACT,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,gBAAgB,EAGrB,OAAO,GAAE,oBAAyB,GACjC,cAAc,CAWhB"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { AugurAPI, Basecamp2Types } from "@simpleapps-com/augur-api";
|
|
2
|
+
import type { EdgeCacheValue, ListResult } from "../sdk-call";
|
|
3
|
+
/** Derived from augur-api SDK — keeps types in sync automatically. */
|
|
4
|
+
export type Basecamp2ApiClient = Pick<AugurAPI, "basecamp2">;
|
|
5
|
+
export interface Basecamp2ActionsConfig {
|
|
6
|
+
/** Cache key prefix (e.g. "example:"). Default: "". */
|
|
7
|
+
cachePrefix?: string;
|
|
8
|
+
/** CDN edge cache value passed to SDK. Default: 1 (hour). */
|
|
9
|
+
edgeCache?: EdgeCacheValue;
|
|
10
|
+
/** CDN edge cache for rarely-changing data like people. Default: 8 (hours). */
|
|
11
|
+
longEdgeCache?: EdgeCacheValue;
|
|
12
|
+
/** Redis TTL in seconds. Default: 3600 (1 hour). */
|
|
13
|
+
redisTtl?: number;
|
|
14
|
+
/** Redis TTL for rarely-changing data in seconds. Default: 28800 (8 hours). */
|
|
15
|
+
longRedisTtl?: number;
|
|
16
|
+
}
|
|
17
|
+
export interface Basecamp2Actions {
|
|
18
|
+
getTodos: (params?: Basecamp2Types.TodosListParams) => Promise<ListResult>;
|
|
19
|
+
getTodo: (todoId: number) => Promise<unknown>;
|
|
20
|
+
getTodosSummary: (params?: Basecamp2Types.TodosSummaryListParams) => Promise<ListResult>;
|
|
21
|
+
getComments: (params?: Basecamp2Types.CommentsListParams) => Promise<ListResult>;
|
|
22
|
+
getPeople: (params?: Basecamp2Types.PeopleListParams) => Promise<ListResult>;
|
|
23
|
+
getProjects: (params?: Basecamp2Types.ProjectsListParams) => Promise<ListResult>;
|
|
24
|
+
getEvents: (params?: Basecamp2Types.EventsListParams) => Promise<ListResult>;
|
|
25
|
+
getMetrics: (params?: Basecamp2Types.MetricsListParams) => Promise<ListResult>;
|
|
26
|
+
getTodolists: (params?: Basecamp2Types.TodolistsListParams) => Promise<ListResult>;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Creates server-side basecamp2 actions with Redis caching and edge cache support.
|
|
30
|
+
*
|
|
31
|
+
* Covers the Basecamp2 project management endpoints: todos, todo summaries,
|
|
32
|
+
* comments, people, projects, events, metrics, and todolists.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```ts
|
|
36
|
+
* import { createBasecamp2Actions } from "@simpleapps-com/augur-server";
|
|
37
|
+
* import { getAugurClient } from "./augur-client";
|
|
38
|
+
*
|
|
39
|
+
* export const basecamp2Actions = createBasecamp2Actions(getAugurClient(), {
|
|
40
|
+
* cachePrefix: "example:",
|
|
41
|
+
* });
|
|
42
|
+
*
|
|
43
|
+
* const todos = await basecamp2Actions.getTodos();
|
|
44
|
+
* const people = await basecamp2Actions.getPeople();
|
|
45
|
+
* ``` */
|
|
46
|
+
export declare function createBasecamp2Actions(api: Basecamp2ApiClient, config?: Basecamp2ActionsConfig): Basecamp2Actions;
|
|
47
|
+
//# sourceMappingURL=basecamp2.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"basecamp2.d.ts","sourceRoot":"","sources":["../../src/actions/basecamp2.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC1E,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAI9D,sEAAsE;AACtE,MAAM,MAAM,kBAAkB,GAAG,IAAI,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;AAE7D,MAAM,WAAW,sBAAsB;IACrC,uDAAuD;IACvD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,6DAA6D;IAC7D,SAAS,CAAC,EAAE,cAAc,CAAC;IAC3B,+EAA+E;IAC/E,aAAa,CAAC,EAAE,cAAc,CAAC;IAC/B,oDAAoD;IACpD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,+EAA+E;IAC/E,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,CAAC,MAAM,CAAC,EAAE,cAAc,CAAC,eAAe,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;IAC3E,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAC9C,eAAe,EAAE,CAAC,MAAM,CAAC,EAAE,cAAc,CAAC,sBAAsB,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;IACzF,WAAW,EAAE,CAAC,MAAM,CAAC,EAAE,cAAc,CAAC,kBAAkB,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;IACjF,SAAS,EAAE,CAAC,MAAM,CAAC,EAAE,cAAc,CAAC,gBAAgB,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;IAC7E,WAAW,EAAE,CAAC,MAAM,CAAC,EAAE,cAAc,CAAC,kBAAkB,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;IACjF,SAAS,EAAE,CAAC,MAAM,CAAC,EAAE,cAAc,CAAC,gBAAgB,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;IAC7E,UAAU,EAAE,CAAC,MAAM,CAAC,EAAE,cAAc,CAAC,iBAAiB,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;IAC/E,YAAY,EAAE,CAAC,MAAM,CAAC,EAAE,cAAc,CAAC,mBAAmB,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;CACpF;AAED;;;;;;;;;;;;;;;;;SAiBS;AACT,wBAAgB,sBAAsB,CACpC,GAAG,EAAE,kBAAkB,EACvB,MAAM,GAAE,sBAA2B,GAClC,gBAAgB,CA8IlB"}
|