@iflyrpa/playwright 1.2.50 → 1.2.51-beta.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.
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.49"
47
+ i8: "1.2.50"
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);
@@ -200,11 +200,29 @@ class SentryInstance {
200
200
  updateArticleId(articleId) {
201
201
  this.articleId = articleId;
202
202
  }
203
+ updateSaveType(saveType) {
204
+ this.saveType = saveType;
205
+ }
206
+ updateGBInitStatus(status) {
207
+ this.GBInitStatus = status;
208
+ }
209
+ updateBetaFlag(status) {
210
+ this.isBetaUser = status;
211
+ }
212
+ updateTimeConsuming(Record) {
213
+ this.TimeConsuming = Record;
214
+ }
203
215
  setScope(callback, extras) {
204
216
  (0, node_namespaceObject.withScope)((scope)=>{
205
217
  scope.setTransactionName("rpa");
206
218
  if (this.coreVersion) scope.setTag("coreVersion", this.coreVersion);
207
219
  if (this.articleId) scope.setTag("articleId", this.articleId);
220
+ if (this.saveType) scope.setTag("saveType", this.saveType);
221
+ if (void 0 !== this.GBInitStatus) {
222
+ scope.setTag("GBInitStatus", this.GBInitStatus);
223
+ scope.setTag("isBetaUser", this.isBetaUser);
224
+ }
225
+ if (this.TimeConsuming) scope.setTags(this.TimeConsuming);
208
226
  if (this.user) scope.setUser(this.user);
209
227
  if (extras) scope.setExtras(extras);
210
228
  callback(scope);
@@ -227,10 +245,14 @@ class SentryInstance {
227
245
  sentry_define_property(this, "coreVersion", void 0);
228
246
  sentry_define_property(this, "user", void 0);
229
247
  sentry_define_property(this, "articleId", void 0);
248
+ sentry_define_property(this, "saveType", void 0);
249
+ sentry_define_property(this, "GBInitStatus", void 0);
250
+ sentry_define_property(this, "isBetaUser", void 0);
251
+ sentry_define_property(this, "TimeConsuming", void 0);
230
252
  this.user = taskParams.user;
231
253
  this.sentry = (0, node_namespaceObject.initWithoutDefaultIntegrations)({
232
254
  dsn: DEFAULT_SENTRY_DSN,
233
- environment: taskParams.enverionment || "development",
255
+ environment: taskParams.environment || "development",
234
256
  tracesSampleRate: 1.0,
235
257
  initialScope: {
236
258
  user: taskParams.user,
@@ -356,6 +378,61 @@ class PackageManager {
356
378
  this.task = task;
357
379
  }
358
380
  }
381
+ const growthbook_namespaceObject = require("@growthbook/growthbook");
382
+ const external_cross_fetch_namespaceObject = require("cross-fetch");
383
+ var external_cross_fetch_default = /*#__PURE__*/ __webpack_require__.n(external_cross_fetch_namespaceObject);
384
+ function growthBook_define_property(obj, key, value) {
385
+ if (key in obj) Object.defineProperty(obj, key, {
386
+ value: value,
387
+ enumerable: true,
388
+ configurable: true,
389
+ writable: true
390
+ });
391
+ else obj[key] = value;
392
+ return obj;
393
+ }
394
+ const DEFAULT_GROWTHBOOK_DSN = "http://172.31.101.75:3100";
395
+ const ClientKey = {
396
+ Development: "sdk-6RuE0HPuWbj7QE5B",
397
+ Production: "sdk-UN3TtuusVhIOBHh"
398
+ };
399
+ class GrowthBookInstance {
400
+ async init() {
401
+ return this.growthBook.init({
402
+ timeout: 1000
403
+ });
404
+ }
405
+ async updateAttributes(attrs) {
406
+ const current = this.growthBook.getAttributes();
407
+ await this.growthBook.setAttributes({
408
+ ...current,
409
+ ...attrs
410
+ });
411
+ }
412
+ getAttributes() {
413
+ return this.growthBook.getAttributes();
414
+ }
415
+ isFeatureOn(flagKey) {
416
+ return this.growthBook.isOn(flagKey);
417
+ }
418
+ constructor(taskParams){
419
+ var _taskParams_user;
420
+ growthBook_define_property(this, "growthBook", void 0);
421
+ const clientKey = taskParams.debug ? ClientKey.Development : ClientKey.Production;
422
+ (0, growthbook_namespaceObject.setPolyfills)({
423
+ fetch: external_cross_fetch_default()
424
+ });
425
+ this.growthBook = new growthbook_namespaceObject.GrowthBook({
426
+ debug: taskParams.debug || false,
427
+ disableCache: true,
428
+ apiHost: DEFAULT_GROWTHBOOK_DSN,
429
+ clientKey,
430
+ attributes: {
431
+ id: (null === (_taskParams_user = taskParams.user) || void 0 === _taskParams_user ? void 0 : _taskParams_user.id) || ""
432
+ }
433
+ });
434
+ }
435
+ }
359
436
  function task_define_property(obj, key, value) {
360
437
  if (key in obj) Object.defineProperty(obj, key, {
361
438
  value: value,
@@ -441,15 +518,34 @@ class Task {
441
518
  setArticleId(articleId) {
442
519
  this.logger.updateArticleId(articleId);
443
520
  }
521
+ setSaveType(saveType) {
522
+ this.logger.updateSaveType(saveType);
523
+ }
524
+ setBetaType(status) {
525
+ this.logger.updateBetaFlag(status);
526
+ }
527
+ setTimeConsuming(Record) {
528
+ this.logger.updateTimeConsuming(Record);
529
+ }
530
+ isFeatOn(key) {
531
+ return this.growthBook.isFeatureOn(key);
532
+ }
533
+ async initializeGrowthBook() {
534
+ return this.growthBook.init();
535
+ }
444
536
  constructor(taskParam){
445
537
  task_define_property(this, "logger", void 0);
446
538
  task_define_property(this, "cachePath", void 0);
447
539
  task_define_property(this, "debug", void 0);
448
540
  task_define_property(this, "packagesDir", void 0);
449
541
  task_define_property(this, "packageManager", void 0);
542
+ task_define_property(this, "_timerRecord", {});
450
543
  task_define_property(this, "playwrightPackage", void 0);
451
544
  task_define_property(this, "electronPackage", void 0);
452
545
  task_define_property(this, "_electronApp", null);
546
+ task_define_property(this, "growthBook", void 0);
547
+ task_define_property(this, "_growthbookInitPromise", void 0);
548
+ task_define_property(this, "isInitializedGB", false);
453
549
  task_define_property(this, "isClosed", false);
454
550
  this.cachePath = taskParam.cachePath;
455
551
  this.packagesDir = external_node_path_default().join(taskParam.cachePath, "packages");
@@ -458,6 +554,21 @@ class Task {
458
554
  this.packageManager = new PackageManager(this);
459
555
  this.playwrightPackage = this.installPlaywright();
460
556
  this.electronPackage = this.installElectron();
557
+ this.growthBook = new GrowthBookInstance(taskParam);
558
+ this._growthbookInitPromise = this.initializeGrowthBook().then((res)=>{
559
+ if (res && !res.success) throw new Error(res.source);
560
+ this.logger.updateGBInitStatus(this.isInitializedGB = true);
561
+ this.logger.updateBetaFlag(this.growthBook.isFeatureOn(actions_namespaceObject.BetaFlag));
562
+ this.logger.info("GrowthBook 初始化成功");
563
+ this.debug && console.log("GrowthBook 初始化成功", res);
564
+ }).catch((error)=>{
565
+ this.logger.updateGBInitStatus(this.isInitializedGB = false);
566
+ this.logger.updateBetaFlag(this.growthBook.isFeatureOn(actions_namespaceObject.BetaFlag));
567
+ this.logger.warn("GrowthBook 初始化失败", {
568
+ details: error.message
569
+ });
570
+ this.debug && console.log("GrowthBook 初始化失败", error.message);
571
+ });
461
572
  }
462
573
  }
463
574
  function src_define_property(obj, key, value) {
package/dist/index.d.ts CHANGED
@@ -43,10 +43,18 @@ declare class SentryInstance {
43
43
  private coreVersion?;
44
44
  private user?;
45
45
  private articleId?;
46
+ private saveType?;
47
+ private GBInitStatus?;
48
+ private isBetaUser?;
49
+ private TimeConsuming?;
46
50
  constructor(taskParams: TaskParams);
47
51
  updateCoreVersion(version: string): void;
48
52
  updateUser(user: User): void;
49
53
  updateArticleId(articleId?: string): void;
54
+ updateSaveType(saveType?: string): void;
55
+ updateGBInitStatus(status: boolean): void;
56
+ updateBetaFlag(status: boolean): void;
57
+ updateTimeConsuming(Record: TimeConsuming): void;
50
58
  private setScope;
51
59
  captureException(error: unknown, extras?: Record<string, unknown>): void;
52
60
  captureMessage(message: string, level?: SeverityLevel, extras?: Record<string, unknown>): void;
@@ -58,9 +66,13 @@ declare class Task implements AutomateTask {
58
66
  debug: boolean;
59
67
  packagesDir: string;
60
68
  packageManager: PackageManager;
69
+ _timerRecord: Record<string, any>;
61
70
  private playwrightPackage;
62
71
  private electronPackage;
63
72
  private _electronApp;
73
+ private growthBook;
74
+ _growthbookInitPromise: Promise<void>;
75
+ isInitializedGB: boolean;
64
76
  /**
65
77
  * 应用是否已关闭
66
78
  */
@@ -99,6 +111,11 @@ declare class Task implements AutomateTask {
99
111
  protected setActionVersion(version: string): void;
100
112
  setUser(user: User): void;
101
113
  setArticleId(articleId: string): void;
114
+ setSaveType(saveType: string): void;
115
+ setBetaType(status: boolean): void;
116
+ setTimeConsuming(Record: Record<string, any>): void;
117
+ isFeatOn(key: string): boolean;
118
+ private initializeGrowthBook;
102
119
  }
103
120
 
104
121
  declare interface TaskParams {
@@ -106,9 +123,11 @@ declare interface TaskParams {
106
123
  cachePath: string;
107
124
  forceUpdate?: boolean;
108
125
  user?: User;
109
- enverionment?: string;
126
+ environment?: string;
110
127
  }
111
128
 
129
+ declare type TimeConsuming = Record<string, any>;
130
+
112
131
  export declare const version: string;
113
132
 
114
133
  export { }
package/dist/index.js CHANGED
@@ -9,8 +9,10 @@ import * as __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__ from "@iflyrpa/s
9
9
  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
+ import * as __WEBPACK_EXTERNAL_MODULE__growthbook_growthbook_9088614c__ from "@growthbook/growthbook";
13
+ import * as __WEBPACK_EXTERNAL_MODULE_cross_fetch_b7c6e9bd__ from "cross-fetch";
12
14
  var package_namespaceObject = {
13
- i8: "1.2.49"
15
+ i8: "1.2.50"
14
16
  };
15
17
  function _define_property(obj, key, value) {
16
18
  if (key in obj) Object.defineProperty(obj, key, {
@@ -151,11 +153,29 @@ class SentryInstance {
151
153
  updateArticleId(articleId) {
152
154
  this.articleId = articleId;
153
155
  }
156
+ updateSaveType(saveType) {
157
+ this.saveType = saveType;
158
+ }
159
+ updateGBInitStatus(status) {
160
+ this.GBInitStatus = status;
161
+ }
162
+ updateBetaFlag(status) {
163
+ this.isBetaUser = status;
164
+ }
165
+ updateTimeConsuming(Record) {
166
+ this.TimeConsuming = Record;
167
+ }
154
168
  setScope(callback, extras) {
155
169
  (0, __WEBPACK_EXTERNAL_MODULE__sentry_node_4658624b__.withScope)((scope)=>{
156
170
  scope.setTransactionName("rpa");
157
171
  if (this.coreVersion) scope.setTag("coreVersion", this.coreVersion);
158
172
  if (this.articleId) scope.setTag("articleId", this.articleId);
173
+ if (this.saveType) scope.setTag("saveType", this.saveType);
174
+ if (void 0 !== this.GBInitStatus) {
175
+ scope.setTag("GBInitStatus", this.GBInitStatus);
176
+ scope.setTag("isBetaUser", this.isBetaUser);
177
+ }
178
+ if (this.TimeConsuming) scope.setTags(this.TimeConsuming);
159
179
  if (this.user) scope.setUser(this.user);
160
180
  if (extras) scope.setExtras(extras);
161
181
  callback(scope);
@@ -178,10 +198,14 @@ class SentryInstance {
178
198
  sentry_define_property(this, "coreVersion", void 0);
179
199
  sentry_define_property(this, "user", void 0);
180
200
  sentry_define_property(this, "articleId", void 0);
201
+ sentry_define_property(this, "saveType", void 0);
202
+ sentry_define_property(this, "GBInitStatus", void 0);
203
+ sentry_define_property(this, "isBetaUser", void 0);
204
+ sentry_define_property(this, "TimeConsuming", void 0);
181
205
  this.user = taskParams.user;
182
206
  this.sentry = (0, __WEBPACK_EXTERNAL_MODULE__sentry_node_4658624b__.initWithoutDefaultIntegrations)({
183
207
  dsn: DEFAULT_SENTRY_DSN,
184
- environment: taskParams.enverionment || "development",
208
+ environment: taskParams.environment || "development",
185
209
  tracesSampleRate: 1.0,
186
210
  initialScope: {
187
211
  user: taskParams.user,
@@ -305,6 +329,58 @@ class PackageManager {
305
329
  this.task = task;
306
330
  }
307
331
  }
332
+ function growthBook_define_property(obj, key, value) {
333
+ if (key in obj) Object.defineProperty(obj, key, {
334
+ value: value,
335
+ enumerable: true,
336
+ configurable: true,
337
+ writable: true
338
+ });
339
+ else obj[key] = value;
340
+ return obj;
341
+ }
342
+ const DEFAULT_GROWTHBOOK_DSN = "http://172.31.101.75:3100";
343
+ const ClientKey = {
344
+ Development: "sdk-6RuE0HPuWbj7QE5B",
345
+ Production: "sdk-UN3TtuusVhIOBHh"
346
+ };
347
+ class GrowthBookInstance {
348
+ async init() {
349
+ return this.growthBook.init({
350
+ timeout: 1000
351
+ });
352
+ }
353
+ async updateAttributes(attrs) {
354
+ const current = this.growthBook.getAttributes();
355
+ await this.growthBook.setAttributes({
356
+ ...current,
357
+ ...attrs
358
+ });
359
+ }
360
+ getAttributes() {
361
+ return this.growthBook.getAttributes();
362
+ }
363
+ isFeatureOn(flagKey) {
364
+ return this.growthBook.isOn(flagKey);
365
+ }
366
+ constructor(taskParams){
367
+ var _taskParams_user;
368
+ growthBook_define_property(this, "growthBook", void 0);
369
+ const clientKey = taskParams.debug ? ClientKey.Development : ClientKey.Production;
370
+ (0, __WEBPACK_EXTERNAL_MODULE__growthbook_growthbook_9088614c__.setPolyfills)({
371
+ fetch: __WEBPACK_EXTERNAL_MODULE_cross_fetch_b7c6e9bd__["default"]
372
+ });
373
+ this.growthBook = new __WEBPACK_EXTERNAL_MODULE__growthbook_growthbook_9088614c__.GrowthBook({
374
+ debug: taskParams.debug || false,
375
+ disableCache: true,
376
+ apiHost: DEFAULT_GROWTHBOOK_DSN,
377
+ clientKey,
378
+ attributes: {
379
+ id: (null === (_taskParams_user = taskParams.user) || void 0 === _taskParams_user ? void 0 : _taskParams_user.id) || ""
380
+ }
381
+ });
382
+ }
383
+ }
308
384
  function task_define_property(obj, key, value) {
309
385
  if (key in obj) Object.defineProperty(obj, key, {
310
386
  value: value,
@@ -390,15 +466,34 @@ class Task {
390
466
  setArticleId(articleId) {
391
467
  this.logger.updateArticleId(articleId);
392
468
  }
469
+ setSaveType(saveType) {
470
+ this.logger.updateSaveType(saveType);
471
+ }
472
+ setBetaType(status) {
473
+ this.logger.updateBetaFlag(status);
474
+ }
475
+ setTimeConsuming(Record) {
476
+ this.logger.updateTimeConsuming(Record);
477
+ }
478
+ isFeatOn(key) {
479
+ return this.growthBook.isFeatureOn(key);
480
+ }
481
+ async initializeGrowthBook() {
482
+ return this.growthBook.init();
483
+ }
393
484
  constructor(taskParam){
394
485
  task_define_property(this, "logger", void 0);
395
486
  task_define_property(this, "cachePath", void 0);
396
487
  task_define_property(this, "debug", void 0);
397
488
  task_define_property(this, "packagesDir", void 0);
398
489
  task_define_property(this, "packageManager", void 0);
490
+ task_define_property(this, "_timerRecord", {});
399
491
  task_define_property(this, "playwrightPackage", void 0);
400
492
  task_define_property(this, "electronPackage", void 0);
401
493
  task_define_property(this, "_electronApp", null);
494
+ task_define_property(this, "growthBook", void 0);
495
+ task_define_property(this, "_growthbookInitPromise", void 0);
496
+ task_define_property(this, "isInitializedGB", false);
402
497
  task_define_property(this, "isClosed", false);
403
498
  this.cachePath = taskParam.cachePath;
404
499
  this.packagesDir = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(taskParam.cachePath, "packages");
@@ -407,6 +502,21 @@ class Task {
407
502
  this.packageManager = new PackageManager(this);
408
503
  this.playwrightPackage = this.installPlaywright();
409
504
  this.electronPackage = this.installElectron();
505
+ this.growthBook = new GrowthBookInstance(taskParam);
506
+ this._growthbookInitPromise = this.initializeGrowthBook().then((res)=>{
507
+ if (res && !res.success) throw new Error(res.source);
508
+ this.logger.updateGBInitStatus(this.isInitializedGB = true);
509
+ this.logger.updateBetaFlag(this.growthBook.isFeatureOn(__WEBPACK_EXTERNAL_MODULE__iflyrpa_actions_bd801d6f__.BetaFlag));
510
+ this.logger.info("GrowthBook 初始化成功");
511
+ this.debug && console.log("GrowthBook 初始化成功", res);
512
+ }).catch((error)=>{
513
+ this.logger.updateGBInitStatus(this.isInitializedGB = false);
514
+ this.logger.updateBetaFlag(this.growthBook.isFeatureOn(__WEBPACK_EXTERNAL_MODULE__iflyrpa_actions_bd801d6f__.BetaFlag));
515
+ this.logger.warn("GrowthBook 初始化失败", {
516
+ details: error.message
517
+ });
518
+ this.debug && console.log("GrowthBook 初始化失败", error.message);
519
+ });
410
520
  }
411
521
  }
412
522
  function src_define_property(obj, key, value) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@iflyrpa/playwright",
3
3
  "type": "module",
4
- "version": "1.2.50",
4
+ "version": "1.2.51-beta.0",
5
5
  "exports": {
6
6
  ".": {
7
7
  "types": "./dist/index.d.ts",
@@ -24,12 +24,14 @@
24
24
  },
25
25
  "dependencies": {
26
26
  "@electron/get": "^2.0.0",
27
+ "@growthbook/growthbook": "^1.5.1",
27
28
  "@sentry/node": "^9.11.0",
29
+ "cross-fetch": "^4.1.0",
28
30
  "extract-zip": "^2.0.1",
29
31
  "loglevel": "^1.9.2",
32
+ "@iflyrpa/actions": "1.2.18-beta.0",
30
33
  "@iflyrpa/pacote": "1.0.0",
31
- "@iflyrpa/actions": "1.2.17",
32
- "@iflyrpa/share": "0.0.10"
34
+ "@iflyrpa/share": "0.0.11-beta.0"
33
35
  },
34
36
  "scripts": {
35
37
  "build": "rslib build",