@attlaz/client 1.101.0 → 1.102.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -4,6 +4,14 @@ export interface DirectTransportRoute {
|
|
|
4
4
|
prefix: string;
|
|
5
5
|
baseUrl: string;
|
|
6
6
|
}
|
|
7
|
+
/**
|
|
8
|
+
* The actor an internal call runs as. Backends resolve access against this, so a caller that reaches
|
|
9
|
+
* user-owned resources must name one — an anonymous session can only reach unguarded routes.
|
|
10
|
+
*/
|
|
11
|
+
export interface DirectTransportPrincipal {
|
|
12
|
+
id: string;
|
|
13
|
+
name: string;
|
|
14
|
+
}
|
|
7
15
|
/**
|
|
8
16
|
* Transport for internal service-to-service calls that bypasses Gateway OAuth.
|
|
9
17
|
* Authenticates via HMAC-signed session headers instead of an OAuth token.
|
|
@@ -29,9 +37,13 @@ export declare class DirectTransport implements ITransport {
|
|
|
29
37
|
private readonly sortedRoutes;
|
|
30
38
|
private parseErrorHandler;
|
|
31
39
|
/**
|
|
32
|
-
* Creates the
|
|
40
|
+
* Creates the session payload for internal service-to-service calls.
|
|
41
|
+
*
|
|
42
|
+
* Pass `user` when the call reaches resources an access policy guards (typically the platform
|
|
43
|
+
* SYSTEM user); omit it only for routes that need no actor. The payload is what the receiving
|
|
44
|
+
* backend authenticates as, so it must be re-signed whenever it changes.
|
|
33
45
|
*/
|
|
34
|
-
static createSessionPayload(): string;
|
|
46
|
+
static createSessionPayload(user?: DirectTransportPrincipal | null): string;
|
|
35
47
|
constructor(defaultBaseUrl: string, sessionPayload: string, sessionSignature: string, routes?: DirectTransportRoute[]);
|
|
36
48
|
request<T>(action: string, parameters?: Parameters, method?: string, _signWithOauthToken?: boolean): Promise<T>;
|
|
37
49
|
private resolveClient;
|
|
@@ -25,12 +25,16 @@ export class DirectTransport {
|
|
|
25
25
|
sortedRoutes;
|
|
26
26
|
parseErrorHandler = null;
|
|
27
27
|
/**
|
|
28
|
-
* Creates the
|
|
28
|
+
* Creates the session payload for internal service-to-service calls.
|
|
29
|
+
*
|
|
30
|
+
* Pass `user` when the call reaches resources an access policy guards (typically the platform
|
|
31
|
+
* SYSTEM user); omit it only for routes that need no actor. The payload is what the receiving
|
|
32
|
+
* backend authenticates as, so it must be re-signed whenever it changes.
|
|
29
33
|
*/
|
|
30
|
-
static createSessionPayload() {
|
|
34
|
+
static createSessionPayload(user = null) {
|
|
31
35
|
return JSON.stringify({
|
|
32
36
|
api_version: 'latest',
|
|
33
|
-
user:
|
|
37
|
+
user: user,
|
|
34
38
|
client: null,
|
|
35
39
|
ip: 'internal',
|
|
36
40
|
roles: [],
|
package/dist/index.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export { HttpClientRequest } from './Http/HttpClientRequest.js';
|
|
|
9
9
|
export { HttpClientResponse } from './Http/HttpClientResponse.js';
|
|
10
10
|
export { ITransport } from './Http/Transport/ITransport.js';
|
|
11
11
|
export { DirectTransport } from './Http/Transport/DirectTransport.js';
|
|
12
|
-
export type { DirectTransportRoute } from './Http/Transport/DirectTransport.js';
|
|
12
|
+
export type { DirectTransportRoute, DirectTransportPrincipal } from './Http/Transport/DirectTransport.js';
|
|
13
13
|
export { OAuthClient } from './Http/Transport/OAuthClient.js';
|
|
14
14
|
export { OAuthClientOptions } from './Http/OAuthClientOptions.js';
|
|
15
15
|
export { OAuthClientToken } from './Http/OAuthClientToken.js';
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "1.
|
|
1
|
+
export declare const VERSION = "1.101.0";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "1.
|
|
1
|
+
export const VERSION = "1.101.0";
|