@rippling/rippling-sdk 0.2.0-alpha.34 → 0.2.0-alpha.36
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/examples/.keep +4 -0
- package/examples/manifest/dental-practice-management/dental-practice-management.ts +651 -0
- package/examples/manifest/dental-practice-management/manifest.json +1870 -0
- package/examples/manifest/gym-membership-management/gym-membership-management.ts +757 -0
- package/examples/manifest/gym-membership-management/manifest.json +1975 -0
- package/examples/sdui/sdui-crud-todo/rippling-function.ts +367 -0
- package/examples/sdui/sdui-crud-todo/sdui-crud-todo.ts +282 -0
- package/examples/sdui/sdui-showcase/rippling-function.ts +381 -0
- package/examples/sdui/sdui-showcase/sdui-showcase.ts +351 -0
- package/examples/sdui/sdui-tab-multi-view/rippling-function.ts +1061 -0
- package/examples/sdui/sdui-tab-multi-view/sdui-tab-multi-view.ts +924 -0
- package/examples/sdui/vote/rippling-function.ts +330 -0
- package/examples/sdui/vote/vote.ts +298 -0
- package/lib/manifest/app.d.mts +81 -13
- package/lib/manifest/app.d.mts.map +1 -1
- package/lib/manifest/app.d.ts +81 -13
- package/lib/manifest/app.d.ts.map +1 -1
- package/lib/manifest/app.js +37 -16
- package/lib/manifest/app.js.map +1 -1
- package/lib/manifest/app.mjs +37 -16
- package/lib/manifest/app.mjs.map +1 -1
- package/lib/manifest/category.d.mts +63 -7
- package/lib/manifest/category.d.mts.map +1 -1
- package/lib/manifest/category.d.ts +63 -7
- package/lib/manifest/category.d.ts.map +1 -1
- package/lib/manifest/category.js +45 -10
- package/lib/manifest/category.js.map +1 -1
- package/lib/manifest/category.mjs +43 -8
- package/lib/manifest/category.mjs.map +1 -1
- package/lib/manifest/custom-object-field-section.d.mts +56 -6
- package/lib/manifest/custom-object-field-section.d.mts.map +1 -1
- package/lib/manifest/custom-object-field-section.d.ts +56 -6
- package/lib/manifest/custom-object-field-section.d.ts.map +1 -1
- package/lib/manifest/custom-object-field-section.js +41 -14
- package/lib/manifest/custom-object-field-section.js.map +1 -1
- package/lib/manifest/custom-object-field-section.mjs +39 -12
- package/lib/manifest/custom-object-field-section.mjs.map +1 -1
- package/lib/manifest/custom-object-page-layout.d.mts +201 -41
- package/lib/manifest/custom-object-page-layout.d.mts.map +1 -1
- package/lib/manifest/custom-object-page-layout.d.ts +201 -41
- package/lib/manifest/custom-object-page-layout.d.ts.map +1 -1
- package/lib/manifest/custom-object-page-layout.js +76 -30
- package/lib/manifest/custom-object-page-layout.js.map +1 -1
- package/lib/manifest/custom-object-page-layout.mjs +74 -28
- package/lib/manifest/custom-object-page-layout.mjs.map +1 -1
- package/lib/manifest/custom-object.d.mts +128 -15
- package/lib/manifest/custom-object.d.mts.map +1 -1
- package/lib/manifest/custom-object.d.ts +128 -15
- package/lib/manifest/custom-object.d.ts.map +1 -1
- package/lib/manifest/custom-object.js +61 -26
- package/lib/manifest/custom-object.js.map +1 -1
- package/lib/manifest/custom-object.mjs +61 -26
- package/lib/manifest/custom-object.mjs.map +1 -1
- package/lib/manifest/field.d.mts +265 -54
- package/lib/manifest/field.d.mts.map +1 -1
- package/lib/manifest/field.d.ts +265 -54
- package/lib/manifest/field.d.ts.map +1 -1
- package/lib/manifest/field.js +100 -57
- package/lib/manifest/field.js.map +1 -1
- package/lib/manifest/field.mjs +100 -57
- package/lib/manifest/field.mjs.map +1 -1
- package/lib/manifest/list-view.d.mts +105 -14
- package/lib/manifest/list-view.d.mts.map +1 -1
- package/lib/manifest/list-view.d.ts +105 -14
- package/lib/manifest/list-view.d.ts.map +1 -1
- package/lib/manifest/list-view.js +50 -14
- package/lib/manifest/list-view.js.map +1 -1
- package/lib/manifest/list-view.mjs +48 -12
- package/lib/manifest/list-view.mjs.map +1 -1
- package/lib/manifest/manifest-builder.d.mts +77 -11
- package/lib/manifest/manifest-builder.d.mts.map +1 -1
- package/lib/manifest/manifest-builder.d.ts +77 -11
- package/lib/manifest/manifest-builder.d.ts.map +1 -1
- package/lib/manifest/manifest-builder.js +46 -24
- package/lib/manifest/manifest-builder.js.map +1 -1
- package/lib/manifest/manifest-builder.mjs +44 -22
- package/lib/manifest/manifest-builder.mjs.map +1 -1
- package/lib/manifest/manifest-function.d.mts +92 -12
- package/lib/manifest/manifest-function.d.mts.map +1 -1
- package/lib/manifest/manifest-function.d.ts +92 -12
- package/lib/manifest/manifest-function.d.ts.map +1 -1
- package/lib/manifest/manifest-function.js +40 -11
- package/lib/manifest/manifest-function.js.map +1 -1
- package/lib/manifest/manifest-function.mjs +38 -9
- package/lib/manifest/manifest-function.mjs.map +1 -1
- package/lib/manifest/rule.d.mts +94 -16
- package/lib/manifest/rule.d.mts.map +1 -1
- package/lib/manifest/rule.d.ts +94 -16
- package/lib/manifest/rule.d.ts.map +1 -1
- package/lib/manifest/rule.js +36 -15
- package/lib/manifest/rule.js.map +1 -1
- package/lib/manifest/rule.mjs +36 -15
- package/lib/manifest/rule.mjs.map +1 -1
- package/lib/manifest/sdui-page.d.mts +67 -11
- package/lib/manifest/sdui-page.d.mts.map +1 -1
- package/lib/manifest/sdui-page.d.ts +67 -11
- package/lib/manifest/sdui-page.d.ts.map +1 -1
- package/lib/manifest/sdui-page.js +44 -13
- package/lib/manifest/sdui-page.js.map +1 -1
- package/lib/manifest/sdui-page.mjs +42 -11
- package/lib/manifest/sdui-page.mjs.map +1 -1
- package/lib/manifest/validation.d.mts +87 -12
- package/lib/manifest/validation.d.mts.map +1 -1
- package/lib/manifest/validation.d.ts +87 -12
- package/lib/manifest/validation.d.ts.map +1 -1
- package/lib/manifest/validation.js +41 -15
- package/lib/manifest/validation.js.map +1 -1
- package/lib/manifest/validation.mjs +39 -13
- package/lib/manifest/validation.mjs.map +1 -1
- package/lib/sdui/actions.d.mts +25 -0
- package/lib/sdui/actions.d.mts.map +1 -0
- package/lib/sdui/actions.d.ts +25 -0
- package/lib/sdui/actions.d.ts.map +1 -0
- package/lib/sdui/actions.js +53 -0
- package/lib/sdui/actions.js.map +1 -0
- package/lib/sdui/actions.mjs +42 -0
- package/lib/sdui/actions.mjs.map +1 -0
- package/lib/sdui/component.d.mts +41 -0
- package/lib/sdui/component.d.mts.map +1 -0
- package/lib/sdui/component.d.ts +41 -0
- package/lib/sdui/component.d.ts.map +1 -0
- package/lib/sdui/component.js +95 -0
- package/lib/sdui/component.js.map +1 -0
- package/lib/sdui/component.mjs +91 -0
- package/lib/sdui/component.mjs.map +1 -0
- package/lib/sdui/components.d.mts +149 -0
- package/lib/sdui/components.d.mts.map +1 -0
- package/lib/sdui/components.d.ts +149 -0
- package/lib/sdui/components.d.ts.map +1 -0
- package/lib/sdui/components.js +303 -0
- package/lib/sdui/components.js.map +1 -0
- package/lib/sdui/components.mjs +298 -0
- package/lib/sdui/components.mjs.map +1 -0
- package/lib/sdui/conditions.d.mts +25 -0
- package/lib/sdui/conditions.d.mts.map +1 -0
- package/lib/sdui/conditions.d.ts +25 -0
- package/lib/sdui/conditions.d.ts.map +1 -0
- package/lib/sdui/conditions.js +47 -0
- package/lib/sdui/conditions.js.map +1 -0
- package/lib/sdui/conditions.mjs +35 -0
- package/lib/sdui/conditions.mjs.map +1 -0
- package/lib/sdui/directives.d.mts +18 -0
- package/lib/sdui/directives.d.mts.map +1 -0
- package/lib/sdui/directives.d.ts +18 -0
- package/lib/sdui/directives.d.ts.map +1 -0
- package/lib/sdui/directives.js +28 -0
- package/lib/sdui/directives.js.map +1 -0
- package/lib/sdui/directives.mjs +21 -0
- package/lib/sdui/directives.mjs.map +1 -0
- package/lib/sdui/index.d.mts +362 -0
- package/lib/sdui/index.d.mts.map +1 -0
- package/lib/sdui/index.d.ts +362 -0
- package/lib/sdui/index.d.ts.map +1 -0
- package/lib/sdui/index.js +375 -0
- package/lib/sdui/index.js.map +1 -0
- package/lib/sdui/index.mjs +199 -0
- package/lib/sdui/index.mjs.map +1 -0
- package/lib/sdui/props.d.mts +12 -0
- package/lib/sdui/props.d.mts.map +1 -0
- package/lib/sdui/props.d.ts +12 -0
- package/lib/sdui/props.d.ts.map +1 -0
- package/lib/sdui/props.js +25 -0
- package/lib/sdui/props.js.map +1 -0
- package/lib/sdui/props.mjs +21 -0
- package/lib/sdui/props.mjs.map +1 -0
- package/lib/sdui/render.d.mts +23 -0
- package/lib/sdui/render.d.mts.map +1 -0
- package/lib/sdui/render.d.ts +23 -0
- package/lib/sdui/render.d.ts.map +1 -0
- package/lib/sdui/render.js +40 -0
- package/lib/sdui/render.js.map +1 -0
- package/lib/sdui/render.mjs +37 -0
- package/lib/sdui/render.mjs.map +1 -0
- package/lib/sdui/state.d.mts +22 -0
- package/lib/sdui/state.d.mts.map +1 -0
- package/lib/sdui/state.d.ts +22 -0
- package/lib/sdui/state.d.ts.map +1 -0
- package/lib/sdui/state.js +57 -0
- package/lib/sdui/state.js.map +1 -0
- package/lib/sdui/state.mjs +53 -0
- package/lib/sdui/state.mjs.map +1 -0
- package/package.json +11 -1
- package/resources/company-legal-entity-workers.d.mts +79 -0
- package/resources/company-legal-entity-workers.d.mts.map +1 -0
- package/resources/company-legal-entity-workers.d.ts +79 -0
- package/resources/company-legal-entity-workers.d.ts.map +1 -0
- package/resources/company-legal-entity-workers.js +30 -0
- package/resources/company-legal-entity-workers.js.map +1 -0
- package/resources/company-legal-entity-workers.mjs +26 -0
- package/resources/company-legal-entity-workers.mjs.map +1 -0
- package/resources/draft-hires.d.mts +4 -0
- package/resources/draft-hires.d.mts.map +1 -1
- package/resources/draft-hires.d.ts +4 -0
- package/resources/draft-hires.d.ts.map +1 -1
- package/resources/files.d.mts +16 -1
- package/resources/files.d.mts.map +1 -1
- package/resources/files.d.ts +16 -1
- package/resources/files.d.ts.map +1 -1
- package/resources/headcount-positions.d.mts +2 -2
- package/resources/headcount-positions.d.mts.map +1 -1
- package/resources/headcount-positions.d.ts +2 -2
- package/resources/headcount-positions.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/legal-entities.d.mts +1 -1
- package/resources/legal-entities.d.mts.map +1 -1
- package/resources/legal-entities.d.ts +1 -1
- package/resources/legal-entities.d.ts.map +1 -1
- package/resources/location-factors.d.mts +2 -2
- package/resources/location-factors.d.mts.map +1 -1
- package/resources/location-factors.d.ts +2 -2
- package/resources/location-factors.d.ts.map +1 -1
- package/resources/shared.d.mts +1 -1
- package/resources/shared.d.mts.map +1 -1
- package/resources/shared.d.ts +1 -1
- package/resources/shared.d.ts.map +1 -1
- package/resources/workers.d.mts +2 -2
- package/resources/workers.d.mts.map +1 -1
- package/resources/workers.d.ts +2 -2
- package/resources/workers.d.ts.map +1 -1
- package/src/client.ts +20 -0
- package/src/lib/manifest/app.ts +81 -26
- package/src/lib/manifest/category.ts +63 -14
- package/src/lib/manifest/custom-object-field-section.ts +56 -17
- package/src/lib/manifest/custom-object-page-layout.ts +201 -66
- package/src/lib/manifest/custom-object.ts +128 -37
- package/src/lib/manifest/field.ts +265 -75
- package/src/lib/manifest/list-view.ts +105 -25
- package/src/lib/manifest/manifest-builder.ts +75 -32
- package/src/lib/manifest/manifest-function.ts +92 -22
- package/src/lib/manifest/rule.ts +95 -29
- package/src/lib/manifest/sdui-page.ts +67 -21
- package/src/lib/manifest/validation.ts +87 -24
- package/src/lib/sdui/actions.ts +58 -0
- package/src/lib/sdui/component.ts +122 -0
- package/src/lib/sdui/components.ts +308 -0
- package/src/lib/sdui/conditions.ts +59 -0
- package/src/lib/sdui/directives.ts +42 -0
- package/src/lib/sdui/index.ts +365 -0
- package/src/lib/sdui/props.ts +32 -0
- package/src/lib/sdui/render.ts +58 -0
- package/src/lib/sdui/state.ts +60 -0
- package/src/resources/company-legal-entity-workers.ts +115 -0
- package/src/resources/draft-hires.ts +5 -0
- package/src/resources/files.ts +18 -1
- package/src/resources/headcount-positions.ts +2 -0
- package/src/resources/index.ts +7 -0
- package/src/resources/legal-entities.ts +1 -0
- package/src/resources/location-factors.ts +2 -0
- package/src/resources/shared.ts +1 -0
- package/src/resources/workers.ts +2 -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/lib/manifest/rule.d.mts
CHANGED
|
@@ -1,34 +1,99 @@
|
|
|
1
1
|
import { type TriggerType, type UpdateTriggerType } from "./_helpers.mjs";
|
|
2
2
|
import type { CustomObject } from "./custom-object.mjs";
|
|
3
3
|
import type { Field } from "./field.mjs";
|
|
4
|
+
/**
|
|
5
|
+
* A single action performed when a {@link Rule} fires.
|
|
6
|
+
*/
|
|
4
7
|
export interface RuleAction {
|
|
5
|
-
/**
|
|
8
|
+
/**
|
|
9
|
+
* The field to set when this action runs.
|
|
10
|
+
*
|
|
11
|
+
* Required.
|
|
12
|
+
*/
|
|
6
13
|
targetField: Field;
|
|
7
14
|
/**
|
|
8
|
-
* Set the target to a fixed value. Mutually exclusive with `rqlFormula`.
|
|
9
|
-
*
|
|
10
|
-
*
|
|
15
|
+
* Set the target field to a fixed value. Mutually exclusive with `rqlFormula`.
|
|
16
|
+
*
|
|
17
|
+
* Optional. For `SELECT` / `RADIO` fields, pass a string or single-element array —
|
|
18
|
+
* both are normalized to an array on the wire.
|
|
11
19
|
*/
|
|
12
20
|
fixedValue?: any;
|
|
13
|
-
/**
|
|
21
|
+
/**
|
|
22
|
+
* Set the target field to the result of an RQL formula. Mutually exclusive with `fixedValue`.
|
|
23
|
+
*
|
|
24
|
+
* Optional.
|
|
25
|
+
*/
|
|
14
26
|
rqlFormula?: string;
|
|
15
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* Initialization properties for {@link Rule}.
|
|
30
|
+
*/
|
|
16
31
|
export interface RuleProps {
|
|
17
|
-
/**
|
|
32
|
+
/**
|
|
33
|
+
* Display name of this automation rule shown in the UI.
|
|
34
|
+
*
|
|
35
|
+
* Required.
|
|
36
|
+
*/
|
|
18
37
|
flowName: string;
|
|
19
|
-
/**
|
|
38
|
+
/**
|
|
39
|
+
* When this rule fires. One of `'CREATE'` | `'UPDATE'` | `'CREATE_OR_UPDATE'`.
|
|
40
|
+
*
|
|
41
|
+
* Required. The constructor throws if an invalid value is passed.
|
|
42
|
+
*/
|
|
20
43
|
triggerType: TriggerType;
|
|
21
|
-
/**
|
|
44
|
+
/**
|
|
45
|
+
* Stable identifier for this rule. Pass a human-readable slug
|
|
46
|
+
* (e.g. `'gym_default_enrollment_status'`) to keep it stable across regenerations.
|
|
47
|
+
*
|
|
48
|
+
* Optional. Auto-generated when omitted. @default generateId('flow')
|
|
49
|
+
*/
|
|
22
50
|
flowId?: string;
|
|
23
|
-
/**
|
|
51
|
+
/**
|
|
52
|
+
* RQL formula guard — the rule fires only when this expression is truthy.
|
|
53
|
+
*
|
|
54
|
+
* Optional. @default null
|
|
55
|
+
*/
|
|
24
56
|
rqlCondition?: string;
|
|
25
|
-
/**
|
|
57
|
+
/**
|
|
58
|
+
* Controls when an `UPDATE` trigger fires relative to the condition.
|
|
59
|
+
* One of `'MEETS_CONDITION_AFTER_ONLY'` | `'MEETS_CONDITION_BEFORE_OR_AFTER'`.
|
|
60
|
+
*
|
|
61
|
+
* Conditional. Only meaningful when `triggerType` is `'UPDATE'` or `'CREATE_OR_UPDATE'`.
|
|
62
|
+
* @default `'MEETS_CONDITION_AFTER_ONLY'`
|
|
63
|
+
*/
|
|
26
64
|
updateTriggerType?: UpdateTriggerType;
|
|
27
|
-
/**
|
|
65
|
+
/**
|
|
66
|
+
* Internal description of this rule (for developer reference only).
|
|
67
|
+
*
|
|
68
|
+
* Optional. @default null
|
|
69
|
+
*/
|
|
28
70
|
description?: string;
|
|
29
|
-
/**
|
|
71
|
+
/**
|
|
72
|
+
* Actions to run when the rule fires. Each action sets one field to a fixed value
|
|
73
|
+
* or RQL formula result.
|
|
74
|
+
*
|
|
75
|
+
* Optional. @default `[]`
|
|
76
|
+
*/
|
|
30
77
|
actions?: RuleAction[];
|
|
31
78
|
}
|
|
79
|
+
/**
|
|
80
|
+
* Defines a record-triggered automation rule and registers it with the manifest.
|
|
81
|
+
*
|
|
82
|
+
* A rule fires automatically when a record on the parent custom object is created,
|
|
83
|
+
* updated, or both — depending on `triggerType`. Each rule runs a list of actions
|
|
84
|
+
* that set field values, optionally guarded by an RQL condition.
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* ```ts
|
|
88
|
+
* new Rule(enrollmentObj, {
|
|
89
|
+
* flowId: 'gym_default_enrollment_status',
|
|
90
|
+
* flowName: 'Default attendance to Registered',
|
|
91
|
+
* triggerType: 'CREATE',
|
|
92
|
+
* description: 'New roster rows start as Registered unless changed',
|
|
93
|
+
* actions: [{ targetField: enrollmentAttendanceField, fixedValue: ['Registered'] }],
|
|
94
|
+
* });
|
|
95
|
+
* ```
|
|
96
|
+
*/
|
|
32
97
|
export declare class Rule {
|
|
33
98
|
private readonly _flowId;
|
|
34
99
|
private readonly _customObjectApiName;
|
|
@@ -38,13 +103,26 @@ export declare class Rule {
|
|
|
38
103
|
private readonly _updateTriggerType;
|
|
39
104
|
private readonly _description;
|
|
40
105
|
private readonly _actions;
|
|
41
|
-
/**
|
|
106
|
+
/**
|
|
107
|
+
* @param customObject - The custom object this rule is attached to.
|
|
108
|
+
* @param props - Initialization properties.
|
|
109
|
+
* @throws {Error} If `props.triggerType` is not one of `'CREATE'`, `'UPDATE'`, `'CREATE_OR_UPDATE'`.
|
|
110
|
+
*/
|
|
42
111
|
constructor(customObject: CustomObject, props: RuleProps);
|
|
43
|
-
/**
|
|
112
|
+
/**
|
|
113
|
+
* Returns the stable identifier for this rule (e.g. `'gym_default_enrollment_status'`).
|
|
114
|
+
*/
|
|
44
115
|
getFlowId(): string;
|
|
45
|
-
/**
|
|
116
|
+
/**
|
|
117
|
+
* Returns the api_name of the custom object this rule is attached to.
|
|
118
|
+
*/
|
|
46
119
|
getCustomObjectApiName(): string;
|
|
47
|
-
/**
|
|
120
|
+
/**
|
|
121
|
+
* Serializes this rule to the wire format consumed by the manifest install endpoint.
|
|
122
|
+
*
|
|
123
|
+
* @returns A plain object with `type: 'CUSTOM_OBJECT_RECORD_TRIGGERED_FLOW'`.
|
|
124
|
+
* Optional fields are omitted when unset; `actions` is omitted when empty.
|
|
125
|
+
*/
|
|
48
126
|
toDict(): Record<string, any>;
|
|
49
127
|
}
|
|
50
128
|
//# sourceMappingURL=rule.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rule.d.mts","sourceRoot":"","sources":["../../src/lib/manifest/rule.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"rule.d.mts","sourceRoot":"","sources":["../../src/lib/manifest/rule.ts"],"names":[],"mappings":"OAAO,EAAc,KAAK,WAAW,EAAE,KAAK,iBAAiB,EAAE;OACxD,KAAK,EAAE,YAAY,EAAE;OACrB,KAAK,EAAE,KAAK,EAAE;AAErB;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB;;;;OAIG;IACH,WAAW,EAAE,KAAK,CAAC;IACnB;;;;;OAKG;IACH,UAAU,CAAC,EAAE,GAAG,CAAC;IACjB;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB;;;;OAIG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,WAAW,EAAE,WAAW,CAAC;IACzB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;;;OAMG;IACH,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;IACtC;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,UAAU,EAAE,CAAC;CACxB;AA0BD;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,IAAI;IACf,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAS;IAC9C,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IACnC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAc;IAC3C,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAqB;IACnD,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAgC;IACnE,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAqB;IAClD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAe;IAExC;;;;OAIG;gBACS,YAAY,EAAE,YAAY,EAAE,KAAK,EAAE,SAAS;IAkBxD;;OAEG;IACH,SAAS,IAAI,MAAM;IAInB;;OAEG;IACH,sBAAsB,IAAI,MAAM;IAIhC;;;;;OAKG;IACH,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;CAc9B"}
|
package/lib/manifest/rule.d.ts
CHANGED
|
@@ -1,34 +1,99 @@
|
|
|
1
1
|
import { type TriggerType, type UpdateTriggerType } from "./_helpers.js";
|
|
2
2
|
import type { CustomObject } from "./custom-object.js";
|
|
3
3
|
import type { Field } from "./field.js";
|
|
4
|
+
/**
|
|
5
|
+
* A single action performed when a {@link Rule} fires.
|
|
6
|
+
*/
|
|
4
7
|
export interface RuleAction {
|
|
5
|
-
/**
|
|
8
|
+
/**
|
|
9
|
+
* The field to set when this action runs.
|
|
10
|
+
*
|
|
11
|
+
* Required.
|
|
12
|
+
*/
|
|
6
13
|
targetField: Field;
|
|
7
14
|
/**
|
|
8
|
-
* Set the target to a fixed value. Mutually exclusive with `rqlFormula`.
|
|
9
|
-
*
|
|
10
|
-
*
|
|
15
|
+
* Set the target field to a fixed value. Mutually exclusive with `rqlFormula`.
|
|
16
|
+
*
|
|
17
|
+
* Optional. For `SELECT` / `RADIO` fields, pass a string or single-element array —
|
|
18
|
+
* both are normalized to an array on the wire.
|
|
11
19
|
*/
|
|
12
20
|
fixedValue?: any;
|
|
13
|
-
/**
|
|
21
|
+
/**
|
|
22
|
+
* Set the target field to the result of an RQL formula. Mutually exclusive with `fixedValue`.
|
|
23
|
+
*
|
|
24
|
+
* Optional.
|
|
25
|
+
*/
|
|
14
26
|
rqlFormula?: string;
|
|
15
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* Initialization properties for {@link Rule}.
|
|
30
|
+
*/
|
|
16
31
|
export interface RuleProps {
|
|
17
|
-
/**
|
|
32
|
+
/**
|
|
33
|
+
* Display name of this automation rule shown in the UI.
|
|
34
|
+
*
|
|
35
|
+
* Required.
|
|
36
|
+
*/
|
|
18
37
|
flowName: string;
|
|
19
|
-
/**
|
|
38
|
+
/**
|
|
39
|
+
* When this rule fires. One of `'CREATE'` | `'UPDATE'` | `'CREATE_OR_UPDATE'`.
|
|
40
|
+
*
|
|
41
|
+
* Required. The constructor throws if an invalid value is passed.
|
|
42
|
+
*/
|
|
20
43
|
triggerType: TriggerType;
|
|
21
|
-
/**
|
|
44
|
+
/**
|
|
45
|
+
* Stable identifier for this rule. Pass a human-readable slug
|
|
46
|
+
* (e.g. `'gym_default_enrollment_status'`) to keep it stable across regenerations.
|
|
47
|
+
*
|
|
48
|
+
* Optional. Auto-generated when omitted. @default generateId('flow')
|
|
49
|
+
*/
|
|
22
50
|
flowId?: string;
|
|
23
|
-
/**
|
|
51
|
+
/**
|
|
52
|
+
* RQL formula guard — the rule fires only when this expression is truthy.
|
|
53
|
+
*
|
|
54
|
+
* Optional. @default null
|
|
55
|
+
*/
|
|
24
56
|
rqlCondition?: string;
|
|
25
|
-
/**
|
|
57
|
+
/**
|
|
58
|
+
* Controls when an `UPDATE` trigger fires relative to the condition.
|
|
59
|
+
* One of `'MEETS_CONDITION_AFTER_ONLY'` | `'MEETS_CONDITION_BEFORE_OR_AFTER'`.
|
|
60
|
+
*
|
|
61
|
+
* Conditional. Only meaningful when `triggerType` is `'UPDATE'` or `'CREATE_OR_UPDATE'`.
|
|
62
|
+
* @default `'MEETS_CONDITION_AFTER_ONLY'`
|
|
63
|
+
*/
|
|
26
64
|
updateTriggerType?: UpdateTriggerType;
|
|
27
|
-
/**
|
|
65
|
+
/**
|
|
66
|
+
* Internal description of this rule (for developer reference only).
|
|
67
|
+
*
|
|
68
|
+
* Optional. @default null
|
|
69
|
+
*/
|
|
28
70
|
description?: string;
|
|
29
|
-
/**
|
|
71
|
+
/**
|
|
72
|
+
* Actions to run when the rule fires. Each action sets one field to a fixed value
|
|
73
|
+
* or RQL formula result.
|
|
74
|
+
*
|
|
75
|
+
* Optional. @default `[]`
|
|
76
|
+
*/
|
|
30
77
|
actions?: RuleAction[];
|
|
31
78
|
}
|
|
79
|
+
/**
|
|
80
|
+
* Defines a record-triggered automation rule and registers it with the manifest.
|
|
81
|
+
*
|
|
82
|
+
* A rule fires automatically when a record on the parent custom object is created,
|
|
83
|
+
* updated, or both — depending on `triggerType`. Each rule runs a list of actions
|
|
84
|
+
* that set field values, optionally guarded by an RQL condition.
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* ```ts
|
|
88
|
+
* new Rule(enrollmentObj, {
|
|
89
|
+
* flowId: 'gym_default_enrollment_status',
|
|
90
|
+
* flowName: 'Default attendance to Registered',
|
|
91
|
+
* triggerType: 'CREATE',
|
|
92
|
+
* description: 'New roster rows start as Registered unless changed',
|
|
93
|
+
* actions: [{ targetField: enrollmentAttendanceField, fixedValue: ['Registered'] }],
|
|
94
|
+
* });
|
|
95
|
+
* ```
|
|
96
|
+
*/
|
|
32
97
|
export declare class Rule {
|
|
33
98
|
private readonly _flowId;
|
|
34
99
|
private readonly _customObjectApiName;
|
|
@@ -38,13 +103,26 @@ export declare class Rule {
|
|
|
38
103
|
private readonly _updateTriggerType;
|
|
39
104
|
private readonly _description;
|
|
40
105
|
private readonly _actions;
|
|
41
|
-
/**
|
|
106
|
+
/**
|
|
107
|
+
* @param customObject - The custom object this rule is attached to.
|
|
108
|
+
* @param props - Initialization properties.
|
|
109
|
+
* @throws {Error} If `props.triggerType` is not one of `'CREATE'`, `'UPDATE'`, `'CREATE_OR_UPDATE'`.
|
|
110
|
+
*/
|
|
42
111
|
constructor(customObject: CustomObject, props: RuleProps);
|
|
43
|
-
/**
|
|
112
|
+
/**
|
|
113
|
+
* Returns the stable identifier for this rule (e.g. `'gym_default_enrollment_status'`).
|
|
114
|
+
*/
|
|
44
115
|
getFlowId(): string;
|
|
45
|
-
/**
|
|
116
|
+
/**
|
|
117
|
+
* Returns the api_name of the custom object this rule is attached to.
|
|
118
|
+
*/
|
|
46
119
|
getCustomObjectApiName(): string;
|
|
47
|
-
/**
|
|
120
|
+
/**
|
|
121
|
+
* Serializes this rule to the wire format consumed by the manifest install endpoint.
|
|
122
|
+
*
|
|
123
|
+
* @returns A plain object with `type: 'CUSTOM_OBJECT_RECORD_TRIGGERED_FLOW'`.
|
|
124
|
+
* Optional fields are omitted when unset; `actions` is omitted when empty.
|
|
125
|
+
*/
|
|
48
126
|
toDict(): Record<string, any>;
|
|
49
127
|
}
|
|
50
128
|
//# sourceMappingURL=rule.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rule.d.ts","sourceRoot":"","sources":["../../src/lib/manifest/rule.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"rule.d.ts","sourceRoot":"","sources":["../../src/lib/manifest/rule.ts"],"names":[],"mappings":"OAAO,EAAc,KAAK,WAAW,EAAE,KAAK,iBAAiB,EAAE;OACxD,KAAK,EAAE,YAAY,EAAE;OACrB,KAAK,EAAE,KAAK,EAAE;AAErB;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB;;;;OAIG;IACH,WAAW,EAAE,KAAK,CAAC;IACnB;;;;;OAKG;IACH,UAAU,CAAC,EAAE,GAAG,CAAC;IACjB;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB;;;;OAIG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,WAAW,EAAE,WAAW,CAAC;IACzB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;;;OAMG;IACH,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;IACtC;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,UAAU,EAAE,CAAC;CACxB;AA0BD;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,IAAI;IACf,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAS;IAC9C,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IACnC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAc;IAC3C,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAqB;IACnD,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAgC;IACnE,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAqB;IAClD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAe;IAExC;;;;OAIG;gBACS,YAAY,EAAE,YAAY,EAAE,KAAK,EAAE,SAAS;IAkBxD;;OAEG;IACH,SAAS,IAAI,MAAM;IAInB;;OAEG;IACH,sBAAsB,IAAI,MAAM;IAIhC;;;;;OAKG;IACH,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;CAc9B"}
|
package/lib/manifest/rule.js
CHANGED
|
@@ -1,18 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* The contents of this file were inserted manually and are not generated by Stainless.
|
|
4
|
-
*
|
|
5
|
-
* Record-triggered flows (automation rules) for custom objects.
|
|
6
|
-
* Backend schema: CUSTOM_OBJECT_RECORD_TRIGGERED_FLOW (v2)
|
|
7
|
-
*
|
|
8
|
-
* Construction is CDK-style: `new Rule(customObject, props)` — the CO is
|
|
9
|
-
* the first positional arg, and the rule auto-registers with the manifest
|
|
10
|
-
* via the CO's scope chain.
|
|
11
|
-
*/
|
|
12
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
3
|
exports.Rule = void 0;
|
|
14
4
|
const _helpers_1 = require("./_helpers.js");
|
|
15
|
-
const VALID_TRIGGERS = ['CREATE', 'UPDATE', 'CREATE_OR_UPDATE'];
|
|
16
5
|
/** SELECT / RADIO rule actions use list `fixed_value` (Rippling rule builder). */
|
|
17
6
|
function fixedValueToWire(targetField, value) {
|
|
18
7
|
const ft = targetField.getFieldType();
|
|
@@ -36,9 +25,32 @@ function actionToDict(action) {
|
|
|
36
25
|
}
|
|
37
26
|
return out;
|
|
38
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* Defines a record-triggered automation rule and registers it with the manifest.
|
|
30
|
+
*
|
|
31
|
+
* A rule fires automatically when a record on the parent custom object is created,
|
|
32
|
+
* updated, or both — depending on `triggerType`. Each rule runs a list of actions
|
|
33
|
+
* that set field values, optionally guarded by an RQL condition.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```ts
|
|
37
|
+
* new Rule(enrollmentObj, {
|
|
38
|
+
* flowId: 'gym_default_enrollment_status',
|
|
39
|
+
* flowName: 'Default attendance to Registered',
|
|
40
|
+
* triggerType: 'CREATE',
|
|
41
|
+
* description: 'New roster rows start as Registered unless changed',
|
|
42
|
+
* actions: [{ targetField: enrollmentAttendanceField, fixedValue: ['Registered'] }],
|
|
43
|
+
* });
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
39
46
|
class Rule {
|
|
40
|
-
/**
|
|
47
|
+
/**
|
|
48
|
+
* @param customObject - The custom object this rule is attached to.
|
|
49
|
+
* @param props - Initialization properties.
|
|
50
|
+
* @throws {Error} If `props.triggerType` is not one of `'CREATE'`, `'UPDATE'`, `'CREATE_OR_UPDATE'`.
|
|
51
|
+
*/
|
|
41
52
|
constructor(customObject, props) {
|
|
53
|
+
const VALID_TRIGGERS = ['CREATE', 'UPDATE', 'CREATE_OR_UPDATE'];
|
|
42
54
|
if (!VALID_TRIGGERS.includes(props.triggerType)) {
|
|
43
55
|
throw new Error(`Invalid trigger_type: ${props.triggerType}. Must be one of: ${VALID_TRIGGERS.join(', ')}`);
|
|
44
56
|
}
|
|
@@ -52,15 +64,24 @@ class Rule {
|
|
|
52
64
|
this._actions = [...(props.actions ?? [])];
|
|
53
65
|
customObject._register(this);
|
|
54
66
|
}
|
|
55
|
-
/**
|
|
67
|
+
/**
|
|
68
|
+
* Returns the stable identifier for this rule (e.g. `'gym_default_enrollment_status'`).
|
|
69
|
+
*/
|
|
56
70
|
getFlowId() {
|
|
57
71
|
return this._flowId;
|
|
58
72
|
}
|
|
59
|
-
/**
|
|
73
|
+
/**
|
|
74
|
+
* Returns the api_name of the custom object this rule is attached to.
|
|
75
|
+
*/
|
|
60
76
|
getCustomObjectApiName() {
|
|
61
77
|
return this._customObjectApiName;
|
|
62
78
|
}
|
|
63
|
-
/**
|
|
79
|
+
/**
|
|
80
|
+
* Serializes this rule to the wire format consumed by the manifest install endpoint.
|
|
81
|
+
*
|
|
82
|
+
* @returns A plain object with `type: 'CUSTOM_OBJECT_RECORD_TRIGGERED_FLOW'`.
|
|
83
|
+
* Optional fields are omitted when unset; `actions` is omitted when empty.
|
|
84
|
+
*/
|
|
64
85
|
toDict() {
|
|
65
86
|
const component = {
|
|
66
87
|
type: 'CUSTOM_OBJECT_RECORD_TRIGGERED_FLOW',
|
package/lib/manifest/rule.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rule.js","sourceRoot":"","sources":["../../src/lib/manifest/rule.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"rule.js","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,IAAI,CAAC,aAAa,IAAI,IAAI;YAAE,SAAS,CAAC,eAAe,CAAC,GAAG,IAAI,CAAC,aAAa,CAAC;QAChF,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC;YAAE,SAAS,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;QACrF,OAAO,SAAS,CAAC;IACnB,CAAC;CACF;AAnED,oBAmEC"}
|
package/lib/manifest/rule.mjs
CHANGED
|
@@ -1,15 +1,4 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* The contents of this file were inserted manually and are not generated by Stainless.
|
|
3
|
-
*
|
|
4
|
-
* Record-triggered flows (automation rules) for custom objects.
|
|
5
|
-
* Backend schema: CUSTOM_OBJECT_RECORD_TRIGGERED_FLOW (v2)
|
|
6
|
-
*
|
|
7
|
-
* Construction is CDK-style: `new Rule(customObject, props)` — the CO is
|
|
8
|
-
* the first positional arg, and the rule auto-registers with the manifest
|
|
9
|
-
* via the CO's scope chain.
|
|
10
|
-
*/
|
|
11
1
|
import { generateId } from "./_helpers.mjs";
|
|
12
|
-
const VALID_TRIGGERS = ['CREATE', 'UPDATE', 'CREATE_OR_UPDATE'];
|
|
13
2
|
/** SELECT / RADIO rule actions use list `fixed_value` (Rippling rule builder). */
|
|
14
3
|
function fixedValueToWire(targetField, value) {
|
|
15
4
|
const ft = targetField.getFieldType();
|
|
@@ -33,9 +22,32 @@ function actionToDict(action) {
|
|
|
33
22
|
}
|
|
34
23
|
return out;
|
|
35
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* Defines a record-triggered automation rule and registers it with the manifest.
|
|
27
|
+
*
|
|
28
|
+
* A rule fires automatically when a record on the parent custom object is created,
|
|
29
|
+
* updated, or both — depending on `triggerType`. Each rule runs a list of actions
|
|
30
|
+
* that set field values, optionally guarded by an RQL condition.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```ts
|
|
34
|
+
* new Rule(enrollmentObj, {
|
|
35
|
+
* flowId: 'gym_default_enrollment_status',
|
|
36
|
+
* flowName: 'Default attendance to Registered',
|
|
37
|
+
* triggerType: 'CREATE',
|
|
38
|
+
* description: 'New roster rows start as Registered unless changed',
|
|
39
|
+
* actions: [{ targetField: enrollmentAttendanceField, fixedValue: ['Registered'] }],
|
|
40
|
+
* });
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
36
43
|
export class Rule {
|
|
37
|
-
/**
|
|
44
|
+
/**
|
|
45
|
+
* @param customObject - The custom object this rule is attached to.
|
|
46
|
+
* @param props - Initialization properties.
|
|
47
|
+
* @throws {Error} If `props.triggerType` is not one of `'CREATE'`, `'UPDATE'`, `'CREATE_OR_UPDATE'`.
|
|
48
|
+
*/
|
|
38
49
|
constructor(customObject, props) {
|
|
50
|
+
const VALID_TRIGGERS = ['CREATE', 'UPDATE', 'CREATE_OR_UPDATE'];
|
|
39
51
|
if (!VALID_TRIGGERS.includes(props.triggerType)) {
|
|
40
52
|
throw new Error(`Invalid trigger_type: ${props.triggerType}. Must be one of: ${VALID_TRIGGERS.join(', ')}`);
|
|
41
53
|
}
|
|
@@ -49,15 +61,24 @@ export class Rule {
|
|
|
49
61
|
this._actions = [...(props.actions ?? [])];
|
|
50
62
|
customObject._register(this);
|
|
51
63
|
}
|
|
52
|
-
/**
|
|
64
|
+
/**
|
|
65
|
+
* Returns the stable identifier for this rule (e.g. `'gym_default_enrollment_status'`).
|
|
66
|
+
*/
|
|
53
67
|
getFlowId() {
|
|
54
68
|
return this._flowId;
|
|
55
69
|
}
|
|
56
|
-
/**
|
|
70
|
+
/**
|
|
71
|
+
* Returns the api_name of the custom object this rule is attached to.
|
|
72
|
+
*/
|
|
57
73
|
getCustomObjectApiName() {
|
|
58
74
|
return this._customObjectApiName;
|
|
59
75
|
}
|
|
60
|
-
/**
|
|
76
|
+
/**
|
|
77
|
+
* Serializes this rule to the wire format consumed by the manifest install endpoint.
|
|
78
|
+
*
|
|
79
|
+
* @returns A plain object with `type: 'CUSTOM_OBJECT_RECORD_TRIGGERED_FLOW'`.
|
|
80
|
+
* Optional fields are omitted when unset; `actions` is omitted when empty.
|
|
81
|
+
*/
|
|
61
82
|
toDict() {
|
|
62
83
|
const component = {
|
|
63
84
|
type: 'CUSTOM_OBJECT_RECORD_TRIGGERED_FLOW',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rule.mjs","sourceRoot":"","sources":["../../src/lib/manifest/rule.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"rule.mjs","sourceRoot":"","sources":["../../src/lib/manifest/rule.ts"],"names":[],"mappings":"OAAO,EAAE,UAAU,EAA4C;AAiF/D,kFAAkF;AAClF,SAAS,gBAAgB,CAAC,WAAkB,EAAE,KAAU;IACtD,MAAM,EAAE,GAAG,WAAW,CAAC,YAAY,EAAE,CAAC;IACtC,IAAI,EAAE,KAAK,QAAQ,IAAI,EAAE,KAAK,OAAO,EAAE,CAAC;QACtC,OAAO,KAAK,CAAC;IACf,CAAC;IACD,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,CAAC,KAAK,CAAC,CAAC;AACjB,CAAC;AAED,SAAS,YAAY,CAAC,MAAkB;IACtC,MAAM,GAAG,GAAwB;QAC/B,YAAY,EAAE,MAAM,CAAC,WAAW,CAAC,UAAU,EAAE;KAC9C,CAAC;IACF,IAAI,MAAM,CAAC,UAAU,IAAI,IAAI,EAAE,CAAC;QAC9B,GAAG,CAAC,aAAa,CAAC,GAAG,gBAAgB,CAAC,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,UAAU,CAAC,CAAC;IAC/E,CAAC;SAAM,IAAI,MAAM,CAAC,UAAU,IAAI,IAAI,EAAE,CAAC;QACrC,GAAG,CAAC,aAAa,CAAC,GAAG,MAAM,CAAC,UAAU,CAAC;IACzC,CAAC;IACD,OAAO,GAAG,CAAC;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,CAAC,oBAAoB;YACzC,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,YAAY,EAAE,IAAI,CAAC,YAAY;SAChC,CAAC;QACF,IAAI,IAAI,CAAC,YAAY,IAAI,IAAI;YAAE,SAAS,CAAC,aAAa,CAAC,GAAG,IAAI,CAAC,YAAY,CAAC;QAC5E,IAAI,IAAI,CAAC,kBAAkB,IAAI,IAAI;YAAE,SAAS,CAAC,qBAAqB,CAAC,GAAG,IAAI,CAAC,kBAAkB,CAAC;QAChG,IAAI,IAAI,CAAC,aAAa,IAAI,IAAI;YAAE,SAAS,CAAC,eAAe,CAAC,GAAG,IAAI,CAAC,aAAa,CAAC;QAChF,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC;YAAE,SAAS,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;QACrF,OAAO,SAAS,CAAC;IACnB,CAAC;CACF"}
|
|
@@ -1,33 +1,89 @@
|
|
|
1
1
|
import type { ManifestFunction } from "./manifest-function.mjs";
|
|
2
2
|
import type { ManifestScope } from "./manifest-builder.mjs";
|
|
3
|
+
/**
|
|
4
|
+
* Initialization properties for {@link SduiPage}.
|
|
5
|
+
*/
|
|
3
6
|
export interface SduiPageProps {
|
|
4
|
-
/**
|
|
7
|
+
/**
|
|
8
|
+
* Unique identifier for this page within the package (e.g. `'gym_today_schedule'`).
|
|
9
|
+
*
|
|
10
|
+
* Required.
|
|
11
|
+
*/
|
|
5
12
|
sduiPageId: string;
|
|
6
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* Display name shown as the tab label in the app (e.g. `'Today\'s schedule'`).
|
|
15
|
+
*
|
|
16
|
+
* Required.
|
|
17
|
+
*/
|
|
7
18
|
name: string;
|
|
8
19
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
20
|
+
* The function that renders this page. Pass a live {@link ManifestFunction} reference,
|
|
21
|
+
* or a raw api_name string for functions defined outside this manifest.
|
|
22
|
+
*
|
|
23
|
+
* Required.
|
|
12
24
|
*/
|
|
13
25
|
function: ManifestFunction | string;
|
|
14
|
-
/**
|
|
26
|
+
/**
|
|
27
|
+
* Human-readable description of what this page shows.
|
|
28
|
+
*
|
|
29
|
+
* Optional. @default `''`
|
|
30
|
+
*/
|
|
15
31
|
description?: string;
|
|
16
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* Defines an SDUI page and registers it with the manifest.
|
|
35
|
+
*
|
|
36
|
+
* An SDUI page is a custom UI surface backed by a {@link ManifestFunction}. It appears
|
|
37
|
+
* as a tab in a Rippling {@link App}. You would normally define SDUI pages after the
|
|
38
|
+
* functions they reference, then pass them to an `App` via `pages`.
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```ts
|
|
42
|
+
* const todaySchedulePage = new SduiPage(manifest, {
|
|
43
|
+
* sduiPageId: 'gym_today_schedule',
|
|
44
|
+
* name: 'Today\'s schedule',
|
|
45
|
+
* function: todayScheduleFn,
|
|
46
|
+
* description: 'SDUI list of class sessions for front desk',
|
|
47
|
+
* });
|
|
48
|
+
*
|
|
49
|
+
* new App(manifest, {
|
|
50
|
+
* apiName: 'gym_membership_management_app',
|
|
51
|
+
* name: 'Gym Membership Management',
|
|
52
|
+
* pages: [memberObj, trainerObj, todaySchedulePage],
|
|
53
|
+
* });
|
|
54
|
+
* ```
|
|
55
|
+
*
|
|
56
|
+
* @see {@link ManifestFunction} — provides the handler that renders this page.
|
|
57
|
+
* @see {@link App} — hosts this page as a tab via `pages`.
|
|
58
|
+
*/
|
|
17
59
|
export declare class SduiPage {
|
|
18
60
|
private readonly _sduiPageId;
|
|
19
61
|
private readonly _name;
|
|
20
62
|
private readonly _functionApiName;
|
|
21
63
|
private readonly _description;
|
|
22
|
-
/**
|
|
64
|
+
/**
|
|
65
|
+
* @param scope - The manifest to register this page with.
|
|
66
|
+
* @param props - Initialization properties.
|
|
67
|
+
* @throws {Error} If `sduiPageId`, `name`, or `function` is missing.
|
|
68
|
+
*/
|
|
23
69
|
constructor(scope: ManifestScope, props: SduiPageProps);
|
|
24
|
-
/**
|
|
70
|
+
/**
|
|
71
|
+
* Returns the unique page identifier (e.g. `'gym_today_schedule'`).
|
|
72
|
+
*/
|
|
25
73
|
getSduiPageId(): string;
|
|
26
|
-
/**
|
|
74
|
+
/**
|
|
75
|
+
* Returns the display name (tab label) of this page.
|
|
76
|
+
*/
|
|
27
77
|
getName(): string;
|
|
28
|
-
/**
|
|
78
|
+
/**
|
|
79
|
+
* Returns the api_name of the function backing this page.
|
|
80
|
+
*/
|
|
29
81
|
getFunctionApiName(): string;
|
|
30
|
-
/**
|
|
82
|
+
/**
|
|
83
|
+
* Serializes this SDUI page to the wire format consumed by the manifest install endpoint.
|
|
84
|
+
*
|
|
85
|
+
* @returns A plain object with `type: 'SDUI_PAGE'`.
|
|
86
|
+
*/
|
|
31
87
|
toDict(): Record<string, any>;
|
|
32
88
|
}
|
|
33
89
|
//# sourceMappingURL=sdui-page.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdui-page.d.mts","sourceRoot":"","sources":["../../src/lib/manifest/sdui-page.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sdui-page.d.mts","sourceRoot":"","sources":["../../src/lib/manifest/sdui-page.ts"],"names":[],"mappings":"OAAO,KAAK,EAAE,gBAAgB,EAAE;OACzB,KAAK,EAAE,aAAa,EAAE;AAE7B;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B;;;;OAIG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;;;;OAKG;IACH,QAAQ,EAAE,gBAAgB,GAAG,MAAM,CAAC;IACpC;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,qBAAa,QAAQ;IACnB,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;IACrC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAS;IAC/B,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAS;IAC1C,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAS;IAEtC;;;;OAIG;gBACS,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,aAAa;IAWtD;;OAEG;IACH,aAAa,IAAI,MAAM;IAIvB;;OAEG;IACH,OAAO,IAAI,MAAM;IAIjB;;OAEG;IACH,kBAAkB,IAAI,MAAM;IAI5B;;;;OAIG;IACH,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;CAS9B"}
|