@hearth-auth/sdk 0.0.1
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.
- package/CHANGELOG.md +12 -0
- package/README.md +680 -0
- package/package.json +44 -0
- package/src/admin.ts +157 -0
- package/src/browser-auth.ts +130 -0
- package/src/claims.ts +180 -0
- package/src/client.ts +251 -0
- package/src/errors.ts +173 -0
- package/src/generated/google/api/annotations_pb.ts +44 -0
- package/src/generated/google/api/http_pb.ts +467 -0
- package/src/generated/hearth/authz/v1/authz_pb.ts +593 -0
- package/src/generated/hearth/cluster/v1/raft_pb.ts +183 -0
- package/src/generated/hearth/events/v1/audit_pb.ts +886 -0
- package/src/generated/hearth/identity/v1/identity_pb.ts +1673 -0
- package/src/generated/hearth/identity/v1/oauth_pb.ts +1138 -0
- package/src/generated/hearth/rbac/v1/rbac_pb.ts +2000 -0
- package/src/hearth-client.ts +288 -0
- package/src/hearth.ts +224 -0
- package/src/index.ts +106 -0
- package/src/introspection-client.ts +83 -0
- package/src/jwks-client.ts +45 -0
- package/src/middleware.ts +82 -0
- package/src/pkce.ts +129 -0
- package/src/react.tsx +57 -0
- package/src/session-version-cache.ts +167 -0
- package/src/types.ts +188 -0
- package/tests/admin-crud.test.ts +97 -0
- package/tests/auth-flow.test.ts +75 -0
- package/tests/authorize.test.ts +386 -0
- package/tests/claims.test.ts +159 -0
- package/tests/hasPermission.test.ts +152 -0
- package/tests/hearth-client.test.ts +243 -0
- package/tests/helpers.ts +90 -0
- package/tests/jwks.test.ts +62 -0
- package/tests/pkce.test.ts +210 -0
- package/tests/react-useHasPermission.test.tsx +92 -0
- package/tests/required-action.test.ts +276 -0
- package/tests/session-version.test.ts +391 -0
- package/tsconfig.json +16 -0
- package/vitest.config.ts +8 -0
package/src/client.ts
ADDED
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
import { decodeJwt } from "jose";
|
|
2
|
+
import { RequiredActionError } from "./errors.js";
|
|
3
|
+
import type {
|
|
4
|
+
AuthorizeParams,
|
|
5
|
+
AuthorizeResponse,
|
|
6
|
+
BootstrapResponse,
|
|
7
|
+
JwksDocument,
|
|
8
|
+
MePermissionsResponse,
|
|
9
|
+
RegisterClientParams,
|
|
10
|
+
OAuthClient,
|
|
11
|
+
TokenExchangeParams,
|
|
12
|
+
TokenResponse,
|
|
13
|
+
UserInfoResponse,
|
|
14
|
+
} from "./types.js";
|
|
15
|
+
|
|
16
|
+
/** Parameters for the PKCE authorization-code callback handler (spec §7). */
|
|
17
|
+
export interface HandleCallbackParams {
|
|
18
|
+
/** Full callback URL including query parameters (`code`, `state`, etc.). */
|
|
19
|
+
callbackUrl: string;
|
|
20
|
+
/** OAuth 2.0 client ID. */
|
|
21
|
+
clientId: string;
|
|
22
|
+
/** Redirect URI registered for this client. */
|
|
23
|
+
redirectUri: string;
|
|
24
|
+
/** PKCE code verifier generated during `login()` (RFC 7636). */
|
|
25
|
+
codeVerifier?: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** Error thrown when the Hearth API returns an error. */
|
|
29
|
+
export class HearthError extends Error {
|
|
30
|
+
constructor(
|
|
31
|
+
public readonly status: number,
|
|
32
|
+
public readonly body: unknown,
|
|
33
|
+
) {
|
|
34
|
+
super(`Hearth API error ${status}: ${JSON.stringify(body)}`);
|
|
35
|
+
this.name = "HearthError";
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** Configuration for HearthApiClient. */
|
|
40
|
+
export interface HearthApiClientConfig {
|
|
41
|
+
baseUrl: string;
|
|
42
|
+
realmId: string;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Low-level Hearth HTTP API client for auth code flows, token management,
|
|
47
|
+
* JWKS retrieval, and live RBAC claim resolution.
|
|
48
|
+
*
|
|
49
|
+
* @deprecated Use {@link HearthClient} from `hearth-client.js` as the
|
|
50
|
+
* recommended entry point. This class is kept as a lower-level primitive.
|
|
51
|
+
*/
|
|
52
|
+
export class HearthApiClient {
|
|
53
|
+
private readonly baseUrl: string;
|
|
54
|
+
private readonly realmId: string;
|
|
55
|
+
|
|
56
|
+
constructor(config: HearthApiClientConfig) {
|
|
57
|
+
this.baseUrl = config.baseUrl.replace(/\/$/, "");
|
|
58
|
+
this.realmId = config.realmId;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** POST /admin/bootstrap — create realm, admin user, tokens (dev mode only). */
|
|
62
|
+
static async bootstrap(baseUrl: string): Promise<BootstrapResponse> {
|
|
63
|
+
const url = `${baseUrl.replace(/\/$/, "")}/admin/bootstrap`;
|
|
64
|
+
const resp = await fetch(url, { method: "POST" });
|
|
65
|
+
if (!resp.ok) {
|
|
66
|
+
throw new HearthError(resp.status, await resp.json());
|
|
67
|
+
}
|
|
68
|
+
return resp.json() as Promise<BootstrapResponse>;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/** POST /clients — register an OAuth 2.0 client. */
|
|
72
|
+
async registerClient(params: RegisterClientParams): Promise<OAuthClient> {
|
|
73
|
+
return this.post("/clients", {
|
|
74
|
+
client_name: params.clientName,
|
|
75
|
+
redirect_uris: params.redirectUris,
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/** POST /authorize — initiate an authorization code flow. */
|
|
80
|
+
async authorize(params: AuthorizeParams): Promise<AuthorizeResponse> {
|
|
81
|
+
return this.post("/authorize", {
|
|
82
|
+
client_id: params.clientId,
|
|
83
|
+
redirect_uri: params.redirectUri,
|
|
84
|
+
scope: params.scope,
|
|
85
|
+
state: params.state,
|
|
86
|
+
response_type: params.responseType ?? "code",
|
|
87
|
+
user_id: params.userId,
|
|
88
|
+
code_challenge: params.codeChallenge,
|
|
89
|
+
code_challenge_method: params.codeChallengeMethod,
|
|
90
|
+
nonce: params.nonce,
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/** POST /token — exchange an authorization code for tokens. */
|
|
95
|
+
async exchangeCode(params: TokenExchangeParams): Promise<TokenResponse> {
|
|
96
|
+
return this.post("/token", {
|
|
97
|
+
client_id: params.clientId,
|
|
98
|
+
code: params.code,
|
|
99
|
+
redirect_uri: params.redirectUri,
|
|
100
|
+
code_verifier: params.codeVerifier,
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Handle a PKCE authorization-code callback (spec §7).
|
|
106
|
+
*
|
|
107
|
+
* Extracts the `code` from `callbackUrl`, exchanges it for tokens, then
|
|
108
|
+
* inspects the JWT's `token_type` claim before returning:
|
|
109
|
+
*
|
|
110
|
+
* - If `token_type === "required_action"`: throws {@link RequiredActionError}
|
|
111
|
+
* with `requiredActions` populated from the JWT's `required_actions` claim.
|
|
112
|
+
* - If the callback URL contains `required_action_redirect_uri`: throws
|
|
113
|
+
* {@link RequiredActionError} with `redirectUri` set to that value.
|
|
114
|
+
* - Otherwise: returns the token response normally.
|
|
115
|
+
*/
|
|
116
|
+
async handleCallback(params: HandleCallbackParams): Promise<TokenResponse> {
|
|
117
|
+
const url = new URL(params.callbackUrl);
|
|
118
|
+
const code = url.searchParams.get("code");
|
|
119
|
+
const requiredActionRedirectUri = url.searchParams.get(
|
|
120
|
+
"required_action_redirect_uri",
|
|
121
|
+
);
|
|
122
|
+
|
|
123
|
+
if (!code) {
|
|
124
|
+
throw new Error("handleCallback: no authorization code found in callback URL");
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
const tokens = await this.exchangeCode({
|
|
128
|
+
clientId: params.clientId,
|
|
129
|
+
code,
|
|
130
|
+
redirectUri: params.redirectUri,
|
|
131
|
+
codeVerifier: params.codeVerifier,
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
// Decode the access token to read Hearth-specific claims.
|
|
135
|
+
let jwtPayload: Record<string, unknown> = {};
|
|
136
|
+
try {
|
|
137
|
+
jwtPayload = decodeJwt(tokens.access_token) as Record<string, unknown>;
|
|
138
|
+
} catch {
|
|
139
|
+
// Non-JWT access tokens (opaque) skip required-action detection.
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
const tokenType = jwtPayload["token_type"];
|
|
143
|
+
const requiredActions = Array.isArray(jwtPayload["required_actions"])
|
|
144
|
+
? (jwtPayload["required_actions"] as string[])
|
|
145
|
+
: [];
|
|
146
|
+
|
|
147
|
+
if (tokenType === "required_action") {
|
|
148
|
+
throw new RequiredActionError(
|
|
149
|
+
requiredActions,
|
|
150
|
+
requiredActionRedirectUri ?? undefined,
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
if (requiredActionRedirectUri !== null) {
|
|
155
|
+
throw new RequiredActionError([], requiredActionRedirectUri);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
return tokens;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/** POST /token — refresh tokens using a refresh token. */
|
|
162
|
+
async refreshTokens(
|
|
163
|
+
clientId: string,
|
|
164
|
+
refreshToken: string,
|
|
165
|
+
): Promise<TokenResponse> {
|
|
166
|
+
return this.post("/token", {
|
|
167
|
+
client_id: clientId,
|
|
168
|
+
grant_type: "refresh_token",
|
|
169
|
+
refresh_token: refreshToken,
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* GET /v1/me/permissions — fetch the freshly-resolved RBAC claim set
|
|
175
|
+
* for the bearer-token user.
|
|
176
|
+
*
|
|
177
|
+
* Unlike `hasPermission()` on a `createHearth()` client (which reads
|
|
178
|
+
* the cached set from the JWT), this call queries the server and
|
|
179
|
+
* reflects any role/group assignments made since the token was issued.
|
|
180
|
+
*/
|
|
181
|
+
async permissions(accessToken: string): Promise<MePermissionsResponse> {
|
|
182
|
+
const resp = await fetch(`${this.baseUrl}/v1/me/permissions`, {
|
|
183
|
+
headers: {
|
|
184
|
+
"X-Realm-ID": this.realmId,
|
|
185
|
+
Authorization: `Bearer ${accessToken}`,
|
|
186
|
+
},
|
|
187
|
+
});
|
|
188
|
+
if (!resp.ok) {
|
|
189
|
+
throw new HearthError(resp.status, await resp.json());
|
|
190
|
+
}
|
|
191
|
+
return resp.json() as Promise<MePermissionsResponse>;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/** GET /userinfo — retrieve user claims using an access token. */
|
|
195
|
+
async userinfo(accessToken: string): Promise<UserInfoResponse> {
|
|
196
|
+
const resp = await fetch(`${this.baseUrl}/userinfo`, {
|
|
197
|
+
headers: {
|
|
198
|
+
"X-Realm-ID": this.realmId,
|
|
199
|
+
Authorization: `Bearer ${accessToken}`,
|
|
200
|
+
},
|
|
201
|
+
});
|
|
202
|
+
if (!resp.ok) {
|
|
203
|
+
throw new HearthError(resp.status, await resp.json());
|
|
204
|
+
}
|
|
205
|
+
return resp.json() as Promise<UserInfoResponse>;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/** GET /jwks — retrieve the JWKS document. */
|
|
209
|
+
async jwks(): Promise<JwksDocument> {
|
|
210
|
+
const resp = await fetch(`${this.baseUrl}/jwks`);
|
|
211
|
+
if (!resp.ok) {
|
|
212
|
+
throw new HearthError(resp.status, await resp.json());
|
|
213
|
+
}
|
|
214
|
+
return resp.json() as Promise<JwksDocument>;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/** GET /.well-known/openid-configuration — OIDC discovery document. */
|
|
218
|
+
async discovery(): Promise<Record<string, unknown>> {
|
|
219
|
+
const resp = await fetch(
|
|
220
|
+
`${this.baseUrl}/.well-known/openid-configuration`,
|
|
221
|
+
);
|
|
222
|
+
if (!resp.ok) {
|
|
223
|
+
throw new HearthError(resp.status, await resp.json());
|
|
224
|
+
}
|
|
225
|
+
return resp.json() as Promise<Record<string, unknown>>;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/** Creates an AdminClient using the given access token. */
|
|
229
|
+
admin(accessToken: string): AdminClient {
|
|
230
|
+
return new AdminClient(this.baseUrl, this.realmId, accessToken);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
private async post<T>(path: string, body: unknown): Promise<T> {
|
|
235
|
+
const resp = await fetch(`${this.baseUrl}${path}`, {
|
|
236
|
+
method: "POST",
|
|
237
|
+
headers: {
|
|
238
|
+
"Content-Type": "application/json",
|
|
239
|
+
"X-Realm-ID": this.realmId,
|
|
240
|
+
},
|
|
241
|
+
body: JSON.stringify(body),
|
|
242
|
+
});
|
|
243
|
+
if (!resp.ok) {
|
|
244
|
+
throw new HearthError(resp.status, await resp.json());
|
|
245
|
+
}
|
|
246
|
+
return resp.json() as Promise<T>;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
// AdminClient is imported here to avoid circular deps — it's re-exported from index.
|
|
251
|
+
import { AdminClient } from "./admin.js";
|
package/src/errors.ts
ADDED
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Spec §5 — Hearth SDK error hierarchy.
|
|
3
|
+
*
|
|
4
|
+
* All SDK-specific errors extend HearthSdkError so callers can catch
|
|
5
|
+
* the entire category with a single `instanceof HearthSdkError` check.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/** Base class for all Hearth SDK errors. */
|
|
9
|
+
export class HearthSdkError extends Error {
|
|
10
|
+
constructor(message: string) {
|
|
11
|
+
super(message);
|
|
12
|
+
this.name = this.constructor.name;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/** Thrown when the client is misconfigured (missing baseUrl, realmId, etc.). */
|
|
17
|
+
export class ConfigurationError extends HearthSdkError {
|
|
18
|
+
constructor(message: string) {
|
|
19
|
+
super(message);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** Thrown when the OIDC discovery document cannot be fetched or parsed. */
|
|
24
|
+
export class DiscoveryError extends HearthSdkError {
|
|
25
|
+
constructor(
|
|
26
|
+
message: string,
|
|
27
|
+
public readonly cause?: unknown,
|
|
28
|
+
) {
|
|
29
|
+
super(message);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** Thrown when fetching or parsing the JWKS document fails. */
|
|
34
|
+
export class JWKSFetchError extends HearthSdkError {
|
|
35
|
+
constructor(
|
|
36
|
+
message: string,
|
|
37
|
+
public readonly cause?: unknown,
|
|
38
|
+
) {
|
|
39
|
+
super(message);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** Thrown when a token's `exp` claim is in the past. */
|
|
44
|
+
export class TokenExpiredError extends HearthSdkError {
|
|
45
|
+
constructor(
|
|
46
|
+
public readonly expiredAt: Date,
|
|
47
|
+
message = `Token expired at ${expiredAt.toISOString()}`,
|
|
48
|
+
) {
|
|
49
|
+
super(message);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** Thrown when a token's `nbf` claim is in the future. */
|
|
54
|
+
export class TokenNotYetValidError extends HearthSdkError {
|
|
55
|
+
constructor(
|
|
56
|
+
public readonly notBefore: Date,
|
|
57
|
+
message = `Token not yet valid until ${notBefore.toISOString()}`,
|
|
58
|
+
) {
|
|
59
|
+
super(message);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** Thrown when a token fails signature or structural validation. */
|
|
64
|
+
export class TokenInvalidError extends HearthSdkError {
|
|
65
|
+
constructor(message: string) {
|
|
66
|
+
super(message);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** Thrown when the token's `iss` claim does not match the expected issuer. */
|
|
71
|
+
export class TokenIssuerError extends HearthSdkError {
|
|
72
|
+
constructor(
|
|
73
|
+
public readonly expected: string,
|
|
74
|
+
public readonly actual: string,
|
|
75
|
+
message = `Token issuer mismatch: expected "${expected}", got "${actual}"`,
|
|
76
|
+
) {
|
|
77
|
+
super(message);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/** Thrown when the token's `aud` claim does not include the expected audience. */
|
|
82
|
+
export class TokenAudienceError extends HearthSdkError {
|
|
83
|
+
constructor(
|
|
84
|
+
public readonly expected: string,
|
|
85
|
+
public readonly actual: string[],
|
|
86
|
+
message = `Token audience mismatch: expected "${expected}", got [${actual.join(", ")}]`,
|
|
87
|
+
) {
|
|
88
|
+
super(message);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Thrown when a token has `token_type === "required_action"`, indicating the
|
|
94
|
+
* user must complete pending actions before the token can be used for general
|
|
95
|
+
* API access. Also thrown when the callback URL contains
|
|
96
|
+
* `required_action_redirect_uri` (spec §5, §7).
|
|
97
|
+
*/
|
|
98
|
+
export class RequiredActionError extends HearthSdkError {
|
|
99
|
+
constructor(
|
|
100
|
+
/** Pending action names from the token's `required_actions` claim. */
|
|
101
|
+
public readonly requiredActions: string[],
|
|
102
|
+
/** Optional URL to the Hearth interstitial page for completing the actions. */
|
|
103
|
+
public readonly redirectUri?: string,
|
|
104
|
+
message = `Required actions pending: ${requiredActions.join(", ")}`,
|
|
105
|
+
) {
|
|
106
|
+
super(message);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/** Thrown when a token introspection request fails or returns inactive. */
|
|
111
|
+
export class IntrospectionError extends HearthSdkError {
|
|
112
|
+
constructor(
|
|
113
|
+
message: string,
|
|
114
|
+
public readonly cause?: unknown,
|
|
115
|
+
) {
|
|
116
|
+
super(message);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Thrown when the `mode` field echoed in an introspection response does not
|
|
122
|
+
* match the SDK's configured `expectedMode`.
|
|
123
|
+
*
|
|
124
|
+
* Per HEA-923 design constraint: mode must be validated explicitly; the SDK
|
|
125
|
+
* MUST NOT silently tolerate a server returning a different mode than the one
|
|
126
|
+
* configured for the resource server.
|
|
127
|
+
*/
|
|
128
|
+
export class AuthorizationModeMismatchError extends HearthSdkError {
|
|
129
|
+
constructor(
|
|
130
|
+
public readonly expected: string,
|
|
131
|
+
public readonly actual: string,
|
|
132
|
+
message = `Authorization mode mismatch: expected "${expected}", got "${actual}"`,
|
|
133
|
+
) {
|
|
134
|
+
super(message);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Thrown when a token's `sv` claim is below the minimum accepted session
|
|
140
|
+
* version for the session (RFC HEA-930 § 8).
|
|
141
|
+
*
|
|
142
|
+
* Resource servers should translate this into an HTTP 401 response.
|
|
143
|
+
*/
|
|
144
|
+
export class SessionVersionRevokedError extends HearthSdkError {
|
|
145
|
+
constructor(
|
|
146
|
+
public readonly sessionId: string,
|
|
147
|
+
public readonly tokenSv: bigint,
|
|
148
|
+
public readonly minSv: bigint,
|
|
149
|
+
message = `Session version revoked: sid=${sessionId}, sv=${tokenSv} < min=${minSv}`,
|
|
150
|
+
) {
|
|
151
|
+
super(message);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Thrown when the session-version cache has not been refreshed within
|
|
157
|
+
* `staleThresholdMs` (RFC HEA-930 § 8.1).
|
|
158
|
+
*
|
|
159
|
+
* When `onStale` is `"reject"`, resource servers should translate this into
|
|
160
|
+
* an HTTP 401 response with `error=session_version_cache_stale`.
|
|
161
|
+
* When `onStale` is `"introspect"`, catch this error and fall back to the
|
|
162
|
+
* introspection endpoint.
|
|
163
|
+
*/
|
|
164
|
+
export class SessionVersionCacheStaleError extends HearthSdkError {
|
|
165
|
+
constructor(
|
|
166
|
+
/** Cache age in milliseconds, or -1 if the cache has never been seeded. */
|
|
167
|
+
public readonly ageMs: number,
|
|
168
|
+
public readonly onStale: "reject" | "introspect" = "reject",
|
|
169
|
+
message = `Session version cache stale: age=${ageMs < 0 ? "never seeded" : `${ageMs}ms`}`,
|
|
170
|
+
) {
|
|
171
|
+
super(message);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// Copyright 2015 Google LLC
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
|
|
15
|
+
// Vendored from github.com/googleapis/googleapis (Apache-2.0).
|
|
16
|
+
// Kept minimal: only annotations.proto + http.proto are needed for
|
|
17
|
+
// google.api.http method annotations. Replaces the buf.build remote
|
|
18
|
+
// dependency so CI never needs the buf module cache hydrated.
|
|
19
|
+
|
|
20
|
+
// @generated by protoc-gen-es v2.12.0 with parameter "target=ts"
|
|
21
|
+
// @generated from file google/api/annotations.proto (package google.api, syntax proto3)
|
|
22
|
+
/* eslint-disable */
|
|
23
|
+
|
|
24
|
+
import type { GenExtension, GenFile } from "@bufbuild/protobuf/codegenv2";
|
|
25
|
+
import { extDesc, fileDesc } from "@bufbuild/protobuf/codegenv2";
|
|
26
|
+
import type { HttpRule } from "./http_pb";
|
|
27
|
+
import { file_google_api_http } from "./http_pb";
|
|
28
|
+
import type { MethodOptions } from "@bufbuild/protobuf/wkt";
|
|
29
|
+
import { file_google_protobuf_descriptor } from "@bufbuild/protobuf/wkt";
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Describes the file google/api/annotations.proto.
|
|
33
|
+
*/
|
|
34
|
+
export const file_google_api_annotations: GenFile = /*@__PURE__*/
|
|
35
|
+
fileDesc("Chxnb29nbGUvYXBpL2Fubm90YXRpb25zLnByb3RvEgpnb29nbGUuYXBpOksKBGh0dHASHi5nb29nbGUucHJvdG9idWYuTWV0aG9kT3B0aW9ucxiwyrwiIAEoCzIULmdvb2dsZS5hcGkuSHR0cFJ1bGVSBGh0dHBCbgoOY29tLmdvb2dsZS5hcGlCEEFubm90YXRpb25zUHJvdG9QAVpBZ29vZ2xlLmdvbGFuZy5vcmcvZ2VucHJvdG8vZ29vZ2xlYXBpcy9hcGkvYW5ub3RhdGlvbnM7YW5ub3RhdGlvbnOiAgRHQVBJYgZwcm90bzM", [file_google_api_http, file_google_protobuf_descriptor]);
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* See `HttpRule`.
|
|
39
|
+
*
|
|
40
|
+
* @generated from extension: google.api.HttpRule http = 72295728;
|
|
41
|
+
*/
|
|
42
|
+
export const http: GenExtension<MethodOptions, HttpRule> = /*@__PURE__*/
|
|
43
|
+
extDesc(file_google_api_annotations, 0);
|
|
44
|
+
|