@sentry/wizard 3.10.0 → 3.12.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 (150) hide show
  1. package/CHANGELOG.md +54 -7
  2. package/dist/lib/Constants.d.ts +1 -0
  3. package/dist/lib/Constants.js +5 -0
  4. package/dist/lib/Constants.js.map +1 -1
  5. package/dist/lib/Steps/ChooseIntegration.js +8 -4
  6. package/dist/lib/Steps/ChooseIntegration.js.map +1 -1
  7. package/dist/lib/Steps/Integrations/Android.d.ts +9 -0
  8. package/dist/lib/Steps/Integrations/Android.js +86 -0
  9. package/dist/lib/Steps/Integrations/Android.js.map +1 -0
  10. package/dist/lib/Steps/Integrations/ReactNative.js +3 -3
  11. package/dist/lib/Steps/Integrations/ReactNative.js.map +1 -1
  12. package/dist/lib/Steps/PromptForParameters.js +36 -3
  13. package/dist/lib/Steps/PromptForParameters.js.map +1 -1
  14. package/dist/lib/Steps/SentryProjectSelector.js +1 -1
  15. package/dist/lib/Steps/SentryProjectSelector.js.map +1 -1
  16. package/dist/package.json +4 -3
  17. package/dist/src/android/android-wizard.d.ts +2 -0
  18. package/dist/src/android/android-wizard.js +225 -0
  19. package/dist/src/android/android-wizard.js.map +1 -0
  20. package/dist/src/android/code-tools.d.ts +47 -0
  21. package/dist/src/android/code-tools.js +173 -0
  22. package/dist/src/android/code-tools.js.map +1 -0
  23. package/dist/src/android/gradle.d.ts +62 -0
  24. package/dist/src/android/gradle.js +286 -0
  25. package/dist/src/android/gradle.js.map +1 -0
  26. package/dist/src/android/manifest.d.ts +57 -0
  27. package/dist/src/android/manifest.js +183 -0
  28. package/dist/src/android/manifest.js.map +1 -0
  29. package/dist/src/android/templates.d.ts +11 -0
  30. package/dist/src/android/templates.js +34 -0
  31. package/dist/src/android/templates.js.map +1 -0
  32. package/dist/src/apple/apple-wizard.js +123 -64
  33. package/dist/src/apple/apple-wizard.js.map +1 -1
  34. package/dist/src/apple/cocoapod.js +4 -3
  35. package/dist/src/apple/cocoapod.js.map +1 -1
  36. package/dist/src/apple/code-tools.d.ts +1 -1
  37. package/dist/src/apple/code-tools.js +43 -19
  38. package/dist/src/apple/code-tools.js.map +1 -1
  39. package/dist/src/apple/fastlane.d.ts +1 -1
  40. package/dist/src/apple/fastlane.js +12 -6
  41. package/dist/src/apple/fastlane.js.map +1 -1
  42. package/dist/src/apple/templates.d.ts +2 -2
  43. package/dist/src/apple/templates.js +4 -4
  44. package/dist/src/apple/templates.js.map +1 -1
  45. package/dist/src/apple/xcode-manager.d.ts +19 -3
  46. package/dist/src/apple/xcode-manager.js +126 -24
  47. package/dist/src/apple/xcode-manager.js.map +1 -1
  48. package/dist/src/nextjs/nextjs-wizard.js +49 -11
  49. package/dist/src/nextjs/nextjs-wizard.js.map +1 -1
  50. package/dist/src/nextjs/templates.d.ts +2 -0
  51. package/dist/src/nextjs/templates.js +6 -2
  52. package/dist/src/nextjs/templates.js.map +1 -1
  53. package/dist/src/remix/remix-wizard.js +10 -20
  54. package/dist/src/remix/remix-wizard.js.map +1 -1
  55. package/dist/src/sourcemaps/sourcemaps-wizard.js +26 -13
  56. package/dist/src/sourcemaps/sourcemaps-wizard.js.map +1 -1
  57. package/dist/src/sourcemaps/tools/nextjs.js +1 -1
  58. package/dist/src/sourcemaps/tools/nextjs.js.map +1 -1
  59. package/dist/src/sourcemaps/tools/sentry-cli.js +19 -16
  60. package/dist/src/sourcemaps/tools/sentry-cli.js.map +1 -1
  61. package/dist/src/sourcemaps/tools/vite.d.ts +2 -1
  62. package/dist/src/sourcemaps/tools/vite.js +123 -111
  63. package/dist/src/sourcemaps/tools/vite.js.map +1 -1
  64. package/dist/src/sourcemaps/tools/webpack.d.ts +6 -1
  65. package/dist/src/sourcemaps/tools/webpack.js +290 -25
  66. package/dist/src/sourcemaps/tools/webpack.js.map +1 -1
  67. package/dist/src/sourcemaps/utils/detect-tool.d.ts +1 -1
  68. package/dist/src/sourcemaps/utils/detect-tool.js.map +1 -1
  69. package/dist/src/sveltekit/sdk-setup.js +5 -5
  70. package/dist/src/sveltekit/sdk-setup.js.map +1 -1
  71. package/dist/src/sveltekit/sveltekit-wizard.js +34 -44
  72. package/dist/src/sveltekit/sveltekit-wizard.js.map +1 -1
  73. package/dist/src/telemetry.js +1 -0
  74. package/dist/src/telemetry.js.map +1 -1
  75. package/dist/src/utils/ast-utils.d.ts +9 -5
  76. package/dist/src/utils/ast-utils.js +26 -11
  77. package/dist/src/utils/ast-utils.js.map +1 -1
  78. package/dist/src/utils/clack-utils.d.ts +74 -28
  79. package/dist/src/utils/clack-utils.js +427 -264
  80. package/dist/src/utils/clack-utils.js.map +1 -1
  81. package/dist/src/utils/package-manager.d.ts +10 -0
  82. package/dist/{lib/Helper/PackageManager.js → src/utils/package-manager.js} +42 -74
  83. package/dist/src/utils/package-manager.js.map +1 -0
  84. package/dist/src/utils/release-registry.d.ts +1 -0
  85. package/dist/src/utils/release-registry.js +68 -0
  86. package/dist/src/utils/release-registry.js.map +1 -0
  87. package/dist/src/utils/sentrycli-utils.d.ts +4 -0
  88. package/dist/src/utils/sentrycli-utils.js +41 -0
  89. package/dist/src/utils/sentrycli-utils.js.map +1 -0
  90. package/dist/test/android/code-tools.test.d.ts +1 -0
  91. package/dist/test/android/code-tools.test.js +34 -0
  92. package/dist/test/android/code-tools.test.js.map +1 -0
  93. package/dist/test/sourcemaps/tools/vite.test.d.ts +1 -0
  94. package/dist/test/sourcemaps/tools/vite.test.js +132 -0
  95. package/dist/test/sourcemaps/tools/vite.test.js.map +1 -0
  96. package/dist/test/sourcemaps/tools/webpack.test.d.ts +1 -0
  97. package/dist/test/sourcemaps/tools/webpack.test.js +179 -0
  98. package/dist/test/sourcemaps/tools/webpack.test.js.map +1 -0
  99. package/dist/test/utils/ast-utils.test.js +42 -7
  100. package/dist/test/utils/ast-utils.test.js.map +1 -1
  101. package/dist/test/utils/clack-utils.test.d.ts +1 -0
  102. package/dist/test/utils/clack-utils.test.js +200 -0
  103. package/dist/test/utils/clack-utils.test.js.map +1 -0
  104. package/lib/Constants.ts +5 -0
  105. package/lib/Steps/ChooseIntegration.ts +7 -3
  106. package/lib/Steps/Integrations/Android.ts +23 -0
  107. package/lib/Steps/Integrations/ReactNative.ts +9 -3
  108. package/lib/Steps/PromptForParameters.ts +48 -3
  109. package/lib/Steps/SentryProjectSelector.ts +3 -1
  110. package/package.json +4 -3
  111. package/src/android/android-wizard.ts +204 -0
  112. package/src/android/code-tools.ts +170 -0
  113. package/src/android/gradle.ts +250 -0
  114. package/src/android/manifest.ts +180 -0
  115. package/src/android/templates.ts +88 -0
  116. package/src/apple/apple-wizard.ts +113 -35
  117. package/src/apple/cocoapod.ts +6 -3
  118. package/src/apple/code-tools.ts +46 -18
  119. package/src/apple/fastlane.ts +6 -12
  120. package/src/apple/templates.ts +2 -8
  121. package/src/apple/xcode-manager.ts +167 -25
  122. package/src/nextjs/nextjs-wizard.ts +72 -8
  123. package/src/nextjs/templates.ts +16 -2
  124. package/src/remix/remix-wizard.ts +10 -15
  125. package/src/sourcemaps/sourcemaps-wizard.ts +19 -5
  126. package/src/sourcemaps/tools/nextjs.ts +2 -2
  127. package/src/sourcemaps/tools/sentry-cli.ts +8 -7
  128. package/src/sourcemaps/tools/vite.ts +143 -79
  129. package/src/sourcemaps/tools/webpack.ts +369 -30
  130. package/src/sourcemaps/utils/detect-tool.ts +2 -1
  131. package/src/sveltekit/sdk-setup.ts +10 -6
  132. package/src/sveltekit/sveltekit-wizard.ts +5 -14
  133. package/src/telemetry.ts +2 -0
  134. package/src/utils/ast-utils.ts +29 -11
  135. package/src/utils/clack-utils.ts +485 -283
  136. package/src/utils/package-manager.ts +61 -0
  137. package/src/utils/release-registry.ts +19 -0
  138. package/src/utils/sentrycli-utils.ts +22 -0
  139. package/test/android/code-tools.test.ts +49 -0
  140. package/test/sourcemaps/tools/vite.test.ts +149 -0
  141. package/test/sourcemaps/tools/webpack.test.ts +303 -0
  142. package/test/utils/ast-utils.test.ts +28 -9
  143. package/test/utils/clack-utils.test.ts +142 -0
  144. package/dist/lib/Helper/PackageManager.d.ts +0 -22
  145. package/dist/lib/Helper/PackageManager.js.map +0 -1
  146. package/dist/src/utils/vendor/clack-custom-select.d.ts +0 -21
  147. package/dist/src/utils/vendor/clack-custom-select.js +0 -137
  148. package/dist/src/utils/vendor/clack-custom-select.js.map +0 -1
  149. package/lib/Helper/PackageManager.ts +0 -59
  150. package/src/utils/vendor/clack-custom-select.ts +0 -160
package/CHANGELOG.md CHANGED
@@ -1,5 +1,46 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.12.0
4
+
5
+ - feat(sourcemaps): Automatically insert Sentry Webpack plugin (#432)
6
+ - fix(android): Add support for unusual import statements (#440)
7
+ - fix(wizard): Sort projects in project-selection step (#441)
8
+ - enh(android): Add more telemetry (#435)
9
+
10
+ ## 3.11.0
11
+
12
+ - feat(android): Add wizard support for Android (#389)
13
+
14
+ Set up the Sentry Android SDK in your app with one command:
15
+
16
+ ```sh
17
+ npx @sentry/wizard@latest -i android
18
+ # or via brew
19
+ brew install getsentry/tools/sentry-wizard && sentry-wizard -i android
20
+ ```
21
+
22
+ - feat(craft): Add `brew` target for automatically publishing `sentry-wizard` to
23
+ Sentry's custom Homebrew tap (#406)
24
+
25
+ You can now install `sentry-wizard` via Homebrew:
26
+
27
+ ```sh
28
+ brew update
29
+ brew install getsentry/tools/sentry-wizard
30
+ ```
31
+
32
+ - feat: Add Bun package manager support (#417)
33
+ - feat(apple): Add option to choose between cocoapods when available and SPM (#423)
34
+ - feat(apple): Search App entry point by build files not directories (#420)
35
+ - feat(apple): Use ".sentryclirc" for auth instead of hard coding it (#422)
36
+ - feat(nextjs): Add support for Next.js 13 app router (#385)
37
+ - feat(sourcemaps): Provide exit path if there's no need to upload sourcemaps (#415)
38
+ - fix: Handle no projects available (#412)
39
+ - fix: Remove picocolor usage (#426)
40
+ - fix: Support org auth tokens in old wizards (#409)
41
+ - fix: Treat user-entered DSN as a public DSN (#410)
42
+ - fix(sourcemaps): Enable source map generation when modifying Vite config (#421)
43
+
3
44
  ## 3.10.0
4
45
 
5
46
  - feat(remix): Add Remix wizard (#387)
@@ -7,7 +48,7 @@
7
48
  Set up the Sentry Remix SDK in your app with one command:
8
49
 
9
50
  ```sh
10
- npx @sentry/wizard -i remix
51
+ npx @sentry/wizard@latest -i remix
11
52
  ```
12
53
 
13
54
  - fix(cordova): Fallback to the default Sentry CLI path if not defined. (#401)
@@ -19,18 +60,22 @@ npx @sentry/wizard -i remix
19
60
  ## 3.9.1
20
61
 
21
62
  - ref(sourcemaps): Handle no vite config found case (#391)
22
- - ref(sourcemaps): Improve handling of vite config already having Sentry code (#392)
63
+ - ref(sourcemaps): Improve handling of vite config already having Sentry code
64
+ (#392)
23
65
  - fix(apple): Don't remove other swift packages (#396)
24
66
 
25
67
  ## 3.9.0
26
68
 
27
69
  - ref: Add debug logging to clack-based wizards (#381)
28
70
  - fix: Pin minimum version to Node 14.18 (#383)
29
- - feat(sourcemaps): Automatically insert Sentry Vite plugin in Vite config (#382)
71
+ - feat(sourcemaps): Automatically insert Sentry Vite plugin in Vite config
72
+ (#382)
30
73
  - feat(reactnative): Use `with-environment.sh` in Xcode Build Phases (#329)
31
- - fix(sveltekit): Bump `magicast` to handle vite configs declared as variables (#380)
74
+ - fix(sveltekit): Bump `magicast` to handle vite configs declared as variables
75
+ (#380)
32
76
  - ref(sveltekit): Add vite plugin insertion fallback mechanism (#379)
33
- - ref(sveltekit): Insert project config into vite config instead of `sentry.properties` (#378)
77
+ - ref(sveltekit): Insert project config into vite config instead of
78
+ `sentry.properties` (#378)
34
79
 
35
80
  ## 3.8.0
36
81
 
@@ -41,7 +86,8 @@ npx @sentry/wizard -i remix
41
86
  - feat(sourcemaps): Add option to add cli npm script to build command (#374)
42
87
  - fix(login): Avoid repeatedly printing loading message (#368)
43
88
  - fix(sveltekit): Abort the wizard when encountering an error (#376)
44
- - ref(sourcemaps): Redirect to ReactNative wizard if RN project is detected (#369)
89
+ - ref(sourcemaps): Redirect to ReactNative wizard if RN project is detected
90
+ (#369)
45
91
 
46
92
  ## 3.7.1
47
93
 
@@ -58,7 +104,8 @@ fix(telemetry): Re-enable telemetry collection (#361)
58
104
 
59
105
  - feat(apple): Add support for iOS (#334)
60
106
  - feat(sourcemaps): Add CLI-based flow for Angular (#349)
61
- - feat(sourcemaps): Detect SvelteKit and NextJS projects and redirect to dedicated wizards (#341)
107
+ - feat(sourcemaps): Detect SvelteKit and NextJS projects and redirect to
108
+ dedicated wizards (#341)
62
109
  - feat(sourcemaps): Pre-select auto-detected build tool option (#354)
63
110
  - ref(sourcemaps): Improve Outro message (#344)
64
111
 
@@ -2,6 +2,7 @@
2
2
  export declare enum Integration {
3
3
  reactNative = "reactNative",
4
4
  ios = "ios",
5
+ android = "android",
5
6
  cordova = "cordova",
6
7
  electron = "electron",
7
8
  nextjs = "nextjs",
@@ -6,6 +6,7 @@ var Integration;
6
6
  (function (Integration) {
7
7
  Integration["reactNative"] = "reactNative";
8
8
  Integration["ios"] = "ios";
9
+ Integration["android"] = "android";
9
10
  Integration["cordova"] = "cordova";
10
11
  Integration["electron"] = "electron";
11
12
  Integration["nextjs"] = "nextjs";
@@ -38,6 +39,8 @@ function getPlatformDescription(type) {
38
39
  exports.getPlatformDescription = getPlatformDescription;
39
40
  function getIntegrationDescription(type) {
40
41
  switch (type) {
42
+ case Integration.android:
43
+ return 'Android';
41
44
  case Integration.reactNative:
42
45
  return 'React Native';
43
46
  case Integration.cordova:
@@ -61,6 +64,8 @@ function getIntegrationDescription(type) {
61
64
  exports.getIntegrationDescription = getIntegrationDescription;
62
65
  function mapIntegrationToPlatform(type) {
63
66
  switch (type) {
67
+ case Integration.android:
68
+ return 'android';
64
69
  case Integration.reactNative:
65
70
  return 'react-native';
66
71
  case Integration.cordova:
@@ -1 +1 @@
1
- {"version":3,"file":"Constants.js","sourceRoot":"","sources":["../../lib/Constants.ts"],"names":[],"mappings":";;;AAAA,wCAAwC;AACxC,IAAY,WASX;AATD,WAAY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;YACzB,OAAO,8BAA8B,CAAC;QACxC,KAAK,WAAW,CAAC,GAAG;YAClB,OAAO,KAAK,CAAC;QACf;YACE,OAAO,cAAc,CAAC;KACzB;AACH,CAAC;AArBD,8DAqBC;AAED,SAAgB,wBAAwB,CAAC,IAAY;IACnD,QAAQ,IAAI,EAAE;QACZ,KAAK,WAAW,CAAC,WAAW;YAC1B,OAAO,cAAc,CAAC;QACxB,KAAK,WAAW,CAAC,OAAO;YACtB,OAAO,SAAS,CAAC;QACnB,KAAK,WAAW,CAAC,QAAQ;YACvB,OAAO,qBAAqB,CAAC;QAC/B,KAAK,WAAW,CAAC,MAAM;YACrB,OAAO,mBAAmB,CAAC;QAC7B,KAAK,WAAW,CAAC,KAAK;YACpB,OAAO,kBAAkB,CAAC;QAC5B,KAAK,WAAW,CAAC,SAAS;YACxB,OAAO,sBAAsB,CAAC;QAChC,KAAK,WAAW,CAAC,UAAU;YACzB,OAAO,SAAS,CAAC;QACnB,KAAK,WAAW,CAAC,GAAG;YAClB,OAAO,KAAK,CAAC;QACf;YACE,MAAM,IAAI,KAAK,CAAC,8BAAuB,IAAI,CAAE,CAAC,CAAC;KAClD;AACH,CAAC;AArBD,4DAqBC;AAOD,SAAgB,qBAAqB;IACnC,OAAO,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,UAAC,IAAY,IAAK,OAAA,CAAC;QACrD,IAAI,EAAE,yBAAyB,CAAC,IAAI,CAAC;QACrC,KAAK,EAAE,IAAI;KACZ,CAAC,EAHoD,CAGpD,CAAC,CAAC;AACN,CAAC;AALD,sDAKC;AAeY,QAAA,WAAW,GAAG,oBAAoB,CAAC","sourcesContent":["/** Key value should be the same here */\nexport enum Integration {\n reactNative = 'reactNative',\n ios = 'ios',\n cordova = 'cordova',\n electron = 'electron',\n nextjs = 'nextjs',\n remix = 'remix',\n sveltekit = 'sveltekit',\n sourcemaps = 'sourcemaps',\n}\n\n/** Key value should be the same here */\nexport enum Platform {\n ios = 'ios',\n android = 'android',\n}\n\nexport function getPlatformChoices(): any[] {\n return Object.keys(Platform).map((platform: string) => ({\n checked: true,\n name: getPlatformDescription(platform),\n value: platform,\n }));\n}\n\nexport function getPlatformDescription(type: string): string {\n switch (type) {\n case Platform.ios:\n return 'iOS';\n default:\n return 'Android';\n }\n}\n\nexport function getIntegrationDescription(type: string): string {\n switch (type) {\n case Integration.reactNative:\n return 'React Native';\n case Integration.cordova:\n return 'Cordova';\n case Integration.electron:\n return 'Electron';\n case Integration.nextjs:\n return 'Next.js';\n case Integration.remix:\n return 'Remix';\n case Integration.sveltekit:\n return 'SvelteKit';\n case Integration.sourcemaps:\n return 'Configure Source Maps Upload';\n case Integration.ios:\n return 'iOS';\n default:\n return 'React Native';\n }\n}\n\nexport function mapIntegrationToPlatform(type: string): string | undefined {\n switch (type) {\n case Integration.reactNative:\n return 'react-native';\n case Integration.cordova:\n return 'cordova';\n case Integration.electron:\n return 'javascript-electron';\n case Integration.nextjs:\n return 'javascript-nextjs';\n case Integration.remix:\n return 'javascript-remix';\n case Integration.sveltekit:\n return 'javascript-sveltekit';\n case Integration.sourcemaps:\n return undefined;\n case Integration.ios:\n return 'iOS';\n default:\n throw new Error(`Unknown integration ${type}`);\n }\n}\n\ntype IntegrationChoice = {\n name: string;\n value: string;\n};\n\nexport function getIntegrationChoices(): IntegrationChoice[] {\n return Object.keys(Integration).map((type: string) => ({\n name: getIntegrationDescription(type),\n value: type,\n }));\n}\n\nexport interface Args {\n url: string;\n debug: boolean;\n uninstall: boolean;\n integration: Integration;\n platform: Platform[];\n skipConnect: boolean;\n quiet: boolean;\n signup: boolean;\n promoCode?: string;\n disableTelemetry?: boolean;\n}\n\nexport const DEFAULT_URL = 'https://sentry.io/';\n"]}
1
+ {"version":3,"file":"Constants.js","sourceRoot":"","sources":["../../lib/Constants.ts"],"names":[],"mappings":";;;AAAA,wCAAwC;AACxC,IAAY,WAUX;AAVD,WAAY,WAAW;IACrB,0CAA2B,CAAA;IAC3B,0B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AAW,CAAC;QACrB,KAAK,WAAW,CAAC,UAAU;YACzB,OAAO,8BAA8B,CAAC;QACxC,KAAK,WAAW,CAAC,GAAG;YAClB,OAAO,KAAK,CAAC;QACf;YACE,OAAO,cAAc,CAAC;KACzB;AACH,CAAC;AAvBD,8DAuBC;AAED,SAAgB,wBAAwB,CAAC,IAAY;IACnD,QAAQ,IAAI,EAAE;QACZ,KAAK,WAAW,CAAC,OAAO;YACtB,OAAO,SAAS,CAAC;QACnB,KAAK,WAAW,CAAC,WAAW;YAC1B,OAAO,cAAc,CAAC;QACxB,KAAK,WAAW,CAAC,OAAO;YACtB,OAAO,SAAS,CAAC;QACnB,KAAK,WAAW,CAAC,QAAQ;YACvB,OAAO,qBAAqB,CAAC;QAC/B,KAAK,WAAW,CAAC,MAAM;YACrB,OAAO,mBAAmB,CAAC;QAC7B,KAAK,WAAW,CAAC,KAAK;YACpB,OAAO,kBAAkB,CAAC;QAC5B,KAAK,WAAW,CAAC,SAAS;YACxB,OAAO,sBAAsB,CAAC;QAChC,KAAK,WAAW,CAAC,UAAU;YACzB,OAAO,SAAS,CAAC;QACnB,KAAK,WAAW,CAAC,GAAG;YAClB,OAAO,KAAK,CAAC;QACf;YACE,MAAM,IAAI,KAAK,CAAC,8BAAuB,IAAI,CAAE,CAAC,CAAC;KAClD;AACH,CAAC;AAvBD,4DAuBC;AAOD,SAAgB,qBAAqB;IACnC,OAAO,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,UAAC,IAAY,IAAK,OAAA,CAAC;QACrD,IAAI,EAAE,yBAAyB,CAAC,IAAI,CAAC;QACrC,KAAK,EAAE,IAAI;KACZ,CAAC,EAHoD,CAGpD,CAAC,CAAC;AACN,CAAC;AALD,sDAKC;AAeY,QAAA,WAAW,GAAG,oBAAoB,CAAC","sourcesContent":["/** Key value should be the same here */\nexport enum Integration {\n reactNative = 'reactNative',\n ios = 'ios',\n android = 'android',\n cordova = 'cordova',\n electron = 'electron',\n nextjs = 'nextjs',\n remix = 'remix',\n sveltekit = 'sveltekit',\n sourcemaps = 'sourcemaps',\n}\n\n/** Key value should be the same here */\nexport enum Platform {\n ios = 'ios',\n android = 'android',\n}\n\nexport function getPlatformChoices(): any[] {\n return Object.keys(Platform).map((platform: string) => ({\n checked: true,\n name: getPlatformDescription(platform),\n value: platform,\n }));\n}\n\nexport function getPlatformDescription(type: string): string {\n switch (type) {\n case Platform.ios:\n return 'iOS';\n default:\n return 'Android';\n }\n}\n\nexport function getIntegrationDescription(type: string): string {\n switch (type) {\n case Integration.android:\n return 'Android';\n case Integration.reactNative:\n return 'React Native';\n case Integration.cordova:\n return 'Cordova';\n case Integration.electron:\n return 'Electron';\n case Integration.nextjs:\n return 'Next.js';\n case Integration.remix:\n return 'Remix';\n case Integration.sveltekit:\n return 'SvelteKit';\n case Integration.sourcemaps:\n return 'Configure Source Maps Upload';\n case Integration.ios:\n return 'iOS';\n default:\n return 'React Native';\n }\n}\n\nexport function mapIntegrationToPlatform(type: string): string | undefined {\n switch (type) {\n case Integration.android:\n return 'android';\n case Integration.reactNative:\n return 'react-native';\n case Integration.cordova:\n return 'cordova';\n case Integration.electron:\n return 'javascript-electron';\n case Integration.nextjs:\n return 'javascript-nextjs';\n case Integration.remix:\n return 'javascript-remix';\n case Integration.sveltekit:\n return 'javascript-sveltekit';\n case Integration.sourcemaps:\n return undefined;\n case Integration.ios:\n return 'iOS';\n default:\n throw new Error(`Unknown integration ${type}`);\n }\n}\n\ntype IntegrationChoice = {\n name: string;\n value: string;\n};\n\nexport function getIntegrationChoices(): IntegrationChoice[] {\n return Object.keys(Integration).map((type: string) => ({\n name: getIntegrationDescription(type),\n value: type,\n }));\n}\n\nexport interface Args {\n url: string;\n debug: boolean;\n uninstall: boolean;\n integration: Integration;\n platform: Platform[];\n skipConnect: boolean;\n quiet: boolean;\n signup: boolean;\n promoCode?: string;\n disableTelemetry?: boolean;\n}\n\nexport const DEFAULT_URL = 'https://sentry.io/';\n"]}
@@ -53,7 +53,6 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
53
53
  Object.defineProperty(exports, "__esModule", { value: true });
54
54
  exports.ChooseIntegration = void 0;
55
55
  var inquirer_1 = require("inquirer");
56
- var picocolors_1 = require("picocolors");
57
56
  var Constants_1 = require("../Constants");
58
57
  var BaseStep_1 = require("./BaseStep");
59
58
  var Cordova_1 = require("./Integrations/Cordova");
@@ -65,6 +64,8 @@ var Apple_1 = require("./Integrations/Apple");
65
64
  var SvelteKitShim_1 = require("./Integrations/SvelteKitShim");
66
65
  var package_json_1 = require("../../src/utils/package-json");
67
66
  var Remix_1 = require("./Integrations/Remix");
67
+ var Android_1 = require("./Integrations/Android");
68
+ var Logging_1 = require("../Helper/Logging");
68
69
  var projectPackage = {};
69
70
  try {
70
71
  // If we run directly in setup-wizard
@@ -88,6 +89,9 @@ var ChooseIntegration = /** @class */ (function (_super) {
88
89
  integrationPrompt = _a.sent();
89
90
  integration = null;
90
91
  switch (integrationPrompt.integration) {
92
+ case Constants_1.Integration.android:
93
+ integration = new Android_1.Android(this._argv);
94
+ break;
91
95
  case Constants_1.Integration.cordova:
92
96
  integration = new Cordova_1.Cordova(sanitizeUrl(this._argv));
93
97
  break;
@@ -150,14 +154,14 @@ var ChooseIntegration = /** @class */ (function (_super) {
150
154
  }
151
155
  else {
152
156
  if (this._argv.quiet) {
153
- throw new Error('You need to choose a integration');
157
+ throw new Error('You need to choose a platform');
154
158
  }
155
159
  detectedDefaultSelection = this.tryDetectingIntegration();
156
160
  return [2 /*return*/, (0, inquirer_1.prompt)([
157
161
  {
158
162
  choices: (0, Constants_1.getIntegrationChoices)(),
159
163
  default: detectedDefaultSelection,
160
- message: 'What integration do you want to set up?',
164
+ message: 'What platform do you want to set up?',
161
165
  name: 'integration',
162
166
  type: 'list',
163
167
  },
@@ -178,7 +182,7 @@ exports.ChooseIntegration = ChooseIntegration;
178
182
  function sanitizeUrl(argv) {
179
183
  if (!argv.url) {
180
184
  argv.url = Constants_1.DEFAULT_URL;
181
- (0, picocolors_1.dim)("no URL provided, fallback to ".concat(argv.url));
185
+ (0, Logging_1.dim)("no URL provided, fallback to ".concat(argv.url));
182
186
  return argv;
183
187
  }
184
188
  var baseUrl = argv.url;
@@ -1 +1 @@
1
- {"version":3,"file":"ChooseIntegration.js","sourceRoot":"","sources":["../../../lib/Steps/ChooseIntegration.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,qCAAkC;AAClC,yCAAiC;AAEjC,0CAKsB;AACtB,uCAAsC;AACtC,kDAAiD;AACjD,oDAAmD;AACnD,wDAAuD;AACvD,0DAAyD;AACzD,gEAA+D;AAC/D,8CAA6C;AAC7C,8DAA6D;AAC7D,6DAAmE;AACnE,8CAA6C;AAE7C,IAAI,cAAc,GAAQ,EAAE,CAAC;AAE7B,IAAI;IACF,qCAAqC;IACrC,cAAc,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;CAChD;AAAC,WAAM;IACN,cAAc,GAAG,OAAO,CAAC,UAAG,OAAO,CAAC,GAAG,EAAE,kBAAe,CAAC,CAAC;CAC3D;AAMD;IAAuC,qCAAQ;IAA/C;;IAiFA,CAAC;IAhFc,gCAAI,GAAjB,UAAkB,QAAiB;;;;;4BACP,qBAAM,IAAI,CAAC,8BAA8B,EAAE,EAAA;;wBAA/D,iBAAiB,GAAG,SAA2C;wBAEjE,WAAW,GAAG,IAAI,CAAC;wBACvB,QAAQ,iBAAiB,CAAC,WAAW,EAAE;4BACrC,KAAK,uBAAW,CAAC,OAAO;gCACtB,WAAW,GAAG,IAAI,iBAAO,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;gCACnD,MAAM;4BACR,KAAK,uBAAW,CAAC,QAAQ;gCACvB,WAAW,GAAG,IAAI,mBAAQ,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;gCACpD,MAAM;4BACR,KAAK,uBAA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OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC;IAC/C,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC;IAEnB,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import type { Answers } from 'inquirer';\nimport { prompt } from 'inquirer';\nimport { dim } from 'picocolors';\n\nimport {\n Args,\n DEFAULT_URL,\n getIntegrationChoices,\n Integration,\n} from '../Constants';\nimport { BaseStep } from './BaseStep';\nimport { Cordova } from './Integrations/Cordova';\nimport { Electron } from './Integrations/Electron';\nimport { NextJsShim } from './Integrations/NextJsShim';\nimport { ReactNative } from './Integrations/ReactNative';\nimport { SourceMapsShim } from './Integrations/SourceMapsShim';\nimport { Apple } from './Integrations/Apple';\nimport { SvelteKitShim } from './Integrations/SvelteKitShim';\nimport { hasPackageInstalled } from '../../src/utils/package-json';\nimport { Remix } from './Integrations/Remix';\n\nlet projectPackage: any = {};\n\ntry {\n // If we run directly in setup-wizard\n projectPackage = require('../../package.json');\n} catch {\n projectPackage = require(`${process.cwd()}/package.json`);\n}\n\ntype IntegrationPromptAnswer = {\n integration: Integration;\n};\n\nexport class ChooseIntegration extends BaseStep {\n public async emit(_answers: Answers): Promise<Answers> {\n const integrationPrompt = await this._getIntegrationPromptSelection();\n\n let integration = null;\n switch (integrationPrompt.integration) {\n case Integration.cordova:\n integration = new Cordova(sanitizeUrl(this._argv));\n break;\n case Integration.electron:\n integration = new Electron(sanitizeUrl(this._argv));\n break;\n case Integration.nextjs:\n integration = new NextJsShim(this._argv);\n break;\n case Integration.remix:\n integration = new Remix(this._argv);\n break;\n case Integration.sveltekit:\n integration = new SvelteKitShim(this._argv);\n break;\n case Integration.sourcemaps:\n integration = new SourceMapsShim(this._argv);\n break;\n case Integration.ios:\n integration = new Apple(this._argv);\n break;\n case Integration.reactNative:\n default:\n integration = new ReactNative(sanitizeUrl(this._argv));\n break;\n }\n\n return { integration };\n }\n\n public tryDetectingIntegration(): Integration | undefined {\n if (hasPackageInstalled('react-native', projectPackage)) {\n return Integration.reactNative;\n }\n if (hasPackageInstalled('cordova', projectPackage)) {\n return Integration.cordova;\n }\n if (hasPackageInstalled('electron', projectPackage)) {\n return Integration.electron;\n }\n if (hasPackageInstalled('next', projectPackage)) {\n return Integration.nextjs;\n }\n if (hasPackageInstalled('remix-run', projectPackage)) {\n return Integration.remix;\n }\n if (hasPackageInstalled('@sveltejs/kit', projectPackage)) {\n return Integration.sveltekit;\n }\n\n return;\n }\n\n private async _getIntegrationPromptSelection(): Promise<IntegrationPromptAnswer> {\n // If we receive project type as an arg we skip asking\n if (this._argv.integration) {\n return { integration: this._argv.integration };\n } else {\n if (this._argv.quiet) {\n throw new Error('You need to choose a integration');\n }\n\n const detectedDefaultSelection = this.tryDetectingIntegration();\n\n return prompt([\n {\n choices: getIntegrationChoices(),\n default: detectedDefaultSelection,\n message: 'What integration do you want to set up?',\n name: 'integration',\n type: 'list',\n },\n ]);\n }\n }\n}\n\n/**\n * For the `clack`-based wizard flows, which we only shim here, we don't set\n * a default url value. For backwards-compatibility with the other flows,\n * we fill it here and sanitize a user-enterd url.\n */\nfunction sanitizeUrl(argv: Args): Args {\n if (!argv.url) {\n argv.url = DEFAULT_URL;\n dim(`no URL provided, fallback to ${argv.url}`);\n return argv;\n }\n\n let baseUrl = argv.url;\n baseUrl += baseUrl.endsWith('/') ? '' : '/';\n baseUrl = baseUrl.replace(/:\\/(?!\\/)/g, '://');\n argv.url = baseUrl;\n\n return argv;\n}\n"]}
1
+ {"version":3,"file":"ChooseIntegration.js","sourceRoot":"","sources":["../../../lib/Steps/ChooseIntegration.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,qCAAkC;AAElC,0CAKsB;AACtB,uCAAsC;AACtC,kDAAiD;AACjD,oDAAmD;AACnD,wDAAuD;AACvD,0DAAyD;AACzD,gEAA+D;AAC/D,8CAA6C;AAC7C,8DAA6D;AAC7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CAAC,KAAK,CAAC,WAAW,EAAE,EAAC;iBAChD;qBAAM;oBACL,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE;wBACpB,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;qBAClD;oBAEK,wBAAwB,GAAG,IAAI,CAAC,uBAAuB,EAAE,CAAC;oBAEhE,sBAAO,IAAA,iBAAM,EAAC;4BACZ;gCACE,OAAO,EAAE,IAAA,iCAAqB,GAAE;gCAChC,OAAO,EAAE,wBAAwB;gCACjC,OAAO,EAAE,sCAAsC;gCAC/C,IAAI,EAAE,aAAa;gCACnB,IAAI,EAAE,MAAM;6BACb;yBACF,CAAC,EAAC;iBACJ;;;;KACF;IACH,wBAAC;AAAD,CAAC,AApFD,CAAuC,mBAAQ,GAoF9C;AApFY,8CAAiB;AAsF9B;;;;GAIG;AACH,SAAS,WAAW,CAAC,IAAU;IAC7B,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,GAAG,GAAG,uBAAW,CAAC;QACvB,IAAA,aAAG,EAAC,uCAAgC,IAAI,CAAC,GAAG,CAAE,CAAC,CAAC;QAChD,OAAO,IAAI,CAAC;KACb;IAED,IAAI,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC;IACvB,OAAO,IAAI,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC;IAC5C,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC;IAC/C,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC;IAEnB,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import type { Answers } from 'inquirer';\nimport { prompt } from 'inquirer';\n\nimport {\n Args,\n DEFAULT_URL,\n getIntegrationChoices,\n Integration,\n} from '../Constants';\nimport { BaseStep } from './BaseStep';\nimport { Cordova } from './Integrations/Cordova';\nimport { Electron } from './Integrations/Electron';\nimport { NextJsShim } from './Integrations/NextJsShim';\nimport { ReactNative } from './Integrations/ReactNative';\nimport { SourceMapsShim } from './Integrations/SourceMapsShim';\nimport { Apple } from './Integrations/Apple';\nimport { SvelteKitShim } from './Integrations/SvelteKitShim';\nimport { hasPackageInstalled } from '../../src/utils/package-json';\nimport { Remix } from './Integrations/Remix';\nimport { Android } from './Integrations/Android';\nimport { dim } from '../Helper/Logging';\n\nlet projectPackage: any = {};\n\ntry {\n // If we run directly in setup-wizard\n projectPackage = require('../../package.json');\n} catch {\n projectPackage = require(`${process.cwd()}/package.json`);\n}\n\ntype IntegrationPromptAnswer = {\n integration: Integration;\n};\n\nexport class ChooseIntegration extends BaseStep {\n public async emit(_answers: Answers): Promise<Answers> {\n const integrationPrompt = await this._getIntegrationPromptSelection();\n\n let integration = null;\n switch (integrationPrompt.integration) {\n case Integration.android:\n integration = new Android(this._argv);\n break;\n case Integration.cordova:\n integration = new Cordova(sanitizeUrl(this._argv));\n break;\n case Integration.electron:\n integration = new Electron(sanitizeUrl(this._argv));\n break;\n case Integration.nextjs:\n integration = new NextJsShim(this._argv);\n break;\n case Integration.remix:\n integration = new Remix(this._argv);\n break;\n case Integration.sveltekit:\n integration = new SvelteKitShim(this._argv);\n break;\n case Integration.sourcemaps:\n integration = new SourceMapsShim(this._argv);\n break;\n case Integration.ios:\n integration = new Apple(this._argv);\n break;\n case Integration.reactNative:\n default:\n integration = new ReactNative(sanitizeUrl(this._argv));\n break;\n }\n\n return { integration };\n }\n\n public tryDetectingIntegration(): Integration | undefined {\n if (hasPackageInstalled('react-native', projectPackage)) {\n return Integration.reactNative;\n }\n if (hasPackageInstalled('cordova', projectPackage)) {\n return Integration.cordova;\n }\n if (hasPackageInstalled('electron', projectPackage)) {\n return Integration.electron;\n }\n if (hasPackageInstalled('next', projectPackage)) {\n return Integration.nextjs;\n }\n if (hasPackageInstalled('remix-run', projectPackage)) {\n return Integration.remix;\n }\n if (hasPackageInstalled('@sveltejs/kit', projectPackage)) {\n return Integration.sveltekit;\n }\n\n return;\n }\n\n private async _getIntegrationPromptSelection(): Promise<IntegrationPromptAnswer> {\n // If we receive project type as an arg we skip asking\n if (this._argv.integration) {\n return { integration: this._argv.integration };\n } else {\n if (this._argv.quiet) {\n throw new Error('You need to choose a platform');\n }\n\n const detectedDefaultSelection = this.tryDetectingIntegration();\n\n return prompt([\n {\n choices: getIntegrationChoices(),\n default: detectedDefaultSelection,\n message: 'What platform do you want to set up?',\n name: 'integration',\n type: 'list',\n },\n ]);\n }\n }\n}\n\n/**\n * For the `clack`-based wizard flows, which we only shim here, we don't set\n * a default url value. For backwards-compatibility with the other flows,\n * we fill it here and sanitize a user-enterd url.\n */\nfunction sanitizeUrl(argv: Args): Args {\n if (!argv.url) {\n argv.url = DEFAULT_URL;\n dim(`no URL provided, fallback to ${argv.url}`);\n return argv;\n }\n\n let baseUrl = argv.url;\n baseUrl += baseUrl.endsWith('/') ? '' : '/';\n baseUrl = baseUrl.replace(/:\\/(?!\\/)/g, '://');\n argv.url = baseUrl;\n\n return argv;\n}\n"]}
@@ -0,0 +1,9 @@
1
+ import { Answers } from 'inquirer';
2
+ import { BaseIntegration } from './BaseIntegration';
3
+ import { Args } from '../../Constants';
4
+ export declare class Android extends BaseIntegration {
5
+ protected _argv: Args;
6
+ constructor(_argv: Args);
7
+ emit(_answers: Answers): Promise<Answers>;
8
+ shouldConfigure(_answers: Answers): Promise<Answers>;
9
+ }
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
18
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
19
+ return new (P || (P = Promise))(function (resolve, reject) {
20
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
21
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
22
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
23
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
24
+ });
25
+ };
26
+ var __generator = (this && this.__generator) || function (thisArg, body) {
27
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
28
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
29
+ function verb(n) { return function (v) { return step([n, v]); }; }
30
+ function step(op) {
31
+ if (f) throw new TypeError("Generator is already executing.");
32
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
33
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
34
+ if (y = 0, t) op = [op[0] & 2, t.value];
35
+ switch (op[0]) {
36
+ case 0: case 1: t = op; break;
37
+ case 4: _.label++; return { value: op[1], done: false };
38
+ case 5: _.label++; y = op[1]; op = [0]; continue;
39
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
40
+ default:
41
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
42
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
43
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
44
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
45
+ if (t[2]) _.ops.pop();
46
+ _.trys.pop(); continue;
47
+ }
48
+ op = body.call(thisArg, _);
49
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
50
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
51
+ }
52
+ };
53
+ Object.defineProperty(exports, "__esModule", { value: true });
54
+ exports.Android = void 0;
55
+ var BaseIntegration_1 = require("./BaseIntegration");
56
+ var android_wizard_1 = require("../../../src/android/android-wizard");
57
+ var Android = /** @class */ (function (_super) {
58
+ __extends(Android, _super);
59
+ function Android(_argv) {
60
+ var _this = _super.call(this, _argv) || this;
61
+ _this._argv = _argv;
62
+ return _this;
63
+ }
64
+ Android.prototype.emit = function (_answers) {
65
+ return __awaiter(this, void 0, void 0, function () {
66
+ return __generator(this, function (_a) {
67
+ switch (_a.label) {
68
+ case 0: return [4 /*yield*/, (0, android_wizard_1.runAndroidWizard)({
69
+ promoCode: this._argv.promoCode,
70
+ url: this._argv.url,
71
+ telemetryEnabled: !this._argv.disableTelemetry,
72
+ })];
73
+ case 1:
74
+ _a.sent();
75
+ return [2 /*return*/, {}];
76
+ }
77
+ });
78
+ });
79
+ };
80
+ Android.prototype.shouldConfigure = function (_answers) {
81
+ return this._shouldConfigure;
82
+ };
83
+ return Android;
84
+ }(BaseIntegration_1.BaseIntegration));
85
+ exports.Android = Android;
86
+ //# sourceMappingURL=Android.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Android.js","sourceRoot":"","sources":["../../../../lib/Steps/Integrations/Android.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,qDAAoD;AAEpD,sEAAuE;AAEvE;IAA6B,2BAAe;IAC1C,iBAA6B,KAAW;QAAxC,YACE,kBAAM,KAAK,CAAC,SACb;QAF4B,WAAK,GAAL,KAAK,CAAM;;IAExC,CAAC;IAEY,sBAAI,GAAjB,UAAkB,QAAiB;;;;4BACjC,qBAAM,IAAA,iCAAgB,EAAC;4BACrB,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS;4BAC/B,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG;4BACnB,gBAAgB,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,gBAAgB;yBAC/C,CAAC,EAAA;;wBAJF,SAIE,CAAC;wBACH,sBAAO,EAAE,EAAC;;;;KACX;IAEM,iCAAe,GAAtB,UAAuB,QAAiB;QACtC,OAAO,IAAI,CAAC,gBAAgB,CAAC;IAC/B,CAAC;IACH,cAAC;AAAD,CAAC,AAjBD,CAA6B,iCAAe,GAiB3C;AAjBY,0BAAO","sourcesContent":["import { Answers } from 'inquirer';\nimport { BaseIntegration } from './BaseIntegration';\nimport { Args } from '../../Constants';\nimport { runAndroidWizard } from '../../../src/android/android-wizard';\n\nexport class Android extends BaseIntegration {\n public constructor(protected _argv: Args) {\n super(_argv);\n }\n\n public async emit(_answers: Answers): Promise<Answers> {\n await runAndroidWizard({\n promoCode: this._argv.promoCode,\n url: this._argv.url,\n telemetryEnabled: !this._argv.disableTelemetry,\n });\n return {};\n }\n\n public shouldConfigure(_answers: Answers): Promise<Answers> {\n return this._shouldConfigure;\n }\n}\n"]}
@@ -85,7 +85,7 @@ var util_1 = require("util");
85
85
  var File_1 = require("../../Helper/File");
86
86
  var Logging_1 = require("../../Helper/Logging");
87
87
  var Package_1 = require("../../Helper/Package");
88
- var PackageManager_1 = require("../../Helper/PackageManager");
88
+ var package_manager_1 = require("../../../src/utils/package-manager");
89
89
  var SentryCli_1 = require("../../Helper/SentryCli");
90
90
  var MobileProject_1 = require("./MobileProject");
91
91
  var BottomBar_1 = require("../../Helper/BottomBar");
@@ -122,7 +122,7 @@ var ReactNative = exports.ReactNative = /** @class */ (function (_super) {
122
122
  }
123
123
  (0, Logging_1.nl)();
124
124
  userAnswers = { continue: true };
125
- packageManager = (0, PackageManager_1.getPackageManagerChoice)();
125
+ packageManager = (0, package_manager_1.detectPackageManger)();
126
126
  hasCompatibleReactNativeVersion = (0, Package_1.checkPackageVersion)(this._readAppPackage(), exports.REACT_NATIVE_PACKAGE, exports.COMPATIBLE_REACT_NATIVE_VERSIONS, true);
127
127
  if (!(!hasCompatibleReactNativeVersion && !this._argv.quiet)) return [3 /*break*/, 3];
128
128
  return [4 /*yield*/, (0, inquirer_1.prompt)({
@@ -141,7 +141,7 @@ var ReactNative = exports.ReactNative = /** @class */ (function (_super) {
141
141
  }
142
142
  if (!packageManager) return [3 /*break*/, 5];
143
143
  BottomBar_1.BottomBar.show("Adding ".concat(exports.SENTRY_REACT_NATIVE_PACKAGE, "..."));
144
- return [4 /*yield*/, packageManager.installPackage(exports.SENTRY_REACT_NATIVE_PACKAGE)];
144
+ return [4 /*yield*/, (0, package_manager_1.installPackageWithPackageManager)(packageManager, exports.SENTRY_REACT_NATIVE_PACKAGE)];
145
145
  case 4:
146
146
  _a.sent();
147
147
  BottomBar_1.BottomBar.hide();
@@ -1 +1 @@
1
- {"version":3,"file":"ReactNative.js","sourceRoot":"","sources":["../../../../lib/Steps/Integrations/ReactNative.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8BAA8B;AAC9B,+CAAqC;AACrC,qCAAyB;AAEzB,qCAAkC;AAClC,wCAA4B;AAC5B,yCAA6B;AAC7B,6BAAiC;AAGjC,0CAK2B;AAC3B,gDAA8D;AAC9D,gDAA2D;AAC3D,8DAAsE;AACtE,oDAAmD;AACnD,iDAAgD;AAChD,oDAAmD;AACnD,2BAA0B;AAE1B,IAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;AAElB,QAAA,gCAAgC,GAAG,UAAU,CAAC;AAC9C,QAAA,sBAAsB,GAAG,UAAU,CAAC;AA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AAE;oBACV,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;wBACtC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,KAAK,GAAG,EAAE;4BAC3B,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;4BACpB,MAAM;yBACP;qBACF;iBACF;gBACD,SAAS;aACV;SACF;IACH,CAAC;IAEO,uCAAiB,GAAzB,UACE,SAAiB,EACjB,QAAgB;QAFlB,iBAgBC;QAZC,IAAM,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QACrC,OAAO,IAAI,OAAO,CAAC,UAAC,OAAO,EAAE,MAAM;YACjC,IAAI,CAAC,KAAK,CAAC,UAAC,GAAQ;gBAClB,IAAI,GAAG,EAAE;oBACP,MAAM,CAAC,GAAG,CAAC,CAAC;oBACZ,OAAO;iBACR;gBAED,KAAI,CAAC,yBAAyB,CAAC,IAAI,CAAC,CAAC;gBACrC,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC;YAC5B,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;IA5hBD;;OAEG;IACY,+CAAmC,GAAG,aAAa,CAAC;IA0hBrE,kBAAC;CAAA,AA9hBD,CAAiC,6BAAa,GA8hB7C","sourcesContent":["/* eslint-disable max-lines */\nimport { exec } from 'child_process';\nimport * as fs from 'fs';\nimport type { Answers } from 'inquirer';\nimport { prompt } from 'inquirer';\nimport * as _ from 'lodash';\nimport * as path from 'path';\nimport { promisify } from 'util';\n\nimport type { Args } from '../../Constants';\nimport {\n exists,\n matchesContent,\n matchFiles,\n patchMatchingFile,\n} from '../../Helper/File';\nimport { dim, green, l, nl, red } from '../../Helper/Logging';\nimport { checkPackageVersion } from '../../Helper/Package';\nimport { getPackageManagerChoice } from '../../Helper/PackageManager';\nimport { SentryCli } from '../../Helper/SentryCli';\nimport { MobileProject } from './MobileProject';\nimport { BottomBar } from '../../Helper/BottomBar';\nimport { URL } from 'url';\n\nconst xcode = require('xcode');\n\nexport const COMPATIBLE_REACT_NATIVE_VERSIONS = '>=0.69.0';\nexport const COMPATIBLE_SDK_VERSION = '>= 5.0.0';\n\nexport const SENTRY_REACT_NATIVE_PACKAGE = '@sentry/react-native';\nexport const REACT_NATIVE_PACKAGE = 'react-native';\n\nexport const DOCS_MANUAL_STEPS =\n 'https://docs.sentry.io/platforms/react-native/manual-setup/manual-setup/';\n\nexport class ReactNative extends MobileProject {\n /**\n * All React Native versions have app/build.gradle with android section.\n */\n private static _buildGradleAndroidSectionBeginning = /^android {/m;\n\n private url: string | undefined;\n\n protected _answers: Answers;\n protected _sentryCli: SentryCli;\n\n public constructor(protected _argv: Args) {\n super(_argv);\n this.url = _argv.url;\n this._sentryCli = new SentryCli(this._argv);\n }\n\n public async emit(answers: Answers): Promise<Answers> {\n if (this._argv.uninstall) {\n return this.uninstall(answers);\n }\n if (!(await this.shouldEmit(answers))) {\n return {};\n }\n nl();\n\n let userAnswers: Answers = { continue: true };\n const packageManager = getPackageManagerChoice();\n\n const hasCompatibleReactNativeVersion = checkPackageVersion(\n this._readAppPackage(),\n REACT_NATIVE_PACKAGE,\n COMPATIBLE_REACT_NATIVE_VERSIONS,\n true,\n );\n if (!hasCompatibleReactNativeVersion && !this._argv.quiet) {\n userAnswers = await prompt({\n message:\n \"Your version of React Native is not compatible with Sentry's React Native SDK. Do you want to continue?\",\n name: 'continue',\n default: false,\n type: 'confirm',\n });\n nl();\n }\n if (!userAnswers.continue) {\n throw new Error(\n `Please upgrade to a version that is compatible with ${COMPATIBLE_REACT_NATIVE_VERSIONS}. Or use ${DOCS_MANUAL_STEPS}`,\n );\n }\n\n if (packageManager) {\n BottomBar.show(`Adding ${SENTRY_REACT_NATIVE_PACKAGE}...`);\n await packageManager.installPackage(SENTRY_REACT_NATIVE_PACKAGE);\n BottomBar.hide();\n green(`✓ Added \\`${SENTRY_REACT_NATIVE_PACKAGE}\\``);\n }\n const hasCompatibleSentryReactNativeVersion = checkPackageVersion(\n this._readAppPackage(),\n SENTRY_REACT_NATIVE_PACKAGE,\n COMPATIBLE_SDK_VERSION,\n true,\n );\n if (!hasCompatibleSentryReactNativeVersion && !this._argv.quiet) {\n userAnswers = await prompt({\n message: `Your version of ${SENTRY_REACT_NATIVE_PACKAGE} is not compatible with this wizard. Do you want to continue?`,\n name: 'continue',\n default: false,\n type: 'confirm',\n });\n nl();\n }\n if (!userAnswers.continue) {\n throw new Error(\n `Please upgrade to a version that is compatible with ${COMPATIBLE_SDK_VERSION}.`,\n );\n }\n\n const sentryCliProperties =\n this._sentryCli.convertAnswersToProperties(answers);\n\n const promises = this.getPlatforms(answers).map(\n async (platform: string) => {\n try {\n if (platform === 'ios') {\n await patchMatchingFile(\n 'ios/*.xcodeproj/project.pbxproj',\n this._patchXcodeProj.bind(this),\n );\n green('✓ Patched build script in Xcode project.');\n BottomBar.show('Adding Sentry pods...');\n await this._podInstall();\n BottomBar.hide();\n green('✓ Pods installed.');\n } else {\n await patchMatchingFile(\n '**/app/build.gradle',\n this._patchBuildGradle.bind(this),\n );\n green('✓ Patched build.gradle file.');\n }\n await this._patchJsSentryInit(platform, answers);\n await this._addSentryProperties(platform, sentryCliProperties);\n green(`✓ Added sentry.properties file to ${platform}`);\n } catch (e) {\n red(e);\n }\n },\n );\n\n await Promise.all(promises);\n\n let host: string | null = null;\n try {\n host = new URL(this.url || '').host;\n } catch (_error) {\n // ignore\n }\n const orgSlug = _.get(answers, 'config.organization.slug', null);\n const projectId = _.get(answers, 'config.project.id', null);\n const projectIssuesUrl =\n host && orgSlug && projectId\n ? `https://${orgSlug}.${host}/issues/?project=${projectId}`\n : null;\n\n l(`\nTo make sure everything is set up correctly, put the following code snippet into your application.\nThe snippet will create a button that, when tapped, sends a test event to Sentry.\n`);\n\n if (projectIssuesUrl) {\n l(`After that check your project issues:`);\n l(projectIssuesUrl);\n nl();\n }\n\n l(\n `<Button title='Try!' onPress={ () => { Sentry.captureException(new Error('First error')) }}/>`,\n );\n nl();\n\n if (!this._argv.quiet) {\n await prompt({\n message: 'Have you successfully sent a test event?',\n name: 'snippet',\n default: true,\n type: 'confirm',\n });\n }\n\n return answers;\n }\n\n public async uninstall(_answers: Answers): Promise<Answers> {\n await patchMatchingFile(\n '**/*.xcodeproj/project.pbxproj',\n this._unpatchXcodeProj.bind(this),\n );\n await patchMatchingFile(\n '**/app/build.gradle',\n this._unpatchBuildGradle.bind(this),\n );\n return {};\n }\n\n // eslint-disable-next-line @typescript-eslint/require-await\n protected async _shouldConfigurePlatform(platform: string): Promise<boolean> {\n let result = false;\n\n if (!exists(`${platform}/sentry.properties`)) {\n result = true;\n this.debug(`${platform}/sentry.properties not exists`);\n }\n\n if (!matchesContent('**/*.xcodeproj/project.pbxproj', /sentry-cli/gi)) {\n result = true;\n this.debug('**/*.xcodeproj/project.pbxproj not matched');\n }\n\n if (!matchesContent('**/app/build.gradle', /sentry\\.gradle/gi)) {\n result = true;\n this.debug('**/app/build.gradle not matched');\n }\n\n const regex = /Sentry/gi;\n if (\n exists(`index.${platform}.js`) &&\n !matchesContent(`index.${platform}.js`, regex)\n ) {\n result = true;\n this.debug(`index.${platform}.js not matched`);\n }\n if (exists('App.js') && !matchesContent('App.js', regex)) {\n result = true;\n this.debug('index.js or App.js not matched');\n }\n\n if (this._argv.uninstall) {\n // if we uninstall we need to invert the result so we remove already patched\n // but leave untouched platforms as they are\n return !result;\n }\n\n return result;\n }\n\n private _readAppPackage(): Record<string, unknown> {\n let appPackage: Record<string, unknown> = {};\n\n try {\n appPackage = JSON.parse(\n fs.readFileSync(path.join(process.cwd(), 'package.json'), 'utf8'),\n );\n } catch {\n // We don't need to have this\n }\n\n return appPackage;\n }\n\n private async _podInstall(): Promise<void> {\n await promisify(exec)('npx --yes pod-install --non-interactive --quiet');\n }\n\n private async _patchJsSentryInit(\n platform: string,\n answers: Answers,\n ): Promise<void> {\n const prefixGlob = '{.,./src}';\n const suffixGlob = '@(j|t|cj|mj)s?(x)';\n const platformGlob = `index.${platform}.${suffixGlob}`;\n // rm 0.49 introduced an App.js for both platforms\n const universalGlob = `App.${suffixGlob}`;\n const jsFileGlob = `${prefixGlob}/+(${platformGlob}|${universalGlob})`;\n\n const jsFileToPatch = matchFiles(jsFileGlob);\n if (jsFileToPatch.length !== 0) {\n await patchMatchingFile(\n jsFileGlob,\n this._patchJs.bind(this),\n answers,\n platform,\n );\n green(`✓ Patched ${jsFileToPatch.join(', ')} file(s).`);\n } else {\n red(`✗ Could not find ${platformGlob} nor ${universalGlob} files.`);\n red('✗ Please, visit https://docs.sentry.io/platforms/react-native');\n }\n }\n\n private _addSentryProperties(\n platform: string,\n properties: any,\n ): Promise<void> {\n let rv = Promise.resolve();\n\n // This will create the ios/android folder before trying to write\n // sentry.properties in it which would fail otherwise\n if (!fs.existsSync(platform)) {\n dim(`${platform} folder did not exist, creating it.`);\n fs.mkdirSync(platform);\n }\n const fn = path.join(platform, 'sentry.properties');\n\n if (platform === 'android' && properties['cli/executable']) {\n // We don't need to write the sentry-cli path in the properties file\n // since our gradle plugins already pick it up on the correct spot\n delete properties['cli/executable'];\n }\n rv = rv.then(() =>\n fs.writeFileSync(fn, this._sentryCli.dumpProperties(properties)),\n );\n\n return rv;\n }\n\n private _patchJs(\n contents: string,\n _filename: string,\n answers: Answers,\n platform?: string,\n ): Promise<string | null> {\n // since the init call could live in other places too, we really only\n // want to do this if we managed to patch any of the other files as well.\n if (contents.match(/Sentry.config\\(/)) {\n return Promise.resolve(null);\n }\n\n // if we match @sentry\\/react-native somewhere, we already patched the file\n // and no longer need to\n if (contents.match('@sentry/react-native')) {\n return Promise.resolve(contents);\n }\n\n let dsn = '__DSN__';\n this.getPlatforms(answers).forEach((selectedPlatform: string) => {\n if (platform && selectedPlatform === platform) {\n dsn = _.get(answers, 'config.dsn.public', null);\n } else if (platform === undefined) {\n dsn = _.get(answers, 'config.dsn.public', null);\n }\n });\n\n return Promise.resolve(\n contents.replace(\n /^([^]*)(import\\s+[^;]*?;$)/m,\n (match) =>\n // eslint-disable-next-line prefer-template\n match +\n \"\\n\\nimport * as Sentry from '@sentry/react-native';\\n\\n\" +\n 'Sentry.init({ \\n' +\n ` dsn: '${dsn}', \\n` +\n '});\\n',\n ),\n );\n }\n\n // ANDROID -----------------------------------------\n\n private _patchBuildGradle(contents: string): Promise<string | null> {\n const applyFrom =\n 'apply from: \"../../node_modules/@sentry/react-native/sentry.gradle\"';\n if (contents.indexOf(applyFrom) >= 0) {\n return Promise.resolve(null);\n }\n\n return Promise.resolve(\n contents.replace(\n ReactNative._buildGradleAndroidSectionBeginning,\n // eslint-disable-next-line prefer-template\n (match) => applyFrom + '\\n' + match,\n ),\n );\n }\n\n private _unpatchBuildGradle(contents: string): Promise<string> {\n return Promise.resolve(\n contents.replace(\n /^\\s*apply from: [\"']..\\/..\\/node_modules\\/@sentry\\/react-native\\/sentry.gradle[\"'];?\\s*?\\r?\\n/m,\n '',\n ),\n );\n }\n\n // IOS -----------------------------------------\n\n private _patchExistingXcodeBuildScripts(buildScripts: any): void {\n for (const script of buildScripts) {\n if (\n !script.shellScript.match(/\\/scripts\\/react-native-xcode\\.sh/i) ||\n script.shellScript.match(/sentry-cli\\s+react-native\\s+xcode/i)\n ) {\n continue;\n }\n let code = JSON.parse(script.shellScript);\n code =\n // eslint-disable-next-line prefer-template, @typescript-eslint/restrict-plus-operands\n 'export SENTRY_PROPERTIES=sentry.properties\\n' +\n 'export EXTRA_PACKAGER_ARGS=\"--sourcemap-output $DERIVED_FILE_DIR/main.jsbundle.map\"\\n' +\n code.replace(\n '$REACT_NATIVE_XCODE',\n () =>\n // eslint-disable-next-line no-useless-escape\n '\\\\\"../node_modules/@sentry/cli/bin/sentry-cli react-native xcode $REACT_NATIVE_XCODE\\\\\"',\n ) +\n '\\n/bin/sh -c \"$WITH_ENVIRONMENT ../node_modules/@sentry/react-native/scripts/collect-modules.sh\"\\n';\n script.shellScript = JSON.stringify(code);\n }\n }\n\n private _addNewXcodeBuildPhaseForSymbols(buildScripts: any, proj: any): void {\n for (const script of buildScripts) {\n if (\n script.shellScript.match(\n /sentry-cli\\s+(upload-dsym|debug-files upload)/,\n )\n ) {\n return;\n }\n }\n\n proj.addBuildPhase(\n [],\n 'PBXShellScriptBuildPhase',\n 'Upload Debug Symbols to Sentry',\n null,\n {\n shellPath: '/bin/sh',\n shellScript: `\nWITH_ENVIRONMENT=\"../node_modules/react-native/scripts/xcode/with-environment.sh\"\nif [ -f \"$WITH_ENVIRONMENT\" ]; then\n . \"$WITH_ENVIRONMENT\"\nfi \nexport SENTRY_PROPERTIES=sentry.properties\n[ \"$SENTRY_INCLUDE_NATIVE_SOURCES\" = \"true\" ] && INCLUDE_SOURCES_FLAG=\"--include-sources\" || INCLUDE_SOURCES_FLAG=\"\"\n../node_modules/@sentry/cli/bin/sentry-cli debug-files upload \"$INCLUDE_SOURCES_FLAG\" \"$DWARF_DSYM_FOLDER_PATH\"\n`,\n },\n );\n }\n\n private _patchXcodeProj(\n contents: string,\n filename: string,\n ): Promise<string | undefined> {\n const proj = xcode.project(filename);\n return new Promise((resolve, reject) => {\n proj.parse((err: any) => {\n if (err) {\n reject(err);\n return;\n }\n\n const buildScripts = [];\n for (const key in proj.hash.project.objects.PBXShellScriptBuildPhase ||\n {}) {\n if (\n // eslint-disable-next-line no-prototype-builtins\n proj.hash.project.objects.PBXShellScriptBuildPhase.hasOwnProperty(\n key,\n )\n ) {\n const val = proj.hash.project.objects.PBXShellScriptBuildPhase[key];\n if (val.isa) {\n buildScripts.push(val);\n }\n }\n }\n\n try {\n this._patchExistingXcodeBuildScripts(buildScripts);\n } catch (e) {\n red(e);\n }\n try {\n this._addNewXcodeBuildPhaseForSymbols(buildScripts, proj);\n } catch (e) {\n red(e);\n }\n\n // we always modify the xcode file in memory but we only want to save it\n // in case the user wants configuration for ios. This is why we check\n // here first if changes are made before we might prompt the platform\n // continue prompt.\n const newContents = proj.writeSync();\n if (newContents === contents) {\n resolve(undefined);\n } else {\n resolve(newContents);\n }\n });\n });\n }\n\n private _unpatchXcodeBuildScripts(proj: any): void {\n const scripts = proj.hash.project.objects.PBXShellScriptBuildPhase || {};\n const firstTarget = proj.getFirstTarget().uuid;\n const nativeTargets = proj.hash.project.objects.PBXNativeTarget;\n\n // scripts to patch partially. Run this first so that we don't\n // accidentally delete some scripts later entirely that we only want to\n // rewrite.\n for (const key of Object.keys(scripts)) {\n const script = scripts[key];\n\n // ignore comments\n if (typeof script === 'string') {\n continue;\n }\n\n // ignore scripts that do not invoke the react-native-xcode command.\n if (!script.shellScript.match(/sentry-cli\\s+react-native\\s+xcode/i)) {\n continue;\n }\n\n script.shellScript = JSON.stringify(\n JSON.parse(script.shellScript)\n // remove sentry properties export\n .replace(/^export SENTRY_PROPERTIES=sentry.properties\\r?\\n/m, '')\n .replace(\n /^\\/bin\\/sh .*?..\\/node_modules\\/@sentry\\/react-native\\/scripts\\/collect-modules.sh\"?\\r?\\n/m,\n '',\n )\n // unwrap react-native-xcode.sh command. In case someone replaced it\n // entirely with the sentry-cli command we need to put the original\n // version back in.\n .replace(\n /\\.\\.\\/node_modules\\/@sentry\\/cli\\/bin\\/sentry-cli\\s+react-native\\s+xcode\\s+\\$REACT_NATIVE_XCODE/i,\n '$REACT_NATIVE_XCODE',\n ),\n );\n }\n\n // scripts to kill entirely.\n for (const key of Object.keys(scripts)) {\n const script = scripts[key];\n\n // ignore comments and keys that got deleted\n if (typeof script === 'string' || script === undefined) {\n continue;\n }\n\n if (\n script.shellScript.match(\n /@sentry\\/cli\\/bin\\/sentry-cli\\s+(upload-dsym|debug-files upload)\\b/,\n )\n ) {\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete scripts[key];\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete scripts[`${key}_comment`];\n const phases = nativeTargets[firstTarget].buildPhases;\n if (phases) {\n for (let i = 0; i < phases.length; i++) {\n if (phases[i].value === key) {\n phases.splice(i, 1);\n break;\n }\n }\n }\n continue;\n }\n }\n }\n\n private _unpatchXcodeProj(\n _contents: string,\n filename: string,\n ): Promise<string> {\n const proj = xcode.project(filename);\n return new Promise((resolve, reject) => {\n proj.parse((err: any) => {\n if (err) {\n reject(err);\n return;\n }\n\n this._unpatchXcodeBuildScripts(proj);\n resolve(proj.writeSync());\n });\n });\n }\n}\n"]}
1
+ {"version":3,"file":"ReactNative.js","sourceRoot":"","sources":["../../../../lib/Steps/Integrations/ReactNative.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8BAA8B;AAC9B,+CAAqC;AACrC,qCAAyB;AAEzB,qCAAkC;AAClC,wCAA4B;AAC5B,yCAA6B;AAC7B,6BAAiC;AAGjC,0CAK2B;AAC3B,gDAA8D;AAC9D,gDAA2D;AAC3D,sEAG4C;AAC5C,oDAAmD;AACnD,iDAAgD;AAChD,oDAAmD;AACnD,2BAA0B;AAE1B,IAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;AAElB,QAAA,gCAAgC,GAAG,UAAU,CAAC;AAC9C,QAAA,sBAAsB,GAAG,UAAU,CAAC;AAEpC,QAAA,2BAA2B,GAAG,sBAAsB,CAAC;AACrD,QAAA,oBAAoB,GAAG,cAAc,CAAC;AAEtC,QAAA,iBAAiB,GAC5B,0EAA0E,CAAC;AAE7E;IAAiC,+BAAa;IAW5C,qBAA6B,KAAW;QAAxC,YACE,kBAAM,KAAK,CAAC,SAGb;QAJ4B,WAAK,GAAL,KAAK,CAAM;QAEtC,KAAI,CAAC,GAAG,GAAG,KAAK,CAAC,GAAG,CAAC;QACrB,KAAI,CAAC,UAAU,GAAG,IAAI,qBAAS,CAAC,KAAI,CAAC,KAAK,CAAC,CAAC;;IAC9C,CAAC;IAEY,0BAAI,GAAjB,UAAkB,OAAgB;;;;;;;wBAChC,IAAI,IAAI,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I,OAAO,CAAC,UAAC,OAAO,EAAE,MAAM;YACjC,IAAI,CAAC,KAAK,CAAC,UAAC,GAAQ;gBAClB,IAAI,GAAG,EAAE;oBACP,MAAM,CAAC,GAAG,CAAC,CAAC;oBACZ,OAAO;iBACR;gBAED,KAAI,CAAC,yBAAyB,CAAC,IAAI,CAAC,CAAC;gBACrC,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC;YAC5B,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;IA/hBD;;OAEG;IACY,+CAAmC,GAAG,aAAa,CAAC;IA6hBrE,kBAAC;CAAA,AAjiBD,CAAiC,6BAAa,GAiiB7C","sourcesContent":["/* eslint-disable max-lines */\nimport { exec } from 'child_process';\nimport * as fs from 'fs';\nimport type { Answers } from 'inquirer';\nimport { prompt } from 'inquirer';\nimport * as _ from 'lodash';\nimport * as path from 'path';\nimport { promisify } from 'util';\n\nimport type { Args } from '../../Constants';\nimport {\n exists,\n matchesContent,\n matchFiles,\n patchMatchingFile,\n} from '../../Helper/File';\nimport { dim, green, l, nl, red } from '../../Helper/Logging';\nimport { checkPackageVersion } from '../../Helper/Package';\nimport {\n detectPackageManger,\n installPackageWithPackageManager,\n} from '../../../src/utils/package-manager';\nimport { SentryCli } from '../../Helper/SentryCli';\nimport { MobileProject } from './MobileProject';\nimport { BottomBar } from '../../Helper/BottomBar';\nimport { URL } from 'url';\n\nconst xcode = require('xcode');\n\nexport const COMPATIBLE_REACT_NATIVE_VERSIONS = '>=0.69.0';\nexport const COMPATIBLE_SDK_VERSION = '>= 5.0.0';\n\nexport const SENTRY_REACT_NATIVE_PACKAGE = '@sentry/react-native';\nexport const REACT_NATIVE_PACKAGE = 'react-native';\n\nexport const DOCS_MANUAL_STEPS =\n 'https://docs.sentry.io/platforms/react-native/manual-setup/manual-setup/';\n\nexport class ReactNative extends MobileProject {\n /**\n * All React Native versions have app/build.gradle with android section.\n */\n private static _buildGradleAndroidSectionBeginning = /^android {/m;\n\n private url: string | undefined;\n\n protected _answers: Answers;\n protected _sentryCli: SentryCli;\n\n public constructor(protected _argv: Args) {\n super(_argv);\n this.url = _argv.url;\n this._sentryCli = new SentryCli(this._argv);\n }\n\n public async emit(answers: Answers): Promise<Answers> {\n if (this._argv.uninstall) {\n return this.uninstall(answers);\n }\n if (!(await this.shouldEmit(answers))) {\n return {};\n }\n nl();\n\n let userAnswers: Answers = { continue: true };\n const packageManager = detectPackageManger();\n\n const hasCompatibleReactNativeVersion = checkPackageVersion(\n this._readAppPackage(),\n REACT_NATIVE_PACKAGE,\n COMPATIBLE_REACT_NATIVE_VERSIONS,\n true,\n );\n if (!hasCompatibleReactNativeVersion && !this._argv.quiet) {\n userAnswers = await prompt({\n message:\n \"Your version of React Native is not compatible with Sentry's React Native SDK. Do you want to continue?\",\n name: 'continue',\n default: false,\n type: 'confirm',\n });\n nl();\n }\n if (!userAnswers.continue) {\n throw new Error(\n `Please upgrade to a version that is compatible with ${COMPATIBLE_REACT_NATIVE_VERSIONS}. Or use ${DOCS_MANUAL_STEPS}`,\n );\n }\n\n if (packageManager) {\n BottomBar.show(`Adding ${SENTRY_REACT_NATIVE_PACKAGE}...`);\n await installPackageWithPackageManager(\n packageManager,\n SENTRY_REACT_NATIVE_PACKAGE,\n );\n BottomBar.hide();\n green(`✓ Added \\`${SENTRY_REACT_NATIVE_PACKAGE}\\``);\n }\n const hasCompatibleSentryReactNativeVersion = checkPackageVersion(\n this._readAppPackage(),\n SENTRY_REACT_NATIVE_PACKAGE,\n COMPATIBLE_SDK_VERSION,\n true,\n );\n if (!hasCompatibleSentryReactNativeVersion && !this._argv.quiet) {\n userAnswers = await prompt({\n message: `Your version of ${SENTRY_REACT_NATIVE_PACKAGE} is not compatible with this wizard. Do you want to continue?`,\n name: 'continue',\n default: false,\n type: 'confirm',\n });\n nl();\n }\n if (!userAnswers.continue) {\n throw new Error(\n `Please upgrade to a version that is compatible with ${COMPATIBLE_SDK_VERSION}.`,\n );\n }\n\n const sentryCliProperties =\n this._sentryCli.convertAnswersToProperties(answers);\n\n const promises = this.getPlatforms(answers).map(\n async (platform: string) => {\n try {\n if (platform === 'ios') {\n await patchMatchingFile(\n 'ios/*.xcodeproj/project.pbxproj',\n this._patchXcodeProj.bind(this),\n );\n green('✓ Patched build script in Xcode project.');\n BottomBar.show('Adding Sentry pods...');\n await this._podInstall();\n BottomBar.hide();\n green('✓ Pods installed.');\n } else {\n await patchMatchingFile(\n '**/app/build.gradle',\n this._patchBuildGradle.bind(this),\n );\n green('✓ Patched build.gradle file.');\n }\n await this._patchJsSentryInit(platform, answers);\n await this._addSentryProperties(platform, sentryCliProperties);\n green(`✓ Added sentry.properties file to ${platform}`);\n } catch (e) {\n red(e);\n }\n },\n );\n\n await Promise.all(promises);\n\n let host: string | null = null;\n try {\n host = new URL(this.url || '').host;\n } catch (_error) {\n // ignore\n }\n const orgSlug = _.get(answers, 'config.organization.slug', null);\n const projectId = _.get(answers, 'config.project.id', null);\n const projectIssuesUrl =\n host && orgSlug && projectId\n ? `https://${orgSlug}.${host}/issues/?project=${projectId}`\n : null;\n\n l(`\nTo make sure everything is set up correctly, put the following code snippet into your application.\nThe snippet will create a button that, when tapped, sends a test event to Sentry.\n`);\n\n if (projectIssuesUrl) {\n l(`After that check your project issues:`);\n l(projectIssuesUrl);\n nl();\n }\n\n l(\n `<Button title='Try!' onPress={ () => { Sentry.captureException(new Error('First error')) }}/>`,\n );\n nl();\n\n if (!this._argv.quiet) {\n await prompt({\n message: 'Have you successfully sent a test event?',\n name: 'snippet',\n default: true,\n type: 'confirm',\n });\n }\n\n return answers;\n }\n\n public async uninstall(_answers: Answers): Promise<Answers> {\n await patchMatchingFile(\n '**/*.xcodeproj/project.pbxproj',\n this._unpatchXcodeProj.bind(this),\n );\n await patchMatchingFile(\n '**/app/build.gradle',\n this._unpatchBuildGradle.bind(this),\n );\n return {};\n }\n\n // eslint-disable-next-line @typescript-eslint/require-await\n protected async _shouldConfigurePlatform(platform: string): Promise<boolean> {\n let result = false;\n\n if (!exists(`${platform}/sentry.properties`)) {\n result = true;\n this.debug(`${platform}/sentry.properties not exists`);\n }\n\n if (!matchesContent('**/*.xcodeproj/project.pbxproj', /sentry-cli/gi)) {\n result = true;\n this.debug('**/*.xcodeproj/project.pbxproj not matched');\n }\n\n if (!matchesContent('**/app/build.gradle', /sentry\\.gradle/gi)) {\n result = true;\n this.debug('**/app/build.gradle not matched');\n }\n\n const regex = /Sentry/gi;\n if (\n exists(`index.${platform}.js`) &&\n !matchesContent(`index.${platform}.js`, regex)\n ) {\n result = true;\n this.debug(`index.${platform}.js not matched`);\n }\n if (exists('App.js') && !matchesContent('App.js', regex)) {\n result = true;\n this.debug('index.js or App.js not matched');\n }\n\n if (this._argv.uninstall) {\n // if we uninstall we need to invert the result so we remove already patched\n // but leave untouched platforms as they are\n return !result;\n }\n\n return result;\n }\n\n private _readAppPackage(): Record<string, unknown> {\n let appPackage: Record<string, unknown> = {};\n\n try {\n appPackage = JSON.parse(\n fs.readFileSync(path.join(process.cwd(), 'package.json'), 'utf8'),\n );\n } catch {\n // We don't need to have this\n }\n\n return appPackage;\n }\n\n private async _podInstall(): Promise<void> {\n await promisify(exec)('npx --yes pod-install --non-interactive --quiet');\n }\n\n private async _patchJsSentryInit(\n platform: string,\n answers: Answers,\n ): Promise<void> {\n const prefixGlob = '{.,./src}';\n const suffixGlob = '@(j|t|cj|mj)s?(x)';\n const platformGlob = `index.${platform}.${suffixGlob}`;\n // rm 0.49 introduced an App.js for both platforms\n const universalGlob = `App.${suffixGlob}`;\n const jsFileGlob = `${prefixGlob}/+(${platformGlob}|${universalGlob})`;\n\n const jsFileToPatch = matchFiles(jsFileGlob);\n if (jsFileToPatch.length !== 0) {\n await patchMatchingFile(\n jsFileGlob,\n this._patchJs.bind(this),\n answers,\n platform,\n );\n green(`✓ Patched ${jsFileToPatch.join(', ')} file(s).`);\n } else {\n red(`✗ Could not find ${platformGlob} nor ${universalGlob} files.`);\n red('✗ Please, visit https://docs.sentry.io/platforms/react-native');\n }\n }\n\n private _addSentryProperties(\n platform: string,\n properties: any,\n ): Promise<void> {\n let rv = Promise.resolve();\n\n // This will create the ios/android folder before trying to write\n // sentry.properties in it which would fail otherwise\n if (!fs.existsSync(platform)) {\n dim(`${platform} folder did not exist, creating it.`);\n fs.mkdirSync(platform);\n }\n const fn = path.join(platform, 'sentry.properties');\n\n if (platform === 'android' && properties['cli/executable']) {\n // We don't need to write the sentry-cli path in the properties file\n // since our gradle plugins already pick it up on the correct spot\n delete properties['cli/executable'];\n }\n rv = rv.then(() =>\n fs.writeFileSync(fn, this._sentryCli.dumpProperties(properties)),\n );\n\n return rv;\n }\n\n private _patchJs(\n contents: string,\n _filename: string,\n answers: Answers,\n platform?: string,\n ): Promise<string | null> {\n // since the init call could live in other places too, we really only\n // want to do this if we managed to patch any of the other files as well.\n if (contents.match(/Sentry.config\\(/)) {\n return Promise.resolve(null);\n }\n\n // if we match @sentry\\/react-native somewhere, we already patched the file\n // and no longer need to\n if (contents.match('@sentry/react-native')) {\n return Promise.resolve(contents);\n }\n\n let dsn = '__DSN__';\n this.getPlatforms(answers).forEach((selectedPlatform: string) => {\n if (platform && selectedPlatform === platform) {\n dsn = _.get(answers, 'config.dsn.public', null);\n } else if (platform === undefined) {\n dsn = _.get(answers, 'config.dsn.public', null);\n }\n });\n\n return Promise.resolve(\n contents.replace(\n /^([^]*)(import\\s+[^;]*?;$)/m,\n (match) =>\n // eslint-disable-next-line prefer-template\n match +\n \"\\n\\nimport * as Sentry from '@sentry/react-native';\\n\\n\" +\n 'Sentry.init({ \\n' +\n ` dsn: '${dsn}', \\n` +\n '});\\n',\n ),\n );\n }\n\n // ANDROID -----------------------------------------\n\n private _patchBuildGradle(contents: string): Promise<string | null> {\n const applyFrom =\n 'apply from: \"../../node_modules/@sentry/react-native/sentry.gradle\"';\n if (contents.indexOf(applyFrom) >= 0) {\n return Promise.resolve(null);\n }\n\n return Promise.resolve(\n contents.replace(\n ReactNative._buildGradleAndroidSectionBeginning,\n // eslint-disable-next-line prefer-template\n (match) => applyFrom + '\\n' + match,\n ),\n );\n }\n\n private _unpatchBuildGradle(contents: string): Promise<string> {\n return Promise.resolve(\n contents.replace(\n /^\\s*apply from: [\"']..\\/..\\/node_modules\\/@sentry\\/react-native\\/sentry.gradle[\"'];?\\s*?\\r?\\n/m,\n '',\n ),\n );\n }\n\n // IOS -----------------------------------------\n\n private _patchExistingXcodeBuildScripts(buildScripts: any): void {\n for (const script of buildScripts) {\n if (\n !script.shellScript.match(/\\/scripts\\/react-native-xcode\\.sh/i) ||\n script.shellScript.match(/sentry-cli\\s+react-native\\s+xcode/i)\n ) {\n continue;\n }\n let code = JSON.parse(script.shellScript);\n code =\n // eslint-disable-next-line prefer-template, @typescript-eslint/restrict-plus-operands\n 'export SENTRY_PROPERTIES=sentry.properties\\n' +\n 'export EXTRA_PACKAGER_ARGS=\"--sourcemap-output $DERIVED_FILE_DIR/main.jsbundle.map\"\\n' +\n code.replace(\n '$REACT_NATIVE_XCODE',\n () =>\n // eslint-disable-next-line no-useless-escape\n '\\\\\"../node_modules/@sentry/cli/bin/sentry-cli react-native xcode $REACT_NATIVE_XCODE\\\\\"',\n ) +\n '\\n/bin/sh -c \"$WITH_ENVIRONMENT ../node_modules/@sentry/react-native/scripts/collect-modules.sh\"\\n';\n script.shellScript = JSON.stringify(code);\n }\n }\n\n private _addNewXcodeBuildPhaseForSymbols(buildScripts: any, proj: any): void {\n for (const script of buildScripts) {\n if (\n script.shellScript.match(\n /sentry-cli\\s+(upload-dsym|debug-files upload)/,\n )\n ) {\n return;\n }\n }\n\n proj.addBuildPhase(\n [],\n 'PBXShellScriptBuildPhase',\n 'Upload Debug Symbols to Sentry',\n null,\n {\n shellPath: '/bin/sh',\n shellScript: `\nWITH_ENVIRONMENT=\"../node_modules/react-native/scripts/xcode/with-environment.sh\"\nif [ -f \"$WITH_ENVIRONMENT\" ]; then\n . \"$WITH_ENVIRONMENT\"\nfi \nexport SENTRY_PROPERTIES=sentry.properties\n[ \"$SENTRY_INCLUDE_NATIVE_SOURCES\" = \"true\" ] && INCLUDE_SOURCES_FLAG=\"--include-sources\" || INCLUDE_SOURCES_FLAG=\"\"\n../node_modules/@sentry/cli/bin/sentry-cli debug-files upload \"$INCLUDE_SOURCES_FLAG\" \"$DWARF_DSYM_FOLDER_PATH\"\n`,\n },\n );\n }\n\n private _patchXcodeProj(\n contents: string,\n filename: string,\n ): Promise<string | undefined> {\n const proj = xcode.project(filename);\n return new Promise((resolve, reject) => {\n proj.parse((err: any) => {\n if (err) {\n reject(err);\n return;\n }\n\n const buildScripts = [];\n for (const key in proj.hash.project.objects.PBXShellScriptBuildPhase ||\n {}) {\n if (\n // eslint-disable-next-line no-prototype-builtins\n proj.hash.project.objects.PBXShellScriptBuildPhase.hasOwnProperty(\n key,\n )\n ) {\n const val = proj.hash.project.objects.PBXShellScriptBuildPhase[key];\n if (val.isa) {\n buildScripts.push(val);\n }\n }\n }\n\n try {\n this._patchExistingXcodeBuildScripts(buildScripts);\n } catch (e) {\n red(e);\n }\n try {\n this._addNewXcodeBuildPhaseForSymbols(buildScripts, proj);\n } catch (e) {\n red(e);\n }\n\n // we always modify the xcode file in memory but we only want to save it\n // in case the user wants configuration for ios. This is why we check\n // here first if changes are made before we might prompt the platform\n // continue prompt.\n const newContents = proj.writeSync();\n if (newContents === contents) {\n resolve(undefined);\n } else {\n resolve(newContents);\n }\n });\n });\n }\n\n private _unpatchXcodeBuildScripts(proj: any): void {\n const scripts = proj.hash.project.objects.PBXShellScriptBuildPhase || {};\n const firstTarget = proj.getFirstTarget().uuid;\n const nativeTargets = proj.hash.project.objects.PBXNativeTarget;\n\n // scripts to patch partially. Run this first so that we don't\n // accidentally delete some scripts later entirely that we only want to\n // rewrite.\n for (const key of Object.keys(scripts)) {\n const script = scripts[key];\n\n // ignore comments\n if (typeof script === 'string') {\n continue;\n }\n\n // ignore scripts that do not invoke the react-native-xcode command.\n if (!script.shellScript.match(/sentry-cli\\s+react-native\\s+xcode/i)) {\n continue;\n }\n\n script.shellScript = JSON.stringify(\n JSON.parse(script.shellScript)\n // remove sentry properties export\n .replace(/^export SENTRY_PROPERTIES=sentry.properties\\r?\\n/m, '')\n .replace(\n /^\\/bin\\/sh .*?..\\/node_modules\\/@sentry\\/react-native\\/scripts\\/collect-modules.sh\"?\\r?\\n/m,\n '',\n )\n // unwrap react-native-xcode.sh command. In case someone replaced it\n // entirely with the sentry-cli command we need to put the original\n // version back in.\n .replace(\n /\\.\\.\\/node_modules\\/@sentry\\/cli\\/bin\\/sentry-cli\\s+react-native\\s+xcode\\s+\\$REACT_NATIVE_XCODE/i,\n '$REACT_NATIVE_XCODE',\n ),\n );\n }\n\n // scripts to kill entirely.\n for (const key of Object.keys(scripts)) {\n const script = scripts[key];\n\n // ignore comments and keys that got deleted\n if (typeof script === 'string' || script === undefined) {\n continue;\n }\n\n if (\n script.shellScript.match(\n /@sentry\\/cli\\/bin\\/sentry-cli\\s+(upload-dsym|debug-files upload)\\b/,\n )\n ) {\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete scripts[key];\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete scripts[`${key}_comment`];\n const phases = nativeTargets[firstTarget].buildPhases;\n if (phases) {\n for (let i = 0; i < phases.length; i++) {\n if (phases[i].value === key) {\n phases.splice(i, 1);\n break;\n }\n }\n }\n continue;\n }\n }\n }\n\n private _unpatchXcodeProj(\n _contents: string,\n filename: string,\n ): Promise<string> {\n const proj = xcode.project(filename);\n return new Promise((resolve, reject) => {\n proj.parse((err: any) => {\n if (err) {\n reject(err);\n return;\n }\n\n this._unpatchXcodeBuildScripts(proj);\n resolve(proj.writeSync());\n });\n });\n }\n}\n"]}
@@ -137,11 +137,11 @@ var PromptForParameters = /** @class */ (function (_super) {
137
137
  return [4 /*yield*/, (0, inquirer_1.prompt)([
138
138
  {
139
139
  message: 'DSN:',
140
- name: 'secret',
140
+ name: 'public',
141
141
  type: 'input',
142
142
  // eslint-disable-next-line @typescript-eslint/unbound-method
143
143
  validate: this._validateDSN,
144
- when: this._shouldAsk(answers, 'config.dsn.secret', function () {
144
+ when: this._shouldAsk(answers, 'config.dsn.public', function () {
145
145
  (0, Logging_1.dim)('Please copy/paste your DSN');
146
146
  (0, Logging_1.dim)("It can be found here: ".concat(url));
147
147
  }),
@@ -191,7 +191,14 @@ var PromptForParameters = /** @class */ (function (_super) {
191
191
  return shouldAsk;
192
192
  };
193
193
  PromptForParameters.prototype._validateAuthToken = function (input) {
194
- if (!input.match(/[0-9a-f]{64}/g)) {
194
+ var isOrgToken = input.startsWith('sntrys_');
195
+ if (isOrgToken) {
196
+ if (!isValidOrgToken(input)) {
197
+ return 'Make sure you correctly copied your auth token. It should start with "sntrys_"';
198
+ }
199
+ return true;
200
+ }
201
+ if (!input.match(/(sntrys_)?[0-9a-f]{64}/g)) {
195
202
  return 'Make sure you copied the correct auth token, it should be 64 hex chars';
196
203
  }
197
204
  return true;
@@ -218,4 +225,30 @@ var PromptForParameters = /** @class */ (function (_super) {
218
225
  return PromptForParameters;
219
226
  }(BaseStep_1.BaseStep));
220
227
  exports.PromptForParameters = PromptForParameters;
228
+ /**
229
+ * Trying to parse and decode an org auth token. Based on:
230
+ * - https://github.com/getsentry/rfcs/blob/main/text/0091-ci-upload-tokens.md#parsing-tokens
231
+ * - https://github.com/getsentry/rfcs/blob/main/text/0091-ci-upload-tokens.md#token-facts
232
+ */
233
+ function isValidOrgToken(input) {
234
+ if (!input.startsWith('sntrys_')) {
235
+ return false;
236
+ }
237
+ var tokenParts = input.split('_');
238
+ if (tokenParts.length < 3) {
239
+ return false;
240
+ }
241
+ try {
242
+ var payload = tokenParts[1];
243
+ var decodedPayload = Buffer.from(payload, 'base64').toString();
244
+ var jsonPayload = JSON.parse(decodedPayload);
245
+ if (!jsonPayload.iat || !jsonPayload.url || !jsonPayload.org) {
246
+ return false;
247
+ }
248
+ }
249
+ catch (_a) {
250
+ return false;
251
+ }
252
+ return true;
253
+ }
221
254
  //# sourceMappingURL=PromptForParameters.js.map