@authzed/authzed-js-node
Version:
authzed js client for nodejs
83 lines • 5.04 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/schema_service.proto" (package "authzed.api.v1", syntax proto3)
// tslint:disable
import { SchemaService } from "./schema_service.js";
import * as grpc from "@grpc/grpc-js";
/**
* SchemaService implements operations on a Permissions System's Schema.
*
* @generated from protobuf service authzed.api.v1.SchemaService
*/
export class SchemaServiceClient extends grpc.Client {
_binaryOptions;
constructor(address, credentials, options = {}, binaryOptions = {}) {
super(address, credentials, options);
this._binaryOptions = binaryOptions;
}
/**
* Read returns the current Object Definitions for a Permissions System.
*
* Errors include:
* - INVALID_ARGUMENT: a provided value has failed to semantically validate
* - NOT_FOUND: no schema has been defined
*
* @generated from protobuf rpc: ReadSchema(authzed.api.v1.ReadSchemaRequest) returns (authzed.api.v1.ReadSchemaResponse);
*/
readSchema(input, metadata, options, callback) {
const method = SchemaService.methods[0];
return this.makeUnaryRequest(`/${SchemaService.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options, callback);
}
/**
* Write overwrites the current Object Definitions for a Permissions System.
*
* @generated from protobuf rpc: WriteSchema(authzed.api.v1.WriteSchemaRequest) returns (authzed.api.v1.WriteSchemaResponse);
*/
writeSchema(input, metadata, options, callback) {
const method = SchemaService.methods[1];
return this.makeUnaryRequest(`/${SchemaService.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options, callback);
}
/**
* ReflectSchema reflects the current schema stored in SpiceDB, returning a structural
* form of the schema for use by client tooling.
*
* @generated from protobuf rpc: ReflectSchema(authzed.api.v1.ReflectSchemaRequest) returns (authzed.api.v1.ReflectSchemaResponse);
*/
reflectSchema(input, metadata, options, callback) {
const method = SchemaService.methods[2];
return this.makeUnaryRequest(`/${SchemaService.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options, callback);
}
/**
* ComputablePermissions returns the set of permissions that compute based off a relation
* in the current schema. For example, if the schema has a relation `viewer` and a permission
* `view` defined as `permission view = viewer + editor`, then the
* computable permissions for the relation `viewer` will include `view`.
*
* @generated from protobuf rpc: ComputablePermissions(authzed.api.v1.ComputablePermissionsRequest) returns (authzed.api.v1.ComputablePermissionsResponse);
*/
computablePermissions(input, metadata, options, callback) {
const method = SchemaService.methods[3];
return this.makeUnaryRequest(`/${SchemaService.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options, callback);
}
/**
* DependentRelations returns the set of relations and permissions that used
* to compute a permission, recursively, in the current schema. It is the
* inverse of the ComputablePermissions API.
*
* @generated from protobuf rpc: DependentRelations(authzed.api.v1.DependentRelationsRequest) returns (authzed.api.v1.DependentRelationsResponse);
*/
dependentRelations(input, metadata, options, callback) {
const method = SchemaService.methods[4];
return this.makeUnaryRequest(`/${SchemaService.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options, callback);
}
/**
* DiffSchema returns the difference between the specified schema and the current
* schema stored in SpiceDB.
*
* @generated from protobuf rpc: DiffSchema(authzed.api.v1.DiffSchemaRequest) returns (authzed.api.v1.DiffSchemaResponse);
*/
diffSchema(input, metadata, options, callback) {
const method = SchemaService.methods[5];
return this.makeUnaryRequest(`/${SchemaService.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options, callback);
}
}
//# sourceMappingURL=schema_service.grpc-client.js.map