@codemation/host 0.0.5 → 0.0.11

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 (132) hide show
  1. package/README.md +3 -3
  2. package/dist/{PrismaMigrationDeployer-B7cHGrXP.js → AppConfigFactory-DWIz2hy-.js} +104 -58
  3. package/dist/AppConfigFactory-DWIz2hy-.js.map +1 -0
  4. package/dist/{client-Yh7-CQud.d.ts → AppConfigFactory-DmHOpg8O.d.ts} +52 -31
  5. package/dist/{CodemationFrontendBootstrapRequest-CNEk-C4D.js → AppContainerFactory-B5eRpvAa.js} +3269 -3374
  6. package/dist/AppContainerFactory-B5eRpvAa.js.map +1 -0
  7. package/dist/{CodemationWhitelabelConfig-DgbjgtrR.d.ts → CodemationAuthConfig-Bh2cCNCI.d.ts} +32 -2
  8. package/dist/{CodemationConfig-XCkSV2dj.d.ts → CodemationConfig-D2ULNkec.d.ts} +53 -49
  9. package/dist/CodemationConfigNormalizer-CBLxXaRV.d.ts +9 -0
  10. package/dist/{CodemationConsumerConfigLoader-scS_RQMy.js → CodemationConsumerConfigLoader-BBzAr6L_.js} +128 -3
  11. package/dist/CodemationConsumerConfigLoader-BBzAr6L_.js.map +1 -0
  12. package/dist/{CodemationConsumerConfigLoader-Dmm2TzAA.d.ts → CodemationConsumerConfigLoader-BLvzcfb7.d.ts} +4 -4
  13. package/dist/CodemationPluginListMerger-B0-e4CJ6.d.ts +391 -0
  14. package/dist/{CodemationPluginListMerger-BNmaoXQL.js → CodemationPluginListMerger-DrVOw9KP.js} +18 -10
  15. package/dist/CodemationPluginListMerger-DrVOw9KP.js.map +1 -0
  16. package/dist/{CredentialServices-DpDpm8mL.d.ts → CredentialServices-BeuMtqYA.d.ts} +3 -3
  17. package/dist/{CredentialServices-BKBGe7l3.js → CredentialServices-DNb3CZwW.js} +3 -3
  18. package/dist/CredentialServices-DNb3CZwW.js.map +1 -0
  19. package/dist/FrontendAppConfig-D50wjj_n.d.ts +27 -0
  20. package/dist/{WorkflowViewContracts-DCLpTn25.d.ts → FrontendAppConfigFactory-Bj-DZNlt.d.ts} +29 -2
  21. package/dist/FrontendAppConfigJsonCodec-1_L7H_Qo.d.ts +20 -0
  22. package/dist/FrontendAppConfigJsonCodec-nOCQI0ag.js +84 -0
  23. package/dist/FrontendAppConfigJsonCodec-nOCQI0ag.js.map +1 -0
  24. package/dist/{LogLevelPolicy-4cq9z0TI.d.ts → LogLevelPolicy-BS_NlAOg.d.ts} +2 -2
  25. package/dist/{ServerLoggerFactory-BRHxIDS7.js → ServerLoggerFactory-BltIIDfQ.js} +4 -129
  26. package/dist/ServerLoggerFactory-BltIIDfQ.js.map +1 -0
  27. package/dist/client.d.ts +5 -3
  28. package/dist/client.js +2 -1
  29. package/dist/client.js.map +1 -1
  30. package/dist/consumer.d.ts +5 -4
  31. package/dist/consumer.js +4 -4
  32. package/dist/credentials.d.ts +4 -4
  33. package/dist/credentials.js +3 -3
  34. package/dist/devServerSidecar.d.ts +1 -1
  35. package/dist/{index-Bs4F1IsC.d.ts → index-CkiptHb-.d.ts} +19 -20
  36. package/dist/index.d.ts +14 -19
  37. package/dist/index.js +12 -11
  38. package/dist/nextServer.d.ts +244 -9
  39. package/dist/nextServer.js +8 -8
  40. package/dist/persistenceServer-CaehMh3M.d.ts +9 -0
  41. package/dist/{persistenceServer-8tcM2S48.js → persistenceServer-DVeWUbc3.js} +2 -2
  42. package/dist/{persistenceServer-8tcM2S48.js.map → persistenceServer-DVeWUbc3.js.map} +1 -1
  43. package/dist/persistenceServer.d.ts +7 -6
  44. package/dist/persistenceServer.js +4 -4
  45. package/dist/{server-Dd65rNm6.js → server-C65z_kqm.js} +47 -17
  46. package/dist/server-C65z_kqm.js.map +1 -0
  47. package/dist/{server-BBdsATju.d.ts → server-Dyo8qh4k.d.ts} +23 -4
  48. package/dist/server.d.ts +12 -9
  49. package/dist/server.js +11 -10
  50. package/package.json +11 -6
  51. package/prisma/migrations/20260315063514_init/migration.sql +16 -16
  52. package/prisma/migrations/20260316090000_workflow_debugger_overlay/migration.sql +9 -9
  53. package/prisma/migrations/20260317120000_trigger_state_store/migration.sql +3 -3
  54. package/prisma/migrations/20260317153000_trigger_setup_state/migration.sql +8 -8
  55. package/prisma/migrations/20260318110000_credentials_v2/migration.sql +49 -49
  56. package/prisma/migrations/20260319110000_credential_oauth2_material/migration.sql +28 -28
  57. package/prisma/migrations/20260319200000_codemation_auth_tables/migration.sql +56 -56
  58. package/prisma/migrations/20260320140000_user_invites_account_status/migration.sql +20 -20
  59. package/prisma/migrations/20260325120000_workflow_activation/migration.sql +8 -8
  60. package/prisma/migrations/migration_lock.toml +3 -3
  61. package/prisma/schema.prisma +179 -179
  62. package/prisma.config.ts +15 -2
  63. package/src/application/commands/WorkflowCommandHandlers.ts +9 -0
  64. package/src/application/dev/BootRuntimeSnapshotHolder.ts +2 -2
  65. package/src/application/dev/BootRuntimeSummary.types.ts +2 -2
  66. package/src/application/queries/WorkflowQueryHandlers.ts +7 -0
  67. package/src/applicationTokens.ts +1 -1
  68. package/src/bootstrap/AppContainerFactory.ts +584 -0
  69. package/src/bootstrap/{PreparedCodemationRuntime.ts → AppContainerLifecycle.ts} +3 -8
  70. package/src/bootstrap/runtime/AppConfigFactory.ts +155 -30
  71. package/src/bootstrap/runtime/DatabaseMigrations.ts +18 -0
  72. package/src/bootstrap/runtime/FrontendRuntime.ts +44 -0
  73. package/src/bootstrap/runtime/WorkerRuntime.ts +55 -0
  74. package/src/client.ts +7 -0
  75. package/src/index.ts +15 -5
  76. package/src/infrastructure/persistence/PrismaMigrationDeployer.ts +2 -2
  77. package/src/infrastructure/persistence/SchedulerPersistenceCompatibilityValidator.ts +2 -2
  78. package/src/infrastructure/scheduler/WorkerRuntimeScheduler.ts +16 -0
  79. package/src/infrastructure/scheduler/bullmq/BullmqNodeExecutionScheduler.ts +47 -0
  80. package/src/infrastructure/scheduler/bullmq/BullmqScheduler.ts +33 -0
  81. package/src/infrastructure/scheduler/bullmq/BullmqWorker.ts +48 -0
  82. package/src/infrastructure/scheduler/bullmq/RedisConnectionOptionsFactory.ts +48 -0
  83. package/src/nextServer.ts +12 -3
  84. package/src/persistenceServer.ts +2 -2
  85. package/src/presentation/config/AppConfig.ts +25 -1
  86. package/src/presentation/frontend/CodemationFrontendAuthSnapshot.ts +14 -0
  87. package/src/presentation/frontend/CodemationFrontendAuthSnapshotFactory.ts +84 -0
  88. package/src/presentation/frontend/CodemationFrontendAuthSnapshotJsonCodec.ts +58 -0
  89. package/src/presentation/frontend/FrontendAppConfig.ts +10 -0
  90. package/src/presentation/frontend/FrontendAppConfigFactory.ts +26 -0
  91. package/src/presentation/frontend/FrontendAppConfigJsonCodec.ts +58 -0
  92. package/src/presentation/http/CodemationServerGatewayFactory.ts +22 -16
  93. package/src/presentation/server/AppConfigLoader.ts +39 -0
  94. package/src/presentation/server/CodemationConsumerAppResolver.ts +2 -2
  95. package/src/presentation/server/CodemationConsumerConfigLoader.ts +3 -2
  96. package/src/server.ts +7 -0
  97. package/vitest.shared.ts +0 -4
  98. package/dist/CodemationConsumerConfigLoader-scS_RQMy.js.map +0 -1
  99. package/dist/CodemationFrontendBootstrapRequest-CNEk-C4D.js.map +0 -1
  100. package/dist/CodemationPluginListMerger-BNmaoXQL.js.map +0 -1
  101. package/dist/CodemationPluginListMerger-BRYqEk0y.d.ts +0 -793
  102. package/dist/CredentialServices-BKBGe7l3.js.map +0 -1
  103. package/dist/PrismaMigrationDeployer-B7cHGrXP.js.map +0 -1
  104. package/dist/ServerLoggerFactory-BRHxIDS7.js.map +0 -1
  105. package/dist/persistenceServer-DPSj_-oU.d.ts +0 -37
  106. package/dist/server-Dd65rNm6.js.map +0 -1
  107. package/src/bootstrap/CodemationContainerFactory.ts +0 -310
  108. package/src/bootstrap/CodemationFrontendBootstrapRequest.ts +0 -16
  109. package/src/bootstrap/CodemationWorkerBootstrapRequest.ts +0 -19
  110. package/src/bootstrap/PreparedCodemationRuntimeFactory.ts +0 -308
  111. package/src/bootstrap/boot/CliRuntimeBootService.ts +0 -27
  112. package/src/bootstrap/boot/FrontendRuntimeBootService.ts +0 -86
  113. package/src/bootstrap/boot/WorkerRuntimeBootService.ts +0 -64
  114. package/src/bootstrap/runtime/ResolvedImplementationSelectionFactory.ts +0 -118
  115. package/src/codemationApplication.ts +0 -311
  116. package/src/infrastructure/credentials/FrameworkBuiltinCredentialTypesRegistrar.ts +0 -21
  117. package/src/infrastructure/persistence/DatabasePersistenceResolver.ts +0 -91
  118. package/src/infrastructure/persistence/generated/prisma/client.d.ts +0 -1
  119. package/src/infrastructure/persistence/generated/prisma/default.d.ts +0 -1
  120. package/src/infrastructure/persistence/generated/prisma/edge.d.ts +0 -1
  121. package/src/infrastructure/persistence/generated/prisma/index.d.ts +0 -4766
  122. package/src/infrastructure/persistence/generated/prisma/package.json +0 -144
  123. package/src/infrastructure/persistence/generated/prisma/query_compiler_fast_bg.wasm +0 -0
  124. package/src/infrastructure/persistence/generated/prisma/runtime/client.d.ts +0 -3358
  125. package/src/infrastructure/persistence/generated/prisma/runtime/index-browser.d.ts +0 -90
  126. package/src/infrastructure/persistence/generated/prisma/schema.prisma +0 -35
  127. package/src/infrastructure/persistence/generated/prisma/wasm-edge-light-loader.mjs +0 -5
  128. package/src/infrastructure/persistence/generated/prisma/wasm-worker-loader.mjs +0 -5
  129. package/src/infrastructure/runtime/WorkerRuntimeScheduler.ts +0 -35
  130. package/src/presentation/config/CodemationApplicationFacade.ts +0 -5
  131. /package/dist/{decorate-B-N_5S4p.js → decorate-B0PP651O.js} +0 -0
  132. /package/dist/{decorateParam-BTcc3KNk.js → decorateParam-DrsXNPuw.js} +0 -0
@@ -1,20 +1,20 @@
1
- -- AlterTable
2
- ALTER TABLE "codemation_auth_user" ADD COLUMN "account_status" TEXT NOT NULL DEFAULT 'active';
3
-
4
- -- CreateTable
5
- CREATE TABLE "codemation_auth_user_invite" (
6
- "id" TEXT NOT NULL,
7
- "user_id" TEXT NOT NULL,
8
- "token_hash" TEXT NOT NULL,
9
- "expires_at" TIMESTAMP(3) NOT NULL,
10
- "created_at" TIMESTAMP(3) NOT NULL,
11
- "revoked_at" TIMESTAMP(3),
12
-
13
- CONSTRAINT "codemation_auth_user_invite_pkey" PRIMARY KEY ("id")
14
- );
15
-
16
- CREATE UNIQUE INDEX "codemation_auth_user_invite_token_hash_key" ON "codemation_auth_user_invite"("token_hash");
17
-
18
- CREATE INDEX "codemation_auth_user_invite_user_id_idx" ON "codemation_auth_user_invite"("user_id");
19
-
20
- ALTER TABLE "codemation_auth_user_invite" ADD CONSTRAINT "codemation_auth_user_invite_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "codemation_auth_user"("id") ON DELETE CASCADE ON UPDATE CASCADE;
1
+ -- AlterTable
2
+ ALTER TABLE "codemation_auth_user" ADD COLUMN "account_status" TEXT NOT NULL DEFAULT 'active';
3
+
4
+ -- CreateTable
5
+ CREATE TABLE "codemation_auth_user_invite" (
6
+ "id" TEXT NOT NULL,
7
+ "user_id" TEXT NOT NULL,
8
+ "token_hash" TEXT NOT NULL,
9
+ "expires_at" TIMESTAMP(3) NOT NULL,
10
+ "created_at" TIMESTAMP(3) NOT NULL,
11
+ "revoked_at" TIMESTAMP(3),
12
+
13
+ CONSTRAINT "codemation_auth_user_invite_pkey" PRIMARY KEY ("id")
14
+ );
15
+
16
+ CREATE UNIQUE INDEX "codemation_auth_user_invite_token_hash_key" ON "codemation_auth_user_invite"("token_hash");
17
+
18
+ CREATE INDEX "codemation_auth_user_invite_user_id_idx" ON "codemation_auth_user_invite"("user_id");
19
+
20
+ ALTER TABLE "codemation_auth_user_invite" ADD CONSTRAINT "codemation_auth_user_invite_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "codemation_auth_user"("id") ON DELETE CASCADE ON UPDATE CASCADE;
@@ -1,8 +1,8 @@
1
- -- CreateTable
2
- CREATE TABLE "WorkflowActivation" (
3
- "workflow_id" TEXT NOT NULL,
4
- "is_active" BOOLEAN NOT NULL DEFAULT false,
5
- "updated_at" TEXT NOT NULL,
6
-
7
- CONSTRAINT "WorkflowActivation_pkey" PRIMARY KEY ("workflow_id")
8
- );
1
+ -- CreateTable
2
+ CREATE TABLE "WorkflowActivation" (
3
+ "workflow_id" TEXT NOT NULL,
4
+ "is_active" BOOLEAN NOT NULL DEFAULT false,
5
+ "updated_at" TEXT NOT NULL,
6
+
7
+ CONSTRAINT "WorkflowActivation_pkey" PRIMARY KEY ("workflow_id")
8
+ );
@@ -1,3 +1,3 @@
1
- # Please do not edit this file manually
2
- # It should be added in your version-control system (e.g., Git)
3
- provider = "postgresql"
1
+ # Please do not edit this file manually
2
+ # It should be added in your version-control system (e.g., Git)
3
+ provider = "postgresql"
@@ -1,179 +1,179 @@
1
- generator client {
2
- provider = "prisma-client-js"
3
- output = "../src/infrastructure/persistence/generated/prisma-client"
4
- }
5
-
6
- datasource db {
7
- provider = "postgresql"
8
- }
9
-
10
- model Run {
11
- runId String @id @map("run_id")
12
- workflowId String @map("workflow_id")
13
- startedAt String @map("started_at")
14
- status String
15
- parentJson String? @map("parent_json")
16
- executionOptionsJson String? @map("execution_options_json")
17
- updatedAt String @map("updated_at")
18
- stateJson String @map("state_json")
19
- }
20
-
21
- model WorkflowDebuggerOverlay {
22
- workflowId String @id @map("workflow_id")
23
- updatedAt String @map("updated_at")
24
- copiedFromRunId String? @map("copied_from_run_id")
25
- stateJson String @map("state_json")
26
- }
27
-
28
- model WorkflowActivation {
29
- workflowId String @id @map("workflow_id")
30
- isActive Boolean @default(false) @map("is_active")
31
- updatedAt String @map("updated_at")
32
- }
33
-
34
- model TriggerSetupState {
35
- workflowId String @map("workflow_id")
36
- nodeId String @map("node_id")
37
- updatedAt String @map("updated_at")
38
- stateJson String @map("state_json")
39
-
40
- @@id([workflowId, nodeId])
41
- }
42
-
43
- model CredentialInstance {
44
- instanceId String @id @map("instance_id")
45
- typeId String @map("type_id")
46
- displayName String @map("display_name")
47
- sourceKind String @map("source_kind")
48
- publicConfigJson String @map("public_config_json")
49
- secretRefJson String @map("secret_ref_json")
50
- tagsJson String @map("tags_json")
51
- setupStatus String @map("setup_status")
52
- createdAt String @map("created_at")
53
- updatedAt String @map("updated_at")
54
- }
55
-
56
- model CredentialSecretMaterial {
57
- instanceId String @id @map("instance_id")
58
- encryptedJson String @map("encrypted_json")
59
- encryptionKeyId String @map("encryption_key_id")
60
- schemaVersion Int @map("schema_version")
61
- updatedAt String @map("updated_at")
62
- }
63
-
64
- model CredentialOAuth2Material {
65
- instanceId String @id @map("instance_id")
66
- encryptedJson String @map("encrypted_json")
67
- encryptionKeyId String @map("encryption_key_id")
68
- schemaVersion Int @map("schema_version")
69
- providerId String @map("provider_id")
70
- connectedEmail String? @map("connected_email")
71
- connectedAt String? @map("connected_at")
72
- scopesJson String @map("scopes_json")
73
- updatedAt String @map("updated_at")
74
- }
75
-
76
- model CredentialOAuth2State {
77
- state String @id
78
- instanceId String @map("instance_id")
79
- codeVerifier String? @map("code_verifier")
80
- providerId String? @map("provider_id")
81
- requestedScopesJson String @map("requested_scopes_json")
82
- createdAt String @map("created_at")
83
- expiresAt String @map("expires_at")
84
-
85
- @@index([instanceId])
86
- @@index([expiresAt])
87
- }
88
-
89
- model CredentialBinding {
90
- workflowId String @map("workflow_id")
91
- nodeId String @map("node_id")
92
- slotKey String @map("slot_key")
93
- instanceId String @map("instance_id")
94
- updatedAt String @map("updated_at")
95
-
96
- @@id([workflowId, nodeId, slotKey])
97
- @@index([instanceId])
98
- }
99
-
100
- model CredentialTestResult {
101
- testId String @id @map("test_id")
102
- instanceId String @map("instance_id")
103
- status String
104
- message String?
105
- detailsJson String @map("details_json")
106
- testedAt String @map("tested_at")
107
- expiresAt String? @map("expires_at")
108
-
109
- @@index([instanceId, testedAt])
110
- }
111
-
112
- /// Auth.js / NextAuth user directory (JWT sessions; optional OAuth linking)
113
- model User {
114
- id String @id @default(cuid())
115
- name String?
116
- email String? @unique
117
- emailVerified DateTime? @map("email_verified")
118
- image String?
119
- passwordHash String? @map("password_hash")
120
- /// invited | active | inactive (local directory / invite flow)
121
- accountStatus String @default("active") @map("account_status")
122
- accounts Account[]
123
- sessions Session[]
124
- invites UserInvite[]
125
-
126
- @@map("codemation_auth_user")
127
- }
128
-
129
- model UserInvite {
130
- id String @id @default(cuid())
131
- userId String @map("user_id")
132
- tokenHash String @unique @map("token_hash")
133
- expiresAt DateTime @map("expires_at")
134
- createdAt DateTime @map("created_at")
135
- revokedAt DateTime? @map("revoked_at")
136
- user User @relation(fields: [userId], references: [id], onDelete: Cascade)
137
-
138
- @@index([userId])
139
- @@map("codemation_auth_user_invite")
140
- }
141
-
142
- model Account {
143
- id String @id @default(cuid())
144
- userId String @map("user_id")
145
- type String
146
- provider String
147
- providerAccountId String @map("provider_account_id")
148
- refresh_token String? @db.Text
149
- access_token String? @db.Text
150
- expires_at Int?
151
- token_type String?
152
- scope String? @db.Text
153
- id_token String? @db.Text
154
- session_state String?
155
-
156
- user User @relation(fields: [userId], references: [id], onDelete: Cascade)
157
-
158
- @@unique([provider, providerAccountId])
159
- @@map("codemation_auth_account")
160
- }
161
-
162
- model Session {
163
- id String @id @default(cuid())
164
- sessionToken String @unique @map("session_token")
165
- userId String @map("user_id")
166
- expires DateTime
167
- user User @relation(fields: [userId], references: [id], onDelete: Cascade)
168
-
169
- @@map("codemation_auth_session")
170
- }
171
-
172
- model VerificationToken {
173
- identifier String
174
- token String
175
- expires DateTime
176
-
177
- @@unique([identifier, token])
178
- @@map("codemation_auth_verification_token")
179
- }
1
+ generator client {
2
+ provider = "prisma-client-js"
3
+ output = "../src/infrastructure/persistence/generated/prisma-client"
4
+ }
5
+
6
+ datasource db {
7
+ provider = "postgresql"
8
+ }
9
+
10
+ model Run {
11
+ runId String @id @map("run_id")
12
+ workflowId String @map("workflow_id")
13
+ startedAt String @map("started_at")
14
+ status String
15
+ parentJson String? @map("parent_json")
16
+ executionOptionsJson String? @map("execution_options_json")
17
+ updatedAt String @map("updated_at")
18
+ stateJson String @map("state_json")
19
+ }
20
+
21
+ model WorkflowDebuggerOverlay {
22
+ workflowId String @id @map("workflow_id")
23
+ updatedAt String @map("updated_at")
24
+ copiedFromRunId String? @map("copied_from_run_id")
25
+ stateJson String @map("state_json")
26
+ }
27
+
28
+ model WorkflowActivation {
29
+ workflowId String @id @map("workflow_id")
30
+ isActive Boolean @default(false) @map("is_active")
31
+ updatedAt String @map("updated_at")
32
+ }
33
+
34
+ model TriggerSetupState {
35
+ workflowId String @map("workflow_id")
36
+ nodeId String @map("node_id")
37
+ updatedAt String @map("updated_at")
38
+ stateJson String @map("state_json")
39
+
40
+ @@id([workflowId, nodeId])
41
+ }
42
+
43
+ model CredentialInstance {
44
+ instanceId String @id @map("instance_id")
45
+ typeId String @map("type_id")
46
+ displayName String @map("display_name")
47
+ sourceKind String @map("source_kind")
48
+ publicConfigJson String @map("public_config_json")
49
+ secretRefJson String @map("secret_ref_json")
50
+ tagsJson String @map("tags_json")
51
+ setupStatus String @map("setup_status")
52
+ createdAt String @map("created_at")
53
+ updatedAt String @map("updated_at")
54
+ }
55
+
56
+ model CredentialSecretMaterial {
57
+ instanceId String @id @map("instance_id")
58
+ encryptedJson String @map("encrypted_json")
59
+ encryptionKeyId String @map("encryption_key_id")
60
+ schemaVersion Int @map("schema_version")
61
+ updatedAt String @map("updated_at")
62
+ }
63
+
64
+ model CredentialOAuth2Material {
65
+ instanceId String @id @map("instance_id")
66
+ encryptedJson String @map("encrypted_json")
67
+ encryptionKeyId String @map("encryption_key_id")
68
+ schemaVersion Int @map("schema_version")
69
+ providerId String @map("provider_id")
70
+ connectedEmail String? @map("connected_email")
71
+ connectedAt String? @map("connected_at")
72
+ scopesJson String @map("scopes_json")
73
+ updatedAt String @map("updated_at")
74
+ }
75
+
76
+ model CredentialOAuth2State {
77
+ state String @id
78
+ instanceId String @map("instance_id")
79
+ codeVerifier String? @map("code_verifier")
80
+ providerId String? @map("provider_id")
81
+ requestedScopesJson String @map("requested_scopes_json")
82
+ createdAt String @map("created_at")
83
+ expiresAt String @map("expires_at")
84
+
85
+ @@index([instanceId])
86
+ @@index([expiresAt])
87
+ }
88
+
89
+ model CredentialBinding {
90
+ workflowId String @map("workflow_id")
91
+ nodeId String @map("node_id")
92
+ slotKey String @map("slot_key")
93
+ instanceId String @map("instance_id")
94
+ updatedAt String @map("updated_at")
95
+
96
+ @@id([workflowId, nodeId, slotKey])
97
+ @@index([instanceId])
98
+ }
99
+
100
+ model CredentialTestResult {
101
+ testId String @id @map("test_id")
102
+ instanceId String @map("instance_id")
103
+ status String
104
+ message String?
105
+ detailsJson String @map("details_json")
106
+ testedAt String @map("tested_at")
107
+ expiresAt String? @map("expires_at")
108
+
109
+ @@index([instanceId, testedAt])
110
+ }
111
+
112
+ /// Auth.js / NextAuth user directory (JWT sessions; optional OAuth linking)
113
+ model User {
114
+ id String @id @default(cuid())
115
+ name String?
116
+ email String? @unique
117
+ emailVerified DateTime? @map("email_verified")
118
+ image String?
119
+ passwordHash String? @map("password_hash")
120
+ /// invited | active | inactive (local directory / invite flow)
121
+ accountStatus String @default("active") @map("account_status")
122
+ accounts Account[]
123
+ sessions Session[]
124
+ invites UserInvite[]
125
+
126
+ @@map("codemation_auth_user")
127
+ }
128
+
129
+ model UserInvite {
130
+ id String @id @default(cuid())
131
+ userId String @map("user_id")
132
+ tokenHash String @unique @map("token_hash")
133
+ expiresAt DateTime @map("expires_at")
134
+ createdAt DateTime @map("created_at")
135
+ revokedAt DateTime? @map("revoked_at")
136
+ user User @relation(fields: [userId], references: [id], onDelete: Cascade)
137
+
138
+ @@index([userId])
139
+ @@map("codemation_auth_user_invite")
140
+ }
141
+
142
+ model Account {
143
+ id String @id @default(cuid())
144
+ userId String @map("user_id")
145
+ type String
146
+ provider String
147
+ providerAccountId String @map("provider_account_id")
148
+ refresh_token String? @db.Text
149
+ access_token String? @db.Text
150
+ expires_at Int?
151
+ token_type String?
152
+ scope String? @db.Text
153
+ id_token String? @db.Text
154
+ session_state String?
155
+
156
+ user User @relation(fields: [userId], references: [id], onDelete: Cascade)
157
+
158
+ @@unique([provider, providerAccountId])
159
+ @@map("codemation_auth_account")
160
+ }
161
+
162
+ model Session {
163
+ id String @id @default(cuid())
164
+ sessionToken String @unique @map("session_token")
165
+ userId String @map("user_id")
166
+ expires DateTime
167
+ user User @relation(fields: [userId], references: [id], onDelete: Cascade)
168
+
169
+ @@map("codemation_auth_session")
170
+ }
171
+
172
+ model VerificationToken {
173
+ identifier String
174
+ token String
175
+ expires DateTime
176
+
177
+ @@unique([identifier, token])
178
+ @@map("codemation_auth_verification_token")
179
+ }
package/prisma.config.ts CHANGED
@@ -1,5 +1,18 @@
1
1
  import "dotenv/config";
2
- import { defineConfig, env } from "prisma/config";
2
+ import { defineConfig } from "prisma/config";
3
+
4
+ class PrismaConfigEnvironment {
5
+ static fallbackGenerateDatabaseUrl = "postgresql://codemation:codemation@127.0.0.1:5432/codemation";
6
+
7
+ static resolveDatasourceUrl(): string {
8
+ const databaseUrl = process.env.DATABASE_URL?.trim();
9
+ if (databaseUrl && databaseUrl.length > 0) {
10
+ return databaseUrl;
11
+ }
12
+ // `prisma generate` only needs a schema-compatible datasource URL; runtime commands inject a real one.
13
+ return this.fallbackGenerateDatabaseUrl;
14
+ }
15
+ }
3
16
 
4
17
  export default defineConfig({
5
18
  schema: "prisma/schema.prisma",
@@ -7,6 +20,6 @@ export default defineConfig({
7
20
  path: "prisma/migrations",
8
21
  },
9
22
  datasource: {
10
- url: env("DATABASE_URL"),
23
+ url: PrismaConfigEnvironment.resolveDatasourceUrl(),
11
24
  },
12
25
  });
@@ -0,0 +1,9 @@
1
+ export { CopyRunToWorkflowDebuggerCommandHandler } from "./CopyRunToWorkflowDebuggerCommandHandler";
2
+ export { HandleWebhookInvocationCommandHandler } from "./HandleWebhookInvocationCommandHandler";
3
+ export { ReplaceMutableRunWorkflowSnapshotCommandHandler } from "./ReplaceMutableRunWorkflowSnapshotCommandHandler";
4
+ export { ReplaceWorkflowDebuggerOverlayCommandHandler } from "./ReplaceWorkflowDebuggerOverlayCommandHandler";
5
+ export { ReplayWorkflowNodeCommandHandler } from "./ReplayWorkflowNodeCommandHandler";
6
+ export { SetPinnedNodeInputCommandHandler } from "./SetPinnedNodeInputCommandHandler";
7
+ export { SetWorkflowActivationCommandHandler } from "./SetWorkflowActivationCommandHandler";
8
+ export { StartWorkflowRunCommandHandler } from "./StartWorkflowRunCommandHandler";
9
+ export { UploadOverlayPinnedBinaryCommandHandler } from "./UploadOverlayPinnedBinaryCommandHandler";
@@ -2,8 +2,8 @@ import { injectable } from "@codemation/core";
2
2
  import type { BootRuntimeSummary } from "./BootRuntimeSummary.types";
3
3
 
4
4
  /**
5
- * Holds the latest {@link BootRuntimeSummary} after {@link CodemationApplication} prepare wiring.
6
- * Avoids injecting {@link CodemationApplication} into dev diagnostics (circular ESM graph with assembler).
5
+ * Holds the latest {@link BootRuntimeSummary} after app container creation.
6
+ * Avoids injecting container-building services into dev diagnostics.
7
7
  */
8
8
  @injectable()
9
9
  export class BootRuntimeSnapshotHolder {
@@ -1,9 +1,9 @@
1
- import type { ResolvedDatabasePersistence } from "../../infrastructure/persistence/DatabasePersistenceResolver";
1
+ import type { AppPersistenceConfig } from "../../presentation/config/AppConfig";
2
2
  import type { CodemationEventBusKind, CodemationSchedulerKind } from "../../presentation/config/CodemationConfig";
3
3
 
4
4
  /** Resolved persistence + scheduler wiring captured at host prepare time (dev banner / diagnostics). */
5
5
  export type BootRuntimeSummary = Readonly<{
6
- databasePersistence: ResolvedDatabasePersistence;
6
+ databasePersistence: AppPersistenceConfig;
7
7
  eventBusKind: CodemationEventBusKind;
8
8
  queuePrefix: string;
9
9
  schedulerKind: CodemationSchedulerKind;
@@ -0,0 +1,7 @@
1
+ export { GetRunBinaryAttachmentQueryHandler } from "./GetRunBinaryAttachmentQueryHandler";
2
+ export { GetRunStateQueryHandler } from "./GetRunStateQueryHandler";
3
+ export { GetWorkflowDebuggerOverlayQueryHandler } from "./GetWorkflowDebuggerOverlayQueryHandler";
4
+ export { GetWorkflowDetailQueryHandler } from "./GetWorkflowDetailQueryHandler";
5
+ export { GetWorkflowOverlayBinaryAttachmentQueryHandler } from "./GetWorkflowOverlayBinaryAttachmentQueryHandler";
6
+ export { GetWorkflowSummariesQueryHandler } from "./GetWorkflowSummariesQueryHandler";
7
+ export { ListWorkflowRunsQueryHandler } from "./ListWorkflowRunsQueryHandler";
@@ -16,7 +16,7 @@ import type { WorkflowRunRepository } from "./domain/runs/WorkflowRunRepository"
16
16
  import type { WorkflowDebuggerOverlayRepository } from "./domain/workflows/WorkflowDebuggerOverlayRepository";
17
17
  import type { WorkflowDefinitionRepository } from "./domain/workflows/WorkflowDefinitionRepository";
18
18
  import type { WorkflowActivationRepository } from "./domain/workflows/WorkflowActivationRepository";
19
- import type { WorkerRuntimeScheduler } from "./infrastructure/runtime/WorkerRuntimeScheduler";
19
+ import type { WorkerRuntimeScheduler } from "./infrastructure/scheduler/WorkerRuntimeScheduler";
20
20
  import type { PrismaClient } from "./infrastructure/persistence/generated/prisma-client/client.js";
21
21
  import type { AppConfig } from "./presentation/config/AppConfig";
22
22
  import type { CodemationAuthConfig } from "./presentation/config/CodemationAuthConfig";