Registry / auth-security / permify-typescript

permify-typescript

JSON →
library1.6.9jsnpmunverified

permify-typescript is the official TypeScript client for Permify, an open-source authorization service designed for building fine-grained and scalable authorization systems. This package provides a programmatic interface to interact with the Permify API, covering operations for schema, relationships, permissions, and tenancy. As of version 1.6.9, the client's versioning now directly aligns with the upstream Permify API/OpenAPI version, ensuring closer synchronization with the service's capabilities. It is automatically generated by the OpenAPI Generator project, which ensures a consistent and up-to-date interface to the Permify API. The library supports Node.js environments version 18 and higher, shipping with full TypeScript type definitions for an enhanced developer experience.

npm install permify-typescript
INSTALL
IMPORT
SIG · PERMIFY-TYPESCRIPT
P
permify-typescript
auth-securityjavascriptv1.6.9
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.

permify (all exports)
import * as permify from 'permify-typescript';
const permify = require('permify-typescript');
CommonJS `require` might work with transpilation, but this library is primarily designed for ESM with Node.js >=18, aligning with modern TypeScript best practices.
Configuration, TenancyApi, PermissionApi
import { Configuration, TenancyApi, PermissionApi } from 'permify-typescript';
import Configuration from 'permify-typescript/Configuration';
API client classes, configuration, and most models are exported as named exports directly from the package root.
Tenant (type)
import type { Tenant } from 'permify-typescript';
import { Tenant } from 'permify-typescript';
Use `import type` for importing only type definitions in TypeScript for better bundle optimization and clarity, as `Tenant` is a type definition for an API model.

This quickstart demonstrates how to initialize the Permify TypeScript client, configure it with a base path and an authorization header using environment variables, and then create a new tenant using the TenancyApi client.

import * as permify from "permify-typescript"; // Configure the client with your Permify API base path and authorization token. // It's recommended to use environment variables for sensitive data. const configuration = new permify.Configuration({ basePath: process.env.PERMIFY_API_BASE_PATH ?? "http://localhost:3476", headers: { 'Authorization': process.env.PERMIFY_API_KEY ? `Bearer ${process.env.PERMIFY_API_KEY}` : "" } }); // Initialize the TenancyApi to interact with tenant-related endpoints. const apiInstance = new permify.TenancyApi(configuration); // Define a tenant ID, perhaps from a database or a unique identifier. let tenantId = "example_tenant_id"; // Create a new tenant in Permify. apiInstance.tenantsCreate({ body: { id: tenantId, name: "Example Tenant" } }) .then((data) => { console.log('API called successfully. Created tenant: ' + JSON.stringify(data.tenant)); }) .catch((error) => { console.error('Error creating tenant:', error.response?.data || error.message); });
Debug
Known issues
gotchaStarting with v1.6.9, `permify-typescript` versions directly align with the upstream Permify API/OpenAPI version. A jump in the client's major or minor version number does not necessarily imply a breaking change in the SDK itself, but rather an update to match the Permify service's capabilities. Always refer to the package's specific release notes.
fix
Consult the `permify-typescript` GitHub release notes or changelog for specific SDK-level breaking changes rather than solely relying on version number increments to determine client compatibility.
affects: >=1.6.9
breakingThe `permify-typescript` package specifies Node.js version 18 or higher as a minimum requirement. Running on older Node.js versions may lead to unexpected runtime errors, dependency conflicts, or installation failures.
fix
Upgrade your Node.js environment to version 18 or newer. Consider using a Node.js version manager like `nvm` to easily switch between versions.
affects: <18.0.0
gotchaAPI requests require proper authentication. Failure to provide a valid `Authorization` header (e.g., a Bearer token) will result in API authentication failures, typically a 401 Unauthorized response from the Permify API.
fix
Ensure the `Authorization` header is correctly set in the `Configuration` object, providing a valid Permify API key or token, preferably via environment variables (`process.env.PERMIFY_API_KEY`).
affects: *
Errors
Common errors & fixes
Error: connect ECONNREFUSED 127.0.0.1:3476
The Permify API server is not running or is inaccessible at the specified `basePath` in the client configuration, preventing a connection.
fix
Verify that the Permify server is running and listening on the configured address and port (e.g., `http://localhost:3476`). Check firewall settings or network connectivity issues.
Error: Request failed with status code 401
The Permify API rejected the request due to missing, invalid, or expired authentication credentials provided in the `Authorization` header.
fix
Double-check that your `PERMIFY_API_KEY` environment variable (or hardcoded token) is correct and that the `Authorization` header is properly formatted (e.g., `Bearer YOUR_TOKEN`).
TypeError: permify.Configuration is not a constructor
This error often occurs when attempting to use CommonJS `require` syntax or incorrect destructuring for a module that primarily uses ES Modules (ESM) and named exports.
fix
Ensure you are using ESM `import` statements (e.g., `import { Configuration } from 'permify-typescript';` or `import * as permify from 'permify-typescript';`) and that your Node.js project is configured to run ESM (e.g., by setting `"type": "module"` in your `package.json`).
Upgrade
Version history
1.6.9latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
28 hits · last 30 days
node
22
OpenAI (training)
1
Resources
permify-typescript — npm install permify-typescript · libregistry