@yargote/artifacts-client 0.1.0-beta.3 → 0.1.0-beta.4

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.3
6
+ npm install @yargote/artifacts-client@0.1.0-beta.4
7
7
  ```
8
8
 
9
9
  ```ts
@@ -36,18 +36,22 @@ Every method makes one HTTP request. The client does not retry, follow redirects
36
36
  | Method | Input | Result |
37
37
  | --- | --- | --- |
38
38
  | `identity()` | None | Verified user, session, client, and scopes |
39
- | `create(command)` | `requestId`, complete `snapshot`, optional `response` | Artifact receipt |
40
- | `list(query?)` | Optional `limit` and `cursor` | Artifact summaries and `nextCursor` |
39
+ | `create(command)` | `requestId`, complete `snapshot`, optional `project` and `response` | Artifact receipt |
40
+ | `list(query?)` | Optional `limit`, `cursor`, and `project` | Artifact summaries and `nextCursor` |
41
+ | `projects()` | None | `{ items: [{ name, artifactCount }] }` |
41
42
  | `read(query)` | `artifactId`, optional `revisionId` and `response` | Artifact revision |
42
43
  | `update(command)` | `requestId`, `artifactId`, `expectedRevisionId`, complete `snapshot`, optional `response` | Artifact receipt |
43
44
  | `history(query)` | `artifactId`, optional `limit`, `beforeSequence`, and `response` | Revisions and `nextBeforeSequence` |
44
45
  | `publish(command)` | `requestId`, `artifactId`, `revisionId`, `expectedPublicationVersion` | Publication receipt |
46
+ | `move(command)` | `requestId`, `artifactId`, `project` name or null | `{ artifactId, project }` |
45
47
  | `export(query)` | `artifactId`, `revisionId` | `{ filename, mediaType, bytes, sha256 }` |
46
48
 
47
49
  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.
48
50
 
49
51
  All commands and JSON responses pass the strict domain schemas. An omitted mutation `response` remains omitted in the transmitted command. JSON responses are bounded at 64 MiB, which accommodates ten maximum-size revisions with JSON escaping. Archives are bounded at 8 MiB. Export verifies the binary bytes against `X-Artifact-SHA256` and returns the bytes without rebuilding the ZIP.
50
52
 
53
+ 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`.
54
+
51
55
  `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.
52
56
 
53
57
  ## Errors and retries
@@ -56,7 +60,7 @@ All commands and JSON responses pass the strict domain schemas. An omitted mutat
56
60
 
57
61
  Invalid local commands throw a Zod validation error before any HTTP request. Invalid configuration throws `TypeError`.
58
62
 
59
- A caller that needs recovery retains the complete create, update, or publish command before its first request. While the artifact exists, retrying that exact command returns the original receipt. Changing `response`, the snapshot, or any expected version changes the command. A conflict requires a new deliberate command with a new request ID. A replayed receipt describes the original operation and can differ from a fresh read.
63
+ A caller that needs recovery retains the complete create, update, publish, or move command before its first request. While the artifact exists, retrying that exact command returns the original receipt. Changing `response`, the snapshot, or any expected version changes the command. A conflict requires a new deliberate command with a new request ID. A replayed receipt describes the original operation and can differ from a fresh read.
60
64
 
61
65
  ## Compiled installation
62
66
 
@@ -64,4 +68,4 @@ The registry package contains compiled ESM JavaScript and declarations. Consumer
64
68
 
65
69
  This package is MIT licensed. The license applies to this package and does not license the private Artifacts application repository.
66
70
 
67
- Permanent deletion from the panel invalidates historical content-bearing receipts. An exact create, update or publish retry for a deleted artifact returns `not_found`; request identity remains reserved, so a changed command still returns `request_conflict` and an old create cannot recreate it. Live-session and scope checks still precede replay. This package exposes no deletion operation.
71
+ Permanent deletion from the panel invalidates historical content-bearing receipts. An exact create, update, publish or move retry for a deleted artifact returns `not_found`; request identity remains reserved, so a changed command still returns `request_conflict` and an old create cannot recreate it. Live-session and scope checks still precede replay. This package exposes no deletion operation.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yargote/artifacts-client",
3
- "version": "0.1.0-beta.3",
3
+ "version": "0.1.0-beta.4",
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.3",
29
+ "@yargote/artifacts-contracts": "0.1.0-beta.4",
30
30
  "zod": "4.6.5"
31
31
  },
32
32
  "publishConfig": {
package/src/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
- import { createSchema, exportSchema, historySchema, listSchema, publishResultSchema, publishSchema, readSchema, type ArtifactRead, type UpdateInput } from '@yargote/artifacts-contracts';
3
- import { historyResultSchema, listResultSchema, summaryHistoryResultSchema, type Identity } from '@yargote/artifacts-contracts/http';
2
+ import { createSchema, exportSchema, historySchema, listSchema, moveResultSchema, moveSchema, publishResultSchema, publishSchema, readSchema, type ArtifactRead, type UpdateInput } from '@yargote/artifacts-contracts';
3
+ import { historyResultSchema, listResultSchema, projectsResultSchema, summaryHistoryResultSchema, type Identity } from '@yargote/artifacts-contracts/http';
4
4
  import type { CompactArtifactRead } from '@yargote/artifacts-contracts/workflow';
5
5
  export type { ArtifactRead, Snapshot, UpdateInput } from '@yargote/artifacts-contracts';
6
6
  export type { Identity } from '@yargote/artifacts-contracts/http';
@@ -10,6 +10,9 @@ export type CreateInput = z.input<typeof createSchema>;
10
10
  export type ReadInput = z.input<typeof readSchema>;
11
11
  export type PublishInput = z.input<typeof publishSchema>;
12
12
  export type ListInput = z.input<typeof listSchema>;
13
+ export type MoveInput = z.input<typeof moveSchema>;
14
+ export type MoveResult = z.infer<typeof moveResultSchema>;
15
+ export type ProjectsResult = z.infer<typeof projectsResultSchema>;
13
16
  export type HistoryInput = z.input<typeof historySchema>;
14
17
  export type ExportInput = z.input<typeof exportSchema>;
15
18
  export type ArtifactArchive = {
@@ -36,6 +39,7 @@ export interface ArtifactHttpClient {
36
39
  }): Promise<ArtifactRead>;
37
40
  create(input: CreateInput): Promise<ArtifactRead | CompactArtifactRead>;
38
41
  list(input?: ListInput): Promise<z.infer<typeof listResultSchema>>;
42
+ projects(): Promise<ProjectsResult>;
39
43
  read(input: ReadInput & {
40
44
  response: 'compact';
41
45
  }): Promise<CompactArtifactRead>;
@@ -58,6 +62,7 @@ export interface ArtifactHttpClient {
58
62
  }): Promise<HistoryResult>;
59
63
  history(input: HistoryInput): Promise<HistoryResult | SummaryHistoryResult>;
60
64
  publish(input: PublishInput): Promise<z.infer<typeof publishResultSchema>>;
65
+ move(input: MoveInput): Promise<MoveResult>;
61
66
  export(input: ExportInput): Promise<ArtifactArchive>;
62
67
  }
63
68
  export declare function createArtifactHttpClient(options: {
package/src/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
- import { artifactReadSchema, createSchema, exportSchema, historySchema, listSchema, publishResultSchema, publishSchema, readSchema, updateSchema } from '@yargote/artifacts-contracts';
3
- import { compactArtifactReadSchema, historyResultSchema, httpErrorSchema, identitySchema, listResultSchema, restBase, summaryHistoryResultSchema } from '@yargote/artifacts-contracts/http';
2
+ import { artifactReadSchema, createSchema, exportSchema, historySchema, listSchema, moveResultSchema, moveSchema, publishResultSchema, publishSchema, readSchema, updateSchema } from '@yargote/artifacts-contracts';
3
+ import { compactArtifactReadSchema, historyResultSchema, httpErrorSchema, identitySchema, listResultSchema, projectsResultSchema, restBase, summaryHistoryResultSchema } from '@yargote/artifacts-contracts/http';
4
4
  export { prepareArtifactEdit } from '@yargote/artifacts-contracts/workflow';
5
5
  export class HttpError extends Error {
6
6
  status;
@@ -140,6 +140,7 @@ export function createArtifactHttpClient(options) {
140
140
  list(value = {}) {
141
141
  return json(`/artifacts${query(listSchema.parse(value))}`, 'GET', listResultSchema);
142
142
  },
143
+ projects: () => json('/projects', 'GET', projectsResultSchema),
143
144
  read(value) {
144
145
  const { artifactId, ...parameters } = readSchema.parse(value);
145
146
  return json(`/artifacts/${encodeURIComponent(artifactId)}${query(parameters)}`, 'GET', parameters.response === 'compact' ? compactArtifactReadSchema : artifactReadSchema);
@@ -156,6 +157,10 @@ export function createArtifactHttpClient(options) {
156
157
  const input = publishSchema.parse(value);
157
158
  return json(`/artifacts/${encodeURIComponent(input.artifactId)}/publication`, 'PUT', publishResultSchema, input);
158
159
  },
160
+ move(value) {
161
+ const input = moveSchema.parse(value);
162
+ return json(`/artifacts/${encodeURIComponent(input.artifactId)}/project`, 'PUT', moveResultSchema, input);
163
+ },
159
164
  export(value) {
160
165
  const input = exportSchema.parse(value);
161
166
  return request(`/artifacts/${encodeURIComponent(input.artifactId)}/revisions/${encodeURIComponent(input.revisionId)}/export`, 'GET', async (response, bytes) => {