Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions buf.gen.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
version: v2
managed:
enabled: true
inputs:
- module: buf.build/permifyco/permify
# Permify proto version - update this when upgrading
plugins:
- remote: buf.build/community/stephenh-ts-proto:v2.6.1
- local: ["node_modules/.bin/protoc-gen-ts_proto"]
out: src/grpc/generated
opt:
- oneof=unions
- forceLong=long
- esModuleInterop=true
- env=node
- outputServices=nice-grpc
- outputServices=generic-definitions
- esModuleInterop=true
- env=node
- useExactTypes=false
- forceLong=long
- oneof=unions
8 changes: 2 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"run-instance": "scripts/run-instance.sh",
"run-test": "ts-node node_modules/jasmine/bin/jasmine --config=jasmine.json",
"lint": "eslint \"src/**/*.ts\"",
"build": "npx tsc",
"build": "rm -rf ./dist && npx tsc && cp -r src/grpc/generated dist/src/grpc/",
"buf:generate": "buf generate"
},
"keywords": [
Expand All @@ -31,8 +31,6 @@
"license": "Apache-2.0",
"dependencies": {
"@grpc/grpc-js": "^1.9.0",
"@protobuf-ts/runtime": "^2.9.1",
"@protobuf-ts/runtime-rpc": "^2.9.1",
"nice-grpc": "^2.1.9",
"nice-grpc-common": "^2.0.0",
"long": "^5.2.3"
Expand All @@ -45,10 +43,8 @@
"eslint": "^9.21.0",
"globals": "^16.0.0",
"jasmine": "^5.2.0",
"jest": "^30.0.0",
"ts-jest": "^29.2.4",
"ts-node": "^10.9.2",
"ts-proto": "^2.8.3",
"ts-proto": "^2.6.1",
"typescript": "^5.0.0"
}
}
16 changes: 7 additions & 9 deletions src/grpc/clients.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {ClientMiddleware, createChannel, createClientFactory, ChannelCredentials} from 'nice-grpc';

import { ClientMiddleware, createChannel, createClientFactory, ChannelCredentials } from 'nice-grpc';
import {
PermissionDefinition,
SchemaDefinition,
Expand All @@ -8,11 +7,10 @@ import {
WatchDefinition,
BundleDefinition
} from './generated/base/v1/service';

import {Config} from "./config";
import { Config } from './config';

/**
* Create a new gRPC service client for of Permify.
* Create a new gRPC service client for Permify.
* The client can be configured with multiple client interceptors. For authentication interceptors,
* see the interceptors in this package.
*
Expand All @@ -22,10 +20,10 @@ import {Config} from "./config";
* @returns A new gRPC service client for the Permission API of Permify.
*/
export function newClient(conf: Config, ...interceptors: ClientMiddleware[]) {
const channel = (conf.insecure)
? createChannel(conf.endpoint, ChannelCredentials.createInsecure())
: createChannel(conf.endpoint, ChannelCredentials.createSsl(conf.cert, conf.pk, conf.certChain));
const channel = conf.insecure
? createChannel(conf.endpoint, ChannelCredentials.createInsecure())
: createChannel(conf.endpoint, ChannelCredentials.createSsl(conf.cert, conf.pk, conf.certChain));

let factory = createClientFactory();
for (const interceptor of interceptors) {
factory = factory.use(interceptor);
Expand Down
2 changes: 2 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"rootDir": "./",
"strict": false,
"strictNullChecks": false,
"typeRoots": [
"node_modules/@types"
]
Expand Down
Loading
Loading