@agent-cards/sdk 0.23.27 → 0.24.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 +66 -0
- package/PREFLIGHT.md +7 -1
- package/README.md +137 -99
- package/dist/aci.d.ts +52 -22
- package/dist/aci.js +79 -15
- package/dist/adyen-merchant-hosted.generated.d.ts +1 -1
- package/dist/adyen-merchant-hosted.generated.js +459 -21
- package/dist/agent-amount.generated.js +1 -1
- package/dist/agentcard.d.ts +4 -5
- package/dist/agentcard.js +4 -5
- package/dist/amadeus.d.ts +9 -3
- package/dist/amadeus.js +33 -4
- package/dist/api-module.d.ts +1 -7
- package/dist/api-module.js +3 -5
- package/dist/{voice-retry.js → api-retry.js} +1 -1
- package/dist/api-types.d.ts +53 -0
- package/dist/{voice-types.js → api-types.js} +7 -2
- package/dist/approvals.d.ts +166 -0
- package/dist/approvals.js +213 -0
- package/dist/buy.d.ts +20 -101
- package/dist/buy.js +19 -74
- package/dist/capabilities.generated.js +1 -1
- package/dist/card-fields.generated.js +1398 -106
- package/dist/cdp.d.ts +3 -13
- package/dist/cdp.js +231 -175
- package/dist/client.d.ts +104 -22
- package/dist/client.js +215 -40
- package/dist/creditguard.generated.d.ts +4 -4
- package/dist/datatrans.generated.js +22 -1
- package/dist/elavon-converge.generated.js +5 -3
- package/dist/hold.d.ts +8 -0
- package/dist/hold.js +43 -2
- package/dist/hosted-entry.js +2 -0
- package/dist/index.d.ts +9 -15
- package/dist/index.js +6 -10
- package/dist/juspay-gate.js +2 -2
- package/dist/juspay.generated.d.ts +2 -2
- package/dist/juspay.generated.js +174 -4
- package/dist/lifecycle.d.ts +9 -61
- package/dist/lifecycle.js +24 -10
- package/dist/merchant-card-endpoints.generated.d.ts +6 -1
- package/dist/merchant-card-endpoints.generated.js +344 -19
- package/dist/merchant-hosted.d.ts +8 -1
- package/dist/nike-order.d.ts +51 -0
- package/dist/nike-order.js +81 -0
- package/dist/oceanpayment.d.ts +38 -0
- package/dist/oceanpayment.js +70 -0
- package/dist/paddle-tokenex.generated.js +105 -10
- package/dist/payplug.d.ts +41 -0
- package/dist/payplug.js +71 -0
- package/dist/payrails.generated.js +27 -7
- package/dist/payrexx.generated.js +176 -2
- package/dist/pre-claim.d.ts +9 -0
- package/dist/pre-claim.js +86 -7
- package/dist/preflight-capabilities.generated.d.ts +0 -4
- package/dist/preflight-capabilities.generated.js +0 -5
- package/dist/preflight-catalog.json +46 -5
- package/dist/preflight-playwright.d.ts +2 -2
- package/dist/preflight-playwright.js +63 -14
- package/dist/preflight-schemas.json +4 -0
- package/dist/preflight.generated.d.ts +0 -4
- package/dist/preflight.generated.js +24 -1
- package/dist/prepared-processor.d.ts +18 -5
- package/dist/prepared-processor.js +48 -8
- package/dist/primer.generated.js +1418 -120
- package/dist/processout.generated.d.ts +61 -0
- package/dist/processout.generated.js +577 -0
- package/dist/requests.js +1 -1
- package/dist/shiji-sts.generated.js +105 -10
- package/dist/stripe-checkout.generated.js +1405 -234
- package/dist/substitutions.generated.js +460 -26
- package/dist/tap-payments.generated.js +105 -10
- package/dist/twoc2p.generated.js +105 -10
- package/dist/url-masks/bluesnap.d.ts +2 -0
- package/dist/url-masks/bluesnap.js +15 -0
- package/dist/url-masks/oceanpayment.d.ts +2 -0
- package/dist/url-masks/oceanpayment.js +13 -0
- package/dist/url-masks/payplug.d.ts +2 -0
- package/dist/url-masks/payplug.js +13 -0
- package/dist/url-masks/vtex_payments.d.ts +2 -0
- package/dist/url-masks/vtex_payments.js +12 -0
- package/dist/url-masks.generated.d.ts +1 -1
- package/dist/url-masks.generated.js +6 -2
- package/dist/verifone.generated.js +42 -2
- package/dist/vtex-payments.generated.d.ts +127 -0
- package/dist/vtex-payments.generated.js +544 -0
- package/dist/webhooks.d.ts +2 -2
- package/dist/webhooks.js +2 -2
- package/dist/wspay.generated.d.ts +1 -1
- package/dist/wspay.generated.js +175 -3
- package/examples/preflight/kernel-native/inventory.json +1 -1
- package/package.json +6 -8
- package/dist/languages.d.ts +0 -23
- package/dist/languages.js +0 -76
- package/dist/voice-pkce.d.ts +0 -49
- package/dist/voice-pkce.js +0 -147
- package/dist/voice-stream.generated.d.ts +0 -118
- package/dist/voice-stream.generated.js +0 -170
- package/dist/voice-types.d.ts +0 -735
- package/dist/voice.d.ts +0 -373
- package/dist/voice.js +0 -815
- package/readme.test.mjs +0 -53
- /package/dist/{voice-retry.d.ts → api-retry.d.ts} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
2
|
// Generated from @agent-cards/payment-core. Do not edit.
|
|
3
|
-
// artifact-sha256:
|
|
3
|
+
// artifact-sha256: e9f7e427a2cae183ce249c0adeabab974d75c413b81cf9f1a7d013fb1d962e31
|
|
4
4
|
// src/sha256.js
|
|
5
5
|
var K = /* @__PURE__ */ new Uint32Array([
|
|
6
6
|
1116352408,
|
|
@@ -335,9 +335,64 @@ function isPlainObject(v) {
|
|
|
335
335
|
return !!v && typeof v === "object" && !Array.isArray(v);
|
|
336
336
|
}
|
|
337
337
|
var MAX_PATH_STEPS = 16;
|
|
338
|
+
var MAX_TEXT_STEPS = 2;
|
|
339
|
+
function isTextStep(step) {
|
|
340
|
+
return isPlainObject(step) && Object.keys(step).length === 1 && step.text === "json";
|
|
341
|
+
}
|
|
342
|
+
function sameStep(a, b) {
|
|
343
|
+
return a === b || isTextStep(a) && isTextStep(b);
|
|
344
|
+
}
|
|
345
|
+
function spellJson(parsed, form) {
|
|
346
|
+
const text = JSON.stringify(parsed);
|
|
347
|
+
if (form !== "php")
|
|
348
|
+
return text;
|
|
349
|
+
return text.replace(/\//g, "\\/").replace(/[\u0080-\uffff]/g, (unit) => `\\u${unit.charCodeAt(0).toString(16).padStart(4, "0")}`);
|
|
350
|
+
}
|
|
351
|
+
function jsonTextForm(value) {
|
|
352
|
+
if (typeof value !== "string" || !/^[[{]/.test(value))
|
|
353
|
+
return void 0;
|
|
354
|
+
let parsed;
|
|
355
|
+
try {
|
|
356
|
+
parsed = JSON.parse(value);
|
|
357
|
+
}
|
|
358
|
+
catch {
|
|
359
|
+
return void 0;
|
|
360
|
+
}
|
|
361
|
+
if (parsed === null || typeof parsed !== "object")
|
|
362
|
+
return void 0;
|
|
363
|
+
for (const form of ["js", "php"]) {
|
|
364
|
+
try {
|
|
365
|
+
if (spellJson(parsed, form) === value)
|
|
366
|
+
return { parsed, form };
|
|
367
|
+
}
|
|
368
|
+
catch {
|
|
369
|
+
return void 0;
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
return void 0;
|
|
373
|
+
}
|
|
374
|
+
function jsonText(value) {
|
|
375
|
+
return jsonTextForm(value)?.parsed;
|
|
376
|
+
}
|
|
338
377
|
function isJsonPath(path) {
|
|
339
378
|
return Array.isArray(path) && path.length <= MAX_PATH_STEPS && path.every((step) => typeof step === "string" ? step.length > 0 && !FORBIDDEN_KEYS.has(step) : Number.isSafeInteger(step) && step >= 0);
|
|
340
379
|
}
|
|
380
|
+
function isProfilePath(path) {
|
|
381
|
+
if (!Array.isArray(path) || path.length > MAX_PATH_STEPS)
|
|
382
|
+
return false;
|
|
383
|
+
let texts = 0;
|
|
384
|
+
for (const [i, step] of path.entries()) {
|
|
385
|
+
if (isTextStep(step)) {
|
|
386
|
+
texts += 1;
|
|
387
|
+
if (i === 0 || i === path.length - 1 || isTextStep(path[i - 1]) || texts > MAX_TEXT_STEPS)
|
|
388
|
+
return false;
|
|
389
|
+
}
|
|
390
|
+
else if (!isJsonPath([step])) {
|
|
391
|
+
return false;
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
return true;
|
|
395
|
+
}
|
|
341
396
|
function jsonAt(root, path) {
|
|
342
397
|
let node = root;
|
|
343
398
|
for (const step of path) {
|
|
@@ -352,6 +407,42 @@ function jsonAt(root, path) {
|
|
|
352
407
|
}
|
|
353
408
|
return { found: true, value: node };
|
|
354
409
|
}
|
|
410
|
+
function profileAt(root, path) {
|
|
411
|
+
if (!isProfilePath(path))
|
|
412
|
+
return { found: false };
|
|
413
|
+
let node = root;
|
|
414
|
+
for (const step of path) {
|
|
415
|
+
if (isTextStep(step)) {
|
|
416
|
+
const inner = jsonText(node);
|
|
417
|
+
if (inner === void 0)
|
|
418
|
+
return { found: false };
|
|
419
|
+
node = inner;
|
|
420
|
+
continue;
|
|
421
|
+
}
|
|
422
|
+
const at = jsonAt(node, [step]);
|
|
423
|
+
if (!at.found)
|
|
424
|
+
return { found: false };
|
|
425
|
+
node = at.value;
|
|
426
|
+
}
|
|
427
|
+
return { found: true, value: node };
|
|
428
|
+
}
|
|
429
|
+
function editAtProfilePath(root, path, edit) {
|
|
430
|
+
const at = profileAt(root, path);
|
|
431
|
+
if (!at.found || !isPlainObject(at.value))
|
|
432
|
+
return false;
|
|
433
|
+
const k = path.findIndex(isTextStep);
|
|
434
|
+
if (k === -1) {
|
|
435
|
+
edit(at.value);
|
|
436
|
+
return true;
|
|
437
|
+
}
|
|
438
|
+
const holder = jsonAt(root, path.slice(0, k - 1)).value;
|
|
439
|
+
const key = path[k - 1];
|
|
440
|
+
const text = jsonTextForm(holder[key]);
|
|
441
|
+
if (!text || !editAtProfilePath(text.parsed, path.slice(k + 1), edit))
|
|
442
|
+
return false;
|
|
443
|
+
holder[key] = spellJson(text.parsed, text.form);
|
|
444
|
+
return true;
|
|
445
|
+
}
|
|
355
446
|
function roundTrips(parsed, body) {
|
|
356
447
|
try {
|
|
357
448
|
return JSON.stringify(parsed) === body;
|
|
@@ -361,17 +452,17 @@ function roundTrips(parsed, body) {
|
|
|
361
452
|
}
|
|
362
453
|
}
|
|
363
454
|
function sameSteps(a, b) {
|
|
364
|
-
return Array.isArray(a) && Array.isArray(b) && a.length === b.length && a.every((step, i) => step
|
|
455
|
+
return Array.isArray(a) && Array.isArray(b) && a.length === b.length && a.every((step, i) => sameStep(step, b[i]));
|
|
365
456
|
}
|
|
366
457
|
function pathsOverlap(a, b) {
|
|
367
458
|
const n = Math.min(a.length, b.length);
|
|
368
459
|
for (let i = 0; i < n; i += 1)
|
|
369
|
-
if (a[i]
|
|
460
|
+
if (!sameStep(a[i], b[i]))
|
|
370
461
|
return false;
|
|
371
462
|
return true;
|
|
372
463
|
}
|
|
373
464
|
function describePath(path) {
|
|
374
|
-
return path.length ? path.map((step) => typeof step === "number" ? `[${step}]` : `.${step}`).join("").replace(/^\./, "") : "(root)";
|
|
465
|
+
return path.length ? path.map((step) => typeof step === "number" ? `[${step}]` : isTextStep(step) ? "<json>" : `.${step}`).join("").replace(/^\./, "") : "(root)";
|
|
375
466
|
}
|
|
376
467
|
// src/substitution-primitives.js
|
|
377
468
|
var SubstitutionError = class extends Error {
|
|
@@ -420,7 +511,7 @@ function swapMerchantHostedFields(body, spec, ciphertext = ADYEN_JWE) {
|
|
|
420
511
|
const path = Array.isArray(spec.path) ? [...spec.path] : spec.path;
|
|
421
512
|
const fields = isPlainObject(spec.fields) ? Object.fromEntries(Object.entries(spec.fields)) : null;
|
|
422
513
|
const remove = Array.isArray(spec.remove) ? [...spec.remove] : spec.remove ?? [];
|
|
423
|
-
if (!
|
|
514
|
+
if (!isProfilePath(path))
|
|
424
515
|
throw new SubstitutionError("refusing substitution path");
|
|
425
516
|
if (!fields || Object.keys(fields).length === 0)
|
|
426
517
|
throw new SubstitutionError("substitutions carry no fields");
|
|
@@ -454,7 +545,7 @@ function swapMerchantHostedFields(body, spec, ciphertext = ADYEN_JWE) {
|
|
|
454
545
|
}
|
|
455
546
|
if (!isPlainObject(parsed))
|
|
456
547
|
throw new SubstitutionError("the paused body is not a JSON object");
|
|
457
|
-
const holder =
|
|
548
|
+
const holder = profileAt(parsed, path);
|
|
458
549
|
if (!holder.found || !isPlainObject(holder.value))
|
|
459
550
|
throw new SubstitutionError(`the paused body has no object at ${describePath(path)}`);
|
|
460
551
|
const swaps = /* @__PURE__ */ new Map();
|
|
@@ -506,15 +597,19 @@ function swapMerchantHostedFields(body, spec, ciphertext = ADYEN_JWE) {
|
|
|
506
597
|
catch {
|
|
507
598
|
throw new SubstitutionError("the substituted body is not JSON");
|
|
508
599
|
}
|
|
509
|
-
const written =
|
|
600
|
+
const written = profileAt(out, path);
|
|
510
601
|
if (!written.found || !isPlainObject(written.value) || names.some((name) => written.value[name] !== fields[name]) || dummies.some((dummy) => swapped.includes(dummy))) {
|
|
511
602
|
throw new SubstitutionError(`the substitution did not land at ${describePath(path)}`);
|
|
512
603
|
}
|
|
513
604
|
if (remove.length === 0 && set.length === 0)
|
|
514
605
|
return swapped;
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
606
|
+
if (remove.length > 0 && !editAtProfilePath(out, path, (object) => {
|
|
607
|
+
for (const key of remove)
|
|
608
|
+
if (Object.prototype.hasOwnProperty.call(object, key))
|
|
609
|
+
delete object[key];
|
|
610
|
+
})) {
|
|
611
|
+
throw new SubstitutionError(`the substitution did not land at ${describePath(path)}`);
|
|
612
|
+
}
|
|
518
613
|
for (const entry of set) {
|
|
519
614
|
const parent = jsonAt(out, entry.path.slice(0, -1));
|
|
520
615
|
if (!parent.found || !isPlainObject(parent.value))
|