@clickraft/cli 0.1.6 → 0.1.8

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/index.js CHANGED
@@ -1722,7 +1722,8 @@ async function runDeviceFlow(opts) {
1722
1722
  apiBaseUrl: opts.apiBaseUrl,
1723
1723
  clientId: opts.clientId,
1724
1724
  deviceCode: authResp.device_code,
1725
- signal: opts.signal
1725
+ signal: opts.signal,
1726
+ cloudflareAccess: opts.cloudflareAccess
1726
1727
  });
1727
1728
  if (result.kind === "success") {
1728
1729
  return result.token;
@@ -1757,11 +1758,16 @@ async function runDeviceFlow(opts) {
1757
1758
  }
1758
1759
  async function requestDeviceAuthorization(opts) {
1759
1760
  const body = new URLSearchParams({ client_id: opts.clientId, scope: opts.scope }).toString();
1761
+ const headers = { "content-type": FORM_CONTENT_TYPE };
1762
+ if (opts.cloudflareAccess) {
1763
+ headers["cf-access-client-id"] = opts.cloudflareAccess.clientId;
1764
+ headers["cf-access-client-secret"] = opts.cloudflareAccess.clientSecret;
1765
+ }
1760
1766
  let resp;
1761
1767
  try {
1762
1768
  resp = await request(`${opts.apiBaseUrl}/oauth/device-authorization`, {
1763
1769
  method: "POST",
1764
- headers: { "content-type": FORM_CONTENT_TYPE },
1770
+ headers,
1765
1771
  body,
1766
1772
  signal: opts.signal
1767
1773
  });
@@ -1828,11 +1834,16 @@ async function pollToken(args) {
1828
1834
  device_code: args.deviceCode,
1829
1835
  grant_type: GRANT_TYPE
1830
1836
  }).toString();
1837
+ const headers = { "content-type": FORM_CONTENT_TYPE };
1838
+ if (args.cloudflareAccess) {
1839
+ headers["cf-access-client-id"] = args.cloudflareAccess.clientId;
1840
+ headers["cf-access-client-secret"] = args.cloudflareAccess.clientSecret;
1841
+ }
1831
1842
  let resp;
1832
1843
  try {
1833
1844
  resp = await request(`${args.apiBaseUrl}/oauth/token`, {
1834
1845
  method: "POST",
1835
- headers: { "content-type": FORM_CONTENT_TYPE },
1846
+ headers,
1836
1847
  body,
1837
1848
  signal: args.signal
1838
1849
  });
@@ -2036,7 +2047,8 @@ async function login(options) {
2036
2047
  scope,
2037
2048
  onUserCode: options.onUserCode,
2038
2049
  onPoll: options.onPoll,
2039
- signal: options.signal
2050
+ signal: options.signal,
2051
+ cloudflareAccess: config.cloudflareAccess
2040
2052
  });
2041
2053
  const profile = buildCredentialsProfile({ token, apiBaseUrl });
2042
2054
  await setProfile(profileName, profile, options.credentialsPath);
@@ -2212,7 +2224,7 @@ var TokenRowSchema = z6.object({
2212
2224
  id: z6.string().uuid(),
2213
2225
  organizationId: z6.string().uuid(),
2214
2226
  userId: z6.string().uuid(),
2215
- clientId: z6.string(),
2227
+ clientId: z6.string().nullable(),
2216
2228
  tokenPrefix: z6.string(),
2217
2229
  name: z6.string().nullable(),
2218
2230
  scopes: z6.array(z6.string()),