@powerlines/engine 0.44.7 → 0.44.9

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
@@ -283,9 +283,22 @@ var Worker = class {
283
283
  this.#worker = new jest_worker.Worker(workerPath, {
284
284
  maxRetries: 0,
285
285
  numWorkers: (0, node_os.cpus)().length ?? 3,
286
+ computeWorkerKey: (method, ...args) => {
287
+ let executionParams = { method };
288
+ if (args.length > 0 && (0, _stryke_type_checks_is_set_object.isSetObject)(args[0])) {
289
+ const arg = args[0];
290
+ if ((0, _stryke_type_checks_is_set_object.isSetObject)(arg.options)) executionParams = {
291
+ method,
292
+ executionIndex: arg.options.executionIndex ?? 0,
293
+ name: arg.options.name
294
+ };
295
+ }
296
+ return JSON.stringify(executionParams);
297
+ },
286
298
  ...rest,
287
299
  forkOptions: {
288
300
  ...rest.forkOptions,
301
+ silent: true,
289
302
  execArgv: [...execArgv, ...rest.forkOptions?.execArgv ?? []],
290
303
  env: workerEnv
291
304
  }
@@ -435,7 +448,7 @@ var PowerlinesEngine = class PowerlinesEngine {
435
448
  */
436
449
  async types(inlineConfig = { command: "types" }) {
437
450
  const timer = this.context.timer("Types");
438
- this.context.info(" 🏗️ Generating typescript declarations for the Powerlines project");
451
+ this.context.info("🏗️ Generating typescript declarations for the Powerlines project");
439
452
  this.context.debug(" Aggregating configuration options for the Powerlines project");
440
453
  inlineConfig.command ??= "types";
441
454
  await Promise.all(this.#context.executions.map(async (execution) => this.#worker.types({
@@ -455,7 +468,7 @@ var PowerlinesEngine = class PowerlinesEngine {
455
468
  */
456
469
  async prepare(inlineConfig = { command: "prepare" }) {
457
470
  const timer = this.context.timer("Prepare");
458
- this.context.info(" 🏗️ Preparing the Powerlines project");
471
+ this.context.info("🏗️ Preparing the Powerlines project");
459
472
  this.context.debug("Aggregating configuration options for the Powerlines project");
460
473
  inlineConfig.command ??= "prepare";
461
474
  await Promise.all(this.#context.executions.map(async (execution) => this.#worker.prepare({
@@ -476,7 +489,7 @@ var PowerlinesEngine = class PowerlinesEngine {
476
489
  */
477
490
  async new(inlineConfig) {
478
491
  const timer = this.context.timer("New");
479
- this.context.info(" 🆕 Creating a new Powerlines project");
492
+ this.context.info("🆕 Creating a new Powerlines project");
480
493
  inlineConfig.command ??= "new";
481
494
  await Promise.all(this.#context.executions.map(async (execution) => this.#worker.new({
482
495
  options: execution.options,
@@ -496,7 +509,7 @@ var PowerlinesEngine = class PowerlinesEngine {
496
509
  */
497
510
  async clean(inlineConfig = { command: "clean" }) {
498
511
  const timer = this.context.timer("Clean");
499
- this.context.info(" 🧹 Cleaning the previous Powerlines artifacts");
512
+ this.context.info("🧹 Cleaning the previous Powerlines artifacts");
500
513
  inlineConfig.command ??= "clean";
501
514
  await Promise.all(this.#context.executions.map(async (execution) => this.#worker.clean({
502
515
  options: execution.options,
@@ -513,7 +526,7 @@ var PowerlinesEngine = class PowerlinesEngine {
513
526
  */
514
527
  async lint(inlineConfig = { command: "lint" }) {
515
528
  const timer = this.context.timer("Lint");
516
- this.context.info(" 📝 Linting the Powerlines project");
529
+ this.context.info("📝 Linting the Powerlines project");
517
530
  inlineConfig.command ??= "lint";
518
531
  await Promise.all(this.#context.executions.map(async (execution) => this.#worker.lint({
519
532
  options: execution.options,
@@ -533,7 +546,7 @@ var PowerlinesEngine = class PowerlinesEngine {
533
546
  */
534
547
  async test(inlineConfig = { command: "test" }) {
535
548
  const timer = this.context.timer("Test");
536
- this.context.info(" 🧪 Running tests for the Powerlines project");
549
+ this.context.info("🧪 Running tests for the Powerlines project");
537
550
  inlineConfig.command ??= "test";
538
551
  await Promise.all(this.#context.executions.map(async (execution) => this.#worker.test({
539
552
  options: execution.options,
@@ -553,7 +566,7 @@ var PowerlinesEngine = class PowerlinesEngine {
553
566
  */
554
567
  async build(inlineConfig = { command: "build" }) {
555
568
  const timer = this.context.timer("Build");
556
- this.context.info(" 📦 Building the Powerlines project");
569
+ this.context.info("📦 Building the Powerlines project");
557
570
  await Promise.all(this.#context.executions.map(async (execution) => this.#worker.build({
558
571
  options: execution.options,
559
572
  config: inlineConfig
@@ -569,7 +582,7 @@ var PowerlinesEngine = class PowerlinesEngine {
569
582
  */
570
583
  async docs(inlineConfig = { command: "docs" }) {
571
584
  const timer = this.context.timer("Docs");
572
- this.context.info(" 📓 Generating documentation for the Powerlines project");
585
+ this.context.info("📓 Generating documentation for the Powerlines project");
573
586
  inlineConfig.command ??= "docs";
574
587
  await Promise.all(this.#context.executions.map(async (execution) => this.#worker.docs({
575
588
  options: execution.options,
@@ -588,7 +601,7 @@ var PowerlinesEngine = class PowerlinesEngine {
588
601
  */
589
602
  async deploy(inlineConfig = { command: "deploy" }) {
590
603
  const timer = this.context.timer("Deploy");
591
- this.context.info(" 🚀 Deploying the Powerlines project");
604
+ this.context.info("🚀 Deploying the Powerlines project");
592
605
  inlineConfig.command ??= "deploy";
593
606
  await Promise.all(this.#context.executions.map(async (execution) => this.#worker.deploy({
594
607
  options: execution.options,
@@ -607,7 +620,7 @@ var PowerlinesEngine = class PowerlinesEngine {
607
620
  */
608
621
  async finalize() {
609
622
  const timer = this.context.timer("Finalization");
610
- this.context.info(" 🏁 Powerlines finalization processes started");
623
+ this.context.info("🏁 Powerlines finalization processes started");
611
624
  this.#worker.close();
612
625
  this.context.debug("✔ Powerlines finalization completed successfully");
613
626
  timer();
@@ -618,9 +631,15 @@ var PowerlinesEngine = class PowerlinesEngine {
618
631
  async [Symbol.asyncDispose]() {
619
632
  return this.finalize();
620
633
  }
634
+ /**
635
+ * Handle incoming IPC messages from the worker processes, routing them to the appropriate handlers based on the message type.
636
+ *
637
+ * @param message - The IPC message received from a worker process
638
+ */
621
639
  async handleIpcMessage(message) {
622
640
  switch (message.type) {
623
- case "write-log":
641
+ case "write-log": {
642
+ const payload = parseWriteLogMessagePayload(message.payload);
624
643
  this.context.logger.debug({
625
644
  meta: {
626
645
  category: "ipc",
@@ -628,14 +647,17 @@ var PowerlinesEngine = class PowerlinesEngine {
628
647
  executionIndex: message.executionIndex,
629
648
  environment: message.environment
630
649
  },
631
- message: "Received a \"write-log\" IPC message from worker"
650
+ message: `Received a "write-log" IPC message from worker:
651
+ Type: ${payload.meta.type}
652
+ Message: ${(0, _stryke_convert_to_array.toArray)(payload.message).filter(Boolean).join("\n")}`
632
653
  });
633
654
  await this.handleWriteLog({
634
655
  ...message,
635
656
  type: "write-log",
636
- payload: parseWriteLogMessagePayload(message.payload)
657
+ payload
637
658
  });
638
659
  break;
660
+ }
639
661
  case "update-command":
640
662
  this.context.logger.debug({
641
663
  meta: {
@@ -644,7 +666,7 @@ var PowerlinesEngine = class PowerlinesEngine {
644
666
  executionIndex: message.executionIndex,
645
667
  environment: message.environment
646
668
  },
647
- message: "Received an \"update-command\" IPC message from worker"
669
+ message: `Received an "update-command" IPC message from worker: \n${JSON.stringify(message, null, 2)}`
648
670
  });
649
671
  await this.handleUpdateCommand({
650
672
  ...message,
@@ -660,7 +682,7 @@ var PowerlinesEngine = class PowerlinesEngine {
660
682
  executionIndex: message.executionIndex,
661
683
  environment: message.environment
662
684
  },
663
- message: "Received an \"update-hook\" IPC message from worker"
685
+ message: `Received an "update-hook" IPC message from worker: \n${JSON.stringify(message, null, 2)}`
664
686
  });
665
687
  await this.handleUpdateHook({
666
688
  ...message,
@@ -676,7 +698,7 @@ var PowerlinesEngine = class PowerlinesEngine {
676
698
  executionIndex: message.executionIndex,
677
699
  environment: message.environment
678
700
  },
679
- message: "Received an \"update-plugin\" IPC message from worker"
701
+ message: `Received an "update-plugin" IPC message from worker: \n${JSON.stringify(message, null, 2)}`
680
702
  });
681
703
  await this.handleUpdatePlugin({
682
704
  ...message,
@@ -704,7 +726,8 @@ var PowerlinesEngine = class PowerlinesEngine {
704
726
  environment: message.environment,
705
727
  plugin: payload.meta.plugin,
706
728
  source: payload.meta.source,
707
- timestamp: message.timestamp
729
+ timestamp: message.timestamp,
730
+ $$ipc: true
708
731
  }
709
732
  });
710
733
  }
package/dist/index.d.cts CHANGED
@@ -123,6 +123,11 @@ declare class PowerlinesEngine implements Engine, AsyncDisposable {
123
123
  * Asynchronous disposal method for the Powerlines Engine, which will call the finalize method to perform any necessary cleanup when the engine is disposed of.
124
124
  */
125
125
  [Symbol.asyncDispose](): Promise<void>;
126
+ /**
127
+ * Handle incoming IPC messages from the worker processes, routing them to the appropriate handlers based on the message type.
128
+ *
129
+ * @param message - The IPC message received from a worker process
130
+ */
126
131
  private handleIpcMessage;
127
132
  private handleWriteLog;
128
133
  private handleUpdatePlugin;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;AA+DA;;;;;;cAAa,gBAAA,YAA4B,MAAA,EAAQ,eAAA;EAAA;EAmEtC;;;;;;EAAA,OAlDW,WAAA,CAClB,OAAA,EAAS,aAAA,GACR,OAAA,CAAQ,gBAAA;EA0FY;;;EAAA,IAjEZ,OAAA,CAAA,GAAW,aAAA;EAkEJ;;;;;EAAA,UAzDT,WAAA,CAAa,OAAA,EAAS,aAAA;EA2Db;;;;;;;;EA/CL,KAAA,CACX,YAAA,GAAc,WAAA,CACZ,IAAA,CAAK,iBAAA,8BAIN,OAAA;EA4Ce;;;;;;;;EATL,OAAA,CACX,YAAA,GACI,WAAA,CAAY,IAAA,CAAK,mBAAA,8BACjB,WAAA,CAAY,IAAA,CAAK,iBAAA,8BACjB,WAAA,CAAY,IAAA,CAAK,eAAA,8BACjB,WAAA,CAAY,IAAA,CAAK,iBAAA,8BACjB,WAAA,CAAY,IAAA,CAAK,iBAAA,8BACjB,WAAA,CAAY,IAAA,CAAK,gBAAA,8BACjB,WAAA,CAAY,IAAA,CAAK,gBAAA,8BACjB,WAAA,CAAY,IAAA,CAAK,kBAAA,8BAEpB,OAAA;EA8DoB;;;;;;;;;EA9BV,GAAA,CAAI,YAAA,EAAc,WAAA,CAAY,eAAA,eAA2B,OAAA;EA8DnE;;;;;;;;;EAnCU,KAAA,CACX,YAAA,GACI,WAAA,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EAAA,QAsBA,kBAAA;EAAA,QAEA,gBAAA;EAAA,QAEA,mBAAA;AAAA"}
package/dist/index.d.mts CHANGED
@@ -123,6 +123,11 @@ declare class PowerlinesEngine implements Engine, AsyncDisposable {
123
123
  * Asynchronous disposal method for the Powerlines Engine, which will call the finalize method to perform any necessary cleanup when the engine is disposed of.
124
124
  */
125
125
  [Symbol.asyncDispose](): Promise<void>;
126
+ /**
127
+ * Handle incoming IPC messages from the worker processes, routing them to the appropriate handlers based on the message type.
128
+ *
129
+ * @param message - The IPC message received from a worker process
130
+ */
126
131
  private handleIpcMessage;
127
132
  private handleWriteLog;
128
133
  private handleUpdatePlugin;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;AA+DA;;;;;;cAAa,gBAAA,YAA4B,MAAA,EAAQ,eAAA;EAAA;EAmEtC;;;;;;EAAA,OAlDW,WAAA,CAClB,OAAA,EAAS,aAAA,GACR,OAAA,CAAQ,gBAAA;EA0FY;;;EAAA,IAjEZ,OAAA,CAAA,GAAW,aAAA;EAkEJ;;;;;EAAA,UAzDT,WAAA,CAAa,OAAA,EAAS,aAAA;EA2Db;;;;;;;;EA/CL,KAAA,CACX,YAAA,GAAc,WAAA,CACZ,IAAA,CAAK,iBAAA,8BAIN,OAAA;EA4Ce;;;;;;;;EATL,OAAA,CACX,YAAA,GACI,WAAA,CAAY,IAAA,CAAK,mBAAA,8BACjB,WAAA,CAAY,IAAA,CAAK,iBAAA,8BACjB,WAAA,CAAY,IAAA,CAAK,eAAA,8BACjB,WAAA,CAAY,IAAA,CAAK,iBAAA,8BACjB,WAAA,CAAY,IAAA,CAAK,iBAAA,8BACjB,WAAA,CAAY,IAAA,CAAK,gBAAA,8BACjB,WAAA,CAAY,IAAA,CAAK,gBAAA,8BACjB,WAAA,CAAY,IAAA,CAAK,kBAAA,8BAEpB,OAAA;EA8DoB;;;;;;;;;EA9BV,GAAA,CAAI,YAAA,EAAc,WAAA,C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AAO,YAAA,KAAa,OAAA;EA/QhB;;;;;EAAA,QAwRJ,gBAAA;EAAA,QAuGA,cAAA;EAAA,QAsBA,kBAAA;EAAA,QAEA,gBAAA;EAAA,QAEA,mBAAA;AAAA"}
package/dist/index.mjs CHANGED
@@ -281,9 +281,22 @@ var Worker$1 = class {
281
281
  this.#worker = new Worker(workerPath, {
282
282
  maxRetries: 0,
283
283
  numWorkers: cpus().length ?? 3,
284
+ computeWorkerKey: (method, ...args) => {
285
+ let executionParams = { method };
286
+ if (args.length > 0 && isSetObject(args[0])) {
287
+ const arg = args[0];
288
+ if (isSetObject(arg.options)) executionParams = {
289
+ method,
290
+ executionIndex: arg.options.executionIndex ?? 0,
291
+ name: arg.options.name
292
+ };
293
+ }
294
+ return JSON.stringify(executionParams);
295
+ },
284
296
  ...rest,
285
297
  forkOptions: {
286
298
  ...rest.forkOptions,
299
+ silent: true,
287
300
  execArgv: [...execArgv, ...rest.forkOptions?.execArgv ?? []],
288
301
  env: workerEnv
289
302
  }
@@ -433,7 +446,7 @@ var PowerlinesEngine = class PowerlinesEngine {
433
446
  */
434
447
  async types(inlineConfig = { command: "types" }) {
435
448
  const timer = this.context.timer("Types");
436
- this.context.info(" 🏗️ Generating typescript declarations for the Powerlines project");
449
+ this.context.info("🏗️ Generating typescript declarations for the Powerlines project");
437
450
  this.context.debug(" Aggregating configuration options for the Powerlines project");
438
451
  inlineConfig.command ??= "types";
439
452
  await Promise.all(this.#context.executions.map(async (execution) => this.#worker.types({
@@ -453,7 +466,7 @@ var PowerlinesEngine = class PowerlinesEngine {
453
466
  */
454
467
  async prepare(inlineConfig = { command: "prepare" }) {
455
468
  const timer = this.context.timer("Prepare");
456
- this.context.info(" 🏗️ Preparing the Powerlines project");
469
+ this.context.info("🏗️ Preparing the Powerlines project");
457
470
  this.context.debug("Aggregating configuration options for the Powerlines project");
458
471
  inlineConfig.command ??= "prepare";
459
472
  await Promise.all(this.#context.executions.map(async (execution) => this.#worker.prepare({
@@ -474,7 +487,7 @@ var PowerlinesEngine = class PowerlinesEngine {
474
487
  */
475
488
  async new(inlineConfig) {
476
489
  const timer = this.context.timer("New");
477
- this.context.info(" 🆕 Creating a new Powerlines project");
490
+ this.context.info("🆕 Creating a new Powerlines project");
478
491
  inlineConfig.command ??= "new";
479
492
  await Promise.all(this.#context.executions.map(async (execution) => this.#worker.new({
480
493
  options: execution.options,
@@ -494,7 +507,7 @@ var PowerlinesEngine = class PowerlinesEngine {
494
507
  */
495
508
  async clean(inlineConfig = { command: "clean" }) {
496
509
  const timer = this.context.timer("Clean");
497
- this.context.info(" 🧹 Cleaning the previous Powerlines artifacts");
510
+ this.context.info("🧹 Cleaning the previous Powerlines artifacts");
498
511
  inlineConfig.command ??= "clean";
499
512
  await Promise.all(this.#context.executions.map(async (execution) => this.#worker.clean({
500
513
  options: execution.options,
@@ -511,7 +524,7 @@ var PowerlinesEngine = class PowerlinesEngine {
511
524
  */
512
525
  async lint(inlineConfig = { command: "lint" }) {
513
526
  const timer = this.context.timer("Lint");
514
- this.context.info(" 📝 Linting the Powerlines project");
527
+ this.context.info("📝 Linting the Powerlines project");
515
528
  inlineConfig.command ??= "lint";
516
529
  await Promise.all(this.#context.executions.map(async (execution) => this.#worker.lint({
517
530
  options: execution.options,
@@ -531,7 +544,7 @@ var PowerlinesEngine = class PowerlinesEngine {
531
544
  */
532
545
  async test(inlineConfig = { command: "test" }) {
533
546
  const timer = this.context.timer("Test");
534
- this.context.info(" 🧪 Running tests for the Powerlines project");
547
+ this.context.info("🧪 Running tests for the Powerlines project");
535
548
  inlineConfig.command ??= "test";
536
549
  await Promise.all(this.#context.executions.map(async (execution) => this.#worker.test({
537
550
  options: execution.options,
@@ -551,7 +564,7 @@ var PowerlinesEngine = class PowerlinesEngine {
551
564
  */
552
565
  async build(inlineConfig = { command: "build" }) {
553
566
  const timer = this.context.timer("Build");
554
- this.context.info(" 📦 Building the Powerlines project");
567
+ this.context.info("📦 Building the Powerlines project");
555
568
  await Promise.all(this.#context.executions.map(async (execution) => this.#worker.build({
556
569
  options: execution.options,
557
570
  config: inlineConfig
@@ -567,7 +580,7 @@ var PowerlinesEngine = class PowerlinesEngine {
567
580
  */
568
581
  async docs(inlineConfig = { command: "docs" }) {
569
582
  const timer = this.context.timer("Docs");
570
- this.context.info(" 📓 Generating documentation for the Powerlines project");
583
+ this.context.info("📓 Generating documentation for the Powerlines project");
571
584
  inlineConfig.command ??= "docs";
572
585
  await Promise.all(this.#context.executions.map(async (execution) => this.#worker.docs({
573
586
  options: execution.options,
@@ -586,7 +599,7 @@ var PowerlinesEngine = class PowerlinesEngine {
586
599
  */
587
600
  async deploy(inlineConfig = { command: "deploy" }) {
588
601
  const timer = this.context.timer("Deploy");
589
- this.context.info(" 🚀 Deploying the Powerlines project");
602
+ this.context.info("🚀 Deploying the Powerlines project");
590
603
  inlineConfig.command ??= "deploy";
591
604
  await Promise.all(this.#context.executions.map(async (execution) => this.#worker.deploy({
592
605
  options: execution.options,
@@ -605,7 +618,7 @@ var PowerlinesEngine = class PowerlinesEngine {
605
618
  */
606
619
  async finalize() {
607
620
  const timer = this.context.timer("Finalization");
608
- this.context.info(" 🏁 Powerlines finalization processes started");
621
+ this.context.info("🏁 Powerlines finalization processes started");
609
622
  this.#worker.close();
610
623
  this.context.debug("✔ Powerlines finalization completed successfully");
611
624
  timer();
@@ -616,9 +629,15 @@ var PowerlinesEngine = class PowerlinesEngine {
616
629
  async [Symbol.asyncDispose]() {
617
630
  return this.finalize();
618
631
  }
632
+ /**
633
+ * Handle incoming IPC messages from the worker processes, routing them to the appropriate handlers based on the message type.
634
+ *
635
+ * @param message - The IPC message received from a worker process
636
+ */
619
637
  async handleIpcMessage(message) {
620
638
  switch (message.type) {
621
- case "write-log":
639
+ case "write-log": {
640
+ const payload = parseWriteLogMessagePayload(message.payload);
622
641
  this.context.logger.debug({
623
642
  meta: {
624
643
  category: "ipc",
@@ -626,14 +645,17 @@ var PowerlinesEngine = class PowerlinesEngine {
626
645
  executionIndex: message.executionIndex,
627
646
  environment: message.environment
628
647
  },
629
- message: "Received a \"write-log\" IPC message from worker"
648
+ message: `Received a "write-log" IPC message from worker:
649
+ Type: ${payload.meta.type}
650
+ Message: ${toArray(payload.message).filter(Boolean).join("\n")}`
630
651
  });
631
652
  await this.handleWriteLog({
632
653
  ...message,
633
654
  type: "write-log",
634
- payload: parseWriteLogMessagePayload(message.payload)
655
+ payload
635
656
  });
636
657
  break;
658
+ }
637
659
  case "update-command":
638
660
  this.context.logger.debug({
639
661
  meta: {
@@ -642,7 +664,7 @@ var PowerlinesEngine = class PowerlinesEngine {
642
664
  executionIndex: message.executionIndex,
643
665
  environment: message.environment
644
666
  },
645
- message: "Received an \"update-command\" IPC message from worker"
667
+ message: `Received an "update-command" IPC message from worker: \n${JSON.stringify(message, null, 2)}`
646
668
  });
647
669
  await this.handleUpdateCommand({
648
670
  ...message,
@@ -658,7 +680,7 @@ var PowerlinesEngine = class PowerlinesEngine {
658
680
  executionIndex: message.executionIndex,
659
681
  environment: message.environment
660
682
  },
661
- message: "Received an \"update-hook\" IPC message from worker"
683
+ message: `Received an "update-hook" IPC message from worker: \n${JSON.stringify(message, null, 2)}`
662
684
  });
663
685
  await this.handleUpdateHook({
664
686
  ...message,
@@ -674,7 +696,7 @@ var PowerlinesEngine = class PowerlinesEngine {
674
696
  executionIndex: message.executionIndex,
675
697
  environment: message.environment
676
698
  },
677
- message: "Received an \"update-plugin\" IPC message from worker"
699
+ message: `Received an "update-plugin" IPC message from worker: \n${JSON.stringify(message, null, 2)}`
678
700
  });
679
701
  await this.handleUpdatePlugin({
680
702
  ...message,
@@ -702,7 +724,8 @@ var PowerlinesEngine = class PowerlinesEngine {
702
724
  environment: message.environment,
703
725
  plugin: payload.meta.plugin,
704
726
  source: payload.meta.source,
705
- timestamp: message.timestamp
727
+ timestamp: message.timestamp,
728
+ $$ipc: true
706
729
  }
707
730
  });
708
731
  }