@zapier/zapier-sdk 0.18.3 → 0.19.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 (417) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/README.md +44 -32
  3. package/dist/index.cjs +658 -693
  4. package/dist/index.d.mts +272 -138
  5. package/dist/index.d.ts +2541 -40
  6. package/dist/index.mjs +638 -692
  7. package/package.json +14 -13
  8. package/dist/api/auth.d.ts +0 -19
  9. package/dist/api/auth.d.ts.map +0 -1
  10. package/dist/api/auth.js +0 -70
  11. package/dist/api/auth.test.d.ts +0 -2
  12. package/dist/api/auth.test.d.ts.map +0 -1
  13. package/dist/api/auth.test.js +0 -220
  14. package/dist/api/client.d.ts +0 -9
  15. package/dist/api/client.d.ts.map +0 -1
  16. package/dist/api/client.integration.test.d.ts +0 -5
  17. package/dist/api/client.integration.test.d.ts.map +0 -1
  18. package/dist/api/client.integration.test.js +0 -318
  19. package/dist/api/client.js +0 -374
  20. package/dist/api/client.methods.test.d.ts +0 -2
  21. package/dist/api/client.methods.test.d.ts.map +0 -1
  22. package/dist/api/client.methods.test.js +0 -158
  23. package/dist/api/client.test.d.ts +0 -2
  24. package/dist/api/client.test.d.ts.map +0 -1
  25. package/dist/api/client.test.js +0 -96
  26. package/dist/api/debug.d.ts +0 -14
  27. package/dist/api/debug.d.ts.map +0 -1
  28. package/dist/api/debug.js +0 -131
  29. package/dist/api/debug.test.d.ts +0 -2
  30. package/dist/api/debug.test.d.ts.map +0 -1
  31. package/dist/api/debug.test.js +0 -59
  32. package/dist/api/index.d.ts +0 -30
  33. package/dist/api/index.d.ts.map +0 -1
  34. package/dist/api/index.js +0 -43
  35. package/dist/api/polling.d.ts +0 -46
  36. package/dist/api/polling.d.ts.map +0 -1
  37. package/dist/api/polling.js +0 -139
  38. package/dist/api/polling.test.d.ts +0 -2
  39. package/dist/api/polling.test.d.ts.map +0 -1
  40. package/dist/api/polling.test.js +0 -318
  41. package/dist/api/router.d.ts +0 -16
  42. package/dist/api/router.d.ts.map +0 -1
  43. package/dist/api/router.js +0 -31
  44. package/dist/api/router.test.d.ts +0 -2
  45. package/dist/api/router.test.d.ts.map +0 -1
  46. package/dist/api/router.test.js +0 -103
  47. package/dist/api/schemas.d.ts +0 -531
  48. package/dist/api/schemas.d.ts.map +0 -1
  49. package/dist/api/schemas.js +0 -389
  50. package/dist/api/types.d.ts +0 -82
  51. package/dist/api/types.d.ts.map +0 -1
  52. package/dist/api/types.js +0 -1
  53. package/dist/auth.d.ts +0 -52
  54. package/dist/auth.d.ts.map +0 -1
  55. package/dist/auth.js +0 -72
  56. package/dist/auth.test.d.ts +0 -2
  57. package/dist/auth.test.d.ts.map +0 -1
  58. package/dist/auth.test.js +0 -102
  59. package/dist/constants.d.ts +0 -14
  60. package/dist/constants.d.ts.map +0 -1
  61. package/dist/constants.js +0 -13
  62. package/dist/index.d.ts.map +0 -1
  63. package/dist/index.js +0 -42
  64. package/dist/plugins/api/index.d.ts +0 -12
  65. package/dist/plugins/api/index.d.ts.map +0 -1
  66. package/dist/plugins/api/index.js +0 -24
  67. package/dist/plugins/apps/index.d.ts +0 -15
  68. package/dist/plugins/apps/index.d.ts.map +0 -1
  69. package/dist/plugins/apps/index.js +0 -112
  70. package/dist/plugins/apps/schemas.d.ts +0 -42
  71. package/dist/plugins/apps/schemas.d.ts.map +0 -1
  72. package/dist/plugins/apps/schemas.js +0 -14
  73. package/dist/plugins/eventEmission/builders.d.ts +0 -14
  74. package/dist/plugins/eventEmission/builders.d.ts.map +0 -1
  75. package/dist/plugins/eventEmission/builders.js +0 -109
  76. package/dist/plugins/eventEmission/index.d.ts +0 -38
  77. package/dist/plugins/eventEmission/index.d.ts.map +0 -1
  78. package/dist/plugins/eventEmission/index.js +0 -336
  79. package/dist/plugins/eventEmission/index.test.d.ts +0 -5
  80. package/dist/plugins/eventEmission/index.test.d.ts.map +0 -1
  81. package/dist/plugins/eventEmission/index.test.js +0 -581
  82. package/dist/plugins/eventEmission/transport.d.ts +0 -27
  83. package/dist/plugins/eventEmission/transport.d.ts.map +0 -1
  84. package/dist/plugins/eventEmission/transport.js +0 -104
  85. package/dist/plugins/eventEmission/transport.test.d.ts +0 -5
  86. package/dist/plugins/eventEmission/transport.test.d.ts.map +0 -1
  87. package/dist/plugins/eventEmission/transport.test.js +0 -164
  88. package/dist/plugins/eventEmission/types.d.ts +0 -63
  89. package/dist/plugins/eventEmission/types.d.ts.map +0 -1
  90. package/dist/plugins/eventEmission/types.js +0 -1
  91. package/dist/plugins/eventEmission/utils.d.ts +0 -45
  92. package/dist/plugins/eventEmission/utils.d.ts.map +0 -1
  93. package/dist/plugins/eventEmission/utils.js +0 -114
  94. package/dist/plugins/fetch/index.d.ts +0 -36
  95. package/dist/plugins/fetch/index.d.ts.map +0 -1
  96. package/dist/plugins/fetch/index.js +0 -62
  97. package/dist/plugins/fetch/schemas.d.ts +0 -19
  98. package/dist/plugins/fetch/schemas.d.ts.map +0 -1
  99. package/dist/plugins/fetch/schemas.js +0 -31
  100. package/dist/plugins/findFirstAuthentication/index.d.ts +0 -21
  101. package/dist/plugins/findFirstAuthentication/index.d.ts.map +0 -1
  102. package/dist/plugins/findFirstAuthentication/index.js +0 -36
  103. package/dist/plugins/findFirstAuthentication/index.test.d.ts +0 -2
  104. package/dist/plugins/findFirstAuthentication/index.test.d.ts.map +0 -1
  105. package/dist/plugins/findFirstAuthentication/index.test.js +0 -177
  106. package/dist/plugins/findFirstAuthentication/schemas.d.ts +0 -20
  107. package/dist/plugins/findFirstAuthentication/schemas.d.ts.map +0 -1
  108. package/dist/plugins/findFirstAuthentication/schemas.js +0 -18
  109. package/dist/plugins/findUniqueAuthentication/index.d.ts +0 -21
  110. package/dist/plugins/findUniqueAuthentication/index.d.ts.map +0 -1
  111. package/dist/plugins/findUniqueAuthentication/index.js +0 -39
  112. package/dist/plugins/findUniqueAuthentication/index.test.d.ts +0 -2
  113. package/dist/plugins/findUniqueAuthentication/index.test.d.ts.map +0 -1
  114. package/dist/plugins/findUniqueAuthentication/index.test.js +0 -159
  115. package/dist/plugins/findUniqueAuthentication/schemas.d.ts +0 -20
  116. package/dist/plugins/findUniqueAuthentication/schemas.d.ts.map +0 -1
  117. package/dist/plugins/findUniqueAuthentication/schemas.js +0 -18
  118. package/dist/plugins/getAction/index.d.ts +0 -25
  119. package/dist/plugins/getAction/index.d.ts.map +0 -1
  120. package/dist/plugins/getAction/index.js +0 -42
  121. package/dist/plugins/getAction/index.test.d.ts +0 -2
  122. package/dist/plugins/getAction/index.test.d.ts.map +0 -1
  123. package/dist/plugins/getAction/index.test.js +0 -211
  124. package/dist/plugins/getAction/schemas.d.ts +0 -30
  125. package/dist/plugins/getAction/schemas.d.ts.map +0 -1
  126. package/dist/plugins/getAction/schemas.js +0 -12
  127. package/dist/plugins/getApp/index.d.ts +0 -21
  128. package/dist/plugins/getApp/index.d.ts.map +0 -1
  129. package/dist/plugins/getApp/index.js +0 -44
  130. package/dist/plugins/getApp/index.test.d.ts +0 -2
  131. package/dist/plugins/getApp/index.test.d.ts.map +0 -1
  132. package/dist/plugins/getApp/index.test.js +0 -157
  133. package/dist/plugins/getApp/schemas.d.ts +0 -16
  134. package/dist/plugins/getApp/schemas.d.ts.map +0 -1
  135. package/dist/plugins/getApp/schemas.js +0 -8
  136. package/dist/plugins/getAuthentication/index.d.ts +0 -21
  137. package/dist/plugins/getAuthentication/index.d.ts.map +0 -1
  138. package/dist/plugins/getAuthentication/index.js +0 -29
  139. package/dist/plugins/getAuthentication/index.test.d.ts +0 -2
  140. package/dist/plugins/getAuthentication/index.test.d.ts.map +0 -1
  141. package/dist/plugins/getAuthentication/index.test.js +0 -106
  142. package/dist/plugins/getAuthentication/schemas.d.ts +0 -7
  143. package/dist/plugins/getAuthentication/schemas.d.ts.map +0 -1
  144. package/dist/plugins/getAuthentication/schemas.js +0 -1
  145. package/dist/plugins/getInputFieldsSchema/index.d.ts +0 -23
  146. package/dist/plugins/getInputFieldsSchema/index.d.ts.map +0 -1
  147. package/dist/plugins/getInputFieldsSchema/index.js +0 -53
  148. package/dist/plugins/getInputFieldsSchema/index.test.d.ts +0 -2
  149. package/dist/plugins/getInputFieldsSchema/index.test.d.ts.map +0 -1
  150. package/dist/plugins/getInputFieldsSchema/index.test.js +0 -291
  151. package/dist/plugins/getInputFieldsSchema/schemas.d.ts +0 -28
  152. package/dist/plugins/getInputFieldsSchema/schemas.d.ts.map +0 -1
  153. package/dist/plugins/getInputFieldsSchema/schemas.js +0 -13
  154. package/dist/plugins/getProfile/index.d.ts +0 -25
  155. package/dist/plugins/getProfile/index.d.ts.map +0 -1
  156. package/dist/plugins/getProfile/index.js +0 -39
  157. package/dist/plugins/getProfile/schemas.d.ts +0 -13
  158. package/dist/plugins/getProfile/schemas.d.ts.map +0 -1
  159. package/dist/plugins/getProfile/schemas.js +0 -6
  160. package/dist/plugins/listActions/index.d.ts +0 -30
  161. package/dist/plugins/listActions/index.d.ts.map +0 -1
  162. package/dist/plugins/listActions/index.js +0 -75
  163. package/dist/plugins/listActions/index.test.d.ts +0 -2
  164. package/dist/plugins/listActions/index.test.d.ts.map +0 -1
  165. package/dist/plugins/listActions/index.test.js +0 -453
  166. package/dist/plugins/listActions/schemas.d.ts +0 -35
  167. package/dist/plugins/listActions/schemas.d.ts.map +0 -1
  168. package/dist/plugins/listActions/schemas.js +0 -22
  169. package/dist/plugins/listApps/index.d.ts +0 -25
  170. package/dist/plugins/listApps/index.d.ts.map +0 -1
  171. package/dist/plugins/listApps/index.js +0 -69
  172. package/dist/plugins/listApps/index.test.d.ts +0 -2
  173. package/dist/plugins/listApps/index.test.d.ts.map +0 -1
  174. package/dist/plugins/listApps/index.test.js +0 -141
  175. package/dist/plugins/listApps/schemas.d.ts +0 -26
  176. package/dist/plugins/listApps/schemas.d.ts.map +0 -1
  177. package/dist/plugins/listApps/schemas.js +0 -19
  178. package/dist/plugins/listAuthentications/index.d.ts +0 -24
  179. package/dist/plugins/listAuthentications/index.d.ts.map +0 -1
  180. package/dist/plugins/listAuthentications/index.js +0 -77
  181. package/dist/plugins/listAuthentications/index.test.d.ts +0 -2
  182. package/dist/plugins/listAuthentications/index.test.d.ts.map +0 -1
  183. package/dist/plugins/listAuthentications/index.test.js +0 -832
  184. package/dist/plugins/listAuthentications/schemas.d.ts +0 -30
  185. package/dist/plugins/listAuthentications/schemas.d.ts.map +0 -1
  186. package/dist/plugins/listAuthentications/schemas.js +0 -32
  187. package/dist/plugins/listInputFieldChoices/index.d.ts +0 -33
  188. package/dist/plugins/listInputFieldChoices/index.d.ts.map +0 -1
  189. package/dist/plugins/listInputFieldChoices/index.js +0 -115
  190. package/dist/plugins/listInputFieldChoices/index.test.d.ts +0 -2
  191. package/dist/plugins/listInputFieldChoices/index.test.d.ts.map +0 -1
  192. package/dist/plugins/listInputFieldChoices/index.test.js +0 -717
  193. package/dist/plugins/listInputFieldChoices/schemas.d.ts +0 -43
  194. package/dist/plugins/listInputFieldChoices/schemas.d.ts.map +0 -1
  195. package/dist/plugins/listInputFieldChoices/schemas.js +0 -65
  196. package/dist/plugins/listInputFields/index.d.ts +0 -34
  197. package/dist/plugins/listInputFields/index.d.ts.map +0 -1
  198. package/dist/plugins/listInputFields/index.js +0 -204
  199. package/dist/plugins/listInputFields/index.test.d.ts +0 -2
  200. package/dist/plugins/listInputFields/index.test.d.ts.map +0 -1
  201. package/dist/plugins/listInputFields/index.test.js +0 -359
  202. package/dist/plugins/listInputFields/schemas.d.ts +0 -35
  203. package/dist/plugins/listInputFields/schemas.d.ts.map +0 -1
  204. package/dist/plugins/listInputFields/schemas.js +0 -23
  205. package/dist/plugins/manifest/index.d.ts +0 -85
  206. package/dist/plugins/manifest/index.d.ts.map +0 -1
  207. package/dist/plugins/manifest/index.js +0 -376
  208. package/dist/plugins/manifest/index.test.d.ts +0 -2
  209. package/dist/plugins/manifest/index.test.d.ts.map +0 -1
  210. package/dist/plugins/manifest/index.test.js +0 -1139
  211. package/dist/plugins/manifest/schemas.d.ts +0 -57
  212. package/dist/plugins/manifest/schemas.d.ts.map +0 -1
  213. package/dist/plugins/manifest/schemas.js +0 -50
  214. package/dist/plugins/registry/index.d.ts +0 -21
  215. package/dist/plugins/registry/index.d.ts.map +0 -1
  216. package/dist/plugins/registry/index.js +0 -117
  217. package/dist/plugins/request/index.d.ts +0 -21
  218. package/dist/plugins/request/index.d.ts.map +0 -1
  219. package/dist/plugins/request/index.js +0 -76
  220. package/dist/plugins/request/index.test.d.ts +0 -2
  221. package/dist/plugins/request/index.test.d.ts.map +0 -1
  222. package/dist/plugins/request/index.test.js +0 -337
  223. package/dist/plugins/request/schemas.d.ts +0 -54
  224. package/dist/plugins/request/schemas.d.ts.map +0 -1
  225. package/dist/plugins/request/schemas.js +0 -41
  226. package/dist/plugins/runAction/index.d.ts +0 -33
  227. package/dist/plugins/runAction/index.d.ts.map +0 -1
  228. package/dist/plugins/runAction/index.js +0 -108
  229. package/dist/plugins/runAction/index.test.d.ts +0 -2
  230. package/dist/plugins/runAction/index.test.d.ts.map +0 -1
  231. package/dist/plugins/runAction/index.test.js +0 -333
  232. package/dist/plugins/runAction/schemas.d.ts +0 -34
  233. package/dist/plugins/runAction/schemas.d.ts.map +0 -1
  234. package/dist/plugins/runAction/schemas.js +0 -23
  235. package/dist/resolvers/actionKey.d.ts +0 -15
  236. package/dist/resolvers/actionKey.d.ts.map +0 -1
  237. package/dist/resolvers/actionKey.js +0 -19
  238. package/dist/resolvers/actionType.d.ts +0 -10
  239. package/dist/resolvers/actionType.d.ts.map +0 -1
  240. package/dist/resolvers/actionType.js +0 -21
  241. package/dist/resolvers/appKey.d.ts +0 -3
  242. package/dist/resolvers/appKey.d.ts.map +0 -1
  243. package/dist/resolvers/appKey.js +0 -5
  244. package/dist/resolvers/authenticationId.d.ts +0 -9
  245. package/dist/resolvers/authenticationId.d.ts.map +0 -1
  246. package/dist/resolvers/authenticationId.js +0 -42
  247. package/dist/resolvers/index.d.ts +0 -8
  248. package/dist/resolvers/index.d.ts.map +0 -1
  249. package/dist/resolvers/index.js +0 -8
  250. package/dist/resolvers/inputFieldKey.d.ts +0 -11
  251. package/dist/resolvers/inputFieldKey.d.ts.map +0 -1
  252. package/dist/resolvers/inputFieldKey.js +0 -47
  253. package/dist/resolvers/inputs.d.ts +0 -17
  254. package/dist/resolvers/inputs.d.ts.map +0 -1
  255. package/dist/resolvers/inputs.js +0 -50
  256. package/dist/schemas/Action.d.ts +0 -24
  257. package/dist/schemas/Action.d.ts.map +0 -1
  258. package/dist/schemas/Action.js +0 -40
  259. package/dist/schemas/App.d.ts +0 -57
  260. package/dist/schemas/App.d.ts.map +0 -1
  261. package/dist/schemas/App.js +0 -31
  262. package/dist/schemas/Auth.d.ts +0 -55
  263. package/dist/schemas/Auth.d.ts.map +0 -1
  264. package/dist/schemas/Auth.js +0 -33
  265. package/dist/schemas/Field.d.ts +0 -61
  266. package/dist/schemas/Field.d.ts.map +0 -1
  267. package/dist/schemas/Field.js +0 -116
  268. package/dist/schemas/Run.d.ts +0 -3
  269. package/dist/schemas/Run.d.ts.map +0 -1
  270. package/dist/schemas/Run.js +0 -31
  271. package/dist/schemas/UserProfile.d.ts +0 -13
  272. package/dist/schemas/UserProfile.d.ts.map +0 -1
  273. package/dist/schemas/UserProfile.js +0 -32
  274. package/dist/sdk.d.ts +0 -146
  275. package/dist/sdk.d.ts.map +0 -1
  276. package/dist/sdk.js +0 -112
  277. package/dist/sdk.test.d.ts +0 -2
  278. package/dist/sdk.test.d.ts.map +0 -1
  279. package/dist/sdk.test.js +0 -255
  280. package/dist/services/implementations.d.ts +0 -63
  281. package/dist/services/implementations.d.ts.map +0 -1
  282. package/dist/services/implementations.js +0 -80
  283. package/dist/temporary-internal-core/handlers/listApps.d.ts +0 -67
  284. package/dist/temporary-internal-core/handlers/listApps.d.ts.map +0 -1
  285. package/dist/temporary-internal-core/handlers/listApps.js +0 -134
  286. package/dist/temporary-internal-core/handlers/listApps.test.d.ts +0 -2
  287. package/dist/temporary-internal-core/handlers/listApps.test.d.ts.map +0 -1
  288. package/dist/temporary-internal-core/handlers/listApps.test.js +0 -367
  289. package/dist/temporary-internal-core/index.d.ts +0 -18
  290. package/dist/temporary-internal-core/index.d.ts.map +0 -1
  291. package/dist/temporary-internal-core/index.js +0 -18
  292. package/dist/temporary-internal-core/schemas/apps/index.d.ts +0 -175
  293. package/dist/temporary-internal-core/schemas/apps/index.d.ts.map +0 -1
  294. package/dist/temporary-internal-core/schemas/apps/index.js +0 -97
  295. package/dist/temporary-internal-core/schemas/errors/index.d.ts +0 -139
  296. package/dist/temporary-internal-core/schemas/errors/index.d.ts.map +0 -1
  297. package/dist/temporary-internal-core/schemas/errors/index.js +0 -129
  298. package/dist/temporary-internal-core/schemas/implementations/index.d.ts +0 -127
  299. package/dist/temporary-internal-core/schemas/implementations/index.d.ts.map +0 -1
  300. package/dist/temporary-internal-core/schemas/implementations/index.js +0 -79
  301. package/dist/temporary-internal-core/types/handler.d.ts +0 -51
  302. package/dist/temporary-internal-core/types/handler.d.ts.map +0 -1
  303. package/dist/temporary-internal-core/types/handler.js +0 -8
  304. package/dist/temporary-internal-core/types/index.d.ts +0 -5
  305. package/dist/temporary-internal-core/types/index.d.ts.map +0 -1
  306. package/dist/temporary-internal-core/types/index.js +0 -4
  307. package/dist/temporary-internal-core/utils/app-locators.d.ts +0 -34
  308. package/dist/temporary-internal-core/utils/app-locators.d.ts.map +0 -1
  309. package/dist/temporary-internal-core/utils/app-locators.js +0 -39
  310. package/dist/temporary-internal-core/utils/string-utils.d.ts +0 -28
  311. package/dist/temporary-internal-core/utils/string-utils.d.ts.map +0 -1
  312. package/dist/temporary-internal-core/utils/string-utils.js +0 -52
  313. package/dist/temporary-internal-core/utils/transformations.d.ts +0 -18
  314. package/dist/temporary-internal-core/utils/transformations.d.ts.map +0 -1
  315. package/dist/temporary-internal-core/utils/transformations.js +0 -36
  316. package/dist/types/domain.d.ts +0 -52
  317. package/dist/types/domain.d.ts.map +0 -1
  318. package/dist/types/domain.js +0 -1
  319. package/dist/types/domain.test.d.ts +0 -2
  320. package/dist/types/domain.test.d.ts.map +0 -1
  321. package/dist/types/domain.test.js +0 -39
  322. package/dist/types/errors.d.ts +0 -143
  323. package/dist/types/errors.d.ts.map +0 -1
  324. package/dist/types/errors.js +0 -187
  325. package/dist/types/events.d.ts +0 -38
  326. package/dist/types/events.d.ts.map +0 -1
  327. package/dist/types/events.js +0 -7
  328. package/dist/types/functions.d.ts +0 -27
  329. package/dist/types/functions.d.ts.map +0 -1
  330. package/dist/types/functions.js +0 -1
  331. package/dist/types/plugin.d.ts +0 -75
  332. package/dist/types/plugin.d.ts.map +0 -1
  333. package/dist/types/plugin.js +0 -9
  334. package/dist/types/properties.d.ts +0 -33
  335. package/dist/types/properties.d.ts.map +0 -1
  336. package/dist/types/properties.js +0 -52
  337. package/dist/types/sdk.d.ts +0 -69
  338. package/dist/types/sdk.d.ts.map +0 -1
  339. package/dist/types/sdk.js +0 -4
  340. package/dist/types/telemetry-events.d.ts +0 -105
  341. package/dist/types/telemetry-events.d.ts.map +0 -1
  342. package/dist/types/telemetry-events.js +0 -8
  343. package/dist/utils/array-utils.d.ts +0 -31
  344. package/dist/utils/array-utils.d.ts.map +0 -1
  345. package/dist/utils/array-utils.js +0 -36
  346. package/dist/utils/array-utils.test.d.ts +0 -2
  347. package/dist/utils/array-utils.test.d.ts.map +0 -1
  348. package/dist/utils/array-utils.test.js +0 -107
  349. package/dist/utils/batch-utils.d.ts +0 -72
  350. package/dist/utils/batch-utils.d.ts.map +0 -1
  351. package/dist/utils/batch-utils.js +0 -162
  352. package/dist/utils/batch-utils.test.d.ts +0 -2
  353. package/dist/utils/batch-utils.test.d.ts.map +0 -1
  354. package/dist/utils/batch-utils.test.js +0 -476
  355. package/dist/utils/domain-utils.d.ts +0 -66
  356. package/dist/utils/domain-utils.d.ts.map +0 -1
  357. package/dist/utils/domain-utils.js +0 -164
  358. package/dist/utils/domain-utils.test.d.ts +0 -2
  359. package/dist/utils/domain-utils.test.d.ts.map +0 -1
  360. package/dist/utils/domain-utils.test.js +0 -346
  361. package/dist/utils/file-utils.d.ts +0 -4
  362. package/dist/utils/file-utils.d.ts.map +0 -1
  363. package/dist/utils/file-utils.js +0 -74
  364. package/dist/utils/file-utils.test.d.ts +0 -2
  365. package/dist/utils/file-utils.test.d.ts.map +0 -1
  366. package/dist/utils/file-utils.test.js +0 -51
  367. package/dist/utils/function-utils.d.ts +0 -73
  368. package/dist/utils/function-utils.d.ts.map +0 -1
  369. package/dist/utils/function-utils.js +0 -245
  370. package/dist/utils/function-utils.test.d.ts +0 -2
  371. package/dist/utils/function-utils.test.d.ts.map +0 -1
  372. package/dist/utils/function-utils.test.js +0 -110
  373. package/dist/utils/id-utils.d.ts +0 -13
  374. package/dist/utils/id-utils.d.ts.map +0 -1
  375. package/dist/utils/id-utils.js +0 -22
  376. package/dist/utils/id-utils.test.d.ts +0 -2
  377. package/dist/utils/id-utils.test.d.ts.map +0 -1
  378. package/dist/utils/id-utils.test.js +0 -22
  379. package/dist/utils/pagination-utils.d.ts +0 -37
  380. package/dist/utils/pagination-utils.d.ts.map +0 -1
  381. package/dist/utils/pagination-utils.js +0 -165
  382. package/dist/utils/pagination-utils.test.d.ts +0 -17
  383. package/dist/utils/pagination-utils.test.d.ts.map +0 -1
  384. package/dist/utils/pagination-utils.test.js +0 -461
  385. package/dist/utils/retry-utils.d.ts +0 -45
  386. package/dist/utils/retry-utils.d.ts.map +0 -1
  387. package/dist/utils/retry-utils.js +0 -51
  388. package/dist/utils/retry-utils.test.d.ts +0 -2
  389. package/dist/utils/retry-utils.test.d.ts.map +0 -1
  390. package/dist/utils/retry-utils.test.js +0 -90
  391. package/dist/utils/schema-utils.d.ts +0 -69
  392. package/dist/utils/schema-utils.d.ts.map +0 -1
  393. package/dist/utils/schema-utils.js +0 -72
  394. package/dist/utils/string-utils.d.ts +0 -40
  395. package/dist/utils/string-utils.d.ts.map +0 -1
  396. package/dist/utils/string-utils.js +0 -69
  397. package/dist/utils/string-utils.test.d.ts +0 -2
  398. package/dist/utils/string-utils.test.d.ts.map +0 -1
  399. package/dist/utils/string-utils.test.js +0 -59
  400. package/dist/utils/telemetry-utils.d.ts +0 -44
  401. package/dist/utils/telemetry-utils.d.ts.map +0 -1
  402. package/dist/utils/telemetry-utils.js +0 -55
  403. package/dist/utils/telemetry-utils.test.d.ts +0 -2
  404. package/dist/utils/telemetry-utils.test.d.ts.map +0 -1
  405. package/dist/utils/telemetry-utils.test.js +0 -94
  406. package/dist/utils/url-utils.d.ts +0 -19
  407. package/dist/utils/url-utils.d.ts.map +0 -1
  408. package/dist/utils/url-utils.js +0 -62
  409. package/dist/utils/url-utils.test.d.ts +0 -2
  410. package/dist/utils/url-utils.test.d.ts.map +0 -1
  411. package/dist/utils/url-utils.test.js +0 -103
  412. package/dist/utils/validation.d.ts +0 -4
  413. package/dist/utils/validation.d.ts.map +0 -1
  414. package/dist/utils/validation.js +0 -30
  415. package/dist/utils/validation.test.d.ts +0 -2
  416. package/dist/utils/validation.test.d.ts.map +0 -1
  417. package/dist/utils/validation.test.js +0 -44
@@ -1,164 +0,0 @@
1
- /**
2
- * Domain utility functions for working with app identifiers and data normalization
3
- */
4
- /**
5
- * Splits a versioned key to extract the base key and version
6
- *
7
- * @param versionedKey - Versioned key in format "KeyName@version" (e.g., "SlackCLIAPI@1.21.1")
8
- * @returns Tuple of [baseKey, version] or [versionedKey, undefined] if no @ symbol
9
- *
10
- * @example
11
- * splitVersionedKey("SlackCLIAPI@1.21.1") // ["SlackCLIAPI", "1.21.1"]
12
- * splitVersionedKey("SomeAPI") // ["SomeAPI", undefined]
13
- */
14
- export function splitVersionedKey(versionedKey) {
15
- const parts = versionedKey.split("@");
16
- if (parts.length >= 2) {
17
- const baseKey = parts[0];
18
- const version = parts.slice(1).join("@"); // Handle edge case of multiple @ symbols
19
- return [baseKey, version];
20
- }
21
- return [versionedKey, undefined];
22
- }
23
- /**
24
- * Converts a lightweight ImplementationMeta to a slimmed AppItem
25
- *
26
- * @param implementationMeta - Raw ImplementationMeta from API
27
- * @returns Normalized AppItem with essential fields only
28
- */
29
- export function normalizeImplementationMetaToAppItem(implementationMeta) {
30
- const [selectedApi, appVersion] = splitVersionedKey(implementationMeta.id);
31
- const { id, name, ...restOfImplementationMeta } = implementationMeta;
32
- return {
33
- ...restOfImplementationMeta,
34
- title: name,
35
- key: selectedApi,
36
- implementation_id: id,
37
- version: appVersion,
38
- };
39
- }
40
- export function normalizeActionItem(action) {
41
- const { name, type, selected_api: selectedApi } = action;
42
- // Split version from selected_api
43
- const [appKey, appVersion] = selectedApi
44
- ? splitVersionedKey(selectedApi)
45
- : ["", undefined];
46
- return {
47
- // Only include the fields we want - explicitly list them
48
- id: action.id,
49
- key: action.key,
50
- description: action.description,
51
- is_important: action.is_important,
52
- is_hidden: action.is_hidden,
53
- // Transformed fields
54
- app_key: appKey,
55
- app_version: appVersion,
56
- action_type: type,
57
- title: name, // Map name to title
58
- type: "action",
59
- };
60
- }
61
- /**
62
- * Groups app keys by their type based on format patterns
63
- *
64
- * @param appKeys Array of app key strings to categorize
65
- * @returns Object with arrays of keys grouped by type: selectedApi (CLI APIs), slug (everything else)
66
- *
67
- * @example
68
- * groupVersionedAppKeysByType([
69
- * 'FormatterCLIAPI@1.0.0',
70
- * 'slack',
71
- * 'AnotherAPI'
72
- * ])
73
- * // Returns: {
74
- * // selectedApi: ['FormatterCLIAPI@1.0.0', 'AnotherAPI'],
75
- * // slug: ['slack']
76
- * // }
77
- */
78
- export function groupVersionedAppKeysByType(appKeys) {
79
- const result = {
80
- selectedApi: [],
81
- slug: [],
82
- };
83
- // Use Sets to track seen keys for deduplication
84
- const seenSelectedApi = new Set();
85
- const seenSlugs = new Set();
86
- for (const key of appKeys) {
87
- const appLocator = toAppLocator(key);
88
- if (appLocator.slug) {
89
- // For slugs, we need to reconstruct the versioned slug
90
- const versionedSlug = appLocator.version
91
- ? `${appLocator.slug}@${appLocator.version}`
92
- : appLocator.slug;
93
- if (!seenSlugs.has(versionedSlug)) {
94
- seenSlugs.add(versionedSlug);
95
- result.slug.push(versionedSlug);
96
- }
97
- }
98
- else {
99
- // For implementation names (selectedApi)
100
- if (!seenSelectedApi.has(key)) {
101
- seenSelectedApi.add(key);
102
- result.selectedApi.push(key);
103
- }
104
- }
105
- }
106
- return result;
107
- }
108
- export function groupAppKeysByType(appKeys) {
109
- const grouped = groupVersionedAppKeysByType(appKeys);
110
- // Extract base keys and dedupe by using Set
111
- return {
112
- selectedApi: [
113
- ...new Set(grouped.selectedApi.map((key) => key.split("@")[0])),
114
- ],
115
- slug: [...new Set(grouped.slug.map((key) => key.split("@")[0]))],
116
- };
117
- }
118
- export function isSlug(slug) {
119
- return !!slug.match(/^[a-z0-9]+(?:-[a-z0-9]+)*$/);
120
- }
121
- export function isSnakeCasedSlug(slug) {
122
- // Allow leading underscore for slugs starting with a number.
123
- if (slug.match(/^_[0-9]/)) {
124
- slug = slug.slice(1);
125
- }
126
- return !!slug.match(/^[a-z0-9]+(?:_[a-z0-9]+)*$/);
127
- }
128
- export function dashifySnakeCasedSlug(slug) {
129
- // Only dashify if it's a valid snake_cased slug.
130
- if (!isSnakeCasedSlug(slug)) {
131
- return slug;
132
- }
133
- // Allow one leading underscore for slugs starting with a number.
134
- if (slug.startsWith("_")) {
135
- slug = slug.slice(1);
136
- }
137
- return slug.replace(/_/g, "-");
138
- }
139
- export function isUuid(appKey) {
140
- return /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(appKey);
141
- }
142
- export function toAppLocator(appKey) {
143
- const [appKeyWithoutVersion, version] = splitVersionedKey(appKey);
144
- if (isUuid(appKeyWithoutVersion)) {
145
- throw new Error(`UUID app keys are not supported. Use app slug or implementation ID instead of: ${appKey}`);
146
- }
147
- const slug = isSlug(appKeyWithoutVersion)
148
- ? appKeyWithoutVersion
149
- : isSnakeCasedSlug(appKeyWithoutVersion)
150
- ? dashifySnakeCasedSlug(appKeyWithoutVersion)
151
- : undefined;
152
- return {
153
- lookupAppKey: appKeyWithoutVersion,
154
- slug,
155
- implementationName: slug ? undefined : appKeyWithoutVersion,
156
- version,
157
- };
158
- }
159
- export function isResolvedAppLocator(appLocator) {
160
- return !!appLocator.implementationName;
161
- }
162
- export function toImplementationId(appLocator) {
163
- return `${appLocator.implementationName}@${appLocator.version || "latest"}`;
164
- }
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=domain-utils.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"domain-utils.test.d.ts","sourceRoot":"","sources":["../../src/utils/domain-utils.test.ts"],"names":[],"mappings":""}
@@ -1,346 +0,0 @@
1
- import { describe, it, expect } from "vitest";
2
- import { groupVersionedAppKeysByType, groupAppKeysByType, toAppLocator, } from "./domain-utils";
3
- describe("domain-utils", () => {
4
- describe("groupVersionedAppKeysByType", () => {
5
- it("should reject UUID app keys", () => {
6
- expect(() => {
7
- groupVersionedAppKeysByType(["61e47557-af91-4b0c-a3e0-c28606357664"]);
8
- }).toThrow("UUID app keys are not supported. Use app slug or implementation ID instead of: 61e47557-af91-4b0c-a3e0-c28606357664");
9
- });
10
- it("should categorize *API as selectedApi", () => {
11
- const result = groupVersionedAppKeysByType(["FormatterCLIAPI"]);
12
- expect(result).toEqual({
13
- selectedApi: ["FormatterCLIAPI"],
14
- slug: [],
15
- });
16
- });
17
- it("should categorize various API types as selectedApi", () => {
18
- const result = groupVersionedAppKeysByType([
19
- "FormatterCLIAPI",
20
- "SlackAPI",
21
- "GmailRESTAPI",
22
- "WebhookAPI",
23
- "AnythingWithUppercase",
24
- ]);
25
- expect(result).toEqual({
26
- selectedApi: [
27
- "FormatterCLIAPI",
28
- "SlackAPI",
29
- "GmailRESTAPI",
30
- "WebhookAPI",
31
- "AnythingWithUppercase",
32
- ],
33
- slug: [],
34
- });
35
- });
36
- it("should categorize lower-case strings as slugs, converting underscores to dashes", () => {
37
- const result = groupVersionedAppKeysByType([
38
- "slack",
39
- "google-sheets",
40
- "_100hires_ats",
41
- "amazon_redshift",
42
- ]);
43
- expect(result).toEqual({
44
- selectedApi: [],
45
- slug: ["slack", "google-sheets", "100hires-ats", "amazon-redshift"],
46
- });
47
- });
48
- it("should preserve version from API implementations", () => {
49
- const result = groupVersionedAppKeysByType(["FormatterCLIAPI@1.0.0"]);
50
- expect(result).toEqual({
51
- selectedApi: ["FormatterCLIAPI@1.0.0"],
52
- slug: [],
53
- });
54
- });
55
- it("should preserve version from slugs", () => {
56
- const result = groupVersionedAppKeysByType(["slack@2.1.0"]);
57
- expect(result).toEqual({
58
- selectedApi: [],
59
- slug: ["slack@2.1.0"],
60
- });
61
- });
62
- it("should handle mixed types correctly", () => {
63
- const result = groupVersionedAppKeysByType([
64
- "FormatterCLIAPI@1.0.0",
65
- "slack",
66
- "AnotherAPI",
67
- "gmail@3.0.1",
68
- ]);
69
- expect(result).toEqual({
70
- selectedApi: ["FormatterCLIAPI@1.0.0", "AnotherAPI"],
71
- slug: ["slack", "gmail@3.0.1"],
72
- });
73
- });
74
- it("should handle empty array", () => {
75
- const result = groupVersionedAppKeysByType([]);
76
- expect(result).toEqual({
77
- selectedApi: [],
78
- slug: [],
79
- });
80
- });
81
- it("should reject uppercase and lowercase UUIDs", () => {
82
- expect(() => {
83
- groupVersionedAppKeysByType(["61E47557-AF91-4B0C-A3E0-C28606357664"]);
84
- }).toThrow("UUID app keys are not supported. Use app slug or implementation ID instead of: 61E47557-AF91-4B0C-A3E0-C28606357664");
85
- expect(() => {
86
- groupVersionedAppKeysByType(["f47ac10b-58cc-4372-a567-0e02b2c3d479"]);
87
- }).toThrow("UUID app keys are not supported. Use app slug or implementation ID instead of: f47ac10b-58cc-4372-a567-0e02b2c3d479");
88
- });
89
- it("should categorize partial UUIDs as slugs", () => {
90
- const result = groupVersionedAppKeysByType([
91
- "61e47557-af91-4b0c-a3e0", // too short
92
- "61e47557-af91-4b0c-a3e0-c28606357664-extra", // too long
93
- ]);
94
- expect(result).toEqual({
95
- selectedApi: [],
96
- slug: [
97
- "61e47557-af91-4b0c-a3e0",
98
- "61e47557-af91-4b0c-a3e0-c28606357664-extra",
99
- ],
100
- });
101
- });
102
- it("should dedupe exact duplicate versioned keys", () => {
103
- const result = groupVersionedAppKeysByType([
104
- "slack@2.1.0",
105
- "FormatterCLIAPI@1.0.0",
106
- "slack@2.1.0", // exact duplicate
107
- "FormatterCLIAPI@1.0.0", // exact duplicate
108
- "slack@2.1.1",
109
- "FormatterCLIAPI@1.0.1",
110
- ]);
111
- expect(result).toEqual({
112
- selectedApi: ["FormatterCLIAPI@1.0.0", "FormatterCLIAPI@1.0.1"],
113
- slug: ["slack@2.1.0", "slack@2.1.1"],
114
- });
115
- });
116
- });
117
- describe("groupAppKeysByType", () => {
118
- it("should strip versions from API implementations", () => {
119
- const result = groupAppKeysByType(["FormatterCLIAPI@1.0.0"]);
120
- expect(result).toEqual({
121
- selectedApi: ["FormatterCLIAPI"],
122
- slug: [],
123
- });
124
- });
125
- it("should strip versions from slugs", () => {
126
- const result = groupAppKeysByType(["slack@2.1.0"]);
127
- expect(result).toEqual({
128
- selectedApi: [],
129
- slug: ["slack"],
130
- });
131
- });
132
- it("should handle mixed types and strip versions", () => {
133
- const result = groupAppKeysByType([
134
- "FormatterCLIAPI@1.0.0",
135
- "slack",
136
- "AnotherAPI@2.3.4",
137
- "gmail@3.0.1",
138
- ]);
139
- expect(result).toEqual({
140
- selectedApi: ["FormatterCLIAPI", "AnotherAPI"],
141
- slug: ["slack", "gmail"],
142
- });
143
- });
144
- it("should handle keys without versions", () => {
145
- const result = groupAppKeysByType([
146
- "FormatterCLIAPI",
147
- "slack",
148
- "AnotherAPI",
149
- ]);
150
- expect(result).toEqual({
151
- selectedApi: ["FormatterCLIAPI", "AnotherAPI"],
152
- slug: ["slack"],
153
- });
154
- });
155
- it("should reject UUID app keys (delegated to versioned function)", () => {
156
- expect(() => {
157
- groupAppKeysByType(["61e47557-af91-4b0c-a3e0-c28606357664"]);
158
- }).toThrow("UUID app keys are not supported. Use app slug or implementation ID instead of: 61e47557-af91-4b0c-a3e0-c28606357664");
159
- });
160
- it("should handle empty array", () => {
161
- const result = groupAppKeysByType([]);
162
- expect(result).toEqual({
163
- selectedApi: [],
164
- slug: [],
165
- });
166
- });
167
- it("should dedupe multiple versions of same base key", () => {
168
- const result = groupAppKeysByType([
169
- "slack@1.0.0",
170
- "FormatterCLIAPI@2.1.0",
171
- "slack@1.2.3", // different version of slack
172
- "FormatterCLIAPI@1.0.0", // different version of FormatterCLIAPI
173
- "gmail",
174
- ]);
175
- expect(result).toEqual({
176
- selectedApi: ["FormatterCLIAPI"], // only one instance despite multiple versions
177
- slug: ["slack", "gmail"], // only one slack despite multiple versions
178
- });
179
- });
180
- it("should dedupe exact duplicates after version stripping", () => {
181
- const result = groupAppKeysByType([
182
- "slack@1.0.0",
183
- "slack", // no version
184
- "slack@2.0.0", // different version
185
- "FormatterCLIAPI",
186
- "FormatterCLIAPI@1.5.0",
187
- ]);
188
- expect(result).toEqual({
189
- selectedApi: ["FormatterCLIAPI"],
190
- slug: ["slack"],
191
- });
192
- });
193
- });
194
- describe("toAppLocator", () => {
195
- it("should reject UUID app keys", () => {
196
- expect(() => {
197
- toAppLocator("61e47557-af91-4b0c-a3e0-c28606357664");
198
- }).toThrow("UUID app keys are not supported. Use app slug or implementation ID instead of: 61e47557-af91-4b0c-a3e0-c28606357664");
199
- });
200
- it("should reject UUID app keys with versions", () => {
201
- expect(() => {
202
- toAppLocator("61e47557-af91-4b0c-a3e0-c28606357664@1.0.0");
203
- }).toThrow("UUID app keys are not supported. Use app slug or implementation ID instead of: 61e47557-af91-4b0c-a3e0-c28606357664@1.0.0");
204
- });
205
- it("should reject uppercase UUID app keys", () => {
206
- expect(() => {
207
- toAppLocator("61E47557-AF91-4B0C-A3E0-C28606357664");
208
- }).toThrow("UUID app keys are not supported. Use app slug or implementation ID instead of: 61E47557-AF91-4B0C-A3E0-C28606357664");
209
- });
210
- it("should handle simple slug without version", () => {
211
- const result = toAppLocator("slack");
212
- expect(result).toEqual({
213
- lookupAppKey: "slack",
214
- slug: "slack",
215
- implementationName: undefined,
216
- version: undefined,
217
- });
218
- });
219
- it("should handle slug with version", () => {
220
- const result = toAppLocator("slack@1.0.0");
221
- expect(result).toEqual({
222
- lookupAppKey: "slack",
223
- slug: "slack",
224
- implementationName: undefined,
225
- version: "1.0.0",
226
- });
227
- });
228
- it("should handle dashified slug", () => {
229
- const result = toAppLocator("google-sheets");
230
- expect(result).toEqual({
231
- lookupAppKey: "google-sheets",
232
- slug: "google-sheets",
233
- implementationName: undefined,
234
- version: undefined,
235
- });
236
- });
237
- it("should handle dashified slug with version", () => {
238
- const result = toAppLocator("google-sheets@2.1.3");
239
- expect(result).toEqual({
240
- lookupAppKey: "google-sheets",
241
- slug: "google-sheets",
242
- implementationName: undefined,
243
- version: "2.1.3",
244
- });
245
- });
246
- it("should handle snake_cased slug and convert to dash", () => {
247
- const result = toAppLocator("google_sheets");
248
- expect(result).toEqual({
249
- lookupAppKey: "google_sheets",
250
- slug: "google-sheets",
251
- implementationName: undefined,
252
- version: undefined,
253
- });
254
- });
255
- it("should handle snake_cased slug with version and convert to dash", () => {
256
- const result = toAppLocator("google_sheets@2.1.3");
257
- expect(result).toEqual({
258
- lookupAppKey: "google_sheets",
259
- slug: "google-sheets",
260
- implementationName: undefined,
261
- version: "2.1.3",
262
- });
263
- });
264
- it("should handle leading underscore snake_cased slug", () => {
265
- const result = toAppLocator("_100hires_ats");
266
- expect(result).toEqual({
267
- lookupAppKey: "_100hires_ats",
268
- slug: "100hires-ats",
269
- implementationName: undefined,
270
- version: undefined,
271
- });
272
- });
273
- it("should handle leading underscore snake_cased slug with version", () => {
274
- const result = toAppLocator("_100hires_ats@3.0.0");
275
- expect(result).toEqual({
276
- lookupAppKey: "_100hires_ats",
277
- slug: "100hires-ats",
278
- implementationName: undefined,
279
- version: "3.0.0",
280
- });
281
- });
282
- it("should handle implementation name without version", () => {
283
- const result = toAppLocator("SlackCLIAPI");
284
- expect(result).toEqual({
285
- lookupAppKey: "SlackCLIAPI",
286
- slug: undefined,
287
- implementationName: "SlackCLIAPI",
288
- version: undefined,
289
- });
290
- });
291
- it("should handle implementation name with version", () => {
292
- const result = toAppLocator("SlackCLIAPI@1.29.0");
293
- expect(result).toEqual({
294
- lookupAppKey: "SlackCLIAPI",
295
- slug: undefined,
296
- implementationName: "SlackCLIAPI",
297
- version: "1.29.0",
298
- });
299
- });
300
- it("should handle edge cases with complex version numbers", () => {
301
- const result = toAppLocator("slack@1.2.3-beta.4+build.5");
302
- expect(result).toEqual({
303
- lookupAppKey: "slack",
304
- slug: "slack",
305
- implementationName: undefined,
306
- version: "1.2.3-beta.4+build.5",
307
- });
308
- });
309
- it("should handle single character app keys", () => {
310
- const result = toAppLocator("a");
311
- expect(result).toEqual({
312
- lookupAppKey: "a",
313
- slug: "a",
314
- implementationName: undefined,
315
- version: undefined,
316
- });
317
- });
318
- it("should handle app keys with numbers", () => {
319
- const result = toAppLocator("app123");
320
- expect(result).toEqual({
321
- lookupAppKey: "app123",
322
- slug: "app123",
323
- implementationName: undefined,
324
- version: undefined,
325
- });
326
- });
327
- it("should handle mixed case app keys that aren't implementation names", () => {
328
- const result = toAppLocator("SlackBot");
329
- expect(result).toEqual({
330
- lookupAppKey: "SlackBot",
331
- slug: undefined,
332
- implementationName: "SlackBot",
333
- version: undefined,
334
- });
335
- });
336
- it("should handle empty version (app key ending with @)", () => {
337
- const result = toAppLocator("slack@");
338
- expect(result).toEqual({
339
- lookupAppKey: "slack",
340
- slug: "slack",
341
- implementationName: undefined,
342
- version: "",
343
- });
344
- });
345
- });
346
- });
@@ -1,4 +0,0 @@
1
- export declare function resolve(path: string, basePath?: string): Promise<string>;
2
- export declare function writeFile(filePath: string, content: string): Promise<void>;
3
- export declare function readFile(filePath: string): Promise<string>;
4
- //# sourceMappingURL=file-utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"file-utils.d.ts","sourceRoot":"","sources":["../../src/utils/file-utils.ts"],"names":[],"mappings":"AA6BA,wBAAsB,OAAO,CAC3B,IAAI,EAAE,MAAM,EACZ,QAAQ,GAAE,MAAY,GACrB,OAAO,CAAC,MAAM,CAAC,CA8BjB;AAED,wBAAsB,SAAS,CAC7B,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,IAAI,CAAC,CAUf;AAED,wBAAsB,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAchE"}
@@ -1,74 +0,0 @@
1
- // In-memory filesystem fallback for browser environments
2
- const inMemoryFiles = {};
3
- // Lazy-loaded modules
4
- let fsPromises = null;
5
- let pathModule = null;
6
- async function loadFsPromises() {
7
- if (fsPromises)
8
- return fsPromises;
9
- try {
10
- fsPromises = await import("fs/promises");
11
- return fsPromises;
12
- }
13
- catch {
14
- return null;
15
- }
16
- }
17
- async function loadPathModule() {
18
- if (pathModule)
19
- return pathModule;
20
- try {
21
- pathModule = await import("path");
22
- return pathModule;
23
- }
24
- catch {
25
- return null;
26
- }
27
- }
28
- export async function resolve(path, basePath = "/") {
29
- const pathModule = await loadPathModule();
30
- if (pathModule) {
31
- return pathModule.resolve(path);
32
- }
33
- // Simple fallback path resolution assuming root "/" location
34
- if (path.startsWith("/")) {
35
- return path;
36
- }
37
- if (path.startsWith("./")) {
38
- // Remove ./ prefix and join to base
39
- const cleanPath = path.slice(2);
40
- return basePath.endsWith("/")
41
- ? basePath + cleanPath
42
- : basePath + "/" + cleanPath;
43
- }
44
- if (path.startsWith("../")) {
45
- // Remove ../ prefix since we're already at root
46
- const cleanPath = path.replace(/^(\.\.\/)+/, "");
47
- return basePath.endsWith("/")
48
- ? basePath + cleanPath
49
- : basePath + "/" + cleanPath;
50
- }
51
- // No slash prefix, join to base
52
- return basePath.endsWith("/") ? basePath + path : basePath + "/" + path;
53
- }
54
- export async function writeFile(filePath, content) {
55
- const fs = await loadFsPromises();
56
- if (fs) {
57
- await fs.writeFile(filePath, content, "utf8");
58
- return;
59
- }
60
- // Fallback to in-memory filesystem
61
- inMemoryFiles[filePath] = content;
62
- }
63
- export async function readFile(filePath) {
64
- const fs = await loadFsPromises();
65
- if (fs) {
66
- return await fs.readFile(filePath, "utf8");
67
- }
68
- // Fallback to in-memory filesystem
69
- const content = inMemoryFiles[filePath];
70
- if (content !== undefined) {
71
- return content;
72
- }
73
- throw new Error(`File not found: ${filePath}`);
74
- }
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=file-utils.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"file-utils.test.d.ts","sourceRoot":"","sources":["../../src/utils/file-utils.test.ts"],"names":[],"mappings":""}
@@ -1,51 +0,0 @@
1
- import { describe, it, expect, vi } from "vitest";
2
- import { resolve, writeFile, readFile } from "./file-utils";
3
- // Mock the dynamic imports to simulate missing modules
4
- vi.mock("fs/promises", () => {
5
- throw new Error("Module not found");
6
- });
7
- vi.mock("path", () => {
8
- throw new Error("Module not found");
9
- });
10
- describe("file-utils", () => {
11
- describe("resolve", () => {
12
- it("should handle absolute paths", async () => {
13
- expect(await resolve("/absolute/path")).toBe("/absolute/path");
14
- });
15
- it("should handle relative paths with ./", async () => {
16
- expect(await resolve("./relative/path")).toBe("/relative/path");
17
- expect(await resolve("./relative/path", "/base")).toBe("/base/relative/path");
18
- expect(await resolve("./relative/path", "/base/")).toBe("/base/relative/path");
19
- });
20
- it("should handle parent directory paths with ../", async () => {
21
- expect(await resolve("../parent/path")).toBe("/parent/path");
22
- expect(await resolve("../../nested/parent/path")).toBe("/nested/parent/path");
23
- expect(await resolve("../parent/path", "/base")).toBe("/base/parent/path");
24
- });
25
- it("should handle paths without prefix", async () => {
26
- expect(await resolve("simple/path")).toBe("/simple/path");
27
- expect(await resolve("simple/path", "/base")).toBe("/base/simple/path");
28
- expect(await resolve("simple/path", "/base/")).toBe("/base/simple/path");
29
- });
30
- });
31
- describe("writeFile and readFile with in-memory filesystem", () => {
32
- it("should write and read files using in-memory filesystem when fs is not available", async () => {
33
- const filePath = "/test/file.txt";
34
- const content = "Hello, world!";
35
- await writeFile(filePath, content);
36
- const readContent = await readFile(filePath);
37
- expect(readContent).toBe(content);
38
- });
39
- it("should throw error when reading non-existent file", async () => {
40
- await expect(readFile("/non/existent/file.txt")).rejects.toThrow("File not found: /non/existent/file.txt");
41
- });
42
- it("should handle multiple files in in-memory filesystem", async () => {
43
- await writeFile("/file1.txt", "content1");
44
- await writeFile("/file2.txt", "content2");
45
- await writeFile("/dir/file3.txt", "content3");
46
- expect(await readFile("/file1.txt")).toBe("content1");
47
- expect(await readFile("/file2.txt")).toBe("content2");
48
- expect(await readFile("/dir/file3.txt")).toBe("content3");
49
- });
50
- });
51
- });