@impz/testing 6.9.1 → 6.10.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 (2) hide show
  1. package/dist/index.js +18 -6
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -20188,7 +20188,8 @@ var SystemFeaturesSchema = z33.object({
20188
20188
  execDropSysAdmin: z33.boolean().optional(),
20189
20189
  guestScratch: z33.boolean().optional(),
20190
20190
  imagePins: z33.boolean().optional(),
20191
- buildContextUpload: z33.boolean().optional()
20191
+ buildContextUpload: z33.boolean().optional(),
20192
+ destroyIdCheck: z33.boolean().optional()
20192
20193
  });
20193
20194
  var GuestInfoSchema = z33.object({
20194
20195
  scratchDir: z33.string(),
@@ -20306,7 +20307,7 @@ var ResourceKindSchema = z34.enum([
20306
20307
  var ResourceDataSchema = z34.object({
20307
20308
  kind: ResourceKindSchema,
20308
20309
  name: z34.string(),
20309
- reason: z34.enum(["binding_changed"]).optional()
20310
+ reason: z34.enum(["binding_changed", "id_changed"]).optional()
20310
20311
  });
20311
20312
  var ForbiddenReasonSchema = z34.enum(["imp_out_of_scope", "not_grantable", "scope"]);
20312
20313
  var ForbiddenDataSchema = z34.object({ reason: ForbiddenReasonSchema });
@@ -20425,7 +20426,7 @@ var impsContract = {
20425
20426
  create: contractBase.meta(ACCESS.manageImp).input(ImpCreateInputSchema).output(ImpSchema),
20426
20427
  list: contractBase.meta(ACCESS.readAny).input(z40.object({ builders: z40.boolean().optional() }).optional()).output(z40.array(ImpSchema)),
20427
20428
  get: contractBase.meta(ACCESS.readImp).input(NameInputSchema).output(ImpSchema),
20428
- destroy: contractBase.meta(ACCESS.manageImp).input(NameInputSchema).output(EmptySchema),
20429
+ destroy: contractBase.meta(ACCESS.manageImp).input(z40.object({ name: NameSchema, id: z40.string().optional() })).output(EmptySchema),
20429
20430
  start: contractBase.meta(ACCESS.execImp).input(NameInputSchema).output(ImpSchema),
20430
20431
  stop: contractBase.meta(ACCESS.execImp).input(ForceInputSchema).output(ImpSchema),
20431
20432
  sleep: contractBase.meta(ACCESS.execImp).input(ForceInputSchema).output(ImpSchema),
@@ -21993,7 +21994,7 @@ import { join as join48 } from "path";
21993
21994
  // packages/daemon/package.json
21994
21995
  var package_default = {
21995
21996
  name: "@impz/daemon",
21996
- version: "6.9.1",
21997
+ version: "6.10.0",
21997
21998
  private: true,
21998
21999
  description: "impd: the imp host daemon",
21999
22000
  type: "module",
@@ -22247,6 +22248,12 @@ function buildConflictError(kind, name, message) {
22247
22248
  data: { kind, name }
22248
22249
  });
22249
22250
  }
22251
+ function buildIdChangedError(name, id) {
22252
+ return new ImpdError("CONFLICT", {
22253
+ message: `imp ${name} is no longer the imp with id ${id}`,
22254
+ data: { kind: "imp", name, reason: "id_changed" }
22255
+ });
22256
+ }
22250
22257
  var NOT_BACKED_UP_REASON = "created with backup off";
22251
22258
  function buildNotBackedUpError(name, refusal) {
22252
22259
  return new ImpdError("PRECONDITION_FAILED", {
@@ -30104,7 +30111,7 @@ function createImpRoutes(os, deps, views) {
30104
30111
  }),
30105
30112
  get: os.imps.get.handler((context) => views.readCallerImp(context.context.caller, deps.imps.readImp(context.input.name))),
30106
30113
  destroy: os.imps.destroy.handler(async (context) => {
30107
- await deps.imps.destroyImp(context.input.name);
30114
+ await deps.imps.destroyImp(context.input.name, { id: context.input.id });
30108
30115
  return {};
30109
30116
  }),
30110
30117
  start: os.imps.start.handler((context) => views.readCallerImp(context.context.caller, deps.imps.startImp(context.input.name))),
@@ -38800,7 +38807,12 @@ function createImpCommands(parts) {
38800
38807
  return presenter.readApi(after);
38801
38808
  }),
38802
38809
  destroyImp: async (name, options = {}) => {
38803
- await lock.withImp(name, removeLockedImp, options);
38810
+ await lock.withImp(name, async (imp) => {
38811
+ if (options.id !== undefined && imp.id !== options.id) {
38812
+ throw buildIdChangedError(name, options.id);
38813
+ }
38814
+ await removeLockedImp(imp);
38815
+ }, options);
38804
38816
  },
38805
38817
  destroyImpId: async (id, kind) => {
38806
38818
  await lock.withImpId(id, async (imp) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@impz/testing",
3
- "version": "6.9.1",
3
+ "version": "6.10.0",
4
4
  "description": "A real impd on stand-ins, for Bun tests of code that drives impd through @impz/client",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -43,7 +43,7 @@
43
43
  "ts-pattern": "^5.9.2",
44
44
  "xstate": "^5.33.3",
45
45
  "zod": "^4.6.7",
46
- "@impz/client": "6.9.1"
46
+ "@impz/client": "6.10.0"
47
47
  },
48
48
  "engines": {
49
49
  "bun": ">=1.4.3"