@adminide-stack/form-builder-core 5.1.8-alpha.57 → 5.1.8-alpha.63
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/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/utils/integrationCommands.d.ts +56 -0
- package/lib/utils/integrationCommands.d.ts.map +1 -0
- package/lib/utils/integrationCommands.js +76 -0
- package/lib/utils/integrationCommands.js.map +1 -0
- package/package.json +4 -4
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{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';export{buildCommandsFromActions,buildParamBindings,extractUserFieldsFromStepperFormMetadata}from'./utils/integrationCommands.js';//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,56 @@
|
|
|
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
|
+
}
|
|
17
|
+
export interface IntegrationCommand {
|
|
18
|
+
command: string;
|
|
19
|
+
title: string;
|
|
20
|
+
category?: string;
|
|
21
|
+
description?: string;
|
|
22
|
+
parameters: IntegrationCommandParameter[];
|
|
23
|
+
execution: IntegrationCommandExecution;
|
|
24
|
+
}
|
|
25
|
+
export interface FieldBinding {
|
|
26
|
+
userField?: string;
|
|
27
|
+
workflowNodeId?: string;
|
|
28
|
+
paramName?: string;
|
|
29
|
+
}
|
|
30
|
+
export interface ActionBinding {
|
|
31
|
+
action?: string;
|
|
32
|
+
label?: string;
|
|
33
|
+
workflow?: JsonObject;
|
|
34
|
+
fieldBindings?: FieldBinding[];
|
|
35
|
+
}
|
|
36
|
+
export interface UserFieldDef {
|
|
37
|
+
type?: string;
|
|
38
|
+
title?: string;
|
|
39
|
+
format?: string;
|
|
40
|
+
enum?: unknown[];
|
|
41
|
+
}
|
|
42
|
+
export interface BuildActionsOptions {
|
|
43
|
+
slug: string;
|
|
44
|
+
category?: string;
|
|
45
|
+
namespace?: string;
|
|
46
|
+
userFields?: Record<string, UserFieldDef>;
|
|
47
|
+
}
|
|
48
|
+
export type MetadataSchemaEntry = {
|
|
49
|
+
schemaId?: string;
|
|
50
|
+
[key: string]: unknown;
|
|
51
|
+
};
|
|
52
|
+
export declare function buildParamBindings(action: ActionBinding): Record<string, string>;
|
|
53
|
+
export declare function buildCommandsFromActions(actions: ActionBinding[], opts: BuildActionsOptions): IntegrationCommand[];
|
|
54
|
+
export declare function extractUserFieldsFromStepperFormMetadata(metadataSchema: MetadataSchemaEntry[], stepKey?: string): Record<string, UserFieldDef>;
|
|
55
|
+
export {};
|
|
56
|
+
//# sourceMappingURL=integrationCommands.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"integrationCommands.d.ts","sourceRoot":"","sources":["../../src/utils/integrationCommands.ts"],"names":[],"mappings":"AAAA,KAAK,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE1C,MAAM,WAAW,2BAA2B;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE;QAAE,IAAI,EAAE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AAE,YAAY,CAAC,CAAC;CAC7C;AAED,MAAM,MAAM,mBAAmB,GAAG;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CAAE,CAAC;AAchF,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAQhF;AAED,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,aAAa,EAAE,EAAE,IAAI,EAAE,mBAAmB,GAAG,kBAAkB,EAAE,CAmClH;AAED,wBAAgB,wCAAwC,CACpD,cAAc,EAAE,mBAAmB,EAAE,EACrC,OAAO,SAAe,GACvB,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAe9B"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
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
|
+
function buildParamBindings(action) {
|
|
13
|
+
const map = {};
|
|
14
|
+
(action.fieldBindings || []).forEach(binding => {
|
|
15
|
+
if (!binding.userField) return;
|
|
16
|
+
const paramKey = binding.paramName || binding.userField;
|
|
17
|
+
map[paramKey] = binding.userField;
|
|
18
|
+
});
|
|
19
|
+
return map;
|
|
20
|
+
}
|
|
21
|
+
function buildCommandsFromActions(actions, opts) {
|
|
22
|
+
return (actions || []).filter(action => !!action && !!action.action).map(action => {
|
|
23
|
+
const id = `${opts.slug}.${action.action}`;
|
|
24
|
+
const title = action.label || action.action;
|
|
25
|
+
const workflow = normalizeWorkflowSelection(action.workflow);
|
|
26
|
+
const parameters = (action.fieldBindings || []).filter(b => !!(b.paramName || b.userField)).map(b => {
|
|
27
|
+
const name = b.paramName || b.userField;
|
|
28
|
+
const source = b.userField && opts.userFields?.[b.userField] || {};
|
|
29
|
+
const schema = {
|
|
30
|
+
type: source.type || 'string'
|
|
31
|
+
};
|
|
32
|
+
if (source.title) schema.description = source.title;
|
|
33
|
+
if (source.format) schema.format = source.format;
|
|
34
|
+
if (Array.isArray(source.enum)) schema.enum = source.enum;
|
|
35
|
+
return {
|
|
36
|
+
name,
|
|
37
|
+
schema
|
|
38
|
+
};
|
|
39
|
+
});
|
|
40
|
+
const cmd = {
|
|
41
|
+
command: id,
|
|
42
|
+
title,
|
|
43
|
+
parameters,
|
|
44
|
+
execution: {
|
|
45
|
+
type: 'workflow',
|
|
46
|
+
namespace: opts.namespace || '',
|
|
47
|
+
workflowSlug: workflow.workflowSlug || '',
|
|
48
|
+
version: workflow.version || '',
|
|
49
|
+
paramBindings: buildParamBindings(action)
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
if (opts.category) cmd.category = opts.category;
|
|
53
|
+
return cmd;
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
function extractUserFieldsFromStepperFormMetadata(metadataSchema, stepKey = 'userFields') {
|
|
57
|
+
const result = {};
|
|
58
|
+
const stepper = (metadataSchema || []).find(entry => entry?.schemaId === 'stepper-form');
|
|
59
|
+
const nodes = stepper?.configurationNodes || [];
|
|
60
|
+
const formNode = nodes.find(node => node?.type === 'form');
|
|
61
|
+
const props = formNode?.properties || {};
|
|
62
|
+
const prefix = `${stepKey}.`;
|
|
63
|
+
Object.keys(props).forEach(key => {
|
|
64
|
+
if (!key.startsWith(prefix)) return;
|
|
65
|
+
const rest = key.slice(prefix.length);
|
|
66
|
+
if (rest.includes('.')) return;
|
|
67
|
+
const def = props[key] || {};
|
|
68
|
+
result[rest] = {
|
|
69
|
+
type: def.type,
|
|
70
|
+
title: def.title,
|
|
71
|
+
format: def.format,
|
|
72
|
+
enum: def.enum
|
|
73
|
+
};
|
|
74
|
+
});
|
|
75
|
+
return result;
|
|
76
|
+
}export{buildCommandsFromActions,buildParamBindings,extractUserFieldsFromStepperFormMetadata};//# sourceMappingURL=integrationCommands.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"integrationCommands.js","sources":["../../src/utils/integrationCommands.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAA,SAAK,0BAA4B,CAAA,QAAS,EAAA;AAE1C,EAAA,IAAM,WAAW,OAAA,EAAA;MACb,eAAa,KAAA,QAAA,EAAA;AACb,IAAA,IAAA;aAAc,UAAS,CAAA,QAAA,CAAA;aAAC,CAAA,EAAA;AAAsB,MAAA,OAAI,EAAE;;AACvD,EAAA;AAED,EAAA,eAAiB;;AAEb,2BAAkB,CAAA,MAAA,EAAA;QAClB,GAAA,GAAA,EAAY;SACZ,CAAA,aAAgB,IAAA,EAAA,EAAA,OAAA,CAAA,OAAA,IAAA;AAChB,IAAA,IAAA,CAAA,OAAA,CAAa,SAAS;AACzB,IAAA,MAAA,QAAA,GAAA,OAAA,CAAA,SAAA,IAAA,OAAA,CAAA,SAAA;AAED,IAAA,aAAiB,GAAA,OAAA,CAAA,SAAkB;IAC/B;SACK;;AAEL,SAAY,wBAAS,CAAA,OAAA,EAAA,IAAA,EAAA;SACrB,CAAA,OAAY,IAAA,EAAA,EAAA,MAAA,CAAA,MAAA,IAAA,CAA2B,CAAA,MAAG,IAAA,CAAA,CAAA,MAAA,CAAA,MAAA,CAAA,CAAA,GAAA,CAAA,MAAA,IAAA;IAC1C,MAAA,EAAA,GAAW,6BAA4B,CAAA,CAAA;AAC1C,IAAA,MAAA,KAAA,GAAA,MAAA,CAAA,KAAA,IAAA,MAAA,CAAA,MAAA;AAED,IAAA,cAAiB,GAAA,0BAAY,CAAA,MAAA,CAAA,QAAA,CAAA;IACzB,MAAA,UAAY,GAAO,CAAA,MAAA,CAAA,aAAA,IAAA,EAAA,EAAA,MAAA,CAAA,CAAA,IAAA,CAAA,EAAA,CAAA,CAAA,SAAA,IAAA,CAAA,CAAA,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pha.63",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -19,12 +19,12 @@
|
|
|
19
19
|
"watch": "npm run build:lib:watch"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
|
-
"@adminide-stack/connector-catalog": "5.1.8-alpha.
|
|
23
|
-
"common": "5.1.8-alpha.
|
|
22
|
+
"@adminide-stack/connector-catalog": "5.1.8-alpha.63",
|
|
23
|
+
"common": "5.1.8-alpha.63",
|
|
24
24
|
"typescript": "^5.4.0"
|
|
25
25
|
},
|
|
26
26
|
"publishConfig": {
|
|
27
27
|
"access": "public"
|
|
28
28
|
},
|
|
29
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "81a791892b0fa1a307a37f7556f26a94550fbba6"
|
|
30
30
|
}
|