@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
@@ -1,6 +1,5 @@
1
1
  /*
2
- * Grant Program Management - programs, grants, applicants, applications,
3
- * milestones, and disbursements.
2
+ * Grant Program Management - programs, grants, applicants, applications, milestones, and disbursements.
4
3
  *
5
4
  * gpm_program__c <- funding program and budget
6
5
  * gpm_grant__c <- grant cycle under a program
@@ -14,24 +13,26 @@
14
13
  * > examples/manifest/grant-program-management/manifest.json
15
14
  */
16
15
 
17
- import { toCustomCategoryApiName } from '@rippling/rippling-sdk/core/platform/custom-objects';
18
16
  import {
19
- defineBasicTypedPageLayout,
20
- defineTypedListView,
21
- defineTypedRule,
22
- defineTypedValidation,
23
- registerManifestCustomObjects,
24
- } from '@rippling/rippling-sdk/core/platform/manifest/custom-objects';
25
- import { Category, ManifestBuilder, SummaryField } from '@rippling/rippling-sdk/lib/manifest';
26
- import {
27
- applicantDefinition,
28
- applicationDefinition,
29
- disbursementDefinition,
30
- grantDefinition,
31
- GRANTS_CATEGORY,
32
- milestoneDefinition,
33
- programDefinition,
34
- } from './schema';
17
+ Category,
18
+ CustomObject,
19
+ CustomObjectFieldSection,
20
+ CustomObjectPageLayout,
21
+ DateField,
22
+ EmailField,
23
+ FormulaField,
24
+ ListViewDef,
25
+ LongTextField,
26
+ LookupField,
27
+ ManifestBuilder,
28
+ NumberField,
29
+ ParentChildField,
30
+ Rule,
31
+ RadioField,
32
+ SummaryField,
33
+ TextField,
34
+ Validation,
35
+ } from '@rippling/rippling-sdk/lib/manifest';
35
36
 
36
37
  const manifest = new ManifestBuilder({
37
38
  key: 'grant_program_management',
@@ -40,261 +41,554 @@ const manifest = new ManifestBuilder({
40
41
  });
41
42
 
42
43
  const category = new Category(manifest, {
43
- apiName: toCustomCategoryApiName(GRANTS_CATEGORY),
44
+ apiName: 'grants__c',
44
45
  name: 'Grants',
45
46
  description: 'Grant program and funding records',
46
47
  });
47
48
 
48
- const [program, grant, applicant, application, milestone, disbursement] = registerManifestCustomObjects(
49
- manifest,
50
- {
51
- category,
52
- definitions: [
53
- programDefinition,
54
- grantDefinition,
55
- applicantDefinition,
56
- applicationDefinition,
57
- milestoneDefinition,
58
- disbursementDefinition,
59
- ] as const,
60
- },
61
- );
62
-
63
- const grantCountOnProgram = new SummaryField(program.object, {
49
+ const programObj = new CustomObject(manifest, {
50
+ apiName: 'gpm_program__c',
51
+ name: 'Program',
52
+ pluralLabel: 'Programs',
53
+ category,
54
+ description: 'Funding program with annual budget and focus area',
55
+ });
56
+
57
+ const programSection = new CustomObjectFieldSection(programObj, {
58
+ name: 'Program',
59
+ sectionId: 'sec_gpm_program',
60
+ });
61
+
62
+ const programFocusField = new RadioField(programObj, {
63
+ apiName: 'focus_area__c',
64
+ displayName: 'Focus area',
65
+ description: 'Program focus area',
66
+ options: ['Education', 'Workforce', 'Climate', 'Health', 'Housing', 'Community safety'],
67
+ required: true,
68
+ section: programSection,
69
+ });
70
+
71
+ const programBudgetCentsField = new NumberField(programObj, {
72
+ apiName: 'annual_budget_cents__c',
73
+ displayName: 'Annual budget (cents)',
74
+ description: 'Annual funding budget in cents',
75
+ decimalPlaces: 0,
76
+ section: programSection,
77
+ });
78
+
79
+ const programGuidelinesField = new LongTextField(programObj, {
80
+ apiName: 'guidelines__c',
81
+ displayName: 'Guidelines',
82
+ description: 'Eligibility and operating guidelines',
83
+ maxLength: 8000,
84
+ section: programSection,
85
+ });
86
+
87
+ const grantObj = new CustomObject(manifest, {
88
+ apiName: 'gpm_grant__c',
89
+ name: 'Grant',
90
+ pluralLabel: 'Grants',
91
+ category,
92
+ description: 'Grant cycle under a funding program',
93
+ });
94
+
95
+ const grantSection = new CustomObjectFieldSection(grantObj, {
96
+ name: 'Grant',
97
+ sectionId: 'sec_gpm_grant',
98
+ });
99
+
100
+ const grantProgramRef = new ParentChildField(grantObj, {
101
+ apiName: 'program_ref__c',
102
+ displayName: 'Program',
103
+ target: programObj,
104
+ relatedDataLabel: 'Grants',
105
+ parentChildType: 'PRIMARY',
106
+ enableParentOwnerInheritance: false,
107
+ description: 'Program this grant belongs to',
108
+ section: grantSection,
109
+ });
110
+
111
+ const grantStatusField = new RadioField(grantObj, {
112
+ apiName: 'status__c',
113
+ displayName: 'Status',
114
+ description: 'Grant cycle status',
115
+ options: ['Planning', 'Open', 'Review', 'Awarded', 'Closed'],
116
+ required: true,
117
+ section: grantSection,
118
+ });
119
+
120
+ const grantOpenDateField = new DateField(grantObj, {
121
+ apiName: 'open_date__c',
122
+ displayName: 'Open date',
123
+ description: 'Application open date',
124
+ section: grantSection,
125
+ });
126
+
127
+ const grantCloseDateField = new DateField(grantObj, {
128
+ apiName: 'close_date__c',
129
+ displayName: 'Close date',
130
+ description: 'Application close date',
131
+ section: grantSection,
132
+ });
133
+
134
+ const grantAwardBudgetCentsField = new NumberField(grantObj, {
135
+ apiName: 'award_budget_cents__c',
136
+ displayName: 'Award budget (cents)',
137
+ description: 'Budget allocated to this grant cycle',
138
+ decimalPlaces: 0,
139
+ section: grantSection,
140
+ });
141
+
142
+ const applicantObj = new CustomObject(manifest, {
143
+ apiName: 'gpm_applicant__c',
144
+ name: 'Applicant',
145
+ pluralLabel: 'Applicants',
146
+ category,
147
+ description: 'Applicant organization and contact details',
148
+ });
149
+
150
+ const applicantSection = new CustomObjectFieldSection(applicantObj, {
151
+ name: 'Applicant',
152
+ sectionId: 'sec_gpm_applicant',
153
+ });
154
+
155
+ const applicantLegalNameField = new TextField(applicantObj, {
156
+ apiName: 'legal_name__c',
157
+ displayName: 'Legal name',
158
+ description: 'Applicant organization legal name',
159
+ maxLength: 200,
160
+ required: true,
161
+ section: applicantSection,
162
+ });
163
+
164
+ const applicantTypeField = new RadioField(applicantObj, {
165
+ apiName: 'applicant_type__c',
166
+ displayName: 'Applicant type',
167
+ description: 'Applicant organization type',
168
+ options: ['Nonprofit', 'School', 'Government', 'Small business', 'Community group'],
169
+ required: true,
170
+ section: applicantSection,
171
+ });
172
+
173
+ const applicantEmailField = new EmailField(applicantObj, {
174
+ apiName: 'contact_email__c',
175
+ displayName: 'Contact email',
176
+ description: 'Primary applicant contact email',
177
+ section: applicantSection,
178
+ });
179
+
180
+ const applicationObj = new CustomObject(manifest, {
181
+ apiName: 'gpm_application__c',
182
+ name: 'Application',
183
+ pluralLabel: 'Applications',
184
+ category,
185
+ description: 'Application submitted by an applicant for a grant',
186
+ });
187
+
188
+ const applicationSection = new CustomObjectFieldSection(applicationObj, {
189
+ name: 'Application',
190
+ sectionId: 'sec_gpm_application',
191
+ });
192
+
193
+ const applicationGrantRef = new ParentChildField(applicationObj, {
194
+ apiName: 'grant_ref__c',
195
+ displayName: 'Grant',
196
+ target: grantObj,
197
+ relatedDataLabel: 'Applications',
198
+ parentChildType: 'PRIMARY',
199
+ enableParentOwnerInheritance: false,
200
+ description: 'Grant cycle this application targets',
201
+ section: applicationSection,
202
+ });
203
+
204
+ const applicationApplicantRef = new LookupField(applicationObj, {
205
+ apiName: 'applicant_ref__c',
206
+ displayName: 'Applicant',
207
+ target: applicantObj,
208
+ relatedDataLabel: 'Applications',
209
+ description: 'Applicant submitting this request',
210
+ required: true,
211
+ section: applicationSection,
212
+ });
213
+
214
+ const applicationStatusField = new RadioField(applicationObj, {
215
+ apiName: 'status__c',
216
+ displayName: 'Status',
217
+ description: 'Application review state',
218
+ options: ['Draft', 'Submitted', 'Eligibility review', 'Panel review', 'Awarded', 'Declined'],
219
+ required: true,
220
+ section: applicationSection,
221
+ });
222
+
223
+ const requestedAmountCentsField = new NumberField(applicationObj, {
224
+ apiName: 'requested_amount_cents__c',
225
+ displayName: 'Requested amount (cents)',
226
+ description: 'Requested funding amount in cents',
227
+ decimalPlaces: 0,
228
+ required: true,
229
+ section: applicationSection,
230
+ });
231
+
232
+ const scoreField = new NumberField(applicationObj, {
233
+ apiName: 'review_score__c',
234
+ displayName: 'Review score',
235
+ description: 'Panel score from 0 to 100',
236
+ decimalPlaces: 2,
237
+ section: applicationSection,
238
+ });
239
+
240
+ const proposalSummaryField = new LongTextField(applicationObj, {
241
+ apiName: 'proposal_summary__c',
242
+ displayName: 'Proposal summary',
243
+ description: 'Program plan and impact narrative',
244
+ maxLength: 8000,
245
+ section: applicationSection,
246
+ });
247
+
248
+ const milestoneObj = new CustomObject(manifest, {
249
+ apiName: 'gpm_milestone__c',
250
+ name: 'Milestone',
251
+ pluralLabel: 'Milestones',
252
+ category,
253
+ description: 'Deliverable or report due for an awarded application',
254
+ });
255
+
256
+ const milestoneSection = new CustomObjectFieldSection(milestoneObj, {
257
+ name: 'Milestone',
258
+ sectionId: 'sec_gpm_milestone',
259
+ });
260
+
261
+ const milestoneApplicationRef = new ParentChildField(milestoneObj, {
262
+ apiName: 'application_ref__c',
263
+ displayName: 'Application',
264
+ target: applicationObj,
265
+ relatedDataLabel: 'Milestones',
266
+ parentChildType: 'PRIMARY',
267
+ enableParentOwnerInheritance: true,
268
+ description: 'Application this milestone belongs to',
269
+ section: milestoneSection,
270
+ });
271
+
272
+ const milestoneDueDateField = new DateField(milestoneObj, {
273
+ apiName: 'due_date__c',
274
+ displayName: 'Due date',
275
+ description: 'Milestone due date',
276
+ required: true,
277
+ section: milestoneSection,
278
+ });
279
+
280
+ const milestoneStatusField = new RadioField(milestoneObj, {
281
+ apiName: 'status__c',
282
+ displayName: 'Status',
283
+ description: 'Milestone status',
284
+ options: ['Not started', 'In progress', 'Submitted', 'Accepted', 'Late'],
285
+ required: true,
286
+ section: milestoneSection,
287
+ });
288
+
289
+ const disbursementObj = new CustomObject(manifest, {
290
+ apiName: 'gpm_disbursement__c',
291
+ name: 'Disbursement',
292
+ pluralLabel: 'Disbursements',
293
+ category,
294
+ description: 'Payment tranche tied to an awarded application',
295
+ });
296
+
297
+ const disbursementSection = new CustomObjectFieldSection(disbursementObj, {
298
+ name: 'Disbursement',
299
+ sectionId: 'sec_gpm_disbursement',
300
+ });
301
+
302
+ const disbursementApplicationRef = new ParentChildField(disbursementObj, {
303
+ apiName: 'application_ref__c',
304
+ displayName: 'Application',
305
+ target: applicationObj,
306
+ relatedDataLabel: 'Disbursements',
307
+ parentChildType: 'PRIMARY',
308
+ enableParentOwnerInheritance: true,
309
+ description: 'Application funded by this disbursement',
310
+ section: disbursementSection,
311
+ });
312
+
313
+ const disbursementAmountCentsField = new NumberField(disbursementObj, {
314
+ apiName: 'amount_cents__c',
315
+ displayName: 'Amount (cents)',
316
+ description: 'Disbursement amount in cents',
317
+ decimalPlaces: 0,
318
+ required: true,
319
+ section: disbursementSection,
320
+ });
321
+
322
+ const disbursementStatusField = new RadioField(disbursementObj, {
323
+ apiName: 'status__c',
324
+ displayName: 'Status',
325
+ description: 'Disbursement status',
326
+ options: ['Scheduled', 'Approved', 'Paid', 'Held', 'Cancelled'],
327
+ required: true,
328
+ section: disbursementSection,
329
+ });
330
+
331
+ const disbursementDateField = new DateField(disbursementObj, {
332
+ apiName: 'disbursement_date__c',
333
+ displayName: 'Disbursement date',
334
+ description: 'Scheduled or actual payment date',
335
+ section: disbursementSection,
336
+ });
337
+
338
+ const grantCountOnProgram = new SummaryField(programObj, {
64
339
  apiName: 'grant_count__c',
65
340
  displayName: 'Grants',
66
- aggregates: grant.fields.status,
341
+ aggregates: grantStatusField,
67
342
  using: 'COUNT',
68
- lookup: grant.fields.program_ref,
343
+ lookup: grantProgramRef,
69
344
  description: 'Grant cycles under this program',
70
- section: program.sections.program,
345
+ section: programSection,
71
346
  });
72
347
 
73
- const applicationCountOnGrant = new SummaryField(grant.object, {
348
+ const applicationCountOnGrant = new SummaryField(grantObj, {
74
349
  apiName: 'application_count__c',
75
350
  displayName: 'Applications',
76
- aggregates: application.fields.applicant_ref,
351
+ aggregates: applicationApplicantRef,
77
352
  using: 'COUNT',
78
- lookup: application.fields.grant_ref,
353
+ lookup: applicationGrantRef,
79
354
  description: 'Applications submitted for this grant',
80
- section: grant.sections.grant,
355
+ section: grantSection,
81
356
  });
82
357
 
83
- const requestedAmountOnGrant = new SummaryField(grant.object, {
358
+ const requestedAmountOnGrant = new SummaryField(grantObj, {
84
359
  apiName: 'requested_amount_cents_total__c',
85
360
  displayName: 'Requested amount total (cents)',
86
- aggregates: application.fields.requested_amount_cents,
361
+ aggregates: requestedAmountCentsField,
87
362
  using: 'SUM',
88
- lookup: application.fields.grant_ref,
363
+ lookup: applicationGrantRef,
89
364
  description: 'Total requested funding for this grant',
90
- section: grant.sections.grant,
365
+ section: grantSection,
91
366
  });
92
367
 
93
- const milestoneCountOnApplication = new SummaryField(application.object, {
368
+ const milestoneCountOnApplication = new SummaryField(applicationObj, {
94
369
  apiName: 'milestone_count__c',
95
370
  displayName: 'Milestones',
96
- aggregates: milestone.fields.status,
371
+ aggregates: milestoneStatusField,
97
372
  using: 'COUNT',
98
- lookup: milestone.fields.application_ref,
373
+ lookup: milestoneApplicationRef,
99
374
  description: 'Milestones attached to this application',
100
- section: application.sections.application,
375
+ section: applicationSection,
101
376
  });
102
377
 
103
- const disbursedAmountOnApplication = new SummaryField(application.object, {
378
+ const disbursedAmountOnApplication = new SummaryField(applicationObj, {
104
379
  apiName: 'disbursed_amount_cents__c',
105
380
  displayName: 'Disbursed amount (cents)',
106
- aggregates: disbursement.fields.amount_cents,
381
+ aggregates: disbursementAmountCentsField,
107
382
  using: 'SUM',
108
- lookup: disbursement.fields.application_ref,
383
+ lookup: disbursementApplicationRef,
109
384
  description: 'Total disbursements for this application',
110
- section: application.sections.application,
385
+ section: applicationSection,
111
386
  });
112
387
 
113
- // ── Validations & defaults ────────────────────────────────────────────────
114
- defineTypedValidation(grant, {
388
+ const applicationLabelField = new FormulaField(applicationObj, {
389
+ apiName: 'review_label__c',
390
+ displayName: 'Review label',
391
+ description: 'Review queue label',
392
+ fieldType: 'TEXT',
393
+ maxLength: 240,
394
+ formula: "CONCATENATE(status__c, ' - score ', review_score__c)",
395
+ section: applicationSection,
396
+ });
397
+
398
+ new Validation(grantObj, {
115
399
  ruleId: 'gpm_grant_close_after_open',
116
400
  displayName: 'Close date must be after open date',
117
- whenInvalid: (c) => c.lte(c.fields.close_date, c.fields.open_date),
401
+ rqlFormula: '(close_date__c <= open_date__c)',
118
402
  errorMessage: 'Close date must be after open date.',
119
403
  ruleDescription: 'Prevents inverted application windows',
120
404
  state: 'ACTIVE',
121
405
  level: 'FIELD',
122
- field: 'close_date',
406
+ fieldRef: grantCloseDateField,
123
407
  });
124
408
 
125
- defineTypedValidation(application, {
409
+ new Validation(applicationObj, {
126
410
  ruleId: 'gpm_requested_amount_positive',
127
411
  displayName: 'Requested amount must be positive',
128
- whenInvalid: (c) => c.lte(c.fields.requested_amount_cents, 0),
412
+ rqlFormula: '(requested_amount_cents__c <= 0)',
129
413
  errorMessage: 'Requested amount must be greater than zero.',
130
414
  ruleDescription: 'Blocks zero-value applications',
131
415
  state: 'ACTIVE',
132
416
  level: 'FIELD',
133
- field: 'requested_amount_cents',
417
+ fieldRef: requestedAmountCentsField,
134
418
  });
135
419
 
136
- defineTypedValidation(application, {
420
+ new Validation(applicationObj, {
137
421
  ruleId: 'gpm_review_score_range',
138
422
  displayName: 'Review score must be 0-100',
139
- whenInvalid: (c) => c.or(c.lt(c.fields.review_score, 0), c.gt(c.fields.review_score, 100)),
423
+ rqlFormula: '((review_score__c < 0) OR (review_score__c > 100))',
140
424
  errorMessage: 'Review score must be between 0 and 100.',
141
425
  ruleDescription: 'Keeps panel scores in range',
142
426
  state: 'ACTIVE',
143
427
  level: 'FIELD',
144
- field: 'review_score',
428
+ fieldRef: scoreField,
145
429
  });
146
430
 
147
- defineTypedRule(application, {
431
+ new Rule(applicationObj, {
148
432
  flowId: 'gpm_default_application_status',
149
433
  flowName: 'Default application status',
150
434
  triggerType: 'CREATE',
151
435
  description: 'New applications start as Draft',
152
- actions: (rules) => [rules.setField('status').toValue('Draft')],
436
+ actions: [{ targetField: applicationStatusField, fixedValue: 'Draft' }],
153
437
  });
154
438
 
155
- defineTypedRule(milestone, {
439
+ new Rule(milestoneObj, {
156
440
  flowId: 'gpm_default_milestone_status',
157
441
  flowName: 'Default milestone status',
158
442
  triggerType: 'CREATE',
159
443
  description: 'New milestones start Not started',
160
- actions: (rules) => [rules.setField('status').toValue('Not started')],
444
+ actions: [{ targetField: milestoneStatusField, fixedValue: 'Not started' }],
161
445
  });
162
446
 
163
- // ── List views ─────────────────────────────────────────────────────────────
164
- defineTypedListView(program, {
447
+ new ListViewDef(programObj, {
165
448
  viewId: 'view_gpm_programs',
166
449
  name: 'Programs',
167
450
  description: 'Funding programs with budgets and grant counts',
168
- fields: ['name', 'focus_area', 'annual_budget_cents', grantCountOnProgram],
451
+ fields: ['name', programFocusField, programBudgetCentsField, grantCountOnProgram],
169
452
  orderBy: 'name',
170
453
  sortOrder: 'ASC',
171
454
  isPublic: true,
172
455
  objectScope: 'all',
173
456
  });
174
457
 
175
- defineTypedListView(grant, {
458
+ new ListViewDef(grantObj, {
176
459
  viewId: 'view_gpm_grants',
177
460
  name: 'Grants',
178
461
  description: 'Grant cycles with application and requested amount rollups',
179
462
  fields: [
180
463
  'name',
181
- 'program_ref',
182
- 'status',
183
- 'open_date',
184
- 'close_date',
185
- 'award_budget_cents',
464
+ grantProgramRef,
465
+ grantStatusField,
466
+ grantOpenDateField,
467
+ grantCloseDateField,
468
+ grantAwardBudgetCentsField,
186
469
  applicationCountOnGrant,
187
470
  requestedAmountOnGrant,
188
471
  ],
189
- orderBy: 'close_date',
472
+ orderBy: grantCloseDateField,
190
473
  sortOrder: 'ASC',
191
474
  isPublic: true,
192
475
  objectScope: 'all',
193
476
  });
194
477
 
195
- defineTypedListView(applicant, {
478
+ new ListViewDef(applicantObj, {
196
479
  viewId: 'view_gpm_applicants',
197
480
  name: 'Applicants',
198
481
  description: 'Applicant directory',
199
- fields: ['name', 'legal_name', 'applicant_type', 'contact_email'],
200
- orderBy: 'legal_name',
482
+ fields: ['name', applicantLegalNameField, applicantTypeField, applicantEmailField],
483
+ orderBy: applicantLegalNameField,
201
484
  sortOrder: 'ASC',
202
485
  isPublic: true,
203
486
  objectScope: 'all',
204
487
  });
205
488
 
206
- defineTypedListView(application, {
489
+ new ListViewDef(applicationObj, {
207
490
  viewId: 'view_gpm_applications',
208
491
  name: 'Applications',
209
492
  description: 'Application review queue',
210
493
  fields: [
211
494
  'name',
212
- 'grant_ref',
213
- 'applicant_ref',
214
- 'status',
215
- 'requested_amount_cents',
216
- 'review_score',
495
+ applicationGrantRef,
496
+ applicationApplicantRef,
497
+ applicationStatusField,
498
+ requestedAmountCentsField,
499
+ scoreField,
217
500
  milestoneCountOnApplication,
218
501
  disbursedAmountOnApplication,
219
- 'review_label',
502
+ applicationLabelField,
220
503
  ],
221
- orderBy: 'review_score',
504
+ orderBy: scoreField,
222
505
  sortOrder: 'DESC',
223
506
  isPublic: true,
224
507
  objectScope: 'all',
225
508
  });
226
509
 
227
- defineTypedListView(milestone, {
510
+ new ListViewDef(milestoneObj, {
228
511
  viewId: 'view_gpm_milestones',
229
512
  name: 'Milestones',
230
513
  description: 'Deliverables and report deadlines',
231
- fields: ['name', 'application_ref', 'due_date', 'status'],
232
- orderBy: 'due_date',
514
+ fields: ['name', milestoneApplicationRef, milestoneDueDateField, milestoneStatusField],
515
+ orderBy: milestoneDueDateField,
233
516
  sortOrder: 'ASC',
234
517
  isPublic: true,
235
518
  objectScope: 'all',
236
519
  });
237
520
 
238
- defineTypedListView(disbursement, {
521
+ new ListViewDef(disbursementObj, {
239
522
  viewId: 'view_gpm_disbursements',
240
523
  name: 'Disbursements',
241
524
  description: 'Payment tranches by application',
242
- fields: ['name', 'application_ref', 'amount_cents', 'status', 'disbursement_date'],
243
- orderBy: 'disbursement_date',
525
+ fields: [
526
+ 'name',
527
+ disbursementApplicationRef,
528
+ disbursementAmountCentsField,
529
+ disbursementStatusField,
530
+ disbursementDateField,
531
+ ],
532
+ orderBy: disbursementDateField,
244
533
  sortOrder: 'ASC',
245
534
  isPublic: true,
246
535
  objectScope: 'all',
247
536
  });
248
537
 
249
- // ── Page layouts ───────────────────────────────────────────────────────────
250
- defineBasicTypedPageLayout(program, {
251
- section: program.sections.program,
252
- fields: ['name', 'focus_area', 'annual_budget_cents', grantCountOnProgram, 'guidelines'],
538
+ CustomObjectPageLayout.basic(programObj, {
539
+ section: programSection,
540
+ fields: ['name', programFocusField, programBudgetCentsField, grantCountOnProgram, programGuidelinesField],
253
541
  });
254
542
 
255
- defineBasicTypedPageLayout(grant, {
256
- section: grant.sections.grant,
543
+ CustomObjectPageLayout.basic(grantObj, {
544
+ section: grantSection,
257
545
  fields: [
258
546
  'name',
259
- 'program_ref',
260
- 'status',
261
- 'open_date',
262
- 'close_date',
263
- 'award_budget_cents',
547
+ grantProgramRef,
548
+ grantStatusField,
549
+ grantOpenDateField,
550
+ grantCloseDateField,
551
+ grantAwardBudgetCentsField,
264
552
  applicationCountOnGrant,
265
553
  requestedAmountOnGrant,
266
554
  ],
267
555
  });
268
556
 
269
- defineBasicTypedPageLayout(applicant, {
270
- section: applicant.sections.applicant,
271
- fields: ['name', 'legal_name', 'applicant_type', 'contact_email'],
557
+ CustomObjectPageLayout.basic(applicantObj, {
558
+ section: applicantSection,
559
+ fields: ['name', applicantLegalNameField, applicantTypeField, applicantEmailField],
272
560
  });
273
561
 
274
- defineBasicTypedPageLayout(application, {
275
- section: application.sections.application,
562
+ CustomObjectPageLayout.basic(applicationObj, {
563
+ section: applicationSection,
276
564
  fields: [
277
565
  'name',
278
- 'grant_ref',
279
- 'applicant_ref',
280
- 'status',
281
- 'requested_amount_cents',
282
- 'review_score',
566
+ applicationGrantRef,
567
+ applicationApplicantRef,
568
+ applicationStatusField,
569
+ requestedAmountCentsField,
570
+ scoreField,
283
571
  milestoneCountOnApplication,
284
572
  disbursedAmountOnApplication,
285
- 'review_label',
286
- 'proposal_summary',
573
+ applicationLabelField,
574
+ proposalSummaryField,
287
575
  ],
288
576
  });
289
577
 
290
- defineBasicTypedPageLayout(milestone, {
291
- section: milestone.sections.milestone,
292
- fields: ['name', 'application_ref', 'due_date', 'status'],
578
+ CustomObjectPageLayout.basic(milestoneObj, {
579
+ section: milestoneSection,
580
+ fields: ['name', milestoneApplicationRef, milestoneDueDateField, milestoneStatusField],
293
581
  });
294
582
 
295
- defineBasicTypedPageLayout(disbursement, {
296
- section: disbursement.sections.disbursement,
297
- fields: ['name', 'application_ref', 'amount_cents', 'status', 'disbursement_date'],
583
+ CustomObjectPageLayout.basic(disbursementObj, {
584
+ section: disbursementSection,
585
+ fields: [
586
+ 'name',
587
+ disbursementApplicationRef,
588
+ disbursementAmountCentsField,
589
+ disbursementStatusField,
590
+ disbursementDateField,
591
+ ],
298
592
  });
299
593
 
300
594
  console.log(manifest.preview());