@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.
Files changed (88) hide show
  1. package/dist-cjs/runtime/defaultService.js +18 -0
  2. package/dist-cjs/runtime/express.js +39 -0
  3. package/dist-cjs/runtime/index.js +7 -0
  4. package/dist-cjs/src/endpoint/EndpointParameters.js +12 -0
  5. package/dist-cjs/src/endpoint/endpointResolver.js +16 -0
  6. package/dist-cjs/src/endpoint/ruleset.js +38 -0
  7. package/dist-cjs/src/index.js +7 -0
  8. package/dist-cjs/src/models/index.js +4 -0
  9. package/dist-cjs/src/models/models_0.js +860 -0
  10. package/dist-cjs/src/protocols/Aws_restJson1.js +1077 -0
  11. package/dist-cjs/src/server/GamePluginService.js +231 -0
  12. package/dist-cjs/src/server/index.js +5 -0
  13. package/dist-cjs/src/server/operations/ApplyMove.js +109 -0
  14. package/dist-cjs/src/server/operations/ApplySaveFileEdit.js +109 -0
  15. package/dist-cjs/src/server/operations/AssignParticipants.js +101 -0
  16. package/dist-cjs/src/server/operations/DescribeSaveFile.js +101 -0
  17. package/dist-cjs/src/server/operations/GetGameResult.js +101 -0
  18. package/dist-cjs/src/server/operations/GetGameStatus.js +101 -0
  19. package/dist-cjs/src/server/operations/GetMetadata.js +99 -0
  20. package/dist-cjs/src/server/operations/GetPlayerView.js +101 -0
  21. package/dist-cjs/src/server/operations/GetSaveFileEditorState.js +101 -0
  22. package/dist-cjs/src/server/operations/Health.js +99 -0
  23. package/dist-cjs/src/server/operations/InitializeGame.js +101 -0
  24. package/dist-cjs/src/server/operations/IsConfigMove.js +101 -0
  25. package/dist-cjs/src/server/operations/IsOutOfTurnMove.js +101 -0
  26. package/dist-cjs/src/server/operations/SelectBotMove.js +101 -0
  27. package/dist-cjs/src/server/operations/ValidateMove.js +101 -0
  28. package/dist-cjs/src/server/operations/index.js +18 -0
  29. package/dist-cjs/tsconfig.cjs.tsbuildinfo +1 -0
  30. package/dist-es/runtime/defaultService.js +15 -0
  31. package/dist-es/runtime/express.js +36 -0
  32. package/dist-es/runtime/index.js +2 -0
  33. package/dist-es/src/endpoint/EndpointParameters.js +8 -0
  34. package/dist-es/src/endpoint/endpointResolver.js +12 -0
  35. package/dist-es/src/endpoint/ruleset.js +35 -0
  36. package/dist-es/src/index.js +3 -0
  37. package/dist-es/src/models/index.js +1 -0
  38. package/dist-es/src/models/models_0.js +855 -0
  39. package/dist-es/src/protocols/Aws_restJson1.js +1041 -0
  40. package/dist-es/src/server/GamePluginService.js +226 -0
  41. package/dist-es/src/server/index.js +2 -0
  42. package/dist-es/src/server/operations/ApplyMove.js +103 -0
  43. package/dist-es/src/server/operations/ApplySaveFileEdit.js +103 -0
  44. package/dist-es/src/server/operations/AssignParticipants.js +95 -0
  45. package/dist-es/src/server/operations/DescribeSaveFile.js +95 -0
  46. package/dist-es/src/server/operations/GetGameResult.js +95 -0
  47. package/dist-es/src/server/operations/GetGameStatus.js +95 -0
  48. package/dist-es/src/server/operations/GetMetadata.js +93 -0
  49. package/dist-es/src/server/operations/GetPlayerView.js +95 -0
  50. package/dist-es/src/server/operations/GetSaveFileEditorState.js +95 -0
  51. package/dist-es/src/server/operations/Health.js +93 -0
  52. package/dist-es/src/server/operations/InitializeGame.js +95 -0
  53. package/dist-es/src/server/operations/IsConfigMove.js +95 -0
  54. package/dist-es/src/server/operations/IsOutOfTurnMove.js +95 -0
  55. package/dist-es/src/server/operations/SelectBotMove.js +95 -0
  56. package/dist-es/src/server/operations/ValidateMove.js +95 -0
  57. package/dist-es/src/server/operations/index.js +15 -0
  58. package/dist-es/tsconfig.es.tsbuildinfo +1 -0
  59. package/dist-types/runtime/defaultService.d.ts +9 -0
  60. package/dist-types/runtime/express.d.ts +12 -0
  61. package/dist-types/runtime/index.d.ts +3 -0
  62. package/dist-types/src/endpoint/EndpointParameters.d.ts +20 -0
  63. package/dist-types/src/endpoint/endpointResolver.d.ts +5 -0
  64. package/dist-types/src/endpoint/ruleset.d.ts +2 -0
  65. package/dist-types/src/index.d.ts +22 -0
  66. package/dist-types/src/models/index.d.ts +1 -0
  67. package/dist-types/src/models/models_0.d.ts +402 -0
  68. package/dist-types/src/protocols/Aws_restJson1.d.ts +52 -0
  69. package/dist-types/src/server/GamePluginService.d.ts +54 -0
  70. package/dist-types/src/server/index.d.ts +2 -0
  71. package/dist-types/src/server/operations/ApplyMove.d.ts +41 -0
  72. package/dist-types/src/server/operations/ApplySaveFileEdit.d.ts +41 -0
  73. package/dist-types/src/server/operations/AssignParticipants.d.ts +41 -0
  74. package/dist-types/src/server/operations/DescribeSaveFile.d.ts +41 -0
  75. package/dist-types/src/server/operations/GetGameResult.d.ts +41 -0
  76. package/dist-types/src/server/operations/GetGameStatus.d.ts +41 -0
  77. package/dist-types/src/server/operations/GetMetadata.d.ts +41 -0
  78. package/dist-types/src/server/operations/GetPlayerView.d.ts +41 -0
  79. package/dist-types/src/server/operations/GetSaveFileEditorState.d.ts +41 -0
  80. package/dist-types/src/server/operations/Health.d.ts +41 -0
  81. package/dist-types/src/server/operations/InitializeGame.d.ts +41 -0
  82. package/dist-types/src/server/operations/IsConfigMove.d.ts +41 -0
  83. package/dist-types/src/server/operations/IsOutOfTurnMove.d.ts +41 -0
  84. package/dist-types/src/server/operations/SelectBotMove.d.ts +41 -0
  85. package/dist-types/src/server/operations/ValidateMove.d.ts +41 -0
  86. package/dist-types/src/server/operations/index.d.ts +15 -0
  87. package/package.json +88 -0
  88. package/runtime/package.json +5 -0
@@ -0,0 +1,231 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getGamePluginServiceHandler = exports.GamePluginServiceHandler = void 0;
4
+ const Aws_restJson1_1 = require("../protocols/Aws_restJson1");
5
+ const ApplyMove_1 = require("./operations/ApplyMove");
6
+ const ApplySaveFileEdit_1 = require("./operations/ApplySaveFileEdit");
7
+ const AssignParticipants_1 = require("./operations/AssignParticipants");
8
+ const DescribeSaveFile_1 = require("./operations/DescribeSaveFile");
9
+ const GetGameResult_1 = require("./operations/GetGameResult");
10
+ const GetGameStatus_1 = require("./operations/GetGameStatus");
11
+ const GetMetadata_1 = require("./operations/GetMetadata");
12
+ const GetPlayerView_1 = require("./operations/GetPlayerView");
13
+ const GetSaveFileEditorState_1 = require("./operations/GetSaveFileEditorState");
14
+ const Health_1 = require("./operations/Health");
15
+ const InitializeGame_1 = require("./operations/InitializeGame");
16
+ const IsConfigMove_1 = require("./operations/IsConfigMove");
17
+ const IsOutOfTurnMove_1 = require("./operations/IsOutOfTurnMove");
18
+ const SelectBotMove_1 = require("./operations/SelectBotMove");
19
+ const ValidateMove_1 = require("./operations/ValidateMove");
20
+ const server_common_1 = require("@aws-smithy/server-common");
21
+ const node_http_handler_1 = require("@smithy/node-http-handler");
22
+ const util_base64_1 = require("@smithy/util-base64");
23
+ const util_utf8_1 = require("@smithy/util-utf8");
24
+ const serdeContextBase = {
25
+ base64Encoder: util_base64_1.toBase64,
26
+ base64Decoder: util_base64_1.fromBase64,
27
+ utf8Encoder: util_utf8_1.toUtf8,
28
+ utf8Decoder: util_utf8_1.fromUtf8,
29
+ streamCollector: node_http_handler_1.streamCollector,
30
+ requestHandler: new node_http_handler_1.NodeHttpHandler(),
31
+ disableHostPrefix: true
32
+ };
33
+ async function handle(request, context, operationName, serializer, operation, serializeFrameworkException, validationFn, validationCustomizer) {
34
+ let input;
35
+ try {
36
+ input = await serializer.deserialize(request, {
37
+ endpoint: () => Promise.resolve(request), ...serdeContextBase
38
+ });
39
+ }
40
+ catch (error) {
41
+ if ((0, server_common_1.isFrameworkException)(error)) {
42
+ return serializeFrameworkException(error, serdeContextBase);
43
+ }
44
+ ;
45
+ return serializeFrameworkException(new server_common_1.SerializationException(), serdeContextBase);
46
+ }
47
+ try {
48
+ let validationFailures = validationFn(input);
49
+ if (validationFailures && validationFailures.length > 0) {
50
+ let validationException = validationCustomizer({ operation: operationName }, validationFailures);
51
+ if (validationException) {
52
+ return serializer.serializeError(validationException, serdeContextBase);
53
+ }
54
+ }
55
+ let output = await operation(input, context);
56
+ return serializer.serialize(output, serdeContextBase);
57
+ }
58
+ catch (error) {
59
+ if (serializer.isOperationError(error)) {
60
+ return serializer.serializeError(error, serdeContextBase);
61
+ }
62
+ console.log('Received an unexpected error', error);
63
+ return serializeFrameworkException(new server_common_1.InternalFailureException(), serdeContextBase);
64
+ }
65
+ }
66
+ class GamePluginServiceHandler {
67
+ service;
68
+ mux;
69
+ serializerFactory;
70
+ serializeFrameworkException;
71
+ validationCustomizer;
72
+ constructor(service, mux, serializerFactory, serializeFrameworkException, validationCustomizer) {
73
+ this.service = service;
74
+ this.mux = mux;
75
+ this.serializerFactory = serializerFactory;
76
+ this.serializeFrameworkException = serializeFrameworkException;
77
+ this.validationCustomizer = validationCustomizer;
78
+ }
79
+ async handle(request, context) {
80
+ const target = this.mux.match(request);
81
+ if (target === undefined) {
82
+ return this.serializeFrameworkException(new server_common_1.UnknownOperationException(), serdeContextBase);
83
+ }
84
+ switch (target.operation) {
85
+ case "ApplyMove": {
86
+ return handle(request, context, "ApplyMove", this.serializerFactory("ApplyMove"), this.service.ApplyMove, this.serializeFrameworkException, ApplyMove_1.ApplyMoveServerInput.validate, this.validationCustomizer);
87
+ }
88
+ case "ApplySaveFileEdit": {
89
+ return handle(request, context, "ApplySaveFileEdit", this.serializerFactory("ApplySaveFileEdit"), this.service.ApplySaveFileEdit, this.serializeFrameworkException, ApplySaveFileEdit_1.ApplySaveFileEditServerInput.validate, this.validationCustomizer);
90
+ }
91
+ case "AssignParticipants": {
92
+ return handle(request, context, "AssignParticipants", this.serializerFactory("AssignParticipants"), this.service.AssignParticipants, this.serializeFrameworkException, AssignParticipants_1.AssignParticipantsServerInput.validate, this.validationCustomizer);
93
+ }
94
+ case "DescribeSaveFile": {
95
+ return handle(request, context, "DescribeSaveFile", this.serializerFactory("DescribeSaveFile"), this.service.DescribeSaveFile, this.serializeFrameworkException, DescribeSaveFile_1.DescribeSaveFileServerInput.validate, this.validationCustomizer);
96
+ }
97
+ case "GetGameResult": {
98
+ return handle(request, context, "GetGameResult", this.serializerFactory("GetGameResult"), this.service.GetGameResult, this.serializeFrameworkException, GetGameResult_1.GetGameResultServerInput.validate, this.validationCustomizer);
99
+ }
100
+ case "GetGameStatus": {
101
+ return handle(request, context, "GetGameStatus", this.serializerFactory("GetGameStatus"), this.service.GetGameStatus, this.serializeFrameworkException, GetGameStatus_1.GetGameStatusServerInput.validate, this.validationCustomizer);
102
+ }
103
+ case "GetMetadata": {
104
+ return handle(request, context, "GetMetadata", this.serializerFactory("GetMetadata"), this.service.GetMetadata, this.serializeFrameworkException, GetMetadata_1.GetMetadataServerInput.validate, this.validationCustomizer);
105
+ }
106
+ case "GetPlayerView": {
107
+ return handle(request, context, "GetPlayerView", this.serializerFactory("GetPlayerView"), this.service.GetPlayerView, this.serializeFrameworkException, GetPlayerView_1.GetPlayerViewServerInput.validate, this.validationCustomizer);
108
+ }
109
+ case "GetSaveFileEditorState": {
110
+ return handle(request, context, "GetSaveFileEditorState", this.serializerFactory("GetSaveFileEditorState"), this.service.GetSaveFileEditorState, this.serializeFrameworkException, GetSaveFileEditorState_1.GetSaveFileEditorStateServerInput.validate, this.validationCustomizer);
111
+ }
112
+ case "Health": {
113
+ return handle(request, context, "Health", this.serializerFactory("Health"), this.service.Health, this.serializeFrameworkException, Health_1.HealthServerInput.validate, this.validationCustomizer);
114
+ }
115
+ case "InitializeGame": {
116
+ return handle(request, context, "InitializeGame", this.serializerFactory("InitializeGame"), this.service.InitializeGame, this.serializeFrameworkException, InitializeGame_1.InitializeGameServerInput.validate, this.validationCustomizer);
117
+ }
118
+ case "IsConfigMove": {
119
+ return handle(request, context, "IsConfigMove", this.serializerFactory("IsConfigMove"), this.service.IsConfigMove, this.serializeFrameworkException, IsConfigMove_1.IsConfigMoveServerInput.validate, this.validationCustomizer);
120
+ }
121
+ case "IsOutOfTurnMove": {
122
+ return handle(request, context, "IsOutOfTurnMove", this.serializerFactory("IsOutOfTurnMove"), this.service.IsOutOfTurnMove, this.serializeFrameworkException, IsOutOfTurnMove_1.IsOutOfTurnMoveServerInput.validate, this.validationCustomizer);
123
+ }
124
+ case "SelectBotMove": {
125
+ return handle(request, context, "SelectBotMove", this.serializerFactory("SelectBotMove"), this.service.SelectBotMove, this.serializeFrameworkException, SelectBotMove_1.SelectBotMoveServerInput.validate, this.validationCustomizer);
126
+ }
127
+ case "ValidateMove": {
128
+ return handle(request, context, "ValidateMove", this.serializerFactory("ValidateMove"), this.service.ValidateMove, this.serializeFrameworkException, ValidateMove_1.ValidateMoveServerInput.validate, this.validationCustomizer);
129
+ }
130
+ }
131
+ }
132
+ }
133
+ exports.GamePluginServiceHandler = GamePluginServiceHandler;
134
+ const getGamePluginServiceHandler = (service, customizer) => {
135
+ const mux = new server_common_1.httpbinding.HttpBindingMux([
136
+ new server_common_1.httpbinding.UriSpec('POST', [
137
+ { type: 'path_literal', value: "v1" },
138
+ { type: 'path_literal', value: "moves" },
139
+ { type: 'path_literal', value: "apply" },
140
+ ], [], { service: "GamePlugin", operation: "ApplyMove" }),
141
+ new server_common_1.httpbinding.UriSpec('POST', [
142
+ { type: 'path_literal', value: "v1" },
143
+ { type: 'path_literal', value: "saves" },
144
+ { type: 'path_literal', value: "editor-edit" },
145
+ ], [], { service: "GamePlugin", operation: "ApplySaveFileEdit" }),
146
+ new server_common_1.httpbinding.UriSpec('POST', [
147
+ { type: 'path_literal', value: "v1" },
148
+ { type: 'path_literal', value: "participants" },
149
+ { type: 'path_literal', value: "assign" },
150
+ ], [], { service: "GamePlugin", operation: "AssignParticipants" }),
151
+ new server_common_1.httpbinding.UriSpec('POST', [
152
+ { type: 'path_literal', value: "v1" },
153
+ { type: 'path_literal', value: "saves" },
154
+ { type: 'path_literal', value: "describe" },
155
+ ], [], { service: "GamePlugin", operation: "DescribeSaveFile" }),
156
+ new server_common_1.httpbinding.UriSpec('POST', [
157
+ { type: 'path_literal', value: "v1" },
158
+ { type: 'path_literal', value: "games" },
159
+ { type: 'path_literal', value: "result" },
160
+ ], [], { service: "GamePlugin", operation: "GetGameResult" }),
161
+ new server_common_1.httpbinding.UriSpec('POST', [
162
+ { type: 'path_literal', value: "v1" },
163
+ { type: 'path_literal', value: "games" },
164
+ { type: 'path_literal', value: "status" },
165
+ ], [], { service: "GamePlugin", operation: "GetGameStatus" }),
166
+ new server_common_1.httpbinding.UriSpec('GET', [
167
+ { type: 'path_literal', value: "v1" },
168
+ { type: 'path_literal', value: "metadata" },
169
+ ], [], { service: "GamePlugin", operation: "GetMetadata" }),
170
+ new server_common_1.httpbinding.UriSpec('POST', [
171
+ { type: 'path_literal', value: "v1" },
172
+ { type: 'path_literal', value: "games" },
173
+ { type: 'path_literal', value: "player-view" },
174
+ ], [], { service: "GamePlugin", operation: "GetPlayerView" }),
175
+ new server_common_1.httpbinding.UriSpec('POST', [
176
+ { type: 'path_literal', value: "v1" },
177
+ { type: 'path_literal', value: "saves" },
178
+ { type: 'path_literal', value: "editor-state" },
179
+ ], [], { service: "GamePlugin", operation: "GetSaveFileEditorState" }),
180
+ new server_common_1.httpbinding.UriSpec('GET', [
181
+ { type: 'path_literal', value: "v1" },
182
+ { type: 'path_literal', value: "health" },
183
+ ], [], { service: "GamePlugin", operation: "Health" }),
184
+ new server_common_1.httpbinding.UriSpec('POST', [
185
+ { type: 'path_literal', value: "v1" },
186
+ { type: 'path_literal', value: "games" },
187
+ { type: 'path_literal', value: "initialize" },
188
+ ], [], { service: "GamePlugin", operation: "InitializeGame" }),
189
+ new server_common_1.httpbinding.UriSpec('POST', [
190
+ { type: 'path_literal', value: "v1" },
191
+ { type: 'path_literal', value: "moves" },
192
+ { type: 'path_literal', value: "is-config" },
193
+ ], [], { service: "GamePlugin", operation: "IsConfigMove" }),
194
+ new server_common_1.httpbinding.UriSpec('POST', [
195
+ { type: 'path_literal', value: "v1" },
196
+ { type: 'path_literal', value: "moves" },
197
+ { type: 'path_literal', value: "is-out-of-turn" },
198
+ ], [], { service: "GamePlugin", operation: "IsOutOfTurnMove" }),
199
+ new server_common_1.httpbinding.UriSpec('POST', [
200
+ { type: 'path_literal', value: "v1" },
201
+ { type: 'path_literal', value: "bots" },
202
+ { type: 'path_literal', value: "select-move" },
203
+ ], [], { service: "GamePlugin", operation: "SelectBotMove" }),
204
+ new server_common_1.httpbinding.UriSpec('POST', [
205
+ { type: 'path_literal', value: "v1" },
206
+ { type: 'path_literal', value: "moves" },
207
+ { type: 'path_literal', value: "validate" },
208
+ ], [], { service: "GamePlugin", operation: "ValidateMove" }),
209
+ ]);
210
+ const serFn = (op) => {
211
+ switch (op) {
212
+ case "ApplyMove": return new ApplyMove_1.ApplyMoveSerializer();
213
+ case "ApplySaveFileEdit": return new ApplySaveFileEdit_1.ApplySaveFileEditSerializer();
214
+ case "AssignParticipants": return new AssignParticipants_1.AssignParticipantsSerializer();
215
+ case "DescribeSaveFile": return new DescribeSaveFile_1.DescribeSaveFileSerializer();
216
+ case "GetGameResult": return new GetGameResult_1.GetGameResultSerializer();
217
+ case "GetGameStatus": return new GetGameStatus_1.GetGameStatusSerializer();
218
+ case "GetMetadata": return new GetMetadata_1.GetMetadataSerializer();
219
+ case "GetPlayerView": return new GetPlayerView_1.GetPlayerViewSerializer();
220
+ case "GetSaveFileEditorState": return new GetSaveFileEditorState_1.GetSaveFileEditorStateSerializer();
221
+ case "Health": return new Health_1.HealthSerializer();
222
+ case "InitializeGame": return new InitializeGame_1.InitializeGameSerializer();
223
+ case "IsConfigMove": return new IsConfigMove_1.IsConfigMoveSerializer();
224
+ case "IsOutOfTurnMove": return new IsOutOfTurnMove_1.IsOutOfTurnMoveSerializer();
225
+ case "SelectBotMove": return new SelectBotMove_1.SelectBotMoveSerializer();
226
+ case "ValidateMove": return new ValidateMove_1.ValidateMoveSerializer();
227
+ }
228
+ };
229
+ return new GamePluginServiceHandler(service, mux, serFn, Aws_restJson1_1.serializeFrameworkException, customizer);
230
+ };
231
+ exports.getGamePluginServiceHandler = getGamePluginServiceHandler;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./operations"), exports);
5
+ tslib_1.__exportStar(require("./GamePluginService"), exports);
@@ -0,0 +1,109 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ApplyMoveHandler = exports.getApplyMoveHandler = exports.ApplyMoveSerializer = exports.ApplyMoveServerInput = 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 ApplyMoveServerInput;
11
+ (function (ApplyMoveServerInput) {
12
+ ApplyMoveServerInput.validate = models_0_1.ApplyMoveInput.validate;
13
+ })(ApplyMoveServerInput || (exports.ApplyMoveServerInput = ApplyMoveServerInput = {}));
14
+ class ApplyMoveSerializer {
15
+ serialize = Aws_restJson1_1.serializeApplyMoveResponse;
16
+ deserialize = Aws_restJson1_1.deserializeApplyMoveRequest;
17
+ isOperationError(error) {
18
+ const names = ["InvalidMoveError"];
19
+ return names.includes(error.name);
20
+ }
21
+ ;
22
+ serializeError(error, ctx) {
23
+ switch (error.name) {
24
+ case "InvalidMoveError": {
25
+ return (0, Aws_restJson1_1.serializeInvalidMoveErrorError)(error, ctx);
26
+ }
27
+ default: {
28
+ throw error;
29
+ }
30
+ }
31
+ }
32
+ }
33
+ exports.ApplyMoveSerializer = ApplyMoveSerializer;
34
+ const getApplyMoveHandler = (operation, customizer) => {
35
+ const mux = new server_common_1.httpbinding.HttpBindingMux([
36
+ new server_common_1.httpbinding.UriSpec('POST', [
37
+ { type: 'path_literal', value: "v1" },
38
+ { type: 'path_literal', value: "moves" },
39
+ { type: 'path_literal', value: "apply" },
40
+ ], [], { service: "GamePlugin", operation: "ApplyMove" }),
41
+ ]);
42
+ return new ApplyMoveHandler(operation, mux, new ApplyMoveSerializer(), Aws_restJson1_1.serializeFrameworkException, customizer);
43
+ };
44
+ exports.getApplyMoveHandler = getApplyMoveHandler;
45
+ const serdeContextBase = {
46
+ base64Encoder: util_base64_1.toBase64,
47
+ base64Decoder: util_base64_1.fromBase64,
48
+ utf8Encoder: util_utf8_1.toUtf8,
49
+ utf8Decoder: util_utf8_1.fromUtf8,
50
+ streamCollector: node_http_handler_1.streamCollector,
51
+ requestHandler: new node_http_handler_1.NodeHttpHandler(),
52
+ disableHostPrefix: true
53
+ };
54
+ async function handle(request, context, operationName, serializer, operation, serializeFrameworkException, validationFn, validationCustomizer) {
55
+ let input;
56
+ try {
57
+ input = await serializer.deserialize(request, {
58
+ endpoint: () => Promise.resolve(request), ...serdeContextBase
59
+ });
60
+ }
61
+ catch (error) {
62
+ if ((0, server_common_1.isFrameworkException)(error)) {
63
+ return serializeFrameworkException(error, serdeContextBase);
64
+ }
65
+ ;
66
+ return serializeFrameworkException(new server_common_1.SerializationException(), serdeContextBase);
67
+ }
68
+ try {
69
+ let validationFailures = validationFn(input);
70
+ if (validationFailures && validationFailures.length > 0) {
71
+ let validationException = validationCustomizer({ operation: operationName }, validationFailures);
72
+ if (validationException) {
73
+ return serializer.serializeError(validationException, serdeContextBase);
74
+ }
75
+ }
76
+ let output = await operation(input, context);
77
+ return serializer.serialize(output, serdeContextBase);
78
+ }
79
+ catch (error) {
80
+ if (serializer.isOperationError(error)) {
81
+ return serializer.serializeError(error, serdeContextBase);
82
+ }
83
+ console.log('Received an unexpected error', error);
84
+ return serializeFrameworkException(new server_common_1.InternalFailureException(), serdeContextBase);
85
+ }
86
+ }
87
+ class ApplyMoveHandler {
88
+ operation;
89
+ mux;
90
+ serializer;
91
+ serializeFrameworkException;
92
+ validationCustomizer;
93
+ constructor(operation, mux, serializer, serializeFrameworkException, validationCustomizer) {
94
+ this.operation = operation;
95
+ this.mux = mux;
96
+ this.serializer = serializer;
97
+ this.serializeFrameworkException = serializeFrameworkException;
98
+ this.validationCustomizer = validationCustomizer;
99
+ }
100
+ async handle(request, context) {
101
+ const target = this.mux.match(request);
102
+ if (target === undefined) {
103
+ console.log('Received a request that did not match com.boardgame.plugin#GamePlugin.ApplyMove. This indicates a misconfiguration.');
104
+ return this.serializeFrameworkException(new server_common_1.InternalFailureException(), serdeContextBase);
105
+ }
106
+ return handle(request, context, "ApplyMove", this.serializer, this.operation, this.serializeFrameworkException, ApplyMoveServerInput.validate, this.validationCustomizer);
107
+ }
108
+ }
109
+ exports.ApplyMoveHandler = ApplyMoveHandler;
@@ -0,0 +1,109 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ApplySaveFileEditHandler = exports.getApplySaveFileEditHandler = exports.ApplySaveFileEditSerializer = exports.ApplySaveFileEditServerInput = 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 ApplySaveFileEditServerInput;
11
+ (function (ApplySaveFileEditServerInput) {
12
+ ApplySaveFileEditServerInput.validate = models_0_1.ApplySaveFileEditInput.validate;
13
+ })(ApplySaveFileEditServerInput || (exports.ApplySaveFileEditServerInput = ApplySaveFileEditServerInput = {}));
14
+ class ApplySaveFileEditSerializer {
15
+ serialize = Aws_restJson1_1.serializeApplySaveFileEditResponse;
16
+ deserialize = Aws_restJson1_1.deserializeApplySaveFileEditRequest;
17
+ isOperationError(error) {
18
+ const names = ["SaveFileEditRejectedError"];
19
+ return names.includes(error.name);
20
+ }
21
+ ;
22
+ serializeError(error, ctx) {
23
+ switch (error.name) {
24
+ case "SaveFileEditRejectedError": {
25
+ return (0, Aws_restJson1_1.serializeSaveFileEditRejectedErrorError)(error, ctx);
26
+ }
27
+ default: {
28
+ throw error;
29
+ }
30
+ }
31
+ }
32
+ }
33
+ exports.ApplySaveFileEditSerializer = ApplySaveFileEditSerializer;
34
+ const getApplySaveFileEditHandler = (operation, customizer) => {
35
+ const mux = new server_common_1.httpbinding.HttpBindingMux([
36
+ new server_common_1.httpbinding.UriSpec('POST', [
37
+ { type: 'path_literal', value: "v1" },
38
+ { type: 'path_literal', value: "saves" },
39
+ { type: 'path_literal', value: "editor-edit" },
40
+ ], [], { service: "GamePlugin", operation: "ApplySaveFileEdit" }),
41
+ ]);
42
+ return new ApplySaveFileEditHandler(operation, mux, new ApplySaveFileEditSerializer(), Aws_restJson1_1.serializeFrameworkException, customizer);
43
+ };
44
+ exports.getApplySaveFileEditHandler = getApplySaveFileEditHandler;
45
+ const serdeContextBase = {
46
+ base64Encoder: util_base64_1.toBase64,
47
+ base64Decoder: util_base64_1.fromBase64,
48
+ utf8Encoder: util_utf8_1.toUtf8,
49
+ utf8Decoder: util_utf8_1.fromUtf8,
50
+ streamCollector: node_http_handler_1.streamCollector,
51
+ requestHandler: new node_http_handler_1.NodeHttpHandler(),
52
+ disableHostPrefix: true
53
+ };
54
+ async function handle(request, context, operationName, serializer, operation, serializeFrameworkException, validationFn, validationCustomizer) {
55
+ let input;
56
+ try {
57
+ input = await serializer.deserialize(request, {
58
+ endpoint: () => Promise.resolve(request), ...serdeContextBase
59
+ });
60
+ }
61
+ catch (error) {
62
+ if ((0, server_common_1.isFrameworkException)(error)) {
63
+ return serializeFrameworkException(error, serdeContextBase);
64
+ }
65
+ ;
66
+ return serializeFrameworkException(new server_common_1.SerializationException(), serdeContextBase);
67
+ }
68
+ try {
69
+ let validationFailures = validationFn(input);
70
+ if (validationFailures && validationFailures.length > 0) {
71
+ let validationException = validationCustomizer({ operation: operationName }, validationFailures);
72
+ if (validationException) {
73
+ return serializer.serializeError(validationException, serdeContextBase);
74
+ }
75
+ }
76
+ let output = await operation(input, context);
77
+ return serializer.serialize(output, serdeContextBase);
78
+ }
79
+ catch (error) {
80
+ if (serializer.isOperationError(error)) {
81
+ return serializer.serializeError(error, serdeContextBase);
82
+ }
83
+ console.log('Received an unexpected error', error);
84
+ return serializeFrameworkException(new server_common_1.InternalFailureException(), serdeContextBase);
85
+ }
86
+ }
87
+ class ApplySaveFileEditHandler {
88
+ operation;
89
+ mux;
90
+ serializer;
91
+ serializeFrameworkException;
92
+ validationCustomizer;
93
+ constructor(operation, mux, serializer, serializeFrameworkException, validationCustomizer) {
94
+ this.operation = operation;
95
+ this.mux = mux;
96
+ this.serializer = serializer;
97
+ this.serializeFrameworkException = serializeFrameworkException;
98
+ this.validationCustomizer = validationCustomizer;
99
+ }
100
+ async handle(request, context) {
101
+ const target = this.mux.match(request);
102
+ if (target === undefined) {
103
+ console.log('Received a request that did not match com.boardgame.plugin#GamePlugin.ApplySaveFileEdit. This indicates a misconfiguration.');
104
+ return this.serializeFrameworkException(new server_common_1.InternalFailureException(), serdeContextBase);
105
+ }
106
+ return handle(request, context, "ApplySaveFileEdit", this.serializer, this.operation, this.serializeFrameworkException, ApplySaveFileEditServerInput.validate, this.validationCustomizer);
107
+ }
108
+ }
109
+ exports.ApplySaveFileEditHandler = ApplySaveFileEditHandler;
@@ -0,0 +1,101 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AssignParticipantsHandler = exports.getAssignParticipantsHandler = exports.AssignParticipantsSerializer = exports.AssignParticipantsServerInput = 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 AssignParticipantsServerInput;
11
+ (function (AssignParticipantsServerInput) {
12
+ AssignParticipantsServerInput.validate = models_0_1.AssignParticipantsInput.validate;
13
+ })(AssignParticipantsServerInput || (exports.AssignParticipantsServerInput = AssignParticipantsServerInput = {}));
14
+ class AssignParticipantsSerializer {
15
+ serialize = Aws_restJson1_1.serializeAssignParticipantsResponse;
16
+ deserialize = Aws_restJson1_1.deserializeAssignParticipantsRequest;
17
+ isOperationError(error) {
18
+ return false;
19
+ }
20
+ ;
21
+ serializeError(error, ctx) {
22
+ throw error;
23
+ }
24
+ }
25
+ exports.AssignParticipantsSerializer = AssignParticipantsSerializer;
26
+ const getAssignParticipantsHandler = (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: "participants" },
31
+ { type: 'path_literal', value: "assign" },
32
+ ], [], { service: "GamePlugin", operation: "AssignParticipants" }),
33
+ ]);
34
+ return new AssignParticipantsHandler(operation, mux, new AssignParticipantsSerializer(), Aws_restJson1_1.serializeFrameworkException, customizer);
35
+ };
36
+ exports.getAssignParticipantsHandler = getAssignParticipantsHandler;
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 AssignParticipantsHandler {
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.AssignParticipants. This indicates a misconfiguration.');
96
+ return this.serializeFrameworkException(new server_common_1.InternalFailureException(), serdeContextBase);
97
+ }
98
+ return handle(request, context, "AssignParticipants", this.serializer, this.operation, this.serializeFrameworkException, AssignParticipantsServerInput.validate, this.validationCustomizer);
99
+ }
100
+ }
101
+ exports.AssignParticipantsHandler = AssignParticipantsHandler;
@@ -0,0 +1,101 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DescribeSaveFileHandler = exports.getDescribeSaveFileHandler = exports.DescribeSaveFileSerializer = exports.DescribeSaveFileServerInput = 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 DescribeSaveFileServerInput;
11
+ (function (DescribeSaveFileServerInput) {
12
+ DescribeSaveFileServerInput.validate = models_0_1.DescribeSaveFileInput.validate;
13
+ })(DescribeSaveFileServerInput || (exports.DescribeSaveFileServerInput = DescribeSaveFileServerInput = {}));
14
+ class DescribeSaveFileSerializer {
15
+ serialize = Aws_restJson1_1.serializeDescribeSaveFileResponse;
16
+ deserialize = Aws_restJson1_1.deserializeDescribeSaveFileRequest;
17
+ isOperationError(error) {
18
+ return false;
19
+ }
20
+ ;
21
+ serializeError(error, ctx) {
22
+ throw error;
23
+ }
24
+ }
25
+ exports.DescribeSaveFileSerializer = DescribeSaveFileSerializer;
26
+ const getDescribeSaveFileHandler = (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: "describe" },
32
+ ], [], { service: "GamePlugin", operation: "DescribeSaveFile" }),
33
+ ]);
34
+ return new DescribeSaveFileHandler(operation, mux, new DescribeSaveFileSerializer(), Aws_restJson1_1.serializeFrameworkException, customizer);
35
+ };
36
+ exports.getDescribeSaveFileHandler = getDescribeSaveFileHandler;
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 DescribeSaveFileHandler {
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.DescribeSaveFile. This indicates a misconfiguration.');
96
+ return this.serializeFrameworkException(new server_common_1.InternalFailureException(), serdeContextBase);
97
+ }
98
+ return handle(request, context, "DescribeSaveFile", this.serializer, this.operation, this.serializeFrameworkException, DescribeSaveFileServerInput.validate, this.validationCustomizer);
99
+ }
100
+ }
101
+ exports.DescribeSaveFileHandler = DescribeSaveFileHandler;