@fluid-app/fluid-cli 0.1.492 → 0.1.493

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.
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { A as identityToken, B as isIdentityProfile, C as readConfig, D as getConfigDir, E as isStrictConfig, F as signInWithBrowser, G as getFluidApiBase, I as signOutIdentity, J as signup, K as redeemIdentityLink, L as resolveIdentityUrl, M as primeIdentityProfile, P as sessionFacts, T as writeConfig, U as confirmMfa, V as FLUID_API_ERROR, W as fetchUserCompanies, X as validateToken, Y as switchCompany, _ as getAuthToken, c as inputsModeActive, dt as rootCommand, ft as visibleOptions, g as getActiveProfile, i as INPUTS_MODE_ENV, k as describeIdentityError, l as registerInputsHook, mt as walkCommands, pt as visibleSubcommands, q as sendMfa, s as exitOnInputsError, u as createInputsReader, ut as filterCatalog, w as updateConfig, x as resolveCredentialSource } from "../hook-CPmRkza4.mjs";
2
+ import { A as identityToken, B as isIdentityProfile, C as readConfig, D as getConfigDir, E as isStrictConfig, F as signInWithBrowser, G as getFluidApiBase, I as signOutIdentity, J as signup, K as redeemIdentityLink, L as resolveIdentityUrl, M as primeIdentityProfile, P as sessionFacts, T as writeConfig, U as confirmMfa, V as FLUID_API_ERROR, W as fetchUserCompanies, X as validateToken, Y as switchCompany, _ as getAuthToken, c as inputsModeActive, dt as rootCommand, ft as visibleOptions, g as getActiveProfile, i as INPUTS_MODE_ENV, k as describeIdentityError, l as registerInputsHook, mt as walkCommands, pt as visibleSubcommands, q as sendMfa, s as exitOnInputsError, u as createInputsReader, ut as filterCatalog, w as updateConfig, x as resolveCredentialSource } from "../hook-Bt98kSKV.mjs";
3
3
  import { createRequire } from "node:module";
4
4
  import { existsSync, mkdirSync, readFileSync, readdirSync, realpathSync, renameSync, rmSync, unlinkSync, writeFileSync } from "node:fs";
5
5
  import { fileURLToPath, pathToFileURL } from "node:url";
@@ -105,6 +105,15 @@ function filterCatalog(entries, root, prefix) {
105
105
  return entries.filter((entry) => base.every((word, index) => entry.path[index] === word));
106
106
  }
107
107
  //#endregion
108
+ //#region package.json
109
+ var version = "0.1.493";
110
+ //#endregion
111
+ //#region src/auth/client-headers.ts
112
+ const CLIENT_HEADERS = {
113
+ "X-Fluid-Client": "cli",
114
+ "X-Fluid-Client-Version": version
115
+ };
116
+ //#endregion
108
117
  //#region src/utils/result.ts
109
118
  function success(value) {
110
119
  return {
@@ -168,6 +177,10 @@ function getErrorMessage$1(error) {
168
177
  }
169
178
  //#endregion
170
179
  //#region src/auth/fluid-api.ts
180
+ /**
181
+ * Fluid API client for authentication operations, and the public signup
182
+ * that comes before any of them
183
+ */
171
184
  const API_TIMEOUT_MS = 1e4;
172
185
  const SIGNUP_TIMEOUT_MS = 6e4;
173
186
  function getFluidApiBase() {
@@ -239,7 +252,10 @@ async function validateToken(token, options = {}) {
239
252
  try {
240
253
  const response = await fetch(`${options.baseUrl ?? getFluidApiBase()}/api/company/v1/companies/me`, {
241
254
  method: "GET",
242
- headers: { Authorization: `Bearer ${token}` },
255
+ headers: {
256
+ ...CLIENT_HEADERS,
257
+ Authorization: `Bearer ${token}`
258
+ },
243
259
  signal
244
260
  });
245
261
  if (response.ok) {
@@ -271,7 +287,10 @@ async function sendMfa(email, options = {}) {
271
287
  try {
272
288
  const response = await fetch(`${getFluidApiBase()}/api/authentication/send_mfa`, {
273
289
  method: "POST",
274
- headers: { "Content-Type": "application/json" },
290
+ headers: {
291
+ ...CLIENT_HEADERS,
292
+ "Content-Type": "application/json"
293
+ },
275
294
  body: JSON.stringify(options.fluidShop ? {
276
295
  email,
277
296
  fluid_shop: options.fluidShop
@@ -310,7 +329,10 @@ async function confirmMfa(uuid, code, options = {}) {
310
329
  try {
311
330
  const response = await fetch(`${apiBase}/api/authentication/confirm_mfa`, {
312
331
  method: "POST",
313
- headers: { "Content-Type": "application/json" },
332
+ headers: {
333
+ ...CLIENT_HEADERS,
334
+ "Content-Type": "application/json"
335
+ },
314
336
  body: JSON.stringify({
315
337
  uuid,
316
338
  multi_factor_authentication: { verification_code: code },
@@ -357,7 +379,10 @@ async function redeemIdentityLink(token, options = {}) {
357
379
  try {
358
380
  const response = await fetch(`${options.baseUrl ?? getFluidApiBase()}/api/v2026-10/single-sign-ons/identity-link-redemptions`, {
359
381
  method: "POST",
360
- headers: { "Content-Type": "application/json" },
382
+ headers: {
383
+ ...CLIENT_HEADERS,
384
+ "Content-Type": "application/json"
385
+ },
361
386
  body: JSON.stringify({ token }),
362
387
  signal
363
388
  });
@@ -388,7 +413,10 @@ async function fetchUserCompanies(token, baseUrl) {
388
413
  try {
389
414
  const response = await fetch(`${apiBase}/api/me`, {
390
415
  method: "GET",
391
- headers: { Authorization: `Bearer ${token}` },
416
+ headers: {
417
+ ...CLIENT_HEADERS,
418
+ Authorization: `Bearer ${token}`
419
+ },
392
420
  signal
393
421
  });
394
422
  if (response.ok) {
@@ -422,6 +450,7 @@ async function switchCompany(token, companyId, baseUrl) {
422
450
  const response = await fetch(`${apiBase}/api/authentication/company/${companyId}/switch`, {
423
451
  method: "PUT",
424
452
  headers: {
453
+ ...CLIENT_HEADERS,
425
454
  Authorization: `Bearer ${token}`,
426
455
  "Content-Type": "application/json"
427
456
  },
@@ -551,7 +580,10 @@ async function signup(request) {
551
580
  try {
552
581
  const response = await fetch(`${getFluidApiBase()}/api/company`, {
553
582
  method: "POST",
554
- headers: { "Content-Type": "application/json" },
583
+ headers: {
584
+ ...CLIENT_HEADERS,
585
+ "Content-Type": "application/json"
586
+ },
555
587
  body: JSON.stringify({
556
588
  user: {
557
589
  first_name: request.firstName,
@@ -3886,4 +3918,4 @@ function exitOnInputsError(error, io = processIo) {
3886
3918
  //#endregion
3887
3919
  export { isError as $, identityToken as A, isIdentityProfile as B, readConfig as C, getConfigDir as D, isStrictConfig as E, signInWithBrowser as F, getFluidApiBase as G, SIGNUP_ERROR as H, signOutIdentity as I, signup as J, redeemIdentityLink as K, resolveIdentityUrl as L, primeIdentityProfile as M, profileAccessToken as N, getConfigFilePath as O, sessionFacts as P, getErrorMessage$1 as Q, createFetchClient as R, findProjectConfig as S, writeConfig as T, confirmMfa as U, FLUID_API_ERROR as V, fetchUserCompanies as W, validateToken as X, switchCompany as Y, failure as Z, getAuthToken as _, INPUTS_UNDECLARED_CODE as a, success as at, listProfileNames as b, inputsModeActive as c, unwrap as ct, setActiveSnapshot as d, rootCommand as dt, isFailure as et, inInternalRead as f, visibleOptions as ft, getActiveProfile as g, declareInputs as h, describeCommand as ht, INPUTS_MODE_ENV as i, mapResult as it, isRoleNotGrantedError as j, describeIdentityError as k, registerInputsHook as l, unwrapOr as lt, withInternalReadsAsync as m, walkCommands as mt, INPUTS_MISMATCH_CODE as n, isSuccess as nt, INPUTS_UNDECLARED_EXIT as o, tryCatch as ot, withInternalReads as p, visibleSubcommands as pt, sendMfa as q, INPUTS_MISMATCH_EXIT as r, mapError as rt, exitOnInputsError as s, tryCatchAsync as st, INPUTS_EXPECT_ENV as t, isNodeError as tt, createInputsReader as u, filterCatalog as ut, getAuthTokenAsync as v, updateConfig as w, resolveCredentialSource as x, getRoleAuthTokenAsync as y, createDefaultConfig as z };
3888
3920
 
3889
- //# sourceMappingURL=hook-CPmRkza4.mjs.map
3921
+ //# sourceMappingURL=hook-Bt98kSKV.mjs.map