@igstack/app-catalog-backend-core 0.1.1-alpha-20260304152616 → 0.3.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/index.d.ts +11318 -1052
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4930 -1466
- package/dist/index.js.map +1 -1
- package/package.json +10 -7
- package/prisma/schema.prisma +2 -2
- package/prisma.config.ts +13 -0
- package/src/db/client.ts +20 -2
- package/src/db/prisma.ts +3 -0
- package/src/db/syncAppCatalog.ts +1 -1
- package/src/db/tableSyncMagazine.ts +1 -1
- package/src/db/tableSyncPrismaAdapter.ts +2 -3
- package/src/generated/prisma/browser.ts +59 -0
- package/src/generated/prisma/client.ts +83 -0
- package/src/generated/prisma/commonInputTypes.ts +658 -0
- package/src/generated/prisma/enums.ts +26 -0
- package/src/generated/prisma/internal/class.ts +274 -0
- package/src/generated/prisma/internal/prismaNamespace.ts +1506 -0
- package/src/generated/prisma/internal/prismaNamespaceBrowser.ts +250 -0
- package/src/generated/prisma/models/DbAppForCatalog.ts +1490 -0
- package/src/generated/prisma/models/DbAppTagDefinition.ts +1199 -0
- package/src/generated/prisma/models/DbApprovalMethod.ts +1181 -0
- package/src/generated/prisma/models/DbAsset.ts +1394 -0
- package/src/generated/prisma/models/account.ts +1632 -0
- package/src/generated/prisma/models/session.ts +1447 -0
- package/src/generated/prisma/models/user.ts +1562 -0
- package/src/generated/prisma/models/verification.ts +1180 -0
- package/src/generated/prisma/models.ts +19 -0
- package/src/generated/prisma/pjtg.ts +183 -0
- package/src/index.ts +0 -27
- package/src/middleware/database.ts +13 -2
- package/src/middleware/featureRegistry.ts +0 -38
- package/src/modules/assets/upsertAsset.ts +1 -1
- package/src/server/controller.ts +0 -16
- package/src/modules/appCatalogAdmin/appCatalogAdminRouter.ts +0 -187
- package/src/modules/appCatalogAdmin/catalogBackupController.ts +0 -213
- package/src/modules/approvalMethod/approvalMethodRouter.ts +0 -169
- package/src/modules/approvalMethod/slugUtils.ts +0 -17
- package/src/modules/approvalMethod/syncApprovalMethods.ts +0 -38
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@igstack/app-catalog-backend-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Backend core library for App Catalog",
|
|
5
5
|
"homepage": "https://github.com/lislon/app-catalog",
|
|
6
6
|
"repository": {
|
|
@@ -27,11 +27,13 @@
|
|
|
27
27
|
"files": [
|
|
28
28
|
"dist",
|
|
29
29
|
"src",
|
|
30
|
-
"prisma"
|
|
30
|
+
"prisma",
|
|
31
|
+
"prisma.config.ts"
|
|
31
32
|
],
|
|
32
33
|
"dependencies": {
|
|
33
34
|
"@kubernetes/client-node": "^1.2.0",
|
|
34
|
-
"@prisma/
|
|
35
|
+
"@prisma/adapter-pg": "^7.4.2",
|
|
36
|
+
"@prisma/client": "^7.4.2",
|
|
35
37
|
"@trpc/client": "^11.4.2",
|
|
36
38
|
"@trpc/server": "^11.4.2",
|
|
37
39
|
"ai": "^6.0.37",
|
|
@@ -48,8 +50,8 @@
|
|
|
48
50
|
"tsyringe": "^4.10.0",
|
|
49
51
|
"yaml": "^2.8.0",
|
|
50
52
|
"zod": "^4.3.5",
|
|
51
|
-
"@igstack/app-catalog-
|
|
52
|
-
"@igstack/app-catalog-
|
|
53
|
+
"@igstack/app-catalog-table-sync": "0.3.0",
|
|
54
|
+
"@igstack/app-catalog-shared-core": "0.3.0"
|
|
53
55
|
},
|
|
54
56
|
"devDependencies": {
|
|
55
57
|
"@tanstack/vite-config": "^0.4.3",
|
|
@@ -59,9 +61,10 @@
|
|
|
59
61
|
"@types/jsonwebtoken": "^9.0.9",
|
|
60
62
|
"@types/multer": "^1.4.12",
|
|
61
63
|
"@types/node": "^24.3.0",
|
|
64
|
+
"@types/pg": "^8.18.0",
|
|
62
65
|
"esbuild": "^0.25.5",
|
|
63
|
-
"prisma": "^
|
|
64
|
-
"prisma-json-types-generator": "^
|
|
66
|
+
"prisma": "^7.4.2",
|
|
67
|
+
"prisma-json-types-generator": "^4.1.1",
|
|
65
68
|
"tsdown": "^0.15.12",
|
|
66
69
|
"tsx": "^4.19.4",
|
|
67
70
|
"typescript": "5.9.2",
|
package/prisma/schema.prisma
CHANGED
package/prisma.config.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { defineConfig } from 'prisma/config'
|
|
2
|
+
|
|
3
|
+
// Note: Environment variables should be loaded by the calling context
|
|
4
|
+
// (e.g., via dotenv-defaults in the application entry point)
|
|
5
|
+
// The Prisma CLI will use the AC_CORE_DATABASE_URL from the environment
|
|
6
|
+
// where it's executed (e.g., examples/backend-example/.env.defaults)
|
|
7
|
+
|
|
8
|
+
export default defineConfig({
|
|
9
|
+
schema: 'prisma/schema.prisma',
|
|
10
|
+
datasource: {
|
|
11
|
+
url: process.env.AC_CORE_DATABASE_URL ?? '',
|
|
12
|
+
},
|
|
13
|
+
})
|
package/src/db/client.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import { PrismaClient } from '
|
|
1
|
+
import { PrismaClient } from './prisma'
|
|
2
|
+
import { PrismaPg } from '@prisma/adapter-pg'
|
|
3
|
+
import pg from 'pg'
|
|
2
4
|
|
|
3
5
|
let prismaClient: PrismaClient | null = null
|
|
6
|
+
let pool: pg.Pool | null = null
|
|
4
7
|
|
|
5
8
|
/**
|
|
6
9
|
* Gets the internal Prisma client instance.
|
|
@@ -8,7 +11,18 @@ let prismaClient: PrismaClient | null = null
|
|
|
8
11
|
*/
|
|
9
12
|
export function getDbClient(): PrismaClient {
|
|
10
13
|
if (!prismaClient) {
|
|
11
|
-
|
|
14
|
+
const databaseUrl = process.env.AC_CORE_DATABASE_URL
|
|
15
|
+
if (!databaseUrl) {
|
|
16
|
+
throw new Error(
|
|
17
|
+
'AC_CORE_DATABASE_URL environment variable is required for PrismaClient initialization',
|
|
18
|
+
)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// Prisma 7 with adapter: Create pg pool and wrap with adapter
|
|
22
|
+
pool = new pg.Pool({ connectionString: databaseUrl })
|
|
23
|
+
const adapter = new PrismaPg(pool)
|
|
24
|
+
|
|
25
|
+
prismaClient = new PrismaClient({ adapter })
|
|
12
26
|
}
|
|
13
27
|
return prismaClient
|
|
14
28
|
}
|
|
@@ -39,4 +53,8 @@ export async function disconnectDb(): Promise<void> {
|
|
|
39
53
|
await prismaClient.$disconnect()
|
|
40
54
|
prismaClient = null
|
|
41
55
|
}
|
|
56
|
+
if (pool) {
|
|
57
|
+
await pool.end()
|
|
58
|
+
pool = null
|
|
59
|
+
}
|
|
42
60
|
}
|
package/src/db/prisma.ts
ADDED
package/src/db/syncAppCatalog.ts
CHANGED
|
@@ -9,7 +9,7 @@ import { readFile, readdir, stat } from 'node:fs/promises'
|
|
|
9
9
|
import { group } from 'radashi'
|
|
10
10
|
import { upsertAsset } from '../modules/assets/upsertAsset'
|
|
11
11
|
import type { ApprovalMethod } from '../types'
|
|
12
|
-
import type { PrismaClient } from '
|
|
12
|
+
import type { PrismaClient } from './prisma'
|
|
13
13
|
|
|
14
14
|
export interface SyncAppCatalogResult {
|
|
15
15
|
created: number
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { tableSync } from '@igstack/app-catalog-table-sync'
|
|
2
|
-
import type { Prisma, PrismaClient } from '
|
|
3
|
-
import type * as runtime from '@prisma/client/runtime/library'
|
|
2
|
+
import type { Prisma, PrismaClient } from './prisma'
|
|
4
3
|
import { mapValues, omit, pick } from 'radashi'
|
|
5
4
|
|
|
6
5
|
export type ScalarKeys<TPrismaModelName extends Prisma.ModelName> =
|
|
@@ -36,7 +35,7 @@ export interface TableSyncParamsPrisma<
|
|
|
36
35
|
}
|
|
37
36
|
|
|
38
37
|
function getPrismaModelOperations<
|
|
39
|
-
TPrismaClient
|
|
38
|
+
TPrismaClient,
|
|
40
39
|
TPrismaModelName extends Prisma.ModelName,
|
|
41
40
|
>(prisma: TPrismaClient, prismaModelName: TPrismaModelName) {
|
|
42
41
|
const key = (prismaModelName.slice(0, 1).toLowerCase() +
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
|
|
2
|
+
/* !!! This is code generated by Prisma. Do not edit directly. !!! */
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
// biome-ignore-all lint: generated file
|
|
5
|
+
// @ts-nocheck
|
|
6
|
+
/*
|
|
7
|
+
* This file should be your main import to use Prisma-related types and utilities in a browser.
|
|
8
|
+
* Use it to get access to models, enums, and input types.
|
|
9
|
+
*
|
|
10
|
+
* This file does not contain a `PrismaClient` class, nor several other helpers that are intended as server-side only.
|
|
11
|
+
* See `client.ts` for the standard, server-side entry point.
|
|
12
|
+
*
|
|
13
|
+
* 🟢 You can import this file directly.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
import * as Prisma from './internal/prismaNamespaceBrowser'
|
|
17
|
+
export { Prisma }
|
|
18
|
+
export * as $Enums from './enums'
|
|
19
|
+
export * from './enums';
|
|
20
|
+
/**
|
|
21
|
+
* Model user
|
|
22
|
+
*
|
|
23
|
+
*/
|
|
24
|
+
export type user = Prisma.userModel
|
|
25
|
+
/**
|
|
26
|
+
* Model session
|
|
27
|
+
*
|
|
28
|
+
*/
|
|
29
|
+
export type session = Prisma.sessionModel
|
|
30
|
+
/**
|
|
31
|
+
* Model account
|
|
32
|
+
*
|
|
33
|
+
*/
|
|
34
|
+
export type account = Prisma.accountModel
|
|
35
|
+
/**
|
|
36
|
+
* Model verification
|
|
37
|
+
*
|
|
38
|
+
*/
|
|
39
|
+
export type verification = Prisma.verificationModel
|
|
40
|
+
/**
|
|
41
|
+
* Model DbApprovalMethod
|
|
42
|
+
*
|
|
43
|
+
*/
|
|
44
|
+
export type DbApprovalMethod = Prisma.DbApprovalMethodModel
|
|
45
|
+
/**
|
|
46
|
+
* Model DbAppForCatalog
|
|
47
|
+
*
|
|
48
|
+
*/
|
|
49
|
+
export type DbAppForCatalog = Prisma.DbAppForCatalogModel
|
|
50
|
+
/**
|
|
51
|
+
* Model DbAppTagDefinition
|
|
52
|
+
*
|
|
53
|
+
*/
|
|
54
|
+
export type DbAppTagDefinition = Prisma.DbAppTagDefinitionModel
|
|
55
|
+
/**
|
|
56
|
+
* Model DbAsset
|
|
57
|
+
*
|
|
58
|
+
*/
|
|
59
|
+
export type DbAsset = Prisma.DbAssetModel
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
|
|
2
|
+
/* !!! This is code generated by Prisma. Do not edit directly. !!! */
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
// biome-ignore-all lint: generated file
|
|
5
|
+
// @ts-nocheck
|
|
6
|
+
/*
|
|
7
|
+
* This file should be your main import to use Prisma. Through it you get access to all the models, enums, and input types.
|
|
8
|
+
* If you're looking for something you can import in the client-side of your application, please refer to the `browser.ts` file instead.
|
|
9
|
+
*
|
|
10
|
+
* 🟢 You can import this file directly.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import * as process from 'node:process'
|
|
14
|
+
import * as path from 'node:path'
|
|
15
|
+
import { fileURLToPath } from 'node:url'
|
|
16
|
+
globalThis['__dirname'] = path.dirname(fileURLToPath(import.meta.url))
|
|
17
|
+
|
|
18
|
+
import * as runtime from "@prisma/client/runtime/client"
|
|
19
|
+
import * as $Enums from "./enums"
|
|
20
|
+
import * as $Class from "./internal/class"
|
|
21
|
+
import * as Prisma from "./internal/prismaNamespace"
|
|
22
|
+
|
|
23
|
+
export * as $Enums from './enums'
|
|
24
|
+
export * from "./enums"
|
|
25
|
+
/**
|
|
26
|
+
* ## Prisma Client
|
|
27
|
+
*
|
|
28
|
+
* Type-safe database client for TypeScript
|
|
29
|
+
* @example
|
|
30
|
+
* ```
|
|
31
|
+
* const prisma = new PrismaClient({
|
|
32
|
+
* adapter: new PrismaPg({ connectionString: process.env.DATABASE_URL })
|
|
33
|
+
* })
|
|
34
|
+
* // Fetch zero or more Users
|
|
35
|
+
* const users = await prisma.user.findMany()
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
38
|
+
* Read more in our [docs](https://pris.ly/d/client).
|
|
39
|
+
*/
|
|
40
|
+
export const PrismaClient = $Class.getPrismaClientClass()
|
|
41
|
+
export type PrismaClient<LogOpts extends Prisma.LogLevel = never, OmitOpts extends Prisma.PrismaClientOptions["omit"] = Prisma.PrismaClientOptions["omit"], ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = $Class.PrismaClient<LogOpts, OmitOpts, ExtArgs>
|
|
42
|
+
export { Prisma }
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Model user
|
|
46
|
+
*
|
|
47
|
+
*/
|
|
48
|
+
export type user = Prisma.userModel
|
|
49
|
+
/**
|
|
50
|
+
* Model session
|
|
51
|
+
*
|
|
52
|
+
*/
|
|
53
|
+
export type session = Prisma.sessionModel
|
|
54
|
+
/**
|
|
55
|
+
* Model account
|
|
56
|
+
*
|
|
57
|
+
*/
|
|
58
|
+
export type account = Prisma.accountModel
|
|
59
|
+
/**
|
|
60
|
+
* Model verification
|
|
61
|
+
*
|
|
62
|
+
*/
|
|
63
|
+
export type verification = Prisma.verificationModel
|
|
64
|
+
/**
|
|
65
|
+
* Model DbApprovalMethod
|
|
66
|
+
*
|
|
67
|
+
*/
|
|
68
|
+
export type DbApprovalMethod = Prisma.DbApprovalMethodModel
|
|
69
|
+
/**
|
|
70
|
+
* Model DbAppForCatalog
|
|
71
|
+
*
|
|
72
|
+
*/
|
|
73
|
+
export type DbAppForCatalog = Prisma.DbAppForCatalogModel
|
|
74
|
+
/**
|
|
75
|
+
* Model DbAppTagDefinition
|
|
76
|
+
*
|
|
77
|
+
*/
|
|
78
|
+
export type DbAppTagDefinition = Prisma.DbAppTagDefinitionModel
|
|
79
|
+
/**
|
|
80
|
+
* Model DbAsset
|
|
81
|
+
*
|
|
82
|
+
*/
|
|
83
|
+
export type DbAsset = Prisma.DbAssetModel
|