@absolutejs/artifacts 0.1.2 → 0.1.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/dist/index.js +25 -4
- package/dist/manifest.js +124 -0
- package/dist/manifest.json +78 -0
- package/dist/src/drizzle.d.ts +8 -8
- package/dist/src/generators.d.ts +4 -4
- package/dist/src/index.d.ts +1 -1
- package/dist/src/manifest.d.ts +6 -6
- package/dist/src/registry.d.ts +2 -2
- package/dist/src/service.d.ts +2 -2
- package/dist/src/types.d.ts +16 -10
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -4,6 +4,18 @@ import { Value } from "@sinclair/typebox/value";
|
|
|
4
4
|
|
|
5
5
|
// src/types.ts
|
|
6
6
|
var ARTIFACT_STATUSES = ["draft", "published", "archived"];
|
|
7
|
+
function isJsonValue(value) {
|
|
8
|
+
if (value === null || typeof value === "boolean" || typeof value === "string") {
|
|
9
|
+
return true;
|
|
10
|
+
}
|
|
11
|
+
if (typeof value === "number")
|
|
12
|
+
return Number.isFinite(value);
|
|
13
|
+
if (Array.isArray(value))
|
|
14
|
+
return value.every(isJsonValue);
|
|
15
|
+
if (typeof value !== "object")
|
|
16
|
+
return false;
|
|
17
|
+
return Object.values(value).every(isJsonValue);
|
|
18
|
+
}
|
|
7
19
|
var ARTIFACT_EVENT_TYPES = [
|
|
8
20
|
"artifact.archived",
|
|
9
21
|
"artifact.asset_attached",
|
|
@@ -35,7 +47,7 @@ var defineArtifactRegistry = (definitions) => ({
|
|
|
35
47
|
if (!definition) {
|
|
36
48
|
throw new ArtifactError("unknown_kind", `Unknown artifact kind: ${kind}`);
|
|
37
49
|
}
|
|
38
|
-
if (!Value.Check(definition.content, content)) {
|
|
50
|
+
if (!Value.Check(definition.content, content) || !isJsonValue(content)) {
|
|
39
51
|
const issue = [...Value.Errors(definition.content, content)][0];
|
|
40
52
|
const detail = issue ? `${issue.path || "/"}: ${issue.message}` : "invalid content";
|
|
41
53
|
throw new ArtifactError("invalid_content", `Invalid ${kind} artifact content (${detail})`);
|
|
@@ -711,7 +723,15 @@ var createMemoryArtifactStore = (initial = []) => {
|
|
|
711
723
|
};
|
|
712
724
|
// src/tools.ts
|
|
713
725
|
import { Type as Type2 } from "@sinclair/typebox";
|
|
714
|
-
var
|
|
726
|
+
var JsonValueSchema = Type2.Recursive((self) => Type2.Union([
|
|
727
|
+
Type2.String(),
|
|
728
|
+
Type2.Number(),
|
|
729
|
+
Type2.Boolean(),
|
|
730
|
+
Type2.Null(),
|
|
731
|
+
Type2.Array(self),
|
|
732
|
+
Type2.Record(Type2.String(), self)
|
|
733
|
+
]));
|
|
734
|
+
var record = (input) => isJsonValue(input) && input !== null && typeof input === "object" && !Array.isArray(input) ? input : {};
|
|
715
735
|
var stringValue = (input, key) => typeof input[key] === "string" ? input[key] : undefined;
|
|
716
736
|
var createArtifactTools = (options) => ({
|
|
717
737
|
artifact_create: {
|
|
@@ -720,7 +740,7 @@ var createArtifactTools = (options) => ({
|
|
|
720
740
|
const input = record(raw);
|
|
721
741
|
const kind = stringValue(input, "kind");
|
|
722
742
|
const title = stringValue(input, "title");
|
|
723
|
-
if (!kind || !title || input.content
|
|
743
|
+
if (!kind || !title || !isJsonValue(input.content)) {
|
|
724
744
|
return "Provide kind, title, and content.";
|
|
725
745
|
}
|
|
726
746
|
const artifact = await options.service.create(options.ownerId, {
|
|
@@ -732,7 +752,7 @@ var createArtifactTools = (options) => ({
|
|
|
732
752
|
return JSON.stringify(artifact);
|
|
733
753
|
},
|
|
734
754
|
input: Type2.Object({
|
|
735
|
-
content:
|
|
755
|
+
content: JsonValueSchema,
|
|
736
756
|
kind: Type2.String({ minLength: 1 }),
|
|
737
757
|
title: Type2.String({ minLength: 1 })
|
|
738
758
|
})
|
|
@@ -834,6 +854,7 @@ var createArtifactTools = (options) => ({
|
|
|
834
854
|
});
|
|
835
855
|
export {
|
|
836
856
|
standardArtifactDefinitions,
|
|
857
|
+
isJsonValue,
|
|
837
858
|
defineArtifactRegistry,
|
|
838
859
|
createMemoryArtifactStore,
|
|
839
860
|
createMemoryArtifactAssetStore,
|
package/dist/manifest.js
CHANGED
|
@@ -168,6 +168,79 @@ var serializedTool = Type.Object({
|
|
|
168
168
|
input: jsonSchemaObject,
|
|
169
169
|
kind: Type.Union([Type.Literal("runtime"), Type.Literal("workspace")])
|
|
170
170
|
});
|
|
171
|
+
var productId = Type.String({ pattern: "^[a-z][a-z0-9_-]{0,63}$" });
|
|
172
|
+
var productCopy = {
|
|
173
|
+
description: Type.String({ minLength: 1 }),
|
|
174
|
+
id: productId,
|
|
175
|
+
title: Type.String({ minLength: 1 })
|
|
176
|
+
};
|
|
177
|
+
var productOperation = Type.Union([
|
|
178
|
+
Type.Literal("aggregate"),
|
|
179
|
+
Type.Literal("create"),
|
|
180
|
+
Type.Literal("delete"),
|
|
181
|
+
Type.Literal("detail"),
|
|
182
|
+
Type.Literal("list"),
|
|
183
|
+
Type.Literal("update")
|
|
184
|
+
]);
|
|
185
|
+
var productProjection = Type.Object({
|
|
186
|
+
blocks: Type.Optional(Type.Array(Type.Object({
|
|
187
|
+
...productCopy,
|
|
188
|
+
category: Type.String({ minLength: 1 }),
|
|
189
|
+
componentExport: Type.String({ minLength: 1 }),
|
|
190
|
+
frameworks: Type.Optional(Type.Array(Type.Union(clientFrameworks.map((framework) => Type.Literal(framework))))),
|
|
191
|
+
props: jsonSchemaObject
|
|
192
|
+
}))),
|
|
193
|
+
connections: Type.Optional(Type.Array(Type.Object({
|
|
194
|
+
...productCopy,
|
|
195
|
+
envKeys: Type.Optional(Type.Array(Type.String({ minLength: 1 }))),
|
|
196
|
+
kind: Type.Union([
|
|
197
|
+
Type.Literal("none"),
|
|
198
|
+
Type.Literal("oauth"),
|
|
199
|
+
Type.Literal("secret")
|
|
200
|
+
]),
|
|
201
|
+
setupTool: Type.Optional(Type.String({ pattern: TOOL_NAME_PATTERN.source })),
|
|
202
|
+
testTool: Type.Optional(Type.String({ pattern: TOOL_NAME_PATTERN.source }))
|
|
203
|
+
}))),
|
|
204
|
+
dataSources: Type.Optional(Type.Array(Type.Object({
|
|
205
|
+
...productCopy,
|
|
206
|
+
operations: Type.Array(productOperation, { minItems: 1 }),
|
|
207
|
+
schema: jsonSchemaObject,
|
|
208
|
+
tools: Type.Optional(Type.Partial(Type.Object({
|
|
209
|
+
aggregate: Type.String({ pattern: TOOL_NAME_PATTERN.source }),
|
|
210
|
+
create: Type.String({ pattern: TOOL_NAME_PATTERN.source }),
|
|
211
|
+
delete: Type.String({ pattern: TOOL_NAME_PATTERN.source }),
|
|
212
|
+
detail: Type.String({ pattern: TOOL_NAME_PATTERN.source }),
|
|
213
|
+
list: Type.String({ pattern: TOOL_NAME_PATTERN.source }),
|
|
214
|
+
update: Type.String({ pattern: TOOL_NAME_PATTERN.source })
|
|
215
|
+
})))
|
|
216
|
+
}))),
|
|
217
|
+
events: Type.Optional(Type.Array(Type.Object({
|
|
218
|
+
...productCopy,
|
|
219
|
+
schema: jsonSchemaObject,
|
|
220
|
+
source: Type.Union([
|
|
221
|
+
Type.Literal("data"),
|
|
222
|
+
Type.Literal("package"),
|
|
223
|
+
Type.Literal("ui"),
|
|
224
|
+
Type.Literal("webhook")
|
|
225
|
+
])
|
|
226
|
+
}))),
|
|
227
|
+
healthChecks: Type.Optional(Type.Array(Type.Object({
|
|
228
|
+
...productCopy,
|
|
229
|
+
tool: Type.String({ pattern: TOOL_NAME_PATTERN.source })
|
|
230
|
+
}))),
|
|
231
|
+
releaseChecks: Type.Optional(Type.Array(Type.Object({
|
|
232
|
+
...productCopy,
|
|
233
|
+
healthCheckIds: Type.Optional(Type.Array(productId)),
|
|
234
|
+
severity: Type.Union([
|
|
235
|
+
Type.Literal("blocking"),
|
|
236
|
+
Type.Literal("warning")
|
|
237
|
+
])
|
|
238
|
+
}))),
|
|
239
|
+
workflowActions: Type.Optional(Type.Array(Type.Object({
|
|
240
|
+
...productCopy,
|
|
241
|
+
tool: Type.String({ pattern: TOOL_NAME_PATTERN.source })
|
|
242
|
+
})))
|
|
243
|
+
});
|
|
171
244
|
var manifestSchema = Type.Object({
|
|
172
245
|
contract: Type.Union([Type.Literal(1), Type.Literal(2)]),
|
|
173
246
|
discovery: Type.Optional(Type.Object({
|
|
@@ -193,6 +266,14 @@ var manifestSchema = Type.Object({
|
|
|
193
266
|
tagline: Type.String({ minLength: 1 })
|
|
194
267
|
}),
|
|
195
268
|
implements: Type.Optional(Type.Array(adapterImplementation)),
|
|
269
|
+
integration: Type.Optional(Type.Object({
|
|
270
|
+
description: Type.Optional(Type.String({ minLength: 1 })),
|
|
271
|
+
mode: Type.Union([
|
|
272
|
+
Type.Literal("adapter"),
|
|
273
|
+
Type.Literal("code-first"),
|
|
274
|
+
Type.Literal("recipe")
|
|
275
|
+
])
|
|
276
|
+
})),
|
|
196
277
|
lifecycle: Type.Optional(Type.Array(lifecycleStep)),
|
|
197
278
|
presets: Type.Optional(Type.Array(Type.Object({
|
|
198
279
|
description: Type.Optional(Type.String()),
|
|
@@ -200,6 +281,7 @@ var manifestSchema = Type.Object({
|
|
|
200
281
|
title: Type.String(),
|
|
201
282
|
values: Type.Record(Type.String(), Type.Unknown())
|
|
202
283
|
}))),
|
|
284
|
+
product: Type.Optional(productProjection),
|
|
203
285
|
requires: Type.Optional(manifestRequirements),
|
|
204
286
|
settings: jsonSchemaObject,
|
|
205
287
|
slots: Type.Optional(Type.Record(Type.String(), adapterSlot)),
|
|
@@ -220,6 +302,48 @@ var manifest = defineManifest()({
|
|
|
220
302
|
name: "@absolutejs/artifacts",
|
|
221
303
|
tagline: "Give everything your AI makes a real lifecycle."
|
|
222
304
|
},
|
|
305
|
+
product: {
|
|
306
|
+
blocks: [
|
|
307
|
+
{
|
|
308
|
+
category: "content",
|
|
309
|
+
componentExport: "ArtifactWorkspace",
|
|
310
|
+
description: "Browse a typed artifact, its lifecycle state, and immutable revision history.",
|
|
311
|
+
frameworks: ["react", "client"],
|
|
312
|
+
id: "artifact_workspace",
|
|
313
|
+
props: Type2.Object({
|
|
314
|
+
artifactId: Type2.String({ minLength: 1 }),
|
|
315
|
+
ownerId: Type2.String({ minLength: 1 })
|
|
316
|
+
}),
|
|
317
|
+
title: "Artifact workspace"
|
|
318
|
+
}
|
|
319
|
+
],
|
|
320
|
+
dataSources: [
|
|
321
|
+
{
|
|
322
|
+
description: "Owner-scoped typed artifacts with current state and immutable revisions.",
|
|
323
|
+
id: "artifacts",
|
|
324
|
+
operations: ["list", "detail"],
|
|
325
|
+
schema: Type2.Object({
|
|
326
|
+
artifactId: Type2.String(),
|
|
327
|
+
kind: Type2.String(),
|
|
328
|
+
ownerId: Type2.String(),
|
|
329
|
+
revision: Type2.Integer()
|
|
330
|
+
}),
|
|
331
|
+
title: "Artifacts",
|
|
332
|
+
tools: {
|
|
333
|
+
detail: "artifact_get",
|
|
334
|
+
list: "artifact_list"
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
],
|
|
338
|
+
workflowActions: [
|
|
339
|
+
{
|
|
340
|
+
description: "Restore an immutable artifact revision as a new private draft.",
|
|
341
|
+
id: "restore_artifact",
|
|
342
|
+
title: "Restore artifact revision",
|
|
343
|
+
tool: "artifact_restore"
|
|
344
|
+
}
|
|
345
|
+
]
|
|
346
|
+
},
|
|
223
347
|
implements: [
|
|
224
348
|
defineImplementation()({
|
|
225
349
|
contract: "artifacts/store",
|
package/dist/manifest.json
CHANGED
|
@@ -8,6 +8,84 @@
|
|
|
8
8
|
"name": "@absolutejs/artifacts",
|
|
9
9
|
"tagline": "Give everything your AI makes a real lifecycle."
|
|
10
10
|
},
|
|
11
|
+
"product": {
|
|
12
|
+
"blocks": [
|
|
13
|
+
{
|
|
14
|
+
"category": "content",
|
|
15
|
+
"componentExport": "ArtifactWorkspace",
|
|
16
|
+
"description": "Browse a typed artifact, its lifecycle state, and immutable revision history.",
|
|
17
|
+
"frameworks": [
|
|
18
|
+
"react",
|
|
19
|
+
"client"
|
|
20
|
+
],
|
|
21
|
+
"id": "artifact_workspace",
|
|
22
|
+
"props": {
|
|
23
|
+
"type": "object",
|
|
24
|
+
"required": [
|
|
25
|
+
"artifactId",
|
|
26
|
+
"ownerId"
|
|
27
|
+
],
|
|
28
|
+
"properties": {
|
|
29
|
+
"artifactId": {
|
|
30
|
+
"minLength": 1,
|
|
31
|
+
"type": "string"
|
|
32
|
+
},
|
|
33
|
+
"ownerId": {
|
|
34
|
+
"minLength": 1,
|
|
35
|
+
"type": "string"
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"title": "Artifact workspace"
|
|
40
|
+
}
|
|
41
|
+
],
|
|
42
|
+
"dataSources": [
|
|
43
|
+
{
|
|
44
|
+
"description": "Owner-scoped typed artifacts with current state and immutable revisions.",
|
|
45
|
+
"id": "artifacts",
|
|
46
|
+
"operations": [
|
|
47
|
+
"list",
|
|
48
|
+
"detail"
|
|
49
|
+
],
|
|
50
|
+
"schema": {
|
|
51
|
+
"type": "object",
|
|
52
|
+
"required": [
|
|
53
|
+
"artifactId",
|
|
54
|
+
"kind",
|
|
55
|
+
"ownerId",
|
|
56
|
+
"revision"
|
|
57
|
+
],
|
|
58
|
+
"properties": {
|
|
59
|
+
"artifactId": {
|
|
60
|
+
"type": "string"
|
|
61
|
+
},
|
|
62
|
+
"kind": {
|
|
63
|
+
"type": "string"
|
|
64
|
+
},
|
|
65
|
+
"ownerId": {
|
|
66
|
+
"type": "string"
|
|
67
|
+
},
|
|
68
|
+
"revision": {
|
|
69
|
+
"type": "integer"
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
"title": "Artifacts",
|
|
74
|
+
"tools": {
|
|
75
|
+
"detail": "artifact_get",
|
|
76
|
+
"list": "artifact_list"
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
],
|
|
80
|
+
"workflowActions": [
|
|
81
|
+
{
|
|
82
|
+
"description": "Restore an immutable artifact revision as a new private draft.",
|
|
83
|
+
"id": "restore_artifact",
|
|
84
|
+
"title": "Restore artifact revision",
|
|
85
|
+
"tool": "artifact_restore"
|
|
86
|
+
}
|
|
87
|
+
]
|
|
88
|
+
},
|
|
11
89
|
"implements": [
|
|
12
90
|
{
|
|
13
91
|
"contract": "artifacts/store",
|
package/dist/src/drizzle.d.ts
CHANGED
|
@@ -138,13 +138,13 @@ export declare const artifactRevisions: import("drizzle-orm/pg-core").PgTableWit
|
|
|
138
138
|
}>;
|
|
139
139
|
document: import("drizzle-orm/pg-core").PgBuildColumn<"artifact_revisions", import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").PgCustomColumnBuilder<{
|
|
140
140
|
dataType: "custom";
|
|
141
|
-
data: Readonly<ArtifactRecord<
|
|
141
|
+
data: Readonly<ArtifactRecord<import("./types").JsonValue>>;
|
|
142
142
|
driverParam: unknown;
|
|
143
143
|
}>>, {
|
|
144
144
|
name: string;
|
|
145
145
|
tableName: "artifact_revisions";
|
|
146
146
|
dataType: "custom";
|
|
147
|
-
data: Readonly<ArtifactRecord<
|
|
147
|
+
data: Readonly<ArtifactRecord<import("./types").JsonValue>>;
|
|
148
148
|
driverParam: unknown;
|
|
149
149
|
notNull: true;
|
|
150
150
|
hasDefault: false;
|
|
@@ -760,13 +760,13 @@ export declare const artifactDrizzleSchema: {
|
|
|
760
760
|
}>;
|
|
761
761
|
document: import("drizzle-orm/pg-core").PgBuildColumn<"artifact_revisions", import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").PgCustomColumnBuilder<{
|
|
762
762
|
dataType: "custom";
|
|
763
|
-
data: Readonly<ArtifactRecord<
|
|
763
|
+
data: Readonly<ArtifactRecord<import("./types").JsonValue>>;
|
|
764
764
|
driverParam: unknown;
|
|
765
765
|
}>>, {
|
|
766
766
|
name: string;
|
|
767
767
|
tableName: "artifact_revisions";
|
|
768
768
|
dataType: "custom";
|
|
769
|
-
data: Readonly<ArtifactRecord<
|
|
769
|
+
data: Readonly<ArtifactRecord<import("./types").JsonValue>>;
|
|
770
770
|
driverParam: unknown;
|
|
771
771
|
notNull: true;
|
|
772
772
|
hasDefault: false;
|
|
@@ -1051,13 +1051,13 @@ export declare const ArtifactRevisionInsertSchema: import("drizzle-typebox").Bui
|
|
|
1051
1051
|
}>;
|
|
1052
1052
|
document: import("drizzle-orm/pg-core").PgBuildColumn<"artifact_revisions", import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").PgCustomColumnBuilder<{
|
|
1053
1053
|
dataType: "custom";
|
|
1054
|
-
data: Readonly<ArtifactRecord<
|
|
1054
|
+
data: Readonly<ArtifactRecord<import("./types").JsonValue>>;
|
|
1055
1055
|
driverParam: unknown;
|
|
1056
1056
|
}>>, {
|
|
1057
1057
|
name: string;
|
|
1058
1058
|
tableName: "artifact_revisions";
|
|
1059
1059
|
dataType: "custom";
|
|
1060
|
-
data: Readonly<ArtifactRecord<
|
|
1060
|
+
data: Readonly<ArtifactRecord<import("./types").JsonValue>>;
|
|
1061
1061
|
driverParam: unknown;
|
|
1062
1062
|
notNull: true;
|
|
1063
1063
|
hasDefault: false;
|
|
@@ -1117,13 +1117,13 @@ export declare const ArtifactRevisionSelectSchema: import("drizzle-typebox").Bui
|
|
|
1117
1117
|
}>;
|
|
1118
1118
|
document: import("drizzle-orm/pg-core").PgBuildColumn<"artifact_revisions", import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").PgCustomColumnBuilder<{
|
|
1119
1119
|
dataType: "custom";
|
|
1120
|
-
data: Readonly<ArtifactRecord<
|
|
1120
|
+
data: Readonly<ArtifactRecord<import("./types").JsonValue>>;
|
|
1121
1121
|
driverParam: unknown;
|
|
1122
1122
|
}>>, {
|
|
1123
1123
|
name: string;
|
|
1124
1124
|
tableName: "artifact_revisions";
|
|
1125
1125
|
dataType: "custom";
|
|
1126
|
-
data: Readonly<ArtifactRecord<
|
|
1126
|
+
data: Readonly<ArtifactRecord<import("./types").JsonValue>>;
|
|
1127
1127
|
driverParam: unknown;
|
|
1128
1128
|
notNull: true;
|
|
1129
1129
|
hasDefault: false;
|
package/dist/src/generators.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { ArtifactAssetWriteInput, ArtifactBundleCreateInput, ArtifactProvenance, ArtifactRecord } from "./types";
|
|
1
|
+
import type { ArtifactAssetWriteInput, ArtifactBundleCreateInput, ArtifactProvenance, ArtifactRecord, JsonObject, JsonValue } from "./types";
|
|
2
2
|
export type ArtifactGenerationInput = {
|
|
3
3
|
createdBy: string;
|
|
4
|
-
input?:
|
|
4
|
+
input?: JsonObject;
|
|
5
5
|
kind: string;
|
|
6
6
|
ownerId: string;
|
|
7
7
|
prompt?: string;
|
|
@@ -12,8 +12,8 @@ export type ArtifactGenerationContext = {
|
|
|
12
12
|
};
|
|
13
13
|
export type ArtifactGenerationResult = {
|
|
14
14
|
assets?: ArtifactAssetWriteInput[];
|
|
15
|
-
content:
|
|
16
|
-
metadata?:
|
|
15
|
+
content: JsonValue;
|
|
16
|
+
metadata?: JsonObject;
|
|
17
17
|
provenance?: ArtifactProvenance;
|
|
18
18
|
title?: string;
|
|
19
19
|
warnings?: string[];
|
package/dist/src/index.d.ts
CHANGED
|
@@ -13,4 +13,4 @@ export { createArtifactRendererRegistry, type ArtifactRenderer, type ArtifactRen
|
|
|
13
13
|
export { createArtifactService, type ArtifactPublisher, type ArtifactService, type ArtifactServiceOptions, } from "./service";
|
|
14
14
|
export { createMemoryArtifactStore, createMemoryArtifactAssetStore, type ArtifactAssetStore, type ArtifactAssetTransaction, type ArtifactStore, } from "./store";
|
|
15
15
|
export { createArtifactTools, type ArtifactToolDefinition, type ArtifactToolMap, type ArtifactToolOptions, } from "./tools";
|
|
16
|
-
export { ARTIFACT_STATUSES, ARTIFACT_EVENT_TYPES, ArtifactError, type ArtifactAssetReference, type ArtifactAssetRole, type ArtifactAssetWriteInput, type ArtifactBundleCreateInput, type ArtifactCapability, type ArtifactCreateInput, type ArtifactErrorCode, type ArtifactEvent, type ArtifactEventQuery, type ArtifactEventType, type ArtifactGarbageCollectionResult, type ArtifactIndexingState, type ArtifactIndexingStatus, type ArtifactListQuery, type ArtifactLineageReference, type ArtifactLineageRelation, type ArtifactProvenance, type ArtifactPublication, type ArtifactPublishInput, type ArtifactRecord, type ArtifactRevision, type ArtifactRetentionCandidate, type ArtifactStatus, type ArtifactUpdateInput, } from "./types";
|
|
16
|
+
export { ARTIFACT_STATUSES, ARTIFACT_EVENT_TYPES, ArtifactError, isJsonValue, type ArtifactAssetReference, type ArtifactAssetRole, type ArtifactAssetWriteInput, type ArtifactBundleCreateInput, type ArtifactCapability, type ArtifactCreateInput, type ArtifactErrorCode, type ArtifactEvent, type ArtifactEventQuery, type ArtifactEventType, type ArtifactGarbageCollectionResult, type ArtifactIndexingState, type ArtifactIndexingStatus, type ArtifactListQuery, type ArtifactLineageReference, type ArtifactLineageRelation, type ArtifactProvenance, type ArtifactPublication, type ArtifactPublishInput, type ArtifactRecord, type ArtifactRevision, type ArtifactRetentionCandidate, type ArtifactStatus, type ArtifactUpdateInput, type JsonObject, type JsonPrimitive, type JsonValue, } from "./types";
|
package/dist/src/manifest.d.ts
CHANGED
|
@@ -11,10 +11,10 @@ export declare const manifest: Omit<import("@absolutejs/manifest").PackageManife
|
|
|
11
11
|
detach: (ownerId: string, artifactId: string, assetId: string, expectedRevision?: number) => Promise<import("./types").ArtifactRecord>;
|
|
12
12
|
get: (ownerId: string, artifactId: string) => Promise<import("./types").ArtifactRecord>;
|
|
13
13
|
getIndexingState: (ownerId: string, artifactId: string) => Promise<import("./types").ArtifactIndexingState | null>;
|
|
14
|
-
getRevision: (ownerId: string, artifactId: string, revision: number) => Promise<Readonly<import("./types").ArtifactRecord<
|
|
14
|
+
getRevision: (ownerId: string, artifactId: string, revision: number) => Promise<Readonly<import("./types").ArtifactRecord<import("./types").JsonValue>>>;
|
|
15
15
|
list: (ownerId: string, query?: import("./types").ArtifactListQuery) => Promise<import("./types").ArtifactRecord[]>;
|
|
16
16
|
listEvents: (query?: import("./types").ArtifactEventQuery) => Promise<import("./types").ArtifactEvent[]>;
|
|
17
|
-
listRevisions: (ownerId: string, artifactId: string) => Promise<Readonly<import("./types").ArtifactRecord<
|
|
17
|
+
listRevisions: (ownerId: string, artifactId: string) => Promise<Readonly<import("./types").ArtifactRecord<import("./types").JsonValue>>[]>;
|
|
18
18
|
markEventProcessed: (eventId: string, processedAt?: string) => Promise<boolean>;
|
|
19
19
|
markIndexing: (ownerId: string, artifactId: string, input: {
|
|
20
20
|
documentIds?: string[];
|
|
@@ -46,10 +46,10 @@ export declare const manifest: Omit<import("@absolutejs/manifest").PackageManife
|
|
|
46
46
|
detach: (ownerId: string, artifactId: string, assetId: string, expectedRevision?: number) => Promise<import("./types").ArtifactRecord>;
|
|
47
47
|
get: (ownerId: string, artifactId: string) => Promise<import("./types").ArtifactRecord>;
|
|
48
48
|
getIndexingState: (ownerId: string, artifactId: string) => Promise<import("./types").ArtifactIndexingState | null>;
|
|
49
|
-
getRevision: (ownerId: string, artifactId: string, revision: number) => Promise<Readonly<import("./types").ArtifactRecord<
|
|
49
|
+
getRevision: (ownerId: string, artifactId: string, revision: number) => Promise<Readonly<import("./types").ArtifactRecord<import("./types").JsonValue>>>;
|
|
50
50
|
list: (ownerId: string, query?: import("./types").ArtifactListQuery) => Promise<import("./types").ArtifactRecord[]>;
|
|
51
51
|
listEvents: (query?: import("./types").ArtifactEventQuery) => Promise<import("./types").ArtifactEvent[]>;
|
|
52
|
-
listRevisions: (ownerId: string, artifactId: string) => Promise<Readonly<import("./types").ArtifactRecord<
|
|
52
|
+
listRevisions: (ownerId: string, artifactId: string) => Promise<Readonly<import("./types").ArtifactRecord<import("./types").JsonValue>>[]>;
|
|
53
53
|
markEventProcessed: (eventId: string, processedAt?: string) => Promise<boolean>;
|
|
54
54
|
markIndexing: (ownerId: string, artifactId: string, input: {
|
|
55
55
|
documentIds?: string[];
|
|
@@ -82,10 +82,10 @@ export declare const manifest: Omit<import("@absolutejs/manifest").PackageManife
|
|
|
82
82
|
detach: (ownerId: string, artifactId: string, assetId: string, expectedRevision?: number) => Promise<import("./types").ArtifactRecord>;
|
|
83
83
|
get: (ownerId: string, artifactId: string) => Promise<import("./types").ArtifactRecord>;
|
|
84
84
|
getIndexingState: (ownerId: string, artifactId: string) => Promise<import("./types").ArtifactIndexingState | null>;
|
|
85
|
-
getRevision: (ownerId: string, artifactId: string, revision: number) => Promise<Readonly<import("./types").ArtifactRecord<
|
|
85
|
+
getRevision: (ownerId: string, artifactId: string, revision: number) => Promise<Readonly<import("./types").ArtifactRecord<import("./types").JsonValue>>>;
|
|
86
86
|
list: (ownerId: string, query?: import("./types").ArtifactListQuery) => Promise<import("./types").ArtifactRecord[]>;
|
|
87
87
|
listEvents: (query?: import("./types").ArtifactEventQuery) => Promise<import("./types").ArtifactEvent[]>;
|
|
88
|
-
listRevisions: (ownerId: string, artifactId: string) => Promise<Readonly<import("./types").ArtifactRecord<
|
|
88
|
+
listRevisions: (ownerId: string, artifactId: string) => Promise<Readonly<import("./types").ArtifactRecord<import("./types").JsonValue>>[]>;
|
|
89
89
|
markEventProcessed: (eventId: string, processedAt?: string) => Promise<boolean>;
|
|
90
90
|
markIndexing: (ownerId: string, artifactId: string, input: {
|
|
91
91
|
documentIds?: string[];
|
package/dist/src/registry.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Static, TSchema } from "@sinclair/typebox";
|
|
2
|
-
import { type ArtifactCapability } from "./types";
|
|
2
|
+
import { type ArtifactCapability, type JsonValue } from "./types";
|
|
3
3
|
export type ArtifactAssetPolicy = {
|
|
4
4
|
/** Exact media types or wildcards such as image/* and application/*. */
|
|
5
5
|
acceptedMediaTypes?: string[];
|
|
@@ -18,6 +18,6 @@ export type ArtifactContent<TDefinitions extends ArtifactKindDefinitions, TKind
|
|
|
18
18
|
export type ArtifactRegistry<TDefinitions extends ArtifactKindDefinitions> = {
|
|
19
19
|
definitions: TDefinitions;
|
|
20
20
|
kindNames: Array<keyof TDefinitions & string>;
|
|
21
|
-
parse<TKind extends keyof TDefinitions & string>(kind: TKind, content: unknown): ArtifactContent<TDefinitions, TKind
|
|
21
|
+
parse<TKind extends keyof TDefinitions & string>(kind: TKind, content: unknown): ArtifactContent<TDefinitions, TKind> & JsonValue;
|
|
22
22
|
};
|
|
23
23
|
export declare const defineArtifactRegistry: <const TDefinitions extends ArtifactKindDefinitions>(definitions: TDefinitions) => ArtifactRegistry<TDefinitions>;
|
package/dist/src/service.d.ts
CHANGED
|
@@ -37,10 +37,10 @@ export declare const createArtifactService: <TDefinitions extends ArtifactKindDe
|
|
|
37
37
|
detach: (ownerId: string, artifactId: string, assetId: string, expectedRevision?: number) => Promise<ArtifactRecord>;
|
|
38
38
|
get: (ownerId: string, artifactId: string) => Promise<ArtifactRecord>;
|
|
39
39
|
getIndexingState: (ownerId: string, artifactId: string) => Promise<ArtifactIndexingState | null>;
|
|
40
|
-
getRevision: (ownerId: string, artifactId: string, revision: number) => Promise<Readonly<ArtifactRecord<
|
|
40
|
+
getRevision: (ownerId: string, artifactId: string, revision: number) => Promise<Readonly<ArtifactRecord<import("./types").JsonValue>>>;
|
|
41
41
|
list: (ownerId: string, query?: ArtifactListQuery) => Promise<ArtifactRecord[]>;
|
|
42
42
|
listEvents: (query?: ArtifactEventQuery) => Promise<ArtifactEvent[]>;
|
|
43
|
-
listRevisions: (ownerId: string, artifactId: string) => Promise<Readonly<ArtifactRecord<
|
|
43
|
+
listRevisions: (ownerId: string, artifactId: string) => Promise<Readonly<ArtifactRecord<import("./types").JsonValue>>[]>;
|
|
44
44
|
markEventProcessed: (eventId: string, processedAt?: string) => Promise<boolean>;
|
|
45
45
|
markIndexing: (ownerId: string, artifactId: string, input: {
|
|
46
46
|
documentIds?: string[];
|
package/dist/src/types.d.ts
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
export declare const ARTIFACT_STATUSES: readonly ["draft", "published", "archived"];
|
|
2
|
+
export type JsonPrimitive = boolean | null | number | string;
|
|
3
|
+
export type JsonValue = JsonPrimitive | JsonObject | JsonValue[];
|
|
4
|
+
export type JsonObject = {
|
|
5
|
+
[key: string]: JsonValue;
|
|
6
|
+
};
|
|
7
|
+
export declare function isJsonValue(value: unknown): value is JsonValue;
|
|
2
8
|
export type ArtifactStatus = (typeof ARTIFACT_STATUSES)[number];
|
|
3
9
|
export type ArtifactCapability = "attach" | "archive" | "edit" | "export" | "preview" | "publish" | "refine";
|
|
4
10
|
export type ArtifactProvenance = {
|
|
@@ -31,7 +37,7 @@ export type ArtifactAssetReference = {
|
|
|
31
37
|
id: string;
|
|
32
38
|
createdAt: string;
|
|
33
39
|
mediaType: string;
|
|
34
|
-
metadata?:
|
|
40
|
+
metadata?: JsonObject;
|
|
35
41
|
name: string;
|
|
36
42
|
role: ArtifactAssetRole;
|
|
37
43
|
size: number;
|
|
@@ -41,11 +47,11 @@ export type ArtifactAssetReference = {
|
|
|
41
47
|
export type ArtifactAssetWriteInput = {
|
|
42
48
|
data: Uint8Array;
|
|
43
49
|
mediaType: string;
|
|
44
|
-
metadata?:
|
|
50
|
+
metadata?: JsonObject;
|
|
45
51
|
name: string;
|
|
46
52
|
role?: ArtifactAssetRole;
|
|
47
53
|
};
|
|
48
|
-
export type ArtifactRecord<TContent =
|
|
54
|
+
export type ArtifactRecord<TContent = JsonValue> = {
|
|
49
55
|
assets: ArtifactAssetReference[];
|
|
50
56
|
capabilities: ArtifactCapability[];
|
|
51
57
|
content: TContent;
|
|
@@ -53,7 +59,7 @@ export type ArtifactRecord<TContent = unknown> = {
|
|
|
53
59
|
createdBy: string;
|
|
54
60
|
id: string;
|
|
55
61
|
kind: string;
|
|
56
|
-
metadata:
|
|
62
|
+
metadata: JsonObject;
|
|
57
63
|
ownerId: string;
|
|
58
64
|
provenance?: ArtifactProvenance;
|
|
59
65
|
publication?: ArtifactPublication;
|
|
@@ -70,7 +76,7 @@ export type ArtifactEvent = {
|
|
|
70
76
|
createdAt: string;
|
|
71
77
|
id: string;
|
|
72
78
|
ownerId: string;
|
|
73
|
-
payload?:
|
|
79
|
+
payload?: JsonObject;
|
|
74
80
|
processedAt?: string;
|
|
75
81
|
revision: number;
|
|
76
82
|
type: ArtifactEventType;
|
|
@@ -91,7 +97,7 @@ export type ArtifactIndexingState = {
|
|
|
91
97
|
updatedAt: string;
|
|
92
98
|
};
|
|
93
99
|
/** An immutable point-in-time copy of an artifact record. */
|
|
94
|
-
export type ArtifactRevision<TContent =
|
|
100
|
+
export type ArtifactRevision<TContent = JsonValue> = Readonly<ArtifactRecord<TContent>>;
|
|
95
101
|
export type ArtifactListQuery = {
|
|
96
102
|
kind?: string;
|
|
97
103
|
limit?: number;
|
|
@@ -99,18 +105,18 @@ export type ArtifactListQuery = {
|
|
|
99
105
|
};
|
|
100
106
|
export type ArtifactCreateInput = {
|
|
101
107
|
assets?: ArtifactAssetReference[];
|
|
102
|
-
content:
|
|
108
|
+
content: JsonValue;
|
|
103
109
|
createdBy: string;
|
|
104
110
|
kind: string;
|
|
105
|
-
metadata?:
|
|
111
|
+
metadata?: JsonObject;
|
|
106
112
|
provenance?: ArtifactProvenance;
|
|
107
113
|
title: string;
|
|
108
114
|
};
|
|
109
115
|
export type ArtifactUpdateInput = {
|
|
110
116
|
assets?: ArtifactAssetReference[];
|
|
111
|
-
content?:
|
|
117
|
+
content?: JsonValue;
|
|
112
118
|
expectedRevision?: number;
|
|
113
|
-
metadata?:
|
|
119
|
+
metadata?: JsonObject;
|
|
114
120
|
title?: string;
|
|
115
121
|
};
|
|
116
122
|
export type ArtifactBundleCreateInput = Omit<ArtifactCreateInput, "assets"> & {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@absolutejs/artifacts",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "Typed, versioned artifacts for AI products — schemas, lifecycle, storage, rendering, publishing, revisions, and agent tools without prescribing a database or host.",
|
|
5
5
|
"author": "Alex Kahn",
|
|
6
6
|
"license": "BUSL-1.1",
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
}
|
|
84
84
|
},
|
|
85
85
|
"dependencies": {
|
|
86
|
-
"@absolutejs/manifest": "^0.
|
|
86
|
+
"@absolutejs/manifest": "^0.8.0",
|
|
87
87
|
"@sinclair/typebox": "^0.34.0",
|
|
88
88
|
"drizzle-typebox": "1.0.0-beta.14-a36c63d"
|
|
89
89
|
},
|