@highstate/backend 0.12.1 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/dist/{chunk-SEPC66ZL.js → chunk-4JUMOKLV.js} +4 -3
  2. package/dist/chunk-4JUMOKLV.js.map +1 -0
  3. package/dist/highstate.manifest.json +2 -2
  4. package/dist/index.js +86 -60
  5. package/dist/index.js.map +1 -1
  6. package/dist/shared/index.js +1 -1
  7. package/package.json +3 -3
  8. package/prisma/project/main.prisma +1 -1
  9. package/prisma/project/operation.prisma +1 -0
  10. package/src/business/instance-state.ts +61 -27
  11. package/src/database/_generated/project/browser.ts +244 -0
  12. package/src/database/_generated/project/client.ts +5 -30
  13. package/src/database/_generated/project/commonInputTypes.ts +2 -2
  14. package/src/database/_generated/project/enums.ts +3 -1
  15. package/src/database/_generated/project/internal/class.ts +11 -16
  16. package/src/database/_generated/project/internal/prismaNamespace.ts +7 -13
  17. package/src/database/_generated/project/internal/prismaNamespaceBrowser.ts +445 -0
  18. package/src/database/_generated/project/models/ApiKey.ts +21 -21
  19. package/src/database/_generated/project/models/Artifact.ts +31 -31
  20. package/src/database/_generated/project/models/HubModel.ts +11 -11
  21. package/src/database/_generated/project/models/InstanceCustomStatus.ts +23 -23
  22. package/src/database/_generated/project/models/InstanceEvaluationState.ts +15 -15
  23. package/src/database/_generated/project/models/InstanceLock.ts +15 -15
  24. package/src/database/_generated/project/models/InstanceModel.ts +11 -11
  25. package/src/database/_generated/project/models/InstanceOperationState.ts +44 -44
  26. package/src/database/_generated/project/models/InstanceState.ts +206 -206
  27. package/src/database/_generated/project/models/Operation.ts +70 -70
  28. package/src/database/_generated/project/models/OperationLog.ts +2 -2
  29. package/src/database/_generated/project/models/Page.ts +54 -54
  30. package/src/database/_generated/project/models/Secret.ts +44 -44
  31. package/src/database/_generated/project/models/ServiceAccount.ts +40 -40
  32. package/src/database/_generated/project/models/Terminal.ts +62 -62
  33. package/src/database/_generated/project/models/TerminalSession.ts +2 -2
  34. package/src/database/_generated/project/models/TerminalSessionLog.ts +2 -2
  35. package/src/database/_generated/project/models/Trigger.ts +32 -32
  36. package/src/database/_generated/project/models/UnlockMethod.ts +11 -11
  37. package/src/database/_generated/project/models/UserCompositeViewport.ts +17 -17
  38. package/src/database/_generated/project/models/UserProjectViewport.ts +11 -11
  39. package/src/database/_generated/project/models/Worker.ts +2 -2
  40. package/src/database/_generated/project/models/WorkerUnitRegistration.ts +23 -23
  41. package/src/database/_generated/project/models/WorkerVersion.ts +29 -29
  42. package/src/database/_generated/project/models/WorkerVersionLog.ts +2 -2
  43. package/src/database/_generated/project/models.ts +1 -1
  44. package/src/database/_generated/project/pjtg.ts +1 -0
  45. package/src/orchestrator/operation-workset.ts +22 -11
  46. package/src/orchestrator/operation.ts +11 -5
  47. package/src/shared/models/project/operation.ts +1 -0
  48. package/dist/chunk-SEPC66ZL.js.map +0 -1
@@ -1,4 +1,4 @@
1
- export { AccessError, BackendError, BackendUnlockMethodNotFoundError, CannotDeleteLastBackendUnlockMethodError, CannotDeleteLastUnlockMethodError, GraphResolver, InputHashResolver, InputResolver, InstanceLockLostError, InstanceLockedError, InstanceNotFoundError, InstanceStateNotFoundError, InvalidInstanceKindError, MAX_WORKER_START_ATTEMPTS, OperationNotFoundError, ProjectLockedError, ProjectNotFoundError, PromiseTracker, SystemSecretNames, ValidationResolver, WorkerVersionNotFoundError, apiKeyMetaSchema, apiKeyOutputSchema, apiKeyQuerySchema, applyLibraryUpdate, artifactOutputSchema, artifactQuerySchema, backendUnlockMethodInputSchema, backendUnlockMethodMetaSchema, codebaseLibrary, codebaseProjectModelStorage, collectionQueryResult, collectionQuerySchema, createAsyncBatcher, databaseProjectModelStorage, diffLibraries, extractDigestFromImage, finalInstanceOperationStatuses, finalOperationStatuses, forSchema, getAllDependents, getMatchedInjectionInstanceInputs, getResolvedHubInputs, getResolvedInjectionInstanceInputs, getResolvedInstanceInputs, getResolvedInstanceOutputs, getWorkerIdentity, globalProjectSpace, hasObjectMeta, hostPulumiBackend, instanceCustomStatusInputSchema, instanceLockEventSchema, instanceLockOutputSchema, instanceStateEventSchema, int32ToBytes, isFinalOperationStatus, isInstanceDeployed, isTransientInstanceOperationStatus, isTransientOperationStatus, isVirtualGhostInstance, librarySpecSchema, operationEventSchema, operationLaunchInputSchema, operationMetaSchema, operationOptionsSchema, operationOutputSchema, operationPhaseInstanceSchema, operationPhaseSchema, operationPhaseTypeSchema, operationPlanInputSchema, operationStatusSchema, operationTypeSchema, pageDetailsOutputSchema, pageOutputSchema, pageQuerySchema, projectInputSchema, projectModelEventSchema, projectModelStorageSpecSchema, projectOutputSchema, projectUnlockStateSchema, projectUnlockSuiteSchema, pulumiBackendSpecSchema, resolverFactories, secretOutputSchema, secretQuerySchema, serviceAccountOutputSchema, serviceAccountQuerySchema, stableInstanceInputSchema, terminalDetailsOutputSchema, terminalOutputSchema, terminalQuerySchema, terminalSessionOutputSchema, terminalStatusSchema, toApiKeyOutput, toPageOutput, toSecretOutput, toTerminalDetailsOutput, toTerminalOutput, toTerminalSessionOutput, toWorkerOutput, toWorkerVersionOutput, triggerOutputSchema, triggerQuerySchema, unlockMethodInputSchema, unlockMethodMetaSchema, unlockMethodOutputSchema, unlockMethodType, waitAll, workerOutputSchema, workerQuerySchema, workerUnitRegistrationEventSchema, workerVersionOutputSchema, workerVersionStatusSchema } from '../chunk-SEPC66ZL.js';
1
+ export { AccessError, BackendError, BackendUnlockMethodNotFoundError, CannotDeleteLastBackendUnlockMethodError, CannotDeleteLastUnlockMethodError, GraphResolver, InputHashResolver, InputResolver, InstanceLockLostError, InstanceLockedError, InstanceNotFoundError, InstanceStateNotFoundError, InvalidInstanceKindError, MAX_WORKER_START_ATTEMPTS, OperationNotFoundError, ProjectLockedError, ProjectNotFoundError, PromiseTracker, SystemSecretNames, ValidationResolver, WorkerVersionNotFoundError, apiKeyMetaSchema, apiKeyOutputSchema, apiKeyQuerySchema, applyLibraryUpdate, artifactOutputSchema, artifactQuerySchema, backendUnlockMethodInputSchema, backendUnlockMethodMetaSchema, codebaseLibrary, codebaseProjectModelStorage, collectionQueryResult, collectionQuerySchema, createAsyncBatcher, databaseProjectModelStorage, diffLibraries, extractDigestFromImage, finalInstanceOperationStatuses, finalOperationStatuses, forSchema, getAllDependents, getMatchedInjectionInstanceInputs, getResolvedHubInputs, getResolvedInjectionInstanceInputs, getResolvedInstanceInputs, getResolvedInstanceOutputs, getWorkerIdentity, globalProjectSpace, hasObjectMeta, hostPulumiBackend, instanceCustomStatusInputSchema, instanceLockEventSchema, instanceLockOutputSchema, instanceStateEventSchema, int32ToBytes, isFinalOperationStatus, isInstanceDeployed, isTransientInstanceOperationStatus, isTransientOperationStatus, isVirtualGhostInstance, librarySpecSchema, operationEventSchema, operationLaunchInputSchema, operationMetaSchema, operationOptionsSchema, operationOutputSchema, operationPhaseInstanceSchema, operationPhaseSchema, operationPhaseTypeSchema, operationPlanInputSchema, operationStatusSchema, operationTypeSchema, pageDetailsOutputSchema, pageOutputSchema, pageQuerySchema, projectInputSchema, projectModelEventSchema, projectModelStorageSpecSchema, projectOutputSchema, projectUnlockStateSchema, projectUnlockSuiteSchema, pulumiBackendSpecSchema, resolverFactories, secretOutputSchema, secretQuerySchema, serviceAccountOutputSchema, serviceAccountQuerySchema, stableInstanceInputSchema, terminalDetailsOutputSchema, terminalOutputSchema, terminalQuerySchema, terminalSessionOutputSchema, terminalStatusSchema, toApiKeyOutput, toPageOutput, toSecretOutput, toTerminalDetailsOutput, toTerminalOutput, toTerminalSessionOutput, toWorkerOutput, toWorkerVersionOutput, triggerOutputSchema, triggerQuerySchema, unlockMethodInputSchema, unlockMethodMetaSchema, unlockMethodOutputSchema, unlockMethodType, waitAll, workerOutputSchema, workerQuerySchema, workerUnitRegistrationEventSchema, workerVersionOutputSchema, workerVersionStatusSchema } from '../chunk-4JUMOKLV.js';
2
2
  import '../chunk-I7BWSAN6.js';
3
3
  //# sourceMappingURL=index.js.map
4
4
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@highstate/backend",
3
- "version": "0.12.1",
3
+ "version": "0.13.0",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist",
@@ -25,7 +25,6 @@
25
25
  },
26
26
  "dependencies": {
27
27
  "@aws-crypto/crc32": "^5.2.0",
28
- "@highstate/contract": "^0.10.0",
29
28
  "@msgpack/msgpack": "^3.1.2",
30
29
  "@napi-rs/keyring": "^1.1.8",
31
30
  "@noble/ciphers": "^1.3.0",
@@ -58,7 +57,8 @@
58
57
  "uuid": "^11.1.0",
59
58
  "watcher": "^2.3.1",
60
59
  "yaml": "^2.7.1",
61
- "zod": "^4.0.5"
60
+ "zod": "^4.0.5",
61
+ "@highstate/contract": "0.13.0"
62
62
  },
63
63
  "peerDependencies": {
64
64
  "@pulumi/pulumi": "^3.198.0",
@@ -5,7 +5,7 @@ datasource db {
5
5
 
6
6
  generator client {
7
7
  provider = "prisma-client"
8
- previewFeatures = ["queryCompiler", "driverAdapters"]
8
+ engineType = "client"
9
9
  output = "../../src/database/_generated/project"
10
10
  moduleFormat = "esm"
11
11
  generatedFileExtension = "ts"
@@ -3,6 +3,7 @@ enum OperationStatus {
3
3
  pending
4
4
  running
5
5
  failing
6
+ cancelling
6
7
 
7
8
  // stable statuses
8
9
  completed
@@ -266,6 +266,31 @@ export class InstanceStateService {
266
266
  instanceId: InstanceId,
267
267
  { deleteSecrets = false, clearTerminalData = false }: ForgetInstanceStateOptions = {},
268
268
  ): Promise<void> {
269
+ await this.forgetInstanceStates(projectId, [instanceId], {
270
+ deleteSecrets,
271
+ clearTerminalData,
272
+ })
273
+ }
274
+
275
+ /**
276
+ * Forgets states for multiple instances in a single transaction.
277
+ *
278
+ * The transaction ensures the operation is all-or-nothing.
279
+ * Side effects are still performed after commit.
280
+ *
281
+ * @param projectId The ID of the project containing the instances.
282
+ * @param instanceIds The IDs of the instances whose states are to be forgotten.
283
+ * @param options Configuration options for terminal and secret handling.
284
+ */
285
+ async forgetInstanceStates(
286
+ projectId: string,
287
+ instanceIds: InstanceId[],
288
+ { deleteSecrets = false, clearTerminalData = false }: ForgetInstanceStateOptions = {},
289
+ ): Promise<void> {
290
+ if (instanceIds.length === 0) {
291
+ return
292
+ }
293
+
269
294
  const database = await this.database.forProject(projectId)
270
295
  const project = await this.database.backend.project.findUnique({
271
296
  where: { id: projectId },
@@ -276,41 +301,50 @@ export class InstanceStateService {
276
301
  throw new ProjectNotFoundError(projectId)
277
302
  }
278
303
 
304
+ const uniqueInstanceIds = Array.from(new Set(instanceIds))
305
+
279
306
  // collect instances to process cleanup after transaction
280
307
  const unitInstancesToCleanup: { id: string; instanceId: InstanceId }[] = []
281
308
  const updatedStateIds: string[] = []
282
309
 
283
310
  await database.$transaction(async tx => {
284
- const state = await tx.instanceState.findUnique({
285
- where: { instanceId },
286
- select: {
287
- id: true,
288
- kind: true,
289
- instanceId: true,
290
- lock: { select: { stateId: true } },
291
- },
292
- })
311
+ for (const instanceId of uniqueInstanceIds) {
312
+ const state = await tx.instanceState.findUnique({
313
+ where: { instanceId },
314
+ select: {
315
+ id: true,
316
+ kind: true,
317
+ instanceId: true,
318
+ lock: { select: { stateId: true } },
319
+ },
320
+ })
293
321
 
294
- if (!state) {
295
- throw new InstanceStateNotFoundError(projectId, instanceId)
296
- }
322
+ if (!state) {
323
+ throw new InstanceStateNotFoundError(projectId, instanceId)
324
+ }
297
325
 
298
- if (state.lock) {
299
- throw new InstanceLockedError(projectId, instanceId)
300
- }
326
+ if (state.lock) {
327
+ throw new InstanceLockedError(projectId, instanceId)
328
+ }
301
329
 
302
- await this.processInstanceDeletion(
303
- tx,
304
- projectId,
305
- state,
306
- { deleteSecrets, clearTerminalData },
307
- unitInstancesToCleanup,
308
- updatedStateIds,
309
- )
330
+ await this.processInstanceDeletion(
331
+ tx,
332
+ projectId,
333
+ state,
334
+ { deleteSecrets, clearTerminalData },
335
+ unitInstancesToCleanup,
336
+ updatedStateIds,
337
+ )
338
+ }
310
339
  })
311
340
 
341
+ const uniqueUpdatedStateIds = Array.from(new Set(updatedStateIds))
342
+ const uniqueUnitInstancesToCleanup = Array.from(
343
+ new Map(unitInstancesToCleanup.map(item => [item.id, item])).values(),
344
+ )
345
+
312
346
  // publish state events for all updated instances
313
- for (const updatedStateId of updatedStateIds) {
347
+ for (const updatedStateId of uniqueUpdatedStateIds) {
314
348
  void this.pubsubManager.publish(["instance-state", projectId], {
315
349
  type: "patched",
316
350
  stateId: updatedStateId,
@@ -338,7 +372,7 @@ export class InstanceStateService {
338
372
  await waitAll([
339
373
  this.workerService.cleanupWorkerUsageAndSync(projectId),
340
374
  this.artifactService.collectGarbage(projectId),
341
- ...unitInstancesToCleanup.map(async ({ id, instanceId }) => {
375
+ ...uniqueUnitInstancesToCleanup.map(async ({ id, instanceId }) => {
342
376
  const [instanceType, instanceName] = parseInstanceId(instanceId)
343
377
 
344
378
  await this.runnerBackend.deleteState({
@@ -352,7 +386,7 @@ export class InstanceStateService {
352
386
  ])
353
387
  } catch (error) {
354
388
  this.logger.warn(
355
- { error, projectId, instanceId },
389
+ { error, projectId, instanceIds: uniqueInstanceIds },
356
390
  "failed to perform side effects after forgetting instance state",
357
391
  )
358
392
  }
@@ -431,7 +465,7 @@ export class InstanceStateService {
431
465
  // track this instance as updated
432
466
  updatedStateIds.push(state.id)
433
467
 
434
- this.logger.info({ projectId }, `marked state "%s" as deleted`, state.id)
468
+ this.logger.info({ projectId }, `marked state "%s" as undeployed`, state.id)
435
469
 
436
470
  // recursively handle child instances using parentId
437
471
  if (state.kind === "composite") {
@@ -0,0 +1,244 @@
1
+
2
+ /* !!! This is code generated by Prisma. Do not edit directly. !!! */
3
+ /* eslint-disable */
4
+ // @ts-nocheck
5
+ /*
6
+ * This file should be your main import to use Prisma-related types and utilities in a browser.
7
+ * Use it to get access to models, enums, and input types.
8
+ *
9
+ * This file does not contain a `PrismaClient` class, nor several other helpers that are intended as server-side only.
10
+ * See `client.ts` for the standard, server-side entry point.
11
+ *
12
+ * 🟢 You can import this file directly.
13
+ */
14
+
15
+ import * as Prisma from './internal/prismaNamespaceBrowser.ts'
16
+ export { Prisma }
17
+ export * as $Enums from './enums.ts'
18
+ export * from './enums.ts';
19
+ /**
20
+ * Model ApiKey
21
+ * The API key provides authentication tokens for accessing the platform API.
22
+ *
23
+ * Each API key impersonates a service account, inheriting its permissions and access scope.
24
+ * Keys are automatically created for worker versions and can be manually created for
25
+ * external integrations. The token is a 32-byte random hex string that can be regenerated.
26
+ */
27
+ export type ApiKey = Prisma.ApiKeyModel
28
+ /**
29
+ * Model Artifact
30
+ * The artifact represents a file or folder stored in the system.
31
+ *
32
+ * It can be produced by units or manually uploaded via API by service accounts.
33
+ *
34
+ * Since different actors can produce the same artifact with the same content and hash,
35
+ * there is the ownership/usage concept to track which entities produce or use the artifact.
36
+ * The "ownership" and "usage" are synonymous in this context and often referred to as "usage".
37
+ *
38
+ * When no usages are present, the artifact will be automatically garbage collected after a certain period.
39
+ */
40
+ export type Artifact = Prisma.ArtifactModel
41
+ /**
42
+ * Model InstanceCustomStatus
43
+ *
44
+ */
45
+ export type InstanceCustomStatus = Prisma.InstanceCustomStatusModel
46
+ /**
47
+ * Model InstanceEvaluationState
48
+ * The evaluation state tracks the result of evaluating composite instances to produce virtual instances.
49
+ *
50
+ * Composite instances are template components that generate other instances (virtual instances) when evaluated.
51
+ * The evaluation process executes the composite's create function with resolved inputs to produce a tree
52
+ * of child instances. These virtual instances exist in the source "virtual" state and can be units
53
+ * (mapping to Pulumi resources) or other composites (producing more virtual instances recursively).
54
+ *
55
+ * Evaluation happens automatically after project unlock and library reloads to keep virtual instances
56
+ * synchronized with their composite definitions. Evaluation state persists the produced instance model
57
+ * and tracks success/error status with descriptive messages showing the instance tree or error details.
58
+ */
59
+ export type InstanceEvaluationState = Prisma.InstanceEvaluationStateModel
60
+ /**
61
+ * Model InstanceState
62
+ *
63
+ */
64
+ export type InstanceState = Prisma.InstanceStateModel
65
+ /**
66
+ * Model UserProjectViewport
67
+ *
68
+ */
69
+ export type UserProjectViewport = Prisma.UserProjectViewportModel
70
+ /**
71
+ * Model UserCompositeViewport
72
+ *
73
+ */
74
+ export type UserCompositeViewport = Prisma.UserCompositeViewportModel
75
+ /**
76
+ * Model InstanceLock
77
+ *
78
+ */
79
+ export type InstanceLock = Prisma.InstanceLockModel
80
+ /**
81
+ * Model InstanceModel
82
+ * The container for project instances.
83
+ *
84
+ * Only used when "database" project model storage is used.
85
+ */
86
+ export type InstanceModel = Prisma.InstanceModelModel
87
+ /**
88
+ * Model HubModel
89
+ * The container for project hubs.
90
+ *
91
+ * Only used when "database" project model storage is used.
92
+ */
93
+ export type HubModel = Prisma.HubModelModel
94
+ /**
95
+ * Model Operation
96
+ *
97
+ */
98
+ export type Operation = Prisma.OperationModel
99
+ /**
100
+ * Model InstanceOperationState
101
+ *
102
+ */
103
+ export type InstanceOperationState = Prisma.InstanceOperationStateModel
104
+ /**
105
+ * Model OperationLog
106
+ *
107
+ */
108
+ export type OperationLog = Prisma.OperationLogModel
109
+ /**
110
+ * Model Page
111
+ * The page provides custom UI content for instances and service accounts.
112
+ *
113
+ * Pages can be created by units to display instance-specific information or by service accounts.
114
+ * The content consists of blocks that support markdown text, QR codes with optional content display,
115
+ * and file attachments (inline or artifact references). Instance pages are explicitly deleted
116
+ * when instances are destroyed.
117
+ */
118
+ export type Page = Prisma.PageModel
119
+ /**
120
+ * Model Secret
121
+ * The secret stores sensitive configuration values for instances, service accounts, and system components.
122
+ *
123
+ * Secrets can be instance-owned (for unit configuration), service account-owned, or system-level
124
+ * (like Pulumi passwords).
125
+ *
126
+ * Secrets persist through normal destroy (recreate) operations
127
+ * and are only deleted when explicitly forgetting instance state with the deleteSecrets flag or when manually deleted.
128
+ *
129
+ * Secret updates invalidate instance input hashes via inputHashNonce, triggering re-execution
130
+ * during operations. But the content of the secrets itself do not contribute to the input hash.
131
+ *
132
+ * System secrets like Pulumi passwords are created on-demand and persist for the whole project lifetime.
133
+ */
134
+ export type Secret = Prisma.SecretModel
135
+ /**
136
+ * Model ServiceAccount
137
+ * The service account represents an identity for non-human actors in the system.
138
+ *
139
+ * Service accounts are automatically created for workers and can be manually created
140
+ * for external integrations. They define the access scope for resources like artifacts,
141
+ * secrets, terminals, and pages. Multiple API keys can impersonate the same service account,
142
+ * allowing different authentication tokens to share the same permissions.
143
+ */
144
+ export type ServiceAccount = Prisma.ServiceAccountModel
145
+ /**
146
+ * Model Terminal
147
+ * The terminal provides interactive shell access to infrastructure resources.
148
+ *
149
+ * Terminals can be created by units (owned by instances) or by service accounts.
150
+ * Each terminal maintains a specification for creating containers that power the terminal,
151
+ * including image, command, environment, and mounted files.
152
+ *
153
+ * Instance-owned terminals are marked unavailable when the instance is destroyed, preserving session history.
154
+ * Service account terminals persist independently.
155
+ */
156
+ export type Terminal = Prisma.TerminalModel
157
+ /**
158
+ * Model TerminalSession
159
+ * The terminal session represents a single interactive connection to a terminal.
160
+ *
161
+ * Each session tracks when it started and finished. All session output is preserved in logs.
162
+ */
163
+ export type TerminalSession = Prisma.TerminalSessionModel
164
+ /**
165
+ * Model TerminalSessionLog
166
+ * The terminal session log captures all input and output from a terminal session.
167
+ *
168
+ * Logs are stored with ULID identifiers for timestamp ordering.
169
+ */
170
+ export type TerminalSessionLog = Prisma.TerminalSessionLogModel
171
+ /**
172
+ * Model Trigger
173
+ * The trigger defines automated actions that execute in response to specific events.
174
+ *
175
+ * Triggers are created by units to perform actions at defined points in the instance lifecycle
176
+ * or on schedule. The spec field determines the trigger type and behavior - currently supporting
177
+ * before-destroy triggers, with planned support for additional types like cron scheduling.
178
+ * Triggers are deleted along with their instance.
179
+ */
180
+ export type Trigger = Prisma.TriggerModel
181
+ /**
182
+ * Model UnlockMethod
183
+ * The unlock method enables decryption of project databases through user authentication.
184
+ *
185
+ * Each project database is encrypted with a master key, which is then encrypted for each
186
+ * unlock method's recipient using AGE encryption. Users authenticate (password or passkey)
187
+ * to decrypt their specific AGE identity, which then decrypts the master key.
188
+ *
189
+ * Multiple unlock methods can exist per project, allowing different authentication paths
190
+ * to the same encrypted database. When unlock methods are added/removed, the master key
191
+ * is re-encrypted for the new set of recipients.
192
+ *
193
+ * The encryptedIdentity contains the AGE identity encrypted with the user's authentication
194
+ * method (password-derived key or WebAuthn), while the recipient is the public key
195
+ * corresponding to that identity.
196
+ */
197
+ export type UnlockMethod = Prisma.UnlockMethodModel
198
+ /**
199
+ * Model Worker
200
+ * The worker represents a containerized application that extends unit capabilities beyond Pulumi execution.
201
+ *
202
+ * Workers enable units to perform runtime operations after Pulumi program completion,
203
+ * such as attaching custom statuses, monitoring resources, or triggering unit reconfigurations.
204
+ * Since Pulumi programs cannot affect instances after execution, workers bypass this limitation
205
+ * by providing persistent runtime behavior.
206
+ *
207
+ * The worker identity (fully qualified image name) indicates the same publisher/party and services as natural authentication mechanism.
208
+ * All versions of a worker share the same service account, meaning they operate over
209
+ * the same resources and have the same access scope within the platform.
210
+ */
211
+ export type Worker = Prisma.WorkerModel
212
+ /**
213
+ * Model WorkerVersion
214
+ * The worker version represents a specific container image digest of a worker.
215
+ *
216
+ * Each version corresponds to an immutable container image identified by its SHA256 digest.
217
+ * Versions are automatically created when units reference new image digests and deleted
218
+ * when no longer referenced by any unit registrations.
219
+ *
220
+ * Each version has its own API key for isolation, but all versions of a worker
221
+ * share the same service account and thus the same access scope within the platform.
222
+ * The runtime starts containers when registrations exist and stops them when removed.
223
+ */
224
+ export type WorkerVersion = Prisma.WorkerVersionModel
225
+ /**
226
+ * Model WorkerUnitRegistration
227
+ * The worker unit registration tracks which unit instances require specific worker versions.
228
+ *
229
+ * Units declare worker dependencies through their outputs, creating registrations that
230
+ * trigger the runtime to start corresponding worker containers. Each registration
231
+ * includes parameters passed to the worker for unit-specific configuration.
232
+ *
233
+ * Registrations are managed during operation execution - created when units declare workers
234
+ * and removed when units are destroyed. Worker versions without registrations are garbage collected.
235
+ */
236
+ export type WorkerUnitRegistration = Prisma.WorkerUnitRegistrationModel
237
+ /**
238
+ * Model WorkerVersionLog
239
+ * The worker version log captures output from running worker containers.
240
+ *
241
+ * Logs include both worker-generated output and system messages from the runtime.
242
+ * The ULID identifier provides timestamp ordering. Logs are deleted with the worker version.
243
+ */
244
+ export type WorkerVersionLog = Prisma.WorkerVersionLogModel
@@ -2,16 +2,17 @@
2
2
  /* !!! This is code generated by Prisma. Do not edit directly. !!! */
3
3
  /* eslint-disable */
4
4
  // @ts-nocheck
5
- /**
5
+ /*
6
6
  * This file should be your main import to use Prisma. Through it you get access to all the models, enums, and input types.
7
- *
7
+ * If you're looking for something you can import in the client-side of your application, please refer to the `browser.ts` file instead.
8
+ *
8
9
  * 🟢 You can import this file directly.
9
10
  */
10
11
 
11
12
  import * as process from 'node:process'
12
13
  import * as path from 'node:path'
13
14
  import { fileURLToPath } from 'node:url'
14
- const __dirname = path.dirname(fileURLToPath(import.meta.url))
15
+ globalThis['__dirname'] = path.dirname(fileURLToPath(import.meta.url))
15
16
 
16
17
  import * as runtime from "@prisma/client/runtime/client"
17
18
  import * as $Enums from "./enums.ts"
@@ -19,6 +20,7 @@ import * as $Class from "./internal/class.ts"
19
20
  import * as Prisma from "./internal/prismaNamespace.ts"
20
21
 
21
22
  export * as $Enums from './enums.ts'
23
+ export * from "./enums.ts"
22
24
  /**
23
25
  * ## Prisma Client
24
26
  *
@@ -264,30 +266,3 @@ export type WorkerUnitRegistration = Prisma.WorkerUnitRegistrationModel
264
266
  * The ULID identifier provides timestamp ordering. Logs are deleted with the worker version.
265
267
  */
266
268
  export type WorkerVersionLog = Prisma.WorkerVersionLogModel
267
-
268
- export type InstanceEvaluationStatus = $Enums.InstanceEvaluationStatus
269
- export const InstanceEvaluationStatus = $Enums.InstanceEvaluationStatus
270
-
271
- export type InstanceStatus = $Enums.InstanceStatus
272
- export const InstanceStatus = $Enums.InstanceStatus
273
-
274
- export type InstanceSource = $Enums.InstanceSource
275
- export const InstanceSource = $Enums.InstanceSource
276
-
277
- export type OperationStatus = $Enums.OperationStatus
278
- export const OperationStatus = $Enums.OperationStatus
279
-
280
- export type OperationType = $Enums.OperationType
281
- export const OperationType = $Enums.OperationType
282
-
283
- export type InstanceOperationStatus = $Enums.InstanceOperationStatus
284
- export const InstanceOperationStatus = $Enums.InstanceOperationStatus
285
-
286
- export type TerminalStatus = $Enums.TerminalStatus
287
- export const TerminalStatus = $Enums.TerminalStatus
288
-
289
- export type UnlockMethodType = $Enums.UnlockMethodType
290
- export const UnlockMethodType = $Enums.UnlockMethodType
291
-
292
- export type WorkerVersionStatus = $Enums.WorkerVersionStatus
293
- export const WorkerVersionStatus = $Enums.WorkerVersionStatus
@@ -2,13 +2,13 @@
2
2
  /* !!! This is code generated by Prisma. Do not edit directly. !!! */
3
3
  /* eslint-disable */
4
4
  // @ts-nocheck
5
- /**
5
+ /*
6
6
  * This file exports various common sort, input & filter types that are not directly linked to a particular model.
7
7
  *
8
8
  * 🟢 You can import this file directly.
9
9
  */
10
10
 
11
- import * as runtime from "@prisma/client/runtime/client"
11
+ import type * as runtime from "@prisma/client/runtime/client"
12
12
  import * as $Enums from "./enums.ts"
13
13
  import type * as Prisma from "./internal/prismaNamespace.ts"
14
14
 
@@ -2,11 +2,12 @@
2
2
  /* !!! This is code generated by Prisma. Do not edit directly. !!! */
3
3
  /* eslint-disable */
4
4
  // @ts-nocheck
5
- /**
5
+ /*
6
6
  * This file exports all enum related types from the schema.
7
7
  *
8
8
  * 🟢 You can import this file directly.
9
9
  */
10
+
10
11
  export const InstanceEvaluationStatus = {
11
12
  evaluating: 'evaluating',
12
13
  evaluated: 'evaluated',
@@ -38,6 +39,7 @@ export const OperationStatus = {
38
39
  pending: 'pending',
39
40
  running: 'running',
40
41
  failing: 'failing',
42
+ cancelling: 'cancelling',
41
43
  completed: 'completed',
42
44
  failed: 'failed',
43
45
  cancelled: 'cancelled'