@sixb/server 0.1.2 → 0.1.3

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 (72) hide show
  1. package/dist/auth/experience.d.ts +33 -0
  2. package/dist/auth/experience.d.ts.map +1 -0
  3. package/dist/auth/public-routes.d.ts.map +1 -1
  4. package/dist/index.d.ts +1 -0
  5. package/dist/index.d.ts.map +1 -1
  6. package/dist/index.js +1891 -1337
  7. package/dist/index.js.map +17 -14
  8. package/dist/openapi/tags.d.ts +6 -2
  9. package/dist/openapi/tags.d.ts.map +1 -1
  10. package/dist/registerRoutes.d.ts.map +1 -1
  11. package/dist/routes/action-runs.d.ts +6 -6
  12. package/dist/routes/actions.d.ts +3 -3
  13. package/dist/routes/agents.d.ts +149 -77
  14. package/dist/routes/agents.d.ts.map +1 -1
  15. package/dist/routes/ai-accounting.d.ts +31 -0
  16. package/dist/routes/ai-accounting.d.ts.map +1 -0
  17. package/dist/routes/auth.d.ts +110 -53
  18. package/dist/routes/auth.d.ts.map +1 -1
  19. package/dist/routes/connector-connection-runs.d.ts +56 -56
  20. package/dist/routes/connector-connections.d.ts +14 -14
  21. package/dist/routes/datasets.d.ts +12 -12
  22. package/dist/routes/events.d.ts +1 -1
  23. package/dist/routes/files.d.ts +8 -8
  24. package/dist/routes/links.d.ts +9 -9
  25. package/dist/routes/logs.d.ts +2 -2
  26. package/dist/routes/objects.d.ts +3 -3
  27. package/dist/routes/pipelines.d.ts +10 -10
  28. package/dist/routes/projections.d.ts +62 -50
  29. package/dist/routes/projections.d.ts.map +1 -1
  30. package/dist/routes/syncs.d.ts +6 -6
  31. package/dist/routes/telemetry.d.ts +7 -7
  32. package/dist/routes/webhook-runs.d.ts +2 -2
  33. package/dist/routes/workflows.d.ts +142 -57
  34. package/dist/routes/workflows.d.ts.map +1 -1
  35. package/dist/routes/ws/logs.d.ts +10 -10
  36. package/dist/schemas/actions.d.ts +16 -16
  37. package/dist/schemas/agents.d.ts +459 -142
  38. package/dist/schemas/agents.d.ts.map +1 -1
  39. package/dist/schemas/ai-accounting.d.ts +2393 -0
  40. package/dist/schemas/ai-accounting.d.ts.map +1 -0
  41. package/dist/schemas/auth.d.ts +96 -96
  42. package/dist/schemas/connectors.d.ts +24 -24
  43. package/dist/schemas/event-payloads.d.ts +6 -6
  44. package/dist/schemas/events.d.ts +6 -6
  45. package/dist/schemas/links.d.ts +2 -2
  46. package/dist/schemas/logs.d.ts +18 -18
  47. package/dist/schemas/pipelines.d.ts +20 -20
  48. package/dist/schemas/projections.d.ts +400 -288
  49. package/dist/schemas/projections.d.ts.map +1 -1
  50. package/dist/schemas/status.d.ts +2 -2
  51. package/dist/schemas/syncs.d.ts +10 -10
  52. package/dist/schemas/webhook-runs.d.ts +12 -12
  53. package/dist/schemas/workflows.d.ts +833 -162
  54. package/dist/schemas/workflows.d.ts.map +1 -1
  55. package/dist/server.d.ts +5 -0
  56. package/dist/server.d.ts.map +1 -1
  57. package/package.json +5 -5
  58. package/src/auth/experience.ts +190 -0
  59. package/src/auth/public-routes.ts +7 -0
  60. package/src/index.ts +1 -0
  61. package/src/openapi/tags.ts +4 -0
  62. package/src/registerRoutes.ts +2 -0
  63. package/src/routes/agents.ts +1 -0
  64. package/src/routes/ai-accounting.ts +166 -0
  65. package/src/routes/auth.ts +188 -32
  66. package/src/routes/projections.ts +18 -4
  67. package/src/routes/workflows.ts +16 -0
  68. package/src/schemas/agents.ts +4 -9
  69. package/src/schemas/ai-accounting.ts +182 -0
  70. package/src/schemas/projections.ts +6 -0
  71. package/src/schemas/workflows.ts +8 -3
  72. package/src/server.ts +10 -0
package/src/server.ts CHANGED
@@ -25,6 +25,7 @@ import {
25
25
  type SixbApiBrowserPolicy,
26
26
  } from "./auth/browser-origin"
27
27
  import { CSRF_TOKEN_RESPONSE_HEADER_NAME } from "./auth/csrf"
28
+ import type { SixbAuthExperienceOptions } from "./auth/experience"
28
29
  import { ServerAuthGuard } from "./auth/guard"
29
30
  import { consumeInternalRequestAuthState } from "./auth/scope"
30
31
  import { SESSION_ACTIVITY_HEADER_NAME } from "./auth/session-activity"
@@ -49,6 +50,8 @@ export interface SixbServerOptions {
49
50
  hostname?: string
50
51
  quiet?: boolean
51
52
  browser: SixbApiBrowserPolicy
53
+ /** Optional custom-app auth bundle mounted under the API's `/auth` routes. */
54
+ authExperience?: SixbAuthExperienceOptions
52
55
  }
53
56
 
54
57
  export function createSixbServer(options: SixbServerOptions): SixbServer {
@@ -63,6 +66,7 @@ export class SixbServer {
63
66
  private readonly apiBrowserPolicy: ResolvedSixbApiBrowserPolicy
64
67
  private readonly authContextResolver: ResolveRequestAuthContext
65
68
  private readonly authRedirectContextResolver: ResolveAuthRedirectContext
69
+ private readonly authExperience?: SixbAuthExperienceOptions
66
70
  private app: SixbApp | null = null
67
71
  private bunServer: ReturnType<typeof Bun.serve> | null = null
68
72
  private maintenance: OntologyMaintenanceHandle | null = null
@@ -77,6 +81,7 @@ export class SixbServer {
77
81
  this.authRedirectContextResolver = createApiBrowserAuthRedirectContextResolver(
78
82
  this.apiBrowserPolicy
79
83
  )
84
+ this.authExperience = options.authExperience
80
85
  }
81
86
 
82
87
  getHost(): SixbHostView {
@@ -117,6 +122,10 @@ export class SixbServer {
117
122
  return this.apiBrowserPolicy
118
123
  }
119
124
 
125
+ getAuthExperience(): SixbAuthExperienceOptions | undefined {
126
+ return this.authExperience
127
+ }
128
+
120
129
  async start(): Promise<void> {
121
130
  if (this.app !== null || this.bunServer !== null || this.maintenance !== null) {
122
131
  throw new Error("[SixbServer] Server is already running.")
@@ -304,6 +313,7 @@ export function createSixbApi(server: SixbServer) {
304
313
  server.resolveAuthRedirectContext(request, input),
305
314
  getInvitationDestinationOptions: (request) => server.getInvitationDestinationOptions(request),
306
315
  resolveAuthRequestOrigin: (request) => server.resolveAuthRequestOrigin(request),
316
+ authExperience: server.getAuthExperience(),
307
317
  resolveInvitationRedirectContext: (request, input) =>
308
318
  server.resolveInvitationRedirectContext(request, input),
309
319
  })