@quadnix/octo-build 0.0.17 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (195) hide show
  1. package/LICENSE +661 -0
  2. package/README.md +25 -3
  3. package/dist/commands/apply/apply.command.d.ts +25 -0
  4. package/dist/commands/apply/apply.command.js +136 -0
  5. package/dist/commands/apply/apply.command.js.map +1 -0
  6. package/dist/commands/apply/index.d.ts +1 -0
  7. package/dist/commands/apply/index.js +2 -0
  8. package/dist/commands/apply/index.js.map +1 -0
  9. package/dist/commands/build/build.command.d.ts +1 -1
  10. package/dist/commands/build/build.command.js +4 -4
  11. package/dist/commands/build/build.command.js.map +1 -1
  12. package/dist/commands/build/main.d.ts +22 -0
  13. package/dist/commands/build/main.js +22 -0
  14. package/dist/commands/build/main.js.map +1 -1
  15. package/dist/commands/build/parsers/build-file.parser.d.ts +6 -0
  16. package/dist/commands/build/parsers/build-file.parser.js +6 -0
  17. package/dist/commands/build/parsers/build-file.parser.js.map +1 -1
  18. package/dist/commands/build/streams/stream-manager.d.ts +6 -0
  19. package/dist/commands/build/streams/stream-manager.js +7 -1
  20. package/dist/commands/build/streams/stream-manager.js.map +1 -1
  21. package/dist/commands/commit/commit.command.d.ts +22 -0
  22. package/dist/commands/commit/commit.command.js +94 -0
  23. package/dist/commands/commit/commit.command.js.map +1 -0
  24. package/dist/commands/commit/index.d.ts +1 -0
  25. package/dist/commands/commit/index.js +2 -0
  26. package/dist/commands/commit/index.js.map +1 -0
  27. package/dist/commands/create-anchor/create-anchor.command.js +1 -1
  28. package/dist/commands/create-anchor/create-anchor.command.js.map +1 -1
  29. package/dist/commands/create-anchor/generator-octo-anchor-template/generators/app/index.d.ts +18 -3
  30. package/dist/commands/create-anchor/generator-octo-anchor-template/generators/app/index.js +29 -11
  31. package/dist/commands/create-anchor/generator-octo-anchor-template/generators/app/index.js.map +1 -1
  32. package/dist/commands/create-anchor/generator-octo-anchor-template/generators/app/templates/anchors/anchor/anchor.schema.ts.ejs +9 -1
  33. package/dist/commands/create-app/create-app.command.d.ts +1 -1
  34. package/dist/commands/create-app/create-app.command.js +7 -3
  35. package/dist/commands/create-app/create-app.command.js.map +1 -1
  36. package/dist/commands/create-app/generator-octo-app-template/generators/app/index.d.ts +17 -1
  37. package/dist/commands/create-app/generator-octo-app-template/generators/app/index.js +59 -12
  38. package/dist/commands/create-app/generator-octo-app-template/generators/app/index.js.map +1 -1
  39. package/dist/commands/create-app/generator-octo-app-template/generators/app/templates/README.md.ejs +60 -10
  40. package/dist/commands/create-app/generator-octo-app-template/generators/app/templates/gitignore.ejs +13 -0
  41. package/dist/commands/create-app/generator-octo-app-template/generators/app/templates/index.ts.ejs +19 -0
  42. package/dist/commands/create-app/generator-octo-app-template/generators/app/templates/package.json.ejs +9 -1
  43. package/dist/commands/create-app/generator-octo-app-template/generators/app/templates/src/aws-dynamodb-service/octo.yaml.ejs +111 -0
  44. package/dist/commands/create-app/generator-octo-app-template/generators/app/templates/src/aws-ecs-server/octo.yaml.ejs +14 -0
  45. package/dist/commands/create-app/generator-octo-app-template/generators/app/templates/src/aws-s3-website/octo.yaml.ejs +14 -0
  46. package/dist/commands/create-app/generator-octo-app-template/generators/app/templates/tsconfig.json.ejs +0 -3
  47. package/dist/commands/{create-resource/create-resource.command.d.ts → create-external-resource/create-external-resource.command.d.ts} +1 -1
  48. package/dist/commands/create-external-resource/create-external-resource.command.js +64 -0
  49. package/dist/commands/create-external-resource/create-external-resource.command.js.map +1 -0
  50. package/dist/commands/{create-resource/generator-octo-resource-template → create-external-resource/generator-octo-external-resource-template}/generators/app/index.d.ts +17 -2
  51. package/dist/commands/{create-resource/generator-octo-resource-template → create-external-resource/generator-octo-external-resource-template}/generators/app/index.js +36 -35
  52. package/dist/commands/create-external-resource/generator-octo-external-resource-template/generators/app/index.js.map +1 -0
  53. package/dist/commands/{create-resource/generator-octo-resource-template → create-external-resource/generator-octo-external-resource-template}/generators/app/templates/resources/resource/actions/add.resource.action.ts.ejs +7 -16
  54. package/dist/commands/{create-resource/generator-octo-resource-template → create-external-resource/generator-octo-external-resource-template}/generators/app/templates/resources/resource/actions/delete.resource.action.ts.ejs +21 -3
  55. package/dist/commands/create-external-resource/generator-octo-external-resource-template/generators/app/templates/resources/resource/actions/update.resource.action.ts.ejs +63 -0
  56. package/dist/commands/{create-resource/generator-octo-resource-template → create-external-resource/generator-octo-external-resource-template}/generators/app/templates/resources/resource/index.ts.ejs +1 -2
  57. package/dist/commands/create-external-resource/generator-octo-external-resource-template/generators/app/templates/resources/resource/resource.ts.ejs +28 -0
  58. package/dist/commands/create-external-resource/index.d.ts +1 -0
  59. package/dist/commands/create-external-resource/index.js +2 -0
  60. package/dist/commands/create-external-resource/index.js.map +1 -0
  61. package/dist/commands/create-model/create-model.command.js +1 -1
  62. package/dist/commands/create-model/create-model.command.js.map +1 -1
  63. package/dist/commands/create-model/generator-octo-model-template/generators/app/index.d.ts +17 -2
  64. package/dist/commands/create-model/generator-octo-model-template/generators/app/index.js +26 -9
  65. package/dist/commands/create-model/generator-octo-model-template/generators/app/index.js.map +1 -1
  66. package/dist/commands/create-model/generator-octo-model-template/generators/app/templates/models/model/model.ts.ejs +3 -1
  67. package/dist/commands/create-model/generator-octo-model-template/generators/app/templates/models/model/schema.ts.ejs +6 -1
  68. package/dist/commands/create-module/create-module.command.js +1 -1
  69. package/dist/commands/create-module/create-module.command.js.map +1 -1
  70. package/dist/commands/create-module/generator-octo-module-template/generators/app/index.d.ts +17 -2
  71. package/dist/commands/create-module/generator-octo-module-template/generators/app/index.js +27 -10
  72. package/dist/commands/create-module/generator-octo-module-template/generators/app/index.js.map +1 -1
  73. package/dist/commands/create-overlay/create-overlay.command.js +4 -3
  74. package/dist/commands/create-overlay/create-overlay.command.js.map +1 -1
  75. package/dist/commands/create-overlay/generator-octo-overlay-template/generators/app/index.d.ts +17 -2
  76. package/dist/commands/create-overlay/generator-octo-overlay-template/generators/app/index.js +26 -9
  77. package/dist/commands/create-overlay/generator-octo-overlay-template/generators/app/index.js.map +1 -1
  78. package/dist/commands/{create-cdk/create-cdk.command.d.ts → create-terraform-resource/create-terraform-resource.command.d.ts} +3 -3
  79. package/dist/commands/{create-resource/create-resource.command.js → create-terraform-resource/create-terraform-resource.command.js} +17 -11
  80. package/dist/commands/create-terraform-resource/create-terraform-resource.command.js.map +1 -0
  81. package/dist/commands/create-terraform-resource/generator-octo-terraform-resource-template/generators/app/index.d.ts +25 -0
  82. package/dist/commands/create-terraform-resource/generator-octo-terraform-resource-template/generators/app/index.js +71 -0
  83. package/dist/commands/create-terraform-resource/generator-octo-terraform-resource-template/generators/app/index.js.map +1 -0
  84. package/dist/commands/create-terraform-resource/generator-octo-terraform-resource-template/generators/app/templates/resources/resource/index.schema.ts.ejs +43 -0
  85. package/dist/commands/create-terraform-resource/generator-octo-terraform-resource-template/generators/app/templates/resources/resource/index.ts.ejs +1 -0
  86. package/dist/commands/create-terraform-resource/generator-octo-terraform-resource-template/generators/app/templates/resources/resource/resource.ts.ejs +83 -0
  87. package/dist/commands/create-terraform-resource/index.d.ts +1 -0
  88. package/dist/commands/create-terraform-resource/index.js +2 -0
  89. package/dist/commands/create-terraform-resource/index.js.map +1 -0
  90. package/dist/commands/generate/generate.command.d.ts +14 -0
  91. package/dist/commands/generate/generate.command.js +35 -0
  92. package/dist/commands/generate/generate.command.js.map +1 -0
  93. package/dist/commands/generate/index.d.ts +1 -0
  94. package/dist/commands/generate/index.js +2 -0
  95. package/dist/commands/generate/index.js.map +1 -0
  96. package/dist/commands/get-response/get-response.command.d.ts +18 -0
  97. package/dist/commands/get-response/get-response.command.js +39 -0
  98. package/dist/commands/get-response/get-response.command.js.map +1 -0
  99. package/dist/commands/get-response/index.d.ts +1 -0
  100. package/dist/commands/get-response/index.js +2 -0
  101. package/dist/commands/get-response/index.js.map +1 -0
  102. package/dist/commands/lock/index.d.ts +1 -0
  103. package/dist/commands/lock/index.js +2 -0
  104. package/dist/commands/lock/index.js.map +1 -0
  105. package/dist/commands/lock/lock.command.d.ts +13 -0
  106. package/dist/commands/lock/lock.command.js +28 -0
  107. package/dist/commands/lock/lock.command.js.map +1 -0
  108. package/dist/commands/run-action/index.d.ts +1 -0
  109. package/dist/commands/run-action/index.js +2 -0
  110. package/dist/commands/run-action/index.js.map +1 -0
  111. package/dist/commands/run-action/run-action.command.d.ts +12 -0
  112. package/dist/commands/run-action/run-action.command.js +46 -0
  113. package/dist/commands/run-action/run-action.command.js.map +1 -0
  114. package/dist/commands/unlock/index.d.ts +1 -0
  115. package/dist/commands/unlock/index.js +2 -0
  116. package/dist/commands/unlock/index.js.map +1 -0
  117. package/dist/commands/unlock/unlock.command.d.ts +18 -0
  118. package/dist/commands/unlock/unlock.command.js +51 -0
  119. package/dist/commands/unlock/unlock.command.js.map +1 -0
  120. package/dist/commands/validate/index.d.ts +1 -0
  121. package/dist/commands/validate/index.js +2 -0
  122. package/dist/commands/validate/index.js.map +1 -0
  123. package/dist/commands/validate/validate.command.d.ts +17 -0
  124. package/dist/commands/validate/validate.command.js +68 -0
  125. package/dist/commands/validate/validate.command.js.map +1 -0
  126. package/dist/index.js +20 -8
  127. package/dist/index.js.map +1 -1
  128. package/dist/resources/octo-v1.schema.json +86 -19
  129. package/dist/utilities/definition/yaml/yaml-definition.utility.d.ts +98 -10
  130. package/dist/utilities/definition/yaml/yaml-definition.utility.js +197 -66
  131. package/dist/utilities/definition/yaml/yaml-definition.utility.js.map +1 -1
  132. package/dist/utilities/octo/octo.utility.d.ts +48 -0
  133. package/dist/utilities/octo/octo.utility.js +144 -0
  134. package/dist/utilities/octo/octo.utility.js.map +1 -0
  135. package/dist/utilities/process/process.utility.d.ts +8 -0
  136. package/dist/utilities/process/process.utility.js +8 -0
  137. package/dist/utilities/process/process.utility.js.map +1 -1
  138. package/dist/utilities/project-index/project-index.utility.d.ts +27 -0
  139. package/dist/utilities/project-index/project-index.utility.js +71 -0
  140. package/dist/utilities/project-index/project-index.utility.js.map +1 -0
  141. package/dist/utilities/string/string.utility.d.ts +22 -0
  142. package/dist/utilities/string/string.utility.js +27 -0
  143. package/dist/utilities/string/string.utility.js.map +1 -1
  144. package/package.json +9 -8
  145. package/dist/commands/create-cdk/create-cdk.command.js +0 -70
  146. package/dist/commands/create-cdk/create-cdk.command.js.map +0 -1
  147. package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/index.d.ts +0 -10
  148. package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/index.js +0 -107
  149. package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/index.js.map +0 -1
  150. package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/README.md.ejs +0 -23
  151. package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/eslint.config.js.ejs +0 -337
  152. package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/gitignore.ejs +0 -82
  153. package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/gitkeep.ejs +0 -0
  154. package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/package.json.ejs +0 -57
  155. package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/prettierrc.ejs +0 -5
  156. package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/src/anchors/app/app.anchor.schema.ts.ejs +0 -19
  157. package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/src/anchors/app/app.anchor.ts.ejs +0 -17
  158. package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/src/factories/dummy-credentials.factory.ts.ejs +0 -28
  159. package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/src/modules/app/dummy-app/dummy-app.module.spec.ts.ejs +0 -90
  160. package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/src/modules/app/dummy-app/dummy-app.module.ts.ejs +0 -16
  161. package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/src/modules/app/dummy-app/index.schema.ts.ejs +0 -10
  162. package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/src/modules/app/dummy-app/index.ts.ejs +0 -3
  163. package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/src/modules/app/dummy-app/models/app/actions/add-dummy-app.model.action.ts.ejs +0 -59
  164. package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/src/modules/app/dummy-app/models/app/index.ts.ejs +0 -1
  165. package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/src/resources/http-fetch/actions/add-http-fetch.resource.action.ts.ejs +0 -55
  166. package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/src/resources/http-fetch/http-fetch.resource.ts.ejs +0 -12
  167. package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/src/resources/http-fetch/index.schema.ts.ejs +0 -35
  168. package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/src/resources/http-fetch/index.ts.ejs +0 -3
  169. package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/src/utilities/dummy/dummy.utility.ts.ejs +0 -11
  170. package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/tsconfig.build.json.ejs +0 -11
  171. package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/tsconfig.json.ejs +0 -39
  172. package/dist/commands/create-cdk/index.d.ts +0 -1
  173. package/dist/commands/create-cdk/index.js +0 -2
  174. package/dist/commands/create-cdk/index.js.map +0 -1
  175. package/dist/commands/create-resource/create-resource.command.js.map +0 -1
  176. package/dist/commands/create-resource/generator-octo-resource-template/generators/app/index.js.map +0 -1
  177. package/dist/commands/create-resource/generator-octo-resource-template/generators/app/templates/resources/resource/actions/update-tags.resource.action.ts.ejs +0 -86
  178. package/dist/commands/create-resource/generator-octo-resource-template/generators/app/templates/resources/resource/actions/validate.resource.action.ts.ejs +0 -40
  179. package/dist/commands/create-resource/generator-octo-resource-template/generators/app/templates/resources/resource/resource.ts.ejs +0 -12
  180. package/dist/commands/create-resource/index.d.ts +0 -1
  181. package/dist/commands/create-resource/index.js +0 -2
  182. package/dist/commands/create-resource/index.js.map +0 -1
  183. package/dist/commands/run/index.d.ts +0 -1
  184. package/dist/commands/run/index.js +0 -2
  185. package/dist/commands/run/index.js.map +0 -1
  186. package/dist/commands/run/run.command.d.ts +0 -11
  187. package/dist/commands/run/run.command.js +0 -96
  188. package/dist/commands/run/run.command.js.map +0 -1
  189. package/dist/commands/state/index.d.ts +0 -1
  190. package/dist/commands/state/index.js +0 -2
  191. package/dist/commands/state/index.js.map +0 -1
  192. package/dist/commands/state/state.command.d.ts +0 -14
  193. package/dist/commands/state/state.command.js +0 -79
  194. package/dist/commands/state/state.command.js.map +0 -1
  195. /package/dist/commands/{create-resource/generator-octo-resource-template → create-external-resource/generator-octo-external-resource-template}/generators/app/templates/resources/resource/index.schema.ts.ejs +0 -0
@@ -7,6 +7,20 @@ env:
7
7
  kind: string
8
8
  value: "123456789123"
9
9
 
10
+ terraform:
11
+ requiredVersion: "1.6.0"
12
+ requiredProviders:
13
+ aws:
14
+ source: hashicorp/aws
15
+ providers:
16
+ - providerType: aws
17
+ accountId: "${env.AWS_ACCOUNT_ID}"
18
+ # Optional. Puts a name in the generated provider alias in place of the account number.
19
+ # accountName: prod
20
+ regionId: us-east-1
21
+ spec:
22
+ profile: default
23
+
10
24
  settings:
11
25
  listeners:
12
26
  - type: HtmlReportEventListener
@@ -10,6 +10,20 @@ env:
10
10
  kind: string
11
11
  value: my-website-unique-bucket
12
12
 
13
+ terraform:
14
+ requiredVersion: "1.6.0"
15
+ requiredProviders:
16
+ aws:
17
+ source: hashicorp/aws
18
+ providers:
19
+ - providerType: aws
20
+ accountId: "${env.AWS_ACCOUNT_ID}"
21
+ # Optional. Puts a name in the generated provider alias in place of the account number.
22
+ # accountName: prod
23
+ regionId: us-east-1
24
+ spec:
25
+ profile: default
26
+
13
27
  settings:
14
28
  listeners:
15
29
  - type: HtmlReportEventListener
@@ -20,9 +20,6 @@
20
20
  "strictBindCallApply": true,
21
21
  "strictNullChecks": true,
22
22
  "target": "ES2022",
23
- "typeRoots": [
24
- "node_modules/@types"
25
- ],
26
23
  "useDefineForClassFields": false,
27
24
  "verbatimModuleSyntax": true
28
25
  },
@@ -1,5 +1,5 @@
1
1
  import type { ArgumentsCamelCase, Argv } from 'yargs';
2
- export declare const createResourceCommand: {
2
+ export declare const createExternalResourceCommand: {
3
3
  builder: (yargs: Argv) => Argv;
4
4
  command: string;
5
5
  describe: string;
@@ -0,0 +1,64 @@
1
+ import { dirname, resolve } from 'path';
2
+ import { fileURLToPath } from 'url';
3
+ import chalk from 'chalk';
4
+ import { createEnv } from 'yeoman-environment';
5
+ import { StringUtility } from '../../utilities/string/string.utility.js';
6
+ const __dirname = dirname(fileURLToPath(import.meta.url));
7
+ export const createExternalResourceCommand = {
8
+ builder: (yargs) => {
9
+ return yargs
10
+ .option('name', {
11
+ alias: 'n',
12
+ demandOption: true,
13
+ description: 'Name of the resource to create. Should be in kebab-case (e.g., my-awesome-resource).',
14
+ type: 'string',
15
+ })
16
+ .option('package', {
17
+ demandOption: true,
18
+ description: 'Package name for the resource.',
19
+ type: 'string',
20
+ })
21
+ .option('path', {
22
+ alias: 'p',
23
+ default: '.',
24
+ description: 'Root directory path of the project.',
25
+ type: 'string',
26
+ });
27
+ },
28
+ command: 'create-external-resource',
29
+ // Named for the lifecycle, not as the general case: a resource terraform manages is the common
30
+ // one, and that is `create-terraform-resource`. This generator emits the other kind - a resource
31
+ // whose add/delete run as SDK calls, which terraform drives by shelling back into `run-action`.
32
+ describe: 'Create a new Octo resource whose lifecycle runs outside Terraform.',
33
+ handler: async (argv) => {
34
+ const { name, package: packageName, path } = argv;
35
+ // Validate resource name format (should be kebab-case)
36
+ if (!StringUtility.isKebabCase(name)) {
37
+ console.error(chalk.red('Resource name must be in kebab-case format (e.g., my-vpc)'));
38
+ process.exit(1);
39
+ }
40
+ // Rejected here rather than at registration: the decorator runs this same check, but only once
41
+ // the generated resource is loaded, long after the files are on disk.
42
+ if (!StringUtility.isValidPackageName(packageName)) {
43
+ console.error(chalk.red(`Invalid package name "${packageName}"! Expected e.g. @octo or my-package.`));
44
+ process.exit(1);
45
+ }
46
+ console.log(chalk.blue(`Creating external resource "${name}" with package "${packageName}"...`));
47
+ const env = createEnv();
48
+ env.register(resolve(__dirname, 'generator-octo-external-resource-template/generators/app/index.js'), {
49
+ namespace: 'generator-octo-external-resource-template:app',
50
+ });
51
+ try {
52
+ await env.run(['generator-octo-external-resource-template:app', name, packageName, path], {
53
+ skipCache: true,
54
+ skipInstall: true,
55
+ });
56
+ console.log(chalk.green(`Successfully created external resource!`));
57
+ }
58
+ catch (error) {
59
+ console.error(chalk.red(`Failed to create external resource! ${error.message}`));
60
+ process.exit(1);
61
+ }
62
+ },
63
+ };
64
+ //# sourceMappingURL=create-external-resource.command.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-external-resource.command.js","sourceRoot":"","sources":["../../../src/commands/create-external-resource/create-external-resource.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,0CAA0C,CAAC;AAEzE,MAAM,SAAS,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAE1D,MAAM,CAAC,MAAM,6BAA6B,GAAG;IAC3C,OAAO,EAAE,CAAC,KAAW,EAAQ,EAAE;QAC7B,OAAO,KAAK;aACT,MAAM,CAAC,MAAM,EAAE;YACd,KAAK,EAAE,GAAG;YACV,YAAY,EAAE,IAAI;YAClB,WAAW,EAAE,sFAAsF;YACnG,IAAI,EAAE,QAAQ;SACf,CAAC;aACD,MAAM,CAAC,SAAS,EAAE;YACjB,YAAY,EAAE,I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AAG,CAAC,GAAG,CAAC,CAAC,+CAA+C,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,CAAC,EAAE;gBACxF,SAAS,EAAE,IAAI;gBACf,WAAW,EAAE,IAAI;aAClB,CAAC,CAAC;YAEH,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,yCAAyC,CAAC,CAAC,CAAC;QACtE,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,uCAAuC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;YACjF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC;CACF,CAAC"}
@@ -1,10 +1,25 @@
1
1
  import Generator, { type BaseOptions } from 'yeoman-generator';
2
+ /**
3
+ * @internal
4
+ */
2
5
  export default class extends Generator {
3
- private readonly cdkRootDir;
4
6
  private readonly packageName;
7
+ private readonly projectRootDir;
5
8
  private readonly resourceName;
9
+ /**
10
+ * @internal
11
+ */
6
12
  constructor(args: string[], opts: BaseOptions);
13
+ /**
14
+ * @internal
15
+ */
16
+ end(): void;
17
+ /**
18
+ * @internal
19
+ */
7
20
  initializing(): Promise<void>;
21
+ /**
22
+ * @internal
23
+ */
8
24
  writing(): Promise<void>;
9
- end(): void;
10
25
  }
@@ -1,16 +1,37 @@
1
1
  import { readdir, stat } from 'fs/promises';
2
2
  import { join, resolve } from 'path';
3
3
  import Generator, {} from 'yeoman-generator';
4
+ import { ProjectIndexUtility } from '../../../../../utilities/project-index/project-index.utility.js';
4
5
  import { StringUtility } from '../../../../../utilities/string/string.utility.js';
6
+ /**
7
+ * @internal
8
+ */
5
9
  export default class extends Generator {
10
+ /**
11
+ * @internal
12
+ */
6
13
  constructor(args, opts) {
7
14
  super(args, opts);
8
15
  this.resourceName = args[0];
9
16
  this.packageName = args[1];
10
- this.cdkRootDir = args[2];
17
+ this.projectRootDir = args[2];
11
18
  }
19
+ /**
20
+ * @internal
21
+ */
22
+ end() {
23
+ const targetPath = resolve(join(this.projectRootDir, 'src', 'resources', this.resourceName));
24
+ this.log('✅ Your external resource has been generated successfully!');
25
+ this.log(`📁 Resource created at: ${targetPath}`);
26
+ ProjectIndexUtility.addImport(this.projectRootDir, `./resources/${this.resourceName}/index.js`);
27
+ this.log('📦 Next steps:');
28
+ this.log(` Address all "Fix me" in generated files`);
29
+ }
30
+ /**
31
+ * @internal
32
+ */
12
33
  async initializing() {
13
- const targetPath = resolve(join(this.cdkRootDir, 'src', 'resources', this.resourceName));
34
+ const targetPath = resolve(join(this.projectRootDir, 'src', 'resources', this.resourceName));
14
35
  // Check if directory already exists and is not empty.
15
36
  let targetPathStat;
16
37
  try {
@@ -30,46 +51,26 @@ export default class extends Generator {
30
51
  // Set the destination root to the resource directory.
31
52
  this.destinationRoot(targetPath);
32
53
  }
54
+ /**
55
+ * @internal
56
+ */
33
57
  async writing() {
34
- // Create the resource file.
35
- this.fs.copyTpl(this.templatePath('resources/resource/resource.ts.ejs'), this.destinationPath(`${this.resourceName}.resource.ts`), {
58
+ const templateData = {
36
59
  packageName: this.packageName,
37
60
  resourceName: this.resourceName,
61
+ resourceNameCamel: StringUtility.toCamelCase(this.resourceName),
38
62
  resourceNamePascal: StringUtility.toPascalCase(this.resourceName),
39
- });
63
+ };
64
+ // Create the resource file.
65
+ this.fs.copyTpl(this.templatePath('resources/resource/resource.ts.ejs'), this.destinationPath(`${this.resourceName}.resource.ts`), templateData);
40
66
  // Create schema file.
41
- this.fs.copyTpl(this.templatePath('resources/resource/index.schema.ts.ejs'), this.destinationPath('index.schema.ts'), {
42
- resourceNamePascal: StringUtility.toPascalCase(this.resourceName),
43
- });
67
+ this.fs.copyTpl(this.templatePath('resources/resource/index.schema.ts.ejs'), this.destinationPath('index.schema.ts'), templateData);
44
68
  // Create index.ts
45
- this.fs.copyTpl(this.templatePath('resources/resource/index.ts.ejs'), this.destinationPath('index.ts'), {
46
- resourceName: this.resourceName,
47
- resourceNamePascal: StringUtility.toPascalCase(this.resourceName),
48
- });
69
+ this.fs.copyTpl(this.templatePath('resources/resource/index.ts.ejs'), this.destinationPath('index.ts'), templateData);
49
70
  // Create actions directory and action files
50
- this.fs.copyTpl(this.templatePath('resources/resource/actions/add.resource.action.ts.ejs'), this.destinationPath('actions', `add-${this.resourceName}.resource.action.ts`), {
51
- resourceName: this.resourceName,
52
- resourceNamePascal: StringUtility.toPascalCase(this.resourceName),
53
- });
54
- this.fs.copyTpl(this.templatePath('resources/resource/actions/delete.resource.action.ts.ejs'), this.destinationPath('actions', `delete-${this.resourceName}.resource.action.ts`), {
55
- resourceName: this.resourceName,
56
- resourceNamePascal: StringUtility.toPascalCase(this.resourceName),
57
- });
58
- this.fs.copyTpl(this.templatePath('resources/resource/actions/update-tags.resource.action.ts.ejs'), this.destinationPath('actions', `update-${this.resourceName}-tags.resource.action.ts`), {
59
- resourceName: this.resourceName,
60
- resourceNamePascal: StringUtility.toPascalCase(this.resourceName),
61
- });
62
- this.fs.copyTpl(this.templatePath('resources/resource/actions/validate.resource.action.ts.ejs'), this.destinationPath('actions', `validate-${this.resourceName}.resource.action.ts`), {
63
- resourceName: this.resourceName,
64
- resourceNamePascal: StringUtility.toPascalCase(this.resourceName),
65
- });
66
- }
67
- end() {
68
- const targetPath = resolve(join(this.cdkRootDir, 'src', 'resources', this.resourceName));
69
- this.log('✅ Your resource has been generated successfully!');
70
- this.log(`📁 Resource created at: ${targetPath}`);
71
- this.log('📦 Next steps:');
72
- this.log(` Address all "Fix me" in generated files`);
71
+ this.fs.copyTpl(this.templatePath('resources/resource/actions/add.resource.action.ts.ejs'), this.destinationPath('actions', `add-${this.resourceName}.resource.action.ts`), templateData);
72
+ this.fs.copyTpl(this.templatePath('resources/resource/actions/delete.resource.action.ts.ejs'), this.destinationPath('actions', `delete-${this.resourceName}.resource.action.ts`), templateData);
73
+ this.fs.copyTpl(this.templatePath('resources/resource/actions/update.resource.action.ts.ejs'), this.destinationPath('actions', `update-${this.resourceName}.resource.action.ts`), templateData);
73
74
  }
74
75
  }
75
76
  //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/commands/create-external-resource/generator-octo-external-resource-template/generators/app/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAE5C,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,SAAS,EAAE,EAAoB,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,iEAAiE,CAAC;AACtG,OAAO,EAAE,aAAa,EAAE,MAAM,mDAAmD,CAAC;AAElF;;GAEG;AACH,MAAM,CAAC,OAAO,MAAO,SAAQ,SAAS;IAKpC;;OAEG;IACH,YAAY,IAAc,EAAE,IAAiB;QAC3C,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAElB,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QAC5B,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QAC3B,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;IAChC,CAAC;IAED;;OAEG;IACH,GAAG;QACD,MAAM,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,KAAK,EAAE,WAAW,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC;QAE7F,IAAI,CAAC,GAAG,CAAC,2DAA2D,CAAC,CAAC;QACtE,IAAI,CAAC,GAAG,CAAC,2BAA2B,UAAU,EAAE,CAAC,CAAC;QAClD,mBAAmB,CAAC,SAAS,CAAC,IAAI,CAAC,cAAc,EAAE,eAAe,IAAI,CAAC,YAAY,WAAW,CAAC,CAAC;QAEhG,IAAI,CAAC,GAAG,CAAC,gBAAgB,C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G,IAAI,CAAC,YAAY,cAAc,CAAC,EACxD,YAAY,CACb,CAAC;QAEF,sBAAsB;QACtB,IAAI,CAAC,EAAE,CAAC,OAAO,CACb,IAAI,CAAC,YAAY,CAAC,wCAAwC,CAAC,EAC3D,IAAI,CAAC,eAAe,CAAC,iBAAiB,CAAC,EACvC,YAAY,CACb,CAAC;QAEF,kBAAkB;QAClB,IAAI,CAAC,EAAE,CAAC,OAAO,CACb,IAAI,CAAC,YAAY,CAAC,iCAAiC,CAAC,EACpD,IAAI,CAAC,eAAe,CAAC,UAAU,CAAC,EAChC,YAAY,CACb,CAAC;QAEF,4CAA4C;QAC5C,IAAI,CAAC,EAAE,CAAC,OAAO,CACb,IAAI,CAAC,YAAY,CAAC,uDAAuD,CAAC,EAC1E,IAAI,CAAC,eAAe,CAAC,SAAS,EAAE,OAAO,IAAI,CAAC,YAAY,qBAAqB,CAAC,EAC9E,YAAY,CACb,CAAC;QAEF,IAAI,CAAC,EAAE,CAAC,OAAO,CACb,IAAI,CAAC,YAAY,CAAC,0DAA0D,CAAC,EAC7E,IAAI,CAAC,eAAe,CAAC,SAAS,EAAE,UAAU,IAAI,CAAC,YAAY,qBAAqB,CAAC,EACjF,YAAY,CACb,CAAC;QAEF,IAAI,CAAC,EAAE,CAAC,OAAO,CACb,IAAI,CAAC,YAAY,CAAC,0DAA0D,CAAC,EAC7E,IAAI,CAAC,eAAe,CAAC,SAAS,EAAE,UAAU,IAAI,CAAC,YAAY,qBAAqB,CAAC,EACjF,YAAY,CACb,CAAC;IACJ,CAAC;CACF"}
@@ -19,25 +19,16 @@ export class Add<%= resourceNamePascal %>ResourceAction extends ANodeAction impl
19
19
 
20
20
  async handle(diff: Diff<<%= resourceNamePascal %>>): Promise<<%= resourceNamePascal %>Schema['response']> {
21
21
  // Get properties.
22
- const <%= resourceName %> = diff.node;
23
- const properties = <%= resourceName %>.properties;
24
- const response = <%= resourceName %>.response;
25
- const tags = <%= resourceName %>.tags;
22
+ const <%= resourceNameCamel %> = diff.node;
23
+ const properties = <%= resourceNameCamel %>.properties;
24
+ const response = <%= resourceNameCamel %>.response;
25
+ const tags = <%= resourceNameCamel %>.tags;
26
26
 
27
27
  // Fix me: Implement the add resource logic.
28
- // This is where you would create the actual resource.
28
+ // This is where you would create the actual resource (SDK call, script, API request, ...).
29
29
 
30
- // Fix me: Return response properties.
31
- return response;
32
- }
33
-
34
- async mock(diff: Diff<<%= resourceNamePascal %>>, capture: Partial<<%= resourceNamePascal %>Schema['response']>): Promise<<%= resourceNamePascal %>Schema['response']> {
35
- // Get properties.
36
- const <%= resourceName %> = diff.node;
37
- const properties = <%= resourceName %>.properties;
38
- const response = <%= resourceName %>.response;
39
-
40
- // Fix me: Return response using captures.
30
+ // Fix me: Populate and return every declared response key. Each key must be declared on the
31
+ // schema's `response` so Octo can emit it as a Terraform output.
41
32
  return response;
42
33
  }
43
34
  }
@@ -1,6 +1,24 @@
1
1
  import { ANodeAction, Action, type Diff, DiffAction, Factory, type IResourceAction, hasNodeName } from '@quadnix/octo';
2
2
  import { <%= resourceNamePascal %> } from '../<%= resourceName %>.resource.js';
3
3
 
4
+ /**
5
+ * Deletes the resource.
6
+ *
7
+ * Unlike add and update, this does **not** run mid-apply. Terraform cannot run it: octo deletes a
8
+ * resource by removing its block from the configuration, and terraform will not run a
9
+ * `when = destroy` provisioner for a resource that is no longer in the configuration. So `octo
10
+ * commit` runs this instead, from the project directory, after terraform has destroyed the
11
+ * `null_resource`.
12
+ *
13
+ * Two consequences worth designing around:
14
+ *
15
+ * - **The working directory is not the one add and update saw.** Those run inside a terragrunt
16
+ * cache directory; this runs wherever `octo commit` was invoked. Anything positional - a relative
17
+ * file path, a relative config lookup - resolves somewhere else. Build absolute paths from a
18
+ * module input rather than assuming a cwd.
19
+ * - **Throwing here aborts the commit**, on purpose: octo state then still records the resource, so
20
+ * the next run diffs it again and retries. Failing loudly is better than a silent leak.
21
+ */
4
22
  @Action(<%= resourceNamePascal %>)
5
23
  export class Delete<%= resourceNamePascal %>ResourceAction extends ANodeAction implements IResourceAction<<%= resourceNamePascal %>> {
6
24
  constructor() {
@@ -18,9 +36,9 @@ export class Delete<%= resourceNamePascal %>ResourceAction extends ANodeAction i
18
36
 
19
37
  async handle(diff: Diff<<%= resourceNamePascal %>>): Promise<void> {
20
38
  // Get properties.
21
- const <%= resourceName %> = diff.node;
22
- const properties = <%= resourceName %>.properties;
23
- const response = <%= resourceName %>.response;
39
+ const <%= resourceNameCamel %> = diff.node;
40
+ const properties = <%= resourceNameCamel %>.properties;
41
+ const response = <%= resourceNameCamel %>.response;
24
42
 
25
43
  // Fix me: Implement the delete resource logic.
26
44
  // This is where you would delete the actual resource.
@@ -0,0 +1,63 @@
1
+ import { ANodeAction, Action, type Diff, DiffAction, Factory, type IResourceAction, hasNodeName } from '@quadnix/octo';
2
+ import type { <%= resourceNamePascal %>Schema } from '../index.schema.js';
3
+ import { <%= resourceNamePascal %> } from '../<%= resourceName %>.resource.js';
4
+
5
+ /**
6
+ * Handles the two `UPDATE` diffs an external resource receives.
7
+ *
8
+ * Neither is optional: a diff that no registered action matches aborts the whole transaction with
9
+ * "No matching action given for diff!". Deleting this file means a generated resource works until
10
+ * its first change and then refuses to apply at all.
11
+ *
12
+ * - **`properties`** - the default `diffProperties()` emits this whenever a property changes. You
13
+ * own the partial-update semantics. `diff.value` carries the changed properties; the resource's
14
+ * `properties` already hold the new values. If the underlying API cannot change an attribute in
15
+ * place, do not silently skip it - either recreate it here, or override `diffProperties()` on the
16
+ * resource to return `DiffAction.REPLACE` with a reason, which routes the change through the add
17
+ * and delete actions instead.
18
+ * - **`parent`** - emitted when a parent is replaced, with `diff.value` naming the new parent. The
19
+ * parent's outputs are this resource's inputs, so they have just changed underneath it: re-read
20
+ * them from `this.parents` and re-apply. Skipping this case is how an external resource ends up
21
+ * pointing at a parent that no longer exists.
22
+ */
23
+ @Action(<%= resourceNamePascal %>)
24
+ export class Update<%= resourceNamePascal %>ResourceAction extends ANodeAction implements IResourceAction<<%= resourceNamePascal %>> {
25
+ constructor() {
26
+ super();
27
+ }
28
+
29
+ filter(diff: Diff): boolean {
30
+ return (
31
+ diff.action === DiffAction.UPDATE &&
32
+ diff.node instanceof <%= resourceNamePascal %> &&
33
+ hasNodeName(diff.node, '<%= resourceName %>') &&
34
+ (diff.field === 'properties' || diff.field === 'parent')
35
+ );
36
+ }
37
+
38
+ async handle(diff: Diff<<%= resourceNamePascal %>>): Promise<<%= resourceNamePascal %>Schema['response']> {
39
+ // Get properties.
40
+ const <%= resourceNameCamel %> = diff.node;
41
+ const properties = <%= resourceNameCamel %>.properties;
42
+ const response = <%= resourceNameCamel %>.response;
43
+
44
+ // Fix me: Implement the update resource logic.
45
+ // This is where you would apply the changed properties to the actual resource.
46
+
47
+ // Fix me: Return every declared response key, re-reading any the update changed. Returning the
48
+ // response unchanged is what an unimplemented update looks like, and it reports success.
49
+ return response;
50
+ }
51
+ }
52
+
53
+ @Factory<Update<%= resourceNamePascal %>ResourceAction>(Update<%= resourceNamePascal %>ResourceAction)
54
+ export class Update<%= resourceNamePascal %>ResourceActionFactory {
55
+ private static instance: Update<%= resourceNamePascal %>ResourceAction;
56
+
57
+ static async create(): Promise<Update<%= resourceNamePascal %>ResourceAction> {
58
+ if (!this.instance) {
59
+ this.instance = new Update<%= resourceNamePascal %>ResourceAction();
60
+ }
61
+ return this.instance;
62
+ }
63
+ }
@@ -1,6 +1,5 @@
1
1
  import './actions/add-<%= resourceName %>.resource.action.js';
2
2
  import './actions/delete-<%= resourceName %>.resource.action.js';
3
- import './actions/update-<%= resourceName %>-tags.resource.action.js';
4
- import './actions/validate-<%= resourceName %>.resource.action.js';
3
+ import './actions/update-<%= resourceName %>.resource.action.js';
5
4
 
6
5
  export { <%= resourceNamePascal %> } from './<%= resourceName %>.resource.js';
@@ -0,0 +1,28 @@
1
+ import { AResource, Resource } from '@quadnix/octo';
2
+ import { <%= resourceNamePascal %>Schema } from './index.schema.js';
3
+
4
+ /**
5
+ * An external resource: its lifecycle (create / update / delete) runs outside Terraform, in the
6
+ * resource actions under `./actions` (SDK calls, scripts, API requests). Octo wraps it in a
7
+ * `null_resource` + `data "external"` at generate time and calls back into the action at apply time.
8
+ *
9
+ * For a resource whose lifecycle is managed by Terraform itself, use `create-terraform-resource`.
10
+ *
11
+ * Two things an external resource does not get, so that you do not go looking for them:
12
+ *
13
+ * - **Tags do not reach it.** The generated `null_resource` triggers on the properties hash and on
14
+ * each parent input; `tags` is not among them. A tags-only change therefore re-triggers nothing,
15
+ * Terraform does not re-run the provisioner, and no action is invoked. Apply tags inside the
16
+ * add/update actions if the underlying API supports them.
17
+ * - **There is no per-resource validate action.** `octo validate` compares Terraform's plan against
18
+ * Octo's own diff; it does not run resource actions.
19
+ */
20
+ @Resource<<%= resourceNamePascal %>>('<%= packageName %>', '<%= resourceName %>', <%= resourceNamePascal %>Schema)
21
+ export class <%= resourceNamePascal %> extends AResource<<%= resourceNamePascal %>Schema, <%= resourceNamePascal %>> {
22
+ declare properties: <%= resourceNamePascal %>Schema['properties'];
23
+ declare response: <%= resourceNamePascal %>Schema['response'];
24
+
25
+ constructor(resourceId: string, properties: <%= resourceNamePascal %>Schema['properties'], parents: []) {
26
+ super(resourceId, properties, parents);
27
+ }
28
+ }
@@ -0,0 +1 @@
1
+ export { createExternalResourceCommand } from './create-external-resource.command.js';
@@ -0,0 +1,2 @@
1
+ export { createExternalResourceCommand } from './create-external-resource.command.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/create-external-resource/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,uCAAuC,CAAC"}
@@ -28,7 +28,7 @@ export const createModelCommand = {
28
28
  .option('path', {
29
29
  alias: 'p',
30
30
  default: '.',
31
- description: 'Root directory path of the CDK.',
31
+ description: 'Root directory path of the project.',
32
32
  type: 'string',
33
33
  });
34
34
  },
@@ -1 +1 @@
1
- {"version":3,"file":"create-model.command.js","sourceRoot":"","sources":["../../../src/commands/create-model/create-model.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,0CAA0C,CAAC;AAEzE,MAAM,SAAS,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAE1D,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,OAAO,EAAE,CAAC,KAAW,EAAQ,EAAE;QAC7B,OAAO,KAAK;aACT,MAAM,CAAC,MAAM,EAAE;YACd,KAAK,EAAE,GAAG;YACV,YAAY,EAAE,IAAI;YAClB,WAAW,EACT,mGAAmG;YACrG,IAAI,EAAE,QAAQ;SACf,CAAC;aACD,MAAM,CAAC,MAAM,EAAE;YACd,KAAK,EAAE,GAAG;YACV,OAAO,EAAE,aAAa,CAAC,qBAAqB;YAC5C,YAAY,EAAE,IAAI;YAClB,WAAW,EAAE,+CAA+C;YAC5D,IAAI,EAAE,QAAQ;SACf,CAAC;aACD,MAAM,CAAC,SAAS,EAAE;YACjB,YAAY,EAAE,IAAI;YAClB,WAAW,EAAE,6BAA6B;YAC1C,IAAI,EAAE,QAAQ;SACf,CAAC;aACD,MAAM,CAAC,MAAM,EAAE;YACd,KAAK,EAAE,GAAG;YACV,OAAO,EAAE,GAAG;YACZ,WAAW,EAAE,iCAAiC;YAC9C,IAAI,EAAE,QAAQ;SACf,CAAC,CAAC;IACP,CAAC;IACD,OAAO,EAAE,cAAc;IACvB,QAAQ,EAAE,0BAA0B;IACpC,OAAO,EAAE,KAAK,EACZ,IAAuF,EACxE,EAAE;QACjB,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC;QAExD,qDAAqD;QACrD,IAAI,CAAC,aAAa,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC;YACrC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,oEAAoE,CAAC,CAAC,CAAC;YAC/F,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QAED,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,8BAA8B,IAAI,cAAc,IAAI,MAAM,CAAC,CAAC,CAAC;QAEpF,MAAM,GAAG,GAAG,SAAS,EAAE,CAAC;QACxB,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,SAAS,EAAE,uDAAuD,CAAC,EAAE;YACxF,SAAS,EAAE,mCAAmC;SAC/C,CAAC,CAAC;QAEH,IAAI,CAAC;YACH,MAAM,GAAG,CAAC,GAAG,CAAC,CAAC,mCAAmC,EAAE,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,CAAC,EAAE;gBAClF,SAAS,EAAE,IAAI;gBACf,WAAW,EAAE,IAAI;aAClB,CAAC,CAAC;YAEH,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,6BAA6B,CAAC,CAAC,CAAC;QAC1D,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,2BAA2B,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;YACrE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC;CACF,CAAC"}
1
+ {"version":3,"file":"create-model.command.js","sourceRoot":"","sources":["../../../src/commands/create-model/create-model.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACxC,OAAO,EAAE,aAAa,EAA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,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,oEAAoE,CAAC,CAAC,CAAC;YAC/F,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QAED,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,8BAA8B,IAAI,cAAc,IAAI,MAAM,CAAC,CAAC,CAAC;QAEpF,MAAM,GAAG,GAAG,SAAS,EAAE,CAAC;QACxB,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,SAAS,EAAE,uDAAuD,CAAC,EAAE;YACxF,SAAS,EAAE,mCAAmC;SAC/C,CAAC,CAAC;QAEH,IAAI,CAAC;YACH,MAAM,GAAG,CAAC,GAAG,CAAC,CAAC,mCAAmC,EAAE,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,CAAC,EAAE;gBAClF,SAAS,EAAE,IAAI;gBACf,WAAW,EAAE,IAAI;aAClB,CAAC,CAAC;YAEH,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,6BAA6B,CAAC,CAAC,CAAC;QAC1D,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,2BAA2B,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;YACrE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC;CACF,CAAC"}
@@ -1,11 +1,26 @@
1
1
  import Generator, { type BaseOptions } from 'yeoman-generator';
2
+ /**
3
+ * @internal
4
+ */
2
5
  export default class extends Generator {
3
6
  private readonly modelType;
4
- private readonly cdkRootDir;
5
7
  private readonly moduleName;
6
8
  private readonly packageName;
9
+ private readonly projectRootDir;
10
+ /**
11
+ * @internal
12
+ */
7
13
  constructor(args: string[], opts: BaseOptions);
14
+ /**
15
+ * @internal
16
+ */
17
+ end(): void;
18
+ /**
19
+ * @internal
20
+ */
8
21
  initializing(): Promise<void>;
22
+ /**
23
+ * @internal
24
+ */
9
25
  writing(): Promise<void>;
10
- end(): void;
11
26
  }
@@ -1,17 +1,38 @@
1
1
  import { readdir, stat } from 'fs/promises';
2
2
  import { join, resolve } from 'path';
3
3
  import Generator, {} from 'yeoman-generator';
4
+ import { ProjectIndexUtility } from '../../../../../utilities/project-index/project-index.utility.js';
4
5
  import { StringUtility } from '../../../../../utilities/string/string.utility.js';
6
+ /**
7
+ * @internal
8
+ */
5
9
  export default class extends Generator {
10
+ /**
11
+ * @internal
12
+ */
6
13
  constructor(args, opts) {
7
14
  super(args, opts);
8
15
  this.moduleName = args[0];
9
16
  this.modelType = args[1];
10
17
  this.packageName = args[2];
11
- this.cdkRootDir = args[3];
18
+ this.projectRootDir = args[3];
12
19
  }
20
+ /**
21
+ * @internal
22
+ */
23
+ end() {
24
+ const targetPath = resolve(join(this.projectRootDir, 'src', 'modules', this.modelType, this.moduleName, 'models', this.modelType));
25
+ this.log('✅ Your model has been generated successfully!');
26
+ this.log(`📁 Model created at: ${targetPath}`);
27
+ ProjectIndexUtility.addImport(this.projectRootDir, `./modules/${this.modelType}/${this.moduleName}/models/${this.modelType}/index.js`);
28
+ this.log('📦 Next steps:');
29
+ this.log(` Address all "Fix me" in generated files`);
30
+ }
31
+ /**
32
+ * @internal
33
+ */
13
34
  async initializing() {
14
- const targetPath = resolve(join(this.cdkRootDir, 'src', 'modules', this.modelType, this.moduleName, 'models', this.modelType));
35
+ const targetPath = resolve(join(this.projectRootDir, 'src', 'modules', this.modelType, this.moduleName, 'models', this.modelType));
15
36
  // Check if directory already exists and is not empty.
16
37
  let targetPathStat;
17
38
  try {
@@ -31,6 +52,9 @@ export default class extends Generator {
31
52
  // Set the destination root to the model directory.
32
53
  this.destinationRoot(targetPath);
33
54
  }
55
+ /**
56
+ * @internal
57
+ */
34
58
  async writing() {
35
59
  // Create the model file.
36
60
  this.fs.copyTpl(this.templatePath('models/model/model.ts.ejs'), this.destinationPath(`${this.moduleName}.model.ts`), {
@@ -57,12 +81,5 @@ export default class extends Generator {
57
81
  moduleNamePascal: StringUtility.toPascalCase(this.moduleName),
58
82
  });
59
83
  }
60
- end() {
61
- const targetPath = resolve(join(this.cdkRootDir, 'src', 'modules', this.modelType, this.moduleName, 'models', this.modelType));
62
- this.log('✅ Your model has been generated successfully!');
63
- this.log(`📁 Model created at: ${targetPath}`);
64
- this.log('📦 Next steps:');
65
- this.log(` Address all "Fix me" in generated files`);
66
- }
67
84
  }
68
85
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/commands/create-model/generator-octo-model-template/generators/app/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAE5C,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,SAAS,EAAE,EAAoB,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,mDAAmD,CAAC;AAElF,MAAM,CAAC,OAAO,MAAO,SAAQ,SAAS;IAMpC,YAAY,IAAc,EAAE,IAAiB;QAC3C,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAElB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QAC1B,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QACzB,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QAC3B,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;IAC5B,CAAC;IAED,KAAK,CAAC,YAAY;QAChB,MAAM,UAAU,GAAG,OAAO,CACxB,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,UAAU,EAAE,QAAQ,EAAE,IAAI,CAAC,SA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,IAAI,CAAC,UAAU;YAC3B,gBAAgB,EAAE,aAAa,CAAC,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC;YAC7D,WAAW,EAAE,IAAI,CAAC,WAAW;SAC9B,CACF,CAAC;QAEF,sBAAsB;QACtB,IAAI,CAAC,EAAE,CAAC,OAAO,CACb,IAAI,CAAC,YAAY,CAAC,4BAA4B,CAAC,EAC/C,IAAI,CAAC,eAAe,CAAC,GAAG,IAAI,CAAC,UAAU,YAAY,CAAC,EACpD;YACE,eAAe,EAAE,aAAa,CAAC,YAAY,CAAC,IAAI,CAAC,SAAS,CAAC;YAC3D,gBAAgB,EAAE,aAAa,CAAC,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC;SAC9D,CACF,CAAC;QAEF,kBAAkB;QAClB,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC,2BAA2B,CAAC,EAAE,IAAI,CAAC,eAAe,CAAC,UAAU,CAAC,EAAE;YAChG,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,gBAAgB,EAAE,aAAa,CAAC,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC;SAC9D,CAAC,CAAC;QAEH,2CAA2C;QAC3C,IAAI,CAAC,EAAE,CAAC,OAAO,CACb,IAAI,CAAC,YAAY,CAAC,8CAA8C,CAAC,EACjE,IAAI,CAAC,eAAe,CAAC,SAAS,EAAE,OAAO,IAAI,CAAC,UAAU,kBAAkB,CAAC,EACzE;YACE,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,gBAAgB,EAAE,aAAa,CAAC,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC;SAC9D,CACF,CAAC;IACJ,CAAC;CACF"}
@@ -1,4 +1,6 @@
1
- import { Model, <%= modelTypePascal %> } from '@quadnix/octo';
1
+ <%# Sorted for the same reason as the schema's imports: `App` sorts before `Model`, `Service` after. -%>
2
+ <% const modelImports = ['Model', modelTypePascal].sort().join(', '); -%>
3
+ import { <%= modelImports %> } from '@quadnix/octo';
2
4
  import { <%= moduleNamePascal %>Schema } from './<%= moduleName %>.schema.js';
3
5
 
4
6
  @Model<<%= moduleNamePascal %>>('<%= packageName %>', '<%= modelType %>', <%= moduleNamePascal %>Schema)
@@ -1,4 +1,9 @@
1
- import { <%= modelTypePascal %>Schema, Schema, Validate } from '@quadnix/octo';
1
+ <%# Sorted here rather than written in a fixed order: the model type is the only variable member,
2
+ and where it falls among the others depends on its name - `AccountSchema` sorts before `Schema`,
3
+ `ServiceSchema` after it. A fixed order fails the generated app's own import/order and
4
+ sort-imports rules for half the model types. -%>
5
+ <% const modelSchemaImports = ['Schema', 'Validate', `${modelTypePascal}Schema`].sort().join(', '); -%>
6
+ import { <%= modelSchemaImports %> } from '@quadnix/octo';
2
7
 
3
8
  export class <%= moduleNamePascal %>Schema extends <%= modelTypePascal %>Schema {
4
9
  // Fix me: Add schema properties specific to your module
@@ -28,7 +28,7 @@ export const createModuleCommand = {
28
28
  .option('path', {
29
29
  alias: 'p',
30
30
  default: '.',
31
- description: 'Root directory path of the CDK.',
31
+ description: 'Root directory path of the project.',
32
32
  type: 'string',
33
33
  });
34
34
  },