@highstate/backend 0.19.1 → 0.21.1
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-b05q6fm2.js +37 -0
- package/dist/{chunk-V2NILDHS.js → chunk-gxjwa93h.js} +704 -604
- package/dist/{chunk-X2WG3WGL.js → chunk-vzdz6chj.js} +18 -15
- package/dist/highstate.manifest.json +4 -4
- package/dist/index.js +7350 -3514
- package/dist/library/package-resolution-worker.js +121 -10
- package/dist/library/worker/main.js +31 -17
- package/dist/shared/index.js +254 -4
- package/package.json +19 -20
- package/prisma/backend/_schema/object.prisma +12 -0
- package/prisma/backend/sqlite/migrations/20260222113554_add_object_tracking/migration.sql +7 -0
- package/prisma/project/artifact.prisma +3 -0
- package/prisma/project/entity.prisma +125 -0
- package/prisma/project/instance.prisma +6 -0
- package/prisma/project/migrations/20260301210131_add_entity_tracking/migration.sql +70 -0
- package/prisma/project/migrations/20260302212734_add_resource_hooks_flag/migration.sql +1 -0
- package/prisma/project/operation.prisma +3 -0
- package/src/artifact/factory.ts +3 -2
- package/src/business/artifact.test.ts +22 -2
- package/src/business/artifact.ts +7 -1
- package/src/business/entity-snapshot.test.ts +684 -0
- package/src/business/entity-snapshot.ts +904 -0
- package/src/business/evaluation.test.ts +56 -0
- package/src/business/evaluation.ts +102 -22
- package/src/business/global-search.test.ts +344 -0
- package/src/business/global-search.ts +902 -0
- package/src/business/index.ts +4 -0
- package/src/business/instance-lock.ts +58 -74
- package/src/business/instance-state.test.ts +15 -1
- package/src/business/instance-state.ts +37 -14
- package/src/business/object-ref-index.test.ts +140 -0
- package/src/business/object-ref-index.ts +193 -0
- package/src/business/operation.test.ts +15 -1
- package/src/business/operation.ts +4 -0
- package/src/business/project-model.ts +154 -13
- package/src/business/project-unlock.ts +25 -2
- package/src/business/project.ts +9 -0
- package/src/business/secret.test.ts +35 -2
- package/src/business/secret.ts +32 -9
- package/src/business/settings.ts +761 -0
- package/src/business/unit-output.test.ts +477 -0
- package/src/business/unit-output.ts +461 -0
- package/src/business/worker.ts +55 -4
- package/src/database/_generated/backend/postgresql/browser.ts +6 -0
- package/src/database/_generated/backend/postgresql/client.ts +6 -0
- package/src/database/_generated/backend/postgresql/internal/class.ts +23 -5
- package/src/database/_generated/backend/postgresql/internal/prismaNamespace.ts +89 -5
- package/src/database/_generated/backend/postgresql/internal/prismaNamespaceBrowser.ts +9 -0
- package/src/database/_generated/backend/postgresql/models/Object.ts +1076 -0
- package/src/database/_generated/backend/postgresql/models.ts +1 -0
- package/src/database/_generated/backend/sqlite/browser.ts +6 -0
- package/src/database/_generated/backend/sqlite/client.ts +6 -0
- package/src/database/_generated/backend/sqlite/internal/class.ts +23 -5
- package/src/database/_generated/backend/sqlite/internal/prismaNamespace.ts +89 -5
- package/src/database/_generated/backend/sqlite/internal/prismaNamespaceBrowser.ts +9 -0
- package/src/database/_generated/backend/sqlite/models/Object.ts +1074 -0
- package/src/database/_generated/backend/sqlite/models.ts +1 -0
- package/src/database/_generated/project/browser.ts +23 -0
- package/src/database/_generated/project/client.ts +23 -0
- package/src/database/_generated/project/commonInputTypes.ts +87 -53
- package/src/database/_generated/project/enums.ts +8 -0
- package/src/database/_generated/project/internal/class.ts +53 -5
- package/src/database/_generated/project/internal/prismaNamespace.ts +367 -13
- package/src/database/_generated/project/internal/prismaNamespaceBrowser.ts +48 -1
- package/src/database/_generated/project/models/Artifact.ts +199 -11
- package/src/database/_generated/project/models/Entity.ts +1274 -0
- package/src/database/_generated/project/models/EntitySnapshot.ts +2389 -0
- package/src/database/_generated/project/models/EntitySnapshotContent.ts +1260 -0
- package/src/database/_generated/project/models/EntitySnapshotReference.ts +1449 -0
- package/src/database/_generated/project/models/InstanceState.ts +361 -1
- package/src/database/_generated/project/models/Operation.ts +148 -3
- package/src/database/_generated/project/models/OperationLog.ts +0 -4
- package/src/database/_generated/project/models.ts +4 -0
- package/src/database/migration.ts +3 -0
- package/src/library/find-package-json.test.ts +77 -0
- package/src/library/find-package-json.ts +149 -0
- package/src/library/package-resolution-worker.ts +7 -3
- package/src/library/worker/evaluator.ts +7 -1
- package/src/orchestrator/manager.ts +7 -0
- package/src/orchestrator/operation-context.captured-outputs.test.ts +118 -0
- package/src/orchestrator/operation-context.ts +154 -16
- package/src/orchestrator/operation-plan.destroy.test.md +33 -12
- package/src/orchestrator/operation-plan.destroy.test.ts +140 -2
- package/src/orchestrator/operation-plan.fixtures.ts +2 -0
- package/src/orchestrator/operation-plan.md +4 -1
- package/src/orchestrator/operation-plan.ts +286 -92
- package/src/orchestrator/operation-plan.update.test.md +286 -11
- package/src/orchestrator/operation-plan.update.test.ts +656 -5
- package/src/orchestrator/operation-workset.ts +72 -22
- package/src/orchestrator/operation.cancel.test.ts +4 -0
- package/src/orchestrator/operation.composite.test.ts +341 -0
- package/src/orchestrator/operation.destroy.test.ts +4 -0
- package/src/orchestrator/operation.output-validation.failure.test.ts +124 -0
- package/src/orchestrator/operation.preview.test.ts +4 -0
- package/src/orchestrator/operation.refresh.test.ts +4 -0
- package/src/orchestrator/operation.test-utils.ts +52 -13
- package/src/orchestrator/operation.ts +230 -68
- package/src/orchestrator/operation.update.failure.test.ts +4 -0
- package/src/orchestrator/operation.update.skip.test.ts +196 -0
- package/src/orchestrator/operation.update.test.ts +4 -0
- package/src/orchestrator/plan-test-builder.ts +1 -0
- package/src/orchestrator/unit-input-values.test.ts +450 -0
- package/src/orchestrator/unit-input-values.ts +281 -0
- package/src/pubsub/manager.ts +3 -0
- package/src/runner/abstractions.ts +23 -54
- package/src/runner/factory.ts +3 -3
- package/src/runner/force-abort.ts +7 -2
- package/src/runner/local.ts +116 -87
- package/src/runner/pulumi.ts +3 -5
- package/src/services.ts +53 -2
- package/src/shared/models/prisma.ts +1 -0
- package/src/shared/models/project/entity.ts +121 -0
- package/src/shared/models/project/index.ts +1 -0
- package/src/shared/models/project/operation.ts +61 -3
- package/src/shared/models/project/state.ts +10 -0
- package/src/shared/models/project/worker.ts +7 -0
- package/src/shared/resolvers/effective-output-type.test.ts +494 -0
- package/src/shared/resolvers/effective-output-type.ts +162 -0
- package/src/shared/resolvers/index.ts +1 -0
- package/src/shared/resolvers/input.ts +59 -9
- package/src/shared/utils/index.ts +1 -0
- package/src/shared/utils/stable-json.ts +41 -0
- package/src/terminal/manager.ts +6 -0
- package/src/terminal/run.sh.ts +9 -4
- package/src/worker/manager.ts +97 -1
- package/LICENSE +0 -21
- package/dist/chunk-I7BWSAN6.js +0 -49
- package/dist/chunk-I7BWSAN6.js.map +0 -1
- package/dist/chunk-V2NILDHS.js.map +0 -1
- package/dist/chunk-X2WG3WGL.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/library/package-resolution-worker.js.map +0 -1
- package/dist/library/worker/main.js.map +0 -1
- package/dist/shared/index.js.map +0 -1
|
@@ -210,6 +210,7 @@ export type OperationWhereInput = {
|
|
|
210
210
|
finishedAt?: Prisma.DateTimeNullableFilter<"Operation"> | Date | string | null
|
|
211
211
|
operationStates?: Prisma.InstanceOperationStateListRelationFilter
|
|
212
212
|
logs?: Prisma.OperationLogListRelationFilter
|
|
213
|
+
entitySnapshots?: Prisma.EntitySnapshotListRelationFilter
|
|
213
214
|
}
|
|
214
215
|
|
|
215
216
|
export type OperationOrderByWithRelationInput = {
|
|
@@ -225,6 +226,7 @@ export type OperationOrderByWithRelationInput = {
|
|
|
225
226
|
finishedAt?: Prisma.SortOrderInput | Prisma.SortOrder
|
|
226
227
|
operationStates?: Prisma.InstanceOperationStateOrderByRelationAggregateInput
|
|
227
228
|
logs?: Prisma.OperationLogOrderByRelationAggregateInput
|
|
229
|
+
entitySnapshots?: Prisma.EntitySnapshotOrderByRelationAggregateInput
|
|
228
230
|
}
|
|
229
231
|
|
|
230
232
|
export type OperationWhereUniqueInput = Prisma.AtLeast<{
|
|
@@ -243,6 +245,7 @@ export type OperationWhereUniqueInput = Prisma.AtLeast<{
|
|
|
243
245
|
finishedAt?: Prisma.DateTimeNullableFilter<"Operation"> | Date | string | null
|
|
244
246
|
operationStates?: Prisma.InstanceOperationStateListRelationFilter
|
|
245
247
|
logs?: Prisma.OperationLogListRelationFilter
|
|
248
|
+
entitySnapshots?: Prisma.EntitySnapshotListRelationFilter
|
|
246
249
|
}, "id">
|
|
247
250
|
|
|
248
251
|
export type OperationOrderByWithAggregationInput = {
|
|
@@ -290,6 +293,7 @@ export type OperationCreateInput = {
|
|
|
290
293
|
finishedAt?: Date | string | null
|
|
291
294
|
operationStates?: Prisma.InstanceOperationStateCreateNestedManyWithoutOperationInput
|
|
292
295
|
logs?: Prisma.OperationLogCreateNestedManyWithoutOperationInput
|
|
296
|
+
entitySnapshots?: Prisma.EntitySnapshotCreateNestedManyWithoutOperationInput
|
|
293
297
|
}
|
|
294
298
|
|
|
295
299
|
export type OperationUncheckedCreateInput = {
|
|
@@ -305,6 +309,7 @@ export type OperationUncheckedCreateInput = {
|
|
|
305
309
|
finishedAt?: Date | string | null
|
|
306
310
|
operationStates?: Prisma.InstanceOperationStateUncheckedCreateNestedManyWithoutOperationInput
|
|
307
311
|
logs?: Prisma.OperationLogUncheckedCreateNestedManyWithoutOperationInput
|
|
312
|
+
entitySnapshots?: Prisma.EntitySnapshotUncheckedCreateNestedManyWithoutOperationInput
|
|
308
313
|
}
|
|
309
314
|
|
|
310
315
|
export type OperationUpdateInput = {
|
|
@@ -320,6 +325,7 @@ export type OperationUpdateInput = {
|
|
|
320
325
|
finishedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
|
321
326
|
operationStates?: Prisma.InstanceOperationStateUpdateManyWithoutOperationNestedInput
|
|
322
327
|
logs?: Prisma.OperationLogUpdateManyWithoutOperationNestedInput
|
|
328
|
+
entitySnapshots?: Prisma.EntitySnapshotUpdateManyWithoutOperationNestedInput
|
|
323
329
|
}
|
|
324
330
|
|
|
325
331
|
export type OperationUncheckedUpdateInput = {
|
|
@@ -335,6 +341,7 @@ export type OperationUncheckedUpdateInput = {
|
|
|
335
341
|
finishedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
|
336
342
|
operationStates?: Prisma.InstanceOperationStateUncheckedUpdateManyWithoutOperationNestedInput
|
|
337
343
|
logs?: Prisma.OperationLogUncheckedUpdateManyWithoutOperationNestedInput
|
|
344
|
+
entitySnapshots?: Prisma.EntitySnapshotUncheckedUpdateManyWithoutOperationNestedInput
|
|
338
345
|
}
|
|
339
346
|
|
|
340
347
|
export type OperationCreateManyInput = {
|
|
@@ -376,6 +383,11 @@ export type OperationUncheckedUpdateManyInput = {
|
|
|
376
383
|
finishedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
|
377
384
|
}
|
|
378
385
|
|
|
386
|
+
export type OperationScalarRelationFilter = {
|
|
387
|
+
is?: Prisma.OperationWhereInput
|
|
388
|
+
isNot?: Prisma.OperationWhereInput
|
|
389
|
+
}
|
|
390
|
+
|
|
379
391
|
export type OperationCountOrderByAggregateInput = {
|
|
380
392
|
id?: Prisma.SortOrder
|
|
381
393
|
meta?: Prisma.SortOrder
|
|
@@ -407,9 +419,18 @@ export type OperationMinOrderByAggregateInput = {
|
|
|
407
419
|
finishedAt?: Prisma.SortOrder
|
|
408
420
|
}
|
|
409
421
|
|
|
410
|
-
export type
|
|
411
|
-
|
|
412
|
-
|
|
422
|
+
export type OperationCreateNestedOneWithoutEntitySnapshotsInput = {
|
|
423
|
+
create?: Prisma.XOR<Prisma.OperationCreateWithoutEntitySnapshotsInput, Prisma.OperationUncheckedCreateWithoutEntitySnapshotsInput>
|
|
424
|
+
connectOrCreate?: Prisma.OperationCreateOrConnectWithoutEntitySnapshotsInput
|
|
425
|
+
connect?: Prisma.OperationWhereUniqueInput
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
export type OperationUpdateOneRequiredWithoutEntitySnapshotsNestedInput = {
|
|
429
|
+
create?: Prisma.XOR<Prisma.OperationCreateWithoutEntitySnapshotsInput, Prisma.OperationUncheckedCreateWithoutEntitySnapshotsInput>
|
|
430
|
+
connectOrCreate?: Prisma.OperationCreateOrConnectWithoutEntitySnapshotsInput
|
|
431
|
+
upsert?: Prisma.OperationUpsertWithoutEntitySnapshotsInput
|
|
432
|
+
connect?: Prisma.OperationWhereUniqueInput
|
|
433
|
+
update?: Prisma.XOR<Prisma.XOR<Prisma.OperationUpdateToOneWithWhereWithoutEntitySnapshotsInput, Prisma.OperationUpdateWithoutEntitySnapshotsInput>, Prisma.OperationUncheckedUpdateWithoutEntitySnapshotsInput>
|
|
413
434
|
}
|
|
414
435
|
|
|
415
436
|
export type EnumOperationTypeFieldUpdateOperationsInput = {
|
|
@@ -452,6 +473,82 @@ export type OperationUpdateOneRequiredWithoutLogsNestedInput = {
|
|
|
452
473
|
update?: Prisma.XOR<Prisma.XOR<Prisma.OperationUpdateToOneWithWhereWithoutLogsInput, Prisma.OperationUpdateWithoutLogsInput>, Prisma.OperationUncheckedUpdateWithoutLogsInput>
|
|
453
474
|
}
|
|
454
475
|
|
|
476
|
+
export type OperationCreateWithoutEntitySnapshotsInput = {
|
|
477
|
+
id?: string
|
|
478
|
+
meta:PrismaJson.OperationMeta
|
|
479
|
+
type: $Enums.OperationType
|
|
480
|
+
status?: $Enums.OperationStatus
|
|
481
|
+
options:PrismaJson.OperationOptions
|
|
482
|
+
requestedInstanceIds:PrismaJson.InstanceIds
|
|
483
|
+
phases?:PrismaJson.OperationPhase[] | Prisma.NullableJsonNullValueInput
|
|
484
|
+
startedAt?: Date | string
|
|
485
|
+
updatedAt?: Date | string
|
|
486
|
+
finishedAt?: Date | string | null
|
|
487
|
+
operationStates?: Prisma.InstanceOperationStateCreateNestedManyWithoutOperationInput
|
|
488
|
+
logs?: Prisma.OperationLogCreateNestedManyWithoutOperationInput
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
export type OperationUncheckedCreateWithoutEntitySnapshotsInput = {
|
|
492
|
+
id?: string
|
|
493
|
+
meta:PrismaJson.OperationMeta
|
|
494
|
+
type: $Enums.OperationType
|
|
495
|
+
status?: $Enums.OperationStatus
|
|
496
|
+
options:PrismaJson.OperationOptions
|
|
497
|
+
requestedInstanceIds:PrismaJson.InstanceIds
|
|
498
|
+
phases?:PrismaJson.OperationPhase[] | Prisma.NullableJsonNullValueInput
|
|
499
|
+
startedAt?: Date | string
|
|
500
|
+
updatedAt?: Date | string
|
|
501
|
+
finishedAt?: Date | string | null
|
|
502
|
+
operationStates?: Prisma.InstanceOperationStateUncheckedCreateNestedManyWithoutOperationInput
|
|
503
|
+
logs?: Prisma.OperationLogUncheckedCreateNestedManyWithoutOperationInput
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
export type OperationCreateOrConnectWithoutEntitySnapshotsInput = {
|
|
507
|
+
where: Prisma.OperationWhereUniqueInput
|
|
508
|
+
create: Prisma.XOR<Prisma.OperationCreateWithoutEntitySnapshotsInput, Prisma.OperationUncheckedCreateWithoutEntitySnapshotsInput>
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
export type OperationUpsertWithoutEntitySnapshotsInput = {
|
|
512
|
+
update: Prisma.XOR<Prisma.OperationUpdateWithoutEntitySnapshotsInput, Prisma.OperationUncheckedUpdateWithoutEntitySnapshotsInput>
|
|
513
|
+
create: Prisma.XOR<Prisma.OperationCreateWithoutEntitySnapshotsInput, Prisma.OperationUncheckedCreateWithoutEntitySnapshotsInput>
|
|
514
|
+
where?: Prisma.OperationWhereInput
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
export type OperationUpdateToOneWithWhereWithoutEntitySnapshotsInput = {
|
|
518
|
+
where?: Prisma.OperationWhereInput
|
|
519
|
+
data: Prisma.XOR<Prisma.OperationUpdateWithoutEntitySnapshotsInput, Prisma.OperationUncheckedUpdateWithoutEntitySnapshotsInput>
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
export type OperationUpdateWithoutEntitySnapshotsInput = {
|
|
523
|
+
id?: Prisma.StringFieldUpdateOperationsInput | string
|
|
524
|
+
meta?:PrismaJson.OperationMeta
|
|
525
|
+
type?: Prisma.EnumOperationTypeFieldUpdateOperationsInput | $Enums.OperationType
|
|
526
|
+
status?: Prisma.EnumOperationStatusFieldUpdateOperationsInput | $Enums.OperationStatus
|
|
527
|
+
options?:PrismaJson.OperationOptions
|
|
528
|
+
requestedInstanceIds?:PrismaJson.InstanceIds
|
|
529
|
+
phases?:PrismaJson.OperationPhase[] | Prisma.NullableJsonNullValueInput
|
|
530
|
+
startedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
|
531
|
+
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
|
532
|
+
finishedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
|
533
|
+
operationStates?: Prisma.InstanceOperationStateUpdateManyWithoutOperationNestedInput
|
|
534
|
+
logs?: Prisma.OperationLogUpdateManyWithoutOperationNestedInput
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
export type OperationUncheckedUpdateWithoutEntitySnapshotsInput = {
|
|
538
|
+
id?: Prisma.StringFieldUpdateOperationsInput | string
|
|
539
|
+
meta?:PrismaJson.OperationMeta
|
|
540
|
+
type?: Prisma.EnumOperationTypeFieldUpdateOperationsInput | $Enums.OperationType
|
|
541
|
+
status?: Prisma.EnumOperationStatusFieldUpdateOperationsInput | $Enums.OperationStatus
|
|
542
|
+
options?:PrismaJson.OperationOptions
|
|
543
|
+
requestedInstanceIds?:PrismaJson.InstanceIds
|
|
544
|
+
phases?:PrismaJson.OperationPhase[] | Prisma.NullableJsonNullValueInput
|
|
545
|
+
startedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
|
546
|
+
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
|
547
|
+
finishedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
|
548
|
+
operationStates?: Prisma.InstanceOperationStateUncheckedUpdateManyWithoutOperationNestedInput
|
|
549
|
+
logs?: Prisma.OperationLogUncheckedUpdateManyWithoutOperationNestedInput
|
|
550
|
+
}
|
|
551
|
+
|
|
455
552
|
export type OperationCreateWithoutOperationStatesInput = {
|
|
456
553
|
id?: string
|
|
457
554
|
meta:PrismaJson.OperationMeta
|
|
@@ -464,6 +561,7 @@ export type OperationCreateWithoutOperationStatesInput = {
|
|
|
464
561
|
updatedAt?: Date | string
|
|
465
562
|
finishedAt?: Date | string | null
|
|
466
563
|
logs?: Prisma.OperationLogCreateNestedManyWithoutOperationInput
|
|
564
|
+
entitySnapshots?: Prisma.EntitySnapshotCreateNestedManyWithoutOperationInput
|
|
467
565
|
}
|
|
468
566
|
|
|
469
567
|
export type OperationUncheckedCreateWithoutOperationStatesInput = {
|
|
@@ -478,6 +576,7 @@ export type OperationUncheckedCreateWithoutOperationStatesInput = {
|
|
|
478
576
|
updatedAt?: Date | string
|
|
479
577
|
finishedAt?: Date | string | null
|
|
480
578
|
logs?: Prisma.OperationLogUncheckedCreateNestedManyWithoutOperationInput
|
|
579
|
+
entitySnapshots?: Prisma.EntitySnapshotUncheckedCreateNestedManyWithoutOperationInput
|
|
481
580
|
}
|
|
482
581
|
|
|
483
582
|
export type OperationCreateOrConnectWithoutOperationStatesInput = {
|
|
@@ -508,6 +607,7 @@ export type OperationUpdateWithoutOperationStatesInput = {
|
|
|
508
607
|
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
|
509
608
|
finishedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
|
510
609
|
logs?: Prisma.OperationLogUpdateManyWithoutOperationNestedInput
|
|
610
|
+
entitySnapshots?: Prisma.EntitySnapshotUpdateManyWithoutOperationNestedInput
|
|
511
611
|
}
|
|
512
612
|
|
|
513
613
|
export type OperationUncheckedUpdateWithoutOperationStatesInput = {
|
|
@@ -522,6 +622,7 @@ export type OperationUncheckedUpdateWithoutOperationStatesInput = {
|
|
|
522
622
|
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
|
523
623
|
finishedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
|
524
624
|
logs?: Prisma.OperationLogUncheckedUpdateManyWithoutOperationNestedInput
|
|
625
|
+
entitySnapshots?: Prisma.EntitySnapshotUncheckedUpdateManyWithoutOperationNestedInput
|
|
525
626
|
}
|
|
526
627
|
|
|
527
628
|
export type OperationCreateWithoutLogsInput = {
|
|
@@ -536,6 +637,7 @@ export type OperationCreateWithoutLogsInput = {
|
|
|
536
637
|
updatedAt?: Date | string
|
|
537
638
|
finishedAt?: Date | string | null
|
|
538
639
|
operationStates?: Prisma.InstanceOperationStateCreateNestedManyWithoutOperationInput
|
|
640
|
+
entitySnapshots?: Prisma.EntitySnapshotCreateNestedManyWithoutOperationInput
|
|
539
641
|
}
|
|
540
642
|
|
|
541
643
|
export type OperationUncheckedCreateWithoutLogsInput = {
|
|
@@ -550,6 +652,7 @@ export type OperationUncheckedCreateWithoutLogsInput = {
|
|
|
550
652
|
updatedAt?: Date | string
|
|
551
653
|
finishedAt?: Date | string | null
|
|
552
654
|
operationStates?: Prisma.InstanceOperationStateUncheckedCreateNestedManyWithoutOperationInput
|
|
655
|
+
entitySnapshots?: Prisma.EntitySnapshotUncheckedCreateNestedManyWithoutOperationInput
|
|
553
656
|
}
|
|
554
657
|
|
|
555
658
|
export type OperationCreateOrConnectWithoutLogsInput = {
|
|
@@ -580,6 +683,7 @@ export type OperationUpdateWithoutLogsInput = {
|
|
|
580
683
|
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
|
581
684
|
finishedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
|
582
685
|
operationStates?: Prisma.InstanceOperationStateUpdateManyWithoutOperationNestedInput
|
|
686
|
+
entitySnapshots?: Prisma.EntitySnapshotUpdateManyWithoutOperationNestedInput
|
|
583
687
|
}
|
|
584
688
|
|
|
585
689
|
export type OperationUncheckedUpdateWithoutLogsInput = {
|
|
@@ -594,6 +698,7 @@ export type OperationUncheckedUpdateWithoutLogsInput = {
|
|
|
594
698
|
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
|
595
699
|
finishedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
|
596
700
|
operationStates?: Prisma.InstanceOperationStateUncheckedUpdateManyWithoutOperationNestedInput
|
|
701
|
+
entitySnapshots?: Prisma.EntitySnapshotUncheckedUpdateManyWithoutOperationNestedInput
|
|
597
702
|
}
|
|
598
703
|
|
|
599
704
|
|
|
@@ -604,11 +709,13 @@ export type OperationUncheckedUpdateWithoutLogsInput = {
|
|
|
604
709
|
export type OperationCountOutputType = {
|
|
605
710
|
operationStates: number
|
|
606
711
|
logs: number
|
|
712
|
+
entitySnapshots: number
|
|
607
713
|
}
|
|
608
714
|
|
|
609
715
|
export type OperationCountOutputTypeSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
|
610
716
|
operationStates?: boolean | OperationCountOutputTypeCountOperationStatesArgs
|
|
611
717
|
logs?: boolean | OperationCountOutputTypeCountLogsArgs
|
|
718
|
+
entitySnapshots?: boolean | OperationCountOutputTypeCountEntitySnapshotsArgs
|
|
612
719
|
}
|
|
613
720
|
|
|
614
721
|
/**
|
|
@@ -635,6 +742,13 @@ export type OperationCountOutputTypeCountLogsArgs<ExtArgs extends runtime.Types.
|
|
|
635
742
|
where?: Prisma.OperationLogWhereInput
|
|
636
743
|
}
|
|
637
744
|
|
|
745
|
+
/**
|
|
746
|
+
* OperationCountOutputType without action
|
|
747
|
+
*/
|
|
748
|
+
export type OperationCountOutputTypeCountEntitySnapshotsArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
|
749
|
+
where?: Prisma.EntitySnapshotWhereInput
|
|
750
|
+
}
|
|
751
|
+
|
|
638
752
|
|
|
639
753
|
export type OperationSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetSelect<{
|
|
640
754
|
id?: boolean
|
|
@@ -649,6 +763,7 @@ export type OperationSelect<ExtArgs extends runtime.Types.Extensions.InternalArg
|
|
|
649
763
|
finishedAt?: boolean
|
|
650
764
|
operationStates?: boolean | Prisma.Operation$operationStatesArgs<ExtArgs>
|
|
651
765
|
logs?: boolean | Prisma.Operation$logsArgs<ExtArgs>
|
|
766
|
+
entitySnapshots?: boolean | Prisma.Operation$entitySnapshotsArgs<ExtArgs>
|
|
652
767
|
_count?: boolean | Prisma.OperationCountOutputTypeDefaultArgs<ExtArgs>
|
|
653
768
|
}, ExtArgs["result"]["operation"]>
|
|
654
769
|
|
|
@@ -695,6 +810,7 @@ export type OperationOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs
|
|
|
695
810
|
export type OperationInclude<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
|
696
811
|
operationStates?: boolean | Prisma.Operation$operationStatesArgs<ExtArgs>
|
|
697
812
|
logs?: boolean | Prisma.Operation$logsArgs<ExtArgs>
|
|
813
|
+
entitySnapshots?: boolean | Prisma.Operation$entitySnapshotsArgs<ExtArgs>
|
|
698
814
|
_count?: boolean | Prisma.OperationCountOutputTypeDefaultArgs<ExtArgs>
|
|
699
815
|
}
|
|
700
816
|
export type OperationIncludeCreateManyAndReturn<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {}
|
|
@@ -711,6 +827,10 @@ export type $OperationPayload<ExtArgs extends runtime.Types.Extensions.InternalA
|
|
|
711
827
|
* The logs of the operation.
|
|
712
828
|
*/
|
|
713
829
|
logs: Prisma.$OperationLogPayload<ExtArgs>[]
|
|
830
|
+
/**
|
|
831
|
+
* The entity snapshots created by this operation.
|
|
832
|
+
*/
|
|
833
|
+
entitySnapshots: Prisma.$EntitySnapshotPayload<ExtArgs>[]
|
|
714
834
|
}
|
|
715
835
|
scalars: runtime.Types.Extensions.GetPayloadResult<{
|
|
716
836
|
/**
|
|
@@ -1157,6 +1277,7 @@ export interface Prisma__OperationClient<T, Null = never, ExtArgs extends runtim
|
|
|
1157
1277
|
readonly [Symbol.toStringTag]: "PrismaPromise"
|
|
1158
1278
|
operationStates<T extends Prisma.Operation$operationStatesArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.Operation$operationStatesArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$InstanceOperationStatePayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
|
|
1159
1279
|
logs<T extends Prisma.Operation$logsArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.Operation$logsArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$OperationLogPayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
|
|
1280
|
+
entitySnapshots<T extends Prisma.Operation$entitySnapshotsArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.Operation$entitySnapshotsArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$EntitySnapshotPayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
|
|
1160
1281
|
/**
|
|
1161
1282
|
* Attaches callbacks for the resolution and/or rejection of the Promise.
|
|
1162
1283
|
* @param onfulfilled The callback to execute when the Promise is resolved.
|
|
@@ -1629,6 +1750,30 @@ export type Operation$logsArgs<ExtArgs extends runtime.Types.Extensions.Internal
|
|
|
1629
1750
|
distinct?: Prisma.OperationLogScalarFieldEnum | Prisma.OperationLogScalarFieldEnum[]
|
|
1630
1751
|
}
|
|
1631
1752
|
|
|
1753
|
+
/**
|
|
1754
|
+
* Operation.entitySnapshots
|
|
1755
|
+
*/
|
|
1756
|
+
export type Operation$entitySnapshotsArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
|
1757
|
+
/**
|
|
1758
|
+
* Select specific fields to fetch from the EntitySnapshot
|
|
1759
|
+
*/
|
|
1760
|
+
select?: Prisma.EntitySnapshotSelect<ExtArgs> | null
|
|
1761
|
+
/**
|
|
1762
|
+
* Omit specific fields from the EntitySnapshot
|
|
1763
|
+
*/
|
|
1764
|
+
omit?: Prisma.EntitySnapshotOmit<ExtArgs> | null
|
|
1765
|
+
/**
|
|
1766
|
+
* Choose, which related nodes to fetch as well
|
|
1767
|
+
*/
|
|
1768
|
+
include?: Prisma.EntitySnapshotInclude<ExtArgs> | null
|
|
1769
|
+
where?: Prisma.EntitySnapshotWhereInput
|
|
1770
|
+
orderBy?: Prisma.EntitySnapshotOrderByWithRelationInput | Prisma.EntitySnapshotOrderByWithRelationInput[]
|
|
1771
|
+
cursor?: Prisma.EntitySnapshotWhereUniqueInput
|
|
1772
|
+
take?: number
|
|
1773
|
+
skip?: number
|
|
1774
|
+
distinct?: Prisma.EntitySnapshotScalarFieldEnum | Prisma.EntitySnapshotScalarFieldEnum[]
|
|
1775
|
+
}
|
|
1776
|
+
|
|
1632
1777
|
/**
|
|
1633
1778
|
* Operation without action
|
|
1634
1779
|
*/
|
|
@@ -405,10 +405,6 @@ export type OperationLogUncheckedUpdateManyWithoutOperationNestedInput = {
|
|
|
405
405
|
deleteMany?: Prisma.OperationLogScalarWhereInput | Prisma.OperationLogScalarWhereInput[]
|
|
406
406
|
}
|
|
407
407
|
|
|
408
|
-
export type BoolFieldUpdateOperationsInput = {
|
|
409
|
-
set?: boolean
|
|
410
|
-
}
|
|
411
|
-
|
|
412
408
|
export type OperationLogCreateWithoutStateInput = {
|
|
413
409
|
id: string
|
|
414
410
|
isSystem?: boolean
|
|
@@ -11,6 +11,10 @@
|
|
|
11
11
|
export type * from './models/ApiKey.ts'
|
|
12
12
|
export type * from './models/Artifact.ts'
|
|
13
13
|
export type * from './models/InstanceCustomStatus.ts'
|
|
14
|
+
export type * from './models/Entity.ts'
|
|
15
|
+
export type * from './models/EntitySnapshot.ts'
|
|
16
|
+
export type * from './models/EntitySnapshotReference.ts'
|
|
17
|
+
export type * from './models/EntitySnapshotContent.ts'
|
|
14
18
|
export type * from './models/InstanceEvaluationState.ts'
|
|
15
19
|
export type * from './models/InstanceState.ts'
|
|
16
20
|
export type * from './models/UserProjectViewport.ts'
|
|
@@ -23,6 +23,7 @@ export const migrationPacks = {
|
|
|
23
23
|
migrationNames: [
|
|
24
24
|
//
|
|
25
25
|
"20250928124105_initial_migration",
|
|
26
|
+
"20260222113554_add_object_tracking",
|
|
26
27
|
],
|
|
27
28
|
},
|
|
28
29
|
project: {
|
|
@@ -32,6 +33,8 @@ export const migrationPacks = {
|
|
|
32
33
|
//
|
|
33
34
|
"20250928130725_initial_migration",
|
|
34
35
|
"20260123000000_add_instance_state_self_hash",
|
|
36
|
+
"20260301210131_add_entity_tracking",
|
|
37
|
+
"20260302212734_add_resource_hooks_flag",
|
|
35
38
|
],
|
|
36
39
|
},
|
|
37
40
|
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { mkdir, mkdtemp, rm, writeFile } from "node:fs/promises"
|
|
2
|
+
import { tmpdir } from "node:os"
|
|
3
|
+
import { resolve } from "node:path"
|
|
4
|
+
import { pathToFileURL } from "node:url"
|
|
5
|
+
import { describe, expect, test } from "vitest"
|
|
6
|
+
import { findPackageJSONCompat } from "./find-package-json"
|
|
7
|
+
|
|
8
|
+
describe("findPackageJSONPolyfill", () => {
|
|
9
|
+
test("resolves bare package name from nearest node_modules ancestor", async () => {
|
|
10
|
+
const sandbox = await mkdtemp(resolve(tmpdir(), "find-package-json-"))
|
|
11
|
+
|
|
12
|
+
try {
|
|
13
|
+
const projectRoot = resolve(sandbox, "project")
|
|
14
|
+
const appDir = resolve(projectRoot, "apps", "api")
|
|
15
|
+
const packageJsonPath = resolve(projectRoot, "package.json")
|
|
16
|
+
const dependencyPackageJsonPath = resolve(
|
|
17
|
+
projectRoot,
|
|
18
|
+
"node_modules",
|
|
19
|
+
"@highstate",
|
|
20
|
+
"library",
|
|
21
|
+
"package.json",
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
await mkdir(resolve(appDir), { recursive: true })
|
|
25
|
+
await mkdir(resolve(projectRoot, "node_modules", "@highstate", "library"), {
|
|
26
|
+
recursive: true,
|
|
27
|
+
})
|
|
28
|
+
await writeFile(packageJsonPath, '{"name":"project"}')
|
|
29
|
+
await writeFile(dependencyPackageJsonPath, '{"name":"@highstate/library"}')
|
|
30
|
+
|
|
31
|
+
const result = await findPackageJSONCompat("@highstate/library", resolve(appDir, "index.ts"))
|
|
32
|
+
|
|
33
|
+
expect(result).toBe(dependencyPackageJsonPath)
|
|
34
|
+
} finally {
|
|
35
|
+
await rm(sandbox, { recursive: true, force: true })
|
|
36
|
+
}
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
test("resolves nearest package.json for relative path specifier", async () => {
|
|
40
|
+
const sandbox = await mkdtemp(resolve(tmpdir(), "find-package-json-"))
|
|
41
|
+
|
|
42
|
+
try {
|
|
43
|
+
const projectRoot = resolve(sandbox, "project")
|
|
44
|
+
const sourceDir = resolve(projectRoot, "src")
|
|
45
|
+
const sourceFile = resolve(sourceDir, "entry.ts")
|
|
46
|
+
const packageJsonPath = resolve(projectRoot, "package.json")
|
|
47
|
+
|
|
48
|
+
await mkdir(sourceDir, { recursive: true })
|
|
49
|
+
await writeFile(packageJsonPath, '{"name":"project"}')
|
|
50
|
+
await writeFile(sourceFile, "export {}")
|
|
51
|
+
|
|
52
|
+
const result = await findPackageJSONCompat("./entry.ts", pathToFileURL(sourceFile))
|
|
53
|
+
|
|
54
|
+
expect(result).toBe(packageJsonPath)
|
|
55
|
+
} finally {
|
|
56
|
+
await rm(sandbox, { recursive: true, force: true })
|
|
57
|
+
}
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
test("returns undefined for missing bare package", async () => {
|
|
61
|
+
const sandbox = await mkdtemp(resolve(tmpdir(), "find-package-json-"))
|
|
62
|
+
|
|
63
|
+
try {
|
|
64
|
+
const projectRoot = resolve(sandbox, "project")
|
|
65
|
+
await mkdir(projectRoot, { recursive: true })
|
|
66
|
+
|
|
67
|
+
const result = await findPackageJSONCompat(
|
|
68
|
+
"missing-package",
|
|
69
|
+
resolve(projectRoot, "index.ts"),
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
expect(result).toBeUndefined()
|
|
73
|
+
} finally {
|
|
74
|
+
await rm(sandbox, { recursive: true, force: true })
|
|
75
|
+
}
|
|
76
|
+
})
|
|
77
|
+
})
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { access } from "node:fs/promises"
|
|
2
|
+
import { dirname, isAbsolute, resolve } from "node:path"
|
|
3
|
+
import { fileURLToPath } from "node:url"
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Polyfill for resolving the path to a package.json file for a given module specifier and base URL.
|
|
7
|
+
*
|
|
8
|
+
* Context: https://github.com/oven-sh/bun/issues/23898
|
|
9
|
+
*/
|
|
10
|
+
export async function findPackageJSONCompat(
|
|
11
|
+
specifier: string | URL,
|
|
12
|
+
base?: string | URL,
|
|
13
|
+
): Promise<string | undefined> {
|
|
14
|
+
const parsedSpecifier = toPathSpecifier(specifier)
|
|
15
|
+
|
|
16
|
+
if (parsedSpecifier.type === "bare") {
|
|
17
|
+
if (!base) {
|
|
18
|
+
return undefined
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const basePath = resolveBasePath(base)
|
|
22
|
+
const baseDir = await normalizePathForLookup(basePath)
|
|
23
|
+
|
|
24
|
+
return await findPackageJsonForBareSpecifier(baseDir, parsedSpecifier.value)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const resolvedPath = resolvePathSpecifier(parsedSpecifier.value, base)
|
|
28
|
+
const lookupStart = await normalizePathForLookup(resolvedPath)
|
|
29
|
+
|
|
30
|
+
return await findNearestPackageJson(lookupStart)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
type PathSpecifier = { type: "bare"; value: string } | { type: "path"; value: string }
|
|
34
|
+
|
|
35
|
+
function toPathSpecifier(specifier: string | URL): PathSpecifier {
|
|
36
|
+
if (specifier instanceof URL) {
|
|
37
|
+
if (specifier.protocol !== "file:") {
|
|
38
|
+
throw new Error(`Unsupported URL protocol "${specifier.protocol}"`)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return { type: "path", value: fileURLToPath(specifier) }
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
if (specifier.startsWith("file:")) {
|
|
45
|
+
return { type: "path", value: fileURLToPath(new URL(specifier)) }
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (isBareSpecifier(specifier)) {
|
|
49
|
+
return { type: "bare", value: specifier }
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return { type: "path", value: specifier }
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function isBareSpecifier(specifier: string): boolean {
|
|
56
|
+
return !specifier.startsWith(".") && !specifier.startsWith("/") && !specifier.startsWith("file:")
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function resolvePathSpecifier(specifierPath: string, base?: string | URL): string {
|
|
60
|
+
if (isAbsolute(specifierPath)) {
|
|
61
|
+
return specifierPath
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const basePath = base ? resolveBasePath(base) : process.cwd()
|
|
65
|
+
|
|
66
|
+
if (specifierPath.startsWith(".")) {
|
|
67
|
+
const baseDir = isLikelyFilePath(basePath) ? dirname(basePath) : basePath
|
|
68
|
+
return resolve(baseDir, specifierPath)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return specifierPath
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function resolveBasePath(base: string | URL): string {
|
|
75
|
+
if (base instanceof URL) {
|
|
76
|
+
if (base.protocol !== "file:") {
|
|
77
|
+
throw new Error(`Unsupported base URL protocol "${base.protocol}"`)
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
return fileURLToPath(base)
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
if (base.startsWith("file:")) {
|
|
84
|
+
return fileURLToPath(new URL(base))
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
return base
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
async function normalizePathForLookup(pathValue: string): Promise<string> {
|
|
91
|
+
const existsAsFile = await pathExists(pathValue)
|
|
92
|
+
if (existsAsFile && isLikelyFilePath(pathValue)) {
|
|
93
|
+
return dirname(pathValue)
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
return pathValue
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function isLikelyFilePath(pathValue: string): boolean {
|
|
100
|
+
return pathValue.endsWith(".json") || pathValue.endsWith(".mjs") || pathValue.endsWith(".js")
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
async function findNearestPackageJson(startPath: string): Promise<string | undefined> {
|
|
104
|
+
let current = startPath
|
|
105
|
+
|
|
106
|
+
while (true) {
|
|
107
|
+
const candidate = resolve(current, "package.json")
|
|
108
|
+
if (await pathExists(candidate)) {
|
|
109
|
+
return candidate
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
const parent = dirname(current)
|
|
113
|
+
if (parent === current) {
|
|
114
|
+
return undefined
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
current = parent
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
async function findPackageJsonForBareSpecifier(
|
|
122
|
+
startDirectory: string,
|
|
123
|
+
packageName: string,
|
|
124
|
+
): Promise<string | undefined> {
|
|
125
|
+
let current = startDirectory
|
|
126
|
+
|
|
127
|
+
while (true) {
|
|
128
|
+
const candidate = resolve(current, "node_modules", packageName, "package.json")
|
|
129
|
+
if (await pathExists(candidate)) {
|
|
130
|
+
return candidate
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
const parent = dirname(current)
|
|
134
|
+
if (parent === current) {
|
|
135
|
+
return undefined
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
current = parent
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
async function pathExists(pathValue: string): Promise<boolean> {
|
|
143
|
+
try {
|
|
144
|
+
await access(pathValue)
|
|
145
|
+
return true
|
|
146
|
+
} catch {
|
|
147
|
+
return false
|
|
148
|
+
}
|
|
149
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { realpath } from "node:fs/promises"
|
|
2
|
-
import { findPackageJSON } from "node:module"
|
|
3
2
|
import { dirname } from "node:path"
|
|
4
3
|
import { parentPort, workerData } from "node:worker_threads"
|
|
5
4
|
import pino, { type Level } from "pino"
|
|
5
|
+
import { findPackageJSONCompat } from "./find-package-json"
|
|
6
6
|
|
|
7
7
|
export type PackageResolutionWorkerData = {
|
|
8
8
|
importPath: string
|
|
@@ -37,9 +37,13 @@ const results: PackageResult[] = []
|
|
|
37
37
|
|
|
38
38
|
for (const packageName of packageNames) {
|
|
39
39
|
try {
|
|
40
|
-
const path =
|
|
40
|
+
const path = await findPackageJSONCompat(packageName, rootDir)
|
|
41
41
|
if (!path) {
|
|
42
|
-
|
|
42
|
+
results.push({
|
|
43
|
+
type: "not-found",
|
|
44
|
+
packageName,
|
|
45
|
+
})
|
|
46
|
+
continue
|
|
43
47
|
}
|
|
44
48
|
|
|
45
49
|
results.push({
|
|
@@ -11,6 +11,12 @@ import {
|
|
|
11
11
|
import { mapValues } from "remeda"
|
|
12
12
|
import { errorToString } from "../../common"
|
|
13
13
|
|
|
14
|
+
function toCloneSafeInstanceModel(instance: InstanceModel): InstanceModel {
|
|
15
|
+
// Runtime instances may contain Proxy-based accessors in outputs/resolvedOutputs.
|
|
16
|
+
// Serialize to plain data so worker thread postMessage can structured-clone it.
|
|
17
|
+
return JSON.parse(JSON.stringify(instance)) as InstanceModel
|
|
18
|
+
}
|
|
19
|
+
|
|
14
20
|
export function evaluateProject(
|
|
15
21
|
logger: Logger,
|
|
16
22
|
components: Readonly<Record<string, Component>>,
|
|
@@ -42,7 +48,7 @@ export function evaluateProject(
|
|
|
42
48
|
success: true,
|
|
43
49
|
|
|
44
50
|
virtualInstances: getRuntimeInstances()
|
|
45
|
-
.map(instance => instance.instance)
|
|
51
|
+
.map(instance => toCloneSafeInstanceModel(instance.instance))
|
|
46
52
|
// only include top-level composite instances and their children
|
|
47
53
|
.filter(instance => instance.kind === "composite" || !allInstancesMap.has(instance.id)),
|
|
48
54
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { InstanceId } from "@highstate/contract"
|
|
2
2
|
import type { Logger } from "pino"
|
|
3
3
|
import type {
|
|
4
|
+
EntitySnapshotService,
|
|
4
5
|
InstanceLockService,
|
|
5
6
|
InstanceStateService,
|
|
6
7
|
OperationService,
|
|
@@ -8,6 +9,7 @@ import type {
|
|
|
8
9
|
ProjectUnlockService,
|
|
9
10
|
SecretService,
|
|
10
11
|
UnitExtraService,
|
|
12
|
+
UnitOutputService,
|
|
11
13
|
} from "../business"
|
|
12
14
|
import type { ArtifactService } from "../business/artifact"
|
|
13
15
|
import type { DatabaseManager, Operation, Project } from "../database"
|
|
@@ -37,6 +39,8 @@ export class OperationManager {
|
|
|
37
39
|
private readonly instanceStateService: InstanceStateService,
|
|
38
40
|
private readonly projectModelService: ProjectModelService,
|
|
39
41
|
private readonly unitExtraService: UnitExtraService,
|
|
42
|
+
private readonly entitySnapshotService: EntitySnapshotService,
|
|
43
|
+
private readonly unitOutputService: UnitOutputService,
|
|
40
44
|
private readonly database: DatabaseManager,
|
|
41
45
|
private readonly logger: Logger,
|
|
42
46
|
) {
|
|
@@ -71,6 +75,7 @@ export class OperationManager {
|
|
|
71
75
|
this.libraryBackend,
|
|
72
76
|
this.instanceStateService,
|
|
73
77
|
this.projectModelService,
|
|
78
|
+
undefined,
|
|
74
79
|
this.logger,
|
|
75
80
|
)
|
|
76
81
|
|
|
@@ -141,6 +146,8 @@ export class OperationManager {
|
|
|
141
146
|
this.instanceStateService,
|
|
142
147
|
this.projectModelService,
|
|
143
148
|
this.unitExtraService,
|
|
149
|
+
this.entitySnapshotService,
|
|
150
|
+
this.unitOutputService,
|
|
144
151
|
this.logger.child({ operationId: operation.id }),
|
|
145
152
|
)
|
|
146
153
|
|