@anweather/game-plugin-ssdk 1.2.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-cjs/runtime/defaultService.js +18 -0
- package/dist-cjs/runtime/express.js +39 -0
- package/dist-cjs/runtime/index.js +7 -0
- package/dist-cjs/src/endpoint/EndpointParameters.js +12 -0
- package/dist-cjs/src/endpoint/endpointResolver.js +16 -0
- package/dist-cjs/src/endpoint/ruleset.js +38 -0
- package/dist-cjs/src/index.js +7 -0
- package/dist-cjs/src/models/index.js +4 -0
- package/dist-cjs/src/models/models_0.js +860 -0
- package/dist-cjs/src/protocols/Aws_restJson1.js +1077 -0
- package/dist-cjs/src/server/GamePluginService.js +231 -0
- package/dist-cjs/src/server/index.js +5 -0
- package/dist-cjs/src/server/operations/ApplyMove.js +109 -0
- package/dist-cjs/src/server/operations/ApplySaveFileEdit.js +109 -0
- package/dist-cjs/src/server/operations/AssignParticipants.js +101 -0
- package/dist-cjs/src/server/operations/DescribeSaveFile.js +101 -0
- package/dist-cjs/src/server/operations/GetGameResult.js +101 -0
- package/dist-cjs/src/server/operations/GetGameStatus.js +101 -0
- package/dist-cjs/src/server/operations/GetMetadata.js +99 -0
- package/dist-cjs/src/server/operations/GetPlayerView.js +101 -0
- package/dist-cjs/src/server/operations/GetSaveFileEditorState.js +101 -0
- package/dist-cjs/src/server/operations/Health.js +99 -0
- package/dist-cjs/src/server/operations/InitializeGame.js +101 -0
- package/dist-cjs/src/server/operations/IsConfigMove.js +101 -0
- package/dist-cjs/src/server/operations/IsOutOfTurnMove.js +101 -0
- package/dist-cjs/src/server/operations/SelectBotMove.js +101 -0
- package/dist-cjs/src/server/operations/ValidateMove.js +101 -0
- package/dist-cjs/src/server/operations/index.js +18 -0
- package/dist-cjs/tsconfig.cjs.tsbuildinfo +1 -0
- package/dist-es/runtime/defaultService.js +15 -0
- package/dist-es/runtime/express.js +36 -0
- package/dist-es/runtime/index.js +2 -0
- package/dist-es/src/endpoint/EndpointParameters.js +8 -0
- package/dist-es/src/endpoint/endpointResolver.js +12 -0
- package/dist-es/src/endpoint/ruleset.js +35 -0
- package/dist-es/src/index.js +3 -0
- package/dist-es/src/models/index.js +1 -0
- package/dist-es/src/models/models_0.js +855 -0
- package/dist-es/src/protocols/Aws_restJson1.js +1041 -0
- package/dist-es/src/server/GamePluginService.js +226 -0
- package/dist-es/src/server/index.js +2 -0
- package/dist-es/src/server/operations/ApplyMove.js +103 -0
- package/dist-es/src/server/operations/ApplySaveFileEdit.js +103 -0
- package/dist-es/src/server/operations/AssignParticipants.js +95 -0
- package/dist-es/src/server/operations/DescribeSaveFile.js +95 -0
- package/dist-es/src/server/operations/GetGameResult.js +95 -0
- package/dist-es/src/server/operations/GetGameStatus.js +95 -0
- package/dist-es/src/server/operations/GetMetadata.js +93 -0
- package/dist-es/src/server/operations/GetPlayerView.js +95 -0
- package/dist-es/src/server/operations/GetSaveFileEditorState.js +95 -0
- package/dist-es/src/server/operations/Health.js +93 -0
- package/dist-es/src/server/operations/InitializeGame.js +95 -0
- package/dist-es/src/server/operations/IsConfigMove.js +95 -0
- package/dist-es/src/server/operations/IsOutOfTurnMove.js +95 -0
- package/dist-es/src/server/operations/SelectBotMove.js +95 -0
- package/dist-es/src/server/operations/ValidateMove.js +95 -0
- package/dist-es/src/server/operations/index.js +15 -0
- package/dist-es/tsconfig.es.tsbuildinfo +1 -0
- package/dist-types/runtime/defaultService.d.ts +9 -0
- package/dist-types/runtime/express.d.ts +12 -0
- package/dist-types/runtime/index.d.ts +3 -0
- package/dist-types/src/endpoint/EndpointParameters.d.ts +20 -0
- package/dist-types/src/endpoint/endpointResolver.d.ts +5 -0
- package/dist-types/src/endpoint/ruleset.d.ts +2 -0
- package/dist-types/src/index.d.ts +22 -0
- package/dist-types/src/models/index.d.ts +1 -0
- package/dist-types/src/models/models_0.d.ts +402 -0
- package/dist-types/src/protocols/Aws_restJson1.d.ts +52 -0
- package/dist-types/src/server/GamePluginService.d.ts +54 -0
- package/dist-types/src/server/index.d.ts +2 -0
- package/dist-types/src/server/operations/ApplyMove.d.ts +41 -0
- package/dist-types/src/server/operations/ApplySaveFileEdit.d.ts +41 -0
- package/dist-types/src/server/operations/AssignParticipants.d.ts +41 -0
- package/dist-types/src/server/operations/DescribeSaveFile.d.ts +41 -0
- package/dist-types/src/server/operations/GetGameResult.d.ts +41 -0
- package/dist-types/src/server/operations/GetGameStatus.d.ts +41 -0
- package/dist-types/src/server/operations/GetMetadata.d.ts +41 -0
- package/dist-types/src/server/operations/GetPlayerView.d.ts +41 -0
- package/dist-types/src/server/operations/GetSaveFileEditorState.d.ts +41 -0
- package/dist-types/src/server/operations/Health.d.ts +41 -0
- package/dist-types/src/server/operations/InitializeGame.d.ts +41 -0
- package/dist-types/src/server/operations/IsConfigMove.d.ts +41 -0
- package/dist-types/src/server/operations/IsOutOfTurnMove.d.ts +41 -0
- package/dist-types/src/server/operations/SelectBotMove.d.ts +41 -0
- package/dist-types/src/server/operations/ValidateMove.d.ts +41 -0
- package/dist-types/src/server/operations/index.d.ts +15 -0
- package/package.json +88 -0
- package/runtime/package.json +5 -0
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GetGameResultHandler = exports.getGetGameResultHandler = exports.GetGameResultSerializer = exports.GetGameResultServerInput = void 0;
|
|
4
|
+
const models_0_1 = require("../../models/models_0");
|
|
5
|
+
const Aws_restJson1_1 = require("../../protocols/Aws_restJson1");
|
|
6
|
+
const server_common_1 = require("@aws-smithy/server-common");
|
|
7
|
+
const node_http_handler_1 = require("@smithy/node-http-handler");
|
|
8
|
+
const util_base64_1 = require("@smithy/util-base64");
|
|
9
|
+
const util_utf8_1 = require("@smithy/util-utf8");
|
|
10
|
+
var GetGameResultServerInput;
|
|
11
|
+
(function (GetGameResultServerInput) {
|
|
12
|
+
GetGameResultServerInput.validate = models_0_1.PluginStateOnlyInput.validate;
|
|
13
|
+
})(GetGameResultServerInput || (exports.GetGameResultServerInput = GetGameResultServerInput = {}));
|
|
14
|
+
class GetGameResultSerializer {
|
|
15
|
+
serialize = Aws_restJson1_1.serializeGetGameResultResponse;
|
|
16
|
+
deserialize = Aws_restJson1_1.deserializeGetGameResultRequest;
|
|
17
|
+
isOperationError(error) {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
;
|
|
21
|
+
serializeError(error, ctx) {
|
|
22
|
+
throw error;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.GetGameResultSerializer = GetGameResultSerializer;
|
|
26
|
+
const getGetGameResultHandler = (operation, customizer) => {
|
|
27
|
+
const mux = new server_common_1.httpbinding.HttpBindingMux([
|
|
28
|
+
new server_common_1.httpbinding.UriSpec('POST', [
|
|
29
|
+
{ type: 'path_literal', value: "v1" },
|
|
30
|
+
{ type: 'path_literal', value: "games" },
|
|
31
|
+
{ type: 'path_literal', value: "result" },
|
|
32
|
+
], [], { service: "GamePlugin", operation: "GetGameResult" }),
|
|
33
|
+
]);
|
|
34
|
+
return new GetGameResultHandler(operation, mux, new GetGameResultSerializer(), Aws_restJson1_1.serializeFrameworkException, customizer);
|
|
35
|
+
};
|
|
36
|
+
exports.getGetGameResultHandler = getGetGameResultHandler;
|
|
37
|
+
const serdeContextBase = {
|
|
38
|
+
base64Encoder: util_base64_1.toBase64,
|
|
39
|
+
base64Decoder: util_base64_1.fromBase64,
|
|
40
|
+
utf8Encoder: util_utf8_1.toUtf8,
|
|
41
|
+
utf8Decoder: util_utf8_1.fromUtf8,
|
|
42
|
+
streamCollector: node_http_handler_1.streamCollector,
|
|
43
|
+
requestHandler: new node_http_handler_1.NodeHttpHandler(),
|
|
44
|
+
disableHostPrefix: true
|
|
45
|
+
};
|
|
46
|
+
async function handle(request, context, operationName, serializer, operation, serializeFrameworkException, validationFn, validationCustomizer) {
|
|
47
|
+
let input;
|
|
48
|
+
try {
|
|
49
|
+
input = await serializer.deserialize(request, {
|
|
50
|
+
endpoint: () => Promise.resolve(request), ...serdeContextBase
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
if ((0, server_common_1.isFrameworkException)(error)) {
|
|
55
|
+
return serializeFrameworkException(error, serdeContextBase);
|
|
56
|
+
}
|
|
57
|
+
;
|
|
58
|
+
return serializeFrameworkException(new server_common_1.SerializationException(), serdeContextBase);
|
|
59
|
+
}
|
|
60
|
+
try {
|
|
61
|
+
let validationFailures = validationFn(input);
|
|
62
|
+
if (validationFailures && validationFailures.length > 0) {
|
|
63
|
+
let validationException = validationCustomizer({ operation: operationName }, validationFailures);
|
|
64
|
+
if (validationException) {
|
|
65
|
+
return serializer.serializeError(validationException, serdeContextBase);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
let output = await operation(input, context);
|
|
69
|
+
return serializer.serialize(output, serdeContextBase);
|
|
70
|
+
}
|
|
71
|
+
catch (error) {
|
|
72
|
+
if (serializer.isOperationError(error)) {
|
|
73
|
+
return serializer.serializeError(error, serdeContextBase);
|
|
74
|
+
}
|
|
75
|
+
console.log('Received an unexpected error', error);
|
|
76
|
+
return serializeFrameworkException(new server_common_1.InternalFailureException(), serdeContextBase);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
class GetGameResultHandler {
|
|
80
|
+
operation;
|
|
81
|
+
mux;
|
|
82
|
+
serializer;
|
|
83
|
+
serializeFrameworkException;
|
|
84
|
+
validationCustomizer;
|
|
85
|
+
constructor(operation, mux, serializer, serializeFrameworkException, validationCustomizer) {
|
|
86
|
+
this.operation = operation;
|
|
87
|
+
this.mux = mux;
|
|
88
|
+
this.serializer = serializer;
|
|
89
|
+
this.serializeFrameworkException = serializeFrameworkException;
|
|
90
|
+
this.validationCustomizer = validationCustomizer;
|
|
91
|
+
}
|
|
92
|
+
async handle(request, context) {
|
|
93
|
+
const target = this.mux.match(request);
|
|
94
|
+
if (target === undefined) {
|
|
95
|
+
console.log('Received a request that did not match com.boardgame.plugin#GamePlugin.GetGameResult. This indicates a misconfiguration.');
|
|
96
|
+
return this.serializeFrameworkException(new server_common_1.InternalFailureException(), serdeContextBase);
|
|
97
|
+
}
|
|
98
|
+
return handle(request, context, "GetGameResult", this.serializer, this.operation, this.serializeFrameworkException, GetGameResultServerInput.validate, this.validationCustomizer);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
exports.GetGameResultHandler = GetGameResultHandler;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GetGameStatusHandler = exports.getGetGameStatusHandler = exports.GetGameStatusSerializer = exports.GetGameStatusServerInput = void 0;
|
|
4
|
+
const models_0_1 = require("../../models/models_0");
|
|
5
|
+
const Aws_restJson1_1 = require("../../protocols/Aws_restJson1");
|
|
6
|
+
const server_common_1 = require("@aws-smithy/server-common");
|
|
7
|
+
const node_http_handler_1 = require("@smithy/node-http-handler");
|
|
8
|
+
const util_base64_1 = require("@smithy/util-base64");
|
|
9
|
+
const util_utf8_1 = require("@smithy/util-utf8");
|
|
10
|
+
var GetGameStatusServerInput;
|
|
11
|
+
(function (GetGameStatusServerInput) {
|
|
12
|
+
GetGameStatusServerInput.validate = models_0_1.PluginStateOnlyInput.validate;
|
|
13
|
+
})(GetGameStatusServerInput || (exports.GetGameStatusServerInput = GetGameStatusServerInput = {}));
|
|
14
|
+
class GetGameStatusSerializer {
|
|
15
|
+
serialize = Aws_restJson1_1.serializeGetGameStatusResponse;
|
|
16
|
+
deserialize = Aws_restJson1_1.deserializeGetGameStatusRequest;
|
|
17
|
+
isOperationError(error) {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
;
|
|
21
|
+
serializeError(error, ctx) {
|
|
22
|
+
throw error;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.GetGameStatusSerializer = GetGameStatusSerializer;
|
|
26
|
+
const getGetGameStatusHandler = (operation, customizer) => {
|
|
27
|
+
const mux = new server_common_1.httpbinding.HttpBindingMux([
|
|
28
|
+
new server_common_1.httpbinding.UriSpec('POST', [
|
|
29
|
+
{ type: 'path_literal', value: "v1" },
|
|
30
|
+
{ type: 'path_literal', value: "games" },
|
|
31
|
+
{ type: 'path_literal', value: "status" },
|
|
32
|
+
], [], { service: "GamePlugin", operation: "GetGameStatus" }),
|
|
33
|
+
]);
|
|
34
|
+
return new GetGameStatusHandler(operation, mux, new GetGameStatusSerializer(), Aws_restJson1_1.serializeFrameworkException, customizer);
|
|
35
|
+
};
|
|
36
|
+
exports.getGetGameStatusHandler = getGetGameStatusHandler;
|
|
37
|
+
const serdeContextBase = {
|
|
38
|
+
base64Encoder: util_base64_1.toBase64,
|
|
39
|
+
base64Decoder: util_base64_1.fromBase64,
|
|
40
|
+
utf8Encoder: util_utf8_1.toUtf8,
|
|
41
|
+
utf8Decoder: util_utf8_1.fromUtf8,
|
|
42
|
+
streamCollector: node_http_handler_1.streamCollector,
|
|
43
|
+
requestHandler: new node_http_handler_1.NodeHttpHandler(),
|
|
44
|
+
disableHostPrefix: true
|
|
45
|
+
};
|
|
46
|
+
async function handle(request, context, operationName, serializer, operation, serializeFrameworkException, validationFn, validationCustomizer) {
|
|
47
|
+
let input;
|
|
48
|
+
try {
|
|
49
|
+
input = await serializer.deserialize(request, {
|
|
50
|
+
endpoint: () => Promise.resolve(request), ...serdeContextBase
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
if ((0, server_common_1.isFrameworkException)(error)) {
|
|
55
|
+
return serializeFrameworkException(error, serdeContextBase);
|
|
56
|
+
}
|
|
57
|
+
;
|
|
58
|
+
return serializeFrameworkException(new server_common_1.SerializationException(), serdeContextBase);
|
|
59
|
+
}
|
|
60
|
+
try {
|
|
61
|
+
let validationFailures = validationFn(input);
|
|
62
|
+
if (validationFailures && validationFailures.length > 0) {
|
|
63
|
+
let validationException = validationCustomizer({ operation: operationName }, validationFailures);
|
|
64
|
+
if (validationException) {
|
|
65
|
+
return serializer.serializeError(validationException, serdeContextBase);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
let output = await operation(input, context);
|
|
69
|
+
return serializer.serialize(output, serdeContextBase);
|
|
70
|
+
}
|
|
71
|
+
catch (error) {
|
|
72
|
+
if (serializer.isOperationError(error)) {
|
|
73
|
+
return serializer.serializeError(error, serdeContextBase);
|
|
74
|
+
}
|
|
75
|
+
console.log('Received an unexpected error', error);
|
|
76
|
+
return serializeFrameworkException(new server_common_1.InternalFailureException(), serdeContextBase);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
class GetGameStatusHandler {
|
|
80
|
+
operation;
|
|
81
|
+
mux;
|
|
82
|
+
serializer;
|
|
83
|
+
serializeFrameworkException;
|
|
84
|
+
validationCustomizer;
|
|
85
|
+
constructor(operation, mux, serializer, serializeFrameworkException, validationCustomizer) {
|
|
86
|
+
this.operation = operation;
|
|
87
|
+
this.mux = mux;
|
|
88
|
+
this.serializer = serializer;
|
|
89
|
+
this.serializeFrameworkException = serializeFrameworkException;
|
|
90
|
+
this.validationCustomizer = validationCustomizer;
|
|
91
|
+
}
|
|
92
|
+
async handle(request, context) {
|
|
93
|
+
const target = this.mux.match(request);
|
|
94
|
+
if (target === undefined) {
|
|
95
|
+
console.log('Received a request that did not match com.boardgame.plugin#GamePlugin.GetGameStatus. This indicates a misconfiguration.');
|
|
96
|
+
return this.serializeFrameworkException(new server_common_1.InternalFailureException(), serdeContextBase);
|
|
97
|
+
}
|
|
98
|
+
return handle(request, context, "GetGameStatus", this.serializer, this.operation, this.serializeFrameworkException, GetGameStatusServerInput.validate, this.validationCustomizer);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
exports.GetGameStatusHandler = GetGameStatusHandler;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GetMetadataHandler = exports.getGetMetadataHandler = exports.GetMetadataSerializer = exports.GetMetadataServerInput = void 0;
|
|
4
|
+
const Aws_restJson1_1 = require("../../protocols/Aws_restJson1");
|
|
5
|
+
const server_common_1 = require("@aws-smithy/server-common");
|
|
6
|
+
const node_http_handler_1 = require("@smithy/node-http-handler");
|
|
7
|
+
const util_base64_1 = require("@smithy/util-base64");
|
|
8
|
+
const util_utf8_1 = require("@smithy/util-utf8");
|
|
9
|
+
var GetMetadataServerInput;
|
|
10
|
+
(function (GetMetadataServerInput) {
|
|
11
|
+
GetMetadataServerInput.validate = () => [];
|
|
12
|
+
})(GetMetadataServerInput || (exports.GetMetadataServerInput = GetMetadataServerInput = {}));
|
|
13
|
+
class GetMetadataSerializer {
|
|
14
|
+
serialize = Aws_restJson1_1.serializeGetMetadataResponse;
|
|
15
|
+
deserialize = Aws_restJson1_1.deserializeGetMetadataRequest;
|
|
16
|
+
isOperationError(error) {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
;
|
|
20
|
+
serializeError(error, ctx) {
|
|
21
|
+
throw error;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.GetMetadataSerializer = GetMetadataSerializer;
|
|
25
|
+
const getGetMetadataHandler = (operation, customizer) => {
|
|
26
|
+
const mux = new server_common_1.httpbinding.HttpBindingMux([
|
|
27
|
+
new server_common_1.httpbinding.UriSpec('GET', [
|
|
28
|
+
{ type: 'path_literal', value: "v1" },
|
|
29
|
+
{ type: 'path_literal', value: "metadata" },
|
|
30
|
+
], [], { service: "GamePlugin", operation: "GetMetadata" }),
|
|
31
|
+
]);
|
|
32
|
+
return new GetMetadataHandler(operation, mux, new GetMetadataSerializer(), Aws_restJson1_1.serializeFrameworkException, customizer);
|
|
33
|
+
};
|
|
34
|
+
exports.getGetMetadataHandler = getGetMetadataHandler;
|
|
35
|
+
const serdeContextBase = {
|
|
36
|
+
base64Encoder: util_base64_1.toBase64,
|
|
37
|
+
base64Decoder: util_base64_1.fromBase64,
|
|
38
|
+
utf8Encoder: util_utf8_1.toUtf8,
|
|
39
|
+
utf8Decoder: util_utf8_1.fromUtf8,
|
|
40
|
+
streamCollector: node_http_handler_1.streamCollector,
|
|
41
|
+
requestHandler: new node_http_handler_1.NodeHttpHandler(),
|
|
42
|
+
disableHostPrefix: true
|
|
43
|
+
};
|
|
44
|
+
async function handle(request, context, operationName, serializer, operation, serializeFrameworkException, validationFn, validationCustomizer) {
|
|
45
|
+
let input;
|
|
46
|
+
try {
|
|
47
|
+
input = await serializer.deserialize(request, {
|
|
48
|
+
endpoint: () => Promise.resolve(request), ...serdeContextBase
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
if ((0, server_common_1.isFrameworkException)(error)) {
|
|
53
|
+
return serializeFrameworkException(error, serdeContextBase);
|
|
54
|
+
}
|
|
55
|
+
;
|
|
56
|
+
return serializeFrameworkException(new server_common_1.SerializationException(), serdeContextBase);
|
|
57
|
+
}
|
|
58
|
+
try {
|
|
59
|
+
let validationFailures = validationFn(input);
|
|
60
|
+
if (validationFailures && validationFailures.length > 0) {
|
|
61
|
+
let validationException = validationCustomizer({ operation: operationName }, validationFailures);
|
|
62
|
+
if (validationException) {
|
|
63
|
+
return serializer.serializeError(validationException, serdeContextBase);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
let output = await operation(input, context);
|
|
67
|
+
return serializer.serialize(output, serdeContextBase);
|
|
68
|
+
}
|
|
69
|
+
catch (error) {
|
|
70
|
+
if (serializer.isOperationError(error)) {
|
|
71
|
+
return serializer.serializeError(error, serdeContextBase);
|
|
72
|
+
}
|
|
73
|
+
console.log('Received an unexpected error', error);
|
|
74
|
+
return serializeFrameworkException(new server_common_1.InternalFailureException(), serdeContextBase);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
class GetMetadataHandler {
|
|
78
|
+
operation;
|
|
79
|
+
mux;
|
|
80
|
+
serializer;
|
|
81
|
+
serializeFrameworkException;
|
|
82
|
+
validationCustomizer;
|
|
83
|
+
constructor(operation, mux, serializer, serializeFrameworkException, validationCustomizer) {
|
|
84
|
+
this.operation = operation;
|
|
85
|
+
this.mux = mux;
|
|
86
|
+
this.serializer = serializer;
|
|
87
|
+
this.serializeFrameworkException = serializeFrameworkException;
|
|
88
|
+
this.validationCustomizer = validationCustomizer;
|
|
89
|
+
}
|
|
90
|
+
async handle(request, context) {
|
|
91
|
+
const target = this.mux.match(request);
|
|
92
|
+
if (target === undefined) {
|
|
93
|
+
console.log('Received a request that did not match com.boardgame.plugin#GamePlugin.GetMetadata. This indicates a misconfiguration.');
|
|
94
|
+
return this.serializeFrameworkException(new server_common_1.InternalFailureException(), serdeContextBase);
|
|
95
|
+
}
|
|
96
|
+
return handle(request, context, "GetMetadata", this.serializer, this.operation, this.serializeFrameworkException, GetMetadataServerInput.validate, this.validationCustomizer);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
exports.GetMetadataHandler = GetMetadataHandler;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GetPlayerViewHandler = exports.getGetPlayerViewHandler = exports.GetPlayerViewSerializer = exports.GetPlayerViewServerInput = void 0;
|
|
4
|
+
const models_0_1 = require("../../models/models_0");
|
|
5
|
+
const Aws_restJson1_1 = require("../../protocols/Aws_restJson1");
|
|
6
|
+
const server_common_1 = require("@aws-smithy/server-common");
|
|
7
|
+
const node_http_handler_1 = require("@smithy/node-http-handler");
|
|
8
|
+
const util_base64_1 = require("@smithy/util-base64");
|
|
9
|
+
const util_utf8_1 = require("@smithy/util-utf8");
|
|
10
|
+
var GetPlayerViewServerInput;
|
|
11
|
+
(function (GetPlayerViewServerInput) {
|
|
12
|
+
GetPlayerViewServerInput.validate = models_0_1.GetPlayerViewInput.validate;
|
|
13
|
+
})(GetPlayerViewServerInput || (exports.GetPlayerViewServerInput = GetPlayerViewServerInput = {}));
|
|
14
|
+
class GetPlayerViewSerializer {
|
|
15
|
+
serialize = Aws_restJson1_1.serializeGetPlayerViewResponse;
|
|
16
|
+
deserialize = Aws_restJson1_1.deserializeGetPlayerViewRequest;
|
|
17
|
+
isOperationError(error) {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
;
|
|
21
|
+
serializeError(error, ctx) {
|
|
22
|
+
throw error;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.GetPlayerViewSerializer = GetPlayerViewSerializer;
|
|
26
|
+
const getGetPlayerViewHandler = (operation, customizer) => {
|
|
27
|
+
const mux = new server_common_1.httpbinding.HttpBindingMux([
|
|
28
|
+
new server_common_1.httpbinding.UriSpec('POST', [
|
|
29
|
+
{ type: 'path_literal', value: "v1" },
|
|
30
|
+
{ type: 'path_literal', value: "games" },
|
|
31
|
+
{ type: 'path_literal', value: "player-view" },
|
|
32
|
+
], [], { service: "GamePlugin", operation: "GetPlayerView" }),
|
|
33
|
+
]);
|
|
34
|
+
return new GetPlayerViewHandler(operation, mux, new GetPlayerViewSerializer(), Aws_restJson1_1.serializeFrameworkException, customizer);
|
|
35
|
+
};
|
|
36
|
+
exports.getGetPlayerViewHandler = getGetPlayerViewHandler;
|
|
37
|
+
const serdeContextBase = {
|
|
38
|
+
base64Encoder: util_base64_1.toBase64,
|
|
39
|
+
base64Decoder: util_base64_1.fromBase64,
|
|
40
|
+
utf8Encoder: util_utf8_1.toUtf8,
|
|
41
|
+
utf8Decoder: util_utf8_1.fromUtf8,
|
|
42
|
+
streamCollector: node_http_handler_1.streamCollector,
|
|
43
|
+
requestHandler: new node_http_handler_1.NodeHttpHandler(),
|
|
44
|
+
disableHostPrefix: true
|
|
45
|
+
};
|
|
46
|
+
async function handle(request, context, operationName, serializer, operation, serializeFrameworkException, validationFn, validationCustomizer) {
|
|
47
|
+
let input;
|
|
48
|
+
try {
|
|
49
|
+
input = await serializer.deserialize(request, {
|
|
50
|
+
endpoint: () => Promise.resolve(request), ...serdeContextBase
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
if ((0, server_common_1.isFrameworkException)(error)) {
|
|
55
|
+
return serializeFrameworkException(error, serdeContextBase);
|
|
56
|
+
}
|
|
57
|
+
;
|
|
58
|
+
return serializeFrameworkException(new server_common_1.SerializationException(), serdeContextBase);
|
|
59
|
+
}
|
|
60
|
+
try {
|
|
61
|
+
let validationFailures = validationFn(input);
|
|
62
|
+
if (validationFailures && validationFailures.length > 0) {
|
|
63
|
+
let validationException = validationCustomizer({ operation: operationName }, validationFailures);
|
|
64
|
+
if (validationException) {
|
|
65
|
+
return serializer.serializeError(validationException, serdeContextBase);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
let output = await operation(input, context);
|
|
69
|
+
return serializer.serialize(output, serdeContextBase);
|
|
70
|
+
}
|
|
71
|
+
catch (error) {
|
|
72
|
+
if (serializer.isOperationError(error)) {
|
|
73
|
+
return serializer.serializeError(error, serdeContextBase);
|
|
74
|
+
}
|
|
75
|
+
console.log('Received an unexpected error', error);
|
|
76
|
+
return serializeFrameworkException(new server_common_1.InternalFailureException(), serdeContextBase);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
class GetPlayerViewHandler {
|
|
80
|
+
operation;
|
|
81
|
+
mux;
|
|
82
|
+
serializer;
|
|
83
|
+
serializeFrameworkException;
|
|
84
|
+
validationCustomizer;
|
|
85
|
+
constructor(operation, mux, serializer, serializeFrameworkException, validationCustomizer) {
|
|
86
|
+
this.operation = operation;
|
|
87
|
+
this.mux = mux;
|
|
88
|
+
this.serializer = serializer;
|
|
89
|
+
this.serializeFrameworkException = serializeFrameworkException;
|
|
90
|
+
this.validationCustomizer = validationCustomizer;
|
|
91
|
+
}
|
|
92
|
+
async handle(request, context) {
|
|
93
|
+
const target = this.mux.match(request);
|
|
94
|
+
if (target === undefined) {
|
|
95
|
+
console.log('Received a request that did not match com.boardgame.plugin#GamePlugin.GetPlayerView. This indicates a misconfiguration.');
|
|
96
|
+
return this.serializeFrameworkException(new server_common_1.InternalFailureException(), serdeContextBase);
|
|
97
|
+
}
|
|
98
|
+
return handle(request, context, "GetPlayerView", this.serializer, this.operation, this.serializeFrameworkException, GetPlayerViewServerInput.validate, this.validationCustomizer);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
exports.GetPlayerViewHandler = GetPlayerViewHandler;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GetSaveFileEditorStateHandler = exports.getGetSaveFileEditorStateHandler = exports.GetSaveFileEditorStateSerializer = exports.GetSaveFileEditorStateServerInput = void 0;
|
|
4
|
+
const models_0_1 = require("../../models/models_0");
|
|
5
|
+
const Aws_restJson1_1 = require("../../protocols/Aws_restJson1");
|
|
6
|
+
const server_common_1 = require("@aws-smithy/server-common");
|
|
7
|
+
const node_http_handler_1 = require("@smithy/node-http-handler");
|
|
8
|
+
const util_base64_1 = require("@smithy/util-base64");
|
|
9
|
+
const util_utf8_1 = require("@smithy/util-utf8");
|
|
10
|
+
var GetSaveFileEditorStateServerInput;
|
|
11
|
+
(function (GetSaveFileEditorStateServerInput) {
|
|
12
|
+
GetSaveFileEditorStateServerInput.validate = models_0_1.GetSaveFileEditorStateInput.validate;
|
|
13
|
+
})(GetSaveFileEditorStateServerInput || (exports.GetSaveFileEditorStateServerInput = GetSaveFileEditorStateServerInput = {}));
|
|
14
|
+
class GetSaveFileEditorStateSerializer {
|
|
15
|
+
serialize = Aws_restJson1_1.serializeGetSaveFileEditorStateResponse;
|
|
16
|
+
deserialize = Aws_restJson1_1.deserializeGetSaveFileEditorStateRequest;
|
|
17
|
+
isOperationError(error) {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
;
|
|
21
|
+
serializeError(error, ctx) {
|
|
22
|
+
throw error;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.GetSaveFileEditorStateSerializer = GetSaveFileEditorStateSerializer;
|
|
26
|
+
const getGetSaveFileEditorStateHandler = (operation, customizer) => {
|
|
27
|
+
const mux = new server_common_1.httpbinding.HttpBindingMux([
|
|
28
|
+
new server_common_1.httpbinding.UriSpec('POST', [
|
|
29
|
+
{ type: 'path_literal', value: "v1" },
|
|
30
|
+
{ type: 'path_literal', value: "saves" },
|
|
31
|
+
{ type: 'path_literal', value: "editor-state" },
|
|
32
|
+
], [], { service: "GamePlugin", operation: "GetSaveFileEditorState" }),
|
|
33
|
+
]);
|
|
34
|
+
return new GetSaveFileEditorStateHandler(operation, mux, new GetSaveFileEditorStateSerializer(), Aws_restJson1_1.serializeFrameworkException, customizer);
|
|
35
|
+
};
|
|
36
|
+
exports.getGetSaveFileEditorStateHandler = getGetSaveFileEditorStateHandler;
|
|
37
|
+
const serdeContextBase = {
|
|
38
|
+
base64Encoder: util_base64_1.toBase64,
|
|
39
|
+
base64Decoder: util_base64_1.fromBase64,
|
|
40
|
+
utf8Encoder: util_utf8_1.toUtf8,
|
|
41
|
+
utf8Decoder: util_utf8_1.fromUtf8,
|
|
42
|
+
streamCollector: node_http_handler_1.streamCollector,
|
|
43
|
+
requestHandler: new node_http_handler_1.NodeHttpHandler(),
|
|
44
|
+
disableHostPrefix: true
|
|
45
|
+
};
|
|
46
|
+
async function handle(request, context, operationName, serializer, operation, serializeFrameworkException, validationFn, validationCustomizer) {
|
|
47
|
+
let input;
|
|
48
|
+
try {
|
|
49
|
+
input = await serializer.deserialize(request, {
|
|
50
|
+
endpoint: () => Promise.resolve(request), ...serdeContextBase
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
if ((0, server_common_1.isFrameworkException)(error)) {
|
|
55
|
+
return serializeFrameworkException(error, serdeContextBase);
|
|
56
|
+
}
|
|
57
|
+
;
|
|
58
|
+
return serializeFrameworkException(new server_common_1.SerializationException(), serdeContextBase);
|
|
59
|
+
}
|
|
60
|
+
try {
|
|
61
|
+
let validationFailures = validationFn(input);
|
|
62
|
+
if (validationFailures && validationFailures.length > 0) {
|
|
63
|
+
let validationException = validationCustomizer({ operation: operationName }, validationFailures);
|
|
64
|
+
if (validationException) {
|
|
65
|
+
return serializer.serializeError(validationException, serdeContextBase);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
let output = await operation(input, context);
|
|
69
|
+
return serializer.serialize(output, serdeContextBase);
|
|
70
|
+
}
|
|
71
|
+
catch (error) {
|
|
72
|
+
if (serializer.isOperationError(error)) {
|
|
73
|
+
return serializer.serializeError(error, serdeContextBase);
|
|
74
|
+
}
|
|
75
|
+
console.log('Received an unexpected error', error);
|
|
76
|
+
return serializeFrameworkException(new server_common_1.InternalFailureException(), serdeContextBase);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
class GetSaveFileEditorStateHandler {
|
|
80
|
+
operation;
|
|
81
|
+
mux;
|
|
82
|
+
serializer;
|
|
83
|
+
serializeFrameworkException;
|
|
84
|
+
validationCustomizer;
|
|
85
|
+
constructor(operation, mux, serializer, serializeFrameworkException, validationCustomizer) {
|
|
86
|
+
this.operation = operation;
|
|
87
|
+
this.mux = mux;
|
|
88
|
+
this.serializer = serializer;
|
|
89
|
+
this.serializeFrameworkException = serializeFrameworkException;
|
|
90
|
+
this.validationCustomizer = validationCustomizer;
|
|
91
|
+
}
|
|
92
|
+
async handle(request, context) {
|
|
93
|
+
const target = this.mux.match(request);
|
|
94
|
+
if (target === undefined) {
|
|
95
|
+
console.log('Received a request that did not match com.boardgame.plugin#GamePlugin.GetSaveFileEditorState. This indicates a misconfiguration.');
|
|
96
|
+
return this.serializeFrameworkException(new server_common_1.InternalFailureException(), serdeContextBase);
|
|
97
|
+
}
|
|
98
|
+
return handle(request, context, "GetSaveFileEditorState", this.serializer, this.operation, this.serializeFrameworkException, GetSaveFileEditorStateServerInput.validate, this.validationCustomizer);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
exports.GetSaveFileEditorStateHandler = GetSaveFileEditorStateHandler;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HealthHandler = exports.getHealthHandler = exports.HealthSerializer = exports.HealthServerInput = void 0;
|
|
4
|
+
const Aws_restJson1_1 = require("../../protocols/Aws_restJson1");
|
|
5
|
+
const server_common_1 = require("@aws-smithy/server-common");
|
|
6
|
+
const node_http_handler_1 = require("@smithy/node-http-handler");
|
|
7
|
+
const util_base64_1 = require("@smithy/util-base64");
|
|
8
|
+
const util_utf8_1 = require("@smithy/util-utf8");
|
|
9
|
+
var HealthServerInput;
|
|
10
|
+
(function (HealthServerInput) {
|
|
11
|
+
HealthServerInput.validate = () => [];
|
|
12
|
+
})(HealthServerInput || (exports.HealthServerInput = HealthServerInput = {}));
|
|
13
|
+
class HealthSerializer {
|
|
14
|
+
serialize = Aws_restJson1_1.serializeHealthResponse;
|
|
15
|
+
deserialize = Aws_restJson1_1.deserializeHealthRequest;
|
|
16
|
+
isOperationError(error) {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
;
|
|
20
|
+
serializeError(error, ctx) {
|
|
21
|
+
throw error;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.HealthSerializer = HealthSerializer;
|
|
25
|
+
const getHealthHandler = (operation, customizer) => {
|
|
26
|
+
const mux = new server_common_1.httpbinding.HttpBindingMux([
|
|
27
|
+
new server_common_1.httpbinding.UriSpec('GET', [
|
|
28
|
+
{ type: 'path_literal', value: "v1" },
|
|
29
|
+
{ type: 'path_literal', value: "health" },
|
|
30
|
+
], [], { service: "GamePlugin", operation: "Health" }),
|
|
31
|
+
]);
|
|
32
|
+
return new HealthHandler(operation, mux, new HealthSerializer(), Aws_restJson1_1.serializeFrameworkException, customizer);
|
|
33
|
+
};
|
|
34
|
+
exports.getHealthHandler = getHealthHandler;
|
|
35
|
+
const serdeContextBase = {
|
|
36
|
+
base64Encoder: util_base64_1.toBase64,
|
|
37
|
+
base64Decoder: util_base64_1.fromBase64,
|
|
38
|
+
utf8Encoder: util_utf8_1.toUtf8,
|
|
39
|
+
utf8Decoder: util_utf8_1.fromUtf8,
|
|
40
|
+
streamCollector: node_http_handler_1.streamCollector,
|
|
41
|
+
requestHandler: new node_http_handler_1.NodeHttpHandler(),
|
|
42
|
+
disableHostPrefix: true
|
|
43
|
+
};
|
|
44
|
+
async function handle(request, context, operationName, serializer, operation, serializeFrameworkException, validationFn, validationCustomizer) {
|
|
45
|
+
let input;
|
|
46
|
+
try {
|
|
47
|
+
input = await serializer.deserialize(request, {
|
|
48
|
+
endpoint: () => Promise.resolve(request), ...serdeContextBase
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
if ((0, server_common_1.isFrameworkException)(error)) {
|
|
53
|
+
return serializeFrameworkException(error, serdeContextBase);
|
|
54
|
+
}
|
|
55
|
+
;
|
|
56
|
+
return serializeFrameworkException(new server_common_1.SerializationException(), serdeContextBase);
|
|
57
|
+
}
|
|
58
|
+
try {
|
|
59
|
+
let validationFailures = validationFn(input);
|
|
60
|
+
if (validationFailures && validationFailures.length > 0) {
|
|
61
|
+
let validationException = validationCustomizer({ operation: operationName }, validationFailures);
|
|
62
|
+
if (validationException) {
|
|
63
|
+
return serializer.serializeError(validationException, serdeContextBase);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
let output = await operation(input, context);
|
|
67
|
+
return serializer.serialize(output, serdeContextBase);
|
|
68
|
+
}
|
|
69
|
+
catch (error) {
|
|
70
|
+
if (serializer.isOperationError(error)) {
|
|
71
|
+
return serializer.serializeError(error, serdeContextBase);
|
|
72
|
+
}
|
|
73
|
+
console.log('Received an unexpected error', error);
|
|
74
|
+
return serializeFrameworkException(new server_common_1.InternalFailureException(), serdeContextBase);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
class HealthHandler {
|
|
78
|
+
operation;
|
|
79
|
+
mux;
|
|
80
|
+
serializer;
|
|
81
|
+
serializeFrameworkException;
|
|
82
|
+
validationCustomizer;
|
|
83
|
+
constructor(operation, mux, serializer, serializeFrameworkException, validationCustomizer) {
|
|
84
|
+
this.operation = operation;
|
|
85
|
+
this.mux = mux;
|
|
86
|
+
this.serializer = serializer;
|
|
87
|
+
this.serializeFrameworkException = serializeFrameworkException;
|
|
88
|
+
this.validationCustomizer = validationCustomizer;
|
|
89
|
+
}
|
|
90
|
+
async handle(request, context) {
|
|
91
|
+
const target = this.mux.match(request);
|
|
92
|
+
if (target === undefined) {
|
|
93
|
+
console.log('Received a request that did not match com.boardgame.plugin#GamePlugin.Health. This indicates a misconfiguration.');
|
|
94
|
+
return this.serializeFrameworkException(new server_common_1.InternalFailureException(), serdeContextBase);
|
|
95
|
+
}
|
|
96
|
+
return handle(request, context, "Health", this.serializer, this.operation, this.serializeFrameworkException, HealthServerInput.validate, this.validationCustomizer);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
exports.HealthHandler = HealthHandler;
|