agentmail 0.3.2 → 0.3.4

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 (202) hide show
  1. package/dist/cjs/BaseClient.js +2 -2
  2. package/dist/cjs/Client.d.ts +3 -0
  3. package/dist/cjs/Client.js +17 -12
  4. package/dist/cjs/api/resources/inboxes/resources/messages/client/Client.js +2 -1
  5. package/dist/cjs/api/resources/inboxes/resources/messages/client/requests/ListMessagesRequest.d.ts +1 -0
  6. package/dist/cjs/api/resources/inboxes/resources/threads/client/Client.js +2 -1
  7. package/dist/cjs/api/resources/inboxes/resources/threads/client/requests/ListThreadsRequest.d.ts +1 -0
  8. package/dist/cjs/api/resources/index.d.ts +3 -0
  9. package/dist/cjs/api/resources/index.js +4 -1
  10. package/dist/cjs/api/resources/lists/client/Client.d.ts +65 -0
  11. package/dist/cjs/api/resources/lists/client/Client.js +307 -0
  12. package/dist/cjs/api/resources/lists/client/index.d.ts +1 -0
  13. package/dist/cjs/api/resources/lists/client/index.js +17 -0
  14. package/dist/cjs/api/resources/lists/client/requests/ListListEntriesRequest.d.ts +9 -0
  15. package/dist/cjs/api/resources/lists/client/requests/ListListEntriesRequest.js +3 -0
  16. package/dist/cjs/api/resources/lists/client/requests/index.d.ts +1 -0
  17. package/dist/cjs/api/resources/lists/client/requests/index.js +2 -0
  18. package/dist/cjs/api/resources/lists/index.d.ts +2 -0
  19. package/dist/cjs/api/resources/lists/index.js +18 -0
  20. package/dist/cjs/api/resources/lists/types/CreateListEntryRequest.d.ts +6 -0
  21. package/dist/cjs/api/resources/lists/types/CreateListEntryRequest.js +3 -0
  22. package/dist/cjs/api/resources/lists/types/Direction.d.ts +6 -0
  23. package/dist/cjs/api/resources/lists/types/Direction.js +9 -0
  24. package/dist/cjs/api/resources/lists/types/EntryType.d.ts +6 -0
  25. package/dist/cjs/api/resources/lists/types/EntryType.js +9 -0
  26. package/dist/cjs/api/resources/lists/types/ListEntry.d.ts +3 -0
  27. package/dist/cjs/api/resources/lists/types/ListEntry.js +3 -0
  28. package/dist/cjs/api/resources/lists/types/ListEntryBase.d.ts +13 -0
  29. package/dist/cjs/api/resources/lists/types/ListEntryBase.js +3 -0
  30. package/dist/cjs/api/resources/lists/types/ListListEntriesResponse.d.ts +8 -0
  31. package/dist/cjs/api/resources/lists/types/ListListEntriesResponse.js +3 -0
  32. package/dist/cjs/api/resources/lists/types/ListType.d.ts +6 -0
  33. package/dist/cjs/api/resources/lists/types/ListType.js +9 -0
  34. package/dist/cjs/api/resources/lists/types/PodListEntry.d.ts +7 -0
  35. package/dist/cjs/api/resources/lists/types/PodListEntry.js +3 -0
  36. package/dist/cjs/api/resources/lists/types/PodListListEntriesResponse.d.ts +8 -0
  37. package/dist/cjs/api/resources/lists/types/PodListListEntriesResponse.js +3 -0
  38. package/dist/cjs/api/resources/lists/types/index.d.ts +9 -0
  39. package/dist/cjs/api/resources/lists/types/index.js +25 -0
  40. package/dist/cjs/api/resources/pods/client/Client.d.ts +3 -0
  41. package/dist/cjs/api/resources/pods/client/Client.js +7 -2
  42. package/dist/cjs/api/resources/pods/resources/index.d.ts +2 -0
  43. package/dist/cjs/api/resources/pods/resources/index.js +3 -1
  44. package/dist/cjs/api/resources/pods/resources/lists/client/Client.d.ts +69 -0
  45. package/dist/cjs/api/resources/pods/resources/lists/client/Client.js +311 -0
  46. package/dist/cjs/api/resources/pods/resources/lists/client/index.d.ts +1 -0
  47. package/dist/cjs/api/resources/pods/resources/lists/client/index.js +17 -0
  48. package/dist/cjs/api/resources/pods/resources/lists/client/requests/ListListEntriesRequest.d.ts +9 -0
  49. package/dist/cjs/api/resources/pods/resources/lists/client/requests/ListListEntriesRequest.js +3 -0
  50. package/dist/cjs/api/resources/pods/resources/lists/client/requests/index.d.ts +1 -0
  51. package/dist/cjs/api/resources/pods/resources/lists/client/requests/index.js +2 -0
  52. package/dist/cjs/api/resources/pods/resources/lists/index.d.ts +1 -0
  53. package/dist/cjs/api/resources/pods/resources/lists/index.js +17 -0
  54. package/dist/cjs/api/resources/pods/resources/threads/client/Client.js +2 -1
  55. package/dist/cjs/api/resources/pods/resources/threads/client/requests/ListThreadsRequest.d.ts +1 -0
  56. package/dist/cjs/api/resources/threads/client/Client.js +2 -1
  57. package/dist/cjs/api/resources/threads/client/requests/ListThreadsRequest.d.ts +1 -0
  58. package/dist/cjs/api/types/IncludeBlocked.d.ts +4 -0
  59. package/dist/cjs/api/types/IncludeBlocked.js +3 -0
  60. package/dist/cjs/api/types/index.d.ts +1 -0
  61. package/dist/cjs/api/types/index.js +1 -0
  62. package/dist/cjs/serialization/resources/index.d.ts +2 -0
  63. package/dist/cjs/serialization/resources/index.js +3 -1
  64. package/dist/cjs/serialization/resources/lists/index.d.ts +1 -0
  65. package/dist/cjs/serialization/resources/lists/index.js +17 -0
  66. package/dist/cjs/serialization/resources/lists/types/CreateListEntryRequest.d.ts +10 -0
  67. package/dist/cjs/serialization/resources/lists/types/CreateListEntryRequest.js +42 -0
  68. package/dist/cjs/serialization/resources/lists/types/Direction.d.ts +7 -0
  69. package/dist/cjs/serialization/resources/lists/types/Direction.js +39 -0
  70. package/dist/cjs/serialization/resources/lists/types/EntryType.d.ts +7 -0
  71. package/dist/cjs/serialization/resources/lists/types/EntryType.js +39 -0
  72. package/dist/cjs/serialization/resources/lists/types/ListEntry.d.ts +9 -0
  73. package/dist/cjs/serialization/resources/lists/types/ListEntry.js +40 -0
  74. package/dist/cjs/serialization/resources/lists/types/ListEntryBase.d.ts +19 -0
  75. package/dist/cjs/serialization/resources/lists/types/ListEntryBase.js +51 -0
  76. package/dist/cjs/serialization/resources/lists/types/ListListEntriesResponse.d.ts +16 -0
  77. package/dist/cjs/serialization/resources/lists/types/ListListEntriesResponse.js +48 -0
  78. package/dist/cjs/serialization/resources/lists/types/ListType.d.ts +7 -0
  79. package/dist/cjs/serialization/resources/lists/types/ListType.js +39 -0
  80. package/dist/cjs/serialization/resources/lists/types/PodListEntry.d.ts +11 -0
  81. package/dist/cjs/serialization/resources/lists/types/PodListEntry.js +45 -0
  82. package/dist/cjs/serialization/resources/lists/types/PodListListEntriesResponse.d.ts +16 -0
  83. package/dist/cjs/serialization/resources/lists/types/PodListListEntriesResponse.js +48 -0
  84. package/dist/cjs/serialization/resources/lists/types/index.d.ts +9 -0
  85. package/dist/cjs/serialization/resources/lists/types/index.js +25 -0
  86. package/dist/cjs/serialization/types/IncludeBlocked.d.ts +7 -0
  87. package/dist/cjs/serialization/types/IncludeBlocked.js +39 -0
  88. package/dist/cjs/serialization/types/index.d.ts +1 -0
  89. package/dist/cjs/serialization/types/index.js +1 -0
  90. package/dist/cjs/version.d.ts +1 -1
  91. package/dist/cjs/version.js +1 -1
  92. package/dist/cjs/wrapper/Client.d.ts +4 -4
  93. package/dist/cjs/wrapper/Client.js +7 -7
  94. package/dist/cjs/wrapper/mppx.d.ts +8 -0
  95. package/dist/cjs/wrapper/{mpp.js → mppx.js} +5 -5
  96. package/dist/{esm/wrapper/probe402.d.mts → cjs/wrapper/util.d.ts} +1 -0
  97. package/dist/cjs/wrapper/{probe402.js → util.js} +5 -1
  98. package/dist/cjs/wrapper/x402.js +2 -2
  99. package/dist/esm/BaseClient.mjs +2 -2
  100. package/dist/esm/Client.d.mts +3 -0
  101. package/dist/esm/Client.mjs +5 -0
  102. package/dist/esm/api/resources/inboxes/resources/messages/client/Client.mjs +2 -1
  103. package/dist/esm/api/resources/inboxes/resources/messages/client/requests/ListMessagesRequest.d.mts +1 -0
  104. package/dist/esm/api/resources/inboxes/resources/threads/client/Client.mjs +2 -1
  105. package/dist/esm/api/resources/inboxes/resources/threads/client/requests/ListThreadsRequest.d.mts +1 -0
  106. package/dist/esm/api/resources/index.d.mts +3 -0
  107. package/dist/esm/api/resources/index.mjs +3 -0
  108. package/dist/esm/api/resources/lists/client/Client.d.mts +65 -0
  109. package/dist/esm/api/resources/lists/client/Client.mjs +270 -0
  110. package/dist/esm/api/resources/lists/client/index.d.mts +1 -0
  111. package/dist/esm/api/resources/lists/client/index.mjs +1 -0
  112. package/dist/esm/api/resources/lists/client/requests/ListListEntriesRequest.d.mts +9 -0
  113. package/dist/esm/api/resources/lists/client/requests/ListListEntriesRequest.mjs +2 -0
  114. package/dist/esm/api/resources/lists/client/requests/index.d.mts +1 -0
  115. package/dist/esm/api/resources/lists/client/requests/index.mjs +1 -0
  116. package/dist/esm/api/resources/lists/index.d.mts +2 -0
  117. package/dist/esm/api/resources/lists/index.mjs +2 -0
  118. package/dist/esm/api/resources/lists/types/CreateListEntryRequest.d.mts +6 -0
  119. package/dist/esm/api/resources/lists/types/CreateListEntryRequest.mjs +2 -0
  120. package/dist/esm/api/resources/lists/types/Direction.d.mts +6 -0
  121. package/dist/esm/api/resources/lists/types/Direction.mjs +6 -0
  122. package/dist/esm/api/resources/lists/types/EntryType.d.mts +6 -0
  123. package/dist/esm/api/resources/lists/types/EntryType.mjs +6 -0
  124. package/dist/esm/api/resources/lists/types/ListEntry.d.mts +3 -0
  125. package/dist/esm/api/resources/lists/types/ListEntry.mjs +2 -0
  126. package/dist/esm/api/resources/lists/types/ListEntryBase.d.mts +13 -0
  127. package/dist/esm/api/resources/lists/types/ListEntryBase.mjs +2 -0
  128. package/dist/esm/api/resources/lists/types/ListListEntriesResponse.d.mts +8 -0
  129. package/dist/esm/api/resources/lists/types/ListListEntriesResponse.mjs +2 -0
  130. package/dist/esm/api/resources/lists/types/ListType.d.mts +6 -0
  131. package/dist/esm/api/resources/lists/types/ListType.mjs +6 -0
  132. package/dist/esm/api/resources/lists/types/PodListEntry.d.mts +7 -0
  133. package/dist/esm/api/resources/lists/types/PodListEntry.mjs +2 -0
  134. package/dist/esm/api/resources/lists/types/PodListListEntriesResponse.d.mts +8 -0
  135. package/dist/esm/api/resources/lists/types/PodListListEntriesResponse.mjs +2 -0
  136. package/dist/esm/api/resources/lists/types/index.d.mts +9 -0
  137. package/dist/esm/api/resources/lists/types/index.mjs +9 -0
  138. package/dist/esm/api/resources/pods/client/Client.d.mts +3 -0
  139. package/dist/esm/api/resources/pods/client/Client.mjs +5 -0
  140. package/dist/esm/api/resources/pods/resources/index.d.mts +2 -0
  141. package/dist/esm/api/resources/pods/resources/index.mjs +2 -0
  142. package/dist/esm/api/resources/pods/resources/lists/client/Client.d.mts +69 -0
  143. package/dist/esm/api/resources/pods/resources/lists/client/Client.mjs +274 -0
  144. package/dist/esm/api/resources/pods/resources/lists/client/index.d.mts +1 -0
  145. package/dist/esm/api/resources/pods/resources/lists/client/index.mjs +1 -0
  146. package/dist/esm/api/resources/pods/resources/lists/client/requests/ListListEntriesRequest.d.mts +9 -0
  147. package/dist/esm/api/resources/pods/resources/lists/client/requests/ListListEntriesRequest.mjs +2 -0
  148. package/dist/esm/api/resources/pods/resources/lists/client/requests/index.d.mts +1 -0
  149. package/dist/esm/api/resources/pods/resources/lists/client/requests/index.mjs +1 -0
  150. package/dist/esm/api/resources/pods/resources/lists/index.d.mts +1 -0
  151. package/dist/esm/api/resources/pods/resources/lists/index.mjs +1 -0
  152. package/dist/esm/api/resources/pods/resources/threads/client/Client.mjs +2 -1
  153. package/dist/esm/api/resources/pods/resources/threads/client/requests/ListThreadsRequest.d.mts +1 -0
  154. package/dist/esm/api/resources/threads/client/Client.mjs +2 -1
  155. package/dist/esm/api/resources/threads/client/requests/ListThreadsRequest.d.mts +1 -0
  156. package/dist/esm/api/types/IncludeBlocked.d.mts +4 -0
  157. package/dist/esm/api/types/IncludeBlocked.mjs +2 -0
  158. package/dist/esm/api/types/index.d.mts +1 -0
  159. package/dist/esm/api/types/index.mjs +1 -0
  160. package/dist/esm/serialization/resources/index.d.mts +2 -0
  161. package/dist/esm/serialization/resources/index.mjs +2 -0
  162. package/dist/esm/serialization/resources/lists/index.d.mts +1 -0
  163. package/dist/esm/serialization/resources/lists/index.mjs +1 -0
  164. package/dist/esm/serialization/resources/lists/types/CreateListEntryRequest.d.mts +10 -0
  165. package/dist/esm/serialization/resources/lists/types/CreateListEntryRequest.mjs +6 -0
  166. package/dist/esm/serialization/resources/lists/types/Direction.d.mts +7 -0
  167. package/dist/esm/serialization/resources/lists/types/Direction.mjs +3 -0
  168. package/dist/esm/serialization/resources/lists/types/EntryType.d.mts +7 -0
  169. package/dist/esm/serialization/resources/lists/types/EntryType.mjs +3 -0
  170. package/dist/esm/serialization/resources/lists/types/ListEntry.d.mts +9 -0
  171. package/dist/esm/serialization/resources/lists/types/ListEntry.mjs +4 -0
  172. package/dist/esm/serialization/resources/lists/types/ListEntryBase.d.mts +19 -0
  173. package/dist/esm/serialization/resources/lists/types/ListEntryBase.mjs +15 -0
  174. package/dist/esm/serialization/resources/lists/types/ListListEntriesResponse.d.mts +16 -0
  175. package/dist/esm/serialization/resources/lists/types/ListListEntriesResponse.mjs +12 -0
  176. package/dist/esm/serialization/resources/lists/types/ListType.d.mts +7 -0
  177. package/dist/esm/serialization/resources/lists/types/ListType.mjs +3 -0
  178. package/dist/esm/serialization/resources/lists/types/PodListEntry.d.mts +11 -0
  179. package/dist/esm/serialization/resources/lists/types/PodListEntry.mjs +9 -0
  180. package/dist/esm/serialization/resources/lists/types/PodListListEntriesResponse.d.mts +16 -0
  181. package/dist/esm/serialization/resources/lists/types/PodListListEntriesResponse.mjs +12 -0
  182. package/dist/esm/serialization/resources/lists/types/index.d.mts +9 -0
  183. package/dist/esm/serialization/resources/lists/types/index.mjs +9 -0
  184. package/dist/esm/serialization/types/IncludeBlocked.d.mts +7 -0
  185. package/dist/esm/serialization/types/IncludeBlocked.mjs +3 -0
  186. package/dist/esm/serialization/types/index.d.mts +1 -0
  187. package/dist/esm/serialization/types/index.mjs +1 -0
  188. package/dist/esm/version.d.mts +1 -1
  189. package/dist/esm/version.mjs +1 -1
  190. package/dist/esm/wrapper/Client.d.mts +4 -4
  191. package/dist/esm/wrapper/Client.mjs +7 -7
  192. package/dist/esm/wrapper/mppx.d.mts +8 -0
  193. package/dist/esm/wrapper/{mpp.mjs → mppx.mjs} +4 -4
  194. package/dist/{cjs/wrapper/probe402.d.ts → esm/wrapper/util.d.mts} +1 -0
  195. package/dist/esm/wrapper/{probe402.mjs → util.mjs} +4 -1
  196. package/dist/esm/wrapper/x402.mjs +1 -1
  197. package/dist/llms-full.txt +5436 -3440
  198. package/dist/llms.txt +15 -1
  199. package/package.json +1 -1
  200. package/reference.md +558 -0
  201. package/dist/cjs/wrapper/mpp.d.ts +0 -2
  202. package/dist/esm/wrapper/mpp.d.mts +0 -2
@@ -0,0 +1,9 @@
1
+ export * from "./CreateListEntryRequest.mjs";
2
+ export * from "./Direction.mjs";
3
+ export * from "./EntryType.mjs";
4
+ export * from "./ListEntry.mjs";
5
+ export * from "./ListEntryBase.mjs";
6
+ export * from "./ListListEntriesResponse.mjs";
7
+ export * from "./ListType.mjs";
8
+ export * from "./PodListEntry.mjs";
9
+ export * from "./PodListListEntriesResponse.mjs";
@@ -0,0 +1,9 @@
1
+ export * from "./CreateListEntryRequest.mjs";
2
+ export * from "./Direction.mjs";
3
+ export * from "./EntryType.mjs";
4
+ export * from "./ListEntry.mjs";
5
+ export * from "./ListEntryBase.mjs";
6
+ export * from "./ListListEntriesResponse.mjs";
7
+ export * from "./ListType.mjs";
8
+ export * from "./PodListEntry.mjs";
9
+ export * from "./PodListListEntriesResponse.mjs";
@@ -0,0 +1,7 @@
1
+ import type * as AgentMail from "../../api/index.mjs";
2
+ import * as core from "../../core/index.mjs";
3
+ import type * as serializers from "../index.mjs";
4
+ export declare const IncludeBlocked: core.serialization.Schema<serializers.IncludeBlocked.Raw, AgentMail.IncludeBlocked>;
5
+ export declare namespace IncludeBlocked {
6
+ type Raw = boolean;
7
+ }
@@ -0,0 +1,3 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ import * as core from "../../core/index.mjs";
3
+ export const IncludeBlocked = core.serialization.boolean();
@@ -5,6 +5,7 @@ export * from "./Count.mjs";
5
5
  export * from "./ErrorMessage.mjs";
6
6
  export * from "./ErrorName.mjs";
7
7
  export * from "./ErrorResponse.mjs";
8
+ export * from "./IncludeBlocked.mjs";
8
9
  export * from "./IncludeSpam.mjs";
9
10
  export * from "./Labels.mjs";
10
11
  export * from "./Limit.mjs";
@@ -5,6 +5,7 @@ export * from "./Count.mjs";
5
5
  export * from "./ErrorMessage.mjs";
6
6
  export * from "./ErrorName.mjs";
7
7
  export * from "./ErrorResponse.mjs";
8
+ export * from "./IncludeBlocked.mjs";
8
9
  export * from "./IncludeSpam.mjs";
9
10
  export * from "./Labels.mjs";
10
11
  export * from "./Limit.mjs";
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.3.2";
1
+ export declare const SDK_VERSION = "0.3.4";
@@ -1 +1 @@
1
- export const SDK_VERSION = "0.3.2";
1
+ export const SDK_VERSION = "0.3.4";
@@ -1,22 +1,22 @@
1
1
  import type { x402Client } from "@x402/fetch";
2
- import type { Mppx } from "mppx/client";
3
2
  import { Supplier } from "../core/index.mjs";
4
3
  import { AgentMailClient as FernAgentMailClient } from "../Client.mjs";
5
4
  import { WebsocketsClient } from "./WebsocketsClient.mjs";
5
+ import { type MppxClient } from "./mppx.mjs";
6
6
  type SharedOptions = Omit<FernAgentMailClient.Options, "apiKey">;
7
7
  export declare namespace AgentMailClient {
8
8
  type Options = SharedOptions & ({
9
9
  x402: x402Client;
10
- mpp?: never;
10
+ mppx?: never;
11
11
  apiKey?: never;
12
12
  } | {
13
- mpp: Mppx.Mppx;
13
+ mppx: MppxClient;
14
14
  x402?: never;
15
15
  apiKey?: never;
16
16
  } | {
17
17
  apiKey?: Supplier<string>;
18
18
  x402?: never;
19
- mpp?: never;
19
+ mppx?: never;
20
20
  });
21
21
  type RequestOptions = FernAgentMailClient.RequestOptions;
22
22
  }
@@ -24,7 +24,7 @@ import { AgentMailEnvironment } from "../environments.mjs";
24
24
  import { AgentMailClient as FernAgentMailClient } from "../Client.mjs";
25
25
  import { WebsocketsClient } from "./WebsocketsClient.mjs";
26
26
  import { getPaymentCredentials as getX402Credentials } from "./x402.mjs";
27
- import { getPaymentCredentials as getMppCredentials } from "./mpp.mjs";
27
+ import { getPaymentCredentials as getMppCredentials } from "./mppx.mjs";
28
28
  export class AgentMailClient extends FernAgentMailClient {
29
29
  get websockets() {
30
30
  var _a;
@@ -36,8 +36,8 @@ export class AgentMailClient extends FernAgentMailClient {
36
36
  let wrappedFetch;
37
37
  const fernOptions = Object.assign(Object.assign({}, rest), { authProvider: new NoOpAuthProvider(), fetch: (input, init) => __awaiter(this, void 0, void 0, function* () {
38
38
  if (!wrappedFetch) {
39
- const mod = yield import("@x402/fetch");
40
- wrappedFetch = mod.wrapFetchWithPayment(fetch, x402);
39
+ const { wrapFetchWithPayment } = yield import("@x402/fetch");
40
+ wrappedFetch = wrapFetchWithPayment(fetch, x402);
41
41
  }
42
42
  return wrappedFetch(input, init);
43
43
  }) });
@@ -47,14 +47,14 @@ export class AgentMailClient extends FernAgentMailClient {
47
47
  super(fernOptions);
48
48
  this._getPaymentCredentials = (wsUrl) => getX402Credentials(wsUrl, x402);
49
49
  }
50
- else if (options.mpp) {
51
- const { mpp } = options, rest = __rest(options, ["mpp"]);
52
- const fernOptions = Object.assign(Object.assign({}, rest), { authProvider: new NoOpAuthProvider(), fetch: mpp.fetch });
50
+ else if (options.mppx) {
51
+ const { mppx } = options, rest = __rest(options, ["mppx"]);
52
+ const fernOptions = Object.assign(Object.assign({}, rest), { authProvider: new NoOpAuthProvider(), fetch: mppx.fetch });
53
53
  if (!fernOptions.environment && !fernOptions.baseUrl) {
54
54
  fernOptions.environment = AgentMailEnvironment.ProdMpp;
55
55
  }
56
56
  super(fernOptions);
57
- this._getPaymentCredentials = (wsUrl) => getMppCredentials(wsUrl, mpp);
57
+ this._getPaymentCredentials = (wsUrl) => getMppCredentials(wsUrl, mppx);
58
58
  }
59
59
  else {
60
60
  let fernOptions = options;
@@ -0,0 +1,8 @@
1
+ export interface MppxClient {
2
+ fetch: typeof globalThis.fetch;
3
+ transport: {
4
+ setCredential(request: Request, credential: string): Request;
5
+ };
6
+ createCredential(response: Response): Promise<string>;
7
+ }
8
+ export declare function getPaymentCredentials(wsUrl: string, mppx: MppxClient): Promise<Record<string, string>>;
@@ -7,12 +7,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
- import { probe402 } from "./probe402.mjs";
11
- export function getPaymentCredentials(wsUrl, mpp) {
10
+ import { probe402, wsToHttp } from "./util.mjs";
11
+ export function getPaymentCredentials(wsUrl, mppx) {
12
12
  return __awaiter(this, void 0, void 0, function* () {
13
13
  const response = yield probe402(wsUrl);
14
- const credential = yield mpp.createCredential(response);
15
- const signed = mpp.transport.setCredential(new Request(wsUrl), credential);
14
+ const credential = yield mppx.createCredential(response);
15
+ const signed = mppx.transport.setCredential(new Request(wsToHttp(wsUrl)), credential);
16
16
  const headers = {};
17
17
  signed.headers.forEach((value, key) => {
18
18
  headers[key] = value;
@@ -1 +1,2 @@
1
+ export declare function wsToHttp(wsUrl: string): string;
1
2
  export declare function probe402(wsUrl: string): Promise<Response>;
@@ -7,9 +7,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
+ export function wsToHttp(wsUrl) {
11
+ return wsUrl.replace(/^wss:\/\//, "https://").replace(/^ws:\/\//, "http://");
12
+ }
10
13
  export function probe402(wsUrl) {
11
14
  return __awaiter(this, void 0, void 0, function* () {
12
- const httpUrl = wsUrl.replace(/^wss:\/\//, "https://").replace(/^ws:\/\//, "http://");
15
+ const httpUrl = wsToHttp(wsUrl);
13
16
  const response = yield fetch(httpUrl);
14
17
  if (response.status !== 402) {
15
18
  throw new Error(`Expected 402 from ${httpUrl} but got ${response.status}`);
@@ -7,7 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
- import { probe402 } from "./probe402.mjs";
10
+ import { probe402 } from "./util.mjs";
11
11
  export function getPaymentCredentials(wsUrl, client) {
12
12
  return __awaiter(this, void 0, void 0, function* () {
13
13
  const { x402HTTPClient } = yield import("@x402/fetch");