@iflyrpa/playwright 1.2.24 → 1.2.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -44,7 +44,7 @@ __webpack_require__.d(__webpack_exports__, {
44
44
  });
45
45
  const actions_namespaceObject = require("@iflyrpa/actions");
46
46
  var package_namespaceObject = {
47
- i8: "1.2.23"
47
+ i8: "1.2.25"
48
48
  };
49
49
  const external_node_fs_namespaceObject = require("node:fs");
50
50
  var external_node_fs_default = /*#__PURE__*/ __webpack_require__.n(external_node_fs_namespaceObject);
@@ -124,10 +124,11 @@ class ElectronInstall {
124
124
  await external_extract_zip_default()(zipPath, {
125
125
  dir: this.rootDir
126
126
  });
127
- this.task.logger.info(`electron@${this.version} 下载成功`);
127
+ this.task.logger.info("electron download success");
128
128
  return this.electronPath;
129
129
  } catch (error) {
130
130
  this.task.logger.error(`electron@${this.version} 下载失败`, error);
131
+ this.task.logger.info("electron download fail");
131
132
  throw error;
132
133
  }
133
134
  }
@@ -172,10 +173,11 @@ const launchElectronApp = async (task, playwright, electronPath)=>{
172
173
  ],
173
174
  cwd: cachePath
174
175
  });
175
- logger.info(`electron 启动成功:${electronPath} ${mainPath}`);
176
+ logger.info("electron launch success");
176
177
  return electronApp;
177
178
  } catch (error) {
178
179
  logger.error("electron 启动失败:", error);
180
+ logger.info("electron launch fail");
179
181
  throw error;
180
182
  }
181
183
  };
@@ -200,14 +202,27 @@ class SentryInstance {
200
202
  updateUser(user) {
201
203
  this.user = user;
202
204
  }
203
- captureException(error) {
205
+ setScope(callback, extras) {
204
206
  (0, node_namespaceObject.withScope)((scope)=>{
205
- var _this_sentry;
207
+ scope.setTransactionName("rpa");
206
208
  if (this.coreVersion) scope.setTag("coreVersion", this.coreVersion);
207
209
  if (this.user) scope.setUser(this.user);
208
- null === (_this_sentry = this.sentry) || void 0 === _this_sentry || _this_sentry.captureException(error);
210
+ if (extras) scope.setExtras(extras);
211
+ callback(scope);
209
212
  });
210
213
  }
214
+ captureException(error, extras) {
215
+ this.setScope(()=>{
216
+ var _this_sentry;
217
+ return null === (_this_sentry = this.sentry) || void 0 === _this_sentry ? void 0 : _this_sentry.captureException(error);
218
+ }, extras);
219
+ }
220
+ captureMessage(message, level, extras) {
221
+ this.setScope(()=>{
222
+ var _this_sentry;
223
+ return null === (_this_sentry = this.sentry) || void 0 === _this_sentry ? void 0 : _this_sentry.captureMessage(message, level);
224
+ }, extras);
225
+ }
211
226
  constructor(taskParams){
212
227
  sentry_define_property(this, "sentry", void 0);
213
228
  sentry_define_property(this, "coreVersion", void 0);
@@ -216,6 +231,7 @@ class SentryInstance {
216
231
  this.sentry = (0, node_namespaceObject.initWithoutDefaultIntegrations)({
217
232
  dsn: DEFAULT_SENTRY_DSN,
218
233
  environment: taskParams.enverionment || "development",
234
+ tracesSampleRate: 1.0,
219
235
  initialScope: {
220
236
  user: taskParams.user,
221
237
  tags: {
@@ -236,18 +252,21 @@ function logger_define_property(obj, key, value) {
236
252
  return obj;
237
253
  }
238
254
  class Logger extends SentryInstance {
239
- debug(...msg) {
240
- external_loglevel_default().debug(...msg);
255
+ debug(msg, extras) {
256
+ external_loglevel_default().debug(msg);
257
+ this.captureMessage(msg, "debug", extras);
241
258
  }
242
- info(...msg) {
243
- external_loglevel_default().info(...msg);
259
+ info(msg, extras) {
260
+ external_loglevel_default().info(msg);
261
+ this.captureMessage(msg, "info", extras);
244
262
  }
245
- warn(...msg) {
246
- external_loglevel_default().warn(...msg);
263
+ warn(msg, extras) {
264
+ external_loglevel_default().warn(msg);
265
+ this.captureMessage(msg, "warning", extras);
247
266
  }
248
267
  error(prefix, error) {
249
268
  if (error instanceof Error) error.message = `${prefix}: ${error.message}`;
250
- else if (error && 'object' == typeof error) {
269
+ else if (error && "object" == typeof error) {
251
270
  const errorStr = JSON.stringify(error, null, 2);
252
271
  error = new Error(`${prefix}: ${errorStr}`);
253
272
  } else error = new Error(`${prefix}: ${error}`);
package/dist/index.d.ts CHANGED
@@ -5,6 +5,7 @@ import { LoggerImplement } from '@iflyrpa/share';
5
5
  import { Page } from 'playwright-core';
6
6
  import type { PageParams } from '@iflyrpa/share';
7
7
  import * as RpaAction from '@iflyrpa/actions';
8
+ import { SeverityLevel } from '@sentry/node';
8
9
  import { User } from '@sentry/node';
9
10
 
10
11
  export { ActionMethodParams }
@@ -12,9 +13,9 @@ export { ActionMethodParams }
12
13
  declare class Logger extends SentryInstance implements LoggerImplement {
13
14
  private stream;
14
15
  constructor(taskParams: TaskParams);
15
- debug(...msg: any[]): void;
16
- info(...msg: any[]): void;
17
- warn(...msg: any[]): void;
16
+ debug(msg: string, extras?: Record<string, unknown>): void;
17
+ info(msg: string, extras?: Record<string, unknown>): void;
18
+ warn(msg: string, extras?: Record<string, unknown>): void;
18
19
  error(prefix: string, error?: Error | unknown): void;
19
20
  close(): void;
20
21
  }
@@ -44,7 +45,9 @@ declare class SentryInstance {
44
45
  constructor(taskParams: TaskParams);
45
46
  updateCoreVersion(version: string): void;
46
47
  updateUser(user: User): void;
47
- captureException(error: unknown): void;
48
+ private setScope;
49
+ captureException(error: unknown, extras?: Record<string, unknown>): void;
50
+ captureMessage(message: string, level?: SeverityLevel, extras?: Record<string, unknown>): void;
48
51
  }
49
52
 
50
53
  declare class Task implements AutomateTask {
package/dist/index.js CHANGED
@@ -10,7 +10,7 @@ import * as __WEBPACK_EXTERNAL_MODULE_loglevel__ from "loglevel";
10
10
  import * as __WEBPACK_EXTERNAL_MODULE__sentry_node_4658624b__ from "@sentry/node";
11
11
  import * as __WEBPACK_EXTERNAL_MODULE__iflyrpa_pacote_56da1cff__ from "@iflyrpa/pacote";
12
12
  var package_namespaceObject = {
13
- i8: "1.2.23"
13
+ i8: "1.2.25"
14
14
  };
15
15
  function _define_property(obj, key, value) {
16
16
  if (key in obj) Object.defineProperty(obj, key, {
@@ -79,10 +79,11 @@ class ElectronInstall {
79
79
  await (0, __WEBPACK_EXTERNAL_MODULE_extract_zip_c4acec5a__["default"])(zipPath, {
80
80
  dir: this.rootDir
81
81
  });
82
- this.task.logger.info(`electron@${this.version} 下载成功`);
82
+ this.task.logger.info("electron download success");
83
83
  return this.electronPath;
84
84
  } catch (error) {
85
85
  this.task.logger.error(`electron@${this.version} 下载失败`, error);
86
+ this.task.logger.info("electron download fail");
86
87
  throw error;
87
88
  }
88
89
  }
@@ -126,10 +127,11 @@ const launchElectronApp = async (task, playwright, electronPath)=>{
126
127
  ],
127
128
  cwd: cachePath
128
129
  });
129
- logger.info(`electron 启动成功:${electronPath} ${mainPath}`);
130
+ logger.info("electron launch success");
130
131
  return electronApp;
131
132
  } catch (error) {
132
133
  logger.error("electron 启动失败:", error);
134
+ logger.info("electron launch fail");
133
135
  throw error;
134
136
  }
135
137
  };
@@ -151,14 +153,27 @@ class SentryInstance {
151
153
  updateUser(user) {
152
154
  this.user = user;
153
155
  }
154
- captureException(error) {
156
+ setScope(callback, extras) {
155
157
  (0, __WEBPACK_EXTERNAL_MODULE__sentry_node_4658624b__.withScope)((scope)=>{
156
- var _this_sentry;
158
+ scope.setTransactionName("rpa");
157
159
  if (this.coreVersion) scope.setTag("coreVersion", this.coreVersion);
158
160
  if (this.user) scope.setUser(this.user);
159
- null === (_this_sentry = this.sentry) || void 0 === _this_sentry || _this_sentry.captureException(error);
161
+ if (extras) scope.setExtras(extras);
162
+ callback(scope);
160
163
  });
161
164
  }
165
+ captureException(error, extras) {
166
+ this.setScope(()=>{
167
+ var _this_sentry;
168
+ return null === (_this_sentry = this.sentry) || void 0 === _this_sentry ? void 0 : _this_sentry.captureException(error);
169
+ }, extras);
170
+ }
171
+ captureMessage(message, level, extras) {
172
+ this.setScope(()=>{
173
+ var _this_sentry;
174
+ return null === (_this_sentry = this.sentry) || void 0 === _this_sentry ? void 0 : _this_sentry.captureMessage(message, level);
175
+ }, extras);
176
+ }
162
177
  constructor(taskParams){
163
178
  sentry_define_property(this, "sentry", void 0);
164
179
  sentry_define_property(this, "coreVersion", void 0);
@@ -167,6 +182,7 @@ class SentryInstance {
167
182
  this.sentry = (0, __WEBPACK_EXTERNAL_MODULE__sentry_node_4658624b__.initWithoutDefaultIntegrations)({
168
183
  dsn: DEFAULT_SENTRY_DSN,
169
184
  environment: taskParams.enverionment || "development",
185
+ tracesSampleRate: 1.0,
170
186
  initialScope: {
171
187
  user: taskParams.user,
172
188
  tags: {
@@ -187,18 +203,21 @@ function logger_define_property(obj, key, value) {
187
203
  return obj;
188
204
  }
189
205
  class Logger extends SentryInstance {
190
- debug(...msg) {
191
- __WEBPACK_EXTERNAL_MODULE_loglevel__["default"].debug(...msg);
206
+ debug(msg, extras) {
207
+ __WEBPACK_EXTERNAL_MODULE_loglevel__["default"].debug(msg);
208
+ this.captureMessage(msg, "debug", extras);
192
209
  }
193
- info(...msg) {
194
- __WEBPACK_EXTERNAL_MODULE_loglevel__["default"].info(...msg);
210
+ info(msg, extras) {
211
+ __WEBPACK_EXTERNAL_MODULE_loglevel__["default"].info(msg);
212
+ this.captureMessage(msg, "info", extras);
195
213
  }
196
- warn(...msg) {
197
- __WEBPACK_EXTERNAL_MODULE_loglevel__["default"].warn(...msg);
214
+ warn(msg, extras) {
215
+ __WEBPACK_EXTERNAL_MODULE_loglevel__["default"].warn(msg);
216
+ this.captureMessage(msg, "warning", extras);
198
217
  }
199
218
  error(prefix, error) {
200
219
  if (error instanceof Error) error.message = `${prefix}: ${error.message}`;
201
- else if (error && 'object' == typeof error) {
220
+ else if (error && "object" == typeof error) {
202
221
  const errorStr = JSON.stringify(error, null, 2);
203
222
  error = new Error(`${prefix}: ${errorStr}`);
204
223
  } else error = new Error(`${prefix}: ${error}`);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@iflyrpa/playwright",
3
3
  "type": "module",
4
- "version": "1.2.24",
4
+ "version": "1.2.26",
5
5
  "exports": {
6
6
  ".": {
7
7
  "types": "./dist/index.d.ts",
@@ -24,11 +24,11 @@
24
24
  },
25
25
  "dependencies": {
26
26
  "@electron/get": "^2.0.0",
27
- "@sentry/node": "^9.2.0",
27
+ "@sentry/node": "^9.11.0",
28
28
  "extract-zip": "^2.0.1",
29
29
  "loglevel": "^1.9.2",
30
30
  "@iflyrpa/pacote": "1.0.0",
31
- "@iflyrpa/actions": "1.1.28",
31
+ "@iflyrpa/actions": "1.1.30",
32
32
  "@iflyrpa/share": "0.0.6"
33
33
  },
34
34
  "scripts": {