@sixb/server 0.1.12 → 0.1.13

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.
Files changed (85) hide show
  1. package/README.md +5 -4
  2. package/dist/auth/access-token-boundary.d.ts +13 -9
  3. package/dist/auth/access-token-boundary.d.ts.map +1 -1
  4. package/dist/auth/client-address.d.ts +12 -0
  5. package/dist/auth/client-address.d.ts.map +1 -0
  6. package/dist/auth/guard.d.ts.map +1 -1
  7. package/dist/auth/public-routes.d.ts +5 -0
  8. package/dist/auth/public-routes.d.ts.map +1 -1
  9. package/dist/auth/rate-limit.d.ts +15 -0
  10. package/dist/auth/rate-limit.d.ts.map +1 -0
  11. package/dist/auth/scope.d.ts +8 -3
  12. package/dist/auth/scope.d.ts.map +1 -1
  13. package/dist/auth/shared-access.d.ts.map +1 -1
  14. package/dist/index.js +578 -455
  15. package/dist/index.js.map +40 -38
  16. package/dist/openapi/security.d.ts +34 -10
  17. package/dist/openapi/security.d.ts.map +1 -1
  18. package/dist/routes/auth.d.ts +64 -17
  19. package/dist/routes/auth.d.ts.map +1 -1
  20. package/dist/routes/connectors.d.ts.map +1 -1
  21. package/dist/routes/events.d.ts +0 -4
  22. package/dist/routes/events.d.ts.map +1 -1
  23. package/dist/routes/files.d.ts +15 -2
  24. package/dist/routes/files.d.ts.map +1 -1
  25. package/dist/routes/models.d.ts +7 -7
  26. package/dist/routes/ontology.d.ts +13 -1
  27. package/dist/routes/ontology.d.ts.map +1 -1
  28. package/dist/routes/shared-access.d.ts.map +1 -1
  29. package/dist/routes/workflows.d.ts +30 -30
  30. package/dist/routes/workflows.d.ts.map +1 -1
  31. package/dist/routes/ws/agents.d.ts +2 -3
  32. package/dist/routes/ws/agents.d.ts.map +1 -1
  33. package/dist/schemas/auth.d.ts +241 -85
  34. package/dist/schemas/auth.d.ts.map +1 -1
  35. package/dist/schemas/common.d.ts +11 -0
  36. package/dist/schemas/common.d.ts.map +1 -1
  37. package/dist/schemas/events.d.ts +74 -44
  38. package/dist/schemas/events.d.ts.map +1 -1
  39. package/dist/schemas/models.d.ts +38 -38
  40. package/dist/schemas/ontology.d.ts +160 -0
  41. package/dist/schemas/ontology.d.ts.map +1 -1
  42. package/dist/schemas/workflows.d.ts +180 -190
  43. package/dist/schemas/workflows.d.ts.map +1 -1
  44. package/dist/server.d.ts +6 -0
  45. package/dist/server.d.ts.map +1 -1
  46. package/dist/utils/ws.d.ts +1 -2
  47. package/dist/utils/ws.d.ts.map +1 -1
  48. package/package.json +4 -4
  49. package/src/auth/access-token-boundary.ts +31 -30
  50. package/src/auth/client-address.ts +67 -0
  51. package/src/auth/guard.ts +13 -4
  52. package/src/auth/public-routes.ts +9 -2
  53. package/src/auth/rate-limit.ts +43 -0
  54. package/src/auth/scope.ts +13 -3
  55. package/src/auth/shared-access.ts +0 -3
  56. package/src/openapi/security.ts +37 -17
  57. package/src/routes/action-runs.ts +5 -5
  58. package/src/routes/actions.ts +4 -4
  59. package/src/routes/agents.ts +9 -9
  60. package/src/routes/ai-accounting.ts +10 -10
  61. package/src/routes/auth.ts +331 -432
  62. package/src/routes/connector-connection-runs.ts +5 -5
  63. package/src/routes/connector-connections.ts +3 -3
  64. package/src/routes/connectors.ts +2 -2
  65. package/src/routes/events.ts +2 -2
  66. package/src/routes/files.ts +30 -15
  67. package/src/routes/links.ts +3 -3
  68. package/src/routes/logs.ts +2 -2
  69. package/src/routes/objects.ts +12 -12
  70. package/src/routes/ontology.ts +27 -9
  71. package/src/routes/pipelines.ts +2 -2
  72. package/src/routes/project.ts +2 -2
  73. package/src/routes/share-grants.ts +4 -4
  74. package/src/routes/shared-access.ts +3 -2
  75. package/src/routes/syncs.ts +2 -2
  76. package/src/routes/telemetry.ts +5 -5
  77. package/src/routes/workflows.ts +18 -19
  78. package/src/routes/ws/agents.ts +4 -5
  79. package/src/schemas/auth.ts +27 -8
  80. package/src/schemas/common.ts +6 -0
  81. package/src/schemas/events.ts +35 -7
  82. package/src/schemas/ontology.ts +16 -1
  83. package/src/schemas/workflows.ts +4 -9
  84. package/src/server.ts +35 -5
  85. package/src/utils/ws.ts +2 -3
@@ -13,7 +13,7 @@ import {
13
13
  serializeConnectorConnection,
14
14
  serializeConnectorConnectionRun,
15
15
  } from "../connectors/http"
16
- import { SIXB_CSRF_SECURITY_REQUIREMENT } from "../openapi/security"
16
+ import { SIXB_SESSION_MUTATION_SECURITY_REQUIREMENT } from "../openapi/security"
17
17
  import { OPENAPI_TAGS } from "../openapi/tags"
18
18
  import { ErrorResponseSchema } from "../schemas/common"
19
19
  import {
@@ -132,7 +132,7 @@ export function registerConnectorConnectionRunRoutes(
132
132
  summary: "Start a connector connection run",
133
133
  tags: [OPENAPI_TAGS.connectorConnectionRuns.name],
134
134
  operationId: "startConnectorConnectionRun",
135
- security: SIXB_CSRF_SECURITY_REQUIREMENT,
135
+ security: SIXB_SESSION_MUTATION_SECURITY_REQUIREMENT,
136
136
  },
137
137
  }
138
138
  )
@@ -209,7 +209,7 @@ export function registerConnectorConnectionRunRoutes(
209
209
  summary: "Add a connector connection from an existing authorization",
210
210
  tags: [OPENAPI_TAGS.connectorConnectionRuns.name],
211
211
  operationId: "addConnectorConnection",
212
- security: SIXB_CSRF_SECURITY_REQUIREMENT,
212
+ security: SIXB_SESSION_MUTATION_SECURITY_REQUIREMENT,
213
213
  },
214
214
  }
215
215
  )
@@ -249,7 +249,7 @@ export function registerConnectorConnectionRunRoutes(
249
249
  summary: "Select a connector account",
250
250
  tags: [OPENAPI_TAGS.connectorConnectionRuns.name],
251
251
  operationId: "selectConnectorConnectionRunAccount",
252
- security: SIXB_CSRF_SECURITY_REQUIREMENT,
252
+ security: SIXB_SESSION_MUTATION_SECURITY_REQUIREMENT,
253
253
  },
254
254
  }
255
255
  )
@@ -309,7 +309,7 @@ export function registerConnectorConnectionRunRoutes(
309
309
  summary: "Reauthorize a connector connection",
310
310
  tags: [OPENAPI_TAGS.connectorConnectionRuns.name],
311
311
  operationId: "reauthorizeConnectorConnection",
312
- security: SIXB_CSRF_SECURITY_REQUIREMENT,
312
+ security: SIXB_SESSION_MUTATION_SECURITY_REQUIREMENT,
313
313
  },
314
314
  }
315
315
  )
@@ -6,7 +6,7 @@ import {
6
6
  handleConnectorRouteError,
7
7
  serializeConnectorConnection,
8
8
  } from "../connectors/http"
9
- import { SIXB_CSRF_SECURITY_REQUIREMENT } from "../openapi/security"
9
+ import { SIXB_SESSION_MUTATION_SECURITY_REQUIREMENT } from "../openapi/security"
10
10
  import { OPENAPI_TAGS } from "../openapi/tags"
11
11
  import { ErrorResponseSchema, SuccessResponseSchema } from "../schemas/common"
12
12
  import {
@@ -90,7 +90,7 @@ export function registerConnectorConnectionRoutes(app: Elysia, host: SixbHostVie
90
90
  summary: "Disconnect a connector account",
91
91
  tags: [OPENAPI_TAGS.connectorConnections.name],
92
92
  operationId: "disconnectConnectorConnection",
93
- security: SIXB_CSRF_SECURITY_REQUIREMENT,
93
+ security: SIXB_SESSION_MUTATION_SECURITY_REQUIREMENT,
94
94
  },
95
95
  }
96
96
  )
@@ -128,7 +128,7 @@ export function registerConnectorConnectionRoutes(app: Elysia, host: SixbHostVie
128
128
  summary: "Revoke a connector authorization",
129
129
  tags: [OPENAPI_TAGS.connectorConnections.name],
130
130
  operationId: "revokeConnectorConnection",
131
- security: SIXB_CSRF_SECURITY_REQUIREMENT,
131
+ security: SIXB_SESSION_MUTATION_SECURITY_REQUIREMENT,
132
132
  },
133
133
  }
134
134
  )
@@ -1,4 +1,4 @@
1
- import type { OntologySource, SixbHostView } from "@sixb/core"
1
+ import type { SixbHostView } from "@sixb/core"
2
2
  import { isOAuthConnectorDefinition } from "@sixb/core/internal/connector-connections"
3
3
  import type { Sixb } from "@sixb/core/internal/request-execution"
4
4
  import type { Elysia } from "elysia"
@@ -10,7 +10,7 @@ import { ConnectorParamsSchema, ConnectorSchema } from "../schemas/connectors"
10
10
  function serializeConnector(
11
11
  connector: ReturnType<SixbHostView["definitions"]["connectors"]["list"]>[number],
12
12
  host: SixbHostView,
13
- execution: Sixb<readonly OntologySource[]>
13
+ execution: Sixb
14
14
  ) {
15
15
  return {
16
16
  id: connector.id,
@@ -1,6 +1,6 @@
1
1
  import { AuthorizationError, type SixbHostView } from "@sixb/core"
2
2
  import type { Elysia } from "elysia"
3
- import { bearerSecurityRequirement } from "../auth/access-token-boundary"
3
+ import { accessTokenSecurityRequirement } from "../auth/access-token-boundary"
4
4
  import { requireRequestSixb } from "../auth/scope"
5
5
  import { OPENAPI_TAGS } from "../openapi/tags"
6
6
  import { ErrorResponseSchema } from "../schemas/common"
@@ -48,7 +48,7 @@ export function registerEventRoutes(app: Elysia, _host: SixbHostView) {
48
48
  summary: "Read domain events",
49
49
  tags: [OPENAPI_TAGS.events.name],
50
50
  operationId: "listEvents",
51
- security: bearerSecurityRequirement("listEvents"),
51
+ security: accessTokenSecurityRequirement("listEvents"),
52
52
  },
53
53
  }
54
54
  )
@@ -2,7 +2,6 @@ import {
2
2
  type BlobDigest,
3
3
  DEFAULT_SIMPLE_FILE_UPLOAD_BYTES,
4
4
  type FileRef,
5
- InMemoryFileUploadSessions,
6
5
  type SixbHostView,
7
6
  SYSTEM_PRINCIPAL,
8
7
  } from "@sixb/core"
@@ -10,9 +9,9 @@ import { computeBlobDigest, supportsDirectUpload } from "@sixb/core/blob-storage
10
9
  import { createFileUploadId, createUploadExpiresAt } from "@sixb/core/internal/storage"
11
10
  import { type FileUploadSession, FileUploadSessionError } from "@sixb/core/storage"
12
11
  import type { Elysia } from "elysia"
13
- import { bearerSecurityRequirement } from "../auth/access-token-boundary"
12
+ import { accessTokenSecurityRequirement } from "../auth/access-token-boundary"
14
13
  import { requireRequestSixb } from "../auth/scope"
15
- import { SIXB_CSRF_SECURITY_REQUIREMENT } from "../openapi/security"
14
+ import { SIXB_SESSION_MUTATION_SECURITY_REQUIREMENT } from "../openapi/security"
16
15
  import { OPENAPI_TAGS } from "../openapi/tags"
17
16
  import { ErrorResponseSchema, SuccessResponseSchema } from "../schemas/common"
18
17
  import {
@@ -24,7 +23,7 @@ import {
24
23
  FileUploadPartParamsSchema,
25
24
  SignedFileUploadPartSchema,
26
25
  } from "../schemas/files"
27
- import { handleRouteError } from "../utils/http"
26
+ import { handleRouteError, unconfiguredStorageResponse } from "../utils/http"
28
27
  import { RequestBodyTooLargeError, readRequestBodyWithLimit } from "../utils/request-body"
29
28
  // The simple-upload ceiling lives in @sixb/core so the client staged-switch
30
29
  // threshold and this server limit stay a single source of truth. The body limit
@@ -33,11 +32,7 @@ import { RequestBodyTooLargeError, readRequestBodyWithLimit } from "../utils/req
33
32
  export const DEFAULT_SIMPLE_FILE_UPLOAD_BODY_BYTES = DEFAULT_SIMPLE_FILE_UPLOAD_BYTES + 1024 * 1024
34
33
 
35
34
  export function registerFileRoutes(app: Elysia, host: SixbHostView) {
36
- // Staged/direct-put upload sessions default to an in-memory store: they are NOT
37
- // durable across restart and NOT shared across instances. A durable Pg/Sqlite
38
- // store is a follow-up; deployments needing durability supply their own via
39
- // `host.storage.fileUploadSessions`.
40
- const uploadSessions = host.storage.fileUploadSessions ?? new InMemoryFileUploadSessions()
35
+ const uploadSessions = host.storage.fileUploadSessions
41
36
 
42
37
  return app
43
38
  .post(
@@ -96,7 +91,7 @@ export function registerFileRoutes(app: Elysia, host: SixbHostView) {
96
91
  summary: "Upload a file",
97
92
  tags: [OPENAPI_TAGS.files.name],
98
93
  operationId: "uploadFileRaw",
99
- security: bearerSecurityRequirement("uploadFileRaw"),
94
+ security: accessTokenSecurityRequirement("uploadFileRaw"),
100
95
  requestBody: {
101
96
  required: true,
102
97
  content: {
@@ -125,6 +120,9 @@ export function registerFileRoutes(app: Elysia, host: SixbHostView) {
125
120
  async (context) => {
126
121
  const { body, set } = context
127
122
  try {
123
+ if (!uploadSessions) {
124
+ return unconfiguredStorageResponse(set, "File upload session storage")
125
+ }
128
126
  const parsed = CreateFileUploadBodySchema.parse(body)
129
127
  const principal = requireRequestSixb(context).execution.requestedBy ?? SYSTEM_PRINCIPAL
130
128
  const uploadId = createFileUploadId()
@@ -170,12 +168,13 @@ export function registerFileRoutes(app: Elysia, host: SixbHostView) {
170
168
  response: {
171
169
  201: CreateFileUploadResponseSchema,
172
170
  400: ErrorResponseSchema,
171
+ 501: ErrorResponseSchema,
173
172
  },
174
173
  detail: {
175
174
  summary: "Create a staged file upload",
176
175
  tags: [OPENAPI_TAGS.files.name],
177
176
  operationId: "createFileUpload",
178
- security: SIXB_CSRF_SECURITY_REQUIREMENT,
177
+ security: SIXB_SESSION_MUTATION_SECURITY_REQUIREMENT,
179
178
  },
180
179
  }
181
180
  )
@@ -184,6 +183,9 @@ export function registerFileRoutes(app: Elysia, host: SixbHostView) {
184
183
  async (context) => {
185
184
  const { params, request, set } = context
186
185
  try {
186
+ if (!uploadSessions) {
187
+ return unconfiguredStorageResponse(set, "File upload session storage")
188
+ }
187
189
  const principal = requireRequestSixb(context).execution.requestedBy ?? SYSTEM_PRINCIPAL
188
190
  const session = await uploadSessions.getForPrincipal(params.uploadId, principal)
189
191
  if (session.status !== "pending") {
@@ -247,12 +249,13 @@ export function registerFileRoutes(app: Elysia, host: SixbHostView) {
247
249
  404: ErrorResponseSchema,
248
250
  409: ErrorResponseSchema,
249
251
  410: ErrorResponseSchema,
252
+ 501: ErrorResponseSchema,
250
253
  },
251
254
  detail: {
252
255
  summary: "Upload staged file content through Sixb",
253
256
  tags: [OPENAPI_TAGS.files.name],
254
257
  operationId: "uploadFileContent",
255
- security: SIXB_CSRF_SECURITY_REQUIREMENT,
258
+ security: SIXB_SESSION_MUTATION_SECURITY_REQUIREMENT,
256
259
  requestBody: {
257
260
  required: true,
258
261
  content: {
@@ -272,6 +275,9 @@ export function registerFileRoutes(app: Elysia, host: SixbHostView) {
272
275
  async (context) => {
273
276
  const { params, set } = context
274
277
  try {
278
+ if (!uploadSessions) {
279
+ return unconfiguredStorageResponse(set, "File upload session storage")
280
+ }
275
281
  const principal = requireRequestSixb(context).execution.requestedBy ?? SYSTEM_PRINCIPAL
276
282
  const session = await uploadSessions.getForPrincipal(params.uploadId, principal)
277
283
  if (session.status !== "pending") {
@@ -316,12 +322,13 @@ export function registerFileRoutes(app: Elysia, host: SixbHostView) {
316
322
  404: ErrorResponseSchema,
317
323
  409: ErrorResponseSchema,
318
324
  410: ErrorResponseSchema,
325
+ 501: ErrorResponseSchema,
319
326
  },
320
327
  detail: {
321
328
  summary: "Sign a staged multipart upload part",
322
329
  tags: [OPENAPI_TAGS.files.name],
323
330
  operationId: "signFileUploadPart",
324
- security: SIXB_CSRF_SECURITY_REQUIREMENT,
331
+ security: SIXB_SESSION_MUTATION_SECURITY_REQUIREMENT,
325
332
  },
326
333
  }
327
334
  )
@@ -330,6 +337,9 @@ export function registerFileRoutes(app: Elysia, host: SixbHostView) {
330
337
  async (context) => {
331
338
  const { body, params, set } = context
332
339
  try {
340
+ if (!uploadSessions) {
341
+ return unconfiguredStorageResponse(set, "File upload session storage")
342
+ }
333
343
  const principal = requireRequestSixb(context).execution.requestedBy ?? SYSTEM_PRINCIPAL
334
344
  const parsed = CompleteFileUploadBodySchema.parse(body ?? {})
335
345
  const session = await uploadSessions.getForPrincipal(params.uploadId, principal)
@@ -385,12 +395,13 @@ export function registerFileRoutes(app: Elysia, host: SixbHostView) {
385
395
  404: ErrorResponseSchema,
386
396
  409: ErrorResponseSchema,
387
397
  410: ErrorResponseSchema,
398
+ 501: ErrorResponseSchema,
388
399
  },
389
400
  detail: {
390
401
  summary: "Complete a staged file upload",
391
402
  tags: [OPENAPI_TAGS.files.name],
392
403
  operationId: "completeFileUpload",
393
- security: SIXB_CSRF_SECURITY_REQUIREMENT,
404
+ security: SIXB_SESSION_MUTATION_SECURITY_REQUIREMENT,
394
405
  },
395
406
  }
396
407
  )
@@ -399,6 +410,9 @@ export function registerFileRoutes(app: Elysia, host: SixbHostView) {
399
410
  async (context) => {
400
411
  const { params, set } = context
401
412
  try {
413
+ if (!uploadSessions) {
414
+ return unconfiguredStorageResponse(set, "File upload session storage")
415
+ }
402
416
  const principal = requireRequestSixb(context).execution.requestedBy ?? SYSTEM_PRINCIPAL
403
417
  const session = await uploadSessions.getForPrincipal(params.uploadId, principal)
404
418
 
@@ -439,12 +453,13 @@ export function registerFileRoutes(app: Elysia, host: SixbHostView) {
439
453
  404: ErrorResponseSchema,
440
454
  409: ErrorResponseSchema,
441
455
  410: ErrorResponseSchema,
456
+ 501: ErrorResponseSchema,
442
457
  },
443
458
  detail: {
444
459
  summary: "Abort a staged file upload",
445
460
  tags: [OPENAPI_TAGS.files.name],
446
461
  operationId: "abortFileUpload",
447
- security: SIXB_CSRF_SECURITY_REQUIREMENT,
462
+ security: SIXB_SESSION_MUTATION_SECURITY_REQUIREMENT,
448
463
  },
449
464
  }
450
465
  )
@@ -1,6 +1,6 @@
1
1
  import type { SixbHostView } from "@sixb/core"
2
2
  import type { Elysia } from "elysia"
3
- import { bearerSecurityRequirement } from "../auth/access-token-boundary"
3
+ import { accessTokenSecurityRequirement } from "../auth/access-token-boundary"
4
4
  import { requireRequestSixb } from "../auth/scope"
5
5
  import { OPENAPI_TAGS } from "../openapi/tags"
6
6
  import { ErrorResponseSchema, SuccessResponseSchema } from "../schemas/common"
@@ -44,7 +44,7 @@ export function registerLinkRoutes(app: Elysia, _host: SixbHostView) {
44
44
  summary: "Create or update object link",
45
45
  tags: [OPENAPI_TAGS.links.name],
46
46
  operationId: "upsertObjectLink",
47
- security: bearerSecurityRequirement("upsertObjectLink"),
47
+ security: accessTokenSecurityRequirement("upsertObjectLink"),
48
48
  },
49
49
  }
50
50
  )
@@ -82,7 +82,7 @@ export function registerLinkRoutes(app: Elysia, _host: SixbHostView) {
82
82
  summary: "Remove object link",
83
83
  tags: [OPENAPI_TAGS.links.name],
84
84
  operationId: "removeObjectLink",
85
- security: bearerSecurityRequirement("removeObjectLink"),
85
+ security: accessTokenSecurityRequirement("removeObjectLink"),
86
86
  },
87
87
  }
88
88
  )
@@ -1,6 +1,6 @@
1
1
  import { logLevelsAtOrAbove, type SixbHostView } from "@sixb/core"
2
2
  import type { Elysia } from "elysia"
3
- import { bearerSecurityRequirement } from "../auth/access-token-boundary"
3
+ import { accessTokenSecurityRequirement } from "../auth/access-token-boundary"
4
4
  import { requireRequestSixb } from "../auth/scope"
5
5
  import { OPENAPI_TAGS } from "../openapi/tags"
6
6
  import { ErrorResponseSchema } from "../schemas/common"
@@ -53,7 +53,7 @@ export function registerLogRoutes(app: Elysia, _host: SixbHostView) {
53
53
  summary: "Read run logs",
54
54
  tags: [OPENAPI_TAGS.logs.name],
55
55
  operationId: "listLogs",
56
- security: bearerSecurityRequirement("listLogs"),
56
+ security: accessTokenSecurityRequirement("listLogs"),
57
57
  },
58
58
  }
59
59
  )
@@ -15,7 +15,7 @@ import type {
15
15
  } from "@sixb/core/storage"
16
16
  import type { Elysia } from "elysia"
17
17
  import { ZodError, z } from "zod"
18
- import { bearerSecurityRequirement } from "../auth/access-token-boundary"
18
+ import { accessTokenSecurityRequirement } from "../auth/access-token-boundary"
19
19
  import { requireRequestSixb } from "../auth/scope"
20
20
  import {
21
21
  createContextualFileContentResponse,
@@ -335,7 +335,7 @@ export function registerObjectRoutes(app: Elysia, host: SixbHostView) {
335
335
  summary: "Search objects",
336
336
  tags: [OPENAPI_TAGS.objects.name],
337
337
  operationId: "searchObjects",
338
- security: bearerSecurityRequirement("searchObjects"),
338
+ security: accessTokenSecurityRequirement("searchObjects"),
339
339
  },
340
340
  }
341
341
  )
@@ -393,7 +393,7 @@ export function registerObjectRoutes(app: Elysia, host: SixbHostView) {
393
393
  summary: "List objects",
394
394
  tags: [OPENAPI_TAGS.objects.name],
395
395
  operationId: "listObjects",
396
- security: bearerSecurityRequirement("listObjects"),
396
+ security: accessTokenSecurityRequirement("listObjects"),
397
397
  },
398
398
  }
399
399
  )
@@ -428,7 +428,7 @@ export function registerObjectRoutes(app: Elysia, host: SixbHostView) {
428
428
  summary: "Query objects",
429
429
  tags: [OPENAPI_TAGS.objects.name],
430
430
  operationId: "queryObjects",
431
- security: bearerSecurityRequirement("queryObjects"),
431
+ security: accessTokenSecurityRequirement("queryObjects"),
432
432
  requestBody: {
433
433
  required: true,
434
434
  content: {
@@ -518,7 +518,7 @@ export function registerObjectRoutes(app: Elysia, host: SixbHostView) {
518
518
  summary: "Query object links",
519
519
  tags: [OPENAPI_TAGS.links.name],
520
520
  operationId: "queryObjectLinks",
521
- security: bearerSecurityRequirement("queryObjectLinks"),
521
+ security: accessTokenSecurityRequirement("queryObjectLinks"),
522
522
  requestBody: {
523
523
  required: true,
524
524
  content: {
@@ -587,7 +587,7 @@ export function registerObjectRoutes(app: Elysia, host: SixbHostView) {
587
587
  summary: "Count objects",
588
588
  tags: [OPENAPI_TAGS.objects.name],
589
589
  operationId: "countObjects",
590
- security: bearerSecurityRequirement("countObjects"),
590
+ security: accessTokenSecurityRequirement("countObjects"),
591
591
  requestBody: {
592
592
  required: true,
593
593
  content: {
@@ -670,7 +670,7 @@ export function registerObjectRoutes(app: Elysia, host: SixbHostView) {
670
670
  summary: "Check object existence",
671
671
  tags: [OPENAPI_TAGS.objects.name],
672
672
  operationId: "existsObjects",
673
- security: bearerSecurityRequirement("existsObjects"),
673
+ security: accessTokenSecurityRequirement("existsObjects"),
674
674
  requestBody: {
675
675
  required: true,
676
676
  content: {
@@ -757,7 +757,7 @@ export function registerObjectRoutes(app: Elysia, host: SixbHostView) {
757
757
  summary: "Facet objects",
758
758
  tags: [OPENAPI_TAGS.objects.name],
759
759
  operationId: "facetObjects",
760
- security: bearerSecurityRequirement("facetObjects"),
760
+ security: accessTokenSecurityRequirement("facetObjects"),
761
761
  requestBody: {
762
762
  required: true,
763
763
  content: {
@@ -821,7 +821,7 @@ export function registerObjectRoutes(app: Elysia, host: SixbHostView) {
821
821
  summary: "Get object file content",
822
822
  tags: [OPENAPI_TAGS.objectFiles.name],
823
823
  operationId: "getObjectFileContent",
824
- security: bearerSecurityRequirement("getObjectFileContent"),
824
+ security: accessTokenSecurityRequirement("getObjectFileContent"),
825
825
  responses: fileContentGetResponses(),
826
826
  },
827
827
  }
@@ -840,7 +840,7 @@ export function registerObjectRoutes(app: Elysia, host: SixbHostView) {
840
840
  summary: "Head object file content",
841
841
  tags: [OPENAPI_TAGS.objectFiles.name],
842
842
  operationId: "headObjectFileContent",
843
- security: bearerSecurityRequirement("headObjectFileContent"),
843
+ security: accessTokenSecurityRequirement("headObjectFileContent"),
844
844
  responses: fileContentHeadResponses(),
845
845
  },
846
846
  }
@@ -876,7 +876,7 @@ export function registerObjectRoutes(app: Elysia, host: SixbHostView) {
876
876
  summary: "Get object by id",
877
877
  tags: [OPENAPI_TAGS.objects.name],
878
878
  operationId: "getObject",
879
- security: bearerSecurityRequirement("getObject"),
879
+ security: accessTokenSecurityRequirement("getObject"),
880
880
  },
881
881
  }
882
882
  )
@@ -915,7 +915,7 @@ export function registerObjectRoutes(app: Elysia, host: SixbHostView) {
915
915
  summary: "Create or update object",
916
916
  tags: [OPENAPI_TAGS.objects.name],
917
917
  operationId: "upsertObject",
918
- security: bearerSecurityRequirement("upsertObject"),
918
+ security: accessTokenSecurityRequirement("upsertObject"),
919
919
  },
920
920
  }
921
921
  )
@@ -1,7 +1,8 @@
1
- import type { OntologySource, SixbHostView } from "@sixb/core"
1
+ import type { Property, SixbHostView, ValueType } from "@sixb/core"
2
+ import { resolvePropertyQueryCapabilities } from "@sixb/core/internal/ontology"
2
3
  import type { Sixb } from "@sixb/core/internal/request-execution"
3
4
  import type { Elysia } from "elysia"
4
- import { bearerSecurityRequirement } from "../auth/access-token-boundary"
5
+ import { accessTokenSecurityRequirement } from "../auth/access-token-boundary"
5
6
  import { requireRequestSixb } from "../auth/scope"
6
7
  import { OPENAPI_TAGS } from "../openapi/tags"
7
8
  import { ErrorResponseSchema } from "../schemas/common"
@@ -26,6 +27,17 @@ function serializeProperty(
26
27
  }
27
28
  }
28
29
 
30
+ function serializeObjectProperty(
31
+ property: Property,
32
+ valueTypesById: ReadonlyMap<string, ValueType>
33
+ ) {
34
+ const capabilities = resolvePropertyQueryCapabilities(property, valueTypesById)
35
+ return {
36
+ ...serializeProperty(property),
37
+ capabilities: { ...capabilities, operators: [...capabilities.operators] },
38
+ }
39
+ }
40
+
29
41
  function serializeSearch(
30
42
  search: ReturnType<SixbHostView["definitions"]["ontology"]["listObjectTypes"]>[number]["search"]
31
43
  ) {
@@ -54,7 +66,8 @@ function serializeSearch(
54
66
  }
55
67
 
56
68
  function serializeObjectType(
57
- execution: Sixb<readonly OntologySource[]>,
69
+ execution: Sixb,
70
+ valueTypesById: ReadonlyMap<string, ValueType>,
58
71
  objectType: ReturnType<SixbHostView["definitions"]["ontology"]["listObjectTypes"]>[number]
59
72
  ) {
60
73
  return {
@@ -63,7 +76,9 @@ function serializeObjectType(
63
76
  description: objectType.description,
64
77
  extends: objectType.extends,
65
78
  implements: objectType.implements ? [...objectType.implements] : undefined,
66
- properties: objectType.properties.map(serializeProperty),
79
+ properties: objectType.properties.map((property) =>
80
+ serializeObjectProperty(property, valueTypesById)
81
+ ),
67
82
  search: serializeSearch(objectType.search),
68
83
  links: objectType.links.map((link) => ({
69
84
  id: link.id,
@@ -92,13 +107,16 @@ function serializeObjectType(
92
107
  }
93
108
  }
94
109
 
95
- export function registerOntologyRoutes(app: Elysia, _host: SixbHostView) {
110
+ export function registerOntologyRoutes(app: Elysia, host: SixbHostView) {
96
111
  return app
97
112
  .get(
98
113
  "/api/object-types",
99
114
  async (context) => {
100
115
  const sixb = requireRequestSixb(context)
101
- return sixb.objects.listTypes().map((objectType) => serializeObjectType(sixb, objectType))
116
+ const valueTypesById = host.definitions.ontology.getValueTypesById()
117
+ return sixb.objects
118
+ .listTypes()
119
+ .map((objectType) => serializeObjectType(sixb, valueTypesById, objectType))
102
120
  },
103
121
  {
104
122
  response: { 200: ObjectTypeSchema.array() },
@@ -106,7 +124,7 @@ export function registerOntologyRoutes(app: Elysia, _host: SixbHostView) {
106
124
  summary: "List registered object types",
107
125
  tags: [OPENAPI_TAGS.ontology.name],
108
126
  operationId: "listObjectTypes",
109
- security: bearerSecurityRequirement("listObjectTypes"),
127
+ security: accessTokenSecurityRequirement("listObjectTypes"),
110
128
  },
111
129
  }
112
130
  )
@@ -121,7 +139,7 @@ export function registerOntologyRoutes(app: Elysia, _host: SixbHostView) {
121
139
  return { error: "Object type not found" }
122
140
  }
123
141
 
124
- return serializeObjectType(sixb, objectType)
142
+ return serializeObjectType(sixb, host.definitions.ontology.getValueTypesById(), objectType)
125
143
  },
126
144
  {
127
145
  params: ObjectTypeParamsSchema,
@@ -130,7 +148,7 @@ export function registerOntologyRoutes(app: Elysia, _host: SixbHostView) {
130
148
  summary: "Get object type definition",
131
149
  tags: [OPENAPI_TAGS.ontology.name],
132
150
  operationId: "getObjectType",
133
- security: bearerSecurityRequirement("getObjectType"),
151
+ security: accessTokenSecurityRequirement("getObjectType"),
134
152
  },
135
153
  }
136
154
  )
@@ -2,7 +2,7 @@ import type { PipelineDefinition, PipelineStepExecutor, SixbHostView } from "@si
2
2
  import type { PipelineRunRecord, PipelineStepRunRecord } from "@sixb/core/storage"
3
3
  import type { Elysia } from "elysia"
4
4
  import { requireRequestSixb } from "../auth/scope"
5
- import { SIXB_CSRF_SECURITY_REQUIREMENT } from "../openapi/security"
5
+ import { SIXB_SESSION_MUTATION_SECURITY_REQUIREMENT } from "../openapi/security"
6
6
  import { OPENAPI_TAGS } from "../openapi/tags"
7
7
  import { ErrorResponseSchema } from "../schemas/common"
8
8
  import {
@@ -291,7 +291,7 @@ export function registerPipelineRoutes(app: Elysia, host: SixbHostView) {
291
291
  summary: "Request a pipeline run",
292
292
  tags: [OPENAPI_TAGS.pipelineRuns.name],
293
293
  operationId: "requestPipelineRun",
294
- security: SIXB_CSRF_SECURITY_REQUIREMENT,
294
+ security: SIXB_SESSION_MUTATION_SECURITY_REQUIREMENT,
295
295
  },
296
296
  }
297
297
  )
@@ -1,6 +1,6 @@
1
1
  import type { SixbHostView } from "@sixb/core"
2
2
  import type { Elysia } from "elysia"
3
- import { bearerSecurityRequirement } from "../auth/access-token-boundary"
3
+ import { accessTokenSecurityRequirement } from "../auth/access-token-boundary"
4
4
  import { OPENAPI_TAGS } from "../openapi/tags"
5
5
  import { ProjectInfoResponseSchema } from "../schemas/project"
6
6
  export function registerProjectRoutes(app: Elysia, host: SixbHostView) {
@@ -10,7 +10,7 @@ export function registerProjectRoutes(app: Elysia, host: SixbHostView) {
10
10
  summary: "Get current project metadata",
11
11
  tags: [OPENAPI_TAGS.project.name],
12
12
  operationId: "getProjectInfo",
13
- security: bearerSecurityRequirement("getProjectInfo"),
13
+ security: accessTokenSecurityRequirement("getProjectInfo"),
14
14
  },
15
15
  })
16
16
  }
@@ -6,7 +6,7 @@ import {
6
6
  } from "@sixb/core"
7
7
  import { ObjectNotFoundError } from "@sixb/core/storage"
8
8
  import type { Elysia } from "elysia"
9
- import { bearerSecurityRequirement } from "../auth/access-token-boundary"
9
+ import { accessTokenSecurityRequirement } from "../auth/access-token-boundary"
10
10
  import { requireRequestSixb } from "../auth/scope"
11
11
  import { OPENAPI_TAGS } from "../openapi/tags"
12
12
  import { ErrorResponseSchema } from "../schemas/common"
@@ -65,7 +65,7 @@ export function registerShareGrantRoutes(app: Elysia, _host: SixbHostView) {
65
65
  summary: "Issue a shared-access grant",
66
66
  tags: [OPENAPI_TAGS.sharedAccess.name],
67
67
  operationId: "issueSharedAccessGrant",
68
- security: bearerSecurityRequirement("issueSharedAccessGrant"),
68
+ security: accessTokenSecurityRequirement("issueSharedAccessGrant"),
69
69
  },
70
70
  }
71
71
  )
@@ -109,7 +109,7 @@ export function registerShareGrantRoutes(app: Elysia, _host: SixbHostView) {
109
109
  summary: "List shared-access grants",
110
110
  tags: [OPENAPI_TAGS.sharedAccess.name],
111
111
  operationId: "listSharedAccessGrants",
112
- security: bearerSecurityRequirement("listSharedAccessGrants"),
112
+ security: accessTokenSecurityRequirement("listSharedAccessGrants"),
113
113
  },
114
114
  }
115
115
  )
@@ -148,7 +148,7 @@ export function registerShareGrantRoutes(app: Elysia, _host: SixbHostView) {
148
148
  summary: "Revoke a shared-access grant",
149
149
  tags: [OPENAPI_TAGS.sharedAccess.name],
150
150
  operationId: "revokeSharedAccessGrant",
151
- security: bearerSecurityRequirement("revokeSharedAccessGrant"),
151
+ security: accessTokenSecurityRequirement("revokeSharedAccessGrant"),
152
152
  },
153
153
  }
154
154
  )
@@ -8,7 +8,7 @@ import {
8
8
  sharedAccessUnauthenticatedResponse,
9
9
  sharedAccessUnavailableResponse,
10
10
  } from "../auth/shared-access"
11
- import { SIXB_CSRF_SECURITY_REQUIREMENT } from "../openapi/security"
11
+ import { SIXB_CSRF_SECURITY_SCHEME_ID } from "../openapi/security"
12
12
  import { OPENAPI_TAGS } from "../openapi/tags"
13
13
  import { ErrorResponseSchema } from "../schemas/common"
14
14
  import {
@@ -112,7 +112,8 @@ export function registerSharedAccessRoutes(app: Elysia, boundary: SharedAccessBo
112
112
  summary: "Sign out a shared-access session",
113
113
  tags: [OPENAPI_TAGS.sharedAccess.name],
114
114
  operationId: "signOutSharedAccess",
115
- security: SIXB_CSRF_SECURITY_REQUIREMENT,
115
+ // Succeeds for anyone; a Share's session cookie also needs its CSRF token.
116
+ security: [{ [SIXB_CSRF_SECURITY_SCHEME_ID]: [] }, {}],
116
117
  },
117
118
  }
118
119
  )
@@ -2,7 +2,7 @@ import type { SixbHostView, SyncDefinition } from "@sixb/core"
2
2
  import type { SyncRunRecord } from "@sixb/core/storage"
3
3
  import type { Elysia } from "elysia"
4
4
  import { requireRequestSixb } from "../auth/scope"
5
- import { SIXB_CSRF_SECURITY_REQUIREMENT } from "../openapi/security"
5
+ import { SIXB_SESSION_MUTATION_SECURITY_REQUIREMENT } from "../openapi/security"
6
6
  import { OPENAPI_TAGS } from "../openapi/tags"
7
7
  import { ErrorResponseSchema } from "../schemas/common"
8
8
  import {
@@ -210,7 +210,7 @@ export function registerSyncRoutes(app: Elysia, host: SixbHostView) {
210
210
  summary: "Request a sync run",
211
211
  tags: [OPENAPI_TAGS.syncRuns.name],
212
212
  operationId: "requestSyncRun",
213
- security: SIXB_CSRF_SECURITY_REQUIREMENT,
213
+ security: SIXB_SESSION_MUTATION_SECURITY_REQUIREMENT,
214
214
  },
215
215
  }
216
216
  )