@diia-inhouse/scaffold 2.24.0 → 2.52.2

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 (116) hide show
  1. package/LICENCE.md +59 -59
  2. package/dist/_sharedTemplates/actionTest.t +11 -10
  3. package/dist/_templates/add/action/01-action.ts.t +6 -3
  4. package/dist/_templates/add/action/01-test.ts.t +1 -33
  5. package/dist/_templates/add/action/prompt.js +18 -9
  6. package/dist/_templates/add/action/prompt.js.map +1 -1
  7. package/dist/_templates/add/eventListener/01-event.ts.t +2 -2
  8. package/dist/_templates/add/generator/prompt.js +2 -1
  9. package/dist/_templates/add/generator/prompt.js.map +1 -1
  10. package/dist/_templates/add/model/01-interfaces.model.ts.t +1 -1
  11. package/dist/_templates/add/model/01-model.ts.t +1 -1
  12. package/dist/_templates/add/test/prompt.js +2 -1
  13. package/dist/_templates/add/test/prompt.js.map +1 -1
  14. package/dist/_templates/add/view/01-index.ts.t +7 -0
  15. package/dist/_templates/add/view/01-interface.ts.t +11 -0
  16. package/dist/_templates/add/view/01-view.ts.t +15 -0
  17. package/dist/_templates/add/view/02-scriptRunner.t +3 -0
  18. package/dist/_templates/add/view/prompt.js +30 -0
  19. package/dist/_templates/add/view/prompt.js.map +1 -0
  20. package/dist/_templates/init/admin/01-adminActionsService.ts.t +26 -0
  21. package/dist/_templates/init/admin/01-adminExecuteCustom.ts.t +34 -0
  22. package/dist/_templates/init/admin/01-adminExecuteCustomInterface.ts.t +10 -0
  23. package/dist/_templates/init/admin/01-adminExecuteQuery.ts.t +22 -0
  24. package/dist/_templates/init/admin/01-adminExecuteQueryInterface.ts.t +10 -0
  25. package/dist/_templates/init/admin/01-adminGetMeta.ts.t +22 -0
  26. package/dist/_templates/init/admin/01-adminGetMetaInterface.ts.t +7 -0
  27. package/dist/_templates/init/admin/01-adminService.ts.t +23 -0
  28. package/dist/_templates/init/admin/02-scriptRunner.ts.t +3 -0
  29. package/dist/_templates/init/admin/prompt.js +76 -0
  30. package/dist/_templates/init/admin/prompt.js.map +1 -0
  31. package/dist/_templates/init/matchers/01-matcher.ts.t +1 -1
  32. package/dist/_templates/init/matchers/01-vitest.d.ts.t +16 -0
  33. package/dist/_templates/init/matchers/02-scriptRunner.ts.t +1 -1
  34. package/dist/_templates/init/matchers/prompt.js +23 -17
  35. package/dist/_templates/init/matchers/prompt.js.map +1 -1
  36. package/dist/_templates/init/package/01-.gitignore.t +6 -0
  37. package/dist/_templates/init/package/01-.gitlab-ci.yml.t +7 -6
  38. package/dist/_templates/init/package/01-codeowners.t +5 -0
  39. package/dist/_templates/init/package/01-eslint.config.mjs.t +22 -0
  40. package/dist/_templates/init/package/01-package.json.t +8 -17
  41. package/dist/_templates/init/package/01-readme.md.t +4 -0
  42. package/dist/_templates/init/package/01-test.tsconfig.json.t +5 -1
  43. package/dist/_templates/init/package/01-vitest.config.mts.t +19 -0
  44. package/dist/_templates/init/package/prompt.js +8 -2
  45. package/dist/_templates/init/package/prompt.js.map +1 -1
  46. package/dist/_templates/init/service/01-.env.example.t +24 -19
  47. package/dist/_templates/init/service/01-.env.test.t +3 -0
  48. package/dist/_templates/init/service/01-.gitignore.t +1 -0
  49. package/dist/_templates/init/service/01-.gitlab-ci.yml.t +3 -7
  50. package/dist/_templates/init/service/01-.prettierignore.t +1 -0
  51. package/dist/_templates/init/service/01-codeowners.t +5 -0
  52. package/dist/_templates/init/service/01-eslint.config.mjs.t +21 -0
  53. package/dist/_templates/init/service/01-package.json.t +14 -28
  54. package/dist/_templates/init/service/01-proto.service.proto.t +15 -1
  55. package/dist/_templates/init/service/01-readme.md.t +11 -0
  56. package/dist/_templates/init/service/01-src.actions.v1.getAddResult.ts.t +12 -2
  57. package/dist/_templates/init/service/01-src.bootstrap.ts.t +5 -4
  58. package/dist/_templates/init/service/01-src.configs.config.ts.t +150 -0
  59. package/dist/_templates/init/service/01-src.configs.logger.ts.t +11 -0
  60. package/dist/_templates/init/service/01-src.configs.queue.ts.t +46 -0
  61. package/dist/_templates/init/service/01-src.deps.ts.t +1 -1
  62. package/dist/_templates/init/service/01-src.index.ts.t +3 -4
  63. package/dist/_templates/init/service/01-src.interfaces.config.ts.t +1 -1
  64. package/dist/_templates/init/service/01-src.interfaces.queue.ts.t +23 -0
  65. package/dist/_templates/init/service/01-src.services.add.ts.t +9 -0
  66. package/dist/_templates/init/service/01-src.views.exampleViews.index.ts.t +7 -0
  67. package/dist/_templates/init/service/01-src.views.exampleViews.interface.ts.t +11 -0
  68. package/dist/_templates/init/service/01-src.views.exampleViews.view.ts.t +15 -0
  69. package/dist/_templates/init/service/01-tests.integration.actionts.getAddResult.spec.ts.t +4 -12
  70. package/dist/_templates/init/service/01-tests.interfaces.ts.t +3 -0
  71. package/dist/_templates/init/service/01-tests.tsconfig.json.t +6 -2
  72. package/dist/_templates/init/service/01-tests.utils.getApp.ts.t +18 -5
  73. package/dist/_templates/init/service/01-tests.vitest.d.ts.t +11 -0
  74. package/dist/_templates/init/service/01-tsconfig.json.t +2 -2
  75. package/dist/_templates/init/service/01-vitest.config.mts.t +42 -0
  76. package/dist/_templates/init/service/02-scriptRunner.ts.t +1 -1
  77. package/dist/_templates/init/service/prompt.js +44 -5
  78. package/dist/_templates/init/service/prompt.js.map +1 -1
  79. package/dist/_templates/init/temporal/01-worker.activity.activity-example.ts.t +14 -0
  80. package/dist/_templates/init/temporal/01-worker.activity.index.ts.t +9 -0
  81. package/dist/_templates/init/temporal/01-worker.index.ts.t +32 -0
  82. package/dist/_templates/init/temporal/01-worker.workflow.index.ts.t +9 -0
  83. package/dist/_templates/init/temporal/01-worker.workflow.workflow-example.ts.t +25 -0
  84. package/dist/_templates/init/temporal/02-scriptRunner.ts.t +3 -0
  85. package/dist/_templates/init/temporal/prompt.js +15 -0
  86. package/dist/_templates/init/temporal/prompt.js.map +1 -0
  87. package/dist/depsNames.js +28 -27
  88. package/dist/depsNames.js.map +1 -1
  89. package/dist/index.js +2 -2
  90. package/dist/index.js.map +1 -1
  91. package/dist/interfaces/_templates/add/view.js +3 -0
  92. package/dist/interfaces/_templates/add/view.js.map +1 -0
  93. package/dist/interfaces/_templates/init/admin.js +3 -0
  94. package/dist/interfaces/_templates/init/admin.js.map +1 -0
  95. package/dist/interfaces/_templates/init/matcher.js +6 -6
  96. package/dist/interfaces/_templates/init/service.js +3 -8
  97. package/dist/interfaces/_templates/init/service.js.map +1 -1
  98. package/dist/interfaces/_templates/init/temporal.js +3 -0
  99. package/dist/interfaces/_templates/init/temporal.js.map +1 -0
  100. package/dist/prompt/autocomplete.js +1 -3
  101. package/dist/prompt/autocomplete.js.map +1 -1
  102. package/dist/prompt/select/baseSelect.js +1 -3
  103. package/dist/prompt/select/baseSelect.js.map +1 -1
  104. package/dist/prompt/select/multiselect.js +1 -3
  105. package/dist/prompt/select/multiselect.js.map +1 -1
  106. package/dist/prompt/select/yesNoSelect.js +1 -2
  107. package/dist/prompt/select/yesNoSelect.js.map +1 -1
  108. package/dist/utils.js +3 -4
  109. package/dist/utils.js.map +1 -1
  110. package/package.json +17 -19
  111. package/dist/_templates/init/matchers/01-jest.d.ts.t +0 -16
  112. package/dist/_templates/init/package/01-.eslintignore.t +0 -7
  113. package/dist/_templates/init/service/01-.eslintignore.t +0 -9
  114. package/dist/_templates/init/service/01-dockerfile.t +0 -38
  115. package/dist/_templates/init/service/01-src.config.ts.t +0 -163
  116. package/dist/_templates/init/service/01-tests.jest.d.ts.t +0 -5
package/LICENCE.md CHANGED
@@ -18,40 +18,40 @@ or has expressed by any other means his willingness to license under the EUPL.
18
18
 
19
19
  In this Licence, the following terms have the following meaning:
20
20
 
21
- - ‘The Licence’: this Licence.
21
+ - ‘The Licence’: this Licence.
22
22
 
23
- - ‘The Original Work’: the work or software distributed or communicated by the
24
- Licensor under this Licence, available as Source Code and also as Executable
25
- Code as the case may be.
23
+ - ‘The Original Work’: the work or software distributed or communicated by the
24
+ Licensor under this Licence, available as Source Code and also as Executable
25
+ Code as the case may be.
26
26
 
27
- - ‘Derivative Works’: the works or software that could be created by the
28
- Licensee, based upon the Original Work or modifications thereof. This Licence
29
- does not define the extent of modification or dependence on the Original Work
30
- required in order to classify a work as a Derivative Work; this extent is
31
- determined by copyright law applicable in the country mentioned in Article 15.
27
+ - ‘Derivative Works’: the works or software that could be created by the
28
+ Licensee, based upon the Original Work or modifications thereof. This Licence
29
+ does not define the extent of modification or dependence on the Original Work
30
+ required in order to classify a work as a Derivative Work; this extent is
31
+ determined by copyright law applicable in the country mentioned in Article 15.
32
32
 
33
- - ‘The Work’: the Original Work or its Derivative Works.
33
+ - ‘The Work’: the Original Work or its Derivative Works.
34
34
 
35
- - ‘The Source Code’: the human-readable form of the Work which is the most
36
- convenient for people to study and modify.
35
+ - ‘The Source Code’: the human-readable form of the Work which is the most
36
+ convenient for people to study and modify.
37
37
 
38
- - ‘The Executable Code’: any code which has generally been compiled and which is
39
- meant to be interpreted by a computer as a program.
38
+ - ‘The Executable Code’: any code which has generally been compiled and which is
39
+ meant to be interpreted by a computer as a program.
40
40
 
41
- - ‘The Licensor’: the natural or legal person that distributes or communicates
42
- the Work under the Licence.
41
+ - ‘The Licensor’: the natural or legal person that distributes or communicates
42
+ the Work under the Licence.
43
43
 
44
- - ‘Contributor(s)’: any natural or legal person who modifies the Work under the
45
- Licence, or otherwise contributes to the creation of a Derivative Work.
44
+ - ‘Contributor(s)’: any natural or legal person who modifies the Work under the
45
+ Licence, or otherwise contributes to the creation of a Derivative Work.
46
46
 
47
- - ‘The Licensee’ or ‘You’: any natural or legal person who makes any usage of
48
- the Work under the terms of the Licence.
47
+ - ‘The Licensee’ or ‘You’: any natural or legal person who makes any usage of
48
+ the Work under the terms of the Licence.
49
49
 
50
- - ‘Distribution’ or ‘Communication’: any act of selling, giving, lending,
51
- renting, distributing, communicating, transmitting, or otherwise making
52
- available, online or offline, copies of the Work or providing access to its
53
- essential functionalities at the disposal of any other natural or legal
54
- person.
50
+ - ‘Distribution’ or ‘Communication’: any act of selling, giving, lending,
51
+ renting, distributing, communicating, transmitting, or otherwise making
52
+ available, online or offline, copies of the Work or providing access to its
53
+ essential functionalities at the disposal of any other natural or legal
54
+ person.
55
55
 
56
56
  2. Scope of the rights granted by the Licence
57
57
 
@@ -59,15 +59,15 @@ The Licensor hereby grants You a worldwide, royalty-free, non-exclusive,
59
59
  sublicensable licence to do the following, for the duration of copyright vested
60
60
  in the Original Work:
61
61
 
62
- - use the Work in any circumstance and for all usage,
63
- - reproduce the Work,
64
- - modify the Work, and make Derivative Works based upon the Work,
65
- - communicate to the public, including the right to make available or display
66
- the Work or copies thereof to the public and perform publicly, as the case may
67
- be, the Work,
68
- - distribute the Work or copies thereof,
69
- - lend and rent the Work or copies thereof,
70
- - sublicense rights in the Work or copies thereof.
62
+ - use the Work in any circumstance and for all usage,
63
+ - reproduce the Work,
64
+ - modify the Work, and make Derivative Works based upon the Work,
65
+ - communicate to the public, including the right to make available or display
66
+ the Work or copies thereof to the public and perform publicly, as the case may
67
+ be, the Work,
68
+ - distribute the Work or copies thereof,
69
+ - lend and rent the Work or copies thereof,
70
+ - sublicense rights in the Work or copies thereof.
71
71
 
72
72
  Those rights can be exercised on any media, supports and formats, whether now
73
73
  known or later invented, as far as the applicable law permits so.
@@ -240,43 +240,43 @@ their choice.
240
240
 
241
241
  Without prejudice to specific agreement between parties,
242
242
 
243
- - any litigation resulting from the interpretation of this License, arising
244
- between the European Union institutions, bodies, offices or agencies, as a
245
- Licensor, and any Licensee, will be subject to the jurisdiction of the Court
246
- of Justice of the European Union, as laid down in article 272 of the Treaty on
247
- the Functioning of the European Union,
243
+ - any litigation resulting from the interpretation of this License, arising
244
+ between the European Union institutions, bodies, offices or agencies, as a
245
+ Licensor, and any Licensee, will be subject to the jurisdiction of the Court
246
+ of Justice of the European Union, as laid down in article 272 of the Treaty on
247
+ the Functioning of the European Union,
248
248
 
249
- - any litigation arising between other parties and resulting from the
250
- interpretation of this License, will be subject to the exclusive jurisdiction
251
- of the competent court where the Licensor resides or conducts its primary
252
- business.
249
+ - any litigation arising between other parties and resulting from the
250
+ interpretation of this License, will be subject to the exclusive jurisdiction
251
+ of the competent court where the Licensor resides or conducts its primary
252
+ business.
253
253
 
254
254
  15. Applicable Law
255
255
 
256
256
  Without prejudice to specific agreement between parties,
257
257
 
258
- - this Licence shall be governed by the law of the European Union Member State
259
- where the Licensor has his seat, resides or has his registered office,
258
+ - this Licence shall be governed by the law of the European Union Member State
259
+ where the Licensor has his seat, resides or has his registered office,
260
260
 
261
- - this licence shall be governed by Belgian law if the Licensor has no seat,
262
- residence or registered office inside a European Union Member State.
261
+ - this licence shall be governed by Belgian law if the Licensor has no seat,
262
+ residence or registered office inside a European Union Member State.
263
263
 
264
264
  Appendix
265
265
 
266
266
  ‘Compatible Licences’ according to Article 5 EUPL are:
267
267
 
268
- - GNU General Public License (GPL) v. 2, v. 3
269
- - GNU Affero General Public License (AGPL) v. 3
270
- - Open Software License (OSL) v. 2.1, v. 3.0
271
- - Eclipse Public License (EPL) v. 1.0
272
- - CeCILL v. 2.0, v. 2.1
273
- - Mozilla Public Licence (MPL) v. 2
274
- - GNU Lesser General Public Licence (LGPL) v. 2.1, v. 3
275
- - Creative Commons Attribution-ShareAlike v. 3.0 Unported (CC BY-SA 3.0) for
276
- works other than software
277
- - European Union Public Licence (EUPL) v. 1.1, v. 1.2
278
- - Québec Free and Open-Source Licence — Reciprocity (LiLiQ-R) or Strong
279
- Reciprocity (LiLiQ-R+).
268
+ - GNU General Public License (GPL) v. 2, v. 3
269
+ - GNU Affero General Public License (AGPL) v. 3
270
+ - Open Software License (OSL) v. 2.1, v. 3.0
271
+ - Eclipse Public License (EPL) v. 1.0
272
+ - CeCILL v. 2.0, v. 2.1
273
+ - Mozilla Public Licence (MPL) v. 2
274
+ - GNU Lesser General Public Licence (LGPL) v. 2.1, v. 3
275
+ - Creative Commons Attribution-ShareAlike v. 3.0 Unported (CC BY-SA 3.0) for
276
+ works other than software
277
+ - European Union Public Licence (EUPL) v. 1.1, v. 1.2
278
+ - Québec Free and Open-Source Licence — Reciprocity (LiLiQ-R) or Strong
279
+ Reciprocity (LiLiQ-R+).
280
280
 
281
281
  The European Commission may update this Appendix to later versions of the above
282
282
  licences without producing a new version of the EUPL, as long as they provide
@@ -1,3 +1,7 @@
1
+ import { clientCallOptions } from '@diia-inhouse/diia-app'
2
+
3
+ import { GrpcClient } from '@src/generated'
4
+
1
5
  import TestKit from '@diia-inhouse/test'
2
6
 
3
7
  import <%= h.changeCase.pascal(name) %>Action from '<%= relateActionPathFromTest %>'
@@ -8,29 +12,26 @@ import { ActionResult } from '<%= relativeInterfacePath %>'
8
12
 
9
13
  describe(`Action ${<%= h.changeCase.pascal(name) %>Action.name}`, () => {
10
14
  let app: Awaited<ReturnType<typeof getApp>>
11
-
12
- let action: <%= h.changeCase.pascal(name) %>Action
15
+ let grpcClient: GrpcClient
13
16
 
14
17
  const testKit = new TestKit()
15
18
 
16
19
  beforeAll(async () => {
17
20
  app = await getApp()
18
- action = app.container.build(<%= h.changeCase.pascal(name) %>Action)
19
- })
20
-
21
- afterAll(async () => {
22
- await app.stop()
21
+ grpcClient = app.container.resolve('grpcClient')
23
22
  })
24
23
 
25
24
  it('should *ExpectedBehavior* when *StateUnderTest*', async () => {
26
25
  // Arrange
27
- const headers = testKit.session.getHeaders()
28
26
  const session = testKit.session.getUserSession()
29
27
 
30
28
  // Act
31
- const result = await action.handler({session, headers, params: {}})
29
+ const result = await grpcClient.<%= name %>(
30
+ {},
31
+ clientCallOptions({ session }),
32
+ )
32
33
 
33
34
  // Assert
34
35
  expect(result).toEqual<ActionResult>({})
35
36
  })
36
- })
37
+ })
@@ -3,6 +3,7 @@ to: <%= actionPath %>
3
3
  ---
4
4
 
5
5
  import { GrpcAppAction } from '@diia-inhouse/diia-app'
6
+ import { SessionType } from '@diia-inhouse/types'
6
7
 
7
8
  <% if (isActionWithValidation) { %>
8
9
  import { ValidationSchema } from '@diia-inhouse/validators'
@@ -11,14 +12,16 @@ import { GrpcAppAction } from '@diia-inhouse/diia-app'
11
12
  import { ActionResult, Context } from '<%= relativeInterfacePath %>'
12
13
 
13
14
  export default class <%= h.changeCase.pascal(name) %>Action implements GrpcAppAction<Context> {
14
- constructor(private readonly service: unknown) {}
15
+ readonly name = '<%= name %>'
15
16
 
16
- readonly name: string = '<%= name %>'
17
+ readonly sessionType = SessionType.None
17
18
 
18
19
  <% if (isActionWithValidation) { %>
19
20
  readonly validationRules: ValidationSchema<Context['params']> = {}
20
21
  <% } %>
21
-
22
+
23
+ constructor(private readonly service: unknown) {}
24
+
22
25
  async handler(args: Context): Promise<ActionResult> {
23
26
  const {
24
27
  params: {},
@@ -1,37 +1,5 @@
1
1
  ---
2
2
  to: <%= testPath %>
3
3
  ---
4
- import TestKit from '@diia-inhouse/test'
5
4
 
6
- import <%= h.changeCase.pascal(name) %>Action from '<%= relateActionPathFromTest %>'
7
-
8
- import { getApp } from '@tests/utils/getApp'
9
-
10
- import { ActionResult } from '<%= relativeInterfacePath %>'
11
-
12
- describe(`Action ${<%= h.changeCase.pascal(name) %>Action.name}`, () => {
13
- let app: Awaited<ReturnType<typeof getApp>>
14
- let action: <%= h.changeCase.pascal(name) %>Action
15
- const testKit = new TestKit()
16
-
17
- beforeAll(async () => {
18
- app = await getApp()
19
- action = app.container.build(<%= h.changeCase.pascal(name) %>Action)
20
- })
21
-
22
- afterAll(async () => {
23
- await app.stop()
24
- })
25
-
26
- it('should *ExpectedBehavior* when *StateUnderTest*', async () => {
27
- // Arrange
28
- const headers = testKit.session.getHeaders()
29
- const session = testKit.session.getUserSession()
30
-
31
- // Act
32
- const result = await action.handler({session, headers, params: {}})
33
-
34
- // Assert
35
- expect(result).toEqual<ActionResult>({})
36
- })
37
- })
5
+ <%- include(sharedTemplatePath, {name, relativeInterfacePath, relateActionPathFromTest}) %>
@@ -5,17 +5,22 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const node_fs_1 = __importDefault(require("node:fs"));
7
7
  const node_path_1 = __importDefault(require("node:path"));
8
+ const chalk_1 = __importDefault(require("chalk"));
8
9
  const prompt_1 = require("../../../prompt");
10
+ const utils_1 = require("../../../utils");
9
11
  const ROOT_ACTION = '.';
10
12
  const NEW_FOLDER = 'new-folder';
11
13
  function getActionsFolder(versionFolder) {
12
14
  const actionVersionFolderPath = node_path_1.default.resolve(process.cwd(), 'src/actions', versionFolder);
13
- const isActionVersionFolderExists = node_fs_1.default.existsSync(actionVersionFolderPath);
15
+ // eslint-disable-next-line security/detect-non-literal-fs-filename
16
+ const isActionVersionFolderExists = node_fs_1.default.existsSync(actionVersionFolderPath); // nosemgrep: eslint.detect-non-literal-fs-filename
14
17
  if (!isActionVersionFolderExists) {
15
- node_fs_1.default.mkdirSync(actionVersionFolderPath, { recursive: true });
18
+ // eslint-disable-next-line security/detect-non-literal-fs-filename
19
+ node_fs_1.default.mkdirSync(actionVersionFolderPath, { recursive: true }); // nosemgrep: eslint.detect-non-literal-fs-filename
16
20
  return [ROOT_ACTION, NEW_FOLDER];
17
21
  }
18
- const actionFolders = node_fs_1.default
22
+ // eslint-disable-next-line security/detect-non-literal-fs-filename
23
+ const actionFolders = node_fs_1.default // nosemgrep: eslint.detect-non-literal-fs-filename
19
24
  .readdirSync(actionVersionFolderPath, { withFileTypes: true })
20
25
  .filter((entity) => entity.isDirectory())
21
26
  .map((directory) => directory.name);
@@ -38,13 +43,17 @@ exports.default = {
38
43
  format: (value) => `v${value}`,
39
44
  });
40
45
  const normalizedVersion = `v${version}`;
41
- let actionFolder = await (0, prompt_1.promptAutoComplete)({
46
+ const actionFolder = await (0, prompt_1.promptAutoComplete)({
42
47
  name: 'actionFolder',
43
- message: `Pick folder where do you want create new action \n
44
- ${ROOT_ACTION} -> create new action in src/actions \n
45
- ${NEW_FOLDER} -> create new folder with your action in src/actions \n`,
48
+ message: 'Pick folder where do you want create new action \n' +
49
+ chalk_1.default.green(`${ROOT_ACTION} -> create new action in src/actions \n`) +
50
+ chalk_1.default.blue(`${NEW_FOLDER} -> create new folder with your action in src/actions \n`),
46
51
  choices: getActionsFolder(normalizedVersion),
47
52
  });
53
+ let newActionPath = node_path_1.default.join(normalizedVersion, actionFolder, actionName);
54
+ if (actionFolder === ROOT_ACTION) {
55
+ newActionPath = node_path_1.default.join(normalizedVersion, actionName);
56
+ }
48
57
  if (actionFolder === NEW_FOLDER) {
49
58
  const { newFolderName } = await prompter.prompt({
50
59
  type: 'input',
@@ -52,9 +61,8 @@ exports.default = {
52
61
  message: 'Please, enter new folder name',
53
62
  required: true,
54
63
  });
55
- actionFolder = newFolderName === normalizedVersion ? newFolderName : node_path_1.default.join(normalizedVersion, newFolderName);
64
+ newActionPath = node_path_1.default.join(normalizedVersion, newFolderName, actionName);
56
65
  }
57
- const newActionPath = actionFolder === ROOT_ACTION ? node_path_1.default.join(normalizedVersion, actionName) : node_path_1.default.join(normalizedVersion, actionFolder, actionName);
58
66
  const finalActionPath = node_path_1.default.resolve(process.cwd(), 'src/actions', `${newActionPath}.ts`);
59
67
  const finalInterfacePath = node_path_1.default.resolve(process.cwd(), 'src/interfaces/actions', `${newActionPath}.ts`);
60
68
  const relativeInterfacePath = node_path_1.default.join('@interfaces/actions', newActionPath);
@@ -64,6 +72,7 @@ exports.default = {
64
72
  message: 'Do you need validation?',
65
73
  });
66
74
  return {
75
+ sharedTemplatePath: (0, utils_1.getSharedTemplate)('actionTest.t'),
67
76
  name: actionName,
68
77
  version,
69
78
  actionPath: finalActionPath,
@@ -1 +1 @@
1
- {"version":3,"file":"prompt.js","sourceRoot":"","sources":["../../../../src/_templates/add/action/prompt.ts"],"names":[],"mappings":";;;;;AAAA,sDAAwB;AACxB,0DAA4B;AAI5B,4CAAuE;AAEvE,MAAM,WAAW,GAAG,GAAG,CAAA;AACvB,MAAM,UAAU,GAAG,YAAY,CAAA;AAE/B,SAAS,gBAAgB,CAAC,aAAqB;IAC3C,MAAM,uBAAuB,GAAG,mBAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EA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;YACR,wBAAwB;SAC3B,CAAA;IACL,CAAC;CACJ,CAAA"}
@@ -8,11 +8,11 @@ import { ValidationSchema } from '@diia-inhouse/validators'
8
8
  import { EventPayload } from '@interfaces/eventListeners/<%= h.changeCase.camel(eventEnumKey) %>'
9
9
 
10
10
  export default class <%= eventEnumKey %>EventListener implements EventBusListener {
11
- constructor(private readonly service: unknown) {}
12
-
13
11
  readonly event: InternalEvent = InternalEvent.<%= eventEnumKey %>
14
12
 
15
13
  readonly validationRules: ValidationSchema<EventPayload> = {}
14
+
15
+ constructor(private readonly service: unknown) {}
16
16
 
17
17
  async handler(message: EventPayload): Promise<void> {}
18
18
  }
@@ -9,7 +9,8 @@ const prompt_1 = require("../../../prompt");
9
9
  const NEW_GENERATOR_TYPE = 'new-type';
10
10
  function getGeneratorTypes() {
11
11
  const generatorsPath = node_path_1.default.resolve(process.cwd(), 'src/_templates');
12
- const generators = node_fs_1.default
12
+ // eslint-disable-next-line security/detect-non-literal-fs-filename
13
+ const generators = node_fs_1.default // nosemgrep: eslint.detect-non-literal-fs-filename
13
14
  .readdirSync(generatorsPath, { withFileTypes: true })
14
15
  .filter((entity) => entity.isDirectory())
15
16
  .map((directory) => directory.name);
@@ -1 +1 @@
1
- {"version":3,"file":"prompt.js","sourceRoot":"","sources":["../../../../src/_templates/add/generator/prompt.ts"],"names":[],"mappings":";;;;;AAAA,sDAAwB;AACxB,0DAA4B;AAI5B,4CAAqE;AAErE,MAAM,kBAAkB,GAAG,UAAU,CAAA;AAErC,SAAS,iBAAiB;IACtB,MAAM,cAAc,GAAG,mBAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,gBAAgB,CAAC,CAAA;IAEpE,MAAM,UAAU,GAAG,iBAAE;SAChB,WAAW,CAAC,cAAc,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC;SACpD,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC;SACxC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@diia-inhouse/db'
5
5
 
6
6
  export interface <%= h.changeCase.pascal(name) %> {}
7
7
 
@@ -2,7 +2,7 @@
2
2
  to: <%= modelPath %>
3
3
  ---
4
4
 
5
- import { Model, Schema, model, models } from 'mongoose'
5
+ import { Model, Schema, model, models } from '@diia-inhouse/db'
6
6
 
7
7
  import {
8
8
  <%= h.changeCase.pascal(name) %>
@@ -11,7 +11,8 @@ async function walker() {
11
11
  const acc = [];
12
12
  const rootActionsFolderPath = node_path_1.default.resolve(process.cwd(), 'src/actions');
13
13
  const fn = async (currentFolderPath) => {
14
- const readdirResult = node_fs_1.default.readdirSync(currentFolderPath, { withFileTypes: true });
14
+ // eslint-disable-next-line security/detect-non-literal-fs-filename
15
+ const readdirResult = node_fs_1.default.readdirSync(currentFolderPath, { withFileTypes: true }); // nosemgrep: eslint.detect-non-literal-fs-filename
15
16
  for (const file of readdirResult.filter((entity) => entity.isFile())) {
16
17
  const from = node_path_1.default.resolve(process.cwd(), 'src');
17
18
  const currentFilePath = node_path_1.default.join(currentFolderPath, node_path_1.default.parse(file.name).name);
@@ -1 +1 @@
1
- {"version":3,"file":"prompt.js","sourceRoot":"","sources":["../../../../src/_templates/add/test/prompt.ts"],"names":[],"mappings":";;;;;AAAA,sDAAwB;AACxB,0DAA4B;AAG5B,+DAAiE;AACjE,0CAAkD;AAElD,KAAK,UAAU,MAAM;IACjB,MAAM,GAAG,GAAa,EAAE,CAAA;IACxB,MAAM,qBAAqB,GAAG,mBAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,aAAa,CAAC,CAAA;IAExE,MAAM,EAAE,GAAG,KAAK,EAAE,iBAAyB,EAAiB,EAAE;QAC1D,MAAM,aAAa,GAAG,iBAAE,CAAC,WAAW,CAAC,iBAAiB,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAA;QAEhF,KAAK,MAAM,IAAI,IAAI,aAAa,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAA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GAAG;YACX,kBAAkB,EAAE,IAAA,yBAAiB,EAAC,cAAc,CAAC;YAErD,QAAQ;YACR,IAAI,EAAE,UAAU;YAChB,qBAAqB,EAAE,6BAA6B;YACpD,wBAAwB;SAC3B,CAAA;QAED,OAAO,MAAM,CAAA;IACjB,CAAC;CACJ,CAAA"}
@@ -0,0 +1,7 @@
1
+ ---
2
+ to: <%= indexPath %>
3
+ ---
4
+
5
+ export { <%= className %> as default } from './view'
6
+
7
+ export * from './interface'
@@ -0,0 +1,11 @@
1
+ ---
2
+ to: <%= interfacePath %>
3
+ ---
4
+
5
+ import { DesignSystemResponse } from '@diia-inhouse/types'
6
+
7
+ export interface ViewParams {
8
+
9
+ }
10
+
11
+ export type ViewScreen = DesignSystemResponse
@@ -0,0 +1,15 @@
1
+ ---
2
+ to: <%= viewPath %>
3
+ ---
4
+
5
+ import { ViewParams, ViewScreen } from './interface'
6
+
7
+ export class <%= className %> {
8
+ toScreen(params: ViewParams): ViewScreen {
9
+ return {
10
+ topGroup: [],
11
+ body: [],
12
+ bottomGroup: [],
13
+ }
14
+ }
15
+ }
@@ -0,0 +1,3 @@
1
+ ---
2
+ sh: "npx prettier --write <%= viewPath %> <%= interfacePath %> <%= indexPath %>"
3
+ ---
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const node_path_1 = __importDefault(require("node:path"));
7
+ const lodash_1 = require("lodash");
8
+ function getClassName(view) {
9
+ return [...view.split(node_path_1.default.sep).map((item) => (0, lodash_1.upperFirst)(item)), 'View'].join('');
10
+ }
11
+ exports.default = {
12
+ prompt: async ({ prompter }) => {
13
+ const { view } = await prompter.prompt({
14
+ type: 'input',
15
+ name: 'view',
16
+ message: "What's your view? (confirmation, banks/list, etc.)",
17
+ required: true,
18
+ });
19
+ const viewPath = node_path_1.default.resolve(process.cwd(), 'src/views', view, 'view.ts');
20
+ const interfacePath = node_path_1.default.resolve(process.cwd(), 'src/views', view, 'interface.ts');
21
+ const indexPath = node_path_1.default.resolve(process.cwd(), 'src/views', view, 'index.ts');
22
+ return {
23
+ className: getClassName(view),
24
+ viewPath,
25
+ interfacePath,
26
+ indexPath,
27
+ };
28
+ },
29
+ };
30
+ //# sourceMappingURL=prompt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompt.js","sourceRoot":"","sources":["../../../../src/_templates/add/view/prompt.ts"],"names":[],"mappings":";;;;;AAAA,0DAA4B;AAE5B,mCAAmC;AAKnC,SAAS,YAAY,CAAC,IAAY;IAC9B,OAAO,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,mBAAI,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAA,mBAAU,EAAC,IAAI,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;AACrF,CAAC;AAED,kBAAe;IACX,MAAM,EAAE,KAAK,EAAE,EAAE,QAAQ,EAAU,EAAoB,EAAE;QACrD,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC;YACnC,IAAI,EAAE,OAAO;YACb,IAAI,EAAE,MAAM;YACZ,OAAO,EAAE,oDAAoD;YAC7D,QAAQ,EAAE,IAAI;SACjB,CAAC,CAAA;QAEF,MAAM,QAAQ,GAAG,mBAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,SAAS,CAAC,CAAA;QAC1E,MAAM,aAAa,GAAG,mBAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,cAAc,CAAC,CAAA;QACpF,MAAM,SAAS,GAAG,mBAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,UAAU,CAAC,CAAA;QAE5E,OAAO;YACH,SAAS,EAAE,YAAY,CAAC,IAAI,CAAC;YAC7B,QAAQ;YACR,aAAa;YACb,SAAS;SACZ,CAAA;IACL,CAAC;CACJ,CAAA"}
@@ -0,0 +1,26 @@
1
+ ---
2
+ to: <%= adminServicePath %>/actions.ts
3
+ ---
4
+ import { ActionAdapterInterface, z } from '@diia-inhouse/admin'
5
+
6
+ const adminUpdateEncryptedStorageSchema = z.object({
7
+ params1: z.string(),
8
+ })
9
+
10
+ const testCustomAction: ActionAdapterInterface<
11
+ 'testCustomAction',
12
+ z.infer<typeof adminUpdateEncryptedStorageSchema>
13
+ > = {
14
+ event: 'testCustomAction',
15
+ schema: adminUpdateEncryptedStorageSchema,
16
+ permissions: [],
17
+ meta: {
18
+ title: 'Test Custom Action',
19
+ description: 'Test custom action',
20
+ },
21
+ }
22
+
23
+
24
+ export const AdminActions = [
25
+ testCustomAction,
26
+ ] as const
@@ -0,0 +1,34 @@
1
+ ---
2
+ to: <%= actionPath %>/adminExecuteCustom.ts
3
+ ---
4
+
5
+ import { GrpcAppAction } from '@diia-inhouse/diia-app'
6
+
7
+ import { SessionType } from '@diia-inhouse/types'
8
+ import { ValidationSchema } from '@diia-inhouse/validators'
9
+
10
+ import AdminService from '@services/admin'
11
+
12
+ import { ActionResult, Context } from '@interfaces/actions/v1/admin/adminExecuteCustom'
13
+
14
+ export default class AdminExecuteCustomAction implements GrpcAppAction<Context> {
15
+ readonly name = 'adminExecuteCustom'
16
+
17
+ readonly sessionType = SessionType.None
18
+
19
+ readonly validationRules: ValidationSchema<Context['params']> = {
20
+ event: { type: 'string', enum: Object.keys(AdminActions) },
21
+ params: { type: 'string' },
22
+ }
23
+
24
+ constructor(private readonly adminService: AdminService) {}
25
+
26
+ async handler(args: Context): Promise<ActionResult> {
27
+ const {
28
+ params: { event, params = '' },
29
+ } = args
30
+
31
+
32
+ return await this.adminService.executeCustom(event as ExtractEvents<typeof AdminActions>, params)
33
+ }
34
+ }
@@ -0,0 +1,10 @@
1
+ ---
2
+ to: <%= interfacePath %>/adminExecuteCommand.ts
3
+ ---
4
+ import { ActionContext } from '@diia-inhouse/types'
5
+
6
+ import { AdminExecuteCustomReq, AdminExecuteCustomRes } from '@src/generated'
7
+
8
+ export type Context = ActionContext<AdminExecuteCustomReq>
9
+
10
+ export type ActionResult = AdminExecuteCustomRes
@@ -0,0 +1,22 @@
1
+ ---
2
+ to: <%= actionPath %>/adminExecuteQuery.ts
3
+ ---
4
+
5
+ import { GrpcAppAction } from '@diia-inhouse/diia-app'
6
+
7
+ import { ModelExposer } from '@diia-inhouse/pkg-admin'
8
+ import { SessionType } from '@diia-inhouse/types'
9
+
10
+ import { ActionResult, Context } from '@interfaces/actions/v1/admin/adminExecuteQuery'
11
+
12
+ export default class AdminExecuteQueryAction implements GrpcAppAction<Context> {
13
+ readonly name = 'adminExecuteQuery'
14
+
15
+ readonly sessionType = SessionType.None
16
+
17
+ constructor(private readonly modelExposer: ModelExposer) {}
18
+
19
+ async handler(args: Context): Promise<ActionResult> {
20
+ return await this.modelExposer.executeQuery(args.params.params)
21
+ }
22
+ }
@@ -0,0 +1,10 @@
1
+ ---
2
+ to: <%= interfacePath %>/adminExecuteQuery.ts
3
+ ---
4
+ import { ActionContext } from '@diia-inhouse/types'
5
+
6
+ import { AdminExecuteQueryReq, AdminExecuteQueryRes } from '@src/generated'
7
+
8
+ export type Context = ActionContext<AdminExecuteQueryReq>
9
+
10
+ export type ActionResult = AdminExecuteQueryRes