prisma-laravel-migrate 3.0.8 → 3.1.0
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/package.json +2 -2
- package/small.prisma +0 -715
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "prisma-laravel-migrate",
|
|
3
|
-
"version": "3.0
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"description": "Generate laravel migrations and/or models using prisma files",
|
|
5
5
|
"bin": {
|
|
6
6
|
"prisma-laravel-migrations": "./dist/cli/migrator.index.js",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@prettier/plugin-php": "^0.24.0",
|
|
48
48
|
"@prisma/generator-helper": "^6.19.0",
|
|
49
|
-
"@prisma/internals": "^
|
|
49
|
+
"@prisma/internals": "^7.1.0",
|
|
50
50
|
"change-case": "^5.4.4",
|
|
51
51
|
"commander": "^14.0.0",
|
|
52
52
|
"dayjs": "^1.11.13",
|
package/small.prisma
DELETED
|
@@ -1,715 +0,0 @@
|
|
|
1
|
-
// ─────────────────────────────────────────────────────────
|
|
2
|
-
// FortiPlugin (userless) + Authors + Plugin Issues wired in
|
|
3
|
-
// ─────────────────────────────────────────────────────────
|
|
4
|
-
|
|
5
|
-
datasource db {
|
|
6
|
-
provider = "mysql"
|
|
7
|
-
url = ""
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
generator migrations {
|
|
11
|
-
provider = "prisma-laravel-migrations"
|
|
12
|
-
outputDir = "./database/migrations"
|
|
13
|
-
tablePrefix = "scpl_"
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
generator models {
|
|
17
|
-
provider = "prisma-laravel-models"
|
|
18
|
-
outputDir = "src/Models"
|
|
19
|
-
outputEnumDir = "src/Enums"
|
|
20
|
-
namespace = "Timeax\\FortiPlugin"
|
|
21
|
-
stubDir = "prisma/stubs"
|
|
22
|
-
tablePrefix = "scpl_"
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
// ─── ENUMS ────────────────────────────────────────────────
|
|
26
|
-
|
|
27
|
-
enum PluginStatus {
|
|
28
|
-
active
|
|
29
|
-
inactive
|
|
30
|
-
archived
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
enum ValidationStatus {
|
|
34
|
-
valid
|
|
35
|
-
unchecked
|
|
36
|
-
unverified
|
|
37
|
-
failed
|
|
38
|
-
pending
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
enum AuthorStatus {
|
|
42
|
-
pending
|
|
43
|
-
active
|
|
44
|
-
inactive
|
|
45
|
-
blocked
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
enum PluginSettingValueType {
|
|
49
|
-
string
|
|
50
|
-
number
|
|
51
|
-
boolean
|
|
52
|
-
json
|
|
53
|
-
file
|
|
54
|
-
blob
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
enum AuthorRole {
|
|
58
|
-
owner
|
|
59
|
-
maintainer
|
|
60
|
-
contributor
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
enum IssueStatus {
|
|
64
|
-
open
|
|
65
|
-
triage
|
|
66
|
-
in_progress
|
|
67
|
-
resolved
|
|
68
|
-
rejected
|
|
69
|
-
closed
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
// ─── MODELS ───────────────────────────────────────────────
|
|
73
|
-
|
|
74
|
-
// AUTHORS (new)
|
|
75
|
-
///@hidden:password
|
|
76
|
-
///@guarded:id
|
|
77
|
-
///@fillable:slug,name,handle,email,avatar_url,org,website,meta,verified,password,status
|
|
78
|
-
model Author {
|
|
79
|
-
id BigInt @id @default(autoincrement()) @db.BigInt
|
|
80
|
-
slug String @unique
|
|
81
|
-
name String
|
|
82
|
-
handle String? @unique
|
|
83
|
-
email String? @unique
|
|
84
|
-
password String
|
|
85
|
-
avatar_url String?
|
|
86
|
-
org String?
|
|
87
|
-
website String?
|
|
88
|
-
meta Json?
|
|
89
|
-
status AuthorStatus @default(pending)
|
|
90
|
-
verified Boolean @default(false)
|
|
91
|
-
created_at DateTime @default(now())
|
|
92
|
-
updated_at DateTime @updatedAt
|
|
93
|
-
|
|
94
|
-
// relations
|
|
95
|
-
pluginLinks PluginAuthor[]
|
|
96
|
-
reportedIssues PluginIssue[] @relation("IssueReporter")
|
|
97
|
-
issueMessages PluginIssueMessage[]
|
|
98
|
-
uploadedZips PluginZip[]
|
|
99
|
-
pluginTokens PluginToken[]
|
|
100
|
-
tokens AuthorToken[] /// author-level tokens (for login sessions etc.)
|
|
101
|
-
pluginAuditActors PluginAuditLog[] @relation("PluginAuditActor")
|
|
102
|
-
auditActors AuditLog[] @relation("AuditActor")
|
|
103
|
-
|
|
104
|
-
@@map("authors")
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
///@guarded:id
|
|
108
|
-
///@fillable:author_id,token_hash,expires_at,last_used,revoked,meta
|
|
109
|
-
model AuthorToken {
|
|
110
|
-
id BigInt @id @default(autoincrement()) @db.BigInt
|
|
111
|
-
author_id BigInt
|
|
112
|
-
token_hash String @unique
|
|
113
|
-
expires_at DateTime
|
|
114
|
-
last_used DateTime?
|
|
115
|
-
revoked Boolean @default(false)
|
|
116
|
-
meta Json? /// e.g. { "scopes": ["forti-packager-fetch-policy"] }
|
|
117
|
-
created_at DateTime @default(now())
|
|
118
|
-
updated_at DateTime @updatedAt
|
|
119
|
-
|
|
120
|
-
author Author @relation(fields: [author_id], references: [id])
|
|
121
|
-
|
|
122
|
-
@@index([author_id])
|
|
123
|
-
@@map("author_tokens")
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
// PLUGIN↔AUTHOR (pivot)
|
|
127
|
-
///@guarded:plugin_id,author_id
|
|
128
|
-
///@fillable:plugin_id,author_id,role
|
|
129
|
-
model PluginAuthor {
|
|
130
|
-
plugin_id BigInt
|
|
131
|
-
author_id BigInt
|
|
132
|
-
role AuthorRole @default(contributor)
|
|
133
|
-
created_at DateTime @default(now())
|
|
134
|
-
|
|
135
|
-
plugin Plugin @relation(fields: [plugin_id], references: [id])
|
|
136
|
-
author Author @relation(fields: [author_id], references: [id])
|
|
137
|
-
|
|
138
|
-
@@id([plugin_id, author_id])
|
|
139
|
-
@@index([author_id])
|
|
140
|
-
@@map("plugin_author")
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
// PLUGIN SETTINGS (unchanged)
|
|
144
|
-
///@guarded:id
|
|
145
|
-
///@fillable:plugin_id,key,value,type
|
|
146
|
-
model PluginSetting {
|
|
147
|
-
id BigInt @id @default(autoincrement()) @db.BigInt
|
|
148
|
-
plugin_id BigInt @db.BigInt
|
|
149
|
-
key String
|
|
150
|
-
value String @db.LongText
|
|
151
|
-
type PluginSettingValueType @default(string)
|
|
152
|
-
created_at DateTime @default(now())
|
|
153
|
-
updated_at DateTime @updatedAt
|
|
154
|
-
|
|
155
|
-
plugin Plugin @relation(fields: [plugin_id], references: [id], onDelete: Cascade)
|
|
156
|
-
|
|
157
|
-
@@unique([plugin_id, key])
|
|
158
|
-
@@index([plugin_id])
|
|
159
|
-
@@map("plugin_settings")
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
// PLUGIN VERSIONS (unchanged structure; authors are on Plugin/Zip)
|
|
163
|
-
///@guarded:id
|
|
164
|
-
///@fillable:plugin_id,version,archive_url,manifest,validation_report,status
|
|
165
|
-
model PluginVersion {
|
|
166
|
-
id BigInt @id @default(autoincrement()) @db.BigInt
|
|
167
|
-
plugin_id BigInt
|
|
168
|
-
version String
|
|
169
|
-
archive_url String
|
|
170
|
-
manifest Json?
|
|
171
|
-
validation_report Json?
|
|
172
|
-
status ValidationStatus @default(unchecked)
|
|
173
|
-
created_at DateTime @default(now())
|
|
174
|
-
updated_at DateTime @updatedAt
|
|
175
|
-
|
|
176
|
-
plugin Plugin @relation(fields: [plugin_id], references: [id])
|
|
177
|
-
|
|
178
|
-
@@index([plugin_id])
|
|
179
|
-
@@map("plugin_versions")
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
// PLUGIN ZIP FILES (now tied to Author instead of string)
|
|
183
|
-
///@guarded:id
|
|
184
|
-
///@fillable:placeholder_id,path,meta,status,validation_status,uploaded_by_author_id
|
|
185
|
-
model PluginZip {
|
|
186
|
-
id BigInt @id @default(autoincrement()) @db.BigInt
|
|
187
|
-
placeholder_id BigInt
|
|
188
|
-
path String @db.Text
|
|
189
|
-
meta Json @default("{}")
|
|
190
|
-
status PluginStatus @default(active)
|
|
191
|
-
validation_status ValidationStatus @default(unchecked)
|
|
192
|
-
uploaded_by_author_id BigInt?
|
|
193
|
-
created_at DateTime @default(now())
|
|
194
|
-
updated_at DateTime @updatedAt
|
|
195
|
-
|
|
196
|
-
placeholder PluginPlaceholder @relation(fields: [placeholder_id], references: [id])
|
|
197
|
-
uploadedBy Author? @relation(fields: [uploaded_by_author_id], references: [id])
|
|
198
|
-
|
|
199
|
-
@@index([placeholder_id])
|
|
200
|
-
@@index([uploaded_by_author_id])
|
|
201
|
-
@@map("plugin_zips")
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
// PLUGIN TOKENS (associate to Author optionally)
|
|
205
|
-
///@guarded:id
|
|
206
|
-
///@fillable:plugin_placeholder_id,token_hash,expires_at,last_used,revoked,author_id
|
|
207
|
-
model PluginToken {
|
|
208
|
-
id BigInt @id @default(autoincrement()) @db.BigInt
|
|
209
|
-
plugin_placeholder_id BigInt
|
|
210
|
-
token_hash String @unique
|
|
211
|
-
meta Json ///@fillable
|
|
212
|
-
expires_at DateTime
|
|
213
|
-
last_used DateTime?
|
|
214
|
-
revoked Boolean @default(false)
|
|
215
|
-
author_id BigInt?
|
|
216
|
-
created_at DateTime @default(now())
|
|
217
|
-
updated_at DateTime @updatedAt
|
|
218
|
-
|
|
219
|
-
placeholder PluginPlaceholder? @relation(fields: [plugin_placeholder_id], references: [id])
|
|
220
|
-
author Author? @relation(fields: [author_id], references: [id])
|
|
221
|
-
|
|
222
|
-
@@index([plugin_placeholder_id])
|
|
223
|
-
@@index([author_id])
|
|
224
|
-
@@map("plugin_tokens")
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
// PLUGIN ISSUES (reintroduced; author-based)
|
|
228
|
-
///@guarded:id
|
|
229
|
-
///@fillable:plugin_id,reporter_id,type,description,status,severity,meta
|
|
230
|
-
model PluginIssue {
|
|
231
|
-
id BigInt @id @default(autoincrement()) @db.BigInt
|
|
232
|
-
plugin_id BigInt
|
|
233
|
-
reporter_id BigInt
|
|
234
|
-
type String
|
|
235
|
-
description String @db.Text
|
|
236
|
-
status IssueStatus @default(open)
|
|
237
|
-
severity String? /// optional (low|med|high|critical or free-form)
|
|
238
|
-
meta Json?
|
|
239
|
-
created_at DateTime @default(now())
|
|
240
|
-
updated_at DateTime @updatedAt
|
|
241
|
-
|
|
242
|
-
plugin Plugin @relation(fields: [plugin_id], references: [id])
|
|
243
|
-
reporter Author @relation("IssueReporter", fields: [reporter_id], references: [id])
|
|
244
|
-
messages PluginIssueMessage[]
|
|
245
|
-
|
|
246
|
-
@@index([plugin_id])
|
|
247
|
-
@@index([reporter_id])
|
|
248
|
-
@@map("plugin_issues")
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
// PLUGIN ISSUE MESSAGES (author-based)
|
|
252
|
-
///@guarded:id
|
|
253
|
-
///@fillable:issue_id,author_id,message
|
|
254
|
-
model PluginIssueMessage {
|
|
255
|
-
id BigInt @id @default(autoincrement()) @db.BigInt
|
|
256
|
-
issue_id BigInt
|
|
257
|
-
author_id BigInt
|
|
258
|
-
message String @db.Text
|
|
259
|
-
created_at DateTime @default(now())
|
|
260
|
-
updated_at DateTime @updatedAt
|
|
261
|
-
|
|
262
|
-
issue PluginIssue @relation(fields: [issue_id], references: [id])
|
|
263
|
-
author Author @relation(fields: [author_id], references: [id])
|
|
264
|
-
|
|
265
|
-
@@index([issue_id])
|
|
266
|
-
@@index([author_id])
|
|
267
|
-
@@map("plugin_issue_messages")
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
// AUDIT LOGS (global; add optional author)
|
|
271
|
-
///@guarded:id
|
|
272
|
-
///@fillable:actor,actor_author_id,action,context
|
|
273
|
-
model AuditLog {
|
|
274
|
-
id BigInt @id @default(autoincrement()) @db.BigInt
|
|
275
|
-
actor String?
|
|
276
|
-
actor_author_id BigInt?
|
|
277
|
-
action String
|
|
278
|
-
context Json?
|
|
279
|
-
created_at DateTime @default(now())
|
|
280
|
-
updated_at DateTime @updatedAt
|
|
281
|
-
|
|
282
|
-
actorAuthor Author? @relation("AuditActor", fields: [actor_author_id], references: [id])
|
|
283
|
-
|
|
284
|
-
@@index([actor_author_id])
|
|
285
|
-
@@map("audit_logs")
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
// PLUGIN AUDIT LOGS (per-plugin; add optional author)
|
|
289
|
-
///@guarded:id
|
|
290
|
-
///@fillable:plugin_id,actor,actor_author_id,type,action,resource,context
|
|
291
|
-
model PluginAuditLog {
|
|
292
|
-
id BigInt @id @default(autoincrement()) @db.BigInt
|
|
293
|
-
plugin_id BigInt
|
|
294
|
-
actor String?
|
|
295
|
-
actor_author_id BigInt?
|
|
296
|
-
type String
|
|
297
|
-
action String
|
|
298
|
-
resource String
|
|
299
|
-
context Json?
|
|
300
|
-
created_at DateTime @default(now())
|
|
301
|
-
updated_at DateTime @updatedAt
|
|
302
|
-
|
|
303
|
-
plugin Plugin @relation(fields: [plugin_id], references: [id])
|
|
304
|
-
actorAuthor Author? @relation("PluginAuditActor", fields: [actor_author_id], references: [id])
|
|
305
|
-
|
|
306
|
-
@@index([plugin_id])
|
|
307
|
-
@@index([actor_author_id])
|
|
308
|
-
@@map("plugin_audit_logs")
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
// PLACEHOLDERS (unchanged except optional link to authors kept via tokens/zips)
|
|
312
|
-
///@guarded:id
|
|
313
|
-
///@fillable:slug,name,unique_key,owner_ref,meta
|
|
314
|
-
model PluginPlaceholder {
|
|
315
|
-
id BigInt @id @default(autoincrement()) @db.BigInt
|
|
316
|
-
slug String @unique
|
|
317
|
-
name String @unique
|
|
318
|
-
unique_key String @unique
|
|
319
|
-
owner_ref String?
|
|
320
|
-
meta Json?
|
|
321
|
-
created_at DateTime @default(now())
|
|
322
|
-
updated_at DateTime @updatedAt
|
|
323
|
-
|
|
324
|
-
tokens PluginToken[]
|
|
325
|
-
signatures PluginSignature[]
|
|
326
|
-
zips PluginZip[]
|
|
327
|
-
plugin Plugin?
|
|
328
|
-
|
|
329
|
-
@@map("placeholders")
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
// SIGNATURES (unchanged)
|
|
333
|
-
///@guarded:id
|
|
334
|
-
///@fillable:placeholder_id,host_domain,owner_host,plugin_key,signature
|
|
335
|
-
model PluginSignature {
|
|
336
|
-
id BigInt @id @default(autoincrement()) @db.BigInt
|
|
337
|
-
placeholder_id BigInt
|
|
338
|
-
host_domain String
|
|
339
|
-
owner_host String
|
|
340
|
-
plugin_key String
|
|
341
|
-
signature String
|
|
342
|
-
created_at DateTime @default(now())
|
|
343
|
-
updated_at DateTime @updatedAt
|
|
344
|
-
|
|
345
|
-
placeholder PluginPlaceholder @relation(fields: [placeholder_id], references: [id])
|
|
346
|
-
|
|
347
|
-
@@index([placeholder_id])
|
|
348
|
-
@@map("plugin_signatures")
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
// Enums
|
|
352
|
-
enum KeyPurpose {
|
|
353
|
-
packager_sign
|
|
354
|
-
installer_verify
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
// Model
|
|
358
|
-
///@guarded:id
|
|
359
|
-
///@fillable:purpose,public_pem,private_pem,fingerprint,created_at,rotated_at
|
|
360
|
-
model HostKey {
|
|
361
|
-
id BigInt @id @default(autoincrement()) @db.BigInt
|
|
362
|
-
purpose KeyPurpose
|
|
363
|
-
public_pem String @db.Text
|
|
364
|
-
private_pem String? @db.Text
|
|
365
|
-
fingerprint String @unique
|
|
366
|
-
created_at DateTime @default(now())
|
|
367
|
-
updated_at DateTime?
|
|
368
|
-
rotated_at DateTime?
|
|
369
|
-
|
|
370
|
-
@@map("host_keys")
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
/// ===========================
|
|
374
|
-
/// Polymorphic enum
|
|
375
|
-
/// ===========================
|
|
376
|
-
enum PermissionType {
|
|
377
|
-
db
|
|
378
|
-
file
|
|
379
|
-
notification
|
|
380
|
-
module
|
|
381
|
-
network
|
|
382
|
-
codec // obfuscator
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
/// ===========================
|
|
386
|
-
/// Route approval enum (as you defined)
|
|
387
|
-
/// ===========================
|
|
388
|
-
enum RoutePermissionStatus {
|
|
389
|
-
pending
|
|
390
|
-
approved
|
|
391
|
-
denied
|
|
392
|
-
revoked
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
/// ===========================
|
|
396
|
-
/// Optional bundles (tags)
|
|
397
|
-
/// ===========================
|
|
398
|
-
|
|
399
|
-
///@guarded:id
|
|
400
|
-
///@fillable:name,description,is_system,status
|
|
401
|
-
model PermissionTag {
|
|
402
|
-
id BigInt @id @default(autoincrement()) @db.BigInt
|
|
403
|
-
name String @unique
|
|
404
|
-
description String?
|
|
405
|
-
is_system Boolean @default(false)
|
|
406
|
-
status PluginStatus @default(active)
|
|
407
|
-
created_at DateTime @default(now())
|
|
408
|
-
updated_at DateTime @updatedAt
|
|
409
|
-
|
|
410
|
-
// assignments
|
|
411
|
-
plugins PluginPermissionTag[]
|
|
412
|
-
items PermissionTagItem[]
|
|
413
|
-
|
|
414
|
-
@@map("permission_tags")
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
/// Assign a tag to a plugin (plugins inherit all tag items)
|
|
418
|
-
/// Host can time-window the entire tag assignment.
|
|
419
|
-
///@guarded:id
|
|
420
|
-
///@fillable:plugin_id,tag_id,active,limited,limit_type,limit_value
|
|
421
|
-
model PluginPermissionTag {
|
|
422
|
-
id BigInt @id @default(autoincrement()) @db.BigInt
|
|
423
|
-
plugin_id BigInt
|
|
424
|
-
tag_id BigInt
|
|
425
|
-
active Boolean @default(true)
|
|
426
|
-
|
|
427
|
-
// Host-only approval window (not from manifest)
|
|
428
|
-
limited Boolean @default(false)
|
|
429
|
-
limit_type String?
|
|
430
|
-
limit_value String?
|
|
431
|
-
|
|
432
|
-
created_at DateTime @default(now())
|
|
433
|
-
updated_at DateTime @updatedAt
|
|
434
|
-
|
|
435
|
-
plugin Plugin @relation(fields: [plugin_id], references: [id])
|
|
436
|
-
tag PermissionTag @relation(fields: [tag_id], references: [id])
|
|
437
|
-
|
|
438
|
-
@@unique([plugin_id, tag_id])
|
|
439
|
-
@@index([plugin_id])
|
|
440
|
-
@@index([tag_id])
|
|
441
|
-
@@map("plugin_permission_tags")
|
|
442
|
-
}
|
|
443
|
-
|
|
444
|
-
/// Tag → Concrete permission (polymorphic)
|
|
445
|
-
/// Allows per-item constraints/audit at the tag layer.
|
|
446
|
-
///@guarded:id
|
|
447
|
-
///@fillable:tag_id,permission_type,permission_id,constraints,audit
|
|
448
|
-
model PermissionTagItem {
|
|
449
|
-
id BigInt @id @default(autoincrement()) @db.BigInt
|
|
450
|
-
tag_id BigInt
|
|
451
|
-
permission_type PermissionType
|
|
452
|
-
permission_id BigInt @db.BigInt
|
|
453
|
-
|
|
454
|
-
// Assignment-level metadata (host managed)
|
|
455
|
-
constraints Json?
|
|
456
|
-
audit Json?
|
|
457
|
-
|
|
458
|
-
created_at DateTime @default(now())
|
|
459
|
-
updated_at DateTime @updatedAt
|
|
460
|
-
|
|
461
|
-
tag PermissionTag @relation(fields: [tag_id], references: [id])
|
|
462
|
-
|
|
463
|
-
@@unique([tag_id, permission_type, permission_id])
|
|
464
|
-
@@index([tag_id])
|
|
465
|
-
@@map("permission_tag_items")
|
|
466
|
-
}
|
|
467
|
-
|
|
468
|
-
/// ===========================
|
|
469
|
-
/// Direct plugin assignments
|
|
470
|
-
/// ===========================
|
|
471
|
-
|
|
472
|
-
/// Plugin → Concrete permission (polymorphic)
|
|
473
|
-
/// Includes constraints/audit at the direct assignment level.
|
|
474
|
-
///@guarded:id
|
|
475
|
-
///@fillable:plugin_id,permission_type,permission_id,active,limited,limit_type,limit_value,constraints,audit
|
|
476
|
-
model PluginPermission {
|
|
477
|
-
id BigInt @id @default(autoincrement()) @db.BigInt
|
|
478
|
-
plugin_id BigInt
|
|
479
|
-
permission_type PermissionType
|
|
480
|
-
permission_id BigInt @db.BigInt
|
|
481
|
-
active Boolean @default(false)
|
|
482
|
-
|
|
483
|
-
// Host-only approval window (not from manifest)
|
|
484
|
-
limited Boolean @default(false)
|
|
485
|
-
limit_type String?
|
|
486
|
-
limit_value String?
|
|
487
|
-
|
|
488
|
-
// Assignment-level metadata (host managed)
|
|
489
|
-
constraints Json?
|
|
490
|
-
audit Json?
|
|
491
|
-
|
|
492
|
-
created_at DateTime @default(now())
|
|
493
|
-
updated_at DateTime @updatedAt
|
|
494
|
-
|
|
495
|
-
plugin Plugin @relation(fields: [plugin_id], references: [id])
|
|
496
|
-
|
|
497
|
-
@@unique([plugin_id, permission_type, permission_id])
|
|
498
|
-
@@index([plugin_id])
|
|
499
|
-
@@map("plugin_permissions")
|
|
500
|
-
}
|
|
501
|
-
|
|
502
|
-
/// ===========================
|
|
503
|
-
/// Concrete permissions (strict action parity)
|
|
504
|
-
/// ===========================
|
|
505
|
-
|
|
506
|
-
/// DB — actions: select, insert, update, delete, truncate, grouped_queries
|
|
507
|
-
///@guarded:id,permissions,natural_key
|
|
508
|
-
///@fillable:natural_key,model,table,readable_columns,writable_columns,limited,limit_type,limit_value
|
|
509
|
-
model DbPermission {
|
|
510
|
-
id BigInt @id @default(autoincrement()) @db.BigInt
|
|
511
|
-
|
|
512
|
-
/// Deterministic natural key (e.g., hash of model/table/columns/action-set)
|
|
513
|
-
natural_key String @unique
|
|
514
|
-
|
|
515
|
-
model String? // alias/FQCN (host-catalog validated if provided)
|
|
516
|
-
table String? // optional raw table name
|
|
517
|
-
|
|
518
|
-
// Boolean map: { select, insert, update, delete, truncate, grouped_queries }
|
|
519
|
-
permissions Json // SERVICE-MANAGED
|
|
520
|
-
|
|
521
|
-
readable_columns Json?
|
|
522
|
-
writable_columns Json?
|
|
523
|
-
|
|
524
|
-
created_at DateTime @default(now())
|
|
525
|
-
updated_at DateTime @updatedAt
|
|
526
|
-
|
|
527
|
-
@@map("db_permissions")
|
|
528
|
-
}
|
|
529
|
-
|
|
530
|
-
/// FILE — actions: read, write, append, delete, mkdir, rmdir, list
|
|
531
|
-
///@guarded:id,permissions,natural_key
|
|
532
|
-
///@fillable:natural_key,base_dir,paths,limited,limit_type,limit_value
|
|
533
|
-
model FilePermission {
|
|
534
|
-
id BigInt @id @default(autoincrement()) @db.BigInt
|
|
535
|
-
|
|
536
|
-
/// Deterministic natural key (e.g., hash of base_dir/paths/action-set)
|
|
537
|
-
natural_key String @unique
|
|
538
|
-
|
|
539
|
-
base_dir String
|
|
540
|
-
paths Json // ["**/*","logs/*",...]
|
|
541
|
-
|
|
542
|
-
// Boolean map: { read, write, append, delete, mkdir, rmdir, list }
|
|
543
|
-
permissions Json // SERVICE-MANAGED
|
|
544
|
-
|
|
545
|
-
created_at DateTime @default(now())
|
|
546
|
-
updated_at DateTime @updatedAt
|
|
547
|
-
|
|
548
|
-
@@map("file_permissions")
|
|
549
|
-
}
|
|
550
|
-
|
|
551
|
-
/// NOTIFY — actions: send, receive
|
|
552
|
-
///@guarded:id,permissions,natural_key
|
|
553
|
-
///@fillable:natural_key,channel,templates_allowed,recipients_allowed,limited,limit_type,limit_value
|
|
554
|
-
model NotificationPermission {
|
|
555
|
-
id BigInt @id @default(autoincrement()) @db.BigInt
|
|
556
|
-
|
|
557
|
-
/// Deterministic natural key (e.g., hash of channel/templates/recipients/action-set)
|
|
558
|
-
natural_key String @unique
|
|
559
|
-
|
|
560
|
-
channel String // host-defined alias
|
|
561
|
-
|
|
562
|
-
// Boolean map: { send, receive }
|
|
563
|
-
permissions Json // SERVICE-MANAGED
|
|
564
|
-
|
|
565
|
-
templates_allowed Json?
|
|
566
|
-
recipients_allowed Json?
|
|
567
|
-
|
|
568
|
-
created_at DateTime @default(now())
|
|
569
|
-
updated_at DateTime @updatedAt
|
|
570
|
-
|
|
571
|
-
@@map("notification_permissions")
|
|
572
|
-
}
|
|
573
|
-
|
|
574
|
-
/// MODULE — single action: call → access flag
|
|
575
|
-
///@guarded:id,natural_key
|
|
576
|
-
///@fillable:natural_key,module,apis,access,limited,limit_type,limit_value
|
|
577
|
-
model ModulePermission {
|
|
578
|
-
id BigInt @id @default(autoincrement()) @db.BigInt
|
|
579
|
-
|
|
580
|
-
/// Deterministic natural key (e.g., hash of module/apis)
|
|
581
|
-
natural_key String @unique
|
|
582
|
-
|
|
583
|
-
module String // alias or FQCN (host-catalog validated)
|
|
584
|
-
apis Json // ["createToken","revokeToken",...]
|
|
585
|
-
access Boolean @default(false) // action: call
|
|
586
|
-
|
|
587
|
-
created_at DateTime @default(now())
|
|
588
|
-
updated_at DateTime @updatedAt
|
|
589
|
-
|
|
590
|
-
@@map("module_permissions")
|
|
591
|
-
}
|
|
592
|
-
|
|
593
|
-
/// NETWORK — single action: request → access flag
|
|
594
|
-
/// NOTE: natural key is `rule_key` (kept as-is).
|
|
595
|
-
///@guarded:id,rule_key
|
|
596
|
-
///@fillable:rule_key,label,hosts,methods,schemes,ports,paths,headers_allowed,ips_allowed,auth_via_host_secret,access,limited,limit_type,limit_value
|
|
597
|
-
model NetworkPermission {
|
|
598
|
-
id BigInt @id @default(autoincrement()) @db.BigInt
|
|
599
|
-
|
|
600
|
-
/// Deterministic fingerprint for this rule (e.g., sha1 over hosts/methods/schemes/ports/paths).
|
|
601
|
-
natural_key String @unique
|
|
602
|
-
|
|
603
|
-
/// Optional human-readable label for admins/reviewers.
|
|
604
|
-
label String?
|
|
605
|
-
|
|
606
|
-
/// Gate for network egress via the host HTTP client.
|
|
607
|
-
access Boolean @default(false)
|
|
608
|
-
|
|
609
|
-
/// Allowlists (manifest `target` fields)
|
|
610
|
-
hosts Json // ["api.stripe.com","*.example.com"]
|
|
611
|
-
methods Json // ["GET","POST"]
|
|
612
|
-
schemes Json?
|
|
613
|
-
ports Json?
|
|
614
|
-
paths Json?
|
|
615
|
-
headers_allowed Json?
|
|
616
|
-
ips_allowed Json?
|
|
617
|
-
|
|
618
|
-
/// Secrets policy: if true, the host injects credentials; plugins don't supply secrets.
|
|
619
|
-
auth_via_host_secret Boolean @default(true)
|
|
620
|
-
|
|
621
|
-
created_at DateTime @default(now())
|
|
622
|
-
updated_at DateTime @updatedAt
|
|
623
|
-
|
|
624
|
-
@@map("network_permissions")
|
|
625
|
-
}
|
|
626
|
-
|
|
627
|
-
/// CODEC/OBFUSCATOR — single action: invoke → access flag
|
|
628
|
-
///@guarded:id,natural_key
|
|
629
|
-
///@fillable:natural_key,module,allowed,access,limited,limit_type,limit_value
|
|
630
|
-
model CodecPermission {
|
|
631
|
-
id BigInt @id @default(autoincrement()) @db.BigInt
|
|
632
|
-
|
|
633
|
-
/// Deterministic natural key (e.g., hash of allowed+access)
|
|
634
|
-
natural_key String @unique
|
|
635
|
-
|
|
636
|
-
module String @default("codec")
|
|
637
|
-
allowed Json? // validated against Obfuscator catalog
|
|
638
|
-
access Boolean @default(false) // action: invoke
|
|
639
|
-
|
|
640
|
-
created_at DateTime @default(now())
|
|
641
|
-
updated_at DateTime @updatedAt
|
|
642
|
-
|
|
643
|
-
@@map("codec_permissions")
|
|
644
|
-
}
|
|
645
|
-
|
|
646
|
-
/// ===========================
|
|
647
|
-
/// Per-route approvals (as provided)
|
|
648
|
-
/// ===========================
|
|
649
|
-
|
|
650
|
-
/// @fillable(plugin_id, route_id, status, guard, meta, approved_at)
|
|
651
|
-
model PluginRoutePermission {
|
|
652
|
-
id BigInt @id @default(autoincrement())
|
|
653
|
-
plugin_id BigInt
|
|
654
|
-
plugin Plugin @relation(fields: [plugin_id], references: [id])
|
|
655
|
-
|
|
656
|
-
/// The JSON-declared route `id` (unique per plugin).
|
|
657
|
-
route_id String
|
|
658
|
-
|
|
659
|
-
/// Current permission state.
|
|
660
|
-
status RoutePermissionStatus @default(pending)
|
|
661
|
-
|
|
662
|
-
/// Optional: lock the guard used when writing this route.
|
|
663
|
-
guard String?
|
|
664
|
-
|
|
665
|
-
/// Host-defined metadata (notes, expiresAt, reasons, etc.).
|
|
666
|
-
meta Json?
|
|
667
|
-
|
|
668
|
-
approved_at DateTime?
|
|
669
|
-
created_at DateTime @default(now())
|
|
670
|
-
updated_at DateTime @updatedAt
|
|
671
|
-
|
|
672
|
-
@@unique([plugin_id, route_id])
|
|
673
|
-
@@index([plugin_id, status])
|
|
674
|
-
@@map("plugin_route_permissions")
|
|
675
|
-
}
|
|
676
|
-
|
|
677
|
-
/// ===========================
|
|
678
|
-
/// Plugin (links to pivots)
|
|
679
|
-
/// ===========================
|
|
680
|
-
/// NOTE: Assuming PluginStatus enum & other related models already exist.
|
|
681
|
-
///@guarded
|
|
682
|
-
model Plugin {
|
|
683
|
-
id BigInt @id @default(autoincrement()) @db.BigInt
|
|
684
|
-
name String @unique
|
|
685
|
-
image String?
|
|
686
|
-
status PluginStatus @default(active)
|
|
687
|
-
config Json?
|
|
688
|
-
meta Json?
|
|
689
|
-
plugin_placeholder_id BigInt @unique @db.BigInt
|
|
690
|
-
active_version_id BigInt
|
|
691
|
-
owner_ref String?
|
|
692
|
-
|
|
693
|
-
// existing relations (assumed to exist)
|
|
694
|
-
placeholder PluginPlaceholder @relation(fields: [plugin_placeholder_id], references: [id])
|
|
695
|
-
plugin_settings PluginSetting[]
|
|
696
|
-
plugin_versions PluginVersion[]
|
|
697
|
-
logs PluginAuditLog[]
|
|
698
|
-
authors PluginAuthor[]
|
|
699
|
-
issues PluginIssue[]
|
|
700
|
-
|
|
701
|
-
// direct + tag bundles
|
|
702
|
-
plugin_permissions PluginPermission[]
|
|
703
|
-
permission_tags PluginPermissionTag[]
|
|
704
|
-
|
|
705
|
-
// per-route approvals
|
|
706
|
-
routes PluginRoutePermission[]
|
|
707
|
-
|
|
708
|
-
activated_at DateTime?
|
|
709
|
-
activated_by BigInt?
|
|
710
|
-
|
|
711
|
-
created_at DateTime @default(now())
|
|
712
|
-
updated_at DateTime @updatedAt
|
|
713
|
-
|
|
714
|
-
@@map("plugins")
|
|
715
|
-
}
|