@sixb/sqlite 0.1.12 → 0.1.14

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 (44) hide show
  1. package/dist/auth-storage/access-tokens.d.ts +0 -1
  2. package/dist/auth-storage/access-tokens.d.ts.map +1 -1
  3. package/dist/auth-storage/auth-storage.d.ts +2 -1
  4. package/dist/auth-storage/auth-storage.d.ts.map +1 -1
  5. package/dist/auth-storage/device-authorizations.d.ts.map +1 -1
  6. package/dist/auth-storage/rows.d.ts +7 -4
  7. package/dist/auth-storage/rows.d.ts.map +1 -1
  8. package/dist/auth-storage/sessions.d.ts +8 -1
  9. package/dist/auth-storage/sessions.d.ts.map +1 -1
  10. package/dist/auth-storage/shared.d.ts.map +1 -1
  11. package/dist/file-upload-session-storage.d.ts +6 -0
  12. package/dist/file-upload-session-storage.d.ts.map +1 -0
  13. package/dist/index.d.ts +2 -0
  14. package/dist/index.d.ts.map +1 -1
  15. package/dist/index.js +441 -123
  16. package/dist/index.js.map +18 -17
  17. package/dist/migrations.d.ts.map +1 -1
  18. package/dist/objects/storage.d.ts.map +1 -1
  19. package/dist/ontology-storage/materializations.d.ts +0 -2
  20. package/dist/ontology-storage/materializations.d.ts.map +1 -1
  21. package/dist/ontology-storage/shared.d.ts +2 -1
  22. package/dist/ontology-storage/shared.d.ts.map +1 -1
  23. package/dist/workflow-intervention-storage.d.ts.map +1 -1
  24. package/package.json +3 -3
  25. package/src/auth-storage/access-tokens.ts +11 -18
  26. package/src/auth-storage/auth-storage.ts +49 -86
  27. package/src/auth-storage/device-authorizations.ts +3 -5
  28. package/src/auth-storage/rows.ts +18 -8
  29. package/src/auth-storage/sessions.ts +89 -4
  30. package/src/auth-storage/shared.ts +9 -3
  31. package/src/file-upload-session-storage.ts +136 -0
  32. package/src/index.ts +5 -0
  33. package/src/migrations/046-workflow-intervention-principals.sql +15 -0
  34. package/src/migrations/047-ontology-commit-attribution.sql +67 -0
  35. package/src/migrations/048-file-upload-sessions.sql +35 -0
  36. package/src/migrations/049-native-sessions.sql +12 -0
  37. package/src/migrations/050-directory-group-memberships.sql +21 -0
  38. package/src/migrations.ts +16 -0
  39. package/src/objects/query-compiler.ts +59 -4
  40. package/src/objects/reader.ts +4 -0
  41. package/src/objects/storage.ts +1 -0
  42. package/src/ontology-storage/materializations.ts +16 -59
  43. package/src/ontology-storage/shared.ts +7 -3
  44. package/src/workflow-intervention-storage.ts +9 -9
@@ -6,8 +6,8 @@ import type {
6
6
  ExpireWorkflowInterventionInput,
7
7
  ListWorkflowInterventionsInput,
8
8
  ListWorkflowInterventionsResult,
9
+ Principal,
9
10
  SubmitWorkflowInterventionInput,
10
- WorkflowInterventionActor,
11
11
  WorkflowInterventionRecord,
12
12
  WorkflowInterventionStorage,
13
13
  } from "@sixb/core/storage"
@@ -113,7 +113,7 @@ export class SqliteWorkflowInterventionStorage implements WorkflowInterventionSt
113
113
  .run(
114
114
  "submitted",
115
115
  (input.submittedAt ?? new Date()).toISOString(),
116
- serializeActor(input.submittedBy),
116
+ serializePrincipal(input.submittedBy),
117
117
  serializeRecord(input.response),
118
118
  existing.project_id,
119
119
  existing.id
@@ -141,7 +141,7 @@ export class SqliteWorkflowInterventionStorage implements WorkflowInterventionSt
141
141
  .run(
142
142
  "cancelled",
143
143
  (input.cancelledAt ?? new Date()).toISOString(),
144
- serializeActor(input.cancelledBy),
144
+ serializePrincipal(input.cancelledBy),
145
145
  existing.project_id,
146
146
  existing.id
147
147
  )
@@ -331,12 +331,12 @@ function parseRecord(value: string): WorkflowIOSnapshot {
331
331
  return JSON.parse(value) as WorkflowIOSnapshot
332
332
  }
333
333
 
334
- function serializeActor(actor: WorkflowInterventionActor | undefined): string | null {
335
- return actor ? JSON.stringify(actor) : null
334
+ function serializePrincipal(principal: Principal | undefined): string | null {
335
+ return principal ? JSON.stringify(principal) : null
336
336
  }
337
337
 
338
- function parseActor(value: string | null): WorkflowInterventionActor | undefined {
339
- return value ? (JSON.parse(value) as WorkflowInterventionActor) : undefined
338
+ function parsePrincipal(value: string | null): Principal | undefined {
339
+ return value ? (JSON.parse(value) as Principal) : undefined
340
340
  }
341
341
 
342
342
  function rowToWorkflowInterventionRecord(
@@ -358,10 +358,10 @@ function rowToWorkflowInterventionRecord(
358
358
  requestedAt: new Date(row.requested_at),
359
359
  expiresAt: row.expires_at ? new Date(row.expires_at) : undefined,
360
360
  submittedAt: row.submitted_at ? new Date(row.submitted_at) : undefined,
361
- submittedBy: parseActor(row.submitted_by),
361
+ submittedBy: parsePrincipal(row.submitted_by),
362
362
  response: row.response ? parseRecord(row.response) : undefined,
363
363
  cancelledAt: row.cancelled_at ? new Date(row.cancelled_at) : undefined,
364
- cancelledBy: parseActor(row.cancelled_by),
364
+ cancelledBy: parsePrincipal(row.cancelled_by),
365
365
  expiredAt: row.expired_at ? new Date(row.expired_at) : undefined,
366
366
  }
367
367
  }