@burdenoff/be-sdk 2026.1111.1 → 2026.1113.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/dist/activity/index.d.ts +2 -2
- package/dist/ai-credits/index.d.ts +1 -1
- package/dist/auth/index.d.ts +1 -1
- package/dist/bootstrap/index.d.ts +1 -1
- package/dist/bun-runtime-metrics-CPy5D6NT.js +58 -0
- package/dist/bun-runtime-metrics-CPy5D6NT.js.map +1 -0
- package/dist/cache/index.d.ts +1 -1
- package/dist/context/index.d.ts +1 -1
- package/dist/event-queue/index.d.ts +1 -1
- package/dist/export/index.d.ts +1 -1
- package/dist/export/index.js +1 -1
- package/dist/{export-DJXE3Osa.js → export-lqKewsuF.js} +2 -2
- package/dist/{export-DJXE3Osa.js.map → export-lqKewsuF.js.map} +1 -1
- package/dist/files/index.d.ts +1 -1
- package/dist/gateway/index.d.ts +3 -3
- package/dist/gateway/index.js +2 -2
- package/dist/gateway-2en8Gx_a.js +274 -0
- package/dist/gateway-2en8Gx_a.js.map +1 -0
- package/dist/graph/index.d.ts +1 -1
- package/dist/{graphql-CUDyhibV.d.ts → graphql-C8jKLLel.d.ts} +1 -1
- package/dist/{index-B2LCaK0R.d.ts → index-479i3w77.d.ts} +1 -1
- package/dist/{index-BGzMYJsm.d.ts → index-8pUSoT85.d.ts} +1 -1
- package/dist/{index-ADmsX0BI.d.ts → index-9MJVKzWA.d.ts} +3 -3
- package/dist/{index-FbXPfen7.d.ts → index-BJwHEzpN.d.ts} +1 -1
- package/dist/{index-CTTwo9av.d.ts → index-BTaQMEgB.d.ts} +1 -1
- package/dist/{index-CDOqxSIi.d.ts → index-Base-sg5.d.ts} +1 -1
- package/dist/{index-C_GXXF32.d.ts → index-Bh6W5JO4.d.ts} +3 -3
- package/dist/{index-BeVtqGO-.d.ts → index-Bwn5Z1h-.d.ts} +1 -1
- package/dist/{index-FRRaa6h2.d.ts → index-CEtULfb_.d.ts} +3 -3
- package/dist/{index-DqbGqfAy.d.ts → index-Cwu5Mpji.d.ts} +1 -1
- package/dist/{index-CaM9JUcc.d.ts → index-DSynXDRD.d.ts} +1 -1
- package/dist/{index-CVCyKzhB.d.ts → index-DWER4-_x.d.ts} +3 -3
- package/dist/{index-cmR9k9ga.d.ts → index-DhFP_AIB.d.ts} +1 -1
- package/dist/{index-zd_NPGJo.d.ts → index-DqpCL9kD.d.ts} +4 -4
- package/dist/{index-U_tu3zUl.d.ts → index-Dw_0wE4q.d.ts} +2 -2
- package/dist/{index-3KOZ1zN9.d.ts → index-HeUeEsMU.d.ts} +1 -1
- package/dist/{index-Cot73bdh.d.ts → index-KlrnELrN.d.ts} +1 -1
- package/dist/{index-MArCb8Aq.d.ts → index-SvWwlTUC.d.ts} +1 -1
- package/dist/{index-CHwMhK6v.d.ts → index-YMGOJins.d.ts} +2 -2
- package/dist/index-oJMtR3nl.d.ts +88 -0
- package/dist/index.d.ts +21 -21
- package/dist/index.js +5 -5
- package/dist/init/index.d.ts +1 -1
- package/dist/init/index.js +1 -1
- package/dist/{init-CQPFmOOe.js → init-D814LeLF.js} +2 -2
- package/dist/{init-CQPFmOOe.js.map → init-D814LeLF.js.map} +1 -1
- package/dist/instrumentation/index.d.ts +2 -2
- package/dist/layer/index.d.ts +2 -2
- package/dist/layer-Bcix-WCl.js.map +1 -1
- package/dist/{layer-BZBZZWeV.d.ts → layer-C0zxAUgR.d.ts} +1 -0
- package/dist/logger/index.d.ts +1 -1
- package/dist/notifications/index.d.ts +1 -1
- package/dist/payments/index.d.ts +2 -2
- package/dist/rbac/index.d.ts +1 -1
- package/dist/resource-caps/index.d.ts +1 -1
- package/dist/{sdk-B62itAH1.js → sdk-DqIqX-Ue.js} +33 -2
- package/dist/sdk-DqIqX-Ue.js.map +1 -0
- package/dist/search/index.d.ts +2 -2
- package/dist/security/index.d.ts +1 -1
- package/dist/security/rate-limit/index.d.ts +1 -1
- package/dist/server/index.js +2 -3
- package/dist/server/index.js.map +1 -1
- package/dist/tags/index.d.ts +1 -1
- package/dist/telemetry/index.d.ts +2 -2
- package/dist/telemetry/index.js +8 -4
- package/dist/telemetry/index.js.map +1 -1
- package/dist/temporal/index.d.ts +1 -1
- package/dist/tracker/index.d.ts +2 -2
- package/dist/tracker/index.js +2 -2
- package/dist/{tracker-PQztSlhJ.js → tracker-Cl3cGKe-.js} +2 -2
- package/dist/{tracker-PQztSlhJ.js.map → tracker-Cl3cGKe-.js.map} +1 -1
- package/dist/translation/index.d.ts +2 -2
- package/dist/types/index.d.ts +2 -2
- package/dist/{types-C6EKaS3V.d.ts → types-gJ9Qqi9E.d.ts} +1 -1
- package/dist/usage/index.d.ts +1 -1
- package/dist/usage/index.js +1 -1
- package/dist/{usage-BRqVP3CJ.js → usage-ygkKsxdd.js} +2 -2
- package/dist/{usage-BRqVP3CJ.js.map → usage-ygkKsxdd.js.map} +1 -1
- package/package.json +1 -1
- package/dist/gateway-ByVo-n37.js +0 -50
- package/dist/gateway-ByVo-n37.js.map +0 -1
- package/dist/index-YOShAwkq.d.ts +0 -45
- package/dist/sdk-B62itAH1.js.map +0 -1
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-ad2WFvuA.js";
|
|
2
|
+
import { a as isGatewayClientError, i as createGatewayClientFromEnv, r as createGatewayClient, t as GatewayClient } from "./client-sAJTrb4i.js";
|
|
3
|
+
import { t as signServiceJwt } from "./service-jwt-Bu-WNA_-.js";
|
|
4
|
+
import { n as GatewayError, r as GatewayErrorType, t as CircuitState } from "./types-BYMYND1L.js";
|
|
5
|
+
import { t as security_exports } from "./security-DIG-95Ic.js";
|
|
6
|
+
|
|
7
|
+
// src/gateway/delegated-transport.ts
|
|
8
|
+
/** Header an internal gateway reads a delegated `app_as_user` bearer from. */
|
|
9
|
+
const DELEGATED_AUTHORIZATION_HEADER = "x-delegated-authorization";
|
|
10
|
+
const JWT_SEGMENT = /^[A-Za-z0-9_-]+$/;
|
|
11
|
+
function isCompactJwt(token) {
|
|
12
|
+
const segments = token.split(".");
|
|
13
|
+
return segments.length === 3 && segments.every((segment) => JWT_SEGMENT.test(segment));
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Builds the request headers for a delegated internal-gateway call, for use as
|
|
17
|
+
* `GatewayClient.internalQuery({ query, headers })`.
|
|
18
|
+
*
|
|
19
|
+
* @throws Error when the token is not a compact JWS (so a malformed value can
|
|
20
|
+
* never be smuggled into a header) or the workspace id is blank.
|
|
21
|
+
*/
|
|
22
|
+
function buildDelegatedGatewayHeaders(input) {
|
|
23
|
+
const token = input.appAsUserToken;
|
|
24
|
+
if (typeof token !== "string" || token.length === 0 || token.length > 8192 || !isCompactJwt(token)) throw new Error("Delegated gateway transport requires a compact app_as_user token");
|
|
25
|
+
const headers = { [DELEGATED_AUTHORIZATION_HEADER]: `Bearer ${token}` };
|
|
26
|
+
if (input.workspaceId !== void 0) {
|
|
27
|
+
const workspaceId = input.workspaceId.trim();
|
|
28
|
+
if (workspaceId.length === 0 || workspaceId !== input.workspaceId) throw new Error("Delegated gateway transport requires a non-blank workspace id");
|
|
29
|
+
headers["x-workspace-id"] = workspaceId;
|
|
30
|
+
}
|
|
31
|
+
return headers;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// src/gateway/proactive-identity.ts
|
|
35
|
+
/**
|
|
36
|
+
* Proactive assistant identity (BOFF-13161, Contract C2 of BOFF-13159).
|
|
37
|
+
*
|
|
38
|
+
* A background proactive assistant reads a product AS a user, read-only, and
|
|
39
|
+
* only after the user opted in. global-auth-svc owns the identity: one
|
|
40
|
+
* service-managed BOT app per product (`proactive-assistant-<product>`), the
|
|
41
|
+
* user's consent as an AppUserDelegation with scopes `["delegation:read"]`
|
|
42
|
+
* per workspace for 30 days, and a short-lived `app_as_user` read token. The
|
|
43
|
+
* gateways refuse every mutation and subscription such a token sends
|
|
44
|
+
* (FORBIDDEN / DELEGATION_READ_ONLY, Contract C1).
|
|
45
|
+
*
|
|
46
|
+
* These helpers call global-auth's internal, service-only fields over the
|
|
47
|
+
* global internal gateway, signed as the calling service. Only the proactive
|
|
48
|
+
* orchestrator service (wspace-sandbox-svc) is accepted by global-auth.
|
|
49
|
+
*
|
|
50
|
+
* Trust boundary: pass the user the calling service authenticated itself (the
|
|
51
|
+
* gateway-verified actor of its own self-scoped request), never an id taken
|
|
52
|
+
* from job input, a model's output or any other untrusted text.
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* ```ts
|
|
56
|
+
* import {
|
|
57
|
+
* buildDelegatedGatewayHeaders,
|
|
58
|
+
* createGatewayClientFromEnv,
|
|
59
|
+
* issueProactiveReadToken,
|
|
60
|
+
* } from '@burdenoff/be-sdk/gateway';
|
|
61
|
+
*
|
|
62
|
+
* const { token } = await issueProactiveReadToken({ product: 'fluidgrids', userId, workspaceId });
|
|
63
|
+
* // Read as the user through the internal gateway; a mutation is refused there.
|
|
64
|
+
* await createGatewayClientFromEnv().internalQuery({
|
|
65
|
+
* query: '{ workflows { id name } }',
|
|
66
|
+
* headers: buildDelegatedGatewayHeaders({ appAsUserToken: token, workspaceId }),
|
|
67
|
+
* });
|
|
68
|
+
* ```
|
|
69
|
+
*
|
|
70
|
+
* @module gateway/proactive-identity
|
|
71
|
+
*/
|
|
72
|
+
/** The only scope a proactive consent or read token carries. */
|
|
73
|
+
const PROACTIVE_READ_SCOPE = "delegation:read";
|
|
74
|
+
/** Client id of a product's proactive assistant app. */
|
|
75
|
+
function proactiveAssistantClientId(product) {
|
|
76
|
+
return `proactive-assistant-${product.trim().toLowerCase()}`;
|
|
77
|
+
}
|
|
78
|
+
var ProactiveIdentityError = class extends Error {
|
|
79
|
+
code;
|
|
80
|
+
constructor(message, code) {
|
|
81
|
+
super(message);
|
|
82
|
+
this.code = code;
|
|
83
|
+
this.name = "ProactiveIdentityError";
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
/** Whether `error` is the refusal for a user without live consent. */
|
|
87
|
+
function isProactiveConsentMissing(error) {
|
|
88
|
+
return error instanceof ProactiveIdentityError && error.code === "CONSENT_MISSING";
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* GraphQL codes that describe an unavailable dependency rather than a decision
|
|
92
|
+
* by global-auth; the gateways mask an unreachable subgraph with these.
|
|
93
|
+
*/
|
|
94
|
+
const UNAVAILABLE_CODES = /* @__PURE__ */ new Set([
|
|
95
|
+
"INTERNAL_SERVER_ERROR",
|
|
96
|
+
"SERVICE_UNAVAILABLE",
|
|
97
|
+
"AUTH_SERVICE_UNAVAILABLE",
|
|
98
|
+
"DOWNSTREAM_SERVICE_ERROR",
|
|
99
|
+
"GATEWAY_TIMEOUT"
|
|
100
|
+
]);
|
|
101
|
+
const DEFAULT_TIMEOUT_MS = 1e4;
|
|
102
|
+
function codeOf(error) {
|
|
103
|
+
const code = error.extensions?.["code"];
|
|
104
|
+
return typeof code === "string" ? code : null;
|
|
105
|
+
}
|
|
106
|
+
/** The refusal carried by a GraphQL error, or null when it is not a decision. */
|
|
107
|
+
function refusalOf(errors) {
|
|
108
|
+
const first = errors?.[0];
|
|
109
|
+
if (!first) return null;
|
|
110
|
+
const code = codeOf(first);
|
|
111
|
+
if (!code || UNAVAILABLE_CODES.has(code)) return null;
|
|
112
|
+
return new ProactiveIdentityError(first.message, code);
|
|
113
|
+
}
|
|
114
|
+
function cloudflareAccessHeaders() {
|
|
115
|
+
const id = process.env["CF_ACCESS_CLIENT_ID"];
|
|
116
|
+
const secret = process.env["CF_ACCESS_CLIENT_SECRET"];
|
|
117
|
+
return id && secret ? {
|
|
118
|
+
"cf-access-client-id": id,
|
|
119
|
+
"cf-access-client-secret": secret
|
|
120
|
+
} : {};
|
|
121
|
+
}
|
|
122
|
+
function envServiceIdentity() {
|
|
123
|
+
return (process.env["SERVICE_IDENTITY"] || process.env["SERVICE_NAME"])?.trim() || void 0;
|
|
124
|
+
}
|
|
125
|
+
function defaultClient(timeoutMs, identity) {
|
|
126
|
+
const url = (process.env["GLOBAL_INT_GATEWAY_URL"] || process.env["GLOBAL_PUBLIC_GATEWAY_URL"])?.trim();
|
|
127
|
+
if (!url) throw new ProactiveIdentityError("No global gateway is configured (GLOBAL_INT_GATEWAY_URL)", "UNAVAILABLE");
|
|
128
|
+
if (!identity) throw new ProactiveIdentityError("SERVICE_IDENTITY or SERVICE_NAME is required to sign the call", "UNAVAILABLE");
|
|
129
|
+
const layer = process.env["SERVICE_LAYER"] === "global" ? "global" : "wspace";
|
|
130
|
+
return new GatewayClient({
|
|
131
|
+
layer,
|
|
132
|
+
serviceName: identity,
|
|
133
|
+
serviceIdentity: identity,
|
|
134
|
+
crossLayerGatewayUrl: url,
|
|
135
|
+
timeout: timeoutMs
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
function requireTarget(input) {
|
|
139
|
+
for (const [name, value] of Object.entries({
|
|
140
|
+
product: input.product,
|
|
141
|
+
userId: input.userId,
|
|
142
|
+
workspaceId: input.workspaceId
|
|
143
|
+
})) if (typeof value !== "string" || value.trim().length === 0) throw new ProactiveIdentityError(`${name} is required`, "BAD_USER_INPUT");
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Call one global-auth field as this service. The call is never retried and
|
|
147
|
+
* bypasses the circuit breaker: a refusal must surface at once, and the
|
|
148
|
+
* callers fail closed.
|
|
149
|
+
*/
|
|
150
|
+
async function call(query, variables, field, options) {
|
|
151
|
+
const identity = options.serviceIdentity?.trim() || envServiceIdentity();
|
|
152
|
+
const client = options.client ?? defaultClient(options.timeoutMs ?? DEFAULT_TIMEOUT_MS, identity);
|
|
153
|
+
let response;
|
|
154
|
+
try {
|
|
155
|
+
response = await client.crossLayerQuery({
|
|
156
|
+
query,
|
|
157
|
+
variables,
|
|
158
|
+
headers: {
|
|
159
|
+
"x-actor-type": "service",
|
|
160
|
+
...identity ? { "x-service-name": identity } : {},
|
|
161
|
+
...cloudflareAccessHeaders()
|
|
162
|
+
},
|
|
163
|
+
skipRetry: true,
|
|
164
|
+
skipCircuitBreaker: true
|
|
165
|
+
});
|
|
166
|
+
} catch (error) {
|
|
167
|
+
const refusal = error instanceof GatewayError ? refusalOf(error.graphqlErrors) : null;
|
|
168
|
+
if (refusal) throw refusal;
|
|
169
|
+
throw new ProactiveIdentityError(`global-auth is unreachable: ${error instanceof Error ? error.message : String(error)}`, "UNAVAILABLE");
|
|
170
|
+
}
|
|
171
|
+
if (response.errors?.length) throw refusalOf(response.errors) ?? new ProactiveIdentityError(response.errors[0]?.message ?? "global-auth failed", "UNAVAILABLE");
|
|
172
|
+
const data = response.data?.[field];
|
|
173
|
+
if (data === void 0 || data === null) throw new ProactiveIdentityError(`global-auth returned no ${field}`, "EMPTY_RESPONSE");
|
|
174
|
+
return data;
|
|
175
|
+
}
|
|
176
|
+
const CONSENT_FIELDS = "product clientId userId workspaceId granted expiresAt";
|
|
177
|
+
function toConsent(raw) {
|
|
178
|
+
return {
|
|
179
|
+
...raw,
|
|
180
|
+
expiresAt: raw.expiresAt ? new Date(raw.expiresAt) : null
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Mint a read-only `app_as_user` token (scope `delegation:read`, bound to the
|
|
185
|
+
* workspace, 15 minutes by default and never past the consent) for the
|
|
186
|
+
* product's proactive assistant acting as the user. Use it with
|
|
187
|
+
* `buildDelegatedGatewayHeaders`.
|
|
188
|
+
*
|
|
189
|
+
* @throws ProactiveIdentityError with code `CONSENT_MISSING` when the user has
|
|
190
|
+
* no live consent for the workspace, or another code when the call failed.
|
|
191
|
+
*/
|
|
192
|
+
async function issueProactiveReadToken(input, options = {}) {
|
|
193
|
+
requireTarget(input);
|
|
194
|
+
const minted = await call(`mutation IssueProactiveReadToken($input: IssueProactiveReadTokenInternalInput!) {
|
|
195
|
+
issueProactiveReadTokenInternal(input: $input) { token expiresAt }
|
|
196
|
+
}`, { input: {
|
|
197
|
+
product: input.product,
|
|
198
|
+
userId: input.userId,
|
|
199
|
+
workspaceId: input.workspaceId,
|
|
200
|
+
...input.ttlSeconds === void 0 ? {} : { ttlSeconds: input.ttlSeconds }
|
|
201
|
+
} }, "issueProactiveReadTokenInternal", options);
|
|
202
|
+
const expiresAt = new Date(minted.expiresAt);
|
|
203
|
+
if (typeof minted.token !== "string" || minted.token.length === 0 || Number.isNaN(expiresAt.getTime())) throw new ProactiveIdentityError("global-auth returned a malformed read token", "EMPTY_RESPONSE");
|
|
204
|
+
return {
|
|
205
|
+
token: minted.token,
|
|
206
|
+
expiresAt
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Record or renew the user's opt-in to the product's proactive assistant for
|
|
211
|
+
* one workspace (30 days from now).
|
|
212
|
+
*/
|
|
213
|
+
async function grantProactiveConsent(input, options = {}) {
|
|
214
|
+
requireTarget(input);
|
|
215
|
+
return toConsent(await call(`mutation GrantProactiveConsent($input: ProactiveConsentInternalInput!) {
|
|
216
|
+
grantProactiveConsentInternal(input: $input) { ${CONSENT_FIELDS} }
|
|
217
|
+
}`, { input: {
|
|
218
|
+
product: input.product,
|
|
219
|
+
userId: input.userId,
|
|
220
|
+
workspaceId: input.workspaceId
|
|
221
|
+
} }, "grantProactiveConsentInternal", options));
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Withdraw the user's opt-in for one workspace. Tokens already minted for it
|
|
225
|
+
* stop verifying at the gateways. False when there was nothing to withdraw.
|
|
226
|
+
*/
|
|
227
|
+
async function revokeProactiveConsent(input, options = {}) {
|
|
228
|
+
requireTarget(input);
|
|
229
|
+
return call(`mutation RevokeProactiveConsent($input: RevokeProactiveConsentInternalInput!) {
|
|
230
|
+
revokeProactiveConsentInternal(input: $input)
|
|
231
|
+
}`, { input: {
|
|
232
|
+
product: input.product,
|
|
233
|
+
userId: input.userId,
|
|
234
|
+
workspaceId: input.workspaceId,
|
|
235
|
+
...input.reason === void 0 ? {} : { reason: input.reason }
|
|
236
|
+
} }, "revokeProactiveConsentInternal", options);
|
|
237
|
+
}
|
|
238
|
+
/** The user's current consent state for the product and workspace. */
|
|
239
|
+
async function getProactiveConsent(input, options = {}) {
|
|
240
|
+
requireTarget(input);
|
|
241
|
+
return toConsent(await call(`query ProactiveConsent($input: ProactiveConsentInternalInput!) {
|
|
242
|
+
proactiveConsentInternal(input: $input) { ${CONSENT_FIELDS} }
|
|
243
|
+
}`, { input: {
|
|
244
|
+
product: input.product,
|
|
245
|
+
userId: input.userId,
|
|
246
|
+
workspaceId: input.workspaceId
|
|
247
|
+
} }, "proactiveConsentInternal", options));
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
// src/gateway/index.ts
|
|
251
|
+
var gateway_exports = /* @__PURE__ */ __exportAll({
|
|
252
|
+
CircuitState: () => CircuitState,
|
|
253
|
+
DELEGATED_AUTHORIZATION_HEADER: () => DELEGATED_AUTHORIZATION_HEADER,
|
|
254
|
+
GatewayClient: () => GatewayClient,
|
|
255
|
+
GatewayError: () => GatewayError,
|
|
256
|
+
GatewayErrorType: () => GatewayErrorType,
|
|
257
|
+
PROACTIVE_READ_SCOPE: () => PROACTIVE_READ_SCOPE,
|
|
258
|
+
ProactiveIdentityError: () => ProactiveIdentityError,
|
|
259
|
+
Security: () => security_exports,
|
|
260
|
+
buildDelegatedGatewayHeaders: () => buildDelegatedGatewayHeaders,
|
|
261
|
+
createGatewayClient: () => createGatewayClient,
|
|
262
|
+
createGatewayClientFromEnv: () => createGatewayClientFromEnv,
|
|
263
|
+
getProactiveConsent: () => getProactiveConsent,
|
|
264
|
+
grantProactiveConsent: () => grantProactiveConsent,
|
|
265
|
+
isGatewayClientError: () => isGatewayClientError,
|
|
266
|
+
isProactiveConsentMissing: () => isProactiveConsentMissing,
|
|
267
|
+
issueProactiveReadToken: () => issueProactiveReadToken,
|
|
268
|
+
proactiveAssistantClientId: () => proactiveAssistantClientId,
|
|
269
|
+
revokeProactiveConsent: () => revokeProactiveConsent,
|
|
270
|
+
signServiceJwt: () => signServiceJwt
|
|
271
|
+
});
|
|
272
|
+
|
|
273
|
+
export { grantProactiveConsent as a, proactiveAssistantClientId as c, buildDelegatedGatewayHeaders as d, getProactiveConsent as i, revokeProactiveConsent as l, PROACTIVE_READ_SCOPE as n, isProactiveConsentMissing as o, ProactiveIdentityError as r, issueProactiveReadToken as s, gateway_exports as t, DELEGATED_AUTHORIZATION_HEADER as u };
|
|
274
|
+
//# sourceMappingURL=gateway-2en8Gx_a.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gateway-2en8Gx_a.js","names":[],"sources":["../src/gateway/delegated-transport.ts","../src/gateway/proactive-identity.ts","../src/gateway/index.ts"],"sourcesContent":["/**\n * Delegated gateway transport (BOFF-9962).\n *\n * A service that must call the platform as \"agent X acting for user Y\" does\n * not set actor or consent headers itself: internal gateways strip those.\n * Instead it obtains a short-lived `app_as_user` token from global-auth\n * (`issueAppAsUserTokenInternal`) and presents it on the internal gateway's\n * `x-delegated-authorization` header. The gateway verifies the signature,\n * checks revocation and the grant's workspace bounds, and only then forwards\n * the represented user as the actor together with `x-verified-delegation`.\n *\n * @module gateway/delegated-transport\n */\n\nimport type { GatewayRequestHeaders } from '../types/layer.js';\n\n/** Header an internal gateway reads a delegated `app_as_user` bearer from. */\nexport const DELEGATED_AUTHORIZATION_HEADER = 'x-delegated-authorization';\n\nexport interface DelegatedGatewayTransportInput {\n /** Signed `app_as_user` access token issued by global-auth. */\n appAsUserToken: string;\n /** Workspace the call targets; must be inside the grant's workspace bounds. */\n workspaceId?: string;\n}\n\nconst JWT_SEGMENT = /^[A-Za-z0-9_-]+$/;\n\nfunction isCompactJwt(token: string): boolean {\n const segments = token.split('.');\n return segments.length === 3 && segments.every((segment) => JWT_SEGMENT.test(segment));\n}\n\n/**\n * Builds the request headers for a delegated internal-gateway call, for use as\n * `GatewayClient.internalQuery({ query, headers })`.\n *\n * @throws Error when the token is not a compact JWS (so a malformed value can\n * never be smuggled into a header) or the workspace id is blank.\n */\nexport function buildDelegatedGatewayHeaders(input: DelegatedGatewayTransportInput): GatewayRequestHeaders {\n const token = input.appAsUserToken;\n if (typeof token !== 'string' || token.length === 0 || token.length > 8192 || !isCompactJwt(token)) {\n throw new Error('Delegated gateway transport requires a compact app_as_user token');\n }\n const headers: GatewayRequestHeaders = {\n [DELEGATED_AUTHORIZATION_HEADER]: `Bearer ${token}`,\n };\n if (input.workspaceId !== undefined) {\n const workspaceId = input.workspaceId.trim();\n if (workspaceId.length === 0 || workspaceId !== input.workspaceId) {\n throw new Error('Delegated gateway transport requires a non-blank workspace id');\n }\n headers['x-workspace-id'] = workspaceId;\n }\n return headers;\n}\n","/**\n * Proactive assistant identity (BOFF-13161, Contract C2 of BOFF-13159).\n *\n * A background proactive assistant reads a product AS a user, read-only, and\n * only after the user opted in. global-auth-svc owns the identity: one\n * service-managed BOT app per product (`proactive-assistant-<product>`), the\n * user's consent as an AppUserDelegation with scopes `[\"delegation:read\"]`\n * per workspace for 30 days, and a short-lived `app_as_user` read token. The\n * gateways refuse every mutation and subscription such a token sends\n * (FORBIDDEN / DELEGATION_READ_ONLY, Contract C1).\n *\n * These helpers call global-auth's internal, service-only fields over the\n * global internal gateway, signed as the calling service. Only the proactive\n * orchestrator service (wspace-sandbox-svc) is accepted by global-auth.\n *\n * Trust boundary: pass the user the calling service authenticated itself (the\n * gateway-verified actor of its own self-scoped request), never an id taken\n * from job input, a model's output or any other untrusted text.\n *\n * @example\n * ```ts\n * import {\n * buildDelegatedGatewayHeaders,\n * createGatewayClientFromEnv,\n * issueProactiveReadToken,\n * } from '@burdenoff/be-sdk/gateway';\n *\n * const { token } = await issueProactiveReadToken({ product: 'fluidgrids', userId, workspaceId });\n * // Read as the user through the internal gateway; a mutation is refused there.\n * await createGatewayClientFromEnv().internalQuery({\n * query: '{ workflows { id name } }',\n * headers: buildDelegatedGatewayHeaders({ appAsUserToken: token, workspaceId }),\n * });\n * ```\n *\n * @module gateway/proactive-identity\n */\n\nimport { GatewayClient } from './client.js';\nimport { GatewayError, type GraphQLError, type GraphQLRequestOptions, type GraphQLResponse } from './types.js';\n\n/** The only scope a proactive consent or read token carries. */\nexport const PROACTIVE_READ_SCOPE = 'delegation:read';\n\n/** Client id of a product's proactive assistant app. */\nexport function proactiveAssistantClientId(product: string): string {\n return `proactive-assistant-${product.trim().toLowerCase()}`;\n}\n\n/**\n * Why a proactive identity call failed. `CONSENT_MISSING` means the user has\n * no live consent for the workspace (never granted, revoked or expired);\n * `UNAVAILABLE` means global-auth could not be reached or gave no answer. Any\n * other value is the GraphQL error code global-auth refused with.\n */\nexport type ProactiveIdentityErrorCode = string;\n\nexport class ProactiveIdentityError extends Error {\n constructor(\n message: string,\n readonly code: ProactiveIdentityErrorCode\n ) {\n super(message);\n this.name = 'ProactiveIdentityError';\n }\n}\n\n/** Whether `error` is the refusal for a user without live consent. */\nexport function isProactiveConsentMissing(error: unknown): boolean {\n return error instanceof ProactiveIdentityError && error.code === 'CONSENT_MISSING';\n}\n\n/** Whose consent, for which product and workspace. */\nexport interface ProactiveIdentityTarget {\n /** Product slug, e.g. `fluidgrids`. */\n product: string;\n /** The user the assistant reads as; see the trust boundary above. */\n userId: string;\n /** The workspace (UUID) the consent and token are bound to. */\n workspaceId: string;\n}\n\nexport interface IssueProactiveReadTokenInput extends ProactiveIdentityTarget {\n /** Token lifetime in seconds, 60 to 900; default 900 (15 minutes). */\n ttlSeconds?: number;\n}\n\nexport interface RevokeProactiveConsentInput extends ProactiveIdentityTarget {\n /** Recorded on the audit entry. */\n reason?: string;\n}\n\n/** A read-only `app_as_user` token, for `buildDelegatedGatewayHeaders`. */\nexport interface ProactiveReadToken {\n token: string;\n expiresAt: Date;\n}\n\n/** A user's consent state for one product and workspace. */\nexport interface ProactiveConsent {\n product: string;\n clientId: string;\n userId: string;\n workspaceId: string;\n granted: boolean;\n /** When the consent ends; null when it is not granted. */\n expiresAt: Date | null;\n}\n\n/** The part of a gateway client these helpers use. */\nexport type ProactiveIdentityClient = {\n crossLayerQuery<T = unknown>(options: GraphQLRequestOptions): Promise<GraphQLResponse<T>>;\n};\n\nexport interface ProactiveIdentityOptions {\n /**\n * Gateway client to call global-auth with. Default: a client signed as this\n * service (`SERVICE_IDENTITY`, else `SERVICE_NAME`) bound to\n * `GLOBAL_INT_GATEWAY_URL` (else `GLOBAL_PUBLIC_GATEWAY_URL`).\n */\n client?: ProactiveIdentityClient;\n /** Request timeout in milliseconds for the default client. Default 10 s. */\n timeoutMs?: number;\n /**\n * The calling service's identity, sent as `x-service-name` so the internal\n * gateway names the service as the actor (global-auth accepts only the\n * proactive orchestrator). Default: `SERVICE_IDENTITY`, else `SERVICE_NAME`.\n */\n serviceIdentity?: string;\n}\n\n/**\n * GraphQL codes that describe an unavailable dependency rather than a decision\n * by global-auth; the gateways mask an unreachable subgraph with these.\n */\nconst UNAVAILABLE_CODES = new Set([\n 'INTERNAL_SERVER_ERROR',\n 'SERVICE_UNAVAILABLE',\n 'AUTH_SERVICE_UNAVAILABLE',\n 'DOWNSTREAM_SERVICE_ERROR',\n 'GATEWAY_TIMEOUT',\n]);\n\nconst DEFAULT_TIMEOUT_MS = 10_000;\n\nfunction codeOf(error: GraphQLError): string | null {\n const code = error.extensions?.['code'];\n return typeof code === 'string' ? code : null;\n}\n\n/** The refusal carried by a GraphQL error, or null when it is not a decision. */\nfunction refusalOf(errors: readonly GraphQLError[] | undefined): ProactiveIdentityError | null {\n const first = errors?.[0];\n if (!first) return null;\n const code = codeOf(first);\n if (!code || UNAVAILABLE_CODES.has(code)) return null;\n return new ProactiveIdentityError(first.message, code);\n}\n\nfunction cloudflareAccessHeaders(): Record<string, string> {\n const id = process.env['CF_ACCESS_CLIENT_ID'];\n const secret = process.env['CF_ACCESS_CLIENT_SECRET'];\n return id && secret ? { 'cf-access-client-id': id, 'cf-access-client-secret': secret } : {};\n}\n\nfunction envServiceIdentity(): string | undefined {\n return (process.env['SERVICE_IDENTITY'] || process.env['SERVICE_NAME'])?.trim() || undefined;\n}\n\nfunction defaultClient(timeoutMs: number, identity: string | undefined): ProactiveIdentityClient {\n const url = (process.env['GLOBAL_INT_GATEWAY_URL'] || process.env['GLOBAL_PUBLIC_GATEWAY_URL'])?.trim();\n if (!url) {\n throw new ProactiveIdentityError('No global gateway is configured (GLOBAL_INT_GATEWAY_URL)', 'UNAVAILABLE');\n }\n if (!identity) {\n throw new ProactiveIdentityError('SERVICE_IDENTITY or SERVICE_NAME is required to sign the call', 'UNAVAILABLE');\n }\n const layer = process.env['SERVICE_LAYER'] === 'global' ? 'global' : 'wspace';\n return new GatewayClient({\n layer,\n serviceName: identity,\n serviceIdentity: identity,\n crossLayerGatewayUrl: url,\n timeout: timeoutMs,\n });\n}\n\nfunction requireTarget(input: ProactiveIdentityTarget): void {\n for (const [name, value] of Object.entries({\n product: input.product,\n userId: input.userId,\n workspaceId: input.workspaceId,\n })) {\n if (typeof value !== 'string' || value.trim().length === 0) {\n throw new ProactiveIdentityError(`${name} is required`, 'BAD_USER_INPUT');\n }\n }\n}\n\n/**\n * Call one global-auth field as this service. The call is never retried and\n * bypasses the circuit breaker: a refusal must surface at once, and the\n * callers fail closed.\n */\nasync function call<T>(\n query: string,\n variables: Record<string, unknown>,\n field: string,\n options: ProactiveIdentityOptions\n): Promise<T> {\n const identity = options.serviceIdentity?.trim() || envServiceIdentity();\n const client = options.client ?? defaultClient(options.timeoutMs ?? DEFAULT_TIMEOUT_MS, identity);\n let response: GraphQLResponse<Record<string, T | null>>;\n try {\n response = await client.crossLayerQuery<Record<string, T | null>>({\n query,\n variables,\n // No x-actor-id: on a service token it would mean \"on behalf of\". The\n // internal gateway takes the actor from x-service-name instead.\n headers: {\n 'x-actor-type': 'service',\n ...(identity ? { 'x-service-name': identity } : {}),\n ...cloudflareAccessHeaders(),\n },\n skipRetry: true,\n skipCircuitBreaker: true,\n });\n } catch (error) {\n // The internal gateway maps unknown error codes (CONSENT_MISSING) to HTTP\n // statuses, so a refusal often arrives as a thrown GatewayError.\n const refusal = error instanceof GatewayError ? refusalOf(error.graphqlErrors) : null;\n if (refusal) throw refusal;\n throw new ProactiveIdentityError(\n `global-auth is unreachable: ${error instanceof Error ? error.message : String(error)}`,\n 'UNAVAILABLE'\n );\n }\n if (response.errors?.length) {\n throw (\n refusalOf(response.errors) ??\n new ProactiveIdentityError(response.errors[0]?.message ?? 'global-auth failed', 'UNAVAILABLE')\n );\n }\n const data = response.data?.[field];\n if (data === undefined || data === null) {\n throw new ProactiveIdentityError(`global-auth returned no ${field}`, 'EMPTY_RESPONSE');\n }\n return data;\n}\n\ninterface RawConsent {\n product: string;\n clientId: string;\n userId: string;\n workspaceId: string;\n granted: boolean;\n expiresAt: string | null;\n}\n\nconst CONSENT_FIELDS = 'product clientId userId workspaceId granted expiresAt';\n\nfunction toConsent(raw: RawConsent): ProactiveConsent {\n return { ...raw, expiresAt: raw.expiresAt ? new Date(raw.expiresAt) : null };\n}\n\n/**\n * Mint a read-only `app_as_user` token (scope `delegation:read`, bound to the\n * workspace, 15 minutes by default and never past the consent) for the\n * product's proactive assistant acting as the user. Use it with\n * `buildDelegatedGatewayHeaders`.\n *\n * @throws ProactiveIdentityError with code `CONSENT_MISSING` when the user has\n * no live consent for the workspace, or another code when the call failed.\n */\nexport async function issueProactiveReadToken(\n input: IssueProactiveReadTokenInput,\n options: ProactiveIdentityOptions = {}\n): Promise<ProactiveReadToken> {\n requireTarget(input);\n const minted = await call<{ token: string; expiresAt: string }>(\n `mutation IssueProactiveReadToken($input: IssueProactiveReadTokenInternalInput!) {\n issueProactiveReadTokenInternal(input: $input) { token expiresAt }\n }`,\n {\n input: {\n product: input.product,\n userId: input.userId,\n workspaceId: input.workspaceId,\n ...(input.ttlSeconds === undefined ? {} : { ttlSeconds: input.ttlSeconds }),\n },\n },\n 'issueProactiveReadTokenInternal',\n options\n );\n const expiresAt = new Date(minted.expiresAt);\n if (typeof minted.token !== 'string' || minted.token.length === 0 || Number.isNaN(expiresAt.getTime())) {\n throw new ProactiveIdentityError('global-auth returned a malformed read token', 'EMPTY_RESPONSE');\n }\n return { token: minted.token, expiresAt };\n}\n\n/**\n * Record or renew the user's opt-in to the product's proactive assistant for\n * one workspace (30 days from now).\n */\nexport async function grantProactiveConsent(\n input: ProactiveIdentityTarget,\n options: ProactiveIdentityOptions = {}\n): Promise<ProactiveConsent> {\n requireTarget(input);\n const raw = await call<RawConsent>(\n `mutation GrantProactiveConsent($input: ProactiveConsentInternalInput!) {\n grantProactiveConsentInternal(input: $input) { ${CONSENT_FIELDS} }\n }`,\n { input: { product: input.product, userId: input.userId, workspaceId: input.workspaceId } },\n 'grantProactiveConsentInternal',\n options\n );\n return toConsent(raw);\n}\n\n/**\n * Withdraw the user's opt-in for one workspace. Tokens already minted for it\n * stop verifying at the gateways. False when there was nothing to withdraw.\n */\nexport async function revokeProactiveConsent(\n input: RevokeProactiveConsentInput,\n options: ProactiveIdentityOptions = {}\n): Promise<boolean> {\n requireTarget(input);\n return call<boolean>(\n `mutation RevokeProactiveConsent($input: RevokeProactiveConsentInternalInput!) {\n revokeProactiveConsentInternal(input: $input)\n }`,\n {\n input: {\n product: input.product,\n userId: input.userId,\n workspaceId: input.workspaceId,\n ...(input.reason === undefined ? {} : { reason: input.reason }),\n },\n },\n 'revokeProactiveConsentInternal',\n options\n );\n}\n\n/** The user's current consent state for the product and workspace. */\nexport async function getProactiveConsent(\n input: ProactiveIdentityTarget,\n options: ProactiveIdentityOptions = {}\n): Promise<ProactiveConsent> {\n requireTarget(input);\n const raw = await call<RawConsent>(\n `query ProactiveConsent($input: ProactiveConsentInternalInput!) {\n proactiveConsentInternal(input: $input) { ${CONSENT_FIELDS} }\n }`,\n { input: { product: input.product, userId: input.userId, workspaceId: input.workspaceId } },\n 'proactiveConsentInternal',\n options\n );\n return toConsent(raw);\n}\n","/**\n * Gateway Module\n *\n * Provides unified gateway client for layer-aware M2M communication\n * with circuit breaker and retry logic.\n *\n * @module gateway\n * @category Gateway\n *\n * @example\n * ```typescript\n * import { GatewayClient, createGatewayClientFromEnv } from '@burdenoff/be-sdk/gateway';\n *\n * // Create from environment variables\n * const client = createGatewayClientFromEnv();\n *\n * // Or create manually\n * const client = new GatewayClient({\n * layer: 'wspace',\n * serviceName: 'wspace-tags-svc',\n * });\n *\n * // Internal call (same layer, uses int-gateway with bypass)\n * const internalResult = await client.internalQuery({\n * query: `query { getTag(id: \"123\") { id name } }`,\n * });\n *\n * // Cross-layer call (via public gateway)\n * const crossLayerResult = await client.crossLayerQuery({\n * query: `query { getCurrentUser { id email } }`,\n * });\n * ```\n */\n\n// Client exports\nexport { GatewayClient, createGatewayClient, createGatewayClientFromEnv, isGatewayClientError } from './client.js';\n\n// Service-JWT minting for cross-layer M2M auth. Exposed so non-GatewayClient\n// callers (e.g. bespoke graphql-request clients) can authenticate identically.\nexport { signServiceJwt } from './service-jwt.js';\n\n// Delegated internal-gateway transport (BOFF-9962): call as an agent acting\n// for a user by presenting a verified app_as_user token, never raw headers.\nexport {\n buildDelegatedGatewayHeaders,\n DELEGATED_AUTHORIZATION_HEADER,\n type DelegatedGatewayTransportInput,\n} from './delegated-transport.js';\n\n// Proactive assistant identity (BOFF-13161): opt-in, read-only consent and the\n// short-lived delegation:read token to use with buildDelegatedGatewayHeaders.\nexport {\n getProactiveConsent,\n grantProactiveConsent,\n isProactiveConsentMissing,\n issueProactiveReadToken,\n PROACTIVE_READ_SCOPE,\n proactiveAssistantClientId,\n ProactiveIdentityError,\n revokeProactiveConsent,\n type IssueProactiveReadTokenInput,\n type ProactiveConsent,\n type ProactiveIdentityClient,\n type ProactiveIdentityErrorCode,\n type ProactiveIdentityOptions,\n type ProactiveIdentityTarget,\n type ProactiveReadToken,\n type RevokeProactiveConsentInput,\n} from './proactive-identity.js';\n\n// Type exports\nexport {\n CircuitState,\n GatewayErrorType,\n GatewayError,\n type GatewayClientConfig,\n type GraphQLRequestOptions,\n type GraphQLResponse,\n type GraphQLError,\n type IGatewayClient,\n type ICircuitBreaker,\n type CircuitBreakerStats,\n type GatewayClientHealth,\n type RequestContext,\n} from './types.js';\n\n// Gateway-side security plugin stack (for public gateways).\n// Imported by consumers as `@burdenoff/be-sdk/gateway/security` — this\n// re-export lets `@burdenoff/be-sdk/gateway` also resolve the namespace.\nexport * as Security from './security/index.js';\n"],"mappings":";;;;;;;;AAiBA,MAAa,iCAAiC;AAS9C,MAAM,cAAc;AAEpB,SAAS,aAAa,OAAwB;CAC5C,MAAM,WAAW,MAAM,MAAM,GAAG;CAChC,OAAO,SAAS,WAAW,KAAK,SAAS,OAAO,YAAY,YAAY,KAAK,OAAO,CAAC;AACvF;;;;;;;;AASA,SAAgB,6BAA6B,OAA8D;CACzG,MAAM,QAAQ,MAAM;CACpB,IAAI,OAAO,UAAU,YAAY,MAAM,WAAW,KAAK,MAAM,SAAS,QAAQ,CAAC,aAAa,KAAK,GAC/F,MAAM,IAAI,MAAM,kEAAkE;CAEpF,MAAM,UAAiC,GACpC,iCAAiC,UAAU,QAC9C;CACA,IAAI,MAAM,gBAAgB,QAAW;EACnC,MAAM,cAAc,MAAM,YAAY,KAAK;EAC3C,IAAI,YAAY,WAAW,KAAK,gBAAgB,MAAM,aACpD,MAAM,IAAI,MAAM,+DAA+D;EAEjF,QAAQ,oBAAoB;CAC9B;CACA,OAAO;AACT;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACdA,MAAa,uBAAuB;;AAGpC,SAAgB,2BAA2B,SAAyB;CAClE,OAAO,uBAAuB,QAAQ,KAAK,CAAC,CAAC,YAAY;AAC3D;AAUA,IAAa,yBAAb,cAA4C,MAAM;CAGrC;CAFX,YACE,SACA,AAAS,MACT;EACA,MAAM,OAAO;EAFJ;EAGT,KAAK,OAAO;CACd;AACF;;AAGA,SAAgB,0BAA0B,OAAyB;CACjE,OAAO,iBAAiB,0BAA0B,MAAM,SAAS;AACnE;;;;;AAiEA,MAAM,oCAAoB,IAAI,IAAI;CAChC;CACA;CACA;CACA;CACA;AACF,CAAC;AAED,MAAM,qBAAqB;AAE3B,SAAS,OAAO,OAAoC;CAClD,MAAM,OAAO,MAAM,aAAa;CAChC,OAAO,OAAO,SAAS,WAAW,OAAO;AAC3C;;AAGA,SAAS,UAAU,QAA4E;CAC7F,MAAM,QAAQ,SAAS;CACvB,IAAI,CAAC,OAAO,OAAO;CACnB,MAAM,OAAO,OAAO,KAAK;CACzB,IAAI,CAAC,QAAQ,kBAAkB,IAAI,IAAI,GAAG,OAAO;CACjD,OAAO,IAAI,uBAAuB,MAAM,SAAS,IAAI;AACvD;AAEA,SAAS,0BAAkD;CACzD,MAAM,KAAK,QAAQ,IAAI;CACvB,MAAM,SAAS,QAAQ,IAAI;CAC3B,OAAO,MAAM,SAAS;EAAE,uBAAuB;EAAI,2BAA2B;CAAO,IAAI,CAAC;AAC5F;AAEA,SAAS,qBAAyC;CAChD,QAAQ,QAAQ,IAAI,uBAAuB,QAAQ,IAAI,gBAAe,EAAG,KAAK,KAAK;AACrF;AAEA,SAAS,cAAc,WAAmB,UAAuD;CAC/F,MAAM,OAAO,QAAQ,IAAI,6BAA6B,QAAQ,IAAI,6BAA4B,EAAG,KAAK;CACtG,IAAI,CAAC,KACH,MAAM,IAAI,uBAAuB,4DAA4D,aAAa;CAE5G,IAAI,CAAC,UACH,MAAM,IAAI,uBAAuB,iEAAiE,aAAa;CAEjH,MAAM,QAAQ,QAAQ,IAAI,qBAAqB,WAAW,WAAW;CACrE,OAAO,IAAI,cAAc;EACvB;EACA,aAAa;EACb,iBAAiB;EACjB,sBAAsB;EACtB,SAAS;CACX,CAAC;AACH;AAEA,SAAS,cAAc,OAAsC;CAC3D,KAAK,MAAM,CAAC,MAAM,UAAU,OAAO,QAAQ;EACzC,SAAS,MAAM;EACf,QAAQ,MAAM;EACd,aAAa,MAAM;CACrB,CAAC,GACC,IAAI,OAAO,UAAU,YAAY,MAAM,KAAK,CAAC,CAAC,WAAW,GACvD,MAAM,IAAI,uBAAuB,GAAG,KAAK,eAAe,gBAAgB;AAG9E;;;;;;AAOA,eAAe,KACb,OACA,WACA,OACA,SACY;CACZ,MAAM,WAAW,QAAQ,iBAAiB,KAAK,KAAK,mBAAmB;CACvE,MAAM,SAAS,QAAQ,UAAU,cAAc,QAAQ,aAAa,oBAAoB,QAAQ;CAChG,IAAI;CACJ,IAAI;EACF,WAAW,MAAM,OAAO,gBAA0C;GAChE;GACA;GAGA,SAAS;IACP,gBAAgB;IAChB,GAAI,WAAW,EAAE,kBAAkB,SAAS,IAAI,CAAC;IACjD,GAAG,wBAAwB;GAC7B;GACA,WAAW;GACX,oBAAoB;EACtB,CAAC;CACH,SAAS,OAAO;EAGd,MAAM,UAAU,iBAAiB,eAAe,UAAU,MAAM,aAAa,IAAI;EACjF,IAAI,SAAS,MAAM;EACnB,MAAM,IAAI,uBACR,+BAA+B,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,KACpF,aACF;CACF;CACA,IAAI,SAAS,QAAQ,QACnB,MACE,UAAU,SAAS,MAAM,KACzB,IAAI,uBAAuB,SAAS,OAAO,EAAE,EAAE,WAAW,sBAAsB,aAAa;CAGjG,MAAM,OAAO,SAAS,OAAO;CAC7B,IAAI,SAAS,UAAa,SAAS,MACjC,MAAM,IAAI,uBAAuB,2BAA2B,SAAS,gBAAgB;CAEvF,OAAO;AACT;AAWA,MAAM,iBAAiB;AAEvB,SAAS,UAAU,KAAmC;CACpD,OAAO;EAAE,GAAG;EAAK,WAAW,IAAI,YAAY,IAAI,KAAK,IAAI,SAAS,IAAI;CAAK;AAC7E;;;;;;;;;;AAWA,eAAsB,wBACpB,OACA,UAAoC,CAAC,GACR;CAC7B,cAAc,KAAK;CACnB,MAAM,SAAS,MAAM,KACnB;;QAGA,EACE,OAAO;EACL,SAAS,MAAM;EACf,QAAQ,MAAM;EACd,aAAa,MAAM;EACnB,GAAI,MAAM,eAAe,SAAY,CAAC,IAAI,EAAE,YAAY,MAAM,WAAW;CAC3E,EACF,GACA,mCACA,OACF;CACA,MAAM,YAAY,IAAI,KAAK,OAAO,SAAS;CAC3C,IAAI,OAAO,OAAO,UAAU,YAAY,OAAO,MAAM,WAAW,KAAK,OAAO,MAAM,UAAU,QAAQ,CAAC,GACnG,MAAM,IAAI,uBAAuB,+CAA+C,gBAAgB;CAElG,OAAO;EAAE,OAAO,OAAO;EAAO;CAAU;AAC1C;;;;;AAMA,eAAsB,sBACpB,OACA,UAAoC,CAAC,GACV;CAC3B,cAAc,KAAK;CASnB,OAAO,UAAU,MARC,KAChB;uDACmD,eAAe;QAElE,EAAE,OAAO;EAAE,SAAS,MAAM;EAAS,QAAQ,MAAM;EAAQ,aAAa,MAAM;CAAY,EAAE,GAC1F,iCACA,OACF,CACoB;AACtB;;;;;AAMA,eAAsB,uBACpB,OACA,UAAoC,CAAC,GACnB;CAClB,cAAc,KAAK;CACnB,OAAO,KACL;;QAGA,EACE,OAAO;EACL,SAAS,MAAM;EACf,QAAQ,MAAM;EACd,aAAa,MAAM;EACnB,GAAI,MAAM,WAAW,SAAY,CAAC,IAAI,EAAE,QAAQ,MAAM,OAAO;CAC/D,EACF,GACA,kCACA,OACF;AACF;;AAGA,eAAsB,oBACpB,OACA,UAAoC,CAAC,GACV;CAC3B,cAAc,KAAK;CASnB,OAAO,UAAU,MARC,KAChB;kDAC8C,eAAe;QAE7D,EAAE,OAAO;EAAE,SAAS,MAAM;EAAS,QAAQ,MAAM;EAAQ,aAAa,MAAM;CAAY,EAAE,GAC1F,4BACA,OACF,CACoB;AACtB"}
|
package/dist/graph/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { _ as SearchResponse, a as EdgeDocument, c as EntityVertex, d as ModuleGraphConfig, f as ProductFacet, g as SearchFilters, h as SearchFacets, i as addGraphExtension, l as GraphEvent, m as RelationshipGraphConfig, n as GraphEventEmitter, o as EntityBulkOperationsConfig, r as GraphMiddlewareConfig, s as EntityGraphConfig, t as EntityEventType, u as GraphEventType, v as SearchResult, y as TypeFacet } from "../prisma-extension-Cfl09swM.js";
|
|
2
|
-
import { $ as createGraphEventsHelper, A as GraphSchema, B as GraphExportService, C as defineGraphConfig, Ct as shouldSyncRelationship, D as EntityEventHook, E as EntityEventContext, F as RelationshipExportData, G as createRelationshipFromEntity, H as GraphRelationshipExport, I as defineModuleGraph, J as GraphEventPublishOptions, K as EntityEventData, L as EntityFetcher, M as ModuleGraphDefinition, N as RelationshipDefinition, O as EntityRbacConfig, P as RelationshipEventData, Q as GraphRelationshipData, R as GraphEntityExport, S as defineEntity, St as shouldSyncEntity, T as EntityDefinition, U as RelationshipFetcher, V as GraphExportServiceConfig, W as createGraphExportService, X as GraphEventsHelperConfig, Y as GraphEventsHelper, Z as GraphEventsPublisher, _ as DefineGraphConfigOptions, _t as createRelationshipEvent, a as GraphNode, at as createPrismaGraphIntegration, b as STANDARD_FIELDS, bt as getCollectionForEntity, c as TraverseOptions, ct as ExtractedRelationshipData, d as InitializeGraphOptions, dt as GenericGraphConfig, et as getGraphEventsPublisher, f as getGraphStats, ft as GenericRelationshipConfig, g as DefineEntityConfigOptions, gt as createEntityEvent, h as AUDIT_FIELDS, ht as ValidationErrorType, i as GraphModule, it as PrismaGraphIntegrationOptions, j as ModuleGraph, k as GraphEventOptions, l as TraverseResult, lt as FieldMapper, m as isGraphInitialized, mt as GraphValidationResult, n as CreateNodeOptions, nt as withDeferredGraphEvents, o as QueryGraphOptions, ot as EntityRbacConfig$1, p as initializeGraph, pt as GraphValidationError, q as GraphEntityConfig, r as GraphEdge, rt as PrismaGraphIntegration, s as TraverseDirection, st as ExtractedEntityData, t as CreateEdgeOptions, tt as DeferredGraphResult, ut as GenericEntityConfig, v as DefineRelationshipConfigOptions, vt as extractEntityTitle, w as defineRelationship, wt as GraphRegistry, x as TENANT_FIELDS, xt as parseRelationship, y as SOFT_DELETE_FIELDS, yt as extractMinimalFields, z as GraphExportResponse } from "../index-
|
|
2
|
+
import { $ as createGraphEventsHelper, A as GraphSchema, B as GraphExportService, C as defineGraphConfig, Ct as shouldSyncRelationship, D as EntityEventHook, E as EntityEventContext, F as RelationshipExportData, G as createRelationshipFromEntity, H as GraphRelationshipExport, I as defineModuleGraph, J as GraphEventPublishOptions, K as EntityEventData, L as EntityFetcher, M as ModuleGraphDefinition, N as RelationshipDefinition, O as EntityRbacConfig, P as RelationshipEventData, Q as GraphRelationshipData, R as GraphEntityExport, S as defineEntity, St as shouldSyncEntity, T as EntityDefinition, U as RelationshipFetcher, V as GraphExportServiceConfig, W as createGraphExportService, X as GraphEventsHelperConfig, Y as GraphEventsHelper, Z as GraphEventsPublisher, _ as DefineGraphConfigOptions, _t as createRelationshipEvent, a as GraphNode, at as createPrismaGraphIntegration, b as STANDARD_FIELDS, bt as getCollectionForEntity, c as TraverseOptions, ct as ExtractedRelationshipData, d as InitializeGraphOptions, dt as GenericGraphConfig, et as getGraphEventsPublisher, f as getGraphStats, ft as GenericRelationshipConfig, g as DefineEntityConfigOptions, gt as createEntityEvent, h as AUDIT_FIELDS, ht as ValidationErrorType, i as GraphModule, it as PrismaGraphIntegrationOptions, j as ModuleGraph, k as GraphEventOptions, l as TraverseResult, lt as FieldMapper, m as isGraphInitialized, mt as GraphValidationResult, n as CreateNodeOptions, nt as withDeferredGraphEvents, o as QueryGraphOptions, ot as EntityRbacConfig$1, p as initializeGraph, pt as GraphValidationError, q as GraphEntityConfig, r as GraphEdge, rt as PrismaGraphIntegration, s as TraverseDirection, st as ExtractedEntityData, t as CreateEdgeOptions, tt as DeferredGraphResult, ut as GenericEntityConfig, v as DefineRelationshipConfigOptions, vt as extractEntityTitle, w as defineRelationship, wt as GraphRegistry, x as TENANT_FIELDS, xt as parseRelationship, y as SOFT_DELETE_FIELDS, yt as extractMinimalFields, z as GraphExportResponse } from "../index-9MJVKzWA.js";
|
|
3
3
|
export { AUDIT_FIELDS, CreateEdgeOptions, CreateNodeOptions, type DeferredGraphResult, type DefineEntityConfigOptions, type DefineGraphConfigOptions, type DefineRelationshipConfigOptions, type EdgeDocument, type EntityBulkOperationsConfig, type EntityDefinition, type EntityEventContext, type EntityEventData, type EntityEventHook, type EntityEventType, type EntityFetcher, type EntityGraphConfig, type EntityRbacConfig, type EntityVertex, type ExtractedEntityData, type ExtractedRelationshipData, type FieldMapper, type GenericEntityConfig, type EntityRbacConfig$1 as GenericEntityRbacConfig, type GenericGraphConfig, type GenericRelationshipConfig, GraphEdge, type GraphEntityConfig, type GraphEntityExport, type GraphEvent, type GraphEventEmitter, type GraphEventOptions, type GraphEventPublishOptions, type GraphEventType, type GraphEventsHelper, type GraphEventsHelperConfig, GraphEventsPublisher, type GraphExportResponse, GraphExportService, type GraphExportServiceConfig, type GraphMiddlewareConfig, GraphModule, GraphNode, GraphRegistry, type GraphRelationshipData, type GraphRelationshipExport, type GraphSchema, type GraphValidationError, type GraphValidationResult, type InitializeGraphOptions, type ModuleGraph, type ModuleGraphConfig, type ModuleGraphDefinition, type PrismaGraphIntegration, type PrismaGraphIntegrationOptions, type ProductFacet, QueryGraphOptions, type RelationshipDefinition, type RelationshipEventData, type RelationshipExportData, type RelationshipFetcher, type RelationshipGraphConfig, SOFT_DELETE_FIELDS, STANDARD_FIELDS, type SearchFacets, type SearchFilters, type SearchResponse, type SearchResult, TENANT_FIELDS, TraverseDirection, TraverseOptions, TraverseResult, type TypeFacet, type ValidationErrorType, addGraphExtension, createEntityEvent, createGraphEventsHelper, createGraphExportService, createPrismaGraphIntegration, createRelationshipEvent, createRelationshipFromEntity, defineEntity, defineGraphConfig, defineModuleGraph, defineRelationship, extractEntityTitle, extractMinimalFields, getCollectionForEntity, getGraphEventsPublisher, getGraphStats, initializeGraph, isGraphInitialized, parseRelationship, shouldSyncEntity, shouldSyncRelationship, withDeferredGraphEvents };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as GraphQLRequestOptions, l as GraphQLResponse, s as GraphQLError } from "./types-
|
|
1
|
+
import { c as GraphQLRequestOptions, l as GraphQLResponse, s as GraphQLError } from "./types-gJ9Qqi9E.js";
|
|
2
2
|
declare const FILE_ACTOR_TYPES: readonly ["user", "app", "service", "super_admin"];
|
|
3
3
|
type FileActorType = (typeof FILE_ACTOR_TYPES)[number];
|
|
4
4
|
interface FileActor {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { p as SDKContext } from "./index-
|
|
2
|
-
import { t as BurdenoffGraphQLClient } from "./graphql-
|
|
1
|
+
import { p as SDKContext } from "./index-BTaQMEgB.js";
|
|
2
|
+
import { t as BurdenoffGraphQLClient } from "./graphql-C8jKLLel.js";
|
|
3
3
|
import { n as PrismaClientBase } from "./client-BgAEvDC2.js";
|
|
4
|
-
import { Mt as GraphEventEmitterImpl, kt as EntityEventRbacMetadata } from "./index-
|
|
4
|
+
import { Mt as GraphEventEmitterImpl, kt as EntityEventRbacMetadata } from "./index-CEtULfb_.js";
|
|
5
5
|
import { _ as SearchResponse, a as EdgeDocument, c as EntityVertex, d as ModuleGraphConfig, f as ProductFacet, g as SearchFilters, h as SearchFacets, i as addGraphExtension, l as GraphEvent, m as RelationshipGraphConfig, n as GraphEventEmitter, o as EntityBulkOperationsConfig, p as RegistryEntityRbacConfig, r as GraphMiddlewareConfig, s as EntityGraphConfig, t as EntityEventType, u as GraphEventType, v as SearchResult, y as TypeFacet } from "./prisma-extension-Cfl09swM.js";
|
|
6
6
|
interface ResolvedEntityGraphConfig extends Omit<EntityGraphConfig, 'fields'> {
|
|
7
7
|
fields: string[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as DEFAULT_LAYER_RESOURCES, d as LayerFullConfig, f as LayerGatewayConfig, i as DEFAULT_GATEWAY_ROUTING, l as GatewayRoutingConfig, m as ServiceLayer, o as DEFAULT_LAYER_STREAMS, p as LayerResourceUrls, u as LayerConfig } from "./layer-
|
|
1
|
+
import { a as DEFAULT_LAYER_RESOURCES, d as LayerFullConfig, f as LayerGatewayConfig, i as DEFAULT_GATEWAY_ROUTING, l as GatewayRoutingConfig, m as ServiceLayer, o as DEFAULT_LAYER_STREAMS, p as LayerResourceUrls, u as LayerConfig } from "./layer-C0zxAUgR.js";
|
|
2
2
|
declare namespace index_d_exports {
|
|
3
3
|
export { DEFAULT_GATEWAY_ROUTING, DEFAULT_LAYER_RESOURCES, DEFAULT_LAYER_STREAMS, GatewayRoutingConfig, LayerConfig, LayerFullConfig, LayerGatewayConfig, LayerManager, LayerResourceUrls, ServiceLayer, createLayerManagerFromEnv, detectLayerFromServiceName, getGatewayUrlForLayer, validateLayerConfig };
|
|
4
4
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as BurdenoffGraphQLClient } from "./graphql-
|
|
2
|
-
import { p as SDKContext } from "./index-
|
|
3
|
-
import { m as ServiceLayer } from "./layer-
|
|
1
|
+
import { t as BurdenoffGraphQLClient } from "./graphql-C8jKLLel.js";
|
|
2
|
+
import { p as SDKContext } from "./index-BTaQMEgB.js";
|
|
3
|
+
import { m as ServiceLayer } from "./layer-C0zxAUgR.js";
|
|
4
4
|
type MaybePromise<T> = Promise<T> | T;
|
|
5
5
|
type AsyncIterableIteratorOrValue<T> = T | AsyncIterableIterator<T>;
|
|
6
6
|
type Maybe<T> = T | null | undefined;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { m as ServiceLayer } from "./layer-
|
|
1
|
+
import { m as ServiceLayer } from "./layer-C0zxAUgR.js";
|
|
2
2
|
import { n as ShutdownDisposable } from "./index-Dt1HJPTX.js";
|
|
3
|
-
import { t as BurdenoffGraphQLClient } from "./graphql-
|
|
4
|
-
import { p as SDKContext } from "./index-
|
|
3
|
+
import { t as BurdenoffGraphQLClient } from "./graphql-C8jKLLel.js";
|
|
4
|
+
import { p as SDKContext } from "./index-BTaQMEgB.js";
|
|
5
5
|
interface EventMessage$1<T = unknown> {
|
|
6
6
|
id: string;
|
|
7
7
|
subject: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { m as ServiceLayer } from "./layer-
|
|
1
|
+
import { m as ServiceLayer } from "./layer-C0zxAUgR.js";
|
|
2
2
|
import { Client, WorkflowHandle } from "@temporalio/client";
|
|
3
3
|
import { Duration } from "@temporalio/common";
|
|
4
4
|
type WorkflowSearchAttributes = Record<string, unknown>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as BurdenoffGraphQLClient } from "./graphql-
|
|
2
|
-
import { m as SDKError, p as SDKContext } from "./index-
|
|
3
|
-
import {
|
|
1
|
+
import { t as BurdenoffGraphQLClient } from "./graphql-C8jKLLel.js";
|
|
2
|
+
import { m as SDKError, p as SDKContext } from "./index-BTaQMEgB.js";
|
|
3
|
+
import { S as GatewayClient } from "./index-oJMtR3nl.js";
|
|
4
4
|
interface BillingUsageOperationInput {
|
|
5
5
|
quotaName: string;
|
|
6
6
|
value?: number;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { t as BurdenoffGraphQLClient } from "./graphql-
|
|
2
|
-
import { p as SDKContext } from "./index-
|
|
1
|
+
import { t as BurdenoffGraphQLClient } from "./graphql-C8jKLLel.js";
|
|
2
|
+
import { p as SDKContext } from "./index-BTaQMEgB.js";
|
|
3
3
|
import { ActivitySeverity, ActivityType } from "./activity/index.js";
|
|
4
|
-
import { p as UsageMetricType } from "./index-
|
|
5
|
-
import { a as NotificationType } from "./index-
|
|
4
|
+
import { p as UsageMetricType } from "./index-DWER4-_x.js";
|
|
5
|
+
import { a as NotificationType } from "./index-Dw_0wE4q.js";
|
|
6
6
|
import { o as AssistantSessionAttribution } from "./assistant-session-DA5ZKJOr.js";
|
|
7
7
|
interface TrackingEvent {
|
|
8
8
|
eventType: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as BurdenoffGraphQLClient } from "./graphql-
|
|
2
|
-
import { p as SDKContext } from "./index-
|
|
1
|
+
import { t as BurdenoffGraphQLClient } from "./graphql-C8jKLLel.js";
|
|
2
|
+
import { p as SDKContext } from "./index-BTaQMEgB.js";
|
|
3
3
|
declare namespace tenant_notifications_d_exports {
|
|
4
4
|
export { BatchNotificationInput, Notification$1 as Notification, NotificationChannel$1 as NotificationChannel, NotificationPriority, NotificationStats, NotificationTemplate, NotificationType$1 as NotificationType, RecipientInput$1 as RecipientInput, SendNotificationInput, SendWithTemplateInput, TenantNotificationsModule };
|
|
5
5
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as GraphQLRequestOptions, l as GraphQLResponse } from "./types-
|
|
1
|
+
import { c as GraphQLRequestOptions, l as GraphQLResponse } from "./types-gJ9Qqi9E.js";
|
|
2
2
|
declare const TAG_ACTOR_TYPES: readonly ["user", "app", "service", "super_admin"];
|
|
3
3
|
type TagActorType = (typeof TAG_ACTOR_TYPES)[number];
|
|
4
4
|
interface TagActor {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { p as SDKContext } from "./index-
|
|
1
|
+
import { p as SDKContext } from "./index-BTaQMEgB.js";
|
|
2
2
|
declare namespace index_d_exports {
|
|
3
3
|
export { LogLevel, LogMeta, Logger, LoggerConfig, LoggerTransport, debug, error, log, logger, redactSensitiveFields, redactSensitiveString, warn };
|
|
4
4
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as BurdenoffGraphQLClient } from "./graphql-
|
|
2
|
-
import { p as SDKContext } from "./index-
|
|
1
|
+
import { t as BurdenoffGraphQLClient } from "./graphql-C8jKLLel.js";
|
|
2
|
+
import { p as SDKContext } from "./index-BTaQMEgB.js";
|
|
3
3
|
import { i as GraphQLContext } from "./types-CWybW61E.js";
|
|
4
4
|
interface CookieOptions {
|
|
5
5
|
name: string;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { s as GatewayRequestHeaders } from "./layer-C0zxAUgR.js";
|
|
2
|
+
import { a as GatewayError, c as GraphQLRequestOptions, d as IGatewayClient, f as RequestContext, i as GatewayClientHealth, l as GraphQLResponse, n as CircuitState, o as GatewayErrorType, r as GatewayClientConfig, s as GraphQLError, t as CircuitBreakerStats, u as ICircuitBreaker } from "./types-gJ9Qqi9E.js";
|
|
3
|
+
import { t as index_d_exports$1 } from "./index-C0qLquY0.js";
|
|
4
|
+
declare function isGatewayClientError(error: unknown): boolean;
|
|
5
|
+
declare class GatewayClient implements IGatewayClient {
|
|
6
|
+
private config;
|
|
7
|
+
private layerManager;
|
|
8
|
+
private internalCircuitBreaker;
|
|
9
|
+
private crossLayerCircuitBreaker;
|
|
10
|
+
private retryConfig;
|
|
11
|
+
private defaultHeaders;
|
|
12
|
+
constructor(config: GatewayClientConfig);
|
|
13
|
+
private getInternalUrl;
|
|
14
|
+
private getCrossLayerUrl;
|
|
15
|
+
internalQuery<T = unknown>(options: GraphQLRequestOptions): Promise<GraphQLResponse<T>>;
|
|
16
|
+
crossLayerQuery<T = unknown>(options: GraphQLRequestOptions): Promise<GraphQLResponse<T>>;
|
|
17
|
+
query<T = unknown>(gatewayUrl: string, options: GraphQLRequestOptions): Promise<GraphQLResponse<T>>;
|
|
18
|
+
getInternalCircuitBreaker(): ICircuitBreaker;
|
|
19
|
+
getCrossLayerCircuitBreaker(): ICircuitBreaker;
|
|
20
|
+
getHealthStatus(): GatewayClientHealth;
|
|
21
|
+
updateDefaultHeaders(headers: Partial<GatewayRequestHeaders>): void;
|
|
22
|
+
private createRequestContext;
|
|
23
|
+
private shouldRetryError;
|
|
24
|
+
private calculateRetryDelay;
|
|
25
|
+
private logRetryAttempt;
|
|
26
|
+
private executeWithRetry;
|
|
27
|
+
private buildRequestHeaders;
|
|
28
|
+
private handleGraphQLErrors;
|
|
29
|
+
private handleFetchError;
|
|
30
|
+
private executeRequest;
|
|
31
|
+
private sleep;
|
|
32
|
+
}
|
|
33
|
+
declare function createGatewayClient(config: GatewayClientConfig): GatewayClient;
|
|
34
|
+
declare function createGatewayClientFromEnv(): GatewayClient;
|
|
35
|
+
declare function signServiceJwt(actorId: string, ttlSeconds?: number): Promise<string | null>;
|
|
36
|
+
declare const DELEGATED_AUTHORIZATION_HEADER = "x-delegated-authorization";
|
|
37
|
+
interface DelegatedGatewayTransportInput {
|
|
38
|
+
appAsUserToken: string;
|
|
39
|
+
workspaceId?: string;
|
|
40
|
+
}
|
|
41
|
+
declare function buildDelegatedGatewayHeaders(input: DelegatedGatewayTransportInput): GatewayRequestHeaders;
|
|
42
|
+
declare const PROACTIVE_READ_SCOPE = "delegation:read";
|
|
43
|
+
declare function proactiveAssistantClientId(product: string): string;
|
|
44
|
+
type ProactiveIdentityErrorCode = string;
|
|
45
|
+
declare class ProactiveIdentityError extends Error {
|
|
46
|
+
readonly code: ProactiveIdentityErrorCode;
|
|
47
|
+
constructor(message: string, code: ProactiveIdentityErrorCode);
|
|
48
|
+
}
|
|
49
|
+
declare function isProactiveConsentMissing(error: unknown): boolean;
|
|
50
|
+
interface ProactiveIdentityTarget {
|
|
51
|
+
product: string;
|
|
52
|
+
userId: string;
|
|
53
|
+
workspaceId: string;
|
|
54
|
+
}
|
|
55
|
+
interface IssueProactiveReadTokenInput extends ProactiveIdentityTarget {
|
|
56
|
+
ttlSeconds?: number;
|
|
57
|
+
}
|
|
58
|
+
interface RevokeProactiveConsentInput extends ProactiveIdentityTarget {
|
|
59
|
+
reason?: string;
|
|
60
|
+
}
|
|
61
|
+
interface ProactiveReadToken {
|
|
62
|
+
token: string;
|
|
63
|
+
expiresAt: Date;
|
|
64
|
+
}
|
|
65
|
+
interface ProactiveConsent {
|
|
66
|
+
product: string;
|
|
67
|
+
clientId: string;
|
|
68
|
+
userId: string;
|
|
69
|
+
workspaceId: string;
|
|
70
|
+
granted: boolean;
|
|
71
|
+
expiresAt: Date | null;
|
|
72
|
+
}
|
|
73
|
+
type ProactiveIdentityClient = {
|
|
74
|
+
crossLayerQuery<T = unknown>(options: GraphQLRequestOptions): Promise<GraphQLResponse<T>>;
|
|
75
|
+
};
|
|
76
|
+
interface ProactiveIdentityOptions {
|
|
77
|
+
client?: ProactiveIdentityClient;
|
|
78
|
+
timeoutMs?: number;
|
|
79
|
+
serviceIdentity?: string;
|
|
80
|
+
}
|
|
81
|
+
declare function issueProactiveReadToken(input: IssueProactiveReadTokenInput, options?: ProactiveIdentityOptions): Promise<ProactiveReadToken>;
|
|
82
|
+
declare function grantProactiveConsent(input: ProactiveIdentityTarget, options?: ProactiveIdentityOptions): Promise<ProactiveConsent>;
|
|
83
|
+
declare function revokeProactiveConsent(input: RevokeProactiveConsentInput, options?: ProactiveIdentityOptions): Promise<boolean>;
|
|
84
|
+
declare function getProactiveConsent(input: ProactiveIdentityTarget, options?: ProactiveIdentityOptions): Promise<ProactiveConsent>;
|
|
85
|
+
declare namespace index_d_exports {
|
|
86
|
+
export { CircuitBreakerStats, CircuitState, DELEGATED_AUTHORIZATION_HEADER, DelegatedGatewayTransportInput, GatewayClient, GatewayClientConfig, GatewayClientHealth, GatewayError, GatewayErrorType, GraphQLError, GraphQLRequestOptions, GraphQLResponse, ICircuitBreaker, IGatewayClient, IssueProactiveReadTokenInput, PROACTIVE_READ_SCOPE, ProactiveConsent, ProactiveIdentityClient, ProactiveIdentityError, ProactiveIdentityErrorCode, ProactiveIdentityOptions, ProactiveIdentityTarget, ProactiveReadToken, RequestContext, RevokeProactiveConsentInput, index_d_exports$1 as Security, buildDelegatedGatewayHeaders, createGatewayClient, createGatewayClientFromEnv, getProactiveConsent, grantProactiveConsent, isGatewayClientError, isProactiveConsentMissing, issueProactiveReadToken, proactiveAssistantClientId, revokeProactiveConsent, signServiceJwt };
|
|
87
|
+
}
|
|
88
|
+
export { createGatewayClient as C, GatewayClient as S, isGatewayClientError as T, revokeProactiveConsent as _, ProactiveIdentityClient as a, buildDelegatedGatewayHeaders as b, ProactiveIdentityOptions as c, RevokeProactiveConsentInput as d, getProactiveConsent as f, proactiveAssistantClientId as g, issueProactiveReadToken as h, ProactiveConsent as i, ProactiveIdentityTarget as l, isProactiveConsentMissing as m, IssueProactiveReadTokenInput as n, ProactiveIdentityError as o, grantProactiveConsent as p, PROACTIVE_READ_SCOPE as r, ProactiveIdentityErrorCode as s, index_d_exports as t, ProactiveReadToken as u, DELEGATED_AUTHORIZATION_HEADER as v, createGatewayClientFromEnv as w, signServiceJwt as x, DelegatedGatewayTransportInput as y };
|