axiam-sdk 1.0.0-alpha
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/LICENSE +201 -0
- package/README.md +231 -0
- package/dist/amqp/index.d.cts +246 -0
- package/dist/amqp/index.d.ts +246 -0
- package/dist/amqp/index.js +179 -0
- package/dist/amqp/index.js.map +1 -0
- package/dist/amqp/index.mjs +166 -0
- package/dist/amqp/index.mjs.map +1 -0
- package/dist/client-B2SB-C7c.d.cts +207 -0
- package/dist/client-B2SB-C7c.d.ts +207 -0
- package/dist/grpc/index.d.cts +106 -0
- package/dist/grpc/index.d.ts +106 -0
- package/dist/grpc/index.js +908 -0
- package/dist/grpc/index.js.map +1 -0
- package/dist/grpc/index.mjs +868 -0
- package/dist/grpc/index.mjs.map +1 -0
- package/dist/index.d.cts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +561 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +552 -0
- package/dist/index.mjs.map +1 -0
- package/dist/jwks-CX-nhD6A.d.cts +29 -0
- package/dist/jwks-CX-nhD6A.d.ts +29 -0
- package/dist/middleware/index.d.cts +153 -0
- package/dist/middleware/index.d.ts +153 -0
- package/dist/middleware/index.js +232 -0
- package/dist/middleware/index.js.map +1 -0
- package/dist/middleware/index.mjs +220 -0
- package/dist/middleware/index.mjs.map +1 -0
- package/dist/node/index.d.cts +103 -0
- package/dist/node/index.d.ts +103 -0
- package/dist/node/index.js +717 -0
- package/dist/node/index.js.map +1 -0
- package/dist/node/index.mjs +700 -0
- package/dist/node/index.mjs.map +1 -0
- package/dist/rest/index.d.cts +27 -0
- package/dist/rest/index.d.ts +27 -0
- package/dist/rest/index.js +561 -0
- package/dist/rest/index.js.map +1 -0
- package/dist/rest/index.mjs +552 -0
- package/dist/rest/index.mjs.map +1 -0
- package/dist/sensitive-CWBH_tHr.d.cts +12 -0
- package/dist/sensitive-CWBH_tHr.d.ts +12 -0
- package/package.json +145 -0
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import * as grpc from '@grpc/grpc-js';
|
|
2
|
+
import { Interceptor } from '@grpc/grpc-js';
|
|
3
|
+
import { NodeSession } from '../node/index.js';
|
|
4
|
+
export { ACCESS_COOKIE, CSRF_COOKIE, REFRESH_COOKIE, TokenManager, createJar, createNodeClient, createNodeSession, extractCookieValue, wrapAxios } from '../node/index.js';
|
|
5
|
+
import { A as AccessDecision } from '../client-B2SB-C7c.js';
|
|
6
|
+
export { A as AxiamClaims, J as JWKS_PATH, V as Verifier, c as createVerifier } from '../jwks-CX-nhD6A.js';
|
|
7
|
+
import 'tough-cookie';
|
|
8
|
+
import '../sensitive-CWBH_tHr.js';
|
|
9
|
+
import 'axios';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Injects `authorization: Bearer <token>` (when a cached token is present)
|
|
13
|
+
* and `x-tenant-id` metadata on every outgoing RPC (CONTRACT.md §5). Never
|
|
14
|
+
* logs the token — `expose()` is only called at this metadata-insertion
|
|
15
|
+
* boundary.
|
|
16
|
+
*/
|
|
17
|
+
declare function authInterceptor(session: NodeSession): Interceptor;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Await `fn()`. On a gRPC UNAUTHENTICATED (16) error, drive the shared
|
|
21
|
+
* single-flight refresh, sync the token cache from the jar, and retry `fn()`
|
|
22
|
+
* exactly once. Any other error (or a second UNAUTHENTICATED) is mapped to
|
|
23
|
+
* an AxiamError via `mapGrpcStatusToError` and rethrown.
|
|
24
|
+
*/
|
|
25
|
+
declare function callWithRefresh<T>(session: NodeSession, fn: () => Promise<T>): Promise<T>;
|
|
26
|
+
|
|
27
|
+
interface WireCheckAccessRequest {
|
|
28
|
+
tenant_id: string;
|
|
29
|
+
subject_id: string;
|
|
30
|
+
action: string;
|
|
31
|
+
resource_id: string;
|
|
32
|
+
scope?: string;
|
|
33
|
+
}
|
|
34
|
+
interface WireCheckAccessResponse {
|
|
35
|
+
allowed: boolean;
|
|
36
|
+
deny_reason: string;
|
|
37
|
+
}
|
|
38
|
+
interface WireBatchCheckAccessRequest {
|
|
39
|
+
requests: WireCheckAccessRequest[];
|
|
40
|
+
}
|
|
41
|
+
interface WireBatchCheckAccessResponse {
|
|
42
|
+
results: WireCheckAccessResponse[];
|
|
43
|
+
}
|
|
44
|
+
type UnaryCallback<T> = (error: grpc.ServiceError | null, response?: T) => void;
|
|
45
|
+
/**
|
|
46
|
+
* The subset of a ts-proto (`outputServices=grpc-js`) generated
|
|
47
|
+
* `AuthorizationServiceClient` this module needs. The real generated client
|
|
48
|
+
* satisfies this shape exactly (unary Node-callback methods), so a
|
|
49
|
+
* buf-enabled build's generated client is a drop-in replacement here.
|
|
50
|
+
*/
|
|
51
|
+
interface WireAuthorizationServiceClient {
|
|
52
|
+
checkAccess(request: WireCheckAccessRequest, metadata: grpc.Metadata, callback: UnaryCallback<WireCheckAccessResponse>): grpc.ClientUnaryCall;
|
|
53
|
+
batchCheckAccess(request: WireBatchCheckAccessRequest, metadata: grpc.Metadata, callback: UnaryCallback<WireBatchCheckAccessResponse>): grpc.ClientUnaryCall;
|
|
54
|
+
close(): void;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Public (camelCase, §1) single access-check request shape.
|
|
58
|
+
*
|
|
59
|
+
* `subjectId` is required here (unlike REST's optional `AccessCheck.subjectId`)
|
|
60
|
+
* because gRPC calls typically originate from a service-mesh caller with no
|
|
61
|
+
* request-scoped JWT to derive a subject from — the caller must pass it
|
|
62
|
+
* explicitly. REST, by contrast, derives the subject from the caller's JWT
|
|
63
|
+
* when `subjectId` is omitted (§5). This mirrors the proto's non-`optional`
|
|
64
|
+
* `subject_id` field (`proto/axiam/v1/authorization.proto`), which is not
|
|
65
|
+
* changed here (SDK-Q10, C2).
|
|
66
|
+
*/
|
|
67
|
+
interface CheckAccessRequest {
|
|
68
|
+
tenantId: string;
|
|
69
|
+
subjectId: string;
|
|
70
|
+
action: string;
|
|
71
|
+
resourceId: string;
|
|
72
|
+
scope?: string;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Construct a real `AuthorizationServiceClient` over grpc-js's own
|
|
76
|
+
* `makeClientConstructor` primitive (the same primitive ts-proto's
|
|
77
|
+
* `outputServices=grpc-js` codegen target uses under the hood). This
|
|
78
|
+
* transport-level client encodes/decodes with JSON as a build-independent
|
|
79
|
+
* stand-in for the protobuf binary codec a buf-enabled build's generated
|
|
80
|
+
* serializers would use — swap this factory for the generated
|
|
81
|
+
* `AuthorizationServiceClient` once `src/gen` exists (D-20).
|
|
82
|
+
*/
|
|
83
|
+
declare function buildAuthorizationServiceClient(baseUrl: string, credentials: grpc.ChannelCredentials, interceptors: grpc.Interceptor[]): WireAuthorizationServiceClient;
|
|
84
|
+
type AuthorizationServiceClientFactory = (baseUrl: string, credentials: grpc.ChannelCredentials, interceptors: grpc.Interceptor[]) => WireAuthorizationServiceClient;
|
|
85
|
+
/**
|
|
86
|
+
* gRPC transport for `AuthorizationService` (`checkAccess`/`batchCheck`,
|
|
87
|
+
* SC#2 Node half), reusing one long-lived client/channel per instance (D-10
|
|
88
|
+
* — never reconstructed per-call) and injecting auth + tenant metadata via
|
|
89
|
+
* the synchronous interceptor on every RPC.
|
|
90
|
+
*/
|
|
91
|
+
declare class AuthzGrpcClient {
|
|
92
|
+
#private;
|
|
93
|
+
constructor(session: NodeSession, options: {
|
|
94
|
+
baseUrl: string;
|
|
95
|
+
customCa?: string;
|
|
96
|
+
allowInsecure?: boolean;
|
|
97
|
+
}, clientFactory?: AuthorizationServiceClientFactory);
|
|
98
|
+
/** `CheckAccess` over gRPC (SC#2 Node half). UNAUTHENTICATED triggers exactly one shared-guard refresh + one retry (§9.3). */
|
|
99
|
+
checkAccess(request: CheckAccessRequest): Promise<AccessDecision>;
|
|
100
|
+
/** `BatchCheckAccess` over gRPC — results preserve input order (§1). */
|
|
101
|
+
batchCheck(requests: CheckAccessRequest[]): Promise<AccessDecision[]>;
|
|
102
|
+
/** Close the underlying gRPC channel. */
|
|
103
|
+
close(): void;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export { AccessDecision, type AuthorizationServiceClientFactory, AuthzGrpcClient, type CheckAccessRequest, NodeSession, type WireAuthorizationServiceClient, type WireBatchCheckAccessRequest, type WireBatchCheckAccessResponse, type WireCheckAccessRequest, type WireCheckAccessResponse, authInterceptor, buildAuthorizationServiceClient, callWithRefresh };
|