@fern-api/venus-api-sdk 0.0.20 → 0.0.21

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 (308) hide show
  1. package/Client.d.ts +23 -0
  2. package/Client.js +28 -0
  3. package/api/index.js +17 -0
  4. package/api/resources/commons/index.js +17 -0
  5. package/api/resources/commons/types/OrganizationId.js +10 -0
  6. package/api/resources/commons/types/UserId.js +10 -0
  7. package/api/resources/commons/types/index.js +18 -0
  8. package/api/resources/index.js +40 -0
  9. package/{types/api → api}/resources/organization/client/Client.d.ts +4 -4
  10. package/api/resources/organization/client/Client.js +214 -0
  11. package/api/resources/organization/client/addUser.js +44 -0
  12. package/api/resources/organization/client/create.js +44 -0
  13. package/api/resources/organization/client/get.js +34 -0
  14. package/api/resources/organization/client/getMyOrganizationFromScopedToken.js +34 -0
  15. package/api/resources/organization/client/index.js +36 -0
  16. package/api/resources/organization/client/isMember.js +24 -0
  17. package/api/resources/organization/client/requests/AddUserToOrgRequest.js +5 -0
  18. package/api/resources/organization/client/requests/CreateOrganizationRequest.js +5 -0
  19. package/api/resources/organization/client/requests/UpdateOrganizationRequest.js +5 -0
  20. package/api/resources/organization/client/requests/index.js +2 -0
  21. package/api/resources/organization/client/update.js +34 -0
  22. package/api/resources/organization/index.js +18 -0
  23. package/api/resources/organization/types/LightweightUser.d.ts +8 -0
  24. package/api/resources/organization/types/LightweightUser.js +5 -0
  25. package/{types/api → api}/resources/organization/types/Organization.d.ts +2 -0
  26. package/api/resources/organization/types/Organization.js +5 -0
  27. package/api/resources/organization/types/index.d.ts +2 -0
  28. package/api/resources/organization/types/index.js +18 -0
  29. package/{types/api → api}/resources/registry/client/Client.d.ts +4 -4
  30. package/api/resources/registry/client/Client.js +135 -0
  31. package/api/resources/registry/client/generateRegistryTokens.js +44 -0
  32. package/api/resources/registry/client/hasRegistryPermission.js +44 -0
  33. package/api/resources/registry/client/index.js +33 -0
  34. package/api/resources/registry/client/requests/CheckRegistryPermissionRequest.js +5 -0
  35. package/api/resources/registry/client/requests/GenerateRegistryTokensRequest.js +5 -0
  36. package/api/resources/registry/client/requests/RevokeTokenRequest.js +5 -0
  37. package/api/resources/registry/client/requests/index.js +2 -0
  38. package/api/resources/registry/client/revokeToken.js +44 -0
  39. package/api/resources/registry/index.js +18 -0
  40. package/api/resources/registry/types/MavenRegistryToken.js +5 -0
  41. package/api/resources/registry/types/NpmRegistryToken.js +5 -0
  42. package/api/resources/registry/types/RegistryToken.js +45 -0
  43. package/api/resources/registry/types/RegistryTokens.js +5 -0
  44. package/api/resources/registry/types/index.js +20 -0
  45. package/{types/api → api}/resources/user/client/Client.d.ts +4 -4
  46. package/api/resources/user/client/Client.js +87 -0
  47. package/api/resources/user/client/getMyOrganizations.js +24 -0
  48. package/api/resources/user/client/getMyself.js +24 -0
  49. package/api/resources/user/client/index.js +32 -0
  50. package/api/resources/user/client/requests/GetUserOrganizationsRequest.js +5 -0
  51. package/api/resources/user/client/requests/index.js +2 -0
  52. package/api/resources/user/index.js +18 -0
  53. package/api/resources/user/types/OrganizationsPage.js +5 -0
  54. package/api/resources/user/types/User.js +5 -0
  55. package/api/resources/user/types/index.js +18 -0
  56. package/core/auth/BasicAuth.js +26 -0
  57. package/core/auth/BearerToken.js +15 -0
  58. package/core/auth/index.js +7 -0
  59. package/core/fetcher/APIResponse.js +2 -0
  60. package/{types/core → core}/fetcher/Fetcher.d.ts +0 -3
  61. package/core/fetcher/Fetcher.js +85 -0
  62. package/core/fetcher/Supplier.js +13 -0
  63. package/core/fetcher/index.js +7 -0
  64. package/core/index.js +32 -0
  65. package/core/schemas/Schema.js +19 -0
  66. package/core/schemas/builders/date/date.js +55 -0
  67. package/core/schemas/builders/date/index.js +5 -0
  68. package/core/schemas/builders/enum/enum.js +29 -0
  69. package/core/schemas/builders/enum/index.js +5 -0
  70. package/core/schemas/builders/index.js +28 -0
  71. package/core/schemas/builders/lazy/index.js +7 -0
  72. package/core/schemas/builders/lazy/lazy.js +28 -0
  73. package/core/schemas/builders/lazy/lazyObject.js +21 -0
  74. package/core/schemas/builders/list/index.js +5 -0
  75. package/core/schemas/builders/list/list.js +53 -0
  76. package/core/schemas/builders/literals/index.js +5 -0
  77. package/core/schemas/builders/literals/stringLiteral.js +28 -0
  78. package/core/schemas/builders/object/index.js +9 -0
  79. package/core/schemas/builders/object/object.js +231 -0
  80. package/core/schemas/builders/object/property.js +16 -0
  81. package/core/schemas/builders/object/types.js +2 -0
  82. package/core/schemas/builders/object-like/getObjectLikeUtils.js +62 -0
  83. package/core/schemas/builders/object-like/index.js +6 -0
  84. package/core/schemas/builders/object-like/types.js +2 -0
  85. package/core/schemas/builders/primitives/any.js +6 -0
  86. package/core/schemas/builders/primitives/boolean.js +24 -0
  87. package/core/schemas/builders/primitives/index.js +13 -0
  88. package/core/schemas/builders/primitives/number.js +24 -0
  89. package/core/schemas/builders/primitives/string.js +24 -0
  90. package/core/schemas/builders/primitives/unknown.js +6 -0
  91. package/core/schemas/builders/record/index.js +5 -0
  92. package/core/schemas/builders/record/record.js +91 -0
  93. package/core/schemas/builders/record/types.js +2 -0
  94. package/core/schemas/builders/schema-utils/JsonError.js +13 -0
  95. package/core/schemas/builders/schema-utils/ParseError.js +13 -0
  96. package/core/schemas/builders/schema-utils/getSchemaUtils.js +82 -0
  97. package/core/schemas/builders/schema-utils/index.js +11 -0
  98. package/core/schemas/builders/schema-utils/stringifyValidationErrors.js +10 -0
  99. package/core/schemas/builders/set/index.js +5 -0
  100. package/core/schemas/builders/set/set.js +44 -0
  101. package/core/schemas/builders/union/discriminant.js +10 -0
  102. package/core/schemas/builders/union/index.js +7 -0
  103. package/core/schemas/builders/union/types.js +2 -0
  104. package/core/schemas/builders/union/union.js +100 -0
  105. package/core/schemas/index.js +17 -0
  106. package/core/schemas/utils/MaybePromise.js +2 -0
  107. package/core/schemas/utils/OptionalRecord.js +2 -0
  108. package/core/schemas/utils/addQuestionMarksToNullableProperties.d.ts +7 -0
  109. package/core/schemas/utils/addQuestionMarksToNullableProperties.js +2 -0
  110. package/core/schemas/utils/createIdentitySchemaCreator.js +18 -0
  111. package/core/schemas/utils/entries.js +7 -0
  112. package/core/schemas/utils/filterObject.js +14 -0
  113. package/core/schemas/utils/isPlainObject.js +19 -0
  114. package/core/schemas/utils/keys.js +7 -0
  115. package/core/schemas/utils/partition.js +16 -0
  116. package/index.js +29 -0
  117. package/package.json +19 -43
  118. package/serialization/index.js +17 -0
  119. package/serialization/resources/commons/index.js +17 -0
  120. package/serialization/resources/commons/types/OrganizationId.js +35 -0
  121. package/serialization/resources/commons/types/UserId.js +37 -0
  122. package/serialization/resources/commons/types/index.js +18 -0
  123. package/serialization/resources/index.js +39 -0
  124. package/serialization/resources/organization/client/addUser.js +47 -0
  125. package/serialization/resources/organization/client/create.js +47 -0
  126. package/serialization/resources/organization/client/get.js +44 -0
  127. package/serialization/resources/organization/client/getMyOrganizationFromScopedToken.js +44 -0
  128. package/serialization/resources/organization/client/index.js +36 -0
  129. package/serialization/resources/organization/client/isMember.js +31 -0
  130. package/serialization/resources/organization/client/requests/AddUserToOrgRequest.js +34 -0
  131. package/serialization/resources/organization/client/requests/CreateOrganizationRequest.js +34 -0
  132. package/serialization/resources/organization/client/requests/UpdateOrganizationRequest.js +33 -0
  133. package/serialization/resources/organization/client/requests/index.js +9 -0
  134. package/serialization/resources/organization/client/update.js +44 -0
  135. package/serialization/resources/organization/index.js +18 -0
  136. package/serialization/resources/organization/types/LightweightUser.d.ts +14 -0
  137. package/serialization/resources/organization/types/LightweightUser.js +35 -0
  138. package/{types/serialization → serialization}/resources/organization/types/Organization.d.ts +2 -0
  139. package/serialization/resources/organization/types/Organization.js +36 -0
  140. package/serialization/resources/organization/types/index.d.ts +2 -0
  141. package/serialization/resources/organization/types/index.js +18 -0
  142. package/serialization/resources/registry/client/generateRegistryTokens.js +47 -0
  143. package/serialization/resources/registry/client/hasRegistryPermission.js +48 -0
  144. package/serialization/resources/registry/client/index.js +33 -0
  145. package/serialization/resources/registry/client/requests/CheckRegistryPermissionRequest.js +34 -0
  146. package/serialization/resources/registry/client/requests/GenerateRegistryTokensRequest.js +33 -0
  147. package/serialization/resources/registry/client/requests/RevokeTokenRequest.js +34 -0
  148. package/serialization/resources/registry/client/requests/index.js +9 -0
  149. package/serialization/resources/registry/client/revokeToken.js +47 -0
  150. package/serialization/resources/registry/index.js +18 -0
  151. package/serialization/resources/registry/types/MavenRegistryToken.js +34 -0
  152. package/serialization/resources/registry/types/NpmRegistryToken.js +33 -0
  153. package/serialization/resources/registry/types/RegistryToken.js +49 -0
  154. package/serialization/resources/registry/types/RegistryTokens.js +34 -0
  155. package/serialization/resources/registry/types/index.js +20 -0
  156. package/serialization/resources/user/index.js +17 -0
  157. package/serialization/resources/user/types/OrganizationsPage.js +34 -0
  158. package/serialization/resources/user/types/User.js +36 -0
  159. package/serialization/resources/user/types/index.js +18 -0
  160. package/core.d.ts +0 -4
  161. package/dist/browser/cjs/core.js +0 -4821
  162. package/dist/browser/cjs/index.js +0 -6937
  163. package/dist/browser/cjs/serialization.js +0 -6453
  164. package/dist/browser/esm/core.js +0 -4815
  165. package/dist/browser/esm/index.js +0 -6933
  166. package/dist/browser/esm/serialization.js +0 -6471
  167. package/dist/node/core.js +0 -13178
  168. package/dist/node/index.js +0 -15320
  169. package/dist/node/serialization.js +0 -15332
  170. package/serialization.d.ts +0 -4
  171. package/types/Client.d.ts +0 -21
  172. package/types/api/resources/organization/types/index.d.ts +0 -1
  173. package/types/core/schemas/utils/addQuestionMarksToNullableProperties.d.ts +0 -9
  174. package/types/serialization/resources/organization/types/index.d.ts +0 -1
  175. /package/{types/api → api}/index.d.ts +0 -0
  176. /package/{types/api → api}/resources/commons/index.d.ts +0 -0
  177. /package/{types/api → api}/resources/commons/types/OrganizationId.d.ts +0 -0
  178. /package/{types/api → api}/resources/commons/types/UserId.d.ts +0 -0
  179. /package/{types/api → api}/resources/commons/types/index.d.ts +0 -0
  180. /package/{types/api → api}/resources/index.d.ts +0 -0
  181. /package/{types/api → api}/resources/organization/client/addUser.d.ts +0 -0
  182. /package/{types/api → api}/resources/organization/client/create.d.ts +0 -0
  183. /package/{types/api → api}/resources/organization/client/get.d.ts +0 -0
  184. /package/{types/api → api}/resources/organization/client/getMyOrganizationFromScopedToken.d.ts +0 -0
  185. /package/{types/api → api}/resources/organization/client/index.d.ts +0 -0
  186. /package/{types/api → api}/resources/organization/client/isMember.d.ts +0 -0
  187. /package/{types/api → api}/resources/organization/client/requests/AddUserToOrgRequest.d.ts +0 -0
  188. /package/{types/api → api}/resources/organization/client/requests/CreateOrganizationRequest.d.ts +0 -0
  189. /package/{types/api → api}/resources/organization/client/requests/UpdateOrganizationRequest.d.ts +0 -0
  190. /package/{types/api → api}/resources/organization/client/requests/index.d.ts +0 -0
  191. /package/{types/api → api}/resources/organization/client/update.d.ts +0 -0
  192. /package/{types/api → api}/resources/organization/index.d.ts +0 -0
  193. /package/{types/api → api}/resources/registry/client/generateRegistryTokens.d.ts +0 -0
  194. /package/{types/api → api}/resources/registry/client/hasRegistryPermission.d.ts +0 -0
  195. /package/{types/api → api}/resources/registry/client/index.d.ts +0 -0
  196. /package/{types/api → api}/resources/registry/client/requests/CheckRegistryPermissionRequest.d.ts +0 -0
  197. /package/{types/api → api}/resources/registry/client/requests/GenerateRegistryTokensRequest.d.ts +0 -0
  198. /package/{types/api → api}/resources/registry/client/requests/RevokeTokenRequest.d.ts +0 -0
  199. /package/{types/api → api}/resources/registry/client/requests/index.d.ts +0 -0
  200. /package/{types/api → api}/resources/registry/client/revokeToken.d.ts +0 -0
  201. /package/{types/api → api}/resources/registry/index.d.ts +0 -0
  202. /package/{types/api → api}/resources/registry/types/MavenRegistryToken.d.ts +0 -0
  203. /package/{types/api → api}/resources/registry/types/NpmRegistryToken.d.ts +0 -0
  204. /package/{types/api → api}/resources/registry/types/RegistryToken.d.ts +0 -0
  205. /package/{types/api → api}/resources/registry/types/RegistryTokens.d.ts +0 -0
  206. /package/{types/api → api}/resources/registry/types/index.d.ts +0 -0
  207. /package/{types/api → api}/resources/user/client/getMyOrganizations.d.ts +0 -0
  208. /package/{types/api → api}/resources/user/client/getMyself.d.ts +0 -0
  209. /package/{types/api → api}/resources/user/client/index.d.ts +0 -0
  210. /package/{types/api → api}/resources/user/client/requests/GetUserOrganizationsRequest.d.ts +0 -0
  211. /package/{types/api → api}/resources/user/client/requests/index.d.ts +0 -0
  212. /package/{types/api → api}/resources/user/index.d.ts +0 -0
  213. /package/{types/api → api}/resources/user/types/OrganizationsPage.d.ts +0 -0
  214. /package/{types/api → api}/resources/user/types/User.d.ts +0 -0
  215. /package/{types/api → api}/resources/user/types/index.d.ts +0 -0
  216. /package/{types/core → core}/auth/BasicAuth.d.ts +0 -0
  217. /package/{types/core → core}/auth/BearerToken.d.ts +0 -0
  218. /package/{types/core → core}/auth/index.d.ts +0 -0
  219. /package/{types/core → core}/fetcher/APIResponse.d.ts +0 -0
  220. /package/{types/core → core}/fetcher/Supplier.d.ts +0 -0
  221. /package/{types/core → core}/fetcher/index.d.ts +0 -0
  222. /package/{types/core → core}/index.d.ts +0 -0
  223. /package/{types/core → core}/schemas/Schema.d.ts +0 -0
  224. /package/{types/core → core}/schemas/builders/date/date.d.ts +0 -0
  225. /package/{types/core → core}/schemas/builders/date/index.d.ts +0 -0
  226. /package/{types/core → core}/schemas/builders/enum/enum.d.ts +0 -0
  227. /package/{types/core → core}/schemas/builders/enum/index.d.ts +0 -0
  228. /package/{types/core → core}/schemas/builders/index.d.ts +0 -0
  229. /package/{types/core → core}/schemas/builders/lazy/index.d.ts +0 -0
  230. /package/{types/core → core}/schemas/builders/lazy/lazy.d.ts +0 -0
  231. /package/{types/core → core}/schemas/builders/lazy/lazyObject.d.ts +0 -0
  232. /package/{types/core → core}/schemas/builders/list/index.d.ts +0 -0
  233. /package/{types/core → core}/schemas/builders/list/list.d.ts +0 -0
  234. /package/{types/core → core}/schemas/builders/literals/index.d.ts +0 -0
  235. /package/{types/core → core}/schemas/builders/literals/stringLiteral.d.ts +0 -0
  236. /package/{types/core → core}/schemas/builders/object/index.d.ts +0 -0
  237. /package/{types/core → core}/schemas/builders/object/object.d.ts +0 -0
  238. /package/{types/core → core}/schemas/builders/object/property.d.ts +0 -0
  239. /package/{types/core → core}/schemas/builders/object/types.d.ts +0 -0
  240. /package/{types/core → core}/schemas/builders/object-like/getObjectLikeUtils.d.ts +0 -0
  241. /package/{types/core → core}/schemas/builders/object-like/index.d.ts +0 -0
  242. /package/{types/core → core}/schemas/builders/object-like/types.d.ts +0 -0
  243. /package/{types/core → core}/schemas/builders/primitives/any.d.ts +0 -0
  244. /package/{types/core → core}/schemas/builders/primitives/boolean.d.ts +0 -0
  245. /package/{types/core → core}/schemas/builders/primitives/index.d.ts +0 -0
  246. /package/{types/core → core}/schemas/builders/primitives/number.d.ts +0 -0
  247. /package/{types/core → core}/schemas/builders/primitives/string.d.ts +0 -0
  248. /package/{types/core → core}/schemas/builders/primitives/unknown.d.ts +0 -0
  249. /package/{types/core → core}/schemas/builders/record/index.d.ts +0 -0
  250. /package/{types/core → core}/schemas/builders/record/record.d.ts +0 -0
  251. /package/{types/core → core}/schemas/builders/record/types.d.ts +0 -0
  252. /package/{types/core → core}/schemas/builders/schema-utils/JsonError.d.ts +0 -0
  253. /package/{types/core → core}/schemas/builders/schema-utils/ParseError.d.ts +0 -0
  254. /package/{types/core → core}/schemas/builders/schema-utils/getSchemaUtils.d.ts +0 -0
  255. /package/{types/core → core}/schemas/builders/schema-utils/index.d.ts +0 -0
  256. /package/{types/core → core}/schemas/builders/schema-utils/stringifyValidationErrors.d.ts +0 -0
  257. /package/{types/core → core}/schemas/builders/set/index.d.ts +0 -0
  258. /package/{types/core → core}/schemas/builders/set/set.d.ts +0 -0
  259. /package/{types/core → core}/schemas/builders/union/discriminant.d.ts +0 -0
  260. /package/{types/core → core}/schemas/builders/union/index.d.ts +0 -0
  261. /package/{types/core → core}/schemas/builders/union/types.d.ts +0 -0
  262. /package/{types/core → core}/schemas/builders/union/union.d.ts +0 -0
  263. /package/{types/core → core}/schemas/index.d.ts +0 -0
  264. /package/{types/core → core}/schemas/utils/MaybePromise.d.ts +0 -0
  265. /package/{types/core → core}/schemas/utils/OptionalRecord.d.ts +0 -0
  266. /package/{types/core → core}/schemas/utils/createIdentitySchemaCreator.d.ts +0 -0
  267. /package/{types/core → core}/schemas/utils/entries.d.ts +0 -0
  268. /package/{types/core → core}/schemas/utils/filterObject.d.ts +0 -0
  269. /package/{types/core → core}/schemas/utils/isPlainObject.d.ts +0 -0
  270. /package/{types/core → core}/schemas/utils/keys.d.ts +0 -0
  271. /package/{types/core → core}/schemas/utils/partition.d.ts +0 -0
  272. /package/{types/index.d.ts → index.d.ts} +0 -0
  273. /package/{types/serialization → serialization}/index.d.ts +0 -0
  274. /package/{types/serialization → serialization}/resources/commons/index.d.ts +0 -0
  275. /package/{types/serialization → serialization}/resources/commons/types/OrganizationId.d.ts +0 -0
  276. /package/{types/serialization → serialization}/resources/commons/types/UserId.d.ts +0 -0
  277. /package/{types/serialization → serialization}/resources/commons/types/index.d.ts +0 -0
  278. /package/{types/serialization → serialization}/resources/index.d.ts +0 -0
  279. /package/{types/serialization → serialization}/resources/organization/client/addUser.d.ts +0 -0
  280. /package/{types/serialization → serialization}/resources/organization/client/create.d.ts +0 -0
  281. /package/{types/serialization → serialization}/resources/organization/client/get.d.ts +0 -0
  282. /package/{types/serialization → serialization}/resources/organization/client/getMyOrganizationFromScopedToken.d.ts +0 -0
  283. /package/{types/serialization → serialization}/resources/organization/client/index.d.ts +0 -0
  284. /package/{types/serialization → serialization}/resources/organization/client/isMember.d.ts +0 -0
  285. /package/{types/serialization → serialization}/resources/organization/client/requests/AddUserToOrgRequest.d.ts +0 -0
  286. /package/{types/serialization → serialization}/resources/organization/client/requests/CreateOrganizationRequest.d.ts +0 -0
  287. /package/{types/serialization → serialization}/resources/organization/client/requests/UpdateOrganizationRequest.d.ts +0 -0
  288. /package/{types/serialization → serialization}/resources/organization/client/requests/index.d.ts +0 -0
  289. /package/{types/serialization → serialization}/resources/organization/client/update.d.ts +0 -0
  290. /package/{types/serialization → serialization}/resources/organization/index.d.ts +0 -0
  291. /package/{types/serialization → serialization}/resources/registry/client/generateRegistryTokens.d.ts +0 -0
  292. /package/{types/serialization → serialization}/resources/registry/client/hasRegistryPermission.d.ts +0 -0
  293. /package/{types/serialization → serialization}/resources/registry/client/index.d.ts +0 -0
  294. /package/{types/serialization → serialization}/resources/registry/client/requests/CheckRegistryPermissionRequest.d.ts +0 -0
  295. /package/{types/serialization → serialization}/resources/registry/client/requests/GenerateRegistryTokensRequest.d.ts +0 -0
  296. /package/{types/serialization → serialization}/resources/registry/client/requests/RevokeTokenRequest.d.ts +0 -0
  297. /package/{types/serialization → serialization}/resources/registry/client/requests/index.d.ts +0 -0
  298. /package/{types/serialization → serialization}/resources/registry/client/revokeToken.d.ts +0 -0
  299. /package/{types/serialization → serialization}/resources/registry/index.d.ts +0 -0
  300. /package/{types/serialization → serialization}/resources/registry/types/MavenRegistryToken.d.ts +0 -0
  301. /package/{types/serialization → serialization}/resources/registry/types/NpmRegistryToken.d.ts +0 -0
  302. /package/{types/serialization → serialization}/resources/registry/types/RegistryToken.d.ts +0 -0
  303. /package/{types/serialization → serialization}/resources/registry/types/RegistryTokens.d.ts +0 -0
  304. /package/{types/serialization → serialization}/resources/registry/types/index.d.ts +0 -0
  305. /package/{types/serialization → serialization}/resources/user/index.d.ts +0 -0
  306. /package/{types/serialization → serialization}/resources/user/types/OrganizationsPage.d.ts +0 -0
  307. /package/{types/serialization → serialization}/resources/user/types/User.d.ts +0 -0
  308. /package/{types/serialization → serialization}/resources/user/types/index.d.ts +0 -0
@@ -0,0 +1,87 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ var desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = { enumerable: true, get: function() { return m[k]; } };
10
+ }
11
+ Object.defineProperty(o, k2, desc);
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
18
+ }) : function(o, v) {
19
+ o["default"] = v;
20
+ });
21
+ var __importStar = (this && this.__importStar) || function (mod) {
22
+ if (mod && mod.__esModule) return mod;
23
+ var result = {};
24
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25
+ __setModuleDefault(result, mod);
26
+ return result;
27
+ };
28
+ var __importDefault = (this && this.__importDefault) || function (mod) {
29
+ return (mod && mod.__esModule) ? mod : { "default": mod };
30
+ };
31
+ Object.defineProperty(exports, "__esModule", { value: true });
32
+ exports.User = void 0;
33
+ const core = __importStar(require("../../../../core"));
34
+ const venus_api_sdk_1 = require("../../../..");
35
+ const url_join_1 = __importDefault(require("url-join"));
36
+ const serializers = __importStar(require("../../../../serialization"));
37
+ class User {
38
+ options;
39
+ constructor(options) {
40
+ this.options = options;
41
+ }
42
+ async getMyself() {
43
+ const _response = await core.fetcher({
44
+ url: (0, url_join_1.default)(this.options.environment, "/users"),
45
+ method: "GET",
46
+ headers: {
47
+ Authorization: core.BearerToken.toAuthorizationHeader(await core.Supplier.get(this.options.token)),
48
+ },
49
+ });
50
+ if (_response.ok) {
51
+ return {
52
+ ok: true,
53
+ body: await serializers.User.parseOrThrow(_response.body, {
54
+ allowUnknownKeys: true,
55
+ }),
56
+ };
57
+ }
58
+ return {
59
+ ok: false,
60
+ error: venus_api_sdk_1.FernVenusApi.user.getMyself.Error._unknown(_response.error),
61
+ };
62
+ }
63
+ async getMyOrganizations(request) {
64
+ const { pageId } = request;
65
+ const _queryParams = new URLSearchParams();
66
+ _queryParams.append("pageId", pageId.toString());
67
+ const _response = await core.fetcher({
68
+ url: (0, url_join_1.default)(this.options.environment, "/users/organizations"),
69
+ method: "GET",
70
+ headers: {
71
+ Authorization: core.BearerToken.toAuthorizationHeader(await core.Supplier.get(this.options.token)),
72
+ },
73
+ queryParameters: _queryParams,
74
+ });
75
+ if (_response.ok) {
76
+ return {
77
+ ok: true,
78
+ body: await serializers.OrganizationsPage.parseOrThrow(_response.body, { allowUnknownKeys: true }),
79
+ };
80
+ }
81
+ return {
82
+ ok: false,
83
+ error: venus_api_sdk_1.FernVenusApi.user.getMyOrganizations.Error._unknown(_response.error),
84
+ };
85
+ }
86
+ }
87
+ exports.User = User;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.Error = void 0;
7
+ const venus_api_sdk_1 = require("../../../..");
8
+ exports.Error = {
9
+ _unknown: (fetcherError) => {
10
+ return {
11
+ error: undefined,
12
+ content: fetcherError,
13
+ _visit: function (visitor) {
14
+ return venus_api_sdk_1.FernVenusApi.user.getMyOrganizations.Error._visit(this, visitor);
15
+ },
16
+ };
17
+ },
18
+ _visit: (value, visitor) => {
19
+ switch (value.error) {
20
+ default:
21
+ return visitor._other(value);
22
+ }
23
+ },
24
+ };
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.Error = void 0;
7
+ const venus_api_sdk_1 = require("../../../..");
8
+ exports.Error = {
9
+ _unknown: (fetcherError) => {
10
+ return {
11
+ error: undefined,
12
+ content: fetcherError,
13
+ _visit: function (visitor) {
14
+ return venus_api_sdk_1.FernVenusApi.user.getMyself.Error._visit(this, visitor);
15
+ },
16
+ };
17
+ },
18
+ _visit: (value, visitor) => {
19
+ switch (value.error) {
20
+ default:
21
+ return visitor._other(value);
22
+ }
23
+ },
24
+ };
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
19
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
20
+ };
21
+ var __importStar = (this && this.__importStar) || function (mod) {
22
+ if (mod && mod.__esModule) return mod;
23
+ var result = {};
24
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25
+ __setModuleDefault(result, mod);
26
+ return result;
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.getMyOrganizations = exports.getMyself = void 0;
30
+ __exportStar(require("./requests"), exports);
31
+ exports.getMyself = __importStar(require("./getMyself"));
32
+ exports.getMyOrganizations = __importStar(require("./getMyOrganizations"));
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./types"), exports);
18
+ __exportStar(require("./client"), exports);
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./User"), exports);
18
+ __exportStar(require("./OrganizationsPage"), exports);
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BasicAuth = void 0;
4
+ const js_base64_1 = require("js-base64");
5
+ const BASIC_AUTH_HEADER_PREFIX = /^Basic /i;
6
+ exports.BasicAuth = {
7
+ toAuthorizationHeader: (basicAuth) => {
8
+ if (basicAuth == null) {
9
+ return undefined;
10
+ }
11
+ const token = js_base64_1.Base64.encode(`${basicAuth.username}:${basicAuth.password}`);
12
+ return `Basic ${token}`;
13
+ },
14
+ fromAuthorizationHeader: (header) => {
15
+ const credentials = header.replace(BASIC_AUTH_HEADER_PREFIX, "");
16
+ const decoded = js_base64_1.Base64.decode(credentials);
17
+ const [username, password] = decoded.split(":", 2);
18
+ if (username == null || password == null) {
19
+ throw new Error("Invalid basic auth");
20
+ }
21
+ return {
22
+ username,
23
+ password,
24
+ };
25
+ },
26
+ };
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BearerToken = void 0;
4
+ const BEARER_AUTH_HEADER_PREFIX = /^Bearer /i;
5
+ exports.BearerToken = {
6
+ toAuthorizationHeader: (token) => {
7
+ if (token == null) {
8
+ return undefined;
9
+ }
10
+ return `Bearer ${token}`;
11
+ },
12
+ fromAuthorizationHeader: (header) => {
13
+ return header.replace(BEARER_AUTH_HEADER_PREFIX, "").trim();
14
+ },
15
+ };
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BearerToken = exports.BasicAuth = void 0;
4
+ var BasicAuth_1 = require("./BasicAuth");
5
+ Object.defineProperty(exports, "BasicAuth", { enumerable: true, get: function () { return BasicAuth_1.BasicAuth; } });
6
+ var BearerToken_1 = require("./BearerToken");
7
+ Object.defineProperty(exports, "BearerToken", { enumerable: true, get: function () { return BearerToken_1.BearerToken; } });
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,7 +1,4 @@
1
1
  import { APIResponse } from "./APIResponse";
2
- export interface Fetcher {
3
- fetch: FetchFunction;
4
- }
5
2
  export declare type FetchFunction = (args: Fetcher.Args) => Promise<APIResponse<unknown, Fetcher.Error>>;
6
3
  export declare namespace Fetcher {
7
4
  interface Args {
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.fetcher = void 0;
7
+ const axios_1 = __importDefault(require("axios"));
8
+ const fetcher = async (args) => {
9
+ const headers = {
10
+ "Content-Type": "application/json",
11
+ };
12
+ if (args.headers != null) {
13
+ for (const [key, value] of Object.entries(args.headers)) {
14
+ if (value != null) {
15
+ headers[key] = value;
16
+ }
17
+ }
18
+ }
19
+ try {
20
+ const response = await (0, axios_1.default)({
21
+ url: args.url,
22
+ params: args.queryParameters,
23
+ method: args.method,
24
+ headers,
25
+ data: args.body,
26
+ validateStatus: () => true,
27
+ transformResponse: (response) => response,
28
+ timeout: args.timeoutMs ?? 60_000,
29
+ transitional: {
30
+ clarifyTimeoutError: true,
31
+ },
32
+ withCredentials: args.withCredentials,
33
+ });
34
+ let body;
35
+ if (response.data != null && response.data.length > 0) {
36
+ try {
37
+ body = JSON.parse(response.data) ?? undefined;
38
+ }
39
+ catch {
40
+ return {
41
+ ok: false,
42
+ error: {
43
+ reason: "non-json",
44
+ statusCode: response.status,
45
+ rawBody: response.data,
46
+ },
47
+ };
48
+ }
49
+ }
50
+ if (response.status >= 200 && response.status < 300) {
51
+ return {
52
+ ok: true,
53
+ body,
54
+ };
55
+ }
56
+ else {
57
+ return {
58
+ ok: false,
59
+ error: {
60
+ reason: "status-code",
61
+ statusCode: response.status,
62
+ body,
63
+ },
64
+ };
65
+ }
66
+ }
67
+ catch (error) {
68
+ if (error.code === "ETIMEDOUT") {
69
+ return {
70
+ ok: false,
71
+ error: {
72
+ reason: "timeout",
73
+ },
74
+ };
75
+ }
76
+ return {
77
+ ok: false,
78
+ error: {
79
+ reason: "unknown",
80
+ errorMessage: error.message,
81
+ },
82
+ };
83
+ }
84
+ };
85
+ exports.fetcher = fetcher;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Supplier = void 0;
4
+ exports.Supplier = {
5
+ get: async (supplier) => {
6
+ if (typeof supplier === "function") {
7
+ return supplier();
8
+ }
9
+ else {
10
+ return supplier;
11
+ }
12
+ },
13
+ };
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Supplier = exports.fetcher = void 0;
4
+ var Fetcher_1 = require("./Fetcher");
5
+ Object.defineProperty(exports, "fetcher", { enumerable: true, get: function () { return Fetcher_1.fetcher; } });
6
+ var Supplier_1 = require("./Supplier");
7
+ Object.defineProperty(exports, "Supplier", { enumerable: true, get: function () { return Supplier_1.Supplier; } });
package/core/index.js ADDED
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
26
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.serialization = void 0;
30
+ exports.serialization = __importStar(require("./schemas"));
31
+ __exportStar(require("./auth"), exports);
32
+ __exportStar(require("./fetcher"), exports);
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SchemaType = void 0;
4
+ exports.SchemaType = {
5
+ DATE: "date",
6
+ ENUM: "enum",
7
+ LIST: "list",
8
+ STRING_LITERAL: "stringLiteral",
9
+ OBJECT: "object",
10
+ ANY: "any",
11
+ BOOLEAN: "boolean",
12
+ NUMBER: "number",
13
+ STRING: "string",
14
+ UNKNOWN: "unknown",
15
+ RECORD: "record",
16
+ SET: "set",
17
+ UNION: "union",
18
+ OPTIONAL: "optional",
19
+ };
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.date = void 0;
4
+ const Schema_1 = require("../../Schema");
5
+ const schema_utils_1 = require("../schema-utils");
6
+ // https://stackoverflow.com/questions/12756159/regex-and-iso8601-formatted-datetime
7
+ const ISO_8601_REGEX = /^([+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([.,]\d+(?!:))?)?(\17[0-5]\d([.,]\d+)?)?([zZ]|([+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/;
8
+ function date() {
9
+ const baseSchema = {
10
+ parse: (raw) => {
11
+ if (typeof raw === "string" && ISO_8601_REGEX.test(raw)) {
12
+ return {
13
+ ok: true,
14
+ value: new Date(raw),
15
+ };
16
+ }
17
+ else {
18
+ return {
19
+ ok: false,
20
+ errors: [
21
+ {
22
+ path: [],
23
+ message: "Not an ISO 8601 date string",
24
+ },
25
+ ],
26
+ };
27
+ }
28
+ },
29
+ json: (date) => {
30
+ if (date instanceof Date) {
31
+ return {
32
+ ok: true,
33
+ value: date.toISOString(),
34
+ };
35
+ }
36
+ else {
37
+ return {
38
+ ok: false,
39
+ errors: [
40
+ {
41
+ path: [],
42
+ message: "Not a Date object",
43
+ },
44
+ ],
45
+ };
46
+ }
47
+ },
48
+ getType: () => Schema_1.SchemaType.DATE,
49
+ };
50
+ return {
51
+ ...baseSchema,
52
+ ...(0, schema_utils_1.getSchemaUtils)(baseSchema),
53
+ };
54
+ }
55
+ exports.date = date;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.date = void 0;
4
+ var date_1 = require("./date");
5
+ Object.defineProperty(exports, "date", { enumerable: true, get: function () { return date_1.date; } });
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.enum_ = void 0;
4
+ const Schema_1 = require("../../Schema");
5
+ const createIdentitySchemaCreator_1 = require("../../utils/createIdentitySchemaCreator");
6
+ function enum_(values) {
7
+ const validValues = new Set(values);
8
+ const schemaCreator = (0, createIdentitySchemaCreator_1.createIdentitySchemaCreator)(Schema_1.SchemaType.ENUM, (value, { allowUnknownKeys = false } = {}) => {
9
+ if (typeof value === "string" && (validValues.has(value) || allowUnknownKeys)) {
10
+ return {
11
+ ok: true,
12
+ value: value,
13
+ };
14
+ }
15
+ else {
16
+ return {
17
+ ok: false,
18
+ errors: [
19
+ {
20
+ path: [],
21
+ message: "Not one of the allowed values",
22
+ },
23
+ ],
24
+ };
25
+ }
26
+ });
27
+ return schemaCreator();
28
+ }
29
+ exports.enum_ = enum_;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.enum_ = void 0;
4
+ var enum_1 = require("./enum");
5
+ Object.defineProperty(exports, "enum_", { enumerable: true, get: function () { return enum_1.enum_; } });
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./date"), exports);
18
+ __exportStar(require("./enum"), exports);
19
+ __exportStar(require("./lazy"), exports);
20
+ __exportStar(require("./list"), exports);
21
+ __exportStar(require("./literals"), exports);
22
+ __exportStar(require("./object"), exports);
23
+ __exportStar(require("./object-like"), exports);
24
+ __exportStar(require("./primitives"), exports);
25
+ __exportStar(require("./record"), exports);
26
+ __exportStar(require("./schema-utils"), exports);
27
+ __exportStar(require("./set"), exports);
28
+ __exportStar(require("./union"), exports);
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.lazyObject = exports.lazy = void 0;
4
+ var lazy_1 = require("./lazy");
5
+ Object.defineProperty(exports, "lazy", { enumerable: true, get: function () { return lazy_1.lazy; } });
6
+ var lazyObject_1 = require("./lazyObject");
7
+ Object.defineProperty(exports, "lazyObject", { enumerable: true, get: function () { return lazyObject_1.lazyObject; } });
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getMemoizedSchema = exports.constructLazyBaseSchema = exports.lazy = void 0;
4
+ const schema_utils_1 = require("../schema-utils");
5
+ function lazy(getter) {
6
+ const baseSchema = constructLazyBaseSchema(getter);
7
+ return {
8
+ ...baseSchema,
9
+ ...(0, schema_utils_1.getSchemaUtils)(baseSchema),
10
+ };
11
+ }
12
+ exports.lazy = lazy;
13
+ function constructLazyBaseSchema(getter) {
14
+ return {
15
+ parse: async (raw, opts) => (await getMemoizedSchema(getter)).parse(raw, opts),
16
+ json: async (parsed, opts) => (await getMemoizedSchema(getter)).json(parsed, opts),
17
+ getType: async () => (await getMemoizedSchema(getter)).getType(),
18
+ };
19
+ }
20
+ exports.constructLazyBaseSchema = constructLazyBaseSchema;
21
+ async function getMemoizedSchema(getter) {
22
+ const castedGetter = getter;
23
+ if (castedGetter.__zurg_memoized == null) {
24
+ castedGetter.__zurg_memoized = await getter();
25
+ }
26
+ return castedGetter.__zurg_memoized;
27
+ }
28
+ exports.getMemoizedSchema = getMemoizedSchema;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.lazyObject = void 0;
4
+ const object_1 = require("../object");
5
+ const object_like_1 = require("../object-like");
6
+ const schema_utils_1 = require("../schema-utils");
7
+ const lazy_1 = require("./lazy");
8
+ function lazyObject(getter) {
9
+ const baseSchema = {
10
+ ...(0, lazy_1.constructLazyBaseSchema)(getter),
11
+ _getRawProperties: async () => (await (0, lazy_1.getMemoizedSchema)(getter))._getRawProperties(),
12
+ _getParsedProperties: async () => (await (0, lazy_1.getMemoizedSchema)(getter))._getParsedProperties(),
13
+ };
14
+ return {
15
+ ...baseSchema,
16
+ ...(0, schema_utils_1.getSchemaUtils)(baseSchema),
17
+ ...(0, object_like_1.getObjectLikeUtils)(baseSchema),
18
+ ...(0, object_1.getObjectUtils)(baseSchema),
19
+ };
20
+ }
21
+ exports.lazyObject = lazyObject;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.list = void 0;
4
+ var list_1 = require("./list");
5
+ Object.defineProperty(exports, "list", { enumerable: true, get: function () { return list_1.list; } });