@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.
Files changed (270) hide show
  1. package/client.d.mts +6 -0
  2. package/client.d.mts.map +1 -1
  3. package/client.d.ts +6 -0
  4. package/client.d.ts.map +1 -1
  5. package/client.js +6 -0
  6. package/client.js.map +1 -1
  7. package/client.mjs +6 -0
  8. package/client.mjs.map +1 -1
  9. package/examples/.keep +4 -0
  10. package/examples/manifest/dental-practice-management/dental-practice-management.ts +651 -0
  11. package/examples/manifest/dental-practice-management/manifest.json +1870 -0
  12. package/examples/manifest/gym-membership-management/gym-membership-management.ts +757 -0
  13. package/examples/manifest/gym-membership-management/manifest.json +1975 -0
  14. package/examples/sdui/sdui-crud-todo/rippling-function.ts +367 -0
  15. package/examples/sdui/sdui-crud-todo/sdui-crud-todo.ts +282 -0
  16. package/examples/sdui/sdui-showcase/rippling-function.ts +381 -0
  17. package/examples/sdui/sdui-showcase/sdui-showcase.ts +351 -0
  18. package/examples/sdui/sdui-tab-multi-view/rippling-function.ts +1061 -0
  19. package/examples/sdui/sdui-tab-multi-view/sdui-tab-multi-view.ts +924 -0
  20. package/examples/sdui/vote/rippling-function.ts +330 -0
  21. package/examples/sdui/vote/vote.ts +298 -0
  22. package/lib/manifest/app.d.mts +81 -13
  23. package/lib/manifest/app.d.mts.map +1 -1
  24. package/lib/manifest/app.d.ts +81 -13
  25. package/lib/manifest/app.d.ts.map +1 -1
  26. package/lib/manifest/app.js +37 -16
  27. package/lib/manifest/app.js.map +1 -1
  28. package/lib/manifest/app.mjs +37 -16
  29. package/lib/manifest/app.mjs.map +1 -1
  30. package/lib/manifest/category.d.mts +63 -7
  31. package/lib/manifest/category.d.mts.map +1 -1
  32. package/lib/manifest/category.d.ts +63 -7
  33. package/lib/manifest/category.d.ts.map +1 -1
  34. package/lib/manifest/category.js +45 -10
  35. package/lib/manifest/category.js.map +1 -1
  36. package/lib/manifest/category.mjs +43 -8
  37. package/lib/manifest/category.mjs.map +1 -1
  38. package/lib/manifest/custom-object-field-section.d.mts +56 -6
  39. package/lib/manifest/custom-object-field-section.d.mts.map +1 -1
  40. package/lib/manifest/custom-object-field-section.d.ts +56 -6
  41. package/lib/manifest/custom-object-field-section.d.ts.map +1 -1
  42. package/lib/manifest/custom-object-field-section.js +41 -14
  43. package/lib/manifest/custom-object-field-section.js.map +1 -1
  44. package/lib/manifest/custom-object-field-section.mjs +39 -12
  45. package/lib/manifest/custom-object-field-section.mjs.map +1 -1
  46. package/lib/manifest/custom-object-page-layout.d.mts +201 -41
  47. package/lib/manifest/custom-object-page-layout.d.mts.map +1 -1
  48. package/lib/manifest/custom-object-page-layout.d.ts +201 -41
  49. package/lib/manifest/custom-object-page-layout.d.ts.map +1 -1
  50. package/lib/manifest/custom-object-page-layout.js +76 -30
  51. package/lib/manifest/custom-object-page-layout.js.map +1 -1
  52. package/lib/manifest/custom-object-page-layout.mjs +74 -28
  53. package/lib/manifest/custom-object-page-layout.mjs.map +1 -1
  54. package/lib/manifest/custom-object.d.mts +128 -15
  55. package/lib/manifest/custom-object.d.mts.map +1 -1
  56. package/lib/manifest/custom-object.d.ts +128 -15
  57. package/lib/manifest/custom-object.d.ts.map +1 -1
  58. package/lib/manifest/custom-object.js +61 -26
  59. package/lib/manifest/custom-object.js.map +1 -1
  60. package/lib/manifest/custom-object.mjs +61 -26
  61. package/lib/manifest/custom-object.mjs.map +1 -1
  62. package/lib/manifest/field.d.mts +265 -54
  63. package/lib/manifest/field.d.mts.map +1 -1
  64. package/lib/manifest/field.d.ts +265 -54
  65. package/lib/manifest/field.d.ts.map +1 -1
  66. package/lib/manifest/field.js +100 -57
  67. package/lib/manifest/field.js.map +1 -1
  68. package/lib/manifest/field.mjs +100 -57
  69. package/lib/manifest/field.mjs.map +1 -1
  70. package/lib/manifest/list-view.d.mts +105 -14
  71. package/lib/manifest/list-view.d.mts.map +1 -1
  72. package/lib/manifest/list-view.d.ts +105 -14
  73. package/lib/manifest/list-view.d.ts.map +1 -1
  74. package/lib/manifest/list-view.js +50 -14
  75. package/lib/manifest/list-view.js.map +1 -1
  76. package/lib/manifest/list-view.mjs +48 -12
  77. package/lib/manifest/list-view.mjs.map +1 -1
  78. package/lib/manifest/manifest-builder.d.mts +77 -11
  79. package/lib/manifest/manifest-builder.d.mts.map +1 -1
  80. package/lib/manifest/manifest-builder.d.ts +77 -11
  81. package/lib/manifest/manifest-builder.d.ts.map +1 -1
  82. package/lib/manifest/manifest-builder.js +46 -24
  83. package/lib/manifest/manifest-builder.js.map +1 -1
  84. package/lib/manifest/manifest-builder.mjs +44 -22
  85. package/lib/manifest/manifest-builder.mjs.map +1 -1
  86. package/lib/manifest/manifest-function.d.mts +92 -12
  87. package/lib/manifest/manifest-function.d.mts.map +1 -1
  88. package/lib/manifest/manifest-function.d.ts +92 -12
  89. package/lib/manifest/manifest-function.d.ts.map +1 -1
  90. package/lib/manifest/manifest-function.js +40 -11
  91. package/lib/manifest/manifest-function.js.map +1 -1
  92. package/lib/manifest/manifest-function.mjs +38 -9
  93. package/lib/manifest/manifest-function.mjs.map +1 -1
  94. package/lib/manifest/rule.d.mts +94 -16
  95. package/lib/manifest/rule.d.mts.map +1 -1
  96. package/lib/manifest/rule.d.ts +94 -16
  97. package/lib/manifest/rule.d.ts.map +1 -1
  98. package/lib/manifest/rule.js +36 -15
  99. package/lib/manifest/rule.js.map +1 -1
  100. package/lib/manifest/rule.mjs +36 -15
  101. package/lib/manifest/rule.mjs.map +1 -1
  102. package/lib/manifest/sdui-page.d.mts +67 -11
  103. package/lib/manifest/sdui-page.d.mts.map +1 -1
  104. package/lib/manifest/sdui-page.d.ts +67 -11
  105. package/lib/manifest/sdui-page.d.ts.map +1 -1
  106. package/lib/manifest/sdui-page.js +44 -13
  107. package/lib/manifest/sdui-page.js.map +1 -1
  108. package/lib/manifest/sdui-page.mjs +42 -11
  109. package/lib/manifest/sdui-page.mjs.map +1 -1
  110. package/lib/manifest/validation.d.mts +87 -12
  111. package/lib/manifest/validation.d.mts.map +1 -1
  112. package/lib/manifest/validation.d.ts +87 -12
  113. package/lib/manifest/validation.d.ts.map +1 -1
  114. package/lib/manifest/validation.js +41 -15
  115. package/lib/manifest/validation.js.map +1 -1
  116. package/lib/manifest/validation.mjs +39 -13
  117. package/lib/manifest/validation.mjs.map +1 -1
  118. package/lib/sdui/actions.d.mts +25 -0
  119. package/lib/sdui/actions.d.mts.map +1 -0
  120. package/lib/sdui/actions.d.ts +25 -0
  121. package/lib/sdui/actions.d.ts.map +1 -0
  122. package/lib/sdui/actions.js +53 -0
  123. package/lib/sdui/actions.js.map +1 -0
  124. package/lib/sdui/actions.mjs +42 -0
  125. package/lib/sdui/actions.mjs.map +1 -0
  126. package/lib/sdui/component.d.mts +41 -0
  127. package/lib/sdui/component.d.mts.map +1 -0
  128. package/lib/sdui/component.d.ts +41 -0
  129. package/lib/sdui/component.d.ts.map +1 -0
  130. package/lib/sdui/component.js +95 -0
  131. package/lib/sdui/component.js.map +1 -0
  132. package/lib/sdui/component.mjs +91 -0
  133. package/lib/sdui/component.mjs.map +1 -0
  134. package/lib/sdui/components.d.mts +149 -0
  135. package/lib/sdui/components.d.mts.map +1 -0
  136. package/lib/sdui/components.d.ts +149 -0
  137. package/lib/sdui/components.d.ts.map +1 -0
  138. package/lib/sdui/components.js +303 -0
  139. package/lib/sdui/components.js.map +1 -0
  140. package/lib/sdui/components.mjs +298 -0
  141. package/lib/sdui/components.mjs.map +1 -0
  142. package/lib/sdui/conditions.d.mts +25 -0
  143. package/lib/sdui/conditions.d.mts.map +1 -0
  144. package/lib/sdui/conditions.d.ts +25 -0
  145. package/lib/sdui/conditions.d.ts.map +1 -0
  146. package/lib/sdui/conditions.js +47 -0
  147. package/lib/sdui/conditions.js.map +1 -0
  148. package/lib/sdui/conditions.mjs +35 -0
  149. package/lib/sdui/conditions.mjs.map +1 -0
  150. package/lib/sdui/directives.d.mts +18 -0
  151. package/lib/sdui/directives.d.mts.map +1 -0
  152. package/lib/sdui/directives.d.ts +18 -0
  153. package/lib/sdui/directives.d.ts.map +1 -0
  154. package/lib/sdui/directives.js +28 -0
  155. package/lib/sdui/directives.js.map +1 -0
  156. package/lib/sdui/directives.mjs +21 -0
  157. package/lib/sdui/directives.mjs.map +1 -0
  158. package/lib/sdui/index.d.mts +362 -0
  159. package/lib/sdui/index.d.mts.map +1 -0
  160. package/lib/sdui/index.d.ts +362 -0
  161. package/lib/sdui/index.d.ts.map +1 -0
  162. package/lib/sdui/index.js +375 -0
  163. package/lib/sdui/index.js.map +1 -0
  164. package/lib/sdui/index.mjs +199 -0
  165. package/lib/sdui/index.mjs.map +1 -0
  166. package/lib/sdui/props.d.mts +12 -0
  167. package/lib/sdui/props.d.mts.map +1 -0
  168. package/lib/sdui/props.d.ts +12 -0
  169. package/lib/sdui/props.d.ts.map +1 -0
  170. package/lib/sdui/props.js +25 -0
  171. package/lib/sdui/props.js.map +1 -0
  172. package/lib/sdui/props.mjs +21 -0
  173. package/lib/sdui/props.mjs.map +1 -0
  174. package/lib/sdui/render.d.mts +23 -0
  175. package/lib/sdui/render.d.mts.map +1 -0
  176. package/lib/sdui/render.d.ts +23 -0
  177. package/lib/sdui/render.d.ts.map +1 -0
  178. package/lib/sdui/render.js +40 -0
  179. package/lib/sdui/render.js.map +1 -0
  180. package/lib/sdui/render.mjs +37 -0
  181. package/lib/sdui/render.mjs.map +1 -0
  182. package/lib/sdui/state.d.mts +22 -0
  183. package/lib/sdui/state.d.mts.map +1 -0
  184. package/lib/sdui/state.d.ts +22 -0
  185. package/lib/sdui/state.d.ts.map +1 -0
  186. package/lib/sdui/state.js +57 -0
  187. package/lib/sdui/state.js.map +1 -0
  188. package/lib/sdui/state.mjs +53 -0
  189. package/lib/sdui/state.mjs.map +1 -0
  190. package/package.json +11 -1
  191. package/resources/company-legal-entity-workers.d.mts +79 -0
  192. package/resources/company-legal-entity-workers.d.mts.map +1 -0
  193. package/resources/company-legal-entity-workers.d.ts +79 -0
  194. package/resources/company-legal-entity-workers.d.ts.map +1 -0
  195. package/resources/company-legal-entity-workers.js +30 -0
  196. package/resources/company-legal-entity-workers.js.map +1 -0
  197. package/resources/company-legal-entity-workers.mjs +26 -0
  198. package/resources/company-legal-entity-workers.mjs.map +1 -0
  199. package/resources/draft-hires.d.mts +4 -0
  200. package/resources/draft-hires.d.mts.map +1 -1
  201. package/resources/draft-hires.d.ts +4 -0
  202. package/resources/draft-hires.d.ts.map +1 -1
  203. package/resources/files.d.mts +16 -1
  204. package/resources/files.d.mts.map +1 -1
  205. package/resources/files.d.ts +16 -1
  206. package/resources/files.d.ts.map +1 -1
  207. package/resources/headcount-positions.d.mts +2 -2
  208. package/resources/headcount-positions.d.mts.map +1 -1
  209. package/resources/headcount-positions.d.ts +2 -2
  210. package/resources/headcount-positions.d.ts.map +1 -1
  211. package/resources/index.d.mts +1 -0
  212. package/resources/index.d.mts.map +1 -1
  213. package/resources/index.d.ts +1 -0
  214. package/resources/index.d.ts.map +1 -1
  215. package/resources/index.js +4 -2
  216. package/resources/index.js.map +1 -1
  217. package/resources/index.mjs +1 -0
  218. package/resources/index.mjs.map +1 -1
  219. package/resources/legal-entities.d.mts +1 -1
  220. package/resources/legal-entities.d.mts.map +1 -1
  221. package/resources/legal-entities.d.ts +1 -1
  222. package/resources/legal-entities.d.ts.map +1 -1
  223. package/resources/location-factors.d.mts +2 -2
  224. package/resources/location-factors.d.mts.map +1 -1
  225. package/resources/location-factors.d.ts +2 -2
  226. package/resources/location-factors.d.ts.map +1 -1
  227. package/resources/shared.d.mts +1 -1
  228. package/resources/shared.d.mts.map +1 -1
  229. package/resources/shared.d.ts +1 -1
  230. package/resources/shared.d.ts.map +1 -1
  231. package/resources/workers.d.mts +2 -2
  232. package/resources/workers.d.mts.map +1 -1
  233. package/resources/workers.d.ts +2 -2
  234. package/resources/workers.d.ts.map +1 -1
  235. package/src/client.ts +20 -0
  236. package/src/lib/manifest/app.ts +81 -26
  237. package/src/lib/manifest/category.ts +63 -14
  238. package/src/lib/manifest/custom-object-field-section.ts +56 -17
  239. package/src/lib/manifest/custom-object-page-layout.ts +201 -66
  240. package/src/lib/manifest/custom-object.ts +128 -37
  241. package/src/lib/manifest/field.ts +265 -75
  242. package/src/lib/manifest/list-view.ts +105 -25
  243. package/src/lib/manifest/manifest-builder.ts +75 -32
  244. package/src/lib/manifest/manifest-function.ts +92 -22
  245. package/src/lib/manifest/rule.ts +95 -29
  246. package/src/lib/manifest/sdui-page.ts +67 -21
  247. package/src/lib/manifest/validation.ts +87 -24
  248. package/src/lib/sdui/actions.ts +58 -0
  249. package/src/lib/sdui/component.ts +122 -0
  250. package/src/lib/sdui/components.ts +308 -0
  251. package/src/lib/sdui/conditions.ts +59 -0
  252. package/src/lib/sdui/directives.ts +42 -0
  253. package/src/lib/sdui/index.ts +365 -0
  254. package/src/lib/sdui/props.ts +32 -0
  255. package/src/lib/sdui/render.ts +58 -0
  256. package/src/lib/sdui/state.ts +60 -0
  257. package/src/resources/company-legal-entity-workers.ts +115 -0
  258. package/src/resources/draft-hires.ts +5 -0
  259. package/src/resources/files.ts +18 -1
  260. package/src/resources/headcount-positions.ts +2 -0
  261. package/src/resources/index.ts +7 -0
  262. package/src/resources/legal-entities.ts +1 -0
  263. package/src/resources/location-factors.ts +2 -0
  264. package/src/resources/shared.ts +1 -0
  265. package/src/resources/workers.ts +2 -0
  266. package/src/version.ts +1 -1
  267. package/version.d.mts +1 -1
  268. package/version.d.ts +1 -1
  269. package/version.js +1 -1
  270. 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
- /** Required. Display name of the view. */
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
- /** Required. Column definitions (live `Field` refs; at least one). */
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
- /** Required. Whether the view is visible to all users. */
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
- /** Identity override. Override the view identifier. @default generateId('view') */
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
- /** Optional. Sort column (live `Field` ref). Required if `sortOrder` is set. */
34
+ /**
35
+ * Field to sort by. Required when `sortOrder` is set.
36
+ *
37
+ * Optional.
38
+ */
26
39
  orderBy?: Field;
27
- /** Conditional. Sort direction — requires `orderBy`. */
40
+ /**
41
+ * Sort direction. One of `'ASC'` | `'DESC'`. Requires `orderBy` to be set.
42
+ *
43
+ * Optional.
44
+ */
28
45
  sortOrder?: SortOrder;
29
- /** Optional. Object scope. @default 'all' */
46
+ /**
47
+ * Record scope for this view. One of `'all'` | `'my_records'`.
48
+ *
49
+ * Optional. @default `'all'`
50
+ */
30
51
  objectScope?: ObjectScope;
31
- /** Optional. Free-form description. @default null */
52
+ /**
53
+ * Human-readable description of this view.
54
+ *
55
+ * Optional. @default null
56
+ */
32
57
  description?: string;
33
- /** Optional. Per-column configuration overrides. @default {} */
58
+ /**
59
+ * Per-column configuration overrides (width, visibility, etc.).
60
+ *
61
+ * Optional. @default `{}`
62
+ */
34
63
  columnConfig?: Record<string, any>;
35
- /** Optional. RQL filter expression. @default null */
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
- /** Build a new view def and auto-register with the CO's scope. */
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
- /** Backend view_id used as this view's identifier. */
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
- /** api_name of the CustomObject this view lives on. */
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
- /** Serialize to the backend `CUSTOM_OBJECT_LIST_VIEW` wire shape. */
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
- * The contents of this file were inserted manually and are not generated by Stainless.
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
- * Local operations only (no HTTP):
19
- * - preview() — render manifest as a JSON string
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 a child component for registration.
31
- * Implemented by `ManifestBuilder` (root) and by nestable parents like
32
- * `CustomObject` and `CustomObjectFieldSection` that forward to the builder.
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
- /** Unique project key for this manifest. */
27
+ /**
28
+ * Unique project key for this manifest (e.g. `'gym_membership_management'`).
29
+ *
30
+ * Required.
31
+ */
41
32
  key: string;
42
- /** Display name (defaults to key if not provided). */
33
+ /**
34
+ * Display name for this manifest.
35
+ *
36
+ * Optional. Defaults to `key` when not provided.
37
+ */
43
38
  name?: string;
44
- /** Optional description. */
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
- /** Build a new manifest; `name` defaults to `key` when unset. */
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
- /** Build the manifest object: metadata + flat component list. */
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
- /** Flat list of all component dicts. */
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
- /** Pretty-printed JSON string. */
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
- /** Required. Function api_name (snake_case identifier). */
8
+ /**
9
+ * Unique identifier for this function (e.g. `'gym_today_schedule_fn'`).
10
+ *
11
+ * Required.
12
+ */
16
13
  apiName: string;
17
- /** Required. Display name shown in the UI. */
14
+ /**
15
+ * Display name shown in the Rippling UI.
16
+ *
17
+ * Required.
18
+ */
18
19
  name: string;
19
- /** Optional. TypeScript handler source; must export `onRipplingEvent`. @default '' */
20
+ /**
21
+ * TypeScript handler source code. Must export an `onRipplingEvent` function.
22
+ *
23
+ * Optional. @default `''`
24
+ */
20
25
  code?: string;
21
- /** Optional. Function description. @default '' */
26
+ /**
27
+ * Human-readable description of what this function does.
28
+ *
29
+ * Optional. @default `''`
30
+ */
22
31
  description?: string;
23
- /** Optional. NPM package dependencies. @default null */
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
- /** Optional. Raw deployment options. Prefer `runtime`. @default null */
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
- /** Optional. Shorthand: sets `deploymentOptions.runtime`. */
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
- /** Optional. Outbound domain allowlist. @default null */
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
- /** Optional. Whether the function runs asynchronously. @default false */
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
- /** Build a new function and auto-register with `scope`; `runtime` is merged into `deploymentOptions` if set. */
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
- /** Backend api_name for this function. */
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
- /** Serialize to the backend `FUNCTION` wire shape; empty fields are omitted. */
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',
@@ -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
- const VALID_TRIGGERS: TriggerType[] = ['CREATE', 'UPDATE', 'CREATE_OR_UPDATE'];
17
-
5
+ /**
6
+ * A single action performed when a {@link Rule} fires.
7
+ */
18
8
  export interface RuleAction {
19
- /** Target field — live `Field` ref. */
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
- * For `SELECT` / `RADIO` targets, the wire payload uses a list (multichoice
24
- * shape); pass a string/one value or an array — both are normalized to an array.
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
- /** Set the target to the result of an RQL formula. */
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
- /** Required. Display name of the flow. */
34
+ /**
35
+ * Display name of this automation rule shown in the UI.
36
+ *
37
+ * Required.
38
+ */
33
39
  flowName: string;
34
- /** Required. When the flow fires. */
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
- /** Identity override. Override the flow identifier. @default generateId('flow') */
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
- /** Optional. RQL formula guard — fires only when truthy. @default null */
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
- /** Conditional. Update-trigger condition type. @default 'MEETS_CONDITION_AFTER_ONLY' */
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
- /** Optional. Internal description. @default null */
67
+ /**
68
+ * Internal description of this rule (for developer reference only).
69
+ *
70
+ * Optional. @default null
71
+ */
43
72
  description?: string;
44
- /** Optional. Actions to run when the flow fires. @default [] */
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
- /** Build a new rule and auto-register with the CO's scope; validates `triggerType`. */
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
- /** Backend flow_id used as this rule's identifier. */
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
- /** api_name of the CustomObject this rule lives on. */
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
- /** Serialize to the backend `CUSTOM_OBJECT_RECORD_TRIGGERED_FLOW` wire shape. */
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',