@yargote/artifacts-contracts 0.1.0-beta.4 → 0.1.0-beta.6

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-contracts` contains strict domain schemas, types, `ArtifactError`, snapshot serialization, and pure retained-edit helpers. It has no database, ZIP, server, or CLI dependency. Node 24 or later is required.
4
4
 
5
5
  ```sh
6
- npm install @yargote/artifacts-contracts@0.1.0-beta.4
6
+ npm install @yargote/artifacts-contracts@0.1.0-beta.6
7
7
  ```
8
8
 
9
9
  The root export contains domain schemas and types. `/workflow` contains `prepareArtifactEdit`, revision comparison, and compact projections. `/serialization` contains canonical JSON and SHA-256. `/http` contains HTTP response schemas, identity, canonical resource validation, and route URL helpers.
@@ -11,3 +11,5 @@ The root export contains domain schemas and types. `/workflow` contains `prepare
11
11
  The existing `@artifacts/artifacts` root, `/contracts`, and `/workflow` exports re-export these implementations. Store and REST packages share one `ArtifactError` runtime.
12
12
 
13
13
  This package is MIT licensed. The license applies to this package and does not license the private Artifacts application repository.
14
+
15
+ `shareSchema` accepts optional `notify` and `requireNew: true` without defaults. `shareResultSchema` remains the strict five-field grant shape used by lists. `shareCommandResultSchema` adds an optional immutable notification disposition for commands. Plain and explicit-false requests return the original grant shape. An absent flag and an explicit false remain distinct receipt arguments.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yargote/artifacts-contracts",
3
- "version": "0.1.0-beta.4",
3
+ "version": "0.1.0-beta.6",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Shared schemas and contracts for Artifacts clients.",
package/src/index.d.ts CHANGED
@@ -124,6 +124,63 @@ export declare const moveResultSchema: z.ZodObject<{
124
124
  project: z.ZodNullable<z.ZodString>;
125
125
  }, z.core.$strict>;
126
126
  export type MoveResult = z.infer<typeof moveResultSchema>;
127
+ export declare const shareSchema: z.ZodObject<{
128
+ requestId: z.ZodString;
129
+ artifactId: z.ZodString;
130
+ email: z.ZodPipe<z.ZodString, z.ZodEmail>;
131
+ notify: z.ZodOptional<z.ZodBoolean>;
132
+ requireNew: z.ZodOptional<z.ZodLiteral<true>>;
133
+ }, z.core.$strict>;
134
+ export declare const unshareSchema: z.ZodObject<{
135
+ requestId: z.ZodString;
136
+ artifactId: z.ZodString;
137
+ shareId: z.ZodString;
138
+ }, z.core.$strict>;
139
+ export declare const listSharesSchema: z.ZodObject<{
140
+ artifactId: z.ZodString;
141
+ }, z.core.$strict>;
142
+ export declare const shareResultSchema: z.ZodObject<{
143
+ shareId: z.ZodString;
144
+ artifactId: z.ZodString;
145
+ kind: z.ZodLiteral<"email">;
146
+ value: z.ZodEmail;
147
+ createdAt: z.ZodISODateTime;
148
+ }, z.core.$strict>;
149
+ export declare const notificationSchema: z.ZodUnion<readonly [z.ZodObject<{
150
+ status: z.ZodLiteral<"requested">;
151
+ }, z.core.$strict>, z.ZodObject<{
152
+ status: z.ZodLiteral<"skipped">;
153
+ reason: z.ZodLiteral<"disabled">;
154
+ }, z.core.$strict>, z.ZodObject<{
155
+ status: z.ZodLiteral<"skipped">;
156
+ reason: z.ZodLiteral<"rate_limited">;
157
+ retryAt: z.ZodISODateTime;
158
+ }, z.core.$strict>]>;
159
+ export declare const shareCommandResultSchema: z.ZodObject<{
160
+ shareId: z.ZodString;
161
+ artifactId: z.ZodString;
162
+ kind: z.ZodLiteral<"email">;
163
+ value: z.ZodEmail;
164
+ createdAt: z.ZodISODateTime;
165
+ notification: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
166
+ status: z.ZodLiteral<"requested">;
167
+ }, z.core.$strict>, z.ZodObject<{
168
+ status: z.ZodLiteral<"skipped">;
169
+ reason: z.ZodLiteral<"disabled">;
170
+ }, z.core.$strict>, z.ZodObject<{
171
+ status: z.ZodLiteral<"skipped">;
172
+ reason: z.ZodLiteral<"rate_limited">;
173
+ retryAt: z.ZodISODateTime;
174
+ }, z.core.$strict>]>>;
175
+ }, z.core.$strict>;
176
+ export declare const unshareResultSchema: z.ZodObject<{
177
+ artifactId: z.ZodString;
178
+ shareId: z.ZodString;
179
+ }, z.core.$strict>;
180
+ export type Share = z.infer<typeof shareResultSchema>;
181
+ export type ShareResult = z.infer<typeof shareCommandResultSchema>;
182
+ export type Notification = z.infer<typeof notificationSchema>;
183
+ export type UnshareResult = z.infer<typeof unshareResultSchema>;
127
184
  export declare const exportSchema: z.ZodObject<{
128
185
  artifactId: z.ZodString;
129
186
  revisionId: z.ZodString;
@@ -197,6 +254,13 @@ export type Viewer = z.infer<typeof viewerSchema>;
197
254
  export type Publication = z.infer<typeof publicationSchema>;
198
255
  export type Revision = z.infer<typeof revisionSchema>;
199
256
  export type ArtifactRead = z.infer<typeof artifactReadSchema>;
257
+ export type SharedRead = z.infer<typeof sharedReadSchema>;
258
+ export type SharedArtifactSummary = Readonly<{
259
+ artifactId: string;
260
+ title: string;
261
+ ownerName: string;
262
+ url: string;
263
+ }>;
200
264
  export type ArtifactSummary = {
201
265
  artifactId: string;
202
266
  title: string;
@@ -318,6 +382,44 @@ export declare const artifactReadSchema: z.ZodObject<{
318
382
  }, z.core.$strict>;
319
383
  }, z.core.$strict>;
320
384
  }, z.core.$strict>;
385
+ export declare const sharedReadSchema: z.ZodObject<{
386
+ artifactId: z.ZodString;
387
+ ownerName: z.ZodDefault<z.ZodString>;
388
+ publication: z.ZodObject<{
389
+ revisionId: z.ZodString;
390
+ version: z.ZodNumber;
391
+ url: z.ZodURL;
392
+ }, z.core.$strict>;
393
+ revision: z.ZodObject<{
394
+ id: z.ZodString;
395
+ createdAt: z.ZodISODateTime;
396
+ sha256: z.ZodString;
397
+ snapshot: z.ZodObject<{
398
+ metadata: z.ZodObject<{
399
+ title: z.ZodString;
400
+ description: z.ZodString;
401
+ custom: z.ZodOptional<z.ZodJSONSchema>;
402
+ }, z.core.$strict>;
403
+ content: z.ZodObject<{
404
+ kind: z.ZodEnum<{
405
+ text: "text";
406
+ html: "html";
407
+ markdown: "markdown";
408
+ }>;
409
+ text: z.ZodString;
410
+ }, z.core.$strict>;
411
+ files: z.ZodArray<z.ZodObject<{
412
+ path: z.ZodString;
413
+ mediaType: z.ZodString;
414
+ encoding: z.ZodEnum<{
415
+ utf8: "utf8";
416
+ base64: "base64";
417
+ }>;
418
+ data: z.ZodString;
419
+ }, z.core.$strict>>;
420
+ }, z.core.$strict>;
421
+ }, z.core.$strict>;
422
+ }, z.core.$strict>;
321
423
  export declare const publishResultSchema: z.ZodObject<{
322
424
  revisionId: z.ZodString;
323
425
  version: z.ZodNumber;
package/src/index.js CHANGED
@@ -32,6 +32,17 @@ export const deleteSchema = z.strictObject({ requestId, artifactId: identifier,
32
32
  export const deleteResultSchema = z.strictObject({ artifactId: identifier });
33
33
  export const moveSchema = z.strictObject({ requestId, artifactId: identifier, project: projectNameSchema.nullable() });
34
34
  export const moveResultSchema = z.strictObject({ artifactId: identifier, project: z.string().nullable() });
35
+ export const shareSchema = z.strictObject({ requestId, artifactId: identifier, email: z.string().trim().toLowerCase().pipe(z.email().max(254)).meta({ format: 'email', description: 'Email address, trimmed and lowercased; at most 254 characters after trimming' }), notify: z.boolean().optional(), requireNew: z.literal(true).optional() });
36
+ export const unshareSchema = z.strictObject({ requestId, artifactId: identifier, shareId: identifier });
37
+ export const listSharesSchema = z.strictObject({ artifactId: identifier });
38
+ export const shareResultSchema = z.strictObject({ shareId: identifier, artifactId: identifier, kind: z.literal('email'), value: z.email(), createdAt: z.iso.datetime() });
39
+ export const notificationSchema = z.union([
40
+ z.strictObject({ status: z.literal('requested') }),
41
+ z.strictObject({ status: z.literal('skipped'), reason: z.literal('disabled') }),
42
+ z.strictObject({ status: z.literal('skipped'), reason: z.literal('rate_limited'), retryAt: z.iso.datetime() }),
43
+ ]);
44
+ export const shareCommandResultSchema = shareResultSchema.extend({ notification: notificationSchema.optional() });
45
+ export const unshareResultSchema = z.strictObject({ artifactId: identifier, shareId: identifier });
35
46
  export const exportSchema = z.strictObject({ artifactId: identifier, revisionId: identifier });
36
47
  export const listSchema = z.strictObject({ limit: z.number().int().min(1).max(100).default(25), cursor: identifier.optional(), project: projectNameSchema.optional() });
37
48
  export const libraryQuerySchema = z.strictObject({
@@ -59,4 +70,5 @@ export function decodeFile(file) {
59
70
  export const publicationSchema = z.strictObject({ revisionId: identifier, version: z.number().int().positive(), url: z.url() });
60
71
  export const revisionSchema = z.strictObject({ id: identifier, parentRevisionId: identifier.nullable(), sequence: z.number().int().positive(), authorUserId: identifier, authorClientId: identifier, createdAt: z.iso.datetime(), sha256: z.string().regex(/^[a-f0-9]{64}$/), snapshot: snapshotSchema });
61
72
  export const artifactReadSchema = z.strictObject({ artifactId: identifier, ownerId: identifier, headRevisionId: identifier, project: z.string().nullable(), publication: publicationSchema.nullable(), revision: revisionSchema });
73
+ export const sharedReadSchema = z.strictObject({ artifactId: identifier, ownerName: z.string().default('Usuario de Artifacts'), publication: publicationSchema, revision: revisionSchema.pick({ id: true, createdAt: true, sha256: true, snapshot: true }) });
62
74
  export const publishResultSchema = publicationSchema.extend({ artifactId: identifier });