@quadnix/octo-build 0.0.17 → 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.
- package/LICENSE +661 -0
- package/README.md +117 -8
- package/dist/commands/apply/apply.command.d.ts +25 -0
- package/dist/commands/apply/apply.command.js +130 -0
- package/dist/commands/apply/apply.command.js.map +1 -0
- package/dist/commands/apply/index.d.ts +1 -0
- package/dist/commands/apply/index.js +2 -0
- package/dist/commands/apply/index.js.map +1 -0
- package/dist/commands/build/build.command.d.ts +1 -1
- package/dist/commands/build/build.command.js +4 -4
- package/dist/commands/build/build.command.js.map +1 -1
- package/dist/commands/build/main.d.ts +22 -0
- package/dist/commands/build/main.js +22 -0
- package/dist/commands/build/main.js.map +1 -1
- package/dist/commands/build/parsers/build-file.parser.d.ts +6 -0
- package/dist/commands/build/parsers/build-file.parser.js +6 -0
- package/dist/commands/build/parsers/build-file.parser.js.map +1 -1
- package/dist/commands/build/streams/stream-manager.d.ts +6 -0
- package/dist/commands/build/streams/stream-manager.js +7 -1
- package/dist/commands/build/streams/stream-manager.js.map +1 -1
- package/dist/commands/commit/commit.command.d.ts +23 -0
- package/dist/commands/commit/commit.command.js +81 -0
- package/dist/commands/commit/commit.command.js.map +1 -0
- package/dist/commands/commit/index.d.ts +1 -0
- package/dist/commands/commit/index.js +2 -0
- package/dist/commands/commit/index.js.map +1 -0
- package/dist/commands/create-anchor/create-anchor.command.js +1 -1
- package/dist/commands/create-anchor/create-anchor.command.js.map +1 -1
- package/dist/commands/create-anchor/generator-octo-anchor-template/generators/app/index.d.ts +18 -3
- package/dist/commands/create-anchor/generator-octo-anchor-template/generators/app/index.js +29 -11
- package/dist/commands/create-anchor/generator-octo-anchor-template/generators/app/index.js.map +1 -1
- package/dist/commands/create-anchor/generator-octo-anchor-template/generators/app/templates/anchors/anchor/anchor.schema.ts.ejs +9 -1
- package/dist/commands/create-app/create-app.command.d.ts +1 -1
- package/dist/commands/create-app/create-app.command.js +7 -3
- package/dist/commands/create-app/create-app.command.js.map +1 -1
- package/dist/commands/create-app/generator-octo-app-template/generators/app/index.d.ts +17 -1
- package/dist/commands/create-app/generator-octo-app-template/generators/app/index.js +72 -16
- package/dist/commands/create-app/generator-octo-app-template/generators/app/index.js.map +1 -1
- package/dist/commands/create-app/generator-octo-app-template/generators/app/templates/README.md.ejs +73 -14
- package/dist/commands/create-app/generator-octo-app-template/generators/app/templates/gitignore.ejs +14 -0
- package/dist/commands/create-app/generator-octo-app-template/generators/app/templates/index.ts.ejs +19 -0
- package/dist/commands/create-app/generator-octo-app-template/generators/app/templates/package.json.ejs +9 -1
- package/dist/commands/create-app/generator-octo-app-template/generators/app/templates/src/aws-dynamodb-service/octo.yaml.ejs +111 -0
- package/dist/commands/create-app/generator-octo-app-template/generators/app/templates/src/aws-ecs-server/octo.yaml.ejs +28 -16
- package/dist/commands/create-app/generator-octo-app-template/generators/app/templates/src/aws-s3-website/octo.yaml.ejs +25 -3
- package/dist/commands/create-app/generator-octo-app-template/generators/app/templates/tsconfig.json.ejs +0 -3
- package/dist/commands/{create-resource/create-resource.command.d.ts → create-external-resource/create-external-resource.command.d.ts} +1 -1
- package/dist/commands/create-external-resource/create-external-resource.command.js +64 -0
- package/dist/commands/create-external-resource/create-external-resource.command.js.map +1 -0
- package/dist/commands/{create-resource/generator-octo-resource-template → create-external-resource/generator-octo-external-resource-template}/generators/app/index.d.ts +17 -2
- package/dist/commands/{create-resource/generator-octo-resource-template → create-external-resource/generator-octo-external-resource-template}/generators/app/index.js +36 -35
- package/dist/commands/create-external-resource/generator-octo-external-resource-template/generators/app/index.js.map +1 -0
- package/dist/commands/{create-resource/generator-octo-resource-template → create-external-resource/generator-octo-external-resource-template}/generators/app/templates/resources/resource/actions/add.resource.action.ts.ejs +7 -16
- package/dist/commands/{create-resource/generator-octo-resource-template → create-external-resource/generator-octo-external-resource-template}/generators/app/templates/resources/resource/actions/delete.resource.action.ts.ejs +21 -3
- package/dist/commands/create-external-resource/generator-octo-external-resource-template/generators/app/templates/resources/resource/actions/update.resource.action.ts.ejs +63 -0
- package/dist/commands/{create-resource/generator-octo-resource-template → create-external-resource/generator-octo-external-resource-template}/generators/app/templates/resources/resource/index.ts.ejs +1 -2
- package/dist/commands/create-external-resource/generator-octo-external-resource-template/generators/app/templates/resources/resource/resource.ts.ejs +28 -0
- package/dist/commands/create-external-resource/index.d.ts +1 -0
- package/dist/commands/create-external-resource/index.js +2 -0
- package/dist/commands/create-external-resource/index.js.map +1 -0
- package/dist/commands/create-model/create-model.command.js +1 -1
- package/dist/commands/create-model/create-model.command.js.map +1 -1
- package/dist/commands/create-model/generator-octo-model-template/generators/app/index.d.ts +17 -2
- package/dist/commands/create-model/generator-octo-model-template/generators/app/index.js +26 -9
- package/dist/commands/create-model/generator-octo-model-template/generators/app/index.js.map +1 -1
- package/dist/commands/create-model/generator-octo-model-template/generators/app/templates/models/model/model.ts.ejs +41 -1
- package/dist/commands/create-model/generator-octo-model-template/generators/app/templates/models/model/schema.ts.ejs +6 -1
- package/dist/commands/create-module/create-module.command.js +1 -1
- package/dist/commands/create-module/create-module.command.js.map +1 -1
- package/dist/commands/create-module/generator-octo-module-template/generators/app/index.d.ts +17 -2
- package/dist/commands/create-module/generator-octo-module-template/generators/app/index.js +27 -10
- package/dist/commands/create-module/generator-octo-module-template/generators/app/index.js.map +1 -1
- package/dist/commands/create-overlay/create-overlay.command.js +4 -3
- package/dist/commands/create-overlay/create-overlay.command.js.map +1 -1
- package/dist/commands/create-overlay/generator-octo-overlay-template/generators/app/index.d.ts +17 -2
- package/dist/commands/create-overlay/generator-octo-overlay-template/generators/app/index.js +26 -9
- package/dist/commands/create-overlay/generator-octo-overlay-template/generators/app/index.js.map +1 -1
- package/dist/commands/{create-cdk/create-cdk.command.d.ts → create-terraform-resource/create-terraform-resource.command.d.ts} +3 -3
- package/dist/commands/{create-resource/create-resource.command.js → create-terraform-resource/create-terraform-resource.command.js} +17 -11
- package/dist/commands/create-terraform-resource/create-terraform-resource.command.js.map +1 -0
- package/dist/commands/create-terraform-resource/generator-octo-terraform-resource-template/generators/app/index.d.ts +25 -0
- package/dist/commands/create-terraform-resource/generator-octo-terraform-resource-template/generators/app/index.js +71 -0
- package/dist/commands/create-terraform-resource/generator-octo-terraform-resource-template/generators/app/index.js.map +1 -0
- package/dist/commands/create-terraform-resource/generator-octo-terraform-resource-template/generators/app/templates/resources/resource/index.schema.ts.ejs +43 -0
- package/dist/commands/create-terraform-resource/generator-octo-terraform-resource-template/generators/app/templates/resources/resource/index.ts.ejs +1 -0
- package/dist/commands/create-terraform-resource/generator-octo-terraform-resource-template/generators/app/templates/resources/resource/resource.ts.ejs +83 -0
- package/dist/commands/create-terraform-resource/index.d.ts +1 -0
- package/dist/commands/create-terraform-resource/index.js +2 -0
- package/dist/commands/create-terraform-resource/index.js.map +1 -0
- package/dist/commands/generate/generate.command.d.ts +16 -0
- package/dist/commands/generate/generate.command.js +35 -0
- package/dist/commands/generate/generate.command.js.map +1 -0
- package/dist/commands/generate/index.d.ts +1 -0
- package/dist/commands/generate/index.js +2 -0
- package/dist/commands/generate/index.js.map +1 -0
- package/dist/commands/get-response/get-response.command.d.ts +18 -0
- package/dist/commands/get-response/get-response.command.js +39 -0
- package/dist/commands/get-response/get-response.command.js.map +1 -0
- package/dist/commands/get-response/index.d.ts +1 -0
- package/dist/commands/get-response/index.js +2 -0
- package/dist/commands/get-response/index.js.map +1 -0
- package/dist/commands/lock/index.d.ts +1 -0
- package/dist/commands/lock/index.js +2 -0
- package/dist/commands/lock/index.js.map +1 -0
- package/dist/commands/lock/lock.command.d.ts +18 -0
- package/dist/commands/lock/lock.command.js +31 -0
- package/dist/commands/lock/lock.command.js.map +1 -0
- package/dist/commands/run-action/index.d.ts +1 -0
- package/dist/commands/run-action/index.js +2 -0
- package/dist/commands/run-action/index.js.map +1 -0
- package/dist/commands/run-action/run-action.command.d.ts +12 -0
- package/dist/commands/run-action/run-action.command.js +40 -0
- package/dist/commands/run-action/run-action.command.js.map +1 -0
- package/dist/commands/unlock/index.d.ts +1 -0
- package/dist/commands/unlock/index.js +2 -0
- package/dist/commands/unlock/index.js.map +1 -0
- package/dist/commands/unlock/unlock.command.d.ts +18 -0
- package/dist/commands/unlock/unlock.command.js +35 -0
- package/dist/commands/unlock/unlock.command.js.map +1 -0
- package/dist/commands/validate/index.d.ts +1 -0
- package/dist/commands/validate/index.js +2 -0
- package/dist/commands/validate/index.js.map +1 -0
- package/dist/commands/validate/validate.command.d.ts +17 -0
- package/dist/commands/validate/validate.command.js +62 -0
- package/dist/commands/validate/validate.command.js.map +1 -0
- package/dist/index.js +20 -8
- package/dist/index.js.map +1 -1
- package/dist/resources/octo-v1.schema.json +108 -27
- package/dist/utilities/definition/yaml/yaml-definition.utility.d.ts +103 -13
- package/dist/utilities/definition/yaml/yaml-definition.utility.js +215 -68
- package/dist/utilities/definition/yaml/yaml-definition.utility.js.map +1 -1
- package/dist/utilities/octo/octo.utility.d.ts +65 -0
- package/dist/utilities/octo/octo.utility.js +178 -0
- package/dist/utilities/octo/octo.utility.js.map +1 -0
- package/dist/utilities/process/process.utility.d.ts +8 -0
- package/dist/utilities/process/process.utility.js +8 -0
- package/dist/utilities/process/process.utility.js.map +1 -1
- package/dist/utilities/project-index/project-index.utility.d.ts +27 -0
- package/dist/utilities/project-index/project-index.utility.js +71 -0
- package/dist/utilities/project-index/project-index.utility.js.map +1 -0
- package/dist/utilities/string/string.utility.d.ts +22 -0
- package/dist/utilities/string/string.utility.js +27 -0
- package/dist/utilities/string/string.utility.js.map +1 -1
- package/package.json +11 -8
- package/dist/commands/create-cdk/create-cdk.command.js +0 -70
- package/dist/commands/create-cdk/create-cdk.command.js.map +0 -1
- package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/index.d.ts +0 -10
- package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/index.js +0 -107
- package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/index.js.map +0 -1
- package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/README.md.ejs +0 -23
- package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/eslint.config.js.ejs +0 -337
- package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/gitignore.ejs +0 -82
- package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/gitkeep.ejs +0 -0
- package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/package.json.ejs +0 -57
- package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/prettierrc.ejs +0 -5
- package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/src/anchors/app/app.anchor.schema.ts.ejs +0 -19
- package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/src/anchors/app/app.anchor.ts.ejs +0 -17
- package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/src/factories/dummy-credentials.factory.ts.ejs +0 -28
- package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/src/modules/app/dummy-app/dummy-app.module.spec.ts.ejs +0 -90
- package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/src/modules/app/dummy-app/dummy-app.module.ts.ejs +0 -16
- package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/src/modules/app/dummy-app/index.schema.ts.ejs +0 -10
- package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/src/modules/app/dummy-app/index.ts.ejs +0 -3
- package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/src/modules/app/dummy-app/models/app/actions/add-dummy-app.model.action.ts.ejs +0 -59
- package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/src/modules/app/dummy-app/models/app/index.ts.ejs +0 -1
- package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/src/resources/http-fetch/actions/add-http-fetch.resource.action.ts.ejs +0 -55
- package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/src/resources/http-fetch/http-fetch.resource.ts.ejs +0 -12
- package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/src/resources/http-fetch/index.schema.ts.ejs +0 -35
- package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/src/resources/http-fetch/index.ts.ejs +0 -3
- package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/src/utilities/dummy/dummy.utility.ts.ejs +0 -11
- package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/tsconfig.build.json.ejs +0 -11
- package/dist/commands/create-cdk/generator-octo-cdk-template/generators/app/templates/tsconfig.json.ejs +0 -39
- package/dist/commands/create-cdk/index.d.ts +0 -1
- package/dist/commands/create-cdk/index.js +0 -2
- package/dist/commands/create-cdk/index.js.map +0 -1
- package/dist/commands/create-resource/create-resource.command.js.map +0 -1
- package/dist/commands/create-resource/generator-octo-resource-template/generators/app/index.js.map +0 -1
- package/dist/commands/create-resource/generator-octo-resource-template/generators/app/templates/resources/resource/actions/update-tags.resource.action.ts.ejs +0 -86
- package/dist/commands/create-resource/generator-octo-resource-template/generators/app/templates/resources/resource/actions/validate.resource.action.ts.ejs +0 -40
- package/dist/commands/create-resource/generator-octo-resource-template/generators/app/templates/resources/resource/resource.ts.ejs +0 -12
- package/dist/commands/create-resource/index.d.ts +0 -1
- package/dist/commands/create-resource/index.js +0 -2
- package/dist/commands/create-resource/index.js.map +0 -1
- package/dist/commands/run/index.d.ts +0 -1
- package/dist/commands/run/index.js +0 -2
- package/dist/commands/run/index.js.map +0 -1
- package/dist/commands/run/run.command.d.ts +0 -11
- package/dist/commands/run/run.command.js +0 -96
- package/dist/commands/run/run.command.js.map +0 -1
- package/dist/commands/state/index.d.ts +0 -1
- package/dist/commands/state/index.js +0 -2
- package/dist/commands/state/index.js.map +0 -1
- package/dist/commands/state/state.command.d.ts +0 -14
- package/dist/commands/state/state.command.js +0 -79
- package/dist/commands/state/state.command.js.map +0 -1
- /package/dist/commands/{create-resource/generator-octo-resource-template → create-external-resource/generator-octo-external-resource-template}/generators/app/templates/resources/resource/index.schema.ts.ejs +0 -0
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { Factory } from '@quadnix/octo';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* This is a dummy credentials class to demonstrate how to create a custom factory and use it across your CDK.
|
|
5
|
-
*/
|
|
6
|
-
export class DummyCredentials {
|
|
7
|
-
readonly username = 'dummy';
|
|
8
|
-
readonly password = 'dummy';
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* This is a factory exposing a singleton instance of the `DummyCredentials` class.
|
|
13
|
-
* It uses the `@Factory` decorator to register with the Octo container.
|
|
14
|
-
* It defines some unique metadata which uniquely identifies the factory category.
|
|
15
|
-
* Calling the factory using the container will always execute the `create` method,
|
|
16
|
-
* and return an instance of the `DummyCredentials` class.
|
|
17
|
-
*/
|
|
18
|
-
@Factory<DummyCredentials>(DummyCredentials, { metadata: { package: '@<%= name %>' } })
|
|
19
|
-
export class DummyCredentialsFactory {
|
|
20
|
-
private static instance: DummyCredentials;
|
|
21
|
-
|
|
22
|
-
static async create(): Promise<DummyCredentials> {
|
|
23
|
-
if (!this.instance) {
|
|
24
|
-
this.instance = new DummyCredentials();
|
|
25
|
-
}
|
|
26
|
-
return this.instance;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import { TestContainer, TestModuleContainer, TestStateProvider } from '@quadnix/octo';
|
|
2
|
-
import { DummyAppModule } from './index.js';
|
|
3
|
-
|
|
4
|
-
describe('DummyAppModule UT', () => {
|
|
5
|
-
let testModuleContainer: TestModuleContainer;
|
|
6
|
-
|
|
7
|
-
beforeEach(async () => {
|
|
8
|
-
await TestContainer.create(
|
|
9
|
-
{
|
|
10
|
-
mocks: [],
|
|
11
|
-
},
|
|
12
|
-
{ factoryTimeoutInMs: 500 },
|
|
13
|
-
);
|
|
14
|
-
|
|
15
|
-
testModuleContainer = new TestModuleContainer();
|
|
16
|
-
await testModuleContainer.initialize(new TestStateProvider());
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
afterEach(async () => {
|
|
20
|
-
await testModuleContainer.reset();
|
|
21
|
-
await TestContainer.reset();
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
it('should call correct actions', async () => {
|
|
25
|
-
const { 'app-module.model.app': app } = await testModuleContainer.runModule<DummyAppModule>({
|
|
26
|
-
inputs: { name: '<%= name %>' },
|
|
27
|
-
moduleId: 'app-module',
|
|
28
|
-
type: DummyAppModule,
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
const result = await testModuleContainer.commit(app, {
|
|
32
|
-
enableResourceCapture: false,
|
|
33
|
-
filterByModuleIds: ['app-module'],
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
// Correct actions are called.
|
|
37
|
-
expect(testModuleContainer.mapTransactionActions(result.modelTransaction)).toMatchInlineSnapshot(`
|
|
38
|
-
[
|
|
39
|
-
[
|
|
40
|
-
"AddDummyAppModelAction",
|
|
41
|
-
],
|
|
42
|
-
]
|
|
43
|
-
`);
|
|
44
|
-
expect(testModuleContainer.mapTransactionActions(result.resourceTransaction)).toMatchInlineSnapshot(`
|
|
45
|
-
[
|
|
46
|
-
[
|
|
47
|
-
"AddHttpFetchResourceAction",
|
|
48
|
-
],
|
|
49
|
-
]
|
|
50
|
-
`);
|
|
51
|
-
|
|
52
|
-
// Correct resources are added.
|
|
53
|
-
expect(result.resourceDiffs).toMatchInlineSnapshot(`
|
|
54
|
-
[
|
|
55
|
-
[
|
|
56
|
-
{
|
|
57
|
-
"action": "add",
|
|
58
|
-
"field": "resourceId",
|
|
59
|
-
"node": "@<%= name %>/http-fetch=http-fetch-<%= name %>",
|
|
60
|
-
"value": "@<%= name %>/http-fetch=http-fetch-<%= name %>",
|
|
61
|
-
},
|
|
62
|
-
],
|
|
63
|
-
]
|
|
64
|
-
`);
|
|
65
|
-
|
|
66
|
-
// Resource action executed.
|
|
67
|
-
expect(result.resourceDiffs[0][0].node.synth()).toMatchInlineSnapshot(`
|
|
68
|
-
{
|
|
69
|
-
"parents": [],
|
|
70
|
-
"properties": {
|
|
71
|
-
"url": "https://dummy.com/echo/get/json",
|
|
72
|
-
},
|
|
73
|
-
"resourceId": "http-fetch-<%= name %>",
|
|
74
|
-
"response": {
|
|
75
|
-
"urlContent": {
|
|
76
|
-
"credentials": {
|
|
77
|
-
"password": "dummy",
|
|
78
|
-
"username": "dummy",
|
|
79
|
-
},
|
|
80
|
-
"data": {
|
|
81
|
-
"success": true,
|
|
82
|
-
"url": "https://dummy.com/echo/get/json",
|
|
83
|
-
},
|
|
84
|
-
},
|
|
85
|
-
},
|
|
86
|
-
"tags": {},
|
|
87
|
-
}
|
|
88
|
-
`);
|
|
89
|
-
});
|
|
90
|
-
});
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { AModule, App, Module } from '@quadnix/octo';
|
|
2
|
-
import { AppAnchor } from '../../../anchors/app/app.anchor.js';
|
|
3
|
-
import { DummyAppModuleSchema } from './index.schema.js';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* This is a dummy app module that creates a new `App` model.
|
|
7
|
-
* It also creates an anchor for the `App` model.
|
|
8
|
-
*/
|
|
9
|
-
@Module<DummyAppModule>('@<%= name %>', DummyAppModuleSchema)
|
|
10
|
-
export class DummyAppModule extends AModule<DummyAppModuleSchema, App> {
|
|
11
|
-
async onInit(inputs: DummyAppModuleSchema): Promise<App> {
|
|
12
|
-
const app = new App(inputs.name);
|
|
13
|
-
app.addAnchor(new AppAnchor('AppAnchor', { name: inputs.name }, app));
|
|
14
|
-
return app;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Schema, Validate } from '@quadnix/octo';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* This is a dummy app module schema to demonstrate how to create a custom module schema.
|
|
5
|
-
* In this case, the `name` property is required and must be at least 1 character long.
|
|
6
|
-
*/
|
|
7
|
-
export class DummyAppModuleSchema {
|
|
8
|
-
@Validate({ options: { minLength: 1 } })
|
|
9
|
-
name = Schema<string>();
|
|
10
|
-
}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Action,
|
|
3
|
-
type ActionOutputs,
|
|
4
|
-
App,
|
|
5
|
-
type Diff,
|
|
6
|
-
DiffAction,
|
|
7
|
-
type EnhancedModuleSchema,
|
|
8
|
-
Factory,
|
|
9
|
-
type IModelAction,
|
|
10
|
-
hasNodeName,
|
|
11
|
-
} from '@quadnix/octo';
|
|
12
|
-
import { HttpFetch } from '../../../../../../resources/http-fetch/index.js';
|
|
13
|
-
import type { DummyAppModule } from '../../../dummy-app.module.js';
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* This dummy app model action executes when a new `App` model is added.
|
|
17
|
-
* It adds a new `HttpFetch` resource.
|
|
18
|
-
*/
|
|
19
|
-
@Action(App)
|
|
20
|
-
export class AddDummyAppModelAction implements IModelAction<DummyAppModule> {
|
|
21
|
-
filter(diff: Diff): boolean {
|
|
22
|
-
return (
|
|
23
|
-
diff.action === DiffAction.ADD &&
|
|
24
|
-
diff.node instanceof App &&
|
|
25
|
-
hasNodeName(diff.node, 'app') &&
|
|
26
|
-
diff.field === 'name'
|
|
27
|
-
);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
async handle(
|
|
31
|
-
_diff: Diff,
|
|
32
|
-
actionInputs: EnhancedModuleSchema<DummyAppModule>,
|
|
33
|
-
actionOutputs: ActionOutputs,
|
|
34
|
-
): Promise<ActionOutputs> {
|
|
35
|
-
const { name } = actionInputs.inputs;
|
|
36
|
-
const httpFetch = new HttpFetch(
|
|
37
|
-
`http-fetch-${name}`,
|
|
38
|
-
{
|
|
39
|
-
url: 'https://dummy.com/echo/get/json',
|
|
40
|
-
},
|
|
41
|
-
[],
|
|
42
|
-
);
|
|
43
|
-
|
|
44
|
-
actionOutputs[httpFetch.resourceId] = httpFetch;
|
|
45
|
-
return actionOutputs;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
@Factory<AddDummyAppModelAction>(AddDummyAppModelAction)
|
|
50
|
-
export class AddDummyAppModelActionFactory {
|
|
51
|
-
private static instance: AddDummyAppModelAction;
|
|
52
|
-
|
|
53
|
-
static async create(): Promise<AddDummyAppModelAction> {
|
|
54
|
-
if (!this.instance) {
|
|
55
|
-
this.instance = new AddDummyAppModelAction();
|
|
56
|
-
}
|
|
57
|
-
return this.instance;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import './actions/add-dummy-app.model.action.js';
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { ANodeAction, Action, Diff, DiffAction, Factory, type IResourceAction, hasNodeName } from '@quadnix/octo';
|
|
2
|
-
import { DummyCredentials } from '../../../factories/dummy-credentials.factory.js';
|
|
3
|
-
import { DummyUtility } from '../../../utilities/dummy/dummy.utility.js';
|
|
4
|
-
import { HttpFetch } from '../http-fetch.resource.js';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* This action is executed when a new `HttpFetch` resource is added.
|
|
8
|
-
* It fetches content from a URL and sets the response.
|
|
9
|
-
*/
|
|
10
|
-
@Action(HttpFetch)
|
|
11
|
-
export class AddHttpFetchResourceAction extends ANodeAction implements IResourceAction<HttpFetch> {
|
|
12
|
-
constructor() {
|
|
13
|
-
super();
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
filter(diff: Diff): boolean {
|
|
17
|
-
return (
|
|
18
|
-
diff.action === DiffAction.ADD &&
|
|
19
|
-
diff.node instanceof HttpFetch &&
|
|
20
|
-
hasNodeName(diff.node, 'http-fetch') &&
|
|
21
|
-
diff.field === 'resourceId'
|
|
22
|
-
);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
async handle(diff: Diff<HttpFetch>): Promise<void> {
|
|
26
|
-
// Get properties.
|
|
27
|
-
const httpFetch = diff.node;
|
|
28
|
-
const properties = httpFetch.properties;
|
|
29
|
-
const response = httpFetch.response;
|
|
30
|
-
|
|
31
|
-
// Get instances.
|
|
32
|
-
const dummyCredentials = await this.container.get(DummyCredentials, { metadata: { package: '@<%= name %>' } });
|
|
33
|
-
|
|
34
|
-
// Fetch content and set response.
|
|
35
|
-
response.urlContent = await DummyUtility.httpGet(properties.url, dummyCredentials);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
async mock(_diff: Diff<HttpFetch>, capture: Partial<HttpFetch['response']>): Promise<void> {
|
|
39
|
-
DummyUtility.httpGet = async (): Promise<object> => {
|
|
40
|
-
return capture.urlContent ?? {};
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
@Factory<AddHttpFetchResourceAction>(AddHttpFetchResourceAction)
|
|
46
|
-
export class AddHttpFetchResourceActionFactory {
|
|
47
|
-
private static instance: AddHttpFetchResourceAction;
|
|
48
|
-
|
|
49
|
-
static async create(): Promise<AddHttpFetchResourceAction> {
|
|
50
|
-
if (!this.instance) {
|
|
51
|
-
this.instance = new AddHttpFetchResourceAction();
|
|
52
|
-
}
|
|
53
|
-
return this.instance;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { AResource, Resource } from '@quadnix/octo';
|
|
2
|
-
import { HttpFetchSchema } from './index.schema.js';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* This is an example resource that demonstrates how to create a custom resource.
|
|
6
|
-
*/
|
|
7
|
-
@Resource<HttpFetch>('@<%= name %>', 'http-fetch', HttpFetchSchema)
|
|
8
|
-
export class HttpFetch extends AResource<HttpFetchSchema, HttpFetch> {
|
|
9
|
-
constructor(resourceId: string, properties: HttpFetchSchema['properties'], parents: []) {
|
|
10
|
-
super(resourceId, properties, parents);
|
|
11
|
-
}
|
|
12
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { BaseResourceSchema, Schema, Validate } from '@quadnix/octo';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* This is an example resource schema to demonstrate how to create a custom resource schema.
|
|
5
|
-
* This resource is for the `HttpFetch` resource, and exposes a `url` property.
|
|
6
|
-
* Validation for the property is also included using the `@Validate` decorator.
|
|
7
|
-
* In this case, the `url` property is required and must be at least 1 character long.
|
|
8
|
-
*
|
|
9
|
-
* Once the resource is run, the resource actions will fetch the content of the URL
|
|
10
|
-
* and store it in the `urlContent` property.
|
|
11
|
-
* The content validation can be done here as well, and it automatically validates when the response is set
|
|
12
|
-
* in the resource actions.
|
|
13
|
-
*/
|
|
14
|
-
export class HttpFetchSchema extends BaseResourceSchema {
|
|
15
|
-
@Validate({
|
|
16
|
-
destruct: (value: HttpFetchSchema['properties']): string[] => [value.url],
|
|
17
|
-
options: { minLength: 1 },
|
|
18
|
-
})
|
|
19
|
-
override properties = Schema<{
|
|
20
|
-
url: string;
|
|
21
|
-
}>();
|
|
22
|
-
|
|
23
|
-
@Validate({
|
|
24
|
-
destruct: (value: HttpFetchSchema['response']): string[] => {
|
|
25
|
-
if (value.urlContent) {
|
|
26
|
-
return [JSON.stringify(value.urlContent)];
|
|
27
|
-
}
|
|
28
|
-
return [];
|
|
29
|
-
},
|
|
30
|
-
options: { minLength: 1 },
|
|
31
|
-
})
|
|
32
|
-
override response = Schema<{
|
|
33
|
-
urlContent?: object;
|
|
34
|
-
}>();
|
|
35
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This is a dummy utility exposing some dummy methods.
|
|
3
|
-
*/
|
|
4
|
-
export class DummyUtility {
|
|
5
|
-
static async httpGet(url: string, credentials: { username: string; password: string }): Promise<object> {
|
|
6
|
-
return {
|
|
7
|
-
credentials: { password: credentials.password, username: credentials.username },
|
|
8
|
-
data: { success: true, url },
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"allowSyntheticDefaultImports": true,
|
|
4
|
-
"baseUrl": "./",
|
|
5
|
-
"declaration": true,
|
|
6
|
-
"emitDecoratorMetadata": true,
|
|
7
|
-
"experimentalDecorators": true,
|
|
8
|
-
"forceConsistentCasingInFileNames": true,
|
|
9
|
-
"incremental": true,
|
|
10
|
-
"isolatedModules": true,
|
|
11
|
-
"module": "Node16",
|
|
12
|
-
"moduleResolution": "Node16",
|
|
13
|
-
"noFallthroughCasesInSwitch": true,
|
|
14
|
-
"noImplicitAny": false,
|
|
15
|
-
"noImplicitOverride": true,
|
|
16
|
-
"outDir": "./dist",
|
|
17
|
-
"removeComments": false,
|
|
18
|
-
"skipLibCheck": true,
|
|
19
|
-
"sourceMap": true,
|
|
20
|
-
"strictBindCallApply": true,
|
|
21
|
-
"strictNullChecks": true,
|
|
22
|
-
"target": "ES2022",
|
|
23
|
-
"typeRoots": [
|
|
24
|
-
"node_modules/@types"
|
|
25
|
-
],
|
|
26
|
-
"useDefineForClassFields": false,
|
|
27
|
-
"verbatimModuleSyntax": true
|
|
28
|
-
},
|
|
29
|
-
"exclude": [
|
|
30
|
-
"coverage",
|
|
31
|
-
"dist",
|
|
32
|
-
"node_modules"
|
|
33
|
-
],
|
|
34
|
-
"include": [
|
|
35
|
-
"eslint.config.js",
|
|
36
|
-
"**/*.json",
|
|
37
|
-
"**/*.ts"
|
|
38
|
-
]
|
|
39
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { createCdkCommand } from './create-cdk.command.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/create-cdk/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-resource.command.js","sourceRoot":"","sources":["../../../src/commands/create-resource/create-resource.command.ts"],"names":[],"mappings":"AAAA,OAAO,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CAAC,CAAC;QAClB,CAAC;QAED,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,sBAAsB,IAAI,mBAAmB,WAAW,MAAM,CAAC,CAAC,CAAC;QAExF,MAAM,GAAG,GAAG,SAAS,EAAE,CAAC;QACxB,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,SAAS,EAAE,0DAA0D,CAAC,EAAE;YAC3F,SAAS,EAAE,sCAAsC;SAClD,CAAC,CAAC;QAEH,IAAI,CAAC;YACH,MAAM,GAAG,CAAC,GAAG,CAAC,CAAC,sCAAsC,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,CAAC,EAAE;gBAC/E,SAAS,EAAE,IAAI;gBACf,WAAW,EAAE,IAAI;aAClB,CAAC,CAAC;YAEH,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,gCAAgC,CAAC,CAAC,CAAC;QAC7D,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,8BAA8B,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;YACxE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC;CACF,CAAC"}
|
package/dist/commands/create-resource/generator-octo-resource-template/generators/app/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/commands/create-resource/generator-octo-resource-template/generators/app/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAE5C,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,SAAS,EAAE,EAAoB,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,mDAAmD,CAAC;AAElF,MAAM,CAAC,OAAO,MAAO,SAAQ,SAAS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CAAC,EAAE,CAAC,OAAO,CACb,IAAI,CAAC,YAAY,CAAC,+DAA+D,CAAC,EAClF,IAAI,CAAC,eAAe,CAAC,SAAS,EAAE,UAAU,IAAI,CAAC,YAAY,0BAA0B,CAAC,EACtF;YACE,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,kBAAkB,EAAE,aAAa,CAAC,YAAY,CAAC,IAAI,CAAC,YAAY,CAAC;SAClE,CACF,CAAC;QAEF,IAAI,CAAC,EAAE,CAAC,OAAO,CACb,IAAI,CAAC,YAAY,CAAC,4DAA4D,CAAC,EAC/E,IAAI,CAAC,eAAe,CAAC,SAAS,EAAE,YAAY,IAAI,CAAC,YAAY,qBAAqB,CAAC,EACnF;YACE,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,kBAAkB,EAAE,aAAa,CAAC,YAAY,CAAC,IAAI,CAAC,YAAY,CAAC;SAClE,CACF,CAAC;IACJ,CAAC;IAED,GAAG;QACD,MAAM,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,KAAK,EAAE,WAAW,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC;QAEzF,IAAI,CAAC,GAAG,CAAC,kDAAkD,CAAC,CAAC;QAC7D,IAAI,CAAC,GAAG,CAAC,2BAA2B,UAAU,EAAE,CAAC,CAAC;QAClD,IAAI,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;QAC3B,IAAI,CAAC,GAAG,CAAC,4CAA4C,CAAC,CAAC;IACzD,CAAC;CACF"}
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ANodeAction,
|
|
3
|
-
Action,
|
|
4
|
-
type Diff,
|
|
5
|
-
DiffAction,
|
|
6
|
-
type DiffValueTypeTagUpdate,
|
|
7
|
-
Factory,
|
|
8
|
-
type IResourceAction,
|
|
9
|
-
hasNodeName,
|
|
10
|
-
} from '@quadnix/octo';
|
|
11
|
-
import { <%= resourceNamePascal %> } from '../<%= resourceName %>.resource.js';
|
|
12
|
-
|
|
13
|
-
@Action(<%= resourceNamePascal %>)
|
|
14
|
-
export class Update<%= resourceNamePascal %>TagsResourceAction extends ANodeAction implements IResourceAction<<%= resourceNamePascal %>> {
|
|
15
|
-
constructor() {
|
|
16
|
-
super();
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
filter(diff: Diff): boolean {
|
|
20
|
-
return (
|
|
21
|
-
diff.action === DiffAction.UPDATE &&
|
|
22
|
-
diff.node instanceof <%= resourceNamePascal %> &&
|
|
23
|
-
hasNodeName(diff.node, '<%= resourceName %>') &&
|
|
24
|
-
diff.field === 'tags'
|
|
25
|
-
);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
async handle(diff: Diff<<%= resourceNamePascal %>, DiffValueTypeTagUpdate>): Promise<void> {
|
|
29
|
-
// Get properties.
|
|
30
|
-
const <%= resourceName %> = diff.node;
|
|
31
|
-
const properties = <%= resourceName %>.properties;
|
|
32
|
-
const response = <%= resourceName %>.response;
|
|
33
|
-
const tagUpdates = diff.value;
|
|
34
|
-
|
|
35
|
-
// Fix me: Implement the update-tag resource logic.
|
|
36
|
-
// This is where you would update tags of the actual resource.
|
|
37
|
-
// E.g.,
|
|
38
|
-
/*
|
|
39
|
-
// Get instances.
|
|
40
|
-
const ec2Client = await this.container.get<EC2Client, typeof EC2ClientFactory>(EC2Client, {
|
|
41
|
-
args: [properties.awsAccountId, properties.awsRegionId],
|
|
42
|
-
metadata: { package: '@example' },
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
// Delete tags.
|
|
46
|
-
if (tagUpdates.delete.length > 0) {
|
|
47
|
-
await ec2Client.send(
|
|
48
|
-
new DeleteTagsCommand({
|
|
49
|
-
Resources: [response.ResourceId!],
|
|
50
|
-
Tags: tagUpdates.delete.map((tag) => ({ Key: tag })),
|
|
51
|
-
}),
|
|
52
|
-
);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
// Add/Update tags.
|
|
56
|
-
if (Object.keys(tagUpdates.add).length > 0 || Object.keys(tagUpdates.update).length > 0) {
|
|
57
|
-
await ec2Client.send(
|
|
58
|
-
new CreateTagsCommand({
|
|
59
|
-
Resources: [response.ResourceId!],
|
|
60
|
-
Tags: Object.entries({ ...tagUpdates.add, ...tagUpdates.update }).map(([key, value]) => ({
|
|
61
|
-
Key: key,
|
|
62
|
-
Value: value,
|
|
63
|
-
})),
|
|
64
|
-
}),
|
|
65
|
-
);
|
|
66
|
-
}
|
|
67
|
-
*/
|
|
68
|
-
|
|
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.
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
@Factory<Update<%= resourceNamePascal %>TagsResourceAction>(Update<%= resourceNamePascal %>TagsResourceAction)
|
|
77
|
-
export class Update<%= resourceNamePascal %>TagsResourceActionFactory {
|
|
78
|
-
private static instance: Update<%= resourceNamePascal %>TagsResourceAction;
|
|
79
|
-
|
|
80
|
-
static async create(): Promise<Update<%= resourceNamePascal %>TagsResourceAction> {
|
|
81
|
-
if (!this.instance) {
|
|
82
|
-
this.instance = new Update<%= resourceNamePascal %>TagsResourceAction();
|
|
83
|
-
}
|
|
84
|
-
return this.instance;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { ANodeAction, Action, type Diff, DiffAction, Factory, type IResourceAction, hasNodeName } from '@quadnix/octo';
|
|
2
|
-
import { <%= resourceNamePascal %> } from '../<%= resourceName %>.resource.js';
|
|
3
|
-
|
|
4
|
-
@Action(<%= resourceNamePascal %>)
|
|
5
|
-
export class Validate<%= resourceNamePascal %>ResourceAction extends ANodeAction implements IResourceAction<<%= resourceNamePascal %>> {
|
|
6
|
-
constructor() {
|
|
7
|
-
super();
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
filter(diff: Diff): boolean {
|
|
11
|
-
return (
|
|
12
|
-
diff.action === DiffAction.VALIDATE &&
|
|
13
|
-
diff.node instanceof <%= resourceNamePascal %> &&
|
|
14
|
-
hasNodeName(diff.node, '<%= resourceName %>') &&
|
|
15
|
-
diff.field === 'resourceId'
|
|
16
|
-
);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
async handle(diff: Diff<<%= resourceNamePascal %>>): Promise<void> {
|
|
20
|
-
// Get properties.
|
|
21
|
-
const <%= resourceName %> = diff.node;
|
|
22
|
-
const properties = <%= resourceName %>.properties;
|
|
23
|
-
const response = <%= resourceName %>.response;
|
|
24
|
-
|
|
25
|
-
// Fix me: Implement the resource validation logic.
|
|
26
|
-
// This is where you would validate the actual resource and its properties.
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
@Factory<Validate<%= resourceNamePascal %>ResourceAction>(Validate<%= resourceNamePascal %>ResourceAction)
|
|
31
|
-
export class Validate<%= resourceNamePascal %>ResourceActionFactory {
|
|
32
|
-
private static instance: Validate<%= resourceNamePascal %>ResourceAction;
|
|
33
|
-
|
|
34
|
-
static async create(): Promise<Validate<%= resourceNamePascal %>ResourceAction> {
|
|
35
|
-
if (!this.instance) {
|
|
36
|
-
this.instance = new Validate<%= resourceNamePascal %>ResourceAction();
|
|
37
|
-
}
|
|
38
|
-
return this.instance;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { AResource, Resource } from '@quadnix/octo';
|
|
2
|
-
import { <%= resourceNamePascal %>Schema } from './index.schema.js';
|
|
3
|
-
|
|
4
|
-
@Resource<<%= resourceNamePascal %>>('<%= packageName %>', '<%= resourceName %>', <%= resourceNamePascal %>Schema)
|
|
5
|
-
export class <%= resourceNamePascal %> extends AResource<<%= resourceNamePascal %>Schema, <%= resourceNamePascal %>> {
|
|
6
|
-
declare properties: <%= resourceNamePascal %>Schema['properties'];
|
|
7
|
-
declare response: <%= resourceNamePascal %>Schema['response'];
|
|
8
|
-
|
|
9
|
-
constructor(resourceId: string, properties: <%= resourceNamePascal %>Schema['properties'], parents: []) {
|
|
10
|
-
super(resourceId, properties, parents);
|
|
11
|
-
}
|
|
12
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { createResourceCommand } from './create-resource.command.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/create-resource/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { runCommand } from './run.command.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/run/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
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 {};
|