@dishantlangayan/solace-cloud-cli 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.
- package/README.md +106 -23
- package/dist/commands/missionctrl/broker/create.d.ts +3 -4
- package/dist/commands/missionctrl/broker/create.js +3 -14
- package/dist/commands/missionctrl/broker/delete.d.ts +3 -4
- package/dist/commands/missionctrl/broker/delete.js +3 -13
- package/dist/commands/missionctrl/broker/display.d.ts +3 -4
- package/dist/commands/missionctrl/broker/display.js +6 -15
- package/dist/commands/missionctrl/broker/list.d.ts +3 -3
- package/dist/commands/missionctrl/broker/list.js +9 -9
- package/dist/commands/missionctrl/broker/opstatus.d.ts +1 -1
- package/dist/commands/missionctrl/broker/opstatus.js +1 -3
- package/dist/commands/missionctrl/broker/state.d.ts +12 -0
- package/dist/commands/missionctrl/broker/state.js +52 -0
- package/dist/commands/missionctrl/broker/update.d.ts +3 -4
- package/dist/commands/missionctrl/broker/update.js +8 -14
- package/dist/commands/platform/env/create.d.ts +3 -4
- package/dist/commands/platform/env/create.js +10 -19
- package/dist/commands/platform/env/delete.d.ts +1 -1
- package/dist/commands/platform/env/delete.js +7 -5
- package/dist/commands/platform/env/display.d.ts +3 -4
- package/dist/commands/platform/env/display.js +14 -26
- package/dist/commands/platform/env/list.d.ts +3 -3
- package/dist/commands/platform/env/list.js +9 -9
- package/dist/commands/platform/env/update.d.ts +3 -4
- package/dist/commands/platform/env/update.js +12 -22
- package/dist/types/broker.d.ts +15 -0
- package/dist/types/environment.d.ts +2 -2
- package/oclif.manifest.json +77 -8
- package/package.json +7 -8
- package/dist/sc-command.d.ts +0 -22
- package/dist/sc-command.js +0 -54
- package/dist/util/internal.d.ts +0 -21
- package/dist/util/internal.js +0 -46
- package/dist/util/json.d.ts +0 -15
- package/dist/util/json.js +0 -19
- package/dist/util/sc-connection.d.ts +0 -13
- package/dist/util/sc-connection.js +0 -52
package/dist/util/internal.js
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { table } from 'table';
|
|
2
|
-
/**
|
|
3
|
-
* Formats a camel case style `string` into a title case.
|
|
4
|
-
*
|
|
5
|
-
* @param text Text to transform.
|
|
6
|
-
*/
|
|
7
|
-
export function camelCaseToTitleCase(text) {
|
|
8
|
-
return text
|
|
9
|
-
.replaceAll(/(^\w|\s\w)/g, (m) => m.toUpperCase())
|
|
10
|
-
.replaceAll(/([A-Z][a-z]+)/g, ' $1')
|
|
11
|
-
.replaceAll(/\s{2,}/g, ' ')
|
|
12
|
-
.trim();
|
|
13
|
-
}
|
|
14
|
-
export function renderTable(data, columnConfig) {
|
|
15
|
-
// Table config
|
|
16
|
-
const tableConfig = {
|
|
17
|
-
columns: columnConfig
|
|
18
|
-
};
|
|
19
|
-
const tableStr = table(data, tableConfig);
|
|
20
|
-
return tableStr;
|
|
21
|
-
}
|
|
22
|
-
export function renderKeyValueTable(data, columnConfig) {
|
|
23
|
-
if (columnConfig === undefined) {
|
|
24
|
-
columnConfig = { 1: { width: 50, wrapWord: true } };
|
|
25
|
-
}
|
|
26
|
-
// Table config
|
|
27
|
-
const tableConfig = {
|
|
28
|
-
columns: columnConfig,
|
|
29
|
-
drawHorizontalLine(lineIndex, rowCount) {
|
|
30
|
-
return lineIndex === 0 || lineIndex === 1 || lineIndex === rowCount;
|
|
31
|
-
},
|
|
32
|
-
};
|
|
33
|
-
const tableStr = table(data, tableConfig);
|
|
34
|
-
return tableStr;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Sleep function.
|
|
38
|
-
* @param ms Num of milliseconds to wait
|
|
39
|
-
* @returns Promise that resolves after the specified time
|
|
40
|
-
*/
|
|
41
|
-
export function sleep(ms) {
|
|
42
|
-
return new Promise((resolve) => {
|
|
43
|
-
setTimeout(resolve, ms);
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
export const sleepModule = { sleep };
|
package/dist/util/json.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Parse JSON `string` data.
|
|
3
|
-
*
|
|
4
|
-
* @param data Data to parse.
|
|
5
|
-
*/
|
|
6
|
-
export declare function parseJson(data: string, _throwOnEmpty?: boolean): unknown;
|
|
7
|
-
/**
|
|
8
|
-
* Finds a the key with the provided value in the JSON array and returns the JSON object.
|
|
9
|
-
*
|
|
10
|
-
* @param array The JSON array to search
|
|
11
|
-
* @param key The key to lookup in the array
|
|
12
|
-
* @param value The value of the key to match
|
|
13
|
-
* @returns The JSON object that matches the key and value
|
|
14
|
-
*/
|
|
15
|
-
export declare function findByKey<T>(array: T[], key: keyof T, value: unknown): T | undefined;
|
package/dist/util/json.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Parse JSON `string` data.
|
|
3
|
-
*
|
|
4
|
-
* @param data Data to parse.
|
|
5
|
-
*/
|
|
6
|
-
export function parseJson(data, _throwOnEmpty = true) {
|
|
7
|
-
return typeof data === 'string' ? JSON.parse(data) : data;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Finds a the key with the provided value in the JSON array and returns the JSON object.
|
|
11
|
-
*
|
|
12
|
-
* @param array The JSON array to search
|
|
13
|
-
* @param key The key to lookup in the array
|
|
14
|
-
* @param value The value of the key to match
|
|
15
|
-
* @returns The JSON object that matches the key and value
|
|
16
|
-
*/
|
|
17
|
-
export function findByKey(array, key, value) {
|
|
18
|
-
return array.find(item => item[key] === value);
|
|
19
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { AxiosRequestConfig } from 'axios';
|
|
2
|
-
export declare class ScConnection {
|
|
3
|
-
private axiosInstance;
|
|
4
|
-
private endpointUrl;
|
|
5
|
-
constructor(baseURL?: string, accessToken?: string, timeout?: number);
|
|
6
|
-
delete<T>(url: string, config?: AxiosRequestConfig): Promise<T>;
|
|
7
|
-
get<T>(url: string, config?: AxiosRequestConfig): Promise<T>;
|
|
8
|
-
patch<T>(url: string, data?: unknown, config?: AxiosRequestConfig): Promise<T>;
|
|
9
|
-
post<T>(url: string, data?: unknown, config?: AxiosRequestConfig): Promise<T>;
|
|
10
|
-
put<T>(url: string, data?: unknown, config?: AxiosRequestConfig): Promise<T>;
|
|
11
|
-
private joinPaths;
|
|
12
|
-
}
|
|
13
|
-
export default ScConnection;
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import axios from 'axios';
|
|
2
|
-
import { DefaultBaseUrl, EnvironmentVariable, envVars } from '../config/env-vars.js';
|
|
3
|
-
export class ScConnection {
|
|
4
|
-
axiosInstance;
|
|
5
|
-
endpointUrl = '';
|
|
6
|
-
constructor(baseURL = envVars.getString(EnvironmentVariable.SC_BASE_URL, DefaultBaseUrl), accessToken = envVars.getString(EnvironmentVariable.SC_ACCESS_TOKEN, ''), timeout = 10_000) {
|
|
7
|
-
const apiVersion = envVars.getString(EnvironmentVariable.SC_API_VERSION, 'v2');
|
|
8
|
-
this.endpointUrl = this.joinPaths(baseURL, `/api/${apiVersion}`);
|
|
9
|
-
this.axiosInstance = axios.create({
|
|
10
|
-
baseURL: this.endpointUrl,
|
|
11
|
-
headers: {
|
|
12
|
-
'Authorization': `Bearer ${accessToken}`,
|
|
13
|
-
'Content-Type': 'application/json',
|
|
14
|
-
},
|
|
15
|
-
timeout,
|
|
16
|
-
});
|
|
17
|
-
// Add interceptors if needed
|
|
18
|
-
this.axiosInstance.interceptors.response.use((response) => response, (error) => {
|
|
19
|
-
console.error('API Error:', error.response?.data || error.message);
|
|
20
|
-
return Promise.reject(error);
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
// DELETE request
|
|
24
|
-
async delete(url, config) {
|
|
25
|
-
const response = await this.axiosInstance.delete(url, config);
|
|
26
|
-
return response.data;
|
|
27
|
-
}
|
|
28
|
-
// GET request
|
|
29
|
-
async get(url, config) {
|
|
30
|
-
const response = await this.axiosInstance.get(url, config);
|
|
31
|
-
return response.data;
|
|
32
|
-
}
|
|
33
|
-
// PATCH request
|
|
34
|
-
async patch(url, data, config) {
|
|
35
|
-
const response = await this.axiosInstance.patch(url, data, config);
|
|
36
|
-
return response.data;
|
|
37
|
-
}
|
|
38
|
-
// POST request
|
|
39
|
-
async post(url, data, config) {
|
|
40
|
-
const response = await this.axiosInstance.post(url, data, config);
|
|
41
|
-
return response.data;
|
|
42
|
-
}
|
|
43
|
-
// PUT request
|
|
44
|
-
async put(url, data, config) {
|
|
45
|
-
const response = await this.axiosInstance.put(url, data, config);
|
|
46
|
-
return response.data;
|
|
47
|
-
}
|
|
48
|
-
joinPaths(base, path) {
|
|
49
|
-
return `${base.replace(/\/+$/, '')}/${path.replace(/^\/+/, '')}`;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
export default ScConnection;
|