{"id":15848,"library":"symbol-openapi-typescript-fetch-client","title":"Symbol OpenAPI TypeScript Fetch Client","description":"This package, `symbol-openapi-typescript-fetch-client` (version 1.0.3, last published in November 2021), provides a generated OpenAPI client for the Symbol blockchain. It is built using `symbol-openapi-generator` and designed to interact with Symbol nodes via the standard `fetch` API. It ships with TypeScript types, offering type-safe access to Symbol's REST API endpoints as defined by its OpenAPI specification at the time of its generation. However, it's crucial to note that this package is essentially an artifact generated from an older specification and generator. The README itself points users to `symbol-sdk-typescript-javascript`, which has since been deprecated (as of January 2022). For current Symbol blockchain development, the actively maintained `@symbol/symbol-sdk` package should be used instead, as this generated client is not regularly updated and reflects an outdated state of the Symbol ecosystem.","status":"abandoned","version":"1.0.3","language":"javascript","source_language":"en","source_url":"https://github.com/symbol/symbol-openapi-generator","tags":["javascript","typescript"],"install":[{"cmd":"npm install symbol-openapi-typescript-fetch-client","lang":"bash","label":"npm"},{"cmd":"yarn add symbol-openapi-typescript-fetch-client","lang":"bash","label":"yarn"},{"cmd":"pnpm add symbol-openapi-typescript-fetch-client","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Required for `fetch` API availability in Node.js environments older than 18, as this client relies on a global `fetch`.","package":"node-fetch","optional":true}],"imports":[{"note":"The library primarily uses ES Module syntax and TypeScript definitions. CommonJS `require` might work for specific exports but is not the idiomatic way for this package.","wrong":"const Configuration = require('symbol-openapi-typescript-fetch-client').Configuration;","symbol":"Configuration","correct":"import { Configuration } from 'symbol-openapi-typescript-fetch-client';"},{"note":"API client classes like `NodeRoutesApi` are named exports from the top-level package, not default exports from sub-paths.","wrong":"import NodeRoutesApi from 'symbol-openapi-typescript-fetch-client/NodeRoutesApi';","symbol":"NodeRoutesApi","correct":"import { NodeRoutesApi } from 'symbol-openapi-typescript-fetch-client';"},{"note":"Other API classes (e.g., `BlockRoutesApi`, `TransactionRoutesApi`) follow the same named export pattern.","symbol":"BlockRoutesApi","correct":"import { BlockRoutesApi } from 'symbol-openapi-typescript-fetch-client';"}],"quickstart":{"code":"import { Configuration, NodeRoutesApi } from 'symbol-openapi-typescript-fetch-client';\n\nasync function getNodeHealthStatus() {\n  // For Node.js versions < 18, you might need a polyfill:\n  // import fetch from 'node-fetch';\n  // globalThis.fetch = fetch as any; \n\n  const nodeUrl = process.env.SYMBOL_NODE_URL ?? 'http://localhost:3000';\n\n  try {\n    const config = new Configuration({ \n      basePath: nodeUrl,\n      // You can add headers, API keys, or other configurations here\n      // For example, for a public node, no specific auth is usually needed for node info.\n    });\n    const nodeApi = new NodeRoutesApi(config);\n\n    // Fetch the node info\n    const nodeInfo = await nodeApi.getNodeInfo();\n    console.log('Node Info:', nodeInfo);\n\n    // Fetch the node health status\n    const healthStatus = await nodeApi.getNodeHealth();\n    console.log('Node Health Status:', healthStatus);\n\n  } catch (error) {\n    console.error('Error fetching Symbol node information:', error);\n    if (error instanceof TypeError && error.message.includes('fetch is not defined')) {\n      console.error('Hint: In Node.js environments, ensure `fetch` is available. For Node.js < 18, install `node-fetch` and polyfill `globalThis.fetch`.');\n    }\n  }\n}\n\ngetNodeHealthStatus();","lang":"typescript","description":"Demonstrates how to initialize the generated Symbol OpenAPI client and fetch basic information about a Symbol node, including its health status and general details."},"warnings":[{"fix":"Migrate to the actively maintained `@symbol/symbol-sdk` package for interacting with the Symbol blockchain. If a generated client is strictly required, explore more recent OpenAPI client generators or a more up-to-date generated Symbol client if available.","message":"This package (version 1.0.3) was last published over 4 years ago (November 2021) and is considered abandoned. It reflects an outdated state of the Symbol OpenAPI specification and generator. Using it in new projects is highly discouraged due to potential incompatibilities and lack of updates.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Disregard the README's recommendation to use `symbol-sdk-typescript-javascript`. Instead, use `@symbol/symbol-sdk` which is the current, actively supported SDK for Symbol.","message":"The README for this package explicitly directs users to `symbol-sdk-typescript-javascript` for client development. However, `symbol-sdk-typescript-javascript` itself has been deprecated as of January 2022. This further underscores the outdated nature of `symbol-openapi-typescript-fetch-client` and its recommendations.","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"For complex Symbol application development requiring more than raw API calls, always prefer the `@symbol/symbol-sdk` package. Use this generated client only if you specifically need a minimalistic fetch-based client for an older API version and understand its limitations.","message":"This is a *generated OpenAPI client*, not the comprehensive Symbol SDK. It provides raw API access based on the OpenAPI specification. It lacks higher-level abstractions, utility functions, and domain-specific logic that are present in the full `@symbol/symbol-sdk`.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"For Node.js environments older than 18, install `node-fetch` (e.g., `npm install node-fetch`) and polyfill `globalThis.fetch` before making any API calls:\n```typescript\nimport fetch from 'node-fetch';\nglobalThis.fetch = fetch as any;\n// ... then use the generated client\n```","message":"The client relies on the global `fetch` API. In Node.js environments prior to version 18, `fetch` is not natively available. Running the client in such environments will result in a runtime error.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-21T00:00:00.000Z","next_check":"2026-07-20T00:00:00.000Z","problems":[{"fix":"For Node.js environments, upgrade to Node.js 18 or newer, or install `node-fetch` and polyfill `globalThis.fetch`:\n```typescript\nimport fetch from 'node-fetch';\nglobalThis.fetch = fetch as any;\n```","cause":"The client attempts to use the `fetch` API, but it's not available in the current JavaScript runtime, specifically in older Node.js versions (pre-18) or environments without a `fetch` polyfill.","error":"TypeError: fetch is not defined"},{"fix":"For development, you can temporarily disable certificate verification by setting the `NODE_TLS_REJECT_UNAUTHORIZED='0'` environment variable (not recommended for production). Alternatively, configure your environment to trust the certificate or use an HTTP endpoint if available and appropriate for your security model.","cause":"This error typically occurs when connecting to a Symbol node via HTTPS with a self-signed or untrusted SSL certificate, common in local development environments or private networks without proper certificate authority setup.","error":"Error: unable to verify the first certificate"}],"ecosystem":"npm"}