@highstate/backend 0.9.18 → 0.9.20
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/dist/{chunk-OU5OQBLB.js → chunk-I7BWSAN6.js} +3 -28
- package/dist/{chunk-OU5OQBLB.js.map → chunk-I7BWSAN6.js.map} +1 -1
- package/dist/chunk-RC6Q3XQQ.js +1547 -0
- package/dist/chunk-RC6Q3XQQ.js.map +1 -0
- package/dist/chunk-VB4YL327.js +139 -0
- package/dist/chunk-VB4YL327.js.map +1 -0
- package/dist/database/local/prisma.config.js +26 -0
- package/dist/database/local/prisma.config.js.map +1 -0
- package/dist/highstate.manifest.json +2 -1
- package/dist/index.js +7590 -7289
- package/dist/index.js.map +1 -1
- package/dist/library/package-resolution-worker.js +1 -1
- package/dist/library/package-resolution-worker.js.map +1 -1
- package/dist/library/worker/main.js +35 -29
- package/dist/library/worker/main.js.map +1 -1
- package/dist/shared/index.js +2 -2
- package/package.json +18 -9
- package/prisma/backend/_schema/layout.prisma +7 -0
- package/prisma/backend/_schema/library.prisma +17 -0
- package/prisma/backend/_schema/project.prisma +101 -0
- package/prisma/backend/_schema/pulumi.prisma +17 -0
- package/prisma/backend/postgresql/main.prisma +17 -0
- package/prisma/backend/sqlite/main.prisma +17 -0
- package/prisma/backend/sqlite/migrations/20250817070609_initiial/migration.sql +34 -0
- package/prisma/backend/sqlite/migrations/20250817104948_add_fields/migration.sql +59 -0
- package/prisma/backend/sqlite/migrations/20250818082732_add_models/migration.sql +41 -0
- package/prisma/backend/sqlite/migrations/20250818083106_a/migration.sql +19 -0
- package/prisma/backend/sqlite/migrations/20250818101945_hi/migration.sql +1 -0
- package/prisma/backend/sqlite/migrations/20250819082315_a/migration.sql +5 -0
- package/prisma/backend/sqlite/migrations/migration_lock.toml +3 -0
- package/prisma/project/api-key.prisma +32 -0
- package/prisma/project/artifact.prisma +52 -0
- package/prisma/project/custom-status.prisma +46 -0
- package/prisma/project/evaluation.prisma +45 -0
- package/prisma/project/instance.prisma +157 -0
- package/prisma/project/layout.prisma +23 -0
- package/prisma/project/lock.prisma +18 -0
- package/prisma/project/main.prisma +17 -0
- package/prisma/project/migrations/20250816081310_initial/migration.sql +300 -0
- package/prisma/project/migrations/20250816082523_test/migration.sql +72 -0
- package/prisma/project/migrations/20250818065643_update/migration.sql +42 -0
- package/prisma/project/migrations/20250818070758_a/migration.sql +8 -0
- package/prisma/project/migrations/20250818070913_a/migration.sql +8 -0
- package/prisma/project/migrations/20250818082720_add_motels/migration.sql +11 -0
- package/prisma/project/migrations/20250818112523_hello/migration.sql +35 -0
- package/prisma/project/migrations/20250819082305_a/migration.sql +14 -0
- package/prisma/project/migrations/20250819165004_add_missing_fields/migration.sql +216 -0
- package/prisma/project/migrations/20250819171309_a/migration.sql +22 -0
- package/prisma/project/migrations/20250820113949_a/migration.sql +66 -0
- package/prisma/project/migrations/20250820144256_b/migration.sql +31 -0
- package/prisma/project/migrations/20250820145547_a/migration.sql +24 -0
- package/prisma/project/migrations/20250820182517_b/migration.sql +2 -0
- package/prisma/project/migrations/20250821172324_a/migration.sql +2 -0
- package/prisma/project/migrations/20250822081339_a/migration.sql +219 -0
- package/prisma/project/migrations/20250822083742_b/migration.sql +1 -0
- package/prisma/project/migrations/20250822105134_boom/migration.sql +1 -0
- package/prisma/project/migrations/20250822141028_b/migration.sql +1 -0
- package/prisma/project/migrations/20250822142342_b/migration.sql +16 -0
- package/prisma/project/migrations/20250824072720_a/migration.sql +1 -0
- package/prisma/project/migrations/20250824093656_b/migration.sql +21 -0
- package/prisma/project/migrations/20250825082518_a/migration.sql +1 -0
- package/prisma/project/migrations/20250825085343_b/migration.sql +1 -0
- package/prisma/project/migrations/20250825091312_a/migration.sql +1 -0
- package/prisma/project/migrations/20250903095431_hi/migration.sql +44 -0
- package/prisma/project/migrations/20250903174255_a/migration.sql +24 -0
- package/prisma/project/migrations/20250908095205_hi/migration.sql +18 -0
- package/prisma/project/migrations/20250909155857_hi/migration.sql +15 -0
- package/prisma/project/migrations/migration_lock.toml +3 -0
- package/prisma/project/model.prisma +37 -0
- package/prisma/project/operation.prisma +148 -0
- package/prisma/project/page.prisma +49 -0
- package/prisma/project/secret.prisma +54 -0
- package/prisma/project/service-account.prisma +42 -0
- package/prisma/project/terminal.prisma +107 -0
- package/prisma/project/trigger.prisma +37 -0
- package/prisma/project/unlock-method.prisma +46 -0
- package/prisma/project/worker.prisma +169 -0
- package/src/artifact/abstractions.ts +13 -13
- package/src/artifact/encryption.ts +30 -54
- package/src/artifact/factory.ts +6 -9
- package/src/artifact/local.ts +33 -46
- package/src/business/api-key.ts +24 -36
- package/src/business/artifact.test.ts +978 -0
- package/src/business/artifact.ts +136 -216
- package/src/business/evaluation.ts +328 -0
- package/src/business/index.ts +5 -2
- package/src/business/instance-lock.test.ts +1060 -0
- package/src/business/instance-lock.ts +387 -78
- package/src/business/instance-state.test.ts +735 -0
- package/src/business/instance-state.ts +582 -337
- package/src/business/operation.test.ts +439 -0
- package/src/business/operation.ts +174 -208
- package/src/business/project-model.ts +258 -0
- package/src/business/project-unlock.ts +168 -126
- package/src/business/project.ts +287 -179
- package/src/business/secret.test.ts +469 -130
- package/src/business/secret.ts +177 -217
- package/src/business/settings.test.ts +695 -0
- package/src/business/settings.ts +855 -0
- package/src/business/terminal-session.ts +90 -0
- package/src/business/unit-extra.test.ts +539 -0
- package/src/business/unit-extra.ts +160 -0
- package/src/business/worker.test.ts +356 -579
- package/src/business/worker.ts +238 -339
- package/src/common/codebase.ts +65 -0
- package/src/common/index.ts +3 -5
- package/src/common/logger.ts +5 -0
- package/src/common/utils.ts +4 -3
- package/src/config.ts +10 -11
- package/src/database/_generated/backend/postgresql/client.ts +72 -0
- package/src/database/_generated/backend/postgresql/commonInputTypes.ts +350 -0
- package/src/database/_generated/backend/postgresql/enums.ts +13 -0
- package/src/database/_generated/backend/postgresql/internal/class.ts +320 -0
- package/src/database/_generated/backend/postgresql/internal/prismaNamespace.ts +1238 -0
- package/src/database/_generated/backend/postgresql/models/Library.ts +1263 -0
- package/src/database/_generated/backend/postgresql/models/Project.ts +2175 -0
- package/src/database/_generated/backend/postgresql/models/ProjectModelStorage.ts +1263 -0
- package/src/database/_generated/backend/postgresql/models/ProjectSpace.ts +1602 -0
- package/src/database/_generated/backend/postgresql/models/PulumiBackend.ts +1263 -0
- package/src/database/_generated/backend/postgresql/models/UserWorkspaseLayout.ts +1065 -0
- package/src/database/_generated/backend/postgresql/models.ts +16 -0
- package/src/database/_generated/backend/postgresql/pjtg.ts +182 -0
- package/src/database/_generated/backend/sqlite/client.ts +72 -0
- package/src/database/_generated/backend/sqlite/commonInputTypes.ts +331 -0
- package/src/database/_generated/backend/sqlite/enums.ts +13 -0
- package/src/database/_generated/backend/sqlite/internal/class.ts +318 -0
- package/src/database/_generated/backend/sqlite/internal/prismaNamespace.ts +1207 -0
- package/src/database/_generated/backend/sqlite/models/Library.ts +1261 -0
- package/src/database/_generated/backend/sqlite/models/Project.ts +2169 -0
- package/src/database/_generated/backend/sqlite/models/ProjectModelStorage.ts +1261 -0
- package/src/database/_generated/backend/sqlite/models/ProjectSpace.ts +1599 -0
- package/src/database/_generated/backend/sqlite/models/PulumiBackend.ts +1261 -0
- package/src/database/_generated/backend/sqlite/models/UserWorkspaseLayout.ts +1063 -0
- package/src/database/_generated/backend/sqlite/models.ts +16 -0
- package/src/database/_generated/backend/sqlite/pjtg.ts +182 -0
- package/src/database/_generated/project/client.ts +204 -0
- package/src/database/_generated/project/commonInputTypes.ts +827 -0
- package/src/database/_generated/project/enums.ts +104 -0
- package/src/database/_generated/project/internal/class.ts +479 -0
- package/src/database/_generated/project/internal/prismaNamespace.ts +2974 -0
- package/src/database/_generated/project/models/ApiKey.ts +1506 -0
- package/src/database/_generated/project/models/Artifact.ts +2051 -0
- package/src/database/_generated/project/models/HubModel.ts +1125 -0
- package/src/database/_generated/project/models/InstanceCustomStatus.ts +1713 -0
- package/src/database/_generated/project/models/InstanceEvaluationState.ts +1312 -0
- package/src/database/_generated/project/models/InstanceLock.ts +1268 -0
- package/src/database/_generated/project/models/InstanceModel.ts +1125 -0
- package/src/database/_generated/project/models/InstanceOperationState.ts +1707 -0
- package/src/database/_generated/project/models/InstanceState.ts +4613 -0
- package/src/database/_generated/project/models/Operation.ts +1647 -0
- package/src/database/_generated/project/models/OperationLog.ts +1455 -0
- package/src/database/_generated/project/models/Page.ts +1838 -0
- package/src/database/_generated/project/models/Secret.ts +1692 -0
- package/src/database/_generated/project/models/ServiceAccount.ts +2165 -0
- package/src/database/_generated/project/models/Terminal.ts +2038 -0
- package/src/database/_generated/project/models/TerminalSession.ts +1454 -0
- package/src/database/_generated/project/models/TerminalSessionLog.ts +1280 -0
- package/src/database/_generated/project/models/Trigger.ts +1430 -0
- package/src/database/_generated/project/models/UnlockMethod.ts +1220 -0
- package/src/database/_generated/project/models/UserCompositeViewport.ts +1280 -0
- package/src/database/_generated/project/models/UserProjectViewport.ts +1059 -0
- package/src/database/_generated/project/models/Worker.ts +1459 -0
- package/src/database/_generated/project/models/WorkerUnitRegistration.ts +1524 -0
- package/src/database/_generated/project/models/WorkerVersion.ts +1974 -0
- package/src/database/_generated/project/models/WorkerVersionLog.ts +1318 -0
- package/src/database/_generated/project/models.ts +35 -0
- package/src/database/_generated/project/pjtg.ts +182 -0
- package/src/database/abstractions.ts +19 -0
- package/src/database/factory.ts +37 -0
- package/src/database/index.ts +6 -0
- package/src/database/local/backend.ts +134 -0
- package/src/database/local/index.ts +3 -0
- package/src/database/local/meta.ts +46 -0
- package/src/database/local/prisma.config.ts +25 -0
- package/src/database/local/project.ts +39 -0
- package/src/database/manager.ts +181 -0
- package/src/database/migrate.ts +35 -0
- package/src/database/prisma.ts +56 -0
- package/src/database/well-known.ts +38 -0
- package/src/index.ts +4 -4
- package/src/library/abstractions.ts +3 -5
- package/src/library/factory.ts +1 -1
- package/src/library/local.ts +81 -26
- package/src/library/package-resolution-worker.ts +1 -1
- package/src/library/worker/evaluator.ts +40 -23
- package/src/library/worker/loader.lite.ts +1 -1
- package/src/library/worker/main.ts +3 -10
- package/src/library/worker/protocol.ts +0 -1
- package/src/lock/index.ts +0 -1
- package/src/lock/manager.ts +0 -10
- package/src/orchestrator/manager.ts +190 -104
- package/src/orchestrator/operation-context.ts +357 -0
- package/src/orchestrator/operation-plan.destroy.test.md +357 -0
- package/src/orchestrator/operation-plan.destroy.test.ts +775 -0
- package/src/orchestrator/operation-plan.fixtures.ts +213 -0
- package/src/orchestrator/operation-plan.md +198 -0
- package/src/orchestrator/operation-plan.refresh.test.md +199 -0
- package/src/orchestrator/operation-plan.refresh.test.ts +367 -0
- package/src/orchestrator/operation-plan.ts +709 -0
- package/src/orchestrator/operation-plan.update.test.md +485 -0
- package/src/orchestrator/operation-plan.update.test.ts +1066 -0
- package/src/orchestrator/operation-workset.ts +233 -578
- package/src/orchestrator/operation.ts +440 -948
- package/src/orchestrator/plan-test-builder.ts +267 -0
- package/src/project-model/abstractions.ts +118 -0
- package/src/project-model/backends/codebase.ts +365 -0
- package/src/project-model/backends/database.ts +440 -0
- package/src/project-model/errors.ts +81 -0
- package/src/project-model/factory.ts +24 -0
- package/src/project-model/index.ts +4 -0
- package/src/project-model/utils.test.ts +544 -0
- package/src/project-model/utils.ts +242 -0
- package/src/pubsub/abstractions.ts +10 -1
- package/src/pubsub/factory.ts +4 -4
- package/src/pubsub/index.ts +1 -0
- package/src/pubsub/manager.ts +29 -13
- package/src/pubsub/memory.ts +31 -0
- package/src/runner/abstractions.ts +40 -41
- package/src/runner/artifact-env.ts +19 -8
- package/src/runner/factory.ts +6 -6
- package/src/runner/force-abort.ts +3 -6
- package/src/runner/local.ts +74 -67
- package/src/runner/pulumi.ts +23 -63
- package/src/services.ts +181 -123
- package/src/shared/models/backend/index.ts +3 -1
- package/src/shared/models/backend/library.ts +9 -1
- package/src/shared/models/backend/project.ts +43 -42
- package/src/shared/models/backend/pulumi.ts +14 -0
- package/src/shared/models/backend/unlock-method.ts +1 -1
- package/src/shared/models/backend/well-known.ts +58 -0
- package/src/shared/models/base.ts +40 -26
- package/src/shared/models/errors.ts +82 -1
- package/src/shared/models/index.ts +3 -2
- package/src/shared/models/prisma.ts +36 -0
- package/src/shared/models/project/api-key.ts +37 -59
- package/src/shared/models/project/artifact.ts +16 -76
- package/src/shared/models/project/custom-status.ts +12 -0
- package/src/shared/models/project/index.ts +8 -7
- package/src/shared/models/project/lock.ts +10 -78
- package/src/shared/models/project/model.ts +19 -1
- package/src/shared/models/project/operation.ts +235 -99
- package/src/shared/models/project/page.ts +37 -48
- package/src/shared/models/project/secret.ts +29 -89
- package/src/shared/models/project/service-account.ts +12 -17
- package/src/shared/models/project/state.ts +100 -407
- package/src/shared/models/project/terminal.ts +75 -88
- package/src/shared/models/project/trigger.ts +13 -49
- package/src/shared/models/project/unlock-method.ts +20 -26
- package/src/shared/models/project/worker.ts +89 -90
- package/src/shared/resolvers/graph-resolver.ts +21 -0
- package/src/shared/resolvers/index.ts +1 -1
- package/src/shared/resolvers/input-hash.ts +24 -14
- package/src/shared/resolvers/input.ts +9 -2
- package/src/shared/resolvers/registry.ts +5 -4
- package/src/shared/resolvers/state.ts +12 -1
- package/src/shared/resolvers/validation.ts +7 -3
- package/src/shared/utils/index.ts +1 -2
- package/src/shared/utils/promise-tracker.ts +30 -3
- package/src/terminal/abstractions.ts +1 -1
- package/src/terminal/docker.ts +3 -3
- package/src/terminal/manager.ts +102 -118
- package/src/test-utils/database.ts +119 -0
- package/src/test-utils/index.ts +2 -0
- package/src/test-utils/services.ts +134 -0
- package/src/unlock/abstractions.ts +5 -23
- package/src/unlock/memory.ts +9 -14
- package/src/worker/abstractions.ts +7 -4
- package/src/worker/docker.ts +14 -19
- package/src/worker/manager.ts +366 -97
- package/dist/chunk-NAAIDR4U.js +0 -8499
- package/dist/chunk-NAAIDR4U.js.map +0 -1
- package/dist/chunk-Y7DXREVO.js +0 -1745
- package/dist/chunk-Y7DXREVO.js.map +0 -1
- package/dist/magic-string.es-5ABAC4JN.js +0 -1292
- package/dist/magic-string.es-5ABAC4JN.js.map +0 -1
- package/src/business/__traces__/secret/update-instance-secrets/create-and-delete-secrets-simultaneously.md +0 -356
- package/src/business/__traces__/secret/update-instance-secrets/create-new-secrets-for-instance.md +0 -274
- package/src/business/__traces__/secret/update-instance-secrets/delete-existing-secrets.md +0 -223
- package/src/business/__traces__/secret/update-instance-secrets/no-op-when-no-changes.md +0 -147
- package/src/business/__traces__/secret/update-instance-secrets/update-existing-secrets.md +0 -280
- package/src/business/__traces__/worker/update-unit-registrations/add-new-unit-registration-when-other-exists.md +0 -360
- package/src/business/__traces__/worker/update-unit-registrations/add-new-unit-registration.md +0 -215
- package/src/business/__traces__/worker/update-unit-registrations/create-multiple-workers-with-different-identities.md +0 -427
- package/src/business/__traces__/worker/update-unit-registrations/handle-nonexistent-registration-id-gracefully.md +0 -217
- package/src/business/__traces__/worker/update-unit-registrations/no-op-when-no-changes.md +0 -132
- package/src/business/__traces__/worker/update-unit-registrations/recreate-worker-when-image-changes.md +0 -454
- package/src/business/__traces__/worker/update-unit-registrations/recreate-worker-when-image-version-changes.md +0 -426
- package/src/business/__traces__/worker/update-unit-registrations/recreate-worker-with-same-identity-reuses-service-account.md +0 -372
- package/src/business/__traces__/worker/update-unit-registrations/remove-one-of-multiple-unit-registrations.md +0 -383
- package/src/business/__traces__/worker/update-unit-registrations/remove-unit-registration.md +0 -245
- package/src/business/__traces__/worker/update-unit-registrations/update-existing-unit-registration-when-params-change.md +0 -174
- package/src/business/__traces__/worker/update-unit-registrations/update-params-and-image-simultaneously.md +0 -432
- package/src/business/__traces__/worker/update-unit-registrations/worker-with-multiple-registrations-not-deleted-when-one-removed.md +0 -220
- package/src/business/backend-unlock.ts +0 -10
- package/src/common/clock.ts +0 -18
- package/src/common/performance.ts +0 -44
- package/src/common/random.ts +0 -68
- package/src/common/test/index.ts +0 -2
- package/src/common/test/render.ts +0 -98
- package/src/common/test/tracer.ts +0 -359
- package/src/hotstate/abstractions.ts +0 -48
- package/src/hotstate/factory.ts +0 -17
- package/src/hotstate/index.ts +0 -3
- package/src/hotstate/manager.ts +0 -192
- package/src/hotstate/memory.ts +0 -100
- package/src/hotstate/validation.ts +0 -100
- package/src/lock/test.ts +0 -108
- package/src/project/abstractions.ts +0 -78
- package/src/project/evaluation.ts +0 -248
- package/src/project/factory.ts +0 -11
- package/src/project/index.ts +0 -3
- package/src/project/local.ts +0 -417
- package/src/pubsub/local.ts +0 -36
- package/src/pubsub/validation.ts +0 -33
- package/src/shared/utils/args.ts +0 -25
- package/src/state/abstractions.ts +0 -289
- package/src/state/encryption.ts +0 -98
- package/src/state/factory.ts +0 -20
- package/src/state/index.ts +0 -7
- package/src/state/local/backend.ts +0 -106
- package/src/state/local/collection.ts +0 -361
- package/src/state/local/index.ts +0 -2
- package/src/state/manager.ts +0 -890
- package/src/state/memory/backend.ts +0 -70
- package/src/state/memory/collection.ts +0 -270
- package/src/state/memory/index.ts +0 -2
- package/src/state/repository/index.ts +0 -2
- package/src/state/repository/repository.index.ts +0 -193
- package/src/state/repository/repository.ts +0 -507
- package/src/state/test.ts +0 -457
- /package/src/{state → database/local}/keyring.ts +0 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Warnings:
|
|
3
|
+
|
|
4
|
+
- You are about to drop the column `createdAt` on the `InstanceLock` table. All the data in the column will be lost.
|
|
5
|
+
|
|
6
|
+
*/
|
|
7
|
+
-- RedefineTables
|
|
8
|
+
PRAGMA defer_foreign_keys=ON;
|
|
9
|
+
PRAGMA foreign_keys=OFF;
|
|
10
|
+
CREATE TABLE "new_InstanceLock" (
|
|
11
|
+
"stateId" TEXT NOT NULL PRIMARY KEY,
|
|
12
|
+
"meta" JSONB NOT NULL,
|
|
13
|
+
"token" TEXT NOT NULL,
|
|
14
|
+
"acquiredAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
15
|
+
CONSTRAINT "InstanceLock_stateId_fkey" FOREIGN KEY ("stateId") REFERENCES "InstanceState" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
|
|
16
|
+
);
|
|
17
|
+
INSERT INTO "new_InstanceLock" ("meta", "stateId", "token") SELECT "meta", "stateId", "token" FROM "InstanceLock";
|
|
18
|
+
DROP TABLE "InstanceLock";
|
|
19
|
+
ALTER TABLE "new_InstanceLock" RENAME TO "InstanceLock";
|
|
20
|
+
PRAGMA foreign_keys=ON;
|
|
21
|
+
PRAGMA defer_foreign_keys=OFF;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
-- This is an empty migration.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
-- This is an empty migration.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
-- This is an empty migration.
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Warnings:
|
|
3
|
+
|
|
4
|
+
- You are about to drop the column `scopes` on the `ApiKey` table. All the data in the column will be lost.
|
|
5
|
+
- You are about to drop the column `message` on the `InstanceOperationState` table. All the data in the column will be lost.
|
|
6
|
+
- Added the required column `serviceAccountId` to the `ApiKey` table without a default value. This is not possible if the table is not empty.
|
|
7
|
+
|
|
8
|
+
*/
|
|
9
|
+
-- RedefineTables
|
|
10
|
+
PRAGMA defer_foreign_keys=ON;
|
|
11
|
+
PRAGMA foreign_keys=OFF;
|
|
12
|
+
CREATE TABLE "new_ApiKey" (
|
|
13
|
+
"id" TEXT NOT NULL PRIMARY KEY,
|
|
14
|
+
"meta" JSONB NOT NULL,
|
|
15
|
+
"serviceAccountId" TEXT NOT NULL,
|
|
16
|
+
"token" TEXT NOT NULL,
|
|
17
|
+
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
18
|
+
"updatedAt" DATETIME NOT NULL,
|
|
19
|
+
CONSTRAINT "ApiKey_serviceAccountId_fkey" FOREIGN KEY ("serviceAccountId") REFERENCES "ServiceAccount" ("id") ON DELETE CASCADE ON UPDATE CASCADE
|
|
20
|
+
);
|
|
21
|
+
INSERT INTO "new_ApiKey" ("createdAt", "id", "meta", "token", "updatedAt") SELECT "createdAt", "id", "meta", "token", "updatedAt" FROM "ApiKey";
|
|
22
|
+
DROP TABLE "ApiKey";
|
|
23
|
+
ALTER TABLE "new_ApiKey" RENAME TO "ApiKey";
|
|
24
|
+
CREATE UNIQUE INDEX "ApiKey_token_key" ON "ApiKey"("token");
|
|
25
|
+
CREATE TABLE "new_InstanceOperationState" (
|
|
26
|
+
"operationId" TEXT NOT NULL,
|
|
27
|
+
"stateId" TEXT NOT NULL,
|
|
28
|
+
"status" TEXT NOT NULL,
|
|
29
|
+
"currentResourceCount" INTEGER,
|
|
30
|
+
"totalResourceCount" INTEGER,
|
|
31
|
+
"model" JSONB NOT NULL,
|
|
32
|
+
"resolvedInputs" JSONB NOT NULL,
|
|
33
|
+
"startedAt" DATETIME,
|
|
34
|
+
"finishedAt" DATETIME,
|
|
35
|
+
|
|
36
|
+
PRIMARY KEY ("operationId", "stateId"),
|
|
37
|
+
CONSTRAINT "InstanceOperationState_operationId_fkey" FOREIGN KEY ("operationId") REFERENCES "Operation" ("id") ON DELETE RESTRICT ON UPDATE CASCADE,
|
|
38
|
+
CONSTRAINT "InstanceOperationState_stateId_fkey" FOREIGN KEY ("stateId") REFERENCES "InstanceState" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
|
|
39
|
+
);
|
|
40
|
+
INSERT INTO "new_InstanceOperationState" ("currentResourceCount", "finishedAt", "model", "operationId", "resolvedInputs", "startedAt", "stateId", "status", "totalResourceCount") SELECT "currentResourceCount", "finishedAt", "model", "operationId", "resolvedInputs", "startedAt", "stateId", "status", "totalResourceCount" FROM "InstanceOperationState";
|
|
41
|
+
DROP TABLE "InstanceOperationState";
|
|
42
|
+
ALTER TABLE "new_InstanceOperationState" RENAME TO "InstanceOperationState";
|
|
43
|
+
PRAGMA foreign_keys=ON;
|
|
44
|
+
PRAGMA defer_foreign_keys=OFF;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
-- RedefineTables
|
|
2
|
+
PRAGMA defer_foreign_keys=ON;
|
|
3
|
+
PRAGMA foreign_keys=OFF;
|
|
4
|
+
CREATE TABLE "new_WorkerVersion" (
|
|
5
|
+
"id" TEXT NOT NULL PRIMARY KEY,
|
|
6
|
+
"meta" JSONB NOT NULL,
|
|
7
|
+
"status" TEXT NOT NULL DEFAULT 'unknown',
|
|
8
|
+
"enabled" BOOLEAN NOT NULL DEFAULT true,
|
|
9
|
+
"runtimeId" TEXT,
|
|
10
|
+
"workerId" TEXT NOT NULL,
|
|
11
|
+
"digest" TEXT NOT NULL,
|
|
12
|
+
"apiKeyId" TEXT NOT NULL,
|
|
13
|
+
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
14
|
+
"updatedAt" DATETIME NOT NULL,
|
|
15
|
+
CONSTRAINT "WorkerVersion_workerId_fkey" FOREIGN KEY ("workerId") REFERENCES "Worker" ("id") ON DELETE RESTRICT ON UPDATE CASCADE,
|
|
16
|
+
CONSTRAINT "WorkerVersion_apiKeyId_fkey" FOREIGN KEY ("apiKeyId") REFERENCES "ApiKey" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
|
|
17
|
+
);
|
|
18
|
+
INSERT INTO "new_WorkerVersion" ("apiKeyId", "createdAt", "digest", "id", "meta", "updatedAt", "workerId") SELECT "apiKeyId", "createdAt", "digest", "id", "meta", "updatedAt", "workerId" FROM "WorkerVersion";
|
|
19
|
+
DROP TABLE "WorkerVersion";
|
|
20
|
+
ALTER TABLE "new_WorkerVersion" RENAME TO "WorkerVersion";
|
|
21
|
+
CREATE UNIQUE INDEX "WorkerVersion_digest_key" ON "WorkerVersion"("digest");
|
|
22
|
+
CREATE UNIQUE INDEX "WorkerVersion_apiKeyId_key" ON "WorkerVersion"("apiKeyId");
|
|
23
|
+
PRAGMA foreign_keys=ON;
|
|
24
|
+
PRAGMA defer_foreign_keys=OFF;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Warnings:
|
|
3
|
+
|
|
4
|
+
- You are about to drop the `WorkerLog` table. If the table is not empty, all the data it contains will be lost.
|
|
5
|
+
|
|
6
|
+
*/
|
|
7
|
+
-- DropTable
|
|
8
|
+
PRAGMA foreign_keys=off;
|
|
9
|
+
DROP TABLE "WorkerLog";
|
|
10
|
+
PRAGMA foreign_keys=on;
|
|
11
|
+
|
|
12
|
+
-- CreateTable
|
|
13
|
+
CREATE TABLE "WorkerVersionLog" (
|
|
14
|
+
"id" TEXT NOT NULL PRIMARY KEY,
|
|
15
|
+
"workerVersionId" TEXT NOT NULL,
|
|
16
|
+
"content" TEXT NOT NULL,
|
|
17
|
+
CONSTRAINT "WorkerVersionLog_workerVersionId_fkey" FOREIGN KEY ("workerVersionId") REFERENCES "WorkerVersion" ("id") ON DELETE CASCADE ON UPDATE CASCADE
|
|
18
|
+
);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
-- RedefineTables
|
|
2
|
+
PRAGMA defer_foreign_keys=ON;
|
|
3
|
+
PRAGMA foreign_keys=OFF;
|
|
4
|
+
CREATE TABLE "new_WorkerVersionLog" (
|
|
5
|
+
"id" TEXT NOT NULL PRIMARY KEY,
|
|
6
|
+
"workerVersionId" TEXT NOT NULL,
|
|
7
|
+
"content" TEXT NOT NULL,
|
|
8
|
+
"isSystem" BOOLEAN NOT NULL DEFAULT false,
|
|
9
|
+
CONSTRAINT "WorkerVersionLog_workerVersionId_fkey" FOREIGN KEY ("workerVersionId") REFERENCES "WorkerVersion" ("id") ON DELETE CASCADE ON UPDATE CASCADE
|
|
10
|
+
);
|
|
11
|
+
INSERT INTO "new_WorkerVersionLog" ("content", "id", "workerVersionId") SELECT "content", "id", "workerVersionId" FROM "WorkerVersionLog";
|
|
12
|
+
DROP TABLE "WorkerVersionLog";
|
|
13
|
+
ALTER TABLE "new_WorkerVersionLog" RENAME TO "WorkerVersionLog";
|
|
14
|
+
PRAGMA foreign_keys=ON;
|
|
15
|
+
PRAGMA defer_foreign_keys=OFF;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/// The container for project instances.
|
|
2
|
+
///
|
|
3
|
+
/// Only used when "database" project model storage is used.
|
|
4
|
+
model InstanceModel {
|
|
5
|
+
/// The ID of the instance in the format of `{type}:{name}`.
|
|
6
|
+
id String @id
|
|
7
|
+
|
|
8
|
+
/// The model of the instance managed by the backend.
|
|
9
|
+
///
|
|
10
|
+
/// [InstanceModel]
|
|
11
|
+
model Json
|
|
12
|
+
|
|
13
|
+
/// The time when the instance model was created.
|
|
14
|
+
createdAt DateTime @default(now())
|
|
15
|
+
|
|
16
|
+
/// The time when the instance model was last updated.
|
|
17
|
+
updatedAt DateTime @updatedAt
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/// The container for project hubs.
|
|
21
|
+
///
|
|
22
|
+
/// Only used when "database" project model storage is used.
|
|
23
|
+
model HubModel {
|
|
24
|
+
/// The CUIDv2 of the hub.
|
|
25
|
+
id String @id
|
|
26
|
+
|
|
27
|
+
/// The model of the hub managed by the backend.
|
|
28
|
+
///
|
|
29
|
+
/// [HubModel]
|
|
30
|
+
model Json
|
|
31
|
+
|
|
32
|
+
/// The time when the hub model was created.
|
|
33
|
+
createdAt DateTime @default(now())
|
|
34
|
+
|
|
35
|
+
/// The time when the hub model was last updated.
|
|
36
|
+
updatedAt DateTime @updatedAt
|
|
37
|
+
}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
enum OperationStatus {
|
|
2
|
+
// transient statuses
|
|
3
|
+
pending
|
|
4
|
+
running
|
|
5
|
+
failing
|
|
6
|
+
|
|
7
|
+
// stable statuses
|
|
8
|
+
completed
|
|
9
|
+
failed
|
|
10
|
+
cancelled
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
enum OperationType {
|
|
14
|
+
update
|
|
15
|
+
preview
|
|
16
|
+
destroy
|
|
17
|
+
recreate
|
|
18
|
+
refresh
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
enum InstanceOperationStatus {
|
|
22
|
+
// transient statuses
|
|
23
|
+
updating
|
|
24
|
+
processing_triggers
|
|
25
|
+
previewing
|
|
26
|
+
destroying
|
|
27
|
+
refreshing
|
|
28
|
+
pending
|
|
29
|
+
cancelling
|
|
30
|
+
|
|
31
|
+
// stable statuses
|
|
32
|
+
updated
|
|
33
|
+
skipped
|
|
34
|
+
destroyed
|
|
35
|
+
refreshed
|
|
36
|
+
cancelled
|
|
37
|
+
failed
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
model Operation {
|
|
41
|
+
/// The CUIDv2 of the operation.
|
|
42
|
+
id String @id @default(cuid(2))
|
|
43
|
+
|
|
44
|
+
/// The metadata of the operation.
|
|
45
|
+
///
|
|
46
|
+
/// [OperationMeta]
|
|
47
|
+
meta Json
|
|
48
|
+
|
|
49
|
+
/// The type of the operation.
|
|
50
|
+
type OperationType
|
|
51
|
+
|
|
52
|
+
/// The status of the operation.
|
|
53
|
+
status OperationStatus @default(pending)
|
|
54
|
+
|
|
55
|
+
/// The options of the operation.
|
|
56
|
+
///
|
|
57
|
+
/// [OperationOptions]
|
|
58
|
+
options Json
|
|
59
|
+
|
|
60
|
+
/// The IDs of the instances that were exlicitly requested to operate on.
|
|
61
|
+
///
|
|
62
|
+
/// [InstanceIds]
|
|
63
|
+
requestedInstanceIds Json
|
|
64
|
+
|
|
65
|
+
/// The execution phases of the operation.
|
|
66
|
+
///
|
|
67
|
+
/// [OperationPhase[]]
|
|
68
|
+
phases Json?
|
|
69
|
+
|
|
70
|
+
/// The time when the operation started.
|
|
71
|
+
startedAt DateTime @default(now())
|
|
72
|
+
|
|
73
|
+
/// The time when the operation was last updated.
|
|
74
|
+
updatedAt DateTime @updatedAt
|
|
75
|
+
|
|
76
|
+
/// The time when the operation finished.
|
|
77
|
+
finishedAt DateTime?
|
|
78
|
+
|
|
79
|
+
/// The operation states associated with this operation.
|
|
80
|
+
operationStates InstanceOperationState[]
|
|
81
|
+
|
|
82
|
+
/// The logs of the operation.
|
|
83
|
+
logs OperationLog[]
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
model InstanceOperationState {
|
|
87
|
+
/// The ID of the operation this state belongs to.
|
|
88
|
+
operationId String
|
|
89
|
+
|
|
90
|
+
/// The ID of the instance state affected by the operation.
|
|
91
|
+
stateId String
|
|
92
|
+
|
|
93
|
+
/// The enum representing the current status of the instance from the operation perspective.
|
|
94
|
+
status InstanceOperationStatus
|
|
95
|
+
|
|
96
|
+
/// The current count of the Pulumi resources being managed by this instance.
|
|
97
|
+
currentResourceCount Int?
|
|
98
|
+
|
|
99
|
+
/// The total count of the Pulumi resources that this instance is expected to manage.
|
|
100
|
+
totalResourceCount Int?
|
|
101
|
+
|
|
102
|
+
/// The snapshot of the instance model at the moment of operation start.
|
|
103
|
+
///
|
|
104
|
+
/// [InstanceModel]
|
|
105
|
+
model Json
|
|
106
|
+
|
|
107
|
+
/// The snapshot of the resolved inputs at the moment of operation start.
|
|
108
|
+
///
|
|
109
|
+
/// [InstanceResolvedInputs]
|
|
110
|
+
resolvedInputs Json
|
|
111
|
+
|
|
112
|
+
/// The time when the operation on this instance started.
|
|
113
|
+
/// Not populated on create, even if the instance is ready to start immediately.
|
|
114
|
+
startedAt DateTime?
|
|
115
|
+
|
|
116
|
+
/// The time when the operation on this instance finished.
|
|
117
|
+
finishedAt DateTime?
|
|
118
|
+
|
|
119
|
+
/// The operation this state belongs to.
|
|
120
|
+
operation Operation @relation(fields: [operationId], references: [id])
|
|
121
|
+
|
|
122
|
+
/// The instance this state belongs to.
|
|
123
|
+
state InstanceState @relation(fields: [stateId], references: [id])
|
|
124
|
+
|
|
125
|
+
@@id([operationId, stateId])
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
model OperationLog {
|
|
129
|
+
/// The ULID of the log. Also used to extract the timestamp.
|
|
130
|
+
id String @id
|
|
131
|
+
|
|
132
|
+
/// The ID of the operation this log belongs to.
|
|
133
|
+
operationId String
|
|
134
|
+
|
|
135
|
+
/// The ID of the instance state this log produced by.
|
|
136
|
+
/// Can be `null` if the log is not associated with any instance.
|
|
137
|
+
stateId String?
|
|
138
|
+
|
|
139
|
+
/// The content of the log.
|
|
140
|
+
content String
|
|
141
|
+
|
|
142
|
+
/// The operation this log belongs to.
|
|
143
|
+
operation Operation @relation(fields: [operationId], references: [id])
|
|
144
|
+
|
|
145
|
+
/// The instance this log produced by.
|
|
146
|
+
/// Can be `null` if the log is not associated with any instance.
|
|
147
|
+
state InstanceState? @relation(fields: [stateId], references: [id])
|
|
148
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/// The page provides custom UI content for instances and service accounts.
|
|
2
|
+
///
|
|
3
|
+
/// Pages can be created by units to display instance-specific information or by service accounts.
|
|
4
|
+
/// The content consists of blocks that support markdown text, QR codes with optional content display,
|
|
5
|
+
/// and file attachments (inline or artifact references). Instance pages are explicitly deleted
|
|
6
|
+
/// when instances are destroyed.
|
|
7
|
+
model Page {
|
|
8
|
+
/// The CUIDv2 of the page.
|
|
9
|
+
id String @id @default(cuid(2))
|
|
10
|
+
|
|
11
|
+
/// The metadata of the page managed by the backend.
|
|
12
|
+
///
|
|
13
|
+
/// [GlobalCommonObjectMeta]
|
|
14
|
+
meta Json
|
|
15
|
+
|
|
16
|
+
/// The ID of the instance state that owns this page.
|
|
17
|
+
stateId String?
|
|
18
|
+
|
|
19
|
+
/// The name of the page within the instance.
|
|
20
|
+
/// Will be null if the page is not owned by an instance.
|
|
21
|
+
name String?
|
|
22
|
+
|
|
23
|
+
/// The ID of the service account that owns this page.
|
|
24
|
+
serviceAccountId String?
|
|
25
|
+
|
|
26
|
+
/// The content of the page as an array of blocks.
|
|
27
|
+
///
|
|
28
|
+
/// Supports markdown, QR codes, and file blocks.
|
|
29
|
+
///
|
|
30
|
+
/// [PageContent]
|
|
31
|
+
content Json
|
|
32
|
+
|
|
33
|
+
/// The time when the page was created.
|
|
34
|
+
createdAt DateTime @default(now())
|
|
35
|
+
|
|
36
|
+
/// The time when the page was last updated.
|
|
37
|
+
updatedAt DateTime @updatedAt
|
|
38
|
+
|
|
39
|
+
/// The instance this page belongs to if any.
|
|
40
|
+
state InstanceState? @relation(fields: [stateId], references: [id])
|
|
41
|
+
|
|
42
|
+
/// The service account this page belongs to if any.
|
|
43
|
+
serviceAccount ServiceAccount? @relation(fields: [serviceAccountId], references: [id])
|
|
44
|
+
|
|
45
|
+
/// The artifacts used by this page.
|
|
46
|
+
artifacts Artifact[]
|
|
47
|
+
|
|
48
|
+
@@unique([stateId, name]) // the name is unique within the instance
|
|
49
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/// The secret stores sensitive configuration values for instances, service accounts, and system components.
|
|
2
|
+
///
|
|
3
|
+
/// Secrets can be instance-owned (for unit configuration), service account-owned, or system-level
|
|
4
|
+
/// (like Pulumi passwords).
|
|
5
|
+
///
|
|
6
|
+
/// Secrets persist through normal destroy (recreate) operations
|
|
7
|
+
/// and are only deleted when explicitly forgetting instance state with the deleteSecrets flag or when manually deleted.
|
|
8
|
+
///
|
|
9
|
+
/// Secret updates invalidate instance input hashes via inputHashNonce, triggering re-execution
|
|
10
|
+
/// during operations. But the content of the secrets itself do not contribute to the input hash.
|
|
11
|
+
///
|
|
12
|
+
/// System secrets like Pulumi passwords are created on-demand and persist for the whole project lifetime.
|
|
13
|
+
model Secret {
|
|
14
|
+
/// The CUIDv2 of the secret.
|
|
15
|
+
id String @id @default(cuid(2))
|
|
16
|
+
|
|
17
|
+
/// The metadata of the secret managed by the backend.
|
|
18
|
+
///
|
|
19
|
+
/// [GlobalCommonObjectMeta]
|
|
20
|
+
meta Json
|
|
21
|
+
|
|
22
|
+
/// The ID of the state of the instance owning this secret.
|
|
23
|
+
stateId String?
|
|
24
|
+
|
|
25
|
+
/// The name of the secret within the instance.
|
|
26
|
+
///
|
|
27
|
+
/// Will be null if the secret is not owned by an instance.
|
|
28
|
+
name String?
|
|
29
|
+
|
|
30
|
+
/// The name of the secret within the project if the secret is a system secret.
|
|
31
|
+
systemName String? @unique
|
|
32
|
+
|
|
33
|
+
/// The ID of the service account owning this secret.
|
|
34
|
+
serviceAccountId String?
|
|
35
|
+
|
|
36
|
+
/// The content of the secret.
|
|
37
|
+
///
|
|
38
|
+
/// ![unknown]
|
|
39
|
+
content Json
|
|
40
|
+
|
|
41
|
+
/// The time when the secret was created.
|
|
42
|
+
createdAt DateTime @default(now())
|
|
43
|
+
|
|
44
|
+
/// The time when the secret was last updated.
|
|
45
|
+
updatedAt DateTime @updatedAt
|
|
46
|
+
|
|
47
|
+
/// The instance this secret belongs to.
|
|
48
|
+
state InstanceState? @relation(fields: [stateId], references: [id])
|
|
49
|
+
|
|
50
|
+
/// The service account this secret belongs to.
|
|
51
|
+
serviceAccount ServiceAccount? @relation(fields: [serviceAccountId], references: [id])
|
|
52
|
+
|
|
53
|
+
@@unique([stateId, name]) // the name must be unique within the instance
|
|
54
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/// The service account represents an identity for non-human actors in the system.
|
|
2
|
+
///
|
|
3
|
+
/// Service accounts are automatically created for workers and can be manually created
|
|
4
|
+
/// for external integrations. They define the access scope for resources like artifacts,
|
|
5
|
+
/// secrets, terminals, and pages. Multiple API keys can impersonate the same service account,
|
|
6
|
+
/// allowing different authentication tokens to share the same permissions.
|
|
7
|
+
model ServiceAccount {
|
|
8
|
+
/// The CUIDv2 of the service account.
|
|
9
|
+
id String @id @default(cuid(2))
|
|
10
|
+
|
|
11
|
+
/// The metadata of the service account managed by the backend.
|
|
12
|
+
///
|
|
13
|
+
/// [ServiceAccountMeta]
|
|
14
|
+
meta Json
|
|
15
|
+
|
|
16
|
+
/// The time when the service account was created.
|
|
17
|
+
createdAt DateTime @default(now())
|
|
18
|
+
|
|
19
|
+
/// The time when the service account was last updated.
|
|
20
|
+
updatedAt DateTime @updatedAt
|
|
21
|
+
|
|
22
|
+
/// The workers using this service account.
|
|
23
|
+
workers Worker[]
|
|
24
|
+
|
|
25
|
+
/// The artifacts used by this service account.
|
|
26
|
+
artifacts Artifact[]
|
|
27
|
+
|
|
28
|
+
/// The secrets owned by this service account.
|
|
29
|
+
secrets Secret[]
|
|
30
|
+
|
|
31
|
+
/// The terminals owned by this service account.
|
|
32
|
+
terminals Terminal[]
|
|
33
|
+
|
|
34
|
+
/// The pages owned by this service account.
|
|
35
|
+
pages Page[]
|
|
36
|
+
|
|
37
|
+
/// The instance custom statuses attached by this service account.
|
|
38
|
+
customStatuses InstanceCustomStatus[]
|
|
39
|
+
|
|
40
|
+
/// The API keys impersonating this service account.
|
|
41
|
+
apiKeys ApiKey[]
|
|
42
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/// The terminal status indicates whether a terminal can accept new connections.
|
|
2
|
+
enum TerminalStatus {
|
|
3
|
+
/// The terminal is currently active and can create new sessions.
|
|
4
|
+
active
|
|
5
|
+
|
|
6
|
+
/// The instance was destroyed and the terminal is no longer available, but here for historical purposes.
|
|
7
|
+
unavailable
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/// The terminal provides interactive shell access to infrastructure resources.
|
|
11
|
+
///
|
|
12
|
+
/// Terminals can be created by units (owned by instances) or by service accounts.
|
|
13
|
+
/// Each terminal maintains a specification for creating containers that power the terminal,
|
|
14
|
+
/// including image, command, environment, and mounted files.
|
|
15
|
+
///
|
|
16
|
+
/// Instance-owned terminals are marked unavailable when the instance is destroyed, preserving session history.
|
|
17
|
+
/// Service account terminals persist independently.
|
|
18
|
+
model Terminal {
|
|
19
|
+
/// The CUIDv2 of the terminal.
|
|
20
|
+
id String @id @default(cuid(2))
|
|
21
|
+
|
|
22
|
+
/// The metadata of the terminal managed by the backend.
|
|
23
|
+
///
|
|
24
|
+
/// [GlobalCommonObjectMeta]
|
|
25
|
+
meta Json
|
|
26
|
+
|
|
27
|
+
/// The status of the terminal.
|
|
28
|
+
status TerminalStatus @default(active)
|
|
29
|
+
|
|
30
|
+
/// The specification for creating the container that powers this terminal.
|
|
31
|
+
///
|
|
32
|
+
/// Includes image, command, working directory, environment variables, and files.
|
|
33
|
+
///
|
|
34
|
+
/// [TerminalSpec]
|
|
35
|
+
spec Json
|
|
36
|
+
|
|
37
|
+
/// The ID of the instance state owning this terminal.
|
|
38
|
+
stateId String?
|
|
39
|
+
|
|
40
|
+
/// The name of the terminal within the instance.
|
|
41
|
+
///
|
|
42
|
+
/// Will be null if the terminal is not owned by an instance.
|
|
43
|
+
name String?
|
|
44
|
+
|
|
45
|
+
/// The ID of the service account owning this terminal.
|
|
46
|
+
serviceAccountId String?
|
|
47
|
+
|
|
48
|
+
/// The time when the terminal was created.
|
|
49
|
+
createdAt DateTime @default(now())
|
|
50
|
+
|
|
51
|
+
/// The time when the terminal was last updated.
|
|
52
|
+
updatedAt DateTime @updatedAt
|
|
53
|
+
|
|
54
|
+
/// The instance this terminal belongs to.
|
|
55
|
+
state InstanceState? @relation(fields: [stateId], references: [id], onDelete: Cascade)
|
|
56
|
+
|
|
57
|
+
/// The service account this terminal belongs to.
|
|
58
|
+
serviceAccount ServiceAccount? @relation(fields: [serviceAccountId], references: [id], onDelete: Cascade)
|
|
59
|
+
|
|
60
|
+
/// The terminal sessions associated with this terminal.
|
|
61
|
+
sessions TerminalSession[]
|
|
62
|
+
|
|
63
|
+
/// The artifacts used by this terminal.
|
|
64
|
+
artifacts Artifact[]
|
|
65
|
+
|
|
66
|
+
@@unique([stateId, name]) // the name is unique within the instance
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/// The terminal session represents a single interactive connection to a terminal.
|
|
70
|
+
///
|
|
71
|
+
/// Each session tracks when it started and finished. All session output is preserved in logs.
|
|
72
|
+
model TerminalSession {
|
|
73
|
+
/// The CUIDv2 of the terminal session.
|
|
74
|
+
id String @id @default(cuid(2))
|
|
75
|
+
|
|
76
|
+
/// The ID of the terminal this session belongs to.
|
|
77
|
+
terminalId String
|
|
78
|
+
|
|
79
|
+
/// The time when the terminal session started.
|
|
80
|
+
startedAt DateTime @default(now())
|
|
81
|
+
|
|
82
|
+
/// The time when the terminal session finished.
|
|
83
|
+
finishedAt DateTime?
|
|
84
|
+
|
|
85
|
+
/// The terminal this session belongs to.
|
|
86
|
+
terminal Terminal @relation(fields: [terminalId], references: [id], onDelete: Cascade)
|
|
87
|
+
|
|
88
|
+
/// The logs of the terminal session.
|
|
89
|
+
logs TerminalSessionLog[]
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/// The terminal session log captures all input and output from a terminal session.
|
|
93
|
+
///
|
|
94
|
+
/// Logs are stored with ULID identifiers for timestamp ordering.
|
|
95
|
+
model TerminalSessionLog {
|
|
96
|
+
/// The ULID of the session log. Also used to extract the timestamp.
|
|
97
|
+
id String @id
|
|
98
|
+
|
|
99
|
+
/// The ID of the terminal session this log belongs to.
|
|
100
|
+
sessionId String
|
|
101
|
+
|
|
102
|
+
/// The content of the log.
|
|
103
|
+
content String
|
|
104
|
+
|
|
105
|
+
/// The terminal session this log belongs to.
|
|
106
|
+
session TerminalSession @relation(fields: [sessionId], references: [id], onDelete: Cascade)
|
|
107
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/// The trigger defines automated actions that execute in response to specific events.
|
|
2
|
+
///
|
|
3
|
+
/// Triggers are created by units to perform actions at defined points in the instance lifecycle
|
|
4
|
+
/// or on schedule. The spec field determines the trigger type and behavior - currently supporting
|
|
5
|
+
/// before-destroy triggers, with planned support for additional types like cron scheduling.
|
|
6
|
+
/// Triggers are deleted along with their instance.
|
|
7
|
+
model Trigger {
|
|
8
|
+
/// The CUIDv2 of the trigger.
|
|
9
|
+
id String @id @default(cuid(2))
|
|
10
|
+
|
|
11
|
+
/// The metadata of the trigger managed by the backend.
|
|
12
|
+
///
|
|
13
|
+
/// [GlobalCommonObjectMeta]
|
|
14
|
+
meta Json
|
|
15
|
+
|
|
16
|
+
/// The ID of the instance state this trigger belongs to.
|
|
17
|
+
stateId String
|
|
18
|
+
|
|
19
|
+
/// The name of the trigger within the instance.
|
|
20
|
+
name String
|
|
21
|
+
|
|
22
|
+
/// The specification of the trigger describing its type and behavior.
|
|
23
|
+
///
|
|
24
|
+
/// [TriggerSpec]
|
|
25
|
+
spec Json
|
|
26
|
+
|
|
27
|
+
/// The time when the trigger was created.
|
|
28
|
+
createdAt DateTime @default(now())
|
|
29
|
+
|
|
30
|
+
/// The time when the trigger was last updated.
|
|
31
|
+
updatedAt DateTime @updatedAt
|
|
32
|
+
|
|
33
|
+
/// The instance this trigger belongs to.
|
|
34
|
+
state InstanceState @relation(fields: [stateId], references: [id])
|
|
35
|
+
|
|
36
|
+
@@unique([stateId, name]) // the name is unique within the instance
|
|
37
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/// The unlock method type determines how users authenticate to decrypt project databases.
|
|
2
|
+
enum UnlockMethodType {
|
|
3
|
+
/// The password is used to unlock the project.
|
|
4
|
+
password
|
|
5
|
+
|
|
6
|
+
/// The passkey (via WebAuthn) is used to unlock the project.
|
|
7
|
+
passkey
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/// The unlock method enables decryption of project databases through user authentication.
|
|
11
|
+
///
|
|
12
|
+
/// Each project database is encrypted with a master key, which is then encrypted for each
|
|
13
|
+
/// unlock method's recipient using AGE encryption. Users authenticate (password or passkey)
|
|
14
|
+
/// to decrypt their specific AGE identity, which then decrypts the master key.
|
|
15
|
+
///
|
|
16
|
+
/// Multiple unlock methods can exist per project, allowing different authentication paths
|
|
17
|
+
/// to the same encrypted database. When unlock methods are added/removed, the master key
|
|
18
|
+
/// is re-encrypted for the new set of recipients.
|
|
19
|
+
///
|
|
20
|
+
/// The encryptedIdentity contains the AGE identity encrypted with the user's authentication
|
|
21
|
+
/// method (password-derived key or WebAuthn), while the recipient is the public key
|
|
22
|
+
/// corresponding to that identity.
|
|
23
|
+
model UnlockMethod {
|
|
24
|
+
/// The CUIDv2 of the unlock method.
|
|
25
|
+
id String @id @default(cuid(2))
|
|
26
|
+
|
|
27
|
+
/// The metadata of the unlock method managed by the backend.
|
|
28
|
+
///
|
|
29
|
+
/// [UnlockMethodMeta]
|
|
30
|
+
meta Json
|
|
31
|
+
|
|
32
|
+
/// The type of unlock method.
|
|
33
|
+
type UnlockMethodType
|
|
34
|
+
|
|
35
|
+
/// The AGE identity encrypted and armored also with AGE.
|
|
36
|
+
encryptedIdentity String
|
|
37
|
+
|
|
38
|
+
/// The AGE recipient for this unlock method.
|
|
39
|
+
recipient String
|
|
40
|
+
|
|
41
|
+
/// The time when the unlock method was created.
|
|
42
|
+
createdAt DateTime @default(now())
|
|
43
|
+
|
|
44
|
+
/// The time when the unlock method was last updated.
|
|
45
|
+
updatedAt DateTime @updatedAt
|
|
46
|
+
}
|