@rulebricks/sdk 1.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 (942) hide show
  1. package/Client.d.ts +26 -0
  2. package/Client.js +47 -0
  3. package/LICENSE.txt +21 -0
  4. package/README.md +83 -0
  5. package/api/errors/BadRequestError.d.ts +7 -0
  6. package/api/errors/BadRequestError.js +47 -0
  7. package/api/errors/ForbiddenError.d.ts +7 -0
  8. package/api/errors/ForbiddenError.js +47 -0
  9. package/api/errors/InternalServerError.d.ts +7 -0
  10. package/api/errors/InternalServerError.js +47 -0
  11. package/api/errors/NotFoundError.d.ts +7 -0
  12. package/api/errors/NotFoundError.js +47 -0
  13. package/api/errors/index.d.ts +1 -0
  14. package/api/errors/index.js +24 -0
  15. package/api/index.d.ts +1 -0
  16. package/api/index.js +23 -0
  17. package/api/resources/assets/client/Client.d.ts +100 -0
  18. package/api/resources/assets/client/Client.js +611 -0
  19. package/api/resources/assets/client/index.d.ts +1 -0
  20. package/api/resources/assets/client/index.js +21 -0
  21. package/api/resources/assets/client/requests/DeleteFolderRequest.d.ts +1 -0
  22. package/api/resources/assets/client/requests/DeleteFolderRequest.js +5 -0
  23. package/api/resources/assets/client/requests/DeleteRuleRequest.d.ts +1 -0
  24. package/api/resources/assets/client/requests/DeleteRuleRequest.js +5 -0
  25. package/api/resources/assets/client/requests/ExportRuleRequest.d.ts +1 -0
  26. package/api/resources/assets/client/requests/ExportRuleRequest.js +5 -0
  27. package/api/resources/assets/client/requests/ImportRuleRequest.d.ts +1 -0
  28. package/api/resources/assets/client/requests/ImportRuleRequest.js +5 -0
  29. package/api/resources/assets/client/requests/ListRulesRequest.d.ts +1 -0
  30. package/api/resources/assets/client/requests/ListRulesRequest.js +5 -0
  31. package/api/resources/assets/client/requests/UpsertFolderRequest.d.ts +1 -0
  32. package/api/resources/assets/client/requests/UpsertFolderRequest.js +5 -0
  33. package/api/resources/assets/client/requests/index.d.ts +1 -0
  34. package/api/resources/assets/client/requests/index.js +2 -0
  35. package/api/resources/assets/index.d.ts +1 -0
  36. package/api/resources/assets/index.js +22 -0
  37. package/api/resources/assets/types/DeleteFolderResponse.d.ts +1 -0
  38. package/api/resources/assets/types/DeleteFolderResponse.js +5 -0
  39. package/api/resources/assets/types/DeleteRuleResponse.d.ts +1 -0
  40. package/api/resources/assets/types/DeleteRuleResponse.js +5 -0
  41. package/api/resources/assets/types/ListFlowsResponseItem.d.ts +1 -0
  42. package/api/resources/assets/types/ListFlowsResponseItem.js +5 -0
  43. package/api/resources/assets/types/ListFoldersResponseItem.d.ts +1 -0
  44. package/api/resources/assets/types/ListFoldersResponseItem.js +5 -0
  45. package/api/resources/assets/types/ListRulesResponseItem.d.ts +1 -0
  46. package/api/resources/assets/types/ListRulesResponseItem.js +5 -0
  47. package/api/resources/assets/types/ListRulesResponseItemFolder.d.ts +1 -0
  48. package/api/resources/assets/types/ListRulesResponseItemFolder.js +5 -0
  49. package/api/resources/assets/types/UpsertFolderResponse.d.ts +1 -0
  50. package/api/resources/assets/types/UpsertFolderResponse.js +5 -0
  51. package/api/resources/assets/types/UsageResponse.d.ts +1 -0
  52. package/api/resources/assets/types/UsageResponse.js +5 -0
  53. package/api/resources/assets/types/index.d.ts +1 -0
  54. package/api/resources/assets/types/index.js +28 -0
  55. package/api/resources/decisions/client/Client.d.ts +19 -0
  56. package/api/resources/decisions/client/Client.js +146 -0
  57. package/api/resources/decisions/client/index.d.ts +1 -0
  58. package/api/resources/decisions/client/index.js +21 -0
  59. package/api/resources/decisions/client/requests/QueryRequest.d.ts +1 -0
  60. package/api/resources/decisions/client/requests/QueryRequest.js +5 -0
  61. package/api/resources/decisions/client/requests/index.d.ts +1 -0
  62. package/api/resources/decisions/client/requests/index.js +2 -0
  63. package/api/resources/decisions/index.d.ts +1 -0
  64. package/api/resources/decisions/index.js +22 -0
  65. package/api/resources/decisions/types/QueryResponse.d.ts +1 -0
  66. package/api/resources/decisions/types/QueryResponse.js +5 -0
  67. package/api/resources/decisions/types/index.d.ts +1 -0
  68. package/api/resources/decisions/types/index.js +21 -0
  69. package/api/resources/flows/client/Client.d.ts +21 -0
  70. package/api/resources/flows/client/Client.js +133 -0
  71. package/api/resources/flows/client/index.d.ts +1 -0
  72. package/api/resources/flows/client/index.js +2 -0
  73. package/api/resources/flows/index.d.ts +1 -0
  74. package/api/resources/flows/index.js +21 -0
  75. package/api/resources/index.d.ts +8 -0
  76. package/api/resources/index.js +54 -0
  77. package/api/resources/rules/client/Client.d.ts +60 -0
  78. package/api/resources/rules/client/Client.js +272 -0
  79. package/api/resources/rules/client/index.d.ts +1 -0
  80. package/api/resources/rules/client/index.js +2 -0
  81. package/api/resources/rules/index.d.ts +1 -0
  82. package/api/resources/rules/index.js +21 -0
  83. package/api/resources/tests/client/Client.d.ts +82 -0
  84. package/api/resources/tests/client/Client.js +439 -0
  85. package/api/resources/tests/client/index.d.ts +1 -0
  86. package/api/resources/tests/client/index.js +21 -0
  87. package/api/resources/tests/client/requests/CreateFlowTestRequest.d.ts +1 -0
  88. package/api/resources/tests/client/requests/CreateFlowTestRequest.js +5 -0
  89. package/api/resources/tests/client/requests/CreateRuleTestRequest.d.ts +1 -0
  90. package/api/resources/tests/client/requests/CreateRuleTestRequest.js +5 -0
  91. package/api/resources/tests/client/requests/index.d.ts +1 -0
  92. package/api/resources/tests/client/requests/index.js +2 -0
  93. package/api/resources/tests/index.d.ts +1 -0
  94. package/api/resources/tests/index.js +22 -0
  95. package/api/resources/tests/types/CreateFlowTestResponse.d.ts +1 -0
  96. package/api/resources/tests/types/CreateFlowTestResponse.js +5 -0
  97. package/api/resources/tests/types/CreateRuleTestResponse.d.ts +1 -0
  98. package/api/resources/tests/types/CreateRuleTestResponse.js +5 -0
  99. package/api/resources/tests/types/DeleteFlowTestResponse.d.ts +1 -0
  100. package/api/resources/tests/types/DeleteFlowTestResponse.js +5 -0
  101. package/api/resources/tests/types/DeleteRuleTestResponse.d.ts +1 -0
  102. package/api/resources/tests/types/DeleteRuleTestResponse.js +5 -0
  103. package/api/resources/tests/types/ListFlowTestsResponseItem.d.ts +1 -0
  104. package/api/resources/tests/types/ListFlowTestsResponseItem.js +5 -0
  105. package/api/resources/tests/types/ListRuleTestsResponseItem.d.ts +1 -0
  106. package/api/resources/tests/types/ListRuleTestsResponseItem.js +5 -0
  107. package/api/resources/tests/types/index.d.ts +1 -0
  108. package/api/resources/tests/types/index.js +26 -0
  109. package/api/resources/users/client/Client.d.ts +62 -0
  110. package/api/resources/users/client/Client.js +269 -0
  111. package/api/resources/users/client/index.d.ts +1 -0
  112. package/api/resources/users/client/index.js +21 -0
  113. package/api/resources/users/client/requests/CreateGroupRequest.d.ts +1 -0
  114. package/api/resources/users/client/requests/CreateGroupRequest.js +5 -0
  115. package/api/resources/users/client/requests/InviteRequest.d.ts +1 -0
  116. package/api/resources/users/client/requests/InviteRequest.js +5 -0
  117. package/api/resources/users/client/requests/index.d.ts +1 -0
  118. package/api/resources/users/client/requests/index.js +2 -0
  119. package/api/resources/users/index.d.ts +1 -0
  120. package/api/resources/users/index.js +22 -0
  121. package/api/resources/users/types/CreateGroupResponse.d.ts +1 -0
  122. package/api/resources/users/types/CreateGroupResponse.js +5 -0
  123. package/api/resources/users/types/InviteRequestRole.d.ts +5 -0
  124. package/api/resources/users/types/InviteRequestRole.js +10 -0
  125. package/api/resources/users/types/InviteResponse.d.ts +1 -0
  126. package/api/resources/users/types/InviteResponse.js +5 -0
  127. package/api/resources/users/types/ListGroupsResponseItem.d.ts +1 -0
  128. package/api/resources/users/types/ListGroupsResponseItem.js +5 -0
  129. package/api/resources/users/types/index.d.ts +1 -0
  130. package/api/resources/users/types/index.js +24 -0
  131. package/api/resources/values/client/Client.d.ts +37 -0
  132. package/api/resources/values/client/Client.js +255 -0
  133. package/api/resources/values/client/index.d.ts +1 -0
  134. package/api/resources/values/client/index.js +21 -0
  135. package/api/resources/values/client/requests/DeleteDynamicValueRequest.d.ts +1 -0
  136. package/api/resources/values/client/requests/DeleteDynamicValueRequest.js +5 -0
  137. package/api/resources/values/client/requests/ListDynamicValuesRequest.d.ts +1 -0
  138. package/api/resources/values/client/requests/ListDynamicValuesRequest.js +5 -0
  139. package/api/resources/values/client/requests/index.d.ts +1 -0
  140. package/api/resources/values/client/requests/index.js +2 -0
  141. package/api/resources/values/index.d.ts +1 -0
  142. package/api/resources/values/index.js +22 -0
  143. package/api/resources/values/types/DeleteDynamicValueResponse.d.ts +1 -0
  144. package/api/resources/values/types/DeleteDynamicValueResponse.js +5 -0
  145. package/api/resources/values/types/ListDynamicValuesResponseItem.d.ts +1 -0
  146. package/api/resources/values/types/ListDynamicValuesResponseItem.js +5 -0
  147. package/api/resources/values/types/ListDynamicValuesResponseItemType.d.ts +7 -0
  148. package/api/resources/values/types/ListDynamicValuesResponseItemType.js +12 -0
  149. package/api/resources/values/types/ListDynamicValuesResponseItemUsagesItem.d.ts +1 -0
  150. package/api/resources/values/types/ListDynamicValuesResponseItemUsagesItem.js +5 -0
  151. package/api/resources/values/types/ListDynamicValuesResponseItemValue.d.ts +1 -0
  152. package/api/resources/values/types/ListDynamicValuesResponseItemValue.js +5 -0
  153. package/api/resources/values/types/UpdateRequestValue.d.ts +1 -0
  154. package/api/resources/values/types/UpdateRequestValue.js +5 -0
  155. package/api/resources/values/types/UpdateResponseItem.d.ts +1 -0
  156. package/api/resources/values/types/UpdateResponseItem.js +5 -0
  157. package/api/resources/values/types/UpdateResponseItemType.d.ts +7 -0
  158. package/api/resources/values/types/UpdateResponseItemType.js +12 -0
  159. package/api/resources/values/types/UpdateResponseItemValue.d.ts +1 -0
  160. package/api/resources/values/types/UpdateResponseItemValue.js +5 -0
  161. package/api/resources/values/types/index.d.ts +1 -0
  162. package/api/resources/values/types/index.js +29 -0
  163. package/api/types/BadRequestErrorBody.d.ts +1 -0
  164. package/api/types/BadRequestErrorBody.js +5 -0
  165. package/api/types/ForbiddenErrorBody.d.ts +1 -0
  166. package/api/types/ForbiddenErrorBody.js +5 -0
  167. package/api/types/InternalServerErrorBody.d.ts +1 -0
  168. package/api/types/InternalServerErrorBody.js +5 -0
  169. package/api/types/NotFoundErrorBody.d.ts +1 -0
  170. package/api/types/NotFoundErrorBody.js +5 -0
  171. package/api/types/index.d.ts +1 -0
  172. package/api/types/index.js +24 -0
  173. package/banner.png +0 -0
  174. package/core/fetcher/APIResponse.d.ts +1 -0
  175. package/core/fetcher/APIResponse.js +2 -0
  176. package/core/fetcher/Fetcher.d.ts +3 -0
  177. package/core/fetcher/Fetcher.js +161 -0
  178. package/core/fetcher/Supplier.d.ts +4 -0
  179. package/core/fetcher/Supplier.js +32 -0
  180. package/core/fetcher/getHeader.d.ts +2 -0
  181. package/core/fetcher/getHeader.js +12 -0
  182. package/core/fetcher/index.d.ts +9 -0
  183. package/core/fetcher/index.js +9 -0
  184. package/core/index.d.ts +2 -0
  185. package/core/index.js +39 -0
  186. package/core/schemas/Schema.d.ts +19 -0
  187. package/core/schemas/Schema.js +21 -0
  188. package/core/schemas/builders/date/date.d.ts +4 -0
  189. package/core/schemas/builders/date/date.js +63 -0
  190. package/core/schemas/builders/date/index.d.ts +3 -0
  191. package/core/schemas/builders/date/index.js +5 -0
  192. package/core/schemas/builders/enum/enum.d.ts +3 -0
  193. package/core/schemas/builders/enum/enum.js +39 -0
  194. package/core/schemas/builders/enum/index.d.ts +3 -0
  195. package/core/schemas/builders/enum/index.js +5 -0
  196. package/core/schemas/builders/index.d.ts +1 -0
  197. package/core/schemas/builders/index.js +33 -0
  198. package/core/schemas/builders/lazy/index.d.ts +5 -0
  199. package/core/schemas/builders/lazy/index.js +7 -0
  200. package/core/schemas/builders/lazy/lazy.d.ts +13 -0
  201. package/core/schemas/builders/lazy/lazy.js +46 -0
  202. package/core/schemas/builders/lazy/lazyObject.d.ts +8 -0
  203. package/core/schemas/builders/lazy/lazyObject.js +31 -0
  204. package/core/schemas/builders/list/index.d.ts +3 -0
  205. package/core/schemas/builders/list/index.js +5 -0
  206. package/core/schemas/builders/list/list.d.ts +7 -0
  207. package/core/schemas/builders/list/list.js +78 -0
  208. package/core/schemas/builders/literals/booleanLiteral.d.ts +3 -0
  209. package/core/schemas/builders/literals/booleanLiteral.js +29 -0
  210. package/core/schemas/builders/literals/index.d.ts +5 -0
  211. package/core/schemas/builders/literals/index.js +7 -0
  212. package/core/schemas/builders/literals/stringLiteral.d.ts +3 -0
  213. package/core/schemas/builders/literals/stringLiteral.js +29 -0
  214. package/core/schemas/builders/object/index.d.ts +9 -0
  215. package/core/schemas/builders/object/index.js +11 -0
  216. package/core/schemas/builders/object/object.d.ts +27 -0
  217. package/core/schemas/builders/object/object.js +268 -0
  218. package/core/schemas/builders/object/objectWithoutOptionalProperties.d.ts +2 -0
  219. package/core/schemas/builders/object/objectWithoutOptionalProperties.js +8 -0
  220. package/core/schemas/builders/object/property.d.ts +7 -0
  221. package/core/schemas/builders/object/property.js +16 -0
  222. package/core/schemas/builders/object/types.d.ts +1 -0
  223. package/core/schemas/builders/object/types.js +2 -0
  224. package/core/schemas/builders/object-like/getObjectLikeUtils.d.ts +23 -0
  225. package/core/schemas/builders/object-like/getObjectLikeUtils.js +73 -0
  226. package/core/schemas/builders/object-like/index.d.ts +4 -0
  227. package/core/schemas/builders/object-like/index.js +6 -0
  228. package/core/schemas/builders/object-like/types.d.ts +1 -0
  229. package/core/schemas/builders/object-like/types.js +2 -0
  230. package/core/schemas/builders/primitives/any.d.ts +3 -0
  231. package/core/schemas/builders/primitives/any.js +6 -0
  232. package/core/schemas/builders/primitives/boolean.d.ts +3 -0
  233. package/core/schemas/builders/primitives/boolean.js +25 -0
  234. package/core/schemas/builders/primitives/index.d.ts +6 -0
  235. package/core/schemas/builders/primitives/index.js +13 -0
  236. package/core/schemas/builders/primitives/number.d.ts +3 -0
  237. package/core/schemas/builders/primitives/number.js +25 -0
  238. package/core/schemas/builders/primitives/string.d.ts +3 -0
  239. package/core/schemas/builders/primitives/string.js +25 -0
  240. package/core/schemas/builders/primitives/unknown.d.ts +3 -0
  241. package/core/schemas/builders/primitives/unknown.js +6 -0
  242. package/core/schemas/builders/record/index.d.ts +3 -0
  243. package/core/schemas/builders/record/index.js +5 -0
  244. package/core/schemas/builders/record/record.d.ts +7 -0
  245. package/core/schemas/builders/record/record.js +116 -0
  246. package/core/schemas/builders/record/types.d.ts +1 -0
  247. package/core/schemas/builders/record/types.js +2 -0
  248. package/core/schemas/builders/schema-utils/JsonError.d.ts +5 -0
  249. package/core/schemas/builders/schema-utils/JsonError.js +12 -0
  250. package/core/schemas/builders/schema-utils/ParseError.d.ts +5 -0
  251. package/core/schemas/builders/schema-utils/ParseError.js +12 -0
  252. package/core/schemas/builders/schema-utils/getSchemaUtils.d.ts +54 -0
  253. package/core/schemas/builders/schema-utils/getSchemaUtils.js +95 -0
  254. package/core/schemas/builders/schema-utils/index.d.ts +9 -0
  255. package/core/schemas/builders/schema-utils/index.js +11 -0
  256. package/core/schemas/builders/schema-utils/stringifyValidationErrors.d.ts +2 -0
  257. package/core/schemas/builders/schema-utils/stringifyValidationErrors.js +10 -0
  258. package/core/schemas/builders/set/index.d.ts +3 -0
  259. package/core/schemas/builders/set/index.js +5 -0
  260. package/core/schemas/builders/set/set.d.ts +7 -0
  261. package/core/schemas/builders/set/set.js +63 -0
  262. package/core/schemas/builders/undiscriminated-union/index.d.ts +3 -0
  263. package/core/schemas/builders/undiscriminated-union/index.js +5 -0
  264. package/core/schemas/builders/undiscriminated-union/types.d.ts +1 -0
  265. package/core/schemas/builders/undiscriminated-union/types.js +2 -0
  266. package/core/schemas/builders/undiscriminated-union/undiscriminatedUnion.d.ts +7 -0
  267. package/core/schemas/builders/undiscriminated-union/undiscriminatedUnion.js +61 -0
  268. package/core/schemas/builders/union/discriminant.d.ts +5 -0
  269. package/core/schemas/builders/union/discriminant.js +10 -0
  270. package/core/schemas/builders/union/index.d.ts +5 -0
  271. package/core/schemas/builders/union/index.js +7 -0
  272. package/core/schemas/builders/union/types.d.ts +1 -0
  273. package/core/schemas/builders/union/types.js +2 -0
  274. package/core/schemas/builders/union/union.d.ts +8 -0
  275. package/core/schemas/builders/union/union.js +152 -0
  276. package/core/schemas/index.d.ts +1 -0
  277. package/core/schemas/index.js +21 -0
  278. package/core/schemas/utils/MaybePromise.d.ts +1 -0
  279. package/core/schemas/utils/MaybePromise.js +2 -0
  280. package/core/schemas/utils/addQuestionMarksToNullableProperties.d.ts +1 -0
  281. package/core/schemas/utils/addQuestionMarksToNullableProperties.js +2 -0
  282. package/core/schemas/utils/createIdentitySchemaCreator.d.ts +7 -0
  283. package/core/schemas/utils/createIdentitySchemaCreator.js +16 -0
  284. package/core/schemas/utils/entries.d.ts +2 -0
  285. package/core/schemas/utils/entries.js +7 -0
  286. package/core/schemas/utils/filterObject.d.ts +2 -0
  287. package/core/schemas/utils/filterObject.js +14 -0
  288. package/core/schemas/utils/getErrorMessageForIncorrectType.d.ts +2 -0
  289. package/core/schemas/utils/getErrorMessageForIncorrectType.js +24 -0
  290. package/core/schemas/utils/isPlainObject.d.ts +2 -0
  291. package/core/schemas/utils/isPlainObject.js +18 -0
  292. package/core/schemas/utils/keys.d.ts +2 -0
  293. package/core/schemas/utils/keys.js +7 -0
  294. package/core/schemas/utils/maybeSkipValidation.d.ts +2 -0
  295. package/core/schemas/utils/maybeSkipValidation.js +47 -0
  296. package/core/schemas/utils/partition.d.ts +2 -0
  297. package/core/schemas/utils/partition.js +16 -0
  298. package/dist/Client.d.ts +26 -0
  299. package/dist/Client.js +47 -0
  300. package/dist/api/errors/BadRequestError.d.ts +7 -0
  301. package/dist/api/errors/BadRequestError.js +47 -0
  302. package/dist/api/errors/ForbiddenError.d.ts +7 -0
  303. package/dist/api/errors/ForbiddenError.js +47 -0
  304. package/dist/api/errors/InternalServerError.d.ts +7 -0
  305. package/dist/api/errors/InternalServerError.js +47 -0
  306. package/dist/api/errors/NotFoundError.d.ts +7 -0
  307. package/dist/api/errors/NotFoundError.js +47 -0
  308. package/dist/api/errors/index.d.ts +1 -0
  309. package/dist/api/errors/index.js +24 -0
  310. package/dist/api/index.d.ts +1 -0
  311. package/dist/api/index.js +23 -0
  312. package/dist/api/resources/assets/client/Client.d.ts +100 -0
  313. package/dist/api/resources/assets/client/Client.js +611 -0
  314. package/dist/api/resources/assets/client/index.d.ts +1 -0
  315. package/dist/api/resources/assets/client/index.js +21 -0
  316. package/dist/api/resources/assets/client/requests/DeleteFolderRequest.d.ts +1 -0
  317. package/dist/api/resources/assets/client/requests/DeleteFolderRequest.js +5 -0
  318. package/dist/api/resources/assets/client/requests/DeleteRuleRequest.d.ts +1 -0
  319. package/dist/api/resources/assets/client/requests/DeleteRuleRequest.js +5 -0
  320. package/dist/api/resources/assets/client/requests/ExportRuleRequest.d.ts +1 -0
  321. package/dist/api/resources/assets/client/requests/ExportRuleRequest.js +5 -0
  322. package/dist/api/resources/assets/client/requests/ImportRuleRequest.d.ts +1 -0
  323. package/dist/api/resources/assets/client/requests/ImportRuleRequest.js +5 -0
  324. package/dist/api/resources/assets/client/requests/ListRulesRequest.d.ts +1 -0
  325. package/dist/api/resources/assets/client/requests/ListRulesRequest.js +5 -0
  326. package/dist/api/resources/assets/client/requests/UpsertFolderRequest.d.ts +1 -0
  327. package/dist/api/resources/assets/client/requests/UpsertFolderRequest.js +5 -0
  328. package/dist/api/resources/assets/client/requests/index.d.ts +1 -0
  329. package/dist/api/resources/assets/client/requests/index.js +2 -0
  330. package/dist/api/resources/assets/index.d.ts +1 -0
  331. package/dist/api/resources/assets/index.js +22 -0
  332. package/dist/api/resources/assets/types/DeleteFolderResponse.d.ts +1 -0
  333. package/dist/api/resources/assets/types/DeleteFolderResponse.js +5 -0
  334. package/dist/api/resources/assets/types/DeleteRuleResponse.d.ts +1 -0
  335. package/dist/api/resources/assets/types/DeleteRuleResponse.js +5 -0
  336. package/dist/api/resources/assets/types/ListFlowsResponseItem.d.ts +1 -0
  337. package/dist/api/resources/assets/types/ListFlowsResponseItem.js +5 -0
  338. package/dist/api/resources/assets/types/ListFoldersResponseItem.d.ts +1 -0
  339. package/dist/api/resources/assets/types/ListFoldersResponseItem.js +5 -0
  340. package/dist/api/resources/assets/types/ListRulesResponseItem.d.ts +1 -0
  341. package/dist/api/resources/assets/types/ListRulesResponseItem.js +5 -0
  342. package/dist/api/resources/assets/types/ListRulesResponseItemFolder.d.ts +1 -0
  343. package/dist/api/resources/assets/types/ListRulesResponseItemFolder.js +5 -0
  344. package/dist/api/resources/assets/types/UpsertFolderResponse.d.ts +1 -0
  345. package/dist/api/resources/assets/types/UpsertFolderResponse.js +5 -0
  346. package/dist/api/resources/assets/types/UsageResponse.d.ts +1 -0
  347. package/dist/api/resources/assets/types/UsageResponse.js +5 -0
  348. package/dist/api/resources/assets/types/index.d.ts +1 -0
  349. package/dist/api/resources/assets/types/index.js +28 -0
  350. package/dist/api/resources/decisions/client/Client.d.ts +19 -0
  351. package/dist/api/resources/decisions/client/Client.js +146 -0
  352. package/dist/api/resources/decisions/client/index.d.ts +1 -0
  353. package/dist/api/resources/decisions/client/index.js +21 -0
  354. package/dist/api/resources/decisions/client/requests/QueryRequest.d.ts +1 -0
  355. package/dist/api/resources/decisions/client/requests/QueryRequest.js +5 -0
  356. package/dist/api/resources/decisions/client/requests/index.d.ts +1 -0
  357. package/dist/api/resources/decisions/client/requests/index.js +2 -0
  358. package/dist/api/resources/decisions/index.d.ts +1 -0
  359. package/dist/api/resources/decisions/index.js +22 -0
  360. package/dist/api/resources/decisions/types/QueryResponse.d.ts +1 -0
  361. package/dist/api/resources/decisions/types/QueryResponse.js +5 -0
  362. package/dist/api/resources/decisions/types/index.d.ts +1 -0
  363. package/dist/api/resources/decisions/types/index.js +21 -0
  364. package/dist/api/resources/flows/client/Client.d.ts +21 -0
  365. package/dist/api/resources/flows/client/Client.js +133 -0
  366. package/dist/api/resources/flows/client/index.d.ts +1 -0
  367. package/dist/api/resources/flows/client/index.js +2 -0
  368. package/dist/api/resources/flows/index.d.ts +1 -0
  369. package/dist/api/resources/flows/index.js +21 -0
  370. package/dist/api/resources/index.d.ts +8 -0
  371. package/dist/api/resources/index.js +54 -0
  372. package/dist/api/resources/rules/client/Client.d.ts +60 -0
  373. package/dist/api/resources/rules/client/Client.js +272 -0
  374. package/dist/api/resources/rules/client/index.d.ts +1 -0
  375. package/dist/api/resources/rules/client/index.js +2 -0
  376. package/dist/api/resources/rules/index.d.ts +1 -0
  377. package/dist/api/resources/rules/index.js +21 -0
  378. package/dist/api/resources/tests/client/Client.d.ts +82 -0
  379. package/dist/api/resources/tests/client/Client.js +439 -0
  380. package/dist/api/resources/tests/client/index.d.ts +1 -0
  381. package/dist/api/resources/tests/client/index.js +21 -0
  382. package/dist/api/resources/tests/client/requests/CreateFlowTestRequest.d.ts +1 -0
  383. package/dist/api/resources/tests/client/requests/CreateFlowTestRequest.js +5 -0
  384. package/dist/api/resources/tests/client/requests/CreateRuleTestRequest.d.ts +1 -0
  385. package/dist/api/resources/tests/client/requests/CreateRuleTestRequest.js +5 -0
  386. package/dist/api/resources/tests/client/requests/index.d.ts +1 -0
  387. package/dist/api/resources/tests/client/requests/index.js +2 -0
  388. package/dist/api/resources/tests/index.d.ts +1 -0
  389. package/dist/api/resources/tests/index.js +22 -0
  390. package/dist/api/resources/tests/types/CreateFlowTestResponse.d.ts +1 -0
  391. package/dist/api/resources/tests/types/CreateFlowTestResponse.js +5 -0
  392. package/dist/api/resources/tests/types/CreateRuleTestResponse.d.ts +1 -0
  393. package/dist/api/resources/tests/types/CreateRuleTestResponse.js +5 -0
  394. package/dist/api/resources/tests/types/DeleteFlowTestResponse.d.ts +1 -0
  395. package/dist/api/resources/tests/types/DeleteFlowTestResponse.js +5 -0
  396. package/dist/api/resources/tests/types/DeleteRuleTestResponse.d.ts +1 -0
  397. package/dist/api/resources/tests/types/DeleteRuleTestResponse.js +5 -0
  398. package/dist/api/resources/tests/types/ListFlowTestsResponseItem.d.ts +1 -0
  399. package/dist/api/resources/tests/types/ListFlowTestsResponseItem.js +5 -0
  400. package/dist/api/resources/tests/types/ListRuleTestsResponseItem.d.ts +1 -0
  401. package/dist/api/resources/tests/types/ListRuleTestsResponseItem.js +5 -0
  402. package/dist/api/resources/tests/types/index.d.ts +1 -0
  403. package/dist/api/resources/tests/types/index.js +26 -0
  404. package/dist/api/resources/users/client/Client.d.ts +62 -0
  405. package/dist/api/resources/users/client/Client.js +269 -0
  406. package/dist/api/resources/users/client/index.d.ts +1 -0
  407. package/dist/api/resources/users/client/index.js +21 -0
  408. package/dist/api/resources/users/client/requests/CreateGroupRequest.d.ts +1 -0
  409. package/dist/api/resources/users/client/requests/CreateGroupRequest.js +5 -0
  410. package/dist/api/resources/users/client/requests/InviteRequest.d.ts +1 -0
  411. package/dist/api/resources/users/client/requests/InviteRequest.js +5 -0
  412. package/dist/api/resources/users/client/requests/index.d.ts +1 -0
  413. package/dist/api/resources/users/client/requests/index.js +2 -0
  414. package/dist/api/resources/users/index.d.ts +1 -0
  415. package/dist/api/resources/users/index.js +22 -0
  416. package/dist/api/resources/users/types/CreateGroupResponse.d.ts +1 -0
  417. package/dist/api/resources/users/types/CreateGroupResponse.js +5 -0
  418. package/dist/api/resources/users/types/InviteRequestRole.d.ts +5 -0
  419. package/dist/api/resources/users/types/InviteRequestRole.js +10 -0
  420. package/dist/api/resources/users/types/InviteResponse.d.ts +1 -0
  421. package/dist/api/resources/users/types/InviteResponse.js +5 -0
  422. package/dist/api/resources/users/types/ListGroupsResponseItem.d.ts +1 -0
  423. package/dist/api/resources/users/types/ListGroupsResponseItem.js +5 -0
  424. package/dist/api/resources/users/types/index.d.ts +1 -0
  425. package/dist/api/resources/users/types/index.js +24 -0
  426. package/dist/api/resources/values/client/Client.d.ts +37 -0
  427. package/dist/api/resources/values/client/Client.js +255 -0
  428. package/dist/api/resources/values/client/index.d.ts +1 -0
  429. package/dist/api/resources/values/client/index.js +21 -0
  430. package/dist/api/resources/values/client/requests/DeleteDynamicValueRequest.d.ts +1 -0
  431. package/dist/api/resources/values/client/requests/DeleteDynamicValueRequest.js +5 -0
  432. package/dist/api/resources/values/client/requests/ListDynamicValuesRequest.d.ts +1 -0
  433. package/dist/api/resources/values/client/requests/ListDynamicValuesRequest.js +5 -0
  434. package/dist/api/resources/values/client/requests/index.d.ts +1 -0
  435. package/dist/api/resources/values/client/requests/index.js +2 -0
  436. package/dist/api/resources/values/index.d.ts +1 -0
  437. package/dist/api/resources/values/index.js +22 -0
  438. package/dist/api/resources/values/types/DeleteDynamicValueResponse.d.ts +1 -0
  439. package/dist/api/resources/values/types/DeleteDynamicValueResponse.js +5 -0
  440. package/dist/api/resources/values/types/ListDynamicValuesResponseItem.d.ts +1 -0
  441. package/dist/api/resources/values/types/ListDynamicValuesResponseItem.js +5 -0
  442. package/dist/api/resources/values/types/ListDynamicValuesResponseItemType.d.ts +7 -0
  443. package/dist/api/resources/values/types/ListDynamicValuesResponseItemType.js +12 -0
  444. package/dist/api/resources/values/types/ListDynamicValuesResponseItemUsagesItem.d.ts +1 -0
  445. package/dist/api/resources/values/types/ListDynamicValuesResponseItemUsagesItem.js +5 -0
  446. package/dist/api/resources/values/types/ListDynamicValuesResponseItemValue.d.ts +1 -0
  447. package/dist/api/resources/values/types/ListDynamicValuesResponseItemValue.js +5 -0
  448. package/dist/api/resources/values/types/UpdateRequestValue.d.ts +1 -0
  449. package/dist/api/resources/values/types/UpdateRequestValue.js +5 -0
  450. package/dist/api/resources/values/types/UpdateResponseItem.d.ts +1 -0
  451. package/dist/api/resources/values/types/UpdateResponseItem.js +5 -0
  452. package/dist/api/resources/values/types/UpdateResponseItemType.d.ts +7 -0
  453. package/dist/api/resources/values/types/UpdateResponseItemType.js +12 -0
  454. package/dist/api/resources/values/types/UpdateResponseItemValue.d.ts +1 -0
  455. package/dist/api/resources/values/types/UpdateResponseItemValue.js +5 -0
  456. package/dist/api/resources/values/types/index.d.ts +1 -0
  457. package/dist/api/resources/values/types/index.js +29 -0
  458. package/dist/api/types/BadRequestErrorBody.d.ts +1 -0
  459. package/dist/api/types/BadRequestErrorBody.js +5 -0
  460. package/dist/api/types/ForbiddenErrorBody.d.ts +1 -0
  461. package/dist/api/types/ForbiddenErrorBody.js +5 -0
  462. package/dist/api/types/InternalServerErrorBody.d.ts +1 -0
  463. package/dist/api/types/InternalServerErrorBody.js +5 -0
  464. package/dist/api/types/NotFoundErrorBody.d.ts +1 -0
  465. package/dist/api/types/NotFoundErrorBody.js +5 -0
  466. package/dist/api/types/index.d.ts +1 -0
  467. package/dist/api/types/index.js +24 -0
  468. package/dist/core/fetcher/APIResponse.d.ts +1 -0
  469. package/dist/core/fetcher/APIResponse.js +2 -0
  470. package/dist/core/fetcher/Fetcher.d.ts +3 -0
  471. package/dist/core/fetcher/Fetcher.js +161 -0
  472. package/dist/core/fetcher/Supplier.d.ts +4 -0
  473. package/dist/core/fetcher/Supplier.js +32 -0
  474. package/dist/core/fetcher/getHeader.d.ts +2 -0
  475. package/dist/core/fetcher/getHeader.js +12 -0
  476. package/dist/core/fetcher/index.d.ts +9 -0
  477. package/dist/core/fetcher/index.js +9 -0
  478. package/dist/core/index.d.ts +2 -0
  479. package/dist/core/index.js +39 -0
  480. package/dist/core/schemas/Schema.d.ts +19 -0
  481. package/dist/core/schemas/Schema.js +21 -0
  482. package/dist/core/schemas/builders/date/date.d.ts +4 -0
  483. package/dist/core/schemas/builders/date/date.js +63 -0
  484. package/dist/core/schemas/builders/date/index.d.ts +3 -0
  485. package/dist/core/schemas/builders/date/index.js +5 -0
  486. package/dist/core/schemas/builders/enum/enum.d.ts +3 -0
  487. package/dist/core/schemas/builders/enum/enum.js +39 -0
  488. package/dist/core/schemas/builders/enum/index.d.ts +3 -0
  489. package/dist/core/schemas/builders/enum/index.js +5 -0
  490. package/dist/core/schemas/builders/index.d.ts +1 -0
  491. package/dist/core/schemas/builders/index.js +33 -0
  492. package/dist/core/schemas/builders/lazy/index.d.ts +5 -0
  493. package/dist/core/schemas/builders/lazy/index.js +7 -0
  494. package/dist/core/schemas/builders/lazy/lazy.d.ts +13 -0
  495. package/dist/core/schemas/builders/lazy/lazy.js +46 -0
  496. package/dist/core/schemas/builders/lazy/lazyObject.d.ts +8 -0
  497. package/dist/core/schemas/builders/lazy/lazyObject.js +31 -0
  498. package/dist/core/schemas/builders/list/index.d.ts +3 -0
  499. package/dist/core/schemas/builders/list/index.js +5 -0
  500. package/dist/core/schemas/builders/list/list.d.ts +7 -0
  501. package/dist/core/schemas/builders/list/list.js +78 -0
  502. package/dist/core/schemas/builders/literals/booleanLiteral.d.ts +3 -0
  503. package/dist/core/schemas/builders/literals/booleanLiteral.js +29 -0
  504. package/dist/core/schemas/builders/literals/index.d.ts +5 -0
  505. package/dist/core/schemas/builders/literals/index.js +7 -0
  506. package/dist/core/schemas/builders/literals/stringLiteral.d.ts +3 -0
  507. package/dist/core/schemas/builders/literals/stringLiteral.js +29 -0
  508. package/dist/core/schemas/builders/object/index.d.ts +9 -0
  509. package/dist/core/schemas/builders/object/index.js +11 -0
  510. package/dist/core/schemas/builders/object/object.d.ts +27 -0
  511. package/dist/core/schemas/builders/object/object.js +268 -0
  512. package/dist/core/schemas/builders/object/objectWithoutOptionalProperties.d.ts +2 -0
  513. package/dist/core/schemas/builders/object/objectWithoutOptionalProperties.js +8 -0
  514. package/dist/core/schemas/builders/object/property.d.ts +7 -0
  515. package/dist/core/schemas/builders/object/property.js +16 -0
  516. package/dist/core/schemas/builders/object/types.d.ts +1 -0
  517. package/dist/core/schemas/builders/object/types.js +2 -0
  518. package/dist/core/schemas/builders/object-like/getObjectLikeUtils.d.ts +23 -0
  519. package/dist/core/schemas/builders/object-like/getObjectLikeUtils.js +73 -0
  520. package/dist/core/schemas/builders/object-like/index.d.ts +4 -0
  521. package/dist/core/schemas/builders/object-like/index.js +6 -0
  522. package/dist/core/schemas/builders/object-like/types.d.ts +1 -0
  523. package/dist/core/schemas/builders/object-like/types.js +2 -0
  524. package/dist/core/schemas/builders/primitives/any.d.ts +3 -0
  525. package/dist/core/schemas/builders/primitives/any.js +6 -0
  526. package/dist/core/schemas/builders/primitives/boolean.d.ts +3 -0
  527. package/dist/core/schemas/builders/primitives/boolean.js +25 -0
  528. package/dist/core/schemas/builders/primitives/index.d.ts +6 -0
  529. package/dist/core/schemas/builders/primitives/index.js +13 -0
  530. package/dist/core/schemas/builders/primitives/number.d.ts +3 -0
  531. package/dist/core/schemas/builders/primitives/number.js +25 -0
  532. package/dist/core/schemas/builders/primitives/string.d.ts +3 -0
  533. package/dist/core/schemas/builders/primitives/string.js +25 -0
  534. package/dist/core/schemas/builders/primitives/unknown.d.ts +3 -0
  535. package/dist/core/schemas/builders/primitives/unknown.js +6 -0
  536. package/dist/core/schemas/builders/record/index.d.ts +3 -0
  537. package/dist/core/schemas/builders/record/index.js +5 -0
  538. package/dist/core/schemas/builders/record/record.d.ts +7 -0
  539. package/dist/core/schemas/builders/record/record.js +116 -0
  540. package/dist/core/schemas/builders/record/types.d.ts +1 -0
  541. package/dist/core/schemas/builders/record/types.js +2 -0
  542. package/dist/core/schemas/builders/schema-utils/JsonError.d.ts +5 -0
  543. package/dist/core/schemas/builders/schema-utils/JsonError.js +12 -0
  544. package/dist/core/schemas/builders/schema-utils/ParseError.d.ts +5 -0
  545. package/dist/core/schemas/builders/schema-utils/ParseError.js +12 -0
  546. package/dist/core/schemas/builders/schema-utils/getSchemaUtils.d.ts +54 -0
  547. package/dist/core/schemas/builders/schema-utils/getSchemaUtils.js +95 -0
  548. package/dist/core/schemas/builders/schema-utils/index.d.ts +9 -0
  549. package/dist/core/schemas/builders/schema-utils/index.js +11 -0
  550. package/dist/core/schemas/builders/schema-utils/stringifyValidationErrors.d.ts +2 -0
  551. package/dist/core/schemas/builders/schema-utils/stringifyValidationErrors.js +10 -0
  552. package/dist/core/schemas/builders/set/index.d.ts +3 -0
  553. package/dist/core/schemas/builders/set/index.js +5 -0
  554. package/dist/core/schemas/builders/set/set.d.ts +7 -0
  555. package/dist/core/schemas/builders/set/set.js +63 -0
  556. package/dist/core/schemas/builders/undiscriminated-union/index.d.ts +3 -0
  557. package/dist/core/schemas/builders/undiscriminated-union/index.js +5 -0
  558. package/dist/core/schemas/builders/undiscriminated-union/types.d.ts +1 -0
  559. package/dist/core/schemas/builders/undiscriminated-union/types.js +2 -0
  560. package/dist/core/schemas/builders/undiscriminated-union/undiscriminatedUnion.d.ts +7 -0
  561. package/dist/core/schemas/builders/undiscriminated-union/undiscriminatedUnion.js +61 -0
  562. package/dist/core/schemas/builders/union/discriminant.d.ts +5 -0
  563. package/dist/core/schemas/builders/union/discriminant.js +10 -0
  564. package/dist/core/schemas/builders/union/index.d.ts +5 -0
  565. package/dist/core/schemas/builders/union/index.js +7 -0
  566. package/dist/core/schemas/builders/union/types.d.ts +1 -0
  567. package/dist/core/schemas/builders/union/types.js +2 -0
  568. package/dist/core/schemas/builders/union/union.d.ts +8 -0
  569. package/dist/core/schemas/builders/union/union.js +152 -0
  570. package/dist/core/schemas/index.d.ts +1 -0
  571. package/dist/core/schemas/index.js +21 -0
  572. package/dist/core/schemas/utils/MaybePromise.d.ts +1 -0
  573. package/dist/core/schemas/utils/MaybePromise.js +2 -0
  574. package/dist/core/schemas/utils/addQuestionMarksToNullableProperties.d.ts +1 -0
  575. package/dist/core/schemas/utils/addQuestionMarksToNullableProperties.js +2 -0
  576. package/dist/core/schemas/utils/createIdentitySchemaCreator.d.ts +7 -0
  577. package/dist/core/schemas/utils/createIdentitySchemaCreator.js +16 -0
  578. package/dist/core/schemas/utils/entries.d.ts +2 -0
  579. package/dist/core/schemas/utils/entries.js +7 -0
  580. package/dist/core/schemas/utils/filterObject.d.ts +2 -0
  581. package/dist/core/schemas/utils/filterObject.js +14 -0
  582. package/dist/core/schemas/utils/getErrorMessageForIncorrectType.d.ts +2 -0
  583. package/dist/core/schemas/utils/getErrorMessageForIncorrectType.js +24 -0
  584. package/dist/core/schemas/utils/isPlainObject.d.ts +2 -0
  585. package/dist/core/schemas/utils/isPlainObject.js +18 -0
  586. package/dist/core/schemas/utils/keys.d.ts +2 -0
  587. package/dist/core/schemas/utils/keys.js +7 -0
  588. package/dist/core/schemas/utils/maybeSkipValidation.d.ts +2 -0
  589. package/dist/core/schemas/utils/maybeSkipValidation.js +47 -0
  590. package/dist/core/schemas/utils/partition.d.ts +2 -0
  591. package/dist/core/schemas/utils/partition.js +16 -0
  592. package/dist/errors/RulebricksApiError.d.ts +10 -0
  593. package/dist/errors/RulebricksApiError.js +32 -0
  594. package/dist/errors/RulebricksApiTimeoutError.d.ts +4 -0
  595. package/dist/errors/RulebricksApiTimeoutError.js +13 -0
  596. package/dist/errors/index.d.ts +5 -0
  597. package/dist/errors/index.js +7 -0
  598. package/dist/forge/index.d.ts +4 -0
  599. package/dist/forge/index.js +31 -0
  600. package/dist/forge/operators.d.ts +136 -0
  601. package/dist/forge/operators.js +938 -0
  602. package/dist/forge/rule.d.ts +129 -0
  603. package/dist/forge/rule.js +702 -0
  604. package/dist/forge/types.d.ts +53 -0
  605. package/dist/forge/types.js +34 -0
  606. package/dist/forge/values.d.ts +21 -0
  607. package/dist/forge/values.js +88 -0
  608. package/dist/index.d.ts +15 -0
  609. package/dist/index.js +113 -0
  610. package/dist/serialization/index.d.ts +1 -0
  611. package/dist/serialization/index.js +22 -0
  612. package/dist/serialization/resources/assets/client/exportRule.d.ts +2 -0
  613. package/dist/serialization/resources/assets/client/exportRule.js +37 -0
  614. package/dist/serialization/resources/assets/client/importRule.d.ts +2 -0
  615. package/dist/serialization/resources/assets/client/importRule.js +37 -0
  616. package/dist/serialization/resources/assets/client/index.d.ts +6 -0
  617. package/dist/serialization/resources/assets/client/index.js +43 -0
  618. package/dist/serialization/resources/assets/client/listFlows.d.ts +2 -0
  619. package/dist/serialization/resources/assets/client/listFlows.js +56 -0
  620. package/dist/serialization/resources/assets/client/listFolders.d.ts +2 -0
  621. package/dist/serialization/resources/assets/client/listFolders.js +56 -0
  622. package/dist/serialization/resources/assets/client/listRules.d.ts +2 -0
  623. package/dist/serialization/resources/assets/client/listRules.js +56 -0
  624. package/dist/serialization/resources/assets/client/requests/DeleteFolderRequest.d.ts +2 -0
  625. package/dist/serialization/resources/assets/client/requests/DeleteFolderRequest.js +39 -0
  626. package/dist/serialization/resources/assets/client/requests/DeleteRuleRequest.d.ts +2 -0
  627. package/dist/serialization/resources/assets/client/requests/DeleteRuleRequest.js +39 -0
  628. package/dist/serialization/resources/assets/client/requests/ImportRuleRequest.d.ts +2 -0
  629. package/dist/serialization/resources/assets/client/requests/ImportRuleRequest.js +39 -0
  630. package/dist/serialization/resources/assets/client/requests/UpsertFolderRequest.d.ts +2 -0
  631. package/dist/serialization/resources/assets/client/requests/UpsertFolderRequest.js +41 -0
  632. package/dist/serialization/resources/assets/client/requests/index.d.ts +9 -0
  633. package/dist/serialization/resources/assets/client/requests/index.js +11 -0
  634. package/dist/serialization/resources/assets/index.d.ts +1 -0
  635. package/dist/serialization/resources/assets/index.js +22 -0
  636. package/dist/serialization/resources/assets/types/DeleteFolderResponse.d.ts +2 -0
  637. package/dist/serialization/resources/assets/types/DeleteFolderResponse.js +42 -0
  638. package/dist/serialization/resources/assets/types/DeleteRuleResponse.d.ts +2 -0
  639. package/dist/serialization/resources/assets/types/DeleteRuleResponse.js +39 -0
  640. package/dist/serialization/resources/assets/types/ListFlowsResponseItem.d.ts +2 -0
  641. package/dist/serialization/resources/assets/types/ListFlowsResponseItem.js +44 -0
  642. package/dist/serialization/resources/assets/types/ListFoldersResponseItem.d.ts +2 -0
  643. package/dist/serialization/resources/assets/types/ListFoldersResponseItem.js +42 -0
  644. package/dist/serialization/resources/assets/types/ListRulesResponseItem.d.ts +2 -0
  645. package/dist/serialization/resources/assets/types/ListRulesResponseItem.js +67 -0
  646. package/dist/serialization/resources/assets/types/ListRulesResponseItemFolder.d.ts +2 -0
  647. package/dist/serialization/resources/assets/types/ListRulesResponseItemFolder.js +42 -0
  648. package/dist/serialization/resources/assets/types/UpsertFolderResponse.d.ts +2 -0
  649. package/dist/serialization/resources/assets/types/UpsertFolderResponse.js +42 -0
  650. package/dist/serialization/resources/assets/types/UsageResponse.d.ts +2 -0
  651. package/dist/serialization/resources/assets/types/UsageResponse.js +44 -0
  652. package/dist/serialization/resources/assets/types/index.d.ts +1 -0
  653. package/dist/serialization/resources/assets/types/index.js +28 -0
  654. package/dist/serialization/resources/decisions/index.d.ts +1 -0
  655. package/dist/serialization/resources/decisions/index.js +21 -0
  656. package/dist/serialization/resources/decisions/types/QueryResponse.d.ts +2 -0
  657. package/dist/serialization/resources/decisions/types/QueryResponse.js +42 -0
  658. package/dist/serialization/resources/decisions/types/index.d.ts +1 -0
  659. package/dist/serialization/resources/decisions/types/index.js +21 -0
  660. package/dist/serialization/resources/flows/client/execute.d.ts +3 -0
  661. package/dist/serialization/resources/flows/client/execute.js +38 -0
  662. package/dist/serialization/resources/flows/client/index.d.ts +2 -0
  663. package/dist/serialization/resources/flows/client/index.js +33 -0
  664. package/dist/serialization/resources/flows/index.d.ts +1 -0
  665. package/dist/serialization/resources/flows/index.js +21 -0
  666. package/dist/serialization/resources/index.d.ts +8 -0
  667. package/dist/serialization/resources/index.js +52 -0
  668. package/dist/serialization/resources/rules/client/bulkSolve.d.ts +3 -0
  669. package/dist/serialization/resources/rules/client/bulkSolve.js +38 -0
  670. package/dist/serialization/resources/rules/client/index.d.ts +4 -0
  671. package/dist/serialization/resources/rules/client/index.js +35 -0
  672. package/dist/serialization/resources/rules/client/parallelSolve.d.ts +3 -0
  673. package/dist/serialization/resources/rules/client/parallelSolve.js +38 -0
  674. package/dist/serialization/resources/rules/client/solve.d.ts +3 -0
  675. package/dist/serialization/resources/rules/client/solve.js +38 -0
  676. package/dist/serialization/resources/rules/index.d.ts +1 -0
  677. package/dist/serialization/resources/rules/index.js +21 -0
  678. package/dist/serialization/resources/tests/client/index.d.ts +3 -0
  679. package/dist/serialization/resources/tests/client/index.js +40 -0
  680. package/dist/serialization/resources/tests/client/listFlowTests.d.ts +2 -0
  681. package/dist/serialization/resources/tests/client/listFlowTests.js +56 -0
  682. package/dist/serialization/resources/tests/client/listRuleTests.d.ts +2 -0
  683. package/dist/serialization/resources/tests/client/listRuleTests.js +56 -0
  684. package/dist/serialization/resources/tests/client/requests/CreateFlowTestRequest.d.ts +2 -0
  685. package/dist/serialization/resources/tests/client/requests/CreateFlowTestRequest.js +42 -0
  686. package/dist/serialization/resources/tests/client/requests/CreateRuleTestRequest.d.ts +2 -0
  687. package/dist/serialization/resources/tests/client/requests/CreateRuleTestRequest.js +42 -0
  688. package/dist/serialization/resources/tests/client/requests/index.d.ts +5 -0
  689. package/dist/serialization/resources/tests/client/requests/index.js +7 -0
  690. package/dist/serialization/resources/tests/index.d.ts +1 -0
  691. package/dist/serialization/resources/tests/index.js +22 -0
  692. package/dist/serialization/resources/tests/types/CreateFlowTestResponse.d.ts +2 -0
  693. package/dist/serialization/resources/tests/types/CreateFlowTestResponse.js +47 -0
  694. package/dist/serialization/resources/tests/types/CreateRuleTestResponse.d.ts +2 -0
  695. package/dist/serialization/resources/tests/types/CreateRuleTestResponse.js +47 -0
  696. package/dist/serialization/resources/tests/types/DeleteFlowTestResponse.d.ts +2 -0
  697. package/dist/serialization/resources/tests/types/DeleteFlowTestResponse.js +47 -0
  698. package/dist/serialization/resources/tests/types/DeleteRuleTestResponse.d.ts +2 -0
  699. package/dist/serialization/resources/tests/types/DeleteRuleTestResponse.js +47 -0
  700. package/dist/serialization/resources/tests/types/ListFlowTestsResponseItem.d.ts +2 -0
  701. package/dist/serialization/resources/tests/types/ListFlowTestsResponseItem.js +47 -0
  702. package/dist/serialization/resources/tests/types/ListRuleTestsResponseItem.d.ts +2 -0
  703. package/dist/serialization/resources/tests/types/ListRuleTestsResponseItem.js +47 -0
  704. package/dist/serialization/resources/tests/types/index.d.ts +1 -0
  705. package/dist/serialization/resources/tests/types/index.js +26 -0
  706. package/dist/serialization/resources/users/client/index.d.ts +2 -0
  707. package/dist/serialization/resources/users/client/index.js +39 -0
  708. package/dist/serialization/resources/users/client/listGroups.d.ts +2 -0
  709. package/dist/serialization/resources/users/client/listGroups.js +56 -0
  710. package/dist/serialization/resources/users/client/requests/CreateGroupRequest.d.ts +2 -0
  711. package/dist/serialization/resources/users/client/requests/CreateGroupRequest.js +40 -0
  712. package/dist/serialization/resources/users/client/requests/InviteRequest.d.ts +2 -0
  713. package/dist/serialization/resources/users/client/requests/InviteRequest.js +60 -0
  714. package/dist/serialization/resources/users/client/requests/index.d.ts +5 -0
  715. package/dist/serialization/resources/users/client/requests/index.js +7 -0
  716. package/dist/serialization/resources/users/index.d.ts +1 -0
  717. package/dist/serialization/resources/users/index.js +22 -0
  718. package/dist/serialization/resources/users/types/CreateGroupResponse.d.ts +2 -0
  719. package/dist/serialization/resources/users/types/CreateGroupResponse.js +42 -0
  720. package/dist/serialization/resources/users/types/InviteRequestRole.d.ts +2 -0
  721. package/dist/serialization/resources/users/types/InviteRequestRole.js +37 -0
  722. package/dist/serialization/resources/users/types/InviteResponse.d.ts +2 -0
  723. package/dist/serialization/resources/users/types/InviteResponse.js +39 -0
  724. package/dist/serialization/resources/users/types/ListGroupsResponseItem.d.ts +2 -0
  725. package/dist/serialization/resources/users/types/ListGroupsResponseItem.js +42 -0
  726. package/dist/serialization/resources/users/types/index.d.ts +1 -0
  727. package/dist/serialization/resources/users/types/index.js +24 -0
  728. package/dist/serialization/resources/values/client/index.d.ts +3 -0
  729. package/dist/serialization/resources/values/client/index.js +34 -0
  730. package/dist/serialization/resources/values/client/listDynamicValues.d.ts +2 -0
  731. package/dist/serialization/resources/values/client/listDynamicValues.js +56 -0
  732. package/dist/serialization/resources/values/client/update.d.ts +3 -0
  733. package/dist/serialization/resources/values/client/update.js +57 -0
  734. package/dist/serialization/resources/values/index.d.ts +1 -0
  735. package/dist/serialization/resources/values/index.js +22 -0
  736. package/dist/serialization/resources/values/types/DeleteDynamicValueResponse.d.ts +2 -0
  737. package/dist/serialization/resources/values/types/DeleteDynamicValueResponse.js +39 -0
  738. package/dist/serialization/resources/values/types/ListDynamicValuesResponseItem.d.ts +2 -0
  739. package/dist/serialization/resources/values/types/ListDynamicValuesResponseItem.js +66 -0
  740. package/dist/serialization/resources/values/types/ListDynamicValuesResponseItemType.d.ts +2 -0
  741. package/dist/serialization/resources/values/types/ListDynamicValuesResponseItemType.js +37 -0
  742. package/dist/serialization/resources/values/types/ListDynamicValuesResponseItemUsagesItem.d.ts +2 -0
  743. package/dist/serialization/resources/values/types/ListDynamicValuesResponseItemUsagesItem.js +44 -0
  744. package/dist/serialization/resources/values/types/ListDynamicValuesResponseItemValue.d.ts +2 -0
  745. package/dist/serialization/resources/values/types/ListDynamicValuesResponseItemValue.js +42 -0
  746. package/dist/serialization/resources/values/types/UpdateRequestValue.d.ts +2 -0
  747. package/dist/serialization/resources/values/types/UpdateRequestValue.js +42 -0
  748. package/dist/serialization/resources/values/types/UpdateResponseItem.d.ts +2 -0
  749. package/dist/serialization/resources/values/types/UpdateResponseItem.js +61 -0
  750. package/dist/serialization/resources/values/types/UpdateResponseItemType.d.ts +2 -0
  751. package/dist/serialization/resources/values/types/UpdateResponseItemType.js +37 -0
  752. package/dist/serialization/resources/values/types/UpdateResponseItemValue.d.ts +2 -0
  753. package/dist/serialization/resources/values/types/UpdateResponseItemValue.js +42 -0
  754. package/dist/serialization/resources/values/types/index.d.ts +1 -0
  755. package/dist/serialization/resources/values/types/index.js +29 -0
  756. package/dist/serialization/types/BadRequestErrorBody.d.ts +2 -0
  757. package/dist/serialization/types/BadRequestErrorBody.js +39 -0
  758. package/dist/serialization/types/ForbiddenErrorBody.d.ts +2 -0
  759. package/dist/serialization/types/ForbiddenErrorBody.js +39 -0
  760. package/dist/serialization/types/InternalServerErrorBody.d.ts +2 -0
  761. package/dist/serialization/types/InternalServerErrorBody.js +39 -0
  762. package/dist/serialization/types/NotFoundErrorBody.d.ts +2 -0
  763. package/dist/serialization/types/NotFoundErrorBody.js +39 -0
  764. package/dist/serialization/types/index.d.ts +1 -0
  765. package/dist/serialization/types/index.js +24 -0
  766. package/errors/RulebricksApiError.d.ts +10 -0
  767. package/errors/RulebricksApiError.js +32 -0
  768. package/errors/RulebricksApiTimeoutError.d.ts +4 -0
  769. package/errors/RulebricksApiTimeoutError.js +13 -0
  770. package/errors/index.d.ts +5 -0
  771. package/errors/index.js +7 -0
  772. package/forge/index.d.ts +4 -0
  773. package/forge/index.js +31 -0
  774. package/forge/operators.d.ts +136 -0
  775. package/forge/operators.js +938 -0
  776. package/forge/rule.d.ts +129 -0
  777. package/forge/rule.js +702 -0
  778. package/forge/types.d.ts +53 -0
  779. package/forge/types.js +34 -0
  780. package/forge/values.d.ts +21 -0
  781. package/forge/values.js +88 -0
  782. package/index.d.ts +15 -0
  783. package/index.js +113 -0
  784. package/jest.config.js +5 -0
  785. package/package.json +43 -0
  786. package/serialization/index.d.ts +1 -0
  787. package/serialization/index.js +22 -0
  788. package/serialization/resources/assets/client/exportRule.d.ts +2 -0
  789. package/serialization/resources/assets/client/exportRule.js +37 -0
  790. package/serialization/resources/assets/client/importRule.d.ts +2 -0
  791. package/serialization/resources/assets/client/importRule.js +37 -0
  792. package/serialization/resources/assets/client/index.d.ts +6 -0
  793. package/serialization/resources/assets/client/index.js +43 -0
  794. package/serialization/resources/assets/client/listFlows.d.ts +2 -0
  795. package/serialization/resources/assets/client/listFlows.js +56 -0
  796. package/serialization/resources/assets/client/listFolders.d.ts +2 -0
  797. package/serialization/resources/assets/client/listFolders.js +56 -0
  798. package/serialization/resources/assets/client/listRules.d.ts +2 -0
  799. package/serialization/resources/assets/client/listRules.js +56 -0
  800. package/serialization/resources/assets/client/requests/DeleteFolderRequest.d.ts +2 -0
  801. package/serialization/resources/assets/client/requests/DeleteFolderRequest.js +39 -0
  802. package/serialization/resources/assets/client/requests/DeleteRuleRequest.d.ts +2 -0
  803. package/serialization/resources/assets/client/requests/DeleteRuleRequest.js +39 -0
  804. package/serialization/resources/assets/client/requests/ImportRuleRequest.d.ts +2 -0
  805. package/serialization/resources/assets/client/requests/ImportRuleRequest.js +39 -0
  806. package/serialization/resources/assets/client/requests/UpsertFolderRequest.d.ts +2 -0
  807. package/serialization/resources/assets/client/requests/UpsertFolderRequest.js +41 -0
  808. package/serialization/resources/assets/client/requests/index.d.ts +9 -0
  809. package/serialization/resources/assets/client/requests/index.js +11 -0
  810. package/serialization/resources/assets/index.d.ts +1 -0
  811. package/serialization/resources/assets/index.js +22 -0
  812. package/serialization/resources/assets/types/DeleteFolderResponse.d.ts +2 -0
  813. package/serialization/resources/assets/types/DeleteFolderResponse.js +42 -0
  814. package/serialization/resources/assets/types/DeleteRuleResponse.d.ts +2 -0
  815. package/serialization/resources/assets/types/DeleteRuleResponse.js +39 -0
  816. package/serialization/resources/assets/types/ListFlowsResponseItem.d.ts +2 -0
  817. package/serialization/resources/assets/types/ListFlowsResponseItem.js +44 -0
  818. package/serialization/resources/assets/types/ListFoldersResponseItem.d.ts +2 -0
  819. package/serialization/resources/assets/types/ListFoldersResponseItem.js +42 -0
  820. package/serialization/resources/assets/types/ListRulesResponseItem.d.ts +2 -0
  821. package/serialization/resources/assets/types/ListRulesResponseItem.js +67 -0
  822. package/serialization/resources/assets/types/ListRulesResponseItemFolder.d.ts +2 -0
  823. package/serialization/resources/assets/types/ListRulesResponseItemFolder.js +42 -0
  824. package/serialization/resources/assets/types/UpsertFolderResponse.d.ts +2 -0
  825. package/serialization/resources/assets/types/UpsertFolderResponse.js +42 -0
  826. package/serialization/resources/assets/types/UsageResponse.d.ts +2 -0
  827. package/serialization/resources/assets/types/UsageResponse.js +44 -0
  828. package/serialization/resources/assets/types/index.d.ts +1 -0
  829. package/serialization/resources/assets/types/index.js +28 -0
  830. package/serialization/resources/decisions/index.d.ts +1 -0
  831. package/serialization/resources/decisions/index.js +21 -0
  832. package/serialization/resources/decisions/types/QueryResponse.d.ts +2 -0
  833. package/serialization/resources/decisions/types/QueryResponse.js +42 -0
  834. package/serialization/resources/decisions/types/index.d.ts +1 -0
  835. package/serialization/resources/decisions/types/index.js +21 -0
  836. package/serialization/resources/flows/client/execute.d.ts +3 -0
  837. package/serialization/resources/flows/client/execute.js +38 -0
  838. package/serialization/resources/flows/client/index.d.ts +2 -0
  839. package/serialization/resources/flows/client/index.js +33 -0
  840. package/serialization/resources/flows/index.d.ts +1 -0
  841. package/serialization/resources/flows/index.js +21 -0
  842. package/serialization/resources/index.d.ts +8 -0
  843. package/serialization/resources/index.js +52 -0
  844. package/serialization/resources/rules/client/bulkSolve.d.ts +3 -0
  845. package/serialization/resources/rules/client/bulkSolve.js +38 -0
  846. package/serialization/resources/rules/client/index.d.ts +4 -0
  847. package/serialization/resources/rules/client/index.js +35 -0
  848. package/serialization/resources/rules/client/parallelSolve.d.ts +3 -0
  849. package/serialization/resources/rules/client/parallelSolve.js +38 -0
  850. package/serialization/resources/rules/client/solve.d.ts +3 -0
  851. package/serialization/resources/rules/client/solve.js +38 -0
  852. package/serialization/resources/rules/index.d.ts +1 -0
  853. package/serialization/resources/rules/index.js +21 -0
  854. package/serialization/resources/tests/client/index.d.ts +3 -0
  855. package/serialization/resources/tests/client/index.js +40 -0
  856. package/serialization/resources/tests/client/listFlowTests.d.ts +2 -0
  857. package/serialization/resources/tests/client/listFlowTests.js +56 -0
  858. package/serialization/resources/tests/client/listRuleTests.d.ts +2 -0
  859. package/serialization/resources/tests/client/listRuleTests.js +56 -0
  860. package/serialization/resources/tests/client/requests/CreateFlowTestRequest.d.ts +2 -0
  861. package/serialization/resources/tests/client/requests/CreateFlowTestRequest.js +42 -0
  862. package/serialization/resources/tests/client/requests/CreateRuleTestRequest.d.ts +2 -0
  863. package/serialization/resources/tests/client/requests/CreateRuleTestRequest.js +42 -0
  864. package/serialization/resources/tests/client/requests/index.d.ts +5 -0
  865. package/serialization/resources/tests/client/requests/index.js +7 -0
  866. package/serialization/resources/tests/index.d.ts +1 -0
  867. package/serialization/resources/tests/index.js +22 -0
  868. package/serialization/resources/tests/types/CreateFlowTestResponse.d.ts +2 -0
  869. package/serialization/resources/tests/types/CreateFlowTestResponse.js +47 -0
  870. package/serialization/resources/tests/types/CreateRuleTestResponse.d.ts +2 -0
  871. package/serialization/resources/tests/types/CreateRuleTestResponse.js +47 -0
  872. package/serialization/resources/tests/types/DeleteFlowTestResponse.d.ts +2 -0
  873. package/serialization/resources/tests/types/DeleteFlowTestResponse.js +47 -0
  874. package/serialization/resources/tests/types/DeleteRuleTestResponse.d.ts +2 -0
  875. package/serialization/resources/tests/types/DeleteRuleTestResponse.js +47 -0
  876. package/serialization/resources/tests/types/ListFlowTestsResponseItem.d.ts +2 -0
  877. package/serialization/resources/tests/types/ListFlowTestsResponseItem.js +47 -0
  878. package/serialization/resources/tests/types/ListRuleTestsResponseItem.d.ts +2 -0
  879. package/serialization/resources/tests/types/ListRuleTestsResponseItem.js +47 -0
  880. package/serialization/resources/tests/types/index.d.ts +1 -0
  881. package/serialization/resources/tests/types/index.js +26 -0
  882. package/serialization/resources/users/client/index.d.ts +2 -0
  883. package/serialization/resources/users/client/index.js +39 -0
  884. package/serialization/resources/users/client/listGroups.d.ts +2 -0
  885. package/serialization/resources/users/client/listGroups.js +56 -0
  886. package/serialization/resources/users/client/requests/CreateGroupRequest.d.ts +2 -0
  887. package/serialization/resources/users/client/requests/CreateGroupRequest.js +40 -0
  888. package/serialization/resources/users/client/requests/InviteRequest.d.ts +2 -0
  889. package/serialization/resources/users/client/requests/InviteRequest.js +60 -0
  890. package/serialization/resources/users/client/requests/index.d.ts +5 -0
  891. package/serialization/resources/users/client/requests/index.js +7 -0
  892. package/serialization/resources/users/index.d.ts +1 -0
  893. package/serialization/resources/users/index.js +22 -0
  894. package/serialization/resources/users/types/CreateGroupResponse.d.ts +2 -0
  895. package/serialization/resources/users/types/CreateGroupResponse.js +42 -0
  896. package/serialization/resources/users/types/InviteRequestRole.d.ts +2 -0
  897. package/serialization/resources/users/types/InviteRequestRole.js +37 -0
  898. package/serialization/resources/users/types/InviteResponse.d.ts +2 -0
  899. package/serialization/resources/users/types/InviteResponse.js +39 -0
  900. package/serialization/resources/users/types/ListGroupsResponseItem.d.ts +2 -0
  901. package/serialization/resources/users/types/ListGroupsResponseItem.js +42 -0
  902. package/serialization/resources/users/types/index.d.ts +1 -0
  903. package/serialization/resources/users/types/index.js +24 -0
  904. package/serialization/resources/values/client/index.d.ts +3 -0
  905. package/serialization/resources/values/client/index.js +34 -0
  906. package/serialization/resources/values/client/listDynamicValues.d.ts +2 -0
  907. package/serialization/resources/values/client/listDynamicValues.js +56 -0
  908. package/serialization/resources/values/client/update.d.ts +3 -0
  909. package/serialization/resources/values/client/update.js +57 -0
  910. package/serialization/resources/values/index.d.ts +1 -0
  911. package/serialization/resources/values/index.js +22 -0
  912. package/serialization/resources/values/types/DeleteDynamicValueResponse.d.ts +2 -0
  913. package/serialization/resources/values/types/DeleteDynamicValueResponse.js +39 -0
  914. package/serialization/resources/values/types/ListDynamicValuesResponseItem.d.ts +2 -0
  915. package/serialization/resources/values/types/ListDynamicValuesResponseItem.js +66 -0
  916. package/serialization/resources/values/types/ListDynamicValuesResponseItemType.d.ts +2 -0
  917. package/serialization/resources/values/types/ListDynamicValuesResponseItemType.js +37 -0
  918. package/serialization/resources/values/types/ListDynamicValuesResponseItemUsagesItem.d.ts +2 -0
  919. package/serialization/resources/values/types/ListDynamicValuesResponseItemUsagesItem.js +44 -0
  920. package/serialization/resources/values/types/ListDynamicValuesResponseItemValue.d.ts +2 -0
  921. package/serialization/resources/values/types/ListDynamicValuesResponseItemValue.js +42 -0
  922. package/serialization/resources/values/types/UpdateRequestValue.d.ts +2 -0
  923. package/serialization/resources/values/types/UpdateRequestValue.js +42 -0
  924. package/serialization/resources/values/types/UpdateResponseItem.d.ts +2 -0
  925. package/serialization/resources/values/types/UpdateResponseItem.js +61 -0
  926. package/serialization/resources/values/types/UpdateResponseItemType.d.ts +2 -0
  927. package/serialization/resources/values/types/UpdateResponseItemType.js +37 -0
  928. package/serialization/resources/values/types/UpdateResponseItemValue.d.ts +2 -0
  929. package/serialization/resources/values/types/UpdateResponseItemValue.js +42 -0
  930. package/serialization/resources/values/types/index.d.ts +1 -0
  931. package/serialization/resources/values/types/index.js +29 -0
  932. package/serialization/types/BadRequestErrorBody.d.ts +2 -0
  933. package/serialization/types/BadRequestErrorBody.js +39 -0
  934. package/serialization/types/ForbiddenErrorBody.d.ts +2 -0
  935. package/serialization/types/ForbiddenErrorBody.js +39 -0
  936. package/serialization/types/InternalServerErrorBody.d.ts +2 -0
  937. package/serialization/types/InternalServerErrorBody.js +39 -0
  938. package/serialization/types/NotFoundErrorBody.d.ts +2 -0
  939. package/serialization/types/NotFoundErrorBody.js +39 -0
  940. package/serialization/types/index.d.ts +1 -0
  941. package/serialization/types/index.js +24 -0
  942. package/tests/client.test.ts +11 -0
package/forge/rule.js ADDED
@@ -0,0 +1,702 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.Rule = exports.Condition = exports.RuleTest = void 0;
13
+ const types_js_1 = require("./types.js");
14
+ const operators_js_1 = require("./operators.js");
15
+ class RuleTest {
16
+ constructor() {
17
+ this.id = this.generateId();
18
+ this.name = "Untitled Test";
19
+ this.request = {};
20
+ this.response = {};
21
+ this.critical = false;
22
+ this.lastExecuted = null;
23
+ this.testState = null;
24
+ this.error = null;
25
+ this.success = null;
26
+ }
27
+ generateId() {
28
+ return Array.from({ length: 21 }, () => "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"[Math.floor(Math.random() * 62)]).join("");
29
+ }
30
+ setName(name) {
31
+ this.name = name;
32
+ return this;
33
+ }
34
+ expect(request, response) {
35
+ this.request = request;
36
+ this.response = response;
37
+ return this;
38
+ }
39
+ isCritical(critical = true) {
40
+ this.critical = critical;
41
+ return this;
42
+ }
43
+ toDict() {
44
+ return {
45
+ id: this.id,
46
+ name: this.name,
47
+ request: this.request,
48
+ response: this.response,
49
+ critical: this.critical,
50
+ lastExecuted: this.lastExecuted,
51
+ testState: this.testState,
52
+ error: this.error,
53
+ success: this.success,
54
+ };
55
+ }
56
+ static fromJSON(data) {
57
+ const jsonData = typeof data === "string" ? JSON.parse(data) : data;
58
+ if (typeof jsonData !== "object") {
59
+ throw new Error("Input must be a dictionary or JSON object");
60
+ }
61
+ const test = new RuleTest();
62
+ test.id = jsonData.id || test.generateId();
63
+ test.name = jsonData.name || "Untitled Test";
64
+ test.request = jsonData.request || {};
65
+ test.response = jsonData.response || {};
66
+ test.critical = jsonData.critical || false;
67
+ test.lastExecuted = jsonData.lastExecuted || null;
68
+ test.testState = jsonData.testState || null;
69
+ test.error = jsonData.error || null;
70
+ test.success = jsonData.success || null;
71
+ return test;
72
+ }
73
+ }
74
+ exports.RuleTest = RuleTest;
75
+ class Condition {
76
+ constructor(rule, conditions = {}, index = null, settings = {}) {
77
+ this.rule = rule;
78
+ this.request = {};
79
+ this.response = {};
80
+ this.index = index;
81
+ this.conditions = conditions;
82
+ this.settings = Object.assign({ enabled: true, groupId: null, priority: 0, schedule: [], or: false }, settings);
83
+ }
84
+ // Helper to process dynamic values
85
+ processDynamicValues(arg) {
86
+ if (arg && typeof arg === "object" && arg.$rb) {
87
+ return arg;
88
+ }
89
+ else if (Array.isArray(arg)) {
90
+ return arg.map((item) => this.processDynamicValues(item));
91
+ }
92
+ else if (arg && typeof arg === "object") {
93
+ return Object.entries(arg).reduce((acc, [key, value]) => {
94
+ acc[key] = this.processDynamicValues(value);
95
+ return acc;
96
+ }, {});
97
+ }
98
+ return arg;
99
+ }
100
+ when(conditions) {
101
+ for (const [fieldName, [operator, args]] of Object.entries(conditions)) {
102
+ if (!(fieldName in this.rule.fields)) {
103
+ throw new Error(`Field '${fieldName}' is not defined in request schema`);
104
+ }
105
+ if (this.index !== null) {
106
+ // Editing existing condition
107
+ this.rule.conditions[this.index].request[fieldName] = {
108
+ op: operator,
109
+ args: args.map((arg) => this.processDynamicValues(arg)),
110
+ };
111
+ }
112
+ else {
113
+ // Creating new condition
114
+ this.conditions[fieldName] = [operator, args];
115
+ }
116
+ }
117
+ return this;
118
+ }
119
+ then(responses) {
120
+ for (const [fieldName, value] of Object.entries(responses)) {
121
+ if (!(fieldName in this.rule.responseFields)) {
122
+ throw new Error(`Field '${fieldName}' is not defined in response schema`);
123
+ }
124
+ }
125
+ if (this.index !== null) {
126
+ // Editing existing condition
127
+ for (const [fieldName, value] of Object.entries(responses)) {
128
+ this.rule.conditions[this.index].response[fieldName] = {
129
+ value: this.processDynamicValues(value),
130
+ };
131
+ }
132
+ return this;
133
+ }
134
+ else {
135
+ // Creating new condition
136
+ this.response = responses;
137
+ const condition = {
138
+ request: {},
139
+ response: {},
140
+ settings: this.settings,
141
+ };
142
+ // Process conditions
143
+ for (const [fieldName, [operator, args]] of Object.entries(this.conditions)) {
144
+ condition.request[fieldName] = {
145
+ op: operator,
146
+ args: args.map((arg) => this.processDynamicValues(arg)),
147
+ };
148
+ }
149
+ // Process responses
150
+ for (const [fieldName, value] of Object.entries(this.response)) {
151
+ condition.response[fieldName] = {
152
+ value: this.processDynamicValues(value),
153
+ };
154
+ }
155
+ this.rule.conditions.push(condition);
156
+ return this.rule;
157
+ }
158
+ }
159
+ setPriority(priority) {
160
+ this.settings.priority = priority;
161
+ if (this.index !== null) {
162
+ this.rule.conditions[this.index].settings.priority = priority;
163
+ }
164
+ return this;
165
+ }
166
+ enable() {
167
+ this.settings.enabled = true;
168
+ if (this.index !== null) {
169
+ this.rule.conditions[this.index].settings.enabled = true;
170
+ }
171
+ return this;
172
+ }
173
+ disable() {
174
+ this.settings.enabled = false;
175
+ if (this.index !== null) {
176
+ this.rule.conditions[this.index].settings.enabled = false;
177
+ }
178
+ return this;
179
+ }
180
+ delete() {
181
+ if (this.index !== null) {
182
+ this.rule.conditions.splice(this.index, 1);
183
+ }
184
+ }
185
+ toString() {
186
+ return this.index !== null ? `<Condition: Row ${this.index}>` : "<Condition: New>";
187
+ }
188
+ [Symbol.toStringTag]() {
189
+ return this.toString();
190
+ }
191
+ [Symbol.for("nodejs.util.inspect.custom")]() {
192
+ return this.toString();
193
+ }
194
+ toJSON() {
195
+ return {
196
+ request: this.request,
197
+ response: this.response,
198
+ settings: this.settings,
199
+ };
200
+ }
201
+ }
202
+ exports.Condition = Condition;
203
+ class Rule {
204
+ constructor() {
205
+ this.id = this.generateUUID();
206
+ this.name = "Untitled Rule";
207
+ this.description = "";
208
+ this.folderId = null;
209
+ this.slug = this.generateSlug();
210
+ this.createdAt = new Date().toISOString();
211
+ this.updatedAt = this.createdAt;
212
+ this.updatedBy = "Rulebricks Forge SDK";
213
+ this.published = false;
214
+ this.sampleRequest = {};
215
+ this.sampleResponse = {};
216
+ this.testRequest = {};
217
+ this.testSuite = [];
218
+ this.fields = {};
219
+ this.responseFields = {};
220
+ this.conditions = [];
221
+ this.groups = {};
222
+ this.publishedRequestSchema = null;
223
+ this.publishedResponseSchema = null;
224
+ this.publishedConditions = null;
225
+ this.publishedGroups = {};
226
+ this.history = [];
227
+ this.form = null;
228
+ this.accessGroups = [];
229
+ this.settings = {
230
+ testing: false,
231
+ schemaValidation: false,
232
+ allProperties: false,
233
+ lockSchema: false,
234
+ };
235
+ }
236
+ generateUUID() {
237
+ return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
238
+ const r = (Math.random() * 16) | 0;
239
+ const v = c === "x" ? r : (r & 0x3) | 0x8;
240
+ return v.toString(16);
241
+ });
242
+ }
243
+ generateSlug(length = 10) {
244
+ const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
245
+ return Array.from({ length }, () => chars[Math.floor(Math.random() * chars.length)]).join("");
246
+ }
247
+ getFieldType(field) {
248
+ if (field instanceof operators_js_1.BooleanField)
249
+ return types_js_1.RuleType.BOOLEAN;
250
+ if (field instanceof operators_js_1.NumberField)
251
+ return types_js_1.RuleType.NUMBER;
252
+ if (field instanceof operators_js_1.StringField)
253
+ return types_js_1.RuleType.STRING;
254
+ if (field instanceof operators_js_1.DateField)
255
+ return types_js_1.RuleType.DATE;
256
+ if (field instanceof operators_js_1.ListField)
257
+ return types_js_1.RuleType.LIST;
258
+ return types_js_1.RuleType.STRING; // Default fallback
259
+ }
260
+ setWorkspace(client) {
261
+ this.workspace = client;
262
+ return this;
263
+ }
264
+ setName(name) {
265
+ this.name = name;
266
+ this.slug = this.generateSlug();
267
+ return this;
268
+ }
269
+ setDescription(description) {
270
+ this.description = description;
271
+ return this;
272
+ }
273
+ setFolder(folderName, createIfMissing = false) {
274
+ return __awaiter(this, void 0, void 0, function* () {
275
+ if (!this.workspace) {
276
+ throw new Error("A Rulebricks client is required to set a folder by name");
277
+ }
278
+ const folders = yield this.workspace.assets.listFolders();
279
+ let folder = folders.find((f) => f.name === folderName);
280
+ if (!folder && createIfMissing) {
281
+ if (folders.some((f) => f.name === folderName)) {
282
+ throw new Error("Folder name conflicts with an existing folder");
283
+ }
284
+ folder = yield this.workspace.assets.upsertFolder({ name: folderName });
285
+ }
286
+ if (!folder) {
287
+ throw new Error(`Folder '${folderName}' not found and createIfMissing is false`);
288
+ }
289
+ this.folderId = folder.id || null;
290
+ return this;
291
+ });
292
+ }
293
+ setFolderById(folderId) {
294
+ this.folderId = folderId;
295
+ return this;
296
+ }
297
+ setAlias(alias) {
298
+ return __awaiter(this, void 0, void 0, function* () {
299
+ if (!this.workspace) {
300
+ throw new Error("A Rulebricks client is required to set an alias");
301
+ }
302
+ if (alias.length < 3) {
303
+ throw new Error("Alias must be at least 3 characters long");
304
+ }
305
+ if (alias.includes("/") || alias.includes("\\") || alias.includes(" ")) {
306
+ throw new Error("Alias cannot contain slashes or spaces");
307
+ }
308
+ const validChars = /^[a-zA-Z0-9\-_]+$/;
309
+ if (!validChars.test(alias)) {
310
+ throw new Error("Alias cannot contain special characters");
311
+ }
312
+ const rules = yield this.workspace.assets.listRules();
313
+ if (rules.some((r) => r.slug === alias)) {
314
+ throw new Error("Alias conflicts with an existing rule");
315
+ }
316
+ this.slug = alias;
317
+ return this;
318
+ });
319
+ }
320
+ addBooleanField(name, description = "", defaultValue = false) {
321
+ const field = new operators_js_1.BooleanField(name, description, defaultValue);
322
+ this.fields[name] = field;
323
+ return field;
324
+ }
325
+ addNumberField(name, description = "", defaultValue = 0) {
326
+ const field = new operators_js_1.NumberField(name, description, defaultValue);
327
+ this.fields[name] = field;
328
+ return field;
329
+ }
330
+ addStringField(name, description = "", defaultValue = "") {
331
+ const field = new operators_js_1.StringField(name, description, defaultValue);
332
+ this.fields[name] = field;
333
+ return field;
334
+ }
335
+ addDateField(name, description = "", defaultValue) {
336
+ const field = new operators_js_1.DateField(name, description, defaultValue);
337
+ this.fields[name] = field;
338
+ return field;
339
+ }
340
+ addListField(name, description = "", defaultValue = []) {
341
+ const field = new operators_js_1.ListField(name, description, defaultValue);
342
+ this.fields[name] = field;
343
+ return field;
344
+ }
345
+ enableContinuousTesting(enabled = true) {
346
+ this.settings.testing = enabled;
347
+ return this;
348
+ }
349
+ enableSchemaValidation(enabled = true) {
350
+ this.settings.schemaValidation = enabled;
351
+ return this;
352
+ }
353
+ requireAllProperties(enabled = true) {
354
+ this.settings.allProperties = enabled;
355
+ return this;
356
+ }
357
+ lockSchema(enabled = true) {
358
+ this.settings.lockSchema = enabled;
359
+ return this;
360
+ }
361
+ addAccessGroup(groupName, createIfMissing = false) {
362
+ return __awaiter(this, void 0, void 0, function* () {
363
+ if (!this.workspace) {
364
+ throw new Error("A Rulebricks client is required to manage access groups");
365
+ }
366
+ const existingGroups = yield this.workspace.users.listGroups();
367
+ let group = existingGroups.find((g) => g.name === groupName);
368
+ if (!group && !createIfMissing) {
369
+ throw new Error(`User group '${groupName}' not found and createIfMissing is False`);
370
+ }
371
+ if (!group && createIfMissing) {
372
+ group = yield this.workspace.users.createGroup({ name: groupName });
373
+ }
374
+ if (!this.accessGroups.includes(groupName)) {
375
+ this.accessGroups.push(groupName);
376
+ }
377
+ return this;
378
+ });
379
+ }
380
+ removeAccessGroup(groupName) {
381
+ const index = this.accessGroups.indexOf(groupName);
382
+ if (index !== -1) {
383
+ this.accessGroups.splice(index, 1);
384
+ }
385
+ return this;
386
+ }
387
+ addBooleanResponse(name, description = "", defaultValue = false) {
388
+ const field = new operators_js_1.BooleanField(name, description, defaultValue);
389
+ this.responseFields[name] = field;
390
+ return field;
391
+ }
392
+ addNumberResponse(name, description = "", defaultValue = 0) {
393
+ const field = new operators_js_1.NumberField(name, description, defaultValue);
394
+ this.responseFields[name] = field;
395
+ return field;
396
+ }
397
+ addStringResponse(name, description = "", defaultValue = "") {
398
+ const field = new operators_js_1.StringField(name, description, defaultValue);
399
+ this.responseFields[name] = field;
400
+ return field;
401
+ }
402
+ addDateResponse(name, description = "", defaultValue) {
403
+ const field = new operators_js_1.DateField(name, description, defaultValue);
404
+ this.responseFields[name] = field;
405
+ return field;
406
+ }
407
+ addListResponse(name, description = "", defaultValue = []) {
408
+ const field = new operators_js_1.ListField(name, description, defaultValue);
409
+ this.responseFields[name] = field;
410
+ return field;
411
+ }
412
+ findConditions(conditions) {
413
+ return this.conditions
414
+ .map((condition, index) => {
415
+ let matchesAll = Object.entries(conditions).every(([field, [operator, args]]) => {
416
+ const request = condition.request[field];
417
+ if (!request)
418
+ return false;
419
+ if (request.op !== operator)
420
+ return false;
421
+ // Handle dynamic values
422
+ const requestArgs = request.args.map((arg) => typeof arg === "object" && arg.$rb ? arg.name.toUpperCase() : String(arg));
423
+ const searchArgs = args.map((arg) => typeof arg === "object" && arg.$rb ? arg.name.toUpperCase() : String(arg));
424
+ return JSON.stringify(requestArgs) === JSON.stringify(searchArgs);
425
+ });
426
+ if (matchesAll) {
427
+ const convertedRequest = {};
428
+ for (const [field, value] of Object.entries(condition.request)) {
429
+ convertedRequest[field] = [value.op, value.args];
430
+ }
431
+ return new Condition(this, convertedRequest, index, condition.settings);
432
+ }
433
+ return null;
434
+ })
435
+ .filter((condition) => condition !== null);
436
+ }
437
+ // Helper method to get proper field instances
438
+ getField(name, type) {
439
+ const field = this.fields[name];
440
+ if (!field) {
441
+ throw new Error(`Field '${name}' not found in request schema`);
442
+ }
443
+ const expectedType = this.getFieldType(field);
444
+ if (expectedType !== type) {
445
+ throw new Error(`Field '${name}' is not a ${type.toLowerCase()} field`);
446
+ }
447
+ return field;
448
+ }
449
+ getBooleanField(name) {
450
+ return this.getField(name, types_js_1.RuleType.BOOLEAN);
451
+ }
452
+ getNumberField(name) {
453
+ return this.getField(name, types_js_1.RuleType.NUMBER);
454
+ }
455
+ getStringField(name) {
456
+ return this.getField(name, types_js_1.RuleType.STRING);
457
+ }
458
+ getDateField(name) {
459
+ return this.getField(name, types_js_1.RuleType.DATE);
460
+ }
461
+ getListField(name) {
462
+ return this.getField(name, types_js_1.RuleType.LIST);
463
+ }
464
+ when(conditions = {}) {
465
+ const condition = new Condition(this, conditions);
466
+ return condition;
467
+ }
468
+ any(conditions) {
469
+ const condition = new Condition(this, conditions, null, { or: true });
470
+ return condition;
471
+ }
472
+ getConditions() {
473
+ return this.conditions;
474
+ }
475
+ getConditionCount() {
476
+ return this.conditions.length;
477
+ }
478
+ addTest(test) {
479
+ const existingTest = this.findTestById(test.id);
480
+ if (existingTest) {
481
+ Object.assign(existingTest, {
482
+ name: test.name,
483
+ request: test.request,
484
+ response: test.response,
485
+ critical: test.critical,
486
+ });
487
+ }
488
+ else {
489
+ this.testSuite.push(test);
490
+ }
491
+ return this;
492
+ }
493
+ removeTest(testId) {
494
+ this.testSuite = this.testSuite.filter((t) => t.id !== testId);
495
+ return this;
496
+ }
497
+ findTestById(testId) {
498
+ return this.testSuite.find((t) => t.id === testId);
499
+ }
500
+ findTestByName(name) {
501
+ return this.testSuite.find((t) => t.name === name);
502
+ }
503
+ update() {
504
+ return __awaiter(this, void 0, void 0, function* () {
505
+ if (!this.workspace) {
506
+ throw new Error("Workspace not set. Call setWorkspace() before updating the rule.");
507
+ }
508
+ const ruleData = this.toDict();
509
+ yield this.workspace.assets.importRule({ rule: ruleData });
510
+ return this;
511
+ });
512
+ }
513
+ publish() {
514
+ return __awaiter(this, void 0, void 0, function* () {
515
+ if (!this.workspace) {
516
+ throw new Error("A Rulebricks client is required to publish a rule");
517
+ }
518
+ const ruleData = this.toDict();
519
+ ruleData._publish = true;
520
+ yield this.workspace.assets.importRule({ rule: ruleData });
521
+ return this;
522
+ });
523
+ }
524
+ fromWorkspace(ruleId) {
525
+ return __awaiter(this, void 0, void 0, function* () {
526
+ if (!this.workspace) {
527
+ throw new Error("A Rulebricks client is required to load a rule from the workspace");
528
+ }
529
+ const ruleData = yield this.workspace.assets.exportRule({ id: ruleId });
530
+ const rule = Rule.fromJSON(ruleData);
531
+ Object.assign(this, rule);
532
+ return this;
533
+ });
534
+ }
535
+ toDict() {
536
+ let sampleRequest = this.sampleRequest || {};
537
+ let sampleResponse = this.sampleResponse || {};
538
+ for (const [name, field] of Object.entries(this.fields)) {
539
+ const parts = name.split(".");
540
+ let current = sampleRequest;
541
+ for (const part of parts.slice(0, -1)) {
542
+ current = current[part] = current[part] || {};
543
+ }
544
+ current[parts[parts.length - 1]] = field.defaultValue;
545
+ }
546
+ for (const [name, field] of Object.entries(this.responseFields)) {
547
+ const parts = name.split(".");
548
+ let current = sampleResponse;
549
+ for (const part of parts.slice(0, -1)) {
550
+ current = current[part] = current[part] || {};
551
+ }
552
+ current[parts[parts.length - 1]] = field.defaultValue;
553
+ }
554
+ const caseAndSpace = (str) => {
555
+ let titleCase = str.replace(/\w\S*/g, (text) => text.charAt(0).toUpperCase() + text.substring(1).toLowerCase());
556
+ // Replace underscores and any special characters with spaces
557
+ return titleCase.replace(/_/g, " ").replace(/[^a-zA-Z0-9 ]/g, "");
558
+ };
559
+ const fields = Object.entries(this.fields).map(([name, field]) => ({
560
+ name: caseAndSpace(name),
561
+ key: field.key || name,
562
+ type: field.type,
563
+ description: field.description,
564
+ defaultValue: field.defaultValue,
565
+ show: true,
566
+ }));
567
+ const responseFields = Object.entries(this.responseFields).map(([name, field]) => ({
568
+ name: caseAndSpace(name),
569
+ key: field.key || name,
570
+ type: field.type,
571
+ description: field.description,
572
+ defaultValue: field.defaultValue,
573
+ show: true,
574
+ }));
575
+ return {
576
+ id: this.id,
577
+ name: this.name,
578
+ description: this.description,
579
+ tag: this.folderId,
580
+ slug: this.slug,
581
+ createdAt: this.createdAt,
582
+ updatedAt: this.updatedAt,
583
+ updatedBy: this.updatedBy,
584
+ settings: this.settings,
585
+ accessGroups: this.accessGroups,
586
+ requestSchema: fields,
587
+ responseSchema: responseFields,
588
+ conditions: this.conditions,
589
+ testSuite: this.testSuite.map((test) => test.toDict()),
590
+ published_requestSchema: this.publishedRequestSchema,
591
+ published_responseSchema: this.publishedResponseSchema,
592
+ published_conditions: this.publishedConditions,
593
+ published_groups: this.publishedGroups,
594
+ form: this.form,
595
+ history: this.history,
596
+ published: this.published,
597
+ sampleRequest: sampleRequest,
598
+ sampleResponse: sampleResponse,
599
+ testRequest: this.testRequest,
600
+ groups: this.groups,
601
+ no_conditions: this.conditions.length,
602
+ };
603
+ }
604
+ toJSON() {
605
+ return JSON.stringify(this.toDict(), (_, value) => {
606
+ if (value instanceof Date) {
607
+ return value.toISOString();
608
+ }
609
+ return value;
610
+ }, 2);
611
+ }
612
+ static fromJSON(data) {
613
+ const jsonData = typeof data === "string" ? JSON.parse(data) : data;
614
+ const rule = new Rule();
615
+ rule.id = jsonData.id;
616
+ rule.name = jsonData.name;
617
+ rule.description = jsonData.description;
618
+ rule.folderId = jsonData.tag;
619
+ rule.slug = jsonData.slug;
620
+ rule.createdAt = jsonData.createdAt;
621
+ rule.updatedAt = jsonData.updatedAt;
622
+ rule.updatedBy = jsonData.updatedBy;
623
+ rule.settings = jsonData.settings;
624
+ rule.accessGroups = jsonData.accessGroups;
625
+ rule.conditions = jsonData.conditions;
626
+ rule.publishedRequestSchema = jsonData.publishedRequestSchema || null;
627
+ rule.publishedResponseSchema = jsonData.publishedResponseSchema || null;
628
+ rule.publishedConditions = jsonData.publishedConditions || null;
629
+ rule.publishedGroups = jsonData.publishedGroups || {};
630
+ rule.form = jsonData.form || null;
631
+ rule.history = jsonData.history || [];
632
+ rule.published = jsonData.published;
633
+ rule.testRequest = jsonData.testRequest || {};
634
+ rule.groups = jsonData.groups || {};
635
+ const caseAndSpace = (str) => {
636
+ let titleCase = str.replace(/\w\S*/g, (text) => text.charAt(0).toUpperCase() + text.substring(1).toLowerCase());
637
+ // Replace underscores and any special characters with spaces
638
+ return titleCase.replace(/_/g, " ").replace(/[^a-zA-Z0-9 ]/g, "");
639
+ };
640
+ // Convert request schema to fields
641
+ jsonData.requestSchema.forEach((fieldData) => {
642
+ const field = {
643
+ key: fieldData.key,
644
+ // start case and replace underscores and any special characters with spaces
645
+ name: fieldData.name || caseAndSpace(fieldData.key),
646
+ type: fieldData.type,
647
+ description: fieldData.description,
648
+ defaultValue: fieldData.defaultValue,
649
+ operators: {},
650
+ };
651
+ rule.fields[fieldData.name] = field;
652
+ });
653
+ // Convert response schema to fields
654
+ jsonData.responseSchema.forEach((fieldData) => {
655
+ const field = {
656
+ key: fieldData.key,
657
+ name: fieldData.name || caseAndSpace(fieldData.key),
658
+ type: fieldData.type,
659
+ description: fieldData.description,
660
+ defaultValue: fieldData.defaultValue,
661
+ operators: {},
662
+ };
663
+ rule.responseFields[fieldData.name] = field;
664
+ });
665
+ // Convert test suite
666
+ rule.testSuite = (jsonData.testSuite || []).map((testData) => RuleTest.fromJSON(testData));
667
+ return rule;
668
+ }
669
+ getEditorUrl() {
670
+ if (!this.workspace) {
671
+ throw new Error("Workspace not configured. Call setWorkspace() first.");
672
+ }
673
+ return `https://rulebricks.com/dashboard/${this.id}`;
674
+ }
675
+ toTable() {
676
+ const header = ["Condition", ...Object.keys(this.fields), "Response"];
677
+ const rows = [];
678
+ this.conditions.forEach((condition, index) => {
679
+ const row = [`#${index + 1}`];
680
+ // Add request conditions
681
+ Object.keys(this.fields).forEach((fieldName) => {
682
+ const cond = condition.request[fieldName];
683
+ row.push(cond ? `${cond.op} ${cond.args.join(", ")}` : "-");
684
+ });
685
+ // Add response
686
+ const responseStr = Object.entries(condition.response)
687
+ .map(([key, value]) => `${key}: ${value.value}`)
688
+ .join(", ");
689
+ row.push(responseStr || "-");
690
+ rows.push(row);
691
+ });
692
+ // Format as ASCII table
693
+ const maxLengths = header.map((_, colIndex) => Math.max(header[colIndex].length, ...rows.map((row) => row[colIndex].length)));
694
+ const separator = maxLengths.map((len) => "-".repeat(len)).join("-+-");
695
+ const formatRow = (row) => row.map((cell, i) => cell.padEnd(maxLengths[i])).join(" | ");
696
+ return [formatRow(header), separator, ...rows.map(formatRow)].join("\n");
697
+ }
698
+ toString() {
699
+ return `Rule(name="${this.name}", id="${this.id}", conditions=${this.conditions.length})`;
700
+ }
701
+ }
702
+ exports.Rule = Rule;