Skip to content

Commit

Permalink
Merge pull request #10 from aserto-dev/connect_2
Browse files Browse the repository at this point in the history
move to connectrpc 2
  • Loading branch information
gimmyxd authored Nov 27, 2024
2 parents 09db5e3 + e865928 commit 375fb4e
Show file tree
Hide file tree
Showing 54 changed files with 2,784 additions and 7,477 deletions.
35 changes: 34 additions & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ env:
VAULT_ADDR: https://vault.eng.aserto.com/

jobs:
build:
release:
runs-on: ubuntu-latest
steps:
- name: Read Configuration
Expand All @@ -18,7 +18,9 @@ jobs:
token: ${{ secrets.VAULT_TOKEN }}
secrets: |
kv/data/npmjs "NPM_TOKEN" | NODE_AUTH_TOKEN;
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: '20.x'
Expand All @@ -27,6 +29,7 @@ jobs:
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT

- uses: actions/cache@v4
id: yarn-cache
with:
Expand All @@ -39,3 +42,33 @@ jobs:
- run: yarn install --immutable
- run: yarn npm publish --access public

bump_version:
runs-on: ubuntu-latest
needs: release
steps:
- uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ vars.CODEGEN_APP_ID }}
private-key: ${{ secrets.CODEGEN_APP_KEY }}

- uses: actions/checkout@v4
with:
token: ${{ steps.app-token.outputs.token }}
ref: 'main'

# bump to the next patch version
- name: Bump version
id: bump_version
run: |
VERSION=$(npm version patch --no-git-tag-version)
echo $VERSION
echo "::set-output name=next_version::$VERSION"
- name: Commit changes
uses: EndBug/add-and-commit@v9
with:
default_author: github_actions
message: 'Bump to ${{ steps.bump_version.outputs.next_version }} (CI)'
add: 'package.json'
Binary file modified .yarn/install-state.gz
Binary file not shown.
725 changes: 367 additions & 358 deletions .yarn/releases/yarn-4.4.1.cjs → .yarn/releases/yarn-4.5.1.cjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ nodeLinker: node-modules

npmAuthToken: "${NODE_AUTH_TOKEN:-default}"

yarnPath: .yarn/releases/yarn-4.4.1.cjs
yarnPath: .yarn/releases/yarn-4.5.1.cjs
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ yarn install
yarn gen
```

### Build with a local build of authorizer
```
BUF_PATH=/path/to/authorizer.bin yarn gen
```

## Usage

This repository contains only the bindings.
Expand Down
18 changes: 5 additions & 13 deletions buf.gen.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
version: v1
version: v2
clean: true
plugins:
- plugin: es
opt: target=ts
out: src/gen/mjs
- plugin: es
opt: target=js
out: src/gen/mjs
- plugin: connect-es
opt: target=ts
out: src/gen/mjs
- plugin: connect-es
opt: target=js
out: src/gen/mjs
- local: protoc-gen-es
opt: target=ts+js
out: src/gen/mjs
13 changes: 0 additions & 13 deletions buf.lock

This file was deleted.

21 changes: 0 additions & 21 deletions buf.yaml

This file was deleted.

17 changes: 8 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@aserto/node-authorizer",
"version": "0.20.10",
"version": "0.21.0",
"description": "Node gRPC bindings for the Aserto authorizer service",
"scripts": {
"gen": "rm -rf src && buf generate --include-imports ${BUF_PATH:-buf.build/aserto-dev/authorizer} && rm -rf src/gen/cjs && tsc",
Expand All @@ -12,15 +12,14 @@
"keywords": [],
"author": "Aserto",
"license": "Apache-2.0",
"dependencies": {
"@bufbuild/protobuf": "^2.2.2"
},
"devDependencies": {
"@bufbuild/buf": "^1.40.1",
"@bufbuild/protobuf": "^1.10.0",
"@bufbuild/protoc-gen-es": "^1.10.0",
"@connectrpc/protoc-gen-connect-es": "^1.4.0",
"@types/google-protobuf": "^3.15.12",
"@types/node": "^18.19.50",
"google-protobuf": "^3.21.4",
"typescript": "^4.9.5"
"@bufbuild/protoc-gen-es": "^2.2.2",
"@types/node": "^22.9.1",
"typescript": "^5.6.3"
},
"packageManager": "yarn@4.4.1"
"packageManager": "yarn@4.5.1"
}
68 changes: 32 additions & 36 deletions src/gen/cjs/aserto/authorizer/v2/api/decision_logs_pb.d.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf";
import { Message, proto3, Struct, Timestamp } from "@bufbuild/protobuf";
import { IdentityContext } from "./identity_context_pb.js";
import { PolicyContext } from "./policy_context_pb.js";
import { PolicyInstance } from "./policy_instance_pb.js";
import type { GenFile, GenMessage } from "@bufbuild/protobuf/codegenv1";
import type { Timestamp } from "@bufbuild/protobuf/wkt";
import type { PolicyContext } from "./policy_context_pb";
import type { IdentityContext } from "./identity_context_pb";
import type { PolicyInstance } from "./policy_instance_pb";
import type { JsonObject, Message } from "@bufbuild/protobuf";
/**
* Describes the file aserto/authorizer/v2/api/decision_logs.proto.
*/
export declare const file_aserto_authorizer_v2_api_decision_logs: GenFile;
/**
* represents a decision that an authorizer performed in the past
*
* @generated from message aserto.authorizer.v2.api.Decision
*/
export declare class Decision extends Message<Decision> {
export type Decision = Message<"aserto.authorizer.v2.api.Decision"> & {
/**
* unique id, replay a decision starting with this, also useful to de-dup
*
Expand Down Expand Up @@ -52,7 +57,7 @@ export declare class Decision extends Message<Decision> {
*
* @generated from field: google.protobuf.Struct resource = 7;
*/
resource?: Struct;
resource?: JsonObject;
/**
* annotations that may be added to a decision
*
Expand All @@ -67,21 +72,18 @@ export declare class Decision extends Message<Decision> {
* @generated from field: optional string tenant_id = 9;
*/
tenantId?: string;
constructor(data?: PartialMessage<Decision>);
static readonly runtime: typeof proto3;
static readonly typeName = "aserto.authorizer.v2.api.Decision";
static readonly fields: FieldList;
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): Decision;
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): Decision;
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): Decision;
static equals(a: Decision | PlainMessage<Decision> | undefined, b: Decision | PlainMessage<Decision> | undefined): boolean;
}
};
/**
* Describes the message aserto.authorizer.v2.api.Decision.
* Use `create(DecisionSchema)` to create a new message.
*/
export declare const DecisionSchema: GenMessage<Decision>;
/**
* information about a user on behalf of whom a decision was made
*
* @generated from message aserto.authorizer.v2.api.DecisionUser
*/
export declare class DecisionUser extends Message<DecisionUser> {
export type DecisionUser = Message<"aserto.authorizer.v2.api.DecisionUser"> & {
/**
* identity context used in the decision
*
Expand All @@ -100,21 +102,18 @@ export declare class DecisionUser extends Message<DecisionUser> {
* @generated from field: string email = 3;
*/
email: string;
constructor(data?: PartialMessage<DecisionUser>);
static readonly runtime: typeof proto3;
static readonly typeName = "aserto.authorizer.v2.api.DecisionUser";
static readonly fields: FieldList;
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): DecisionUser;
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): DecisionUser;
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): DecisionUser;
static equals(a: DecisionUser | PlainMessage<DecisionUser> | undefined, b: DecisionUser | PlainMessage<DecisionUser> | undefined): boolean;
}
};
/**
* Describes the message aserto.authorizer.v2.api.DecisionUser.
* Use `create(DecisionUserSchema)` to create a new message.
*/
export declare const DecisionUserSchema: GenMessage<DecisionUser>;
/**
* information about a policy used in a decision
*
* @generated from message aserto.authorizer.v2.api.DecisionPolicy
*/
export declare class DecisionPolicy extends Message<DecisionPolicy> {
export type DecisionPolicy = Message<"aserto.authorizer.v2.api.DecisionPolicy"> & {
/**
* policy context used in the decision
*
Expand Down Expand Up @@ -151,12 +150,9 @@ export declare class DecisionPolicy extends Message<DecisionPolicy> {
* @generated from field: aserto.authorizer.v2.api.PolicyInstance policy_instance = 6;
*/
policyInstance?: PolicyInstance;
constructor(data?: PartialMessage<DecisionPolicy>);
static readonly runtime: typeof proto3;
static readonly typeName = "aserto.authorizer.v2.api.DecisionPolicy";
static readonly fields: FieldList;
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): DecisionPolicy;
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): DecisionPolicy;
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): DecisionPolicy;
static equals(a: DecisionPolicy | PlainMessage<DecisionPolicy> | undefined, b: DecisionPolicy | PlainMessage<DecisionPolicy> | undefined): boolean;
}
};
/**
* Describes the message aserto.authorizer.v2.api.DecisionPolicy.
* Use `create(DecisionPolicySchema)` to create a new message.
*/
export declare const DecisionPolicySchema: GenMessage<DecisionPolicy>;
Loading

0 comments on commit 375fb4e

Please sign in to comment.