@mercuryo-ai/magicpay-sdk 0.1.0-test.2
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/LICENSE.md +56 -0
- package/README.md +426 -0
- package/dist/agentbrowse.d.ts +66 -0
- package/dist/agentbrowse.d.ts.map +1 -0
- package/dist/agentbrowse.js +174 -0
- package/dist/client.d.ts +50 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +61 -0
- package/dist/core.d.ts +7 -0
- package/dist/core.d.ts.map +1 -0
- package/dist/core.js +3 -0
- package/dist/gateway.d.ts +67 -0
- package/dist/gateway.d.ts.map +1 -0
- package/dist/gateway.js +271 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/request-flow.d.ts +37 -0
- package/dist/request-flow.d.ts.map +1 -0
- package/dist/request-flow.js +70 -0
- package/dist/secret-flow.d.ts +228 -0
- package/dist/secret-flow.d.ts.map +1 -0
- package/dist/secret-flow.js +536 -0
- package/dist/session-client.d.ts +305 -0
- package/dist/session-client.d.ts.map +1 -0
- package/dist/session-client.js +82 -0
- package/dist/session-flow.d.ts +42 -0
- package/dist/session-flow.d.ts.map +1 -0
- package/dist/session-flow.js +71 -0
- package/docs/examples.md +432 -0
- package/package.json +94 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACpB,uBAAuB,EACvB,4BAA4B,GAC7B,MAAM,cAAc,CAAC;AACtB,YAAY,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAE1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACnD,YAAY,EACV,cAAc,EACd,4BAA4B,EAC5B,qBAAqB,EACrB,wBAAwB,GACzB,MAAM,aAAa,CAAC;AAErB,YAAY,EACV,kBAAkB,EAClB,YAAY,EACZ,oBAAoB,EACpB,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,mBAAmB,CAAC;AAE3B,YAAY,EACV,gCAAgC,EAChC,4BAA4B,EAC5B,wBAAwB,GACzB,MAAM,mBAAmB,CAAC;AAE3B,YAAY,EACV,0BAA0B,EAC1B,6BAA6B,EAC7B,wBAAwB,EACxB,eAAe,GAChB,MAAM,qBAAqB,CAAC;AAE7B,YAAY,EACV,wBAAwB,EACxB,yBAAyB,EACzB,yBAAyB,EACzB,wBAAwB,EACxB,oBAAoB,EACpB,aAAa,EACb,mBAAmB,EACnB,sBAAsB,EACtB,wBAAwB,EACxB,iBAAiB,EACjB,sBAAsB,EACtB,4BAA4B,EAC5B,wBAAwB,EACxB,uBAAuB,EACvB,iCAAiC,EACjC,6BAA6B,EAC7B,6BAA6B,EAC7B,oBAAoB,EACpB,qBAAqB,EACrB,mBAAmB,EACnB,2BAA2B,EAC3B,iBAAiB,EACjB,yBAAyB,EACzB,+BAA+B,EAC/B,oBAAoB,EACpB,yBAAyB,EACzB,gBAAgB,EAChB,oBAAoB,EACpB,iBAAiB,GAClB,MAAM,kBAAkB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { SessionResponse, SessionBackendCurrentRequest, SessionBackendRequest, SessionBackendSession } from './session-client.js';
|
|
2
|
+
export type SessionRequestType = SessionBackendCurrentRequest['type'];
|
|
3
|
+
export type SessionRequestStatus = SessionBackendCurrentRequest['status'];
|
|
4
|
+
export type SessionRequestDomain = 'secret' | 'payment' | 'approval' | 'captcha' | 'alert';
|
|
5
|
+
export type SessionPhase = 'active' | 'waiting_for_user' | 'terminal';
|
|
6
|
+
export type SessionRequestLike = Pick<SessionBackendCurrentRequest, 'id' | 'type' | 'status' | 'blocking' | 'title' | 'summary' | 'expires_at'> & Partial<Pick<SessionBackendRequest, 'payload' | 'response_payload' | 'resolved_at'>>;
|
|
7
|
+
export interface SessionRequestState {
|
|
8
|
+
id: string;
|
|
9
|
+
type: SessionRequestType;
|
|
10
|
+
domain: SessionRequestDomain;
|
|
11
|
+
status: SessionRequestStatus;
|
|
12
|
+
blocking: boolean;
|
|
13
|
+
title: string;
|
|
14
|
+
summary: string | null;
|
|
15
|
+
expiresAt: string | null;
|
|
16
|
+
pending: boolean;
|
|
17
|
+
terminal: boolean;
|
|
18
|
+
paymentRelated: boolean;
|
|
19
|
+
approvalRelated: boolean;
|
|
20
|
+
}
|
|
21
|
+
export interface RemoteSessionState {
|
|
22
|
+
sessionId: string;
|
|
23
|
+
sessionStatus: SessionBackendSession['status'];
|
|
24
|
+
phase: SessionPhase;
|
|
25
|
+
waitingForUser: boolean;
|
|
26
|
+
closed: boolean;
|
|
27
|
+
paymentFlowActive: boolean;
|
|
28
|
+
approvalPending: boolean;
|
|
29
|
+
activeRequest: SessionRequestState | null;
|
|
30
|
+
}
|
|
31
|
+
export declare function classifySessionRequestDomain(type: SessionRequestType): SessionRequestDomain;
|
|
32
|
+
export declare function isApprovalRequestType(type: SessionRequestType): boolean;
|
|
33
|
+
export declare function isPaymentFlowRequestType(type: SessionRequestType): boolean;
|
|
34
|
+
export declare function isSessionRequestTerminal(status: SessionRequestStatus): boolean;
|
|
35
|
+
export declare function describeSessionRequestState(request: SessionRequestLike): SessionRequestState;
|
|
36
|
+
export declare function describeRemoteSessionState(envelope: Pick<SessionResponse, 'session' | 'current_request'>): RemoteSessionState;
|
|
37
|
+
//# sourceMappingURL=request-flow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request-flow.d.ts","sourceRoot":"","sources":["../src/request-flow.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,4BAA4B,EAC5B,qBAAqB,EACrB,qBAAqB,EACtB,MAAM,qBAAqB,CAAC;AAE7B,MAAM,MAAM,kBAAkB,GAAG,4BAA4B,CAAC,MAAM,CAAC,CAAC;AACtE,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AC,IAAI,EAAE,kBAAkB,GAAG,oBAAoB,CAc3F;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAEvE;AAED,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAE1E;AAED,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAE9E;AAED,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,kBAAkB,GAAG,mBAAmB,CAiB5F;AAeD,wBAAgB,0BAA0B,CACxC,QAAQ,EAAE,IAAI,CAAC,eAAe,EAAE,SAAS,GAAG,iBAAiB,CAAC,GAC7D,kBAAkB,CAkBpB"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
export function classifySessionRequestDomain(type) {
|
|
2
|
+
switch (type) {
|
|
3
|
+
case 'secret_read':
|
|
4
|
+
case 'secret_write':
|
|
5
|
+
return 'secret';
|
|
6
|
+
case 'purchase':
|
|
7
|
+
return 'payment';
|
|
8
|
+
case 'payment_approval':
|
|
9
|
+
return 'approval';
|
|
10
|
+
case 'captcha':
|
|
11
|
+
return 'captcha';
|
|
12
|
+
case 'alert':
|
|
13
|
+
return 'alert';
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
export function isApprovalRequestType(type) {
|
|
17
|
+
return type === 'payment_approval';
|
|
18
|
+
}
|
|
19
|
+
export function isPaymentFlowRequestType(type) {
|
|
20
|
+
return type === 'purchase' || type === 'payment_approval';
|
|
21
|
+
}
|
|
22
|
+
export function isSessionRequestTerminal(status) {
|
|
23
|
+
return status !== 'pending';
|
|
24
|
+
}
|
|
25
|
+
export function describeSessionRequestState(request) {
|
|
26
|
+
const domain = classifySessionRequestDomain(request.type);
|
|
27
|
+
return {
|
|
28
|
+
id: request.id,
|
|
29
|
+
type: request.type,
|
|
30
|
+
domain,
|
|
31
|
+
status: request.status,
|
|
32
|
+
blocking: request.blocking,
|
|
33
|
+
title: request.title,
|
|
34
|
+
summary: request.summary,
|
|
35
|
+
expiresAt: request.expires_at,
|
|
36
|
+
pending: request.status === 'pending',
|
|
37
|
+
terminal: isSessionRequestTerminal(request.status),
|
|
38
|
+
paymentRelated: isPaymentFlowRequestType(request.type),
|
|
39
|
+
approvalRelated: isApprovalRequestType(request.type),
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
function classifySessionPhase(status) {
|
|
43
|
+
switch (status) {
|
|
44
|
+
case 'waiting_for_user':
|
|
45
|
+
return 'waiting_for_user';
|
|
46
|
+
case 'completed':
|
|
47
|
+
case 'canceled':
|
|
48
|
+
case 'error':
|
|
49
|
+
return 'terminal';
|
|
50
|
+
case 'in_progress':
|
|
51
|
+
return 'active';
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
export function describeRemoteSessionState(envelope) {
|
|
55
|
+
const activeRequest = envelope.current_request
|
|
56
|
+
? describeSessionRequestState(envelope.current_request)
|
|
57
|
+
: null;
|
|
58
|
+
return {
|
|
59
|
+
sessionId: envelope.session.id,
|
|
60
|
+
sessionStatus: envelope.session.status,
|
|
61
|
+
phase: classifySessionPhase(envelope.session.status),
|
|
62
|
+
waitingForUser: envelope.session.status === 'waiting_for_user',
|
|
63
|
+
closed: envelope.session.status === 'completed' ||
|
|
64
|
+
envelope.session.status === 'canceled' ||
|
|
65
|
+
envelope.session.status === 'error',
|
|
66
|
+
paymentFlowActive: activeRequest?.paymentRelated ?? false,
|
|
67
|
+
approvalPending: Boolean(activeRequest?.approvalRelated && activeRequest.pending),
|
|
68
|
+
activeRequest,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import { type ClaimRemoteSecretResponse, type CreateRemoteSecretRequestInput, type SessionBackendRequest, type SessionBackendSecretCatalogEntry } from './session-client.js';
|
|
2
|
+
import { type MagicPayRequestOptions, type MagicPayGatewayConfig } from './gateway.js';
|
|
3
|
+
export declare const LOGIN_FIELD_KEYS: readonly ["username", "password"];
|
|
4
|
+
export declare const IDENTITY_FIELD_KEYS: readonly ["full_name", "document_number", "date_of_birth", "nationality", "issue_date", "expiry_date", "issuing_country"];
|
|
5
|
+
export declare const PAYMENT_CARD_FIELD_KEYS: readonly ["cardholder", "pan", "exp_month", "exp_year", "cvv"];
|
|
6
|
+
export type StoredSecretKind = 'login' | 'identity' | 'payment_card';
|
|
7
|
+
export type LoginFieldKey = (typeof LOGIN_FIELD_KEYS)[number];
|
|
8
|
+
export type IdentityFieldKey = (typeof IDENTITY_FIELD_KEYS)[number];
|
|
9
|
+
export type PaymentCardFieldKey = (typeof PAYMENT_CARD_FIELD_KEYS)[number];
|
|
10
|
+
export type StoredSecretFieldKey = LoginFieldKey | IdentityFieldKey | PaymentCardFieldKey;
|
|
11
|
+
export type StoredSecretScope = 'site' | 'global';
|
|
12
|
+
export type ProtectedFieldPolicy = 'deterministic_only' | 'llm_assisted';
|
|
13
|
+
export declare const PROTECTED_BINDING_VALUE_HINTS: readonly ["direct", "full_name.given", "full_name.family", "date_of_birth.day", "date_of_birth.month", "date_of_birth.year"];
|
|
14
|
+
export type ProtectedBindingValueHint = (typeof PROTECTED_BINDING_VALUE_HINTS)[number];
|
|
15
|
+
export type StoredSecretApplicabilityTarget = 'host' | 'site' | 'global';
|
|
16
|
+
export type SecretRequestType = 'secret_read' | 'secret_write';
|
|
17
|
+
export type SecretRequestStatus = 'pending' | 'fulfilled' | 'denied' | 'expired' | 'failed' | 'canceled';
|
|
18
|
+
export type SecretClaimFailureKind = 'not_fulfilled' | 'already_claimed' | 'aborted' | 'other';
|
|
19
|
+
export type SecretRequestStatusContract = {
|
|
20
|
+
message: string;
|
|
21
|
+
reason: string;
|
|
22
|
+
nextAction?: string;
|
|
23
|
+
outcomeType?: 'approval_pending' | 'approval_denied' | 'request_expired';
|
|
24
|
+
};
|
|
25
|
+
export type SecretRequestContextMismatchReason = 'host' | 'scope';
|
|
26
|
+
export type SecretRequestFillReadiness = {
|
|
27
|
+
kind: 'ready';
|
|
28
|
+
} | {
|
|
29
|
+
kind: 'fill_mismatch';
|
|
30
|
+
requestFillRef: string;
|
|
31
|
+
} | {
|
|
32
|
+
kind: 'already_claimed';
|
|
33
|
+
claimedAt: string;
|
|
34
|
+
} | {
|
|
35
|
+
kind: 'not_ready';
|
|
36
|
+
statusContract: SecretRequestStatusContract;
|
|
37
|
+
} | {
|
|
38
|
+
kind: 'context_mismatch';
|
|
39
|
+
mismatchReasons: SecretRequestContextMismatchReason[];
|
|
40
|
+
expectedHost?: string;
|
|
41
|
+
observedHost?: string;
|
|
42
|
+
expectedScopeRef?: string;
|
|
43
|
+
observedScopeRef?: string;
|
|
44
|
+
};
|
|
45
|
+
export interface StoredSecretApplicability {
|
|
46
|
+
target: StoredSecretApplicabilityTarget;
|
|
47
|
+
value?: string;
|
|
48
|
+
}
|
|
49
|
+
export type StoredSecretFieldPolicies = Partial<Record<StoredSecretFieldKey, ProtectedFieldPolicy>>;
|
|
50
|
+
export interface StoredSecretMetadata {
|
|
51
|
+
storedSecretRef: string;
|
|
52
|
+
kind: StoredSecretKind;
|
|
53
|
+
scope: StoredSecretScope;
|
|
54
|
+
displayName: string;
|
|
55
|
+
fieldKeys: StoredSecretFieldKey[];
|
|
56
|
+
fieldPolicies?: StoredSecretFieldPolicies;
|
|
57
|
+
intentRequired: boolean;
|
|
58
|
+
applicability: StoredSecretApplicability;
|
|
59
|
+
preferredForMerchantKeys?: string[];
|
|
60
|
+
}
|
|
61
|
+
export interface SecretCatalog {
|
|
62
|
+
host: string;
|
|
63
|
+
syncedAt: string;
|
|
64
|
+
storedSecrets: StoredSecretMetadata[];
|
|
65
|
+
}
|
|
66
|
+
export type SecretCatalogByHost = Record<string, SecretCatalog>;
|
|
67
|
+
export interface SecretRequestSnapshot {
|
|
68
|
+
requestId: string;
|
|
69
|
+
fillRef: string;
|
|
70
|
+
requestType: SecretRequestType;
|
|
71
|
+
status: SecretRequestStatus;
|
|
72
|
+
storedSecretRef?: string;
|
|
73
|
+
kind?: StoredSecretKind;
|
|
74
|
+
host?: string;
|
|
75
|
+
pageRef?: string;
|
|
76
|
+
scopeRef?: string;
|
|
77
|
+
createdAt: string;
|
|
78
|
+
updatedAt: string;
|
|
79
|
+
expiresAt?: string;
|
|
80
|
+
resolvedAt?: string;
|
|
81
|
+
claimedAt?: string;
|
|
82
|
+
}
|
|
83
|
+
export interface SecretRequestHintField {
|
|
84
|
+
key: StoredSecretFieldKey;
|
|
85
|
+
label?: string;
|
|
86
|
+
type?: 'text' | 'secret' | 'date' | 'number';
|
|
87
|
+
required?: boolean;
|
|
88
|
+
}
|
|
89
|
+
type SecretRequestHintBase = {
|
|
90
|
+
storedSecretRef?: string;
|
|
91
|
+
credentialKey?: string;
|
|
92
|
+
credentialName?: string;
|
|
93
|
+
kind?: StoredSecretKind;
|
|
94
|
+
host?: string;
|
|
95
|
+
scopeRef?: string;
|
|
96
|
+
};
|
|
97
|
+
export type SecretRequestHint = SecretRequestHintBase & {
|
|
98
|
+
fields: StoredSecretFieldKey[] | SecretRequestHintField[];
|
|
99
|
+
};
|
|
100
|
+
export type SecretRequestSession = {
|
|
101
|
+
sessionId: string;
|
|
102
|
+
status: string;
|
|
103
|
+
currentRequestId: string | null;
|
|
104
|
+
lastEventSeq: number;
|
|
105
|
+
browserSessionId: string | null;
|
|
106
|
+
};
|
|
107
|
+
export interface CreateSecretRequestInput {
|
|
108
|
+
sessionId: string;
|
|
109
|
+
clientRequestId: string;
|
|
110
|
+
fillRef: string;
|
|
111
|
+
purpose: string;
|
|
112
|
+
merchantName: string;
|
|
113
|
+
page?: {
|
|
114
|
+
ref?: string;
|
|
115
|
+
url?: string;
|
|
116
|
+
title?: string;
|
|
117
|
+
};
|
|
118
|
+
secretHint: SecretRequestHint;
|
|
119
|
+
run?: CreateRemoteSecretRequestInput['run'];
|
|
120
|
+
step?: CreateRemoteSecretRequestInput['step'];
|
|
121
|
+
}
|
|
122
|
+
export interface CreateSecretRequestResult {
|
|
123
|
+
requestId: string;
|
|
124
|
+
snapshot: SecretRequestSnapshot;
|
|
125
|
+
reused: boolean;
|
|
126
|
+
duplicate: boolean;
|
|
127
|
+
session: SecretRequestSession;
|
|
128
|
+
}
|
|
129
|
+
export interface SecretRequestPollResult {
|
|
130
|
+
requestId: string;
|
|
131
|
+
snapshot: SecretRequestSnapshot;
|
|
132
|
+
session: SecretRequestSession;
|
|
133
|
+
}
|
|
134
|
+
export type SecretRequestPollFailureKind = 'not_found' | 'aborted' | 'other';
|
|
135
|
+
export type SecretRequestPollOutcome = {
|
|
136
|
+
success: true;
|
|
137
|
+
result: SecretRequestPollResult;
|
|
138
|
+
} | {
|
|
139
|
+
success: false;
|
|
140
|
+
kind: SecretRequestPollFailureKind;
|
|
141
|
+
reason: string;
|
|
142
|
+
status?: number;
|
|
143
|
+
errorCode?: string | null;
|
|
144
|
+
};
|
|
145
|
+
export interface SecretRequestPollAttempt {
|
|
146
|
+
attempt: number;
|
|
147
|
+
elapsedMs: number;
|
|
148
|
+
nextIntervalMs: number;
|
|
149
|
+
outcome: SecretRequestPollOutcome;
|
|
150
|
+
}
|
|
151
|
+
export interface SecretRequestPollUntilOptions {
|
|
152
|
+
timeoutMs?: number;
|
|
153
|
+
requestTimeoutMs?: number;
|
|
154
|
+
intervalMs?: number;
|
|
155
|
+
backoffMultiplier?: number;
|
|
156
|
+
maxIntervalMs?: number;
|
|
157
|
+
retryOnTransientFailure?: boolean;
|
|
158
|
+
stopWhen?: 'fulfilled' | 'terminal';
|
|
159
|
+
signal?: AbortSignal;
|
|
160
|
+
onAttempt?: (attempt: SecretRequestPollAttempt) => void;
|
|
161
|
+
}
|
|
162
|
+
export type SecretRequestPollUntilFailureKind = SecretRequestPollFailureKind | 'timeout';
|
|
163
|
+
export type SecretRequestPollUntilOutcome = {
|
|
164
|
+
success: true;
|
|
165
|
+
requestId: string;
|
|
166
|
+
attempts: number;
|
|
167
|
+
elapsedMs: number;
|
|
168
|
+
result: SecretRequestPollResult;
|
|
169
|
+
statusContract: SecretRequestStatusContract;
|
|
170
|
+
} | {
|
|
171
|
+
success: false;
|
|
172
|
+
requestId: string;
|
|
173
|
+
attempts: number;
|
|
174
|
+
elapsedMs: number;
|
|
175
|
+
kind: SecretRequestPollUntilFailureKind;
|
|
176
|
+
reason: string;
|
|
177
|
+
lastResult?: SecretRequestPollResult;
|
|
178
|
+
status?: number;
|
|
179
|
+
errorCode?: string | null;
|
|
180
|
+
};
|
|
181
|
+
export interface ClaimSecretRequestResult {
|
|
182
|
+
requestId: string;
|
|
183
|
+
issuedAt: string;
|
|
184
|
+
expiresAt?: string;
|
|
185
|
+
secret: {
|
|
186
|
+
values: Partial<Record<StoredSecretFieldKey, string>>;
|
|
187
|
+
source: 'saved_secret' | 'saved_credential' | 'inline_response';
|
|
188
|
+
storedSecretRef?: string;
|
|
189
|
+
credentialId?: string;
|
|
190
|
+
kind?: StoredSecretKind;
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
export type ClaimSecretRequestOutcome = {
|
|
194
|
+
success: true;
|
|
195
|
+
result: ClaimSecretRequestResult;
|
|
196
|
+
} | {
|
|
197
|
+
success: false;
|
|
198
|
+
kind: SecretClaimFailureKind;
|
|
199
|
+
reason: string;
|
|
200
|
+
status?: number;
|
|
201
|
+
errorCode?: string | null;
|
|
202
|
+
};
|
|
203
|
+
export declare function describeSecretRequestStatus(status: SecretRequestStatus, requestType: SecretRequestType): SecretRequestStatusContract;
|
|
204
|
+
export declare function evaluateSecretRequestForFill(request: Pick<SecretRequestSnapshot, 'fillRef' | 'status' | 'requestType' | 'claimedAt' | 'host' | 'scopeRef'>, options: {
|
|
205
|
+
fillRef: string;
|
|
206
|
+
observedHost?: string | null;
|
|
207
|
+
observedScopeRef?: string;
|
|
208
|
+
}): SecretRequestFillReadiness;
|
|
209
|
+
export declare function mapSessionRequestToSecretRequestSnapshot(request: SessionBackendRequest): SecretRequestSnapshot;
|
|
210
|
+
export declare function mapClaimedRemoteSecret(response: ClaimRemoteSecretResponse): ClaimSecretRequestResult;
|
|
211
|
+
export declare function mapApiCatalogEntryToStoredSecret(entry: SessionBackendSecretCatalogEntry, host: string): StoredSecretMetadata;
|
|
212
|
+
export declare function resolveCatalogHost(urlOrHost: string): string;
|
|
213
|
+
export declare function resolveSecretCatalogContext(catalogByHost: SecretCatalogByHost | undefined, urlOrHost: string): {
|
|
214
|
+
host: string;
|
|
215
|
+
catalog: SecretCatalog | null;
|
|
216
|
+
};
|
|
217
|
+
export declare function fetchSecretCatalog(gateway: MagicPayGatewayConfig, sessionId: string, urlOrHost: string, options?: MagicPayRequestOptions & {
|
|
218
|
+
syncedAt?: string;
|
|
219
|
+
}): Promise<SecretCatalog>;
|
|
220
|
+
export declare function createSecretRequest(gateway: MagicPayGatewayConfig, input: CreateSecretRequestInput, options?: MagicPayRequestOptions): Promise<CreateSecretRequestResult>;
|
|
221
|
+
export declare function pollSecretRequest(gateway: MagicPayGatewayConfig, sessionId: string, requestId: string, options?: MagicPayRequestOptions): Promise<SecretRequestPollOutcome>;
|
|
222
|
+
export declare function pollSecretRequestUntil(gateway: MagicPayGatewayConfig, sessionId: string, requestId: string, options?: SecretRequestPollUntilOptions & {
|
|
223
|
+
fetchImpl?: typeof fetch;
|
|
224
|
+
}): Promise<SecretRequestPollUntilOutcome>;
|
|
225
|
+
export declare function claimSecretRequest(gateway: MagicPayGatewayConfig, sessionId: string, requestId: string, claimId: string, options?: MagicPayRequestOptions): Promise<ClaimSecretRequestOutcome>;
|
|
226
|
+
export declare function classifySecretClaimFailure(error: unknown): SecretClaimFailureKind;
|
|
227
|
+
export {};
|
|
228
|
+
//# sourceMappingURL=secret-flow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"secret-flow.d.ts","sourceRoot":"","sources":["../src/secret-flow.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,yBAAyB,EAC9B,KAAK,8BAA8B,EAGnC,KAAK,qBAAqB,EAC1B,KAAK,gCAAgC,EACtC,MAAM,qBAAqB,CAA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