@igstack/app-catalog-backend-core 0.3.1-alpha-20260405015231 → 0.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.
- package/dist/db/syncAppCatalog.d.mts +3 -5
- package/dist/db/syncAppCatalog.d.mts.map +1 -1
- package/dist/db/syncAppCatalog.mjs +49 -57
- package/dist/db/syncAppCatalog.mjs.map +1 -1
- package/dist/db/tableSyncMagazine.d.mts +3 -7
- package/dist/db/tableSyncMagazine.d.mts.map +1 -1
- package/dist/db/tableSyncMagazine.mjs +3 -7
- package/dist/db/tableSyncMagazine.mjs.map +1 -1
- package/dist/db/tableSyncPrismaAdapter.mjs.map +1 -1
- package/dist/generated/prisma/client.mjs.map +1 -1
- package/dist/generated/prisma/internal/class.d.mts +5 -17
- package/dist/generated/prisma/internal/class.d.mts.map +1 -1
- package/dist/generated/prisma/internal/class.mjs +4 -4
- package/dist/generated/prisma/internal/class.mjs.map +1 -1
- package/dist/generated/prisma/internal/prismaNamespace.d.mts +46 -132
- package/dist/generated/prisma/internal/prismaNamespace.d.mts.map +1 -1
- package/dist/generated/prisma/models/DbResource.d.mts +2433 -0
- package/dist/generated/prisma/models/DbResource.d.mts.map +1 -0
- package/dist/generated/prisma/models/SourceReference.d.mts +90 -90
- package/dist/generated/prisma/models/SourceReference.d.mts.map +1 -1
- package/dist/generated/prisma/models.d.mts +2 -3
- package/dist/index.d.mts +3 -4
- package/dist/modules/appCatalog/checkLinks.mjs +1 -1
- package/dist/modules/appCatalog/checkLinks.mjs.map +1 -1
- package/dist/modules/appCatalog/service.mjs +26 -34
- package/dist/modules/appCatalog/service.mjs.map +1 -1
- package/dist/modules/assets/screenshotRestController.mjs +2 -2
- package/dist/modules/assets/screenshotRestController.mjs.map +1 -1
- package/dist/modules/assets/syncAssets.mjs +4 -4
- package/dist/modules/assets/syncAssets.mjs.map +1 -1
- package/dist/modules/lighthouseKeeper/tools.mjs +1 -1
- package/dist/modules/lighthouseKeeper/tools.mjs.map +1 -1
- package/dist/server/controller.d.mts +2 -2
- package/dist/server/controller.mjs.map +1 -1
- package/dist/types/common/appCatalogTypes.d.mts +26 -9
- package/dist/types/common/appCatalogTypes.d.mts.map +1 -1
- package/dist/types/common/approvalMethodTypes.d.mts +5 -1
- package/dist/types/common/approvalMethodTypes.d.mts.map +1 -1
- package/package.json +3 -3
- package/prisma/schema.prisma +53 -62
- package/src/db/syncAppCatalog.ts +68 -73
- package/src/db/tableSyncMagazine.ts +3 -7
- package/src/db/tableSyncPrismaAdapter.ts +1 -1
- package/src/generated/prisma/browser.ts +2 -7
- package/src/generated/prisma/client.ts +2 -7
- package/src/generated/prisma/internal/class.ts +8 -18
- package/src/generated/prisma/internal/prismaNamespace.ts +43 -131
- package/src/generated/prisma/internal/prismaNamespaceBrowser.ts +7 -20
- package/src/generated/prisma/models/DbResource.ts +2701 -0
- package/src/generated/prisma/models/SourceReference.ts +89 -89
- package/src/generated/prisma/models.ts +1 -2
- package/src/index.ts +1 -1
- package/src/modules/appCatalog/checkLinks.ts +7 -7
- package/src/modules/appCatalog/service.ts +51 -62
- package/src/modules/assets/screenshotRestController.ts +2 -2
- package/src/modules/assets/screenshotRouter.ts +2 -2
- package/src/modules/assets/syncAssets.ts +4 -4
- package/src/modules/lighthouseKeeper/tools.ts +1 -1
- package/src/prisma-json-types.d.ts +8 -8
- package/src/server/controller.ts +2 -2
- package/src/types/common/appCatalogTypes.ts +28 -9
- package/src/types/common/approvalMethodTypes.ts +6 -0
- package/src/types/index.ts +0 -1
- package/dist/generated/prisma/models/DbAppForCatalog.d.mts +0 -1778
- package/dist/generated/prisma/models/DbAppForCatalog.d.mts.map +0 -1
- package/dist/generated/prisma/models/DbSubResource.d.mts +0 -1468
- package/dist/generated/prisma/models/DbSubResource.d.mts.map +0 -1
- package/dist/types/common/subResourceTypes.d.mts +0 -24
- package/dist/types/common/subResourceTypes.d.mts.map +0 -1
- package/src/generated/prisma/models/DbAppForCatalog.ts +0 -2014
- package/src/generated/prisma/models/DbSubResource.ts +0 -1692
- package/src/types/common/subResourceTypes.ts +0 -20
|
@@ -4,20 +4,19 @@ import type {
|
|
|
4
4
|
AppApprovalMethod,
|
|
5
5
|
AppCatalogData,
|
|
6
6
|
AppCategory,
|
|
7
|
-
AppForCatalog,
|
|
8
7
|
GroupingTagDefinition,
|
|
8
|
+
Resource,
|
|
9
9
|
} from '../../types/common/appCatalogTypes'
|
|
10
10
|
import type {
|
|
11
11
|
CustomConfig,
|
|
12
12
|
ServiceConfig,
|
|
13
13
|
} from '../../types/common/approvalMethodTypes'
|
|
14
14
|
import type { Group, Person } from '../../types/common/personGroupTypes'
|
|
15
|
-
import type { SubResource } from '../../types/common/subResourceTypes'
|
|
16
15
|
import { omit } from 'radashi'
|
|
17
16
|
import { parseSourceSlug } from '../../utils/parseSourceSlug'
|
|
18
17
|
|
|
19
|
-
/** Prisma query result for
|
|
20
|
-
type
|
|
18
|
+
/** Prisma query result for DbResource with sourceRefs included (used by rowToResource) */
|
|
19
|
+
type ResourceRowWithSourceRefs = Prisma.DbResourceGetPayload<{
|
|
21
20
|
include: { sourceRefs: true }
|
|
22
21
|
}>
|
|
23
22
|
|
|
@@ -34,16 +33,16 @@ export async function getGroupingTagDefinitionsFromPrisma(): Promise<
|
|
|
34
33
|
// Fetch all tag definitions
|
|
35
34
|
const rows = await prisma.dbAppTagDefinition.findMany()
|
|
36
35
|
|
|
37
|
-
// Fetch all
|
|
38
|
-
const
|
|
36
|
+
// Fetch all resources to count tag usage
|
|
37
|
+
const resources = await prisma.dbResource.findMany({
|
|
39
38
|
select: { tags: true },
|
|
40
39
|
})
|
|
41
40
|
|
|
42
|
-
// Count tag values across all
|
|
41
|
+
// Count tag values across all resources
|
|
43
42
|
const tagCounts = new Map<string, Map<string, number>>()
|
|
44
43
|
|
|
45
|
-
for (const
|
|
46
|
-
const tags = (
|
|
44
|
+
for (const resource of resources) {
|
|
45
|
+
const tags = (resource.tags as unknown as string[] | null) ?? []
|
|
47
46
|
for (const tag of tags) {
|
|
48
47
|
const [prefix, value] = tag.split(':')
|
|
49
48
|
if (prefix && value) {
|
|
@@ -80,7 +79,7 @@ export async function getApprovalMethodsFromPrisma(): Promise<
|
|
|
80
79
|
> {
|
|
81
80
|
const prisma = getDbClient()
|
|
82
81
|
|
|
83
|
-
// Fetch all
|
|
82
|
+
// Fetch all approval methods
|
|
84
83
|
const rows = await prisma.dbApprovalMethod.findMany()
|
|
85
84
|
|
|
86
85
|
return rows.map((row) => {
|
|
@@ -129,13 +128,13 @@ export async function getApprovalMethodsFromPrisma(): Promise<
|
|
|
129
128
|
})
|
|
130
129
|
}
|
|
131
130
|
|
|
132
|
-
function
|
|
131
|
+
function rowToResource(row: ResourceRowWithSourceRefs): Resource {
|
|
133
132
|
const accessRequest =
|
|
134
|
-
row.accessRequest as unknown as
|
|
133
|
+
row.accessRequest as unknown as Resource['accessRequest']
|
|
135
134
|
const teams = (row.teams as unknown as string[] | null) ?? []
|
|
136
|
-
const tags = (row.tags as unknown as
|
|
135
|
+
const tags = (row.tags as unknown as Resource['tags']) ?? []
|
|
137
136
|
const screenshotIds =
|
|
138
|
-
(row.screenshotIds as unknown as
|
|
137
|
+
(row.screenshotIds as unknown as Resource['screenshotIds']) ?? []
|
|
139
138
|
const sources = row.sourceRefs.map((ref) => ({
|
|
140
139
|
sourceSlug: ref.sourceSlug,
|
|
141
140
|
url: ref.url,
|
|
@@ -151,19 +150,18 @@ function rowToAppForCatalog(row: AppRowWithSourceRefs): AppForCatalog {
|
|
|
151
150
|
const deprecated =
|
|
152
151
|
row.deprecated == null
|
|
153
152
|
? undefined
|
|
154
|
-
: (row.deprecated as unknown as
|
|
153
|
+
: (row.deprecated as unknown as Resource['deprecated'])
|
|
155
154
|
const aiPrompt = row.aiPrompt == null ? undefined : row.aiPrompt
|
|
156
155
|
const urlIssues = (row.urlIssues as unknown as string[] | null)?.length
|
|
157
156
|
? (row.urlIssues as unknown as string[])
|
|
158
157
|
: undefined
|
|
159
158
|
const tiers =
|
|
160
|
-
row.tiers == null
|
|
161
|
-
? undefined
|
|
162
|
-
: (row.tiers as unknown as AppForCatalog['tiers'])
|
|
159
|
+
row.tiers == null ? undefined : (row.tiers as unknown as Resource['tiers'])
|
|
163
160
|
|
|
164
161
|
return {
|
|
165
162
|
id: row.id,
|
|
166
163
|
slug: row.slug,
|
|
164
|
+
type: row.type,
|
|
167
165
|
displayName: row.displayName,
|
|
168
166
|
abbreviation,
|
|
169
167
|
nicknames,
|
|
@@ -180,21 +178,37 @@ function rowToAppForCatalog(row: AppRowWithSourceRefs): AppForCatalog {
|
|
|
180
178
|
aiPrompt,
|
|
181
179
|
urlIssues,
|
|
182
180
|
tiers,
|
|
181
|
+
// Fields from former SubResource
|
|
182
|
+
parentSlug: row.parentSlug ?? undefined,
|
|
183
|
+
tier: row.tier ?? undefined,
|
|
184
|
+
familySlug: row.familySlug ?? undefined,
|
|
185
|
+
aliases: row.aliases.length ? row.aliases : undefined,
|
|
186
|
+
ownerPersonSlug: row.ownerPersonSlug ?? undefined,
|
|
187
|
+
accessMaintainerGroupSlugs: row.accessMaintainerGroupSlugs.length
|
|
188
|
+
? row.accessMaintainerGroupSlugs
|
|
189
|
+
: undefined,
|
|
190
|
+
accessComments: row.accessComments ?? undefined,
|
|
191
|
+
extra: row.extra
|
|
192
|
+
? (row.extra as unknown as Record<string, unknown>)
|
|
193
|
+
: undefined,
|
|
183
194
|
}
|
|
184
195
|
}
|
|
185
196
|
|
|
186
|
-
export async function
|
|
197
|
+
export async function getResourcesFromPrisma(): Promise<Resource[]> {
|
|
187
198
|
const prisma = getDbClient()
|
|
188
199
|
|
|
189
|
-
const rows = await prisma.
|
|
200
|
+
const rows = await prisma.dbResource.findMany({
|
|
190
201
|
include: {
|
|
191
202
|
sourceRefs: true,
|
|
192
203
|
},
|
|
193
204
|
})
|
|
194
205
|
|
|
195
|
-
return rows.map(
|
|
206
|
+
return rows.map(rowToResource)
|
|
196
207
|
}
|
|
197
208
|
|
|
209
|
+
/** @deprecated Use getResourcesFromPrisma instead */
|
|
210
|
+
export const getAppsFromPrisma = getResourcesFromPrisma
|
|
211
|
+
|
|
198
212
|
export interface UpdateAppInput {
|
|
199
213
|
id: string
|
|
200
214
|
data: {
|
|
@@ -208,7 +222,7 @@ export interface UpdateAppInput {
|
|
|
208
222
|
}
|
|
209
223
|
}
|
|
210
224
|
|
|
211
|
-
export async function updateApp(input: UpdateAppInput): Promise<
|
|
225
|
+
export async function updateApp(input: UpdateAppInput): Promise<Resource> {
|
|
212
226
|
const prisma = getDbClient()
|
|
213
227
|
const { id, data } = input
|
|
214
228
|
|
|
@@ -230,7 +244,7 @@ export async function updateApp(input: UpdateAppInput): Promise<AppForCatalog> {
|
|
|
230
244
|
updatePayload.description = data.description
|
|
231
245
|
if (data.aiPrompt !== undefined) updatePayload.aiPrompt = data.aiPrompt
|
|
232
246
|
|
|
233
|
-
const updated = await prisma.
|
|
247
|
+
const updated = await prisma.dbResource.update({
|
|
234
248
|
where: { id },
|
|
235
249
|
data: updatePayload,
|
|
236
250
|
include: { sourceRefs: true },
|
|
@@ -249,34 +263,34 @@ export async function updateApp(input: UpdateAppInput): Promise<AppForCatalog> {
|
|
|
249
263
|
}
|
|
250
264
|
|
|
251
265
|
await prisma.sourceReference.deleteMany({
|
|
252
|
-
where: {
|
|
266
|
+
where: { resourceId: updated.id },
|
|
253
267
|
})
|
|
254
268
|
|
|
255
269
|
if (urls.length > 0) {
|
|
256
270
|
await prisma.sourceReference.createMany({
|
|
257
271
|
data: urls.map((url) => ({
|
|
258
|
-
|
|
272
|
+
resourceId: updated.id,
|
|
259
273
|
sourceSlug: parseSourceSlug(url),
|
|
260
274
|
url: url.trim(),
|
|
261
275
|
})),
|
|
262
276
|
})
|
|
263
277
|
}
|
|
264
278
|
|
|
265
|
-
const refetched = await prisma.
|
|
279
|
+
const refetched = await prisma.dbResource.findUnique({
|
|
266
280
|
where: { id },
|
|
267
281
|
include: { sourceRefs: true },
|
|
268
282
|
})
|
|
269
|
-
if (!refetched) throw new Error('
|
|
270
|
-
return
|
|
283
|
+
if (!refetched) throw new Error('Resource not found after update')
|
|
284
|
+
return rowToResource(refetched)
|
|
271
285
|
}
|
|
272
286
|
|
|
273
|
-
return
|
|
287
|
+
return rowToResource(updated)
|
|
274
288
|
}
|
|
275
289
|
|
|
276
|
-
export function deriveCategories(
|
|
290
|
+
export function deriveCategories(resources: Resource[]): AppCategory[] {
|
|
277
291
|
const tagSet = new Set<string>()
|
|
278
|
-
for (const
|
|
279
|
-
for (const tag of
|
|
292
|
+
for (const resource of resources) {
|
|
293
|
+
for (const tag of resource.tags ?? []) {
|
|
280
294
|
const normalized = tag.trim().toLowerCase()
|
|
281
295
|
if (normalized) tagSet.add(normalized)
|
|
282
296
|
}
|
|
@@ -312,43 +326,18 @@ export async function getGroupsFromPrisma(): Promise<Group[]> {
|
|
|
312
326
|
}))
|
|
313
327
|
}
|
|
314
328
|
|
|
315
|
-
export async function getSubResourcesFromPrisma(): Promise<SubResource[]> {
|
|
316
|
-
const prisma = getDbClient()
|
|
317
|
-
const rows = await prisma.dbSubResource.findMany()
|
|
318
|
-
return rows.map((row) => ({
|
|
319
|
-
slug: row.slug,
|
|
320
|
-
displayName: row.displayName,
|
|
321
|
-
description: row.description ?? undefined,
|
|
322
|
-
appSlug: row.appSlug,
|
|
323
|
-
familySlug: row.familySlug ?? undefined,
|
|
324
|
-
tierSlug: row.tierSlug ?? undefined,
|
|
325
|
-
aliases: row.aliases as unknown as string[],
|
|
326
|
-
ownerPersonSlug: row.ownerPersonSlug ?? undefined,
|
|
327
|
-
accessMaintainerGroupSlugs:
|
|
328
|
-
row.accessMaintainerGroupSlugs as unknown as string[],
|
|
329
|
-
accessRequest: row.accessRequest
|
|
330
|
-
? (row.accessRequest as unknown as SubResource['accessRequest'])
|
|
331
|
-
: undefined,
|
|
332
|
-
accessComments: row.accessComments ?? undefined,
|
|
333
|
-
extra: row.extra
|
|
334
|
-
? (row.extra as unknown as Record<string, unknown>)
|
|
335
|
-
: undefined,
|
|
336
|
-
}))
|
|
337
|
-
}
|
|
338
|
-
|
|
339
329
|
export async function getAppCatalogData(
|
|
340
|
-
|
|
330
|
+
getResourcesOptional?: () => Promise<Resource[]>,
|
|
341
331
|
): Promise<AppCatalogData> {
|
|
342
|
-
const
|
|
343
|
-
? await
|
|
344
|
-
: await
|
|
332
|
+
const resources = getResourcesOptional
|
|
333
|
+
? await getResourcesOptional()
|
|
334
|
+
: await getResourcesFromPrisma()
|
|
345
335
|
|
|
346
336
|
return {
|
|
347
|
-
|
|
337
|
+
resources,
|
|
348
338
|
tagsDefinitions: await getGroupingTagDefinitionsFromPrisma(),
|
|
349
339
|
approvalMethods: await getApprovalMethodsFromPrisma(),
|
|
350
340
|
persons: await getPersonsFromPrisma(),
|
|
351
341
|
groups: await getGroupsFromPrisma(),
|
|
352
|
-
subResources: await getSubResourcesFromPrisma(),
|
|
353
342
|
}
|
|
354
343
|
}
|
|
@@ -33,7 +33,7 @@ export function registerScreenshotRestController(
|
|
|
33
33
|
const prisma = getDbClient()
|
|
34
34
|
|
|
35
35
|
// Find app by slug
|
|
36
|
-
const app = await prisma.
|
|
36
|
+
const app = await prisma.dbResource.findUnique({
|
|
37
37
|
where: { slug: appSlug },
|
|
38
38
|
select: { screenshotIds: true },
|
|
39
39
|
})
|
|
@@ -82,7 +82,7 @@ export function registerScreenshotRestController(
|
|
|
82
82
|
const prisma = getDbClient()
|
|
83
83
|
|
|
84
84
|
// Find app by slug
|
|
85
|
-
const app = await prisma.
|
|
85
|
+
const app = await prisma.dbResource.findUnique({
|
|
86
86
|
where: { slug: appSlug },
|
|
87
87
|
select: { screenshotIds: true },
|
|
88
88
|
})
|
|
@@ -50,7 +50,7 @@ export function createScreenshotRouter() {
|
|
|
50
50
|
const prisma = getDbClient()
|
|
51
51
|
|
|
52
52
|
// Find app by slug
|
|
53
|
-
const app = await prisma.
|
|
53
|
+
const app = await prisma.dbResource.findUnique({
|
|
54
54
|
where: { slug: input.appSlug },
|
|
55
55
|
select: { screenshotIds: true },
|
|
56
56
|
})
|
|
@@ -88,7 +88,7 @@ export function createScreenshotRouter() {
|
|
|
88
88
|
const prisma = getDbClient()
|
|
89
89
|
|
|
90
90
|
// Find app by slug
|
|
91
|
-
const app = await prisma.
|
|
91
|
+
const app = await prisma.dbResource.findUnique({
|
|
92
92
|
where: { slug: input.appSlug },
|
|
93
93
|
select: { screenshotIds: true },
|
|
94
94
|
})
|
|
@@ -176,7 +176,7 @@ async function syncScreenshotsFromDirectory(
|
|
|
176
176
|
for (const [appId, screenshots] of screenshotsByApp) {
|
|
177
177
|
try {
|
|
178
178
|
// Check if app exists
|
|
179
|
-
const app = await prisma.
|
|
179
|
+
const app = await prisma.dbResource.findUnique({
|
|
180
180
|
where: { slug: appId },
|
|
181
181
|
select: { id: true },
|
|
182
182
|
})
|
|
@@ -200,14 +200,14 @@ async function syncScreenshotsFromDirectory(
|
|
|
200
200
|
|
|
201
201
|
if (existing) {
|
|
202
202
|
// Link to app via screenshotIds array if not already linked
|
|
203
|
-
const existingApp = await prisma.
|
|
203
|
+
const existingApp = await prisma.dbResource.findUnique({
|
|
204
204
|
where: { slug: appId },
|
|
205
205
|
})
|
|
206
206
|
if (
|
|
207
207
|
existingApp &&
|
|
208
208
|
!existingApp.screenshotIds.includes(existing.id)
|
|
209
209
|
) {
|
|
210
|
-
await prisma.
|
|
210
|
+
await prisma.dbResource.update({
|
|
211
211
|
where: { slug: appId },
|
|
212
212
|
data: {
|
|
213
213
|
screenshotIds: [...existingApp.screenshotIds, existing.id],
|
|
@@ -245,7 +245,7 @@ async function syncScreenshotsFromDirectory(
|
|
|
245
245
|
})
|
|
246
246
|
|
|
247
247
|
// Link screenshot to app via screenshotIds array
|
|
248
|
-
await prisma.
|
|
248
|
+
await prisma.dbResource.update({
|
|
249
249
|
where: { slug: appId },
|
|
250
250
|
data: {
|
|
251
251
|
screenshotIds: {
|
|
@@ -44,7 +44,7 @@ export function createAppCatalogAITools(
|
|
|
44
44
|
inputSchema: getAppCardSchema,
|
|
45
45
|
execute: async ({ slug }: { slug: string }) => {
|
|
46
46
|
try {
|
|
47
|
-
const app = await prisma.
|
|
47
|
+
const app = await prisma.dbResource.findUnique({
|
|
48
48
|
where: { slug },
|
|
49
49
|
include: {
|
|
50
50
|
sourceRefs: true,
|
|
@@ -17,22 +17,22 @@ declare global {
|
|
|
17
17
|
// DbApprovalMethod.config - Type-specific configuration
|
|
18
18
|
type ApprovalMethodConfig = import('./types/index').ApprovalMethodConfig
|
|
19
19
|
|
|
20
|
-
//
|
|
21
|
-
type
|
|
20
|
+
// DbResource.accessRequest - Per-resource approval configuration
|
|
21
|
+
type AccessRequest = import('./types/index').AppAccessRequest
|
|
22
22
|
|
|
23
|
-
//
|
|
23
|
+
// DbResource.links - Array of links
|
|
24
24
|
interface AppLink {
|
|
25
25
|
displayName?: string
|
|
26
26
|
url: string
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
//
|
|
30
|
-
type
|
|
29
|
+
// Role used within accessRequest
|
|
30
|
+
type Role = import('./types/index').AppRole
|
|
31
31
|
|
|
32
|
-
//
|
|
33
|
-
type
|
|
32
|
+
// DbResource.tiers - Tier variants (prod/dev)
|
|
33
|
+
type TierVariant = import('./types/index').TierVariant
|
|
34
34
|
|
|
35
|
-
//
|
|
35
|
+
// DbResource.extra - Arbitrary extra data
|
|
36
36
|
type SubResourceExtra = Record<string, unknown>
|
|
37
37
|
}
|
|
38
38
|
}
|
package/src/server/controller.ts
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
updateApp as updateAppService,
|
|
4
4
|
} from '../modules/appCatalog/service'
|
|
5
5
|
import type { AppCatalogData } from '../types'
|
|
6
|
-
import type {
|
|
6
|
+
import type { Resource } from '../types/common/appCatalogTypes'
|
|
7
7
|
|
|
8
8
|
import type { BetterAuth } from '../modules/auth/auth'
|
|
9
9
|
import { createAuthRouter } from '../modules/auth/authRouter.js'
|
|
@@ -50,7 +50,7 @@ export function createTrpcRouter(
|
|
|
50
50
|
),
|
|
51
51
|
updateApp: publicProcedure
|
|
52
52
|
.input(updateAppInputSchema)
|
|
53
|
-
.mutation(async ({ input }): Promise<
|
|
53
|
+
.mutation(async ({ input }): Promise<Resource> => {
|
|
54
54
|
return updateAppService(input)
|
|
55
55
|
}),
|
|
56
56
|
}),
|
|
@@ -8,17 +8,16 @@
|
|
|
8
8
|
|
|
9
9
|
import type { AppAccessRequest, ApprovalMethod } from './approvalMethodTypes'
|
|
10
10
|
import type { Group, Person } from './personGroupTypes'
|
|
11
|
-
import type { SubResource } from './subResourceTypes'
|
|
12
11
|
|
|
13
12
|
// ============================================================================
|
|
14
|
-
//
|
|
13
|
+
// TIER VARIANT
|
|
15
14
|
// ============================================================================
|
|
16
15
|
|
|
17
16
|
/**
|
|
18
|
-
* A tier variant of
|
|
17
|
+
* A tier variant of a resource (e.g., prod/dev environments).
|
|
19
18
|
* Each tier can have its own URL and access process.
|
|
20
19
|
*/
|
|
21
|
-
export interface
|
|
20
|
+
export interface TierVariant {
|
|
22
21
|
tierSlug: string
|
|
23
22
|
displayName?: string
|
|
24
23
|
description?: string
|
|
@@ -41,11 +40,14 @@ export interface SourceReference {
|
|
|
41
40
|
}
|
|
42
41
|
|
|
43
42
|
/**
|
|
44
|
-
*
|
|
43
|
+
* Resource entry in the catalog (application or sub-resource).
|
|
44
|
+
* Unified model: applications have no parentSlug; sub-resources have parentSlug.
|
|
45
45
|
*/
|
|
46
|
-
export interface
|
|
46
|
+
export interface Resource {
|
|
47
47
|
id: string
|
|
48
48
|
slug: string
|
|
49
|
+
/** Discriminator: "application" for top-level apps, "sub-resource" for children, etc. */
|
|
50
|
+
type?: string
|
|
49
51
|
displayName: string
|
|
50
52
|
abbreviation?: string // Optional short abbreviation (e.g. K8s, ECR, LV)
|
|
51
53
|
nicknames?: string[] // Alternative names / AKA
|
|
@@ -72,7 +74,25 @@ export interface AppForCatalog {
|
|
|
72
74
|
/** URL health issues detected by automated scanning */
|
|
73
75
|
urlIssues?: string[]
|
|
74
76
|
/** Optional tier variants (e.g., prod/dev) with per-tier URLs and access */
|
|
75
|
-
tiers?:
|
|
77
|
+
tiers?: TierVariant[]
|
|
78
|
+
|
|
79
|
+
// --- Fields merged from former SubResource ---
|
|
80
|
+
/** Slug of parent resource (undefined for top-level applications) */
|
|
81
|
+
parentSlug?: string
|
|
82
|
+
/** Tier slug (e.g. "prod", "dev") — for sub-resources */
|
|
83
|
+
tier?: string
|
|
84
|
+
/** Groups tier variants visually */
|
|
85
|
+
familySlug?: string
|
|
86
|
+
/** Alternative identifiers */
|
|
87
|
+
aliases?: string[]
|
|
88
|
+
/** Person slug of the owner */
|
|
89
|
+
ownerPersonSlug?: string
|
|
90
|
+
/** Group slugs of access maintainers */
|
|
91
|
+
accessMaintainerGroupSlugs?: string[]
|
|
92
|
+
/** Free-text access comments */
|
|
93
|
+
accessComments?: string
|
|
94
|
+
/** Arbitrary extra data */
|
|
95
|
+
extra?: Record<string, unknown>
|
|
76
96
|
}
|
|
77
97
|
|
|
78
98
|
// Derived catalog data returned by backend
|
|
@@ -115,11 +135,10 @@ export interface AppVersionInfo {
|
|
|
115
135
|
}
|
|
116
136
|
|
|
117
137
|
export interface AppCatalogData {
|
|
118
|
-
|
|
138
|
+
resources: Resource[]
|
|
119
139
|
tagsDefinitions: GroupingTagDefinition[]
|
|
120
140
|
approvalMethods: AppApprovalMethod[]
|
|
121
141
|
persons: Person[]
|
|
122
142
|
groups: Group[]
|
|
123
|
-
subResources: SubResource[]
|
|
124
143
|
versions?: AppVersionInfo
|
|
125
144
|
}
|
|
@@ -151,3 +151,9 @@ export interface AppAccessRequest {
|
|
|
151
151
|
*/
|
|
152
152
|
urls?: ApprovalUrl[]
|
|
153
153
|
}
|
|
154
|
+
|
|
155
|
+
/** @deprecated Use AppAccessRequest instead (same type, new canonical name) */
|
|
156
|
+
export type AccessRequest = AppAccessRequest
|
|
157
|
+
|
|
158
|
+
/** @deprecated Use AppRole instead (same type, new canonical name) */
|
|
159
|
+
export type Role = AppRole
|
package/src/types/index.ts
CHANGED
|
@@ -4,7 +4,6 @@ export * from './common/resourceTypes.js'
|
|
|
4
4
|
export * from './common/appCatalogTypes.js'
|
|
5
5
|
export * from './common/approvalMethodTypes.js'
|
|
6
6
|
export * from './common/personGroupTypes.js'
|
|
7
|
-
export * from './common/subResourceTypes.js'
|
|
8
7
|
export * from './common/env/envTypes.js'
|
|
9
8
|
export * from './common/app/appTypes.js'
|
|
10
9
|
export * from './common/app/ui/appUiTypes.js'
|