@flowcore/sdk 1.64.2 → 1.65.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/CHANGELOG.md +17 -0
- package/esm/commands/user/user.initialize-in-keycloak.d.ts +34 -10
- package/esm/commands/user/user.initialize-in-keycloak.d.ts.map +1 -1
- package/esm/commands/user/user.initialize-in-keycloak.js +41 -22
- package/package.json +1 -1
- package/script/commands/user/user.initialize-in-keycloak.d.ts +34 -10
- package/script/commands/user/user.initialize-in-keycloak.d.ts.map +1 -1
- package/script/commands/user/user.initialize-in-keycloak.js +41 -22
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.65.0](https://github.com/flowcore-io/flowcore-sdk/compare/v1.64.3...v1.65.0) (2026-01-09)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* update UserInitializeInKeycloakCommand to use new response stru… ([361d377](https://github.com/flowcore-io/flowcore-sdk/commit/361d37741c34ea2207ca9c9dc4431fb389df8ce6))
|
|
9
|
+
* update UserInitializeInKeycloakCommand to use new response structure and API endpoint ([0aa16a4](https://github.com/flowcore-io/flowcore-sdk/commit/0aa16a498c8ed20db881e1d227d5681410a9dfef))
|
|
10
|
+
|
|
11
|
+
## [1.64.3](https://github.com/flowcore-io/flowcore-sdk/compare/v1.64.2...v1.64.3) (2025-12-19)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
* include user ID in Keycloak initialization query ([c6c3f11](https://github.com/flowcore-io/flowcore-sdk/commit/c6c3f1181068a3c1fbd8164e890c3d00df1f5d4c))
|
|
17
|
+
* include user ID in Keycloak initialization query ([6e11cdf](https://github.com/flowcore-io/flowcore-sdk/commit/6e11cdfa2784f4cac0a32b6ea7ce5c265d733747))
|
|
18
|
+
* update user initialization to include user ID in response structure ([4bbb1ad](https://github.com/flowcore-io/flowcore-sdk/commit/4bbb1ad1c4e61969db0c3cef43da15215c658411))
|
|
19
|
+
|
|
3
20
|
## [1.64.2](https://github.com/flowcore-io/flowcore-sdk/compare/v1.64.1...v1.64.2) (2025-12-18)
|
|
4
21
|
|
|
5
22
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Command } from "../../common/command.js";
|
|
2
|
+
import type { Static, TObject, TString } from "@sinclair/typebox";
|
|
2
3
|
/**
|
|
3
4
|
* The input for initializing user in Keycloak
|
|
4
5
|
* No input parameters needed - checks current authenticated user
|
|
@@ -6,19 +7,41 @@ import { GraphQlCommand } from "../../common/command-graphql.js";
|
|
|
6
7
|
export type UserInitializeInKeycloakInput = Record<PropertyKey, never>;
|
|
7
8
|
/**
|
|
8
9
|
* The output for initializing user in Keycloak
|
|
10
|
+
* (matches the REST API response)
|
|
9
11
|
*/
|
|
10
|
-
export
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
export type UserInitializeInKeycloakOutput = Static<typeof responseSchema>;
|
|
13
|
+
declare const responseSchema: TObject<{
|
|
14
|
+
id: TString;
|
|
15
|
+
username: TString;
|
|
16
|
+
email: TString;
|
|
17
|
+
firstName: TString;
|
|
18
|
+
lastName: TString;
|
|
19
|
+
}>;
|
|
16
20
|
/**
|
|
17
|
-
*
|
|
21
|
+
* Finalize user initialization by setting Flowcore User ID in Keycloak.
|
|
22
|
+
*
|
|
23
|
+
* Calls `POST /api/users` on the user service with an empty JSON body.
|
|
24
|
+
* Requires a bearer token.
|
|
18
25
|
*/
|
|
19
|
-
export declare class UserInitializeInKeycloakCommand extends
|
|
26
|
+
export declare class UserInitializeInKeycloakCommand extends Command<UserInitializeInKeycloakInput, UserInitializeInKeycloakOutput> {
|
|
27
|
+
/**
|
|
28
|
+
* The allowed modes for the command
|
|
29
|
+
*/
|
|
30
|
+
protected allowedModes: ("apiKey" | "bearer")[];
|
|
31
|
+
/**
|
|
32
|
+
* Get the base URL for the request
|
|
33
|
+
*/
|
|
34
|
+
protected getBaseUrl(): string;
|
|
35
|
+
/**
|
|
36
|
+
* Get the method
|
|
37
|
+
*/
|
|
38
|
+
protected getMethod(): string;
|
|
39
|
+
/**
|
|
40
|
+
* Get the path for the request
|
|
41
|
+
*/
|
|
42
|
+
protected getPath(): string;
|
|
20
43
|
/**
|
|
21
|
-
* Get the body for the request
|
|
44
|
+
* Get the body for the request (must be an empty JSON object)
|
|
22
45
|
*/
|
|
23
46
|
protected getBody(): Record<string, unknown>;
|
|
24
47
|
/**
|
|
@@ -26,4 +49,5 @@ export declare class UserInitializeInKeycloakCommand extends GraphQlCommand<User
|
|
|
26
49
|
*/
|
|
27
50
|
protected parseResponse(rawResponse: unknown): UserInitializeInKeycloakOutput;
|
|
28
51
|
}
|
|
52
|
+
export {};
|
|
29
53
|
//# sourceMappingURL=user.initialize-in-keycloak.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user.initialize-in-keycloak.d.ts","sourceRoot":"","sources":["../../../src/commands/user/user.initialize-in-keycloak.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"user.initialize-in-keycloak.d.ts","sourceRoot":"","sources":["../../../src/commands/user/user.initialize-in-keycloak.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AAEjD,OAAO,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAEjE;;;GAGG;AACH,MAAM,MAAM,6BAA6B,GAAG,MAAM,CAAC,WAAW,EAAE,KAAK,CAAC,CAAA;AAEtE;;;GAGG;AACH,MAAM,MAAM,8BAA8B,GAAG,MAAM,CAAC,OAAO,cAAc,CAAC,CAAA;AAE1E,QAAA,MAAM,cAAc,EAAE,OAAO,CAAC;IAC5B,EAAE,EAAE,OAAO,CAAA;IACX,QAAQ,EAAE,OAAO,CAAA;IACjB,KAAK,EAAE,OAAO,CAAA;IACd,SAAS,EAAE,OAAO,CAAA;IAClB,QAAQ,EAAE,OAAO,CAAA;CAClB,CAMC,CAAA;AAEF;;;;;GAKG;AACH,qBAAa,+BAAgC,SAAQ,OAAO,CAC1D,6BAA6B,EAC7B,8BAA8B,CAC/B;IACC;;OAEG;IACH,UAAmB,YAAY,EAAE,CAAC,QAAQ,GAAG,QAAQ,CAAC,EAAE,CAAa;IAErE;;OAEG;cACgB,UAAU,IAAI,MAAM;IAIvC;;OAEG;cACgB,SAAS,IAAI,MAAM;IAItC;;OAEG;cACgB,OAAO,IAAI,MAAM;IAIpC;;OAEG;cACgB,OAAO,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAMrD;;OAEG;cACgB,aAAa,CAAC,WAAW,EAAE,OAAO,GAAG,8BAA8B;CAIvF"}
|
|
@@ -1,36 +1,55 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { Type } from "@sinclair/typebox";
|
|
2
|
+
import { Command } from "../../common/command.js";
|
|
3
|
+
import { parseResponseHelper } from "../../utils/parse-response-helper.js";
|
|
4
|
+
const responseSchema = Type.Object({
|
|
5
|
+
id: Type.String(),
|
|
6
|
+
username: Type.String(),
|
|
7
|
+
email: Type.String(),
|
|
8
|
+
firstName: Type.String(),
|
|
9
|
+
lastName: Type.String(),
|
|
10
|
+
});
|
|
8
11
|
/**
|
|
9
|
-
*
|
|
12
|
+
* Finalize user initialization by setting Flowcore User ID in Keycloak.
|
|
13
|
+
*
|
|
14
|
+
* Calls `POST /api/users` on the user service with an empty JSON body.
|
|
15
|
+
* Requires a bearer token.
|
|
10
16
|
*/
|
|
11
|
-
export class UserInitializeInKeycloakCommand extends
|
|
17
|
+
export class UserInitializeInKeycloakCommand extends Command {
|
|
18
|
+
/**
|
|
19
|
+
* The allowed modes for the command
|
|
20
|
+
*/
|
|
21
|
+
allowedModes = ["bearer"];
|
|
22
|
+
/**
|
|
23
|
+
* Get the base URL for the request
|
|
24
|
+
*/
|
|
25
|
+
getBaseUrl() {
|
|
26
|
+
return "https://user-2.api.flowcore.io";
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Get the method
|
|
30
|
+
*/
|
|
31
|
+
getMethod() {
|
|
32
|
+
return "POST";
|
|
33
|
+
}
|
|
12
34
|
/**
|
|
13
|
-
* Get the
|
|
35
|
+
* Get the path for the request
|
|
36
|
+
*/
|
|
37
|
+
getPath() {
|
|
38
|
+
return "/api/users";
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Get the body for the request (must be an empty JSON object)
|
|
14
42
|
*/
|
|
15
43
|
getBody() {
|
|
16
44
|
return {
|
|
17
|
-
|
|
18
|
-
variables: {},
|
|
45
|
+
// intentionally empty
|
|
19
46
|
};
|
|
20
47
|
}
|
|
21
48
|
/**
|
|
22
49
|
* Parse the response
|
|
23
50
|
*/
|
|
24
51
|
parseResponse(rawResponse) {
|
|
25
|
-
const response = rawResponse;
|
|
26
|
-
|
|
27
|
-
throw new InvalidResponseException(response.errors.map((e) => e.message).join(", "), { graphql: response.errors.map((e) => e.message).join(", ") });
|
|
28
|
-
}
|
|
29
|
-
// If me exists and is not null i.e. flowcore_user_id is not null, user is initialized
|
|
30
|
-
const isInitialized = response.data?.me !== null && response.data?.me !== undefined;
|
|
31
|
-
return {
|
|
32
|
-
isInitialized,
|
|
33
|
-
me: response.data?.me,
|
|
34
|
-
};
|
|
52
|
+
const response = parseResponseHelper(responseSchema, rawResponse);
|
|
53
|
+
return response;
|
|
35
54
|
}
|
|
36
55
|
}
|
package/package.json
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Command } from "../../common/command.js";
|
|
2
|
+
import type { Static, TObject, TString } from "@sinclair/typebox";
|
|
2
3
|
/**
|
|
3
4
|
* The input for initializing user in Keycloak
|
|
4
5
|
* No input parameters needed - checks current authenticated user
|
|
@@ -6,19 +7,41 @@ import { GraphQlCommand } from "../../common/command-graphql.js";
|
|
|
6
7
|
export type UserInitializeInKeycloakInput = Record<PropertyKey, never>;
|
|
7
8
|
/**
|
|
8
9
|
* The output for initializing user in Keycloak
|
|
10
|
+
* (matches the REST API response)
|
|
9
11
|
*/
|
|
10
|
-
export
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
export type UserInitializeInKeycloakOutput = Static<typeof responseSchema>;
|
|
13
|
+
declare const responseSchema: TObject<{
|
|
14
|
+
id: TString;
|
|
15
|
+
username: TString;
|
|
16
|
+
email: TString;
|
|
17
|
+
firstName: TString;
|
|
18
|
+
lastName: TString;
|
|
19
|
+
}>;
|
|
16
20
|
/**
|
|
17
|
-
*
|
|
21
|
+
* Finalize user initialization by setting Flowcore User ID in Keycloak.
|
|
22
|
+
*
|
|
23
|
+
* Calls `POST /api/users` on the user service with an empty JSON body.
|
|
24
|
+
* Requires a bearer token.
|
|
18
25
|
*/
|
|
19
|
-
export declare class UserInitializeInKeycloakCommand extends
|
|
26
|
+
export declare class UserInitializeInKeycloakCommand extends Command<UserInitializeInKeycloakInput, UserInitializeInKeycloakOutput> {
|
|
27
|
+
/**
|
|
28
|
+
* The allowed modes for the command
|
|
29
|
+
*/
|
|
30
|
+
protected allowedModes: ("apiKey" | "bearer")[];
|
|
31
|
+
/**
|
|
32
|
+
* Get the base URL for the request
|
|
33
|
+
*/
|
|
34
|
+
protected getBaseUrl(): string;
|
|
35
|
+
/**
|
|
36
|
+
* Get the method
|
|
37
|
+
*/
|
|
38
|
+
protected getMethod(): string;
|
|
39
|
+
/**
|
|
40
|
+
* Get the path for the request
|
|
41
|
+
*/
|
|
42
|
+
protected getPath(): string;
|
|
20
43
|
/**
|
|
21
|
-
* Get the body for the request
|
|
44
|
+
* Get the body for the request (must be an empty JSON object)
|
|
22
45
|
*/
|
|
23
46
|
protected getBody(): Record<string, unknown>;
|
|
24
47
|
/**
|
|
@@ -26,4 +49,5 @@ export declare class UserInitializeInKeycloakCommand extends GraphQlCommand<User
|
|
|
26
49
|
*/
|
|
27
50
|
protected parseResponse(rawResponse: unknown): UserInitializeInKeycloakOutput;
|
|
28
51
|
}
|
|
52
|
+
export {};
|
|
29
53
|
//# sourceMappingURL=user.initialize-in-keycloak.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user.initialize-in-keycloak.d.ts","sourceRoot":"","sources":["../../../src/commands/user/user.initialize-in-keycloak.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"user.initialize-in-keycloak.d.ts","sourceRoot":"","sources":["../../../src/commands/user/user.initialize-in-keycloak.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AAEjD,OAAO,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAEjE;;;GAGG;AACH,MAAM,MAAM,6BAA6B,GAAG,MAAM,CAAC,WAAW,EAAE,KAAK,CAAC,CAAA;AAEtE;;;GAGG;AACH,MAAM,MAAM,8BAA8B,GAAG,MAAM,CAAC,OAAO,cAAc,CAAC,CAAA;AAE1E,QAAA,MAAM,cAAc,EAAE,OAAO,CAAC;IAC5B,EAAE,EAAE,OAAO,CAAA;IACX,QAAQ,EAAE,OAAO,CAAA;IACjB,KAAK,EAAE,OAAO,CAAA;IACd,SAAS,EAAE,OAAO,CAAA;IAClB,QAAQ,EAAE,OAAO,CAAA;CAClB,CAMC,CAAA;AAEF;;;;;GAKG;AACH,qBAAa,+BAAgC,SAAQ,OAAO,CAC1D,6BAA6B,EAC7B,8BAA8B,CAC/B;IACC;;OAEG;IACH,UAAmB,YAAY,EAAE,CAAC,QAAQ,GAAG,QAAQ,CAAC,EAAE,CAAa;IAErE;;OAEG;cACgB,UAAU,IAAI,MAAM;IAIvC;;OAEG;cACgB,SAAS,IAAI,MAAM;IAItC;;OAEG;cACgB,OAAO,IAAI,MAAM;IAIpC;;OAEG;cACgB,OAAO,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAMrD;;OAEG;cACgB,aAAa,CAAC,WAAW,EAAE,OAAO,GAAG,8BAA8B;CAIvF"}
|
|
@@ -1,40 +1,59 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.UserInitializeInKeycloakCommand = void 0;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
const typebox_1 = require("@sinclair/typebox");
|
|
5
|
+
const command_js_1 = require("../../common/command.js");
|
|
6
|
+
const parse_response_helper_js_1 = require("../../utils/parse-response-helper.js");
|
|
7
|
+
const responseSchema = typebox_1.Type.Object({
|
|
8
|
+
id: typebox_1.Type.String(),
|
|
9
|
+
username: typebox_1.Type.String(),
|
|
10
|
+
email: typebox_1.Type.String(),
|
|
11
|
+
firstName: typebox_1.Type.String(),
|
|
12
|
+
lastName: typebox_1.Type.String(),
|
|
13
|
+
});
|
|
11
14
|
/**
|
|
12
|
-
*
|
|
15
|
+
* Finalize user initialization by setting Flowcore User ID in Keycloak.
|
|
16
|
+
*
|
|
17
|
+
* Calls `POST /api/users` on the user service with an empty JSON body.
|
|
18
|
+
* Requires a bearer token.
|
|
13
19
|
*/
|
|
14
|
-
class UserInitializeInKeycloakCommand extends
|
|
20
|
+
class UserInitializeInKeycloakCommand extends command_js_1.Command {
|
|
21
|
+
/**
|
|
22
|
+
* The allowed modes for the command
|
|
23
|
+
*/
|
|
24
|
+
allowedModes = ["bearer"];
|
|
25
|
+
/**
|
|
26
|
+
* Get the base URL for the request
|
|
27
|
+
*/
|
|
28
|
+
getBaseUrl() {
|
|
29
|
+
return "https://user-2.api.flowcore.io";
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Get the method
|
|
33
|
+
*/
|
|
34
|
+
getMethod() {
|
|
35
|
+
return "POST";
|
|
36
|
+
}
|
|
15
37
|
/**
|
|
16
|
-
* Get the
|
|
38
|
+
* Get the path for the request
|
|
39
|
+
*/
|
|
40
|
+
getPath() {
|
|
41
|
+
return "/api/users";
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Get the body for the request (must be an empty JSON object)
|
|
17
45
|
*/
|
|
18
46
|
getBody() {
|
|
19
47
|
return {
|
|
20
|
-
|
|
21
|
-
variables: {},
|
|
48
|
+
// intentionally empty
|
|
22
49
|
};
|
|
23
50
|
}
|
|
24
51
|
/**
|
|
25
52
|
* Parse the response
|
|
26
53
|
*/
|
|
27
54
|
parseResponse(rawResponse) {
|
|
28
|
-
const response = rawResponse;
|
|
29
|
-
|
|
30
|
-
throw new invalid_response_js_1.InvalidResponseException(response.errors.map((e) => e.message).join(", "), { graphql: response.errors.map((e) => e.message).join(", ") });
|
|
31
|
-
}
|
|
32
|
-
// If me exists and is not null i.e. flowcore_user_id is not null, user is initialized
|
|
33
|
-
const isInitialized = response.data?.me !== null && response.data?.me !== undefined;
|
|
34
|
-
return {
|
|
35
|
-
isInitialized,
|
|
36
|
-
me: response.data?.me,
|
|
37
|
-
};
|
|
55
|
+
const response = (0, parse_response_helper_js_1.parseResponseHelper)(responseSchema, rawResponse);
|
|
56
|
+
return response;
|
|
38
57
|
}
|
|
39
58
|
}
|
|
40
59
|
exports.UserInitializeInKeycloakCommand = UserInitializeInKeycloakCommand;
|