@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
@@ -1,144 +1,178 @@
1
1
  import { existsSync } from 'fs';
2
2
  import { delimiter, dirname, resolve } from 'path';
3
- import { Container, Octo, StateManagementService } from '@quadnix/octo';
3
+ import { CommandFailedEvent, CommandFinishedEvent, CommandStartedEvent, Container, Octo, StateManagementService, } from '@quadnix/octo';
4
4
  import chalk from 'chalk';
5
5
  import { YamlDefinitionUtility } from '../definition/yaml/yaml-definition.utility.js';
6
6
  /**
7
- * The absolute path of the definition file, from `OCTO_DEFINITION_FILE_PATH`.
8
- *
9
- * @throws If the variable is unset, or names a file that does not exist.
7
+ * Boots octo the way every lifecycle command does, from the definition file `OCTO_DEFINITION_FILE_PATH`
8
+ * names, and reports what went wrong when a command fails.
10
9
  */
11
- function resolveDefinitionFilePath() {
12
- const fromEnv = process.env.OCTO_DEFINITION_FILE_PATH;
13
- if (!fromEnv) {
14
- throw new Error(`Environment variable "OCTO_DEFINITION_FILE_PATH" is not set! Set it to the path of your Octo definition YAML file.`);
15
- }
16
- const definitionFilePath = resolve(process.cwd(), fromEnv);
17
- if (!existsSync(definitionFilePath)) {
18
- throw new Error(`Octo definition file not found at "${definitionFilePath}"!`);
19
- }
20
- return definitionFilePath;
21
- }
22
- /**
23
- * Boots only the state provider the definition names, without loading a single module.
24
- *
25
- * `apply` is a terraform action rather than an octo mode, so it has no reason to compose a model
26
- * graph - but terraform state is checked out of the state provider and back into it around every
27
- * terraform command, so the provider still has to be there.
28
- */
29
- export async function bootStateProvider() {
30
- const definition = new YamlDefinitionUtility(resolveDefinitionFilePath());
31
- const stateProvider = definition.resolveStateProvider();
32
- await Container.getInstance().get(StateManagementService, {
33
- args: [stateProvider.type],
34
- });
35
- }
36
- /**
37
- * @param quietStdout Keeps **stdout** free of everything but the command's own output. Set by
38
- * `run-action`, whose stdout is consumed by terraform's `data "external"` as JSON.
39
- *
40
- * It does not disable listeners — it routes them to stderr, so that the SDK resource-action path,
41
- * the only place resource actions actually execute, stays observable.
42
- */
43
- export async function bootOcto({ quietStdout = false } = {}) {
44
- const definition = new YamlDefinitionUtility(resolveDefinitionFilePath());
45
- const hooks = await definition.resolveHooks();
46
- const imports = await definition.resolveImports();
47
- const listeners = await definition.resolveListeners({ logDestination: quietStdout ? 'stderr' : 'stdout' });
48
- const modules = definition.resolveModules(imports);
49
- const stateProvider = definition.resolveStateProvider();
50
- const tags = definition.resolveTags();
51
- const terraformOptions = definition.resolveTerraformOptions();
52
- if (!quietStdout) {
53
- console.log(chalk.green('Definition file is valid and all modules were successfully imported.'));
54
- }
55
- // Initialize.
56
- const octo = new Octo();
57
- await octo.initialize(stateProvider.type, listeners.map((l) => ({
58
- options: {
59
- args: l.args,
60
- metadata: l.metadata,
61
- },
62
- type: l.type,
63
- })));
64
- // Register hooks.
65
- octo.registerHooks(hooks);
66
- // Register terraform config + providers.
67
- octo.registerTerraformConfig({
68
- minTerraformVersion: terraformOptions.requiredVersion,
69
- providers: terraformOptions.requiredProviders,
70
- });
71
- for (const provider of terraformOptions.providers) {
72
- octo.registerTerraformProvider(provider.providerType, provider.accountId, provider.regionId, provider.spec, {
73
- accountName: provider.accountName,
74
- setRegionAttribute: provider.setRegionAttribute,
10
+ export class OctoUtility {
11
+ /**
12
+ * Boots octo with every listener, hook, module and terraform provider the definition lists, and
13
+ * composes the app. Prints nothing, so stdout carries only the command's own output.
14
+ */
15
+ static async bootOcto() {
16
+ const definition = new YamlDefinitionUtility(OctoUtility.resolveDefinitionFilePath());
17
+ const hooks = await definition.resolveHooks();
18
+ const imports = await definition.resolveImports();
19
+ const listeners = await definition.resolveListeners();
20
+ const modules = definition.resolveModules(imports);
21
+ const stateProvider = definition.resolveStateProvider();
22
+ const tags = definition.resolveTags();
23
+ const terraformOptions = definition.resolveTerraformOptions();
24
+ // Initialize.
25
+ const octo = new Octo();
26
+ await octo.initialize(stateProvider.type, listeners.map((l) => ({
27
+ options: {
28
+ args: l.args,
29
+ metadata: l.metadata,
30
+ },
31
+ type: l.type,
32
+ })));
33
+ // Register hooks.
34
+ octo.registerHooks(hooks);
35
+ // Register terraform config + providers.
36
+ octo.registerTerraformConfig({
37
+ minTerraformVersion: terraformOptions.requiredVersion,
38
+ providers: terraformOptions.requiredProviders,
75
39
  });
40
+ for (const provider of terraformOptions.providers) {
41
+ octo.registerTerraformProvider(provider.providerType, provider.accountId, provider.regionId, provider.spec, {
42
+ accountName: provider.accountName,
43
+ setRegionAttribute: provider.setRegionAttribute,
44
+ });
45
+ }
46
+ // Load modules.
47
+ for (const moduleDefinition of modules) {
48
+ octo.loadModule(moduleDefinition.moduleClass, moduleDefinition.moduleId, moduleDefinition.moduleInputs);
49
+ }
50
+ octo.orderModules(modules.map((m) => m.moduleClass));
51
+ // Compose.
52
+ await octo.compose();
53
+ const app = octo.getRootModel();
54
+ // Register tags. A module-scoped tag names a module that only exists once compose has run it.
55
+ octo.registerTags(tags);
56
+ return { app, octo };
76
57
  }
77
- // Load modules.
78
- for (const moduleDefinition of modules) {
79
- octo.loadModule(moduleDefinition.moduleClass, moduleDefinition.moduleId, moduleDefinition.moduleInputs);
58
+ /**
59
+ * Boots only the state provider the definition names, without loading a single module, and returns
60
+ * how often terraform state is checked into it during a terraform command. Loads every listener the definition lists.
61
+ *
62
+ * `apply` is a terraform action rather than an octo mode, so it has no reason to compose a model
63
+ * graph - but terraform state is checked out of the state provider and back into it around every
64
+ * terraform command, so the provider still has to be there, and terraform's output reaches the
65
+ * terminal only through the listeners.
66
+ */
67
+ static async bootStateProvider() {
68
+ const definition = new YamlDefinitionUtility(OctoUtility.resolveDefinitionFilePath());
69
+ const stateProvider = definition.resolveStateProvider();
70
+ await Container.getInstance().get(StateManagementService, {
71
+ args: [stateProvider.type],
72
+ });
73
+ for (const listener of await definition.resolveListeners()) {
74
+ await Container.getInstance().get(listener.type, {
75
+ args: listener.args,
76
+ metadata: listener.metadata,
77
+ });
78
+ }
79
+ return { stateCheckInIntervalInMs: definition.resolveStateCheckInIntervalInMs() };
80
80
  }
81
- octo.orderModules(modules.map((m) => m.moduleClass));
82
- // Compose.
83
- await octo.compose();
84
- const app = octo.getRootModel();
85
- // Register tags. A module-scoped tag names a module that only exists once compose has run it.
86
- octo.registerTags(tags);
87
- return { app, octo };
88
- }
89
- /**
90
- * Makes the environment survive the trip into terraform's `local-exec`.
91
- *
92
- * An external resource shells back out to `octo` from the terraform that terragrunt runs -
93
- * `run-action` from its `local-exec` provisioner, `get-response` from its `data "external"` - and
94
- * those commands inherit this process's environment. Two things about it are wrong by default, and
95
- * both fail only after real infrastructure exists:
96
- *
97
- * - **`octo` is a bare binary name**, resolved through `PATH`. Invoking a binary by path -
98
- * `node_modules/.bin/octo apply` - does not put its directory on `PATH` for child processes, so
99
- * the callback dies with `octo: command not found`. The generated app runs the flow through
100
- * package scripts, and `npm run` does put that directory on `PATH`, but running the binary
101
- * directly is still supported and has to work the same. The project's bin directory is prepended
102
- * here, and the directory this CLI is running from after it, so a globally installed or linked
103
- * octo still wins over nothing at all.
104
- * - **`OCTO_DEFINITION_FILE_PATH` is usually relative** (`octo.yaml` - the package scripts set
105
- * exactly that), and terraform runs `local-exec` with a terragrunt cache directory as its cwd,
106
- * where that resolves to nothing. It is made absolute here, against the cwd the user actually
107
- * invoked from.
108
- */
109
- export function prepareCallbackEnvironment() {
110
- const definitionFilePath = process.env.OCTO_DEFINITION_FILE_PATH;
111
- if (definitionFilePath) {
112
- process.env.OCTO_DEFINITION_FILE_PATH = resolve(process.cwd(), definitionFilePath);
81
+ /**
82
+ * Makes the environment survive the trip into terraform's `local-exec`.
83
+ *
84
+ * An external resource shells back out to `octo` from the terraform that terragrunt runs -
85
+ * `run-action` from its `local-exec` provisioner, `get-response` from its `data "external"` - and
86
+ * those commands inherit this process's environment. Two things about it are wrong by default, and
87
+ * both fail only after real infrastructure exists:
88
+ *
89
+ * - **`octo` is a bare binary name**, resolved through `PATH`. Invoking a binary by path -
90
+ * `node_modules/.bin/octo apply` - does not put its directory on `PATH` for child processes, so
91
+ * the callback dies with `octo: command not found`. The generated app runs the flow through
92
+ * package scripts, and `npm run` does put that directory on `PATH`, but running the binary
93
+ * directly is still supported and has to work the same. The project's bin directory is prepended
94
+ * here, and the directory this CLI is running from after it, so a globally installed or linked
95
+ * octo still wins over nothing at all.
96
+ * - **`OCTO_DEFINITION_FILE_PATH` is usually relative** (`octo.yaml` - the package scripts set
97
+ * exactly that), and terraform runs `local-exec` with a terragrunt cache directory as its cwd,
98
+ * where that resolves to nothing. It is made absolute here, against the cwd the user actually
99
+ * invoked from.
100
+ */
101
+ static prepareCallbackEnvironment() {
102
+ const definitionFilePath = process.env.OCTO_DEFINITION_FILE_PATH;
103
+ if (definitionFilePath) {
104
+ process.env.OCTO_DEFINITION_FILE_PATH = resolve(process.cwd(), definitionFilePath);
105
+ }
106
+ const binDirectories = [resolve(process.cwd(), 'node_modules', '.bin'), dirname(process.argv[1] ?? '')].filter((directory) => directory && existsSync(directory));
107
+ const pathEntries = (process.env.PATH ?? '').split(delimiter).filter(Boolean);
108
+ process.env.PATH = [...binDirectories.filter((d) => !pathEntries.includes(d)), ...pathEntries].join(delimiter);
113
109
  }
114
- const binDirectories = [resolve(process.cwd(), 'node_modules', '.bin'), dirname(process.argv[1] ?? '')].filter((directory) => directory && existsSync(directory));
115
- const pathEntries = (process.env.PATH ?? '').split(delimiter).filter(Boolean);
116
- process.env.PATH = [...binDirectories.filter((d) => !pathEntries.includes(d)), ...pathEntries].join(delimiter);
117
- }
118
- /**
119
- * Prints an octo error to stderr, including the properties it carries - the diff that matched no
120
- * action, most of all - which a bare stack trace would hide.
121
- */
122
- export function reportError(error) {
123
- console.error(chalk.red(error.stack));
124
- for (const errorProperty of Object.getOwnPropertyNames(error) || []) {
125
- if (errorProperty !== 'message' && errorProperty !== 'stack') {
126
- // Serialized rather than interpolated: the properties worth attaching to an octo error are
127
- // objects - the diff that matched no action, most of all - and `${}` renders those as
128
- // "[object Object]", which hides the only thing that would identify the node and field.
129
- const value = error[errorProperty];
130
- const renderedValue = value !== null && typeof value === 'object' ? JSON.stringify(value, undefined, 2) : String(value);
131
- console.error(chalk.red(`${errorProperty}: ${renderedValue}`));
110
+ /**
111
+ * Prints an octo error to stderr, including the properties it carries - the diff that matched no
112
+ * action, most of all - which a bare stack trace would hide.
113
+ */
114
+ static reportError(error) {
115
+ console.error(chalk.red(error.stack));
116
+ for (const errorProperty of Object.getOwnPropertyNames(error) || []) {
117
+ if (errorProperty !== 'message' && errorProperty !== 'stack') {
118
+ // Serialized rather than interpolated: the properties worth attaching to an octo error are
119
+ // objects - the diff that matched no action, most of all - and `${}` renders those as
120
+ // "[object Object]", which hides the only thing that would identify the node and field.
121
+ const value = error[errorProperty];
122
+ const renderedValue = value !== null && typeof value === 'object' ? JSON.stringify(value, undefined, 2) : String(value);
123
+ console.error(chalk.red(`${errorProperty}: ${renderedValue}`));
124
+ }
125
+ }
126
+ const failures = error.failures || [];
127
+ if (failures.length > 0) {
128
+ console.error('\n');
129
+ console.error(chalk.red('FAILURES'));
130
+ console.error(chalk.red('========'));
131
+ }
132
+ for (let i = 0; i < failures.length; i++) {
133
+ console.error(chalk.red(`${i + 1}. ${failures[i]}`));
132
134
  }
133
135
  }
134
- const failures = error.failures || [];
135
- if (failures.length > 0) {
136
- console.error('\n');
137
- console.error(chalk.red('FAILURES'));
138
- console.error(chalk.red('========'));
136
+ /**
137
+ * Runs one lifecycle command: announces it, runs `body`, and exits with 1 after reporting what it
138
+ * threw. The command's end is announced, and awaited by listeners such as the journal, before the
139
+ * process exits.
140
+ */
141
+ static async runCommand(command, body) {
142
+ const eventService = (await Container.getInstance().get('EventService'));
143
+ const startedAt = Date.now();
144
+ eventService.emit(new CommandStartedEvent(undefined, { command }));
145
+ // Run the command, announcing how it ended.
146
+ try {
147
+ await body();
148
+ }
149
+ catch (error) {
150
+ await eventService.emitAndWait(new CommandFailedEvent(undefined, {
151
+ command,
152
+ durationInMs: Date.now() - startedAt,
153
+ error: error instanceof Error ? error : new Error(String(error)),
154
+ }));
155
+ OctoUtility.reportError(error);
156
+ process.exit(1);
157
+ return;
158
+ }
159
+ await eventService.emitAndWait(new CommandFinishedEvent(undefined, { command, durationInMs: Date.now() - startedAt }));
139
160
  }
140
- for (let i = 0; i < failures.length; i++) {
141
- console.error(chalk.red(`${i + 1}. ${failures[i]}`));
161
+ /**
162
+ * The absolute path of the definition file, from `OCTO_DEFINITION_FILE_PATH`.
163
+ *
164
+ * @throws If the variable is unset, or names a file that does not exist.
165
+ */
166
+ static resolveDefinitionFilePath() {
167
+ const fromEnv = process.env.OCTO_DEFINITION_FILE_PATH;
168
+ if (!fromEnv) {
169
+ throw new Error(`Environment variable "OCTO_DEFINITION_FILE_PATH" is not set! Set it to the path of your Octo definition YAML file.`);
170
+ }
171
+ const definitionFilePath = resolve(process.cwd(), fromEnv);
172
+ if (!existsSync(definitionFilePath)) {
173
+ throw new Error(`Octo definition file not found at "${definitionFilePath}"!`);
174
+ }
175
+ return definitionFilePath;
142
176
  }
143
177
  }
144
178
  //# sourceMappingURL=octo.utility.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"octo.utility.js","sourceRoot":"","sources":["../../../src/utilities/octo/octo.utility.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACnD,OAAO,EAAY,SAA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octo-event-listeners": "~0.1.0",
9
+ "@quadnix/octo": "~0.2.0",
10
+ "@quadnix/octo-event-listeners": "~0.2.0",
11
11
  "ajv": "~8.17.1",
12
12
  "chalk": "~5.5.0",
13
13
  "js-yaml": "~4.1.0",
@@ -80,12 +80,14 @@
80
80
  },
81
81
  "type": "module",
82
82
  "types": "./dist/index.d.ts",
83
- "version": "0.1.0",
83
+ "version": "0.2.0",
84
84
  "scripts": {
85
85
  "build": "rimraf dist && tsc -p tsconfig.build.json && pnpm run copy-assets && chmod +x ./dist/index.js",
86
86
  "check:circular-dependency": "dpdm --no-tree --exit-code circular:1 --no-warning ./dist/index.js",
87
+ "check:types": "tsc --noEmit -p tsconfig.json",
87
88
  "copy-assets": "copyfiles -u 1 \"src/**/*.{ejs,json}\" dist/",
88
89
  "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
90
+ "format:check": "prettier --check \"src/**/*.ts\" \"test/**/*.ts\"",
89
91
  "lint": "eslint .",
90
92
  "lint:fix": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
91
93
  "test": "NODE_OPTIONS=--experimental-vm-modules jest --testRegex=\"\\.spec.ts$\"",