@agent-cards/sdk 0.23.28 → 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.
Files changed (97) hide show
  1. package/CHANGELOG.md +58 -0
  2. package/PREFLIGHT.md +7 -1
  3. package/README.md +137 -99
  4. package/dist/aci.d.ts +52 -22
  5. package/dist/aci.js +79 -15
  6. package/dist/adyen-merchant-hosted.generated.d.ts +1 -1
  7. package/dist/adyen-merchant-hosted.generated.js +459 -21
  8. package/dist/agent-amount.generated.js +1 -1
  9. package/dist/agentcard.d.ts +4 -5
  10. package/dist/agentcard.js +4 -5
  11. package/dist/amadeus.d.ts +9 -3
  12. package/dist/amadeus.js +33 -4
  13. package/dist/api-module.d.ts +1 -7
  14. package/dist/api-module.js +3 -5
  15. package/dist/{voice-retry.js → api-retry.js} +1 -1
  16. package/dist/api-types.d.ts +53 -0
  17. package/dist/{voice-types.js → api-types.js} +7 -2
  18. package/dist/approvals.d.ts +166 -0
  19. package/dist/approvals.js +213 -0
  20. package/dist/buy.d.ts +20 -101
  21. package/dist/buy.js +19 -74
  22. package/dist/capabilities.generated.js +1 -1
  23. package/dist/card-fields.generated.js +1398 -106
  24. package/dist/cdp.d.ts +3 -13
  25. package/dist/cdp.js +231 -175
  26. package/dist/client.d.ts +104 -22
  27. package/dist/client.js +215 -40
  28. package/dist/creditguard.generated.d.ts +4 -4
  29. package/dist/datatrans.generated.js +22 -1
  30. package/dist/elavon-converge.generated.js +5 -3
  31. package/dist/hold.d.ts +8 -0
  32. package/dist/hold.js +43 -2
  33. package/dist/hosted-entry.js +2 -0
  34. package/dist/index.d.ts +9 -15
  35. package/dist/index.js +6 -10
  36. package/dist/lifecycle.d.ts +9 -61
  37. package/dist/lifecycle.js +24 -10
  38. package/dist/merchant-card-endpoints.generated.d.ts +6 -1
  39. package/dist/merchant-card-endpoints.generated.js +344 -19
  40. package/dist/merchant-hosted.d.ts +8 -1
  41. package/dist/nike-order.d.ts +51 -0
  42. package/dist/nike-order.js +81 -0
  43. package/dist/oceanpayment.d.ts +38 -0
  44. package/dist/oceanpayment.js +70 -0
  45. package/dist/paddle-tokenex.generated.js +105 -10
  46. package/dist/payplug.d.ts +41 -0
  47. package/dist/payplug.js +71 -0
  48. package/dist/payrails.generated.js +27 -7
  49. package/dist/pre-claim.d.ts +9 -0
  50. package/dist/pre-claim.js +86 -7
  51. package/dist/preflight-capabilities.generated.d.ts +0 -4
  52. package/dist/preflight-capabilities.generated.js +0 -5
  53. package/dist/preflight-catalog.json +46 -5
  54. package/dist/preflight-playwright.d.ts +2 -2
  55. package/dist/preflight-playwright.js +63 -14
  56. package/dist/preflight-schemas.json +4 -0
  57. package/dist/preflight.generated.d.ts +0 -4
  58. package/dist/preflight.generated.js +24 -1
  59. package/dist/prepared-processor.d.ts +18 -5
  60. package/dist/prepared-processor.js +48 -8
  61. package/dist/primer.generated.js +1418 -120
  62. package/dist/processout.generated.d.ts +61 -0
  63. package/dist/processout.generated.js +577 -0
  64. package/dist/requests.js +1 -1
  65. package/dist/shiji-sts.generated.js +105 -10
  66. package/dist/stripe-checkout.generated.js +1405 -234
  67. package/dist/substitutions.generated.js +460 -26
  68. package/dist/tap-payments.generated.js +105 -10
  69. package/dist/twoc2p.generated.js +105 -10
  70. package/dist/url-masks/bluesnap.d.ts +2 -0
  71. package/dist/url-masks/bluesnap.js +15 -0
  72. package/dist/url-masks/oceanpayment.d.ts +2 -0
  73. package/dist/url-masks/oceanpayment.js +13 -0
  74. package/dist/url-masks/payplug.d.ts +2 -0
  75. package/dist/url-masks/payplug.js +13 -0
  76. package/dist/url-masks/vtex_payments.d.ts +2 -0
  77. package/dist/url-masks/vtex_payments.js +12 -0
  78. package/dist/url-masks.generated.d.ts +1 -1
  79. package/dist/url-masks.generated.js +6 -2
  80. package/dist/verifone.generated.js +42 -2
  81. package/dist/vtex-payments.generated.d.ts +127 -0
  82. package/dist/vtex-payments.generated.js +544 -0
  83. package/dist/webhooks.d.ts +2 -2
  84. package/dist/webhooks.js +2 -2
  85. package/examples/preflight/kernel-native/inventory.json +1 -1
  86. package/package.json +6 -8
  87. package/dist/languages.d.ts +0 -23
  88. package/dist/languages.js +0 -76
  89. package/dist/voice-pkce.d.ts +0 -49
  90. package/dist/voice-pkce.js +0 -147
  91. package/dist/voice-stream.generated.d.ts +0 -118
  92. package/dist/voice-stream.generated.js +0 -170
  93. package/dist/voice-types.d.ts +0 -735
  94. package/dist/voice.d.ts +0 -373
  95. package/dist/voice.js +0 -815
  96. package/readme.test.mjs +0 -53
  97. /package/dist/{voice-retry.d.ts → api-retry.d.ts} +0 -0
package/readme.test.mjs DELETED
@@ -1,53 +0,0 @@
1
- // The README's hello world, run as written against the stub. The block is read
2
- // off README.md, its import is pointed at dist, `returnLink` (the link the
3
- // app's sheet came back with) is taken from the stub, and the client is aimed
4
- // at the stub; nothing else changes, so a line that stops running here stops
5
- // the test.
6
- import assert from 'node:assert/strict';
7
- import fs from 'node:fs';
8
- import { test } from 'node:test';
9
- import { startStub } from './voice-stub.mjs';
10
-
11
- const AsyncFunction = Object.getPrototypeOf(async function () {}).constructor;
12
-
13
- /** The first fenced block after the heading, as text. */
14
- export function readmeBlock(file, heading) {
15
- const md = fs.readFileSync(file, 'utf8');
16
- const at = md.indexOf(`\n${heading}\n`);
17
- assert.ok(at >= 0, `${heading} is in ${file}`);
18
- const m = /```[a-z]*\n([\s\S]*?)```/.exec(md.slice(at));
19
- assert.ok(m, `a code block follows ${heading}`);
20
- return m[1];
21
- }
22
-
23
- test("the hello world runs as written: connect, the sheet's return link, a sandbox purchase, the result", async () => {
24
- // The API names the client's mode on the token exchange; the hello world names none itself.
25
- const stub = await startStub({ tokenSandbox: true });
26
- try {
27
- let code = readmeBlock(new URL('./README.md', import.meta.url), '## Hello world');
28
- assert.equal(code.trim().split('\n').filter((l) => l.trim()).length, 7, 'seven lines');
29
- assert.match(code, /request: 'sandbox'/); assert.match(code, /user_id: person\.user_id/);
30
- assert.doesNotMatch(code, /sandbox: true/, 'sandbox and live are decided by the credentials, never named in code');
31
- // The import becomes a dynamic one on dist; the client is aimed at the stub; the return link is the stub's.
32
- code = code.replace(/^import \{([^}]+)\} from '@agent-cards\/sdk';/m, "const {$1} = await import('./dist/index.js');");
33
- code = code.replace('new Agentcard({', 'new Agentcard({ baseUrl: stub.baseUrl, pollIntervalMs: 10,');
34
- code = code.replace('completeConnect(returnLink)', 'completeConnect(stub.state.returnLinkFor(link.session_id))');
35
- process.env.AGENTCARD_CLIENT_ID = 'cid'; process.env.AGENTCARD_CLIENT_SECRET = 'acs_good';
36
- // The person approves while the server waits.
37
- const approve = setInterval(() => { for (const row of stub.state.authorizations.values()) { row.status = 'approved'; row.approved_with = 'voice'; } }, 20);
38
- try {
39
- const run = new AsyncFunction('stub', code + '\nreturn { agentcard, link, person, purchase, card, cards, result };');
40
- const out = await run(stub);
41
- assert.equal(out.agentcard.sandbox, true, 'the client learned its mode from the token exchange');
42
- assert.equal(out.link.grant, 'exchange');
43
- assert.equal(out.person.user_id, 'usr_1');
44
- assert.equal(out.purchase.status, 'awaiting_approval');
45
- assert.match(out.purchase.approval_url, /^http:\/\/vault\.test\/authorize\?id=cauth_/);
46
- assert.equal(out.result.status, 'approved'); assert.equal(out.result.approved_with, 'voice');
47
- // The card that pays rides the create (decision 213): named, with the recommendation's reason, and the others beside it.
48
- assert.equal(out.card.id, 'vc_sapphire'); assert.match(out.card.reason, /3x on shopping/); assert.equal(out.cards.length, 2);
49
- const create = stub.state.requests.find((r) => r.path === '/v2/checkout/authorizations').body;
50
- assert.equal(create.user, 'usr_1'); assert.match(create.request.url, /pi_sandbox/);
51
- } finally { clearInterval(approve); }
52
- } finally { await stub.close(); }
53
- });
File without changes