@wix/create-app 0.0.168 → 0.0.170

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.
@@ -13,7 +13,7 @@ import {
13
13
  pathExists,
14
14
  require_is_git_url,
15
15
  require_lib
16
- } from "./chunk-ZPLNYYYY.js";
16
+ } from "./chunk-KLP34UUN.js";
17
17
  import {
18
18
  __commonJS,
19
19
  __require,
@@ -3984,4 +3984,4 @@ ejs/lib/ejs.js:
3984
3984
  * @license {@link http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0}
3985
3985
  *)
3986
3986
  */
3987
- //# sourceMappingURL=generator-XRFNCPHT.js.map
3987
+ //# sourceMappingURL=generator-AK5W7AYP.js.map
package/build/index.js CHANGED
@@ -98,7 +98,7 @@ import {
98
98
  setupTestEnv,
99
99
  writeJson,
100
100
  zod_default
101
- } from "./chunk-ZPLNYYYY.js";
101
+ } from "./chunk-KLP34UUN.js";
102
102
  import {
103
103
  __commonJS,
104
104
  __dirname,
@@ -43609,6 +43609,23 @@ var accountAuthStrategy = {
43609
43609
  async login({ deviceCode: deviceCode2, signal }) {
43610
43610
  const accountAuth = await waitForLogin(deviceCode2, { signal });
43611
43611
  return createAccountAuthState(accountAuth);
43612
+ },
43613
+ async loginWithRefreshToken({ refreshToken }) {
43614
+ const renewTokenResult = await client.renewToken({ refreshToken });
43615
+ if ((0, import_variant14.isType)(renewTokenResult, RenewTokenData.TokenRenewed)) {
43616
+ const newTokenData = renewTokenResult.payload;
43617
+ const userInfo2 = await client.userInfo({
43618
+ accessToken: newTokenData.accessToken
43619
+ });
43620
+ const result = { ...newTokenData, userInfo: userInfo2 };
43621
+ await deleteAuthData();
43622
+ await saveAuthData(result);
43623
+ return createAccountAuthState(result);
43624
+ }
43625
+ throw new CliError({
43626
+ code: CliErrorCode.FailedToLoginWithRefreshToken(),
43627
+ cause: null
43628
+ });
43612
43629
  }
43613
43630
  };
43614
43631
 
@@ -43630,19 +43647,28 @@ function useAuth() {
43630
43647
  return context2;
43631
43648
  }
43632
43649
 
43633
- // ../../node_modules/@wix/bi-logger-wix-cli/dist/esm/v2/index.js
43650
+ // ../../node_modules/@wix/bi-logger-dev-tools-data/dist/esm/v2/index.js
43634
43651
  init_esm_shims();
43635
43652
  function wixCliCliCommand(params) {
43636
- return { evid: 5200, src: 11, endpoint: "wix-cli", params };
43653
+ return { evid: 5200, src: 11, endpoint: "", params };
43637
43654
  }
43638
43655
  function wixCliCliCommandStatus(params) {
43639
- return { evid: 5201, src: 11, endpoint: "wix-cli", params };
43656
+ return { evid: 5201, src: 11, endpoint: "", params };
43640
43657
  }
43641
43658
  function wixCliLoginStart(params) {
43642
- return { evid: 5211, src: 11, endpoint: "wix-cli", params };
43659
+ return { evid: 5211, src: 11, endpoint: "", params };
43643
43660
  }
43644
43661
  function wixCliLoginEnd(params) {
43645
- return { evid: 5212, src: 11, endpoint: "wix-cli", params };
43662
+ return { evid: 5212, src: 11, endpoint: "", params };
43663
+ }
43664
+ function wixCliAppFlowStepsAnswers(params) {
43665
+ return { evid: 5229, src: 11, endpoint: "", params };
43666
+ }
43667
+ function wixCliCliError(params) {
43668
+ return { evid: 5230, src: 11, endpoint: "", params };
43669
+ }
43670
+ function wixCliAction(params) {
43671
+ return { evid: 5231, src: 11, endpoint: "", params };
43646
43672
  }
43647
43673
 
43648
43674
  // ../cli-auth/src/components/Login.tsx
@@ -50722,7 +50748,9 @@ var createEnv = () => {
50722
50748
  return {
50723
50749
  isCI: overrides2.isCI ?? import_ci_info.default.isCI,
50724
50750
  isPR: overrides2.isPR ?? import_ci_info.default.isPR,
50725
- ciName: overrides2.ciName ?? import_ci_info.default.name ?? process.env.CI_NAME ?? null
50751
+ ciName: overrides2.ciName ?? import_ci_info.default.name ?? process.env.CI_NAME ?? null,
50752
+ cliEnvName: overrides2.cliEnvName ?? process.env.WIX_RUNTIME_ENVIRONMENT ?? null,
50753
+ cliTrackingId: overrides2.cliTrackingId ?? process.env.TRACKING_ID ?? null
50726
50754
  };
50727
50755
  };
50728
50756
 
@@ -51051,6 +51079,15 @@ function getErrorComponent(code, cause) {
51051
51079
  }
51052
51080
  );
51053
51081
  },
51082
+ FailedToLoginWithRefreshToken: () => {
51083
+ return () => /* @__PURE__ */ import_react77.default.createElement(
51084
+ ErrorMessage,
51085
+ {
51086
+ message: "Failed to login with refresh token",
51087
+ hint: "Please check that your refresh token is valid and not revoked, then try again."
51088
+ }
51089
+ );
51090
+ },
51054
51091
  FailedToRevokeRefreshToken: ({ email }) => {
51055
51092
  return () => /* @__PURE__ */ import_react77.default.createElement(
51056
51093
  SystemErrorMessage,
@@ -55184,6 +55221,47 @@ function shouldAddPerformanceIntegrations(options) {
55184
55221
  // ../cli-error-reporting/src/error-reporter.ts
55185
55222
  var import_verror3 = __toESM(require_verror(), 1);
55186
55223
  import EventEmitter2 from "node:events";
55224
+
55225
+ // ../cli-error-reporting/src/error-utils.ts
55226
+ init_esm_shims();
55227
+ function truncateStringValues(value2, maxLength) {
55228
+ if (value2 == null) {
55229
+ return value2;
55230
+ }
55231
+ if (typeof value2 === "string") {
55232
+ if (value2.length <= maxLength) {
55233
+ return value2;
55234
+ }
55235
+ return `${value2.slice(0, maxLength)} [Truncated]`;
55236
+ }
55237
+ if (Array.isArray(value2)) {
55238
+ return value2.map((item) => truncateStringValues(item, maxLength));
55239
+ }
55240
+ if (typeof value2 === "object") {
55241
+ return Object.fromEntries(
55242
+ Object.entries(value2).map(([k, v]) => [
55243
+ k,
55244
+ truncateStringValues(v, maxLength)
55245
+ ])
55246
+ );
55247
+ }
55248
+ return value2;
55249
+ }
55250
+ function toSafeJson(value2) {
55251
+ if (typeof value2 === "string") {
55252
+ try {
55253
+ return JSON.parse(value2);
55254
+ } catch {
55255
+ return value2;
55256
+ }
55257
+ }
55258
+ return value2;
55259
+ }
55260
+ function normalizeRequestId(requestId) {
55261
+ return requestId.split(",").map((id) => id.trim()).at(0) ?? requestId;
55262
+ }
55263
+
55264
+ // ../cli-error-reporting/src/error-reporter.ts
55187
55265
  var ReportErrorResult = (0, import_variant16.variant)({
55188
55266
  Reported: (0, import_variant16.fields)(),
55189
55267
  Ignored: {}
@@ -55198,8 +55276,15 @@ var reportError = (scope, originalError, { data } = {}) => {
55198
55276
  captureContext: (localScope) => {
55199
55277
  const httpError = extractHttpError(error);
55200
55278
  if (httpError) {
55201
- localScope.setTag("request.id", httpError.requestId);
55202
- localScope.setContext("Request Info", getHttpErrorInfo(httpError));
55279
+ localScope.setTag(
55280
+ "request.id",
55281
+ normalizeRequestId(httpError.requestId)
55282
+ );
55283
+ const errorInfo = getHttpErrorInfo(httpError);
55284
+ errorInfo.request.data = toSafeJson(errorInfo.request.data);
55285
+ errorInfo.response.data = toSafeJson(errorInfo.response.data);
55286
+ const truncatedErrorInfo = truncateStringValues(errorInfo, 200);
55287
+ localScope.setContext("Request Info", truncatedErrorInfo);
55203
55288
  }
55204
55289
  if (error instanceof Error) {
55205
55290
  localScope.setContext("Error Details", {
@@ -55207,9 +55292,11 @@ var reportError = (scope, originalError, { data } = {}) => {
55207
55292
  "Full Stack": import_verror3.default.fullStack(error)
55208
55293
  });
55209
55294
  }
55210
- const { isCI: isCI3, isPR, ciName } = createEnv();
55295
+ const { isCI: isCI3, isPR, ciName, cliEnvName, cliTrackingId } = createEnv();
55211
55296
  localScope.setTag("ci", yesOrNo(isCI3));
55212
55297
  localScope.setTag("ci.name", ciName);
55298
+ localScope.setTag("cli.env_name", cliEnvName);
55299
+ localScope.setTag("cli.tracking_id", cliTrackingId);
55213
55300
  localScope.setContext("CI", {
55214
55301
  Name: ciName,
55215
55302
  "Is CI": yesOrNo(isCI3),
@@ -55238,8 +55325,9 @@ function createErrorReporter({ dsn, release: release2 }) {
55238
55325
  },
55239
55326
  // Since we pass `requestInfo`, the default depth of 3
55240
55327
  // redacts most useful info passed from API error responses
55241
- // so we increase it to include more of the potential error http repsonse.
55242
- normalizeDepth: 10
55328
+ // so we increase it to include more of the potential error http response.
55329
+ normalizeDepth: 8,
55330
+ normalizeMaxBreadth: 20
55243
55331
  });
55244
55332
  const sentryScope = new Scope();
55245
55333
  sentryScope.setClient(sentryClient);
@@ -56971,20 +57059,6 @@ var import_react96 = __toESM(require_react(), 1);
56971
57059
 
56972
57060
  // src/bi/events.ts
56973
57061
  init_esm_shims();
56974
-
56975
- // ../../node_modules/@wix/bi-logger-dev-tools-data/dist/esm/v2/index.js
56976
- init_esm_shims();
56977
- function wixCliAppFlowStepsAnswers(params) {
56978
- return { evid: 5229, src: 11, endpoint: "", params };
56979
- }
56980
- function wixCliCliError(params) {
56981
- return { evid: 5230, src: 11, endpoint: "", params };
56982
- }
56983
- function wixCliAction(params) {
56984
- return { evid: 5231, src: 11, endpoint: "", params };
56985
- }
56986
-
56987
- // src/bi/events.ts
56988
57062
  var createAppBiEvents = (biLogger) => ({
56989
57063
  cliAction: ({
56990
57064
  question,
@@ -57174,7 +57248,7 @@ function reportCommandStartEvent({
57174
57248
  }) {
57175
57249
  const options = command.opts();
57176
57250
  const args = command.args;
57177
- const privateOptions = /* @__PURE__ */ new Set(["apiKey"]);
57251
+ const privateOptions = /* @__PURE__ */ new Set(["apiKey", "refreshToken"]);
57178
57252
  const sanitizedOptions = Object.fromEntries(
57179
57253
  Object.entries(options).map(([flagName, flagValue]) => {
57180
57254
  const value2 = privateOptions.has(flagName) ? "<censored>" : flagValue;
@@ -57238,7 +57312,7 @@ function reportCommandStartEvent({
57238
57312
  var package_default = {
57239
57313
  name: "@wix/create-app",
57240
57314
  description: "Create Wix apps",
57241
- version: "0.0.168",
57315
+ version: "0.0.170",
57242
57316
  author: "Ihor Machuzhak",
57243
57317
  bin: "bin/index.cjs",
57244
57318
  devDependencies: {
@@ -57248,7 +57322,7 @@ var package_default = {
57248
57322
  "@types/react": "^18.3.3",
57249
57323
  "@types/semver": "^7.5.8",
57250
57324
  "@types/validate-npm-package-name": "^4.0.2",
57251
- "@wix/bi-logger-dev-tools-data": "^1.127.0",
57325
+ "@wix/bi-logger-dev-tools-data": "^1.144.0",
57252
57326
  "@wix/cli-auth": "workspace:*",
57253
57327
  "@wix/cli-error": "workspace:*",
57254
57328
  "@wix/cli-error-reporting": "workspace:*",
@@ -67359,7 +67433,7 @@ function getTasks({
67359
67433
  cause: e2
67360
67434
  });
67361
67435
  }
67362
- const { generateApp } = await import("./generator-XRFNCPHT.js");
67436
+ const { generateApp } = await import("./generator-AK5W7AYP.js");
67363
67437
  await generateApp({
67364
67438
  packageName,
67365
67439
  packageFolder,