@sixb/server 0.1.3 → 0.1.5
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 +1 -1
- package/dist/index.js +1127 -937
- package/dist/index.js.map +17 -15
- package/dist/openapi/tags.d.ts +6 -2
- package/dist/openapi/tags.d.ts.map +1 -1
- package/dist/registerRoutes.d.ts.map +1 -1
- package/dist/routes/actions.d.ts +2 -1
- package/dist/routes/actions.d.ts.map +1 -1
- package/dist/routes/agents.d.ts +15 -0
- package/dist/routes/agents.d.ts.map +1 -1
- package/dist/routes/links.d.ts +0 -51
- package/dist/routes/links.d.ts.map +1 -1
- package/dist/routes/logs.d.ts +1 -1
- package/dist/routes/models.d.ts +60 -0
- package/dist/routes/models.d.ts.map +1 -0
- package/dist/routes/objects.d.ts +48 -0
- package/dist/routes/objects.d.ts.map +1 -1
- package/dist/routes/projections.d.ts +88 -86
- package/dist/routes/projections.d.ts.map +1 -1
- package/dist/routes/syncs.d.ts +32 -32
- package/dist/schemas/actions.d.ts +92 -0
- package/dist/schemas/actions.d.ts.map +1 -1
- package/dist/schemas/agents.d.ts +127 -0
- package/dist/schemas/agents.d.ts.map +1 -1
- package/dist/schemas/ai-accounting.d.ts +26 -26
- package/dist/schemas/connectors.d.ts +11 -1
- package/dist/schemas/connectors.d.ts.map +1 -1
- package/dist/schemas/links.d.ts +0 -41
- package/dist/schemas/links.d.ts.map +1 -1
- package/dist/schemas/logs.d.ts +4 -4
- package/dist/schemas/models.d.ts +50 -0
- package/dist/schemas/models.d.ts.map +1 -0
- package/dist/schemas/objects.d.ts +22 -0
- package/dist/schemas/objects.d.ts.map +1 -1
- package/dist/schemas/projections.d.ts +542 -513
- package/dist/schemas/projections.d.ts.map +1 -1
- package/dist/schemas/syncs.d.ts +23 -23
- package/package.json +4 -4
- package/src/openapi/tags.ts +4 -0
- package/src/registerRoutes.ts +2 -0
- package/src/routes/actions.ts +18 -3
- package/src/routes/agents.ts +21 -3
- package/src/routes/links.ts +2 -53
- package/src/routes/models.ts +31 -0
- package/src/routes/objects.ts +103 -0
- package/src/schemas/actions.ts +5 -0
- package/src/schemas/agents.ts +15 -0
- package/src/schemas/connectors.ts +13 -3
- package/src/schemas/links.ts +0 -17
- package/src/schemas/models.ts +15 -0
- package/src/schemas/objects.ts +104 -0
- package/src/schemas/projections.ts +6 -3
package/dist/index.js
CHANGED
|
@@ -687,6 +687,10 @@ var OPENAPI_TAGS = {
|
|
|
687
687
|
name: "Agents",
|
|
688
688
|
description: "Agent catalog"
|
|
689
689
|
},
|
|
690
|
+
models: {
|
|
691
|
+
name: "Models",
|
|
692
|
+
description: "Project model catalog"
|
|
693
|
+
},
|
|
690
694
|
agentThreads: {
|
|
691
695
|
name: "Agent Threads",
|
|
692
696
|
description: "Agent conversation threads and messages"
|
|
@@ -1208,6 +1212,9 @@ var ActionCatalogItemSchema = z3.object({
|
|
|
1208
1212
|
effects: z3.boolean()
|
|
1209
1213
|
})
|
|
1210
1214
|
});
|
|
1215
|
+
var ActionDetailSchema = ActionCatalogItemSchema.extend({
|
|
1216
|
+
inputSchema: z3.record(z3.unknown())
|
|
1217
|
+
});
|
|
1211
1218
|
var ActionRunStatusSchema = z3.enum([
|
|
1212
1219
|
"queued",
|
|
1213
1220
|
"running",
|
|
@@ -1667,6 +1674,7 @@ function registerActionRunRoutes(app, host) {
|
|
|
1667
1674
|
}
|
|
1668
1675
|
|
|
1669
1676
|
// src/routes/actions.ts
|
|
1677
|
+
import { schemaFieldsToJsonSchema } from "@sixb/core/internal/ontology";
|
|
1670
1678
|
function serializeAction(action) {
|
|
1671
1679
|
return ActionCatalogItemSchema.parse({
|
|
1672
1680
|
id: action.id,
|
|
@@ -1690,7 +1698,16 @@ function serializeAction(action) {
|
|
|
1690
1698
|
}
|
|
1691
1699
|
});
|
|
1692
1700
|
}
|
|
1693
|
-
function
|
|
1701
|
+
function serializeActionDetail(action, host) {
|
|
1702
|
+
return ActionDetailSchema.parse({
|
|
1703
|
+
...serializeAction(action),
|
|
1704
|
+
inputSchema: schemaFieldsToJsonSchema({
|
|
1705
|
+
fields: action.params,
|
|
1706
|
+
valueTypesById: host.definitions.ontology.getValueTypesById()
|
|
1707
|
+
})
|
|
1708
|
+
});
|
|
1709
|
+
}
|
|
1710
|
+
function registerActionRoutes(app, host) {
|
|
1694
1711
|
return app.get("/api/actions", async (context) => {
|
|
1695
1712
|
const actions = requireRequestSixb(context).actions.list();
|
|
1696
1713
|
return actions.map(serializeAction);
|
|
@@ -1709,10 +1726,10 @@ function registerActionRoutes(app, _host) {
|
|
|
1709
1726
|
set.status = 404;
|
|
1710
1727
|
return { error: "Action not found" };
|
|
1711
1728
|
}
|
|
1712
|
-
return
|
|
1729
|
+
return serializeActionDetail(action, host);
|
|
1713
1730
|
}, {
|
|
1714
1731
|
params: ActionIdParamsSchema,
|
|
1715
|
-
response: { 200:
|
|
1732
|
+
response: { 200: ActionDetailSchema, 404: ErrorResponseSchema },
|
|
1716
1733
|
detail: {
|
|
1717
1734
|
summary: "Get action metadata",
|
|
1718
1735
|
tags: [OPENAPI_TAGS.actions.name],
|
|
@@ -2693,6 +2710,11 @@ var AgentContextPartSchema = AgentContextEntryInputSchema.extend({
|
|
|
2693
2710
|
var AgentLoopConfigSchema = z8.object({
|
|
2694
2711
|
stopWhen: z8.object({
|
|
2695
2712
|
maxSteps: z8.number().int().positive().optional()
|
|
2713
|
+
}).optional(),
|
|
2714
|
+
context: z8.object({
|
|
2715
|
+
windowTokens: z8.number().int().positive().optional(),
|
|
2716
|
+
reserveTokens: z8.number().int().positive().optional(),
|
|
2717
|
+
keepRecentTokens: z8.number().int().positive().optional()
|
|
2696
2718
|
}).optional()
|
|
2697
2719
|
});
|
|
2698
2720
|
var AgentReasoningLevelSchema = z8.enum(AGENT_REASONING_LEVELS);
|
|
@@ -2791,6 +2813,11 @@ var AgentRunDiagnosticSchema = z8.object({
|
|
|
2791
2813
|
path: z8.string().optional(),
|
|
2792
2814
|
message: z8.string()
|
|
2793
2815
|
});
|
|
2816
|
+
var AgentMessageCompactionSchema = z8.object({
|
|
2817
|
+
checkpointId: z8.string(),
|
|
2818
|
+
summary: z8.string(),
|
|
2819
|
+
createdAt: z8.string()
|
|
2820
|
+
});
|
|
2794
2821
|
var AgentMessageSchema = z8.object({
|
|
2795
2822
|
id: z8.string(),
|
|
2796
2823
|
projectId: z8.string(),
|
|
@@ -2801,6 +2828,7 @@ var AgentMessageSchema = z8.object({
|
|
|
2801
2828
|
seq: z8.number(),
|
|
2802
2829
|
parts: z8.array(AgentMessagePartSchema),
|
|
2803
2830
|
annotations: z8.array(AgentRunDiagnosticSchema),
|
|
2831
|
+
compaction: AgentMessageCompactionSchema.optional(),
|
|
2804
2832
|
metadata: JsonValueSchema.optional(),
|
|
2805
2833
|
contentVersion: z8.number(),
|
|
2806
2834
|
createdAt: z8.string(),
|
|
@@ -2905,7 +2933,7 @@ function serializeThread(thread) {
|
|
|
2905
2933
|
updatedAt: toIsoString(thread.updatedAt)
|
|
2906
2934
|
});
|
|
2907
2935
|
}
|
|
2908
|
-
function serializeMessage(message, annotations = []) {
|
|
2936
|
+
function serializeMessage(message, annotations = [], checkpoint) {
|
|
2909
2937
|
return AgentMessageSchema.parse({
|
|
2910
2938
|
id: message.id,
|
|
2911
2939
|
projectId: message.projectId,
|
|
@@ -2916,6 +2944,11 @@ function serializeMessage(message, annotations = []) {
|
|
|
2916
2944
|
seq: message.seq,
|
|
2917
2945
|
parts: message.parts,
|
|
2918
2946
|
annotations,
|
|
2947
|
+
compaction: checkpoint ? {
|
|
2948
|
+
checkpointId: checkpoint.id,
|
|
2949
|
+
summary: checkpoint.summary,
|
|
2950
|
+
createdAt: toIsoString(checkpoint.createdAt)
|
|
2951
|
+
} : undefined,
|
|
2919
2952
|
metadata: message.metadata,
|
|
2920
2953
|
contentVersion: message.contentVersion,
|
|
2921
2954
|
createdAt: toIsoString(message.createdAt),
|
|
@@ -3200,10 +3233,14 @@ function registerAgentRoutes(app, host) {
|
|
|
3200
3233
|
order: parsed.order
|
|
3201
3234
|
});
|
|
3202
3235
|
const runIds = result.messages.flatMap((message) => message.runId === null ? [] : [message.runId]);
|
|
3203
|
-
const runs = await
|
|
3236
|
+
const [runs, checkpoints] = await Promise.all([
|
|
3237
|
+
storage.runs.getByIds({ projectId: host.id, ids: runIds }),
|
|
3238
|
+
storage.checkpoints.getByRunIds({ projectId: host.id, runIds })
|
|
3239
|
+
]);
|
|
3204
3240
|
const diagnosticsByRunId = new Map(runs.filter((run) => run.threadId === thread.id).map((run) => [run.id, run.diagnostics ?? []]));
|
|
3241
|
+
const checkpointsByRunId = new Map(checkpoints.filter((checkpoint) => checkpoint.threadId === thread.id).map((checkpoint) => [checkpoint.createdByRunId, checkpoint]));
|
|
3205
3242
|
return AgentMessageListResponseSchema.parse({
|
|
3206
|
-
messages: result.messages.map((message) => serializeMessage(message, message.runId === null ? [] : diagnosticsByRunId.get(message.runId) ?? [])),
|
|
3243
|
+
messages: result.messages.map((message) => serializeMessage(message, message.runId === null ? [] : diagnosticsByRunId.get(message.runId) ?? [], message.runId === null ? undefined : checkpointsByRunId.get(message.runId))),
|
|
3207
3244
|
hasMore: result.hasMore,
|
|
3208
3245
|
total: result.total
|
|
3209
3246
|
});
|
|
@@ -3846,9 +3883,11 @@ var ConnectorOAuthCallbackQuerySchema = z10.object({
|
|
|
3846
3883
|
code: z10.string().min(1).optional(),
|
|
3847
3884
|
auth_code: z10.string().min(1).optional(),
|
|
3848
3885
|
error: z10.string().min(1).optional()
|
|
3849
|
-
}).refine((query) =>
|
|
3850
|
-
|
|
3851
|
-
|
|
3886
|
+
}).refine((query) => {
|
|
3887
|
+
const hasAuthorizationCode = query.code !== undefined || query.auth_code !== undefined;
|
|
3888
|
+
const hasProviderError = query.error !== undefined;
|
|
3889
|
+
return hasAuthorizationCode !== hasProviderError;
|
|
3890
|
+
}, { message: "OAuth callback must contain exactly one of an authorization code or error." }).refine((query) => query.code === undefined || query.auth_code === undefined || query.code === query.auth_code, { message: "OAuth callback code and auth_code must match when both are present." }).transform(({ auth_code, ...query }) => ({ ...query, code: query.code ?? auth_code }));
|
|
3852
3891
|
function connectorRouteErrorResponseSchema(codes) {
|
|
3853
3892
|
return ErrorResponseSchema.extend({
|
|
3854
3893
|
code: z10.enum(codes).optional().describe("Stable machine-readable failure code for programmatic handling.")
|
|
@@ -4878,10 +4917,6 @@ var LinkSourceParamsSchema = z14.object({
|
|
|
4878
4917
|
var LinkParamsSchema = LinkSourceParamsSchema.extend({
|
|
4879
4918
|
linkId: z14.string().min(1)
|
|
4880
4919
|
});
|
|
4881
|
-
var LinkQuerySchema = z14.object({
|
|
4882
|
-
linkId: z14.string().optional(),
|
|
4883
|
-
direction: z14.enum(["outgoing", "incoming", "both"]).default("outgoing")
|
|
4884
|
-
});
|
|
4885
4920
|
var RemoveLinkQuerySchema = z14.object({
|
|
4886
4921
|
targetTypeId: z14.string().min(1),
|
|
4887
4922
|
targetId: z14.string().min(1)
|
|
@@ -4891,59 +4926,10 @@ var UpsertLinkBodySchema = z14.object({
|
|
|
4891
4926
|
targetId: z14.string().min(1),
|
|
4892
4927
|
properties: z14.record(z14.unknown()).optional()
|
|
4893
4928
|
});
|
|
4894
|
-
var ObjectLinkSchema = z14.object({
|
|
4895
|
-
projectId: z14.string(),
|
|
4896
|
-
sourceTypeId: z14.string(),
|
|
4897
|
-
sourceId: z14.string(),
|
|
4898
|
-
linkId: z14.string(),
|
|
4899
|
-
targetTypeId: z14.string(),
|
|
4900
|
-
targetId: z14.string(),
|
|
4901
|
-
properties: z14.record(z14.unknown()).optional(),
|
|
4902
|
-
createdAt: z14.string(),
|
|
4903
|
-
updatedAt: z14.string()
|
|
4904
|
-
});
|
|
4905
4929
|
|
|
4906
4930
|
// src/routes/links.ts
|
|
4907
4931
|
function registerLinkRoutes(app, _host) {
|
|
4908
|
-
return app.
|
|
4909
|
-
const { params, query, set } = context;
|
|
4910
|
-
try {
|
|
4911
|
-
const sixb = requireRequestSixb(context);
|
|
4912
|
-
if (!sixb.objects.getTypeById(params.objectTypeId)) {
|
|
4913
|
-
set.status = 404;
|
|
4914
|
-
return { error: "Object not found" };
|
|
4915
|
-
}
|
|
4916
|
-
const parsedQuery = LinkQuerySchema.parse(query);
|
|
4917
|
-
const links = await sixb.objects.listLinks({
|
|
4918
|
-
objectTypeId: params.objectTypeId,
|
|
4919
|
-
objectId: params.objectId,
|
|
4920
|
-
linkId: parsedQuery.linkId,
|
|
4921
|
-
direction: parsedQuery.direction
|
|
4922
|
-
});
|
|
4923
|
-
return links.map((link) => ({
|
|
4924
|
-
...link,
|
|
4925
|
-
createdAt: toIsoString(link.createdAt),
|
|
4926
|
-
updatedAt: toIsoString(link.updatedAt)
|
|
4927
|
-
}));
|
|
4928
|
-
} catch (error) {
|
|
4929
|
-
set.status = 400;
|
|
4930
|
-
return { error: error instanceof Error ? error.message : String(error) };
|
|
4931
|
-
}
|
|
4932
|
-
}, {
|
|
4933
|
-
params: LinkSourceParamsSchema,
|
|
4934
|
-
query: LinkQuerySchema,
|
|
4935
|
-
response: {
|
|
4936
|
-
200: ObjectLinkSchema.array(),
|
|
4937
|
-
400: ErrorResponseSchema,
|
|
4938
|
-
404: ErrorResponseSchema
|
|
4939
|
-
},
|
|
4940
|
-
detail: {
|
|
4941
|
-
summary: "List object links",
|
|
4942
|
-
tags: [OPENAPI_TAGS.links.name],
|
|
4943
|
-
operationId: "listObjectLinks",
|
|
4944
|
-
security: bearerSecurityRequirement("listObjectLinks")
|
|
4945
|
-
}
|
|
4946
|
-
}).put("/api/objects/:objectTypeId/:objectId/links/:linkId", async (context) => {
|
|
4932
|
+
return app.put("/api/objects/:objectTypeId/:objectId/links/:linkId", async (context) => {
|
|
4947
4933
|
const { params, body, set } = context;
|
|
4948
4934
|
try {
|
|
4949
4935
|
const parsedBody = UpsertLinkBodySchema.parse(body);
|
|
@@ -5114,6 +5100,37 @@ function registerLogRoutes(app, _host) {
|
|
|
5114
5100
|
});
|
|
5115
5101
|
}
|
|
5116
5102
|
|
|
5103
|
+
// src/schemas/models.ts
|
|
5104
|
+
import { z as z16 } from "zod";
|
|
5105
|
+
var LanguageModelSchema = z16.object({
|
|
5106
|
+
provider: z16.string(),
|
|
5107
|
+
modelId: z16.string(),
|
|
5108
|
+
isDefault: z16.boolean()
|
|
5109
|
+
});
|
|
5110
|
+
var ModelCatalogSchema = z16.object({
|
|
5111
|
+
language: z16.array(LanguageModelSchema)
|
|
5112
|
+
});
|
|
5113
|
+
|
|
5114
|
+
// src/routes/models.ts
|
|
5115
|
+
function serializeLanguageModel(entry, defaultRef) {
|
|
5116
|
+
return { provider: entry.provider, modelId: entry.modelId, isDefault: entry.ref === defaultRef };
|
|
5117
|
+
}
|
|
5118
|
+
function registerModelRoutes(app, host) {
|
|
5119
|
+
return app.get("/api/models", () => {
|
|
5120
|
+
const language = host.definitions.models?.language;
|
|
5121
|
+
return ModelCatalogSchema.parse({
|
|
5122
|
+
language: language === undefined ? [] : language.list().map((entry) => serializeLanguageModel(entry, language.default.ref))
|
|
5123
|
+
});
|
|
5124
|
+
}, {
|
|
5125
|
+
response: { 200: ModelCatalogSchema },
|
|
5126
|
+
detail: {
|
|
5127
|
+
summary: "List the project model catalog",
|
|
5128
|
+
tags: [OPENAPI_TAGS.models.name],
|
|
5129
|
+
operationId: "listModels"
|
|
5130
|
+
}
|
|
5131
|
+
});
|
|
5132
|
+
}
|
|
5133
|
+
|
|
5117
5134
|
// src/routes/objects.ts
|
|
5118
5135
|
import {
|
|
5119
5136
|
AuthorizationError as AuthorizationError3,
|
|
@@ -5121,35 +5138,35 @@ import {
|
|
|
5121
5138
|
ObjectQueryPlanningError,
|
|
5122
5139
|
ObjectQueryValidationError
|
|
5123
5140
|
} from "@sixb/core";
|
|
5124
|
-
import { ZodError as ZodError3, z as
|
|
5141
|
+
import { ZodError as ZodError3, z as z18 } from "zod";
|
|
5125
5142
|
|
|
5126
5143
|
// src/schemas/objects.ts
|
|
5127
|
-
import { z as
|
|
5128
|
-
var ObjectParamsSchema =
|
|
5129
|
-
objectTypeId:
|
|
5130
|
-
objectId:
|
|
5131
|
-
});
|
|
5132
|
-
var ObjectSearchQuerySchema =
|
|
5133
|
-
q:
|
|
5134
|
-
limit:
|
|
5135
|
-
});
|
|
5136
|
-
var ObjectSearchResponseSchema =
|
|
5137
|
-
items:
|
|
5138
|
-
ref:
|
|
5139
|
-
objectTypeId:
|
|
5140
|
-
primaryId:
|
|
5144
|
+
import { z as z17 } from "zod";
|
|
5145
|
+
var ObjectParamsSchema = z17.object({
|
|
5146
|
+
objectTypeId: z17.string().min(1),
|
|
5147
|
+
objectId: z17.string().min(1)
|
|
5148
|
+
});
|
|
5149
|
+
var ObjectSearchQuerySchema = z17.object({
|
|
5150
|
+
q: z17.string().trim().min(1).max(200),
|
|
5151
|
+
limit: z17.string().regex(/^\d+$/).optional()
|
|
5152
|
+
});
|
|
5153
|
+
var ObjectSearchResponseSchema = z17.object({
|
|
5154
|
+
items: z17.array(z17.object({
|
|
5155
|
+
ref: z17.object({
|
|
5156
|
+
objectTypeId: z17.string(),
|
|
5157
|
+
primaryId: z17.string()
|
|
5141
5158
|
}),
|
|
5142
|
-
label:
|
|
5159
|
+
label: z17.string()
|
|
5143
5160
|
}))
|
|
5144
5161
|
});
|
|
5145
5162
|
var OBJECT_LIST_MAX_LIMIT = 1000;
|
|
5146
|
-
var Rfc3339DateSchema =
|
|
5163
|
+
var Rfc3339DateSchema = z17.string().datetime({ offset: true });
|
|
5147
5164
|
function objectListDateSchema(parameter) {
|
|
5148
|
-
return
|
|
5165
|
+
return z17.string().refine((value) => Rfc3339DateSchema.safeParse(value).success, {
|
|
5149
5166
|
message: `Invalid query parameter '${parameter}': expected an RFC 3339 timestamp.`
|
|
5150
5167
|
}).transform((value) => new Date(value));
|
|
5151
5168
|
}
|
|
5152
|
-
var ObjectListLimitSchema =
|
|
5169
|
+
var ObjectListLimitSchema = z17.string().refine((value) => {
|
|
5153
5170
|
if (!/^\d+$/.test(value))
|
|
5154
5171
|
return false;
|
|
5155
5172
|
const parsed = Number(value);
|
|
@@ -5157,25 +5174,25 @@ var ObjectListLimitSchema = z16.string().refine((value) => {
|
|
|
5157
5174
|
}, {
|
|
5158
5175
|
message: `Invalid query parameter 'limit': expected an integer between 0 and ${OBJECT_LIST_MAX_LIMIT}.`
|
|
5159
5176
|
}).transform(Number);
|
|
5160
|
-
var ObjectListOffsetSchema =
|
|
5177
|
+
var ObjectListOffsetSchema = z17.string().refine((value) => /^\d+$/.test(value) && Number.isSafeInteger(Number(value)), {
|
|
5161
5178
|
message: "Invalid query parameter 'offset': expected a non-negative safe integer."
|
|
5162
5179
|
}).transform(Number);
|
|
5163
|
-
var ObjectsQuerySchema =
|
|
5164
|
-
objectTypeId:
|
|
5165
|
-
idPrefix:
|
|
5166
|
-
idSuffix:
|
|
5180
|
+
var ObjectsQuerySchema = z17.object({
|
|
5181
|
+
objectTypeId: z17.string().optional(),
|
|
5182
|
+
idPrefix: z17.string().optional(),
|
|
5183
|
+
idSuffix: z17.string().optional(),
|
|
5167
5184
|
updatedAfter: objectListDateSchema("updatedAfter").optional(),
|
|
5168
5185
|
updatedBefore: objectListDateSchema("updatedBefore").optional(),
|
|
5169
5186
|
createdAfter: objectListDateSchema("createdAfter").optional(),
|
|
5170
5187
|
createdBefore: objectListDateSchema("createdBefore").optional(),
|
|
5171
5188
|
limit: ObjectListLimitSchema.optional(),
|
|
5172
5189
|
offset: ObjectListOffsetSchema.optional(),
|
|
5173
|
-
orderBy:
|
|
5190
|
+
orderBy: z17.enum(["createdAt", "updatedAt", "primaryId"], {
|
|
5174
5191
|
errorMap: () => ({
|
|
5175
5192
|
message: "Invalid query parameter 'orderBy': expected one of createdAt, updatedAt, or primaryId."
|
|
5176
5193
|
})
|
|
5177
5194
|
}).optional(),
|
|
5178
|
-
order:
|
|
5195
|
+
order: z17.enum(["asc", "desc"], {
|
|
5179
5196
|
errorMap: () => ({
|
|
5180
5197
|
message: "Invalid query parameter 'order': expected 'asc' or 'desc'."
|
|
5181
5198
|
})
|
|
@@ -5183,163 +5200,178 @@ var ObjectsQuerySchema = z16.object({
|
|
|
5183
5200
|
}).superRefine((query, context) => {
|
|
5184
5201
|
if (query.updatedAfter && query.updatedBefore && query.updatedAfter > query.updatedBefore) {
|
|
5185
5202
|
context.addIssue({
|
|
5186
|
-
code:
|
|
5203
|
+
code: z17.ZodIssueCode.custom,
|
|
5187
5204
|
path: ["updatedAfter"],
|
|
5188
5205
|
message: "Invalid query parameter range: 'updatedAfter' must be before or equal to 'updatedBefore'."
|
|
5189
5206
|
});
|
|
5190
5207
|
}
|
|
5191
5208
|
if (query.createdAfter && query.createdBefore && query.createdAfter > query.createdBefore) {
|
|
5192
5209
|
context.addIssue({
|
|
5193
|
-
code:
|
|
5210
|
+
code: z17.ZodIssueCode.custom,
|
|
5194
5211
|
path: ["createdAfter"],
|
|
5195
5212
|
message: "Invalid query parameter range: 'createdAfter' must be before or equal to 'createdBefore'."
|
|
5196
5213
|
});
|
|
5197
5214
|
}
|
|
5198
5215
|
});
|
|
5199
|
-
var UpsertObjectBodySchema =
|
|
5200
|
-
properties:
|
|
5216
|
+
var UpsertObjectBodySchema = z17.object({
|
|
5217
|
+
properties: z17.record(z17.unknown())
|
|
5201
5218
|
});
|
|
5202
|
-
var ObjectQueryPredicateSchema =
|
|
5203
|
-
|
|
5204
|
-
op:
|
|
5205
|
-
items:
|
|
5219
|
+
var ObjectQueryPredicateSchema = z17.lazy(() => z17.union([
|
|
5220
|
+
z17.object({
|
|
5221
|
+
op: z17.enum(["and", "or"]),
|
|
5222
|
+
items: z17.array(ObjectQueryPredicateSchema)
|
|
5206
5223
|
}).strict(),
|
|
5207
|
-
|
|
5208
|
-
op:
|
|
5224
|
+
z17.object({
|
|
5225
|
+
op: z17.literal("not"),
|
|
5209
5226
|
item: ObjectQueryPredicateSchema
|
|
5210
5227
|
}).strict(),
|
|
5211
|
-
|
|
5212
|
-
op:
|
|
5213
|
-
propertyId:
|
|
5228
|
+
z17.object({
|
|
5229
|
+
op: z17.enum(["eq", "neq", "lt", "lte", "gt", "gte"]),
|
|
5230
|
+
propertyId: z17.string().min(1),
|
|
5214
5231
|
value: JsonValueSchema
|
|
5215
5232
|
}).strict(),
|
|
5216
|
-
|
|
5217
|
-
op:
|
|
5218
|
-
propertyId:
|
|
5219
|
-
values:
|
|
5233
|
+
z17.object({
|
|
5234
|
+
op: z17.literal("in"),
|
|
5235
|
+
propertyId: z17.string().min(1),
|
|
5236
|
+
values: z17.array(JsonValueSchema)
|
|
5220
5237
|
}).strict(),
|
|
5221
|
-
|
|
5222
|
-
op:
|
|
5223
|
-
propertyId:
|
|
5224
|
-
value:
|
|
5238
|
+
z17.object({
|
|
5239
|
+
op: z17.literal("exists"),
|
|
5240
|
+
propertyId: z17.string().min(1),
|
|
5241
|
+
value: z17.boolean()
|
|
5225
5242
|
}).strict(),
|
|
5226
|
-
|
|
5227
|
-
op:
|
|
5228
|
-
propertyId:
|
|
5243
|
+
z17.object({
|
|
5244
|
+
op: z17.literal("contains"),
|
|
5245
|
+
propertyId: z17.string().min(1),
|
|
5229
5246
|
value: JsonValueSchema
|
|
5230
5247
|
}).strict()
|
|
5231
5248
|
]));
|
|
5232
|
-
var ObjectQuerySortFieldSchema =
|
|
5233
|
-
|
|
5234
|
-
kind:
|
|
5235
|
-
propertyId:
|
|
5236
|
-
direction:
|
|
5249
|
+
var ObjectQuerySortFieldSchema = z17.union([
|
|
5250
|
+
z17.object({
|
|
5251
|
+
kind: z17.literal("property"),
|
|
5252
|
+
propertyId: z17.string().min(1),
|
|
5253
|
+
direction: z17.enum(["asc", "desc"]).optional()
|
|
5237
5254
|
}).strict(),
|
|
5238
|
-
|
|
5239
|
-
kind:
|
|
5240
|
-
direction:
|
|
5255
|
+
z17.object({
|
|
5256
|
+
kind: z17.literal("relevance"),
|
|
5257
|
+
direction: z17.enum(["asc", "desc"]).optional()
|
|
5241
5258
|
}).strict()
|
|
5242
5259
|
]);
|
|
5243
|
-
var ObjectExpansionSchema =
|
|
5244
|
-
linkId:
|
|
5245
|
-
direction:
|
|
5246
|
-
sourceObjectTypeId:
|
|
5247
|
-
limit:
|
|
5248
|
-
orderBy:
|
|
5249
|
-
expand:
|
|
5260
|
+
var ObjectExpansionSchema = z17.lazy(() => z17.object({
|
|
5261
|
+
linkId: z17.string().min(1),
|
|
5262
|
+
direction: z17.enum(["outgoing", "incoming"]),
|
|
5263
|
+
sourceObjectTypeId: z17.string().min(1).optional(),
|
|
5264
|
+
limit: z17.number().int().nonnegative().optional(),
|
|
5265
|
+
orderBy: z17.array(ObjectQuerySortFieldSchema).optional(),
|
|
5266
|
+
expand: z17.array(ObjectExpansionSchema).optional()
|
|
5250
5267
|
}).strict());
|
|
5251
|
-
var ObjectQuerySchema =
|
|
5252
|
-
|
|
5253
|
-
kind:
|
|
5254
|
-
objectTypeId:
|
|
5255
|
-
includeSubtypes:
|
|
5268
|
+
var ObjectQuerySchema = z17.lazy(() => z17.discriminatedUnion("kind", [
|
|
5269
|
+
z17.object({
|
|
5270
|
+
kind: z17.literal("start"),
|
|
5271
|
+
objectTypeId: z17.string().min(1),
|
|
5272
|
+
includeSubtypes: z17.boolean().optional()
|
|
5273
|
+
}).strict(),
|
|
5274
|
+
z17.object({
|
|
5275
|
+
kind: z17.literal("refs"),
|
|
5276
|
+
refs: z17.array(z17.object({
|
|
5277
|
+
objectTypeId: z17.string().min(1),
|
|
5278
|
+
primaryId: z17.string().min(1)
|
|
5279
|
+
}).strict())
|
|
5256
5280
|
}).strict(),
|
|
5257
|
-
|
|
5258
|
-
kind:
|
|
5281
|
+
z17.object({
|
|
5282
|
+
kind: z17.literal("filter"),
|
|
5259
5283
|
input: ObjectQuerySchema,
|
|
5260
5284
|
predicate: ObjectQueryPredicateSchema
|
|
5261
5285
|
}).strict(),
|
|
5262
|
-
|
|
5263
|
-
kind:
|
|
5286
|
+
z17.object({
|
|
5287
|
+
kind: z17.literal("text"),
|
|
5264
5288
|
input: ObjectQuerySchema,
|
|
5265
|
-
query:
|
|
5266
|
-
fields:
|
|
5289
|
+
query: z17.string(),
|
|
5290
|
+
fields: z17.array(z17.string().min(1)).optional()
|
|
5267
5291
|
}).strict(),
|
|
5268
|
-
|
|
5269
|
-
kind:
|
|
5292
|
+
z17.object({
|
|
5293
|
+
kind: z17.literal("vector"),
|
|
5270
5294
|
input: ObjectQuerySchema,
|
|
5271
|
-
vector:
|
|
5272
|
-
propertyId:
|
|
5273
|
-
k:
|
|
5295
|
+
vector: z17.array(z17.number().finite()),
|
|
5296
|
+
propertyId: z17.string().min(1),
|
|
5297
|
+
k: z17.number().int().positive()
|
|
5274
5298
|
}).strict(),
|
|
5275
|
-
|
|
5276
|
-
kind:
|
|
5299
|
+
z17.object({
|
|
5300
|
+
kind: z17.literal("traverse"),
|
|
5277
5301
|
input: ObjectQuerySchema,
|
|
5278
|
-
linkId:
|
|
5279
|
-
direction:
|
|
5280
|
-
sourceObjectTypeId:
|
|
5302
|
+
linkId: z17.string().min(1),
|
|
5303
|
+
direction: z17.enum(["outgoing", "incoming"]),
|
|
5304
|
+
sourceObjectTypeId: z17.string().min(1).optional()
|
|
5281
5305
|
}).strict(),
|
|
5282
|
-
|
|
5283
|
-
kind:
|
|
5284
|
-
op:
|
|
5285
|
-
inputs:
|
|
5306
|
+
z17.object({
|
|
5307
|
+
kind: z17.literal("set"),
|
|
5308
|
+
op: z17.enum(["union", "intersect", "subtract"]),
|
|
5309
|
+
inputs: z17.array(ObjectQuerySchema)
|
|
5286
5310
|
}).strict(),
|
|
5287
|
-
|
|
5288
|
-
kind:
|
|
5311
|
+
z17.object({
|
|
5312
|
+
kind: z17.literal("sort"),
|
|
5289
5313
|
input: ObjectQuerySchema,
|
|
5290
|
-
fields:
|
|
5314
|
+
fields: z17.array(ObjectQuerySortFieldSchema)
|
|
5291
5315
|
}).strict(),
|
|
5292
|
-
|
|
5293
|
-
kind:
|
|
5316
|
+
z17.object({
|
|
5317
|
+
kind: z17.literal("limit"),
|
|
5294
5318
|
input: ObjectQuerySchema,
|
|
5295
|
-
limit:
|
|
5319
|
+
limit: z17.number().int().nonnegative()
|
|
5296
5320
|
}).strict(),
|
|
5297
|
-
|
|
5298
|
-
kind:
|
|
5321
|
+
z17.object({
|
|
5322
|
+
kind: z17.literal("page"),
|
|
5299
5323
|
input: ObjectQuerySchema,
|
|
5300
|
-
pageSize:
|
|
5301
|
-
pageToken:
|
|
5324
|
+
pageSize: z17.number().int().positive(),
|
|
5325
|
+
pageToken: z17.string().optional()
|
|
5302
5326
|
}).strict(),
|
|
5303
|
-
|
|
5304
|
-
kind:
|
|
5327
|
+
z17.object({
|
|
5328
|
+
kind: z17.literal("project"),
|
|
5305
5329
|
input: ObjectQuerySchema,
|
|
5306
|
-
properties:
|
|
5330
|
+
properties: z17.array(z17.string().min(1)).optional()
|
|
5307
5331
|
}).strict(),
|
|
5308
|
-
|
|
5309
|
-
kind:
|
|
5332
|
+
z17.object({
|
|
5333
|
+
kind: z17.literal("expand"),
|
|
5310
5334
|
input: ObjectQuerySchema,
|
|
5311
|
-
expansions:
|
|
5335
|
+
expansions: z17.array(ObjectExpansionSchema)
|
|
5312
5336
|
}).strict()
|
|
5313
5337
|
]));
|
|
5314
|
-
var ObjectQueryRequestSchema =
|
|
5338
|
+
var ObjectQueryRequestSchema = z17.object({
|
|
5315
5339
|
query: ObjectQuerySchema,
|
|
5316
|
-
includeTotal:
|
|
5340
|
+
includeTotal: z17.boolean().optional()
|
|
5317
5341
|
}).strict();
|
|
5318
|
-
var ObjectQueryCountRequestSchema =
|
|
5342
|
+
var ObjectQueryCountRequestSchema = z17.object({
|
|
5319
5343
|
query: ObjectQuerySchema
|
|
5320
5344
|
}).strict();
|
|
5321
|
-
var ObjectQueryExistsRequestSchema =
|
|
5345
|
+
var ObjectQueryExistsRequestSchema = z17.object({
|
|
5322
5346
|
query: ObjectQuerySchema
|
|
5323
5347
|
}).strict();
|
|
5324
|
-
var ObjectQueryFacetRequestSchema =
|
|
5325
|
-
propertyId:
|
|
5326
|
-
limit:
|
|
5348
|
+
var ObjectQueryFacetRequestSchema = z17.object({
|
|
5349
|
+
propertyId: z17.string().min(1),
|
|
5350
|
+
limit: z17.number().int().positive()
|
|
5327
5351
|
}).strict();
|
|
5328
|
-
var ObjectQueryFacetsRequestSchema =
|
|
5352
|
+
var ObjectQueryFacetsRequestSchema = z17.object({
|
|
5329
5353
|
query: ObjectQuerySchema,
|
|
5330
|
-
facets:
|
|
5354
|
+
facets: z17.array(ObjectQueryFacetRequestSchema).min(1)
|
|
5331
5355
|
}).strict();
|
|
5332
|
-
var
|
|
5333
|
-
|
|
5334
|
-
|
|
5335
|
-
|
|
5336
|
-
|
|
5337
|
-
|
|
5338
|
-
|
|
5339
|
-
|
|
5340
|
-
|
|
5341
|
-
|
|
5342
|
-
|
|
5356
|
+
var ObjectQueryLinksRequestSchema = z17.object({
|
|
5357
|
+
query: ObjectQuerySchema,
|
|
5358
|
+
direction: z17.enum(["outgoing", "incoming", "both"]).default("both"),
|
|
5359
|
+
linkId: z17.string().min(1).optional(),
|
|
5360
|
+
includeObjects: z17.boolean().default(false),
|
|
5361
|
+
pageSize: z17.number().int().positive().max(1000).default(100),
|
|
5362
|
+
pageToken: z17.string().min(1).optional()
|
|
5363
|
+
}).strict();
|
|
5364
|
+
var TwinObjectSchema = z17.object({
|
|
5365
|
+
primaryId: z17.string(),
|
|
5366
|
+
objectTypeId: z17.string(),
|
|
5367
|
+
properties: z17.record(z17.unknown()),
|
|
5368
|
+
createdAt: z17.string(),
|
|
5369
|
+
updatedAt: z17.string()
|
|
5370
|
+
});
|
|
5371
|
+
var ObjectListResponseSchema = z17.object({
|
|
5372
|
+
objects: z17.array(TwinObjectSchema),
|
|
5373
|
+
hasMore: z17.boolean(),
|
|
5374
|
+
total: z17.number()
|
|
5343
5375
|
});
|
|
5344
5376
|
var anyJsonValueSchema = {};
|
|
5345
5377
|
var stringArraySchema = { type: "array", items: { type: "string", minLength: 1 } };
|
|
@@ -5347,6 +5379,7 @@ var objectQueryRef = { $ref: "#/components/schemas/ObjectQuery" };
|
|
|
5347
5379
|
var objectQueryPredicateRef = { $ref: "#/components/schemas/ObjectQueryPredicate" };
|
|
5348
5380
|
var objectQuerySortFieldRef = { $ref: "#/components/schemas/ObjectQuerySortField" };
|
|
5349
5381
|
var objectExpansionRef = { $ref: "#/components/schemas/ObjectExpansion" };
|
|
5382
|
+
var objectRefSchemaRef = { $ref: "#/components/schemas/ObjectRef" };
|
|
5350
5383
|
var ObjectQueryOpenApiSchemas = {
|
|
5351
5384
|
ErrorResponse: {
|
|
5352
5385
|
type: "object",
|
|
@@ -5485,6 +5518,38 @@ var ObjectQueryOpenApiSchemas = {
|
|
|
5485
5518
|
plan: { $ref: "#/components/schemas/ObjectQueryPlanSummary" }
|
|
5486
5519
|
}
|
|
5487
5520
|
},
|
|
5521
|
+
ObjectQueryLink: {
|
|
5522
|
+
type: "object",
|
|
5523
|
+
required: ["source", "linkId", "target", "createdAt", "updatedAt"],
|
|
5524
|
+
additionalProperties: false,
|
|
5525
|
+
properties: {
|
|
5526
|
+
source: objectRefSchemaRef,
|
|
5527
|
+
linkId: { type: "string" },
|
|
5528
|
+
target: objectRefSchemaRef,
|
|
5529
|
+
properties: { type: "object", additionalProperties: true },
|
|
5530
|
+
createdAt: { type: "string" },
|
|
5531
|
+
updatedAt: { type: "string" }
|
|
5532
|
+
}
|
|
5533
|
+
},
|
|
5534
|
+
ObjectQueryLinksResponse: {
|
|
5535
|
+
type: "object",
|
|
5536
|
+
required: ["objects", "links", "hasMore"],
|
|
5537
|
+
additionalProperties: false,
|
|
5538
|
+
properties: {
|
|
5539
|
+
objects: {
|
|
5540
|
+
type: "array",
|
|
5541
|
+
description: "Selected objects followed by visible endpoint objects from this link page, de-duplicated. Empty unless includeObjects is true.",
|
|
5542
|
+
items: { $ref: "#/components/schemas/ObjectQueryObject" }
|
|
5543
|
+
},
|
|
5544
|
+
links: {
|
|
5545
|
+
type: "array",
|
|
5546
|
+
description: "Visible physical links in deterministic identity order.",
|
|
5547
|
+
items: { $ref: "#/components/schemas/ObjectQueryLink" }
|
|
5548
|
+
},
|
|
5549
|
+
hasMore: { type: "boolean" },
|
|
5550
|
+
nextPageToken: { type: "string" }
|
|
5551
|
+
}
|
|
5552
|
+
},
|
|
5488
5553
|
ObjectQueryErrorResponse: {
|
|
5489
5554
|
type: "object",
|
|
5490
5555
|
required: ["error"],
|
|
@@ -5544,6 +5609,36 @@ var ObjectQueryOpenApiSchemas = {
|
|
|
5544
5609
|
}
|
|
5545
5610
|
}
|
|
5546
5611
|
},
|
|
5612
|
+
ObjectQueryLinksRequest: {
|
|
5613
|
+
type: "object",
|
|
5614
|
+
required: ["query"],
|
|
5615
|
+
additionalProperties: false,
|
|
5616
|
+
properties: {
|
|
5617
|
+
query: objectQueryRef,
|
|
5618
|
+
direction: { type: "string", enum: ["outgoing", "incoming", "both"], default: "both" },
|
|
5619
|
+
linkId: { type: "string", minLength: 1 },
|
|
5620
|
+
includeObjects: {
|
|
5621
|
+
type: "boolean",
|
|
5622
|
+
default: false,
|
|
5623
|
+
description: "Include selected objects and visible endpoints from the current link page."
|
|
5624
|
+
},
|
|
5625
|
+
pageSize: { type: "integer", minimum: 1, maximum: 1000, default: 100 },
|
|
5626
|
+
pageToken: {
|
|
5627
|
+
type: "string",
|
|
5628
|
+
minLength: 1,
|
|
5629
|
+
description: "Opaque token from the previous page. The project, normalized query, direction, and linkId must remain unchanged."
|
|
5630
|
+
}
|
|
5631
|
+
}
|
|
5632
|
+
},
|
|
5633
|
+
ObjectRef: {
|
|
5634
|
+
type: "object",
|
|
5635
|
+
required: ["objectTypeId", "primaryId"],
|
|
5636
|
+
additionalProperties: false,
|
|
5637
|
+
properties: {
|
|
5638
|
+
objectTypeId: { type: "string", minLength: 1 },
|
|
5639
|
+
primaryId: { type: "string", minLength: 1 }
|
|
5640
|
+
}
|
|
5641
|
+
},
|
|
5547
5642
|
ObjectQuery: {
|
|
5548
5643
|
oneOf: [
|
|
5549
5644
|
{
|
|
@@ -5556,6 +5651,20 @@ var ObjectQueryOpenApiSchemas = {
|
|
|
5556
5651
|
includeSubtypes: { type: "boolean" }
|
|
5557
5652
|
}
|
|
5558
5653
|
},
|
|
5654
|
+
{
|
|
5655
|
+
type: "object",
|
|
5656
|
+
required: ["kind", "refs"],
|
|
5657
|
+
additionalProperties: false,
|
|
5658
|
+
properties: {
|
|
5659
|
+
kind: { type: "string", enum: ["refs"] },
|
|
5660
|
+
refs: {
|
|
5661
|
+
type: "array",
|
|
5662
|
+
minItems: 1,
|
|
5663
|
+
description: "One to 1,000 unique identities after normalization; duplicate entries are accepted and removed.",
|
|
5664
|
+
items: objectRefSchemaRef
|
|
5665
|
+
}
|
|
5666
|
+
}
|
|
5667
|
+
},
|
|
5559
5668
|
{
|
|
5560
5669
|
type: "object",
|
|
5561
5670
|
required: ["kind", "input", "predicate"],
|
|
@@ -5769,7 +5878,7 @@ var ObjectQueryOpenApiSchemas = {
|
|
|
5769
5878
|
|
|
5770
5879
|
// src/routes/objects.ts
|
|
5771
5880
|
var ObjectFileContentQuerySchema = FileContentQuerySchema.extend({
|
|
5772
|
-
path:
|
|
5881
|
+
path: z18.string().min(1).regex(/^\/properties(?:\/|$)/, "Object file content paths must start with /properties/")
|
|
5773
5882
|
});
|
|
5774
5883
|
function serializeObject(row) {
|
|
5775
5884
|
return {
|
|
@@ -5780,6 +5889,22 @@ function serializeObject(row) {
|
|
|
5780
5889
|
updatedAt: toIsoString(row.updatedAt)
|
|
5781
5890
|
};
|
|
5782
5891
|
}
|
|
5892
|
+
function serializeObjectLink(link) {
|
|
5893
|
+
return {
|
|
5894
|
+
source: {
|
|
5895
|
+
objectTypeId: link.sourceTypeId,
|
|
5896
|
+
primaryId: link.sourceId
|
|
5897
|
+
},
|
|
5898
|
+
linkId: link.linkId,
|
|
5899
|
+
target: {
|
|
5900
|
+
objectTypeId: link.targetTypeId,
|
|
5901
|
+
primaryId: link.targetId
|
|
5902
|
+
},
|
|
5903
|
+
...link.properties === undefined ? {} : { properties: link.properties },
|
|
5904
|
+
createdAt: toIsoString(link.createdAt),
|
|
5905
|
+
updatedAt: toIsoString(link.updatedAt)
|
|
5906
|
+
};
|
|
5907
|
+
}
|
|
5783
5908
|
function serializeExpandedObject(row) {
|
|
5784
5909
|
const serialized = serializeObject(row);
|
|
5785
5910
|
if (row.links)
|
|
@@ -6066,6 +6191,69 @@ function registerObjectRoutes(app, host) {
|
|
|
6066
6191
|
}
|
|
6067
6192
|
}
|
|
6068
6193
|
}
|
|
6194
|
+
}).post("/api/objects/query/links", async (context) => {
|
|
6195
|
+
const { body, set } = context;
|
|
6196
|
+
try {
|
|
6197
|
+
const parsed = ObjectQueryLinksRequestSchema.parse(body);
|
|
6198
|
+
const result = await requireRequestSixb(context).objects.queryLinks(parsed);
|
|
6199
|
+
return {
|
|
6200
|
+
objects: result.objects.map(serializeObject),
|
|
6201
|
+
links: result.links.map(serializeObjectLink),
|
|
6202
|
+
hasMore: result.hasMore,
|
|
6203
|
+
...result.nextPageToken === undefined ? {} : { nextPageToken: result.nextPageToken }
|
|
6204
|
+
};
|
|
6205
|
+
} catch (error) {
|
|
6206
|
+
return handleObjectQueryError(error, set);
|
|
6207
|
+
}
|
|
6208
|
+
}, {
|
|
6209
|
+
detail: {
|
|
6210
|
+
summary: "Query object links",
|
|
6211
|
+
tags: [OPENAPI_TAGS.links.name],
|
|
6212
|
+
operationId: "queryObjectLinks",
|
|
6213
|
+
security: bearerSecurityRequirement("queryObjectLinks"),
|
|
6214
|
+
requestBody: {
|
|
6215
|
+
required: true,
|
|
6216
|
+
content: {
|
|
6217
|
+
"application/json": {
|
|
6218
|
+
schema: { $ref: "#/components/schemas/ObjectQueryLinksRequest" }
|
|
6219
|
+
}
|
|
6220
|
+
}
|
|
6221
|
+
},
|
|
6222
|
+
responses: {
|
|
6223
|
+
200: {
|
|
6224
|
+
description: "Response for status 200",
|
|
6225
|
+
content: {
|
|
6226
|
+
"application/json": {
|
|
6227
|
+
schema: { $ref: "#/components/schemas/ObjectQueryLinksResponse" }
|
|
6228
|
+
}
|
|
6229
|
+
}
|
|
6230
|
+
},
|
|
6231
|
+
400: {
|
|
6232
|
+
description: "Response for status 400",
|
|
6233
|
+
content: {
|
|
6234
|
+
"application/json": {
|
|
6235
|
+
schema: { $ref: "#/components/schemas/ObjectQueryErrorResponse" }
|
|
6236
|
+
}
|
|
6237
|
+
}
|
|
6238
|
+
},
|
|
6239
|
+
403: {
|
|
6240
|
+
description: "Response for status 403",
|
|
6241
|
+
content: {
|
|
6242
|
+
"application/json": {
|
|
6243
|
+
schema: { $ref: "#/components/schemas/ErrorResponse" }
|
|
6244
|
+
}
|
|
6245
|
+
}
|
|
6246
|
+
},
|
|
6247
|
+
500: {
|
|
6248
|
+
description: "Response for status 500",
|
|
6249
|
+
content: {
|
|
6250
|
+
"application/json": {
|
|
6251
|
+
schema: { $ref: "#/components/schemas/ErrorResponse" }
|
|
6252
|
+
}
|
|
6253
|
+
}
|
|
6254
|
+
}
|
|
6255
|
+
}
|
|
6256
|
+
}
|
|
6069
6257
|
}).post("/api/objects/query/count", async (context) => {
|
|
6070
6258
|
const { body, set } = context;
|
|
6071
6259
|
try {
|
|
@@ -6426,111 +6614,111 @@ function registerOntologyRoutes(app, _host) {
|
|
|
6426
6614
|
import {
|
|
6427
6615
|
PIPELINE_RUN_FAILURE_CODES
|
|
6428
6616
|
} from "@sixb/core/storage";
|
|
6429
|
-
import { z as
|
|
6617
|
+
import { z as z19 } from "zod";
|
|
6430
6618
|
var PipelineRunFailureSchema = sixbFailureSchema(PIPELINE_RUN_FAILURE_CODES);
|
|
6431
|
-
var PipelineParamsSchema =
|
|
6432
|
-
pipelineId:
|
|
6619
|
+
var PipelineParamsSchema = z19.object({
|
|
6620
|
+
pipelineId: z19.string().min(1)
|
|
6433
6621
|
});
|
|
6434
|
-
var PipelineRunParamsSchema =
|
|
6435
|
-
runId:
|
|
6622
|
+
var PipelineRunParamsSchema = z19.object({
|
|
6623
|
+
runId: z19.string().min(1)
|
|
6436
6624
|
});
|
|
6437
|
-
var PipelineRunStatusSchema =
|
|
6625
|
+
var PipelineRunStatusSchema = z19.enum([
|
|
6438
6626
|
"queued",
|
|
6439
6627
|
"running",
|
|
6440
6628
|
"succeeded",
|
|
6441
6629
|
"failed",
|
|
6442
6630
|
"cancelled"
|
|
6443
6631
|
]);
|
|
6444
|
-
var PipelineStepRunStatusSchema =
|
|
6445
|
-
var PipelineRunsQuerySchema =
|
|
6446
|
-
pipelineId:
|
|
6632
|
+
var PipelineStepRunStatusSchema = z19.enum(["running", "succeeded", "failed", "cancelled"]);
|
|
6633
|
+
var PipelineRunsQuerySchema = z19.object({
|
|
6634
|
+
pipelineId: z19.string().optional(),
|
|
6447
6635
|
status: PipelineRunStatusSchema.optional(),
|
|
6448
|
-
startedAfter:
|
|
6449
|
-
startedBefore:
|
|
6450
|
-
limit:
|
|
6451
|
-
offset:
|
|
6452
|
-
order:
|
|
6453
|
-
});
|
|
6454
|
-
var DatasetVersionRefSchema2 =
|
|
6455
|
-
datasetId:
|
|
6456
|
-
versionId:
|
|
6457
|
-
});
|
|
6458
|
-
var PipelineTriggerSchema =
|
|
6459
|
-
type:
|
|
6460
|
-
scheduleId:
|
|
6461
|
-
});
|
|
6462
|
-
var PipelineStepExecutorSchema =
|
|
6463
|
-
|
|
6464
|
-
kind:
|
|
6465
|
-
dialect:
|
|
6636
|
+
startedAfter: z19.string().optional(),
|
|
6637
|
+
startedBefore: z19.string().optional(),
|
|
6638
|
+
limit: z19.string().optional(),
|
|
6639
|
+
offset: z19.string().optional(),
|
|
6640
|
+
order: z19.enum(["asc", "desc"]).optional()
|
|
6641
|
+
});
|
|
6642
|
+
var DatasetVersionRefSchema2 = z19.object({
|
|
6643
|
+
datasetId: z19.string(),
|
|
6644
|
+
versionId: z19.string()
|
|
6645
|
+
});
|
|
6646
|
+
var PipelineTriggerSchema = z19.object({
|
|
6647
|
+
type: z19.literal("schedule"),
|
|
6648
|
+
scheduleId: z19.string()
|
|
6649
|
+
});
|
|
6650
|
+
var PipelineStepExecutorSchema = z19.union([
|
|
6651
|
+
z19.object({
|
|
6652
|
+
kind: z19.literal("sql"),
|
|
6653
|
+
dialect: z19.literal("duckdb")
|
|
6466
6654
|
}),
|
|
6467
|
-
|
|
6468
|
-
kind:
|
|
6655
|
+
z19.object({
|
|
6656
|
+
kind: z19.literal("run")
|
|
6469
6657
|
})
|
|
6470
6658
|
]);
|
|
6471
|
-
var PipelineRunSchema =
|
|
6472
|
-
id:
|
|
6473
|
-
projectId:
|
|
6474
|
-
pipelineId:
|
|
6659
|
+
var PipelineRunSchema = z19.object({
|
|
6660
|
+
id: z19.string(),
|
|
6661
|
+
projectId: z19.string(),
|
|
6662
|
+
pipelineId: z19.string(),
|
|
6475
6663
|
status: PipelineRunStatusSchema,
|
|
6476
|
-
queuedAt:
|
|
6477
|
-
startedAt:
|
|
6478
|
-
finishedAt:
|
|
6664
|
+
queuedAt: z19.string(),
|
|
6665
|
+
startedAt: z19.string().optional(),
|
|
6666
|
+
finishedAt: z19.string().optional(),
|
|
6479
6667
|
output: DatasetVersionRefSchema2.optional(),
|
|
6480
6668
|
error: PipelineRunFailureSchema.optional()
|
|
6481
6669
|
});
|
|
6482
|
-
var PipelineStepRunSchema =
|
|
6483
|
-
id:
|
|
6484
|
-
projectId:
|
|
6485
|
-
pipelineRunId:
|
|
6486
|
-
pipelineId:
|
|
6487
|
-
stepId:
|
|
6488
|
-
datasetId:
|
|
6489
|
-
mode:
|
|
6670
|
+
var PipelineStepRunSchema = z19.object({
|
|
6671
|
+
id: z19.string(),
|
|
6672
|
+
projectId: z19.string(),
|
|
6673
|
+
pipelineRunId: z19.string(),
|
|
6674
|
+
pipelineId: z19.string(),
|
|
6675
|
+
stepId: z19.string(),
|
|
6676
|
+
datasetId: z19.string(),
|
|
6677
|
+
mode: z19.enum(["snapshot", "append"]),
|
|
6490
6678
|
status: PipelineStepRunStatusSchema,
|
|
6491
|
-
startedAt:
|
|
6492
|
-
finishedAt:
|
|
6493
|
-
inputs:
|
|
6679
|
+
startedAt: z19.string(),
|
|
6680
|
+
finishedAt: z19.string().optional(),
|
|
6681
|
+
inputs: z19.array(DatasetVersionRefSchema2),
|
|
6494
6682
|
output: DatasetVersionRefSchema2.optional(),
|
|
6495
|
-
rowsWritten:
|
|
6683
|
+
rowsWritten: z19.number().optional(),
|
|
6496
6684
|
error: PipelineRunFailureSchema.optional()
|
|
6497
6685
|
});
|
|
6498
|
-
var PipelineStepSchema =
|
|
6499
|
-
id:
|
|
6500
|
-
mode:
|
|
6686
|
+
var PipelineStepSchema = z19.object({
|
|
6687
|
+
id: z19.string(),
|
|
6688
|
+
mode: z19.enum(["snapshot", "append"]),
|
|
6501
6689
|
executor: PipelineStepExecutorSchema,
|
|
6502
|
-
inputs:
|
|
6503
|
-
name:
|
|
6690
|
+
inputs: z19.array(z19.object({
|
|
6691
|
+
name: z19.string(),
|
|
6504
6692
|
dataset: DatasetDefinitionSchema
|
|
6505
6693
|
})),
|
|
6506
6694
|
output: DatasetDefinitionSchema
|
|
6507
6695
|
});
|
|
6508
|
-
var PipelineSchema =
|
|
6509
|
-
id:
|
|
6510
|
-
triggers:
|
|
6511
|
-
graph:
|
|
6512
|
-
kind:
|
|
6513
|
-
nodes:
|
|
6514
|
-
kind:
|
|
6696
|
+
var PipelineSchema = z19.object({
|
|
6697
|
+
id: z19.string(),
|
|
6698
|
+
triggers: z19.array(PipelineTriggerSchema),
|
|
6699
|
+
graph: z19.object({
|
|
6700
|
+
kind: z19.literal("sequence"),
|
|
6701
|
+
nodes: z19.array(z19.object({
|
|
6702
|
+
kind: z19.literal("step"),
|
|
6515
6703
|
step: PipelineStepSchema
|
|
6516
6704
|
}))
|
|
6517
6705
|
}),
|
|
6518
6706
|
latestRun: PipelineRunSchema.nullable()
|
|
6519
6707
|
});
|
|
6520
|
-
var PipelineRunListResponseSchema =
|
|
6521
|
-
runs:
|
|
6522
|
-
hasMore:
|
|
6523
|
-
total:
|
|
6708
|
+
var PipelineRunListResponseSchema = z19.object({
|
|
6709
|
+
runs: z19.array(PipelineRunSchema),
|
|
6710
|
+
hasMore: z19.boolean(),
|
|
6711
|
+
total: z19.number()
|
|
6524
6712
|
});
|
|
6525
|
-
var PipelineRunDetailResponseSchema =
|
|
6713
|
+
var PipelineRunDetailResponseSchema = z19.object({
|
|
6526
6714
|
run: PipelineRunSchema,
|
|
6527
|
-
steps:
|
|
6715
|
+
steps: z19.array(PipelineStepRunSchema)
|
|
6528
6716
|
});
|
|
6529
|
-
var RequestPipelineRunResponseSchema =
|
|
6530
|
-
runId:
|
|
6531
|
-
jobId:
|
|
6532
|
-
pipelineId:
|
|
6533
|
-
queuedAt:
|
|
6717
|
+
var RequestPipelineRunResponseSchema = z19.object({
|
|
6718
|
+
runId: z19.string(),
|
|
6719
|
+
jobId: z19.string(),
|
|
6720
|
+
pipelineId: z19.string(),
|
|
6721
|
+
queuedAt: z19.string()
|
|
6534
6722
|
});
|
|
6535
6723
|
|
|
6536
6724
|
// src/routes/pipelines.ts
|
|
@@ -6752,9 +6940,9 @@ function registerPipelineRoutes(app, host) {
|
|
|
6752
6940
|
}
|
|
6753
6941
|
|
|
6754
6942
|
// src/schemas/project.ts
|
|
6755
|
-
import { z as
|
|
6756
|
-
var ProjectInfoResponseSchema =
|
|
6757
|
-
id:
|
|
6943
|
+
import { z as z20 } from "zod";
|
|
6944
|
+
var ProjectInfoResponseSchema = z20.object({
|
|
6945
|
+
id: z20.string()
|
|
6758
6946
|
});
|
|
6759
6947
|
|
|
6760
6948
|
// src/routes/project.ts
|
|
@@ -6772,146 +6960,147 @@ function registerProjectRoutes(app, host) {
|
|
|
6772
6960
|
|
|
6773
6961
|
// src/schemas/projections.ts
|
|
6774
6962
|
import { PROJECTION_RUN_FAILURE_CODES } from "@sixb/core/storage";
|
|
6775
|
-
import { z as
|
|
6963
|
+
import { z as z21 } from "zod";
|
|
6776
6964
|
var ProjectionRunFailureSchema = sixbFailureSchema(PROJECTION_RUN_FAILURE_CODES);
|
|
6777
|
-
var ProjectionKindSchema =
|
|
6778
|
-
var ProjectionRunStatusSchema =
|
|
6965
|
+
var ProjectionKindSchema = z21.enum(["object", "link", "telemetry"]);
|
|
6966
|
+
var ProjectionRunStatusSchema = z21.enum([
|
|
6779
6967
|
"queued",
|
|
6780
6968
|
"running",
|
|
6781
6969
|
"succeeded",
|
|
6782
6970
|
"failed",
|
|
6783
6971
|
"cancelled"
|
|
6784
6972
|
]);
|
|
6785
|
-
var ProjectionRunIdentityBaseSchema =
|
|
6786
|
-
projectionId:
|
|
6787
|
-
datasetVersion:
|
|
6788
|
-
datasetId:
|
|
6789
|
-
versionId:
|
|
6790
|
-
createdAt:
|
|
6973
|
+
var ProjectionRunIdentityBaseSchema = z21.object({
|
|
6974
|
+
projectionId: z21.string(),
|
|
6975
|
+
datasetVersion: z21.object({
|
|
6976
|
+
datasetId: z21.string(),
|
|
6977
|
+
versionId: z21.string(),
|
|
6978
|
+
createdAt: z21.string()
|
|
6791
6979
|
}),
|
|
6792
|
-
ontologyRevision:
|
|
6793
|
-
projectionRevision:
|
|
6794
|
-
ownershipHash:
|
|
6795
|
-
});
|
|
6796
|
-
var ProjectionRunBaseSchema =
|
|
6797
|
-
id:
|
|
6798
|
-
projectId:
|
|
6799
|
-
executionId:
|
|
6980
|
+
ontologyRevision: z21.string(),
|
|
6981
|
+
projectionRevision: z21.string(),
|
|
6982
|
+
ownershipHash: z21.string()
|
|
6983
|
+
});
|
|
6984
|
+
var ProjectionRunBaseSchema = z21.object({
|
|
6985
|
+
id: z21.string(),
|
|
6986
|
+
projectId: z21.string(),
|
|
6987
|
+
executionId: z21.string(),
|
|
6800
6988
|
status: ProjectionRunStatusSchema,
|
|
6801
|
-
attempt:
|
|
6802
|
-
progress:
|
|
6803
|
-
sourceRowsRead:
|
|
6804
|
-
sourceRowsSkipped:
|
|
6989
|
+
attempt: z21.number(),
|
|
6990
|
+
progress: z21.object({
|
|
6991
|
+
sourceRowsRead: z21.number(),
|
|
6992
|
+
sourceRowsSkipped: z21.number()
|
|
6805
6993
|
}),
|
|
6806
|
-
queuedAt:
|
|
6807
|
-
startedAt:
|
|
6808
|
-
finishedAt:
|
|
6994
|
+
queuedAt: z21.string(),
|
|
6995
|
+
startedAt: z21.string().optional(),
|
|
6996
|
+
finishedAt: z21.string().optional(),
|
|
6809
6997
|
error: ProjectionRunFailureSchema.optional()
|
|
6810
6998
|
});
|
|
6811
6999
|
var ObjectProjectionRunSchema = ProjectionRunBaseSchema.extend({
|
|
6812
7000
|
identity: ProjectionRunIdentityBaseSchema.extend({
|
|
6813
|
-
projectionKind:
|
|
6814
|
-
protocol:
|
|
7001
|
+
projectionKind: z21.literal("object"),
|
|
7002
|
+
protocol: z21.literal("replacement")
|
|
6815
7003
|
}),
|
|
6816
|
-
target:
|
|
7004
|
+
target: z21.object({ objectTypeId: z21.string() })
|
|
6817
7005
|
});
|
|
6818
7006
|
var LinkProjectionRunSchema = ProjectionRunBaseSchema.extend({
|
|
6819
7007
|
identity: ProjectionRunIdentityBaseSchema.extend({
|
|
6820
|
-
projectionKind:
|
|
6821
|
-
protocol:
|
|
7008
|
+
projectionKind: z21.literal("link"),
|
|
7009
|
+
protocol: z21.literal("replacement")
|
|
6822
7010
|
}),
|
|
6823
|
-
target:
|
|
6824
|
-
sourceObjectTypeId:
|
|
6825
|
-
targetObjectTypeId:
|
|
7011
|
+
target: z21.object({
|
|
7012
|
+
sourceObjectTypeId: z21.string(),
|
|
7013
|
+
targetObjectTypeId: z21.string()
|
|
6826
7014
|
})
|
|
6827
7015
|
});
|
|
6828
7016
|
var TelemetryProjectionRunSchema = ProjectionRunBaseSchema.extend({
|
|
6829
7017
|
identity: ProjectionRunIdentityBaseSchema.extend({
|
|
6830
|
-
projectionKind:
|
|
6831
|
-
protocol:
|
|
7018
|
+
projectionKind: z21.literal("telemetry"),
|
|
7019
|
+
protocol: z21.literal("telemetry")
|
|
6832
7020
|
}),
|
|
6833
|
-
target:
|
|
7021
|
+
target: z21.object({ objectTypeId: z21.string() })
|
|
6834
7022
|
});
|
|
6835
|
-
var ProjectionRunSchema =
|
|
7023
|
+
var ProjectionRunSchema = z21.union([
|
|
6836
7024
|
ObjectProjectionRunSchema,
|
|
6837
7025
|
LinkProjectionRunSchema,
|
|
6838
7026
|
TelemetryProjectionRunSchema
|
|
6839
7027
|
]);
|
|
6840
|
-
var ForeignKeyDescriptorSchema =
|
|
6841
|
-
linkId:
|
|
6842
|
-
sourcePropertyId:
|
|
6843
|
-
sourceField:
|
|
6844
|
-
targetObjectTypeId:
|
|
6845
|
-
});
|
|
6846
|
-
var SourceEditConflictResolutionSchema =
|
|
6847
|
-
|
|
6848
|
-
|
|
7028
|
+
var ForeignKeyDescriptorSchema = z21.object({
|
|
7029
|
+
linkId: z21.string(),
|
|
7030
|
+
sourcePropertyId: z21.string().optional(),
|
|
7031
|
+
sourceField: z21.string().optional(),
|
|
7032
|
+
targetObjectTypeId: z21.string()
|
|
7033
|
+
});
|
|
7034
|
+
var SourceEditConflictResolutionSchema = z21.union([
|
|
7035
|
+
z21.object({ strategy: z21.literal("editsWin") }),
|
|
7036
|
+
z21.object({ strategy: z21.literal("mostRecent"), sourceTimestamp: z21.string() })
|
|
6849
7037
|
]);
|
|
6850
|
-
var ObjectProjectionSchema =
|
|
6851
|
-
_tag:
|
|
6852
|
-
id:
|
|
6853
|
-
objectTypeId:
|
|
6854
|
-
datasetId:
|
|
6855
|
-
properties:
|
|
6856
|
-
links:
|
|
7038
|
+
var ObjectProjectionSchema = z21.object({
|
|
7039
|
+
_tag: z21.literal("ObjectProjectionDefinition"),
|
|
7040
|
+
id: z21.string(),
|
|
7041
|
+
objectTypeId: z21.string(),
|
|
7042
|
+
datasetId: z21.string(),
|
|
7043
|
+
properties: z21.record(z21.string()),
|
|
7044
|
+
links: z21.record(ForeignKeyDescriptorSchema),
|
|
6857
7045
|
conflictResolution: SourceEditConflictResolutionSchema,
|
|
6858
7046
|
latestRun: ProjectionRunSchema.nullable()
|
|
6859
7047
|
});
|
|
6860
|
-
var LinkProjectionSchema =
|
|
6861
|
-
_tag:
|
|
6862
|
-
id:
|
|
6863
|
-
linkId:
|
|
6864
|
-
sourceObjectTypeId:
|
|
6865
|
-
targetObjectTypeId:
|
|
6866
|
-
datasetId:
|
|
6867
|
-
sourceField:
|
|
6868
|
-
targetField:
|
|
7048
|
+
var LinkProjectionSchema = z21.object({
|
|
7049
|
+
_tag: z21.literal("LinkProjectionDefinition"),
|
|
7050
|
+
id: z21.string(),
|
|
7051
|
+
linkId: z21.string(),
|
|
7052
|
+
sourceObjectTypeId: z21.string(),
|
|
7053
|
+
targetObjectTypeId: z21.string(),
|
|
7054
|
+
datasetId: z21.string(),
|
|
7055
|
+
sourceField: z21.string(),
|
|
7056
|
+
targetField: z21.string(),
|
|
6869
7057
|
latestRun: ProjectionRunSchema.nullable()
|
|
6870
7058
|
});
|
|
6871
|
-
var TelemetryProjectionSchema =
|
|
6872
|
-
_tag:
|
|
6873
|
-
id:
|
|
6874
|
-
objectTypeId:
|
|
6875
|
-
|
|
6876
|
-
|
|
6877
|
-
|
|
6878
|
-
|
|
6879
|
-
|
|
6880
|
-
|
|
7059
|
+
var TelemetryProjectionSchema = z21.object({
|
|
7060
|
+
_tag: z21.literal("TelemetryProjectionDefinition"),
|
|
7061
|
+
id: z21.string(),
|
|
7062
|
+
objectTypeId: z21.string(),
|
|
7063
|
+
datasetId: z21.string(),
|
|
7064
|
+
objectIdField: z21.string(),
|
|
7065
|
+
atField: z21.string(),
|
|
7066
|
+
properties: z21.record(z21.object({
|
|
7067
|
+
valueField: z21.string(),
|
|
7068
|
+
unitField: z21.string().optional()
|
|
7069
|
+
})),
|
|
6881
7070
|
latestRun: ProjectionRunSchema.nullable()
|
|
6882
7071
|
});
|
|
6883
|
-
var ProjectionListResponseSchema =
|
|
6884
|
-
objectProjections:
|
|
6885
|
-
linkProjections:
|
|
6886
|
-
telemetryProjections:
|
|
7072
|
+
var ProjectionListResponseSchema = z21.object({
|
|
7073
|
+
objectProjections: z21.array(ObjectProjectionSchema),
|
|
7074
|
+
linkProjections: z21.array(LinkProjectionSchema),
|
|
7075
|
+
telemetryProjections: z21.array(TelemetryProjectionSchema)
|
|
6887
7076
|
});
|
|
6888
|
-
var ProjectionParamsSchema =
|
|
6889
|
-
projectionId:
|
|
7077
|
+
var ProjectionParamsSchema = z21.object({
|
|
7078
|
+
projectionId: z21.string().min(1)
|
|
6890
7079
|
});
|
|
6891
|
-
var ProjectionResponseSchema =
|
|
7080
|
+
var ProjectionResponseSchema = z21.union([
|
|
6892
7081
|
ObjectProjectionSchema,
|
|
6893
7082
|
LinkProjectionSchema,
|
|
6894
7083
|
TelemetryProjectionSchema
|
|
6895
7084
|
]);
|
|
6896
|
-
var ProjectionRunParamsSchema =
|
|
6897
|
-
runId:
|
|
7085
|
+
var ProjectionRunParamsSchema = z21.object({
|
|
7086
|
+
runId: z21.string().min(1)
|
|
6898
7087
|
});
|
|
6899
|
-
var ProjectionRunsQuerySchema =
|
|
6900
|
-
projectionId:
|
|
7088
|
+
var ProjectionRunsQuerySchema = z21.object({
|
|
7089
|
+
projectionId: z21.string().optional(),
|
|
6901
7090
|
projectionKind: ProjectionKindSchema.optional(),
|
|
6902
|
-
datasetId:
|
|
6903
|
-
datasetVersionId:
|
|
7091
|
+
datasetId: z21.string().optional(),
|
|
7092
|
+
datasetVersionId: z21.string().optional(),
|
|
6904
7093
|
status: ProjectionRunStatusSchema.optional(),
|
|
6905
|
-
startedAfter:
|
|
6906
|
-
startedBefore:
|
|
6907
|
-
limit:
|
|
6908
|
-
offset:
|
|
6909
|
-
order:
|
|
7094
|
+
startedAfter: z21.string().optional(),
|
|
7095
|
+
startedBefore: z21.string().optional(),
|
|
7096
|
+
limit: z21.string().optional(),
|
|
7097
|
+
offset: z21.string().optional(),
|
|
7098
|
+
order: z21.enum(["asc", "desc"]).optional()
|
|
6910
7099
|
});
|
|
6911
|
-
var ProjectionRunListResponseSchema =
|
|
6912
|
-
runs:
|
|
6913
|
-
hasMore:
|
|
6914
|
-
total:
|
|
7100
|
+
var ProjectionRunListResponseSchema = z21.object({
|
|
7101
|
+
runs: z21.array(ProjectionRunSchema),
|
|
7102
|
+
hasMore: z21.boolean(),
|
|
7103
|
+
total: z21.number()
|
|
6915
7104
|
});
|
|
6916
7105
|
|
|
6917
7106
|
// src/routes/projections.ts
|
|
@@ -7079,88 +7268,88 @@ function registerProjectionRoutes(app, host) {
|
|
|
7079
7268
|
import { deriveRuleEventDependencies } from "@sixb/core/internal/rules";
|
|
7080
7269
|
|
|
7081
7270
|
// src/schemas/rules.ts
|
|
7082
|
-
import { z as
|
|
7083
|
-
var RuleParamsSchema =
|
|
7084
|
-
ruleId:
|
|
7085
|
-
});
|
|
7086
|
-
var RuleStatesQuerySchema =
|
|
7087
|
-
ruleId:
|
|
7088
|
-
objectTypeId:
|
|
7089
|
-
primaryId:
|
|
7090
|
-
limit:
|
|
7091
|
-
offset:
|
|
7092
|
-
order:
|
|
7093
|
-
});
|
|
7094
|
-
var RuleValueSchema =
|
|
7095
|
-
var RuleSubjectSchema =
|
|
7096
|
-
kind:
|
|
7097
|
-
objectTypeId:
|
|
7098
|
-
});
|
|
7099
|
-
var RuleEventSubjectSchema =
|
|
7100
|
-
kind:
|
|
7101
|
-
objectTypeId:
|
|
7102
|
-
primaryId:
|
|
7103
|
-
});
|
|
7104
|
-
var RulePropertyPredicateSchema =
|
|
7105
|
-
kind:
|
|
7106
|
-
propertyId:
|
|
7107
|
-
op:
|
|
7271
|
+
import { z as z22 } from "zod";
|
|
7272
|
+
var RuleParamsSchema = z22.object({
|
|
7273
|
+
ruleId: z22.string().min(1)
|
|
7274
|
+
});
|
|
7275
|
+
var RuleStatesQuerySchema = z22.object({
|
|
7276
|
+
ruleId: z22.string().optional(),
|
|
7277
|
+
objectTypeId: z22.string().optional(),
|
|
7278
|
+
primaryId: z22.string().optional(),
|
|
7279
|
+
limit: z22.string().optional(),
|
|
7280
|
+
offset: z22.string().optional(),
|
|
7281
|
+
order: z22.enum(["asc", "desc"]).optional()
|
|
7282
|
+
});
|
|
7283
|
+
var RuleValueSchema = z22.union([z22.string(), z22.number(), z22.boolean()]).nullable();
|
|
7284
|
+
var RuleSubjectSchema = z22.object({
|
|
7285
|
+
kind: z22.literal("object"),
|
|
7286
|
+
objectTypeId: z22.string()
|
|
7287
|
+
});
|
|
7288
|
+
var RuleEventSubjectSchema = z22.object({
|
|
7289
|
+
kind: z22.literal("object"),
|
|
7290
|
+
objectTypeId: z22.string(),
|
|
7291
|
+
primaryId: z22.string()
|
|
7292
|
+
});
|
|
7293
|
+
var RulePropertyPredicateSchema = z22.object({
|
|
7294
|
+
kind: z22.literal("property"),
|
|
7295
|
+
propertyId: z22.string(),
|
|
7296
|
+
op: z22.enum(["eq", "notEq", "gt", "gte", "lt", "lte", "isPresent", "isMissing"]),
|
|
7108
7297
|
value: RuleValueSchema.optional()
|
|
7109
7298
|
});
|
|
7110
|
-
var RuleLinkPredicateSchema =
|
|
7111
|
-
kind:
|
|
7112
|
-
linkId:
|
|
7113
|
-
op:
|
|
7299
|
+
var RuleLinkPredicateSchema = z22.object({
|
|
7300
|
+
kind: z22.literal("link"),
|
|
7301
|
+
linkId: z22.string(),
|
|
7302
|
+
op: z22.enum(["exists", "isMissing"])
|
|
7114
7303
|
});
|
|
7115
7304
|
function createRulePredicateSchema(childPredicateSchema) {
|
|
7116
|
-
return
|
|
7117
|
-
|
|
7118
|
-
kind:
|
|
7119
|
-
predicates:
|
|
7305
|
+
return z22.union([
|
|
7306
|
+
z22.object({
|
|
7307
|
+
kind: z22.literal("all"),
|
|
7308
|
+
predicates: z22.array(childPredicateSchema)
|
|
7120
7309
|
}),
|
|
7121
|
-
|
|
7122
|
-
kind:
|
|
7123
|
-
predicates:
|
|
7310
|
+
z22.object({
|
|
7311
|
+
kind: z22.literal("any"),
|
|
7312
|
+
predicates: z22.array(childPredicateSchema)
|
|
7124
7313
|
}),
|
|
7125
|
-
|
|
7126
|
-
kind:
|
|
7314
|
+
z22.object({
|
|
7315
|
+
kind: z22.literal("not"),
|
|
7127
7316
|
predicate: childPredicateSchema
|
|
7128
7317
|
}),
|
|
7129
7318
|
RulePropertyPredicateSchema,
|
|
7130
7319
|
RuleLinkPredicateSchema
|
|
7131
7320
|
]);
|
|
7132
7321
|
}
|
|
7133
|
-
var DeepRulePredicateSchema = createRulePredicateSchema(
|
|
7322
|
+
var DeepRulePredicateSchema = createRulePredicateSchema(z22.unknown());
|
|
7134
7323
|
var NestedRulePredicateSchema = createRulePredicateSchema(DeepRulePredicateSchema);
|
|
7135
7324
|
var RulePredicateSchema = NestedRulePredicateSchema;
|
|
7136
|
-
var RuleEventDependencySchema =
|
|
7137
|
-
|
|
7138
|
-
type:
|
|
7139
|
-
objectTypeId:
|
|
7325
|
+
var RuleEventDependencySchema = z22.union([
|
|
7326
|
+
z22.object({
|
|
7327
|
+
type: z22.enum(["object.created", "object.updated", "object.deleted"]),
|
|
7328
|
+
objectTypeId: z22.string()
|
|
7140
7329
|
}),
|
|
7141
|
-
|
|
7142
|
-
type:
|
|
7143
|
-
sourceTypeId:
|
|
7144
|
-
linkId:
|
|
7330
|
+
z22.object({
|
|
7331
|
+
type: z22.enum(["link.created", "link.updated", "link.deleted"]),
|
|
7332
|
+
sourceTypeId: z22.string(),
|
|
7333
|
+
linkId: z22.string()
|
|
7145
7334
|
})
|
|
7146
7335
|
]);
|
|
7147
|
-
var RuleSchema =
|
|
7148
|
-
kind:
|
|
7149
|
-
id:
|
|
7336
|
+
var RuleSchema = z22.object({
|
|
7337
|
+
kind: z22.literal("rule"),
|
|
7338
|
+
id: z22.string(),
|
|
7150
7339
|
subject: RuleSubjectSchema,
|
|
7151
7340
|
predicate: RulePredicateSchema,
|
|
7152
|
-
dependencies:
|
|
7341
|
+
dependencies: z22.array(RuleEventDependencySchema)
|
|
7153
7342
|
});
|
|
7154
|
-
var RuleStateSchema =
|
|
7155
|
-
projectId:
|
|
7156
|
-
ruleId:
|
|
7343
|
+
var RuleStateSchema = z22.object({
|
|
7344
|
+
projectId: z22.string(),
|
|
7345
|
+
ruleId: z22.string(),
|
|
7157
7346
|
subject: RuleEventSubjectSchema,
|
|
7158
|
-
triggeredAt:
|
|
7347
|
+
triggeredAt: z22.string()
|
|
7159
7348
|
});
|
|
7160
|
-
var RuleStateListResponseSchema =
|
|
7161
|
-
states:
|
|
7162
|
-
hasMore:
|
|
7163
|
-
total:
|
|
7349
|
+
var RuleStateListResponseSchema = z22.object({
|
|
7350
|
+
states: z22.array(RuleStateSchema),
|
|
7351
|
+
hasMore: z22.boolean(),
|
|
7352
|
+
total: z22.number()
|
|
7164
7353
|
});
|
|
7165
7354
|
|
|
7166
7355
|
// src/routes/rules.ts
|
|
@@ -7240,44 +7429,44 @@ function registerRuleRoutes(app, host) {
|
|
|
7240
7429
|
}
|
|
7241
7430
|
|
|
7242
7431
|
// src/schemas/status.ts
|
|
7243
|
-
import { z as
|
|
7244
|
-
var HealthResponseSchema =
|
|
7245
|
-
var StorageReadinessSchema =
|
|
7246
|
-
reachable:
|
|
7247
|
-
schemaValid:
|
|
7432
|
+
import { z as z23 } from "zod";
|
|
7433
|
+
var HealthResponseSchema = z23.object({ status: z23.literal("ok") });
|
|
7434
|
+
var StorageReadinessSchema = z23.object({
|
|
7435
|
+
reachable: z23.boolean(),
|
|
7436
|
+
schemaValid: z23.boolean()
|
|
7248
7437
|
});
|
|
7249
|
-
var ReadinessResponseSchema =
|
|
7250
|
-
status:
|
|
7438
|
+
var ReadinessResponseSchema = z23.object({
|
|
7439
|
+
status: z23.enum(["ready", "unready"]),
|
|
7251
7440
|
storage: StorageReadinessSchema,
|
|
7252
|
-
reason:
|
|
7253
|
-
});
|
|
7254
|
-
var MaintenanceSummarySchema =
|
|
7255
|
-
running:
|
|
7256
|
-
intervalMs:
|
|
7257
|
-
lastStartedAt:
|
|
7258
|
-
lastCompletedAt:
|
|
7259
|
-
lastDurationMs:
|
|
7260
|
-
consecutiveFailures:
|
|
7261
|
-
lastError:
|
|
7262
|
-
outbox:
|
|
7263
|
-
pendingCount:
|
|
7264
|
-
oldestPendingAt:
|
|
7265
|
-
retryingCount:
|
|
7266
|
-
maxAttempts:
|
|
7441
|
+
reason: z23.string().optional()
|
|
7442
|
+
});
|
|
7443
|
+
var MaintenanceSummarySchema = z23.object({
|
|
7444
|
+
running: z23.boolean(),
|
|
7445
|
+
intervalMs: z23.number().int().positive(),
|
|
7446
|
+
lastStartedAt: z23.string().nullable(),
|
|
7447
|
+
lastCompletedAt: z23.string().nullable(),
|
|
7448
|
+
lastDurationMs: z23.number().nonnegative().nullable(),
|
|
7449
|
+
consecutiveFailures: z23.number().int().nonnegative(),
|
|
7450
|
+
lastError: z23.string().nullable(),
|
|
7451
|
+
outbox: z23.object({
|
|
7452
|
+
pendingCount: z23.number().int().nonnegative(),
|
|
7453
|
+
oldestPendingAt: z23.string().nullable(),
|
|
7454
|
+
retryingCount: z23.number().int().nonnegative(),
|
|
7455
|
+
maxAttempts: z23.number().int().nonnegative()
|
|
7267
7456
|
}).nullable(),
|
|
7268
|
-
terminalSources:
|
|
7269
|
-
count:
|
|
7270
|
-
oldestTerminalAt:
|
|
7457
|
+
terminalSources: z23.object({
|
|
7458
|
+
count: z23.number().int().nonnegative(),
|
|
7459
|
+
oldestTerminalAt: z23.string().nullable()
|
|
7271
7460
|
}).nullable(),
|
|
7272
|
-
cleanup:
|
|
7273
|
-
publishedOutboxRowsDeleted:
|
|
7274
|
-
terminalSourceRowsDeleted:
|
|
7275
|
-
terminalSourceMaterializationsDeleted:
|
|
7461
|
+
cleanup: z23.object({
|
|
7462
|
+
publishedOutboxRowsDeleted: z23.number().int().nonnegative(),
|
|
7463
|
+
terminalSourceRowsDeleted: z23.number().int().nonnegative(),
|
|
7464
|
+
terminalSourceMaterializationsDeleted: z23.number().int().nonnegative()
|
|
7276
7465
|
}).nullable()
|
|
7277
7466
|
});
|
|
7278
|
-
var StatusResponseSchema =
|
|
7279
|
-
status:
|
|
7280
|
-
objectTypes:
|
|
7467
|
+
var StatusResponseSchema = z23.object({
|
|
7468
|
+
status: z23.enum(["ok", "degraded"]),
|
|
7469
|
+
objectTypes: z23.number().int().nonnegative(),
|
|
7281
7470
|
maintenance: MaintenanceSummarySchema
|
|
7282
7471
|
});
|
|
7283
7472
|
|
|
@@ -7323,74 +7512,74 @@ function registerStatusRoutes(app, host) {
|
|
|
7323
7512
|
import {
|
|
7324
7513
|
SYNC_RUN_FAILURE_CODES
|
|
7325
7514
|
} from "@sixb/core/storage";
|
|
7326
|
-
import { z as
|
|
7515
|
+
import { z as z24 } from "zod";
|
|
7327
7516
|
var SyncRunFailureSchema = sixbFailureSchema(SYNC_RUN_FAILURE_CODES);
|
|
7328
|
-
var SyncParamsSchema =
|
|
7329
|
-
syncId:
|
|
7330
|
-
});
|
|
7331
|
-
var SyncRunStatusSchema =
|
|
7332
|
-
var SyncModeSchema =
|
|
7333
|
-
var SyncRunsQuerySchema =
|
|
7334
|
-
syncId:
|
|
7335
|
-
datasetId:
|
|
7517
|
+
var SyncParamsSchema = z24.object({
|
|
7518
|
+
syncId: z24.string().min(1)
|
|
7519
|
+
});
|
|
7520
|
+
var SyncRunStatusSchema = z24.enum(["queued", "running", "succeeded", "failed", "cancelled"]);
|
|
7521
|
+
var SyncModeSchema = z24.enum(["snapshot", "append", "merge"]);
|
|
7522
|
+
var SyncRunsQuerySchema = z24.object({
|
|
7523
|
+
syncId: z24.string().optional(),
|
|
7524
|
+
datasetId: z24.string().optional(),
|
|
7336
7525
|
status: SyncRunStatusSchema.optional(),
|
|
7337
|
-
startedAfter:
|
|
7338
|
-
startedBefore:
|
|
7339
|
-
limit:
|
|
7340
|
-
offset:
|
|
7341
|
-
order:
|
|
7342
|
-
});
|
|
7343
|
-
var RequestSyncRunBodySchema =
|
|
7344
|
-
expectedLatestVersionId:
|
|
7345
|
-
commitMessage:
|
|
7346
|
-
});
|
|
7347
|
-
var SyncTriggerSchema =
|
|
7348
|
-
type:
|
|
7349
|
-
scheduleId:
|
|
7350
|
-
});
|
|
7351
|
-
var SyncRunSchema =
|
|
7352
|
-
id:
|
|
7353
|
-
projectId:
|
|
7354
|
-
syncId:
|
|
7355
|
-
datasetId:
|
|
7526
|
+
startedAfter: z24.string().optional(),
|
|
7527
|
+
startedBefore: z24.string().optional(),
|
|
7528
|
+
limit: z24.string().optional(),
|
|
7529
|
+
offset: z24.string().optional(),
|
|
7530
|
+
order: z24.enum(["asc", "desc"]).optional()
|
|
7531
|
+
});
|
|
7532
|
+
var RequestSyncRunBodySchema = z24.object({
|
|
7533
|
+
expectedLatestVersionId: z24.string().optional(),
|
|
7534
|
+
commitMessage: z24.string().optional()
|
|
7535
|
+
});
|
|
7536
|
+
var SyncTriggerSchema = z24.object({
|
|
7537
|
+
type: z24.literal("schedule"),
|
|
7538
|
+
scheduleId: z24.string()
|
|
7539
|
+
});
|
|
7540
|
+
var SyncRunSchema = z24.object({
|
|
7541
|
+
id: z24.string(),
|
|
7542
|
+
projectId: z24.string(),
|
|
7543
|
+
syncId: z24.string(),
|
|
7544
|
+
datasetId: z24.string(),
|
|
7356
7545
|
mode: SyncModeSchema,
|
|
7357
7546
|
status: SyncRunStatusSchema,
|
|
7358
|
-
queuedAt:
|
|
7359
|
-
startedAt:
|
|
7360
|
-
finishedAt:
|
|
7361
|
-
rowsRead:
|
|
7362
|
-
output:
|
|
7363
|
-
datasetId:
|
|
7364
|
-
versionId:
|
|
7547
|
+
queuedAt: z24.string(),
|
|
7548
|
+
startedAt: z24.string().optional(),
|
|
7549
|
+
finishedAt: z24.string().optional(),
|
|
7550
|
+
rowsRead: z24.number().optional(),
|
|
7551
|
+
output: z24.object({
|
|
7552
|
+
datasetId: z24.string(),
|
|
7553
|
+
versionId: z24.string()
|
|
7365
7554
|
}).optional(),
|
|
7366
|
-
expectedLatestVersionId:
|
|
7367
|
-
commitMessage:
|
|
7555
|
+
expectedLatestVersionId: z24.string().optional(),
|
|
7556
|
+
commitMessage: z24.string().optional(),
|
|
7368
7557
|
error: SyncRunFailureSchema.optional()
|
|
7369
7558
|
});
|
|
7370
|
-
var SyncSchema =
|
|
7371
|
-
id:
|
|
7559
|
+
var SyncSchema = z24.object({
|
|
7560
|
+
id: z24.string(),
|
|
7372
7561
|
mode: SyncModeSchema,
|
|
7373
|
-
connector:
|
|
7374
|
-
id:
|
|
7375
|
-
type:
|
|
7562
|
+
connector: z24.object({
|
|
7563
|
+
id: z24.string(),
|
|
7564
|
+
type: z24.string()
|
|
7376
7565
|
}),
|
|
7377
|
-
target:
|
|
7378
|
-
kind:
|
|
7566
|
+
target: z24.object({
|
|
7567
|
+
kind: z24.literal("dataset"),
|
|
7379
7568
|
dataset: DatasetDefinitionSchema
|
|
7380
7569
|
}),
|
|
7381
|
-
triggers:
|
|
7570
|
+
triggers: z24.array(SyncTriggerSchema),
|
|
7382
7571
|
latestRun: SyncRunSchema.nullable()
|
|
7383
7572
|
});
|
|
7384
|
-
var SyncRunListResponseSchema =
|
|
7385
|
-
runs:
|
|
7386
|
-
hasMore:
|
|
7387
|
-
total:
|
|
7573
|
+
var SyncRunListResponseSchema = z24.object({
|
|
7574
|
+
runs: z24.array(SyncRunSchema),
|
|
7575
|
+
hasMore: z24.boolean(),
|
|
7576
|
+
total: z24.number()
|
|
7388
7577
|
});
|
|
7389
|
-
var RequestSyncRunResponseSchema =
|
|
7390
|
-
runId:
|
|
7391
|
-
jobId:
|
|
7392
|
-
syncId:
|
|
7393
|
-
queuedAt:
|
|
7578
|
+
var RequestSyncRunResponseSchema = z24.object({
|
|
7579
|
+
runId: z24.string(),
|
|
7580
|
+
jobId: z24.string(),
|
|
7581
|
+
syncId: z24.string(),
|
|
7582
|
+
queuedAt: z24.string()
|
|
7394
7583
|
});
|
|
7395
7584
|
|
|
7396
7585
|
// src/routes/syncs.ts
|
|
@@ -7544,52 +7733,52 @@ function registerSyncRoutes(app, host) {
|
|
|
7544
7733
|
}
|
|
7545
7734
|
|
|
7546
7735
|
// src/schemas/telemetry.ts
|
|
7547
|
-
import { z as
|
|
7548
|
-
var TelemetryParamsSchema =
|
|
7549
|
-
objectTypeId:
|
|
7550
|
-
objectId:
|
|
7551
|
-
propertyId:
|
|
7552
|
-
});
|
|
7553
|
-
var TelemetryHistoryQuerySchema =
|
|
7554
|
-
from:
|
|
7555
|
-
to:
|
|
7556
|
-
limit:
|
|
7557
|
-
order:
|
|
7736
|
+
import { z as z25 } from "zod";
|
|
7737
|
+
var TelemetryParamsSchema = z25.object({
|
|
7738
|
+
objectTypeId: z25.string().min(1),
|
|
7739
|
+
objectId: z25.string().min(1),
|
|
7740
|
+
propertyId: z25.string().min(1)
|
|
7741
|
+
});
|
|
7742
|
+
var TelemetryHistoryQuerySchema = z25.object({
|
|
7743
|
+
from: z25.string().optional(),
|
|
7744
|
+
to: z25.string().optional(),
|
|
7745
|
+
limit: z25.string().optional(),
|
|
7746
|
+
order: z25.enum(["asc", "desc"]).optional()
|
|
7558
7747
|
});
|
|
7559
|
-
var BulkTelemetryHistorySeriesInputSchema =
|
|
7560
|
-
objectTypeId:
|
|
7561
|
-
objectId:
|
|
7562
|
-
propertyId:
|
|
7748
|
+
var BulkTelemetryHistorySeriesInputSchema = z25.object({
|
|
7749
|
+
objectTypeId: z25.string().min(1),
|
|
7750
|
+
objectId: z25.string().min(1),
|
|
7751
|
+
propertyId: z25.string().min(1)
|
|
7563
7752
|
}).strict();
|
|
7564
|
-
var BulkTelemetryHistoryBodySchema =
|
|
7565
|
-
series:
|
|
7566
|
-
from:
|
|
7567
|
-
to:
|
|
7568
|
-
limitPerSeries:
|
|
7569
|
-
order:
|
|
7753
|
+
var BulkTelemetryHistoryBodySchema = z25.object({
|
|
7754
|
+
series: z25.array(BulkTelemetryHistorySeriesInputSchema).min(1),
|
|
7755
|
+
from: z25.string().optional(),
|
|
7756
|
+
to: z25.string().optional(),
|
|
7757
|
+
limitPerSeries: z25.number().int().nonnegative().optional(),
|
|
7758
|
+
order: z25.enum(["asc", "desc"]).optional()
|
|
7570
7759
|
}).strict();
|
|
7571
|
-
var AppendTelemetryBodySchema =
|
|
7572
|
-
value:
|
|
7573
|
-
unit:
|
|
7574
|
-
at:
|
|
7760
|
+
var AppendTelemetryBodySchema = z25.object({
|
|
7761
|
+
value: z25.unknown(),
|
|
7762
|
+
unit: z25.string().optional(),
|
|
7763
|
+
at: z25.string().optional()
|
|
7575
7764
|
});
|
|
7576
|
-
var TelemetryPointSchema =
|
|
7577
|
-
projectId:
|
|
7578
|
-
objectTypeId:
|
|
7579
|
-
objectId:
|
|
7580
|
-
propertyId:
|
|
7581
|
-
value:
|
|
7582
|
-
unit:
|
|
7583
|
-
at:
|
|
7584
|
-
});
|
|
7585
|
-
var BulkTelemetryHistorySeriesSchema =
|
|
7586
|
-
objectTypeId:
|
|
7587
|
-
objectId:
|
|
7588
|
-
propertyId:
|
|
7589
|
-
points:
|
|
7590
|
-
});
|
|
7591
|
-
var BulkTelemetryHistoryResponseSchema =
|
|
7592
|
-
series:
|
|
7765
|
+
var TelemetryPointSchema = z25.object({
|
|
7766
|
+
projectId: z25.string(),
|
|
7767
|
+
objectTypeId: z25.string(),
|
|
7768
|
+
objectId: z25.string(),
|
|
7769
|
+
propertyId: z25.string(),
|
|
7770
|
+
value: z25.unknown(),
|
|
7771
|
+
unit: z25.string().optional(),
|
|
7772
|
+
at: z25.string()
|
|
7773
|
+
});
|
|
7774
|
+
var BulkTelemetryHistorySeriesSchema = z25.object({
|
|
7775
|
+
objectTypeId: z25.string(),
|
|
7776
|
+
objectId: z25.string(),
|
|
7777
|
+
propertyId: z25.string(),
|
|
7778
|
+
points: z25.array(TelemetryPointSchema)
|
|
7779
|
+
});
|
|
7780
|
+
var BulkTelemetryHistoryResponseSchema = z25.object({
|
|
7781
|
+
series: z25.array(BulkTelemetryHistorySeriesSchema)
|
|
7593
7782
|
});
|
|
7594
7783
|
|
|
7595
7784
|
// src/routes/telemetry.ts
|
|
@@ -7747,40 +7936,40 @@ function registerTelemetryRoutes(app, _host) {
|
|
|
7747
7936
|
|
|
7748
7937
|
// src/schemas/webhook-runs.ts
|
|
7749
7938
|
import { WEBHOOK_RUN_FAILURE_CODES } from "@sixb/core/storage";
|
|
7750
|
-
import { z as
|
|
7939
|
+
import { z as z26 } from "zod";
|
|
7751
7940
|
var WebhookRunFailureSchema = sixbFailureSchema(WEBHOOK_RUN_FAILURE_CODES);
|
|
7752
|
-
var WebhookRunStatusSchema =
|
|
7753
|
-
var WebhookRunsQuerySchema =
|
|
7754
|
-
connectorId:
|
|
7755
|
-
webhookId:
|
|
7941
|
+
var WebhookRunStatusSchema = z26.enum(["running", "succeeded", "failed"]);
|
|
7942
|
+
var WebhookRunsQuerySchema = z26.object({
|
|
7943
|
+
connectorId: z26.string().optional(),
|
|
7944
|
+
webhookId: z26.string().optional(),
|
|
7756
7945
|
status: WebhookRunStatusSchema.optional(),
|
|
7757
|
-
idempotencyKey:
|
|
7758
|
-
startedAfter:
|
|
7759
|
-
startedBefore:
|
|
7760
|
-
limit:
|
|
7761
|
-
offset:
|
|
7762
|
-
order:
|
|
7946
|
+
idempotencyKey: z26.string().optional(),
|
|
7947
|
+
startedAfter: z26.string().optional(),
|
|
7948
|
+
startedBefore: z26.string().optional(),
|
|
7949
|
+
limit: z26.string().optional(),
|
|
7950
|
+
offset: z26.string().optional(),
|
|
7951
|
+
order: z26.enum(["asc", "desc"]).optional()
|
|
7763
7952
|
});
|
|
7764
|
-
var WebhookRunSchema =
|
|
7765
|
-
id:
|
|
7766
|
-
projectId:
|
|
7767
|
-
executionId:
|
|
7768
|
-
connectorId:
|
|
7769
|
-
webhookId:
|
|
7953
|
+
var WebhookRunSchema = z26.object({
|
|
7954
|
+
id: z26.string(),
|
|
7955
|
+
projectId: z26.string(),
|
|
7956
|
+
executionId: z26.string(),
|
|
7957
|
+
connectorId: z26.string(),
|
|
7958
|
+
webhookId: z26.string(),
|
|
7770
7959
|
status: WebhookRunStatusSchema,
|
|
7771
|
-
method:
|
|
7772
|
-
route:
|
|
7773
|
-
startedAt:
|
|
7774
|
-
finishedAt:
|
|
7775
|
-
requestBodyBytes:
|
|
7776
|
-
responseStatus:
|
|
7777
|
-
idempotencyKey:
|
|
7960
|
+
method: z26.string(),
|
|
7961
|
+
route: z26.string(),
|
|
7962
|
+
startedAt: z26.string(),
|
|
7963
|
+
finishedAt: z26.string().optional(),
|
|
7964
|
+
requestBodyBytes: z26.number(),
|
|
7965
|
+
responseStatus: z26.number().optional(),
|
|
7966
|
+
idempotencyKey: z26.string().optional(),
|
|
7778
7967
|
error: WebhookRunFailureSchema.optional()
|
|
7779
7968
|
});
|
|
7780
|
-
var WebhookRunListResponseSchema =
|
|
7781
|
-
runs:
|
|
7782
|
-
hasMore:
|
|
7783
|
-
total:
|
|
7969
|
+
var WebhookRunListResponseSchema = z26.object({
|
|
7970
|
+
runs: z26.array(WebhookRunSchema),
|
|
7971
|
+
hasMore: z26.boolean(),
|
|
7972
|
+
total: z26.number()
|
|
7784
7973
|
});
|
|
7785
7974
|
|
|
7786
7975
|
// src/routes/webhook-runs.ts
|
|
@@ -7855,25 +8044,25 @@ import {
|
|
|
7855
8044
|
snapshotWorkflowInterventionResponse
|
|
7856
8045
|
} from "@sixb/core/internal/workflows";
|
|
7857
8046
|
import { AGENT_RUN_FAILURE_CODES as AGENT_RUN_FAILURE_CODES2, WORKFLOW_RUN_FAILURE_CODES as WORKFLOW_RUN_FAILURE_CODES2 } from "@sixb/core/storage";
|
|
7858
|
-
import { z as
|
|
8047
|
+
import { z as z28 } from "zod";
|
|
7859
8048
|
|
|
7860
8049
|
// src/schemas/workflows.ts
|
|
7861
8050
|
import {
|
|
7862
8051
|
WORKFLOW_RUN_FAILURE_CODES
|
|
7863
8052
|
} from "@sixb/core/storage";
|
|
7864
|
-
import { z as
|
|
7865
|
-
var WorkflowIOSnapshotSchema =
|
|
8053
|
+
import { z as z27 } from "zod";
|
|
8054
|
+
var WorkflowIOSnapshotSchema = z27.record(JsonValueSchema);
|
|
7866
8055
|
var WorkflowRunFailureSchema = sixbFailureSchema(WORKFLOW_RUN_FAILURE_CODES);
|
|
7867
|
-
var WorkflowParamsSchema =
|
|
7868
|
-
workflowId:
|
|
8056
|
+
var WorkflowParamsSchema = z27.object({
|
|
8057
|
+
workflowId: z27.string().min(1)
|
|
7869
8058
|
});
|
|
7870
|
-
var WorkflowRunParamsSchema =
|
|
7871
|
-
runId:
|
|
8059
|
+
var WorkflowRunParamsSchema = z27.object({
|
|
8060
|
+
runId: z27.string().min(1)
|
|
7872
8061
|
});
|
|
7873
|
-
var WorkflowInterventionParamsSchema =
|
|
7874
|
-
interventionId:
|
|
8062
|
+
var WorkflowInterventionParamsSchema = z27.object({
|
|
8063
|
+
interventionId: z27.string().min(1)
|
|
7875
8064
|
});
|
|
7876
|
-
var WorkflowRunStatusSchema =
|
|
8065
|
+
var WorkflowRunStatusSchema = z27.enum([
|
|
7877
8066
|
"queued",
|
|
7878
8067
|
"running",
|
|
7879
8068
|
"waiting",
|
|
@@ -7881,91 +8070,91 @@ var WorkflowRunStatusSchema = z26.enum([
|
|
|
7881
8070
|
"failed",
|
|
7882
8071
|
"cancelled"
|
|
7883
8072
|
]);
|
|
7884
|
-
var WorkflowInterventionStatusSchema =
|
|
8073
|
+
var WorkflowInterventionStatusSchema = z27.enum([
|
|
7885
8074
|
"pending",
|
|
7886
8075
|
"submitted",
|
|
7887
8076
|
"cancelled",
|
|
7888
8077
|
"expired"
|
|
7889
8078
|
]);
|
|
7890
|
-
var WorkflowRunsQuerySchema =
|
|
7891
|
-
workflowId:
|
|
8079
|
+
var WorkflowRunsQuerySchema = z27.object({
|
|
8080
|
+
workflowId: z27.string().optional(),
|
|
7892
8081
|
status: WorkflowRunStatusSchema.optional(),
|
|
7893
|
-
startedAfter:
|
|
7894
|
-
startedBefore:
|
|
7895
|
-
limit:
|
|
7896
|
-
offset:
|
|
7897
|
-
order:
|
|
7898
|
-
});
|
|
7899
|
-
var WorkflowInterventionsQuerySchema =
|
|
7900
|
-
workflowId:
|
|
7901
|
-
workflowRunId:
|
|
7902
|
-
nodeRunId:
|
|
7903
|
-
nodeId:
|
|
7904
|
-
nodeKey:
|
|
7905
|
-
interventionId:
|
|
8082
|
+
startedAfter: z27.string().optional(),
|
|
8083
|
+
startedBefore: z27.string().optional(),
|
|
8084
|
+
limit: z27.string().optional(),
|
|
8085
|
+
offset: z27.string().optional(),
|
|
8086
|
+
order: z27.enum(["asc", "desc"]).optional()
|
|
8087
|
+
});
|
|
8088
|
+
var WorkflowInterventionsQuerySchema = z27.object({
|
|
8089
|
+
workflowId: z27.string().optional(),
|
|
8090
|
+
workflowRunId: z27.string().optional(),
|
|
8091
|
+
nodeRunId: z27.string().optional(),
|
|
8092
|
+
nodeId: z27.string().optional(),
|
|
8093
|
+
nodeKey: z27.string().optional(),
|
|
8094
|
+
interventionId: z27.string().optional(),
|
|
7906
8095
|
status: WorkflowInterventionStatusSchema.optional(),
|
|
7907
|
-
requestedAfter:
|
|
7908
|
-
requestedBefore:
|
|
7909
|
-
limit:
|
|
7910
|
-
offset:
|
|
7911
|
-
order:
|
|
8096
|
+
requestedAfter: z27.string().optional(),
|
|
8097
|
+
requestedBefore: z27.string().optional(),
|
|
8098
|
+
limit: z27.string().optional(),
|
|
8099
|
+
offset: z27.string().optional(),
|
|
8100
|
+
order: z27.enum(["asc", "desc"]).optional()
|
|
7912
8101
|
});
|
|
7913
|
-
var RequestWorkflowRunBodySchema =
|
|
8102
|
+
var RequestWorkflowRunBodySchema = z27.object({
|
|
7914
8103
|
input: WorkflowIOSnapshotSchema.optional()
|
|
7915
8104
|
}).default({});
|
|
7916
|
-
var WorkflowInterventionActorSchema =
|
|
7917
|
-
principalType:
|
|
7918
|
-
principalId:
|
|
8105
|
+
var WorkflowInterventionActorSchema = z27.object({
|
|
8106
|
+
principalType: z27.enum(["user", "serviceAccount", "system"]),
|
|
8107
|
+
principalId: z27.string().min(1)
|
|
7919
8108
|
});
|
|
7920
|
-
var CancelWorkflowRunBodySchema =
|
|
7921
|
-
var SubmitWorkflowInterventionBodySchema =
|
|
8109
|
+
var CancelWorkflowRunBodySchema = z27.object({}).default({});
|
|
8110
|
+
var SubmitWorkflowInterventionBodySchema = z27.object({
|
|
7922
8111
|
response: WorkflowIOSnapshotSchema
|
|
7923
8112
|
});
|
|
7924
|
-
var CancelWorkflowInterventionBodySchema =
|
|
7925
|
-
var WorkflowTriggerSchema =
|
|
7926
|
-
type:
|
|
7927
|
-
scheduleId:
|
|
8113
|
+
var CancelWorkflowInterventionBodySchema = z27.object({}).default({});
|
|
8114
|
+
var WorkflowTriggerSchema = z27.object({
|
|
8115
|
+
type: z27.literal("schedule"),
|
|
8116
|
+
scheduleId: z27.string()
|
|
7928
8117
|
});
|
|
7929
|
-
var WorkflowNodeSchema =
|
|
7930
|
-
|
|
7931
|
-
type:
|
|
7932
|
-
id:
|
|
7933
|
-
key:
|
|
8118
|
+
var WorkflowNodeSchema = z27.union([
|
|
8119
|
+
z27.object({
|
|
8120
|
+
type: z27.literal("step"),
|
|
8121
|
+
id: z27.string(),
|
|
8122
|
+
key: z27.string(),
|
|
7934
8123
|
input: WorkflowIOSnapshotSchema,
|
|
7935
8124
|
output: WorkflowIOSnapshotSchema
|
|
7936
8125
|
}),
|
|
7937
|
-
|
|
7938
|
-
type:
|
|
7939
|
-
id:
|
|
7940
|
-
key:
|
|
7941
|
-
objectTypeId:
|
|
8126
|
+
z27.object({
|
|
8127
|
+
type: z27.literal("action"),
|
|
8128
|
+
id: z27.string(),
|
|
8129
|
+
key: z27.string(),
|
|
8130
|
+
objectTypeId: z27.string().optional(),
|
|
7942
8131
|
params: WorkflowIOSnapshotSchema
|
|
7943
8132
|
}),
|
|
7944
|
-
|
|
7945
|
-
type:
|
|
7946
|
-
id:
|
|
7947
|
-
key:
|
|
8133
|
+
z27.object({
|
|
8134
|
+
type: z27.literal("intervention"),
|
|
8135
|
+
id: z27.string(),
|
|
8136
|
+
key: z27.string(),
|
|
7948
8137
|
input: WorkflowIOSnapshotSchema,
|
|
7949
8138
|
response: WorkflowIOSnapshotSchema,
|
|
7950
|
-
description:
|
|
8139
|
+
description: z27.string().optional()
|
|
7951
8140
|
}),
|
|
7952
|
-
|
|
7953
|
-
type:
|
|
7954
|
-
id:
|
|
7955
|
-
key:
|
|
7956
|
-
agentId:
|
|
8141
|
+
z27.object({
|
|
8142
|
+
type: z27.literal("agent"),
|
|
8143
|
+
id: z27.string(),
|
|
8144
|
+
key: z27.string(),
|
|
8145
|
+
agentId: z27.string(),
|
|
7957
8146
|
input: WorkflowIOSnapshotSchema,
|
|
7958
8147
|
output: WorkflowIOSnapshotSchema
|
|
7959
8148
|
})
|
|
7960
8149
|
]);
|
|
7961
|
-
var WorkflowRunSummarySchema =
|
|
7962
|
-
id:
|
|
7963
|
-
projectId:
|
|
7964
|
-
workflowId:
|
|
8150
|
+
var WorkflowRunSummarySchema = z27.object({
|
|
8151
|
+
id: z27.string(),
|
|
8152
|
+
projectId: z27.string(),
|
|
8153
|
+
workflowId: z27.string(),
|
|
7965
8154
|
status: WorkflowRunStatusSchema,
|
|
7966
|
-
queuedAt:
|
|
7967
|
-
startedAt:
|
|
7968
|
-
finishedAt:
|
|
8155
|
+
queuedAt: z27.string().optional(),
|
|
8156
|
+
startedAt: z27.string(),
|
|
8157
|
+
finishedAt: z27.string().optional(),
|
|
7969
8158
|
error: WorkflowRunFailureSchema.optional(),
|
|
7970
8159
|
requestedBy: WorkflowInterventionActorSchema
|
|
7971
8160
|
});
|
|
@@ -7973,111 +8162,111 @@ var WorkflowRunDetailSchema = WorkflowRunSummarySchema.extend({
|
|
|
7973
8162
|
input: WorkflowIOSnapshotSchema,
|
|
7974
8163
|
output: WorkflowIOSnapshotSchema.optional()
|
|
7975
8164
|
});
|
|
7976
|
-
var WorkflowAgentNodeExecutionSummarySchema =
|
|
7977
|
-
agentId:
|
|
7978
|
-
status:
|
|
7979
|
-
attempt:
|
|
7980
|
-
modelId:
|
|
7981
|
-
finishReason:
|
|
8165
|
+
var WorkflowAgentNodeExecutionSummarySchema = z27.object({
|
|
8166
|
+
agentId: z27.string(),
|
|
8167
|
+
status: z27.enum(["queued", "running", "succeeded", "failed", "cancelled"]),
|
|
8168
|
+
attempt: z27.number().int().nonnegative(),
|
|
8169
|
+
modelId: z27.string().optional(),
|
|
8170
|
+
finishReason: z27.string().optional(),
|
|
7982
8171
|
usage: AiUsageSummarySchema.optional(),
|
|
7983
8172
|
cost: AiCostSummarySchema.optional(),
|
|
7984
|
-
startedAt:
|
|
7985
|
-
completedAt:
|
|
8173
|
+
startedAt: z27.string().optional(),
|
|
8174
|
+
completedAt: z27.string().optional()
|
|
7986
8175
|
});
|
|
7987
|
-
var WorkflowAgentFailurePhaseSchema =
|
|
8176
|
+
var WorkflowAgentFailurePhaseSchema = z27.enum(["agent-loop", "structured-finalizer"]);
|
|
7988
8177
|
var WorkflowAgentNodeExecutionSchema = WorkflowAgentNodeExecutionSummarySchema.extend({
|
|
7989
|
-
nodeRunId:
|
|
7990
|
-
prompt:
|
|
7991
|
-
trace:
|
|
7992
|
-
diagnostics:
|
|
8178
|
+
nodeRunId: z27.string(),
|
|
8179
|
+
prompt: z27.string(),
|
|
8180
|
+
trace: z27.array(AgentMessagePartSchema).optional(),
|
|
8181
|
+
diagnostics: z27.array(JsonValueSchema).optional(),
|
|
7993
8182
|
failurePhase: WorkflowAgentFailurePhaseSchema.optional(),
|
|
7994
8183
|
error: AgentRunFailureSchema.optional(),
|
|
7995
|
-
createdAt:
|
|
7996
|
-
});
|
|
7997
|
-
var WorkflowNodeRunSchema =
|
|
7998
|
-
id:
|
|
7999
|
-
projectId:
|
|
8000
|
-
workflowRunId:
|
|
8001
|
-
workflowId:
|
|
8002
|
-
nodeIndex:
|
|
8003
|
-
nodeType:
|
|
8004
|
-
nodeId:
|
|
8005
|
-
nodeKey:
|
|
8006
|
-
status:
|
|
8184
|
+
createdAt: z27.string()
|
|
8185
|
+
});
|
|
8186
|
+
var WorkflowNodeRunSchema = z27.object({
|
|
8187
|
+
id: z27.string(),
|
|
8188
|
+
projectId: z27.string(),
|
|
8189
|
+
workflowRunId: z27.string(),
|
|
8190
|
+
workflowId: z27.string(),
|
|
8191
|
+
nodeIndex: z27.number(),
|
|
8192
|
+
nodeType: z27.enum(["step", "action", "intervention", "agent"]),
|
|
8193
|
+
nodeId: z27.string(),
|
|
8194
|
+
nodeKey: z27.string(),
|
|
8195
|
+
status: z27.enum(["running", "waiting", "succeeded", "failed", "cancelled"]),
|
|
8007
8196
|
input: WorkflowIOSnapshotSchema,
|
|
8008
|
-
startedAt:
|
|
8009
|
-
finishedAt:
|
|
8197
|
+
startedAt: z27.string(),
|
|
8198
|
+
finishedAt: z27.string().optional(),
|
|
8010
8199
|
output: WorkflowIOSnapshotSchema.optional(),
|
|
8011
8200
|
error: WorkflowRunFailureSchema.optional(),
|
|
8012
8201
|
agentExecution: WorkflowAgentNodeExecutionSummarySchema.optional()
|
|
8013
8202
|
});
|
|
8014
|
-
var WorkflowInterventionSchema =
|
|
8015
|
-
id:
|
|
8016
|
-
projectId:
|
|
8017
|
-
workflowId:
|
|
8018
|
-
workflowRunId:
|
|
8019
|
-
nodeRunId:
|
|
8020
|
-
nodeIndex:
|
|
8021
|
-
nodeId:
|
|
8022
|
-
nodeKey:
|
|
8023
|
-
interventionId:
|
|
8203
|
+
var WorkflowInterventionSchema = z27.object({
|
|
8204
|
+
id: z27.string(),
|
|
8205
|
+
projectId: z27.string(),
|
|
8206
|
+
workflowId: z27.string(),
|
|
8207
|
+
workflowRunId: z27.string(),
|
|
8208
|
+
nodeRunId: z27.string(),
|
|
8209
|
+
nodeIndex: z27.number(),
|
|
8210
|
+
nodeId: z27.string(),
|
|
8211
|
+
nodeKey: z27.string(),
|
|
8212
|
+
interventionId: z27.string(),
|
|
8024
8213
|
input: WorkflowIOSnapshotSchema,
|
|
8025
8214
|
defaultResponse: WorkflowIOSnapshotSchema,
|
|
8026
8215
|
status: WorkflowInterventionStatusSchema,
|
|
8027
|
-
requestedAt:
|
|
8028
|
-
expiresAt:
|
|
8029
|
-
submittedAt:
|
|
8216
|
+
requestedAt: z27.string(),
|
|
8217
|
+
expiresAt: z27.string().optional(),
|
|
8218
|
+
submittedAt: z27.string().optional(),
|
|
8030
8219
|
submittedBy: WorkflowInterventionActorSchema.optional(),
|
|
8031
8220
|
response: WorkflowIOSnapshotSchema.optional(),
|
|
8032
|
-
cancelledAt:
|
|
8221
|
+
cancelledAt: z27.string().optional(),
|
|
8033
8222
|
cancelledBy: WorkflowInterventionActorSchema.optional(),
|
|
8034
|
-
expiredAt:
|
|
8223
|
+
expiredAt: z27.string().optional()
|
|
8035
8224
|
});
|
|
8036
|
-
var WorkflowSchema =
|
|
8037
|
-
id:
|
|
8225
|
+
var WorkflowSchema = z27.object({
|
|
8226
|
+
id: z27.string(),
|
|
8038
8227
|
input: WorkflowIOSnapshotSchema,
|
|
8039
|
-
triggers:
|
|
8040
|
-
nodes:
|
|
8228
|
+
triggers: z27.array(WorkflowTriggerSchema),
|
|
8229
|
+
nodes: z27.array(WorkflowNodeSchema),
|
|
8041
8230
|
latestRun: WorkflowRunSummarySchema.nullable()
|
|
8042
8231
|
});
|
|
8043
|
-
var WorkflowRunListResponseSchema =
|
|
8044
|
-
runs:
|
|
8045
|
-
hasMore:
|
|
8046
|
-
total:
|
|
8232
|
+
var WorkflowRunListResponseSchema = z27.object({
|
|
8233
|
+
runs: z27.array(WorkflowRunSummarySchema),
|
|
8234
|
+
hasMore: z27.boolean(),
|
|
8235
|
+
total: z27.number()
|
|
8047
8236
|
});
|
|
8048
|
-
var WorkflowRunDetailResponseSchema =
|
|
8237
|
+
var WorkflowRunDetailResponseSchema = z27.object({
|
|
8049
8238
|
run: WorkflowRunDetailSchema,
|
|
8050
|
-
nodes:
|
|
8239
|
+
nodes: z27.array(WorkflowNodeRunSchema)
|
|
8051
8240
|
});
|
|
8052
8241
|
var CancelWorkflowRunResponseSchema = WorkflowRunDetailResponseSchema;
|
|
8053
|
-
var WorkflowInterventionListResponseSchema =
|
|
8054
|
-
interventions:
|
|
8055
|
-
hasMore:
|
|
8056
|
-
total:
|
|
8242
|
+
var WorkflowInterventionListResponseSchema = z27.object({
|
|
8243
|
+
interventions: z27.array(WorkflowInterventionSchema),
|
|
8244
|
+
hasMore: z27.boolean(),
|
|
8245
|
+
total: z27.number()
|
|
8057
8246
|
});
|
|
8058
|
-
var SubmitWorkflowInterventionResponseSchema =
|
|
8247
|
+
var SubmitWorkflowInterventionResponseSchema = z27.object({
|
|
8059
8248
|
intervention: WorkflowInterventionSchema,
|
|
8060
|
-
jobId:
|
|
8249
|
+
jobId: z27.string()
|
|
8061
8250
|
});
|
|
8062
|
-
var CancelWorkflowInterventionResponseSchema =
|
|
8251
|
+
var CancelWorkflowInterventionResponseSchema = z27.object({
|
|
8063
8252
|
intervention: WorkflowInterventionSchema
|
|
8064
8253
|
});
|
|
8065
|
-
var RequestWorkflowRunResponseSchema =
|
|
8066
|
-
runId:
|
|
8067
|
-
jobId:
|
|
8068
|
-
workflowId:
|
|
8069
|
-
queuedAt:
|
|
8254
|
+
var RequestWorkflowRunResponseSchema = z27.object({
|
|
8255
|
+
runId: z27.string(),
|
|
8256
|
+
jobId: z27.string(),
|
|
8257
|
+
workflowId: z27.string(),
|
|
8258
|
+
queuedAt: z27.string()
|
|
8070
8259
|
});
|
|
8071
8260
|
|
|
8072
8261
|
// src/routes/workflows.ts
|
|
8073
8262
|
var WorkflowRunFileContentQuerySchema = FileContentQuerySchema.extend({
|
|
8074
|
-
path:
|
|
8263
|
+
path: z28.string().min(1).regex(/^\/(?:input|output)(?:\/|$)/, "Workflow run file content paths must start with /input/ or /output/")
|
|
8075
8264
|
});
|
|
8076
8265
|
var WorkflowNodeFileContentQuerySchema = FileContentQuerySchema.extend({
|
|
8077
|
-
path:
|
|
8266
|
+
path: z28.string().min(1).regex(/^\/(?:input|output)(?:\/|$)/, "Workflow node file content paths must start with /input/ or /output/")
|
|
8078
8267
|
});
|
|
8079
8268
|
var WorkflowNodeFileContentParamsSchema = WorkflowRunParamsSchema.extend({
|
|
8080
|
-
nodeKey:
|
|
8269
|
+
nodeKey: z28.string().min(1)
|
|
8081
8270
|
});
|
|
8082
8271
|
function serializeWorkflowRunSummary(run) {
|
|
8083
8272
|
return {
|
|
@@ -9119,6 +9308,7 @@ function registerHttpRoutes(app, host, options) {
|
|
|
9119
9308
|
registerFileRoutes(app, host);
|
|
9120
9309
|
registerActionRunRoutes(app, host);
|
|
9121
9310
|
registerAgentRoutes(app, host);
|
|
9311
|
+
registerModelRoutes(app, host);
|
|
9122
9312
|
registerLinkRoutes(app, host);
|
|
9123
9313
|
registerTelemetryRoutes(app, host);
|
|
9124
9314
|
registerEventRoutes(app, host);
|
|
@@ -9280,269 +9470,269 @@ function notFoundResponse() {
|
|
|
9280
9470
|
}
|
|
9281
9471
|
|
|
9282
9472
|
// src/schemas/auth.ts
|
|
9283
|
-
import { z as
|
|
9284
|
-
var AuthInvitationStatusSchema =
|
|
9285
|
-
var AuthGroupOptionSchema =
|
|
9286
|
-
id:
|
|
9287
|
-
label:
|
|
9288
|
-
description:
|
|
9289
|
-
});
|
|
9290
|
-
var AuthInvitationSchema =
|
|
9291
|
-
id:
|
|
9292
|
-
email:
|
|
9293
|
-
groupIds:
|
|
9473
|
+
import { z as z29 } from "zod";
|
|
9474
|
+
var AuthInvitationStatusSchema = z29.enum(["pending", "accepted", "revoked"]);
|
|
9475
|
+
var AuthGroupOptionSchema = z29.object({
|
|
9476
|
+
id: z29.string(),
|
|
9477
|
+
label: z29.string().optional(),
|
|
9478
|
+
description: z29.string().optional()
|
|
9479
|
+
});
|
|
9480
|
+
var AuthInvitationSchema = z29.object({
|
|
9481
|
+
id: z29.string(),
|
|
9482
|
+
email: z29.string(),
|
|
9483
|
+
groupIds: z29.array(z29.string()),
|
|
9294
9484
|
status: AuthInvitationStatusSchema,
|
|
9295
|
-
createdAt:
|
|
9296
|
-
updatedAt:
|
|
9297
|
-
expiresAt:
|
|
9298
|
-
acceptedAt:
|
|
9299
|
-
revokedAt:
|
|
9485
|
+
createdAt: z29.string(),
|
|
9486
|
+
updatedAt: z29.string(),
|
|
9487
|
+
expiresAt: z29.string(),
|
|
9488
|
+
acceptedAt: z29.string().optional(),
|
|
9489
|
+
revokedAt: z29.string().optional()
|
|
9300
9490
|
});
|
|
9301
|
-
var AuthInvitationDeliverySchema =
|
|
9302
|
-
status:
|
|
9491
|
+
var AuthInvitationDeliverySchema = z29.object({
|
|
9492
|
+
status: z29.enum(["sent", "skipped", "rate_limited", "not_supported"])
|
|
9303
9493
|
});
|
|
9304
9494
|
var AuthInvitationGroupOptionSchema = AuthGroupOptionSchema;
|
|
9305
|
-
var AuthAccessTokenKindSchema =
|
|
9306
|
-
var AuthAccessTokenSubjectTypeSchema =
|
|
9307
|
-
var AuthAccessTokenStatusSchema =
|
|
9308
|
-
var AuthServiceAccountStatusSchema =
|
|
9309
|
-
var AuthUserStatusSchema =
|
|
9310
|
-
var AuthAccessTokenSchema =
|
|
9311
|
-
id:
|
|
9312
|
-
name:
|
|
9495
|
+
var AuthAccessTokenKindSchema = z29.enum(["personal", "serviceAccount"]);
|
|
9496
|
+
var AuthAccessTokenSubjectTypeSchema = z29.enum(["user", "serviceAccount"]);
|
|
9497
|
+
var AuthAccessTokenStatusSchema = z29.enum(["active", "expired", "revoked"]);
|
|
9498
|
+
var AuthServiceAccountStatusSchema = z29.enum(["active", "suspended"]);
|
|
9499
|
+
var AuthUserStatusSchema = z29.enum(["active", "suspended"]);
|
|
9500
|
+
var AuthAccessTokenSchema = z29.object({
|
|
9501
|
+
id: z29.string(),
|
|
9502
|
+
name: z29.string(),
|
|
9313
9503
|
kind: AuthAccessTokenKindSchema,
|
|
9314
9504
|
status: AuthAccessTokenStatusSchema,
|
|
9315
9505
|
subjectType: AuthAccessTokenSubjectTypeSchema,
|
|
9316
|
-
subjectId:
|
|
9317
|
-
subjectLabel:
|
|
9318
|
-
groupIds:
|
|
9319
|
-
createdAt:
|
|
9320
|
-
expiresAt:
|
|
9321
|
-
revokedAt:
|
|
9322
|
-
lastUsedAt:
|
|
9323
|
-
lastUsedUserAgent:
|
|
9324
|
-
lastUsedIpAddress:
|
|
9325
|
-
});
|
|
9326
|
-
var AuthServiceAccountSchema =
|
|
9327
|
-
id:
|
|
9328
|
-
name:
|
|
9329
|
-
description:
|
|
9506
|
+
subjectId: z29.string(),
|
|
9507
|
+
subjectLabel: z29.string().optional(),
|
|
9508
|
+
groupIds: z29.array(z29.string()).optional(),
|
|
9509
|
+
createdAt: z29.string(),
|
|
9510
|
+
expiresAt: z29.string(),
|
|
9511
|
+
revokedAt: z29.string().optional(),
|
|
9512
|
+
lastUsedAt: z29.string().optional(),
|
|
9513
|
+
lastUsedUserAgent: z29.string().optional(),
|
|
9514
|
+
lastUsedIpAddress: z29.string().optional()
|
|
9515
|
+
});
|
|
9516
|
+
var AuthServiceAccountSchema = z29.object({
|
|
9517
|
+
id: z29.string(),
|
|
9518
|
+
name: z29.string(),
|
|
9519
|
+
description: z29.string().optional(),
|
|
9330
9520
|
status: AuthServiceAccountStatusSchema,
|
|
9331
|
-
groupIds:
|
|
9332
|
-
createdAt:
|
|
9333
|
-
updatedAt:
|
|
9334
|
-
});
|
|
9335
|
-
var AuthMemberUserSchema =
|
|
9336
|
-
id:
|
|
9337
|
-
email:
|
|
9338
|
-
displayName:
|
|
9339
|
-
avatarUrl:
|
|
9521
|
+
groupIds: z29.array(z29.string()),
|
|
9522
|
+
createdAt: z29.string(),
|
|
9523
|
+
updatedAt: z29.string()
|
|
9524
|
+
});
|
|
9525
|
+
var AuthMemberUserSchema = z29.object({
|
|
9526
|
+
id: z29.string(),
|
|
9527
|
+
email: z29.string(),
|
|
9528
|
+
displayName: z29.string().optional(),
|
|
9529
|
+
avatarUrl: z29.string().optional(),
|
|
9340
9530
|
status: AuthUserStatusSchema,
|
|
9341
|
-
createdAt:
|
|
9342
|
-
updatedAt:
|
|
9531
|
+
createdAt: z29.string(),
|
|
9532
|
+
updatedAt: z29.string()
|
|
9343
9533
|
});
|
|
9344
|
-
var AuthManagedMemberSchema =
|
|
9534
|
+
var AuthManagedMemberSchema = z29.object({
|
|
9345
9535
|
user: AuthMemberUserSchema,
|
|
9346
|
-
groupIds:
|
|
9536
|
+
groupIds: z29.array(z29.string())
|
|
9347
9537
|
});
|
|
9348
|
-
var AuthMemberCapabilitiesSchema =
|
|
9349
|
-
assignGroups:
|
|
9350
|
-
suspend:
|
|
9351
|
-
reactivate:
|
|
9538
|
+
var AuthMemberCapabilitiesSchema = z29.object({
|
|
9539
|
+
assignGroups: z29.boolean(),
|
|
9540
|
+
suspend: z29.boolean(),
|
|
9541
|
+
reactivate: z29.boolean()
|
|
9352
9542
|
});
|
|
9353
9543
|
var AuthMemberSchema = AuthManagedMemberSchema.extend({
|
|
9354
9544
|
capabilities: AuthMemberCapabilitiesSchema
|
|
9355
9545
|
});
|
|
9356
|
-
var GetAuthAccessManagementOptionsResponseSchema =
|
|
9357
|
-
groups:
|
|
9546
|
+
var GetAuthAccessManagementOptionsResponseSchema = z29.object({
|
|
9547
|
+
groups: z29.array(AuthGroupOptionSchema)
|
|
9358
9548
|
});
|
|
9359
|
-
var ListAuthAccessTokensResponseSchema =
|
|
9360
|
-
accessTokens:
|
|
9549
|
+
var ListAuthAccessTokensResponseSchema = z29.object({
|
|
9550
|
+
accessTokens: z29.array(AuthAccessTokenSchema)
|
|
9361
9551
|
});
|
|
9362
|
-
var CreateAuthPersonalAccessTokenBodySchema =
|
|
9363
|
-
name:
|
|
9364
|
-
expiresAt:
|
|
9365
|
-
groupIds:
|
|
9552
|
+
var CreateAuthPersonalAccessTokenBodySchema = z29.object({
|
|
9553
|
+
name: z29.string().trim().min(1),
|
|
9554
|
+
expiresAt: z29.string().min(1),
|
|
9555
|
+
groupIds: z29.array(z29.string().min(1)).optional()
|
|
9366
9556
|
});
|
|
9367
|
-
var CreateAuthPersonalAccessTokenResponseSchema =
|
|
9557
|
+
var CreateAuthPersonalAccessTokenResponseSchema = z29.object({
|
|
9368
9558
|
accessToken: AuthAccessTokenSchema,
|
|
9369
|
-
tokenValue:
|
|
9559
|
+
tokenValue: z29.string()
|
|
9370
9560
|
});
|
|
9371
|
-
var RevokeAuthAccessTokenParamsSchema =
|
|
9372
|
-
tokenId:
|
|
9561
|
+
var RevokeAuthAccessTokenParamsSchema = z29.object({
|
|
9562
|
+
tokenId: z29.string().min(1)
|
|
9373
9563
|
});
|
|
9374
|
-
var RevokeAuthAccessTokenResponseSchema =
|
|
9564
|
+
var RevokeAuthAccessTokenResponseSchema = z29.object({
|
|
9375
9565
|
accessToken: AuthAccessTokenSchema
|
|
9376
9566
|
});
|
|
9377
|
-
var ListAuthServiceAccountsResponseSchema =
|
|
9378
|
-
serviceAccounts:
|
|
9567
|
+
var ListAuthServiceAccountsResponseSchema = z29.object({
|
|
9568
|
+
serviceAccounts: z29.array(AuthServiceAccountSchema)
|
|
9379
9569
|
});
|
|
9380
|
-
var CreateAuthServiceAccountBodySchema =
|
|
9381
|
-
id:
|
|
9382
|
-
name:
|
|
9383
|
-
description:
|
|
9384
|
-
groupIds:
|
|
9570
|
+
var CreateAuthServiceAccountBodySchema = z29.object({
|
|
9571
|
+
id: z29.string().trim().min(1).optional(),
|
|
9572
|
+
name: z29.string().trim().min(1),
|
|
9573
|
+
description: z29.string().trim().optional(),
|
|
9574
|
+
groupIds: z29.array(z29.string().min(1)).optional()
|
|
9385
9575
|
});
|
|
9386
|
-
var CreateAuthServiceAccountResponseSchema =
|
|
9576
|
+
var CreateAuthServiceAccountResponseSchema = z29.object({
|
|
9387
9577
|
serviceAccount: AuthServiceAccountSchema
|
|
9388
9578
|
});
|
|
9389
|
-
var AuthServiceAccountParamsSchema =
|
|
9390
|
-
serviceAccountId:
|
|
9579
|
+
var AuthServiceAccountParamsSchema = z29.object({
|
|
9580
|
+
serviceAccountId: z29.string().min(1)
|
|
9391
9581
|
});
|
|
9392
|
-
var DisableAuthServiceAccountResponseSchema =
|
|
9582
|
+
var DisableAuthServiceAccountResponseSchema = z29.object({
|
|
9393
9583
|
serviceAccount: AuthServiceAccountSchema
|
|
9394
9584
|
});
|
|
9395
|
-
var ListAuthServiceAccountAccessTokensResponseSchema =
|
|
9396
|
-
accessTokens:
|
|
9585
|
+
var ListAuthServiceAccountAccessTokensResponseSchema = z29.object({
|
|
9586
|
+
accessTokens: z29.array(AuthAccessTokenSchema)
|
|
9397
9587
|
});
|
|
9398
|
-
var CreateAuthServiceAccountAccessTokenBodySchema =
|
|
9399
|
-
name:
|
|
9400
|
-
expiresAt:
|
|
9401
|
-
groupIds:
|
|
9588
|
+
var CreateAuthServiceAccountAccessTokenBodySchema = z29.object({
|
|
9589
|
+
name: z29.string().trim().min(1),
|
|
9590
|
+
expiresAt: z29.string().min(1),
|
|
9591
|
+
groupIds: z29.array(z29.string().min(1)).optional()
|
|
9402
9592
|
});
|
|
9403
|
-
var CreateAuthServiceAccountAccessTokenResponseSchema =
|
|
9593
|
+
var CreateAuthServiceAccountAccessTokenResponseSchema = z29.object({
|
|
9404
9594
|
accessToken: AuthAccessTokenSchema,
|
|
9405
|
-
tokenValue:
|
|
9595
|
+
tokenValue: z29.string()
|
|
9406
9596
|
});
|
|
9407
9597
|
var RevokeAuthServiceAccountAccessTokenParamsSchema = AuthServiceAccountParamsSchema.extend({
|
|
9408
|
-
tokenId:
|
|
9598
|
+
tokenId: z29.string().min(1)
|
|
9409
9599
|
});
|
|
9410
|
-
var RevokeAuthServiceAccountAccessTokenResponseSchema =
|
|
9600
|
+
var RevokeAuthServiceAccountAccessTokenResponseSchema = z29.object({
|
|
9411
9601
|
accessToken: AuthAccessTokenSchema
|
|
9412
9602
|
});
|
|
9413
|
-
var AuthCreateInvitationCapabilitySchema =
|
|
9414
|
-
|
|
9415
|
-
state:
|
|
9603
|
+
var AuthCreateInvitationCapabilitySchema = z29.union([
|
|
9604
|
+
z29.object({
|
|
9605
|
+
state: z29.literal("enabled")
|
|
9416
9606
|
}),
|
|
9417
|
-
|
|
9418
|
-
state:
|
|
9419
|
-
reason:
|
|
9607
|
+
z29.object({
|
|
9608
|
+
state: z29.literal("disabled"),
|
|
9609
|
+
reason: z29.enum(["missing_membership_policy", "invitation_delivery_not_supported"])
|
|
9420
9610
|
})
|
|
9421
9611
|
]);
|
|
9422
|
-
var AuthInvitationDestinationSchema =
|
|
9423
|
-
id:
|
|
9424
|
-
label:
|
|
9425
|
-
});
|
|
9426
|
-
var GetAuthInvitationOptionsResponseSchema =
|
|
9427
|
-
groups:
|
|
9428
|
-
destinations:
|
|
9429
|
-
defaultDestinationId:
|
|
9430
|
-
canInviteWithoutGroups:
|
|
9431
|
-
capabilities:
|
|
9612
|
+
var AuthInvitationDestinationSchema = z29.object({
|
|
9613
|
+
id: z29.enum(["atlas", "app"]),
|
|
9614
|
+
label: z29.string()
|
|
9615
|
+
});
|
|
9616
|
+
var GetAuthInvitationOptionsResponseSchema = z29.object({
|
|
9617
|
+
groups: z29.array(AuthInvitationGroupOptionSchema),
|
|
9618
|
+
destinations: z29.array(AuthInvitationDestinationSchema),
|
|
9619
|
+
defaultDestinationId: z29.enum(["atlas", "app"]).optional(),
|
|
9620
|
+
canInviteWithoutGroups: z29.boolean(),
|
|
9621
|
+
capabilities: z29.object({
|
|
9432
9622
|
createInvitation: AuthCreateInvitationCapabilitySchema
|
|
9433
9623
|
})
|
|
9434
9624
|
});
|
|
9435
|
-
var GetAuthMembershipOptionsResponseSchema =
|
|
9436
|
-
groups:
|
|
9437
|
-
capabilities:
|
|
9438
|
-
invite:
|
|
9439
|
-
assignGroups:
|
|
9440
|
-
suspend:
|
|
9625
|
+
var GetAuthMembershipOptionsResponseSchema = z29.object({
|
|
9626
|
+
groups: z29.array(AuthGroupOptionSchema),
|
|
9627
|
+
capabilities: z29.object({
|
|
9628
|
+
invite: z29.boolean(),
|
|
9629
|
+
assignGroups: z29.boolean(),
|
|
9630
|
+
suspend: z29.boolean()
|
|
9441
9631
|
})
|
|
9442
9632
|
});
|
|
9443
|
-
var ListAuthMembersQuerySchema =
|
|
9444
|
-
limit:
|
|
9445
|
-
offset:
|
|
9446
|
-
order:
|
|
9633
|
+
var ListAuthMembersQuerySchema = z29.object({
|
|
9634
|
+
limit: z29.string().optional(),
|
|
9635
|
+
offset: z29.string().optional(),
|
|
9636
|
+
order: z29.enum(["asc", "desc"]).optional()
|
|
9447
9637
|
});
|
|
9448
|
-
var ListAuthMembersResponseSchema =
|
|
9449
|
-
members:
|
|
9450
|
-
hasMore:
|
|
9451
|
-
total:
|
|
9638
|
+
var ListAuthMembersResponseSchema = z29.object({
|
|
9639
|
+
members: z29.array(AuthMemberSchema),
|
|
9640
|
+
hasMore: z29.boolean(),
|
|
9641
|
+
total: z29.number()
|
|
9452
9642
|
});
|
|
9453
|
-
var AuthMemberParamsSchema =
|
|
9454
|
-
userId:
|
|
9643
|
+
var AuthMemberParamsSchema = z29.object({
|
|
9644
|
+
userId: z29.string().min(1)
|
|
9455
9645
|
});
|
|
9456
|
-
var UpdateAuthMemberGroupsBodySchema =
|
|
9457
|
-
groupIds:
|
|
9646
|
+
var UpdateAuthMemberGroupsBodySchema = z29.object({
|
|
9647
|
+
groupIds: z29.array(z29.string().min(1))
|
|
9458
9648
|
});
|
|
9459
|
-
var UpdateAuthMemberGroupsResponseSchema =
|
|
9649
|
+
var UpdateAuthMemberGroupsResponseSchema = z29.object({
|
|
9460
9650
|
member: AuthManagedMemberSchema
|
|
9461
9651
|
});
|
|
9462
|
-
var SuspendAuthMemberResponseSchema =
|
|
9652
|
+
var SuspendAuthMemberResponseSchema = z29.object({
|
|
9463
9653
|
member: AuthManagedMemberSchema
|
|
9464
9654
|
});
|
|
9465
|
-
var ReactivateAuthMemberResponseSchema =
|
|
9655
|
+
var ReactivateAuthMemberResponseSchema = z29.object({
|
|
9466
9656
|
member: AuthManagedMemberSchema
|
|
9467
9657
|
});
|
|
9468
|
-
var CreateAuthInvitationBodySchema =
|
|
9469
|
-
email:
|
|
9470
|
-
groupIds:
|
|
9471
|
-
destinationId:
|
|
9472
|
-
expiresAt:
|
|
9473
|
-
returnTo:
|
|
9658
|
+
var CreateAuthInvitationBodySchema = z29.object({
|
|
9659
|
+
email: z29.string().min(1),
|
|
9660
|
+
groupIds: z29.array(z29.string().min(1)).optional(),
|
|
9661
|
+
destinationId: z29.enum(["atlas", "app"]).optional(),
|
|
9662
|
+
expiresAt: z29.string().optional(),
|
|
9663
|
+
returnTo: z29.string().optional()
|
|
9474
9664
|
});
|
|
9475
|
-
var CreateAuthInvitationResponseSchema =
|
|
9665
|
+
var CreateAuthInvitationResponseSchema = z29.object({
|
|
9476
9666
|
invitation: AuthInvitationSchema,
|
|
9477
9667
|
delivery: AuthInvitationDeliverySchema
|
|
9478
9668
|
});
|
|
9479
|
-
var ListAuthInvitationsQuerySchema =
|
|
9480
|
-
email:
|
|
9669
|
+
var ListAuthInvitationsQuerySchema = z29.object({
|
|
9670
|
+
email: z29.string().optional(),
|
|
9481
9671
|
status: AuthInvitationStatusSchema.optional(),
|
|
9482
|
-
limit:
|
|
9483
|
-
offset:
|
|
9484
|
-
order:
|
|
9672
|
+
limit: z29.string().optional(),
|
|
9673
|
+
offset: z29.string().optional(),
|
|
9674
|
+
order: z29.enum(["asc", "desc"]).optional()
|
|
9485
9675
|
});
|
|
9486
|
-
var ListAuthInvitationsResponseSchema =
|
|
9487
|
-
invitations:
|
|
9488
|
-
hasMore:
|
|
9489
|
-
total:
|
|
9676
|
+
var ListAuthInvitationsResponseSchema = z29.object({
|
|
9677
|
+
invitations: z29.array(AuthInvitationSchema),
|
|
9678
|
+
hasMore: z29.boolean(),
|
|
9679
|
+
total: z29.number()
|
|
9490
9680
|
});
|
|
9491
|
-
var RevokeAuthInvitationParamsSchema =
|
|
9492
|
-
invitationId:
|
|
9681
|
+
var RevokeAuthInvitationParamsSchema = z29.object({
|
|
9682
|
+
invitationId: z29.string().min(1)
|
|
9493
9683
|
});
|
|
9494
|
-
var RevokeAuthInvitationResponseSchema =
|
|
9684
|
+
var RevokeAuthInvitationResponseSchema = z29.object({
|
|
9495
9685
|
invitation: AuthInvitationSchema
|
|
9496
9686
|
});
|
|
9497
|
-
var AuthSessionResponseSchema =
|
|
9498
|
-
|
|
9499
|
-
authenticated:
|
|
9687
|
+
var AuthSessionResponseSchema = z29.union([
|
|
9688
|
+
z29.object({
|
|
9689
|
+
authenticated: z29.literal(false)
|
|
9500
9690
|
}),
|
|
9501
|
-
|
|
9502
|
-
authenticated:
|
|
9503
|
-
csrfToken:
|
|
9504
|
-
applicationAccess:
|
|
9505
|
-
allowed:
|
|
9506
|
-
audience:
|
|
9691
|
+
z29.object({
|
|
9692
|
+
authenticated: z29.literal(true),
|
|
9693
|
+
csrfToken: z29.string(),
|
|
9694
|
+
applicationAccess: z29.object({
|
|
9695
|
+
allowed: z29.boolean(),
|
|
9696
|
+
audience: z29.enum(["atlas", "app"])
|
|
9507
9697
|
}),
|
|
9508
|
-
user:
|
|
9509
|
-
id:
|
|
9510
|
-
email:
|
|
9511
|
-
displayName:
|
|
9512
|
-
avatarUrl:
|
|
9513
|
-
groupIds:
|
|
9698
|
+
user: z29.object({
|
|
9699
|
+
id: z29.string(),
|
|
9700
|
+
email: z29.string(),
|
|
9701
|
+
displayName: z29.string().optional(),
|
|
9702
|
+
avatarUrl: z29.string().optional(),
|
|
9703
|
+
groupIds: z29.array(z29.string())
|
|
9514
9704
|
}),
|
|
9515
|
-
session:
|
|
9516
|
-
id:
|
|
9517
|
-
expiresAt:
|
|
9705
|
+
session: z29.object({
|
|
9706
|
+
id: z29.string(),
|
|
9707
|
+
expiresAt: z29.string()
|
|
9518
9708
|
})
|
|
9519
9709
|
})
|
|
9520
9710
|
]);
|
|
9521
|
-
var AuthSignOutResponseSchema =
|
|
9522
|
-
success:
|
|
9711
|
+
var AuthSignOutResponseSchema = z29.object({
|
|
9712
|
+
success: z29.boolean()
|
|
9523
9713
|
});
|
|
9524
|
-
var AuthSessionSummarySchema =
|
|
9525
|
-
id:
|
|
9526
|
-
audience:
|
|
9527
|
-
current:
|
|
9528
|
-
createdAt:
|
|
9529
|
-
expiresAt:
|
|
9530
|
-
lastSeenAt:
|
|
9531
|
-
userAgent:
|
|
9532
|
-
ipAddress:
|
|
9714
|
+
var AuthSessionSummarySchema = z29.object({
|
|
9715
|
+
id: z29.string(),
|
|
9716
|
+
audience: z29.enum(["atlas", "app"]),
|
|
9717
|
+
current: z29.boolean(),
|
|
9718
|
+
createdAt: z29.string(),
|
|
9719
|
+
expiresAt: z29.string(),
|
|
9720
|
+
lastSeenAt: z29.string().optional(),
|
|
9721
|
+
userAgent: z29.string().optional(),
|
|
9722
|
+
ipAddress: z29.string().optional()
|
|
9533
9723
|
});
|
|
9534
|
-
var ListAuthSessionsResponseSchema =
|
|
9535
|
-
sessions:
|
|
9724
|
+
var ListAuthSessionsResponseSchema = z29.object({
|
|
9725
|
+
sessions: z29.array(AuthSessionSummarySchema)
|
|
9536
9726
|
});
|
|
9537
|
-
var RevokeAuthSessionParamsSchema =
|
|
9538
|
-
sessionId:
|
|
9727
|
+
var RevokeAuthSessionParamsSchema = z29.object({
|
|
9728
|
+
sessionId: z29.string().min(1)
|
|
9539
9729
|
});
|
|
9540
|
-
var RevokeAuthSessionResponseSchema =
|
|
9541
|
-
success:
|
|
9730
|
+
var RevokeAuthSessionResponseSchema = z29.object({
|
|
9731
|
+
success: z29.boolean()
|
|
9542
9732
|
});
|
|
9543
|
-
var SignOutAllResponseSchema =
|
|
9544
|
-
success:
|
|
9545
|
-
revokedCount:
|
|
9733
|
+
var SignOutAllResponseSchema = z29.object({
|
|
9734
|
+
success: z29.boolean(),
|
|
9735
|
+
revokedCount: z29.number()
|
|
9546
9736
|
});
|
|
9547
9737
|
|
|
9548
9738
|
// src/routes/auth.ts
|
|
@@ -11424,7 +11614,7 @@ import {
|
|
|
11424
11614
|
isAgentRunActivityEvent
|
|
11425
11615
|
} from "@sixb/core/agents/streams";
|
|
11426
11616
|
import { BrokerCursorExpiredError } from "@sixb/core/broker";
|
|
11427
|
-
import { z as
|
|
11617
|
+
import { z as z30 } from "zod";
|
|
11428
11618
|
|
|
11429
11619
|
// src/utils/ws.ts
|
|
11430
11620
|
function safeSend(target, payload) {
|
|
@@ -11472,25 +11662,25 @@ async function decodeWsMessage(message) {
|
|
|
11472
11662
|
}
|
|
11473
11663
|
|
|
11474
11664
|
// src/routes/ws/agents.ts
|
|
11475
|
-
var SubscribeSchema =
|
|
11476
|
-
type:
|
|
11477
|
-
runId:
|
|
11478
|
-
afterCursor:
|
|
11665
|
+
var SubscribeSchema = z30.object({
|
|
11666
|
+
type: z30.literal("subscribe"),
|
|
11667
|
+
runId: z30.string().min(1),
|
|
11668
|
+
afterCursor: z30.string().min(1).optional()
|
|
11479
11669
|
});
|
|
11480
|
-
var SubscribeActivitySchema =
|
|
11481
|
-
type:
|
|
11670
|
+
var SubscribeActivitySchema = z30.object({
|
|
11671
|
+
type: z30.literal("subscribe.activity")
|
|
11482
11672
|
});
|
|
11483
|
-
var ReplaySchema =
|
|
11484
|
-
type:
|
|
11485
|
-
runId:
|
|
11486
|
-
afterCursor:
|
|
11487
|
-
limit:
|
|
11673
|
+
var ReplaySchema = z30.object({
|
|
11674
|
+
type: z30.literal("replay"),
|
|
11675
|
+
runId: z30.string().min(1),
|
|
11676
|
+
afterCursor: z30.string().min(1).optional(),
|
|
11677
|
+
limit: z30.number().int().positive().max(500).optional()
|
|
11488
11678
|
});
|
|
11489
|
-
var UnsubscribeSchema =
|
|
11490
|
-
type:
|
|
11491
|
-
runId:
|
|
11679
|
+
var UnsubscribeSchema = z30.object({
|
|
11680
|
+
type: z30.literal("unsubscribe"),
|
|
11681
|
+
runId: z30.string().min(1).optional()
|
|
11492
11682
|
});
|
|
11493
|
-
var AgentStreamMessageSchema =
|
|
11683
|
+
var AgentStreamMessageSchema = z30.union([
|
|
11494
11684
|
SubscribeSchema,
|
|
11495
11685
|
SubscribeActivitySchema,
|
|
11496
11686
|
ReplaySchema,
|
|
@@ -11776,22 +11966,22 @@ function errorMessage(error) {
|
|
|
11776
11966
|
|
|
11777
11967
|
// src/routes/ws/events.ts
|
|
11778
11968
|
import { scopeKeysForEvent } from "@sixb/core/events/scope";
|
|
11779
|
-
import { z as
|
|
11780
|
-
var SubscribeSchema2 =
|
|
11781
|
-
type:
|
|
11782
|
-
topic:
|
|
11783
|
-
types:
|
|
11784
|
-
objectTypeId:
|
|
11785
|
-
primaryId:
|
|
11786
|
-
actionId:
|
|
11787
|
-
runId:
|
|
11788
|
-
afterCursor:
|
|
11789
|
-
limit:
|
|
11790
|
-
});
|
|
11791
|
-
var UnsubscribeSchema2 =
|
|
11792
|
-
type:
|
|
11793
|
-
});
|
|
11794
|
-
var SubscriptionMessageSchema =
|
|
11969
|
+
import { z as z31 } from "zod";
|
|
11970
|
+
var SubscribeSchema2 = z31.object({
|
|
11971
|
+
type: z31.literal("subscribe"),
|
|
11972
|
+
topic: z31.enum(EVENT_TOPICS).optional(),
|
|
11973
|
+
types: z31.array(z31.enum(EVENT_TYPES)).optional(),
|
|
11974
|
+
objectTypeId: z31.string().optional(),
|
|
11975
|
+
primaryId: z31.string().optional(),
|
|
11976
|
+
actionId: z31.string().optional(),
|
|
11977
|
+
runId: z31.string().optional(),
|
|
11978
|
+
afterCursor: z31.string().optional(),
|
|
11979
|
+
limit: z31.number().int().positive().max(500).optional()
|
|
11980
|
+
});
|
|
11981
|
+
var UnsubscribeSchema2 = z31.object({
|
|
11982
|
+
type: z31.literal("unsubscribe")
|
|
11983
|
+
});
|
|
11984
|
+
var SubscriptionMessageSchema = z31.union([SubscribeSchema2, UnsubscribeSchema2]);
|
|
11795
11985
|
function parseSubscriptionMessage(payload) {
|
|
11796
11986
|
if (!payload || typeof payload !== "object") {
|
|
11797
11987
|
return { ok: false, error: "Message must be a JSON object." };
|
|
@@ -11981,7 +12171,7 @@ function eventMatchesScope(event, filter) {
|
|
|
11981
12171
|
}
|
|
11982
12172
|
|
|
11983
12173
|
// src/routes/ws/logs.ts
|
|
11984
|
-
import { z as
|
|
12174
|
+
import { z as z32 } from "zod";
|
|
11985
12175
|
|
|
11986
12176
|
// src/routes/ws/log-subscription-hub.ts
|
|
11987
12177
|
import { BrokerCursorExpiredError as BrokerCursorExpiredError2 } from "@sixb/core/broker";
|
|
@@ -12294,26 +12484,26 @@ function socketBufferedAmount(ws) {
|
|
|
12294
12484
|
}
|
|
12295
12485
|
|
|
12296
12486
|
// src/routes/ws/logs.ts
|
|
12297
|
-
var SubscribeSchema3 =
|
|
12298
|
-
type:
|
|
12299
|
-
kinds:
|
|
12300
|
-
levels:
|
|
12301
|
-
run:
|
|
12302
|
-
kind:
|
|
12487
|
+
var SubscribeSchema3 = z32.object({
|
|
12488
|
+
type: z32.literal("subscribe"),
|
|
12489
|
+
kinds: z32.array(z32.enum(SIXB_RUN_KINDS)).min(1).optional(),
|
|
12490
|
+
levels: z32.array(z32.enum(LOG_LEVELS)).min(1).optional(),
|
|
12491
|
+
run: z32.object({
|
|
12492
|
+
kind: z32.enum(SIXB_RUN_KINDS),
|
|
12303
12493
|
id: LogRunIdSchema
|
|
12304
12494
|
}).optional(),
|
|
12305
|
-
afterCursor:
|
|
12495
|
+
afterCursor: z32.string().optional()
|
|
12306
12496
|
}).superRefine((value, context) => {
|
|
12307
12497
|
if (value.run && value.kinds && !value.kinds.includes(value.run.kind)) {
|
|
12308
12498
|
context.addIssue({
|
|
12309
|
-
code:
|
|
12499
|
+
code: z32.ZodIssueCode.custom,
|
|
12310
12500
|
path: ["run"],
|
|
12311
12501
|
message: "run.kind must be included in kinds"
|
|
12312
12502
|
});
|
|
12313
12503
|
}
|
|
12314
12504
|
});
|
|
12315
|
-
var UnsubscribeSchema3 =
|
|
12316
|
-
var SubscriptionMessageSchema2 =
|
|
12505
|
+
var UnsubscribeSchema3 = z32.object({ type: z32.literal("unsubscribe") });
|
|
12506
|
+
var SubscriptionMessageSchema2 = z32.union([SubscribeSchema3, UnsubscribeSchema3]);
|
|
12317
12507
|
function parseLogSubscriptionMessage(payload) {
|
|
12318
12508
|
if (!payload || typeof payload !== "object") {
|
|
12319
12509
|
return { ok: false, error: "Message must be a JSON object." };
|
|
@@ -12696,4 +12886,4 @@ export {
|
|
|
12696
12886
|
SixbServer
|
|
12697
12887
|
};
|
|
12698
12888
|
|
|
12699
|
-
//# debugId=
|
|
12889
|
+
//# debugId=D4859E1909D00F4164756E2164756E21
|