arkos 1.4.9-beta → 1.4.10-beta
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/cjs/app.js +14 -14
- package/dist/cjs/components/arkos-policy/index.js +38 -0
- package/dist/cjs/components/arkos-policy/index.js.map +1 -0
- package/dist/cjs/{types/arkos-prisma-input.bak.js → components/arkos-policy/types.js} +1 -1
- package/dist/cjs/components/arkos-policy/types.js.map +1 -0
- package/dist/cjs/exports/auth/index.js +1 -1
- package/dist/cjs/exports/config.js +6 -0
- package/dist/cjs/exports/config.js.map +1 -0
- package/dist/cjs/exports/controllers/index.js +2 -2
- package/dist/cjs/exports/error-handler/index.js +2 -2
- package/dist/cjs/exports/index.js +4 -4
- package/dist/cjs/exports/middlewares/index.js +1 -1
- package/dist/cjs/exports/prisma/index.js +1 -1
- package/dist/cjs/exports/services/index.js +5 -5
- package/dist/cjs/exports/utils/index.js +2 -2
- package/dist/cjs/exports/validation/index.js +2 -2
- package/dist/cjs/modules/auth/auth.controller.js +7 -7
- package/dist/cjs/modules/auth/auth.router.js +10 -10
- package/dist/cjs/modules/auth/auth.service.js +12 -12
- package/dist/cjs/modules/auth/utils/auth-error-objects.js +1 -1
- package/dist/cjs/modules/auth/utils/helpers/auth.controller.helpers.js +2 -2
- package/dist/cjs/modules/auth/utils/services/auth-action.service.js +3 -3
- package/dist/cjs/modules/base/base.controller.js +9 -9
- package/dist/cjs/modules/base/base.middlewares.js +9 -9
- package/dist/cjs/modules/base/base.router.js +4 -4
- package/dist/cjs/modules/base/base.service.js +8 -8
- package/dist/cjs/modules/base/utils/error-prettifier.js +1 -1
- package/dist/cjs/modules/base/utils/helpers/base.controller.helpers.js +1 -1
- package/dist/cjs/modules/base/utils/helpers/base.middlewares.helpers.js +1 -1
- package/dist/cjs/modules/base/utils/helpers/base.router.helpers.js +9 -9
- package/dist/cjs/modules/base/utils/helpers/base.service.helpers.js +2 -2
- package/dist/cjs/modules/debugger/debugger.service.js +4 -4
- package/dist/cjs/modules/debugger/utils/loaded-components-logger.js +2 -2
- package/dist/cjs/modules/email/email.service.js +2 -2
- package/dist/cjs/modules/error-handler/error-handler.controller.js +2 -2
- package/dist/cjs/modules/error-handler/utils/error-handler.helpers.js +1 -1
- package/dist/cjs/modules/file-upload/file-upload.controller.js +9 -9
- package/dist/cjs/modules/file-upload/file-upload.controller.js.map +1 -1
- package/dist/cjs/modules/file-upload/file-upload.router.js +22 -22
- package/dist/cjs/modules/file-upload/file-upload.router.js.map +1 -1
- package/dist/cjs/modules/file-upload/file-upload.service.js +6 -6
- package/dist/cjs/modules/file-upload/utils/helpers/file-upload.helpers.js +3 -3
- package/dist/cjs/modules/swagger/swagger.router.js +8 -8
- package/dist/cjs/modules/swagger/utils/get-open-api-login-html.js +276 -0
- package/dist/cjs/modules/swagger/utils/get-open-api-login-html.js.map +1 -0
- package/dist/cjs/modules/swagger/utils/helpers/get-authentication-json-schema-paths.js +3 -3
- package/dist/cjs/modules/swagger/utils/helpers/get-file-upload-json-schema-paths.js +4 -4
- package/dist/cjs/modules/swagger/utils/helpers/get-swagger-default-configs.js +1 -1
- package/dist/cjs/modules/swagger/utils/helpers/json-schema-generators/generate-class-validator-json-schemas.js +4 -4
- package/dist/cjs/modules/swagger/utils/helpers/json-schema-generators/generate-prisma-json-schemas.js +2 -2
- package/dist/cjs/modules/swagger/utils/helpers/json-schema-generators/generate-zod-json-schemas.js +3 -3
- package/dist/cjs/modules/swagger/utils/helpers/json-schema-generators/prisma-models/generate-prisma-model-main-routes-paths.js +5 -5
- package/dist/cjs/modules/swagger/utils/helpers/json-schema-generators/prisma-models/generate-prisma-model-parent-routes-paths.js +3 -3
- package/dist/cjs/modules/swagger/utils/helpers/missing-json-schemas-generator.js +2 -2
- package/dist/cjs/modules/swagger/utils/helpers/openapi-schema-converter.js +3 -3
- package/dist/cjs/modules/swagger/utils/helpers/swagger.router.helpers.js +12 -12
- package/dist/cjs/server.js +5 -5
- package/dist/cjs/types/arkos-config/utils.js +3 -0
- package/dist/cjs/types/arkos-config/utils.js.map +1 -0
- package/dist/cjs/types/arkos.js +3 -0
- package/dist/cjs/types/arkos.js.map +1 -0
- package/dist/cjs/types/index.js.map +1 -1
- package/dist/cjs/utils/arkos-router/arkos-router-openapi-manager.js +1 -1
- package/dist/cjs/utils/arkos-router/index.js +9 -9
- package/dist/cjs/utils/arkos-router/index.js.map +1 -1
- package/dist/cjs/utils/arkos-router/route-config-validator.js +2 -2
- package/dist/cjs/utils/arkos-router/types/index.js.map +1 -1
- package/dist/cjs/utils/arkos-router/utils/helpers/apply-arkos-router-proxy.js +152 -0
- package/dist/cjs/utils/arkos-router/utils/helpers/apply-arkos-router-proxy.js.map +1 -0
- package/dist/cjs/utils/arkos-router/utils/helpers/index.js +6 -6
- package/dist/cjs/utils/arkos-router/utils/helpers/upload-manager.js +8 -8
- package/dist/cjs/utils/bundler.js +163 -0
- package/dist/cjs/utils/bundler.js.map +1 -0
- package/dist/cjs/utils/cli/build.js +21 -33
- package/dist/cjs/utils/cli/build.js.map +1 -1
- package/dist/cjs/utils/cli/dev.js +6 -5
- package/dist/cjs/utils/cli/dev.js.map +1 -1
- package/dist/cjs/utils/cli/export-auth-action.js +4 -3
- package/dist/cjs/utils/cli/export-auth-action.js.map +1 -1
- package/dist/cjs/utils/cli/generate.js +8 -8
- package/dist/cjs/utils/cli/index.js +7 -7
- package/dist/cjs/utils/cli/prisma-generate.js +3 -3
- package/dist/cjs/utils/cli/remove-dir-cli.js +1 -1
- package/dist/cjs/utils/cli/start.js +5 -5
- package/dist/cjs/utils/cli/start.js.map +1 -1
- package/dist/cjs/utils/cli/utils/cli.helpers.js +3 -3
- package/dist/cjs/utils/cli/utils/runtime-cli-commander.js +5 -5
- package/dist/cjs/utils/cli/utils/template-generator/templates/auth-configs-template.js +2 -2
- package/dist/cjs/utils/cli/utils/template-generator/templates/class-validator/create-dto-template.js +2 -2
- package/dist/cjs/utils/cli/utils/template-generator/templates/class-validator/update-dto-template.js +2 -2
- package/dist/cjs/utils/cli/utils/template-generator/templates/class-validator-dto-generator.js +2 -2
- package/dist/cjs/utils/cli/utils/template-generator/templates/generate-multiple-components.js +3 -3
- package/dist/cjs/utils/cli/utils/template-generator/templates/hooks-template.js +1 -1
- package/dist/cjs/utils/cli/utils/template-generator/templates/policy-template.js +53 -0
- package/dist/cjs/utils/cli/utils/template-generator/templates/policy-template.js.map +1 -0
- package/dist/cjs/utils/cli/utils/template-generator/templates/query-options-template.js +1 -1
- package/dist/cjs/utils/cli/utils/template-generator/templates/router-template.js +1 -1
- package/dist/cjs/utils/cli/utils/template-generator/templates/service-template.js +1 -1
- package/dist/cjs/utils/cli/utils/template-generator/templates/zod/create-schema-template.js +2 -2
- package/dist/cjs/utils/cli/utils/template-generator/templates/zod/update-schema-template.js +2 -2
- package/dist/cjs/utils/cli/utils/template-generator/templates/zod-schema-generator.js +2 -2
- package/dist/cjs/utils/cli/utils/template-generators.js +11 -11
- package/dist/cjs/utils/cli/utils/watermark-stamper.js +3 -3
- package/dist/cjs/utils/dotenv.helpers.js +2 -2
- package/dist/cjs/utils/dynamic-loader.js +8 -8
- package/dist/cjs/utils/features/api.features.js +5 -5
- package/dist/cjs/utils/features/change-case.features.js +1 -1
- package/dist/cjs/utils/features/port-and-host-allocator.js +1 -1
- package/dist/cjs/utils/helpers/api.features.helpers.js +2 -2
- package/dist/cjs/utils/helpers/arkos-config.helpers.js +3 -3
- package/dist/cjs/utils/helpers/exit-error.js +12 -0
- package/dist/cjs/utils/helpers/exit-error.js.map +1 -0
- package/dist/cjs/utils/helpers/fs.helpers.js +1 -1
- package/dist/cjs/utils/helpers/fs.helpers.js.map +1 -1
- package/dist/cjs/utils/helpers/prisma.helpers.js +6 -6
- package/dist/cjs/utils/helpers/query-parser.helpers.js +1 -1
- package/dist/cjs/utils/helpers/routers.helpers.js +4 -4
- package/dist/cjs/utils/helpers/routers.helpers.js.map +1 -1
- package/dist/cjs/utils/initialize-app.js +56 -0
- package/dist/cjs/utils/initialize-app.js.map +1 -0
- package/dist/cjs/utils/prisma/prisma-json-schema-generator.js +4 -4
- package/dist/cjs/utils/prisma/prisma-schema-parser.js +2 -2
- package/dist/cjs/utils/setup-app.js +119 -0
- package/dist/cjs/utils/setup-app.js.map +1 -0
- package/dist/esm/components/arkos-policy/index.js +32 -0
- package/dist/esm/components/arkos-policy/index.js.map +1 -0
- package/dist/esm/components/arkos-policy/types.js +2 -0
- package/dist/esm/components/arkos-policy/types.js.map +1 -0
- package/dist/esm/exports/config.js +3 -0
- package/dist/esm/exports/config.js.map +1 -0
- package/dist/esm/modules/file-upload/file-upload.controller.js +2 -2
- package/dist/esm/modules/file-upload/file-upload.controller.js.map +1 -1
- package/dist/esm/modules/file-upload/file-upload.router.js +12 -12
- package/dist/esm/modules/file-upload/file-upload.router.js.map +1 -1
- package/dist/esm/modules/swagger/utils/get-open-api-login-html.js +273 -0
- package/dist/esm/modules/swagger/utils/get-open-api-login-html.js.map +1 -0
- package/dist/esm/types/arkos-config/utils.js +2 -0
- package/dist/esm/types/arkos-config/utils.js.map +1 -0
- package/dist/esm/types/arkos.js +2 -0
- package/dist/esm/types/arkos.js.map +1 -0
- package/dist/esm/types/index.js.map +1 -1
- package/dist/esm/utils/arkos-router/index.js.map +1 -1
- package/dist/esm/utils/arkos-router/types/index.js.map +1 -1
- package/dist/esm/utils/arkos-router/utils/helpers/apply-arkos-router-proxy.js +146 -0
- package/dist/esm/utils/arkos-router/utils/helpers/apply-arkos-router-proxy.js.map +1 -0
- package/dist/esm/utils/bundler.js +156 -0
- package/dist/esm/utils/bundler.js.map +1 -0
- package/dist/esm/utils/cli/build.js +15 -27
- package/dist/esm/utils/cli/build.js.map +1 -1
- package/dist/esm/utils/cli/dev.js +1 -0
- package/dist/esm/utils/cli/dev.js.map +1 -1
- package/dist/esm/utils/cli/export-auth-action.js +1 -0
- package/dist/esm/utils/cli/export-auth-action.js.map +1 -1
- package/dist/esm/utils/cli/start.js +1 -1
- package/dist/esm/utils/cli/start.js.map +1 -1
- package/dist/esm/utils/cli/utils/cli.helpers.js +1 -1
- package/dist/esm/utils/cli/utils/template-generator/templates/policy-template.js +47 -0
- package/dist/esm/utils/cli/utils/template-generator/templates/policy-template.js.map +1 -0
- package/dist/esm/utils/helpers/exit-error.js +6 -0
- package/dist/esm/utils/helpers/exit-error.js.map +1 -0
- package/dist/esm/utils/helpers/fs.helpers.js +1 -1
- package/dist/esm/utils/helpers/fs.helpers.js.map +1 -1
- package/dist/esm/utils/helpers/routers.helpers.js.map +1 -1
- package/dist/esm/utils/initialize-app.js +50 -0
- package/dist/esm/utils/initialize-app.js.map +1 -0
- package/dist/esm/utils/setup-app.js +113 -0
- package/dist/esm/utils/setup-app.js.map +1 -0
- package/dist/types/components/arkos-policy/index.d.ts +31 -0
- package/dist/types/components/arkos-policy/types.d.ts +21 -0
- package/dist/types/exports/config.d.ts +2 -0
- package/dist/types/modules/file-upload/file-upload.router.d.ts +1 -2
- package/dist/types/modules/swagger/utils/get-open-api-login-html.d.ts +1 -0
- package/dist/types/types/arkos-config/utils.d.ts +35 -0
- package/dist/types/types/arkos.d.ts +31 -0
- package/dist/types/types/index.d.ts +3 -5
- package/dist/types/utils/arkos-router/types/index.d.ts +20 -11
- package/dist/types/utils/arkos-router/utils/helpers/apply-arkos-router-proxy.d.ts +7 -0
- package/dist/types/utils/bundler.d.ts +152 -0
- package/dist/types/utils/cli/utils/template-generator/templates/policy-template.d.ts +2 -0
- package/dist/types/utils/helpers/exit-error.d.ts +1 -0
- package/dist/types/utils/helpers/routers.helpers.d.ts +3 -3
- package/dist/types/utils/initialize-app.d.ts +2 -0
- package/dist/types/utils/setup-app.d.ts +2 -0
- package/package.json +1 -1
- package/dist/cjs/types/arkos-prisma-input.bak.js.map +0 -1
- package/dist/cjs/utils/cli/utils/static-types-generator.js +0 -558
- package/dist/cjs/utils/cli/utils/static-types-generator.js.map +0 -1
- package/dist/esm/types/arkos-prisma-input.bak.js +0 -2
- package/dist/esm/types/arkos-prisma-input.bak.js.map +0 -1
- package/dist/esm/utils/cli/utils/static-types-generator.js +0 -553
- package/dist/esm/utils/cli/utils/static-types-generator.js.map +0 -1
- package/dist/types/types/arkos-prisma-input.bak.d.ts +0 -237
- package/dist/types/utils/cli/utils/static-types-generator.d.ts +0 -36
|
@@ -1,553 +0,0 @@
|
|
|
1
|
-
import fs from "fs/promises";
|
|
2
|
-
import { execSync } from "child_process";
|
|
3
|
-
import path from "path";
|
|
4
|
-
import sheu from "../../sheu.js";
|
|
5
|
-
import { kebabCase } from "../../helpers/change-case.helpers.js";
|
|
6
|
-
import prismaSchemaParser from "../../prisma/prisma-schema-parser.js";
|
|
7
|
-
class StaticTypesGenerator {
|
|
8
|
-
constructor() {
|
|
9
|
-
this.packageName = "@arkosjs/types";
|
|
10
|
-
this.outputDir = path.resolve(process.cwd(), `node_modules/${this.packageName}`);
|
|
11
|
-
}
|
|
12
|
-
async generate() {
|
|
13
|
-
try {
|
|
14
|
-
await this.generatePrismaClient();
|
|
15
|
-
await this.ensureOutputDirectory();
|
|
16
|
-
await this.generateTypeDeclarations();
|
|
17
|
-
await this.generatePackageJson();
|
|
18
|
-
sheu.done("Types for @prisma/client and base service generated successfully!");
|
|
19
|
-
}
|
|
20
|
-
catch (error) {
|
|
21
|
-
sheu.error("Failed to generate static types:");
|
|
22
|
-
console.log(error);
|
|
23
|
-
throw error;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
async generatePrismaClient() {
|
|
27
|
-
return new Promise((resolve, reject) => {
|
|
28
|
-
try {
|
|
29
|
-
execSync("npx prisma generate", { stdio: "inherit" });
|
|
30
|
-
resolve();
|
|
31
|
-
}
|
|
32
|
-
catch (error) {
|
|
33
|
-
reject(new Error(`Prisma generation failed: ${error}`));
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
async ensureOutputDirectory() {
|
|
38
|
-
await fs.mkdir(this.outputDir, { recursive: true });
|
|
39
|
-
}
|
|
40
|
-
generateDeclarationContent() {
|
|
41
|
-
return `import { ServiceBaseContext } from "arkos/services";
|
|
42
|
-
import { Prisma, PrismaClient } from "@prisma/client"
|
|
43
|
-
|
|
44
|
-
export interface PrismaField {
|
|
45
|
-
name: string;
|
|
46
|
-
type: string;
|
|
47
|
-
isOptional: boolean;
|
|
48
|
-
isArray: boolean;
|
|
49
|
-
foreignKeyField?: string;
|
|
50
|
-
foreignReferenceField?: string;
|
|
51
|
-
isRelation: boolean;
|
|
52
|
-
defaultValue?: any;
|
|
53
|
-
isId?: boolean;
|
|
54
|
-
isUnique?: boolean;
|
|
55
|
-
attributes: string[];
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
export declare type ModelsGetPayload<T extends Record<string, any>> = {
|
|
60
|
-
${prismaSchemaParser.models
|
|
61
|
-
.map((model) => ` "${kebabCase(model.name)}": {
|
|
62
|
-
Delegate: Prisma.${model.name}Delegate,
|
|
63
|
-
GetPayload: Prisma.${model.name}GetPayload<T>,
|
|
64
|
-
FindManyArgs: Prisma.${model.name}FindManyArgs,
|
|
65
|
-
FindFirstArgs: Prisma.${model.name}FindFirstArgs,
|
|
66
|
-
CreateArgs: Prisma.${model.name}CreateArgs,
|
|
67
|
-
CreateManyArgs: Prisma.${model.name}CreateManyArgs,
|
|
68
|
-
UpdateArgs: Prisma.${model.name}UpdateArgs,
|
|
69
|
-
UpdateManyArgs: Prisma.${model.name}UpdateManyArgs,
|
|
70
|
-
DeleteArgs: Prisma.${model.name}DeleteArgs,
|
|
71
|
-
DeleteManyArgs: Prisma.${model.name}DeleteManyArgs,
|
|
72
|
-
CountArgs: Prisma.${model.name}CountArgs
|
|
73
|
-
}`)
|
|
74
|
-
.join(",\n")}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
export type ExtractFilters<T> = T extends { where?: infer W; [x: string]: any } ? W : any;
|
|
78
|
-
export type ExtractQueryOptions<T, K extends keyof T = never> = Omit<T, K>;
|
|
79
|
-
export type ExtractData<T> = T extends { data: infer D; [x: string]: any } ? D : any;
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* Base service class for handling CRUD operations on a specific model.
|
|
84
|
-
* This class provides standard implementation of data operations that can be extended
|
|
85
|
-
*
|
|
86
|
-
* by model-specific service classes.
|
|
87
|
-
*
|
|
88
|
-
* @class BaseService
|
|
89
|
-
*
|
|
90
|
-
* @usage
|
|
91
|
-
*
|
|
92
|
-
* **Example:** creating a simple service
|
|
93
|
-
*
|
|
94
|
-
* \`\`\`ts
|
|
95
|
-
* import { BaseService } from "arkos/services"
|
|
96
|
-
*
|
|
97
|
-
* export class UserService extends BaseService<"user"> {}
|
|
98
|
-
*
|
|
99
|
-
* const userService = new UserService("user")
|
|
100
|
-
* \`\`\`
|
|
101
|
-
*
|
|
102
|
-
* **Example:** accessing request context in hooks
|
|
103
|
-
*
|
|
104
|
-
* \`\`\`
|
|
105
|
-
*
|
|
106
|
-
* @see {@link https://www.arkosjs.com/docs/api-reference/the-base-service-class}
|
|
107
|
-
* @see {@link https://www.arkosjs.com/docs/guide/accessing-request-context-in-services}
|
|
108
|
-
*
|
|
109
|
-
*/
|
|
110
|
-
export declare class BaseService<
|
|
111
|
-
TModelName extends keyof ModelsGetPayload<any>
|
|
112
|
-
> {
|
|
113
|
-
modelName: TModelName;
|
|
114
|
-
relationFields: {
|
|
115
|
-
singular: PrismaField[] | undefined;
|
|
116
|
-
list: PrismaField[] | undefined;
|
|
117
|
-
};
|
|
118
|
-
prisma: PrismaClient;
|
|
119
|
-
|
|
120
|
-
constructor(modelName: TModelName);
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* Creates a single record in the database.
|
|
124
|
-
*
|
|
125
|
-
* @template TOptions - The query options type extending query options excluding 'data'
|
|
126
|
-
* @param {ExtractData} data - The data for creating the record
|
|
127
|
-
* @param {TOptions} [queryOptions] - Optional Prisma query options (select, include, etc.)
|
|
128
|
-
* @param {ServiceBaseContext} [context] - Optional service execution context
|
|
129
|
-
* @returns {Promise<ModelsGetPayload>} The created record
|
|
130
|
-
*
|
|
131
|
-
* @example
|
|
132
|
-
* \`\`\`ts
|
|
133
|
-
* const user = await userService.createOne({
|
|
134
|
-
* name: "John Doe",
|
|
135
|
-
* email: "john@example.com"
|
|
136
|
-
* });
|
|
137
|
-
* \`\`\`
|
|
138
|
-
*
|
|
139
|
-
* @example
|
|
140
|
-
* \`\`\`ts
|
|
141
|
-
* // With query options
|
|
142
|
-
* const user = await userService.createOne(
|
|
143
|
-
* { name: "John Doe", email: "john@example.com" },
|
|
144
|
-
* { include: { posts: true } }
|
|
145
|
-
* );
|
|
146
|
-
* \`\`\`
|
|
147
|
-
*/
|
|
148
|
-
createOne<TOptions extends ExtractQueryOptions<ModelsGetPayload<any>[TModelName]['CreateArgs'], 'data'>>(
|
|
149
|
-
data: ExtractData<ModelsGetPayload<any>[TModelName]['CreateArgs']>,
|
|
150
|
-
queryOptions?: TOptions,
|
|
151
|
-
context?: ServiceBaseContext
|
|
152
|
-
): Promise<ModelsGetPayload<TOptions>[TModelName]['GetPayload']>;
|
|
153
|
-
|
|
154
|
-
/**
|
|
155
|
-
* Creates multiple records in the database.
|
|
156
|
-
*
|
|
157
|
-
* @template TOptions - The query options type extending query options excluding 'data'
|
|
158
|
-
* @param {ExtractData} data - Array of data objects or object with data array
|
|
159
|
-
* @param {TOptions} [queryOptions] - Optional Prisma query options
|
|
160
|
-
* @param {ServiceBaseContext} [context] - Optional service execution context
|
|
161
|
-
* @returns {Promise<Array>} Array of created records
|
|
162
|
-
*
|
|
163
|
-
* @example
|
|
164
|
-
* \`\`\`ts
|
|
165
|
-
* const users = await userService.createMany([
|
|
166
|
-
* { name: "John Doe", email: "john@example.com" },
|
|
167
|
-
* { name: "Jane Smith", email: "jane@example.com" }
|
|
168
|
-
* ]);
|
|
169
|
-
* \`\`\`
|
|
170
|
-
*/
|
|
171
|
-
createMany<TOptions extends ExtractQueryOptions<ModelsGetPayload<any>[TModelName]['CreateManyArgs'], 'data'>>(
|
|
172
|
-
data: ExtractData<ModelsGetPayload<any>[TModelName]['CreateManyArgs']>,
|
|
173
|
-
queryOptions?: TOptions,
|
|
174
|
-
context?: ServiceBaseContext
|
|
175
|
-
): Promise<ModelsGetPayload<TOptions>[TModelName]['GetPayload'][]>;
|
|
176
|
-
|
|
177
|
-
/**
|
|
178
|
-
* Counts records matching the specified filters.
|
|
179
|
-
*
|
|
180
|
-
* @template TOptions - The query options type extending query options excluding 'where'
|
|
181
|
-
* @param {ExtractFilters} [filters] - Optional where conditions to filter records
|
|
182
|
-
* @param {TOptions} [queryOptions] - Optional Prisma query options
|
|
183
|
-
* @param {ServiceBaseContext} [context] - Optional service execution context
|
|
184
|
-
* @returns {Promise<number>} The count of matching records
|
|
185
|
-
*
|
|
186
|
-
* @example
|
|
187
|
-
* \`\`\`ts
|
|
188
|
-
* const totalUsers = await userService.count();
|
|
189
|
-
* \`\`\`
|
|
190
|
-
*
|
|
191
|
-
* @example
|
|
192
|
-
* \`\`\`ts
|
|
193
|
-
* const activeUsers = await userService.count({
|
|
194
|
-
* status: "active"
|
|
195
|
-
* });
|
|
196
|
-
* \`\`\`
|
|
197
|
-
*/
|
|
198
|
-
count<TOptions extends ExtractQueryOptions<ModelsGetPayload<any>[TModelName]['CountArgs'], 'where'>>(
|
|
199
|
-
filters?: ExtractFilters<ModelsGetPayload<any>[TModelName]['CountArgs']>,
|
|
200
|
-
queryOptions?: TOptions,
|
|
201
|
-
context?: ServiceBaseContext
|
|
202
|
-
): Promise<number>;
|
|
203
|
-
|
|
204
|
-
/**
|
|
205
|
-
* Finds multiple records matching the specified filters.
|
|
206
|
-
*
|
|
207
|
-
* @template TOptions - The query options type extending query options excluding 'where'
|
|
208
|
-
* @param {ExtractFilters} [filters] - Optional where conditions to filter records
|
|
209
|
-
* @param {TOptions} [queryOptions] - Optional Prisma query options (select, include, orderBy, skip, take, etc.)
|
|
210
|
-
* @param {ServiceBaseContext} [context] - Optional service execution context
|
|
211
|
-
* @returns {Promise<Array>} Array of matching records
|
|
212
|
-
*
|
|
213
|
-
* @example
|
|
214
|
-
* \`\`\`ts
|
|
215
|
-
* const users = await userService.findMany({
|
|
216
|
-
* status: "active"
|
|
217
|
-
* });
|
|
218
|
-
* \`\`\`
|
|
219
|
-
*
|
|
220
|
-
* @example
|
|
221
|
-
* \`\`\`ts
|
|
222
|
-
* // With pagination and ordering
|
|
223
|
-
* const users = await userService.findMany(
|
|
224
|
-
* { status: "active" },
|
|
225
|
-
* { orderBy: { createdAt: "desc" }, take: 10, skip: 0 }
|
|
226
|
-
* );
|
|
227
|
-
* \`\`\`
|
|
228
|
-
*/
|
|
229
|
-
findMany<TOptions extends ExtractQueryOptions<ModelsGetPayload<any>[TModelName]['FindManyArgs'], 'where'>>(
|
|
230
|
-
filters?: ExtractFilters<ModelsGetPayload<any>[TModelName]['FindManyArgs']>,
|
|
231
|
-
queryOptions?: TOptions,
|
|
232
|
-
context?: ServiceBaseContext
|
|
233
|
-
): Promise<ModelsGetPayload<TOptions>[TModelName]['GetPayload'][]>;
|
|
234
|
-
|
|
235
|
-
/**
|
|
236
|
-
* Finds a single record by its ID.
|
|
237
|
-
*
|
|
238
|
-
* @template TOptions - The query options type extending query options excluding 'where'
|
|
239
|
-
* @param {string | number} id - The unique identifier of the record
|
|
240
|
-
* @param {TOptions} [queryOptions] - Optional Prisma query options (select, include, etc.)
|
|
241
|
-
* @param {ServiceBaseContext} [context] - Optional service execution context
|
|
242
|
-
* @returns {Promise<ModelsGetPayload | null>} The matching record or null if not found
|
|
243
|
-
*
|
|
244
|
-
* @example
|
|
245
|
-
* \`\`\`ts
|
|
246
|
-
* const user = await userService.findById("user-123");
|
|
247
|
-
* \`\`\`
|
|
248
|
-
*
|
|
249
|
-
* @example
|
|
250
|
-
* \`\`\`ts
|
|
251
|
-
* // With relations
|
|
252
|
-
* const user = await userService.findById(
|
|
253
|
-
* "user-123",
|
|
254
|
-
* { include: { posts: true, profile: true } }
|
|
255
|
-
* );
|
|
256
|
-
* \`\`\`
|
|
257
|
-
*/
|
|
258
|
-
findById<TOptions extends ExtractQueryOptions<ModelsGetPayload<any>[TModelName]['FindFirstArgs'], 'where'>>(
|
|
259
|
-
id: string | number,
|
|
260
|
-
queryOptions?: TOptions,
|
|
261
|
-
context?: ServiceBaseContext
|
|
262
|
-
): Promise<ModelsGetPayload<TOptions>[TModelName]['GetPayload'] | null>;
|
|
263
|
-
|
|
264
|
-
/**
|
|
265
|
-
* Updates a single record matching the specified id.
|
|
266
|
-
*
|
|
267
|
-
* @template TOptions - The query options type extending query options excluding 'where' and 'data'
|
|
268
|
-
* @param {string | number} id - The unique identifier of the record
|
|
269
|
-
* @param {ExtractData} data - The data to update
|
|
270
|
-
* @param {TOptions} [queryOptions] - Optional Prisma query options (select, include, etc.)
|
|
271
|
-
* @param {ServiceBaseContext} [context] - Optional service execution context
|
|
272
|
-
* @returns {Promise<ModelsGetPayload>} The updated record
|
|
273
|
-
*
|
|
274
|
-
* @example
|
|
275
|
-
* \`\`\`ts
|
|
276
|
-
* const updatedUser = await userService.updateById(
|
|
277
|
-
* "user-123",
|
|
278
|
-
* { name: "John Updated" }
|
|
279
|
-
* );
|
|
280
|
-
* \`\`\`
|
|
281
|
-
*
|
|
282
|
-
* @example
|
|
283
|
-
* \`\`\`ts
|
|
284
|
-
* // With relations
|
|
285
|
-
* const updatedUser = await userService.updateById(
|
|
286
|
-
* "user-123",
|
|
287
|
-
* { name: "John Updated" },
|
|
288
|
-
* { include: { posts: true } }
|
|
289
|
-
* );
|
|
290
|
-
* \`\`\`
|
|
291
|
-
*/
|
|
292
|
-
updateById<TOptions extends ExtractQueryOptions<ModelsGetPayload<any>[TModelName]['UpdateArgs'], 'where' | 'data'>>(
|
|
293
|
-
id: string | number,
|
|
294
|
-
data: ExtractData<ModelsGetPayload<any>[TModelName]['UpdateArgs']>,
|
|
295
|
-
queryOptions?: TOptions,
|
|
296
|
-
context?: ServiceBaseContext
|
|
297
|
-
): Promise<ModelsGetPayload<TOptions>[TModelName]['GetPayload']>;
|
|
298
|
-
|
|
299
|
-
/**
|
|
300
|
-
* Deletes a single record matching the specified id.
|
|
301
|
-
*
|
|
302
|
-
* @param {string | number} id - The unique identifier of the record
|
|
303
|
-
* @param {ServiceBaseContext} [context] - Optional service execution context
|
|
304
|
-
* @returns {Promise<ModelsGetPayload>} The deleted record
|
|
305
|
-
*
|
|
306
|
-
* @example
|
|
307
|
-
* \`\`\`ts
|
|
308
|
-
* const deletedUser = await userService.deleteById("user-123");
|
|
309
|
-
* \`\`\`
|
|
310
|
-
*/
|
|
311
|
-
deleteById(
|
|
312
|
-
id: string | number,
|
|
313
|
-
context?: ServiceBaseContext
|
|
314
|
-
): Promise<ModelsGetPayload<any>[TModelName]['GetPayload']>;
|
|
315
|
-
|
|
316
|
-
/**
|
|
317
|
-
* Finds the first record matching the specified filters.
|
|
318
|
-
*
|
|
319
|
-
* @template TOptions - The query options type extending query options excluding 'where'
|
|
320
|
-
* @param {ExtractFilters} filters - Where conditions to filter records
|
|
321
|
-
* @param {TOptions} [queryOptions] - Optional Prisma query options (select, include, orderBy, etc.)
|
|
322
|
-
* @param {ServiceBaseContext} [context] - Optional service execution context
|
|
323
|
-
* @returns {Promise<ModelsGetPayload | null>} The first matching record or null if not found
|
|
324
|
-
*
|
|
325
|
-
* @example
|
|
326
|
-
* \`\`\`ts
|
|
327
|
-
* const user = await userService.findOne({
|
|
328
|
-
* email: "john@example.com"
|
|
329
|
-
* });
|
|
330
|
-
* \`\`\`
|
|
331
|
-
*
|
|
332
|
-
* @example
|
|
333
|
-
* \`\`\`ts
|
|
334
|
-
* // With relations and ordering
|
|
335
|
-
* const latestPost = await postService.findOne(
|
|
336
|
-
* { published: true },
|
|
337
|
-
* { include: { author: true }, orderBy: { createdAt: "desc" } }
|
|
338
|
-
* );
|
|
339
|
-
* \`\`\`
|
|
340
|
-
*/
|
|
341
|
-
findOne<TOptions extends ExtractQueryOptions<ModelsGetPayload<any>[TModelName]['FindFirstArgs'], 'where'>>(
|
|
342
|
-
filters: ExtractFilters<ModelsGetPayload<any>[TModelName]['FindManyArgs']>,
|
|
343
|
-
queryOptions?: TOptions,
|
|
344
|
-
context?: ServiceBaseContext
|
|
345
|
-
): Promise<ModelsGetPayload<TOptions>[TModelName]['GetPayload'] | null>;
|
|
346
|
-
|
|
347
|
-
/**
|
|
348
|
-
* Updates a single record matching the specified filters.
|
|
349
|
-
*
|
|
350
|
-
* @template TOptions - The query options type extending query options excluding 'where' and 'data'
|
|
351
|
-
* @param {ExtractFilters} filters - Where conditions to identify the record to update
|
|
352
|
-
* @param {ExtractData} data - The data to update
|
|
353
|
-
* @param {TOptions} [queryOptions] - Optional Prisma query options (select, include, etc.)
|
|
354
|
-
* @param {ServiceBaseContext} [context] - Optional service execution context
|
|
355
|
-
* @returns {Promise<ModelsGetPayload>} The updated record
|
|
356
|
-
*
|
|
357
|
-
* @example
|
|
358
|
-
* \`\`\`ts
|
|
359
|
-
* const updatedUser = await userService.updateOne(
|
|
360
|
-
* { id: "user-123" },
|
|
361
|
-
* { name: "John Updated" }
|
|
362
|
-
* );
|
|
363
|
-
* \`\`\`
|
|
364
|
-
*
|
|
365
|
-
* @example
|
|
366
|
-
* \`\`\`ts
|
|
367
|
-
* // With relations
|
|
368
|
-
* const updatedUser = await userService.updateOne(
|
|
369
|
-
* { id: "user-123" },
|
|
370
|
-
* { name: "John Updated" },
|
|
371
|
-
* { include: { posts: true } }
|
|
372
|
-
* );
|
|
373
|
-
* \`\`\`
|
|
374
|
-
*/
|
|
375
|
-
updateOne<TOptions extends ExtractQueryOptions<ModelsGetPayload<any>[TModelName]['UpdateArgs'], 'where' | 'data'>>(
|
|
376
|
-
filters: ExtractFilters<ModelsGetPayload<any>[TModelName]['UpdateArgs']>,
|
|
377
|
-
data: ExtractData<ModelsGetPayload<any>[TModelName]['UpdateArgs']>,
|
|
378
|
-
queryOptions?: TOptions,
|
|
379
|
-
context?: ServiceBaseContext
|
|
380
|
-
): Promise<ModelsGetPayload<TOptions>[TModelName]['GetPayload']>;
|
|
381
|
-
|
|
382
|
-
/**
|
|
383
|
-
* Updates multiple records matching the specified filters.
|
|
384
|
-
*
|
|
385
|
-
* @template TOptions - The query options type extending query options excluding 'where' and 'data'
|
|
386
|
-
* @param {ExtractFilters} filters - Where conditions to identify records to update
|
|
387
|
-
* @param {ExtractData} data - The data to update
|
|
388
|
-
* @param {TOptions} [queryOptions] - Optional Prisma query options
|
|
389
|
-
* @param {ServiceBaseContext} [context] - Optional service execution context
|
|
390
|
-
* @returns {Promise<{ count: number }>} Object containing count of updated records
|
|
391
|
-
*
|
|
392
|
-
* @example
|
|
393
|
-
* \`\`\`ts
|
|
394
|
-
* const result = await userService.updateMany(
|
|
395
|
-
* { status: "pending" },
|
|
396
|
-
* { status: "active" }
|
|
397
|
-
* );
|
|
398
|
-
* console.log(result.count); // Number of updated records
|
|
399
|
-
* \`\`\`
|
|
400
|
-
*/
|
|
401
|
-
updateMany<TOptions extends ExtractQueryOptions<ModelsGetPayload<any>[TModelName]['UpdateManyArgs'], 'where' | 'data'>>(
|
|
402
|
-
filters: ExtractFilters<ModelsGetPayload<any>[TModelName]['UpdateManyArgs']>,
|
|
403
|
-
data: ExtractData<ModelsGetPayload<any>[TModelName]['UpdateManyArgs']>,
|
|
404
|
-
queryOptions?: TOptions,
|
|
405
|
-
context?: ServiceBaseContext
|
|
406
|
-
): Promise<{ count: number }>;
|
|
407
|
-
|
|
408
|
-
/**
|
|
409
|
-
* Deletes a single record matching the specified filters.
|
|
410
|
-
*
|
|
411
|
-
* @template TOptions - The query options type extending query options excluding 'where'
|
|
412
|
-
* @param {ExtractFilters} filters - Where conditions to identify the record to delete
|
|
413
|
-
* @param {TOptions} [queryOptions] - Optional Prisma query options
|
|
414
|
-
* @param {ServiceBaseContext} [context] - Optional service execution context
|
|
415
|
-
* @returns {Promise<ModelsGetPayload>} The deleted record
|
|
416
|
-
*
|
|
417
|
-
* @example
|
|
418
|
-
* \`\`\`ts
|
|
419
|
-
* const deletedUser = await userService.deleteOne({
|
|
420
|
-
* id: "user-123"
|
|
421
|
-
* });
|
|
422
|
-
* \`\`\`
|
|
423
|
-
*/
|
|
424
|
-
deleteOne<TOptions extends ExtractQueryOptions<ModelsGetPayload<any>[TModelName]['DeleteArgs'], 'where'>>(
|
|
425
|
-
filters: ExtractFilters<ModelsGetPayload<any>[TModelName]['DeleteArgs']>,
|
|
426
|
-
queryOptions?: TOptions,
|
|
427
|
-
context?: ServiceBaseContext
|
|
428
|
-
): Promise<ModelsGetPayload<TOptions>[TModelName]['GetPayload']>;
|
|
429
|
-
|
|
430
|
-
/**
|
|
431
|
-
* Deletes multiple records matching the specified filters.
|
|
432
|
-
*
|
|
433
|
-
* @template TOptions - The query options type extending query options excluding 'where'
|
|
434
|
-
* @param {ExtractFilters} filters - Where conditions to identify records to delete
|
|
435
|
-
* @param {TOptions} [queryOptions] - Optional Prisma query options
|
|
436
|
-
* @param {ServiceBaseContext} [context] - Optional service execution context
|
|
437
|
-
* @returns {Promise<{ count: number }>} Object containing count of deleted records
|
|
438
|
-
*
|
|
439
|
-
* @example
|
|
440
|
-
* \`\`\`ts
|
|
441
|
-
* const result = await userService.deleteMany({
|
|
442
|
-
* status: "inactive"
|
|
443
|
-
* });
|
|
444
|
-
* console.log(result.count); // Number of deleted records
|
|
445
|
-
* \`\`\`
|
|
446
|
-
*/
|
|
447
|
-
deleteMany<TOptions extends ExtractQueryOptions<ModelsGetPayload<any>[TModelName]['DeleteManyArgs'], 'where'>>(
|
|
448
|
-
filters: ExtractFilters<ModelsGetPayload<any>[TModelName]['DeleteManyArgs']>,
|
|
449
|
-
queryOptions?: TOptions,
|
|
450
|
-
context?: ServiceBaseContext
|
|
451
|
-
): Promise<{ count: number }>;
|
|
452
|
-
|
|
453
|
-
/**
|
|
454
|
-
* Performs multiple update operations in a single transaction.
|
|
455
|
-
* Each item in the data array must contain filter criteria to identify the record to update.
|
|
456
|
-
*
|
|
457
|
-
* @template TOptions - The query options type extending query options excluding 'where' and 'data'
|
|
458
|
-
* @param {Array<UpdateOneData>} dataArray - Array of update objects, each containing filter criteria and data
|
|
459
|
-
* @param {TOptions} [queryOptions] - Optional Prisma query options applied to all updates
|
|
460
|
-
* @param {ServiceBaseContext} [context] - Optional service execution context
|
|
461
|
-
* @returns {Promise<Array<ModelsGetPayload>>} Array of updated records
|
|
462
|
-
*
|
|
463
|
-
* @example
|
|
464
|
-
* \`\`\`ts
|
|
465
|
-
* const results = await userService.batchUpdate([
|
|
466
|
-
* { where: { id: "user-1" }, data: { status: "active" } },
|
|
467
|
-
* { where: { id: "user-2" }, data: { status: "inactive" } }
|
|
468
|
-
* ]);
|
|
469
|
-
* \`\`\`
|
|
470
|
-
*
|
|
471
|
-
* @example
|
|
472
|
-
* \`\`\`ts
|
|
473
|
-
* // With query options for all updates
|
|
474
|
-
* const results = await userService.batchUpdate(
|
|
475
|
-
* [
|
|
476
|
-
* { where: { id: "user-1" }, data: { status: "active" } },
|
|
477
|
-
* { where: { id: "user-2" }, data: { status: "inactive" } }
|
|
478
|
-
* ],
|
|
479
|
-
* { include: { posts: true } }
|
|
480
|
-
* );
|
|
481
|
-
* \`\`\`
|
|
482
|
-
*/
|
|
483
|
-
batchUpdate<TOptions extends ExtractQueryOptions<ModelsGetPayload<any>[TModelName]['UpdateArgs'], 'where' | 'data'>>(
|
|
484
|
-
dataArray: Array<{
|
|
485
|
-
where: ExtractFilters<ModelsGetPayload<any>[TModelName]['UpdateArgs']>,
|
|
486
|
-
data: ExtractData<ModelsGetPayload<any>[TModelName]['UpdateArgs']>
|
|
487
|
-
}>,
|
|
488
|
-
queryOptions?: TOptions,
|
|
489
|
-
context?: ServiceBaseContext
|
|
490
|
-
): Promise<Array<ModelsGetPayload<TOptions>[TModelName]['GetPayload']>>;
|
|
491
|
-
|
|
492
|
-
/**
|
|
493
|
-
* Performs multiple delete operations in a single transaction.
|
|
494
|
-
*
|
|
495
|
-
* @template TOptions - The query options type extending query options excluding 'where'
|
|
496
|
-
* @param {Array<ExtractFilters>} batchFilters - Array of where conditions, each identifying a record to delete
|
|
497
|
-
* @param {TOptions} [queryOptions] - Optional Prisma query options applied to all deletes
|
|
498
|
-
* @param {ServiceBaseContext} [context] - Optional service execution context
|
|
499
|
-
* @returns {Promise<Array<ModelsGetPayload>>} Array of deleted records
|
|
500
|
-
*
|
|
501
|
-
* @example
|
|
502
|
-
* \`\`\`ts
|
|
503
|
-
* const deletedUsers = await userService.batchDelete([
|
|
504
|
-
* { id: "user-1" },
|
|
505
|
-
* { id: "user-2" },
|
|
506
|
-
* { id: "user-3" }
|
|
507
|
-
* ]);
|
|
508
|
-
* \`\`\`
|
|
509
|
-
*
|
|
510
|
-
* @example
|
|
511
|
-
* \`\`\`ts
|
|
512
|
-
* // With query options
|
|
513
|
-
* const deletedUsers = await userService.batchDelete(
|
|
514
|
-
* [
|
|
515
|
-
* { id: "user-1" },
|
|
516
|
-
* { id: "user-2" }
|
|
517
|
-
* ],
|
|
518
|
-
* { include: { posts: true } }
|
|
519
|
-
* );
|
|
520
|
-
* \`\`\`
|
|
521
|
-
*/
|
|
522
|
-
batchDelete<TOptions extends ExtractQueryOptions<ModelsGetPayload<any>[TModelName]['DeleteArgs'], 'where'>>(
|
|
523
|
-
batchFilters: Array<ExtractFilters<ModelsGetPayload<any>[TModelName]['DeleteArgs']>>,
|
|
524
|
-
queryOptions?: TOptions,
|
|
525
|
-
context?: ServiceBaseContext
|
|
526
|
-
): Promise<Array<ModelsGetPayload<TOptions>[TModelName]['GetPayload']>>;
|
|
527
|
-
}
|
|
528
|
-
`;
|
|
529
|
-
}
|
|
530
|
-
async generateTypeDeclarations() {
|
|
531
|
-
const content = this.generateDeclarationContent();
|
|
532
|
-
const filePath = path.join(this.outputDir, "base.service.d.ts");
|
|
533
|
-
await fs.writeFile(filePath, content, { encoding: "utf8" });
|
|
534
|
-
}
|
|
535
|
-
generatePackageJsonContent() {
|
|
536
|
-
return JSON.stringify({
|
|
537
|
-
name: this.packageName,
|
|
538
|
-
version: "1.0.0",
|
|
539
|
-
types: "./base.service.d.ts",
|
|
540
|
-
exports: {
|
|
541
|
-
"./base.service": "./base.service.d.ts",
|
|
542
|
-
},
|
|
543
|
-
}, null, 2);
|
|
544
|
-
}
|
|
545
|
-
async generatePackageJson() {
|
|
546
|
-
const content = this.generatePackageJsonContent();
|
|
547
|
-
const pkgPath = path.join(this.outputDir, "package.json");
|
|
548
|
-
await fs.writeFile(pkgPath, content, { encoding: "utf8" });
|
|
549
|
-
}
|
|
550
|
-
}
|
|
551
|
-
const staticTypesGenerator = new StaticTypesGenerator();
|
|
552
|
-
export default staticTypesGenerator;
|
|
553
|
-
//# sourceMappingURL=static-types-generator.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"static-types-generator.js","sourceRoot":"","sources":["../../../../../src/utils/cli/utils/static-types-generator.ts"],"names":[],"mappings":"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","sourcesContent":["import fs from \"fs/promises\";\nimport { execSync } from \"child_process\";\nimport path from \"path\";\nimport sheu from \"../../sheu\";\nimport { kebabCase } from \"../../helpers/change-case.helpers\";\nimport prismaSchemaParser from \"../../prisma/prisma-schema-parser\";\n\nclass StaticTypesGenerator {\n private readonly outputDir: string;\n private readonly packageName = \"@arkosjs/types\";\n\n constructor() {\n this.outputDir = path.resolve(\n process.cwd(),\n `node_modules/${this.packageName}`\n );\n }\n\n /**\n * Generates all static types including Prisma types and package metadata\n * @returns Promise<void>\n */\n async generate(): Promise<void> {\n try {\n // Step 1: Generate Prisma client types\n await this.generatePrismaClient();\n\n // Step 2: Ensure output directory exists\n await this.ensureOutputDirectory();\n\n // Step 3: Generate TypeScript declaration file\n await this.generateTypeDeclarations();\n\n // Step 4: Generate package.json\n await this.generatePackageJson();\n\n sheu.done(\n \"Types for @prisma/client and base service generated successfully!\"\n );\n } catch (error) {\n sheu.error(\"Failed to generate static types:\");\n console.log(error);\n throw error;\n }\n }\n\n /**\n * Executes Prisma client generation\n */\n private async generatePrismaClient(): Promise<void> {\n return new Promise((resolve, reject) => {\n try {\n execSync(\"npx prisma generate\", { stdio: \"inherit\" });\n resolve();\n } catch (error) {\n reject(new Error(`Prisma generation failed: ${error}`));\n }\n });\n }\n\n /**\n * Ensures the output directory exists\n */\n private async ensureOutputDirectory(): Promise<void> {\n await fs.mkdir(this.outputDir, { recursive: true });\n }\n\n /**\n * Generates the TypeScript declaration file content\n */\n private generateDeclarationContent(): string {\n return `import { ServiceBaseContext } from \"arkos/services\";\nimport { Prisma, PrismaClient } from \"@prisma/client\"\n\nexport interface PrismaField {\n name: string;\n type: string;\n isOptional: boolean;\n isArray: boolean;\n foreignKeyField?: string;\n foreignReferenceField?: string;\n isRelation: boolean;\n defaultValue?: any;\n isId?: boolean;\n isUnique?: boolean;\n attributes: string[];\n}\n\n\nexport declare type ModelsGetPayload<T extends Record<string, any>> = {\n${prismaSchemaParser.models\n .map(\n (model) =>\n ` \"${kebabCase(model.name)}\": {\n Delegate: Prisma.${model.name}Delegate,\n GetPayload: Prisma.${model.name}GetPayload<T>,\n FindManyArgs: Prisma.${model.name}FindManyArgs,\n FindFirstArgs: Prisma.${model.name}FindFirstArgs,\n CreateArgs: Prisma.${model.name}CreateArgs,\n CreateManyArgs: Prisma.${model.name}CreateManyArgs,\n UpdateArgs: Prisma.${model.name}UpdateArgs,\n UpdateManyArgs: Prisma.${model.name}UpdateManyArgs,\n DeleteArgs: Prisma.${model.name}DeleteArgs,\n DeleteManyArgs: Prisma.${model.name}DeleteManyArgs,\n CountArgs: Prisma.${model.name}CountArgs\n }`\n )\n .join(\",\\n\")}\n}\n\nexport type ExtractFilters<T> = T extends { where?: infer W; [x: string]: any } ? W : any;\nexport type ExtractQueryOptions<T, K extends keyof T = never> = Omit<T, K>;\nexport type ExtractData<T> = T extends { data: infer D; [x: string]: any } ? D : any;\n\n\n/**\n * Base service class for handling CRUD operations on a specific model.\n * This class provides standard implementation of data operations that can be extended\n *\n * by model-specific service classes.\n *\n * @class BaseService\n *\n * @usage\n *\n * **Example:** creating a simple service\n *\n * \\`\\`\\`ts\n * import { BaseService } from \"arkos/services\"\n *\n * export class UserService extends BaseService<\"user\"> {}\n *\n * const userService = new UserService(\"user\")\n * \\`\\`\\`\n *\n * **Example:** accessing request context in hooks\n *\n * \\`\\`\\`\n *\n * @see {@link https://www.arkosjs.com/docs/api-reference/the-base-service-class}\n * @see {@link https://www.arkosjs.com/docs/guide/accessing-request-context-in-services}\n *\n */\nexport declare class BaseService<\n TModelName extends keyof ModelsGetPayload<any>\n> {\n modelName: TModelName;\n relationFields: {\n singular: PrismaField[] | undefined;\n list: PrismaField[] | undefined;\n };\n prisma: PrismaClient;\n \n constructor(modelName: TModelName);\n \n /**\n * Creates a single record in the database.\n *\n * @template TOptions - The query options type extending query options excluding 'data'\n * @param {ExtractData} data - The data for creating the record\n * @param {TOptions} [queryOptions] - Optional Prisma query options (select, include, etc.)\n * @param {ServiceBaseContext} [context] - Optional service execution context\n * @returns {Promise<ModelsGetPayload>} The created record\n *\n * @example\n * \\`\\`\\`ts\n * const user = await userService.createOne({\n * name: \"John Doe\",\n * email: \"john@example.com\"\n * });\n * \\`\\`\\`\n *\n * @example\n * \\`\\`\\`ts\n * // With query options\n * const user = await userService.createOne(\n * { name: \"John Doe\", email: \"john@example.com\" },\n * { include: { posts: true } }\n * );\n * \\`\\`\\`\n */\n createOne<TOptions extends ExtractQueryOptions<ModelsGetPayload<any>[TModelName]['CreateArgs'], 'data'>>(\n data: ExtractData<ModelsGetPayload<any>[TModelName]['CreateArgs']>, \n queryOptions?: TOptions, \n context?: ServiceBaseContext\n ): Promise<ModelsGetPayload<TOptions>[TModelName]['GetPayload']>;\n\n /**\n * Creates multiple records in the database.\n *\n * @template TOptions - The query options type extending query options excluding 'data'\n * @param {ExtractData} data - Array of data objects or object with data array\n * @param {TOptions} [queryOptions] - Optional Prisma query options\n * @param {ServiceBaseContext} [context] - Optional service execution context\n * @returns {Promise<Array>} Array of created records\n *\n * @example\n * \\`\\`\\`ts\n * const users = await userService.createMany([\n * { name: \"John Doe\", email: \"john@example.com\" },\n * { name: \"Jane Smith\", email: \"jane@example.com\" }\n * ]);\n * \\`\\`\\`\n */\n createMany<TOptions extends ExtractQueryOptions<ModelsGetPayload<any>[TModelName]['CreateManyArgs'], 'data'>>(\n data: ExtractData<ModelsGetPayload<any>[TModelName]['CreateManyArgs']>, \n queryOptions?: TOptions, \n context?: ServiceBaseContext\n ): Promise<ModelsGetPayload<TOptions>[TModelName]['GetPayload'][]>;\n\n /**\n * Counts records matching the specified filters.\n *\n * @template TOptions - The query options type extending query options excluding 'where'\n * @param {ExtractFilters} [filters] - Optional where conditions to filter records\n * @param {TOptions} [queryOptions] - Optional Prisma query options\n * @param {ServiceBaseContext} [context] - Optional service execution context\n * @returns {Promise<number>} The count of matching records\n *\n * @example\n * \\`\\`\\`ts\n * const totalUsers = await userService.count();\n * \\`\\`\\`\n *\n * @example\n * \\`\\`\\`ts\n * const activeUsers = await userService.count({\n * status: \"active\"\n * });\n * \\`\\`\\`\n */ \n count<TOptions extends ExtractQueryOptions<ModelsGetPayload<any>[TModelName]['CountArgs'], 'where'>>(\n filters?: ExtractFilters<ModelsGetPayload<any>[TModelName]['CountArgs']>, \n queryOptions?: TOptions,\n context?: ServiceBaseContext\n ): Promise<number>;\n\n /**\n * Finds multiple records matching the specified filters.\n *\n * @template TOptions - The query options type extending query options excluding 'where'\n * @param {ExtractFilters} [filters] - Optional where conditions to filter records\n * @param {TOptions} [queryOptions] - Optional Prisma query options (select, include, orderBy, skip, take, etc.)\n * @param {ServiceBaseContext} [context] - Optional service execution context\n * @returns {Promise<Array>} Array of matching records\n *\n * @example\n * \\`\\`\\`ts\n * const users = await userService.findMany({\n * status: \"active\"\n * });\n * \\`\\`\\`\n *\n * @example\n * \\`\\`\\`ts\n * // With pagination and ordering\n * const users = await userService.findMany(\n * { status: \"active\" },\n * { orderBy: { createdAt: \"desc\" }, take: 10, skip: 0 }\n * );\n * \\`\\`\\`\n */\n findMany<TOptions extends ExtractQueryOptions<ModelsGetPayload<any>[TModelName]['FindManyArgs'], 'where'>>(\n filters?: ExtractFilters<ModelsGetPayload<any>[TModelName]['FindManyArgs']>, \n queryOptions?: TOptions, \n context?: ServiceBaseContext\n ): Promise<ModelsGetPayload<TOptions>[TModelName]['GetPayload'][]>;\n\n /**\n * Finds a single record by its ID.\n *\n * @template TOptions - The query options type extending query options excluding 'where'\n * @param {string | number} id - The unique identifier of the record\n * @param {TOptions} [queryOptions] - Optional Prisma query options (select, include, etc.)\n * @param {ServiceBaseContext} [context] - Optional service execution context\n * @returns {Promise<ModelsGetPayload | null>} The matching record or null if not found\n *\n * @example\n * \\`\\`\\`ts\n * const user = await userService.findById(\"user-123\");\n * \\`\\`\\`\n *\n * @example\n * \\`\\`\\`ts\n * // With relations\n * const user = await userService.findById(\n * \"user-123\",\n * { include: { posts: true, profile: true } }\n * );\n * \\`\\`\\`\n */\n findById<TOptions extends ExtractQueryOptions<ModelsGetPayload<any>[TModelName]['FindFirstArgs'], 'where'>>(\n id: string | number, \n queryOptions?: TOptions, \n context?: ServiceBaseContext\n ): Promise<ModelsGetPayload<TOptions>[TModelName]['GetPayload'] | null>;\n\n /**\n * Updates a single record matching the specified id.\n *\n * @template TOptions - The query options type extending query options excluding 'where' and 'data'\n * @param {string | number} id - The unique identifier of the record\n * @param {ExtractData} data - The data to update\n * @param {TOptions} [queryOptions] - Optional Prisma query options (select, include, etc.)\n * @param {ServiceBaseContext} [context] - Optional service execution context\n * @returns {Promise<ModelsGetPayload>} The updated record\n *\n * @example\n * \\`\\`\\`ts\n * const updatedUser = await userService.updateById(\n * \"user-123\",\n * { name: \"John Updated\" }\n * );\n * \\`\\`\\`\n *\n * @example\n * \\`\\`\\`ts\n * // With relations\n * const updatedUser = await userService.updateById(\n * \"user-123\",\n * { name: \"John Updated\" },\n * { include: { posts: true } }\n * );\n * \\`\\`\\`\n */\n updateById<TOptions extends ExtractQueryOptions<ModelsGetPayload<any>[TModelName]['UpdateArgs'], 'where' | 'data'>>(\n id: string | number,\n data: ExtractData<ModelsGetPayload<any>[TModelName]['UpdateArgs']>, \n queryOptions?: TOptions, \n context?: ServiceBaseContext\n ): Promise<ModelsGetPayload<TOptions>[TModelName]['GetPayload']>;\n\n /**\n * Deletes a single record matching the specified id.\n *\n * @param {string | number} id - The unique identifier of the record\n * @param {ServiceBaseContext} [context] - Optional service execution context\n * @returns {Promise<ModelsGetPayload>} The deleted record\n *\n * @example\n * \\`\\`\\`ts\n * const deletedUser = await userService.deleteById(\"user-123\");\n * \\`\\`\\`\n */\n deleteById(\n id: string | number,\n context?: ServiceBaseContext\n ): Promise<ModelsGetPayload<any>[TModelName]['GetPayload']>;\n\n /**\n * Finds the first record matching the specified filters.\n *\n * @template TOptions - The query options type extending query options excluding 'where'\n * @param {ExtractFilters} filters - Where conditions to filter records\n * @param {TOptions} [queryOptions] - Optional Prisma query options (select, include, orderBy, etc.)\n * @param {ServiceBaseContext} [context] - Optional service execution context\n * @returns {Promise<ModelsGetPayload | null>} The first matching record or null if not found\n *\n * @example\n * \\`\\`\\`ts\n * const user = await userService.findOne({\n * email: \"john@example.com\"\n * });\n * \\`\\`\\`\n *\n * @example\n * \\`\\`\\`ts\n * // With relations and ordering\n * const latestPost = await postService.findOne(\n * { published: true },\n * { include: { author: true }, orderBy: { createdAt: \"desc\" } }\n * );\n * \\`\\`\\`\n */\n findOne<TOptions extends ExtractQueryOptions<ModelsGetPayload<any>[TModelName]['FindFirstArgs'], 'where'>>(\n filters: ExtractFilters<ModelsGetPayload<any>[TModelName]['FindManyArgs']>, \n queryOptions?: TOptions, \n context?: ServiceBaseContext\n ): Promise<ModelsGetPayload<TOptions>[TModelName]['GetPayload'] | null>;\n\n /**\n * Updates a single record matching the specified filters.\n *\n * @template TOptions - The query options type extending query options excluding 'where' and 'data'\n * @param {ExtractFilters} filters - Where conditions to identify the record to update\n * @param {ExtractData} data - The data to update\n * @param {TOptions} [queryOptions] - Optional Prisma query options (select, include, etc.)\n * @param {ServiceBaseContext} [context] - Optional service execution context\n * @returns {Promise<ModelsGetPayload>} The updated record\n *\n * @example\n * \\`\\`\\`ts\n * const updatedUser = await userService.updateOne(\n * { id: \"user-123\" },\n * { name: \"John Updated\" }\n * );\n * \\`\\`\\`\n *\n * @example\n * \\`\\`\\`ts\n * // With relations\n * const updatedUser = await userService.updateOne(\n * { id: \"user-123\" },\n * { name: \"John Updated\" },\n * { include: { posts: true } }\n * );\n * \\`\\`\\`\n */\n updateOne<TOptions extends ExtractQueryOptions<ModelsGetPayload<any>[TModelName]['UpdateArgs'], 'where' | 'data'>>(\n filters: ExtractFilters<ModelsGetPayload<any>[TModelName]['UpdateArgs']>, \n data: ExtractData<ModelsGetPayload<any>[TModelName]['UpdateArgs']>, \n queryOptions?: TOptions, \n context?: ServiceBaseContext\n ): Promise<ModelsGetPayload<TOptions>[TModelName]['GetPayload']>;\n\n /**\n * Updates multiple records matching the specified filters.\n *\n * @template TOptions - The query options type extending query options excluding 'where' and 'data'\n * @param {ExtractFilters} filters - Where conditions to identify records to update\n * @param {ExtractData} data - The data to update\n * @param {TOptions} [queryOptions] - Optional Prisma query options\n * @param {ServiceBaseContext} [context] - Optional service execution context\n * @returns {Promise<{ count: number }>} Object containing count of updated records\n *\n * @example\n * \\`\\`\\`ts\n * const result = await userService.updateMany(\n * { status: \"pending\" },\n * { status: \"active\" }\n * );\n * console.log(result.count); // Number of updated records\n * \\`\\`\\`\n */\n updateMany<TOptions extends ExtractQueryOptions<ModelsGetPayload<any>[TModelName]['UpdateManyArgs'], 'where' | 'data'>>(\n filters: ExtractFilters<ModelsGetPayload<any>[TModelName]['UpdateManyArgs']>, \n data: ExtractData<ModelsGetPayload<any>[TModelName]['UpdateManyArgs']>, \n queryOptions?: TOptions, \n context?: ServiceBaseContext\n ): Promise<{ count: number }>;\n\n /**\n * Deletes a single record matching the specified filters.\n *\n * @template TOptions - The query options type extending query options excluding 'where'\n * @param {ExtractFilters} filters - Where conditions to identify the record to delete\n * @param {TOptions} [queryOptions] - Optional Prisma query options\n * @param {ServiceBaseContext} [context] - Optional service execution context\n * @returns {Promise<ModelsGetPayload>} The deleted record\n *\n * @example\n * \\`\\`\\`ts\n * const deletedUser = await userService.deleteOne({\n * id: \"user-123\"\n * });\n * \\`\\`\\`\n */\n deleteOne<TOptions extends ExtractQueryOptions<ModelsGetPayload<any>[TModelName]['DeleteArgs'], 'where'>>(\n filters: ExtractFilters<ModelsGetPayload<any>[TModelName]['DeleteArgs']>, \n queryOptions?: TOptions,\n context?: ServiceBaseContext\n ): Promise<ModelsGetPayload<TOptions>[TModelName]['GetPayload']>;\n\n /**\n * Deletes multiple records matching the specified filters.\n *\n * @template TOptions - The query options type extending query options excluding 'where'\n * @param {ExtractFilters} filters - Where conditions to identify records to delete\n * @param {TOptions} [queryOptions] - Optional Prisma query options\n * @param {ServiceBaseContext} [context] - Optional service execution context\n * @returns {Promise<{ count: number }>} Object containing count of deleted records\n *\n * @example\n * \\`\\`\\`ts\n * const result = await userService.deleteMany({\n * status: \"inactive\"\n * });\n * console.log(result.count); // Number of deleted records\n * \\`\\`\\`\n */\n deleteMany<TOptions extends ExtractQueryOptions<ModelsGetPayload<any>[TModelName]['DeleteManyArgs'], 'where'>>(\n filters: ExtractFilters<ModelsGetPayload<any>[TModelName]['DeleteManyArgs']>, \n queryOptions?: TOptions,\n context?: ServiceBaseContext\n ): Promise<{ count: number }>;\n\n /**\n * Performs multiple update operations in a single transaction.\n * Each item in the data array must contain filter criteria to identify the record to update.\n *\n * @template TOptions - The query options type extending query options excluding 'where' and 'data'\n * @param {Array<UpdateOneData>} dataArray - Array of update objects, each containing filter criteria and data\n * @param {TOptions} [queryOptions] - Optional Prisma query options applied to all updates\n * @param {ServiceBaseContext} [context] - Optional service execution context\n * @returns {Promise<Array<ModelsGetPayload>>} Array of updated records\n *\n * @example\n * \\`\\`\\`ts\n * const results = await userService.batchUpdate([\n * { where: { id: \"user-1\" }, data: { status: \"active\" } },\n * { where: { id: \"user-2\" }, data: { status: \"inactive\" } }\n * ]);\n * \\`\\`\\`\n *\n * @example\n * \\`\\`\\`ts\n * // With query options for all updates\n * const results = await userService.batchUpdate(\n * [\n * { where: { id: \"user-1\" }, data: { status: \"active\" } },\n * { where: { id: \"user-2\" }, data: { status: \"inactive\" } }\n * ],\n * { include: { posts: true } }\n * );\n * \\`\\`\\`\n */\n batchUpdate<TOptions extends ExtractQueryOptions<ModelsGetPayload<any>[TModelName]['UpdateArgs'], 'where' | 'data'>>(\n dataArray: Array<{\n where: ExtractFilters<ModelsGetPayload<any>[TModelName]['UpdateArgs']>,\n data: ExtractData<ModelsGetPayload<any>[TModelName]['UpdateArgs']>\n }>,\n queryOptions?: TOptions,\n context?: ServiceBaseContext\n ): Promise<Array<ModelsGetPayload<TOptions>[TModelName]['GetPayload']>>;\n\n /**\n * Performs multiple delete operations in a single transaction.\n *\n * @template TOptions - The query options type extending query options excluding 'where'\n * @param {Array<ExtractFilters>} batchFilters - Array of where conditions, each identifying a record to delete\n * @param {TOptions} [queryOptions] - Optional Prisma query options applied to all deletes\n * @param {ServiceBaseContext} [context] - Optional service execution context\n * @returns {Promise<Array<ModelsGetPayload>>} Array of deleted records\n *\n * @example\n * \\`\\`\\`ts\n * const deletedUsers = await userService.batchDelete([\n * { id: \"user-1\" },\n * { id: \"user-2\" },\n * { id: \"user-3\" }\n * ]);\n * \\`\\`\\`\n *\n * @example\n * \\`\\`\\`ts\n * // With query options\n * const deletedUsers = await userService.batchDelete(\n * [\n * { id: \"user-1\" },\n * { id: \"user-2\" }\n * ],\n * { include: { posts: true } }\n * );\n * \\`\\`\\`\n */\n batchDelete<TOptions extends ExtractQueryOptions<ModelsGetPayload<any>[TModelName]['DeleteArgs'], 'where'>>(\n batchFilters: Array<ExtractFilters<ModelsGetPayload<any>[TModelName]['DeleteArgs']>>,\n queryOptions?: TOptions,\n context?: ServiceBaseContext\n ): Promise<Array<ModelsGetPayload<TOptions>[TModelName]['GetPayload']>>;\n}\n`;\n }\n\n /**\n * Writes the TypeScript declaration file\n */\n private async generateTypeDeclarations(): Promise<void> {\n const content = this.generateDeclarationContent();\n const filePath = path.join(this.outputDir, \"base.service.d.ts\");\n await fs.writeFile(filePath, content, { encoding: \"utf8\" });\n }\n\n /**\n * Generates the package.json content\n */\n private generatePackageJsonContent(): string {\n return JSON.stringify(\n {\n name: this.packageName,\n version: \"1.0.0\",\n types: \"./base.service.d.ts\",\n exports: {\n \"./base.service\": \"./base.service.d.ts\",\n },\n },\n null,\n 2\n );\n }\n\n /**\n * Writes the package.json file\n */\n private async generatePackageJson(): Promise<void> {\n const content = this.generatePackageJsonContent();\n const pkgPath = path.join(this.outputDir, \"package.json\");\n await fs.writeFile(pkgPath, content, { encoding: \"utf8\" });\n }\n}\n\nconst staticTypesGenerator = new StaticTypesGenerator();\nexport default staticTypesGenerator;\n"]}
|