varlink-js 0.1.1 → 1.0.0-alpha.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/README.md +561 -72
- package/dist/cli/args.d.ts +50 -0
- package/dist/cli/args.d.ts.map +1 -0
- package/dist/cli/args.js +370 -0
- package/dist/cli/args.js.map +1 -0
- package/dist/cli/bridge.d.ts +4 -0
- package/dist/cli/bridge.d.ts.map +1 -0
- package/dist/cli/bridge.js +119 -0
- package/dist/cli/bridge.js.map +1 -0
- package/dist/cli/call.d.ts +4 -0
- package/dist/cli/call.d.ts.map +1 -0
- package/dist/cli/call.js +274 -0
- package/dist/cli/call.js.map +1 -0
- package/dist/cli/certification-idl.d.ts +2 -0
- package/dist/cli/certification-idl.d.ts.map +1 -0
- package/dist/cli/certification-idl.js +91 -0
- package/dist/cli/certification-idl.js.map +1 -0
- package/dist/cli/certification.d.ts +78 -0
- package/dist/cli/certification.d.ts.map +1 -0
- package/dist/cli/certification.js +327 -0
- package/dist/cli/certification.js.map +1 -0
- package/dist/cli/certify.d.ts +4 -0
- package/dist/cli/certify.d.ts.map +1 -0
- package/dist/cli/certify.js +95 -0
- package/dist/cli/certify.js.map +1 -0
- package/dist/cli/context.d.ts +50 -0
- package/dist/cli/context.d.ts.map +1 -0
- package/dist/cli/context.js +114 -0
- package/dist/cli/context.js.map +1 -0
- package/dist/cli/idl.d.ts +8 -0
- package/dist/cli/idl.d.ts.map +1 -0
- package/dist/cli/idl.js +276 -0
- package/dist/cli/idl.js.map +1 -0
- package/dist/cli/introspect.d.ts +6 -0
- package/dist/cli/introspect.d.ts.map +1 -0
- package/dist/cli/introspect.js +162 -0
- package/dist/cli/introspect.js.map +1 -0
- package/dist/cli/io.d.ts +116 -0
- package/dist/cli/io.d.ts.map +1 -0
- package/dist/cli/io.js +213 -0
- package/dist/cli/io.js.map +1 -0
- package/dist/cli/json.d.ts +12 -0
- package/dist/cli/json.d.ts.map +1 -0
- package/dist/cli/json.js +53 -0
- package/dist/cli/json.js.map +1 -0
- package/dist/cli/main.d.ts +3 -0
- package/dist/cli/main.d.ts.map +1 -0
- package/dist/cli/main.js +12 -0
- package/dist/cli/main.js.map +1 -0
- package/dist/cli/node-io.d.ts +22 -0
- package/dist/cli/node-io.d.ts.map +1 -0
- package/dist/cli/node-io.js +332 -0
- package/dist/cli/node-io.js.map +1 -0
- package/dist/cli/run.d.ts +12 -0
- package/dist/cli/run.d.ts.map +1 -0
- package/dist/cli/run.js +153 -0
- package/dist/cli/run.js.map +1 -0
- package/dist/cli/target.d.ts +45 -0
- package/dist/cli/target.d.ts.map +1 -0
- package/dist/cli/target.js +100 -0
- package/dist/cli/target.js.map +1 -0
- package/dist/cli/upgrade.d.ts +30 -0
- package/dist/cli/upgrade.d.ts.map +1 -0
- package/dist/cli/upgrade.js +205 -0
- package/dist/cli/upgrade.js.map +1 -0
- package/dist/cli/version.d.ts +3 -0
- package/dist/cli/version.d.ts.map +1 -0
- package/dist/cli/version.js +7 -0
- package/dist/cli/version.js.map +1 -0
- package/dist/codegen/doc.d.ts +39 -0
- package/dist/codegen/doc.d.ts.map +1 -0
- package/dist/codegen/doc.js +178 -0
- package/dist/codegen/doc.js.map +1 -0
- package/dist/codegen/generate.d.ts +43 -0
- package/dist/codegen/generate.d.ts.map +1 -0
- package/dist/codegen/generate.js +498 -0
- package/dist/codegen/generate.js.map +1 -0
- package/dist/codegen/index.d.ts +2 -0
- package/dist/codegen/index.d.ts.map +1 -0
- package/dist/codegen/index.js +3 -0
- package/dist/codegen/index.js.map +1 -0
- package/dist/codegen/sha256.d.ts +5 -0
- package/dist/codegen/sha256.d.ts.map +1 -0
- package/dist/codegen/sha256.js +82 -0
- package/dist/codegen/sha256.js.map +1 -0
- package/dist/core/address/index.d.ts +2 -0
- package/dist/core/address/index.d.ts.map +1 -0
- package/dist/core/address/index.js +3 -0
- package/dist/core/address/index.js.map +1 -0
- package/dist/core/address/parse.d.ts +62 -0
- package/dist/core/address/parse.d.ts.map +1 -0
- package/dist/core/address/parse.js +181 -0
- package/dist/core/address/parse.js.map +1 -0
- package/dist/core/errors/index.d.ts +5 -0
- package/dist/core/errors/index.d.ts.map +1 -0
- package/dist/core/errors/index.js +6 -0
- package/dist/core/errors/index.js.map +1 -0
- package/dist/core/errors/local.d.ts +80 -0
- package/dist/core/errors/local.d.ts.map +1 -0
- package/dist/core/errors/local.js +143 -0
- package/dist/core/errors/local.js.map +1 -0
- package/dist/core/errors/registry.d.ts +24 -0
- package/dist/core/errors/registry.d.ts.map +1 -0
- package/dist/core/errors/registry.js +60 -0
- package/dist/core/errors/registry.js.map +1 -0
- package/dist/core/errors/standard.d.ts +74 -0
- package/dist/core/errors/standard.d.ts.map +1 -0
- package/dist/core/errors/standard.js +134 -0
- package/dist/core/errors/standard.js.map +1 -0
- package/dist/core/errors/varlink-error.d.ts +33 -0
- package/dist/core/errors/varlink-error.d.ts.map +1 -0
- package/dist/core/errors/varlink-error.js +51 -0
- package/dist/core/errors/varlink-error.js.map +1 -0
- package/dist/core/idl/ast.d.ts +145 -0
- package/dist/core/idl/ast.d.ts.map +1 -0
- package/dist/core/idl/ast.js +23 -0
- package/dist/core/idl/ast.js.map +1 -0
- package/dist/core/idl/errors.d.ts +32 -0
- package/dist/core/idl/errors.d.ts.map +1 -0
- package/dist/core/idl/errors.js +20 -0
- package/dist/core/idl/errors.js.map +1 -0
- package/dist/core/idl/format.d.ts +18 -0
- package/dist/core/idl/format.d.ts.map +1 -0
- package/dist/core/idl/format.js +186 -0
- package/dist/core/idl/format.js.map +1 -0
- package/dist/core/idl/index.d.ts +8 -0
- package/dist/core/idl/index.d.ts.map +1 -0
- package/dist/core/idl/index.js +7 -0
- package/dist/core/idl/index.js.map +1 -0
- package/dist/core/idl/lexer.d.ts +48 -0
- package/dist/core/idl/lexer.d.ts.map +1 -0
- package/dist/core/idl/lexer.js +181 -0
- package/dist/core/idl/lexer.js.map +1 -0
- package/dist/core/idl/names.d.ts +13 -0
- package/dist/core/idl/names.d.ts.map +1 -0
- package/dist/core/idl/names.js +20 -0
- package/dist/core/idl/names.js.map +1 -0
- package/dist/core/idl/parser.d.ts +14 -0
- package/dist/core/idl/parser.d.ts.map +1 -0
- package/dist/core/idl/parser.js +254 -0
- package/dist/core/idl/parser.js.map +1 -0
- package/dist/core/idl/validate.d.ts +13 -0
- package/dist/core/idl/validate.d.ts.map +1 -0
- package/dist/core/idl/validate.js +271 -0
- package/dist/core/idl/validate.js.map +1 -0
- package/dist/core/index.d.ts +6 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +7 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/protocol/channel.d.ts +92 -0
- package/dist/core/protocol/channel.d.ts.map +1 -0
- package/dist/core/protocol/channel.js +4 -0
- package/dist/core/protocol/channel.js.map +1 -0
- package/dist/core/protocol/client-session.d.ts +87 -0
- package/dist/core/protocol/client-session.d.ts.map +1 -0
- package/dist/core/protocol/client-session.js +215 -0
- package/dist/core/protocol/client-session.js.map +1 -0
- package/dist/core/protocol/dispatch.d.ts +182 -0
- package/dist/core/protocol/dispatch.d.ts.map +1 -0
- package/dist/core/protocol/dispatch.js +697 -0
- package/dist/core/protocol/dispatch.js.map +1 -0
- package/dist/core/protocol/framer.d.ts +80 -0
- package/dist/core/protocol/framer.d.ts.map +1 -0
- package/dist/core/protocol/framer.js +336 -0
- package/dist/core/protocol/framer.js.map +1 -0
- package/dist/core/protocol/index.d.ts +7 -0
- package/dist/core/protocol/index.d.ts.map +1 -0
- package/dist/core/protocol/index.js +9 -0
- package/dist/core/protocol/index.js.map +1 -0
- package/dist/core/protocol/messages.d.ts +68 -0
- package/dist/core/protocol/messages.d.ts.map +1 -0
- package/dist/core/protocol/messages.js +181 -0
- package/dist/core/protocol/messages.js.map +1 -0
- package/dist/core/protocol/server-session.d.ts +134 -0
- package/dist/core/protocol/server-session.d.ts.map +1 -0
- package/dist/core/protocol/server-session.js +304 -0
- package/dist/core/protocol/server-session.js.map +1 -0
- package/dist/core/types/codec.d.ts +32 -0
- package/dist/core/types/codec.d.ts.map +1 -0
- package/dist/core/types/codec.js +138 -0
- package/dist/core/types/codec.js.map +1 -0
- package/dist/core/types/compile.d.ts +66 -0
- package/dist/core/types/compile.d.ts.map +1 -0
- package/dist/core/types/compile.js +353 -0
- package/dist/core/types/compile.js.map +1 -0
- package/dist/core/types/descriptors.d.ts +65 -0
- package/dist/core/types/descriptors.d.ts.map +1 -0
- package/dist/core/types/descriptors.js +99 -0
- package/dist/core/types/descriptors.js.map +1 -0
- package/dist/core/types/index.d.ts +4 -0
- package/dist/core/types/index.d.ts.map +1 -0
- package/dist/core/types/index.js +5 -0
- package/dist/core/types/index.js.map +1 -0
- package/dist/http/client.d.ts +155 -0
- package/dist/http/client.d.ts.map +1 -0
- package/dist/http/client.js +857 -0
- package/dist/http/client.js.map +1 -0
- package/dist/http/errors.d.ts +14 -0
- package/dist/http/errors.d.ts.map +1 -0
- package/dist/http/errors.js +20 -0
- package/dist/http/errors.js.map +1 -0
- package/dist/http/index.d.ts +3 -0
- package/dist/http/index.d.ts.map +1 -0
- package/dist/http/index.js +4 -0
- package/dist/http/index.js.map +1 -0
- package/dist/http/jsonseq.d.ts +25 -0
- package/dist/http/jsonseq.d.ts.map +1 -0
- package/dist/http/jsonseq.js +184 -0
- package/dist/http/jsonseq.js.map +1 -0
- package/dist/idl/index.d.ts +2 -0
- package/dist/idl/index.d.ts.map +1 -0
- package/dist/idl/index.js +3 -0
- package/dist/idl/index.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/interfaces/index.d.ts +3 -0
- package/dist/interfaces/index.d.ts.map +1 -0
- package/dist/interfaces/index.js +6 -0
- package/dist/interfaces/index.js.map +1 -0
- package/dist/interfaces/io.github.pzmarzly.varlinkjs.d.ts +34 -0
- package/dist/interfaces/io.github.pzmarzly.varlinkjs.d.ts.map +1 -0
- package/dist/interfaces/io.github.pzmarzly.varlinkjs.js +25 -0
- package/dist/interfaces/io.github.pzmarzly.varlinkjs.js.map +1 -0
- package/dist/interfaces/org.varlink.service.d.ts +100 -0
- package/dist/interfaces/org.varlink.service.d.ts.map +1 -0
- package/dist/interfaces/org.varlink.service.js +103 -0
- package/dist/interfaces/org.varlink.service.js.map +1 -0
- package/dist/interfaces/runtime.d.ts +7 -0
- package/dist/interfaces/runtime.d.ts.map +1 -0
- package/dist/interfaces/runtime.js +7 -0
- package/dist/interfaces/runtime.js.map +1 -0
- package/dist/node/activation-fds.d.ts +15 -0
- package/dist/node/activation-fds.d.ts.map +1 -0
- package/dist/node/activation-fds.js +24 -0
- package/dist/node/activation-fds.js.map +1 -0
- package/dist/node/activation.d.ts +121 -0
- package/dist/node/activation.d.ts.map +1 -0
- package/dist/node/activation.js +572 -0
- package/dist/node/activation.js.map +1 -0
- package/dist/node/connect.d.ts +37 -0
- package/dist/node/connect.d.ts.map +1 -0
- package/dist/node/connect.js +110 -0
- package/dist/node/connect.js.map +1 -0
- package/dist/node/index.d.ts +10 -0
- package/dist/node/index.d.ts.map +1 -0
- package/dist/node/index.js +13 -0
- package/dist/node/index.js.map +1 -0
- package/dist/node/listen.d.ts +105 -0
- package/dist/node/listen.d.ts.map +1 -0
- package/dist/node/listen.js +594 -0
- package/dist/node/listen.js.map +1 -0
- package/dist/node/native.d.ts +102 -0
- package/dist/node/native.d.ts.map +1 -0
- package/dist/node/native.js +551 -0
- package/dist/node/native.js.map +1 -0
- package/dist/node/pool.d.ts +10 -0
- package/dist/node/pool.d.ts.map +1 -0
- package/dist/node/pool.js +18 -0
- package/dist/node/pool.js.map +1 -0
- package/dist/node/registry.d.ts +110 -0
- package/dist/node/registry.d.ts.map +1 -0
- package/dist/node/registry.js +480 -0
- package/dist/node/registry.js.map +1 -0
- package/dist/node/socket.d.ts +17 -0
- package/dist/node/socket.d.ts.map +1 -0
- package/dist/node/socket.js +251 -0
- package/dist/node/socket.js.map +1 -0
- package/dist/node/spawn-channel.d.ts +22 -0
- package/dist/node/spawn-channel.d.ts.map +1 -0
- package/dist/node/spawn-channel.js +248 -0
- package/dist/node/spawn-channel.js.map +1 -0
- package/dist/node/spawn.d.ts +107 -0
- package/dist/node/spawn.d.ts.map +1 -0
- package/dist/node/spawn.js +604 -0
- package/dist/node/spawn.js.map +1 -0
- package/dist/rpc/connection.d.ts +275 -0
- package/dist/rpc/connection.d.ts.map +1 -0
- package/dist/rpc/connection.js +1007 -0
- package/dist/rpc/connection.js.map +1 -0
- package/dist/rpc/index.d.ts +7 -0
- package/dist/rpc/index.d.ts.map +1 -0
- package/dist/rpc/index.js +6 -0
- package/dist/rpc/index.js.map +1 -0
- package/dist/rpc/pool.d.ts +86 -0
- package/dist/rpc/pool.d.ts.map +1 -0
- package/dist/rpc/pool.js +423 -0
- package/dist/rpc/pool.js.map +1 -0
- package/dist/rpc/proxy.d.ts +40 -0
- package/dist/rpc/proxy.d.ts.map +1 -0
- package/dist/rpc/proxy.js +65 -0
- package/dist/rpc/proxy.js.map +1 -0
- package/dist/rpc/server.d.ts +245 -0
- package/dist/rpc/server.d.ts.map +1 -0
- package/dist/rpc/server.js +833 -0
- package/dist/rpc/server.js.map +1 -0
- package/dist/rpc/service.d.ts +57 -0
- package/dist/rpc/service.d.ts.map +1 -0
- package/dist/rpc/service.js +96 -0
- package/dist/rpc/service.js.map +1 -0
- package/dist/rpc/typed-client.d.ts +50 -0
- package/dist/rpc/typed-client.d.ts.map +1 -0
- package/dist/rpc/typed-client.js +64 -0
- package/dist/rpc/typed-client.js.map +1 -0
- package/dist/rpc/upgrade.d.ts +40 -0
- package/dist/rpc/upgrade.d.ts.map +1 -0
- package/dist/rpc/upgrade.js +95 -0
- package/dist/rpc/upgrade.js.map +1 -0
- package/dist/rpc/util.d.ts +20 -0
- package/dist/rpc/util.d.ts.map +1 -0
- package/dist/rpc/util.js +60 -0
- package/dist/rpc/util.js.map +1 -0
- package/dist/testing/faulty.d.ts +37 -0
- package/dist/testing/faulty.d.ts.map +1 -0
- package/dist/testing/faulty.js +164 -0
- package/dist/testing/faulty.js.map +1 -0
- package/dist/testing/index.d.ts +3 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +4 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/testing/pair.d.ts +23 -0
- package/dist/testing/pair.d.ts.map +1 -0
- package/dist/testing/pair.js +159 -0
- package/dist/testing/pair.js.map +1 -0
- package/dist/websocket/channel.d.ts +78 -0
- package/dist/websocket/channel.d.ts.map +1 -0
- package/dist/websocket/channel.js +478 -0
- package/dist/websocket/channel.js.map +1 -0
- package/dist/websocket/connect.d.ts +41 -0
- package/dist/websocket/connect.d.ts.map +1 -0
- package/dist/websocket/connect.js +165 -0
- package/dist/websocket/connect.js.map +1 -0
- package/dist/websocket/index.d.ts +3 -0
- package/dist/websocket/index.d.ts.map +1 -0
- package/dist/websocket/index.js +4 -0
- package/dist/websocket/index.js.map +1 -0
- package/package.json +83 -16
- package/src/cli/args.ts +408 -0
- package/src/cli/bridge.ts +116 -0
- package/src/cli/call.ts +301 -0
- package/src/{schemas/org.varlink.certification.varlink → cli/certification-idl.ts} +5 -1
- package/src/cli/certification.ts +393 -0
- package/src/cli/certify.ts +92 -0
- package/src/cli/context.ts +153 -0
- package/src/cli/idl.ts +270 -0
- package/src/cli/introspect.ts +167 -0
- package/src/cli/io.ts +303 -0
- package/src/cli/json.ts +57 -0
- package/src/cli/main.ts +11 -0
- package/src/cli/node-io.ts +328 -0
- package/src/cli/run.ts +163 -0
- package/src/cli/target.ts +152 -0
- package/src/cli/upgrade.ts +195 -0
- package/src/cli/version.ts +8 -0
- package/src/codegen/doc.ts +185 -0
- package/src/codegen/generate.ts +557 -0
- package/src/codegen/index.ts +9 -0
- package/src/codegen/sha256.ts +84 -0
- package/src/core/address/index.ts +2 -0
- package/src/core/address/parse.ts +184 -0
- package/src/core/errors/index.ts +31 -0
- package/src/core/errors/local.ts +165 -0
- package/src/core/errors/registry.ts +78 -0
- package/src/core/errors/standard.ts +145 -0
- package/src/core/errors/varlink-error.ts +61 -0
- package/src/core/idl/ast.ts +167 -0
- package/src/core/idl/errors.ts +58 -0
- package/src/core/idl/format.ts +209 -0
- package/src/core/idl/index.ts +26 -0
- package/src/core/idl/lexer.ts +221 -0
- package/src/core/idl/names.ts +24 -0
- package/src/core/idl/parser.ts +281 -0
- package/src/core/idl/validate.ts +267 -0
- package/src/core/index.ts +6 -0
- package/src/core/protocol/channel.ts +99 -0
- package/src/core/protocol/client-session.ts +255 -0
- package/src/core/protocol/dispatch.ts +861 -0
- package/src/core/protocol/framer.ts +340 -0
- package/src/core/protocol/index.ts +44 -0
- package/src/core/protocol/messages.ts +212 -0
- package/src/core/protocol/server-session.ts +349 -0
- package/src/core/types/codec.ts +170 -0
- package/src/core/types/compile.ts +406 -0
- package/src/core/types/descriptors.ts +153 -0
- package/src/core/types/index.ts +23 -0
- package/src/http/client.ts +1074 -0
- package/src/http/errors.ts +21 -0
- package/src/http/index.ts +16 -0
- package/src/http/jsonseq.ts +178 -0
- package/src/idl/index.ts +2 -0
- package/src/index.ts +23 -0
- package/src/interfaces/index.ts +11 -0
- package/src/interfaces/io.github.pzmarzly.varlinkjs.ts +51 -0
- package/src/interfaces/org.varlink.service.ts +190 -0
- package/src/interfaces/runtime.ts +21 -0
- package/src/node/activation-fds.ts +26 -0
- package/src/node/activation.ts +628 -0
- package/src/node/connect.ts +123 -0
- package/src/node/index.ts +40 -0
- package/src/node/listen.ts +711 -0
- package/src/node/native.ts +637 -0
- package/src/node/pool.ts +21 -0
- package/src/node/registry.ts +500 -0
- package/src/node/socket.ts +257 -0
- package/src/node/spawn-channel.ts +262 -0
- package/src/node/spawn.ts +711 -0
- package/src/rpc/connection.ts +1346 -0
- package/src/rpc/index.ts +45 -0
- package/src/rpc/pool.ts +514 -0
- package/src/rpc/proxy.ts +120 -0
- package/src/rpc/server.ts +1057 -0
- package/src/rpc/service.ts +142 -0
- package/src/rpc/typed-client.ts +116 -0
- package/src/rpc/upgrade.ts +121 -0
- package/src/rpc/util.ts +63 -0
- package/src/testing/faulty.ts +189 -0
- package/src/testing/index.ts +3 -0
- package/src/testing/pair.ts +170 -0
- package/src/websocket/channel.ts +519 -0
- package/src/websocket/connect.ts +212 -0
- package/src/websocket/index.ts +3 -0
- package/.github/workflows/bun.yml +0 -18
- package/.github/workflows/nodejs.yml +0 -18
- package/eslint.config.cjs +0 -17
- package/src/client/client.test.ts +0 -138
- package/src/client/client.ts +0 -119
- package/src/protocol/protocol.ts +0 -124
- package/src/schemas/org.varlink.certification.varlink.ts +0 -32
- package/src/schemas/org.varlink.resolver.varlink +0 -18
- package/src/schemas/org.varlink.resolver.varlink.ts +0 -25
- package/src/schemas/org.varlink.service.varlink +0 -29
- package/src/schemas/org.varlink.service.varlink.ts +0 -25
- package/src/server/reference-server.ts +0 -436
- package/src/server/run-reference-server.ts +0 -11
- package/src/server/server.test.ts +0 -41
- package/src/server/server.ts +0 -180
- package/src/transport/node-socket.ts +0 -174
- package/src/transport/transport.ts +0 -58
- package/tsconfig.json +0 -27
- package/tsup.config.ts +0 -19
package/README.md
CHANGED
|
@@ -1,93 +1,582 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
-
|
|
4
|
-
|
|
5
|
-
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
|
|
15
|
-
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
1
|
+
# varlink-js
|
|
2
|
+
|
|
3
|
+
[Varlink](https://varlink.org/) ([UAPI.20](https://uapi-group.org/specifications/specs/varlink/)) for JavaScript
|
|
4
|
+
runtimes: a client, a server (with `org.varlink.service` built in), an IDL parser, validator and formatter, a
|
|
5
|
+
TypeScript code generator and a `varlink-js` CLI modelled on systemd's `varlinkctl`. Zero runtime dependencies, ESM
|
|
6
|
+
only, Node.js ≥ 22.12 (Bun and Deno run the unit and regression tests in CI; see [Runtimes](#runtimes)).
|
|
7
|
+
|
|
8
|
+
**Status: `1.0.0-alpha.0`, published to npm under the `next` dist-tag.** This is a rewrite; the 0.1.x API is gone (see
|
|
9
|
+
[docs/MIGRATION.md](docs/MIGRATION.md)). The design, with the reasons behind every rule, is in
|
|
10
|
+
[docs/DESIGN.md](docs/DESIGN.md).
|
|
11
|
+
|
|
12
|
+
- [Install](#install) · [Quick start](#quick-start) · [Codegen](#codegen) · [CLI](#cli) · [Addresses](#addresses)
|
|
13
|
+
- [Limits and defaults](#limits-and-defaults) · [Cancellation and timeouts](#cancellation-and-timeouts) ·
|
|
14
|
+
[Errors](#errors) · [Integers](#integers) · [Socket activation and friends](#socket-activation-and-friends)
|
|
15
|
+
- [Runtimes](#runtimes) · [What is tested where](#what-is-tested-where) · [Not yet implemented](#not-yet-implemented)
|
|
16
|
+
· [Certification](#certification)
|
|
17
|
+
|
|
18
|
+
## Install
|
|
19
|
+
|
|
20
|
+
```sh
|
|
21
|
+
npm install varlink-js@next
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Prereleases are published under the `next` dist-tag only, so a plain `npm install varlink-js` still resolves to the
|
|
25
|
+
old 0.1.x line until the first stable 1.0.0 moves `latest`.
|
|
26
|
+
|
|
27
|
+
To try unreleased changes, note that `npm install github:…` does not work: npm 12 refuses git dependencies by
|
|
28
|
+
default (`EALLOWGIT`), and with `--allow-git=all` it installs the package without `dist/`, because `dist/` is built by
|
|
29
|
+
the `prepack` script, which npm does not run for a git dependency. Build a tarball instead (the same steps CI and the
|
|
30
|
+
release workflow run before the consumer test, `test/fixtures/consumer/run.js`):
|
|
31
|
+
|
|
32
|
+
```sh
|
|
33
|
+
git clone https://github.com/pzmarzly/varlink-js.git
|
|
34
|
+
cd varlink-js
|
|
35
|
+
npm ci # development needs Node.js >= 22.18 (TypeScript type stripping); users need >= 22.12
|
|
36
|
+
npm pack # prepack builds dist/ -> varlink-js-1.0.0-alpha.0.tgz
|
|
37
|
+
cd /path/to/your/project
|
|
38
|
+
npm install /path/to/varlink-js/varlink-js-1.0.0-alpha.0.tgz
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Entry points (the `exports` map; there are no deep imports):
|
|
42
|
+
|
|
43
|
+
| Import | What |
|
|
44
|
+
|---|---|
|
|
45
|
+
| `varlink-js` | `createServer`, `createConnection` (over any `ByteChannel`), `createPool`, `createClient`, errors, `parseAddress`, `streamOf`, types. No Node imports. |
|
|
46
|
+
| `varlink-js/node` | `connect`, `listen`, `createPool(address)`, `connectExec`, `connectBridge`, `listenFromEnv`, `listenAuto`, `listenStdio`, registry and resolver helpers. |
|
|
47
|
+
| `varlink-js/websocket` | WebSocket mode client: `connect`, `createPool`, `fromWebSocket`. |
|
|
48
|
+
| `varlink-js/http` | Simple HTTP mode client: `createHttpClient`. |
|
|
49
|
+
| `varlink-js/idl` | `parseInterface`, `validateInterface`, `formatInterface`, the AST types. |
|
|
50
|
+
| `varlink-js/codegen` | `generate`, `generateFromService`. |
|
|
51
|
+
| `varlink-js/testing` | `pair()` (in-memory channel pair), `faulty()` (fault injection). |
|
|
52
|
+
| `varlink-js` (bin) | The CLI, see [CLI](#cli). |
|
|
53
|
+
|
|
54
|
+
## Quick start
|
|
55
|
+
|
|
56
|
+
The code blocks below are copies of files under [`examples/`](examples/), which CI runs end to end
|
|
57
|
+
(`test/docs/examples.test.ts`). In this repository the examples import `../src/…`; the blocks show the package
|
|
58
|
+
specifiers you use (`varlink-js`, `varlink-js/node`, …). `test/docs/snippets.test.ts` checks every block against its
|
|
59
|
+
file with exactly that substitution.
|
|
60
|
+
|
|
61
|
+
### Client: `org.varlink.service.GetInfo`
|
|
62
|
+
|
|
63
|
+
<!-- snippet: examples/client.ts -->
|
|
64
|
+
```ts
|
|
65
|
+
// Calls org.varlink.service.GetInfo: `node examples/client.ts ADDRESS`, e.g. unix:/run/org.example.sock.
|
|
66
|
+
import { connect } from "varlink-js/node";
|
|
67
|
+
|
|
68
|
+
const address = process.argv[2] ?? "unix:./org.example.reference.sock";
|
|
69
|
+
const conn = await connect(address); // unix:/path, unix:@name (Linux), tcp:host:port, exec:/path, ssh-unix:…
|
|
70
|
+
try {
|
|
71
|
+
const info = await conn.getInfo(); // org.varlink.service.GetInfo, reply validated
|
|
72
|
+
console.log(`${info.vendor} ${info.product} ${info.version} (${info.url})`);
|
|
73
|
+
for (const name of info.interfaces) console.log(` ${name}`);
|
|
74
|
+
} finally {
|
|
75
|
+
await conn.close();
|
|
76
|
+
}
|
|
23
77
|
```
|
|
24
78
|
|
|
25
|
-
|
|
79
|
+
### Server: an interface from IDL text, a streaming method, a typed error
|
|
80
|
+
|
|
81
|
+
<!-- snippet: examples/server.ts -->
|
|
82
|
+
```ts
|
|
83
|
+
// A small server from IDL text: `node examples/server.ts [ADDRESS]` (default tcp:127.0.0.1:0, a free port).
|
|
84
|
+
import { createServer, streamOf, VarlinkError } from "varlink-js";
|
|
85
|
+
import { listen } from "varlink-js/node";
|
|
26
86
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
import { SocketClientSideTransport } from "varlink-js/transport/node-socket";
|
|
87
|
+
const IDL = `# A demo interface.
|
|
88
|
+
interface org.example.demo
|
|
30
89
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
90
|
+
# Greets someone.
|
|
91
|
+
method Hello(name: string) -> (greeting: string)
|
|
92
|
+
|
|
93
|
+
# Counts from 1 to n, one reply per number.
|
|
94
|
+
# [Requires 'more' flag]
|
|
95
|
+
method Count(n: int) -> (i: int)
|
|
96
|
+
|
|
97
|
+
# n is not between 1 and max.
|
|
98
|
+
error OutOfRange (n: int, max: int)
|
|
99
|
+
`;
|
|
100
|
+
|
|
101
|
+
const server = createServer({ vendor: "Example", product: "demo", version: "1.0", url: "https://example.org" });
|
|
102
|
+
server.addInterface(IDL, {
|
|
103
|
+
// Parameters are validated against the IDL before a handler runs.
|
|
104
|
+
Hello: (p: { name: string }) => ({ greeting: `Hello, ${p.name}!` }),
|
|
105
|
+
// An async generator streams: each `yield` is a reply with `continues`, the `return` value is the final reply.
|
|
106
|
+
// streamOf() re-yields items but returns the last one, so it goes out as the final reply.
|
|
107
|
+
Count: async function* (p: { n: number }) {
|
|
108
|
+
if (p.n < 1 || p.n > 100) throw new VarlinkError("org.example.demo.OutOfRange", { n: p.n, max: 100 });
|
|
109
|
+
return yield* streamOf(Array.from({ length: p.n }, (_, k) => ({ i: k + 1 })));
|
|
110
|
+
},
|
|
35
111
|
});
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
112
|
+
|
|
113
|
+
// unix:/path (mode applies only there), unix:@name (Linux; no permissions) or tcp:127.0.0.1:PORT
|
|
114
|
+
const listener = await listen(process.argv[2] ?? "tcp:127.0.0.1:0", { mode: 0o644 });
|
|
115
|
+
server.serve(listener);
|
|
116
|
+
const stop = (): void => {
|
|
117
|
+
void server.shutdown().then(() => process.exit(0)); // graceful: running calls may finish (5 s deadline)
|
|
118
|
+
};
|
|
119
|
+
process.once("SIGINT", stop);
|
|
120
|
+
process.once("SIGTERM", stop);
|
|
121
|
+
|
|
122
|
+
// Handlers first, then the line the caller waits for, so an early signal still shuts down cleanly.
|
|
123
|
+
console.log(`Listening on ${listener.address}`);
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
`listen()` binds exactly the address you pass. For a unix socket path, `mode` is applied before the socket appears at
|
|
127
|
+
its path; 0644 means only the owner can connect (connecting needs write permission), and root, which ignores file
|
|
128
|
+
permissions. Caveats: on a file system without hard links, or when the private directory's path would not fit in
|
|
129
|
+
`sun_path`, the mode is applied right after `bind` (a short window with the umask's mode); and `mode` is silently
|
|
130
|
+
ignored for `tcp:`, `unix:@` (abstract sockets have no permissions: any local user in the network namespace can
|
|
131
|
+
connect) and `{ fd }` listeners.
|
|
132
|
+
|
|
133
|
+
### Calling it: `call`, `stream`, `collect`, a typed error
|
|
134
|
+
|
|
135
|
+
<!-- snippet: examples/demo-client.ts -->
|
|
136
|
+
```ts
|
|
137
|
+
// Calls examples/server.ts: `node examples/demo-client.ts ADDRESS` (the address the server printed).
|
|
138
|
+
import { isVarlinkError } from "varlink-js";
|
|
139
|
+
import { connect } from "varlink-js/node";
|
|
140
|
+
|
|
141
|
+
const address = process.argv[2];
|
|
142
|
+
if (address === undefined) throw new Error("usage: node examples/demo-client.ts ADDRESS");
|
|
143
|
+
|
|
144
|
+
const conn = await connect(address);
|
|
145
|
+
try {
|
|
146
|
+
const { greeting } = await conn.call("org.example.demo.Hello", { name: "world" });
|
|
147
|
+
console.log(greeting); // Hello, world!
|
|
148
|
+
|
|
149
|
+
// `more`: one iteration per reply, the final one included.
|
|
150
|
+
for await (const reply of conn.stream("org.example.demo.Count", { n: 3 })) console.log(reply.i); // 1 2 3
|
|
151
|
+
|
|
152
|
+
try {
|
|
153
|
+
await conn.collect("org.example.demo.Count", { n: 1000 }); // collect(): all replies as an array
|
|
154
|
+
} catch (e) {
|
|
155
|
+
if (!isVarlinkError(e, "org.example.demo.OutOfRange")) throw e;
|
|
156
|
+
console.log(`${e.error}: max is ${String(e.parameters.max)}`);
|
|
157
|
+
}
|
|
158
|
+
} finally {
|
|
159
|
+
await conn.close();
|
|
160
|
+
}
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
```sh
|
|
164
|
+
node examples/server.ts # Listening on tcp:127.0.0.1:<port>
|
|
165
|
+
node examples/demo-client.ts tcp:127.0.0.1:<port>
|
|
166
|
+
node examples/client.ts tcp:127.0.0.1:<port> # GetInfo
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
Untyped calls give `Record<string, unknown>`. `conn.oneway(method, params)` sends a oneway call and resolves once it
|
|
170
|
+
is written. `conn.proxy("org.example.demo")` fetches the interface and returns an object with one function per method
|
|
171
|
+
(runtime validation, no codegen).
|
|
172
|
+
|
|
173
|
+
### Typed client (codegen)
|
|
174
|
+
|
|
175
|
+
Generate a module from the IDL (see [Codegen](#codegen)), then:
|
|
176
|
+
|
|
177
|
+
<!-- snippet: examples/codegen/client.ts -->
|
|
178
|
+
```ts
|
|
179
|
+
// A typed client from the generated module: `node examples/codegen/client.ts ADDRESS`.
|
|
180
|
+
import { connect } from "varlink-js/node";
|
|
181
|
+
import { NoSuchNote, OrgExampleNotes } from "./org.example.notes.ts";
|
|
182
|
+
|
|
183
|
+
const address = process.argv[2];
|
|
184
|
+
if (address === undefined) throw new Error("usage: node examples/codegen/client.ts ADDRESS");
|
|
185
|
+
|
|
186
|
+
const conn = await connect(address);
|
|
187
|
+
try {
|
|
188
|
+
const notes = OrgExampleNotes.client(conn); // also works with a Pool
|
|
189
|
+
const { id } = await notes.Add({ text: "buy milk", tags: ["shopping"] });
|
|
190
|
+
const { note } = await notes.Get({ id });
|
|
191
|
+
console.log(`note ${String(note.id)}: ${note.text} [${note.tags.join(", ")}]`);
|
|
192
|
+
|
|
193
|
+
for await (const reply of notes.List.stream()) console.log(`listed: ${reply.note?.text ?? "(none)"}`);
|
|
194
|
+
|
|
195
|
+
try {
|
|
196
|
+
await notes.Get({ id: 999 });
|
|
197
|
+
} catch (e) {
|
|
198
|
+
if (!NoSuchNote.is(e)) throw e;
|
|
199
|
+
console.log(`no note ${String(e.parameters.id)}`); // e.parameters is typed { id: number }
|
|
200
|
+
}
|
|
201
|
+
} finally {
|
|
202
|
+
await conn.close();
|
|
203
|
+
}
|
|
49
204
|
```
|
|
50
205
|
|
|
51
|
-
|
|
206
|
+
Each method of a typed client is callable (one reply) and has `.stream()`, `.collect()` and `.oneway()`. Typed calls
|
|
207
|
+
decode their replies against the IDL as far as the connection's `validateReplies` allows: under the default `"off"`
|
|
208
|
+
(which typed calls treat as `"warn"`) a valid reply is decoded to its type, but an invalid one is delivered raw and
|
|
209
|
+
only reported to `onError` (reason `invalid-reply`); only an out-of-range integer still rejects. Use
|
|
210
|
+
`connect(address, { validateReplies: "throw" })` if every reply must match its type.
|
|
211
|
+
|
|
212
|
+
### Reference server
|
|
213
|
+
|
|
214
|
+
[`examples/reference-server.ts`](examples/reference-server.ts) is a small, safe server to point clients at:
|
|
215
|
+
|
|
216
|
+
```sh
|
|
217
|
+
node examples/reference-server.ts # unix:./org.example.reference.sock, mode 0644
|
|
218
|
+
node examples/reference-server.ts --varlink=tcp:127.0.0.1:0 # prints the real port
|
|
219
|
+
node examples/client.ts unix:./org.example.reference.sock
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
It implements `org.example.reference` (a plain method, a streaming method, typed errors, a method safe to call as
|
|
223
|
+
oneway that keeps at most 16 messages of at most 1 KiB), refuses TCP hosts other than loopback (it never binds
|
|
224
|
+
`0.0.0.0` or `::`), refuses `unix:@` addresses (abstract sockets have no file permissions, so any local user could
|
|
225
|
+
connect), answers `GetInterfaceDescription` only from its registered interfaces (never from the file system), prints
|
|
226
|
+
`Listening on <address>` and shuts down gracefully on SIGINT/SIGTERM with exit code 0. A loopback TCP port is still open
|
|
227
|
+
to every local user; use the default unix socket for owner-only access. Refused addresses exit with 2
|
|
228
|
+
before anything is bound. All of that is checked by `test/docs/examples.test.ts`.
|
|
229
|
+
|
|
230
|
+
## Codegen
|
|
52
231
|
|
|
53
|
-
|
|
54
|
-
import { VarlinkServer } from "varlink-js/server/server";
|
|
55
|
-
import { SocketServerSideTransport } from "varlink-js/transport/node-socket";
|
|
56
|
-
import { OrgVarlinkService } from "varlink-js/schemas/org.varlink.service.varlink";
|
|
232
|
+
`generate(idl, options)` from `varlink-js/codegen` turns one interface into one TypeScript module:
|
|
57
233
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
234
|
+
<!-- snippet: examples/codegen/generate.ts#generate -->
|
|
235
|
+
```ts
|
|
236
|
+
const idl = readFileSync(new URL("org.example.notes.varlink", import.meta.url), "utf8");
|
|
237
|
+
const { fileName, code, constName } = generate(idl, options); // options: { ints?: "number" | "bigint", importPath? }
|
|
238
|
+
// fileName: "org.example.notes.ts", constName: "OrgExampleNotes"
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
The CLI does the same, from files or from a running service:
|
|
242
|
+
|
|
243
|
+
```sh
|
|
244
|
+
varlink-js codegen org.example.notes.varlink -o generated # writes generated/org.example.notes.ts
|
|
245
|
+
varlink-js codegen --address unix:/run/org.example.sock org.example.notes -o generated
|
|
246
|
+
varlink-js codegen org.example.notes.varlink > notes.ts # one input without -o: stdout
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
Options: `--ints=number|bigint` (default `number`), `--import-path=SPEC` (the module the generated code imports,
|
|
250
|
+
default `varlink-js`). `generateFromService(connOrPool, name)` is the API form of `--address`.
|
|
251
|
+
|
|
252
|
+
What a generated module exports, for an interface `org.example.notes` (descriptor name `OrgExampleNotes`):
|
|
253
|
+
|
|
254
|
+
| Export | What |
|
|
255
|
+
|---|---|
|
|
256
|
+
| `OrgExampleNotes_IDL` | The IDL text, verbatim (served by `GetInterfaceDescription`). |
|
|
257
|
+
| `Note`, … | One `type` per IDL `type`; named enums also get `<Name>_Values` (a const array). |
|
|
258
|
+
| `Add_Input`, `Add_Output`, … | Parameters and result of each method. |
|
|
259
|
+
| `NoSuchNote` (+ `NoSuchNote_Parameters`) | One class per IDL error, extending `VarlinkError`, with `errorName` and a static `is(e)` guard. |
|
|
260
|
+
| `OrgExampleNotes` | The descriptor: `name`, `idl`, `ints`, `methods`, `errors`, and `client(connOrPool)`. |
|
|
261
|
+
| `OrgExampleNotes_Client`, `OrgExampleNotes_Handlers`, `OrgExampleNotes_Descriptor` | The typed client, the handlers object for `server.implement()`, the descriptor type. |
|
|
262
|
+
|
|
263
|
+
The output is deterministic and starts with a header naming the generator version and the source's SHA-256, so it can
|
|
264
|
+
be committed; `examples/codegen/org.example.notes.ts` is, and a test regenerates it and fails if it is stale. The
|
|
265
|
+
`ints` mode is recorded in the descriptor and must match the connection's or server's (a `TypeError` otherwise, for
|
|
266
|
+
interfaces that use `int`). A typed server:
|
|
267
|
+
|
|
268
|
+
<!-- snippet: examples/codegen/server.ts -->
|
|
269
|
+
```ts
|
|
270
|
+
// A typed server from the generated module: `node examples/codegen/server.ts [ADDRESS]` (default tcp:127.0.0.1:0).
|
|
271
|
+
import { createServer, streamOf } from "varlink-js";
|
|
272
|
+
import { listen } from "varlink-js/node";
|
|
273
|
+
import { NoSuchNote, OrgExampleNotes, type Note } from "./org.example.notes.ts";
|
|
274
|
+
|
|
275
|
+
const notes = new Map<number, Note>();
|
|
276
|
+
let nextId = 1;
|
|
277
|
+
|
|
278
|
+
const server = createServer({ vendor: "Example", product: "notes", version: "1.0", url: "https://example.org" });
|
|
279
|
+
// Handlers are typed from the IDL: parameters, results and yielded replies.
|
|
280
|
+
server.implement(OrgExampleNotes, {
|
|
281
|
+
Add({ text, tags }) {
|
|
282
|
+
const id = nextId++;
|
|
283
|
+
notes.set(id, { id, text, tags: tags ?? [] });
|
|
284
|
+
return { id };
|
|
285
|
+
},
|
|
286
|
+
Get({ id }) {
|
|
287
|
+
const note = notes.get(id);
|
|
288
|
+
if (note === undefined) throw new NoSuchNote({ id }); // a generated error class
|
|
289
|
+
return { note };
|
|
290
|
+
},
|
|
291
|
+
// streamOf() holds one item back so the last note goes out as the final reply.
|
|
292
|
+
async *List() {
|
|
293
|
+
return yield* streamOf([...notes.values()].map((note) => ({ note })));
|
|
294
|
+
},
|
|
61
295
|
});
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
296
|
+
|
|
297
|
+
const listener = await listen(process.argv[2] ?? "tcp:127.0.0.1:0", { mode: 0o644 });
|
|
298
|
+
server.serve(listener);
|
|
299
|
+
const stop = (): void => {
|
|
300
|
+
void server.shutdown().then(() => process.exit(0));
|
|
301
|
+
};
|
|
302
|
+
process.once("SIGINT", stop);
|
|
303
|
+
process.once("SIGTERM", stop);
|
|
304
|
+
|
|
305
|
+
// Handlers first, then the line the caller waits for, so an early signal still shuts down cleanly.
|
|
306
|
+
console.log(`Listening on ${listener.address}`);
|
|
72
307
|
```
|
|
73
308
|
|
|
74
|
-
|
|
309
|
+
## CLI
|
|
310
|
+
|
|
311
|
+
`varlink-js [OPTIONS…] COMMAND …` (`npx varlink-js` once installed; `node src/cli/main.ts` from a checkout).
|
|
312
|
+
`varlink-js --help` prints the full usage.
|
|
313
|
+
|
|
314
|
+
| Command | Does | varlinkctl |
|
|
315
|
+
|---|---|---|
|
|
316
|
+
| `info ADDRESS` | Service information (GetInfo) | `varlinkctl info` |
|
|
317
|
+
| `list-interfaces ADDRESS` | Interfaces of the service | `varlinkctl list-interfaces` |
|
|
318
|
+
| `list-methods ADDRESS [INTERFACE…]` | Methods of the service or of the given interfaces | `varlinkctl list-methods` (newer systemd; not in 255) |
|
|
319
|
+
| `introspect ADDRESS [INTERFACE…]` | Interface definitions (all when none given) | `varlinkctl introspect` |
|
|
320
|
+
| `call ADDRESS METHOD [PARAMETERS]` | Calls a method; parameters as a JSON object, or stdin | `varlinkctl call` |
|
|
321
|
+
| `validate-idl [FILE]` | Validates an interface definition | `varlinkctl validate-idl` |
|
|
322
|
+
| `format [FILE…]` | Canonical formatting (`--check`, `-i`) | libvarlink's `varlink format` |
|
|
323
|
+
| `codegen FILE…`, `codegen --address ADDRESS INTERFACE…` | TypeScript, see [Codegen](#codegen) | — |
|
|
324
|
+
| `bridge ADDRESS` | Raw bytes between stdin/stdout and ADDRESS, for `--bridge` style use (unix, `unix:@`, tcp only) | — |
|
|
325
|
+
| `certify server ADDRESS`, `certify client ADDRESS` | `org.varlink.certification` server / client | python/rust certification |
|
|
326
|
+
|
|
327
|
+
- `call --more` prints the replies as JSON-SEQ (RFC 7464) as they arrive, like varlinkctl; `-E` is
|
|
328
|
+
`--more --timeout=infinity`; `--collect` prints one array; `--oneway` exits once the call is written;
|
|
329
|
+
`--graceful=ERROR` treats that error reply as success.
|
|
330
|
+
- Global options: `--json=pretty|short|off`, `-j`, `-q`. `--timeout=SECS` (a systemd time span, default 45 s,
|
|
331
|
+
`infinity` for none) is accepted by the commands that talk to a service: `info`, `list-interfaces`, `list-methods`,
|
|
332
|
+
`introspect`, `call`, `codegen`, `bridge` and `certify` (not by `validate-idl` or `format`). Unlike the library's
|
|
333
|
+
stream timeout, the CLI's timeout covers the connect and the whole call, `--more` included, as in varlinkctl.
|
|
334
|
+
- Exit status: 0 on success, 1 on any failure, 130/143 after SIGINT/SIGTERM; `call --exec` returns the command's
|
|
335
|
+
exit status (128 + the signal number if a signal ended it); `certify server` exits 0 after a signal (it stops
|
|
336
|
+
gracefully).
|
|
337
|
+
- `call --upgrade ADDRESS METHOD [PARAMS]` (as varlinkctl): after the confirming reply, stdin goes to the service and
|
|
338
|
+
its bytes to stdout until both sides are done; parameters come from the command line only. `--upgrade --exec` is
|
|
339
|
+
not supported.
|
|
340
|
+
- `call --push-fd=FD|PATH` and `call --exec ADDRESS METHOD PARAMS -- CMD…` (as varlinkctl; PARAMS is required) need the optional
|
|
341
|
+
`varlink-js-native` addon (Linux; see `native/README.md`; `VARLINK_JS_NATIVE=<path to native/index.js>` points the
|
|
342
|
+
CLI at a local build). Not available yet: `serve` and `list-registry`.
|
|
343
|
+
- Integers are lossless in the CLI (it uses `ints: "bigint"` internally): 2⁶³−1 and 2⁶⁴−1 round-trip.
|
|
344
|
+
|
|
345
|
+
## Addresses
|
|
346
|
+
|
|
347
|
+
`parseAddress()` (from `varlink-js`) parses every kind below; which function dials or listens depends on the kind.
|
|
348
|
+
|
|
349
|
+
| Kind | Example | Client | Server | Notes |
|
|
350
|
+
|---|---|---|---|---|
|
|
351
|
+
| unix path | `unix:/run/org.example.sock`, `/run/x.sock`, `./x.sock` | `connect` (`varlink-js/node`) | `listen` | `listen(address, { mode })` sets the socket's mode; an existing live socket is never replaced (`EADDRINUSE`). |
|
|
352
|
+
| abstract unix | `unix:@org.example` | `connect` | `listen` | Linux only; elsewhere `OperationNotSupportedError`. No file permissions: `mode` is ignored and any local user in the network namespace can connect. |
|
|
353
|
+
| tcp | `tcp:127.0.0.1:12345`, `tcp:[::1]:12345` | `connect` (`TCP_NODELAY`) | `listen` | Port 0 picks a free port (`listener.address` has the real one). Binds exactly the host given. |
|
|
354
|
+
| exec | `exec:/usr/libexec/org.example.service` | `connect`, `connectExec` | the child: `listenFromEnv()` / `listenAuto()` | Spawns the service with a connected socket as fd 3 (`LISTEN_FDS=1`). Tested on Node, Bun and Deno. |
|
|
355
|
+
| ssh | `ssh-unix:host:/run/x.sock` (alias `ssh:`), `ssh-exec:host:command` | `connect` | the remote side: `listenAuto()` with `SYSTEMD_VARLINK_LISTEN=-` | Runs `ssh` (or `$SYSTEMD_SSH`). CI uses a fake ssh (on Node, Bun and Deno); real ssh is not tested in CI. |
|
|
356
|
+
| inherited socket | fd from systemd | — | `listen({ fd })`, `listenFromEnv()` | Socket activation, see below. |
|
|
357
|
+
| stdio | a command line | `connectBridge(argv)` | `listenStdio()` | Speaks varlink over a child's stdin/stdout / our own. Tested on Node, Bun and Deno. |
|
|
358
|
+
| WebSocket | `ws://host/…`, `wss://…`, `https://host/ws/services/<service>` | `connect`, `createPool` (`varlink-js/websocket`) | — | Needs `globalThis.WebSocket` or the `WebSocket` option. No server side. |
|
|
359
|
+
| HTTP | `https://host/…` (a varlink HTTP bridge) | `createHttpClient` (`varlink-js/http`) | — | No oneway (rejects), no upgrade, one request per call. No server side. |
|
|
360
|
+
| any `ByteChannel` | your own transport | `createConnection(channel)` | `server.handle(channel)`, `server.serve(listener)` | `varlink-js/testing` `pair()` gives an in-memory pair. |
|
|
361
|
+
|
|
362
|
+
`connect()` from `varlink-js/node` rejects WebSocket and HTTP addresses with `OperationNotSupportedError`; use the
|
|
363
|
+
subpaths above.
|
|
364
|
+
|
|
365
|
+
## Limits and defaults
|
|
366
|
+
|
|
367
|
+
| Limit | Default | Option | Checked by |
|
|
368
|
+
|---|---|---|---|
|
|
369
|
+
| Largest message (client, server, HTTP client) | 16 MiB | `maxMessageSize` | `test/docs/defaults.test.ts`, `test/unit/protocol/framer.test.ts` |
|
|
370
|
+
| Complete calls buffered per server connection (then reading stops) | 64 | `maxQueuedCalls` (server) | `test/docs/defaults.test.ts`, `test/unit/protocol/server-session.test.ts` |
|
|
371
|
+
| Received fds held by buffered, not yet dispatched calls per server connection (then reading stops; one message carrying more is still accepted). The framer holds at most `maxQueuedFds` − 1 + one read's fds, plus the fds of the call being handled: about 758 per connection in the worst case at the default (sd-varlink holds 253) | 253 (`SCM_MAX_FD`) | `maxQueuedFds` (server, with `allowFdPassingInput`) | `test/unit/protocol/server-session.test.ts`, `test/unit/rpc/server.test.ts`; `test/docs/defaults.test.ts` checks the constant's value only |
|
|
372
|
+
| Open server connections (more are closed at once) | 4096 | `maxConnections` (server) | `test/docs/defaults.test.ts` |
|
|
373
|
+
| Connections per UID | off (opt-in, as sd-varlink's `SD_VARLINK_SERVER_ACCOUNT_UID`; needs the native addon) | `maxConnectionsPerUid` (server) | `test/unit/rpc/server-peer.test.ts` |
|
|
374
|
+
| Call timeout (clock starts at the head of the reply queue) | 45 s, 0 = none | `timeout` (connection, or per call) | `test/docs/defaults.test.ts`, `test/unit/rpc/connection.test.ts` |
|
|
375
|
+
| Connect phase (`connect()`) | the same `timeout` (45 s) | `timeout`, `signal` | `test/docs/defaults.test.ts`, `test/unit/node/connect.test.ts` |
|
|
376
|
+
| Stream replies buffered unread (then reading pauses) | 64 | `highWaterMark` (connection) | `test/docs/defaults.test.ts`, `test/unit/rpc/connection.test.ts` |
|
|
377
|
+
| `collect()` replies (more: `RangeError`, connection closed) | 1024 | `max` (per call) | `test/unit/rpc/connection.test.ts`; `test/docs/defaults.test.ts` checks the constant's value only |
|
|
378
|
+
| Pool connections | 8 | `max` (pool) | `test/docs/defaults.test.ts` |
|
|
379
|
+
| Pool idle connection lifetime | 30 s, 0 = forever | `idleTimeout` (pool) | `test/docs/defaults.test.ts` |
|
|
380
|
+
| Pool wait for a connection | 45 s, 0 = forever | `timeout` (pool, or per call) | `test/docs/defaults.test.ts` |
|
|
381
|
+
| Graceful shutdown deadline | 5 s, 0 = none | `server.shutdown({ timeout })` | `test/docs/defaults.test.ts`, `test/unit/rpc/server.test.ts` |
|
|
382
|
+
| Idle timeout of server connections | none (an idle client is never dropped) | — | `test/regression/e2e.test.ts` |
|
|
383
|
+
| JSON nesting when decoding | 2048 levels | fixed | `test/unit/types/codec.test.ts` |
|
|
384
|
+
| Value nesting when validating | 1024 levels (`MAX_VALUE_DEPTH`) | fixed | `test/unit/types/validators.test.ts`; `test/docs/defaults.test.ts` checks the constant's value only |
|
|
385
|
+
| IDL type nesting | 64 levels (`MAX_TYPE_DEPTH`) | fixed | `test/unit/idl/errors.test.ts`; `test/docs/defaults.test.ts` checks the constant's value only |
|
|
386
|
+
| WebSocket bytes received but unread (then the socket is closed) | 64 MiB | `maxBufferedBytes` | `test/docs/defaults.test.ts` |
|
|
387
|
+
| WebSocket `write()` resolves while `bufferedAmount` is at most | 1 MiB | `writeHighWaterMark` | `test/docs/defaults.test.ts` |
|
|
388
|
+
| `LISTEN_FDS` accepted by `listenFromEnv()` | 1 … 1024 | — | `test/unit/node/activation.test.ts` |
|
|
389
|
+
|
|
390
|
+
`test/docs/defaults.test.ts` creates each object without the option and checks that it enforces the default (for
|
|
391
|
+
the sizes: exactly the default is accepted, one byte more is not), with a mocked clock for the times.
|
|
392
|
+
|
|
393
|
+
Options go to `connect()`/`createConnection()` (connection), `createServer()` (server), `createPool()` (pool),
|
|
394
|
+
`createHttpClient()` and `varlink-js/websocket` `connect()`. Each server connection handles one call at a time;
|
|
395
|
+
pipelined calls wait in its queue.
|
|
396
|
+
|
|
397
|
+
## Cancellation and timeouts
|
|
398
|
+
|
|
399
|
+
Varlink has no cancel message: a client that loses interest closes the connection (UAPI). So:
|
|
400
|
+
|
|
401
|
+
- **`signal` on a call** (`conn.call(m, p, { signal })`): the call rejects with `signal.reason`. If the call was not
|
|
402
|
+
written yet (already aborted, or still queued behind others) it is just dropped and the connection stays open. If it
|
|
403
|
+
was written, the connection is **closed**, and every other pending call on it rejects with `ConnectionClosedError`
|
|
404
|
+
(its `cause` is the reason).
|
|
405
|
+
- **`timeout`** (default 45 s): the clock starts when the call reaches the head of the reply queue, not when it is
|
|
406
|
+
queued, so a call waiting behind a long stream cannot time out. Expiry rejects with `CallTimeoutError` and closes the
|
|
407
|
+
connection.
|
|
408
|
+
- **Streams**: for `stream()`, `timeout` covers only the time to the first reply (subscriptions may run forever);
|
|
409
|
+
`idleTimeout` (default none) limits the gap between replies. Leaving a `for await` early (`break`, `return`, a throw)
|
|
410
|
+
closes the connection if the call was already written. A stream nobody reads stops the connection from reading
|
|
411
|
+
after `highWaterMark` replies, so later calls on that connection wait behind it.
|
|
412
|
+
- **Independent cancellation**: use a `Pool`; each operation leases its own connection, so closing one does not affect
|
|
413
|
+
the others.
|
|
414
|
+
- **`conn.close(reason)`** rejects every pending call with `ConnectionClosedError` (`cause` = reason).
|
|
415
|
+
- **Server side**: a handler's `ctx.signal` aborts when the client disconnects or the server shuts down; check it in
|
|
416
|
+
long-running work. `ctx.notify(params)` (a `continues` reply from a plain async handler) rejects with
|
|
417
|
+
`ConnectionClosedError` once the connection is gone. A oneway call to a generator handler runs only up to its first
|
|
418
|
+
`yield`.
|
|
419
|
+
- **Graceful shutdown**: `server.shutdown()` closes the listeners, aborts every active call's signal but still writes
|
|
420
|
+
its reply, drops calls that were buffered but not started, and closes what is left after `timeout` (5 s; `0` waits
|
|
421
|
+
for every handler). `shutdown({ graceful: false })` closes everything at once. `server.closed` resolves after any
|
|
422
|
+
shutdown.
|
|
423
|
+
- **HTTP mode**: a call's `signal` aborts its request; there is no connection to close.
|
|
424
|
+
|
|
425
|
+
## Errors
|
|
426
|
+
|
|
427
|
+
```text
|
|
428
|
+
Error
|
|
429
|
+
├─ VarlinkError an error reply on the wire: .error (name), .parameters; isVarlinkError(e, name?)
|
|
430
|
+
│ ├─ InterfaceNotFoundError, MethodNotFoundError, MethodNotImplementedError, InvalidParameterError,
|
|
431
|
+
│ │ PermissionDeniedError, ExpectedMoreError, ExpectedUpgradeError (org.varlink.service)
|
|
432
|
+
│ ├─ InternalError io.github.pzmarzly.varlinkjs.InternalError
|
|
433
|
+
│ └─ generated error classes (codegen)
|
|
434
|
+
├─ VarlinkLocalError never on the wire: .localName; isVarlinkLocalError(e, name?)
|
|
435
|
+
│ ├─ ConnectionClosedError, CallTimeoutError, UpgradePendingError, OperationNotSupportedError
|
|
436
|
+
│ ├─ ProtocolError ── MessageTooLargeError
|
|
437
|
+
│ ├─ ValidationError ── IntegerRangeError (.parameter: dotted path of the bad value)
|
|
438
|
+
│ └─ HttpBridgeError (varlink-js/http)
|
|
439
|
+
└─ IdlSyntaxError (a SyntaxError, varlink-js/idl)
|
|
440
|
+
```
|
|
441
|
+
|
|
442
|
+
- An aborted call rejects with the signal's own reason (whatever was passed to `abort(reason)`; by default an
|
|
443
|
+
`AbortError` `DOMException`, a `TimeoutError` one for `AbortSignal.timeout()`), not a wrapper.
|
|
444
|
+
- `isVarlinkError(e, name?)` and `isVarlinkLocalError(e, localName?)` are brand checks, so they work even with two
|
|
445
|
+
copies of the library loaded. The standard error classes, `InternalError` and generated error classes also have a
|
|
446
|
+
static `is(e)` (e.g. `MethodNotFoundError.is(e)`); the local error classes, `HttpBridgeError` and `IdlSyntaxError`
|
|
447
|
+
do not. Check a local error by its `localName`: `io.systemd.Disconnected` (`ConnectionClosedError`),
|
|
448
|
+
`io.systemd.TimedOut` (`CallTimeoutError`), `io.systemd.Protocol` (`ProtocolError`, `MessageTooLargeError`),
|
|
449
|
+
`org.varlink.service.InvalidParameter` (`ValidationError`, `IntegerRangeError`), `varlink-js.UpgradePending`,
|
|
450
|
+
`varlink-js.OperationNotSupported`, `varlink-js.HttpBridge`.
|
|
451
|
+
- Clients map error replies to classes: the standard errors and `InternalError` always, generated classes once their
|
|
452
|
+
interface is registered (`X.client(conn)` does that). Unknown names give a plain `VarlinkError` with the name and
|
|
453
|
+
parameters intact.
|
|
454
|
+
- Servers send standard errors per the UAPI dispatch rules: an unknown interface gives `InterfaceNotFound`, an unknown
|
|
455
|
+
method of a known interface `MethodNotFound`, a method without a handler `MethodNotImplemented`, parameters that fail
|
|
456
|
+
validation `InvalidParameter` (with the dotted path), a method marked `[Requires 'more' flag]` called without `more`
|
|
457
|
+
`ExpectedMore`. Nothing at all is sent for a oneway call, errors included.
|
|
458
|
+
- **Typed errors**: throw a `VarlinkError` (`new VarlinkError("org.example.demo.OutOfRange", { n, max })`) or a
|
|
459
|
+
generated class (`new NoSuchNote({ id })`). When the error's interface is registered on the server, the error must be
|
|
460
|
+
declared there and its parameters must match; otherwise the client gets `InternalError` instead and `onError` is
|
|
461
|
+
called with reason `invalid-error`. Errors of interfaces the server does not know are sent unchecked.
|
|
462
|
+
- **Unexpected exceptions**: a handler that throws anything that is not a `VarlinkError` makes the server reply
|
|
463
|
+
`io.github.pzmarzly.varlinkjs.InternalError` with no parameters. The details (message, stack) go only to the
|
|
464
|
+
server's `onError(error, { method, reason })` hook (default: a one-line `console.warn` with the reason), never to
|
|
465
|
+
the client. Every server registers the interface `io.github.pzmarzly.varlinkjs` (the constant
|
|
466
|
+
`INTERNAL_ERROR_INTERFACE`), so the error is introspectable. The interface name is provisional (DESIGN §9 Q2) and may
|
|
467
|
+
change before 1.0.
|
|
468
|
+
|
|
469
|
+
## Integers
|
|
470
|
+
|
|
471
|
+
| `ints` | `int` is | Notes |
|
|
472
|
+
|---|---|---|
|
|
473
|
+
| `"number"` (default) | `number` | A validated value outside ±(2⁵³−1) fails with `IntegerRangeError` instead of losing precision: a server answers `InvalidParameter`, a typed call rejects. Unvalidated replies (untyped calls, `validateReplies: "off"`) keep such values as `bigint`. |
|
|
474
|
+
| `"bigint"` (opt-in) | `bigint` | Exact 64-bit values. Needs `JSON.parse` revivers with `context.source` and `JSON.rawJSON` (Node.js ≥ 22.12 has both; the CI `floor` job checks 22.12.0); without them `OperationNotSupportedError`. |
|
|
475
|
+
|
|
476
|
+
Set it on `connect()`/`createConnection()`, `createServer()`, `createHttpClient()` and `generate()`/`--ints`; a
|
|
477
|
+
generated descriptor must match its target's mode when the interface uses `int`.
|
|
478
|
+
|
|
479
|
+
## Socket activation and friends
|
|
480
|
+
|
|
481
|
+
All from `varlink-js/node`:
|
|
482
|
+
|
|
483
|
+
- `await listenFromEnv()`: the sockets systemd passed (`LISTEN_FDS`, `LISTEN_PID`, the fds named `varlink` in
|
|
484
|
+
`LISTEN_FDNAMES`, or another name with `{ name }`), or `null` if the process was not socket-activated or no fd has
|
|
485
|
+
that name. systemd names an fd after its socket unit unless the unit sets `FileDescriptorName=varlink`, so without
|
|
486
|
+
that line you get `null`. Only when `LISTEN_FDNAMES` is absent is a single fd used whatever its name. Unsets the
|
|
487
|
+
variables.
|
|
488
|
+
- `listenAuto()`: `listenFromEnv()` plus `$SYSTEMD_VARLINK_LISTEN` (an address, or `-` for stdio), merged into one
|
|
489
|
+
listener, or `null`.
|
|
490
|
+
- `listenStdio()`: one connection over stdin/stdout. A stdio-served process must exit when that connection ends
|
|
491
|
+
(`exitOnIdle` plus `await server.closed`).
|
|
492
|
+
- `createServer({ exitOnIdle: ms })`: once serving, the server shuts down after `ms` without any open connection;
|
|
493
|
+
`await server.closed` then exit.
|
|
494
|
+
- Registry (`/run/varlink/registry`, systemd ≥ 260): `server.serve(listener, { registry: true })` publishes a unix
|
|
495
|
+
socket listener under its interface names and removes the entries at shutdown (except for a socket-activated
|
|
496
|
+
`{ fd }` listener: the socket belongs to the service manager and outlives us, so its entries stay); `listRegistry()`,
|
|
497
|
+
`resolveInterface(name)` (registry first, then `org.varlink.resolver`).
|
|
498
|
+
|
|
499
|
+
Activation fds are close-on-exec only when `listenFromEnv` gets the native addon (`{ native }`); without it, children
|
|
500
|
+
you spawn yourself inherit them.
|
|
501
|
+
`LISTEN_PIDFDID` is ignored.
|
|
502
|
+
|
|
503
|
+
## Runtimes
|
|
504
|
+
|
|
505
|
+
| Runtime | CI | What runs |
|
|
506
|
+
|---|---|---|
|
|
507
|
+
| Node.js 22, 24, 26 (latest of each) | `ci.yml` `test` | everything (`npm test`), plus `npm pack` and the consumer fixture |
|
|
508
|
+
| Node.js 22.12.0 (the `engines` floor) | `ci.yml` `floor` | compiled `runtime-features` and `exports` tests, the packed tarball |
|
|
509
|
+
| Bun (latest) | `runtimes.yml` `bun` | `test/unit` and `test/regression` (on Linux), the spawn (`exec:`, fake ssh, bridge) and activation tests included. Skipped on Bun: the three abort/timeout-during-spawn tests of `test/unit/node/spawn.test.ts` (no `child_process` diagnostics channel), its bridge test that needs EOF from a still-running stdio server (`process.stdout.end()` sends no FIN), the "no timers once shut down" test of `test/unit/rpc/exit-on-idle.test.ts`, and the cross-copy `isVarlinkError` test of `test/regression/tooling.test.ts` (Bun's module cache ignores the query). The `listen({ fd })` tests of `test/unit/node/fd.test.ts` skip themselves on any runtime whose `net.Server` exposes no fd |
|
|
510
|
+
| Deno 2 | `runtimes.yml` `deno` | the same suites. Skipped on Deno: the same stdio-EOF bridge test, and the "nonblocking" connected activation fd tests of `test/unit/node/connected-fd.test.ts` (a `net.Socket` has no real fd) |
|
|
511
|
+
| Browsers | — | `varlink-js`, `varlink-js/websocket`, `varlink-js/http` and `varlink-js/idl` import nothing from Node (a lint rule and a typecheck without `@types/node` enforce it), but no browser test runs in CI |
|
|
512
|
+
|
|
513
|
+
## What is tested where
|
|
514
|
+
|
|
515
|
+
| Feature | Tests | CI job |
|
|
516
|
+
|---|---|---|
|
|
517
|
+
| Regressions of the 0.1.x bugs (F1–F17: crashes, oneway replies, wrong standard errors, timeouts, unbounded buffers, …) | `test/regression/e2e.test.ts`, `test/regression/session.test.ts`, `test/regression/sockets.test.ts` | `ci.yml` test; `runtimes.yml` bun, deno |
|
|
518
|
+
| Protocol: framing, message rules, dispatch table | `test/unit/protocol/` | `ci.yml` test; bun, deno |
|
|
519
|
+
| Connection: timeouts, abort, streams, collect, backpressure | `test/unit/rpc/connection.test.ts` | `ci.yml` test; bun, deno |
|
|
520
|
+
| Server: registration, limits, shutdown, InternalError | `test/unit/rpc/server.test.ts`, `test/fuzz/server.test.ts` | `ci.yml` test; bun, deno (fuzz: `ci.yml` only) |
|
|
521
|
+
| Pool | `test/unit/rpc/pool.test.ts` | `ci.yml` test; bun, deno |
|
|
522
|
+
| The defaults in this README | `test/docs/defaults.test.ts` | `ci.yml` test |
|
|
523
|
+
| unix and tcp `connect`/`listen`, socket mode | `test/unit/node/connect.test.ts`, `test/unit/node/listen.test.ts` | `ci.yml` test; bun, deno |
|
|
524
|
+
| `unix:@` (Linux) | `test/unit/node/abstract.test.ts` | `ci.yml` test; bun, deno |
|
|
525
|
+
| `exec:`, ssh (fake ssh), bridge | `test/unit/node/spawn.test.ts`, `test/unit/node/spawn-channel.test.ts`, `test/unit/cli/call.test.ts` | `ci.yml` test; bun, deno (a few tests skipped, see [Runtimes](#runtimes)) |
|
|
526
|
+
| Socket activation, `listenAuto`, stdio, `listen({ fd })` | `test/unit/node/activation.test.ts`, `test/unit/node/connected-fd.test.ts`, `test/unit/node/fd.test.ts` | `ci.yml` test; bun, deno (Deno skips the nonblocking connected-fd tests; the `listen({ fd })` tests skip themselves on a runtime whose `net.Server` exposes no fd) |
|
|
527
|
+
| Real `systemd-socket-activate`, `varlinkctl exec:`, the registry via `varlinkctl` (each runs only when its tool is on `PATH` and skips silently otherwise; nothing makes CI fail if the runner lacks it) | `test/interop/vm/socket-activate.test.ts`, `test/interop/vm/varlinkctl-exec.test.ts`, `test/interop/vm/registry.test.ts` | `ci.yml` test |
|
|
528
|
+
| `exitOnIdle` | `test/unit/rpc/exit-on-idle.test.ts` | `ci.yml` test; bun, deno (one test skipped on Bun) |
|
|
529
|
+
| Registry, resolver | `test/unit/node/registry.test.ts`, `test/unit/node/registry-serve.test.ts`, `test/unit/node/resolver.test.ts` | `ci.yml` test; bun, deno |
|
|
530
|
+
| WebSocket and HTTP clients | `test/unit/websocket/`, `test/unit/http/` | `ci.yml` test; bun, deno |
|
|
531
|
+
| IDL parser, validator, formatter (corpus incl. systemd interfaces) | `test/unit/idl/` | `ci.yml` test; bun, deno |
|
|
532
|
+
| Codegen | `test/unit/codegen/` | `ci.yml` test; bun, deno |
|
|
533
|
+
| CLI, in-process | `test/unit/cli/` | `ci.yml` test; bun, deno |
|
|
534
|
+
| CLI as a process (signals, EPIPE, bridge, certify) | `test/e2e/cli/cli.test.ts` | `ci.yml` test |
|
|
535
|
+
| Certification, JS client ↔ JS server | `test/interop/certification.test.ts` | `ci.yml` test; `interop.yml` python |
|
|
536
|
+
| python-varlink certification both ways, unix and tcp | `test/interop/python.test.ts` | `interop.yml` python (ubuntu, macOS) |
|
|
537
|
+
| rust varlink certification both ways, unix and tcp | `test/interop/rust.test.ts` | `interop.yml` rust |
|
|
538
|
+
| `varlinkctl` against our server, `validate-idl`, the userdb Multiplexer | `test/interop/varlinkctl.test.ts` | `interop.yml` varlinkctl (systemd 255 and 259) |
|
|
539
|
+
| `exports` map, the packed package in a consumer project | `test/unit/exports.test.ts`, `test/fixtures/consumer/run.js` | `ci.yml` test, floor |
|
|
540
|
+
| Examples, README/MIGRATION code blocks, release workflow guards | `test/docs/examples.test.ts`, `test/docs/snippets.test.ts`, `test/docs/release-workflow.test.ts` | `ci.yml` test |
|
|
541
|
+
| Runtime layering (no Node imports in the portable entry points) | `test/tooling/lint-boundaries.test.ts` | `ci.yml` test |
|
|
542
|
+
|
|
543
|
+
**Not covered by CI:**
|
|
544
|
+
|
|
545
|
+
- Real ssh (`test/interop/vm/ssh.test.ts` needs `VARLINK_SSH_*` variables) and `systemd-pcrextend` as root
|
|
546
|
+
(`test/interop/vm/pcrextend.test.ts`).
|
|
547
|
+
- The non-Linux rejection of `unix:@` (`test/unit/node/connect.test.ts`, `test/unit/node/listen.test.ts`): every
|
|
548
|
+
`ci.yml` job runs on Linux.
|
|
549
|
+
- Byte-for-byte comparison of the CLI's output with varlinkctl: done by hand against systemd 255
|
|
550
|
+
(`test/e2e/cli/varlinkctl/`).
|
|
551
|
+
- Windows and browsers. On Bun and Deno: everything outside `test/unit` and `test/regression` (the CLI as a process
|
|
552
|
+
in `test/e2e`, the examples and docs checks in `test/docs`, `test/fuzz`, `test/interop`), plus the skips listed
|
|
553
|
+
under [Runtimes](#runtimes).
|
|
554
|
+
|
|
555
|
+
## Not yet implemented
|
|
556
|
+
|
|
557
|
+
- **No prebuilt binaries for `varlink-js-native`** (fd passing, peer credentials, per-UID limits, `user.varlink`
|
|
558
|
+
xattr): it is built from source with a C compiler, Linux only, and not published. Without it those features are
|
|
559
|
+
absent and fd-using calls fail with `OperationNotSupportedError`.
|
|
560
|
+
- **No WebSocket or HTTP server**: those subpaths are clients only.
|
|
561
|
+
- **HTTP mode has no oneway calls** (`HttpClient.oneway()` rejects with `OperationNotSupportedError`).
|
|
562
|
+
- The `org.varlink.resolver` client does `Resolve` and `GetInfo` only, untyped; there is no resolver server.
|
|
75
563
|
|
|
76
564
|
## Certification
|
|
77
565
|
|
|
78
|
-
|
|
79
|
-
# JS client, JS server
|
|
80
|
-
bun run test
|
|
566
|
+
[`examples/certification/`](examples/certification/) has an `org.varlink.certification` server and client:
|
|
81
567
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
568
|
+
```sh
|
|
569
|
+
node examples/certification/server.ts --varlink=tcp:127.0.0.1:0 # prints the port
|
|
570
|
+
python -m varlink.tests.test_certification --client --varlink=tcp:127.0.0.1:<port>
|
|
85
571
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
python3 -m varlink.tests.test_certification --client --varlink=tcp:127.0.0.1:12345
|
|
572
|
+
python -u -m varlink.tests.test_certification --varlink=tcp:127.0.0.1:12345 &
|
|
573
|
+
node examples/certification/client.ts --varlink=tcp:127.0.0.1:12345
|
|
89
574
|
```
|
|
90
575
|
|
|
576
|
+
The rust `varlink-certification` binary works the same way (`--varlink=…` / `--client --varlink=…`); see
|
|
577
|
+
[examples/certification/README.md](examples/certification/README.md). CI runs python-varlink 31.0.0 (ubuntu and
|
|
578
|
+
macOS) and rust varlink (a pinned commit) both ways over unix and tcp (`interop.yml`).
|
|
579
|
+
|
|
91
580
|
## License
|
|
92
581
|
|
|
93
|
-
MIT
|
|
582
|
+
MIT, see [LICENSE](LICENSE).
|