@contentstack/cli-utilities 1.5.7 → 1.5.8
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/add-locale.d.ts +1 -0
- package/lib/add-locale.js +19 -0
- package/lib/date-time.d.ts +2 -0
- package/lib/date-time.js +19 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +2 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const addLocale: (apiKey: any, managementToken: any, host: any) => Promise<void>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addLocale = void 0;
|
|
4
|
+
const http_client_1 = require("./http-client");
|
|
5
|
+
const addLocale = async (apiKey, managementToken, host) => {
|
|
6
|
+
const httpClient = new http_client_1.HttpClient({
|
|
7
|
+
headers: { api_key: apiKey, authorization: managementToken },
|
|
8
|
+
});
|
|
9
|
+
const { data } = await httpClient.post(`https://${host}/v3/locales`, {
|
|
10
|
+
locale: {
|
|
11
|
+
name: 'English',
|
|
12
|
+
code: 'en-us',
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
if ([161, 105].includes(data.error_code)) {
|
|
16
|
+
throw new Error(data.error_code === 105 ? 'Sorry but you don\'t have access to this stack' : data.error_message);
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
exports.addLocale = addLocale;
|
package/lib/date-time.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.formatTime = exports.formatDate = void 0;
|
|
4
|
+
const formatDate = (date) => {
|
|
5
|
+
return [
|
|
6
|
+
date.getFullYear(),
|
|
7
|
+
(date.getMonth() + 1).toString().padStart(2, '0'),
|
|
8
|
+
date.getDate().toString().padStart(2, '0'),
|
|
9
|
+
].join('');
|
|
10
|
+
};
|
|
11
|
+
exports.formatDate = formatDate;
|
|
12
|
+
const formatTime = (date) => {
|
|
13
|
+
return [
|
|
14
|
+
date.getHours().toString().padStart(2, '0'),
|
|
15
|
+
date.getMinutes().toString().padStart(2, '0'),
|
|
16
|
+
date.getSeconds().toString().padStart(2, '0'),
|
|
17
|
+
].join('');
|
|
18
|
+
};
|
|
19
|
+
exports.formatTime = formatTime;
|
package/lib/index.d.ts
CHANGED
|
@@ -13,6 +13,8 @@ export { default as NodeCrypto } from './encrypter';
|
|
|
13
13
|
export { Args as args, Flags as flags, Command } from './cli-ux';
|
|
14
14
|
export * from './helpers';
|
|
15
15
|
export * from './interfaces';
|
|
16
|
+
export * from './date-time';
|
|
17
|
+
export * from './add-locale';
|
|
16
18
|
export { Args, CommandHelp, Config, Errors, Flags, loadHelpClass, Help, HelpBase, HelpSection, HelpSectionRenderer, HelpSectionKeyValueTable, Hook, Interfaces, Parser, Plugin, run, toCached, tsPath, toStandardizedId, toConfiguredId, settings, Settings, flush, ux, execute, stderr, stdout, } from '@oclif/core';
|
|
17
19
|
export { FlagInput, ArgInput } from '@oclif/core/lib/interfaces/parser';
|
|
18
20
|
export { default as TablePrompt } from './inquirer-table-prompt';
|
package/lib/index.js
CHANGED
|
@@ -31,6 +31,8 @@ Object.defineProperty(exports, "flags", { enumerable: true, get: function () { r
|
|
|
31
31
|
Object.defineProperty(exports, "Command", { enumerable: true, get: function () { return cli_ux_2.Command; } });
|
|
32
32
|
tslib_1.__exportStar(require("./helpers"), exports);
|
|
33
33
|
tslib_1.__exportStar(require("./interfaces"), exports);
|
|
34
|
+
tslib_1.__exportStar(require("./date-time"), exports);
|
|
35
|
+
tslib_1.__exportStar(require("./add-locale"), exports);
|
|
34
36
|
// NOTE Exporting all @oclif/core modules: So that all the module can be acessed through cli-utility
|
|
35
37
|
var core_1 = require("@oclif/core");
|
|
36
38
|
Object.defineProperty(exports, "Args", { enumerable: true, get: function () { return core_1.Args; } });
|