@terreno/admin-backend 57.0.0-beta.1 → 57.1.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 (43) hide show
  1. package/README.md +3 -0
  2. package/dist/adminApp.d.ts +11 -4
  3. package/dist/adminApp.js +859 -263
  4. package/dist/adminConfigIdentity.d.ts +16 -0
  5. package/dist/adminConfigIdentity.js +100 -0
  6. package/dist/adminTextSearch.d.ts +17 -0
  7. package/dist/adminTextSearch.js +117 -0
  8. package/dist/adminUiV2.js +1 -1
  9. package/dist/aggregateAdmin.d.ts +20 -0
  10. package/dist/aggregateAdmin.js +275 -0
  11. package/dist/documentStorageApp.d.ts +3 -1
  12. package/dist/documentStorageApp.js +20 -42
  13. package/dist/filterParser.d.ts +11 -0
  14. package/dist/filterParser.js +260 -0
  15. package/dist/index.d.ts +9 -0
  16. package/dist/index.js +15 -1
  17. package/dist/legacy.d.ts +9 -0
  18. package/dist/legacy.js +61 -0
  19. package/dist/resolvedAdminModel.d.ts +23 -0
  20. package/dist/resolvedAdminModel.js +130 -0
  21. package/dist/routePath.d.ts +2 -0
  22. package/dist/routePath.js +18 -0
  23. package/package.json +4 -3
  24. package/src/adminApp.models.test.ts +894 -1
  25. package/src/adminApp.test.ts +35 -1
  26. package/src/adminApp.ts +599 -98
  27. package/src/adminConfigIdentity.test.ts +56 -0
  28. package/src/adminConfigIdentity.ts +87 -0
  29. package/src/adminTextSearch.test.ts +73 -0
  30. package/src/adminTextSearch.ts +74 -0
  31. package/src/adminUiV2.test.ts +1 -0
  32. package/src/adminUiV2.ts +1 -1
  33. package/src/aggregateAdmin.test.ts +220 -0
  34. package/src/aggregateAdmin.ts +206 -0
  35. package/src/documentStorageApp.test.ts +11 -0
  36. package/src/documentStorageApp.ts +20 -39
  37. package/src/filterParser.test.ts +68 -0
  38. package/src/filterParser.ts +229 -0
  39. package/src/index.ts +35 -0
  40. package/src/legacy.test.ts +34 -0
  41. package/src/legacy.ts +63 -0
  42. package/src/resolvedAdminModel.ts +114 -0
  43. package/src/routePath.ts +14 -0
package/README.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # @terreno/admin-backend
2
2
 
3
+ See [Add a model to the admin](../docs/how-to/admin-add-model.md) for the recommended
4
+ `modelRouter({admin: ...})` setup.
5
+
3
6
  Admin panel backend plugin for `@terreno/api` that auto-generates admin CRUD endpoints and metadata for Mongoose models.
4
7
 
5
8
  ## Install
@@ -1,4 +1,4 @@
1
- import { type PopulatePath, type ScriptArgDef, type ScriptRunner, type User } from "@terreno/api";
1
+ import { type AnyTerrenoAccess, type PopulatePath, type ScriptArgDef, type ScriptRunner, type TerrenoApp, type User } from "@terreno/api";
2
2
  import express from "express";
3
3
  import type { Model } from "mongoose";
4
4
  import mongoose from "mongoose";
@@ -112,8 +112,8 @@ export interface AdminCustomScreenConfig {
112
112
  * Configuration options for the AdminApp plugin.
113
113
  */
114
114
  export interface AdminOptions {
115
- /** Array of model configurations to expose in the admin panel */
116
- models: AdminModelConfig[];
115
+ /** Legacy model configurations (deprecated — prefer modelRouter `admin:` or plugin contributions). */
116
+ models?: AdminModelConfig[];
117
117
  /** Array of scripts that can be run from the admin panel */
118
118
  scripts?: AdminScriptConfig[];
119
119
  /** Base path for all admin routes. Defaults to "/admin". */
@@ -127,6 +127,9 @@ export interface AdminOptions {
127
127
  * Consumers typically persist to an `AdminAuditLog` collection.
128
128
  */
129
129
  onAdminAudit?: (event: AdminAuditEvent, req: express.Request) => void | Promise<void>;
130
+ /** When set, admin shell entry requires `admin:access`; model CRUD also requires
131
+ * resource/action permissions (for example `user:update`) from the same Access instance. */
132
+ accessControl?: AnyTerrenoAccess;
130
133
  }
131
134
  export declare const getArrayEmbeddedSchemaType: (schemaPath: mongoose.SchemaType) => mongoose.SchemaType | undefined;
132
135
  /**
@@ -179,6 +182,10 @@ export declare class AdminApp {
179
182
  * @param options - Admin panel configuration including models and base path
180
183
  */
181
184
  constructor(options: AdminOptions);
185
+ private adminAccessPermissions;
186
+ private hasScriptPermission;
187
+ private hasConfigurationPermission;
188
+ private resourceActionPermissions;
182
189
  /**
183
190
  * Register admin routes with the Express application.
184
191
  *
@@ -195,6 +202,6 @@ export declare class AdminApp {
195
202
  *
196
203
  * @param app - The Express application instance to register with
197
204
  */
198
- register(app: express.Application, openApi?: unknown): void;
205
+ register(app: express.Application, openApi?: unknown, terrenoApp?: TerrenoApp): void;
199
206
  private mountScriptRoutes;
200
207
  }