@adminide-stack/form-builder-core 5.1.8-alpha.15 → 5.1.8-alpha.154
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/LICENSE +63 -22
- package/lib/config/cdnConfig.d.ts +7 -3
- package/lib/config/cdnConfig.d.ts.map +1 -1
- package/lib/config/cdnConfig.js +17 -7
- package/lib/config/cdnConfig.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/utils/authMetaDataSchema.d.ts +91 -2
- package/lib/utils/authMetaDataSchema.d.ts.map +1 -1
- package/lib/utils/authMetaDataSchema.js +170 -41
- package/lib/utils/authMetaDataSchema.js.map +1 -1
- package/lib/utils/integrationCommands.d.ts +94 -0
- package/lib/utils/integrationCommands.d.ts.map +1 -0
- package/lib/utils/integrationCommands.js +253 -0
- package/lib/utils/integrationCommands.js.map +1 -0
- package/package.json +3 -4
package/LICENSE
CHANGED
|
@@ -1,30 +1,71 @@
|
|
|
1
|
-
PROPRIETARY SOFTWARE LICENSE
|
|
1
|
+
PROPRIETARY SOFTWARE LICENSE AGREEMENT
|
|
2
2
|
|
|
3
|
-
Copyright (c)
|
|
3
|
+
Copyright (c) 2026 CDEBase Inc. All Rights Reserved.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
NOTICE TO USER: THIS IS A CONTRACT. BY INSTALLING, COPYING, OR OTHERWISE
|
|
6
|
+
USING THE SOFTWARE, YOU AGREE TO BE BOUND BY THE TERMS OF THIS LICENSE.
|
|
7
|
+
IF YOU DO NOT AGREE TO THE TERMS OF THIS LICENSE, DO NOT INSTALL, COPY,
|
|
8
|
+
OR USE THE SOFTWARE.
|
|
7
9
|
|
|
8
|
-
|
|
10
|
+
NO LICENSE GRANTED
|
|
11
|
+
No license, express or implied, is granted to any person or entity.
|
|
12
|
+
All rights are reserved by CDEBase Inc. Any use of this software
|
|
13
|
+
without prior written authorization from CDEBase Inc. is strictly
|
|
14
|
+
prohibited.
|
|
9
15
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
16
|
+
RESTRICTIONS
|
|
17
|
+
You may NOT:
|
|
18
|
+
a) Copy, modify, adapt, translate, reverse engineer, decompile, or
|
|
19
|
+
disassemble the software or create derivative works based on it
|
|
20
|
+
b) Distribute, sublicense, lease, rent, loan, or otherwise transfer
|
|
21
|
+
the software to any third party
|
|
22
|
+
c) Remove or alter any proprietary notices, labels, or marks on the
|
|
23
|
+
software
|
|
24
|
+
d) Use the software to develop competing products or services
|
|
25
|
+
e) Publicly disclose any benchmarking or performance results
|
|
26
|
+
f) Use the software in any manner that violates applicable laws or
|
|
27
|
+
regulations
|
|
28
|
+
g) Access, view, or use any portion of the source code without
|
|
29
|
+
explicit prior written consent from CDEBase Inc.
|
|
14
30
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
31
|
+
OWNERSHIP
|
|
32
|
+
This software is the exclusive proprietary property of CDEBase Inc.
|
|
33
|
+
and is protected by copyright laws and international treaty provisions.
|
|
34
|
+
CDEBase Inc. retains all rights, title, and interest in and to the
|
|
35
|
+
software, including all copyrights, patents, trade secrets, trademarks,
|
|
36
|
+
and other intellectual property rights. No rights are transferred or
|
|
37
|
+
conveyed by possession or access to this software.
|
|
18
38
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
39
|
+
CONFIDENTIALITY
|
|
40
|
+
The software contains trade secrets and proprietary information of
|
|
41
|
+
CDEBase Inc. You agree to maintain strict confidentiality of the
|
|
42
|
+
software and not disclose it, in whole or in part, to any third party
|
|
43
|
+
without prior written consent of CDEBase Inc. This obligation survives
|
|
44
|
+
termination of any agreement with CDEBase Inc.
|
|
22
45
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
46
|
+
TERMINATION
|
|
47
|
+
Any unauthorized use automatically and immediately terminates all
|
|
48
|
+
permissions. CDEBase Inc. may seek all available legal and equitable
|
|
49
|
+
remedies, including injunctive relief, for any unauthorized use or
|
|
50
|
+
disclosure.
|
|
29
51
|
|
|
30
|
-
|
|
52
|
+
WARRANTY DISCLAIMER
|
|
53
|
+
THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
54
|
+
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
55
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND
|
|
56
|
+
NONINFRINGEMENT.
|
|
57
|
+
|
|
58
|
+
LIMITATION OF LIABILITY
|
|
59
|
+
IN NO EVENT SHALL CDEBASE INC. BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
|
|
60
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER ARISING OUT OF THE USE
|
|
61
|
+
OF OR INABILITY TO USE THE SOFTWARE.
|
|
62
|
+
|
|
63
|
+
GOVERNING LAW
|
|
64
|
+
This agreement shall be governed by and construed in accordance with
|
|
65
|
+
the laws of the jurisdiction in which CDEBase Inc. is registered,
|
|
66
|
+
without regard to its conflict of law provisions.
|
|
67
|
+
|
|
68
|
+
For licensing inquiries, contact: legal@cdebase.com
|
|
69
|
+
|
|
70
|
+
CDEBase Inc.
|
|
71
|
+
All Rights Reserved.
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* CDN / asset-URL configuration.
|
|
2
|
+
* CDN / asset-URL configuration for connector artwork.
|
|
3
3
|
*
|
|
4
4
|
* Connector configs store only the *path* portion
|
|
5
5
|
* (e.g. `_side/thirdparty/logos/gmail.svg`); call `iurl(path)` to get the
|
|
6
6
|
* full URL at runtime.
|
|
7
7
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
8
|
+
* Logos are served from the `cde-extensions` bucket (the same CDN that fronts
|
|
9
|
+
* the connector registry and pods), *not* from the tenant upload bucket that
|
|
10
|
+
* `AWS_CDN_URL` points at. Override with the `EXTENSION_CDN_URL` env var via
|
|
11
|
+
* `setCdnBase()`; browser packages do that at init time.
|
|
10
12
|
*/
|
|
13
|
+
/** `cde-extensions` bucket CDN — the default home for connector artwork. */
|
|
14
|
+
export declare const DEFAULT_EXTENSION_CDN_BASE = "https://cdn.yantra.app";
|
|
11
15
|
/** Set the CDN base URL (typically called once from env-config). */
|
|
12
16
|
export declare function setCdnBase(base: string): void;
|
|
13
17
|
/** Get the current CDN base URL. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cdnConfig.d.ts","sourceRoot":"","sources":["../../src/config/cdnConfig.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"cdnConfig.d.ts","sourceRoot":"","sources":["../../src/config/cdnConfig.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,4EAA4E;AAC5E,eAAO,MAAM,0BAA0B,2BAA2B,CAAC;AAInE,oEAAoE;AACpE,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAS7C;AAED,oCAAoC;AACpC,wBAAgB,UAAU,IAAI,MAAM,CAEnC;AAED,0DAA0D;AAC1D,wBAAgB,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAOzC"}
|
package/lib/config/cdnConfig.js
CHANGED
|
@@ -1,18 +1,28 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* CDN / asset-URL configuration.
|
|
2
|
+
* CDN / asset-URL configuration for connector artwork.
|
|
3
3
|
*
|
|
4
4
|
* Connector configs store only the *path* portion
|
|
5
5
|
* (e.g. `_side/thirdparty/logos/gmail.svg`); call `iurl(path)` to get the
|
|
6
6
|
* full URL at runtime.
|
|
7
7
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
8
|
+
* Logos are served from the `cde-extensions` bucket (the same CDN that fronts
|
|
9
|
+
* the connector registry and pods), *not* from the tenant upload bucket that
|
|
10
|
+
* `AWS_CDN_URL` points at. Override with the `EXTENSION_CDN_URL` env var via
|
|
11
|
+
* `setCdnBase()`; browser packages do that at init time.
|
|
10
12
|
*/
|
|
11
|
-
|
|
13
|
+
/** `cde-extensions` bucket CDN — the default home for connector artwork. */
|
|
14
|
+
const DEFAULT_EXTENSION_CDN_BASE = 'https://cdn.yantra.app';
|
|
15
|
+
let _cdnBase = DEFAULT_EXTENSION_CDN_BASE;
|
|
12
16
|
/** Set the CDN base URL (typically called once from env-config). */
|
|
13
17
|
function setCdnBase(base) {
|
|
14
|
-
// Strip trailing slash for consistency.
|
|
15
|
-
|
|
18
|
+
// Strip trailing slash for consistency. Empty/blank resets to the default
|
|
19
|
+
// so an unset env var can never degrade logos to host-relative 404s.
|
|
20
|
+
const trimmed = (base || '').trim();
|
|
21
|
+
if (!trimmed) {
|
|
22
|
+
_cdnBase = DEFAULT_EXTENSION_CDN_BASE;
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
_cdnBase = trimmed.endsWith('/') ? trimmed.slice(0, -1) : trimmed;
|
|
16
26
|
}
|
|
17
27
|
/** Get the current CDN base URL. */
|
|
18
28
|
function getCdnBase() {
|
|
@@ -26,4 +36,4 @@ function iurl(path) {
|
|
|
26
36
|
// Strip leading slash so we don't end up with a double-slash.
|
|
27
37
|
const clean = path.startsWith('/') ? path.slice(1) : path;
|
|
28
38
|
return _cdnBase ? `${_cdnBase}/${clean}` : clean;
|
|
29
|
-
}export{getCdnBase,iurl,setCdnBase};//# sourceMappingURL=cdnConfig.js.map
|
|
39
|
+
}export{DEFAULT_EXTENSION_CDN_BASE,getCdnBase,iurl,setCdnBase};//# sourceMappingURL=cdnConfig.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cdnConfig.js","sources":["../../src/config/cdnConfig.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"cdnConfig.js","sources":["../../src/config/cdnConfig.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAA;;;;;;;;;;;AAWG;AAEH;AACA,MAAA,0BAAa,GAAA;AAIb,IAAA,QAAA,GAAA,0BAAA;AACA;AAWA,SAAA,UAAA,CAAA,IAAA,EAAA;AACA;AAIA;AACA,EAAA,MAAA,OAAA,GAAA,CAAA,IAAA,MAAqB,EAAA,IAAM,EAAA;;;;;;;;;;;;;;;;;;;"}
|
package/lib/index.d.ts
CHANGED
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,2CAA2C,CAAC;AAC1D,cAAc,sBAAsB,CAAC;AACrC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,yCAAyC,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,8BAA8B,EAAE,MAAM,yBAAyB,CAAC;AAC9F,cAAc,4BAA4B,CAAC;AAC3C,cAAc,qCAAqC,CAAC;AACpD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,cAAc,CAAC;AAC7B,cAAc,uBAAuB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,2CAA2C,CAAC;AAC1D,cAAc,sBAAsB,CAAC;AACrC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,yCAAyC,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,8BAA8B,EAAE,MAAM,yBAAyB,CAAC;AAC9F,cAAc,4BAA4B,CAAC;AAC3C,cAAc,qCAAqC,CAAC;AACpD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,cAAc,CAAC;AAC7B,cAAc,uBAAuB,CAAC;AACtC,cAAc,6BAA6B,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{getCdnBase,iurl,setCdnBase}from'./config/cdnConfig.js';export{CONNECTOR_CATALOG_SAMPLE_CHUNK_SIZE,CONNECTOR_CATALOG_SAMPLE_ENTRIES,CONNECTOR_CATALOG_SAMPLE_ENTRY_BY_SCHEMA_ID}from'./config/connectorSampleOptions.generated.js';export{CONNECTOR_CATEGORIES}from'./config/configTypes.js';export{generateFunctionCode,generateHandlerBody,generateHandlerBodyWithReturn,generateStepFromFunction,generateStepFunctionsFromDB,wrapStepsInInngestFunction}from'./inngest/generateFunctionCode.js';export{getAvailableDefinitions,installLibraryForAutocomplete,setupMonacoAutocomplete,setupStepAutocomplete,updateAutocompleteConfig}from'./inngest/monacoAutocompleteIntegration.js';export{cleanStepCode,extractFunctionBody,extractStepVarName,generateFromExtractedFunctions}from'./inngest/stepGenerator.js';export{buildMetadataSchema,buildProviderConfig,buildProviderSeedFromConfig,buildProviderWithRefs,createOAuthSeedGenerator}from'./utils/authMetaDataSchema.js';export{resolveConnectorFieldTokensInString,resolveConnectorFieldTokensInValue}from'./utils/connectorFieldTokenResolver.js';export{deepMergeElements,deepMergeFormSteps}from'./utils/deepMergeFormSteps.js';export{flatten,unflatten}from'./utils/json.js';export{DatabaseType,FORM_METADATA_NODE_TYPE,FormType,SCHEMA_ID_OPTIONS,flattenSchemaWithUiContext,flattenSchemas,flattenUiSchema,isContributionSchemaId,parseSampleNodes}from'./utils/schemaHelpers.js';//# sourceMappingURL=index.js.map
|
|
1
|
+
export{DEFAULT_EXTENSION_CDN_BASE,getCdnBase,iurl,setCdnBase}from'./config/cdnConfig.js';export{CONNECTOR_CATALOG_SAMPLE_CHUNK_SIZE,CONNECTOR_CATALOG_SAMPLE_ENTRIES,CONNECTOR_CATALOG_SAMPLE_ENTRY_BY_SCHEMA_ID}from'./config/connectorSampleOptions.generated.js';export{CONNECTOR_CATEGORIES}from'./config/configTypes.js';export{generateFunctionCode,generateHandlerBody,generateHandlerBodyWithReturn,generateStepFromFunction,generateStepFunctionsFromDB,wrapStepsInInngestFunction}from'./inngest/generateFunctionCode.js';export{getAvailableDefinitions,installLibraryForAutocomplete,setupMonacoAutocomplete,setupStepAutocomplete,updateAutocompleteConfig}from'./inngest/monacoAutocompleteIntegration.js';export{cleanStepCode,extractFunctionBody,extractStepVarName,generateFromExtractedFunctions}from'./inngest/stepGenerator.js';export{buildCredentialOAuthConfigKey,buildCredentialOAuthTokenVaultKeys,buildCredentialScopedSecretKey,buildMetadataSchema,buildNamespaceCredentialOAuthTokenVaultKeys,buildOAuthInstanceTokenVaultKeys,buildProviderConfig,buildProviderCredentialOAuthTokenVaultKeys,buildProviderSeedFromConfig,buildProviderWithRefs,createOAuthSeedGenerator,credentialIdFromOAuthConfigKey,credentialIdFromScopedSecretKey,isCredentialAccountConfigKey,isCredentialScopedSecretKey,namespaceFromOAuthConfigKey,stripCredentialAccountConfigKey,stripCredentialScopedSecretKey,toVaultPrefix}from'./utils/authMetaDataSchema.js';export{resolveConnectorFieldTokensInString,resolveConnectorFieldTokensInValue}from'./utils/connectorFieldTokenResolver.js';export{deepMergeElements,deepMergeFormSteps}from'./utils/deepMergeFormSteps.js';export{flatten,unflatten}from'./utils/json.js';export{DatabaseType,FORM_METADATA_NODE_TYPE,FormType,SCHEMA_ID_OPTIONS,flattenSchemaWithUiContext,flattenSchemas,flattenUiSchema,isContributionSchemaId,parseSampleNodes}from'./utils/schemaHelpers.js';export{buildCommandsFromActions,buildIntegrationConfigurationContribution,buildMenusFromCommands,buildParamBindings,extractTemplateUserFields,extractUserFieldsFromStepperFormMetadata,parseInputTemplate,resolveInputTemplate}from'./utils/integrationCommands.js';//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ConnectorType } from 'common';
|
|
2
2
|
import { ConnectorCategoryTuple, ConnectorConfig, CustomButtonConfig, FormFieldConfig, FormResourceConfig, MCPProviderConfig } from '../config/configTypes';
|
|
3
3
|
type SampleFormGenerator = (title?: string, formIcon?: string, formExtensionId?: string) => any[];
|
|
4
|
-
interface ProviderTemplateSeed {
|
|
4
|
+
export interface ProviderTemplateSeed {
|
|
5
5
|
key: string;
|
|
6
6
|
providerId: string;
|
|
7
7
|
title: string;
|
|
@@ -179,7 +179,96 @@ export declare const buildProviderConfig: (providerConfig: CustomProviderConfigI
|
|
|
179
179
|
}[];
|
|
180
180
|
};
|
|
181
181
|
export declare function buildProviderSeedFromConfig(provider: ConnectorConfig | MCPProviderConfig, connectorType: ConnectorType): ProviderTemplateSeed;
|
|
182
|
-
|
|
182
|
+
/**
|
|
183
|
+
* Normalize a provider id or form namespace into a vault secret key prefix.
|
|
184
|
+
* e.g. `gmail-app-hk7zf7w9` → `GMAIL_APP_HK7ZF7W9`
|
|
185
|
+
*/
|
|
186
|
+
export declare const toVaultPrefix: (value: string) => string;
|
|
187
|
+
/**
|
|
188
|
+
* Per-form-instance vault keys for non-account-specific secrets (e.g. API key fields).
|
|
189
|
+
*
|
|
190
|
+
* Do NOT use these for OAuth access/refresh tokens when multiple accounts can share
|
|
191
|
+
* one published form — connecting account B would overwrite account A's vault entry.
|
|
192
|
+
* Access/refresh live under per-credential `configKey.accounts.{id}.*` and durable
|
|
193
|
+
* `CRED_<id>_*` vault keys via syncOAuthTokensToCredentialVault.
|
|
194
|
+
*
|
|
195
|
+
* Client id/secret stay provider-scoped (shared OAuth app credentials).
|
|
196
|
+
*/
|
|
197
|
+
export declare const buildOAuthInstanceTokenVaultKeys: (namespace: string) => {
|
|
198
|
+
/** @deprecated Do not wire access tokens to this shared key — use CRED_* instead. */
|
|
199
|
+
readonly accessToken: `${string}_ACCESS_TOKEN`;
|
|
200
|
+
/** @deprecated Do not wire refresh tokens to this shared key — use CRED_* instead. */
|
|
201
|
+
readonly refreshToken: `${string}_REFRESH_TOKEN`;
|
|
202
|
+
readonly apiKey: `${string}_API_KEY`;
|
|
203
|
+
};
|
|
204
|
+
/**
|
|
205
|
+
* Credential-scoped vault key: `{BASE_KEY}_{credentialId}`.
|
|
206
|
+
*
|
|
207
|
+
* This is the platform's own convention — `preferences-service` resolves a
|
|
208
|
+
* `format: 'secret'` config key to `${defaultValueSource.secretKey}_${credentialId}`
|
|
209
|
+
* on both read and write whenever the node context carries a `credentialId`.
|
|
210
|
+
* API-key connectors reuse the exact same shape so several credentials for one
|
|
211
|
+
* provider can coexist in a project/env instead of overwriting each other's
|
|
212
|
+
* shared `PROVIDER_API_KEY` entry (the same isolation OAuth gets from its
|
|
213
|
+
* per-account configKey).
|
|
214
|
+
*
|
|
215
|
+
* Idempotent when `baseSecretKey` is already scoped to the same credential.
|
|
216
|
+
*/
|
|
217
|
+
export declare const buildCredentialScopedSecretKey: (baseSecretKey: string, credentialId: string) => string;
|
|
218
|
+
/** True when a vault key already carries a `_{credentialId}` suffix. */
|
|
219
|
+
export declare const isCredentialScopedSecretKey: (secretKey: string) => boolean;
|
|
220
|
+
/** Strip `_{credentialId}` to recover the catalog/base vault key. */
|
|
221
|
+
export declare const stripCredentialScopedSecretKey: (secretKey: string) => string;
|
|
222
|
+
/** credentialId embedded in a scoped vault key, if any. */
|
|
223
|
+
export declare const credentialIdFromScopedSecretKey: (secretKey: string) => string | null;
|
|
224
|
+
/**
|
|
225
|
+
* Durable per-credential token vault keys. Used after OAuth connect so each
|
|
226
|
+
* FormBuilderCredential keeps its own token pair even when several credentials
|
|
227
|
+
* share the same published template/configKey staging path.
|
|
228
|
+
*/
|
|
229
|
+
export declare const buildCredentialOAuthTokenVaultKeys: (credentialId: string) => {
|
|
230
|
+
readonly accessToken: `${string}_ACCESS_TOKEN`;
|
|
231
|
+
readonly refreshToken: `${string}_REFRESH_TOKEN`;
|
|
232
|
+
};
|
|
233
|
+
/**
|
|
234
|
+
* Provider-scoped per-credential OAuth vault keys (e.g. OAuth callback writes
|
|
235
|
+
* `GOOGLE_GMAIL_ACCESS_TOKEN_{credentialId}` to Personal Vault).
|
|
236
|
+
*/
|
|
237
|
+
export declare const buildProviderCredentialOAuthTokenVaultKeys: (providerId: string, credentialId: string) => {
|
|
238
|
+
readonly accessToken: `${string}_ACCESS_TOKEN_${string}`;
|
|
239
|
+
readonly refreshToken: `${string}_REFRESH_TOKEN_${string}`;
|
|
240
|
+
};
|
|
241
|
+
/**
|
|
242
|
+
* Namespace-scoped per-credential OAuth vault keys (`google_gmail-app` → `GOOGLE_GMAIL_APP_*_{id}`).
|
|
243
|
+
*/
|
|
244
|
+
export declare const buildNamespaceCredentialOAuthTokenVaultKeys: (namespace: string, credentialId: string) => {
|
|
245
|
+
readonly accessToken: `${string}_ACCESS_TOKEN_${string}`;
|
|
246
|
+
readonly refreshToken: `${string}_REFRESH_TOKEN_${string}`;
|
|
247
|
+
};
|
|
248
|
+
/** True when configKey is already scoped to a FormBuilder credential account. */
|
|
249
|
+
export declare const isCredentialAccountConfigKey: (configKey: string) => boolean;
|
|
250
|
+
/** Strip `.accounts.{credentialId}` to recover the published template configKey. */
|
|
251
|
+
export declare const stripCredentialAccountConfigKey: (configKey: string) => string;
|
|
252
|
+
/** credentialId embedded in an account-scoped configKey, if any. */
|
|
253
|
+
export declare const credentialIdFromOAuthConfigKey: (configKey: string) => string | null;
|
|
254
|
+
/**
|
|
255
|
+
* Build the per-credential OAuth configKey used for connect / refresh / disconnect.
|
|
256
|
+
* Idempotent when `baseConfigKey` is already account-scoped for the same id.
|
|
257
|
+
*/
|
|
258
|
+
export declare const buildCredentialOAuthConfigKey: (baseConfigKey: string, credentialId: string) => string;
|
|
259
|
+
/** Extract the form namespace from an oauthConnector configKey path. */
|
|
260
|
+
export declare const namespaceFromOAuthConfigKey: (configKey: string) => string | null;
|
|
261
|
+
export interface SeedGeneratorOptions {
|
|
262
|
+
/**
|
|
263
|
+
* Exact namespace (== formId) per seed, aligned by index. Pass a published template's
|
|
264
|
+
* key to regenerate a form that is identity-compatible with it - same formId and the
|
|
265
|
+
* same `integrationSettings.settings.<type>.<ns>.oauthConnector` configuration keys -
|
|
266
|
+
* so stored credentials and OAuth writes keep resolving. Omitted entries fall back to
|
|
267
|
+
* the random-suffix default (new-form behavior).
|
|
268
|
+
*/
|
|
269
|
+
namespaces?: Array<string | undefined>;
|
|
270
|
+
}
|
|
271
|
+
export declare function createOAuthSeedGenerator(seeds: ProviderTemplateSeed[], options?: SeedGeneratorOptions): SampleFormGenerator;
|
|
183
272
|
export declare const buildProviderWithRefs: (provider: any, sampleNodes: any[]) => any;
|
|
184
273
|
export declare const buildMetadataSchema: (sampleNodes: any[]) => ({
|
|
185
274
|
schemaId: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authMetaDataSchema.d.ts","sourceRoot":"","sources":["../../src/utils/authMetaDataSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,aAAa,EAAyD,MAAM,QAAQ,CAAC;AAClH,OAAO,EAEH,sBAAsB,EACtB,eAAe,EACf,kBAAkB,EAClB,eAAe,EACf,kBAAkB,EAClB,iBAAiB,EACpB,MAAM,uBAAuB,CAAC;AAI/B,KAAK,mBAAmB,GAAG,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,EAAE,eAAe,CAAC,EAAE,MAAM,KAAK,GAAG,EAAE,CAAC;AAElG,
|
|
1
|
+
{"version":3,"file":"authMetaDataSchema.d.ts","sourceRoot":"","sources":["../../src/utils/authMetaDataSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,aAAa,EAAyD,MAAM,QAAQ,CAAC;AAClH,OAAO,EAEH,sBAAsB,EACtB,eAAe,EACf,kBAAkB,EAClB,eAAe,EACf,kBAAkB,EAClB,iBAAiB,EACpB,MAAM,uBAAuB,CAAC;AAI/B,KAAK,mBAAmB,GAAG,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,EAAE,eAAe,CAAC,EAAE,MAAM,KAAK,GAAG,EAAE,CAAC;AAElG,MAAM,WAAW,oBAAoB;IACjC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GAIG;AACH,eAAO,MAAM,kCAAkC,GAAI,cAAc,MAAM;;;CAMtE,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,0CAA0C,GAAI,YAAY,MAAM,EAAE,cAAc,MAAM;;;CAMlG,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,2CAA2C,GAAI,WAAW,MAAM,EAAE,cAAc,MAAM;;;CAMlG,CAAC;AAaF,iFAAiF;AACjF,eAAO,MAAM,4BAA4B,GAAI,WAAW,MAAM,KAAG,OACP,CAAC;AAE3D,oFAAoF;AACpF,eAAO,MAAM,+BAA+B,GAAI,WAAW,MAAM,KAAG,MACD,CAAC;AAEpE,oEAAoE;AACpE,eAAO,MAAM,8BAA8B,GAAI,WAAW,MAAM,KAAG,MAAM,GAAG,IAG3E,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,6BAA6B,GAAI,eAAe,MAAM,EAAE,cAAc,MAAM,KAAG,MAM3F,CAAC;AAEF,wEAAwE;AACxE,eAAO,MAAM,2BAA2B,GAAI,WAAW,MAAM,KAAG,MAAM,GAAG,IAIxE,CAAC;AAu1CF,MAAM,WAAW,oBAAoB;IACjC;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;CAC1C;AAED,wBAAgB,wBAAwB,CACpC,KAAK,EAAE,oBAAoB,EAAE,EAC7B,OAAO,GAAE,oBAAyB,GACnC,mBAAmB,CAGrB;AAqBD,eAAO,MAAM,qBAAqB,GAAI,UAAU,GAAG,EAAE,aAAa,GAAG,EAAE,QAsBtE,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,aAAa,GAAG,EAAE;;;;;;;;;;;;;IAqBrD,CAAC"}
|
|
@@ -226,7 +226,134 @@ function buildInngestNode() {
|
|
|
226
226
|
};
|
|
227
227
|
}
|
|
228
228
|
const seedCategory = seed => seed.categories[0];
|
|
229
|
+
/**
|
|
230
|
+
* uiLayout credential namespace bucket — collapses every connector category into
|
|
231
|
+
* one of three: app | llm | mcp. MCP by connectorType; LLM seeds carry connectorType
|
|
232
|
+
* 'app' but a `${id}:llm` key; everything else is an app connector.
|
|
233
|
+
*/
|
|
234
|
+
const seedCredentialNamespace = seed => seed.connectorType === 'mcp' ? 'mcp' : seed.key.endsWith(':llm') ? 'llm' : 'app';
|
|
235
|
+
/**
|
|
236
|
+
* Normalize a provider id or form namespace into a vault secret key prefix.
|
|
237
|
+
* e.g. `gmail-app-hk7zf7w9` → `GMAIL_APP_HK7ZF7W9`
|
|
238
|
+
*/
|
|
229
239
|
const toVaultPrefix = value => value.replace(/[^a-zA-Z0-9]/g, '_').toUpperCase();
|
|
240
|
+
/**
|
|
241
|
+
* Per-form-instance vault keys for non-account-specific secrets (e.g. API key fields).
|
|
242
|
+
*
|
|
243
|
+
* Do NOT use these for OAuth access/refresh tokens when multiple accounts can share
|
|
244
|
+
* one published form — connecting account B would overwrite account A's vault entry.
|
|
245
|
+
* Access/refresh live under per-credential `configKey.accounts.{id}.*` and durable
|
|
246
|
+
* `CRED_<id>_*` vault keys via syncOAuthTokensToCredentialVault.
|
|
247
|
+
*
|
|
248
|
+
* Client id/secret stay provider-scoped (shared OAuth app credentials).
|
|
249
|
+
*/
|
|
250
|
+
const buildOAuthInstanceTokenVaultKeys = namespace => {
|
|
251
|
+
const prefix = toVaultPrefix(namespace);
|
|
252
|
+
return {
|
|
253
|
+
/** @deprecated Do not wire access tokens to this shared key — use CRED_* instead. */
|
|
254
|
+
accessToken: `${prefix}_ACCESS_TOKEN`,
|
|
255
|
+
/** @deprecated Do not wire refresh tokens to this shared key — use CRED_* instead. */
|
|
256
|
+
refreshToken: `${prefix}_REFRESH_TOKEN`,
|
|
257
|
+
apiKey: `${prefix}_API_KEY`
|
|
258
|
+
};
|
|
259
|
+
};
|
|
260
|
+
/** `_{24-hex}` suffix appended to a base vault key to scope it to one credential. */
|
|
261
|
+
const CREDENTIAL_SCOPED_SECRET_KEY_RE = /_([a-fA-F0-9]{24})$/;
|
|
262
|
+
/**
|
|
263
|
+
* Credential-scoped vault key: `{BASE_KEY}_{credentialId}`.
|
|
264
|
+
*
|
|
265
|
+
* This is the platform's own convention — `preferences-service` resolves a
|
|
266
|
+
* `format: 'secret'` config key to `${defaultValueSource.secretKey}_${credentialId}`
|
|
267
|
+
* on both read and write whenever the node context carries a `credentialId`.
|
|
268
|
+
* API-key connectors reuse the exact same shape so several credentials for one
|
|
269
|
+
* provider can coexist in a project/env instead of overwriting each other's
|
|
270
|
+
* shared `PROVIDER_API_KEY` entry (the same isolation OAuth gets from its
|
|
271
|
+
* per-account configKey).
|
|
272
|
+
*
|
|
273
|
+
* Idempotent when `baseSecretKey` is already scoped to the same credential.
|
|
274
|
+
*/
|
|
275
|
+
const buildCredentialScopedSecretKey = (baseSecretKey, credentialId) => {
|
|
276
|
+
const base = stripCredentialScopedSecretKey(baseSecretKey || '');
|
|
277
|
+
if (!base || !credentialId) {
|
|
278
|
+
return base || '';
|
|
279
|
+
}
|
|
280
|
+
return `${base}_${credentialId}`;
|
|
281
|
+
};
|
|
282
|
+
/** True when a vault key already carries a `_{credentialId}` suffix. */
|
|
283
|
+
const isCredentialScopedSecretKey = secretKey => CREDENTIAL_SCOPED_SECRET_KEY_RE.test(secretKey || '');
|
|
284
|
+
/** Strip `_{credentialId}` to recover the catalog/base vault key. */
|
|
285
|
+
const stripCredentialScopedSecretKey = secretKey => (secretKey || '').replace(CREDENTIAL_SCOPED_SECRET_KEY_RE, '');
|
|
286
|
+
/** credentialId embedded in a scoped vault key, if any. */
|
|
287
|
+
const credentialIdFromScopedSecretKey = secretKey => CREDENTIAL_SCOPED_SECRET_KEY_RE.exec(secretKey || '')?.[1] || null;
|
|
288
|
+
/**
|
|
289
|
+
* Durable per-credential token vault keys. Used after OAuth connect so each
|
|
290
|
+
* FormBuilderCredential keeps its own token pair even when several credentials
|
|
291
|
+
* share the same published template/configKey staging path.
|
|
292
|
+
*/
|
|
293
|
+
const buildCredentialOAuthTokenVaultKeys = credentialId => {
|
|
294
|
+
const prefix = toVaultPrefix(`cred_${credentialId}`);
|
|
295
|
+
return {
|
|
296
|
+
accessToken: `${prefix}_ACCESS_TOKEN`,
|
|
297
|
+
refreshToken: `${prefix}_REFRESH_TOKEN`
|
|
298
|
+
};
|
|
299
|
+
};
|
|
300
|
+
/**
|
|
301
|
+
* Provider-scoped per-credential OAuth vault keys (e.g. OAuth callback writes
|
|
302
|
+
* `GOOGLE_GMAIL_ACCESS_TOKEN_{credentialId}` to Personal Vault).
|
|
303
|
+
*/
|
|
304
|
+
const buildProviderCredentialOAuthTokenVaultKeys = (providerId, credentialId) => {
|
|
305
|
+
const prefix = toVaultPrefix(providerId);
|
|
306
|
+
return {
|
|
307
|
+
accessToken: `${prefix}_ACCESS_TOKEN_${credentialId}`,
|
|
308
|
+
refreshToken: `${prefix}_REFRESH_TOKEN_${credentialId}`
|
|
309
|
+
};
|
|
310
|
+
};
|
|
311
|
+
/**
|
|
312
|
+
* Namespace-scoped per-credential OAuth vault keys (`google_gmail-app` → `GOOGLE_GMAIL_APP_*_{id}`).
|
|
313
|
+
*/
|
|
314
|
+
const buildNamespaceCredentialOAuthTokenVaultKeys = (namespace, credentialId) => {
|
|
315
|
+
const prefix = toVaultPrefix(namespace);
|
|
316
|
+
return {
|
|
317
|
+
accessToken: `${prefix}_ACCESS_TOKEN_${credentialId}`,
|
|
318
|
+
refreshToken: `${prefix}_REFRESH_TOKEN_${credentialId}`
|
|
319
|
+
};
|
|
320
|
+
};
|
|
321
|
+
/**
|
|
322
|
+
* Per-connected-account OAuth preferences path.
|
|
323
|
+
* Template: `….{namespace}.oauthConnector`
|
|
324
|
+
* Account: `….{namespace}.oauthConnector.accounts.{credentialId}`
|
|
325
|
+
*
|
|
326
|
+
* OAuth app settings (client id/secret, scopes, endpoints) are seeded from the
|
|
327
|
+
* template path onto each account path so ApplicationConnectorOAuthService can
|
|
328
|
+
* use a single configKey without a shared token staging slot.
|
|
329
|
+
*/
|
|
330
|
+
const CREDENTIAL_ACCOUNT_CONFIG_KEY_RE = /\.accounts\.([a-fA-F0-9]{24})$/;
|
|
331
|
+
/** True when configKey is already scoped to a FormBuilder credential account. */
|
|
332
|
+
const isCredentialAccountConfigKey = configKey => CREDENTIAL_ACCOUNT_CONFIG_KEY_RE.test(configKey || '');
|
|
333
|
+
/** Strip `.accounts.{credentialId}` to recover the published template configKey. */
|
|
334
|
+
const stripCredentialAccountConfigKey = configKey => (configKey || '').replace(CREDENTIAL_ACCOUNT_CONFIG_KEY_RE, '');
|
|
335
|
+
/** credentialId embedded in an account-scoped configKey, if any. */
|
|
336
|
+
const credentialIdFromOAuthConfigKey = configKey => {
|
|
337
|
+
const match = CREDENTIAL_ACCOUNT_CONFIG_KEY_RE.exec(configKey || '');
|
|
338
|
+
return match?.[1] || null;
|
|
339
|
+
};
|
|
340
|
+
/**
|
|
341
|
+
* Build the per-credential OAuth configKey used for connect / refresh / disconnect.
|
|
342
|
+
* Idempotent when `baseConfigKey` is already account-scoped for the same id.
|
|
343
|
+
*/
|
|
344
|
+
const buildCredentialOAuthConfigKey = (baseConfigKey, credentialId) => {
|
|
345
|
+
const base = stripCredentialAccountConfigKey(baseConfigKey || '').replace(/\.+$/, '');
|
|
346
|
+
if (!base || !credentialId) {
|
|
347
|
+
return base || '';
|
|
348
|
+
}
|
|
349
|
+
return `${base}.accounts.${credentialId}`;
|
|
350
|
+
};
|
|
351
|
+
/** Extract the form namespace from an oauthConnector configKey path. */
|
|
352
|
+
const namespaceFromOAuthConfigKey = configKey => {
|
|
353
|
+
const normalized = stripCredentialAccountConfigKey(configKey || '');
|
|
354
|
+
const match = /integrationSettings\.settings\.[^.]+\.([^.]+)\.oauthConnector(?:\.|$)/.exec(normalized);
|
|
355
|
+
return match?.[1] || null;
|
|
356
|
+
};
|
|
230
357
|
const seedAuthMethodDefault = seed => seed.authMethods.includes('oauth2') ? 'oauth' : seed.connectorType === 'mcp' ? 'mcp' : 'api_key';
|
|
231
358
|
/**
|
|
232
359
|
* Build a `genericType -> count` map for the given fields. Used by
|
|
@@ -264,7 +391,10 @@ const resolveFieldKey = (field, genericTypeCounts) => {
|
|
|
264
391
|
return field.name;
|
|
265
392
|
};
|
|
266
393
|
function buildPreGeneratedFormSteps(seed, namespace) {
|
|
267
|
-
|
|
394
|
+
// Shared OAuth app credentials (one client id/secret per provider).
|
|
395
|
+
const providerVaultPrefix = toVaultPrefix(seed.providerId);
|
|
396
|
+
// Per-form-instance tokens — unique namespace prevents multi-account overwrite.
|
|
397
|
+
const instanceTokenKeys = buildOAuthInstanceTokenVaultKeys(namespace);
|
|
268
398
|
const isApp = seed.connectorType === 'app';
|
|
269
399
|
const isApiKeyOnly = seedIsApiKeyOnly(seed);
|
|
270
400
|
const templateType = seedTemplateType(seed);
|
|
@@ -361,7 +491,7 @@ function buildPreGeneratedFormSteps(seed, namespace) {
|
|
|
361
491
|
useBasicAuth: seed.useBasicAuth ?? false,
|
|
362
492
|
connectorRedirectUri: '{{CLIENT_URL}}/{{CONNECTOR_ENDPOINT}}',
|
|
363
493
|
// connectorAuthMethod — present only for non-oauth connectors (matches reference forms)
|
|
364
|
-
...(
|
|
494
|
+
...(seedAuthMethodDefault(seed) !== 'oauth' ? {
|
|
365
495
|
connectorAuthMethod: seedAuthMethodDefault(seed)
|
|
366
496
|
} : {}),
|
|
367
497
|
...(seed.fields.length > 0 ? {
|
|
@@ -401,7 +531,7 @@ function buildPreGeneratedFormSteps(seed, namespace) {
|
|
|
401
531
|
defaultValueSource: {
|
|
402
532
|
type: ContributeDefaultValueSourceType.Vault,
|
|
403
533
|
secretType: 'OAUTH_CLIENT',
|
|
404
|
-
secretKey: `${
|
|
534
|
+
secretKey: `${providerVaultPrefix}_CLIENT_ID`,
|
|
405
535
|
...(isApp ? {
|
|
406
536
|
requiredReference: true
|
|
407
537
|
} : {})
|
|
@@ -420,7 +550,7 @@ function buildPreGeneratedFormSteps(seed, namespace) {
|
|
|
420
550
|
defaultValueSource: {
|
|
421
551
|
type: ContributeDefaultValueSourceType.Vault,
|
|
422
552
|
secretType: 'OAUTH_CLIENT',
|
|
423
|
-
secretKey: `${
|
|
553
|
+
secretKey: `${providerVaultPrefix}_CLIENT_SECRET`,
|
|
424
554
|
...(isApp ? {
|
|
425
555
|
requiredReference: true
|
|
426
556
|
} : {})
|
|
@@ -439,7 +569,7 @@ function buildPreGeneratedFormSteps(seed, namespace) {
|
|
|
439
569
|
defaultValueSource: {
|
|
440
570
|
type: ContributeDefaultValueSourceType.Vault,
|
|
441
571
|
secretType: 'API_KEY',
|
|
442
|
-
secretKey:
|
|
572
|
+
secretKey: instanceTokenKeys.apiKey
|
|
443
573
|
}
|
|
444
574
|
}
|
|
445
575
|
}, {
|
|
@@ -451,11 +581,16 @@ function buildPreGeneratedFormSteps(seed, namespace) {
|
|
|
451
581
|
default: '',
|
|
452
582
|
readOnly: true,
|
|
453
583
|
scope: 1 /* ConfigurationScope.APPLICATION */,
|
|
584
|
+
|
|
585
|
+
// No shared vault secretKey by default — multi-account connects would overwrite.
|
|
586
|
+
// Staging still needs a vault route: writeSettings discards format:secret when
|
|
587
|
+
// defaultValueSource is missing. Instance keys are the temporary staging slot;
|
|
588
|
+
// completeOAuth / sync(force) copies them into CRED_<credentialId>_*.
|
|
454
589
|
schemaExtensions: {
|
|
455
590
|
defaultValueSource: {
|
|
456
591
|
type: ContributeDefaultValueSourceType.Vault,
|
|
457
592
|
secretType: 'OAUTH_CLIENT',
|
|
458
|
-
secretKey:
|
|
593
|
+
secretKey: instanceTokenKeys.accessToken
|
|
459
594
|
}
|
|
460
595
|
}
|
|
461
596
|
}, {
|
|
@@ -471,7 +606,7 @@ function buildPreGeneratedFormSteps(seed, namespace) {
|
|
|
471
606
|
defaultValueSource: {
|
|
472
607
|
type: ContributeDefaultValueSourceType.Vault,
|
|
473
608
|
secretType: 'OAUTH_CLIENT',
|
|
474
|
-
secretKey:
|
|
609
|
+
secretKey: instanceTokenKeys.refreshToken
|
|
475
610
|
}
|
|
476
611
|
}
|
|
477
612
|
}, {
|
|
@@ -754,7 +889,7 @@ function buildPreGeneratedFormSteps(seed, namespace) {
|
|
|
754
889
|
useBasicAuth: seed.useBasicAuth ?? false,
|
|
755
890
|
connectorRedirectUri: '{{CLIENT_URL}}/{{CONNECTOR_ENDPOINT}}',
|
|
756
891
|
// connectorAuthMethod — present only for non-oauth connectors (matches reference forms)
|
|
757
|
-
...(
|
|
892
|
+
...(seedAuthMethodDefault(seed) !== 'oauth' ? {
|
|
758
893
|
connectorAuthMethod: seedAuthMethodDefault(seed)
|
|
759
894
|
} : {}),
|
|
760
895
|
...(seed.fields.length > 0 ? {
|
|
@@ -776,25 +911,6 @@ function buildPreGeneratedFormSteps(seed, namespace) {
|
|
|
776
911
|
}]
|
|
777
912
|
}];
|
|
778
913
|
}
|
|
779
|
-
const buildCategoryKeyLookup = () => {
|
|
780
|
-
const lookup = new Map();
|
|
781
|
-
const prefix = 'uiLayout.credential.templates.';
|
|
782
|
-
const suffix = '.value';
|
|
783
|
-
for (const [key, value] of Object.entries(CONTRIBUTION_POINTS)) {
|
|
784
|
-
if (key.startsWith(prefix) && key.endsWith(suffix)) {
|
|
785
|
-
lookup.set(value, key.slice(prefix.length, -suffix.length));
|
|
786
|
-
}
|
|
787
|
-
}
|
|
788
|
-
return lookup;
|
|
789
|
-
};
|
|
790
|
-
const CATEGORY_KEY_LOOKUP = buildCategoryKeyLookup();
|
|
791
|
-
const categoryToTemplateTypeKey = category => {
|
|
792
|
-
const key = CATEGORY_KEY_LOOKUP.get(category);
|
|
793
|
-
if (!key) {
|
|
794
|
-
throw new Error(`No contribution-point template type found for category "${category}"`);
|
|
795
|
-
}
|
|
796
|
-
return key;
|
|
797
|
-
};
|
|
798
914
|
function buildOAuthConfigurationContribution(seedsWithNamespaces) {
|
|
799
915
|
const formProperties = {
|
|
800
916
|
required: []
|
|
@@ -805,7 +921,8 @@ function buildOAuthConfigurationContribution(seedsWithNamespaces) {
|
|
|
805
921
|
seed,
|
|
806
922
|
namespace
|
|
807
923
|
} of seedsWithNamespaces) {
|
|
808
|
-
const
|
|
924
|
+
const providerVaultPrefix = toVaultPrefix(seed.providerId);
|
|
925
|
+
const instanceTokenKeys = buildOAuthInstanceTokenVaultKeys(namespace);
|
|
809
926
|
const isApp = seed.connectorType === 'app';
|
|
810
927
|
const isApiKeyOnly = seedIsApiKeyOnly(seed);
|
|
811
928
|
const templateType = seedTemplateType(seed);
|
|
@@ -867,7 +984,7 @@ function buildOAuthConfigurationContribution(seedsWithNamespaces) {
|
|
|
867
984
|
defaultValueSource: {
|
|
868
985
|
type: ContributeDefaultValueSourceType.Vault,
|
|
869
986
|
secretType: 'OAUTH_CLIENT',
|
|
870
|
-
secretKey: `${
|
|
987
|
+
secretKey: `${providerVaultPrefix}_CLIENT_ID`,
|
|
871
988
|
...(isApp ? {
|
|
872
989
|
requiredReference: true
|
|
873
990
|
} : {})
|
|
@@ -888,7 +1005,7 @@ function buildOAuthConfigurationContribution(seedsWithNamespaces) {
|
|
|
888
1005
|
defaultValueSource: {
|
|
889
1006
|
type: ContributeDefaultValueSourceType.Vault,
|
|
890
1007
|
secretType: 'OAUTH_CLIENT',
|
|
891
|
-
secretKey: `${
|
|
1008
|
+
secretKey: `${providerVaultPrefix}_CLIENT_SECRET`,
|
|
892
1009
|
...(isApp ? {
|
|
893
1010
|
requiredReference: true
|
|
894
1011
|
} : {})
|
|
@@ -909,7 +1026,7 @@ function buildOAuthConfigurationContribution(seedsWithNamespaces) {
|
|
|
909
1026
|
defaultValueSource: {
|
|
910
1027
|
type: ContributeDefaultValueSourceType.Vault,
|
|
911
1028
|
secretType: 'API_KEY',
|
|
912
|
-
secretKey:
|
|
1029
|
+
secretKey: instanceTokenKeys.apiKey
|
|
913
1030
|
}
|
|
914
1031
|
}, {
|
|
915
1032
|
'ui:widget': !seed.authMethods.includes('oauth2') ? 'password' : 'hidden',
|
|
@@ -925,10 +1042,13 @@ function buildOAuthConfigurationContribution(seedsWithNamespaces) {
|
|
|
925
1042
|
readOnly: true,
|
|
926
1043
|
writeOnly: true,
|
|
927
1044
|
scope: 1 /* ConfigurationScope.APPLICATION */,
|
|
1045
|
+
|
|
1046
|
+
// Staging vault route required — writeSettings drops format:secret
|
|
1047
|
+
// without defaultValueSource. Durable isolation is CRED_* via sync.
|
|
928
1048
|
defaultValueSource: {
|
|
929
1049
|
type: ContributeDefaultValueSourceType.Vault,
|
|
930
1050
|
secretType: 'OAUTH_CLIENT',
|
|
931
|
-
secretKey:
|
|
1051
|
+
secretKey: instanceTokenKeys.accessToken
|
|
932
1052
|
}
|
|
933
1053
|
}, {
|
|
934
1054
|
'ui:widget': 'hidden'
|
|
@@ -945,7 +1065,7 @@ function buildOAuthConfigurationContribution(seedsWithNamespaces) {
|
|
|
945
1065
|
defaultValueSource: {
|
|
946
1066
|
type: ContributeDefaultValueSourceType.Vault,
|
|
947
1067
|
secretType: 'OAUTH_CLIENT',
|
|
948
|
-
secretKey:
|
|
1068
|
+
secretKey: instanceTokenKeys.refreshToken
|
|
949
1069
|
}
|
|
950
1070
|
}, {
|
|
951
1071
|
'ui:widget': 'hidden'
|
|
@@ -1299,15 +1419,24 @@ function buildOAuthConfigurationContribution(seedsWithNamespaces) {
|
|
|
1299
1419
|
properties: formUIProperties
|
|
1300
1420
|
}];
|
|
1301
1421
|
}
|
|
1302
|
-
function generateFromSeeds(seeds, title, formIcon, formExtensionId) {
|
|
1422
|
+
function generateFromSeeds(seeds, title, formIcon, formExtensionId, options = {}) {
|
|
1303
1423
|
const allNodes = [];
|
|
1304
1424
|
const mergedUiLayoutTemplates = {};
|
|
1305
1425
|
const mergedUiLayoutUi = {};
|
|
1306
1426
|
let uiLayoutFormMetadataNode = null;
|
|
1307
1427
|
const seedsWithNamespaces = [];
|
|
1308
1428
|
seeds.forEach((seed, idx) => {
|
|
1309
|
-
|
|
1310
|
-
|
|
1429
|
+
// The namespace doubles as the formId AND flows into every configuration key
|
|
1430
|
+
// (`integrationSettings.settings.<type>.<ns>.oauthConnector…`). An explicit
|
|
1431
|
+
// namespace lets a caller regenerate the form for an ALREADY-PUBLISHED template
|
|
1432
|
+
// so the output is identity-compatible with it (same formId, same config keys);
|
|
1433
|
+
// the random default is only safe for brand-new forms.
|
|
1434
|
+
const generatedFormId = options.namespaces?.[idx] || `${sanitizeFieldKey(seed.providerId)}-${seed.connectorType}-${Math.random().toString(36).substring(2, 10)}`;
|
|
1435
|
+
// The connector's own title, with no `(APP)` marker appended. `connectorType` is
|
|
1436
|
+
// `app` for every one of the 1166 catalog connectors, so the suffix carried no
|
|
1437
|
+
// information - it just made every row in the credential picker read "… (APP)".
|
|
1438
|
+
// The type is still contributed as `connectorType` for anything that needs it.
|
|
1439
|
+
const providerTitle = seed.title;
|
|
1311
1440
|
const namespace = generatedFormId;
|
|
1312
1441
|
seedsWithNamespaces.push({
|
|
1313
1442
|
seed,
|
|
@@ -1543,13 +1672,13 @@ function generateFromSeeds(seeds, title, formIcon, formExtensionId) {
|
|
|
1543
1672
|
const credentialBasePath = CONTRIBUTION_POINTS['uiLayout.credential.path'];
|
|
1544
1673
|
const prefixedTemplates = {};
|
|
1545
1674
|
const prefixedUi = {};
|
|
1546
|
-
//
|
|
1675
|
+
// Bucket each seed into one of three credential namespaces: app | llm | mcp
|
|
1547
1676
|
const nsToCategoryMap = new Map();
|
|
1548
1677
|
seedsWithNamespaces.forEach(({
|
|
1549
1678
|
seed,
|
|
1550
1679
|
namespace
|
|
1551
1680
|
}) => {
|
|
1552
|
-
nsToCategoryMap.set(namespace,
|
|
1681
|
+
nsToCategoryMap.set(namespace, seedCredentialNamespace(seed));
|
|
1553
1682
|
});
|
|
1554
1683
|
Object.keys(mergedUiLayoutTemplates).forEach(key => {
|
|
1555
1684
|
const categoryKey = nsToCategoryMap.get(key);
|
|
@@ -1587,8 +1716,8 @@ function generateFromSeeds(seeds, title, formIcon, formExtensionId) {
|
|
|
1587
1716
|
if (!uiLayoutFormMetadataNode) return allNodes;
|
|
1588
1717
|
return [...allNodes, uiLayoutFormMetadataNode, uiLayoutFormNode, uiLayoutFormUINode];
|
|
1589
1718
|
}
|
|
1590
|
-
function createOAuthSeedGenerator(seeds) {
|
|
1591
|
-
return (title = '', formIcon = '', formExtensionId = '') => generateFromSeeds(seeds, title, formIcon, formExtensionId);
|
|
1719
|
+
function createOAuthSeedGenerator(seeds, options = {}) {
|
|
1720
|
+
return (title = '', formIcon = '', formExtensionId = '') => generateFromSeeds(seeds, title, formIcon, formExtensionId, options);
|
|
1592
1721
|
}
|
|
1593
1722
|
// create provider refs
|
|
1594
1723
|
const findRefPath = node => {
|
|
@@ -1646,4 +1775,4 @@ const buildMetadataSchema = sampleNodes => {
|
|
|
1646
1775
|
configurationNodes: entry.configurationNodes,
|
|
1647
1776
|
contributes: {}
|
|
1648
1777
|
}))];
|
|
1649
|
-
};export{buildMetadataSchema,buildProviderConfig,buildProviderSeedFromConfig,buildProviderWithRefs,createOAuthSeedGenerator};//# sourceMappingURL=authMetaDataSchema.js.map
|
|
1778
|
+
};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,
|
|
1
|
+
{"version":3,"file":"authMetaDataSchema.js","sources":["../../src/utils/authMetaDataSchema.ts"],"sourcesContent":[null],"names":[],"mappings":"6NAeA,MAAM,WAAW,GAAA,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
type JsonObject = Record<string, unknown>;
|
|
2
|
+
export interface IntegrationCommandParameter {
|
|
3
|
+
name: string;
|
|
4
|
+
schema: {
|
|
5
|
+
type: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
[key: string]: unknown;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
export interface IntegrationCommandExecution {
|
|
11
|
+
type: 'workflow';
|
|
12
|
+
namespace: string;
|
|
13
|
+
workflowSlug: string;
|
|
14
|
+
version: string;
|
|
15
|
+
paramBindings: Record<string, string>;
|
|
16
|
+
/** Parsed JSON body template. When present, the runtime resolves it via resolveInputTemplate instead of building a flat body from paramBindings. */
|
|
17
|
+
inputTemplate?: unknown;
|
|
18
|
+
}
|
|
19
|
+
export interface IntegrationCommand {
|
|
20
|
+
command: string;
|
|
21
|
+
title: string;
|
|
22
|
+
category?: string;
|
|
23
|
+
description?: string;
|
|
24
|
+
parameters: IntegrationCommandParameter[];
|
|
25
|
+
execution: IntegrationCommandExecution;
|
|
26
|
+
}
|
|
27
|
+
export interface FieldBinding {
|
|
28
|
+
userField?: string;
|
|
29
|
+
workflowNodeId?: string;
|
|
30
|
+
paramName?: string;
|
|
31
|
+
}
|
|
32
|
+
export interface ActionBinding {
|
|
33
|
+
action?: string;
|
|
34
|
+
label?: string;
|
|
35
|
+
workflow?: JsonObject;
|
|
36
|
+
fieldBindings?: FieldBinding[];
|
|
37
|
+
/** Optional JSON body template authored by the publisher; {{$user.<field>}} placeholders are filled with end-user values at run time. */
|
|
38
|
+
inputTemplate?: string;
|
|
39
|
+
}
|
|
40
|
+
export interface UserFieldDef {
|
|
41
|
+
type?: string;
|
|
42
|
+
title?: string;
|
|
43
|
+
format?: string;
|
|
44
|
+
enum?: unknown[];
|
|
45
|
+
}
|
|
46
|
+
export interface BuildActionsOptions {
|
|
47
|
+
slug: string;
|
|
48
|
+
category?: string;
|
|
49
|
+
namespace?: string;
|
|
50
|
+
userFields?: Record<string, UserFieldDef>;
|
|
51
|
+
}
|
|
52
|
+
export type MetadataSchemaEntry = {
|
|
53
|
+
schemaId?: string;
|
|
54
|
+
[key: string]: unknown;
|
|
55
|
+
};
|
|
56
|
+
export declare function parseInputTemplate(raw?: string): unknown;
|
|
57
|
+
/** Collects the user-field keys referenced as {{$user.<key>}} anywhere in a parsed template. */
|
|
58
|
+
export declare function extractTemplateUserFields(node: unknown, refs?: Set<string>): string[];
|
|
59
|
+
/**
|
|
60
|
+
* Fills {{$user.<key>}} placeholders with end-user values by walking the parsed template.
|
|
61
|
+
* A string that is exactly one placeholder is replaced with the raw typed value; placeholders
|
|
62
|
+
* embedded in a longer string are interpolated. Everything else (including workflow-native
|
|
63
|
+
* {{...}} expressions) passes through untouched.
|
|
64
|
+
*
|
|
65
|
+
* Values that the template never references are appended to the resolved root object so callers
|
|
66
|
+
* still receive them; template-authored keys always win over a same-named extra value.
|
|
67
|
+
*/
|
|
68
|
+
export declare function resolveInputTemplate(node: unknown, values: Record<string, unknown>): unknown;
|
|
69
|
+
export declare function buildParamBindings(action: ActionBinding): Record<string, string>;
|
|
70
|
+
export declare function buildCommandsFromActions(actions: ActionBinding[], opts: BuildActionsOptions): IntegrationCommand[];
|
|
71
|
+
export interface IntegrationMenuEntry {
|
|
72
|
+
command: string;
|
|
73
|
+
label: string;
|
|
74
|
+
enabled: boolean;
|
|
75
|
+
order: number;
|
|
76
|
+
}
|
|
77
|
+
export interface IntegrationMenusContributes {
|
|
78
|
+
commandPalette: IntegrationMenuEntry[];
|
|
79
|
+
}
|
|
80
|
+
export declare function buildMenusFromCommands(commands: IntegrationCommand[]): IntegrationMenusContributes;
|
|
81
|
+
export interface IntegrationConfigurationIdentity {
|
|
82
|
+
title?: string;
|
|
83
|
+
formId: string;
|
|
84
|
+
/** Identifies this template independently of formId — generated fresh if not supplied. */
|
|
85
|
+
formTemplateId?: string;
|
|
86
|
+
formExtensionId?: string;
|
|
87
|
+
description?: string;
|
|
88
|
+
projectType?: string;
|
|
89
|
+
tags?: string[];
|
|
90
|
+
}
|
|
91
|
+
export declare function buildIntegrationConfigurationContribution(userFields: Record<string, UserFieldDef>, slug: string, identity?: IntegrationConfigurationIdentity): Record<string, unknown>[];
|
|
92
|
+
export declare function extractUserFieldsFromStepperFormMetadata(metadataSchema: MetadataSchemaEntry[], stepKey?: string): Record<string, UserFieldDef>;
|
|
93
|
+
export {};
|
|
94
|
+
//# sourceMappingURL=integrationCommands.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"integrationCommands.d.ts","sourceRoot":"","sources":["../../src/utils/integrationCommands.ts"],"names":[],"mappings":"AAEA,KAAK,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE1C,MAAM,WAAW,2BAA2B;IACxC,IAAI,EA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AA0F;IAC1F,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,wBAAgB,yCAAyC,CACrD,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,EACxC,IAAI,EAAE,MAAM,EACZ,QAAQ,CAAC,EAAE,gCAAgC,GAC5C,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CA+E3B;AAED,wBAAgB,wCAAwC,CACpD,cAAc,EAAE,mBAAmB,EAAE,EACrC,OAAO,SAAe,GACvB,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAe9B"}
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
import {v4}from'uuid';function normalizeWorkflowSelection(workflow) {
|
|
2
|
+
if (!workflow) return {};
|
|
3
|
+
if (typeof workflow === 'string') {
|
|
4
|
+
try {
|
|
5
|
+
return JSON.parse(workflow);
|
|
6
|
+
} catch (e) {
|
|
7
|
+
return {};
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
return workflow;
|
|
11
|
+
}
|
|
12
|
+
const USER_REF = /\{\{\$user\.([\w.-]+)\}\}/g;
|
|
13
|
+
const FULL_USER_REF = /^\{\{\$user\.([\w.-]+)\}\}$/;
|
|
14
|
+
function parseInputTemplate(raw) {
|
|
15
|
+
if (!raw?.trim()) return undefined;
|
|
16
|
+
try {
|
|
17
|
+
return JSON.parse(raw);
|
|
18
|
+
} catch (e) {
|
|
19
|
+
return undefined;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
/** Collects the user-field keys referenced as {{$user.<key>}} anywhere in a parsed template. */
|
|
23
|
+
function extractTemplateUserFields(node, refs = new Set()) {
|
|
24
|
+
if (typeof node === 'string') {
|
|
25
|
+
for (const m of node.matchAll(USER_REF)) refs.add(m[1]);
|
|
26
|
+
} else if (Array.isArray(node)) {
|
|
27
|
+
node.forEach(item => extractTemplateUserFields(item, refs));
|
|
28
|
+
} else if (node && typeof node === 'object') {
|
|
29
|
+
Object.values(node).forEach(value => extractTemplateUserFields(value, refs));
|
|
30
|
+
}
|
|
31
|
+
return [...refs];
|
|
32
|
+
}
|
|
33
|
+
function fillTemplateNode(node, values) {
|
|
34
|
+
if (typeof node === 'string') {
|
|
35
|
+
const full = FULL_USER_REF.exec(node);
|
|
36
|
+
if (full) return values[full[1]];
|
|
37
|
+
return node.replace(USER_REF, (_, key) => String(values[key] ?? ''));
|
|
38
|
+
}
|
|
39
|
+
if (Array.isArray(node)) return node.map(item => fillTemplateNode(item, values));
|
|
40
|
+
if (node && typeof node === 'object') {
|
|
41
|
+
return Object.fromEntries(Object.entries(node).map(([key, value]) => [key, fillTemplateNode(value, values)]));
|
|
42
|
+
}
|
|
43
|
+
return node;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Fills {{$user.<key>}} placeholders with end-user values by walking the parsed template.
|
|
47
|
+
* A string that is exactly one placeholder is replaced with the raw typed value; placeholders
|
|
48
|
+
* embedded in a longer string are interpolated. Everything else (including workflow-native
|
|
49
|
+
* {{...}} expressions) passes through untouched.
|
|
50
|
+
*
|
|
51
|
+
* Values that the template never references are appended to the resolved root object so callers
|
|
52
|
+
* still receive them; template-authored keys always win over a same-named extra value.
|
|
53
|
+
*/
|
|
54
|
+
function resolveInputTemplate(node, values) {
|
|
55
|
+
const resolved = fillTemplateNode(node, values);
|
|
56
|
+
if (!resolved || typeof resolved !== 'object' || Array.isArray(resolved)) return resolved;
|
|
57
|
+
const referenced = new Set(extractTemplateUserFields(node));
|
|
58
|
+
const extras = Object.entries(values).filter(([key]) => !referenced.has(key) && !(key in resolved));
|
|
59
|
+
return extras.length ? {
|
|
60
|
+
...resolved,
|
|
61
|
+
...Object.fromEntries(extras)
|
|
62
|
+
} : resolved;
|
|
63
|
+
}
|
|
64
|
+
function buildParamBindings(action) {
|
|
65
|
+
const map = {};
|
|
66
|
+
(action.fieldBindings || []).forEach(binding => {
|
|
67
|
+
if (!binding.userField) return;
|
|
68
|
+
const paramKey = binding.paramName || binding.userField;
|
|
69
|
+
map[paramKey] = binding.userField;
|
|
70
|
+
});
|
|
71
|
+
return map;
|
|
72
|
+
}
|
|
73
|
+
function buildCommandsFromActions(actions, opts) {
|
|
74
|
+
return (actions || []).filter(action => !!action && !!action.action).map(action => {
|
|
75
|
+
const id = `${opts.slug}.${action.action}`;
|
|
76
|
+
const title = action.label || action.action;
|
|
77
|
+
const workflow = normalizeWorkflowSelection(action.workflow);
|
|
78
|
+
const inputTemplate = parseInputTemplate(action.inputTemplate);
|
|
79
|
+
// Template mode: parameters come from the {{$user.*}} refs, keyed by user field name.
|
|
80
|
+
const paramSources = inputTemplate ? extractTemplateUserFields(inputTemplate).map(field => ({
|
|
81
|
+
name: field,
|
|
82
|
+
userField: field
|
|
83
|
+
})) : (action.fieldBindings || []).filter(b => !!(b.paramName || b.userField)).map(b => ({
|
|
84
|
+
name: b.paramName || b.userField,
|
|
85
|
+
userField: b.userField
|
|
86
|
+
}));
|
|
87
|
+
const parameters = paramSources.map(({
|
|
88
|
+
name,
|
|
89
|
+
userField
|
|
90
|
+
}) => {
|
|
91
|
+
const source = userField && opts.userFields?.[userField] || {};
|
|
92
|
+
const schema = {
|
|
93
|
+
type: source.type || 'string'
|
|
94
|
+
};
|
|
95
|
+
if (source.title) schema.description = source.title;
|
|
96
|
+
if (source.format) schema.format = source.format;
|
|
97
|
+
if (Array.isArray(source.enum)) schema.enum = source.enum;
|
|
98
|
+
return {
|
|
99
|
+
name,
|
|
100
|
+
schema
|
|
101
|
+
};
|
|
102
|
+
});
|
|
103
|
+
const cmd = {
|
|
104
|
+
command: id,
|
|
105
|
+
title,
|
|
106
|
+
parameters,
|
|
107
|
+
execution: {
|
|
108
|
+
type: 'workflow',
|
|
109
|
+
namespace: opts.namespace || '',
|
|
110
|
+
workflowSlug: workflow.workflowSlug || '',
|
|
111
|
+
version: workflow.version || '',
|
|
112
|
+
paramBindings: inputTemplate ? Object.fromEntries(paramSources.map(({
|
|
113
|
+
name
|
|
114
|
+
}) => [name, name])) : buildParamBindings(action),
|
|
115
|
+
...(inputTemplate !== undefined ? {
|
|
116
|
+
inputTemplate
|
|
117
|
+
} : {})
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
if (opts.category) cmd.category = opts.category;
|
|
121
|
+
return cmd;
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
function buildMenusFromCommands(commands) {
|
|
125
|
+
return {
|
|
126
|
+
commandPalette: commands.map((cmd, i) => ({
|
|
127
|
+
command: cmd.command,
|
|
128
|
+
label: cmd.title,
|
|
129
|
+
enabled: true,
|
|
130
|
+
order: i + 1
|
|
131
|
+
}))
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
function buildIntegrationConfigurationContribution(userFields, slug, identity) {
|
|
135
|
+
const formProperties = {
|
|
136
|
+
required: []
|
|
137
|
+
};
|
|
138
|
+
const formUIProperties = {};
|
|
139
|
+
const basePath = `integrationSettings.settings.integrationWorkflow.${slug}`;
|
|
140
|
+
const metaPaths = new Set();
|
|
141
|
+
const baseParts = basePath.split('.');
|
|
142
|
+
for (let i = 1; i <= baseParts.length; i++) {
|
|
143
|
+
metaPaths.add(baseParts.slice(0, i).join('.'));
|
|
144
|
+
}
|
|
145
|
+
Array.from(metaPaths).sort().forEach(path => {
|
|
146
|
+
const parts = path.split('.');
|
|
147
|
+
formProperties[`${path}.meta`] = {
|
|
148
|
+
title: parts[parts.length - 1],
|
|
149
|
+
description: '',
|
|
150
|
+
type: 'object',
|
|
151
|
+
position: 0
|
|
152
|
+
};
|
|
153
|
+
formProperties[`${path}.required`] = [];
|
|
154
|
+
});
|
|
155
|
+
if (identity) {
|
|
156
|
+
formProperties[`${basePath}.title`] = {
|
|
157
|
+
type: 'string',
|
|
158
|
+
title: 'title',
|
|
159
|
+
default: identity.title || ''
|
|
160
|
+
};
|
|
161
|
+
formProperties[`${basePath}.description`] = {
|
|
162
|
+
type: 'string',
|
|
163
|
+
title: 'description',
|
|
164
|
+
default: identity.description || ''
|
|
165
|
+
};
|
|
166
|
+
formProperties[`${basePath}.projectType`] = {
|
|
167
|
+
type: 'string',
|
|
168
|
+
title: 'projectType',
|
|
169
|
+
default: identity.projectType || 'Integration'
|
|
170
|
+
};
|
|
171
|
+
formProperties[`${basePath}.tags`] = {
|
|
172
|
+
type: 'array',
|
|
173
|
+
title: 'tags',
|
|
174
|
+
items: {
|
|
175
|
+
type: 'string'
|
|
176
|
+
},
|
|
177
|
+
uniqueItems: true,
|
|
178
|
+
default: identity.tags || ['integration']
|
|
179
|
+
};
|
|
180
|
+
formProperties[`${basePath}.formId`] = {
|
|
181
|
+
type: 'string',
|
|
182
|
+
title: 'formId',
|
|
183
|
+
default: identity.formId,
|
|
184
|
+
readOnly: true
|
|
185
|
+
};
|
|
186
|
+
formProperties[`${basePath}.formTemplateId`] = {
|
|
187
|
+
type: 'string',
|
|
188
|
+
title: 'formTemplateId',
|
|
189
|
+
default: identity.formTemplateId || v4(),
|
|
190
|
+
readOnly: true
|
|
191
|
+
};
|
|
192
|
+
formProperties[`${basePath}.formExtensionId`] = {
|
|
193
|
+
type: 'string',
|
|
194
|
+
title: 'formExtensionId',
|
|
195
|
+
default: identity.formExtensionId || '',
|
|
196
|
+
readOnly: true
|
|
197
|
+
};
|
|
198
|
+
formUIProperties[`${basePath}.formId`] = {
|
|
199
|
+
'ui:readonly': true
|
|
200
|
+
};
|
|
201
|
+
formUIProperties[`${basePath}.formTemplateId`] = {
|
|
202
|
+
'ui:readonly': true
|
|
203
|
+
};
|
|
204
|
+
formUIProperties[`${basePath}.formExtensionId`] = {
|
|
205
|
+
'ui:readonly': true
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
Object.entries(userFields).forEach(([key, def]) => {
|
|
209
|
+
formProperties[`${basePath}.${key}`] = {
|
|
210
|
+
type: def.type || 'string',
|
|
211
|
+
title: def.title || key,
|
|
212
|
+
...(def.format ? {
|
|
213
|
+
format: def.format
|
|
214
|
+
} : {}),
|
|
215
|
+
...(Array.isArray(def.enum) ? {
|
|
216
|
+
enum: def.enum
|
|
217
|
+
} : {})
|
|
218
|
+
};
|
|
219
|
+
});
|
|
220
|
+
return [{
|
|
221
|
+
type: 'form-metadata',
|
|
222
|
+
properties: {
|
|
223
|
+
schemaId: 'configuration'
|
|
224
|
+
}
|
|
225
|
+
}, {
|
|
226
|
+
type: 'form',
|
|
227
|
+
properties: formProperties
|
|
228
|
+
}, {
|
|
229
|
+
type: 'formUI',
|
|
230
|
+
properties: formUIProperties
|
|
231
|
+
}];
|
|
232
|
+
}
|
|
233
|
+
function extractUserFieldsFromStepperFormMetadata(metadataSchema, stepKey = 'userFields') {
|
|
234
|
+
const result = {};
|
|
235
|
+
const stepper = (metadataSchema || []).find(entry => entry?.schemaId === 'stepper-form');
|
|
236
|
+
const nodes = stepper?.configurationNodes || [];
|
|
237
|
+
const formNode = nodes.find(node => node?.type === 'form');
|
|
238
|
+
const props = formNode?.properties || {};
|
|
239
|
+
const prefix = `${stepKey}.`;
|
|
240
|
+
Object.keys(props).forEach(key => {
|
|
241
|
+
if (!key.startsWith(prefix)) return;
|
|
242
|
+
const rest = key.slice(prefix.length);
|
|
243
|
+
if (rest.includes('.')) return;
|
|
244
|
+
const def = props[key] || {};
|
|
245
|
+
result[rest] = {
|
|
246
|
+
type: def.type,
|
|
247
|
+
title: def.title,
|
|
248
|
+
format: def.format,
|
|
249
|
+
enum: def.enum
|
|
250
|
+
};
|
|
251
|
+
});
|
|
252
|
+
return result;
|
|
253
|
+
}export{buildCommandsFromActions,buildIntegrationConfigurationContribution,buildMenusFromCommands,buildParamBindings,extractTemplateUserFields,extractUserFieldsFromStepperFormMetadata,parseInputTemplate,resolveInputTemplate};//# sourceMappingURL=integrationCommands.js.map
|
|
@@ -0,0 +1 @@
|
|
|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A,CAAA;IACA,MAAA,UAAc,GAAA,YAAO,CAAA,GAAA,CAAA,CAAA;AACrB,MAAA,IAAK;AACR,MAAA;AAED,KAAA,KAAA;AAqFA,MAAA,MAAA,MAAA,GAAA,6CACI,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adminide-stack/form-builder-core",
|
|
3
|
-
"version": "5.1.8-alpha.
|
|
3
|
+
"version": "5.1.8-alpha.154",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -19,12 +19,11 @@
|
|
|
19
19
|
"watch": "npm run build:lib:watch"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
|
-
"
|
|
23
|
-
"common": "5.1.8-alpha.15",
|
|
22
|
+
"common": "5.1.8-alpha.144",
|
|
24
23
|
"typescript": "^5.4.0"
|
|
25
24
|
},
|
|
26
25
|
"publishConfig": {
|
|
27
26
|
"access": "public"
|
|
28
27
|
},
|
|
29
|
-
"gitHead": "
|
|
28
|
+
"gitHead": "d23c9fa0b16d711de23a5389aeebd0bc326f496b"
|
|
30
29
|
}
|