@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.js
CHANGED
|
@@ -112,7 +112,7 @@ function getTrustLevel(score) {
|
|
|
112
112
|
}
|
|
113
113
|
|
|
114
114
|
// src/version.ts
|
|
115
|
-
var SDK_VERSION = "5.
|
|
115
|
+
var SDK_VERSION = "5.4.1";
|
|
116
116
|
|
|
117
117
|
// src/http.ts
|
|
118
118
|
var SDK_USER_AGENT = `astrasync-sdk/${SDK_VERSION}`;
|
|
@@ -293,7 +293,14 @@ function getCacheKey(request, counterpartyId) {
|
|
|
293
293
|
request.callerMetadata?.sourceIp || "",
|
|
294
294
|
request.callerMetadata?.userAgent || "",
|
|
295
295
|
request.callerMetadata?.forwardedFor || "",
|
|
296
|
-
request.callerMetadata?.agentCardUrl || ""
|
|
296
|
+
request.callerMetadata?.agentCardUrl || "",
|
|
297
|
+
// UAT2 Bug B (5.4.1): the commerce phase and cart identity DO affect the
|
|
298
|
+
// backend verdict — the confirm leg is the ONLY leg that may execute
|
|
299
|
+
// first-party settlement. Without these, a confirm within the cache TTL of
|
|
300
|
+
// its start_checkout quote was served the cached quote-leg grant (no
|
|
301
|
+
// settlementOutcome) and never reached the backend. Same F-A1-07 bug class.
|
|
302
|
+
request.commercePhase || "",
|
|
303
|
+
request.checkoutSessionId || ""
|
|
297
304
|
].join("|");
|
|
298
305
|
}
|
|
299
306
|
function getCachedResult(request, counterpartyId) {
|
|
@@ -2675,7 +2682,13 @@ var VerificationGatewayClient = class {
|
|
|
2675
2682
|
debug: options.debug,
|
|
2676
2683
|
customHeaders: options.customHeaders,
|
|
2677
2684
|
counterpartyUrl: options.counterpartyUrl,
|
|
2678
|
-
counterpartyType: options.counterpartyType
|
|
2685
|
+
counterpartyType: options.counterpartyType,
|
|
2686
|
+
// 5.4.1 (UAT2): previously dropped here despite being a typed, documented
|
|
2687
|
+
// GatewayConfig field — a client-driven confirmCheckout() could never
|
|
2688
|
+
// identify its endpoint by ASTRAE id, so merchants with multiple
|
|
2689
|
+
// endpoints on one origin (or a stale row sharing the URL) resolved
|
|
2690
|
+
// non-deterministically by URL and could miss the first-party gate.
|
|
2691
|
+
counterpartyId: options.counterpartyId
|
|
2679
2692
|
};
|
|
2680
2693
|
this.timeout = options.timeout || 1e4;
|
|
2681
2694
|
this.retryConfig = options.retry || { maxRetries: 3, backoffMs: 1e3 };
|
|
@@ -2707,6 +2720,52 @@ var VerificationGatewayClient = class {
|
|
|
2707
2720
|
})
|
|
2708
2721
|
);
|
|
2709
2722
|
}
|
|
2723
|
+
/**
|
|
2724
|
+
* 5.4.0 (astra-pay): confirm-leg of a checkout — the ONLY call that may fire
|
|
2725
|
+
* first-party charge-at-redeem (server-side settlement on the owner's saved
|
|
2726
|
+
* instrument). This is the supported public surface for the confirm leg;
|
|
2727
|
+
* `verify()` deliberately does not expose the checkout fields, so settlement
|
|
2728
|
+
* can never fire by accident from a generic verify.
|
|
2729
|
+
*
|
|
2730
|
+
* Sends `commercePhase: 'confirm'` plus the checkout session id (per-cart
|
|
2731
|
+
* idempotency) and line items (order/receipt plane), and identifies the
|
|
2732
|
+
* merchant via `counterpartyUrl`/`counterpartyType` (required — the backend
|
|
2733
|
+
* only settles a merchant-mediated grant against a first-party storefront).
|
|
2734
|
+
* `purpose`/`action` default to the canonical shopping pair.
|
|
2735
|
+
*
|
|
2736
|
+
* Returns the full `VerificationResult`: read `.settlementOutcome` for the
|
|
2737
|
+
* settled/failed/requires_action/no_instrument outcome (+ `orderId`), and the
|
|
2738
|
+
* identity/policy/`failures` fields for a denial. On any non-`confirm`/first-
|
|
2739
|
+
* party path `settlementOutcome` is simply absent — no money moves.
|
|
2740
|
+
*/
|
|
2741
|
+
async confirmCheckout(options) {
|
|
2742
|
+
const credentials = {
|
|
2743
|
+
astraId: options.astraId,
|
|
2744
|
+
apiKey: options.apiKey,
|
|
2745
|
+
jwt: options.jwt
|
|
2746
|
+
};
|
|
2747
|
+
return this.executeWithRetry(
|
|
2748
|
+
() => verify(
|
|
2749
|
+
this.config,
|
|
2750
|
+
{
|
|
2751
|
+
credentials,
|
|
2752
|
+
purpose: options.purpose ?? "shopping",
|
|
2753
|
+
action: options.action ?? "shopping.purchase",
|
|
2754
|
+
transactionValue: options.transactionValue,
|
|
2755
|
+
currency: options.currency,
|
|
2756
|
+
commercePhase: "confirm",
|
|
2757
|
+
checkoutSessionId: options.checkoutSessionId,
|
|
2758
|
+
checkoutItems: options.checkoutItems,
|
|
2759
|
+
counterpartyUrl: options.counterpartyUrl,
|
|
2760
|
+
counterpartyType: options.counterpartyType
|
|
2761
|
+
},
|
|
2762
|
+
// 5.4.1 (UAT2 Bug B): the confirm leg must always reach the backend —
|
|
2763
|
+
// a cached quote-leg grant carries no settlementOutcome and would
|
|
2764
|
+
// silently skip settlement.
|
|
2765
|
+
{ bypassCache: true }
|
|
2766
|
+
)
|
|
2767
|
+
);
|
|
2768
|
+
}
|
|
2710
2769
|
/**
|
|
2711
2770
|
* Quick verification — checks credentials and policy in one call.
|
|
2712
2771
|
*
|