@relyio/sdk 0.4.0 → 0.5.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,28 @@
1
1
  # @relyio/sdk
2
2
 
3
+ ## 0.5.0
4
+
5
+ ### Minor Changes
6
+
7
+ - c59912d: `client.sandbox` reports the `relyio dev` sandbox the client resolved, `client.project()` describes the project your key belongs to, and `@relyio/sdk` exports the `SandboxState`, `Project` and `RelyIOChangeDetail` types.
8
+
9
+ `client.project()` calls `GET /v1/project` and returns the organization, project, dataset and branch, each with its `id` and `name`, plus `studioUrl`, the address of the project's Studio. `dataset` is the one your requests read, which may be a sandbox rather than the project's default, so add it to a Studio link as `?dataset=`. `studioUrl` is `null` when the service has no Dashboard address configured.
10
+
11
+ `client.sandbox` is one of five states:
12
+
13
+ - `{ state: 'active', datasetId, branchId, expiresAt, source }` — the client is reading the sandbox. `source` is `'env'` under `relyio dev -- <command>` and `'file'` when it read `.relyio/dev.json`. `branchId` is `null` from the environment, which names no branch. `expiresAt` is `null` for a sandbox with no deadline.
14
+ - `{ state: 'expired', expiredAt }` or `{ state: 'unreadable', reason }` — a sandbox was found and ignored, so the client reads the dataset and key you configured. The console says so, as before.
15
+ - `{ state: 'absent' }` — no sandbox was found. A client created in the browser always reports this, because the browser cannot see the environment or the file.
16
+ - `{ state: 'disabled' }` — the client did not look, because you passed `dev: false`, or `NODE_ENV` is `production` and you did not pass `dev: true`.
17
+
18
+ It is plain JSON with no API key in it, so a Next.js server component can pass it to a client component as a prop:
19
+
20
+ ```tsx
21
+ <SandboxBadge sandbox={relyio.sandbox} />
22
+ ```
23
+
24
+ `RelyIOChangeDetail` is the `detail` a `RELYIO_CHANGE_EVENT` dispatch carries: the same `{ entryId, contentType, locale, kind, cursor }` as a `Change` from `relyio.changes()`.
25
+
3
26
  ## 0.4.0
4
27
 
5
28
  ### Minor Changes