@authzed/authzed-js-node
Version:
authzed js client for nodejs
129 lines • 8.43 kB
JavaScript
// @generated by protobuf-ts 2.9.1 with parameter generate_dependencies,long_type_string,client_grpc1
// @generated from protobuf file "authzed/api/v1/permission_service.proto" (package "authzed.api.v1", syntax proto3)
// tslint:disable
import { PermissionsService } from "./permission_service.js";
import * as grpc from "@grpc/grpc-js";
/**
* PermissionsService implements a set of RPCs that perform operations on
* relationships and permissions.
*
* @generated from protobuf service authzed.api.v1.PermissionsService
*/
export class PermissionsServiceClient extends grpc.Client {
_binaryOptions;
constructor(address, credentials, options = {}, binaryOptions = {}) {
super(address, credentials, options);
this._binaryOptions = binaryOptions;
}
/**
* ReadRelationships reads a set of the relationships matching one or more
* filters.
*
* @generated from protobuf rpc: ReadRelationships(authzed.api.v1.ReadRelationshipsRequest) returns (stream authzed.api.v1.ReadRelationshipsResponse);
*/
readRelationships(input, metadata, options) {
const method = PermissionsService.methods[0];
return this.makeServerStreamRequest(`/${PermissionsService.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options);
}
/**
* WriteRelationships atomically writes and/or deletes a set of specified
* relationships. An optional set of preconditions can be provided that must
* be satisfied for the operation to commit.
*
* @generated from protobuf rpc: WriteRelationships(authzed.api.v1.WriteRelationshipsRequest) returns (authzed.api.v1.WriteRelationshipsResponse);
*/
writeRelationships(input, metadata, options, callback) {
const method = PermissionsService.methods[1];
return this.makeUnaryRequest(`/${PermissionsService.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options, callback);
}
/**
* DeleteRelationships atomically bulk deletes all relationships matching the
* provided filter. If no relationships match, none will be deleted and the
* operation will succeed. An optional set of preconditions can be provided that must
* be satisfied for the operation to commit.
*
* @generated from protobuf rpc: DeleteRelationships(authzed.api.v1.DeleteRelationshipsRequest) returns (authzed.api.v1.DeleteRelationshipsResponse);
*/
deleteRelationships(input, metadata, options, callback) {
const method = PermissionsService.methods[2];
return this.makeUnaryRequest(`/${PermissionsService.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options, callback);
}
/**
* CheckPermission determines for a given resource whether a subject computes
* to having a permission or is a direct member of a particular relation.
*
* @generated from protobuf rpc: CheckPermission(authzed.api.v1.CheckPermissionRequest) returns (authzed.api.v1.CheckPermissionResponse);
*/
checkPermission(input, metadata, options, callback) {
const method = PermissionsService.methods[3];
return this.makeUnaryRequest(`/${PermissionsService.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options, callback);
}
/**
* CheckBulkPermissions evaluates the given list of permission checks
* and returns the list of results.
*
* @generated from protobuf rpc: CheckBulkPermissions(authzed.api.v1.CheckBulkPermissionsRequest) returns (authzed.api.v1.CheckBulkPermissionsResponse);
*/
checkBulkPermissions(input, metadata, options, callback) {
const method = PermissionsService.methods[4];
return this.makeUnaryRequest(`/${PermissionsService.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options, callback);
}
/**
* ExpandPermissionTree reveals the graph structure for a resource's
* permission or relation. This RPC does not recurse infinitely deep and may
* require multiple calls to fully unnest a deeply nested graph.
*
* @generated from protobuf rpc: ExpandPermissionTree(authzed.api.v1.ExpandPermissionTreeRequest) returns (authzed.api.v1.ExpandPermissionTreeResponse);
*/
expandPermissionTree(input, metadata, options, callback) {
const method = PermissionsService.methods[5];
return this.makeUnaryRequest(`/${PermissionsService.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options, callback);
}
/**
* LookupResources returns all the resources of a given type that a subject
* can access whether via a computed permission or relation membership.
*
* @generated from protobuf rpc: LookupResources(authzed.api.v1.LookupResourcesRequest) returns (stream authzed.api.v1.LookupResourcesResponse);
*/
lookupResources(input, metadata, options) {
const method = PermissionsService.methods[6];
return this.makeServerStreamRequest(`/${PermissionsService.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options);
}
/**
* LookupSubjects returns all the subjects of a given type that
* have access whether via a computed permission or relation membership.
*
* @generated from protobuf rpc: LookupSubjects(authzed.api.v1.LookupSubjectsRequest) returns (stream authzed.api.v1.LookupSubjectsResponse);
*/
lookupSubjects(input, metadata, options) {
const method = PermissionsService.methods[7];
return this.makeServerStreamRequest(`/${PermissionsService.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options);
}
/**
* ImportBulkRelationships is a faster path to writing a large number of
* relationships at once. It is both batched and streaming. For maximum
* performance, the caller should attempt to write relationships in as close
* to relationship sort order as possible: (resource.object_type,
* resource.object_id, relation, subject.object.object_type,
* subject.object.object_id, subject.optional_relation). All relationships
* written are done so under a single transaction.
*
* @generated from protobuf rpc: ImportBulkRelationships(stream authzed.api.v1.ImportBulkRelationshipsRequest) returns (authzed.api.v1.ImportBulkRelationshipsResponse);
*/
importBulkRelationships(metadata, options, callback) {
const method = PermissionsService.methods[8];
return this.makeClientStreamRequest(`/${PermissionsService.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), metadata, options, callback);
}
/**
* ExportBulkRelationships is the fastest path available to exporting
* relationships from the server. It is resumable, and will return results
* in an order determined by the server.
*
* @generated from protobuf rpc: ExportBulkRelationships(authzed.api.v1.ExportBulkRelationshipsRequest) returns (stream authzed.api.v1.ExportBulkRelationshipsResponse);
*/
exportBulkRelationships(input, metadata, options) {
const method = PermissionsService.methods[9];
return this.makeServerStreamRequest(`/${PermissionsService.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options);
}
}
//# sourceMappingURL=permission_service.grpc-client.js.map