@stripe/link-cli 0.10.1 → 0.11.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/README.md +17 -1
- package/dist/cli.js +49 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -154,6 +154,18 @@ link-cli spend-request create ... \
|
|
|
154
154
|
|
|
155
155
|
In MCP/agent mode, pass as a structured object.
|
|
156
156
|
|
|
157
|
+
#### Metadata
|
|
158
|
+
|
|
159
|
+
Attach arbitrary string data to a spend request with the repeatable `--metadata` flag (`key:value` format). Max 50 keys, key ≤ 40 chars, value ≤ 500 chars.
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
link-cli spend-request create ... \
|
|
163
|
+
--metadata "order_id:ord_123" \
|
|
164
|
+
--metadata "team:growth"
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
In MCP/agent mode, pass `metadata` as a structured `{ key: value }` object.
|
|
168
|
+
|
|
157
169
|
#### Credential types
|
|
158
170
|
|
|
159
171
|
By default, a spend request provisions a virtual card. For merchants that support the [Machine Payments Protocol](https://mpp.dev) (HTTP 402) and the Stripe payment method, instead pass `--credential-type "shared_payment_token"`.
|
|
@@ -207,11 +219,13 @@ When you provide `--client-name`, the Link app displays it when you approve the
|
|
|
207
219
|
|
|
208
220
|
With `--interval`, the login command yields the verification code immediately and then polls inline until authenticated or timed out — no separate `auth status` call needed. This is recommended for agents that cannot relay the code while a separate polling command blocks their I/O channel.
|
|
209
221
|
|
|
210
|
-
`auth status` includes an `update` field when a newer version is available:
|
|
222
|
+
`auth status` reports the `scope` and `authorization_details` the current session was granted (echoed by the token endpoint at login/refresh and stored in the credential file), and includes an `update` field when a newer version is available:
|
|
211
223
|
|
|
212
224
|
```json
|
|
213
225
|
{
|
|
214
226
|
"authenticated": true,
|
|
227
|
+
"scope": "userinfo:read payment_methods.agentic",
|
|
228
|
+
"authorization_details": [{ "type": "source", "actions": ["read"] }],
|
|
215
229
|
"update": {
|
|
216
230
|
"current_version": "0.1.2",
|
|
217
231
|
"latest_version": "0.2.0",
|
|
@@ -220,6 +234,8 @@ With `--interval`, the login command yields the verification code immediately an
|
|
|
220
234
|
}
|
|
221
235
|
```
|
|
222
236
|
|
|
237
|
+
`scope` and `authorization_details` are only present when the token endpoint returned them.
|
|
238
|
+
|
|
223
239
|
Set `NO_UPDATE_NOTIFIER=1` to suppress update checks (for example, in CI).
|
|
224
240
|
|
|
225
241
|
All commands accept `--auth <path>` to store auth credentials in a specific file instead of the default location. `auth login` writes to this file; all other commands read from it. Useful for running multiple sessions with separate identities.
|
package/dist/cli.js
CHANGED
|
@@ -12656,7 +12656,11 @@ function resolveAuthInfo(envAccessToken2, authStorage2) {
|
|
|
12656
12656
|
source: "storage",
|
|
12657
12657
|
tokenPreview: `${auth.access_token.substring(0, 20)}...`,
|
|
12658
12658
|
tokenType: auth.token_type,
|
|
12659
|
-
credentialsPath
|
|
12659
|
+
credentialsPath,
|
|
12660
|
+
...auth.scope && { scope: auth.scope },
|
|
12661
|
+
...auth.authorization_details && {
|
|
12662
|
+
authorizationDetails: auth.authorization_details
|
|
12663
|
+
}
|
|
12660
12664
|
};
|
|
12661
12665
|
}
|
|
12662
12666
|
return { authenticated: false, source: "storage", credentialsPath };
|
|
@@ -12690,6 +12694,15 @@ var AuthStatus = ({
|
|
|
12690
12694
|
"Token type: ",
|
|
12691
12695
|
/* @__PURE__ */ jsx3(Text3, { bold: true, children: info.tokenType })
|
|
12692
12696
|
] }),
|
|
12697
|
+
info.source === "storage" && info.scope && /* @__PURE__ */ jsxs3(Text3, { children: [
|
|
12698
|
+
"Scope: ",
|
|
12699
|
+
/* @__PURE__ */ jsx3(Text3, { bold: true, children: info.scope })
|
|
12700
|
+
] }),
|
|
12701
|
+
info.source === "storage" && info.authorizationDetails && /* @__PURE__ */ jsxs3(Text3, { children: [
|
|
12702
|
+
"Authorization details:",
|
|
12703
|
+
" ",
|
|
12704
|
+
/* @__PURE__ */ jsx3(Text3, { bold: true, children: JSON.stringify(info.authorizationDetails) })
|
|
12705
|
+
] }),
|
|
12693
12706
|
info.source === "env" ? /* @__PURE__ */ jsxs3(Text3, { children: [
|
|
12694
12707
|
"Source: ",
|
|
12695
12708
|
/* @__PURE__ */ jsx3(Text3, { bold: true, children: "LINK_ACCESS_TOKEN" })
|
|
@@ -12730,6 +12743,10 @@ async function* pollAuthStatus(authResource, storage2, opts, update) {
|
|
|
12730
12743
|
access_token: `${auth.access_token.substring(0, 20)}...`,
|
|
12731
12744
|
token_type: auth.token_type,
|
|
12732
12745
|
credentials_path: storage2.getPath(),
|
|
12746
|
+
...auth.scope && { scope: auth.scope },
|
|
12747
|
+
...auth.authorization_details && {
|
|
12748
|
+
authorization_details: auth.authorization_details
|
|
12749
|
+
},
|
|
12733
12750
|
...update && { update }
|
|
12734
12751
|
};
|
|
12735
12752
|
}
|
|
@@ -12939,7 +12956,11 @@ function createAuthCli(authResource, getUpdateInfo2, authStorage2, envAccessToke
|
|
|
12939
12956
|
access_token: info.tokenPreview,
|
|
12940
12957
|
token_type: info.tokenType,
|
|
12941
12958
|
...info.source === "storage" && {
|
|
12942
|
-
credentials_path: info.credentialsPath
|
|
12959
|
+
credentials_path: info.credentialsPath,
|
|
12960
|
+
...info.scope && { scope: info.scope },
|
|
12961
|
+
...info.authorizationDetails && {
|
|
12962
|
+
authorization_details: info.authorizationDetails
|
|
12963
|
+
}
|
|
12943
12964
|
},
|
|
12944
12965
|
...update && { update }
|
|
12945
12966
|
};
|
|
@@ -16824,6 +16845,9 @@ var createOptions = z10.object({
|
|
|
16824
16845
|
force: z10.boolean().default(false).describe("Overwrite output file if it already exists"),
|
|
16825
16846
|
approvalDetail: z10.union([z10.string(), z10.record(z10.string(), z10.unknown())]).optional().describe(
|
|
16826
16847
|
"Approval details object (MCP/agent: pass as object; CLI: pass as JSON string). Required fields: approved_at (unix timestamp), approval_method (click|programmatic|voice), app_name, external_user_id. Optional: ip_address, user_agent, device_type (mobile|web), agent_log_id, external_user_name, external_session_id, authentication_method (biometric_face|biometric_fingerprint|passkey)."
|
|
16848
|
+
),
|
|
16849
|
+
metadata: z10.array(z10.union([z10.string(), z10.record(z10.string(), z10.string())])).default([]).describe(
|
|
16850
|
+
'Metadata key:value pair (repeatable). Attaches arbitrary string data to the spend request. Max 50 keys, key <= 40 chars, value <= 500 chars. Example: "order_id:ord_123"'
|
|
16827
16851
|
)
|
|
16828
16852
|
});
|
|
16829
16853
|
var listOptions3 = z10.object({
|
|
@@ -17019,6 +17043,16 @@ function createSpendRequestCli(repository, authStorage2, envAccessToken2) {
|
|
|
17019
17043
|
(item) => typeof item === "string" ? parseTotalFlag(item) : item
|
|
17020
17044
|
) : void 0;
|
|
17021
17045
|
const approvalDetails = opts.approvalDetail !== void 0 ? typeof opts.approvalDetail === "string" ? JSON.parse(opts.approvalDetail) : opts.approvalDetail : void 0;
|
|
17046
|
+
let metadata;
|
|
17047
|
+
if (opts.metadata?.length) {
|
|
17048
|
+
metadata = {};
|
|
17049
|
+
for (const item of opts.metadata) {
|
|
17050
|
+
Object.assign(
|
|
17051
|
+
metadata,
|
|
17052
|
+
typeof item === "string" ? parseKvString(item) : item
|
|
17053
|
+
);
|
|
17054
|
+
}
|
|
17055
|
+
}
|
|
17022
17056
|
const createParams = {
|
|
17023
17057
|
payment_details: opts.paymentMethodId,
|
|
17024
17058
|
credential_type: credentialType,
|
|
@@ -17033,7 +17067,8 @@ function createSpendRequestCli(repository, authStorage2, envAccessToken2) {
|
|
|
17033
17067
|
request_approval: requestApproval || void 0,
|
|
17034
17068
|
test: opts.test ? true : void 0,
|
|
17035
17069
|
approve: opts.approve ? true : void 0,
|
|
17036
|
-
approval_details: approvalDetails
|
|
17070
|
+
approval_details: approvalDetails,
|
|
17071
|
+
metadata
|
|
17037
17072
|
};
|
|
17038
17073
|
const outputFile = opts.outputFile;
|
|
17039
17074
|
const forceOverwrite = opts.force;
|
|
@@ -17755,7 +17790,11 @@ ${serializeRedactedFormBody(params)}`
|
|
|
17755
17790
|
access_token: resp.access_token,
|
|
17756
17791
|
refresh_token: resp.refresh_token,
|
|
17757
17792
|
expires_in: resp.expires_in,
|
|
17758
|
-
token_type: resp.token_type
|
|
17793
|
+
token_type: resp.token_type,
|
|
17794
|
+
...resp.scope && { scope: resp.scope },
|
|
17795
|
+
...resp.authorization_details && {
|
|
17796
|
+
authorization_details: resp.authorization_details
|
|
17797
|
+
}
|
|
17759
17798
|
};
|
|
17760
17799
|
}
|
|
17761
17800
|
if (status === 400) {
|
|
@@ -17835,7 +17874,11 @@ ${serializeRedactedFormBody(params)}`
|
|
|
17835
17874
|
access_token: resp.access_token,
|
|
17836
17875
|
refresh_token: resp.refresh_token,
|
|
17837
17876
|
expires_in: resp.expires_in,
|
|
17838
|
-
token_type: resp.token_type
|
|
17877
|
+
token_type: resp.token_type,
|
|
17878
|
+
...resp.scope && { scope: resp.scope },
|
|
17879
|
+
...resp.authorization_details && {
|
|
17880
|
+
authorization_details: resp.authorization_details
|
|
17881
|
+
}
|
|
17839
17882
|
};
|
|
17840
17883
|
}
|
|
17841
17884
|
};
|
|
@@ -18156,7 +18199,7 @@ function cacheUpdateInfo(value, ttlMs = UPDATE_CACHE_TTL_MS) {
|
|
|
18156
18199
|
}
|
|
18157
18200
|
|
|
18158
18201
|
// src/cli.tsx
|
|
18159
|
-
var cliVersion = "0.
|
|
18202
|
+
var cliVersion = "0.11.0";
|
|
18160
18203
|
var cliName = "@stripe/link-cli";
|
|
18161
18204
|
var defaultHeaders = {
|
|
18162
18205
|
"User-Agent": `link-cli/${cliVersion}`
|