@codemation/host 0.0.7 → 0.0.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 (24) hide show
  1. package/package.json +10 -5
  2. package/prisma/migrations/20260315063514_init/migration.sql +16 -16
  3. package/prisma/migrations/20260316090000_workflow_debugger_overlay/migration.sql +9 -9
  4. package/prisma/migrations/20260317120000_trigger_state_store/migration.sql +3 -3
  5. package/prisma/migrations/20260317153000_trigger_setup_state/migration.sql +8 -8
  6. package/prisma/migrations/20260318110000_credentials_v2/migration.sql +49 -49
  7. package/prisma/migrations/20260319110000_credential_oauth2_material/migration.sql +28 -28
  8. package/prisma/migrations/20260319200000_codemation_auth_tables/migration.sql +56 -56
  9. package/prisma/migrations/20260320140000_user_invites_account_status/migration.sql +20 -20
  10. package/prisma/migrations/20260325120000_workflow_activation/migration.sql +8 -8
  11. package/prisma/migrations/migration_lock.toml +3 -3
  12. package/prisma/schema.prisma +179 -179
  13. package/prisma.config.ts +15 -2
  14. package/src/infrastructure/persistence/generated/prisma/client.d.ts +0 -1
  15. package/src/infrastructure/persistence/generated/prisma/default.d.ts +0 -1
  16. package/src/infrastructure/persistence/generated/prisma/edge.d.ts +0 -1
  17. package/src/infrastructure/persistence/generated/prisma/index.d.ts +0 -4766
  18. package/src/infrastructure/persistence/generated/prisma/package.json +0 -144
  19. package/src/infrastructure/persistence/generated/prisma/query_compiler_fast_bg.wasm +0 -0
  20. package/src/infrastructure/persistence/generated/prisma/runtime/client.d.ts +0 -3358
  21. package/src/infrastructure/persistence/generated/prisma/runtime/index-browser.d.ts +0 -90
  22. package/src/infrastructure/persistence/generated/prisma/schema.prisma +0 -35
  23. package/src/infrastructure/persistence/generated/prisma/wasm-edge-light-loader.mjs +0 -5
  24. package/src/infrastructure/persistence/generated/prisma/wasm-worker-loader.mjs +0 -5
@@ -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
  });
@@ -1 +0,0 @@
1
- export * from "./index"
@@ -1 +0,0 @@
1
- export * from "./index"
@@ -1 +0,0 @@
1
- export * from "./default"