@quadnix/octo-build 0.1.0 → 0.2.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 (38) hide show
  1. package/README.md +108 -21
  2. package/dist/commands/apply/apply.command.js +32 -38
  3. package/dist/commands/apply/apply.command.js.map +1 -1
  4. package/dist/commands/commit/commit.command.d.ts +4 -3
  5. package/dist/commands/commit/commit.command.js +31 -44
  6. package/dist/commands/commit/commit.command.js.map +1 -1
  7. package/dist/commands/create-app/generator-octo-app-template/generators/app/index.js +15 -6
  8. package/dist/commands/create-app/generator-octo-app-template/generators/app/index.js.map +1 -1
  9. package/dist/commands/create-app/generator-octo-app-template/generators/app/templates/README.md.ejs +25 -16
  10. package/dist/commands/create-app/generator-octo-app-template/generators/app/templates/gitignore.ejs +3 -2
  11. package/dist/commands/create-app/generator-octo-app-template/generators/app/templates/src/aws-dynamodb-service/octo.yaml.ejs +1 -1
  12. package/dist/commands/create-app/generator-octo-app-template/generators/app/templates/src/aws-ecs-server/octo.yaml.ejs +14 -16
  13. package/dist/commands/create-app/generator-octo-app-template/generators/app/templates/src/aws-s3-website/octo.yaml.ejs +11 -3
  14. package/dist/commands/create-model/generator-octo-model-template/generators/app/templates/models/model/model.ts.ejs +38 -0
  15. package/dist/commands/generate/generate.command.d.ts +3 -1
  16. package/dist/commands/generate/generate.command.js +12 -12
  17. package/dist/commands/generate/generate.command.js.map +1 -1
  18. package/dist/commands/get-response/get-response.command.js +3 -3
  19. package/dist/commands/get-response/get-response.command.js.map +1 -1
  20. package/dist/commands/lock/lock.command.d.ts +8 -3
  21. package/dist/commands/lock/lock.command.js +16 -13
  22. package/dist/commands/lock/lock.command.js.map +1 -1
  23. package/dist/commands/run-action/run-action.command.js +4 -10
  24. package/dist/commands/run-action/run-action.command.js.map +1 -1
  25. package/dist/commands/unlock/unlock.command.d.ts +5 -5
  26. package/dist/commands/unlock/unlock.command.js +15 -31
  27. package/dist/commands/unlock/unlock.command.js.map +1 -1
  28. package/dist/commands/validate/validate.command.d.ts +1 -1
  29. package/dist/commands/validate/validate.command.js +9 -15
  30. package/dist/commands/validate/validate.command.js.map +1 -1
  31. package/dist/resources/octo-v1.schema.json +25 -11
  32. package/dist/utilities/definition/yaml/yaml-definition.utility.d.ts +15 -13
  33. package/dist/utilities/definition/yaml/yaml-definition.utility.js +38 -22
  34. package/dist/utilities/definition/yaml/yaml-definition.utility.js.map +1 -1
  35. package/dist/utilities/octo/octo.utility.d.ts +62 -45
  36. package/dist/utilities/octo/octo.utility.js +162 -128
  37. package/dist/utilities/octo/octo.utility.js.map +1 -1
  38. package/package.json +5 -3
@@ -23,7 +23,7 @@ terraform:
23
23
 
24
24
  settings:
25
25
  listeners:
26
- - type: HtmlReportEventListener
26
+ - type: JournalEventListener
27
27
  - type: LoggingEventListener
28
28
 
29
29
  stateProvider:
@@ -35,16 +35,16 @@ imports:
35
35
  importPath: "@quadnix/octo-aws-cdk/modules/app/simple-app"
36
36
  - className: AwsIniAccountModule
37
37
  importPath: "@quadnix/octo-aws-cdk/modules/account/aws-ini-account"
38
- - className: AwsEcsDeploymentModule
39
- importPath: "@quadnix/octo-aws-cdk/modules/deployment/aws-ecs-deployment"
38
+ - className: AwsDeploymentModule
39
+ importPath: "@quadnix/octo-aws-cdk/modules/deployment/aws-deployment"
40
40
  - className: AwsEcsEnvironmentModule
41
41
  importPath: "@quadnix/octo-aws-cdk/modules/environment/aws-ecs-environment"
42
42
  - className: AwsEcsExecutionModule
43
43
  importPath: "@quadnix/octo-aws-cdk/modules/execution/aws-ecs-execution"
44
44
  - className: AwsMultiAzRegionModule
45
45
  importPath: "@quadnix/octo-aws-cdk/modules/region/aws-multi-az-region"
46
- - className: AwsEcsServerModule
47
- importPath: "@quadnix/octo-aws-cdk/modules/server/aws-ecs-server"
46
+ - className: AwsServerModule
47
+ importPath: "@quadnix/octo-aws-cdk/modules/server/aws-server"
48
48
  - className: AwsEcsAlbServiceModule
49
49
  importPath: "@quadnix/octo-aws-cdk/modules/service/aws-ecs-alb-service"
50
50
  - className: AwsSimpleSubnetModule
@@ -73,24 +73,22 @@ modules:
73
73
  vpcCidrBlock: 10.0.0.0/16
74
74
 
75
75
  - moduleId: backend-server-module
76
- moduleClass: AwsEcsServerModule
76
+ moduleClass: AwsServerModule
77
77
  moduleInputs:
78
78
  account: "${{account-module.model.account}}"
79
79
  serverKey: backend
80
80
 
81
81
  - moduleId: backend-deployment-v1-module
82
- moduleClass: AwsEcsDeploymentModule
82
+ moduleClass: AwsDeploymentModule
83
83
  moduleInputs:
84
- deploymentContainerProperties:
85
- cpu: 256
86
- image:
87
- command: node webserver
88
- ports:
89
- - containerPort: 80
90
- protocol: tcp
91
- uri: docker.io/ealen/echo-server:0.9.2
92
- memory: 512
84
+ command: [node, webserver]
85
+ cpu: 256
93
86
  deploymentTag: v1
87
+ imageUri: docker.io/ealen/echo-server:0.9.2
88
+ memory: 512
89
+ ports:
90
+ - containerPort: 80
91
+ protocol: tcp
94
92
  server: "${{backend-server-module.model.server}}"
95
93
 
96
94
  - moduleId: qa-environment-module
@@ -26,7 +26,7 @@ terraform:
26
26
 
27
27
  settings:
28
28
  listeners:
29
- - type: HtmlReportEventListener
29
+ - type: JournalEventListener
30
30
  - type: LoggingEventListener
31
31
 
32
32
  stateProvider:
@@ -38,6 +38,8 @@ imports:
38
38
  importPath: "@quadnix/octo-aws-cdk/modules/app/simple-app"
39
39
  - className: AwsIniAccountModule
40
40
  importPath: "@quadnix/octo-aws-cdk/modules/account/aws-ini-account"
41
+ - className: AwsServerlessRegionModule
42
+ importPath: "@quadnix/octo-aws-cdk/modules/region/aws-serverless-region"
41
43
  - className: AwsS3StaticWebsiteServiceModule
42
44
  importPath: "@quadnix/octo-aws-cdk/modules/service/aws-s3-static-website-service"
43
45
 
@@ -53,10 +55,16 @@ modules:
53
55
  accountId: "${env.AWS_ACCOUNT_ID}"
54
56
  app: "${{app-module.model.app}}"
55
57
 
58
+ - moduleId: region-module
59
+ moduleClass: AwsServerlessRegionModule
60
+ moduleInputs:
61
+ account: "${{account-module.model.account}}"
62
+ name: aws-s3-website
63
+ regionId: aws-us-east-1
64
+
56
65
  - moduleId: s3-website-service-module
57
66
  moduleClass: AwsS3StaticWebsiteServiceModule
58
67
  moduleInputs:
59
- account: "${{account-module.model.account}}"
60
- awsRegionId: us-east-1
61
68
  bucketName: "${env.AWS_S3_WEBSITE_BUCKET_NAME}"
62
69
  directoryPath: website
70
+ region: "${{region-module.model.region}}"
@@ -1,3 +1,40 @@
1
+ <%# A service is built with its parents, type and label, and carries them through synth() and unSynth(). -%>
2
+ <% if (modelType === 'service') { -%>
3
+ import { type AModel, Model, Service, ServiceType } from '@quadnix/octo';
4
+ import { <%= moduleNamePascal %>Schema } from './<%= moduleName %>.schema.js';
5
+
6
+ @Model<<%= moduleNamePascal %>>('<%= packageName %>', 'service', <%= moduleNamePascal %>Schema)
7
+ export class <%= moduleNamePascal %> extends Service {
8
+ // Fix me: Add properties specific to your module.
9
+ private readonly customProperty: string;
10
+
11
+ // Fix me: Update constructor to take properties as inputs.
12
+ constructor(customProperty: string, parents: AModel<any, any>[]) {
13
+ // Fix me: Initialize model with the correct ID, the nodes it sits under, its type and its label.
14
+ super(customProperty, parents, ServiceType.OTHER, '<%= moduleName %>');
15
+
16
+ // Fix me: Initialize module-specific properties.
17
+ this.customProperty = customProperty;
18
+ }
19
+
20
+ override synth(): <%= moduleNamePascal %>Schema {
21
+ // Fix me: Return serialized schema.
22
+ return {
23
+ ...super.synth(),
24
+ customProperty: this.customProperty,
25
+ };
26
+ }
27
+
28
+ static override async unSynth(
29
+ service: <%= moduleNamePascal %>Schema,
30
+ deReferenceContext: (context: string) => Promise<AModel<any, any>>,
31
+ ): Promise<<%= moduleNamePascal %>> {
32
+ // Fix me: Return unserialized instance of <%= moduleNamePascal %>.
33
+ const parents = await Promise.all(service.parents.map((p) => deReferenceContext(p.context)));
34
+ return new <%= moduleNamePascal %>(service.customProperty, parents);
35
+ }
36
+ }
37
+ <% } else { -%>
1
38
  <%# Sorted for the same reason as the schema's imports: `App` sorts before `Model`, `Service` after. -%>
2
39
  <% const modelImports = ['Model', modelTypePascal].sort().join(', '); -%>
3
40
  import { <%= modelImports %> } from '@quadnix/octo';
@@ -29,3 +66,4 @@ export class <%= moduleNamePascal %> extends <%= modelTypePascal %> {
29
66
  return new <%= moduleNamePascal %>(<%= modelType %>.customProperty);
30
67
  }
31
68
  }
69
+ <% } -%>
@@ -3,7 +3,9 @@ type GenerateCommandArguments = {
3
3
  outputDir: string;
4
4
  };
5
5
  /**
6
- * Step 1 of the octo lifecycle. See {@link Octo.generate}.
6
+ * Step 1 of the octo lifecycle. See `Octo.generate()`.
7
+ *
8
+ * The state is refreshed before octo boots, because booting is what reads it.
7
9
  */
8
10
  export declare const generateCommand: {
9
11
  builder: (yargs: Argv) => Argv;
@@ -1,7 +1,10 @@
1
1
  import { resolve } from 'path';
2
- import { bootOcto, reportError } from '../../utilities/octo/octo.utility.js';
2
+ import { Container, StateManagementService } from '@quadnix/octo';
3
+ import { OctoUtility } from '../../utilities/octo/octo.utility.js';
3
4
  /**
4
- * Step 1 of the octo lifecycle. See {@link Octo.generate}.
5
+ * Step 1 of the octo lifecycle. See `Octo.generate()`.
6
+ *
7
+ * The state is refreshed before octo boots, because booting is what reads it.
5
8
  */
6
9
  export const generateCommand = {
7
10
  builder: (yargs) => {
@@ -17,19 +20,16 @@ export const generateCommand = {
17
20
  describe: 'Step 1: generate Terragrunt module folders representing the full desired infrastructure.',
18
21
  handler: async (argv) => {
19
22
  const { outputDir } = argv;
20
- try {
21
- const { app, octo } = await bootOcto();
23
+ await OctoUtility.runCommand('generate', async () => {
24
+ await OctoUtility.bootStateProvider();
25
+ await (await Container.getInstance().get(StateManagementService)).refreshState();
26
+ const { app, octo } = await OctoUtility.bootOcto();
22
27
  const resolvedOutputDir = resolve(process.cwd(), outputDir);
23
28
  await octo.generate(app, { outputDir: resolvedOutputDir });
24
29
  // Nothing is printed here. The listeners report what was written and that the mode finished,
25
- // and they are the only writer on stdout - a `console.log` alongside them lands out of order,
26
- // because pino's stream and this one flush independently. Failures still reach stderr via
27
- // `reportError`, so a silent run is a successful one.
28
- }
29
- catch (error) {
30
- reportError(error);
31
- process.exit(1);
32
- }
30
+ // on stderr, and failures reach stderr via `reportError`. Generate has no output of its own, so
31
+ // stdout stays empty.
32
+ });
33
33
  },
34
34
  };
35
35
  //# sourceMappingURL=generate.command.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"generate.command.js","sourceRoot":"","sources":["../../../src/commands/generate/generate.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAE/B,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AAM7E;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,OAAO,EAAE,CAAC,KAAW,EAAQ,EAAE;QAC7B,OAAO,KAAK,CAAC,MAAM,CAAC,WAAW,EAAE;YAC/B,KAAK,EAAE,GAAG;YACV,YAAY,EAAE,IAAI;YAClB,WAAW,EACT,2GAA2G;gBAC3G,2FAA2F;YAC7F,IAAI,EAAE,QAAQ;SACf,CAAC,CAAC;IACL,CAAC;IACD,OAAO,EAAE,UAAU;IACnB,QAAQ,EAAE,0FAA0F;IACpG,OAAO,EAAE,KAAK,EAAE,IAAkD,EAAiB,EAAE;QACnF,MAAM,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC;QAE3B,IAAI,CAAC;YACH,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,MAAM,QAAQ,EAAE,CAAC;YAEvC,MAAM,iBAAiB,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,SAAS,CAAC,CAAC;YAC5D,MAAM,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,iBAAiB,EAAE,CAAC,CAAC;YAE3D,6FAA6F;YAC7F,8FAA8F;YAC9F,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EAAE,EAAE,SAAS,CAAC,CAAC;YAC5D,MAAM,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,iBAAiB,EAAE,CAAC,CAAC;YAE3D,6FAA6F;YAC7F,gGAAgG;YAChG,sBAAsB;QACxB,CAAC,CAAC,CAAC;IACL,CAAC;CACF,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { Container, StateManagementService } from '@quadnix/octo';
2
- import { bootStateProvider, reportError } from '../../utilities/octo/octo.utility.js';
2
+ import { OctoUtility } from '../../utilities/octo/octo.utility.js';
3
3
  /**
4
4
  * Prints a resource's recorded response as JSON.
5
5
  *
@@ -20,7 +20,7 @@ export const getResponseCommand = {
20
20
  handler: async (argv) => {
21
21
  const { resourceId } = argv;
22
22
  try {
23
- await bootStateProvider();
23
+ await OctoUtility.bootStateProvider();
24
24
  const stateManagementService = await Container.getInstance().get(StateManagementService);
25
25
  const response = await stateManagementService.getResourceResponse(resourceId);
26
26
  if (!response) {
@@ -31,7 +31,7 @@ export const getResponseCommand = {
31
31
  process.stdout.write(JSON.stringify(response));
32
32
  }
33
33
  catch (error) {
34
- reportError(error);
34
+ OctoUtility.reportError(error);
35
35
  process.exit(1);
36
36
  }
37
37
  },
@@ -1 +1 @@
1
- {"version":3,"file":"get-response.command.js","sourceRoot":"","sources":["../../../src/commands/get-response/get-response.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAElE,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AAMtF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,OAAO,EAAE,CAAC,KAAW,EAAQ,EAAE;QAC7B,OAAO,KAAK,CAAC,MAAM,CAAC,YAAY,EAAE;YAChC,YAAY,EAAE,IAAI;YAClB,WAAW,EAAE,0DAA0D;YACvE,IAAI,EAAE,QAAQ;SACf,CAAC,CAAC;IACL,CAAC;IACD,OAAO,EAAE,cAAc;IACvB,QAAQ,EAAE,sFAAsF;IAChG,OAAO,EAAE,KAAK,EAAE,IAAqD,EAAiB,EAAE;QACtF,MAAM,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC;QAE5B,IAAI,CAAC;YACH,MAAM,iBAAiB,EAAE,CAAC;YAC1B,MAAM,sBAAsB,GAAG,MAAM,SAAS,CAAC,WAAW,EAAE,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC;YAEzF,MAAM,QAAQ,GAAG,MAAM,sBAAsB,CAAC,mBAAmB,CAAC,UAAU,CAAC,CAAC;YAC9E,IAAI,CAAC,QAAQ,EAAE,CAAC;gBACd,MAAM,IAAI,KAAK,CACb,sCAAsC,UAAU,KAAK;oBACnD,yFAAyF,CAC5F,CAAC;YACJ,CAAC;YAED,qFAAqF;YACrF,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC;QACjD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,WAAW,CAAC,KAAK,CAAC,CAAC;YACnB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC;CACF,CAAC"}
1
+ {"version":3,"file":"get-response.command.js","sourceRoot":"","sources":["../../../src/commands/get-response/get-response.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAElE,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AAMnE;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,OAAO,EAAE,CAAC,KAAW,EAAQ,EAAE;QAC7B,OAAO,KAAK,CAAC,MAAM,CAAC,YAAY,EAAE;YAChC,YAAY,EAAE,IAAI;YAClB,WAAW,EAAE,0DAA0D;YACvE,IAAI,EAAE,QAAQ;SACf,CAAC,CAAC;IACL,CAAC;IACD,OAAO,EAAE,cAAc;IACvB,QAAQ,EAAE,sFAAsF;IAChG,OAAO,EAAE,KAAK,EAAE,IAAqD,EAAiB,EAAE;QACtF,MAAM,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC;QAE5B,IAAI,CAAC;YACH,MAAM,WAAW,CAAC,iBAAiB,EAAE,CAAC;YACtC,MAAM,sBAAsB,GAAG,MAAM,SAAS,CAAC,WAAW,EAAE,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC;YAEzF,MAAM,QAAQ,GAAG,MAAM,sBAAsB,CAAC,mBAAmB,CAAC,UAAU,CAAC,CAAC;YAC9E,IAAI,CAAC,QAAQ,EAAE,CAAC;gBACd,MAAM,IAAI,KAAK,CACb,sCAAsC,UAAU,KAAK;oBACnD,yFAAyF,CAC5F,CAAC;YACJ,CAAC;YAED,qFAAqF;YACrF,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC;QACjD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,WAAW,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;YAC/B,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC;CACF,CAAC"}
@@ -1,6 +1,10 @@
1
- import type { Argv } from 'yargs';
1
+ import type { ArgumentsCamelCase, Argv } from 'yargs';
2
+ type LockCommandArguments = {
3
+ lockId?: string;
4
+ };
2
5
  /**
3
- * Takes the app lock, which `apply` and `commit` both require.
6
+ * Takes the app lock, which `apply` and `commit` both require. With `--lockId`, resumes the run
7
+ * already holding that lock, which is how a run that died is finished.
4
8
  *
5
9
  * The lock id is the only thing printed on stdout, so a shell can capture it:
6
10
  * `LOCK_ID=$(octo lock)`. Everything else goes to stderr.
@@ -9,5 +13,6 @@ export declare const lockCommand: {
9
13
  builder: (yargs: Argv) => Argv;
10
14
  command: string;
11
15
  describe: string;
12
- handler: () => Promise<void>;
16
+ handler: (argv: ArgumentsCamelCase<LockCommandArguments>) => Promise<void>;
13
17
  };
18
+ export {};
@@ -1,28 +1,31 @@
1
1
  import { Container, StateManagementService } from '@quadnix/octo';
2
2
  import chalk from 'chalk';
3
- import { bootStateProvider, reportError } from '../../utilities/octo/octo.utility.js';
3
+ import { OctoUtility } from '../../utilities/octo/octo.utility.js';
4
4
  /**
5
- * Takes the app lock, which `apply` and `commit` both require.
5
+ * Takes the app lock, which `apply` and `commit` both require. With `--lockId`, resumes the run
6
+ * already holding that lock, which is how a run that died is finished.
6
7
  *
7
8
  * The lock id is the only thing printed on stdout, so a shell can capture it:
8
9
  * `LOCK_ID=$(octo lock)`. Everything else goes to stderr.
9
10
  */
10
11
  export const lockCommand = {
11
- builder: (yargs) => yargs,
12
+ builder: (yargs) => {
13
+ return yargs.option('lockId', {
14
+ demandOption: false,
15
+ description: 'Resume the run holding this lock ID instead of taking a new lock. Stop that run first.',
16
+ type: 'string',
17
+ });
18
+ },
12
19
  command: 'lock',
13
20
  describe: 'Take the app state lock, printing its ID. Required before apply and commit.',
14
- handler: async () => {
15
- try {
16
- await bootStateProvider();
21
+ handler: async (argv) => {
22
+ await OctoUtility.runCommand('lock', async () => {
23
+ await OctoUtility.bootStateProvider();
17
24
  const stateManagementService = await Container.getInstance().get(StateManagementService);
18
- const { lockId } = await stateManagementService.lockApp();
19
- console.error(chalk.green('App is locked.'));
25
+ const { lockId } = await stateManagementService.lockApp(argv.lockId);
26
+ console.error(chalk.green(argv.lockId ? 'App lock is resumed.' : 'App is locked.'));
20
27
  console.log(lockId);
21
- }
22
- catch (error) {
23
- reportError(error);
24
- process.exit(1);
25
- }
28
+ });
26
29
  },
27
30
  };
28
31
  //# sourceMappingURL=lock.command.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"lock.command.js","sourceRoot":"","sources":["../../../src/commands/lock/lock.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAClE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wF;YACrG,IAAI,EAAE,QAAQ;SACf,CAAC,CAAC;IACL,CAAC;IACD,OAAO,EAAE,MAAM;IACf,QAAQ,EAAE,6EAA6E;IACvF,OAAO,EAAE,KAAK,EAAE,IAA8C,EAAiB,EAAE;QAC/E,MAAM,WAAW,CAAC,UAAU,CAAC,MAAM,EAAE,KAAK,IAAI,EAAE;YAC9C,MAAM,WAAW,CAAC,iBAAiB,EAAE,CAAC;YACtC,MAAM,sBAAsB,GAAG,MAAM,SAAS,CAAC,WAAW,EAAE,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC;YAEzF,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,sBAAsB,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YAErE,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,sBAAsB,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC;YACpF,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACtB,CAAC,CAAC,CAAC;IACL,CAAC;CACF,CAAC"}
@@ -1,4 +1,4 @@
1
- import { bootOcto, reportError } from '../../utilities/octo/octo.utility.js';
1
+ import { OctoUtility } from '../../utilities/octo/octo.utility.js';
2
2
  export const runActionCommand = {
3
3
  builder: (yargs) => {
4
4
  return yargs
@@ -18,7 +18,7 @@ export const runActionCommand = {
18
18
  describe: 'Run a single resource action. Invoked by Terraform mid-apply for an external resource.',
19
19
  handler: async (argv) => {
20
20
  const { input, resourceId } = argv;
21
- try {
21
+ await OctoUtility.runCommand('run-action', async () => {
22
22
  const inputs = {};
23
23
  for (const entry of input ?? []) {
24
24
  const separatorIndex = entry.indexOf('=');
@@ -27,20 +27,14 @@ export const runActionCommand = {
27
27
  }
28
28
  inputs[entry.slice(0, separatorIndex)] = entry.slice(separatorIndex + 1);
29
29
  }
30
- // stdout carries ONLY the response JSON (terraform's `data "external"` consumes it), so suppress
31
- // boot output and route this command's own diagnostics to stderr.
32
- const { app, octo } = await bootOcto({ quietStdout: true });
30
+ const { app, octo } = await OctoUtility.bootOcto();
33
31
  const result = await octo.runAction(app, {
34
32
  inputs,
35
33
  resourceId,
36
34
  });
37
35
  // stdout carries ONLY the response JSON — terraform's `data "external"` consumes it.
38
36
  process.stdout.write(JSON.stringify(result.response));
39
- }
40
- catch (error) {
41
- reportError(error);
42
- process.exit(1);
43
- }
37
+ });
44
38
  },
45
39
  };
46
40
  //# sourceMappingURL=run-action.command.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"run-action.command.js","sourceRoot":"","sources":["../../../src/commands/run-action/run-action.command.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AAO7E,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,OAAO,EAAE,CAAC,KAAW,EAAQ,EAAE;QAC7B,OAAO,KAAK;aACT,MAAM,CAAC,YAAY,EAAE;YACpB,YAAY,EAAE,IAAI;YAClB,WAAW,EAAE,iDAAiD;YAC9D,IAAI,EAAE,QAAQ;SACf,CAAC;aACD,MAAM,CAAC,OAAO,EAAE;YACf,KAAK,EAAE,IAAI;YACX,OAAO,EAAE,EAAE;YACX,WAAW,EAAE,iFAAiF;YAC9F,IAAI,EAAE,QAAQ;SACf,CAAC,CAAC;IACP,CAAC;IACD,OAAO,EAAE,YAAY;IACrB,QAAQ,EAAE,wFAAwF;IAClG,OAAO,EAAE,KAAK,EAAE,IAAmD,EAAiB,EAAE;QACpF,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC;QAEnC,IAAI,CAAC;YACH,MAAM,MAAM,GAA2B,EAAE,CAAC;YAC1C,KAAK,MAAM,KAAK,IAAI,KAAK,IAAI,EAAE,EAAE,CAAC;gBAChC,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;gBAC1C,IAAI,cAAc,GAAG,CAAC,EAAE,CAAC;oBACvB,MAAM,IAAI,KAAK,CAAC,oBAAoB,KAAK,uDAAuD,CAAC,CAAC;gBACpG,CAAC;gBACD,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,cAAc,CAAC,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,cAAc,GAAG,CAAC,CAAC,CAAC;YAC3E,CAAC;YAED,iGAAiG;YACjG,kEAAkE;YAClE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,MAAM,QAAQ,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC;YAE5D,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE;gBACvC,MAAM;gBACN,UAAU;aACX,CAAC,CAAC;YAEH,qFAAqF;YACrF,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;QACxD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,WAAW,CAAC,KAAK,CAAC,CAAC;YACnB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC;CACF,CAAC"}
1
+ {"version":3,"file":"run-action.command.js","sourceRoot":"","sources":["../../../src/commands/run-action/run-action.command.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AAOnE,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,OAAO,EAAE,CAAC,KAAW,EAAQ,EAAE;QAC7B,OAAO,KAAK;aACT,MAAM,CAAC,YAAY,EAAE;YACpB,YAAY,EAAE,IAAI;YAClB,WAAW,EAAE,iDAAiD;YAC9D,IAAI,EAAE,QAAQ;SACf,CAAC;aACD,MAAM,CAAC,OAAO,EAAE;YACf,KAAK,EAAE,IAAI;YACX,OAAO,EAAE,EAAE;YACX,WAAW,EAAE,iFAAiF;YAC9F,IAAI,EAAE,QAAQ;SACf,CAAC,CAAC;IACP,CAAC;IACD,OAAO,EAAE,YAAY;IACrB,QAAQ,EAAE,wFAAwF;IAClG,OAAO,EAAE,KAAK,EAAE,IAAmD,EAAiB,EAAE;QACpF,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC;QAEnC,MAAM,WAAW,CAAC,UAAU,CAAC,YAAY,EAAE,KAAK,IAAI,EAAE;YACpD,MAAM,MAAM,GAA2B,EAAE,CAAC;YAC1C,KAAK,MAAM,KAAK,IAAI,KAAK,IAAI,EAAE,EAAE,CAAC;gBAChC,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;gBAC1C,IAAI,cAAc,GAAG,CAAC,EAAE,CAAC;oBACvB,MAAM,IAAI,KAAK,CAAC,oBAAoB,KAAK,uDAAuD,CAAC,CAAC;gBACpG,CAAC;gBACD,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,cAAc,CAAC,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,cAAc,GAAG,CAAC,CAAC,CAAC;YAC3E,CAAC;YAED,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,MAAM,WAAW,CAAC,QAAQ,EAAE,CAAC;YAEnD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE;gBACvC,MAAM;gBACN,UAAU;aACX,CAAC,CAAC;YAEH,qFAAqF;YACrF,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;QACxD,CAAC,CAAC,CAAC;IACL,CAAC;CACF,CAAC"}
@@ -1,13 +1,13 @@
1
1
  import type { ArgumentsCamelCase, Argv } from 'yargs';
2
2
  type UnlockCommandArguments = {
3
- force?: boolean;
4
- lockId?: string;
3
+ lockId: string;
5
4
  };
6
5
  /**
7
- * Releases the app lock.
6
+ * Finishes a run as it stands and releases its lock.
8
7
  *
9
- * A run that finishes releases its own lock - `commit` always does, however it ends - so this is
10
- * either for a run that never reached its commit, or for `--force` after one died holding the lock.
8
+ * A successful `commit` releases its own lock, so this is for a run that will not reach one - a run
9
+ * that never applied, or one somebody finished by hand. With a remote state provider, releasing
10
+ * seals what the run wrote.
11
11
  */
12
12
  export declare const unlockCommand: {
13
13
  builder: (yargs: Argv) => Argv;
@@ -1,51 +1,35 @@
1
1
  import { Container, StateManagementService } from '@quadnix/octo';
2
2
  import chalk from 'chalk';
3
- import { bootStateProvider, reportError } from '../../utilities/octo/octo.utility.js';
3
+ import { OctoUtility } from '../../utilities/octo/octo.utility.js';
4
4
  /**
5
- * Releases the app lock.
5
+ * Finishes a run as it stands and releases its lock.
6
6
  *
7
- * A run that finishes releases its own lock - `commit` always does, however it ends - so this is
8
- * either for a run that never reached its commit, or for `--force` after one died holding the lock.
7
+ * A successful `commit` releases its own lock, so this is for a run that will not reach one - a run
8
+ * that never applied, or one somebody finished by hand. With a remote state provider, releasing
9
+ * seals what the run wrote.
9
10
  */
10
11
  export const unlockCommand = {
11
12
  builder: (yargs) => {
12
- return yargs
13
- .option('lockId', {
14
- demandOption: false,
13
+ return yargs.option('lockId', {
14
+ demandOption: true,
15
15
  description: 'The lock ID to release, as printed by `octo lock`.',
16
16
  type: 'string',
17
- })
18
- .option('force', {
19
- default: false,
20
- demandOption: false,
21
- description: 'Release whatever lock is held, without knowing its ID. For a run that died holding one.',
22
- type: 'boolean',
23
17
  });
24
18
  },
25
19
  command: 'unlock',
26
- describe: 'Release the app state lock.',
20
+ describe: 'Finish a run as it stands, releasing its app state lock.',
27
21
  handler: async (argv) => {
28
- const { force, lockId } = argv;
29
- try {
30
- if (!force && !lockId) {
31
- throw new Error('Either --lockId or --force is required to unlock!');
32
- }
33
- await bootStateProvider();
22
+ const { lockId } = argv;
23
+ await OctoUtility.runCommand('unlock', async () => {
24
+ await OctoUtility.bootStateProvider();
34
25
  const stateManagementService = await Container.getInstance().get(StateManagementService);
35
- // Force reads the held lock and releases that, which is the only way through when the ID was
36
- // lost with the run that took it.
37
- const existingLockId = await stateManagementService.getAppLock();
38
- if (!existingLockId) {
26
+ if (!(await stateManagementService.getAppLock())) {
39
27
  console.error(chalk.green('App is already unlocked.'));
40
28
  return;
41
29
  }
42
- await stateManagementService.unlockApp(force ? existingLockId : lockId);
43
- console.error(chalk.green(`App was unlocked, releasing lock ID "${existingLockId}".`));
44
- }
45
- catch (error) {
46
- reportError(error);
47
- process.exit(1);
48
- }
30
+ await stateManagementService.unlockApp(lockId);
31
+ console.error(chalk.green(`App was unlocked, releasing lock ID "${lockId}".`));
32
+ });
49
33
  },
50
34
  };
51
35
  //# sourceMappingURL=unlock.command.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"unlock.command.js","sourceRoot":"","sources":["../../../src/commands/unlock/unlock.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAClE,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AAOtF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,OAAO,EAAE,CAAC,KAAW,EAAQ,EAAE;QAC7B,OAAO,KAAK;aACT,MAAM,CAAC,QAAQ,EAAE;YAChB,YAAY,EAAE,KAAK;YACnB,WAAW,EAAE,oDAAoD;YACjE,IAAI,EAAE,QAAQ;SACf,CAAC;aACD,MAAM,CAAC,OAAO,EAAE;YACf,OAAO,EAAE,KAAK;YACd,YAAY,EAAE,KAAK;YACnB,WAAW,EAAE,yFAAyF;YACtG,IAAI,EAAE,SAAS;SAChB,CAAC,CAAC;IACP,CAAC;IACD,OAAO,EAAE,QAAQ;IACjB,QAAQ,EAAE,6BAA6B;IACvC,OAAO,EAAE,KAAK,EAAE,IAAgD,EAAiB,EAAE;QACjF,MAAM,EAAE,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C7B,OAAO,KAAK,CAAC,MAAM,CAAC,QAAQ,EAAE;YAC5B,YAAY,EAAE,IAAI;YAClB,WAAW,EAAE,oDAAoD;YACjE,IAAI,EAAE,QAAQ;SACf,CAAC,CAAC;IACL,CAAC;IACD,OAAO,EAAE,QAAQ;IACjB,QAAQ,EAAE,0DAA0D;IACpE,OAAO,EAAE,KAAK,EAAE,IAAgD,EAAiB,EAAE;QACjF,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;QAExB,MAAM,WAAW,CAAC,UAAU,CAAC,QAAQ,EAAE,KAAK,IAAI,EAAE;YAChD,MAAM,WAAW,CAAC,iBAAiB,EAAE,CAAC;YACtC,MAAM,sBAAsB,GAAG,MAAM,SAAS,CAAC,WAAW,EAAE,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC;YAEzF,IAAI,CAAC,CAAC,MAAM,sBAAsB,CAAC,UAAU,EAAE,CAAC,EAAE,CAAC;gBACjD,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,0BAA0B,CAAC,CAAC,CAAC;gBACvD,OAAO;YACT,CAAC;YAED,MAAM,sBAAsB,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;YAC/C,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,wCAAwC,MAAM,IAAI,CAAC,CAAC,CAAC;QACjF,CAAC,CAAC,CAAC;IACL,CAAC;CACF,CAAC"}
@@ -6,7 +6,7 @@ type ValidateCommandArguments = {
6
6
  timeoutInMs?: number;
7
7
  };
8
8
  /**
9
- * Step 2 of the octo lifecycle. See {@link Octo.validate}.
9
+ * Step 2 of the octo lifecycle. See `Octo.validate()`.
10
10
  */
11
11
  export declare const validateCommand: {
12
12
  builder: (yargs: Argv) => Argv;
@@ -1,9 +1,8 @@
1
1
  import { resolve } from 'path';
2
2
  import { Container, TerraformUtility } from '@quadnix/octo';
3
- import chalk from 'chalk';
4
- import { bootOcto, prepareCallbackEnvironment, reportError } from '../../utilities/octo/octo.utility.js';
3
+ import { OctoUtility } from '../../utilities/octo/octo.utility.js';
5
4
  /**
6
- * Step 2 of the octo lifecycle. See {@link Octo.validate}.
5
+ * Step 2 of the octo lifecycle. See `Octo.validate()`.
7
6
  */
8
7
  export const validateCommand = {
9
8
  builder: (yargs) => {
@@ -34,10 +33,10 @@ export const validateCommand = {
34
33
  handler: async (argv) => {
35
34
  const { terraformBinary, terragruntBinary, terragruntDir, timeoutInMs } = argv;
36
35
  const resolvedDir = resolve(process.cwd(), terragruntDir);
37
- try {
36
+ await OctoUtility.runCommand('validate', async () => {
38
37
  // A plan reads every `data "external"`, and each one shells back out to `octo get-response`.
39
- prepareCallbackEnvironment();
40
- const { app, octo } = await bootOcto();
38
+ OctoUtility.prepareCallbackEnvironment();
39
+ const { app, octo } = await OctoUtility.bootOcto();
41
40
  const terraformUtility = await Container.getInstance().get(TerraformUtility, {
42
41
  args: [{ terraformBinary, terragruntBinary, timeoutInMs }, true],
43
42
  });
@@ -52,17 +51,12 @@ export const validateCommand = {
52
51
  // findings to act on, not exit codes.
53
52
  //
54
53
  // The verdict itself is not printed here - the listeners render the report, drift included,
55
- // on stdout, and a `console.log` alongside pino lands out of order. What is left is the exit
56
- // code, which is the CLI's own job, and the failure line on stderr.
54
+ // on stderr. What is left is the exit code, which is the CLI's own job, and the failure line on
55
+ // stderr.
57
56
  if (report.failures.length > 0) {
58
- console.error(chalk.red('\nValidation could not complete!'));
59
- process.exit(1);
57
+ throw new Error('Validation could not complete!');
60
58
  }
61
- }
62
- catch (error) {
63
- reportError(error);
64
- process.exit(1);
65
- }
59
+ });
66
60
  },
67
61
  };
68
62
  //# sourceMappingURL=validate.command.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"validate.command.js","sourceRoot":"","sources":["../../../src/commands/validate/validate.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM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EAAE,IAAI,EAAE,CAAC,CAAC;YAE5E,0FAA0F;YAC1F,6FAA6F;YAC7F,6CAA6C;YAC7C,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC;YAEpD,wFAAwF;YACxF,sCAAsC;YACtC,EAAE;YACF,4FAA4F;YAC5F,gGAAgG;YAChG,UAAU;YACV,IAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC/B,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;YACpD,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;CACF,CAAC"}
@@ -81,11 +81,8 @@
81
81
  {
82
82
  "additionalProperties": false,
83
83
  "properties": {
84
- "reportDir": {
85
- "type": "string"
86
- },
87
84
  "type": {
88
- "const": "HtmlReportEventListener",
85
+ "const": "JournalEventListener",
89
86
  "type": "string"
90
87
  }
91
88
  },
@@ -119,32 +116,49 @@
119
116
  {
120
117
  "additionalProperties": false,
121
118
  "properties": {
122
- "encryptionKey": {
123
- "type": "string"
124
- },
125
119
  "statePath": {
126
120
  "type": "string"
127
121
  },
128
122
  "type": {
129
- "const": "LocalEncryptionStateProvider",
123
+ "const": "LocalStateProvider",
130
124
  "type": "string"
131
125
  }
132
126
  },
133
- "required": ["encryptionKey", "type", "statePath"],
127
+ "required": ["type", "statePath"],
134
128
  "type": "object"
135
129
  },
136
130
  {
137
131
  "additionalProperties": false,
138
132
  "properties": {
133
+ "appId": {
134
+ "type": "string"
135
+ },
136
+ "checkInIntervalInSeconds": {
137
+ "maximum": 60,
138
+ "minimum": 5,
139
+ "type": "integer"
140
+ },
141
+ "lockContext": {
142
+ "type": "string"
143
+ },
144
+ "organizationId": {
145
+ "type": "string"
146
+ },
147
+ "sessionId": {
148
+ "type": "string"
149
+ },
150
+ "stateManagementServiceUrl": {
151
+ "type": "string"
152
+ },
139
153
  "statePath": {
140
154
  "type": "string"
141
155
  },
142
156
  "type": {
143
- "const": "LocalStateProvider",
157
+ "const": "RemoteStateProvider",
144
158
  "type": "string"
145
159
  }
146
160
  },
147
- "required": ["type", "statePath"],
161
+ "required": ["appId", "organizationId", "sessionId", "stateManagementServiceUrl", "statePath", "type"],
148
162
  "type": "object"
149
163
  },
150
164
  {