@eide/foir-cli 0.5.7 → 0.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.
Files changed (2) hide show
  1. package/dist/cli.js +17 -2
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -978,7 +978,9 @@ function createIdentityMethods(client) {
978
978
  id: params.id,
979
979
  name: params.name,
980
980
  isActive: params.isActive,
981
- rateLimitPerHour: params.rateLimitPerHour
981
+ rateLimitPerHour: params.rateLimitPerHour,
982
+ scopes: params.scopes,
983
+ updateScopes: params.updateScopes
982
984
  })
983
985
  );
984
986
  return { apiKey: resp.apiKey ?? null };
@@ -5219,7 +5221,20 @@ async function reconcileApiKeys(client, apiKeys, summary) {
5219
5221
  );
5220
5222
  for (const key of apiKeys) {
5221
5223
  if (!key.name || !key.keyType || !key.envVar) continue;
5222
- if (existingByName.has(key.name)) continue;
5224
+ const existingKey = existingByName.get(key.name);
5225
+ if (existingKey) {
5226
+ const wantScopes = (key.scopes ?? []).slice().sort();
5227
+ const haveScopes = (existingKey.scopes ?? []).slice().sort();
5228
+ const scopesChanged = wantScopes.length !== haveScopes.length || wantScopes.some((s, i) => s !== haveScopes[i]);
5229
+ if (scopesChanged) {
5230
+ await client.identity.updateApiKey({
5231
+ id: existingKey.id,
5232
+ scopes: key.scopes ?? [],
5233
+ updateScopes: true
5234
+ });
5235
+ }
5236
+ continue;
5237
+ }
5223
5238
  const result = await client.identity.createApiKey({
5224
5239
  name: key.name,
5225
5240
  keyType: key.keyType === "secret" ? 2 : 1,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eide/foir-cli",
3
- "version": "0.5.7",
3
+ "version": "0.5.8",
4
4
  "description": "Universal platform CLI for Foir platform",
5
5
  "type": "module",
6
6
  "publishConfig": {