@rippling/rippling-sdk 0.2.0-alpha.52 → 0.2.0-alpha.54
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 +24 -0
- package/client.d.mts.map +1 -1
- package/client.d.ts +24 -0
- package/client.d.ts.map +1 -1
- package/client.js +24 -0
- package/client.js.map +1 -1
- package/client.mjs +24 -0
- package/client.mjs.map +1 -1
- package/examples/manifest/custom-object-creation-workflow/custom-object-creation-workflow.ts +85 -0
- package/lib/manifest/_helpers.d.mts +7 -5
- package/lib/manifest/_helpers.d.mts.map +1 -1
- package/lib/manifest/_helpers.d.ts +7 -5
- package/lib/manifest/_helpers.d.ts.map +1 -1
- package/lib/manifest/_helpers.js +7 -5
- package/lib/manifest/_helpers.js.map +1 -1
- package/lib/manifest/_helpers.mjs +7 -5
- package/lib/manifest/_helpers.mjs.map +1 -1
- package/lib/manifest/index.d.mts +1 -0
- package/lib/manifest/index.d.mts.map +1 -1
- package/lib/manifest/index.d.ts +1 -0
- package/lib/manifest/index.d.ts.map +1 -1
- package/lib/manifest/index.js +3 -1
- package/lib/manifest/index.js.map +1 -1
- package/lib/manifest/index.mjs +1 -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/lib/manifest/rule.d.mts +6 -4
- package/lib/manifest/rule.d.mts.map +1 -1
- package/lib/manifest/rule.d.ts +6 -4
- package/lib/manifest/rule.d.ts.map +1 -1
- package/lib/manifest/rule.js +31 -9
- package/lib/manifest/rule.js.map +1 -1
- package/lib/manifest/rule.mjs +31 -9
- package/lib/manifest/rule.mjs.map +1 -1
- package/lib/manifest/workflow.d.mts +155 -0
- package/lib/manifest/workflow.d.mts.map +1 -0
- package/lib/manifest/workflow.d.ts +155 -0
- package/lib/manifest/workflow.d.ts.map +1 -0
- package/lib/manifest/workflow.js +51 -0
- package/lib/manifest/workflow.js.map +1 -0
- package/lib/manifest/workflow.mjs +47 -0
- package/lib/manifest/workflow.mjs.map +1 -0
- package/package.json +1 -1
- package/resources/break-types.d.mts +85 -0
- package/resources/break-types.d.mts.map +1 -0
- package/resources/break-types.d.ts +85 -0
- package/resources/break-types.d.ts.map +1 -0
- package/resources/break-types.js +32 -0
- package/resources/break-types.js.map +1 -0
- package/resources/break-types.mjs +28 -0
- package/resources/break-types.mjs.map +1 -0
- package/resources/draft-hires.d.mts +2 -2
- package/resources/draft-hires.d.mts.map +1 -1
- package/resources/draft-hires.d.ts +2 -2
- package/resources/draft-hires.d.ts.map +1 -1
- package/resources/earnings-inputs.d.mts +33 -0
- package/resources/earnings-inputs.d.mts.map +1 -1
- package/resources/earnings-inputs.d.ts +33 -0
- package/resources/earnings-inputs.d.ts.map +1 -1
- package/resources/index.d.mts +4 -0
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +4 -0
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +10 -2
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +4 -0
- package/resources/index.mjs.map +1 -1
- package/resources/scheduled-job-assignments.d.mts +156 -0
- package/resources/scheduled-job-assignments.d.mts.map +1 -0
- package/resources/scheduled-job-assignments.d.ts +156 -0
- package/resources/scheduled-job-assignments.d.ts.map +1 -0
- package/resources/scheduled-job-assignments.js +39 -0
- package/resources/scheduled-job-assignments.js.map +1 -0
- package/resources/scheduled-job-assignments.mjs +35 -0
- package/resources/scheduled-job-assignments.mjs.map +1 -0
- package/resources/software-deployments.d.mts +468 -0
- package/resources/software-deployments.d.mts.map +1 -0
- package/resources/software-deployments.d.ts +468 -0
- package/resources/software-deployments.d.ts.map +1 -0
- package/resources/software-deployments.js +56 -0
- package/resources/software-deployments.js.map +1 -0
- package/resources/software-deployments.mjs +52 -0
- package/resources/software-deployments.mjs.map +1 -0
- package/resources/worker-time-splits.d.mts +371 -0
- package/resources/worker-time-splits.d.mts.map +1 -0
- package/resources/worker-time-splits.d.ts +371 -0
- package/resources/worker-time-splits.d.ts.map +1 -0
- package/resources/worker-time-splits.js +56 -0
- package/resources/worker-time-splits.js.map +1 -0
- package/resources/worker-time-splits.mjs +52 -0
- package/resources/worker-time-splits.mjs.map +1 -0
- package/resources/workers.d.mts +1 -1
- package/resources/workers.d.ts +1 -1
- package/resources/workers.js +1 -1
- package/resources/workers.mjs +1 -1
- package/resources/workflow-action-executions.d.mts +84 -0
- package/resources/workflow-action-executions.d.mts.map +1 -1
- package/resources/workflow-action-executions.d.ts +84 -0
- package/resources/workflow-action-executions.d.ts.map +1 -1
- package/src/client.ts +100 -0
- package/src/lib/manifest/_helpers.ts +7 -5
- package/src/lib/manifest/index.ts +26 -0
- package/src/lib/manifest/manifest-builder.ts +2 -1
- package/src/lib/manifest/rule.ts +55 -15
- package/src/lib/manifest/workflow.ts +244 -0
- package/src/resources/break-types.ts +120 -0
- package/src/resources/draft-hires.ts +2 -2
- package/src/resources/earnings-inputs.ts +39 -0
- package/src/resources/index.ts +38 -0
- package/src/resources/scheduled-job-assignments.ts +216 -0
- package/src/resources/software-deployments.ts +607 -0
- package/src/resources/worker-time-splits.ts +480 -0
- package/src/resources/workers.ts +1 -1
- package/src/resources/workflow-action-executions.ts +98 -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
- package/examples/manifest/dental-practice-management/manifest.json +0 -1912
- package/examples/manifest/gym-membership-management/manifest.json +0 -1991
- package/examples/manifest/simple-todo-app/manifest.json +0 -429
package/src/client.ts
CHANGED
|
@@ -19,6 +19,13 @@ import { AbstractPage, PageCursorURLResponse } from './core/pagination';
|
|
|
19
19
|
import * as Uploads from './core/uploads';
|
|
20
20
|
import * as API from './resources/index';
|
|
21
21
|
import { APIPromise } from './core/api-promise';
|
|
22
|
+
import {
|
|
23
|
+
BreakTypeListParams,
|
|
24
|
+
BreakTypeListResponse,
|
|
25
|
+
BreakTypeListResponsesPageCursorURL,
|
|
26
|
+
BreakTypeRetrieveResponse,
|
|
27
|
+
BreakTypes,
|
|
28
|
+
} from './resources/break-types';
|
|
22
29
|
import {
|
|
23
30
|
BusinessPartnerGroup,
|
|
24
31
|
BusinessPartnerGroupCreateParams,
|
|
@@ -323,6 +330,13 @@ import {
|
|
|
323
330
|
ReportRunRetrieveResponse,
|
|
324
331
|
ReportRuns,
|
|
325
332
|
} from './resources/report-runs';
|
|
333
|
+
import {
|
|
334
|
+
ScheduledJobAssignmentListParams,
|
|
335
|
+
ScheduledJobAssignmentListResponse,
|
|
336
|
+
ScheduledJobAssignmentListResponsesPageCursorURL,
|
|
337
|
+
ScheduledJobAssignmentRetrieveResponse,
|
|
338
|
+
ScheduledJobAssignments,
|
|
339
|
+
} from './resources/scheduled-job-assignments';
|
|
326
340
|
import {
|
|
327
341
|
ScheduleCreateParams,
|
|
328
342
|
ScheduleCreateResponse,
|
|
@@ -365,6 +379,18 @@ import {
|
|
|
365
379
|
ShiftassignmentUpdateResponse,
|
|
366
380
|
Shiftassignments,
|
|
367
381
|
} from './resources/shiftassignments';
|
|
382
|
+
import {
|
|
383
|
+
SoftwareDeploymentCreateParams,
|
|
384
|
+
SoftwareDeploymentCreateResponse,
|
|
385
|
+
SoftwareDeploymentListParams,
|
|
386
|
+
SoftwareDeploymentListResponse,
|
|
387
|
+
SoftwareDeploymentListResponsesPageCursorURL,
|
|
388
|
+
SoftwareDeploymentRetrieveParams,
|
|
389
|
+
SoftwareDeploymentRetrieveResponse,
|
|
390
|
+
SoftwareDeploymentUpdateParams,
|
|
391
|
+
SoftwareDeploymentUpdateResponse,
|
|
392
|
+
SoftwareDeployments,
|
|
393
|
+
} from './resources/software-deployments';
|
|
368
394
|
import { SSOMe, SSOMeListParams, SSOMeResource } from './resources/sso-me';
|
|
369
395
|
import {
|
|
370
396
|
Team,
|
|
@@ -443,6 +469,18 @@ import {
|
|
|
443
469
|
WorkLocations,
|
|
444
470
|
WorkLocationsPageCursorURL,
|
|
445
471
|
} from './resources/work-locations';
|
|
472
|
+
import {
|
|
473
|
+
WorkerTimeSplitCreateParams,
|
|
474
|
+
WorkerTimeSplitCreateResponse,
|
|
475
|
+
WorkerTimeSplitListParams,
|
|
476
|
+
WorkerTimeSplitListResponse,
|
|
477
|
+
WorkerTimeSplitListResponsesPageCursorURL,
|
|
478
|
+
WorkerTimeSplitRetrieveParams,
|
|
479
|
+
WorkerTimeSplitRetrieveResponse,
|
|
480
|
+
WorkerTimeSplitUpdateParams,
|
|
481
|
+
WorkerTimeSplitUpdateResponse,
|
|
482
|
+
WorkerTimeSplits,
|
|
483
|
+
} from './resources/worker-time-splits';
|
|
446
484
|
import {
|
|
447
485
|
Worker,
|
|
448
486
|
WorkerListParams,
|
|
@@ -1350,6 +1388,10 @@ export class RipplingSDK {
|
|
|
1350
1388
|
* Job related information for the company
|
|
1351
1389
|
*/
|
|
1352
1390
|
jobPayRateExceptions: API.JobPayRateExceptions = new API.JobPayRateExceptions(this);
|
|
1391
|
+
/**
|
|
1392
|
+
* Break types configured by the company for time tracking
|
|
1393
|
+
*/
|
|
1394
|
+
breakTypes: API.BreakTypes = new API.BreakTypes(this);
|
|
1353
1395
|
/**
|
|
1354
1396
|
* Someone who applies to a job requisition opened by the company
|
|
1355
1397
|
*/
|
|
@@ -1445,10 +1487,18 @@ export class RipplingSDK {
|
|
|
1445
1487
|
* Schedules used by the company
|
|
1446
1488
|
*/
|
|
1447
1489
|
schedules: API.Schedules = new API.Schedules(this);
|
|
1490
|
+
/**
|
|
1491
|
+
* Job related information for the company
|
|
1492
|
+
*/
|
|
1493
|
+
scheduledJobAssignments: API.ScheduledJobAssignments = new API.ScheduledJobAssignments(this);
|
|
1448
1494
|
/**
|
|
1449
1495
|
* Shift assignments assigned to workers
|
|
1450
1496
|
*/
|
|
1451
1497
|
shiftassignments: API.Shiftassignments = new API.Shiftassignments(this);
|
|
1498
|
+
/**
|
|
1499
|
+
* Software deployed to company devices
|
|
1500
|
+
*/
|
|
1501
|
+
softwareDeployments: API.SoftwareDeployments = new API.SoftwareDeployments(this);
|
|
1452
1502
|
/**
|
|
1453
1503
|
* Job titles used by the company
|
|
1454
1504
|
*/
|
|
@@ -1457,6 +1507,10 @@ export class RipplingSDK {
|
|
|
1457
1507
|
* Unassigned shifts that are part of a schedule
|
|
1458
1508
|
*/
|
|
1459
1509
|
unassignedshifts: API.Unassignedshifts = new API.Unassignedshifts(this);
|
|
1510
|
+
/**
|
|
1511
|
+
* Job related information for the company
|
|
1512
|
+
*/
|
|
1513
|
+
workerTimeSplits: API.WorkerTimeSplits = new API.WorkerTimeSplits(this);
|
|
1460
1514
|
/**
|
|
1461
1515
|
* Execute workflow actions like sending emails, Slack messages, and notifications
|
|
1462
1516
|
*/
|
|
@@ -1501,6 +1555,7 @@ RipplingSDK.BusinessPartnerGroups = BusinessPartnerGroups;
|
|
|
1501
1555
|
RipplingSDK.Functions = Functions;
|
|
1502
1556
|
RipplingSDK.JobAssignments = JobAssignments;
|
|
1503
1557
|
RipplingSDK.JobPayRateExceptions = JobPayRateExceptions;
|
|
1558
|
+
RipplingSDK.BreakTypes = BreakTypes;
|
|
1504
1559
|
RipplingSDK.Candidates = Candidates;
|
|
1505
1560
|
RipplingSDK.CandidateApplications = CandidateApplications;
|
|
1506
1561
|
RipplingSDK.CompanyLegalEntities = CompanyLegalEntities;
|
|
@@ -1527,9 +1582,12 @@ RipplingSDK.PlatformCapabilities = PlatformCapabilities;
|
|
|
1527
1582
|
RipplingSDK.Reports = Reports;
|
|
1528
1583
|
RipplingSDK.ReportRuns = ReportRuns;
|
|
1529
1584
|
RipplingSDK.Schedules = Schedules;
|
|
1585
|
+
RipplingSDK.ScheduledJobAssignments = ScheduledJobAssignments;
|
|
1530
1586
|
RipplingSDK.Shiftassignments = Shiftassignments;
|
|
1587
|
+
RipplingSDK.SoftwareDeployments = SoftwareDeployments;
|
|
1531
1588
|
RipplingSDK.Titles = Titles;
|
|
1532
1589
|
RipplingSDK.Unassignedshifts = Unassignedshifts;
|
|
1590
|
+
RipplingSDK.WorkerTimeSplits = WorkerTimeSplits;
|
|
1533
1591
|
RipplingSDK.WorkflowActionExecutions = WorkflowActionExecutions;
|
|
1534
1592
|
RipplingSDK.ShiftAssignments = ShiftAssignments;
|
|
1535
1593
|
RipplingSDK.UnassignedShifts = UnassignedShifts;
|
|
@@ -1833,6 +1891,14 @@ export declare namespace RipplingSDK {
|
|
|
1833
1891
|
type JobPayRateExceptionListChangeLogParams as JobPayRateExceptionListChangeLogParams,
|
|
1834
1892
|
};
|
|
1835
1893
|
|
|
1894
|
+
export {
|
|
1895
|
+
BreakTypes as BreakTypes,
|
|
1896
|
+
type BreakTypeListResponse as BreakTypeListResponse,
|
|
1897
|
+
type BreakTypeRetrieveResponse as BreakTypeRetrieveResponse,
|
|
1898
|
+
type BreakTypeListResponsesPageCursorURL as BreakTypeListResponsesPageCursorURL,
|
|
1899
|
+
type BreakTypeListParams as BreakTypeListParams,
|
|
1900
|
+
};
|
|
1901
|
+
|
|
1836
1902
|
export {
|
|
1837
1903
|
Candidates as Candidates,
|
|
1838
1904
|
type CandidateListResponse as CandidateListResponse,
|
|
@@ -2038,6 +2104,14 @@ export declare namespace RipplingSDK {
|
|
|
2038
2104
|
type ScheduleUpdateParams as ScheduleUpdateParams,
|
|
2039
2105
|
};
|
|
2040
2106
|
|
|
2107
|
+
export {
|
|
2108
|
+
ScheduledJobAssignments as ScheduledJobAssignments,
|
|
2109
|
+
type ScheduledJobAssignmentListResponse as ScheduledJobAssignmentListResponse,
|
|
2110
|
+
type ScheduledJobAssignmentRetrieveResponse as ScheduledJobAssignmentRetrieveResponse,
|
|
2111
|
+
type ScheduledJobAssignmentListResponsesPageCursorURL as ScheduledJobAssignmentListResponsesPageCursorURL,
|
|
2112
|
+
type ScheduledJobAssignmentListParams as ScheduledJobAssignmentListParams,
|
|
2113
|
+
};
|
|
2114
|
+
|
|
2041
2115
|
export {
|
|
2042
2116
|
Shiftassignments as Shiftassignments,
|
|
2043
2117
|
type ShiftassignmentListResponse as ShiftassignmentListResponse,
|
|
@@ -2051,6 +2125,19 @@ export declare namespace RipplingSDK {
|
|
|
2051
2125
|
type ShiftassignmentUpdateParams as ShiftassignmentUpdateParams,
|
|
2052
2126
|
};
|
|
2053
2127
|
|
|
2128
|
+
export {
|
|
2129
|
+
SoftwareDeployments as SoftwareDeployments,
|
|
2130
|
+
type SoftwareDeploymentListResponse as SoftwareDeploymentListResponse,
|
|
2131
|
+
type SoftwareDeploymentCreateResponse as SoftwareDeploymentCreateResponse,
|
|
2132
|
+
type SoftwareDeploymentRetrieveResponse as SoftwareDeploymentRetrieveResponse,
|
|
2133
|
+
type SoftwareDeploymentUpdateResponse as SoftwareDeploymentUpdateResponse,
|
|
2134
|
+
type SoftwareDeploymentListResponsesPageCursorURL as SoftwareDeploymentListResponsesPageCursorURL,
|
|
2135
|
+
type SoftwareDeploymentListParams as SoftwareDeploymentListParams,
|
|
2136
|
+
type SoftwareDeploymentCreateParams as SoftwareDeploymentCreateParams,
|
|
2137
|
+
type SoftwareDeploymentRetrieveParams as SoftwareDeploymentRetrieveParams,
|
|
2138
|
+
type SoftwareDeploymentUpdateParams as SoftwareDeploymentUpdateParams,
|
|
2139
|
+
};
|
|
2140
|
+
|
|
2054
2141
|
export {
|
|
2055
2142
|
Titles as Titles,
|
|
2056
2143
|
type TitleListResponse as TitleListResponse,
|
|
@@ -2076,6 +2163,19 @@ export declare namespace RipplingSDK {
|
|
|
2076
2163
|
type UnassignedshiftUpdateParams as UnassignedshiftUpdateParams,
|
|
2077
2164
|
};
|
|
2078
2165
|
|
|
2166
|
+
export {
|
|
2167
|
+
WorkerTimeSplits as WorkerTimeSplits,
|
|
2168
|
+
type WorkerTimeSplitListResponse as WorkerTimeSplitListResponse,
|
|
2169
|
+
type WorkerTimeSplitCreateResponse as WorkerTimeSplitCreateResponse,
|
|
2170
|
+
type WorkerTimeSplitRetrieveResponse as WorkerTimeSplitRetrieveResponse,
|
|
2171
|
+
type WorkerTimeSplitUpdateResponse as WorkerTimeSplitUpdateResponse,
|
|
2172
|
+
type WorkerTimeSplitListResponsesPageCursorURL as WorkerTimeSplitListResponsesPageCursorURL,
|
|
2173
|
+
type WorkerTimeSplitListParams as WorkerTimeSplitListParams,
|
|
2174
|
+
type WorkerTimeSplitCreateParams as WorkerTimeSplitCreateParams,
|
|
2175
|
+
type WorkerTimeSplitRetrieveParams as WorkerTimeSplitRetrieveParams,
|
|
2176
|
+
type WorkerTimeSplitUpdateParams as WorkerTimeSplitUpdateParams,
|
|
2177
|
+
};
|
|
2178
|
+
|
|
2079
2179
|
export {
|
|
2080
2180
|
WorkflowActionExecutions as WorkflowActionExecutions,
|
|
2081
2181
|
type WorkflowActionExecutionCreateResponse as WorkflowActionExecutionCreateResponse,
|
|
@@ -129,12 +129,14 @@ export const ALLOWED_SUMMARY_OUTPUT: Record<SummaryAggregation, ReadonlySet<Fiel
|
|
|
129
129
|
* used as a summary filter at all": field types **absent from this map**
|
|
130
130
|
* are rejected as filter fields entirely. The UI-hidden types are:
|
|
131
131
|
*
|
|
132
|
-
* SELECT
|
|
132
|
+
* SELECT — array-valued at the RQL layer; the
|
|
133
133
|
* "is this option selected?" semantics are
|
|
134
|
-
* ambiguous for aggregations.
|
|
135
|
-
*
|
|
136
|
-
*
|
|
137
|
-
*
|
|
134
|
+
* ambiguous for aggregations.
|
|
135
|
+
* RADIO — single-value choice fields are not supported
|
|
136
|
+
* by the summary filter condition builder.
|
|
137
|
+
* When a choice should drive an aggregate filter,
|
|
138
|
+
* model a plain BOOLEAN on the child CO, update it
|
|
139
|
+
* with a `Rule` action, and filter on that.
|
|
138
140
|
* LONG_TEXT — backend hard-rejects (parent_child_util.py).
|
|
139
141
|
* OG_REFERENCE_FIELD — lookup/parent-child: filter-on-what is
|
|
140
142
|
* ambiguous (id vs. name vs. edge metadata).
|
|
@@ -186,3 +186,29 @@ export {
|
|
|
186
186
|
type ValidationLoadFromExistingOptions,
|
|
187
187
|
type ValidationProps,
|
|
188
188
|
} from './validation';
|
|
189
|
+
|
|
190
|
+
export {
|
|
191
|
+
Workflow,
|
|
192
|
+
type WorkflowAutomationEventType,
|
|
193
|
+
type WorkflowAnnualSchedule,
|
|
194
|
+
type WorkflowBusinessTrigger,
|
|
195
|
+
type WorkflowCronSchedule,
|
|
196
|
+
type WorkflowCustomSchedule,
|
|
197
|
+
type WorkflowCustomScheduleFrequencyUnit,
|
|
198
|
+
type WorkflowDateRelativeOperatorType,
|
|
199
|
+
type WorkflowDateRelativeTrigger,
|
|
200
|
+
type WorkflowDeletionIdentifier,
|
|
201
|
+
type WorkflowManualTrigger,
|
|
202
|
+
type WorkflowMonthlyOnDayOfWeekSchedule,
|
|
203
|
+
type WorkflowMonthlySchedule,
|
|
204
|
+
type WorkflowOneTimeSchedule,
|
|
205
|
+
type WorkflowProps,
|
|
206
|
+
type WorkflowQuarterlySchedule,
|
|
207
|
+
type WorkflowRecordChangeOperationType,
|
|
208
|
+
type WorkflowRecordChangeTrigger,
|
|
209
|
+
type WorkflowScheduledFrequencyType,
|
|
210
|
+
type WorkflowScheduledTrigger,
|
|
211
|
+
type WorkflowTimeOfDaySchedule,
|
|
212
|
+
type WorkflowTrigger,
|
|
213
|
+
type WorkflowTriggerBase,
|
|
214
|
+
} from './workflow';
|
package/src/lib/manifest/rule.ts
CHANGED
|
@@ -23,8 +23,9 @@ export interface RuleAction {
|
|
|
23
23
|
/**
|
|
24
24
|
* Set the target field to a fixed value. Mutually exclusive with `rqlFormula`.
|
|
25
25
|
*
|
|
26
|
-
* Optional. For `
|
|
27
|
-
*
|
|
26
|
+
* Optional. For `SelectField` targets, pass one option value or an array of option
|
|
27
|
+
* values; a scalar is serialized as a single-element array. For `RadioField` targets,
|
|
28
|
+
* pass exactly one option value as a scalar; arrays are rejected.
|
|
28
29
|
*/
|
|
29
30
|
fixedValue?: any;
|
|
30
31
|
/**
|
|
@@ -68,8 +69,8 @@ export interface RuleProps {
|
|
|
68
69
|
* Controls when an `UPDATE` trigger fires relative to the condition.
|
|
69
70
|
* One of `'MEETS_CONDITION_AFTER_ONLY'` | `'MEETS_CONDITION_BEFORE_OR_AFTER'`.
|
|
70
71
|
*
|
|
71
|
-
* Conditional.
|
|
72
|
-
*
|
|
72
|
+
* Conditional. Required when `triggerType` is `'UPDATE'` or `'CREATE_OR_UPDATE'`.
|
|
73
|
+
* Must be omitted when `triggerType` is `'CREATE'`.
|
|
73
74
|
*/
|
|
74
75
|
updateTriggerType?: UpdateTriggerType;
|
|
75
76
|
/**
|
|
@@ -91,16 +92,28 @@ export interface RuleLoadFromExistingOptions extends ExistingManifestContextOpti
|
|
|
91
92
|
customObjectApiName?: string;
|
|
92
93
|
}
|
|
93
94
|
|
|
94
|
-
|
|
95
|
+
const VALID_TRIGGERS: TriggerType[] = ['CREATE', 'UPDATE', 'CREATE_OR_UPDATE'];
|
|
96
|
+
const VALID_UPDATE_TRIGGER_TYPES: UpdateTriggerType[] = [
|
|
97
|
+
'MEETS_CONDITION_AFTER_ONLY',
|
|
98
|
+
'MEETS_CONDITION_BEFORE_OR_AFTER',
|
|
99
|
+
];
|
|
100
|
+
|
|
95
101
|
function fixedValueToWire(targetField: Field, value: any): any {
|
|
96
102
|
const ft = targetField.getFieldType();
|
|
97
|
-
if (ft
|
|
98
|
-
return value;
|
|
103
|
+
if (ft === 'SELECT') {
|
|
104
|
+
return Array.isArray(value) ? value : [value];
|
|
99
105
|
}
|
|
100
|
-
|
|
106
|
+
|
|
107
|
+
if (ft === 'RADIO') {
|
|
108
|
+
if (Array.isArray(value)) {
|
|
109
|
+
throw new TypeError(
|
|
110
|
+
`Rule.fixedValue for RADIO field ${targetField.getApiName()} must be a scalar value.`,
|
|
111
|
+
);
|
|
112
|
+
}
|
|
101
113
|
return value;
|
|
102
114
|
}
|
|
103
|
-
|
|
115
|
+
|
|
116
|
+
return value;
|
|
104
117
|
}
|
|
105
118
|
|
|
106
119
|
function actionToDict(action: RuleAction): Record<string, any> {
|
|
@@ -119,6 +132,37 @@ function hasOwn(value: Record<string, any>, key: string): boolean {
|
|
|
119
132
|
return Object.prototype.hasOwnProperty.call(value, key);
|
|
120
133
|
}
|
|
121
134
|
|
|
135
|
+
function validateTriggerConfig(props: Pick<RuleProps, 'triggerType' | 'updateTriggerType'>): void {
|
|
136
|
+
if (!VALID_TRIGGERS.includes(props.triggerType)) {
|
|
137
|
+
throw new Error(
|
|
138
|
+
`Invalid trigger_type: ${props.triggerType}. Must be one of: ${VALID_TRIGGERS.join(', ')}`,
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
if (props.triggerType === 'CREATE') {
|
|
143
|
+
if (props.updateTriggerType != null) {
|
|
144
|
+
throw new Error('updateTriggerType must be omitted when triggerType is CREATE.');
|
|
145
|
+
}
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
if (props.updateTriggerType == null) {
|
|
150
|
+
throw new Error(
|
|
151
|
+
`updateTriggerType is required when triggerType is ${
|
|
152
|
+
props.triggerType
|
|
153
|
+
}. Must be one of: ${VALID_UPDATE_TRIGGER_TYPES.join(', ')}`,
|
|
154
|
+
);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
if (!VALID_UPDATE_TRIGGER_TYPES.includes(props.updateTriggerType)) {
|
|
158
|
+
throw new Error(
|
|
159
|
+
`Invalid update_trigger_type: ${
|
|
160
|
+
props.updateTriggerType
|
|
161
|
+
}. Must be one of: ${VALID_UPDATE_TRIGGER_TYPES.join(', ')}`,
|
|
162
|
+
);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
122
166
|
/**
|
|
123
167
|
* Defines a record-triggered automation rule and registers it with the manifest.
|
|
124
168
|
*
|
|
@@ -161,14 +205,10 @@ export class Rule {
|
|
|
161
205
|
* @param customObject - The custom object this rule is attached to.
|
|
162
206
|
* @param props - Initialization properties.
|
|
163
207
|
* @throws {Error} If `props.triggerType` is not one of `'CREATE'`, `'UPDATE'`, `'CREATE_OR_UPDATE'`.
|
|
208
|
+
* @throws {Error} If `props.updateTriggerType` is missing or invalid for update-style triggers.
|
|
164
209
|
*/
|
|
165
210
|
constructor(customObject: CustomObject, props: RuleProps) {
|
|
166
|
-
|
|
167
|
-
if (!VALID_TRIGGERS.includes(props.triggerType)) {
|
|
168
|
-
throw new Error(
|
|
169
|
-
`Invalid trigger_type: ${props.triggerType}. Must be one of: ${VALID_TRIGGERS.join(', ')}`,
|
|
170
|
-
);
|
|
171
|
-
}
|
|
211
|
+
validateTriggerConfig(props);
|
|
172
212
|
this._flowId = props.flowId ?? generateId('flow');
|
|
173
213
|
this._customObjectApiName = customObject.getApiName();
|
|
174
214
|
this._flowName = props.flowName;
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
import { generateId } from './_helpers';
|
|
2
|
+
import type { ManifestFunction } from './manifest-function';
|
|
3
|
+
import type { ManifestComponentDeletion, ManifestScope } from './manifest-builder';
|
|
4
|
+
|
|
5
|
+
export type WorkflowAutomationEventType =
|
|
6
|
+
| 'AUTOMATION_EVENT_TYPE_BUSINESS'
|
|
7
|
+
| 'AUTOMATION_EVENT_TYPE_RECORD_CHANGE'
|
|
8
|
+
| 'AUTOMATION_EVENT_TYPE_SCHEDULED'
|
|
9
|
+
| 'AUTOMATION_EVENT_TYPE_MANUAL'
|
|
10
|
+
| 'AUTOMATION_EVENT_TYPE_DATE_RELATIVE';
|
|
11
|
+
|
|
12
|
+
export type WorkflowRecordChangeOperationType =
|
|
13
|
+
| 'RECORD_CHANGE_OPERATION_TYPE_CREATE'
|
|
14
|
+
| 'RECORD_CHANGE_OPERATION_TYPE_UPDATE'
|
|
15
|
+
| 'RECORD_CHANGE_OPERATION_TYPE_DELETE'
|
|
16
|
+
| 'RECORD_CHANGE_OPERATION_TYPE_CREATE_OR_UPDATE';
|
|
17
|
+
|
|
18
|
+
export type WorkflowDateRelativeOperatorType =
|
|
19
|
+
| 'DATE_RELATIVE_TRIGGER_OPERATOR_TYPE_EQ'
|
|
20
|
+
| 'DATE_RELATIVE_TRIGGER_OPERATOR_TYPE_WITHIN'
|
|
21
|
+
| 'DATE_RELATIVE_TRIGGER_OPERATOR_TYPE_BETWEEN';
|
|
22
|
+
|
|
23
|
+
export type WorkflowScheduledFrequencyType =
|
|
24
|
+
| 'SCHEDULED_TRIGGER_FREQUENCY_TYPE_DAILY'
|
|
25
|
+
| 'SCHEDULED_TRIGGER_FREQUENCY_TYPE_WEEKDAY_DAILY'
|
|
26
|
+
| 'SCHEDULED_TRIGGER_FREQUENCY_TYPE_WEEKLY'
|
|
27
|
+
| 'SCHEDULED_TRIGGER_FREQUENCY_TYPE_BIWEEKLY'
|
|
28
|
+
| 'SCHEDULED_TRIGGER_FREQUENCY_TYPE_MONTHLY'
|
|
29
|
+
| 'SCHEDULED_TRIGGER_FREQUENCY_TYPE_MONTHLY_ON_DAY_OF_WEEK'
|
|
30
|
+
| 'SCHEDULED_TRIGGER_FREQUENCY_TYPE_ONE_TIME'
|
|
31
|
+
| 'SCHEDULED_TRIGGER_FREQUENCY_TYPE_QUARTERLY'
|
|
32
|
+
| 'SCHEDULED_TRIGGER_FREQUENCY_TYPE_ANNUALLY'
|
|
33
|
+
| 'SCHEDULED_TRIGGER_FREQUENCY_TYPE_CUSTOM'
|
|
34
|
+
| 'SCHEDULED_TRIGGER_FREQUENCY_TYPE_CRON';
|
|
35
|
+
|
|
36
|
+
export type WorkflowCustomScheduleFrequencyUnit =
|
|
37
|
+
| 'CUSTOM_SCHEDULE_TRIGGER_FREQUENCY_UNIT_DAYS'
|
|
38
|
+
| 'CUSTOM_SCHEDULE_TRIGGER_FREQUENCY_UNIT_WEEKS'
|
|
39
|
+
| 'CUSTOM_SCHEDULE_TRIGGER_FREQUENCY_UNIT_MONTHS'
|
|
40
|
+
| 'CUSTOM_SCHEDULE_TRIGGER_FREQUENCY_UNIT_YEARS'
|
|
41
|
+
| 'CUSTOM_SCHEDULE_TRIGGER_FREQUENCY_UNIT_HOURS'
|
|
42
|
+
| 'CUSTOM_SCHEDULE_TRIGGER_FREQUENCY_UNIT_MINUTES';
|
|
43
|
+
|
|
44
|
+
export interface WorkflowTimeOfDaySchedule {
|
|
45
|
+
hour_of_day: number;
|
|
46
|
+
minute_of_hour?: number;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export interface WorkflowOneTimeSchedule extends WorkflowTimeOfDaySchedule {
|
|
50
|
+
year: number;
|
|
51
|
+
month_of_year: number;
|
|
52
|
+
day_of_month: number;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export interface WorkflowWeeklySchedule extends WorkflowTimeOfDaySchedule {
|
|
56
|
+
day_of_week: number[];
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export interface WorkflowMonthlySchedule extends WorkflowTimeOfDaySchedule {
|
|
60
|
+
day_of_month: number;
|
|
61
|
+
start_month?: number;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export interface WorkflowMonthlyOnDayOfWeekSchedule extends WorkflowTimeOfDaySchedule {
|
|
65
|
+
day_of_week: number;
|
|
66
|
+
day_of_month: number;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export interface WorkflowQuarterlySchedule extends WorkflowTimeOfDaySchedule {
|
|
70
|
+
day_of_month: number;
|
|
71
|
+
month_of_year: number;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export interface WorkflowAnnualSchedule extends WorkflowTimeOfDaySchedule {
|
|
75
|
+
day_of_month: number;
|
|
76
|
+
month_of_year: number;
|
|
77
|
+
start_month?: number;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export interface WorkflowCronSchedule {
|
|
81
|
+
cron_expression: string;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export interface WorkflowCustomSchedule extends WorkflowTimeOfDaySchedule {
|
|
85
|
+
custom_schedule_frequency: WorkflowCustomScheduleFrequencyUnit;
|
|
86
|
+
custom_schedule_frequency_value: number;
|
|
87
|
+
daily_schedule?: WorkflowTimeOfDaySchedule;
|
|
88
|
+
weekly_schedule?: WorkflowWeeklySchedule;
|
|
89
|
+
monthly_schedule?: WorkflowMonthlySchedule;
|
|
90
|
+
annual_schedule?: WorkflowAnnualSchedule;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export interface WorkflowTriggerBase {
|
|
94
|
+
automation_event_type: WorkflowAutomationEventType;
|
|
95
|
+
og_module?: string;
|
|
96
|
+
base_model?: string;
|
|
97
|
+
rql_formula?: string;
|
|
98
|
+
is_basic_workflow?: boolean;
|
|
99
|
+
og_category?: string;
|
|
100
|
+
condition_builder_mode?: string;
|
|
101
|
+
conditions_tree?: string;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export interface WorkflowBusinessTrigger extends WorkflowTriggerBase {
|
|
105
|
+
automation_event_type: 'AUTOMATION_EVENT_TYPE_BUSINESS';
|
|
106
|
+
event_name: string;
|
|
107
|
+
business_event_trigger?: {
|
|
108
|
+
navigation_path?: string;
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export interface WorkflowRecordChangeTrigger extends WorkflowTriggerBase {
|
|
113
|
+
automation_event_type: 'AUTOMATION_EVENT_TYPE_RECORD_CHANGE';
|
|
114
|
+
record_change_operation_type: WorkflowRecordChangeOperationType;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export interface WorkflowDateRelativeTrigger extends WorkflowTriggerBase {
|
|
118
|
+
automation_event_type: 'AUTOMATION_EVENT_TYPE_DATE_RELATIVE';
|
|
119
|
+
date_relative_trigger: {
|
|
120
|
+
hour_of_day: number;
|
|
121
|
+
minute_of_hour?: number;
|
|
122
|
+
timezone?: string;
|
|
123
|
+
base_model_date_field_rql_path?: string;
|
|
124
|
+
trigger_on_anniversary?: boolean;
|
|
125
|
+
date_range_operator?: WorkflowDateRelativeOperatorType;
|
|
126
|
+
should_trigger_exactly_once_per_trigger_object?: boolean;
|
|
127
|
+
operands?: Array<{ time_delta?: { days: number } }>;
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export interface WorkflowScheduledTrigger extends WorkflowTriggerBase {
|
|
132
|
+
automation_event_type: 'AUTOMATION_EVENT_TYPE_SCHEDULED';
|
|
133
|
+
scheduled_trigger: {
|
|
134
|
+
frequency: WorkflowScheduledFrequencyType;
|
|
135
|
+
timezone: string;
|
|
136
|
+
daily_schedule?: WorkflowTimeOfDaySchedule;
|
|
137
|
+
weekday_schedule?: WorkflowTimeOfDaySchedule;
|
|
138
|
+
one_time_schedule?: WorkflowOneTimeSchedule;
|
|
139
|
+
weekly_schedule?: WorkflowWeeklySchedule;
|
|
140
|
+
bi_weekly_schedule?: WorkflowWeeklySchedule;
|
|
141
|
+
monthly_schedule?: WorkflowMonthlySchedule;
|
|
142
|
+
monthly_on_day_of_week_schedule?: WorkflowMonthlyOnDayOfWeekSchedule;
|
|
143
|
+
quarterly_schedule?: WorkflowQuarterlySchedule;
|
|
144
|
+
annual_schedule?: WorkflowAnnualSchedule;
|
|
145
|
+
cron_schedule?: WorkflowCronSchedule;
|
|
146
|
+
custom_schedule?: WorkflowCustomSchedule;
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
export interface WorkflowManualTrigger extends WorkflowTriggerBase {
|
|
151
|
+
automation_event_type: 'AUTOMATION_EVENT_TYPE_MANUAL';
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
export type WorkflowTrigger =
|
|
155
|
+
| WorkflowBusinessTrigger
|
|
156
|
+
| WorkflowRecordChangeTrigger
|
|
157
|
+
| WorkflowDateRelativeTrigger
|
|
158
|
+
| WorkflowScheduledTrigger
|
|
159
|
+
| WorkflowManualTrigger;
|
|
160
|
+
|
|
161
|
+
export interface WorkflowDeletionIdentifier {
|
|
162
|
+
definitionId: string;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
export interface WorkflowProps {
|
|
166
|
+
/**
|
|
167
|
+
* Stable workflow definition id. Auto-generated when omitted.
|
|
168
|
+
*/
|
|
169
|
+
definitionId?: string;
|
|
170
|
+
/**
|
|
171
|
+
* Workflow title shown to admins.
|
|
172
|
+
*/
|
|
173
|
+
title: string;
|
|
174
|
+
/**
|
|
175
|
+
* Short workflow description shown to admins.
|
|
176
|
+
*/
|
|
177
|
+
description: string;
|
|
178
|
+
/**
|
|
179
|
+
* The function this workflow runs. Pass a live {@link ManifestFunction} reference,
|
|
180
|
+
* or a raw api_name string for functions defined outside this manifest.
|
|
181
|
+
*
|
|
182
|
+
* Required.
|
|
183
|
+
*/
|
|
184
|
+
function: ManifestFunction | string;
|
|
185
|
+
/**
|
|
186
|
+
* Trigger definition in the workflows v2 proto JSON shape.
|
|
187
|
+
*/
|
|
188
|
+
trigger: WorkflowTrigger;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* Defines a simple Workflow Studio workflow and registers it with the manifest.
|
|
193
|
+
*
|
|
194
|
+
* This intentionally models only the authoring inputs we need today: workflow
|
|
195
|
+
* metadata, trigger JSON, and the function reference. The installer/backend can
|
|
196
|
+
* derive the graph from these fields later.
|
|
197
|
+
*/
|
|
198
|
+
export class Workflow {
|
|
199
|
+
static readonly componentType = 'WORKFLOW_DEFINITION' as const;
|
|
200
|
+
|
|
201
|
+
static toDeletionIdentifier(identifier: WorkflowDeletionIdentifier | string): ManifestComponentDeletion {
|
|
202
|
+
const definitionId = typeof identifier === 'string' ? identifier : identifier.definitionId;
|
|
203
|
+
return {
|
|
204
|
+
type: Workflow.componentType,
|
|
205
|
+
definition_id: definitionId,
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
private readonly _definitionId: string;
|
|
210
|
+
private readonly _title: string;
|
|
211
|
+
private readonly _description: string;
|
|
212
|
+
private readonly _functionApiName: string;
|
|
213
|
+
private readonly _trigger: WorkflowTrigger;
|
|
214
|
+
|
|
215
|
+
constructor(scope: ManifestScope, props: WorkflowProps) {
|
|
216
|
+
if (!props.function) throw new Error('function is required');
|
|
217
|
+
this._definitionId = props.definitionId ?? generateId('workflow');
|
|
218
|
+
this._title = props.title;
|
|
219
|
+
this._description = props.description;
|
|
220
|
+
this._functionApiName = typeof props.function === 'string' ? props.function : props.function.getApiName();
|
|
221
|
+
this._trigger = props.trigger;
|
|
222
|
+
scope._register(this);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
getDefinitionId(): string {
|
|
226
|
+
return this._definitionId;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
toDict(): Record<string, any> {
|
|
230
|
+
const component: Record<string, any> = {
|
|
231
|
+
type: Workflow.componentType,
|
|
232
|
+
definition_id: this._definitionId,
|
|
233
|
+
version_status: 'VERSION_STATUS_DRAFT',
|
|
234
|
+
trigger_status: 'TRIGGER_STATUS_INACTIVE',
|
|
235
|
+
trigger: this._trigger,
|
|
236
|
+
workflow_meta: {
|
|
237
|
+
name: this._title,
|
|
238
|
+
description: this._description,
|
|
239
|
+
},
|
|
240
|
+
function_api_name: this._functionApiName,
|
|
241
|
+
};
|
|
242
|
+
return component;
|
|
243
|
+
}
|
|
244
|
+
}
|