@quadnix/octo-build 0.0.8 → 0.0.9

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 (135) hide show
  1. package/dist/commands/create-anchor/create-anchor.command.d.ts +13 -0
  2. package/dist/commands/create-anchor/create-anchor.command.js +67 -0
  3. package/dist/commands/create-anchor/create-anchor.command.js.map +1 -0
  4. package/dist/commands/create-anchor/generator-octo-anchor-template/generators/app/index.d.ts +13 -0
  5. package/dist/commands/create-anchor/generator-octo-anchor-template/generators/app/index.js +59 -0
  6. package/dist/commands/create-anchor/generator-octo-anchor-template/generators/app/index.js.map +1 -0
  7. package/dist/commands/create-anchor/generator-octo-anchor-template/generators/app/templates/anchors/anchor/anchor.schema.ts.ejs +23 -0
  8. package/dist/commands/create-anchor/generator-octo-anchor-template/generators/app/templates/anchors/anchor/anchor.ts.ejs +15 -0
  9. package/dist/commands/create-anchor/index.d.ts +1 -0
  10. package/dist/commands/create-anchor/index.js +2 -0
  11. package/dist/commands/create-anchor/index.js.map +1 -0
  12. package/dist/commands/{create/create.command.d.ts → create-app/create-app.command.d.ts} +1 -1
  13. package/dist/commands/{create/create.command.js → create-app/create-app.command.js} +3 -3
  14. package/dist/commands/create-app/create-app.command.js.map +1 -0
  15. package/dist/commands/{create → create-app}/generator-octo-app-template/generators/app/index.d.ts +0 -1
  16. package/dist/commands/{create → create-app}/generator-octo-app-template/generators/app/index.js +18 -29
  17. package/dist/commands/create-app/generator-octo-app-template/generators/app/index.js.map +1 -0
  18. package/dist/commands/create-app/generator-octo-app-template/generators/app/templates/README.md.ejs +58 -0
  19. package/dist/commands/create-app/generator-octo-app-template/generators/app/templates/eslint.config.js.ejs +118 -0
  20. package/dist/commands/{create → create-app}/generator-octo-app-template/generators/app/templates/package.json.ejs +1 -4
  21. package/dist/commands/{create/generator-octo-app-template/generators/app/templates/src/aws-s3-website → create-app/generator-octo-app-template/generators/app/templates/src/aws-ecs-server}/main.ts.ejs +3 -3
  22. package/dist/commands/{create/generator-octo-app-template/generators/app/templates/src/aws-ecs-server → create-app/generator-octo-app-template/generators/app/templates/src/aws-s3-website}/main.ts.ejs +3 -3
  23. package/dist/commands/{create → create-app}/generator-octo-app-template/generators/app/templates/src/aws-s3-website/module-definitions.ts.ejs +1 -1
  24. package/dist/commands/create-app/index.d.ts +1 -0
  25. package/dist/commands/create-app/index.js +2 -0
  26. package/dist/commands/create-app/index.js.map +1 -0
  27. package/dist/commands/create-cdk/create-cdk.command.d.ts +11 -0
  28. package/dist/commands/create-cdk/create-cdk.command.js +70 -0
  29. package/dist/commands/create-cdk/create-cdk.command.js.map +1 -0
  30. package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/index.d.ts +10 -0
  31. package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/index.js +107 -0
  32. package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/index.js.map +1 -0
  33. package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/README.md.ejs +23 -0
  34. package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/eslint.config.js.ejs +337 -0
  35. package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/gitignore.ejs +82 -0
  36. package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/package.json.ejs +57 -0
  37. package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/prettierrc.ejs +5 -0
  38. package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/src/anchors/app/app.anchor.schema.ts.ejs +19 -0
  39. package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/src/anchors/app/app.anchor.ts.ejs +17 -0
  40. package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/src/factories/dummy-credentials.factory.ts.ejs +28 -0
  41. package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/src/modules/app/dummy-app/dummy-app.module.spec.ts.ejs +90 -0
  42. package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/src/modules/app/dummy-app/dummy-app.module.ts.ejs +16 -0
  43. package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/src/modules/app/dummy-app/index.schema.ts.ejs +10 -0
  44. package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/src/modules/app/dummy-app/index.ts.ejs +3 -0
  45. 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 +59 -0
  46. package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/src/modules/app/dummy-app/models/app/index.ts.ejs +1 -0
  47. package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/src/resources/http-fetch/actions/add-http-fetch.resource.action.ts.ejs +55 -0
  48. package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/src/resources/http-fetch/http-fetch.resource.ts.ejs +12 -0
  49. package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/src/resources/http-fetch/index.schema.ts.ejs +35 -0
  50. package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/src/resources/http-fetch/index.ts.ejs +3 -0
  51. package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/src/utilities/dummy/dummy.utility.ts.ejs +11 -0
  52. package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/tsconfig.build.json.ejs +11 -0
  53. package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/tsconfig.json.ejs +39 -0
  54. package/dist/commands/create-cdk/index.d.ts +1 -0
  55. package/dist/commands/create-cdk/index.js +2 -0
  56. package/dist/commands/create-cdk/index.js.map +1 -0
  57. package/dist/commands/create-model/create-model.command.d.ts +12 -0
  58. package/dist/commands/create-model/create-model.command.js +62 -0
  59. package/dist/commands/create-model/create-model.command.js.map +1 -0
  60. package/dist/commands/create-model/generator-octo-model-template/generators/app/index.d.ts +11 -0
  61. package/dist/commands/create-model/generator-octo-model-template/generators/app/index.js +68 -0
  62. package/dist/commands/create-model/generator-octo-model-template/generators/app/index.js.map +1 -0
  63. package/dist/commands/create-model/generator-octo-model-template/generators/app/templates/models/model/actions/add.model.action.ts.ejs +50 -0
  64. package/dist/commands/create-model/generator-octo-model-template/generators/app/templates/models/model/index.ts.ejs +3 -0
  65. package/dist/commands/create-model/generator-octo-model-template/generators/app/templates/models/model/model.ts.ejs +29 -0
  66. package/dist/commands/create-model/generator-octo-model-template/generators/app/templates/models/model/schema.ts.ejs +8 -0
  67. package/dist/commands/create-model/index.d.ts +1 -0
  68. package/dist/commands/create-model/index.js +2 -0
  69. package/dist/commands/create-model/index.js.map +1 -0
  70. package/dist/commands/create-module/create-module.command.d.ts +12 -0
  71. package/dist/commands/create-module/create-module.command.js +62 -0
  72. package/dist/commands/create-module/create-module.command.js.map +1 -0
  73. package/dist/commands/create-module/generator-octo-module-template/generators/app/index.d.ts +11 -0
  74. package/dist/commands/create-module/generator-octo-module-template/generators/app/index.js +60 -0
  75. package/dist/commands/create-module/generator-octo-module-template/generators/app/index.js.map +1 -0
  76. package/dist/commands/create-module/generator-octo-module-template/generators/app/templates/index.schema.ts.ejs +3 -0
  77. package/dist/commands/create-module/generator-octo-module-template/generators/app/templates/index.ts.ejs +1 -0
  78. package/dist/commands/create-module/generator-octo-module-template/generators/app/templates/module.ts.ejs +9 -0
  79. package/dist/commands/create-module/index.d.ts +1 -0
  80. package/dist/commands/create-module/index.js +2 -0
  81. package/dist/commands/create-module/index.js.map +1 -0
  82. package/dist/commands/create-overlay/create-overlay.command.d.ts +13 -0
  83. package/dist/commands/create-overlay/create-overlay.command.js +67 -0
  84. package/dist/commands/create-overlay/create-overlay.command.js.map +1 -0
  85. package/dist/commands/create-overlay/generator-octo-overlay-template/generators/app/index.d.ts +12 -0
  86. package/dist/commands/create-overlay/generator-octo-overlay-template/generators/app/index.js +72 -0
  87. package/dist/commands/create-overlay/generator-octo-overlay-template/generators/app/index.js.map +1 -0
  88. package/dist/commands/create-overlay/generator-octo-overlay-template/generators/app/templates/overlays/overlay/actions/add.overlay.action.ts.ejs +50 -0
  89. package/dist/commands/create-overlay/generator-octo-overlay-template/generators/app/templates/overlays/overlay/index.ts.ejs +3 -0
  90. package/dist/commands/create-overlay/generator-octo-overlay-template/generators/app/templates/overlays/overlay/overlay.schema.ts.ejs +13 -0
  91. package/dist/commands/create-overlay/generator-octo-overlay-template/generators/app/templates/overlays/overlay/overlay.ts.ejs +22 -0
  92. package/dist/commands/create-overlay/index.d.ts +1 -0
  93. package/dist/commands/create-overlay/index.js +2 -0
  94. package/dist/commands/create-overlay/index.js.map +1 -0
  95. package/dist/commands/create-resource/create-resource.command.d.ts +11 -0
  96. package/dist/commands/create-resource/create-resource.command.js +55 -0
  97. package/dist/commands/create-resource/create-resource.command.js.map +1 -0
  98. package/dist/commands/create-resource/generator-octo-resource-template/generators/app/index.d.ts +10 -0
  99. package/dist/commands/create-resource/generator-octo-resource-template/generators/app/index.js +71 -0
  100. package/dist/commands/create-resource/generator-octo-resource-template/generators/app/index.js.map +1 -0
  101. package/dist/commands/create-resource/generator-octo-resource-template/generators/app/templates/resources/resource/actions/add.resource.action.ts.ejs +65 -0
  102. package/dist/commands/create-resource/generator-octo-resource-template/generators/app/templates/resources/resource/actions/delete.resource.action.ts.ejs +58 -0
  103. package/dist/commands/create-resource/generator-octo-resource-template/generators/app/templates/resources/resource/actions/update-tags.resource.action.ts.ejs +95 -0
  104. package/dist/commands/create-resource/generator-octo-resource-template/generators/app/templates/resources/resource/index.schema.ts.ejs +31 -0
  105. package/dist/commands/create-resource/generator-octo-resource-template/generators/app/templates/resources/resource/index.ts.ejs +5 -0
  106. package/dist/commands/create-resource/generator-octo-resource-template/generators/app/templates/resources/resource/resource.ts.ejs +12 -0
  107. package/dist/commands/create-resource/index.d.ts +1 -0
  108. package/dist/commands/create-resource/index.js +2 -0
  109. package/dist/commands/create-resource/index.js.map +1 -0
  110. package/dist/index.js +14 -2
  111. package/dist/index.js.map +1 -1
  112. package/dist/utilities/string/string.utility.d.ts +5 -0
  113. package/dist/utilities/string/string.utility.js +26 -0
  114. package/dist/utilities/string/string.utility.js.map +1 -0
  115. package/package.json +2 -2
  116. package/dist/commands/create/create.command.js.map +0 -1
  117. package/dist/commands/create/generator-octo-app-template/generators/app/index.js.map +0 -1
  118. package/dist/commands/create/generator-octo-app-template/generators/app/templates/README.md.ejs +0 -84
  119. package/dist/commands/create/generator-octo-app-template/generators/app/templates/eslint.config.js.ejs +0 -130
  120. package/dist/commands/create/index.d.ts +0 -1
  121. package/dist/commands/create/index.js +0 -2
  122. package/dist/commands/create/index.js.map +0 -1
  123. /package/dist/commands/{create → create-app}/generator-octo-app-template/generators/app/templates/gitignore.ejs +0 -0
  124. /package/dist/commands/{create/generator-octo-app-template/generators/app/templates/src/aws-ecs-server/octo → create-app/generator-octo-app-template/generators/app/templates}/gitkeep.ejs +0 -0
  125. /package/dist/commands/{create → create-app}/generator-octo-app-template/generators/app/templates/prettierrc.ejs +0 -0
  126. /package/dist/commands/{create → create-app}/generator-octo-app-template/generators/app/templates/src/aws-ecs-server/app.config.ts.ejs +0 -0
  127. /package/dist/commands/{create → create-app}/generator-octo-app-template/generators/app/templates/src/aws-ecs-server/env.ejs +0 -0
  128. /package/dist/commands/{create → create-app}/generator-octo-app-template/generators/app/templates/src/aws-ecs-server/module-definitions.ts.ejs +0 -0
  129. /package/dist/commands/{create → create-app}/generator-octo-app-template/generators/app/templates/src/aws-s3-website/app.config.ts.ejs +0 -0
  130. /package/dist/commands/{create → create-app}/generator-octo-app-template/generators/app/templates/src/aws-s3-website/env.ejs +0 -0
  131. /package/dist/commands/{create → create-app}/generator-octo-app-template/generators/app/templates/src/aws-s3-website/website/error.html.ejs +0 -0
  132. /package/dist/commands/{create → create-app}/generator-octo-app-template/generators/app/templates/src/aws-s3-website/website/index.html.ejs +0 -0
  133. /package/dist/commands/{create → create-app}/generator-octo-app-template/generators/app/templates/tsconfig.build.json.ejs +0 -0
  134. /package/dist/commands/{create → create-app}/generator-octo-app-template/generators/app/templates/tsconfig.json.ejs +0 -0
  135. /package/dist/commands/{create/generator-octo-app-template/generators/app/templates/src/aws-s3-website/octo → create-cdk/generator-octo-cdk-template/generators/app/templates}/gitkeep.ejs +0 -0
@@ -0,0 +1,68 @@
1
+ import { readdir, stat } from 'fs/promises';
2
+ import { join, resolve } from 'path';
3
+ import Generator, {} from 'yeoman-generator';
4
+ import { StringUtility } from '../../../../../utilities/string/string.utility.js';
5
+ export default class extends Generator {
6
+ constructor(args, opts) {
7
+ super(args, opts);
8
+ this.moduleName = args[0];
9
+ this.modelType = args[1];
10
+ this.packageName = args[2];
11
+ this.cdkRootDir = args[3];
12
+ }
13
+ async initializing() {
14
+ const targetPath = resolve(join(this.cdkRootDir, 'src', 'modules', this.modelType, this.moduleName, 'models', this.modelType));
15
+ // Check if directory already exists and is not empty.
16
+ let targetPathStat;
17
+ try {
18
+ targetPathStat = await stat(targetPath);
19
+ }
20
+ catch (error) {
21
+ if (error.code !== 'ENOENT') {
22
+ throw error;
23
+ }
24
+ }
25
+ if (targetPathStat?.isDirectory()) {
26
+ const files = await readdir(targetPath);
27
+ if (files.length > 0) {
28
+ throw new Error(`Directory '${targetPath}' already exists and is not empty!`);
29
+ }
30
+ }
31
+ // Set the destination root to the model directory.
32
+ this.destinationRoot(targetPath);
33
+ }
34
+ async writing() {
35
+ // Create the model file.
36
+ this.fs.copyTpl(this.templatePath('models/model/model.ts.ejs'), this.destinationPath(`${this.moduleName}.model.ts`), {
37
+ modelType: this.modelType,
38
+ modelTypePascal: StringUtility.toPascalCase(this.modelType),
39
+ moduleName: this.moduleName,
40
+ moduleNamePascal: StringUtility.toPascalCase(this.moduleName),
41
+ packageName: this.packageName,
42
+ });
43
+ // Create schema file.
44
+ this.fs.copyTpl(this.templatePath('models/model/schema.ts.ejs'), this.destinationPath(`${this.moduleName}.schema.ts`), {
45
+ modelTypePascal: StringUtility.toPascalCase(this.modelType),
46
+ moduleNamePascal: StringUtility.toPascalCase(this.moduleName),
47
+ });
48
+ // Create index.ts
49
+ this.fs.copyTpl(this.templatePath('models/model/index.ts.ejs'), this.destinationPath('index.ts'), {
50
+ moduleName: this.moduleName,
51
+ moduleNamePascal: StringUtility.toPascalCase(this.moduleName),
52
+ });
53
+ // Create actions directory and action file
54
+ this.fs.copyTpl(this.templatePath('models/model/actions/add.model.action.ts.ejs'), this.destinationPath('actions', `add-${this.moduleName}.model.action.ts`), {
55
+ modelType: this.modelType,
56
+ moduleName: this.moduleName,
57
+ moduleNamePascal: StringUtility.toPascalCase(this.moduleName),
58
+ });
59
+ }
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
+ }
68
+ //# sourceMappingURL=index.js.map
@@ -0,0 +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,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IAAI,CAAC,GAAG,CAAC,+CAA+C,CAAC,CAAC;QAC1D,IAAI,CAAC,GAAG,CAAC,wBAAwB,UAAU,EAAE,CAAC,CAAC;QAC/C,IAAI,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;QAC3B,IAAI,CAAC,GAAG,CAAC,4CAA4C,CAAC,CAAC;IACzD,CAAC;CACF"}
@@ -0,0 +1,50 @@
1
+ import {
2
+ Action,
3
+ type ActionOutputs,
4
+ type Diff,
5
+ DiffAction,
6
+ type EnhancedModuleSchema,
7
+ Factory,
8
+ type IModelAction,
9
+ hasNodeName,
10
+ } from '@quadnix/octo';
11
+ import type { <%= moduleNamePascal %>Module } from '../../../<%= moduleName %>.module.js';
12
+ import { <%= moduleNamePascal %> } from '../<%= moduleName %>.model.js';
13
+
14
+ @Action(<%= moduleNamePascal %>)
15
+ export class Add<%= moduleNamePascal %>ModelAction implements IModelAction<<%= moduleNamePascal %>Module> {
16
+ filter(diff: Diff): boolean {
17
+ // Fix me: Update "diff.field" to assert correct model id.
18
+ return (
19
+ diff.action === DiffAction.ADD &&
20
+ diff.node instanceof <%= moduleNamePascal %> &&
21
+ hasNodeName(diff.node, '<%= modelType %>') &&
22
+ diff.field === 'my-model-id'
23
+ );
24
+ }
25
+
26
+ async handle(
27
+ diff: Diff<<%= moduleNamePascal %>>,
28
+ actionInputs: EnhancedModuleSchema<<%= moduleNamePascal %>Module>,
29
+ actionOutputs: ActionOutputs,
30
+ ): Promise<ActionOutputs> {
31
+ const <%= modelType %> = diff.node;
32
+
33
+ // Fix me: Implement the action logic.
34
+ // This is where you would create the actual resources for your module.
35
+
36
+ return actionOutputs;
37
+ }
38
+ }
39
+
40
+ @Factory<Add<%= moduleNamePascal %>ModelAction>(Add<%= moduleNamePascal %>ModelAction)
41
+ export class Add<%= moduleNamePascal %>ModelActionFactory {
42
+ private static instance: Add<%= moduleNamePascal %>ModelAction;
43
+
44
+ static async create(): Promise<Add<%= moduleNamePascal %>ModelAction> {
45
+ if (!this.instance) {
46
+ this.instance = new Add<%= moduleNamePascal %>ModelAction();
47
+ }
48
+ return this.instance;
49
+ }
50
+ }
@@ -0,0 +1,3 @@
1
+ import './actions/add-<%= moduleName %>.model.action.js';
2
+
3
+ export { <%= moduleNamePascal %> } from './<%= moduleName %>.model.js';
@@ -0,0 +1,29 @@
1
+ import { Model, <%= modelTypePascal %> } from '@quadnix/octo';
2
+ import { <%= moduleNamePascal %>Schema } from './<%= moduleName %>.schema.js';
3
+
4
+ @Model<<%= moduleNamePascal %>>('<%= packageName %>', '<%= modelType %>', <%= moduleNamePascal %>Schema)
5
+ export class <%= moduleNamePascal %> extends <%= modelTypePascal %> {
6
+ // Fix me: Add properties specific to your module.
7
+ private readonly customProperty: string;
8
+
9
+ // Fix me: Update constructor to take properties as inputs.
10
+ constructor(customProperty: string) {
11
+ // Fix me: Initialize model with correct ID.
12
+ super(customProperty);
13
+
14
+ // Fix me: Initialize module-specific properties.
15
+ this.customProperty = customProperty;
16
+ }
17
+
18
+ override synth(): <%= moduleNamePascal %>Schema {
19
+ // Fix me: Return serialized schema.
20
+ return {
21
+ customProperty: this.customProperty,
22
+ };
23
+ }
24
+
25
+ static override async unSynth(<%= modelType %>: <%= moduleNamePascal %>Schema): Promise<<%= moduleNamePascal %>> {
26
+ // Fix me: Return unserialized instance of <%= moduleNamePascal %>.
27
+ return new <%= moduleNamePascal %>(<%= modelType %>.customProperty);
28
+ }
29
+ }
@@ -0,0 +1,8 @@
1
+ import { <%= modelTypePascal %>Schema, Schema, Validate } from '@quadnix/octo';
2
+
3
+ export class <%= moduleNamePascal %>Schema extends <%= modelTypePascal %>Schema {
4
+ // Fix me: Add schema properties specific to your module
5
+ // Example:
6
+ @Validate({ options: { minLength: 1 } })
7
+ customProperty = Schema<string>();
8
+ }
@@ -0,0 +1 @@
1
+ export { createModelCommand } from './create-model.command.js';
@@ -0,0 +1,2 @@
1
+ export { createModelCommand } from './create-model.command.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/create-model/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC"}
@@ -0,0 +1,12 @@
1
+ import type { ArgumentsCamelCase, Argv } from 'yargs';
2
+ export declare const createModuleCommand: {
3
+ builder: (yargs: Argv) => Argv;
4
+ command: string;
5
+ describe: string;
6
+ handler: (argv: ArgumentsCamelCase<{
7
+ name: string;
8
+ package: string;
9
+ path: string;
10
+ type: string;
11
+ }>) => Promise<void>;
12
+ };
@@ -0,0 +1,62 @@
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 createModuleCommand = {
8
+ builder: (yargs) => {
9
+ return yargs
10
+ .option('name', {
11
+ alias: 'n',
12
+ demandOption: true,
13
+ description: 'Name of the module to create. Should be in kebab-case (e.g., my-awesome-region).',
14
+ type: 'string',
15
+ })
16
+ .option('type', {
17
+ alias: 't',
18
+ choices: StringUtility.AVAILABLE_MODEL_TYPES,
19
+ demandOption: true,
20
+ description: 'Type of model this module is for.',
21
+ type: 'string',
22
+ })
23
+ .option('package', {
24
+ demandOption: true,
25
+ description: 'Package name for the module.',
26
+ type: 'string',
27
+ })
28
+ .option('path', {
29
+ alias: 'p',
30
+ default: '.',
31
+ description: 'Root directory path of the CDK.',
32
+ type: 'string',
33
+ });
34
+ },
35
+ command: 'create-module',
36
+ describe: 'Create a new Octo module.',
37
+ handler: async (argv) => {
38
+ const { name, package: packageName, path, type } = argv;
39
+ // Validate module name format (should be kebab-case)
40
+ if (!StringUtility.isKebabCase(name)) {
41
+ console.error(chalk.red('Module name must be in kebab-case format (e.g., my-awesome-region)'));
42
+ process.exit(1);
43
+ }
44
+ console.log(chalk.blue(`Creating module "${name}" of type "${type}"...`));
45
+ const env = createEnv();
46
+ env.register(resolve(__dirname, 'generator-octo-module-template/generators/app/index.js'), {
47
+ namespace: 'generator-octo-module-template:app',
48
+ });
49
+ try {
50
+ await env.run(['generator-octo-module-template:app', name, type, packageName, path], {
51
+ skipCache: true,
52
+ skipInstall: true,
53
+ });
54
+ console.log(chalk.green(`Successfully created module!`));
55
+ }
56
+ catch (error) {
57
+ console.error(chalk.red(`Failed to create module! ${error.message}`));
58
+ process.exit(1);
59
+ }
60
+ },
61
+ };
62
+ //# sourceMappingURL=create-module.command.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-module.command.js","sourceRoot":"","sources":["../../../src/commands/create-module/create-module.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,mBAAmB,GAAG;IACjC,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,kFAAkF;YAC/F,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,mCAAmC;YAChD,IAAI,EAAE,QAAQ;SACf,CAAC;aACD,MAAM,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AC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,4BAA4B,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;YACtE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC;CACF,CAAC"}
@@ -0,0 +1,11 @@
1
+ import Generator, { type BaseOptions } from 'yeoman-generator';
2
+ export default class extends Generator {
3
+ private readonly cdkRootDir;
4
+ private readonly modelType;
5
+ private readonly moduleName;
6
+ private readonly packageName;
7
+ constructor(args: string[], opts: BaseOptions);
8
+ initializing(): Promise<void>;
9
+ writing(): Promise<void>;
10
+ end(): void;
11
+ }
@@ -0,0 +1,60 @@
1
+ import { readdir, stat } from 'fs/promises';
2
+ import { join, resolve } from 'path';
3
+ import Generator, {} from 'yeoman-generator';
4
+ import { StringUtility } from '../../../../../utilities/string/string.utility.js';
5
+ export default class extends Generator {
6
+ constructor(args, opts) {
7
+ super(args, opts);
8
+ this.moduleName = args[0];
9
+ this.modelType = args[1];
10
+ this.packageName = args[2];
11
+ this.cdkRootDir = args[3];
12
+ }
13
+ async initializing() {
14
+ const targetPath = resolve(join(this.cdkRootDir, 'src', 'modules', this.modelType, this.moduleName));
15
+ // Check if directory already exists and is not empty.
16
+ let targetPathStat;
17
+ try {
18
+ targetPathStat = await stat(targetPath);
19
+ }
20
+ catch (error) {
21
+ if (error.code !== 'ENOENT') {
22
+ throw error;
23
+ }
24
+ }
25
+ if (targetPathStat?.isDirectory()) {
26
+ const files = await readdir(targetPath, { withFileTypes: true });
27
+ if (files.filter((f) => f.isFile()).length > 0) {
28
+ throw new Error(`Directory '${targetPath}' already exists and is not empty!`);
29
+ }
30
+ }
31
+ // Set the destination root to the module directory.
32
+ this.destinationRoot(targetPath);
33
+ }
34
+ async writing() {
35
+ // Create the module file
36
+ this.fs.copyTpl(this.templatePath('module.ts.ejs'), this.destinationPath(`${this.moduleName}.module.ts`), {
37
+ modelTypePascal: StringUtility.toPascalCase(this.modelType),
38
+ moduleNamePascal: StringUtility.toPascalCase(this.moduleName),
39
+ packageName: this.packageName,
40
+ });
41
+ // Create index.schema.ts
42
+ this.fs.copyTpl(this.templatePath('index.schema.ts.ejs'), this.destinationPath('index.schema.ts'), {
43
+ moduleNamePascal: StringUtility.toPascalCase(this.moduleName),
44
+ });
45
+ // Create index.ts
46
+ this.fs.copyTpl(this.templatePath('index.ts.ejs'), this.destinationPath('index.ts'), {
47
+ moduleName: this.moduleName,
48
+ moduleNamePascal: StringUtility.toPascalCase(this.moduleName),
49
+ });
50
+ }
51
+ end() {
52
+ const targetPath = resolve(join(this.cdkRootDir, 'src', 'modules', this.modelType, this.moduleName));
53
+ this.log('✅ Your module has been generated successfully!');
54
+ this.log(`📁 Module created at: ${targetPath}`);
55
+ this.log('📦 Next steps:');
56
+ this.log(` Update index.schema.ts`);
57
+ this.log(` Implement the logic in ${this.moduleName}.module.ts`);
58
+ }
59
+ }
60
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/commands/create-module/generator-octo-module-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,I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+1 @@
1
+ export { <%= moduleNamePascal %>Module } from './<%= moduleName %>.module.js';
@@ -0,0 +1,9 @@
1
+ import { AModule, Module, type <%= modelTypePascal %> } from '@quadnix/octo';
2
+ import { <%= moduleNamePascal %>ModuleSchema } from './index.schema.js';
3
+
4
+ @Module<<%= moduleNamePascal %>Module>('<%= packageName %>', <%= moduleNamePascal %>ModuleSchema)
5
+ export class <%= moduleNamePascal %>Module extends AModule<<%= moduleNamePascal %>ModuleSchema, <%= modelTypePascal %>> {
6
+ async onInit(inputs: <%= moduleNamePascal %>ModuleSchema): Promise<<%= modelTypePascal %>> {
7
+ // Fix me: Create and return a new instance of <%= modelTypePascal %>.
8
+ }
9
+ }
@@ -0,0 +1 @@
1
+ export { createModuleCommand } from './create-module.command.js';
@@ -0,0 +1,2 @@
1
+ export { createModuleCommand } from './create-module.command.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/create-module/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC"}
@@ -0,0 +1,13 @@
1
+ import type { ArgumentsCamelCase, Argv } from 'yargs';
2
+ export declare const createOverlayCommand: {
3
+ builder: (yargs: Argv) => Argv;
4
+ command: string;
5
+ describe: string;
6
+ handler: (argv: ArgumentsCamelCase<{
7
+ name: string;
8
+ overlay: string;
9
+ package: string;
10
+ path: string;
11
+ type: string;
12
+ }>) => Promise<void>;
13
+ };
@@ -0,0 +1,67 @@
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 createOverlayCommand = {
8
+ builder: (yargs) => {
9
+ return yargs
10
+ .option('name', {
11
+ alias: 'n',
12
+ demandOption: true,
13
+ description: 'Name of the module where the overlay is created. Should be in kebab-case (e.g., my-awesome-region).',
14
+ type: 'string',
15
+ })
16
+ .option('type', {
17
+ alias: 't',
18
+ choices: StringUtility.AVAILABLE_MODEL_TYPES,
19
+ demandOption: true,
20
+ description: 'Type of model this overlay is for.',
21
+ type: 'string',
22
+ })
23
+ .option('package', {
24
+ demandOption: true,
25
+ description: 'Package name for the overlay.',
26
+ type: 'string',
27
+ })
28
+ .option('overlay', {
29
+ demandOption: true,
30
+ description: 'Overlay name for the module.',
31
+ type: 'string',
32
+ })
33
+ .option('path', {
34
+ alias: 'p',
35
+ default: '.',
36
+ description: 'Root directory path of the CDK.',
37
+ type: 'string',
38
+ });
39
+ },
40
+ command: 'create-overlay',
41
+ describe: 'Create a new Octo overlay.',
42
+ handler: async (argv) => {
43
+ const { name, overlay, package: packageName, path, type } = argv;
44
+ // Validate module and overlay name format (should be kebab-case)
45
+ if (!StringUtility.isKebabCase(name) || !StringUtility.isKebabCase(overlay)) {
46
+ console.error(chalk.red('Module/Overlay name must be in kebab-case format (e.g., my-awesome-region)'));
47
+ process.exit(1);
48
+ }
49
+ console.log(chalk.blue(`Creating overlay for module "${name}" of type "${type}"...`));
50
+ const env = createEnv();
51
+ env.register(resolve(__dirname, 'generator-octo-overlay-template/generators/app/index.js'), {
52
+ namespace: 'generator-octo-overlay-template:app',
53
+ });
54
+ try {
55
+ await env.run(['generator-octo-overlay-template:app', name, type, packageName, overlay, path], {
56
+ skipCache: true,
57
+ skipInstall: true,
58
+ });
59
+ console.log(chalk.green(`Successfully created overlay!`));
60
+ }
61
+ catch (error) {
62
+ console.error(chalk.red(`Failed to create overlay! ${error.message}`));
63
+ process.exit(1);
64
+ }
65
+ },
66
+ };
67
+ //# sourceMappingURL=create-overlay.command.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-overlay.command.js","sourceRoot":"","sources":["../../../src/commands/create-overlay/create-overlay.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE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RootDir;
4
+ private readonly modelType;
5
+ private readonly moduleName;
6
+ private readonly overlayName;
7
+ private readonly packageName;
8
+ constructor(args: string[], opts: BaseOptions);
9
+ initializing(): Promise<void>;
10
+ writing(): Promise<void>;
11
+ end(): void;
12
+ }
@@ -0,0 +1,72 @@
1
+ import { readdir, stat } from 'fs/promises';
2
+ import { join, resolve } from 'path';
3
+ import Generator, {} from 'yeoman-generator';
4
+ import { StringUtility } from '../../../../../utilities/string/string.utility.js';
5
+ export default class extends Generator {
6
+ constructor(args, opts) {
7
+ super(args, opts);
8
+ this.moduleName = args[0];
9
+ this.modelType = args[1];
10
+ this.packageName = args[2];
11
+ this.overlayName = args[3];
12
+ this.cdkRootDir = args[4];
13
+ }
14
+ async initializing() {
15
+ const targetPath = resolve(join(this.cdkRootDir, 'src', 'modules', this.modelType, this.moduleName, 'overlays', `${this.moduleName}-${this.overlayName}`));
16
+ // Check if directory already exists and is not empty.
17
+ let targetPathStat;
18
+ try {
19
+ targetPathStat = await stat(targetPath);
20
+ }
21
+ catch (error) {
22
+ if (error.code !== 'ENOENT') {
23
+ throw error;
24
+ }
25
+ }
26
+ if (targetPathStat?.isDirectory()) {
27
+ const files = await readdir(targetPath);
28
+ if (files.length > 0) {
29
+ throw new Error(`Directory '${targetPath}' already exists and is not empty!`);
30
+ }
31
+ }
32
+ // Set the destination root to the overlay directory.
33
+ this.destinationRoot(targetPath);
34
+ }
35
+ async writing() {
36
+ // Create the overlay file.
37
+ this.fs.copyTpl(this.templatePath('overlays/overlay/overlay.ts.ejs'), this.destinationPath(`${this.moduleName}-${this.overlayName}.overlay.ts`), {
38
+ moduleName: this.moduleName,
39
+ moduleNamePascal: StringUtility.toPascalCase(this.moduleName),
40
+ overlayName: this.overlayName,
41
+ overlayNamePascal: StringUtility.toPascalCase(this.overlayName),
42
+ packageName: this.packageName,
43
+ });
44
+ // Create schema file.
45
+ this.fs.copyTpl(this.templatePath('overlays/overlay/overlay.schema.ts.ejs'), this.destinationPath(`${this.moduleName}-${this.overlayName}.schema.ts`), {
46
+ moduleNamePascal: StringUtility.toPascalCase(this.moduleName),
47
+ overlayNamePascal: StringUtility.toPascalCase(this.overlayName),
48
+ });
49
+ // Create index.ts
50
+ this.fs.copyTpl(this.templatePath('overlays/overlay/index.ts.ejs'), this.destinationPath('index.ts'), {
51
+ moduleName: this.moduleName,
52
+ moduleNamePascal: StringUtility.toPascalCase(this.moduleName),
53
+ overlayName: this.overlayName,
54
+ overlayNamePascal: StringUtility.toPascalCase(this.overlayName),
55
+ });
56
+ // Create actions directory and action file
57
+ this.fs.copyTpl(this.templatePath('overlays/overlay/actions/add.overlay.action.ts.ejs'), this.destinationPath('actions', `add-${this.moduleName}-${this.overlayName}.overlay.action.ts`), {
58
+ moduleName: this.moduleName,
59
+ moduleNamePascal: StringUtility.toPascalCase(this.moduleName),
60
+ overlayName: this.overlayName,
61
+ overlayNamePascal: StringUtility.toPascalCase(this.overlayName),
62
+ });
63
+ }
64
+ end() {
65
+ const targetPath = resolve(join(this.cdkRootDir, 'src', 'modules', this.modelType, this.moduleName, 'overlays', `${this.moduleName}-${this.overlayName}`));
66
+ this.log('✅ Your overlay has been generated successfully!');
67
+ this.log(`📁 Overlay created at: ${targetPath}`);
68
+ this.log('📦 Next steps:');
69
+ this.log(` Address all "Fix me" in generated files`);
70
+ }
71
+ }
72
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/commands/create-overlay/generator-octo-overlay-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,SA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AC,OAAO,CACb,IAAI,CAAC,YAAY,CAAC,oDAAoD,CAAC,EACvE,IAAI,CAAC,eAAe,CAAC,SAAS,EAAE,OAAO,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,WAAW,oBAAoB,CAAC,EAC/F;YACE,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,gBAAgB,EAAE,aAAa,CAAC,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC;YAC7D,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,iBAAiB,EAAE,aAAa,CAAC,YAAY,CAAC,IAAI,CAAC,WAAW,CAAC;SAChE,CACF,CAAC;IACJ,CAAC;IAED,GAAG;QACD,MAAM,UAAU,GAAG,OAAO,CACxB,IAAI,CACF,IAAI,CAAC,UAAU,EACf,KAAK,EACL,SAAS,EACT,IAAI,CAAC,SAAS,EACd,IAAI,CAAC,UAAU,EACf,UAAU,EACV,GAAG,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,WAAW,EAAE,CACzC,CACF,CAAC;QAEF,IAAI,CAAC,GAAG,CAAC,iDAAiD,CAAC,CAAC;QAC5D,IAAI,CAAC,GAAG,CAAC,0BAA0B,UAAU,EAAE,CAAC,CAAC;QACjD,IAAI,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;QAC3B,IAAI,CAAC,GAAG,CAAC,4CAA4C,CAAC,CAAC;IACzD,CAAC;CACF"}
@@ -0,0 +1,50 @@
1
+ import {
2
+ Action,
3
+ type ActionOutputs,
4
+ type Diff,
5
+ DiffAction,
6
+ type EnhancedModuleSchema,
7
+ Factory,
8
+ type IModelAction,
9
+ hasNodeName,
10
+ } from '@quadnix/octo';
11
+ import type { <%= moduleNamePascal %>Module } from '../../../<%= moduleName %>.module.js';
12
+ import { <%= moduleNamePascal %><%= overlayNamePascal %>Overlay } from '../<%= moduleName %>-<%= overlayName %>.overlay.js';
13
+
14
+ @Action(<%= moduleNamePascal %><%= overlayNamePascal %>Overlay)
15
+ export class Add<%= moduleNamePascal %><%= overlayNamePascal %>OverlayAction implements IModelAction<<%= moduleNamePascal %>Module> {
16
+ filter(diff: Diff): boolean {
17
+ return (
18
+ diff.action === DiffAction.ADD &&
19
+ diff.node instanceof <%= moduleNamePascal %><%= overlayNamePascal %>Overlay &&
20
+ hasNodeName(diff.node, '<%= moduleName %>-<%= overlayName %>-overlay') &&
21
+ diff.field === 'overlayId'
22
+ );
23
+ }
24
+
25
+ async handle(
26
+ diff: Diff<<%= moduleNamePascal %><%= overlayNamePascal %>Overlay>,
27
+ actionInputs: EnhancedModuleSchema<<%= moduleNamePascal %>Module>,
28
+ actionOutputs: ActionOutputs,
29
+ ): Promise<ActionOutputs> {
30
+ const overlay = diff.node;
31
+ const properties = overlay.properties;
32
+
33
+ // Fix me: Implement the action logic.
34
+ // This is where you would create the actual resources for your module.
35
+
36
+ return actionOutputs;
37
+ }
38
+ }
39
+
40
+ @Factory<Add<%= moduleNamePascal %><%= overlayNamePascal %>OverlayAction>(Add<%= moduleNamePascal %><%= overlayNamePascal %>OverlayAction)
41
+ export class Add<%= moduleNamePascal %><%= overlayNamePascal %>OverlayActionFactory {
42
+ private static instance: Add<%= moduleNamePascal %><%= overlayNamePascal %>OverlayAction;
43
+
44
+ static async create(): Promise<Add<%= moduleNamePascal %><%= overlayNamePascal %>OverlayAction> {
45
+ if (!this.instance) {
46
+ this.instance = new Add<%= moduleNamePascal %><%= overlayNamePascal %>OverlayAction();
47
+ }
48
+ return this.instance;
49
+ }
50
+ }
@@ -0,0 +1,3 @@
1
+ import './actions/add-<%= moduleName %>-<%= overlayName %>.overlay.action.js';
2
+
3
+ export { <%= moduleNamePascal %><%= overlayNamePascal %>Overlay } from './<%= moduleName %>-<%= overlayName %>.overlay.js';
@@ -0,0 +1,13 @@
1
+ import { BaseOverlaySchema, Schema, Validate } from '@quadnix/octo';
2
+
3
+ export class <%= moduleNamePascal %><%= overlayNamePascal %>OverlaySchema extends BaseOverlaySchema {
4
+ @Validate({
5
+ destruct: (value: <%= moduleNamePascal %><%= overlayNamePascal %>OverlaySchema['properties']): string[] => [
6
+ // Fix me: Add properties for validation.
7
+ ],
8
+ options: { minLength: 1 },
9
+ })
10
+ override properties = Schema<{
11
+ // Fix me: Add overlay properties.
12
+ }>();
13
+ }