@terreno/admin-backend 57.3.0 → 57.4.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 (44) hide show
  1. package/bunfig.toml +9 -1
  2. package/dist/adminApp.d.ts +20 -2
  3. package/dist/adminApp.js +468 -363
  4. package/dist/adminConfigIdentity.d.ts +1 -0
  5. package/dist/adminConfigIdentity.js +1 -0
  6. package/dist/adminMigrations.d.ts +10 -0
  7. package/dist/adminMigrations.js +205 -0
  8. package/dist/adminScriptJob.d.ts +32 -0
  9. package/dist/adminScriptJob.js +360 -0
  10. package/dist/adminTextSearch.d.ts +1 -0
  11. package/dist/adminTextSearch.js +1 -0
  12. package/dist/adminUiV2.d.ts +2 -0
  13. package/dist/aggregateAdmin.js +2 -0
  14. package/dist/enrichAdminListFilters.d.ts +7 -0
  15. package/dist/enrichAdminListFilters.js +37 -0
  16. package/dist/filterParser.js +139 -12
  17. package/dist/index.d.ts +2 -0
  18. package/dist/index.js +4 -1
  19. package/dist/legacy.js +4 -2
  20. package/dist/resolvedAdminModel.js +2 -1
  21. package/package.json +7 -7
  22. package/src/adminApp.migrations.test.ts +232 -0
  23. package/src/adminApp.models.test.ts +645 -1
  24. package/src/adminApp.syncMeta.test.ts +237 -0
  25. package/src/adminApp.test.ts +92 -0
  26. package/src/adminApp.ts +344 -124
  27. package/src/adminConfigIdentity.ts +1 -0
  28. package/src/adminHttpGoldens.test.ts +337 -0
  29. package/src/adminMigrations.ts +157 -0
  30. package/src/adminScriptJob.test.ts +297 -0
  31. package/src/adminScriptJob.ts +271 -0
  32. package/src/adminSyncMutationAuthMismatch.test.ts +650 -0
  33. package/src/adminTextSearch.test.ts +28 -0
  34. package/src/adminTextSearch.ts +1 -0
  35. package/src/adminUiV2.ts +2 -0
  36. package/src/aggregateAdmin.test.ts +125 -0
  37. package/src/aggregateAdmin.ts +2 -0
  38. package/src/enrichAdminListFilters.test.ts +44 -0
  39. package/src/enrichAdminListFilters.ts +29 -0
  40. package/src/filterParser.test.ts +95 -0
  41. package/src/filterParser.ts +156 -10
  42. package/src/index.ts +2 -0
  43. package/src/legacy.ts +5 -1
  44. package/src/resolvedAdminModel.ts +2 -1
package/bunfig.toml CHANGED
@@ -1,7 +1,15 @@
1
1
  [test]
2
2
  preload = ["./src/tests/bunSetup.ts"]
3
3
  root = "./src"
4
- coveragePathIgnorePatterns = ["**/*.test.ts", "../api/**", "dist/**", "**/node_modules/**"]
4
+ coveragePathIgnorePatterns = [
5
+ "**/*.test.ts",
6
+ "**/tests/**",
7
+ # Sibling workspace packages are compiled into `dist/` for this package's CI run;
8
+ # they carry their own coverage gates.
9
+ "../**",
10
+ "dist/**",
11
+ "**/node_modules/**",
12
+ ]
5
13
  # Enforced by scripts/check-coverage.ts; Bun parses this key but does not
6
14
  # fail the run when coverage is below threshold. See
7
15
  # https://github.com/oven-sh/bun/issues/7367 and https://github.com/oven-sh/bun/pull/27933.
@@ -114,6 +114,9 @@ export interface AdminCustomScreenConfig {
114
114
  name: string;
115
115
  /** Optional subtitle or help text shown with the screen card in the admin UI */
116
116
  description?: string;
117
+ /** Sidebar group label; grouped screens render with matching model groups in AdminShell. */
118
+ group?: string;
119
+ icon?: string;
117
120
  /** RBAC or custom authorization for exposing this screen in admin metadata/navigation. */
118
121
  adminAccess?: Pick<AdminAccessConfig, "authorize" | "resource"> & {
119
122
  action?: string;
@@ -134,14 +137,27 @@ export interface AdminOptions {
134
137
  /** Extra custom screens merged with built-ins (e.g. version-config) */
135
138
  customScreens?: AdminCustomScreenConfig[];
136
139
  /**
137
- * Optional audit sink for admin CRUD after modelRouter succeeds.
138
- * Consumers typically persist to an `AdminAuditLog` collection.
140
+ * Extra audit sink after successful admin CRUD. When `AuditApp` is registered,
141
+ * AdminApp also writes `AuditEvent` rows (`source: "admin"`) without this hook.
139
142
  */
140
143
  onAdminAudit?: (event: AdminAuditEvent, req: express.Request) => void | Promise<void>;
141
144
  /** When set, admin shell entry requires `admin:access`; model CRUD also requires
142
145
  * resource/action permissions (for example `user:update`) from the same Access instance. */
143
146
  accessControl?: AnyTerrenoAccess;
147
+ /**
148
+ * When `dir` is set, admin exposes GET/POST `/migrations` and
149
+ * `GET /admin/config` includes `migrations.enabled: true`.
150
+ */
151
+ migrations?: {
152
+ dir: string;
153
+ };
154
+ /**
155
+ * Scope admin CRUD for models with an `organizationId` schema path.
156
+ * Default false so existing single-tenant admin panels remain unchanged.
157
+ */
158
+ organizations?: boolean;
144
159
  }
160
+ /** @internal */
145
161
  export declare const getArrayEmbeddedSchemaType: (schemaPath: mongoose.SchemaType) => mongoose.SchemaType | undefined;
146
162
  /**
147
163
  * TerrenoPlugin that auto-generates admin CRUD endpoints for Mongoose models.
@@ -193,7 +209,9 @@ export declare class AdminApp {
193
209
  * @param options - Admin panel configuration including models and base path
194
210
  */
195
211
  constructor(options: AdminOptions);
212
+ private isOrganizationScoped;
196
213
  private adminAccessPermissions;
214
+ private adminRunScriptsPermissions;
197
215
  private hasScriptPermission;
198
216
  private hasConfigurationPermission;
199
217
  private canAnyResourceAction;