@adinsure-ops/ops-cli 5.1.3 → 5.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/lib/commands/sql.d.ts +2 -1
- package/lib/commands/sql.js +35 -28
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
- package/CHANGELOGS.md +0 -202
package/lib/commands/sql.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ export default class Sql extends CommandBase<typeof Sql> {
|
|
|
20
20
|
'column-type': import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
21
21
|
};
|
|
22
22
|
private readonly _moduleTypes;
|
|
23
|
-
private
|
|
23
|
+
private _dbmsTypes;
|
|
24
24
|
/**
|
|
25
25
|
* Get unique Script ID zip by specified version
|
|
26
26
|
* @param {string} version The version of Identity Server
|
|
@@ -37,6 +37,7 @@ export default class Sql extends CommandBase<typeof Sql> {
|
|
|
37
37
|
handleLayer(scriptDbmsFolder: string, scriptLayer: string, scriptType: string, dbmsFormat: string): Promise<string>;
|
|
38
38
|
sqlExtendScriptGeneration(tableSchema: string | undefined, tableName: string | undefined, columnName: string | undefined, columnType: string | undefined): Promise<string>;
|
|
39
39
|
oradcExtendScriptGeneration(tableSchema: string | undefined, tableName: string | undefined, columnName: string | undefined, columnType: string | undefined): Promise<string>;
|
|
40
|
+
postgresExtendScriptGeneration(tableSchema: string | undefined, tableName: string | undefined, columnName: string | undefined, columnType: string | undefined): Promise<string>;
|
|
40
41
|
checkExtendParameters(): Promise<string[]>;
|
|
41
42
|
run(): Promise<void>;
|
|
42
43
|
}
|
package/lib/commands/sql.js
CHANGED
|
@@ -21,7 +21,23 @@ class Sql extends CommandBase {
|
|
|
21
21
|
reins: 'Reinsurance',
|
|
22
22
|
shared: 'Shared',
|
|
23
23
|
};
|
|
24
|
-
this.
|
|
24
|
+
this._dbmsTypes = [
|
|
25
|
+
{
|
|
26
|
+
name: 'sql',
|
|
27
|
+
scriptLocation: undefined,
|
|
28
|
+
extendGenerator: this.sqlExtendScriptGeneration
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
name: 'oradc',
|
|
32
|
+
scriptLocation: undefined,
|
|
33
|
+
extendGenerator: this.oradcExtendScriptGeneration
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
name: 'postgres',
|
|
37
|
+
scriptLocation: undefined,
|
|
38
|
+
extendGenerator: this.postgresExtendScriptGeneration
|
|
39
|
+
}
|
|
40
|
+
];
|
|
25
41
|
}
|
|
26
42
|
/**
|
|
27
43
|
* Get unique Script ID zip by specified version
|
|
@@ -122,12 +138,19 @@ BEGIN
|
|
|
122
138
|
end;`;
|
|
123
139
|
});
|
|
124
140
|
}
|
|
141
|
+
postgresExtendScriptGeneration(tableSchema, tableName, columnName, columnType) {
|
|
142
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
143
|
+
return `ALTER TABLE IF EXISTS ${tableSchema}.${tableName}
|
|
144
|
+
ADD COLUMN IF NOT EXISTS ${columnName} ${columnType};
|
|
145
|
+
`;
|
|
146
|
+
});
|
|
147
|
+
}
|
|
125
148
|
checkExtendParameters() {
|
|
126
149
|
return __awaiter(this, void 0, void 0, function* () {
|
|
127
150
|
const { flags } = yield this.parse(Sql);
|
|
128
151
|
const arrayOfParameters = [];
|
|
129
152
|
if (flags['table-schema'] === undefined) {
|
|
130
|
-
arrayOfParameters.push('table-
|
|
153
|
+
arrayOfParameters.push('table-schema');
|
|
131
154
|
}
|
|
132
155
|
if (flags['table-name'] === undefined) {
|
|
133
156
|
arrayOfParameters.push('table-name');
|
|
@@ -218,13 +241,12 @@ end;`;
|
|
|
218
241
|
if (!(yield fs.pathExists(scriptsRootFolder))) {
|
|
219
242
|
this.error(`Could not resolve database scripts folder: ${scriptsRootFolder}`);
|
|
220
243
|
}
|
|
221
|
-
const
|
|
222
|
-
|
|
223
|
-
const scriptDbmsFolder = path.resolve(scriptsRootFolder, dbmsFormat);
|
|
244
|
+
for (const dbmsFormat of this._dbmsTypes) {
|
|
245
|
+
const scriptDbmsFolder = path.resolve(scriptsRootFolder, dbmsFormat.name);
|
|
224
246
|
if (yield fs.pathExists(scriptDbmsFolder)) {
|
|
225
247
|
let scriptFolder = path.resolve(scriptDbmsFolder, scriptType);
|
|
226
248
|
if (scriptLayer !== undefined) {
|
|
227
|
-
scriptFolder = yield this.handleLayer(scriptDbmsFolder, scriptLayer, scriptType, dbmsFormat);
|
|
249
|
+
scriptFolder = yield this.handleLayer(scriptDbmsFolder, scriptLayer, scriptType, dbmsFormat.name);
|
|
228
250
|
}
|
|
229
251
|
if (scriptModule !== undefined) {
|
|
230
252
|
scriptFolder = path.resolve(scriptFolder, this._moduleTypes[scriptModule]);
|
|
@@ -233,7 +255,7 @@ end;`;
|
|
|
233
255
|
this.warn(`Could not resolve existing database scripts folder. Creating folder: ${scriptFolder}`);
|
|
234
256
|
yield fs.mkdir(scriptFolder);
|
|
235
257
|
}
|
|
236
|
-
|
|
258
|
+
dbmsFormat.scriptLocation = scriptFolder;
|
|
237
259
|
}
|
|
238
260
|
}
|
|
239
261
|
// Validation of parameters succeed. Requesting new SQL script ID and creating file.
|
|
@@ -247,27 +269,12 @@ end;`;
|
|
|
247
269
|
scriptId = (yield this.getScriptId(version.version)).data;
|
|
248
270
|
this.log(`Got: '${chalk.green(scriptId)}'`);
|
|
249
271
|
}
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
const scriptsFilePath = path.resolve(scriptFolder, `${scriptId}.sql`);
|
|
257
|
-
// The values in flags such as table-schema, which are passed into the sql generation function can never be undefined as they
|
|
258
|
-
// are checked prior to executing this code, so the functions are defined in a way where they can intake an undefined parameter
|
|
259
|
-
// only due to typescript.
|
|
260
|
-
yield (sqlOrOradc ? fs.writeFile(scriptsFilePath, yield this.oradcExtendScriptGeneration(flags['table-schema'], flags['table-name'], flags['column-name'], flags['column-type'])) : fs.writeFile(scriptsFilePath, yield this.sqlExtendScriptGeneration(flags['table-schema'], flags['table-name'], flags['column-name'], flags['column-type'])));
|
|
261
|
-
this.log(`${chalk.yellow(scriptsFilePath)}`);
|
|
262
|
-
sqlOrOradc++;
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
else {
|
|
266
|
-
for (const scriptFolder of scriptFolderLocations) {
|
|
267
|
-
const scriptsFilePath = path.resolve(scriptFolder, `${scriptId}.sql`);
|
|
268
|
-
yield fs.writeFile(scriptsFilePath, '');
|
|
269
|
-
this.log(`${chalk.yellow(scriptsFilePath)}`);
|
|
270
|
-
}
|
|
272
|
+
const usedDbmsTypes = this._dbmsTypes.filter(it => it.scriptLocation !== undefined);
|
|
273
|
+
for (const usedDbmsType of usedDbmsTypes) {
|
|
274
|
+
const scriptsFilePath = path.resolve(usedDbmsType.scriptLocation, `${scriptId}.sql`);
|
|
275
|
+
const content = scriptType === 'Extend' ? yield usedDbmsType.extendGenerator(flags['table-schema'], flags['table-name'], flags['column-name'], flags['column-type']) : '';
|
|
276
|
+
yield fs.writeFile(scriptsFilePath, content);
|
|
277
|
+
this.log(`${chalk.yellow(scriptsFilePath)}`);
|
|
271
278
|
}
|
|
272
279
|
});
|
|
273
280
|
}
|
package/oclif.manifest.json
CHANGED
package/package.json
CHANGED
package/CHANGELOGS.md
DELETED
|
@@ -1,202 +0,0 @@
|
|
|
1
|
-
# Changelogs
|
|
2
|
-
|
|
3
|
-
## 5.1.3: 2024-07-19
|
|
4
|
-
|
|
5
|
-
- LJADIRD-46495: make the `ops npm:dependency-update` command process `package.json` files in hidden (sub)directories, too.
|
|
6
|
-
|
|
7
|
-
## 5.1.2: 2024-07-04
|
|
8
|
-
|
|
9
|
-
- LJADIRD-43932: updated all core (oclif) and non-core dependencies
|
|
10
|
-
- LJADIRDSUP-15178: added acquiring token by refreshToken functionality into security context
|
|
11
|
-
- LJADIRD-47453: updated create-nightly-tag regex to match correct versions and create new tag
|
|
12
|
-
|
|
13
|
-
## 5.1.1: 2024-05-13
|
|
14
|
-
|
|
15
|
-
- LJADIRD-46524: added more verbose output to the security context when aquiring token
|
|
16
|
-
|
|
17
|
-
## 5.1.0: 2024-03-29
|
|
18
|
-
|
|
19
|
-
- LJADIRDSUP-13830: added verbose error output when downloading studio and installing the plugin into the VSCode
|
|
20
|
-
- LJADIRD-45744: removed Node.js v16 support, only supporting Node.js >=18
|
|
21
|
-
|
|
22
|
-
## 5.0.11: 2024-03-26
|
|
23
|
-
|
|
24
|
-
- LJADIRD-45711: updated regex for matching tags in the gitlab:next-nightly-tag command
|
|
25
|
-
|
|
26
|
-
## 5.0.10: 2024-03-20
|
|
27
|
-
|
|
28
|
-
- LJADIRDSUP-13469: added gurads for checking if the npmrc file being read is a directory
|
|
29
|
-
|
|
30
|
-
## 5.0.9: 2024-01-03
|
|
31
|
-
|
|
32
|
-
- ops-cli sql command is now case insensitive
|
|
33
|
-
- LJADIRDSUP-12244: axios already returns json and doesn't need to be parsed again
|
|
34
|
-
|
|
35
|
-
## 5.0.8: 2023-12-22
|
|
36
|
-
|
|
37
|
-
- gitlab:get-nightly-tag command request is fixed since the parameters in the HTTP header were misconfigured
|
|
38
|
-
|
|
39
|
-
## 5.0.7: 2023-12-18
|
|
40
|
-
|
|
41
|
-
- Sql command can now accept aruguments in lowercase as well as with a capital first letter
|
|
42
|
-
- Bugfix: sql path will now stop capitalizing the extend, migration, data and schema directory
|
|
43
|
-
|
|
44
|
-
## 5.0.6: 2023-12-14
|
|
45
|
-
|
|
46
|
-
- Node 16 support added
|
|
47
|
-
|
|
48
|
-
## 5.0.5: 2023-11-20
|
|
49
|
-
|
|
50
|
-
- Fixed the ops-cli releasing cycle as a few minor releases were not uploaded to npm.js
|
|
51
|
-
|
|
52
|
-
## 5.0.4: 2023-09-27
|
|
53
|
-
|
|
54
|
-
- Fixed version command's post request, where the headers were actually stored in the body
|
|
55
|
-
|
|
56
|
-
## 5.0.3: 2023-09-25
|
|
57
|
-
|
|
58
|
-
- Updated node engine support to also include 20.x and deprecated the use of 14.x
|
|
59
|
-
|
|
60
|
-
## 5.0.2: 2023-09-14
|
|
61
|
-
|
|
62
|
-
- Fixed download commands and their output flag
|
|
63
|
-
- Fixed translate command to have correct url in the get request
|
|
64
|
-
|
|
65
|
-
## 5.0.1: 2023-09-12
|
|
66
|
-
|
|
67
|
-
- Updated ops-cli to the stable version 5.x
|
|
68
|
-
- Prepare-content command is back! But with a differenct syntax than before, so check the README
|
|
69
|
-
- Faster performance and updated dependencies
|
|
70
|
-
|
|
71
|
-
## 5.0.0: 2023-09-08
|
|
72
|
-
|
|
73
|
-
- Added --description flag to the log command. It accepts the description of the changelog which will be used
|
|
74
|
-
- Added --force flag to the log command. It creates folder structure if missing
|
|
75
|
-
- Added --keep flag to the download:studio command
|
|
76
|
-
- Bugfixes
|
|
77
|
-
- Security patching: the project was migrated to a new oclif framework from the old one
|
|
78
|
-
- Performace tuning
|
|
79
|
-
- [DEPRECATED] Deprecation and removal of the prepare-content command
|
|
80
|
-
- [REMOVED] `--servicePrincipal` login is no longer available or required. 'AZURE_CLIENT_ID' and 'AZURE_CLIENT_SECRET' environment variables are required with every command in order to use service principal.
|
|
81
|
-
|
|
82
|
-
## 4.8.3: 2023-08-22
|
|
83
|
-
|
|
84
|
-
- Bugfixes; sql command was fixed so that even when Extend was not used it required its parameters
|
|
85
|
-
- Security patches in library dependencies
|
|
86
|
-
|
|
87
|
-
## 4.8.2: 2023-07-28
|
|
88
|
-
|
|
89
|
-
- Sql command can now generate a template for mssql and oracle, for extending an sql table with a column
|
|
90
|
-
|
|
91
|
-
## 4.8.1: 2023-06-01
|
|
92
|
-
|
|
93
|
-
- Added --force option to login command, to forcefully replace the old auth token
|
|
94
|
-
- Added --retry option to publush command, to retry publishing a package multiple times in case of 4xx or 5xx http errors
|
|
95
|
-
|
|
96
|
-
## 4.8.0: 2023-05-01
|
|
97
|
-
|
|
98
|
-
- VERSION files now don't need to be trimmed (they can have leading or trailing whitespace characters) in order for commands to read it properly
|
|
99
|
-
- Added two new commands (usage in README file):
|
|
100
|
-
- download:jmeter-examples
|
|
101
|
-
- download:keycloak-scim
|
|
102
|
-
|
|
103
|
-
## 4.7.0: 2023-03-22
|
|
104
|
-
|
|
105
|
-
- Fixed bug in `download:studio` when flag `-i` was always required in case we used `-o` flag
|
|
106
|
-
- Download of signalr is now also supported
|
|
107
|
-
- Improved description for download topic, it now displays information on downloading individual components
|
|
108
|
-
- Update command is no longer supported. Instead the update available warning provides information on available update options
|
|
109
|
-
|
|
110
|
-
## 4.6.0: 2023-02-15
|
|
111
|
-
|
|
112
|
-
- Doctor no longer checks for `vsts-npm-auth` package
|
|
113
|
-
- When installing studio you can pass parameter `s` to skip installation in case the selected version is already installed
|
|
114
|
-
|
|
115
|
-
## 4.5.2: 2023-01-12
|
|
116
|
-
|
|
117
|
-
- Limit description length for sql scripts
|
|
118
|
-
|
|
119
|
-
## 4.5.1: 2022-12-13
|
|
120
|
-
|
|
121
|
-
- Fixed release version for windows and linux packages
|
|
122
|
-
|
|
123
|
-
## 4.5.0: 2022-10-05
|
|
124
|
-
|
|
125
|
-
- Add `--major` flag for sql script generation
|
|
126
|
-
- Add `SQL_SCRIPT_VERSION` to force script generation
|
|
127
|
-
|
|
128
|
-
## 4.4.0: 2022-10-03
|
|
129
|
-
|
|
130
|
-
- Added parameters for offline sql script creation
|
|
131
|
-
- Ability to recover from prerelease tag when creating db scripts
|
|
132
|
-
|
|
133
|
-
## 4.3.0: 2022-07-27
|
|
134
|
-
|
|
135
|
-
- Added command `npm:dependency-update` to update dependencies on packages in workspace defined by filter
|
|
136
|
-
- Added command `nuget:dependency-update` to update dependencies on packages in workspace defined by filter
|
|
137
|
-
- Improve error handling in translation fetching
|
|
138
|
-
- Improve warning output when npm publish fails
|
|
139
|
-
|
|
140
|
-
## 4.2.0: 2022-07-15
|
|
141
|
-
|
|
142
|
-
- Added command `gitlab:get-tag-pipeline` to track pipeline status and wait for pipeline to finish
|
|
143
|
-
- Added `--outputVersionOnly` to `gitlab:next-nightly-tag` to output only version
|
|
144
|
-
|
|
145
|
-
## 4.1.0: 2022-06-15
|
|
146
|
-
|
|
147
|
-
- `vsix` file is removed after installation when `-i` flag is used
|
|
148
|
-
|
|
149
|
-
## 4.0.0: 2021-05-31
|
|
150
|
-
|
|
151
|
-
- New auth options
|
|
152
|
-
- [DEPRECATED] `--servicePrincipal` login is no longer available or required. 'AZURE_CLIENT_ID' and 'AZURE_CLIENT_SECRET' environment variables are required with every command in order to use service principal.
|
|
153
|
-
|
|
154
|
-
## 3.9.0: 2021-05-30
|
|
155
|
-
|
|
156
|
-
- Additional options for translations output filename
|
|
157
|
-
|
|
158
|
-
## 3.8.1: 2021-05-17
|
|
159
|
-
|
|
160
|
-
- Fix GitLab next nightly tag when tags with `test` and `qa` annotation exists
|
|
161
|
-
|
|
162
|
-
## 3.8.0: 2021-05-05
|
|
163
|
-
|
|
164
|
-
- Added GitLab next nightly tag
|
|
165
|
-
|
|
166
|
-
## 3.7.0: 2021-04-28
|
|
167
|
-
|
|
168
|
-
- Added download commands for AdInsure Server, Client, IdentityServer and Scheduler
|
|
169
|
-
|
|
170
|
-
## 3.6.1: 2021-12-02
|
|
171
|
-
|
|
172
|
-
- Improve workspace search pattern for npm publish
|
|
173
|
-
|
|
174
|
-
## 3.6.0: 2021-11-30
|
|
175
|
-
|
|
176
|
-
- Add ability to transform files with prepare-content
|
|
177
|
-
|
|
178
|
-
## 3.5.0: 2021-11-24
|
|
179
|
-
|
|
180
|
-
- Renaming prepare-content command
|
|
181
|
-
|
|
182
|
-
## 3.4.0: 2021-10-24
|
|
183
|
-
|
|
184
|
-
- Added Jira command for listing labels and setting them
|
|
185
|
-
- Added Jira command for listing issue
|
|
186
|
-
|
|
187
|
-
## 3.3.1: 2021-10-16
|
|
188
|
-
|
|
189
|
-
- Exclude should be optional for npm:publish
|
|
190
|
-
|
|
191
|
-
## 3.3.0: 2021-10-14
|
|
192
|
-
|
|
193
|
-
- Introduced npm check command
|
|
194
|
-
- Introcuced npm publish command
|
|
195
|
-
- Introduced doctor command
|
|
196
|
-
- Introduced download:platform and download:studio command
|
|
197
|
-
|
|
198
|
-
## 3.2.4: 2021-10-09
|
|
199
|
-
|
|
200
|
-
- Ignore VERSION file when using 'new' command
|
|
201
|
-
- Unexpected token in JSON files should not stop execution
|
|
202
|
-
- Introduce `--exclude-dir` parameter for `version` command
|