@terreno/admin-backend 0.13.3 → 0.14.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.
- package/dist/adminApp.js +1 -1
- package/dist/documentStorageApp.js +1 -1
- package/package.json +3 -3
- package/src/adminApp.ts +4 -5
- package/src/documentStorageApp.ts +1 -1
package/dist/adminApp.js
CHANGED
|
@@ -564,7 +564,7 @@ var AdminApp = /** @class */ (function () {
|
|
|
564
564
|
}
|
|
565
565
|
var _loop_2 = function (config) {
|
|
566
566
|
var hiddenFieldSet = new Set((_e = config.hiddenFields) !== null && _e !== void 0 ? _e : []);
|
|
567
|
-
// noExplicitAny:
|
|
567
|
+
// biome-ignore lint/suspicious/noExplicitAny: matches the Model<any> from AdminModelConfig above.
|
|
568
568
|
var routerOptions = __assign(__assign({}, (openApi ? { openApi: openApi } : {})), { permissions: {
|
|
569
569
|
create: [api_1.Permissions.IsAdmin],
|
|
570
570
|
delete: [api_1.Permissions.IsAdmin],
|
|
@@ -219,7 +219,7 @@ var DocumentStorageApp = /** @class */ (function () {
|
|
|
219
219
|
}); })], false));
|
|
220
220
|
// POST basePath/ — Upload a file
|
|
221
221
|
app.post.apply(app, __spreadArray(__spreadArray(["".concat(basePath, "/")], __read(adminGuard), false), [
|
|
222
|
-
// noExplicitAny: multer's RequestHandler type is incompatible with Express 5's middleware signature.
|
|
222
|
+
// biome-ignore lint/suspicious/noExplicitAny: multer's RequestHandler type is incompatible with Express 5's middleware signature.
|
|
223
223
|
upload.single("file"),
|
|
224
224
|
(0, api_1.asyncHandler)(function (req, res) { return __awaiter(_this, void 0, void 0, function () {
|
|
225
225
|
var file, targetPrefix, sanitizedFilename, gcsPath, gcsFile, documentFile;
|
package/package.json
CHANGED
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
},
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"@google-cloud/storage": "^7.15.0",
|
|
8
|
-
"@terreno/api": "0.
|
|
8
|
+
"@terreno/api": "0.14.0",
|
|
9
9
|
"express": "^5.2.1",
|
|
10
10
|
"luxon": "^3.7.2",
|
|
11
|
-
"multer": "
|
|
11
|
+
"multer": "2.1.1"
|
|
12
12
|
},
|
|
13
13
|
"description": "Admin panel backend plugin for @terreno/api",
|
|
14
14
|
"devDependencies": {
|
|
@@ -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.
|
|
56
|
+
"version": "0.14.0"
|
|
57
57
|
}
|
package/src/adminApp.ts
CHANGED
|
@@ -33,9 +33,8 @@ export interface AdminFieldOverride {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
export interface AdminModelConfig {
|
|
36
|
-
// noExplicitAny: Model must accept any document type for the generic admin panel;
|
|
37
|
-
// Model<unknown> breaks callers since Model<T> is invariant in T.
|
|
38
36
|
/** The Mongoose model to expose in the admin panel */
|
|
37
|
+
// biome-ignore lint/suspicious/noExplicitAny: Model<T> is invariant; the admin panel must accept any document shape.
|
|
39
38
|
model: Model<any>;
|
|
40
39
|
/** Route path for this model's endpoints, relative to basePath (e.g., "/users") */
|
|
41
40
|
routePath: string;
|
|
@@ -544,7 +543,7 @@ export class AdminApp {
|
|
|
544
543
|
// Mount modelRouter for each model with IsAdmin permissions
|
|
545
544
|
for (const config of modelConfigs) {
|
|
546
545
|
const hiddenFieldSet = new Set(config.hiddenFields ?? []);
|
|
547
|
-
// noExplicitAny:
|
|
546
|
+
// biome-ignore lint/suspicious/noExplicitAny: matches the Model<any> from AdminModelConfig above.
|
|
548
547
|
const routerOptions: ModelRouterOptions<any> = {
|
|
549
548
|
...(openApi ? {openApi: openApi as OpenApiMiddleware} : {}),
|
|
550
549
|
permissions: {
|
|
@@ -691,7 +690,7 @@ export class AdminApp {
|
|
|
691
690
|
throw new APIError({status: 403, title: "Only admins can view tasks"});
|
|
692
691
|
}
|
|
693
692
|
|
|
694
|
-
let task;
|
|
693
|
+
let task: BackgroundTaskDocument | null;
|
|
695
694
|
try {
|
|
696
695
|
task = await BackgroundTask.findById(req.params.id);
|
|
697
696
|
} catch (err: unknown) {
|
|
@@ -715,7 +714,7 @@ export class AdminApp {
|
|
|
715
714
|
throw new APIError({status: 403, title: "Only admins can cancel tasks"});
|
|
716
715
|
}
|
|
717
716
|
|
|
718
|
-
let task;
|
|
717
|
+
let task: BackgroundTaskDocument | null;
|
|
719
718
|
try {
|
|
720
719
|
task = await BackgroundTask.findById(req.params.id);
|
|
721
720
|
} catch (err: unknown) {
|
|
@@ -179,7 +179,7 @@ export class DocumentStorageApp {
|
|
|
179
179
|
app.post(
|
|
180
180
|
`${basePath}/`,
|
|
181
181
|
...adminGuard,
|
|
182
|
-
// noExplicitAny: multer's RequestHandler type is incompatible with Express 5's middleware signature.
|
|
182
|
+
// biome-ignore lint/suspicious/noExplicitAny: multer's RequestHandler type is incompatible with Express 5's middleware signature.
|
|
183
183
|
upload.single("file") as any,
|
|
184
184
|
asyncHandler(async (req: express.Request, res: express.Response) => {
|
|
185
185
|
const file = (req as unknown as {file?: Express.Multer.File}).file;
|