Skip to content

Commit

Permalink
chore!: Move generated protobuf to default buf file path (#1009)
Browse files Browse the repository at this point in the history
Following the update to the Buf config v2 in arcjet/arcjet#2435 [the default path](https://buf.build/docs/migration-guides/migrate-v2-config-files#v2-configuration) is now `proto` so the `out` is specified as `../arcjet-js/protocol`
  • Loading branch information
davidmytton authored Jun 28, 2024
1 parent 6b692da commit 6800a00
Show file tree
Hide file tree
Showing 13 changed files with 15 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .trunk/trunk.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ lint:
- linters: [ALL]
paths:
- analyze/wasm/**
- protocol/gen/**
- protocol/proto/**
- "**/LICENSE"
- "**/CHANGELOG.md"
- .github/CODEOWNERS
Expand Down
2 changes: 0 additions & 2 deletions protocol/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,4 @@ client.js
client.d.ts
convert.js
convert.d.ts
proto.js
proto.d.ts
test/*.js
4 changes: 2 additions & 2 deletions protocol/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ import {
ArcjetRule,
ArcjetStack,
} from "./index.js";
import { DecideService } from "./gen/es/decide/v1alpha1/decide_connect.js";
import { DecideService } from "./proto/decide/v1alpha1/decide_connect.js";
import {
DecideRequest,
ReportRequest,
} from "./gen/es/decide/v1alpha1/decide_pb.js";
} from "./proto/decide/v1alpha1/decide_pb.js";

// TODO: Dedupe with `errorMessage` in core
function errorMessage(err: unknown): string {
Expand Down
2 changes: 1 addition & 1 deletion protocol/convert.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ import {
RuleState,
SDKStack,
ShieldReason,
} from "./gen/es/decide/v1alpha1/decide_pb.js";
} from "./proto/decide/v1alpha1/decide_pb.js";

export function ArcjetModeToProtocol(mode: ArcjetMode) {
switch (mode) {
Expand Down
2 changes: 1 addition & 1 deletion protocol/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { typeid } from "typeid-js";
import { Reason } from "./gen/es/decide/v1alpha1/decide_pb.js";
import { Reason } from "./proto/decide/v1alpha1/decide_pb.js";

type RequiredProps<T, K extends keyof T> = Required<Pick<T, K>> & Omit<T, K>;

Expand Down
2 changes: 1 addition & 1 deletion protocol/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"files": [
"LICENSE",
"README.md",
"gen/",
"proto/",
"*.js",
"*.d.ts",
"*.ts",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// @generated by protoc-gen-es v1.8.0
// @generated by protoc-gen-es v1.10.0
// @generated from file proto/decide/v1alpha1/decide.proto (package proto.decide.v1alpha1, syntax proto3)
/* eslint-disable */
// @ts-nocheck
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// @generated by protoc-gen-es v1.8.0
// @generated by protoc-gen-es v1.10.0
// @generated from file proto/decide/v1alpha1/decide.proto (package proto.decide.v1alpha1, syntax proto3)
/* eslint-disable */
// @ts-nocheck
Expand Down
8 changes: 4 additions & 4 deletions protocol/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ export default createConfig(import.meta.url, {
// This externalizes the auto-generated protobuf code so it is not
// processed by rollup
resolveId(source) {
if (source === "./gen/es/decide/v1alpha1/decide_pb.js") {
if (source === "./proto/decide/v1alpha1/decide_pb.js") {
return { id: source, external: true };
}
if (source === "../gen/es/decide/v1alpha1/decide_pb.js") {
if (source === "../proto/decide/v1alpha1/decide_pb.js") {
return { id: source, external: true };
}
if (source === "./gen/es/decide/v1alpha1/decide_connect.js") {
if (source === "./proto/decide/v1alpha1/decide_connect.js") {
return { id: source, external: true };
}
if (source === "../gen/es/decide/v1alpha1/decide_connect.js") {
if (source === "../proto/decide/v1alpha1/decide_connect.js") {
return { id: source, external: true };
}
return null;
Expand Down
4 changes: 2 additions & 2 deletions protocol/test/client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
} from "@jest/globals";
import { createClient } from "../client.js";
import { createRouterTransport } from "@connectrpc/connect";
import { DecideService } from "../gen/es/decide/v1alpha1/decide_connect.js";
import { DecideService } from "../proto/decide/v1alpha1/decide_connect.js";
import {
Conclusion,
DecideRequest,
Expand All @@ -20,7 +20,7 @@ import {
RuleResult,
RuleState,
SDKStack,
} from "../gen/es/decide/v1alpha1/decide_pb.js";
} from "../proto/decide/v1alpha1/decide_pb.js";
import {
ArcjetAllowDecision,
ArcjetChallengeDecision,
Expand Down
2 changes: 1 addition & 1 deletion protocol/test/convert.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import {
RuleResult,
RuleState,
SDKStack,
} from "../gen/es/decide/v1alpha1/decide_pb.js";
} from "../proto/decide/v1alpha1/decide_pb.js";
import {
ArcjetAllowDecision,
ArcjetBotReason,
Expand Down

0 comments on commit 6800a00

Please sign in to comment.