@env-hopper/backend-core 2.0.1-alpha → 2.0.1-alpha-20260224145405
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/index.d.ts +2059 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2571 -0
- package/dist/index.js.map +1 -0
- package/package.json +26 -11
- package/prisma/migrations/20250526183023_init/migration.sql +71 -0
- package/prisma/migrations/migration_lock.toml +3 -0
- package/prisma/schema.prisma +149 -0
- package/src/db/client.ts +42 -0
- package/src/db/index.ts +21 -0
- package/src/db/syncAppCatalog.ts +310 -0
- package/src/db/tableSyncMagazine.ts +32 -0
- package/src/db/tableSyncPrismaAdapter.ts +203 -0
- package/src/generated/prisma/client.d.ts +1 -0
- package/src/generated/prisma/client.js +4 -0
- package/src/generated/prisma/default.d.ts +1 -0
- package/src/generated/prisma/default.js +4 -0
- package/src/generated/prisma/edge.d.ts +1 -0
- package/src/generated/prisma/edge.js +227 -0
- package/src/generated/prisma/index-browser.js +214 -0
- package/src/generated/prisma/index.d.ts +4212 -0
- package/src/generated/prisma/index.js +248 -0
- package/src/generated/prisma/libquery_engine-darwin-arm64.dylib.node +0 -0
- package/src/generated/prisma/package.json +183 -0
- package/src/generated/prisma/query_engine_bg.js +2 -0
- package/src/generated/prisma/query_engine_bg.wasm +0 -0
- package/src/generated/prisma/runtime/edge-esm.js +34 -0
- package/src/generated/prisma/runtime/edge.js +34 -0
- package/src/generated/prisma/runtime/index-browser.d.ts +370 -0
- package/src/generated/prisma/runtime/index-browser.js +16 -0
- package/src/generated/prisma/runtime/library.d.ts +3982 -0
- package/src/generated/prisma/runtime/library.js +146 -0
- package/src/generated/prisma/runtime/react-native.js +83 -0
- package/src/generated/prisma/runtime/wasm-compiler-edge.js +84 -0
- package/src/generated/prisma/runtime/wasm-engine-edge.js +36 -0
- package/src/generated/prisma/schema.prisma +49 -0
- package/src/generated/prisma/wasm-edge-light-loader.mjs +4 -0
- package/src/generated/prisma/wasm-worker-loader.mjs +4 -0
- package/src/generated/prisma/wasm.d.ts +1 -0
- package/src/generated/prisma/wasm.js +234 -0
- package/src/index.ts +109 -1
- package/src/middleware/backendResolver.ts +49 -0
- package/src/middleware/createEhMiddleware.ts +171 -0
- package/src/middleware/database.ts +62 -0
- package/src/middleware/featureRegistry.ts +173 -0
- package/src/middleware/index.ts +43 -0
- package/src/middleware/types.ts +202 -0
- package/src/modules/admin/chat/createAdminChatHandler.ts +152 -0
- package/src/modules/admin/chat/createDatabaseTools.ts +261 -0
- package/src/modules/appCatalog/service.ts +130 -0
- package/src/modules/appCatalogAdmin/appCatalogAdminRouter.ts +187 -0
- package/src/modules/appCatalogAdmin/catalogBackupController.ts +213 -0
- package/src/modules/approvalMethod/approvalMethodRouter.ts +169 -0
- package/src/modules/approvalMethod/slugUtils.ts +17 -0
- package/src/modules/approvalMethod/syncApprovalMethods.ts +38 -0
- package/src/modules/assets/assetRestController.ts +271 -0
- package/src/modules/assets/assetUtils.ts +114 -0
- package/src/modules/assets/screenshotRestController.ts +195 -0
- package/src/modules/assets/screenshotRouter.ts +112 -0
- package/src/modules/assets/syncAssets.ts +277 -0
- package/src/modules/assets/upsertAsset.ts +46 -0
- package/src/modules/auth/auth.ts +51 -0
- package/src/modules/auth/authProviders.ts +40 -0
- package/src/modules/auth/authRouter.ts +75 -0
- package/src/modules/auth/authorizationUtils.ts +132 -0
- package/src/modules/auth/devMockUserUtils.ts +49 -0
- package/src/modules/auth/registerAuthRoutes.ts +33 -0
- package/src/modules/icons/iconRestController.ts +171 -0
- package/src/modules/icons/iconRouter.ts +180 -0
- package/src/modules/icons/iconService.ts +73 -0
- package/src/modules/icons/iconUtils.ts +46 -0
- package/src/prisma-json-types.d.ts +34 -0
- package/src/server/controller.ts +103 -44
- package/src/server/ehStaticControllerContract.ts +8 -1
- package/src/server/ehTrpcContext.ts +9 -6
- package/src/server/trpcSetup.ts +89 -0
- package/src/types/backend/api.ts +1 -14
- package/src/types/backend/companySpecificBackend.ts +17 -0
- package/src/types/common/appCatalogTypes.ts +56 -10
- package/src/types/common/approvalMethodTypes.ts +149 -0
- package/src/types/common/dataRootTypes.ts +72 -10
- package/src/types/index.ts +3 -0
- package/dist/esm/__tests__/dummy.test.d.ts +0 -1
- package/dist/esm/index.d.ts +0 -7
- package/dist/esm/index.js +0 -9
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/server/controller.d.ts +0 -32
- package/dist/esm/server/controller.js +0 -35
- package/dist/esm/server/controller.js.map +0 -1
- package/dist/esm/server/db.d.ts +0 -2
- package/dist/esm/server/ehStaticControllerContract.d.ts +0 -9
- package/dist/esm/server/ehStaticControllerContract.js +0 -12
- package/dist/esm/server/ehStaticControllerContract.js.map +0 -1
- package/dist/esm/server/ehTrpcContext.d.ts +0 -8
- package/dist/esm/server/ehTrpcContext.js +0 -11
- package/dist/esm/server/ehTrpcContext.js.map +0 -1
- package/dist/esm/types/backend/api.d.ts +0 -71
- package/dist/esm/types/backend/common.d.ts +0 -9
- package/dist/esm/types/backend/dataSources.d.ts +0 -20
- package/dist/esm/types/backend/deployments.d.ts +0 -34
- package/dist/esm/types/common/app/appTypes.d.ts +0 -12
- package/dist/esm/types/common/app/ui/appUiTypes.d.ts +0 -10
- package/dist/esm/types/common/appCatalogTypes.d.ts +0 -16
- package/dist/esm/types/common/dataRootTypes.d.ts +0 -32
- package/dist/esm/types/common/env/envTypes.d.ts +0 -6
- package/dist/esm/types/common/resourceTypes.d.ts +0 -8
- package/dist/esm/types/common/sharedTypes.d.ts +0 -4
- package/dist/esm/types/index.d.ts +0 -11
- package/src/server/db.ts +0 -4
|
@@ -1,19 +1,65 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/**
|
|
2
|
+
* App Catalog Types - Universal Software Access Request Catalog
|
|
3
|
+
*
|
|
4
|
+
* These types define a standardized catalog of software applications and their
|
|
5
|
+
* access methods. The typing system is designed to be universal across companies,
|
|
6
|
+
* abstracting away specific tools (Jira, Slack, etc.) into generic categories.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import type { AppAccessRequest, ApprovalMethod } from './approvalMethodTypes'
|
|
10
|
+
|
|
11
|
+
// ============================================================================
|
|
12
|
+
// APP CATALOG TYPES
|
|
13
|
+
// ============================================================================
|
|
4
14
|
|
|
5
|
-
|
|
15
|
+
/**
|
|
16
|
+
* Application entry in the catalog
|
|
17
|
+
*/
|
|
18
|
+
export interface AppForCatalog {
|
|
19
|
+
id: string
|
|
6
20
|
slug: string
|
|
7
|
-
|
|
21
|
+
displayName: string
|
|
22
|
+
description?: string
|
|
23
|
+
teams?: Array<string>
|
|
24
|
+
accessRequest?: AppAccessRequest
|
|
25
|
+
notes?: string
|
|
26
|
+
tags?: Array<string>
|
|
27
|
+
appUrl?: string
|
|
28
|
+
links?: Array<{ url: string; title?: string }>
|
|
29
|
+
iconName?: string // Optional icon identifier for display
|
|
30
|
+
screenshotIds?: Array<string>
|
|
8
31
|
}
|
|
9
32
|
|
|
10
|
-
|
|
11
|
-
|
|
33
|
+
// Derived catalog data returned by backend
|
|
34
|
+
export interface AppCategory {
|
|
35
|
+
id: string
|
|
36
|
+
name: string
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface GroupingTagDefinition {
|
|
40
|
+
prefix: string
|
|
12
41
|
displayName: string
|
|
13
|
-
|
|
42
|
+
description: string
|
|
43
|
+
values: Array<GroupingTagValue>
|
|
14
44
|
}
|
|
15
45
|
|
|
16
|
-
|
|
17
|
-
|
|
46
|
+
type DistributiveOmit<T, TKey extends keyof any> = T extends any
|
|
47
|
+
? Omit<T, TKey>
|
|
48
|
+
: never
|
|
49
|
+
|
|
50
|
+
export type AppApprovalMethod = DistributiveOmit<
|
|
51
|
+
ApprovalMethod,
|
|
52
|
+
'createdAt' | 'updatedAt'
|
|
53
|
+
>
|
|
54
|
+
|
|
55
|
+
export interface GroupingTagValue {
|
|
56
|
+
value: string
|
|
18
57
|
displayName: string
|
|
58
|
+
description: string
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface AppCatalogData {
|
|
62
|
+
apps: Array<AppForCatalog>
|
|
63
|
+
tagsDefinitions: Array<GroupingTagDefinition>
|
|
64
|
+
approvalMethods: Array<AppApprovalMethod>
|
|
19
65
|
}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Approval Method Types
|
|
3
|
+
*
|
|
4
|
+
* Global approval method templates that apps can link to.
|
|
5
|
+
* Each method has a type (service, personTeam, custom) with type-specific config.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
// ============================================================================
|
|
9
|
+
// APPROVAL METHOD TYPES (Global Templates)
|
|
10
|
+
// ============================================================================
|
|
11
|
+
|
|
12
|
+
export type ApprovalMethodType = 'service' | 'personTeam' | 'custom'
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Contact for reaching out (not necessarily the approver)
|
|
16
|
+
*/
|
|
17
|
+
export interface ReachOutContact {
|
|
18
|
+
displayName: string
|
|
19
|
+
contact: string // email, slack handle, etc.
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Service type config - for bots, ticketing systems, self-service portals
|
|
24
|
+
*/
|
|
25
|
+
export interface ServiceConfig {
|
|
26
|
+
url?: string // Service URL (clickable in UI)
|
|
27
|
+
icon?: string // Icon identifier
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Person/Team type config - for human approvers
|
|
32
|
+
*/
|
|
33
|
+
export interface PersonTeamConfig {
|
|
34
|
+
reachOutContacts?: Array<ReachOutContact>
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Custom type config - generic, no additional fields
|
|
39
|
+
*/
|
|
40
|
+
export interface CustomConfig {
|
|
41
|
+
// No additional fields
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Union of all config types
|
|
46
|
+
*/
|
|
47
|
+
export type ApprovalMethodConfig =
|
|
48
|
+
| ServiceConfig
|
|
49
|
+
| PersonTeamConfig
|
|
50
|
+
| CustomConfig
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Approval Method - stored in DbApprovalMethod
|
|
54
|
+
*/
|
|
55
|
+
// export interface ApprovalMethod {
|
|
56
|
+
// slug: string
|
|
57
|
+
// type: ApprovalMethodType
|
|
58
|
+
// displayName: string
|
|
59
|
+
// config?: ApprovalMethodConfig
|
|
60
|
+
// createdAt?: Date
|
|
61
|
+
// updatedAt?: Date
|
|
62
|
+
// }
|
|
63
|
+
|
|
64
|
+
export type ApprovalMethod = {
|
|
65
|
+
slug: string
|
|
66
|
+
displayName: string
|
|
67
|
+
createdAt?: Date
|
|
68
|
+
updatedAt?: Date
|
|
69
|
+
} & (
|
|
70
|
+
| {
|
|
71
|
+
type: 'service'
|
|
72
|
+
config: ServiceConfig
|
|
73
|
+
}
|
|
74
|
+
| {
|
|
75
|
+
type: 'personTeam'
|
|
76
|
+
config: PersonTeamConfig
|
|
77
|
+
}
|
|
78
|
+
| {
|
|
79
|
+
type: 'custom'
|
|
80
|
+
config: CustomConfig
|
|
81
|
+
}
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
// ============================================================================
|
|
85
|
+
// PER-APP APPROVAL DETAILS
|
|
86
|
+
// ============================================================================
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Role that can be requested for an app
|
|
90
|
+
*/
|
|
91
|
+
export interface AppRole {
|
|
92
|
+
displayName: string
|
|
93
|
+
description?: string
|
|
94
|
+
adminNotes?: string
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Approver contact (person who approves, may differ from reach-out contact)
|
|
99
|
+
*/
|
|
100
|
+
export interface ApproverContact {
|
|
101
|
+
displayName: string
|
|
102
|
+
contact?: string
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* URL link with optional label
|
|
107
|
+
*/
|
|
108
|
+
export interface ApprovalUrl {
|
|
109
|
+
label?: string
|
|
110
|
+
url: string
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Per-app approval details - stored as JSON in DbAppForCatalog
|
|
115
|
+
* All comment/text-like strings are markdown
|
|
116
|
+
*/
|
|
117
|
+
export interface AppAccessRequest {
|
|
118
|
+
approvalMethodId: string // FK to DbApprovalMethod
|
|
119
|
+
|
|
120
|
+
// Common fields (all types) - markdown text
|
|
121
|
+
comments?: string
|
|
122
|
+
requestPrompt?: string
|
|
123
|
+
postApprovalInstructions?: string
|
|
124
|
+
|
|
125
|
+
// Lists
|
|
126
|
+
roles?: Array<AppRole>
|
|
127
|
+
approvers?: Array<ApproverContact>
|
|
128
|
+
urls?: Array<ApprovalUrl>
|
|
129
|
+
|
|
130
|
+
// Type-specific (Person/Team only)
|
|
131
|
+
whoToReachOut?: string // markdown
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// ============================================================================
|
|
135
|
+
// INPUT TYPES FOR API
|
|
136
|
+
// ============================================================================
|
|
137
|
+
|
|
138
|
+
export interface CreateApprovalMethodInput {
|
|
139
|
+
type: ApprovalMethodType
|
|
140
|
+
displayName: string
|
|
141
|
+
config?: ApprovalMethodConfig
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
export interface UpdateApprovalMethodInput {
|
|
145
|
+
id: string
|
|
146
|
+
type?: ApprovalMethodType
|
|
147
|
+
displayName?: string
|
|
148
|
+
config?: ApprovalMethodConfig
|
|
149
|
+
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import type { DefaultWithOverridesAndTemplate } from '@env-hopper/shared-core'
|
|
1
2
|
import type { EhAppsMeta, EhContextIndexed } from '../backend/api.js'
|
|
2
|
-
import type { EhEnvIndexed } from './env/envTypes.js'
|
|
3
3
|
import type { EhAppIndexed } from './app/appTypes.js'
|
|
4
|
+
import type { EhEnvIndexed } from './env/envTypes.js'
|
|
4
5
|
|
|
5
|
-
export type
|
|
6
|
+
export type JumpResourceSlug = string
|
|
6
7
|
export type EnvSlug = string
|
|
7
8
|
|
|
8
9
|
export interface BootstrapConfigData {
|
|
@@ -12,13 +13,13 @@ export interface BootstrapConfigData {
|
|
|
12
13
|
contexts: Array<EhContextIndexed>
|
|
13
14
|
defaults: {
|
|
14
15
|
envSlug: EnvSlug
|
|
15
|
-
resourceJumpSlug:
|
|
16
|
+
resourceJumpSlug: JumpResourceSlug
|
|
16
17
|
}
|
|
17
18
|
}
|
|
18
19
|
|
|
19
|
-
export interface
|
|
20
|
+
export interface AvailabilityMatrixData {
|
|
20
21
|
envSlugs: Array<EnvSlug>
|
|
21
|
-
resourceJumpSlugs: Array<
|
|
22
|
+
resourceJumpSlugs: Array<JumpResourceSlug>
|
|
22
23
|
availabilityVariants: Array<AvailabilityVariant>
|
|
23
24
|
matrix: Array<Array<number>>
|
|
24
25
|
}
|
|
@@ -29,10 +30,71 @@ export interface AvailabilityVariant {
|
|
|
29
30
|
hasData?: boolean
|
|
30
31
|
}
|
|
31
32
|
|
|
33
|
+
export type ResourceJumpMetaInfo = Record<string, string>
|
|
34
|
+
|
|
35
|
+
export interface Sluggable {
|
|
36
|
+
slug: string
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface DisplayNamable {
|
|
40
|
+
displayName: string
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface SlugAndDisplayable extends Sluggable, DisplayNamable {
|
|
44
|
+
slug: string
|
|
45
|
+
displayName: string
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export interface EnvBaseInfo extends SlugAndDisplayable {
|
|
49
|
+
slug: string
|
|
50
|
+
displayName: string
|
|
51
|
+
templateParams?: Record<string, string>
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export interface LateResolvableParam extends SlugAndDisplayable {
|
|
55
|
+
slug: string
|
|
56
|
+
displayName: string
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export interface ResourceJump extends SlugAndDisplayable {
|
|
60
|
+
slug: string
|
|
61
|
+
displayName: string
|
|
62
|
+
urlTemplate: DefaultWithOverridesAndTemplate
|
|
63
|
+
lateResolvableParamSlugs?: Array<string>
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export interface ResourceJumpGroup {
|
|
67
|
+
slug: string
|
|
68
|
+
displayName: string
|
|
69
|
+
resourceSlugs: Array<string> // First item is primary, rest are children
|
|
70
|
+
}
|
|
71
|
+
|
|
32
72
|
export interface ResourceJumpsData {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
73
|
+
resourceJumps: Array<ResourceJump>
|
|
74
|
+
envs: Array<EnvBaseInfo>
|
|
75
|
+
lateResolvableParams: Array<LateResolvableParam>
|
|
76
|
+
groups?: Array<ResourceJumpGroup>
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export interface ResourceJumpsExtendedData {
|
|
80
|
+
// resourceJumps: Array<Pick<ResourceJump, 'slug'>>
|
|
81
|
+
envs: Array<EnvInfoExtended>
|
|
82
|
+
// groups?: Array<ResourceJumpGroup>
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export interface EnvInfoExtended extends Sluggable {
|
|
86
|
+
slug: string
|
|
87
|
+
description?: string
|
|
88
|
+
owner?: User
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// export interface ResourceJumpExtended extends Sluggable {
|
|
92
|
+
// slug: string
|
|
93
|
+
// description?: string;
|
|
94
|
+
// owner?: User;
|
|
95
|
+
// }
|
|
96
|
+
|
|
97
|
+
export interface User {
|
|
98
|
+
id: string
|
|
99
|
+
displayName: string
|
|
38
100
|
}
|
package/src/types/index.ts
CHANGED
|
@@ -3,6 +3,7 @@ export * from './common/sharedTypes.js'
|
|
|
3
3
|
export * from './common/resourceTypes.js'
|
|
4
4
|
export * from './common/dataRootTypes.js'
|
|
5
5
|
export * from './common/appCatalogTypes.js'
|
|
6
|
+
export * from './common/approvalMethodTypes.js'
|
|
6
7
|
export * from './common/env/envTypes.js'
|
|
7
8
|
export * from './common/app/appTypes.js'
|
|
8
9
|
export * from './common/app/ui/appUiTypes.js'
|
|
@@ -14,6 +15,8 @@ export * from './backend/api.js'
|
|
|
14
15
|
export * from './backend/common.js'
|
|
15
16
|
// Data source types
|
|
16
17
|
export * from './backend/dataSources.js'
|
|
18
|
+
// Company specific backend types
|
|
19
|
+
export * from './backend/companySpecificBackend.js'
|
|
17
20
|
|
|
18
21
|
// Deployment and version types
|
|
19
22
|
export * from './backend/deployments.js'
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/esm/index.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export { trpcRouter } from './server/controller.js';
|
|
2
|
-
export type { TRPCRouter } from './server/controller.js';
|
|
3
|
-
export { createEhTrpcContext } from './server/ehTrpcContext.js';
|
|
4
|
-
export type { EhTrpcContext, EhTrpcContextOptions, } from './server/ehTrpcContext.js';
|
|
5
|
-
export { staticControllerContract } from './server/ehStaticControllerContract.js';
|
|
6
|
-
export type { EhStaticControllerContract } from './server/ehStaticControllerContract.js';
|
|
7
|
-
export * from './types/index.js';
|
package/dist/esm/index.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { trpcRouter } from "./server/controller.js";
|
|
2
|
-
import { createEhTrpcContext } from "./server/ehTrpcContext.js";
|
|
3
|
-
import { staticControllerContract } from "./server/ehStaticControllerContract.js";
|
|
4
|
-
export {
|
|
5
|
-
createEhTrpcContext,
|
|
6
|
-
staticControllerContract,
|
|
7
|
-
trpcRouter
|
|
8
|
-
};
|
|
9
|
-
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { EhTrpcContext } from './ehTrpcContext.js';
|
|
2
|
-
export declare const trpcRouter: import('@trpc/server').TRPCBuiltRouter<{
|
|
3
|
-
ctx: EhTrpcContext;
|
|
4
|
-
meta: {};
|
|
5
|
-
errorShape: import('@trpc/server').TRPCDefaultErrorShape;
|
|
6
|
-
transformer: false;
|
|
7
|
-
}, import('@trpc/server').TRPCDecorateCreateRouterOptions<{
|
|
8
|
-
bootstrap: import('@trpc/server').TRPCQueryProcedure<{
|
|
9
|
-
input: void;
|
|
10
|
-
output: import('..').BootstrapConfigData;
|
|
11
|
-
meta: {};
|
|
12
|
-
}>;
|
|
13
|
-
availabilityMatrix: import('@trpc/server').TRPCQueryProcedure<{
|
|
14
|
-
input: void;
|
|
15
|
-
output: import('..').AvailiabilityMatrixData;
|
|
16
|
-
meta: {};
|
|
17
|
-
}>;
|
|
18
|
-
tryFindRenameRule: import('@trpc/server').TRPCQueryProcedure<{
|
|
19
|
-
input: {
|
|
20
|
-
envSlug?: string | undefined;
|
|
21
|
-
resourceSlug?: string | undefined;
|
|
22
|
-
};
|
|
23
|
-
output: false | import('..').RenameRule;
|
|
24
|
-
meta: {};
|
|
25
|
-
}>;
|
|
26
|
-
resourceJumps: import('@trpc/server').TRPCQueryProcedure<{
|
|
27
|
-
input: void;
|
|
28
|
-
output: import('..').ResourceJumpsData;
|
|
29
|
-
meta: {};
|
|
30
|
-
}>;
|
|
31
|
-
}>>;
|
|
32
|
-
export type TRPCRouter = typeof trpcRouter;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { initTRPC } from "@trpc/server";
|
|
2
|
-
import z from "zod";
|
|
3
|
-
const t = initTRPC.context().create();
|
|
4
|
-
const router = t.router;
|
|
5
|
-
const publicProcedure = t.procedure;
|
|
6
|
-
const trpcRouter = router({
|
|
7
|
-
bootstrap: publicProcedure.query(async ({ ctx }) => {
|
|
8
|
-
return await ctx.companySpecificBackend.getBootstrapData();
|
|
9
|
-
}),
|
|
10
|
-
availabilityMatrix: publicProcedure.query(async ({ ctx }) => {
|
|
11
|
-
return await ctx.companySpecificBackend.getAvailabilityMatrix();
|
|
12
|
-
}),
|
|
13
|
-
tryFindRenameRule: publicProcedure.input(
|
|
14
|
-
z.object({
|
|
15
|
-
envSlug: z.string().optional(),
|
|
16
|
-
resourceSlug: z.string().optional()
|
|
17
|
-
})
|
|
18
|
-
).query(async ({ input, ctx }) => {
|
|
19
|
-
return await ctx.companySpecificBackend.getNameMigrations(input);
|
|
20
|
-
}),
|
|
21
|
-
resourceJumps: publicProcedure.query(async ({ ctx }) => {
|
|
22
|
-
return await ctx.companySpecificBackend.getResourceJumps();
|
|
23
|
-
})
|
|
24
|
-
// specificEnvs: publicProcedure
|
|
25
|
-
// .query(async ({ctx}) => {
|
|
26
|
-
// return await ctx.companySpecificBackend.getDeployments({
|
|
27
|
-
// envNames: ['dev', 'prod'],
|
|
28
|
-
// appNames: ['app1', 'app2'],
|
|
29
|
-
// })
|
|
30
|
-
// }),
|
|
31
|
-
});
|
|
32
|
-
export {
|
|
33
|
-
trpcRouter
|
|
34
|
-
};
|
|
35
|
-
//# sourceMappingURL=controller.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"controller.js","sources":["../../../src/server/controller.ts"],"sourcesContent":["import { initTRPC } from '@trpc/server'\nimport z from 'zod'\nimport type { EhTrpcContext } from './ehTrpcContext'\nimport type { TRPCRootObject } from '@trpc/server'\n\n/**\n * Initialization of tRPC backend\n * Should be done only once per backend!\n */\nconst t: TRPCRootObject<EhTrpcContext, {}, {}> = initTRPC\n .context<EhTrpcContext>()\n .create()\n\n/**\n * Export reusable router and procedure helpers\n * that can be used throughout the router\n */\nconst router: typeof t.router = t.router\nconst publicProcedure: typeof t.procedure = t.procedure\n\nexport const trpcRouter = router({\n bootstrap: publicProcedure.query(async ({ ctx }) => {\n return await ctx.companySpecificBackend.getBootstrapData()\n }),\n\n availabilityMatrix: publicProcedure.query(async ({ ctx }) => {\n return await ctx.companySpecificBackend.getAvailabilityMatrix()\n }),\n\n tryFindRenameRule: publicProcedure\n .input(\n z.object({\n envSlug: z.string().optional(),\n resourceSlug: z.string().optional(),\n }),\n )\n .query(async ({ input, ctx }) => {\n return await ctx.companySpecificBackend.getNameMigrations(input)\n }),\n\n resourceJumps: publicProcedure.query(async ({ ctx }) => {\n return await ctx.companySpecificBackend.getResourceJumps()\n }),\n\n // specificEnvs: publicProcedure\n // .query(async ({ctx}) => {\n // return await ctx.companySpecificBackend.getDeployments({\n // envNames: ['dev', 'prod'],\n // appNames: ['app1', 'app2'],\n // })\n // }),\n})\n\nexport type TRPCRouter = typeof trpcRouter\n"],"names":[],"mappings":";;AASA,MAAM,IAA2C,SAC9C,QAAA,EACA,OAAA;AAMH,MAAM,SAA0B,EAAE;AAClC,MAAM,kBAAsC,EAAE;AAEvC,MAAM,aAAa,OAAO;AAAA,EAC/B,WAAW,gBAAgB,MAAM,OAAO,EAAE,UAAU;AAClD,WAAO,MAAM,IAAI,uBAAuB,iBAAA;AAAA,EAC1C,CAAC;AAAA,EAED,oBAAoB,gBAAgB,MAAM,OAAO,EAAE,UAAU;AAC3D,WAAO,MAAM,IAAI,uBAAuB,sBAAA;AAAA,EAC1C,CAAC;AAAA,EAED,mBAAmB,gBAChB;AAAA,IACC,EAAE,OAAO;AAAA,MACP,SAAS,EAAE,OAAA,EAAS,SAAA;AAAA,MACpB,cAAc,EAAE,OAAA,EAAS,SAAA;AAAA,IAAS,CACnC;AAAA,EAAA,EAEF,MAAM,OAAO,EAAE,OAAO,UAAU;AAC/B,WAAO,MAAM,IAAI,uBAAuB,kBAAkB,KAAK;AAAA,EACjE,CAAC;AAAA,EAEH,eAAe,gBAAgB,MAAM,OAAO,EAAE,UAAU;AACtD,WAAO,MAAM,IAAI,uBAAuB,iBAAA;AAAA,EAC1C,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASH,CAAC;"}
|
package/dist/esm/server/db.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ehStaticControllerContract.js","sources":["../../../src/server/ehStaticControllerContract.ts"],"sourcesContent":["export interface EhStaticControllerContract {\n methods: { getIcon: { method: string; url: string } }\n}\n\nexport const staticControllerContract: EhStaticControllerContract = {\n methods: {\n getIcon: {\n method: 'get',\n url: 'icon/:icon',\n },\n },\n}\n"],"names":[],"mappings":"AAIO,MAAM,2BAAuD;AAAA,EAClE,SAAS;AAAA,IACP,SAAS;AAAA,MACP,QAAQ;AAAA,MACR,KAAK;AAAA,IAAA;AAAA,EACP;AAEJ;"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { EhBackendCompanySpecificBackend } from '../types.js';
|
|
2
|
-
export interface EhTrpcContext {
|
|
3
|
-
companySpecificBackend: EhBackendCompanySpecificBackend;
|
|
4
|
-
}
|
|
5
|
-
export interface EhTrpcContextOptions {
|
|
6
|
-
companySpecificBackend: EhBackendCompanySpecificBackend;
|
|
7
|
-
}
|
|
8
|
-
export declare function createEhTrpcContext({ companySpecificBackend, }: EhTrpcContextOptions): EhTrpcContext;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ehTrpcContext.js","sources":["../../../src/server/ehTrpcContext.ts"],"sourcesContent":["import type { EhBackendCompanySpecificBackend } from '../types'\n\nexport interface EhTrpcContext {\n companySpecificBackend: EhBackendCompanySpecificBackend\n}\n\nexport interface EhTrpcContextOptions {\n companySpecificBackend: EhBackendCompanySpecificBackend\n}\n\nexport function createEhTrpcContext({\n companySpecificBackend,\n}: EhTrpcContextOptions): EhTrpcContext {\n return {\n companySpecificBackend,\n }\n}\n\n// const createContext = ({\n// req,\n// res\n// }: trpcExpress.CreateExpressContextOptions) => ({}); // no context\n// type Context = Awaited<ReturnType<typeof createContext>>;\n"],"names":[],"mappings":"AAUO,SAAS,oBAAoB;AAAA,EAClC;AACF,GAAwC;AACtC,SAAO;AAAA,IACL;AAAA,EAAA;AAEJ;"}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { AvailiabilityMatrixData, BootstrapConfigData, ResourceJumpsData } from '../common/dataRootTypes.js';
|
|
2
|
-
import { EhAppIndexed } from '../common/app/appTypes.js';
|
|
3
|
-
import { EhAppPageIndexed, EhAppUiIndexed } from '../common/app/ui/appUiTypes.js';
|
|
4
|
-
import { EhBackendCredentialInput, EhBackendUiDefaultsInput } from './common.js';
|
|
5
|
-
import { EhBackendDataSourceInput } from './dataSources.js';
|
|
6
|
-
export interface EhBackendVersionsRequestParams {
|
|
7
|
-
envNames: Array<string>;
|
|
8
|
-
appNames: Array<string>;
|
|
9
|
-
}
|
|
10
|
-
export interface EhBackendVersionsReturn {
|
|
11
|
-
envIds: Array<string>;
|
|
12
|
-
appIds: Array<string>;
|
|
13
|
-
}
|
|
14
|
-
export interface EhBackendPageInput extends EhAppPageIndexed {
|
|
15
|
-
slug: string;
|
|
16
|
-
title?: string;
|
|
17
|
-
url: string;
|
|
18
|
-
credentialsRefs?: Array<string>;
|
|
19
|
-
}
|
|
20
|
-
export interface EhBackendAppUIBaseInput {
|
|
21
|
-
credentials?: Array<EhBackendCredentialInput>;
|
|
22
|
-
defaults?: EhBackendUiDefaultsInput;
|
|
23
|
-
}
|
|
24
|
-
export interface EhBackendAppUIInput extends EhBackendAppUIBaseInput, EhAppUiIndexed {
|
|
25
|
-
pages: Array<EhBackendPageInput>;
|
|
26
|
-
}
|
|
27
|
-
export interface EhBackendTagsDescriptionDataIndexed {
|
|
28
|
-
descriptions: Array<EhBackendTagDescriptionDataIndexed>;
|
|
29
|
-
}
|
|
30
|
-
export interface EhBackendTagDescriptionDataIndexed {
|
|
31
|
-
tagKey: string;
|
|
32
|
-
displayName?: string;
|
|
33
|
-
fixedTagValues?: Array<EhBackendTagFixedTagValue>;
|
|
34
|
-
}
|
|
35
|
-
export interface EhBackendTagFixedTagValue {
|
|
36
|
-
tagValue: string;
|
|
37
|
-
displayName: string;
|
|
38
|
-
}
|
|
39
|
-
export interface EhBackendAppInput extends EhAppIndexed {
|
|
40
|
-
ui?: EhBackendAppUIInput;
|
|
41
|
-
dataSources?: Array<EhBackendDataSourceInput>;
|
|
42
|
-
}
|
|
43
|
-
export interface EhContextIndexed {
|
|
44
|
-
slug: string;
|
|
45
|
-
displayName: string;
|
|
46
|
-
/**
|
|
47
|
-
* The value is shared across envs (By default: false)
|
|
48
|
-
*/
|
|
49
|
-
isSharedAcrossEnvs?: boolean;
|
|
50
|
-
defaultFixedValues?: Array<string>;
|
|
51
|
-
}
|
|
52
|
-
export type EhBackendAppDto = EhAppIndexed;
|
|
53
|
-
export interface EhAppsMeta {
|
|
54
|
-
defaultIcon?: string;
|
|
55
|
-
tags: EhBackendTagsDescriptionDataIndexed;
|
|
56
|
-
}
|
|
57
|
-
export interface RenameRuleParams {
|
|
58
|
-
envSlug?: string;
|
|
59
|
-
resourceSlug?: string;
|
|
60
|
-
}
|
|
61
|
-
export interface RenameRule {
|
|
62
|
-
type: 'resourceRename' | 'envRename';
|
|
63
|
-
oldSlug: string;
|
|
64
|
-
targetSlug: string;
|
|
65
|
-
}
|
|
66
|
-
export interface EhBackendCompanySpecificBackend {
|
|
67
|
-
getBootstrapData: () => Promise<BootstrapConfigData>;
|
|
68
|
-
getAvailabilityMatrix: () => Promise<AvailiabilityMatrixData>;
|
|
69
|
-
getNameMigrations: (params: RenameRuleParams) => Promise<RenameRule | false>;
|
|
70
|
-
getResourceJumps: () => Promise<ResourceJumpsData>;
|
|
71
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { EhMetaDictionary } from '../common/sharedTypes.js';
|
|
2
|
-
export interface EhBackendDataSourceInputCommon {
|
|
3
|
-
meta?: EhMetaDictionary;
|
|
4
|
-
}
|
|
5
|
-
export interface EhBackendDataSourceInputDb {
|
|
6
|
-
slug?: string;
|
|
7
|
-
type: 'db';
|
|
8
|
-
url: string;
|
|
9
|
-
username: string;
|
|
10
|
-
password: string;
|
|
11
|
-
}
|
|
12
|
-
export interface EhBackendDataSourceInputKafka {
|
|
13
|
-
slug?: string;
|
|
14
|
-
type: 'kafka';
|
|
15
|
-
topics: {
|
|
16
|
-
consumer?: Array<string>;
|
|
17
|
-
producer?: Array<string>;
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
export type EhBackendDataSourceInput = EhBackendDataSourceInputCommon & (EhBackendDataSourceInputDb | EhBackendDataSourceInputKafka);
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { EhMetaDictionary } from '../common/sharedTypes.js';
|
|
2
|
-
export interface EhBackendEnvironmentInput {
|
|
3
|
-
slug: string;
|
|
4
|
-
displayName?: string;
|
|
5
|
-
description?: string;
|
|
6
|
-
meta?: EhMetaDictionary;
|
|
7
|
-
}
|
|
8
|
-
export interface EhBackendDeploymentInput {
|
|
9
|
-
envId: string;
|
|
10
|
-
appId: string;
|
|
11
|
-
displayVersion: string;
|
|
12
|
-
meta?: EhMetaDictionary;
|
|
13
|
-
}
|
|
14
|
-
export interface EhBackendDeployableInput {
|
|
15
|
-
slug: string;
|
|
16
|
-
meta?: {
|
|
17
|
-
config: string;
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Latest - backend returned latest data.
|
|
22
|
-
* Cached - backend in process of updating data, but returned cached data.
|
|
23
|
-
*/
|
|
24
|
-
export type EhBackendDataFreshness = 'latest' | 'cached';
|
|
25
|
-
export interface EhBackendDataVersion {
|
|
26
|
-
version: string;
|
|
27
|
-
freshness: EhBackendDataFreshness;
|
|
28
|
-
}
|
|
29
|
-
export interface EhBackendDeployment {
|
|
30
|
-
appName: string;
|
|
31
|
-
deployableServiceName: string;
|
|
32
|
-
envName: string;
|
|
33
|
-
version: EhBackendDataVersion;
|
|
34
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { EhMetaDictionary, Tag } from '../sharedTypes.js';
|
|
2
|
-
import { EhAppUiIndexed } from './ui/appUiTypes.js';
|
|
3
|
-
export interface EhAppIndexed {
|
|
4
|
-
slug: string;
|
|
5
|
-
displayName: string;
|
|
6
|
-
abbr?: string;
|
|
7
|
-
aliases?: Array<string>;
|
|
8
|
-
ui?: EhAppUiIndexed;
|
|
9
|
-
tags?: Array<Tag>;
|
|
10
|
-
iconName?: string;
|
|
11
|
-
meta?: EhMetaDictionary;
|
|
12
|
-
}
|