@eide/foir-cli 0.6.0 → 0.6.3

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.
Files changed (2) hide show
  1. package/dist/cli.js +23 -18
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -5201,15 +5201,17 @@ async function reconcilePlacements(client, configId, placements, summary) {
5201
5201
  const currentConfigJson = config2.config ?? {};
5202
5202
  const updatedConfig = {
5203
5203
  ...currentConfigJson,
5204
- placements: placements.map((p) => ({
5205
- type: p.type,
5206
- url: p.url,
5207
- allowedOrigin: p.allowedOrigin,
5208
- height: p.height,
5209
- tabName: p.tabName,
5210
- hideContentTab: p.hideContentTab,
5211
- modelKeys: p.modelKeys
5212
- }))
5204
+ placements: placements.map((p) => {
5205
+ const out = {};
5206
+ if (p.type !== void 0) out.type = p.type;
5207
+ if (p.url !== void 0) out.url = p.url;
5208
+ if (p.allowedOrigin !== void 0) out.allowedOrigin = p.allowedOrigin;
5209
+ if (p.height !== void 0) out.height = p.height;
5210
+ if (p.tabName !== void 0) out.tabName = p.tabName;
5211
+ if (p.hideContentTab !== void 0) out.hideContentTab = p.hideContentTab;
5212
+ if (p.modelKeys !== void 0) out.modelKeys = p.modelKeys;
5213
+ return out;
5214
+ })
5213
5215
  };
5214
5216
  await client.configs.updateConfig({
5215
5217
  id: configId,
@@ -5236,6 +5238,7 @@ async function reconcileApiKeys(client, configKey, apiKeys, summary) {
5236
5238
  for (const key of apiKeys) {
5237
5239
  if (!key.name || !key.keyType || !key.envVar) continue;
5238
5240
  const existingKey = existingByName.get(key.name);
5241
+ let rawKey;
5239
5242
  if (existingKey) {
5240
5243
  const wantScopes = (key.scopes ?? []).slice().sort();
5241
5244
  const haveScopes = (existingKey.scopes ?? []).slice().sort();
@@ -5247,16 +5250,18 @@ async function reconcileApiKeys(client, configKey, apiKeys, summary) {
5247
5250
  updateScopes: true
5248
5251
  });
5249
5252
  }
5250
- continue;
5253
+ const rotated = await client.identity.rotateApiKey(existingKey.id);
5254
+ rawKey = rotated?.apiKey?.rawKey;
5255
+ } else {
5256
+ const result = await client.identity.createApiKey({
5257
+ name: key.name,
5258
+ keyType: key.keyType === "secret" ? 2 : 1,
5259
+ allowedModels: key.allowedModels,
5260
+ allowedFileTypes: key.allowedFileTypes,
5261
+ scopes: key.scopes
5262
+ });
5263
+ rawKey = result?.apiKey?.rawKey;
5251
5264
  }
5252
- const result = await client.identity.createApiKey({
5253
- name: key.name,
5254
- keyType: key.keyType === "secret" ? 2 : 1,
5255
- allowedModels: key.allowedModels,
5256
- allowedFileTypes: key.allowedFileTypes,
5257
- scopes: key.scopes
5258
- });
5259
- const rawKey = result?.apiKey?.rawKey;
5260
5265
  if (rawKey) {
5261
5266
  summary.apiKeys.push({
5262
5267
  name: key.name,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eide/foir-cli",
3
- "version": "0.6.0",
3
+ "version": "0.6.3",
4
4
  "description": "Universal platform CLI for Foir platform",
5
5
  "type": "module",
6
6
  "publishConfig": {