@cognipilot/zenoh-wasm 1.9.0-wasm.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.
package/LICENSE ADDED
@@ -0,0 +1,459 @@
1
+ apache-2.0
2
+ epl-2.0
3
+
4
+
5
+ Apache License
6
+ Version 2.0, January 2004
7
+ http://www.apache.org/licenses/
8
+
9
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
10
+
11
+ 1. Definitions.
12
+
13
+ "License" shall mean the terms and conditions for use, reproduction,
14
+ and distribution as defined by Sections 1 through 9 of this document.
15
+
16
+ "Licensor" shall mean the copyright owner or entity authorized by
17
+ the copyright owner that is granting the License.
18
+
19
+ "Legal Entity" shall mean the union of the acting entity and all
20
+ other entities that control, are controlled by, or are under common
21
+ control with that entity. For the purposes of this definition,
22
+ "control" means (i) the power, direct or indirect, to cause the
23
+ direction or management of such entity, whether by contract or
24
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
25
+ outstanding shares, or (iii) beneficial ownership of such entity.
26
+
27
+ "You" (or "Your") shall mean an individual or Legal Entity
28
+ exercising permissions granted by this License.
29
+
30
+ "Source" form shall mean the preferred form for making modifications,
31
+ including but not limited to software source code, documentation
32
+ source, and configuration files.
33
+
34
+ "Object" form shall mean any form resulting from mechanical
35
+ transformation or translation of a Source form, including but
36
+ not limited to compiled object code, generated documentation,
37
+ and conversions to other media types.
38
+
39
+ "Work" shall mean the work of authorship, whether in Source or
40
+ Object form, made available under the License, as indicated by a
41
+ copyright notice that is included in or attached to the work
42
+ (an example is provided in the Appendix below).
43
+
44
+ "Derivative Works" shall mean any work, whether in Source or Object
45
+ form, that is based on (or derived from) the Work and for which the
46
+ editorial revisions, annotations, elaborations, or other modifications
47
+ represent, as a whole, an original work of authorship. For the purposes
48
+ of this License, Derivative Works shall not include works that remain
49
+ separable from, or merely link (or bind by name) to the interfaces of,
50
+ the Work and Derivative Works thereof.
51
+
52
+ "Contribution" shall mean any work of authorship, including
53
+ the original version of the Work and any modifications or additions
54
+ to that Work or Derivative Works thereof, that is intentionally
55
+ submitted to Licensor for inclusion in the Work by the copyright owner
56
+ or by an individual or Legal Entity authorized to submit on behalf of
57
+ the copyright owner. For the purposes of this definition, "submitted"
58
+ means any form of electronic, verbal, or written communication sent
59
+ to the Licensor or its representatives, including but not limited to
60
+ communication on electronic mailing lists, source code control systems,
61
+ and issue tracking systems that are managed by, or on behalf of, the
62
+ Licensor for the purpose of discussing and improving the Work, but
63
+ excluding communication that is conspicuously marked or otherwise
64
+ designated in writing by the copyright owner as "Not a Contribution."
65
+
66
+ "Contributor" shall mean Licensor and any individual or Legal Entity
67
+ on behalf of whom a Contribution has been received by Licensor and
68
+ subsequently incorporated within the Work.
69
+
70
+ 2. Grant of Copyright License. Subject to the terms and conditions of
71
+ this License, each Contributor hereby grants to You a perpetual,
72
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
73
+ copyright license to reproduce, prepare Derivative Works of,
74
+ publicly display, publicly perform, sublicense, and distribute the
75
+ Work and such Derivative Works in Source or Object form.
76
+
77
+ 3. Grant of Patent License. Subject to the terms and conditions of
78
+ this License, each Contributor hereby grants to You a perpetual,
79
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
80
+ (except as stated in this section) patent license to make, have made,
81
+ use, offer to sell, sell, import, and otherwise transfer the Work,
82
+ where such license applies only to those patent claims licensable
83
+ by such Contributor that are necessarily infringed by their
84
+ Contribution(s) alone or by combination of their Contribution(s)
85
+ with the Work to which such Contribution(s) was submitted. If You
86
+ institute patent litigation against any entity (including a
87
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
88
+ or a Contribution incorporated within the Work constitutes direct
89
+ or contributory patent infringement, then any patent licenses
90
+ granted to You under this License for that Work shall terminate
91
+ as of the date such litigation is filed.
92
+
93
+ 4. Redistribution. You may reproduce and distribute copies of the
94
+ Work or Derivative Works thereof in any medium, with or without
95
+ modifications, and in Source or Object form, provided that You
96
+ meet the following conditions:
97
+
98
+ (a) You must give any other recipients of the Work or
99
+ Derivative Works a copy of this License; and
100
+
101
+ (b) You must cause any modified files to carry prominent notices
102
+ stating that You changed the files; and
103
+
104
+ (c) You must retain, in the Source form of any Derivative Works
105
+ that You distribute, all copyright, patent, trademark, and
106
+ attribution notices from the Source form of the Work,
107
+ excluding those notices that do not pertain to any part of
108
+ the Derivative Works; and
109
+
110
+ (d) If the Work includes a "NOTICE" text file as part of its
111
+ distribution, then any Derivative Works that You distribute must
112
+ include a readable copy of the attribution notices contained
113
+ within such NOTICE file, excluding those notices that do not
114
+ pertain to any part of the Derivative Works, in at least one
115
+ of the following places: within a NOTICE text file distributed
116
+ as part of the Derivative Works; within the Source form or
117
+ documentation, if provided along with the Derivative Works; or,
118
+ within a display generated by the Derivative Works, if and
119
+ wherever such third-party notices normally appear. The contents
120
+ of the NOTICE file are for informational purposes only and
121
+ do not modify the License. You may add Your own attribution
122
+ notices within Derivative Works that You distribute, alongside
123
+ or as an addendum to the NOTICE text from the Work, provided
124
+ that such additional attribution notices cannot be construed
125
+ as modifying the License.
126
+
127
+ You may add Your own copyright statement to Your modifications and
128
+ may provide additional or different license terms and conditions
129
+ for use, reproduction, or distribution of Your modifications, or
130
+ for any such Derivative Works as a whole, provided Your use,
131
+ reproduction, and distribution of the Work otherwise complies with
132
+ the conditions stated in this License.
133
+
134
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
135
+ any Contribution intentionally submitted for inclusion in the Work
136
+ by You to the Licensor shall be under the terms and conditions of
137
+ this License, without any additional terms or conditions.
138
+ Notwithstanding the above, nothing herein shall supersede or modify
139
+ the terms of any separate license agreement you may have executed
140
+ with Licensor regarding such Contributions.
141
+
142
+ 6. Trademarks. This License does not grant permission to use the trade
143
+ names, trademarks, service marks, or product names of the Licensor,
144
+ except as required for reasonable and customary use in describing the
145
+ origin of the Work and reproducing the content of the NOTICE file.
146
+
147
+ 7. Disclaimer of Warranty. Unless required by applicable law or
148
+ agreed to in writing, Licensor provides the Work (and each
149
+ Contributor provides its Contributions) on an "AS IS" BASIS,
150
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
151
+ implied, including, without limitation, any warranties or conditions
152
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
153
+ PARTICULAR PURPOSE. You are solely responsible for determining the
154
+ appropriateness of using or redistributing the Work and assume any
155
+ risks associated with Your exercise of permissions under this License.
156
+
157
+ 8. Limitation of Liability. In no event and under no legal theory,
158
+ whether in tort (including negligence), contract, or otherwise,
159
+ unless required by applicable law (such as deliberate and grossly
160
+ negligent acts) or agreed to in writing, shall any Contributor be
161
+ liable to You for damages, including any direct, indirect, special,
162
+ incidental, or consequential damages of any character arising as a
163
+ result of this License or out of the use or inability to use the
164
+ Work (including but not limited to damages for loss of goodwill,
165
+ work stoppage, computer failure or malfunction, or any and all
166
+ other commercial damages or losses), even if such Contributor
167
+ has been advised of the possibility of such damages.
168
+
169
+ 9. Accepting Warranty or Additional Liability. While redistributing
170
+ the Work or Derivative Works thereof, You may choose to offer,
171
+ and charge a fee for, acceptance of support, warranty, indemnity,
172
+ or other liability obligations and/or rights consistent with this
173
+ License. However, in accepting such obligations, You may act only
174
+ on Your own behalf and on Your sole responsibility, not on behalf
175
+ of any other Contributor, and only if You agree to indemnify,
176
+ defend, and hold each Contributor harmless for any liability
177
+ incurred by, or claims asserted against, such Contributor by reason
178
+ of your accepting any such warranty or additional liability.
179
+
180
+ OR
181
+
182
+ Eclipse Public License - v 2.0
183
+
184
+ THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE
185
+ PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION
186
+ OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
187
+
188
+ 1. DEFINITIONS
189
+
190
+ "Contribution" means:
191
+
192
+ a) in the case of the initial Contributor, the initial content
193
+ Distributed under this Agreement, and
194
+
195
+ b) in the case of each subsequent Contributor:
196
+ i) changes to the Program, and
197
+ ii) additions to the Program;
198
+ where such changes and/or additions to the Program originate from
199
+ and are Distributed by that particular Contributor. A Contribution
200
+ "originates" from a Contributor if it was added to the Program by
201
+ such Contributor itself or anyone acting on such Contributor's behalf.
202
+ Contributions do not include changes or additions to the Program that
203
+ are not Modified Works.
204
+
205
+ "Contributor" means any person or entity that Distributes the Program.
206
+
207
+ "Licensed Patents" mean patent claims licensable by a Contributor which
208
+ are necessarily infringed by the use or sale of its Contribution alone
209
+ or when combined with the Program.
210
+
211
+ "Program" means the Contributions Distributed in accordance with this
212
+ Agreement.
213
+
214
+ "Recipient" means anyone who receives the Program under this Agreement
215
+ or any Secondary License (as applicable), including Contributors.
216
+
217
+ "Derivative Works" shall mean any work, whether in Source Code or other
218
+ form, that is based on (or derived from) the Program and for which the
219
+ editorial revisions, annotations, elaborations, or other modifications
220
+ represent, as a whole, an original work of authorship.
221
+
222
+ "Modified Works" shall mean any work in Source Code or other form that
223
+ results from an addition to, deletion from, or modification of the
224
+ contents of the Program, including, for purposes of clarity any new file
225
+ in Source Code form that contains any contents of the Program. Modified
226
+ Works shall not include works that contain only declarations,
227
+ interfaces, types, classes, structures, or files of the Program solely
228
+ in each case in order to link to, bind by name, or subclass the Program
229
+ or Modified Works thereof.
230
+
231
+ "Distribute" means the acts of a) distributing or b) making available
232
+ in any manner that enables the transfer of a copy.
233
+
234
+ "Source Code" means the form of a Program preferred for making
235
+ modifications, including but not limited to software source code,
236
+ documentation source, and configuration files.
237
+
238
+ "Secondary License" means either the GNU General Public License,
239
+ Version 2.0, or any later versions of that license, including any
240
+ exceptions or additional permissions as identified by the initial
241
+ Contributor.
242
+
243
+ 2. GRANT OF RIGHTS
244
+
245
+ a) Subject to the terms of this Agreement, each Contributor hereby
246
+ grants Recipient a non-exclusive, worldwide, royalty-free copyright
247
+ license to reproduce, prepare Derivative Works of, publicly display,
248
+ publicly perform, Distribute and sublicense the Contribution of such
249
+ Contributor, if any, and such Derivative Works.
250
+
251
+ b) Subject to the terms of this Agreement, each Contributor hereby
252
+ grants Recipient a non-exclusive, worldwide, royalty-free patent
253
+ license under Licensed Patents to make, use, sell, offer to sell,
254
+ import and otherwise transfer the Contribution of such Contributor,
255
+ if any, in Source Code or other form. This patent license shall
256
+ apply to the combination of the Contribution and the Program if, at
257
+ the time the Contribution is added by the Contributor, such addition
258
+ of the Contribution causes such combination to be covered by the
259
+ Licensed Patents. The patent license shall not apply to any other
260
+ combinations which include the Contribution. No hardware per se is
261
+ licensed hereunder.
262
+
263
+ c) Recipient understands that although each Contributor grants the
264
+ licenses to its Contributions set forth herein, no assurances are
265
+ provided by any Contributor that the Program does not infringe the
266
+ patent or other intellectual property rights of any other entity.
267
+ Each Contributor disclaims any liability to Recipient for claims
268
+ brought by any other entity based on infringement of intellectual
269
+ property rights or otherwise. As a condition to exercising the
270
+ rights and licenses granted hereunder, each Recipient hereby
271
+ assumes sole responsibility to secure any other intellectual
272
+ property rights needed, if any. For example, if a third party
273
+ patent license is required to allow Recipient to Distribute the
274
+ Program, it is Recipient's responsibility to acquire that license
275
+ before distributing the Program.
276
+
277
+ d) Each Contributor represents that to its knowledge it has
278
+ sufficient copyright rights in its Contribution, if any, to grant
279
+ the copyright license set forth in this Agreement.
280
+
281
+ e) Notwithstanding the terms of any Secondary License, no
282
+ Contributor makes additional grants to any Recipient (other than
283
+ those set forth in this Agreement) as a result of such Recipient's
284
+ receipt of the Program under the terms of a Secondary License
285
+ (if permitted under the terms of Section 3).
286
+
287
+ 3. REQUIREMENTS
288
+
289
+ 3.1 If a Contributor Distributes the Program in any form, then:
290
+
291
+ a) the Program must also be made available as Source Code, in
292
+ accordance with section 3.2, and the Contributor must accompany
293
+ the Program with a statement that the Source Code for the Program
294
+ is available under this Agreement, and informs Recipients how to
295
+ obtain it in a reasonable manner on or through a medium customarily
296
+ used for software exchange; and
297
+
298
+ b) the Contributor may Distribute the Program under a license
299
+ different than this Agreement, provided that such license:
300
+ i) effectively disclaims on behalf of all other Contributors all
301
+ warranties and conditions, express and implied, including
302
+ warranties or conditions of title and non-infringement, and
303
+ implied warranties or conditions of merchantability and fitness
304
+ for a particular purpose;
305
+
306
+ ii) effectively excludes on behalf of all other Contributors all
307
+ liability for damages, including direct, indirect, special,
308
+ incidental and consequential damages, such as lost profits;
309
+
310
+ iii) does not attempt to limit or alter the recipients' rights
311
+ in the Source Code under section 3.2; and
312
+
313
+ iv) requires any subsequent distribution of the Program by any
314
+ party to be under a license that satisfies the requirements
315
+ of this section 3.
316
+
317
+ 3.2 When the Program is Distributed as Source Code:
318
+
319
+ a) it must be made available under this Agreement, or if the
320
+ Program (i) is combined with other material in a separate file or
321
+ files made available under a Secondary License, and (ii) the initial
322
+ Contributor attached to the Source Code the notice described in
323
+ Exhibit A of this Agreement, then the Program may be made available
324
+ under the terms of such Secondary Licenses, and
325
+
326
+ b) a copy of this Agreement must be included with each copy of
327
+ the Program.
328
+
329
+ 3.3 Contributors may not remove or alter any copyright, patent,
330
+ trademark, attribution notices, disclaimers of warranty, or limitations
331
+ of liability ("notices") contained within the Program from any copy of
332
+ the Program which they Distribute, provided that Contributors may add
333
+ their own appropriate notices.
334
+
335
+ 4. COMMERCIAL DISTRIBUTION
336
+
337
+ Commercial distributors of software may accept certain responsibilities
338
+ with respect to end users, business partners and the like. While this
339
+ license is intended to facilitate the commercial use of the Program,
340
+ the Contributor who includes the Program in a commercial product
341
+ offering should do so in a manner which does not create potential
342
+ liability for other Contributors. Therefore, if a Contributor includes
343
+ the Program in a commercial product offering, such Contributor
344
+ ("Commercial Contributor") hereby agrees to defend and indemnify every
345
+ other Contributor ("Indemnified Contributor") against any losses,
346
+ damages and costs (collectively "Losses") arising from claims, lawsuits
347
+ and other legal actions brought by a third party against the Indemnified
348
+ Contributor to the extent caused by the acts or omissions of such
349
+ Commercial Contributor in connection with its distribution of the Program
350
+ in a commercial product offering. The obligations in this section do not
351
+ apply to any claims or Losses relating to any actual or alleged
352
+ intellectual property infringement. In order to qualify, an Indemnified
353
+ Contributor must: a) promptly notify the Commercial Contributor in
354
+ writing of such claim, and b) allow the Commercial Contributor to control,
355
+ and cooperate with the Commercial Contributor in, the defense and any
356
+ related settlement negotiations. The Indemnified Contributor may
357
+ participate in any such claim at its own expense.
358
+
359
+ For example, a Contributor might include the Program in a commercial
360
+ product offering, Product X. That Contributor is then a Commercial
361
+ Contributor. If that Commercial Contributor then makes performance
362
+ claims, or offers warranties related to Product X, those performance
363
+ claims and warranties are such Commercial Contributor's responsibility
364
+ alone. Under this section, the Commercial Contributor would have to
365
+ defend claims against the other Contributors related to those performance
366
+ claims and warranties, and if a court requires any other Contributor to
367
+ pay any damages as a result, the Commercial Contributor must pay
368
+ those damages.
369
+
370
+ 5. NO WARRANTY
371
+
372
+ EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, AND TO THE EXTENT
373
+ PERMITTED BY APPLICABLE LAW, THE PROGRAM IS PROVIDED ON AN "AS IS"
374
+ BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR
375
+ IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF
376
+ TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR
377
+ PURPOSE. Each Recipient is solely responsible for determining the
378
+ appropriateness of using and distributing the Program and assumes all
379
+ risks associated with its exercise of rights under this Agreement,
380
+ including but not limited to the risks and costs of program errors,
381
+ compliance with applicable laws, damage to or loss of data, programs
382
+ or equipment, and unavailability or interruption of operations.
383
+
384
+ 6. DISCLAIMER OF LIABILITY
385
+
386
+ EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, AND TO THE EXTENT
387
+ PERMITTED BY APPLICABLE LAW, NEITHER RECIPIENT NOR ANY CONTRIBUTORS
388
+ SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
389
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST
390
+ PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
391
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
392
+ ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE
393
+ EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE
394
+ POSSIBILITY OF SUCH DAMAGES.
395
+
396
+ 7. GENERAL
397
+
398
+ If any provision of this Agreement is invalid or unenforceable under
399
+ applicable law, it shall not affect the validity or enforceability of
400
+ the remainder of the terms of this Agreement, and without further
401
+ action by the parties hereto, such provision shall be reformed to the
402
+ minimum extent necessary to make such provision valid and enforceable.
403
+
404
+ If Recipient institutes patent litigation against any entity
405
+ (including a cross-claim or counterclaim in a lawsuit) alleging that the
406
+ Program itself (excluding combinations of the Program with other software
407
+ or hardware) infringes such Recipient's patent(s), then such Recipient's
408
+ rights granted under Section 2(b) shall terminate as of the date such
409
+ litigation is filed.
410
+
411
+ All Recipient's rights under this Agreement shall terminate if it
412
+ fails to comply with any of the material terms or conditions of this
413
+ Agreement and does not cure such failure in a reasonable period of
414
+ time after becoming aware of such noncompliance. If all Recipient's
415
+ rights under this Agreement terminate, Recipient agrees to cease use
416
+ and distribution of the Program as soon as reasonably practicable.
417
+ However, Recipient's obligations under this Agreement and any licenses
418
+ granted by Recipient relating to the Program shall continue and survive.
419
+
420
+ Everyone is permitted to copy and distribute copies of this Agreement,
421
+ but in order to avoid inconsistency the Agreement is copyrighted and
422
+ may only be modified in the following manner. The Agreement Steward
423
+ reserves the right to publish new versions (including revisions) of
424
+ this Agreement from time to time. No one other than the Agreement
425
+ Steward has the right to modify this Agreement. The Eclipse Foundation
426
+ is the initial Agreement Steward. The Eclipse Foundation may assign the
427
+ responsibility to serve as the Agreement Steward to a suitable separate
428
+ entity. Each new version of the Agreement will be given a distinguishing
429
+ version number. The Program (including Contributions) may always be
430
+ Distributed subject to the version of the Agreement under which it was
431
+ received. In addition, after a new version of the Agreement is published,
432
+ Contributor may elect to Distribute the Program (including its
433
+ Contributions) under the new version.
434
+
435
+ Except as expressly stated in Sections 2(a) and 2(b) above, Recipient
436
+ receives no rights or licenses to the intellectual property of any
437
+ Contributor under this Agreement, whether expressly, by implication,
438
+ estoppel or otherwise. All rights in the Program not expressly granted
439
+ under this Agreement are reserved. Nothing in this Agreement is intended
440
+ to be enforceable by any entity that is not a Contributor or Recipient.
441
+ No third-party beneficiary rights are created under this Agreement.
442
+
443
+ Exhibit A - Form of Secondary Licenses Notice
444
+
445
+ "This Source Code may also be made available under the following
446
+ Secondary Licenses when the conditions for such availability set forth
447
+ in the Eclipse Public License, v. 2.0 are satisfied: {name license(s),
448
+ version(s), and exceptions or additional permissions here}."
449
+
450
+ Simply including a copy of this Agreement, including this Exhibit A
451
+ is not sufficient to license the Source Code under Secondary Licenses.
452
+
453
+ If it is not possible or desirable to put the notice in a particular
454
+ file, then You may include the notice in a location (such as a LICENSE
455
+ file in a relevant directory) where a recipient would be likely to
456
+ look for such a notice.
457
+
458
+ You may add additional accurate notices of copyright ownership.
459
+
package/README.md ADDED
@@ -0,0 +1,75 @@
1
+ # zenoh-wasm
2
+
3
+ Browser WebAssembly bindings for Zenoh over WebSocket transports.
4
+
5
+ ```js
6
+ import init, { initPanicHook, open } from "zenoh-wasm";
7
+
8
+ await init();
9
+ initPanicHook();
10
+
11
+ const session = await open("ws/127.0.0.1:7447");
12
+ await session.putString("demo/hello", "hello from wasm");
13
+ await session.putBytes("demo/flatbuffer", new Uint8Array([1, 2, 3, 4]));
14
+ await session.close();
15
+ ```
16
+
17
+ Run a Zenoh router with a WebSocket listener:
18
+
19
+ ```sh
20
+ zenohd -l ws/0.0.0.0:7447
21
+ ```
22
+
23
+ For custom Zenoh configuration, pass JSON5 to `openWithConfig()`:
24
+
25
+ ```js
26
+ import init, { openWithConfig } from "zenoh-wasm";
27
+
28
+ await init();
29
+
30
+ const session = await openWithConfig(`{
31
+ mode: "client",
32
+ connect: {
33
+ endpoints: ["ws/127.0.0.1:7447"]
34
+ }
35
+ }`);
36
+ ```
37
+
38
+ This package is browser-oriented and uses `wasm32-unknown-unknown`. Use async APIs only. Blocking `.wait()` APIs, multicast scouting, listeners, dynamic plugins, and low-latency transport are not supported in the browser wasm build.
39
+
40
+ ## Releasing From CI
41
+
42
+ The `Release zenoh-wasm npm` workflow publishes npm packages only after its release checks pass for a tag that matches `zenoh-wasm-npm-v<version>`.
43
+
44
+ Configure these repository settings before publishing:
45
+
46
+ - Secret `NPM_TOKEN`: npm automation token with publish access.
47
+ - Variable `NPM_PACKAGE_NAME`: npm package name, for example `@cognipilot/zenoh-wasm`.
48
+ - Variable `NPM_TAG`: npm dist-tag, for example `next`.
49
+ - Variable `NPM_RELEASE_BRANCH`: release branch name. Defaults to `cognipilot/zenoh-wasm-npm`.
50
+
51
+ Create a release tag on the release branch:
52
+
53
+ ```sh
54
+ git switch cognipilot/zenoh-wasm-npm
55
+ git tag -a zenoh-wasm-npm-v1.9.0-wasm.0 -m 'zenoh wasm npm 1.9.0-wasm.0'
56
+ git push cognipilot cognipilot/zenoh-wasm-npm
57
+ git push cognipilot zenoh-wasm-npm-v1.9.0-wasm.0
58
+ ```
59
+
60
+ The version in the tag becomes the npm package version. The builder also passes that version into the wasm module, so `version()` reports the published npm version.
61
+
62
+ Build package artifacts locally without publishing:
63
+
64
+ ```sh
65
+ NPM_PACKAGE_NAME='@cognipilot/zenoh-wasm' \
66
+ NPM_PACKAGE_VERSION='1.9.0-wasm.0' \
67
+ NPM_REPOSITORY_URL='git+https://github.com/CogniPilot/zenoh.git' \
68
+ node bindings/zenoh-wasm/scripts/build-package.mjs
69
+ ```
70
+
71
+ To publish manually from the generated package directory:
72
+
73
+ ```sh
74
+ npm publish bindings/zenoh-wasm/pkg --tag next --access public --provenance
75
+ ```
package/package.json ADDED
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "@cognipilot/zenoh-wasm",
3
+ "version": "1.9.0-wasm.0",
4
+ "description": "Browser WebAssembly bindings for Zenoh over WebSocket transports.",
5
+ "license": "EPL-2.0 OR Apache-2.0",
6
+ "type": "module",
7
+ "sideEffects": false,
8
+ "main": "./zenoh_wasm.js",
9
+ "module": "./zenoh_wasm.js",
10
+ "types": "./zenoh_wasm.d.ts",
11
+ "exports": {
12
+ ".": {
13
+ "types": "./zenoh_wasm.d.ts",
14
+ "default": "./zenoh_wasm.js"
15
+ }
16
+ },
17
+ "files": [
18
+ "zenoh_wasm.js",
19
+ "zenoh_wasm_bg.wasm",
20
+ "zenoh_wasm.d.ts",
21
+ "README.md",
22
+ "LICENSE"
23
+ ],
24
+ "repository": {
25
+ "type": "git",
26
+ "url": "git+https://github.com/CogniPilot/zenoh.git",
27
+ "directory": "bindings/zenoh-wasm"
28
+ },
29
+ "keywords": [
30
+ "zenoh",
31
+ "wasm",
32
+ "webassembly",
33
+ "websocket",
34
+ "pubsub"
35
+ ]
36
+ }
@@ -0,0 +1,73 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+
4
+ export class ZenohSession {
5
+ private constructor();
6
+ free(): void;
7
+ [Symbol.dispose](): void;
8
+ close(): Promise<void>;
9
+ isClosed(): boolean;
10
+ putBytes(key_expr: string, payload: Uint8Array): Promise<void>;
11
+ putString(key_expr: string, payload: string): Promise<void>;
12
+ }
13
+
14
+ export function initPanicHook(): void;
15
+
16
+ export function open(endpoint: string): Promise<ZenohSession>;
17
+
18
+ export function openWithConfig(config_json5: string): Promise<ZenohSession>;
19
+
20
+ export function version(): string;
21
+
22
+ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
23
+
24
+ export interface InitOutput {
25
+ readonly memory: WebAssembly.Memory;
26
+ readonly __wbg_zenohsession_free: (a: number, b: number) => void;
27
+ readonly open: (a: number, b: number) => any;
28
+ readonly openWithConfig: (a: number, b: number) => any;
29
+ readonly version: () => [number, number];
30
+ readonly zenohsession_close: (a: number) => any;
31
+ readonly zenohsession_isClosed: (a: number) => number;
32
+ readonly zenohsession_putBytes: (a: number, b: number, c: number, d: number, e: number) => any;
33
+ readonly zenohsession_putString: (a: number, b: number, c: number, d: number, e: number) => any;
34
+ readonly initPanicHook: () => void;
35
+ readonly wasm_bindgen__convert__closures_____invoke__h8302226a96718918: (a: number, b: number, c: any) => [number, number];
36
+ readonly wasm_bindgen__convert__closures_____invoke__h93bca70f85705cc5: (a: number, b: number, c: any, d: any) => void;
37
+ readonly wasm_bindgen__convert__closures_____invoke__h48e7698a55f7fca5: (a: number, b: number, c: any) => void;
38
+ readonly wasm_bindgen__convert__closures_____invoke__h48e7698a55f7fca5_2: (a: number, b: number, c: any) => void;
39
+ readonly wasm_bindgen__convert__closures_____invoke__h48e7698a55f7fca5_3: (a: number, b: number, c: any) => void;
40
+ readonly wasm_bindgen__convert__closures_____invoke__h48e7698a55f7fca5_4: (a: number, b: number, c: any) => void;
41
+ readonly wasm_bindgen__convert__closures_____invoke__haaaa3619ed91b031: (a: number, b: number) => void;
42
+ readonly __wbindgen_malloc: (a: number, b: number) => number;
43
+ readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
44
+ readonly __wbindgen_exn_store: (a: number) => void;
45
+ readonly __externref_table_alloc: () => number;
46
+ readonly __wbindgen_externrefs: WebAssembly.Table;
47
+ readonly __wbindgen_free: (a: number, b: number, c: number) => void;
48
+ readonly __wbindgen_destroy_closure: (a: number, b: number) => void;
49
+ readonly __externref_table_dealloc: (a: number) => void;
50
+ readonly __wbindgen_start: () => void;
51
+ }
52
+
53
+ export type SyncInitInput = BufferSource | WebAssembly.Module;
54
+
55
+ /**
56
+ * Instantiates the given `module`, which can either be bytes or
57
+ * a precompiled `WebAssembly.Module`.
58
+ *
59
+ * @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
60
+ *
61
+ * @returns {InitOutput}
62
+ */
63
+ export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
64
+
65
+ /**
66
+ * If `module_or_path` is {RequestInfo} or {URL}, makes a request and
67
+ * for everything else, calls `WebAssembly.instantiate` directly.
68
+ *
69
+ * @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
70
+ *
71
+ * @returns {Promise<InitOutput>}
72
+ */
73
+ export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;