@tak-ps/node-tak 12.29.0 → 12.31.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 +9 -1
- package/dist/lib/api/mission-property.d.ts +65 -0
- package/dist/lib/api/mission-property.js +114 -0
- package/dist/lib/api/mission-property.js.map +1 -0
- package/dist/lib/api/user-management.d.ts +168 -0
- package/dist/lib/api/user-management.js +296 -0
- package/dist/lib/api/user-management.js.map +1 -0
- package/dist/lib/api.d.ts +5 -1
- package/dist/lib/api.js +10 -2
- package/dist/lib/api.js.map +1 -1
- package/dist/test/mission-property.test.d.ts +1 -0
- package/dist/test/mission-property.test.js +73 -0
- package/dist/test/mission-property.test.js.map +1 -0
- package/dist/test/user-management.test.d.ts +1 -0
- package/dist/test/user-management.test.js +158 -0
- package/dist/test/user-management.test.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/lib/api/mission-property.ts +155 -0
- package/lib/api/user-management.ts +326 -0
- package/lib/api.ts +11 -1
- package/package.json +1 -1
- package/test/mission-property.test.ts +95 -0
- package/test/user-management.test.ts +207 -0
package/CHANGELOG.md
CHANGED
|
@@ -12,9 +12,17 @@
|
|
|
12
12
|
|
|
13
13
|
### Pending
|
|
14
14
|
|
|
15
|
+
### v12.31.0 - 2026-09-29
|
|
16
|
+
|
|
17
|
+
- :tada: Add `MissionProperty` API module for TAK Server 5.9+ Mission key/value properties (`list` with optional `prefix`, `get`, `set` (upsert), `delete`, `deleteAll`)
|
|
18
|
+
|
|
19
|
+
### v12.30.0 - 2026-09-04
|
|
20
|
+
|
|
21
|
+
- :tada: Add `UserManagement` API module & `tak user-management` CLI command implementing the File User Account Management API (`createUser`, `createUsers`, `listUsers`, `userGroups`, `changePassword`, `updateUserGroups`, `updateGroupUsers`, `deleteUser`, `listGroups`, `groupUsers`)
|
|
22
|
+
|
|
15
23
|
### v12.29.0 - 2026-09-03
|
|
16
24
|
|
|
17
|
-
- :tada: `Files.upload()` accepts an optional `uid` to set the UID metadata of the uploaded file
|
|
25
|
+
- :tada: `Files.upload()` accepts an optional `uid` to set the UID metadata of the uploaded file
|
|
18
26
|
|
|
19
27
|
### v12.28.0 - 2026-08-28
|
|
20
28
|
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { Static } from '@sinclair/typebox';
|
|
2
|
+
import type { MissionOptions } from './mission.js';
|
|
3
|
+
import Commands from '../commands.js';
|
|
4
|
+
export declare const MissionProperty: import("@sinclair/typebox").TObject<{
|
|
5
|
+
key: import("@sinclair/typebox").TString;
|
|
6
|
+
value: import("@sinclair/typebox").TString;
|
|
7
|
+
}>;
|
|
8
|
+
export declare const MissionPropertyListInput: import("@sinclair/typebox").TObject<{
|
|
9
|
+
prefix: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
10
|
+
}>;
|
|
11
|
+
export declare const SetMissionProperty: import("@sinclair/typebox").TObject<{
|
|
12
|
+
key: import("@sinclair/typebox").TString;
|
|
13
|
+
value: import("@sinclair/typebox").TString;
|
|
14
|
+
creatorUid: import("@sinclair/typebox").TString;
|
|
15
|
+
}>;
|
|
16
|
+
export declare const TAKItem_MissionProperty: import("@sinclair/typebox").TObject<{
|
|
17
|
+
version: import("@sinclair/typebox").TString;
|
|
18
|
+
type: import("@sinclair/typebox").TString;
|
|
19
|
+
data: import("@sinclair/typebox").TObject<{
|
|
20
|
+
key: import("@sinclair/typebox").TString;
|
|
21
|
+
value: import("@sinclair/typebox").TString;
|
|
22
|
+
}>;
|
|
23
|
+
messages: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
|
|
24
|
+
nodeId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
25
|
+
}>;
|
|
26
|
+
export declare const TAKList_MissionProperty: import("@sinclair/typebox").TObject<{
|
|
27
|
+
version: import("@sinclair/typebox").TString;
|
|
28
|
+
type: import("@sinclair/typebox").TString;
|
|
29
|
+
data: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
|
|
30
|
+
key: import("@sinclair/typebox").TString;
|
|
31
|
+
value: import("@sinclair/typebox").TString;
|
|
32
|
+
}>>;
|
|
33
|
+
messages: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
|
|
34
|
+
nodeId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
35
|
+
}>;
|
|
36
|
+
/**
|
|
37
|
+
* Key/Value properties stored on a Mission Sync
|
|
38
|
+
*
|
|
39
|
+
* Requires TAK Server 5.9 or later
|
|
40
|
+
*/
|
|
41
|
+
export default class MissionPropertyCommands extends Commands {
|
|
42
|
+
#private;
|
|
43
|
+
schema: {};
|
|
44
|
+
cli(): Promise<object | string>;
|
|
45
|
+
/**
|
|
46
|
+
* List properties on a Mission Sync, optionally filtered by key prefix
|
|
47
|
+
*/
|
|
48
|
+
list(mission: string, query?: Static<typeof MissionPropertyListInput>, opts?: Static<typeof MissionOptions>): Promise<Static<typeof TAKList_MissionProperty>>;
|
|
49
|
+
/**
|
|
50
|
+
* Get a single property on a Mission Sync
|
|
51
|
+
*/
|
|
52
|
+
get(mission: string, key: string, opts?: Static<typeof MissionOptions>): Promise<Static<typeof TAKItem_MissionProperty>>;
|
|
53
|
+
/**
|
|
54
|
+
* Create or update (upsert) a property on a Mission Sync
|
|
55
|
+
*/
|
|
56
|
+
set(mission: string, body: Static<typeof SetMissionProperty>, opts?: Static<typeof MissionOptions>): Promise<Static<typeof TAKItem_MissionProperty>>;
|
|
57
|
+
/**
|
|
58
|
+
* Delete a single property on a Mission Sync
|
|
59
|
+
*/
|
|
60
|
+
delete(mission: string, key: string, creatorUid: string, opts?: Static<typeof MissionOptions>): Promise<void>;
|
|
61
|
+
/**
|
|
62
|
+
* Delete all properties on a Mission Sync
|
|
63
|
+
*/
|
|
64
|
+
deleteAll(mission: string, creatorUid: string, opts?: Static<typeof MissionOptions>): Promise<void>;
|
|
65
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { Type } from '@sinclair/typebox';
|
|
2
|
+
import { TAKItem, TAKList } from './types.js';
|
|
3
|
+
import Commands from '../commands.js';
|
|
4
|
+
import { GUIDMatch } from './mission.js';
|
|
5
|
+
export const MissionProperty = Type.Object({
|
|
6
|
+
key: Type.String(),
|
|
7
|
+
value: Type.String()
|
|
8
|
+
});
|
|
9
|
+
export const MissionPropertyListInput = Type.Object({
|
|
10
|
+
prefix: Type.Optional(Type.String({
|
|
11
|
+
description: 'Only return properties whose key starts with this prefix'
|
|
12
|
+
}))
|
|
13
|
+
});
|
|
14
|
+
export const SetMissionProperty = Type.Object({
|
|
15
|
+
key: Type.String(),
|
|
16
|
+
value: Type.String(),
|
|
17
|
+
creatorUid: Type.String()
|
|
18
|
+
});
|
|
19
|
+
export const TAKItem_MissionProperty = TAKItem(MissionProperty);
|
|
20
|
+
export const TAKList_MissionProperty = TAKList(MissionProperty);
|
|
21
|
+
/**
|
|
22
|
+
* Key/Value properties stored on a Mission Sync
|
|
23
|
+
*
|
|
24
|
+
* Requires TAK Server 5.9 or later
|
|
25
|
+
*/
|
|
26
|
+
export default class MissionPropertyCommands extends Commands {
|
|
27
|
+
schema = {};
|
|
28
|
+
async cli() {
|
|
29
|
+
throw new Error('Unsupported Subcommand');
|
|
30
|
+
}
|
|
31
|
+
#headers(opts) {
|
|
32
|
+
if (opts && opts.token) {
|
|
33
|
+
return {
|
|
34
|
+
MissionAuthorization: `Bearer ${opts.token}`
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
return {};
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Property endpoints are only exposed by GUID, resolve a Mission name if needed
|
|
43
|
+
*/
|
|
44
|
+
async #guid(mission, opts) {
|
|
45
|
+
if (GUIDMatch.test(mission))
|
|
46
|
+
return mission;
|
|
47
|
+
return (await this.api.Mission.get(mission, {}, opts)).guid;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* List properties on a Mission Sync, optionally filtered by key prefix
|
|
51
|
+
*/
|
|
52
|
+
async list(mission, query = {}, opts) {
|
|
53
|
+
const guid = await this.#guid(mission, opts);
|
|
54
|
+
const url = new URL(`/Marti/api/missions/guid/${encodeURIComponent(guid)}/properties`, this.api.url);
|
|
55
|
+
if (query.prefix !== undefined)
|
|
56
|
+
url.searchParams.append('prefix', query.prefix);
|
|
57
|
+
return await this.api.fetch(url, {
|
|
58
|
+
method: 'GET',
|
|
59
|
+
headers: this.#headers(opts)
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Get a single property on a Mission Sync
|
|
64
|
+
*/
|
|
65
|
+
async get(mission, key, opts) {
|
|
66
|
+
const guid = await this.#guid(mission, opts);
|
|
67
|
+
const url = new URL(`/Marti/api/missions/guid/${encodeURIComponent(guid)}/properties/${encodeURIComponent(key)}`, this.api.url);
|
|
68
|
+
return await this.api.fetch(url, {
|
|
69
|
+
method: 'GET',
|
|
70
|
+
headers: this.#headers(opts)
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Create or update (upsert) a property on a Mission Sync
|
|
75
|
+
*/
|
|
76
|
+
async set(mission, body, opts) {
|
|
77
|
+
const guid = await this.#guid(mission, opts);
|
|
78
|
+
const url = new URL(`/Marti/api/missions/guid/${encodeURIComponent(guid)}/properties`, this.api.url);
|
|
79
|
+
url.searchParams.append('creatorUid', body.creatorUid);
|
|
80
|
+
return await this.api.fetch(url, {
|
|
81
|
+
method: 'PUT',
|
|
82
|
+
headers: this.#headers(opts),
|
|
83
|
+
body: {
|
|
84
|
+
key: body.key,
|
|
85
|
+
value: body.value
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Delete a single property on a Mission Sync
|
|
91
|
+
*/
|
|
92
|
+
async delete(mission, key, creatorUid, opts) {
|
|
93
|
+
const guid = await this.#guid(mission, opts);
|
|
94
|
+
const url = new URL(`/Marti/api/missions/guid/${encodeURIComponent(guid)}/properties/${encodeURIComponent(key)}`, this.api.url);
|
|
95
|
+
url.searchParams.append('creatorUid', creatorUid);
|
|
96
|
+
await this.api.fetch(url, {
|
|
97
|
+
method: 'DELETE',
|
|
98
|
+
headers: this.#headers(opts)
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Delete all properties on a Mission Sync
|
|
103
|
+
*/
|
|
104
|
+
async deleteAll(mission, creatorUid, opts) {
|
|
105
|
+
const guid = await this.#guid(mission, opts);
|
|
106
|
+
const url = new URL(`/Marti/api/missions/guid/${encodeURIComponent(guid)}/properties`, this.api.url);
|
|
107
|
+
url.searchParams.append('creatorUid', creatorUid);
|
|
108
|
+
await this.api.fetch(url, {
|
|
109
|
+
method: 'DELETE',
|
|
110
|
+
headers: this.#headers(opts)
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
//# sourceMappingURL=mission-property.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mission-property.js","sourceRoot":"","sources":["../../../lib/api/mission-property.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAU,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE9C,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,CAAC,MAAM,CAAC;IACvC,GAAG,EAAE,IAAI,CAAC,MAAM,EAAE;IAClB,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE;CACvB,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,wBAAwB,GAAG,IAAI,CAAC,MAAM,CAAC;IAChD,MAAM,EAAE,IAAI,CAAC,QAA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I,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACrG,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;QAElD,MAAM,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,EAAE;YACtB,MAAM,EAAE,QAAQ;YAChB,OAAO,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;SAC/B,CAAC,CAAC;IACP,CAAC;CACJ"}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import { Static } from '@sinclair/typebox';
|
|
2
|
+
import Commands, { CommandOutputFormat, type ParsedArgs } from '../commands.js';
|
|
3
|
+
export declare const UserManagementUsername: import("@sinclair/typebox").TObject<{
|
|
4
|
+
username: import("@sinclair/typebox").TString;
|
|
5
|
+
}>;
|
|
6
|
+
export declare const UserManagementGroupName: import("@sinclair/typebox").TObject<{
|
|
7
|
+
groupname: import("@sinclair/typebox").TString;
|
|
8
|
+
}>;
|
|
9
|
+
export declare const UserManagementNewUser: import("@sinclair/typebox").TObject<{
|
|
10
|
+
groupList: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
|
|
11
|
+
groupListIN: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
|
|
12
|
+
groupListOUT: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
|
|
13
|
+
username: import("@sinclair/typebox").TString;
|
|
14
|
+
password: import("@sinclair/typebox").TString;
|
|
15
|
+
}>;
|
|
16
|
+
export declare const UserManagementBulkUsers: import("@sinclair/typebox").TObject<{
|
|
17
|
+
groupList: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
|
|
18
|
+
groupListIN: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
|
|
19
|
+
groupListOUT: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
|
|
20
|
+
usernameExpression: import("@sinclair/typebox").TString;
|
|
21
|
+
startN: import("@sinclair/typebox").TInteger;
|
|
22
|
+
endN: import("@sinclair/typebox").TInteger;
|
|
23
|
+
}>;
|
|
24
|
+
export declare const UserManagementUserPassword: import("@sinclair/typebox").TObject<{
|
|
25
|
+
username: import("@sinclair/typebox").TString;
|
|
26
|
+
password: import("@sinclair/typebox").TString;
|
|
27
|
+
}>;
|
|
28
|
+
export declare const UserManagementUserGroups: import("@sinclair/typebox").TObject<{
|
|
29
|
+
groupList: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
|
|
30
|
+
groupListIN: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
|
|
31
|
+
groupListOUT: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
|
|
32
|
+
username: import("@sinclair/typebox").TString;
|
|
33
|
+
}>;
|
|
34
|
+
export declare const UserManagementGroupUsers: import("@sinclair/typebox").TObject<{
|
|
35
|
+
groupname: import("@sinclair/typebox").TString;
|
|
36
|
+
usersInGroupList: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
|
|
37
|
+
usersInGroupListIN: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
|
|
38
|
+
usersInGroupListOUT: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
|
|
39
|
+
}>;
|
|
40
|
+
export declare const UserManagementList_Username: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
|
|
41
|
+
username: import("@sinclair/typebox").TString;
|
|
42
|
+
}>>;
|
|
43
|
+
export declare const UserManagementList_GroupName: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
|
|
44
|
+
groupname: import("@sinclair/typebox").TString;
|
|
45
|
+
}>>;
|
|
46
|
+
export declare const UserManagementList_UserPassword: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
|
|
47
|
+
username: import("@sinclair/typebox").TString;
|
|
48
|
+
password: import("@sinclair/typebox").TString;
|
|
49
|
+
}>>;
|
|
50
|
+
export declare const UserManagementUserGroupsResponse: import("@sinclair/typebox").TObject<{
|
|
51
|
+
username: import("@sinclair/typebox").TString;
|
|
52
|
+
groupList: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
|
|
53
|
+
groupListIN: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
|
|
54
|
+
groupListOUT: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
|
|
55
|
+
}>;
|
|
56
|
+
export declare const UserManagementGroupUsersResponse: import("@sinclair/typebox").TObject<{
|
|
57
|
+
groupname: import("@sinclair/typebox").TString;
|
|
58
|
+
usersInGroupList: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
|
|
59
|
+
usersInGroupListIN: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
|
|
60
|
+
usersInGroupListOUT: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
|
|
61
|
+
}>;
|
|
62
|
+
/**
|
|
63
|
+
* Manage File (non-LDAP) User Accounts on TAK Server
|
|
64
|
+
*
|
|
65
|
+
* {@link https://docs.tak.gov/api/takserver#tag/file-user-account-management-api TAK Server Docs}.
|
|
66
|
+
*/
|
|
67
|
+
export default class UserManagementCommands extends Commands {
|
|
68
|
+
schema: {
|
|
69
|
+
'list-users': {
|
|
70
|
+
description: string;
|
|
71
|
+
params: import("@sinclair/typebox").TObject<{}>;
|
|
72
|
+
query: import("@sinclair/typebox").TObject<{}>;
|
|
73
|
+
formats: CommandOutputFormat[];
|
|
74
|
+
};
|
|
75
|
+
'list-groups': {
|
|
76
|
+
description: string;
|
|
77
|
+
params: import("@sinclair/typebox").TObject<{}>;
|
|
78
|
+
query: import("@sinclair/typebox").TObject<{}>;
|
|
79
|
+
formats: CommandOutputFormat[];
|
|
80
|
+
};
|
|
81
|
+
'user-groups': {
|
|
82
|
+
description: string;
|
|
83
|
+
params: import("@sinclair/typebox").TObject<{
|
|
84
|
+
username: import("@sinclair/typebox").TString;
|
|
85
|
+
}>;
|
|
86
|
+
query: import("@sinclair/typebox").TObject<{}>;
|
|
87
|
+
formats: CommandOutputFormat[];
|
|
88
|
+
};
|
|
89
|
+
'group-users': {
|
|
90
|
+
description: string;
|
|
91
|
+
params: import("@sinclair/typebox").TObject<{
|
|
92
|
+
group: import("@sinclair/typebox").TString;
|
|
93
|
+
}>;
|
|
94
|
+
query: import("@sinclair/typebox").TObject<{}>;
|
|
95
|
+
formats: CommandOutputFormat[];
|
|
96
|
+
};
|
|
97
|
+
'delete-user': {
|
|
98
|
+
description: string;
|
|
99
|
+
params: import("@sinclair/typebox").TObject<{
|
|
100
|
+
username: import("@sinclair/typebox").TString;
|
|
101
|
+
}>;
|
|
102
|
+
query: import("@sinclair/typebox").TObject<{}>;
|
|
103
|
+
formats: CommandOutputFormat[];
|
|
104
|
+
};
|
|
105
|
+
};
|
|
106
|
+
cli(args: ParsedArgs): Promise<object | string>;
|
|
107
|
+
/**
|
|
108
|
+
* Create a new File User
|
|
109
|
+
*
|
|
110
|
+
* {@link https://docs.tak.gov/api/takserver#tag/file-user-account-management-api/operation/createOrUpdateFileUser TAK Server Docs}.
|
|
111
|
+
*/
|
|
112
|
+
createUser(user: Static<typeof UserManagementNewUser>): Promise<void>;
|
|
113
|
+
/**
|
|
114
|
+
* Create File Users in bulk from a username expression containing `[N]`
|
|
115
|
+
* Passwords are generated by the server and only returned once
|
|
116
|
+
*
|
|
117
|
+
* {@link https://docs.tak.gov/api/takserver#tag/file-user-account-management-api/operation/createFileUsersInBulk TAK Server Docs}.
|
|
118
|
+
*/
|
|
119
|
+
createUsers(bulk: Static<typeof UserManagementBulkUsers>): Promise<Static<typeof UserManagementList_UserPassword>>;
|
|
120
|
+
/**
|
|
121
|
+
* List all File Users
|
|
122
|
+
*
|
|
123
|
+
* {@link https://docs.tak.gov/api/takserver#tag/file-user-account-management-api/operation/getAllUsers_3 TAK Server Docs}.
|
|
124
|
+
*/
|
|
125
|
+
listUsers(): Promise<Static<typeof UserManagementList_Username>>;
|
|
126
|
+
/**
|
|
127
|
+
* Get the Groups associated with a File User
|
|
128
|
+
*
|
|
129
|
+
* {@link https://docs.tak.gov/api/takserver#tag/file-user-account-management-api/operation/getGroupsForUsers TAK Server Docs}.
|
|
130
|
+
*/
|
|
131
|
+
userGroups(username: string): Promise<Static<typeof UserManagementUserGroupsResponse>>;
|
|
132
|
+
/**
|
|
133
|
+
* Change the password of a File User
|
|
134
|
+
*
|
|
135
|
+
* {@link https://docs.tak.gov/api/takserver#tag/file-user-account-management-api/operation/changeUserPassword TAK Server Docs}.
|
|
136
|
+
*/
|
|
137
|
+
changePassword(user: Static<typeof UserManagementUserPassword>): Promise<void>;
|
|
138
|
+
/**
|
|
139
|
+
* Replace the Groups associated with a File User
|
|
140
|
+
*
|
|
141
|
+
* {@link https://docs.tak.gov/api/takserver#tag/file-user-account-management-api/operation/updateGroupsForUser TAK Server Docs}.
|
|
142
|
+
*/
|
|
143
|
+
updateUserGroups(user: Static<typeof UserManagementUserGroups>): Promise<void>;
|
|
144
|
+
/**
|
|
145
|
+
* Replace the File Users associated with a Group
|
|
146
|
+
*
|
|
147
|
+
* {@link https://docs.tak.gov/api/takserver#tag/file-user-account-management-api/operation/updateUsersForGroup TAK Server Docs}.
|
|
148
|
+
*/
|
|
149
|
+
updateGroupUsers(group: Static<typeof UserManagementGroupUsers>): Promise<void>;
|
|
150
|
+
/**
|
|
151
|
+
* Delete a File User
|
|
152
|
+
*
|
|
153
|
+
* {@link https://docs.tak.gov/api/takserver#tag/file-user-account-management-api/operation/deleteUser_1 TAK Server Docs}.
|
|
154
|
+
*/
|
|
155
|
+
deleteUser(username: string): Promise<void>;
|
|
156
|
+
/**
|
|
157
|
+
* List all Group Names used by File Users
|
|
158
|
+
*
|
|
159
|
+
* {@link https://docs.tak.gov/api/takserver#tag/file-user-account-management-api/operation/getAllGroupNames TAK Server Docs}.
|
|
160
|
+
*/
|
|
161
|
+
listGroups(): Promise<Static<typeof UserManagementList_GroupName>>;
|
|
162
|
+
/**
|
|
163
|
+
* Get the File Users in a Group along with their IN/OUT/BOTH direction
|
|
164
|
+
*
|
|
165
|
+
* {@link https://docs.tak.gov/api/takserver#tag/file-user-account-management-api/operation/getUsersInGroup TAK Server Docs}.
|
|
166
|
+
*/
|
|
167
|
+
groupUsers(group: string): Promise<Static<typeof UserManagementGroupUsersResponse>>;
|
|
168
|
+
}
|
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
import { Type } from '@sinclair/typebox';
|
|
2
|
+
import Commands, { CommandOutputFormat } from '../commands.js';
|
|
3
|
+
const GroupLists = {
|
|
4
|
+
groupList: Type.Optional(Type.Array(Type.String())),
|
|
5
|
+
groupListIN: Type.Optional(Type.Array(Type.String())),
|
|
6
|
+
groupListOUT: Type.Optional(Type.Array(Type.String()))
|
|
7
|
+
};
|
|
8
|
+
export const UserManagementUsername = Type.Object({
|
|
9
|
+
username: Type.String()
|
|
10
|
+
});
|
|
11
|
+
export const UserManagementGroupName = Type.Object({
|
|
12
|
+
groupname: Type.String()
|
|
13
|
+
});
|
|
14
|
+
export const UserManagementNewUser = Type.Object({
|
|
15
|
+
username: Type.String(),
|
|
16
|
+
password: Type.String(),
|
|
17
|
+
...GroupLists
|
|
18
|
+
});
|
|
19
|
+
export const UserManagementBulkUsers = Type.Object({
|
|
20
|
+
usernameExpression: Type.String({ description: 'Username pattern containing [N] which is replaced by each integer from startN to endN' }),
|
|
21
|
+
startN: Type.Integer(),
|
|
22
|
+
endN: Type.Integer(),
|
|
23
|
+
...GroupLists
|
|
24
|
+
});
|
|
25
|
+
export const UserManagementUserPassword = Type.Object({
|
|
26
|
+
username: Type.String(),
|
|
27
|
+
password: Type.String()
|
|
28
|
+
});
|
|
29
|
+
export const UserManagementUserGroups = Type.Object({
|
|
30
|
+
username: Type.String(),
|
|
31
|
+
...GroupLists
|
|
32
|
+
});
|
|
33
|
+
export const UserManagementGroupUsers = Type.Object({
|
|
34
|
+
groupname: Type.String(),
|
|
35
|
+
usersInGroupList: Type.Optional(Type.Array(Type.String())),
|
|
36
|
+
usersInGroupListIN: Type.Optional(Type.Array(Type.String())),
|
|
37
|
+
usersInGroupListOUT: Type.Optional(Type.Array(Type.String()))
|
|
38
|
+
});
|
|
39
|
+
export const UserManagementList_Username = Type.Array(UserManagementUsername);
|
|
40
|
+
export const UserManagementList_GroupName = Type.Array(UserManagementGroupName);
|
|
41
|
+
export const UserManagementList_UserPassword = Type.Array(UserManagementUserPassword);
|
|
42
|
+
export const UserManagementUserGroupsResponse = Type.Object({
|
|
43
|
+
username: Type.String(),
|
|
44
|
+
groupList: Type.Array(Type.String()),
|
|
45
|
+
groupListIN: Type.Array(Type.String()),
|
|
46
|
+
groupListOUT: Type.Array(Type.String())
|
|
47
|
+
});
|
|
48
|
+
export const UserManagementGroupUsersResponse = Type.Object({
|
|
49
|
+
groupname: Type.String(),
|
|
50
|
+
usersInGroupList: Type.Array(Type.String()),
|
|
51
|
+
usersInGroupListIN: Type.Array(Type.String()),
|
|
52
|
+
usersInGroupListOUT: Type.Array(Type.String())
|
|
53
|
+
});
|
|
54
|
+
/**
|
|
55
|
+
* Manage File (non-LDAP) User Accounts on TAK Server
|
|
56
|
+
*
|
|
57
|
+
* {@link https://docs.tak.gov/api/takserver#tag/file-user-account-management-api TAK Server Docs}.
|
|
58
|
+
*/
|
|
59
|
+
export default class UserManagementCommands extends Commands {
|
|
60
|
+
schema = {
|
|
61
|
+
'list-users': {
|
|
62
|
+
description: 'List File Users',
|
|
63
|
+
params: Type.Object({}),
|
|
64
|
+
query: Type.Object({}),
|
|
65
|
+
formats: [CommandOutputFormat.JSON]
|
|
66
|
+
},
|
|
67
|
+
'list-groups': {
|
|
68
|
+
description: 'List Group Names used by File Users',
|
|
69
|
+
params: Type.Object({}),
|
|
70
|
+
query: Type.Object({}),
|
|
71
|
+
formats: [CommandOutputFormat.JSON]
|
|
72
|
+
},
|
|
73
|
+
'user-groups': {
|
|
74
|
+
description: 'List Groups for a given File User',
|
|
75
|
+
params: Type.Object({ username: Type.String() }),
|
|
76
|
+
query: Type.Object({}),
|
|
77
|
+
formats: [CommandOutputFormat.JSON]
|
|
78
|
+
},
|
|
79
|
+
'group-users': {
|
|
80
|
+
description: 'List File Users in a given Group',
|
|
81
|
+
params: Type.Object({ group: Type.String() }),
|
|
82
|
+
query: Type.Object({}),
|
|
83
|
+
formats: [CommandOutputFormat.JSON]
|
|
84
|
+
},
|
|
85
|
+
'delete-user': {
|
|
86
|
+
description: 'Delete a File User',
|
|
87
|
+
params: Type.Object({ username: Type.String() }),
|
|
88
|
+
query: Type.Object({}),
|
|
89
|
+
formats: [CommandOutputFormat.JSON]
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
async cli(args) {
|
|
93
|
+
if (args._[3] === 'list-users') {
|
|
94
|
+
const list = await this.listUsers();
|
|
95
|
+
if (args.format === 'json') {
|
|
96
|
+
return list;
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
return list.map((user) => user.username).join('\n');
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
else if (args._[3] === 'list-groups') {
|
|
103
|
+
const list = await this.listGroups();
|
|
104
|
+
if (args.format === 'json') {
|
|
105
|
+
return list;
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
return list.map((group) => group.groupname).join('\n');
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
else if (args._[3] === 'user-groups') {
|
|
112
|
+
if (!args._[4])
|
|
113
|
+
throw new Error('username must be provided');
|
|
114
|
+
const user = await this.userGroups(args._[4]);
|
|
115
|
+
if (args.format === 'json') {
|
|
116
|
+
return user;
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
return [
|
|
120
|
+
`${user.username}`,
|
|
121
|
+
` BOTH: ${user.groupList.join(', ')}`,
|
|
122
|
+
` IN: ${user.groupListIN.join(', ')}`,
|
|
123
|
+
` OUT: ${user.groupListOUT.join(', ')}`
|
|
124
|
+
].join('\n');
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
else if (args._[3] === 'group-users') {
|
|
128
|
+
if (!args._[4])
|
|
129
|
+
throw new Error('group must be provided');
|
|
130
|
+
const group = await this.groupUsers(args._[4]);
|
|
131
|
+
if (args.format === 'json') {
|
|
132
|
+
return group;
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
return [
|
|
136
|
+
`${group.groupname}`,
|
|
137
|
+
` BOTH: ${group.usersInGroupList.join(', ')}`,
|
|
138
|
+
` IN: ${group.usersInGroupListIN.join(', ')}`,
|
|
139
|
+
` OUT: ${group.usersInGroupListOUT.join(', ')}`
|
|
140
|
+
].join('\n');
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
else if (args._[3] === 'delete-user') {
|
|
144
|
+
if (!args._[4])
|
|
145
|
+
throw new Error('username must be provided');
|
|
146
|
+
await this.deleteUser(args._[4]);
|
|
147
|
+
return `Deleted ${args._[4]}`;
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
throw new Error('Unsupported Subcommand');
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Create a new File User
|
|
155
|
+
*
|
|
156
|
+
* {@link https://docs.tak.gov/api/takserver#tag/file-user-account-management-api/operation/createOrUpdateFileUser TAK Server Docs}.
|
|
157
|
+
*/
|
|
158
|
+
async createUser(user) {
|
|
159
|
+
const url = new URL('/Marti/api/user-management/api/new-user', this.api.url);
|
|
160
|
+
await this.api.fetch(url, {
|
|
161
|
+
method: 'POST',
|
|
162
|
+
body: {
|
|
163
|
+
username: user.username,
|
|
164
|
+
password: user.password,
|
|
165
|
+
groupList: user.groupList ?? [],
|
|
166
|
+
groupListIN: user.groupListIN ?? [],
|
|
167
|
+
groupListOUT: user.groupListOUT ?? []
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Create File Users in bulk from a username expression containing `[N]`
|
|
173
|
+
* Passwords are generated by the server and only returned once
|
|
174
|
+
*
|
|
175
|
+
* {@link https://docs.tak.gov/api/takserver#tag/file-user-account-management-api/operation/createFileUsersInBulk TAK Server Docs}.
|
|
176
|
+
*/
|
|
177
|
+
async createUsers(bulk) {
|
|
178
|
+
const url = new URL('/Marti/api/user-management/api/new-users', this.api.url);
|
|
179
|
+
return await this.api.fetch(url, {
|
|
180
|
+
method: 'POST',
|
|
181
|
+
body: {
|
|
182
|
+
usernameExpression: bulk.usernameExpression,
|
|
183
|
+
startN: bulk.startN,
|
|
184
|
+
endN: bulk.endN,
|
|
185
|
+
groupList: bulk.groupList ?? [],
|
|
186
|
+
groupListIN: bulk.groupListIN ?? [],
|
|
187
|
+
groupListOUT: bulk.groupListOUT ?? []
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* List all File Users
|
|
193
|
+
*
|
|
194
|
+
* {@link https://docs.tak.gov/api/takserver#tag/file-user-account-management-api/operation/getAllUsers_3 TAK Server Docs}.
|
|
195
|
+
*/
|
|
196
|
+
async listUsers() {
|
|
197
|
+
const url = new URL('/Marti/api/user-management/api/list-users', this.api.url);
|
|
198
|
+
return await this.api.fetch(url, {
|
|
199
|
+
method: 'GET'
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Get the Groups associated with a File User
|
|
204
|
+
*
|
|
205
|
+
* {@link https://docs.tak.gov/api/takserver#tag/file-user-account-management-api/operation/getGroupsForUsers TAK Server Docs}.
|
|
206
|
+
*/
|
|
207
|
+
async userGroups(username) {
|
|
208
|
+
const url = new URL(`/Marti/api/user-management/api/get-groups-for-user/${encodeURIComponent(username)}`, this.api.url);
|
|
209
|
+
return await this.api.fetch(url, {
|
|
210
|
+
method: 'GET'
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Change the password of a File User
|
|
215
|
+
*
|
|
216
|
+
* {@link https://docs.tak.gov/api/takserver#tag/file-user-account-management-api/operation/changeUserPassword TAK Server Docs}.
|
|
217
|
+
*/
|
|
218
|
+
async changePassword(user) {
|
|
219
|
+
const url = new URL('/Marti/api/user-management/api/change-user-password', this.api.url);
|
|
220
|
+
await this.api.fetch(url, {
|
|
221
|
+
method: 'PUT',
|
|
222
|
+
body: {
|
|
223
|
+
username: user.username,
|
|
224
|
+
password: user.password
|
|
225
|
+
}
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Replace the Groups associated with a File User
|
|
230
|
+
*
|
|
231
|
+
* {@link https://docs.tak.gov/api/takserver#tag/file-user-account-management-api/operation/updateGroupsForUser TAK Server Docs}.
|
|
232
|
+
*/
|
|
233
|
+
async updateUserGroups(user) {
|
|
234
|
+
const url = new URL('/Marti/api/user-management/api/update-groups', this.api.url);
|
|
235
|
+
await this.api.fetch(url, {
|
|
236
|
+
method: 'PUT',
|
|
237
|
+
body: {
|
|
238
|
+
username: user.username,
|
|
239
|
+
groupList: user.groupList ?? [],
|
|
240
|
+
groupListIN: user.groupListIN ?? [],
|
|
241
|
+
groupListOUT: user.groupListOUT ?? []
|
|
242
|
+
}
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Replace the File Users associated with a Group
|
|
247
|
+
*
|
|
248
|
+
* {@link https://docs.tak.gov/api/takserver#tag/file-user-account-management-api/operation/updateUsersForGroup TAK Server Docs}.
|
|
249
|
+
*/
|
|
250
|
+
async updateGroupUsers(group) {
|
|
251
|
+
const url = new URL('/Marti/api/user-management/api/update-group-users', this.api.url);
|
|
252
|
+
await this.api.fetch(url, {
|
|
253
|
+
method: 'PUT',
|
|
254
|
+
body: {
|
|
255
|
+
groupname: group.groupname,
|
|
256
|
+
usersInGroupList: group.usersInGroupList ?? [],
|
|
257
|
+
usersInGroupListIN: group.usersInGroupListIN ?? [],
|
|
258
|
+
usersInGroupListOUT: group.usersInGroupListOUT ?? []
|
|
259
|
+
}
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Delete a File User
|
|
264
|
+
*
|
|
265
|
+
* {@link https://docs.tak.gov/api/takserver#tag/file-user-account-management-api/operation/deleteUser_1 TAK Server Docs}.
|
|
266
|
+
*/
|
|
267
|
+
async deleteUser(username) {
|
|
268
|
+
const url = new URL(`/Marti/api/user-management/api/delete-user/${encodeURIComponent(username)}`, this.api.url);
|
|
269
|
+
await this.api.fetch(url, {
|
|
270
|
+
method: 'DELETE'
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* List all Group Names used by File Users
|
|
275
|
+
*
|
|
276
|
+
* {@link https://docs.tak.gov/api/takserver#tag/file-user-account-management-api/operation/getAllGroupNames TAK Server Docs}.
|
|
277
|
+
*/
|
|
278
|
+
async listGroups() {
|
|
279
|
+
const url = new URL('/Marti/api/user-management/api/list-groupnames', this.api.url);
|
|
280
|
+
return await this.api.fetch(url, {
|
|
281
|
+
method: 'GET'
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* Get the File Users in a Group along with their IN/OUT/BOTH direction
|
|
286
|
+
*
|
|
287
|
+
* {@link https://docs.tak.gov/api/takserver#tag/file-user-account-management-api/operation/getUsersInGroup TAK Server Docs}.
|
|
288
|
+
*/
|
|
289
|
+
async groupUsers(group) {
|
|
290
|
+
const url = new URL(`/Marti/api/user-management/api/users-in-group/${encodeURIComponent(group)}`, this.api.url);
|
|
291
|
+
return await this.api.fetch(url, {
|
|
292
|
+
method: 'GET'
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
//# sourceMappingURL=user-management.js.map
|