@yargote/artifacts-client 0.1.0-beta.7 → 0.1.0-beta.9

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 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.7
6
+ npm install @yargote/artifacts-client@0.1.0-beta.9
7
7
  ```
8
8
 
9
9
  ```ts
@@ -38,17 +38,17 @@ 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 |
48
48
  | `share(command)` | `requestId`, `artifactId`, `email`, optional `notify` and `requireNew: true` | Share receipt with optional notification disposition |
49
49
  | `listShares(query)` | `artifactId` | `{ items: Share[] }` |
50
50
  | `unshare(command)` | `requestId`, `artifactId`, `shareId` | `void` after an empty HTTP 204 |
51
- | `move(command)` | `requestId`, `artifactId`, `project` name or null | `{ artifactId, project }` |
51
+ | `move(command)` | `requestId`, `artifactId`, and at least one of `project` (name or null) and `slug` (slug or null) | `{ artifactId, project }` |
52
52
  | `export(query)` | `artifactId`, `revisionId` | `{ filename, mediaType, bytes, sha256 }` |
53
53
 
54
54
  Create, read, and update accept `response: 'compact'`. The returned revision contains metadata and file summaries. Omitted response and `response: 'full'` return the complete snapshot. History accepts `response: 'summary'` or `response: 'full'`. Its page limit is ten revisions. Overloads reflect these projections in the return type.
@@ -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`. `move` sets, changes, or clears the slug: an omitted field keeps its value and `null` clears it. A move into a used slug fails with the same `slug_conflict`. The move result is unchanged, so published clients keep parsing it. Read the artifact to see its new slug.
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.7",
3
+ "version": "0.1.0-beta.9",
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.7",
29
+ "@yargote/artifacts-contracts": "0.1.0-beta.9",
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);