@baseplate-dev/fastify-generators 0.5.0 → 0.5.1

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.
Files changed (64) hide show
  1. package/dist/constants/fastify-packages.d.ts +1 -0
  2. package/dist/constants/fastify-packages.d.ts.map +1 -1
  3. package/dist/constants/fastify-packages.js +1 -0
  4. package/dist/constants/fastify-packages.js.map +1 -1
  5. package/dist/generators/core/app-module-setup/app-module-setup.generator.js +2 -2
  6. package/dist/generators/core/app-module-setup/app-module-setup.generator.js.map +1 -1
  7. package/dist/generators/core/fastify/fastify.generator.js +2 -1
  8. package/dist/generators/core/fastify/fastify.generator.js.map +1 -1
  9. package/dist/generators/core/fastify-cookie-context/fastify-cookie-context.generator.js +1 -1
  10. package/dist/generators/core/fastify-cookie-context/fastify-cookie-context.generator.js.map +1 -1
  11. package/dist/generators/index.d.ts +0 -1
  12. package/dist/generators/index.d.ts.map +1 -1
  13. package/dist/generators/index.js +0 -1
  14. package/dist/generators/index.js.map +1 -1
  15. package/dist/generators/prisma/_shared/build-data-helpers/generate-operation-callbacks.d.ts.map +1 -1
  16. package/dist/generators/prisma/_shared/build-data-helpers/generate-operation-callbacks.js +2 -4
  17. package/dist/generators/prisma/_shared/build-data-helpers/generate-operation-callbacks.js.map +1 -1
  18. package/dist/generators/prisma/_shared/build-data-helpers/generate-relation-build-data.d.ts +27 -39
  19. package/dist/generators/prisma/_shared/build-data-helpers/generate-relation-build-data.d.ts.map +1 -1
  20. package/dist/generators/prisma/_shared/build-data-helpers/generate-relation-build-data.js +28 -62
  21. package/dist/generators/prisma/_shared/build-data-helpers/generate-relation-build-data.js.map +1 -1
  22. package/dist/generators/prisma/_shared/crud-method/primary-key-input.d.ts +10 -0
  23. package/dist/generators/prisma/_shared/crud-method/primary-key-input.d.ts.map +1 -1
  24. package/dist/generators/prisma/_shared/crud-method/primary-key-input.js +26 -0
  25. package/dist/generators/prisma/_shared/crud-method/primary-key-input.js.map +1 -1
  26. package/dist/generators/prisma/data-utils/templates/src/utils/data-operations/define-operations.ts +139 -75
  27. package/dist/generators/prisma/data-utils/templates/src/utils/data-operations/field-definitions.ts +77 -63
  28. package/dist/generators/prisma/data-utils/templates/src/utils/data-operations/prisma-utils.ts +4 -2
  29. package/dist/generators/prisma/prisma-data-create/prisma-data-create.generator.d.ts.map +1 -1
  30. package/dist/generators/prisma/prisma-data-create/prisma-data-create.generator.js +6 -1
  31. package/dist/generators/prisma/prisma-data-create/prisma-data-create.generator.js.map +1 -1
  32. package/dist/generators/prisma/prisma-data-nested-field/nested-field-writer.d.ts.map +1 -1
  33. package/dist/generators/prisma/prisma-data-nested-field/nested-field-writer.js +10 -9
  34. package/dist/generators/prisma/prisma-data-nested-field/nested-field-writer.js.map +1 -1
  35. package/package.json +5 -5
  36. package/dist/generators/email/fastify-postmark/fastify-postmark.generator.d.ts +0 -25
  37. package/dist/generators/email/fastify-postmark/fastify-postmark.generator.d.ts.map +0 -1
  38. package/dist/generators/email/fastify-postmark/fastify-postmark.generator.js +0 -66
  39. package/dist/generators/email/fastify-postmark/fastify-postmark.generator.js.map +0 -1
  40. package/dist/generators/email/fastify-postmark/generated/index.d.ts +0 -33
  41. package/dist/generators/email/fastify-postmark/generated/index.d.ts.map +0 -1
  42. package/dist/generators/email/fastify-postmark/generated/index.js +0 -9
  43. package/dist/generators/email/fastify-postmark/generated/index.js.map +0 -1
  44. package/dist/generators/email/fastify-postmark/generated/template-paths.d.ts +0 -12
  45. package/dist/generators/email/fastify-postmark/generated/template-paths.d.ts.map +0 -1
  46. package/dist/generators/email/fastify-postmark/generated/template-paths.js +0 -22
  47. package/dist/generators/email/fastify-postmark/generated/template-paths.js.map +0 -1
  48. package/dist/generators/email/fastify-postmark/generated/template-renderers.d.ts +0 -21
  49. package/dist/generators/email/fastify-postmark/generated/template-renderers.d.ts.map +0 -1
  50. package/dist/generators/email/fastify-postmark/generated/template-renderers.js +0 -39
  51. package/dist/generators/email/fastify-postmark/generated/template-renderers.js.map +0 -1
  52. package/dist/generators/email/fastify-postmark/generated/typed-templates.d.ts +0 -11
  53. package/dist/generators/email/fastify-postmark/generated/typed-templates.d.ts.map +0 -1
  54. package/dist/generators/email/fastify-postmark/generated/typed-templates.js +0 -14
  55. package/dist/generators/email/fastify-postmark/generated/typed-templates.js.map +0 -1
  56. package/dist/generators/email/fastify-postmark/index.d.ts +0 -2
  57. package/dist/generators/email/fastify-postmark/index.d.ts.map +0 -1
  58. package/dist/generators/email/fastify-postmark/index.js +0 -2
  59. package/dist/generators/email/fastify-postmark/index.js.map +0 -1
  60. package/dist/generators/email/fastify-postmark/templates/src/services/postmark.ts +0 -60
  61. package/dist/generators/email/index.d.ts +0 -2
  62. package/dist/generators/email/index.d.ts.map +0 -1
  63. package/dist/generators/email/index.js +0 -2
  64. package/dist/generators/email/index.js.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@baseplate-dev/fastify-generators",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "Fastify generators for Baseplate",
5
5
  "keywords": [
6
6
  "fastify",
@@ -39,9 +39,9 @@
39
39
  "indent-string": "5.0.0",
40
40
  "inflection": "3.0.0",
41
41
  "zod": "^4.1.13",
42
- "@baseplate-dev/core-generators": "0.5.0",
43
- "@baseplate-dev/sync": "0.5.0",
44
- "@baseplate-dev/utils": "0.5.0"
42
+ "@baseplate-dev/core-generators": "0.5.1",
43
+ "@baseplate-dev/sync": "0.5.1",
44
+ "@baseplate-dev/utils": "0.5.1"
45
45
  },
46
46
  "devDependencies": {
47
47
  "concurrently": "9.0.1",
@@ -50,7 +50,7 @@
50
50
  "prettier": "3.6.2",
51
51
  "typescript": "5.8.3",
52
52
  "vitest": "4.0.16",
53
- "@baseplate-dev/tools": "0.5.0"
53
+ "@baseplate-dev/tools": "0.5.1"
54
54
  },
55
55
  "engines": {
56
56
  "node": "^22.0.0"
@@ -1,25 +0,0 @@
1
- export type FastifyPostmarkProvider = unknown;
2
- export declare const fastifyPostmarkProvider: import("@baseplate-dev/sync").ProviderType<unknown>;
3
- export declare const fastifyPostmarkGenerator: import("@baseplate-dev/sync").GeneratorBundleCreator<Record<string, never>, {
4
- nodePackages: import("@baseplate-dev/sync").AnyGeneratorTask;
5
- config: import("@baseplate-dev/sync").GeneratorTask<undefined, {
6
- provider: import("@baseplate-dev/sync").ProviderType<Omit<import("@baseplate-dev/utils").FieldMap<{
7
- configFields: import("@baseplate-dev/utils").MapContainer<string, import("#src/generators/core/config-service/index.js").ConfigServiceField>;
8
- }>, "getValues">>;
9
- }, undefined>;
10
- paths: import("@baseplate-dev/sync").GeneratorTask<{
11
- emailFastifyPostmarkPaths: import("@baseplate-dev/sync").ProviderExport<import("./generated/template-paths.js").EmailFastifyPostmarkPaths>;
12
- }, {
13
- packageInfo: import("@baseplate-dev/sync").ProviderType<import("@baseplate-dev/core-generators").PackageInfoProvider>;
14
- }, undefined>;
15
- main: import("@baseplate-dev/sync").GeneratorTask<{
16
- fastifyPostmark: import("@baseplate-dev/sync").ProviderExport<unknown>;
17
- }, {
18
- typescriptFile: import("@baseplate-dev/sync").ProviderType<import("@baseplate-dev/core-generators").TypescriptFileProvider>;
19
- configServiceImports: import("@baseplate-dev/sync").ProviderType<import("@baseplate-dev/core-generators").InferTsImportMapFromSchema<{
20
- config: {};
21
- }>>;
22
- paths: import("@baseplate-dev/sync").ProviderType<import("./generated/template-paths.js").EmailFastifyPostmarkPaths>;
23
- }, any>;
24
- }>;
25
- //# sourceMappingURL=fastify-postmark.generator.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fastify-postmark.generator.d.ts","sourceRoot":"","sources":["../../../../src/generators/email/fastify-postmark/fastify-postmark.generator.ts"],"names":[],"mappings":"AA0BA,MAAM,MAAM,uBAAuB,GAAG,OAAO,CAAC;AAE9C,eAAO,MAAM,uBAAuB,qDAC6B,CAAC;AAElE,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;EA6DnC,CAAC"}
@@ -1,66 +0,0 @@
1
- import { createNodePackagesTask, extractPackageVersions, packageScope, tsCodeFragment, tsImportBuilder, typescriptFileProvider, } from '@baseplate-dev/core-generators';
2
- import { createGenerator, createGeneratorTask, createProviderTask, createProviderType, } from '@baseplate-dev/sync';
3
- import { z } from 'zod';
4
- import { FASTIFY_PACKAGES } from '#src/constants/fastify-packages.js';
5
- import { configServiceImportsProvider, configServiceProvider, } from '#src/generators/core/config-service/index.js';
6
- import { EMAIL_FASTIFY_POSTMARK_GENERATED } from './generated/index.js';
7
- const descriptorSchema = z.object({});
8
- export const fastifyPostmarkProvider = createProviderType('fastify-postmark');
9
- export const fastifyPostmarkGenerator = createGenerator({
10
- name: 'email/fastify-postmark',
11
- generatorFileUrl: import.meta.url,
12
- descriptorSchema,
13
- buildTasks: () => ({
14
- nodePackages: createNodePackagesTask({
15
- prod: extractPackageVersions(FASTIFY_PACKAGES, ['postmark']),
16
- }),
17
- config: createProviderTask(configServiceProvider, (configService) => {
18
- configService.configFields.set('POSTMARK_API_TOKEN', {
19
- comment: 'Postmark API token',
20
- validator: tsCodeFragment('z.string().min(1)'),
21
- seedValue: 'POSTMARK_API_TOKEN',
22
- exampleValue: 'POSTMARK_API_TOKEN',
23
- });
24
- }),
25
- paths: EMAIL_FASTIFY_POSTMARK_GENERATED.paths.task,
26
- main: createGeneratorTask({
27
- dependencies: {
28
- typescriptFile: typescriptFileProvider,
29
- configServiceImports: configServiceImportsProvider,
30
- paths: EMAIL_FASTIFY_POSTMARK_GENERATED.paths.provider,
31
- },
32
- exports: {
33
- fastifyPostmark: fastifyPostmarkProvider.export(packageScope),
34
- },
35
- run({ typescriptFile, configServiceImports, paths }) {
36
- return {
37
- providers: {
38
- fastifyPostmark: {},
39
- },
40
- build: async (builder) => {
41
- await builder.apply(typescriptFile.renderTemplateFile({
42
- template: EMAIL_FASTIFY_POSTMARK_GENERATED.templates.postmark,
43
- destination: paths.postmark,
44
- importMapProviders: {
45
- configServiceImports,
46
- },
47
- variables: {
48
- // placeholder values for now
49
- TPL_DEFAULT_FROM: "'<DEFAULT_FROM>'",
50
- TPL_TEMPLATE_CONFIG: tsCodeFragment(`{
51
- TEST_EMAIL: {
52
- alias: 'test-email',
53
- schema: z.object({
54
- name: z.string().min(1),
55
- }),
56
- },
57
- }`, tsImportBuilder(['z']).from('zod')),
58
- },
59
- }));
60
- },
61
- };
62
- },
63
- }),
64
- }),
65
- });
66
- //# sourceMappingURL=fastify-postmark.generator.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fastify-postmark.generator.js","sourceRoot":"","sources":["../../../../src/generators/email/fastify-postmark/fastify-postmark.generator.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,sBAAsB,EACtB,YAAY,EACZ,cAAc,EACd,eAAe,EACf,sBAAsB,GACvB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AACtE,OAAO,EACL,4BAA4B,EAC5B,qBAAqB,GACtB,MAAM,8CAA8C,CAAC;AAEtD,OAAO,EAAE,gCAAgC,EAAE,MAAM,sBAAsB,CAAC;AAExE,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AAItC,MAAM,CAAC,MAAM,uBAAuB,GAClC,kBAAkB,CAA0B,kBAAkB,CAAC,CAAC;AAElE,MAAM,CAAC,MAAM,wBAAwB,GAAG,eAAe,CAAC;IACtD,IAAI,EAAE,wBAAwB;IAC9B,gBAAgB,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG;IACjC,gBAAgB;IAChB,UAAU,EAAE,GAAG,EAAE,CAAC,CAAC;QACjB,YAAY,EAAE,sBAAsB,CAAC;YACnC,IAAI,EAAE,sBAAsB,CAAC,gBAAgB,EAAE,CAAC,UAAU,CAAC,CAAC;SAC7D,CAAC;QACF,MAAM,EAAE,kBAAkB,CAAC,qBAAqB,EAAE,CAAC,aAAa,EAAE,EAAE;YAClE,aAAa,CAAC,YAAY,CAAC,GAAG,CAAC,oBAAoB,EAAE;gBACnD,OAAO,EAAE,oBAAoB;gBAC7B,SAAS,EAAE,cAAc,CAAC,mBAAmB,CAAC;gBAC9C,SAAS,EAAE,oBAAoB;gBAC/B,YAAY,EAAE,oBAAoB;aACnC,CAAC,CAAC;QACL,CAAC,CAAC;QACF,KAAK,EAAE,gCAAgC,CAAC,KAAK,CAAC,IAAI;QAClD,IAAI,EAAE,mBAAmB,CAAC;YACxB,YAAY,EAAE;gBACZ,cAAc,EAAE,sBAAsB;gBACtC,oBAAoB,EAAE,4BAA4B;gBAClD,KAAK,EAAE,gCAAgC,CAAC,KAAK,CAAC,QAAQ;aACvD;YACD,OAAO,EAAE;gBACP,eAAe,EAAE,uBAAuB,CAAC,MAAM,CAAC,YAAY,CAAC;aAC9D;YACD,GAAG,CAAC,EAAE,cAAc,EAAE,oBAAoB,EAAE,KAAK,EAAE;gBACjD,OAAO;oBACL,SAAS,EAAE;wBACT,eAAe,EAAE,EAAE;qBACpB;oBACD,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;wBACvB,MAAM,OAAO,CAAC,KAAK,CACjB,cAAc,CAAC,kBAAkB,CAAC;4BAChC,QAAQ,EAAE,gCAAgC,CAAC,SAAS,CAAC,QAAQ;4BAC7D,WAAW,EAAE,KAAK,CAAC,QAAQ;4BAC3B,kBAAkB,EAAE;gCAClB,oBAAoB;6BACrB;4BACD,SAAS,EAAE;gCACT,6BAA6B;gCAC7B,gBAAgB,EAAE,kBAAkB;gCACpC,mBAAmB,EAAE,cAAc,CACjC;;;;;;;oBAOA,EACA,eAAe,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CACnC;6BACF;yBACF,CAAC,CACH,CAAC;oBACJ,CAAC;iBACF,CAAC;YACJ,CAAC;SACF,CAAC;KACH,CAAC;CACH,CAAC,CAAC"}
@@ -1,33 +0,0 @@
1
- export declare const EMAIL_FASTIFY_POSTMARK_GENERATED: {
2
- paths: {
3
- provider: import("@baseplate-dev/sync").ProviderType<import("./template-paths.js").EmailFastifyPostmarkPaths>;
4
- task: import("@baseplate-dev/sync").GeneratorTask<{
5
- emailFastifyPostmarkPaths: import("@baseplate-dev/sync").ProviderExport<import("./template-paths.js").EmailFastifyPostmarkPaths>;
6
- }, {
7
- packageInfo: import("@baseplate-dev/sync").ProviderType<import("@baseplate-dev/core-generators").PackageInfoProvider>;
8
- }, undefined>;
9
- };
10
- renderers: {
11
- provider: import("@baseplate-dev/sync").ProviderType<import("./template-renderers.js").EmailFastifyPostmarkRenderers>;
12
- task: import("@baseplate-dev/sync").GeneratorTask<{
13
- emailFastifyPostmarkRenderers: import("@baseplate-dev/sync").ProviderExport<import("./template-renderers.js").EmailFastifyPostmarkRenderers>;
14
- }, {
15
- configServiceImports: import("@baseplate-dev/sync").ProviderType<import("@baseplate-dev/core-generators").InferTsImportMapFromSchema<{
16
- config: {};
17
- }>>;
18
- paths: import("@baseplate-dev/sync").ProviderType<import("./template-paths.js").EmailFastifyPostmarkPaths>;
19
- typescriptFile: import("@baseplate-dev/sync").ProviderType<import("@baseplate-dev/core-generators").TypescriptFileProvider>;
20
- }, undefined>;
21
- };
22
- templates: {
23
- postmark: import("@baseplate-dev/core-generators").TsTemplateFile<{
24
- TPL_DEFAULT_FROM: {};
25
- TPL_TEMPLATE_CONFIG: {};
26
- }, {
27
- configServiceImports: import("@baseplate-dev/sync").ProviderType<import("@baseplate-dev/core-generators").InferTsImportMapFromSchema<{
28
- config: {};
29
- }>>;
30
- }, Record<never, Record<never, never>>>;
31
- };
32
- };
33
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/generators/email/fastify-postmark/generated/index.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,gCAAgC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAI5C,CAAC"}
@@ -1,9 +0,0 @@
1
- import { EMAIL_FASTIFY_POSTMARK_PATHS } from './template-paths.js';
2
- import { EMAIL_FASTIFY_POSTMARK_RENDERERS } from './template-renderers.js';
3
- import { EMAIL_FASTIFY_POSTMARK_TEMPLATES } from './typed-templates.js';
4
- export const EMAIL_FASTIFY_POSTMARK_GENERATED = {
5
- paths: EMAIL_FASTIFY_POSTMARK_PATHS,
6
- renderers: EMAIL_FASTIFY_POSTMARK_RENDERERS,
7
- templates: EMAIL_FASTIFY_POSTMARK_TEMPLATES,
8
- };
9
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/generators/email/fastify-postmark/generated/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,gCAAgC,EAAE,MAAM,yBAAyB,CAAC;AAC3E,OAAO,EAAE,gCAAgC,EAAE,MAAM,sBAAsB,CAAC;AAExE,MAAM,CAAC,MAAM,gCAAgC,GAAG;IAC9C,KAAK,EAAE,4BAA4B;IACnC,SAAS,EAAE,gCAAgC;IAC3C,SAAS,EAAE,gCAAgC;CAC5C,CAAC"}
@@ -1,12 +0,0 @@
1
- export interface EmailFastifyPostmarkPaths {
2
- postmark: string;
3
- }
4
- export declare const EMAIL_FASTIFY_POSTMARK_PATHS: {
5
- provider: import("@baseplate-dev/sync").ProviderType<EmailFastifyPostmarkPaths>;
6
- task: import("@baseplate-dev/sync").GeneratorTask<{
7
- emailFastifyPostmarkPaths: import("@baseplate-dev/sync").ProviderExport<EmailFastifyPostmarkPaths>;
8
- }, {
9
- packageInfo: import("@baseplate-dev/sync").ProviderType<import("@baseplate-dev/core-generators").PackageInfoProvider>;
10
- }, undefined>;
11
- };
12
- //# sourceMappingURL=template-paths.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"template-paths.d.ts","sourceRoot":"","sources":["../../../../../src/generators/email/fastify-postmark/generated/template-paths.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,yBAAyB;IACxC,QAAQ,EAAE,MAAM,CAAC;CAClB;AAsBD,eAAO,MAAM,4BAA4B;;;;;;;CAGxC,CAAC"}
@@ -1,22 +0,0 @@
1
- import { packageInfoProvider } from '@baseplate-dev/core-generators';
2
- import { createGeneratorTask, createProviderType } from '@baseplate-dev/sync';
3
- const emailFastifyPostmarkPaths = createProviderType('email-fastify-postmark-paths');
4
- const emailFastifyPostmarkPathsTask = createGeneratorTask({
5
- dependencies: { packageInfo: packageInfoProvider },
6
- exports: { emailFastifyPostmarkPaths: emailFastifyPostmarkPaths.export() },
7
- run({ packageInfo }) {
8
- const srcRoot = packageInfo.getPackageSrcPath();
9
- return {
10
- providers: {
11
- emailFastifyPostmarkPaths: {
12
- postmark: `${srcRoot}/services/postmark.ts`,
13
- },
14
- },
15
- };
16
- },
17
- });
18
- export const EMAIL_FASTIFY_POSTMARK_PATHS = {
19
- provider: emailFastifyPostmarkPaths,
20
- task: emailFastifyPostmarkPathsTask,
21
- };
22
- //# sourceMappingURL=template-paths.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"template-paths.js","sourceRoot":"","sources":["../../../../../src/generators/email/fastify-postmark/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,yBAAyB,GAAG,kBAAkB,CAClD,8BAA8B,CAC/B,CAAC;AAEF,MAAM,6BAA6B,GAAG,mBAAmB,CAAC;IACxD,YAAY,EAAE,EAAE,WAAW,EAAE,mBAAmB,EAAE;IAClD,OAAO,EAAE,EAAE,yBAAyB,EAAE,yBAAyB,CAAC,MAAM,EAAE,EAAE;IAC1E,GAAG,CAAC,EAAE,WAAW,EAAE;QACjB,MAAM,OAAO,GAAG,WAAW,CAAC,iBAAiB,EAAE,CAAC;QAEhD,OAAO;YACL,SAAS,EAAE;gBACT,yBAAyB,EAAE;oBACzB,QAAQ,EAAE,GAAG,OAAO,uBAAuB;iBAC5C;aACF;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,4BAA4B,GAAG;IAC1C,QAAQ,EAAE,yBAAyB;IACnC,IAAI,EAAE,6BAA6B;CACpC,CAAC"}
@@ -1,21 +0,0 @@
1
- import type { RenderTsTemplateFileActionInput } from '@baseplate-dev/core-generators';
2
- import type { BuilderAction } from '@baseplate-dev/sync';
3
- import { EMAIL_FASTIFY_POSTMARK_TEMPLATES } from './typed-templates.js';
4
- export interface EmailFastifyPostmarkRenderers {
5
- postmark: {
6
- render: (options: Omit<RenderTsTemplateFileActionInput<typeof EMAIL_FASTIFY_POSTMARK_TEMPLATES.postmark>, 'destination' | 'importMapProviders' | 'template' | 'generatorPaths'>) => BuilderAction;
7
- };
8
- }
9
- export declare const EMAIL_FASTIFY_POSTMARK_RENDERERS: {
10
- provider: import("@baseplate-dev/sync").ProviderType<EmailFastifyPostmarkRenderers>;
11
- task: import("@baseplate-dev/sync").GeneratorTask<{
12
- emailFastifyPostmarkRenderers: import("@baseplate-dev/sync").ProviderExport<EmailFastifyPostmarkRenderers>;
13
- }, {
14
- configServiceImports: import("@baseplate-dev/sync").ProviderType<import("@baseplate-dev/core-generators").InferTsImportMapFromSchema<{
15
- config: {};
16
- }>>;
17
- paths: import("@baseplate-dev/sync").ProviderType<import("./template-paths.js").EmailFastifyPostmarkPaths>;
18
- typescriptFile: import("@baseplate-dev/sync").ProviderType<import("@baseplate-dev/core-generators").TypescriptFileProvider>;
19
- }, undefined>;
20
- };
21
- //# sourceMappingURL=template-renderers.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"template-renderers.d.ts","sourceRoot":"","sources":["../../../../../src/generators/email/fastify-postmark/generated/template-renderers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,gCAAgC,CAAC;AACtF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAQzD,OAAO,EAAE,gCAAgC,EAAE,MAAM,sBAAsB,CAAC;AAExE,MAAM,WAAW,6BAA6B;IAC5C,QAAQ,EAAE;QACR,MAAM,EAAE,CACN,OAAO,EAAE,IAAI,CACX,+BAA+B,CAC7B,OAAO,gCAAgC,CAAC,QAAQ,CACjD,EACD,aAAa,GAAG,oBAAoB,GAAG,UAAU,GAAG,gBAAgB,CACrE,KACE,aAAa,CAAC;KACpB,CAAC;CACH;AAqCD,eAAO,MAAM,gCAAgC;;;;;;;;;;;CAG5C,CAAC"}
@@ -1,39 +0,0 @@
1
- import { typescriptFileProvider } from '@baseplate-dev/core-generators';
2
- import { createGeneratorTask, createProviderType } from '@baseplate-dev/sync';
3
- import { configServiceImportsProvider } from '#src/generators/core/config-service/generated/ts-import-providers.js';
4
- import { EMAIL_FASTIFY_POSTMARK_PATHS } from './template-paths.js';
5
- import { EMAIL_FASTIFY_POSTMARK_TEMPLATES } from './typed-templates.js';
6
- const emailFastifyPostmarkRenderers = createProviderType('email-fastify-postmark-renderers');
7
- const emailFastifyPostmarkRenderersTask = createGeneratorTask({
8
- dependencies: {
9
- configServiceImports: configServiceImportsProvider,
10
- paths: EMAIL_FASTIFY_POSTMARK_PATHS.provider,
11
- typescriptFile: typescriptFileProvider,
12
- },
13
- exports: {
14
- emailFastifyPostmarkRenderers: emailFastifyPostmarkRenderers.export(),
15
- },
16
- run({ configServiceImports, paths, typescriptFile }) {
17
- return {
18
- providers: {
19
- emailFastifyPostmarkRenderers: {
20
- postmark: {
21
- render: (options) => typescriptFile.renderTemplateFile({
22
- template: EMAIL_FASTIFY_POSTMARK_TEMPLATES.postmark,
23
- destination: paths.postmark,
24
- importMapProviders: {
25
- configServiceImports,
26
- },
27
- ...options,
28
- }),
29
- },
30
- },
31
- },
32
- };
33
- },
34
- });
35
- export const EMAIL_FASTIFY_POSTMARK_RENDERERS = {
36
- provider: emailFastifyPostmarkRenderers,
37
- task: emailFastifyPostmarkRenderersTask,
38
- };
39
- //# sourceMappingURL=template-renderers.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"template-renderers.js","sourceRoot":"","sources":["../../../../../src/generators/email/fastify-postmark/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,4BAA4B,EAAE,MAAM,sEAAsE,CAAC;AAEpH,OAAO,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,gCAAgC,EAAE,MAAM,sBAAsB,CAAC;AAexE,MAAM,6BAA6B,GACjC,kBAAkB,CAChB,kCAAkC,CACnC,CAAC;AAEJ,MAAM,iCAAiC,GAAG,mBAAmB,CAAC;IAC5D,YAAY,EAAE;QACZ,oBAAoB,EAAE,4BAA4B;QAClD,KAAK,EAAE,4BAA4B,CAAC,QAAQ;QAC5C,cAAc,EAAE,sBAAsB;KACvC;IACD,OAAO,EAAE;QACP,6BAA6B,EAAE,6BAA6B,CAAC,MAAM,EAAE;KACtE;IACD,GAAG,CAAC,EAAE,oBAAoB,EAAE,KAAK,EAAE,cAAc,EAAE;QACjD,OAAO;YACL,SAAS,EAAE;gBACT,6BAA6B,EAAE;oBAC7B,QAAQ,EAAE;wBACR,MAAM,EAAE,CAAC,OAAO,EAAE,EAAE,CAClB,cAAc,CAAC,kBAAkB,CAAC;4BAChC,QAAQ,EAAE,gCAAgC,CAAC,QAAQ;4BACnD,WAAW,EAAE,KAAK,CAAC,QAAQ;4BAC3B,kBAAkB,EAAE;gCAClB,oBAAoB;6BACrB;4BACD,GAAG,OAAO;yBACX,CAAC;qBACL;iBACF;aACF;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,gCAAgC,GAAG;IAC9C,QAAQ,EAAE,6BAA6B;IACvC,IAAI,EAAE,iCAAiC;CACxC,CAAC"}
@@ -1,11 +0,0 @@
1
- export declare const EMAIL_FASTIFY_POSTMARK_TEMPLATES: {
2
- postmark: import("@baseplate-dev/core-generators").TsTemplateFile<{
3
- TPL_DEFAULT_FROM: {};
4
- TPL_TEMPLATE_CONFIG: {};
5
- }, {
6
- configServiceImports: import("@baseplate-dev/sync").ProviderType<import("@baseplate-dev/core-generators").InferTsImportMapFromSchema<{
7
- config: {};
8
- }>>;
9
- }, Record<never, Record<never, never>>>;
10
- };
11
- //# sourceMappingURL=typed-templates.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"typed-templates.d.ts","sourceRoot":"","sources":["../../../../../src/generators/email/fastify-postmark/generated/typed-templates.ts"],"names":[],"mappings":"AAkBA,eAAO,MAAM,gCAAgC;;;;;;;;;CAAe,CAAC"}
@@ -1,14 +0,0 @@
1
- import { createTsTemplateFile } from '@baseplate-dev/core-generators';
2
- import path from 'node:path';
3
- import { configServiceImportsProvider } from '#src/generators/core/config-service/generated/ts-import-providers.js';
4
- const postmark = createTsTemplateFile({
5
- fileOptions: { kind: 'singleton' },
6
- importMapProviders: { configServiceImports: configServiceImportsProvider },
7
- name: 'postmark',
8
- source: {
9
- path: path.join(import.meta.dirname, '../templates/src/services/postmark.ts'),
10
- },
11
- variables: { TPL_DEFAULT_FROM: {}, TPL_TEMPLATE_CONFIG: {} },
12
- });
13
- export const EMAIL_FASTIFY_POSTMARK_TEMPLATES = { postmark };
14
- //# sourceMappingURL=typed-templates.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"typed-templates.js","sourceRoot":"","sources":["../../../../../src/generators/email/fastify-postmark/generated/typed-templates.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AACtE,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,4BAA4B,EAAE,MAAM,sEAAsE,CAAC;AAEpH,MAAM,QAAQ,GAAG,oBAAoB,CAAC;IACpC,WAAW,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE;IAClC,kBAAkB,EAAE,EAAE,oBAAoB,EAAE,4BAA4B,EAAE;IAC1E,IAAI,EAAE,UAAU;IAChB,MAAM,EAAE;QACN,IAAI,EAAE,IAAI,CAAC,IAAI,CACb,MAAM,CAAC,IAAI,CAAC,OAAO,EACnB,uCAAuC,CACxC;KACF;IACD,SAAS,EAAE,EAAE,gBAAgB,EAAE,EAAE,EAAE,mBAAmB,EAAE,EAAE,EAAE;CAC7D,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,gCAAgC,GAAG,EAAE,QAAQ,EAAE,CAAC"}
@@ -1,2 +0,0 @@
1
- export * from './fastify-postmark.generator.js';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/generators/email/fastify-postmark/index.ts"],"names":[],"mappings":"AAAA,cAAc,iCAAiC,CAAC"}
@@ -1,2 +0,0 @@
1
- export * from './fastify-postmark.generator.js';
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/generators/email/fastify-postmark/index.ts"],"names":[],"mappings":"AAAA,cAAc,iCAAiC,CAAC"}
@@ -1,60 +0,0 @@
1
- // @ts-nocheck
2
-
3
- import { config } from '%configServiceImports';
4
- import { ServerClient } from 'postmark';
5
- import { z } from 'zod';
6
-
7
- const client = new ServerClient(config.POSTMARK_API_TOKEN);
8
-
9
- const DEFAULT_FROM = TPL_DEFAULT_FROM;
10
-
11
- interface EmailTemplateConfiguration {
12
- alias: string;
13
- schema: z.ZodType;
14
- }
15
-
16
- // helper for making strongly-typed template configs
17
- function createTemplateConfig<
18
- T extends Record<string, EmailTemplateConfiguration>,
19
- >(templateConfig: T): T {
20
- return templateConfig;
21
- }
22
-
23
- const POSTMARK_TEMPLATES = createTemplateConfig(TPL_TEMPLATE_CONFIG);
24
-
25
- export type PostmarkTemplateKey = keyof typeof POSTMARK_TEMPLATES;
26
-
27
- interface RenderAndSendTemplateInput<TemplateKey extends PostmarkTemplateKey> {
28
- templateKey: TemplateKey;
29
- data: z.infer<(typeof POSTMARK_TEMPLATES)[TemplateKey]['schema']>;
30
- from?: string;
31
- to: string;
32
- }
33
-
34
- export async function renderAndSendTemplate<
35
- TemplateKey extends PostmarkTemplateKey,
36
- >({
37
- templateKey,
38
- from,
39
- data,
40
- to,
41
- }: RenderAndSendTemplateInput<TemplateKey>): Promise<void> {
42
- if (!(templateKey in POSTMARK_TEMPLATES)) {
43
- throw new Error(`No template found for key ${templateKey}`);
44
- }
45
- const template = POSTMARK_TEMPLATES[templateKey];
46
-
47
- const validatedData = template.schema.parse(data);
48
-
49
- // Avoid sending emails in tests
50
- if (process.env.NODE_ENV === 'test') {
51
- return;
52
- }
53
-
54
- await client.sendEmailWithTemplate({
55
- From: from ?? DEFAULT_FROM,
56
- To: to,
57
- TemplateAlias: template.alias,
58
- TemplateModel: validatedData,
59
- });
60
- }
@@ -1,2 +0,0 @@
1
- export * from './fastify-postmark/index.js';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/generators/email/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC"}
@@ -1,2 +0,0 @@
1
- export * from './fastify-postmark/index.js';
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/generators/email/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC"}