@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
|
@@ -1,41 +1,108 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* The contents of this file were inserted manually and are not generated by Stainless.
|
|
3
|
-
*
|
|
4
|
-
* List view definitions for custom objects (column layout + sorting).
|
|
5
|
-
* Backend schema: CUSTOM_OBJECT_LIST_VIEW (v2)
|
|
6
|
-
*
|
|
7
|
-
* Construction is CDK-style: `new ListViewDef(customObject, props)` — the
|
|
8
|
-
* CO is the first positional arg, and the view auto-registers with the
|
|
9
|
-
* manifest via the CO's scope chain.
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
1
|
import { generateId, type ObjectScope, type SortOrder } from './_helpers';
|
|
13
2
|
import type { CustomObject } from './custom-object';
|
|
14
3
|
import type { Field } from './field';
|
|
15
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Initialization properties for {@link ListViewDef}.
|
|
7
|
+
*/
|
|
16
8
|
export interface ListViewDefProps {
|
|
17
|
-
/**
|
|
9
|
+
/**
|
|
10
|
+
* Display name of this list view shown in the UI (e.g. `'All members'`).
|
|
11
|
+
*
|
|
12
|
+
* Required.
|
|
13
|
+
*/
|
|
18
14
|
name: string;
|
|
19
|
-
/**
|
|
15
|
+
/**
|
|
16
|
+
* Columns to display, as live {@link Field} references. At least one field is required.
|
|
17
|
+
*
|
|
18
|
+
* Required.
|
|
19
|
+
*/
|
|
20
20
|
fields: Field[];
|
|
21
|
-
/**
|
|
21
|
+
/**
|
|
22
|
+
* Whether this view is visible to all users (`true`) or only the record owner (`false`).
|
|
23
|
+
*
|
|
24
|
+
* Required.
|
|
25
|
+
*/
|
|
22
26
|
isPublic: boolean;
|
|
23
|
-
/**
|
|
27
|
+
/**
|
|
28
|
+
* Stable identifier for this view. Pass a human-readable slug
|
|
29
|
+
* (e.g. `'view_gym_all_members'`) to keep it stable across regenerations.
|
|
30
|
+
*
|
|
31
|
+
* Optional. Auto-generated when omitted. @default generateId('view')
|
|
32
|
+
*/
|
|
24
33
|
viewId?: string;
|
|
25
|
-
/**
|
|
34
|
+
/**
|
|
35
|
+
* Field to sort by. Required when `sortOrder` is set.
|
|
36
|
+
*
|
|
37
|
+
* Optional.
|
|
38
|
+
*/
|
|
26
39
|
orderBy?: Field;
|
|
27
|
-
/**
|
|
40
|
+
/**
|
|
41
|
+
* Sort direction. One of `'ASC'` | `'DESC'`. Requires `orderBy` to be set.
|
|
42
|
+
*
|
|
43
|
+
* Optional.
|
|
44
|
+
*/
|
|
28
45
|
sortOrder?: SortOrder;
|
|
29
|
-
/**
|
|
46
|
+
/**
|
|
47
|
+
* Record scope for this view. One of `'all'` | `'my_records'`.
|
|
48
|
+
*
|
|
49
|
+
* Optional. @default `'all'`
|
|
50
|
+
*/
|
|
30
51
|
objectScope?: ObjectScope;
|
|
31
|
-
/**
|
|
52
|
+
/**
|
|
53
|
+
* Human-readable description of this view.
|
|
54
|
+
*
|
|
55
|
+
* Optional. @default null
|
|
56
|
+
*/
|
|
32
57
|
description?: string;
|
|
33
|
-
/**
|
|
58
|
+
/**
|
|
59
|
+
* Per-column configuration overrides (width, visibility, etc.).
|
|
60
|
+
*
|
|
61
|
+
* Optional. @default `{}`
|
|
62
|
+
*/
|
|
34
63
|
columnConfig?: Record<string, any>;
|
|
35
|
-
/**
|
|
64
|
+
/**
|
|
65
|
+
* RQL filter expression to pre-filter records shown in this view
|
|
66
|
+
* (e.g. `'(session_date__c == TODAY())'`).
|
|
67
|
+
*
|
|
68
|
+
* Optional. @default null
|
|
69
|
+
*/
|
|
36
70
|
rqlFilter?: string;
|
|
37
71
|
}
|
|
38
72
|
|
|
73
|
+
/**
|
|
74
|
+
* Defines a list view and registers it with the manifest.
|
|
75
|
+
*
|
|
76
|
+
* A list view defines which fields appear as columns, their sort order, and an
|
|
77
|
+
* optional RQL filter. You can define multiple views per custom object; each
|
|
78
|
+
* appears as a selectable view in the object's list page.
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* ```ts
|
|
82
|
+
* new ListViewDef(memberObj, {
|
|
83
|
+
* viewId: 'view_gym_all_members',
|
|
84
|
+
* name: 'All members',
|
|
85
|
+
* description: 'Directory with membership status',
|
|
86
|
+
* fields: [memberDisplayName, memberEmail, memberPhone, memberStatusField, memberJoinDate],
|
|
87
|
+
* orderBy: memberLastName,
|
|
88
|
+
* sortOrder: 'ASC',
|
|
89
|
+
* isPublic: true,
|
|
90
|
+
* objectScope: 'all',
|
|
91
|
+
* });
|
|
92
|
+
*
|
|
93
|
+
* // Filtered view example:
|
|
94
|
+
* new ListViewDef(sessionObj, {
|
|
95
|
+
* viewId: 'view_gym_today_sessions',
|
|
96
|
+
* name: 'Today\'s class sessions',
|
|
97
|
+
* fields: [sessionTrainerRef, sessionStartField, sessionClassTypeField],
|
|
98
|
+
* orderBy: sessionStartField,
|
|
99
|
+
* sortOrder: 'ASC',
|
|
100
|
+
* isPublic: true,
|
|
101
|
+
* objectScope: 'all',
|
|
102
|
+
* rqlFilter: '(session_date__c == TODAY())',
|
|
103
|
+
* });
|
|
104
|
+
* ```
|
|
105
|
+
*/
|
|
39
106
|
export class ListViewDef {
|
|
40
107
|
private readonly _viewId: string;
|
|
41
108
|
private readonly _customObjectApiName: string;
|
|
@@ -49,7 +116,11 @@ export class ListViewDef {
|
|
|
49
116
|
private readonly _columnConfig: Record<string, any> | undefined;
|
|
50
117
|
private readonly _rqlFilter: string | undefined;
|
|
51
118
|
|
|
52
|
-
/**
|
|
119
|
+
/**
|
|
120
|
+
* @param customObject - The custom object this view belongs to.
|
|
121
|
+
* @param props - Initialization properties.
|
|
122
|
+
* @throws {Error} If `name` is empty, `fields` is empty, or `sortOrder` is set without `orderBy`.
|
|
123
|
+
*/
|
|
53
124
|
constructor(customObject: CustomObject, props: ListViewDefProps) {
|
|
54
125
|
if (!props.name) throw new Error('ListViewDef: name cannot be empty');
|
|
55
126
|
if (!props.fields || props.fields.length === 0) {
|
|
@@ -72,17 +143,26 @@ export class ListViewDef {
|
|
|
72
143
|
customObject._register(this);
|
|
73
144
|
}
|
|
74
145
|
|
|
75
|
-
/**
|
|
146
|
+
/**
|
|
147
|
+
* Returns the stable identifier for this view (e.g. `'view_gym_all_members'`).
|
|
148
|
+
*/
|
|
76
149
|
getViewId(): string {
|
|
77
150
|
return this._viewId;
|
|
78
151
|
}
|
|
79
152
|
|
|
80
|
-
/**
|
|
153
|
+
/**
|
|
154
|
+
* Returns the api_name of the custom object this view belongs to.
|
|
155
|
+
*/
|
|
81
156
|
getCustomObjectApiName(): string {
|
|
82
157
|
return this._customObjectApiName;
|
|
83
158
|
}
|
|
84
159
|
|
|
85
|
-
/**
|
|
160
|
+
/**
|
|
161
|
+
* Serializes this list view to the wire format consumed by the manifest install endpoint.
|
|
162
|
+
*
|
|
163
|
+
* @returns A plain object with `type: 'CUSTOM_OBJECT_LIST_VIEW'`.
|
|
164
|
+
* Optional fields are omitted when unset.
|
|
165
|
+
*/
|
|
86
166
|
toDict(): Record<string, any> {
|
|
87
167
|
const d: Record<string, any> = {
|
|
88
168
|
type: 'CUSTOM_OBJECT_LIST_VIEW',
|
|
@@ -1,57 +1,85 @@
|
|
|
1
|
-
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* ManifestBuilder collects manifest components and serializes to JSON.
|
|
5
|
-
*
|
|
6
|
-
* Wiring model (CDK-style scope-first):
|
|
7
|
-
* - Every component takes its parent scope as the first positional
|
|
8
|
-
* constructor arg. The scope is either a `ManifestBuilder` (root) or a
|
|
9
|
-
* `CustomObject` / `CustomObjectFieldSection` for nested children.
|
|
10
|
-
* - Constructing a component auto-registers it with the builder via the
|
|
11
|
-
* scope's `_register` hook. There is no public `addComponent` — the
|
|
12
|
-
* only way a component enters the manifest is by being constructed
|
|
13
|
-
* with a scope that forwards up to this builder.
|
|
14
|
-
* - The builder does not walk into components; each component emits the
|
|
15
|
-
* foreign-key fields (`custom_object_api_name`, `model_rql_name`, ...)
|
|
16
|
-
* itself in `toDict()`.
|
|
1
|
+
/**
|
|
2
|
+
* Any object that can be included in a manifest.
|
|
17
3
|
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* - buildManifest() — return the manifest as a plain object
|
|
21
|
-
* - componentsList() — return the flat list of component dicts
|
|
4
|
+
* Implement `toDict()` to return the component's wire-format dict.
|
|
5
|
+
* All built-in SDK classes implement this interface automatically.
|
|
22
6
|
*/
|
|
23
|
-
|
|
24
|
-
/** Any object with a toDict() method can be a manifest component. */
|
|
25
7
|
export interface ManifestComponent {
|
|
26
8
|
toDict(): Record<string, any>;
|
|
27
9
|
}
|
|
28
10
|
|
|
29
11
|
/**
|
|
30
|
-
* A scope — anything that can accept
|
|
31
|
-
*
|
|
32
|
-
*
|
|
12
|
+
* A scope — anything that can accept child component registrations.
|
|
13
|
+
*
|
|
14
|
+
* Implemented by {@link ManifestBuilder} (the root) and by nestable parents
|
|
15
|
+
* like `CustomObject` that forward registrations up to the builder.
|
|
16
|
+
* Pass a scope as the first argument when constructing any manifest component.
|
|
33
17
|
*/
|
|
34
18
|
export interface ManifestScope {
|
|
35
19
|
/** @internal Register a child component; builder-bound scopes forward up. */
|
|
36
20
|
_register(component: ManifestComponent): void;
|
|
37
21
|
}
|
|
38
22
|
|
|
23
|
+
/**
|
|
24
|
+
* Initialization properties for {@link ManifestBuilder}.
|
|
25
|
+
*/
|
|
39
26
|
export interface ManifestBuilderProps {
|
|
40
|
-
/**
|
|
27
|
+
/**
|
|
28
|
+
* Unique project key for this manifest (e.g. `'gym_membership_management'`).
|
|
29
|
+
*
|
|
30
|
+
* Required.
|
|
31
|
+
*/
|
|
41
32
|
key: string;
|
|
42
|
-
/**
|
|
33
|
+
/**
|
|
34
|
+
* Display name for this manifest.
|
|
35
|
+
*
|
|
36
|
+
* Optional. Defaults to `key` when not provided.
|
|
37
|
+
*/
|
|
43
38
|
name?: string;
|
|
44
|
-
/**
|
|
39
|
+
/**
|
|
40
|
+
* Human-readable description of what this manifest contains.
|
|
41
|
+
*
|
|
42
|
+
* Optional.
|
|
43
|
+
*/
|
|
45
44
|
description?: string;
|
|
46
45
|
}
|
|
47
46
|
|
|
47
|
+
/**
|
|
48
|
+
* Root container for a manifest — collects all components and serializes them to JSON.
|
|
49
|
+
*
|
|
50
|
+
* You would normally create one `ManifestBuilder` at the top of your manifest file,
|
|
51
|
+
* then pass it as the scope to all top-level components (categories, custom objects,
|
|
52
|
+
* functions, apps, SDUI pages). Each component auto-registers on construction; there
|
|
53
|
+
* is no separate add or register call.
|
|
54
|
+
*
|
|
55
|
+
* After defining all components, call `preview()` to emit the manifest as a
|
|
56
|
+
* pretty-printed JSON string, or `buildManifest()` to get the plain object.
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```ts
|
|
60
|
+
* const manifest = new ManifestBuilder({
|
|
61
|
+
* key: 'gym_membership_management',
|
|
62
|
+
* name: 'Gym Membership Management',
|
|
63
|
+
* description: 'Members, trainers, schedules, and check-in',
|
|
64
|
+
* });
|
|
65
|
+
*
|
|
66
|
+
* const category = new Category(manifest, { apiName: 'gym__c', name: 'Gym' });
|
|
67
|
+
* const memberObj = new CustomObject(manifest, { apiName: 'gym_member__c', name: 'Member', category });
|
|
68
|
+
* // ... define fields, rules, list views, etc. ...
|
|
69
|
+
*
|
|
70
|
+
* console.log(manifest.preview());
|
|
71
|
+
* ```
|
|
72
|
+
*/
|
|
48
73
|
export class ManifestBuilder implements ManifestScope {
|
|
49
74
|
readonly key: string;
|
|
50
75
|
readonly name: string;
|
|
51
76
|
readonly description: string;
|
|
52
77
|
private readonly _components: ManifestComponent[] = [];
|
|
53
78
|
|
|
54
|
-
/**
|
|
79
|
+
/**
|
|
80
|
+
* @param props - Initialization properties.
|
|
81
|
+
* @throws {Error} If `props.key` is empty or missing.
|
|
82
|
+
*/
|
|
55
83
|
constructor(props: ManifestBuilderProps) {
|
|
56
84
|
if (!props.key) {
|
|
57
85
|
throw new Error('key is required');
|
|
@@ -72,7 +100,11 @@ export class ManifestBuilder implements ManifestScope {
|
|
|
72
100
|
this._components.push(component);
|
|
73
101
|
}
|
|
74
102
|
|
|
75
|
-
/**
|
|
103
|
+
/**
|
|
104
|
+
* Returns the manifest as a plain object with `metadata` and a flat `components` array.
|
|
105
|
+
*
|
|
106
|
+
* @returns `{ metadata: { key, name, description? }, components: Record<string, any>[] }`
|
|
107
|
+
*/
|
|
76
108
|
buildManifest(): { metadata: Record<string, any>; components: Record<string, any>[] } {
|
|
77
109
|
const metadata: Record<string, any> = {
|
|
78
110
|
key: this.key,
|
|
@@ -85,12 +117,23 @@ export class ManifestBuilder implements ManifestScope {
|
|
|
85
117
|
return { metadata, components };
|
|
86
118
|
}
|
|
87
119
|
|
|
88
|
-
/**
|
|
120
|
+
/**
|
|
121
|
+
* Returns the flat list of all registered component dicts.
|
|
122
|
+
*
|
|
123
|
+
* @returns An array of wire-format component objects, in registration order.
|
|
124
|
+
*/
|
|
89
125
|
componentsList(): Record<string, any>[] {
|
|
90
126
|
return this._components.map((c) => c.toDict());
|
|
91
127
|
}
|
|
92
128
|
|
|
93
|
-
/**
|
|
129
|
+
/**
|
|
130
|
+
* Returns the full manifest as a pretty-printed JSON string.
|
|
131
|
+
*
|
|
132
|
+
* Typically used as the final line of a manifest file to emit the output:
|
|
133
|
+
* `console.log(manifest.preview())`.
|
|
134
|
+
*
|
|
135
|
+
* @returns Indented JSON string of the complete manifest.
|
|
136
|
+
*/
|
|
94
137
|
preview(): string {
|
|
95
138
|
return JSON.stringify(this.buildManifest(), null, 2);
|
|
96
139
|
}
|
|
@@ -1,37 +1,98 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* The contents of this file were inserted manually and are not generated by Stainless.
|
|
3
|
-
*
|
|
4
|
-
* Custom function definitions (TypeScript handler code).
|
|
5
|
-
* Backend schema: FUNCTION (v2)
|
|
6
|
-
*
|
|
7
|
-
* Named ManifestFunction to avoid collision with the JavaScript built-in Function.
|
|
8
|
-
* Re-exported as both ManifestFunction and Function from the barrel.
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
1
|
import type { FunctionRuntime } from './_helpers';
|
|
12
2
|
import type { ManifestScope } from './manifest-builder';
|
|
13
3
|
|
|
4
|
+
/**
|
|
5
|
+
* Initialization properties for {@link ManifestFunction}.
|
|
6
|
+
*/
|
|
14
7
|
export interface ManifestFunctionProps {
|
|
15
|
-
/**
|
|
8
|
+
/**
|
|
9
|
+
* Unique identifier for this function (e.g. `'gym_today_schedule_fn'`).
|
|
10
|
+
*
|
|
11
|
+
* Required.
|
|
12
|
+
*/
|
|
16
13
|
apiName: string;
|
|
17
|
-
/**
|
|
14
|
+
/**
|
|
15
|
+
* Display name shown in the Rippling UI.
|
|
16
|
+
*
|
|
17
|
+
* Required.
|
|
18
|
+
*/
|
|
18
19
|
name: string;
|
|
19
|
-
/**
|
|
20
|
+
/**
|
|
21
|
+
* TypeScript handler source code. Must export an `onRipplingEvent` function.
|
|
22
|
+
*
|
|
23
|
+
* Optional. @default `''`
|
|
24
|
+
*/
|
|
20
25
|
code?: string;
|
|
21
|
-
/**
|
|
26
|
+
/**
|
|
27
|
+
* Human-readable description of what this function does.
|
|
28
|
+
*
|
|
29
|
+
* Optional. @default `''`
|
|
30
|
+
*/
|
|
22
31
|
description?: string;
|
|
23
|
-
/**
|
|
32
|
+
/**
|
|
33
|
+
* NPM package dependencies as a `{ packageName: versionRange }` map
|
|
34
|
+
* (e.g. `{ '@rippling/rippling-sdk': '^0.2.0' }`).
|
|
35
|
+
*
|
|
36
|
+
* Optional. @default null
|
|
37
|
+
*/
|
|
24
38
|
dependencies?: Record<string, string>;
|
|
25
|
-
/**
|
|
39
|
+
/**
|
|
40
|
+
* Raw deployment options object. Prefer `runtime` for the common case.
|
|
41
|
+
*
|
|
42
|
+
* Optional. @default null
|
|
43
|
+
*/
|
|
26
44
|
deploymentOptions?: Record<string, any>;
|
|
27
|
-
/**
|
|
45
|
+
/**
|
|
46
|
+
* Deployment runtime shorthand. Sets `deploymentOptions.runtime` and is merged
|
|
47
|
+
* with any explicit `deploymentOptions`. One of `'cloudflare-js'` | `'lambda-deno'`
|
|
48
|
+
* | `'lambda-python'`.
|
|
49
|
+
*
|
|
50
|
+
* Optional.
|
|
51
|
+
*/
|
|
28
52
|
runtime?: FunctionRuntime;
|
|
29
|
-
/**
|
|
53
|
+
/**
|
|
54
|
+
* Outbound domain allowlist. Requests to domains not in this list will be blocked.
|
|
55
|
+
*
|
|
56
|
+
* Optional. @default null
|
|
57
|
+
*/
|
|
30
58
|
allowedDomains?: string[];
|
|
31
|
-
/**
|
|
59
|
+
/**
|
|
60
|
+
* Whether this function runs asynchronously (fire-and-forget).
|
|
61
|
+
*
|
|
62
|
+
* Optional. @default `false`
|
|
63
|
+
*/
|
|
32
64
|
isAsync?: boolean;
|
|
33
65
|
}
|
|
34
66
|
|
|
67
|
+
/**
|
|
68
|
+
* Defines a serverless function and registers it with the manifest.
|
|
69
|
+
*
|
|
70
|
+
* A `ManifestFunction` packages TypeScript handler code that runs on Rippling's
|
|
71
|
+
* serverless infrastructure. Functions are the backing implementation for
|
|
72
|
+
* {@link SduiPage} surfaces. The handler must export `onRipplingEvent`.
|
|
73
|
+
*
|
|
74
|
+
* This class is named `ManifestFunction` to avoid collision with the JavaScript
|
|
75
|
+
* built-in `Function`. It is also re-exported as `Function` from the barrel for
|
|
76
|
+
* convenience.
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* ```ts
|
|
80
|
+
* const todayScheduleFn = new ManifestFunction(manifest, {
|
|
81
|
+
* apiName: 'gym_today_schedule_fn',
|
|
82
|
+
* name: 'Today\'s schedule (SDUI)',
|
|
83
|
+
* description: 'Searchable grid of class sessions',
|
|
84
|
+
* runtime: 'lambda-deno',
|
|
85
|
+
* code: handlerSource,
|
|
86
|
+
* dependencies: {
|
|
87
|
+
* '@rippling/rippling-sdk': '^0.2.0-alpha.33',
|
|
88
|
+
* '@rippling/sdui-builder': '^0.1.0',
|
|
89
|
+
* },
|
|
90
|
+
* isAsync: false,
|
|
91
|
+
* });
|
|
92
|
+
* ```
|
|
93
|
+
*
|
|
94
|
+
* @see {@link SduiPage} — wraps a `ManifestFunction` as a navigable UI surface.
|
|
95
|
+
*/
|
|
35
96
|
export class ManifestFunction {
|
|
36
97
|
private readonly _apiName: string;
|
|
37
98
|
private readonly _name: string;
|
|
@@ -42,7 +103,10 @@ export class ManifestFunction {
|
|
|
42
103
|
private readonly _allowedDomains: string[] | undefined;
|
|
43
104
|
private readonly _isAsync: boolean;
|
|
44
105
|
|
|
45
|
-
/**
|
|
106
|
+
/**
|
|
107
|
+
* @param scope - The manifest to register this function with.
|
|
108
|
+
* @param props - Initialization properties.
|
|
109
|
+
*/
|
|
46
110
|
constructor(scope: ManifestScope, props: ManifestFunctionProps) {
|
|
47
111
|
this._apiName = props.apiName;
|
|
48
112
|
this._name = props.name;
|
|
@@ -58,12 +122,18 @@ export class ManifestFunction {
|
|
|
58
122
|
scope._register(this);
|
|
59
123
|
}
|
|
60
124
|
|
|
61
|
-
/**
|
|
125
|
+
/**
|
|
126
|
+
* Returns the api_name of this function (e.g. `'gym_today_schedule_fn'`).
|
|
127
|
+
*/
|
|
62
128
|
getApiName(): string {
|
|
63
129
|
return this._apiName;
|
|
64
130
|
}
|
|
65
131
|
|
|
66
|
-
/**
|
|
132
|
+
/**
|
|
133
|
+
* Serializes this function to the wire format consumed by the manifest install endpoint.
|
|
134
|
+
*
|
|
135
|
+
* @returns A plain object with `type: 'FUNCTION'`. Empty or unset optional fields are omitted.
|
|
136
|
+
*/
|
|
67
137
|
toDict(): Record<string, any> {
|
|
68
138
|
const component: Record<string, any> = {
|
|
69
139
|
type: 'FUNCTION',
|
package/src/lib/manifest/rule.ts
CHANGED
|
@@ -1,47 +1,81 @@
|
|
|
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
|
-
|
|
12
1
|
import { generateId, type TriggerType, type UpdateTriggerType } from './_helpers';
|
|
13
2
|
import type { CustomObject } from './custom-object';
|
|
14
3
|
import type { Field } from './field';
|
|
15
4
|
|
|
16
|
-
|
|
17
|
-
|
|
5
|
+
/**
|
|
6
|
+
* A single action performed when a {@link Rule} fires.
|
|
7
|
+
*/
|
|
18
8
|
export interface RuleAction {
|
|
19
|
-
/**
|
|
9
|
+
/**
|
|
10
|
+
* The field to set when this action runs.
|
|
11
|
+
*
|
|
12
|
+
* Required.
|
|
13
|
+
*/
|
|
20
14
|
targetField: Field;
|
|
21
15
|
/**
|
|
22
|
-
* Set the target to a fixed value. Mutually exclusive with `rqlFormula`.
|
|
23
|
-
*
|
|
24
|
-
*
|
|
16
|
+
* Set the target field to a fixed value. Mutually exclusive with `rqlFormula`.
|
|
17
|
+
*
|
|
18
|
+
* Optional. For `SELECT` / `RADIO` fields, pass a string or single-element array —
|
|
19
|
+
* both are normalized to an array on the wire.
|
|
25
20
|
*/
|
|
26
21
|
fixedValue?: any;
|
|
27
|
-
/**
|
|
22
|
+
/**
|
|
23
|
+
* Set the target field to the result of an RQL formula. Mutually exclusive with `fixedValue`.
|
|
24
|
+
*
|
|
25
|
+
* Optional.
|
|
26
|
+
*/
|
|
28
27
|
rqlFormula?: string;
|
|
29
28
|
}
|
|
30
29
|
|
|
30
|
+
/**
|
|
31
|
+
* Initialization properties for {@link Rule}.
|
|
32
|
+
*/
|
|
31
33
|
export interface RuleProps {
|
|
32
|
-
/**
|
|
34
|
+
/**
|
|
35
|
+
* Display name of this automation rule shown in the UI.
|
|
36
|
+
*
|
|
37
|
+
* Required.
|
|
38
|
+
*/
|
|
33
39
|
flowName: string;
|
|
34
|
-
/**
|
|
40
|
+
/**
|
|
41
|
+
* When this rule fires. One of `'CREATE'` | `'UPDATE'` | `'CREATE_OR_UPDATE'`.
|
|
42
|
+
*
|
|
43
|
+
* Required. The constructor throws if an invalid value is passed.
|
|
44
|
+
*/
|
|
35
45
|
triggerType: TriggerType;
|
|
36
|
-
/**
|
|
46
|
+
/**
|
|
47
|
+
* Stable identifier for this rule. Pass a human-readable slug
|
|
48
|
+
* (e.g. `'gym_default_enrollment_status'`) to keep it stable across regenerations.
|
|
49
|
+
*
|
|
50
|
+
* Optional. Auto-generated when omitted. @default generateId('flow')
|
|
51
|
+
*/
|
|
37
52
|
flowId?: string;
|
|
38
|
-
/**
|
|
53
|
+
/**
|
|
54
|
+
* RQL formula guard — the rule fires only when this expression is truthy.
|
|
55
|
+
*
|
|
56
|
+
* Optional. @default null
|
|
57
|
+
*/
|
|
39
58
|
rqlCondition?: string;
|
|
40
|
-
/**
|
|
59
|
+
/**
|
|
60
|
+
* Controls when an `UPDATE` trigger fires relative to the condition.
|
|
61
|
+
* One of `'MEETS_CONDITION_AFTER_ONLY'` | `'MEETS_CONDITION_BEFORE_OR_AFTER'`.
|
|
62
|
+
*
|
|
63
|
+
* Conditional. Only meaningful when `triggerType` is `'UPDATE'` or `'CREATE_OR_UPDATE'`.
|
|
64
|
+
* @default `'MEETS_CONDITION_AFTER_ONLY'`
|
|
65
|
+
*/
|
|
41
66
|
updateTriggerType?: UpdateTriggerType;
|
|
42
|
-
/**
|
|
67
|
+
/**
|
|
68
|
+
* Internal description of this rule (for developer reference only).
|
|
69
|
+
*
|
|
70
|
+
* Optional. @default null
|
|
71
|
+
*/
|
|
43
72
|
description?: string;
|
|
44
|
-
/**
|
|
73
|
+
/**
|
|
74
|
+
* Actions to run when the rule fires. Each action sets one field to a fixed value
|
|
75
|
+
* or RQL formula result.
|
|
76
|
+
*
|
|
77
|
+
* Optional. @default `[]`
|
|
78
|
+
*/
|
|
45
79
|
actions?: RuleAction[];
|
|
46
80
|
}
|
|
47
81
|
|
|
@@ -69,6 +103,24 @@ function actionToDict(action: RuleAction): Record<string, any> {
|
|
|
69
103
|
return out;
|
|
70
104
|
}
|
|
71
105
|
|
|
106
|
+
/**
|
|
107
|
+
* Defines a record-triggered automation rule and registers it with the manifest.
|
|
108
|
+
*
|
|
109
|
+
* A rule fires automatically when a record on the parent custom object is created,
|
|
110
|
+
* updated, or both — depending on `triggerType`. Each rule runs a list of actions
|
|
111
|
+
* that set field values, optionally guarded by an RQL condition.
|
|
112
|
+
*
|
|
113
|
+
* @example
|
|
114
|
+
* ```ts
|
|
115
|
+
* new Rule(enrollmentObj, {
|
|
116
|
+
* flowId: 'gym_default_enrollment_status',
|
|
117
|
+
* flowName: 'Default attendance to Registered',
|
|
118
|
+
* triggerType: 'CREATE',
|
|
119
|
+
* description: 'New roster rows start as Registered unless changed',
|
|
120
|
+
* actions: [{ targetField: enrollmentAttendanceField, fixedValue: ['Registered'] }],
|
|
121
|
+
* });
|
|
122
|
+
* ```
|
|
123
|
+
*/
|
|
72
124
|
export class Rule {
|
|
73
125
|
private readonly _flowId: string;
|
|
74
126
|
private readonly _customObjectApiName: string;
|
|
@@ -79,8 +131,13 @@ export class Rule {
|
|
|
79
131
|
private readonly _description: string | undefined;
|
|
80
132
|
private readonly _actions: RuleAction[];
|
|
81
133
|
|
|
82
|
-
/**
|
|
134
|
+
/**
|
|
135
|
+
* @param customObject - The custom object this rule is attached to.
|
|
136
|
+
* @param props - Initialization properties.
|
|
137
|
+
* @throws {Error} If `props.triggerType` is not one of `'CREATE'`, `'UPDATE'`, `'CREATE_OR_UPDATE'`.
|
|
138
|
+
*/
|
|
83
139
|
constructor(customObject: CustomObject, props: RuleProps) {
|
|
140
|
+
const VALID_TRIGGERS: TriggerType[] = ['CREATE', 'UPDATE', 'CREATE_OR_UPDATE'];
|
|
84
141
|
if (!VALID_TRIGGERS.includes(props.triggerType)) {
|
|
85
142
|
throw new Error(
|
|
86
143
|
`Invalid trigger_type: ${props.triggerType}. Must be one of: ${VALID_TRIGGERS.join(', ')}`,
|
|
@@ -97,17 +154,26 @@ export class Rule {
|
|
|
97
154
|
customObject._register(this);
|
|
98
155
|
}
|
|
99
156
|
|
|
100
|
-
/**
|
|
157
|
+
/**
|
|
158
|
+
* Returns the stable identifier for this rule (e.g. `'gym_default_enrollment_status'`).
|
|
159
|
+
*/
|
|
101
160
|
getFlowId(): string {
|
|
102
161
|
return this._flowId;
|
|
103
162
|
}
|
|
104
163
|
|
|
105
|
-
/**
|
|
164
|
+
/**
|
|
165
|
+
* Returns the api_name of the custom object this rule is attached to.
|
|
166
|
+
*/
|
|
106
167
|
getCustomObjectApiName(): string {
|
|
107
168
|
return this._customObjectApiName;
|
|
108
169
|
}
|
|
109
170
|
|
|
110
|
-
/**
|
|
171
|
+
/**
|
|
172
|
+
* Serializes this rule to the wire format consumed by the manifest install endpoint.
|
|
173
|
+
*
|
|
174
|
+
* @returns A plain object with `type: 'CUSTOM_OBJECT_RECORD_TRIGGERED_FLOW'`.
|
|
175
|
+
* Optional fields are omitted when unset; `actions` is omitted when empty.
|
|
176
|
+
*/
|
|
111
177
|
toDict(): Record<string, any> {
|
|
112
178
|
const component: Record<string, any> = {
|
|
113
179
|
type: 'CUSTOM_OBJECT_RECORD_TRIGGERED_FLOW',
|