@highstate/backend 0.9.26 → 0.9.28
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-GJTMJQUW.js → chunk-QSHSXLO2.js} +18 -9
- package/dist/chunk-QSHSXLO2.js.map +1 -0
- package/dist/index.js +292 -132
- package/dist/index.js.map +1 -1
- package/dist/shared/index.js +1 -1
- package/package.json +3 -3
- package/prisma/backend/_schema/layout.prisma +3 -1
- package/prisma/backend/_schema/project.prisma +4 -2
- package/prisma/backend/_schema/unlock-method.prisma +19 -0
- package/prisma/backend/sqlite/migrations/{20250818082732_add_models → 20250928124105_initial_migration}/migration.sql +48 -16
- package/prisma/project/api-key.prisma +3 -1
- package/prisma/project/artifact.prisma +2 -2
- package/prisma/project/custom-status.prisma +1 -1
- package/prisma/project/layout.prisma +4 -0
- package/prisma/project/migrations/{20250816081310_initial → 20250928130725_initial_migration}/migration.sql +132 -46
- package/prisma/project/terminal.prisma +2 -2
- package/prisma/project/unlock-method.prisma +1 -1
- package/prisma/project/worker.prisma +1 -1
- package/src/business/backend-unlock.test.ts +133 -0
- package/src/business/backend-unlock.ts +76 -0
- package/src/business/index.ts +1 -0
- package/src/business/settings.test.ts +3 -2
- package/src/database/_generated/backend/postgresql/client.ts +9 -4
- package/src/database/_generated/backend/postgresql/internal/class.ts +147 -168
- package/src/database/_generated/backend/postgresql/internal/prismaNamespace.ts +127 -40
- package/src/database/_generated/backend/postgresql/models/BackendUnlockMethod.ts +1156 -0
- package/src/database/_generated/backend/postgresql/models/Project.ts +2 -2
- package/src/database/_generated/backend/postgresql/models/ProjectSpace.ts +7 -1
- package/src/database/_generated/backend/postgresql/models/UserWorkspaceLayout.ts +1067 -0
- package/src/database/_generated/backend/postgresql/models.ts +2 -1
- package/src/database/_generated/backend/sqlite/client.ts +9 -4
- package/src/database/_generated/backend/sqlite/internal/class.ts +146 -165
- package/src/database/_generated/backend/sqlite/internal/prismaNamespace.ts +127 -40
- package/src/database/_generated/backend/sqlite/models/BackendUnlockMethod.ts +1154 -0
- package/src/database/_generated/backend/sqlite/models/Project.ts +2 -2
- package/src/database/_generated/backend/sqlite/models/ProjectSpace.ts +7 -1
- package/src/database/_generated/backend/sqlite/models/UserWorkspaceLayout.ts +1065 -0
- package/src/database/_generated/backend/sqlite/models.ts +2 -1
- package/src/database/_generated/project/commonInputTypes.ts +26 -26
- package/src/database/_generated/project/internal/class.ts +7 -8
- package/src/database/_generated/project/internal/prismaNamespace.ts +8 -7
- package/src/database/_generated/project/models/ApiKey.ts +2 -0
- package/src/database/_generated/project/models/Artifact.ts +2 -2
- package/src/database/_generated/project/models/InstanceCustomStatus.ts +1 -1
- package/src/database/_generated/project/models/OperationLog.ts +49 -1
- package/src/database/_generated/project/models/UnlockMethod.ts +2 -2
- package/src/database/_generated/project/models/UserCompositeViewport.ts +16 -14
- package/src/database/_generated/project/models/UserProjectViewport.ts +11 -9
- package/src/database/_generated/project/models/WorkerVersion.ts +1 -5
- package/src/database/abstractions.ts +25 -3
- package/src/database/factory.ts +5 -6
- package/src/database/local/backend.ts +148 -18
- package/src/database/manager.ts +30 -2
- package/src/database/prisma.ts +1 -0
- package/src/orchestrator/operation-plan.ts +0 -19
- package/src/orchestrator/operation.ts +21 -4
- package/src/services.ts +12 -3
- package/src/shared/models/backend/unlock-method.ts +7 -13
- package/src/shared/models/errors.ts +14 -0
- package/src/shared/models/prisma.ts +10 -2
- package/src/test-utils/database.ts +34 -6
- package/dist/chunk-GJTMJQUW.js.map +0 -1
- package/prisma/backend/sqlite/migrations/20250817070609_initiial/migration.sql +0 -34
- package/prisma/backend/sqlite/migrations/20250817104948_add_fields/migration.sql +0 -59
- package/prisma/backend/sqlite/migrations/20250818083106_a/migration.sql +0 -19
- package/prisma/backend/sqlite/migrations/20250818101945_hi/migration.sql +0 -1
- package/prisma/backend/sqlite/migrations/20250819082315_a/migration.sql +0 -5
- package/prisma/project/migrations/20250816082523_test/migration.sql +0 -72
- package/prisma/project/migrations/20250818065643_update/migration.sql +0 -42
- package/prisma/project/migrations/20250818070758_a/migration.sql +0 -8
- package/prisma/project/migrations/20250818070913_a/migration.sql +0 -8
- package/prisma/project/migrations/20250818082720_add_motels/migration.sql +0 -11
- package/prisma/project/migrations/20250818112523_hello/migration.sql +0 -35
- package/prisma/project/migrations/20250819082305_a/migration.sql +0 -14
- package/prisma/project/migrations/20250819165004_add_missing_fields/migration.sql +0 -216
- package/prisma/project/migrations/20250819171309_a/migration.sql +0 -22
- package/prisma/project/migrations/20250820113949_a/migration.sql +0 -66
- package/prisma/project/migrations/20250820144256_b/migration.sql +0 -31
- package/prisma/project/migrations/20250820145547_a/migration.sql +0 -24
- package/prisma/project/migrations/20250820182517_b/migration.sql +0 -2
- package/prisma/project/migrations/20250821172324_a/migration.sql +0 -2
- package/prisma/project/migrations/20250822081339_a/migration.sql +0 -219
- package/prisma/project/migrations/20250822083742_b/migration.sql +0 -1
- package/prisma/project/migrations/20250822105134_boom/migration.sql +0 -1
- package/prisma/project/migrations/20250822141028_b/migration.sql +0 -1
- package/prisma/project/migrations/20250822142342_b/migration.sql +0 -16
- package/prisma/project/migrations/20250824072720_a/migration.sql +0 -1
- package/prisma/project/migrations/20250824093656_b/migration.sql +0 -21
- package/prisma/project/migrations/20250825082518_a/migration.sql +0 -1
- package/prisma/project/migrations/20250825085343_b/migration.sql +0 -1
- package/prisma/project/migrations/20250825091312_a/migration.sql +0 -1
- package/prisma/project/migrations/20250903095431_hi/migration.sql +0 -44
- package/prisma/project/migrations/20250903174255_a/migration.sql +0 -24
- package/prisma/project/migrations/20250908095205_hi/migration.sql +0 -18
- package/prisma/project/migrations/20250909155857_hi/migration.sql +0 -15
- package/prisma/project/migrations/20250921092621_b/migration.sql +0 -33
- package/prisma/project/migrations/20250921093911_b/migration.sql +0 -1
- package/src/database/_generated/backend/postgresql/models/UserWorkspaseLayout.ts +0 -1065
- package/src/database/_generated/backend/sqlite/models/UserWorkspaseLayout.ts +0 -1063
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AccessError, InstanceLockLostError, globalProjectSpace, codebaseLibrary, hostPulumiBackend, codebaseProjectModelStorage, databaseProjectModelStorage, ProjectLockedError, ProjectNotFoundError, BackendError, forSchema, projectOutputSchema, InstanceStateNotFoundError, InstanceLockedError, waitAll, OperationNotFoundError, InputResolver, CannotDeleteLastUnlockMethodError, InvalidInstanceKindError, operationOutputSchema, terminalOutputSchema, toTerminalOutput, terminalDetailsOutputSchema, toTerminalDetailsOutput, serviceAccountOutputSchema, apiKeyOutputSchema, toApiKeyOutput, workerOutputSchema, toWorkerOutput, workerVersionOutputSchema, toWorkerVersionOutput, pageDetailsOutputSchema, toPageOutput, secretOutputSchema, toSecretOutput, artifactOutputSchema, triggerOutputSchema, unlockMethodOutputSchema, pageOutputSchema, toTerminalSessionOutput, extractDigestFromImage, getWorkerIdentity, WorkerVersionNotFoundError, createAsyncBatcher, operationOptionsSchema, finalOperationStatuses, finalInstanceOperationStatuses, diffLibraries, isTransientInstanceOperationStatus, InputHashResolver, PromiseTracker, workerUnitRegistrationEventSchema, terminalSessionOutputSchema, operationEventSchema, projectModelEventSchema, instanceLockEventSchema, instanceStateEventSchema, projectUnlockStateSchema, isVirtualGhostInstance } from './chunk-
|
|
1
|
+
import { AccessError, BackendUnlockMethodNotFoundError, CannotDeleteLastBackendUnlockMethodError, InstanceLockLostError, globalProjectSpace, codebaseLibrary, hostPulumiBackend, codebaseProjectModelStorage, databaseProjectModelStorage, ProjectLockedError, ProjectNotFoundError, BackendError, forSchema, projectOutputSchema, InstanceStateNotFoundError, InstanceLockedError, waitAll, OperationNotFoundError, InputResolver, CannotDeleteLastUnlockMethodError, InvalidInstanceKindError, operationOutputSchema, terminalOutputSchema, toTerminalOutput, terminalDetailsOutputSchema, toTerminalDetailsOutput, serviceAccountOutputSchema, apiKeyOutputSchema, toApiKeyOutput, workerOutputSchema, toWorkerOutput, workerVersionOutputSchema, toWorkerVersionOutput, pageDetailsOutputSchema, toPageOutput, secretOutputSchema, toSecretOutput, artifactOutputSchema, triggerOutputSchema, unlockMethodOutputSchema, pageOutputSchema, toTerminalSessionOutput, extractDigestFromImage, getWorkerIdentity, WorkerVersionNotFoundError, createAsyncBatcher, operationOptionsSchema, finalOperationStatuses, finalInstanceOperationStatuses, diffLibraries, isTransientInstanceOperationStatus, InputHashResolver, PromiseTracker, workerUnitRegistrationEventSchema, terminalSessionOutputSchema, operationEventSchema, projectModelEventSchema, instanceLockEventSchema, instanceStateEventSchema, projectUnlockStateSchema, isVirtualGhostInstance } from './chunk-QSHSXLO2.js';
|
|
2
2
|
import { codebaseConfig, stringArrayType, createProjectLogger, isAbortErrorLike, getCodebaseHighstatePath, resolveMainLocalProject, errorToString, waitForAbort, AbortError, renderTree, runWithRetryOnError } from './chunk-VB4YL327.js';
|
|
3
3
|
import { __using, __callDispose } from './chunk-I7BWSAN6.js';
|
|
4
4
|
import { randomBytes, createHash } from 'node:crypto';
|
|
@@ -6,6 +6,8 @@ import { createId } from '@paralleldrive/cuid2';
|
|
|
6
6
|
import { hubModelSchema, instanceModelSchema, parseInstanceId, isUnitModel, HighstateConfigKey, unitArtifactSchema, unitWorkerSchema, unitTriggerSchema, unitPageSchema, unitTerminalSchema, instanceStatusFieldSchema, getInstanceId } from '@highstate/contract';
|
|
7
7
|
import { omit, isNonNullish, groupBy, pipe, flatMap, unique, map, mapValues, join as join$1, omitBy } from 'remeda';
|
|
8
8
|
import z3, { z } from 'zod';
|
|
9
|
+
import * as os from 'node:os';
|
|
10
|
+
import { tmpdir, hostname } from 'node:os';
|
|
9
11
|
import { PrismaLibSQL } from '@prisma/adapter-libsql';
|
|
10
12
|
import { generateIdentity, armor, Decrypter, Encrypter, identityToRecipient } from 'age-encryption';
|
|
11
13
|
import * as path4 from 'node:path';
|
|
@@ -30,8 +32,6 @@ import { decode, encode } from '@msgpack/msgpack';
|
|
|
30
32
|
import { BetterLock } from 'better-lock';
|
|
31
33
|
import { readPackageJSON } from 'pkg-types';
|
|
32
34
|
import Watcher from 'watcher';
|
|
33
|
-
import * as os from 'node:os';
|
|
34
|
-
import { tmpdir } from 'node:os';
|
|
35
35
|
import { crc32 } from 'node:zlib';
|
|
36
36
|
import { sha256 } from '@noble/hashes/sha2';
|
|
37
37
|
import { pipeline } from 'node:stream/promises';
|
|
@@ -242,6 +242,65 @@ var ArtifactService = class {
|
|
|
242
242
|
});
|
|
243
243
|
}
|
|
244
244
|
};
|
|
245
|
+
|
|
246
|
+
// src/business/backend-unlock.ts
|
|
247
|
+
var BackendUnlockService = class {
|
|
248
|
+
constructor(database, logger) {
|
|
249
|
+
this.database = database;
|
|
250
|
+
this.logger = logger;
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Lists backend unlock methods ordered by creation time.
|
|
254
|
+
*
|
|
255
|
+
* @returns The ordered unlock method collection.
|
|
256
|
+
*/
|
|
257
|
+
async listUnlockMethods() {
|
|
258
|
+
return await this.database.backend.backendUnlockMethod.findMany({
|
|
259
|
+
orderBy: { createdAt: "asc" }
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Stores a new unlock method and refreshes master-key recipients.
|
|
264
|
+
*
|
|
265
|
+
* @param input Unlock method payload gathered from the CLI or automation.
|
|
266
|
+
* @returns The persisted unlock method.
|
|
267
|
+
*/
|
|
268
|
+
async addUnlockMethod(input) {
|
|
269
|
+
const record = await this.database.backend.backendUnlockMethod.create({ data: input });
|
|
270
|
+
await this.reencryptBackendMasterKey();
|
|
271
|
+
return record;
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* Removes an unlock method by identifier and rotates the encrypted master key.
|
|
275
|
+
*
|
|
276
|
+
* @param id Identifier of the unlock method to delete.
|
|
277
|
+
*/
|
|
278
|
+
async deleteUnlockMethod(id) {
|
|
279
|
+
const methods = await this.database.backend.backendUnlockMethod.findMany();
|
|
280
|
+
const method = methods.find((m) => m.id === id);
|
|
281
|
+
if (!method) {
|
|
282
|
+
throw new BackendUnlockMethodNotFoundError(id);
|
|
283
|
+
}
|
|
284
|
+
if (methods.length === 1) {
|
|
285
|
+
throw new CannotDeleteLastBackendUnlockMethodError();
|
|
286
|
+
}
|
|
287
|
+
await this.database.backend.backendUnlockMethod.delete({ where: { id } });
|
|
288
|
+
await this.reencryptBackendMasterKey();
|
|
289
|
+
}
|
|
290
|
+
async reencryptBackendMasterKey() {
|
|
291
|
+
if (!this.database.isEncryptionEnabled) {
|
|
292
|
+
return;
|
|
293
|
+
}
|
|
294
|
+
const recipients = await this.database.backend.backendUnlockMethod.findMany({
|
|
295
|
+
select: { recipient: true }
|
|
296
|
+
});
|
|
297
|
+
await this.database.updateBackendUnlockRecipients(recipients.map((method) => method.recipient));
|
|
298
|
+
this.logger.debug(
|
|
299
|
+
{ recipientCount: recipients.length },
|
|
300
|
+
"updated backend master key recipients"
|
|
301
|
+
);
|
|
302
|
+
}
|
|
303
|
+
};
|
|
245
304
|
var InstanceLockService = class {
|
|
246
305
|
constructor(database, pubsubManager, logger) {
|
|
247
306
|
this.database = database;
|
|
@@ -561,63 +620,66 @@ var InstanceLockService = class {
|
|
|
561
620
|
};
|
|
562
621
|
|
|
563
622
|
// src/database/abstractions.ts
|
|
564
|
-
var backendDatabaseVersion =
|
|
565
|
-
var projectDatabaseVersion =
|
|
623
|
+
var backendDatabaseVersion = 1;
|
|
624
|
+
var projectDatabaseVersion = 1;
|
|
566
625
|
var config = {
|
|
567
|
-
generator: {
|
|
568
|
-
name: "client",
|
|
569
|
-
provider: {
|
|
570
|
-
fromEnvVar: null,
|
|
571
|
-
value: "prisma-client"
|
|
626
|
+
"generator": {
|
|
627
|
+
"name": "client",
|
|
628
|
+
"provider": {
|
|
629
|
+
"fromEnvVar": null,
|
|
630
|
+
"value": "prisma-client"
|
|
572
631
|
},
|
|
573
|
-
output: {
|
|
574
|
-
value: "/home/exeteres/Projects/personal/highstate/packages/platform/backend/src/database/_generated/backend/sqlite",
|
|
575
|
-
fromEnvVar: null
|
|
632
|
+
"output": {
|
|
633
|
+
"value": "/home/exeteres/Projects/personal/highstate/packages/platform/backend/src/database/_generated/backend/sqlite",
|
|
634
|
+
"fromEnvVar": null
|
|
576
635
|
},
|
|
577
|
-
config: {
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
engineType: "client"
|
|
636
|
+
"config": {
|
|
637
|
+
"moduleFormat": "esm",
|
|
638
|
+
"generatedFileExtension": "ts",
|
|
639
|
+
"importFileExtension": "ts",
|
|
640
|
+
"engineType": "client"
|
|
582
641
|
},
|
|
583
|
-
binaryTargets: [
|
|
642
|
+
"binaryTargets": [
|
|
584
643
|
{
|
|
585
|
-
fromEnvVar: null,
|
|
586
|
-
value: "linux-nixos",
|
|
587
|
-
native: true
|
|
644
|
+
"fromEnvVar": null,
|
|
645
|
+
"value": "linux-nixos",
|
|
646
|
+
"native": true
|
|
588
647
|
}
|
|
589
648
|
],
|
|
590
|
-
previewFeatures: [
|
|
591
|
-
|
|
592
|
-
|
|
649
|
+
"previewFeatures": [
|
|
650
|
+
"driverAdapters",
|
|
651
|
+
"queryCompiler"
|
|
652
|
+
],
|
|
653
|
+
"sourceFilePath": "/home/exeteres/Projects/personal/highstate/packages/platform/backend/prisma/backend/sqlite/main.prisma",
|
|
654
|
+
"isCustomOutput": true
|
|
593
655
|
},
|
|
594
|
-
relativePath: "../../../../../prisma/backend/sqlite",
|
|
595
|
-
clientVersion: "6.14.0",
|
|
596
|
-
engineVersion: "717184b7b35ea05dfa71a3236b7af656013e1e49",
|
|
597
|
-
datasourceNames: [
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
656
|
+
"relativePath": "../../../../../prisma/backend/sqlite",
|
|
657
|
+
"clientVersion": "6.14.0",
|
|
658
|
+
"engineVersion": "717184b7b35ea05dfa71a3236b7af656013e1e49",
|
|
659
|
+
"datasourceNames": [
|
|
660
|
+
"db"
|
|
661
|
+
],
|
|
662
|
+
"activeProvider": "sqlite",
|
|
663
|
+
"postinstall": false,
|
|
664
|
+
"inlineDatasources": {
|
|
665
|
+
"db": {
|
|
666
|
+
"url": {
|
|
667
|
+
"fromEnvVar": "HIGHSTATE_MIGRATION_DATABASE_URL",
|
|
668
|
+
"value": null
|
|
605
669
|
}
|
|
606
670
|
}
|
|
607
671
|
},
|
|
608
|
-
inlineSchema: 'model
|
|
609
|
-
inlineSchemaHash: "
|
|
610
|
-
copyEngine: true,
|
|
611
|
-
runtimeDataModel: {
|
|
612
|
-
models: {},
|
|
613
|
-
enums: {},
|
|
614
|
-
types: {}
|
|
672
|
+
"inlineSchema": 'model UserWorkspaceLayout {\n /// The opaque ID of the user to which this layout belongs.\n userId String @id\n\n /// The layout of the user workspace managed by the frontend.\n ///\n /// ![unknown]\n layout Json\n}\n\nmodel Library {\n /// The CUIDv2 of the library.\n id String @id @default(cuid(2))\n\n /// The metadata of the library managed by the backend.\n ///\n /// [CommonObjectMeta]\n meta Json\n\n /// The spec of the library.\n ///\n /// [LibrarySpec]\n spec Json\n\n /// The projects using this library.\n projects Project[]\n}\n\nmodel Project {\n /// The CUIDv2 of the project.\n id String @id @default(cuid(2))\n\n /// Project meta managed by the backend.\n ///\n /// [CommonObjectMeta]\n meta Json\n\n /// The name of the project within the space.\n name String\n\n /// The ID of the project space this project belongs to.\n spaceId String\n\n /// The ID of the project model storage this project uses.\n modelStorageId String\n\n /// The ID of the library used by this project.\n libraryId String\n\n /// The ID of the Pulumi backend used by this project.\n pulumiBackendId String\n\n /// Encrypted project master key in AGE format.\n encryptedMasterKey String\n\n /// The unlock suite for this project.\n ///\n /// [ProjectUnlockSuite]\n unlockSuite Json\n\n /// The current version of the project database.\n /// This is used to determine if the project needs to be migrated.\n databaseVersion Int\n\n /// The time when the project was created.\n createdAt DateTime @default(now())\n\n /// The time when the project was last updated.\n updatedAt DateTime @updatedAt\n\n /// The project space this project belongs to.\n space ProjectSpace @relation(fields: [spaceId], references: [id])\n\n /// The project model storage this project uses.\n modelStorage ProjectModelStorage @relation(fields: [modelStorageId], references: [id])\n\n /// The library used by this project.\n library Library @relation(fields: [libraryId], references: [id])\n\n /// The Pulumi backend used by this project.\n pulumiBackend PulumiBackend @relation(fields: [pulumiBackendId], references: [id])\n\n @@unique([spaceId, name])\n}\n\nmodel ProjectSpace {\n /// The CUIDv2 of the project space.\n id String @id @default(cuid(2))\n\n /// The name of the project space within the parent space.\n ///\n /// Will be null for the global project space.\n name String?\n\n /// The ID of the parent project space, if any.\n parentId String?\n\n /// The metadata of the project space managed by the backend.\n ///\n /// [CommonObjectMeta]\n meta Json\n\n /// The projects in this project space.\n projects Project[]\n\n /// The parent project space, if any.\n parent ProjectSpace? @relation("ProjectSpaceHierarchy", fields: [parentId], references: [id])\n\n /// The child project spaces, if any.\n children ProjectSpace[] @relation("ProjectSpaceHierarchy")\n\n @@unique([parentId, name])\n}\n\nmodel ProjectModelStorage {\n /// The CUIDv2 of the project model storage.\n id String @id @default(cuid(2))\n\n /// The metadata of the project model storage managed by the backend.\n ///\n /// [CommonObjectMeta]\n meta Json\n\n /// The specification of the project model storage.\n ///\n /// [ProjectModelStorageSpec]\n spec Json\n\n /// The projects using this model storage.\n projects Project[]\n}\n\nmodel PulumiBackend {\n /// The CUIDv2 of the Pulumi backend.\n id String @id @default(cuid(2))\n\n /// The backend meta managed by the backend.\n ///\n /// [CommonObjectMeta]\n meta Json\n\n /// The spec of the Pulumi backend.\n ///\n /// [PulumiBackendSpec]\n spec Json\n\n /// The projects using this backend.\n projects Project[]\n}\n\n/// Unlock methods describe trusted identities that can decrypt the backend master key.\nmodel BackendUnlockMethod {\n /// The CUIDv2 of the unlock method.\n id String @id @default(cuid(2))\n\n /// The metadata of the unlock method managed by the backend.\n /// \n /// [BackendUnlockMethodMeta]\n meta Json\n\n /// The AGE recipient for this unlock method.\n recipient String @unique\n\n /// The time when the unlock method was created.\n createdAt DateTime @default(now())\n\n /// The time when the unlock method was last updated.\n updatedAt DateTime @updatedAt\n}\n\ndatasource db {\n provider = "sqlite"\n url = env("HIGHSTATE_MIGRATION_DATABASE_URL")\n}\n\ngenerator client {\n provider = "prisma-client"\n previewFeatures = ["queryCompiler", "driverAdapters"]\n output = "../../../src/database/_generated/backend/sqlite"\n moduleFormat = "esm"\n generatedFileExtension = "ts"\n importFileExtension = "ts"\n}\n\ngenerator json {\n provider = "prisma-json-types-generator"\n}\n',
|
|
673
|
+
"inlineSchemaHash": "a1ceaf17c7e387f39b598365de3b12cae9e6d31f021d9ab4f958f2c85bb34129",
|
|
674
|
+
"copyEngine": true,
|
|
675
|
+
"runtimeDataModel": {
|
|
676
|
+
"models": {},
|
|
677
|
+
"enums": {},
|
|
678
|
+
"types": {}
|
|
615
679
|
},
|
|
616
|
-
dirname: ""
|
|
680
|
+
"dirname": ""
|
|
617
681
|
};
|
|
618
|
-
config.runtimeDataModel = JSON.parse(
|
|
619
|
-
'{"models":{"UserWorkspaseLayout":{"fields":[{"name":"userId","kind":"scalar","type":"String"},{"name":"layout","kind":"scalar","type":"Json"}],"dbName":null},"Library":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"meta","kind":"scalar","type":"Json"},{"name":"spec","kind":"scalar","type":"Json"},{"name":"projects","kind":"object","type":"Project","relationName":"LibraryToProject"}],"dbName":null},"Project":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"meta","kind":"scalar","type":"Json"},{"name":"name","kind":"scalar","type":"String"},{"name":"spaceId","kind":"scalar","type":"String"},{"name":"modelStorageId","kind":"scalar","type":"String"},{"name":"libraryId","kind":"scalar","type":"String"},{"name":"pulumiBackendId","kind":"scalar","type":"String"},{"name":"encryptedMasterKey","kind":"scalar","type":"String"},{"name":"unlockSuite","kind":"scalar","type":"Json"},{"name":"databaseVersion","kind":"scalar","type":"Int"},{"name":"createdAt","kind":"scalar","type":"DateTime"},{"name":"updatedAt","kind":"scalar","type":"DateTime"},{"name":"space","kind":"object","type":"ProjectSpace","relationName":"ProjectToProjectSpace"},{"name":"modelStorage","kind":"object","type":"ProjectModelStorage","relationName":"ProjectToProjectModelStorage"},{"name":"library","kind":"object","type":"Library","relationName":"LibraryToProject"},{"name":"pulumiBackend","kind":"object","type":"PulumiBackend","relationName":"ProjectToPulumiBackend"}],"dbName":null},"ProjectSpace":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"name","kind":"scalar","type":"String"},{"name":"parentId","kind":"scalar","type":"String"},{"name":"meta","kind":"scalar","type":"Json"},{"name":"projects","kind":"object","type":"Project","relationName":"ProjectToProjectSpace"},{"name":"parent","kind":"object","type":"ProjectSpace","relationName":"ProjectSpaceHierarchy"},{"name":"children","kind":"object","type":"ProjectSpace","relationName":"ProjectSpaceHierarchy"}],"dbName":null},"ProjectModelStorage":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"meta","kind":"scalar","type":"Json"},{"name":"spec","kind":"scalar","type":"Json"},{"name":"projects","kind":"object","type":"Project","relationName":"ProjectToProjectModelStorage"}],"dbName":null},"PulumiBackend":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"meta","kind":"scalar","type":"Json"},{"name":"spec","kind":"scalar","type":"Json"},{"name":"projects","kind":"object","type":"Project","relationName":"ProjectToPulumiBackend"}],"dbName":null}},"enums":{},"types":{}}'
|
|
620
|
-
);
|
|
682
|
+
config.runtimeDataModel = JSON.parse('{"models":{"UserWorkspaceLayout":{"fields":[{"name":"userId","kind":"scalar","type":"String"},{"name":"layout","kind":"scalar","type":"Json"}],"dbName":null},"Library":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"meta","kind":"scalar","type":"Json"},{"name":"spec","kind":"scalar","type":"Json"},{"name":"projects","kind":"object","type":"Project","relationName":"LibraryToProject"}],"dbName":null},"Project":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"meta","kind":"scalar","type":"Json"},{"name":"name","kind":"scalar","type":"String"},{"name":"spaceId","kind":"scalar","type":"String"},{"name":"modelStorageId","kind":"scalar","type":"String"},{"name":"libraryId","kind":"scalar","type":"String"},{"name":"pulumiBackendId","kind":"scalar","type":"String"},{"name":"encryptedMasterKey","kind":"scalar","type":"String"},{"name":"unlockSuite","kind":"scalar","type":"Json"},{"name":"databaseVersion","kind":"scalar","type":"Int"},{"name":"createdAt","kind":"scalar","type":"DateTime"},{"name":"updatedAt","kind":"scalar","type":"DateTime"},{"name":"space","kind":"object","type":"ProjectSpace","relationName":"ProjectToProjectSpace"},{"name":"modelStorage","kind":"object","type":"ProjectModelStorage","relationName":"ProjectToProjectModelStorage"},{"name":"library","kind":"object","type":"Library","relationName":"LibraryToProject"},{"name":"pulumiBackend","kind":"object","type":"PulumiBackend","relationName":"ProjectToPulumiBackend"}],"dbName":null},"ProjectSpace":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"name","kind":"scalar","type":"String"},{"name":"parentId","kind":"scalar","type":"String"},{"name":"meta","kind":"scalar","type":"Json"},{"name":"projects","kind":"object","type":"Project","relationName":"ProjectToProjectSpace"},{"name":"parent","kind":"object","type":"ProjectSpace","relationName":"ProjectSpaceHierarchy"},{"name":"children","kind":"object","type":"ProjectSpace","relationName":"ProjectSpaceHierarchy"}],"dbName":null},"ProjectModelStorage":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"meta","kind":"scalar","type":"Json"},{"name":"spec","kind":"scalar","type":"Json"},{"name":"projects","kind":"object","type":"Project","relationName":"ProjectToProjectModelStorage"}],"dbName":null},"PulumiBackend":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"meta","kind":"scalar","type":"Json"},{"name":"spec","kind":"scalar","type":"Json"},{"name":"projects","kind":"object","type":"Project","relationName":"ProjectToPulumiBackend"}],"dbName":null},"BackendUnlockMethod":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"meta","kind":"scalar","type":"Json"},{"name":"recipient","kind":"scalar","type":"String"},{"name":"createdAt","kind":"scalar","type":"DateTime"},{"name":"updatedAt","kind":"scalar","type":"DateTime"}],"dbName":null}},"enums":{},"types":{}}');
|
|
621
683
|
config.engineWasm = void 0;
|
|
622
684
|
async function decodeBase64AsWasm(wasmBase64) {
|
|
623
685
|
const { Buffer: Buffer2 } = await import('node:buffer');
|
|
@@ -754,6 +816,47 @@ var localBackendDatabaseConfig = z.object({
|
|
|
754
816
|
HIGHSTATE_BACKEND_DATABASE_LOCAL_PATH: z.string().optional(),
|
|
755
817
|
HIGHSTATE_ENCRYPTION_ENABLED: z.stringbool().default(true)
|
|
756
818
|
});
|
|
819
|
+
var LocalBackendDatabaseBackend = class {
|
|
820
|
+
constructor(database, databasePath, logger, isEncryptionEnabled) {
|
|
821
|
+
this.database = database;
|
|
822
|
+
this.databasePath = databasePath;
|
|
823
|
+
this.logger = logger;
|
|
824
|
+
this.isEncryptionEnabled = isEncryptionEnabled;
|
|
825
|
+
}
|
|
826
|
+
/**
|
|
827
|
+
* Rewrites the encrypted master key to match the provided recipients.
|
|
828
|
+
*
|
|
829
|
+
* @param recipients AGE recipients that should retain access to the backend master key.
|
|
830
|
+
*/
|
|
831
|
+
async reencryptMasterKey(recipients) {
|
|
832
|
+
if (!this.isEncryptionEnabled) {
|
|
833
|
+
return;
|
|
834
|
+
}
|
|
835
|
+
const meta = await readMetaFile(this.databasePath);
|
|
836
|
+
if (!meta?.masterKey) {
|
|
837
|
+
this.logger.warn(
|
|
838
|
+
{ databasePath: this.databasePath },
|
|
839
|
+
"backend meta file does not contain a master key; skipping re-encryption"
|
|
840
|
+
);
|
|
841
|
+
return;
|
|
842
|
+
}
|
|
843
|
+
const identity = await getOrCreateBackendIdentity(this.logger);
|
|
844
|
+
const decrypter = new Decrypter();
|
|
845
|
+
decrypter.addIdentity(identity);
|
|
846
|
+
const plaintextMasterKey = await decrypter.decrypt(armor.decode(meta.masterKey), "text");
|
|
847
|
+
const encrypter = new Encrypter();
|
|
848
|
+
const allowedRecipients = new Set(recipients);
|
|
849
|
+
allowedRecipients.add(await identityToRecipient(identity));
|
|
850
|
+
for (const recipient of allowedRecipients) {
|
|
851
|
+
encrypter.addRecipient(recipient);
|
|
852
|
+
}
|
|
853
|
+
const encrypted = await encrypter.encrypt(plaintextMasterKey);
|
|
854
|
+
await writeMetaFile(this.databasePath, {
|
|
855
|
+
...meta,
|
|
856
|
+
masterKey: armor.encode(encrypted)
|
|
857
|
+
});
|
|
858
|
+
}
|
|
859
|
+
};
|
|
757
860
|
async function createMasterKey(logger) {
|
|
758
861
|
const identity = await getOrCreateBackendIdentity(logger);
|
|
759
862
|
const masterKey = randomBytes(32).toString("hex");
|
|
@@ -762,7 +865,7 @@ async function createMasterKey(logger) {
|
|
|
762
865
|
encrypter.addRecipient(recipient);
|
|
763
866
|
const encryptedMasterKey = await encrypter.encrypt(masterKey);
|
|
764
867
|
const armoredMasterKey = armor.encode(encryptedMasterKey);
|
|
765
|
-
return { armoredMasterKey, masterKey };
|
|
868
|
+
return { armoredMasterKey, masterKey, recipient };
|
|
766
869
|
}
|
|
767
870
|
async function ensureDatabaseInitialized(databasePath, encryptionEnabled, logger) {
|
|
768
871
|
const meta = await readMetaFile(databasePath);
|
|
@@ -773,7 +876,13 @@ async function ensureDatabaseInitialized(databasePath, encryptionEnabled, logger
|
|
|
773
876
|
version: backendDatabaseVersion,
|
|
774
877
|
masterKey: masterKey2?.armoredMasterKey
|
|
775
878
|
};
|
|
776
|
-
return {
|
|
879
|
+
return {
|
|
880
|
+
shouldMigrate: true,
|
|
881
|
+
masterKey: masterKey2?.masterKey,
|
|
882
|
+
metaFile,
|
|
883
|
+
created: true,
|
|
884
|
+
initialRecipient: masterKey2?.recipient
|
|
885
|
+
};
|
|
777
886
|
}
|
|
778
887
|
if (meta.version > backendDatabaseVersion) {
|
|
779
888
|
throw new Error(
|
|
@@ -784,12 +893,13 @@ async function ensureDatabaseInitialized(databasePath, encryptionEnabled, logger
|
|
|
784
893
|
return {
|
|
785
894
|
shouldMigrate: meta.version < backendDatabaseVersion,
|
|
786
895
|
masterKey: void 0,
|
|
787
|
-
metaFile: meta
|
|
896
|
+
metaFile: meta,
|
|
897
|
+
created: false
|
|
788
898
|
};
|
|
789
899
|
}
|
|
790
900
|
if (!meta.masterKey) {
|
|
791
901
|
throw new Error(
|
|
792
|
-
`Database meta file at "${databasePath}/meta.yaml" does not contain a master key.`
|
|
902
|
+
`Database meta file at "${databasePath}/backend.meta.yaml" does not contain a master key.`
|
|
793
903
|
);
|
|
794
904
|
}
|
|
795
905
|
const identity = await getOrCreateBackendIdentity(logger);
|
|
@@ -801,20 +911,17 @@ async function ensureDatabaseInitialized(databasePath, encryptionEnabled, logger
|
|
|
801
911
|
return {
|
|
802
912
|
shouldMigrate: meta.version < backendDatabaseVersion,
|
|
803
913
|
masterKey,
|
|
804
|
-
metaFile: meta
|
|
914
|
+
metaFile: meta,
|
|
915
|
+
created: false
|
|
805
916
|
};
|
|
806
917
|
}
|
|
807
|
-
async function
|
|
918
|
+
async function createLocalBackendDatabaseBackend(config4, logger) {
|
|
808
919
|
if (!config4.HIGHSTATE_ENCRYPTION_ENABLED) {
|
|
809
920
|
logger.warn("local database encryption is disabled, this is not recommended for production use");
|
|
810
921
|
}
|
|
811
922
|
let databasePath = config4.HIGHSTATE_BACKEND_DATABASE_LOCAL_PATH;
|
|
812
923
|
databasePath ??= await getCodebaseHighstatePath(config4, logger);
|
|
813
|
-
const { shouldMigrate, masterKey, metaFile } = await ensureDatabaseInitialized(
|
|
814
|
-
databasePath,
|
|
815
|
-
config4.HIGHSTATE_ENCRYPTION_ENABLED,
|
|
816
|
-
logger
|
|
817
|
-
);
|
|
924
|
+
const { shouldMigrate, masterKey, metaFile, created, initialRecipient } = await ensureDatabaseInitialized(databasePath, config4.HIGHSTATE_ENCRYPTION_ENABLED, logger);
|
|
818
925
|
const databaseUrl = `file:${databasePath}/backend.db`;
|
|
819
926
|
if (shouldMigrate) {
|
|
820
927
|
await migrateDatabase(databaseUrl, "backend/sqlite", masterKey, logger);
|
|
@@ -827,65 +934,98 @@ async function createLocalBackendDatabase(config4, logger) {
|
|
|
827
934
|
const prismaClient = new PrismaClient({
|
|
828
935
|
adapter
|
|
829
936
|
});
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
937
|
+
const database = prismaClient;
|
|
938
|
+
await ensureWellKnownEntitiesCreated(database);
|
|
939
|
+
const backendLogger = logger.child({ service: "LocalBackendDatabaseBackend" });
|
|
940
|
+
await ensureInitialUnlockMethod(database, created, initialRecipient, backendLogger);
|
|
941
|
+
backendLogger.info("database is ready");
|
|
942
|
+
return new LocalBackendDatabaseBackend(
|
|
943
|
+
database,
|
|
944
|
+
databasePath,
|
|
945
|
+
backendLogger,
|
|
946
|
+
config4.HIGHSTATE_ENCRYPTION_ENABLED
|
|
947
|
+
);
|
|
948
|
+
}
|
|
949
|
+
function getInitialBackendUnlockMethodMeta(host) {
|
|
950
|
+
const trimmed = host?.trim() ?? "";
|
|
951
|
+
const title = trimmed.length > 0 ? trimmed : "initial";
|
|
952
|
+
const description = trimmed.length > 0 ? `Identity automatically registered for ${trimmed} when this backend database was created.` : "Identity automatically registered when this backend database was created.";
|
|
953
|
+
return { title, description };
|
|
954
|
+
}
|
|
955
|
+
async function ensureInitialUnlockMethod(database, created, initialRecipient, logger) {
|
|
956
|
+
if (!created || !initialRecipient) {
|
|
957
|
+
return;
|
|
958
|
+
}
|
|
959
|
+
const meta = getInitialBackendUnlockMethodMeta(hostname());
|
|
960
|
+
await database.backendUnlockMethod.create({
|
|
961
|
+
data: {
|
|
962
|
+
recipient: initialRecipient,
|
|
963
|
+
meta
|
|
964
|
+
}
|
|
965
|
+
});
|
|
966
|
+
logger.info(
|
|
967
|
+
{ title: meta.title, recipient: initialRecipient },
|
|
968
|
+
"registered initial backend unlock method"
|
|
969
|
+
);
|
|
833
970
|
}
|
|
834
971
|
var config2 = {
|
|
835
|
-
generator: {
|
|
836
|
-
name: "client",
|
|
837
|
-
provider: {
|
|
838
|
-
fromEnvVar: null,
|
|
839
|
-
value: "prisma-client"
|
|
972
|
+
"generator": {
|
|
973
|
+
"name": "client",
|
|
974
|
+
"provider": {
|
|
975
|
+
"fromEnvVar": null,
|
|
976
|
+
"value": "prisma-client"
|
|
840
977
|
},
|
|
841
|
-
output: {
|
|
842
|
-
value: "/home/exeteres/Projects/personal/highstate/packages/platform/backend/src/database/_generated/backend/postgresql",
|
|
843
|
-
fromEnvVar: null
|
|
978
|
+
"output": {
|
|
979
|
+
"value": "/home/exeteres/Projects/personal/highstate/packages/platform/backend/src/database/_generated/backend/postgresql",
|
|
980
|
+
"fromEnvVar": null
|
|
844
981
|
},
|
|
845
|
-
config: {
|
|
846
|
-
|
|
847
|
-
generatedFileExtension: "ts",
|
|
848
|
-
|
|
849
|
-
engineType: "client"
|
|
982
|
+
"config": {
|
|
983
|
+
"moduleFormat": "esm",
|
|
984
|
+
"generatedFileExtension": "ts",
|
|
985
|
+
"importFileExtension": "ts",
|
|
986
|
+
"engineType": "client"
|
|
850
987
|
},
|
|
851
|
-
binaryTargets: [
|
|
988
|
+
"binaryTargets": [
|
|
852
989
|
{
|
|
853
|
-
fromEnvVar: null,
|
|
854
|
-
value: "linux-nixos",
|
|
855
|
-
native: true
|
|
990
|
+
"fromEnvVar": null,
|
|
991
|
+
"value": "linux-nixos",
|
|
992
|
+
"native": true
|
|
856
993
|
}
|
|
857
994
|
],
|
|
858
|
-
previewFeatures: [
|
|
859
|
-
|
|
860
|
-
|
|
995
|
+
"previewFeatures": [
|
|
996
|
+
"driverAdapters",
|
|
997
|
+
"queryCompiler"
|
|
998
|
+
],
|
|
999
|
+
"sourceFilePath": "/home/exeteres/Projects/personal/highstate/packages/platform/backend/prisma/backend/postgresql/main.prisma",
|
|
1000
|
+
"isCustomOutput": true
|
|
861
1001
|
},
|
|
862
|
-
relativePath: "../../../../../prisma/backend/postgresql",
|
|
863
|
-
clientVersion: "6.14.0",
|
|
864
|
-
engineVersion: "717184b7b35ea05dfa71a3236b7af656013e1e49",
|
|
865
|
-
datasourceNames: [
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
1002
|
+
"relativePath": "../../../../../prisma/backend/postgresql",
|
|
1003
|
+
"clientVersion": "6.14.0",
|
|
1004
|
+
"engineVersion": "717184b7b35ea05dfa71a3236b7af656013e1e49",
|
|
1005
|
+
"datasourceNames": [
|
|
1006
|
+
"db"
|
|
1007
|
+
],
|
|
1008
|
+
"activeProvider": "postgresql",
|
|
1009
|
+
"postinstall": false,
|
|
1010
|
+
"inlineDatasources": {
|
|
1011
|
+
"db": {
|
|
1012
|
+
"url": {
|
|
1013
|
+
"fromEnvVar": "HIGHSTATE_MIGRATION_DATABASE_URL",
|
|
1014
|
+
"value": null
|
|
873
1015
|
}
|
|
874
1016
|
}
|
|
875
1017
|
},
|
|
876
|
-
inlineSchema: 'model
|
|
877
|
-
inlineSchemaHash: "
|
|
878
|
-
copyEngine: true,
|
|
879
|
-
runtimeDataModel: {
|
|
880
|
-
models: {},
|
|
881
|
-
enums: {},
|
|
882
|
-
types: {}
|
|
1018
|
+
"inlineSchema": 'model UserWorkspaceLayout {\n /// The opaque ID of the user to which this layout belongs.\n userId String @id\n\n /// The layout of the user workspace managed by the frontend.\n ///\n /// ![unknown]\n layout Json\n}\n\nmodel Library {\n /// The CUIDv2 of the library.\n id String @id @default(cuid(2))\n\n /// The metadata of the library managed by the backend.\n ///\n /// [CommonObjectMeta]\n meta Json\n\n /// The spec of the library.\n ///\n /// [LibrarySpec]\n spec Json\n\n /// The projects using this library.\n projects Project[]\n}\n\nmodel Project {\n /// The CUIDv2 of the project.\n id String @id @default(cuid(2))\n\n /// Project meta managed by the backend.\n ///\n /// [CommonObjectMeta]\n meta Json\n\n /// The name of the project within the space.\n name String\n\n /// The ID of the project space this project belongs to.\n spaceId String\n\n /// The ID of the project model storage this project uses.\n modelStorageId String\n\n /// The ID of the library used by this project.\n libraryId String\n\n /// The ID of the Pulumi backend used by this project.\n pulumiBackendId String\n\n /// Encrypted project master key in AGE format.\n encryptedMasterKey String\n\n /// The unlock suite for this project.\n ///\n /// [ProjectUnlockSuite]\n unlockSuite Json\n\n /// The current version of the project database.\n /// This is used to determine if the project needs to be migrated.\n databaseVersion Int\n\n /// The time when the project was created.\n createdAt DateTime @default(now())\n\n /// The time when the project was last updated.\n updatedAt DateTime @updatedAt\n\n /// The project space this project belongs to.\n space ProjectSpace @relation(fields: [spaceId], references: [id])\n\n /// The project model storage this project uses.\n modelStorage ProjectModelStorage @relation(fields: [modelStorageId], references: [id])\n\n /// The library used by this project.\n library Library @relation(fields: [libraryId], references: [id])\n\n /// The Pulumi backend used by this project.\n pulumiBackend PulumiBackend @relation(fields: [pulumiBackendId], references: [id])\n\n @@unique([spaceId, name])\n}\n\nmodel ProjectSpace {\n /// The CUIDv2 of the project space.\n id String @id @default(cuid(2))\n\n /// The name of the project space within the parent space.\n ///\n /// Will be null for the global project space.\n name String?\n\n /// The ID of the parent project space, if any.\n parentId String?\n\n /// The metadata of the project space managed by the backend.\n ///\n /// [CommonObjectMeta]\n meta Json\n\n /// The projects in this project space.\n projects Project[]\n\n /// The parent project space, if any.\n parent ProjectSpace? @relation("ProjectSpaceHierarchy", fields: [parentId], references: [id])\n\n /// The child project spaces, if any.\n children ProjectSpace[] @relation("ProjectSpaceHierarchy")\n\n @@unique([parentId, name])\n}\n\nmodel ProjectModelStorage {\n /// The CUIDv2 of the project model storage.\n id String @id @default(cuid(2))\n\n /// The metadata of the project model storage managed by the backend.\n ///\n /// [CommonObjectMeta]\n meta Json\n\n /// The specification of the project model storage.\n ///\n /// [ProjectModelStorageSpec]\n spec Json\n\n /// The projects using this model storage.\n projects Project[]\n}\n\nmodel PulumiBackend {\n /// The CUIDv2 of the Pulumi backend.\n id String @id @default(cuid(2))\n\n /// The backend meta managed by the backend.\n ///\n /// [CommonObjectMeta]\n meta Json\n\n /// The spec of the Pulumi backend.\n ///\n /// [PulumiBackendSpec]\n spec Json\n\n /// The projects using this backend.\n projects Project[]\n}\n\n/// Unlock methods describe trusted identities that can decrypt the backend master key.\nmodel BackendUnlockMethod {\n /// The CUIDv2 of the unlock method.\n id String @id @default(cuid(2))\n\n /// The metadata of the unlock method managed by the backend.\n /// \n /// [BackendUnlockMethodMeta]\n meta Json\n\n /// The AGE recipient for this unlock method.\n recipient String @unique\n\n /// The time when the unlock method was created.\n createdAt DateTime @default(now())\n\n /// The time when the unlock method was last updated.\n updatedAt DateTime @updatedAt\n}\n\ndatasource db {\n provider = "postgresql"\n url = env("HIGHSTATE_MIGRATION_DATABASE_URL")\n}\n\ngenerator client {\n provider = "prisma-client"\n previewFeatures = ["queryCompiler", "driverAdapters"]\n output = "../../../src/database/_generated/backend/postgresql"\n moduleFormat = "esm"\n generatedFileExtension = "ts"\n importFileExtension = "ts"\n}\n\ngenerator json {\n provider = "prisma-json-types-generator"\n}\n',
|
|
1019
|
+
"inlineSchemaHash": "da1dbb64b6c731ded11a88c53a02bc985f6d5732acc37035289eded446f9fbcc",
|
|
1020
|
+
"copyEngine": true,
|
|
1021
|
+
"runtimeDataModel": {
|
|
1022
|
+
"models": {},
|
|
1023
|
+
"enums": {},
|
|
1024
|
+
"types": {}
|
|
883
1025
|
},
|
|
884
|
-
dirname: ""
|
|
1026
|
+
"dirname": ""
|
|
885
1027
|
};
|
|
886
|
-
config2.runtimeDataModel = JSON.parse(
|
|
887
|
-
'{"models":{"UserWorkspaseLayout":{"fields":[{"name":"userId","kind":"scalar","type":"String"},{"name":"layout","kind":"scalar","type":"Json"}],"dbName":null},"Library":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"meta","kind":"scalar","type":"Json"},{"name":"spec","kind":"scalar","type":"Json"},{"name":"projects","kind":"object","type":"Project","relationName":"LibraryToProject"}],"dbName":null},"Project":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"meta","kind":"scalar","type":"Json"},{"name":"name","kind":"scalar","type":"String"},{"name":"spaceId","kind":"scalar","type":"String"},{"name":"modelStorageId","kind":"scalar","type":"String"},{"name":"libraryId","kind":"scalar","type":"String"},{"name":"pulumiBackendId","kind":"scalar","type":"String"},{"name":"encryptedMasterKey","kind":"scalar","type":"String"},{"name":"unlockSuite","kind":"scalar","type":"Json"},{"name":"databaseVersion","kind":"scalar","type":"Int"},{"name":"createdAt","kind":"scalar","type":"DateTime"},{"name":"updatedAt","kind":"scalar","type":"DateTime"},{"name":"space","kind":"object","type":"ProjectSpace","relationName":"ProjectToProjectSpace"},{"name":"modelStorage","kind":"object","type":"ProjectModelStorage","relationName":"ProjectToProjectModelStorage"},{"name":"library","kind":"object","type":"Library","relationName":"LibraryToProject"},{"name":"pulumiBackend","kind":"object","type":"PulumiBackend","relationName":"ProjectToPulumiBackend"}],"dbName":null},"ProjectSpace":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"name","kind":"scalar","type":"String"},{"name":"parentId","kind":"scalar","type":"String"},{"name":"meta","kind":"scalar","type":"Json"},{"name":"projects","kind":"object","type":"Project","relationName":"ProjectToProjectSpace"},{"name":"parent","kind":"object","type":"ProjectSpace","relationName":"ProjectSpaceHierarchy"},{"name":"children","kind":"object","type":"ProjectSpace","relationName":"ProjectSpaceHierarchy"}],"dbName":null},"ProjectModelStorage":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"meta","kind":"scalar","type":"Json"},{"name":"spec","kind":"scalar","type":"Json"},{"name":"projects","kind":"object","type":"Project","relationName":"ProjectToProjectModelStorage"}],"dbName":null},"PulumiBackend":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"meta","kind":"scalar","type":"Json"},{"name":"spec","kind":"scalar","type":"Json"},{"name":"projects","kind":"object","type":"Project","relationName":"ProjectToPulumiBackend"}],"dbName":null}},"enums":{},"types":{}}'
|
|
888
|
-
);
|
|
1028
|
+
config2.runtimeDataModel = JSON.parse('{"models":{"UserWorkspaceLayout":{"fields":[{"name":"userId","kind":"scalar","type":"String"},{"name":"layout","kind":"scalar","type":"Json"}],"dbName":null},"Library":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"meta","kind":"scalar","type":"Json"},{"name":"spec","kind":"scalar","type":"Json"},{"name":"projects","kind":"object","type":"Project","relationName":"LibraryToProject"}],"dbName":null},"Project":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"meta","kind":"scalar","type":"Json"},{"name":"name","kind":"scalar","type":"String"},{"name":"spaceId","kind":"scalar","type":"String"},{"name":"modelStorageId","kind":"scalar","type":"String"},{"name":"libraryId","kind":"scalar","type":"String"},{"name":"pulumiBackendId","kind":"scalar","type":"String"},{"name":"encryptedMasterKey","kind":"scalar","type":"String"},{"name":"unlockSuite","kind":"scalar","type":"Json"},{"name":"databaseVersion","kind":"scalar","type":"Int"},{"name":"createdAt","kind":"scalar","type":"DateTime"},{"name":"updatedAt","kind":"scalar","type":"DateTime"},{"name":"space","kind":"object","type":"ProjectSpace","relationName":"ProjectToProjectSpace"},{"name":"modelStorage","kind":"object","type":"ProjectModelStorage","relationName":"ProjectToProjectModelStorage"},{"name":"library","kind":"object","type":"Library","relationName":"LibraryToProject"},{"name":"pulumiBackend","kind":"object","type":"PulumiBackend","relationName":"ProjectToPulumiBackend"}],"dbName":null},"ProjectSpace":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"name","kind":"scalar","type":"String"},{"name":"parentId","kind":"scalar","type":"String"},{"name":"meta","kind":"scalar","type":"Json"},{"name":"projects","kind":"object","type":"Project","relationName":"ProjectToProjectSpace"},{"name":"parent","kind":"object","type":"ProjectSpace","relationName":"ProjectSpaceHierarchy"},{"name":"children","kind":"object","type":"ProjectSpace","relationName":"ProjectSpaceHierarchy"}],"dbName":null},"ProjectModelStorage":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"meta","kind":"scalar","type":"Json"},{"name":"spec","kind":"scalar","type":"Json"},{"name":"projects","kind":"object","type":"Project","relationName":"ProjectToProjectModelStorage"}],"dbName":null},"PulumiBackend":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"meta","kind":"scalar","type":"Json"},{"name":"spec","kind":"scalar","type":"Json"},{"name":"projects","kind":"object","type":"Project","relationName":"ProjectToPulumiBackend"}],"dbName":null},"BackendUnlockMethod":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"meta","kind":"scalar","type":"Json"},{"name":"recipient","kind":"scalar","type":"String"},{"name":"createdAt","kind":"scalar","type":"DateTime"},{"name":"updatedAt","kind":"scalar","type":"DateTime"}],"dbName":null}},"enums":{},"types":{}}');
|
|
889
1029
|
config2.engineWasm = void 0;
|
|
890
1030
|
async function decodeBase64AsWasm2(wasmBase64) {
|
|
891
1031
|
const { Buffer: Buffer2 } = await import('node:buffer');
|
|
@@ -937,9 +1077,9 @@ var config3 = {
|
|
|
937
1077
|
"fromEnvVar": null
|
|
938
1078
|
},
|
|
939
1079
|
"config": {
|
|
940
|
-
"moduleFormat": "esm",
|
|
941
|
-
"generatedFileExtension": "ts",
|
|
942
1080
|
"importFileExtension": "ts",
|
|
1081
|
+
"generatedFileExtension": "ts",
|
|
1082
|
+
"moduleFormat": "esm",
|
|
943
1083
|
"engineType": "client"
|
|
944
1084
|
},
|
|
945
1085
|
"binaryTargets": [
|
|
@@ -963,17 +1103,16 @@ var config3 = {
|
|
|
963
1103
|
"db"
|
|
964
1104
|
],
|
|
965
1105
|
"activeProvider": "sqlite",
|
|
966
|
-
"postinstall": false,
|
|
967
1106
|
"inlineDatasources": {
|
|
968
1107
|
"db": {
|
|
969
1108
|
"url": {
|
|
970
|
-
"fromEnvVar":
|
|
971
|
-
"value":
|
|
1109
|
+
"fromEnvVar": "HIGHSTATE_MIGRATION_DATABASE_URL",
|
|
1110
|
+
"value": null
|
|
972
1111
|
}
|
|
973
1112
|
}
|
|
974
1113
|
},
|
|
975
|
-
"inlineSchema": '/// The API key provides authentication tokens for accessing the platform API.\n///\n/// Each API key impersonates a service account, inheriting its permissions and access scope.\n/// Keys are automatically created for worker versions and can be manually created for\n/// external integrations. The token is a 32-byte random hex string that can be regenerated.\nmodel ApiKey {\n /// The CUIDv2 of the API key.\n id String @id @default(cuid(2))\n\n /// The metadata of the API key managed by the backend.\n ///\n /// [ApiKeyMeta]\n meta Json\n\n /// The ID of the service account impersonated by this API key.\n serviceAccountId String\n\n /// The API token for authentication.\n token String @unique\n\n /// The time when the API key was created.\n createdAt DateTime @default(now())\n\n /// The time when the API key was last updated.\n updatedAt DateTime @updatedAt\n\n /// The worker version that owns this API key.\n worker WorkerVersion?\n\n /// The service account which this API key impersonates.\n serviceAccount ServiceAccount @relation(fields: [serviceAccountId], references: [id], onDelete: Cascade)\n}\n\n/// The artifact represents a file or folder stored in the system.\n///\n/// It can be produced by units or manually uploaded via API by service accounts.\n///\n/// Since different actors can produce the same artifact with the same content and hash,\n/// there is the ownership/usage concept to track which entities produce or use the artifact.\n/// The "ownership" and "usage" are synonymous in this context and often referred to as "usage".\n///\n/// When no usages are present, the artifact will be automatically garbage collected after a certain period.\nmodel Artifact {\n /// The CUIDv2 of the artifact.\n id String @id @default(cuid(2))\n\n /// The metadata of the artifact managed by the backend.\n ///\n /// Since multiple actors can produce the same artifact,\n /// this metadata is the last one provided by any actor.\n ///\n /// [CommonObjectMeta]\n meta Json\n\n /// The SHA256 hash of the artifact content.\n hash String @unique\n\n /// The size of the compressed artifact content in bytes.\n ///\n /// Does not represent the size of the original file or folder,\n /// but the size used to store the artifact in the system.\n size Int\n\n /// The chunk size of the artifact content in bytes.\n /// Used to split the artifact into smaller chunks for storage.\n chunkSize Int\n\n /// The timestamp when the artifact fist appeared in the system.\n createdAt DateTime @default(now())\n\n /// The timestamp when the artifact was last updated.\n updatedAt DateTime @updatedAt\n\n /// The service accounts using this artifact.\n serviceAccounts ServiceAccount[]\n\n /// The instances using this artifact.\n instances InstanceState[]\n\n /// The terminals using this artifact.\n terminals Terminal[]\n\n /// The pages using this artifact.\n pages Page[]\n}\n\nmodel InstanceCustomStatus {\n /// The ID of the instance state this status belongs to.\n stateId String\n\n /// The ID of the service account which attached this custom status.\n serviceAccountId String\n\n /// The name of the custom status unique within the instance and service account.\n name String\n\n /// The metadata of the custom status managed by the backend.\n ///\n /// [CommonObjectMeta]\n meta Json\n\n /// The status value of the custom status.\n value String\n\n /// The message describing the instance\'s custom status.\n /// \n /// Can be used to provide additional context or information about the status.\n ///\n /// The message will be displayed in the 800x600 ANSI terminal in the UI,\n /// so differenet TUI elements should be drawn within this area.\n message String?\n\n /// The order of the custom status in the list of statuses.\n ///\n /// Should be values from 0 to 100, where 0 is the highest priority.\n /// By default, the order is 50.\n order Int @default(50)\n\n /// The time when the custom status was first attached to the instance.\n createdAt DateTime @default(now())\n\n /// The time when the custom status was last updated.\n updatedAt DateTime @updatedAt\n\n /// The instance this custom status belongs to.\n state InstanceState @relation(fields: [stateId], references: [id])\n\n /// The service account this custom status belongs to.\n serviceAccount ServiceAccount @relation(fields: [serviceAccountId], references: [id])\n\n @@id([stateId, serviceAccountId, name]) // the name must be unique within the instance and service account\n}\n\nenum InstanceEvaluationStatus {\n /// transient statuses (not persisted in the database)\n evaluating\n\n /// stable statuses\n evaluated\n error\n}\n\n/// The evaluation state tracks the result of evaluating composite instances to produce virtual instances.\n///\n/// Composite instances are template components that generate other instances (virtual instances) when evaluated.\n/// The evaluation process executes the composite\'s create function with resolved inputs to produce a tree\n/// of child instances. These virtual instances exist in the source "virtual" state and can be units\n/// (mapping to Pulumi resources) or other composites (producing more virtual instances recursively).\n///\n/// Evaluation happens automatically after project unlock and library reloads to keep virtual instances\n/// synchronized with their composite definitions. Evaluation state persists the produced instance model\n/// and tracks success/error status with descriptive messages showing the instance tree or error details.\nmodel InstanceEvaluationState {\n /// The ID of the state of the instance.\n stateId String @id\n\n /// The status of the instance evaluation.\n status InstanceEvaluationStatus\n\n /// The message describing the evaluation status.\n /// If the evaluation is failed, this message will contain the error description.\n message String?\n\n /// The model produced by the evaluation.\n ///\n /// Will be `null` if the evaluation is failed.\n ///\n /// Can be set for both: real composite instances and virtual instances produced by the evaluation.\n ///\n /// [InstanceModel]\n model Json?\n\n /// The time when the last evaluation was finished.\n evaluatedAt DateTime @updatedAt\n\n /// The instance this state belongs to.\n state InstanceState @relation(fields: [stateId], references: [id])\n}\n\nenum InstanceStatus {\n /// The instance is exists in the model (resident or virtual), but not yet deployed or was completely destroyed.\n ///\n /// "attempted", "deployed" and "failed" instances can be transitioned back to "undeployed" after\n /// successful "destroy" operation.\n undeployed\n\n /// The instance is attempted, but not yet fully deployed.\n ///\n /// Normally, this status is very short-lived, and here to indicate that the instance\n /// cannot be safely deleted from the the model until it will be completely destroyed.\n attempted\n\n /// The initial deployment of the instance was successful.\n ///\n /// The transition of "deployed -> failed" is not possible, so consequent failed operations\n /// will not affect this status.\n ///\n /// Like "attempted", that instance cannot be safely deleted from the model until it will be completely destroyed.\n deployed\n\n /// The initial deployment of the instance failed.\n /// It can still be transitioned to "deployed" by a successful operation\n ///\n /// Like "attempted", that instance cannot be safely deleted from the model until it will be completely destroyed.\n failed\n}\n\nenum InstanceSource {\n /// The instance is defined in the project model.\n resident\n\n /// The instance is produced by evaluation of composite instance.\n virtual\n}\n\nmodel InstanceState {\n /// The surrogate CUIDv2 primary key of the instance to allow renaming instances.\n id String @id @default(cuid(2))\n\n /// The ID of the instance managed by the system.\n ///\n /// [InstanceId]\n instanceId String @unique\n\n /// The status of the instance.\n status InstanceStatus\n\n /// The source of the instance.\n source InstanceSource\n\n /// The kind of the instance.\n ///\n /// [InstanceKind]\n kind String\n\n /// The ID of the parent instance state, if this instance is a child of another composite instance.\n parentId String?\n\n /// The 32-bit nonce used to invalidate the input hash when secrets are updated.\n inputHashNonce Int?\n\n /// The calculated instance CRC32 input hash at the moment of last operation completion.\n ///\n /// This hash covers:\n /// - the instance\'s configuration (name, args, secret hashes);\n /// - component definition hash;\n /// - the unit\'s source hash (if applicable);\n /// - the input hashes and output hashes of all input instances.\n inputHash Int?\n\n /// The CRC32 of the SHA256 of the output produced by the instance at the moment of last operation completion.\n ///\n /// Does not depend on anything except the instance\'s output.\n outputHash Int?\n\n /// The calculated CRC32 dependency output hash at the moment of last operation completion.\n ///\n /// This hash is calculated as combination of output hashes of all input instances and nothing else.\n ///\n /// The primary use case of this hash is to "short-circuit" execution:\n /// if the outputs of input instances have not changed, dependent instances can skip execution,\n /// even if their input hashes changed due to upstream config changes.\n /// This prevents unnecessary re-execution of the entire dependency graph when only non-output-affecting inputs are modified.\n dependencyOutputHash Int?\n\n /// The mapping of instance output names to artifact IDs passed via them.\n ///\n /// Used to authorize access to artifacts for other instances connected to these outputs.\n ///\n /// [InstanceArtifactIds]\n exportedArtifactIds Json?\n\n /// The snapshot of the instance model at the moment of last non-preview operation start.\n ///\n /// Null if the instance was never operated on.\n ///\n /// [InstanceModel]\n model Json?\n\n /// The snapshot of the resolved inputs at the moment of last non-preview operation start.\n ///\n /// Null if the instance was never operated on.\n ///\n /// [InstanceResolvedInputs]\n resolvedInputs Json?\n\n /// The count of Pulumi resources currently managed by this instance.\n currentResourceCount Int?\n\n /// The status fields produced by the last operation.\n ///\n /// [InstanceStatusFields]\n statusFields Json?\n\n /// The parent instance.\n parent InstanceState? @relation("InstanceHierarchy", fields: [parentId], references: [id])\n\n /// The child instances, if any.\n children InstanceState[] @relation("InstanceHierarchy")\n\n /// The evaluation state of this instance.\n evaluationState InstanceEvaluationState?\n\n /// The operation states associated with this instance.\n operationStates InstanceOperationState[]\n\n /// The secrets associated with this instance.\n secrets Secret[]\n\n /// The terminals associated with this instance.\n terminals Terminal[]\n\n /// The pages associated with this instance.\n pages Page[]\n\n /// The triggers associated with this instance.\n triggers Trigger[]\n\n /// Custom statuses for this instance.\n customStatuses InstanceCustomStatus[]\n\n /// The lock that is currently held on this instance.\n lock InstanceLock?\n\n /// Worker registrations associated with this instance.\n workerRegistrations WorkerUnitRegistration[]\n\n /// The artifacts produced or used by this instance.\n artifacts Artifact[]\n\n /// The operation logs associated with this instance.\n operationLogs OperationLog[]\n\n /// The user viewports associated with this instance.\n userViewports UserCompositeViewport[]\n}\n\nmodel UserProjectViewport {\n /// The opaque ID of the user to which this viewport belongs.\n userId String @id\n\n /// The viewport of the user project managed by the frontend.\n viewport Json\n}\n\nmodel UserCompositeViewport {\n /// The opaque ID of the user to which this viewport belongs.\n userId String\n\n /// The ID of the state of the composite instance to which this viewport belongs.\n stateId String\n\n /// The viewport of the user composite instance managed by the frontend.\n viewport Json\n\n /// The instance state to which this viewport belongs.\n state InstanceState @relation(fields: [stateId], references: [id])\n\n @@id([userId, stateId])\n}\n\nmodel InstanceLock {\n /// The ID of the instance state being locked.\n stateId String @id\n\n /// The metadata of the lock managed by the backend.\n ///\n /// [CommonObjectMeta]\n meta Json\n\n /// The CUIDv2 token to ensure ownership of the lock.\n token String\n\n /// The time when the lock was acquired.\n acquiredAt DateTime @default(now())\n\n /// The instance being locked.\n state InstanceState @relation(fields: [stateId], references: [id])\n}\n\ndatasource db {\n provider = "sqlite"\n directUrl = env("HIGHSTATE_MIGRATION_DATABASE_URL")\n}\n\ngenerator client {\n provider = "prisma-client"\n previewFeatures = ["queryCompiler", "driverAdapters"]\n output = "../../src/database/_generated/project"\n moduleFormat = "esm"\n generatedFileExtension = "ts"\n importFileExtension = "ts"\n}\n\ngenerator json {\n provider = "prisma-json-types-generator"\n}\n\n/// The container for project instances. \n///\n/// Only used when "database" project model storage is used.\nmodel InstanceModel {\n /// The ID of the instance in the format of `{type}:{name}`.\n id String @id\n\n /// The model of the instance managed by the backend.\n ///\n /// [InstanceModel]\n model Json\n\n /// The time when the instance model was created.\n createdAt DateTime @default(now())\n\n /// The time when the instance model was last updated.\n updatedAt DateTime @updatedAt\n}\n\n/// The container for project hubs.\n///\n/// Only used when "database" project model storage is used.\nmodel HubModel {\n /// The CUIDv2 of the hub.\n id String @id\n\n /// The model of the hub managed by the backend.\n ///\n /// [HubModel]\n model Json\n\n /// The time when the hub model was created.\n createdAt DateTime @default(now())\n\n /// The time when the hub model was last updated.\n updatedAt DateTime @updatedAt\n}\n\nenum OperationStatus {\n // transient statuses\n pending\n running\n failing\n\n // stable statuses\n completed\n failed\n cancelled\n}\n\nenum OperationType {\n update\n preview\n destroy\n recreate\n refresh\n}\n\nenum InstanceOperationStatus {\n // transient statuses\n updating\n processing_triggers\n previewing\n destroying\n refreshing\n pending\n cancelling\n\n // stable statuses\n updated\n skipped\n destroyed\n refreshed\n cancelled\n failed\n}\n\nmodel Operation {\n /// The CUIDv2 of the operation.\n id String @id @default(cuid(2))\n\n /// The metadata of the operation.\n ///\n /// [OperationMeta]\n meta Json\n\n /// The type of the operation.\n type OperationType\n\n /// The status of the operation.\n status OperationStatus @default(pending)\n\n /// The options of the operation.\n ///\n /// [OperationOptions]\n options Json\n\n /// The IDs of the instances that were exlicitly requested to operate on.\n ///\n /// [InstanceIds]\n requestedInstanceIds Json\n\n /// The execution phases of the operation.\n ///\n /// [OperationPhase[]]\n phases Json?\n\n /// The time when the operation started.\n startedAt DateTime @default(now())\n\n /// The time when the operation was last updated.\n updatedAt DateTime @updatedAt\n\n /// The time when the operation finished.\n finishedAt DateTime?\n\n /// The operation states associated with this operation.\n operationStates InstanceOperationState[]\n\n /// The logs of the operation.\n logs OperationLog[]\n}\n\nmodel InstanceOperationState {\n /// The ID of the operation this state belongs to.\n operationId String\n\n /// The ID of the instance state affected by the operation.\n stateId String\n\n /// The enum representing the current status of the instance from the operation perspective.\n status InstanceOperationStatus\n\n /// The current count of the Pulumi resources being managed by this instance.\n currentResourceCount Int?\n\n /// The total count of the Pulumi resources that this instance is expected to manage.\n totalResourceCount Int?\n\n /// The snapshot of the instance model at the moment of operation start.\n ///\n /// [InstanceModel]\n model Json\n\n /// The snapshot of the resolved inputs at the moment of operation start.\n ///\n /// [InstanceResolvedInputs]\n resolvedInputs Json\n\n /// The time when the operation on this instance started.\n /// Not populated on create, even if the instance is ready to start immediately.\n startedAt DateTime?\n\n /// The time when the operation on this instance finished.\n finishedAt DateTime?\n\n /// The operation this state belongs to.\n operation Operation @relation(fields: [operationId], references: [id])\n\n /// The instance this state belongs to.\n state InstanceState @relation(fields: [stateId], references: [id])\n\n @@id([operationId, stateId])\n}\n\nmodel OperationLog {\n /// The ULID of the log. Also used to extract the timestamp.\n id String @id\n\n /// The ID of the operation this log belongs to.\n operationId String\n\n /// The ID of the instance state this log produced by.\n /// Can be `null` if the log is not associated with any instance.\n stateId String?\n\n /// The content of the log.\n content String\n\n /// The operation this log belongs to.\n operation Operation @relation(fields: [operationId], references: [id])\n\n /// The instance this log produced by.\n /// Can be `null` if the log is not associated with any instance.\n state InstanceState? @relation(fields: [stateId], references: [id])\n}\n\n/// The page provides custom UI content for instances and service accounts.\n///\n/// Pages can be created by units to display instance-specific information or by service accounts.\n/// The content consists of blocks that support markdown text, QR codes with optional content display,\n/// and file attachments (inline or artifact references). Instance pages are explicitly deleted\n/// when instances are destroyed.\nmodel Page {\n /// The CUIDv2 of the page.\n id String @id @default(cuid(2))\n\n /// The metadata of the page managed by the backend.\n ///\n /// [GlobalCommonObjectMeta]\n meta Json\n\n /// The ID of the instance state that owns this page.\n stateId String?\n\n /// The name of the page within the instance.\n /// Will be null if the page is not owned by an instance.\n name String?\n\n /// The ID of the service account that owns this page.\n serviceAccountId String?\n\n /// The content of the page as an array of blocks.\n ///\n /// Supports markdown, QR codes, and file blocks.\n ///\n /// [PageContent]\n content Json\n\n /// The time when the page was created.\n createdAt DateTime @default(now())\n\n /// The time when the page was last updated.\n updatedAt DateTime @updatedAt\n\n /// The instance this page belongs to if any.\n state InstanceState? @relation(fields: [stateId], references: [id])\n\n /// The service account this page belongs to if any. \n serviceAccount ServiceAccount? @relation(fields: [serviceAccountId], references: [id])\n\n /// The artifacts used by this page.\n artifacts Artifact[]\n\n @@unique([stateId, name]) // the name is unique within the instance\n}\n\n/// The secret stores sensitive configuration values for instances, service accounts, and system components.\n///\n/// Secrets can be instance-owned (for unit configuration), service account-owned, or system-level\n/// (like Pulumi passwords). \n///\n/// Secrets persist through normal destroy (recreate) operations\n/// and are only deleted when explicitly forgetting instance state with the deleteSecrets flag or when manually deleted.\n///\n/// Secret updates invalidate instance input hashes via inputHashNonce, triggering re-execution\n/// during operations. But the content of the secrets itself do not contribute to the input hash.\n///\n/// System secrets like Pulumi passwords are created on-demand and persist for the whole project lifetime.\nmodel Secret {\n /// The CUIDv2 of the secret.\n id String @id @default(cuid(2))\n\n /// The metadata of the secret managed by the backend.\n ///\n /// [GlobalCommonObjectMeta]\n meta Json\n\n /// The ID of the state of the instance owning this secret.\n stateId String?\n\n /// The name of the secret within the instance.\n ///\n /// Will be null if the secret is not owned by an instance.\n name String?\n\n /// The name of the secret within the project if the secret is a system secret.\n systemName String? @unique\n\n /// The ID of the service account owning this secret.\n serviceAccountId String?\n\n /// The content of the secret.\n ///\n /// ![unknown]\n content Json\n\n /// The time when the secret was created.\n createdAt DateTime @default(now())\n\n /// The time when the secret was last updated.\n updatedAt DateTime @updatedAt\n\n /// The instance this secret belongs to.\n state InstanceState? @relation(fields: [stateId], references: [id])\n\n /// The service account this secret belongs to.\n serviceAccount ServiceAccount? @relation(fields: [serviceAccountId], references: [id])\n\n @@unique([stateId, name]) // the name must be unique within the instance\n}\n\n/// The service account represents an identity for non-human actors in the system.\n///\n/// Service accounts are automatically created for workers and can be manually created\n/// for external integrations. They define the access scope for resources like artifacts,\n/// secrets, terminals, and pages. Multiple API keys can impersonate the same service account,\n/// allowing different authentication tokens to share the same permissions.\nmodel ServiceAccount {\n /// The CUIDv2 of the service account.\n id String @id @default(cuid(2))\n\n /// The metadata of the service account managed by the backend.\n ///\n /// [ServiceAccountMeta]\n meta Json\n\n /// The time when the service account was created.\n createdAt DateTime @default(now())\n\n /// The time when the service account was last updated.\n updatedAt DateTime @updatedAt\n\n /// The workers using this service account.\n workers Worker[]\n\n /// The artifacts used by this service account.\n artifacts Artifact[]\n\n /// The secrets owned by this service account.\n secrets Secret[]\n\n /// The terminals owned by this service account.\n terminals Terminal[]\n\n /// The pages owned by this service account.\n pages Page[]\n\n /// The instance custom statuses attached by this service account.\n customStatuses InstanceCustomStatus[]\n\n /// The API keys impersonating this service account.\n apiKeys ApiKey[]\n}\n\n/// The terminal status indicates whether a terminal can accept new connections.\nenum TerminalStatus {\n /// The terminal is currently active and can create new sessions.\n active\n\n /// The instance was destroyed and the terminal is no longer available, but here for historical purposes.\n unavailable\n}\n\n/// The terminal provides interactive shell access to infrastructure resources.\n///\n/// Terminals can be created by units (owned by instances) or by service accounts.\n/// Each terminal maintains a specification for creating containers that power the terminal,\n/// including image, command, environment, and mounted files.\n///\n/// Instance-owned terminals are marked unavailable when the instance is destroyed, preserving session history.\n/// Service account terminals persist independently.\nmodel Terminal {\n /// The CUIDv2 of the terminal.\n id String @id @default(cuid(2))\n\n /// The metadata of the terminal managed by the backend.\n ///\n /// [GlobalCommonObjectMeta]\n meta Json\n\n /// The status of the terminal.\n status TerminalStatus @default(active)\n\n /// The specification for creating the container that powers this terminal.\n ///\n /// Includes image, command, working directory, environment variables, and files.\n ///\n /// [TerminalSpec]\n spec Json\n\n /// The ID of the instance state owning this terminal.\n stateId String?\n\n /// The name of the terminal within the instance.\n ///\n /// Will be null if the terminal is not owned by an instance.\n name String?\n\n /// The ID of the service account owning this terminal.\n serviceAccountId String?\n\n /// The time when the terminal was created.\n createdAt DateTime @default(now())\n\n /// The time when the terminal was last updated.\n updatedAt DateTime @updatedAt\n\n /// The instance this terminal belongs to.\n state InstanceState? @relation(fields: [stateId], references: [id], onDelete: Cascade)\n\n /// The service account this terminal belongs to.\n serviceAccount ServiceAccount? @relation(fields: [serviceAccountId], references: [id], onDelete: Cascade)\n\n /// The terminal sessions associated with this terminal.\n sessions TerminalSession[]\n\n /// The artifacts used by this terminal.\n artifacts Artifact[]\n\n @@unique([stateId, name]) // the name is unique within the instance\n}\n\n/// The terminal session represents a single interactive connection to a terminal.\n///\n/// Each session tracks when it started and finished. All session output is preserved in logs.\nmodel TerminalSession {\n /// The CUIDv2 of the terminal session.\n id String @id @default(cuid(2))\n\n /// The ID of the terminal this session belongs to.\n terminalId String\n\n /// The time when the terminal session started.\n startedAt DateTime @default(now())\n\n /// The time when the terminal session finished.\n finishedAt DateTime?\n\n /// The terminal this session belongs to.\n terminal Terminal @relation(fields: [terminalId], references: [id], onDelete: Cascade)\n\n /// The logs of the terminal session.\n logs TerminalSessionLog[]\n}\n\n/// The terminal session log captures all input and output from a terminal session.\n///\n/// Logs are stored with ULID identifiers for timestamp ordering.\nmodel TerminalSessionLog {\n /// The ULID of the session log. Also used to extract the timestamp.\n id String @id\n\n /// The ID of the terminal session this log belongs to.\n sessionId String\n\n /// The content of the log.\n content String\n\n /// The terminal session this log belongs to.\n session TerminalSession @relation(fields: [sessionId], references: [id], onDelete: Cascade)\n}\n\n/// The trigger defines automated actions that execute in response to specific events.\n///\n/// Triggers are created by units to perform actions at defined points in the instance lifecycle\n/// or on schedule. The spec field determines the trigger type and behavior - currently supporting\n/// before-destroy triggers, with planned support for additional types like cron scheduling.\n/// Triggers are deleted along with their instance.\nmodel Trigger {\n /// The CUIDv2 of the trigger.\n id String @id @default(cuid(2))\n\n /// The metadata of the trigger managed by the backend.\n ///\n /// [GlobalCommonObjectMeta]\n meta Json\n\n /// The ID of the instance state this trigger belongs to.\n stateId String\n\n /// The name of the trigger within the instance.\n name String\n\n /// The specification of the trigger describing its type and behavior.\n ///\n /// [TriggerSpec]\n spec Json\n\n /// The time when the trigger was created.\n createdAt DateTime @default(now())\n\n /// The time when the trigger was last updated.\n updatedAt DateTime @updatedAt\n\n /// The instance this trigger belongs to.\n state InstanceState @relation(fields: [stateId], references: [id])\n\n @@unique([stateId, name]) // the name is unique within the instance\n}\n\n/// The unlock method type determines how users authenticate to decrypt project databases.\nenum UnlockMethodType {\n /// The password is used to unlock the project.\n password\n\n /// The passkey (via WebAuthn) is used to unlock the project.\n passkey\n}\n\n/// The unlock method enables decryption of project databases through user authentication.\n///\n/// Each project database is encrypted with a master key, which is then encrypted for each\n/// unlock method\'s recipient using AGE encryption. Users authenticate (password or passkey)\n/// to decrypt their specific AGE identity, which then decrypts the master key.\n///\n/// Multiple unlock methods can exist per project, allowing different authentication paths\n/// to the same encrypted database. When unlock methods are added/removed, the master key\n/// is re-encrypted for the new set of recipients.\n///\n/// The encryptedIdentity contains the AGE identity encrypted with the user\'s authentication\n/// method (password-derived key or WebAuthn), while the recipient is the public key\n/// corresponding to that identity.\nmodel UnlockMethod {\n /// The CUIDv2 of the unlock method.\n id String @id @default(cuid(2))\n\n /// The metadata of the unlock method managed by the backend.\n /// \n /// [UnlockMethodMeta]\n meta Json\n\n /// The type of unlock method.\n type UnlockMethodType\n\n /// The AGE identity encrypted and armored also with AGE.\n encryptedIdentity String\n\n /// The AGE recipient for this unlock method.\n recipient String\n\n /// The time when the unlock method was created.\n createdAt DateTime @default(now())\n\n /// The time when the unlock method was last updated.\n updatedAt DateTime @updatedAt\n}\n\n/// The worker represents a containerized application that extends unit capabilities beyond Pulumi execution.\n///\n/// Workers enable units to perform runtime operations after Pulumi program completion,\n/// such as attaching custom statuses, monitoring resources, or triggering unit reconfigurations.\n/// Since Pulumi programs cannot affect instances after execution, workers bypass this limitation\n/// by providing persistent runtime behavior.\n///\n/// The worker identity (fully qualified image name) indicates the same publisher/party and services as natural authentication mechanism.\n/// All versions of a worker share the same service account, meaning they operate over\n/// the same resources and have the same access scope within the platform.\nmodel Worker {\n /// The CUIDv2 of the worker.\n id String @id @default(cuid(2))\n\n /// The identity of the worker derived from the container image.\n ///\n /// This is the fully qualified image name without the tag or digest.\n /// The format is `{<registry>/}[<namespace>/]<name>`.\n ///\n /// For example: `ghcr.io/highstate/worker` or `docker.io/library/ubuntu`.\n identity String @unique\n\n /// The ID of the service account this worker uses.\n serviceAccountId String @unique\n\n /// The time this worker first appeared in the system.\n createdAt DateTime @default(now())\n\n /// The service account impersonating this worker.\n serviceAccount ServiceAccount @relation(fields: [serviceAccountId], references: [id])\n\n /// The versions of this worker.\n versions WorkerVersion[]\n}\n\nenum WorkerVersionStatus {\n /// The status is unknown.\n unknown\n\n /// The worker is being started by one of the runtimes.\n starting\n\n /// The worker is running and serving registrations.\n running\n\n /// The worker is being stopping (after was starting/running and was disabled).\n stopping\n\n /// The worker is stopped and not serving registrations.\n stopped\n\n /// The worker failed to start/crashed more than the allowed number of times.\n error\n}\n\n/// The worker version represents a specific container image digest of a worker.\n///\n/// Each version corresponds to an immutable container image identified by its SHA256 digest.\n/// Versions are automatically created when units reference new image digests and deleted\n/// when no longer referenced by any unit registrations.\n///\n/// Each version has its own API key for isolation, but all versions of a worker\n/// share the same service account and thus the same access scope within the platform.\n/// The runtime starts containers when registrations exist and stops them when removed.\nmodel WorkerVersion {\n /// The CUIDv2 of the worker version.\n id String @id @default(cuid(2))\n\n /// The metadata of the worker version managed by the backend.\n ///\n /// [CommonObjectMeta]\n meta Json\n\n /// The current status of the worker version reported by the runtime.\n status WorkerVersionStatus @default(unknown)\n\n /// Whether this worker version is enabled and will be launched when project is unclocked.\n enabled Boolean @default(true)\n\n /// The ID of the runtime where this worker version currently runs.\n runtimeId String?\n\n /// The ID of the worker this version belongs to.\n workerId String\n\n /// The digest of the worker version used to identify it.\n /// The format is raw SHA256 digest without the `sha256:` prefix.\n digest String @unique\n\n /// The ID of the API key this worker version uses.\n apiKeyId String @unique\n\n /// The time this worker version was created.\n createdAt DateTime @default(now())\n\n /// The time this worker version was last updated.\n updatedAt DateTime @updatedAt\n\n /// The worker this version belongs to.\n worker Worker @relation(fields: [workerId], references: [id])\n\n /// The API key this worker version uses.\n apiKey ApiKey @relation(fields: [apiKeyId], references: [id])\n\n /// The unit registrations for this worker version.\n unitRegistrations WorkerUnitRegistration[]\n\n /// The logs produced by this worker version.\n logs WorkerVersionLog[]\n}\n\n/// The worker unit registration tracks which unit instances require specific worker versions.\n///\n/// Units declare worker dependencies through their outputs, creating registrations that\n/// trigger the runtime to start corresponding worker containers. Each registration\n/// includes parameters passed to the worker for unit-specific configuration.\n///\n/// Registrations are managed during operation execution - created when units declare workers\n/// and removed when units are destroyed. Worker versions without registrations are garbage collected.\nmodel WorkerUnitRegistration {\n /// The ID of the state of the unit instance requesting the registration.\n stateId String\n\n /// The name of the worker within the instance.\n name String\n\n /// The parameters of the registration passed by the unit.\n ///\n /// [WorkerUnitRegistrationParams]\n params Json\n\n /// The ID of the worker version this registration currently uses.\n workerVersionId String\n\n /// The time this registration was created.\n createdAt DateTime @default(now())\n\n /// The time this registration was last updated.\n updatedAt DateTime @updatedAt\n\n /// The unit instance requesting the registration.\n state InstanceState @relation(fields: [stateId], references: [id])\n\n /// The worker version this registration currently uses.\n workerVersion WorkerVersion @relation(fields: [workerVersionId], references: [id])\n\n @@id([stateId, name]) // the registration is identified by the instance and name\n}\n\n/// The worker version log captures output from running worker containers.\n///\n/// Logs include both worker-generated output and system messages from the runtime.\n/// The ULID identifier provides timestamp ordering. Logs are deleted with the worker version.\nmodel WorkerVersionLog {\n /// The ULID of the worker log. Also used to extract the timestamp.\n id String @id @default(ulid())\n\n /// The ID of the worker version that produced this log.\n workerVersionId String\n\n /// The log content.\n content String\n\n /// Whether this log is a system/runtime message (vs worker output).\n isSystem Boolean @default(false)\n\n /// The worker version that produced this log.\n workerVersion WorkerVersion @relation(fields: [workerVersionId], references: [id], onDelete: Cascade)\n}\n',
|
|
976
|
-
"inlineSchemaHash": "
|
|
1114
|
+
"inlineSchema": '/// The API key provides authentication tokens for accessing the platform API.\n///\n/// Each API key impersonates a service account, inheriting its permissions and access scope.\n/// Keys are automatically created for worker versions and can be manually created for\n/// external integrations. The token is a 32-byte random hex string that can be regenerated.\nmodel ApiKey {\n /// The CUIDv2 of the API key.\n id String @id @default(cuid(2))\n\n /// The metadata of the API key managed by the backend.\n ///\n /// [ApiKeyMeta]\n meta Json\n\n /// The ID of the service account impersonated by this API key.\n serviceAccountId String\n\n /// The API token for authentication.\n ///\n /// Should be treated as a secret and only shown once at creation/regeneration.\n token String @unique\n\n /// The time when the API key was created.\n createdAt DateTime @default(now())\n\n /// The time when the API key was last updated.\n updatedAt DateTime @updatedAt\n\n /// The worker version that owns this API key.\n worker WorkerVersion?\n\n /// The service account which this API key impersonates.\n serviceAccount ServiceAccount @relation(fields: [serviceAccountId], references: [id])\n}\n\n/// The artifact represents a file or folder stored in the system.\n///\n/// It can be produced by units or manually uploaded via API by service accounts.\n///\n/// Since different actors can produce the same artifact with the same content and hash,\n/// there is the ownership/usage concept to track which entities produce or use the artifact.\n/// The "ownership" and "usage" are synonymous in this context and often referred to as "usage".\n///\n/// When no usages are present, the artifact will be automatically garbage collected after a certain period.\nmodel Artifact {\n /// The CUIDv2 of the artifact.\n id String @id @default(cuid(2))\n\n /// The metadata of the artifact managed by the backend.\n ///\n /// Since multiple actors can produce the same artifact,\n /// this metadata is the last one provided by any actor.\n ///\n /// [CommonObjectMeta]\n meta Json\n\n /// The SHA256 hash of the artifact content.\n hash String @unique\n\n /// The size of the compressed artifact content in bytes.\n ///\n /// Does not represent the size of the original file or folder,\n /// but the size used to store the artifact in the system.\n size Int\n\n /// The chunk size of the artifact content in bytes.\n /// Used to split the artifact into smaller chunks for storage.\n chunkSize Int\n\n /// The time when the artifact first appeared in the system.\n createdAt DateTime @default(now())\n\n /// The time when the artifact was last updated.\n updatedAt DateTime @updatedAt\n\n /// The service accounts using this artifact.\n serviceAccounts ServiceAccount[]\n\n /// The instances using this artifact.\n instances InstanceState[]\n\n /// The terminals using this artifact.\n terminals Terminal[]\n\n /// The pages using this artifact.\n pages Page[]\n}\n\nmodel InstanceCustomStatus {\n /// The ID of the instance state this status belongs to.\n stateId String\n\n /// The ID of the service account which attached this custom status.\n serviceAccountId String\n\n /// The name of the custom status unique within the instance and service account.\n name String\n\n /// The metadata of the custom status managed by the backend.\n ///\n /// [CommonObjectMeta]\n meta Json\n\n /// The status value of the custom status.\n value String\n\n /// The message describing the instance\'s custom status.\n /// \n /// Can be used to provide additional context or information about the status.\n ///\n /// The message will be displayed in the 800x600 ANSI terminal in the UI,\n /// so different TUI elements should be drawn within this area.\n message String?\n\n /// The order of the custom status in the list of statuses.\n ///\n /// Should be values from 0 to 100, where 0 is the highest priority.\n /// By default, the order is 50.\n order Int @default(50)\n\n /// The time when the custom status was first attached to the instance.\n createdAt DateTime @default(now())\n\n /// The time when the custom status was last updated.\n updatedAt DateTime @updatedAt\n\n /// The instance this custom status belongs to.\n state InstanceState @relation(fields: [stateId], references: [id])\n\n /// The service account this custom status belongs to.\n serviceAccount ServiceAccount @relation(fields: [serviceAccountId], references: [id])\n\n @@id([stateId, serviceAccountId, name]) // the name must be unique within the instance and service account\n}\n\nenum InstanceEvaluationStatus {\n /// transient statuses (not persisted in the database)\n evaluating\n\n /// stable statuses\n evaluated\n error\n}\n\n/// The evaluation state tracks the result of evaluating composite instances to produce virtual instances.\n///\n/// Composite instances are template components that generate other instances (virtual instances) when evaluated.\n/// The evaluation process executes the composite\'s create function with resolved inputs to produce a tree\n/// of child instances. These virtual instances exist in the source "virtual" state and can be units\n/// (mapping to Pulumi resources) or other composites (producing more virtual instances recursively).\n///\n/// Evaluation happens automatically after project unlock and library reloads to keep virtual instances\n/// synchronized with their composite definitions. Evaluation state persists the produced instance model\n/// and tracks success/error status with descriptive messages showing the instance tree or error details.\nmodel InstanceEvaluationState {\n /// The ID of the state of the instance.\n stateId String @id\n\n /// The status of the instance evaluation.\n status InstanceEvaluationStatus\n\n /// The message describing the evaluation status.\n /// If the evaluation is failed, this message will contain the error description.\n message String?\n\n /// The model produced by the evaluation.\n ///\n /// Will be `null` if the evaluation is failed.\n ///\n /// Can be set for both: real composite instances and virtual instances produced by the evaluation.\n ///\n /// [InstanceModel]\n model Json?\n\n /// The time when the last evaluation was finished.\n evaluatedAt DateTime @updatedAt\n\n /// The instance this state belongs to.\n state InstanceState @relation(fields: [stateId], references: [id])\n}\n\nenum InstanceStatus {\n /// The instance is exists in the model (resident or virtual), but not yet deployed or was completely destroyed.\n ///\n /// "attempted", "deployed" and "failed" instances can be transitioned back to "undeployed" after\n /// successful "destroy" operation.\n undeployed\n\n /// The instance is attempted, but not yet fully deployed.\n ///\n /// Normally, this status is very short-lived, and here to indicate that the instance\n /// cannot be safely deleted from the the model until it will be completely destroyed.\n attempted\n\n /// The initial deployment of the instance was successful.\n ///\n /// The transition of "deployed -> failed" is not possible, so consequent failed operations\n /// will not affect this status.\n ///\n /// Like "attempted", that instance cannot be safely deleted from the model until it will be completely destroyed.\n deployed\n\n /// The initial deployment of the instance failed.\n /// It can still be transitioned to "deployed" by a successful operation\n ///\n /// Like "attempted", that instance cannot be safely deleted from the model until it will be completely destroyed.\n failed\n}\n\nenum InstanceSource {\n /// The instance is defined in the project model.\n resident\n\n /// The instance is produced by evaluation of composite instance.\n virtual\n}\n\nmodel InstanceState {\n /// The surrogate CUIDv2 primary key of the instance to allow renaming instances.\n id String @id @default(cuid(2))\n\n /// The ID of the instance managed by the system.\n ///\n /// [InstanceId]\n instanceId String @unique\n\n /// The status of the instance.\n status InstanceStatus\n\n /// The source of the instance.\n source InstanceSource\n\n /// The kind of the instance.\n ///\n /// [InstanceKind]\n kind String\n\n /// The ID of the parent instance state, if this instance is a child of another composite instance.\n parentId String?\n\n /// The 32-bit nonce used to invalidate the input hash when secrets are updated.\n inputHashNonce Int?\n\n /// The calculated instance CRC32 input hash at the moment of last operation completion.\n ///\n /// This hash covers:\n /// - the instance\'s configuration (name, args, secret hashes);\n /// - component definition hash;\n /// - the unit\'s source hash (if applicable);\n /// - the input hashes and output hashes of all input instances.\n inputHash Int?\n\n /// The CRC32 of the SHA256 of the output produced by the instance at the moment of last operation completion.\n ///\n /// Does not depend on anything except the instance\'s output.\n outputHash Int?\n\n /// The calculated CRC32 dependency output hash at the moment of last operation completion.\n ///\n /// This hash is calculated as combination of output hashes of all input instances and nothing else.\n ///\n /// The primary use case of this hash is to "short-circuit" execution:\n /// if the outputs of input instances have not changed, dependent instances can skip execution,\n /// even if their input hashes changed due to upstream config changes.\n /// This prevents unnecessary re-execution of the entire dependency graph when only non-output-affecting inputs are modified.\n dependencyOutputHash Int?\n\n /// The mapping of instance output names to artifact IDs passed via them.\n ///\n /// Used to authorize access to artifacts for other instances connected to these outputs.\n ///\n /// [InstanceArtifactIds]\n exportedArtifactIds Json?\n\n /// The snapshot of the instance model at the moment of last non-preview operation start.\n ///\n /// Null if the instance was never operated on.\n ///\n /// [InstanceModel]\n model Json?\n\n /// The snapshot of the resolved inputs at the moment of last non-preview operation start.\n ///\n /// Null if the instance was never operated on.\n ///\n /// [InstanceResolvedInputs]\n resolvedInputs Json?\n\n /// The count of Pulumi resources currently managed by this instance.\n currentResourceCount Int?\n\n /// The status fields produced by the last operation.\n ///\n /// [InstanceStatusFields]\n statusFields Json?\n\n /// The parent instance.\n parent InstanceState? @relation("InstanceHierarchy", fields: [parentId], references: [id])\n\n /// The child instances, if any.\n children InstanceState[] @relation("InstanceHierarchy")\n\n /// The evaluation state of this instance.\n evaluationState InstanceEvaluationState?\n\n /// The operation states associated with this instance.\n operationStates InstanceOperationState[]\n\n /// The secrets associated with this instance.\n secrets Secret[]\n\n /// The terminals associated with this instance.\n terminals Terminal[]\n\n /// The pages associated with this instance.\n pages Page[]\n\n /// The triggers associated with this instance.\n triggers Trigger[]\n\n /// Custom statuses for this instance.\n customStatuses InstanceCustomStatus[]\n\n /// The lock that is currently held on this instance.\n lock InstanceLock?\n\n /// Worker registrations associated with this instance.\n workerRegistrations WorkerUnitRegistration[]\n\n /// The artifacts produced or used by this instance.\n artifacts Artifact[]\n\n /// The operation logs associated with this instance.\n operationLogs OperationLog[]\n\n /// The user viewports associated with this instance.\n userViewports UserCompositeViewport[]\n}\n\nmodel UserProjectViewport {\n /// The opaque ID of the user to which this viewport belongs.\n userId String @id\n\n /// The viewport of the user project managed by the frontend.\n ///\n /// ![unknown]\n viewport Json\n}\n\nmodel UserCompositeViewport {\n /// The opaque ID of the user to which this viewport belongs.\n userId String\n\n /// The ID of the state of the composite instance to which this viewport belongs.\n stateId String\n\n /// The viewport of the user composite instance managed by the frontend.\n ///\n /// ![unknown]\n viewport Json\n\n /// The instance state to which this viewport belongs.\n state InstanceState @relation(fields: [stateId], references: [id])\n\n @@id([userId, stateId])\n}\n\nmodel InstanceLock {\n /// The ID of the instance state being locked.\n stateId String @id\n\n /// The metadata of the lock managed by the backend.\n ///\n /// [CommonObjectMeta]\n meta Json\n\n /// The CUIDv2 token to ensure ownership of the lock.\n token String\n\n /// The time when the lock was acquired.\n acquiredAt DateTime @default(now())\n\n /// The instance being locked.\n state InstanceState @relation(fields: [stateId], references: [id])\n}\n\ndatasource db {\n provider = "sqlite"\n url = env("HIGHSTATE_MIGRATION_DATABASE_URL")\n}\n\ngenerator client {\n provider = "prisma-client"\n previewFeatures = ["queryCompiler", "driverAdapters"]\n output = "../../src/database/_generated/project"\n moduleFormat = "esm"\n generatedFileExtension = "ts"\n importFileExtension = "ts"\n}\n\ngenerator json {\n provider = "prisma-json-types-generator"\n}\n\n/// The container for project instances. \n///\n/// Only used when "database" project model storage is used.\nmodel InstanceModel {\n /// The ID of the instance in the format of `{type}:{name}`.\n id String @id\n\n /// The model of the instance managed by the backend.\n ///\n /// [InstanceModel]\n model Json\n\n /// The time when the instance model was created.\n createdAt DateTime @default(now())\n\n /// The time when the instance model was last updated.\n updatedAt DateTime @updatedAt\n}\n\n/// The container for project hubs.\n///\n/// Only used when "database" project model storage is used.\nmodel HubModel {\n /// The CUIDv2 of the hub.\n id String @id\n\n /// The model of the hub managed by the backend.\n ///\n /// [HubModel]\n model Json\n\n /// The time when the hub model was created.\n createdAt DateTime @default(now())\n\n /// The time when the hub model was last updated.\n updatedAt DateTime @updatedAt\n}\n\nenum OperationStatus {\n // transient statuses\n pending\n running\n failing\n\n // stable statuses\n completed\n failed\n cancelled\n}\n\nenum OperationType {\n update\n preview\n destroy\n recreate\n refresh\n}\n\nenum InstanceOperationStatus {\n // transient statuses\n updating\n processing_triggers\n previewing\n destroying\n refreshing\n pending\n cancelling\n\n // stable statuses\n updated\n skipped\n destroyed\n refreshed\n cancelled\n failed\n}\n\nmodel Operation {\n /// The CUIDv2 of the operation.\n id String @id @default(cuid(2))\n\n /// The metadata of the operation.\n ///\n /// [OperationMeta]\n meta Json\n\n /// The type of the operation.\n type OperationType\n\n /// The status of the operation.\n status OperationStatus @default(pending)\n\n /// The options of the operation.\n ///\n /// [OperationOptions]\n options Json\n\n /// The IDs of the instances that were exlicitly requested to operate on.\n ///\n /// [InstanceIds]\n requestedInstanceIds Json\n\n /// The execution phases of the operation.\n ///\n /// [OperationPhase[]]\n phases Json?\n\n /// The time when the operation started.\n startedAt DateTime @default(now())\n\n /// The time when the operation was last updated.\n updatedAt DateTime @updatedAt\n\n /// The time when the operation finished.\n finishedAt DateTime?\n\n /// The operation states associated with this operation.\n operationStates InstanceOperationState[]\n\n /// The logs of the operation.\n logs OperationLog[]\n}\n\nmodel InstanceOperationState {\n /// The ID of the operation this state belongs to.\n operationId String\n\n /// The ID of the instance state affected by the operation.\n stateId String\n\n /// The enum representing the current status of the instance from the operation perspective.\n status InstanceOperationStatus\n\n /// The current count of the Pulumi resources being managed by this instance.\n currentResourceCount Int?\n\n /// The total count of the Pulumi resources that this instance is expected to manage.\n totalResourceCount Int?\n\n /// The snapshot of the instance model at the moment of operation start.\n ///\n /// [InstanceModel]\n model Json\n\n /// The snapshot of the resolved inputs at the moment of operation start.\n ///\n /// [InstanceResolvedInputs]\n resolvedInputs Json\n\n /// The time when the operation on this instance started.\n /// Not populated on create, even if the instance is ready to start immediately.\n startedAt DateTime?\n\n /// The time when the operation on this instance finished.\n finishedAt DateTime?\n\n /// The operation this state belongs to.\n operation Operation @relation(fields: [operationId], references: [id])\n\n /// The instance this state belongs to.\n state InstanceState @relation(fields: [stateId], references: [id])\n\n @@id([operationId, stateId])\n}\n\nmodel OperationLog {\n /// The ULID of the log. Also used to extract the timestamp.\n id String @id\n\n /// The ID of the operation this log belongs to.\n operationId String\n\n /// The ID of the instance state this log produced by.\n /// Can be `null` if the log is not associated with any instance.\n stateId String?\n\n /// Whether this log is a system/runtime message (vs unit output).\n isSystem Boolean @default(false)\n\n /// The content of the log.\n content String\n\n /// The operation this log belongs to.\n operation Operation @relation(fields: [operationId], references: [id])\n\n /// The instance this log produced by.\n /// Can be `null` if the log is not associated with any instance.\n state InstanceState? @relation(fields: [stateId], references: [id])\n}\n\n/// The page provides custom UI content for instances and service accounts.\n///\n/// Pages can be created by units to display instance-specific information or by service accounts.\n/// The content consists of blocks that support markdown text, QR codes with optional content display,\n/// and file attachments (inline or artifact references). Instance pages are explicitly deleted\n/// when instances are destroyed.\nmodel Page {\n /// The CUIDv2 of the page.\n id String @id @default(cuid(2))\n\n /// The metadata of the page managed by the backend.\n ///\n /// [GlobalCommonObjectMeta]\n meta Json\n\n /// The ID of the instance state that owns this page.\n stateId String?\n\n /// The name of the page within the instance.\n /// Will be null if the page is not owned by an instance.\n name String?\n\n /// The ID of the service account that owns this page.\n serviceAccountId String?\n\n /// The content of the page as an array of blocks.\n ///\n /// Supports markdown, QR codes, and file blocks.\n ///\n /// [PageContent]\n content Json\n\n /// The time when the page was created.\n createdAt DateTime @default(now())\n\n /// The time when the page was last updated.\n updatedAt DateTime @updatedAt\n\n /// The instance this page belongs to if any.\n state InstanceState? @relation(fields: [stateId], references: [id])\n\n /// The service account this page belongs to if any. \n serviceAccount ServiceAccount? @relation(fields: [serviceAccountId], references: [id])\n\n /// The artifacts used by this page.\n artifacts Artifact[]\n\n @@unique([stateId, name]) // the name is unique within the instance\n}\n\n/// The secret stores sensitive configuration values for instances, service accounts, and system components.\n///\n/// Secrets can be instance-owned (for unit configuration), service account-owned, or system-level\n/// (like Pulumi passwords). \n///\n/// Secrets persist through normal destroy (recreate) operations\n/// and are only deleted when explicitly forgetting instance state with the deleteSecrets flag or when manually deleted.\n///\n/// Secret updates invalidate instance input hashes via inputHashNonce, triggering re-execution\n/// during operations. But the content of the secrets itself do not contribute to the input hash.\n///\n/// System secrets like Pulumi passwords are created on-demand and persist for the whole project lifetime.\nmodel Secret {\n /// The CUIDv2 of the secret.\n id String @id @default(cuid(2))\n\n /// The metadata of the secret managed by the backend.\n ///\n /// [GlobalCommonObjectMeta]\n meta Json\n\n /// The ID of the state of the instance owning this secret.\n stateId String?\n\n /// The name of the secret within the instance.\n ///\n /// Will be null if the secret is not owned by an instance.\n name String?\n\n /// The name of the secret within the project if the secret is a system secret.\n systemName String? @unique\n\n /// The ID of the service account owning this secret.\n serviceAccountId String?\n\n /// The content of the secret.\n ///\n /// ![unknown]\n content Json\n\n /// The time when the secret was created.\n createdAt DateTime @default(now())\n\n /// The time when the secret was last updated.\n updatedAt DateTime @updatedAt\n\n /// The instance this secret belongs to.\n state InstanceState? @relation(fields: [stateId], references: [id])\n\n /// The service account this secret belongs to.\n serviceAccount ServiceAccount? @relation(fields: [serviceAccountId], references: [id])\n\n @@unique([stateId, name]) // the name must be unique within the instance\n}\n\n/// The service account represents an identity for non-human actors in the system.\n///\n/// Service accounts are automatically created for workers and can be manually created\n/// for external integrations. They define the access scope for resources like artifacts,\n/// secrets, terminals, and pages. Multiple API keys can impersonate the same service account,\n/// allowing different authentication tokens to share the same permissions.\nmodel ServiceAccount {\n /// The CUIDv2 of the service account.\n id String @id @default(cuid(2))\n\n /// The metadata of the service account managed by the backend.\n ///\n /// [ServiceAccountMeta]\n meta Json\n\n /// The time when the service account was created.\n createdAt DateTime @default(now())\n\n /// The time when the service account was last updated.\n updatedAt DateTime @updatedAt\n\n /// The workers using this service account.\n workers Worker[]\n\n /// The artifacts used by this service account.\n artifacts Artifact[]\n\n /// The secrets owned by this service account.\n secrets Secret[]\n\n /// The terminals owned by this service account.\n terminals Terminal[]\n\n /// The pages owned by this service account.\n pages Page[]\n\n /// The instance custom statuses attached by this service account.\n customStatuses InstanceCustomStatus[]\n\n /// The API keys impersonating this service account.\n apiKeys ApiKey[]\n}\n\n/// The terminal status indicates whether a terminal can accept new connections.\nenum TerminalStatus {\n /// The terminal is currently active and can create new sessions.\n active\n\n /// The instance was destroyed and the terminal is no longer available, but here for historical purposes.\n unavailable\n}\n\n/// The terminal provides interactive shell access to infrastructure resources.\n///\n/// Terminals can be created by units (owned by instances) or by service accounts.\n/// Each terminal maintains a specification for creating containers that power the terminal,\n/// including image, command, environment, and mounted files.\n///\n/// Instance-owned terminals are marked unavailable when the instance is destroyed, preserving session history.\n/// Service account terminals persist independently.\nmodel Terminal {\n /// The CUIDv2 of the terminal.\n id String @id @default(cuid(2))\n\n /// The metadata of the terminal managed by the backend.\n ///\n /// [GlobalCommonObjectMeta]\n meta Json\n\n /// The status of the terminal.\n status TerminalStatus @default(active)\n\n /// The specification for creating the container that powers this terminal.\n ///\n /// Includes image, command, working directory, environment variables, and files.\n ///\n /// [TerminalSpec]\n spec Json\n\n /// The ID of the instance state owning this terminal.\n stateId String?\n\n /// The name of the terminal within the instance.\n ///\n /// Will be null if the terminal is not owned by an instance.\n name String?\n\n /// The ID of the service account owning this terminal.\n serviceAccountId String?\n\n /// The time when the terminal was created.\n createdAt DateTime @default(now())\n\n /// The time when the terminal was last updated.\n updatedAt DateTime @updatedAt\n\n /// The instance this terminal belongs to.\n state InstanceState? @relation(fields: [stateId], references: [id])\n\n /// The service account this terminal belongs to.\n serviceAccount ServiceAccount? @relation(fields: [serviceAccountId], references: [id])\n\n /// The terminal sessions associated with this terminal.\n sessions TerminalSession[]\n\n /// The artifacts used by this terminal.\n artifacts Artifact[]\n\n @@unique([stateId, name]) // the name is unique within the instance\n}\n\n/// The terminal session represents a single interactive connection to a terminal.\n///\n/// Each session tracks when it started and finished. All session output is preserved in logs.\nmodel TerminalSession {\n /// The CUIDv2 of the terminal session.\n id String @id @default(cuid(2))\n\n /// The ID of the terminal this session belongs to.\n terminalId String\n\n /// The time when the terminal session started.\n startedAt DateTime @default(now())\n\n /// The time when the terminal session finished.\n finishedAt DateTime?\n\n /// The terminal this session belongs to.\n terminal Terminal @relation(fields: [terminalId], references: [id], onDelete: Cascade)\n\n /// The logs of the terminal session.\n logs TerminalSessionLog[]\n}\n\n/// The terminal session log captures all input and output from a terminal session.\n///\n/// Logs are stored with ULID identifiers for timestamp ordering.\nmodel TerminalSessionLog {\n /// The ULID of the session log. Also used to extract the timestamp.\n id String @id\n\n /// The ID of the terminal session this log belongs to.\n sessionId String\n\n /// The content of the log.\n content String\n\n /// The terminal session this log belongs to.\n session TerminalSession @relation(fields: [sessionId], references: [id], onDelete: Cascade)\n}\n\n/// The trigger defines automated actions that execute in response to specific events.\n///\n/// Triggers are created by units to perform actions at defined points in the instance lifecycle\n/// or on schedule. The spec field determines the trigger type and behavior - currently supporting\n/// before-destroy triggers, with planned support for additional types like cron scheduling.\n/// Triggers are deleted along with their instance.\nmodel Trigger {\n /// The CUIDv2 of the trigger.\n id String @id @default(cuid(2))\n\n /// The metadata of the trigger managed by the backend.\n ///\n /// [GlobalCommonObjectMeta]\n meta Json\n\n /// The ID of the instance state this trigger belongs to.\n stateId String\n\n /// The name of the trigger within the instance.\n name String\n\n /// The specification of the trigger describing its type and behavior.\n ///\n /// [TriggerSpec]\n spec Json\n\n /// The time when the trigger was created.\n createdAt DateTime @default(now())\n\n /// The time when the trigger was last updated.\n updatedAt DateTime @updatedAt\n\n /// The instance this trigger belongs to.\n state InstanceState @relation(fields: [stateId], references: [id])\n\n @@unique([stateId, name]) // the name is unique within the instance\n}\n\n/// The unlock method type determines how users authenticate to decrypt project databases.\nenum UnlockMethodType {\n /// The password is used to unlock the project.\n password\n\n /// The passkey (via WebAuthn) is used to unlock the project.\n passkey\n}\n\n/// The unlock method enables decryption of project databases through user authentication.\n///\n/// Each project database is encrypted with a master key, which is then encrypted for each\n/// unlock method\'s recipient using AGE encryption. Users authenticate (password or passkey)\n/// to decrypt their specific AGE identity, which then decrypts the master key.\n///\n/// Multiple unlock methods can exist per project, allowing different authentication paths\n/// to the same encrypted database. When unlock methods are added/removed, the master key\n/// is re-encrypted for the new set of recipients.\n///\n/// The encryptedIdentity contains the AGE identity encrypted with the user\'s authentication\n/// method (password-derived key or WebAuthn), while the recipient is the public key\n/// corresponding to that identity.\nmodel UnlockMethod {\n /// The CUIDv2 of the unlock method.\n id String @id @default(cuid(2))\n\n /// The metadata of the unlock method managed by the backend.\n /// \n /// [UnlockMethodMeta]\n meta Json\n\n /// The type of unlock method.\n type UnlockMethodType\n\n /// The AGE identity encrypted and armored also with AGE.\n encryptedIdentity String\n\n /// The AGE recipient for this unlock method.\n recipient String @unique\n\n /// The time when the unlock method was created.\n createdAt DateTime @default(now())\n\n /// The time when the unlock method was last updated.\n updatedAt DateTime @updatedAt\n}\n\n/// The worker represents a containerized application that extends unit capabilities beyond Pulumi execution.\n///\n/// Workers enable units to perform runtime operations after Pulumi program completion,\n/// such as attaching custom statuses, monitoring resources, or triggering unit reconfigurations.\n/// Since Pulumi programs cannot affect instances after execution, workers bypass this limitation\n/// by providing persistent runtime behavior.\n///\n/// The worker identity (fully qualified image name) indicates the same publisher/party and services as natural authentication mechanism.\n/// All versions of a worker share the same service account, meaning they operate over\n/// the same resources and have the same access scope within the platform.\nmodel Worker {\n /// The CUIDv2 of the worker.\n id String @id @default(cuid(2))\n\n /// The identity of the worker derived from the container image.\n ///\n /// This is the fully qualified image name without the tag or digest.\n /// The format is `{<registry>/}[<namespace>/]<name>`.\n ///\n /// For example: `ghcr.io/highstate/worker` or `docker.io/library/ubuntu`.\n identity String @unique\n\n /// The ID of the service account this worker uses.\n serviceAccountId String @unique\n\n /// The time this worker first appeared in the system.\n createdAt DateTime @default(now())\n\n /// The service account impersonating this worker.\n serviceAccount ServiceAccount @relation(fields: [serviceAccountId], references: [id])\n\n /// The versions of this worker.\n versions WorkerVersion[]\n}\n\nenum WorkerVersionStatus {\n /// The status is unknown.\n unknown\n\n /// The worker is being started by one of the runtimes.\n starting\n\n /// The worker is running and serving registrations.\n running\n\n /// The worker is being stopping (after was starting/running and was disabled).\n stopping\n\n /// The worker is stopped and not serving registrations.\n stopped\n\n /// The worker failed to start/crashed more than the allowed number of times.\n error\n}\n\n/// The worker version represents a specific container image digest of a worker.\n///\n/// Each version corresponds to an immutable container image identified by its SHA256 digest.\n/// Versions are automatically created when units reference new image digests and deleted\n/// when no longer referenced by any unit registrations.\n///\n/// Each version has its own API key for isolation, but all versions of a worker\n/// share the same service account and thus the same access scope within the platform.\n/// The runtime starts containers when registrations exist and stops them when removed.\nmodel WorkerVersion {\n /// The CUIDv2 of the worker version.\n id String @id @default(cuid(2))\n\n /// The metadata of the worker version managed by the backend.\n ///\n /// [CommonObjectMeta]\n meta Json\n\n /// The current status of the worker version reported by the runtime.\n status WorkerVersionStatus @default(unknown)\n\n /// Whether this worker version is enabled and will be launched when project is unclocked.\n enabled Boolean @default(true)\n\n /// The ID of the runtime where this worker version currently runs.\n runtimeId String?\n\n /// The ID of the worker this version belongs to.\n workerId String\n\n /// The digest of the worker version used to identify it.\n /// The format is raw SHA256 digest without the `sha256:` prefix in lowercase hex.\n digest String @unique\n\n /// The ID of the API key this worker version uses.\n apiKeyId String @unique\n\n /// The time this worker version was created.\n createdAt DateTime @default(now())\n\n /// The time this worker version was last updated.\n updatedAt DateTime @updatedAt\n\n /// The worker this version belongs to.\n worker Worker @relation(fields: [workerId], references: [id])\n\n /// The API key this worker version uses.\n apiKey ApiKey @relation(fields: [apiKeyId], references: [id])\n\n /// The unit registrations for this worker version.\n unitRegistrations WorkerUnitRegistration[]\n\n /// The logs produced by this worker version.\n logs WorkerVersionLog[]\n}\n\n/// The worker unit registration tracks which unit instances require specific worker versions.\n///\n/// Units declare worker dependencies through their outputs, creating registrations that\n/// trigger the runtime to start corresponding worker containers. Each registration\n/// includes parameters passed to the worker for unit-specific configuration.\n///\n/// Registrations are managed during operation execution - created when units declare workers\n/// and removed when units are destroyed. Worker versions without registrations are garbage collected.\nmodel WorkerUnitRegistration {\n /// The ID of the state of the unit instance requesting the registration.\n stateId String\n\n /// The name of the worker within the instance.\n name String\n\n /// The parameters of the registration passed by the unit.\n ///\n /// [WorkerUnitRegistrationParams]\n params Json\n\n /// The ID of the worker version this registration currently uses.\n workerVersionId String\n\n /// The time this registration was created.\n createdAt DateTime @default(now())\n\n /// The time this registration was last updated.\n updatedAt DateTime @updatedAt\n\n /// The unit instance requesting the registration.\n state InstanceState @relation(fields: [stateId], references: [id])\n\n /// The worker version this registration currently uses.\n workerVersion WorkerVersion @relation(fields: [workerVersionId], references: [id])\n\n @@id([stateId, name]) // the registration is identified by the instance and name\n}\n\n/// The worker version log captures output from running worker containers.\n///\n/// Logs include both worker-generated output and system messages from the runtime.\n/// The ULID identifier provides timestamp ordering. Logs are deleted with the worker version.\nmodel WorkerVersionLog {\n /// The ULID of the worker log. Also used to extract the timestamp.\n id String @id @default(ulid())\n\n /// The ID of the worker version that produced this log.\n workerVersionId String\n\n /// The log content.\n content String\n\n /// Whether this log is a system/runtime message (vs worker output).\n isSystem Boolean @default(false)\n\n /// The worker version that produced this log.\n workerVersion WorkerVersion @relation(fields: [workerVersionId], references: [id], onDelete: Cascade)\n}\n',
|
|
1115
|
+
"inlineSchemaHash": "2f2d2f1d9d315d96cd45552d603253449153e87ea24beb37eb23c907adc6e73d",
|
|
977
1116
|
"copyEngine": true,
|
|
978
1117
|
"runtimeDataModel": {
|
|
979
1118
|
"models": {},
|
|
@@ -982,7 +1121,7 @@ var config3 = {
|
|
|
982
1121
|
},
|
|
983
1122
|
"dirname": ""
|
|
984
1123
|
};
|
|
985
|
-
config3.runtimeDataModel = JSON.parse('{"models":{"ApiKey":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"meta","kind":"scalar","type":"Json"},{"name":"serviceAccountId","kind":"scalar","type":"String"},{"name":"token","kind":"scalar","type":"String"},{"name":"createdAt","kind":"scalar","type":"DateTime"},{"name":"updatedAt","kind":"scalar","type":"DateTime"},{"name":"worker","kind":"object","type":"WorkerVersion","relationName":"ApiKeyToWorkerVersion"},{"name":"serviceAccount","kind":"object","type":"ServiceAccount","relationName":"ApiKeyToServiceAccount"}],"dbName":null},"Artifact":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"meta","kind":"scalar","type":"Json"},{"name":"hash","kind":"scalar","type":"String"},{"name":"size","kind":"scalar","type":"Int"},{"name":"chunkSize","kind":"scalar","type":"Int"},{"name":"createdAt","kind":"scalar","type":"DateTime"},{"name":"updatedAt","kind":"scalar","type":"DateTime"},{"name":"serviceAccounts","kind":"object","type":"ServiceAccount","relationName":"ArtifactToServiceAccount"},{"name":"instances","kind":"object","type":"InstanceState","relationName":"ArtifactToInstanceState"},{"name":"terminals","kind":"object","type":"Terminal","relationName":"ArtifactToTerminal"},{"name":"pages","kind":"object","type":"Page","relationName":"ArtifactToPage"}],"dbName":null},"InstanceCustomStatus":{"fields":[{"name":"stateId","kind":"scalar","type":"String"},{"name":"serviceAccountId","kind":"scalar","type":"String"},{"name":"name","kind":"scalar","type":"String"},{"name":"meta","kind":"scalar","type":"Json"},{"name":"value","kind":"scalar","type":"String"},{"name":"message","kind":"scalar","type":"String"},{"name":"order","kind":"scalar","type":"Int"},{"name":"createdAt","kind":"scalar","type":"DateTime"},{"name":"updatedAt","kind":"scalar","type":"DateTime"},{"name":"state","kind":"object","type":"InstanceState","relationName":"InstanceCustomStatusToInstanceState"},{"name":"serviceAccount","kind":"object","type":"ServiceAccount","relationName":"InstanceCustomStatusToServiceAccount"}],"dbName":null},"InstanceEvaluationState":{"fields":[{"name":"stateId","kind":"scalar","type":"String"},{"name":"status","kind":"enum","type":"InstanceEvaluationStatus"},{"name":"message","kind":"scalar","type":"String"},{"name":"model","kind":"scalar","type":"Json"},{"name":"evaluatedAt","kind":"scalar","type":"DateTime"},{"name":"state","kind":"object","type":"InstanceState","relationName":"InstanceEvaluationStateToInstanceState"}],"dbName":null},"InstanceState":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"instanceId","kind":"scalar","type":"String"},{"name":"status","kind":"enum","type":"InstanceStatus"},{"name":"source","kind":"enum","type":"InstanceSource"},{"name":"kind","kind":"scalar","type":"String"},{"name":"parentId","kind":"scalar","type":"String"},{"name":"inputHashNonce","kind":"scalar","type":"Int"},{"name":"inputHash","kind":"scalar","type":"Int"},{"name":"outputHash","kind":"scalar","type":"Int"},{"name":"dependencyOutputHash","kind":"scalar","type":"Int"},{"name":"exportedArtifactIds","kind":"scalar","type":"Json"},{"name":"model","kind":"scalar","type":"Json"},{"name":"resolvedInputs","kind":"scalar","type":"Json"},{"name":"currentResourceCount","kind":"scalar","type":"Int"},{"name":"statusFields","kind":"scalar","type":"Json"},{"name":"parent","kind":"object","type":"InstanceState","relationName":"InstanceHierarchy"},{"name":"children","kind":"object","type":"InstanceState","relationName":"InstanceHierarchy"},{"name":"evaluationState","kind":"object","type":"InstanceEvaluationState","relationName":"InstanceEvaluationStateToInstanceState"},{"name":"operationStates","kind":"object","type":"InstanceOperationState","relationName":"InstanceOperationStateToInstanceState"},{"name":"secrets","kind":"object","type":"Secret","relationName":"InstanceStateToSecret"},{"name":"terminals","kind":"object","type":"Terminal","relationName":"InstanceStateToTerminal"},{"name":"pages","kind":"object","type":"Page","relationName":"InstanceStateToPage"},{"name":"triggers","kind":"object","type":"Trigger","relationName":"InstanceStateToTrigger"},{"name":"customStatuses","kind":"object","type":"InstanceCustomStatus","relationName":"InstanceCustomStatusToInstanceState"},{"name":"lock","kind":"object","type":"InstanceLock","relationName":"InstanceLockToInstanceState"},{"name":"workerRegistrations","kind":"object","type":"WorkerUnitRegistration","relationName":"InstanceStateToWorkerUnitRegistration"},{"name":"artifacts","kind":"object","type":"Artifact","relationName":"ArtifactToInstanceState"},{"name":"operationLogs","kind":"object","type":"OperationLog","relationName":"InstanceStateToOperationLog"},{"name":"userViewports","kind":"object","type":"UserCompositeViewport","relationName":"InstanceStateToUserCompositeViewport"}],"dbName":null},"UserProjectViewport":{"fields":[{"name":"userId","kind":"scalar","type":"String"},{"name":"viewport","kind":"scalar","type":"Json"}],"dbName":null},"UserCompositeViewport":{"fields":[{"name":"userId","kind":"scalar","type":"String"},{"name":"stateId","kind":"scalar","type":"String"},{"name":"viewport","kind":"scalar","type":"Json"},{"name":"state","kind":"object","type":"InstanceState","relationName":"InstanceStateToUserCompositeViewport"}],"dbName":null},"InstanceLock":{"fields":[{"name":"stateId","kind":"scalar","type":"String"},{"name":"meta","kind":"scalar","type":"Json"},{"name":"token","kind":"scalar","type":"String"},{"name":"acquiredAt","kind":"scalar","type":"DateTime"},{"name":"state","kind":"object","type":"InstanceState","relationName":"InstanceLockToInstanceState"}],"dbName":null},"InstanceModel":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"model","kind":"scalar","type":"Json"},{"name":"createdAt","kind":"scalar","type":"DateTime"},{"name":"updatedAt","kind":"scalar","type":"DateTime"}],"dbName":null},"HubModel":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"model","kind":"scalar","type":"Json"},{"name":"createdAt","kind":"scalar","type":"DateTime"},{"name":"updatedAt","kind":"scalar","type":"DateTime"}],"dbName":null},"Operation":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"meta","kind":"scalar","type":"Json"},{"name":"type","kind":"enum","type":"OperationType"},{"name":"status","kind":"enum","type":"OperationStatus"},{"name":"options","kind":"scalar","type":"Json"},{"name":"requestedInstanceIds","kind":"scalar","type":"Json"},{"name":"phases","kind":"scalar","type":"Json"},{"name":"startedAt","kind":"scalar","type":"DateTime"},{"name":"updatedAt","kind":"scalar","type":"DateTime"},{"name":"finishedAt","kind":"scalar","type":"DateTime"},{"name":"operationStates","kind":"object","type":"InstanceOperationState","relationName":"InstanceOperationStateToOperation"},{"name":"logs","kind":"object","type":"OperationLog","relationName":"OperationToOperationLog"}],"dbName":null},"InstanceOperationState":{"fields":[{"name":"operationId","kind":"scalar","type":"String"},{"name":"stateId","kind":"scalar","type":"String"},{"name":"status","kind":"enum","type":"InstanceOperationStatus"},{"name":"currentResourceCount","kind":"scalar","type":"Int"},{"name":"totalResourceCount","kind":"scalar","type":"Int"},{"name":"model","kind":"scalar","type":"Json"},{"name":"resolvedInputs","kind":"scalar","type":"Json"},{"name":"startedAt","kind":"scalar","type":"DateTime"},{"name":"finishedAt","kind":"scalar","type":"DateTime"},{"name":"operation","kind":"object","type":"Operation","relationName":"InstanceOperationStateToOperation"},{"name":"state","kind":"object","type":"InstanceState","relationName":"InstanceOperationStateToInstanceState"}],"dbName":null},"OperationLog":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"operationId","kind":"scalar","type":"String"},{"name":"stateId","kind":"scalar","type":"String"},{"name":"content","kind":"scalar","type":"String"},{"name":"operation","kind":"object","type":"Operation","relationName":"OperationToOperationLog"},{"name":"state","kind":"object","type":"InstanceState","relationName":"InstanceStateToOperationLog"}],"dbName":null},"Page":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"meta","kind":"scalar","type":"Json"},{"name":"stateId","kind":"scalar","type":"String"},{"name":"name","kind":"scalar","type":"String"},{"name":"serviceAccountId","kind":"scalar","type":"String"},{"name":"content","kind":"scalar","type":"Json"},{"name":"createdAt","kind":"scalar","type":"DateTime"},{"name":"updatedAt","kind":"scalar","type":"DateTime"},{"name":"state","kind":"object","type":"InstanceState","relationName":"InstanceStateToPage"},{"name":"serviceAccount","kind":"object","type":"ServiceAccount","relationName":"PageToServiceAccount"},{"name":"artifacts","kind":"object","type":"Artifact","relationName":"ArtifactToPage"}],"dbName":null},"Secret":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"meta","kind":"scalar","type":"Json"},{"name":"stateId","kind":"scalar","type":"String"},{"name":"name","kind":"scalar","type":"String"},{"name":"systemName","kind":"scalar","type":"String"},{"name":"serviceAccountId","kind":"scalar","type":"String"},{"name":"content","kind":"scalar","type":"Json"},{"name":"createdAt","kind":"scalar","type":"DateTime"},{"name":"updatedAt","kind":"scalar","type":"DateTime"},{"name":"state","kind":"object","type":"InstanceState","relationName":"InstanceStateToSecret"},{"name":"serviceAccount","kind":"object","type":"ServiceAccount","relationName":"SecretToServiceAccount"}],"dbName":null},"ServiceAccount":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"meta","kind":"scalar","type":"Json"},{"name":"createdAt","kind":"scalar","type":"DateTime"},{"name":"updatedAt","kind":"scalar","type":"DateTime"},{"name":"workers","kind":"object","type":"Worker","relationName":"ServiceAccountToWorker"},{"name":"artifacts","kind":"object","type":"Artifact","relationName":"ArtifactToServiceAccount"},{"name":"secrets","kind":"object","type":"Secret","relationName":"SecretToServiceAccount"},{"name":"terminals","kind":"object","type":"Terminal","relationName":"ServiceAccountToTerminal"},{"name":"pages","kind":"object","type":"Page","relationName":"PageToServiceAccount"},{"name":"customStatuses","kind":"object","type":"InstanceCustomStatus","relationName":"InstanceCustomStatusToServiceAccount"},{"name":"apiKeys","kind":"object","type":"ApiKey","relationName":"ApiKeyToServiceAccount"}],"dbName":null},"Terminal":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"meta","kind":"scalar","type":"Json"},{"name":"status","kind":"enum","type":"TerminalStatus"},{"name":"spec","kind":"scalar","type":"Json"},{"name":"stateId","kind":"scalar","type":"String"},{"name":"name","kind":"scalar","type":"String"},{"name":"serviceAccountId","kind":"scalar","type":"String"},{"name":"createdAt","kind":"scalar","type":"DateTime"},{"name":"updatedAt","kind":"scalar","type":"DateTime"},{"name":"state","kind":"object","type":"InstanceState","relationName":"InstanceStateToTerminal"},{"name":"serviceAccount","kind":"object","type":"ServiceAccount","relationName":"ServiceAccountToTerminal"},{"name":"sessions","kind":"object","type":"TerminalSession","relationName":"TerminalToTerminalSession"},{"name":"artifacts","kind":"object","type":"Artifact","relationName":"ArtifactToTerminal"}],"dbName":null},"TerminalSession":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"terminalId","kind":"scalar","type":"String"},{"name":"startedAt","kind":"scalar","type":"DateTime"},{"name":"finishedAt","kind":"scalar","type":"DateTime"},{"name":"terminal","kind":"object","type":"Terminal","relationName":"TerminalToTerminalSession"},{"name":"logs","kind":"object","type":"TerminalSessionLog","relationName":"TerminalSessionToTerminalSessionLog"}],"dbName":null},"TerminalSessionLog":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"sessionId","kind":"scalar","type":"String"},{"name":"content","kind":"scalar","type":"String"},{"name":"session","kind":"object","type":"TerminalSession","relationName":"TerminalSessionToTerminalSessionLog"}],"dbName":null},"Trigger":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"meta","kind":"scalar","type":"Json"},{"name":"stateId","kind":"scalar","type":"String"},{"name":"name","kind":"scalar","type":"String"},{"name":"spec","kind":"scalar","type":"Json"},{"name":"createdAt","kind":"scalar","type":"DateTime"},{"name":"updatedAt","kind":"scalar","type":"DateTime"},{"name":"state","kind":"object","type":"InstanceState","relationName":"InstanceStateToTrigger"}],"dbName":null},"UnlockMethod":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"meta","kind":"scalar","type":"Json"},{"name":"type","kind":"enum","type":"UnlockMethodType"},{"name":"encryptedIdentity","kind":"scalar","type":"String"},{"name":"recipient","kind":"scalar","type":"String"},{"name":"createdAt","kind":"scalar","type":"DateTime"},{"name":"updatedAt","kind":"scalar","type":"DateTime"}],"dbName":null},"Worker":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"identity","kind":"scalar","type":"String"},{"name":"serviceAccountId","kind":"scalar","type":"String"},{"name":"createdAt","kind":"scalar","type":"DateTime"},{"name":"serviceAccount","kind":"object","type":"ServiceAccount","relationName":"ServiceAccountToWorker"},{"name":"versions","kind":"object","type":"WorkerVersion","relationName":"WorkerToWorkerVersion"}],"dbName":null},"WorkerVersion":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"meta","kind":"scalar","type":"Json"},{"name":"status","kind":"enum","type":"WorkerVersionStatus"},{"name":"enabled","kind":"scalar","type":"Boolean"},{"name":"runtimeId","kind":"scalar","type":"String"},{"name":"workerId","kind":"scalar","type":"String"},{"name":"digest","kind":"scalar","type":"String"},{"name":"apiKeyId","kind":"scalar","type":"String"},{"name":"createdAt","kind":"scalar","type":"DateTime"},{"name":"updatedAt","kind":"scalar","type":"DateTime"},{"name":"worker","kind":"object","type":"Worker","relationName":"WorkerToWorkerVersion"},{"name":"apiKey","kind":"object","type":"ApiKey","relationName":"ApiKeyToWorkerVersion"},{"name":"unitRegistrations","kind":"object","type":"WorkerUnitRegistration","relationName":"WorkerUnitRegistrationToWorkerVersion"},{"name":"logs","kind":"object","type":"WorkerVersionLog","relationName":"WorkerVersionToWorkerVersionLog"}],"dbName":null},"WorkerUnitRegistration":{"fields":[{"name":"stateId","kind":"scalar","type":"String"},{"name":"name","kind":"scalar","type":"String"},{"name":"params","kind":"scalar","type":"Json"},{"name":"workerVersionId","kind":"scalar","type":"String"},{"name":"createdAt","kind":"scalar","type":"DateTime"},{"name":"updatedAt","kind":"scalar","type":"DateTime"},{"name":"state","kind":"object","type":"InstanceState","relationName":"InstanceStateToWorkerUnitRegistration"},{"name":"workerVersion","kind":"object","type":"WorkerVersion","relationName":"WorkerUnitRegistrationToWorkerVersion"}],"dbName":null},"WorkerVersionLog":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"workerVersionId","kind":"scalar","type":"String"},{"name":"content","kind":"scalar","type":"String"},{"name":"isSystem","kind":"scalar","type":"Boolean"},{"name":"workerVersion","kind":"object","type":"WorkerVersion","relationName":"WorkerVersionToWorkerVersionLog"}],"dbName":null}},"enums":{},"types":{}}');
|
|
1124
|
+
config3.runtimeDataModel = JSON.parse('{"models":{"ApiKey":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"meta","kind":"scalar","type":"Json"},{"name":"serviceAccountId","kind":"scalar","type":"String"},{"name":"token","kind":"scalar","type":"String"},{"name":"createdAt","kind":"scalar","type":"DateTime"},{"name":"updatedAt","kind":"scalar","type":"DateTime"},{"name":"worker","kind":"object","type":"WorkerVersion","relationName":"ApiKeyToWorkerVersion"},{"name":"serviceAccount","kind":"object","type":"ServiceAccount","relationName":"ApiKeyToServiceAccount"}],"dbName":null},"Artifact":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"meta","kind":"scalar","type":"Json"},{"name":"hash","kind":"scalar","type":"String"},{"name":"size","kind":"scalar","type":"Int"},{"name":"chunkSize","kind":"scalar","type":"Int"},{"name":"createdAt","kind":"scalar","type":"DateTime"},{"name":"updatedAt","kind":"scalar","type":"DateTime"},{"name":"serviceAccounts","kind":"object","type":"ServiceAccount","relationName":"ArtifactToServiceAccount"},{"name":"instances","kind":"object","type":"InstanceState","relationName":"ArtifactToInstanceState"},{"name":"terminals","kind":"object","type":"Terminal","relationName":"ArtifactToTerminal"},{"name":"pages","kind":"object","type":"Page","relationName":"ArtifactToPage"}],"dbName":null},"InstanceCustomStatus":{"fields":[{"name":"stateId","kind":"scalar","type":"String"},{"name":"serviceAccountId","kind":"scalar","type":"String"},{"name":"name","kind":"scalar","type":"String"},{"name":"meta","kind":"scalar","type":"Json"},{"name":"value","kind":"scalar","type":"String"},{"name":"message","kind":"scalar","type":"String"},{"name":"order","kind":"scalar","type":"Int"},{"name":"createdAt","kind":"scalar","type":"DateTime"},{"name":"updatedAt","kind":"scalar","type":"DateTime"},{"name":"state","kind":"object","type":"InstanceState","relationName":"InstanceCustomStatusToInstanceState"},{"name":"serviceAccount","kind":"object","type":"ServiceAccount","relationName":"InstanceCustomStatusToServiceAccount"}],"dbName":null},"InstanceEvaluationState":{"fields":[{"name":"stateId","kind":"scalar","type":"String"},{"name":"status","kind":"enum","type":"InstanceEvaluationStatus"},{"name":"message","kind":"scalar","type":"String"},{"name":"model","kind":"scalar","type":"Json"},{"name":"evaluatedAt","kind":"scalar","type":"DateTime"},{"name":"state","kind":"object","type":"InstanceState","relationName":"InstanceEvaluationStateToInstanceState"}],"dbName":null},"InstanceState":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"instanceId","kind":"scalar","type":"String"},{"name":"status","kind":"enum","type":"InstanceStatus"},{"name":"source","kind":"enum","type":"InstanceSource"},{"name":"kind","kind":"scalar","type":"String"},{"name":"parentId","kind":"scalar","type":"String"},{"name":"inputHashNonce","kind":"scalar","type":"Int"},{"name":"inputHash","kind":"scalar","type":"Int"},{"name":"outputHash","kind":"scalar","type":"Int"},{"name":"dependencyOutputHash","kind":"scalar","type":"Int"},{"name":"exportedArtifactIds","kind":"scalar","type":"Json"},{"name":"model","kind":"scalar","type":"Json"},{"name":"resolvedInputs","kind":"scalar","type":"Json"},{"name":"currentResourceCount","kind":"scalar","type":"Int"},{"name":"statusFields","kind":"scalar","type":"Json"},{"name":"parent","kind":"object","type":"InstanceState","relationName":"InstanceHierarchy"},{"name":"children","kind":"object","type":"InstanceState","relationName":"InstanceHierarchy"},{"name":"evaluationState","kind":"object","type":"InstanceEvaluationState","relationName":"InstanceEvaluationStateToInstanceState"},{"name":"operationStates","kind":"object","type":"InstanceOperationState","relationName":"InstanceOperationStateToInstanceState"},{"name":"secrets","kind":"object","type":"Secret","relationName":"InstanceStateToSecret"},{"name":"terminals","kind":"object","type":"Terminal","relationName":"InstanceStateToTerminal"},{"name":"pages","kind":"object","type":"Page","relationName":"InstanceStateToPage"},{"name":"triggers","kind":"object","type":"Trigger","relationName":"InstanceStateToTrigger"},{"name":"customStatuses","kind":"object","type":"InstanceCustomStatus","relationName":"InstanceCustomStatusToInstanceState"},{"name":"lock","kind":"object","type":"InstanceLock","relationName":"InstanceLockToInstanceState"},{"name":"workerRegistrations","kind":"object","type":"WorkerUnitRegistration","relationName":"InstanceStateToWorkerUnitRegistration"},{"name":"artifacts","kind":"object","type":"Artifact","relationName":"ArtifactToInstanceState"},{"name":"operationLogs","kind":"object","type":"OperationLog","relationName":"InstanceStateToOperationLog"},{"name":"userViewports","kind":"object","type":"UserCompositeViewport","relationName":"InstanceStateToUserCompositeViewport"}],"dbName":null},"UserProjectViewport":{"fields":[{"name":"userId","kind":"scalar","type":"String"},{"name":"viewport","kind":"scalar","type":"Json"}],"dbName":null},"UserCompositeViewport":{"fields":[{"name":"userId","kind":"scalar","type":"String"},{"name":"stateId","kind":"scalar","type":"String"},{"name":"viewport","kind":"scalar","type":"Json"},{"name":"state","kind":"object","type":"InstanceState","relationName":"InstanceStateToUserCompositeViewport"}],"dbName":null},"InstanceLock":{"fields":[{"name":"stateId","kind":"scalar","type":"String"},{"name":"meta","kind":"scalar","type":"Json"},{"name":"token","kind":"scalar","type":"String"},{"name":"acquiredAt","kind":"scalar","type":"DateTime"},{"name":"state","kind":"object","type":"InstanceState","relationName":"InstanceLockToInstanceState"}],"dbName":null},"InstanceModel":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"model","kind":"scalar","type":"Json"},{"name":"createdAt","kind":"scalar","type":"DateTime"},{"name":"updatedAt","kind":"scalar","type":"DateTime"}],"dbName":null},"HubModel":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"model","kind":"scalar","type":"Json"},{"name":"createdAt","kind":"scalar","type":"DateTime"},{"name":"updatedAt","kind":"scalar","type":"DateTime"}],"dbName":null},"Operation":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"meta","kind":"scalar","type":"Json"},{"name":"type","kind":"enum","type":"OperationType"},{"name":"status","kind":"enum","type":"OperationStatus"},{"name":"options","kind":"scalar","type":"Json"},{"name":"requestedInstanceIds","kind":"scalar","type":"Json"},{"name":"phases","kind":"scalar","type":"Json"},{"name":"startedAt","kind":"scalar","type":"DateTime"},{"name":"updatedAt","kind":"scalar","type":"DateTime"},{"name":"finishedAt","kind":"scalar","type":"DateTime"},{"name":"operationStates","kind":"object","type":"InstanceOperationState","relationName":"InstanceOperationStateToOperation"},{"name":"logs","kind":"object","type":"OperationLog","relationName":"OperationToOperationLog"}],"dbName":null},"InstanceOperationState":{"fields":[{"name":"operationId","kind":"scalar","type":"String"},{"name":"stateId","kind":"scalar","type":"String"},{"name":"status","kind":"enum","type":"InstanceOperationStatus"},{"name":"currentResourceCount","kind":"scalar","type":"Int"},{"name":"totalResourceCount","kind":"scalar","type":"Int"},{"name":"model","kind":"scalar","type":"Json"},{"name":"resolvedInputs","kind":"scalar","type":"Json"},{"name":"startedAt","kind":"scalar","type":"DateTime"},{"name":"finishedAt","kind":"scalar","type":"DateTime"},{"name":"operation","kind":"object","type":"Operation","relationName":"InstanceOperationStateToOperation"},{"name":"state","kind":"object","type":"InstanceState","relationName":"InstanceOperationStateToInstanceState"}],"dbName":null},"OperationLog":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"operationId","kind":"scalar","type":"String"},{"name":"stateId","kind":"scalar","type":"String"},{"name":"isSystem","kind":"scalar","type":"Boolean"},{"name":"content","kind":"scalar","type":"String"},{"name":"operation","kind":"object","type":"Operation","relationName":"OperationToOperationLog"},{"name":"state","kind":"object","type":"InstanceState","relationName":"InstanceStateToOperationLog"}],"dbName":null},"Page":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"meta","kind":"scalar","type":"Json"},{"name":"stateId","kind":"scalar","type":"String"},{"name":"name","kind":"scalar","type":"String"},{"name":"serviceAccountId","kind":"scalar","type":"String"},{"name":"content","kind":"scalar","type":"Json"},{"name":"createdAt","kind":"scalar","type":"DateTime"},{"name":"updatedAt","kind":"scalar","type":"DateTime"},{"name":"state","kind":"object","type":"InstanceState","relationName":"InstanceStateToPage"},{"name":"serviceAccount","kind":"object","type":"ServiceAccount","relationName":"PageToServiceAccount"},{"name":"artifacts","kind":"object","type":"Artifact","relationName":"ArtifactToPage"}],"dbName":null},"Secret":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"meta","kind":"scalar","type":"Json"},{"name":"stateId","kind":"scalar","type":"String"},{"name":"name","kind":"scalar","type":"String"},{"name":"systemName","kind":"scalar","type":"String"},{"name":"serviceAccountId","kind":"scalar","type":"String"},{"name":"content","kind":"scalar","type":"Json"},{"name":"createdAt","kind":"scalar","type":"DateTime"},{"name":"updatedAt","kind":"scalar","type":"DateTime"},{"name":"state","kind":"object","type":"InstanceState","relationName":"InstanceStateToSecret"},{"name":"serviceAccount","kind":"object","type":"ServiceAccount","relationName":"SecretToServiceAccount"}],"dbName":null},"ServiceAccount":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"meta","kind":"scalar","type":"Json"},{"name":"createdAt","kind":"scalar","type":"DateTime"},{"name":"updatedAt","kind":"scalar","type":"DateTime"},{"name":"workers","kind":"object","type":"Worker","relationName":"ServiceAccountToWorker"},{"name":"artifacts","kind":"object","type":"Artifact","relationName":"ArtifactToServiceAccount"},{"name":"secrets","kind":"object","type":"Secret","relationName":"SecretToServiceAccount"},{"name":"terminals","kind":"object","type":"Terminal","relationName":"ServiceAccountToTerminal"},{"name":"pages","kind":"object","type":"Page","relationName":"PageToServiceAccount"},{"name":"customStatuses","kind":"object","type":"InstanceCustomStatus","relationName":"InstanceCustomStatusToServiceAccount"},{"name":"apiKeys","kind":"object","type":"ApiKey","relationName":"ApiKeyToServiceAccount"}],"dbName":null},"Terminal":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"meta","kind":"scalar","type":"Json"},{"name":"status","kind":"enum","type":"TerminalStatus"},{"name":"spec","kind":"scalar","type":"Json"},{"name":"stateId","kind":"scalar","type":"String"},{"name":"name","kind":"scalar","type":"String"},{"name":"serviceAccountId","kind":"scalar","type":"String"},{"name":"createdAt","kind":"scalar","type":"DateTime"},{"name":"updatedAt","kind":"scalar","type":"DateTime"},{"name":"state","kind":"object","type":"InstanceState","relationName":"InstanceStateToTerminal"},{"name":"serviceAccount","kind":"object","type":"ServiceAccount","relationName":"ServiceAccountToTerminal"},{"name":"sessions","kind":"object","type":"TerminalSession","relationName":"TerminalToTerminalSession"},{"name":"artifacts","kind":"object","type":"Artifact","relationName":"ArtifactToTerminal"}],"dbName":null},"TerminalSession":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"terminalId","kind":"scalar","type":"String"},{"name":"startedAt","kind":"scalar","type":"DateTime"},{"name":"finishedAt","kind":"scalar","type":"DateTime"},{"name":"terminal","kind":"object","type":"Terminal","relationName":"TerminalToTerminalSession"},{"name":"logs","kind":"object","type":"TerminalSessionLog","relationName":"TerminalSessionToTerminalSessionLog"}],"dbName":null},"TerminalSessionLog":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"sessionId","kind":"scalar","type":"String"},{"name":"content","kind":"scalar","type":"String"},{"name":"session","kind":"object","type":"TerminalSession","relationName":"TerminalSessionToTerminalSessionLog"}],"dbName":null},"Trigger":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"meta","kind":"scalar","type":"Json"},{"name":"stateId","kind":"scalar","type":"String"},{"name":"name","kind":"scalar","type":"String"},{"name":"spec","kind":"scalar","type":"Json"},{"name":"createdAt","kind":"scalar","type":"DateTime"},{"name":"updatedAt","kind":"scalar","type":"DateTime"},{"name":"state","kind":"object","type":"InstanceState","relationName":"InstanceStateToTrigger"}],"dbName":null},"UnlockMethod":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"meta","kind":"scalar","type":"Json"},{"name":"type","kind":"enum","type":"UnlockMethodType"},{"name":"encryptedIdentity","kind":"scalar","type":"String"},{"name":"recipient","kind":"scalar","type":"String"},{"name":"createdAt","kind":"scalar","type":"DateTime"},{"name":"updatedAt","kind":"scalar","type":"DateTime"}],"dbName":null},"Worker":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"identity","kind":"scalar","type":"String"},{"name":"serviceAccountId","kind":"scalar","type":"String"},{"name":"createdAt","kind":"scalar","type":"DateTime"},{"name":"serviceAccount","kind":"object","type":"ServiceAccount","relationName":"ServiceAccountToWorker"},{"name":"versions","kind":"object","type":"WorkerVersion","relationName":"WorkerToWorkerVersion"}],"dbName":null},"WorkerVersion":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"meta","kind":"scalar","type":"Json"},{"name":"status","kind":"enum","type":"WorkerVersionStatus"},{"name":"enabled","kind":"scalar","type":"Boolean"},{"name":"runtimeId","kind":"scalar","type":"String"},{"name":"workerId","kind":"scalar","type":"String"},{"name":"digest","kind":"scalar","type":"String"},{"name":"apiKeyId","kind":"scalar","type":"String"},{"name":"createdAt","kind":"scalar","type":"DateTime"},{"name":"updatedAt","kind":"scalar","type":"DateTime"},{"name":"worker","kind":"object","type":"Worker","relationName":"WorkerToWorkerVersion"},{"name":"apiKey","kind":"object","type":"ApiKey","relationName":"ApiKeyToWorkerVersion"},{"name":"unitRegistrations","kind":"object","type":"WorkerUnitRegistration","relationName":"WorkerUnitRegistrationToWorkerVersion"},{"name":"logs","kind":"object","type":"WorkerVersionLog","relationName":"WorkerVersionToWorkerVersionLog"}],"dbName":null},"WorkerUnitRegistration":{"fields":[{"name":"stateId","kind":"scalar","type":"String"},{"name":"name","kind":"scalar","type":"String"},{"name":"params","kind":"scalar","type":"Json"},{"name":"workerVersionId","kind":"scalar","type":"String"},{"name":"createdAt","kind":"scalar","type":"DateTime"},{"name":"updatedAt","kind":"scalar","type":"DateTime"},{"name":"state","kind":"object","type":"InstanceState","relationName":"InstanceStateToWorkerUnitRegistration"},{"name":"workerVersion","kind":"object","type":"WorkerVersion","relationName":"WorkerUnitRegistrationToWorkerVersion"}],"dbName":null},"WorkerVersionLog":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"workerVersionId","kind":"scalar","type":"String"},{"name":"content","kind":"scalar","type":"String"},{"name":"isSystem","kind":"scalar","type":"Boolean"},{"name":"workerVersion","kind":"object","type":"WorkerVersion","relationName":"WorkerVersionToWorkerVersionLog"}],"dbName":null}},"enums":{},"types":{}}');
|
|
986
1125
|
config3.engineWasm = void 0;
|
|
987
1126
|
async function decodeBase64AsWasm3(wasmBase64) {
|
|
988
1127
|
const { Buffer: Buffer2 } = await import('node:buffer');
|
|
@@ -1045,13 +1184,16 @@ var databaseManagerConfig = z3.object({
|
|
|
1045
1184
|
HIGHSTATE_ENCRYPTION_ENABLED: z3.stringbool().default(true)
|
|
1046
1185
|
});
|
|
1047
1186
|
var DatabaseManagerImpl = class {
|
|
1048
|
-
constructor(
|
|
1049
|
-
this.
|
|
1187
|
+
constructor(backendBackend, projectUnlockBackend, projectDatabaseBackend, config4, logger) {
|
|
1188
|
+
this.backendBackend = backendBackend;
|
|
1050
1189
|
this.projectUnlockBackend = projectUnlockBackend;
|
|
1051
1190
|
this.projectDatabaseBackend = projectDatabaseBackend;
|
|
1052
1191
|
this.config = config4;
|
|
1053
1192
|
this.logger = logger;
|
|
1054
1193
|
}
|
|
1194
|
+
get backend() {
|
|
1195
|
+
return this.backendBackend.database;
|
|
1196
|
+
}
|
|
1055
1197
|
// store the master keys in memory cache for 30 seconds
|
|
1056
1198
|
projectMasterKeys = new LRUCache({
|
|
1057
1199
|
ttl: 3e4,
|
|
@@ -1062,6 +1204,17 @@ var DatabaseManagerImpl = class {
|
|
|
1062
1204
|
get isEncryptionEnabled() {
|
|
1063
1205
|
return this.config.HIGHSTATE_ENCRYPTION_ENABLED;
|
|
1064
1206
|
}
|
|
1207
|
+
/**
|
|
1208
|
+
* Delegates backend master-key rotation to the active backend database backend.
|
|
1209
|
+
*
|
|
1210
|
+
* @param recipients AGE recipients that must retain access to the backend master key.
|
|
1211
|
+
*/
|
|
1212
|
+
async updateBackendUnlockRecipients(recipients) {
|
|
1213
|
+
if (!this.backendBackend.isEncryptionEnabled) {
|
|
1214
|
+
return;
|
|
1215
|
+
}
|
|
1216
|
+
await this.backendBackend.reencryptMasterKey(recipients);
|
|
1217
|
+
}
|
|
1065
1218
|
async getProjectMasterKey(projectId) {
|
|
1066
1219
|
if (!this.isEncryptionEnabled) {
|
|
1067
1220
|
return void 0;
|
|
@@ -1144,10 +1297,10 @@ var databaseConfig = z.object({
|
|
|
1144
1297
|
...localBackendDatabaseConfig.shape,
|
|
1145
1298
|
...databaseManagerConfig.shape
|
|
1146
1299
|
});
|
|
1147
|
-
function
|
|
1300
|
+
function createBackendDatabaseBackend(config4, logger) {
|
|
1148
1301
|
switch (config4.HIGHSTATE_BACKEND_DATABASE_TYPE) {
|
|
1149
1302
|
case "local":
|
|
1150
|
-
return
|
|
1303
|
+
return createLocalBackendDatabaseBackend(config4, logger);
|
|
1151
1304
|
}
|
|
1152
1305
|
}
|
|
1153
1306
|
function createProjectDatabaseBackend(config4, logger) {
|
|
@@ -6089,9 +6242,6 @@ var OperationContext = class _OperationContext {
|
|
|
6089
6242
|
|
|
6090
6243
|
// src/orchestrator/operation-plan.ts
|
|
6091
6244
|
function createOperationPlan(context, type, requestedInstanceIds, options) {
|
|
6092
|
-
if (type === "preview") {
|
|
6093
|
-
validatePreviewRestrictions(context, requestedInstanceIds);
|
|
6094
|
-
}
|
|
6095
6245
|
const workState = {
|
|
6096
6246
|
included: /* @__PURE__ */ new Map(),
|
|
6097
6247
|
compositeTypes: /* @__PURE__ */ new Map(),
|
|
@@ -6128,16 +6278,6 @@ function createOperationPlan(context, type, requestedInstanceIds, options) {
|
|
|
6128
6278
|
}
|
|
6129
6279
|
return createOrderedPhases(workState, context, type, options);
|
|
6130
6280
|
}
|
|
6131
|
-
function validatePreviewRestrictions(context, requestedInstanceIds) {
|
|
6132
|
-
for (const instanceId of requestedInstanceIds) {
|
|
6133
|
-
const dependents = context.getDependentStates(instanceId);
|
|
6134
|
-
if (dependents.length > 0) {
|
|
6135
|
-
throw new Error(
|
|
6136
|
-
`Preview operation not allowed for instance ${instanceId} - has dependent instances`
|
|
6137
|
-
);
|
|
6138
|
-
}
|
|
6139
|
-
}
|
|
6140
|
-
}
|
|
6141
6281
|
function processInstance(instanceId, workState, context, options, operationType) {
|
|
6142
6282
|
const instance = context.getInstance(instanceId);
|
|
6143
6283
|
updateCompositeClassification(instance, workState, context);
|
|
@@ -7241,7 +7381,10 @@ ${errors.join("\n")}`
|
|
|
7241
7381
|
}
|
|
7242
7382
|
async handleUnitError(update, state) {
|
|
7243
7383
|
await this.workset.updateState(update.unitId, {
|
|
7244
|
-
instanceState:
|
|
7384
|
+
instanceState: this.operation.type === "preview" ? (
|
|
7385
|
+
// do not change instance status in preview mode
|
|
7386
|
+
void 0
|
|
7387
|
+
) : {
|
|
7245
7388
|
// keep "deployed" status for initially deployed instances even if the operation was failed or cancelled
|
|
7246
7389
|
status: state.status === "deployed" ? "deployed" : "failed"
|
|
7247
7390
|
},
|
|
@@ -7252,6 +7395,15 @@ ${errors.join("\n")}`
|
|
|
7252
7395
|
});
|
|
7253
7396
|
}
|
|
7254
7397
|
async handleUnitCompletion(update, state) {
|
|
7398
|
+
if (this.operation.type === "preview") {
|
|
7399
|
+
await this.workset.updateState(update.unitId, {
|
|
7400
|
+
operationState: {
|
|
7401
|
+
status: this.workset.getStableStatusByOperationPhase(),
|
|
7402
|
+
finishedAt: /* @__PURE__ */ new Date()
|
|
7403
|
+
}
|
|
7404
|
+
});
|
|
7405
|
+
return;
|
|
7406
|
+
}
|
|
7255
7407
|
const instance = this.context.getInstance(update.unitId);
|
|
7256
7408
|
const data = {
|
|
7257
7409
|
status: this.workset.getNextStableInstanceStatus(instance.id),
|
|
@@ -7274,6 +7426,8 @@ ${errors.join("\n")}`
|
|
|
7274
7426
|
data.dependencyOutputHash = null;
|
|
7275
7427
|
data.outputHash = null;
|
|
7276
7428
|
data.parentId = null;
|
|
7429
|
+
data.model = null;
|
|
7430
|
+
data.resolvedInputs = null;
|
|
7277
7431
|
}
|
|
7278
7432
|
await this.workset.updateState(instance.id, {
|
|
7279
7433
|
// TODO: honestly, it is not correct
|
|
@@ -8566,6 +8720,7 @@ async function createServices({
|
|
|
8566
8720
|
artifactBackend,
|
|
8567
8721
|
artifactService,
|
|
8568
8722
|
// business services
|
|
8723
|
+
backendUnlockService,
|
|
8569
8724
|
instanceLockService,
|
|
8570
8725
|
projectUnlockService,
|
|
8571
8726
|
operationService,
|
|
@@ -8584,10 +8739,10 @@ async function createServices({
|
|
|
8584
8739
|
config4 ??= await loadConfig();
|
|
8585
8740
|
logger ??= pino({ level: config4.HIGHSTATE_LOG_LEVEL, errorKey: "error" });
|
|
8586
8741
|
projectUnlockBackend ??= new MemoryProjectUnlockBackend();
|
|
8587
|
-
const
|
|
8742
|
+
const backendDatabaseBackend = await createBackendDatabaseBackend(config4, logger);
|
|
8588
8743
|
const projectDatabaseBackend = await createProjectDatabaseBackend(config4, logger);
|
|
8589
8744
|
database ??= new DatabaseManagerImpl(
|
|
8590
|
-
|
|
8745
|
+
backendDatabaseBackend,
|
|
8591
8746
|
projectUnlockBackend,
|
|
8592
8747
|
projectDatabaseBackend,
|
|
8593
8748
|
config4,
|
|
@@ -8600,6 +8755,10 @@ async function createServices({
|
|
|
8600
8755
|
libraryBackend ??= await createLibraryBackend(config4, logger);
|
|
8601
8756
|
artifactBackend ??= await createArtifactBackend(config4, database, logger);
|
|
8602
8757
|
artifactService ??= new ArtifactService(database, artifactBackend, logger);
|
|
8758
|
+
backendUnlockService ??= new BackendUnlockService(
|
|
8759
|
+
database,
|
|
8760
|
+
logger.child({ service: "BackendUnlockService" })
|
|
8761
|
+
);
|
|
8603
8762
|
secretService ??= new SecretService(
|
|
8604
8763
|
database,
|
|
8605
8764
|
pubsubManager,
|
|
@@ -8733,6 +8892,7 @@ async function createServices({
|
|
|
8733
8892
|
artifactBackend,
|
|
8734
8893
|
artifactService,
|
|
8735
8894
|
// business services
|
|
8895
|
+
backendUnlockService,
|
|
8736
8896
|
instanceLockService,
|
|
8737
8897
|
projectUnlockService,
|
|
8738
8898
|
operationService,
|
|
@@ -8782,6 +8942,6 @@ async function disposeServices(services) {
|
|
|
8782
8942
|
await Promise.all(promises);
|
|
8783
8943
|
}
|
|
8784
8944
|
|
|
8785
|
-
export { ApiKeyService, ArtifactService, PrismaClient2 as BackendDatabase, DatabaseManagerImpl, DbNull3 as DbNull, InstanceLockService, InstanceStateService, OperationManager, OperationService, PrismaClient3 as ProjectDatabase, ProjectModelService, ProjectService, ProjectUnlockService, SecretService, SettingsService, TerminalManager, TerminalSessionService, UnitExtraService, WorkerService, artifactChunkSize, backendDatabaseVersion,
|
|
8945
|
+
export { ApiKeyService, ArtifactService, PrismaClient2 as BackendDatabase, BackendUnlockService, DatabaseManagerImpl, DbNull3 as DbNull, InstanceLockService, InstanceStateService, OperationManager, OperationService, PrismaClient3 as ProjectDatabase, ProjectModelService, ProjectService, ProjectUnlockService, SecretService, SettingsService, TerminalManager, TerminalSessionService, UnitExtraService, WorkerService, artifactChunkSize, backendDatabaseVersion, createBackendDatabaseBackend, createLibraryBackend, createProjectDatabaseBackend, createServices, createTerminalBackend, databaseConfig, databaseManagerConfig, disposeServices, ensureWellKnownEntitiesCreated, getOrCreateBackendIdentity, getSharedServices, includeForInstanceState, libraryBackendConfig, loadConfig, mapInstanceStateResult, projectDatabaseVersion, projectUnlockServiceConfig, terminalBackendConfig };
|
|
8786
8946
|
//# sourceMappingURL=index.js.map
|
|
8787
8947
|
//# sourceMappingURL=index.js.map
|