@adminide-stack/form-builder-core 5.1.8-alpha.98 → 5.1.9-alpha.14

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.
@@ -1,4 +1,4 @@
1
- import {CONTRIBUTION_POINTS,ContributeDefaultValueSourceType}from'common';import {resolveConnectorFieldTokensInValue}from'./connectorFieldTokenResolver.js';import {parseSampleNodes,flattenSchemas}from'./schemaHelpers.js';const parseScopes = raw => raw.split(',').map(s => s.trim()).filter(Boolean);
1
+ import {CONTRIBUTION_POINTS,ContributeDefaultValueSourceType}from'common';import {CONNECTOR_REDIRECT_URI_TEMPLATE}from'./connectorRedirectUri.js';import {connectorDefaultAuthMethod}from'./connectorDefaultAuthMethod.js';import {resolveConnectorFieldTokensInValue}from'./connectorFieldTokenResolver.js';import {pickConnectorOAuthRequestKnobs,connectorOAuthRequestKnobSettings}from'./connectorOAuthRequestKnobs.js';import {parseSampleNodes,flattenSchemas}from'./schemaHelpers.js';const parseScopes = raw => raw.split(',').map(s => s.trim()).filter(Boolean);
2
2
  const parseEnumValues = raw => {
3
3
  if (Array.isArray(raw)) return raw;
4
4
  if (raw === null || raw === undefined) return [];
@@ -92,13 +92,19 @@ const buildAppSeed = p => {
92
92
  useCustomOAuthEndpoints: p.useCustomOAuthEndpoints,
93
93
  usePKCE: p.usePKCE,
94
94
  clientAuthMethod: p.clientAuthMethod,
95
+ clientIdParamName: p.clientIdParamName,
96
+ useCommaSeparatedScopes: p.useCommaSeparatedScopes,
97
+ tokenEndpointHeaders: p.tokenEndpointHeaders,
98
+ ...pickConnectorOAuthRequestKnobs(p),
95
99
  authorizationUrl: p.authorizationUrl,
96
100
  tokenUrl: p.tokenUrl,
97
101
  revocationUrl: p.revocationUrl,
98
102
  useBasicAuth: p.useBasicAuth,
103
+ requiresDeveloperToken: p.requiresDeveloperToken,
99
104
  mcpUrl: p.mcpUrl || '',
100
105
  connectorType: 'app',
101
106
  authMethods,
107
+ defaultAuthMethod: p.defaultAuthMethod,
102
108
  fields: p.fields || [],
103
109
  resources: p.resources || [],
104
110
  customButtons: p.customButtons || [],
@@ -232,8 +238,129 @@ const seedCategory = seed => seed.categories[0];
232
238
  * 'app' but a `${id}:llm` key; everything else is an app connector.
233
239
  */
234
240
  const seedCredentialNamespace = seed => seed.connectorType === 'mcp' ? 'mcp' : seed.key.endsWith(':llm') ? 'llm' : 'app';
241
+ /**
242
+ * Normalize a provider id or form namespace into a vault secret key prefix.
243
+ * e.g. `gmail-app-hk7zf7w9` → `GMAIL_APP_HK7ZF7W9`
244
+ */
235
245
  const toVaultPrefix = value => value.replace(/[^a-zA-Z0-9]/g, '_').toUpperCase();
236
- const seedAuthMethodDefault = seed => seed.authMethods.includes('oauth2') ? 'oauth' : seed.connectorType === 'mcp' ? 'mcp' : 'api_key';
246
+ /**
247
+ * Per-form-instance vault keys for non-account-specific secrets (e.g. API key fields).
248
+ *
249
+ * Do NOT use these for OAuth access/refresh tokens when multiple accounts can share
250
+ * one published form — connecting account B would overwrite account A's vault entry.
251
+ * Access/refresh live under per-credential `configKey.accounts.{id}.*` and durable
252
+ * `CRED_<id>_*` vault keys via syncOAuthTokensToCredentialVault.
253
+ *
254
+ * Client id/secret stay provider-scoped (shared OAuth app credentials).
255
+ */
256
+ const buildOAuthInstanceTokenVaultKeys = namespace => {
257
+ const prefix = toVaultPrefix(namespace);
258
+ return {
259
+ /** @deprecated Do not wire access tokens to this shared key — use CRED_* instead. */
260
+ accessToken: `${prefix}_ACCESS_TOKEN`,
261
+ /** @deprecated Do not wire refresh tokens to this shared key — use CRED_* instead. */
262
+ refreshToken: `${prefix}_REFRESH_TOKEN`,
263
+ apiKey: `${prefix}_API_KEY`
264
+ };
265
+ };
266
+ /** `_{24-hex}` suffix appended to a base vault key to scope it to one credential. */
267
+ const CREDENTIAL_SCOPED_SECRET_KEY_RE = /_([a-fA-F0-9]{24})$/;
268
+ /**
269
+ * Credential-scoped vault key: `{BASE_KEY}_{credentialId}`.
270
+ *
271
+ * This is the platform's own convention — `preferences-service` resolves a
272
+ * `format: 'secret'` config key to `${defaultValueSource.secretKey}_${credentialId}`
273
+ * on both read and write whenever the node context carries a `credentialId`.
274
+ * API-key connectors reuse the exact same shape so several credentials for one
275
+ * provider can coexist in a project/env instead of overwriting each other's
276
+ * shared `PROVIDER_API_KEY` entry (the same isolation OAuth gets from its
277
+ * per-account configKey).
278
+ *
279
+ * Idempotent when `baseSecretKey` is already scoped to the same credential.
280
+ */
281
+ const buildCredentialScopedSecretKey = (baseSecretKey, credentialId) => {
282
+ const base = stripCredentialScopedSecretKey(baseSecretKey || '');
283
+ if (!base || !credentialId) {
284
+ return base || '';
285
+ }
286
+ return `${base}_${credentialId}`;
287
+ };
288
+ /** True when a vault key already carries a `_{credentialId}` suffix. */
289
+ const isCredentialScopedSecretKey = secretKey => CREDENTIAL_SCOPED_SECRET_KEY_RE.test(secretKey || '');
290
+ /** Strip `_{credentialId}` to recover the catalog/base vault key. */
291
+ const stripCredentialScopedSecretKey = secretKey => (secretKey || '').replace(CREDENTIAL_SCOPED_SECRET_KEY_RE, '');
292
+ /** credentialId embedded in a scoped vault key, if any. */
293
+ const credentialIdFromScopedSecretKey = secretKey => CREDENTIAL_SCOPED_SECRET_KEY_RE.exec(secretKey || '')?.[1] || null;
294
+ /**
295
+ * Durable per-credential token vault keys. Used after OAuth connect so each
296
+ * FormBuilderCredential keeps its own token pair even when several credentials
297
+ * share the same published template/configKey staging path.
298
+ */
299
+ const buildCredentialOAuthTokenVaultKeys = credentialId => {
300
+ const prefix = toVaultPrefix(`cred_${credentialId}`);
301
+ return {
302
+ accessToken: `${prefix}_ACCESS_TOKEN`,
303
+ refreshToken: `${prefix}_REFRESH_TOKEN`
304
+ };
305
+ };
306
+ /**
307
+ * Provider-scoped per-credential OAuth vault keys (e.g. OAuth callback writes
308
+ * `GOOGLE_GMAIL_ACCESS_TOKEN_{credentialId}` to Personal Vault).
309
+ */
310
+ const buildProviderCredentialOAuthTokenVaultKeys = (providerId, credentialId) => {
311
+ const prefix = toVaultPrefix(providerId);
312
+ return {
313
+ accessToken: `${prefix}_ACCESS_TOKEN_${credentialId}`,
314
+ refreshToken: `${prefix}_REFRESH_TOKEN_${credentialId}`
315
+ };
316
+ };
317
+ /**
318
+ * Namespace-scoped per-credential OAuth vault keys (`google_gmail-app` → `GOOGLE_GMAIL_APP_*_{id}`).
319
+ */
320
+ const buildNamespaceCredentialOAuthTokenVaultKeys = (namespace, credentialId) => {
321
+ const prefix = toVaultPrefix(namespace);
322
+ return {
323
+ accessToken: `${prefix}_ACCESS_TOKEN_${credentialId}`,
324
+ refreshToken: `${prefix}_REFRESH_TOKEN_${credentialId}`
325
+ };
326
+ };
327
+ /**
328
+ * Per-connected-account OAuth preferences path.
329
+ * Template: `….{namespace}.oauthConnector`
330
+ * Account: `….{namespace}.oauthConnector.accounts.{credentialId}`
331
+ *
332
+ * OAuth app settings (client id/secret, scopes, endpoints) are seeded from the
333
+ * template path onto each account path so ApplicationConnectorOAuthService can
334
+ * use a single configKey without a shared token staging slot.
335
+ */
336
+ const CREDENTIAL_ACCOUNT_CONFIG_KEY_RE = /\.accounts\.([a-fA-F0-9]{24})$/;
337
+ /** True when configKey is already scoped to a FormBuilder credential account. */
338
+ const isCredentialAccountConfigKey = configKey => CREDENTIAL_ACCOUNT_CONFIG_KEY_RE.test(configKey || '');
339
+ /** Strip `.accounts.{credentialId}` to recover the published template configKey. */
340
+ const stripCredentialAccountConfigKey = configKey => (configKey || '').replace(CREDENTIAL_ACCOUNT_CONFIG_KEY_RE, '');
341
+ /** credentialId embedded in an account-scoped configKey, if any. */
342
+ const credentialIdFromOAuthConfigKey = configKey => {
343
+ const match = CREDENTIAL_ACCOUNT_CONFIG_KEY_RE.exec(configKey || '');
344
+ return match?.[1] || null;
345
+ };
346
+ /**
347
+ * Build the per-credential OAuth configKey used for connect / refresh / disconnect.
348
+ * Idempotent when `baseConfigKey` is already account-scoped for the same id.
349
+ */
350
+ const buildCredentialOAuthConfigKey = (baseConfigKey, credentialId) => {
351
+ const base = stripCredentialAccountConfigKey(baseConfigKey || '').replace(/\.+$/, '');
352
+ if (!base || !credentialId) {
353
+ return base || '';
354
+ }
355
+ return `${base}.accounts.${credentialId}`;
356
+ };
357
+ /** Extract the form namespace from an oauthConnector configKey path. */
358
+ const namespaceFromOAuthConfigKey = configKey => {
359
+ const normalized = stripCredentialAccountConfigKey(configKey || '');
360
+ const match = /integrationSettings\.settings\.[^.]+\.([^.]+)\.oauthConnector(?:\.|$)/.exec(normalized);
361
+ return match?.[1] || null;
362
+ };
363
+ const seedAuthMethodDefault = seed => connectorDefaultAuthMethod(seed) ?? (seed.authMethods.includes('oauth2') ? 'oauth' : seed.connectorType === 'mcp' ? 'mcp' : 'api_key');
237
364
  /**
238
365
  * Build a `genericType -> count` map for the given fields. Used by
239
366
  * {@link resolveFieldKey} to detect colliding `genericType` values so that
@@ -270,7 +397,10 @@ const resolveFieldKey = (field, genericTypeCounts) => {
270
397
  return field.name;
271
398
  };
272
399
  function buildPreGeneratedFormSteps(seed, namespace) {
273
- const vaultPrefix = toVaultPrefix(seed.providerId);
400
+ // Shared OAuth app credentials (one client id/secret per provider).
401
+ const providerVaultPrefix = toVaultPrefix(seed.providerId);
402
+ // Per-form-instance tokens — unique namespace prevents multi-account overwrite.
403
+ const instanceTokenKeys = buildOAuthInstanceTokenVaultKeys(namespace);
274
404
  const isApp = seed.connectorType === 'app';
275
405
  const isApiKeyOnly = seedIsApiKeyOnly(seed);
276
406
  const templateType = seedTemplateType(seed);
@@ -365,14 +495,15 @@ function buildPreGeneratedFormSteps(seed, namespace) {
365
495
  connectorTokenUrl: seed.tokenUrl || '',
366
496
  connectorRevocationUrl: seed.revocationUrl || '',
367
497
  useBasicAuth: seed.useBasicAuth ?? false,
368
- connectorRedirectUri: '{{CLIENT_URL}}/{{CONNECTOR_ENDPOINT}}',
498
+ connectorRedirectUri: CONNECTOR_REDIRECT_URI_TEMPLATE,
369
499
  // connectorAuthMethod — present only for non-oauth connectors (matches reference forms)
370
- ...(!seed.authMethods.includes('oauth2') ? {
500
+ ...(seedAuthMethodDefault(seed) !== 'oauth' ? {
371
501
  connectorAuthMethod: seedAuthMethodDefault(seed)
372
502
  } : {}),
373
- ...(seed.fields.length > 0 ? {
374
- connectorProviderFields: seed.fields
375
- } : {}),
503
+ // Always emitted, even empty: a template entry is self-describing only when a reader can
504
+ // tell "no extra provider fields" from "unknown", and the credential picker synthesizes
505
+ // the form from this entry instead of fetching the published form document.
506
+ connectorProviderFields: seed.fields,
376
507
  ...(seed.resources.length > 0 ? {
377
508
  connectorProviderResources: seed.resources
378
509
  } : {}),
@@ -407,7 +538,7 @@ function buildPreGeneratedFormSteps(seed, namespace) {
407
538
  defaultValueSource: {
408
539
  type: ContributeDefaultValueSourceType.Vault,
409
540
  secretType: 'OAUTH_CLIENT',
410
- secretKey: `${vaultPrefix}_CLIENT_ID`,
541
+ secretKey: `${providerVaultPrefix}_CLIENT_ID`,
411
542
  ...(isApp ? {
412
543
  requiredReference: true
413
544
  } : {})
@@ -426,13 +557,30 @@ function buildPreGeneratedFormSteps(seed, namespace) {
426
557
  defaultValueSource: {
427
558
  type: ContributeDefaultValueSourceType.Vault,
428
559
  secretType: 'OAUTH_CLIENT',
429
- secretKey: `${vaultPrefix}_CLIENT_SECRET`,
560
+ secretKey: `${providerVaultPrefix}_CLIENT_SECRET`,
430
561
  ...(isApp ? {
431
562
  requiredReference: true
432
563
  } : {})
433
564
  }
434
565
  }
435
- }, {
566
+ }, ...(seed.requiresDeveloperToken ? [{
567
+ id: 'developerToken',
568
+ type: 'string',
569
+ label: 'Developer Token',
570
+ description: 'Provider-issued developer token, sent with every API request alongside the OAuth access token',
571
+ format: 'secret',
572
+ readOnly: true,
573
+ default: '',
574
+ scope: isApp ? 6 /* ConfigurationScope.MACHINE_OVERRIDABLE */ : 1 /* ConfigurationScope.APPLICATION */,
575
+ schemaExtensions: {
576
+ defaultValueSource: {
577
+ type: ContributeDefaultValueSourceType.Vault,
578
+ secretType: 'OAUTH_CLIENT',
579
+ secretKey: `${providerVaultPrefix}_DEVELOPER_TOKEN`,
580
+ requiredReference: true
581
+ }
582
+ }
583
+ }] : []), {
436
584
  id: 'apiKey',
437
585
  type: 'string',
438
586
  label: 'API Key',
@@ -445,7 +593,7 @@ function buildPreGeneratedFormSteps(seed, namespace) {
445
593
  defaultValueSource: {
446
594
  type: ContributeDefaultValueSourceType.Vault,
447
595
  secretType: 'API_KEY',
448
- secretKey: `${vaultPrefix}_API_KEY`
596
+ secretKey: instanceTokenKeys.apiKey
449
597
  }
450
598
  }
451
599
  }, {
@@ -457,11 +605,16 @@ function buildPreGeneratedFormSteps(seed, namespace) {
457
605
  default: '',
458
606
  readOnly: true,
459
607
  scope: 1 /* ConfigurationScope.APPLICATION */,
608
+
609
+ // No shared vault secretKey by default — multi-account connects would overwrite.
610
+ // Staging still needs a vault route: writeSettings discards format:secret when
611
+ // defaultValueSource is missing. Instance keys are the temporary staging slot;
612
+ // completeOAuth / sync(force) copies them into CRED_<credentialId>_*.
460
613
  schemaExtensions: {
461
614
  defaultValueSource: {
462
615
  type: ContributeDefaultValueSourceType.Vault,
463
616
  secretType: 'OAUTH_CLIENT',
464
- secretKey: `${vaultPrefix}_ACCESS_TOKEN`
617
+ secretKey: instanceTokenKeys.accessToken
465
618
  }
466
619
  }
467
620
  }, {
@@ -477,7 +630,7 @@ function buildPreGeneratedFormSteps(seed, namespace) {
477
630
  defaultValueSource: {
478
631
  type: ContributeDefaultValueSourceType.Vault,
479
632
  secretType: 'OAUTH_CLIENT',
480
- secretKey: `${vaultPrefix}_REFRESH_TOKEN`
633
+ secretKey: instanceTokenKeys.refreshToken
481
634
  }
482
635
  }
483
636
  }, {
@@ -565,7 +718,7 @@ function buildPreGeneratedFormSteps(seed, namespace) {
565
718
  type: 'string',
566
719
  label: 'Redirect URI',
567
720
  scope: 2 /* ConfigurationScope.MACHINE */,
568
- default: '{{CLIENT_URL}}/{{CONNECTOR_ENDPOINT}}',
721
+ default: CONNECTOR_REDIRECT_URI_TEMPLATE,
569
722
  readOnly: true,
570
723
  defaultValueSource: {
571
724
  type: ContributeDefaultValueSourceType.Environment
@@ -660,6 +813,12 @@ function buildPreGeneratedFormSteps(seed, namespace) {
660
813
  'ui:widget': 'hidden',
661
814
  'ui:placeholder': 'Enter OAuth Client Secret'
662
815
  },
816
+ ...(seed.requiresDeveloperToken ? {
817
+ developerToken: {
818
+ 'ui:widget': 'hidden',
819
+ 'ui:placeholder': 'Enter Developer Token'
820
+ }
821
+ } : {}),
663
822
  apiKey: {
664
823
  'ui:widget': seed.connectorType === 'mcp' || !seed.authMethods.includes('oauth2') ? 'password' : 'hidden',
665
824
  'ui:placeholder': 'Enter API Key'
@@ -758,14 +917,15 @@ function buildPreGeneratedFormSteps(seed, namespace) {
758
917
  connectorTokenUrl: seed.tokenUrl || '',
759
918
  connectorRevocationUrl: seed.revocationUrl || '',
760
919
  useBasicAuth: seed.useBasicAuth ?? false,
761
- connectorRedirectUri: '{{CLIENT_URL}}/{{CONNECTOR_ENDPOINT}}',
920
+ connectorRedirectUri: CONNECTOR_REDIRECT_URI_TEMPLATE,
762
921
  // connectorAuthMethod — present only for non-oauth connectors (matches reference forms)
763
- ...(!seed.authMethods.includes('oauth2') ? {
922
+ ...(seedAuthMethodDefault(seed) !== 'oauth' ? {
764
923
  connectorAuthMethod: seedAuthMethodDefault(seed)
765
924
  } : {}),
766
- ...(seed.fields.length > 0 ? {
767
- connectorProviderFields: seed.fields
768
- } : {}),
925
+ // Always emitted, even empty: a template entry is self-describing only when a reader can
926
+ // tell "no extra provider fields" from "unknown", and the credential picker synthesizes
927
+ // the form from this entry instead of fetching the published form document.
928
+ connectorProviderFields: seed.fields,
769
929
  ...(seed.resources.length > 0 ? {
770
930
  connectorProviderResources: seed.resources
771
931
  } : {}),
@@ -792,7 +952,8 @@ function buildOAuthConfigurationContribution(seedsWithNamespaces) {
792
952
  seed,
793
953
  namespace
794
954
  } of seedsWithNamespaces) {
795
- const vaultPrefix = toVaultPrefix(seed.providerId);
955
+ const providerVaultPrefix = toVaultPrefix(seed.providerId);
956
+ const instanceTokenKeys = buildOAuthInstanceTokenVaultKeys(namespace);
796
957
  const isApp = seed.connectorType === 'app';
797
958
  const isApiKeyOnly = seedIsApiKeyOnly(seed);
798
959
  const templateType = seedTemplateType(seed);
@@ -854,7 +1015,7 @@ function buildOAuthConfigurationContribution(seedsWithNamespaces) {
854
1015
  defaultValueSource: {
855
1016
  type: ContributeDefaultValueSourceType.Vault,
856
1017
  secretType: 'OAUTH_CLIENT',
857
- secretKey: `${vaultPrefix}_CLIENT_ID`,
1018
+ secretKey: `${providerVaultPrefix}_CLIENT_ID`,
858
1019
  ...(isApp ? {
859
1020
  requiredReference: true
860
1021
  } : {})
@@ -875,7 +1036,7 @@ function buildOAuthConfigurationContribution(seedsWithNamespaces) {
875
1036
  defaultValueSource: {
876
1037
  type: ContributeDefaultValueSourceType.Vault,
877
1038
  secretType: 'OAUTH_CLIENT',
878
- secretKey: `${vaultPrefix}_CLIENT_SECRET`,
1039
+ secretKey: `${providerVaultPrefix}_CLIENT_SECRET`,
879
1040
  ...(isApp ? {
880
1041
  requiredReference: true
881
1042
  } : {})
@@ -885,6 +1046,29 @@ function buildOAuthConfigurationContribution(seedsWithNamespaces) {
885
1046
  'ui:description': 'OAuth application client secret',
886
1047
  'ui:placeholder': 'Enter OAuth Client Secret'
887
1048
  });
1049
+ // ── Developer token — an extra provider credential a few APIs (Google Ads)
1050
+ // require on every call. Provisioned exactly like clientId/clientSecret.
1051
+ if (seed.requiresDeveloperToken) {
1052
+ addField('developerToken', {
1053
+ type: 'string',
1054
+ title: 'Developer Token',
1055
+ description: 'Provider-issued developer token, sent with every API request alongside the OAuth access token',
1056
+ format: 'secret',
1057
+ default: '',
1058
+ readOnly: true,
1059
+ scope: isApp ? 6 /* ConfigurationScope.MACHINE_OVERRIDABLE */ : 1 /* ConfigurationScope.APPLICATION */,
1060
+ defaultValueSource: {
1061
+ type: ContributeDefaultValueSourceType.Vault,
1062
+ secretType: 'OAUTH_CLIENT',
1063
+ secretKey: `${providerVaultPrefix}_DEVELOPER_TOKEN`,
1064
+ requiredReference: true
1065
+ }
1066
+ }, {
1067
+ 'ui:widget': 'hidden',
1068
+ 'ui:description': 'Provider-issued developer token, sent with every API request alongside the OAuth access token',
1069
+ 'ui:placeholder': 'Enter Developer Token'
1070
+ });
1071
+ }
888
1072
  addField('apiKey', {
889
1073
  type: 'string',
890
1074
  title: 'API Key',
@@ -896,7 +1080,7 @@ function buildOAuthConfigurationContribution(seedsWithNamespaces) {
896
1080
  defaultValueSource: {
897
1081
  type: ContributeDefaultValueSourceType.Vault,
898
1082
  secretType: 'API_KEY',
899
- secretKey: `${vaultPrefix}_API_KEY`
1083
+ secretKey: instanceTokenKeys.apiKey
900
1084
  }
901
1085
  }, {
902
1086
  'ui:widget': !seed.authMethods.includes('oauth2') ? 'password' : 'hidden',
@@ -912,10 +1096,13 @@ function buildOAuthConfigurationContribution(seedsWithNamespaces) {
912
1096
  readOnly: true,
913
1097
  writeOnly: true,
914
1098
  scope: 1 /* ConfigurationScope.APPLICATION */,
1099
+
1100
+ // Staging vault route required — writeSettings drops format:secret
1101
+ // without defaultValueSource. Durable isolation is CRED_* via sync.
915
1102
  defaultValueSource: {
916
1103
  type: ContributeDefaultValueSourceType.Vault,
917
1104
  secretType: 'OAUTH_CLIENT',
918
- secretKey: `${vaultPrefix}_ACCESS_TOKEN`
1105
+ secretKey: instanceTokenKeys.accessToken
919
1106
  }
920
1107
  }, {
921
1108
  'ui:widget': 'hidden'
@@ -932,7 +1119,7 @@ function buildOAuthConfigurationContribution(seedsWithNamespaces) {
932
1119
  defaultValueSource: {
933
1120
  type: ContributeDefaultValueSourceType.Vault,
934
1121
  secretType: 'OAUTH_CLIENT',
935
- secretKey: `${vaultPrefix}_REFRESH_TOKEN`
1122
+ secretKey: instanceTokenKeys.refreshToken
936
1123
  }
937
1124
  }, {
938
1125
  'ui:widget': 'hidden'
@@ -1039,6 +1226,18 @@ function buildOAuthConfigurationContribution(seedsWithNamespaces) {
1039
1226
  }, {
1040
1227
  'ui:widget': 'hidden'
1041
1228
  });
1229
+ // Without this key in the registry the connect flow cannot see the catalog's
1230
+ // usePKCE, and both the widget and readOAuthConfigFromRegistry fall back to
1231
+ // PKCE-on — silently ignoring every `usePKCE: false` in the catalog.
1232
+ addField('usePKCE', {
1233
+ type: 'boolean',
1234
+ title: 'Use PKCE',
1235
+ default: seed.usePKCE !== false,
1236
+ readOnly: true,
1237
+ scope: 2 /* ConfigurationScope.MACHINE */
1238
+ }, {
1239
+ 'ui:widget': 'hidden'
1240
+ });
1042
1241
  if (seed.clientAuthMethod) {
1043
1242
  addField('clientAuthMethod', {
1044
1243
  type: 'string',
@@ -1050,10 +1249,59 @@ function buildOAuthConfigurationContribution(seedsWithNamespaces) {
1050
1249
  'ui:widget': 'hidden'
1051
1250
  });
1052
1251
  }
1252
+ if (seed.clientIdParamName) {
1253
+ addField('clientIdParamName', {
1254
+ type: 'string',
1255
+ title: 'Client ID Parameter Name',
1256
+ default: seed.clientIdParamName,
1257
+ readOnly: true,
1258
+ scope: 2 /* ConfigurationScope.MACHINE */
1259
+ }, {
1260
+ 'ui:widget': 'hidden'
1261
+ });
1262
+ }
1263
+ if (seed.useCommaSeparatedScopes) {
1264
+ addField('useCommaSeparatedScopes', {
1265
+ type: 'boolean',
1266
+ title: 'Use Comma-Separated Scopes',
1267
+ default: true,
1268
+ readOnly: true,
1269
+ scope: 2 /* ConfigurationScope.MACHINE */
1270
+ }, {
1271
+ 'ui:widget': 'hidden'
1272
+ });
1273
+ }
1274
+ if (seed.tokenEndpointHeaders && Object.keys(seed.tokenEndpointHeaders).length > 0) {
1275
+ // Stored as a JSON string: the OAuth service reads it with one prefix read and
1276
+ // resolves its `{{KEY}}` templates the same way it does the OAuth URLs.
1277
+ addField('tokenEndpointHeaders', {
1278
+ type: 'string',
1279
+ title: 'Token Endpoint Headers',
1280
+ default: JSON.stringify(seed.tokenEndpointHeaders),
1281
+ readOnly: true,
1282
+ scope: 2 /* ConfigurationScope.MACHINE */
1283
+ }, {
1284
+ 'ui:widget': 'hidden'
1285
+ });
1286
+ }
1287
+ // Generic OAuth request/response knobs (TikTok Business). Only the ones a connector
1288
+ // sets are declared, as strings (lists and objects as JSON), so every other
1289
+ // connector's settings stay byte-identical.
1290
+ for (const knob of connectorOAuthRequestKnobSettings(seed)) {
1291
+ addField(knob.name, {
1292
+ type: 'string',
1293
+ title: knob.title,
1294
+ default: knob.value,
1295
+ readOnly: true,
1296
+ scope: 2 /* ConfigurationScope.MACHINE */
1297
+ }, {
1298
+ 'ui:widget': 'hidden'
1299
+ });
1300
+ }
1053
1301
  addField('redirectUri', {
1054
1302
  type: 'string',
1055
1303
  title: 'Redirect URI',
1056
- default: '{{CLIENT_URL}}/{{CONNECTOR_ENDPOINT}}',
1304
+ default: CONNECTOR_REDIRECT_URI_TEMPLATE,
1057
1305
  readOnly: true,
1058
1306
  scope: 2 /* ConfigurationScope.MACHINE */,
1059
1307
  defaultValueSource: {
@@ -1286,15 +1534,24 @@ function buildOAuthConfigurationContribution(seedsWithNamespaces) {
1286
1534
  properties: formUIProperties
1287
1535
  }];
1288
1536
  }
1289
- function generateFromSeeds(seeds, title, formIcon, formExtensionId) {
1537
+ function generateFromSeeds(seeds, title, formIcon, formExtensionId, options = {}) {
1290
1538
  const allNodes = [];
1291
1539
  const mergedUiLayoutTemplates = {};
1292
1540
  const mergedUiLayoutUi = {};
1293
1541
  let uiLayoutFormMetadataNode = null;
1294
1542
  const seedsWithNamespaces = [];
1295
1543
  seeds.forEach((seed, idx) => {
1296
- const generatedFormId = `${sanitizeFieldKey(seed.providerId)}-${seed.connectorType}-${Math.random().toString(36).substring(2, 10)}`;
1297
- const providerTitle = `${seed.title} (${seed.connectorType.toUpperCase()})`;
1544
+ // The namespace doubles as the formId AND flows into every configuration key
1545
+ // (`integrationSettings.settings.<type>.<ns>.oauthConnector…`). An explicit
1546
+ // namespace lets a caller regenerate the form for an ALREADY-PUBLISHED template
1547
+ // so the output is identity-compatible with it (same formId, same config keys);
1548
+ // the random default is only safe for brand-new forms.
1549
+ const generatedFormId = options.namespaces?.[idx] || `${sanitizeFieldKey(seed.providerId)}-${seed.connectorType}-${Math.random().toString(36).substring(2, 10)}`;
1550
+ // The connector's own title, with no `(APP)` marker appended. `connectorType` is
1551
+ // `app` for every one of the 1166 catalog connectors, so the suffix carried no
1552
+ // information - it just made every row in the credential picker read "… (APP)".
1553
+ // The type is still contributed as `connectorType` for anything that needs it.
1554
+ const providerTitle = seed.title;
1298
1555
  const namespace = generatedFormId;
1299
1556
  seedsWithNamespaces.push({
1300
1557
  seed,
@@ -1574,8 +1831,8 @@ function generateFromSeeds(seeds, title, formIcon, formExtensionId) {
1574
1831
  if (!uiLayoutFormMetadataNode) return allNodes;
1575
1832
  return [...allNodes, uiLayoutFormMetadataNode, uiLayoutFormNode, uiLayoutFormUINode];
1576
1833
  }
1577
- function createOAuthSeedGenerator(seeds) {
1578
- return (title = '', formIcon = '', formExtensionId = '') => generateFromSeeds(seeds, title, formIcon, formExtensionId);
1834
+ function createOAuthSeedGenerator(seeds, options = {}) {
1835
+ return (title = '', formIcon = '', formExtensionId = '') => generateFromSeeds(seeds, title, formIcon, formExtensionId, options);
1579
1836
  }
1580
1837
  // create provider refs
1581
1838
  const findRefPath = node => {
@@ -1633,4 +1890,4 @@ const buildMetadataSchema = sampleNodes => {
1633
1890
  configurationNodes: entry.configurationNodes,
1634
1891
  contributes: {}
1635
1892
  }))];
1636
- };export{buildMetadataSchema,buildProviderConfig,buildProviderSeedFromConfig,buildProviderWithRefs,createOAuthSeedGenerator};//# sourceMappingURL=authMetaDataSchema.js.map
1893
+ };export{buildCredentialOAuthConfigKey,buildCredentialOAuthTokenVaultKeys,buildCredentialScopedSecretKey,buildMetadataSchema,buildNamespaceCredentialOAuthTokenVaultKeys,buildOAuthInstanceTokenVaultKeys,buildProviderConfig,buildProviderCredentialOAuthTokenVaultKeys,buildProviderSeedFromConfig,buildProviderWithRefs,createOAuthSeedGenerator,credentialIdFromOAuthConfigKey,credentialIdFromScopedSecretKey,isCredentialAccountConfigKey,isCredentialScopedSecretKey,namespaceFromOAuthConfigKey,stripCredentialAccountConfigKey,stripCredentialScopedSecretKey,toVaultPrefix};//# sourceMappingURL=authMetaDataSchema.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"authMetaDataSchema.js","sources":["../../src/utils/authMetaDataSchema.ts"],"sourcesContent":[null],"names":[],"mappings":"6NAeA,MAAA,WAAU,GAAA,GAAA,IAAA,GAAoB,CAAA,KAAA,CAAA,GAAA,CAAA,CAAA,GAAA,CAAA,CAAA,IAAA,CAAA,CAAA,IAAA,EAAA,CAAA,CAAA,MAAA,CAAA,OAAA,CAAA;MAC1B,eAAY,GAAA,GAAA,IAAA;MACZ,KAAA,CAAA,WAAmB,CAAA,EAAA,OAAA,GAAA;MACnB,GAAK,SAAS,IAAA,GAAA,KAAA,SAAA,EAAA,OAAA,EAAA;MACd,OAAA,GAAW,aAAS,EAAA,OAAA,EAAA;MACpB,CAAA,GAAM,CAAA,IAAE,EAAA,EAAM,OAAG,EAAA;MACjB;IACA,MAAA,MAAA,GAAA,IAAA,CAAA,KAAwB,CAAE,GAAA,CAAA;IAC1B,OAAO,KAAG,CAAA,OAAQ,CAAA,MAAA,CAAA,GAAA,MAAA,GAAA,EAAA;AAClB,EAAA,CAAA,CAAA,OAAA,CAAA,EAAA;IACA,OAAA,GAAA,CAAA,KAAgB,CAAC,IAAE,CAAA,CAAA,GAAO,CAAA,IAAA,IAAA,IAAA,CAAA,IAAA,EAAA,CAAA,CAAA,MAAA,CAAA,OAAA,CAAA,CAAA,GAAA,CAAA,IAAA,IAAA;MAC1B,MAAQ,CAAC,KAAE,EAAA,KAAO,CAAA,GAAA,IAAA,CAAA,KAAA,CAAA,GAAA,CAAA;MAClB,OAAA;QACA,KAAA,EAAA,CAAY,KAAG,IAAA,EAAQ,EAAA,I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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,14 @@
1
+ import type { ConnectorConfig } from '../config/configTypes';
2
+ /** What a seed needs for the catalog's declared default auth method. */
3
+ export interface ConnectorDefaultAuthMethodSeed {
4
+ authMethods: string[];
5
+ defaultAuthMethod?: ConnectorConfig['defaultAuthMethod'];
6
+ }
7
+ /**
8
+ * The auth method a catalog connector declares its credential form opens on
9
+ * (`ConnectorConfig.defaultAuthMethod`), as the form's `authMethod` value - or undefined when it
10
+ * declares none, or declares one it does not offer, so the generators keep their own rule and
11
+ * every connector without the knob gets exactly the default it got before.
12
+ */
13
+ export declare function connectorDefaultAuthMethod(seed: ConnectorDefaultAuthMethodSeed): 'oauth' | 'api_key' | undefined;
14
+ //# sourceMappingURL=connectorDefaultAuthMethod.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connectorDefaultAuthMethod.d.ts","sourceRoot":"","sources":["../../src/utils/connectorDefaultAuthMethod.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAE7D,wEAAwE;AACxE,MAAM,WAAW,8BAA8B;IAC3C,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,iBAAiB,CAAC,EAAE,eAAe,CAAC,mBAAmB,CAAC,CAAC;CAC5D;AAQD;;;;;GAKG;AACH,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,8BAA8B,GAAG,OAAO,GAAG,SAAS,GAAG,SAAS,CAIhH"}
@@ -0,0 +1,16 @@
1
+ /** The credential-form value (`authMethod`) for each catalog auth method. */
2
+ const FORM_AUTH_METHOD = {
3
+ oauth2: 'oauth',
4
+ api_key: 'api_key'
5
+ };
6
+ /**
7
+ * The auth method a catalog connector declares its credential form opens on
8
+ * (`ConnectorConfig.defaultAuthMethod`), as the form's `authMethod` value - or undefined when it
9
+ * declares none, or declares one it does not offer, so the generators keep their own rule and
10
+ * every connector without the knob gets exactly the default it got before.
11
+ */
12
+ function connectorDefaultAuthMethod(seed) {
13
+ const declared = seed.defaultAuthMethod;
14
+ if (!declared || !Object.prototype.hasOwnProperty.call(FORM_AUTH_METHOD, declared)) return undefined;
15
+ return seed.authMethods.includes(declared) ? FORM_AUTH_METHOD[declared] : undefined;
16
+ }export{connectorDefaultAuthMethod};//# sourceMappingURL=connectorDefaultAuthMethod.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connectorDefaultAuthMethod.js","sources":["../../src/utils/connectorDefaultAuthMethod.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAA;AAEA,MAAA,gBAAA,GAAA;AACA,EAAA,eAAiB;SACb,EAAA;AACA,CAAA;AACH;AAQD;;;;;AAKG,SAAA,0BAAA,CAAA,IAAA,EAAA;AACH,EAAA,MAAA,QAAA,GAAA,IAAA,CAAgB,iBAAA;;;"}
@@ -0,0 +1,24 @@
1
+ import type { ConnectorConfig } from '../config/configTypes';
2
+ /**
3
+ * Generic OAuth request/response knobs for a provider whose OAuth departs from the standard
4
+ * (TikTok Business: `app_id`/`secret`/`auth_code`, a JSON token request, no scope, and a token
5
+ * response wrapped in `{ code, message, data }`).
6
+ *
7
+ * Every knob a catalog connector sets is published as a read-only machine setting under the
8
+ * connector's `oauthConnector` path, next to `clientIdParamName` and `tokenEndpointHeaders`,
9
+ * where the adminIde OAuth service reads it with the rest of the prefix. A knob that is not set
10
+ * publishes nothing, so the settings of every other connector stay byte-identical.
11
+ */
12
+ export type ConnectorOAuthRequestKnobs = Pick<ConnectorConfig, 'clientSecretParamName' | 'authorizationCodeParamName' | 'tokenRequestEncoding' | 'tokenRequestOmitParams' | 'authorizationOmitParams' | 'tokenResponseEnvelope' | 'tokenResponseMetadataFields'>;
13
+ /** One knob as published: the leaf name under `oauthConnector`, its title, and the stored string. */
14
+ export interface ConnectorOAuthRequestKnobSetting {
15
+ name: keyof ConnectorOAuthRequestKnobs;
16
+ title: string;
17
+ /** Scalars as they are; lists and objects as JSON, the way `tokenEndpointHeaders` is stored. */
18
+ value: string;
19
+ }
20
+ /** The knobs a connector config sets, and none of the ones it leaves out. */
21
+ export declare function pickConnectorOAuthRequestKnobs(config: ConnectorOAuthRequestKnobs): ConnectorOAuthRequestKnobs;
22
+ /** The settings to publish for a connector's knobs, in publish order; empty when it sets none. */
23
+ export declare function connectorOAuthRequestKnobSettings(knobs: ConnectorOAuthRequestKnobs): ConnectorOAuthRequestKnobSetting[];
24
+ //# sourceMappingURL=connectorOAuthRequestKnobs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connectorOAuthRequestKnobs.d.ts","sourceRoot":"","sources":["../../src/utils/connectorOAuthRequestKnobs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAE7D;;;;;;;;;GASG;AACH,MAAM,MAAM,0BAA0B,GAAG,IAAI,CACzC,eAAe,EACb,uBAAuB,GACvB,4BAA4B,GAC5B,sBAAsB,GACtB,wBAAwB,GACxB,yBAAyB,GACzB,uBAAuB,GACvB,6BAA6B,CAClC,CAAC;AAEF,qGAAqG;AACrG,MAAM,WAAW,gCAAgC;IAC7C,IAAI,EAAE,MAAM,0BAA0B,CAAC;IACvC,KAAK,EAAE,MAAM,CAAC;IACd,gGAAgG;IAChG,KAAK,EAAE,MAAM,CAAC;CACjB;AAaD,6EAA6E;AAC7E,wBAAgB,8BAA8B,CAAC,MAAM,EAAE,0BAA0B,GAAG,0BAA0B,CAM7G;AAUD,kGAAkG;AAClG,wBAAgB,iCAAiC,CAC7C,KAAK,EAAE,0BAA0B,GAClC,gCAAgC,EAAE,CAOpC"}