@authzed/authzed-node
Version:
authzed client for nodejs
81 lines (80 loc) • 6.14 kB
TypeScript
import * as grpc from "@grpc/grpc-js";
import { ExperimentalServiceClient } from "./authzedapi/authzed/api/v1/experimental_service.grpc-client.js";
import { PermissionsServiceClient } from "./authzedapi/authzed/api/v1/permission_service.grpc-client.js";
import { SchemaServiceClient } from "./authzedapi/authzed/api/v1/schema_service.grpc-client.js";
import { WatchServiceClient } from "./authzedapi/authzed/api/v1/watch_service.grpc-client.js";
import { WatchPermissionsServiceClient } from "./authzedapi/authzed/api/materialize/v0/watchpermissions.grpc-client.js";
import { WatchPermissionSetsServiceClient } from "./authzedapi/authzed/api/materialize/v0/watchpermissionsets.grpc-client.js";
import { ClientSecurity, PreconnectServices } from "./util.js";
import type { OmitBaseMethods, PromisifiedClient } from "./types.js";
import { Struct as ImportedPbStruct, NullValue as ImportedPbNullValue } from "./authzedapi/google/protobuf/struct.js";
import type { JsonObject } from "@protobuf-ts/runtime";
export { ImportedPbStruct as PbStruct, ImportedPbNullValue as PbNullValue };
export type ZedDefaultClientInterface = OmitBaseMethods<PermissionsServiceClient, grpc.Client> & OmitBaseMethods<SchemaServiceClient, grpc.Client> & OmitBaseMethods<WatchServiceClient, grpc.Client> & OmitBaseMethods<ExperimentalServiceClient, grpc.Client> & OmitBaseMethods<WatchPermissionsServiceClient, grpc.Client> & OmitBaseMethods<WatchPermissionSetsServiceClient, grpc.Client> & Pick<grpc.Client, "close">;
export type ZedPromiseClientInterface = PromisifiedClient<PermissionsServiceClient> & PromisifiedClient<SchemaServiceClient> & PromisifiedClient<WatchServiceClient> & PromisifiedClient<ExperimentalServiceClient> & PromisifiedClient<WatchPermissionsServiceClient> & PromisifiedClient<WatchPermissionSetsServiceClient> & Pick<ZedDefaultClientInterface, "close">;
export type ZedClientInterface = ZedDefaultClientInterface & {
promises: ZedPromiseClientInterface;
};
/**
* NewClient creates a new client for calling Authzed APIs.
* @param token Secret token for authentication.
* @param endpoint Uri for communicating with Authzed.
* @param security Security level for the connection.
* @param preconnect The services to which the client will preconnect.
* All others will open a connection when first used.
* @returns Client for calling Authzed APIs.
*/
export declare function NewClient(token: string, endpoint?: string, security?: ClientSecurity, preconnect?: PreconnectServices, options?: grpc.ClientOptions | undefined): ZedClientInterface;
/**
* NewClientWithCustomCert creates a new client for calling Authzed APIs using a custom TLS certificate.
* @param token Secret token for authentication.
* @param endpoint Uri for communicating with Authzed.
* @param certificate Buffer read from certificate file.
* @param preconnect The services to which the client will preconnect.
* All others will open a connection when first used.
* @returns Client for calling Authzed APIs.
*/
export declare function NewClientWithCustomCert(token: string, endpoint: string | undefined, certificate: Buffer, preconnect?: PreconnectServices, options?: grpc.ClientOptions | undefined): ZedClientInterface;
/**
* NewClientWithChannelCredentials creates a new client for calling Authzed APIs using custom grpc ChannelCredentials.
*
The {@link ZedCombinedClient} proxies both callback/promise-style methods to the underlying
* {@link ZedClient} and {@link ZedPromiseClient} instances. Direct method calls on the combined
* client will result in calling the underlying callback methods (the generated gRPC methods) while
* the same methods accessed at a sub-path `.promises.<method>` will result in the promise-wrapped
* methods. For all methods that return a {@link ClientReadableStream}, the promise-wrapped method
* will return an array of the resulting responses after the stream has been closed.
*
* @param endpoint Uri for communicating with Authzed.
* @param creds ChannelCredentials used for grpc.
* @param preconnect The services to which the client will preconnect.
* All others will open a connection when first used.
* @returns Client for calling Authzed APIs.
*/
export declare function NewClientWithChannelCredentials(endpoint: string | undefined, creds: grpc.ChannelCredentials, preconnect?: PreconnectServices, options?: grpc.ClientOptions | undefined): ZedClientInterface;
/**
* Creates a google.protobuf.Struct object suitable for use as
* optionalTransactionMetadata in WriteRelationshipsRequest.
*
* @param data A simple JavaScript object (e.g., { key: "value" }) to be converted into a Struct.
* @returns A google.protobuf.Struct object.
*/
export declare function createStructFromObject(data: JsonObject): ImportedPbStruct;
export * from "./authzedapi/authzed/api/v1/core.js";
export * from "./authzedapi/authzed/api/v1/experimental_service.js";
export * from "./authzedapi/authzed/api/v1/experimental_service.grpc-client.js";
export * from "./authzedapi/authzed/api/v1/permission_service.js";
export * from "./authzedapi/authzed/api/v1/permission_service.grpc-client.js";
export * from "./authzedapi/authzed/api/v1/schema_service.js";
export * from "./authzedapi/authzed/api/v1/schema_service.grpc-client.js";
export * from "./authzedapi/authzed/api/v1/watch_service.js";
export * from "./authzedapi/authzed/api/v1/watch_service.grpc-client.js";
export * from "./authzedapi/authzed/api/materialize/v0/watchpermissions.js";
export * from "./authzedapi/authzed/api/materialize/v0/watchpermissions.grpc-client.js";
export { WatchPermissionSetsRequest, WatchPermissionSetsResponse, Cursor as MaterializeCursor, LookupPermissionSetsRequest, LookupPermissionSetsResponse, PermissionSetChange, PermissionSetChange_SetOperation, SetReference, MemberReference, LookupPermissionSetsRequired, BreakingSchemaChange, } from "./authzedapi/authzed/api/materialize/v0/watchpermissionsets.js";
export * from "./authzedapi/authzed/api/materialize/v0/watchpermissionsets.grpc-client.js";
export { ClientSecurity } from "./util.js";
declare const _default: {
NewClient: typeof NewClient;
};
export default _default;