@yargote/artifacts-client 0.1.0-beta.7 → 0.1.0-beta.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/README.md +5 -3
- package/package.json +2 -2
- package/src/index.js +1 -1
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
`@yargote/artifacts-client` is a typed Fetch client for the Artifacts REST API. It depends on `@yargote/artifacts-contracts` and Zod. It does not install the artifact store or a database driver. Node 24 or later is required.
|
|
4
4
|
|
|
5
5
|
```sh
|
|
6
|
-
npm install @yargote/artifacts-client@0.1.0-beta.
|
|
6
|
+
npm install @yargote/artifacts-client@0.1.0-beta.8
|
|
7
7
|
```
|
|
8
8
|
|
|
9
9
|
```ts
|
|
@@ -38,10 +38,10 @@ Every method makes one HTTP request. The client does not retry, follow redirects
|
|
|
38
38
|
| Method | Input | Result |
|
|
39
39
|
| --- | --- | --- |
|
|
40
40
|
| `identity()` | None | Verified user, session, client, and scopes |
|
|
41
|
-
| `create(command)` | `requestId`, complete `snapshot`, optional `project` and `response` | Artifact receipt |
|
|
41
|
+
| `create(command)` | `requestId`, complete `snapshot`, optional `project`, `slug`, and `response` | Artifact receipt |
|
|
42
42
|
| `list(query?)` | Optional `limit`, `cursor`, and `project` | Artifact summaries and `nextCursor` |
|
|
43
43
|
| `projects()` | None | `{ items: [{ name, artifactCount }] }` |
|
|
44
|
-
| `read(query)` | `artifactId`, optional `revisionId` and `response` | Artifact revision |
|
|
44
|
+
| `read(query)` | Exactly one of `artifactId` or `slug` with optional `project`, optional `revisionId` and `response` | Artifact revision |
|
|
45
45
|
| `update(command)` | `requestId`, `artifactId`, `expectedRevisionId`, complete `snapshot`, optional `response` | Artifact receipt |
|
|
46
46
|
| `history(query)` | `artifactId`, optional `limit`, `beforeSequence`, and `response` | Revisions and `nextBeforeSequence` |
|
|
47
47
|
| `publish(command)` | `requestId`, `artifactId`, `revisionId`, `expectedPublicationVersion` | Publication receipt |
|
|
@@ -59,6 +59,8 @@ All sharing methods require `artifacts:publish` and artifact ownership. `share`
|
|
|
59
59
|
|
|
60
60
|
Artifact reads and list items include `project`, a name or null. A project name matches an existing project regardless of letter case and keeps its stored spelling. `move` never creates a revision or changes the publication. `projects()` lists only projects that contain artifacts, ordered by name. Because response schemas are strict, this client requires a server that returns `project`. Version `0.1.0-beta.4` and earlier reject responses from such a server with `invalid_response`.
|
|
61
61
|
|
|
62
|
+
Artifact reads and list items also include `slug`, a page name or null. `read({ project, slug })` calls `GET /lookup` and `read({ artifactId })` calls `GET /artifacts/:artifactId`. An omitted `project` reads the unfiled namespace. A used slug fails `create` with an `HttpError` whose code is `slug_conflict`, status 409, and whose details name the holder's `artifactId`. Version `0.1.0-beta.7` and earlier reject responses that include `slug` with `invalid_response`.
|
|
63
|
+
|
|
62
64
|
`prepareArtifactEdit(client, { artifactId, requestId, changes })` reads the current full snapshot and prepares an immutable update command. Metadata and content changes merge into that snapshot. An explicit `files` array replaces the attachments. The helper does not submit the update. Retain its exact output before sending it.
|
|
63
65
|
|
|
64
66
|
## Errors and retries
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yargote/artifacts-client",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.8",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Typed HTTP client for the Artifacts REST API.",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"LICENSE"
|
|
27
27
|
],
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@yargote/artifacts-contracts": "0.1.0-beta.
|
|
29
|
+
"@yargote/artifacts-contracts": "0.1.0-beta.8",
|
|
30
30
|
"zod": "4.6.5"
|
|
31
31
|
},
|
|
32
32
|
"publishConfig": {
|
package/src/index.js
CHANGED
|
@@ -143,7 +143,7 @@ export function createArtifactHttpClient(options) {
|
|
|
143
143
|
projects: () => json('/projects', 'GET', projectsResultSchema),
|
|
144
144
|
read(value) {
|
|
145
145
|
const { artifactId, ...parameters } = readSchema.parse(value);
|
|
146
|
-
return json(`/artifacts/${encodeURIComponent(artifactId)}${query(parameters)}`, 'GET', parameters.response === 'compact' ? compactArtifactReadSchema : artifactReadSchema);
|
|
146
|
+
return json(`${artifactId === undefined ? '/lookup' : `/artifacts/${encodeURIComponent(artifactId)}`}${query(parameters)}`, 'GET', parameters.response === 'compact' ? compactArtifactReadSchema : artifactReadSchema);
|
|
147
147
|
},
|
|
148
148
|
update(value) {
|
|
149
149
|
const input = updateSchema.parse(value);
|