@metamask/snaps-controllers 12.1.0 → 12.3.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 (94) hide show
  1. package/CHANGELOG.md +27 -1
  2. package/dist/cronjob/CronjobController.cjs +13 -4
  3. package/dist/cronjob/CronjobController.cjs.map +1 -1
  4. package/dist/cronjob/CronjobController.d.cts.map +1 -1
  5. package/dist/cronjob/CronjobController.d.mts.map +1 -1
  6. package/dist/cronjob/CronjobController.mjs +15 -6
  7. package/dist/cronjob/CronjobController.mjs.map +1 -1
  8. package/dist/interface/SnapInterfaceController.cjs +15 -1
  9. package/dist/interface/SnapInterfaceController.cjs.map +1 -1
  10. package/dist/interface/SnapInterfaceController.d.cts +10 -2
  11. package/dist/interface/SnapInterfaceController.d.cts.map +1 -1
  12. package/dist/interface/SnapInterfaceController.d.mts +10 -2
  13. package/dist/interface/SnapInterfaceController.d.mts.map +1 -1
  14. package/dist/interface/SnapInterfaceController.mjs +17 -3
  15. package/dist/interface/SnapInterfaceController.mjs.map +1 -1
  16. package/dist/interface/utils.cjs +104 -4
  17. package/dist/interface/utils.cjs.map +1 -1
  18. package/dist/interface/utils.d.cts +71 -2
  19. package/dist/interface/utils.d.cts.map +1 -1
  20. package/dist/interface/utils.d.mts +71 -2
  21. package/dist/interface/utils.d.mts.map +1 -1
  22. package/dist/interface/utils.mjs +101 -5
  23. package/dist/interface/utils.mjs.map +1 -1
  24. package/dist/multichain/MultichainRouter.cjs +1 -0
  25. package/dist/multichain/MultichainRouter.cjs.map +1 -1
  26. package/dist/multichain/MultichainRouter.d.cts +1 -0
  27. package/dist/multichain/MultichainRouter.d.cts.map +1 -1
  28. package/dist/multichain/MultichainRouter.d.mts +1 -0
  29. package/dist/multichain/MultichainRouter.d.mts.map +1 -1
  30. package/dist/multichain/MultichainRouter.mjs +1 -0
  31. package/dist/multichain/MultichainRouter.mjs.map +1 -1
  32. package/dist/services/AbstractExecutionService.cjs +127 -202
  33. package/dist/services/AbstractExecutionService.cjs.map +1 -1
  34. package/dist/services/AbstractExecutionService.d.cts +8 -53
  35. package/dist/services/AbstractExecutionService.d.cts.map +1 -1
  36. package/dist/services/AbstractExecutionService.d.mts +8 -53
  37. package/dist/services/AbstractExecutionService.d.mts.map +1 -1
  38. package/dist/services/AbstractExecutionService.mjs +127 -202
  39. package/dist/services/AbstractExecutionService.mjs.map +1 -1
  40. package/dist/services/iframe/IframeExecutionService.cjs +2 -2
  41. package/dist/services/iframe/IframeExecutionService.cjs.map +1 -1
  42. package/dist/services/iframe/IframeExecutionService.d.cts +1 -1
  43. package/dist/services/iframe/IframeExecutionService.d.cts.map +1 -1
  44. package/dist/services/iframe/IframeExecutionService.d.mts +1 -1
  45. package/dist/services/iframe/IframeExecutionService.d.mts.map +1 -1
  46. package/dist/services/iframe/IframeExecutionService.mjs +2 -2
  47. package/dist/services/iframe/IframeExecutionService.mjs.map +1 -1
  48. package/dist/services/offscreen/OffscreenExecutionService.cjs +5 -5
  49. package/dist/services/offscreen/OffscreenExecutionService.cjs.map +1 -1
  50. package/dist/services/offscreen/OffscreenExecutionService.d.cts +4 -4
  51. package/dist/services/offscreen/OffscreenExecutionService.d.cts.map +1 -1
  52. package/dist/services/offscreen/OffscreenExecutionService.d.mts +4 -4
  53. package/dist/services/offscreen/OffscreenExecutionService.d.mts.map +1 -1
  54. package/dist/services/offscreen/OffscreenExecutionService.mjs +5 -5
  55. package/dist/services/offscreen/OffscreenExecutionService.mjs.map +1 -1
  56. package/dist/services/proxy/ProxyExecutionService.cjs +6 -6
  57. package/dist/services/proxy/ProxyExecutionService.cjs.map +1 -1
  58. package/dist/services/proxy/ProxyExecutionService.d.cts +4 -4
  59. package/dist/services/proxy/ProxyExecutionService.d.cts.map +1 -1
  60. package/dist/services/proxy/ProxyExecutionService.d.mts +4 -4
  61. package/dist/services/proxy/ProxyExecutionService.d.mts.map +1 -1
  62. package/dist/services/proxy/ProxyExecutionService.mjs +6 -6
  63. package/dist/services/proxy/ProxyExecutionService.mjs.map +1 -1
  64. package/dist/services/webview/WebViewExecutionService.cjs +6 -6
  65. package/dist/services/webview/WebViewExecutionService.cjs.map +1 -1
  66. package/dist/services/webview/WebViewExecutionService.d.cts +5 -5
  67. package/dist/services/webview/WebViewExecutionService.d.cts.map +1 -1
  68. package/dist/services/webview/WebViewExecutionService.d.mts +5 -5
  69. package/dist/services/webview/WebViewExecutionService.d.mts.map +1 -1
  70. package/dist/services/webview/WebViewExecutionService.mjs +6 -6
  71. package/dist/services/webview/WebViewExecutionService.mjs.map +1 -1
  72. package/dist/snaps/SnapController.cjs +60 -72
  73. package/dist/snaps/SnapController.cjs.map +1 -1
  74. package/dist/snaps/SnapController.d.cts +19 -10
  75. package/dist/snaps/SnapController.d.cts.map +1 -1
  76. package/dist/snaps/SnapController.d.mts +19 -10
  77. package/dist/snaps/SnapController.d.mts.map +1 -1
  78. package/dist/snaps/SnapController.mjs +61 -73
  79. package/dist/snaps/SnapController.mjs.map +1 -1
  80. package/dist/snaps/registry/json.cjs +4 -2
  81. package/dist/snaps/registry/json.cjs.map +1 -1
  82. package/dist/snaps/registry/json.d.cts.map +1 -1
  83. package/dist/snaps/registry/json.d.mts.map +1 -1
  84. package/dist/snaps/registry/json.mjs +4 -2
  85. package/dist/snaps/registry/json.mjs.map +1 -1
  86. package/package.json +4 -4
  87. package/dist/snaps/RequestQueue.cjs +0 -44
  88. package/dist/snaps/RequestQueue.cjs.map +0 -1
  89. package/dist/snaps/RequestQueue.d.cts +0 -25
  90. package/dist/snaps/RequestQueue.d.cts.map +0 -1
  91. package/dist/snaps/RequestQueue.d.mts +0 -25
  92. package/dist/snaps/RequestQueue.d.mts.map +0 -1
  93. package/dist/snaps/RequestQueue.mjs +0 -40
  94. package/dist/snaps/RequestQueue.mjs.map +0 -1
@@ -13,10 +13,10 @@ export class IframeExecutionService extends AbstractExecutionService {
13
13
  terminateJob(jobWrapper) {
14
14
  document.getElementById(jobWrapper.id)?.remove();
15
15
  }
16
- async initEnvStream(jobId) {
16
+ async initEnvStream(snapId) {
17
17
  const iframeWindow = await createWindow({
18
18
  uri: this.iframeUrl.toString(),
19
- id: jobId,
19
+ id: snapId,
20
20
  });
21
21
  const stream = new WindowPostMessageStream({
22
22
  name: 'parent',
@@ -1 +1 @@
1
- {"version":3,"file":"IframeExecutionService.mjs","sourceRoot":"","sources":["../../../src/services/iframe/IframeExecutionService.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,sCAAsC;AACxE,OAAO,EAAE,YAAY,EAAE,8BAA8B;AAMrD,OAAO,EAAE,wBAAwB,EAAE,wCAAoC;AAMvE,MAAM,OAAO,sBAAuB,SAAQ,wBAAgC;IAG1E,YAAY,EACV,SAAS,EACT,SAAS,EACT,iBAAiB,EACjB,GAAG,IAAI,EAC+B;QACtC,KAAK,CAAC;YACJ,GAAG,IAAI;YACP,SAAS;YACT,iBAAiB;SAClB,CAAC,CAAC;QACH,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7B,CAAC;IAES,YAAY,CAAC,UAAoC;QACzD,QAAQ,CAAC,cAAc,CAAC,UAAU,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC;IACnD,CAAC;IAES,KAAK,CAAC,aAAa,CAAC,KAAa;QAIzC,MAAM,YAAY,GAAG,MAAM,YAAY,CAAC;YACtC,GAAG,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE;YAC9B,EAAE,EAAE,KAAK;SACV,CAAC,CAAC;QAEH,MAAM,MAAM,GAAG,IAAI,uBAAuB,CAAC;YACzC,IAAI,EAAE,QAAQ;YACd,MAAM,EAAE,OAAO;YACf,YAAY,EAAE,YAAY;YAC1B,YAAY,EAAE,GAAG;SAClB,CAAC,CAAC;QAEH,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,CAAC;IAC1C,CAAC;CACF","sourcesContent":["import type { BasePostMessageStream } from '@metamask/post-message-stream';\nimport { WindowPostMessageStream } from '@metamask/post-message-stream';\nimport { createWindow } from '@metamask/snaps-utils';\n\nimport type {\n ExecutionServiceArgs,\n TerminateJobArgs,\n} from '../AbstractExecutionService';\nimport { AbstractExecutionService } from '../AbstractExecutionService';\n\ntype IframeExecutionEnvironmentServiceArgs = {\n iframeUrl: URL;\n} & ExecutionServiceArgs;\n\nexport class IframeExecutionService extends AbstractExecutionService<Window> {\n public iframeUrl: URL;\n\n constructor({\n iframeUrl,\n messenger,\n setupSnapProvider,\n ...args\n }: IframeExecutionEnvironmentServiceArgs) {\n super({\n ...args,\n messenger,\n setupSnapProvider,\n });\n this.iframeUrl = iframeUrl;\n }\n\n protected terminateJob(jobWrapper: TerminateJobArgs<Window>): void {\n document.getElementById(jobWrapper.id)?.remove();\n }\n\n protected async initEnvStream(jobId: string): Promise<{\n worker: Window;\n stream: BasePostMessageStream;\n }> {\n const iframeWindow = await createWindow({\n uri: this.iframeUrl.toString(),\n id: jobId,\n });\n\n const stream = new WindowPostMessageStream({\n name: 'parent',\n target: 'child',\n targetWindow: iframeWindow,\n targetOrigin: '*',\n });\n\n return { worker: iframeWindow, stream };\n }\n}\n"]}
1
+ {"version":3,"file":"IframeExecutionService.mjs","sourceRoot":"","sources":["../../../src/services/iframe/IframeExecutionService.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,sCAAsC;AACxE,OAAO,EAAE,YAAY,EAAE,8BAA8B;AAMrD,OAAO,EAAE,wBAAwB,EAAE,wCAAoC;AAMvE,MAAM,OAAO,sBAAuB,SAAQ,wBAAgC;IAG1E,YAAY,EACV,SAAS,EACT,SAAS,EACT,iBAAiB,EACjB,GAAG,IAAI,EAC+B;QACtC,KAAK,CAAC;YACJ,GAAG,IAAI;YACP,SAAS;YACT,iBAAiB;SAClB,CAAC,CAAC;QACH,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7B,CAAC;IAES,YAAY,CAAC,UAAoC;QACzD,QAAQ,CAAC,cAAc,CAAC,UAAU,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC;IACnD,CAAC;IAES,KAAK,CAAC,aAAa,CAAC,MAAc;QAI1C,MAAM,YAAY,GAAG,MAAM,YAAY,CAAC;YACtC,GAAG,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE;YAC9B,EAAE,EAAE,MAAM;SACX,CAAC,CAAC;QAEH,MAAM,MAAM,GAAG,IAAI,uBAAuB,CAAC;YACzC,IAAI,EAAE,QAAQ;YACd,MAAM,EAAE,OAAO;YACf,YAAY,EAAE,YAAY;YAC1B,YAAY,EAAE,GAAG;SAClB,CAAC,CAAC;QAEH,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,CAAC;IAC1C,CAAC;CACF","sourcesContent":["import type { BasePostMessageStream } from '@metamask/post-message-stream';\nimport { WindowPostMessageStream } from '@metamask/post-message-stream';\nimport { createWindow } from '@metamask/snaps-utils';\n\nimport type {\n ExecutionServiceArgs,\n TerminateJobArgs,\n} from '../AbstractExecutionService';\nimport { AbstractExecutionService } from '../AbstractExecutionService';\n\ntype IframeExecutionEnvironmentServiceArgs = {\n iframeUrl: URL;\n} & ExecutionServiceArgs;\n\nexport class IframeExecutionService extends AbstractExecutionService<Window> {\n public iframeUrl: URL;\n\n constructor({\n iframeUrl,\n messenger,\n setupSnapProvider,\n ...args\n }: IframeExecutionEnvironmentServiceArgs) {\n super({\n ...args,\n messenger,\n setupSnapProvider,\n });\n this.iframeUrl = iframeUrl;\n }\n\n protected terminateJob(jobWrapper: TerminateJobArgs<Window>): void {\n document.getElementById(jobWrapper.id)?.remove();\n }\n\n protected async initEnvStream(snapId: string): Promise<{\n worker: Window;\n stream: BasePostMessageStream;\n }> {\n const iframeWindow = await createWindow({\n uri: this.iframeUrl.toString(),\n id: snapId,\n });\n\n const stream = new WindowPostMessageStream({\n name: 'parent',\n target: 'child',\n targetWindow: iframeWindow,\n targetOrigin: '*',\n });\n\n return { worker: iframeWindow, stream };\n }\n}\n"]}
@@ -41,15 +41,15 @@ class OffscreenExecutionService extends ProxyExecutionService_1.ProxyExecutionSe
41
41
  __classPrivateFieldSet(this, _OffscreenExecutionService_offscreenPromise, offscreenPromise, "f");
42
42
  }
43
43
  /**
44
- * Create a new stream for the given job ID. This will wait for the offscreen
44
+ * Create a new stream for the given Snap ID. This will wait for the offscreen
45
45
  * environment to be ready before creating the stream.
46
46
  *
47
- * @param jobId - The job ID to create a stream for.
48
- * @returns The stream for the given job ID.
47
+ * @param snapId - The Snap ID to create a stream for.
48
+ * @returns The stream for the given Snap ID.
49
49
  */
50
- async initEnvStream(jobId) {
50
+ async initEnvStream(snapId) {
51
51
  await __classPrivateFieldGet(this, _OffscreenExecutionService_offscreenPromise, "f");
52
- return await super.initEnvStream(jobId);
52
+ return await super.initEnvStream(snapId);
53
53
  }
54
54
  }
55
55
  exports.OffscreenExecutionService = OffscreenExecutionService;
@@ -1 +1 @@
1
- {"version":3,"file":"OffscreenExecutionService.cjs","sourceRoot":"","sources":["../../../src/services/offscreen/OffscreenExecutionService.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,uEAAgF;AAGhF,8EAAuE;AAMvE,MAAa,yBAA0B,SAAQ,6CAAqB;IAGlE;;;;;;;;;;OAUG;IACH,YAAY,EACV,SAAS,EACT,iBAAiB,EACjB,gBAAgB,EAChB,GAAG,IAAI,EACkC;QACzC,KAAK,CAAC;YACJ,GAAG,IAAI;YACP,SAAS;YACT,iBAAiB;YACjB,MAAM,EAAE,IAAI,qDAA+B,CAAC;gBAC1C,IAAI,EAAE,QAAQ;gBACd,MAAM,EAAE,OAAO;aAChB,CAAC;SACH,CAAC,CAAC;QA3BI,8DAAoC;QA6B3C,uBAAA,IAAI,+CAAqB,gBAAgB,MAAA,CAAC;IAC5C,CAAC;IAED;;;;;;OAMG;IACO,KAAK,CAAC,aAAa,CAAC,KAAa;QACzC,MAAM,uBAAA,IAAI,mDAAkB,CAAC;QAE7B,OAAO,MAAM,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IAC1C,CAAC;CACF;AA7CD,8DA6CC","sourcesContent":["import { BrowserRuntimePostMessageStream } from '@metamask/post-message-stream';\n\nimport type { ExecutionServiceArgs } from '../AbstractExecutionService';\nimport { ProxyExecutionService } from '../proxy/ProxyExecutionService';\n\ntype OffscreenExecutionEnvironmentServiceArgs = {\n offscreenPromise: Promise<unknown>;\n} & ExecutionServiceArgs;\n\nexport class OffscreenExecutionService extends ProxyExecutionService {\n readonly #offscreenPromise: Promise<unknown>;\n\n /**\n * Create a new offscreen execution service.\n *\n * @param args - The constructor arguments.\n * @param args.messenger - The messenger to use for communication with the\n * `SnapController`.\n * @param args.setupSnapProvider - The function to use to set up the snap\n * provider.\n * @param args.offscreenPromise - A promise that resolves when the offscreen\n * environment is ready.\n */\n constructor({\n messenger,\n setupSnapProvider,\n offscreenPromise,\n ...args\n }: OffscreenExecutionEnvironmentServiceArgs) {\n super({\n ...args,\n messenger,\n setupSnapProvider,\n stream: new BrowserRuntimePostMessageStream({\n name: 'parent',\n target: 'child',\n }),\n });\n\n this.#offscreenPromise = offscreenPromise;\n }\n\n /**\n * Create a new stream for the given job ID. This will wait for the offscreen\n * environment to be ready before creating the stream.\n *\n * @param jobId - The job ID to create a stream for.\n * @returns The stream for the given job ID.\n */\n protected async initEnvStream(jobId: string) {\n await this.#offscreenPromise;\n\n return await super.initEnvStream(jobId);\n }\n}\n"]}
1
+ {"version":3,"file":"OffscreenExecutionService.cjs","sourceRoot":"","sources":["../../../src/services/offscreen/OffscreenExecutionService.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,uEAAgF;AAGhF,8EAAuE;AAMvE,MAAa,yBAA0B,SAAQ,6CAAqB;IAGlE;;;;;;;;;;OAUG;IACH,YAAY,EACV,SAAS,EACT,iBAAiB,EACjB,gBAAgB,EAChB,GAAG,IAAI,EACkC;QACzC,KAAK,CAAC;YACJ,GAAG,IAAI;YACP,SAAS;YACT,iBAAiB;YACjB,MAAM,EAAE,IAAI,qDAA+B,CAAC;gBAC1C,IAAI,EAAE,QAAQ;gBACd,MAAM,EAAE,OAAO;aAChB,CAAC;SACH,CAAC,CAAC;QA3BI,8DAAoC;QA6B3C,uBAAA,IAAI,+CAAqB,gBAAgB,MAAA,CAAC;IAC5C,CAAC;IAED;;;;;;OAMG;IACO,KAAK,CAAC,aAAa,CAAC,MAAc;QAC1C,MAAM,uBAAA,IAAI,mDAAkB,CAAC;QAE7B,OAAO,MAAM,KAAK,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;IAC3C,CAAC;CACF;AA7CD,8DA6CC","sourcesContent":["import { BrowserRuntimePostMessageStream } from '@metamask/post-message-stream';\n\nimport type { ExecutionServiceArgs } from '../AbstractExecutionService';\nimport { ProxyExecutionService } from '../proxy/ProxyExecutionService';\n\ntype OffscreenExecutionEnvironmentServiceArgs = {\n offscreenPromise: Promise<unknown>;\n} & ExecutionServiceArgs;\n\nexport class OffscreenExecutionService extends ProxyExecutionService {\n readonly #offscreenPromise: Promise<unknown>;\n\n /**\n * Create a new offscreen execution service.\n *\n * @param args - The constructor arguments.\n * @param args.messenger - The messenger to use for communication with the\n * `SnapController`.\n * @param args.setupSnapProvider - The function to use to set up the snap\n * provider.\n * @param args.offscreenPromise - A promise that resolves when the offscreen\n * environment is ready.\n */\n constructor({\n messenger,\n setupSnapProvider,\n offscreenPromise,\n ...args\n }: OffscreenExecutionEnvironmentServiceArgs) {\n super({\n ...args,\n messenger,\n setupSnapProvider,\n stream: new BrowserRuntimePostMessageStream({\n name: 'parent',\n target: 'child',\n }),\n });\n\n this.#offscreenPromise = offscreenPromise;\n }\n\n /**\n * Create a new stream for the given Snap ID. This will wait for the offscreen\n * environment to be ready before creating the stream.\n *\n * @param snapId - The Snap ID to create a stream for.\n * @returns The stream for the given Snap ID.\n */\n protected async initEnvStream(snapId: string) {\n await this.#offscreenPromise;\n\n return await super.initEnvStream(snapId);\n }\n}\n"]}
@@ -18,13 +18,13 @@ export declare class OffscreenExecutionService extends ProxyExecutionService {
18
18
  */
19
19
  constructor({ messenger, setupSnapProvider, offscreenPromise, ...args }: OffscreenExecutionEnvironmentServiceArgs);
20
20
  /**
21
- * Create a new stream for the given job ID. This will wait for the offscreen
21
+ * Create a new stream for the given Snap ID. This will wait for the offscreen
22
22
  * environment to be ready before creating the stream.
23
23
  *
24
- * @param jobId - The job ID to create a stream for.
25
- * @returns The stream for the given job ID.
24
+ * @param snapId - The Snap ID to create a stream for.
25
+ * @returns The stream for the given Snap ID.
26
26
  */
27
- protected initEnvStream(jobId: string): Promise<{
27
+ protected initEnvStream(snapId: string): Promise<{
28
28
  worker: string;
29
29
  stream: import("../index.cjs").ProxyPostMessageStream;
30
30
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"OffscreenExecutionService.d.cts","sourceRoot":"","sources":["../../../src/services/offscreen/OffscreenExecutionService.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,wCAAoC;AACxE,OAAO,EAAE,qBAAqB,EAAE,2CAAuC;AAEvE,KAAK,wCAAwC,GAAG;IAC9C,gBAAgB,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;CACpC,GAAG,oBAAoB,CAAC;AAEzB,qBAAa,yBAA0B,SAAQ,qBAAqB;;IAGlE;;;;;;;;;;OAUG;gBACS,EACV,SAAS,EACT,iBAAiB,EACjB,gBAAgB,EAChB,GAAG,IAAI,EACR,EAAE,wCAAwC;IAc3C;;;;;;OAMG;cACa,aAAa,CAAC,KAAK,EAAE,MAAM;;;;CAK5C"}
1
+ {"version":3,"file":"OffscreenExecutionService.d.cts","sourceRoot":"","sources":["../../../src/services/offscreen/OffscreenExecutionService.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,wCAAoC;AACxE,OAAO,EAAE,qBAAqB,EAAE,2CAAuC;AAEvE,KAAK,wCAAwC,GAAG;IAC9C,gBAAgB,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;CACpC,GAAG,oBAAoB,CAAC;AAEzB,qBAAa,yBAA0B,SAAQ,qBAAqB;;IAGlE;;;;;;;;;;OAUG;gBACS,EACV,SAAS,EACT,iBAAiB,EACjB,gBAAgB,EAChB,GAAG,IAAI,EACR,EAAE,wCAAwC;IAc3C;;;;;;OAMG;cACa,aAAa,CAAC,MAAM,EAAE,MAAM;;;;CAK7C"}
@@ -18,13 +18,13 @@ export declare class OffscreenExecutionService extends ProxyExecutionService {
18
18
  */
19
19
  constructor({ messenger, setupSnapProvider, offscreenPromise, ...args }: OffscreenExecutionEnvironmentServiceArgs);
20
20
  /**
21
- * Create a new stream for the given job ID. This will wait for the offscreen
21
+ * Create a new stream for the given Snap ID. This will wait for the offscreen
22
22
  * environment to be ready before creating the stream.
23
23
  *
24
- * @param jobId - The job ID to create a stream for.
25
- * @returns The stream for the given job ID.
24
+ * @param snapId - The Snap ID to create a stream for.
25
+ * @returns The stream for the given Snap ID.
26
26
  */
27
- protected initEnvStream(jobId: string): Promise<{
27
+ protected initEnvStream(snapId: string): Promise<{
28
28
  worker: string;
29
29
  stream: import("../index.mjs").ProxyPostMessageStream;
30
30
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"OffscreenExecutionService.d.mts","sourceRoot":"","sources":["../../../src/services/offscreen/OffscreenExecutionService.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,wCAAoC;AACxE,OAAO,EAAE,qBAAqB,EAAE,2CAAuC;AAEvE,KAAK,wCAAwC,GAAG;IAC9C,gBAAgB,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;CACpC,GAAG,oBAAoB,CAAC;AAEzB,qBAAa,yBAA0B,SAAQ,qBAAqB;;IAGlE;;;;;;;;;;OAUG;gBACS,EACV,SAAS,EACT,iBAAiB,EACjB,gBAAgB,EAChB,GAAG,IAAI,EACR,EAAE,wCAAwC;IAc3C;;;;;;OAMG;cACa,aAAa,CAAC,KAAK,EAAE,MAAM;;;;CAK5C"}
1
+ {"version":3,"file":"OffscreenExecutionService.d.mts","sourceRoot":"","sources":["../../../src/services/offscreen/OffscreenExecutionService.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,wCAAoC;AACxE,OAAO,EAAE,qBAAqB,EAAE,2CAAuC;AAEvE,KAAK,wCAAwC,GAAG;IAC9C,gBAAgB,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;CACpC,GAAG,oBAAoB,CAAC;AAEzB,qBAAa,yBAA0B,SAAQ,qBAAqB;;IAGlE;;;;;;;;;;OAUG;gBACS,EACV,SAAS,EACT,iBAAiB,EACjB,gBAAgB,EAChB,GAAG,IAAI,EACR,EAAE,wCAAwC;IAc3C;;;;;;OAMG;cACa,aAAa,CAAC,MAAM,EAAE,MAAM;;;;CAK7C"}
@@ -38,15 +38,15 @@ export class OffscreenExecutionService extends ProxyExecutionService {
38
38
  __classPrivateFieldSet(this, _OffscreenExecutionService_offscreenPromise, offscreenPromise, "f");
39
39
  }
40
40
  /**
41
- * Create a new stream for the given job ID. This will wait for the offscreen
41
+ * Create a new stream for the given Snap ID. This will wait for the offscreen
42
42
  * environment to be ready before creating the stream.
43
43
  *
44
- * @param jobId - The job ID to create a stream for.
45
- * @returns The stream for the given job ID.
44
+ * @param snapId - The Snap ID to create a stream for.
45
+ * @returns The stream for the given Snap ID.
46
46
  */
47
- async initEnvStream(jobId) {
47
+ async initEnvStream(snapId) {
48
48
  await __classPrivateFieldGet(this, _OffscreenExecutionService_offscreenPromise, "f");
49
- return await super.initEnvStream(jobId);
49
+ return await super.initEnvStream(snapId);
50
50
  }
51
51
  }
52
52
  _OffscreenExecutionService_offscreenPromise = new WeakMap();
@@ -1 +1 @@
1
- {"version":3,"file":"OffscreenExecutionService.mjs","sourceRoot":"","sources":["../../../src/services/offscreen/OffscreenExecutionService.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,+BAA+B,EAAE,sCAAsC;AAGhF,OAAO,EAAE,qBAAqB,EAAE,2CAAuC;AAMvE,MAAM,OAAO,yBAA0B,SAAQ,qBAAqB;IAGlE;;;;;;;;;;OAUG;IACH,YAAY,EACV,SAAS,EACT,iBAAiB,EACjB,gBAAgB,EAChB,GAAG,IAAI,EACkC;QACzC,KAAK,CAAC;YACJ,GAAG,IAAI;YACP,SAAS;YACT,iBAAiB;YACjB,MAAM,EAAE,IAAI,+BAA+B,CAAC;gBAC1C,IAAI,EAAE,QAAQ;gBACd,MAAM,EAAE,OAAO;aAChB,CAAC;SACH,CAAC,CAAC;QA3BI,8DAAoC;QA6B3C,uBAAA,IAAI,+CAAqB,gBAAgB,MAAA,CAAC;IAC5C,CAAC;IAED;;;;;;OAMG;IACO,KAAK,CAAC,aAAa,CAAC,KAAa;QACzC,MAAM,uBAAA,IAAI,mDAAkB,CAAC;QAE7B,OAAO,MAAM,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IAC1C,CAAC;CACF","sourcesContent":["import { BrowserRuntimePostMessageStream } from '@metamask/post-message-stream';\n\nimport type { ExecutionServiceArgs } from '../AbstractExecutionService';\nimport { ProxyExecutionService } from '../proxy/ProxyExecutionService';\n\ntype OffscreenExecutionEnvironmentServiceArgs = {\n offscreenPromise: Promise<unknown>;\n} & ExecutionServiceArgs;\n\nexport class OffscreenExecutionService extends ProxyExecutionService {\n readonly #offscreenPromise: Promise<unknown>;\n\n /**\n * Create a new offscreen execution service.\n *\n * @param args - The constructor arguments.\n * @param args.messenger - The messenger to use for communication with the\n * `SnapController`.\n * @param args.setupSnapProvider - The function to use to set up the snap\n * provider.\n * @param args.offscreenPromise - A promise that resolves when the offscreen\n * environment is ready.\n */\n constructor({\n messenger,\n setupSnapProvider,\n offscreenPromise,\n ...args\n }: OffscreenExecutionEnvironmentServiceArgs) {\n super({\n ...args,\n messenger,\n setupSnapProvider,\n stream: new BrowserRuntimePostMessageStream({\n name: 'parent',\n target: 'child',\n }),\n });\n\n this.#offscreenPromise = offscreenPromise;\n }\n\n /**\n * Create a new stream for the given job ID. This will wait for the offscreen\n * environment to be ready before creating the stream.\n *\n * @param jobId - The job ID to create a stream for.\n * @returns The stream for the given job ID.\n */\n protected async initEnvStream(jobId: string) {\n await this.#offscreenPromise;\n\n return await super.initEnvStream(jobId);\n }\n}\n"]}
1
+ {"version":3,"file":"OffscreenExecutionService.mjs","sourceRoot":"","sources":["../../../src/services/offscreen/OffscreenExecutionService.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,+BAA+B,EAAE,sCAAsC;AAGhF,OAAO,EAAE,qBAAqB,EAAE,2CAAuC;AAMvE,MAAM,OAAO,yBAA0B,SAAQ,qBAAqB;IAGlE;;;;;;;;;;OAUG;IACH,YAAY,EACV,SAAS,EACT,iBAAiB,EACjB,gBAAgB,EAChB,GAAG,IAAI,EACkC;QACzC,KAAK,CAAC;YACJ,GAAG,IAAI;YACP,SAAS;YACT,iBAAiB;YACjB,MAAM,EAAE,IAAI,+BAA+B,CAAC;gBAC1C,IAAI,EAAE,QAAQ;gBACd,MAAM,EAAE,OAAO;aAChB,CAAC;SACH,CAAC,CAAC;QA3BI,8DAAoC;QA6B3C,uBAAA,IAAI,+CAAqB,gBAAgB,MAAA,CAAC;IAC5C,CAAC;IAED;;;;;;OAMG;IACO,KAAK,CAAC,aAAa,CAAC,MAAc;QAC1C,MAAM,uBAAA,IAAI,mDAAkB,CAAC;QAE7B,OAAO,MAAM,KAAK,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;IAC3C,CAAC;CACF","sourcesContent":["import { BrowserRuntimePostMessageStream } from '@metamask/post-message-stream';\n\nimport type { ExecutionServiceArgs } from '../AbstractExecutionService';\nimport { ProxyExecutionService } from '../proxy/ProxyExecutionService';\n\ntype OffscreenExecutionEnvironmentServiceArgs = {\n offscreenPromise: Promise<unknown>;\n} & ExecutionServiceArgs;\n\nexport class OffscreenExecutionService extends ProxyExecutionService {\n readonly #offscreenPromise: Promise<unknown>;\n\n /**\n * Create a new offscreen execution service.\n *\n * @param args - The constructor arguments.\n * @param args.messenger - The messenger to use for communication with the\n * `SnapController`.\n * @param args.setupSnapProvider - The function to use to set up the snap\n * provider.\n * @param args.offscreenPromise - A promise that resolves when the offscreen\n * environment is ready.\n */\n constructor({\n messenger,\n setupSnapProvider,\n offscreenPromise,\n ...args\n }: OffscreenExecutionEnvironmentServiceArgs) {\n super({\n ...args,\n messenger,\n setupSnapProvider,\n stream: new BrowserRuntimePostMessageStream({\n name: 'parent',\n target: 'child',\n }),\n });\n\n this.#offscreenPromise = offscreenPromise;\n }\n\n /**\n * Create a new stream for the given Snap ID. This will wait for the offscreen\n * environment to be ready before creating the stream.\n *\n * @param snapId - The Snap ID to create a stream for.\n * @returns The stream for the given Snap ID.\n */\n protected async initEnvStream(snapId: string) {\n await this.#offscreenPromise;\n\n return await super.initEnvStream(snapId);\n }\n}\n"]}
@@ -59,16 +59,16 @@ class ProxyExecutionService extends AbstractExecutionService_1.AbstractExecution
59
59
  });
60
60
  }
61
61
  /**
62
- * Create a new stream for the specified job. This wraps the root stream
63
- * in a stream specific to the job.
62
+ * Create a new stream for the specified Snap. This wraps the root stream
63
+ * in a stream specific to the Snap.
64
64
  *
65
- * @param jobId - The job ID.
65
+ * @param snapId - The Snap ID.
66
66
  * @returns An object with the worker ID and stream.
67
67
  */
68
- async initEnvStream(jobId) {
68
+ async initEnvStream(snapId) {
69
69
  const stream = new ProxyPostMessageStream_1.ProxyPostMessageStream({
70
70
  stream: __classPrivateFieldGet(this, _ProxyExecutionService_stream, "f"),
71
- jobId,
71
+ jobId: snapId,
72
72
  });
73
73
  // Send a request and await any response before continuing
74
74
  // This simulates the behaviour of non-proxy environments by effectively awaiting
@@ -81,7 +81,7 @@ class ProxyExecutionService extends AbstractExecutionService_1.AbstractExecution
81
81
  data: { jsonrpc: '2.0', method: 'ping', id: (0, nanoid_1.nanoid)() },
82
82
  });
83
83
  });
84
- return { worker: jobId, stream };
84
+ return { worker: snapId, stream };
85
85
  }
86
86
  }
87
87
  exports.ProxyExecutionService = ProxyExecutionService;
@@ -1 +1 @@
1
- {"version":3,"file":"ProxyExecutionService.cjs","sourceRoot":"","sources":["../../../src/services/proxy/ProxyExecutionService.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,mCAAgC;AAMhC,8EAAuE;AACvE,0EAAmE;AAMnE,MAAa,qBAAsB,SAAQ,mDAAgC;IAGzE;;;;;;;;;;OAUG;IACH,YAAY,EACV,MAAM,EACN,SAAS,EACT,iBAAiB,EACjB,GAAG,IAAI,EAC8B;QACrC,KAAK,CAAC;YACJ,GAAG,IAAI;YACP,SAAS;YACT,iBAAiB;YACjB,OAAO,EAAE,KAAK;SACf,CAAC,CAAC;QAxBI,gDAA+B;QA0BtC,uBAAA,IAAI,iCAAW,MAAM,MAAA,CAAC;IACxB,CAAC;IAED;;;;OAIG;IACH,wEAAwE;IACxE,WAAW;IACX,kEAAkE;IACxD,KAAK,CAAC,YAAY,CAAC,GAA6B;QACxD,0EAA0E;QAC1E,8CAA8C;QAC9C,uBAAA,IAAI,qCAAQ,CAAC,KAAK,CAAC;YACjB,KAAK,EAAE,GAAG,CAAC,EAAE;YACb,IAAI,EAAE;gBACJ,OAAO,EAAE,KAAK;gBACd,MAAM,EAAE,cAAc;gBACtB,EAAE,EAAE,IAAA,eAAM,GAAE;aACb;SACF,CAAC,CAAC;IACL,CAAC;IAED;;;;;;OAMG;IACO,KAAK,CAAC,aAAa,CAAC,KAAa;QACzC,MAAM,MAAM,GAAG,IAAI,+CAAsB,CAAC;YACxC,MAAM,EAAE,uBAAA,IAAI,qCAAQ;YACpB,KAAK;SACN,CAAC,CAAC;QAEH,0DAA0D;QAC1D,iFAAiF;QACjF,2DAA2D;QAC3D,sFAAsF;QACtF,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YAC5B,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;YAC7B,MAAM,CAAC,KAAK,CAAC;gBACX,IAAI,EAAE,SAAS;gBACf,IAAI,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,IAAA,eAAM,GAAE,EAAE;aACvD,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;IACnC,CAAC;CACF;AA9ED,sDA8EC","sourcesContent":["import type { BasePostMessageStream } from '@metamask/post-message-stream';\nimport { nanoid } from 'nanoid';\n\nimport type {\n ExecutionServiceArgs,\n TerminateJobArgs,\n} from '../AbstractExecutionService';\nimport { AbstractExecutionService } from '../AbstractExecutionService';\nimport { ProxyPostMessageStream } from '../ProxyPostMessageStream';\n\ntype ProxyExecutionEnvironmentServiceArgs = {\n stream: BasePostMessageStream;\n} & ExecutionServiceArgs;\n\nexport class ProxyExecutionService extends AbstractExecutionService<string> {\n readonly #stream: BasePostMessageStream;\n\n /**\n * Create a new proxy execution service.\n *\n * @param args - The constructor arguments.\n * @param args.messenger - The messenger to use for communication with the\n * `SnapController`.\n * @param args.setupSnapProvider - The function to use to set up the snap\n * provider.\n * @param args.stream - The stream to use for communicating with the proxy\n * executor.\n */\n constructor({\n stream,\n messenger,\n setupSnapProvider,\n ...args\n }: ProxyExecutionEnvironmentServiceArgs) {\n super({\n ...args,\n messenger,\n setupSnapProvider,\n usePing: false,\n });\n\n this.#stream = stream;\n }\n\n /**\n * Send a termination command to the proxy stream.\n *\n * @param job - The job to terminate.\n */\n // TODO: Either fix this lint violation or explain why it's necessary to\n // ignore.\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n protected async terminateJob(job: TerminateJobArgs<string>) {\n // The `AbstractExecutionService` will have already closed the job stream,\n // so we write to the runtime stream directly.\n this.#stream.write({\n jobId: job.id,\n data: {\n jsonrpc: '2.0',\n method: 'terminateJob',\n id: nanoid(),\n },\n });\n }\n\n /**\n * Create a new stream for the specified job. This wraps the root stream\n * in a stream specific to the job.\n *\n * @param jobId - The job ID.\n * @returns An object with the worker ID and stream.\n */\n protected async initEnvStream(jobId: string) {\n const stream = new ProxyPostMessageStream({\n stream: this.#stream,\n jobId,\n });\n\n // Send a request and await any response before continuing\n // This simulates the behaviour of non-proxy environments by effectively awaiting\n // the load of the environment inside the proxy environment\n // This assumes the proxy environment is already loaded before this function is called\n await new Promise((resolve) => {\n stream.once('data', resolve);\n stream.write({\n name: 'command',\n data: { jsonrpc: '2.0', method: 'ping', id: nanoid() },\n });\n });\n\n return { worker: jobId, stream };\n }\n}\n"]}
1
+ {"version":3,"file":"ProxyExecutionService.cjs","sourceRoot":"","sources":["../../../src/services/proxy/ProxyExecutionService.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,mCAAgC;AAMhC,8EAAuE;AACvE,0EAAmE;AAMnE,MAAa,qBAAsB,SAAQ,mDAAgC;IAGzE;;;;;;;;;;OAUG;IACH,YAAY,EACV,MAAM,EACN,SAAS,EACT,iBAAiB,EACjB,GAAG,IAAI,EAC8B;QACrC,KAAK,CAAC;YACJ,GAAG,IAAI;YACP,SAAS;YACT,iBAAiB;YACjB,OAAO,EAAE,KAAK;SACf,CAAC,CAAC;QAxBI,gDAA+B;QA0BtC,uBAAA,IAAI,iCAAW,MAAM,MAAA,CAAC;IACxB,CAAC;IAED;;;;OAIG;IACH,wEAAwE;IACxE,WAAW;IACX,kEAAkE;IACxD,KAAK,CAAC,YAAY,CAAC,GAA6B;QACxD,0EAA0E;QAC1E,8CAA8C;QAC9C,uBAAA,IAAI,qCAAQ,CAAC,KAAK,CAAC;YACjB,KAAK,EAAE,GAAG,CAAC,EAAE;YACb,IAAI,EAAE;gBACJ,OAAO,EAAE,KAAK;gBACd,MAAM,EAAE,cAAc;gBACtB,EAAE,EAAE,IAAA,eAAM,GAAE;aACb;SACF,CAAC,CAAC;IACL,CAAC;IAED;;;;;;OAMG;IACO,KAAK,CAAC,aAAa,CAAC,MAAc;QAC1C,MAAM,MAAM,GAAG,IAAI,+CAAsB,CAAC;YACxC,MAAM,EAAE,uBAAA,IAAI,qCAAQ;YACpB,KAAK,EAAE,MAAM;SACd,CAAC,CAAC;QAEH,0DAA0D;QAC1D,iFAAiF;QACjF,2DAA2D;QAC3D,sFAAsF;QACtF,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YAC5B,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;YAC7B,MAAM,CAAC,KAAK,CAAC;gBACX,IAAI,EAAE,SAAS;gBACf,IAAI,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,IAAA,eAAM,GAAE,EAAE;aACvD,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;IACpC,CAAC;CACF;AA9ED,sDA8EC","sourcesContent":["import type { BasePostMessageStream } from '@metamask/post-message-stream';\nimport { nanoid } from 'nanoid';\n\nimport type {\n ExecutionServiceArgs,\n TerminateJobArgs,\n} from '../AbstractExecutionService';\nimport { AbstractExecutionService } from '../AbstractExecutionService';\nimport { ProxyPostMessageStream } from '../ProxyPostMessageStream';\n\ntype ProxyExecutionEnvironmentServiceArgs = {\n stream: BasePostMessageStream;\n} & ExecutionServiceArgs;\n\nexport class ProxyExecutionService extends AbstractExecutionService<string> {\n readonly #stream: BasePostMessageStream;\n\n /**\n * Create a new proxy execution service.\n *\n * @param args - The constructor arguments.\n * @param args.messenger - The messenger to use for communication with the\n * `SnapController`.\n * @param args.setupSnapProvider - The function to use to set up the snap\n * provider.\n * @param args.stream - The stream to use for communicating with the proxy\n * executor.\n */\n constructor({\n stream,\n messenger,\n setupSnapProvider,\n ...args\n }: ProxyExecutionEnvironmentServiceArgs) {\n super({\n ...args,\n messenger,\n setupSnapProvider,\n usePing: false,\n });\n\n this.#stream = stream;\n }\n\n /**\n * Send a termination command to the proxy stream.\n *\n * @param job - The job to terminate.\n */\n // TODO: Either fix this lint violation or explain why it's necessary to\n // ignore.\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n protected async terminateJob(job: TerminateJobArgs<string>) {\n // The `AbstractExecutionService` will have already closed the job stream,\n // so we write to the runtime stream directly.\n this.#stream.write({\n jobId: job.id,\n data: {\n jsonrpc: '2.0',\n method: 'terminateJob',\n id: nanoid(),\n },\n });\n }\n\n /**\n * Create a new stream for the specified Snap. This wraps the root stream\n * in a stream specific to the Snap.\n *\n * @param snapId - The Snap ID.\n * @returns An object with the worker ID and stream.\n */\n protected async initEnvStream(snapId: string) {\n const stream = new ProxyPostMessageStream({\n stream: this.#stream,\n jobId: snapId,\n });\n\n // Send a request and await any response before continuing\n // This simulates the behaviour of non-proxy environments by effectively awaiting\n // the load of the environment inside the proxy environment\n // This assumes the proxy environment is already loaded before this function is called\n await new Promise((resolve) => {\n stream.once('data', resolve);\n stream.write({\n name: 'command',\n data: { jsonrpc: '2.0', method: 'ping', id: nanoid() },\n });\n });\n\n return { worker: snapId, stream };\n }\n}\n"]}
@@ -26,13 +26,13 @@ export declare class ProxyExecutionService extends AbstractExecutionService<stri
26
26
  */
27
27
  protected terminateJob(job: TerminateJobArgs<string>): Promise<void>;
28
28
  /**
29
- * Create a new stream for the specified job. This wraps the root stream
30
- * in a stream specific to the job.
29
+ * Create a new stream for the specified Snap. This wraps the root stream
30
+ * in a stream specific to the Snap.
31
31
  *
32
- * @param jobId - The job ID.
32
+ * @param snapId - The Snap ID.
33
33
  * @returns An object with the worker ID and stream.
34
34
  */
35
- protected initEnvStream(jobId: string): Promise<{
35
+ protected initEnvStream(snapId: string): Promise<{
36
36
  worker: string;
37
37
  stream: ProxyPostMessageStream;
38
38
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"ProxyExecutionService.d.cts","sourceRoot":"","sources":["../../../src/services/proxy/ProxyExecutionService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,sCAAsC;AAG3E,OAAO,KAAK,EACV,oBAAoB,EACpB,gBAAgB,EACjB,wCAAoC;AACrC,OAAO,EAAE,wBAAwB,EAAE,wCAAoC;AACvE,OAAO,EAAE,sBAAsB,EAAE,sCAAkC;AAEnE,KAAK,oCAAoC,GAAG;IAC1C,MAAM,EAAE,qBAAqB,CAAC;CAC/B,GAAG,oBAAoB,CAAC;AAEzB,qBAAa,qBAAsB,SAAQ,wBAAwB,CAAC,MAAM,CAAC;;IAGzE;;;;;;;;;;OAUG;gBACS,EACV,MAAM,EACN,SAAS,EACT,iBAAiB,EACjB,GAAG,IAAI,EACR,EAAE,oCAAoC;IAWvC;;;;OAIG;cAIa,YAAY,CAAC,GAAG,EAAE,gBAAgB,CAAC,MAAM,CAAC;IAa1D;;;;;;OAMG;cACa,aAAa,CAAC,KAAK,EAAE,MAAM;;;;CAoB5C"}
1
+ {"version":3,"file":"ProxyExecutionService.d.cts","sourceRoot":"","sources":["../../../src/services/proxy/ProxyExecutionService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,sCAAsC;AAG3E,OAAO,KAAK,EACV,oBAAoB,EACpB,gBAAgB,EACjB,wCAAoC;AACrC,OAAO,EAAE,wBAAwB,EAAE,wCAAoC;AACvE,OAAO,EAAE,sBAAsB,EAAE,sCAAkC;AAEnE,KAAK,oCAAoC,GAAG;IAC1C,MAAM,EAAE,qBAAqB,CAAC;CAC/B,GAAG,oBAAoB,CAAC;AAEzB,qBAAa,qBAAsB,SAAQ,wBAAwB,CAAC,MAAM,CAAC;;IAGzE;;;;;;;;;;OAUG;gBACS,EACV,MAAM,EACN,SAAS,EACT,iBAAiB,EACjB,GAAG,IAAI,EACR,EAAE,oCAAoC;IAWvC;;;;OAIG;cAIa,YAAY,CAAC,GAAG,EAAE,gBAAgB,CAAC,MAAM,CAAC;IAa1D;;;;;;OAMG;cACa,aAAa,CAAC,MAAM,EAAE,MAAM;;;;CAoB7C"}
@@ -26,13 +26,13 @@ export declare class ProxyExecutionService extends AbstractExecutionService<stri
26
26
  */
27
27
  protected terminateJob(job: TerminateJobArgs<string>): Promise<void>;
28
28
  /**
29
- * Create a new stream for the specified job. This wraps the root stream
30
- * in a stream specific to the job.
29
+ * Create a new stream for the specified Snap. This wraps the root stream
30
+ * in a stream specific to the Snap.
31
31
  *
32
- * @param jobId - The job ID.
32
+ * @param snapId - The Snap ID.
33
33
  * @returns An object with the worker ID and stream.
34
34
  */
35
- protected initEnvStream(jobId: string): Promise<{
35
+ protected initEnvStream(snapId: string): Promise<{
36
36
  worker: string;
37
37
  stream: ProxyPostMessageStream;
38
38
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"ProxyExecutionService.d.mts","sourceRoot":"","sources":["../../../src/services/proxy/ProxyExecutionService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,sCAAsC;AAG3E,OAAO,KAAK,EACV,oBAAoB,EACpB,gBAAgB,EACjB,wCAAoC;AACrC,OAAO,EAAE,wBAAwB,EAAE,wCAAoC;AACvE,OAAO,EAAE,sBAAsB,EAAE,sCAAkC;AAEnE,KAAK,oCAAoC,GAAG;IAC1C,MAAM,EAAE,qBAAqB,CAAC;CAC/B,GAAG,oBAAoB,CAAC;AAEzB,qBAAa,qBAAsB,SAAQ,wBAAwB,CAAC,MAAM,CAAC;;IAGzE;;;;;;;;;;OAUG;gBACS,EACV,MAAM,EACN,SAAS,EACT,iBAAiB,EACjB,GAAG,IAAI,EACR,EAAE,oCAAoC;IAWvC;;;;OAIG;cAIa,YAAY,CAAC,GAAG,EAAE,gBAAgB,CAAC,MAAM,CAAC;IAa1D;;;;;;OAMG;cACa,aAAa,CAAC,KAAK,EAAE,MAAM;;;;CAoB5C"}
1
+ {"version":3,"file":"ProxyExecutionService.d.mts","sourceRoot":"","sources":["../../../src/services/proxy/ProxyExecutionService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,sCAAsC;AAG3E,OAAO,KAAK,EACV,oBAAoB,EACpB,gBAAgB,EACjB,wCAAoC;AACrC,OAAO,EAAE,wBAAwB,EAAE,wCAAoC;AACvE,OAAO,EAAE,sBAAsB,EAAE,sCAAkC;AAEnE,KAAK,oCAAoC,GAAG;IAC1C,MAAM,EAAE,qBAAqB,CAAC;CAC/B,GAAG,oBAAoB,CAAC;AAEzB,qBAAa,qBAAsB,SAAQ,wBAAwB,CAAC,MAAM,CAAC;;IAGzE;;;;;;;;;;OAUG;gBACS,EACV,MAAM,EACN,SAAS,EACT,iBAAiB,EACjB,GAAG,IAAI,EACR,EAAE,oCAAoC;IAWvC;;;;OAIG;cAIa,YAAY,CAAC,GAAG,EAAE,gBAAgB,CAAC,MAAM,CAAC;IAa1D;;;;;;OAMG;cACa,aAAa,CAAC,MAAM,EAAE,MAAM;;;;CAoB7C"}
@@ -56,16 +56,16 @@ export class ProxyExecutionService extends AbstractExecutionService {
56
56
  });
57
57
  }
58
58
  /**
59
- * Create a new stream for the specified job. This wraps the root stream
60
- * in a stream specific to the job.
59
+ * Create a new stream for the specified Snap. This wraps the root stream
60
+ * in a stream specific to the Snap.
61
61
  *
62
- * @param jobId - The job ID.
62
+ * @param snapId - The Snap ID.
63
63
  * @returns An object with the worker ID and stream.
64
64
  */
65
- async initEnvStream(jobId) {
65
+ async initEnvStream(snapId) {
66
66
  const stream = new ProxyPostMessageStream({
67
67
  stream: __classPrivateFieldGet(this, _ProxyExecutionService_stream, "f"),
68
- jobId,
68
+ jobId: snapId,
69
69
  });
70
70
  // Send a request and await any response before continuing
71
71
  // This simulates the behaviour of non-proxy environments by effectively awaiting
@@ -78,7 +78,7 @@ export class ProxyExecutionService extends AbstractExecutionService {
78
78
  data: { jsonrpc: '2.0', method: 'ping', id: nanoid() },
79
79
  });
80
80
  });
81
- return { worker: jobId, stream };
81
+ return { worker: snapId, stream };
82
82
  }
83
83
  }
84
84
  _ProxyExecutionService_stream = new WeakMap();
@@ -1 +1 @@
1
- {"version":3,"file":"ProxyExecutionService.mjs","sourceRoot":"","sources":["../../../src/services/proxy/ProxyExecutionService.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,OAAO,EAAE,MAAM,EAAE,eAAe;AAMhC,OAAO,EAAE,wBAAwB,EAAE,wCAAoC;AACvE,OAAO,EAAE,sBAAsB,EAAE,sCAAkC;AAMnE,MAAM,OAAO,qBAAsB,SAAQ,wBAAgC;IAGzE;;;;;;;;;;OAUG;IACH,YAAY,EACV,MAAM,EACN,SAAS,EACT,iBAAiB,EACjB,GAAG,IAAI,EAC8B;QACrC,KAAK,CAAC;YACJ,GAAG,IAAI;YACP,SAAS;YACT,iBAAiB;YACjB,OAAO,EAAE,KAAK;SACf,CAAC,CAAC;QAxBI,gDAA+B;QA0BtC,uBAAA,IAAI,iCAAW,MAAM,MAAA,CAAC;IACxB,CAAC;IAED;;;;OAIG;IACH,wEAAwE;IACxE,WAAW;IACX,kEAAkE;IACxD,KAAK,CAAC,YAAY,CAAC,GAA6B;QACxD,0EAA0E;QAC1E,8CAA8C;QAC9C,uBAAA,IAAI,qCAAQ,CAAC,KAAK,CAAC;YACjB,KAAK,EAAE,GAAG,CAAC,EAAE;YACb,IAAI,EAAE;gBACJ,OAAO,EAAE,KAAK;gBACd,MAAM,EAAE,cAAc;gBACtB,EAAE,EAAE,MAAM,EAAE;aACb;SACF,CAAC,CAAC;IACL,CAAC;IAED;;;;;;OAMG;IACO,KAAK,CAAC,aAAa,CAAC,KAAa;QACzC,MAAM,MAAM,GAAG,IAAI,sBAAsB,CAAC;YACxC,MAAM,EAAE,uBAAA,IAAI,qCAAQ;YACpB,KAAK;SACN,CAAC,CAAC;QAEH,0DAA0D;QAC1D,iFAAiF;QACjF,2DAA2D;QAC3D,sFAAsF;QACtF,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YAC5B,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;YAC7B,MAAM,CAAC,KAAK,CAAC;gBACX,IAAI,EAAE,SAAS;gBACf,IAAI,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE;aACvD,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;IACnC,CAAC;CACF","sourcesContent":["import type { BasePostMessageStream } from '@metamask/post-message-stream';\nimport { nanoid } from 'nanoid';\n\nimport type {\n ExecutionServiceArgs,\n TerminateJobArgs,\n} from '../AbstractExecutionService';\nimport { AbstractExecutionService } from '../AbstractExecutionService';\nimport { ProxyPostMessageStream } from '../ProxyPostMessageStream';\n\ntype ProxyExecutionEnvironmentServiceArgs = {\n stream: BasePostMessageStream;\n} & ExecutionServiceArgs;\n\nexport class ProxyExecutionService extends AbstractExecutionService<string> {\n readonly #stream: BasePostMessageStream;\n\n /**\n * Create a new proxy execution service.\n *\n * @param args - The constructor arguments.\n * @param args.messenger - The messenger to use for communication with the\n * `SnapController`.\n * @param args.setupSnapProvider - The function to use to set up the snap\n * provider.\n * @param args.stream - The stream to use for communicating with the proxy\n * executor.\n */\n constructor({\n stream,\n messenger,\n setupSnapProvider,\n ...args\n }: ProxyExecutionEnvironmentServiceArgs) {\n super({\n ...args,\n messenger,\n setupSnapProvider,\n usePing: false,\n });\n\n this.#stream = stream;\n }\n\n /**\n * Send a termination command to the proxy stream.\n *\n * @param job - The job to terminate.\n */\n // TODO: Either fix this lint violation or explain why it's necessary to\n // ignore.\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n protected async terminateJob(job: TerminateJobArgs<string>) {\n // The `AbstractExecutionService` will have already closed the job stream,\n // so we write to the runtime stream directly.\n this.#stream.write({\n jobId: job.id,\n data: {\n jsonrpc: '2.0',\n method: 'terminateJob',\n id: nanoid(),\n },\n });\n }\n\n /**\n * Create a new stream for the specified job. This wraps the root stream\n * in a stream specific to the job.\n *\n * @param jobId - The job ID.\n * @returns An object with the worker ID and stream.\n */\n protected async initEnvStream(jobId: string) {\n const stream = new ProxyPostMessageStream({\n stream: this.#stream,\n jobId,\n });\n\n // Send a request and await any response before continuing\n // This simulates the behaviour of non-proxy environments by effectively awaiting\n // the load of the environment inside the proxy environment\n // This assumes the proxy environment is already loaded before this function is called\n await new Promise((resolve) => {\n stream.once('data', resolve);\n stream.write({\n name: 'command',\n data: { jsonrpc: '2.0', method: 'ping', id: nanoid() },\n });\n });\n\n return { worker: jobId, stream };\n }\n}\n"]}
1
+ {"version":3,"file":"ProxyExecutionService.mjs","sourceRoot":"","sources":["../../../src/services/proxy/ProxyExecutionService.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,OAAO,EAAE,MAAM,EAAE,eAAe;AAMhC,OAAO,EAAE,wBAAwB,EAAE,wCAAoC;AACvE,OAAO,EAAE,sBAAsB,EAAE,sCAAkC;AAMnE,MAAM,OAAO,qBAAsB,SAAQ,wBAAgC;IAGzE;;;;;;;;;;OAUG;IACH,YAAY,EACV,MAAM,EACN,SAAS,EACT,iBAAiB,EACjB,GAAG,IAAI,EAC8B;QACrC,KAAK,CAAC;YACJ,GAAG,IAAI;YACP,SAAS;YACT,iBAAiB;YACjB,OAAO,EAAE,KAAK;SACf,CAAC,CAAC;QAxBI,gDAA+B;QA0BtC,uBAAA,IAAI,iCAAW,MAAM,MAAA,CAAC;IACxB,CAAC;IAED;;;;OAIG;IACH,wEAAwE;IACxE,WAAW;IACX,kEAAkE;IACxD,KAAK,CAAC,YAAY,CAAC,GAA6B;QACxD,0EAA0E;QAC1E,8CAA8C;QAC9C,uBAAA,IAAI,qCAAQ,CAAC,KAAK,CAAC;YACjB,KAAK,EAAE,GAAG,CAAC,EAAE;YACb,IAAI,EAAE;gBACJ,OAAO,EAAE,KAAK;gBACd,MAAM,EAAE,cAAc;gBACtB,EAAE,EAAE,MAAM,EAAE;aACb;SACF,CAAC,CAAC;IACL,CAAC;IAED;;;;;;OAMG;IACO,KAAK,CAAC,aAAa,CAAC,MAAc;QAC1C,MAAM,MAAM,GAAG,IAAI,sBAAsB,CAAC;YACxC,MAAM,EAAE,uBAAA,IAAI,qCAAQ;YACpB,KAAK,EAAE,MAAM;SACd,CAAC,CAAC;QAEH,0DAA0D;QAC1D,iFAAiF;QACjF,2DAA2D;QAC3D,sFAAsF;QACtF,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YAC5B,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;YAC7B,MAAM,CAAC,KAAK,CAAC;gBACX,IAAI,EAAE,SAAS;gBACf,IAAI,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE;aACvD,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;IACpC,CAAC;CACF","sourcesContent":["import type { BasePostMessageStream } from '@metamask/post-message-stream';\nimport { nanoid } from 'nanoid';\n\nimport type {\n ExecutionServiceArgs,\n TerminateJobArgs,\n} from '../AbstractExecutionService';\nimport { AbstractExecutionService } from '../AbstractExecutionService';\nimport { ProxyPostMessageStream } from '../ProxyPostMessageStream';\n\ntype ProxyExecutionEnvironmentServiceArgs = {\n stream: BasePostMessageStream;\n} & ExecutionServiceArgs;\n\nexport class ProxyExecutionService extends AbstractExecutionService<string> {\n readonly #stream: BasePostMessageStream;\n\n /**\n * Create a new proxy execution service.\n *\n * @param args - The constructor arguments.\n * @param args.messenger - The messenger to use for communication with the\n * `SnapController`.\n * @param args.setupSnapProvider - The function to use to set up the snap\n * provider.\n * @param args.stream - The stream to use for communicating with the proxy\n * executor.\n */\n constructor({\n stream,\n messenger,\n setupSnapProvider,\n ...args\n }: ProxyExecutionEnvironmentServiceArgs) {\n super({\n ...args,\n messenger,\n setupSnapProvider,\n usePing: false,\n });\n\n this.#stream = stream;\n }\n\n /**\n * Send a termination command to the proxy stream.\n *\n * @param job - The job to terminate.\n */\n // TODO: Either fix this lint violation or explain why it's necessary to\n // ignore.\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n protected async terminateJob(job: TerminateJobArgs<string>) {\n // The `AbstractExecutionService` will have already closed the job stream,\n // so we write to the runtime stream directly.\n this.#stream.write({\n jobId: job.id,\n data: {\n jsonrpc: '2.0',\n method: 'terminateJob',\n id: nanoid(),\n },\n });\n }\n\n /**\n * Create a new stream for the specified Snap. This wraps the root stream\n * in a stream specific to the Snap.\n *\n * @param snapId - The Snap ID.\n * @returns An object with the worker ID and stream.\n */\n protected async initEnvStream(snapId: string) {\n const stream = new ProxyPostMessageStream({\n stream: this.#stream,\n jobId: snapId,\n });\n\n // Send a request and await any response before continuing\n // This simulates the behaviour of non-proxy environments by effectively awaiting\n // the load of the environment inside the proxy environment\n // This assumes the proxy environment is already loaded before this function is called\n await new Promise((resolve) => {\n stream.once('data', resolve);\n stream.write({\n name: 'command',\n data: { jsonrpc: '2.0', method: 'ping', id: nanoid() },\n });\n });\n\n return { worker: snapId, stream };\n }\n}\n"]}
@@ -28,14 +28,14 @@ class WebViewExecutionService extends AbstractExecutionService_1.AbstractExecuti
28
28
  __classPrivateFieldSet(this, _WebViewExecutionService_removeWebView, removeWebView, "f");
29
29
  }
30
30
  /**
31
- * Create a new stream for the specified job. This wraps the runtime stream
32
- * in a stream specific to the job.
31
+ * Create a new stream for the specified Snap. This wraps the runtime stream
32
+ * in a stream specific to the Snap.
33
33
  *
34
- * @param jobId - The job ID.
35
- * @returns An object with the worker ID and stream.
34
+ * @param snapId - The Snap ID.
35
+ * @returns An object with the webview and stream.
36
36
  */
37
- async initEnvStream(jobId) {
38
- const webView = await __classPrivateFieldGet(this, _WebViewExecutionService_createWebView, "f").call(this, jobId);
37
+ async initEnvStream(snapId) {
38
+ const webView = await __classPrivateFieldGet(this, _WebViewExecutionService_createWebView, "f").call(this, snapId);
39
39
  const stream = new WebViewMessageStream_1.WebViewMessageStream({
40
40
  name: 'parent',
41
41
  target: 'child',
@@ -1 +1 @@
1
- {"version":3,"file":"WebViewExecutionService.cjs","sourceRoot":"","sources":["../../../src/services/webview/WebViewExecutionService.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,qEAA8D;AAC9D,8EAAuE;AAWvE,MAAa,uBAAwB,SAAQ,mDAA0C;IAKrF,YAAY,EACV,SAAS,EACT,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,GAAG,IAAI,EACqB;QAC5B,KAAK,CAAC;YACJ,GAAG,IAAI;YACP,SAAS;YACT,iBAAiB;SAClB,CAAC,CAAC;QAfI,yDAAe;QAEf,yDAAe;QActB,uBAAA,IAAI,0CAAkB,aAAa,MAAA,CAAC;QACpC,uBAAA,IAAI,0CAAkB,aAAa,MAAA,CAAC;IACtC,CAAC;IAED;;;;;;OAMG;IACO,KAAK,CAAC,aAAa,CAAC,KAAa;QACzC,MAAM,OAAO,GAAG,MAAM,uBAAA,IAAI,8CAAe,MAAnB,IAAI,EAAgB,KAAK,CAAC,CAAC;QAEjD,MAAM,MAAM,GAAG,IAAI,2CAAoB,CAAC;YACtC,IAAI,EAAE,QAAQ;YACd,MAAM,EAAE,OAAO;YACf,OAAO;SACR,CAAC,CAAC;QAEH,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;IACrC,CAAC;IAES,YAAY,CAAC,UAA8C;QACnE,uBAAA,IAAI,8CAAe,MAAnB,IAAI,EAAgB,UAAU,CAAC,EAAE,CAAC,CAAC;IACrC,CAAC;CACF;AA3CD,0DA2CC","sourcesContent":["import type { WebViewInterface } from './WebViewMessageStream';\nimport { WebViewMessageStream } from './WebViewMessageStream';\nimport { AbstractExecutionService } from '../AbstractExecutionService';\nimport type {\n ExecutionServiceArgs,\n TerminateJobArgs,\n} from '../AbstractExecutionService';\n\nexport type WebViewExecutionServiceArgs = ExecutionServiceArgs & {\n createWebView: (jobId: string) => Promise<WebViewInterface>;\n removeWebView: (jobId: string) => void;\n};\n\nexport class WebViewExecutionService extends AbstractExecutionService<WebViewInterface> {\n readonly #createWebView;\n\n readonly #removeWebView;\n\n constructor({\n messenger,\n setupSnapProvider,\n createWebView,\n removeWebView,\n ...args\n }: WebViewExecutionServiceArgs) {\n super({\n ...args,\n messenger,\n setupSnapProvider,\n });\n this.#createWebView = createWebView;\n this.#removeWebView = removeWebView;\n }\n\n /**\n * Create a new stream for the specified job. This wraps the runtime stream\n * in a stream specific to the job.\n *\n * @param jobId - The job ID.\n * @returns An object with the worker ID and stream.\n */\n protected async initEnvStream(jobId: string) {\n const webView = await this.#createWebView(jobId);\n\n const stream = new WebViewMessageStream({\n name: 'parent',\n target: 'child',\n webView,\n });\n\n return { worker: webView, stream };\n }\n\n protected terminateJob(jobWrapper: TerminateJobArgs<WebViewInterface>): void {\n this.#removeWebView(jobWrapper.id);\n }\n}\n"]}
1
+ {"version":3,"file":"WebViewExecutionService.cjs","sourceRoot":"","sources":["../../../src/services/webview/WebViewExecutionService.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,qEAA8D;AAC9D,8EAAuE;AAWvE,MAAa,uBAAwB,SAAQ,mDAA0C;IAKrF,YAAY,EACV,SAAS,EACT,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,GAAG,IAAI,EACqB;QAC5B,KAAK,CAAC;YACJ,GAAG,IAAI;YACP,SAAS;YACT,iBAAiB;SAClB,CAAC,CAAC;QAfI,yDAAe;QAEf,yDAAe;QActB,uBAAA,IAAI,0CAAkB,aAAa,MAAA,CAAC;QACpC,uBAAA,IAAI,0CAAkB,aAAa,MAAA,CAAC;IACtC,CAAC;IAED;;;;;;OAMG;IACO,KAAK,CAAC,aAAa,CAAC,MAAc;QAC1C,MAAM,OAAO,GAAG,MAAM,uBAAA,IAAI,8CAAe,MAAnB,IAAI,EAAgB,MAAM,CAAC,CAAC;QAElD,MAAM,MAAM,GAAG,IAAI,2CAAoB,CAAC;YACtC,IAAI,EAAE,QAAQ;YACd,MAAM,EAAE,OAAO;YACf,OAAO;SACR,CAAC,CAAC;QAEH,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;IACrC,CAAC;IAES,YAAY,CAAC,UAA8C;QACnE,uBAAA,IAAI,8CAAe,MAAnB,IAAI,EAAgB,UAAU,CAAC,EAAE,CAAC,CAAC;IACrC,CAAC;CACF;AA3CD,0DA2CC","sourcesContent":["import type { WebViewInterface } from './WebViewMessageStream';\nimport { WebViewMessageStream } from './WebViewMessageStream';\nimport { AbstractExecutionService } from '../AbstractExecutionService';\nimport type {\n ExecutionServiceArgs,\n TerminateJobArgs,\n} from '../AbstractExecutionService';\n\nexport type WebViewExecutionServiceArgs = ExecutionServiceArgs & {\n createWebView: (jobId: string) => Promise<WebViewInterface>;\n removeWebView: (jobId: string) => void;\n};\n\nexport class WebViewExecutionService extends AbstractExecutionService<WebViewInterface> {\n readonly #createWebView;\n\n readonly #removeWebView;\n\n constructor({\n messenger,\n setupSnapProvider,\n createWebView,\n removeWebView,\n ...args\n }: WebViewExecutionServiceArgs) {\n super({\n ...args,\n messenger,\n setupSnapProvider,\n });\n this.#createWebView = createWebView;\n this.#removeWebView = removeWebView;\n }\n\n /**\n * Create a new stream for the specified Snap. This wraps the runtime stream\n * in a stream specific to the Snap.\n *\n * @param snapId - The Snap ID.\n * @returns An object with the webview and stream.\n */\n protected async initEnvStream(snapId: string) {\n const webView = await this.#createWebView(snapId);\n\n const stream = new WebViewMessageStream({\n name: 'parent',\n target: 'child',\n webView,\n });\n\n return { worker: webView, stream };\n }\n\n protected terminateJob(jobWrapper: TerminateJobArgs<WebViewInterface>): void {\n this.#removeWebView(jobWrapper.id);\n }\n}\n"]}
@@ -10,13 +10,13 @@ export declare class WebViewExecutionService extends AbstractExecutionService<We
10
10
  #private;
11
11
  constructor({ messenger, setupSnapProvider, createWebView, removeWebView, ...args }: WebViewExecutionServiceArgs);
12
12
  /**
13
- * Create a new stream for the specified job. This wraps the runtime stream
14
- * in a stream specific to the job.
13
+ * Create a new stream for the specified Snap. This wraps the runtime stream
14
+ * in a stream specific to the Snap.
15
15
  *
16
- * @param jobId - The job ID.
17
- * @returns An object with the worker ID and stream.
16
+ * @param snapId - The Snap ID.
17
+ * @returns An object with the webview and stream.
18
18
  */
19
- protected initEnvStream(jobId: string): Promise<{
19
+ protected initEnvStream(snapId: string): Promise<{
20
20
  worker: WebViewInterface;
21
21
  stream: WebViewMessageStream;
22
22
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"WebViewExecutionService.d.cts","sourceRoot":"","sources":["../../../src/services/webview/WebViewExecutionService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,mCAA+B;AAC/D,OAAO,EAAE,oBAAoB,EAAE,mCAA+B;AAC9D,OAAO,EAAE,wBAAwB,EAAE,wCAAoC;AACvE,OAAO,KAAK,EACV,oBAAoB,EACpB,gBAAgB,EACjB,wCAAoC;AAErC,MAAM,MAAM,2BAA2B,GAAG,oBAAoB,GAAG;IAC/D,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAC5D,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACxC,CAAC;AAEF,qBAAa,uBAAwB,SAAQ,wBAAwB,CAAC,gBAAgB,CAAC;;gBAKzE,EACV,SAAS,EACT,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,GAAG,IAAI,EACR,EAAE,2BAA2B;IAU9B;;;;;;OAMG;cACa,aAAa,CAAC,KAAK,EAAE,MAAM;;;;IAY3C,SAAS,CAAC,YAAY,CAAC,UAAU,EAAE,gBAAgB,CAAC,gBAAgB,CAAC,GAAG,IAAI;CAG7E"}
1
+ {"version":3,"file":"WebViewExecutionService.d.cts","sourceRoot":"","sources":["../../../src/services/webview/WebViewExecutionService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,mCAA+B;AAC/D,OAAO,EAAE,oBAAoB,EAAE,mCAA+B;AAC9D,OAAO,EAAE,wBAAwB,EAAE,wCAAoC;AACvE,OAAO,KAAK,EACV,oBAAoB,EACpB,gBAAgB,EACjB,wCAAoC;AAErC,MAAM,MAAM,2BAA2B,GAAG,oBAAoB,GAAG;IAC/D,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAC5D,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACxC,CAAC;AAEF,qBAAa,uBAAwB,SAAQ,wBAAwB,CAAC,gBAAgB,CAAC;;gBAKzE,EACV,SAAS,EACT,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,GAAG,IAAI,EACR,EAAE,2BAA2B;IAU9B;;;;;;OAMG;cACa,aAAa,CAAC,MAAM,EAAE,MAAM;;;;IAY5C,SAAS,CAAC,YAAY,CAAC,UAAU,EAAE,gBAAgB,CAAC,gBAAgB,CAAC,GAAG,IAAI;CAG7E"}
@@ -10,13 +10,13 @@ export declare class WebViewExecutionService extends AbstractExecutionService<We
10
10
  #private;
11
11
  constructor({ messenger, setupSnapProvider, createWebView, removeWebView, ...args }: WebViewExecutionServiceArgs);
12
12
  /**
13
- * Create a new stream for the specified job. This wraps the runtime stream
14
- * in a stream specific to the job.
13
+ * Create a new stream for the specified Snap. This wraps the runtime stream
14
+ * in a stream specific to the Snap.
15
15
  *
16
- * @param jobId - The job ID.
17
- * @returns An object with the worker ID and stream.
16
+ * @param snapId - The Snap ID.
17
+ * @returns An object with the webview and stream.
18
18
  */
19
- protected initEnvStream(jobId: string): Promise<{
19
+ protected initEnvStream(snapId: string): Promise<{
20
20
  worker: WebViewInterface;
21
21
  stream: WebViewMessageStream;
22
22
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"WebViewExecutionService.d.mts","sourceRoot":"","sources":["../../../src/services/webview/WebViewExecutionService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,mCAA+B;AAC/D,OAAO,EAAE,oBAAoB,EAAE,mCAA+B;AAC9D,OAAO,EAAE,wBAAwB,EAAE,wCAAoC;AACvE,OAAO,KAAK,EACV,oBAAoB,EACpB,gBAAgB,EACjB,wCAAoC;AAErC,MAAM,MAAM,2BAA2B,GAAG,oBAAoB,GAAG;IAC/D,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAC5D,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACxC,CAAC;AAEF,qBAAa,uBAAwB,SAAQ,wBAAwB,CAAC,gBAAgB,CAAC;;gBAKzE,EACV,SAAS,EACT,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,GAAG,IAAI,EACR,EAAE,2BAA2B;IAU9B;;;;;;OAMG;cACa,aAAa,CAAC,KAAK,EAAE,MAAM;;;;IAY3C,SAAS,CAAC,YAAY,CAAC,UAAU,EAAE,gBAAgB,CAAC,gBAAgB,CAAC,GAAG,IAAI;CAG7E"}
1
+ {"version":3,"file":"WebViewExecutionService.d.mts","sourceRoot":"","sources":["../../../src/services/webview/WebViewExecutionService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,mCAA+B;AAC/D,OAAO,EAAE,oBAAoB,EAAE,mCAA+B;AAC9D,OAAO,EAAE,wBAAwB,EAAE,wCAAoC;AACvE,OAAO,KAAK,EACV,oBAAoB,EACpB,gBAAgB,EACjB,wCAAoC;AAErC,MAAM,MAAM,2BAA2B,GAAG,oBAAoB,GAAG;IAC/D,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAC5D,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACxC,CAAC;AAEF,qBAAa,uBAAwB,SAAQ,wBAAwB,CAAC,gBAAgB,CAAC;;gBAKzE,EACV,SAAS,EACT,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,GAAG,IAAI,EACR,EAAE,2BAA2B;IAU9B;;;;;;OAMG;cACa,aAAa,CAAC,MAAM,EAAE,MAAM;;;;IAY5C,SAAS,CAAC,YAAY,CAAC,UAAU,EAAE,gBAAgB,CAAC,gBAAgB,CAAC,GAAG,IAAI;CAG7E"}
@@ -25,14 +25,14 @@ export class WebViewExecutionService extends AbstractExecutionService {
25
25
  __classPrivateFieldSet(this, _WebViewExecutionService_removeWebView, removeWebView, "f");
26
26
  }
27
27
  /**
28
- * Create a new stream for the specified job. This wraps the runtime stream
29
- * in a stream specific to the job.
28
+ * Create a new stream for the specified Snap. This wraps the runtime stream
29
+ * in a stream specific to the Snap.
30
30
  *
31
- * @param jobId - The job ID.
32
- * @returns An object with the worker ID and stream.
31
+ * @param snapId - The Snap ID.
32
+ * @returns An object with the webview and stream.
33
33
  */
34
- async initEnvStream(jobId) {
35
- const webView = await __classPrivateFieldGet(this, _WebViewExecutionService_createWebView, "f").call(this, jobId);
34
+ async initEnvStream(snapId) {
35
+ const webView = await __classPrivateFieldGet(this, _WebViewExecutionService_createWebView, "f").call(this, snapId);
36
36
  const stream = new WebViewMessageStream({
37
37
  name: 'parent',
38
38
  target: 'child',
@@ -1 +1 @@
1
- {"version":3,"file":"WebViewExecutionService.mjs","sourceRoot":"","sources":["../../../src/services/webview/WebViewExecutionService.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,OAAO,EAAE,oBAAoB,EAAE,mCAA+B;AAC9D,OAAO,EAAE,wBAAwB,EAAE,wCAAoC;AAWvE,MAAM,OAAO,uBAAwB,SAAQ,wBAA0C;IAKrF,YAAY,EACV,SAAS,EACT,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,GAAG,IAAI,EACqB;QAC5B,KAAK,CAAC;YACJ,GAAG,IAAI;YACP,SAAS;YACT,iBAAiB;SAClB,CAAC,CAAC;QAfI,yDAAe;QAEf,yDAAe;QActB,uBAAA,IAAI,0CAAkB,aAAa,MAAA,CAAC;QACpC,uBAAA,IAAI,0CAAkB,aAAa,MAAA,CAAC;IACtC,CAAC;IAED;;;;;;OAMG;IACO,KAAK,CAAC,aAAa,CAAC,KAAa;QACzC,MAAM,OAAO,GAAG,MAAM,uBAAA,IAAI,8CAAe,MAAnB,IAAI,EAAgB,KAAK,CAAC,CAAC;QAEjD,MAAM,MAAM,GAAG,IAAI,oBAAoB,CAAC;YACtC,IAAI,EAAE,QAAQ;YACd,MAAM,EAAE,OAAO;YACf,OAAO;SACR,CAAC,CAAC;QAEH,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;IACrC,CAAC;IAES,YAAY,CAAC,UAA8C;QACnE,uBAAA,IAAI,8CAAe,MAAnB,IAAI,EAAgB,UAAU,CAAC,EAAE,CAAC,CAAC;IACrC,CAAC;CACF","sourcesContent":["import type { WebViewInterface } from './WebViewMessageStream';\nimport { WebViewMessageStream } from './WebViewMessageStream';\nimport { AbstractExecutionService } from '../AbstractExecutionService';\nimport type {\n ExecutionServiceArgs,\n TerminateJobArgs,\n} from '../AbstractExecutionService';\n\nexport type WebViewExecutionServiceArgs = ExecutionServiceArgs & {\n createWebView: (jobId: string) => Promise<WebViewInterface>;\n removeWebView: (jobId: string) => void;\n};\n\nexport class WebViewExecutionService extends AbstractExecutionService<WebViewInterface> {\n readonly #createWebView;\n\n readonly #removeWebView;\n\n constructor({\n messenger,\n setupSnapProvider,\n createWebView,\n removeWebView,\n ...args\n }: WebViewExecutionServiceArgs) {\n super({\n ...args,\n messenger,\n setupSnapProvider,\n });\n this.#createWebView = createWebView;\n this.#removeWebView = removeWebView;\n }\n\n /**\n * Create a new stream for the specified job. This wraps the runtime stream\n * in a stream specific to the job.\n *\n * @param jobId - The job ID.\n * @returns An object with the worker ID and stream.\n */\n protected async initEnvStream(jobId: string) {\n const webView = await this.#createWebView(jobId);\n\n const stream = new WebViewMessageStream({\n name: 'parent',\n target: 'child',\n webView,\n });\n\n return { worker: webView, stream };\n }\n\n protected terminateJob(jobWrapper: TerminateJobArgs<WebViewInterface>): void {\n this.#removeWebView(jobWrapper.id);\n }\n}\n"]}
1
+ {"version":3,"file":"WebViewExecutionService.mjs","sourceRoot":"","sources":["../../../src/services/webview/WebViewExecutionService.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,OAAO,EAAE,oBAAoB,EAAE,mCAA+B;AAC9D,OAAO,EAAE,wBAAwB,EAAE,wCAAoC;AAWvE,MAAM,OAAO,uBAAwB,SAAQ,wBAA0C;IAKrF,YAAY,EACV,SAAS,EACT,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,GAAG,IAAI,EACqB;QAC5B,KAAK,CAAC;YACJ,GAAG,IAAI;YACP,SAAS;YACT,iBAAiB;SAClB,CAAC,CAAC;QAfI,yDAAe;QAEf,yDAAe;QActB,uBAAA,IAAI,0CAAkB,aAAa,MAAA,CAAC;QACpC,uBAAA,IAAI,0CAAkB,aAAa,MAAA,CAAC;IACtC,CAAC;IAED;;;;;;OAMG;IACO,KAAK,CAAC,aAAa,CAAC,MAAc;QAC1C,MAAM,OAAO,GAAG,MAAM,uBAAA,IAAI,8CAAe,MAAnB,IAAI,EAAgB,MAAM,CAAC,CAAC;QAElD,MAAM,MAAM,GAAG,IAAI,oBAAoB,CAAC;YACtC,IAAI,EAAE,QAAQ;YACd,MAAM,EAAE,OAAO;YACf,OAAO;SACR,CAAC,CAAC;QAEH,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;IACrC,CAAC;IAES,YAAY,CAAC,UAA8C;QACnE,uBAAA,IAAI,8CAAe,MAAnB,IAAI,EAAgB,UAAU,CAAC,EAAE,CAAC,CAAC;IACrC,CAAC;CACF","sourcesContent":["import type { WebViewInterface } from './WebViewMessageStream';\nimport { WebViewMessageStream } from './WebViewMessageStream';\nimport { AbstractExecutionService } from '../AbstractExecutionService';\nimport type {\n ExecutionServiceArgs,\n TerminateJobArgs,\n} from '../AbstractExecutionService';\n\nexport type WebViewExecutionServiceArgs = ExecutionServiceArgs & {\n createWebView: (jobId: string) => Promise<WebViewInterface>;\n removeWebView: (jobId: string) => void;\n};\n\nexport class WebViewExecutionService extends AbstractExecutionService<WebViewInterface> {\n readonly #createWebView;\n\n readonly #removeWebView;\n\n constructor({\n messenger,\n setupSnapProvider,\n createWebView,\n removeWebView,\n ...args\n }: WebViewExecutionServiceArgs) {\n super({\n ...args,\n messenger,\n setupSnapProvider,\n });\n this.#createWebView = createWebView;\n this.#removeWebView = removeWebView;\n }\n\n /**\n * Create a new stream for the specified Snap. This wraps the runtime stream\n * in a stream specific to the Snap.\n *\n * @param snapId - The Snap ID.\n * @returns An object with the webview and stream.\n */\n protected async initEnvStream(snapId: string) {\n const webView = await this.#createWebView(snapId);\n\n const stream = new WebViewMessageStream({\n name: 'parent',\n target: 'child',\n webView,\n });\n\n return { worker: webView, stream };\n }\n\n protected terminateJob(jobWrapper: TerminateJobArgs<WebViewInterface>): void {\n this.#removeWebView(jobWrapper.id);\n }\n}\n"]}