@open-captable-protocol/canton 0.2.230 → 0.2.232
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/dist/functions/OpenCapTable/capTable/CapTableBatch.d.ts.map +1 -1
- package/dist/functions/OpenCapTable/capTable/CapTableBatch.js +2 -4
- package/dist/functions/OpenCapTable/capTable/CapTableBatch.js.map +1 -1
- package/dist/functions/OpenCapTable/capTable/getCapTableState.d.ts.map +1 -1
- package/dist/functions/OpenCapTable/capTable/getCapTableState.js +1 -4
- package/dist/functions/OpenCapTable/capTable/getCapTableState.js.map +1 -1
- package/dist/functions/OpenCapTable/capTable/ocfToDaml.d.ts +2 -7
- package/dist/functions/OpenCapTable/capTable/ocfToDaml.d.ts.map +1 -1
- package/dist/functions/OpenCapTable/capTable/ocfToDaml.js +3 -18
- package/dist/functions/OpenCapTable/capTable/ocfToDaml.js.map +1 -1
- package/dist/functions/OpenCapTable/convertibleIssuance/createConvertibleIssuance.d.ts +1 -1
- package/dist/functions/OpenCapTable/convertibleIssuance/createConvertibleIssuance.d.ts.map +1 -1
- package/dist/functions/OpenCapTable/convertibleIssuance/createConvertibleIssuance.js +2 -4
- package/dist/functions/OpenCapTable/convertibleIssuance/createConvertibleIssuance.js.map +1 -1
- package/dist/functions/OpenCapTable/equityCompensationIssuance/createEquityCompensationIssuance.js +1 -1
- package/dist/functions/OpenCapTable/equityCompensationIssuance/createEquityCompensationIssuance.js.map +1 -1
- package/dist/functions/OpenCapTable/issuer/createIssuer.d.ts.map +1 -1
- package/dist/functions/OpenCapTable/issuer/createIssuer.js +1 -13
- package/dist/functions/OpenCapTable/issuer/createIssuer.js.map +1 -1
- package/dist/functions/OpenCapTable/issuerAuthorization/authorizeIssuer.d.ts.map +1 -1
- package/dist/functions/OpenCapTable/issuerAuthorization/authorizeIssuer.js +1 -2
- package/dist/functions/OpenCapTable/issuerAuthorization/authorizeIssuer.js.map +1 -1
- package/dist/functions/OpenCapTable/issuerAuthorization/withdrawAuthorization.d.ts.map +1 -1
- package/dist/functions/OpenCapTable/issuerAuthorization/withdrawAuthorization.js +1 -2
- package/dist/functions/OpenCapTable/issuerAuthorization/withdrawAuthorization.js.map +1 -1
- package/dist/functions/OpenCapTable/stakeholder/getStakeholderAsOcf.d.ts.map +1 -1
- package/dist/functions/OpenCapTable/stakeholder/getStakeholderAsOcf.js.map +1 -1
- package/dist/functions/OpenCapTable/stakeholder/stakeholderDataToDaml.d.ts.map +1 -1
- package/dist/functions/OpenCapTable/stakeholder/stakeholderDataToDaml.js +1 -7
- package/dist/functions/OpenCapTable/stakeholder/stakeholderDataToDaml.js.map +1 -1
- package/dist/functions/OpenCapTable/stakeholderStatusChangeEvent/damlToOcf.d.ts +2 -1
- package/dist/functions/OpenCapTable/stakeholderStatusChangeEvent/damlToOcf.d.ts.map +1 -1
- package/dist/functions/OpenCapTable/stakeholderStatusChangeEvent/damlToOcf.js +1 -9
- package/dist/functions/OpenCapTable/stakeholderStatusChangeEvent/damlToOcf.js.map +1 -1
- package/dist/functions/OpenCapTable/stakeholderStatusChangeEvent/getStakeholderStatusChangeEventAsOcf.d.ts.map +1 -1
- package/dist/functions/OpenCapTable/stakeholderStatusChangeEvent/getStakeholderStatusChangeEventAsOcf.js +1 -8
- package/dist/functions/OpenCapTable/stakeholderStatusChangeEvent/getStakeholderStatusChangeEventAsOcf.js.map +1 -1
- package/dist/functions/OpenCapTable/stockClass/stockClassDataToDaml.d.ts.map +1 -1
- package/dist/functions/OpenCapTable/stockClass/stockClassDataToDaml.js +9 -31
- package/dist/functions/OpenCapTable/stockClass/stockClassDataToDaml.js.map +1 -1
- package/dist/functions/OpenCapTable/stockClassAuthorizedSharesAdjustment/getStockClassAuthorizedSharesAdjustmentAsOcf.d.ts.map +1 -1
- package/dist/functions/OpenCapTable/stockClassAuthorizedSharesAdjustment/getStockClassAuthorizedSharesAdjustmentAsOcf.js +0 -4
- package/dist/functions/OpenCapTable/stockClassAuthorizedSharesAdjustment/getStockClassAuthorizedSharesAdjustmentAsOcf.js.map +1 -1
- package/dist/functions/OpenCapTable/stockPlan/createStockPlan.d.ts.map +1 -1
- package/dist/functions/OpenCapTable/stockPlan/createStockPlan.js +2 -6
- package/dist/functions/OpenCapTable/stockPlan/createStockPlan.js.map +1 -1
- package/dist/functions/OpenCapTable/vestingTerms/createVestingTerms.js +3 -3
- package/dist/functions/OpenCapTable/vestingTerms/createVestingTerms.js.map +1 -1
- package/dist/functions/OpenCapTable/warrantExercise/getWarrantExerciseAsOcf.js.map +1 -1
- package/dist/functions/OpenCapTable/warrantIssuance/createWarrantIssuance.d.ts +5 -5
- package/dist/functions/OpenCapTable/warrantIssuance/createWarrantIssuance.d.ts.map +1 -1
- package/dist/functions/OpenCapTable/warrantIssuance/createWarrantIssuance.js +4 -2
- package/dist/functions/OpenCapTable/warrantIssuance/createWarrantIssuance.js.map +1 -1
- package/dist/functions/OpenCapTableReports/companyValuationReport/addObserversToCompanyValuationReport.d.ts.map +1 -1
- package/dist/functions/OpenCapTableReports/companyValuationReport/addObserversToCompanyValuationReport.js +1 -2
- package/dist/functions/OpenCapTableReports/companyValuationReport/addObserversToCompanyValuationReport.js.map +1 -1
- package/dist/functions/OpenCapTableReports/companyValuationReport/createCompanyValuationReport.d.ts.map +1 -1
- package/dist/functions/OpenCapTableReports/companyValuationReport/createCompanyValuationReport.js +1 -2
- package/dist/functions/OpenCapTableReports/companyValuationReport/createCompanyValuationReport.js.map +1 -1
- package/dist/functions/OpenCapTableReports/companyValuationReport/updateCompanyValuationReport.d.ts.map +1 -1
- package/dist/functions/OpenCapTableReports/companyValuationReport/updateCompanyValuationReport.js +1 -2
- package/dist/functions/OpenCapTableReports/companyValuationReport/updateCompanyValuationReport.js.map +1 -1
- package/dist/types/native.d.ts +76 -78
- package/dist/types/native.d.ts.map +1 -1
- package/dist/utils/entityValidators.d.ts.map +1 -1
- package/dist/utils/entityValidators.js +37 -26
- package/dist/utils/entityValidators.js.map +1 -1
- package/dist/utils/enumConversions.d.ts +6 -9
- package/dist/utils/enumConversions.d.ts.map +1 -1
- package/dist/utils/enumConversions.js +21 -18
- package/dist/utils/enumConversions.js.map +1 -1
- package/dist/utils/index.d.ts +0 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +0 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/planSecurityAliases.d.ts +8 -4
- package/dist/utils/planSecurityAliases.d.ts.map +1 -1
- package/dist/utils/planSecurityAliases.js +51 -8
- package/dist/utils/planSecurityAliases.js.map +1 -1
- package/dist/utils/replicationHelpers.d.ts +0 -4
- package/dist/utils/replicationHelpers.d.ts.map +1 -1
- package/dist/utils/replicationHelpers.js +7 -9
- package/dist/utils/replicationHelpers.js.map +1 -1
- package/dist/utils/typeConversions.d.ts +32 -30
- package/dist/utils/typeConversions.d.ts.map +1 -1
- package/dist/utils/typeConversions.js +82 -90
- package/dist/utils/typeConversions.js.map +1 -1
- package/dist/utils/typeGuards.d.ts +4 -4
- package/dist/utils/typeGuards.d.ts.map +1 -1
- package/dist/utils/typeGuards.js +5 -10
- package/dist/utils/typeGuards.js.map +1 -1
- package/dist/utils/validation.d.ts +17 -17
- package/dist/utils/validation.d.ts.map +1 -1
- package/dist/utils/validation.js +48 -57
- package/dist/utils/validation.js.map +1 -1
- package/package.json +2 -2
- package/dist/utils/deprecatedFieldNormalization.d.ts +0 -881
- package/dist/utils/deprecatedFieldNormalization.d.ts.map +0 -1
- package/dist/utils/deprecatedFieldNormalization.js +0 -1462
- package/dist/utils/deprecatedFieldNormalization.js.map +0 -1
|
@@ -1,881 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Utilities for normalizing deprecated OCF fields to their current equivalents.
|
|
3
|
-
*
|
|
4
|
-
* OCF schema evolves over time, and some fields are deprecated in favor of new ones.
|
|
5
|
-
* These utilities provide type-safe normalization and verification helpers.
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* ```typescript
|
|
9
|
-
* import { normalizeSingularToArray, normalizeDeprecatedStockPlanFields } from './deprecatedFieldNormalization';
|
|
10
|
-
*
|
|
11
|
-
* // Generic singular → array normalization
|
|
12
|
-
* const stockClassIds = normalizeSingularToArray({
|
|
13
|
-
* singularValue: data.stock_class_id,
|
|
14
|
-
* arrayValue: data.stock_class_ids,
|
|
15
|
-
* });
|
|
16
|
-
*
|
|
17
|
-
* // Stock plan specific helper
|
|
18
|
-
* const normalized = normalizeDeprecatedStockPlanFields(inputData);
|
|
19
|
-
* ```
|
|
20
|
-
*/
|
|
21
|
-
import { DEFAULT_DEPRECATED_FIELDS, DEFAULT_INTERNAL_FIELDS, type OcfComparisonOptions } from './ocfComparison';
|
|
22
|
-
/**
|
|
23
|
-
* Configuration for deprecation warnings.
|
|
24
|
-
* Can be customized for testing or production environments.
|
|
25
|
-
*/
|
|
26
|
-
export interface DeprecationWarningConfig {
|
|
27
|
-
/** Whether to emit console warnings for deprecated field usage (default: true in development) */
|
|
28
|
-
enabled: boolean;
|
|
29
|
-
/** Custom warning handler (default: console.warn) */
|
|
30
|
-
handler?: (message: string, details: DeprecationDetails) => void;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Details about a deprecated field usage.
|
|
34
|
-
*/
|
|
35
|
-
export interface DeprecationDetails {
|
|
36
|
-
/** Name of the deprecated field */
|
|
37
|
-
deprecatedField: string;
|
|
38
|
-
/** Name of the replacement field */
|
|
39
|
-
replacementField: string;
|
|
40
|
-
/** The deprecated value that was provided */
|
|
41
|
-
deprecatedValue: unknown;
|
|
42
|
-
/** Context about where the deprecation occurred */
|
|
43
|
-
context?: string;
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Global deprecation warning configuration.
|
|
47
|
-
* Can be modified for testing or to customize warning behavior.
|
|
48
|
-
*/
|
|
49
|
-
export declare const deprecationWarningConfig: DeprecationWarningConfig;
|
|
50
|
-
/**
|
|
51
|
-
* Emit a deprecation warning.
|
|
52
|
-
*
|
|
53
|
-
* @param details - Details about the deprecated field usage
|
|
54
|
-
*/
|
|
55
|
-
export declare function emitDeprecationWarning(details: DeprecationDetails): void;
|
|
56
|
-
/**
|
|
57
|
-
* Parameters for normalizing a singular deprecated field to an array field.
|
|
58
|
-
*/
|
|
59
|
-
export interface SingularToArrayParams<T> {
|
|
60
|
-
/** The deprecated singular value (may be undefined) */
|
|
61
|
-
singularValue: T | undefined;
|
|
62
|
-
/** The current array value (may be undefined or empty) */
|
|
63
|
-
arrayValue: T[] | undefined;
|
|
64
|
-
/** Name of the deprecated field (for warnings) */
|
|
65
|
-
deprecatedFieldName?: string;
|
|
66
|
-
/** Name of the replacement field (for warnings) */
|
|
67
|
-
replacementFieldName?: string;
|
|
68
|
-
/** Context for the warning message */
|
|
69
|
-
context?: string;
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Normalize a deprecated singular field to an array field.
|
|
73
|
-
*
|
|
74
|
-
* When both singular and array values are provided, the array takes precedence.
|
|
75
|
-
* If the array is empty/undefined but singular has a value, wraps it in an array.
|
|
76
|
-
*
|
|
77
|
-
* @param params - Parameters for the normalization
|
|
78
|
-
* @returns The normalized array value (empty array if both inputs are empty/undefined)
|
|
79
|
-
*
|
|
80
|
-
* @example
|
|
81
|
-
* ```typescript
|
|
82
|
-
* // Only deprecated field provided
|
|
83
|
-
* normalizeSingularToArray({
|
|
84
|
-
* singularValue: 'class-1',
|
|
85
|
-
* arrayValue: undefined,
|
|
86
|
-
* }); // Returns ['class-1']
|
|
87
|
-
*
|
|
88
|
-
* // Both provided - array takes precedence
|
|
89
|
-
* normalizeSingularToArray({
|
|
90
|
-
* singularValue: 'class-1',
|
|
91
|
-
* arrayValue: ['class-2', 'class-3'],
|
|
92
|
-
* }); // Returns ['class-2', 'class-3']
|
|
93
|
-
*
|
|
94
|
-
* // Neither provided
|
|
95
|
-
* normalizeSingularToArray({
|
|
96
|
-
* singularValue: undefined,
|
|
97
|
-
* arrayValue: undefined,
|
|
98
|
-
* }); // Returns []
|
|
99
|
-
* ```
|
|
100
|
-
*/
|
|
101
|
-
export declare function normalizeSingularToArray<T>(params: SingularToArrayParams<T>): T[];
|
|
102
|
-
/**
|
|
103
|
-
* Input type that may contain deprecated stock_class_id field.
|
|
104
|
-
* This matches OCF data that may come from older schemas.
|
|
105
|
-
*
|
|
106
|
-
* Note: Fields can be null (not just undefined) when parsing JSON data from external sources.
|
|
107
|
-
*/
|
|
108
|
-
export interface StockPlanDataWithDeprecatedField {
|
|
109
|
-
/** The current array field for stock class associations */
|
|
110
|
-
stock_class_ids?: string[] | null;
|
|
111
|
-
/** @deprecated Use stock_class_ids instead. Deprecated field from older OCF versions. */
|
|
112
|
-
stock_class_id?: string | null;
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* Result of normalizing deprecated stock plan fields.
|
|
116
|
-
*/
|
|
117
|
-
export interface NormalizedStockPlanFields {
|
|
118
|
-
/** Normalized array of stock class IDs */
|
|
119
|
-
stock_class_ids: string[];
|
|
120
|
-
/** Whether a deprecated field was used */
|
|
121
|
-
usedDeprecatedField: boolean;
|
|
122
|
-
}
|
|
123
|
-
/**
|
|
124
|
-
* Normalize deprecated stock plan fields.
|
|
125
|
-
*
|
|
126
|
-
* Handles the OCF deprecation of `stock_class_id` (singular) → `stock_class_ids` (array).
|
|
127
|
-
*
|
|
128
|
-
* @param data - Stock plan data that may contain deprecated fields
|
|
129
|
-
* @param context - Optional context for deprecation warnings (e.g., "stockPlan.create")
|
|
130
|
-
* @returns Object containing normalized stock_class_ids and deprecation usage flag
|
|
131
|
-
*
|
|
132
|
-
* @example
|
|
133
|
-
* ```typescript
|
|
134
|
-
* // Old format (deprecated)
|
|
135
|
-
* const result = normalizeDeprecatedStockPlanFields({
|
|
136
|
-
* stock_class_id: 'sc-1',
|
|
137
|
-
* });
|
|
138
|
-
* // Returns { stock_class_ids: ['sc-1'], usedDeprecatedField: true }
|
|
139
|
-
*
|
|
140
|
-
* // New format
|
|
141
|
-
* const result = normalizeDeprecatedStockPlanFields({
|
|
142
|
-
* stock_class_ids: ['sc-1', 'sc-2'],
|
|
143
|
-
* });
|
|
144
|
-
* // Returns { stock_class_ids: ['sc-1', 'sc-2'], usedDeprecatedField: false }
|
|
145
|
-
* ```
|
|
146
|
-
*/
|
|
147
|
-
export declare function normalizeDeprecatedStockPlanFields(data: StockPlanDataWithDeprecatedField, context?: string): NormalizedStockPlanFields;
|
|
148
|
-
/**
|
|
149
|
-
* Input type that may contain deprecated current_relationship field.
|
|
150
|
-
*/
|
|
151
|
-
export interface StakeholderDataWithDeprecatedField {
|
|
152
|
-
/** The current array field for stakeholder relationships */
|
|
153
|
-
current_relationships?: string[] | null;
|
|
154
|
-
/** @deprecated Use current_relationships instead. */
|
|
155
|
-
current_relationship?: string | null;
|
|
156
|
-
}
|
|
157
|
-
/**
|
|
158
|
-
* Result of normalizing deprecated stakeholder fields.
|
|
159
|
-
*/
|
|
160
|
-
export interface NormalizedStakeholderFields {
|
|
161
|
-
/** Normalized array of stakeholder relationships */
|
|
162
|
-
current_relationships: string[];
|
|
163
|
-
/** Whether a deprecated field was used */
|
|
164
|
-
usedDeprecatedField: boolean;
|
|
165
|
-
}
|
|
166
|
-
/**
|
|
167
|
-
* Normalize deprecated stakeholder relationship fields to their canonical form.
|
|
168
|
-
*
|
|
169
|
-
* This helper accepts stakeholder data that may use the legacy singular
|
|
170
|
-
* `current_relationship` field or the newer array-based `current_relationships`
|
|
171
|
-
* field and returns a normalized representation plus metadata about deprecation use.
|
|
172
|
-
*
|
|
173
|
-
* Behavior:
|
|
174
|
-
* - If only `current_relationship` is provided, it is converted to a single-element
|
|
175
|
-
* `current_relationships` array and `usedDeprecatedField` is set to `true`.
|
|
176
|
-
* - If `current_relationships` is provided and non-empty, it is used as-is and
|
|
177
|
-
* `usedDeprecatedField` is set to `false`, even if `current_relationship` is
|
|
178
|
-
* also present.
|
|
179
|
-
* - If neither field is provided, `current_relationships` will be an empty array
|
|
180
|
-
* and `usedDeprecatedField` will be `false`.
|
|
181
|
-
*
|
|
182
|
-
* The input object is not mutated.
|
|
183
|
-
*
|
|
184
|
-
* @param data - Stakeholder data that may contain either the deprecated
|
|
185
|
-
* `current_relationship` field, the newer `current_relationships` field, or both.
|
|
186
|
-
* @param context - Optional human-readable context used when emitting deprecation
|
|
187
|
-
* warnings. Defaults to `"Stakeholder"` when not provided.
|
|
188
|
-
* @returns Normalized stakeholder relationship fields, including
|
|
189
|
-
* `current_relationships` (always an array) and a `usedDeprecatedField` flag
|
|
190
|
-
* indicating whether only the deprecated field was relied upon.
|
|
191
|
-
*
|
|
192
|
-
* @example
|
|
193
|
-
* ```typescript
|
|
194
|
-
* const normalized = normalizeDeprecatedStakeholderFields({
|
|
195
|
-
* current_relationship: 'EMPLOYEE',
|
|
196
|
-
* });
|
|
197
|
-
* normalized.current_relationships; // ['EMPLOYEE']
|
|
198
|
-
* normalized.usedDeprecatedField; // true
|
|
199
|
-
* ```
|
|
200
|
-
*
|
|
201
|
-
* @example
|
|
202
|
-
* ```typescript
|
|
203
|
-
* const normalized = normalizeDeprecatedStakeholderFields({
|
|
204
|
-
* current_relationship: 'ADVISOR',
|
|
205
|
-
* current_relationships: ['FOUNDER', 'DIRECTOR'],
|
|
206
|
-
* });
|
|
207
|
-
* // The array field takes precedence when both are present.
|
|
208
|
-
* normalized.current_relationships; // ['FOUNDER', 'DIRECTOR']
|
|
209
|
-
* normalized.usedDeprecatedField; // false
|
|
210
|
-
* ```
|
|
211
|
-
*/
|
|
212
|
-
export declare function normalizeDeprecatedStakeholderFields(data: StakeholderDataWithDeprecatedField, context?: string): NormalizedStakeholderFields;
|
|
213
|
-
/**
|
|
214
|
-
* Check stakeholder data for deprecated field usage without modifying the data.
|
|
215
|
-
*/
|
|
216
|
-
export declare function checkStakeholderDeprecatedFieldUsage(data: StakeholderDataWithDeprecatedField): DeprecatedFieldUsageResult;
|
|
217
|
-
/**
|
|
218
|
-
* Migrate deprecated stakeholder fields to their current equivalents.
|
|
219
|
-
*/
|
|
220
|
-
export declare function migrateStakeholderFields<T extends StakeholderDataWithDeprecatedField>(data: T): MigrationResult<Omit<T, 'current_relationship'> & {
|
|
221
|
-
current_relationships: string[];
|
|
222
|
-
}>;
|
|
223
|
-
/**
|
|
224
|
-
* Migrate deprecated fields in multiple stakeholder objects.
|
|
225
|
-
*/
|
|
226
|
-
export declare function migrateStakeholderFieldsBatch<T extends StakeholderDataWithDeprecatedField>(items: T[]): BatchMigrationResult<Omit<T, 'current_relationship'> & {
|
|
227
|
-
current_relationships: string[];
|
|
228
|
-
}>;
|
|
229
|
-
/**
|
|
230
|
-
* Input type that may contain deprecated option_grant_type field.
|
|
231
|
-
*/
|
|
232
|
-
export interface EquityCompensationIssuanceDataWithDeprecatedField {
|
|
233
|
-
/** The current compensation type field */
|
|
234
|
-
compensation_type?: string | null;
|
|
235
|
-
/** @deprecated Use compensation_type instead. */
|
|
236
|
-
option_grant_type?: string | null;
|
|
237
|
-
}
|
|
238
|
-
/**
|
|
239
|
-
* Result of normalizing deprecated equity compensation issuance fields.
|
|
240
|
-
*/
|
|
241
|
-
export interface NormalizedEquityCompensationIssuanceFields {
|
|
242
|
-
/** Normalized compensation type */
|
|
243
|
-
compensation_type: string | null;
|
|
244
|
-
/** Whether a deprecated field was used */
|
|
245
|
-
usedDeprecatedField: boolean;
|
|
246
|
-
/** The original deprecated value (if any) */
|
|
247
|
-
originalDeprecatedValue?: string;
|
|
248
|
-
}
|
|
249
|
-
/**
|
|
250
|
-
* Convert deprecated option_grant_type value to current compensation_type value.
|
|
251
|
-
*/
|
|
252
|
-
export declare function convertOptionGrantTypeToCompensationType(optionGrantType: string): string;
|
|
253
|
-
/**
|
|
254
|
-
* Normalize deprecated equity compensation issuance fields to their canonical form.
|
|
255
|
-
*
|
|
256
|
-
* This helper converts the legacy `option_grant_type` field to the current
|
|
257
|
-
* `compensation_type` field, applying value mappings as needed:
|
|
258
|
-
* - `NSO` → `OPTION_NSO`
|
|
259
|
-
* - `ISO` → `OPTION_ISO`
|
|
260
|
-
* - `INTL` → `OPTION`
|
|
261
|
-
* - Unknown values are passed through unchanged
|
|
262
|
-
*
|
|
263
|
-
* Behavior:
|
|
264
|
-
* - If only `option_grant_type` is provided, it is converted to `compensation_type`
|
|
265
|
-
* with the appropriate value mapping and `usedDeprecatedField` is set to `true`.
|
|
266
|
-
* - If `compensation_type` is provided and non-empty, it is used as-is and
|
|
267
|
-
* `usedDeprecatedField` is set to `false`, even if `option_grant_type` is
|
|
268
|
-
* also present.
|
|
269
|
-
* - If neither field is provided, `compensation_type` will be `null`.
|
|
270
|
-
*
|
|
271
|
-
* The input object is not mutated.
|
|
272
|
-
*
|
|
273
|
-
* @param data - Equity compensation issuance data that may contain either the deprecated
|
|
274
|
-
* `option_grant_type` field, the newer `compensation_type` field, or both.
|
|
275
|
-
* @param context - Optional human-readable context used when emitting deprecation
|
|
276
|
-
* warnings. Defaults to `"EquityCompensationIssuance"` when not provided.
|
|
277
|
-
* @returns Normalized fields including `compensation_type`, a `usedDeprecatedField` flag,
|
|
278
|
-
* and optionally the `originalDeprecatedValue` if conversion occurred.
|
|
279
|
-
*
|
|
280
|
-
* @example
|
|
281
|
-
* ```typescript
|
|
282
|
-
* const normalized = normalizeDeprecatedEquityCompensationIssuanceFields({
|
|
283
|
-
* option_grant_type: 'NSO',
|
|
284
|
-
* });
|
|
285
|
-
* normalized.compensation_type; // 'OPTION_NSO'
|
|
286
|
-
* normalized.usedDeprecatedField; // true
|
|
287
|
-
* normalized.originalDeprecatedValue; // 'NSO'
|
|
288
|
-
* ```
|
|
289
|
-
*
|
|
290
|
-
* @example
|
|
291
|
-
* ```typescript
|
|
292
|
-
* const normalized = normalizeDeprecatedEquityCompensationIssuanceFields({
|
|
293
|
-
* option_grant_type: 'ISO',
|
|
294
|
-
* compensation_type: 'RSU',
|
|
295
|
-
* });
|
|
296
|
-
* // The current field takes precedence when both are present.
|
|
297
|
-
* normalized.compensation_type; // 'RSU'
|
|
298
|
-
* normalized.usedDeprecatedField; // false
|
|
299
|
-
* ```
|
|
300
|
-
*/
|
|
301
|
-
export declare function normalizeDeprecatedEquityCompensationIssuanceFields(data: EquityCompensationIssuanceDataWithDeprecatedField, context?: string): NormalizedEquityCompensationIssuanceFields;
|
|
302
|
-
/**
|
|
303
|
-
* Check equity compensation issuance data for deprecated field usage.
|
|
304
|
-
*/
|
|
305
|
-
export declare function checkEquityCompensationIssuanceDeprecatedFieldUsage(data: EquityCompensationIssuanceDataWithDeprecatedField): DeprecatedFieldUsageResult;
|
|
306
|
-
/**
|
|
307
|
-
* Migrate deprecated equity compensation issuance fields.
|
|
308
|
-
*/
|
|
309
|
-
export declare function migrateEquityCompensationIssuanceFields<T extends EquityCompensationIssuanceDataWithDeprecatedField>(data: T): MigrationResult<Omit<T, 'option_grant_type'> & {
|
|
310
|
-
compensation_type: string | null;
|
|
311
|
-
}>;
|
|
312
|
-
/**
|
|
313
|
-
* Migrate deprecated fields in multiple equity compensation issuance objects.
|
|
314
|
-
*/
|
|
315
|
-
export declare function migrateEquityCompensationIssuanceFieldsBatch<T extends EquityCompensationIssuanceDataWithDeprecatedField>(items: T[]): BatchMigrationResult<Omit<T, 'option_grant_type'> & {
|
|
316
|
-
compensation_type: string | null;
|
|
317
|
-
}>;
|
|
318
|
-
/**
|
|
319
|
-
* Result of checking for deprecated field usage.
|
|
320
|
-
*/
|
|
321
|
-
export interface DeprecatedFieldUsageResult {
|
|
322
|
-
/** Whether any deprecated fields were detected */
|
|
323
|
-
hasDeprecatedFields: boolean;
|
|
324
|
-
/** List of deprecated fields that were used */
|
|
325
|
-
deprecatedFieldsUsed: string[];
|
|
326
|
-
}
|
|
327
|
-
/**
|
|
328
|
-
* Check stock plan data for deprecated field usage without modifying the data.
|
|
329
|
-
*
|
|
330
|
-
* @param data - Stock plan data to check
|
|
331
|
-
* @returns Result indicating whether deprecated fields were used
|
|
332
|
-
*
|
|
333
|
-
* @example
|
|
334
|
-
* ```typescript
|
|
335
|
-
* const result = checkStockPlanDeprecatedFieldUsage({
|
|
336
|
-
* stock_class_id: 'sc-1', // deprecated
|
|
337
|
-
* });
|
|
338
|
-
* // Returns { hasDeprecatedFields: true, deprecatedFieldsUsed: ['stock_class_id'] }
|
|
339
|
-
* ```
|
|
340
|
-
*/
|
|
341
|
-
export declare function checkStockPlanDeprecatedFieldUsage(data: StockPlanDataWithDeprecatedField): DeprecatedFieldUsageResult;
|
|
342
|
-
/**
|
|
343
|
-
* Configuration for a deprecated field mapping.
|
|
344
|
-
*/
|
|
345
|
-
export interface DeprecatedFieldMapping {
|
|
346
|
-
/** The deprecated field name */
|
|
347
|
-
deprecatedField: string;
|
|
348
|
-
/** The replacement field name */
|
|
349
|
-
replacementField: string;
|
|
350
|
-
/** The type of deprecation (singular_to_array, renamed, value_mapped, removed) */
|
|
351
|
-
deprecationType: 'singular_to_array' | 'renamed' | 'value_mapped' | 'removed';
|
|
352
|
-
/** Value mapping for 'value_mapped' deprecation type */
|
|
353
|
-
valueMap?: Record<string, string>;
|
|
354
|
-
}
|
|
355
|
-
/**
|
|
356
|
-
* Value mapping for option_grant_type -> compensation_type conversion.
|
|
357
|
-
*/
|
|
358
|
-
export declare const OPTION_GRANT_TYPE_TO_COMPENSATION_TYPE: Record<string, string>;
|
|
359
|
-
/**
|
|
360
|
-
* Known OCF deprecated field mappings.
|
|
361
|
-
* Add new deprecations here as they are discovered.
|
|
362
|
-
*/
|
|
363
|
-
export declare const OCF_DEPRECATED_FIELDS: Record<string, DeprecatedFieldMapping[]>;
|
|
364
|
-
/**
|
|
365
|
-
* Get the list of deprecated field mappings for an OCF object type.
|
|
366
|
-
*
|
|
367
|
-
* @param objectType - The OCF object type name (e.g., 'StockPlan')
|
|
368
|
-
* @returns Array of deprecated field mappings for the object type
|
|
369
|
-
*/
|
|
370
|
-
export declare function getDeprecatedFieldMappings(objectType: string): DeprecatedFieldMapping[];
|
|
371
|
-
/**
|
|
372
|
-
* Check if a specific field is deprecated for an OCF object type.
|
|
373
|
-
*
|
|
374
|
-
* @param objectType - The OCF object type name
|
|
375
|
-
* @param fieldName - The field name to check
|
|
376
|
-
* @returns The deprecation mapping if the field is deprecated, undefined otherwise
|
|
377
|
-
*/
|
|
378
|
-
export declare function getFieldDeprecation(objectType: string, fieldName: string): DeprecatedFieldMapping | undefined;
|
|
379
|
-
/**
|
|
380
|
-
* Check an object for any deprecated field usage based on known deprecations.
|
|
381
|
-
*
|
|
382
|
-
* @param objectType - The OCF object type name
|
|
383
|
-
* @param data - The object data to check
|
|
384
|
-
* @returns Result indicating which deprecated fields were used
|
|
385
|
-
*
|
|
386
|
-
* @example
|
|
387
|
-
* ```typescript
|
|
388
|
-
* const result = checkDeprecatedFields('StockPlan', {
|
|
389
|
-
* stock_class_id: 'sc-1', // deprecated
|
|
390
|
-
* plan_name: 'Equity Plan',
|
|
391
|
-
* });
|
|
392
|
-
* // Returns { hasDeprecatedFields: true, deprecatedFieldsUsed: ['stock_class_id'] }
|
|
393
|
-
* ```
|
|
394
|
-
*/
|
|
395
|
-
export declare function checkDeprecatedFields(objectType: string, data: Record<string, unknown>): DeprecatedFieldUsageResult;
|
|
396
|
-
/**
|
|
397
|
-
* Item with an identifier for tracking in batch operations.
|
|
398
|
-
*/
|
|
399
|
-
export interface IdentifiableItem {
|
|
400
|
-
/** Unique identifier for the item */
|
|
401
|
-
id?: string;
|
|
402
|
-
/** Index in the original array (for items without id) */
|
|
403
|
-
index?: number;
|
|
404
|
-
}
|
|
405
|
-
/**
|
|
406
|
-
* Result of checking a single object in a batch operation.
|
|
407
|
-
*/
|
|
408
|
-
export interface BatchItemResult extends DeprecatedFieldUsageResult {
|
|
409
|
-
/** Identifier for the item (id or index-based) */
|
|
410
|
-
itemId: string;
|
|
411
|
-
/** The object type that was checked */
|
|
412
|
-
objectType: string;
|
|
413
|
-
}
|
|
414
|
-
/**
|
|
415
|
-
* Aggregated result of checking multiple objects for deprecated field usage.
|
|
416
|
-
*/
|
|
417
|
-
export interface BatchDeprecatedFieldsResult {
|
|
418
|
-
/** Total number of objects checked */
|
|
419
|
-
totalChecked: number;
|
|
420
|
-
/** Number of objects with deprecated fields */
|
|
421
|
-
objectsWithDeprecatedFields: number;
|
|
422
|
-
/** Number of objects without deprecated fields */
|
|
423
|
-
objectsWithoutDeprecatedFields: number;
|
|
424
|
-
/** Whether any deprecated fields were found */
|
|
425
|
-
hasDeprecatedFields: boolean;
|
|
426
|
-
/** Per-item results for objects that have deprecated fields */
|
|
427
|
-
itemsWithDeprecatedFields: BatchItemResult[];
|
|
428
|
-
/** Summary of deprecated field usage by field name */
|
|
429
|
-
deprecatedFieldSummary: Record<string, number>;
|
|
430
|
-
/** Summary of deprecated field usage by object type */
|
|
431
|
-
objectTypeSummary: Record<string, {
|
|
432
|
-
total: number;
|
|
433
|
-
withDeprecated: number;
|
|
434
|
-
}>;
|
|
435
|
-
}
|
|
436
|
-
/**
|
|
437
|
-
* Input item for batch verification.
|
|
438
|
-
*/
|
|
439
|
-
export interface BatchVerificationItem {
|
|
440
|
-
/** The OCF object type (e.g., 'StockPlan') */
|
|
441
|
-
objectType: string;
|
|
442
|
-
/** The data to check */
|
|
443
|
-
data: Record<string, unknown>;
|
|
444
|
-
/** Optional identifier for the item */
|
|
445
|
-
id?: string;
|
|
446
|
-
}
|
|
447
|
-
/**
|
|
448
|
-
* Check multiple objects for deprecated field usage in a single batch operation.
|
|
449
|
-
*
|
|
450
|
-
* @param items - Array of items to check, each with objectType and data
|
|
451
|
-
* @returns Aggregated result with summary statistics and per-item details
|
|
452
|
-
*
|
|
453
|
-
* @example
|
|
454
|
-
* ```typescript
|
|
455
|
-
* const result = checkDeprecatedFieldsBatch([
|
|
456
|
-
* { objectType: 'StockPlan', data: { stock_class_id: 'sc-1', plan_name: 'Plan A' }, id: 'plan-1' },
|
|
457
|
-
* { objectType: 'StockPlan', data: { stock_class_ids: ['sc-2'], plan_name: 'Plan B' }, id: 'plan-2' },
|
|
458
|
-
* ]);
|
|
459
|
-
* // result.objectsWithDeprecatedFields === 1
|
|
460
|
-
* // result.deprecatedFieldSummary === { stock_class_id: 1 }
|
|
461
|
-
* ```
|
|
462
|
-
*/
|
|
463
|
-
export declare function checkDeprecatedFieldsBatch(items: BatchVerificationItem[]): BatchDeprecatedFieldsResult;
|
|
464
|
-
/**
|
|
465
|
-
* Check an array of objects of the same type for deprecated field usage.
|
|
466
|
-
*
|
|
467
|
-
* @param objectType - The OCF object type for all items
|
|
468
|
-
* @param items - Array of data objects to check
|
|
469
|
-
* @returns Aggregated result with summary statistics
|
|
470
|
-
*
|
|
471
|
-
* @example
|
|
472
|
-
* ```typescript
|
|
473
|
-
* const stockPlans = [
|
|
474
|
-
* { id: 'plan-1', stock_class_id: 'sc-1', plan_name: 'Plan A' },
|
|
475
|
-
* { id: 'plan-2', stock_class_ids: ['sc-2'], plan_name: 'Plan B' },
|
|
476
|
-
* ];
|
|
477
|
-
* const result = checkDeprecatedFieldsForType('StockPlan', stockPlans);
|
|
478
|
-
* ```
|
|
479
|
-
*/
|
|
480
|
-
export declare function checkDeprecatedFieldsForType(objectType: string, items: Array<Record<string, unknown>>): BatchDeprecatedFieldsResult;
|
|
481
|
-
/**
|
|
482
|
-
* Result of migrating deprecated fields in an object.
|
|
483
|
-
*/
|
|
484
|
-
export interface MigrationResult<T> {
|
|
485
|
-
/** The migrated data with deprecated fields converted to current format */
|
|
486
|
-
data: T;
|
|
487
|
-
/** Whether any migrations were performed */
|
|
488
|
-
migrated: boolean;
|
|
489
|
-
/** List of fields that were migrated */
|
|
490
|
-
migratedFields: string[];
|
|
491
|
-
/** List of warnings (e.g., both deprecated and current fields present) */
|
|
492
|
-
warnings: string[];
|
|
493
|
-
}
|
|
494
|
-
/**
|
|
495
|
-
* Migrate deprecated stock plan fields to their current equivalents.
|
|
496
|
-
*
|
|
497
|
-
* This function creates a new object with deprecated fields converted to current format.
|
|
498
|
-
* The original object is not modified.
|
|
499
|
-
*
|
|
500
|
-
* @param data - Stock plan data that may contain deprecated fields
|
|
501
|
-
* @returns Migration result with normalized data and migration details
|
|
502
|
-
*
|
|
503
|
-
* @example
|
|
504
|
-
* ```typescript
|
|
505
|
-
* const result = migrateStockPlanFields({
|
|
506
|
-
* id: 'plan-1',
|
|
507
|
-
* stock_class_id: 'sc-1', // deprecated
|
|
508
|
-
* plan_name: 'Equity Plan',
|
|
509
|
-
* });
|
|
510
|
-
* // result.data.stock_class_ids === ['sc-1']
|
|
511
|
-
* // result.migrated === true
|
|
512
|
-
* // result.migratedFields === ['stock_class_id']
|
|
513
|
-
* ```
|
|
514
|
-
*/
|
|
515
|
-
export declare function migrateStockPlanFields<T extends StockPlanDataWithDeprecatedField>(data: T): MigrationResult<Omit<T, 'stock_class_id'> & {
|
|
516
|
-
stock_class_ids: string[];
|
|
517
|
-
}>;
|
|
518
|
-
/**
|
|
519
|
-
* Batch result for migrating multiple objects.
|
|
520
|
-
*/
|
|
521
|
-
export interface BatchMigrationResult<T> {
|
|
522
|
-
/** Migrated items */
|
|
523
|
-
items: Array<MigrationResult<T>>;
|
|
524
|
-
/** Total number of items processed */
|
|
525
|
-
totalProcessed: number;
|
|
526
|
-
/** Number of items that required migration */
|
|
527
|
-
itemsMigrated: number;
|
|
528
|
-
/** Number of items with warnings */
|
|
529
|
-
itemsWithWarnings: number;
|
|
530
|
-
/** Summary of migrated fields */
|
|
531
|
-
migratedFieldsSummary: Record<string, number>;
|
|
532
|
-
}
|
|
533
|
-
/**
|
|
534
|
-
* Migrate deprecated fields in multiple stock plan objects.
|
|
535
|
-
*
|
|
536
|
-
* @param items - Array of stock plan data objects
|
|
537
|
-
* @returns Batch migration result with all migrated items
|
|
538
|
-
*
|
|
539
|
-
* @example
|
|
540
|
-
* ```typescript
|
|
541
|
-
* const plans = [
|
|
542
|
-
* { id: 'plan-1', stock_class_id: 'sc-1' },
|
|
543
|
-
* { id: 'plan-2', stock_class_ids: ['sc-2'] },
|
|
544
|
-
* ];
|
|
545
|
-
* const result = migrateStockPlanFieldsBatch(plans);
|
|
546
|
-
* // result.itemsMigrated === 1
|
|
547
|
-
* ```
|
|
548
|
-
*/
|
|
549
|
-
export declare function migrateStockPlanFieldsBatch<T extends StockPlanDataWithDeprecatedField>(items: T[]): BatchMigrationResult<Omit<T, 'stock_class_id'> & {
|
|
550
|
-
stock_class_ids: string[];
|
|
551
|
-
}>;
|
|
552
|
-
/**
|
|
553
|
-
* Detailed deprecation report for analysis and documentation.
|
|
554
|
-
*/
|
|
555
|
-
export interface DeprecationReport {
|
|
556
|
-
/** Timestamp when the report was generated */
|
|
557
|
-
generatedAt: string;
|
|
558
|
-
/** Summary statistics */
|
|
559
|
-
summary: {
|
|
560
|
-
/** Total objects analyzed */
|
|
561
|
-
totalObjects: number;
|
|
562
|
-
/** Objects with deprecated fields */
|
|
563
|
-
objectsWithDeprecatedFields: number;
|
|
564
|
-
/** Percentage of objects with deprecated fields */
|
|
565
|
-
deprecationPercentage: number;
|
|
566
|
-
/** Total deprecated field usages */
|
|
567
|
-
totalDeprecatedFieldUsages: number;
|
|
568
|
-
};
|
|
569
|
-
/** Breakdown by object type */
|
|
570
|
-
byObjectType: Record<string, {
|
|
571
|
-
total: number;
|
|
572
|
-
withDeprecatedFields: number;
|
|
573
|
-
deprecationPercentage: number;
|
|
574
|
-
fieldsUsed: Record<string, number>;
|
|
575
|
-
}>;
|
|
576
|
-
/** Breakdown by deprecated field */
|
|
577
|
-
byField: Record<string, {
|
|
578
|
-
totalUsages: number;
|
|
579
|
-
objectTypesAffected: string[];
|
|
580
|
-
replacementField: string;
|
|
581
|
-
deprecationType: string;
|
|
582
|
-
}>;
|
|
583
|
-
/** List of all affected items (optional, for detailed reports) */
|
|
584
|
-
affectedItems?: Array<{
|
|
585
|
-
itemId: string;
|
|
586
|
-
objectType: string;
|
|
587
|
-
deprecatedFieldsUsed: string[];
|
|
588
|
-
}>;
|
|
589
|
-
}
|
|
590
|
-
/**
|
|
591
|
-
* Options for generating a deprecation report.
|
|
592
|
-
*/
|
|
593
|
-
export interface DeprecationReportOptions {
|
|
594
|
-
/** Whether to include detailed list of affected items (default: false for large datasets) */
|
|
595
|
-
includeAffectedItems?: boolean;
|
|
596
|
-
/** Maximum number of affected items to include (default: 100) */
|
|
597
|
-
maxAffectedItems?: number;
|
|
598
|
-
}
|
|
599
|
-
/**
|
|
600
|
-
* Generate a detailed deprecation report from batch verification results.
|
|
601
|
-
*
|
|
602
|
-
* @param batchResult - Result from checkDeprecatedFieldsBatch or checkDeprecatedFieldsForType
|
|
603
|
-
* @param options - Options for report generation
|
|
604
|
-
* @returns Detailed deprecation report
|
|
605
|
-
*
|
|
606
|
-
* @example
|
|
607
|
-
* ```typescript
|
|
608
|
-
* const items = [
|
|
609
|
-
* { objectType: 'StockPlan', data: { stock_class_id: 'sc-1' }, id: 'plan-1' },
|
|
610
|
-
* ];
|
|
611
|
-
* const batchResult = checkDeprecatedFieldsBatch(items);
|
|
612
|
-
* const report = generateDeprecationReport(batchResult);
|
|
613
|
-
* console.log(`${report.summary.deprecationPercentage}% of objects use deprecated fields`);
|
|
614
|
-
* ```
|
|
615
|
-
*/
|
|
616
|
-
export declare function generateDeprecationReport(batchResult: BatchDeprecatedFieldsResult, options?: DeprecationReportOptions): DeprecationReport;
|
|
617
|
-
/**
|
|
618
|
-
* Result of validating deprecated field usage.
|
|
619
|
-
*/
|
|
620
|
-
export interface DeprecationValidationResult {
|
|
621
|
-
/** Whether validation passed (no deprecated fields, or within acceptable limits) */
|
|
622
|
-
valid: boolean;
|
|
623
|
-
/** Validation errors (if any) */
|
|
624
|
-
errors: string[];
|
|
625
|
-
/** Validation warnings (if any) */
|
|
626
|
-
warnings: string[];
|
|
627
|
-
/** The underlying check result */
|
|
628
|
-
checkResult: DeprecatedFieldUsageResult;
|
|
629
|
-
}
|
|
630
|
-
/**
|
|
631
|
-
* Options for deprecation validation.
|
|
632
|
-
*/
|
|
633
|
-
export interface DeprecationValidationOptions {
|
|
634
|
-
/** Whether to treat deprecated field usage as an error (default: false, treated as warning) */
|
|
635
|
-
treatAsError?: boolean;
|
|
636
|
-
/** Specific deprecated fields to ignore in validation */
|
|
637
|
-
ignoreFields?: string[];
|
|
638
|
-
/** Custom error message prefix */
|
|
639
|
-
errorMessagePrefix?: string;
|
|
640
|
-
}
|
|
641
|
-
/**
|
|
642
|
-
* Validate an object for deprecated field usage.
|
|
643
|
-
*
|
|
644
|
-
* This is useful for validation pipelines where you want to:
|
|
645
|
-
* - Warn users about deprecated field usage
|
|
646
|
-
* - Optionally fail validation on deprecated fields
|
|
647
|
-
* - Generate clear validation messages
|
|
648
|
-
*
|
|
649
|
-
* @param objectType - The OCF object type
|
|
650
|
-
* @param data - The data to validate
|
|
651
|
-
* @param options - Validation options
|
|
652
|
-
* @returns Validation result
|
|
653
|
-
*
|
|
654
|
-
* @example
|
|
655
|
-
* ```typescript
|
|
656
|
-
* const result = validateDeprecatedFields('StockPlan', {
|
|
657
|
-
* stock_class_id: 'sc-1',
|
|
658
|
-
* }, { treatAsError: false });
|
|
659
|
-
*
|
|
660
|
-
* if (!result.valid) {
|
|
661
|
-
* console.error(result.errors.join('\n'));
|
|
662
|
-
* } else if (result.warnings.length > 0) {
|
|
663
|
-
* console.warn(result.warnings.join('\n'));
|
|
664
|
-
* }
|
|
665
|
-
* ```
|
|
666
|
-
*/
|
|
667
|
-
export declare function validateDeprecatedFields(objectType: string, data: Record<string, unknown>, options?: DeprecationValidationOptions): DeprecationValidationResult;
|
|
668
|
-
/**
|
|
669
|
-
* Create a validator function for use in validation pipelines.
|
|
670
|
-
*
|
|
671
|
-
* @param objectType - The OCF object type to validate
|
|
672
|
-
* @param options - Validation options
|
|
673
|
-
* @returns A validator function that returns DeprecationValidationResult
|
|
674
|
-
*
|
|
675
|
-
* @example
|
|
676
|
-
* ```typescript
|
|
677
|
-
* const validateStockPlan = createDeprecatedFieldsValidator('StockPlan', {
|
|
678
|
-
* treatAsError: false,
|
|
679
|
-
* });
|
|
680
|
-
*
|
|
681
|
-
* // Use in a validation pipeline
|
|
682
|
-
* const result = validateStockPlan(stockPlanData);
|
|
683
|
-
* ```
|
|
684
|
-
*/
|
|
685
|
-
export declare function createDeprecatedFieldsValidator(objectType: string, options?: DeprecationValidationOptions): (data: Record<string, unknown>) => DeprecationValidationResult;
|
|
686
|
-
/**
|
|
687
|
-
* Assert that an object does not use deprecated fields.
|
|
688
|
-
* Throws an error if deprecated fields are detected.
|
|
689
|
-
*
|
|
690
|
-
* @param objectType - The OCF object type
|
|
691
|
-
* @param data - The data to check
|
|
692
|
-
* @param options - Validation options (ignoreFields only)
|
|
693
|
-
* @throws Error if deprecated fields are detected
|
|
694
|
-
*
|
|
695
|
-
* @example
|
|
696
|
-
* ```typescript
|
|
697
|
-
* try {
|
|
698
|
-
* assertNoDeprecatedFields('StockPlan', stockPlanData);
|
|
699
|
-
* // Proceed with operation
|
|
700
|
-
* } catch (error) {
|
|
701
|
-
* // Handle deprecated field usage
|
|
702
|
-
* }
|
|
703
|
-
* ```
|
|
704
|
-
*/
|
|
705
|
-
export declare function assertNoDeprecatedFields(objectType: string, data: Record<string, unknown>, options?: Pick<DeprecationValidationOptions, 'ignoreFields'>): void;
|
|
706
|
-
/**
|
|
707
|
-
* Register a new deprecated field mapping.
|
|
708
|
-
*
|
|
709
|
-
* This is useful for extending the built-in deprecation registry with
|
|
710
|
-
* custom or newly discovered deprecations.
|
|
711
|
-
*
|
|
712
|
-
* @param objectType - The OCF object type
|
|
713
|
-
* @param mapping - The deprecation mapping to register
|
|
714
|
-
*
|
|
715
|
-
* @example
|
|
716
|
-
* ```typescript
|
|
717
|
-
* // Register a new deprecation
|
|
718
|
-
* registerDeprecatedFieldMapping('SomeOcfType', {
|
|
719
|
-
* deprecatedField: 'old_field',
|
|
720
|
-
* replacementField: 'new_fields',
|
|
721
|
-
* deprecationType: 'singular_to_array',
|
|
722
|
-
* });
|
|
723
|
-
* ```
|
|
724
|
-
*/
|
|
725
|
-
export declare function registerDeprecatedFieldMapping(objectType: string, mapping: DeprecatedFieldMapping): void;
|
|
726
|
-
/**
|
|
727
|
-
* Get all registered object types that have deprecated field mappings.
|
|
728
|
-
*
|
|
729
|
-
* @returns Array of object type names
|
|
730
|
-
*/
|
|
731
|
-
export declare function getRegisteredObjectTypes(): string[];
|
|
732
|
-
/**
|
|
733
|
-
* Get all registered deprecated field mappings.
|
|
734
|
-
*
|
|
735
|
-
* @returns Copy of the deprecated fields registry
|
|
736
|
-
*/
|
|
737
|
-
export declare function getAllDeprecatedFieldMappings(): Record<string, DeprecatedFieldMapping[]>;
|
|
738
|
-
/**
|
|
739
|
-
* Result of automatic OCF data normalization.
|
|
740
|
-
*/
|
|
741
|
-
export interface NormalizedOcfDataResult<T> {
|
|
742
|
-
/** The normalized data with deprecated fields converted */
|
|
743
|
-
data: T;
|
|
744
|
-
/** Whether any normalization was performed */
|
|
745
|
-
normalized: boolean;
|
|
746
|
-
/** List of deprecated fields that were normalized */
|
|
747
|
-
normalizedFields: string[];
|
|
748
|
-
/** Warnings generated during normalization */
|
|
749
|
-
warnings: string[];
|
|
750
|
-
}
|
|
751
|
-
/**
|
|
752
|
-
* Automatically normalize deprecated fields in OCF data based on entity type.
|
|
753
|
-
*
|
|
754
|
-
* This function is designed to be called by the SDK internally when processing
|
|
755
|
-
* OCF data, making deprecated field handling transparent to end-users.
|
|
756
|
-
*
|
|
757
|
-
* @param entityType - The OCF entity type (e.g., 'stockPlan')
|
|
758
|
-
* @param data - The OCF data that may contain deprecated fields
|
|
759
|
-
* @param options - Optional configuration
|
|
760
|
-
* @returns The normalized data with deprecated fields converted to current format
|
|
761
|
-
*
|
|
762
|
-
* @example
|
|
763
|
-
* ```typescript
|
|
764
|
-
* // SDK automatically normalizes deprecated fields
|
|
765
|
-
* const result = normalizeDeprecatedOcfFields('stockPlan', {
|
|
766
|
-
* id: 'plan-1',
|
|
767
|
-
* stock_class_id: 'sc-1', // deprecated, automatically converted
|
|
768
|
-
* plan_name: 'Equity Plan',
|
|
769
|
-
* });
|
|
770
|
-
* // result.data.stock_class_ids === ['sc-1']
|
|
771
|
-
* ```
|
|
772
|
-
*/
|
|
773
|
-
export declare function normalizeDeprecatedOcfFields<T extends Record<string, unknown>>(entityType: string, data: T, options?: {
|
|
774
|
-
emitWarnings?: boolean;
|
|
775
|
-
context?: string;
|
|
776
|
-
}): NormalizedOcfDataResult<T>;
|
|
777
|
-
/**
|
|
778
|
-
* Check if an entity type has registered deprecations.
|
|
779
|
-
*
|
|
780
|
-
* @param entityType - The OCF entity type (e.g., 'stockPlan')
|
|
781
|
-
* @returns true if the entity type has deprecation mappings
|
|
782
|
-
*/
|
|
783
|
-
export declare function hasDeprecationsForEntityType(entityType: string): boolean;
|
|
784
|
-
/**
|
|
785
|
-
* Register a mapping from entity type to object type for automatic normalization.
|
|
786
|
-
*
|
|
787
|
-
* @param entityType - The OcfEntityType used in batch API (e.g., 'stockPlan')
|
|
788
|
-
* @param objectType - The object type name used in deprecation registry (e.g., 'StockPlan')
|
|
789
|
-
*/
|
|
790
|
-
export declare function registerEntityTypeMapping(entityType: string, objectType: string): void;
|
|
791
|
-
/**
|
|
792
|
-
* Options for normalizeOcfObject.
|
|
793
|
-
*/
|
|
794
|
-
export interface NormalizeOcfObjectOptions {
|
|
795
|
-
/** Whether to emit deprecation warnings (default: true) */
|
|
796
|
-
emitWarnings?: boolean;
|
|
797
|
-
/** Context for deprecation warnings */
|
|
798
|
-
context?: string;
|
|
799
|
-
}
|
|
800
|
-
/**
|
|
801
|
-
* Normalize an OCF object by applying all deprecation normalizations.
|
|
802
|
-
*
|
|
803
|
-
* This function auto-detects the object type from the `object_type` field and applies:
|
|
804
|
-
* 1. PlanSecurity -> EquityCompensation object_type normalization
|
|
805
|
-
* 2. Deprecated field normalizations (singular->array, value mappings, etc.)
|
|
806
|
-
* 3. Semantic normalizations (e.g., quantity_source: 'UNSPECIFIED' when quantity is absent)
|
|
807
|
-
*/
|
|
808
|
-
export declare function normalizeOcfObject<T extends Record<string, unknown>>(data: T, options?: NormalizeOcfObjectOptions): NormalizedOcfDataResult<T>;
|
|
809
|
-
/**
|
|
810
|
-
* Options for areOcfObjectsEquivalent comparison.
|
|
811
|
-
*/
|
|
812
|
-
export interface OcfEquivalenceOptions extends OcfComparisonOptions {
|
|
813
|
-
/** Whether to normalize objects before comparison (default: true) */
|
|
814
|
-
normalizeBeforeCompare?: boolean;
|
|
815
|
-
/** Whether to emit deprecation warnings during normalization (default: false) */
|
|
816
|
-
emitNormalizationWarnings?: boolean;
|
|
817
|
-
}
|
|
818
|
-
/**
|
|
819
|
-
* Result of OCF equivalence comparison.
|
|
820
|
-
*/
|
|
821
|
-
export interface OcfEquivalenceResult {
|
|
822
|
-
/** Whether the objects are equivalent after normalization */
|
|
823
|
-
equivalent: boolean;
|
|
824
|
-
/** Normalization details for the first object */
|
|
825
|
-
normalizationA: {
|
|
826
|
-
wasNormalized: boolean;
|
|
827
|
-
normalizedFields: string[];
|
|
828
|
-
warnings: string[];
|
|
829
|
-
};
|
|
830
|
-
/** Normalization details for the second object */
|
|
831
|
-
normalizationB: {
|
|
832
|
-
wasNormalized: boolean;
|
|
833
|
-
normalizedFields: string[];
|
|
834
|
-
warnings: string[];
|
|
835
|
-
};
|
|
836
|
-
}
|
|
837
|
-
/**
|
|
838
|
-
* Compare two OCF objects for semantic equivalence after normalizing deprecated fields.
|
|
839
|
-
*/
|
|
840
|
-
export declare function areOcfObjectsEquivalent(dbObject: Record<string, unknown>, chainObject: Record<string, unknown>, options?: OcfEquivalenceOptions): boolean;
|
|
841
|
-
/**
|
|
842
|
-
* Compare two OCF objects with detailed results.
|
|
843
|
-
*/
|
|
844
|
-
export declare function compareOcfObjects(dbObject: Record<string, unknown>, chainObject: Record<string, unknown>, options?: OcfEquivalenceOptions): OcfEquivalenceResult;
|
|
845
|
-
export { DEFAULT_DEPRECATED_FIELDS, DEFAULT_INTERNAL_FIELDS };
|
|
846
|
-
/**
|
|
847
|
-
* Configuration for required array fields by entity type.
|
|
848
|
-
* These fields must be arrays (empty or populated), but raw data might have them as null/undefined.
|
|
849
|
-
* The SDK normalizes these to empty arrays automatically.
|
|
850
|
-
*/
|
|
851
|
-
export declare const REQUIRED_ARRAY_FIELDS: Partial<Record<string, string[]>>;
|
|
852
|
-
/**
|
|
853
|
-
* Normalize required array fields in OCF data.
|
|
854
|
-
* This ensures array fields that are null/undefined become empty arrays.
|
|
855
|
-
*
|
|
856
|
-
* Uses lazy cloning - only creates a copy when modification is actually needed,
|
|
857
|
-
* and clones once then mutates the clone for efficiency.
|
|
858
|
-
*
|
|
859
|
-
* @param entityType - The OCF entity type
|
|
860
|
-
* @param data - The OCF data that may have null/undefined array fields
|
|
861
|
-
* @returns The normalized data with array fields as arrays
|
|
862
|
-
*/
|
|
863
|
-
export declare function normalizeRequiredArrayFields<T extends Record<string, unknown>>(entityType: string, data: T): {
|
|
864
|
-
data: T;
|
|
865
|
-
normalizedFields: string[];
|
|
866
|
-
};
|
|
867
|
-
/**
|
|
868
|
-
* Register required array fields for an entity type.
|
|
869
|
-
*
|
|
870
|
-
* @param entityType - The OCF entity type (e.g., 'stockPlan')
|
|
871
|
-
* @param fields - Array of field names that must be arrays
|
|
872
|
-
*/
|
|
873
|
-
export declare function registerRequiredArrayFields(entityType: string, fields: string[]): void;
|
|
874
|
-
/**
|
|
875
|
-
* Get required array fields for an entity type.
|
|
876
|
-
*
|
|
877
|
-
* @param entityType - The OCF entity type
|
|
878
|
-
* @returns Array of field names that must be arrays
|
|
879
|
-
*/
|
|
880
|
-
export declare function getRequiredArrayFields(entityType: string): string[];
|
|
881
|
-
//# sourceMappingURL=deprecatedFieldNormalization.d.ts.map
|