@agent-cards/sdk 0.21.0 → 0.23.0
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/CHANGELOG.md +87 -2
- package/PREFLIGHT.md +32 -0
- package/README.md +1177 -23
- package/dist/aci.d.ts +173 -0
- package/dist/aci.generated.d.ts +87 -0
- package/dist/aci.generated.js +306 -0
- package/dist/aci.js +371 -0
- package/dist/adyen-merchant-hosted.generated.d.ts +3 -3
- package/dist/adyen-merchant-hosted.generated.js +302 -56
- package/dist/agentcard.d.ts +9 -2
- package/dist/agentcard.js +4 -2
- package/dist/amadeus-checkout.generated.d.ts +57 -0
- package/dist/amadeus-checkout.generated.js +549 -0
- package/dist/amadeus.d.ts +41 -0
- package/dist/amadeus.js +81 -0
- package/dist/builtin-registry.generated.js +1 -1
- package/dist/card-endpoint-facts.d.ts +96 -0
- package/dist/card-endpoint-facts.js +275 -0
- package/dist/card-endpoint-page.d.ts +54 -0
- package/dist/card-endpoint-page.js +69 -0
- package/dist/card-endpoint.d.ts +298 -0
- package/dist/card-endpoint.js +438 -0
- package/dist/card-fields.generated.d.ts +5 -3
- package/dist/card-fields.generated.js +284 -7
- package/dist/cdp.d.ts +5 -1
- package/dist/cdp.js +1155 -141
- package/dist/client.d.ts +456 -20
- package/dist/client.js +1072 -104
- package/dist/creditguard.generated.d.ts +79 -0
- package/dist/creditguard.generated.js +662 -0
- package/dist/cse-body.js +11 -1
- package/dist/cybersource-flex.d.ts +30 -0
- package/dist/cybersource-flex.generated.d.ts +27 -1
- package/dist/cybersource-flex.generated.js +42 -2
- package/dist/cybersource-flex.js +46 -0
- package/dist/datatrans.d.ts +96 -0
- package/dist/datatrans.generated.d.ts +64 -0
- package/dist/datatrans.generated.js +426 -0
- package/dist/datatrans.js +178 -0
- package/dist/ekashu.d.ts +35 -0
- package/dist/ekashu.js +55 -0
- package/dist/elavon-converge.d.ts +37 -0
- package/dist/elavon-converge.generated.d.ts +49 -0
- package/dist/elavon-converge.generated.js +439 -0
- package/dist/elavon-converge.js +84 -0
- package/dist/eprotect.d.ts +152 -0
- package/dist/eprotect.generated.d.ts +77 -0
- package/dist/eprotect.generated.js +498 -0
- package/dist/eprotect.js +222 -0
- package/dist/hosted-form.d.ts +3 -2
- package/dist/hosted-form.js +3 -2
- package/dist/index.d.ts +17 -3
- package/dist/index.js +6 -1
- package/dist/juspay-gate.d.ts +82 -0
- package/dist/juspay-gate.js +126 -0
- package/dist/juspay.generated.d.ts +89 -0
- package/dist/juspay.generated.js +705 -0
- package/dist/lifecycle.d.ts +60 -6
- package/dist/lifecycle.js +122 -8
- package/dist/merchant-card-endpoints.generated.d.ts +122 -0
- package/dist/merchant-card-endpoints.generated.js +4261 -0
- package/dist/merchant-hosted.d.ts +4 -1
- package/dist/merchant-hosted.js +5 -2
- package/dist/merchant-session-probe.d.ts +48 -0
- package/dist/merchant-session-probe.js +53 -0
- package/dist/merchant-session.generated.d.ts +69 -0
- package/dist/merchant-session.generated.js +919 -0
- package/dist/payrails.d.ts +133 -0
- package/dist/payrails.generated.d.ts +73 -0
- package/dist/payrails.generated.js +596 -0
- package/dist/payrails.js +305 -0
- package/dist/pelecard.d.ts +32 -0
- package/dist/pelecard.generated.d.ts +32 -0
- package/dist/pelecard.generated.js +283 -0
- package/dist/pelecard.js +42 -0
- package/dist/pre-claim.d.ts +81 -2
- package/dist/pre-claim.js +1023 -5
- package/dist/preflight-catalog.json +2267 -288
- package/dist/preflight-schemas.json +183 -6
- package/dist/preflight.generated.d.ts +1 -1
- package/dist/preflight.generated.js +243 -4
- package/dist/preparation.d.ts +12 -3
- package/dist/preparation.js +63 -12
- package/dist/prepared-processor.d.ts +84 -5
- package/dist/prepared-processor.js +147 -6
- package/dist/primer.d.ts +53 -0
- package/dist/primer.generated.d.ts +38 -0
- package/dist/primer.generated.js +624 -0
- package/dist/primer.js +82 -0
- package/dist/registry.d.ts +100 -8
- package/dist/registry.js +85 -11
- package/dist/shiji-sts.d.ts +144 -0
- package/dist/shiji-sts.generated.d.ts +72 -0
- package/dist/shiji-sts.generated.js +913 -0
- package/dist/shiji-sts.js +222 -0
- package/dist/stripe-checkout.generated.d.ts +1 -1
- package/dist/stripe-checkout.generated.js +764 -9
- package/dist/stripe-setup.d.ts +16 -0
- package/dist/stripe-setup.js +61 -0
- package/dist/substitutions.generated.js +187 -29
- package/dist/verifone.d.ts +68 -0
- package/dist/verifone.generated.d.ts +51 -0
- package/dist/verifone.generated.js +1413 -0
- package/dist/verifone.js +119 -0
- package/dist/voice-types.d.ts +27 -0
- package/dist/voice.d.ts +6 -1
- package/dist/voice.js +6 -1
- package/dist/wspay.d.ts +41 -0
- package/dist/wspay.generated.d.ts +41 -0
- package/dist/wspay.generated.js +370 -0
- package/dist/wspay.js +65 -0
- package/examples/preflight/kernel-native/inventory.json +1 -1
- package/package.json +3 -3
|
@@ -100,7 +100,10 @@ export declare function armServedProfiles(entries?: readonly unknown[]): Merchan
|
|
|
100
100
|
* under a test_ key.
|
|
101
101
|
*/
|
|
102
102
|
export declare function declareSandboxMerchant(input: SandboxMerchantDeclaration): MerchantProfile;
|
|
103
|
-
/**
|
|
103
|
+
/**
|
|
104
|
+
* The armed profile whose endpoint, a sibling of it (same origin and path shape), its then
|
|
105
|
+
* request or one of its other card requests a URL is; null for any other URL.
|
|
106
|
+
*/
|
|
104
107
|
export declare function merchantProfileFor(profiles: readonly MerchantProfile[], url: string): MerchantProfile | null;
|
|
105
108
|
/** The Fetch.enable globs that pause every armed profile's endpoint and its siblings, a declared endpoint included. */
|
|
106
109
|
export declare function merchantProfileUrlPatterns(profiles: readonly MerchantProfile[]): string[];
|
package/dist/merchant-hosted.js
CHANGED
|
@@ -110,11 +110,14 @@ export function declareSandboxMerchant(input) {
|
|
|
110
110
|
return Object.freeze({ id: built.id, merchant: url.hostname, status: 'enabled',
|
|
111
111
|
sandboxDeclaration: Object.freeze({ endpoint: input.endpoint, clientKey: input.clientKey }) });
|
|
112
112
|
}
|
|
113
|
-
/** How a URL relates to an armed profile: its declared endpoint when it has one, else the reviewed
|
|
113
|
+
/** How a URL relates to an armed profile: its declared endpoint when it has one, else the reviewed requests. */
|
|
114
114
|
function relationTo(profile, url) {
|
|
115
115
|
return profile.sandboxDeclaration ? declaredRelation(profile.sandboxDeclaration.endpoint, url) : urlRelation(profile.id, url);
|
|
116
116
|
}
|
|
117
|
-
/**
|
|
117
|
+
/**
|
|
118
|
+
* The armed profile whose endpoint, a sibling of it (same origin and path shape), its then
|
|
119
|
+
* request or one of its other card requests a URL is; null for any other URL.
|
|
120
|
+
*/
|
|
118
121
|
export function merchantProfileFor(profiles, url) {
|
|
119
122
|
if (typeof url !== 'string')
|
|
120
123
|
return null;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/** One cookie of the merchant's jar, name and value only. */
|
|
2
|
+
export interface MerchantSessionCookie {
|
|
3
|
+
name: string;
|
|
4
|
+
value: string;
|
|
5
|
+
}
|
|
6
|
+
/** What a probe create carries: the reviewed profile and the kept cookies, and the names it dropped (never their values). */
|
|
7
|
+
export interface MerchantSessionCapture {
|
|
8
|
+
profile: string;
|
|
9
|
+
cookies: MerchantSessionCookie[];
|
|
10
|
+
dropped: string[];
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Why a capture was refused before anything left this process. `signed_in`: the jar holds
|
|
14
|
+
* a sign-in token (phase 1 reads guest checkouts only); `no_session`: nothing but
|
|
15
|
+
* bot-manager cookies, or nothing at all; `invalid_session`: a cookie that is not an RFC
|
|
16
|
+
* 6265 pair, one name twice, or past the limits; `unknown_profile`: no reviewed read.
|
|
17
|
+
*/
|
|
18
|
+
export type MerchantSessionRefusal = 'unknown_profile' | 'signed_in' | 'no_session' | 'invalid_session';
|
|
19
|
+
export declare class MerchantSessionRefusedError extends Error {
|
|
20
|
+
readonly profile: string;
|
|
21
|
+
readonly reason: MerchantSessionRefusal;
|
|
22
|
+
constructor(profile: string, reason: MerchantSessionRefusal);
|
|
23
|
+
}
|
|
24
|
+
/** The URL whose cookie jar a capture reads: the block's endpoint and read path. Null for a profile with no reviewed read. */
|
|
25
|
+
export declare function merchantSessionReadUrl(profile: string): string | null;
|
|
26
|
+
/** The capture rules alone, for a jar already read: kept cookies, dropped names, or a MerchantSessionRefusedError. */
|
|
27
|
+
export declare function merchantSessionCapture(profile: string, jar: readonly {
|
|
28
|
+
name: string;
|
|
29
|
+
value: string;
|
|
30
|
+
}[]): MerchantSessionCapture;
|
|
31
|
+
/** The CDP command a capture needs: Network.getCookies on the page session. */
|
|
32
|
+
export interface MerchantSessionCdp {
|
|
33
|
+
send(method: 'Network.getCookies', params: {
|
|
34
|
+
urls: string[];
|
|
35
|
+
}, sessionId?: string): Promise<{
|
|
36
|
+
cookies?: {
|
|
37
|
+
name: string;
|
|
38
|
+
value: string;
|
|
39
|
+
}[];
|
|
40
|
+
} | undefined>;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Read the merchant's cookie jar for a profile's read URL on a CDP page session (the
|
|
44
|
+
* agent's own browser, after the person built the cart by hand) and apply the capture
|
|
45
|
+
* rules. The jar is read the 14b way: Network.getCookies for the exact read URL, so only
|
|
46
|
+
* the cookies the merchant's own page would send there, HttpOnly included.
|
|
47
|
+
*/
|
|
48
|
+
export declare function captureMerchantSession(cdp: MerchantSessionCdp, sessionId: string | undefined, profile: string): Promise<MerchantSessionCapture>;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// The merchant-session probe's capture (the deterministic merchant total, phase 0): the
|
|
2
|
+
// SDK reads the merchant's cookie jar for a reviewed read URL, the way the card endpoint
|
|
3
|
+
// capture reads it for a paused card request (Network.getCookies, HttpOnly included), and
|
|
4
|
+
// hands the kept cookies to the API's probe create. No card request is paused, no JWE is
|
|
5
|
+
// made and no card is involved: the cardholder's Vault page reads the merchant's own total
|
|
6
|
+
// through the merchant-session relay, once, and records what it saw.
|
|
7
|
+
//
|
|
8
|
+
// The same rules as the API and the Vault run (payment-core merchant-session.js, the SDK's
|
|
9
|
+
// generated copy): every bot-manager cookie is dropped (D19), and a jar that carries a
|
|
10
|
+
// sign-in token is refused before anything leaves this process (D22). The cookies are a
|
|
11
|
+
// merchant session: no event, error or log line from this module names a value.
|
|
12
|
+
import { MERCHANT_SESSION_PROFILES as SHARED_PROFILES, merchantSessionCookies as sharedCookies, } from './merchant-session.generated.js';
|
|
13
|
+
export class MerchantSessionRefusedError extends Error {
|
|
14
|
+
profile;
|
|
15
|
+
reason;
|
|
16
|
+
constructor(profile, reason) {
|
|
17
|
+
super(`refused a merchant read for ${profile} (${reason}). Nothing was sent.`);
|
|
18
|
+
this.profile = profile;
|
|
19
|
+
this.reason = reason;
|
|
20
|
+
this.name = 'MerchantSessionRefusedError';
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
const BLOCKS = SHARED_PROFILES;
|
|
24
|
+
const keptCookies = (profile, jar) => sharedCookies(profile, jar);
|
|
25
|
+
/** The URL whose cookie jar a capture reads: the block's endpoint and read path. Null for a profile with no reviewed read. */
|
|
26
|
+
export function merchantSessionReadUrl(profile) {
|
|
27
|
+
const block = BLOCKS.find((entry) => entry.profile === profile);
|
|
28
|
+
return block ? `${block.endpoint}${block.read.path}` : null;
|
|
29
|
+
}
|
|
30
|
+
/** The capture rules alone, for a jar already read: kept cookies, dropped names, or a MerchantSessionRefusedError. */
|
|
31
|
+
export function merchantSessionCapture(profile, jar) {
|
|
32
|
+
if (!merchantSessionReadUrl(profile))
|
|
33
|
+
throw new MerchantSessionRefusedError(profile, 'unknown_profile');
|
|
34
|
+
const kept = keptCookies(profile, (Array.isArray(jar) ? jar : []).map(({ name, value }) => ({ name, value })));
|
|
35
|
+
if (!kept.ok) {
|
|
36
|
+
const reason = kept.code === 'signed_in' || kept.code === 'no_session' || kept.code === 'unknown_profile' ? kept.code : 'invalid_session';
|
|
37
|
+
throw new MerchantSessionRefusedError(profile, reason);
|
|
38
|
+
}
|
|
39
|
+
return { profile, cookies: kept.cookies, dropped: kept.dropped };
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Read the merchant's cookie jar for a profile's read URL on a CDP page session (the
|
|
43
|
+
* agent's own browser, after the person built the cart by hand) and apply the capture
|
|
44
|
+
* rules. The jar is read the 14b way: Network.getCookies for the exact read URL, so only
|
|
45
|
+
* the cookies the merchant's own page would send there, HttpOnly included.
|
|
46
|
+
*/
|
|
47
|
+
export async function captureMerchantSession(cdp, sessionId, profile) {
|
|
48
|
+
const url = merchantSessionReadUrl(profile);
|
|
49
|
+
if (!url)
|
|
50
|
+
throw new MerchantSessionRefusedError(profile, 'unknown_profile');
|
|
51
|
+
const jar = (await cdp.send('Network.getCookies', { urls: [url] }, sessionId))?.cookies ?? [];
|
|
52
|
+
return merchantSessionCapture(profile, jar);
|
|
53
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
declare var MERCHANT_SESSION_MODE: string;
|
|
2
|
+
declare var MERCHANT_SESSION_USER_AGENT: string;
|
|
3
|
+
declare var MERCHANT_SESSION_BOT_COOKIES: any;
|
|
4
|
+
declare var MERCHANT_SESSION_SIGN_IN_COOKIES: any;
|
|
5
|
+
declare var MERCHANT_SESSION_READ_LIMITS: any;
|
|
6
|
+
declare var MERCHANT_SESSION_RELAY_URL: string;
|
|
7
|
+
declare var MERCHANT_SESSION_COOKIE_LIMITS: any;
|
|
8
|
+
declare var MERCHANT_SESSION_PROFILES: any;
|
|
9
|
+
declare function merchantSessionProfile(id: any): any;
|
|
10
|
+
declare function merchantSessionHosts(): unknown[];
|
|
11
|
+
declare function merchantSessionProfileRefusal(block: any): string | null;
|
|
12
|
+
declare function merchantSessionCookies(id: any, cookies: any): {
|
|
13
|
+
ok: boolean;
|
|
14
|
+
code: any;
|
|
15
|
+
reason: any;
|
|
16
|
+
} | {
|
|
17
|
+
ok: boolean;
|
|
18
|
+
cookies: {
|
|
19
|
+
name: any;
|
|
20
|
+
value: any;
|
|
21
|
+
}[];
|
|
22
|
+
dropped: any[];
|
|
23
|
+
header: string;
|
|
24
|
+
};
|
|
25
|
+
declare function merchantSessionRead(id: any, session: any): any;
|
|
26
|
+
declare var MERCHANT_SESSION_CACHE_FACT_CHARS: number;
|
|
27
|
+
declare function merchantSessionAnswerFacts(response: any): {
|
|
28
|
+
status: any;
|
|
29
|
+
challenge: string | null;
|
|
30
|
+
headerNames: string[];
|
|
31
|
+
cache: {};
|
|
32
|
+
};
|
|
33
|
+
declare function merchantSessionReading(id: any, response: any, { now }?: {}): {
|
|
34
|
+
ok: boolean;
|
|
35
|
+
code: any;
|
|
36
|
+
reason: any;
|
|
37
|
+
} | {
|
|
38
|
+
ok: boolean;
|
|
39
|
+
profile: any;
|
|
40
|
+
totalMinor: number;
|
|
41
|
+
currency: any;
|
|
42
|
+
cartId: string;
|
|
43
|
+
cartIdSha256: string;
|
|
44
|
+
expiresAt: number | null;
|
|
45
|
+
snapshotSha256: string;
|
|
46
|
+
digests: {
|
|
47
|
+
goods: string;
|
|
48
|
+
destination: string;
|
|
49
|
+
recipient: string;
|
|
50
|
+
};
|
|
51
|
+
kountSessionSha256: null;
|
|
52
|
+
} | {
|
|
53
|
+
ok: boolean;
|
|
54
|
+
profile: any;
|
|
55
|
+
totalMinor: number;
|
|
56
|
+
currency: any;
|
|
57
|
+
cartId: null;
|
|
58
|
+
cartIdSha256: null;
|
|
59
|
+
expiresAt: null;
|
|
60
|
+
snapshotSha256: string;
|
|
61
|
+
digests: {
|
|
62
|
+
goods: string;
|
|
63
|
+
destination: string;
|
|
64
|
+
recipient: string;
|
|
65
|
+
};
|
|
66
|
+
kountSessionSha256: string | null;
|
|
67
|
+
};
|
|
68
|
+
declare function sameMerchantSnapshot(a: any, b: any): boolean;
|
|
69
|
+
export { MERCHANT_SESSION_BOT_COOKIES, MERCHANT_SESSION_CACHE_FACT_CHARS, MERCHANT_SESSION_COOKIE_LIMITS, MERCHANT_SESSION_MODE, MERCHANT_SESSION_PROFILES, MERCHANT_SESSION_READ_LIMITS, MERCHANT_SESSION_RELAY_URL, MERCHANT_SESSION_SIGN_IN_COOKIES, MERCHANT_SESSION_USER_AGENT, merchantSessionAnswerFacts, merchantSessionCookies, merchantSessionHosts, merchantSessionProfile, merchantSessionProfileRefusal, merchantSessionRead, merchantSessionReading, sameMerchantSnapshot };
|