@diia-inhouse/genproto 1.15.0 → 2.0.1

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 (358) hide show
  1. package/.github/workflows/accept-contribution.yml +13 -0
  2. package/.gitlab-ci.yml +0 -1
  3. package/package.json +6 -7
  4. package/node_modules/@protobufjs/aspromise/LICENSE +0 -26
  5. package/node_modules/@protobufjs/aspromise/README.md +0 -13
  6. package/node_modules/@protobufjs/aspromise/index.d.ts +0 -13
  7. package/node_modules/@protobufjs/aspromise/index.js +0 -52
  8. package/node_modules/@protobufjs/aspromise/package.json +0 -21
  9. package/node_modules/@protobufjs/aspromise/tests/index.js +0 -130
  10. package/node_modules/@protobufjs/base64/LICENSE +0 -26
  11. package/node_modules/@protobufjs/base64/README.md +0 -19
  12. package/node_modules/@protobufjs/base64/index.d.ts +0 -32
  13. package/node_modules/@protobufjs/base64/index.js +0 -139
  14. package/node_modules/@protobufjs/base64/package.json +0 -21
  15. package/node_modules/@protobufjs/base64/tests/index.js +0 -46
  16. package/node_modules/@protobufjs/codegen/LICENSE +0 -26
  17. package/node_modules/@protobufjs/codegen/README.md +0 -49
  18. package/node_modules/@protobufjs/codegen/index.d.ts +0 -31
  19. package/node_modules/@protobufjs/codegen/index.js +0 -99
  20. package/node_modules/@protobufjs/codegen/package.json +0 -13
  21. package/node_modules/@protobufjs/codegen/tests/index.js +0 -13
  22. package/node_modules/@protobufjs/eventemitter/LICENSE +0 -26
  23. package/node_modules/@protobufjs/eventemitter/README.md +0 -22
  24. package/node_modules/@protobufjs/eventemitter/index.d.ts +0 -43
  25. package/node_modules/@protobufjs/eventemitter/index.js +0 -76
  26. package/node_modules/@protobufjs/eventemitter/package.json +0 -21
  27. package/node_modules/@protobufjs/eventemitter/tests/index.js +0 -47
  28. package/node_modules/@protobufjs/fetch/LICENSE +0 -26
  29. package/node_modules/@protobufjs/fetch/README.md +0 -13
  30. package/node_modules/@protobufjs/fetch/index.d.ts +0 -56
  31. package/node_modules/@protobufjs/fetch/index.js +0 -115
  32. package/node_modules/@protobufjs/fetch/package.json +0 -25
  33. package/node_modules/@protobufjs/fetch/tests/index.js +0 -16
  34. package/node_modules/@protobufjs/float/LICENSE +0 -26
  35. package/node_modules/@protobufjs/float/README.md +0 -102
  36. package/node_modules/@protobufjs/float/bench/index.js +0 -87
  37. package/node_modules/@protobufjs/float/bench/suite.js +0 -46
  38. package/node_modules/@protobufjs/float/index.d.ts +0 -83
  39. package/node_modules/@protobufjs/float/index.js +0 -335
  40. package/node_modules/@protobufjs/float/package.json +0 -26
  41. package/node_modules/@protobufjs/float/tests/index.js +0 -100
  42. package/node_modules/@protobufjs/inquire/.npmignore +0 -3
  43. package/node_modules/@protobufjs/inquire/LICENSE +0 -26
  44. package/node_modules/@protobufjs/inquire/README.md +0 -13
  45. package/node_modules/@protobufjs/inquire/index.d.ts +0 -9
  46. package/node_modules/@protobufjs/inquire/index.js +0 -17
  47. package/node_modules/@protobufjs/inquire/package.json +0 -21
  48. package/node_modules/@protobufjs/inquire/tests/data/array.js +0 -1
  49. package/node_modules/@protobufjs/inquire/tests/data/emptyArray.js +0 -1
  50. package/node_modules/@protobufjs/inquire/tests/data/emptyObject.js +0 -1
  51. package/node_modules/@protobufjs/inquire/tests/data/object.js +0 -1
  52. package/node_modules/@protobufjs/inquire/tests/index.js +0 -20
  53. package/node_modules/@protobufjs/path/LICENSE +0 -26
  54. package/node_modules/@protobufjs/path/README.md +0 -19
  55. package/node_modules/@protobufjs/path/index.d.ts +0 -22
  56. package/node_modules/@protobufjs/path/index.js +0 -65
  57. package/node_modules/@protobufjs/path/package.json +0 -21
  58. package/node_modules/@protobufjs/path/tests/index.js +0 -60
  59. package/node_modules/@protobufjs/pool/.npmignore +0 -3
  60. package/node_modules/@protobufjs/pool/LICENSE +0 -26
  61. package/node_modules/@protobufjs/pool/README.md +0 -13
  62. package/node_modules/@protobufjs/pool/index.d.ts +0 -32
  63. package/node_modules/@protobufjs/pool/index.js +0 -48
  64. package/node_modules/@protobufjs/pool/package.json +0 -21
  65. package/node_modules/@protobufjs/pool/tests/index.js +0 -33
  66. package/node_modules/@protobufjs/utf8/.npmignore +0 -3
  67. package/node_modules/@protobufjs/utf8/LICENSE +0 -26
  68. package/node_modules/@protobufjs/utf8/README.md +0 -20
  69. package/node_modules/@protobufjs/utf8/index.d.ts +0 -24
  70. package/node_modules/@protobufjs/utf8/index.js +0 -105
  71. package/node_modules/@protobufjs/utf8/package.json +0 -21
  72. package/node_modules/@protobufjs/utf8/tests/data/utf8.txt +0 -216
  73. package/node_modules/@protobufjs/utf8/tests/index.js +0 -57
  74. package/node_modules/@types/node/LICENSE +0 -21
  75. package/node_modules/@types/node/README.md +0 -15
  76. package/node_modules/@types/node/assert/strict.d.ts +0 -8
  77. package/node_modules/@types/node/assert.d.ts +0 -1040
  78. package/node_modules/@types/node/async_hooks.d.ts +0 -541
  79. package/node_modules/@types/node/buffer.d.ts +0 -2363
  80. package/node_modules/@types/node/child_process.d.ts +0 -1544
  81. package/node_modules/@types/node/cluster.d.ts +0 -578
  82. package/node_modules/@types/node/console.d.ts +0 -452
  83. package/node_modules/@types/node/constants.d.ts +0 -19
  84. package/node_modules/@types/node/crypto.d.ts +0 -4523
  85. package/node_modules/@types/node/dgram.d.ts +0 -596
  86. package/node_modules/@types/node/diagnostics_channel.d.ts +0 -554
  87. package/node_modules/@types/node/dns/promises.d.ts +0 -476
  88. package/node_modules/@types/node/dns.d.ts +0 -864
  89. package/node_modules/@types/node/dom-events.d.ts +0 -124
  90. package/node_modules/@types/node/domain.d.ts +0 -170
  91. package/node_modules/@types/node/events.d.ts +0 -931
  92. package/node_modules/@types/node/fs/promises.d.ts +0 -1245
  93. package/node_modules/@types/node/fs.d.ts +0 -4317
  94. package/node_modules/@types/node/globals.d.ts +0 -412
  95. package/node_modules/@types/node/globals.global.d.ts +0 -1
  96. package/node_modules/@types/node/http.d.ts +0 -1908
  97. package/node_modules/@types/node/http2.d.ts +0 -2418
  98. package/node_modules/@types/node/https.d.ts +0 -550
  99. package/node_modules/@types/node/index.d.ts +0 -89
  100. package/node_modules/@types/node/inspector.d.ts +0 -2746
  101. package/node_modules/@types/node/module.d.ts +0 -315
  102. package/node_modules/@types/node/net.d.ts +0 -999
  103. package/node_modules/@types/node/os.d.ts +0 -495
  104. package/node_modules/@types/node/package.json +0 -217
  105. package/node_modules/@types/node/path.d.ts +0 -191
  106. package/node_modules/@types/node/perf_hooks.d.ts +0 -905
  107. package/node_modules/@types/node/process.d.ts +0 -1754
  108. package/node_modules/@types/node/punycode.d.ts +0 -117
  109. package/node_modules/@types/node/querystring.d.ts +0 -153
  110. package/node_modules/@types/node/readline/promises.d.ts +0 -150
  111. package/node_modules/@types/node/readline.d.ts +0 -540
  112. package/node_modules/@types/node/repl.d.ts +0 -430
  113. package/node_modules/@types/node/sea.d.ts +0 -153
  114. package/node_modules/@types/node/stream/consumers.d.ts +0 -12
  115. package/node_modules/@types/node/stream/promises.d.ts +0 -83
  116. package/node_modules/@types/node/stream/web.d.ts +0 -367
  117. package/node_modules/@types/node/stream.d.ts +0 -1707
  118. package/node_modules/@types/node/string_decoder.d.ts +0 -67
  119. package/node_modules/@types/node/test.d.ts +0 -1729
  120. package/node_modules/@types/node/timers/promises.d.ts +0 -97
  121. package/node_modules/@types/node/timers.d.ts +0 -240
  122. package/node_modules/@types/node/tls.d.ts +0 -1217
  123. package/node_modules/@types/node/trace_events.d.ts +0 -197
  124. package/node_modules/@types/node/tty.d.ts +0 -208
  125. package/node_modules/@types/node/url.d.ts +0 -952
  126. package/node_modules/@types/node/util.d.ts +0 -2292
  127. package/node_modules/@types/node/v8.d.ts +0 -808
  128. package/node_modules/@types/node/vm.d.ts +0 -924
  129. package/node_modules/@types/node/wasi.d.ts +0 -181
  130. package/node_modules/@types/node/worker_threads.d.ts +0 -694
  131. package/node_modules/@types/node/zlib.d.ts +0 -530
  132. package/node_modules/case-anything/LICENSE +0 -21
  133. package/node_modules/case-anything/README.md +0 -259
  134. package/node_modules/case-anything/dist/cjs/index.cjs +0 -133
  135. package/node_modules/case-anything/dist/cjs/index.d.cts +0 -230
  136. package/node_modules/case-anything/dist/index.d.ts +0 -230
  137. package/node_modules/case-anything/dist/index.js +0 -117
  138. package/node_modules/case-anything/package.json +0 -114
  139. package/node_modules/detect-libc/.npmignore +0 -7
  140. package/node_modules/detect-libc/LICENSE +0 -201
  141. package/node_modules/detect-libc/README.md +0 -78
  142. package/node_modules/detect-libc/bin/detect-libc.js +0 -18
  143. package/node_modules/detect-libc/lib/detect-libc.js +0 -92
  144. package/node_modules/detect-libc/package.json +0 -35
  145. package/node_modules/dprint-node/LICENSE +0 -21
  146. package/node_modules/dprint-node/README.md +0 -29
  147. package/node_modules/dprint-node/dprint-node.darwin-arm64.node +0 -0
  148. package/node_modules/dprint-node/dprint-node.darwin-x64.node +0 -0
  149. package/node_modules/dprint-node/dprint-node.linux-arm64-gnu.node +0 -0
  150. package/node_modules/dprint-node/dprint-node.linux-arm64-musl.node +0 -0
  151. package/node_modules/dprint-node/dprint-node.linux-x64-gnu.node +0 -0
  152. package/node_modules/dprint-node/dprint-node.linux-x64-musl.node +0 -0
  153. package/node_modules/dprint-node/dprint-node.win32-x64-msvc.node +0 -0
  154. package/node_modules/dprint-node/index.d.ts +0 -3
  155. package/node_modules/dprint-node/index.js +0 -15
  156. package/node_modules/dprint-node/options.d.ts +0 -477
  157. package/node_modules/dprint-node/package.json +0 -29
  158. package/node_modules/long/LICENSE +0 -202
  159. package/node_modules/long/README.md +0 -280
  160. package/node_modules/long/index.d.ts +0 -457
  161. package/node_modules/long/index.js +0 -1467
  162. package/node_modules/long/package.json +0 -50
  163. package/node_modules/long/umd/index.d.ts +0 -2
  164. package/node_modules/long/umd/index.js +0 -1432
  165. package/node_modules/long/umd/package.json +0 -3
  166. package/node_modules/protobufjs/LICENSE +0 -39
  167. package/node_modules/protobufjs/README.md +0 -727
  168. package/node_modules/protobufjs/dist/light/protobuf.js +0 -7381
  169. package/node_modules/protobufjs/dist/light/protobuf.js.map +0 -1
  170. package/node_modules/protobufjs/dist/light/protobuf.min.js +0 -8
  171. package/node_modules/protobufjs/dist/light/protobuf.min.js.map +0 -1
  172. package/node_modules/protobufjs/dist/minimal/protobuf.js +0 -2736
  173. package/node_modules/protobufjs/dist/minimal/protobuf.js.map +0 -1
  174. package/node_modules/protobufjs/dist/minimal/protobuf.min.js +0 -8
  175. package/node_modules/protobufjs/dist/minimal/protobuf.min.js.map +0 -1
  176. package/node_modules/protobufjs/dist/protobuf.js +0 -9105
  177. package/node_modules/protobufjs/dist/protobuf.js.map +0 -1
  178. package/node_modules/protobufjs/dist/protobuf.min.js +0 -8
  179. package/node_modules/protobufjs/dist/protobuf.min.js.map +0 -1
  180. package/node_modules/protobufjs/ext/debug/README.md +0 -4
  181. package/node_modules/protobufjs/ext/debug/index.js +0 -71
  182. package/node_modules/protobufjs/ext/descriptor/README.md +0 -72
  183. package/node_modules/protobufjs/ext/descriptor/index.d.ts +0 -191
  184. package/node_modules/protobufjs/ext/descriptor/index.js +0 -1052
  185. package/node_modules/protobufjs/ext/descriptor/test.js +0 -54
  186. package/node_modules/protobufjs/google/LICENSE +0 -27
  187. package/node_modules/protobufjs/google/README.md +0 -1
  188. package/node_modules/protobufjs/google/api/annotations.json +0 -83
  189. package/node_modules/protobufjs/google/api/annotations.proto +0 -11
  190. package/node_modules/protobufjs/google/api/http.json +0 -86
  191. package/node_modules/protobufjs/google/api/http.proto +0 -31
  192. package/node_modules/protobufjs/google/protobuf/api.json +0 -118
  193. package/node_modules/protobufjs/google/protobuf/api.proto +0 -34
  194. package/node_modules/protobufjs/google/protobuf/descriptor.json +0 -739
  195. package/node_modules/protobufjs/google/protobuf/descriptor.proto +0 -286
  196. package/node_modules/protobufjs/google/protobuf/source_context.json +0 -20
  197. package/node_modules/protobufjs/google/protobuf/source_context.proto +0 -7
  198. package/node_modules/protobufjs/google/protobuf/type.json +0 -202
  199. package/node_modules/protobufjs/google/protobuf/type.proto +0 -89
  200. package/node_modules/protobufjs/index.d.ts +0 -2741
  201. package/node_modules/protobufjs/index.js +0 -4
  202. package/node_modules/protobufjs/light.d.ts +0 -2
  203. package/node_modules/protobufjs/light.js +0 -4
  204. package/node_modules/protobufjs/minimal.d.ts +0 -2
  205. package/node_modules/protobufjs/minimal.js +0 -4
  206. package/node_modules/protobufjs/package.json +0 -111
  207. package/node_modules/protobufjs/scripts/postinstall.js +0 -32
  208. package/node_modules/protobufjs/src/common.js +0 -399
  209. package/node_modules/protobufjs/src/converter.js +0 -301
  210. package/node_modules/protobufjs/src/decoder.js +0 -129
  211. package/node_modules/protobufjs/src/encoder.js +0 -100
  212. package/node_modules/protobufjs/src/enum.js +0 -198
  213. package/node_modules/protobufjs/src/field.js +0 -377
  214. package/node_modules/protobufjs/src/index-light.js +0 -104
  215. package/node_modules/protobufjs/src/index-minimal.js +0 -36
  216. package/node_modules/protobufjs/src/index.js +0 -12
  217. package/node_modules/protobufjs/src/mapfield.js +0 -126
  218. package/node_modules/protobufjs/src/message.js +0 -139
  219. package/node_modules/protobufjs/src/method.js +0 -160
  220. package/node_modules/protobufjs/src/namespace.js +0 -433
  221. package/node_modules/protobufjs/src/object.js +0 -243
  222. package/node_modules/protobufjs/src/oneof.js +0 -203
  223. package/node_modules/protobufjs/src/parse.js +0 -889
  224. package/node_modules/protobufjs/src/reader.js +0 -416
  225. package/node_modules/protobufjs/src/reader_buffer.js +0 -51
  226. package/node_modules/protobufjs/src/root.js +0 -368
  227. package/node_modules/protobufjs/src/roots.js +0 -18
  228. package/node_modules/protobufjs/src/rpc/service.js +0 -142
  229. package/node_modules/protobufjs/src/rpc.js +0 -36
  230. package/node_modules/protobufjs/src/service.js +0 -167
  231. package/node_modules/protobufjs/src/tokenize.js +0 -416
  232. package/node_modules/protobufjs/src/type.js +0 -589
  233. package/node_modules/protobufjs/src/types.js +0 -196
  234. package/node_modules/protobufjs/src/typescript.jsdoc +0 -15
  235. package/node_modules/protobufjs/src/util/longbits.js +0 -200
  236. package/node_modules/protobufjs/src/util/minimal.js +0 -438
  237. package/node_modules/protobufjs/src/util.js +0 -212
  238. package/node_modules/protobufjs/src/verifier.js +0 -177
  239. package/node_modules/protobufjs/src/wrappers.js +0 -102
  240. package/node_modules/protobufjs/src/writer.js +0 -465
  241. package/node_modules/protobufjs/src/writer_buffer.js +0 -85
  242. package/node_modules/protobufjs/tsconfig.json +0 -8
  243. package/node_modules/ts-poet/.eslintrc.js +0 -12
  244. package/node_modules/ts-poet/.nvmrc +0 -1
  245. package/node_modules/ts-poet/.prettierrc +0 -3
  246. package/node_modules/ts-poet/LICENSE.txt +0 -204
  247. package/node_modules/ts-poet/README.md +0 -236
  248. package/node_modules/ts-poet/bench.js +0 -4
  249. package/node_modules/ts-poet/build/Code.d.ts +0 -64
  250. package/node_modules/ts-poet/build/Code.js +0 -255
  251. package/node_modules/ts-poet/build/ConditionalOutput.d.ts +0 -46
  252. package/node_modules/ts-poet/build/ConditionalOutput.js +0 -62
  253. package/node_modules/ts-poet/build/Import.d.ts +0 -161
  254. package/node_modules/ts-poet/build/Import.js +0 -358
  255. package/node_modules/ts-poet/build/Literal.d.ts +0 -11
  256. package/node_modules/ts-poet/build/Literal.js +0 -63
  257. package/node_modules/ts-poet/build/Node.d.ts +0 -7
  258. package/node_modules/ts-poet/build/Node.js +0 -6
  259. package/node_modules/ts-poet/build/index.d.ts +0 -23
  260. package/node_modules/ts-poet/build/index.js +0 -66
  261. package/node_modules/ts-poet/build/is-plain-object.d.ts +0 -7
  262. package/node_modules/ts-poet/build/is-plain-object.js +0 -31
  263. package/node_modules/ts-poet/build/saveFiles.d.ts +0 -25
  264. package/node_modules/ts-poet/build/saveFiles.js +0 -81
  265. package/node_modules/ts-poet/build/utils.d.ts +0 -2
  266. package/node_modules/ts-poet/build/utils.js +0 -18
  267. package/node_modules/ts-poet/jest.config.js +0 -9
  268. package/node_modules/ts-poet/package.json +0 -34
  269. package/node_modules/ts-proto/LICENSE +0 -201
  270. package/node_modules/ts-proto/README.markdown +0 -1080
  271. package/node_modules/ts-proto/build/case.d.ts +0 -8
  272. package/node_modules/ts-proto/build/case.js +0 -52
  273. package/node_modules/ts-proto/build/context.d.ts +0 -19
  274. package/node_modules/ts-proto/build/context.js +0 -7
  275. package/node_modules/ts-proto/build/encode.d.ts +0 -4
  276. package/node_modules/ts-proto/build/encode.js +0 -78
  277. package/node_modules/ts-proto/build/enums.d.ts +0 -19
  278. package/node_modules/ts-proto/build/enums.js +0 -220
  279. package/node_modules/ts-proto/build/generate-async-iterable.d.ts +0 -6
  280. package/node_modules/ts-proto/build/generate-async-iterable.js +0 -46
  281. package/node_modules/ts-proto/build/generate-generic-service-definition.d.ts +0 -8
  282. package/node_modules/ts-proto/build/generate-generic-service-definition.js +0 -86
  283. package/node_modules/ts-proto/build/generate-grpc-js.d.ts +0 -9
  284. package/node_modules/ts-proto/build/generate-grpc-js.js +0 -204
  285. package/node_modules/ts-proto/build/generate-grpc-web.d.ts +0 -17
  286. package/node_modules/ts-proto/build/generate-grpc-web.js +0 -366
  287. package/node_modules/ts-proto/build/generate-nestjs.d.ts +0 -7
  288. package/node_modules/ts-proto/build/generate-nestjs.js +0 -156
  289. package/node_modules/ts-proto/build/generate-nice-grpc.d.ts +0 -8
  290. package/node_modules/ts-proto/build/generate-nice-grpc.js +0 -134
  291. package/node_modules/ts-proto/build/generate-services.d.ts +0 -31
  292. package/node_modules/ts-proto/build/generate-services.js +0 -397
  293. package/node_modules/ts-proto/build/generate-struct-wrappers.d.ts +0 -36
  294. package/node_modules/ts-proto/build/generate-struct-wrappers.js +0 -361
  295. package/node_modules/ts-proto/build/generate-type-registry.d.ts +0 -3
  296. package/node_modules/ts-proto/build/generate-type-registry.js +0 -51
  297. package/node_modules/ts-proto/build/index.d.ts +0 -1
  298. package/node_modules/ts-proto/build/index.js +0 -10
  299. package/node_modules/ts-proto/build/main.d.ts +0 -54
  300. package/node_modules/ts-proto/build/main.js +0 -2248
  301. package/node_modules/ts-proto/build/options.d.ts +0 -108
  302. package/node_modules/ts-proto/build/options.js +0 -280
  303. package/node_modules/ts-proto/build/plugin.d.ts +0 -1
  304. package/node_modules/ts-proto/build/plugin.js +0 -80
  305. package/node_modules/ts-proto/build/schema.d.ts +0 -5
  306. package/node_modules/ts-proto/build/schema.js +0 -259
  307. package/node_modules/ts-proto/build/sourceInfo.d.ts +0 -78
  308. package/node_modules/ts-proto/build/sourceInfo.js +0 -106
  309. package/node_modules/ts-proto/build/types.d.ts +0 -105
  310. package/node_modules/ts-proto/build/types.js +0 -801
  311. package/node_modules/ts-proto/build/utils.d.ts +0 -84
  312. package/node_modules/ts-proto/build/utils.js +0 -303
  313. package/node_modules/ts-proto/build/visit.d.ts +0 -8
  314. package/node_modules/ts-proto/build/visit.js +0 -45
  315. package/node_modules/ts-proto/package.json +0 -74
  316. package/node_modules/ts-proto/protoc-gen-ts_proto +0 -2
  317. package/node_modules/ts-proto-descriptors/dist/google/protobuf/compiler/plugin.d.ts +0 -185
  318. package/node_modules/ts-proto-descriptors/dist/google/protobuf/compiler/plugin.js +0 -526
  319. package/node_modules/ts-proto-descriptors/dist/google/protobuf/descriptor.d.ts +0 -1155
  320. package/node_modules/ts-proto-descriptors/dist/google/protobuf/descriptor.js +0 -4371
  321. package/node_modules/ts-proto-descriptors/dist/index.d.ts +0 -2
  322. package/node_modules/ts-proto-descriptors/dist/index.js +0 -18
  323. package/node_modules/ts-proto-descriptors/package.json +0 -22
  324. package/node_modules/undici-types/README.md +0 -6
  325. package/node_modules/undici-types/agent.d.ts +0 -31
  326. package/node_modules/undici-types/api.d.ts +0 -43
  327. package/node_modules/undici-types/balanced-pool.d.ts +0 -18
  328. package/node_modules/undici-types/cache.d.ts +0 -36
  329. package/node_modules/undici-types/client.d.ts +0 -97
  330. package/node_modules/undici-types/connector.d.ts +0 -34
  331. package/node_modules/undici-types/content-type.d.ts +0 -21
  332. package/node_modules/undici-types/cookies.d.ts +0 -28
  333. package/node_modules/undici-types/diagnostics-channel.d.ts +0 -67
  334. package/node_modules/undici-types/dispatcher.d.ts +0 -241
  335. package/node_modules/undici-types/errors.d.ts +0 -128
  336. package/node_modules/undici-types/fetch.d.ts +0 -209
  337. package/node_modules/undici-types/file.d.ts +0 -39
  338. package/node_modules/undici-types/filereader.d.ts +0 -54
  339. package/node_modules/undici-types/formdata.d.ts +0 -108
  340. package/node_modules/undici-types/global-dispatcher.d.ts +0 -9
  341. package/node_modules/undici-types/global-origin.d.ts +0 -7
  342. package/node_modules/undici-types/handlers.d.ts +0 -9
  343. package/node_modules/undici-types/header.d.ts +0 -4
  344. package/node_modules/undici-types/index.d.ts +0 -63
  345. package/node_modules/undici-types/interceptors.d.ts +0 -5
  346. package/node_modules/undici-types/mock-agent.d.ts +0 -50
  347. package/node_modules/undici-types/mock-client.d.ts +0 -25
  348. package/node_modules/undici-types/mock-errors.d.ts +0 -12
  349. package/node_modules/undici-types/mock-interceptor.d.ts +0 -93
  350. package/node_modules/undici-types/mock-pool.d.ts +0 -25
  351. package/node_modules/undici-types/package.json +0 -55
  352. package/node_modules/undici-types/patch.d.ts +0 -71
  353. package/node_modules/undici-types/pool-stats.d.ts +0 -19
  354. package/node_modules/undici-types/pool.d.ts +0 -28
  355. package/node_modules/undici-types/proxy-agent.d.ts +0 -30
  356. package/node_modules/undici-types/readable.d.ts +0 -61
  357. package/node_modules/undici-types/webidl.d.ts +0 -220
  358. package/node_modules/undici-types/websocket.d.ts +0 -131
@@ -1,49 +0,0 @@
1
- @protobufjs/codegen
2
- ===================
3
- [![npm](https://img.shields.io/npm/v/@protobufjs/codegen.svg)](https://www.npmjs.com/package/@protobufjs/codegen)
4
-
5
- A minimalistic code generation utility.
6
-
7
- API
8
- ---
9
-
10
- * **codegen([functionParams: `string[]`], [functionName: string]): `Codegen`**<br />
11
- Begins generating a function.
12
-
13
- * **codegen.verbose = `false`**<br />
14
- When set to true, codegen will log generated code to console. Useful for debugging.
15
-
16
- Invoking **codegen** returns an appender function that appends code to the function's body and returns itself:
17
-
18
- * **Codegen(formatString: `string`, [...formatParams: `any`]): Codegen**<br />
19
- Appends code to the function's body. The format string can contain placeholders specifying the types of inserted format parameters:
20
-
21
- * `%d`: Number (integer or floating point value)
22
- * `%f`: Floating point value
23
- * `%i`: Integer value
24
- * `%j`: JSON.stringify'ed value
25
- * `%s`: String value
26
- * `%%`: Percent sign<br />
27
-
28
- * **Codegen([scope: `Object.<string,*>`]): `Function`**<br />
29
- Finishes the function and returns it.
30
-
31
- * **Codegen.toString([functionNameOverride: `string`]): `string`**<br />
32
- Returns the function as a string.
33
-
34
- Example
35
- -------
36
-
37
- ```js
38
- var codegen = require("@protobufjs/codegen");
39
-
40
- var add = codegen(["a", "b"], "add") // A function with parameters "a" and "b" named "add"
41
- ("// awesome comment") // adds the line to the function's body
42
- ("return a + b - c + %d", 1) // replaces %d with 1 and adds the line to the body
43
- ({ c: 1 }); // adds "c" with a value of 1 to the function's scope
44
-
45
- console.log(add.toString()); // function add(a, b) { return a + b - c + 1 }
46
- console.log(add(1, 2)); // calculates 1 + 2 - 1 + 1 = 3
47
- ```
48
-
49
- **License:** [BSD 3-Clause License](https://opensource.org/licenses/BSD-3-Clause)
@@ -1,31 +0,0 @@
1
- export = codegen;
2
-
3
- /**
4
- * Appends code to the function's body.
5
- * @param [formatStringOrScope] Format string or, to finish the function, an object of additional scope variables, if any
6
- * @param [formatParams] Format parameters
7
- * @returns Itself or the generated function if finished
8
- * @throws {Error} If format parameter counts do not match
9
- */
10
- type Codegen = (formatStringOrScope?: (string|{ [k: string]: any }), ...formatParams: any[]) => (Codegen|Function);
11
-
12
- /**
13
- * Begins generating a function.
14
- * @param functionParams Function parameter names
15
- * @param [functionName] Function name if not anonymous
16
- * @returns Appender that appends code to the function's body
17
- */
18
- declare function codegen(functionParams: string[], functionName?: string): Codegen;
19
-
20
- /**
21
- * Begins generating a function.
22
- * @param [functionName] Function name if not anonymous
23
- * @returns Appender that appends code to the function's body
24
- */
25
- declare function codegen(functionName?: string): Codegen;
26
-
27
- declare namespace codegen {
28
-
29
- /** When set to `true`, codegen will log generated code to console. Useful for debugging. */
30
- let verbose: boolean;
31
- }
@@ -1,99 +0,0 @@
1
- "use strict";
2
- module.exports = codegen;
3
-
4
- /**
5
- * Begins generating a function.
6
- * @memberof util
7
- * @param {string[]} functionParams Function parameter names
8
- * @param {string} [functionName] Function name if not anonymous
9
- * @returns {Codegen} Appender that appends code to the function's body
10
- */
11
- function codegen(functionParams, functionName) {
12
-
13
- /* istanbul ignore if */
14
- if (typeof functionParams === "string") {
15
- functionName = functionParams;
16
- functionParams = undefined;
17
- }
18
-
19
- var body = [];
20
-
21
- /**
22
- * Appends code to the function's body or finishes generation.
23
- * @typedef Codegen
24
- * @type {function}
25
- * @param {string|Object.<string,*>} [formatStringOrScope] Format string or, to finish the function, an object of additional scope variables, if any
26
- * @param {...*} [formatParams] Format parameters
27
- * @returns {Codegen|Function} Itself or the generated function if finished
28
- * @throws {Error} If format parameter counts do not match
29
- */
30
-
31
- function Codegen(formatStringOrScope) {
32
- // note that explicit array handling below makes this ~50% faster
33
-
34
- // finish the function
35
- if (typeof formatStringOrScope !== "string") {
36
- var source = toString();
37
- if (codegen.verbose)
38
- console.log("codegen: " + source); // eslint-disable-line no-console
39
- source = "return " + source;
40
- if (formatStringOrScope) {
41
- var scopeKeys = Object.keys(formatStringOrScope),
42
- scopeParams = new Array(scopeKeys.length + 1),
43
- scopeValues = new Array(scopeKeys.length),
44
- scopeOffset = 0;
45
- while (scopeOffset < scopeKeys.length) {
46
- scopeParams[scopeOffset] = scopeKeys[scopeOffset];
47
- scopeValues[scopeOffset] = formatStringOrScope[scopeKeys[scopeOffset++]];
48
- }
49
- scopeParams[scopeOffset] = source;
50
- return Function.apply(null, scopeParams).apply(null, scopeValues); // eslint-disable-line no-new-func
51
- }
52
- return Function(source)(); // eslint-disable-line no-new-func
53
- }
54
-
55
- // otherwise append to body
56
- var formatParams = new Array(arguments.length - 1),
57
- formatOffset = 0;
58
- while (formatOffset < formatParams.length)
59
- formatParams[formatOffset] = arguments[++formatOffset];
60
- formatOffset = 0;
61
- formatStringOrScope = formatStringOrScope.replace(/%([%dfijs])/g, function replace($0, $1) {
62
- var value = formatParams[formatOffset++];
63
- switch ($1) {
64
- case "d": case "f": return String(Number(value));
65
- case "i": return String(Math.floor(value));
66
- case "j": return JSON.stringify(value);
67
- case "s": return String(value);
68
- }
69
- return "%";
70
- });
71
- if (formatOffset !== formatParams.length)
72
- throw Error("parameter count mismatch");
73
- body.push(formatStringOrScope);
74
- return Codegen;
75
- }
76
-
77
- function toString(functionNameOverride) {
78
- return "function " + (functionNameOverride || functionName || "") + "(" + (functionParams && functionParams.join(",") || "") + "){\n " + body.join("\n ") + "\n}";
79
- }
80
-
81
- Codegen.toString = toString;
82
- return Codegen;
83
- }
84
-
85
- /**
86
- * Begins generating a function.
87
- * @memberof util
88
- * @function codegen
89
- * @param {string} [functionName] Function name if not anonymous
90
- * @returns {Codegen} Appender that appends code to the function's body
91
- * @variation 2
92
- */
93
-
94
- /**
95
- * When set to `true`, codegen will log generated code to console. Useful for debugging.
96
- * @name util.codegen.verbose
97
- * @type {boolean}
98
- */
99
- codegen.verbose = false;
@@ -1,13 +0,0 @@
1
- {
2
- "name": "@protobufjs/codegen",
3
- "description": "A minimalistic code generation utility.",
4
- "version": "2.0.4",
5
- "author": "Daniel Wirtz <dcode+protobufjs@dcode.io>",
6
- "repository": {
7
- "type": "git",
8
- "url": "https://github.com/dcodeIO/protobuf.js.git"
9
- },
10
- "license": "BSD-3-Clause",
11
- "main": "index.js",
12
- "types": "index.d.ts"
13
- }
@@ -1,13 +0,0 @@
1
- var codegen = require("..");
2
-
3
- // new require("benchmark").Suite().add("add", function() {
4
-
5
- var add = codegen(["a", "b"], "add")
6
- ("// awesome comment")
7
- ("return a + b - c + %d", 1)
8
- ({ c: 1 });
9
-
10
- if (add(1, 2) !== 3)
11
- throw Error("failed");
12
-
13
- // }).on("cycle", function(event) { process.stdout.write(String(event.target) + "\n"); }).run();
@@ -1,26 +0,0 @@
1
- Copyright (c) 2016, Daniel Wirtz All rights reserved.
2
-
3
- Redistribution and use in source and binary forms, with or without
4
- modification, are permitted provided that the following conditions are
5
- met:
6
-
7
- * Redistributions of source code must retain the above copyright
8
- notice, this list of conditions and the following disclaimer.
9
- * Redistributions in binary form must reproduce the above copyright
10
- notice, this list of conditions and the following disclaimer in the
11
- documentation and/or other materials provided with the distribution.
12
- * Neither the name of its author, nor the names of its contributors
13
- may be used to endorse or promote products derived from this software
14
- without specific prior written permission.
15
-
16
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20
- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -1,22 +0,0 @@
1
- @protobufjs/eventemitter
2
- ========================
3
- [![npm](https://img.shields.io/npm/v/@protobufjs/eventemitter.svg)](https://www.npmjs.com/package/@protobufjs/eventemitter)
4
-
5
- A minimal event emitter.
6
-
7
- API
8
- ---
9
-
10
- * **new EventEmitter()**<br />
11
- Constructs a new event emitter instance.
12
-
13
- * **EventEmitter#on(evt: `string`, fn: `function`, [ctx: `Object`]): `EventEmitter`**<br />
14
- Registers an event listener.
15
-
16
- * **EventEmitter#off([evt: `string`], [fn: `function`]): `EventEmitter`**<br />
17
- Removes an event listener or any matching listeners if arguments are omitted.
18
-
19
- * **EventEmitter#emit(evt: `string`, ...args: `*`): `EventEmitter`**<br />
20
- Emits an event by calling its listeners with the specified arguments.
21
-
22
- **License:** [BSD 3-Clause License](https://opensource.org/licenses/BSD-3-Clause)
@@ -1,43 +0,0 @@
1
- export = EventEmitter;
2
-
3
- /**
4
- * Constructs a new event emitter instance.
5
- * @classdesc A minimal event emitter.
6
- * @memberof util
7
- * @constructor
8
- */
9
- declare class EventEmitter {
10
-
11
- /**
12
- * Constructs a new event emitter instance.
13
- * @classdesc A minimal event emitter.
14
- * @memberof util
15
- * @constructor
16
- */
17
- constructor();
18
-
19
- /**
20
- * Registers an event listener.
21
- * @param {string} evt Event name
22
- * @param {function} fn Listener
23
- * @param {*} [ctx] Listener context
24
- * @returns {util.EventEmitter} `this`
25
- */
26
- on(evt: string, fn: () => any, ctx?: any): EventEmitter;
27
-
28
- /**
29
- * Removes an event listener or any matching listeners if arguments are omitted.
30
- * @param {string} [evt] Event name. Removes all listeners if omitted.
31
- * @param {function} [fn] Listener to remove. Removes all listeners of `evt` if omitted.
32
- * @returns {util.EventEmitter} `this`
33
- */
34
- off(evt?: string, fn?: () => any): EventEmitter;
35
-
36
- /**
37
- * Emits an event by calling its listeners with the specified arguments.
38
- * @param {string} evt Event name
39
- * @param {...*} args Arguments
40
- * @returns {util.EventEmitter} `this`
41
- */
42
- emit(evt: string, ...args: any[]): EventEmitter;
43
- }
@@ -1,76 +0,0 @@
1
- "use strict";
2
- module.exports = EventEmitter;
3
-
4
- /**
5
- * Constructs a new event emitter instance.
6
- * @classdesc A minimal event emitter.
7
- * @memberof util
8
- * @constructor
9
- */
10
- function EventEmitter() {
11
-
12
- /**
13
- * Registered listeners.
14
- * @type {Object.<string,*>}
15
- * @private
16
- */
17
- this._listeners = {};
18
- }
19
-
20
- /**
21
- * Registers an event listener.
22
- * @param {string} evt Event name
23
- * @param {function} fn Listener
24
- * @param {*} [ctx] Listener context
25
- * @returns {util.EventEmitter} `this`
26
- */
27
- EventEmitter.prototype.on = function on(evt, fn, ctx) {
28
- (this._listeners[evt] || (this._listeners[evt] = [])).push({
29
- fn : fn,
30
- ctx : ctx || this
31
- });
32
- return this;
33
- };
34
-
35
- /**
36
- * Removes an event listener or any matching listeners if arguments are omitted.
37
- * @param {string} [evt] Event name. Removes all listeners if omitted.
38
- * @param {function} [fn] Listener to remove. Removes all listeners of `evt` if omitted.
39
- * @returns {util.EventEmitter} `this`
40
- */
41
- EventEmitter.prototype.off = function off(evt, fn) {
42
- if (evt === undefined)
43
- this._listeners = {};
44
- else {
45
- if (fn === undefined)
46
- this._listeners[evt] = [];
47
- else {
48
- var listeners = this._listeners[evt];
49
- for (var i = 0; i < listeners.length;)
50
- if (listeners[i].fn === fn)
51
- listeners.splice(i, 1);
52
- else
53
- ++i;
54
- }
55
- }
56
- return this;
57
- };
58
-
59
- /**
60
- * Emits an event by calling its listeners with the specified arguments.
61
- * @param {string} evt Event name
62
- * @param {...*} args Arguments
63
- * @returns {util.EventEmitter} `this`
64
- */
65
- EventEmitter.prototype.emit = function emit(evt) {
66
- var listeners = this._listeners[evt];
67
- if (listeners) {
68
- var args = [],
69
- i = 1;
70
- for (; i < arguments.length;)
71
- args.push(arguments[i++]);
72
- for (i = 0; i < listeners.length;)
73
- listeners[i].fn.apply(listeners[i++].ctx, args);
74
- }
75
- return this;
76
- };
@@ -1,21 +0,0 @@
1
- {
2
- "name": "@protobufjs/eventemitter",
3
- "description": "A minimal event emitter.",
4
- "version": "1.1.0",
5
- "author": "Daniel Wirtz <dcode+protobufjs@dcode.io>",
6
- "repository": {
7
- "type": "git",
8
- "url": "https://github.com/dcodeIO/protobuf.js.git"
9
- },
10
- "license": "BSD-3-Clause",
11
- "main": "index.js",
12
- "types": "index.d.ts",
13
- "devDependencies": {
14
- "istanbul": "^0.4.5",
15
- "tape": "^4.6.3"
16
- },
17
- "scripts": {
18
- "test": "tape tests/*.js",
19
- "coverage": "istanbul cover node_modules/tape/bin/tape tests/*.js"
20
- }
21
- }
@@ -1,47 +0,0 @@
1
- var tape = require("tape");
2
-
3
- var EventEmitter = require("..");
4
-
5
- tape.test("eventemitter", function(test) {
6
-
7
- var ee = new EventEmitter();
8
- var fn;
9
- var ctx = {};
10
-
11
- test.doesNotThrow(function() {
12
- ee.emit("a", 1);
13
- ee.off();
14
- ee.off("a");
15
- ee.off("a", function() {});
16
- }, "should not throw if no listeners are registered");
17
-
18
- test.equal(ee.on("a", function(arg1) {
19
- test.equal(this, ctx, "should be called with this = ctx");
20
- test.equal(arg1, 1, "should be called with arg1 = 1");
21
- }, ctx), ee, "should return itself when registering events");
22
- ee.emit("a", 1);
23
-
24
- ee.off("a");
25
- test.same(ee._listeners, { a: [] }, "should remove all listeners of the respective event when calling off(evt)");
26
-
27
- ee.off();
28
- test.same(ee._listeners, {}, "should remove all listeners when just calling off()");
29
-
30
- ee.on("a", fn = function(arg1) {
31
- test.equal(this, ctx, "should be called with this = ctx");
32
- test.equal(arg1, 1, "should be called with arg1 = 1");
33
- }, ctx).emit("a", 1);
34
-
35
- ee.off("a", fn);
36
- test.same(ee._listeners, { a: [] }, "should remove the exact listener when calling off(evt, fn)");
37
-
38
- ee.on("a", function() {
39
- test.equal(this, ee, "should be called with this = ee");
40
- }).emit("a");
41
-
42
- test.doesNotThrow(function() {
43
- ee.off("a", fn);
44
- }, "should not throw if no such listener is found");
45
-
46
- test.end();
47
- });
@@ -1,26 +0,0 @@
1
- Copyright (c) 2016, Daniel Wirtz All rights reserved.
2
-
3
- Redistribution and use in source and binary forms, with or without
4
- modification, are permitted provided that the following conditions are
5
- met:
6
-
7
- * Redistributions of source code must retain the above copyright
8
- notice, this list of conditions and the following disclaimer.
9
- * Redistributions in binary form must reproduce the above copyright
10
- notice, this list of conditions and the following disclaimer in the
11
- documentation and/or other materials provided with the distribution.
12
- * Neither the name of its author, nor the names of its contributors
13
- may be used to endorse or promote products derived from this software
14
- without specific prior written permission.
15
-
16
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20
- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -1,13 +0,0 @@
1
- @protobufjs/fetch
2
- =================
3
- [![npm](https://img.shields.io/npm/v/@protobufjs/fetch.svg)](https://www.npmjs.com/package/@protobufjs/fetch)
4
-
5
- Fetches the contents of a file accross node and browsers.
6
-
7
- API
8
- ---
9
-
10
- * **fetch(path: `string`, [options: { binary: boolean } ], [callback: `function(error: ?Error, [contents: string])`]): `Promise<string|Uint8Array>|undefined`**
11
- Fetches the contents of a file.
12
-
13
- **License:** [BSD 3-Clause License](https://opensource.org/licenses/BSD-3-Clause)
@@ -1,56 +0,0 @@
1
- export = fetch;
2
-
3
- /**
4
- * Node-style callback as used by {@link util.fetch}.
5
- * @typedef FetchCallback
6
- * @type {function}
7
- * @param {?Error} error Error, if any, otherwise `null`
8
- * @param {string} [contents] File contents, if there hasn't been an error
9
- * @returns {undefined}
10
- */
11
- type FetchCallback = (error: Error, contents?: string) => void;
12
-
13
- /**
14
- * Options as used by {@link util.fetch}.
15
- * @typedef FetchOptions
16
- * @type {Object}
17
- * @property {boolean} [binary=false] Whether expecting a binary response
18
- * @property {boolean} [xhr=false] If `true`, forces the use of XMLHttpRequest
19
- */
20
-
21
- interface FetchOptions {
22
- binary?: boolean;
23
- xhr?: boolean
24
- }
25
-
26
- /**
27
- * Fetches the contents of a file.
28
- * @memberof util
29
- * @param {string} filename File path or url
30
- * @param {FetchOptions} options Fetch options
31
- * @param {FetchCallback} callback Callback function
32
- * @returns {undefined}
33
- */
34
- declare function fetch(filename: string, options: FetchOptions, callback: FetchCallback): void;
35
-
36
- /**
37
- * Fetches the contents of a file.
38
- * @name util.fetch
39
- * @function
40
- * @param {string} path File path or url
41
- * @param {FetchCallback} callback Callback function
42
- * @returns {undefined}
43
- * @variation 2
44
- */
45
- declare function fetch(path: string, callback: FetchCallback): void;
46
-
47
- /**
48
- * Fetches the contents of a file.
49
- * @name util.fetch
50
- * @function
51
- * @param {string} path File path or url
52
- * @param {FetchOptions} [options] Fetch options
53
- * @returns {Promise<string|Uint8Array>} Promise
54
- * @variation 3
55
- */
56
- declare function fetch(path: string, options?: FetchOptions): Promise<(string|Uint8Array)>;
@@ -1,115 +0,0 @@
1
- "use strict";
2
- module.exports = fetch;
3
-
4
- var asPromise = require("@protobufjs/aspromise"),
5
- inquire = require("@protobufjs/inquire");
6
-
7
- var fs = inquire("fs");
8
-
9
- /**
10
- * Node-style callback as used by {@link util.fetch}.
11
- * @typedef FetchCallback
12
- * @type {function}
13
- * @param {?Error} error Error, if any, otherwise `null`
14
- * @param {string} [contents] File contents, if there hasn't been an error
15
- * @returns {undefined}
16
- */
17
-
18
- /**
19
- * Options as used by {@link util.fetch}.
20
- * @typedef FetchOptions
21
- * @type {Object}
22
- * @property {boolean} [binary=false] Whether expecting a binary response
23
- * @property {boolean} [xhr=false] If `true`, forces the use of XMLHttpRequest
24
- */
25
-
26
- /**
27
- * Fetches the contents of a file.
28
- * @memberof util
29
- * @param {string} filename File path or url
30
- * @param {FetchOptions} options Fetch options
31
- * @param {FetchCallback} callback Callback function
32
- * @returns {undefined}
33
- */
34
- function fetch(filename, options, callback) {
35
- if (typeof options === "function") {
36
- callback = options;
37
- options = {};
38
- } else if (!options)
39
- options = {};
40
-
41
- if (!callback)
42
- return asPromise(fetch, this, filename, options); // eslint-disable-line no-invalid-this
43
-
44
- // if a node-like filesystem is present, try it first but fall back to XHR if nothing is found.
45
- if (!options.xhr && fs && fs.readFile)
46
- return fs.readFile(filename, function fetchReadFileCallback(err, contents) {
47
- return err && typeof XMLHttpRequest !== "undefined"
48
- ? fetch.xhr(filename, options, callback)
49
- : err
50
- ? callback(err)
51
- : callback(null, options.binary ? contents : contents.toString("utf8"));
52
- });
53
-
54
- // use the XHR version otherwise.
55
- return fetch.xhr(filename, options, callback);
56
- }
57
-
58
- /**
59
- * Fetches the contents of a file.
60
- * @name util.fetch
61
- * @function
62
- * @param {string} path File path or url
63
- * @param {FetchCallback} callback Callback function
64
- * @returns {undefined}
65
- * @variation 2
66
- */
67
-
68
- /**
69
- * Fetches the contents of a file.
70
- * @name util.fetch
71
- * @function
72
- * @param {string} path File path or url
73
- * @param {FetchOptions} [options] Fetch options
74
- * @returns {Promise<string|Uint8Array>} Promise
75
- * @variation 3
76
- */
77
-
78
- /**/
79
- fetch.xhr = function fetch_xhr(filename, options, callback) {
80
- var xhr = new XMLHttpRequest();
81
- xhr.onreadystatechange /* works everywhere */ = function fetchOnReadyStateChange() {
82
-
83
- if (xhr.readyState !== 4)
84
- return undefined;
85
-
86
- // local cors security errors return status 0 / empty string, too. afaik this cannot be
87
- // reliably distinguished from an actually empty file for security reasons. feel free
88
- // to send a pull request if you are aware of a solution.
89
- if (xhr.status !== 0 && xhr.status !== 200)
90
- return callback(Error("status " + xhr.status));
91
-
92
- // if binary data is expected, make sure that some sort of array is returned, even if
93
- // ArrayBuffers are not supported. the binary string fallback, however, is unsafe.
94
- if (options.binary) {
95
- var buffer = xhr.response;
96
- if (!buffer) {
97
- buffer = [];
98
- for (var i = 0; i < xhr.responseText.length; ++i)
99
- buffer.push(xhr.responseText.charCodeAt(i) & 255);
100
- }
101
- return callback(null, typeof Uint8Array !== "undefined" ? new Uint8Array(buffer) : buffer);
102
- }
103
- return callback(null, xhr.responseText);
104
- };
105
-
106
- if (options.binary) {
107
- // ref: https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/Sending_and_Receiving_Binary_Data#Receiving_binary_data_in_older_browsers
108
- if ("overrideMimeType" in xhr)
109
- xhr.overrideMimeType("text/plain; charset=x-user-defined");
110
- xhr.responseType = "arraybuffer";
111
- }
112
-
113
- xhr.open("GET", filename);
114
- xhr.send();
115
- };