@datocms/cli-utils
Advanced tools
Comparing version 0.1.7 to 0.1.8
@@ -21,2 +21,7 @@ import { Client, ClientConfigOptions, LogLevel } from '@datocms/cma-client-node'; | ||
protected init(): Promise<void>; | ||
protected buildBaseClientInitializationOptions(): { | ||
apiToken: string; | ||
baseUrl: string | undefined; | ||
logLevel: LogLevel; | ||
}; | ||
protected buildClient(config?: Partial<ClientConfigOptions>): Client; | ||
@@ -23,0 +28,0 @@ protected catch(err: Error & { |
@@ -20,3 +20,3 @@ "use strict"; | ||
} | ||
buildClient(config = {}) { | ||
buildBaseClientInitializationOptions() { | ||
var _a, _b, _c; | ||
@@ -39,6 +39,11 @@ const apiToken = this.parsedFlags['api-token'] || ((_a = this.datoProjectConfig) === null || _a === void 0 ? void 0 : _a.apiToken); | ||
} | ||
return (0, cma_client_node_1.buildClient)({ | ||
return { | ||
apiToken, | ||
baseUrl, | ||
logLevel, | ||
}; | ||
} | ||
buildClient(config = {}) { | ||
return (0, cma_client_node_1.buildClient)({ | ||
...this.buildBaseClientInitializationOptions(), | ||
logFn: (message) => { | ||
@@ -45,0 +50,0 @@ this.log(chalk.gray(message)); |
@@ -8,2 +8,3 @@ export declare type ProjectConfig = { | ||
modelApiKey?: string; | ||
template?: string; | ||
}; | ||
@@ -10,0 +11,0 @@ }; |
{ | ||
"name": "@datocms/cli-utils", | ||
"version": "0.1.7", | ||
"version": "0.1.8", | ||
"description": "Utils for DatoCMS CLI", | ||
@@ -30,3 +30,3 @@ "author": "Stefano Verna <s.verna@datocms.com>", | ||
}, | ||
"gitHead": "ba77786fe9d9cb6e338059c04e57a97cb950a82f" | ||
"gitHead": "2b40a70f6d9b04815f1eb04ef8f79059efced1fa" | ||
} |
@@ -45,3 +45,7 @@ import { | ||
protected buildClient(config: Partial<ClientConfigOptions> = {}): Client { | ||
protected buildBaseClientInitializationOptions(): { | ||
apiToken: string; | ||
baseUrl: string | undefined; | ||
logLevel: LogLevel; | ||
} { | ||
const apiToken = | ||
@@ -72,6 +76,12 @@ this.parsedFlags['api-token'] || this.datoProjectConfig?.apiToken; | ||
return buildClient({ | ||
return { | ||
apiToken, | ||
baseUrl, | ||
logLevel, | ||
}; | ||
} | ||
protected buildClient(config: Partial<ClientConfigOptions> = {}): Client { | ||
return buildClient({ | ||
...this.buildBaseClientInitializationOptions(), | ||
logFn: (message) => { | ||
@@ -78,0 +88,0 @@ this.log(chalk.gray(message)); |
@@ -11,2 +11,3 @@ import { access, readFile } from 'fs/promises'; | ||
modelApiKey?: string; | ||
template?: string; | ||
}; | ||
@@ -13,0 +14,0 @@ }; |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
27708
741
0