@highstate/backend 0.9.18 → 0.9.19
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-5WVU2AK4.js +1535 -0
- package/dist/chunk-5WVU2AK4.js.map +1 -0
- package/dist/{chunk-OU5OQBLB.js → chunk-I7BWSAN6.js} +3 -28
- package/dist/{chunk-OU5OQBLB.js.map → chunk-I7BWSAN6.js.map} +1 -1
- package/dist/chunk-VB4YL327.js +139 -0
- package/dist/chunk-VB4YL327.js.map +1 -0
- package/dist/database/local/prisma.config.js +26 -0
- package/dist/database/local/prisma.config.js.map +1 -0
- package/dist/highstate.manifest.json +2 -1
- package/dist/index.js +7587 -7291
- package/dist/index.js.map +1 -1
- package/dist/library/package-resolution-worker.js +1 -1
- package/dist/library/package-resolution-worker.js.map +1 -1
- package/dist/library/worker/main.js +35 -29
- package/dist/library/worker/main.js.map +1 -1
- package/dist/shared/index.js +2 -2
- package/package.json +18 -9
- package/prisma/backend/_schema/layout.prisma +7 -0
- package/prisma/backend/_schema/library.prisma +17 -0
- package/prisma/backend/_schema/project.prisma +101 -0
- package/prisma/backend/_schema/pulumi.prisma +17 -0
- package/prisma/backend/postgresql/main.prisma +17 -0
- package/prisma/backend/sqlite/main.prisma +17 -0
- package/prisma/backend/sqlite/migrations/20250817070609_initiial/migration.sql +34 -0
- package/prisma/backend/sqlite/migrations/20250817104948_add_fields/migration.sql +59 -0
- package/prisma/backend/sqlite/migrations/20250818082732_add_models/migration.sql +41 -0
- package/prisma/backend/sqlite/migrations/20250818083106_a/migration.sql +19 -0
- package/prisma/backend/sqlite/migrations/20250818101945_hi/migration.sql +1 -0
- package/prisma/backend/sqlite/migrations/20250819082315_a/migration.sql +5 -0
- package/prisma/backend/sqlite/migrations/migration_lock.toml +3 -0
- package/prisma/project/api-key.prisma +27 -0
- package/prisma/project/artifact.prisma +52 -0
- package/prisma/project/custom-status.prisma +46 -0
- package/prisma/project/evaluation.prisma +35 -0
- package/prisma/project/instance.prisma +160 -0
- package/prisma/project/layout.prisma +23 -0
- package/prisma/project/lock.prisma +18 -0
- package/prisma/project/main.prisma +17 -0
- package/prisma/project/migrations/20250816081310_initial/migration.sql +300 -0
- package/prisma/project/migrations/20250816082523_test/migration.sql +72 -0
- package/prisma/project/migrations/20250818065643_update/migration.sql +42 -0
- package/prisma/project/migrations/20250818070758_a/migration.sql +8 -0
- package/prisma/project/migrations/20250818070913_a/migration.sql +8 -0
- package/prisma/project/migrations/20250818082720_add_motels/migration.sql +11 -0
- package/prisma/project/migrations/20250818112523_hello/migration.sql +35 -0
- package/prisma/project/migrations/20250819082305_a/migration.sql +14 -0
- package/prisma/project/migrations/20250819165004_add_missing_fields/migration.sql +216 -0
- package/prisma/project/migrations/20250819171309_a/migration.sql +22 -0
- package/prisma/project/migrations/20250820113949_a/migration.sql +66 -0
- package/prisma/project/migrations/20250820144256_b/migration.sql +31 -0
- package/prisma/project/migrations/20250820145547_a/migration.sql +24 -0
- package/prisma/project/migrations/20250820182517_b/migration.sql +2 -0
- package/prisma/project/migrations/20250821172324_a/migration.sql +2 -0
- package/prisma/project/migrations/20250822081339_a/migration.sql +219 -0
- package/prisma/project/migrations/20250822083742_b/migration.sql +1 -0
- package/prisma/project/migrations/20250822105134_boom/migration.sql +1 -0
- package/prisma/project/migrations/20250822141028_b/migration.sql +1 -0
- package/prisma/project/migrations/20250822142342_b/migration.sql +16 -0
- package/prisma/project/migrations/20250824072720_a/migration.sql +1 -0
- package/prisma/project/migrations/20250824093656_b/migration.sql +21 -0
- package/prisma/project/migrations/20250825082518_a/migration.sql +1 -0
- package/prisma/project/migrations/20250825085343_b/migration.sql +1 -0
- package/prisma/project/migrations/20250825091312_a/migration.sql +1 -0
- package/prisma/project/migrations/20250903095431_hi/migration.sql +44 -0
- package/prisma/project/migrations/20250903174255_a/migration.sql +24 -0
- package/prisma/project/migrations/20250908095205_hi/migration.sql +18 -0
- package/prisma/project/migrations/20250909155857_hi/migration.sql +15 -0
- package/prisma/project/migrations/migration_lock.toml +3 -0
- package/prisma/project/model.prisma +37 -0
- package/prisma/project/operation.prisma +148 -0
- package/prisma/project/page.prisma +41 -0
- package/prisma/project/secret.prisma +42 -0
- package/prisma/project/service-account.prisma +36 -0
- package/prisma/project/terminal.prisma +90 -0
- package/prisma/project/trigger.prisma +31 -0
- package/prisma/project/unlock-method.prisma +32 -0
- package/prisma/project/worker.prisma +138 -0
- package/src/artifact/abstractions.ts +13 -13
- package/src/artifact/encryption.ts +30 -54
- package/src/artifact/factory.ts +6 -9
- package/src/artifact/local.ts +33 -46
- package/src/business/api-key.ts +24 -36
- package/src/business/artifact.test.ts +978 -0
- package/src/business/artifact.ts +136 -216
- package/src/business/evaluation.ts +328 -0
- package/src/business/index.ts +5 -2
- package/src/business/instance-lock.test.ts +1060 -0
- package/src/business/instance-lock.ts +387 -78
- package/src/business/instance-state.test.ts +735 -0
- package/src/business/instance-state.ts +582 -337
- package/src/business/operation.test.ts +439 -0
- package/src/business/operation.ts +174 -208
- package/src/business/project-model.ts +258 -0
- package/src/business/project-unlock.ts +168 -126
- package/src/business/project.ts +287 -179
- package/src/business/secret.test.ts +465 -130
- package/src/business/secret.ts +186 -217
- package/src/business/settings.test.ts +695 -0
- package/src/business/settings.ts +855 -0
- package/src/business/terminal-session.ts +90 -0
- package/src/business/unit-extra.test.ts +539 -0
- package/src/business/unit-extra.ts +160 -0
- package/src/business/worker.test.ts +356 -579
- package/src/business/worker.ts +238 -339
- package/src/common/codebase.ts +65 -0
- package/src/common/index.ts +3 -5
- package/src/common/logger.ts +5 -0
- package/src/common/utils.ts +4 -3
- package/src/config.ts +10 -11
- package/src/database/_generated/backend/postgresql/client.ts +72 -0
- package/src/database/_generated/backend/postgresql/commonInputTypes.ts +350 -0
- package/src/database/_generated/backend/postgresql/enums.ts +13 -0
- package/src/database/_generated/backend/postgresql/internal/class.ts +320 -0
- package/src/database/_generated/backend/postgresql/internal/prismaNamespace.ts +1238 -0
- package/src/database/_generated/backend/postgresql/models/Library.ts +1263 -0
- package/src/database/_generated/backend/postgresql/models/Project.ts +2175 -0
- package/src/database/_generated/backend/postgresql/models/ProjectModelStorage.ts +1263 -0
- package/src/database/_generated/backend/postgresql/models/ProjectSpace.ts +1602 -0
- package/src/database/_generated/backend/postgresql/models/PulumiBackend.ts +1263 -0
- package/src/database/_generated/backend/postgresql/models/UserWorkspaseLayout.ts +1065 -0
- package/src/database/_generated/backend/postgresql/models.ts +16 -0
- package/src/database/_generated/backend/postgresql/pjtg.ts +182 -0
- package/src/database/_generated/backend/sqlite/client.ts +72 -0
- package/src/database/_generated/backend/sqlite/commonInputTypes.ts +331 -0
- package/src/database/_generated/backend/sqlite/enums.ts +13 -0
- package/src/database/_generated/backend/sqlite/internal/class.ts +318 -0
- package/src/database/_generated/backend/sqlite/internal/prismaNamespace.ts +1207 -0
- package/src/database/_generated/backend/sqlite/models/Library.ts +1261 -0
- package/src/database/_generated/backend/sqlite/models/Project.ts +2169 -0
- package/src/database/_generated/backend/sqlite/models/ProjectModelStorage.ts +1261 -0
- package/src/database/_generated/backend/sqlite/models/ProjectSpace.ts +1599 -0
- package/src/database/_generated/backend/sqlite/models/PulumiBackend.ts +1261 -0
- package/src/database/_generated/backend/sqlite/models/UserWorkspaseLayout.ts +1063 -0
- package/src/database/_generated/backend/sqlite/models.ts +16 -0
- package/src/database/_generated/backend/sqlite/pjtg.ts +182 -0
- package/src/database/_generated/project/client.ts +204 -0
- package/src/database/_generated/project/commonInputTypes.ts +827 -0
- package/src/database/_generated/project/enums.ts +104 -0
- package/src/database/_generated/project/internal/class.ts +479 -0
- package/src/database/_generated/project/internal/prismaNamespace.ts +2974 -0
- package/src/database/_generated/project/models/ApiKey.ts +1506 -0
- package/src/database/_generated/project/models/Artifact.ts +2051 -0
- package/src/database/_generated/project/models/HubModel.ts +1125 -0
- package/src/database/_generated/project/models/InstanceCustomStatus.ts +1713 -0
- package/src/database/_generated/project/models/InstanceEvaluationState.ts +1312 -0
- package/src/database/_generated/project/models/InstanceLock.ts +1268 -0
- package/src/database/_generated/project/models/InstanceModel.ts +1125 -0
- package/src/database/_generated/project/models/InstanceOperationState.ts +1707 -0
- package/src/database/_generated/project/models/InstanceState.ts +4613 -0
- package/src/database/_generated/project/models/Operation.ts +1647 -0
- package/src/database/_generated/project/models/OperationLog.ts +1455 -0
- package/src/database/_generated/project/models/Page.ts +1838 -0
- package/src/database/_generated/project/models/Secret.ts +1692 -0
- package/src/database/_generated/project/models/ServiceAccount.ts +2165 -0
- package/src/database/_generated/project/models/Terminal.ts +2038 -0
- package/src/database/_generated/project/models/TerminalSession.ts +1454 -0
- package/src/database/_generated/project/models/TerminalSessionLog.ts +1280 -0
- package/src/database/_generated/project/models/Trigger.ts +1430 -0
- package/src/database/_generated/project/models/UnlockMethod.ts +1220 -0
- package/src/database/_generated/project/models/UserCompositeViewport.ts +1280 -0
- package/src/database/_generated/project/models/UserProjectViewport.ts +1059 -0
- package/src/database/_generated/project/models/Worker.ts +1459 -0
- package/src/database/_generated/project/models/WorkerUnitRegistration.ts +1524 -0
- package/src/database/_generated/project/models/WorkerVersion.ts +1974 -0
- package/src/database/_generated/project/models/WorkerVersionLog.ts +1318 -0
- package/src/database/_generated/project/models.ts +35 -0
- package/src/database/_generated/project/pjtg.ts +182 -0
- package/src/database/abstractions.ts +19 -0
- package/src/database/factory.ts +37 -0
- package/src/database/index.ts +6 -0
- package/src/database/local/backend.ts +134 -0
- package/src/database/local/index.ts +3 -0
- package/src/database/local/meta.ts +46 -0
- package/src/database/local/prisma.config.ts +25 -0
- package/src/database/local/project.ts +39 -0
- package/src/database/manager.ts +181 -0
- package/src/database/migrate.ts +35 -0
- package/src/database/prisma.ts +56 -0
- package/src/database/well-known.ts +38 -0
- package/src/index.ts +4 -4
- package/src/library/abstractions.ts +3 -5
- package/src/library/factory.ts +1 -1
- package/src/library/local.ts +81 -26
- package/src/library/package-resolution-worker.ts +1 -1
- package/src/library/worker/evaluator.ts +40 -23
- package/src/library/worker/loader.lite.ts +1 -1
- package/src/library/worker/main.ts +3 -10
- package/src/library/worker/protocol.ts +0 -1
- package/src/lock/index.ts +0 -1
- package/src/lock/manager.ts +0 -10
- package/src/orchestrator/manager.ts +190 -104
- package/src/orchestrator/operation-context.ts +357 -0
- package/src/orchestrator/operation-plan.destroy.test.md +357 -0
- package/src/orchestrator/operation-plan.destroy.test.ts +775 -0
- package/src/orchestrator/operation-plan.fixtures.ts +213 -0
- package/src/orchestrator/operation-plan.md +198 -0
- package/src/orchestrator/operation-plan.refresh.test.md +199 -0
- package/src/orchestrator/operation-plan.refresh.test.ts +367 -0
- package/src/orchestrator/operation-plan.ts +709 -0
- package/src/orchestrator/operation-plan.update.test.md +485 -0
- package/src/orchestrator/operation-plan.update.test.ts +1066 -0
- package/src/orchestrator/operation-workset.ts +233 -578
- package/src/orchestrator/operation.ts +435 -948
- package/src/orchestrator/plan-test-builder.ts +267 -0
- package/src/project-model/abstractions.ts +118 -0
- package/src/project-model/backends/codebase.ts +365 -0
- package/src/project-model/backends/database.ts +440 -0
- package/src/project-model/errors.ts +81 -0
- package/src/project-model/factory.ts +24 -0
- package/src/project-model/index.ts +4 -0
- package/src/project-model/utils.test.ts +544 -0
- package/src/project-model/utils.ts +242 -0
- package/src/pubsub/abstractions.ts +10 -1
- package/src/pubsub/factory.ts +4 -4
- package/src/pubsub/index.ts +1 -0
- package/src/pubsub/manager.ts +29 -13
- package/src/pubsub/memory.ts +31 -0
- package/src/runner/abstractions.ts +33 -41
- package/src/runner/artifact-env.ts +19 -8
- package/src/runner/factory.ts +6 -6
- package/src/runner/force-abort.ts +3 -6
- package/src/runner/local.ts +64 -67
- package/src/runner/pulumi.ts +23 -63
- package/src/services.ts +181 -123
- package/src/shared/models/backend/index.ts +3 -1
- package/src/shared/models/backend/library.ts +9 -1
- package/src/shared/models/backend/project.ts +43 -42
- package/src/shared/models/backend/pulumi.ts +14 -0
- package/src/shared/models/backend/unlock-method.ts +1 -1
- package/src/shared/models/backend/well-known.ts +58 -0
- package/src/shared/models/base.ts +40 -26
- package/src/shared/models/errors.ts +82 -1
- package/src/shared/models/index.ts +3 -2
- package/src/shared/models/prisma.ts +36 -0
- package/src/shared/models/project/api-key.ts +37 -59
- package/src/shared/models/project/artifact.ts +16 -76
- package/src/shared/models/project/custom-status.ts +12 -0
- package/src/shared/models/project/index.ts +8 -7
- package/src/shared/models/project/lock.ts +10 -78
- package/src/shared/models/project/model.ts +19 -1
- package/src/shared/models/project/operation.ts +222 -99
- package/src/shared/models/project/page.ts +37 -48
- package/src/shared/models/project/secret.ts +29 -89
- package/src/shared/models/project/service-account.ts +12 -17
- package/src/shared/models/project/state.ts +100 -407
- package/src/shared/models/project/terminal.ts +75 -88
- package/src/shared/models/project/trigger.ts +13 -49
- package/src/shared/models/project/unlock-method.ts +20 -26
- package/src/shared/models/project/worker.ts +89 -90
- package/src/shared/resolvers/graph-resolver.ts +21 -0
- package/src/shared/resolvers/index.ts +1 -1
- package/src/shared/resolvers/input-hash.ts +24 -14
- package/src/shared/resolvers/input.ts +1 -1
- package/src/shared/resolvers/registry.ts +5 -4
- package/src/shared/resolvers/state.ts +12 -1
- package/src/shared/resolvers/validation.ts +7 -3
- package/src/shared/utils/index.ts +1 -2
- package/src/shared/utils/promise-tracker.ts +30 -3
- package/src/terminal/abstractions.ts +1 -1
- package/src/terminal/docker.ts +3 -3
- package/src/terminal/manager.ts +102 -118
- package/src/test-utils/database.ts +119 -0
- package/src/test-utils/index.ts +2 -0
- package/src/test-utils/services.ts +134 -0
- package/src/unlock/abstractions.ts +5 -23
- package/src/unlock/memory.ts +9 -14
- package/src/worker/abstractions.ts +7 -4
- package/src/worker/docker.ts +14 -19
- package/src/worker/manager.ts +366 -97
- package/dist/chunk-NAAIDR4U.js +0 -8499
- package/dist/chunk-NAAIDR4U.js.map +0 -1
- package/dist/chunk-Y7DXREVO.js +0 -1745
- package/dist/chunk-Y7DXREVO.js.map +0 -1
- package/dist/magic-string.es-5ABAC4JN.js +0 -1292
- package/dist/magic-string.es-5ABAC4JN.js.map +0 -1
- package/src/business/__traces__/secret/update-instance-secrets/create-and-delete-secrets-simultaneously.md +0 -356
- package/src/business/__traces__/secret/update-instance-secrets/create-new-secrets-for-instance.md +0 -274
- package/src/business/__traces__/secret/update-instance-secrets/delete-existing-secrets.md +0 -223
- package/src/business/__traces__/secret/update-instance-secrets/no-op-when-no-changes.md +0 -147
- package/src/business/__traces__/secret/update-instance-secrets/update-existing-secrets.md +0 -280
- package/src/business/__traces__/worker/update-unit-registrations/add-new-unit-registration-when-other-exists.md +0 -360
- package/src/business/__traces__/worker/update-unit-registrations/add-new-unit-registration.md +0 -215
- package/src/business/__traces__/worker/update-unit-registrations/create-multiple-workers-with-different-identities.md +0 -427
- package/src/business/__traces__/worker/update-unit-registrations/handle-nonexistent-registration-id-gracefully.md +0 -217
- package/src/business/__traces__/worker/update-unit-registrations/no-op-when-no-changes.md +0 -132
- package/src/business/__traces__/worker/update-unit-registrations/recreate-worker-when-image-changes.md +0 -454
- package/src/business/__traces__/worker/update-unit-registrations/recreate-worker-when-image-version-changes.md +0 -426
- package/src/business/__traces__/worker/update-unit-registrations/recreate-worker-with-same-identity-reuses-service-account.md +0 -372
- package/src/business/__traces__/worker/update-unit-registrations/remove-one-of-multiple-unit-registrations.md +0 -383
- package/src/business/__traces__/worker/update-unit-registrations/remove-unit-registration.md +0 -245
- package/src/business/__traces__/worker/update-unit-registrations/update-existing-unit-registration-when-params-change.md +0 -174
- package/src/business/__traces__/worker/update-unit-registrations/update-params-and-image-simultaneously.md +0 -432
- package/src/business/__traces__/worker/update-unit-registrations/worker-with-multiple-registrations-not-deleted-when-one-removed.md +0 -220
- package/src/business/backend-unlock.ts +0 -10
- package/src/common/clock.ts +0 -18
- package/src/common/performance.ts +0 -44
- package/src/common/random.ts +0 -68
- package/src/common/test/index.ts +0 -2
- package/src/common/test/render.ts +0 -98
- package/src/common/test/tracer.ts +0 -359
- package/src/hotstate/abstractions.ts +0 -48
- package/src/hotstate/factory.ts +0 -17
- package/src/hotstate/index.ts +0 -3
- package/src/hotstate/manager.ts +0 -192
- package/src/hotstate/memory.ts +0 -100
- package/src/hotstate/validation.ts +0 -100
- package/src/lock/test.ts +0 -108
- package/src/project/abstractions.ts +0 -78
- package/src/project/evaluation.ts +0 -248
- package/src/project/factory.ts +0 -11
- package/src/project/index.ts +0 -3
- package/src/project/local.ts +0 -417
- package/src/pubsub/local.ts +0 -36
- package/src/pubsub/validation.ts +0 -33
- package/src/shared/utils/args.ts +0 -25
- package/src/state/abstractions.ts +0 -289
- package/src/state/encryption.ts +0 -98
- package/src/state/factory.ts +0 -20
- package/src/state/index.ts +0 -7
- package/src/state/local/backend.ts +0 -106
- package/src/state/local/collection.ts +0 -361
- package/src/state/local/index.ts +0 -2
- package/src/state/manager.ts +0 -890
- package/src/state/memory/backend.ts +0 -70
- package/src/state/memory/collection.ts +0 -270
- package/src/state/memory/index.ts +0 -2
- package/src/state/repository/index.ts +0 -2
- package/src/state/repository/repository.index.ts +0 -193
- package/src/state/repository/repository.ts +0 -507
- package/src/state/test.ts +0 -457
- /package/src/{state → database/local}/keyring.ts +0 -0
|
@@ -1,41 +1,42 @@
|
|
|
1
1
|
import type { ObjectMeta } from "@highstate/contract"
|
|
2
|
+
import { constant, mapValues } from "remeda"
|
|
2
3
|
import { z } from "zod"
|
|
3
4
|
|
|
4
5
|
export function hasObjectMeta(value: unknown): value is { meta: ObjectMeta } {
|
|
5
6
|
return typeof value === "object" && value !== null && "meta" in value
|
|
6
7
|
}
|
|
7
8
|
|
|
9
|
+
const sortBySchema = z.object({
|
|
10
|
+
key: z.string(),
|
|
11
|
+
order: z.enum(["asc", "desc"]),
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
export type GenericEntity = {
|
|
15
|
+
id: string
|
|
16
|
+
meta: ObjectMeta
|
|
17
|
+
createdAt?: Date
|
|
18
|
+
}
|
|
19
|
+
|
|
8
20
|
export const collectionQuerySchema = z.object({
|
|
9
21
|
/**
|
|
10
22
|
* The search string to filter documents by display name, description, or other text fields.
|
|
11
|
-
*
|
|
12
|
-
* Not implemented yet.
|
|
13
23
|
*/
|
|
14
24
|
search: z.string().optional(),
|
|
15
25
|
|
|
16
26
|
/**
|
|
17
|
-
* The
|
|
18
|
-
*
|
|
19
|
-
* Cannot be used with `cursor`.
|
|
20
|
-
*/
|
|
21
|
-
skip: z.number().int().nonnegative().optional(),
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* The sorting order for the results.
|
|
27
|
+
* The sorting configuration for the results.
|
|
25
28
|
*
|
|
26
|
-
*
|
|
29
|
+
* Can be a single sort field or an array of sort fields.
|
|
30
|
+
* Each sort field contains the key and order.
|
|
27
31
|
*/
|
|
28
|
-
|
|
32
|
+
sortBy: z.array(sortBySchema).optional(),
|
|
29
33
|
|
|
30
34
|
/**
|
|
31
|
-
* The
|
|
32
|
-
*
|
|
33
|
-
* If "asc" sorting is used, this will return results after this ID.
|
|
34
|
-
* Otherwise, it will return results before this ID.
|
|
35
|
+
* The number of items to skip.
|
|
35
36
|
*
|
|
36
|
-
*
|
|
37
|
+
* Defaults to 0 if not specified.
|
|
37
38
|
*/
|
|
38
|
-
|
|
39
|
+
skip: z.number().int().nonnegative().default(0).optional(),
|
|
39
40
|
|
|
40
41
|
/**
|
|
41
42
|
* The count of documents to return.
|
|
@@ -43,14 +44,21 @@ export const collectionQuerySchema = z.object({
|
|
|
43
44
|
* Defaults to 20 if not specified.
|
|
44
45
|
* Maximum value is 100.
|
|
45
46
|
*/
|
|
46
|
-
count: z.number().int().
|
|
47
|
+
count: z.number().int().positive().max(100).default(20).optional(),
|
|
47
48
|
})
|
|
48
49
|
|
|
49
50
|
export type CollectionQuery = z.infer<typeof collectionQuerySchema>
|
|
50
51
|
|
|
52
|
+
export function collectionQueryResult<TSchema extends z.ZodType>(schema: TSchema) {
|
|
53
|
+
return z.object({
|
|
54
|
+
items: z.array(schema),
|
|
55
|
+
total: z.number().int().nonnegative(),
|
|
56
|
+
})
|
|
57
|
+
}
|
|
58
|
+
|
|
51
59
|
export type CollectionQueryResult<T> = {
|
|
52
60
|
/**
|
|
53
|
-
* The list of objects matching the query.
|
|
61
|
+
* The list of objects matching the query and restricted by pagination.
|
|
54
62
|
*/
|
|
55
63
|
items: T[]
|
|
56
64
|
|
|
@@ -58,11 +66,17 @@ export type CollectionQueryResult<T> = {
|
|
|
58
66
|
* The total number of documents matching the query.
|
|
59
67
|
*/
|
|
60
68
|
total: number
|
|
69
|
+
}
|
|
61
70
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
71
|
+
/**
|
|
72
|
+
* Creates a selection object using the provided schema.
|
|
73
|
+
*
|
|
74
|
+
* It can be used in zod pick or prisma select.
|
|
75
|
+
*
|
|
76
|
+
* @param schema The Zod schema to create the selection object from.
|
|
77
|
+
*/
|
|
78
|
+
export function forSchema<TSchema extends z.ZodObject>(
|
|
79
|
+
schema: TSchema,
|
|
80
|
+
): { [K in keyof TSchema["shape"]]: true } {
|
|
81
|
+
return mapValues(schema.shape, constant(true)) as { [K in keyof TSchema["shape"]]: true }
|
|
68
82
|
}
|
|
@@ -1,5 +1,86 @@
|
|
|
1
|
-
export class
|
|
1
|
+
export class BackendError extends Error {
|
|
2
|
+
constructor(message: string, cause?: unknown) {
|
|
3
|
+
super(message, { cause })
|
|
4
|
+
this.name = "BackendError"
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export class AccessError extends BackendError {
|
|
2
9
|
constructor(message: string) {
|
|
3
10
|
super(message)
|
|
11
|
+
this.name = "AccessError"
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export class ProjectLockedError extends AccessError {
|
|
16
|
+
constructor(projectId: string) {
|
|
17
|
+
super(`The project with ID "${projectId}" is locked, decryption is not possible.`)
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export class ProjectNotFoundError extends BackendError {
|
|
22
|
+
constructor(projectId: string) {
|
|
23
|
+
super(`Project with ID "${projectId}" not found.`)
|
|
24
|
+
this.name = "ProjectNotFoundError"
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export class CannotDeleteLastUnlockMethodError extends BackendError {
|
|
29
|
+
constructor(projectId: string) {
|
|
30
|
+
super(`Refused to delete the last unlock method for project "${projectId}".`)
|
|
31
|
+
this.name = "CannotDeleteLastUnlockMethodError"
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export class InstanceNotFoundError extends BackendError {
|
|
36
|
+
constructor(projectId: string, instanceId: string) {
|
|
37
|
+
super(`Instance with ID "${instanceId}" not found in project "${projectId}".`)
|
|
38
|
+
this.name = "InstanceNotFoundError"
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export class InvalidInstanceKindError extends BackendError {
|
|
43
|
+
constructor(projectId: string, instanceId: string, expectedKind: string, actualKind: string) {
|
|
44
|
+
super(
|
|
45
|
+
`Instance "${instanceId}" in project "${projectId}" has kind "${actualKind}", but expected "${expectedKind}".`,
|
|
46
|
+
)
|
|
47
|
+
this.name = "InvalidInstanceKindError"
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export class OperationNotFoundError extends BackendError {
|
|
52
|
+
constructor(projectId: string, operationId: string) {
|
|
53
|
+
super(`Operation with ID "${operationId}" not found in project "${projectId}".`)
|
|
54
|
+
this.name = "OperationNotFoundError"
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export class InstanceLockLostError extends BackendError {
|
|
59
|
+
constructor(projectId: string, instanceIds: string[], token: string) {
|
|
60
|
+
super(
|
|
61
|
+
`Instance lock lost for instances [${instanceIds.join(", ")}] in project "${projectId}" with token "${token}".`,
|
|
62
|
+
)
|
|
63
|
+
this.name = "InstanceLockLostError"
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export class InstanceStateNotFoundError extends BackendError {
|
|
68
|
+
constructor(projectId: string, instanceId: string) {
|
|
69
|
+
super(`State for instance with ID "${instanceId}" not found in project "${projectId}".`)
|
|
70
|
+
this.name = "InstanceStateNotFoundError"
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export class InstanceLockedError extends BackendError {
|
|
75
|
+
constructor(projectId: string, instanceId: string) {
|
|
76
|
+
super(`Instance with ID "${instanceId}" in project "${projectId}" is locked.`)
|
|
77
|
+
this.name = "InstanceLockedError"
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export class WorkerVersionNotFoundError extends BackendError {
|
|
82
|
+
constructor(projectId: string, workerVersionId: string) {
|
|
83
|
+
super(`Worker version with ID "${workerVersionId}" not found in project "${projectId}".`)
|
|
84
|
+
this.name = "WorkerVersionNotFoundError"
|
|
4
85
|
}
|
|
5
86
|
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type * as contract from "@highstate/contract"
|
|
2
|
+
import type * as shared from "../../shared"
|
|
3
|
+
|
|
4
|
+
declare global {
|
|
5
|
+
namespace PrismaJson {
|
|
6
|
+
type LibrarySpec = shared.LibrarySpec
|
|
7
|
+
type CommonObjectMeta = contract.CommonObjectMeta
|
|
8
|
+
|
|
9
|
+
type PulumiBackendSpec = shared.PulumiBackendSpec
|
|
10
|
+
|
|
11
|
+
type ProjectModelStorageSpec = shared.ProjectModelStorageSpec
|
|
12
|
+
|
|
13
|
+
type InstanceId = contract.InstanceId
|
|
14
|
+
type NullableInstanceId = contract.InstanceId | null
|
|
15
|
+
type InstanceIds = contract.InstanceId[]
|
|
16
|
+
type InstanceModel = contract.InstanceModel
|
|
17
|
+
|
|
18
|
+
type InstanceArgs = Record<string, unknown>
|
|
19
|
+
type InstanceResolvedInputs = Record<string, contract.InstanceInput[]>
|
|
20
|
+
type UnlockMethodMeta = shared.UnlockMethodMeta
|
|
21
|
+
type ProjectUnlockSuite = shared.ProjectUnlockSuite
|
|
22
|
+
|
|
23
|
+
type InstanceStatusFields = contract.InstanceStatusField[]
|
|
24
|
+
|
|
25
|
+
type OperationMeta = shared.OperationMeta
|
|
26
|
+
type OperationOptions = shared.OperationOptions
|
|
27
|
+
type OperationPhase = shared.OperationPhase
|
|
28
|
+
|
|
29
|
+
type WorkerUnitRegistrationParams = Record<string, unknown>
|
|
30
|
+
|
|
31
|
+
type ServiceAccountMeta = contract.ServiceAccountMeta
|
|
32
|
+
|
|
33
|
+
type ApiKeyMeta = shared.ApiKeyMeta
|
|
34
|
+
type InstanceArtifactIds = Record<string, string[]>
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -1,65 +1,43 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
* The 256-bit random token used to authenticate API requests.
|
|
26
|
-
*/
|
|
27
|
-
token: z.string(),
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* The scopes granted to this API key.
|
|
31
|
-
*/
|
|
32
|
-
scopes: z.array(projectAccessScope),
|
|
1
|
+
import {
|
|
2
|
+
commonObjectMetaSchema,
|
|
3
|
+
objectMetaSchema,
|
|
4
|
+
serviceAccountMetaSchema,
|
|
5
|
+
z,
|
|
6
|
+
} from "@highstate/contract"
|
|
7
|
+
import { collectionQuerySchema } from "../base"
|
|
8
|
+
import type { ServiceAccount } from "../../../database"
|
|
9
|
+
|
|
10
|
+
export const apiKeyMetaSchema = objectMetaSchema
|
|
11
|
+
.pick({
|
|
12
|
+
title: true,
|
|
13
|
+
description: true,
|
|
14
|
+
})
|
|
15
|
+
.required({ title: true })
|
|
16
|
+
|
|
17
|
+
export type ApiKeyMeta = z.infer<typeof apiKeyMetaSchema>
|
|
18
|
+
|
|
19
|
+
export const apiKeyOutputSchema = z.object({
|
|
20
|
+
id: z.cuid2(),
|
|
21
|
+
meta: commonObjectMetaSchema,
|
|
22
|
+
serviceAccountId: z.cuid2(),
|
|
23
|
+
serviceAccountMeta: serviceAccountMetaSchema.nullable(),
|
|
24
|
+
createdAt: z.date(),
|
|
33
25
|
})
|
|
34
26
|
|
|
35
|
-
export type
|
|
36
|
-
export type ProjectAccessScope = z.infer<typeof projectAccessScope>
|
|
37
|
-
export type ProjectApiKey = z.infer<typeof projectApiKeySchema>
|
|
27
|
+
export type ApiKeyOutput = z.infer<typeof apiKeyOutputSchema>
|
|
38
28
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export function validateInstanceAccess(
|
|
44
|
-
apiKey: ProjectApiKey,
|
|
45
|
-
actions: InstanceAction[],
|
|
46
|
-
instanceIds: string[],
|
|
47
|
-
): boolean {
|
|
48
|
-
return apiKey.scopes
|
|
49
|
-
.filter(scope => scope.type === "instance")
|
|
50
|
-
.some(scope => hasAll(scope.actions, actions) && hasAll(scope.instanceIds, instanceIds))
|
|
51
|
-
}
|
|
29
|
+
export const apiKeyQuerySchema = collectionQuerySchema.extend({
|
|
30
|
+
serviceAccountId: z.string().optional(),
|
|
31
|
+
})
|
|
52
32
|
|
|
53
|
-
type
|
|
54
|
-
[K in TType]: Record<(ProjectAccessScope & { type: K })["actions"][number], string>
|
|
55
|
-
}
|
|
33
|
+
export type ApiKeyQuery = z.infer<typeof apiKeyQuerySchema>
|
|
56
34
|
|
|
57
|
-
export
|
|
58
|
-
"
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
35
|
+
export function toApiKeyOutput(
|
|
36
|
+
apiKey: Omit<ApiKeyOutput, "serviceAccountMeta">,
|
|
37
|
+
serviceAccount?: Pick<ServiceAccount, "meta"> | null,
|
|
38
|
+
): ApiKeyOutput {
|
|
39
|
+
return {
|
|
40
|
+
...apiKey,
|
|
41
|
+
serviceAccountMeta: serviceAccount?.meta ?? null,
|
|
42
|
+
}
|
|
65
43
|
}
|
|
@@ -1,83 +1,23 @@
|
|
|
1
|
+
import { commonObjectMetaSchema } from "@highstate/contract"
|
|
1
2
|
import { z } from "zod"
|
|
2
|
-
import {
|
|
3
|
-
import { objectMetaSchema } from "@highstate/contract"
|
|
3
|
+
import { collectionQuerySchema } from "../base"
|
|
4
4
|
|
|
5
|
-
export const
|
|
6
|
-
z.
|
|
7
|
-
type: z.literal("instance"),
|
|
8
|
-
instanceId: z.string(),
|
|
9
|
-
}),
|
|
10
|
-
z.object({
|
|
11
|
-
type: z.literal("terminal"),
|
|
12
|
-
terminalId: z.string(),
|
|
13
|
-
}),
|
|
14
|
-
z.object({
|
|
15
|
-
type: z.literal("service-account"),
|
|
16
|
-
serviceAccountId: z.string(),
|
|
17
|
-
}),
|
|
18
|
-
])
|
|
19
|
-
|
|
20
|
-
export type ArtifactUsage = z.infer<typeof artifactUsageSchema>
|
|
21
|
-
|
|
22
|
-
export function compareArtifactUsage(a: ArtifactUsage, b: ArtifactUsage): boolean {
|
|
23
|
-
if (a.type === "instance" && b.type === "instance") {
|
|
24
|
-
return a.instanceId === b.instanceId
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
if (a.type === "terminal" && b.type === "terminal") {
|
|
28
|
-
return a.terminalId === b.terminalId
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
if (a.type === "service-account" && b.type === "service-account") {
|
|
32
|
-
return a.serviceAccountId === b.serviceAccountId
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return false
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* File metadata schema.
|
|
40
|
-
*/
|
|
41
|
-
export const fileMetaSchema = z.object({
|
|
42
|
-
name: z.string(),
|
|
43
|
-
size: z.number().optional(),
|
|
44
|
-
isBinary: z.boolean().optional(),
|
|
45
|
-
mode: z.number().optional(),
|
|
46
|
-
}) satisfies z.ZodType<FileMeta>
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Complete artifact schema for database storage.
|
|
50
|
-
* Contains all artifact information.
|
|
51
|
-
*/
|
|
52
|
-
export const artifactSchema = z.object({
|
|
53
|
-
/**
|
|
54
|
-
* The UUIDv7 of the artifact generated when the artifact with unique content is first stored.
|
|
55
|
-
*/
|
|
56
|
-
id: z.uuidv7(),
|
|
57
|
-
|
|
58
|
-
meta: objectMetaSchema,
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* The SHA-256 hash of the artifact content before encryption.
|
|
62
|
-
*/
|
|
5
|
+
export const artifactOutputSchema = z.object({
|
|
6
|
+
id: z.cuid2(),
|
|
63
7
|
hash: z.string(),
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* The list of usages of this artifact.
|
|
67
|
-
*
|
|
68
|
-
* When became empty, the artifact is garbage collected.
|
|
69
|
-
*/
|
|
70
|
-
usages: artifactUsageSchema.array(),
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* The size of the unencrypted artifact archive in bytes.
|
|
74
|
-
*/
|
|
75
8
|
size: z.number(),
|
|
9
|
+
meta: commonObjectMetaSchema,
|
|
10
|
+
createdAt: z.date(),
|
|
11
|
+
updatedAt: z.date(),
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
export type ArtifactOutput = z.infer<typeof artifactOutputSchema>
|
|
76
15
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
16
|
+
export const artifactQuerySchema = collectionQuerySchema.extend({
|
|
17
|
+
stateId: z.string().optional(),
|
|
18
|
+
serviceAccountId: z.string().optional(),
|
|
19
|
+
terminalId: z.string().optional(),
|
|
20
|
+
pageId: z.string().optional(),
|
|
81
21
|
})
|
|
82
22
|
|
|
83
|
-
export type
|
|
23
|
+
export type ArtifactQuery = z.infer<typeof artifactQuerySchema>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { commonObjectMetaSchema } from "@highstate/contract"
|
|
2
|
+
import { z } from "zod"
|
|
3
|
+
|
|
4
|
+
export const instanceCustomStatusInputSchema = z.object({
|
|
5
|
+
name: z.string(),
|
|
6
|
+
meta: commonObjectMetaSchema,
|
|
7
|
+
value: z.string(),
|
|
8
|
+
message: z.string().optional(),
|
|
9
|
+
order: z.number().min(0).max(100).optional(),
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
export type InstanceCustomStatusInput = z.infer<typeof instanceCustomStatusInputSchema>
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
+
export * from "./api-key"
|
|
2
|
+
export * from "./artifact"
|
|
3
|
+
export * from "./custom-status"
|
|
4
|
+
export * from "./lock"
|
|
1
5
|
export * from "./model"
|
|
2
|
-
export * from "./state"
|
|
3
6
|
export * from "./operation"
|
|
4
|
-
export * from "./terminal"
|
|
5
7
|
export * from "./page"
|
|
6
|
-
export * from "./artifact"
|
|
7
|
-
export * from "./trigger"
|
|
8
|
-
export * from "./unlock-method"
|
|
9
8
|
export * from "./secret"
|
|
10
|
-
export * from "./lock"
|
|
11
9
|
export * from "./service-account"
|
|
10
|
+
export * from "./state"
|
|
11
|
+
export * from "./terminal"
|
|
12
|
+
export * from "./trigger"
|
|
13
|
+
export * from "./unlock-method"
|
|
12
14
|
export * from "./worker"
|
|
13
|
-
export * from "./api-key"
|
|
@@ -1,91 +1,23 @@
|
|
|
1
|
+
import { commonObjectMetaSchema } from "@highstate/contract"
|
|
1
2
|
import { z } from "zod"
|
|
2
|
-
import { instanceIdSchema, objectMetaSchema } from "@highstate/contract"
|
|
3
3
|
|
|
4
|
-
export const
|
|
5
|
-
z.
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* The operation ID. Will be used to fetch the operation and detect whether it is still running or lost.
|
|
10
|
-
*/
|
|
11
|
-
operationId: z.string(),
|
|
12
|
-
}),
|
|
13
|
-
z.object({
|
|
14
|
-
type: z.literal("evaluation"),
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* The internal evaluation ID that is used to detect lost evaluations and restart them.
|
|
18
|
-
*/
|
|
19
|
-
evaluationId: z.string(),
|
|
20
|
-
}),
|
|
21
|
-
z.object({
|
|
22
|
-
type: z.literal("custom"),
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* The ID of the party that holds the lock.
|
|
26
|
-
*
|
|
27
|
-
* Each locker must only manage the locks it has created.
|
|
28
|
-
*/
|
|
29
|
-
lockerId: z.string(),
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* The ID of the lock provided by the locker.
|
|
33
|
-
*
|
|
34
|
-
* Must be unique across all locks in the locker system.
|
|
35
|
-
*/
|
|
36
|
-
lockId: z.string(),
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* The optional payload provided by the locker.
|
|
40
|
-
*
|
|
41
|
-
* Can be used to store additional information about the lock,
|
|
42
|
-
* like the ID of the lock in the locker system,
|
|
43
|
-
* or any other metadata that is relevant to the lock.
|
|
44
|
-
*/
|
|
45
|
-
payload: z.record(z.string(), z.string()).optional(),
|
|
46
|
-
}),
|
|
47
|
-
])
|
|
48
|
-
|
|
49
|
-
export const instanceLockSchema = z.object({
|
|
50
|
-
id: instanceIdSchema,
|
|
51
|
-
meta: objectMetaSchema,
|
|
52
|
-
spec: instanceLockSpecSchema,
|
|
4
|
+
export const instanceLockOutputSchema = z.object({
|
|
5
|
+
stateId: z.cuid2(),
|
|
6
|
+
meta: commonObjectMetaSchema,
|
|
7
|
+
acquiredAt: z.date(),
|
|
53
8
|
})
|
|
54
9
|
|
|
55
|
-
export type
|
|
56
|
-
export type InstanceLockSpec = z.infer<typeof instanceLockSpecSchema>
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Compares two instance lock specifications for equality.
|
|
60
|
-
*
|
|
61
|
-
* @param a The first instance lock specification to compare.
|
|
62
|
-
* @param b The second instance lock specification to compare.
|
|
63
|
-
*
|
|
64
|
-
* @returns True if both specifications are of the same type and have matching identifiers, false otherwise.
|
|
65
|
-
*/
|
|
66
|
-
export function compareInstanceLockSpecs(a: InstanceLockSpec, b: InstanceLockSpec): boolean {
|
|
67
|
-
if (a.type === "operation" && b.type === "operation") {
|
|
68
|
-
return a.operationId === b.operationId
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
if (a.type === "evaluation" && b.type === "evaluation") {
|
|
72
|
-
return a.evaluationId === b.evaluationId
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
if (a.type === "custom" && b.type === "custom") {
|
|
76
|
-
return a.lockerId === b.lockerId && a.lockId === b.lockId
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
return false
|
|
80
|
-
}
|
|
10
|
+
export type InstanceLockOutput = z.infer<typeof instanceLockOutputSchema>
|
|
81
11
|
|
|
82
12
|
export const instanceLockEventSchema = z.discriminatedUnion("type", [
|
|
83
13
|
z.object({
|
|
84
14
|
type: z.literal("locked"),
|
|
85
|
-
locks:
|
|
15
|
+
locks: instanceLockOutputSchema.array(),
|
|
86
16
|
}),
|
|
87
17
|
z.object({
|
|
88
18
|
type: z.literal("unlocked"),
|
|
89
|
-
|
|
19
|
+
stateIds: z.array(z.string()),
|
|
90
20
|
}),
|
|
91
21
|
])
|
|
22
|
+
|
|
23
|
+
export type InstanceLockEvent = z.infer<typeof instanceLockEventSchema>
|
|
@@ -1,14 +1,32 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
type HubModel,
|
|
3
|
+
hubModelSchema,
|
|
4
|
+
type InstanceModel,
|
|
5
|
+
instanceIdSchema,
|
|
6
|
+
instanceModelSchema,
|
|
7
|
+
} from "@highstate/contract"
|
|
2
8
|
import { z } from "zod"
|
|
3
9
|
|
|
4
10
|
export const projectModelEventSchema = z.object({
|
|
5
11
|
updatedInstances: instanceModelSchema.array().optional(),
|
|
6
12
|
updatedHubs: hubModelSchema.array().optional(),
|
|
7
13
|
updatedVirtualInstances: instanceModelSchema.array().optional(),
|
|
14
|
+
updatedGhostInstances: instanceModelSchema.array().optional(),
|
|
8
15
|
|
|
9
16
|
deletedInstanceIds: instanceIdSchema.array().optional(),
|
|
10
17
|
deletedHubIds: z.string().array().optional(),
|
|
11
18
|
deletedVirtualInstanceIds: instanceIdSchema.array().optional(),
|
|
19
|
+
deletedGhostInstanceIds: instanceIdSchema.array().optional(),
|
|
12
20
|
})
|
|
13
21
|
|
|
14
22
|
export type ProjectNodeEvent = z.infer<typeof projectModelEventSchema>
|
|
23
|
+
|
|
24
|
+
export type ProjectModel = {
|
|
25
|
+
instances: InstanceModel[]
|
|
26
|
+
hubs: HubModel[]
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export type FullProjectModel = ProjectModel & {
|
|
30
|
+
virtualInstances: InstanceModel[]
|
|
31
|
+
ghostInstances: InstanceModel[]
|
|
32
|
+
}
|