@rippling/rippling-sdk 0.2.0-alpha.82 → 0.2.0-alpha.83

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 (351) hide show
  1. package/client.d.mts +4 -4
  2. package/client.d.mts.map +1 -1
  3. package/client.d.ts +4 -4
  4. package/client.d.ts.map +1 -1
  5. package/client.js.map +1 -1
  6. package/client.mjs.map +1 -1
  7. package/core/platform/custom-objects/category.d.mts +125 -0
  8. package/core/platform/custom-objects/category.d.mts.map +1 -0
  9. package/core/platform/custom-objects/category.d.ts +125 -0
  10. package/core/platform/custom-objects/category.d.ts.map +1 -0
  11. package/core/platform/custom-objects/category.js +188 -0
  12. package/core/platform/custom-objects/category.js.map +1 -0
  13. package/core/platform/custom-objects/category.mjs +178 -0
  14. package/core/platform/custom-objects/category.mjs.map +1 -0
  15. package/core/platform/custom-objects/definition.d.mts +147 -0
  16. package/core/platform/custom-objects/definition.d.mts.map +1 -0
  17. package/core/platform/custom-objects/definition.d.ts +147 -0
  18. package/core/platform/custom-objects/definition.d.ts.map +1 -0
  19. package/core/platform/custom-objects/definition.js +200 -0
  20. package/core/platform/custom-objects/definition.js.map +1 -0
  21. package/core/platform/custom-objects/definition.mjs +190 -0
  22. package/core/platform/custom-objects/definition.mjs.map +1 -0
  23. package/core/platform/custom-objects/fields.d.mts +302 -0
  24. package/core/platform/custom-objects/fields.d.mts.map +1 -0
  25. package/core/platform/custom-objects/fields.d.ts +302 -0
  26. package/core/platform/custom-objects/fields.d.ts.map +1 -0
  27. package/core/platform/custom-objects/fields.js +369 -0
  28. package/core/platform/custom-objects/fields.js.map +1 -0
  29. package/core/platform/custom-objects/fields.mjs +347 -0
  30. package/core/platform/custom-objects/fields.mjs.map +1 -0
  31. package/core/platform/custom-objects/function-runtime.d.mts +42 -0
  32. package/core/platform/custom-objects/function-runtime.d.mts.map +1 -0
  33. package/core/platform/custom-objects/function-runtime.d.ts +42 -0
  34. package/core/platform/custom-objects/function-runtime.d.ts.map +1 -0
  35. package/core/platform/custom-objects/function-runtime.js +38 -0
  36. package/core/platform/custom-objects/function-runtime.js.map +1 -0
  37. package/core/platform/custom-objects/function-runtime.mjs +35 -0
  38. package/core/platform/custom-objects/function-runtime.mjs.map +1 -0
  39. package/core/platform/custom-objects/lifecycle.d.mts +83 -0
  40. package/core/platform/custom-objects/lifecycle.d.mts.map +1 -0
  41. package/core/platform/custom-objects/lifecycle.d.ts +83 -0
  42. package/core/platform/custom-objects/lifecycle.d.ts.map +1 -0
  43. package/core/platform/custom-objects/lifecycle.js +372 -0
  44. package/core/platform/custom-objects/lifecycle.js.map +1 -0
  45. package/core/platform/custom-objects/lifecycle.mjs +367 -0
  46. package/core/platform/custom-objects/lifecycle.mjs.map +1 -0
  47. package/core/platform/custom-objects/manager.d.mts +354 -0
  48. package/core/platform/custom-objects/manager.d.mts.map +1 -0
  49. package/core/platform/custom-objects/manager.d.ts +354 -0
  50. package/core/platform/custom-objects/manager.d.ts.map +1 -0
  51. package/core/platform/custom-objects/manager.js +646 -0
  52. package/core/platform/custom-objects/manager.js.map +1 -0
  53. package/core/platform/custom-objects/manager.mjs +637 -0
  54. package/core/platform/custom-objects/manager.mjs.map +1 -0
  55. package/core/platform/custom-objects/provisioning.d.mts +138 -0
  56. package/core/platform/custom-objects/provisioning.d.mts.map +1 -0
  57. package/core/platform/custom-objects/provisioning.d.ts +138 -0
  58. package/core/platform/custom-objects/provisioning.d.ts.map +1 -0
  59. package/core/platform/custom-objects/provisioning.js +455 -0
  60. package/core/platform/custom-objects/provisioning.js.map +1 -0
  61. package/core/platform/custom-objects/provisioning.mjs +447 -0
  62. package/core/platform/custom-objects/provisioning.mjs.map +1 -0
  63. package/core/platform/custom-objects/rql.d.mts +122 -0
  64. package/core/platform/custom-objects/rql.d.mts.map +1 -0
  65. package/core/platform/custom-objects/rql.d.ts +122 -0
  66. package/core/platform/custom-objects/rql.d.ts.map +1 -0
  67. package/core/platform/custom-objects/rql.js +225 -0
  68. package/core/platform/custom-objects/rql.js.map +1 -0
  69. package/core/platform/custom-objects/rql.mjs +222 -0
  70. package/core/platform/custom-objects/rql.mjs.map +1 -0
  71. package/core/platform/custom-objects/schema-manager.d.mts +203 -0
  72. package/core/platform/custom-objects/schema-manager.d.mts.map +1 -0
  73. package/core/platform/custom-objects/schema-manager.d.ts +203 -0
  74. package/core/platform/custom-objects/schema-manager.d.ts.map +1 -0
  75. package/core/platform/custom-objects/schema-manager.js +256 -0
  76. package/core/platform/custom-objects/schema-manager.js.map +1 -0
  77. package/core/platform/custom-objects/schema-manager.mjs +249 -0
  78. package/core/platform/custom-objects/schema-manager.mjs.map +1 -0
  79. package/core/platform/custom-objects/typed-rql.d.mts +157 -0
  80. package/core/platform/custom-objects/typed-rql.d.mts.map +1 -0
  81. package/core/platform/custom-objects/typed-rql.d.ts +157 -0
  82. package/core/platform/custom-objects/typed-rql.d.ts.map +1 -0
  83. package/core/platform/custom-objects/typed-rql.js +583 -0
  84. package/core/platform/custom-objects/typed-rql.js.map +1 -0
  85. package/core/platform/custom-objects/typed-rql.mjs +580 -0
  86. package/core/platform/custom-objects/typed-rql.mjs.map +1 -0
  87. package/core/platform/custom-objects/types.d.mts +549 -0
  88. package/core/platform/custom-objects/types.d.mts.map +1 -0
  89. package/core/platform/custom-objects/types.d.ts +549 -0
  90. package/core/platform/custom-objects/types.d.ts.map +1 -0
  91. package/core/platform/custom-objects/types.js +20 -0
  92. package/core/platform/custom-objects/types.js.map +1 -0
  93. package/core/platform/custom-objects/types.mjs +17 -0
  94. package/core/platform/custom-objects/types.mjs.map +1 -0
  95. package/core/platform/custom-objects/validation.d.mts +97 -0
  96. package/core/platform/custom-objects/validation.d.mts.map +1 -0
  97. package/core/platform/custom-objects/validation.d.ts +97 -0
  98. package/core/platform/custom-objects/validation.d.ts.map +1 -0
  99. package/core/platform/custom-objects/validation.js +477 -0
  100. package/core/platform/custom-objects/validation.js.map +1 -0
  101. package/core/platform/custom-objects/validation.mjs +465 -0
  102. package/core/platform/custom-objects/validation.mjs.map +1 -0
  103. package/core/platform/custom-objects.d.mts +67 -0
  104. package/core/platform/custom-objects.d.mts.map +1 -0
  105. package/core/platform/custom-objects.d.ts +67 -0
  106. package/core/platform/custom-objects.d.ts.map +1 -0
  107. package/core/platform/custom-objects.js +118 -0
  108. package/core/platform/custom-objects.js.map +1 -0
  109. package/core/platform/custom-objects.mjs +45 -0
  110. package/core/platform/custom-objects.mjs.map +1 -0
  111. package/core/platform/manifest/custom-objects/action.d.mts +58 -0
  112. package/core/platform/manifest/custom-objects/action.d.mts.map +1 -0
  113. package/core/platform/manifest/custom-objects/action.d.ts +58 -0
  114. package/core/platform/manifest/custom-objects/action.d.ts.map +1 -0
  115. package/core/platform/manifest/custom-objects/action.js +44 -0
  116. package/core/platform/manifest/custom-objects/action.js.map +1 -0
  117. package/core/platform/manifest/custom-objects/action.mjs +40 -0
  118. package/core/platform/manifest/custom-objects/action.mjs.map +1 -0
  119. package/core/platform/manifest/custom-objects/conditions.d.mts +240 -0
  120. package/core/platform/manifest/custom-objects/conditions.d.mts.map +1 -0
  121. package/core/platform/manifest/custom-objects/conditions.d.ts +240 -0
  122. package/core/platform/manifest/custom-objects/conditions.d.ts.map +1 -0
  123. package/core/platform/manifest/custom-objects/conditions.js +326 -0
  124. package/core/platform/manifest/custom-objects/conditions.js.map +1 -0
  125. package/core/platform/manifest/custom-objects/conditions.mjs +321 -0
  126. package/core/platform/manifest/custom-objects/conditions.mjs.map +1 -0
  127. package/core/platform/manifest/custom-objects/existing.d.mts +87 -0
  128. package/core/platform/manifest/custom-objects/existing.d.mts.map +1 -0
  129. package/core/platform/manifest/custom-objects/existing.d.ts +87 -0
  130. package/core/platform/manifest/custom-objects/existing.d.ts.map +1 -0
  131. package/core/platform/manifest/custom-objects/existing.js +113 -0
  132. package/core/platform/manifest/custom-objects/existing.js.map +1 -0
  133. package/core/platform/manifest/custom-objects/existing.mjs +109 -0
  134. package/core/platform/manifest/custom-objects/existing.mjs.map +1 -0
  135. package/core/platform/manifest/custom-objects/field-resolution.d.mts +48 -0
  136. package/core/platform/manifest/custom-objects/field-resolution.d.mts.map +1 -0
  137. package/core/platform/manifest/custom-objects/field-resolution.d.ts +48 -0
  138. package/core/platform/manifest/custom-objects/field-resolution.d.ts.map +1 -0
  139. package/core/platform/manifest/custom-objects/field-resolution.js +61 -0
  140. package/core/platform/manifest/custom-objects/field-resolution.js.map +1 -0
  141. package/core/platform/manifest/custom-objects/field-resolution.mjs +58 -0
  142. package/core/platform/manifest/custom-objects/field-resolution.mjs.map +1 -0
  143. package/core/platform/manifest/custom-objects/function-file.d.mts +87 -0
  144. package/core/platform/manifest/custom-objects/function-file.d.mts.map +1 -0
  145. package/core/platform/manifest/custom-objects/function-file.d.ts +87 -0
  146. package/core/platform/manifest/custom-objects/function-file.d.ts.map +1 -0
  147. package/core/platform/manifest/custom-objects/function-file.js +76 -0
  148. package/core/platform/manifest/custom-objects/function-file.js.map +1 -0
  149. package/core/platform/manifest/custom-objects/function-file.mjs +69 -0
  150. package/core/platform/manifest/custom-objects/function-file.mjs.map +1 -0
  151. package/core/platform/manifest/custom-objects/list-view.d.mts +65 -0
  152. package/core/platform/manifest/custom-objects/list-view.d.mts.map +1 -0
  153. package/core/platform/manifest/custom-objects/list-view.d.ts +65 -0
  154. package/core/platform/manifest/custom-objects/list-view.d.ts.map +1 -0
  155. package/core/platform/manifest/custom-objects/list-view.js +33 -0
  156. package/core/platform/manifest/custom-objects/list-view.js.map +1 -0
  157. package/core/platform/manifest/custom-objects/list-view.mjs +30 -0
  158. package/core/platform/manifest/custom-objects/list-view.mjs.map +1 -0
  159. package/core/platform/manifest/custom-objects/object-list-page.d.mts +43 -0
  160. package/core/platform/manifest/custom-objects/object-list-page.d.mts.map +1 -0
  161. package/core/platform/manifest/custom-objects/object-list-page.d.ts +43 -0
  162. package/core/platform/manifest/custom-objects/object-list-page.d.ts.map +1 -0
  163. package/core/platform/manifest/custom-objects/object-list-page.js +54 -0
  164. package/core/platform/manifest/custom-objects/object-list-page.js.map +1 -0
  165. package/core/platform/manifest/custom-objects/object-list-page.mjs +50 -0
  166. package/core/platform/manifest/custom-objects/object-list-page.mjs.map +1 -0
  167. package/core/platform/manifest/custom-objects/page-layout.d.mts +142 -0
  168. package/core/platform/manifest/custom-objects/page-layout.d.mts.map +1 -0
  169. package/core/platform/manifest/custom-objects/page-layout.d.ts +142 -0
  170. package/core/platform/manifest/custom-objects/page-layout.d.ts.map +1 -0
  171. package/core/platform/manifest/custom-objects/page-layout.js +184 -0
  172. package/core/platform/manifest/custom-objects/page-layout.js.map +1 -0
  173. package/core/platform/manifest/custom-objects/page-layout.mjs +180 -0
  174. package/core/platform/manifest/custom-objects/page-layout.mjs.map +1 -0
  175. package/core/platform/manifest/custom-objects/register.d.mts +87 -0
  176. package/core/platform/manifest/custom-objects/register.d.mts.map +1 -0
  177. package/core/platform/manifest/custom-objects/register.d.ts +87 -0
  178. package/core/platform/manifest/custom-objects/register.d.ts.map +1 -0
  179. package/core/platform/manifest/custom-objects/register.js +395 -0
  180. package/core/platform/manifest/custom-objects/register.js.map +1 -0
  181. package/core/platform/manifest/custom-objects/register.mjs +391 -0
  182. package/core/platform/manifest/custom-objects/register.mjs.map +1 -0
  183. package/core/platform/manifest/custom-objects/rule.d.mts +113 -0
  184. package/core/platform/manifest/custom-objects/rule.d.mts.map +1 -0
  185. package/core/platform/manifest/custom-objects/rule.d.ts +113 -0
  186. package/core/platform/manifest/custom-objects/rule.d.ts.map +1 -0
  187. package/core/platform/manifest/custom-objects/rule.js +49 -0
  188. package/core/platform/manifest/custom-objects/rule.js.map +1 -0
  189. package/core/platform/manifest/custom-objects/rule.mjs +45 -0
  190. package/core/platform/manifest/custom-objects/rule.mjs.map +1 -0
  191. package/core/platform/manifest/custom-objects/sdui-page.d.mts +214 -0
  192. package/core/platform/manifest/custom-objects/sdui-page.d.mts.map +1 -0
  193. package/core/platform/manifest/custom-objects/sdui-page.d.ts +214 -0
  194. package/core/platform/manifest/custom-objects/sdui-page.d.ts.map +1 -0
  195. package/core/platform/manifest/custom-objects/sdui-page.js +194 -0
  196. package/core/platform/manifest/custom-objects/sdui-page.js.map +1 -0
  197. package/core/platform/manifest/custom-objects/sdui-page.mjs +182 -0
  198. package/core/platform/manifest/custom-objects/sdui-page.mjs.map +1 -0
  199. package/core/platform/manifest/custom-objects/typed-condition.d.mts +28 -0
  200. package/core/platform/manifest/custom-objects/typed-condition.d.mts.map +1 -0
  201. package/core/platform/manifest/custom-objects/typed-condition.d.ts +28 -0
  202. package/core/platform/manifest/custom-objects/typed-condition.d.ts.map +1 -0
  203. package/core/platform/manifest/custom-objects/typed-condition.js +434 -0
  204. package/core/platform/manifest/custom-objects/typed-condition.js.map +1 -0
  205. package/core/platform/manifest/custom-objects/typed-condition.mjs +431 -0
  206. package/core/platform/manifest/custom-objects/typed-condition.mjs.map +1 -0
  207. package/core/platform/manifest/custom-objects/types.d.mts +29 -0
  208. package/core/platform/manifest/custom-objects/types.d.mts.map +1 -0
  209. package/core/platform/manifest/custom-objects/types.d.ts +29 -0
  210. package/core/platform/manifest/custom-objects/types.d.ts.map +1 -0
  211. package/core/platform/manifest/custom-objects/types.js +3 -0
  212. package/core/platform/manifest/custom-objects/types.js.map +1 -0
  213. package/core/platform/manifest/custom-objects/types.mjs +2 -0
  214. package/core/platform/manifest/custom-objects/types.mjs.map +1 -0
  215. package/core/platform/manifest/custom-objects/validation.d.mts +44 -0
  216. package/core/platform/manifest/custom-objects/validation.d.mts.map +1 -0
  217. package/core/platform/manifest/custom-objects/validation.d.ts +44 -0
  218. package/core/platform/manifest/custom-objects/validation.d.ts.map +1 -0
  219. package/core/platform/manifest/custom-objects/validation.js +30 -0
  220. package/core/platform/manifest/custom-objects/validation.js.map +1 -0
  221. package/core/platform/manifest/custom-objects/validation.mjs +27 -0
  222. package/core/platform/manifest/custom-objects/validation.mjs.map +1 -0
  223. package/core/platform/manifest/custom-objects/workflow.d.mts +47 -0
  224. package/core/platform/manifest/custom-objects/workflow.d.mts.map +1 -0
  225. package/core/platform/manifest/custom-objects/workflow.d.ts +47 -0
  226. package/core/platform/manifest/custom-objects/workflow.d.ts.map +1 -0
  227. package/core/platform/manifest/custom-objects/workflow.js +38 -0
  228. package/core/platform/manifest/custom-objects/workflow.js.map +1 -0
  229. package/core/platform/manifest/custom-objects/workflow.mjs +34 -0
  230. package/core/platform/manifest/custom-objects/workflow.mjs.map +1 -0
  231. package/core/platform/manifest/custom-objects.d.mts +85 -0
  232. package/core/platform/manifest/custom-objects.d.mts.map +1 -0
  233. package/core/platform/manifest/custom-objects.d.ts +85 -0
  234. package/core/platform/manifest/custom-objects.d.ts.map +1 -0
  235. package/core/platform/manifest/custom-objects.js +84 -0
  236. package/core/platform/manifest/custom-objects.js.map +1 -0
  237. package/core/platform/manifest/custom-objects.mjs +55 -0
  238. package/core/platform/manifest/custom-objects.mjs.map +1 -0
  239. package/examples/manifest/custom-object-creation-workflow/custom-object-creation-workflow.ts +26 -44
  240. package/examples/manifest/custom-object-creation-workflow/functions/intake-request-created.ts +20 -0
  241. package/examples/manifest/custom-object-creation-workflow/schema.ts +29 -0
  242. package/examples/manifest/dental-practice-management/dental-practice-management.ts +142 -470
  243. package/examples/manifest/dental-practice-management/functions/chair-schedule.ts +13 -23
  244. package/examples/manifest/dental-practice-management/functions/complete-visit.ts +32 -55
  245. package/examples/manifest/dental-practice-management/functions/operatory-list.ts +13 -23
  246. package/examples/manifest/dental-practice-management/functions/patient-list.ts +13 -23
  247. package/examples/manifest/dental-practice-management/functions/treatment-plan-list.ts +13 -23
  248. package/examples/manifest/dental-practice-management/schema.ts +298 -0
  249. package/examples/manifest/existing-manifest-mutations/existing-manifest-mutations.ts +68 -23
  250. package/examples/manifest/field-service-dispatch/field-service-dispatch.ts +102 -375
  251. package/examples/manifest/field-service-dispatch/schema.ts +248 -0
  252. package/examples/manifest/grant-program-management/grant-program-management.ts +125 -419
  253. package/examples/manifest/grant-program-management/schema.ts +269 -0
  254. package/examples/manifest/gym-membership-management/functions/check-in-desk.ts +13 -23
  255. package/examples/manifest/gym-membership-management/functions/member-list.ts +13 -23
  256. package/examples/manifest/gym-membership-management/functions/today-schedule.ts +13 -23
  257. package/examples/manifest/gym-membership-management/functions/trainer-list.ts +13 -23
  258. package/examples/manifest/gym-membership-management/gym-membership-management.ts +92 -442
  259. package/examples/manifest/gym-membership-management/schema.ts +266 -0
  260. package/examples/manifest/procurement-approval-hub/functions/route-purchase-request.ts +20 -0
  261. package/examples/manifest/procurement-approval-hub/procurement-approval-hub.ts +122 -408
  262. package/examples/manifest/procurement-approval-hub/schema.ts +256 -0
  263. package/examples/manifest/simple-todo-app/functions/mark-done.ts +16 -12
  264. package/examples/manifest/simple-todo-app/functions/todo-list.ts +13 -23
  265. package/examples/manifest/simple-todo-app/schema.ts +60 -0
  266. package/examples/manifest/simple-todo-app/simple-todo-app.ts +40 -109
  267. package/examples/manifest/todo-app-without-object-list-view/functions/todo-page.ts +166 -193
  268. package/examples/manifest/todo-app-without-object-list-view/schema.ts +28 -0
  269. package/examples/manifest/todo-app-without-object-list-view/todo-app-without-object-list-view.ts +24 -47
  270. package/package.json +7 -13
  271. package/resources/custom-objects/custom-objects.d.mts +7 -0
  272. package/resources/custom-objects/custom-objects.d.mts.map +1 -1
  273. package/resources/custom-objects/custom-objects.d.ts +7 -0
  274. package/resources/custom-objects/custom-objects.d.ts.map +1 -1
  275. package/resources/custom-objects/custom-objects.js.map +1 -1
  276. package/resources/custom-objects/custom-objects.mjs.map +1 -1
  277. package/resources/custom-objects/fields.d.mts +170 -15
  278. package/resources/custom-objects/fields.d.mts.map +1 -1
  279. package/resources/custom-objects/fields.d.ts +170 -15
  280. package/resources/custom-objects/fields.d.ts.map +1 -1
  281. package/resources/index.d.mts +2 -2
  282. package/resources/index.d.mts.map +1 -1
  283. package/resources/index.d.ts +2 -2
  284. package/resources/index.d.ts.map +1 -1
  285. package/resources/index.js.map +1 -1
  286. package/resources/index.mjs.map +1 -1
  287. package/resources/leave-program-evaluations.d.mts +510 -3
  288. package/resources/leave-program-evaluations.d.mts.map +1 -1
  289. package/resources/leave-program-evaluations.d.ts +510 -3
  290. package/resources/leave-program-evaluations.d.ts.map +1 -1
  291. package/resources/levels.d.mts +64 -2
  292. package/resources/levels.d.mts.map +1 -1
  293. package/resources/levels.d.ts +64 -2
  294. package/resources/levels.d.ts.map +1 -1
  295. package/resources/levels.js +22 -0
  296. package/resources/levels.js.map +1 -1
  297. package/resources/levels.mjs +22 -0
  298. package/resources/levels.mjs.map +1 -1
  299. package/resources/tracks.d.mts +45 -1
  300. package/resources/tracks.d.mts.map +1 -1
  301. package/resources/tracks.d.ts +45 -1
  302. package/resources/tracks.d.ts.map +1 -1
  303. package/resources/tracks.js +22 -0
  304. package/resources/tracks.js.map +1 -1
  305. package/resources/tracks.mjs +22 -0
  306. package/resources/tracks.mjs.map +1 -1
  307. package/src/client.ts +8 -0
  308. package/src/core/platform/README.md +20 -0
  309. package/src/core/platform/custom-objects/category.ts +294 -0
  310. package/src/core/platform/custom-objects/definition.ts +373 -0
  311. package/src/core/platform/custom-objects/fields.ts +653 -0
  312. package/src/core/platform/custom-objects/function-runtime.ts +76 -0
  313. package/src/core/platform/custom-objects/lifecycle.ts +557 -0
  314. package/src/core/platform/custom-objects/manager.ts +959 -0
  315. package/src/core/platform/custom-objects/provisioning.ts +672 -0
  316. package/src/core/platform/custom-objects/rql.ts +375 -0
  317. package/src/core/platform/custom-objects/schema-manager.ts +351 -0
  318. package/src/core/platform/custom-objects/typed-rql.ts +1273 -0
  319. package/src/core/platform/custom-objects/types.ts +753 -0
  320. package/src/core/platform/custom-objects/validation.ts +573 -0
  321. package/src/core/platform/custom-objects.ts +269 -0
  322. package/src/core/platform/manifest/README.md +26 -0
  323. package/src/core/platform/manifest/custom-objects/action.ts +87 -0
  324. package/src/core/platform/manifest/custom-objects/conditions.ts +762 -0
  325. package/src/core/platform/manifest/custom-objects/existing.ts +221 -0
  326. package/src/core/platform/manifest/custom-objects/field-resolution.ts +116 -0
  327. package/src/core/platform/manifest/custom-objects/function-file.ts +149 -0
  328. package/src/core/platform/manifest/custom-objects/list-view.ts +95 -0
  329. package/src/core/platform/manifest/custom-objects/object-list-page.ts +87 -0
  330. package/src/core/platform/manifest/custom-objects/page-layout.ts +380 -0
  331. package/src/core/platform/manifest/custom-objects/register.ts +555 -0
  332. package/src/core/platform/manifest/custom-objects/rule.ts +192 -0
  333. package/src/core/platform/manifest/custom-objects/sdui-page.ts +515 -0
  334. package/src/core/platform/manifest/custom-objects/typed-condition.ts +617 -0
  335. package/src/core/platform/manifest/custom-objects/types.ts +92 -0
  336. package/src/core/platform/manifest/custom-objects/validation.ts +70 -0
  337. package/src/core/platform/manifest/custom-objects/workflow.ts +71 -0
  338. package/src/core/platform/manifest/custom-objects.ts +203 -0
  339. package/src/pebble-sdui-web-custom-apps-shim.d.ts +3 -0
  340. package/src/resources/custom-objects/custom-objects.ts +8 -0
  341. package/src/resources/custom-objects/fields.ts +239 -14
  342. package/src/resources/index.ts +4 -0
  343. package/src/resources/leave-program-evaluations.ts +610 -3
  344. package/src/resources/levels.ts +93 -1
  345. package/src/resources/tracks.ts +70 -0
  346. package/src/tsconfig.json +1 -1
  347. package/src/version.ts +1 -1
  348. package/version.d.mts +1 -1
  349. package/version.d.ts +1 -1
  350. package/version.js +1 -1
  351. package/version.mjs +1 -1
@@ -0,0 +1,672 @@
1
+ import type { RipplingSDK } from '../../../client';
2
+ import type {
3
+ CustomObject,
4
+ CustomObjectCreateParams,
5
+ CustomObjectUpdateParams,
6
+ } from '../../../resources/custom-objects/custom-objects';
7
+ import type {
8
+ CustomObjectField,
9
+ CustomObjectFieldDataType,
10
+ CustomObjectNameFieldDetails,
11
+ FieldCreateParams,
12
+ FieldUpdateParams,
13
+ } from '../../../resources/custom-objects/fields';
14
+ import type { AnyCustomObjectDefinition, AnyFieldDefinition, FieldNames } from './types';
15
+ import type { CustomObjectCategoryDefinition } from './category';
16
+ import { provisionCustomObjectCategoryDefinition } from './category';
17
+
18
+ /**
19
+ * Provisioned custom-object summary returned by the SDK provisioning helpers.
20
+ *
21
+ * @typeParam TDefinition - Typed custom-object definition that was provisioned.
22
+ */
23
+ export interface ProvisionedCustomObject<
24
+ TDefinition extends AnyCustomObjectDefinition = AnyCustomObjectDefinition,
25
+ > {
26
+ /** Logical object definition used as the source of truth. */
27
+ readonly definition: TDefinition;
28
+ /** Wire-level api name created on the backend. */
29
+ readonly customObjectApiName: TDefinition['apiName'];
30
+ /** Backend response returned by `client.customObjects.create(...)`. */
31
+ readonly createdObject: CustomObject;
32
+ /** Backend response returned by `client.customObjects.update(...)`. */
33
+ readonly updatedObject: CustomObject;
34
+ /** Optional response returned when the helper updates the platform-managed `name` field. */
35
+ readonly updatedNameField?: CustomObjectField;
36
+ /** Backend responses returned by field creation calls, keyed by logical field name. */
37
+ readonly createdFields: Readonly<Record<FieldNames<TDefinition>, CustomObjectField>>;
38
+ /** Backend responses returned by field update calls, keyed by logical field name. */
39
+ readonly updatedFields: Readonly<Record<FieldNames<TDefinition>, CustomObjectField>>;
40
+ }
41
+
42
+ /**
43
+ * Options for provisioning a single typed custom-object definition through the REST SDK.
44
+ *
45
+ * Assumptions baked into this helper:
46
+ * - custom-object `create` derives the immutable `api_name` from the submitted logical name
47
+ * - field `create` derives the immutable `api_name` from the submitted logical field name
48
+ * - follow-up `update` calls can safely set human-facing display labels without changing api names
49
+ */
50
+ export interface ProvisionCustomObjectOptions {
51
+ /**
52
+ * Optional typed category definition to create or update before provisioning the object.
53
+ */
54
+ readonly categoryDefinition?: CustomObjectCategoryDefinition;
55
+ /**
56
+ * Resolved custom-category id or native category id used by the live REST object APIs.
57
+ *
58
+ * Supply this when the definition does not embed a typed category definition.
59
+ */
60
+ readonly categoryIdentifier?: string;
61
+ /**
62
+ * Whether to issue the follow-up object update that applies the human-facing display name.
63
+ *
64
+ * Defaults to `true`.
65
+ */
66
+ readonly updateObjectDisplayMetadata?: boolean;
67
+ /**
68
+ * Whether to issue the follow-up field updates that apply human-facing display names.
69
+ *
70
+ * Defaults to `true`.
71
+ */
72
+ readonly updateFieldDisplayMetadata?: boolean;
73
+ /**
74
+ * Whether to update the platform-managed `name` field when the object definition uses autonumber metadata.
75
+ *
76
+ * Defaults to `true`.
77
+ */
78
+ readonly updateNameFieldDetails?: boolean;
79
+ }
80
+
81
+ /** Options for provisioning multiple custom-object definitions in one batch. */
82
+ export interface ProvisionCustomObjectsOptions
83
+ extends Omit<ProvisionCustomObjectOptions, 'categoryDefinition' | 'categoryIdentifier'> {
84
+ /** Optional typed categories to ensure before creating the objects in this batch. */
85
+ readonly categoryDefinitions?: readonly CustomObjectCategoryDefinition[];
86
+ /**
87
+ * Resolved category ids keyed by object api name for definitions that do not embed a typed category definition.
88
+ */
89
+ readonly categoryIdentifiersByObjectApiName?: Readonly<Record<string, string>>;
90
+ }
91
+
92
+ /**
93
+ * Normalized field payload returned by the field-param builder helpers.
94
+ */
95
+ export interface ProvisionableFieldParams {
96
+ /** Payload passed to `client.customObjects.fields.create(...)`. */
97
+ readonly create: FieldCreateParams;
98
+ /** Payload passed to `client.customObjects.fields.update(...)`. */
99
+ readonly update: FieldUpdateParams;
100
+ }
101
+
102
+ /**
103
+ * Returns whether one field references another object and therefore benefits from being created after scalar fields.
104
+ *
105
+ * @param field - Typed field definition to inspect.
106
+ * @returns Whether the field is a lookup or parent-child relationship.
107
+ */
108
+ function isRelationshipField(field: AnyFieldDefinition): boolean {
109
+ return field.kind === 'lookup' || field.kind === 'parent-child';
110
+ }
111
+
112
+ /**
113
+ * Returns whether one field uses a formula-field variant.
114
+ *
115
+ * @param field - Typed field definition to inspect.
116
+ * @returns Whether the field is one of the `formula-*` kinds.
117
+ */
118
+ function isFormulaField(
119
+ field: AnyFieldDefinition,
120
+ ): field is Extract<AnyFieldDefinition, { kind: `formula-${string}` }> {
121
+ return field.kind.startsWith('formula-');
122
+ }
123
+
124
+ /**
125
+ * Builds the wire-level `data_type` payload expected by the custom-object field REST API.
126
+ *
127
+ * @param field - Typed field definition to compile.
128
+ * @returns REST `data_type` payload for the supplied field definition.
129
+ */
130
+ function buildFieldDataType(field: AnyFieldDefinition): CustomObjectFieldDataType | Record<string, unknown> {
131
+ switch (field.kind) {
132
+ case 'text':
133
+ return {
134
+ field_type: 'TEXT',
135
+ ...(field.maxLength != null ? { max_length: field.maxLength } : {}),
136
+ };
137
+ case 'long-text':
138
+ return {
139
+ field_type: 'LONG_TEXT',
140
+ ...(field.maxLength != null ? { max_length: field.maxLength } : {}),
141
+ };
142
+ case 'email':
143
+ return { field_type: 'EMAIL' };
144
+ case 'url':
145
+ return { field_type: 'URL' };
146
+ case 'phone':
147
+ return { field_type: 'PHONE_NUMBER' };
148
+ case 'number':
149
+ return {
150
+ field_type: 'NUMBER',
151
+ ...(field.decimalPlaces != null ? { num_of_decimal_places: field.decimalPlaces } : {}),
152
+ };
153
+ case 'currency':
154
+ return {
155
+ field_type: 'CURRENCY',
156
+ ...(field.currency != null ? { currency: field.currency } : {}),
157
+ ...(field.decimalPlaces != null ? { num_of_decimal_places: field.decimalPlaces } : {}),
158
+ };
159
+ case 'percentage':
160
+ return { field_type: 'PERCENTAGE', num_of_decimal_places: 2 };
161
+ case 'date':
162
+ return { field_type: 'DATE' };
163
+ case 'datetime':
164
+ return { field_type: 'DATETIME' };
165
+ case 'time':
166
+ return { field_type: 'TIME' };
167
+ case 'select':
168
+ return { field_type: 'SELECT', options_list: [...field.options] };
169
+ case 'radio':
170
+ return { field_type: 'RADIO', options_list: [...field.options] };
171
+ case 'boolean':
172
+ return { field_type: 'BOOLEAN' };
173
+ case 'file':
174
+ return {
175
+ field_type: 'FILE',
176
+ supported_types: field.allowedType === 'any' ? ['*'] : [field.allowedType],
177
+ };
178
+ case 'lookup':
179
+ return {
180
+ field_type: 'OG_REFERENCE_FIELD',
181
+ og_model_rql_name: field.target.apiName,
182
+ edge_type: 'LOOKUP',
183
+ ...(field.relatedDataLabel != null ? { related_data_label: field.relatedDataLabel } : {}),
184
+ ...(field.lookupFilterRqlCondition != null ?
185
+ { lookup_filter_rql_condition: field.lookupFilterRqlCondition }
186
+ : {}),
187
+ };
188
+ case 'parent-child':
189
+ return {
190
+ field_type: 'OG_REFERENCE_FIELD',
191
+ og_model_rql_name: field.target.apiName,
192
+ edge_type: 'PARENT_CHILD',
193
+ ...(field.relatedDataLabel != null ? { related_data_label: field.relatedDataLabel } : {}),
194
+ ...(field.parentChildType != null ? { parent_child_type: field.parentChildType } : {}),
195
+ ...(field.enableParentOwnerInheritance != null ?
196
+ { enable_parent_owner_inheritance: field.enableParentOwnerInheritance }
197
+ : {}),
198
+ };
199
+ case 'formula-text':
200
+ return { field_type: 'TEXT', ...(field.maxLength != null ? { max_length: field.maxLength } : {}) };
201
+ case 'formula-number':
202
+ return { field_type: 'NUMBER' };
203
+ case 'formula-boolean':
204
+ return { field_type: 'BOOLEAN' };
205
+ case 'formula-currency':
206
+ return { field_type: 'CURRENCY' };
207
+ case 'formula-percentage':
208
+ return { field_type: 'PERCENTAGE' };
209
+ case 'formula-date':
210
+ return { field_type: 'DATE' };
211
+ case 'formula-url':
212
+ return { field_type: 'URL' };
213
+ }
214
+ }
215
+
216
+ /**
217
+ * Builds REST section metadata for one typed field definition.
218
+ *
219
+ * @param definition - Object definition that owns the field and section map.
220
+ * @param field - Typed field definition whose section metadata should be compiled.
221
+ * @returns Concrete section id string expected by the live REST API, when available.
222
+ * @throws Error when REST provisioning would require a section id that cannot be resolved.
223
+ * @typeParam TDefinition - Object definition that owns the field.
224
+ */
225
+ function buildFieldSection<TDefinition extends AnyCustomObjectDefinition>(
226
+ definition: TDefinition,
227
+ field: AnyFieldDefinition,
228
+ ): FieldCreateParams['section'] {
229
+ const sectionKey = field.section;
230
+ const sectionOverride = field.restSection;
231
+ const overrideSectionId =
232
+ typeof sectionOverride === 'string' ? sectionOverride : sectionOverride?.section_id;
233
+
234
+ if (sectionKey == null) {
235
+ if (sectionOverride == null) return undefined;
236
+ if (overrideSectionId == null) {
237
+ throw new Error('REST field provisioning currently requires a concrete section id string.');
238
+ }
239
+ return overrideSectionId;
240
+ }
241
+
242
+ const sections = definition.sections as Readonly<
243
+ Record<string, { readonly name: string; readonly sectionId?: string }>
244
+ >;
245
+ const sectionDefinition = sections[sectionKey];
246
+ if (sectionDefinition == null) return overrideSectionId;
247
+
248
+ const resolvedSectionId = overrideSectionId ?? sectionDefinition.sectionId;
249
+ if (resolvedSectionId == null) {
250
+ throw new Error(
251
+ `Field section "${sectionKey}" for "${definition.name}" requires a sectionId for REST provisioning.`,
252
+ );
253
+ }
254
+ return resolvedSectionId;
255
+ }
256
+
257
+ /**
258
+ * Builds name-field metadata for REST field updates when the object uses autonumber names.
259
+ *
260
+ * @param definition - Typed object definition whose name-field metadata should be compiled.
261
+ * @returns Name-field metadata payload for the platform-managed `name` field, when needed.
262
+ * @typeParam TDefinition - Object definition being compiled.
263
+ */
264
+ export function buildCustomObjectNameFieldDetails<TDefinition extends AnyCustomObjectDefinition>(
265
+ definition: TDefinition,
266
+ ): CustomObjectNameFieldDetails | undefined {
267
+ if (definition.nameField.kind !== 'autonumber') return undefined;
268
+ return {
269
+ is_autonumber_field: true,
270
+ autonumber_format: definition.nameField.format,
271
+ ...(definition.nameField.startingNumber != null ?
272
+ { starting_number: definition.nameField.startingNumber }
273
+ : {}),
274
+ };
275
+ }
276
+
277
+ /**
278
+ * Builds the object-creation payload for the low-level REST API using a resolved category id.
279
+ *
280
+ * @param definition - Typed object definition to compile.
281
+ * @param categoryIdentifier - Resolved custom-category id or native category id required by the live API.
282
+ * @returns REST object-create payload.
283
+ * @typeParam TDefinition - Object definition being compiled.
284
+ */
285
+ export function buildCustomObjectCreateParams<TDefinition extends AnyCustomObjectDefinition>(
286
+ definition: TDefinition,
287
+ categoryIdentifier: string,
288
+ ): CustomObjectCreateParams {
289
+ return {
290
+ category: categoryIdentifier,
291
+ description: definition.description,
292
+ name: definition.name,
293
+ };
294
+ }
295
+
296
+ /**
297
+ * Builds the object-update payload used to restore human-facing labels after creation.
298
+ *
299
+ * @param definition - Typed object definition to compile.
300
+ * @param categoryIdentifier - Resolved custom-category id or native category id required by the live API.
301
+ * @returns REST object-update payload.
302
+ * @typeParam TDefinition - Object definition being compiled.
303
+ */
304
+ export function buildCustomObjectUpdateParams<TDefinition extends AnyCustomObjectDefinition>(
305
+ definition: TDefinition,
306
+ categoryIdentifier: string,
307
+ ): CustomObjectUpdateParams {
308
+ return {
309
+ category: categoryIdentifier,
310
+ description: definition.description,
311
+ ...(definition.enableHistory != null ? { enable_history: definition.enableHistory } : {}),
312
+ name: definition.displayName,
313
+ ...(definition.ownerRole != null ? { owner_role: definition.ownerRole } : {}),
314
+ ...(definition.pluralLabel != null ? { plural_label: definition.pluralLabel } : {}),
315
+ };
316
+ }
317
+
318
+ /**
319
+ * Builds field create/update payloads for one logical field in a typed object definition.
320
+ *
321
+ * @param definition - Typed object definition that owns the field.
322
+ * @param fieldName - Logical field name to compile.
323
+ * @returns Frozen create/update payload pair for the field.
324
+ * @typeParam TDefinition - Object definition being compiled.
325
+ * @typeParam TFieldName - Logical field name being compiled.
326
+ */
327
+ export function buildProvisionableFieldParams<
328
+ TDefinition extends AnyCustomObjectDefinition,
329
+ TFieldName extends FieldNames<TDefinition>,
330
+ >(definition: TDefinition, fieldName: TFieldName): ProvisionableFieldParams {
331
+ const field = definition.fields[fieldName] as AnyFieldDefinition & { logicalName: string; apiName: string };
332
+ const dataType = buildFieldDataType(field);
333
+ const section = buildFieldSection(definition, field);
334
+ const shared = {
335
+ description: field.description,
336
+ data_type: dataType,
337
+ required: field.required,
338
+ ...(field.enableHistory != null ? { enable_history: field.enableHistory } : {}),
339
+ ...(field.formulaAttributeMetas != null ? { formula_attr_metas: field.formulaAttributeMetas } : {}),
340
+ ...(field.rqlDefinition != null ? { rql_definition: field.rqlDefinition } : {}),
341
+ ...(section != null ? { section } : {}),
342
+ ...(isFormulaField(field) ? { derived_field_formula: field.formula } : {}),
343
+ ...('unique' in field && field.unique != null ? { is_unique: field.unique } : {}),
344
+ };
345
+
346
+ const create: FieldCreateParams = {
347
+ name: field.logicalName,
348
+ ...shared,
349
+ ...(field.derivedAggregatedField != null ?
350
+ { derived_aggregated_field: field.derivedAggregatedField }
351
+ : {}),
352
+ };
353
+
354
+ // The live GA field update path currently does not accept `derived_aggregated_field`, so keep it create-only.
355
+ const update: FieldUpdateParams = {
356
+ name: field.displayName,
357
+ ...shared,
358
+ };
359
+
360
+ return Object.freeze({ create, update });
361
+ }
362
+
363
+ /**
364
+ * Requires a resolved category identifier for one provisioning operation.
365
+ *
366
+ * @param definition - Object definition that needs a category identifier.
367
+ * @param categoryIdentifier - Resolved custom-category id or native category id, if available.
368
+ * @returns Required category identifier.
369
+ * @throws Error when no usable category identifier is available.
370
+ * @typeParam TDefinition - Object definition being provisioned.
371
+ */
372
+ function requireCategoryIdentifier<TDefinition extends AnyCustomObjectDefinition>(
373
+ definition: TDefinition,
374
+ categoryIdentifier: string | undefined,
375
+ ): string {
376
+ if (categoryIdentifier != null) return categoryIdentifier;
377
+ throw new Error(
378
+ `A category identifier is required to provision "${definition.apiName}". ` +
379
+ `Provide options.categoryIdentifier or embed/provide a typed category definition.`,
380
+ );
381
+ }
382
+
383
+ /**
384
+ * Rejects duplicate object definitions within one batch provisioning request.
385
+ *
386
+ * @param definitions - Typed object definitions to validate for uniqueness.
387
+ * @throws Error when multiple definitions compile to the same object API name.
388
+ */
389
+ function assertUniqueObjectDefinitions(definitions: readonly AnyCustomObjectDefinition[]): void {
390
+ const seen = new Map<string, string>();
391
+ for (const definition of definitions) {
392
+ const existingName = seen.get(definition.apiName);
393
+ if (existingName != null) {
394
+ throw new Error(
395
+ `Duplicate custom object definition for "${definition.apiName}" in batch: ` +
396
+ `"${existingName}" and "${definition.name}".`,
397
+ );
398
+ }
399
+ seen.set(definition.apiName, definition.name);
400
+ }
401
+ }
402
+
403
+ /**
404
+ * Collects and deduplicates embedded or explicitly supplied category definitions for a batch provision.
405
+ *
406
+ * @param definitions - Object definitions participating in the batch.
407
+ * @param explicitDefinitions - Optional explicit category definitions supplied by the caller.
408
+ * @returns Frozen deduplicated category-definition list.
409
+ * @throws Error when two definitions for the same category API name disagree on visible metadata.
410
+ */
411
+ function collectCategoryDefinitions(
412
+ definitions: readonly AnyCustomObjectDefinition[],
413
+ explicitDefinitions: readonly CustomObjectCategoryDefinition[] | undefined,
414
+ ): readonly CustomObjectCategoryDefinition[] {
415
+ const categoryDefinitions =
416
+ explicitDefinitions ?? definitions.map((definition) => definition.categoryDefinition);
417
+ const uniqueDefinitions = new Map<string, CustomObjectCategoryDefinition>();
418
+
419
+ for (const definition of categoryDefinitions) {
420
+ if (definition == null) continue;
421
+ const existing = uniqueDefinitions.get(definition.apiName);
422
+ if (existing != null) {
423
+ if (
424
+ existing.displayName !== definition.displayName ||
425
+ existing.description !== definition.description
426
+ ) {
427
+ throw new Error(
428
+ `Conflicting category definitions for "${definition.apiName}" in batch provisioning.`,
429
+ );
430
+ }
431
+ continue;
432
+ }
433
+ uniqueDefinitions.set(definition.apiName, definition);
434
+ }
435
+
436
+ return Object.freeze([...uniqueDefinitions.values()]);
437
+ }
438
+
439
+ /**
440
+ * Resolves the category identifier that should be sent to the live object APIs during provisioning.
441
+ *
442
+ * @param client - SDK client used to provision embedded category definitions when needed.
443
+ * @param definition - Typed object definition being provisioned.
444
+ * @param options - Provisioning options that may already contain a category identifier.
445
+ * @returns Resolved custom-category id or native category id.
446
+ * @typeParam TDefinition - Object definition being provisioned.
447
+ */
448
+ async function resolveProvisionedCategoryIdentifier<TDefinition extends AnyCustomObjectDefinition>(
449
+ client: RipplingSDK,
450
+ definition: TDefinition,
451
+ options: ProvisionCustomObjectOptions,
452
+ ): Promise<string> {
453
+ const categoryDefinition = options.categoryDefinition ?? definition.categoryDefinition;
454
+ if (categoryDefinition == null) {
455
+ return requireCategoryIdentifier(definition, options.categoryIdentifier);
456
+ }
457
+
458
+ const provisionedCategory = await provisionCustomObjectCategoryDefinition(client, categoryDefinition);
459
+ return provisionedCategory.updatedCategory.id;
460
+ }
461
+
462
+ /**
463
+ * Updates the platform-managed `name` field when the typed definition uses autonumber metadata.
464
+ *
465
+ * @param client - SDK client used to call the field APIs.
466
+ * @param definition - Typed object definition whose name-field metadata should be applied.
467
+ * @param options - Provisioning behavior flags.
468
+ * @returns Updated `name` field DTO, when a name-field update was required.
469
+ * @typeParam TDefinition - Object definition being provisioned.
470
+ */
471
+ async function updateNameFieldDetailsIfNeeded<TDefinition extends AnyCustomObjectDefinition>(
472
+ client: RipplingSDK,
473
+ definition: TDefinition,
474
+ options: ProvisionCustomObjectOptions,
475
+ ): Promise<CustomObjectField | undefined> {
476
+ if (!(options.updateNameFieldDetails ?? true)) return undefined;
477
+ const nameFieldDetails = buildCustomObjectNameFieldDetails(definition);
478
+ if (nameFieldDetails == null) return undefined;
479
+ return client.customObjects.fields.update(definition.apiName, 'name', {
480
+ name_field_details: nameFieldDetails,
481
+ });
482
+ }
483
+
484
+ /**
485
+ * Provisions every custom field for one object definition in relationship-safe order.
486
+ *
487
+ * @param client - SDK client used to call the field APIs.
488
+ * @param definition - Typed object definition whose fields should be provisioned.
489
+ * @param updateFieldDisplayMetadata - Whether to issue follow-up field updates for display metadata.
490
+ * @returns Frozen maps of created and updated field DTOs keyed by logical field name.
491
+ * @typeParam TDefinition - Object definition being provisioned.
492
+ */
493
+ async function provisionFieldsForDefinition<TDefinition extends AnyCustomObjectDefinition>(
494
+ client: RipplingSDK,
495
+ definition: TDefinition,
496
+ updateFieldDisplayMetadata: boolean,
497
+ ): Promise<{
498
+ readonly createdFields: Readonly<Record<FieldNames<TDefinition>, CustomObjectField>>;
499
+ readonly updatedFields: Readonly<Record<FieldNames<TDefinition>, CustomObjectField>>;
500
+ }> {
501
+ const createdFields: Partial<Record<FieldNames<TDefinition>, CustomObjectField>> = {};
502
+ const updatedFields: Partial<Record<FieldNames<TDefinition>, CustomObjectField>> = {};
503
+ const orderedFieldNames = Object.keys(definition.fields).sort((left, right) => {
504
+ const leftField = definition.fields[left as FieldNames<TDefinition>] as AnyFieldDefinition;
505
+ const rightField = definition.fields[right as FieldNames<TDefinition>] as AnyFieldDefinition;
506
+ return Number(isRelationshipField(leftField)) - Number(isRelationshipField(rightField));
507
+ }) as FieldNames<TDefinition>[];
508
+
509
+ for (const fieldName of orderedFieldNames) {
510
+ const field = definition.fields[fieldName] as AnyFieldDefinition & { apiName: string };
511
+ const params = buildProvisionableFieldParams(definition, fieldName);
512
+ const createdField = await client.customObjects.fields.create(definition.apiName, params.create);
513
+ if (createdField.api_name !== field.apiName) {
514
+ throw new Error(
515
+ `Field api_name mismatch for "${definition.name}.${String(fieldName)}": expected "${
516
+ field.apiName
517
+ }", got "${createdField.api_name}".`,
518
+ );
519
+ }
520
+ createdFields[fieldName] = createdField;
521
+
522
+ updatedFields[fieldName] =
523
+ updateFieldDisplayMetadata ?
524
+ await client.customObjects.fields.update(definition.apiName, field.apiName, params.update)
525
+ : createdField;
526
+ }
527
+
528
+ return Object.freeze({
529
+ createdFields: Object.freeze(createdFields) as Readonly<
530
+ Record<FieldNames<TDefinition>, CustomObjectField>
531
+ >,
532
+ updatedFields: Object.freeze(updatedFields) as Readonly<
533
+ Record<FieldNames<TDefinition>, CustomObjectField>
534
+ >,
535
+ });
536
+ }
537
+
538
+ /**
539
+ * Creates one typed custom object through the REST SDK and returns the backend responses.
540
+ *
541
+ * @param client - SDK client used to call the metadata APIs.
542
+ * @param definition - Typed object definition to provision.
543
+ * @param options - Provisioning behavior flags for categories, display metadata, and name fields.
544
+ * @returns Frozen provisioning result describing the created object, fields, and optional name-field update.
545
+ * @typeParam TDefinition - Object definition being provisioned.
546
+ */
547
+ export async function provisionCustomObjectDefinition<TDefinition extends AnyCustomObjectDefinition>(
548
+ client: RipplingSDK,
549
+ definition: TDefinition,
550
+ options: ProvisionCustomObjectOptions = {},
551
+ ): Promise<ProvisionedCustomObject<TDefinition>> {
552
+ const updateObjectDisplayMetadata = options.updateObjectDisplayMetadata ?? true;
553
+ const updateFieldDisplayMetadata = options.updateFieldDisplayMetadata ?? true;
554
+
555
+ const categoryIdentifier = await resolveProvisionedCategoryIdentifier(client, definition, options);
556
+
557
+ const createdObject = await client.customObjects.create(
558
+ buildCustomObjectCreateParams(definition, categoryIdentifier),
559
+ );
560
+ if (createdObject.api_name !== definition.apiName) {
561
+ throw new Error(
562
+ `Custom object api_name mismatch for "${definition.name}": expected "${definition.apiName}", got "${
563
+ createdObject.api_name ?? '<missing>'
564
+ }".`,
565
+ );
566
+ }
567
+
568
+ const updatedObject =
569
+ updateObjectDisplayMetadata ?
570
+ await client.customObjects.update(
571
+ definition.apiName,
572
+ buildCustomObjectUpdateParams(definition, categoryIdentifier),
573
+ )
574
+ : createdObject;
575
+ const updatedNameField = await updateNameFieldDetailsIfNeeded(client, definition, options);
576
+ const fieldResults = await provisionFieldsForDefinition(client, definition, updateFieldDisplayMetadata);
577
+
578
+ return Object.freeze({
579
+ definition,
580
+ customObjectApiName: definition.apiName,
581
+ createdObject,
582
+ updatedObject,
583
+ ...(updatedNameField != null ? { updatedNameField } : {}),
584
+ createdFields: fieldResults.createdFields,
585
+ updatedFields: fieldResults.updatedFields,
586
+ });
587
+ }
588
+
589
+ /**
590
+ * Provisions multiple typed custom-object definitions through the REST SDK.
591
+ *
592
+ * @param client - SDK client used to call the metadata APIs.
593
+ * @param definitions - Typed object definitions to provision.
594
+ * @param options - Batch provisioning behavior flags.
595
+ * @returns Frozen provisioning results in input order.
596
+ */
597
+ export async function provisionCustomObjectDefinitions(
598
+ client: RipplingSDK,
599
+ definitions: readonly AnyCustomObjectDefinition[],
600
+ options: ProvisionCustomObjectsOptions = {},
601
+ ): Promise<ReadonlyArray<ProvisionedCustomObject>> {
602
+ assertUniqueObjectDefinitions(definitions);
603
+ const categoryDefinitions = collectCategoryDefinitions(definitions, options.categoryDefinitions);
604
+ const provisionedCategoryIds = new Map<string, string>();
605
+ for (const categoryDefinition of categoryDefinitions) {
606
+ const provisionedCategory = await provisionCustomObjectCategoryDefinition(client, categoryDefinition);
607
+ provisionedCategoryIds.set(categoryDefinition.apiName, provisionedCategory.updatedCategory.id);
608
+ }
609
+
610
+ const objectResults = new Map<string, { readonly created: CustomObject; readonly updated: CustomObject }>();
611
+ const updatedNameFields = new Map<string, CustomObjectField>();
612
+
613
+ for (const definition of definitions) {
614
+ const categoryIdentifier =
615
+ definition.categoryDefinition != null ?
616
+ provisionedCategoryIds.get(definition.categoryDefinition.apiName)
617
+ : options.categoryIdentifiersByObjectApiName?.[definition.apiName];
618
+ const resolvedCategoryIdentifier = requireCategoryIdentifier(definition, categoryIdentifier);
619
+
620
+ const createdObject = await client.customObjects.create(
621
+ buildCustomObjectCreateParams(definition, resolvedCategoryIdentifier),
622
+ );
623
+ if (createdObject.api_name !== definition.apiName) {
624
+ throw new Error(
625
+ `Custom object api_name mismatch for "${definition.name}": expected "${definition.apiName}", got "${
626
+ createdObject.api_name ?? '<missing>'
627
+ }".`,
628
+ );
629
+ }
630
+
631
+ const updatedObject =
632
+ options.updateObjectDisplayMetadata ?? true ?
633
+ await client.customObjects.update(
634
+ definition.apiName,
635
+ buildCustomObjectUpdateParams(definition, resolvedCategoryIdentifier),
636
+ )
637
+ : createdObject;
638
+
639
+ objectResults.set(definition.apiName, Object.freeze({ created: createdObject, updated: updatedObject }));
640
+ const updatedNameField = await updateNameFieldDetailsIfNeeded(client, definition, options);
641
+ if (updatedNameField != null) updatedNameFields.set(definition.apiName, updatedNameField);
642
+ }
643
+
644
+ const results: ProvisionedCustomObject[] = [];
645
+ for (const definition of definitions) {
646
+ const objectResult = objectResults.get(definition.apiName);
647
+ if (objectResult == null) {
648
+ throw new Error(`Missing created object response for "${definition.apiName}".`);
649
+ }
650
+
651
+ const fieldResults = await provisionFieldsForDefinition(
652
+ client,
653
+ definition,
654
+ options.updateFieldDisplayMetadata ?? true,
655
+ );
656
+
657
+ const updatedNameField = updatedNameFields.get(definition.apiName);
658
+ results.push(
659
+ Object.freeze({
660
+ definition,
661
+ customObjectApiName: definition.apiName,
662
+ createdObject: objectResult.created,
663
+ updatedObject: objectResult.updated,
664
+ ...(updatedNameField != null ? { updatedNameField } : {}),
665
+ createdFields: fieldResults.createdFields,
666
+ updatedFields: fieldResults.updatedFields,
667
+ }),
668
+ );
669
+ }
670
+
671
+ return Object.freeze(results);
672
+ }