@rippling/rippling-sdk 0.2.0-alpha.84 → 0.2.0-alpha.86

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 (195) hide show
  1. package/examples/manifest/custom-object-creation-workflow/custom-object-creation-workflow.ts +44 -26
  2. package/examples/manifest/dental-practice-management/dental-practice-management.ts +470 -142
  3. package/examples/manifest/dental-practice-management/functions/chair-schedule.ts +23 -13
  4. package/examples/manifest/dental-practice-management/functions/complete-visit.ts +55 -32
  5. package/examples/manifest/dental-practice-management/functions/operatory-list.ts +23 -13
  6. package/examples/manifest/dental-practice-management/functions/patient-list.ts +23 -13
  7. package/examples/manifest/dental-practice-management/functions/treatment-plan-list.ts +23 -13
  8. package/examples/manifest/existing-manifest-mutations/existing-manifest-mutations.ts +23 -68
  9. package/examples/manifest/field-service-dispatch/field-service-dispatch.ts +375 -102
  10. package/examples/manifest/grant-program-management/grant-program-management.ts +419 -125
  11. package/examples/manifest/gym-membership-management/functions/check-in-desk.ts +23 -13
  12. package/examples/manifest/gym-membership-management/functions/member-list.ts +23 -13
  13. package/examples/manifest/gym-membership-management/functions/today-schedule.ts +23 -13
  14. package/examples/manifest/gym-membership-management/functions/trainer-list.ts +23 -13
  15. package/examples/manifest/gym-membership-management/gym-membership-management.ts +442 -92
  16. package/examples/manifest/procurement-approval-hub/procurement-approval-hub.ts +408 -122
  17. package/examples/manifest/simple-todo-app/functions/mark-done.ts +12 -16
  18. package/examples/manifest/simple-todo-app/functions/todo-list.ts +23 -13
  19. package/examples/manifest/simple-todo-app/simple-todo-app.ts +109 -40
  20. package/examples/manifest/todo-app-without-object-list-view/functions/todo-page.ts +193 -166
  21. package/examples/manifest/todo-app-without-object-list-view/todo-app-without-object-list-view.ts +47 -24
  22. package/package.json +13 -7
  23. package/resources/custom-objects/fields.d.mts +1 -40
  24. package/resources/custom-objects/fields.d.mts.map +1 -1
  25. package/resources/custom-objects/fields.d.ts +1 -40
  26. package/resources/custom-objects/fields.d.ts.map +1 -1
  27. package/resources/levels.d.mts +25 -4
  28. package/resources/levels.d.mts.map +1 -1
  29. package/resources/levels.d.ts +25 -4
  30. package/resources/levels.d.ts.map +1 -1
  31. package/src/resources/custom-objects/fields.ts +1 -46
  32. package/src/resources/levels.ts +28 -4
  33. package/src/tsconfig.json +1 -1
  34. package/src/version.ts +1 -1
  35. package/version.d.mts +1 -1
  36. package/version.d.ts +1 -1
  37. package/version.js +1 -1
  38. package/version.mjs +1 -1
  39. package/core/platform/manifest/custom-objects/action.d.mts +0 -58
  40. package/core/platform/manifest/custom-objects/action.d.mts.map +0 -1
  41. package/core/platform/manifest/custom-objects/action.d.ts +0 -58
  42. package/core/platform/manifest/custom-objects/action.d.ts.map +0 -1
  43. package/core/platform/manifest/custom-objects/action.js +0 -44
  44. package/core/platform/manifest/custom-objects/action.js.map +0 -1
  45. package/core/platform/manifest/custom-objects/action.mjs +0 -40
  46. package/core/platform/manifest/custom-objects/action.mjs.map +0 -1
  47. package/core/platform/manifest/custom-objects/conditions.d.mts +0 -240
  48. package/core/platform/manifest/custom-objects/conditions.d.mts.map +0 -1
  49. package/core/platform/manifest/custom-objects/conditions.d.ts +0 -240
  50. package/core/platform/manifest/custom-objects/conditions.d.ts.map +0 -1
  51. package/core/platform/manifest/custom-objects/conditions.js +0 -326
  52. package/core/platform/manifest/custom-objects/conditions.js.map +0 -1
  53. package/core/platform/manifest/custom-objects/conditions.mjs +0 -321
  54. package/core/platform/manifest/custom-objects/conditions.mjs.map +0 -1
  55. package/core/platform/manifest/custom-objects/existing.d.mts +0 -87
  56. package/core/platform/manifest/custom-objects/existing.d.mts.map +0 -1
  57. package/core/platform/manifest/custom-objects/existing.d.ts +0 -87
  58. package/core/platform/manifest/custom-objects/existing.d.ts.map +0 -1
  59. package/core/platform/manifest/custom-objects/existing.js +0 -113
  60. package/core/platform/manifest/custom-objects/existing.js.map +0 -1
  61. package/core/platform/manifest/custom-objects/existing.mjs +0 -109
  62. package/core/platform/manifest/custom-objects/existing.mjs.map +0 -1
  63. package/core/platform/manifest/custom-objects/field-resolution.d.mts +0 -48
  64. package/core/platform/manifest/custom-objects/field-resolution.d.mts.map +0 -1
  65. package/core/platform/manifest/custom-objects/field-resolution.d.ts +0 -48
  66. package/core/platform/manifest/custom-objects/field-resolution.d.ts.map +0 -1
  67. package/core/platform/manifest/custom-objects/field-resolution.js +0 -61
  68. package/core/platform/manifest/custom-objects/field-resolution.js.map +0 -1
  69. package/core/platform/manifest/custom-objects/field-resolution.mjs +0 -58
  70. package/core/platform/manifest/custom-objects/field-resolution.mjs.map +0 -1
  71. package/core/platform/manifest/custom-objects/function-file.d.mts +0 -87
  72. package/core/platform/manifest/custom-objects/function-file.d.mts.map +0 -1
  73. package/core/platform/manifest/custom-objects/function-file.d.ts +0 -87
  74. package/core/platform/manifest/custom-objects/function-file.d.ts.map +0 -1
  75. package/core/platform/manifest/custom-objects/function-file.js +0 -76
  76. package/core/platform/manifest/custom-objects/function-file.js.map +0 -1
  77. package/core/platform/manifest/custom-objects/function-file.mjs +0 -69
  78. package/core/platform/manifest/custom-objects/function-file.mjs.map +0 -1
  79. package/core/platform/manifest/custom-objects/list-view.d.mts +0 -65
  80. package/core/platform/manifest/custom-objects/list-view.d.mts.map +0 -1
  81. package/core/platform/manifest/custom-objects/list-view.d.ts +0 -65
  82. package/core/platform/manifest/custom-objects/list-view.d.ts.map +0 -1
  83. package/core/platform/manifest/custom-objects/list-view.js +0 -33
  84. package/core/platform/manifest/custom-objects/list-view.js.map +0 -1
  85. package/core/platform/manifest/custom-objects/list-view.mjs +0 -30
  86. package/core/platform/manifest/custom-objects/list-view.mjs.map +0 -1
  87. package/core/platform/manifest/custom-objects/object-list-page.d.mts +0 -43
  88. package/core/platform/manifest/custom-objects/object-list-page.d.mts.map +0 -1
  89. package/core/platform/manifest/custom-objects/object-list-page.d.ts +0 -43
  90. package/core/platform/manifest/custom-objects/object-list-page.d.ts.map +0 -1
  91. package/core/platform/manifest/custom-objects/object-list-page.js +0 -54
  92. package/core/platform/manifest/custom-objects/object-list-page.js.map +0 -1
  93. package/core/platform/manifest/custom-objects/object-list-page.mjs +0 -50
  94. package/core/platform/manifest/custom-objects/object-list-page.mjs.map +0 -1
  95. package/core/platform/manifest/custom-objects/page-layout.d.mts +0 -142
  96. package/core/platform/manifest/custom-objects/page-layout.d.mts.map +0 -1
  97. package/core/platform/manifest/custom-objects/page-layout.d.ts +0 -142
  98. package/core/platform/manifest/custom-objects/page-layout.d.ts.map +0 -1
  99. package/core/platform/manifest/custom-objects/page-layout.js +0 -184
  100. package/core/platform/manifest/custom-objects/page-layout.js.map +0 -1
  101. package/core/platform/manifest/custom-objects/page-layout.mjs +0 -180
  102. package/core/platform/manifest/custom-objects/page-layout.mjs.map +0 -1
  103. package/core/platform/manifest/custom-objects/register.d.mts +0 -87
  104. package/core/platform/manifest/custom-objects/register.d.mts.map +0 -1
  105. package/core/platform/manifest/custom-objects/register.d.ts +0 -87
  106. package/core/platform/manifest/custom-objects/register.d.ts.map +0 -1
  107. package/core/platform/manifest/custom-objects/register.js +0 -395
  108. package/core/platform/manifest/custom-objects/register.js.map +0 -1
  109. package/core/platform/manifest/custom-objects/register.mjs +0 -391
  110. package/core/platform/manifest/custom-objects/register.mjs.map +0 -1
  111. package/core/platform/manifest/custom-objects/rule.d.mts +0 -113
  112. package/core/platform/manifest/custom-objects/rule.d.mts.map +0 -1
  113. package/core/platform/manifest/custom-objects/rule.d.ts +0 -113
  114. package/core/platform/manifest/custom-objects/rule.d.ts.map +0 -1
  115. package/core/platform/manifest/custom-objects/rule.js +0 -49
  116. package/core/platform/manifest/custom-objects/rule.js.map +0 -1
  117. package/core/platform/manifest/custom-objects/rule.mjs +0 -45
  118. package/core/platform/manifest/custom-objects/rule.mjs.map +0 -1
  119. package/core/platform/manifest/custom-objects/sdui-page.d.mts +0 -214
  120. package/core/platform/manifest/custom-objects/sdui-page.d.mts.map +0 -1
  121. package/core/platform/manifest/custom-objects/sdui-page.d.ts +0 -214
  122. package/core/platform/manifest/custom-objects/sdui-page.d.ts.map +0 -1
  123. package/core/platform/manifest/custom-objects/sdui-page.js +0 -194
  124. package/core/platform/manifest/custom-objects/sdui-page.js.map +0 -1
  125. package/core/platform/manifest/custom-objects/sdui-page.mjs +0 -182
  126. package/core/platform/manifest/custom-objects/sdui-page.mjs.map +0 -1
  127. package/core/platform/manifest/custom-objects/typed-condition.d.mts +0 -28
  128. package/core/platform/manifest/custom-objects/typed-condition.d.mts.map +0 -1
  129. package/core/platform/manifest/custom-objects/typed-condition.d.ts +0 -28
  130. package/core/platform/manifest/custom-objects/typed-condition.d.ts.map +0 -1
  131. package/core/platform/manifest/custom-objects/typed-condition.js +0 -434
  132. package/core/platform/manifest/custom-objects/typed-condition.js.map +0 -1
  133. package/core/platform/manifest/custom-objects/typed-condition.mjs +0 -431
  134. package/core/platform/manifest/custom-objects/typed-condition.mjs.map +0 -1
  135. package/core/platform/manifest/custom-objects/types.d.mts +0 -29
  136. package/core/platform/manifest/custom-objects/types.d.mts.map +0 -1
  137. package/core/platform/manifest/custom-objects/types.d.ts +0 -29
  138. package/core/platform/manifest/custom-objects/types.d.ts.map +0 -1
  139. package/core/platform/manifest/custom-objects/types.js +0 -3
  140. package/core/platform/manifest/custom-objects/types.js.map +0 -1
  141. package/core/platform/manifest/custom-objects/types.mjs +0 -2
  142. package/core/platform/manifest/custom-objects/types.mjs.map +0 -1
  143. package/core/platform/manifest/custom-objects/validation.d.mts +0 -44
  144. package/core/platform/manifest/custom-objects/validation.d.mts.map +0 -1
  145. package/core/platform/manifest/custom-objects/validation.d.ts +0 -44
  146. package/core/platform/manifest/custom-objects/validation.d.ts.map +0 -1
  147. package/core/platform/manifest/custom-objects/validation.js +0 -30
  148. package/core/platform/manifest/custom-objects/validation.js.map +0 -1
  149. package/core/platform/manifest/custom-objects/validation.mjs +0 -27
  150. package/core/platform/manifest/custom-objects/validation.mjs.map +0 -1
  151. package/core/platform/manifest/custom-objects/workflow.d.mts +0 -47
  152. package/core/platform/manifest/custom-objects/workflow.d.mts.map +0 -1
  153. package/core/platform/manifest/custom-objects/workflow.d.ts +0 -47
  154. package/core/platform/manifest/custom-objects/workflow.d.ts.map +0 -1
  155. package/core/platform/manifest/custom-objects/workflow.js +0 -38
  156. package/core/platform/manifest/custom-objects/workflow.js.map +0 -1
  157. package/core/platform/manifest/custom-objects/workflow.mjs +0 -34
  158. package/core/platform/manifest/custom-objects/workflow.mjs.map +0 -1
  159. package/core/platform/manifest/custom-objects.d.mts +0 -85
  160. package/core/platform/manifest/custom-objects.d.mts.map +0 -1
  161. package/core/platform/manifest/custom-objects.d.ts +0 -85
  162. package/core/platform/manifest/custom-objects.d.ts.map +0 -1
  163. package/core/platform/manifest/custom-objects.js +0 -84
  164. package/core/platform/manifest/custom-objects.js.map +0 -1
  165. package/core/platform/manifest/custom-objects.mjs +0 -55
  166. package/core/platform/manifest/custom-objects.mjs.map +0 -1
  167. package/examples/manifest/custom-object-creation-workflow/functions/intake-request-created.ts +0 -20
  168. package/examples/manifest/custom-object-creation-workflow/schema.ts +0 -29
  169. package/examples/manifest/dental-practice-management/schema.ts +0 -298
  170. package/examples/manifest/field-service-dispatch/schema.ts +0 -248
  171. package/examples/manifest/grant-program-management/schema.ts +0 -269
  172. package/examples/manifest/gym-membership-management/schema.ts +0 -266
  173. package/examples/manifest/procurement-approval-hub/functions/route-purchase-request.ts +0 -20
  174. package/examples/manifest/procurement-approval-hub/schema.ts +0 -256
  175. package/examples/manifest/simple-todo-app/schema.ts +0 -60
  176. package/examples/manifest/todo-app-without-object-list-view/schema.ts +0 -28
  177. package/src/core/platform/README.md +0 -20
  178. package/src/core/platform/manifest/README.md +0 -26
  179. package/src/core/platform/manifest/custom-objects/action.ts +0 -87
  180. package/src/core/platform/manifest/custom-objects/conditions.ts +0 -762
  181. package/src/core/platform/manifest/custom-objects/existing.ts +0 -221
  182. package/src/core/platform/manifest/custom-objects/field-resolution.ts +0 -116
  183. package/src/core/platform/manifest/custom-objects/function-file.ts +0 -149
  184. package/src/core/platform/manifest/custom-objects/list-view.ts +0 -95
  185. package/src/core/platform/manifest/custom-objects/object-list-page.ts +0 -87
  186. package/src/core/platform/manifest/custom-objects/page-layout.ts +0 -380
  187. package/src/core/platform/manifest/custom-objects/register.ts +0 -555
  188. package/src/core/platform/manifest/custom-objects/rule.ts +0 -192
  189. package/src/core/platform/manifest/custom-objects/sdui-page.ts +0 -515
  190. package/src/core/platform/manifest/custom-objects/typed-condition.ts +0 -617
  191. package/src/core/platform/manifest/custom-objects/types.ts +0 -92
  192. package/src/core/platform/manifest/custom-objects/validation.ts +0 -70
  193. package/src/core/platform/manifest/custom-objects/workflow.ts +0 -71
  194. package/src/core/platform/manifest/custom-objects.ts +0 -203
  195. package/src/pebble-sdui-web-custom-apps-shim.d.ts +0 -3
@@ -12,23 +12,26 @@
12
12
  * > examples/manifest/field-service-dispatch/manifest.json
13
13
  */
14
14
 
15
- import { toCustomCategoryApiName } from '@rippling/rippling-sdk/core/platform/custom-objects';
16
15
  import {
17
- defineBasicTypedPageLayout,
18
- defineTypedListView,
19
- defineTypedRule,
20
- defineTypedValidation,
21
- registerManifestCustomObjects,
22
- } from '@rippling/rippling-sdk/core/platform/manifest/custom-objects';
23
- import { Category, ManifestBuilder, SummaryField } from '@rippling/rippling-sdk/lib/manifest';
24
- import {
25
- assetDefinition,
26
- FIELD_SERVICE_CATEGORY,
27
- partUsageDefinition,
28
- siteDefinition,
29
- taskDefinition,
30
- workOrderDefinition,
31
- } from './schema';
16
+ Category,
17
+ CustomObject,
18
+ CustomObjectFieldSection,
19
+ CustomObjectPageLayout,
20
+ DateField,
21
+ DatetimeField,
22
+ FormulaField,
23
+ ListViewDef,
24
+ LongTextField,
25
+ LookupField,
26
+ ManifestBuilder,
27
+ NumberField,
28
+ ParentChildField,
29
+ Rule,
30
+ RadioField,
31
+ SummaryField,
32
+ TextField,
33
+ Validation,
34
+ } from '@rippling/rippling-sdk/lib/manifest';
32
35
 
33
36
  const manifest = new ManifestBuilder({
34
37
  key: 'field_service_dispatch',
@@ -37,221 +40,491 @@ const manifest = new ManifestBuilder({
37
40
  });
38
41
 
39
42
  const category = new Category(manifest, {
40
- apiName: toCustomCategoryApiName(FIELD_SERVICE_CATEGORY),
43
+ apiName: 'field_service__c',
41
44
  name: 'Field service',
42
45
  description: 'Service operations and dispatch records',
43
46
  });
44
47
 
45
- const [site, asset, workOrder, task, partUsage] = registerManifestCustomObjects(manifest, {
48
+ const siteObj = new CustomObject(manifest, {
49
+ apiName: 'fs_customer_site__c',
50
+ name: 'Customer site',
51
+ pluralLabel: 'Customer sites',
52
+ category,
53
+ description: 'Customer location with service tier and access notes',
54
+ });
55
+
56
+ const siteSection = new CustomObjectFieldSection(siteObj, {
57
+ name: 'Site',
58
+ sectionId: 'sec_fs_site',
59
+ });
60
+
61
+ const siteAccountField = new TextField(siteObj, {
62
+ apiName: 'account_name__c',
63
+ displayName: 'Account name',
64
+ description: 'Customer account or property group',
65
+ required: true,
66
+ maxLength: 160,
67
+ section: siteSection,
68
+ });
69
+
70
+ const siteAddressField = new LongTextField(siteObj, {
71
+ apiName: 'service_address__c',
72
+ displayName: 'Service address',
73
+ description: 'Address, gate code, and arrival instructions',
74
+ maxLength: 3000,
75
+ section: siteSection,
76
+ });
77
+
78
+ const siteTierField = new RadioField(siteObj, {
79
+ apiName: 'service_tier__c',
80
+ displayName: 'Service tier',
81
+ description: 'SLA tier for dispatch prioritization',
82
+ options: ['Standard', 'Premium', 'Critical 24x7'],
83
+ required: true,
84
+ section: siteSection,
85
+ });
86
+
87
+ const assetObj = new CustomObject(manifest, {
88
+ apiName: 'fs_asset__c',
89
+ name: 'Asset',
90
+ pluralLabel: 'Assets',
46
91
  category,
47
- definitions: [
48
- siteDefinition,
49
- assetDefinition,
50
- workOrderDefinition,
51
- taskDefinition,
52
- partUsageDefinition,
53
- ] as const,
92
+ description: 'Installed equipment maintained at a customer site',
93
+ });
94
+
95
+ const assetSection = new CustomObjectFieldSection(assetObj, {
96
+ name: 'Asset',
97
+ sectionId: 'sec_fs_asset',
98
+ });
99
+
100
+ const assetSiteRef = new ParentChildField(assetObj, {
101
+ apiName: 'customer_site_ref__c',
102
+ displayName: 'Customer site',
103
+ target: siteObj,
104
+ relatedDataLabel: 'Assets',
105
+ parentChildType: 'PRIMARY',
106
+ enableParentOwnerInheritance: false,
107
+ description: 'Site where this asset is installed',
108
+ section: assetSection,
109
+ });
110
+
111
+ const assetSerialField = new TextField(assetObj, {
112
+ apiName: 'serial_number__c',
113
+ displayName: 'Serial number',
114
+ description: 'Manufacturer serial number',
115
+ maxLength: 80,
116
+ section: assetSection,
117
+ });
118
+
119
+ const assetTypeField = new RadioField(assetObj, {
120
+ apiName: 'asset_type__c',
121
+ displayName: 'Asset type',
122
+ description: 'Equipment category',
123
+ options: ['HVAC', 'Generator', 'Security', 'Network', 'Kitchen equipment', 'Other'],
124
+ required: true,
125
+ section: assetSection,
126
+ });
127
+
128
+ const assetWarrantyEndField = new DateField(assetObj, {
129
+ apiName: 'warranty_end__c',
130
+ displayName: 'Warranty end',
131
+ description: 'Warranty expiration date',
132
+ section: assetSection,
133
+ });
134
+
135
+ const workOrderObj = new CustomObject(manifest, {
136
+ apiName: 'fs_work_order__c',
137
+ name: 'Work order',
138
+ pluralLabel: 'Work orders',
139
+ category,
140
+ description: 'Dispatch job with schedule, priority, and status',
141
+ });
142
+
143
+ const workOrderSection = new CustomObjectFieldSection(workOrderObj, {
144
+ name: 'Work order',
145
+ sectionId: 'sec_fs_work_order',
146
+ });
147
+
148
+ const workOrderSiteRef = new ParentChildField(workOrderObj, {
149
+ apiName: 'customer_site_ref__c',
150
+ displayName: 'Customer site',
151
+ target: siteObj,
152
+ relatedDataLabel: 'Work orders',
153
+ parentChildType: 'PRIMARY',
154
+ enableParentOwnerInheritance: false,
155
+ description: 'Site receiving service',
156
+ section: workOrderSection,
157
+ });
158
+
159
+ const workOrderAssetRef = new LookupField(workOrderObj, {
160
+ apiName: 'asset_ref__c',
161
+ displayName: 'Asset',
162
+ target: assetObj,
163
+ relatedDataLabel: 'Work orders',
164
+ description: 'Optional installed asset being serviced',
165
+ section: workOrderSection,
166
+ });
167
+
168
+ const workOrderPriorityField = new RadioField(workOrderObj, {
169
+ apiName: 'priority__c',
170
+ displayName: 'Priority',
171
+ description: 'Dispatch priority',
172
+ options: ['Low', 'Normal', 'High', 'Emergency'],
173
+ required: true,
174
+ section: workOrderSection,
175
+ });
176
+
177
+ const workOrderStatusField = new RadioField(workOrderObj, {
178
+ apiName: 'status__c',
179
+ displayName: 'Status',
180
+ description: 'Current dispatch status',
181
+ options: ['New', 'Scheduled', 'In progress', 'Blocked', 'Complete', 'Cancelled'],
182
+ required: true,
183
+ section: workOrderSection,
184
+ });
185
+
186
+ const workOrderScheduledStartField = new DatetimeField(workOrderObj, {
187
+ apiName: 'scheduled_start__c',
188
+ displayName: 'Scheduled start',
189
+ description: 'Planned arrival window start',
190
+ section: workOrderSection,
191
+ });
192
+
193
+ const workOrderScheduledEndField = new DatetimeField(workOrderObj, {
194
+ apiName: 'scheduled_end__c',
195
+ displayName: 'Scheduled end',
196
+ description: 'Planned arrival window end',
197
+ section: workOrderSection,
54
198
  });
55
199
 
56
- const assetCountOnSite = new SummaryField(site.object, {
200
+ const workOrderSummaryField = new LongTextField(workOrderObj, {
201
+ apiName: 'problem_summary__c',
202
+ displayName: 'Problem summary',
203
+ description: 'Customer-reported issue and triage notes',
204
+ maxLength: 6000,
205
+ section: workOrderSection,
206
+ });
207
+
208
+ const taskObj = new CustomObject(manifest, {
209
+ apiName: 'fs_task__c',
210
+ name: 'Task',
211
+ pluralLabel: 'Tasks',
212
+ category,
213
+ description: 'Work order task with labor estimate and completion state',
214
+ });
215
+
216
+ const taskSection = new CustomObjectFieldSection(taskObj, {
217
+ name: 'Task',
218
+ sectionId: 'sec_fs_task',
219
+ });
220
+
221
+ const taskWorkOrderRef = new ParentChildField(taskObj, {
222
+ apiName: 'work_order_ref__c',
223
+ displayName: 'Work order',
224
+ target: workOrderObj,
225
+ relatedDataLabel: 'Tasks',
226
+ parentChildType: 'PRIMARY',
227
+ enableParentOwnerInheritance: true,
228
+ description: 'Work order this task belongs to',
229
+ section: taskSection,
230
+ });
231
+
232
+ const taskTypeField = new RadioField(taskObj, {
233
+ apiName: 'task_type__c',
234
+ displayName: 'Task type',
235
+ description: 'Type of work required',
236
+ options: ['Inspect', 'Repair', 'Replace', 'Calibrate', 'Clean', 'Customer walkthrough'],
237
+ required: true,
238
+ section: taskSection,
239
+ });
240
+
241
+ const taskStatusField = new RadioField(taskObj, {
242
+ apiName: 'status__c',
243
+ displayName: 'Status',
244
+ description: 'Task status',
245
+ options: ['Open', 'In progress', 'Blocked', 'Done'],
246
+ required: true,
247
+ section: taskSection,
248
+ });
249
+
250
+ const taskEstimatedHoursField = new NumberField(taskObj, {
251
+ apiName: 'estimated_hours__c',
252
+ displayName: 'Estimated hours',
253
+ description: 'Labor estimate for this task',
254
+ decimalPlaces: 2,
255
+ section: taskSection,
256
+ });
257
+
258
+ const taskCompletedAtField = new DatetimeField(taskObj, {
259
+ apiName: 'completed_at__c',
260
+ displayName: 'Completed at',
261
+ description: 'Completion timestamp',
262
+ section: taskSection,
263
+ });
264
+
265
+ const partUsageObj = new CustomObject(manifest, {
266
+ apiName: 'fs_part_usage__c',
267
+ name: 'Part usage',
268
+ pluralLabel: 'Part usage',
269
+ category,
270
+ description: 'Part consumed while completing a task',
271
+ });
272
+
273
+ const partUsageSection = new CustomObjectFieldSection(partUsageObj, {
274
+ name: 'Part usage',
275
+ sectionId: 'sec_fs_part_usage',
276
+ });
277
+
278
+ const partTaskRef = new ParentChildField(partUsageObj, {
279
+ apiName: 'task_ref__c',
280
+ displayName: 'Task',
281
+ target: taskObj,
282
+ relatedDataLabel: 'Parts used',
283
+ parentChildType: 'PRIMARY',
284
+ enableParentOwnerInheritance: true,
285
+ description: 'Task that consumed this part',
286
+ section: partUsageSection,
287
+ });
288
+
289
+ const partSkuField = new TextField(partUsageObj, {
290
+ apiName: 'sku__c',
291
+ displayName: 'SKU',
292
+ description: 'Inventory SKU or part number',
293
+ maxLength: 80,
294
+ required: true,
295
+ section: partUsageSection,
296
+ });
297
+
298
+ const partQuantityField = new NumberField(partUsageObj, {
299
+ apiName: 'quantity__c',
300
+ displayName: 'Quantity',
301
+ description: 'Quantity consumed',
302
+ decimalPlaces: 2,
303
+ required: true,
304
+ section: partUsageSection,
305
+ });
306
+
307
+ const partCostCentsField = new NumberField(partUsageObj, {
308
+ apiName: 'unit_cost_cents__c',
309
+ displayName: 'Unit cost (cents)',
310
+ description: 'Unit material cost in cents',
311
+ decimalPlaces: 0,
312
+ section: partUsageSection,
313
+ });
314
+
315
+ const assetCountOnSite = new SummaryField(siteObj, {
57
316
  apiName: 'asset_count__c',
58
317
  displayName: 'Assets',
59
- aggregates: asset.fields.serial_number,
318
+ aggregates: assetSerialField,
60
319
  using: 'COUNT',
61
- lookup: asset.fields.customer_site_ref,
320
+ lookup: assetSiteRef,
62
321
  description: 'Installed asset count',
63
- section: site.sections.site,
322
+ section: siteSection,
64
323
  });
65
324
 
66
- const workOrderCountOnSite = new SummaryField(site.object, {
325
+ const workOrderCountOnSite = new SummaryField(siteObj, {
67
326
  apiName: 'work_order_count__c',
68
327
  displayName: 'Work orders',
69
- aggregates: workOrder.fields.status,
328
+ aggregates: workOrderStatusField,
70
329
  using: 'COUNT',
71
- lookup: workOrder.fields.customer_site_ref,
330
+ lookup: workOrderSiteRef,
72
331
  description: 'Work orders associated with this site',
73
- section: site.sections.site,
332
+ section: siteSection,
74
333
  });
75
334
 
76
- const taskCountOnWorkOrder = new SummaryField(workOrder.object, {
335
+ const taskCountOnWorkOrder = new SummaryField(workOrderObj, {
77
336
  apiName: 'task_count__c',
78
337
  displayName: 'Tasks',
79
- aggregates: task.fields.task_type,
338
+ aggregates: taskTypeField,
80
339
  using: 'COUNT',
81
- lookup: task.fields.work_order_ref,
340
+ lookup: taskWorkOrderRef,
82
341
  description: 'Task count on this work order',
83
- section: workOrder.sections.work_order,
342
+ section: workOrderSection,
84
343
  });
85
344
 
86
- const estimatedHoursOnWorkOrder = new SummaryField(workOrder.object, {
345
+ const estimatedHoursOnWorkOrder = new SummaryField(workOrderObj, {
87
346
  apiName: 'estimated_hours_total__c',
88
347
  displayName: 'Estimated hours total',
89
- aggregates: task.fields.estimated_hours,
348
+ aggregates: taskEstimatedHoursField,
90
349
  using: 'SUM',
91
- lookup: task.fields.work_order_ref,
350
+ lookup: taskWorkOrderRef,
92
351
  description: 'Total estimated labor hours',
93
- section: workOrder.sections.work_order,
352
+ section: workOrderSection,
94
353
  });
95
354
 
96
- const partsCountOnTask = new SummaryField(task.object, {
355
+ const partsCountOnTask = new SummaryField(taskObj, {
97
356
  apiName: 'parts_count__c',
98
357
  displayName: 'Parts lines',
99
- aggregates: partUsage.fields.sku,
358
+ aggregates: partSkuField,
100
359
  using: 'COUNT',
101
- lookup: partUsage.fields.task_ref,
360
+ lookup: partTaskRef,
102
361
  description: 'Number of part usage lines',
103
- section: task.sections.task,
362
+ section: taskSection,
363
+ });
364
+
365
+ const workOrderLabelField = new FormulaField(workOrderObj, {
366
+ apiName: 'dispatch_label__c',
367
+ displayName: 'Dispatch label',
368
+ description: 'Compact board label',
369
+ fieldType: 'TEXT',
370
+ maxLength: 240,
371
+ formula: "CONCATENATE(priority__c, ' - ', status__c)",
372
+ section: workOrderSection,
104
373
  });
105
374
 
106
- // ── Validations & defaults ────────────────────────────────────────────────
107
- defineTypedValidation(workOrder, {
375
+ new Validation(workOrderObj, {
108
376
  ruleId: 'fs_work_order_window_valid',
109
377
  displayName: 'Scheduled end must be after start',
110
- whenInvalid: (c) => c.lte(c.fields.scheduled_end, c.fields.scheduled_start),
378
+ rqlFormula: '(scheduled_end__c <= scheduled_start__c)',
111
379
  errorMessage: 'Scheduled end must be after scheduled start.',
112
380
  ruleDescription: 'Prevents inverted dispatch windows',
113
381
  state: 'ACTIVE',
114
382
  level: 'FIELD',
115
- field: 'scheduled_end',
383
+ fieldRef: workOrderScheduledEndField,
116
384
  });
117
385
 
118
- defineTypedValidation(partUsage, {
386
+ new Validation(partUsageObj, {
119
387
  ruleId: 'fs_part_quantity_positive',
120
388
  displayName: 'Quantity must be positive',
121
- whenInvalid: (c) => c.lte(c.fields.quantity, 0),
389
+ rqlFormula: '(quantity__c <= 0)',
122
390
  errorMessage: 'Quantity must be greater than zero.',
123
391
  ruleDescription: 'Blocks zero or negative parts usage',
124
392
  state: 'ACTIVE',
125
393
  level: 'FIELD',
126
- field: 'quantity',
394
+ fieldRef: partQuantityField,
127
395
  });
128
396
 
129
- defineTypedRule(workOrder, {
397
+ new Rule(workOrderObj, {
130
398
  flowId: 'fs_default_work_order_status',
131
399
  flowName: 'Default work order status',
132
400
  triggerType: 'CREATE',
133
401
  description: 'New work orders start in New status',
134
- actions: (rules) => [rules.setField('status').toValue('New')],
402
+ actions: [{ targetField: workOrderStatusField, fixedValue: 'New' }],
135
403
  });
136
404
 
137
- defineTypedRule(task, {
405
+ new Rule(taskObj, {
138
406
  flowId: 'fs_default_task_status',
139
407
  flowName: 'Default task status',
140
408
  triggerType: 'CREATE',
141
409
  description: 'New tasks start Open',
142
- actions: (rules) => [rules.setField('status').toValue('Open')],
410
+ actions: [{ targetField: taskStatusField, fixedValue: 'Open' }],
143
411
  });
144
412
 
145
- // ── List views ─────────────────────────────────────────────────────────────
146
- defineTypedListView(site, {
413
+ new ListViewDef(siteObj, {
147
414
  viewId: 'view_fs_customer_sites',
148
415
  name: 'Customer sites',
149
416
  description: 'Sites with service tier, assets, and work order volume',
150
- fields: ['name', 'account_name', 'service_tier', assetCountOnSite, workOrderCountOnSite],
417
+ fields: ['name', siteAccountField, siteTierField, assetCountOnSite, workOrderCountOnSite],
151
418
  orderBy: 'name',
152
419
  sortOrder: 'ASC',
153
420
  isPublic: true,
154
421
  objectScope: 'all',
155
422
  });
156
423
 
157
- defineTypedListView(asset, {
424
+ new ListViewDef(assetObj, {
158
425
  viewId: 'view_fs_assets',
159
426
  name: 'Assets',
160
427
  description: 'Installed equipment by site',
161
- fields: ['name', 'customer_site_ref', 'asset_type', 'serial_number', 'warranty_end'],
428
+ fields: ['name', assetSiteRef, assetTypeField, assetSerialField, assetWarrantyEndField],
162
429
  orderBy: 'name',
163
430
  sortOrder: 'ASC',
164
431
  isPublic: true,
165
432
  objectScope: 'all',
166
433
  });
167
434
 
168
- defineTypedListView(workOrder, {
435
+ new ListViewDef(workOrderObj, {
169
436
  viewId: 'view_fs_work_orders',
170
437
  name: 'Work orders',
171
438
  description: 'Dispatch board with schedule and rollups',
172
439
  fields: [
173
440
  'name',
174
- 'customer_site_ref',
175
- 'asset_ref',
176
- 'priority',
177
- 'status',
178
- 'scheduled_start',
441
+ workOrderSiteRef,
442
+ workOrderAssetRef,
443
+ workOrderPriorityField,
444
+ workOrderStatusField,
445
+ workOrderScheduledStartField,
179
446
  taskCountOnWorkOrder,
180
447
  estimatedHoursOnWorkOrder,
181
- 'dispatch_label',
448
+ workOrderLabelField,
182
449
  ],
183
- orderBy: 'scheduled_start',
450
+ orderBy: workOrderScheduledStartField,
184
451
  sortOrder: 'ASC',
185
452
  isPublic: true,
186
453
  objectScope: 'all',
187
454
  });
188
455
 
189
- defineTypedListView(task, {
456
+ new ListViewDef(taskObj, {
190
457
  viewId: 'view_fs_tasks',
191
458
  name: 'Tasks',
192
459
  description: 'Task checklist with estimates and parts lines',
193
- fields: ['name', 'work_order_ref', 'task_type', 'status', 'estimated_hours', partsCountOnTask],
194
- orderBy: 'work_order_ref',
460
+ fields: [
461
+ 'name',
462
+ taskWorkOrderRef,
463
+ taskTypeField,
464
+ taskStatusField,
465
+ taskEstimatedHoursField,
466
+ partsCountOnTask,
467
+ ],
468
+ orderBy: taskWorkOrderRef,
195
469
  sortOrder: 'ASC',
196
470
  isPublic: true,
197
471
  objectScope: 'all',
198
472
  });
199
473
 
200
- defineTypedListView(partUsage, {
474
+ new ListViewDef(partUsageObj, {
201
475
  viewId: 'view_fs_part_usage',
202
476
  name: 'Part usage',
203
477
  description: 'Parts consumed by service tasks',
204
- fields: ['name', 'task_ref', 'sku', 'quantity', 'unit_cost_cents'],
205
- orderBy: 'task_ref',
478
+ fields: ['name', partTaskRef, partSkuField, partQuantityField, partCostCentsField],
479
+ orderBy: partTaskRef,
206
480
  sortOrder: 'ASC',
207
481
  isPublic: true,
208
482
  objectScope: 'all',
209
483
  });
210
484
 
211
- // ── Page layouts ───────────────────────────────────────────────────────────
212
- defineBasicTypedPageLayout(site, {
213
- section: site.sections.site,
214
- fields: ['name', 'account_name', 'service_address', 'service_tier', assetCountOnSite, workOrderCountOnSite],
485
+ CustomObjectPageLayout.basic(siteObj, {
486
+ section: siteSection,
487
+ fields: ['name', siteAccountField, siteAddressField, siteTierField, assetCountOnSite, workOrderCountOnSite],
215
488
  });
216
489
 
217
- defineBasicTypedPageLayout(asset, {
218
- section: asset.sections.asset,
219
- fields: ['name', 'customer_site_ref', 'serial_number', 'asset_type', 'warranty_end'],
490
+ CustomObjectPageLayout.basic(assetObj, {
491
+ section: assetSection,
492
+ fields: ['name', assetSiteRef, assetSerialField, assetTypeField, assetWarrantyEndField],
220
493
  });
221
494
 
222
- defineBasicTypedPageLayout(workOrder, {
223
- section: workOrder.sections.work_order,
495
+ CustomObjectPageLayout.basic(workOrderObj, {
496
+ section: workOrderSection,
224
497
  fields: [
225
498
  'name',
226
- 'customer_site_ref',
227
- 'asset_ref',
228
- 'priority',
229
- 'status',
230
- 'scheduled_start',
231
- 'scheduled_end',
232
- 'problem_summary',
499
+ workOrderSiteRef,
500
+ workOrderAssetRef,
501
+ workOrderPriorityField,
502
+ workOrderStatusField,
503
+ workOrderScheduledStartField,
504
+ workOrderScheduledEndField,
505
+ workOrderSummaryField,
233
506
  taskCountOnWorkOrder,
234
507
  estimatedHoursOnWorkOrder,
235
- 'dispatch_label',
508
+ workOrderLabelField,
236
509
  ],
237
510
  });
238
511
 
239
- defineBasicTypedPageLayout(task, {
240
- section: task.sections.task,
512
+ CustomObjectPageLayout.basic(taskObj, {
513
+ section: taskSection,
241
514
  fields: [
242
515
  'name',
243
- 'work_order_ref',
244
- 'task_type',
245
- 'status',
246
- 'estimated_hours',
247
- 'completed_at',
516
+ taskWorkOrderRef,
517
+ taskTypeField,
518
+ taskStatusField,
519
+ taskEstimatedHoursField,
520
+ taskCompletedAtField,
248
521
  partsCountOnTask,
249
522
  ],
250
523
  });
251
524
 
252
- defineBasicTypedPageLayout(partUsage, {
253
- section: partUsage.sections.part_usage,
254
- fields: ['name', 'task_ref', 'sku', 'quantity', 'unit_cost_cents'],
525
+ CustomObjectPageLayout.basic(partUsageObj, {
526
+ section: partUsageSection,
527
+ fields: ['name', partTaskRef, partSkuField, partQuantityField, partCostCentsField],
255
528
  });
256
529
 
257
530
  console.log(manifest.preview());