@sixb/server 0.0.1
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/LICENSE +21 -0
- package/README.md +123 -0
- package/dist/auth/access-token-boundary.d.ts +23 -0
- package/dist/auth/access-token-boundary.d.ts.map +1 -0
- package/dist/auth/application-access.d.ts +4 -0
- package/dist/auth/application-access.d.ts.map +1 -0
- package/dist/auth/browser-origin.d.ts +62 -0
- package/dist/auth/browser-origin.d.ts.map +1 -0
- package/dist/auth/csrf.d.ts +2 -0
- package/dist/auth/csrf.d.ts.map +1 -0
- package/dist/auth/guard.d.ts +35 -0
- package/dist/auth/guard.d.ts.map +1 -0
- package/dist/auth/public-routes.d.ts +8 -0
- package/dist/auth/public-routes.d.ts.map +1 -0
- package/dist/auth/responses.d.ts +11 -0
- package/dist/auth/responses.d.ts.map +1 -0
- package/dist/auth/return-to.d.ts +3 -0
- package/dist/auth/return-to.d.ts.map +1 -0
- package/dist/auth/scope.d.ts +43 -0
- package/dist/auth/scope.d.ts.map +1 -0
- package/dist/auth/session-activity.d.ts +4 -0
- package/dist/auth/session-activity.d.ts.map +1 -0
- package/dist/auth/session-cookies.d.ts +12 -0
- package/dist/auth/session-cookies.d.ts.map +1 -0
- package/dist/files/content.d.ts +141 -0
- package/dist/files/content.d.ts.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +11522 -0
- package/dist/index.js.map +78 -0
- package/dist/openapi/security.d.ts +26 -0
- package/dist/openapi/security.d.ts.map +1 -0
- package/dist/openapi/tags.d.ts +151 -0
- package/dist/openapi/tags.d.ts.map +1 -0
- package/dist/registerRoutes.d.ts +31 -0
- package/dist/registerRoutes.d.ts.map +1 -0
- package/dist/routes/action-runs.d.ts +244 -0
- package/dist/routes/action-runs.d.ts.map +1 -0
- package/dist/routes/actions.d.ts +183 -0
- package/dist/routes/actions.d.ts.map +1 -0
- package/dist/routes/agent-api-gateway.d.ts +4 -0
- package/dist/routes/agent-api-gateway.d.ts.map +1 -0
- package/dist/routes/agents.d.ts +1061 -0
- package/dist/routes/agents.d.ts.map +1 -0
- package/dist/routes/auth.d.ts +1366 -0
- package/dist/routes/auth.d.ts.map +1 -0
- package/dist/routes/connectors.d.ts +108 -0
- package/dist/routes/connectors.d.ts.map +1 -0
- package/dist/routes/datasets.d.ts +339 -0
- package/dist/routes/datasets.d.ts.map +1 -0
- package/dist/routes/events.d.ts +116 -0
- package/dist/routes/events.d.ts.map +1 -0
- package/dist/routes/files.d.ts +340 -0
- package/dist/routes/files.d.ts.map +1 -0
- package/dist/routes/links.d.ts +175 -0
- package/dist/routes/links.d.ts.map +1 -0
- package/dist/routes/logs.d.ts +88 -0
- package/dist/routes/logs.d.ts.map +1 -0
- package/dist/routes/objects.d.ts +450 -0
- package/dist/routes/objects.d.ts.map +1 -0
- package/dist/routes/ontology.d.ts +240 -0
- package/dist/routes/ontology.d.ts.map +1 -0
- package/dist/routes/pipelines.d.ts +399 -0
- package/dist/routes/pipelines.d.ts.map +1 -0
- package/dist/routes/project.d.ts +56 -0
- package/dist/routes/project.d.ts.map +1 -0
- package/dist/routes/projections.d.ts +916 -0
- package/dist/routes/projections.d.ts.map +1 -0
- package/dist/routes/rules.d.ts +165 -0
- package/dist/routes/rules.d.ts.map +1 -0
- package/dist/routes/status.d.ts +81 -0
- package/dist/routes/status.d.ts.map +1 -0
- package/dist/routes/syncs.d.ts +294 -0
- package/dist/routes/syncs.d.ts.map +1 -0
- package/dist/routes/telemetry.d.ts +241 -0
- package/dist/routes/telemetry.d.ts.map +1 -0
- package/dist/routes/webhook-runs.d.ts +89 -0
- package/dist/routes/webhook-runs.d.ts.map +1 -0
- package/dist/routes/webhooks.d.ts +60 -0
- package/dist/routes/webhooks.d.ts.map +1 -0
- package/dist/routes/workflows.d.ts +973 -0
- package/dist/routes/workflows.d.ts.map +1 -0
- package/dist/routes/ws/agents.d.ts +99 -0
- package/dist/routes/ws/agents.d.ts.map +1 -0
- package/dist/routes/ws/events.d.ts +89 -0
- package/dist/routes/ws/events.d.ts.map +1 -0
- package/dist/routes/ws/index.d.ts +31 -0
- package/dist/routes/ws/index.d.ts.map +1 -0
- package/dist/routes/ws/log-subscription-hub.d.ts +47 -0
- package/dist/routes/ws/log-subscription-hub.d.ts.map +1 -0
- package/dist/routes/ws/logs.d.ts +110 -0
- package/dist/routes/ws/logs.d.ts.map +1 -0
- package/dist/schemas/actions.d.ts +644 -0
- package/dist/schemas/actions.d.ts.map +1 -0
- package/dist/schemas/agents.d.ts +3157 -0
- package/dist/schemas/agents.d.ts.map +1 -0
- package/dist/schemas/auth.d.ts +2023 -0
- package/dist/schemas/auth.d.ts.map +1 -0
- package/dist/schemas/common.d.ts +30 -0
- package/dist/schemas/common.d.ts.map +1 -0
- package/dist/schemas/connectors.d.ts +82 -0
- package/dist/schemas/connectors.d.ts.map +1 -0
- package/dist/schemas/datasets.d.ts +744 -0
- package/dist/schemas/datasets.d.ts.map +1 -0
- package/dist/schemas/event-payloads.d.ts +477 -0
- package/dist/schemas/event-payloads.d.ts.map +1 -0
- package/dist/schemas/events.d.ts +665 -0
- package/dist/schemas/events.d.ts.map +1 -0
- package/dist/schemas/files.d.ts +241 -0
- package/dist/schemas/files.d.ts.map +1 -0
- package/dist/schemas/links.d.ts +90 -0
- package/dist/schemas/links.d.ts.map +1 -0
- package/dist/schemas/logs.d.ts +231 -0
- package/dist/schemas/logs.d.ts.map +1 -0
- package/dist/schemas/objects.d.ts +288 -0
- package/dist/schemas/objects.d.ts.map +1 -0
- package/dist/schemas/ontology.d.ts +778 -0
- package/dist/schemas/ontology.d.ts.map +1 -0
- package/dist/schemas/pipelines.d.ts +1373 -0
- package/dist/schemas/pipelines.d.ts.map +1 -0
- package/dist/schemas/project.d.ts +9 -0
- package/dist/schemas/project.d.ts.map +1 -0
- package/dist/schemas/projections.d.ts +6992 -0
- package/dist/schemas/projections.d.ts.map +1 -0
- package/dist/schemas/rules.d.ts +204 -0
- package/dist/schemas/rules.d.ts.map +1 -0
- package/dist/schemas/status.d.ts +189 -0
- package/dist/schemas/status.d.ts.map +1 -0
- package/dist/schemas/syncs.d.ts +538 -0
- package/dist/schemas/syncs.d.ts.map +1 -0
- package/dist/schemas/telemetry.d.ts +265 -0
- package/dist/schemas/telemetry.d.ts.map +1 -0
- package/dist/schemas/webhook-runs.d.ts +169 -0
- package/dist/schemas/webhook-runs.d.ts.map +1 -0
- package/dist/schemas/workflows.d.ts +1720 -0
- package/dist/schemas/workflows.d.ts.map +1 -0
- package/dist/server.d.ts +64 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/tsconfig.json +5 -0
- package/dist/utils/http.d.ts +23 -0
- package/dist/utils/http.d.ts.map +1 -0
- package/dist/utils/request-body.d.ts +15 -0
- package/dist/utils/request-body.d.ts.map +1 -0
- package/dist/utils/ws.d.ts +10 -0
- package/dist/utils/ws.d.ts.map +1 -0
- package/package.json +68 -0
- package/src/auth/access-token-boundary.ts +68 -0
- package/src/auth/application-access.ts +16 -0
- package/src/auth/browser-origin.ts +367 -0
- package/src/auth/csrf.ts +1 -0
- package/src/auth/guard.ts +169 -0
- package/src/auth/public-routes.ts +87 -0
- package/src/auth/responses.ts +54 -0
- package/src/auth/return-to.ts +21 -0
- package/src/auth/scope.ts +64 -0
- package/src/auth/session-activity.ts +19 -0
- package/src/auth/session-cookies.ts +43 -0
- package/src/files/content.ts +419 -0
- package/src/index.ts +2 -0
- package/src/openapi/security.ts +37 -0
- package/src/openapi/tags.ts +151 -0
- package/src/registerRoutes.ts +49 -0
- package/src/routes/action-runs.ts +238 -0
- package/src/routes/actions.ts +126 -0
- package/src/routes/agent-api-gateway.ts +260 -0
- package/src/routes/agents.ts +943 -0
- package/src/routes/auth.ts +2233 -0
- package/src/routes/connectors.ts +69 -0
- package/src/routes/datasets.ts +402 -0
- package/src/routes/events.ts +55 -0
- package/src/routes/files.ts +675 -0
- package/src/routes/links.ts +143 -0
- package/src/routes/logs.ts +65 -0
- package/src/routes/objects.ts +838 -0
- package/src/routes/ontology.ts +138 -0
- package/src/routes/pipelines.ts +332 -0
- package/src/routes/project.ts +16 -0
- package/src/routes/projections.ts +251 -0
- package/src/routes/rules.ts +124 -0
- package/src/routes/status.ts +53 -0
- package/src/routes/syncs.ts +243 -0
- package/src/routes/telemetry.ts +207 -0
- package/src/routes/webhook-runs.ts +81 -0
- package/src/routes/webhooks.ts +508 -0
- package/src/routes/workflows.ts +1333 -0
- package/src/routes/ws/agents.ts +301 -0
- package/src/routes/ws/events.ts +278 -0
- package/src/routes/ws/index.ts +12 -0
- package/src/routes/ws/log-subscription-hub.ts +375 -0
- package/src/routes/ws/logs.ts +117 -0
- package/src/schemas/actions.ts +123 -0
- package/src/schemas/agents.ts +293 -0
- package/src/schemas/auth.ts +317 -0
- package/src/schemas/common.ts +60 -0
- package/src/schemas/connectors.ts +21 -0
- package/src/schemas/datasets.ts +107 -0
- package/src/schemas/event-payloads.ts +79 -0
- package/src/schemas/events.ts +117 -0
- package/src/schemas/files.ts +82 -0
- package/src/schemas/links.ts +38 -0
- package/src/schemas/logs.ts +76 -0
- package/src/schemas/objects.ts +759 -0
- package/src/schemas/ontology.ts +77 -0
- package/src/schemas/pipelines.ts +150 -0
- package/src/schemas/project.ts +5 -0
- package/src/schemas/projections.ts +144 -0
- package/src/schemas/rules.ts +98 -0
- package/src/schemas/status.ts +51 -0
- package/src/schemas/syncs.ts +83 -0
- package/src/schemas/telemetry.ts +59 -0
- package/src/schemas/webhook-runs.ts +40 -0
- package/src/schemas/workflows.ts +229 -0
- package/src/server.ts +383 -0
- package/src/utils/http.ts +108 -0
- package/src/utils/request-body.ts +62 -0
- package/src/utils/ws.ts +59 -0
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { z } from "zod"
|
|
2
|
+
|
|
3
|
+
export const ObjectTypeParamsSchema = z.object({ objectTypeId: z.string().min(1) })
|
|
4
|
+
|
|
5
|
+
export const PropertyDefinitionSchema = z.object({
|
|
6
|
+
id: z.string(),
|
|
7
|
+
name: z.string(),
|
|
8
|
+
description: z.string().optional(),
|
|
9
|
+
mode: z.enum(["static", "telemetry"]).optional(),
|
|
10
|
+
required: z.boolean().optional(),
|
|
11
|
+
nullable: z.boolean().optional(),
|
|
12
|
+
primary: z.boolean().optional(),
|
|
13
|
+
semanticType: z.string().optional(),
|
|
14
|
+
schema: z.unknown(),
|
|
15
|
+
query: z
|
|
16
|
+
.object({
|
|
17
|
+
searchable: z.boolean().optional(),
|
|
18
|
+
filterable: z.boolean().optional(),
|
|
19
|
+
sortable: z.boolean().optional(),
|
|
20
|
+
text: z.boolean().optional(),
|
|
21
|
+
exact: z.boolean().optional(),
|
|
22
|
+
facet: z.boolean().optional(),
|
|
23
|
+
vector: z.boolean().optional(),
|
|
24
|
+
weight: z.number().optional(),
|
|
25
|
+
})
|
|
26
|
+
.optional(),
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
export const LinkDefinitionSchema = z.object({
|
|
30
|
+
id: z.string(),
|
|
31
|
+
name: z.string(),
|
|
32
|
+
description: z.string().optional(),
|
|
33
|
+
targetObjectTypeId: z.union([z.string(), z.array(z.string())]),
|
|
34
|
+
cardinality: z.enum(["one", "many"]).optional(),
|
|
35
|
+
properties: z.array(PropertyDefinitionSchema).optional(),
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
export const ActionParamSchema = z.object({
|
|
39
|
+
id: z.string(),
|
|
40
|
+
name: z.string(),
|
|
41
|
+
description: z.string().optional(),
|
|
42
|
+
required: z.boolean().optional(),
|
|
43
|
+
nullable: z.boolean().optional(),
|
|
44
|
+
semanticType: z.string().optional(),
|
|
45
|
+
schema: z.unknown(),
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
export const ActionSchema = z.object({
|
|
49
|
+
id: z.string(),
|
|
50
|
+
name: z.string(),
|
|
51
|
+
description: z.string().optional(),
|
|
52
|
+
params: z.array(ActionParamSchema),
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
export const ObjectTypeSchema = z.object({
|
|
56
|
+
id: z.string(),
|
|
57
|
+
name: z.string(),
|
|
58
|
+
description: z.string().optional(),
|
|
59
|
+
extends: z.string().optional(),
|
|
60
|
+
implements: z.array(z.string()).optional(),
|
|
61
|
+
properties: z.array(PropertyDefinitionSchema),
|
|
62
|
+
search: z
|
|
63
|
+
.object({
|
|
64
|
+
title: z.string().optional(),
|
|
65
|
+
defaultText: z.array(z.string()).optional(),
|
|
66
|
+
exact: z.array(z.string()).optional(),
|
|
67
|
+
vector: z
|
|
68
|
+
.object({
|
|
69
|
+
property: z.string(),
|
|
70
|
+
source: z.array(z.string()),
|
|
71
|
+
})
|
|
72
|
+
.optional(),
|
|
73
|
+
})
|
|
74
|
+
.optional(),
|
|
75
|
+
links: z.array(LinkDefinitionSchema),
|
|
76
|
+
actions: z.array(ActionSchema),
|
|
77
|
+
})
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { z } from "zod"
|
|
2
|
+
|
|
3
|
+
export const PipelineParamsSchema = z.object({
|
|
4
|
+
pipelineId: z.string().min(1),
|
|
5
|
+
})
|
|
6
|
+
|
|
7
|
+
export const PipelineRunParamsSchema = z.object({
|
|
8
|
+
runId: z.string().min(1),
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
export const PipelineRunStatusSchema = z.enum(["running", "succeeded", "failed", "cancelled"])
|
|
12
|
+
|
|
13
|
+
export const PipelineRunsQuerySchema = z.object({
|
|
14
|
+
pipelineId: z.string().optional(),
|
|
15
|
+
status: PipelineRunStatusSchema.optional(),
|
|
16
|
+
startedAfter: z.string().optional(),
|
|
17
|
+
startedBefore: z.string().optional(),
|
|
18
|
+
limit: z.string().optional(),
|
|
19
|
+
offset: z.string().optional(),
|
|
20
|
+
order: z.enum(["asc", "desc"]).optional(),
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
const DatasetVersionRefSchema = z.object({
|
|
24
|
+
datasetId: z.string(),
|
|
25
|
+
versionId: z.string(),
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
const DatasetColumnSchema = z.object({
|
|
29
|
+
name: z.string(),
|
|
30
|
+
type: z.enum([
|
|
31
|
+
"string",
|
|
32
|
+
"boolean",
|
|
33
|
+
"int64",
|
|
34
|
+
"float64",
|
|
35
|
+
"decimal",
|
|
36
|
+
"date",
|
|
37
|
+
"timestamp",
|
|
38
|
+
"json",
|
|
39
|
+
"fileRef",
|
|
40
|
+
]),
|
|
41
|
+
nullable: z.boolean().optional(),
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
const DatasetDefinitionSchema = z.object({
|
|
45
|
+
id: z.string(),
|
|
46
|
+
description: z.string().optional(),
|
|
47
|
+
partitionBy: z.array(z.string()).optional(),
|
|
48
|
+
schema: z.object({
|
|
49
|
+
columns: z.array(DatasetColumnSchema),
|
|
50
|
+
}),
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
const PipelineTriggerSchema = z.object({
|
|
54
|
+
type: z.literal("schedule"),
|
|
55
|
+
scheduleId: z.string(),
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
const PipelineStepExecutorSchema = z.union([
|
|
59
|
+
z.object({
|
|
60
|
+
kind: z.literal("sql"),
|
|
61
|
+
dialect: z.literal("duckdb"),
|
|
62
|
+
}),
|
|
63
|
+
z.object({
|
|
64
|
+
kind: z.literal("run"),
|
|
65
|
+
}),
|
|
66
|
+
])
|
|
67
|
+
|
|
68
|
+
export const PipelineRunSchema = z.object({
|
|
69
|
+
id: z.string(),
|
|
70
|
+
projectId: z.string(),
|
|
71
|
+
pipelineId: z.string(),
|
|
72
|
+
status: PipelineRunStatusSchema,
|
|
73
|
+
startedAt: z.string(),
|
|
74
|
+
finishedAt: z.string().optional(),
|
|
75
|
+
output: DatasetVersionRefSchema.optional(),
|
|
76
|
+
error: z
|
|
77
|
+
.object({
|
|
78
|
+
name: z.string().optional(),
|
|
79
|
+
message: z.string(),
|
|
80
|
+
})
|
|
81
|
+
.optional(),
|
|
82
|
+
})
|
|
83
|
+
|
|
84
|
+
export const PipelineStepRunSchema = z.object({
|
|
85
|
+
id: z.string(),
|
|
86
|
+
projectId: z.string(),
|
|
87
|
+
pipelineRunId: z.string(),
|
|
88
|
+
pipelineId: z.string(),
|
|
89
|
+
stepId: z.string(),
|
|
90
|
+
datasetId: z.string(),
|
|
91
|
+
mode: z.enum(["snapshot", "append"]),
|
|
92
|
+
status: PipelineRunStatusSchema,
|
|
93
|
+
startedAt: z.string(),
|
|
94
|
+
finishedAt: z.string().optional(),
|
|
95
|
+
inputs: z.array(DatasetVersionRefSchema),
|
|
96
|
+
output: DatasetVersionRefSchema.optional(),
|
|
97
|
+
rowsWritten: z.number().optional(),
|
|
98
|
+
error: z
|
|
99
|
+
.object({
|
|
100
|
+
name: z.string().optional(),
|
|
101
|
+
message: z.string(),
|
|
102
|
+
})
|
|
103
|
+
.optional(),
|
|
104
|
+
})
|
|
105
|
+
|
|
106
|
+
export const PipelineStepSchema = z.object({
|
|
107
|
+
id: z.string(),
|
|
108
|
+
mode: z.enum(["snapshot", "append"]),
|
|
109
|
+
executor: PipelineStepExecutorSchema,
|
|
110
|
+
inputs: z.array(
|
|
111
|
+
z.object({
|
|
112
|
+
name: z.string(),
|
|
113
|
+
dataset: DatasetDefinitionSchema,
|
|
114
|
+
})
|
|
115
|
+
),
|
|
116
|
+
output: DatasetDefinitionSchema,
|
|
117
|
+
})
|
|
118
|
+
|
|
119
|
+
export const PipelineSchema = z.object({
|
|
120
|
+
id: z.string(),
|
|
121
|
+
triggers: z.array(PipelineTriggerSchema),
|
|
122
|
+
graph: z.object({
|
|
123
|
+
kind: z.literal("sequence"),
|
|
124
|
+
nodes: z.array(
|
|
125
|
+
z.object({
|
|
126
|
+
kind: z.literal("step"),
|
|
127
|
+
step: PipelineStepSchema,
|
|
128
|
+
})
|
|
129
|
+
),
|
|
130
|
+
}),
|
|
131
|
+
latestRun: PipelineRunSchema.nullable(),
|
|
132
|
+
})
|
|
133
|
+
|
|
134
|
+
export const PipelineRunListResponseSchema = z.object({
|
|
135
|
+
runs: z.array(PipelineRunSchema),
|
|
136
|
+
hasMore: z.boolean(),
|
|
137
|
+
total: z.number(),
|
|
138
|
+
})
|
|
139
|
+
|
|
140
|
+
export const PipelineRunDetailResponseSchema = z.object({
|
|
141
|
+
run: PipelineRunSchema,
|
|
142
|
+
steps: z.array(PipelineStepRunSchema),
|
|
143
|
+
})
|
|
144
|
+
|
|
145
|
+
export const RequestPipelineRunResponseSchema = z.object({
|
|
146
|
+
runId: z.string(),
|
|
147
|
+
jobId: z.string(),
|
|
148
|
+
pipelineId: z.string(),
|
|
149
|
+
queuedAt: z.string(),
|
|
150
|
+
})
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { z } from "zod"
|
|
2
|
+
|
|
3
|
+
export const ProjectionKindSchema = z.enum(["object", "link", "telemetry"])
|
|
4
|
+
export const ProjectionRunStatusSchema = z.enum(["running", "succeeded", "failed", "cancelled"])
|
|
5
|
+
|
|
6
|
+
const ProjectionRunIdentityBaseSchema = z.object({
|
|
7
|
+
projectionId: z.string(),
|
|
8
|
+
datasetVersion: z.object({
|
|
9
|
+
datasetId: z.string(),
|
|
10
|
+
versionId: z.string(),
|
|
11
|
+
createdAt: z.string(),
|
|
12
|
+
}),
|
|
13
|
+
ontologyRevision: z.string(),
|
|
14
|
+
projectionRevision: z.string(),
|
|
15
|
+
ownershipHash: z.string(),
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
const ProjectionRunBaseSchema = z.object({
|
|
19
|
+
id: z.string(),
|
|
20
|
+
projectId: z.string(),
|
|
21
|
+
status: ProjectionRunStatusSchema,
|
|
22
|
+
attempt: z.number(),
|
|
23
|
+
progress: z.object({
|
|
24
|
+
sourceRowsRead: z.number(),
|
|
25
|
+
sourceRowsSkipped: z.number(),
|
|
26
|
+
}),
|
|
27
|
+
startedAt: z.string(),
|
|
28
|
+
finishedAt: z.string().optional(),
|
|
29
|
+
errorMessage: z.string().optional(),
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
const ObjectProjectionRunSchema = ProjectionRunBaseSchema.extend({
|
|
33
|
+
identity: ProjectionRunIdentityBaseSchema.extend({
|
|
34
|
+
projectionKind: z.literal("object"),
|
|
35
|
+
protocol: z.literal("replacement"),
|
|
36
|
+
}),
|
|
37
|
+
target: z.object({ objectTypeId: z.string() }),
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
const LinkProjectionRunSchema = ProjectionRunBaseSchema.extend({
|
|
41
|
+
identity: ProjectionRunIdentityBaseSchema.extend({
|
|
42
|
+
projectionKind: z.literal("link"),
|
|
43
|
+
protocol: z.literal("replacement"),
|
|
44
|
+
}),
|
|
45
|
+
target: z.object({
|
|
46
|
+
sourceObjectTypeId: z.string(),
|
|
47
|
+
targetObjectTypeId: z.string(),
|
|
48
|
+
}),
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
const TelemetryProjectionRunSchema = ProjectionRunBaseSchema.extend({
|
|
52
|
+
identity: ProjectionRunIdentityBaseSchema.extend({
|
|
53
|
+
projectionKind: z.literal("telemetry"),
|
|
54
|
+
protocol: z.literal("telemetry"),
|
|
55
|
+
}),
|
|
56
|
+
target: z.object({ objectTypeId: z.string() }),
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
export const ProjectionRunSchema = z.union([
|
|
60
|
+
ObjectProjectionRunSchema,
|
|
61
|
+
LinkProjectionRunSchema,
|
|
62
|
+
TelemetryProjectionRunSchema,
|
|
63
|
+
])
|
|
64
|
+
|
|
65
|
+
export const ForeignKeyDescriptorSchema = z.object({
|
|
66
|
+
linkId: z.string(),
|
|
67
|
+
sourcePropertyId: z.string().optional(),
|
|
68
|
+
sourceField: z.string().optional(),
|
|
69
|
+
targetObjectTypeId: z.string(),
|
|
70
|
+
})
|
|
71
|
+
|
|
72
|
+
export const ObjectProjectionSchema = z.object({
|
|
73
|
+
_tag: z.literal("ObjectProjectionDefinition"),
|
|
74
|
+
id: z.string(),
|
|
75
|
+
objectTypeId: z.string(),
|
|
76
|
+
datasetId: z.string(),
|
|
77
|
+
properties: z.record(z.string()),
|
|
78
|
+
links: z.record(ForeignKeyDescriptorSchema),
|
|
79
|
+
latestRun: ProjectionRunSchema.nullable(),
|
|
80
|
+
})
|
|
81
|
+
|
|
82
|
+
export const LinkProjectionSchema = z.object({
|
|
83
|
+
_tag: z.literal("LinkProjectionDefinition"),
|
|
84
|
+
id: z.string(),
|
|
85
|
+
linkId: z.string(),
|
|
86
|
+
sourceObjectTypeId: z.string(),
|
|
87
|
+
targetObjectTypeId: z.string(),
|
|
88
|
+
datasetId: z.string(),
|
|
89
|
+
sourceField: z.string(),
|
|
90
|
+
targetField: z.string(),
|
|
91
|
+
latestRun: ProjectionRunSchema.nullable(),
|
|
92
|
+
})
|
|
93
|
+
|
|
94
|
+
export const TelemetryProjectionSchema = z.object({
|
|
95
|
+
_tag: z.literal("TelemetryProjectionDefinition"),
|
|
96
|
+
id: z.string(),
|
|
97
|
+
objectTypeId: z.string(),
|
|
98
|
+
propertyId: z.string(),
|
|
99
|
+
datasetId: z.string(),
|
|
100
|
+
objectIdField: z.string(),
|
|
101
|
+
atField: z.string(),
|
|
102
|
+
valueField: z.string(),
|
|
103
|
+
unitField: z.string().optional(),
|
|
104
|
+
latestRun: ProjectionRunSchema.nullable(),
|
|
105
|
+
})
|
|
106
|
+
|
|
107
|
+
export const ProjectionListResponseSchema = z.object({
|
|
108
|
+
objectProjections: z.array(ObjectProjectionSchema),
|
|
109
|
+
linkProjections: z.array(LinkProjectionSchema),
|
|
110
|
+
telemetryProjections: z.array(TelemetryProjectionSchema),
|
|
111
|
+
})
|
|
112
|
+
|
|
113
|
+
export const ProjectionParamsSchema = z.object({
|
|
114
|
+
projectionId: z.string().min(1),
|
|
115
|
+
})
|
|
116
|
+
|
|
117
|
+
export const ProjectionResponseSchema = z.union([
|
|
118
|
+
ObjectProjectionSchema,
|
|
119
|
+
LinkProjectionSchema,
|
|
120
|
+
TelemetryProjectionSchema,
|
|
121
|
+
])
|
|
122
|
+
|
|
123
|
+
export const ProjectionRunParamsSchema = z.object({
|
|
124
|
+
runId: z.string().min(1),
|
|
125
|
+
})
|
|
126
|
+
|
|
127
|
+
export const ProjectionRunsQuerySchema = z.object({
|
|
128
|
+
projectionId: z.string().optional(),
|
|
129
|
+
projectionKind: ProjectionKindSchema.optional(),
|
|
130
|
+
datasetId: z.string().optional(),
|
|
131
|
+
datasetVersionId: z.string().optional(),
|
|
132
|
+
status: ProjectionRunStatusSchema.optional(),
|
|
133
|
+
startedAfter: z.string().optional(),
|
|
134
|
+
startedBefore: z.string().optional(),
|
|
135
|
+
limit: z.string().optional(),
|
|
136
|
+
offset: z.string().optional(),
|
|
137
|
+
order: z.enum(["asc", "desc"]).optional(),
|
|
138
|
+
})
|
|
139
|
+
|
|
140
|
+
export const ProjectionRunListResponseSchema = z.object({
|
|
141
|
+
runs: z.array(ProjectionRunSchema),
|
|
142
|
+
hasMore: z.boolean(),
|
|
143
|
+
total: z.number(),
|
|
144
|
+
})
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import type { RulePredicate } from "@sixb/core"
|
|
2
|
+
import { z } from "zod"
|
|
3
|
+
|
|
4
|
+
export const RuleParamsSchema = z.object({
|
|
5
|
+
ruleId: z.string().min(1),
|
|
6
|
+
})
|
|
7
|
+
|
|
8
|
+
export const RuleStatesQuerySchema = z.object({
|
|
9
|
+
ruleId: z.string().optional(),
|
|
10
|
+
objectTypeId: z.string().optional(),
|
|
11
|
+
primaryId: z.string().optional(),
|
|
12
|
+
limit: z.string().optional(),
|
|
13
|
+
offset: z.string().optional(),
|
|
14
|
+
order: z.enum(["asc", "desc"]).optional(),
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
const RuleValueSchema = z.union([z.string(), z.number(), z.boolean()]).nullable()
|
|
18
|
+
|
|
19
|
+
const RuleSubjectSchema = z.object({
|
|
20
|
+
kind: z.literal("object"),
|
|
21
|
+
objectTypeId: z.string(),
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
const RuleEventSubjectSchema = z.object({
|
|
25
|
+
kind: z.literal("object"),
|
|
26
|
+
objectTypeId: z.string(),
|
|
27
|
+
primaryId: z.string(),
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
const RulePropertyPredicateSchema = z.object({
|
|
31
|
+
kind: z.literal("property"),
|
|
32
|
+
propertyId: z.string(),
|
|
33
|
+
op: z.enum(["eq", "notEq", "gt", "gte", "lt", "lte", "isPresent", "isMissing"]),
|
|
34
|
+
value: RuleValueSchema.optional(),
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
const RuleLinkPredicateSchema = z.object({
|
|
38
|
+
kind: z.literal("link"),
|
|
39
|
+
linkId: z.string(),
|
|
40
|
+
op: z.enum(["exists", "isMissing"]),
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
function createRulePredicateSchema(childPredicateSchema: z.ZodType<unknown>) {
|
|
44
|
+
return z.union([
|
|
45
|
+
z.object({
|
|
46
|
+
kind: z.literal("all"),
|
|
47
|
+
predicates: z.array(childPredicateSchema),
|
|
48
|
+
}),
|
|
49
|
+
z.object({
|
|
50
|
+
kind: z.literal("any"),
|
|
51
|
+
predicates: z.array(childPredicateSchema),
|
|
52
|
+
}),
|
|
53
|
+
z.object({
|
|
54
|
+
kind: z.literal("not"),
|
|
55
|
+
predicate: childPredicateSchema,
|
|
56
|
+
}),
|
|
57
|
+
RulePropertyPredicateSchema,
|
|
58
|
+
RuleLinkPredicateSchema,
|
|
59
|
+
])
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const DeepRulePredicateSchema = createRulePredicateSchema(z.unknown())
|
|
63
|
+
const NestedRulePredicateSchema = createRulePredicateSchema(DeepRulePredicateSchema)
|
|
64
|
+
|
|
65
|
+
export const RulePredicateSchema = NestedRulePredicateSchema as z.ZodType<RulePredicate>
|
|
66
|
+
|
|
67
|
+
const RuleEventDependencySchema = z.union([
|
|
68
|
+
z.object({
|
|
69
|
+
type: z.enum(["object.created", "object.updated", "object.deleted"]),
|
|
70
|
+
objectTypeId: z.string(),
|
|
71
|
+
}),
|
|
72
|
+
z.object({
|
|
73
|
+
type: z.enum(["link.created", "link.updated", "link.deleted"]),
|
|
74
|
+
sourceTypeId: z.string(),
|
|
75
|
+
linkId: z.string(),
|
|
76
|
+
}),
|
|
77
|
+
])
|
|
78
|
+
|
|
79
|
+
export const RuleSchema = z.object({
|
|
80
|
+
kind: z.literal("rule"),
|
|
81
|
+
id: z.string(),
|
|
82
|
+
subject: RuleSubjectSchema,
|
|
83
|
+
predicate: RulePredicateSchema,
|
|
84
|
+
dependencies: z.array(RuleEventDependencySchema),
|
|
85
|
+
})
|
|
86
|
+
|
|
87
|
+
export const RuleStateSchema = z.object({
|
|
88
|
+
projectId: z.string(),
|
|
89
|
+
ruleId: z.string(),
|
|
90
|
+
subject: RuleEventSubjectSchema,
|
|
91
|
+
triggeredAt: z.string(),
|
|
92
|
+
})
|
|
93
|
+
|
|
94
|
+
export const RuleStateListResponseSchema = z.object({
|
|
95
|
+
states: z.array(RuleStateSchema),
|
|
96
|
+
hasMore: z.boolean(),
|
|
97
|
+
total: z.number(),
|
|
98
|
+
})
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { z } from "zod"
|
|
2
|
+
|
|
3
|
+
export const HealthResponseSchema = z.object({ status: z.literal("ok") })
|
|
4
|
+
|
|
5
|
+
const StorageReadinessSchema = z.object({
|
|
6
|
+
reachable: z.boolean(),
|
|
7
|
+
schemaValid: z.boolean(),
|
|
8
|
+
})
|
|
9
|
+
|
|
10
|
+
export const ReadinessResponseSchema = z.object({
|
|
11
|
+
status: z.enum(["ready", "unready"]),
|
|
12
|
+
storage: StorageReadinessSchema,
|
|
13
|
+
reason: z.string().optional(),
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
const MaintenanceSummarySchema = z.object({
|
|
17
|
+
running: z.boolean(),
|
|
18
|
+
intervalMs: z.number().int().positive(),
|
|
19
|
+
lastStartedAt: z.string().nullable(),
|
|
20
|
+
lastCompletedAt: z.string().nullable(),
|
|
21
|
+
lastDurationMs: z.number().nonnegative().nullable(),
|
|
22
|
+
consecutiveFailures: z.number().int().nonnegative(),
|
|
23
|
+
lastError: z.string().nullable(),
|
|
24
|
+
outbox: z
|
|
25
|
+
.object({
|
|
26
|
+
pendingCount: z.number().int().nonnegative(),
|
|
27
|
+
oldestPendingAt: z.string().nullable(),
|
|
28
|
+
retryingCount: z.number().int().nonnegative(),
|
|
29
|
+
maxAttempts: z.number().int().nonnegative(),
|
|
30
|
+
})
|
|
31
|
+
.nullable(),
|
|
32
|
+
terminalSources: z
|
|
33
|
+
.object({
|
|
34
|
+
count: z.number().int().nonnegative(),
|
|
35
|
+
oldestTerminalAt: z.string().nullable(),
|
|
36
|
+
})
|
|
37
|
+
.nullable(),
|
|
38
|
+
cleanup: z
|
|
39
|
+
.object({
|
|
40
|
+
publishedOutboxRowsDeleted: z.number().int().nonnegative(),
|
|
41
|
+
terminalSourceRowsDeleted: z.number().int().nonnegative(),
|
|
42
|
+
terminalSourceMaterializationsDeleted: z.number().int().nonnegative(),
|
|
43
|
+
})
|
|
44
|
+
.nullable(),
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
export const StatusResponseSchema = z.object({
|
|
48
|
+
status: z.enum(["ok", "degraded"]),
|
|
49
|
+
objectTypes: z.number().int().nonnegative(),
|
|
50
|
+
maintenance: MaintenanceSummarySchema,
|
|
51
|
+
})
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { z } from "zod"
|
|
2
|
+
import { DatasetDefinitionSchema } from "./datasets"
|
|
3
|
+
|
|
4
|
+
export const SyncParamsSchema = z.object({
|
|
5
|
+
syncId: z.string().min(1),
|
|
6
|
+
})
|
|
7
|
+
|
|
8
|
+
export const SyncRunStatusSchema = z.enum(["running", "succeeded", "failed", "cancelled"])
|
|
9
|
+
|
|
10
|
+
export const SyncRunsQuerySchema = z.object({
|
|
11
|
+
syncId: z.string().optional(),
|
|
12
|
+
datasetId: z.string().optional(),
|
|
13
|
+
status: SyncRunStatusSchema.optional(),
|
|
14
|
+
startedAfter: z.string().optional(),
|
|
15
|
+
startedBefore: z.string().optional(),
|
|
16
|
+
limit: z.string().optional(),
|
|
17
|
+
offset: z.string().optional(),
|
|
18
|
+
order: z.enum(["asc", "desc"]).optional(),
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
export const RequestSyncRunBodySchema = z.object({
|
|
22
|
+
expectedLatestVersionId: z.string().optional(),
|
|
23
|
+
commitMessage: z.string().optional(),
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
const SyncTriggerSchema = z.object({
|
|
27
|
+
type: z.literal("schedule"),
|
|
28
|
+
scheduleId: z.string(),
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
export const SyncRunSchema = z.object({
|
|
32
|
+
id: z.string(),
|
|
33
|
+
projectId: z.string(),
|
|
34
|
+
syncId: z.string(),
|
|
35
|
+
datasetId: z.string(),
|
|
36
|
+
mode: z.enum(["snapshot", "append"]),
|
|
37
|
+
status: SyncRunStatusSchema,
|
|
38
|
+
startedAt: z.string(),
|
|
39
|
+
finishedAt: z.string().optional(),
|
|
40
|
+
rowsRead: z.number().optional(),
|
|
41
|
+
output: z
|
|
42
|
+
.object({
|
|
43
|
+
datasetId: z.string(),
|
|
44
|
+
versionId: z.string(),
|
|
45
|
+
})
|
|
46
|
+
.optional(),
|
|
47
|
+
expectedLatestVersionId: z.string().optional(),
|
|
48
|
+
commitMessage: z.string().optional(),
|
|
49
|
+
error: z
|
|
50
|
+
.object({
|
|
51
|
+
name: z.string().optional(),
|
|
52
|
+
message: z.string(),
|
|
53
|
+
})
|
|
54
|
+
.optional(),
|
|
55
|
+
})
|
|
56
|
+
|
|
57
|
+
export const SyncSchema = z.object({
|
|
58
|
+
id: z.string(),
|
|
59
|
+
mode: z.enum(["snapshot", "append"]),
|
|
60
|
+
connector: z.object({
|
|
61
|
+
id: z.string(),
|
|
62
|
+
type: z.string(),
|
|
63
|
+
}),
|
|
64
|
+
target: z.object({
|
|
65
|
+
kind: z.literal("dataset"),
|
|
66
|
+
dataset: DatasetDefinitionSchema,
|
|
67
|
+
}),
|
|
68
|
+
triggers: z.array(SyncTriggerSchema),
|
|
69
|
+
latestRun: SyncRunSchema.nullable(),
|
|
70
|
+
})
|
|
71
|
+
|
|
72
|
+
export const SyncRunListResponseSchema = z.object({
|
|
73
|
+
runs: z.array(SyncRunSchema),
|
|
74
|
+
hasMore: z.boolean(),
|
|
75
|
+
total: z.number(),
|
|
76
|
+
})
|
|
77
|
+
|
|
78
|
+
export const RequestSyncRunResponseSchema = z.object({
|
|
79
|
+
runId: z.string(),
|
|
80
|
+
jobId: z.string(),
|
|
81
|
+
syncId: z.string(),
|
|
82
|
+
queuedAt: z.string(),
|
|
83
|
+
})
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { z } from "zod"
|
|
2
|
+
|
|
3
|
+
export const TelemetryParamsSchema = z.object({
|
|
4
|
+
objectTypeId: z.string().min(1),
|
|
5
|
+
objectId: z.string().min(1),
|
|
6
|
+
propertyId: z.string().min(1),
|
|
7
|
+
})
|
|
8
|
+
|
|
9
|
+
export const TelemetryHistoryQuerySchema = z.object({
|
|
10
|
+
from: z.string().optional(),
|
|
11
|
+
to: z.string().optional(),
|
|
12
|
+
limit: z.string().optional(),
|
|
13
|
+
order: z.enum(["asc", "desc"]).optional(),
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
export const BulkTelemetryHistorySeriesInputSchema = z
|
|
17
|
+
.object({
|
|
18
|
+
objectTypeId: z.string().min(1),
|
|
19
|
+
objectId: z.string().min(1),
|
|
20
|
+
propertyId: z.string().min(1),
|
|
21
|
+
})
|
|
22
|
+
.strict()
|
|
23
|
+
|
|
24
|
+
export const BulkTelemetryHistoryBodySchema = z
|
|
25
|
+
.object({
|
|
26
|
+
series: z.array(BulkTelemetryHistorySeriesInputSchema).min(1),
|
|
27
|
+
from: z.string().optional(),
|
|
28
|
+
to: z.string().optional(),
|
|
29
|
+
limitPerSeries: z.number().int().nonnegative().optional(),
|
|
30
|
+
order: z.enum(["asc", "desc"]).optional(),
|
|
31
|
+
})
|
|
32
|
+
.strict()
|
|
33
|
+
|
|
34
|
+
export const AppendTelemetryBodySchema = z.object({
|
|
35
|
+
value: z.unknown(),
|
|
36
|
+
unit: z.string().optional(),
|
|
37
|
+
at: z.string().optional(),
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
export const TelemetryPointSchema = z.object({
|
|
41
|
+
projectId: z.string(),
|
|
42
|
+
objectTypeId: z.string(),
|
|
43
|
+
objectId: z.string(),
|
|
44
|
+
propertyId: z.string(),
|
|
45
|
+
value: z.unknown(),
|
|
46
|
+
unit: z.string().optional(),
|
|
47
|
+
at: z.string(),
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
export const BulkTelemetryHistorySeriesSchema = z.object({
|
|
51
|
+
objectTypeId: z.string(),
|
|
52
|
+
objectId: z.string(),
|
|
53
|
+
propertyId: z.string(),
|
|
54
|
+
points: z.array(TelemetryPointSchema),
|
|
55
|
+
})
|
|
56
|
+
|
|
57
|
+
export const BulkTelemetryHistoryResponseSchema = z.object({
|
|
58
|
+
series: z.array(BulkTelemetryHistorySeriesSchema),
|
|
59
|
+
})
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { z } from "zod"
|
|
2
|
+
|
|
3
|
+
export const WebhookRunStatusSchema = z.enum(["running", "succeeded", "failed", "skipped"])
|
|
4
|
+
|
|
5
|
+
export const WebhookDeliveryClaimResultSchema = z.enum(["claimed", "duplicate", "in_progress"])
|
|
6
|
+
|
|
7
|
+
export const WebhookRunsQuerySchema = z.object({
|
|
8
|
+
connectorId: z.string().optional(),
|
|
9
|
+
webhookId: z.string().optional(),
|
|
10
|
+
status: WebhookRunStatusSchema.optional(),
|
|
11
|
+
idempotencyKey: z.string().optional(),
|
|
12
|
+
startedAfter: z.string().optional(),
|
|
13
|
+
startedBefore: z.string().optional(),
|
|
14
|
+
limit: z.string().optional(),
|
|
15
|
+
offset: z.string().optional(),
|
|
16
|
+
order: z.enum(["asc", "desc"]).optional(),
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
export const WebhookRunSchema = z.object({
|
|
20
|
+
id: z.string(),
|
|
21
|
+
projectId: z.string(),
|
|
22
|
+
connectorId: z.string(),
|
|
23
|
+
webhookId: z.string(),
|
|
24
|
+
status: WebhookRunStatusSchema,
|
|
25
|
+
method: z.string(),
|
|
26
|
+
route: z.string(),
|
|
27
|
+
startedAt: z.string(),
|
|
28
|
+
finishedAt: z.string().optional(),
|
|
29
|
+
requestBodyBytes: z.number().optional(),
|
|
30
|
+
responseStatus: z.number().optional(),
|
|
31
|
+
idempotencyKey: z.string().optional(),
|
|
32
|
+
deliveryClaimResult: WebhookDeliveryClaimResultSchema.optional(),
|
|
33
|
+
error: z.string().optional(),
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
export const WebhookRunListResponseSchema = z.object({
|
|
37
|
+
runs: z.array(WebhookRunSchema),
|
|
38
|
+
hasMore: z.boolean(),
|
|
39
|
+
total: z.number(),
|
|
40
|
+
})
|