@quadnix/octo-build 0.0.9 → 0.0.11

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 (33) hide show
  1. package/dist/commands/create-app/generator-octo-app-template/generators/app/index.js +4 -6
  2. package/dist/commands/create-app/generator-octo-app-template/generators/app/index.js.map +1 -1
  3. package/dist/commands/create-app/generator-octo-app-template/generators/app/templates/README.md.ejs +42 -25
  4. package/dist/commands/create-app/generator-octo-app-template/generators/app/templates/package.json.ejs +0 -3
  5. package/dist/commands/create-app/generator-octo-app-template/generators/app/templates/src/aws-ecs-server/main.ts.ejs +2 -0
  6. package/dist/commands/create-app/generator-octo-app-template/generators/app/templates/src/aws-ecs-server/module-definitions.ts.ejs +1 -2
  7. package/dist/commands/create-app/generator-octo-app-template/generators/app/templates/src/aws-s3-website/octo.yaml.ejs +48 -0
  8. package/dist/commands/create-resource/generator-octo-resource-template/generators/app/templates/resources/resource/actions/add.resource.action.ts.ejs +7 -16
  9. package/dist/commands/create-resource/generator-octo-resource-template/generators/app/templates/resources/resource/actions/delete.resource.action.ts.ejs +0 -18
  10. package/dist/commands/create-resource/generator-octo-resource-template/generators/app/templates/resources/resource/actions/update-tags.resource.action.ts.ejs +4 -13
  11. package/dist/commands/run/index.d.ts +1 -0
  12. package/dist/commands/run/index.js +2 -0
  13. package/dist/commands/run/index.js.map +1 -0
  14. package/dist/commands/run/run.command.d.ts +11 -0
  15. package/dist/commands/run/run.command.js +83 -0
  16. package/dist/commands/run/run.command.js.map +1 -0
  17. package/dist/commands/state/index.d.ts +1 -0
  18. package/dist/commands/state/index.js +2 -0
  19. package/dist/commands/state/index.js.map +1 -0
  20. package/dist/commands/state/state.command.d.ts +14 -0
  21. package/dist/commands/state/state.command.js +79 -0
  22. package/dist/commands/state/state.command.js.map +1 -0
  23. package/dist/index.js +4 -0
  24. package/dist/index.js.map +1 -1
  25. package/dist/resources/octo-v1.schema.json +170 -0
  26. package/dist/utilities/definition/yaml/yaml-definition.utility.d.ts +60 -0
  27. package/dist/utilities/definition/yaml/yaml-definition.utility.js +223 -0
  28. package/dist/utilities/definition/yaml/yaml-definition.utility.js.map +1 -0
  29. package/package.json +5 -2
  30. package/dist/commands/create-app/generator-octo-app-template/generators/app/templates/src/aws-s3-website/app.config.ts.ejs +0 -25
  31. package/dist/commands/create-app/generator-octo-app-template/generators/app/templates/src/aws-s3-website/env.ejs +0 -5
  32. package/dist/commands/create-app/generator-octo-app-template/generators/app/templates/src/aws-s3-website/main.ts.ejs +0 -22
  33. package/dist/commands/create-app/generator-octo-app-template/generators/app/templates/src/aws-s3-website/module-definitions.ts.ejs +0 -52
@@ -44,7 +44,6 @@ export default class extends Generator {
44
44
  '@quadnix/octo': '0.0.x',
45
45
  '@quadnix/octo-aws-cdk': '0.0.x',
46
46
  '@quadnix/octo-event-listeners': '0.0.x',
47
- 'env-smart': '^2.3.2',
48
47
  });
49
48
  await this.addDevDependencies({
50
49
  '@eslint/js': '^9.33.0',
@@ -86,7 +85,9 @@ export default class extends Generator {
86
85
  const templatePath = `src/${this.appTemplate}`;
87
86
  this.fs.copyTpl(this.templatePath(`${templatePath}/app.config.ts.ejs`), this.destinationPath('src/app.config.ts'));
88
87
  this.fs.copyTpl(this.templatePath(`${templatePath}/env.ejs`), this.destinationPath('.env'));
89
- this.fs.copyTpl(this.templatePath(`${templatePath}/main.ts.ejs`), this.destinationPath('src/main.ts'));
88
+ this.fs.copyTpl(this.templatePath(`${templatePath}/main.ts.ejs`), this.destinationPath('src/main.ts'), {
89
+ name: this.appName,
90
+ });
90
91
  this.fs.copyTpl(this.templatePath(`${templatePath}/module-definitions.ts.ejs`), this.destinationPath('src/module-definitions.ts'));
91
92
  }
92
93
  else if (this.appTemplate === 'aws-s3-website') {
@@ -97,10 +98,7 @@ export default class extends Generator {
97
98
  this.fs.copyTpl(this.templatePath(`${templatePath}/website/index.html.ejs`), this.destinationPath('website/index.html'), {
98
99
  name: this.appName,
99
100
  });
100
- this.fs.copyTpl(this.templatePath(`${templatePath}/app.config.ts.ejs`), this.destinationPath('src/app.config.ts'));
101
- this.fs.copyTpl(this.templatePath(`${templatePath}/env.ejs`), this.destinationPath('.env'));
102
- this.fs.copyTpl(this.templatePath(`${templatePath}/main.ts.ejs`), this.destinationPath('src/main.ts'));
103
- this.fs.copyTpl(this.templatePath(`${templatePath}/module-definitions.ts.ejs`), this.destinationPath('src/module-definitions.ts'));
101
+ this.fs.copyTpl(this.templatePath(`${templatePath}/octo.yaml.ejs`), this.destinationPath('octo.yaml'));
104
102
  }
105
103
  else {
106
104
  throw new Error(`Unsupported app template: ${this.appTemplate}`);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/commands/create-app/generator-octo-app-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;AAE/D,MAAM,CAAC,OAAO,MAAO,SAAQ,SAAS;IAKpC,YAAY,IAAc,EAAE,IAAiB;QAC3C,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAElB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QACvB,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;IAC7B,CAAC;IAED,KAAK,CAAC,YAAY;QAChB,MAAM,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;QAE7D,sDAAsD;QACtD,IAAI,cAAiC,CAAC;QACtC,IAAI,CAAC;YACH,cAAc,GAAG,MAAM,IAAI,CAAC,UAAU,CAA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AAU,EAAE,CAAC,CAAC;QAChC,IAAI,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;QAC3B,IAAI,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;QAC7B,IAAI,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAC3B,CAAC;CACF"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/commands/create-app/generator-octo-app-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;AAE/D,MAAM,CAAC,OAAO,MAAO,SAAQ,SAAS;IAKpC,YAAY,IAAc,EAAE,IAAiB;QAC3C,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAElB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QACvB,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;IAC7B,CAAC;IAED,KAAK,CAAC,YAAY;QAChB,MAAM,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;QAE7D,sDAAsD;QACtD,IAAI,cAAiC,CAAC;QACtC,IAAI,CAAC;YACH,cAAc,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,CAAC;QAC1C,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;gBAC5B,MAAM,KAAK,CAAC;YACd,CAAC;QACH,CAAC;QACD,IAAI,cAAc,EAAE,WAAW,EAAE,EAAE,CAAC;YAClC,MAAM,KA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CACF,CAAC;YACF,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC,GAAG,YAAY,gBAAgB,CAAC,EAAE,IAAI,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC,CAAC;QACzG,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,KAAK,CAAC,6BAA6B,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;QACnE,CAAC;IACH,CAAC;IAED,GAAG;QACD,MAAM,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;QAE7D,IAAI,CAAC,GAAG,CAAC,wDAAwD,CAAC,CAAC;QACnE,IAAI,CAAC,GAAG,CAAC,sBAAsB,UAAU,EAAE,CAAC,CAAC;QAC7C,IAAI,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;QAC3B,IAAI,CAAC,GAAG,CAAC,SAAS,UAAU,EAAE,CAAC,CAAC;QAChC,IAAI,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;QAC3B,IAAI,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;QAC7B,IAAI,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAC3B,CAAC;CACF"}
@@ -11,42 +11,59 @@ npm install
11
11
 
12
12
  ## Fix me
13
13
  Before running the app, ensure,
14
- - `.env` values are appropriately set.
14
+ - `env` values are appropriately set in `octo.yaml`.
15
+
16
+ ## Running the Definition file
17
+ The `octo.yaml` is your Octo definition file.
18
+ It contains all the modules you want to run,
19
+ which will create your infrastructure resources as per the module's instructions.
20
+
21
+ To run the definition file,
22
+ ```bash
23
+ npx @quadnix/octo-build run -d octo.yaml
24
+ ```
15
25
 
16
26
  ## Development
27
+ The rest of the setup is a TypeScript project for you to get started with developing new modules in Octo quickly.
28
+ You can follow the official documentation to learn more.
29
+ Once you have your custom constructs and modules defined, you can use below commands to build those modules.
30
+ Don't forget to add your new modules to your Octo definition file.
31
+
17
32
  ```bash
18
- # Build app. This will compile your TypeScript code.
19
33
  npm run build
20
-
21
- # Run app. This will create the infrastructure defined in your app.
22
- npm start
23
34
  ```
24
35
 
25
36
  ## Destroy
37
+ Once you have your infrastructure created, and you wish all of them destroyed,
38
+ its as simple as commenting out the necessary modules and re-running the app.
39
+
26
40
  ### Step 1
27
- In `module-definitions.ts`, comment out all modules except the `app` and `account` modules.
41
+ In `octo.yaml`, comment out all modules except the `app` and `account` modules.
28
42
  The app and account modules load AWS credentials to call AWS APIs, hence they remain uncommented.
29
43
 
30
- By deleting the `s3-website-service-module` module below,
44
+ By commenting the `s3-website-service-module` module below,
31
45
  you are safely deleting the s3-website resources created by this module.
32
46
 
33
- ```typescript
34
- // Example for 'aws-s3-website' template.
35
- private init(): void {
36
- this.add(SimpleAppModule, 'app-module', { name: 'aws-s3-website' });
37
-
38
- this.add(AwsIniAccountModule, 'account-module', {
39
- accountId: config.AWS_ACCOUNT_ID,
40
- app: stub<App>('${{app-module.model.app}}'),
41
- });
42
-
43
- // this.add(AwsS3StaticWebsiteServiceModule, 's3-website-service-module', {
44
- // account: stub<Account>('${{account-module.model.account}}'),
45
- // awsRegionId: 'us-east-1',
46
- // bucketName: config.AWS_S3_WEBSITE_BUCKET_NAME,
47
- // directoryPath: websiteSourcePath,
48
- // });
49
- }
47
+ ```yaml
48
+ modules:
49
+ - moduleId: app-module
50
+ moduleClass: SimpleAppModule
51
+ moduleInputs:
52
+ name: aws-s3-website
53
+
54
+ - moduleId: account-module
55
+ moduleClass: AwsIniAccountModule
56
+ moduleInputs:
57
+ accountId: "${env.AWS_ACCOUNT_ID}"
58
+ app: "${{app-module.model.app}}"
59
+
60
+ #- moduleId: s3-website-service-module
61
+ # moduleClass: AwsS3StaticWebsiteServiceModule
62
+ # moduleInputs:
63
+ # account: "${{account-module.model.account}}"
64
+ # awsRegionId: us-east-1
65
+ # bucketName: "${env.AWS_S3_WEBSITE_BUCKET_NAME}"
66
+ # directoryPath: website
50
67
  ```
51
68
 
52
69
  ### Step 2
@@ -54,5 +71,5 @@ Then, simply re-build and run your app again.
54
71
 
55
72
  ```bash
56
73
  npm run build
57
- npm start
74
+ npx @quadnix/octo-build run -d octo.yaml
58
75
  ```
@@ -37,18 +37,15 @@
37
37
  "octo",
38
38
  "typescript"
39
39
  ],
40
- "main": "dist/main.js",
41
40
  "name": "<%= name %>",
42
41
  "private": true,
43
42
  "scripts": {
44
43
  "build": "rimraf dist && tsc -p tsconfig.build.json",
45
44
  "format": "prettier --write \"src/**/*.ts\"",
46
45
  "lint": "eslint .",
47
- "start": "node dist/main.js",
48
46
  "test": "NODE_OPTIONS=--experimental-vm-modules jest --testRegex=\"\\.spec.ts$\"",
49
47
  "test:e2e": "NODE_OPTIONS=--experimental-vm-modules jest --testRegex=\"\\.e2e-spec.ts$\""
50
48
  },
51
49
  "type": "module",
52
- "types": "dist/main.d.ts",
53
50
  "version": "<%= version %>"
54
51
  }
@@ -11,6 +11,8 @@ const octo = new Octo();
11
11
  const stateProvider = new LocalStateProvider(octoStatePath);
12
12
  await octo.initialize(stateProvider, [{ type: HtmlReportEventListener }, { type: LoggingEventListener }]);
13
13
 
14
+ octo.registerTags([{ scope: {}, tags: { 'cdk': '<%= name %>' } }]);
15
+
14
16
  const moduleDefinitions = new ModuleDefinitions();
15
17
  for (const moduleDefinition of moduleDefinitions.getAll()) {
16
18
  octo.loadModule(moduleDefinition.module, moduleDefinition.moduleId, moduleDefinition.moduleInputs);
@@ -5,7 +5,7 @@ import {
5
5
  type Constructable,
6
6
  type Deployment,
7
7
  type Environment,
8
- Execution,
8
+ type Execution,
9
9
  type ModuleSchemaInputs,
10
10
  type Region,
11
11
  type Server,
@@ -76,7 +76,6 @@ export class ModuleDefinitions {
76
76
  image: {
77
77
  command: 'node webserver',
78
78
  ports: [{ containerPort: 80, protocol: 'tcp' }],
79
- // eslint-disable-next-line spellcheck/spell-checker
80
79
  uri: 'docker.io/ealen/echo-server:0.9.2',
81
80
  },
82
81
  memory: 512,
@@ -0,0 +1,48 @@
1
+ # yaml-language-server: $schema=https://raw.githubusercontent.com/quadnix/octo/refs/heads/main/packages/octo-build/src/resources/octo-v1.schema.json
2
+
3
+ version: 1
4
+
5
+ env:
6
+ - key: AWS_ACCOUNT_ID
7
+ kind: string
8
+ value: "123456789123"
9
+ - key: AWS_S3_WEBSITE_BUCKET_NAME
10
+ kind: string
11
+ value: my-website-unique-bucket
12
+
13
+ settings:
14
+ listeners:
15
+ - type: HtmlReportEventListener
16
+ - type: LoggingEventListener
17
+
18
+ stateProvider:
19
+ type: LocalStateProvider
20
+ statePath: .octo
21
+
22
+ imports:
23
+ - className: SimpleAppModule
24
+ importPath: "@quadnix/octo-aws-cdk/modules/app/simple-app"
25
+ - className: AwsIniAccountModule
26
+ importPath: "@quadnix/octo-aws-cdk/modules/account/aws-ini-account"
27
+ - className: AwsS3StaticWebsiteServiceModule
28
+ importPath: "@quadnix/octo-aws-cdk/modules/service/aws-s3-static-website-service"
29
+
30
+ modules:
31
+ - moduleId: app-module
32
+ moduleClass: SimpleAppModule
33
+ moduleInputs:
34
+ name: aws-s3-website
35
+
36
+ - moduleId: account-module
37
+ moduleClass: AwsIniAccountModule
38
+ moduleInputs:
39
+ accountId: "${env.AWS_ACCOUNT_ID}"
40
+ app: "${{app-module.model.app}}"
41
+
42
+ - moduleId: s3-website-service-module
43
+ moduleClass: AwsS3StaticWebsiteServiceModule
44
+ moduleInputs:
45
+ account: "${{account-module.model.account}}"
46
+ awsRegionId: us-east-1
47
+ bucketName: "${env.AWS_S3_WEBSITE_BUCKET_NAME}"
48
+ directoryPath: website
@@ -17,7 +17,7 @@ export class Add<%= resourceNamePascal %>ResourceAction extends ANodeAction impl
17
17
  );
18
18
  }
19
19
 
20
- async handle(diff: Diff<<%= resourceNamePascal %>>): Promise<void> {
20
+ async handle(diff: Diff<<%= resourceNamePascal %>>): Promise<<%= resourceNamePascal %>Schema['response']> {
21
21
  // Get properties.
22
22
  const <%= resourceNamePascal.toLowerCase().charAt(0) + resourceNamePascal.slice(1) %> = diff.node;
23
23
  const properties = <%= resourceNamePascal.toLowerCase().charAt(0) + resourceNamePascal.slice(1) %>.properties;
@@ -28,27 +28,18 @@ export class Add<%= resourceNamePascal %>ResourceAction extends ANodeAction impl
28
28
  // This is where you would create the actual resource.
29
29
 
30
30
  // Set response.
31
- // Fix me: Set response properties.
31
+ // Fix me: Return response properties.
32
+ return response;
32
33
  }
33
34
 
34
- async mock(diff: Diff<<%= resourceNamePascal %>>, capture: Partial<<%= resourceNamePascal %>Schema['response']>): Promise<void> {
35
+ async mock(diff: Diff<<%= resourceNamePascal %>>, capture: Partial<<%= resourceNamePascal %>Schema['response']>): Promise<<%= resourceNamePascal %>Schema['response']> {
35
36
  // Get properties.
36
37
  const <%= resourceNamePascal.toLowerCase().charAt(0) + resourceNamePascal.slice(1) %> = diff.node;
37
38
  const properties = <%= resourceNamePascal.toLowerCase().charAt(0) + resourceNamePascal.slice(1) %>.properties;
39
+ const response = <%= resourceNamePascal.toLowerCase().charAt(0) + resourceNamePascal.slice(1) %>.response;
38
40
 
39
- // Fix me: Implement mock logic for captures.
40
- // E.g.,
41
- // const ec2Client = await this.container.get<EC2Client, typeof EC2ClientFactory>(EC2Client, {
42
- // args: [properties.awsAccountId, properties.awsRegionId],
43
- // metadata: { package: '@example' },
44
- // });
45
- // ec2Client.send = async (instance: unknown): Promise<unknown> => {
46
- // if (instance instanceof CreateVpcCommand) {
47
- // return { Vpc: { VpcId: capture.VpcId } };
48
- // } else if (instance instanceof ModifyVpcAttributeCommand) {
49
- // return {};
50
- // }
51
- // };
41
+ // Fix me: Return response using captures.
42
+ return response;
52
43
  }
53
44
  }
54
45
 
@@ -25,24 +25,6 @@ export class Delete<%= resourceNamePascal %>ResourceAction extends ANodeAction i
25
25
  // Fix me: Implement the delete resource logic.
26
26
  // This is where you would delete the actual resource.
27
27
  }
28
-
29
- async mock(diff: Diff<<%= resourceNamePascal %>>): Promise<void> {
30
- // Get properties.
31
- const <%= resourceNamePascal.toLowerCase().charAt(0) + resourceNamePascal.slice(1) %> = diff.node;
32
- const properties = <%= resourceNamePascal.toLowerCase().charAt(0) + resourceNamePascal.slice(1) %>.properties;
33
-
34
- // Fix me: Implement mock logic for captures.
35
- // E.g.,
36
- // const ec2Client = await this.container.get<EC2Client, typeof EC2ClientFactory>(EC2Client, {
37
- // args: [properties.awsAccountId, properties.awsRegionId],
38
- // metadata: { package: '@example' },
39
- // });
40
- // ec2Client.send = async (instance: unknown): Promise<unknown> => {
41
- // if (instance instanceof DeleteVpcCommand) {
42
- // return;
43
- // }
44
- // };
45
- }
46
28
  }
47
29
 
48
30
  @Factory<Delete<%= resourceNamePascal %>ResourceAction>(Delete<%= resourceNamePascal %>ResourceAction)
@@ -65,20 +65,11 @@ export class Update<%= resourceNamePascal %>TagsResourceAction extends ANodeActi
65
65
  );
66
66
  }
67
67
  */
68
- }
69
-
70
- async mock(diff: Diff<<%= resourceNamePascal %>, DiffValueTypeTagUpdate>): Promise<void> {
71
- // Get properties.
72
- const <%= resourceNamePascal.toLowerCase().charAt(0) + resourceNamePascal.slice(1) %> = diff.node;
73
- const properties = <%= resourceNamePascal.toLowerCase().charAt(0) + resourceNamePascal.slice(1) %>.properties;
74
68
 
75
- // Fix me: Implement mock logic for captures.
76
- // E.g.,
77
- // const ec2Client = await this.container.get<EC2Client, typeof EC2ClientFactory>(EC2Client, {
78
- // args: [properties.awsAccountId, properties.awsRegionId],
79
- // metadata: { package: '@example' },
80
- // });
81
- // ec2Client.send = async (): Promise<void> => {};
69
+ // You could also extend from `GenericResourceTaggingAction`,
70
+ // only if the AWS resource is supported for generic resource tagging.
71
+ // See https://docs.aws.amazon.com/resourcegroupstagging/latest/APIReference/supported-services.html
72
+ // for more details.
82
73
  }
83
74
  }
84
75
 
@@ -0,0 +1 @@
1
+ export { runCommand } from './run.command.js';
@@ -0,0 +1,2 @@
1
+ export { runCommand } from './run.command.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/run/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,11 @@
1
+ import type { ArgumentsCamelCase, Argv } from 'yargs';
2
+ type RunCommandArguments = {
3
+ definitionFilePath: string;
4
+ };
5
+ export declare const runCommand: {
6
+ builder: (yargs: Argv) => Argv;
7
+ command: string;
8
+ describe: string;
9
+ handler: (argv: ArgumentsCamelCase<RunCommandArguments>) => Promise<void>;
10
+ };
11
+ export {};
@@ -0,0 +1,83 @@
1
+ import { Octo } from '@quadnix/octo';
2
+ import chalk from 'chalk';
3
+ import { YamlDefinitionUtility } from '../../utilities/definition/yaml/yaml-definition.utility.js';
4
+ export const runCommand = {
5
+ builder: (yargs) => {
6
+ return yargs.option('definitionFilePath', {
7
+ alias: 'd',
8
+ demandOption: true,
9
+ description: 'Path to the Octo definition YAML file.',
10
+ type: 'string',
11
+ });
12
+ },
13
+ command: 'run',
14
+ describe: 'Validate and run the Octo definition file.',
15
+ handler: async (argv) => {
16
+ let { definitionFilePath } = argv;
17
+ try {
18
+ const yamlDefinitionUtility = new YamlDefinitionUtility(definitionFilePath);
19
+ const hooks = await yamlDefinitionUtility.resolveHooks();
20
+ const imports = await yamlDefinitionUtility.resolveImports();
21
+ const listeners = await yamlDefinitionUtility.resolveListeners();
22
+ const modules = yamlDefinitionUtility.resolveModules(imports);
23
+ const stateProvider = yamlDefinitionUtility.resolveStateProvider();
24
+ const transactionOptions = yamlDefinitionUtility.resolveTransactionOptions();
25
+ console.log(chalk.green('Definition file is valid and all modules were successfully imported.'));
26
+ // Initialize.
27
+ const octo = new Octo();
28
+ await octo.initialize(stateProvider.type, listeners.map((l) => ({
29
+ options: {
30
+ args: l.args,
31
+ metadata: l.metadata,
32
+ },
33
+ type: l.type,
34
+ })));
35
+ // Register hooks.
36
+ octo.registerHooks(hooks);
37
+ // Load modules.
38
+ for (const moduleDefinition of modules) {
39
+ octo.loadModule(moduleDefinition.moduleClass, moduleDefinition.moduleId, moduleDefinition.moduleInputs);
40
+ }
41
+ octo.orderModules(modules.map((m) => m.moduleClass));
42
+ // Compose.
43
+ const appModuleId = modules[0].moduleId;
44
+ const initializedModules = await octo.compose();
45
+ const app = initializedModules[`${appModuleId}.model.app`];
46
+ // Start transaction.
47
+ const transaction = octo.beginTransaction(app, transactionOptions);
48
+ if (transactionOptions.yieldModelDiffs) {
49
+ const result = await transaction.next();
50
+ console.log(chalk.green('==== Model Diffs ===='));
51
+ console.log(JSON.stringify(result.value, null, 2));
52
+ }
53
+ if (transactionOptions.yieldModelTransaction) {
54
+ const result = await transaction.next();
55
+ console.log(chalk.green('==== Model Transaction ===='));
56
+ console.log(JSON.stringify(result.value, null, 2));
57
+ }
58
+ if (transactionOptions.yieldResourceDiffs) {
59
+ const result = await transaction.next();
60
+ console.log(chalk.green('==== Resource Diffs ===='));
61
+ console.log(JSON.stringify(result.value, null, 2));
62
+ }
63
+ if (transactionOptions.yieldResourceTransaction) {
64
+ const result = await transaction.next();
65
+ console.log(chalk.green('==== Resource Transaction ===='));
66
+ console.log(JSON.stringify(result.value, null, 2));
67
+ }
68
+ const result = await transaction.next();
69
+ if (!transactionOptions.yieldResourceTransaction) {
70
+ console.log(chalk.green('==== Resource Transaction ===='));
71
+ console.log(JSON.stringify(result.value, null, 2));
72
+ }
73
+ }
74
+ catch (error) {
75
+ console.log(chalk.red(error.message));
76
+ for (const failure of error.failures || []) {
77
+ console.log(chalk.red(failure));
78
+ }
79
+ process.exit(1);
80
+ }
81
+ },
82
+ };
83
+ //# sourceMappingURL=run.command.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run.command.js","sourceRoot":"","sources":["../../../src/commands/run/run.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,IAAI,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,qB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AC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;YACtC,KAAK,MAAM,OAAO,IAAI,KAAK,CAAC,QAAQ,IAAI,EAAE,EAAE,CAAC;gBAC3C,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;YAClC,CAAC;YACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC;CACF,CAAC"}
@@ -0,0 +1 @@
1
+ export { stateCommand } from './state.command.js';
@@ -0,0 +1,2 @@
1
+ export { stateCommand } from './state.command.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/state/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { type ArgumentsCamelCase, type Argv } from 'yargs';
2
+ type StateCommandArguments = {
3
+ _: ['state', 'lock' | 'unlock' | 'get-lock'];
4
+ definitionFilePath: string;
5
+ lockID?: string;
6
+ };
7
+ declare function handler(argv: ArgumentsCamelCase<StateCommandArguments>): Promise<void>;
8
+ export declare const stateCommand: {
9
+ builder: (yargs: Argv) => Argv;
10
+ command: string;
11
+ describe: string;
12
+ handler: typeof handler;
13
+ };
14
+ export {};
@@ -0,0 +1,79 @@
1
+ import chalk from 'chalk';
2
+ import {} from 'yargs';
3
+ import { YamlDefinitionUtility } from '../../utilities/definition/yaml/yaml-definition.utility.js';
4
+ async function handler(argv) {
5
+ const { _: [, action], definitionFilePath, lockID, } = argv;
6
+ try {
7
+ const yamlDefinitionUtility = new YamlDefinitionUtility(definitionFilePath);
8
+ const { type: stateProvider } = yamlDefinitionUtility.resolveStateProvider();
9
+ console.log(chalk.green('Definition file is valid and state provider was successfully imported.'));
10
+ switch (action) {
11
+ case 'lock': {
12
+ console.log(chalk.green('Creating a new app lock.'));
13
+ const { lockId: newLockId } = await stateProvider.lockApp();
14
+ console.log(`App is locked with lock ID "${newLockId}".`);
15
+ break;
16
+ }
17
+ case 'unlock': {
18
+ if (!lockID) {
19
+ throw new Error('Lock ID is required to unlock app!');
20
+ }
21
+ console.log(chalk.green('Attempting to unlock app.'));
22
+ await stateProvider.unlockApp(lockID);
23
+ console.log(`App was unlocked using lock ID "${lockID}".`);
24
+ break;
25
+ }
26
+ case 'get-lock':
27
+ default: {
28
+ console.log(chalk.green('Fetching existing app lock.'));
29
+ const existingLockId = await stateProvider.getAppLock();
30
+ if (!existingLockId) {
31
+ console.log('App is unlocked.');
32
+ }
33
+ else {
34
+ console.log(`App is locked with lock ID "${existingLockId}".`);
35
+ }
36
+ }
37
+ }
38
+ }
39
+ catch (error) {
40
+ console.log(chalk.red(error.message));
41
+ for (const failure of error.failures || []) {
42
+ console.log(chalk.red(failure));
43
+ }
44
+ process.exit(1);
45
+ }
46
+ }
47
+ export const stateCommand = {
48
+ builder: (yargs) => {
49
+ return yargs
50
+ .option('definitionFilePath', {
51
+ alias: 'd',
52
+ demandOption: true,
53
+ description: 'Path to the Octo definition YAML file.',
54
+ type: 'string',
55
+ })
56
+ .command({
57
+ command: 'lock',
58
+ describe: 'Acquire a new app state lock.',
59
+ handler,
60
+ })
61
+ .command({
62
+ command: 'unlock <lock-ID>',
63
+ describe: 'Release the app state lock by ID.',
64
+ handler,
65
+ })
66
+ .command({
67
+ command: 'get-lock',
68
+ describe: 'Retrieve information about the current app state lock.',
69
+ handler,
70
+ })
71
+ .demandCommand(1, 'At least one action is required!')
72
+ .strictCommands()
73
+ .help();
74
+ },
75
+ command: 'state',
76
+ describe: 'Operations on app state.',
77
+ handler,
78
+ };
79
+ //# sourceMappingURL=state.command.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"state.command.js","sourceRoot":"","sources":["../../../src/commands/state/state.command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAsC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AAE,kCAAkC,CAAC;aACpD,cAAc,EAAE;aAChB,IAAI,EAAE,CAAC;IACZ,CAAC;IACD,OAAO,EAAE,OAAO;IAChB,QAAQ,EAAE,0BAA0B;IACpC,OAAO;CACR,CAAC"}
package/dist/index.js CHANGED
@@ -10,6 +10,8 @@ import { createModelCommand } from './commands/create-model/index.js';
10
10
  import { createModuleCommand } from './commands/create-module/index.js';
11
11
  import { createOverlayCommand } from './commands/create-overlay/index.js';
12
12
  import { createResourceCommand } from './commands/create-resource/index.js';
13
+ import { runCommand } from './commands/run/index.js';
14
+ import { stateCommand } from './commands/state/index.js';
13
15
  const PROGRAM_NAME = 'octo';
14
16
  const parser = yargs(process.argv.slice(2))
15
17
  .scriptName(PROGRAM_NAME)
@@ -27,5 +29,7 @@ parser.command(createModuleCommand);
27
29
  parser.command(createOverlayCommand);
28
30
  parser.command(createResourceCommand);
29
31
  parser.command(buildCommand);
32
+ parser.command(runCommand);
33
+ parser.command(stateCommand);
30
34
  await parser.argv;
31
35
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AACnC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,MAAM,aAAa,CAAC;AAChC,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC1E,O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AC,CAAC;AAE7B,MAAM,MAAM,CAAC,IAAI,CAAC"}
@@ -0,0 +1,170 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "additionalProperties": false,
4
+ "properties": {
5
+ "env": {
6
+ "items": {
7
+ "additionalProperties": false,
8
+ "properties": {
9
+ "key": {
10
+ "type": "string"
11
+ },
12
+ "kind": {
13
+ "enum": ["boolean", "number", "string"],
14
+ "type": "string"
15
+ },
16
+ "value": {}
17
+ },
18
+ "required": ["key", "kind", "value"],
19
+ "type": "object"
20
+ },
21
+ "type": "array"
22
+ },
23
+ "hooks": {
24
+ "items": {
25
+ "additionalProperties": false,
26
+ "properties": {
27
+ "importPath": {
28
+ "type": "string"
29
+ },
30
+ "method": {
31
+ "type": "string"
32
+ }
33
+ },
34
+ "required": ["importPath", "method"],
35
+ "type": "object"
36
+ },
37
+ "type": "array"
38
+ },
39
+ "imports": {
40
+ "items": {
41
+ "additionalProperties": false,
42
+ "properties": {
43
+ "className": {
44
+ "type": "string"
45
+ },
46
+ "importPath": {
47
+ "type": "string"
48
+ }
49
+ },
50
+ "required": ["className", "importPath"],
51
+ "type": "object"
52
+ },
53
+ "type": "array"
54
+ },
55
+ "modules": {
56
+ "items": {
57
+ "additionalProperties": false,
58
+ "properties": {
59
+ "moduleClass": {
60
+ "type": "string"
61
+ },
62
+ "moduleId": {
63
+ "type": "string"
64
+ },
65
+ "moduleInputs": {
66
+ "type": "object"
67
+ }
68
+ },
69
+ "required": ["moduleClass", "moduleId", "moduleInputs"],
70
+ "type": "object"
71
+ },
72
+ "minItems": 1,
73
+ "type": "array"
74
+ },
75
+ "settings": {
76
+ "additionalProperties": false,
77
+ "properties": {
78
+ "listeners": {
79
+ "items": {
80
+ "oneOf": [
81
+ {
82
+ "additionalProperties": false,
83
+ "properties": {
84
+ "type": {
85
+ "const": "HtmlReportEventListener",
86
+ "type": "string"
87
+ }
88
+ },
89
+ "required": ["type"],
90
+ "type": "object"
91
+ },
92
+ {
93
+ "additionalProperties": false,
94
+ "properties": {
95
+ "type": {
96
+ "const": "LoggingEventListener",
97
+ "type": "string"
98
+ }
99
+ },
100
+ "required": ["type"],
101
+ "type": "object"
102
+ }
103
+ ]
104
+ },
105
+ "type": "array"
106
+ },
107
+ "stateProvider": {
108
+ "oneOf": [
109
+ {
110
+ "additionalProperties": false,
111
+ "properties": {
112
+ "statePath": {
113
+ "type": "string"
114
+ },
115
+ "type": {
116
+ "const": "LocalStateProvider",
117
+ "type": "string"
118
+ }
119
+ },
120
+ "required": ["type", "statePath"],
121
+ "type": "object"
122
+ },
123
+ {
124
+ "additionalProperties": false,
125
+ "properties": {
126
+ "type": {
127
+ "const": "TestStateProvider",
128
+ "type": "string"
129
+ }
130
+ },
131
+ "required": ["type"],
132
+ "type": "object"
133
+ }
134
+ ]
135
+ },
136
+ "transactionOptions": {
137
+ "additionalProperties": false,
138
+ "properties": {
139
+ "yieldModelDiffs": {
140
+ "default": false,
141
+ "type": "boolean"
142
+ },
143
+ "yieldModelTransaction": {
144
+ "default": false,
145
+ "type": "boolean"
146
+ },
147
+ "yieldResourceDiffs": {
148
+ "default": false,
149
+ "type": "boolean"
150
+ },
151
+ "yieldResourceTransaction": {
152
+ "default": false,
153
+ "type": "boolean"
154
+ }
155
+ },
156
+ "type": "object"
157
+ }
158
+ },
159
+ "required": ["stateProvider"],
160
+ "type": "object"
161
+ },
162
+ "version": {
163
+ "enum": [1],
164
+ "type": "number"
165
+ }
166
+ },
167
+ "required": ["imports", "modules", "settings", "version"],
168
+ "title": "Octo V1 Definition Schema",
169
+ "type": "object"
170
+ }
@@ -0,0 +1,60 @@
1
+ import { type Constructable, LocalStateProvider, TestStateProvider } from '@quadnix/octo';
2
+ import type { HtmlReportEventListener } from '@quadnix/octo-event-listeners/html-report';
3
+ import type { LoggingEventListener } from '@quadnix/octo-event-listeners/logging';
4
+ export declare class YamlDefinitionUtility {
5
+ private readonly definition;
6
+ constructor(definitionFilePath: string);
7
+ resolveEnvironmentValue<T>(value: unknown): T;
8
+ resolveHooks(): Promise<{
9
+ postCommitHooks?: {
10
+ handle: any;
11
+ }[];
12
+ postModelActionHooks?: {
13
+ action: any;
14
+ handle: any;
15
+ }[];
16
+ postResourceActionHooks?: {
17
+ action: any;
18
+ handle: any;
19
+ }[];
20
+ preCommitHooks?: {
21
+ handle: any;
22
+ }[];
23
+ preModelActionHooks?: {
24
+ action: any;
25
+ handle: any;
26
+ }[];
27
+ preResourceActionHooks?: {
28
+ action: any;
29
+ handle: any;
30
+ }[];
31
+ }>;
32
+ resolveImports(): Promise<{
33
+ className: Constructable<any>;
34
+ }[]>;
35
+ resolveListeners(): Promise<{
36
+ args?: unknown[];
37
+ metadata?: Record<string, string>;
38
+ type: Constructable<HtmlReportEventListener | LoggingEventListener>;
39
+ }[]>;
40
+ resolveModules(imports: Awaited<ReturnType<YamlDefinitionUtility['resolveImports']>>): {
41
+ moduleClass: Constructable<any>;
42
+ moduleId: string;
43
+ moduleInputs: Record<string, unknown>;
44
+ }[];
45
+ resolveStateProvider(): {
46
+ type: LocalStateProvider;
47
+ } | {
48
+ type: TestStateProvider;
49
+ };
50
+ resolveTransactionOptions(): {
51
+ appLockId: string | undefined;
52
+ enableResourceCapture: boolean;
53
+ enableResourceValidation: boolean;
54
+ yieldModelDiffs: boolean;
55
+ yieldModelTransaction: boolean;
56
+ yieldResourceDiffs: boolean;
57
+ yieldResourceTransaction: boolean;
58
+ };
59
+ private validateDefinition;
60
+ }
@@ -0,0 +1,223 @@
1
+ import { existsSync, readFileSync } from 'fs';
2
+ import { dirname, join, resolve } from 'path';
3
+ import { fileURLToPath } from 'url';
4
+ import { LocalStateProvider, TestStateProvider } from '@quadnix/octo';
5
+ import { Ajv2020 as Ajv } from 'ajv/dist/2020.js';
6
+ import { load } from 'js-yaml';
7
+ const __dirname = dirname(fileURLToPath(import.meta.url));
8
+ export class YamlDefinitionUtility {
9
+ constructor(definitionFilePath) {
10
+ definitionFilePath = resolve(process.cwd(), definitionFilePath);
11
+ if (!existsSync(definitionFilePath)) {
12
+ throw new Error('Cannot find definition file: ' + definitionFilePath);
13
+ }
14
+ try {
15
+ const content = readFileSync(definitionFilePath, 'utf-8');
16
+ this.definition = (load(content) || {});
17
+ }
18
+ catch (error) {
19
+ throw new Error('Unable to parse definition file: ' + error?.message);
20
+ }
21
+ this.validateDefinition();
22
+ }
23
+ resolveEnvironmentValue(value) {
24
+ if (typeof value !== 'string') {
25
+ return value;
26
+ }
27
+ const pattern = value.match(/^\$\{env\.(.+)}$/);
28
+ if (!pattern || pattern.length < 2) {
29
+ return value;
30
+ }
31
+ const environmentKey = this.definition.env.find((e) => e.key === pattern[1]);
32
+ if (!environmentKey) {
33
+ throw new Error(`Key "${pattern[1]}" not found under "env"!`);
34
+ }
35
+ let resolvedValue = process.env[pattern[1]] || environmentKey.value;
36
+ const { kind } = environmentKey;
37
+ switch (kind) {
38
+ case 'boolean': {
39
+ return Boolean(resolvedValue);
40
+ }
41
+ case 'number': {
42
+ return Number(resolvedValue);
43
+ }
44
+ default: {
45
+ return String(resolvedValue);
46
+ }
47
+ }
48
+ }
49
+ async resolveHooks() {
50
+ const hooks = {
51
+ postCommitHooks: [],
52
+ postModelActionHooks: [],
53
+ postResourceActionHooks: [],
54
+ preCommitHooks: [],
55
+ preModelActionHooks: [],
56
+ preResourceActionHooks: [],
57
+ };
58
+ if (!this.definition.hooks?.length) {
59
+ return hooks;
60
+ }
61
+ for (const hookDef of this.definition.hooks) {
62
+ const { importPath, method } = hookDef;
63
+ const resolvedImport = importPath.startsWith('.') || importPath.startsWith('/') ? resolve(process.cwd(), importPath) : importPath;
64
+ try {
65
+ const imported = await import(resolvedImport);
66
+ if (!imported[method]) {
67
+ throw new Error(`Unable to find export "${method}" in path "${resolvedImport}"!`);
68
+ }
69
+ else {
70
+ const importedHooks = imported[method]();
71
+ hooks.postCommitHooks.push(...(importedHooks.postCommitHooks || []));
72
+ hooks.postModelActionHooks.push(...(importedHooks.postModelActionHooks || []));
73
+ hooks.postResourceActionHooks.push(...(importedHooks.postResourceActionHooks || []));
74
+ hooks.preCommitHooks.push(...(importedHooks.preCommitHooks || []));
75
+ hooks.preModelActionHooks.push(...(importedHooks.preModelActionHooks || []));
76
+ hooks.preResourceActionHooks.push(...(importedHooks.preResourceActionHooks || []));
77
+ }
78
+ }
79
+ catch (error) {
80
+ throw new Error(`Failed to import path "${resolvedImport}": ${error?.message || String(error)}`);
81
+ }
82
+ }
83
+ return hooks;
84
+ }
85
+ async resolveImports() {
86
+ const imports = [];
87
+ if (!this.definition.imports?.length) {
88
+ return imports;
89
+ }
90
+ for (const importDef of this.definition.imports) {
91
+ const { className, importPath } = importDef;
92
+ const resolvedImport = importPath.startsWith('.') || importPath.startsWith('/') ? resolve(process.cwd(), importPath) : importPath;
93
+ try {
94
+ const imported = await import(resolvedImport);
95
+ if (!imported[className]) {
96
+ throw new Error(`Unable to find export "${className}" in path "${resolvedImport}"!`);
97
+ }
98
+ else {
99
+ imports.push({ className: imported[className] });
100
+ }
101
+ }
102
+ catch (error) {
103
+ throw new Error(`Failed to import path "${resolvedImport}": ${error?.message || String(error)}`);
104
+ }
105
+ }
106
+ return imports;
107
+ }
108
+ async resolveListeners() {
109
+ const listeners = [];
110
+ if (!this.definition.settings?.listeners?.length) {
111
+ return listeners;
112
+ }
113
+ for (const listenerDef of this.definition.settings.listeners) {
114
+ if (listenerDef.type === 'HtmlReportEventListener') {
115
+ if (process.env.OCTO_DISABLE_HTML_REPORT_EVENT_LISTENER?.toLowerCase() !== 'true') {
116
+ const imported = await import('@quadnix/octo-event-listeners/html-report');
117
+ listeners.push({ type: imported.HtmlReportEventListener });
118
+ }
119
+ }
120
+ else if (listenerDef.type === 'LoggingEventListener') {
121
+ if (process.env.OCTO_DISABLE_LOGGING_EVENT_LISTENER?.toLowerCase() !== 'true') {
122
+ const imported = await import('@quadnix/octo-event-listeners/logging');
123
+ listeners.push({ type: imported.LoggingEventListener });
124
+ }
125
+ }
126
+ }
127
+ return listeners;
128
+ }
129
+ resolveModules(imports) {
130
+ const modules = [];
131
+ if (!this.definition.modules?.length) {
132
+ return modules;
133
+ }
134
+ for (const moduleDef of this.definition.modules) {
135
+ const { moduleClass, moduleId, moduleInputs } = moduleDef;
136
+ const importedModule = imports.find((i) => i.className.name === moduleClass);
137
+ if (!importedModule) {
138
+ throw new Error(`Invalid module definition for moduleId="${moduleId}": "${moduleClass}" not found in "imports"!`);
139
+ }
140
+ const module = { moduleClass: importedModule.className, moduleId, moduleInputs };
141
+ for (const [key, value] of Object.entries(module.moduleInputs || {})) {
142
+ module.moduleInputs[key] = this.resolveEnvironmentValue(value);
143
+ }
144
+ modules.push(module);
145
+ }
146
+ return modules;
147
+ }
148
+ resolveStateProvider() {
149
+ const stateProvider = this.definition.settings.stateProvider;
150
+ if (stateProvider.type === 'LocalStateProvider') {
151
+ return {
152
+ type: new LocalStateProvider(stateProvider.statePath),
153
+ };
154
+ }
155
+ else if (stateProvider.type === 'TestStateProvider') {
156
+ return {
157
+ type: new TestStateProvider(),
158
+ };
159
+ }
160
+ else {
161
+ throw new Error(`Invalid state provider!`);
162
+ }
163
+ }
164
+ resolveTransactionOptions() {
165
+ const tx = this.definition.settings.transactionOptions || {};
166
+ const options = {
167
+ appLockId: undefined,
168
+ enableResourceCapture: false,
169
+ enableResourceValidation: false,
170
+ yieldModelDiffs: tx.yieldModelDiffs || false,
171
+ yieldModelTransaction: tx.yieldModelTransaction || false,
172
+ yieldResourceDiffs: tx.yieldResourceDiffs || false,
173
+ yieldResourceTransaction: tx.yieldResourceTransaction || false,
174
+ };
175
+ if (process.env.OCTO_APP_LOCK_ID) {
176
+ options.appLockId = process.env.OCTO_APP_LOCK_ID;
177
+ }
178
+ if (process.env.OCTO_ENABLE_RESOURCE_CAPTURE) {
179
+ options.enableResourceCapture = process.env.OCTO_ENABLE_RESOURCE_CAPTURE.toLowerCase() === 'true';
180
+ }
181
+ if (process.env.OCTO_ENABLE_RESOURCE_VALIDATION) {
182
+ options.enableResourceValidation = process.env.OCTO_ENABLE_RESOURCE_VALIDATION.toLowerCase() === 'true';
183
+ }
184
+ if (process.env.OCTO_YIELD_MODEL_DIFFS) {
185
+ options.yieldModelDiffs = process.env.OCTO_YIELD_MODEL_DIFFS.toLowerCase() === 'true';
186
+ }
187
+ if (process.env.OCTO_YIELD_MODEL_TRANSACTION) {
188
+ options.yieldModelTransaction = process.env.OCTO_YIELD_MODEL_TRANSACTION.toLowerCase() === 'true';
189
+ }
190
+ if (process.env.OCTO_YIELD_RESOURCE_DIFFS) {
191
+ options.yieldResourceDiffs = process.env.OCTO_YIELD_RESOURCE_DIFFS.toLowerCase() === 'true';
192
+ }
193
+ if (process.env.OCTO_YIELD_RESOURCE_TRANSACTION) {
194
+ options.yieldResourceTransaction = process.env.OCTO_YIELD_RESOURCE_TRANSACTION.toLowerCase() === 'true';
195
+ }
196
+ return options;
197
+ }
198
+ validateDefinition() {
199
+ if (!this.definition?.version || typeof this.definition?.version !== 'number') {
200
+ throw new Error(`Definition version "${this.definition?.version}" must be a number!`);
201
+ }
202
+ const schemaPath = this.definition.version === 1
203
+ ? resolve(join(__dirname, '..', '..', '..', 'resources', 'octo-v1.schema.json'))
204
+ : undefined;
205
+ if (!schemaPath) {
206
+ throw new Error(`Could not find schema for version "${this.definition.version}"!`);
207
+ }
208
+ const schema = JSON.parse(readFileSync(schemaPath, 'utf-8'));
209
+ const ajv = new Ajv({ allErrors: true, strict: true });
210
+ const validate = ajv.compile(schema);
211
+ const valid = validate(this.definition);
212
+ if (!valid) {
213
+ const error = new Error('Definition file failed validation against schema!');
214
+ const failures = [];
215
+ for (const err of validate.errors || []) {
216
+ failures.push(` [${err.instancePath || '/'}] ${err.message}`);
217
+ }
218
+ error['failures'] = failures;
219
+ throw error;
220
+ }
221
+ }
222
+ }
223
+ //# sourceMappingURL=yaml-definition.utility.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"yaml-definition.utility.js","sourceRoot":"","sources":["../../../../src/utilities/definition/yaml/yaml-definition.ut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EAAE,IAAI,EAAE,CAAC,CAAC;QACvD,MAAM,QAAQ,GAAG,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAErC,MAAM,KAAK,GAAG,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACxC,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;YAE7E,MAAM,QAAQ,GAAa,EAAE,CAAC;YAC9B,KAAK,MAAM,GAAG,IAAI,QAAQ,CAAC,MAAM,IAAI,EAAE,EAAE,CAAC;gBACxC,QAAQ,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,YAAY,IAAI,GAAG,KAAK,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;YACjE,CAAC;YACD,KAAK,CAAC,UAAU,CAAC,GAAG,QAAQ,CAAC;YAE7B,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;CACF"}
package/package.json CHANGED
@@ -6,6 +6,9 @@
6
6
  "url": "https://github.com/quadnix/octo/issues"
7
7
  },
8
8
  "dependencies": {
9
+ "@quadnix/octo": "~0.0.25",
10
+ "@quadnix/octo-event-listeners": "~0.0.4",
11
+ "ajv": "~8.17.1",
9
12
  "chalk": "~5.5.0",
10
13
  "js-yaml": "~4.1.0",
11
14
  "p-limit": "~6.2.0",
@@ -77,7 +80,7 @@
77
80
  "scripts": {
78
81
  "build": "rimraf dist && tsc -p tsconfig.build.json && npm run copy-assets && chmod +x ./dist/index.js",
79
82
  "check:circular-dependency": "dpdm --no-tree --exit-code circular:1 --no-warning ./dist/index.js",
80
- "copy-assets": "copyfiles -u 1 \"src/**/*.ejs\" dist/",
83
+ "copy-assets": "copyfiles -u 1 \"src/**/*.{ejs,json}\" dist/",
81
84
  "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
82
85
  "lint": "eslint .",
83
86
  "lint:fix": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
@@ -90,5 +93,5 @@
90
93
  },
91
94
  "type": "module",
92
95
  "types": "./dist/index.d.ts",
93
- "version": "0.0.9"
96
+ "version": "0.0.11"
94
97
  }
@@ -1,25 +0,0 @@
1
- import { dirname } from 'path';
2
- import { fileURLToPath } from 'url';
3
- import env from 'env-smart';
4
-
5
- const __dirname = dirname(fileURLToPath(import.meta.url));
6
-
7
- env.load({
8
- directory: __dirname,
9
- envDefaultsFilename: '.env.defaults',
10
- envFilename: '.env',
11
- inlineTypes: false,
12
- process: true,
13
- });
14
-
15
- type Configuration = {
16
- AWS_ACCOUNT_ID: string;
17
- AWS_S3_WEBSITE_BUCKET_NAME: string;
18
- };
19
-
20
- export const config = env.config<Configuration>((env) => {
21
- return {
22
- AWS_ACCOUNT_ID: env.AWS_ACCOUNT_ID,
23
- AWS_S3_WEBSITE_BUCKET_NAME: env.AWS_S3_WEBSITE_BUCKET_NAME,
24
- };
25
- });
@@ -1,5 +0,0 @@
1
- # Fix me: AWS account ID.
2
- AWS_ACCOUNT_ID=123456789123
3
-
4
- # Fix me: S3 bucket name.
5
- AWS_S3_WEBSITE_BUCKET_NAME=my-website-unique-bucket
@@ -1,22 +0,0 @@
1
- import { dirname, join } from 'path';
2
- import { fileURLToPath } from 'url';
3
- import { type App, LocalStateProvider, Octo } from '@quadnix/octo';
4
- import { HtmlReportEventListener, LoggingEventListener } from '@quadnix/octo-event-listeners';
5
- import { ModuleDefinitions } from './module-definitions.js';
6
-
7
- const __dirname = dirname(fileURLToPath(import.meta.url));
8
- const octoStatePath = join(__dirname, '..', '.octo');
9
-
10
- const octo = new Octo();
11
- const stateProvider = new LocalStateProvider(octoStatePath);
12
- await octo.initialize(stateProvider, [{ type: HtmlReportEventListener }, { type: LoggingEventListener }]);
13
-
14
- const moduleDefinitions = new ModuleDefinitions();
15
- for (const moduleDefinition of moduleDefinitions.getAll()) {
16
- octo.loadModule(moduleDefinition.module, moduleDefinition.moduleId, moduleDefinition.moduleInputs);
17
- }
18
- octo.orderModules(moduleDefinitions.getAll().map((m) => m.module));
19
-
20
- const { 'app-module.model.app': app } = (await octo.compose()) as { 'app-module.model.app': App };
21
- const transaction = octo.beginTransaction(app);
22
- await transaction.next();
@@ -1,52 +0,0 @@
1
- import { dirname, join } from 'path';
2
- import { fileURLToPath } from 'url';
3
- import { type AModule, type Account, type App, type Constructable, type ModuleSchemaInputs, stub } from '@quadnix/octo';
4
- import { AwsIniAccountModule } from '@quadnix/octo-aws-cdk/modules/account/aws-ini-account';
5
- import { SimpleAppModule } from '@quadnix/octo-aws-cdk/modules/app/simple-app';
6
- import { AwsS3StaticWebsiteServiceModule } from '@quadnix/octo-aws-cdk/modules/service/aws-s3-static-website-service';
7
- import { config } from './app.config.js';
8
-
9
- const __dirname = dirname(fileURLToPath(import.meta.url));
10
- const websiteSourcePath = join(__dirname, '..', website');
11
-
12
- type ModuleDefinition<T extends AModule<unknown, any>> = {
13
- module: Constructable<T>;
14
- moduleId: string;
15
- moduleInputs: ModuleSchemaInputs<T>;
16
- };
17
-
18
- export class ModuleDefinitions {
19
- private readonly moduleDefinitions: ModuleDefinition<AModule<unknown, any>>[] = [];
20
-
21
- constructor() {
22
- this.init();
23
- }
24
-
25
- add<T extends AModule<unknown, any>>(
26
- module: Constructable<T>,
27
- moduleId: string,
28
- moduleInputs: ModuleSchemaInputs<T>,
29
- ): void {
30
- this.moduleDefinitions.push({ module, moduleId, moduleInputs });
31
- }
32
-
33
- getAll(): ModuleDefinitions['moduleDefinitions'] {
34
- return this.moduleDefinitions;
35
- }
36
-
37
- private init(): void {
38
- this.add(SimpleAppModule, 'app-module', { name: 'aws-s3-website' });
39
-
40
- this.add(AwsIniAccountModule, 'account-module', {
41
- accountId: config.AWS_ACCOUNT_ID,
42
- app: stub<App>('${{app-module.model.app}}'),
43
- });
44
-
45
- this.add(AwsS3StaticWebsiteServiceModule, 's3-website-service-module', {
46
- account: stub<Account>('${{account-module.model.account}}'),
47
- awsRegionId: 'us-east-1',
48
- bucketName: config.AWS_S3_WEBSITE_BUCKET_NAME,
49
- directoryPath: websiteSourcePath,
50
- });
51
- }
52
- }