@collective-intelligence/external-apps-server-sdk 0.2.2 → 0.2.3
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/AGENTS.md +6 -0
- package/README.md +79 -5
- package/dist/chunks/{index-qe1587f9.js → index-48qvvmm0.js} +2 -2
- package/dist/effect.d.ts +62 -11
- package/dist/effect.js +1 -1
- package/dist/index.d.ts +49 -7
- package/dist/index.js +1 -1
- package/docs/effect.md +14 -6
- package/docs/next-cache.md +5 -0
- package/package.json +2 -2
package/docs/effect.md
CHANGED
|
@@ -22,14 +22,22 @@ export has one identity in the app.
|
|
|
22
22
|
Each client is one `Context.Service` with a `layer` and a `layerConfig` that
|
|
23
23
|
reads Effect `Config`.
|
|
24
24
|
|
|
25
|
-
| Service | Layers
|
|
26
|
-
| -------------- |
|
|
27
|
-
| `ServerClient` | `layerServerClient`, `layerServerClientConfig`, `layerApplicationServerClient`, `layerApplicationServerClientConfig` |
|
|
28
|
-
| `CiEntities` | `layerCiEntities`, `layerCiEntitiesConfig`
|
|
25
|
+
| Service | Layers |
|
|
26
|
+
| -------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
27
|
+
| `ServerClient` | `layerServerClient`, `layerServerClientConfig`, `layerApplicationServerClient`, `layerApplicationServerClientConfig`, `layerDelegatedServerClient` |
|
|
28
|
+
| `CiEntities` | `layerCiEntities`, `layerCiEntitiesConfig` |
|
|
29
29
|
|
|
30
30
|
- `execute` fails with `CiError` or `CiTransportError`; `executeResult` keeps
|
|
31
|
-
the CI error envelope as a value. `records.
|
|
32
|
-
fail with `CiError`; `recordsResult` keeps the
|
|
31
|
+
the CI error envelope as a value. `records.get`, `search`, `create`,
|
|
32
|
+
`update` and `delete` fail with `CiError`; `recordsResult` keeps the
|
|
33
|
+
refusal as a value. A read retries like a write, sends no idempotency key
|
|
34
|
+
and invalidates nothing.
|
|
35
|
+
- `layerDelegatedServerClient(config)` gives one app-wide `ServerClient`.
|
|
36
|
+
Each attempt sends the `DelegatedAccessToken` of the calling fiber, a
|
|
37
|
+
`Context.Reference` whose default is `Option.none()`. Provide it per
|
|
38
|
+
request:
|
|
39
|
+
`Effect.provideService(DelegatedAccessToken, Option.some(memberToken))`.
|
|
40
|
+
A call without it dies with `TypeError` and sends no request.
|
|
33
41
|
- A `layer...Config` reads the client secret with `Config.Redacted`.
|
|
34
42
|
- Without a `sleep` option, the retry backoff is `Effect.sleep` on the
|
|
35
43
|
`Clock`, so `TestClock` drives it.
|
package/docs/next-cache.md
CHANGED
|
@@ -79,6 +79,11 @@ of its record, so the next read computes the entry again. This covers
|
|
|
79
79
|
`CiEntities`). A read, and a write that CI refuses or that fails, expires
|
|
80
80
|
nothing.
|
|
81
81
|
|
|
82
|
+
A record read (`resources.records.get` and `search`, `ServerClient`
|
|
83
|
+
`records.get` and `search`) is not cached or tagged by the SDK: it adds no
|
|
84
|
+
cache tag and expires nothing. To cache a shared one, call `cacheCiRead` in
|
|
85
|
+
the app's `"use cache"` scope, as for any other read.
|
|
86
|
+
|
|
82
87
|
| Code | Give it |
|
|
83
88
|
| ------------------------------------------------------------------ | ----------------------------------------------- |
|
|
84
89
|
| `createServerClient`, `runAsApplication` | `invalidate: nextInvalidate` |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@collective-intelligence/external-apps-server-sdk",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"description": "Server-side client and proxy adapters for Collective Intelligence external applications.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -252,5 +252,5 @@
|
|
|
252
252
|
"vitest": "5.0.2",
|
|
253
253
|
"zod": "4.4.3"
|
|
254
254
|
},
|
|
255
|
-
"gitHead": "
|
|
255
|
+
"gitHead": "e9b03924b4ae4a1ff3eae6753f225e50ee98189b"
|
|
256
256
|
}
|