@terreno/admin-backend 0.11.4-beta.6 → 0.11.5

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.
@@ -924,13 +924,13 @@ var foodModelConfig = {
924
924
  runner: function (_wetRun, ctx) { return __awaiter(void 0, void 0, void 0, function () {
925
925
  return __generator(this, function (_a) {
926
926
  switch (_a.label) {
927
- case 0: return [4 /*yield*/, (ctx === null || ctx === void 0 ? void 0 : ctx.addLog("info", "hello"))];
927
+ case 0: return [4 /*yield*/, ctx.addLog("info", "hello")];
928
928
  case 1:
929
929
  _a.sent();
930
- return [4 /*yield*/, (ctx === null || ctx === void 0 ? void 0 : ctx.updateProgress(50, "Halfway", "Processing"))];
930
+ return [4 /*yield*/, ctx.updateProgress(50, "Halfway", "Processing")];
931
931
  case 2:
932
932
  _a.sent();
933
- return [4 /*yield*/, (ctx === null || ctx === void 0 ? void 0 : ctx.checkCancellation())];
933
+ return [4 /*yield*/, ctx.checkCancellation()];
934
934
  case 3:
935
935
  _a.sent();
936
936
  return [2 /*return*/, { results: ["ok"], success: true }];
@@ -151,8 +151,8 @@ var waitForScripts = function () { return new Promise(function (resolve) { retur
151
151
  case 2:
152
152
  task = _a.sent();
153
153
  (0, bun_test_1.expect)(task).not.toBeNull();
154
- (0, bun_test_1.expect)(task === null || task === void 0 ? void 0 : task.taskType).toBe("test-script");
155
- (0, bun_test_1.expect)(task === null || task === void 0 ? void 0 : task.isDryRun).toBe(true);
154
+ (0, bun_test_1.expect)(task.taskType).toBe("test-script");
155
+ (0, bun_test_1.expect)(task.isDryRun).toBe(true);
156
156
  return [2 /*return*/];
157
157
  }
158
158
  });
@@ -168,7 +168,7 @@ var waitForScripts = function () { return new Promise(function (resolve) { retur
168
168
  case 2:
169
169
  task = _a.sent();
170
170
  (0, bun_test_1.expect)(task).not.toBeNull();
171
- (0, bun_test_1.expect)(task === null || task === void 0 ? void 0 : task.isDryRun).toBe(false);
171
+ (0, bun_test_1.expect)(task.isDryRun).toBe(false);
172
172
  return [2 /*return*/];
173
173
  }
174
174
  });
@@ -184,7 +184,7 @@ var waitForScripts = function () { return new Promise(function (resolve) { retur
184
184
  case 2:
185
185
  task = _a.sent();
186
186
  (0, bun_test_1.expect)(task).not.toBeNull();
187
- (0, bun_test_1.expect)(task === null || task === void 0 ? void 0 : task.isDryRun).toBe(true);
187
+ (0, bun_test_1.expect)(task.isDryRun).toBe(true);
188
188
  return [2 /*return*/];
189
189
  }
190
190
  });
@@ -236,9 +236,9 @@ var waitForScripts = function () { return new Promise(function (resolve) { retur
236
236
  return [4 /*yield*/, api_1.BackgroundTask.findById(res.body.taskId)];
237
237
  case 2:
238
238
  task = _a.sent();
239
- (0, bun_test_1.expect)(task === null || task === void 0 ? void 0 : task.logs).toHaveLength(1);
240
- (0, bun_test_1.expect)(task === null || task === void 0 ? void 0 : task.logs[0].level).toBe("info");
241
- (0, bun_test_1.expect)(task === null || task === void 0 ? void 0 : task.logs[0].message).toInclude("Script started by");
239
+ (0, bun_test_1.expect)(task.logs).toHaveLength(1);
240
+ (0, bun_test_1.expect)(task.logs[0].level).toBe("info");
241
+ (0, bun_test_1.expect)(task.logs[0].message).toInclude("Script started by");
242
242
  return [2 /*return*/];
243
243
  }
244
244
  });
@@ -259,10 +259,10 @@ var waitForScripts = function () { return new Promise(function (resolve) { retur
259
259
  return [4 /*yield*/, api_1.BackgroundTask.findById(res.body.taskId)];
260
260
  case 3:
261
261
  task = _b.sent();
262
- (0, bun_test_1.expect)(task === null || task === void 0 ? void 0 : task.status).toBe("completed");
263
- (0, bun_test_1.expect)(task === null || task === void 0 ? void 0 : task.result).toContain("Ran in dry mode");
264
- (0, bun_test_1.expect)(task === null || task === void 0 ? void 0 : task.completedAt).toBeDefined();
265
- (0, bun_test_1.expect)((_a = task === null || task === void 0 ? void 0 : task.progress) === null || _a === void 0 ? void 0 : _a.percentage).toBe(100);
262
+ (0, bun_test_1.expect)(task.status).toBe("completed");
263
+ (0, bun_test_1.expect)(task.result).toContain("Ran in dry mode");
264
+ (0, bun_test_1.expect)(task.completedAt).toBeDefined();
265
+ (0, bun_test_1.expect)((_a = task.progress) === null || _a === void 0 ? void 0 : _a.percentage).toBe(100);
266
266
  return [2 /*return*/];
267
267
  }
268
268
  });
@@ -285,9 +285,9 @@ var waitForScripts = function () { return new Promise(function (resolve) { retur
285
285
  return [4 /*yield*/, api_1.BackgroundTask.findById(res.body.taskId)];
286
286
  case 4:
287
287
  task = _a.sent();
288
- (0, bun_test_1.expect)(task === null || task === void 0 ? void 0 : task.status).toBe("failed");
288
+ (0, bun_test_1.expect)(task.status).toBe("failed");
289
289
  (0, bun_test_1.expect)(task === null || task === void 0 ? void 0 : task.error).toBe("Script exploded");
290
- (0, bun_test_1.expect)(task === null || task === void 0 ? void 0 : task.result).toContain("Script exploded");
290
+ (0, bun_test_1.expect)(task.result).toContain("Script exploded");
291
291
  return [2 /*return*/];
292
292
  }
293
293
  });
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  },
6
6
  "dependencies": {
7
7
  "@google-cloud/storage": "^7.15.0",
8
- "@terreno/api": "0.11.4-beta.6",
8
+ "@terreno/api": "0.11.5",
9
9
  "express": "^5.2.1",
10
10
  "luxon": "^3.7.2",
11
11
  "multer": "^1.4.5-lts.1"
@@ -53,5 +53,5 @@
53
53
  "test:coverage": "bun run ../scripts/check-coverage.ts"
54
54
  },
55
55
  "types": "dist/index.d.ts",
56
- "version": "0.11.4-beta.6"
56
+ "version": "0.11.5"
57
57
  }
@@ -451,9 +451,9 @@ describe("AdminApp with scripts that use context", () => {
451
451
  description: "Exercises ctx",
452
452
  name: "ctx-script",
453
453
  runner: async (_wetRun, ctx) => {
454
- await ctx?.addLog("info", "hello");
455
- await ctx?.updateProgress(50, "Halfway", "Processing");
456
- await ctx?.checkCancellation();
454
+ await ctx!.addLog("info", "hello");
455
+ await ctx!.updateProgress(50, "Halfway", "Processing");
456
+ await ctx!.checkCancellation();
457
457
  return {results: ["ok"], success: true};
458
458
  },
459
459
  },
@@ -97,8 +97,8 @@ describe("AdminApp script routes", () => {
97
97
  // Verify the task was created in the database
98
98
  const task = await BackgroundTask.findById(res.body.taskId);
99
99
  expect(task).not.toBeNull();
100
- expect(task?.taskType).toBe("test-script");
101
- expect(task?.isDryRun).toBe(true);
100
+ expect(task!.taskType).toBe("test-script");
101
+ expect(task!.isDryRun).toBe(true);
102
102
  });
103
103
 
104
104
  it("creates a wet run task when wetRun=true", async () => {
@@ -106,7 +106,7 @@ describe("AdminApp script routes", () => {
106
106
 
107
107
  const task = await BackgroundTask.findById(res.body.taskId);
108
108
  expect(task).not.toBeNull();
109
- expect(task?.isDryRun).toBe(false);
109
+ expect(task!.isDryRun).toBe(false);
110
110
  });
111
111
 
112
112
  it("creates a dry run task by default", async () => {
@@ -114,7 +114,7 @@ describe("AdminApp script routes", () => {
114
114
 
115
115
  const task = await BackgroundTask.findById(res.body.taskId);
116
116
  expect(task).not.toBeNull();
117
- expect(task?.isDryRun).toBe(true);
117
+ expect(task!.isDryRun).toBe(true);
118
118
  });
119
119
 
120
120
  it("returns 404 for unknown script", async () => {
@@ -138,9 +138,9 @@ describe("AdminApp script routes", () => {
138
138
  const res = await adminAgent.post("/admin/scripts/test-script/run").expect(201);
139
139
 
140
140
  const task = await BackgroundTask.findById(res.body.taskId);
141
- expect(task?.logs).toHaveLength(1);
142
- expect(task?.logs[0].level).toBe("info");
143
- expect(task?.logs[0].message).toInclude("Script started by");
141
+ expect(task!.logs).toHaveLength(1);
142
+ expect(task!.logs[0].level).toBe("info");
143
+ expect(task!.logs[0].message).toInclude("Script started by");
144
144
  });
145
145
 
146
146
  it("completes the task asynchronously with results", async () => {
@@ -150,10 +150,10 @@ describe("AdminApp script routes", () => {
150
150
  await new Promise((resolve) => setTimeout(resolve, 100));
151
151
 
152
152
  const task = await BackgroundTask.findById(res.body.taskId);
153
- expect(task?.status).toBe("completed");
154
- expect(task?.result).toContain("Ran in dry mode");
155
- expect(task?.completedAt).toBeDefined();
156
- expect(task?.progress?.percentage).toBe(100);
153
+ expect(task!.status).toBe("completed");
154
+ expect(task!.result).toContain("Ran in dry mode");
155
+ expect(task!.completedAt).toBeDefined();
156
+ expect(task!.progress?.percentage).toBe(100);
157
157
  });
158
158
 
159
159
  it("marks task as failed when script throws", async () => {
@@ -165,9 +165,9 @@ describe("AdminApp script routes", () => {
165
165
  await new Promise((resolve) => setTimeout(resolve, 100));
166
166
 
167
167
  const task = await BackgroundTask.findById(res.body.taskId);
168
- expect(task?.status).toBe("failed");
168
+ expect(task!.status).toBe("failed");
169
169
  expect(task?.error).toBe("Script exploded");
170
- expect(task?.result).toContain("Script exploded");
170
+ expect(task!.result).toContain("Script exploded");
171
171
  });
172
172
  });
173
173