@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.InitializeGameHandler = exports.getInitializeGameHandler = exports.InitializeGameSerializer = exports.InitializeGameServerInput = 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 InitializeGameServerInput;
|
|
11
|
+
(function (InitializeGameServerInput) {
|
|
12
|
+
InitializeGameServerInput.validate = models_0_1.InitializeGameInput.validate;
|
|
13
|
+
})(InitializeGameServerInput || (exports.InitializeGameServerInput = InitializeGameServerInput = {}));
|
|
14
|
+
class InitializeGameSerializer {
|
|
15
|
+
serialize = Aws_restJson1_1.serializeInitializeGameResponse;
|
|
16
|
+
deserialize = Aws_restJson1_1.deserializeInitializeGameRequest;
|
|
17
|
+
isOperationError(error) {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
;
|
|
21
|
+
serializeError(error, ctx) {
|
|
22
|
+
throw error;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.InitializeGameSerializer = InitializeGameSerializer;
|
|
26
|
+
const getInitializeGameHandler = (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: "initialize" },
|
|
32
|
+
], [], { service: "GamePlugin", operation: "InitializeGame" }),
|
|
33
|
+
]);
|
|
34
|
+
return new InitializeGameHandler(operation, mux, new InitializeGameSerializer(), Aws_restJson1_1.serializeFrameworkException, customizer);
|
|
35
|
+
};
|
|
36
|
+
exports.getInitializeGameHandler = getInitializeGameHandler;
|
|
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 InitializeGameHandler {
|
|
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.InitializeGame. This indicates a misconfiguration.');
|
|
96
|
+
return this.serializeFrameworkException(new server_common_1.InternalFailureException(), serdeContextBase);
|
|
97
|
+
}
|
|
98
|
+
return handle(request, context, "InitializeGame", this.serializer, this.operation, this.serializeFrameworkException, InitializeGameServerInput.validate, this.validationCustomizer);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
exports.InitializeGameHandler = InitializeGameHandler;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.IsConfigMoveHandler = exports.getIsConfigMoveHandler = exports.IsConfigMoveSerializer = exports.IsConfigMoveServerInput = 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 IsConfigMoveServerInput;
|
|
11
|
+
(function (IsConfigMoveServerInput) {
|
|
12
|
+
IsConfigMoveServerInput.validate = models_0_1.IsConfigMoveInput.validate;
|
|
13
|
+
})(IsConfigMoveServerInput || (exports.IsConfigMoveServerInput = IsConfigMoveServerInput = {}));
|
|
14
|
+
class IsConfigMoveSerializer {
|
|
15
|
+
serialize = Aws_restJson1_1.serializeIsConfigMoveResponse;
|
|
16
|
+
deserialize = Aws_restJson1_1.deserializeIsConfigMoveRequest;
|
|
17
|
+
isOperationError(error) {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
;
|
|
21
|
+
serializeError(error, ctx) {
|
|
22
|
+
throw error;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.IsConfigMoveSerializer = IsConfigMoveSerializer;
|
|
26
|
+
const getIsConfigMoveHandler = (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: "moves" },
|
|
31
|
+
{ type: 'path_literal', value: "is-config" },
|
|
32
|
+
], [], { service: "GamePlugin", operation: "IsConfigMove" }),
|
|
33
|
+
]);
|
|
34
|
+
return new IsConfigMoveHandler(operation, mux, new IsConfigMoveSerializer(), Aws_restJson1_1.serializeFrameworkException, customizer);
|
|
35
|
+
};
|
|
36
|
+
exports.getIsConfigMoveHandler = getIsConfigMoveHandler;
|
|
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 IsConfigMoveHandler {
|
|
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.IsConfigMove. This indicates a misconfiguration.');
|
|
96
|
+
return this.serializeFrameworkException(new server_common_1.InternalFailureException(), serdeContextBase);
|
|
97
|
+
}
|
|
98
|
+
return handle(request, context, "IsConfigMove", this.serializer, this.operation, this.serializeFrameworkException, IsConfigMoveServerInput.validate, this.validationCustomizer);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
exports.IsConfigMoveHandler = IsConfigMoveHandler;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.IsOutOfTurnMoveHandler = exports.getIsOutOfTurnMoveHandler = exports.IsOutOfTurnMoveSerializer = exports.IsOutOfTurnMoveServerInput = 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 IsOutOfTurnMoveServerInput;
|
|
11
|
+
(function (IsOutOfTurnMoveServerInput) {
|
|
12
|
+
IsOutOfTurnMoveServerInput.validate = models_0_1.IsOutOfTurnMoveInput.validate;
|
|
13
|
+
})(IsOutOfTurnMoveServerInput || (exports.IsOutOfTurnMoveServerInput = IsOutOfTurnMoveServerInput = {}));
|
|
14
|
+
class IsOutOfTurnMoveSerializer {
|
|
15
|
+
serialize = Aws_restJson1_1.serializeIsOutOfTurnMoveResponse;
|
|
16
|
+
deserialize = Aws_restJson1_1.deserializeIsOutOfTurnMoveRequest;
|
|
17
|
+
isOperationError(error) {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
;
|
|
21
|
+
serializeError(error, ctx) {
|
|
22
|
+
throw error;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.IsOutOfTurnMoveSerializer = IsOutOfTurnMoveSerializer;
|
|
26
|
+
const getIsOutOfTurnMoveHandler = (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: "moves" },
|
|
31
|
+
{ type: 'path_literal', value: "is-out-of-turn" },
|
|
32
|
+
], [], { service: "GamePlugin", operation: "IsOutOfTurnMove" }),
|
|
33
|
+
]);
|
|
34
|
+
return new IsOutOfTurnMoveHandler(operation, mux, new IsOutOfTurnMoveSerializer(), Aws_restJson1_1.serializeFrameworkException, customizer);
|
|
35
|
+
};
|
|
36
|
+
exports.getIsOutOfTurnMoveHandler = getIsOutOfTurnMoveHandler;
|
|
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 IsOutOfTurnMoveHandler {
|
|
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.IsOutOfTurnMove. This indicates a misconfiguration.');
|
|
96
|
+
return this.serializeFrameworkException(new server_common_1.InternalFailureException(), serdeContextBase);
|
|
97
|
+
}
|
|
98
|
+
return handle(request, context, "IsOutOfTurnMove", this.serializer, this.operation, this.serializeFrameworkException, IsOutOfTurnMoveServerInput.validate, this.validationCustomizer);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
exports.IsOutOfTurnMoveHandler = IsOutOfTurnMoveHandler;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SelectBotMoveHandler = exports.getSelectBotMoveHandler = exports.SelectBotMoveSerializer = exports.SelectBotMoveServerInput = 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 SelectBotMoveServerInput;
|
|
11
|
+
(function (SelectBotMoveServerInput) {
|
|
12
|
+
SelectBotMoveServerInput.validate = models_0_1.SelectBotMoveInput.validate;
|
|
13
|
+
})(SelectBotMoveServerInput || (exports.SelectBotMoveServerInput = SelectBotMoveServerInput = {}));
|
|
14
|
+
class SelectBotMoveSerializer {
|
|
15
|
+
serialize = Aws_restJson1_1.serializeSelectBotMoveResponse;
|
|
16
|
+
deserialize = Aws_restJson1_1.deserializeSelectBotMoveRequest;
|
|
17
|
+
isOperationError(error) {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
;
|
|
21
|
+
serializeError(error, ctx) {
|
|
22
|
+
throw error;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.SelectBotMoveSerializer = SelectBotMoveSerializer;
|
|
26
|
+
const getSelectBotMoveHandler = (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: "bots" },
|
|
31
|
+
{ type: 'path_literal', value: "select-move" },
|
|
32
|
+
], [], { service: "GamePlugin", operation: "SelectBotMove" }),
|
|
33
|
+
]);
|
|
34
|
+
return new SelectBotMoveHandler(operation, mux, new SelectBotMoveSerializer(), Aws_restJson1_1.serializeFrameworkException, customizer);
|
|
35
|
+
};
|
|
36
|
+
exports.getSelectBotMoveHandler = getSelectBotMoveHandler;
|
|
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 SelectBotMoveHandler {
|
|
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.SelectBotMove. This indicates a misconfiguration.');
|
|
96
|
+
return this.serializeFrameworkException(new server_common_1.InternalFailureException(), serdeContextBase);
|
|
97
|
+
}
|
|
98
|
+
return handle(request, context, "SelectBotMove", this.serializer, this.operation, this.serializeFrameworkException, SelectBotMoveServerInput.validate, this.validationCustomizer);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
exports.SelectBotMoveHandler = SelectBotMoveHandler;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ValidateMoveHandler = exports.getValidateMoveHandler = exports.ValidateMoveSerializer = exports.ValidateMoveServerInput = 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 ValidateMoveServerInput;
|
|
11
|
+
(function (ValidateMoveServerInput) {
|
|
12
|
+
ValidateMoveServerInput.validate = models_0_1.ValidateMoveInput.validate;
|
|
13
|
+
})(ValidateMoveServerInput || (exports.ValidateMoveServerInput = ValidateMoveServerInput = {}));
|
|
14
|
+
class ValidateMoveSerializer {
|
|
15
|
+
serialize = Aws_restJson1_1.serializeValidateMoveResponse;
|
|
16
|
+
deserialize = Aws_restJson1_1.deserializeValidateMoveRequest;
|
|
17
|
+
isOperationError(error) {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
;
|
|
21
|
+
serializeError(error, ctx) {
|
|
22
|
+
throw error;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.ValidateMoveSerializer = ValidateMoveSerializer;
|
|
26
|
+
const getValidateMoveHandler = (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: "moves" },
|
|
31
|
+
{ type: 'path_literal', value: "validate" },
|
|
32
|
+
], [], { service: "GamePlugin", operation: "ValidateMove" }),
|
|
33
|
+
]);
|
|
34
|
+
return new ValidateMoveHandler(operation, mux, new ValidateMoveSerializer(), Aws_restJson1_1.serializeFrameworkException, customizer);
|
|
35
|
+
};
|
|
36
|
+
exports.getValidateMoveHandler = getValidateMoveHandler;
|
|
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 ValidateMoveHandler {
|
|
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.ValidateMove. This indicates a misconfiguration.');
|
|
96
|
+
return this.serializeFrameworkException(new server_common_1.InternalFailureException(), serdeContextBase);
|
|
97
|
+
}
|
|
98
|
+
return handle(request, context, "ValidateMove", this.serializer, this.operation, this.serializeFrameworkException, ValidateMoveServerInput.validate, this.validationCustomizer);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
exports.ValidateMoveHandler = ValidateMoveHandler;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./ApplyMove"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./ApplySaveFileEdit"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./AssignParticipants"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./DescribeSaveFile"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./GetGameResult"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./GetGameStatus"), exports);
|
|
10
|
+
tslib_1.__exportStar(require("./GetMetadata"), exports);
|
|
11
|
+
tslib_1.__exportStar(require("./GetPlayerView"), exports);
|
|
12
|
+
tslib_1.__exportStar(require("./GetSaveFileEditorState"), exports);
|
|
13
|
+
tslib_1.__exportStar(require("./Health"), exports);
|
|
14
|
+
tslib_1.__exportStar(require("./InitializeGame"), exports);
|
|
15
|
+
tslib_1.__exportStar(require("./IsConfigMove"), exports);
|
|
16
|
+
tslib_1.__exportStar(require("./IsOutOfTurnMove"), exports);
|
|
17
|
+
tslib_1.__exportStar(require("./SelectBotMove"), exports);
|
|
18
|
+
tslib_1.__exportStar(require("./ValidateMove"), exports);
|