@baseplate-dev/fastify-generators 0.4.2 → 0.4.4
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/generators/auth/_providers/authorizer-utils-imports.d.ts +23 -0
- package/dist/generators/auth/_providers/authorizer-utils-imports.d.ts.map +1 -0
- package/dist/generators/auth/_providers/authorizer-utils-imports.js +10 -0
- package/dist/generators/auth/_providers/authorizer-utils-imports.js.map +1 -0
- package/dist/generators/auth/_providers/index.d.ts +1 -0
- package/dist/generators/auth/_providers/index.d.ts.map +1 -1
- package/dist/generators/auth/_providers/index.js +1 -0
- package/dist/generators/auth/_providers/index.js.map +1 -1
- package/dist/generators/auth/authorizer-utils-stub/authorizer-utils-stub.generator.d.ts +54 -0
- package/dist/generators/auth/authorizer-utils-stub/authorizer-utils-stub.generator.d.ts.map +1 -0
- package/dist/generators/auth/authorizer-utils-stub/authorizer-utils-stub.generator.js +34 -0
- package/dist/generators/auth/authorizer-utils-stub/authorizer-utils-stub.generator.js.map +1 -0
- package/dist/generators/auth/authorizer-utils-stub/generated/index.d.ts +78 -0
- package/dist/generators/auth/authorizer-utils-stub/generated/index.d.ts.map +1 -0
- package/dist/generators/auth/authorizer-utils-stub/generated/index.js +11 -0
- package/dist/generators/auth/authorizer-utils-stub/generated/index.js.map +1 -0
- package/dist/generators/auth/authorizer-utils-stub/generated/template-paths.d.ts +12 -0
- package/dist/generators/auth/authorizer-utils-stub/generated/template-paths.d.ts.map +1 -0
- package/dist/generators/auth/authorizer-utils-stub/generated/template-paths.js +24 -0
- package/dist/generators/auth/authorizer-utils-stub/generated/template-paths.js.map +1 -0
- package/dist/generators/auth/authorizer-utils-stub/generated/template-renderers.d.ts +36 -0
- package/dist/generators/auth/authorizer-utils-stub/generated/template-renderers.d.ts.map +1 -0
- package/dist/generators/auth/authorizer-utils-stub/generated/template-renderers.js +42 -0
- package/dist/generators/auth/authorizer-utils-stub/generated/template-renderers.js.map +1 -0
- package/dist/generators/auth/authorizer-utils-stub/generated/ts-import-providers.d.ts +17 -0
- package/dist/generators/auth/authorizer-utils-stub/generated/ts-import-providers.d.ts.map +1 -0
- package/dist/generators/auth/authorizer-utils-stub/generated/ts-import-providers.js +28 -0
- package/dist/generators/auth/authorizer-utils-stub/generated/ts-import-providers.js.map +1 -0
- package/dist/generators/auth/authorizer-utils-stub/generated/typed-templates.d.ts +47 -0
- package/dist/generators/auth/authorizer-utils-stub/generated/typed-templates.d.ts.map +1 -0
- package/dist/generators/auth/authorizer-utils-stub/generated/typed-templates.js +26 -0
- package/dist/generators/auth/authorizer-utils-stub/generated/typed-templates.js.map +1 -0
- package/dist/generators/auth/authorizer-utils-stub/index.d.ts +2 -0
- package/dist/generators/auth/authorizer-utils-stub/index.d.ts.map +1 -0
- package/dist/generators/auth/authorizer-utils-stub/index.js +2 -0
- package/dist/generators/auth/authorizer-utils-stub/index.js.map +1 -0
- package/dist/generators/auth/authorizer-utils-stub/templates/src/utils/authorizers.ts +58 -0
- package/dist/generators/auth/index.d.ts +1 -0
- package/dist/generators/auth/index.d.ts.map +1 -1
- package/dist/generators/auth/index.js +1 -0
- package/dist/generators/auth/index.js.map +1 -1
- package/dist/generators/core/fastify/fastify.generator.js +1 -1
- package/dist/generators/core/fastify/fastify.generator.js.map +1 -1
- package/dist/generators/pothos/pothos-auth/generated/index.d.ts +46 -19
- package/dist/generators/pothos/pothos-auth/generated/index.d.ts.map +1 -1
- package/dist/generators/pothos/pothos-auth/generated/template-renderers.d.ts +17 -9
- package/dist/generators/pothos/pothos-auth/generated/template-renderers.d.ts.map +1 -1
- package/dist/generators/pothos/pothos-auth/generated/template-renderers.js +7 -4
- package/dist/generators/pothos/pothos-auth/generated/template-renderers.js.map +1 -1
- package/dist/generators/pothos/pothos-auth/generated/typed-templates.d.ts +58 -20
- package/dist/generators/pothos/pothos-auth/generated/typed-templates.d.ts.map +1 -1
- package/dist/generators/pothos/pothos-auth/generated/typed-templates.js +7 -3
- package/dist/generators/pothos/pothos-auth/generated/typed-templates.js.map +1 -1
- package/dist/generators/pothos/pothos-auth/pothos-auth.generator.d.ts +17 -20
- package/dist/generators/pothos/pothos-auth/pothos-auth.generator.d.ts.map +1 -1
- package/dist/generators/pothos/pothos-auth/pothos-auth.generator.js +1 -5
- package/dist/generators/pothos/pothos-auth/pothos-auth.generator.js.map +1 -1
- package/dist/generators/pothos/pothos-auth/templates/src/plugins/graphql/FieldAuthorizePlugin/global-types.ts +2 -17
- package/dist/generators/pothos/pothos-auth/templates/src/plugins/graphql/FieldAuthorizePlugin/index.ts +9 -56
- package/dist/generators/pothos/pothos-auth/templates/src/plugins/graphql/FieldAuthorizePlugin/types.ts +28 -25
- package/dist/generators/prisma/_shared/build-data-helpers/generate-operation-callbacks.d.ts +29 -16
- package/dist/generators/prisma/_shared/build-data-helpers/generate-operation-callbacks.d.ts.map +1 -1
- package/dist/generators/prisma/_shared/build-data-helpers/generate-operation-callbacks.js +51 -28
- package/dist/generators/prisma/_shared/build-data-helpers/generate-operation-callbacks.js.map +1 -1
- package/dist/generators/prisma/data-utils/data-utils.generator.d.ts +16 -0
- package/dist/generators/prisma/data-utils/data-utils.generator.d.ts.map +1 -1
- package/dist/generators/prisma/data-utils/generated/index.d.ts +26 -0
- package/dist/generators/prisma/data-utils/generated/index.d.ts.map +1 -1
- package/dist/generators/prisma/data-utils/generated/template-renderers.d.ts +10 -0
- package/dist/generators/prisma/data-utils/generated/template-renderers.d.ts.map +1 -1
- package/dist/generators/prisma/data-utils/generated/template-renderers.js +4 -1
- package/dist/generators/prisma/data-utils/generated/template-renderers.js.map +1 -1
- package/dist/generators/prisma/data-utils/generated/ts-import-providers.d.ts +18 -0
- package/dist/generators/prisma/data-utils/generated/ts-import-providers.d.ts.map +1 -1
- package/dist/generators/prisma/data-utils/generated/ts-import-providers.js +4 -0
- package/dist/generators/prisma/data-utils/generated/ts-import-providers.js.map +1 -1
- package/dist/generators/prisma/data-utils/generated/typed-templates.d.ts +20 -0
- package/dist/generators/prisma/data-utils/generated/typed-templates.d.ts.map +1 -1
- package/dist/generators/prisma/data-utils/generated/typed-templates.js +6 -0
- package/dist/generators/prisma/data-utils/generated/typed-templates.js.map +1 -1
- package/dist/generators/prisma/data-utils/templates/src/utils/data-operations/define-operations.ts +55 -25
- package/dist/generators/prisma/data-utils/templates/src/utils/data-operations/field-definitions.ts +20 -3
- package/dist/generators/prisma/index.d.ts +1 -0
- package/dist/generators/prisma/index.d.ts.map +1 -1
- package/dist/generators/prisma/index.js +1 -0
- package/dist/generators/prisma/index.js.map +1 -1
- package/dist/generators/prisma/prisma/prisma.generator.d.ts +1 -1
- package/dist/generators/prisma/prisma/prisma.generator.d.ts.map +1 -1
- package/dist/generators/prisma/prisma/prisma.generator.js +1 -0
- package/dist/generators/prisma/prisma/prisma.generator.js.map +1 -1
- package/dist/generators/prisma/prisma/templates/package/prisma.config.ts +4 -3
- package/dist/generators/prisma/prisma-authorizer-utils/generated/index.d.ts +237 -0
- package/dist/generators/prisma/prisma-authorizer-utils/generated/index.d.ts.map +1 -0
- package/dist/generators/prisma/prisma-authorizer-utils/generated/index.js +11 -0
- package/dist/generators/prisma/prisma-authorizer-utils/generated/index.js.map +1 -0
- package/dist/generators/prisma/prisma-authorizer-utils/generated/template-paths.d.ts +12 -0
- package/dist/generators/prisma/prisma-authorizer-utils/generated/template-paths.d.ts.map +1 -0
- package/dist/generators/prisma/prisma-authorizer-utils/generated/template-paths.js +24 -0
- package/dist/generators/prisma/prisma-authorizer-utils/generated/template-paths.js.map +1 -0
- package/dist/generators/prisma/prisma-authorizer-utils/generated/template-renderers.d.ts +111 -0
- package/dist/generators/prisma/prisma-authorizer-utils/generated/template-renderers.d.ts.map +1 -0
- package/dist/generators/prisma/prisma-authorizer-utils/generated/template-renderers.js +48 -0
- package/dist/generators/prisma/prisma-authorizer-utils/generated/template-renderers.js.map +1 -0
- package/dist/generators/prisma/prisma-authorizer-utils/generated/ts-import-providers.d.ts +46 -0
- package/dist/generators/prisma/prisma-authorizer-utils/generated/ts-import-providers.d.ts.map +1 -0
- package/dist/generators/prisma/prisma-authorizer-utils/generated/ts-import-providers.js +40 -0
- package/dist/generators/prisma/prisma-authorizer-utils/generated/ts-import-providers.js.map +1 -0
- package/dist/generators/prisma/prisma-authorizer-utils/generated/typed-templates.d.ts +197 -0
- package/dist/generators/prisma/prisma-authorizer-utils/generated/typed-templates.d.ts.map +1 -0
- package/dist/generators/prisma/prisma-authorizer-utils/generated/typed-templates.js +33 -0
- package/dist/generators/prisma/prisma-authorizer-utils/generated/typed-templates.js.map +1 -0
- package/dist/generators/prisma/prisma-authorizer-utils/index.d.ts +4 -0
- package/dist/generators/prisma/prisma-authorizer-utils/index.d.ts.map +1 -0
- package/dist/generators/prisma/prisma-authorizer-utils/index.js +3 -0
- package/dist/generators/prisma/prisma-authorizer-utils/index.js.map +1 -0
- package/dist/generators/prisma/prisma-authorizer-utils/prisma-authorizer-utils.generator.d.ts +141 -0
- package/dist/generators/prisma/prisma-authorizer-utils/prisma-authorizer-utils.generator.d.ts.map +1 -0
- package/dist/generators/prisma/prisma-authorizer-utils/prisma-authorizer-utils.generator.js +49 -0
- package/dist/generators/prisma/prisma-authorizer-utils/prisma-authorizer-utils.generator.js.map +1 -0
- package/dist/generators/prisma/prisma-authorizer-utils/templates/src/utils/authorizers.ts +302 -0
- package/dist/generators/prisma/prisma-data-create/prisma-data-create.generator.d.ts +6 -0
- package/dist/generators/prisma/prisma-data-create/prisma-data-create.generator.d.ts.map +1 -1
- package/dist/generators/prisma/prisma-data-delete/prisma-data-delete.generator.d.ts +6 -0
- package/dist/generators/prisma/prisma-data-delete/prisma-data-delete.generator.d.ts.map +1 -1
- package/dist/generators/prisma/prisma-data-nested-field/prisma-data-nested-field.generator.d.ts +6 -0
- package/dist/generators/prisma/prisma-data-nested-field/prisma-data-nested-field.generator.d.ts.map +1 -1
- package/dist/generators/prisma/prisma-data-service/prisma-data-service.generator.d.ts +6 -0
- package/dist/generators/prisma/prisma-data-service/prisma-data-service.generator.d.ts.map +1 -1
- package/dist/generators/prisma/prisma-data-update/prisma-data-update.generator.d.ts +6 -0
- package/dist/generators/prisma/prisma-data-update/prisma-data-update.generator.d.ts.map +1 -1
- package/dist/generators/prisma/prisma-field/prisma-field.generator.js +1 -1
- package/dist/generators/prisma/prisma-field/prisma-field.generator.js.map +1 -1
- package/dist/generators/vitest/fastify-vitest/fastify-vitest.generator.d.ts +9 -0
- package/dist/generators/vitest/fastify-vitest/fastify-vitest.generator.d.ts.map +1 -1
- package/dist/generators/vitest/fastify-vitest/fastify-vitest.generator.js +10 -3
- package/dist/generators/vitest/fastify-vitest/fastify-vitest.generator.js.map +1 -1
- package/dist/generators/vitest/prisma-vitest/templates/src/tests/scripts/global-setup-prisma.ts +8 -6
- package/package.json +5 -5
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { TsImportMapProviderFromSchema } from '@baseplate-dev/core-generators';
|
|
2
|
+
export declare const authorizerUtilsImportsSchema: {
|
|
3
|
+
checkGlobalAuthorization: {};
|
|
4
|
+
checkInstanceAuthorization: {};
|
|
5
|
+
GlobalRoleCheck: {
|
|
6
|
+
isTypeOnly: true;
|
|
7
|
+
};
|
|
8
|
+
InstanceRoleCheck: {
|
|
9
|
+
isTypeOnly: true;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
export type AuthorizerUtilsImportsProvider = TsImportMapProviderFromSchema<typeof authorizerUtilsImportsSchema>;
|
|
13
|
+
export declare const authorizerUtilsImportsProvider: import("@baseplate-dev/sync").ProviderType<import("@baseplate-dev/core-generators").InferTsImportMapFromSchema<{
|
|
14
|
+
checkGlobalAuthorization: {};
|
|
15
|
+
checkInstanceAuthorization: {};
|
|
16
|
+
GlobalRoleCheck: {
|
|
17
|
+
isTypeOnly: true;
|
|
18
|
+
};
|
|
19
|
+
InstanceRoleCheck: {
|
|
20
|
+
isTypeOnly: true;
|
|
21
|
+
};
|
|
22
|
+
}>>;
|
|
23
|
+
//# sourceMappingURL=authorizer-utils-imports.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authorizer-utils-imports.d.ts","sourceRoot":"","sources":["../../../../src/generators/auth/_providers/authorizer-utils-imports.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,gCAAgC,CAAC;AAKpF,eAAO,MAAM,4BAA4B;;;;;;;;;CAKvC,CAAC;AAEH,MAAM,MAAM,8BAA8B,GAAG,6BAA6B,CACxE,OAAO,4BAA4B,CACpC,CAAC;AAEF,eAAO,MAAM,8BAA8B;;;;;;;;;GAGxC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { createTsImportMapSchema } from '@baseplate-dev/core-generators';
|
|
2
|
+
import { createReadOnlyProviderType } from '@baseplate-dev/sync';
|
|
3
|
+
export const authorizerUtilsImportsSchema = createTsImportMapSchema({
|
|
4
|
+
checkGlobalAuthorization: {},
|
|
5
|
+
checkInstanceAuthorization: {},
|
|
6
|
+
GlobalRoleCheck: { isTypeOnly: true },
|
|
7
|
+
InstanceRoleCheck: { isTypeOnly: true },
|
|
8
|
+
});
|
|
9
|
+
export const authorizerUtilsImportsProvider = createReadOnlyProviderType('authorizer-utils-imports');
|
|
10
|
+
//# sourceMappingURL=authorizer-utils-imports.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authorizer-utils-imports.js","sourceRoot":"","sources":["../../../../src/generators/auth/_providers/authorizer-utils-imports.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AACzE,OAAO,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;AAEjE,MAAM,CAAC,MAAM,4BAA4B,GAAG,uBAAuB,CAAC;IAClE,wBAAwB,EAAE,EAAE;IAC5B,0BAA0B,EAAE,EAAE;IAC9B,eAAe,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE;IACrC,iBAAiB,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE;CACxC,CAAC,CAAC;AAMH,MAAM,CAAC,MAAM,8BAA8B,GACzC,0BAA0B,CACxB,0BAA0B,CAC3B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/generators/auth/_providers/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/generators/auth/_providers/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC;AAC9C,cAAc,mBAAmB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/generators/auth/_providers/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/generators/auth/_providers/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC;AAC9C,cAAc,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stub generator for prisma/authorizer-utils-stub.
|
|
3
|
+
* Used for projects without authentication - exports stub types and functions
|
|
4
|
+
* that match the full authorizer-utils API.
|
|
5
|
+
*/
|
|
6
|
+
export declare const authorizerUtilsStubGenerator: import("@baseplate-dev/sync").GeneratorBundleCreator<Record<string, never>, {
|
|
7
|
+
paths: import("@baseplate-dev/sync").GeneratorTask<{
|
|
8
|
+
prismaAuthorizerUtilsStubPaths: import("@baseplate-dev/sync").ProviderExport<import("./generated/template-paths.js").PrismaAuthorizerUtilsStubPaths>;
|
|
9
|
+
}, {
|
|
10
|
+
packageInfo: import("@baseplate-dev/sync").ProviderType<import("@baseplate-dev/core-generators").PackageInfoProvider>;
|
|
11
|
+
}, undefined>;
|
|
12
|
+
imports: import("@baseplate-dev/sync").GeneratorTask<{
|
|
13
|
+
authorizerUtilsImports: import("@baseplate-dev/sync").ProviderExport<import("@baseplate-dev/core-generators").InferTsImportMapFromSchema<{
|
|
14
|
+
checkGlobalAuthorization: {};
|
|
15
|
+
checkInstanceAuthorization: {};
|
|
16
|
+
GlobalRoleCheck: {
|
|
17
|
+
isTypeOnly: true;
|
|
18
|
+
};
|
|
19
|
+
InstanceRoleCheck: {
|
|
20
|
+
isTypeOnly: true;
|
|
21
|
+
};
|
|
22
|
+
}>>;
|
|
23
|
+
}, {
|
|
24
|
+
paths: import("@baseplate-dev/sync").ProviderType<import("./generated/template-paths.js").PrismaAuthorizerUtilsStubPaths>;
|
|
25
|
+
}, undefined>;
|
|
26
|
+
renderers: import("@baseplate-dev/sync").GeneratorTask<{
|
|
27
|
+
prismaAuthorizerUtilsStubRenderers: import("@baseplate-dev/sync").ProviderExport<import("./generated/template-renderers.js").PrismaAuthorizerUtilsStubRenderers>;
|
|
28
|
+
}, {
|
|
29
|
+
errorHandlerServiceImports: import("@baseplate-dev/sync").ProviderType<import("@baseplate-dev/core-generators").InferTsImportMapFromSchema<{
|
|
30
|
+
BadRequestError: {};
|
|
31
|
+
ForbiddenError: {};
|
|
32
|
+
handleZodRequestValidationError: {};
|
|
33
|
+
HttpError: {};
|
|
34
|
+
InternalServerError: {};
|
|
35
|
+
logError: {};
|
|
36
|
+
NotFoundError: {};
|
|
37
|
+
UnauthorizedError: {};
|
|
38
|
+
}>>;
|
|
39
|
+
paths: import("@baseplate-dev/sync").ProviderType<import("./generated/template-paths.js").PrismaAuthorizerUtilsStubPaths>;
|
|
40
|
+
serviceContextImports: import("@baseplate-dev/sync").ProviderType<import("@baseplate-dev/core-generators").InferTsImportMapFromSchema<{
|
|
41
|
+
createServiceContext: {};
|
|
42
|
+
createSystemServiceContext: {};
|
|
43
|
+
createTestServiceContext: {};
|
|
44
|
+
ServiceContext: {
|
|
45
|
+
isTypeOnly: true;
|
|
46
|
+
};
|
|
47
|
+
}>>;
|
|
48
|
+
typescriptFile: import("@baseplate-dev/sync").ProviderType<import("@baseplate-dev/core-generators").TypescriptFileProvider>;
|
|
49
|
+
}, undefined>;
|
|
50
|
+
main: import("@baseplate-dev/sync").GeneratorTask<any, {
|
|
51
|
+
renderers: import("@baseplate-dev/sync").ProviderType<import("./generated/template-renderers.js").PrismaAuthorizerUtilsStubRenderers>;
|
|
52
|
+
}, any>;
|
|
53
|
+
}>;
|
|
54
|
+
//# sourceMappingURL=authorizer-utils-stub.generator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authorizer-utils-stub.generator.d.ts","sourceRoot":"","sources":["../../../../src/generators/auth/authorizer-utils-stub/authorizer-utils-stub.generator.ts"],"names":[],"mappings":"AAOA;;;;GAIG;AACH,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyBvC,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { createGenerator, createGeneratorTask } from '@baseplate-dev/sync';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { PRISMA_AUTHORIZER_UTILS_STUB_GENERATED as GENERATED_TEMPLATES } from './generated/index.js';
|
|
4
|
+
const descriptorSchema = z.object({});
|
|
5
|
+
/**
|
|
6
|
+
* Stub generator for prisma/authorizer-utils-stub.
|
|
7
|
+
* Used for projects without authentication - exports stub types and functions
|
|
8
|
+
* that match the full authorizer-utils API.
|
|
9
|
+
*/
|
|
10
|
+
export const authorizerUtilsStubGenerator = createGenerator({
|
|
11
|
+
name: 'prisma/authorizer-utils-stub',
|
|
12
|
+
generatorFileUrl: import.meta.url,
|
|
13
|
+
descriptorSchema,
|
|
14
|
+
buildTasks: () => ({
|
|
15
|
+
paths: GENERATED_TEMPLATES.paths.task,
|
|
16
|
+
imports: GENERATED_TEMPLATES.imports.task,
|
|
17
|
+
renderers: GENERATED_TEMPLATES.renderers.task,
|
|
18
|
+
main: createGeneratorTask({
|
|
19
|
+
dependencies: {
|
|
20
|
+
renderers: GENERATED_TEMPLATES.renderers.provider,
|
|
21
|
+
},
|
|
22
|
+
run({ renderers }) {
|
|
23
|
+
return {
|
|
24
|
+
build: async (builder) => {
|
|
25
|
+
await builder.apply(renderers.mainGroup.render({
|
|
26
|
+
variables: {},
|
|
27
|
+
}));
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
},
|
|
31
|
+
}),
|
|
32
|
+
}),
|
|
33
|
+
});
|
|
34
|
+
//# sourceMappingURL=authorizer-utils-stub.generator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authorizer-utils-stub.generator.js","sourceRoot":"","sources":["../../../../src/generators/auth/authorizer-utils-stub/authorizer-utils-stub.generator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC3E,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,sCAAsC,IAAI,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAErG,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AAEtC;;;;GAIG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,eAAe,CAAC;IAC1D,IAAI,EAAE,8BAA8B;IACpC,gBAAgB,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG;IACjC,gBAAgB;IAChB,UAAU,EAAE,GAAG,EAAE,CAAC,CAAC;QACjB,KAAK,EAAE,mBAAmB,CAAC,KAAK,CAAC,IAAI;QACrC,OAAO,EAAE,mBAAmB,CAAC,OAAO,CAAC,IAAI;QACzC,SAAS,EAAE,mBAAmB,CAAC,SAAS,CAAC,IAAI;QAC7C,IAAI,EAAE,mBAAmB,CAAC;YACxB,YAAY,EAAE;gBACZ,SAAS,EAAE,mBAAmB,CAAC,SAAS,CAAC,QAAQ;aAClD;YACD,GAAG,CAAC,EAAE,SAAS,EAAE;gBACf,OAAO;oBACL,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;wBACvB,MAAM,OAAO,CAAC,KAAK,CACjB,SAAS,CAAC,SAAS,CAAC,MAAM,CAAC;4BACzB,SAAS,EAAE,EAAE;yBACd,CAAC,CACH,CAAC;oBACJ,CAAC;iBACF,CAAC;YACJ,CAAC;SACF,CAAC;KACH,CAAC;CACH,CAAC,CAAC"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
export declare const PRISMA_AUTHORIZER_UTILS_STUB_GENERATED: {
|
|
2
|
+
imports: {
|
|
3
|
+
task: import("@baseplate-dev/sync").GeneratorTask<{
|
|
4
|
+
authorizerUtilsImports: import("@baseplate-dev/sync").ProviderExport<import("@baseplate-dev/core-generators").InferTsImportMapFromSchema<{
|
|
5
|
+
checkGlobalAuthorization: {};
|
|
6
|
+
checkInstanceAuthorization: {};
|
|
7
|
+
GlobalRoleCheck: {
|
|
8
|
+
isTypeOnly: true;
|
|
9
|
+
};
|
|
10
|
+
InstanceRoleCheck: {
|
|
11
|
+
isTypeOnly: true;
|
|
12
|
+
};
|
|
13
|
+
}>>;
|
|
14
|
+
}, {
|
|
15
|
+
paths: import("@baseplate-dev/sync").ProviderType<import("./template-paths.js").PrismaAuthorizerUtilsStubPaths>;
|
|
16
|
+
}, undefined>;
|
|
17
|
+
};
|
|
18
|
+
paths: {
|
|
19
|
+
provider: import("@baseplate-dev/sync").ProviderType<import("./template-paths.js").PrismaAuthorizerUtilsStubPaths>;
|
|
20
|
+
task: import("@baseplate-dev/sync").GeneratorTask<{
|
|
21
|
+
prismaAuthorizerUtilsStubPaths: import("@baseplate-dev/sync").ProviderExport<import("./template-paths.js").PrismaAuthorizerUtilsStubPaths>;
|
|
22
|
+
}, {
|
|
23
|
+
packageInfo: import("@baseplate-dev/sync").ProviderType<import("@baseplate-dev/core-generators").PackageInfoProvider>;
|
|
24
|
+
}, undefined>;
|
|
25
|
+
};
|
|
26
|
+
renderers: {
|
|
27
|
+
provider: import("@baseplate-dev/sync").ProviderType<import("./template-renderers.js").PrismaAuthorizerUtilsStubRenderers>;
|
|
28
|
+
task: import("@baseplate-dev/sync").GeneratorTask<{
|
|
29
|
+
prismaAuthorizerUtilsStubRenderers: import("@baseplate-dev/sync").ProviderExport<import("./template-renderers.js").PrismaAuthorizerUtilsStubRenderers>;
|
|
30
|
+
}, {
|
|
31
|
+
errorHandlerServiceImports: import("@baseplate-dev/sync").ProviderType<import("@baseplate-dev/core-generators").InferTsImportMapFromSchema<{
|
|
32
|
+
BadRequestError: {};
|
|
33
|
+
ForbiddenError: {};
|
|
34
|
+
handleZodRequestValidationError: {};
|
|
35
|
+
HttpError: {};
|
|
36
|
+
InternalServerError: {};
|
|
37
|
+
logError: {};
|
|
38
|
+
NotFoundError: {};
|
|
39
|
+
UnauthorizedError: {};
|
|
40
|
+
}>>;
|
|
41
|
+
paths: import("@baseplate-dev/sync").ProviderType<import("./template-paths.js").PrismaAuthorizerUtilsStubPaths>;
|
|
42
|
+
serviceContextImports: import("@baseplate-dev/sync").ProviderType<import("@baseplate-dev/core-generators").InferTsImportMapFromSchema<{
|
|
43
|
+
createServiceContext: {};
|
|
44
|
+
createSystemServiceContext: {};
|
|
45
|
+
createTestServiceContext: {};
|
|
46
|
+
ServiceContext: {
|
|
47
|
+
isTypeOnly: true;
|
|
48
|
+
};
|
|
49
|
+
}>>;
|
|
50
|
+
typescriptFile: import("@baseplate-dev/sync").ProviderType<import("@baseplate-dev/core-generators").TypescriptFileProvider>;
|
|
51
|
+
}, undefined>;
|
|
52
|
+
};
|
|
53
|
+
templates: {
|
|
54
|
+
mainGroup: {
|
|
55
|
+
utilsAuthorizers: import("@baseplate-dev/core-generators").TsTemplateFile<{}, {
|
|
56
|
+
errorHandlerServiceImports: import("@baseplate-dev/sync").ProviderType<import("@baseplate-dev/core-generators").InferTsImportMapFromSchema<{
|
|
57
|
+
BadRequestError: {};
|
|
58
|
+
ForbiddenError: {};
|
|
59
|
+
handleZodRequestValidationError: {};
|
|
60
|
+
HttpError: {};
|
|
61
|
+
InternalServerError: {};
|
|
62
|
+
logError: {};
|
|
63
|
+
NotFoundError: {};
|
|
64
|
+
UnauthorizedError: {};
|
|
65
|
+
}>>;
|
|
66
|
+
serviceContextImports: import("@baseplate-dev/sync").ProviderType<import("@baseplate-dev/core-generators").InferTsImportMapFromSchema<{
|
|
67
|
+
createServiceContext: {};
|
|
68
|
+
createSystemServiceContext: {};
|
|
69
|
+
createTestServiceContext: {};
|
|
70
|
+
ServiceContext: {
|
|
71
|
+
isTypeOnly: true;
|
|
72
|
+
};
|
|
73
|
+
}>>;
|
|
74
|
+
}, Record<never, Record<never, never>>>;
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/generators/auth/authorizer-utils-stub/generated/index.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,sCAAsC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAKlD,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { PRISMA_AUTHORIZER_UTILS_STUB_PATHS } from './template-paths.js';
|
|
2
|
+
import { PRISMA_AUTHORIZER_UTILS_STUB_RENDERERS } from './template-renderers.js';
|
|
3
|
+
import { PRISMA_AUTHORIZER_UTILS_STUB_IMPORTS } from './ts-import-providers.js';
|
|
4
|
+
import { PRISMA_AUTHORIZER_UTILS_STUB_TEMPLATES } from './typed-templates.js';
|
|
5
|
+
export const PRISMA_AUTHORIZER_UTILS_STUB_GENERATED = {
|
|
6
|
+
imports: PRISMA_AUTHORIZER_UTILS_STUB_IMPORTS,
|
|
7
|
+
paths: PRISMA_AUTHORIZER_UTILS_STUB_PATHS,
|
|
8
|
+
renderers: PRISMA_AUTHORIZER_UTILS_STUB_RENDERERS,
|
|
9
|
+
templates: PRISMA_AUTHORIZER_UTILS_STUB_TEMPLATES,
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/generators/auth/authorizer-utils-stub/generated/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kCAAkC,EAAE,MAAM,qBAAqB,CAAC;AACzE,OAAO,EAAE,sCAAsC,EAAE,MAAM,yBAAyB,CAAC;AACjF,OAAO,EAAE,oCAAoC,EAAE,MAAM,0BAA0B,CAAC;AAChF,OAAO,EAAE,sCAAsC,EAAE,MAAM,sBAAsB,CAAC;AAE9E,MAAM,CAAC,MAAM,sCAAsC,GAAG;IACpD,OAAO,EAAE,oCAAoC;IAC7C,KAAK,EAAE,kCAAkC;IACzC,SAAS,EAAE,sCAAsC;IACjD,SAAS,EAAE,sCAAsC;CAClD,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface PrismaAuthorizerUtilsStubPaths {
|
|
2
|
+
utilsAuthorizers: string;
|
|
3
|
+
}
|
|
4
|
+
export declare const PRISMA_AUTHORIZER_UTILS_STUB_PATHS: {
|
|
5
|
+
provider: import("@baseplate-dev/sync").ProviderType<PrismaAuthorizerUtilsStubPaths>;
|
|
6
|
+
task: import("@baseplate-dev/sync").GeneratorTask<{
|
|
7
|
+
prismaAuthorizerUtilsStubPaths: import("@baseplate-dev/sync").ProviderExport<PrismaAuthorizerUtilsStubPaths>;
|
|
8
|
+
}, {
|
|
9
|
+
packageInfo: import("@baseplate-dev/sync").ProviderType<import("@baseplate-dev/core-generators").PackageInfoProvider>;
|
|
10
|
+
}, undefined>;
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=template-paths.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"template-paths.d.ts","sourceRoot":"","sources":["../../../../../src/generators/auth/authorizer-utils-stub/generated/template-paths.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,8BAA8B;IAC7C,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAyBD,eAAO,MAAM,kCAAkC;;;;;;;CAG9C,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { packageInfoProvider } from '@baseplate-dev/core-generators';
|
|
2
|
+
import { createGeneratorTask, createProviderType } from '@baseplate-dev/sync';
|
|
3
|
+
const prismaAuthorizerUtilsStubPaths = createProviderType('prisma-authorizer-utils-stub-paths');
|
|
4
|
+
const prismaAuthorizerUtilsStubPathsTask = createGeneratorTask({
|
|
5
|
+
dependencies: { packageInfo: packageInfoProvider },
|
|
6
|
+
exports: {
|
|
7
|
+
prismaAuthorizerUtilsStubPaths: prismaAuthorizerUtilsStubPaths.export(),
|
|
8
|
+
},
|
|
9
|
+
run({ packageInfo }) {
|
|
10
|
+
const srcRoot = packageInfo.getPackageSrcPath();
|
|
11
|
+
return {
|
|
12
|
+
providers: {
|
|
13
|
+
prismaAuthorizerUtilsStubPaths: {
|
|
14
|
+
utilsAuthorizers: `${srcRoot}/utils/authorizers.ts`,
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
export const PRISMA_AUTHORIZER_UTILS_STUB_PATHS = {
|
|
21
|
+
provider: prismaAuthorizerUtilsStubPaths,
|
|
22
|
+
task: prismaAuthorizerUtilsStubPathsTask,
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=template-paths.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"template-paths.js","sourceRoot":"","sources":["../../../../../src/generators/auth/authorizer-utils-stub/generated/template-paths.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAM9E,MAAM,8BAA8B,GAClC,kBAAkB,CAChB,oCAAoC,CACrC,CAAC;AAEJ,MAAM,kCAAkC,GAAG,mBAAmB,CAAC;IAC7D,YAAY,EAAE,EAAE,WAAW,EAAE,mBAAmB,EAAE;IAClD,OAAO,EAAE;QACP,8BAA8B,EAAE,8BAA8B,CAAC,MAAM,EAAE;KACxE;IACD,GAAG,CAAC,EAAE,WAAW,EAAE;QACjB,MAAM,OAAO,GAAG,WAAW,CAAC,iBAAiB,EAAE,CAAC;QAEhD,OAAO;YACL,SAAS,EAAE;gBACT,8BAA8B,EAAE;oBAC9B,gBAAgB,EAAE,GAAG,OAAO,uBAAuB;iBACpD;aACF;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,kCAAkC,GAAG;IAChD,QAAQ,EAAE,8BAA8B;IACxC,IAAI,EAAE,kCAAkC;CACzC,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { RenderTsTemplateGroupActionInput } from '@baseplate-dev/core-generators';
|
|
2
|
+
import type { BuilderAction } from '@baseplate-dev/sync';
|
|
3
|
+
import { PRISMA_AUTHORIZER_UTILS_STUB_TEMPLATES } from './typed-templates.js';
|
|
4
|
+
export interface PrismaAuthorizerUtilsStubRenderers {
|
|
5
|
+
mainGroup: {
|
|
6
|
+
render: (options: Omit<RenderTsTemplateGroupActionInput<typeof PRISMA_AUTHORIZER_UTILS_STUB_TEMPLATES.mainGroup>, 'importMapProviders' | 'group' | 'paths' | 'generatorPaths'>) => BuilderAction;
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
export declare const PRISMA_AUTHORIZER_UTILS_STUB_RENDERERS: {
|
|
10
|
+
provider: import("@baseplate-dev/sync").ProviderType<PrismaAuthorizerUtilsStubRenderers>;
|
|
11
|
+
task: import("@baseplate-dev/sync").GeneratorTask<{
|
|
12
|
+
prismaAuthorizerUtilsStubRenderers: import("@baseplate-dev/sync").ProviderExport<PrismaAuthorizerUtilsStubRenderers>;
|
|
13
|
+
}, {
|
|
14
|
+
errorHandlerServiceImports: import("@baseplate-dev/sync").ProviderType<import("@baseplate-dev/core-generators").InferTsImportMapFromSchema<{
|
|
15
|
+
BadRequestError: {};
|
|
16
|
+
ForbiddenError: {};
|
|
17
|
+
handleZodRequestValidationError: {};
|
|
18
|
+
HttpError: {};
|
|
19
|
+
InternalServerError: {};
|
|
20
|
+
logError: {};
|
|
21
|
+
NotFoundError: {};
|
|
22
|
+
UnauthorizedError: {};
|
|
23
|
+
}>>;
|
|
24
|
+
paths: import("@baseplate-dev/sync").ProviderType<import("./template-paths.js").PrismaAuthorizerUtilsStubPaths>;
|
|
25
|
+
serviceContextImports: import("@baseplate-dev/sync").ProviderType<import("@baseplate-dev/core-generators").InferTsImportMapFromSchema<{
|
|
26
|
+
createServiceContext: {};
|
|
27
|
+
createSystemServiceContext: {};
|
|
28
|
+
createTestServiceContext: {};
|
|
29
|
+
ServiceContext: {
|
|
30
|
+
isTypeOnly: true;
|
|
31
|
+
};
|
|
32
|
+
}>>;
|
|
33
|
+
typescriptFile: import("@baseplate-dev/sync").ProviderType<import("@baseplate-dev/core-generators").TypescriptFileProvider>;
|
|
34
|
+
}, undefined>;
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=template-renderers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"template-renderers.d.ts","sourceRoot":"","sources":["../../../../../src/generators/auth/authorizer-utils-stub/generated/template-renderers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,gCAAgC,CAAC;AACvF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AASzD,OAAO,EAAE,sCAAsC,EAAE,MAAM,sBAAsB,CAAC;AAE9E,MAAM,WAAW,kCAAkC;IACjD,SAAS,EAAE;QACT,MAAM,EAAE,CACN,OAAO,EAAE,IAAI,CACX,gCAAgC,CAC9B,OAAO,sCAAsC,CAAC,SAAS,CACxD,EACD,oBAAoB,GAAG,OAAO,GAAG,OAAO,GAAG,gBAAgB,CAC5D,KACE,aAAa,CAAC;KACpB,CAAC;CACH;AA6CD,eAAO,MAAM,sCAAsC;;;;;;;;;;;;;;;;;;;;;;;;;;CAGlD,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { typescriptFileProvider } from '@baseplate-dev/core-generators';
|
|
2
|
+
import { createGeneratorTask, createProviderType } from '@baseplate-dev/sync';
|
|
3
|
+
import { errorHandlerServiceImportsProvider } from '#src/generators/core/error-handler-service/generated/ts-import-providers.js';
|
|
4
|
+
import { serviceContextImportsProvider } from '#src/generators/core/service-context/generated/ts-import-providers.js';
|
|
5
|
+
import { PRISMA_AUTHORIZER_UTILS_STUB_PATHS } from './template-paths.js';
|
|
6
|
+
import { PRISMA_AUTHORIZER_UTILS_STUB_TEMPLATES } from './typed-templates.js';
|
|
7
|
+
const prismaAuthorizerUtilsStubRenderers = createProviderType('prisma-authorizer-utils-stub-renderers');
|
|
8
|
+
const prismaAuthorizerUtilsStubRenderersTask = createGeneratorTask({
|
|
9
|
+
dependencies: {
|
|
10
|
+
errorHandlerServiceImports: errorHandlerServiceImportsProvider,
|
|
11
|
+
paths: PRISMA_AUTHORIZER_UTILS_STUB_PATHS.provider,
|
|
12
|
+
serviceContextImports: serviceContextImportsProvider,
|
|
13
|
+
typescriptFile: typescriptFileProvider,
|
|
14
|
+
},
|
|
15
|
+
exports: {
|
|
16
|
+
prismaAuthorizerUtilsStubRenderers: prismaAuthorizerUtilsStubRenderers.export(),
|
|
17
|
+
},
|
|
18
|
+
run({ errorHandlerServiceImports, paths, serviceContextImports, typescriptFile, }) {
|
|
19
|
+
return {
|
|
20
|
+
providers: {
|
|
21
|
+
prismaAuthorizerUtilsStubRenderers: {
|
|
22
|
+
mainGroup: {
|
|
23
|
+
render: (options) => typescriptFile.renderTemplateGroup({
|
|
24
|
+
group: PRISMA_AUTHORIZER_UTILS_STUB_TEMPLATES.mainGroup,
|
|
25
|
+
paths,
|
|
26
|
+
importMapProviders: {
|
|
27
|
+
errorHandlerServiceImports,
|
|
28
|
+
serviceContextImports,
|
|
29
|
+
},
|
|
30
|
+
...options,
|
|
31
|
+
}),
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
export const PRISMA_AUTHORIZER_UTILS_STUB_RENDERERS = {
|
|
39
|
+
provider: prismaAuthorizerUtilsStubRenderers,
|
|
40
|
+
task: prismaAuthorizerUtilsStubRenderersTask,
|
|
41
|
+
};
|
|
42
|
+
//# sourceMappingURL=template-renderers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"template-renderers.js","sourceRoot":"","sources":["../../../../../src/generators/auth/authorizer-utils-stub/generated/template-renderers.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAE9E,OAAO,EAAE,kCAAkC,EAAE,MAAM,6EAA6E,CAAC;AACjI,OAAO,EAAE,6BAA6B,EAAE,MAAM,uEAAuE,CAAC;AAEtH,OAAO,EAAE,kCAAkC,EAAE,MAAM,qBAAqB,CAAC;AACzE,OAAO,EAAE,sCAAsC,EAAE,MAAM,sBAAsB,CAAC;AAe9E,MAAM,kCAAkC,GACtC,kBAAkB,CAChB,wCAAwC,CACzC,CAAC;AAEJ,MAAM,sCAAsC,GAAG,mBAAmB,CAAC;IACjE,YAAY,EAAE;QACZ,0BAA0B,EAAE,kCAAkC;QAC9D,KAAK,EAAE,kCAAkC,CAAC,QAAQ;QAClD,qBAAqB,EAAE,6BAA6B;QACpD,cAAc,EAAE,sBAAsB;KACvC;IACD,OAAO,EAAE;QACP,kCAAkC,EAChC,kCAAkC,CAAC,MAAM,EAAE;KAC9C;IACD,GAAG,CAAC,EACF,0BAA0B,EAC1B,KAAK,EACL,qBAAqB,EACrB,cAAc,GACf;QACC,OAAO;YACL,SAAS,EAAE;gBACT,kCAAkC,EAAE;oBAClC,SAAS,EAAE;wBACT,MAAM,EAAE,CAAC,OAAO,EAAE,EAAE,CAClB,cAAc,CAAC,mBAAmB,CAAC;4BACjC,KAAK,EAAE,sCAAsC,CAAC,SAAS;4BACvD,KAAK;4BACL,kBAAkB,EAAE;gCAClB,0BAA0B;gCAC1B,qBAAqB;6BACtB;4BACD,GAAG,OAAO;yBACX,CAAC;qBACL;iBACF;aACF;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,sCAAsC,GAAG;IACpD,QAAQ,EAAE,kCAAkC;IAC5C,IAAI,EAAE,sCAAsC;CAC7C,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare const PRISMA_AUTHORIZER_UTILS_STUB_IMPORTS: {
|
|
2
|
+
task: import("@baseplate-dev/sync").GeneratorTask<{
|
|
3
|
+
authorizerUtilsImports: import("@baseplate-dev/sync").ProviderExport<import("@baseplate-dev/core-generators").InferTsImportMapFromSchema<{
|
|
4
|
+
checkGlobalAuthorization: {};
|
|
5
|
+
checkInstanceAuthorization: {};
|
|
6
|
+
GlobalRoleCheck: {
|
|
7
|
+
isTypeOnly: true;
|
|
8
|
+
};
|
|
9
|
+
InstanceRoleCheck: {
|
|
10
|
+
isTypeOnly: true;
|
|
11
|
+
};
|
|
12
|
+
}>>;
|
|
13
|
+
}, {
|
|
14
|
+
paths: import("@baseplate-dev/sync").ProviderType<import("./template-paths.js").PrismaAuthorizerUtilsStubPaths>;
|
|
15
|
+
}, undefined>;
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=ts-import-providers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ts-import-providers.d.ts","sourceRoot":"","sources":["../../../../../src/generators/auth/authorizer-utils-stub/generated/ts-import-providers.ts"],"names":[],"mappings":"AAqCA,eAAO,MAAM,oCAAoC;;;;;;;;;;;;;;;CAEhD,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { createTsImportMap, packageScope, } from '@baseplate-dev/core-generators';
|
|
2
|
+
import { createGeneratorTask } from '@baseplate-dev/sync';
|
|
3
|
+
import { authorizerUtilsImportsProvider, authorizerUtilsImportsSchema, } from '#src/generators/auth/_providers/authorizer-utils-imports.js';
|
|
4
|
+
import { PRISMA_AUTHORIZER_UTILS_STUB_PATHS } from './template-paths.js';
|
|
5
|
+
const prismaAuthorizerUtilsStubImportsTask = createGeneratorTask({
|
|
6
|
+
dependencies: {
|
|
7
|
+
paths: PRISMA_AUTHORIZER_UTILS_STUB_PATHS.provider,
|
|
8
|
+
},
|
|
9
|
+
exports: {
|
|
10
|
+
authorizerUtilsImports: authorizerUtilsImportsProvider.export(packageScope),
|
|
11
|
+
},
|
|
12
|
+
run({ paths }) {
|
|
13
|
+
return {
|
|
14
|
+
providers: {
|
|
15
|
+
authorizerUtilsImports: createTsImportMap(authorizerUtilsImportsSchema, {
|
|
16
|
+
checkGlobalAuthorization: paths.utilsAuthorizers,
|
|
17
|
+
checkInstanceAuthorization: paths.utilsAuthorizers,
|
|
18
|
+
GlobalRoleCheck: paths.utilsAuthorizers,
|
|
19
|
+
InstanceRoleCheck: paths.utilsAuthorizers,
|
|
20
|
+
}),
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
export const PRISMA_AUTHORIZER_UTILS_STUB_IMPORTS = {
|
|
26
|
+
task: prismaAuthorizerUtilsStubImportsTask,
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=ts-import-providers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ts-import-providers.js","sourceRoot":"","sources":["../../../../../src/generators/auth/authorizer-utils-stub/generated/ts-import-providers.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,YAAY,GACb,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAE1D,OAAO,EACL,8BAA8B,EAC9B,4BAA4B,GAC7B,MAAM,6DAA6D,CAAC;AAErE,OAAO,EAAE,kCAAkC,EAAE,MAAM,qBAAqB,CAAC;AAEzE,MAAM,oCAAoC,GAAG,mBAAmB,CAAC;IAC/D,YAAY,EAAE;QACZ,KAAK,EAAE,kCAAkC,CAAC,QAAQ;KACnD;IACD,OAAO,EAAE;QACP,sBAAsB,EAAE,8BAA8B,CAAC,MAAM,CAAC,YAAY,CAAC;KAC5E;IACD,GAAG,CAAC,EAAE,KAAK,EAAE;QACX,OAAO;YACL,SAAS,EAAE;gBACT,sBAAsB,EAAE,iBAAiB,CACvC,4BAA4B,EAC5B;oBACE,wBAAwB,EAAE,KAAK,CAAC,gBAAgB;oBAChD,0BAA0B,EAAE,KAAK,CAAC,gBAAgB;oBAClD,eAAe,EAAE,KAAK,CAAC,gBAAgB;oBACvC,iBAAiB,EAAE,KAAK,CAAC,gBAAgB;iBAC1C,CACF;aACF;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,oCAAoC,GAAG;IAClD,IAAI,EAAE,oCAAoC;CAC3C,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
export declare const mainGroup: {
|
|
2
|
+
utilsAuthorizers: import("@baseplate-dev/core-generators").TsTemplateFile<{}, {
|
|
3
|
+
errorHandlerServiceImports: import("@baseplate-dev/sync").ProviderType<import("@baseplate-dev/core-generators").InferTsImportMapFromSchema<{
|
|
4
|
+
BadRequestError: {};
|
|
5
|
+
ForbiddenError: {};
|
|
6
|
+
handleZodRequestValidationError: {};
|
|
7
|
+
HttpError: {};
|
|
8
|
+
InternalServerError: {};
|
|
9
|
+
logError: {};
|
|
10
|
+
NotFoundError: {};
|
|
11
|
+
UnauthorizedError: {};
|
|
12
|
+
}>>;
|
|
13
|
+
serviceContextImports: import("@baseplate-dev/sync").ProviderType<import("@baseplate-dev/core-generators").InferTsImportMapFromSchema<{
|
|
14
|
+
createServiceContext: {};
|
|
15
|
+
createSystemServiceContext: {};
|
|
16
|
+
createTestServiceContext: {};
|
|
17
|
+
ServiceContext: {
|
|
18
|
+
isTypeOnly: true;
|
|
19
|
+
};
|
|
20
|
+
}>>;
|
|
21
|
+
}, Record<never, Record<never, never>>>;
|
|
22
|
+
};
|
|
23
|
+
export declare const PRISMA_AUTHORIZER_UTILS_STUB_TEMPLATES: {
|
|
24
|
+
mainGroup: {
|
|
25
|
+
utilsAuthorizers: import("@baseplate-dev/core-generators").TsTemplateFile<{}, {
|
|
26
|
+
errorHandlerServiceImports: import("@baseplate-dev/sync").ProviderType<import("@baseplate-dev/core-generators").InferTsImportMapFromSchema<{
|
|
27
|
+
BadRequestError: {};
|
|
28
|
+
ForbiddenError: {};
|
|
29
|
+
handleZodRequestValidationError: {};
|
|
30
|
+
HttpError: {};
|
|
31
|
+
InternalServerError: {};
|
|
32
|
+
logError: {};
|
|
33
|
+
NotFoundError: {};
|
|
34
|
+
UnauthorizedError: {};
|
|
35
|
+
}>>;
|
|
36
|
+
serviceContextImports: import("@baseplate-dev/sync").ProviderType<import("@baseplate-dev/core-generators").InferTsImportMapFromSchema<{
|
|
37
|
+
createServiceContext: {};
|
|
38
|
+
createSystemServiceContext: {};
|
|
39
|
+
createTestServiceContext: {};
|
|
40
|
+
ServiceContext: {
|
|
41
|
+
isTypeOnly: true;
|
|
42
|
+
};
|
|
43
|
+
}>>;
|
|
44
|
+
}, Record<never, Record<never, never>>>;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
//# sourceMappingURL=typed-templates.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typed-templates.d.ts","sourceRoot":"","sources":["../../../../../src/generators/auth/authorizer-utils-stub/generated/typed-templates.ts"],"names":[],"mappings":"AA6BA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;CAAuB,CAAC;AAE9C,eAAO,MAAM,sCAAsC;;;;;;;;;;;;;;;;;;;;;;;CAAgB,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { createTsTemplateFile } from '@baseplate-dev/core-generators';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { errorHandlerServiceImportsProvider } from '#src/generators/core/error-handler-service/generated/ts-import-providers.js';
|
|
4
|
+
import { serviceContextImportsProvider } from '#src/generators/core/service-context/generated/ts-import-providers.js';
|
|
5
|
+
const utilsAuthorizers = createTsTemplateFile({
|
|
6
|
+
fileOptions: { kind: 'singleton' },
|
|
7
|
+
group: 'main',
|
|
8
|
+
importMapProviders: {
|
|
9
|
+
errorHandlerServiceImports: errorHandlerServiceImportsProvider,
|
|
10
|
+
serviceContextImports: serviceContextImportsProvider,
|
|
11
|
+
},
|
|
12
|
+
name: 'utils-authorizers',
|
|
13
|
+
projectExports: {
|
|
14
|
+
checkGlobalAuthorization: { isTypeOnly: false },
|
|
15
|
+
checkInstanceAuthorization: { isTypeOnly: false },
|
|
16
|
+
GlobalRoleCheck: { isTypeOnly: true },
|
|
17
|
+
InstanceRoleCheck: { isTypeOnly: true },
|
|
18
|
+
},
|
|
19
|
+
source: {
|
|
20
|
+
path: path.join(import.meta.dirname, '../templates/src/utils/authorizers.ts'),
|
|
21
|
+
},
|
|
22
|
+
variables: {},
|
|
23
|
+
});
|
|
24
|
+
export const mainGroup = { utilsAuthorizers };
|
|
25
|
+
export const PRISMA_AUTHORIZER_UTILS_STUB_TEMPLATES = { mainGroup };
|
|
26
|
+
//# sourceMappingURL=typed-templates.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typed-templates.js","sourceRoot":"","sources":["../../../../../src/generators/auth/authorizer-utils-stub/generated/typed-templates.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AACtE,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,kCAAkC,EAAE,MAAM,6EAA6E,CAAC;AACjI,OAAO,EAAE,6BAA6B,EAAE,MAAM,uEAAuE,CAAC;AAEtH,MAAM,gBAAgB,GAAG,oBAAoB,CAAC;IAC5C,WAAW,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE;IAClC,KAAK,EAAE,MAAM;IACb,kBAAkB,EAAE;QAClB,0BAA0B,EAAE,kCAAkC;QAC9D,qBAAqB,EAAE,6BAA6B;KACrD;IACD,IAAI,EAAE,mBAAmB;IACzB,cAAc,EAAE;QACd,wBAAwB,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE;QAC/C,0BAA0B,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE;QACjD,eAAe,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE;QACrC,iBAAiB,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE;KACxC;IACD,MAAM,EAAE;QACN,IAAI,EAAE,IAAI,CAAC,IAAI,CACb,MAAM,CAAC,IAAI,CAAC,OAAO,EACnB,uCAAuC,CACxC;KACF;IACD,SAAS,EAAE,EAAE;CACd,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,SAAS,GAAG,EAAE,gBAAgB,EAAE,CAAC;AAE9C,MAAM,CAAC,MAAM,sCAAsC,GAAG,EAAE,SAAS,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/generators/auth/authorizer-utils-stub/index.ts"],"names":[],"mappings":"AAAA,cAAc,sCAAsC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/generators/auth/authorizer-utils-stub/index.ts"],"names":[],"mappings":"AAAA,cAAc,sCAAsC,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
|
|
3
|
+
import type { ServiceContext } from '%serviceContextImports';
|
|
4
|
+
|
|
5
|
+
import { ForbiddenError } from '%errorHandlerServiceImports';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Global role check.
|
|
9
|
+
*/
|
|
10
|
+
export type GlobalRoleCheck = (ctx: ServiceContext) => boolean;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Instance role check - requires the model instance.
|
|
14
|
+
* Used for checking ownership or other instance-specific permissions.
|
|
15
|
+
*/
|
|
16
|
+
export type InstanceRoleCheck<TInstance> = (
|
|
17
|
+
ctx: ServiceContext,
|
|
18
|
+
instance: TInstance,
|
|
19
|
+
) => Promise<boolean> | boolean;
|
|
20
|
+
|
|
21
|
+
// ============================================================================
|
|
22
|
+
// Authorization Check Helpers
|
|
23
|
+
// ============================================================================
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Global authorization checks.
|
|
27
|
+
*/
|
|
28
|
+
export function checkGlobalAuthorization(
|
|
29
|
+
ctx: ServiceContext,
|
|
30
|
+
authorize: GlobalRoleCheck[],
|
|
31
|
+
): void {
|
|
32
|
+
for (const check of authorize) {
|
|
33
|
+
if (check(ctx)) return;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
throw new ForbiddenError('Forbidden');
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Instance authorization.
|
|
41
|
+
*/
|
|
42
|
+
export async function checkInstanceAuthorization<T>(
|
|
43
|
+
ctx: ServiceContext,
|
|
44
|
+
instance: T | (() => Promise<T>),
|
|
45
|
+
authorize: (InstanceRoleCheck<T> | GlobalRoleCheck)[],
|
|
46
|
+
): Promise<void> {
|
|
47
|
+
const resolvedInstance =
|
|
48
|
+
typeof instance === 'function'
|
|
49
|
+
? await (instance as () => Promise<T>)()
|
|
50
|
+
: instance;
|
|
51
|
+
|
|
52
|
+
// Run instance checks
|
|
53
|
+
for (const check of authorize) {
|
|
54
|
+
if (await check(ctx, resolvedInstance)) return;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
throw new ForbiddenError('Forbidden');
|
|
58
|
+
}
|
|
@@ -2,6 +2,7 @@ export * from './_providers/index.js';
|
|
|
2
2
|
export * from './auth-context/index.js';
|
|
3
3
|
export * from './auth-plugin/index.js';
|
|
4
4
|
export * from './auth-roles/index.js';
|
|
5
|
+
export * from './authorizer-utils-stub/index.js';
|
|
5
6
|
export * from './password-hasher-service/index.js';
|
|
6
7
|
export * from './placeholder-auth-service/index.js';
|
|
7
8
|
export * from './user-session-types/index.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/generators/auth/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,oCAAoC,CAAC;AACnD,cAAc,qCAAqC,CAAC;AACpD,cAAc,+BAA+B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/generators/auth/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,kCAAkC,CAAC;AACjD,cAAc,oCAAoC,CAAC;AACnD,cAAc,qCAAqC,CAAC;AACpD,cAAc,+BAA+B,CAAC"}
|