@eide/foir-cli 0.5.6 → 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.
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,
@@ -16,7 +16,11 @@
16
16
  * });
17
17
  * ```
18
18
  */
19
- interface FieldDefinitionInput {
19
+ interface SelectFieldConfig extends Record<string, unknown> {
20
+ optionModelKey: string;
21
+ multiple?: boolean;
22
+ }
23
+ type FieldDefinitionInput = {
20
24
  key: string;
21
25
  type: string;
22
26
  label?: string;
@@ -29,7 +33,11 @@ interface FieldDefinitionInput {
29
33
  storage?: string;
30
34
  templateZone?: string;
31
35
  zoneOrder?: number;
32
- }
36
+ };
37
+ type SelectFieldDefinitionInput = Omit<FieldDefinitionInput, 'type' | 'config'> & {
38
+ type: 'select';
39
+ config: SelectFieldConfig;
40
+ };
33
41
  interface ApplyConfigModelInput {
34
42
  key: string;
35
43
  name: string;
@@ -247,6 +255,8 @@ declare const defineExtension: typeof defineConfig;
247
255
  declare function defineModel(model: ApplyConfigModelInput): ApplyConfigModelInput;
248
256
  /** Define a field with type safety. */
249
257
  declare function defineField(field: FieldDefinitionInput): FieldDefinitionInput;
258
+ /** Define a select field — requires `optionModelKey` pointing to a model whose records become options. */
259
+ declare function defineSelectField(field: SelectFieldDefinitionInput): FieldDefinitionInput;
250
260
  /** Define an operation with type safety. */
251
261
  declare function defineOperation(operation: ApplyConfigOperationInput): ApplyConfigOperationInput;
252
262
  /** Define a segment with type safety. */
@@ -264,4 +274,4 @@ declare function defineIntegration(integration: IntegrationInput): IntegrationIn
264
274
  /** Define an extension declaration. */
265
275
  declare function defineExtensionDeclaration(extension: ExtensionInput): ExtensionInput;
266
276
 
267
- export { type ApplyConfigApiKeyInput, type ApplyConfigAuthProviderInput, type ApplyConfigHookInput, type ApplyConfigInput, type ApplyConfigModelInput, type ApplyConfigOperationInput, type ApplyConfigPlacementInput, type ApplyConfigScheduleInput, type ApplyConfigSegmentInput, type CredentialStrategy, type ExpressionPrecondition, type ExtensionInput, type ExtensionPlacementInput, type ExtensionTarget, type FieldDefinitionInput, type IntegrationCredentialsInput, type IntegrationInput, type IntegrationMiddlewareInput, type IntegrationSyncMappingInput, type ModelSeedFieldInput, type ModelSeedInput, type Precondition, type QuotaRule, type SegmentPrecondition, defineAuthProvider, defineConfig, defineExtension, defineExtensionDeclaration, defineField, defineHook, defineIntegration, defineModel, defineOperation, definePlacement, defineSchedule, defineSegment };
277
+ export { type ApplyConfigApiKeyInput, type ApplyConfigAuthProviderInput, type ApplyConfigHookInput, type ApplyConfigInput, type ApplyConfigModelInput, type ApplyConfigOperationInput, type ApplyConfigPlacementInput, type ApplyConfigScheduleInput, type ApplyConfigSegmentInput, type CredentialStrategy, type ExpressionPrecondition, type ExtensionInput, type ExtensionPlacementInput, type ExtensionTarget, type FieldDefinitionInput, type IntegrationCredentialsInput, type IntegrationInput, type IntegrationMiddlewareInput, type IntegrationSyncMappingInput, type ModelSeedFieldInput, type ModelSeedInput, type Precondition, type QuotaRule, type SegmentPrecondition, type SelectFieldConfig, type SelectFieldDefinitionInput, defineAuthProvider, defineConfig, defineExtension, defineExtensionDeclaration, defineField, defineHook, defineIntegration, defineModel, defineOperation, definePlacement, defineSchedule, defineSegment, defineSelectField };
@@ -9,6 +9,9 @@ function defineModel(model) {
9
9
  function defineField(field) {
10
10
  return field;
11
11
  }
12
+ function defineSelectField(field) {
13
+ return field;
14
+ }
12
15
  function defineOperation(operation) {
13
16
  return operation;
14
17
  }
@@ -45,5 +48,6 @@ export {
45
48
  defineOperation,
46
49
  definePlacement,
47
50
  defineSchedule,
48
- defineSegment
51
+ defineSegment,
52
+ defineSelectField
49
53
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eide/foir-cli",
3
- "version": "0.5.6",
3
+ "version": "0.5.8",
4
4
  "description": "Universal platform CLI for Foir platform",
5
5
  "type": "module",
6
6
  "publishConfig": {