@forumviriumhelsinki/podio-mcp 2.3.0
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 +21 -0
- package/README.md +491 -0
- package/build/__tests__/integration/setup.integration.d.ts +104 -0
- package/build/__tests__/integration/setup.integration.d.ts.map +1 -0
- package/build/__tests__/integration/setup.integration.js +233 -0
- package/build/__tests__/integration/setup.integration.js.map +1 -0
- package/build/__tests__/mock-data/items-mock-data.d.ts +168 -0
- package/build/__tests__/mock-data/items-mock-data.d.ts.map +1 -0
- package/build/__tests__/mock-data/items-mock-data.js +370 -0
- package/build/__tests__/mock-data/items-mock-data.js.map +1 -0
- package/build/__tests__/mock-data/notification-mock-data.d.ts +55 -0
- package/build/__tests__/mock-data/notification-mock-data.d.ts.map +1 -0
- package/build/__tests__/mock-data/notification-mock-data.js +190 -0
- package/build/__tests__/mock-data/notification-mock-data.js.map +1 -0
- package/build/__tests__/mock-data/project-epic-mock-data.d.ts +45 -0
- package/build/__tests__/mock-data/project-epic-mock-data.d.ts.map +1 -0
- package/build/__tests__/mock-data/project-epic-mock-data.js +85 -0
- package/build/__tests__/mock-data/project-epic-mock-data.js.map +1 -0
- package/build/__tests__/mock-data/tasks-mock-data.d.ts +27 -0
- package/build/__tests__/mock-data/tasks-mock-data.d.ts.map +1 -0
- package/build/__tests__/mock-data/tasks-mock-data.js +104 -0
- package/build/__tests__/mock-data/tasks-mock-data.js.map +1 -0
- package/build/__tests__/mock-data/utility-mock-data.d.ts +19 -0
- package/build/__tests__/mock-data/utility-mock-data.d.ts.map +1 -0
- package/build/__tests__/mock-data/utility-mock-data.js +165 -0
- package/build/__tests__/mock-data/utility-mock-data.js.map +1 -0
- package/build/__tests__/setup.d.ts +8 -0
- package/build/__tests__/setup.d.ts.map +1 -0
- package/build/__tests__/setup.js +31 -0
- package/build/__tests__/setup.js.map +1 -0
- package/build/__tests__/utils/test-helpers.d.ts +110 -0
- package/build/__tests__/utils/test-helpers.d.ts.map +1 -0
- package/build/__tests__/utils/test-helpers.js +222 -0
- package/build/__tests__/utils/test-helpers.js.map +1 -0
- package/build/api/podio-api-client.d.ts +364 -0
- package/build/api/podio-api-client.d.ts.map +1 -0
- package/build/api/podio-api-client.js +696 -0
- package/build/api/podio-api-client.js.map +1 -0
- package/build/cache/app-cache.d.ts +77 -0
- package/build/cache/app-cache.d.ts.map +1 -0
- package/build/cache/app-cache.js +230 -0
- package/build/cache/app-cache.js.map +1 -0
- package/build/cache/base-cache-manager.d.ts +149 -0
- package/build/cache/base-cache-manager.d.ts.map +1 -0
- package/build/cache/base-cache-manager.js +312 -0
- package/build/cache/base-cache-manager.js.map +1 -0
- package/build/cache/cache-manager.d.ts +230 -0
- package/build/cache/cache-manager.d.ts.map +1 -0
- package/build/cache/cache-manager.js +362 -0
- package/build/cache/cache-manager.js.map +1 -0
- package/build/cache/cache-test.d.ts +9 -0
- package/build/cache/cache-test.d.ts.map +1 -0
- package/build/cache/cache-test.js +169 -0
- package/build/cache/cache-test.js.map +1 -0
- package/build/cache/index.d.ts +18 -0
- package/build/cache/index.d.ts.map +1 -0
- package/build/cache/index.js +20 -0
- package/build/cache/index.js.map +1 -0
- package/build/cache/migration-helper.d.ts +44 -0
- package/build/cache/migration-helper.d.ts.map +1 -0
- package/build/cache/migration-helper.js +235 -0
- package/build/cache/migration-helper.js.map +1 -0
- package/build/cache/project-epic-cache.d.ts +108 -0
- package/build/cache/project-epic-cache.d.ts.map +1 -0
- package/build/cache/project-epic-cache.js +278 -0
- package/build/cache/project-epic-cache.js.map +1 -0
- package/build/cache/space-members-cache.d.ts +99 -0
- package/build/cache/space-members-cache.d.ts.map +1 -0
- package/build/cache/space-members-cache.js +305 -0
- package/build/cache/space-members-cache.js.map +1 -0
- package/build/cache/storage-adapters.d.ts +100 -0
- package/build/cache/storage-adapters.d.ts.map +1 -0
- package/build/cache/storage-adapters.js +297 -0
- package/build/cache/storage-adapters.js.map +1 -0
- package/build/errors/api-errors.d.ts +52 -0
- package/build/errors/api-errors.d.ts.map +1 -0
- package/build/errors/api-errors.js +86 -0
- package/build/errors/api-errors.js.map +1 -0
- package/build/errors/auth-errors.d.ts +67 -0
- package/build/errors/auth-errors.d.ts.map +1 -0
- package/build/errors/auth-errors.js +114 -0
- package/build/errors/auth-errors.js.map +1 -0
- package/build/errors/base.d.ts +102 -0
- package/build/errors/base.d.ts.map +1 -0
- package/build/errors/base.js +131 -0
- package/build/errors/base.js.map +1 -0
- package/build/errors/cache-errors.d.ts +53 -0
- package/build/errors/cache-errors.d.ts.map +1 -0
- package/build/errors/cache-errors.js +83 -0
- package/build/errors/cache-errors.js.map +1 -0
- package/build/errors/config-errors.d.ts +58 -0
- package/build/errors/config-errors.d.ts.map +1 -0
- package/build/errors/config-errors.js +96 -0
- package/build/errors/config-errors.js.map +1 -0
- package/build/errors/index.d.ts +101 -0
- package/build/errors/index.d.ts.map +1 -0
- package/build/errors/index.js +135 -0
- package/build/errors/index.js.map +1 -0
- package/build/errors/structure-errors.d.ts +89 -0
- package/build/errors/structure-errors.d.ts.map +1 -0
- package/build/errors/structure-errors.js +182 -0
- package/build/errors/structure-errors.js.map +1 -0
- package/build/errors/validation-errors.d.ts +81 -0
- package/build/errors/validation-errors.d.ts.map +1 -0
- package/build/errors/validation-errors.js +169 -0
- package/build/errors/validation-errors.js.map +1 -0
- package/build/fields/field-mapper.d.ts +245 -0
- package/build/fields/field-mapper.d.ts.map +1 -0
- package/build/fields/field-mapper.js +404 -0
- package/build/fields/field-mapper.js.map +1 -0
- package/build/index.d.ts +550 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +1527 -0
- package/build/index.js.map +1 -0
- package/build/oauth-helper.d.ts +189 -0
- package/build/oauth-helper.d.ts.map +1 -0
- package/build/oauth-helper.js +422 -0
- package/build/oauth-helper.js.map +1 -0
- package/build/services/app-structure-service.d.ts +49 -0
- package/build/services/app-structure-service.d.ts.map +1 -0
- package/build/services/app-structure-service.js +122 -0
- package/build/services/app-structure-service.js.map +1 -0
- package/build/services/code-execution-service.d.ts +88 -0
- package/build/services/code-execution-service.d.ts.map +1 -0
- package/build/services/code-execution-service.js +342 -0
- package/build/services/code-execution-service.js.map +1 -0
- package/build/services/comment-service.d.ts +66 -0
- package/build/services/comment-service.d.ts.map +1 -0
- package/build/services/comment-service.js +139 -0
- package/build/services/comment-service.js.map +1 -0
- package/build/services/index.d.ts +16 -0
- package/build/services/index.d.ts.map +1 -0
- package/build/services/index.js +15 -0
- package/build/services/index.js.map +1 -0
- package/build/services/item-service.d.ts +104 -0
- package/build/services/item-service.d.ts.map +1 -0
- package/build/services/item-service.js +368 -0
- package/build/services/item-service.js.map +1 -0
- package/build/services/notification-service.d.ts +125 -0
- package/build/services/notification-service.d.ts.map +1 -0
- package/build/services/notification-service.js +321 -0
- package/build/services/notification-service.js.map +1 -0
- package/build/services/project-epic-service.d.ts +73 -0
- package/build/services/project-epic-service.d.ts.map +1 -0
- package/build/services/project-epic-service.js +248 -0
- package/build/services/project-epic-service.js.map +1 -0
- package/build/services/response-formatter.d.ts +190 -0
- package/build/services/response-formatter.d.ts.map +1 -0
- package/build/services/response-formatter.js +1221 -0
- package/build/services/response-formatter.js.map +1 -0
- package/build/services/search-service.d.ts +103 -0
- package/build/services/search-service.d.ts.map +1 -0
- package/build/services/search-service.js +273 -0
- package/build/services/search-service.js.map +1 -0
- package/build/services/task-service.d.ts +70 -0
- package/build/services/task-service.d.ts.map +1 -0
- package/build/services/task-service.js +156 -0
- package/build/services/task-service.js.map +1 -0
- package/build/tools/index.d.ts +8 -0
- package/build/tools/index.d.ts.map +1 -0
- package/build/tools/index.js +8 -0
- package/build/tools/index.js.map +1 -0
- package/build/tools/tool-definitions.d.ts +89 -0
- package/build/tools/tool-definitions.d.ts.map +1 -0
- package/build/tools/tool-definitions.js +1167 -0
- package/build/tools/tool-definitions.js.map +1 -0
- package/build/types/api-types.d.ts +106 -0
- package/build/types/api-types.d.ts.map +1 -0
- package/build/types/api-types.js +11 -0
- package/build/types/api-types.js.map +1 -0
- package/build/types/cache-types.d.ts +52 -0
- package/build/types/cache-types.d.ts.map +1 -0
- package/build/types/cache-types.js +12 -0
- package/build/types/cache-types.js.map +1 -0
- package/build/types/index.d.ts +31 -0
- package/build/types/index.d.ts.map +1 -0
- package/build/types/index.js +25 -0
- package/build/types/index.js.map +1 -0
- package/build/types/notification-types.d.ts +154 -0
- package/build/types/notification-types.d.ts.map +1 -0
- package/build/types/notification-types.js +7 -0
- package/build/types/notification-types.js.map +1 -0
- package/build/types/podio-types.d.ts +250 -0
- package/build/types/podio-types.d.ts.map +1 -0
- package/build/types/podio-types.js +11 -0
- package/build/types/podio-types.js.map +1 -0
- package/build/types/search-types.d.ts +188 -0
- package/build/types/search-types.d.ts.map +1 -0
- package/build/types/search-types.js +43 -0
- package/build/types/search-types.js.map +1 -0
- package/build/utils/debug.d.ts +58 -0
- package/build/utils/debug.d.ts.map +1 -0
- package/build/utils/debug.js +147 -0
- package/build/utils/debug.js.map +1 -0
- package/examples/claude-config-example.json +13 -0
- package/package.json +87 -0
- package/scripts/generate-claude-config.js +107 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation-errors.js","sourceRoot":"","sources":["../../src/errors/validation-errors.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,UAAU,EAAE,cAAc,EAAqB,MAAM,WAAW,CAAC;AAE1E;;;;;GAKG;AACH,MAAM,OAAO,oBAAqB,SAAQ,UAAU;IAClD,YACE,OAAe,EACf,OAAuB,cAAc,CAAC,yBAAyB,EAC/D,UAAwB,EAAE,EAC1B,KAAa;QAEb,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;IACvC,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,aAAa,CAAC,SAAiB,EAAE,OAAgB;QACtD,MAAM,OAAO,GAAG,OAAO;YACrB,CAAC,CAAC,mBAAmB,SAAS,mBAAmB,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AE,cAAc,CAAC,yBAAyB,EAAE;YACjF,QAAQ,EAAE;gBACR,YAAY;gBACZ,UAAU;gBACV,aAAa;aACd;SACF,CAAC,CAAC;IACL,CAAC;IAED;;;;;;OAMG;IACH,MAAM,CAAC,iBAAiB,CAAC,SAAiB,EAAE,KAAU,EAAE,MAAc;QACpE,MAAM,OAAO,GAAG,UAAU,SAAS,wBAAwB,KAAK,MAAM,MAAM,EAAE,CAAC;QAE/E,OAAO,IAAI,oBAAoB,CAAC,OAAO,EAAE,cAAc,CAAC,yBAAyB,EAAE;YACjF,QAAQ,EAAE;gBACR,SAAS;gBACT,KAAK;gBACL,MAAM;aACP;SACF,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview FieldMapper class for centralized Podio field operations
|
|
3
|
+
*
|
|
4
|
+
* This module provides a centralized, type-safe way to work with Podio fields,
|
|
5
|
+
* eliminating repeated field logic throughout the codebase. It handles field
|
|
6
|
+
* finding, value extraction, validation, and payload formatting for all
|
|
7
|
+
* supported Podio field types.
|
|
8
|
+
*
|
|
9
|
+
* @module FieldMapper
|
|
10
|
+
*/
|
|
11
|
+
import type { PodioItem, PodioField } from '../types/podio-types.js';
|
|
12
|
+
/**
|
|
13
|
+
* Supported field types in Podio
|
|
14
|
+
*/
|
|
15
|
+
export type PodioFieldType = 'text' | 'number' | 'category' | 'contact' | 'app' | 'date' | 'location' | 'progress' | 'embed' | 'image';
|
|
16
|
+
/**
|
|
17
|
+
* Configuration for field extraction operations
|
|
18
|
+
*/
|
|
19
|
+
export interface FieldExtractionConfig {
|
|
20
|
+
/** Path to navigate through nested value structures */
|
|
21
|
+
valuePath?: string[];
|
|
22
|
+
/** Default value to return if field is not found or empty */
|
|
23
|
+
defaultValue?: string;
|
|
24
|
+
/** Whether to join multiple values with separator */
|
|
25
|
+
joinMultiple?: boolean;
|
|
26
|
+
/** Separator to use when joining multiple values */
|
|
27
|
+
separator?: string;
|
|
28
|
+
/** Whether to validate field type matches expected */
|
|
29
|
+
validateType?: boolean;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Result of a field extraction operation
|
|
33
|
+
*/
|
|
34
|
+
export interface FieldExtractionResult<T = any> {
|
|
35
|
+
/** Whether the field was found */
|
|
36
|
+
found: boolean;
|
|
37
|
+
/** The extracted value */
|
|
38
|
+
value: T;
|
|
39
|
+
/** The field definition if found */
|
|
40
|
+
field?: PodioField;
|
|
41
|
+
/** Any validation warnings */
|
|
42
|
+
warnings?: string[];
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Configuration for field payload operations
|
|
46
|
+
*/
|
|
47
|
+
export interface FieldPayloadConfig {
|
|
48
|
+
/** Whether to use external_id as field key if available */
|
|
49
|
+
useExternalId?: boolean;
|
|
50
|
+
/** Whether to validate the field exists before adding */
|
|
51
|
+
validateField?: boolean;
|
|
52
|
+
/** Whether to validate the value matches field type */
|
|
53
|
+
validateValue?: boolean;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* FieldMapper provides centralized field operations for Podio items.
|
|
57
|
+
*
|
|
58
|
+
* This class eliminates repeated field logic by providing a type-safe,
|
|
59
|
+
* consistent interface for all field operations including finding fields,
|
|
60
|
+
* extracting values, and building API payloads.
|
|
61
|
+
*
|
|
62
|
+
* @example Basic field extraction
|
|
63
|
+
* ```typescript
|
|
64
|
+
* const mapper = new FieldMapper(appStructure.fields);
|
|
65
|
+
* const title = mapper.extractFieldValue(item, 'title');
|
|
66
|
+
* const status = mapper.extractCategoryText(item, 'Status');
|
|
67
|
+
* ```
|
|
68
|
+
*
|
|
69
|
+
* @example Building API payload
|
|
70
|
+
* ```typescript
|
|
71
|
+
* const payload = mapper.createPayload();
|
|
72
|
+
* mapper.addTextField(payload, 'title', 'My Task');
|
|
73
|
+
* mapper.addCategoryField(payload, 'status', 'In Progress');
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
76
|
+
export declare class FieldMapper {
|
|
77
|
+
/** Available fields in the app structure */
|
|
78
|
+
private readonly fields;
|
|
79
|
+
/** Cache for field lookups by identifier */
|
|
80
|
+
private readonly fieldCache;
|
|
81
|
+
constructor(fields: PodioField[]);
|
|
82
|
+
/**
|
|
83
|
+
* Build internal cache for faster field lookups
|
|
84
|
+
* @private
|
|
85
|
+
*/
|
|
86
|
+
private buildFieldCache;
|
|
87
|
+
/**
|
|
88
|
+
* Find a field by identifier (label, external_id, or field_id)
|
|
89
|
+
*
|
|
90
|
+
* @param identifier - Field identifier to search for
|
|
91
|
+
* @returns The field if found, undefined otherwise
|
|
92
|
+
*/
|
|
93
|
+
findField(identifier: string | number): PodioField | undefined;
|
|
94
|
+
/**
|
|
95
|
+
* Find a field by identifier with type validation
|
|
96
|
+
*
|
|
97
|
+
* @param identifier - Field identifier to search for
|
|
98
|
+
* @param expectedType - Expected field type for validation
|
|
99
|
+
* @returns The field if found and type matches
|
|
100
|
+
* @throws PodioStructureError if field not found or type mismatch
|
|
101
|
+
*/
|
|
102
|
+
findFieldWithType(identifier: string | number, expectedType: PodioFieldType): PodioField;
|
|
103
|
+
/**
|
|
104
|
+
* Find field in item by identifier
|
|
105
|
+
*
|
|
106
|
+
* @param item - Podio item to search in
|
|
107
|
+
* @param identifier - Field identifier
|
|
108
|
+
* @returns The field from the item if found
|
|
109
|
+
*/
|
|
110
|
+
findFieldInItem(item: PodioItem, identifier: string | number): PodioField | undefined;
|
|
111
|
+
/**
|
|
112
|
+
* Get field key for API operations (external_id or field_id)
|
|
113
|
+
*
|
|
114
|
+
* @param field - The field to get key for
|
|
115
|
+
* @param useExternalId - Whether to prefer external_id over field_id
|
|
116
|
+
* @returns The field key to use in API calls
|
|
117
|
+
*/
|
|
118
|
+
getFieldKey(field: PodioField, useExternalId?: boolean): string;
|
|
119
|
+
/**
|
|
120
|
+
* Extract title from a Podio item
|
|
121
|
+
*
|
|
122
|
+
* @param item - The Podio item
|
|
123
|
+
* @returns The extracted title or fallback identifier
|
|
124
|
+
*/
|
|
125
|
+
extractTitle(item: PodioItem): string;
|
|
126
|
+
/**
|
|
127
|
+
* Extract text value from any field using path-based navigation
|
|
128
|
+
*
|
|
129
|
+
* @param item - The Podio item
|
|
130
|
+
* @param identifier - Field identifier
|
|
131
|
+
* @param config - Extraction configuration
|
|
132
|
+
* @returns Extraction result with value and metadata
|
|
133
|
+
*/
|
|
134
|
+
extractFieldValue<T = string>(item: PodioItem, identifier: string | number, config?: FieldExtractionConfig): FieldExtractionResult<T>;
|
|
135
|
+
/**
|
|
136
|
+
* Extract text value from text fields
|
|
137
|
+
*
|
|
138
|
+
* @param item - The Podio item
|
|
139
|
+
* @param identifier - Field identifier
|
|
140
|
+
* @param defaultValue - Default value if not found
|
|
141
|
+
* @returns The text value or default
|
|
142
|
+
*/
|
|
143
|
+
extractTextValue(item: PodioItem, identifier: string | number, defaultValue?: string): string;
|
|
144
|
+
/**
|
|
145
|
+
* Extract category text from category fields
|
|
146
|
+
*
|
|
147
|
+
* @param item - The Podio item
|
|
148
|
+
* @param identifier - Field identifier
|
|
149
|
+
* @param defaultValue - Default value if not found
|
|
150
|
+
* @returns The category text or default
|
|
151
|
+
*/
|
|
152
|
+
extractCategoryText(item: PodioItem, identifier: string | number, defaultValue?: string): string;
|
|
153
|
+
/**
|
|
154
|
+
* Extract contact field property (name, email, etc.)
|
|
155
|
+
*
|
|
156
|
+
* @param item - The Podio item
|
|
157
|
+
* @param identifier - Field identifier
|
|
158
|
+
* @param property - Property to extract (name, mail, etc.)
|
|
159
|
+
* @param defaultValue - Default value if not found
|
|
160
|
+
* @returns The contact property or default
|
|
161
|
+
*/
|
|
162
|
+
extractContactProperty(item: PodioItem, identifier: string | number, property: string, defaultValue?: string): string;
|
|
163
|
+
/**
|
|
164
|
+
* Extract app reference field title
|
|
165
|
+
*
|
|
166
|
+
* @param item - The Podio item
|
|
167
|
+
* @param identifier - Field identifier
|
|
168
|
+
* @param defaultValue - Default value if not found
|
|
169
|
+
* @returns The referenced item title or default
|
|
170
|
+
*/
|
|
171
|
+
extractAppReferenceTitle(item: PodioItem, identifier: string | number, defaultValue?: string): string;
|
|
172
|
+
/**
|
|
173
|
+
* Create a new field payload for API operations
|
|
174
|
+
*
|
|
175
|
+
* @param config - Payload configuration
|
|
176
|
+
* @returns Empty payload object
|
|
177
|
+
*/
|
|
178
|
+
createPayload(config?: FieldPayloadConfig): Record<string, any>;
|
|
179
|
+
/**
|
|
180
|
+
* Add text field to payload
|
|
181
|
+
*
|
|
182
|
+
* @param payload - The payload object
|
|
183
|
+
* @param identifier - Field identifier
|
|
184
|
+
* @param value - Text value to set
|
|
185
|
+
* @param config - Field configuration
|
|
186
|
+
* @throws PodioStructureError if field not found
|
|
187
|
+
* @throws PodioValidationError if validation fails
|
|
188
|
+
*/
|
|
189
|
+
addTextField(payload: Record<string, any>, identifier: string | number, value: string, config?: FieldPayloadConfig): void;
|
|
190
|
+
/**
|
|
191
|
+
* Add category field to payload by option text
|
|
192
|
+
*
|
|
193
|
+
* @param payload - The payload object
|
|
194
|
+
* @param identifier - Field identifier
|
|
195
|
+
* @param optionText - Category option text
|
|
196
|
+
* @param config - Field configuration
|
|
197
|
+
* @throws PodioStructureError if field or option not found
|
|
198
|
+
*/
|
|
199
|
+
addCategoryField(payload: Record<string, any>, identifier: string | number, optionText: string, config?: FieldPayloadConfig): void;
|
|
200
|
+
/**
|
|
201
|
+
* Add contact field to payload by user ID
|
|
202
|
+
*
|
|
203
|
+
* @param payload - The payload object
|
|
204
|
+
* @param identifier - Field identifier
|
|
205
|
+
* @param userId - User ID to assign
|
|
206
|
+
* @param config - Field configuration
|
|
207
|
+
* @throws PodioStructureError if field not found
|
|
208
|
+
*/
|
|
209
|
+
addContactField(payload: Record<string, any>, identifier: string | number, userId: number, config?: FieldPayloadConfig): void;
|
|
210
|
+
/**
|
|
211
|
+
* Add app reference field to payload by item ID
|
|
212
|
+
*
|
|
213
|
+
* @param payload - The payload object
|
|
214
|
+
* @param identifier - Field identifier
|
|
215
|
+
* @param itemId - Referenced item ID
|
|
216
|
+
* @param config - Field configuration
|
|
217
|
+
* @throws PodioStructureError if field not found
|
|
218
|
+
*/
|
|
219
|
+
addAppReferenceField(payload: Record<string, any>, identifier: string | number, itemId: number, config?: FieldPayloadConfig): void;
|
|
220
|
+
/**
|
|
221
|
+
* Get all fields of a specific type
|
|
222
|
+
*
|
|
223
|
+
* @param fieldType - Type of fields to find
|
|
224
|
+
* @returns Array of fields matching the type
|
|
225
|
+
*/
|
|
226
|
+
getFieldsByType(fieldType: PodioFieldType): PodioField[];
|
|
227
|
+
/**
|
|
228
|
+
* Validate that all required fields exist in the app structure
|
|
229
|
+
*
|
|
230
|
+
* @param requiredFields - Array of field identifiers that must exist
|
|
231
|
+
* @throws PodioStructureError if any required field is missing
|
|
232
|
+
*/
|
|
233
|
+
validateRequiredFields(requiredFields: (string | number)[]): void;
|
|
234
|
+
/**
|
|
235
|
+
* Get field statistics and information
|
|
236
|
+
*
|
|
237
|
+
* @returns Statistics about the available fields
|
|
238
|
+
*/
|
|
239
|
+
getFieldStats(): {
|
|
240
|
+
totalFields: number;
|
|
241
|
+
fieldTypes: Record<string, number>;
|
|
242
|
+
fieldsWithExternalId: number;
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
//# sourceMappingURL=field-mapper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"field-mapper.d.ts","sourceRoot":"","sources":["../../src/fields/field-mapper.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAGrE;;GAEG;AACH,MAAM,MAAM,cAAc,GACtB,MAAM,GACN,QAAQ,GACR,UAAU,GACV,SAAS,GACT,KAAK,GACL,MAAM,GACN,UAAU,GACV,UAAU,GACV,OAAO,GACP,OAAO,CAAC;AAEZ;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,uDAAuD;IACv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AM,EAAE,GAAG,CAAC,EAC5B,UAAU,EAAE,MAAM,GAAG,MAAM,EAC3B,UAAU,EAAE,MAAM,EAClB,MAAM,GAAE,kBAAuB,GAC9B,IAAI;IA4BP;;;;;;;;OAQG;IACI,eAAe,CACpB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC5B,UAAU,EAAE,MAAM,GAAG,MAAM,EAC3B,MAAM,EAAE,MAAM,EACd,MAAM,GAAE,kBAAuB,GAC9B,IAAI;IAeP;;;;;;;;OAQG;IACI,oBAAoB,CACzB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC5B,UAAU,EAAE,MAAM,GAAG,MAAM,EAC3B,MAAM,EAAE,MAAM,EACd,MAAM,GAAE,kBAAuB,GAC9B,IAAI;IAeP;;;;;OAKG;IACI,eAAe,CAAC,SAAS,EAAE,cAAc,GAAG,UAAU,EAAE;IAI/D;;;;;OAKG;IACI,sBAAsB,CAAC,cAAc,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,GAAG,IAAI;IAcxE;;;;OAIG;IACI,aAAa,IAAI;QACtB,WAAW,EAAE,MAAM,CAAC;QACpB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACnC,oBAAoB,EAAE,MAAM,CAAC;KAC9B;CAiBF"}
|
|
@@ -0,0 +1,404 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview FieldMapper class for centralized Podio field operations
|
|
3
|
+
*
|
|
4
|
+
* This module provides a centralized, type-safe way to work with Podio fields,
|
|
5
|
+
* eliminating repeated field logic throughout the codebase. It handles field
|
|
6
|
+
* finding, value extraction, validation, and payload formatting for all
|
|
7
|
+
* supported Podio field types.
|
|
8
|
+
*
|
|
9
|
+
* @module FieldMapper
|
|
10
|
+
*/
|
|
11
|
+
import { PodioValidationError, PodioStructureError } from '../errors/index.js';
|
|
12
|
+
/**
|
|
13
|
+
* FieldMapper provides centralized field operations for Podio items.
|
|
14
|
+
*
|
|
15
|
+
* This class eliminates repeated field logic by providing a type-safe,
|
|
16
|
+
* consistent interface for all field operations including finding fields,
|
|
17
|
+
* extracting values, and building API payloads.
|
|
18
|
+
*
|
|
19
|
+
* @example Basic field extraction
|
|
20
|
+
* ```typescript
|
|
21
|
+
* const mapper = new FieldMapper(appStructure.fields);
|
|
22
|
+
* const title = mapper.extractFieldValue(item, 'title');
|
|
23
|
+
* const status = mapper.extractCategoryText(item, 'Status');
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* @example Building API payload
|
|
27
|
+
* ```typescript
|
|
28
|
+
* const payload = mapper.createPayload();
|
|
29
|
+
* mapper.addTextField(payload, 'title', 'My Task');
|
|
30
|
+
* mapper.addCategoryField(payload, 'status', 'In Progress');
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export class FieldMapper {
|
|
34
|
+
/** Available fields in the app structure */
|
|
35
|
+
fields;
|
|
36
|
+
/** Cache for field lookups by identifier */
|
|
37
|
+
fieldCache = new Map();
|
|
38
|
+
constructor(fields) {
|
|
39
|
+
this.fields = fields;
|
|
40
|
+
this.buildFieldCache();
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Build internal cache for faster field lookups
|
|
44
|
+
* @private
|
|
45
|
+
*/
|
|
46
|
+
buildFieldCache() {
|
|
47
|
+
for (const field of this.fields) {
|
|
48
|
+
// Cache by label (case-insensitive)
|
|
49
|
+
this.fieldCache.set(field.label.toLowerCase(), field);
|
|
50
|
+
// Cache by external_id if available (case-insensitive)
|
|
51
|
+
if (field.external_id) {
|
|
52
|
+
this.fieldCache.set(field.external_id.toLowerCase(), field);
|
|
53
|
+
}
|
|
54
|
+
// Cache by field_id as string
|
|
55
|
+
this.fieldCache.set(field.field_id.toString(), field);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Find a field by identifier (label, external_id, or field_id)
|
|
60
|
+
*
|
|
61
|
+
* @param identifier - Field identifier to search for
|
|
62
|
+
* @returns The field if found, undefined otherwise
|
|
63
|
+
*/
|
|
64
|
+
findField(identifier) {
|
|
65
|
+
const searchKey = identifier.toString().toLowerCase();
|
|
66
|
+
return this.fieldCache.get(searchKey);
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Find a field by identifier with type validation
|
|
70
|
+
*
|
|
71
|
+
* @param identifier - Field identifier to search for
|
|
72
|
+
* @param expectedType - Expected field type for validation
|
|
73
|
+
* @returns The field if found and type matches
|
|
74
|
+
* @throws PodioStructureError if field not found or type mismatch
|
|
75
|
+
*/
|
|
76
|
+
findFieldWithType(identifier, expectedType) {
|
|
77
|
+
const field = this.findField(identifier);
|
|
78
|
+
if (!field) {
|
|
79
|
+
throw PodioStructureError.fieldNotFound(identifier.toString());
|
|
80
|
+
}
|
|
81
|
+
if (field.type !== expectedType) {
|
|
82
|
+
throw PodioStructureError.fieldTypeMismatch(identifier.toString(), expectedType, field.type);
|
|
83
|
+
}
|
|
84
|
+
return field;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Find field in item by identifier
|
|
88
|
+
*
|
|
89
|
+
* @param item - Podio item to search in
|
|
90
|
+
* @param identifier - Field identifier
|
|
91
|
+
* @returns The field from the item if found
|
|
92
|
+
*/
|
|
93
|
+
findFieldInItem(item, identifier) {
|
|
94
|
+
const searchKey = identifier.toString().toLowerCase();
|
|
95
|
+
return item.fields.find((field) => field.label.toLowerCase() === searchKey ||
|
|
96
|
+
(field.external_id && field.external_id.toLowerCase() === searchKey) ||
|
|
97
|
+
field.field_id.toString() === identifier.toString());
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Get field key for API operations (external_id or field_id)
|
|
101
|
+
*
|
|
102
|
+
* @param field - The field to get key for
|
|
103
|
+
* @param useExternalId - Whether to prefer external_id over field_id
|
|
104
|
+
* @returns The field key to use in API calls
|
|
105
|
+
*/
|
|
106
|
+
getFieldKey(field, useExternalId = true) {
|
|
107
|
+
if (useExternalId && field.external_id) {
|
|
108
|
+
return field.external_id;
|
|
109
|
+
}
|
|
110
|
+
return field.field_id.toString();
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Extract title from a Podio item
|
|
114
|
+
*
|
|
115
|
+
* @param item - The Podio item
|
|
116
|
+
* @returns The extracted title or fallback identifier
|
|
117
|
+
*/
|
|
118
|
+
extractTitle(item) {
|
|
119
|
+
// Try to find title field by common identifiers
|
|
120
|
+
const titleField = this.findFieldInItem(item, 'title');
|
|
121
|
+
if (titleField && titleField.values.length > 0) {
|
|
122
|
+
const value = titleField.values[0];
|
|
123
|
+
// Handle object values with nested structure
|
|
124
|
+
if (typeof value === 'object' && value?.value) {
|
|
125
|
+
return String(value.value);
|
|
126
|
+
}
|
|
127
|
+
// Handle direct string values
|
|
128
|
+
if (typeof value === 'string') {
|
|
129
|
+
return value;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
// Fallback to item title property or generate identifier
|
|
133
|
+
return item.title || `[Untitled Item ID: ${item.item_id}]`;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Extract text value from any field using path-based navigation
|
|
137
|
+
*
|
|
138
|
+
* @param item - The Podio item
|
|
139
|
+
* @param identifier - Field identifier
|
|
140
|
+
* @param config - Extraction configuration
|
|
141
|
+
* @returns Extraction result with value and metadata
|
|
142
|
+
*/
|
|
143
|
+
extractFieldValue(item, identifier, config = {}) {
|
|
144
|
+
const { valuePath = [], defaultValue = 'N/A', joinMultiple = false, separator = '; ', validateType = false, } = config;
|
|
145
|
+
const field = this.findFieldInItem(item, identifier);
|
|
146
|
+
if (!field || field.values.length === 0) {
|
|
147
|
+
return {
|
|
148
|
+
found: false,
|
|
149
|
+
value: defaultValue,
|
|
150
|
+
warnings: field ? ['Field has no values'] : ['Field not found'],
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
// Extract values from all field values if joining multiple
|
|
154
|
+
const extractedValues = [];
|
|
155
|
+
const valuesToProcess = joinMultiple ? field.values : [field.values[0]];
|
|
156
|
+
for (const fieldValue of valuesToProcess) {
|
|
157
|
+
let currentVal = fieldValue;
|
|
158
|
+
// Navigate through value path
|
|
159
|
+
for (const key of valuePath) {
|
|
160
|
+
if (currentVal && typeof currentVal === 'object' && currentVal[key] !== undefined) {
|
|
161
|
+
currentVal = currentVal[key];
|
|
162
|
+
}
|
|
163
|
+
else {
|
|
164
|
+
currentVal = null;
|
|
165
|
+
break;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
if (currentVal !== null) {
|
|
169
|
+
extractedValues.push(currentVal);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
if (extractedValues.length === 0) {
|
|
173
|
+
return {
|
|
174
|
+
found: true,
|
|
175
|
+
value: defaultValue,
|
|
176
|
+
field,
|
|
177
|
+
warnings: ['No valid values found in field'],
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
// Return single value or joined values
|
|
181
|
+
const result = joinMultiple && extractedValues.length > 1
|
|
182
|
+
? extractedValues.join(separator)
|
|
183
|
+
: extractedValues[0];
|
|
184
|
+
return {
|
|
185
|
+
found: true,
|
|
186
|
+
value: result,
|
|
187
|
+
field,
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Extract text value from text fields
|
|
192
|
+
*
|
|
193
|
+
* @param item - The Podio item
|
|
194
|
+
* @param identifier - Field identifier
|
|
195
|
+
* @param defaultValue - Default value if not found
|
|
196
|
+
* @returns The text value or default
|
|
197
|
+
*/
|
|
198
|
+
extractTextValue(item, identifier, defaultValue = 'N/A') {
|
|
199
|
+
const result = this.extractFieldValue(item, identifier, {
|
|
200
|
+
valuePath: ['value'],
|
|
201
|
+
defaultValue,
|
|
202
|
+
});
|
|
203
|
+
return String(result.value);
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Extract category text from category fields
|
|
207
|
+
*
|
|
208
|
+
* @param item - The Podio item
|
|
209
|
+
* @param identifier - Field identifier
|
|
210
|
+
* @param defaultValue - Default value if not found
|
|
211
|
+
* @returns The category text or default
|
|
212
|
+
*/
|
|
213
|
+
extractCategoryText(item, identifier, defaultValue = 'N/A') {
|
|
214
|
+
const result = this.extractFieldValue(item, identifier, {
|
|
215
|
+
valuePath: ['value', 'text'],
|
|
216
|
+
defaultValue,
|
|
217
|
+
joinMultiple: true,
|
|
218
|
+
});
|
|
219
|
+
return String(result.value);
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Extract contact field property (name, email, etc.)
|
|
223
|
+
*
|
|
224
|
+
* @param item - The Podio item
|
|
225
|
+
* @param identifier - Field identifier
|
|
226
|
+
* @param property - Property to extract (name, mail, etc.)
|
|
227
|
+
* @param defaultValue - Default value if not found
|
|
228
|
+
* @returns The contact property or default
|
|
229
|
+
*/
|
|
230
|
+
extractContactProperty(item, identifier, property, defaultValue = 'N/A') {
|
|
231
|
+
const result = this.extractFieldValue(item, identifier, {
|
|
232
|
+
valuePath: ['value', property],
|
|
233
|
+
defaultValue,
|
|
234
|
+
joinMultiple: true,
|
|
235
|
+
});
|
|
236
|
+
return String(result.value);
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Extract app reference field title
|
|
240
|
+
*
|
|
241
|
+
* @param item - The Podio item
|
|
242
|
+
* @param identifier - Field identifier
|
|
243
|
+
* @param defaultValue - Default value if not found
|
|
244
|
+
* @returns The referenced item title or default
|
|
245
|
+
*/
|
|
246
|
+
extractAppReferenceTitle(item, identifier, defaultValue = 'N/A') {
|
|
247
|
+
const result = this.extractFieldValue(item, identifier, {
|
|
248
|
+
valuePath: ['value', 'title'],
|
|
249
|
+
defaultValue,
|
|
250
|
+
joinMultiple: true,
|
|
251
|
+
});
|
|
252
|
+
return String(result.value);
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Create a new field payload for API operations
|
|
256
|
+
*
|
|
257
|
+
* @param config - Payload configuration
|
|
258
|
+
* @returns Empty payload object
|
|
259
|
+
*/
|
|
260
|
+
createPayload(config = {}) {
|
|
261
|
+
return {};
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Add text field to payload
|
|
265
|
+
*
|
|
266
|
+
* @param payload - The payload object
|
|
267
|
+
* @param identifier - Field identifier
|
|
268
|
+
* @param value - Text value to set
|
|
269
|
+
* @param config - Field configuration
|
|
270
|
+
* @throws PodioStructureError if field not found
|
|
271
|
+
* @throws PodioValidationError if validation fails
|
|
272
|
+
*/
|
|
273
|
+
addTextField(payload, identifier, value, config = {}) {
|
|
274
|
+
const { useExternalId = true, validateField = true } = config;
|
|
275
|
+
if (validateField) {
|
|
276
|
+
const field = this.findFieldWithType(identifier, 'text');
|
|
277
|
+
const fieldKey = this.getFieldKey(field, useExternalId);
|
|
278
|
+
payload[fieldKey] = value;
|
|
279
|
+
}
|
|
280
|
+
else {
|
|
281
|
+
// Fallback mode for flexibility
|
|
282
|
+
const field = this.findField(identifier);
|
|
283
|
+
if (field) {
|
|
284
|
+
const fieldKey = this.getFieldKey(field, useExternalId);
|
|
285
|
+
payload[fieldKey] = value;
|
|
286
|
+
}
|
|
287
|
+
else {
|
|
288
|
+
throw PodioStructureError.fieldNotFound(identifier.toString());
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* Add category field to payload by option text
|
|
294
|
+
*
|
|
295
|
+
* @param payload - The payload object
|
|
296
|
+
* @param identifier - Field identifier
|
|
297
|
+
* @param optionText - Category option text
|
|
298
|
+
* @param config - Field configuration
|
|
299
|
+
* @throws PodioStructureError if field or option not found
|
|
300
|
+
*/
|
|
301
|
+
addCategoryField(payload, identifier, optionText, config = {}) {
|
|
302
|
+
const { useExternalId = true, validateField = true } = config;
|
|
303
|
+
const field = validateField
|
|
304
|
+
? this.findFieldWithType(identifier, 'category')
|
|
305
|
+
: this.findField(identifier);
|
|
306
|
+
if (!field) {
|
|
307
|
+
throw PodioStructureError.fieldNotFound(identifier.toString());
|
|
308
|
+
}
|
|
309
|
+
// Find category option by text
|
|
310
|
+
const option = field.config?.settings?.options?.find((opt) => opt.text.toLowerCase() === optionText.toLowerCase());
|
|
311
|
+
if (!option) {
|
|
312
|
+
throw PodioValidationError.invalidFieldValue(identifier.toString(), optionText, 'Category option not found');
|
|
313
|
+
}
|
|
314
|
+
const fieldKey = this.getFieldKey(field, useExternalId);
|
|
315
|
+
payload[fieldKey] = [option.id];
|
|
316
|
+
}
|
|
317
|
+
/**
|
|
318
|
+
* Add contact field to payload by user ID
|
|
319
|
+
*
|
|
320
|
+
* @param payload - The payload object
|
|
321
|
+
* @param identifier - Field identifier
|
|
322
|
+
* @param userId - User ID to assign
|
|
323
|
+
* @param config - Field configuration
|
|
324
|
+
* @throws PodioStructureError if field not found
|
|
325
|
+
*/
|
|
326
|
+
addContactField(payload, identifier, userId, config = {}) {
|
|
327
|
+
const { useExternalId = true, validateField = true } = config;
|
|
328
|
+
const field = validateField
|
|
329
|
+
? this.findFieldWithType(identifier, 'contact')
|
|
330
|
+
: this.findField(identifier);
|
|
331
|
+
if (!field) {
|
|
332
|
+
throw PodioStructureError.fieldNotFound(identifier.toString());
|
|
333
|
+
}
|
|
334
|
+
const fieldKey = this.getFieldKey(field, useExternalId);
|
|
335
|
+
payload[fieldKey] = [userId];
|
|
336
|
+
}
|
|
337
|
+
/**
|
|
338
|
+
* Add app reference field to payload by item ID
|
|
339
|
+
*
|
|
340
|
+
* @param payload - The payload object
|
|
341
|
+
* @param identifier - Field identifier
|
|
342
|
+
* @param itemId - Referenced item ID
|
|
343
|
+
* @param config - Field configuration
|
|
344
|
+
* @throws PodioStructureError if field not found
|
|
345
|
+
*/
|
|
346
|
+
addAppReferenceField(payload, identifier, itemId, config = {}) {
|
|
347
|
+
const { useExternalId = true, validateField = true } = config;
|
|
348
|
+
const field = validateField
|
|
349
|
+
? this.findFieldWithType(identifier, 'app')
|
|
350
|
+
: this.findField(identifier);
|
|
351
|
+
if (!field) {
|
|
352
|
+
throw PodioStructureError.fieldNotFound(identifier.toString());
|
|
353
|
+
}
|
|
354
|
+
const fieldKey = this.getFieldKey(field, useExternalId);
|
|
355
|
+
payload[fieldKey] = [itemId];
|
|
356
|
+
}
|
|
357
|
+
/**
|
|
358
|
+
* Get all fields of a specific type
|
|
359
|
+
*
|
|
360
|
+
* @param fieldType - Type of fields to find
|
|
361
|
+
* @returns Array of fields matching the type
|
|
362
|
+
*/
|
|
363
|
+
getFieldsByType(fieldType) {
|
|
364
|
+
return this.fields.filter((field) => field.type === fieldType);
|
|
365
|
+
}
|
|
366
|
+
/**
|
|
367
|
+
* Validate that all required fields exist in the app structure
|
|
368
|
+
*
|
|
369
|
+
* @param requiredFields - Array of field identifiers that must exist
|
|
370
|
+
* @throws PodioStructureError if any required field is missing
|
|
371
|
+
*/
|
|
372
|
+
validateRequiredFields(requiredFields) {
|
|
373
|
+
const missing = [];
|
|
374
|
+
for (const identifier of requiredFields) {
|
|
375
|
+
if (!this.findField(identifier)) {
|
|
376
|
+
missing.push(identifier.toString());
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
if (missing.length > 0) {
|
|
380
|
+
throw PodioStructureError.missingFields(missing);
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
/**
|
|
384
|
+
* Get field statistics and information
|
|
385
|
+
*
|
|
386
|
+
* @returns Statistics about the available fields
|
|
387
|
+
*/
|
|
388
|
+
getFieldStats() {
|
|
389
|
+
const fieldTypes = {};
|
|
390
|
+
let fieldsWithExternalId = 0;
|
|
391
|
+
for (const field of this.fields) {
|
|
392
|
+
fieldTypes[field.type] = (fieldTypes[field.type] || 0) + 1;
|
|
393
|
+
if (field.external_id) {
|
|
394
|
+
fieldsWithExternalId++;
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
return {
|
|
398
|
+
totalFields: this.fields.length,
|
|
399
|
+
fieldTypes,
|
|
400
|
+
fieldsWithExternalId,
|
|
401
|
+
};
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
//# sourceMappingURL=field-mapper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"field-mapper.js","sourceRoot":"","sources":["../../src/fields/field-mapper.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AA2D/E;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,OAAO,WAAW;IACtB,4CAA4C;IAC3B,MAAM,CAAe;IAEtC,4CAA4C;IAC3B,UAAU,GAAG,IAAI,GAAG,EAAsB,CAAC;IAE5D,YAAY,MAAoB;QAC9B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,eAAe,EAAE,CAAC;IACzB,CAAC;IAED;;;OAGG;IACK,eAAe;QACrB,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAChC,oCAAoC;YACpC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,WAAW,EAAE,EAAE,KAAK,CAAC,CAAC;YAEtD,uDAAuD;YACvD,IAAI,KAAK,CAAC,WAAW,EAAE,CAAC;gBACtB,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,WAAW,CAAC,WAAW,EAAE,EAAE,KAAK,CAAC,CAAC;YAC9D,CAAC;YAED,8BAA8B;YAC9B,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC,QAAQ,EAAE,EAAE,KAAK,CAAC,CAAC;QACxD,CAAC;IACH,CAAC;IAED;;;;;OAKG;IACI,SAAS,CAAC,UAA2B;QAC1C,MAAM,SAAS,GAAG,UAAU,CAAC,QAAQ,EAAE,CAAC,WAAW,EAAE,CAAC;QACtD,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IACxC,CAAC;IAED;;;;;;;OAOG;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