@rulebricks/sdk 1.5.2 → 2.0.0

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 (305) hide show
  1. package/Client.d.ts +3 -0
  2. package/Client.js +17 -12
  3. package/api/resources/assets/client/Client.d.ts +55 -1
  4. package/api/resources/assets/client/Client.js +135 -0
  5. package/api/resources/assets/client/index.d.ts +1 -1
  6. package/api/resources/assets/client/index.js +15 -0
  7. package/api/resources/assets/client/requests/ExportManifestRequest.d.ts +23 -0
  8. package/api/resources/assets/client/requests/ExportManifestRequest.js +3 -0
  9. package/api/resources/assets/client/requests/ImportManifestRequest.d.ts +48 -0
  10. package/api/resources/assets/client/requests/ImportManifestRequest.js +3 -0
  11. package/api/resources/assets/client/requests/index.d.ts +2 -0
  12. package/api/resources/assets/client/requests/index.js +2 -0
  13. package/api/resources/assets/index.d.ts +1 -0
  14. package/api/resources/assets/index.js +1 -0
  15. package/api/resources/assets/types/ExportAssetsResponse.d.ts +2 -0
  16. package/api/resources/assets/types/ExportAssetsResponse.js +3 -0
  17. package/api/resources/assets/types/index.d.ts +1 -0
  18. package/api/resources/assets/types/index.js +17 -0
  19. package/api/resources/contexts/client/Client.d.ts +167 -0
  20. package/api/resources/contexts/client/Client.js +563 -0
  21. package/api/resources/contexts/client/index.d.ts +1 -0
  22. package/api/resources/contexts/client/index.js +17 -0
  23. package/api/resources/contexts/client/requests/CascadeContextRequest.d.ts +15 -0
  24. package/api/resources/contexts/client/requests/CascadeContextRequest.js +3 -0
  25. package/api/resources/contexts/client/requests/DeleteInstanceContextsRequest.d.ts +13 -0
  26. package/api/resources/contexts/client/requests/DeleteInstanceContextsRequest.js +3 -0
  27. package/api/resources/contexts/client/requests/GetHistoryContextsRequest.d.ts +17 -0
  28. package/api/resources/contexts/client/requests/GetHistoryContextsRequest.js +3 -0
  29. package/api/resources/contexts/client/requests/GetInstanceContextsRequest.d.ts +13 -0
  30. package/api/resources/contexts/client/requests/GetInstanceContextsRequest.js +3 -0
  31. package/api/resources/contexts/client/requests/GetPendingContextsRequest.d.ts +13 -0
  32. package/api/resources/contexts/client/requests/GetPendingContextsRequest.js +3 -0
  33. package/api/resources/contexts/client/requests/SolveContextFlowRequest.d.ts +20 -0
  34. package/api/resources/contexts/client/requests/SolveContextFlowRequest.js +3 -0
  35. package/api/resources/contexts/client/requests/SolveContextRuleRequest.d.ts +20 -0
  36. package/api/resources/contexts/client/requests/SolveContextRuleRequest.js +3 -0
  37. package/api/resources/contexts/client/requests/SubmitContextsRequest.d.ts +19 -0
  38. package/api/resources/contexts/client/requests/SubmitContextsRequest.js +3 -0
  39. package/api/resources/contexts/client/requests/index.d.ts +8 -0
  40. package/api/resources/contexts/client/requests/index.js +2 -0
  41. package/api/resources/contexts/index.d.ts +2 -0
  42. package/api/resources/contexts/index.js +18 -0
  43. package/api/resources/contexts/resources/admin/client/Client.d.ts +102 -0
  44. package/api/resources/contexts/resources/admin/client/Client.js +353 -0
  45. package/api/resources/contexts/resources/admin/client/index.d.ts +1 -0
  46. package/api/resources/contexts/resources/admin/client/index.js +17 -0
  47. package/api/resources/contexts/resources/admin/client/requests/CreateContextRequest.d.ts +55 -0
  48. package/api/resources/contexts/resources/admin/client/requests/CreateContextRequest.js +12 -0
  49. package/api/resources/contexts/resources/admin/client/requests/DeleteAdminRequest.d.ts +10 -0
  50. package/api/resources/contexts/resources/admin/client/requests/DeleteAdminRequest.js +3 -0
  51. package/api/resources/contexts/resources/admin/client/requests/GetAdminRequest.d.ts +10 -0
  52. package/api/resources/contexts/resources/admin/client/requests/GetAdminRequest.js +3 -0
  53. package/api/resources/contexts/resources/admin/client/requests/UpdateContextRequest.d.ts +49 -0
  54. package/api/resources/contexts/resources/admin/client/requests/UpdateContextRequest.js +12 -0
  55. package/api/resources/contexts/resources/admin/client/requests/index.d.ts +4 -0
  56. package/api/resources/contexts/resources/admin/client/requests/index.js +2 -0
  57. package/api/resources/contexts/resources/admin/index.d.ts +1 -0
  58. package/api/resources/contexts/resources/admin/index.js +17 -0
  59. package/api/resources/contexts/resources/index.d.ts +4 -0
  60. package/api/resources/contexts/resources/index.js +43 -0
  61. package/api/resources/contexts/resources/relationships/client/Client.d.ts +67 -0
  62. package/api/resources/contexts/resources/relationships/client/Client.js +252 -0
  63. package/api/resources/contexts/resources/relationships/client/index.d.ts +1 -0
  64. package/api/resources/contexts/resources/relationships/client/index.js +17 -0
  65. package/api/resources/contexts/resources/relationships/client/requests/CreateRelationshipRequest.d.ts +33 -0
  66. package/api/resources/contexts/resources/relationships/client/requests/CreateRelationshipRequest.js +13 -0
  67. package/api/resources/contexts/resources/relationships/client/requests/DeleteRelationshipsRequest.d.ts +13 -0
  68. package/api/resources/contexts/resources/relationships/client/requests/DeleteRelationshipsRequest.js +3 -0
  69. package/api/resources/contexts/resources/relationships/client/requests/ListRelationshipsRequest.d.ts +10 -0
  70. package/api/resources/contexts/resources/relationships/client/requests/ListRelationshipsRequest.js +3 -0
  71. package/api/resources/contexts/resources/relationships/client/requests/index.d.ts +3 -0
  72. package/api/resources/contexts/resources/relationships/client/requests/index.js +2 -0
  73. package/api/resources/contexts/resources/relationships/index.d.ts +1 -0
  74. package/api/resources/contexts/resources/relationships/index.js +17 -0
  75. package/api/resources/index.d.ts +4 -0
  76. package/api/resources/index.js +8 -4
  77. package/api/resources/users/client/Client.d.ts +3 -3
  78. package/api/resources/users/client/Client.js +3 -3
  79. package/api/resources/users/client/requests/CreateUserRequest.d.ts +3 -3
  80. package/api/resources/users/client/requests/UserInviteRequest.d.ts +6 -6
  81. package/api/resources/values/client/Client.d.ts +3 -3
  82. package/api/resources/values/client/Client.js +3 -3
  83. package/api/resources/values/client/requests/UpdateValuesRequest.d.ts +6 -6
  84. package/api/types/CascadeContextResponse.d.ts +10 -0
  85. package/api/types/CascadeContextResponse.js +3 -0
  86. package/api/types/CascadeResult.d.ts +29 -0
  87. package/api/types/CascadeResult.js +12 -0
  88. package/api/types/ContextBase.d.ts +33 -0
  89. package/api/types/ContextBase.js +12 -0
  90. package/api/types/ContextDetail.d.ts +58 -0
  91. package/api/types/ContextDetail.js +3 -0
  92. package/api/types/ContextInstanceHistory.d.ts +10 -0
  93. package/api/types/ContextInstanceHistory.js +3 -0
  94. package/api/types/ContextInstanceHistoryEntry.d.ts +9 -0
  95. package/api/types/ContextInstanceHistoryEntry.js +3 -0
  96. package/api/types/ContextInstancePendingEvaluation.d.ts +29 -0
  97. package/api/types/ContextInstancePendingEvaluation.js +12 -0
  98. package/api/types/ContextInstancePendingResponse.d.ts +8 -0
  99. package/api/types/ContextInstancePendingResponse.js +3 -0
  100. package/api/types/ContextInstanceState.d.ts +31 -0
  101. package/api/types/ContextInstanceState.js +12 -0
  102. package/api/types/ContextListResponse.d.ts +2 -0
  103. package/api/types/ContextListResponse.js +3 -0
  104. package/api/types/ContextRelationshipBase.d.ts +21 -0
  105. package/api/types/ContextRelationshipBase.js +13 -0
  106. package/api/types/ContextRelationshipIncoming.d.ts +11 -0
  107. package/api/types/ContextRelationshipIncoming.js +3 -0
  108. package/api/types/ContextRelationshipOutgoing.d.ts +11 -0
  109. package/api/types/ContextRelationshipOutgoing.js +3 -0
  110. package/api/types/ContextRelationshipsResponse.d.ts +5 -0
  111. package/api/types/ContextRelationshipsResponse.js +3 -0
  112. package/api/types/ContextSchema.d.ts +10 -0
  113. package/api/types/ContextSchema.js +3 -0
  114. package/api/types/ContextSchemaField.d.ts +35 -0
  115. package/api/types/ContextSchemaField.js +16 -0
  116. package/api/types/CreateContextResponse.d.ts +2 -0
  117. package/api/types/CreateContextResponse.js +3 -0
  118. package/api/types/CreateRelationshipResponse.d.ts +2 -0
  119. package/api/types/CreateRelationshipResponse.js +3 -0
  120. package/api/types/CreateUserResponse.d.ts +3 -3
  121. package/api/types/DeleteContextInstanceResponse.d.ts +9 -0
  122. package/api/types/DeleteContextInstanceResponse.js +3 -0
  123. package/api/types/DeleteContextResponse.d.ts +13 -0
  124. package/api/types/DeleteContextResponse.js +3 -0
  125. package/api/types/DeleteRelationshipResponse.d.ts +4 -0
  126. package/api/types/DeleteRelationshipResponse.js +3 -0
  127. package/api/types/DynamicValue.d.ts +9 -3
  128. package/api/types/ExportManifestPreviewResponse.d.ts +51 -0
  129. package/api/types/ExportManifestPreviewResponse.js +3 -0
  130. package/api/types/ExportManifestResponse.d.ts +9 -0
  131. package/api/types/ExportManifestResponse.js +3 -0
  132. package/api/types/FlowDetail.d.ts +28 -0
  133. package/api/types/Folder.d.ts +1 -1
  134. package/api/types/ImportManifestResponse.d.ts +38 -0
  135. package/api/types/ImportManifestResponse.js +3 -0
  136. package/api/types/RuleDetail.d.ts +17 -0
  137. package/api/types/SolveContextFlowResponse.d.ts +23 -0
  138. package/api/types/SolveContextFlowResponse.js +12 -0
  139. package/api/types/SolveContextRuleResponse.d.ts +26 -0
  140. package/api/types/SolveContextRuleResponse.js +12 -0
  141. package/api/types/SubmitContextDataRequest.d.ts +4 -0
  142. package/api/types/SubmitContextDataRequest.js +3 -0
  143. package/api/types/SubmitContextDataResponse.d.ts +30 -0
  144. package/api/types/SubmitContextDataResponse.js +12 -0
  145. package/api/types/UpdateContextResponse.d.ts +2 -0
  146. package/api/types/UpdateContextResponse.js +3 -0
  147. package/api/types/UserDetail.d.ts +4 -4
  148. package/api/types/UserInviteResponse.d.ts +2 -2
  149. package/api/types/index.d.ts +29 -0
  150. package/api/types/index.js +29 -0
  151. package/dist/Client.d.ts +3 -0
  152. package/dist/Client.js +17 -12
  153. package/dist/api/resources/assets/client/Client.d.ts +55 -1
  154. package/dist/api/resources/assets/client/Client.js +135 -0
  155. package/dist/api/resources/assets/client/index.d.ts +1 -1
  156. package/dist/api/resources/assets/client/index.js +15 -0
  157. package/dist/api/resources/assets/client/requests/ExportManifestRequest.d.ts +23 -0
  158. package/dist/api/resources/assets/client/requests/ExportManifestRequest.js +3 -0
  159. package/dist/api/resources/assets/client/requests/ImportManifestRequest.d.ts +48 -0
  160. package/dist/api/resources/assets/client/requests/ImportManifestRequest.js +3 -0
  161. package/dist/api/resources/assets/client/requests/index.d.ts +2 -0
  162. package/dist/api/resources/assets/client/requests/index.js +2 -0
  163. package/dist/api/resources/assets/index.d.ts +1 -0
  164. package/dist/api/resources/assets/index.js +1 -0
  165. package/dist/api/resources/assets/types/ExportAssetsResponse.d.ts +2 -0
  166. package/dist/api/resources/assets/types/ExportAssetsResponse.js +3 -0
  167. package/dist/api/resources/assets/types/index.d.ts +1 -0
  168. package/dist/api/resources/assets/types/index.js +17 -0
  169. package/dist/api/resources/contexts/client/Client.d.ts +167 -0
  170. package/dist/api/resources/contexts/client/Client.js +563 -0
  171. package/dist/api/resources/contexts/client/index.d.ts +1 -0
  172. package/dist/api/resources/contexts/client/index.js +17 -0
  173. package/dist/api/resources/contexts/client/requests/CascadeContextRequest.d.ts +15 -0
  174. package/dist/api/resources/contexts/client/requests/CascadeContextRequest.js +3 -0
  175. package/dist/api/resources/contexts/client/requests/DeleteInstanceContextsRequest.d.ts +13 -0
  176. package/dist/api/resources/contexts/client/requests/DeleteInstanceContextsRequest.js +3 -0
  177. package/dist/api/resources/contexts/client/requests/GetHistoryContextsRequest.d.ts +17 -0
  178. package/dist/api/resources/contexts/client/requests/GetHistoryContextsRequest.js +3 -0
  179. package/dist/api/resources/contexts/client/requests/GetInstanceContextsRequest.d.ts +13 -0
  180. package/dist/api/resources/contexts/client/requests/GetInstanceContextsRequest.js +3 -0
  181. package/dist/api/resources/contexts/client/requests/GetPendingContextsRequest.d.ts +13 -0
  182. package/dist/api/resources/contexts/client/requests/GetPendingContextsRequest.js +3 -0
  183. package/dist/api/resources/contexts/client/requests/SolveContextFlowRequest.d.ts +20 -0
  184. package/dist/api/resources/contexts/client/requests/SolveContextFlowRequest.js +3 -0
  185. package/dist/api/resources/contexts/client/requests/SolveContextRuleRequest.d.ts +20 -0
  186. package/dist/api/resources/contexts/client/requests/SolveContextRuleRequest.js +3 -0
  187. package/dist/api/resources/contexts/client/requests/SubmitContextsRequest.d.ts +19 -0
  188. package/dist/api/resources/contexts/client/requests/SubmitContextsRequest.js +3 -0
  189. package/dist/api/resources/contexts/client/requests/index.d.ts +8 -0
  190. package/dist/api/resources/contexts/client/requests/index.js +2 -0
  191. package/dist/api/resources/contexts/index.d.ts +2 -0
  192. package/dist/api/resources/contexts/index.js +18 -0
  193. package/dist/api/resources/contexts/resources/admin/client/Client.d.ts +102 -0
  194. package/dist/api/resources/contexts/resources/admin/client/Client.js +353 -0
  195. package/dist/api/resources/contexts/resources/admin/client/index.d.ts +1 -0
  196. package/dist/api/resources/contexts/resources/admin/client/index.js +17 -0
  197. package/dist/api/resources/contexts/resources/admin/client/requests/CreateContextRequest.d.ts +55 -0
  198. package/dist/api/resources/contexts/resources/admin/client/requests/CreateContextRequest.js +12 -0
  199. package/dist/api/resources/contexts/resources/admin/client/requests/DeleteAdminRequest.d.ts +10 -0
  200. package/dist/api/resources/contexts/resources/admin/client/requests/DeleteAdminRequest.js +3 -0
  201. package/dist/api/resources/contexts/resources/admin/client/requests/GetAdminRequest.d.ts +10 -0
  202. package/dist/api/resources/contexts/resources/admin/client/requests/GetAdminRequest.js +3 -0
  203. package/dist/api/resources/contexts/resources/admin/client/requests/UpdateContextRequest.d.ts +49 -0
  204. package/dist/api/resources/contexts/resources/admin/client/requests/UpdateContextRequest.js +12 -0
  205. package/dist/api/resources/contexts/resources/admin/client/requests/index.d.ts +4 -0
  206. package/dist/api/resources/contexts/resources/admin/client/requests/index.js +2 -0
  207. package/dist/api/resources/contexts/resources/admin/index.d.ts +1 -0
  208. package/dist/api/resources/contexts/resources/admin/index.js +17 -0
  209. package/dist/api/resources/contexts/resources/index.d.ts +4 -0
  210. package/dist/api/resources/contexts/resources/index.js +43 -0
  211. package/dist/api/resources/contexts/resources/relationships/client/Client.d.ts +67 -0
  212. package/dist/api/resources/contexts/resources/relationships/client/Client.js +252 -0
  213. package/dist/api/resources/contexts/resources/relationships/client/index.d.ts +1 -0
  214. package/dist/api/resources/contexts/resources/relationships/client/index.js +17 -0
  215. package/dist/api/resources/contexts/resources/relationships/client/requests/CreateRelationshipRequest.d.ts +33 -0
  216. package/dist/api/resources/contexts/resources/relationships/client/requests/CreateRelationshipRequest.js +13 -0
  217. package/dist/api/resources/contexts/resources/relationships/client/requests/DeleteRelationshipsRequest.d.ts +13 -0
  218. package/dist/api/resources/contexts/resources/relationships/client/requests/DeleteRelationshipsRequest.js +3 -0
  219. package/dist/api/resources/contexts/resources/relationships/client/requests/ListRelationshipsRequest.d.ts +10 -0
  220. package/dist/api/resources/contexts/resources/relationships/client/requests/ListRelationshipsRequest.js +3 -0
  221. package/dist/api/resources/contexts/resources/relationships/client/requests/index.d.ts +3 -0
  222. package/dist/api/resources/contexts/resources/relationships/client/requests/index.js +2 -0
  223. package/dist/api/resources/contexts/resources/relationships/index.d.ts +1 -0
  224. package/dist/api/resources/contexts/resources/relationships/index.js +17 -0
  225. package/dist/api/resources/index.d.ts +4 -0
  226. package/dist/api/resources/index.js +8 -4
  227. package/dist/api/resources/users/client/Client.d.ts +3 -3
  228. package/dist/api/resources/users/client/Client.js +3 -3
  229. package/dist/api/resources/users/client/requests/CreateUserRequest.d.ts +3 -3
  230. package/dist/api/resources/users/client/requests/UserInviteRequest.d.ts +6 -6
  231. package/dist/api/resources/values/client/Client.d.ts +3 -3
  232. package/dist/api/resources/values/client/Client.js +3 -3
  233. package/dist/api/resources/values/client/requests/UpdateValuesRequest.d.ts +6 -6
  234. package/dist/api/types/CascadeContextResponse.d.ts +10 -0
  235. package/dist/api/types/CascadeContextResponse.js +3 -0
  236. package/dist/api/types/CascadeResult.d.ts +29 -0
  237. package/dist/api/types/CascadeResult.js +12 -0
  238. package/dist/api/types/ContextBase.d.ts +33 -0
  239. package/dist/api/types/ContextBase.js +12 -0
  240. package/dist/api/types/ContextDetail.d.ts +58 -0
  241. package/dist/api/types/ContextDetail.js +3 -0
  242. package/dist/api/types/ContextInstanceHistory.d.ts +10 -0
  243. package/dist/api/types/ContextInstanceHistory.js +3 -0
  244. package/dist/api/types/ContextInstanceHistoryEntry.d.ts +9 -0
  245. package/dist/api/types/ContextInstanceHistoryEntry.js +3 -0
  246. package/dist/api/types/ContextInstancePendingEvaluation.d.ts +29 -0
  247. package/dist/api/types/ContextInstancePendingEvaluation.js +12 -0
  248. package/dist/api/types/ContextInstancePendingResponse.d.ts +8 -0
  249. package/dist/api/types/ContextInstancePendingResponse.js +3 -0
  250. package/dist/api/types/ContextInstanceState.d.ts +31 -0
  251. package/dist/api/types/ContextInstanceState.js +12 -0
  252. package/dist/api/types/ContextListResponse.d.ts +2 -0
  253. package/dist/api/types/ContextListResponse.js +3 -0
  254. package/dist/api/types/ContextRelationshipBase.d.ts +21 -0
  255. package/dist/api/types/ContextRelationshipBase.js +13 -0
  256. package/dist/api/types/ContextRelationshipIncoming.d.ts +11 -0
  257. package/dist/api/types/ContextRelationshipIncoming.js +3 -0
  258. package/dist/api/types/ContextRelationshipOutgoing.d.ts +11 -0
  259. package/dist/api/types/ContextRelationshipOutgoing.js +3 -0
  260. package/dist/api/types/ContextRelationshipsResponse.d.ts +5 -0
  261. package/dist/api/types/ContextRelationshipsResponse.js +3 -0
  262. package/dist/api/types/ContextSchema.d.ts +10 -0
  263. package/dist/api/types/ContextSchema.js +3 -0
  264. package/dist/api/types/ContextSchemaField.d.ts +35 -0
  265. package/dist/api/types/ContextSchemaField.js +16 -0
  266. package/dist/api/types/CreateContextResponse.d.ts +2 -0
  267. package/dist/api/types/CreateContextResponse.js +3 -0
  268. package/dist/api/types/CreateRelationshipResponse.d.ts +2 -0
  269. package/dist/api/types/CreateRelationshipResponse.js +3 -0
  270. package/dist/api/types/CreateUserResponse.d.ts +3 -3
  271. package/dist/api/types/DeleteContextInstanceResponse.d.ts +9 -0
  272. package/dist/api/types/DeleteContextInstanceResponse.js +3 -0
  273. package/dist/api/types/DeleteContextResponse.d.ts +13 -0
  274. package/dist/api/types/DeleteContextResponse.js +3 -0
  275. package/dist/api/types/DeleteRelationshipResponse.d.ts +4 -0
  276. package/dist/api/types/DeleteRelationshipResponse.js +3 -0
  277. package/dist/api/types/DynamicValue.d.ts +9 -3
  278. package/dist/api/types/ExportManifestPreviewResponse.d.ts +51 -0
  279. package/dist/api/types/ExportManifestPreviewResponse.js +3 -0
  280. package/dist/api/types/ExportManifestResponse.d.ts +9 -0
  281. package/dist/api/types/ExportManifestResponse.js +3 -0
  282. package/dist/api/types/FlowDetail.d.ts +28 -0
  283. package/dist/api/types/Folder.d.ts +1 -1
  284. package/dist/api/types/ImportManifestResponse.d.ts +38 -0
  285. package/dist/api/types/ImportManifestResponse.js +3 -0
  286. package/dist/api/types/RuleDetail.d.ts +17 -0
  287. package/dist/api/types/SolveContextFlowResponse.d.ts +23 -0
  288. package/dist/api/types/SolveContextFlowResponse.js +12 -0
  289. package/dist/api/types/SolveContextRuleResponse.d.ts +26 -0
  290. package/dist/api/types/SolveContextRuleResponse.js +12 -0
  291. package/dist/api/types/SubmitContextDataRequest.d.ts +4 -0
  292. package/dist/api/types/SubmitContextDataRequest.js +3 -0
  293. package/dist/api/types/SubmitContextDataResponse.d.ts +30 -0
  294. package/dist/api/types/SubmitContextDataResponse.js +12 -0
  295. package/dist/api/types/UpdateContextResponse.d.ts +2 -0
  296. package/dist/api/types/UpdateContextResponse.js +3 -0
  297. package/dist/api/types/UserDetail.d.ts +4 -4
  298. package/dist/api/types/UserInviteResponse.d.ts +2 -2
  299. package/dist/api/types/index.d.ts +29 -0
  300. package/dist/api/types/index.js +29 -0
  301. package/dist/forge/values.d.ts +1 -1
  302. package/dist/forge/values.js +2 -2
  303. package/forge/values.d.ts +1 -1
  304. package/forge/values.js +2 -2
  305. package/package.json +1 -2
@@ -0,0 +1,55 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * name: "Customer",
5
+ * description: "Represents a customer in the system",
6
+ * schema: [{
7
+ * key: "email",
8
+ * name: "Email",
9
+ * type: "string"
10
+ * }, {
11
+ * key: "age",
12
+ * name: "Age",
13
+ * type: "number"
14
+ * }]
15
+ * }
16
+ */
17
+ export interface CreateContextRequest {
18
+ /** The name of the context. */
19
+ name: string;
20
+ /** Optional custom slug. Auto-generated if not provided. */
21
+ slug?: string;
22
+ /** The description of the context. */
23
+ description?: string;
24
+ /** Initial schema fields for the context. */
25
+ schema?: CreateContextRequest.Schema.Item[];
26
+ /** When true (default), bound rules and flows automatically execute when their inputs are satisfied. */
27
+ auto_execute_decisions?: boolean;
28
+ /** Time-to-live in seconds for live context instances. Instances expire after this duration. */
29
+ ttl_seconds?: number | null;
30
+ /** Maximum number of history entries to retain per field. */
31
+ history_limit?: number;
32
+ /** How to handle fields that don't match the schema. */
33
+ on_schema_mismatch?: CreateContextRequest.OnSchemaMismatch;
34
+ /** Webhook URL called when a rule or flow successfully solves. */
35
+ webhook_on_solve?: string;
36
+ /** Webhook URL called when a live context expires due to TTL. */
37
+ webhook_on_expire?: string;
38
+ }
39
+ export declare namespace CreateContextRequest {
40
+ type Schema = Schema.Item[];
41
+ namespace Schema {
42
+ interface Item {
43
+ key?: string;
44
+ name?: string;
45
+ type?: string;
46
+ defaultValue?: unknown;
47
+ }
48
+ }
49
+ /** How to handle fields that don't match the schema. */
50
+ const OnSchemaMismatch: {
51
+ readonly Ignore: "ignore";
52
+ readonly Reject: "reject";
53
+ };
54
+ type OnSchemaMismatch = (typeof OnSchemaMismatch)[keyof typeof OnSchemaMismatch];
55
+ }
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.CreateContextRequest = void 0;
5
+ var CreateContextRequest;
6
+ (function (CreateContextRequest) {
7
+ /** How to handle fields that don't match the schema. */
8
+ CreateContextRequest.OnSchemaMismatch = {
9
+ Ignore: "ignore",
10
+ Reject: "reject",
11
+ };
12
+ })(CreateContextRequest || (exports.CreateContextRequest = CreateContextRequest = {}));
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * id: "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
5
+ * }
6
+ */
7
+ export interface DeleteAdminRequest {
8
+ /** The unique identifier for the context. */
9
+ id: string;
10
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * id: "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
5
+ * }
6
+ */
7
+ export interface GetAdminRequest {
8
+ /** The unique identifier for the context. */
9
+ id: string;
10
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,49 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * id: "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
5
+ * name: "Updated Customer",
6
+ * description: "Updated description for premium customers"
7
+ * }
8
+ */
9
+ export interface UpdateContextRequest {
10
+ /** The unique identifier for the context. */
11
+ id: string;
12
+ /** The name of the context. */
13
+ name?: string;
14
+ /** The slug of the context. */
15
+ slug?: string;
16
+ /** The description of the context. */
17
+ description?: string;
18
+ /** Updated schema fields for the context. */
19
+ schema?: UpdateContextRequest.Schema.Item[];
20
+ /** When true, bound rules and flows automatically execute when their inputs are satisfied. */
21
+ auto_execute_decisions?: boolean;
22
+ /** Time-to-live in seconds for live context instances. Instances expire after this duration. */
23
+ ttl_seconds?: number | null;
24
+ /** Maximum number of history entries to retain per field. */
25
+ history_limit?: number;
26
+ /** How to handle fields that don't match the schema. */
27
+ on_schema_mismatch?: UpdateContextRequest.OnSchemaMismatch;
28
+ /** Webhook URL called when a rule or flow successfully solves. */
29
+ webhook_on_solve?: string | null;
30
+ /** Webhook URL called when a live context expires due to TTL. */
31
+ webhook_on_expire?: string | null;
32
+ }
33
+ export declare namespace UpdateContextRequest {
34
+ type Schema = Schema.Item[];
35
+ namespace Schema {
36
+ interface Item {
37
+ key?: string;
38
+ name?: string;
39
+ type?: string;
40
+ defaultValue?: unknown;
41
+ }
42
+ }
43
+ /** How to handle fields that don't match the schema. */
44
+ const OnSchemaMismatch: {
45
+ readonly Ignore: "ignore";
46
+ readonly Reject: "reject";
47
+ };
48
+ type OnSchemaMismatch = (typeof OnSchemaMismatch)[keyof typeof OnSchemaMismatch];
49
+ }
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.UpdateContextRequest = void 0;
5
+ var UpdateContextRequest;
6
+ (function (UpdateContextRequest) {
7
+ /** How to handle fields that don't match the schema. */
8
+ UpdateContextRequest.OnSchemaMismatch = {
9
+ Ignore: "ignore",
10
+ Reject: "reject",
11
+ };
12
+ })(UpdateContextRequest || (exports.UpdateContextRequest = UpdateContextRequest = {}));
@@ -0,0 +1,4 @@
1
+ export type { CreateContextRequest } from "./CreateContextRequest.js";
2
+ export type { DeleteAdminRequest } from "./DeleteAdminRequest.js";
3
+ export type { GetAdminRequest } from "./GetAdminRequest.js";
4
+ export type { UpdateContextRequest } from "./UpdateContextRequest.js";
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1 @@
1
+ export * from "./client/index.js";
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./client/index.js"), exports);
@@ -0,0 +1,4 @@
1
+ export * from "./admin/client/requests/index.js";
2
+ export * as admin from "./admin/index.js";
3
+ export * from "./relationships/client/requests/index.js";
4
+ export * as relationships from "./relationships/index.js";
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
19
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
20
+ };
21
+ var __importStar = (this && this.__importStar) || (function () {
22
+ var ownKeys = function(o) {
23
+ ownKeys = Object.getOwnPropertyNames || function (o) {
24
+ var ar = [];
25
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
26
+ return ar;
27
+ };
28
+ return ownKeys(o);
29
+ };
30
+ return function (mod) {
31
+ if (mod && mod.__esModule) return mod;
32
+ var result = {};
33
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
34
+ __setModuleDefault(result, mod);
35
+ return result;
36
+ };
37
+ })();
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.relationships = exports.admin = void 0;
40
+ __exportStar(require("./admin/client/requests/index.js"), exports);
41
+ exports.admin = __importStar(require("./admin/index.js"));
42
+ __exportStar(require("./relationships/client/requests/index.js"), exports);
43
+ exports.relationships = __importStar(require("./relationships/index.js"));
@@ -0,0 +1,67 @@
1
+ import type { BaseClientOptions, BaseRequestOptions } from "../../../../../../BaseClient.js";
2
+ import { type NormalizedClientOptionsWithAuth } from "../../../../../../BaseClient.js";
3
+ import * as core from "../../../../../../core/index.js";
4
+ import * as Rulebricks from "../../../../../index.js";
5
+ export declare namespace RelationshipsClient {
6
+ type Options = BaseClientOptions;
7
+ interface RequestOptions extends BaseRequestOptions {
8
+ }
9
+ }
10
+ export declare class RelationshipsClient {
11
+ protected readonly _options: NormalizedClientOptionsWithAuth<RelationshipsClient.Options>;
12
+ constructor(options: RelationshipsClient.Options);
13
+ /**
14
+ * List all relationships for a specific context.
15
+ *
16
+ * @param {Rulebricks.contexts.ListRelationshipsRequest} request
17
+ * @param {RelationshipsClient.RequestOptions} requestOptions - Request-specific configuration.
18
+ *
19
+ * @throws {@link Rulebricks.NotFoundError}
20
+ * @throws {@link Rulebricks.InternalServerError}
21
+ *
22
+ * @example
23
+ * await client.contexts.relationships.list({
24
+ * id: "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
25
+ * })
26
+ */
27
+ list(request: Rulebricks.contexts.ListRelationshipsRequest, requestOptions?: RelationshipsClient.RequestOptions): core.HttpResponsePromise<Rulebricks.ContextRelationshipsResponse>;
28
+ private __list;
29
+ /**
30
+ * Create a new relationship between two contexts.
31
+ *
32
+ * @param {Rulebricks.contexts.CreateRelationshipRequest} request
33
+ * @param {RelationshipsClient.RequestOptions} requestOptions - Request-specific configuration.
34
+ *
35
+ * @throws {@link Rulebricks.BadRequestError}
36
+ * @throws {@link Rulebricks.NotFoundError}
37
+ * @throws {@link Rulebricks.InternalServerError}
38
+ *
39
+ * @example
40
+ * await client.contexts.relationships.create({
41
+ * id: "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
42
+ * targetContextId: "b2c3d4e5-f6a7-8901-bcde-f12345678901",
43
+ * type: "one-to-many",
44
+ * foreignKey: "customer_id",
45
+ * name: "Customer Orders"
46
+ * })
47
+ */
48
+ create(request: Rulebricks.contexts.CreateRelationshipRequest, requestOptions?: RelationshipsClient.RequestOptions): core.HttpResponsePromise<Rulebricks.CreateRelationshipResponse>;
49
+ private __create;
50
+ /**
51
+ * Delete a specific relationship between contexts.
52
+ *
53
+ * @param {Rulebricks.contexts.DeleteRelationshipsRequest} request
54
+ * @param {RelationshipsClient.RequestOptions} requestOptions - Request-specific configuration.
55
+ *
56
+ * @throws {@link Rulebricks.NotFoundError}
57
+ * @throws {@link Rulebricks.InternalServerError}
58
+ *
59
+ * @example
60
+ * await client.contexts.relationships.delete({
61
+ * id: "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
62
+ * relationship: "c3d4e5f6-a7b8-9012-cdef-123456789012"
63
+ * })
64
+ */
65
+ delete(request: Rulebricks.contexts.DeleteRelationshipsRequest, requestOptions?: RelationshipsClient.RequestOptions): core.HttpResponsePromise<Rulebricks.DeleteRelationshipResponse>;
66
+ private __delete;
67
+ }
@@ -0,0 +1,252 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
36
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
37
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
38
+ return new (P || (P = Promise))(function (resolve, reject) {
39
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
40
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
41
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
42
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
43
+ });
44
+ };
45
+ var __rest = (this && this.__rest) || function (s, e) {
46
+ var t = {};
47
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
48
+ t[p] = s[p];
49
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
50
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
51
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
52
+ t[p[i]] = s[p[i]];
53
+ }
54
+ return t;
55
+ };
56
+ Object.defineProperty(exports, "__esModule", { value: true });
57
+ exports.RelationshipsClient = void 0;
58
+ const BaseClient_js_1 = require("../../../../../../BaseClient.js");
59
+ const headers_js_1 = require("../../../../../../core/headers.js");
60
+ const core = __importStar(require("../../../../../../core/index.js"));
61
+ const environments = __importStar(require("../../../../../../environments.js"));
62
+ const handleNonStatusCodeError_js_1 = require("../../../../../../errors/handleNonStatusCodeError.js");
63
+ const errors = __importStar(require("../../../../../../errors/index.js"));
64
+ const Rulebricks = __importStar(require("../../../../../index.js"));
65
+ class RelationshipsClient {
66
+ constructor(options) {
67
+ this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
68
+ }
69
+ /**
70
+ * List all relationships for a specific context.
71
+ *
72
+ * @param {Rulebricks.contexts.ListRelationshipsRequest} request
73
+ * @param {RelationshipsClient.RequestOptions} requestOptions - Request-specific configuration.
74
+ *
75
+ * @throws {@link Rulebricks.NotFoundError}
76
+ * @throws {@link Rulebricks.InternalServerError}
77
+ *
78
+ * @example
79
+ * await client.contexts.relationships.list({
80
+ * id: "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
81
+ * })
82
+ */
83
+ list(request, requestOptions) {
84
+ return core.HttpResponsePromise.fromPromise(this.__list(request, requestOptions));
85
+ }
86
+ __list(request, requestOptions) {
87
+ return __awaiter(this, void 0, void 0, function* () {
88
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
89
+ const { id } = request;
90
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
91
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
92
+ const _response = yield core.fetcher({
93
+ url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.RulebricksEnvironment.Default, `admin/contexts/${core.url.encodePathParam(id)}/relationships`),
94
+ method: "GET",
95
+ headers: _headers,
96
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
97
+ timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
98
+ maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
99
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
100
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
101
+ logging: this._options.logging,
102
+ });
103
+ if (_response.ok) {
104
+ return {
105
+ data: _response.body,
106
+ rawResponse: _response.rawResponse,
107
+ };
108
+ }
109
+ if (_response.error.reason === "status-code") {
110
+ switch (_response.error.statusCode) {
111
+ case 404:
112
+ throw new Rulebricks.NotFoundError(_response.error.body, _response.rawResponse);
113
+ case 500:
114
+ throw new Rulebricks.InternalServerError(_response.error.body, _response.rawResponse);
115
+ default:
116
+ throw new errors.RulebricksError({
117
+ statusCode: _response.error.statusCode,
118
+ body: _response.error.body,
119
+ rawResponse: _response.rawResponse,
120
+ });
121
+ }
122
+ }
123
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/admin/contexts/{id}/relationships");
124
+ });
125
+ }
126
+ /**
127
+ * Create a new relationship between two contexts.
128
+ *
129
+ * @param {Rulebricks.contexts.CreateRelationshipRequest} request
130
+ * @param {RelationshipsClient.RequestOptions} requestOptions - Request-specific configuration.
131
+ *
132
+ * @throws {@link Rulebricks.BadRequestError}
133
+ * @throws {@link Rulebricks.NotFoundError}
134
+ * @throws {@link Rulebricks.InternalServerError}
135
+ *
136
+ * @example
137
+ * await client.contexts.relationships.create({
138
+ * id: "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
139
+ * targetContextId: "b2c3d4e5-f6a7-8901-bcde-f12345678901",
140
+ * type: "one-to-many",
141
+ * foreignKey: "customer_id",
142
+ * name: "Customer Orders"
143
+ * })
144
+ */
145
+ create(request, requestOptions) {
146
+ return core.HttpResponsePromise.fromPromise(this.__create(request, requestOptions));
147
+ }
148
+ __create(request, requestOptions) {
149
+ return __awaiter(this, void 0, void 0, function* () {
150
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
151
+ const { id } = request, _body = __rest(request, ["id"]);
152
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
153
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
154
+ const _response = yield core.fetcher({
155
+ url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.RulebricksEnvironment.Default, `admin/contexts/${core.url.encodePathParam(id)}/relationships`),
156
+ method: "POST",
157
+ headers: _headers,
158
+ contentType: "application/json",
159
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
160
+ requestType: "json",
161
+ body: _body,
162
+ timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
163
+ maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
164
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
165
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
166
+ logging: this._options.logging,
167
+ });
168
+ if (_response.ok) {
169
+ return {
170
+ data: _response.body,
171
+ rawResponse: _response.rawResponse,
172
+ };
173
+ }
174
+ if (_response.error.reason === "status-code") {
175
+ switch (_response.error.statusCode) {
176
+ case 400:
177
+ throw new Rulebricks.BadRequestError(_response.error.body, _response.rawResponse);
178
+ case 404:
179
+ throw new Rulebricks.NotFoundError(_response.error.body, _response.rawResponse);
180
+ case 500:
181
+ throw new Rulebricks.InternalServerError(_response.error.body, _response.rawResponse);
182
+ default:
183
+ throw new errors.RulebricksError({
184
+ statusCode: _response.error.statusCode,
185
+ body: _response.error.body,
186
+ rawResponse: _response.rawResponse,
187
+ });
188
+ }
189
+ }
190
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/admin/contexts/{id}/relationships");
191
+ });
192
+ }
193
+ /**
194
+ * Delete a specific relationship between contexts.
195
+ *
196
+ * @param {Rulebricks.contexts.DeleteRelationshipsRequest} request
197
+ * @param {RelationshipsClient.RequestOptions} requestOptions - Request-specific configuration.
198
+ *
199
+ * @throws {@link Rulebricks.NotFoundError}
200
+ * @throws {@link Rulebricks.InternalServerError}
201
+ *
202
+ * @example
203
+ * await client.contexts.relationships.delete({
204
+ * id: "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
205
+ * relationship: "c3d4e5f6-a7b8-9012-cdef-123456789012"
206
+ * })
207
+ */
208
+ delete(request, requestOptions) {
209
+ return core.HttpResponsePromise.fromPromise(this.__delete(request, requestOptions));
210
+ }
211
+ __delete(request, requestOptions) {
212
+ return __awaiter(this, void 0, void 0, function* () {
213
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
214
+ const { id, relationship } = request;
215
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
216
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
217
+ const _response = yield core.fetcher({
218
+ url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.RulebricksEnvironment.Default, `admin/contexts/${core.url.encodePathParam(id)}/relationships/${core.url.encodePathParam(relationship)}`),
219
+ method: "DELETE",
220
+ headers: _headers,
221
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
222
+ timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
223
+ maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
224
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
225
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
226
+ logging: this._options.logging,
227
+ });
228
+ if (_response.ok) {
229
+ return {
230
+ data: _response.body,
231
+ rawResponse: _response.rawResponse,
232
+ };
233
+ }
234
+ if (_response.error.reason === "status-code") {
235
+ switch (_response.error.statusCode) {
236
+ case 404:
237
+ throw new Rulebricks.NotFoundError(_response.error.body, _response.rawResponse);
238
+ case 500:
239
+ throw new Rulebricks.InternalServerError(_response.error.body, _response.rawResponse);
240
+ default:
241
+ throw new errors.RulebricksError({
242
+ statusCode: _response.error.statusCode,
243
+ body: _response.error.body,
244
+ rawResponse: _response.rawResponse,
245
+ });
246
+ }
247
+ }
248
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "DELETE", "/admin/contexts/{id}/relationships/{relationship}");
249
+ });
250
+ }
251
+ }
252
+ exports.RelationshipsClient = RelationshipsClient;
@@ -0,0 +1 @@
1
+ export * from "./requests/index.js";
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./requests/index.js"), exports);
@@ -0,0 +1,33 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * id: "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
5
+ * targetContextId: "b2c3d4e5-f6a7-8901-bcde-f12345678901",
6
+ * type: "one-to-many",
7
+ * foreignKey: "customer_id",
8
+ * name: "Customer Orders"
9
+ * }
10
+ */
11
+ export interface CreateRelationshipRequest {
12
+ /** The unique identifier for the context. */
13
+ id: string;
14
+ /** The ID of the target context. */
15
+ targetContextId: string;
16
+ /** The type of relationship. */
17
+ type: CreateRelationshipRequest.Type;
18
+ /** The field key to use as the foreign key. */
19
+ foreignKey: string;
20
+ /** Display name for the relationship. */
21
+ name?: string;
22
+ /** Description of the relationship. */
23
+ description?: string;
24
+ }
25
+ export declare namespace CreateRelationshipRequest {
26
+ /** The type of relationship. */
27
+ const Type: {
28
+ readonly OneToOne: "one-to-one";
29
+ readonly OneToMany: "one-to-many";
30
+ readonly ManyToOne: "many-to-one";
31
+ };
32
+ type Type = (typeof Type)[keyof typeof Type];
33
+ }
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.CreateRelationshipRequest = void 0;
5
+ var CreateRelationshipRequest;
6
+ (function (CreateRelationshipRequest) {
7
+ /** The type of relationship. */
8
+ CreateRelationshipRequest.Type = {
9
+ OneToOne: "one-to-one",
10
+ OneToMany: "one-to-many",
11
+ ManyToOne: "many-to-one",
12
+ };
13
+ })(CreateRelationshipRequest || (exports.CreateRelationshipRequest = CreateRelationshipRequest = {}));
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * id: "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
5
+ * relationship: "c3d4e5f6-a7b8-9012-cdef-123456789012"
6
+ * }
7
+ */
8
+ export interface DeleteRelationshipsRequest {
9
+ /** The unique identifier for the context. */
10
+ id: string;
11
+ /** The unique identifier for the relationship. */
12
+ relationship: string;
13
+ }