@twentyhq/people-data-labs 1.0.4 → 1.0.7

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.
@@ -0,0 +1,77 @@
1
+ import { defineLogicFunction, STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS } from 'twenty-sdk/define';
2
+
3
+ import { UPDATE_FIELDS_OPTION_VALUES } from 'src/constants/update-fields-option-values';
4
+ import { PDL_LOGIC_FUNCTION_CONSTANTS } from 'src/constants/universal-identifiers';
5
+ import { enrichCompaniesCore } from 'src/logic-functions/handlers/enrich-companies';
6
+ import { type EnrichInput, toBulkEnrichInput } from 'src/logic-functions/utils/to-bulk-enrich-input';
7
+
8
+ const handler = (input: EnrichInput) => {
9
+ return enrichCompaniesCore({ input: toBulkEnrichInput(input) });
10
+ }
11
+
12
+ export default defineLogicFunction({
13
+ universalIdentifier: PDL_LOGIC_FUNCTION_CONSTANTS.enrichCompanies.universalIdentifier,
14
+ name: 'enrich-companies',
15
+ description: 'Enrich one or more Company records with People Data Labs data',
16
+ timeoutSeconds: 300,
17
+ handler,
18
+ httpRouteTriggerSettings: {
19
+ path: PDL_LOGIC_FUNCTION_CONSTANTS.enrichCompanies.path,
20
+ httpMethod: 'POST',
21
+ isAuthRequired: true
22
+ },
23
+ workflowActionTriggerSettings: {
24
+ label: 'Enrich Companies',
25
+ icon: 'IconSparkles',
26
+ inputSchema: [
27
+ {
28
+ type: 'object',
29
+ properties: {
30
+ records: {
31
+ type: 'records',
32
+ objectUniversalIdentifier:
33
+ STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS.company.universalIdentifier,
34
+ label: 'Records',
35
+ },
36
+ updateFields: {
37
+ type: 'string',
38
+ label: 'Update fields',
39
+ enum: [...UPDATE_FIELDS_OPTION_VALUES],
40
+ },
41
+ },
42
+ },
43
+ ],
44
+ outputSchema: [
45
+ {
46
+ type: 'object',
47
+ properties: {
48
+ success: { type: 'boolean', label: 'Success' },
49
+ total: { type: 'number', label: 'Total' },
50
+ matched: { type: 'number', label: 'Matched' },
51
+ notFound: { type: 'number', label: 'Not Found' },
52
+ skipped: { type: 'number', label: 'Skipped' },
53
+ errored: { type: 'number', label: 'Errored' },
54
+ results: {
55
+ type: 'array',
56
+ items: {
57
+ type: 'object',
58
+ properties: {
59
+ success: { type: 'boolean', label: 'Success' },
60
+ recordId: { type: 'string', label: 'Record Id' },
61
+ status: { type: 'string', label: 'Status' },
62
+ updatedFields: {
63
+ type: 'array',
64
+ items: { type: 'string' },
65
+ label: 'Updated Fields',
66
+ },
67
+ data: { type: 'object', label: 'Data' },
68
+ message: { type: 'string', label: 'Message' },
69
+ },
70
+ },
71
+ label: 'Results',
72
+ },
73
+ },
74
+ },
75
+ ],
76
+ },
77
+ });