@rivet-gg/chat 0.0.4 → 0.0.6
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.
@@ -12,22 +12,37 @@ const smithy_client_1 = require("@aws-sdk/smithy-client");
|
|
12
12
|
const common_1 = require("@rivet-gg/common");
|
13
13
|
class ChatServiceClient extends smithy_client_1.Client {
|
14
14
|
constructor(configuration) {
|
15
|
-
if (!configuration.hasOwnProperty("requestHandler")) {
|
16
|
-
if (typeof window !== "undefined")
|
17
|
-
configuration.requestHandler = common_1.middleware.browser.requestHandlerMiddleware(configuration.token);
|
18
|
-
else
|
19
|
-
configuration.requestHandler = common_1.middleware.nodejs.requestHandlerMiddleware(configuration.token);
|
20
|
-
}
|
21
15
|
function rivetConfig(input) {
|
22
|
-
var _a, _b, _c;
|
16
|
+
var _a, _b, _c, _d, _e;
|
17
|
+
let endpoint = (_a = configuration.endpoint) !== null && _a !== void 0 ? _a : null;
|
18
|
+
if (endpoint === null) {
|
19
|
+
try {
|
20
|
+
endpoint = (_b = process.env.RIVET_CHAT_API_URL) !== null && _b !== void 0 ? _b : null;
|
21
|
+
}
|
22
|
+
catch (_f) {
|
23
|
+
}
|
24
|
+
if (endpoint === null) {
|
25
|
+
endpoint = "https://chat.api.rivet.gg/v1";
|
26
|
+
}
|
27
|
+
}
|
28
|
+
let token = (_c = input.token) !== null && _c !== void 0 ? _c : null;
|
29
|
+
if (token === null) {
|
30
|
+
try {
|
31
|
+
token = (_e = (_d = process.env.RIVET_CHAT_TOKEN) !== null && _d !== void 0 ? _d : process.env.RIVET_TOKEN) !== null && _e !== void 0 ? _e : null;
|
32
|
+
}
|
33
|
+
catch (_g) {
|
34
|
+
}
|
35
|
+
}
|
23
36
|
return Object.assign(Object.assign({}, input), {
|
24
|
-
endpoint
|
25
|
-
|
26
|
-
token: (_c = input.token) !== null && _c !== void 0 ? _c : null,
|
37
|
+
endpoint,
|
38
|
+
token,
|
27
39
|
});
|
28
40
|
}
|
29
41
|
let _config_0 = (0, runtimeConfig_1.getRuntimeConfig)(configuration);
|
30
42
|
let _config_1 = rivetConfig(_config_0);
|
43
|
+
if (!configuration.hasOwnProperty("requestHandler")) {
|
44
|
+
_config_1.requestHandler = common_1.middleware.requestHandlerMiddleware(_config_1.token);
|
45
|
+
}
|
31
46
|
let _config_2 = (0, config_resolver_1.resolveCustomEndpointsConfig)(_config_1);
|
32
47
|
let _config_3 = (0, middleware_retry_1.resolveRetryConfig)(_config_2);
|
33
48
|
let _config_4 = (0, middleware_host_header_1.resolveHostHeaderConfig)(_config_3);
|
@@ -46,7 +46,7 @@ const serializeAws_restJson1GetThreadHistoryCommand = async (input, context) =>
|
|
46
46
|
throw new Error('No value provided for input HTTP label: threadId.');
|
47
47
|
}
|
48
48
|
const query = {
|
49
|
-
...(input.ts !== undefined && { "ts":
|
49
|
+
...(input.ts !== undefined && { "ts": input.ts.toISOString().toString() }),
|
50
50
|
...(input.count !== undefined && { "count": input.count.toString() }),
|
51
51
|
...(input.queryDirection !== undefined && { "query_direction": input.queryDirection }),
|
52
52
|
};
|
@@ -129,7 +129,7 @@ const serializeAws_restJson1SetThreadReadCommand = async (input, context) => {
|
|
129
129
|
}
|
130
130
|
let body;
|
131
131
|
body = JSON.stringify({
|
132
|
-
...(input.lastReadTs !== undefined && input.lastReadTs !== null && { "last_read_ts":
|
132
|
+
...(input.lastReadTs !== undefined && input.lastReadTs !== null && { "last_read_ts": input.lastReadTs.toISOString() }),
|
133
133
|
});
|
134
134
|
return new protocol_http_1.HttpRequest({
|
135
135
|
protocol,
|
@@ -920,9 +920,9 @@ const deserializeAws_restJson1IdentityExternalLinks = (output, context) => {
|
|
920
920
|
};
|
921
921
|
const deserializeAws_restJson1IdentityGameActivity = (output, context) => {
|
922
922
|
return {
|
923
|
-
friendMetadata: (output.friend_metadata !== undefined && output.friend_metadata !== null) ? deserializeAws_restJson1Document(output.friend_metadata, context) : undefined,
|
924
923
|
game: (output.game !== undefined && output.game !== null) ? deserializeAws_restJson1GameHandle(output.game, context) : undefined,
|
925
924
|
message: (0, smithy_client_1.expectString)(output.message),
|
925
|
+
mutualMetadata: (output.mutual_metadata !== undefined && output.mutual_metadata !== null) ? deserializeAws_restJson1Document(output.mutual_metadata, context) : undefined,
|
926
926
|
publicMetadata: (output.public_metadata !== undefined && output.public_metadata !== null) ? deserializeAws_restJson1Document(output.public_metadata, context) : undefined,
|
927
927
|
};
|
928
928
|
};
|
@@ -12,22 +12,37 @@ var ChatServiceClient = (function (_super) {
|
|
12
12
|
__extends(ChatServiceClient, _super);
|
13
13
|
function ChatServiceClient(configuration) {
|
14
14
|
var _this = this;
|
15
|
-
if (!configuration.hasOwnProperty("requestHandler")) {
|
16
|
-
if (typeof window !== "undefined")
|
17
|
-
configuration.requestHandler = __middleware.browser.requestHandlerMiddleware(configuration.token);
|
18
|
-
else
|
19
|
-
configuration.requestHandler = __middleware.nodejs.requestHandlerMiddleware(configuration.token);
|
20
|
-
}
|
21
15
|
function rivetConfig(input) {
|
22
|
-
var _a, _b, _c;
|
16
|
+
var _a, _b, _c, _d, _e;
|
17
|
+
var endpoint = (_a = configuration.endpoint) !== null && _a !== void 0 ? _a : null;
|
18
|
+
if (endpoint === null) {
|
19
|
+
try {
|
20
|
+
endpoint = (_b = process.env.RIVET_CHAT_API_URL) !== null && _b !== void 0 ? _b : null;
|
21
|
+
}
|
22
|
+
catch (_f) {
|
23
|
+
}
|
24
|
+
if (endpoint === null) {
|
25
|
+
endpoint = "https://chat.api.rivet.gg/v1";
|
26
|
+
}
|
27
|
+
}
|
28
|
+
var token = (_c = input.token) !== null && _c !== void 0 ? _c : null;
|
29
|
+
if (token === null) {
|
30
|
+
try {
|
31
|
+
token = (_e = (_d = process.env.RIVET_CHAT_TOKEN) !== null && _d !== void 0 ? _d : process.env.RIVET_TOKEN) !== null && _e !== void 0 ? _e : null;
|
32
|
+
}
|
33
|
+
catch (_g) {
|
34
|
+
}
|
35
|
+
}
|
23
36
|
return Object.assign(Object.assign({}, input), {
|
24
|
-
endpoint:
|
25
|
-
|
26
|
-
token: (_c = input.token) !== null && _c !== void 0 ? _c : null,
|
37
|
+
endpoint: endpoint,
|
38
|
+
token: token,
|
27
39
|
});
|
28
40
|
}
|
29
41
|
var _config_0 = __getRuntimeConfig(configuration);
|
30
42
|
var _config_1 = rivetConfig(_config_0);
|
43
|
+
if (!configuration.hasOwnProperty("requestHandler")) {
|
44
|
+
_config_1.requestHandler = __middleware.requestHandlerMiddleware(_config_1.token);
|
45
|
+
}
|
31
46
|
var _config_2 = resolveCustomEndpointsConfig(_config_1);
|
32
47
|
var _config_3 = resolveRetryConfig(_config_2);
|
33
48
|
var _config_4 = resolveHostHeaderConfig(_config_3);
|
@@ -53,7 +53,7 @@ export var serializeAws_restJson1GetThreadHistoryCommand = function (input, cont
|
|
53
53
|
else {
|
54
54
|
throw new Error('No value provided for input HTTP label: threadId.');
|
55
55
|
}
|
56
|
-
query = __assign(__assign(__assign({}, (input.ts !== undefined && { "ts":
|
56
|
+
query = __assign(__assign(__assign({}, (input.ts !== undefined && { "ts": input.ts.toISOString().toString() })), (input.count !== undefined && { "count": input.count.toString() })), (input.queryDirection !== undefined && { "query_direction": input.queryDirection }));
|
57
57
|
return [2, new __HttpRequest({
|
58
58
|
protocol: protocol,
|
59
59
|
hostname: hostname,
|
@@ -143,7 +143,7 @@ export var serializeAws_restJson1SetThreadReadCommand = function (input, context
|
|
143
143
|
else {
|
144
144
|
throw new Error('No value provided for input HTTP label: threadId.');
|
145
145
|
}
|
146
|
-
body = JSON.stringify(__assign({}, (input.lastReadTs !== undefined && input.lastReadTs !== null && { "last_read_ts":
|
146
|
+
body = JSON.stringify(__assign({}, (input.lastReadTs !== undefined && input.lastReadTs !== null && { "last_read_ts": input.lastReadTs.toISOString() })));
|
147
147
|
return [2, new __HttpRequest({
|
148
148
|
protocol: protocol,
|
149
149
|
hostname: hostname,
|
@@ -1100,9 +1100,9 @@ var deserializeAws_restJson1IdentityExternalLinks = function (output, context) {
|
|
1100
1100
|
};
|
1101
1101
|
var deserializeAws_restJson1IdentityGameActivity = function (output, context) {
|
1102
1102
|
return {
|
1103
|
-
friendMetadata: (output.friend_metadata !== undefined && output.friend_metadata !== null) ? deserializeAws_restJson1Document(output.friend_metadata, context) : undefined,
|
1104
1103
|
game: (output.game !== undefined && output.game !== null) ? deserializeAws_restJson1GameHandle(output.game, context) : undefined,
|
1105
1104
|
message: __expectString(output.message),
|
1105
|
+
mutualMetadata: (output.mutual_metadata !== undefined && output.mutual_metadata !== null) ? deserializeAws_restJson1Document(output.mutual_metadata, context) : undefined,
|
1106
1106
|
publicMetadata: (output.public_metadata !== undefined && output.public_metadata !== null) ? deserializeAws_restJson1Document(output.public_metadata, context) : undefined,
|
1107
1107
|
};
|
1108
1108
|
};
|
@@ -7,7 +7,7 @@ export declare enum QueryDirection {
|
|
7
7
|
*/
|
8
8
|
AFTER = "after",
|
9
9
|
/**
|
10
|
-
* Query messages send before given
|
10
|
+
* Query messages send before given timestamp.
|
11
11
|
*/
|
12
12
|
BEFORE = "before",
|
13
13
|
/**
|
@@ -283,9 +283,9 @@ export interface IdentityGameActivity {
|
|
283
283
|
*/
|
284
284
|
publicMetadata?: __DocumentType;
|
285
285
|
/**
|
286
|
-
* JSON data seen only by the given identity and their
|
286
|
+
* JSON data seen only by the given identity and their mutual followers.
|
287
287
|
*/
|
288
|
-
|
288
|
+
mutualMetadata?: __DocumentType;
|
289
289
|
}
|
290
290
|
export declare namespace IdentityGameActivity {
|
291
291
|
/**
|
@@ -1279,7 +1279,7 @@ export declare class InternalError extends __BaseException {
|
|
1279
1279
|
readonly name: "InternalError";
|
1280
1280
|
readonly $fault: "server";
|
1281
1281
|
$retryable: {};
|
1282
|
-
code
|
1282
|
+
code: string | undefined;
|
1283
1283
|
/**
|
1284
1284
|
* Unstructured metadata relating to an error. Must be manually parsed.
|
1285
1285
|
*/
|
package/package.json
CHANGED
@@ -1 +1,93 @@
|
|
1
|
-
{
|
1
|
+
{
|
2
|
+
"author": "Rivet Gaming, LLC",
|
3
|
+
"browser": {
|
4
|
+
"./dist-es/runtimeConfig": "./dist-es/runtimeConfig.browser"
|
5
|
+
},
|
6
|
+
"bugs": {
|
7
|
+
"email": "developer@rivet.gg"
|
8
|
+
},
|
9
|
+
"dependencies": {
|
10
|
+
"@aws-crypto/sha256-browser": "2.0.0",
|
11
|
+
"@aws-crypto/sha256-js": "2.0.0",
|
12
|
+
"@aws-sdk/config-resolver": "3.80.0",
|
13
|
+
"@aws-sdk/fetch-http-handler": "3.78.0",
|
14
|
+
"@aws-sdk/hash-node": "3.78.0",
|
15
|
+
"@aws-sdk/invalid-dependency": "3.78.0",
|
16
|
+
"@aws-sdk/middleware-content-length": "3.78.0",
|
17
|
+
"@aws-sdk/middleware-host-header": "3.78.0",
|
18
|
+
"@aws-sdk/middleware-logger": "3.78.0",
|
19
|
+
"@aws-sdk/middleware-retry": "3.80.0",
|
20
|
+
"@aws-sdk/middleware-serde": "3.78.0",
|
21
|
+
"@aws-sdk/middleware-stack": "3.78.0",
|
22
|
+
"@aws-sdk/middleware-user-agent": "3.78.0",
|
23
|
+
"@aws-sdk/node-config-provider": "3.80.0",
|
24
|
+
"@aws-sdk/node-http-handler": "3.94.0",
|
25
|
+
"@aws-sdk/protocol-http": "3.78.0",
|
26
|
+
"@aws-sdk/smithy-client": "3.99.0",
|
27
|
+
"@aws-sdk/types": "3.78.0",
|
28
|
+
"@aws-sdk/url-parser": "3.78.0",
|
29
|
+
"@aws-sdk/util-base64-browser": "3.58.0",
|
30
|
+
"@aws-sdk/util-base64-node": "3.55.0",
|
31
|
+
"@aws-sdk/util-body-length-browser": "3.55.0",
|
32
|
+
"@aws-sdk/util-body-length-node": "3.55.0",
|
33
|
+
"@aws-sdk/util-defaults-mode-browser": "3.99.0",
|
34
|
+
"@aws-sdk/util-defaults-mode-node": "3.99.0",
|
35
|
+
"@aws-sdk/util-user-agent-browser": "3.78.0",
|
36
|
+
"@aws-sdk/util-user-agent-node": "3.80.0",
|
37
|
+
"@aws-sdk/util-utf8-browser": "3.55.0",
|
38
|
+
"@aws-sdk/util-utf8-node": "3.55.0",
|
39
|
+
"@rivet-gg/common": "git+https://github.com/rivet-gg/rivet-sdk-js.git#5f2e50fa9b499805f068aecf36ce691d1472758a",
|
40
|
+
"tslib": "^2.3.1"
|
41
|
+
},
|
42
|
+
"description": "Rivet service enabling identities to send and receive chat messages",
|
43
|
+
"devDependencies": {
|
44
|
+
"@aws-sdk/service-client-documentation-generator": "git+https://github.com/rivet-gg/service-client-documentation-generator.git",
|
45
|
+
"@tsconfig/recommended": "1.0.1",
|
46
|
+
"@types/node": "^12.7.5",
|
47
|
+
"concurrently": "7.0.0",
|
48
|
+
"downlevel-dts": "0.7.0",
|
49
|
+
"rimraf": "^3.0.0",
|
50
|
+
"typedoc": "^0.19.2",
|
51
|
+
"typescript": "~4.6.2"
|
52
|
+
},
|
53
|
+
"engines": {
|
54
|
+
"node": ">=12.0.0"
|
55
|
+
},
|
56
|
+
"files": [
|
57
|
+
"dist-*"
|
58
|
+
],
|
59
|
+
"homepage": "https://rivet.gg/",
|
60
|
+
"license": "Apache-2.0",
|
61
|
+
"main": "./dist-cjs/index.js",
|
62
|
+
"module": "./dist-es/index.js",
|
63
|
+
"name": "@rivet-gg/chat",
|
64
|
+
"overrides": {
|
65
|
+
"typedoc": {
|
66
|
+
"typescript": "~4.6.2"
|
67
|
+
}
|
68
|
+
},
|
69
|
+
"private": false,
|
70
|
+
"react-native": {
|
71
|
+
"./dist-es/runtimeConfig": "./dist-es/runtimeConfig.native"
|
72
|
+
},
|
73
|
+
"scripts": {
|
74
|
+
"build": "yarn run build:cjs && yarn run build:es && yarn run build:types",
|
75
|
+
"build:cjs": "tsc -p tsconfig.cjs.json",
|
76
|
+
"build:docs": "typedoc",
|
77
|
+
"build:es": "tsc -p tsconfig.es.json",
|
78
|
+
"build:types": "tsc -p tsconfig.types.json",
|
79
|
+
"build:types:downlevel": "downlevel-dts dist-types dist-types/ts3.4",
|
80
|
+
"clean": "rimraf ./dist-* && rimraf *.tsbuildinfo",
|
81
|
+
"prepack": "yarn run clean && yarn run build"
|
82
|
+
},
|
83
|
+
"sideEffects": false,
|
84
|
+
"types": "./dist-types/index.d.ts",
|
85
|
+
"typesVersions": {
|
86
|
+
"<4.0": {
|
87
|
+
"dist-types/*": [
|
88
|
+
"dist-types/ts3.4/*"
|
89
|
+
]
|
90
|
+
}
|
91
|
+
},
|
92
|
+
"version": "0.0.6"
|
93
|
+
}
|