@hexagramio/saga-ts 0.9.293-1
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 +19 -0
- package/README.md +36 -0
- package/dist/cjs/commands/bots.d.ts +75 -0
- package/dist/cjs/commands/bots.d.ts.map +1 -0
- package/dist/cjs/commands/bots.js +133 -0
- package/dist/cjs/commands/bots.js.map +1 -0
- package/dist/cjs/commands/system.d.ts +18 -0
- package/dist/cjs/commands/system.d.ts.map +1 -0
- package/dist/cjs/commands/system.js +30 -0
- package/dist/cjs/commands/system.js.map +1 -0
- package/dist/cjs/commands/test_data.d.ts +10 -0
- package/dist/cjs/commands/test_data.d.ts.map +1 -0
- package/dist/cjs/commands/test_data.js +17 -0
- package/dist/cjs/commands/test_data.js.map +1 -0
- package/dist/cjs/commands/user.d.ts +151 -0
- package/dist/cjs/commands/user.d.ts.map +1 -0
- package/dist/cjs/commands/user.js +186 -0
- package/dist/cjs/commands/user.js.map +1 -0
- package/dist/cjs/index.d.ts +116 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/index.js +205 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/lib/shared_types.d.ts +58 -0
- package/dist/cjs/lib/shared_types.d.ts.map +1 -0
- package/dist/cjs/lib/shared_types.js +3 -0
- package/dist/cjs/lib/shared_types.js.map +1 -0
- package/dist/cjs/senders/http.d.ts +26 -0
- package/dist/cjs/senders/http.d.ts.map +1 -0
- package/dist/cjs/senders/http.js +72 -0
- package/dist/cjs/senders/http.js.map +1 -0
- package/dist/cjs/senders/socket.d.ts +52 -0
- package/dist/cjs/senders/socket.d.ts.map +1 -0
- package/dist/cjs/senders/socket.js +134 -0
- package/dist/cjs/senders/socket.js.map +1 -0
- package/dist/cjs/shared/types.d.ts +84 -0
- package/dist/cjs/shared/types.d.ts.map +1 -0
- package/dist/cjs/shared/types.js +23 -0
- package/dist/cjs/shared/types.js.map +1 -0
- package/dist/commands/bots.d.ts +75 -0
- package/dist/commands/bots.d.ts.map +1 -0
- package/dist/commands/bots.js +121 -0
- package/dist/commands/bots.js.map +1 -0
- package/dist/commands/system.d.ts +18 -0
- package/dist/commands/system.d.ts.map +1 -0
- package/dist/commands/system.js +25 -0
- package/dist/commands/system.js.map +1 -0
- package/dist/commands/test_data.d.ts +10 -0
- package/dist/commands/test_data.d.ts.map +1 -0
- package/dist/commands/test_data.js +13 -0
- package/dist/commands/test_data.js.map +1 -0
- package/dist/commands/user.d.ts +151 -0
- package/dist/commands/user.d.ts.map +1 -0
- package/dist/commands/user.js +170 -0
- package/dist/commands/user.js.map +1 -0
- package/dist/index.d.ts +116 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +196 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/shared_types.d.ts +58 -0
- package/dist/lib/shared_types.d.ts.map +1 -0
- package/dist/lib/shared_types.js +2 -0
- package/dist/lib/shared_types.js.map +1 -0
- package/dist/senders/http.d.ts +26 -0
- package/dist/senders/http.d.ts.map +1 -0
- package/dist/senders/http.js +65 -0
- package/dist/senders/http.js.map +1 -0
- package/dist/senders/socket.d.ts +52 -0
- package/dist/senders/socket.d.ts.map +1 -0
- package/dist/senders/socket.js +127 -0
- package/dist/senders/socket.js.map +1 -0
- package/dist/shared/types.d.ts +84 -0
- package/dist/shared/types.d.ts.map +1 -0
- package/dist/shared/types.js +19 -0
- package/dist/shared/types.js.map +1 -0
- package/dist/transport/http.d.ts +7 -0
- package/dist/transport/http.d.ts.map +1 -0
- package/dist/transport/http.js +75 -0
- package/dist/transport/http.js.map +1 -0
- package/package.json +50 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Copyright (C) 2023 DBA Hexagram.io (https://hexagram.io)
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
5
|
+
in the Software without restriction, including without limitation the rights
|
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
8
|
+
furnished to do so, subject to the following conditions:
|
|
9
|
+
|
|
10
|
+
The above copyright notice and this permission notice shall be included in
|
|
11
|
+
all copies or substantial portions of the Software.
|
|
12
|
+
|
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
19
|
+
THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
|
|
2
|
+
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
|
|
3
|
+
**Table of Contents**
|
|
4
|
+
|
|
5
|
+
- [Saga Typescript SDK](#saga-typescript-sdk)
|
|
6
|
+
- [Install](#install)
|
|
7
|
+
- [Tests](#tests)
|
|
8
|
+
- [Build](#build)
|
|
9
|
+
- [Usage](#usage)
|
|
10
|
+
|
|
11
|
+
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
|
|
12
|
+
|
|
13
|
+
# Saga Typescript SDK
|
|
14
|
+
|
|
15
|
+
Typescript SDK to interface with a Saga API host. The implementation is based on the [command design pattern](https://en.wikipedia.org/wiki/Command_pattern).
|
|
16
|
+
|
|
17
|
+
Login and Add Property
|
|
18
|
+
|
|
19
|
+
```js
|
|
20
|
+
|
|
21
|
+
import {
|
|
22
|
+
APIError,
|
|
23
|
+
Authentication,
|
|
24
|
+
sendHTTPCommand} from "../src";
|
|
25
|
+
|
|
26
|
+
import {
|
|
27
|
+
Lo,
|
|
28
|
+
Authentication,
|
|
29
|
+
sendHTTPCommand} from "../src/";
|
|
30
|
+
|
|
31
|
+
const baseURL="https://saga-api.com";
|
|
32
|
+
await authentication = await sendHTTPCommand()
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
```
|
|
36
|
+
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { HTTPCommand } from "../senders/http";
|
|
2
|
+
import { SocketCommand } from "../senders/socket";
|
|
3
|
+
import { CreateProperty, Id, List, ReadProperty, Tags, TestData, TimeStamp } from "../shared/types";
|
|
4
|
+
export interface CreateBot extends TestData, Tags {
|
|
5
|
+
name: string;
|
|
6
|
+
}
|
|
7
|
+
export interface UpdateBot extends CreateBot, Id {
|
|
8
|
+
}
|
|
9
|
+
export interface ReadBot extends UpdateBot, TimeStamp {
|
|
10
|
+
properties: Record<string, ReadProperty>;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* List Bots command
|
|
14
|
+
* @param search search criteria for bots
|
|
15
|
+
* @param accessToken the required accessToken
|
|
16
|
+
* @group HTTP Commands
|
|
17
|
+
*/
|
|
18
|
+
export declare const ListBotsCommand: (accessToken: string, search?: string) => HTTPCommand<List<ReadBot>>;
|
|
19
|
+
/**
|
|
20
|
+
* Create a new bot command
|
|
21
|
+
* @param data a CreateBot Object
|
|
22
|
+
* @param accessToken the required accessToken
|
|
23
|
+
* @group HTTP Commands
|
|
24
|
+
*/
|
|
25
|
+
export declare function CreateBotCommand(accessToken: string, data: CreateBot): HTTPCommand<ReadBot>;
|
|
26
|
+
/**
|
|
27
|
+
* Create an array of bots command
|
|
28
|
+
* @param data a CreateBot Object array
|
|
29
|
+
* @param accessToken the required accessToken
|
|
30
|
+
* @group HTTP Commands
|
|
31
|
+
*/
|
|
32
|
+
export declare function CreateBotsCommand(accessToken: string, data: CreateBot[]): HTTPCommand<ReadBot[]>;
|
|
33
|
+
/**
|
|
34
|
+
* Get a bot command
|
|
35
|
+
* @param id the id of the bot
|
|
36
|
+
* @param accessToken the required accessToken
|
|
37
|
+
* @group HTTP Commands
|
|
38
|
+
*/
|
|
39
|
+
export declare const GetBotCommand: (accessToken: string, id: string) => HTTPCommand<ReadBot>;
|
|
40
|
+
/**
|
|
41
|
+
* Update the bot command
|
|
42
|
+
* @param data the bot needing to be updated, the _id of the bot is used to select the bot
|
|
43
|
+
* @param accessToken the required accessToken
|
|
44
|
+
* @group HTTP Commands
|
|
45
|
+
*/
|
|
46
|
+
export declare const UpdateBotCommand: (accessToken: string, data: UpdateBot) => HTTPCommand<ReadBot>;
|
|
47
|
+
/**
|
|
48
|
+
* Delete a bot command
|
|
49
|
+
* @param id the id of the bot to delete
|
|
50
|
+
* @param accessToken the required accessToken
|
|
51
|
+
* @group HTTP Commands
|
|
52
|
+
*/
|
|
53
|
+
export declare const DeleteBotCommand: (accessToken: string, _id: string) => HTTPCommand<{
|
|
54
|
+
ok: true;
|
|
55
|
+
}>;
|
|
56
|
+
/**
|
|
57
|
+
* Add a bot property command
|
|
58
|
+
* @param data the property
|
|
59
|
+
* @param accessToken the required accessToken
|
|
60
|
+
* @group HTTP Commands
|
|
61
|
+
*/
|
|
62
|
+
export declare const AddBotPropertyCommand: (accessToken: string, data: CreateProperty) => HTTPCommand<ReadProperty>;
|
|
63
|
+
/**
|
|
64
|
+
* A command to join a bots realtime socket
|
|
65
|
+
* @param _id id of the bot
|
|
66
|
+
* @group Socket Commands
|
|
67
|
+
*/
|
|
68
|
+
export declare const JoinBotCommand: (_id: string) => SocketCommand;
|
|
69
|
+
/**
|
|
70
|
+
* A command to leave a bots realtime socket
|
|
71
|
+
* @param _id id of the bot
|
|
72
|
+
* @group Socket Commands
|
|
73
|
+
*/
|
|
74
|
+
export declare const LeaveBotCommand: (_id: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,MAAM,gBAAgB,gBAAiB,MAAM,OAAO,MAAM,KAAE,YAAY;IAAC,EAAE,EAAC,IAAI,CAAA;CAAC,CAMvF,CAAA;AAGD;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,gBAAiB,MAAM,QAAO,cAAc,KAAE,YAAY,YAAY,CAOvG,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,cAAc,QAAQ,MAAM,KAAG,aAM3C,CAAA;AACD;;;;GAIG;AACH,eAAO,MAAM,eAAe,QAAQ,MAAM,KAAG,aAM5C,CAAA"}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LeaveBotCommand = exports.JoinBotCommand = exports.AddBotPropertyCommand = exports.DeleteBotCommand = exports.UpdateBotCommand = exports.GetBotCommand = exports.CreateBotsCommand = exports.CreateBotCommand = exports.ListBotsCommand = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* List Bots command
|
|
6
|
+
* @param search search criteria for bots
|
|
7
|
+
* @param accessToken the required accessToken
|
|
8
|
+
* @group HTTP Commands
|
|
9
|
+
*/
|
|
10
|
+
const ListBotsCommand = (accessToken, search) => {
|
|
11
|
+
return {
|
|
12
|
+
method: "GET",
|
|
13
|
+
path: "/bots",
|
|
14
|
+
params: search ? new URLSearchParams({ search }) : undefined,
|
|
15
|
+
accessToken
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
exports.ListBotsCommand = ListBotsCommand;
|
|
19
|
+
/**
|
|
20
|
+
* Create a new bot command
|
|
21
|
+
* @param data a CreateBot Object
|
|
22
|
+
* @param accessToken the required accessToken
|
|
23
|
+
* @group HTTP Commands
|
|
24
|
+
*/
|
|
25
|
+
function CreateBotCommand(accessToken, data) {
|
|
26
|
+
return {
|
|
27
|
+
method: "POST",
|
|
28
|
+
path: "/bots",
|
|
29
|
+
data,
|
|
30
|
+
accessToken
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
exports.CreateBotCommand = CreateBotCommand;
|
|
34
|
+
/**
|
|
35
|
+
* Create an array of bots command
|
|
36
|
+
* @param data a CreateBot Object array
|
|
37
|
+
* @param accessToken the required accessToken
|
|
38
|
+
* @group HTTP Commands
|
|
39
|
+
*/
|
|
40
|
+
function CreateBotsCommand(accessToken, data) {
|
|
41
|
+
return {
|
|
42
|
+
method: "POST",
|
|
43
|
+
path: "/bots",
|
|
44
|
+
data,
|
|
45
|
+
accessToken
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
exports.CreateBotsCommand = CreateBotsCommand;
|
|
49
|
+
/**
|
|
50
|
+
* Get a bot command
|
|
51
|
+
* @param id the id of the bot
|
|
52
|
+
* @param accessToken the required accessToken
|
|
53
|
+
* @group HTTP Commands
|
|
54
|
+
*/
|
|
55
|
+
const GetBotCommand = (accessToken, id) => {
|
|
56
|
+
return {
|
|
57
|
+
method: "GET",
|
|
58
|
+
path: `/bots/${id}`,
|
|
59
|
+
accessToken
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
exports.GetBotCommand = GetBotCommand;
|
|
63
|
+
/**
|
|
64
|
+
* Update the bot command
|
|
65
|
+
* @param data the bot needing to be updated, the _id of the bot is used to select the bot
|
|
66
|
+
* @param accessToken the required accessToken
|
|
67
|
+
* @group HTTP Commands
|
|
68
|
+
*/
|
|
69
|
+
const UpdateBotCommand = (accessToken, data) => {
|
|
70
|
+
return {
|
|
71
|
+
method: "PUT",
|
|
72
|
+
path: `/bots/${data._id}`,
|
|
73
|
+
data,
|
|
74
|
+
accessToken
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
exports.UpdateBotCommand = UpdateBotCommand;
|
|
78
|
+
/**
|
|
79
|
+
* Delete a bot command
|
|
80
|
+
* @param id the id of the bot to delete
|
|
81
|
+
* @param accessToken the required accessToken
|
|
82
|
+
* @group HTTP Commands
|
|
83
|
+
*/
|
|
84
|
+
const DeleteBotCommand = (accessToken, _id) => {
|
|
85
|
+
return {
|
|
86
|
+
method: "DELETE",
|
|
87
|
+
path: `/bots/${_id}`,
|
|
88
|
+
accessToken
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
exports.DeleteBotCommand = DeleteBotCommand;
|
|
92
|
+
/**
|
|
93
|
+
* Add a bot property command
|
|
94
|
+
* @param data the property
|
|
95
|
+
* @param accessToken the required accessToken
|
|
96
|
+
* @group HTTP Commands
|
|
97
|
+
*/
|
|
98
|
+
const AddBotPropertyCommand = (accessToken, data) => {
|
|
99
|
+
return {
|
|
100
|
+
method: "POST",
|
|
101
|
+
path: `/bots/${data.parent_id}/properties`,
|
|
102
|
+
data,
|
|
103
|
+
accessToken
|
|
104
|
+
};
|
|
105
|
+
};
|
|
106
|
+
exports.AddBotPropertyCommand = AddBotPropertyCommand;
|
|
107
|
+
/**
|
|
108
|
+
* A command to join a bots realtime socket
|
|
109
|
+
* @param _id id of the bot
|
|
110
|
+
* @group Socket Commands
|
|
111
|
+
*/
|
|
112
|
+
const JoinBotCommand = (_id) => {
|
|
113
|
+
return {
|
|
114
|
+
method: "/bots",
|
|
115
|
+
join: true,
|
|
116
|
+
id: _id
|
|
117
|
+
};
|
|
118
|
+
};
|
|
119
|
+
exports.JoinBotCommand = JoinBotCommand;
|
|
120
|
+
/**
|
|
121
|
+
* A command to leave a bots realtime socket
|
|
122
|
+
* @param _id id of the bot
|
|
123
|
+
* @group Socket Commands
|
|
124
|
+
*/
|
|
125
|
+
const LeaveBotCommand = (_id) => {
|
|
126
|
+
return {
|
|
127
|
+
method: "/bots",
|
|
128
|
+
join: false,
|
|
129
|
+
id: _id
|
|
130
|
+
};
|
|
131
|
+
};
|
|
132
|
+
exports.LeaveBotCommand = LeaveBotCommand;
|
|
133
|
+
//# sourceMappingURL=bots.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bots.js","sourceRoot":"","sources":["../../../src/commands/bots.ts"],"names":[],"mappings":";;;AAkBA;;;;;GAKG;AAC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f,IAAI,EAAC,SAAS,GAAG,EAAE;QACnB,WAAW;KACZ,CAAA;AACH,CAAC,CAAA;AANY,QAAA,gBAAgB,oBAM5B;AAGD;;;;;GAKG;AACI,MAAM,qBAAqB,GAAG,CAAC,WAAmB,EAAE,IAAmB,EAA2B,EAAE;IACzG,OAAO;QACL,MAAM,EAAC,MAAM;QACb,IAAI,EAAC,SAAS,IAAI,CAAC,SAAS,aAAa;QACzC,IAAI;QACJ,WAAW;KACZ,CAAA;AACH,CAAC,CAAA;AAPY,QAAA,qBAAqB,yBAOjC;AAED;;;;GAIG;AACI,MAAM,cAAc,GAAG,CAAC,GAAU,EAAiB,EAAE;IAC1D,OAAO;QACL,MAAM,EAAC,OAAO;QACd,IAAI,EAAC,IAAI;QACT,EAAE,EAAC,GAAG;KACP,CAAA;AACH,CAAC,CAAA;AANY,QAAA,cAAc,kBAM1B;AACD;;;;GAIG;AACI,MAAM,eAAe,GAAG,CAAC,GAAU,EAAiB,EAAE;IAC3D,OAAO;QACL,MAAM,EAAC,OAAO;QACd,IAAI,EAAC,KAAK;QACV,EAAE,EAAC,GAAG;KACP,CAAA;AACH,CAAC,CAAA;AANY,QAAA,eAAe,mBAM3B"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { HTTPCommand } from "../senders/http";
|
|
2
|
+
/**
|
|
3
|
+
* Command to return the current saga build version
|
|
4
|
+
* @param accessToken the required accessToken
|
|
5
|
+
* @group HTTP Commands
|
|
6
|
+
*/
|
|
7
|
+
export declare const GetBuildVersionCommand: (accessToken: string) => HTTPCommand<{
|
|
8
|
+
version: string;
|
|
9
|
+
}>;
|
|
10
|
+
/**
|
|
11
|
+
* Command to trigger a saga rebuild
|
|
12
|
+
* @param accessToken the required accessToken
|
|
13
|
+
* @group HTTP Commands
|
|
14
|
+
*/
|
|
15
|
+
export declare const TriggerBuildCommand: (accessToken: string) => HTTPCommand<{
|
|
16
|
+
version: string;
|
|
17
|
+
}>;
|
|
18
|
+
//# sourceMappingURL=system.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"system.d.ts","sourceRoot":"","sources":["../../../src/commands/system.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAC,MAAM,iBAAiB,CAAC;AAG5C;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,gBAAiB,MAAM,KAAE,YAAa;IAAC,OAAO,EAAC,MAAM,CAAA;CAAC,CAMxF,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,gBAAiB,MAAM,KAAE,YAAa;IAAC,OAAO,EAAC,MAAM,CAAA;CAAC,CAMrF,CAAA"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TriggerBuildCommand = exports.GetBuildVersionCommand = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Command to return the current saga build version
|
|
6
|
+
* @param accessToken the required accessToken
|
|
7
|
+
* @group HTTP Commands
|
|
8
|
+
*/
|
|
9
|
+
const GetBuildVersionCommand = (accessToken) => {
|
|
10
|
+
return {
|
|
11
|
+
method: "GET",
|
|
12
|
+
path: "/build",
|
|
13
|
+
accessToken
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
exports.GetBuildVersionCommand = GetBuildVersionCommand;
|
|
17
|
+
/**
|
|
18
|
+
* Command to trigger a saga rebuild
|
|
19
|
+
* @param accessToken the required accessToken
|
|
20
|
+
* @group HTTP Commands
|
|
21
|
+
*/
|
|
22
|
+
const TriggerBuildCommand = (accessToken) => {
|
|
23
|
+
return {
|
|
24
|
+
method: "GET",
|
|
25
|
+
path: "/build",
|
|
26
|
+
accessToken
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
exports.TriggerBuildCommand = TriggerBuildCommand;
|
|
30
|
+
//# sourceMappingURL=system.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"system.js","sourceRoot":"","sources":["../../../src/commands/system.ts"],"names":[],"mappings":";;;AAGA;;;;GAIG;AACI,MAAM,sBAAsB,GAAG,CAAC,WAAmB,EAAgC,EAAE;IAC1F,OAAO;QACL,MAAM,EAAC,KAAK;QACZ,IAAI,EAAC,QAAQ;QACb,WAAW;KACZ,CAAA;AACH,CAAC,CAAA;AANY,QAAA,sBAAsB,0BAMlC;AAED;;;;GAIG;AACI,MAAM,mBAAmB,GAAG,CAAC,WAAmB,EAAgC,EAAE;IACvF,OAAO;QACL,MAAM,EAAC,KAAK;QACZ,IAAI,EAAC,QAAQ;QACb,WAAW;KACZ,CAAA;AACH,CAAC,CAAA;AANY,QAAA,mBAAmB,uBAM/B"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { HTTPCommand } from "../senders/http";
|
|
2
|
+
/**
|
|
3
|
+
* Command to remove all data flagged with test_data from the saga
|
|
4
|
+
* @param accessToken the required accessToken
|
|
5
|
+
* @group HTTP Commands
|
|
6
|
+
*/
|
|
7
|
+
export declare const DeleteTestDataCommand: (accessToken: string) => HTTPCommand<{
|
|
8
|
+
ok: 1;
|
|
9
|
+
}>;
|
|
10
|
+
//# sourceMappingURL=test_data.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test_data.d.ts","sourceRoot":"","sources":["../../../src/commands/test_data.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAC,MAAM,iBAAiB,CAAC;AAE5C;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,gBAAiB,MAAM,KAAE,YAAa;IAAC,EAAE,EAAC,CAAC,CAAA;CAAC,CAM7E,CAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DeleteTestDataCommand = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Command to remove all data flagged with test_data from the saga
|
|
6
|
+
* @param accessToken the required accessToken
|
|
7
|
+
* @group HTTP Commands
|
|
8
|
+
*/
|
|
9
|
+
const DeleteTestDataCommand = (accessToken) => {
|
|
10
|
+
return {
|
|
11
|
+
method: "DELETE",
|
|
12
|
+
path: "/test",
|
|
13
|
+
accessToken
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
exports.DeleteTestDataCommand = DeleteTestDataCommand;
|
|
17
|
+
//# sourceMappingURL=test_data.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test_data.js","sourceRoot":"","sources":["../../../src/commands/test_data.ts"],"names":[],"mappings":";;;AAEA;;;;GAIG;AACI,MAAM,qBAAqB,GAAG,CAAC,WAAmB,EAAuB,EAAE;IAChF,OAAO;QACL,MAAM,EAAC,QAAQ;QACf,IAAI,EAAC,OAAO;QACZ,WAAW;KACZ,CAAA;AACH,CAAC,CAAA;AANY,QAAA,qBAAqB,yBAMjC"}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lit of user messages and functions to generate user commands
|
|
3
|
+
* @packageDocumentation
|
|
4
|
+
*/
|
|
5
|
+
import { HTTPCommand } from "../senders/http";
|
|
6
|
+
import { SocketCommand } from "../senders/socket";
|
|
7
|
+
import { CreateProperty, Id, List, ReadProperty, Tags, TestData, TimeStamp } from "../shared/types";
|
|
8
|
+
/**
|
|
9
|
+
* used to update basic user
|
|
10
|
+
* @group User Types
|
|
11
|
+
*/
|
|
12
|
+
export interface UpdateUser extends Id {
|
|
13
|
+
username?: string;
|
|
14
|
+
tags?: [string];
|
|
15
|
+
email?: string;
|
|
16
|
+
displayname?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
*
|
|
20
|
+
* @group User Types
|
|
21
|
+
*/
|
|
22
|
+
export interface ReadUser extends TimeStamp, Id, TestData, Tags {
|
|
23
|
+
username: string;
|
|
24
|
+
properties: Record<string, ReadProperty>;
|
|
25
|
+
tags?: [string];
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Basic User Creation Message
|
|
29
|
+
* @group User Types
|
|
30
|
+
*/
|
|
31
|
+
export interface BasicUser extends Tags {
|
|
32
|
+
prefix?: "";
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Register User Message
|
|
36
|
+
* @group User Types
|
|
37
|
+
*/
|
|
38
|
+
export interface RegisterUser extends Tags {
|
|
39
|
+
username: string;
|
|
40
|
+
password: string;
|
|
41
|
+
email?: string;
|
|
42
|
+
displayname?: string;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Login User Message
|
|
46
|
+
* @group User Types
|
|
47
|
+
*/
|
|
48
|
+
export interface LoginUser extends Tags {
|
|
49
|
+
username: string;
|
|
50
|
+
password: string;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Creates a command to get the user associated with the given accessToken
|
|
54
|
+
* @param accessToken the required accessToken
|
|
55
|
+
* @group HTTP Commands
|
|
56
|
+
*/
|
|
57
|
+
export declare const WhoAmICommand: (accessToken: string) => HTTPCommand<ReadUser>;
|
|
58
|
+
/**
|
|
59
|
+
* Encapsulates authentication tokens. An authentication object is returned i.e. from {@link LoginUserCommand} It's required for most HTTP Commands.
|
|
60
|
+
*/
|
|
61
|
+
export interface Authentication {
|
|
62
|
+
/**
|
|
63
|
+
* Required access token
|
|
64
|
+
*/
|
|
65
|
+
accessToken: string;
|
|
66
|
+
/**
|
|
67
|
+
* Used to retrieve a new access token using {@link RefreshTokenCommand}
|
|
68
|
+
*/
|
|
69
|
+
refreshToken: string;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Command to login a user
|
|
73
|
+
* @param username string
|
|
74
|
+
* @param password string
|
|
75
|
+
* @group HTTP Commands
|
|
76
|
+
*/
|
|
77
|
+
export declare const LoginUserCommand: (data: LoginUser) => HTTPCommand<ReadUser & Authentication>;
|
|
78
|
+
/**
|
|
79
|
+
* Create command to register a user
|
|
80
|
+
* @param username string
|
|
81
|
+
* @param password string
|
|
82
|
+
* @group HTTP Commands
|
|
83
|
+
*/
|
|
84
|
+
export declare const RegisterUserCommand: (data: RegisterUser) => HTTPCommand<ReadUser & Authentication>;
|
|
85
|
+
/**
|
|
86
|
+
* Command to create a generated user
|
|
87
|
+
* @param basicUser an optional model
|
|
88
|
+
* @group HTTP Commands
|
|
89
|
+
*/
|
|
90
|
+
export declare const CreateGenerateBasicUserCommand: (data?: BasicUser) => HTTPCommand<ReadUser>;
|
|
91
|
+
/**
|
|
92
|
+
* Command to create a test user
|
|
93
|
+
* @param basicUser an optional model
|
|
94
|
+
* @group HTTP Commands
|
|
95
|
+
*/
|
|
96
|
+
export declare const CreateTestUserCommand: (username?: string) => HTTPCommand<ReadUser>;
|
|
97
|
+
/**
|
|
98
|
+
* List Users command
|
|
99
|
+
* @param search search criteria for ysers
|
|
100
|
+
* @param accessToken the required accessToken
|
|
101
|
+
* @group HTTP Commands
|
|
102
|
+
*/
|
|
103
|
+
export declare const ListUsersCommand: (accessToken: string, search?: string) => HTTPCommand<List<ReadUser>>;
|
|
104
|
+
/**
|
|
105
|
+
* Get a user command
|
|
106
|
+
* @param id the id of the user
|
|
107
|
+
* @param accessToken the required accessToken
|
|
108
|
+
* @group HTTP Commands
|
|
109
|
+
*/
|
|
110
|
+
export declare const GetUserCommand: (accessToken: string, id: string) => HTTPCommand<ReadUser>;
|
|
111
|
+
/**
|
|
112
|
+
* Refresh token command
|
|
113
|
+
* @param id the id of the user
|
|
114
|
+
* @param refreshToken the refresh token
|
|
115
|
+
* @group HTTP Commands
|
|
116
|
+
*/
|
|
117
|
+
export declare const RefreshTokenCommand: (refreshToken: string, id: string) => HTTPCommand<Authentication>;
|
|
118
|
+
/**
|
|
119
|
+
* Delete a user command
|
|
120
|
+
* @param id the id of the user
|
|
121
|
+
* @param accessToken the required accessToken
|
|
122
|
+
* @group HTTP Commands
|
|
123
|
+
*/
|
|
124
|
+
export declare const GetDeleteCommand: (accessToken: string, id: string) => HTTPCommand<ReadUser>;
|
|
125
|
+
/**
|
|
126
|
+
* Update the user command
|
|
127
|
+
* @param data the user needing to be updated, the _id of the user is used to select the user
|
|
128
|
+
* @param accessToken the required accessToken
|
|
129
|
+
* @group HTTP Commands
|
|
130
|
+
*/
|
|
131
|
+
export declare const UpdateUserCommand: (accessToken: string, data: UpdateUser) => HTTPCommand<ReadUser>;
|
|
132
|
+
/**
|
|
133
|
+
* Add a bot property command
|
|
134
|
+
* @param data the property
|
|
135
|
+
* @param accessToken the required accessToken
|
|
136
|
+
* @group HTTP Commands
|
|
137
|
+
*/
|
|
138
|
+
export declare const AddUserPropertyCommand: (accessToken: string, data: CreateProperty) => HTTPCommand<ReadProperty>;
|
|
139
|
+
/**
|
|
140
|
+
* A command to join a users realtime socket
|
|
141
|
+
* @param _id the id of the user
|
|
142
|
+
* @group Socket Commands
|
|
143
|
+
*/
|
|
144
|
+
export declare const JoinUserCommand: (_id: string) => SocketCommand;
|
|
145
|
+
/**
|
|
146
|
+
* A command to leave a users realtime socket
|
|
147
|
+
* @param _id the id of the user
|
|
148
|
+
* @group Socket Commands
|
|
149
|
+
*/
|
|
150
|
+
export declare const LeaveUserCommand: (_id: string) => SocketCommand;
|
|
151
|
+
//# sourceMappingURL=user.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user.d.ts","sourceRoot":"","sources":["../../../src/commands/user.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAC,WAAW,EAAC,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAC,aAAa,EAAC,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAC,cAAc,EAAE,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAC,MAAM,iBAAiB,CAAC;AAElG;;;GAGG;AACH,MAAM,WAAW,UAAW,SAAQ,EAAE;IACpC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,CAAC,MAAM,CA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