@shopify/ui-extensions-server-kit 5.2.0 → 5.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 (169) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/ExtensionServerClient/ExtensionServerClient.cjs.js +1 -1
  3. package/dist/ExtensionServerClient/ExtensionServerClient.d.ts +1 -0
  4. package/dist/ExtensionServerClient/ExtensionServerClient.es.js +1 -1
  5. package/dist/ExtensionServerClient/ExtensionServerClient.test.d.ts +8 -0
  6. package/dist/ExtensionServerClient/server-types.d.ts +42 -0
  7. package/dist/context/constants.cjs.js +1 -1
  8. package/dist/context/constants.d.ts +0 -1
  9. package/dist/context/constants.es.js +0 -1
  10. package/dist/context/types.d.ts +1 -0
  11. package/dist/hooks/index.d.ts +0 -2
  12. package/dist/i18n.cjs.js +1 -1
  13. package/dist/i18n.d.ts +1 -20
  14. package/dist/i18n.es.js +0 -1
  15. package/dist/index.cjs.js +1 -1
  16. package/dist/index.es.js +40 -48
  17. package/dist/testing/extensions.cjs.js +1 -1
  18. package/dist/testing/extensions.es.js +2 -2
  19. package/dist/types.cjs.js +1 -1
  20. package/dist/types.d.ts +10 -4
  21. package/dist/types.es.js +2 -2
  22. package/dist/utilities/index.d.ts +0 -1
  23. package/node_modules/@shopify/ui-extensions-test-utils/dist/index.d.ts +3 -0
  24. package/node_modules/@shopify/ui-extensions-test-utils/dist/render.d.ts +2 -0
  25. package/node_modules/@shopify/ui-extensions-test-utils/dist/renderHook.d.ts +17 -0
  26. package/node_modules/@shopify/ui-extensions-test-utils/dist/withProviders.d.ts +9 -0
  27. package/node_modules/@shopify/ui-extensions-test-utils/dist/withProviders.js +1 -0
  28. package/node_modules/@shopify/ui-extensions-test-utils/package.json +2 -3
  29. package/package.json +7 -6
  30. package/project.json +0 -2
  31. package/src/ExtensionServerClient/ExtensionServerClient.test.ts +837 -330
  32. package/src/ExtensionServerClient/ExtensionServerClient.ts +10 -8
  33. package/src/ExtensionServerClient/server-types.ts +55 -0
  34. package/src/ExtensionServerClient/types.ts +2 -0
  35. package/src/context/ExtensionServerProvider.test.tsx +202 -39
  36. package/src/context/ExtensionServerProvider.tsx +1 -0
  37. package/src/context/constants.ts +3 -2
  38. package/src/context/types.ts +1 -0
  39. package/src/hooks/index.ts +0 -2
  40. package/src/i18n.ts +3 -3
  41. package/src/state/reducers/extensionServerReducer.test.ts +2 -2
  42. package/src/testing/extensions.ts +2 -2
  43. package/src/types.ts +10 -4
  44. package/src/utilities/index.ts +0 -1
  45. package/src/utilities/replaceUpdated.ts +1 -0
  46. package/src/utilities/set.ts +1 -0
  47. package/dist/hooks/useExtensionClient.cjs.js +0 -1
  48. package/dist/hooks/useExtensionClient.d.ts +0 -1
  49. package/dist/hooks/useExtensionClient.es.js +0 -8
  50. package/dist/hooks/useExtensionServerEvent.cjs.js +0 -1
  51. package/dist/hooks/useExtensionServerEvent.d.ts +0 -1
  52. package/dist/hooks/useExtensionServerEvent.es.js +0 -9
  53. package/dist/utilities/groupByKey.cjs.js +0 -1
  54. package/dist/utilities/groupByKey.d.ts +0 -3
  55. package/dist/utilities/groupByKey.es.js +0 -6
  56. package/node_modules/@types/node/LICENSE +0 -21
  57. package/node_modules/@types/node/README.md +0 -15
  58. package/node_modules/@types/node/assert/strict.d.ts +0 -8
  59. package/node_modules/@types/node/assert.d.ts +0 -985
  60. package/node_modules/@types/node/async_hooks.d.ts +0 -522
  61. package/node_modules/@types/node/buffer.d.ts +0 -2321
  62. package/node_modules/@types/node/child_process.d.ts +0 -1544
  63. package/node_modules/@types/node/cluster.d.ts +0 -432
  64. package/node_modules/@types/node/console.d.ts +0 -412
  65. package/node_modules/@types/node/constants.d.ts +0 -19
  66. package/node_modules/@types/node/crypto.d.ts +0 -4451
  67. package/node_modules/@types/node/dgram.d.ts +0 -586
  68. package/node_modules/@types/node/diagnostics_channel.d.ts +0 -192
  69. package/node_modules/@types/node/dns/promises.d.ts +0 -381
  70. package/node_modules/@types/node/dns.d.ts +0 -809
  71. package/node_modules/@types/node/dom-events.d.ts +0 -122
  72. package/node_modules/@types/node/domain.d.ts +0 -170
  73. package/node_modules/@types/node/events.d.ts +0 -803
  74. package/node_modules/@types/node/fs/promises.d.ts +0 -1205
  75. package/node_modules/@types/node/fs.d.ts +0 -4211
  76. package/node_modules/@types/node/globals.d.ts +0 -377
  77. package/node_modules/@types/node/globals.global.d.ts +0 -1
  78. package/node_modules/@types/node/http.d.ts +0 -1801
  79. package/node_modules/@types/node/http2.d.ts +0 -2386
  80. package/node_modules/@types/node/https.d.ts +0 -544
  81. package/node_modules/@types/node/index.d.ts +0 -88
  82. package/node_modules/@types/node/inspector.d.ts +0 -2739
  83. package/node_modules/@types/node/module.d.ts +0 -298
  84. package/node_modules/@types/node/net.d.ts +0 -913
  85. package/node_modules/@types/node/os.d.ts +0 -473
  86. package/node_modules/@types/node/package.json +0 -235
  87. package/node_modules/@types/node/path.d.ts +0 -191
  88. package/node_modules/@types/node/perf_hooks.d.ts +0 -626
  89. package/node_modules/@types/node/process.d.ts +0 -1531
  90. package/node_modules/@types/node/punycode.d.ts +0 -117
  91. package/node_modules/@types/node/querystring.d.ts +0 -141
  92. package/node_modules/@types/node/readline/promises.d.ts +0 -143
  93. package/node_modules/@types/node/readline.d.ts +0 -666
  94. package/node_modules/@types/node/repl.d.ts +0 -430
  95. package/node_modules/@types/node/stream/consumers.d.ts +0 -12
  96. package/node_modules/@types/node/stream/promises.d.ts +0 -83
  97. package/node_modules/@types/node/stream/web.d.ts +0 -336
  98. package/node_modules/@types/node/stream.d.ts +0 -1731
  99. package/node_modules/@types/node/string_decoder.d.ts +0 -67
  100. package/node_modules/@types/node/test.d.ts +0 -1113
  101. package/node_modules/@types/node/timers/promises.d.ts +0 -93
  102. package/node_modules/@types/node/timers.d.ts +0 -126
  103. package/node_modules/@types/node/tls.d.ts +0 -1203
  104. package/node_modules/@types/node/trace_events.d.ts +0 -171
  105. package/node_modules/@types/node/ts4.8/assert/strict.d.ts +0 -8
  106. package/node_modules/@types/node/ts4.8/assert.d.ts +0 -985
  107. package/node_modules/@types/node/ts4.8/async_hooks.d.ts +0 -522
  108. package/node_modules/@types/node/ts4.8/buffer.d.ts +0 -2321
  109. package/node_modules/@types/node/ts4.8/child_process.d.ts +0 -1544
  110. package/node_modules/@types/node/ts4.8/cluster.d.ts +0 -432
  111. package/node_modules/@types/node/ts4.8/console.d.ts +0 -412
  112. package/node_modules/@types/node/ts4.8/constants.d.ts +0 -19
  113. package/node_modules/@types/node/ts4.8/crypto.d.ts +0 -4450
  114. package/node_modules/@types/node/ts4.8/dgram.d.ts +0 -586
  115. package/node_modules/@types/node/ts4.8/diagnostics_channel.d.ts +0 -192
  116. package/node_modules/@types/node/ts4.8/dns/promises.d.ts +0 -381
  117. package/node_modules/@types/node/ts4.8/dns.d.ts +0 -809
  118. package/node_modules/@types/node/ts4.8/dom-events.d.ts +0 -122
  119. package/node_modules/@types/node/ts4.8/domain.d.ts +0 -170
  120. package/node_modules/@types/node/ts4.8/events.d.ts +0 -754
  121. package/node_modules/@types/node/ts4.8/fs/promises.d.ts +0 -1205
  122. package/node_modules/@types/node/ts4.8/fs.d.ts +0 -4211
  123. package/node_modules/@types/node/ts4.8/globals.d.ts +0 -377
  124. package/node_modules/@types/node/ts4.8/globals.global.d.ts +0 -1
  125. package/node_modules/@types/node/ts4.8/http.d.ts +0 -1801
  126. package/node_modules/@types/node/ts4.8/http2.d.ts +0 -2386
  127. package/node_modules/@types/node/ts4.8/https.d.ts +0 -544
  128. package/node_modules/@types/node/ts4.8/index.d.ts +0 -88
  129. package/node_modules/@types/node/ts4.8/inspector.d.ts +0 -2739
  130. package/node_modules/@types/node/ts4.8/module.d.ts +0 -298
  131. package/node_modules/@types/node/ts4.8/net.d.ts +0 -913
  132. package/node_modules/@types/node/ts4.8/os.d.ts +0 -473
  133. package/node_modules/@types/node/ts4.8/path.d.ts +0 -191
  134. package/node_modules/@types/node/ts4.8/perf_hooks.d.ts +0 -626
  135. package/node_modules/@types/node/ts4.8/process.d.ts +0 -1531
  136. package/node_modules/@types/node/ts4.8/punycode.d.ts +0 -117
  137. package/node_modules/@types/node/ts4.8/querystring.d.ts +0 -141
  138. package/node_modules/@types/node/ts4.8/readline/promises.d.ts +0 -143
  139. package/node_modules/@types/node/ts4.8/readline.d.ts +0 -666
  140. package/node_modules/@types/node/ts4.8/repl.d.ts +0 -430
  141. package/node_modules/@types/node/ts4.8/stream/consumers.d.ts +0 -12
  142. package/node_modules/@types/node/ts4.8/stream/promises.d.ts +0 -83
  143. package/node_modules/@types/node/ts4.8/stream/web.d.ts +0 -336
  144. package/node_modules/@types/node/ts4.8/stream.d.ts +0 -1731
  145. package/node_modules/@types/node/ts4.8/string_decoder.d.ts +0 -67
  146. package/node_modules/@types/node/ts4.8/test.d.ts +0 -1113
  147. package/node_modules/@types/node/ts4.8/timers/promises.d.ts +0 -93
  148. package/node_modules/@types/node/ts4.8/timers.d.ts +0 -126
  149. package/node_modules/@types/node/ts4.8/tls.d.ts +0 -1203
  150. package/node_modules/@types/node/ts4.8/trace_events.d.ts +0 -171
  151. package/node_modules/@types/node/ts4.8/tty.d.ts +0 -206
  152. package/node_modules/@types/node/ts4.8/url.d.ts +0 -937
  153. package/node_modules/@types/node/ts4.8/util.d.ts +0 -2075
  154. package/node_modules/@types/node/ts4.8/v8.d.ts +0 -541
  155. package/node_modules/@types/node/ts4.8/vm.d.ts +0 -667
  156. package/node_modules/@types/node/ts4.8/wasi.d.ts +0 -158
  157. package/node_modules/@types/node/ts4.8/worker_threads.d.ts +0 -692
  158. package/node_modules/@types/node/ts4.8/zlib.d.ts +0 -517
  159. package/node_modules/@types/node/tty.d.ts +0 -206
  160. package/node_modules/@types/node/url.d.ts +0 -937
  161. package/node_modules/@types/node/util.d.ts +0 -2075
  162. package/node_modules/@types/node/v8.d.ts +0 -541
  163. package/node_modules/@types/node/vm.d.ts +0 -667
  164. package/node_modules/@types/node/wasi.d.ts +0 -158
  165. package/node_modules/@types/node/worker_threads.d.ts +0 -692
  166. package/node_modules/@types/node/zlib.d.ts +0 -517
  167. package/src/hooks/useExtensionClient.ts +0 -6
  168. package/src/hooks/useExtensionServerEvent.ts +0 -11
  169. package/src/utilities/groupByKey.ts +0 -3
@@ -1,158 +0,0 @@
1
- /**
2
- * The WASI API provides an implementation of the [WebAssembly System Interface](https://wasi.dev/) specification. WASI gives sandboxed WebAssembly applications access to the
3
- * underlying operating system via a collection of POSIX-like functions.
4
- *
5
- * ```js
6
- * import { readFile } from 'fs/promises';
7
- * import { WASI } from 'wasi';
8
- * import { argv, env } from 'process';
9
- *
10
- * const wasi = new WASI({
11
- * args: argv,
12
- * env,
13
- * preopens: {
14
- * '/sandbox': '/some/real/path/that/wasm/can/access'
15
- * }
16
- * });
17
- *
18
- * // Some WASI binaries require:
19
- * // const importObject = { wasi_unstable: wasi.wasiImport };
20
- * const importObject = { wasi_snapshot_preview1: wasi.wasiImport };
21
- *
22
- * const wasm = await WebAssembly.compile(
23
- * await readFile(new URL('./demo.wasm', import.meta.url))
24
- * );
25
- * const instance = await WebAssembly.instantiate(wasm, importObject);
26
- *
27
- * wasi.start(instance);
28
- * ```
29
- *
30
- * To run the above example, create a new WebAssembly text format file named`demo.wat`:
31
- *
32
- * ```text
33
- * (module
34
- * ;; Import the required fd_write WASI function which will write the given io vectors to stdout
35
- * ;; The function signature for fd_write is:
36
- * ;; (File Descriptor, *iovs, iovs_len, nwritten) -> Returns number of bytes written
37
- * (import "wasi_snapshot_preview1" "fd_write" (func $fd_write (param i32 i32 i32 i32) (result i32)))
38
- *
39
- * (memory 1)
40
- * (export "memory" (memory 0))
41
- *
42
- * ;; Write 'hello world\n' to memory at an offset of 8 bytes
43
- * ;; Note the trailing newline which is required for the text to appear
44
- * (data (i32.const 8) "hello world\n")
45
- *
46
- * (func $main (export "_start")
47
- * ;; Creating a new io vector within linear memory
48
- * (i32.store (i32.const 0) (i32.const 8)) ;; iov.iov_base - This is a pointer to the start of the 'hello world\n' string
49
- * (i32.store (i32.const 4) (i32.const 12)) ;; iov.iov_len - The length of the 'hello world\n' string
50
- *
51
- * (call $fd_write
52
- * (i32.const 1) ;; file_descriptor - 1 for stdout
53
- * (i32.const 0) ;; *iovs - The pointer to the iov array, which is stored at memory location 0
54
- * (i32.const 1) ;; iovs_len - We're printing 1 string stored in an iov - so one.
55
- * (i32.const 20) ;; nwritten - A place in memory to store the number of bytes written
56
- * )
57
- * drop ;; Discard the number of bytes written from the top of the stack
58
- * )
59
- * )
60
- * ```
61
- *
62
- * Use [wabt](https://github.com/WebAssembly/wabt) to compile `.wat` to `.wasm`
63
- *
64
- * ```console
65
- * $ wat2wasm demo.wat
66
- * ```
67
- *
68
- * The `--experimental-wasi-unstable-preview1` CLI argument is needed for this
69
- * example to run.
70
- * @experimental
71
- * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/wasi.js)
72
- */
73
- declare module "wasi" {
74
- interface WASIOptions {
75
- /**
76
- * An array of strings that the WebAssembly application will
77
- * see as command line arguments. The first argument is the virtual path to the
78
- * WASI command itself.
79
- */
80
- args?: string[] | undefined;
81
- /**
82
- * An object similar to `process.env` that the WebAssembly
83
- * application will see as its environment.
84
- */
85
- env?: object | undefined;
86
- /**
87
- * This object represents the WebAssembly application's
88
- * sandbox directory structure. The string keys of `preopens` are treated as
89
- * directories within the sandbox. The corresponding values in `preopens` are
90
- * the real paths to those directories on the host machine.
91
- */
92
- preopens?: NodeJS.Dict<string> | undefined;
93
- /**
94
- * By default, WASI applications terminate the Node.js
95
- * process via the `__wasi_proc_exit()` function. Setting this option to `true`
96
- * causes `wasi.start()` to return the exit code rather than terminate the
97
- * process.
98
- * @default false
99
- */
100
- returnOnExit?: boolean | undefined;
101
- /**
102
- * The file descriptor used as standard input in the WebAssembly application.
103
- * @default 0
104
- */
105
- stdin?: number | undefined;
106
- /**
107
- * The file descriptor used as standard output in the WebAssembly application.
108
- * @default 1
109
- */
110
- stdout?: number | undefined;
111
- /**
112
- * The file descriptor used as standard error in the WebAssembly application.
113
- * @default 2
114
- */
115
- stderr?: number | undefined;
116
- }
117
- /**
118
- * The `WASI` class provides the WASI system call API and additional convenience
119
- * methods for working with WASI-based applications. Each `WASI` instance
120
- * represents a distinct sandbox environment. For security purposes, each `WASI`instance must have its command-line arguments, environment variables, and
121
- * sandbox directory structure configured explicitly.
122
- * @since v13.3.0, v12.16.0
123
- */
124
- class WASI {
125
- constructor(options?: WASIOptions);
126
- /**
127
- * Attempt to begin execution of `instance` as a WASI command by invoking its`_start()` export. If `instance` does not contain a `_start()` export, or if`instance` contains an `_initialize()`
128
- * export, then an exception is thrown.
129
- *
130
- * `start()` requires that `instance` exports a [`WebAssembly.Memory`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Memory) named`memory`. If
131
- * `instance` does not have a `memory` export an exception is thrown.
132
- *
133
- * If `start()` is called more than once, an exception is thrown.
134
- * @since v13.3.0, v12.16.0
135
- */
136
- start(instance: object): number; // TODO: avoid DOM dependency until WASM moved to own lib.
137
- /**
138
- * Attempt to initialize `instance` as a WASI reactor by invoking its`_initialize()` export, if it is present. If `instance` contains a `_start()`export, then an exception is thrown.
139
- *
140
- * `initialize()` requires that `instance` exports a [`WebAssembly.Memory`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Memory) named`memory`.
141
- * If `instance` does not have a `memory` export an exception is thrown.
142
- *
143
- * If `initialize()` is called more than once, an exception is thrown.
144
- * @since v14.6.0, v12.19.0
145
- */
146
- initialize(instance: object): void; // TODO: avoid DOM dependency until WASM moved to own lib.
147
- /**
148
- * `wasiImport` is an object that implements the WASI system call API. This object
149
- * should be passed as the `wasi_snapshot_preview1` import during the instantiation
150
- * of a [`WebAssembly.Instance`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Instance).
151
- * @since v13.3.0, v12.16.0
152
- */
153
- readonly wasiImport: NodeJS.Dict<any>; // TODO: Narrow to DOM types
154
- }
155
- }
156
- declare module "node:wasi" {
157
- export * from "wasi";
158
- }