@rippling/rippling-sdk 0.2.0-alpha.77 → 0.2.0-alpha.79
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.d.mts +56 -15
- package/lib/manifest/custom-field.d.mts.map +1 -1
- package/lib/manifest/custom-field.d.ts +56 -15
- package/lib/manifest/custom-field.d.ts.map +1 -1
- package/lib/manifest/custom-field.js +27 -0
- package/lib/manifest/custom-field.js.map +1 -1
- package/lib/manifest/custom-field.mjs +27 -0
- package/lib/manifest/custom-field.mjs.map +1 -1
- package/lib/manifest/index.d.mts +1 -1
- package/lib/manifest/index.d.mts.map +1 -1
- package/lib/manifest/index.d.ts +1 -1
- package/lib/manifest/index.d.ts.map +1 -1
- package/lib/manifest/index.js.map +1 -1
- package/lib/manifest/index.mjs.map +1 -1
- package/package.json +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.ts +140 -26
- package/src/lib/manifest/index.ts +9 -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
|
@@ -68,38 +68,106 @@ export type CustomFieldDefaultValue =
|
|
|
68
68
|
| { value: string; rqlDefinitionFormula?: never }
|
|
69
69
|
| { value?: never; rqlDefinitionFormula: string };
|
|
70
70
|
|
|
71
|
-
|
|
71
|
+
/** Properties shared by formula and user-input custom fields. */
|
|
72
|
+
export interface CustomFieldBaseProps<ModelRqlName extends string = string> {
|
|
72
73
|
fieldId?: string;
|
|
73
74
|
name: string;
|
|
74
75
|
section: CustomFieldSection;
|
|
75
|
-
modelRqlName:
|
|
76
|
+
modelRqlName: ModelRqlName;
|
|
76
77
|
dataType: CustomFieldDataType;
|
|
77
78
|
apiName: CustomFieldApiName;
|
|
79
|
+
description?: string | null;
|
|
80
|
+
displayOrder?: number | null;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
type NonSensitiveCustomFieldPermissionClassification = Exclude<
|
|
84
|
+
CustomFieldPermissionClassification,
|
|
85
|
+
'SENSITIVE_PERSONAL_INFO' | 'SENSITIVE_EMPLOYMENT_INFO'
|
|
86
|
+
>;
|
|
87
|
+
|
|
88
|
+
/** Permission properties required for every Employee custom field. */
|
|
89
|
+
export type EmployeeCustomFieldPermissionProps = { applicableGroup: string } & (
|
|
90
|
+
| {
|
|
91
|
+
fieldReadAccess: 'ALL_ACCESS';
|
|
92
|
+
fieldPermissionClassification: NonSensitiveCustomFieldPermissionClassification;
|
|
93
|
+
}
|
|
94
|
+
| {
|
|
95
|
+
fieldReadAccess: 'ADMIN_ACCESS' | 'ADMIN_AND_EMPLOYEE_ACCESS';
|
|
96
|
+
fieldPermissionClassification: CustomFieldPermissionClassification;
|
|
97
|
+
}
|
|
98
|
+
);
|
|
99
|
+
|
|
100
|
+
/** Optional permission properties used by non-Employee custom fields. */
|
|
101
|
+
export interface NonEmployeeCustomFieldPermissionProps {
|
|
78
102
|
fieldPermissionClassification?: CustomFieldPermissionClassification | null;
|
|
79
103
|
fieldReadAccess?: CustomFieldReadAccess | null;
|
|
80
|
-
fieldWriteAccess?: CustomFieldWriteAccess | null;
|
|
81
104
|
applicableGroup?: string | null;
|
|
82
|
-
description?: string | null;
|
|
83
|
-
displayOrder?: number | null;
|
|
84
105
|
}
|
|
85
106
|
|
|
86
|
-
export type
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
107
|
+
export type CustomFieldPermissionProps<ModelRqlName extends string = string> =
|
|
108
|
+
ModelRqlName extends 'Employee' ? EmployeeCustomFieldPermissionProps
|
|
109
|
+
: NonEmployeeCustomFieldPermissionProps;
|
|
110
|
+
|
|
111
|
+
interface CustomFieldUserInputOptions {
|
|
112
|
+
rqlDefinitionFormula?: null;
|
|
113
|
+
required?: boolean | null;
|
|
114
|
+
tip?: string | null;
|
|
115
|
+
defaultValue?: CustomFieldDefaultValue | null;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
type EmployeeCustomFieldUserInputAccess =
|
|
119
|
+
| {
|
|
120
|
+
collectDuring: 'ONBOARDING';
|
|
121
|
+
fieldReadAccess: 'ALL_ACCESS' | 'ADMIN_AND_EMPLOYEE_ACCESS';
|
|
122
|
+
fieldWriteAccess: 'EMPLOYEE_ACCESS' | 'ADMIN_AND_EMPLOYEE_ACCESS' | 'NO_ACCESS';
|
|
123
|
+
}
|
|
124
|
+
| {
|
|
125
|
+
collectDuring?: 'NONE' | 'HIRING' | 'TERMINATING' | null;
|
|
126
|
+
fieldWriteAccess: CustomFieldWriteAccess;
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
interface NonEmployeeCustomFieldUserInputAccess {
|
|
130
|
+
collectDuring?: CustomFieldCollectionTiming | null;
|
|
131
|
+
fieldWriteAccess?: CustomFieldWriteAccess | null;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
type CustomFieldUserInputAccess<ModelRqlName extends string> =
|
|
135
|
+
ModelRqlName extends 'Employee' ? EmployeeCustomFieldUserInputAccess
|
|
136
|
+
: NonEmployeeCustomFieldUserInputAccess;
|
|
137
|
+
|
|
138
|
+
interface CustomFieldFormulaOptions {
|
|
139
|
+
rqlDefinitionFormula: string;
|
|
140
|
+
fieldWriteAccess: 'NO_ACCESS';
|
|
141
|
+
collectDuring?: null;
|
|
142
|
+
required?: null;
|
|
143
|
+
tip?: null;
|
|
144
|
+
defaultValue?: null;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/** A calculated custom field whose value cannot be edited directly. */
|
|
148
|
+
export type FormulaCustomFieldProps<ModelRqlName extends string = string> =
|
|
149
|
+
CustomFieldBaseProps<ModelRqlName> & CustomFieldPermissionProps<ModelRqlName> & CustomFieldFormulaOptions;
|
|
150
|
+
|
|
151
|
+
/** A custom field whose value is supplied by a user or a default value. */
|
|
152
|
+
export type UserInputCustomFieldProps<ModelRqlName extends string = string> =
|
|
153
|
+
CustomFieldBaseProps<ModelRqlName> &
|
|
154
|
+
CustomFieldPermissionProps<ModelRqlName> &
|
|
155
|
+
CustomFieldUserInputOptions &
|
|
156
|
+
CustomFieldUserInputAccess<ModelRqlName>;
|
|
157
|
+
|
|
158
|
+
/** A formula or user-input custom field on the given model. */
|
|
159
|
+
export type CustomFieldProps<ModelRqlName extends string = string> =
|
|
160
|
+
| FormulaCustomFieldProps<ModelRqlName>
|
|
161
|
+
| UserInputCustomFieldProps<ModelRqlName>;
|
|
162
|
+
|
|
163
|
+
/** A calculated Employee custom field. */
|
|
164
|
+
export type EmployeeFormulaCustomFieldProps = FormulaCustomFieldProps<'Employee'>;
|
|
165
|
+
|
|
166
|
+
/** An Employee custom field whose value is supplied by a user or a default value. */
|
|
167
|
+
export type EmployeeUserInputCustomFieldProps = UserInputCustomFieldProps<'Employee'>;
|
|
168
|
+
|
|
169
|
+
/** Any supported Employee custom field. */
|
|
170
|
+
export type EmployeeCustomFieldProps = EmployeeFormulaCustomFieldProps | EmployeeUserInputCustomFieldProps;
|
|
103
171
|
|
|
104
172
|
function cloneJson<T>(value: T): T {
|
|
105
173
|
if (value == null) return value;
|
|
@@ -153,7 +221,7 @@ function customFieldDataTypeFromWire(dataType: Record<string, any>): CustomField
|
|
|
153
221
|
}
|
|
154
222
|
|
|
155
223
|
/** A Custom Field V2 field on a native or custom object. */
|
|
156
|
-
export class CustomField {
|
|
224
|
+
export class CustomField<const ModelRqlName extends string = string> {
|
|
157
225
|
static readonly componentType = 'CUSTOM_FIELD_V2' as const;
|
|
158
226
|
|
|
159
227
|
static toDeletionIdentifier(customFieldId: string): ManifestComponentDeletion {
|
|
@@ -161,9 +229,17 @@ export class CustomField {
|
|
|
161
229
|
}
|
|
162
230
|
|
|
163
231
|
private readonly _fieldId: string;
|
|
164
|
-
private readonly props: CustomFieldProps
|
|
232
|
+
private readonly props: CustomFieldProps<ModelRqlName>;
|
|
165
233
|
|
|
166
|
-
constructor(scope: ManifestScope, props: CustomFieldProps) {
|
|
234
|
+
constructor(scope: ManifestScope, props: CustomFieldProps<ModelRqlName>) {
|
|
235
|
+
const runtimeProps = props as CustomFieldBaseProps<string> & {
|
|
236
|
+
fieldPermissionClassification?: CustomFieldPermissionClassification | null;
|
|
237
|
+
fieldReadAccess?: CustomFieldReadAccess | null;
|
|
238
|
+
fieldWriteAccess?: CustomFieldWriteAccess | null;
|
|
239
|
+
applicableGroup?: string | null;
|
|
240
|
+
collectDuring?: CustomFieldCollectionTiming | null;
|
|
241
|
+
rqlDefinitionFormula?: string | null;
|
|
242
|
+
};
|
|
167
243
|
if (!props.apiName.endsWith('__cfv2')) {
|
|
168
244
|
throw new Error(`Custom Field V2 api_name must end with __cfv2: ${props.apiName}`);
|
|
169
245
|
}
|
|
@@ -173,11 +249,45 @@ export class CustomField {
|
|
|
173
249
|
`but the field belongs to "${props.modelRqlName}".`,
|
|
174
250
|
);
|
|
175
251
|
}
|
|
252
|
+
if (runtimeProps.rqlDefinitionFormula != null && runtimeProps.fieldWriteAccess !== 'NO_ACCESS') {
|
|
253
|
+
throw new Error(`Formula custom field "${props.apiName}" must have fieldWriteAccess "NO_ACCESS".`);
|
|
254
|
+
}
|
|
255
|
+
if (props.modelRqlName === 'Employee') {
|
|
256
|
+
if (
|
|
257
|
+
runtimeProps.fieldPermissionClassification == null ||
|
|
258
|
+
runtimeProps.fieldReadAccess == null ||
|
|
259
|
+
runtimeProps.fieldWriteAccess == null ||
|
|
260
|
+
runtimeProps.applicableGroup == null
|
|
261
|
+
) {
|
|
262
|
+
throw new Error(
|
|
263
|
+
`Employee custom field "${props.apiName}" requires fieldPermissionClassification, ` +
|
|
264
|
+
`fieldReadAccess, fieldWriteAccess, and applicableGroup.`,
|
|
265
|
+
);
|
|
266
|
+
}
|
|
267
|
+
if (
|
|
268
|
+
runtimeProps.fieldReadAccess === 'ALL_ACCESS' &&
|
|
269
|
+
(runtimeProps.fieldPermissionClassification === 'SENSITIVE_PERSONAL_INFO' ||
|
|
270
|
+
runtimeProps.fieldPermissionClassification === 'SENSITIVE_EMPLOYMENT_INFO')
|
|
271
|
+
) {
|
|
272
|
+
throw new Error(
|
|
273
|
+
`Employee custom field "${props.apiName}" cannot use a sensitive permission classification ` +
|
|
274
|
+
`with fieldReadAccess "ALL_ACCESS".`,
|
|
275
|
+
);
|
|
276
|
+
}
|
|
277
|
+
if (
|
|
278
|
+
runtimeProps.collectDuring === 'ONBOARDING' &&
|
|
279
|
+
(runtimeProps.fieldReadAccess === 'ADMIN_ACCESS' || runtimeProps.fieldWriteAccess === 'ADMIN_ACCESS')
|
|
280
|
+
) {
|
|
281
|
+
throw new Error(
|
|
282
|
+
`Employee onboarding custom field "${props.apiName}" must grant the employee read and write access.`,
|
|
283
|
+
);
|
|
284
|
+
}
|
|
285
|
+
}
|
|
176
286
|
this._fieldId = props.fieldId ?? generateId('cfv2');
|
|
177
287
|
this.props = {
|
|
178
288
|
...props,
|
|
179
289
|
dataType: cloneJson(props.dataType),
|
|
180
|
-
}
|
|
290
|
+
} as CustomFieldProps<ModelRqlName>;
|
|
181
291
|
scope._register(this);
|
|
182
292
|
}
|
|
183
293
|
|
|
@@ -228,8 +338,12 @@ export class CustomField {
|
|
|
228
338
|
displayOrder: (component['display_order'] as number | null | undefined) ?? null,
|
|
229
339
|
};
|
|
230
340
|
if (typeof formula === 'string') {
|
|
341
|
+
if (common.fieldWriteAccess != null && common.fieldWriteAccess !== 'NO_ACCESS') {
|
|
342
|
+
throw new TypeError(`Formula CUSTOM_FIELD_V2 field_write_access must be NO_ACCESS.`);
|
|
343
|
+
}
|
|
231
344
|
return new CustomField(scope, {
|
|
232
345
|
...common,
|
|
346
|
+
fieldWriteAccess: 'NO_ACCESS',
|
|
233
347
|
rqlDefinitionFormula: formula,
|
|
234
348
|
collectDuring: null,
|
|
235
349
|
required: null,
|
|
@@ -25,15 +25,24 @@ export {
|
|
|
25
25
|
CustomField,
|
|
26
26
|
CustomField as CustomFieldV2,
|
|
27
27
|
type CustomFieldApiName,
|
|
28
|
+
type CustomFieldBaseProps,
|
|
28
29
|
type CustomFieldCollectionTiming,
|
|
29
30
|
type CustomFieldDataType,
|
|
30
31
|
type CustomFieldDefaultValue,
|
|
31
32
|
type CustomFieldPermissionClassification,
|
|
33
|
+
type CustomFieldPermissionProps,
|
|
32
34
|
type CustomFieldProps,
|
|
33
35
|
type CustomFieldReadAccess,
|
|
34
36
|
type CustomFieldType,
|
|
35
37
|
type CustomFieldUniqueIDCharacterType,
|
|
36
38
|
type CustomFieldWriteAccess,
|
|
39
|
+
type EmployeeCustomFieldPermissionProps,
|
|
40
|
+
type EmployeeCustomFieldProps,
|
|
41
|
+
type EmployeeFormulaCustomFieldProps,
|
|
42
|
+
type EmployeeUserInputCustomFieldProps,
|
|
43
|
+
type FormulaCustomFieldProps,
|
|
44
|
+
type NonEmployeeCustomFieldPermissionProps,
|
|
45
|
+
type UserInputCustomFieldProps,
|
|
37
46
|
} from './custom-field';
|
|
38
47
|
|
|
39
48
|
export { CustomFieldSection, type CustomFieldSectionProps } from './custom-field-section';
|
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.79'; // 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.79";
|
|
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.79";
|
|
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.79'; // 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.79'; // x-release-please-version
|
|
2
2
|
//# sourceMappingURL=version.mjs.map
|