@openclaw/feishu 2026.6.8-beta.2 → 2026.6.9-beta.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 (281) hide show
  1. package/dist/api.js +78 -23
  2. package/dist/{channel-DwygSth-.js → channel-C9mW5kaS.js} +2 -2
  3. package/dist/channel-plugin-api.js +1 -1
  4. package/dist/{channel.runtime-CrqKcXaU.js → channel.runtime-BgUhHAja.js} +3 -3
  5. package/dist/{drive-8o3Omlnd.js → drive-9UfpmY27.js} +15 -2
  6. package/dist/{monitor-_1eNsUVp.js → monitor-BayUOr_U.js} +1 -1
  7. package/dist/{monitor.account-BhoLA1Y0.js → monitor.account-DzZWj0ob.js} +92 -48
  8. package/dist/{send-B3kteMF8.js → send-BozRcrbz.js} +32 -24
  9. package/dist/setup-api.js +1 -1
  10. package/node_modules/@protobufjs/aspromise/LICENSE +26 -0
  11. package/node_modules/@protobufjs/aspromise/README.md +13 -0
  12. package/node_modules/{protobufjs/src/util/aspromise.d.ts → @protobufjs/aspromise/index.d.ts} +13 -13
  13. package/node_modules/{protobufjs/src/util/aspromise.js → @protobufjs/aspromise/index.js} +52 -52
  14. package/node_modules/@protobufjs/aspromise/package.json +21 -0
  15. package/node_modules/@protobufjs/aspromise/tests/index.js +130 -0
  16. package/node_modules/@protobufjs/base64/LICENSE +26 -0
  17. package/node_modules/@protobufjs/base64/README.md +19 -0
  18. package/node_modules/{protobufjs/src/util/base64.d.ts → @protobufjs/base64/index.d.ts} +32 -32
  19. package/node_modules/{protobufjs/src/util/base64.js → @protobufjs/base64/index.js} +139 -146
  20. package/node_modules/@protobufjs/base64/package.json +21 -0
  21. package/node_modules/@protobufjs/base64/tests/index.js +46 -0
  22. package/node_modules/@protobufjs/codegen/LICENSE +26 -0
  23. package/node_modules/@protobufjs/codegen/README.md +49 -0
  24. package/node_modules/{protobufjs/src/util/codegen.d.ts → @protobufjs/codegen/index.d.ts} +31 -31
  25. package/node_modules/{protobufjs/src/util/codegen.js → @protobufjs/codegen/index.js} +112 -113
  26. package/node_modules/@protobufjs/codegen/package.json +13 -0
  27. package/node_modules/@protobufjs/codegen/tests/index.js +13 -0
  28. package/node_modules/@protobufjs/eventemitter/CHANGELOG.md +8 -0
  29. package/node_modules/@protobufjs/eventemitter/LICENSE +26 -0
  30. package/node_modules/@protobufjs/eventemitter/README.md +22 -0
  31. package/node_modules/{protobufjs/src/util/eventemitter.d.ts → @protobufjs/eventemitter/index.d.ts} +45 -45
  32. package/node_modules/{protobufjs/src/util/eventemitter.js → @protobufjs/eventemitter/index.js} +86 -86
  33. package/node_modules/@protobufjs/eventemitter/package.json +21 -0
  34. package/node_modules/@protobufjs/eventemitter/tests/index.js +83 -0
  35. package/node_modules/@protobufjs/fetch/CHANGELOG.md +8 -0
  36. package/node_modules/@protobufjs/fetch/LICENSE +26 -0
  37. package/node_modules/@protobufjs/fetch/README.md +13 -0
  38. package/node_modules/{protobufjs/src/util/fetch.d.ts → @protobufjs/fetch/index.d.ts} +56 -56
  39. package/node_modules/{protobufjs/src/util/fetch.js → @protobufjs/fetch/index.js} +112 -112
  40. package/node_modules/@protobufjs/fetch/package.json +27 -0
  41. package/node_modules/@protobufjs/fetch/tests/data/file.txt +1 -0
  42. package/node_modules/@protobufjs/fetch/tests/index.js +158 -0
  43. package/node_modules/@protobufjs/fetch/util/fs.js +11 -0
  44. package/node_modules/@protobufjs/float/LICENSE +26 -0
  45. package/node_modules/@protobufjs/float/README.md +102 -0
  46. package/node_modules/@protobufjs/float/bench/index.js +87 -0
  47. package/node_modules/@protobufjs/float/bench/suite.js +46 -0
  48. package/node_modules/{protobufjs/src/util/float.js → @protobufjs/float/index.js} +335 -335
  49. package/node_modules/@protobufjs/float/package.json +26 -0
  50. package/node_modules/@protobufjs/float/tests/index.js +100 -0
  51. package/node_modules/@protobufjs/inquire/CHANGELOG.md +8 -0
  52. package/node_modules/@protobufjs/inquire/LICENSE +26 -0
  53. package/node_modules/@protobufjs/inquire/README.md +13 -0
  54. package/node_modules/{protobufjs/src/util/inquire.d.ts → @protobufjs/inquire/index.d.ts} +10 -10
  55. package/node_modules/{protobufjs/src/util/inquire.js → @protobufjs/inquire/index.js} +38 -38
  56. package/node_modules/@protobufjs/inquire/package.json +21 -0
  57. package/node_modules/@protobufjs/inquire/tests/data/array.js +1 -0
  58. package/node_modules/@protobufjs/inquire/tests/data/emptyArray.js +1 -0
  59. package/node_modules/@protobufjs/inquire/tests/data/emptyObject.js +1 -0
  60. package/node_modules/@protobufjs/inquire/tests/data/object.js +1 -0
  61. package/node_modules/@protobufjs/inquire/tests/index.js +20 -0
  62. package/node_modules/@protobufjs/path/LICENSE +26 -0
  63. package/node_modules/@protobufjs/path/README.md +19 -0
  64. package/node_modules/{protobufjs/src/util/path.d.ts → @protobufjs/path/index.d.ts} +22 -22
  65. package/node_modules/{protobufjs/src/util/path.js → @protobufjs/path/index.js} +65 -72
  66. package/node_modules/@protobufjs/path/package.json +21 -0
  67. package/node_modules/@protobufjs/path/tests/index.js +60 -0
  68. package/node_modules/@protobufjs/pool/.npmignore +3 -0
  69. package/node_modules/@protobufjs/pool/LICENSE +26 -0
  70. package/node_modules/@protobufjs/pool/README.md +13 -0
  71. package/node_modules/{protobufjs/src/util/pool.d.ts → @protobufjs/pool/index.d.ts} +32 -32
  72. package/node_modules/{protobufjs/src/util/pool.js → @protobufjs/pool/index.js} +48 -48
  73. package/node_modules/@protobufjs/pool/package.json +21 -0
  74. package/node_modules/@protobufjs/pool/tests/index.js +33 -0
  75. package/node_modules/@protobufjs/utf8/LICENSE +26 -0
  76. package/node_modules/@protobufjs/utf8/README.md +20 -0
  77. package/node_modules/{protobufjs/src/util/utf8.d.ts → @protobufjs/utf8/index.d.ts} +24 -24
  78. package/node_modules/{protobufjs/src/util/utf8.js → @protobufjs/utf8/index.js} +104 -130
  79. package/node_modules/@protobufjs/utf8/package.json +21 -0
  80. package/node_modules/@protobufjs/utf8/tests/data/surrogate_pair_bug.txt +207 -0
  81. package/node_modules/@protobufjs/utf8/tests/data/utf8.txt +216 -0
  82. package/node_modules/@protobufjs/utf8/tests/index.js +74 -0
  83. package/node_modules/@types/node/LICENSE +21 -0
  84. package/node_modules/@types/node/README.md +15 -0
  85. package/node_modules/@types/node/assert/strict.d.ts +59 -0
  86. package/node_modules/@types/node/assert.d.ts +950 -0
  87. package/node_modules/@types/node/async_hooks.d.ts +711 -0
  88. package/node_modules/@types/node/buffer.buffer.d.ts +466 -0
  89. package/node_modules/@types/node/buffer.d.ts +1765 -0
  90. package/node_modules/@types/node/child_process.d.ts +1366 -0
  91. package/node_modules/@types/node/cluster.d.ts +432 -0
  92. package/node_modules/@types/node/compatibility/iterators.d.ts +21 -0
  93. package/node_modules/@types/node/console.d.ts +93 -0
  94. package/node_modules/@types/node/constants.d.ts +14 -0
  95. package/node_modules/@types/node/crypto.d.ts +4058 -0
  96. package/node_modules/@types/node/dgram.d.ts +537 -0
  97. package/node_modules/@types/node/diagnostics_channel.d.ts +552 -0
  98. package/node_modules/@types/node/dns/promises.d.ts +497 -0
  99. package/node_modules/@types/node/dns.d.ts +876 -0
  100. package/node_modules/@types/node/domain.d.ts +150 -0
  101. package/node_modules/@types/node/events.d.ts +1008 -0
  102. package/node_modules/@types/node/fs/promises.d.ts +1468 -0
  103. package/node_modules/@types/node/fs.d.ts +4780 -0
  104. package/node_modules/@types/node/globals.d.ts +150 -0
  105. package/node_modules/@types/node/globals.typedarray.d.ts +101 -0
  106. package/node_modules/@types/node/http.d.ts +2147 -0
  107. package/node_modules/@types/node/http2.d.ts +2485 -0
  108. package/node_modules/@types/node/https.d.ts +400 -0
  109. package/node_modules/@types/node/index.d.ts +117 -0
  110. package/node_modules/@types/node/inspector/promises.d.ts +35 -0
  111. package/node_modules/@types/node/inspector.d.ts +264 -0
  112. package/node_modules/@types/node/inspector.generated.d.ts +4406 -0
  113. package/node_modules/@types/node/module.d.ts +755 -0
  114. package/node_modules/@types/node/net.d.ts +970 -0
  115. package/node_modules/@types/node/os.d.ts +498 -0
  116. package/node_modules/@types/node/package.json +155 -0
  117. package/node_modules/@types/node/path/posix.d.ts +8 -0
  118. package/node_modules/@types/node/path/win32.d.ts +8 -0
  119. package/node_modules/@types/node/path.d.ts +178 -0
  120. package/node_modules/@types/node/perf_hooks.d.ts +612 -0
  121. package/node_modules/@types/node/process.d.ts +2204 -0
  122. package/node_modules/@types/node/punycode.d.ts +89 -0
  123. package/node_modules/@types/node/querystring.d.ts +139 -0
  124. package/node_modules/@types/node/quic.d.ts +897 -0
  125. package/node_modules/@types/node/readline/promises.d.ts +158 -0
  126. package/node_modules/@types/node/readline.d.ts +507 -0
  127. package/node_modules/@types/node/repl.d.ts +420 -0
  128. package/node_modules/@types/node/sea.d.ts +47 -0
  129. package/node_modules/@types/node/sqlite.d.ts +1068 -0
  130. package/node_modules/@types/node/stream/consumers.d.ts +114 -0
  131. package/node_modules/@types/node/stream/iter.d.ts +301 -0
  132. package/node_modules/@types/node/stream/promises.d.ts +211 -0
  133. package/node_modules/@types/node/stream/web.d.ts +300 -0
  134. package/node_modules/@types/node/stream.d.ts +1774 -0
  135. package/node_modules/@types/node/string_decoder.d.ts +27 -0
  136. package/node_modules/@types/node/test/reporters.d.ts +59 -0
  137. package/node_modules/@types/node/test.d.ts +2279 -0
  138. package/node_modules/@types/node/timers/promises.d.ts +93 -0
  139. package/node_modules/@types/node/timers.d.ts +149 -0
  140. package/node_modules/@types/node/tls.d.ts +1193 -0
  141. package/node_modules/@types/node/trace_events.d.ts +103 -0
  142. package/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +462 -0
  143. package/node_modules/@types/node/ts5.6/compatibility/float16array.d.ts +71 -0
  144. package/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +36 -0
  145. package/node_modules/@types/node/ts5.6/index.d.ts +119 -0
  146. package/node_modules/@types/node/ts5.7/compatibility/float16array.d.ts +72 -0
  147. package/node_modules/@types/node/ts5.7/index.d.ts +119 -0
  148. package/node_modules/@types/node/tty.d.ts +225 -0
  149. package/node_modules/@types/node/url.d.ts +556 -0
  150. package/node_modules/@types/node/util/types.d.ts +558 -0
  151. package/node_modules/@types/node/util.d.ts +1677 -0
  152. package/node_modules/@types/node/v8.d.ts +980 -0
  153. package/node_modules/@types/node/vm.d.ts +1136 -0
  154. package/node_modules/@types/node/wasi.d.ts +131 -0
  155. package/node_modules/@types/node/web-globals/abortcontroller.d.ts +59 -0
  156. package/node_modules/@types/node/web-globals/blob.d.ts +23 -0
  157. package/node_modules/@types/node/web-globals/console.d.ts +9 -0
  158. package/node_modules/@types/node/web-globals/crypto.d.ts +39 -0
  159. package/node_modules/@types/node/web-globals/domexception.d.ts +68 -0
  160. package/node_modules/@types/node/web-globals/encoding.d.ts +11 -0
  161. package/node_modules/@types/node/web-globals/events.d.ts +106 -0
  162. package/node_modules/@types/node/web-globals/fetch.d.ts +69 -0
  163. package/node_modules/@types/node/web-globals/importmeta.d.ts +13 -0
  164. package/node_modules/@types/node/web-globals/messaging.d.ts +23 -0
  165. package/node_modules/@types/node/web-globals/navigator.d.ts +25 -0
  166. package/node_modules/@types/node/web-globals/performance.d.ts +45 -0
  167. package/node_modules/@types/node/web-globals/storage.d.ts +24 -0
  168. package/node_modules/@types/node/web-globals/streams.d.ts +115 -0
  169. package/node_modules/@types/node/web-globals/timers.d.ts +44 -0
  170. package/node_modules/@types/node/web-globals/url.d.ts +24 -0
  171. package/node_modules/@types/node/worker_threads.d.ts +671 -0
  172. package/node_modules/@types/node/zlib/iter.d.ts +131 -0
  173. package/node_modules/@types/node/zlib.d.ts +589 -0
  174. package/node_modules/protobufjs/README.md +556 -263
  175. package/node_modules/protobufjs/dist/light/protobuf.js +1569 -1919
  176. package/node_modules/protobufjs/dist/light/protobuf.js.map +1 -1
  177. package/node_modules/protobufjs/dist/light/protobuf.min.js +3 -3
  178. package/node_modules/protobufjs/dist/light/protobuf.min.js.map +1 -1
  179. package/node_modules/protobufjs/dist/minimal/protobuf.js +906 -1132
  180. package/node_modules/protobufjs/dist/minimal/protobuf.js.map +1 -1
  181. package/node_modules/protobufjs/dist/minimal/protobuf.min.js +3 -3
  182. package/node_modules/protobufjs/dist/minimal/protobuf.min.js.map +1 -1
  183. package/node_modules/protobufjs/dist/protobuf.js +1576 -1993
  184. package/node_modules/protobufjs/dist/protobuf.js.map +1 -1
  185. package/node_modules/protobufjs/dist/protobuf.min.js +3 -3
  186. package/node_modules/protobufjs/dist/protobuf.min.js.map +1 -1
  187. package/node_modules/protobufjs/ext/descriptor/README.md +70 -3
  188. package/node_modules/protobufjs/ext/descriptor/index.d.ts +193 -0
  189. package/node_modules/protobufjs/ext/descriptor/index.js +1185 -1
  190. package/node_modules/protobufjs/ext/descriptor/test.js +54 -0
  191. package/node_modules/protobufjs/index.d.ts +720 -834
  192. package/node_modules/protobufjs/package.json +44 -20
  193. package/node_modules/protobufjs/src/converter.js +36 -60
  194. package/node_modules/protobufjs/src/decoder.js +53 -124
  195. package/node_modules/protobufjs/src/encoder.js +2 -10
  196. package/node_modules/protobufjs/src/enum.js +3 -8
  197. package/node_modules/protobufjs/src/field.js +11 -13
  198. package/node_modules/protobufjs/src/index-light.js +1 -1
  199. package/node_modules/protobufjs/src/mapfield.js +0 -1
  200. package/node_modules/protobufjs/src/message.js +11 -5
  201. package/node_modules/protobufjs/src/method.js +4 -5
  202. package/node_modules/protobufjs/src/namespace.js +3 -10
  203. package/node_modules/protobufjs/src/object.js +20 -20
  204. package/node_modules/protobufjs/src/oneof.js +0 -3
  205. package/node_modules/protobufjs/src/parse.js +16 -78
  206. package/node_modules/protobufjs/src/reader.js +31 -136
  207. package/node_modules/protobufjs/src/reader_buffer.js +3 -24
  208. package/node_modules/protobufjs/src/root.js +3 -7
  209. package/node_modules/protobufjs/src/roots.js +1 -1
  210. package/node_modules/protobufjs/src/service.js +6 -13
  211. package/node_modules/protobufjs/src/tokenize.js +1 -6
  212. package/node_modules/protobufjs/src/type.js +30 -44
  213. package/node_modules/protobufjs/src/typescript.jsdoc +15 -0
  214. package/node_modules/protobufjs/src/util/minimal.js +12 -36
  215. package/node_modules/protobufjs/src/util.js +17 -6
  216. package/node_modules/protobufjs/src/verifier.js +6 -6
  217. package/node_modules/protobufjs/src/wrappers.js +1 -0
  218. package/node_modules/protobufjs/src/writer.js +16 -42
  219. package/node_modules/protobufjs/src/writer_buffer.js +1 -18
  220. package/node_modules/protobufjs/tsconfig.json +5 -3
  221. package/node_modules/undici-types/LICENSE +21 -0
  222. package/node_modules/undici-types/README.md +6 -0
  223. package/node_modules/undici-types/agent.d.ts +32 -0
  224. package/node_modules/undici-types/api.d.ts +43 -0
  225. package/node_modules/undici-types/balanced-pool.d.ts +30 -0
  226. package/node_modules/undici-types/cache-interceptor.d.ts +179 -0
  227. package/node_modules/undici-types/cache.d.ts +36 -0
  228. package/node_modules/undici-types/client-stats.d.ts +15 -0
  229. package/node_modules/undici-types/client.d.ts +123 -0
  230. package/node_modules/undici-types/connector.d.ts +36 -0
  231. package/node_modules/undici-types/content-type.d.ts +21 -0
  232. package/node_modules/undici-types/cookies.d.ts +30 -0
  233. package/node_modules/undici-types/diagnostics-channel.d.ts +74 -0
  234. package/node_modules/undici-types/dispatcher.d.ts +279 -0
  235. package/node_modules/undici-types/env-http-proxy-agent.d.ts +22 -0
  236. package/node_modules/undici-types/errors.d.ts +177 -0
  237. package/node_modules/undici-types/eventsource.d.ts +66 -0
  238. package/node_modules/undici-types/fetch.d.ts +211 -0
  239. package/node_modules/undici-types/formdata.d.ts +108 -0
  240. package/node_modules/undici-types/global-dispatcher.d.ts +9 -0
  241. package/node_modules/undici-types/global-origin.d.ts +7 -0
  242. package/node_modules/undici-types/h2c-client.d.ts +73 -0
  243. package/node_modules/undici-types/handlers.d.ts +15 -0
  244. package/node_modules/undici-types/header.d.ts +160 -0
  245. package/node_modules/undici-types/index.d.ts +91 -0
  246. package/node_modules/undici-types/interceptors.d.ts +80 -0
  247. package/node_modules/undici-types/mock-agent.d.ts +68 -0
  248. package/node_modules/undici-types/mock-call-history.d.ts +111 -0
  249. package/node_modules/undici-types/mock-client.d.ts +27 -0
  250. package/node_modules/undici-types/mock-errors.d.ts +12 -0
  251. package/node_modules/undici-types/mock-interceptor.d.ts +94 -0
  252. package/node_modules/undici-types/mock-pool.d.ts +27 -0
  253. package/node_modules/undici-types/package.json +55 -0
  254. package/node_modules/undici-types/patch.d.ts +29 -0
  255. package/node_modules/undici-types/pool-stats.d.ts +19 -0
  256. package/node_modules/undici-types/pool.d.ts +41 -0
  257. package/node_modules/undici-types/proxy-agent.d.ts +29 -0
  258. package/node_modules/undici-types/readable.d.ts +68 -0
  259. package/node_modules/undici-types/retry-agent.d.ts +8 -0
  260. package/node_modules/undici-types/retry-handler.d.ts +125 -0
  261. package/node_modules/undici-types/round-robin-pool.d.ts +41 -0
  262. package/node_modules/undici-types/snapshot-agent.d.ts +109 -0
  263. package/node_modules/undici-types/socks5-proxy-agent.d.ts +25 -0
  264. package/node_modules/undici-types/util.d.ts +18 -0
  265. package/node_modules/undici-types/utility.d.ts +7 -0
  266. package/node_modules/undici-types/webidl.d.ts +347 -0
  267. package/node_modules/undici-types/websocket.d.ts +188 -0
  268. package/npm-shrinkwrap.json +95 -6
  269. package/package.json +4 -4
  270. package/skills/feishu-wiki/SKILL.md +10 -1
  271. package/node_modules/protobufjs/ext/README.md +0 -81
  272. package/node_modules/protobufjs/ext/descriptor.d.ts +0 -86
  273. package/node_modules/protobufjs/ext/descriptor.generated.d.ts +0 -409
  274. package/node_modules/protobufjs/ext/descriptor.js +0 -1266
  275. package/node_modules/protobufjs/ext/textformat.d.ts +0 -19
  276. package/node_modules/protobufjs/ext/textformat.generated.d.ts +0 -11
  277. package/node_modules/protobufjs/ext/textformat.js +0 -1235
  278. package/node_modules/protobufjs/google/protobuf/compiler/plugin.json +0 -126
  279. package/node_modules/protobufjs/google/protobuf/compiler/plugin.proto +0 -47
  280. package/node_modules/protobufjs/src/typescript.js +0 -25
  281. /package/node_modules/{protobufjs/src/util/float.d.ts → @protobufjs/float/index.d.ts} +0 -0
@@ -1,146 +1,139 @@
1
- "use strict";
2
-
3
- /**
4
- * A minimal base64 implementation for number arrays.
5
- * @memberof util
6
- * @namespace
7
- */
8
- var base64 = exports;
9
-
10
- /**
11
- * Calculates the byte length of a base64 encoded string.
12
- * @param {string} string Base64 encoded string
13
- * @returns {number} Byte length
14
- */
15
- base64.length = function length(string) {
16
- var p = string.length;
17
- if (!p)
18
- return 0;
19
- while (p > 0 && string.charAt(p - 1) === "=")
20
- --p;
21
- return Math.floor(p * 3 / 4);
22
- };
23
-
24
- // Base64 encoding table
25
- var b64 = new Array(64);
26
-
27
- // Base64 decoding table
28
- var s64 = new Array(123);
29
-
30
- // 65..90, 97..122, 48..57, 43, 47
31
- for (var i = 0; i < 64;)
32
- s64[b64[i] = i < 26 ? i + 65 : i < 52 ? i + 71 : i < 62 ? i - 4 : i - 59 | 43] = i++;
33
-
34
- s64[45] = 62; // - -> +
35
- s64[95] = 63; // _ -> /
36
-
37
- /**
38
- * Encodes a buffer to a base64 encoded string.
39
- * @param {Uint8Array} buffer Source buffer
40
- * @param {number} start Source start
41
- * @param {number} end Source end
42
- * @returns {string} Base64 encoded string
43
- */
44
- base64.encode = function encode(buffer, start, end) {
45
- var parts = null,
46
- chunk = [];
47
- var i = 0, // output index
48
- j = 0, // goto index
49
- t; // temporary
50
- while (start < end) {
51
- var b = buffer[start++];
52
- switch (j) {
53
- case 0:
54
- chunk[i++] = b64[b >> 2];
55
- t = (b & 3) << 4;
56
- j = 1;
57
- break;
58
- case 1:
59
- chunk[i++] = b64[t | b >> 4];
60
- t = (b & 15) << 2;
61
- j = 2;
62
- break;
63
- case 2:
64
- chunk[i++] = b64[t | b >> 6];
65
- chunk[i++] = b64[b & 63];
66
- j = 0;
67
- break;
68
- }
69
- if (i > 8191) {
70
- (parts || (parts = [])).push(String.fromCharCode.apply(String, chunk));
71
- i = 0;
72
- }
73
- }
74
- if (j) {
75
- chunk[i++] = b64[t];
76
- chunk[i++] = 61;
77
- if (j === 1)
78
- chunk[i++] = 61;
79
- }
80
- if (parts) {
81
- if (i)
82
- parts.push(String.fromCharCode.apply(String, chunk.slice(0, i)));
83
- return parts.join("");
84
- }
85
- return String.fromCharCode.apply(String, chunk.slice(0, i));
86
- };
87
-
88
- var invalidEncoding = "invalid encoding";
89
-
90
- /**
91
- * Decodes a base64 encoded string to a buffer.
92
- * @param {string} string Source string
93
- * @param {Uint8Array} buffer Destination buffer
94
- * @param {number} offset Destination offset
95
- * @returns {number} Number of bytes written
96
- * @throws {Error} If encoding is invalid
97
- */
98
- base64.decode = function decode(string, buffer, offset) {
99
- var start = offset;
100
- var j = 0, // goto index
101
- t; // temporary
102
- for (var i = 0; i < string.length;) {
103
- var c = string.charCodeAt(i++);
104
- if (c === 61 && j > 1)
105
- break;
106
- if ((c = s64[c]) === undefined)
107
- throw Error(invalidEncoding);
108
- switch (j) {
109
- case 0:
110
- t = c;
111
- j = 1;
112
- break;
113
- case 1:
114
- buffer[offset++] = t << 2 | (c & 48) >> 4;
115
- t = c;
116
- j = 2;
117
- break;
118
- case 2:
119
- buffer[offset++] = (t & 15) << 4 | (c & 60) >> 2;
120
- t = c;
121
- j = 3;
122
- break;
123
- case 3:
124
- buffer[offset++] = (t & 3) << 6 | c;
125
- j = 0;
126
- break;
127
- }
128
- }
129
- if (j === 1)
130
- throw Error(invalidEncoding);
131
- return offset - start;
132
- };
133
-
134
- var base64Re = /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/,
135
- base64UrlRe = /[-_]/,
136
- base64UrlNoPaddingRe = /^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2}(?:==)?|[A-Za-z0-9_-]{3}=?)?$/;
137
-
138
- /**
139
- * Tests if the specified string appears to be base64 encoded.
140
- * @param {string} string String to test
141
- * @returns {boolean} `true` if probably base64 encoded, otherwise false
142
- */
143
- base64.test = function test(string) {
144
- return base64Re.test(string)
145
- || base64UrlRe.test(string) && base64UrlNoPaddingRe.test(string);
146
- };
1
+ "use strict";
2
+
3
+ /**
4
+ * A minimal base64 implementation for number arrays.
5
+ * @memberof util
6
+ * @namespace
7
+ */
8
+ var base64 = exports;
9
+
10
+ /**
11
+ * Calculates the byte length of a base64 encoded string.
12
+ * @param {string} string Base64 encoded string
13
+ * @returns {number} Byte length
14
+ */
15
+ base64.length = function length(string) {
16
+ var p = string.length;
17
+ if (!p)
18
+ return 0;
19
+ var n = 0;
20
+ while (--p % 4 > 1 && string.charAt(p) === "=")
21
+ ++n;
22
+ return Math.ceil(string.length * 3) / 4 - n;
23
+ };
24
+
25
+ // Base64 encoding table
26
+ var b64 = new Array(64);
27
+
28
+ // Base64 decoding table
29
+ var s64 = new Array(123);
30
+
31
+ // 65..90, 97..122, 48..57, 43, 47
32
+ for (var i = 0; i < 64;)
33
+ s64[b64[i] = i < 26 ? i + 65 : i < 52 ? i + 71 : i < 62 ? i - 4 : i - 59 | 43] = i++;
34
+
35
+ /**
36
+ * Encodes a buffer to a base64 encoded string.
37
+ * @param {Uint8Array} buffer Source buffer
38
+ * @param {number} start Source start
39
+ * @param {number} end Source end
40
+ * @returns {string} Base64 encoded string
41
+ */
42
+ base64.encode = function encode(buffer, start, end) {
43
+ var parts = null,
44
+ chunk = [];
45
+ var i = 0, // output index
46
+ j = 0, // goto index
47
+ t; // temporary
48
+ while (start < end) {
49
+ var b = buffer[start++];
50
+ switch (j) {
51
+ case 0:
52
+ chunk[i++] = b64[b >> 2];
53
+ t = (b & 3) << 4;
54
+ j = 1;
55
+ break;
56
+ case 1:
57
+ chunk[i++] = b64[t | b >> 4];
58
+ t = (b & 15) << 2;
59
+ j = 2;
60
+ break;
61
+ case 2:
62
+ chunk[i++] = b64[t | b >> 6];
63
+ chunk[i++] = b64[b & 63];
64
+ j = 0;
65
+ break;
66
+ }
67
+ if (i > 8191) {
68
+ (parts || (parts = [])).push(String.fromCharCode.apply(String, chunk));
69
+ i = 0;
70
+ }
71
+ }
72
+ if (j) {
73
+ chunk[i++] = b64[t];
74
+ chunk[i++] = 61;
75
+ if (j === 1)
76
+ chunk[i++] = 61;
77
+ }
78
+ if (parts) {
79
+ if (i)
80
+ parts.push(String.fromCharCode.apply(String, chunk.slice(0, i)));
81
+ return parts.join("");
82
+ }
83
+ return String.fromCharCode.apply(String, chunk.slice(0, i));
84
+ };
85
+
86
+ var invalidEncoding = "invalid encoding";
87
+
88
+ /**
89
+ * Decodes a base64 encoded string to a buffer.
90
+ * @param {string} string Source string
91
+ * @param {Uint8Array} buffer Destination buffer
92
+ * @param {number} offset Destination offset
93
+ * @returns {number} Number of bytes written
94
+ * @throws {Error} If encoding is invalid
95
+ */
96
+ base64.decode = function decode(string, buffer, offset) {
97
+ var start = offset;
98
+ var j = 0, // goto index
99
+ t; // temporary
100
+ for (var i = 0; i < string.length;) {
101
+ var c = string.charCodeAt(i++);
102
+ if (c === 61 && j > 1)
103
+ break;
104
+ if ((c = s64[c]) === undefined)
105
+ throw Error(invalidEncoding);
106
+ switch (j) {
107
+ case 0:
108
+ t = c;
109
+ j = 1;
110
+ break;
111
+ case 1:
112
+ buffer[offset++] = t << 2 | (c & 48) >> 4;
113
+ t = c;
114
+ j = 2;
115
+ break;
116
+ case 2:
117
+ buffer[offset++] = (t & 15) << 4 | (c & 60) >> 2;
118
+ t = c;
119
+ j = 3;
120
+ break;
121
+ case 3:
122
+ buffer[offset++] = (t & 3) << 6 | c;
123
+ j = 0;
124
+ break;
125
+ }
126
+ }
127
+ if (j === 1)
128
+ throw Error(invalidEncoding);
129
+ return offset - start;
130
+ };
131
+
132
+ /**
133
+ * Tests if the specified string appears to be base64 encoded.
134
+ * @param {string} string String to test
135
+ * @returns {boolean} `true` if probably base64 encoded, otherwise false
136
+ */
137
+ base64.test = function test(string) {
138
+ return /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(string);
139
+ };
@@ -0,0 +1,21 @@
1
+ {
2
+ "name": "@protobufjs/base64",
3
+ "description": "A minimal base64 implementation for number arrays.",
4
+ "version": "1.1.2",
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
+ }
@@ -0,0 +1,46 @@
1
+ var tape = require("tape");
2
+
3
+ var base64 = require("..");
4
+
5
+ var strings = {
6
+ "": "",
7
+ "a": "YQ==",
8
+ "ab": "YWI=",
9
+ "abcdefg": "YWJjZGVmZw==",
10
+ "abcdefgh": "YWJjZGVmZ2g=",
11
+ "abcdefghi": "YWJjZGVmZ2hp"
12
+ };
13
+
14
+ tape.test("base64", function(test) {
15
+
16
+ Object.keys(strings).forEach(function(str) {
17
+ var enc = strings[str];
18
+
19
+ test.equal(base64.test(enc), true, "should detect '" + enc + "' to be base64 encoded");
20
+
21
+ var len = base64.length(enc);
22
+ test.equal(len, str.length, "should calculate '" + enc + "' as " + str.length + " bytes");
23
+
24
+ var buf = new Array(len);
25
+ var len2 = base64.decode(enc, buf, 0);
26
+ test.equal(len2, len, "should decode '" + enc + "' to " + len + " bytes");
27
+
28
+ test.equal(String.fromCharCode.apply(String, buf), str, "should decode '" + enc + "' to '" + str + "'");
29
+
30
+ var enc2 = base64.encode(buf, 0, buf.length);
31
+ test.equal(enc2, enc, "should encode '" + str + "' to '" + enc + "'");
32
+
33
+ });
34
+
35
+ test.throws(function() {
36
+ var buf = new Array(10);
37
+ base64.decode("YQ!", buf, 0);
38
+ }, Error, "should throw if encoding is invalid");
39
+
40
+ test.throws(function() {
41
+ var buf = new Array(10);
42
+ base64.decode("Y", buf, 0);
43
+ }, Error, "should throw if string is truncated");
44
+
45
+ test.end();
46
+ });
@@ -0,0 +1,26 @@
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.
@@ -0,0 +1,49 @@
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 +1,31 @@
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
+ 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
+ }