@waterlock/gateway 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,18 @@
1
+ import type { CredentialSource } from "../../core/credentials.js";
2
+ import type { ProviderRequest } from "../../core/policy.js";
3
+ import { type LinearAction, type LinearParams } from "./generated.js";
4
+ export type * from "./generated.js";
5
+ export { linearSdl } from "./generated.js";
6
+ /**
7
+ * What Linear rules see. Narrow on `action` to get typed params, e.g.
8
+ * `r.action === "linear.mutation.issueCreate" && r.params.input.teamId === TEAM`.
9
+ */
10
+ export type LinearRequest = {
11
+ [A in LinearAction]: ProviderRequest<"linear", A, LinearParams[A], Record<string, never>>;
12
+ }[LinearAction];
13
+ export declare function linear(opts: {
14
+ credentials: CredentialSource;
15
+ /** `oauth` (default) sends `Authorization: Bearer <token>`; `apiKey` sends a personal API key as-is. */
16
+ auth?: "oauth" | "apiKey";
17
+ upstream?: string;
18
+ }): import("../../core/provider.js").ProviderDefinition<LinearRequest>;
@@ -0,0 +1,15 @@
1
+ import { createProvider } from "../../core/provider.js";
2
+ import { buildSchema } from "graphql";
3
+ import { createGraphqlMatcher } from "../../graphql/index.js";
4
+ import { linearSdl } from "./generated.js";
5
+ export { linearSdl } from "./generated.js";
6
+ let schema; // built once (~100ms), on first linear() call
7
+ export function linear(opts) {
8
+ return createProvider({
9
+ id: "linear",
10
+ upstream: opts.upstream ?? "https://api.linear.app",
11
+ graphql: { endpoint: "/graphql", matcher: createGraphqlMatcher({ provider: "linear", schema: (schema ??= buildSchema(linearSdl)) }) },
12
+ credentials: opts.credentials,
13
+ ...(opts.auth === "apiKey" ? { inject: ({ headers, credential }) => headers.set("authorization", credential.token) } : {}),
14
+ });
15
+ }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Codegen config for Linear's public GraphQL schema. Review codegen-report.md after any change to schema.graphql.
3
+ */
4
+ declare const _default: import("../../codegen/config.js").CodegenConfig;
5
+ export default _default;
@@ -0,0 +1,27 @@
1
+ import { defineCodegenConfig } from "../../codegen/config.js";
2
+ /**
3
+ * Codegen config for Linear's public GraphQL schema. Review codegen-report.md after any change to schema.graphql.
4
+ */
5
+ export default defineCodegenConfig({
6
+ provider: "linear",
7
+ typePrefix: "Linear",
8
+ source: {
9
+ kind: "graphql",
10
+ title: "Linear API",
11
+ file: "./schema.graphql",
12
+ url: "https://raw.githubusercontent.com/linear/linear/master/packages/sdk/src/schema.graphql",
13
+ },
14
+ out: "./generated.ts",
15
+ report: "./codegen-report.md",
16
+ typesImport: "../../core/types.js",
17
+ scalars: {
18
+ DateTime: "string",
19
+ DateTimeOrDuration: "string",
20
+ Duration: "string",
21
+ TimelessDate: "string",
22
+ TimelessDateOrDuration: "string",
23
+ UUID: "string",
24
+ JSON: "unknown",
25
+ JSONObject: "Record<string, unknown>",
26
+ },
27
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@waterlock/gateway",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Credential-injecting policy gateway for AI agent tool calls",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -10,6 +10,7 @@
10
10
  },
11
11
  "homepage": "https://github.com/waterlockcc/waterlock#readme",
12
12
  "bugs": "https://github.com/waterlockcc/waterlock/issues",
13
+ "packageManager": "pnpm@10.26.0",
13
14
  "engines": {
14
15
  "node": ">=24"
15
16
  },
@@ -29,15 +30,34 @@
29
30
  "types": "./dist/providers/gmail/index.d.ts",
30
31
  "default": "./dist/providers/gmail/index.js"
31
32
  },
33
+ "./providers/linear": {
34
+ "types": "./dist/providers/linear/index.d.ts",
35
+ "default": "./dist/providers/linear/index.js"
36
+ },
32
37
  "./checks": {
33
38
  "types": "./dist/checks/index.d.ts",
34
39
  "default": "./dist/checks/index.js"
40
+ },
41
+ "./graphql": {
42
+ "types": "./dist/graphql/index.d.ts",
43
+ "default": "./dist/graphql/index.js"
35
44
  }
36
45
  },
37
46
  "publishConfig": {
38
47
  "access": "public"
39
48
  },
49
+ "scripts": {
50
+ "build": "rm -rf dist && tsc -p tsconfig.build.json",
51
+ "prepublishOnly": "pnpm typecheck && pnpm test && pnpm build",
52
+ "gen:gmail": "tsx src/codegen/cli.ts src/providers/gmail/gmail.config.ts",
53
+ "gen:gmail:fetch": "tsx src/codegen/cli.ts src/providers/gmail/gmail.config.ts --fetch",
54
+ "gen:linear": "tsx src/codegen/cli.ts src/providers/linear/linear.config.ts",
55
+ "gen:linear:fetch": "tsx src/codegen/cli.ts src/providers/linear/linear.config.ts --fetch",
56
+ "test": "vitest run",
57
+ "typecheck": "tsc --noEmit"
58
+ },
40
59
  "dependencies": {
60
+ "graphql": "^17.0.2",
41
61
  "postal-mime": "4.2.0"
42
62
  },
43
63
  "peerDependencies": {
@@ -52,6 +72,7 @@
52
72
  "@ai-sdk/openai": "^4.0.110",
53
73
  "@googleapis/gmail": "^22.0.2",
54
74
  "@hono/node-server": "^2.1.6",
75
+ "@linear/sdk": "99.0.0",
55
76
  "@types/node": "^26.6.6",
56
77
  "ai": "^7.0.164",
57
78
  "ai-sdk-provider-claude-code": "^4.4.1",
@@ -59,12 +80,5 @@
59
80
  "typescript": "^7.0.2",
60
81
  "vitest": "^5.1.0",
61
82
  "zod": "^4.6.7"
62
- },
63
- "scripts": {
64
- "build": "rm -rf dist && tsc -p tsconfig.build.json",
65
- "gen:gmail": "tsx src/codegen/cli.ts src/providers/gmail/gmail.config.ts",
66
- "gen:gmail:fetch": "tsx src/codegen/cli.ts src/providers/gmail/gmail.config.ts --fetch",
67
- "test": "vitest run",
68
- "typecheck": "tsc --noEmit"
69
83
  }
70
- }
84
+ }