@astrasyncai/verification-gateway 5.3.0 → 5.4.1
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/adapter-interface/interface.d.mts +2 -3
- package/dist/adapter-interface/interface.d.ts +2 -3
- package/dist/adapters/express.d.mts +63 -4
- package/dist/adapters/express.d.ts +63 -4
- package/dist/adapters/express.js +9 -2
- package/dist/adapters/express.js.map +1 -1
- package/dist/adapters/express.mjs +9 -2
- package/dist/adapters/express.mjs.map +1 -1
- package/dist/adapters/mcp.d.mts +396 -4
- package/dist/adapters/mcp.d.ts +396 -4
- package/dist/adapters/mcp.js +9 -2
- package/dist/adapters/mcp.js.map +1 -1
- package/dist/adapters/mcp.mjs +9 -2
- package/dist/adapters/mcp.mjs.map +1 -1
- package/dist/adapters/nextjs.d.mts +22 -4
- package/dist/adapters/nextjs.d.ts +22 -4
- package/dist/adapters/nextjs.js +9 -2
- package/dist/adapters/nextjs.js.map +1 -1
- package/dist/adapters/nextjs.mjs +9 -2
- package/dist/adapters/nextjs.mjs.map +1 -1
- package/dist/adapters/sdk.d.mts +157 -3
- package/dist/adapters/sdk.d.ts +157 -3
- package/dist/adapters/sdk.js +62 -3
- package/dist/adapters/sdk.js.map +1 -1
- package/dist/adapters/sdk.mjs +62 -3
- package/dist/adapters/sdk.mjs.map +1 -1
- package/dist/agent/index.d.mts +224 -3
- package/dist/agent/index.d.ts +224 -3
- package/dist/agent/index.js +1 -1
- package/dist/agent/index.js.map +1 -1
- package/dist/agent/index.mjs +1 -1
- package/dist/agent/index.mjs.map +1 -1
- package/dist/bin/astrasync-claude-hook.js +9 -2
- package/dist/bin/astrasync-codex-hook.js +9 -2
- package/dist/bin/astrasync-guard.js +9 -2
- package/dist/bin/astrasync.js +9 -2
- package/dist/browser/background.js +9 -2
- package/dist/browser/background.js.map +1 -1
- package/dist/browser/background.mjs +9 -2
- package/dist/browser/background.mjs.map +1 -1
- package/dist/browser/browser-adapter.d.mts +1 -5
- package/dist/browser/browser-adapter.d.ts +1 -5
- package/dist/claude-code/claude-code-adapter.d.mts +1 -5
- package/dist/claude-code/claude-code-adapter.d.ts +1 -5
- package/dist/cli/index.d.mts +1 -5
- package/dist/cli/index.d.ts +1 -5
- package/dist/cli/index.js +1 -1
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/index.mjs +1 -1
- package/dist/cli/index.mjs.map +1 -1
- package/dist/codex/index.d.mts +1 -5
- package/dist/codex/index.d.ts +1 -5
- package/dist/codex/index.js +9 -2
- package/dist/codex/index.js.map +1 -1
- package/dist/codex/index.mjs +9 -2
- package/dist/codex/index.mjs.map +1 -1
- package/dist/cursor/cursor-adapter.d.mts +1 -5
- package/dist/cursor/cursor-adapter.d.ts +1 -5
- package/dist/cursor/extension.d.mts +1 -5
- package/dist/cursor/extension.d.ts +1 -5
- package/dist/cursor/extension.js +9 -2
- package/dist/cursor/extension.js.map +1 -1
- package/dist/cursor/extension.mjs +9 -2
- package/dist/cursor/extension.mjs.map +1 -1
- package/dist/edge-config.d.mts +1 -1
- package/dist/edge-config.d.ts +1 -1
- package/dist/edge-config.js +1 -1
- package/dist/edge-config.js.map +1 -1
- package/dist/edge-config.mjs +1 -1
- package/dist/edge-config.mjs.map +1 -1
- package/dist/edge-core/index.d.mts +1 -1
- package/dist/edge-core/index.d.ts +1 -1
- package/dist/edge-core/index.js +9 -2
- package/dist/edge-core/index.js.map +1 -1
- package/dist/edge-core/index.mjs +9 -2
- package/dist/edge-core/index.mjs.map +1 -1
- package/dist/gateway/gateway.d.mts +2 -3
- package/dist/gateway/gateway.d.ts +2 -3
- package/dist/gateway/gateway.js +9 -2
- package/dist/gateway/gateway.js.map +1 -1
- package/dist/gateway/gateway.mjs +9 -2
- package/dist/gateway/gateway.mjs.map +1 -1
- package/dist/git-trigger/git-hooks.d.mts +253 -3
- package/dist/git-trigger/git-hooks.d.ts +253 -3
- package/dist/index.d.mts +4500 -42
- package/dist/index.d.ts +4500 -42
- package/dist/index.js +62 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +62 -3
- package/dist/index.mjs.map +1 -1
- package/dist/interface-q1WrMsB1.d.mts +365 -0
- package/dist/interface-q1WrMsB1.d.ts +365 -0
- package/dist/local-evaluator/evaluator.d.mts +2 -3
- package/dist/local-evaluator/evaluator.d.ts +2 -3
- package/dist/registration/index.js +1 -1
- package/dist/registration/index.js.map +1 -1
- package/dist/registration/index.mjs +1 -1
- package/dist/registration/index.mjs.map +1 -1
- package/dist/transport/index.d.mts +1324 -4
- package/dist/transport/index.d.ts +1324 -4
- package/dist/transport/index.js +1 -1
- package/dist/transport/index.js.map +1 -1
- package/dist/transport/index.mjs +1 -1
- package/dist/transport/index.mjs.map +1 -1
- package/dist/{types-C1s1z0VD.d.ts → types-BRz2U0Pn.d.ts} +2 -2
- package/dist/types-BfILnheI.d.mts +189 -0
- package/dist/types-BfILnheI.d.ts +189 -0
- package/dist/{types-1urxLCZv.d.mts → types-CfBpm3w5.d.mts} +2 -2
- package/dist/types-D28h1384.d.ts +763 -0
- package/dist/types-DJMU5g7Z.d.mts +763 -0
- package/dist/{types-CA1ZhoaJ.d.ts → types-W-A326w3.d.mts} +52 -212
- package/dist/{types-eSqHyFFH.d.mts → types-W-A326w3.d.ts} +52 -212
- package/dist/ui/index.d.mts +1 -2
- package/dist/ui/index.d.ts +1 -2
- package/dist/verify.d.mts +1 -1
- package/dist/verify.d.ts +1 -1
- package/dist/verify.js +9 -2
- package/dist/verify.js.map +1 -1
- package/dist/verify.mjs +9 -2
- package/dist/verify.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/express-DHEz_6Rh.d.ts +0 -69
- package/dist/express-PLYlCd5k.d.mts +0 -69
- package/dist/index-BnrhTsp7.d.ts +0 -1469
- package/dist/index-CdF7L5E0.d.ts +0 -248
- package/dist/index-D6HQmsVV.d.mts +0 -248
- package/dist/index-zD5AaJsO.d.mts +0 -1469
- package/dist/mcp-BuKgYZsC.d.ts +0 -397
- package/dist/mcp-DDcGHRjo.d.mts +0 -397
- package/dist/nextjs-CX9X9okw.d.ts +0 -28
- package/dist/nextjs-w60J62Wj.d.mts +0 -28
- package/dist/sdk-DbY7-3PJ.d.mts +0 -142
- package/dist/sdk-uzuKDTRU.d.ts +0 -142
package/dist/index.mjs
CHANGED
|
@@ -19,7 +19,7 @@ function getTrustLevel(score) {
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
// src/version.ts
|
|
22
|
-
var SDK_VERSION = "5.
|
|
22
|
+
var SDK_VERSION = "5.4.1";
|
|
23
23
|
|
|
24
24
|
// src/http.ts
|
|
25
25
|
var SDK_USER_AGENT = `astrasync-sdk/${SDK_VERSION}`;
|
|
@@ -200,7 +200,14 @@ function getCacheKey(request, counterpartyId) {
|
|
|
200
200
|
request.callerMetadata?.sourceIp || "",
|
|
201
201
|
request.callerMetadata?.userAgent || "",
|
|
202
202
|
request.callerMetadata?.forwardedFor || "",
|
|
203
|
-
request.callerMetadata?.agentCardUrl || ""
|
|
203
|
+
request.callerMetadata?.agentCardUrl || "",
|
|
204
|
+
// UAT2 Bug B (5.4.1): the commerce phase and cart identity DO affect the
|
|
205
|
+
// backend verdict — the confirm leg is the ONLY leg that may execute
|
|
206
|
+
// first-party settlement. Without these, a confirm within the cache TTL of
|
|
207
|
+
// its start_checkout quote was served the cached quote-leg grant (no
|
|
208
|
+
// settlementOutcome) and never reached the backend. Same F-A1-07 bug class.
|
|
209
|
+
request.commercePhase || "",
|
|
210
|
+
request.checkoutSessionId || ""
|
|
204
211
|
].join("|");
|
|
205
212
|
}
|
|
206
213
|
function getCachedResult(request, counterpartyId) {
|
|
@@ -2582,7 +2589,13 @@ var VerificationGatewayClient = class {
|
|
|
2582
2589
|
debug: options.debug,
|
|
2583
2590
|
customHeaders: options.customHeaders,
|
|
2584
2591
|
counterpartyUrl: options.counterpartyUrl,
|
|
2585
|
-
counterpartyType: options.counterpartyType
|
|
2592
|
+
counterpartyType: options.counterpartyType,
|
|
2593
|
+
// 5.4.1 (UAT2): previously dropped here despite being a typed, documented
|
|
2594
|
+
// GatewayConfig field — a client-driven confirmCheckout() could never
|
|
2595
|
+
// identify its endpoint by ASTRAE id, so merchants with multiple
|
|
2596
|
+
// endpoints on one origin (or a stale row sharing the URL) resolved
|
|
2597
|
+
// non-deterministically by URL and could miss the first-party gate.
|
|
2598
|
+
counterpartyId: options.counterpartyId
|
|
2586
2599
|
};
|
|
2587
2600
|
this.timeout = options.timeout || 1e4;
|
|
2588
2601
|
this.retryConfig = options.retry || { maxRetries: 3, backoffMs: 1e3 };
|
|
@@ -2614,6 +2627,52 @@ var VerificationGatewayClient = class {
|
|
|
2614
2627
|
})
|
|
2615
2628
|
);
|
|
2616
2629
|
}
|
|
2630
|
+
/**
|
|
2631
|
+
* 5.4.0 (astra-pay): confirm-leg of a checkout — the ONLY call that may fire
|
|
2632
|
+
* first-party charge-at-redeem (server-side settlement on the owner's saved
|
|
2633
|
+
* instrument). This is the supported public surface for the confirm leg;
|
|
2634
|
+
* `verify()` deliberately does not expose the checkout fields, so settlement
|
|
2635
|
+
* can never fire by accident from a generic verify.
|
|
2636
|
+
*
|
|
2637
|
+
* Sends `commercePhase: 'confirm'` plus the checkout session id (per-cart
|
|
2638
|
+
* idempotency) and line items (order/receipt plane), and identifies the
|
|
2639
|
+
* merchant via `counterpartyUrl`/`counterpartyType` (required — the backend
|
|
2640
|
+
* only settles a merchant-mediated grant against a first-party storefront).
|
|
2641
|
+
* `purpose`/`action` default to the canonical shopping pair.
|
|
2642
|
+
*
|
|
2643
|
+
* Returns the full `VerificationResult`: read `.settlementOutcome` for the
|
|
2644
|
+
* settled/failed/requires_action/no_instrument outcome (+ `orderId`), and the
|
|
2645
|
+
* identity/policy/`failures` fields for a denial. On any non-`confirm`/first-
|
|
2646
|
+
* party path `settlementOutcome` is simply absent — no money moves.
|
|
2647
|
+
*/
|
|
2648
|
+
async confirmCheckout(options) {
|
|
2649
|
+
const credentials = {
|
|
2650
|
+
astraId: options.astraId,
|
|
2651
|
+
apiKey: options.apiKey,
|
|
2652
|
+
jwt: options.jwt
|
|
2653
|
+
};
|
|
2654
|
+
return this.executeWithRetry(
|
|
2655
|
+
() => verify(
|
|
2656
|
+
this.config,
|
|
2657
|
+
{
|
|
2658
|
+
credentials,
|
|
2659
|
+
purpose: options.purpose ?? "shopping",
|
|
2660
|
+
action: options.action ?? "shopping.purchase",
|
|
2661
|
+
transactionValue: options.transactionValue,
|
|
2662
|
+
currency: options.currency,
|
|
2663
|
+
commercePhase: "confirm",
|
|
2664
|
+
checkoutSessionId: options.checkoutSessionId,
|
|
2665
|
+
checkoutItems: options.checkoutItems,
|
|
2666
|
+
counterpartyUrl: options.counterpartyUrl,
|
|
2667
|
+
counterpartyType: options.counterpartyType
|
|
2668
|
+
},
|
|
2669
|
+
// 5.4.1 (UAT2 Bug B): the confirm leg must always reach the backend —
|
|
2670
|
+
// a cached quote-leg grant carries no settlementOutcome and would
|
|
2671
|
+
// silently skip settlement.
|
|
2672
|
+
{ bypassCache: true }
|
|
2673
|
+
)
|
|
2674
|
+
);
|
|
2675
|
+
}
|
|
2617
2676
|
/**
|
|
2618
2677
|
* Quick verification — checks credentials and policy in one call.
|
|
2619
2678
|
*
|