@goldstack/template-dynamodb-cli 0.4.13 → 0.5.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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { InputMigrations } from 'umzug/lib/types';
|
|
2
|
-
import { DynamoDBContext } from '@goldstack/template-dynamodb';
|
|
3
|
-
export declare const dynamoDBCli: (migrations: InputMigrations<DynamoDBContext>, args: string[]) => Promise<void>;
|
|
1
|
+
import { InputMigrations } from 'umzug/lib/types';
|
|
2
|
+
import { DynamoDBContext } from '@goldstack/template-dynamodb';
|
|
3
|
+
export declare const dynamoDBCli: (migrations: InputMigrations<DynamoDBContext>, args: string[]) => Promise<void>;
|
|
4
4
|
//# sourceMappingURL=dynamoDBTableCli.d.ts.map
|
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.dynamoDBCli = void 0;
|
|
4
|
-
const utils_sh_1 = require("@goldstack/utils-sh");
|
|
5
|
-
const template_dynamodb_1 = require("@goldstack/template-dynamodb");
|
|
6
|
-
const dynamoDBCli = async (migrations, args) => {
|
|
7
|
-
const goldstackConfig = JSON.parse((0, utils_sh_1.read)(`${process.cwd()}/goldstack.json`));
|
|
8
|
-
const packageSchema = JSON.parse((0, utils_sh_1.read)(`${process.cwd()}/schemas/package.schema.json`));
|
|
9
|
-
if (args[0] === 'init') {
|
|
10
|
-
await (0, template_dynamodb_1.connect)({
|
|
11
|
-
goldstackConfig,
|
|
12
|
-
packageSchema,
|
|
13
|
-
migrations,
|
|
14
|
-
deploymentName: args[1],
|
|
15
|
-
});
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
if (args[0] === 'delete') {
|
|
19
|
-
await (0, template_dynamodb_1.deleteTable)({
|
|
20
|
-
goldstackConfig,
|
|
21
|
-
packageSchema,
|
|
22
|
-
deploymentName: args[1],
|
|
23
|
-
});
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
if (args[0] === 'migrate-to') {
|
|
27
|
-
await (0, template_dynamodb_1.migrateDownTo)({
|
|
28
|
-
goldstackConfig,
|
|
29
|
-
packageSchema,
|
|
30
|
-
migrations,
|
|
31
|
-
migrationName: args[2],
|
|
32
|
-
deploymentName: args[1],
|
|
33
|
-
});
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
throw new Error(`Unknown DynamoDB table command: ${args[0]}`);
|
|
37
|
-
};
|
|
38
|
-
exports.dynamoDBCli = dynamoDBCli;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.dynamoDBCli = void 0;
|
|
4
|
+
const utils_sh_1 = require("@goldstack/utils-sh");
|
|
5
|
+
const template_dynamodb_1 = require("@goldstack/template-dynamodb");
|
|
6
|
+
const dynamoDBCli = async (migrations, args) => {
|
|
7
|
+
const goldstackConfig = JSON.parse((0, utils_sh_1.read)(`${process.cwd()}/goldstack.json`));
|
|
8
|
+
const packageSchema = JSON.parse((0, utils_sh_1.read)(`${process.cwd()}/schemas/package.schema.json`));
|
|
9
|
+
if (args[0] === 'init') {
|
|
10
|
+
await (0, template_dynamodb_1.connect)({
|
|
11
|
+
goldstackConfig,
|
|
12
|
+
packageSchema,
|
|
13
|
+
migrations,
|
|
14
|
+
deploymentName: args[1],
|
|
15
|
+
});
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
if (args[0] === 'delete') {
|
|
19
|
+
await (0, template_dynamodb_1.deleteTable)({
|
|
20
|
+
goldstackConfig,
|
|
21
|
+
packageSchema,
|
|
22
|
+
deploymentName: args[1],
|
|
23
|
+
});
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
if (args[0] === 'migrate-to') {
|
|
27
|
+
await (0, template_dynamodb_1.migrateDownTo)({
|
|
28
|
+
goldstackConfig,
|
|
29
|
+
packageSchema,
|
|
30
|
+
migrations,
|
|
31
|
+
migrationName: args[2],
|
|
32
|
+
deploymentName: args[1],
|
|
33
|
+
});
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
throw new Error(`Unknown DynamoDB table command: ${args[0]}`);
|
|
37
|
+
};
|
|
38
|
+
exports.dynamoDBCli = dynamoDBCli;
|
|
39
39
|
//# sourceMappingURL=dynamoDBTableCli.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { InputMigrations } from 'umzug/lib/types';
|
|
2
|
-
import { DynamoDBContext } from '@goldstack/template-dynamodb';
|
|
3
|
-
export declare const run: ({ args, migrations, }: {
|
|
4
|
-
args: string[];
|
|
5
|
-
migrations: InputMigrations<DynamoDBContext>;
|
|
6
|
-
}) => Promise<void>;
|
|
1
|
+
import { InputMigrations } from 'umzug/lib/types';
|
|
2
|
+
import { DynamoDBContext } from '@goldstack/template-dynamodb';
|
|
3
|
+
export declare const run: ({ args, migrations, }: {
|
|
4
|
+
args: string[];
|
|
5
|
+
migrations: InputMigrations<DynamoDBContext>;
|
|
6
|
+
}) => Promise<void>;
|
|
7
7
|
//# sourceMappingURL=templateDynamoDBCli.d.ts.map
|
|
@@ -1,69 +1,69 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.run = void 0;
|
|
7
|
-
const utils_package_1 = require("@goldstack/utils-package");
|
|
8
|
-
const utils_cli_1 = require("@goldstack/utils-cli");
|
|
9
|
-
const utils_terraform_1 = require("@goldstack/utils-terraform");
|
|
10
|
-
const utils_terraform_aws_1 = require("@goldstack/utils-terraform-aws");
|
|
11
|
-
const utils_package_config_1 = require("@goldstack/utils-package-config");
|
|
12
|
-
const yargs_1 = __importDefault(require("yargs"));
|
|
13
|
-
const assert_1 = __importDefault(require("assert"));
|
|
14
|
-
const dynamoDBTableCli_1 = require("./dynamoDBTableCli");
|
|
15
|
-
const run = async ({ args, migrations, }) => {
|
|
16
|
-
await (0, utils_cli_1.wrapCli)(async () => {
|
|
17
|
-
const deploymentPositional = (yargs) => {
|
|
18
|
-
return yargs.positional('deployment', {
|
|
19
|
-
type: 'string',
|
|
20
|
-
describe: 'Name of the deployment of the table',
|
|
21
|
-
demandOption: true,
|
|
22
|
-
});
|
|
23
|
-
};
|
|
24
|
-
const argv = await (0, utils_package_1.buildCli)({
|
|
25
|
-
yargs: yargs_1.default,
|
|
26
|
-
deployCommands: (0, utils_package_1.buildDeployCommands)(),
|
|
27
|
-
infraCommands: (0, utils_terraform_1.infraCommands)(),
|
|
28
|
-
})
|
|
29
|
-
.usage('$0 <table>')
|
|
30
|
-
.command('table <init|delete|migrate-to> <deployment>', 'Utility commands for DynamoDB table', (yargs) => {
|
|
31
|
-
yargs
|
|
32
|
-
.command('init', 'Initialise DynamoDB table and run all applicable migrations', deploymentPositional)
|
|
33
|
-
.command('delete', 'Deletes DynamoDB table and all its data', deploymentPositional)
|
|
34
|
-
.command('migrate-to', 'Migrate DynamoDB table', (yargs) => deploymentPositional(yargs).positional('migration-name', {
|
|
35
|
-
type: 'string',
|
|
36
|
-
describe: 'The name of the migration that the table should be migrated to.',
|
|
37
|
-
demandOption: true,
|
|
38
|
-
}));
|
|
39
|
-
})
|
|
40
|
-
.help()
|
|
41
|
-
.parse();
|
|
42
|
-
const packageConfig = new utils_package_config_1.PackageConfig({
|
|
43
|
-
packagePath: './',
|
|
44
|
-
});
|
|
45
|
-
const config = packageConfig.getConfig();
|
|
46
|
-
(0, assert_1.default)(config, 'DynamoDB package config could not be loaded.');
|
|
47
|
-
const command = argv._[0];
|
|
48
|
-
const [, , , ...opArgs] = args;
|
|
49
|
-
if (command === 'infra') {
|
|
50
|
-
await (0, dynamoDBTableCli_1.dynamoDBCli)(migrations, ['init', opArgs[1]]);
|
|
51
|
-
await (0, utils_terraform_aws_1.terraformAwsCli)(opArgs);
|
|
52
|
-
if (opArgs[0] === 'destroy') {
|
|
53
|
-
await (0, dynamoDBTableCli_1.dynamoDBCli)(migrations, ['delete', opArgs[1]]);
|
|
54
|
-
}
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
if (command === 'deploy') {
|
|
58
|
-
await (0, dynamoDBTableCli_1.dynamoDBCli)(migrations, ['init', opArgs[0]]);
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
if (command === 'table') {
|
|
62
|
-
await (0, dynamoDBTableCli_1.dynamoDBCli)(migrations, opArgs);
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
throw new Error('Unknown command: ' + command);
|
|
66
|
-
});
|
|
67
|
-
};
|
|
68
|
-
exports.run = run;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.run = void 0;
|
|
7
|
+
const utils_package_1 = require("@goldstack/utils-package");
|
|
8
|
+
const utils_cli_1 = require("@goldstack/utils-cli");
|
|
9
|
+
const utils_terraform_1 = require("@goldstack/utils-terraform");
|
|
10
|
+
const utils_terraform_aws_1 = require("@goldstack/utils-terraform-aws");
|
|
11
|
+
const utils_package_config_1 = require("@goldstack/utils-package-config");
|
|
12
|
+
const yargs_1 = __importDefault(require("yargs"));
|
|
13
|
+
const assert_1 = __importDefault(require("assert"));
|
|
14
|
+
const dynamoDBTableCli_1 = require("./dynamoDBTableCli");
|
|
15
|
+
const run = async ({ args, migrations, }) => {
|
|
16
|
+
await (0, utils_cli_1.wrapCli)(async () => {
|
|
17
|
+
const deploymentPositional = (yargs) => {
|
|
18
|
+
return yargs.positional('deployment', {
|
|
19
|
+
type: 'string',
|
|
20
|
+
describe: 'Name of the deployment of the table',
|
|
21
|
+
demandOption: true,
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
const argv = await (0, utils_package_1.buildCli)({
|
|
25
|
+
yargs: yargs_1.default,
|
|
26
|
+
deployCommands: (0, utils_package_1.buildDeployCommands)(),
|
|
27
|
+
infraCommands: (0, utils_terraform_1.infraCommands)(),
|
|
28
|
+
})
|
|
29
|
+
.usage('$0 <table>')
|
|
30
|
+
.command('table <init|delete|migrate-to> <deployment>', 'Utility commands for DynamoDB table', (yargs) => {
|
|
31
|
+
yargs
|
|
32
|
+
.command('init', 'Initialise DynamoDB table and run all applicable migrations', deploymentPositional)
|
|
33
|
+
.command('delete', 'Deletes DynamoDB table and all its data', deploymentPositional)
|
|
34
|
+
.command('migrate-to', 'Migrate DynamoDB table', (yargs) => deploymentPositional(yargs).positional('migration-name', {
|
|
35
|
+
type: 'string',
|
|
36
|
+
describe: 'The name of the migration that the table should be migrated to.',
|
|
37
|
+
demandOption: true,
|
|
38
|
+
}));
|
|
39
|
+
})
|
|
40
|
+
.help()
|
|
41
|
+
.parse();
|
|
42
|
+
const packageConfig = new utils_package_config_1.PackageConfig({
|
|
43
|
+
packagePath: './',
|
|
44
|
+
});
|
|
45
|
+
const config = packageConfig.getConfig();
|
|
46
|
+
(0, assert_1.default)(config, 'DynamoDB package config could not be loaded.');
|
|
47
|
+
const command = argv._[0];
|
|
48
|
+
const [, , , ...opArgs] = args;
|
|
49
|
+
if (command === 'infra') {
|
|
50
|
+
await (0, dynamoDBTableCli_1.dynamoDBCli)(migrations, ['init', opArgs[1]]);
|
|
51
|
+
await (0, utils_terraform_aws_1.terraformAwsCli)(opArgs);
|
|
52
|
+
if (opArgs[0] === 'destroy') {
|
|
53
|
+
await (0, dynamoDBTableCli_1.dynamoDBCli)(migrations, ['delete', opArgs[1]]);
|
|
54
|
+
}
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
if (command === 'deploy') {
|
|
58
|
+
await (0, dynamoDBTableCli_1.dynamoDBCli)(migrations, ['init', opArgs[0]]);
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
if (command === 'table') {
|
|
62
|
+
await (0, dynamoDBTableCli_1.dynamoDBCli)(migrations, opArgs);
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
throw new Error('Unknown command: ' + command);
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
exports.run = run;
|
|
69
69
|
//# sourceMappingURL=templateDynamoDBCli.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@goldstack/template-dynamodb-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Utilities for building modules for DynamoDB access.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"goldstack",
|
|
@@ -42,21 +42,21 @@
|
|
|
42
42
|
"version:apply:force": "yarn version $@ && yarn version apply"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@goldstack/template-dynamodb": "0.
|
|
46
|
-
"@goldstack/utils-cli": "0.
|
|
47
|
-
"@goldstack/utils-package": "0.
|
|
48
|
-
"@goldstack/utils-package-config": "0.
|
|
49
|
-
"@goldstack/utils-sh": "0.
|
|
50
|
-
"@goldstack/utils-terraform": "0.
|
|
51
|
-
"@goldstack/utils-terraform-aws": "0.
|
|
45
|
+
"@goldstack/template-dynamodb": "0.2.0",
|
|
46
|
+
"@goldstack/utils-cli": "0.3.0",
|
|
47
|
+
"@goldstack/utils-package": "0.4.0",
|
|
48
|
+
"@goldstack/utils-package-config": "0.4.0",
|
|
49
|
+
"@goldstack/utils-sh": "0.5.0",
|
|
50
|
+
"@goldstack/utils-terraform": "0.4.0",
|
|
51
|
+
"@goldstack/utils-terraform-aws": "0.4.0",
|
|
52
52
|
"source-map-support": "^0.5.21",
|
|
53
53
|
"umzug": "^3.1.1",
|
|
54
54
|
"yargs": "^17.5.1"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@goldstack/utils-docs-cli": "0.3.11",
|
|
58
|
-
"@goldstack/utils-git": "0.
|
|
59
|
-
"@goldstack/utils-package-config-generate": "0.
|
|
58
|
+
"@goldstack/utils-git": "0.2.0",
|
|
59
|
+
"@goldstack/utils-package-config-generate": "0.3.0",
|
|
60
60
|
"@types/jest": "^28.1.8",
|
|
61
61
|
"@types/node": "^18.7.13",
|
|
62
62
|
"@types/yargs": "^17.0.10",
|