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.
- package/dist/cjs/BaseClient.js +2 -2
- package/dist/cjs/Client.d.ts +3 -0
- package/dist/cjs/Client.js +17 -12
- package/dist/cjs/api/resources/inboxes/resources/messages/client/Client.js +2 -1
- package/dist/cjs/api/resources/inboxes/resources/messages/client/requests/ListMessagesRequest.d.ts +1 -0
- package/dist/cjs/api/resources/inboxes/resources/threads/client/Client.js +2 -1
- package/dist/cjs/api/resources/inboxes/resources/threads/client/requests/ListThreadsRequest.d.ts +1 -0
- package/dist/cjs/api/resources/index.d.ts +3 -0
- package/dist/cjs/api/resources/index.js +4 -1
- package/dist/cjs/api/resources/lists/client/Client.d.ts +65 -0
- package/dist/cjs/api/resources/lists/client/Client.js +307 -0
- package/dist/cjs/api/resources/lists/client/index.d.ts +1 -0
- package/dist/cjs/api/resources/lists/client/index.js +17 -0
- package/dist/cjs/api/resources/lists/client/requests/ListListEntriesRequest.d.ts +9 -0
- package/dist/cjs/api/resources/lists/client/requests/ListListEntriesRequest.js +3 -0
- package/dist/cjs/api/resources/lists/client/requests/index.d.ts +1 -0
- package/dist/cjs/api/resources/lists/client/requests/index.js +2 -0
- package/dist/cjs/api/resources/lists/index.d.ts +2 -0
- package/dist/cjs/api/resources/lists/index.js +18 -0
- package/dist/cjs/api/resources/lists/types/CreateListEntryRequest.d.ts +6 -0
- package/dist/cjs/api/resources/lists/types/CreateListEntryRequest.js +3 -0
- package/dist/cjs/api/resources/lists/types/Direction.d.ts +6 -0
- package/dist/cjs/api/resources/lists/types/Direction.js +9 -0
- package/dist/cjs/api/resources/lists/types/EntryType.d.ts +6 -0
- package/dist/cjs/api/resources/lists/types/EntryType.js +9 -0
- package/dist/cjs/api/resources/lists/types/ListEntry.d.ts +3 -0
- package/dist/cjs/api/resources/lists/types/ListEntry.js +3 -0
- package/dist/cjs/api/resources/lists/types/ListEntryBase.d.ts +13 -0
- package/dist/cjs/api/resources/lists/types/ListEntryBase.js +3 -0
- package/dist/cjs/api/resources/lists/types/ListListEntriesResponse.d.ts +8 -0
- package/dist/cjs/api/resources/lists/types/ListListEntriesResponse.js +3 -0
- package/dist/cjs/api/resources/lists/types/ListType.d.ts +6 -0
- package/dist/cjs/api/resources/lists/types/ListType.js +9 -0
- package/dist/cjs/api/resources/lists/types/PodListEntry.d.ts +7 -0
- package/dist/cjs/api/resources/lists/types/PodListEntry.js +3 -0
- package/dist/cjs/api/resources/lists/types/PodListListEntriesResponse.d.ts +8 -0
- package/dist/cjs/api/resources/lists/types/PodListListEntriesResponse.js +3 -0
- package/dist/cjs/api/resources/lists/types/index.d.ts +9 -0
- package/dist/cjs/api/resources/lists/types/index.js +25 -0
- package/dist/cjs/api/resources/pods/client/Client.d.ts +3 -0
- package/dist/cjs/api/resources/pods/client/Client.js +7 -2
- package/dist/cjs/api/resources/pods/resources/index.d.ts +2 -0
- package/dist/cjs/api/resources/pods/resources/index.js +3 -1
- package/dist/cjs/api/resources/pods/resources/lists/client/Client.d.ts +69 -0
- package/dist/cjs/api/resources/pods/resources/lists/client/Client.js +311 -0
- package/dist/cjs/api/resources/pods/resources/lists/client/index.d.ts +1 -0
- package/dist/cjs/api/resources/pods/resources/lists/client/index.js +17 -0
- package/dist/cjs/api/resources/pods/resources/lists/client/requests/ListListEntriesRequest.d.ts +9 -0
- package/dist/cjs/api/resources/pods/resources/lists/client/requests/ListListEntriesRequest.js +3 -0
- package/dist/cjs/api/resources/pods/resources/lists/client/requests/index.d.ts +1 -0
- package/dist/cjs/api/resources/pods/resources/lists/client/requests/index.js +2 -0
- package/dist/cjs/api/resources/pods/resources/lists/index.d.ts +1 -0
- package/dist/cjs/api/resources/pods/resources/lists/index.js +17 -0
- package/dist/cjs/api/resources/pods/resources/threads/client/Client.js +2 -1
- package/dist/cjs/api/resources/pods/resources/threads/client/requests/ListThreadsRequest.d.ts +1 -0
- package/dist/cjs/api/resources/threads/client/Client.js +2 -1
- package/dist/cjs/api/resources/threads/client/requests/ListThreadsRequest.d.ts +1 -0
- package/dist/cjs/api/types/IncludeBlocked.d.ts +4 -0
- package/dist/cjs/api/types/IncludeBlocked.js +3 -0
- package/dist/cjs/api/types/index.d.ts +1 -0
- package/dist/cjs/api/types/index.js +1 -0
- package/dist/cjs/serialization/resources/index.d.ts +2 -0
- package/dist/cjs/serialization/resources/index.js +3 -1
- package/dist/cjs/serialization/resources/lists/index.d.ts +1 -0
- package/dist/cjs/serialization/resources/lists/index.js +17 -0
- package/dist/cjs/serialization/resources/lists/types/CreateListEntryRequest.d.ts +10 -0
- package/dist/cjs/serialization/resources/lists/types/CreateListEntryRequest.js +42 -0
- package/dist/cjs/serialization/resources/lists/types/Direction.d.ts +7 -0
- package/dist/cjs/serialization/resources/lists/types/Direction.js +39 -0
- package/dist/cjs/serialization/resources/lists/types/EntryType.d.ts +7 -0
- package/dist/cjs/serialization/resources/lists/types/EntryType.js +39 -0
- package/dist/cjs/serialization/resources/lists/types/ListEntry.d.ts +9 -0
- package/dist/cjs/serialization/resources/lists/types/ListEntry.js +40 -0
- package/dist/cjs/serialization/resources/lists/types/ListEntryBase.d.ts +19 -0
- package/dist/cjs/serialization/resources/lists/types/ListEntryBase.js +51 -0
- package/dist/cjs/serialization/resources/lists/types/ListListEntriesResponse.d.ts +16 -0
- package/dist/cjs/serialization/resources/lists/types/ListListEntriesResponse.js +48 -0
- package/dist/cjs/serialization/resources/lists/types/ListType.d.ts +7 -0
- package/dist/cjs/serialization/resources/lists/types/ListType.js +39 -0
- package/dist/cjs/serialization/resources/lists/types/PodListEntry.d.ts +11 -0
- package/dist/cjs/serialization/resources/lists/types/PodListEntry.js +45 -0
- package/dist/cjs/serialization/resources/lists/types/PodListListEntriesResponse.d.ts +16 -0
- package/dist/cjs/serialization/resources/lists/types/PodListListEntriesResponse.js +48 -0
- package/dist/cjs/serialization/resources/lists/types/index.d.ts +9 -0
- package/dist/cjs/serialization/resources/lists/types/index.js +25 -0
- package/dist/cjs/serialization/types/IncludeBlocked.d.ts +7 -0
- package/dist/cjs/serialization/types/IncludeBlocked.js +39 -0
- package/dist/cjs/serialization/types/index.d.ts +1 -0
- package/dist/cjs/serialization/types/index.js +1 -0
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/wrapper/Client.d.ts +4 -4
- package/dist/cjs/wrapper/Client.js +7 -7
- package/dist/cjs/wrapper/mppx.d.ts +8 -0
- package/dist/cjs/wrapper/{mpp.js → mppx.js} +5 -5
- package/dist/{esm/wrapper/probe402.d.mts → cjs/wrapper/util.d.ts} +1 -0
- package/dist/cjs/wrapper/{probe402.js → util.js} +5 -1
- package/dist/cjs/wrapper/x402.js +2 -2
- package/dist/esm/BaseClient.mjs +2 -2
- package/dist/esm/Client.d.mts +3 -0
- package/dist/esm/Client.mjs +5 -0
- package/dist/esm/api/resources/inboxes/resources/messages/client/Client.mjs +2 -1
- package/dist/esm/api/resources/inboxes/resources/messages/client/requests/ListMessagesRequest.d.mts +1 -0
- package/dist/esm/api/resources/inboxes/resources/threads/client/Client.mjs +2 -1
- package/dist/esm/api/resources/inboxes/resources/threads/client/requests/ListThreadsRequest.d.mts +1 -0
- package/dist/esm/api/resources/index.d.mts +3 -0
- package/dist/esm/api/resources/index.mjs +3 -0
- package/dist/esm/api/resources/lists/client/Client.d.mts +65 -0
- package/dist/esm/api/resources/lists/client/Client.mjs +270 -0
- package/dist/esm/api/resources/lists/client/index.d.mts +1 -0
- package/dist/esm/api/resources/lists/client/index.mjs +1 -0
- package/dist/esm/api/resources/lists/client/requests/ListListEntriesRequest.d.mts +9 -0
- package/dist/esm/api/resources/lists/client/requests/ListListEntriesRequest.mjs +2 -0
- package/dist/esm/api/resources/lists/client/requests/index.d.mts +1 -0
- package/dist/esm/api/resources/lists/client/requests/index.mjs +1 -0
- package/dist/esm/api/resources/lists/index.d.mts +2 -0
- package/dist/esm/api/resources/lists/index.mjs +2 -0
- package/dist/esm/api/resources/lists/types/CreateListEntryRequest.d.mts +6 -0
- package/dist/esm/api/resources/lists/types/CreateListEntryRequest.mjs +2 -0
- package/dist/esm/api/resources/lists/types/Direction.d.mts +6 -0
- package/dist/esm/api/resources/lists/types/Direction.mjs +6 -0
- package/dist/esm/api/resources/lists/types/EntryType.d.mts +6 -0
- package/dist/esm/api/resources/lists/types/EntryType.mjs +6 -0
- package/dist/esm/api/resources/lists/types/ListEntry.d.mts +3 -0
- package/dist/esm/api/resources/lists/types/ListEntry.mjs +2 -0
- package/dist/esm/api/resources/lists/types/ListEntryBase.d.mts +13 -0
- package/dist/esm/api/resources/lists/types/ListEntryBase.mjs +2 -0
- package/dist/esm/api/resources/lists/types/ListListEntriesResponse.d.mts +8 -0
- package/dist/esm/api/resources/lists/types/ListListEntriesResponse.mjs +2 -0
- package/dist/esm/api/resources/lists/types/ListType.d.mts +6 -0
- package/dist/esm/api/resources/lists/types/ListType.mjs +6 -0
- package/dist/esm/api/resources/lists/types/PodListEntry.d.mts +7 -0
- package/dist/esm/api/resources/lists/types/PodListEntry.mjs +2 -0
- package/dist/esm/api/resources/lists/types/PodListListEntriesResponse.d.mts +8 -0
- package/dist/esm/api/resources/lists/types/PodListListEntriesResponse.mjs +2 -0
- package/dist/esm/api/resources/lists/types/index.d.mts +9 -0
- package/dist/esm/api/resources/lists/types/index.mjs +9 -0
- package/dist/esm/api/resources/pods/client/Client.d.mts +3 -0
- package/dist/esm/api/resources/pods/client/Client.mjs +5 -0
- package/dist/esm/api/resources/pods/resources/index.d.mts +2 -0
- package/dist/esm/api/resources/pods/resources/index.mjs +2 -0
- package/dist/esm/api/resources/pods/resources/lists/client/Client.d.mts +69 -0
- package/dist/esm/api/resources/pods/resources/lists/client/Client.mjs +274 -0
- package/dist/esm/api/resources/pods/resources/lists/client/index.d.mts +1 -0
- package/dist/esm/api/resources/pods/resources/lists/client/index.mjs +1 -0
- package/dist/esm/api/resources/pods/resources/lists/client/requests/ListListEntriesRequest.d.mts +9 -0
- package/dist/esm/api/resources/pods/resources/lists/client/requests/ListListEntriesRequest.mjs +2 -0
- package/dist/esm/api/resources/pods/resources/lists/client/requests/index.d.mts +1 -0
- package/dist/esm/api/resources/pods/resources/lists/client/requests/index.mjs +1 -0
- package/dist/esm/api/resources/pods/resources/lists/index.d.mts +1 -0
- package/dist/esm/api/resources/pods/resources/lists/index.mjs +1 -0
- package/dist/esm/api/resources/pods/resources/threads/client/Client.mjs +2 -1
- package/dist/esm/api/resources/pods/resources/threads/client/requests/ListThreadsRequest.d.mts +1 -0
- package/dist/esm/api/resources/threads/client/Client.mjs +2 -1
- package/dist/esm/api/resources/threads/client/requests/ListThreadsRequest.d.mts +1 -0
- package/dist/esm/api/types/IncludeBlocked.d.mts +4 -0
- package/dist/esm/api/types/IncludeBlocked.mjs +2 -0
- package/dist/esm/api/types/index.d.mts +1 -0
- package/dist/esm/api/types/index.mjs +1 -0
- package/dist/esm/serialization/resources/index.d.mts +2 -0
- package/dist/esm/serialization/resources/index.mjs +2 -0
- package/dist/esm/serialization/resources/lists/index.d.mts +1 -0
- package/dist/esm/serialization/resources/lists/index.mjs +1 -0
- package/dist/esm/serialization/resources/lists/types/CreateListEntryRequest.d.mts +10 -0
- package/dist/esm/serialization/resources/lists/types/CreateListEntryRequest.mjs +6 -0
- package/dist/esm/serialization/resources/lists/types/Direction.d.mts +7 -0
- package/dist/esm/serialization/resources/lists/types/Direction.mjs +3 -0
- package/dist/esm/serialization/resources/lists/types/EntryType.d.mts +7 -0
- package/dist/esm/serialization/resources/lists/types/EntryType.mjs +3 -0
- package/dist/esm/serialization/resources/lists/types/ListEntry.d.mts +9 -0
- package/dist/esm/serialization/resources/lists/types/ListEntry.mjs +4 -0
- package/dist/esm/serialization/resources/lists/types/ListEntryBase.d.mts +19 -0
- package/dist/esm/serialization/resources/lists/types/ListEntryBase.mjs +15 -0
- package/dist/esm/serialization/resources/lists/types/ListListEntriesResponse.d.mts +16 -0
- package/dist/esm/serialization/resources/lists/types/ListListEntriesResponse.mjs +12 -0
- package/dist/esm/serialization/resources/lists/types/ListType.d.mts +7 -0
- package/dist/esm/serialization/resources/lists/types/ListType.mjs +3 -0
- package/dist/esm/serialization/resources/lists/types/PodListEntry.d.mts +11 -0
- package/dist/esm/serialization/resources/lists/types/PodListEntry.mjs +9 -0
- package/dist/esm/serialization/resources/lists/types/PodListListEntriesResponse.d.mts +16 -0
- package/dist/esm/serialization/resources/lists/types/PodListListEntriesResponse.mjs +12 -0
- package/dist/esm/serialization/resources/lists/types/index.d.mts +9 -0
- package/dist/esm/serialization/resources/lists/types/index.mjs +9 -0
- package/dist/esm/serialization/types/IncludeBlocked.d.mts +7 -0
- package/dist/esm/serialization/types/IncludeBlocked.mjs +3 -0
- package/dist/esm/serialization/types/index.d.mts +1 -0
- package/dist/esm/serialization/types/index.mjs +1 -0
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/dist/esm/wrapper/Client.d.mts +4 -4
- package/dist/esm/wrapper/Client.mjs +7 -7
- package/dist/esm/wrapper/mppx.d.mts +8 -0
- package/dist/esm/wrapper/{mpp.mjs → mppx.mjs} +4 -4
- package/dist/{cjs/wrapper/probe402.d.ts → esm/wrapper/util.d.mts} +1 -0
- package/dist/esm/wrapper/{probe402.mjs → util.mjs} +4 -1
- package/dist/esm/wrapper/x402.mjs +1 -1
- package/dist/llms-full.txt +5436 -3440
- package/dist/llms.txt +15 -1
- package/package.json +1 -1
- package/reference.md +558 -0
- package/dist/cjs/wrapper/mpp.d.ts +0 -2
- 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
|
+
}
|
|
@@ -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";
|
package/dist/esm/version.d.mts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.3.
|
|
1
|
+
export declare const SDK_VERSION = "0.3.4";
|
package/dist/esm/version.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "0.3.
|
|
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
|
-
|
|
10
|
+
mppx?: never;
|
|
11
11
|
apiKey?: never;
|
|
12
12
|
} | {
|
|
13
|
-
|
|
13
|
+
mppx: MppxClient;
|
|
14
14
|
x402?: never;
|
|
15
15
|
apiKey?: never;
|
|
16
16
|
} | {
|
|
17
17
|
apiKey?: Supplier<string>;
|
|
18
18
|
x402?: never;
|
|
19
|
-
|
|
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 "./
|
|
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
|
|
40
|
-
wrappedFetch =
|
|
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.
|
|
51
|
-
const {
|
|
52
|
-
const fernOptions = Object.assign(Object.assign({}, rest), { authProvider: new NoOpAuthProvider(), 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,
|
|
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 "./
|
|
11
|
-
export function getPaymentCredentials(wsUrl,
|
|
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
|
|
15
|
-
const signed =
|
|
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;
|
|
@@ -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
|
|
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 "./
|
|
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");
|