@attlaz/client 1.100.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.
- package/dist/Http/Transport/DirectTransport.d.ts +14 -2
- package/dist/Http/Transport/DirectTransport.js +7 -3
- package/dist/Model/User/PasswordCheck.d.ts +13 -2
- package/dist/Model/User/PasswordCheck.js +20 -3
- package/dist/Service/UserEndpoint.js +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
|
@@ -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: [],
|
|
@@ -17,6 +17,17 @@ export declare class PasswordCheck {
|
|
|
17
17
|
* Treat it as a display hint, not a policy: the server owns the threshold, and a low score with
|
|
18
18
|
* `code === null` still means accepted.
|
|
19
19
|
*/
|
|
20
|
-
strength:
|
|
21
|
-
|
|
20
|
+
strength: PasswordStrength | null;
|
|
21
|
+
}
|
|
22
|
+
export type PasswordStrength = 0 | 1 | 2 | 3 | 4;
|
|
23
|
+
export declare namespace PasswordStrength {
|
|
24
|
+
/**
|
|
25
|
+
* Throws on anything outside 0–4, rather than degrading to null.
|
|
26
|
+
*
|
|
27
|
+
* Null does not mean "unknown" here — it means the password was refused before it could be
|
|
28
|
+
* scored, and a caller may rely on that: a strength of null with no code is a state the API never
|
|
29
|
+
* produces. Mapping an unexpected number to null would fabricate exactly that combination.
|
|
30
|
+
* Throwing surfaces as a failed check, which callers already handle.
|
|
31
|
+
*/
|
|
32
|
+
const fromRaw: (input: unknown) => PasswordStrength | null;
|
|
22
33
|
}
|
|
@@ -11,7 +11,24 @@ export class PasswordCheck {
|
|
|
11
11
|
* `code === null` still means accepted.
|
|
12
12
|
*/
|
|
13
13
|
strength = null;
|
|
14
|
-
isAcceptable() {
|
|
15
|
-
return this.code === null;
|
|
16
|
-
}
|
|
17
14
|
}
|
|
15
|
+
export var PasswordStrength;
|
|
16
|
+
(function (PasswordStrength) {
|
|
17
|
+
/**
|
|
18
|
+
* Throws on anything outside 0–4, rather than degrading to null.
|
|
19
|
+
*
|
|
20
|
+
* Null does not mean "unknown" here — it means the password was refused before it could be
|
|
21
|
+
* scored, and a caller may rely on that: a strength of null with no code is a state the API never
|
|
22
|
+
* produces. Mapping an unexpected number to null would fabricate exactly that combination.
|
|
23
|
+
* Throwing surfaces as a failed check, which callers already handle.
|
|
24
|
+
*/
|
|
25
|
+
PasswordStrength.fromRaw = (input) => {
|
|
26
|
+
if (input === null || input === undefined) {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
if (input === 0 || input === 1 || input === 2 || input === 3 || input === 4) {
|
|
30
|
+
return input;
|
|
31
|
+
}
|
|
32
|
+
throw new Error('Unable to parse PasswordStrength: expected 0-4 or null, got "' + String(input) + '"');
|
|
33
|
+
};
|
|
34
|
+
})(PasswordStrength || (PasswordStrength = {}));
|
|
@@ -2,7 +2,7 @@ import { path } from '../Http/Data/Path.js';
|
|
|
2
2
|
import { UserAuthProvider } from '../Model/User/UserAuthProvider.js';
|
|
3
3
|
import { User } from '../Model/User/User.js';
|
|
4
4
|
import { UserSummary } from '../Model/User/UserSummary.js';
|
|
5
|
-
import { PasswordCheck } from '../Model/User/PasswordCheck.js';
|
|
5
|
+
import { PasswordCheck, PasswordStrength } from '../Model/User/PasswordCheck.js';
|
|
6
6
|
import { Endpoint } from './Endpoint.js';
|
|
7
7
|
import { UserNotificationSession } from '../Model/User/UserNotificationSession.js';
|
|
8
8
|
import { QueryString } from '../Http/Data/QueryString.js';
|
|
@@ -149,7 +149,7 @@ export class UserEndpoint extends Endpoint {
|
|
|
149
149
|
const check = new PasswordCheck();
|
|
150
150
|
check.code = (raw.code ?? null);
|
|
151
151
|
check.error = (raw.error ?? null);
|
|
152
|
-
check.strength = (raw.strength
|
|
152
|
+
check.strength = PasswordStrength.fromRaw(raw.strength);
|
|
153
153
|
return check;
|
|
154
154
|
}
|
|
155
155
|
async resetPassword(code, password) {
|
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';
|
|
@@ -210,7 +210,7 @@ export type { UserActionFilter } from './Model/User/UserActionFilter.js';
|
|
|
210
210
|
export { UserSummary } from './Model/User/UserSummary.js';
|
|
211
211
|
export type { UserSummaryType } from './Model/User/UserSummary.js';
|
|
212
212
|
export { PasswordCheck } from './Model/User/PasswordCheck.js';
|
|
213
|
-
export type { PasswordCheckCode } from './Model/User/PasswordCheck.js';
|
|
213
|
+
export type { PasswordCheckCode, PasswordStrength } from './Model/User/PasswordCheck.js';
|
|
214
214
|
export { RunnerImage } from './Model/Runner/RunnerImage.js';
|
|
215
215
|
export { Component } from './Model/Component/Component.js';
|
|
216
216
|
export { ComponentKind } from './Model/Component/ComponentKind.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";
|