@authyon/server 0.2.0-beta.5 → 0.2.0-beta.8

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,323 @@
1
+ // ../../internal/core/errors/authyonError.ts
2
+ var ErrorCodes = {
3
+ Unknown: "unknown",
4
+ NetworkError: "request.network_error",
5
+ Timeout: "request.timeout",
6
+ SessionMalformed: "session.malformed",
7
+ NotAuthenticated: "auth.not_authenticated",
8
+ InvalidToken: "auth.invalid_token",
9
+ MissingToken: "auth.missing_token",
10
+ EmailTaken: "user.email_taken",
11
+ PasswordWeak: "user.password_weak",
12
+ PasswordPwned: "user.password_pwned",
13
+ RateLimited: "rate_limited"
14
+ };
15
+ var AuthyonError = class extends Error {
16
+ constructor(status, body, options = {}) {
17
+ super(body.detail ?? body.title ?? `Authyon request failed with status ${status}`);
18
+ this.name = "AuthyonError";
19
+ this.status = status;
20
+ this.code = body.code ?? "unknown";
21
+ this.title = body.title ?? "Error";
22
+ this.detail = body.detail;
23
+ this.requestId = options.requestId;
24
+ this.retryAfter = options.retryAfter;
25
+ this.cause = options.cause;
26
+ }
27
+ is(code) {
28
+ return this.code === code;
29
+ }
30
+ isAny(...codes) {
31
+ return codes.includes(this.code);
32
+ }
33
+ hasPrefix(prefix) {
34
+ return this.code.startsWith(prefix);
35
+ }
36
+ isStatus(...statuses) {
37
+ return statuses.includes(this.status);
38
+ }
39
+ /** Stable interpretation for UI decisions, retries, telemetry and support flows. */
40
+ interpret() {
41
+ const category = classifyError(this.status, this.code);
42
+ return {
43
+ category,
44
+ action: actionFor(category),
45
+ retryable: isRetryable(category),
46
+ ...this.retryAfter !== void 0 ? { retryAfter: this.retryAfter } : {},
47
+ ...this.requestId !== void 0 ? { requestId: this.requestId } : {}
48
+ };
49
+ }
50
+ get category() {
51
+ return this.interpret().category;
52
+ }
53
+ get retryable() {
54
+ return this.interpret().retryable;
55
+ }
56
+ toJSON() {
57
+ return {
58
+ name: this.name,
59
+ message: this.message,
60
+ status: this.status,
61
+ code: this.code,
62
+ title: this.title,
63
+ detail: this.detail,
64
+ requestId: this.requestId,
65
+ retryAfter: this.retryAfter,
66
+ ...this.interpret()
67
+ };
68
+ }
69
+ };
70
+ function classifyError(status, code) {
71
+ if (code === ErrorCodes.NetworkError) return "network";
72
+ if (code === ErrorCodes.Timeout || status === 408) return "timeout";
73
+ if (code === ErrorCodes.RateLimited || status === 429) return "rate_limit";
74
+ if (code === ErrorCodes.EmailTaken || status === 409) return "conflict";
75
+ if (code === ErrorCodes.PasswordWeak || code === ErrorCodes.PasswordPwned) return "validation";
76
+ if (code === ErrorCodes.SessionMalformed) return "server";
77
+ if (code.startsWith("auth.") || status === 401) return "authentication";
78
+ if (status === 403) return "authorization";
79
+ if (status === 404) return "not_found";
80
+ if (status === 400 || status === 422) return "validation";
81
+ if (status >= 500) return "server";
82
+ return "unknown";
83
+ }
84
+ function actionFor(category) {
85
+ switch (category) {
86
+ case "network":
87
+ case "timeout":
88
+ case "rate_limit":
89
+ case "server":
90
+ return "retry";
91
+ case "authentication":
92
+ return "reauthenticate";
93
+ case "authorization":
94
+ return "request_access";
95
+ case "validation":
96
+ return "fix_input";
97
+ case "not_found":
98
+ return "not_found";
99
+ case "conflict":
100
+ return "resolve_conflict";
101
+ case "unknown":
102
+ return "contact_support";
103
+ }
104
+ }
105
+ function isRetryable(category) {
106
+ return category === "network" || category === "timeout" || category === "rate_limit" || category === "server";
107
+ }
108
+
109
+ // ../../internal/core/http/httpAdapter.ts
110
+ var FetchHttpAdapter = class {
111
+ constructor(fetchImpl = fetch.bind(globalThis)) {
112
+ this.fetchImpl = fetchImpl;
113
+ }
114
+ request(request) {
115
+ return this.fetchImpl(request.url, {
116
+ method: request.method,
117
+ headers: request.headers,
118
+ body: request.body,
119
+ signal: request.signal,
120
+ redirect: "error"
121
+ });
122
+ }
123
+ };
124
+ var LoggingHttpAdapter = class {
125
+ constructor(adapter, options) {
126
+ this.adapter = adapter;
127
+ this.options = options;
128
+ }
129
+ async request(request) {
130
+ const startedAt = Date.now();
131
+ const eventBase = {
132
+ method: request.method,
133
+ url: sanitizeUrl(request.url)
134
+ };
135
+ this.log({ type: "request", ...eventBase, timestamp: startedAt });
136
+ try {
137
+ const response = await this.adapter.request(request);
138
+ this.log({
139
+ type: "response",
140
+ ...eventBase,
141
+ status: response.status,
142
+ durationMs: Date.now() - startedAt,
143
+ requestId: response.headers.get("x-request-id") ?? response.headers.get("trace-id") ?? void 0,
144
+ timestamp: Date.now()
145
+ });
146
+ return response;
147
+ } catch (error) {
148
+ this.log({
149
+ type: "error",
150
+ ...eventBase,
151
+ errorName: error instanceof Error ? error.name : "UnknownError",
152
+ durationMs: Date.now() - startedAt,
153
+ timestamp: Date.now()
154
+ });
155
+ throw error;
156
+ }
157
+ }
158
+ log(event) {
159
+ if (!this.options.enabled) return;
160
+ const logger = this.options.logger ?? defaultHttpLogger;
161
+ try {
162
+ logger(event);
163
+ } catch {
164
+ }
165
+ }
166
+ };
167
+ function defaultHttpLogger(event) {
168
+ console.debug("[Authyon HTTP]", event);
169
+ }
170
+ function sanitizeUrl(value) {
171
+ const url = new URL(value);
172
+ url.username = "";
173
+ url.password = "";
174
+ url.hash = "";
175
+ url.pathname = url.pathname.replace(/(\/platform\/workspace-invites\/)[^/]+/u, "$1REDACTED");
176
+ const queryKeys = /* @__PURE__ */ new Set();
177
+ url.searchParams.forEach((_value, key) => queryKeys.add(key));
178
+ url.search = queryKeys.size > 0 ? [...queryKeys].map((key) => `${encodeURIComponent(key)}=REDACTED`).join("&") : "";
179
+ return url.toString();
180
+ }
181
+
182
+ // ../../internal/core/config/defaults.ts
183
+ var DEFAULT_BASE_URL = "https://api.authyon.com";
184
+ var DEFAULT_EXPIRY_SKEW_MS = 3e4;
185
+
186
+ // ../../internal/core/http/transport.ts
187
+ var DEFAULT_TIMEOUT_MS = 15e3;
188
+ var SharedTransportError = class extends Error {
189
+ constructor(code, cause) {
190
+ super(code === "request.timeout" ? "Request timed out" : "Network request failed");
191
+ this.name = "SharedTransportError";
192
+ this.code = code;
193
+ this.cause = cause;
194
+ }
195
+ };
196
+ function createSharedTransport(options) {
197
+ const baseUrl = normalizeBaseUrl(options.baseUrl, options.allowInsecureHttp ?? false);
198
+ const timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
199
+ if (!Number.isFinite(timeoutMs) || timeoutMs < 0) {
200
+ throw new Error("Authyon: `timeoutMs` must be a non-negative finite number");
201
+ }
202
+ if (options.httpAdapter && options.fetch) {
203
+ throw new Error("Authyon: use either `httpAdapter` or `fetch`, not both");
204
+ }
205
+ const baseAdapter = options.httpAdapter ?? new FetchHttpAdapter(options.fetch);
206
+ const httpAdapter = options.httpLogger ? new LoggingHttpAdapter(baseAdapter, options.httpLogger) : baseAdapter;
207
+ return {
208
+ baseUrl,
209
+ async request(path, init) {
210
+ const controller = new AbortController();
211
+ const timeout = timeoutMs > 0 ? setTimeout(() => controller.abort(), timeoutMs) : void 0;
212
+ try {
213
+ return await httpAdapter.request({
214
+ url: `${baseUrl}${path}`,
215
+ method: init.method ?? "GET",
216
+ headers: normalizeHeaders(init.headers),
217
+ body: init.body,
218
+ signal: controller.signal
219
+ });
220
+ } catch (cause) {
221
+ throw new SharedTransportError(
222
+ controller.signal.aborted ? ErrorCodes.Timeout : ErrorCodes.NetworkError,
223
+ cause
224
+ );
225
+ } finally {
226
+ if (timeout !== void 0) clearTimeout(timeout);
227
+ }
228
+ }
229
+ };
230
+ }
231
+ function normalizeHeaders(headers) {
232
+ const normalized = {};
233
+ new Headers(headers).forEach((value, key) => {
234
+ normalized[key] = value;
235
+ });
236
+ return normalized;
237
+ }
238
+ function responseMetadata(response) {
239
+ const retryAfterHeader = response.headers.get("retry-after");
240
+ const retryAfter = retryAfterHeader ? Number(retryAfterHeader) : void 0;
241
+ return {
242
+ requestId: response.headers.get("x-request-id") ?? response.headers.get("trace-id") ?? void 0,
243
+ retryAfter: Number.isFinite(retryAfter) ? retryAfter : void 0
244
+ };
245
+ }
246
+ function normalizeBaseUrl(value, allowInsecureHttp) {
247
+ let url;
248
+ try {
249
+ url = new URL(value);
250
+ } catch {
251
+ throw new Error("Authyon: `baseUrl` must be an absolute URL");
252
+ }
253
+ const loopback = url.hostname === "localhost" || url.hostname === "127.0.0.1" || url.hostname === "[::1]";
254
+ if (url.protocol !== "https:" && !(url.protocol === "http:" && (loopback || allowInsecureHttp))) {
255
+ throw new Error(
256
+ "Authyon: `baseUrl` must use HTTPS (HTTP is allowed only for loopback or with `allowInsecureHttp`)"
257
+ );
258
+ }
259
+ if (url.username || url.password || url.search || url.hash) {
260
+ throw new Error(
261
+ "Authyon: `baseUrl` cannot contain credentials, query parameters, or fragments"
262
+ );
263
+ }
264
+ return url.toString().replace(/\/+$/, "");
265
+ }
266
+
267
+ // ../../internal/core/http/query.ts
268
+ function appendQuery(path, params) {
269
+ if (!params) return path;
270
+ const query = new URLSearchParams();
271
+ for (const [key, value2] of Object.entries(params)) {
272
+ if (value2 !== void 0) query.set(key, String(value2));
273
+ }
274
+ const value = query.toString();
275
+ return value ? `${path}${path.includes("?") ? "&" : "?"}${value}` : path;
276
+ }
277
+
278
+ // ../../internal/core/http/jsonHttpClient.ts
279
+ var JsonHttpClient = class {
280
+ constructor(transport) {
281
+ this.transport = transport;
282
+ }
283
+ async send(path, options = {}) {
284
+ const headers = { ...options.headers };
285
+ if (options.body !== void 0) headers["Content-Type"] = "application/json";
286
+ try {
287
+ return await this.transport.request(appendQuery(path, options.query), {
288
+ method: options.method ?? "GET",
289
+ headers,
290
+ body: options.body !== void 0 ? JSON.stringify(options.body) : void 0
291
+ });
292
+ } catch (cause) {
293
+ if (!(cause instanceof SharedTransportError)) throw cause;
294
+ throw new AuthyonError(0, { code: cause.code, title: cause.message }, { cause: cause.cause });
295
+ }
296
+ }
297
+ async parse(response) {
298
+ if (!response.ok) {
299
+ let body = {};
300
+ try {
301
+ body = await response.json();
302
+ } catch {
303
+ }
304
+ throw new AuthyonError(response.status, body, responseMetadata(response));
305
+ }
306
+ if (response.status === 204) return void 0;
307
+ return await response.json();
308
+ }
309
+ async request(path, options = {}) {
310
+ return this.parse(await this.send(path, options));
311
+ }
312
+ };
313
+
314
+ export {
315
+ ErrorCodes,
316
+ AuthyonError,
317
+ DEFAULT_BASE_URL,
318
+ DEFAULT_EXPIRY_SKEW_MS,
319
+ FetchHttpAdapter,
320
+ LoggingHttpAdapter,
321
+ createSharedTransport,
322
+ JsonHttpClient
323
+ };
@@ -0,0 +1,13 @@
1
+ var __typeError = (msg) => {
2
+ throw TypeError(msg);
3
+ };
4
+ var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
5
+ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
6
+ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
7
+ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
8
+
9
+ export {
10
+ __privateGet,
11
+ __privateAdd,
12
+ __privateSet
13
+ };
@@ -1,11 +1,3 @@
1
- var __typeError = (msg) => {
2
- throw TypeError(msg);
3
- };
4
- var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
5
- var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
6
- var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
7
- var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
8
-
9
1
  // ../../internal/core/http/clientIp.ts
10
2
  function clientIpHeaders(context) {
11
3
  if (!context?.clientIp) return {};
@@ -237,6 +229,11 @@ function hasPermission(source, requiredPermission) {
237
229
  const permissionSource = isPermissionList(source) ? { permissions: source } : source;
238
230
  return createAuthyonAbility(permissionSource).can(requirement.action, requirement.subject);
239
231
  }
232
+ function hasPermissionGroup(source, group) {
233
+ const hasAll = (group.allOf ?? []).every((permission) => hasPermission(source, permission));
234
+ const hasAny = !group.anyOf?.length || group.anyOf.some((permission) => hasPermission(source, permission));
235
+ return hasAll && hasAny;
236
+ }
240
237
  function isPermissionList(source) {
241
238
  return Array.isArray(source);
242
239
  }
@@ -470,9 +467,6 @@ function unauthenticated() {
470
467
  }
471
468
 
472
469
  export {
473
- __privateGet,
474
- __privateAdd,
475
- __privateSet,
476
470
  clientIpHeaders,
477
471
  normalizeClientIp,
478
472
  TokenVerificationError,
@@ -481,6 +475,7 @@ export {
481
475
  AuthyonAbilityBuilder,
482
476
  createAuthyonAbility,
483
477
  hasPermission,
478
+ hasPermissionGroup,
484
479
  createAuthyonRules,
485
480
  AuthorizationError,
486
481
  authorizeToken,
package/dist/index.cjs CHANGED
@@ -50,6 +50,7 @@ __export(index_exports, {
50
50
  createClient: () => createClient,
51
51
  createExpressAuthorizationMiddleware: () => createExpressAuthorizationMiddleware,
52
52
  hasPermission: () => hasPermission,
53
+ hasPermissionGroup: () => hasPermissionGroup,
53
54
  normalizeClientIp: () => normalizeClientIp
54
55
  });
55
56
  module.exports = __toCommonJS(index_exports);
@@ -835,6 +836,14 @@ var AuthyonServerClient = class {
835
836
  client_id: credentials.clientId,
836
837
  client_secret: credentials.clientSecret
837
838
  }
839
+ }),
840
+ /** POST /tenant/auth/validate — validates an already-minted tenant-client bearer token. */
841
+ validate: (accessToken, context) => this.request("/tenant/auth/validate", {
842
+ method: "POST",
843
+ headers: {
844
+ ...clientIpHeaders(context),
845
+ Authorization: `Bearer ${accessToken}`
846
+ }
838
847
  })
839
848
  };
840
849
  this.workspaceInvites = new WorkspaceInvitesClient(
@@ -953,7 +962,11 @@ var AuthyonServerClient = class {
953
962
  create: (tenantId, input) => this.request(`/env/tenants/${segment(tenantId)}/credentials`, {
954
963
  method: "POST",
955
964
  envBearer: true,
956
- body: { description: input.description, ...lifetimeBody(input), ...permissionsBody(input) }
965
+ body: {
966
+ description: input.description,
967
+ ...lifetimeBody(input),
968
+ ...permissionsBody(input)
969
+ }
957
970
  }),
958
971
  /** Returns a new secret once while keeping the same client id. */
959
972
  rotate: (tenantId, credentialId) => this.request(
@@ -984,7 +997,18 @@ var AuthyonServerClient = class {
984
997
  envBearer: true,
985
998
  body: input
986
999
  }),
987
- /** DELETE /env/tenants/{tenantId} — delete a tenant. */
1000
+ /** PUT /env/tenants/{tenantId}/metadata - replace public and private metadata. */
1001
+ updateMetadata: (tenantId, input) => this.request(`/env/tenants/${encodeURIComponent(tenantId)}/metadata`, {
1002
+ method: "PUT",
1003
+ envBearer: true,
1004
+ body: input
1005
+ }),
1006
+ /** POST /env/tenants/{tenantId}/disable — disable without removing tenant data. */
1007
+ disable: (tenantId) => this.request(`/env/tenants/${encodeURIComponent(tenantId)}/disable`, {
1008
+ method: "POST",
1009
+ envBearer: true
1010
+ }),
1011
+ /** DELETE /env/tenants/{tenantId} — logically delete (disable) a tenant. */
988
1012
  delete: (tenantId) => this.request(`/env/tenants/${encodeURIComponent(tenantId)}`, {
989
1013
  method: "DELETE",
990
1014
  envBearer: true
@@ -1119,6 +1143,7 @@ var AuthyonServerClient = class {
1119
1143
  this.envKey = options.envKey;
1120
1144
  this.clientId = options.clientId;
1121
1145
  __privateSet(this, _clientSecret, options.clientSecret);
1146
+ this.clientIp = options.clientIp;
1122
1147
  this.transport = createSharedTransport({
1123
1148
  baseUrl: options.baseUrl ?? DEFAULT_BASE_URL,
1124
1149
  allowInsecureHttp: options.allowInsecureHttp,
@@ -1145,7 +1170,10 @@ var AuthyonServerClient = class {
1145
1170
  });
1146
1171
  }
1147
1172
  async request(path, options = {}) {
1148
- const headers = { ...options.headers };
1173
+ const headers = {
1174
+ ...clientIpHeaders({ clientIp: this.clientIp }),
1175
+ ...options.headers
1176
+ };
1149
1177
  if (options.envBearer) {
1150
1178
  headers.Authorization = `Bearer ${await this.getEnvironmentAccessToken()}`;
1151
1179
  }
@@ -1296,8 +1324,8 @@ var TenantScopedClient = class {
1296
1324
  return this.server._requestAsTenant(await this.getAccessToken(), path, options);
1297
1325
  }
1298
1326
  /** POST /tenant/auth/validate — validates this tenant client's current bearer token. */
1299
- validate() {
1300
- return this.request("/tenant/auth/validate", { method: "POST" });
1327
+ async validate(context) {
1328
+ return this.server.tenantAuth.validate(await this.getAccessToken(), context);
1301
1329
  }
1302
1330
  };
1303
1331
  function createClient(options = {}) {
@@ -1319,6 +1347,10 @@ var AuthyonServerClientBuilder = class {
1319
1347
  __privateGet(this, _options).clientSecret = clientSecret;
1320
1348
  return this;
1321
1349
  }
1350
+ withClientIp(clientIp) {
1351
+ __privateGet(this, _options).clientIp = clientIp;
1352
+ return this;
1353
+ }
1322
1354
  withBaseUrl(baseUrl, allowInsecureHttp = false) {
1323
1355
  __privateGet(this, _options).baseUrl = baseUrl;
1324
1356
  __privateGet(this, _options).allowInsecureHttp = allowInsecureHttp;
@@ -1412,6 +1444,11 @@ function hasPermission(source, requiredPermission) {
1412
1444
  const permissionSource = isPermissionList(source) ? { permissions: source } : source;
1413
1445
  return createAuthyonAbility(permissionSource).can(requirement.action, requirement.subject);
1414
1446
  }
1447
+ function hasPermissionGroup(source, group) {
1448
+ const hasAll = (group.allOf ?? []).every((permission) => hasPermission(source, permission));
1449
+ const hasAny = !group.anyOf?.length || group.anyOf.some((permission) => hasPermission(source, permission));
1450
+ return hasAll && hasAny;
1451
+ }
1415
1452
  function isPermissionList(source) {
1416
1453
  return Array.isArray(source);
1417
1454
  }
@@ -1668,5 +1705,6 @@ function unauthenticated() {
1668
1705
  createClient,
1669
1706
  createExpressAuthorizationMiddleware,
1670
1707
  hasPermission,
1708
+ hasPermissionGroup,
1671
1709
  normalizeClientIp
1672
1710
  });
package/dist/index.d.cts CHANGED
@@ -1,5 +1,6 @@
1
- import { H as HttpAdapter, c as HttpLoggerOptions, A as AuthyonServerClient } from './authorization-NQe6R3am.cjs';
2
- export { d as AbilityConditions, e as AbilityEvent, f as AbilityListener, g as AbilityRequirement, h as AbilityRule, a as AbilitySubject, i as AcceptWorkspaceInviteInput, j as AccessTokenSource, k as AuditEvent, l as AuthorizationContext, b as AuthorizationError, m as AuthorizationOptions, n as AuthyonAbility, o as AuthyonAbilityBuilder, p as AuthyonAbilityOptions, q as AuthyonJwksDiscoveryOptions, r as AuthyonJwtClaims, s as AuthyonPermissionSource, t as AuthyonServerClientOptions, C as ClientCredentials, u as ClientRequestContext, v as CreateCredentialInput, w as CreateOrganizationInput, x as CreatePermissionInput, y as CreateTenantCredentialInput, z as CreateUserInput, B as CredentialCreator, D as CredentialDetail, E as CredentialListOptions, F as CredentialPermissionsInput, G as CredentialScope, I as EnvironmentUser, J as ExpressAuthorizationMiddlewareOptions, K as ExpressNext, L as ExpressRequestLike, M as ExpressResponseLike, N as FetchHttpAdapter, O as HttpAdapterRequest, P as HttpLogEvent, Q as HttpLogger, S as IntrospectResult, T as InviteTenantMemberInput, U as InviteWorkspaceMemberInput, V as JsonWebKeySet, W as JwksTokenVerifier, X as JwksTokenVerifierOptions, Y as LoggingHttpAdapter, Z as LoginActivity, _ as OpenIdConfiguration, $ as Organization, a0 as Paged, a1 as PaginationOptions, a2 as Permission, a3 as PermissionsByRole, a4 as PlatformScopedClient, R as RequestAuthorizationOptions, a5 as ReservedPermissions, a6 as Role, a7 as RoleGrant, a8 as RoleInput, a9 as RoleList, aa as RolePermissions, ab as SafeJwtAlgorithm, ac as TenantClientValidationResult, ad as TenantCredentialIssued, ae as TenantCredentialSummary, af as TenantManagementScope, ag as TenantMember, ah as TenantMemberPage, ai as TenantMembership, aj as TenantScopedClient, ak as TokenResult, al as TokenVerificationError, am as TokenVerificationErrorCode, an as UpdateOrganizationInput, ao as User, ap as UserScopedClient, aq as ValidateResult, ar as VerifiedAccessToken, as as WorkspaceInvite, at as WorkspaceInviteAccepted, au as WorkspaceInviteIssued, av as WorkspaceInvitePreview, aw as WorkspaceInvitesClient, ax as WorkspaceMember, ay as WorkspaceRole, az as WorkspaceTeam, aA as authorizeRequest, aB as authorizeToken, aC as createAuthorizationErrorResponse, aD as createAuthyonAbility, aE as createAuthyonRules, aF as createClient, aG as createExpressAuthorizationMiddleware, aH as hasPermission, aI as normalizeClientIp } from './authorization-NQe6R3am.cjs';
1
+ import { H as HttpAdapter, a as HttpLoggerOptions, A as AuthyonServerClient } from './authyonServerClient-D8r47VSq.cjs';
2
+ export { b as AcceptWorkspaceInviteInput, c as AccessTokenSource, d as AuditEvent, e as AuthyonJwksDiscoveryOptions, f as AuthyonJwtClaims, g as AuthyonServerClientOptions, C as ClientCredentials, h as ClientRequestContext, i as CreateCredentialInput, j as CreateOrganizationInput, k as CreatePermissionInput, l as CreateTenantCredentialInput, m as CreateUserInput, n as CredentialCreator, o as CredentialDetail, p as CredentialListOptions, q as CredentialPermissionsInput, r as CredentialScope, E as EnvironmentUser, F as FetchHttpAdapter, s as HttpAdapterRequest, t as HttpLogEvent, u as HttpLogger, I as IntrospectResult, v as InviteTenantMemberInput, w as InviteWorkspaceMemberInput, J as JsonWebKeySet, x as JwksTokenVerifier, y as JwksTokenVerifierOptions, L as LoggingHttpAdapter, z as LoginActivity, O as OpenIdConfiguration, B as Organization, P as Paged, D as PaginationOptions, G as Permission, K as PermissionsByRole, M as PlatformScopedClient, R as ReservedPermissions, N as Role, Q as RoleGrant, S as RoleInput, T as RoleList, U as RolePermissions, V as SafeJwtAlgorithm, W as TenantClientValidationResult, X as TenantCredentialIssued, Y as TenantCredentialSummary, Z as TenantManagementScope, _ as TenantMember, $ as TenantMemberPage, a0 as TenantMembership, a1 as TenantScopedClient, a2 as TokenResult, a3 as TokenVerificationError, a4 as TokenVerificationErrorCode, a5 as UpdateOrganizationInput, a6 as User, a7 as UserScopedClient, a8 as ValidateResult, a9 as VerifiedAccessToken, aa as WorkspaceInvite, ab as WorkspaceInviteAccepted, ac as WorkspaceInviteIssued, ad as WorkspaceInvitePreview, ae as WorkspaceInvitesClient, af as WorkspaceMember, ag as WorkspaceRole, ah as WorkspaceTeam, ai as createClient, aj as normalizeClientIp } from './authyonServerClient-D8r47VSq.cjs';
3
+ export { b as AbilityConditions, c as AbilityEvent, d as AbilityListener, e as AbilityRequirement, f as AbilityRule, A as AbilitySubject, g as AuthorizationContext, a as AuthorizationError, h as AuthorizationOptions, i as AuthyonAbility, j as AuthyonAbilityBuilder, k as AuthyonAbilityOptions, l as AuthyonPermissionSource, E as ExpressAuthorizationMiddlewareOptions, m as ExpressNext, n as ExpressRequestLike, o as ExpressResponseLike, P as PermissionGroup, R as RequestAuthorizationOptions, p as authorizeRequest, q as authorizeToken, r as createAuthorizationErrorResponse, s as createAuthyonAbility, t as createAuthyonRules, u as createExpressAuthorizationMiddleware, v as hasPermission, w as hasPermissionGroup } from './authorization-DPlRA9qM.cjs';
3
4
  import 'jose';
4
5
 
5
6
  declare const ErrorCodes: {
@@ -59,6 +60,7 @@ declare class AuthyonServerClientBuilder {
59
60
  #private;
60
61
  withEnvironmentKey(envKey: string): this;
61
62
  withEnvironmentCredentials(clientId: string, clientSecret: string): this;
63
+ withClientIp(clientIp: string): this;
62
64
  withBaseUrl(baseUrl: string, allowInsecureHttp?: boolean): this;
63
65
  withTimeout(timeoutMs: number): this;
64
66
  withHttpAdapter(httpAdapter: HttpAdapter): this;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
- import { H as HttpAdapter, c as HttpLoggerOptions, A as AuthyonServerClient } from './authorization-NQe6R3am.js';
2
- export { d as AbilityConditions, e as AbilityEvent, f as AbilityListener, g as AbilityRequirement, h as AbilityRule, a as AbilitySubject, i as AcceptWorkspaceInviteInput, j as AccessTokenSource, k as AuditEvent, l as AuthorizationContext, b as AuthorizationError, m as AuthorizationOptions, n as AuthyonAbility, o as AuthyonAbilityBuilder, p as AuthyonAbilityOptions, q as AuthyonJwksDiscoveryOptions, r as AuthyonJwtClaims, s as AuthyonPermissionSource, t as AuthyonServerClientOptions, C as ClientCredentials, u as ClientRequestContext, v as CreateCredentialInput, w as CreateOrganizationInput, x as CreatePermissionInput, y as CreateTenantCredentialInput, z as CreateUserInput, B as CredentialCreator, D as CredentialDetail, E as CredentialListOptions, F as CredentialPermissionsInput, G as CredentialScope, I as EnvironmentUser, J as ExpressAuthorizationMiddlewareOptions, K as ExpressNext, L as ExpressRequestLike, M as ExpressResponseLike, N as FetchHttpAdapter, O as HttpAdapterRequest, P as HttpLogEvent, Q as HttpLogger, S as IntrospectResult, T as InviteTenantMemberInput, U as InviteWorkspaceMemberInput, V as JsonWebKeySet, W as JwksTokenVerifier, X as JwksTokenVerifierOptions, Y as LoggingHttpAdapter, Z as LoginActivity, _ as OpenIdConfiguration, $ as Organization, a0 as Paged, a1 as PaginationOptions, a2 as Permission, a3 as PermissionsByRole, a4 as PlatformScopedClient, R as RequestAuthorizationOptions, a5 as ReservedPermissions, a6 as Role, a7 as RoleGrant, a8 as RoleInput, a9 as RoleList, aa as RolePermissions, ab as SafeJwtAlgorithm, ac as TenantClientValidationResult, ad as TenantCredentialIssued, ae as TenantCredentialSummary, af as TenantManagementScope, ag as TenantMember, ah as TenantMemberPage, ai as TenantMembership, aj as TenantScopedClient, ak as TokenResult, al as TokenVerificationError, am as TokenVerificationErrorCode, an as UpdateOrganizationInput, ao as User, ap as UserScopedClient, aq as ValidateResult, ar as VerifiedAccessToken, as as WorkspaceInvite, at as WorkspaceInviteAccepted, au as WorkspaceInviteIssued, av as WorkspaceInvitePreview, aw as WorkspaceInvitesClient, ax as WorkspaceMember, ay as WorkspaceRole, az as WorkspaceTeam, aA as authorizeRequest, aB as authorizeToken, aC as createAuthorizationErrorResponse, aD as createAuthyonAbility, aE as createAuthyonRules, aF as createClient, aG as createExpressAuthorizationMiddleware, aH as hasPermission, aI as normalizeClientIp } from './authorization-NQe6R3am.js';
1
+ import { H as HttpAdapter, a as HttpLoggerOptions, A as AuthyonServerClient } from './authyonServerClient-D8r47VSq.js';
2
+ export { b as AcceptWorkspaceInviteInput, c as AccessTokenSource, d as AuditEvent, e as AuthyonJwksDiscoveryOptions, f as AuthyonJwtClaims, g as AuthyonServerClientOptions, C as ClientCredentials, h as ClientRequestContext, i as CreateCredentialInput, j as CreateOrganizationInput, k as CreatePermissionInput, l as CreateTenantCredentialInput, m as CreateUserInput, n as CredentialCreator, o as CredentialDetail, p as CredentialListOptions, q as CredentialPermissionsInput, r as CredentialScope, E as EnvironmentUser, F as FetchHttpAdapter, s as HttpAdapterRequest, t as HttpLogEvent, u as HttpLogger, I as IntrospectResult, v as InviteTenantMemberInput, w as InviteWorkspaceMemberInput, J as JsonWebKeySet, x as JwksTokenVerifier, y as JwksTokenVerifierOptions, L as LoggingHttpAdapter, z as LoginActivity, O as OpenIdConfiguration, B as Organization, P as Paged, D as PaginationOptions, G as Permission, K as PermissionsByRole, M as PlatformScopedClient, R as ReservedPermissions, N as Role, Q as RoleGrant, S as RoleInput, T as RoleList, U as RolePermissions, V as SafeJwtAlgorithm, W as TenantClientValidationResult, X as TenantCredentialIssued, Y as TenantCredentialSummary, Z as TenantManagementScope, _ as TenantMember, $ as TenantMemberPage, a0 as TenantMembership, a1 as TenantScopedClient, a2 as TokenResult, a3 as TokenVerificationError, a4 as TokenVerificationErrorCode, a5 as UpdateOrganizationInput, a6 as User, a7 as UserScopedClient, a8 as ValidateResult, a9 as VerifiedAccessToken, aa as WorkspaceInvite, ab as WorkspaceInviteAccepted, ac as WorkspaceInviteIssued, ad as WorkspaceInvitePreview, ae as WorkspaceInvitesClient, af as WorkspaceMember, ag as WorkspaceRole, ah as WorkspaceTeam, ai as createClient, aj as normalizeClientIp } from './authyonServerClient-D8r47VSq.js';
3
+ export { b as AbilityConditions, c as AbilityEvent, d as AbilityListener, e as AbilityRequirement, f as AbilityRule, A as AbilitySubject, g as AuthorizationContext, a as AuthorizationError, h as AuthorizationOptions, i as AuthyonAbility, j as AuthyonAbilityBuilder, k as AuthyonAbilityOptions, l as AuthyonPermissionSource, E as ExpressAuthorizationMiddlewareOptions, m as ExpressNext, n as ExpressRequestLike, o as ExpressResponseLike, P as PermissionGroup, R as RequestAuthorizationOptions, p as authorizeRequest, q as authorizeToken, r as createAuthorizationErrorResponse, s as createAuthyonAbility, t as createAuthyonRules, u as createExpressAuthorizationMiddleware, v as hasPermission, w as hasPermissionGroup } from './authorization-BZTzR6iu.js';
3
4
  import 'jose';
4
5
 
5
6
  declare const ErrorCodes: {
@@ -59,6 +60,7 @@ declare class AuthyonServerClientBuilder {
59
60
  #private;
60
61
  withEnvironmentKey(envKey: string): this;
61
62
  withEnvironmentCredentials(clientId: string, clientSecret: string): this;
63
+ withClientIp(clientIp: string): this;
62
64
  withBaseUrl(baseUrl: string, allowInsecureHttp?: boolean): this;
63
65
  withTimeout(timeoutMs: number): this;
64
66
  withHttpAdapter(httpAdapter: HttpAdapter): this;