dub 0.46.13 → 0.46.15

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 (288) hide show
  1. package/dist/commonjs/funcs/analyticsRetrieve.d.ts.map +1 -1
  2. package/dist/commonjs/funcs/analyticsRetrieve.js +4 -3
  3. package/dist/commonjs/funcs/analyticsRetrieve.js.map +1 -1
  4. package/dist/commonjs/funcs/customersCreate.d.ts.map +1 -1
  5. package/dist/commonjs/funcs/customersCreate.js +4 -3
  6. package/dist/commonjs/funcs/customersCreate.js.map +1 -1
  7. package/dist/commonjs/funcs/customersDelete.d.ts.map +1 -1
  8. package/dist/commonjs/funcs/customersDelete.js +4 -3
  9. package/dist/commonjs/funcs/customersDelete.js.map +1 -1
  10. package/dist/commonjs/funcs/customersGet.d.ts.map +1 -1
  11. package/dist/commonjs/funcs/customersGet.js +4 -3
  12. package/dist/commonjs/funcs/customersGet.js.map +1 -1
  13. package/dist/commonjs/funcs/customersList.d.ts.map +1 -1
  14. package/dist/commonjs/funcs/customersList.js +4 -3
  15. package/dist/commonjs/funcs/customersList.js.map +1 -1
  16. package/dist/commonjs/funcs/customersUpdate.d.ts.map +1 -1
  17. package/dist/commonjs/funcs/customersUpdate.js +4 -3
  18. package/dist/commonjs/funcs/customersUpdate.js.map +1 -1
  19. package/dist/commonjs/funcs/domainsCreate.d.ts.map +1 -1
  20. package/dist/commonjs/funcs/domainsCreate.js +4 -3
  21. package/dist/commonjs/funcs/domainsCreate.js.map +1 -1
  22. package/dist/commonjs/funcs/domainsDelete.d.ts.map +1 -1
  23. package/dist/commonjs/funcs/domainsDelete.js +4 -3
  24. package/dist/commonjs/funcs/domainsDelete.js.map +1 -1
  25. package/dist/commonjs/funcs/domainsList.d.ts.map +1 -1
  26. package/dist/commonjs/funcs/domainsList.js +4 -3
  27. package/dist/commonjs/funcs/domainsList.js.map +1 -1
  28. package/dist/commonjs/funcs/domainsUpdate.d.ts.map +1 -1
  29. package/dist/commonjs/funcs/domainsUpdate.js +4 -3
  30. package/dist/commonjs/funcs/domainsUpdate.js.map +1 -1
  31. package/dist/commonjs/funcs/embedTokensCreate.d.ts.map +1 -1
  32. package/dist/commonjs/funcs/embedTokensCreate.js +4 -3
  33. package/dist/commonjs/funcs/embedTokensCreate.js.map +1 -1
  34. package/dist/commonjs/funcs/eventsList.d.ts.map +1 -1
  35. package/dist/commonjs/funcs/eventsList.js +4 -3
  36. package/dist/commonjs/funcs/eventsList.js.map +1 -1
  37. package/dist/commonjs/funcs/linksCount.d.ts.map +1 -1
  38. package/dist/commonjs/funcs/linksCount.js +4 -3
  39. package/dist/commonjs/funcs/linksCount.js.map +1 -1
  40. package/dist/commonjs/funcs/linksCreate.d.ts.map +1 -1
  41. package/dist/commonjs/funcs/linksCreate.js +4 -3
  42. package/dist/commonjs/funcs/linksCreate.js.map +1 -1
  43. package/dist/commonjs/funcs/linksCreateMany.d.ts.map +1 -1
  44. package/dist/commonjs/funcs/linksCreateMany.js +4 -3
  45. package/dist/commonjs/funcs/linksCreateMany.js.map +1 -1
  46. package/dist/commonjs/funcs/linksDelete.d.ts.map +1 -1
  47. package/dist/commonjs/funcs/linksDelete.js +4 -3
  48. package/dist/commonjs/funcs/linksDelete.js.map +1 -1
  49. package/dist/commonjs/funcs/linksDeleteMany.d.ts.map +1 -1
  50. package/dist/commonjs/funcs/linksDeleteMany.js +4 -3
  51. package/dist/commonjs/funcs/linksDeleteMany.js.map +1 -1
  52. package/dist/commonjs/funcs/linksGet.d.ts.map +1 -1
  53. package/dist/commonjs/funcs/linksGet.js +4 -3
  54. package/dist/commonjs/funcs/linksGet.js.map +1 -1
  55. package/dist/commonjs/funcs/linksList.d.ts.map +1 -1
  56. package/dist/commonjs/funcs/linksList.js +4 -3
  57. package/dist/commonjs/funcs/linksList.js.map +1 -1
  58. package/dist/commonjs/funcs/linksUpdate.d.ts.map +1 -1
  59. package/dist/commonjs/funcs/linksUpdate.js +4 -3
  60. package/dist/commonjs/funcs/linksUpdate.js.map +1 -1
  61. package/dist/commonjs/funcs/linksUpdateMany.d.ts.map +1 -1
  62. package/dist/commonjs/funcs/linksUpdateMany.js +4 -3
  63. package/dist/commonjs/funcs/linksUpdateMany.js.map +1 -1
  64. package/dist/commonjs/funcs/linksUpsert.d.ts.map +1 -1
  65. package/dist/commonjs/funcs/linksUpsert.js +4 -3
  66. package/dist/commonjs/funcs/linksUpsert.js.map +1 -1
  67. package/dist/commonjs/funcs/metatagsGet.d.ts.map +1 -1
  68. package/dist/commonjs/funcs/metatagsGet.js +4 -3
  69. package/dist/commonjs/funcs/metatagsGet.js.map +1 -1
  70. package/dist/commonjs/funcs/qrCodesGet.d.ts.map +1 -1
  71. package/dist/commonjs/funcs/qrCodesGet.js +4 -3
  72. package/dist/commonjs/funcs/qrCodesGet.js.map +1 -1
  73. package/dist/commonjs/funcs/tagsCreate.d.ts.map +1 -1
  74. package/dist/commonjs/funcs/tagsCreate.js +4 -3
  75. package/dist/commonjs/funcs/tagsCreate.js.map +1 -1
  76. package/dist/commonjs/funcs/tagsDelete.d.ts.map +1 -1
  77. package/dist/commonjs/funcs/tagsDelete.js +4 -3
  78. package/dist/commonjs/funcs/tagsDelete.js.map +1 -1
  79. package/dist/commonjs/funcs/tagsList.d.ts.map +1 -1
  80. package/dist/commonjs/funcs/tagsList.js +4 -3
  81. package/dist/commonjs/funcs/tagsList.js.map +1 -1
  82. package/dist/commonjs/funcs/tagsUpdate.d.ts.map +1 -1
  83. package/dist/commonjs/funcs/tagsUpdate.js +4 -3
  84. package/dist/commonjs/funcs/tagsUpdate.js.map +1 -1
  85. package/dist/commonjs/funcs/trackLead.d.ts.map +1 -1
  86. package/dist/commonjs/funcs/trackLead.js +4 -3
  87. package/dist/commonjs/funcs/trackLead.js.map +1 -1
  88. package/dist/commonjs/funcs/trackSale.d.ts.map +1 -1
  89. package/dist/commonjs/funcs/trackSale.js +4 -3
  90. package/dist/commonjs/funcs/trackSale.js.map +1 -1
  91. package/dist/commonjs/funcs/workspacesGet.d.ts.map +1 -1
  92. package/dist/commonjs/funcs/workspacesGet.js +4 -3
  93. package/dist/commonjs/funcs/workspacesGet.js.map +1 -1
  94. package/dist/commonjs/funcs/workspacesUpdate.d.ts.map +1 -1
  95. package/dist/commonjs/funcs/workspacesUpdate.js +4 -3
  96. package/dist/commonjs/funcs/workspacesUpdate.js.map +1 -1
  97. package/dist/commonjs/lib/config.d.ts +3 -3
  98. package/dist/commonjs/lib/config.js +3 -3
  99. package/dist/commonjs/lib/config.js.map +1 -1
  100. package/dist/commonjs/lib/encodings.d.ts +10 -9
  101. package/dist/commonjs/lib/encodings.d.ts.map +1 -1
  102. package/dist/commonjs/lib/encodings.js +74 -48
  103. package/dist/commonjs/lib/encodings.js.map +1 -1
  104. package/dist/commonjs/lib/primitives.d.ts +1 -0
  105. package/dist/commonjs/lib/primitives.d.ts.map +1 -1
  106. package/dist/commonjs/lib/primitives.js +11 -1
  107. package/dist/commonjs/lib/primitives.js.map +1 -1
  108. package/dist/commonjs/lib/sdks.d.ts.map +1 -1
  109. package/dist/commonjs/lib/sdks.js +4 -1
  110. package/dist/commonjs/lib/sdks.js.map +1 -1
  111. package/dist/commonjs/models/components/workspaceschema.d.ts +10 -1
  112. package/dist/commonjs/models/components/workspaceschema.d.ts.map +1 -1
  113. package/dist/commonjs/models/components/workspaceschema.js +2 -0
  114. package/dist/commonjs/models/components/workspaceschema.js.map +1 -1
  115. package/dist/commonjs/models/operations/tracksale.d.ts +4 -4
  116. package/dist/commonjs/models/operations/tracksale.d.ts.map +1 -1
  117. package/dist/commonjs/models/operations/tracksale.js +4 -4
  118. package/dist/commonjs/models/operations/tracksale.js.map +1 -1
  119. package/dist/commonjs/models/operations/updateworkspace.d.ts +2 -0
  120. package/dist/commonjs/models/operations/updateworkspace.d.ts.map +1 -1
  121. package/dist/commonjs/models/operations/updateworkspace.js +2 -0
  122. package/dist/commonjs/models/operations/updateworkspace.js.map +1 -1
  123. package/dist/commonjs/package.json +3 -0
  124. package/dist/esm/funcs/analyticsRetrieve.d.ts.map +1 -1
  125. package/dist/esm/funcs/analyticsRetrieve.js +4 -3
  126. package/dist/esm/funcs/analyticsRetrieve.js.map +1 -1
  127. package/dist/esm/funcs/customersCreate.d.ts.map +1 -1
  128. package/dist/esm/funcs/customersCreate.js +4 -3
  129. package/dist/esm/funcs/customersCreate.js.map +1 -1
  130. package/dist/esm/funcs/customersDelete.d.ts.map +1 -1
  131. package/dist/esm/funcs/customersDelete.js +4 -3
  132. package/dist/esm/funcs/customersDelete.js.map +1 -1
  133. package/dist/esm/funcs/customersGet.d.ts.map +1 -1
  134. package/dist/esm/funcs/customersGet.js +4 -3
  135. package/dist/esm/funcs/customersGet.js.map +1 -1
  136. package/dist/esm/funcs/customersList.d.ts.map +1 -1
  137. package/dist/esm/funcs/customersList.js +4 -3
  138. package/dist/esm/funcs/customersList.js.map +1 -1
  139. package/dist/esm/funcs/customersUpdate.d.ts.map +1 -1
  140. package/dist/esm/funcs/customersUpdate.js +4 -3
  141. package/dist/esm/funcs/customersUpdate.js.map +1 -1
  142. package/dist/esm/funcs/domainsCreate.d.ts.map +1 -1
  143. package/dist/esm/funcs/domainsCreate.js +4 -3
  144. package/dist/esm/funcs/domainsCreate.js.map +1 -1
  145. package/dist/esm/funcs/domainsDelete.d.ts.map +1 -1
  146. package/dist/esm/funcs/domainsDelete.js +4 -3
  147. package/dist/esm/funcs/domainsDelete.js.map +1 -1
  148. package/dist/esm/funcs/domainsList.d.ts.map +1 -1
  149. package/dist/esm/funcs/domainsList.js +4 -3
  150. package/dist/esm/funcs/domainsList.js.map +1 -1
  151. package/dist/esm/funcs/domainsUpdate.d.ts.map +1 -1
  152. package/dist/esm/funcs/domainsUpdate.js +4 -3
  153. package/dist/esm/funcs/domainsUpdate.js.map +1 -1
  154. package/dist/esm/funcs/embedTokensCreate.d.ts.map +1 -1
  155. package/dist/esm/funcs/embedTokensCreate.js +4 -3
  156. package/dist/esm/funcs/embedTokensCreate.js.map +1 -1
  157. package/dist/esm/funcs/eventsList.d.ts.map +1 -1
  158. package/dist/esm/funcs/eventsList.js +4 -3
  159. package/dist/esm/funcs/eventsList.js.map +1 -1
  160. package/dist/esm/funcs/linksCount.d.ts.map +1 -1
  161. package/dist/esm/funcs/linksCount.js +4 -3
  162. package/dist/esm/funcs/linksCount.js.map +1 -1
  163. package/dist/esm/funcs/linksCreate.d.ts.map +1 -1
  164. package/dist/esm/funcs/linksCreate.js +4 -3
  165. package/dist/esm/funcs/linksCreate.js.map +1 -1
  166. package/dist/esm/funcs/linksCreateMany.d.ts.map +1 -1
  167. package/dist/esm/funcs/linksCreateMany.js +4 -3
  168. package/dist/esm/funcs/linksCreateMany.js.map +1 -1
  169. package/dist/esm/funcs/linksDelete.d.ts.map +1 -1
  170. package/dist/esm/funcs/linksDelete.js +4 -3
  171. package/dist/esm/funcs/linksDelete.js.map +1 -1
  172. package/dist/esm/funcs/linksDeleteMany.d.ts.map +1 -1
  173. package/dist/esm/funcs/linksDeleteMany.js +4 -3
  174. package/dist/esm/funcs/linksDeleteMany.js.map +1 -1
  175. package/dist/esm/funcs/linksGet.d.ts.map +1 -1
  176. package/dist/esm/funcs/linksGet.js +4 -3
  177. package/dist/esm/funcs/linksGet.js.map +1 -1
  178. package/dist/esm/funcs/linksList.d.ts.map +1 -1
  179. package/dist/esm/funcs/linksList.js +4 -3
  180. package/dist/esm/funcs/linksList.js.map +1 -1
  181. package/dist/esm/funcs/linksUpdate.d.ts.map +1 -1
  182. package/dist/esm/funcs/linksUpdate.js +4 -3
  183. package/dist/esm/funcs/linksUpdate.js.map +1 -1
  184. package/dist/esm/funcs/linksUpdateMany.d.ts.map +1 -1
  185. package/dist/esm/funcs/linksUpdateMany.js +4 -3
  186. package/dist/esm/funcs/linksUpdateMany.js.map +1 -1
  187. package/dist/esm/funcs/linksUpsert.d.ts.map +1 -1
  188. package/dist/esm/funcs/linksUpsert.js +4 -3
  189. package/dist/esm/funcs/linksUpsert.js.map +1 -1
  190. package/dist/esm/funcs/metatagsGet.d.ts.map +1 -1
  191. package/dist/esm/funcs/metatagsGet.js +4 -3
  192. package/dist/esm/funcs/metatagsGet.js.map +1 -1
  193. package/dist/esm/funcs/qrCodesGet.d.ts.map +1 -1
  194. package/dist/esm/funcs/qrCodesGet.js +4 -3
  195. package/dist/esm/funcs/qrCodesGet.js.map +1 -1
  196. package/dist/esm/funcs/tagsCreate.d.ts.map +1 -1
  197. package/dist/esm/funcs/tagsCreate.js +4 -3
  198. package/dist/esm/funcs/tagsCreate.js.map +1 -1
  199. package/dist/esm/funcs/tagsDelete.d.ts.map +1 -1
  200. package/dist/esm/funcs/tagsDelete.js +4 -3
  201. package/dist/esm/funcs/tagsDelete.js.map +1 -1
  202. package/dist/esm/funcs/tagsList.d.ts.map +1 -1
  203. package/dist/esm/funcs/tagsList.js +4 -3
  204. package/dist/esm/funcs/tagsList.js.map +1 -1
  205. package/dist/esm/funcs/tagsUpdate.d.ts.map +1 -1
  206. package/dist/esm/funcs/tagsUpdate.js +4 -3
  207. package/dist/esm/funcs/tagsUpdate.js.map +1 -1
  208. package/dist/esm/funcs/trackLead.d.ts.map +1 -1
  209. package/dist/esm/funcs/trackLead.js +4 -3
  210. package/dist/esm/funcs/trackLead.js.map +1 -1
  211. package/dist/esm/funcs/trackSale.d.ts.map +1 -1
  212. package/dist/esm/funcs/trackSale.js +4 -3
  213. package/dist/esm/funcs/trackSale.js.map +1 -1
  214. package/dist/esm/funcs/workspacesGet.d.ts.map +1 -1
  215. package/dist/esm/funcs/workspacesGet.js +4 -3
  216. package/dist/esm/funcs/workspacesGet.js.map +1 -1
  217. package/dist/esm/funcs/workspacesUpdate.d.ts.map +1 -1
  218. package/dist/esm/funcs/workspacesUpdate.js +4 -3
  219. package/dist/esm/funcs/workspacesUpdate.js.map +1 -1
  220. package/dist/esm/lib/config.d.ts +3 -3
  221. package/dist/esm/lib/config.js +3 -3
  222. package/dist/esm/lib/config.js.map +1 -1
  223. package/dist/esm/lib/encodings.d.ts +10 -9
  224. package/dist/esm/lib/encodings.d.ts.map +1 -1
  225. package/dist/esm/lib/encodings.js +72 -47
  226. package/dist/esm/lib/encodings.js.map +1 -1
  227. package/dist/esm/lib/primitives.d.ts +1 -0
  228. package/dist/esm/lib/primitives.d.ts.map +1 -1
  229. package/dist/esm/lib/primitives.js +9 -0
  230. package/dist/esm/lib/primitives.js.map +1 -1
  231. package/dist/esm/lib/sdks.d.ts.map +1 -1
  232. package/dist/esm/lib/sdks.js +4 -1
  233. package/dist/esm/lib/sdks.js.map +1 -1
  234. package/dist/esm/models/components/workspaceschema.d.ts +10 -1
  235. package/dist/esm/models/components/workspaceschema.d.ts.map +1 -1
  236. package/dist/esm/models/components/workspaceschema.js +2 -0
  237. package/dist/esm/models/components/workspaceschema.js.map +1 -1
  238. package/dist/esm/models/operations/tracksale.d.ts +4 -4
  239. package/dist/esm/models/operations/tracksale.d.ts.map +1 -1
  240. package/dist/esm/models/operations/tracksale.js +4 -4
  241. package/dist/esm/models/operations/tracksale.js.map +1 -1
  242. package/dist/esm/models/operations/updateworkspace.d.ts +2 -0
  243. package/dist/esm/models/operations/updateworkspace.d.ts.map +1 -1
  244. package/dist/esm/models/operations/updateworkspace.js +2 -0
  245. package/dist/esm/models/operations/updateworkspace.js.map +1 -1
  246. package/dist/esm/package.json +3 -0
  247. package/jsr.json +27 -0
  248. package/package.json +1 -1
  249. package/src/funcs/analyticsRetrieve.ts +5 -3
  250. package/src/funcs/customersCreate.ts +5 -3
  251. package/src/funcs/customersDelete.ts +5 -3
  252. package/src/funcs/customersGet.ts +5 -3
  253. package/src/funcs/customersList.ts +5 -3
  254. package/src/funcs/customersUpdate.ts +5 -3
  255. package/src/funcs/domainsCreate.ts +5 -3
  256. package/src/funcs/domainsDelete.ts +5 -3
  257. package/src/funcs/domainsList.ts +5 -3
  258. package/src/funcs/domainsUpdate.ts +5 -3
  259. package/src/funcs/embedTokensCreate.ts +5 -3
  260. package/src/funcs/eventsList.ts +5 -3
  261. package/src/funcs/linksCount.ts +5 -3
  262. package/src/funcs/linksCreate.ts +5 -3
  263. package/src/funcs/linksCreateMany.ts +5 -3
  264. package/src/funcs/linksDelete.ts +5 -3
  265. package/src/funcs/linksDeleteMany.ts +5 -3
  266. package/src/funcs/linksGet.ts +5 -3
  267. package/src/funcs/linksList.ts +5 -3
  268. package/src/funcs/linksUpdate.ts +5 -3
  269. package/src/funcs/linksUpdateMany.ts +5 -3
  270. package/src/funcs/linksUpsert.ts +5 -3
  271. package/src/funcs/metatagsGet.ts +5 -3
  272. package/src/funcs/qrCodesGet.ts +5 -3
  273. package/src/funcs/tagsCreate.ts +5 -3
  274. package/src/funcs/tagsDelete.ts +5 -3
  275. package/src/funcs/tagsList.ts +5 -3
  276. package/src/funcs/tagsUpdate.ts +5 -3
  277. package/src/funcs/trackLead.ts +5 -3
  278. package/src/funcs/trackSale.ts +5 -3
  279. package/src/funcs/workspacesGet.ts +5 -3
  280. package/src/funcs/workspacesUpdate.ts +5 -3
  281. package/src/lib/config.ts +3 -3
  282. package/src/lib/encodings.ts +95 -61
  283. package/src/lib/primitives.ts +14 -0
  284. package/src/lib/sdks.ts +4 -1
  285. package/src/models/components/workspaceschema.ts +8 -1
  286. package/src/models/operations/tracksale.ts +8 -8
  287. package/src/models/operations/updateworkspace.ts +4 -0
  288. package/tsconfig.json +41 -0
@@ -5,6 +5,7 @@
5
5
  import { DubCore } from "../core.js";
6
6
  import { encodeJSON, encodeSimple } from "../lib/encodings.js";
7
7
  import * as M from "../lib/matchers.js";
8
+ import { compactMap } from "../lib/primitives.js";
8
9
  import { safeParse } from "../lib/schemas.js";
9
10
  import { RequestOptions } from "../lib/sdks.js";
10
11
  import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
@@ -80,10 +81,10 @@ export async function workspacesUpdate(
80
81
 
81
82
  const path = pathToFunc("/workspaces/{idOrSlug}")(pathParams);
82
83
 
83
- const headers = new Headers({
84
+ const headers = new Headers(compactMap({
84
85
  "Content-Type": "application/json",
85
86
  Accept: "application/json",
86
- });
87
+ }));
87
88
 
88
89
  const secConfig = await extractSecurity(client._options.token);
89
90
  const securityInput = secConfig == null ? {} : { token: secConfig };
@@ -172,7 +173,8 @@ export async function workspacesUpdate(
172
173
  M.jsonErr(422, errors.UnprocessableEntity$inboundSchema),
173
174
  M.jsonErr(429, errors.RateLimitExceeded$inboundSchema),
174
175
  M.jsonErr(500, errors.InternalServerError$inboundSchema),
175
- M.fail(["4XX", "5XX"]),
176
+ M.fail("4XX"),
177
+ M.fail("5XX"),
176
178
  )(response, { extraFields: responseFields });
177
179
  if (!result.ok) {
178
180
  return result;
package/src/lib/config.ts CHANGED
@@ -57,7 +57,7 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
57
57
  export const SDK_METADATA = {
58
58
  language: "typescript",
59
59
  openapiDocVersion: "0.0.1",
60
- sdkVersion: "0.46.13",
61
- genVersion: "2.493.4",
62
- userAgent: "speakeasy-sdk/typescript 0.46.13 2.493.4 0.0.1 dub",
60
+ sdkVersion: "0.46.15",
61
+ genVersion: "2.493.21",
62
+ userAgent: "speakeasy-sdk/typescript 0.46.15 2.493.21 0.0.1 dub",
63
63
  } as const;
@@ -16,12 +16,16 @@ export function encodeMatrix(
16
16
  key: string,
17
17
  value: unknown,
18
18
  options?: { explode?: boolean; charEncoding?: "percent" | "none" },
19
- ): string {
19
+ ): string | undefined {
20
20
  let out = "";
21
21
  const pairs: [string, unknown][] = options?.explode
22
22
  ? explode(key, value)
23
23
  : [[key, value]];
24
24
 
25
+ if (pairs.every(([_, v]) => v == null)) {
26
+ return;
27
+ }
28
+
25
29
  const encodeString = (v: string) => {
26
30
  return options?.charEncoding === "percent" ? encodeURIComponent(v) : v;
27
31
  };
@@ -29,21 +33,25 @@ export function encodeMatrix(
29
33
 
30
34
  pairs.forEach(([pk, pv]) => {
31
35
  let tmp = "";
32
- let encValue = "";
36
+ let encValue: string | null | undefined = null;
33
37
 
34
- if (pv === undefined) {
38
+ if (pv == null) {
35
39
  return;
36
40
  } else if (Array.isArray(pv)) {
37
- encValue = mapDefined(pv, (v) => `${encodeValue(v)}`).join(",");
41
+ encValue = mapDefined(pv, (v) => `${encodeValue(v)}`)?.join(",");
38
42
  } else if (isPlainObject(pv)) {
39
- encValue = mapDefinedEntries(Object.entries(pv), ([k, v]) => {
43
+ const mapped = mapDefinedEntries(Object.entries(pv), ([k, v]) => {
40
44
  return `,${encodeString(k)},${encodeValue(v)}`;
41
- }).join("");
42
- encValue = encValue.slice(1);
45
+ });
46
+ encValue = mapped?.join("").slice(1);
43
47
  } else {
44
48
  encValue = `${encodeValue(pv)}`;
45
49
  }
46
50
 
51
+ if (encValue == null) {
52
+ return;
53
+ }
54
+
47
55
  const keyPrefix = encodeString(pk);
48
56
  tmp = `${keyPrefix}=${encValue}`;
49
57
  // trim trailing '=' if value was empty
@@ -66,36 +74,40 @@ export function encodeLabel(
66
74
  key: string,
67
75
  value: unknown,
68
76
  options?: { explode?: boolean; charEncoding?: "percent" | "none" },
69
- ): string {
77
+ ): string | undefined {
70
78
  let out = "";
71
79
  const pairs: [string, unknown][] = options?.explode
72
80
  ? explode(key, value)
73
81
  : [[key, value]];
74
82
 
83
+ if (pairs.every(([_, v]) => v == null)) {
84
+ return;
85
+ }
86
+
75
87
  const encodeString = (v: string) => {
76
88
  return options?.charEncoding === "percent" ? encodeURIComponent(v) : v;
77
89
  };
78
90
  const encodeValue = (v: unknown) => encodeString(serializeValue(v));
79
91
 
80
92
  pairs.forEach(([pk, pv]) => {
81
- let encValue = "";
93
+ let encValue: string | null | undefined = "";
82
94
 
83
- if (pv === undefined) {
95
+ if (pv == null) {
84
96
  return;
85
97
  } else if (Array.isArray(pv)) {
86
- encValue = mapDefined(pv, (v) => `${encodeValue(v)}`).join(".");
98
+ encValue = mapDefined(pv, (v) => `${encodeValue(v)}`)?.join(".");
87
99
  } else if (isPlainObject(pv)) {
88
- encValue = mapDefinedEntries(Object.entries(pv), ([k, v]) => {
100
+ const mapped = mapDefinedEntries(Object.entries(pv), ([k, v]) => {
89
101
  return `.${encodeString(k)}.${encodeValue(v)}`;
90
- }).join("");
91
- encValue = encValue.slice(1);
102
+ });
103
+ encValue = mapped?.join("").slice(1);
92
104
  } else {
93
105
  const k =
94
106
  options?.explode && isPlainObject(value) ? `${encodeString(pk)}=` : "";
95
107
  encValue = `${k}${encodeValue(pv)}`;
96
108
  }
97
109
 
98
- out += `.${encValue}`;
110
+ out += encValue == null ? "" : `.${encValue}`;
99
111
  });
100
112
 
101
113
  return out;
@@ -105,7 +117,7 @@ type FormEncoder = (
105
117
  key: string,
106
118
  value: unknown,
107
119
  options?: { explode?: boolean; charEncoding?: "percent" | "none" },
108
- ) => string;
120
+ ) => string | undefined;
109
121
 
110
122
  function formEncoder(sep: string): FormEncoder {
111
123
  return (
@@ -118,6 +130,10 @@ function formEncoder(sep: string): FormEncoder {
118
130
  ? explode(key, value)
119
131
  : [[key, value]];
120
132
 
133
+ if (pairs.every(([_, v]) => v == null)) {
134
+ return;
135
+ }
136
+
121
137
  const encodeString = (v: string) => {
122
138
  return options?.charEncoding === "percent" ? encodeURIComponent(v) : v;
123
139
  };
@@ -128,20 +144,24 @@ function formEncoder(sep: string): FormEncoder {
128
144
 
129
145
  pairs.forEach(([pk, pv]) => {
130
146
  let tmp = "";
131
- let encValue = "";
147
+ let encValue: string | null | undefined = null;
132
148
 
133
- if (pv === undefined) {
149
+ if (pv == null) {
134
150
  return;
135
151
  } else if (Array.isArray(pv)) {
136
- encValue = mapDefined(pv, (v) => `${encodeValue(v)}`).join(encodedSep);
152
+ encValue = mapDefined(pv, (v) => `${encodeValue(v)}`)?.join(encodedSep);
137
153
  } else if (isPlainObject(pv)) {
138
154
  encValue = mapDefinedEntries(Object.entries(pv), ([k, v]) => {
139
155
  return `${encodeString(k)}${encodedSep}${encodeValue(v)}`;
140
- }).join(encodedSep);
156
+ })?.join(encodedSep);
141
157
  } else {
142
158
  encValue = `${encodeValue(pv)}`;
143
159
  }
144
160
 
161
+ if (encValue == null) {
162
+ return;
163
+ }
164
+
145
165
  tmp = `${encodeString(pk)}=${encValue}`;
146
166
 
147
167
  // If we end up with the nothing then skip forward
@@ -180,7 +200,7 @@ export function encodeBodyForm(
180
200
  let tmp = "";
181
201
  let encValue = "";
182
202
 
183
- if (pv === undefined) {
203
+ if (pv == null) {
184
204
  return;
185
205
  } else if (Array.isArray(pv)) {
186
206
  encValue = JSON.stringify(pv, jsonReplacer);
@@ -207,14 +227,14 @@ export function encodeDeepObject(
207
227
  key: string,
208
228
  value: unknown,
209
229
  options?: { charEncoding?: "percent" | "none" },
210
- ): string {
230
+ ): string | undefined {
211
231
  if (value == null) {
212
- return "";
232
+ return;
213
233
  }
214
234
 
215
235
  if (!isPlainObject(value)) {
216
236
  throw new EncodingError(
217
- `Value of parameter '${key}' which uses deepObject encoding must be an object`,
237
+ `Value of parameter '${key}' which uses deepObject encoding must be an object or null`,
218
238
  );
219
239
  }
220
240
 
@@ -225,9 +245,9 @@ export function encodeDeepObjectObject(
225
245
  key: string,
226
246
  value: unknown,
227
247
  options?: { charEncoding?: "percent" | "none" },
228
- ): string {
248
+ ): string | undefined {
229
249
  if (value == null) {
230
- return "";
250
+ return;
231
251
  }
232
252
 
233
253
  let out = "";
@@ -241,7 +261,7 @@ export function encodeDeepObjectObject(
241
261
  }
242
262
 
243
263
  Object.entries(value).forEach(([ck, cv]) => {
244
- if (cv === undefined) {
264
+ if (cv == null) {
245
265
  return;
246
266
  }
247
267
 
@@ -250,19 +270,17 @@ export function encodeDeepObjectObject(
250
270
  if (isPlainObject(cv)) {
251
271
  const objOut = encodeDeepObjectObject(pk, cv, options);
252
272
 
253
- out += `&${objOut}`;
273
+ out += objOut == null ? "" : `&${objOut}`;
254
274
 
255
275
  return;
256
276
  }
257
277
 
258
278
  const pairs: unknown[] = Array.isArray(cv) ? cv : [cv];
259
- let encoded = "";
260
-
261
- encoded = mapDefined(pairs, (v) => {
279
+ const encoded = mapDefined(pairs, (v) => {
262
280
  return `${encodeString(pk)}=${encodeString(serializeValue(v))}`;
263
- }).join("&");
281
+ })?.join("&");
264
282
 
265
- out += `&${encoded}`;
283
+ out += encoded == null ? "" : `&${encoded}`;
266
284
  });
267
285
 
268
286
  return out.slice(1);
@@ -272,9 +290,9 @@ export function encodeJSON(
272
290
  key: string,
273
291
  value: unknown,
274
292
  options?: { explode?: boolean; charEncoding?: "percent" | "none" },
275
- ): string {
293
+ ): string | undefined {
276
294
  if (typeof value === "undefined") {
277
- return "";
295
+ return;
278
296
  }
279
297
 
280
298
  const encodeString = (v: string) => {
@@ -290,40 +308,39 @@ export const encodeSimple = (
290
308
  key: string,
291
309
  value: unknown,
292
310
  options?: { explode?: boolean; charEncoding?: "percent" | "none" },
293
- ): string => {
311
+ ): string | undefined => {
294
312
  let out = "";
295
313
  const pairs: [string, unknown][] = options?.explode
296
314
  ? explode(key, value)
297
315
  : [[key, value]];
298
316
 
317
+ if (pairs.every(([_, v]) => v == null)) {
318
+ return;
319
+ }
320
+
299
321
  const encodeString = (v: string) => {
300
322
  return options?.charEncoding === "percent" ? encodeURIComponent(v) : v;
301
323
  };
302
324
  const encodeValue = (v: unknown) => encodeString(serializeValue(v));
303
325
 
304
326
  pairs.forEach(([pk, pv]) => {
305
- let tmp = "";
327
+ let tmp: string | null | undefined = "";
306
328
 
307
- if (pv === undefined) {
329
+ if (pv == null) {
308
330
  return;
309
331
  } else if (Array.isArray(pv)) {
310
- tmp = mapDefined(pv, (v) => `${encodeValue(v)}`).join(",");
332
+ tmp = mapDefined(pv, (v) => `${encodeValue(v)}`)?.join(",");
311
333
  } else if (isPlainObject(pv)) {
312
- tmp = mapDefinedEntries(Object.entries(pv), ([k, v]) => {
334
+ const mapped = mapDefinedEntries(Object.entries(pv), ([k, v]) => {
313
335
  return `,${encodeString(k)},${encodeValue(v)}`;
314
- }).join("");
315
- tmp = tmp.slice(1);
336
+ });
337
+ tmp = mapped?.join("").slice(1);
316
338
  } else {
317
339
  const k = options?.explode && isPlainObject(value) ? `${pk}=` : "";
318
340
  tmp = `${k}${encodeValue(pv)}`;
319
341
  }
320
342
 
321
- // If we end up with the nothing then skip forward
322
- if (!tmp) {
323
- return;
324
- }
325
-
326
- out += `,${tmp}`;
343
+ out += tmp ? `,${tmp}` : "";
327
344
  });
328
345
 
329
346
  return out.slice(1);
@@ -341,9 +358,7 @@ function explode(key: string, value: unknown): [string, unknown][] {
341
358
  }
342
359
 
343
360
  function serializeValue(value: unknown): string {
344
- if (value === null) {
345
- return "null";
346
- } else if (typeof value === "undefined") {
361
+ if (value == null) {
347
362
  return "";
348
363
  } else if (value instanceof Date) {
349
364
  return value.toISOString();
@@ -364,14 +379,14 @@ function jsonReplacer(_: string, value: unknown): unknown {
364
379
  }
365
380
  }
366
381
 
367
- function mapDefined<T, R>(inp: T[], mapper: (v: T) => R): R[] {
368
- return inp.reduce<R[]>((acc, v) => {
369
- if (v === undefined) {
382
+ function mapDefined<T, R>(inp: T[], mapper: (v: T) => R): R[] | null {
383
+ const res = inp.reduce<R[]>((acc, v) => {
384
+ if (v == null) {
370
385
  return acc;
371
386
  }
372
387
 
373
388
  const m = mapper(v);
374
- if (m === undefined) {
389
+ if (m == null) {
375
390
  return acc;
376
391
  }
377
392
 
@@ -379,30 +394,32 @@ function mapDefined<T, R>(inp: T[], mapper: (v: T) => R): R[] {
379
394
 
380
395
  return acc;
381
396
  }, []);
397
+
398
+ return res.length ? res : null;
382
399
  }
383
400
 
384
401
  function mapDefinedEntries<K, V, R>(
385
402
  inp: Iterable<[K, V]>,
386
403
  mapper: (v: [K, V]) => R,
387
- ): R[] {
404
+ ): R[] | null {
388
405
  const acc: R[] = [];
389
406
  for (const [k, v] of inp) {
390
- if (v === undefined) {
407
+ if (v == null) {
391
408
  continue;
392
409
  }
393
410
 
394
411
  const m = mapper([k, v]);
395
- if (m === undefined) {
412
+ if (m == null) {
396
413
  continue;
397
414
  }
398
415
 
399
416
  acc.push(m);
400
417
  }
401
418
 
402
- return acc;
419
+ return acc.length ? acc : null;
403
420
  }
404
421
 
405
- export function queryJoin(...args: string[]): string {
422
+ export function queryJoin(...args: (string | undefined)[]): string {
406
423
  return args.filter(Boolean).join("&");
407
424
  }
408
425
 
@@ -415,7 +432,7 @@ type QueryEncoder = (
415
432
  key: string,
416
433
  value: unknown,
417
434
  options?: QueryEncoderOptions,
418
- ) => string;
435
+ ) => string | undefined;
419
436
 
420
437
  type BulkQueryEncoder = (
421
438
  values: Record<string, unknown>,
@@ -447,3 +464,20 @@ export const encodeFormQuery = queryEncoder(encodeForm);
447
464
  export const encodeSpaceDelimitedQuery = queryEncoder(encodeSpaceDelimited);
448
465
  export const encodePipeDelimitedQuery = queryEncoder(encodePipeDelimited);
449
466
  export const encodeDeepObjectQuery = queryEncoder(encodeDeepObject);
467
+
468
+ export function appendForm(
469
+ fd: FormData,
470
+ key: string,
471
+ value: unknown,
472
+ fileName?: string,
473
+ ): void {
474
+ if (value == null) {
475
+ return;
476
+ } else if (value instanceof Blob && fileName) {
477
+ fd.append(key, value, fileName);
478
+ } else if (value instanceof Blob) {
479
+ fd.append(key, value);
480
+ } else {
481
+ fd.append(key, String(value));
482
+ }
483
+ }
@@ -120,3 +120,17 @@ export function abortSignalAny(signals: AbortSignal[]): AbortSignal {
120
120
 
121
121
  return result;
122
122
  }
123
+
124
+ export function compactMap<T>(
125
+ values: Record<string, T | undefined>,
126
+ ): Record<string, T> {
127
+ const out: Record<string, T> = {};
128
+
129
+ for (const [k, v] of Object.entries(values)) {
130
+ if (typeof v !== "undefined") {
131
+ out[k] = v;
132
+ }
133
+ }
134
+
135
+ return out;
136
+ }
package/src/lib/sdks.ts CHANGED
@@ -131,7 +131,10 @@ export class ClientSDK {
131
131
 
132
132
  const secQuery: string[] = [];
133
133
  for (const [k, v] of Object.entries(security?.queryParams || {})) {
134
- secQuery.push(encodeForm(k, v, { charEncoding: "percent" }));
134
+ const q = encodeForm(k, v, { charEncoding: "percent" });
135
+ if (typeof q !== "undefined") {
136
+ secQuery.push(q);
137
+ }
135
138
  }
136
139
  if (secQuery.length) {
137
140
  finalQuery += `&${secQuery.join("&")}`;
@@ -149,7 +149,7 @@ export type WorkspaceSchema = {
149
149
  */
150
150
  aiLimit: number;
151
151
  /**
152
- * Whether the workspace has conversion tracking enabled (d.to/conversions).
152
+ * Whether the workspace has conversion tracking enabled automatically for new links (d.to/conversions).
153
153
  */
154
154
  conversionEnabled: boolean;
155
155
  /**
@@ -176,6 +176,10 @@ export type WorkspaceSchema = {
176
176
  * The feature flags of the workspace, indicating which features are enabled.
177
177
  */
178
178
  flags?: { [k: string]: boolean } | undefined;
179
+ /**
180
+ * The miscellaneous key-value store of the workspace.
181
+ */
182
+ store: { [k: string]: any } | null;
179
183
  };
180
184
 
181
185
  /** @internal */
@@ -353,6 +357,7 @@ export const WorkspaceSchema$inboundSchema: z.ZodType<
353
357
  users: z.array(z.lazy(() => Users$inboundSchema)),
354
358
  domains: z.array(z.lazy(() => Domains$inboundSchema)),
355
359
  flags: z.record(z.boolean()).optional(),
360
+ store: z.nullable(z.record(z.any())),
356
361
  });
357
362
 
358
363
  /** @internal */
@@ -386,6 +391,7 @@ export type WorkspaceSchema$Outbound = {
386
391
  users: Array<Users$Outbound>;
387
392
  domains: Array<Domains$Outbound>;
388
393
  flags?: { [k: string]: boolean } | undefined;
394
+ store: { [k: string]: any } | null;
389
395
  };
390
396
 
391
397
  /** @internal */
@@ -423,6 +429,7 @@ export const WorkspaceSchema$outboundSchema: z.ZodType<
423
429
  users: z.array(z.lazy(() => Users$outboundSchema)),
424
430
  domains: z.array(z.lazy(() => Domains$outboundSchema)),
425
431
  flags: z.record(z.boolean()).optional(),
432
+ store: z.nullable(z.record(z.any())),
426
433
  });
427
434
 
428
435
  /**
@@ -79,8 +79,8 @@ export type Sale = {
79
79
  */
80
80
  export type TrackSaleResponseBody = {
81
81
  eventName: string;
82
- customer: TrackSaleCustomer;
83
- sale: Sale;
82
+ customer: TrackSaleCustomer | null;
83
+ sale: Sale | null;
84
84
  };
85
85
 
86
86
  /** @internal */
@@ -308,15 +308,15 @@ export const TrackSaleResponseBody$inboundSchema: z.ZodType<
308
308
  unknown
309
309
  > = z.object({
310
310
  eventName: z.string(),
311
- customer: z.lazy(() => TrackSaleCustomer$inboundSchema),
312
- sale: z.lazy(() => Sale$inboundSchema),
311
+ customer: z.nullable(z.lazy(() => TrackSaleCustomer$inboundSchema)),
312
+ sale: z.nullable(z.lazy(() => Sale$inboundSchema)),
313
313
  });
314
314
 
315
315
  /** @internal */
316
316
  export type TrackSaleResponseBody$Outbound = {
317
317
  eventName: string;
318
- customer: TrackSaleCustomer$Outbound;
319
- sale: Sale$Outbound;
318
+ customer: TrackSaleCustomer$Outbound | null;
319
+ sale: Sale$Outbound | null;
320
320
  };
321
321
 
322
322
  /** @internal */
@@ -326,8 +326,8 @@ export const TrackSaleResponseBody$outboundSchema: z.ZodType<
326
326
  TrackSaleResponseBody
327
327
  > = z.object({
328
328
  eventName: z.string(),
329
- customer: z.lazy(() => TrackSaleCustomer$outboundSchema),
330
- sale: z.lazy(() => Sale$outboundSchema),
329
+ customer: z.nullable(z.lazy(() => TrackSaleCustomer$outboundSchema)),
330
+ sale: z.nullable(z.lazy(() => Sale$outboundSchema)),
331
331
  });
332
332
 
333
333
  /**
@@ -12,6 +12,7 @@ export type UpdateWorkspaceRequestBody = {
12
12
  name?: string | undefined;
13
13
  slug?: string | undefined;
14
14
  logo?: string | undefined;
15
+ conversionEnabled?: boolean | undefined;
15
16
  };
16
17
 
17
18
  export type UpdateWorkspaceRequest = {
@@ -31,6 +32,7 @@ export const UpdateWorkspaceRequestBody$inboundSchema: z.ZodType<
31
32
  name: z.string().optional(),
32
33
  slug: z.string().optional(),
33
34
  logo: z.string().optional(),
35
+ conversionEnabled: z.boolean().optional(),
34
36
  });
35
37
 
36
38
  /** @internal */
@@ -38,6 +40,7 @@ export type UpdateWorkspaceRequestBody$Outbound = {
38
40
  name?: string | undefined;
39
41
  slug?: string | undefined;
40
42
  logo?: string | undefined;
43
+ conversionEnabled?: boolean | undefined;
41
44
  };
42
45
 
43
46
  /** @internal */
@@ -49,6 +52,7 @@ export const UpdateWorkspaceRequestBody$outboundSchema: z.ZodType<
49
52
  name: z.string().optional(),
50
53
  slug: z.string().optional(),
51
54
  logo: z.string().optional(),
55
+ conversionEnabled: z.boolean().optional(),
52
56
  });
53
57
 
54
58
  /**
package/tsconfig.json ADDED
@@ -0,0 +1,41 @@
1
+ {
2
+ "compilerOptions": {
3
+ "incremental": true,
4
+ "tsBuildInfoFile": ".tsbuildinfo",
5
+ "target": "ES2020",
6
+ "lib": ["ES2022", "DOM", "DOM.Iterable"],
7
+ "jsx": "react-jsx",
8
+
9
+ "module": "Node16",
10
+ "moduleResolution": "Node16",
11
+
12
+ "allowJs": true,
13
+
14
+ "declaration": true,
15
+ "declarationMap": true,
16
+ "sourceMap": true,
17
+ "outDir": ".",
18
+
19
+
20
+ // https://github.com/tsconfig/bases/blob/a1bf7c0fa2e094b068ca3e1448ca2ece4157977e/bases/strictest.json
21
+ "strict": true,
22
+ "allowUnusedLabels": false,
23
+ "allowUnreachableCode": false,
24
+ "exactOptionalPropertyTypes": true,
25
+ "useUnknownInCatchVariables": true,
26
+ "noFallthroughCasesInSwitch": true,
27
+ "noImplicitOverride": true,
28
+ "noImplicitReturns": true,
29
+ "noPropertyAccessFromIndexSignature": true,
30
+ "noUncheckedIndexedAccess": true,
31
+ "noUnusedLocals": true,
32
+ "noUnusedParameters": true,
33
+ "isolatedModules": true,
34
+ "checkJs": true,
35
+ "esModuleInterop": true,
36
+ "skipLibCheck": true,
37
+ "forceConsistentCasingInFileNames": true
38
+ },
39
+ "include": ["src"],
40
+ "exclude": ["node_modules"]
41
+ }