utilitas 1999.1.63 → 1999.1.64
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 +0 -1
- package/dist/utilitas.lite.mjs +1 -1
- package/dist/utilitas.lite.mjs.map +1 -1
- package/lib/gen.mjs +9 -7
- package/lib/manifest.mjs +1 -1
- package/lib/shell.mjs +1 -1
- package/package.json +1 -1
package/lib/gen.mjs
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
|
-
ensureArray, ensureString, log as _log, need, throwError,
|
|
2
|
+
ensureArray, ensureString, ignoreErrFunc, log as _log, need, throwError,
|
|
3
|
+
tryUntil,
|
|
3
4
|
} from './utilitas.mjs';
|
|
4
5
|
|
|
5
|
-
import {
|
|
6
|
+
import { assertExist, exec } from './shell.mjs';
|
|
6
7
|
import { convert, MIME_PNG } from './storage.mjs';
|
|
7
8
|
import { createReadStream } from 'fs';
|
|
8
9
|
|
|
@@ -180,12 +181,13 @@ const image = async (prompt, options) => {
|
|
|
180
181
|
};
|
|
181
182
|
|
|
182
183
|
const getGeminiAccessToken = async (credentials) => {
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
184
|
+
const bin = 'gcloud';
|
|
185
|
+
await assertExist(bin);
|
|
186
|
+
const actResp = await ignoreErrFunc(async () => await exec(
|
|
187
|
+
`${bin} auth activate-service-account --key-file=${credentials}`,
|
|
186
188
|
{ acceptError: true }
|
|
187
|
-
);
|
|
188
|
-
assert(actResp
|
|
189
|
+
), { log: true });
|
|
190
|
+
assert(actResp?.includes?.('Activated service account credentials'),
|
|
189
191
|
'Failed to activate service account credentials.', 500);
|
|
190
192
|
const tokResp = (await exec(`gcloud auth print-access-token`)).trim();
|
|
191
193
|
assert(tokResp, 'Failed to get access token.', 500);
|
package/lib/manifest.mjs
CHANGED
package/lib/shell.mjs
CHANGED