Registry / http-networking / kaltura-typescript-client

kaltura-typescript-client

JSON →
library20.7.3jsnpmunverified

The `kaltura-typescript-client` is an auto-generated TypeScript client designed to provide a type-safe facade for the Kaltura server API. It offers strong typing for API actions, classes, and enums, streamlining development for Kaltura-powered applications. As of version 20.7.3, this library operates with a unique distribution model: it is generated directly from the `kaltura/clients-generator` PHP engine and is intended for direct consumption via a `.tar.gz` archive, rather than traditional publication to npmjs. This approach ensures a highly synchronized interface that reflects the latest API definitions. Developers are encouraged to monitor the changelog for updates. A key feature is its explicit support for bundle size optimization, which requires configuration with tools like `babel-plugin-import` to selectively include only the necessary types, preventing excessive application bundle sizes.

npm install kaltura-typescript-client
INSTALL
IMPORT
SIG · KALTURA-TYPESCRIPT
K
kaltura-typescript-client
http-networkingjavascriptv20.7.3
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

KalturaClient
import { KalturaClient } from 'kaltura-typescript-client'
const KalturaClient = require('kaltura-typescript-client')
The primary class for interacting with the Kaltura API. ESM imports are the standard.
KalturaConfiguration
import { KalturaConfiguration } from 'kaltura-typescript-client'
import KalturaConfiguration from 'kaltura-typescript-client/KalturaConfiguration'
Used to configure the client, including service URL and partner ID. It's a named export.
PartnerService
import { PartnerService } from 'kaltura-typescript-client'
import { PartnerService } from 'kaltura-typescript-client/api/services'
Individual API services (e.g., PartnerService, MediaService) are named exports from the root or can be imported directly if using babel-plugin-import. The README's babel config implies they can be loaded via `kaltura-typescript-client/api/types` if configured.
KalturaSessionType
import { KalturaSessionType } from 'kaltura-typescript-client/api/types/KalturaSessionType'
import { KalturaSessionType } from 'kaltura-typescript-client'
Specific types and enums are often nested in sub-paths like `api/types` or `api/types/enums`. This path is inferred from common usage patterns in similar generated clients.

Demonstrates the non-standard installation process and basic client initialization, session establishment, and a sample API call (fetching partner details) using environment variables for credentials in a Node.js environment.

/* IMPORTANT: This client is NOT published to npmjs.com. You must first clone the generation repo, build, and install locally. 1. Clone the generation repository: git clone https://github.com/kaltura/KalturaGeneratedAPIClientsTypescript.git 2. Navigate into the cloned directory: cd KalturaGeneratedAPIClientsTypescript 3. Install dependencies and transpile: npm install npm run deploy 4. Find the generated .tar.gz file (e.g., in `dist/`): ls dist/*.tgz 5. In YOUR project, install the .tgz file: npm install file:path/to/kaltura-typescript-client-vX.Y.Z-DATE.tgz Ensure you have `xhr2` and `dotenv` installed in your project: npm install xhr2 dotenv @types/xhr2 --save-dev */ import { KalturaClient, KalturaConfiguration, PartnerService, SessionStartAction, KalturaSessionType } from 'kaltura-typescript-client'; // Required for Node.js environments as the client uses XMLHttpRequest internally // Must be set globally before client initialization global.XMLHttpRequest = require('xhr2'); // Load environment variables (e.g., from a .env file) import 'dotenv/config'; // Define your Kaltura API credentials and configuration const partnerId = parseInt(process.env.KALTURA_PARTNER_ID ?? '0', 10); const adminSecret = process.env.KALTURA_ADMIN_SECRET ?? ''; const serviceUrl = process.env.KALTURA_SERVICE_URL ?? 'https://www.kaltura.com/api_v3'; if (!partnerId || !adminSecret) { console.error('KALTURA_PARTNER_ID and KALTURA_ADMIN_SECRET must be set in your environment variables.'); process.exit(1); } async function initializeKalturaClient() { const config = new KalturaConfiguration(); config.serviceUrl = serviceUrl; config.partnerId = partnerId; const client = new KalturaClient(config); try { // Start a session with the Kaltura API const sessionStart = new SessionStartAction(); sessionStart.secret = adminSecret; sessionStart.partnerId = partnerId; sessionStart.type = KalturaSessionType.ADMIN; const session = await client.request(sessionStart); if (session && session.ks) { client.set={'ks': session.ks}; console.log('Kaltura Session Started. KS:', session.ks); // Example: Fetch partner details const partnerService = new PartnerService(client); const partner = await partnerService.get(); console.log('Fetched Partner Name:', partner.name); } else { console.error('Failed to start Kaltura session. No KS received.'); } } catch (error) { console.error('Error initializing Kaltura client or making API call:', error); } } initializeKalturaClient();
Debug
Known issues
breakingThis library is not distributed via the public npm registry. It must be manually built from its source repository (`kaltura/KalturaGeneratedAPIClientsTypescript`) and installed as a local `.tar.gz` file in your project.
fix
Follow the 'Adding this library as a dependency to your project' instructions in the README, which involves cloning the generator repo, running `npm install`, `npm run deploy`, finding the `.tgz` file in `dist/`, and then running `npm install file:path/to/your-package.tgz` in your project.
affects: >=1.0.0
gotchaThe library can lead to excessively large application bundles due to its thousands of auto-generated types if not properly optimized.
fix
Integrate `babel-plugin-import` into your build process. Configure it to import from `kaltura-typescript-client/api/types` with specific options as described in the 'Using the library in production' section of the README.
affects: >=1.0.0
gotchaThe library relies on `XMLHttpRequest` internally, which is a browser API. In Node.js environments, you must manually provide a polyfill like `xhr2` and assign it to `global.XMLHttpRequest`.
fix
Install `xhr2` (`npm install xhr2 @types/xhr2 --save-dev`) and add `global.XMLHttpRequest = require('xhr2');` at the top of your application's entry file before any Kaltura client code.
affects: >=1.0.0
gotchaAll code in this project is released under the AGPLv3 license, which has strong copyleft requirements. Ensure your project's licensing is compatible with AGPLv3.
fix
Review the AGPLv3 license terms and consult legal counsel if your project's licensing model has different requirements or if you plan to distribute your software.
affects: >=1.0.0
gotchaDirect Pull Requests (PRs) to this client library's repository are generally discouraged. Changes should be made to the `kaltura/clients-generator` PHP engine repository, as this client is auto-generated.
fix
If you need to contribute changes, fork and submit PRs to the `kaltura/clients-generator` repository, which is the source of truth for the API client generation.
affects: >=1.0.0
Errors
Common errors & fixes
Notice! Your application bundle the whole package of kaltura-xxx-client (either rxjs/ngx/typescript), please refer to the library `readme.md` to reduce app bundle size.
The application bundler is including all thousands of API types and classes from the library, instead of only those explicitly used.
fix
Install `babel-plugin-import` and configure it in your Babel setup with `libraryName: 'kaltura-typescript-client/api/types'`, `libraryDirectory: ''`, `camel2DashComponentName: false`, and `transformToDefaultImport: false` as specified in the README.
ReferenceError: XMLHttpRequest is not defined
The `kaltura-typescript-client` uses `XMLHttpRequest` internally, which is not natively available in Node.js environments.
fix
Install the `xhr2` package (`npm install xhr2 @types/xhr2 --save-dev`) and add `global.XMLHttpRequest = require('xhr2');` at the beginning of your Node.js application's entry point before any Kaltura client code is executed.
Error: Cannot find module 'kaltura-typescript-client'
The package was not installed correctly via the `file:` protocol, or the `.tgz` file path provided during installation was incorrect or has since been moved/deleted.
fix
Ensure you have followed the manual installation steps precisely: build the `.tgz` file from the generation repo, copy it to a stable location, and install it in your project using `npm install file:./path/to/your/kaltura-typescript-client-vX.Y.Z-DATE.tgz`. Verify the path is correct.
Upgrade
Version history
20.7.3latest on npm
Audit
Dependencies
@types/nodeoptionalProvides Node.js specific type definitions for TypeScript projects.
tslibrequiredTypeScript helper functions, commonly required for transpiled TypeScript output.
xhr2requiredProvides `XMLHttpRequest` implementation for Node.js environments, which the client library uses internally.
dotenvoptionalOften used for managing environment variables (like API credentials) in Node.js applications.
Agent activity
8 hits · last 30 days
node
8
Resources
kaltura-typescript-client — npm install kaltura-typescript-client · libregistry