@rippling/rippling-sdk 0.2.0-alpha.76 → 0.2.0-alpha.78
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/client.d.mts +6 -0
- package/client.d.mts.map +1 -1
- package/client.d.ts +6 -0
- package/client.d.ts.map +1 -1
- package/client.js +6 -0
- package/client.js.map +1 -1
- package/client.mjs +6 -0
- package/client.mjs.map +1 -1
- package/lib/manifest/custom-field-section.d.mts +30 -0
- package/lib/manifest/custom-field-section.d.mts.map +1 -0
- package/lib/manifest/custom-field-section.d.ts +30 -0
- package/lib/manifest/custom-field-section.d.ts.map +1 -0
- package/lib/manifest/custom-field-section.js +58 -0
- package/lib/manifest/custom-field-section.js.map +1 -0
- package/lib/manifest/custom-field-section.mjs +54 -0
- package/lib/manifest/custom-field-section.mjs.map +1 -0
- package/lib/manifest/custom-field.d.mts +82 -0
- package/lib/manifest/custom-field.d.mts.map +1 -0
- package/lib/manifest/custom-field.d.ts +82 -0
- package/lib/manifest/custom-field.d.ts.map +1 -0
- package/lib/manifest/custom-field.js +184 -0
- package/lib/manifest/custom-field.js.map +1 -0
- package/lib/manifest/custom-field.mjs +180 -0
- package/lib/manifest/custom-field.mjs.map +1 -0
- package/lib/manifest/custom-object-action.d.mts +9 -3
- package/lib/manifest/custom-object-action.d.mts.map +1 -1
- package/lib/manifest/custom-object-action.d.ts +9 -3
- package/lib/manifest/custom-object-action.d.ts.map +1 -1
- package/lib/manifest/custom-object-action.js +17 -0
- package/lib/manifest/custom-object-action.js.map +1 -1
- package/lib/manifest/custom-object-action.mjs +17 -0
- package/lib/manifest/custom-object-action.mjs.map +1 -1
- package/lib/manifest/existing-manifest-context.d.mts +6 -0
- package/lib/manifest/existing-manifest-context.d.mts.map +1 -1
- package/lib/manifest/existing-manifest-context.d.ts +6 -0
- package/lib/manifest/existing-manifest-context.d.ts.map +1 -1
- package/lib/manifest/existing-manifest-context.js +28 -0
- package/lib/manifest/existing-manifest-context.js.map +1 -1
- package/lib/manifest/existing-manifest-context.mjs +28 -0
- package/lib/manifest/existing-manifest-context.mjs.map +1 -1
- package/lib/manifest/index.d.mts +2 -0
- package/lib/manifest/index.d.mts.map +1 -1
- package/lib/manifest/index.d.ts +2 -0
- package/lib/manifest/index.d.ts.map +1 -1
- package/lib/manifest/index.js +7 -1
- package/lib/manifest/index.js.map +1 -1
- package/lib/manifest/index.mjs +2 -0
- package/lib/manifest/index.mjs.map +1 -1
- package/lib/manifest/manifest-builder.d.mts +1 -1
- package/lib/manifest/manifest-builder.d.mts.map +1 -1
- package/lib/manifest/manifest-builder.d.ts +1 -1
- package/lib/manifest/manifest-builder.d.ts.map +1 -1
- package/lib/manifest/manifest-builder.js.map +1 -1
- package/lib/manifest/manifest-builder.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/custom-fields.d.mts +5 -0
- package/resources/custom-fields.d.mts.map +1 -1
- package/resources/custom-fields.d.ts +5 -0
- package/resources/custom-fields.d.ts.map +1 -1
- package/resources/index.d.mts +1 -0
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +1 -0
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +4 -2
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +1 -0
- package/resources/index.mjs.map +1 -1
- package/resources/leave-program-evaluations.d.mts +57 -0
- package/resources/leave-program-evaluations.d.mts.map +1 -0
- package/resources/leave-program-evaluations.d.ts +57 -0
- package/resources/leave-program-evaluations.d.ts.map +1 -0
- package/resources/leave-program-evaluations.js +18 -0
- package/resources/leave-program-evaluations.js.map +1 -0
- package/resources/leave-program-evaluations.mjs +14 -0
- package/resources/leave-program-evaluations.mjs.map +1 -0
- package/src/client.ts +16 -0
- package/src/lib/manifest/custom-field-section.ts +86 -0
- package/src/lib/manifest/custom-field.ts +309 -0
- package/src/lib/manifest/custom-object-action.ts +22 -3
- package/src/lib/manifest/existing-manifest-context.ts +42 -0
- package/src/lib/manifest/index.ts +18 -0
- package/src/lib/manifest/manifest-builder.ts +2 -0
- package/src/resources/custom-fields.ts +6 -0
- package/src/resources/index.ts +5 -0
- package/src/resources/leave-program-evaluations.ts +88 -0
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
import { generateId } from './_helpers';
|
|
2
|
+
import { CustomFieldSection } from './custom-field-section';
|
|
3
|
+
import { getExistingManifestContext, type ExistingManifestContextOptions } from './existing-manifest-context';
|
|
4
|
+
import type { ManifestComponentDeletion, ManifestScope } from './manifest-builder';
|
|
5
|
+
import { requireObjectComponentField, requireStringComponentField } from './_existing-component-fields';
|
|
6
|
+
|
|
7
|
+
export const CUSTOM_FIELD_TYPES = [
|
|
8
|
+
'TEXT',
|
|
9
|
+
'DATE',
|
|
10
|
+
'NUMBER',
|
|
11
|
+
'CURRENCY',
|
|
12
|
+
'PERCENTAGE',
|
|
13
|
+
'SELECT',
|
|
14
|
+
'FILE',
|
|
15
|
+
'ID',
|
|
16
|
+
'RADIO',
|
|
17
|
+
'TEXTAREA',
|
|
18
|
+
'RANGE',
|
|
19
|
+
'REFERENCE_ID',
|
|
20
|
+
'BOOLEAN',
|
|
21
|
+
'ADDRESS',
|
|
22
|
+
'OG_REFERENCE_FIELD',
|
|
23
|
+
'EMAIL',
|
|
24
|
+
'URL',
|
|
25
|
+
] as const;
|
|
26
|
+
|
|
27
|
+
export type CustomFieldType = (typeof CUSTOM_FIELD_TYPES)[number];
|
|
28
|
+
export type CustomFieldApiName = `${string}__cfv2`;
|
|
29
|
+
|
|
30
|
+
export type CustomFieldUniqueIDCharacterType = 'DIGITS_ONLY' | 'TEXT_ONLY' | 'DIGITS_TEXT_BOTH';
|
|
31
|
+
|
|
32
|
+
type CustomFieldSimpleType = Exclude<
|
|
33
|
+
CustomFieldType,
|
|
34
|
+
'NUMBER' | 'CURRENCY' | 'SELECT' | 'RADIO' | 'ID' | 'OG_REFERENCE_FIELD'
|
|
35
|
+
>;
|
|
36
|
+
|
|
37
|
+
export type CustomFieldDataType =
|
|
38
|
+
| { fieldType: CustomFieldSimpleType }
|
|
39
|
+
| { fieldType: 'NUMBER'; decimalPlaces?: number | null }
|
|
40
|
+
| { fieldType: 'CURRENCY'; currency?: string | null }
|
|
41
|
+
| { fieldType: 'SELECT' | 'RADIO'; options: readonly string[] }
|
|
42
|
+
| {
|
|
43
|
+
fieldType: 'ID';
|
|
44
|
+
numberOfCharacters?: number | null;
|
|
45
|
+
characterType?: CustomFieldUniqueIDCharacterType | null;
|
|
46
|
+
}
|
|
47
|
+
| { fieldType: 'OG_REFERENCE_FIELD'; referencedModelRqlName: string };
|
|
48
|
+
|
|
49
|
+
export type CustomFieldPermissionClassification =
|
|
50
|
+
| 'BASIC_PERSONAL_INFO'
|
|
51
|
+
| 'PERSONAL_INFO'
|
|
52
|
+
| 'SENSITIVE_PERSONAL_INFO'
|
|
53
|
+
| 'BASIC_EMPLOYMENT_INFO'
|
|
54
|
+
| 'EMPLOYMENT_INFO'
|
|
55
|
+
| 'SENSITIVE_EMPLOYMENT_INFO';
|
|
56
|
+
|
|
57
|
+
export type CustomFieldReadAccess = 'ALL_ACCESS' | 'ADMIN_ACCESS' | 'ADMIN_AND_EMPLOYEE_ACCESS';
|
|
58
|
+
|
|
59
|
+
export type CustomFieldWriteAccess =
|
|
60
|
+
| 'EMPLOYEE_ACCESS'
|
|
61
|
+
| 'ADMIN_ACCESS'
|
|
62
|
+
| 'ADMIN_AND_EMPLOYEE_ACCESS'
|
|
63
|
+
| 'NO_ACCESS';
|
|
64
|
+
|
|
65
|
+
export type CustomFieldCollectionTiming = 'NONE' | 'HIRING' | 'ONBOARDING' | 'TERMINATING';
|
|
66
|
+
|
|
67
|
+
export type CustomFieldDefaultValue =
|
|
68
|
+
| { value: string; rqlDefinitionFormula?: never }
|
|
69
|
+
| { value?: never; rqlDefinitionFormula: string };
|
|
70
|
+
|
|
71
|
+
interface CustomFieldCommonProps {
|
|
72
|
+
fieldId?: string;
|
|
73
|
+
name: string;
|
|
74
|
+
section: CustomFieldSection;
|
|
75
|
+
modelRqlName: string;
|
|
76
|
+
dataType: CustomFieldDataType;
|
|
77
|
+
apiName: CustomFieldApiName;
|
|
78
|
+
fieldPermissionClassification?: CustomFieldPermissionClassification | null;
|
|
79
|
+
fieldReadAccess?: CustomFieldReadAccess | null;
|
|
80
|
+
fieldWriteAccess?: CustomFieldWriteAccess | null;
|
|
81
|
+
applicableGroup?: string | null;
|
|
82
|
+
description?: string | null;
|
|
83
|
+
displayOrder?: number | null;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export type CustomFieldProps = CustomFieldCommonProps &
|
|
87
|
+
(
|
|
88
|
+
| {
|
|
89
|
+
rqlDefinitionFormula: string;
|
|
90
|
+
collectDuring?: null;
|
|
91
|
+
required?: null;
|
|
92
|
+
tip?: null;
|
|
93
|
+
defaultValue?: null;
|
|
94
|
+
}
|
|
95
|
+
| {
|
|
96
|
+
rqlDefinitionFormula?: null;
|
|
97
|
+
collectDuring?: CustomFieldCollectionTiming | null;
|
|
98
|
+
required?: boolean | null;
|
|
99
|
+
tip?: string | null;
|
|
100
|
+
defaultValue?: CustomFieldDefaultValue | null;
|
|
101
|
+
}
|
|
102
|
+
);
|
|
103
|
+
|
|
104
|
+
function cloneJson<T>(value: T): T {
|
|
105
|
+
if (value == null) return value;
|
|
106
|
+
return JSON.parse(JSON.stringify(value)) as T;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function customFieldDataTypeFromWire(dataType: Record<string, any>): CustomFieldDataType {
|
|
110
|
+
const fieldType = requireStringComponentField(
|
|
111
|
+
dataType,
|
|
112
|
+
'field_type',
|
|
113
|
+
CustomField.componentType,
|
|
114
|
+
) as CustomFieldType;
|
|
115
|
+
switch (fieldType) {
|
|
116
|
+
case 'NUMBER':
|
|
117
|
+
return {
|
|
118
|
+
fieldType,
|
|
119
|
+
decimalPlaces: (dataType['num_of_decimal_places'] as number | null | undefined) ?? null,
|
|
120
|
+
};
|
|
121
|
+
case 'CURRENCY':
|
|
122
|
+
return { fieldType, currency: (dataType['currency'] as string | null | undefined) ?? null };
|
|
123
|
+
case 'SELECT':
|
|
124
|
+
case 'RADIO': {
|
|
125
|
+
const options = dataType['options_list'];
|
|
126
|
+
if (!Array.isArray(options) || !options.every((option) => typeof option === 'string')) {
|
|
127
|
+
throw new TypeError(`CUSTOM_FIELD_V2 data_type.options_list must be a string array.`);
|
|
128
|
+
}
|
|
129
|
+
return { fieldType, options };
|
|
130
|
+
}
|
|
131
|
+
case 'ID':
|
|
132
|
+
return {
|
|
133
|
+
fieldType,
|
|
134
|
+
numberOfCharacters: (dataType['num_of_chars'] as number | null | undefined) ?? null,
|
|
135
|
+
characterType:
|
|
136
|
+
(dataType['type_of_chars'] as CustomFieldUniqueIDCharacterType | null | undefined) ?? null,
|
|
137
|
+
};
|
|
138
|
+
case 'OG_REFERENCE_FIELD':
|
|
139
|
+
return {
|
|
140
|
+
fieldType,
|
|
141
|
+
referencedModelRqlName: requireStringComponentField(
|
|
142
|
+
dataType,
|
|
143
|
+
'og_model_rql_name',
|
|
144
|
+
CustomField.componentType,
|
|
145
|
+
),
|
|
146
|
+
};
|
|
147
|
+
default:
|
|
148
|
+
if (!(CUSTOM_FIELD_TYPES as readonly string[]).includes(fieldType)) {
|
|
149
|
+
throw new TypeError(`Unsupported CUSTOM_FIELD_V2 field_type: ${fieldType}`);
|
|
150
|
+
}
|
|
151
|
+
return { fieldType };
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/** A Custom Field V2 field on a native or custom object. */
|
|
156
|
+
export class CustomField {
|
|
157
|
+
static readonly componentType = 'CUSTOM_FIELD_V2' as const;
|
|
158
|
+
|
|
159
|
+
static toDeletionIdentifier(customFieldId: string): ManifestComponentDeletion {
|
|
160
|
+
return { type: CustomField.componentType, cfv2_id: customFieldId };
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
private readonly _fieldId: string;
|
|
164
|
+
private readonly props: CustomFieldProps;
|
|
165
|
+
|
|
166
|
+
constructor(scope: ManifestScope, props: CustomFieldProps) {
|
|
167
|
+
if (!props.apiName.endsWith('__cfv2')) {
|
|
168
|
+
throw new Error(`Custom Field V2 api_name must end with __cfv2: ${props.apiName}`);
|
|
169
|
+
}
|
|
170
|
+
if (props.section.getModelRqlName() !== props.modelRqlName) {
|
|
171
|
+
throw new Error(
|
|
172
|
+
`Custom field "${props.apiName}" section belongs to "${props.section.getModelRqlName()}", ` +
|
|
173
|
+
`but the field belongs to "${props.modelRqlName}".`,
|
|
174
|
+
);
|
|
175
|
+
}
|
|
176
|
+
this._fieldId = props.fieldId ?? generateId('cfv2');
|
|
177
|
+
this.props = {
|
|
178
|
+
...props,
|
|
179
|
+
dataType: cloneJson(props.dataType),
|
|
180
|
+
};
|
|
181
|
+
scope._register(this);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
static loadFromExisting(
|
|
185
|
+
fieldIdOrApiName: string,
|
|
186
|
+
options: ExistingManifestContextOptions = {},
|
|
187
|
+
): CustomField {
|
|
188
|
+
return getExistingManifestContext(options).loadCustomField(fieldIdOrApiName);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/** @internal Hydrates a custom field from existing manifest wire JSON. */
|
|
192
|
+
static _fromExistingComponent(
|
|
193
|
+
scope: ManifestScope,
|
|
194
|
+
component: Record<string, any>,
|
|
195
|
+
section: CustomFieldSection,
|
|
196
|
+
): CustomField {
|
|
197
|
+
const dataType = requireObjectComponentField(component, 'data_type', CustomField.componentType);
|
|
198
|
+
const defaultValue = component['default_value'] as Record<string, any> | null | undefined;
|
|
199
|
+
const formula = component['rql_definition_formula'];
|
|
200
|
+
const applicableGroup =
|
|
201
|
+
component['applicable_group'] == null ?
|
|
202
|
+
null
|
|
203
|
+
: requireObjectComponentField(component, 'applicable_group', CustomField.componentType);
|
|
204
|
+
const common = {
|
|
205
|
+
fieldId: requireStringComponentField(component, 'obj_id', CustomField.componentType),
|
|
206
|
+
name: requireStringComponentField(component, 'name', CustomField.componentType),
|
|
207
|
+
section,
|
|
208
|
+
modelRqlName: requireStringComponentField(component, 'model_rql_name', CustomField.componentType),
|
|
209
|
+
apiName: requireStringComponentField(
|
|
210
|
+
component,
|
|
211
|
+
'api_name',
|
|
212
|
+
CustomField.componentType,
|
|
213
|
+
) as CustomFieldApiName,
|
|
214
|
+
dataType: customFieldDataTypeFromWire(dataType),
|
|
215
|
+
fieldPermissionClassification:
|
|
216
|
+
(component['field_permission_classification'] as
|
|
217
|
+
| CustomFieldPermissionClassification
|
|
218
|
+
| null
|
|
219
|
+
| undefined) ?? null,
|
|
220
|
+
fieldReadAccess: (component['field_read_access'] as CustomFieldReadAccess | null | undefined) ?? null,
|
|
221
|
+
fieldWriteAccess:
|
|
222
|
+
(component['field_write_access'] as CustomFieldWriteAccess | null | undefined) ?? null,
|
|
223
|
+
applicableGroup:
|
|
224
|
+
applicableGroup == null ? null : (
|
|
225
|
+
requireStringComponentField(applicableGroup, 'me_obj_id', CustomField.componentType)
|
|
226
|
+
),
|
|
227
|
+
description: (component['description'] as string | null | undefined) ?? null,
|
|
228
|
+
displayOrder: (component['display_order'] as number | null | undefined) ?? null,
|
|
229
|
+
};
|
|
230
|
+
if (typeof formula === 'string') {
|
|
231
|
+
return new CustomField(scope, {
|
|
232
|
+
...common,
|
|
233
|
+
rqlDefinitionFormula: formula,
|
|
234
|
+
collectDuring: null,
|
|
235
|
+
required: null,
|
|
236
|
+
tip: null,
|
|
237
|
+
defaultValue: null,
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
const defaultValueFormula = defaultValue?.['rql_definition_formula'];
|
|
242
|
+
const staticDefaultValue = defaultValue?.['value'];
|
|
243
|
+
return new CustomField(scope, {
|
|
244
|
+
...common,
|
|
245
|
+
rqlDefinitionFormula: null,
|
|
246
|
+
collectDuring: (component['collect_during'] as CustomFieldCollectionTiming | null | undefined) ?? null,
|
|
247
|
+
required: (component['required'] as boolean | null | undefined) ?? null,
|
|
248
|
+
tip: (component['tip'] as string | null | undefined) ?? null,
|
|
249
|
+
defaultValue:
|
|
250
|
+
typeof defaultValueFormula === 'string' ? { rqlDefinitionFormula: defaultValueFormula }
|
|
251
|
+
: typeof staticDefaultValue === 'string' ? { value: staticDefaultValue }
|
|
252
|
+
: null,
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
getFieldId(): string {
|
|
257
|
+
return this._fieldId;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
getApiName(): CustomFieldApiName {
|
|
261
|
+
return this.props.apiName;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
getModelRqlName(): string {
|
|
265
|
+
return this.props.modelRqlName;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
toDict(): Record<string, any> {
|
|
269
|
+
const dataType = this.props.dataType;
|
|
270
|
+
const defaultValue = this.props.defaultValue;
|
|
271
|
+
return {
|
|
272
|
+
type: CustomField.componentType,
|
|
273
|
+
obj_id: this._fieldId,
|
|
274
|
+
name: this.props.name,
|
|
275
|
+
section: this.props.section.getSectionId(),
|
|
276
|
+
model_rql_name: this.props.modelRqlName,
|
|
277
|
+
data_type: {
|
|
278
|
+
type: CustomField.componentType,
|
|
279
|
+
field_type: dataType.fieldType,
|
|
280
|
+
options_list: 'options' in dataType ? [...dataType.options] : null,
|
|
281
|
+
currency: 'currency' in dataType ? dataType.currency ?? null : null,
|
|
282
|
+
num_of_decimal_places: 'decimalPlaces' in dataType ? dataType.decimalPlaces ?? null : null,
|
|
283
|
+
num_of_chars: 'numberOfCharacters' in dataType ? dataType.numberOfCharacters ?? null : null,
|
|
284
|
+
type_of_chars: 'characterType' in dataType ? dataType.characterType ?? null : null,
|
|
285
|
+
og_model_rql_name: 'referencedModelRqlName' in dataType ? dataType.referencedModelRqlName : null,
|
|
286
|
+
},
|
|
287
|
+
api_name: this.props.apiName,
|
|
288
|
+
field_permission_classification: this.props.fieldPermissionClassification ?? null,
|
|
289
|
+
field_read_access: this.props.fieldReadAccess ?? null,
|
|
290
|
+
field_write_access: this.props.fieldWriteAccess ?? null,
|
|
291
|
+
collect_during: this.props.collectDuring ?? null,
|
|
292
|
+
applicable_group: this.props.applicableGroup ?? null,
|
|
293
|
+
description: this.props.description ?? null,
|
|
294
|
+
required: this.props.required ?? null,
|
|
295
|
+
tip: this.props.tip ?? null,
|
|
296
|
+
rql_definition_formula: this.props.rqlDefinitionFormula ?? null,
|
|
297
|
+
default_value:
|
|
298
|
+
defaultValue == null ? null : (
|
|
299
|
+
{
|
|
300
|
+
type: CustomField.componentType,
|
|
301
|
+
value: 'value' in defaultValue ? defaultValue.value : null,
|
|
302
|
+
rql_definition_formula:
|
|
303
|
+
'rqlDefinitionFormula' in defaultValue ? defaultValue.rqlDefinitionFormula : null,
|
|
304
|
+
}
|
|
305
|
+
),
|
|
306
|
+
display_order: this.props.displayOrder ?? null,
|
|
307
|
+
};
|
|
308
|
+
}
|
|
309
|
+
}
|
|
@@ -41,9 +41,9 @@ export class CustomObjectAction {
|
|
|
41
41
|
|
|
42
42
|
private readonly _actionId: string;
|
|
43
43
|
private readonly _objectRqlName: string;
|
|
44
|
-
private
|
|
45
|
-
private
|
|
46
|
-
private
|
|
44
|
+
private _name: string;
|
|
45
|
+
private _functionApiName: string;
|
|
46
|
+
private _visibilityPreferences: CustomObjectActionVisibilityPreference[];
|
|
47
47
|
|
|
48
48
|
constructor(customObject: CustomObject, props: CustomObjectActionProps) {
|
|
49
49
|
if (!props.name.trim()) throw new Error('CustomObjectAction: name cannot be empty');
|
|
@@ -86,6 +86,25 @@ export class CustomObjectAction {
|
|
|
86
86
|
return this._actionId;
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
+
/** Replaces the action's display name. */
|
|
90
|
+
setName(name: string): this {
|
|
91
|
+
if (!name.trim()) throw new Error('CustomObjectAction: name cannot be empty');
|
|
92
|
+
this._name = name;
|
|
93
|
+
return this;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/** Replaces the function invoked by this action. */
|
|
97
|
+
setFunction(fn: ManifestFunction): this {
|
|
98
|
+
this._functionApiName = fn.getApiName();
|
|
99
|
+
return this;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/** Replaces the views where this action is shown. */
|
|
103
|
+
setVisibilityPreferences(preferences: CustomObjectActionVisibilityPreference[]): this {
|
|
104
|
+
this._visibilityPreferences = [...preferences];
|
|
105
|
+
return this;
|
|
106
|
+
}
|
|
107
|
+
|
|
89
108
|
toDict(): Record<string, any> {
|
|
90
109
|
return {
|
|
91
110
|
type: CustomObjectAction.componentType,
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { App } from './app';
|
|
2
2
|
import { Category } from './category';
|
|
3
|
+
import { CustomField } from './custom-field';
|
|
4
|
+
import { CustomFieldSection } from './custom-field-section';
|
|
3
5
|
import { CustomObject } from './custom-object';
|
|
4
6
|
import { CustomObjectAction } from './custom-object-action';
|
|
5
7
|
import { CustomObjectFieldSection } from './custom-object-field-section';
|
|
@@ -189,6 +191,24 @@ export class ExistingManifestContext {
|
|
|
189
191
|
return this.loadCustomObjectComponent(component);
|
|
190
192
|
}
|
|
191
193
|
|
|
194
|
+
loadCustomFieldSection(sectionId: string): CustomFieldSection {
|
|
195
|
+
const component = this.findUnique(
|
|
196
|
+
'CUSTOM_FIELD_SECTION',
|
|
197
|
+
(candidate) => candidate['obj_id'] === sectionId,
|
|
198
|
+
`CUSTOM_FIELD_SECTION ${sectionId}`,
|
|
199
|
+
);
|
|
200
|
+
return this.loadCustomFieldSectionComponent(component);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
loadCustomField(fieldIdOrApiName: string): CustomField {
|
|
204
|
+
const component = this.findUnique(
|
|
205
|
+
'CUSTOM_FIELD_V2',
|
|
206
|
+
(candidate) => candidate['obj_id'] === fieldIdOrApiName || candidate['api_name'] === fieldIdOrApiName,
|
|
207
|
+
`CUSTOM_FIELD_V2 ${fieldIdOrApiName}`,
|
|
208
|
+
);
|
|
209
|
+
return this.loadCustomFieldComponent(component);
|
|
210
|
+
}
|
|
211
|
+
|
|
192
212
|
loadFieldSection(
|
|
193
213
|
sectionIdOrQualifiedId: string,
|
|
194
214
|
options: ExistingManifestObjectOptions = {},
|
|
@@ -309,6 +329,10 @@ export class ExistingManifestContext {
|
|
|
309
329
|
return this.loadCategoryComponent(component);
|
|
310
330
|
case 'CUSTOM_OBJECT':
|
|
311
331
|
return this.loadCustomObjectComponent(component);
|
|
332
|
+
case 'CUSTOM_FIELD_SECTION':
|
|
333
|
+
return this.loadCustomFieldSectionComponent(component);
|
|
334
|
+
case 'CUSTOM_FIELD_V2':
|
|
335
|
+
return this.loadCustomFieldComponent(component);
|
|
312
336
|
case 'CUSTOM_OBJECT_ACTION':
|
|
313
337
|
return this.loadCustomObjectActionComponent(component);
|
|
314
338
|
case 'CUSTOM_OBJECT_FIELD_SECTION':
|
|
@@ -362,6 +386,24 @@ export class ExistingManifestContext {
|
|
|
362
386
|
});
|
|
363
387
|
}
|
|
364
388
|
|
|
389
|
+
private loadCustomFieldSectionComponent(component: Record<string, any>): CustomFieldSection {
|
|
390
|
+
const sectionId = requireStringComponentField(component, 'obj_id', CustomFieldSection.componentType);
|
|
391
|
+
const cacheKey = this.cacheKey('CUSTOM_FIELD_SECTION', sectionId);
|
|
392
|
+
return this.getOrLoad(cacheKey, () =>
|
|
393
|
+
CustomFieldSection._fromExistingComponent(this.getManifestBuilder(), component),
|
|
394
|
+
);
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
private loadCustomFieldComponent(component: Record<string, any>): CustomField {
|
|
398
|
+
const fieldId = requireStringComponentField(component, 'obj_id', CustomField.componentType);
|
|
399
|
+
const sectionId = requireStringComponentField(component, 'section', CustomField.componentType);
|
|
400
|
+
const cacheKey = this.cacheKey('CUSTOM_FIELD_V2', fieldId);
|
|
401
|
+
return this.getOrLoad(cacheKey, () => {
|
|
402
|
+
const section = this.loadCustomFieldSection(sectionId);
|
|
403
|
+
return CustomField._fromExistingComponent(this.getManifestBuilder(), component, section);
|
|
404
|
+
});
|
|
405
|
+
}
|
|
406
|
+
|
|
365
407
|
private loadFieldSectionComponent(component: Record<string, any>): CustomObjectFieldSection {
|
|
366
408
|
const modelName = requireStringComponentField(
|
|
367
409
|
component,
|
|
@@ -20,6 +20,24 @@ export { App, type AppIcon, type AppPage, type AppProps } from './app';
|
|
|
20
20
|
|
|
21
21
|
export { Category, type CategoryProps } from './category';
|
|
22
22
|
|
|
23
|
+
export {
|
|
24
|
+
CUSTOM_FIELD_TYPES,
|
|
25
|
+
CustomField,
|
|
26
|
+
CustomField as CustomFieldV2,
|
|
27
|
+
type CustomFieldApiName,
|
|
28
|
+
type CustomFieldCollectionTiming,
|
|
29
|
+
type CustomFieldDataType,
|
|
30
|
+
type CustomFieldDefaultValue,
|
|
31
|
+
type CustomFieldPermissionClassification,
|
|
32
|
+
type CustomFieldProps,
|
|
33
|
+
type CustomFieldReadAccess,
|
|
34
|
+
type CustomFieldType,
|
|
35
|
+
type CustomFieldUniqueIDCharacterType,
|
|
36
|
+
type CustomFieldWriteAccess,
|
|
37
|
+
} from './custom-field';
|
|
38
|
+
|
|
39
|
+
export { CustomFieldSection, type CustomFieldSectionProps } from './custom-field-section';
|
|
40
|
+
|
|
23
41
|
export {
|
|
24
42
|
CustomObject,
|
|
25
43
|
type CustomObjectFieldInput,
|
|
@@ -77,6 +77,12 @@ export interface CustomFieldListResponse {
|
|
|
77
77
|
*/
|
|
78
78
|
description?: string;
|
|
79
79
|
|
|
80
|
+
/**
|
|
81
|
+
* The available choice values for SELECT and RADIO custom fields. Null for other
|
|
82
|
+
* field types.
|
|
83
|
+
*/
|
|
84
|
+
options?: Array<string>;
|
|
85
|
+
|
|
80
86
|
/**
|
|
81
87
|
* Whether the custom field is required.
|
|
82
88
|
*/
|
package/src/resources/index.ts
CHANGED
|
@@ -314,6 +314,11 @@ export {
|
|
|
314
314
|
type LeaveBalanceRetrieveParams,
|
|
315
315
|
type LeaveBalancesPageCursorURL,
|
|
316
316
|
} from './leave-balances';
|
|
317
|
+
export {
|
|
318
|
+
LeaveProgramEvaluations,
|
|
319
|
+
type LeaveProgramEvaluationCreateResponse,
|
|
320
|
+
type LeaveProgramEvaluationCreateParams,
|
|
321
|
+
} from './leave-program-evaluations';
|
|
317
322
|
export {
|
|
318
323
|
LeaveRequests,
|
|
319
324
|
type LeaveRequest,
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { APIResource } from '../core/resource';
|
|
4
|
+
import { APIPromise } from '../core/api-promise';
|
|
5
|
+
import { RequestOptions } from '../internal/request-options';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Leave program evaluations produced by the leave rules engine
|
|
9
|
+
*/
|
|
10
|
+
export class LeaveProgramEvaluations extends APIResource {
|
|
11
|
+
/**
|
|
12
|
+
* Evaluate leave programs for an employee leave request.
|
|
13
|
+
*/
|
|
14
|
+
create(
|
|
15
|
+
body: LeaveProgramEvaluationCreateParams,
|
|
16
|
+
options?: RequestOptions,
|
|
17
|
+
): APIPromise<LeaveProgramEvaluationCreateResponse> {
|
|
18
|
+
return this._client.post('/leave-program-evaluations/', { body, ...options });
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface LeaveProgramEvaluationCreateResponse {
|
|
23
|
+
/**
|
|
24
|
+
* Combined leave plan derived from all non-ineligible program results.
|
|
25
|
+
*/
|
|
26
|
+
leave_plan: unknown;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Distinct evidence gaps reported by evaluated eligibility rules.
|
|
30
|
+
*/
|
|
31
|
+
missing_evidence: Array<string>;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Per-program rule outputs in evaluation order.
|
|
35
|
+
*/
|
|
36
|
+
program_results: Array<unknown>;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface LeaveProgramEvaluationCreateParams {
|
|
40
|
+
/**
|
|
41
|
+
* Requested leave start date.
|
|
42
|
+
*/
|
|
43
|
+
claim_start_date: string;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Normalized leave reason to evaluate against statutory and custom leave programs.
|
|
47
|
+
*/
|
|
48
|
+
leave_reason:
|
|
49
|
+
| 'BONDING'
|
|
50
|
+
| 'PREGNANCY_DISABILITY'
|
|
51
|
+
| 'PREGNANCY_ACCOMMODATION'
|
|
52
|
+
| 'MEDICAL'
|
|
53
|
+
| 'VACATION'
|
|
54
|
+
| 'OTHER';
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Role ID for the employee whose leave request should be evaluated.
|
|
58
|
+
*/
|
|
59
|
+
role_id: string;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Optional date the child entered the family for bonding leave programs.
|
|
63
|
+
*/
|
|
64
|
+
child_entered_family_date?: string;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Optional parental leave relationship type for parental leave programs.
|
|
68
|
+
*/
|
|
69
|
+
parental_leave_type?:
|
|
70
|
+
| 'birthing_parent'
|
|
71
|
+
| 'non_birthing_parent'
|
|
72
|
+
| 'adoption_parent'
|
|
73
|
+
| 'supporting_person'
|
|
74
|
+
| 'foster_parent';
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Optional leave program codes to evaluate. When omitted, every registered leave
|
|
78
|
+
* program runs in dependency order.
|
|
79
|
+
*/
|
|
80
|
+
program_codes?: Array<string>;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export declare namespace LeaveProgramEvaluations {
|
|
84
|
+
export {
|
|
85
|
+
type LeaveProgramEvaluationCreateResponse as LeaveProgramEvaluationCreateResponse,
|
|
86
|
+
type LeaveProgramEvaluationCreateParams as LeaveProgramEvaluationCreateParams,
|
|
87
|
+
};
|
|
88
|
+
}
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '0.2.0-alpha.
|
|
1
|
+
export const VERSION = '0.2.0-alpha.78'; // x-release-please-version
|
package/version.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.2.0-alpha.
|
|
1
|
+
export declare const VERSION = "0.2.0-alpha.78";
|
|
2
2
|
//# sourceMappingURL=version.d.mts.map
|
package/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.2.0-alpha.
|
|
1
|
+
export declare const VERSION = "0.2.0-alpha.78";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/version.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.VERSION = void 0;
|
|
4
|
-
exports.VERSION = '0.2.0-alpha.
|
|
4
|
+
exports.VERSION = '0.2.0-alpha.78'; // x-release-please-version
|
|
5
5
|
//# sourceMappingURL=version.js.map
|
package/version.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '0.2.0-alpha.
|
|
1
|
+
export const VERSION = '0.2.0-alpha.78'; // x-release-please-version
|
|
2
2
|
//# sourceMappingURL=version.mjs.map
|