{"id":47437,"library":"dwarf-client","title":"dwarf-client","description":"A gRPC client library for the Dwarf URL shortening microservice. Version 1.0.7 provides a simple async API to shorten multiple URLs via a gRPC endpoint configured through the DWARF_GRPC_SERVER environment variable. It is designed for Node.js web servers and uses @grpc/grpc-js for gRPC connectivity. The library is minimal and focuses on batch shortening with error propagation. Compared to HTTP-based URL shorteners, it offers lower latency through gRPC streaming. Release cadence is irregular; no recent updates since 1.0.7.","status":"active","version":"1.0.7","language":"javascript","source_language":"en","source_url":null,"tags":["javascript"],"install":[{"cmd":"npm install dwarf-client","lang":"bash","label":"npm"},{"cmd":"yarn add dwarf-client","lang":"bash","label":"yarn"},{"cmd":"pnpm add dwarf-client","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Required for gRPC client connectivity.","package":"@grpc/grpc-js","optional":false}],"imports":[{"note":"Package is ESM-only. Use import syntax in Node.js with ESM enabled.","wrong":"const shorten = require('dwarf-client').shorten","symbol":"shorten","correct":"import { shorten } from 'dwarf-client'"},{"note":"DwarfClient is a named export, not a default export.","wrong":"import DwarfClient from 'dwarf-client'","symbol":"DwarfClient","correct":"import { DwarfClient } from 'dwarf-client'"},{"note":"TypeScript users can import this type for response shapes.","wrong":"","symbol":"ShortenResponse","correct":"import { ShortenResponse } from 'dwarf-client'"}],"quickstart":{"code":"import { shorten } from 'dwarf-client';\n\nasync function main() {\n  try {\n    const result = await shorten(['http://example.com', 'https://test.org']);\n    console.log('Shortened URLs:', result.urls);\n  } catch (err) {\n    console.error('Error:', err);\n  }\n}\n\nmain();","lang":"typescript","description":"Demonstrates importing the shorten function and batch-shortening two URLs, logging the result."},"warnings":[{"fix":"Set DWARF_GRPC_SERVER environment variable, e.g., export DWARF_GRPC_SERVER=localhost:50051","message":"The gRPC server address must be set via the DWARF_GRPC_SERVER environment variable, otherwise the client will fail to connect.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Use import syntax or enable ESM in your project (type: module in package.json).","message":"The package is ESM-only; CommonJS require() will not work without transpilation.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Wrap calls in try/catch blocks as shown in the documentation.","message":"All functions are synchronous wrappers; errors are thrown synchronously, not passed to callbacks.","severity":"deprecated","affected_versions":">=0.0.0"}],"env_vars":null,"search_vec":"'1.0.7':15,84 'api':20 'async':19 'base':66 'batch':57 'cadenc':77 'client':3,6 'compar':62 'configur':29 'connect':49 'design':39 'dwarf':2,10,32 'dwarf-client':1 'endpoint':28 'environ':35 'error':60 'focus':55 'grpc':5,27,33,48,74 'grpc/grpc-js':46 'http':65 'http-base':64 'irregular':79 'javascript':85 'latenc':72 'librari':7,51 'lower':71 'microservic':13 'minim':53 'multipl':23 'node.js':41 'offer':70 'propag':61 'provid':16 'recent':81 'releas':76 'server':34,43 'shorten':12,22,58,68 'simpl':18 'sinc':83 'stream':75 'updat':82 'url':11,24,67 'use':45 'variabl':36 'version':14 'via':25 'web':42","created_at":"2026-06-07T16:51:30.981696+00:00","updated_at":"2026-06-07T16:51:30.981696+00:00","problems":[{"fix":"Ensure DWARF_GRPC_SERVER is defined and the gRPC server is running.","cause":"The DWARF_GRPC_SERVER environment variable is not set or points to an unreachable server.","error":"Error: 14 UNAVAILABLE: DNS resolution failed"},{"fix":"Use import { shorten } from 'dwarf-client' and enable esModuleInterop in tsconfig.json.","cause":"Project is using CommonJS require() or TypeScript with esModuleInterop disabled.","error":"Cannot find module 'dwarf-client' or its corresponding type declarations"},{"fix":"Change import DwarfClient from 'dwarf-client' to import { shorten } from 'dwarf-client'.","cause":"Default import was used instead of named import.","error":"TypeError: shorten is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":null,"github":null,"docs":null,"changelog":null,"pypi":null,"npm":"dwarf-client","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}