@env-hopper/backend-core 2.0.1-alpha → 2.0.1-alpha.2

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 (66) hide show
  1. package/dist/index.d.ts +1584 -0
  2. package/dist/index.d.ts.map +1 -0
  3. package/dist/index.js +1806 -0
  4. package/dist/index.js.map +1 -0
  5. package/package.json +26 -11
  6. package/prisma/migrations/20250526183023_init/migration.sql +71 -0
  7. package/prisma/migrations/migration_lock.toml +3 -0
  8. package/prisma/schema.prisma +121 -0
  9. package/src/db/client.ts +34 -0
  10. package/src/db/index.ts +17 -0
  11. package/src/db/syncAppCatalog.ts +67 -0
  12. package/src/db/tableSyncMagazine.ts +22 -0
  13. package/src/db/tableSyncPrismaAdapter.ts +202 -0
  14. package/src/index.ts +96 -3
  15. package/src/modules/admin/chat/createAdminChatHandler.ts +152 -0
  16. package/src/modules/admin/chat/createDatabaseTools.ts +261 -0
  17. package/src/modules/appCatalog/service.ts +79 -0
  18. package/src/modules/appCatalogAdmin/appCatalogAdminRouter.ts +113 -0
  19. package/src/modules/assets/assetRestController.ts +309 -0
  20. package/src/modules/assets/assetUtils.ts +81 -0
  21. package/src/modules/assets/screenshotRestController.ts +195 -0
  22. package/src/modules/assets/screenshotRouter.ts +116 -0
  23. package/src/modules/assets/syncAssets.ts +261 -0
  24. package/src/modules/auth/auth.ts +51 -0
  25. package/src/modules/auth/authProviders.ts +108 -0
  26. package/src/modules/auth/authRouter.ts +77 -0
  27. package/src/modules/auth/authorizationUtils.ts +114 -0
  28. package/src/modules/auth/registerAuthRoutes.ts +33 -0
  29. package/src/modules/icons/iconRestController.ts +190 -0
  30. package/src/modules/icons/iconRouter.ts +157 -0
  31. package/src/modules/icons/iconService.ts +73 -0
  32. package/src/server/controller.ts +102 -29
  33. package/src/server/ehStaticControllerContract.ts +8 -1
  34. package/src/server/ehTrpcContext.ts +0 -6
  35. package/src/types/backend/api.ts +1 -14
  36. package/src/types/backend/companySpecificBackend.ts +17 -0
  37. package/src/types/common/appCatalogTypes.ts +167 -0
  38. package/src/types/common/dataRootTypes.ts +72 -10
  39. package/src/types/index.ts +2 -0
  40. package/dist/esm/__tests__/dummy.test.d.ts +0 -1
  41. package/dist/esm/index.d.ts +0 -7
  42. package/dist/esm/index.js +0 -9
  43. package/dist/esm/index.js.map +0 -1
  44. package/dist/esm/server/controller.d.ts +0 -32
  45. package/dist/esm/server/controller.js +0 -35
  46. package/dist/esm/server/controller.js.map +0 -1
  47. package/dist/esm/server/db.d.ts +0 -2
  48. package/dist/esm/server/ehStaticControllerContract.d.ts +0 -9
  49. package/dist/esm/server/ehStaticControllerContract.js +0 -12
  50. package/dist/esm/server/ehStaticControllerContract.js.map +0 -1
  51. package/dist/esm/server/ehTrpcContext.d.ts +0 -8
  52. package/dist/esm/server/ehTrpcContext.js +0 -11
  53. package/dist/esm/server/ehTrpcContext.js.map +0 -1
  54. package/dist/esm/types/backend/api.d.ts +0 -71
  55. package/dist/esm/types/backend/common.d.ts +0 -9
  56. package/dist/esm/types/backend/dataSources.d.ts +0 -20
  57. package/dist/esm/types/backend/deployments.d.ts +0 -34
  58. package/dist/esm/types/common/app/appTypes.d.ts +0 -12
  59. package/dist/esm/types/common/app/ui/appUiTypes.d.ts +0 -10
  60. package/dist/esm/types/common/appCatalogTypes.d.ts +0 -16
  61. package/dist/esm/types/common/dataRootTypes.d.ts +0 -32
  62. package/dist/esm/types/common/env/envTypes.d.ts +0 -6
  63. package/dist/esm/types/common/resourceTypes.d.ts +0 -8
  64. package/dist/esm/types/common/sharedTypes.d.ts +0 -4
  65. package/dist/esm/types/index.d.ts +0 -11
  66. package/src/server/db.ts +0 -4
@@ -0,0 +1,1584 @@
1
+ import * as _trpc_server0 from "@trpc/server";
2
+ import { TRPCRootObject } from "@trpc/server";
3
+ import * as _prisma_client0 from "@prisma/client";
4
+ import { Prisma, PrismaClient } from "@prisma/client";
5
+ import * as better_auth0 from "better-auth";
6
+ import { BetterAuthOptions, BetterAuthPlugin } from "better-auth";
7
+ import { LanguageModel, Tool, tool } from "ai";
8
+ import * as _prisma_client_runtime_library0 from "@prisma/client/runtime/library";
9
+ import { DefaultWithOverridesAndTemplate } from "@env-hopper/shared-core";
10
+ import { Express, Request, Response, Router } from "express";
11
+
12
+ //#region src/types/common/sharedTypes.d.ts
13
+ interface EhMetaDictionary {
14
+ [key: string]: string | null | Record<string, string | null>;
15
+ }
16
+ type Tag = string;
17
+ //#endregion
18
+ //#region src/types/common/resourceTypes.d.ts
19
+ /**
20
+ * Resources like kafka topics, database tables, etc.
21
+ */
22
+ interface EhResourceIndexed {
23
+ slug: string;
24
+ displayName: string;
25
+ defaultFixedValues?: Array<string>;
26
+ }
27
+ //#endregion
28
+ //#region src/types/common/app/ui/appUiTypes.d.ts
29
+ interface EhAppPageIndexed {
30
+ slug: string;
31
+ displayName: string;
32
+ url: string;
33
+ tags?: Array<Tag>;
34
+ }
35
+ interface EhAppUiIndexed {
36
+ pages: Array<EhAppPageIndexed>;
37
+ }
38
+ //#endregion
39
+ //#region src/types/common/app/appTypes.d.ts
40
+ interface EhAppIndexed {
41
+ slug: string;
42
+ displayName: string;
43
+ abbr?: string;
44
+ aliases?: Array<string>;
45
+ ui?: EhAppUiIndexed;
46
+ tags?: Array<Tag>;
47
+ iconName?: string;
48
+ meta?: EhMetaDictionary;
49
+ }
50
+ //#endregion
51
+ //#region src/types/backend/common.d.ts
52
+ interface EhBackendUiDefaultsInput {
53
+ credentialsRefs: Array<string>;
54
+ }
55
+ interface EhBackendCredentialInput {
56
+ slug: string;
57
+ desc?: string;
58
+ username: string;
59
+ password: string;
60
+ }
61
+ //#endregion
62
+ //#region src/types/backend/dataSources.d.ts
63
+ interface EhBackendDataSourceInputCommon {
64
+ meta?: EhMetaDictionary;
65
+ }
66
+ interface EhBackendDataSourceInputDb {
67
+ slug?: string;
68
+ type: 'db';
69
+ url: string;
70
+ username: string;
71
+ password: string;
72
+ }
73
+ interface EhBackendDataSourceInputKafka {
74
+ slug?: string;
75
+ type: 'kafka';
76
+ topics: {
77
+ consumer?: Array<string>;
78
+ producer?: Array<string>;
79
+ };
80
+ }
81
+ type EhBackendDataSourceInput = EhBackendDataSourceInputCommon & (EhBackendDataSourceInputDb | EhBackendDataSourceInputKafka);
82
+ //#endregion
83
+ //#region src/types/backend/api.d.ts
84
+ interface EhBackendVersionsRequestParams {
85
+ envNames: Array<string>;
86
+ appNames: Array<string>;
87
+ }
88
+ interface EhBackendVersionsReturn {
89
+ envIds: Array<string>;
90
+ appIds: Array<string>;
91
+ }
92
+ interface EhBackendPageInput extends EhAppPageIndexed {
93
+ slug: string;
94
+ title?: string;
95
+ url: string;
96
+ credentialsRefs?: Array<string>;
97
+ }
98
+ interface EhBackendAppUIBaseInput {
99
+ credentials?: Array<EhBackendCredentialInput>;
100
+ defaults?: EhBackendUiDefaultsInput;
101
+ }
102
+ interface EhBackendAppUIInput extends EhBackendAppUIBaseInput, EhAppUiIndexed {
103
+ pages: Array<EhBackendPageInput>;
104
+ }
105
+ interface EhBackendTagsDescriptionDataIndexed {
106
+ descriptions: Array<EhBackendTagDescriptionDataIndexed>;
107
+ }
108
+ interface EhBackendTagDescriptionDataIndexed {
109
+ tagKey: string;
110
+ displayName?: string;
111
+ fixedTagValues?: Array<EhBackendTagFixedTagValue>;
112
+ }
113
+ interface EhBackendTagFixedTagValue {
114
+ tagValue: string;
115
+ displayName: string;
116
+ }
117
+ interface EhBackendAppInput extends EhAppIndexed {
118
+ ui?: EhBackendAppUIInput;
119
+ dataSources?: Array<EhBackendDataSourceInput>;
120
+ }
121
+ interface EhContextIndexed {
122
+ slug: string;
123
+ displayName: string;
124
+ /**
125
+ * The value is shared across envs (By default: false)
126
+ */
127
+ isSharedAcrossEnvs?: boolean;
128
+ defaultFixedValues?: Array<string>;
129
+ }
130
+ type EhBackendAppDto = EhAppIndexed;
131
+ interface EhAppsMeta {
132
+ defaultIcon?: string;
133
+ tags: EhBackendTagsDescriptionDataIndexed;
134
+ }
135
+ interface RenameRuleParams {
136
+ envSlug?: string;
137
+ resourceSlug?: string;
138
+ }
139
+ interface RenameRule {
140
+ type: 'resourceRename' | 'envRename';
141
+ oldSlug: string;
142
+ targetSlug: string;
143
+ }
144
+ //#endregion
145
+ //#region src/types/common/env/envTypes.d.ts
146
+ interface EhEnvIndexed {
147
+ slug: string;
148
+ displayName: string;
149
+ meta?: EhMetaDictionary;
150
+ }
151
+ //#endregion
152
+ //#region src/types/common/dataRootTypes.d.ts
153
+ type JumpResourceSlug = string;
154
+ type EnvSlug = string;
155
+ interface BootstrapConfigData {
156
+ envs: Record<EnvSlug, EhEnvIndexed>;
157
+ apps: Record<string, EhAppIndexed>;
158
+ appsMeta: EhAppsMeta;
159
+ contexts: Array<EhContextIndexed>;
160
+ defaults: {
161
+ envSlug: EnvSlug;
162
+ resourceJumpSlug: JumpResourceSlug;
163
+ };
164
+ }
165
+ interface AvailabilityMatrixData {
166
+ envSlugs: Array<EnvSlug>;
167
+ resourceJumpSlugs: Array<JumpResourceSlug>;
168
+ availabilityVariants: Array<AvailabilityVariant>;
169
+ matrix: Array<Array<number>>;
170
+ }
171
+ interface AvailabilityVariant {
172
+ isDeployed: boolean;
173
+ isHealthy?: boolean;
174
+ hasData?: boolean;
175
+ }
176
+ type ResourceJumpMetaInfo = Record<string, string>;
177
+ interface Sluggable {
178
+ slug: string;
179
+ }
180
+ interface DisplayNamable {
181
+ displayName: string;
182
+ }
183
+ interface SlugAndDisplayable extends Sluggable, DisplayNamable {
184
+ slug: string;
185
+ displayName: string;
186
+ }
187
+ interface EnvBaseInfo extends SlugAndDisplayable {
188
+ slug: string;
189
+ displayName: string;
190
+ templateParams?: Record<string, string>;
191
+ }
192
+ interface LateResolvableParam extends SlugAndDisplayable {
193
+ slug: string;
194
+ displayName: string;
195
+ }
196
+ interface ResourceJump extends SlugAndDisplayable {
197
+ slug: string;
198
+ displayName: string;
199
+ urlTemplate: DefaultWithOverridesAndTemplate;
200
+ lateResolvableParamSlugs?: Array<string>;
201
+ }
202
+ interface ResourceJumpGroup {
203
+ slug: string;
204
+ displayName: string;
205
+ resourceSlugs: Array<string>;
206
+ }
207
+ interface ResourceJumpsData {
208
+ resourceJumps: Array<ResourceJump>;
209
+ envs: Array<EnvBaseInfo>;
210
+ lateResolvableParams: Array<LateResolvableParam>;
211
+ groups?: Array<ResourceJumpGroup>;
212
+ }
213
+ interface ResourceJumpsExtendedData {
214
+ envs: Array<EnvInfoExtended>;
215
+ }
216
+ interface EnvInfoExtended extends Sluggable {
217
+ slug: string;
218
+ description?: string;
219
+ owner?: User;
220
+ }
221
+ interface User {
222
+ id: string;
223
+ displayName: string;
224
+ }
225
+ //#endregion
226
+ //#region src/types/common/appCatalogTypes.d.ts
227
+ /**
228
+ * App Catalog Types - Universal Software Access Request Catalog
229
+ *
230
+ * These types define a standardized catalog of software applications and their
231
+ * access methods. The typing system is designed to be universal across companies,
232
+ * abstracting away specific tools (Jira, Slack, etc.) into generic categories.
233
+ */
234
+ /**
235
+ * Bot provider configuration - for chat/AI bots that handle access requests
236
+ */
237
+ interface BotProvider {
238
+ id: string;
239
+ name: string;
240
+ platform?: 'slack' | 'teams' | 'web' | 'other';
241
+ url?: string;
242
+ icon?: string;
243
+ instructions?: string;
244
+ }
245
+ /**
246
+ * Ticketing system provider configuration
247
+ */
248
+ interface TicketingProvider {
249
+ id: string;
250
+ name: string;
251
+ system: 'jira' | 'servicenow' | 'zendesk' | 'freshdesk' | 'other';
252
+ baseUrl: string;
253
+ icon?: string;
254
+ }
255
+ /**
256
+ * Bot-based access - request access through a chat bot
257
+ */
258
+ interface BotAccess {
259
+ type: 'bot';
260
+ providerId: string;
261
+ prompt: string;
262
+ }
263
+ /**
264
+ * Ticketing system access - submit a ticket/request
265
+ */
266
+ interface TicketingAccess {
267
+ type: 'ticketing';
268
+ providerId: string;
269
+ queue?: string;
270
+ portalPath?: string;
271
+ formId?: string;
272
+ }
273
+ /**
274
+ * Email-based access - contact specific people via email
275
+ */
276
+ interface EmailAccess {
277
+ type: 'email';
278
+ contacts: Array<{
279
+ name?: string;
280
+ email: string;
281
+ role?: string;
282
+ }>;
283
+ subject?: string;
284
+ template?: string;
285
+ }
286
+ /**
287
+ * Self-service access - no approval needed, just follow instructions
288
+ */
289
+ interface SelfServiceAccess {
290
+ type: 'self-service';
291
+ url?: string;
292
+ instructions: string;
293
+ }
294
+ /**
295
+ * Documentation-based access - refer to external documentation
296
+ */
297
+ interface DocumentationAccess {
298
+ type: 'documentation';
299
+ url: string;
300
+ title?: string;
301
+ }
302
+ /**
303
+ * Manual/custom access - step-by-step instructions
304
+ */
305
+ interface ManualAccess {
306
+ type: 'manual';
307
+ instructions: string;
308
+ steps?: Array<string>;
309
+ }
310
+ /**
311
+ * Union type for all access methods
312
+ */
313
+ type AccessMethod = BotAccess | TicketingAccess | EmailAccess | SelfServiceAccess | DocumentationAccess | ManualAccess;
314
+ /**
315
+ * Approver information for apps that require specific approval
316
+ */
317
+ interface Approver {
318
+ name: string;
319
+ email: string;
320
+ }
321
+ /**
322
+ * Available roles for an application
323
+ */
324
+ interface AppRole {
325
+ id: string;
326
+ name: string;
327
+ description?: string;
328
+ }
329
+ /**
330
+ * Application entry in the catalog
331
+ */
332
+ interface AppForCatalog {
333
+ id: string;
334
+ slug: string;
335
+ displayName: string;
336
+ description?: string;
337
+ access?: AccessMethod;
338
+ teams?: Array<string>;
339
+ roles?: Array<AppRole>;
340
+ approver?: Approver;
341
+ notes?: string;
342
+ tags?: Array<string>;
343
+ appUrl?: string;
344
+ links?: Array<{
345
+ url: string;
346
+ title?: string;
347
+ }>;
348
+ iconName?: string;
349
+ screenshotIds?: Array<string>;
350
+ }
351
+ interface AppCategory {
352
+ id: string;
353
+ name: string;
354
+ }
355
+ interface AppCatalogData {
356
+ apps: Array<AppForCatalog>;
357
+ categories: Array<AppCategory>;
358
+ }
359
+ interface EhAppCatalogData {
360
+ apps: Array<EhAppCatalogDto>;
361
+ }
362
+ interface EhAppCatalogDto {
363
+ slug: string;
364
+ groups: Array<EhAppCatalogGroupDto>;
365
+ }
366
+ interface EhAppCatalogGroupDto {
367
+ slug: string;
368
+ displayName: string;
369
+ pages: Array<EhAppCatalogPageDto>;
370
+ }
371
+ interface EhAppCatalogPageDto {
372
+ slug: string;
373
+ displayName: string;
374
+ }
375
+ //#endregion
376
+ //#region src/types/backend/companySpecificBackend.d.ts
377
+ interface EhBackendCompanySpecificBackend {
378
+ getBootstrapData: () => Promise<BootstrapConfigData>;
379
+ getAvailabilityMatrix: () => Promise<AvailabilityMatrixData>;
380
+ getNameMigrations: (params: RenameRuleParams) => Promise<RenameRule | false>;
381
+ getResourceJumps: () => Promise<ResourceJumpsData>;
382
+ getResourceJumpsExtended: () => Promise<ResourceJumpsExtendedData>;
383
+ getApps?: () => Promise<Array<AppForCatalog>>;
384
+ }
385
+ //#endregion
386
+ //#region src/types/backend/deployments.d.ts
387
+ interface EhBackendEnvironmentInput {
388
+ slug: string;
389
+ displayName?: string;
390
+ description?: string;
391
+ meta?: EhMetaDictionary;
392
+ }
393
+ interface EhBackendDeploymentInput {
394
+ envId: string;
395
+ appId: string;
396
+ displayVersion: string;
397
+ meta?: EhMetaDictionary;
398
+ }
399
+ interface EhBackendDeployableInput {
400
+ slug: string;
401
+ meta?: {
402
+ config: string;
403
+ };
404
+ }
405
+ /**
406
+ * Latest - backend returned latest data.
407
+ * Cached - backend in process of updating data, but returned cached data.
408
+ */
409
+ type EhBackendDataFreshness = 'latest' | 'cached';
410
+ interface EhBackendDataVersion {
411
+ version: string;
412
+ freshness: EhBackendDataFreshness;
413
+ }
414
+ interface EhBackendDeployment {
415
+ appName: string;
416
+ deployableServiceName: string;
417
+ envName: string;
418
+ version: EhBackendDataVersion;
419
+ }
420
+ //#endregion
421
+ //#region src/modules/auth/auth.d.ts
422
+ interface AuthConfig {
423
+ appName?: string;
424
+ baseURL: string;
425
+ secret: string;
426
+ providers?: BetterAuthOptions['socialProviders'];
427
+ plugins?: Array<BetterAuthPlugin>;
428
+ /** Session expiration in seconds. Default: 7 days (604800) */
429
+ sessionExpiresIn?: number;
430
+ /** Session update age in seconds. Default: 1 day (86400) */
431
+ sessionUpdateAge?: number;
432
+ }
433
+ declare function createAuth(config: AuthConfig): better_auth0.Auth<{
434
+ appName: string;
435
+ baseURL: string;
436
+ basePath: string;
437
+ secret: string;
438
+ database: (options: BetterAuthOptions) => better_auth0.DBAdapter<BetterAuthOptions>;
439
+ socialProviders: better_auth0.SocialProviders;
440
+ plugins: BetterAuthPlugin[];
441
+ emailAndPassword: {
442
+ enabled: true;
443
+ };
444
+ session: {
445
+ expiresIn: number;
446
+ updateAge: number;
447
+ cookieCache: {
448
+ enabled: true;
449
+ maxAge: number;
450
+ };
451
+ };
452
+ advanced: {
453
+ useSecureCookies: boolean;
454
+ };
455
+ }>;
456
+ type BetterAuth = ReturnType<typeof createAuth>;
457
+ //#endregion
458
+ //#region src/server/ehTrpcContext.d.ts
459
+ interface EhTrpcContext {
460
+ companySpecificBackend: EhBackendCompanySpecificBackend;
461
+ }
462
+ interface EhTrpcContextOptions {
463
+ companySpecificBackend: EhBackendCompanySpecificBackend;
464
+ }
465
+ declare function createEhTrpcContext({
466
+ companySpecificBackend
467
+ }: EhTrpcContextOptions): EhTrpcContext;
468
+ //#endregion
469
+ //#region src/server/controller.d.ts
470
+ /**
471
+ * Create the main tRPC router with optional auth instance
472
+ * @param auth - Optional Better Auth instance for auth-related queries
473
+ */
474
+ declare function createTrpcRouter(auth?: BetterAuth): _trpc_server0.TRPCBuiltRouter<{
475
+ ctx: EhTrpcContext;
476
+ meta: {};
477
+ errorShape: _trpc_server0.TRPCDefaultErrorShape;
478
+ transformer: false;
479
+ }, _trpc_server0.TRPCDecorateCreateRouterOptions<{
480
+ bootstrap: _trpc_server0.TRPCQueryProcedure<{
481
+ input: void;
482
+ output: BootstrapConfigData;
483
+ meta: {};
484
+ }>;
485
+ availabilityMatrix: _trpc_server0.TRPCQueryProcedure<{
486
+ input: void;
487
+ output: AvailabilityMatrixData;
488
+ meta: {};
489
+ }>;
490
+ tryFindRenameRule: _trpc_server0.TRPCQueryProcedure<{
491
+ input: {
492
+ envSlug?: string | undefined;
493
+ resourceSlug?: string | undefined;
494
+ };
495
+ output: false | RenameRule;
496
+ meta: {};
497
+ }>;
498
+ resourceJumps: _trpc_server0.TRPCQueryProcedure<{
499
+ input: void;
500
+ output: ResourceJumpsData;
501
+ meta: {};
502
+ }>;
503
+ resourceJumpsExtended: _trpc_server0.TRPCQueryProcedure<{
504
+ input: void;
505
+ output: ResourceJumpsExtendedData;
506
+ meta: {};
507
+ }>;
508
+ resourceJumpBySlugAndEnv: _trpc_server0.TRPCQueryProcedure<{
509
+ input: {
510
+ jumpResourceSlug: string;
511
+ envSlug: string;
512
+ };
513
+ output: ResourceJumpsData;
514
+ meta: {};
515
+ }>;
516
+ appCatalog: _trpc_server0.TRPCQueryProcedure<{
517
+ input: void;
518
+ output: AppCatalogData;
519
+ meta: {};
520
+ }>;
521
+ icon: _trpc_server0.TRPCBuiltRouter<{
522
+ ctx: EhTrpcContext;
523
+ meta: {};
524
+ errorShape: _trpc_server0.TRPCDefaultErrorShape;
525
+ transformer: false;
526
+ }, _trpc_server0.TRPCDecorateCreateRouterOptions<{
527
+ list: _trpc_server0.TRPCQueryProcedure<{
528
+ input: void;
529
+ output: {
530
+ id: string;
531
+ name: string;
532
+ mimeType: string;
533
+ fileSize: number;
534
+ createdAt: Date;
535
+ updatedAt: Date;
536
+ }[];
537
+ meta: {};
538
+ }>;
539
+ getOne: _trpc_server0.TRPCQueryProcedure<{
540
+ input: {
541
+ id: string;
542
+ };
543
+ output: {
544
+ id: string;
545
+ name: string;
546
+ content: _prisma_client_runtime_library0.Bytes;
547
+ mimeType: string;
548
+ fileSize: number;
549
+ assetType: _prisma_client0.$Enums.AssetType;
550
+ checksum: string;
551
+ width: number | null;
552
+ height: number | null;
553
+ createdAt: Date;
554
+ updatedAt: Date;
555
+ } | null;
556
+ meta: {};
557
+ }>;
558
+ create: _trpc_server0.TRPCMutationProcedure<{
559
+ input: {
560
+ name: string;
561
+ content: string;
562
+ mimeType: string;
563
+ fileSize: number;
564
+ };
565
+ output: {
566
+ id: string;
567
+ name: string;
568
+ content: _prisma_client_runtime_library0.Bytes;
569
+ mimeType: string;
570
+ fileSize: number;
571
+ assetType: _prisma_client0.$Enums.AssetType;
572
+ checksum: string;
573
+ width: number | null;
574
+ height: number | null;
575
+ createdAt: Date;
576
+ updatedAt: Date;
577
+ };
578
+ meta: {};
579
+ }>;
580
+ update: _trpc_server0.TRPCMutationProcedure<{
581
+ input: {
582
+ id: string;
583
+ name?: string | undefined;
584
+ content?: string | undefined;
585
+ mimeType?: string | undefined;
586
+ fileSize?: number | undefined;
587
+ };
588
+ output: {
589
+ id: string;
590
+ name: string;
591
+ content: _prisma_client_runtime_library0.Bytes;
592
+ mimeType: string;
593
+ fileSize: number;
594
+ assetType: _prisma_client0.$Enums.AssetType;
595
+ checksum: string;
596
+ width: number | null;
597
+ height: number | null;
598
+ createdAt: Date;
599
+ updatedAt: Date;
600
+ };
601
+ meta: {};
602
+ }>;
603
+ delete: _trpc_server0.TRPCMutationProcedure<{
604
+ input: {
605
+ id: string;
606
+ };
607
+ output: {
608
+ id: string;
609
+ name: string;
610
+ content: _prisma_client_runtime_library0.Bytes;
611
+ mimeType: string;
612
+ fileSize: number;
613
+ assetType: _prisma_client0.$Enums.AssetType;
614
+ checksum: string;
615
+ width: number | null;
616
+ height: number | null;
617
+ createdAt: Date;
618
+ updatedAt: Date;
619
+ };
620
+ meta: {};
621
+ }>;
622
+ deleteMany: _trpc_server0.TRPCMutationProcedure<{
623
+ input: {
624
+ ids: string[];
625
+ };
626
+ output: _prisma_client0.Prisma.BatchPayload;
627
+ meta: {};
628
+ }>;
629
+ getContent: _trpc_server0.TRPCQueryProcedure<{
630
+ input: {
631
+ id: string;
632
+ };
633
+ output: {
634
+ content: string;
635
+ mimeType: string;
636
+ };
637
+ meta: {};
638
+ }>;
639
+ }>>;
640
+ screenshot: _trpc_server0.TRPCBuiltRouter<{
641
+ ctx: EhTrpcContext;
642
+ meta: {};
643
+ errorShape: _trpc_server0.TRPCDefaultErrorShape;
644
+ transformer: false;
645
+ }, _trpc_server0.TRPCDecorateCreateRouterOptions<{
646
+ list: _trpc_server0.TRPCQueryProcedure<{
647
+ input: void;
648
+ output: {
649
+ id: string;
650
+ name: string;
651
+ mimeType: string;
652
+ fileSize: number;
653
+ width: number | null;
654
+ height: number | null;
655
+ createdAt: Date;
656
+ updatedAt: Date;
657
+ }[];
658
+ meta: {};
659
+ }>;
660
+ getOne: _trpc_server0.TRPCQueryProcedure<{
661
+ input: {
662
+ id: string;
663
+ };
664
+ output: {
665
+ id: string;
666
+ name: string;
667
+ mimeType: string;
668
+ fileSize: number;
669
+ width: number | null;
670
+ height: number | null;
671
+ createdAt: Date;
672
+ updatedAt: Date;
673
+ } | null;
674
+ meta: {};
675
+ }>;
676
+ getByAppSlug: _trpc_server0.TRPCQueryProcedure<{
677
+ input: {
678
+ appSlug: string;
679
+ };
680
+ output: {
681
+ id: string;
682
+ name: string;
683
+ mimeType: string;
684
+ fileSize: number;
685
+ width: number | null;
686
+ height: number | null;
687
+ createdAt: Date;
688
+ updatedAt: Date;
689
+ }[];
690
+ meta: {};
691
+ }>;
692
+ getFirstByAppSlug: _trpc_server0.TRPCQueryProcedure<{
693
+ input: {
694
+ appSlug: string;
695
+ };
696
+ output: {
697
+ id: string;
698
+ name: string;
699
+ mimeType: string;
700
+ fileSize: number;
701
+ width: number | null;
702
+ height: number | null;
703
+ createdAt: Date;
704
+ updatedAt: Date;
705
+ } | null;
706
+ meta: {};
707
+ }>;
708
+ }>>;
709
+ appCatalogAdmin: _trpc_server0.TRPCBuiltRouter<{
710
+ ctx: EhTrpcContext;
711
+ meta: {};
712
+ errorShape: _trpc_server0.TRPCDefaultErrorShape;
713
+ transformer: false;
714
+ }, _trpc_server0.TRPCDecorateCreateRouterOptions<{
715
+ list: _trpc_server0.TRPCQueryProcedure<{
716
+ input: void;
717
+ output: {
718
+ id: string;
719
+ createdAt: Date;
720
+ updatedAt: Date;
721
+ description: string;
722
+ slug: string;
723
+ displayName: string;
724
+ access: PrismaJson.AccessMethod;
725
+ teams: string[];
726
+ roles: PrismaJson.AppRole | null;
727
+ approverName: string | null;
728
+ approverEmail: string | null;
729
+ notes: string | null;
730
+ tags: string[];
731
+ appUrl: string | null;
732
+ links: PrismaJson.AppLink[] | null;
733
+ iconName: string | null;
734
+ screenshotIds: string[];
735
+ }[];
736
+ meta: {};
737
+ }>;
738
+ getById: _trpc_server0.TRPCQueryProcedure<{
739
+ input: {
740
+ id: string;
741
+ };
742
+ output: {
743
+ id: string;
744
+ createdAt: Date;
745
+ updatedAt: Date;
746
+ description: string;
747
+ slug: string;
748
+ displayName: string;
749
+ access: PrismaJson.AccessMethod;
750
+ teams: string[];
751
+ roles: PrismaJson.AppRole | null;
752
+ approverName: string | null;
753
+ approverEmail: string | null;
754
+ notes: string | null;
755
+ tags: string[];
756
+ appUrl: string | null;
757
+ links: PrismaJson.AppLink[] | null;
758
+ iconName: string | null;
759
+ screenshotIds: string[];
760
+ } | null;
761
+ meta: {};
762
+ }>;
763
+ create: _trpc_server0.TRPCMutationProcedure<{
764
+ input: {
765
+ slug: string;
766
+ displayName: string;
767
+ description: string;
768
+ access: {
769
+ [x: string]: unknown;
770
+ type: "bot" | "ticketing" | "email" | "self-service" | "documentation" | "manual";
771
+ };
772
+ teams?: string[] | undefined;
773
+ roles?: {
774
+ id: string;
775
+ name: string;
776
+ description?: string | undefined;
777
+ }[] | undefined;
778
+ approver?: {
779
+ name: string;
780
+ email: string;
781
+ } | undefined;
782
+ notes?: string | undefined;
783
+ tags?: string[] | undefined;
784
+ appUrl?: string | undefined;
785
+ links?: {
786
+ url: string;
787
+ displayName?: string | undefined;
788
+ }[] | undefined;
789
+ iconName?: string | undefined;
790
+ screenshotIds?: string[] | undefined;
791
+ };
792
+ output: {
793
+ id: string;
794
+ createdAt: Date;
795
+ updatedAt: Date;
796
+ description: string;
797
+ slug: string;
798
+ displayName: string;
799
+ access: PrismaJson.AccessMethod;
800
+ teams: string[];
801
+ roles: PrismaJson.AppRole | null;
802
+ approverName: string | null;
803
+ approverEmail: string | null;
804
+ notes: string | null;
805
+ tags: string[];
806
+ appUrl: string | null;
807
+ links: PrismaJson.AppLink[] | null;
808
+ iconName: string | null;
809
+ screenshotIds: string[];
810
+ };
811
+ meta: {};
812
+ }>;
813
+ update: _trpc_server0.TRPCMutationProcedure<{
814
+ input: {
815
+ id: string;
816
+ slug?: string | undefined;
817
+ displayName?: string | undefined;
818
+ description?: string | undefined;
819
+ access?: {
820
+ [x: string]: unknown;
821
+ type: "bot" | "ticketing" | "email" | "self-service" | "documentation" | "manual";
822
+ } | undefined;
823
+ teams?: string[] | undefined;
824
+ roles?: {
825
+ id: string;
826
+ name: string;
827
+ description?: string | undefined;
828
+ }[] | undefined;
829
+ approver?: {
830
+ name: string;
831
+ email: string;
832
+ } | undefined;
833
+ notes?: string | undefined;
834
+ tags?: string[] | undefined;
835
+ appUrl?: string | undefined;
836
+ links?: {
837
+ url: string;
838
+ displayName?: string | undefined;
839
+ }[] | undefined;
840
+ iconName?: string | undefined;
841
+ screenshotIds?: string[] | undefined;
842
+ };
843
+ output: {
844
+ id: string;
845
+ createdAt: Date;
846
+ updatedAt: Date;
847
+ description: string;
848
+ slug: string;
849
+ displayName: string;
850
+ access: PrismaJson.AccessMethod;
851
+ teams: string[];
852
+ roles: PrismaJson.AppRole | null;
853
+ approverName: string | null;
854
+ approverEmail: string | null;
855
+ notes: string | null;
856
+ tags: string[];
857
+ appUrl: string | null;
858
+ links: PrismaJson.AppLink[] | null;
859
+ iconName: string | null;
860
+ screenshotIds: string[];
861
+ };
862
+ meta: {};
863
+ }>;
864
+ delete: _trpc_server0.TRPCMutationProcedure<{
865
+ input: {
866
+ id: string;
867
+ };
868
+ output: {
869
+ id: string;
870
+ createdAt: Date;
871
+ updatedAt: Date;
872
+ description: string;
873
+ slug: string;
874
+ displayName: string;
875
+ access: PrismaJson.AccessMethod;
876
+ teams: string[];
877
+ roles: PrismaJson.AppRole | null;
878
+ approverName: string | null;
879
+ approverEmail: string | null;
880
+ notes: string | null;
881
+ tags: string[];
882
+ appUrl: string | null;
883
+ links: PrismaJson.AppLink[] | null;
884
+ iconName: string | null;
885
+ screenshotIds: string[];
886
+ };
887
+ meta: {};
888
+ }>;
889
+ }>>;
890
+ auth: _trpc_server0.TRPCBuiltRouter<{
891
+ ctx: EhTrpcContext;
892
+ meta: {};
893
+ errorShape: _trpc_server0.TRPCDefaultErrorShape;
894
+ transformer: false;
895
+ }, _trpc_server0.TRPCDecorateCreateRouterOptions<{
896
+ getSession: _trpc_server0.TRPCQueryProcedure<{
897
+ input: void;
898
+ output: {
899
+ user: {} | null;
900
+ isAuthenticated: boolean;
901
+ };
902
+ meta: {};
903
+ }>;
904
+ getProviders: _trpc_server0.TRPCQueryProcedure<{
905
+ input: void;
906
+ output: {
907
+ providers: string[];
908
+ };
909
+ meta: {};
910
+ }>;
911
+ }>>;
912
+ }>>;
913
+ type TRPCRouter = ReturnType<typeof createTrpcRouter>;
914
+ //#endregion
915
+ //#region src/server/ehStaticControllerContract.d.ts
916
+ interface EhStaticControllerContract {
917
+ methods: {
918
+ getIcon: {
919
+ method: string;
920
+ url: string;
921
+ };
922
+ getScreenshot: {
923
+ method: string;
924
+ url: string;
925
+ };
926
+ };
927
+ }
928
+ declare const staticControllerContract: EhStaticControllerContract;
929
+ //#endregion
930
+ //#region src/modules/auth/registerAuthRoutes.d.ts
931
+ /**
932
+ * Register Better Auth routes with Express
933
+ * @param app - Express application instance
934
+ * @param auth - Better Auth instance
935
+ */
936
+ declare function registerAuthRoutes(app: Express, auth: BetterAuth): void;
937
+ //#endregion
938
+ //#region src/modules/auth/authRouter.d.ts
939
+ /**
940
+ * Create auth tRPC procedures
941
+ * @param t - tRPC instance
942
+ * @param auth - Better Auth instance (optional, for future extensions)
943
+ * @returns tRPC router with auth procedures
944
+ */
945
+ declare function createAuthRouter(t: TRPCRootObject<EhTrpcContext, {}, {}>, auth?: BetterAuth): _trpc_server0.TRPCBuiltRouter<{
946
+ ctx: EhTrpcContext;
947
+ meta: {};
948
+ errorShape: _trpc_server0.TRPCDefaultErrorShape;
949
+ transformer: false;
950
+ }, _trpc_server0.TRPCDecorateCreateRouterOptions<{
951
+ getSession: _trpc_server0.TRPCQueryProcedure<{
952
+ input: void;
953
+ output: {
954
+ user: {} | null;
955
+ isAuthenticated: boolean;
956
+ };
957
+ meta: {};
958
+ }>;
959
+ getProviders: _trpc_server0.TRPCQueryProcedure<{
960
+ input: void;
961
+ output: {
962
+ providers: string[];
963
+ };
964
+ meta: {};
965
+ }>;
966
+ }>>;
967
+ type AuthRouter = ReturnType<typeof createAuthRouter>;
968
+ //#endregion
969
+ //#region src/modules/auth/authProviders.d.ts
970
+ declare function getAuthProvidersFromEnv(): BetterAuthOptions['socialProviders'];
971
+ /**
972
+ * Get auth plugins from environment variables
973
+ * Currently supports: Okta
974
+ *
975
+ * Example .env:
976
+ * AUTH_OKTA_CLIENT_ID=your_okta_client_id
977
+ * AUTH_OKTA_CLIENT_SECRET=your_okta_client_secret
978
+ * AUTH_OKTA_ISSUER=https://your-org.okta.com/oauth2/ausxb83g4wY1x09ec0h7
979
+ *
980
+ * Note: If you get "User is not assigned to the client application" errors,
981
+ * you need to configure your Okta application to allow all users:
982
+ * 1. In Okta Admin Console, go to Applications → Your App
983
+ * 2. Assignments tab → Assign to Groups → Add "Everyone" group
984
+ * OR
985
+ * 3. Edit the application → In "User consent" section, enable appropriate settings
986
+ *
987
+ * For group-based authorization:
988
+ * 1. Add "groups" scope to your auth server policy rule
989
+ * 2. Create a groups claim in your auth server
990
+ * 3. Groups will be available in the user object after authentication
991
+ */
992
+ declare function getAuthPluginsFromEnv(): Array<BetterAuthPlugin>;
993
+ /**
994
+ * Validate required auth environment variables
995
+ */
996
+ declare function validateAuthConfig(): void;
997
+ //#endregion
998
+ //#region src/modules/auth/authorizationUtils.d.ts
999
+ /**
1000
+ * Authorization utilities for checking user permissions based on groups
1001
+ *
1002
+ * Groups are automatically included in the user session when:
1003
+ * 1. Okta auth server has a "groups" claim configured
1004
+ * 2. The auth policy rule includes "groups" in scope_whitelist
1005
+ *
1006
+ * Example usage in tRPC procedures:
1007
+ * ```typescript
1008
+ * myProcedure: protectedProcedure.query(async ({ ctx }) => {
1009
+ * if (requireAdmin(ctx.user)) {
1010
+ * // Admin-only logic
1011
+ * }
1012
+ * // Regular user logic
1013
+ * })
1014
+ * ```
1015
+ */
1016
+ interface UserWithGroups {
1017
+ id: string;
1018
+ email: string;
1019
+ name?: string;
1020
+ [key: string]: any;
1021
+ }
1022
+ /**
1023
+ * Extract groups from user object
1024
+ * Groups can be stored in different locations depending on the OAuth provider
1025
+ */
1026
+ declare function getUserGroups(user: UserWithGroups | null | undefined): Array<string>;
1027
+ /**
1028
+ * Check if user is a member of any of the specified groups
1029
+ */
1030
+ declare function isMemberOfAnyGroup(user: UserWithGroups | null | undefined, allowedGroups: Array<string>): boolean;
1031
+ /**
1032
+ * Check if user is a member of all specified groups
1033
+ */
1034
+ declare function isMemberOfAllGroups(user: UserWithGroups | null | undefined, requiredGroups: Array<string>): boolean;
1035
+ /**
1036
+ * Get admin group names from environment variables
1037
+ * Default: env_hopper_ui_super_admins
1038
+ */
1039
+ declare function getAdminGroupsFromEnv(): Array<string>;
1040
+ /**
1041
+ * Check if user has admin permissions
1042
+ */
1043
+ declare function isAdmin(user: UserWithGroups | null | undefined): boolean;
1044
+ /**
1045
+ * Require admin permissions - throws error if not admin
1046
+ */
1047
+ declare function requireAdmin(user: UserWithGroups | null | undefined): void;
1048
+ /**
1049
+ * Require membership in specific groups - throws error if not member
1050
+ */
1051
+ declare function requireGroups(user: UserWithGroups | null | undefined, groups: Array<string>): void;
1052
+ //#endregion
1053
+ //#region src/modules/admin/chat/createAdminChatHandler.d.ts
1054
+ interface AdminChatHandlerOptions {
1055
+ /** The AI model to use (from @ai-sdk/openai, @ai-sdk/anthropic, etc.) */
1056
+ model: LanguageModel;
1057
+ /** System prompt for the AI assistant */
1058
+ systemPrompt?: string;
1059
+ /** Tools available to the AI assistant */
1060
+ tools?: Record<string, Tool>;
1061
+ /**
1062
+ * Optional function to validate configuration before processing requests.
1063
+ * Should throw an error if configuration is invalid (e.g., missing API key).
1064
+ * @example
1065
+ * validateConfig: () => {
1066
+ * if (!process.env.OPENAI_API_KEY) {
1067
+ * throw new Error('OPENAI_API_KEY is not configured')
1068
+ * }
1069
+ * }
1070
+ */
1071
+ validateConfig?: () => void;
1072
+ }
1073
+ /**
1074
+ * Creates an Express handler for the admin chat endpoint.
1075
+ *
1076
+ * Usage in thin wrappers:
1077
+ *
1078
+ * ```typescript
1079
+ * // With OpenAI
1080
+ * import { openai } from '@ai-sdk/openai'
1081
+ * app.post('/api/admin/chat', createAdminChatHandler({
1082
+ * model: openai('gpt-4o-mini'),
1083
+ * }))
1084
+ *
1085
+ * // With Claude
1086
+ * import { anthropic } from '@ai-sdk/anthropic'
1087
+ * app.post('/api/admin/chat', createAdminChatHandler({
1088
+ * model: anthropic('claude-sonnet-4-20250514'),
1089
+ * }))
1090
+ * ```
1091
+ */
1092
+ declare function createAdminChatHandler(options: AdminChatHandlerOptions): (req: Request, res: Response) => Promise<void>;
1093
+ //#endregion
1094
+ //#region src/modules/admin/chat/createDatabaseTools.d.ts
1095
+ /**
1096
+ * Generic interface for executing raw SQL queries.
1097
+ * Can be implemented with Prisma's $queryRawUnsafe or any other SQL client.
1098
+ */
1099
+ interface DatabaseClient {
1100
+ /** Execute a SELECT query and return results */
1101
+ query: <T = unknown>(sql: string) => Promise<Array<T>>;
1102
+ /** Execute an INSERT/UPDATE/DELETE and return affected row count */
1103
+ execute: (sql: string) => Promise<{
1104
+ affectedRows: number;
1105
+ }>;
1106
+ /** Get list of tables in the database */
1107
+ getTables: () => Promise<Array<string>>;
1108
+ /** Get columns for a specific table */
1109
+ getColumns: (tableName: string) => Promise<Array<{
1110
+ name: string;
1111
+ type: string;
1112
+ nullable: boolean;
1113
+ }>>;
1114
+ }
1115
+ /**
1116
+ * Creates a DatabaseClient from a Prisma client.
1117
+ */
1118
+ declare function createPrismaDatabaseClient(prisma: {
1119
+ $queryRawUnsafe: <T>(sql: string) => Promise<T>;
1120
+ $executeRawUnsafe: (sql: string) => Promise<number>;
1121
+ }): DatabaseClient;
1122
+ /**
1123
+ * Creates AI tools for generic database access.
1124
+ *
1125
+ * The AI uses these internally - users interact via natural language.
1126
+ * Results are formatted as tables by the AI based on the system prompt.
1127
+ * Uses the internal backend-core Prisma client automatically.
1128
+ */
1129
+ declare function createDatabaseTools(): Record<string, Tool>;
1130
+ /**
1131
+ * Default system prompt for the database admin assistant.
1132
+ * Can be customized or extended.
1133
+ */
1134
+ declare const DEFAULT_ADMIN_SYSTEM_PROMPT = "You are a helpful database admin assistant. You help users view and manage data in the database.\n\nIMPORTANT RULES:\n1. When showing data, ALWAYS format it as a numbered ASCII table so users can reference rows by number\n2. NEVER show raw SQL to users - just describe what you're doing in plain language\n3. When users ask to modify data (update, delete, create), ALWAYS confirm before executing\n4. For updates, show the current value and ask for confirmation before changing\n5. Keep responses concise and focused on the data\n\nFORMATTING EXAMPLE:\nWhen user asks \"show me all apps\", respond like:\n\"Here are all the apps:\n\n| # | ID | Slug | Display Name | Icon |\n|---|----|---------|-----------------| -------|\n| 1 | 1 | portal | Portal | portal |\n| 2 | 2 | admin | Admin Dashboard | admin |\n| 3 | 3 | api | API Service | null |\n\nFound 3 apps total.\"\n\nWhen user says \"update row 2 display name to 'Admin Panel'\":\n1. First confirm: \"I'll update the app 'Admin Dashboard' (ID: 2) to have display name 'Admin Panel'. Proceed?\"\n2. Only after user confirms, execute the update\n3. Then show the updated row\n\nAVAILABLE TABLES:\nUse getDatabaseSchema tool to discover tables and their columns.\n";
1135
+ //#endregion
1136
+ //#region src/modules/icons/iconRestController.d.ts
1137
+ interface IconRestControllerConfig {
1138
+ /**
1139
+ * Base path for icon endpoints (e.g., '/api/icons')
1140
+ */
1141
+ basePath: string;
1142
+ }
1143
+ /**
1144
+ * Registers REST endpoints for icon upload and retrieval
1145
+ *
1146
+ * Endpoints:
1147
+ * - POST {basePath}/upload - Upload a new icon (multipart/form-data with 'icon' field and 'name' field)
1148
+ * - GET {basePath}/:id - Get icon binary by ID
1149
+ * - GET {basePath}/:id/metadata - Get icon metadata only
1150
+ */
1151
+ declare function registerIconRestController(router: Router, config: IconRestControllerConfig): void;
1152
+ //#endregion
1153
+ //#region src/modules/icons/iconService.d.ts
1154
+ interface UpsertIconInput {
1155
+ name: string;
1156
+ content: Buffer;
1157
+ mimeType: string;
1158
+ fileSize: number;
1159
+ }
1160
+ /**
1161
+ * Upsert an icon to the database.
1162
+ * If an icon with the same name exists, it will be updated.
1163
+ * Otherwise, a new icon will be created.
1164
+ */
1165
+ declare function upsertIcon(input: UpsertIconInput): Promise<{
1166
+ id: string;
1167
+ name: string;
1168
+ content: _prisma_client_runtime_library0.Bytes;
1169
+ mimeType: string;
1170
+ fileSize: number;
1171
+ assetType: _prisma_client0.$Enums.AssetType;
1172
+ checksum: string;
1173
+ width: number | null;
1174
+ height: number | null;
1175
+ createdAt: Date;
1176
+ updatedAt: Date;
1177
+ }>;
1178
+ /**
1179
+ * Upsert multiple icons to the database.
1180
+ * This is more efficient than calling upsertIcon multiple times.
1181
+ */
1182
+ declare function upsertIcons(icons: Array<UpsertIconInput>): Promise<{
1183
+ id: string;
1184
+ name: string;
1185
+ content: _prisma_client_runtime_library0.Bytes;
1186
+ mimeType: string;
1187
+ fileSize: number;
1188
+ assetType: _prisma_client0.$Enums.AssetType;
1189
+ checksum: string;
1190
+ width: number | null;
1191
+ height: number | null;
1192
+ createdAt: Date;
1193
+ updatedAt: Date;
1194
+ }[]>;
1195
+ /**
1196
+ * Get an asset (icon or screenshot) by name from the database.
1197
+ * Returns the asset content, mimeType, and name if found.
1198
+ */
1199
+ declare function getAssetByName(name: string): Promise<{
1200
+ name: string;
1201
+ content: Uint8Array<ArrayBuffer>;
1202
+ mimeType: string;
1203
+ } | null>;
1204
+ //#endregion
1205
+ //#region src/modules/assets/assetRestController.d.ts
1206
+ interface AssetRestControllerConfig {
1207
+ /**
1208
+ * Base path for asset endpoints (e.g., '/api/assets')
1209
+ */
1210
+ basePath: string;
1211
+ }
1212
+ /**
1213
+ * Registers REST endpoints for universal asset upload and retrieval
1214
+ *
1215
+ * Endpoints:
1216
+ * - POST {basePath}/upload - Upload a new asset (multipart/form-data)
1217
+ * - GET {basePath}/:id - Get asset binary by ID
1218
+ * - GET {basePath}/:id/metadata - Get asset metadata only
1219
+ * - GET {basePath}/by-name/:name - Get asset binary by name
1220
+ */
1221
+ declare function registerAssetRestController(router: Router, config: AssetRestControllerConfig): void;
1222
+ //#endregion
1223
+ //#region src/modules/assets/screenshotRestController.d.ts
1224
+ interface ScreenshotRestControllerConfig {
1225
+ /**
1226
+ * Base path for screenshot endpoints (e.g., '/api/screenshots')
1227
+ */
1228
+ basePath: string;
1229
+ }
1230
+ /**
1231
+ * Registers REST endpoints for screenshot retrieval
1232
+ *
1233
+ * Endpoints:
1234
+ * - GET {basePath}/app/:appId - Get all screenshots for an app
1235
+ * - GET {basePath}/:id - Get screenshot binary by ID
1236
+ * - GET {basePath}/:id/metadata - Get screenshot metadata only
1237
+ */
1238
+ declare function registerScreenshotRestController(router: Router, config: ScreenshotRestControllerConfig): void;
1239
+ //#endregion
1240
+ //#region src/modules/assets/screenshotRouter.d.ts
1241
+ declare function createScreenshotRouter(t: TRPCRootObject<EhTrpcContext, {}, {}>): _trpc_server0.TRPCBuiltRouter<{
1242
+ ctx: EhTrpcContext;
1243
+ meta: {};
1244
+ errorShape: _trpc_server0.TRPCDefaultErrorShape;
1245
+ transformer: false;
1246
+ }, _trpc_server0.TRPCDecorateCreateRouterOptions<{
1247
+ list: _trpc_server0.TRPCQueryProcedure<{
1248
+ input: void;
1249
+ output: {
1250
+ id: string;
1251
+ name: string;
1252
+ mimeType: string;
1253
+ fileSize: number;
1254
+ width: number | null;
1255
+ height: number | null;
1256
+ createdAt: Date;
1257
+ updatedAt: Date;
1258
+ }[];
1259
+ meta: {};
1260
+ }>;
1261
+ getOne: _trpc_server0.TRPCQueryProcedure<{
1262
+ input: {
1263
+ id: string;
1264
+ };
1265
+ output: {
1266
+ id: string;
1267
+ name: string;
1268
+ mimeType: string;
1269
+ fileSize: number;
1270
+ width: number | null;
1271
+ height: number | null;
1272
+ createdAt: Date;
1273
+ updatedAt: Date;
1274
+ } | null;
1275
+ meta: {};
1276
+ }>;
1277
+ getByAppSlug: _trpc_server0.TRPCQueryProcedure<{
1278
+ input: {
1279
+ appSlug: string;
1280
+ };
1281
+ output: {
1282
+ id: string;
1283
+ name: string;
1284
+ mimeType: string;
1285
+ fileSize: number;
1286
+ width: number | null;
1287
+ height: number | null;
1288
+ createdAt: Date;
1289
+ updatedAt: Date;
1290
+ }[];
1291
+ meta: {};
1292
+ }>;
1293
+ getFirstByAppSlug: _trpc_server0.TRPCQueryProcedure<{
1294
+ input: {
1295
+ appSlug: string;
1296
+ };
1297
+ output: {
1298
+ id: string;
1299
+ name: string;
1300
+ mimeType: string;
1301
+ fileSize: number;
1302
+ width: number | null;
1303
+ height: number | null;
1304
+ createdAt: Date;
1305
+ updatedAt: Date;
1306
+ } | null;
1307
+ meta: {};
1308
+ }>;
1309
+ }>>;
1310
+ //#endregion
1311
+ //#region src/modules/assets/syncAssets.d.ts
1312
+ interface SyncAssetsConfig {
1313
+ /**
1314
+ * Directory containing icon files to sync
1315
+ */
1316
+ iconsDir?: string;
1317
+ /**
1318
+ * Directory containing screenshot files to sync
1319
+ */
1320
+ screenshotsDir?: string;
1321
+ }
1322
+ /**
1323
+ * Sync local asset files (icons and screenshots) from directories into the database.
1324
+ *
1325
+ * This function allows consuming applications to sync asset files without directly
1326
+ * exposing the Prisma client. It handles:
1327
+ * - Icon files: Assigned to apps by matching filename to icon name patterns
1328
+ * - Screenshot files: Assigned to apps by matching filename to app ID (format: <app-id>_screenshot_<no>.<ext>)
1329
+ *
1330
+ * @param config Configuration with paths to icon and screenshot directories
1331
+ */
1332
+ declare function syncAssets(config: SyncAssetsConfig): Promise<{
1333
+ iconsUpserted: number;
1334
+ screenshotsUpserted: number;
1335
+ }>;
1336
+ //#endregion
1337
+ //#region src/modules/appCatalogAdmin/appCatalogAdminRouter.d.ts
1338
+ declare function createAppCatalogAdminRouter(t: TRPCRootObject<EhTrpcContext, {}, {}>): _trpc_server0.TRPCBuiltRouter<{
1339
+ ctx: EhTrpcContext;
1340
+ meta: {};
1341
+ errorShape: _trpc_server0.TRPCDefaultErrorShape;
1342
+ transformer: false;
1343
+ }, _trpc_server0.TRPCDecorateCreateRouterOptions<{
1344
+ list: _trpc_server0.TRPCQueryProcedure<{
1345
+ input: void;
1346
+ output: {
1347
+ id: string;
1348
+ createdAt: Date;
1349
+ updatedAt: Date;
1350
+ description: string;
1351
+ slug: string;
1352
+ displayName: string;
1353
+ access: PrismaJson.AccessMethod;
1354
+ teams: string[];
1355
+ roles: PrismaJson.AppRole | null;
1356
+ approverName: string | null;
1357
+ approverEmail: string | null;
1358
+ notes: string | null;
1359
+ tags: string[];
1360
+ appUrl: string | null;
1361
+ links: PrismaJson.AppLink[] | null;
1362
+ iconName: string | null;
1363
+ screenshotIds: string[];
1364
+ }[];
1365
+ meta: {};
1366
+ }>;
1367
+ getById: _trpc_server0.TRPCQueryProcedure<{
1368
+ input: {
1369
+ id: string;
1370
+ };
1371
+ output: {
1372
+ id: string;
1373
+ createdAt: Date;
1374
+ updatedAt: Date;
1375
+ description: string;
1376
+ slug: string;
1377
+ displayName: string;
1378
+ access: PrismaJson.AccessMethod;
1379
+ teams: string[];
1380
+ roles: PrismaJson.AppRole | null;
1381
+ approverName: string | null;
1382
+ approverEmail: string | null;
1383
+ notes: string | null;
1384
+ tags: string[];
1385
+ appUrl: string | null;
1386
+ links: PrismaJson.AppLink[] | null;
1387
+ iconName: string | null;
1388
+ screenshotIds: string[];
1389
+ } | null;
1390
+ meta: {};
1391
+ }>;
1392
+ create: _trpc_server0.TRPCMutationProcedure<{
1393
+ input: {
1394
+ slug: string;
1395
+ displayName: string;
1396
+ description: string;
1397
+ access: {
1398
+ [x: string]: unknown;
1399
+ type: "bot" | "ticketing" | "email" | "self-service" | "documentation" | "manual";
1400
+ };
1401
+ teams?: string[] | undefined;
1402
+ roles?: {
1403
+ id: string;
1404
+ name: string;
1405
+ description?: string | undefined;
1406
+ }[] | undefined;
1407
+ approver?: {
1408
+ name: string;
1409
+ email: string;
1410
+ } | undefined;
1411
+ notes?: string | undefined;
1412
+ tags?: string[] | undefined;
1413
+ appUrl?: string | undefined;
1414
+ links?: {
1415
+ url: string;
1416
+ displayName?: string | undefined;
1417
+ }[] | undefined;
1418
+ iconName?: string | undefined;
1419
+ screenshotIds?: string[] | undefined;
1420
+ };
1421
+ output: {
1422
+ id: string;
1423
+ createdAt: Date;
1424
+ updatedAt: Date;
1425
+ description: string;
1426
+ slug: string;
1427
+ displayName: string;
1428
+ access: PrismaJson.AccessMethod;
1429
+ teams: string[];
1430
+ roles: PrismaJson.AppRole | null;
1431
+ approverName: string | null;
1432
+ approverEmail: string | null;
1433
+ notes: string | null;
1434
+ tags: string[];
1435
+ appUrl: string | null;
1436
+ links: PrismaJson.AppLink[] | null;
1437
+ iconName: string | null;
1438
+ screenshotIds: string[];
1439
+ };
1440
+ meta: {};
1441
+ }>;
1442
+ update: _trpc_server0.TRPCMutationProcedure<{
1443
+ input: {
1444
+ id: string;
1445
+ slug?: string | undefined;
1446
+ displayName?: string | undefined;
1447
+ description?: string | undefined;
1448
+ access?: {
1449
+ [x: string]: unknown;
1450
+ type: "bot" | "ticketing" | "email" | "self-service" | "documentation" | "manual";
1451
+ } | undefined;
1452
+ teams?: string[] | undefined;
1453
+ roles?: {
1454
+ id: string;
1455
+ name: string;
1456
+ description?: string | undefined;
1457
+ }[] | undefined;
1458
+ approver?: {
1459
+ name: string;
1460
+ email: string;
1461
+ } | undefined;
1462
+ notes?: string | undefined;
1463
+ tags?: string[] | undefined;
1464
+ appUrl?: string | undefined;
1465
+ links?: {
1466
+ url: string;
1467
+ displayName?: string | undefined;
1468
+ }[] | undefined;
1469
+ iconName?: string | undefined;
1470
+ screenshotIds?: string[] | undefined;
1471
+ };
1472
+ output: {
1473
+ id: string;
1474
+ createdAt: Date;
1475
+ updatedAt: Date;
1476
+ description: string;
1477
+ slug: string;
1478
+ displayName: string;
1479
+ access: PrismaJson.AccessMethod;
1480
+ teams: string[];
1481
+ roles: PrismaJson.AppRole | null;
1482
+ approverName: string | null;
1483
+ approverEmail: string | null;
1484
+ notes: string | null;
1485
+ tags: string[];
1486
+ appUrl: string | null;
1487
+ links: PrismaJson.AppLink[] | null;
1488
+ iconName: string | null;
1489
+ screenshotIds: string[];
1490
+ };
1491
+ meta: {};
1492
+ }>;
1493
+ delete: _trpc_server0.TRPCMutationProcedure<{
1494
+ input: {
1495
+ id: string;
1496
+ };
1497
+ output: {
1498
+ id: string;
1499
+ createdAt: Date;
1500
+ updatedAt: Date;
1501
+ description: string;
1502
+ slug: string;
1503
+ displayName: string;
1504
+ access: PrismaJson.AccessMethod;
1505
+ teams: string[];
1506
+ roles: PrismaJson.AppRole | null;
1507
+ approverName: string | null;
1508
+ approverEmail: string | null;
1509
+ notes: string | null;
1510
+ tags: string[];
1511
+ appUrl: string | null;
1512
+ links: PrismaJson.AppLink[] | null;
1513
+ iconName: string | null;
1514
+ screenshotIds: string[];
1515
+ };
1516
+ meta: {};
1517
+ }>;
1518
+ }>>;
1519
+ //#endregion
1520
+ //#region src/db/client.d.ts
1521
+ /**
1522
+ * Gets the internal Prisma client instance.
1523
+ * Creates one if it doesn't exist.
1524
+ */
1525
+ declare function getDbClient(): PrismaClient;
1526
+ /**
1527
+ * Connects to the database.
1528
+ * Call this before performing database operations.
1529
+ */
1530
+ declare function connectDb(): Promise<void>;
1531
+ /**
1532
+ * Disconnects from the database.
1533
+ * Call this when done with database operations (e.g., in scripts).
1534
+ */
1535
+ declare function disconnectDb(): Promise<void>;
1536
+ //#endregion
1537
+ //#region src/db/tableSyncPrismaAdapter.d.ts
1538
+ type ScalarKeys<TPrismaModelName extends Prisma.ModelName> = keyof Prisma.TypeMap['model'][TPrismaModelName]['payload']['scalars'];
1539
+ type ObjectKeys<TPrismaModelName extends Prisma.ModelName> = keyof Prisma.TypeMap['model'][TPrismaModelName]['payload']['objects'];
1540
+ type ScalarFilter<TPrismaModelName extends Prisma.ModelName> = Partial<Prisma.TypeMap['model'][TPrismaModelName]['payload']['scalars']>;
1541
+ interface TableSyncParamsPrisma<TPrismaClient extends PrismaClient, TPrismaModelName extends Prisma.ModelName, TUniqColumns extends ReadonlyArray<ScalarKeys<TPrismaModelName>>, TRelationColumns extends ReadonlyArray<ObjectKeys<TPrismaModelName>>> {
1542
+ prisma: TPrismaClient;
1543
+ prismaModelName: TPrismaModelName;
1544
+ uniqColumns: TUniqColumns;
1545
+ relationColumns?: TRelationColumns;
1546
+ where?: ScalarFilter<TPrismaModelName>;
1547
+ upsertOnly?: boolean;
1548
+ }
1549
+ type MakeTFromPrismaModel<TPrismaModelName extends Prisma.ModelName> = NonNullable<Prisma.TypeMap['model'][TPrismaModelName]['operations']['findUnique']['result']>;
1550
+ declare function tableSyncPrisma<TPrismaClient extends PrismaClient, TPrismaModelName extends Prisma.ModelName, TUniqColumns extends ReadonlyArray<ScalarKeys<TPrismaModelName>>, TRelationColumns extends ReadonlyArray<ObjectKeys<TPrismaModelName>>, TId extends ScalarKeys<TPrismaModelName> & (string | number) = 'id'>(params: TableSyncParamsPrisma<TPrismaClient, TPrismaModelName, TUniqColumns, TRelationColumns>): {
1551
+ sync<TUpsert extends Partial<MakeTFromPrismaModel<TPrismaModelName>> & Pick<MakeTFromPrismaModel<TPrismaModelName>, TUniqColumns[number]>>(upsertRaw: TUpsert[]): Promise<{
1552
+ findIdMaybe: (key: Pick<MakeTFromPrismaModel<TPrismaModelName>, TUniqColumns[number]>) => MakeTFromPrismaModel<TPrismaModelName>[TId] | undefined;
1553
+ findIdOrThrow: (key: Pick<MakeTFromPrismaModel<TPrismaModelName>, TUniqColumns[number]>) => MakeTFromPrismaModel<TPrismaModelName>[TId];
1554
+ getActual(): (Pick<MakeTFromPrismaModel<TPrismaModelName>, TUniqColumns[number]> & MakeTFromPrismaModel<TPrismaModelName>[TId])[];
1555
+ }>;
1556
+ };
1557
+ //#endregion
1558
+ //#region src/db/tableSyncMagazine.d.ts
1559
+ declare const TABLE_SYNC_MAGAZINE: {
1560
+ readonly DbAppForCatalog: {
1561
+ readonly prismaModelName: "DbAppForCatalog";
1562
+ readonly uniqColumns: ["slug"];
1563
+ };
1564
+ };
1565
+ type TableSyncMagazine = typeof TABLE_SYNC_MAGAZINE;
1566
+ type TableSyncMagazineModelNameKey = keyof TableSyncMagazine;
1567
+ //#endregion
1568
+ //#region src/db/syncAppCatalog.d.ts
1569
+ interface SyncAppCatalogResult {
1570
+ created: number;
1571
+ updated: number;
1572
+ deleted: number;
1573
+ total: number;
1574
+ }
1575
+ /**
1576
+ * Syncs app catalog data to the database using table sync.
1577
+ * This will create new apps, update existing ones, and delete any that are no longer in the input.
1578
+ *
1579
+ * Note: Call connectDb() before and disconnectDb() after if running in a script.
1580
+ */
1581
+ declare function syncAppCatalog(apps: Array<AppForCatalog>): Promise<SyncAppCatalogResult>;
1582
+ //#endregion
1583
+ export { AccessMethod, type AdminChatHandlerOptions, AppCatalogData, AppCategory, type AppForCatalog, AppRole, Approver, type AssetRestControllerConfig, type AuthConfig, type AuthRouter, AvailabilityMatrixData, AvailabilityVariant, type BetterAuth, BootstrapConfigData, BotAccess, BotProvider, DEFAULT_ADMIN_SYSTEM_PROMPT, type DatabaseClient, DisplayNamable, DocumentationAccess, EhAppCatalogData, EhAppCatalogDto, EhAppCatalogGroupDto, EhAppCatalogPageDto, EhAppIndexed, EhAppPageIndexed, EhAppUiIndexed, EhAppsMeta, EhBackendAppDto, EhBackendAppInput, EhBackendAppUIBaseInput, EhBackendAppUIInput, EhBackendCompanySpecificBackend, EhBackendCredentialInput, EhBackendDataFreshness, EhBackendDataSourceInput, EhBackendDataSourceInputCommon, EhBackendDataSourceInputDb, EhBackendDataSourceInputKafka, EhBackendDataVersion, EhBackendDeployableInput, EhBackendDeployment, EhBackendDeploymentInput, EhBackendEnvironmentInput, EhBackendPageInput, EhBackendTagDescriptionDataIndexed, EhBackendTagFixedTagValue, EhBackendTagsDescriptionDataIndexed, EhBackendUiDefaultsInput, EhBackendVersionsRequestParams, EhBackendVersionsReturn, EhContextIndexed, EhEnvIndexed, EhMetaDictionary, EhResourceIndexed, type EhStaticControllerContract, type EhTrpcContext, type EhTrpcContextOptions, EmailAccess, EnvBaseInfo, EnvInfoExtended, EnvSlug, type IconRestControllerConfig, JumpResourceSlug, LateResolvableParam, type MakeTFromPrismaModel, ManualAccess, type ObjectKeys, RenameRule, RenameRuleParams, ResourceJump, ResourceJumpGroup, ResourceJumpMetaInfo, ResourceJumpsData, ResourceJumpsExtendedData, type ScalarFilter, type ScalarKeys, type ScreenshotRestControllerConfig, SelfServiceAccess, SlugAndDisplayable, Sluggable, type SyncAppCatalogResult, type SyncAssetsConfig, TABLE_SYNC_MAGAZINE, type TRPCRouter, type TableSyncMagazine, type TableSyncMagazineModelNameKey, type TableSyncParamsPrisma, Tag, TicketingAccess, TicketingProvider, type UpsertIconInput, User, type UserWithGroups, connectDb, createAdminChatHandler, createAppCatalogAdminRouter, createAuth, createAuthRouter, createDatabaseTools, createEhTrpcContext, createPrismaDatabaseClient, createScreenshotRouter, createTrpcRouter, disconnectDb, getAdminGroupsFromEnv, getAssetByName, getAuthPluginsFromEnv, getAuthProvidersFromEnv, getDbClient, getUserGroups, isAdmin, isMemberOfAllGroups, isMemberOfAnyGroup, registerAssetRestController, registerAuthRoutes, registerIconRestController, registerScreenshotRestController, requireAdmin, requireGroups, staticControllerContract, syncAppCatalog, syncAssets, tableSyncPrisma, tool, upsertIcon, upsertIcons, validateAuthConfig };
1584
+ //# sourceMappingURL=index.d.ts.map