@eide/foir-cli 0.5.2 → 0.5.6

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
@@ -1181,6 +1181,24 @@ var TARGET_FROM_PROTO = {
1181
1181
  [ExtensionTarget.RECORD]: "record",
1182
1182
  [ExtensionTarget.MODEL_LIST]: "model-list"
1183
1183
  };
1184
+ var STRATEGY_STRING_MAP = {
1185
+ CREDENTIAL_STRATEGY_UNSPECIFIED: "none",
1186
+ CREDENTIAL_STRATEGY_OAUTH: "oauth",
1187
+ CREDENTIAL_STRATEGY_API_KEY: "api_key",
1188
+ CREDENTIAL_STRATEGY_SHARED_SECRET: "shared_secret",
1189
+ CREDENTIAL_STRATEGY_SSH_KEY: "ssh_key",
1190
+ CREDENTIAL_STRATEGY_NONE: "none",
1191
+ CREDENTIAL_STRATEGY_MANAGED: "managed"
1192
+ };
1193
+ function resolveStrategy(raw) {
1194
+ if (typeof raw === "number") {
1195
+ return STRATEGY_FROM_PROTO[raw] ?? "none";
1196
+ }
1197
+ if (typeof raw === "string") {
1198
+ return STRATEGY_STRING_MAP[raw] ?? raw.toLowerCase().replace("credential_strategy_", "");
1199
+ }
1200
+ return "none";
1201
+ }
1184
1202
  function integrationConfigToInput(cfg) {
1185
1203
  const sync = {};
1186
1204
  for (const [k, v] of Object.entries(cfg.sync)) {
@@ -1189,13 +1207,11 @@ function integrationConfigToInput(cfg) {
1189
1207
  const out = {
1190
1208
  middleware: { url: cfg.middleware?.url ?? "" },
1191
1209
  credentials: {
1192
- strategy: STRATEGY_FROM_PROTO[cfg.credentials?.strategy ?? CredentialStrategy.UNSPECIFIED] ?? "none"
1210
+ strategy: resolveStrategy(cfg.credentials?.strategy)
1193
1211
  },
1194
1212
  sync
1195
1213
  };
1196
- if (cfg.enabled === false) {
1197
- out.enabled = false;
1198
- }
1214
+ out.enabled = cfg.enabled !== false;
1199
1215
  if (cfg.settings && Object.keys(cfg.settings).length > 0) {
1200
1216
  out.settings = cfg.settings;
1201
1217
  }
@@ -4871,11 +4887,11 @@ async function reconcileConfig(client, configId, manifest) {
4871
4887
  }
4872
4888
  async function reconcileModels(client, configId, models, summary) {
4873
4889
  const existing = await client.models.listModels({ limit: 200 });
4874
- const configOwned = existing.items.filter(
4875
- (m) => m.configId === configId
4890
+ const allByKey = new Map(
4891
+ existing.items.map((m) => [m.key, m])
4876
4892
  );
4877
- const existingByKey = new Map(
4878
- configOwned.map((m) => [m.key, m])
4893
+ const configOwnedByKey = new Map(
4894
+ existing.items.filter((m) => m.configId === configId).map((m) => [m.key, m])
4879
4895
  );
4880
4896
  const manifestKeys = /* @__PURE__ */ new Set();
4881
4897
  for (const m of models) {
@@ -4885,7 +4901,7 @@ async function reconcileModels(client, configId, models, summary) {
4885
4901
  if (m.pluralName) config2.pluralName = m.pluralName;
4886
4902
  if (m.pluralKey) config2.pluralKey = m.pluralKey;
4887
4903
  if (m.description) config2.description = m.description;
4888
- const ex = existingByKey.get(m.key);
4904
+ const ex = allByKey.get(m.key);
4889
4905
  if (ex) {
4890
4906
  await client.models.updateModel({
4891
4907
  id: ex.id,
@@ -4905,7 +4921,7 @@ async function reconcileModels(client, configId, models, summary) {
4905
4921
  summary.models.created++;
4906
4922
  }
4907
4923
  }
4908
- for (const [key, ex] of existingByKey) {
4924
+ for (const [key, ex] of configOwnedByKey) {
4909
4925
  if (!manifestKeys.has(key)) {
4910
4926
  await client.models.deleteModel(
4911
4927
  ex.id
@@ -199,7 +199,8 @@ interface IntegrationInput {
199
199
  enabled?: boolean;
200
200
  middleware: IntegrationMiddlewareInput;
201
201
  credentials: IntegrationCredentialsInput;
202
- sync: Record<string, IntegrationSyncMappingInput>;
202
+ /** Source type -> sync mapping. Optional when field mapping is managed via the admin UI. */
203
+ sync?: Record<string, IntegrationSyncMappingInput>;
203
204
  /** Opaque middleware-specific settings — not validated by the CLI. */
204
205
  settings?: Record<string, unknown>;
205
206
  metadata?: Record<string, unknown>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eide/foir-cli",
3
- "version": "0.5.2",
3
+ "version": "0.5.6",
4
4
  "description": "Universal platform CLI for Foir platform",
5
5
  "type": "module",
6
6
  "publishConfig": {