@sparkrewards/sra-sdk 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. package/LICENSE +201 -0
  2. package/dist-cjs/index.js +8 -0
  3. package/dist-cjs/models/index.js +4 -0
  4. package/dist-cjs/models/models_0.js +1901 -0
  5. package/dist-cjs/openapi.js +7 -0
  6. package/dist-cjs/openapi.json +2864 -0
  7. package/dist-cjs/protocols/Aws_restJson1.js +2939 -0
  8. package/dist-cjs/server/AppAPIService.js +371 -0
  9. package/dist-cjs/server/index.js +5 -0
  10. package/dist-cjs/server/operations/DeleteUser.js +121 -0
  11. package/dist-cjs/server/operations/FavoritePlans.js +125 -0
  12. package/dist-cjs/server/operations/FavoriteShops.js +122 -0
  13. package/dist-cjs/server/operations/GetShop.js +126 -0
  14. package/dist-cjs/server/operations/GetShopPublic.js +127 -0
  15. package/dist-cjs/server/operations/GetUser.js +121 -0
  16. package/dist-cjs/server/operations/LikeOrg.js +124 -0
  17. package/dist-cjs/server/operations/NearbyShops.js +121 -0
  18. package/dist-cjs/server/operations/NearbyShopsPublic.js +122 -0
  19. package/dist-cjs/server/operations/NearestShop.js +126 -0
  20. package/dist-cjs/server/operations/OnboardUser.js +122 -0
  21. package/dist-cjs/server/operations/PinnedShop.js +126 -0
  22. package/dist-cjs/server/operations/PinnedShopPublic.js +127 -0
  23. package/dist-cjs/server/operations/Plan.js +123 -0
  24. package/dist-cjs/server/operations/PlanPublic.js +124 -0
  25. package/dist-cjs/server/operations/Plans.js +124 -0
  26. package/dist-cjs/server/operations/PopularShops.js +122 -0
  27. package/dist-cjs/server/operations/PopularShopsPublic.js +123 -0
  28. package/dist-cjs/server/operations/RadiusShops.js +123 -0
  29. package/dist-cjs/server/operations/RecordVisit.js +129 -0
  30. package/dist-cjs/server/operations/RedeemFirstTimeReward.js +125 -0
  31. package/dist-cjs/server/operations/RedeemPointReward.js +126 -0
  32. package/dist-cjs/server/operations/RedeemVisitReward.js +125 -0
  33. package/dist-cjs/server/operations/SearchShopsPublic.js +125 -0
  34. package/dist-cjs/server/operations/SearchSuggestion.js +126 -0
  35. package/dist-cjs/server/operations/UpdateUser.js +121 -0
  36. package/dist-cjs/server/operations/index.js +29 -0
  37. package/dist-es/index.js +4 -0
  38. package/dist-es/models/index.js +1 -0
  39. package/dist-es/models/models_0.js +1893 -0
  40. package/dist-es/openapi.js +3 -0
  41. package/dist-es/openapi.json +2864 -0
  42. package/dist-es/protocols/Aws_restJson1.js +2878 -0
  43. package/dist-es/server/AppAPIService.js +366 -0
  44. package/dist-es/server/index.js +2 -0
  45. package/dist-es/server/operations/DeleteUser.js +115 -0
  46. package/dist-es/server/operations/FavoritePlans.js +119 -0
  47. package/dist-es/server/operations/FavoriteShops.js +116 -0
  48. package/dist-es/server/operations/GetShop.js +120 -0
  49. package/dist-es/server/operations/GetShopPublic.js +121 -0
  50. package/dist-es/server/operations/GetUser.js +115 -0
  51. package/dist-es/server/operations/LikeOrg.js +118 -0
  52. package/dist-es/server/operations/NearbyShops.js +115 -0
  53. package/dist-es/server/operations/NearbyShopsPublic.js +116 -0
  54. package/dist-es/server/operations/NearestShop.js +120 -0
  55. package/dist-es/server/operations/OnboardUser.js +116 -0
  56. package/dist-es/server/operations/PinnedShop.js +120 -0
  57. package/dist-es/server/operations/PinnedShopPublic.js +121 -0
  58. package/dist-es/server/operations/Plan.js +117 -0
  59. package/dist-es/server/operations/PlanPublic.js +118 -0
  60. package/dist-es/server/operations/Plans.js +118 -0
  61. package/dist-es/server/operations/PopularShops.js +116 -0
  62. package/dist-es/server/operations/PopularShopsPublic.js +117 -0
  63. package/dist-es/server/operations/RadiusShops.js +117 -0
  64. package/dist-es/server/operations/RecordVisit.js +123 -0
  65. package/dist-es/server/operations/RedeemFirstTimeReward.js +119 -0
  66. package/dist-es/server/operations/RedeemPointReward.js +120 -0
  67. package/dist-es/server/operations/RedeemVisitReward.js +119 -0
  68. package/dist-es/server/operations/SearchShopsPublic.js +119 -0
  69. package/dist-es/server/operations/SearchSuggestion.js +120 -0
  70. package/dist-es/server/operations/UpdateUser.js +115 -0
  71. package/dist-es/server/operations/index.js +26 -0
  72. package/dist-types/index.d.ts +9 -0
  73. package/dist-types/models/index.d.ts +1 -0
  74. package/dist-types/models/models_0.d.ts +832 -0
  75. package/dist-types/openapi.d.ts +7 -0
  76. package/dist-types/protocols/Aws_restJson1.d.ts +87 -0
  77. package/dist-types/server/AppAPIService.d.ts +76 -0
  78. package/dist-types/server/index.d.ts +2 -0
  79. package/dist-types/server/operations/DeleteUser.d.ts +41 -0
  80. package/dist-types/server/operations/FavoritePlans.d.ts +41 -0
  81. package/dist-types/server/operations/FavoriteShops.d.ts +41 -0
  82. package/dist-types/server/operations/GetShop.d.ts +41 -0
  83. package/dist-types/server/operations/GetShopPublic.d.ts +41 -0
  84. package/dist-types/server/operations/GetUser.d.ts +41 -0
  85. package/dist-types/server/operations/LikeOrg.d.ts +41 -0
  86. package/dist-types/server/operations/NearbyShops.d.ts +41 -0
  87. package/dist-types/server/operations/NearbyShopsPublic.d.ts +41 -0
  88. package/dist-types/server/operations/NearestShop.d.ts +41 -0
  89. package/dist-types/server/operations/OnboardUser.d.ts +41 -0
  90. package/dist-types/server/operations/PinnedShop.d.ts +41 -0
  91. package/dist-types/server/operations/PinnedShopPublic.d.ts +41 -0
  92. package/dist-types/server/operations/Plan.d.ts +41 -0
  93. package/dist-types/server/operations/PlanPublic.d.ts +41 -0
  94. package/dist-types/server/operations/Plans.d.ts +41 -0
  95. package/dist-types/server/operations/PopularShops.d.ts +41 -0
  96. package/dist-types/server/operations/PopularShopsPublic.d.ts +41 -0
  97. package/dist-types/server/operations/RadiusShops.d.ts +41 -0
  98. package/dist-types/server/operations/RecordVisit.d.ts +41 -0
  99. package/dist-types/server/operations/RedeemFirstTimeReward.d.ts +41 -0
  100. package/dist-types/server/operations/RedeemPointReward.d.ts +41 -0
  101. package/dist-types/server/operations/RedeemVisitReward.d.ts +41 -0
  102. package/dist-types/server/operations/SearchShopsPublic.d.ts +41 -0
  103. package/dist-types/server/operations/SearchSuggestion.d.ts +41 -0
  104. package/dist-types/server/operations/UpdateUser.d.ts +41 -0
  105. package/dist-types/server/operations/index.d.ts +26 -0
  106. package/package.json +66 -0
@@ -0,0 +1,125 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RedeemVisitRewardHandler = exports.getRedeemVisitRewardHandler = exports.RedeemVisitRewardSerializer = exports.RedeemVisitRewardServerInput = 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 RedeemVisitRewardServerInput;
11
+ (function (RedeemVisitRewardServerInput) {
12
+ RedeemVisitRewardServerInput.validate = models_0_1.RedeemVisitRewardInput.validate;
13
+ })(RedeemVisitRewardServerInput = exports.RedeemVisitRewardServerInput || (exports.RedeemVisitRewardServerInput = {}));
14
+ class RedeemVisitRewardSerializer {
15
+ constructor() {
16
+ this.serialize = Aws_restJson1_1.serializeRedeemVisitRewardResponse;
17
+ this.deserialize = Aws_restJson1_1.deserializeRedeemVisitRewardRequest;
18
+ }
19
+ isOperationError(error) {
20
+ const names = ["ValidationException", "RuntimeError"];
21
+ return names.includes(error.name);
22
+ }
23
+ ;
24
+ serializeError(error, ctx) {
25
+ switch (error.name) {
26
+ case "ValidationException": {
27
+ return (0, Aws_restJson1_1.serializeValidationExceptionError)(error, ctx);
28
+ }
29
+ case "RuntimeError": {
30
+ return (0, Aws_restJson1_1.serializeRuntimeErrorError)(error, ctx);
31
+ }
32
+ default: {
33
+ throw error;
34
+ }
35
+ }
36
+ }
37
+ }
38
+ exports.RedeemVisitRewardSerializer = RedeemVisitRewardSerializer;
39
+ const getRedeemVisitRewardHandler = (operation) => {
40
+ const mux = new server_common_1.httpbinding.HttpBindingMux([
41
+ new server_common_1.httpbinding.UriSpec('PUT', [
42
+ { type: 'path_literal', value: "rewards" },
43
+ { type: 'path_literal', value: "redeem" },
44
+ { type: 'path_literal', value: "visit" },
45
+ ], [
46
+ { type: 'query', key: "reward_id" },
47
+ ], { service: "AppAPI", operation: "RedeemVisitReward" }),
48
+ ]);
49
+ const customizer = (ctx, failures) => {
50
+ if (!failures) {
51
+ return undefined;
52
+ }
53
+ return {
54
+ name: "ValidationException",
55
+ $fault: "client",
56
+ message: (0, server_common_1.generateValidationSummary)(failures),
57
+ fieldList: failures.map(failure => ({
58
+ path: failure.path,
59
+ message: (0, server_common_1.generateValidationMessage)(failure)
60
+ }))
61
+ };
62
+ };
63
+ return new RedeemVisitRewardHandler(operation, mux, new RedeemVisitRewardSerializer(), Aws_restJson1_1.serializeFrameworkException, customizer);
64
+ };
65
+ exports.getRedeemVisitRewardHandler = getRedeemVisitRewardHandler;
66
+ const serdeContextBase = {
67
+ base64Encoder: util_base64_1.toBase64,
68
+ base64Decoder: util_base64_1.fromBase64,
69
+ utf8Encoder: util_utf8_1.toUtf8,
70
+ utf8Decoder: util_utf8_1.fromUtf8,
71
+ streamCollector: node_http_handler_1.streamCollector,
72
+ requestHandler: new node_http_handler_1.NodeHttpHandler(),
73
+ disableHostPrefix: true
74
+ };
75
+ async function handle(request, context, operationName, serializer, operation, serializeFrameworkException, validationFn, validationCustomizer) {
76
+ let input;
77
+ try {
78
+ input = await serializer.deserialize(request, {
79
+ endpoint: () => Promise.resolve(request), ...serdeContextBase
80
+ });
81
+ }
82
+ catch (error) {
83
+ if ((0, server_common_1.isFrameworkException)(error)) {
84
+ return serializeFrameworkException(error, serdeContextBase);
85
+ }
86
+ ;
87
+ return serializeFrameworkException(new server_common_1.SerializationException(), serdeContextBase);
88
+ }
89
+ try {
90
+ let validationFailures = validationFn(input);
91
+ if (validationFailures && validationFailures.length > 0) {
92
+ let validationException = validationCustomizer({ operation: operationName }, validationFailures);
93
+ if (validationException) {
94
+ return serializer.serializeError(validationException, serdeContextBase);
95
+ }
96
+ }
97
+ let output = await operation(input, context);
98
+ return serializer.serialize(output, serdeContextBase);
99
+ }
100
+ catch (error) {
101
+ if (serializer.isOperationError(error)) {
102
+ return serializer.serializeError(error, serdeContextBase);
103
+ }
104
+ console.log('Received an unexpected error', error);
105
+ return serializeFrameworkException(new server_common_1.InternalFailureException(), serdeContextBase);
106
+ }
107
+ }
108
+ class RedeemVisitRewardHandler {
109
+ constructor(operation, mux, serializer, serializeFrameworkException, validationCustomizer) {
110
+ this.operation = operation;
111
+ this.mux = mux;
112
+ this.serializer = serializer;
113
+ this.serializeFrameworkException = serializeFrameworkException;
114
+ this.validationCustomizer = validationCustomizer;
115
+ }
116
+ async handle(request, context) {
117
+ const target = this.mux.match(request);
118
+ if (target === undefined) {
119
+ console.log('Received a request that did not match software.amazon.smithy.app#AppAPI.RedeemVisitReward. This indicates a misconfiguration.');
120
+ return this.serializeFrameworkException(new server_common_1.InternalFailureException(), serdeContextBase);
121
+ }
122
+ return handle(request, context, "RedeemVisitReward", this.serializer, this.operation, this.serializeFrameworkException, RedeemVisitRewardServerInput.validate, this.validationCustomizer);
123
+ }
124
+ }
125
+ exports.RedeemVisitRewardHandler = RedeemVisitRewardHandler;
@@ -0,0 +1,125 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SearchShopsPublicHandler = exports.getSearchShopsPublicHandler = exports.SearchShopsPublicSerializer = exports.SearchShopsPublicServerInput = 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 SearchShopsPublicServerInput;
11
+ (function (SearchShopsPublicServerInput) {
12
+ SearchShopsPublicServerInput.validate = models_0_1.SearchShopsInput.validate;
13
+ })(SearchShopsPublicServerInput = exports.SearchShopsPublicServerInput || (exports.SearchShopsPublicServerInput = {}));
14
+ class SearchShopsPublicSerializer {
15
+ constructor() {
16
+ this.serialize = Aws_restJson1_1.serializeSearchShopsPublicResponse;
17
+ this.deserialize = Aws_restJson1_1.deserializeSearchShopsPublicRequest;
18
+ }
19
+ isOperationError(error) {
20
+ const names = ["ValidationException", "RuntimeError"];
21
+ return names.includes(error.name);
22
+ }
23
+ ;
24
+ serializeError(error, ctx) {
25
+ switch (error.name) {
26
+ case "ValidationException": {
27
+ return (0, Aws_restJson1_1.serializeValidationExceptionError)(error, ctx);
28
+ }
29
+ case "RuntimeError": {
30
+ return (0, Aws_restJson1_1.serializeRuntimeErrorError)(error, ctx);
31
+ }
32
+ default: {
33
+ throw error;
34
+ }
35
+ }
36
+ }
37
+ }
38
+ exports.SearchShopsPublicSerializer = SearchShopsPublicSerializer;
39
+ const getSearchShopsPublicHandler = (operation) => {
40
+ const mux = new server_common_1.httpbinding.HttpBindingMux([
41
+ new server_common_1.httpbinding.UriSpec('GET', [
42
+ { type: 'path_literal', value: "public" },
43
+ { type: 'path_literal', value: "shops" },
44
+ { type: 'path_literal', value: "search" },
45
+ ], [
46
+ { type: 'query', key: "q" },
47
+ ], { service: "AppAPI", operation: "SearchShopsPublic" }),
48
+ ]);
49
+ const customizer = (ctx, failures) => {
50
+ if (!failures) {
51
+ return undefined;
52
+ }
53
+ return {
54
+ name: "ValidationException",
55
+ $fault: "client",
56
+ message: (0, server_common_1.generateValidationSummary)(failures),
57
+ fieldList: failures.map(failure => ({
58
+ path: failure.path,
59
+ message: (0, server_common_1.generateValidationMessage)(failure)
60
+ }))
61
+ };
62
+ };
63
+ return new SearchShopsPublicHandler(operation, mux, new SearchShopsPublicSerializer(), Aws_restJson1_1.serializeFrameworkException, customizer);
64
+ };
65
+ exports.getSearchShopsPublicHandler = getSearchShopsPublicHandler;
66
+ const serdeContextBase = {
67
+ base64Encoder: util_base64_1.toBase64,
68
+ base64Decoder: util_base64_1.fromBase64,
69
+ utf8Encoder: util_utf8_1.toUtf8,
70
+ utf8Decoder: util_utf8_1.fromUtf8,
71
+ streamCollector: node_http_handler_1.streamCollector,
72
+ requestHandler: new node_http_handler_1.NodeHttpHandler(),
73
+ disableHostPrefix: true
74
+ };
75
+ async function handle(request, context, operationName, serializer, operation, serializeFrameworkException, validationFn, validationCustomizer) {
76
+ let input;
77
+ try {
78
+ input = await serializer.deserialize(request, {
79
+ endpoint: () => Promise.resolve(request), ...serdeContextBase
80
+ });
81
+ }
82
+ catch (error) {
83
+ if ((0, server_common_1.isFrameworkException)(error)) {
84
+ return serializeFrameworkException(error, serdeContextBase);
85
+ }
86
+ ;
87
+ return serializeFrameworkException(new server_common_1.SerializationException(), serdeContextBase);
88
+ }
89
+ try {
90
+ let validationFailures = validationFn(input);
91
+ if (validationFailures && validationFailures.length > 0) {
92
+ let validationException = validationCustomizer({ operation: operationName }, validationFailures);
93
+ if (validationException) {
94
+ return serializer.serializeError(validationException, serdeContextBase);
95
+ }
96
+ }
97
+ let output = await operation(input, context);
98
+ return serializer.serialize(output, serdeContextBase);
99
+ }
100
+ catch (error) {
101
+ if (serializer.isOperationError(error)) {
102
+ return serializer.serializeError(error, serdeContextBase);
103
+ }
104
+ console.log('Received an unexpected error', error);
105
+ return serializeFrameworkException(new server_common_1.InternalFailureException(), serdeContextBase);
106
+ }
107
+ }
108
+ class SearchShopsPublicHandler {
109
+ constructor(operation, mux, serializer, serializeFrameworkException, validationCustomizer) {
110
+ this.operation = operation;
111
+ this.mux = mux;
112
+ this.serializer = serializer;
113
+ this.serializeFrameworkException = serializeFrameworkException;
114
+ this.validationCustomizer = validationCustomizer;
115
+ }
116
+ async handle(request, context) {
117
+ const target = this.mux.match(request);
118
+ if (target === undefined) {
119
+ console.log('Received a request that did not match software.amazon.smithy.app#AppAPI.SearchShopsPublic. This indicates a misconfiguration.');
120
+ return this.serializeFrameworkException(new server_common_1.InternalFailureException(), serdeContextBase);
121
+ }
122
+ return handle(request, context, "SearchShopsPublic", this.serializer, this.operation, this.serializeFrameworkException, SearchShopsPublicServerInput.validate, this.validationCustomizer);
123
+ }
124
+ }
125
+ exports.SearchShopsPublicHandler = SearchShopsPublicHandler;
@@ -0,0 +1,126 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SearchSuggestionHandler = exports.getSearchSuggestionHandler = exports.SearchSuggestionSerializer = exports.SearchSuggestionServerInput = 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 SearchSuggestionServerInput;
11
+ (function (SearchSuggestionServerInput) {
12
+ SearchSuggestionServerInput.validate = models_0_1.SearchSuggestionInput.validate;
13
+ })(SearchSuggestionServerInput = exports.SearchSuggestionServerInput || (exports.SearchSuggestionServerInput = {}));
14
+ class SearchSuggestionSerializer {
15
+ constructor() {
16
+ this.serialize = Aws_restJson1_1.serializeSearchSuggestionResponse;
17
+ this.deserialize = Aws_restJson1_1.deserializeSearchSuggestionRequest;
18
+ }
19
+ isOperationError(error) {
20
+ const names = ["ValidationException", "RuntimeError"];
21
+ return names.includes(error.name);
22
+ }
23
+ ;
24
+ serializeError(error, ctx) {
25
+ switch (error.name) {
26
+ case "ValidationException": {
27
+ return (0, Aws_restJson1_1.serializeValidationExceptionError)(error, ctx);
28
+ }
29
+ case "RuntimeError": {
30
+ return (0, Aws_restJson1_1.serializeRuntimeErrorError)(error, ctx);
31
+ }
32
+ default: {
33
+ throw error;
34
+ }
35
+ }
36
+ }
37
+ }
38
+ exports.SearchSuggestionSerializer = SearchSuggestionSerializer;
39
+ const getSearchSuggestionHandler = (operation) => {
40
+ const mux = new server_common_1.httpbinding.HttpBindingMux([
41
+ new server_common_1.httpbinding.UriSpec('GET', [
42
+ { type: 'path_literal', value: "public" },
43
+ { type: 'path_literal', value: "shops" },
44
+ { type: 'path_literal', value: "search" },
45
+ { type: 'path_literal', value: "suggestion" },
46
+ ], [
47
+ { type: 'query', key: "q" },
48
+ ], { service: "AppAPI", operation: "SearchSuggestion" }),
49
+ ]);
50
+ const customizer = (ctx, failures) => {
51
+ if (!failures) {
52
+ return undefined;
53
+ }
54
+ return {
55
+ name: "ValidationException",
56
+ $fault: "client",
57
+ message: (0, server_common_1.generateValidationSummary)(failures),
58
+ fieldList: failures.map(failure => ({
59
+ path: failure.path,
60
+ message: (0, server_common_1.generateValidationMessage)(failure)
61
+ }))
62
+ };
63
+ };
64
+ return new SearchSuggestionHandler(operation, mux, new SearchSuggestionSerializer(), Aws_restJson1_1.serializeFrameworkException, customizer);
65
+ };
66
+ exports.getSearchSuggestionHandler = getSearchSuggestionHandler;
67
+ const serdeContextBase = {
68
+ base64Encoder: util_base64_1.toBase64,
69
+ base64Decoder: util_base64_1.fromBase64,
70
+ utf8Encoder: util_utf8_1.toUtf8,
71
+ utf8Decoder: util_utf8_1.fromUtf8,
72
+ streamCollector: node_http_handler_1.streamCollector,
73
+ requestHandler: new node_http_handler_1.NodeHttpHandler(),
74
+ disableHostPrefix: true
75
+ };
76
+ async function handle(request, context, operationName, serializer, operation, serializeFrameworkException, validationFn, validationCustomizer) {
77
+ let input;
78
+ try {
79
+ input = await serializer.deserialize(request, {
80
+ endpoint: () => Promise.resolve(request), ...serdeContextBase
81
+ });
82
+ }
83
+ catch (error) {
84
+ if ((0, server_common_1.isFrameworkException)(error)) {
85
+ return serializeFrameworkException(error, serdeContextBase);
86
+ }
87
+ ;
88
+ return serializeFrameworkException(new server_common_1.SerializationException(), serdeContextBase);
89
+ }
90
+ try {
91
+ let validationFailures = validationFn(input);
92
+ if (validationFailures && validationFailures.length > 0) {
93
+ let validationException = validationCustomizer({ operation: operationName }, validationFailures);
94
+ if (validationException) {
95
+ return serializer.serializeError(validationException, serdeContextBase);
96
+ }
97
+ }
98
+ let output = await operation(input, context);
99
+ return serializer.serialize(output, serdeContextBase);
100
+ }
101
+ catch (error) {
102
+ if (serializer.isOperationError(error)) {
103
+ return serializer.serializeError(error, serdeContextBase);
104
+ }
105
+ console.log('Received an unexpected error', error);
106
+ return serializeFrameworkException(new server_common_1.InternalFailureException(), serdeContextBase);
107
+ }
108
+ }
109
+ class SearchSuggestionHandler {
110
+ constructor(operation, mux, serializer, serializeFrameworkException, validationCustomizer) {
111
+ this.operation = operation;
112
+ this.mux = mux;
113
+ this.serializer = serializer;
114
+ this.serializeFrameworkException = serializeFrameworkException;
115
+ this.validationCustomizer = validationCustomizer;
116
+ }
117
+ async handle(request, context) {
118
+ const target = this.mux.match(request);
119
+ if (target === undefined) {
120
+ console.log('Received a request that did not match software.amazon.smithy.app#AppAPI.SearchSuggestion. This indicates a misconfiguration.');
121
+ return this.serializeFrameworkException(new server_common_1.InternalFailureException(), serdeContextBase);
122
+ }
123
+ return handle(request, context, "SearchSuggestion", this.serializer, this.operation, this.serializeFrameworkException, SearchSuggestionServerInput.validate, this.validationCustomizer);
124
+ }
125
+ }
126
+ exports.SearchSuggestionHandler = SearchSuggestionHandler;
@@ -0,0 +1,121 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UpdateUserHandler = exports.getUpdateUserHandler = exports.UpdateUserSerializer = exports.UpdateUserServerInput = 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 UpdateUserServerInput;
11
+ (function (UpdateUserServerInput) {
12
+ UpdateUserServerInput.validate = models_0_1.UpdateUserInput.validate;
13
+ })(UpdateUserServerInput = exports.UpdateUserServerInput || (exports.UpdateUserServerInput = {}));
14
+ class UpdateUserSerializer {
15
+ constructor() {
16
+ this.serialize = Aws_restJson1_1.serializeUpdateUserResponse;
17
+ this.deserialize = Aws_restJson1_1.deserializeUpdateUserRequest;
18
+ }
19
+ isOperationError(error) {
20
+ const names = ["ValidationException", "RuntimeError"];
21
+ return names.includes(error.name);
22
+ }
23
+ ;
24
+ serializeError(error, ctx) {
25
+ switch (error.name) {
26
+ case "ValidationException": {
27
+ return (0, Aws_restJson1_1.serializeValidationExceptionError)(error, ctx);
28
+ }
29
+ case "RuntimeError": {
30
+ return (0, Aws_restJson1_1.serializeRuntimeErrorError)(error, ctx);
31
+ }
32
+ default: {
33
+ throw error;
34
+ }
35
+ }
36
+ }
37
+ }
38
+ exports.UpdateUserSerializer = UpdateUserSerializer;
39
+ const getUpdateUserHandler = (operation) => {
40
+ const mux = new server_common_1.httpbinding.HttpBindingMux([
41
+ new server_common_1.httpbinding.UriSpec('PUT', [
42
+ { type: 'path_literal', value: "user" },
43
+ ], [], { service: "AppAPI", operation: "UpdateUser" }),
44
+ ]);
45
+ const customizer = (ctx, failures) => {
46
+ if (!failures) {
47
+ return undefined;
48
+ }
49
+ return {
50
+ name: "ValidationException",
51
+ $fault: "client",
52
+ message: (0, server_common_1.generateValidationSummary)(failures),
53
+ fieldList: failures.map(failure => ({
54
+ path: failure.path,
55
+ message: (0, server_common_1.generateValidationMessage)(failure)
56
+ }))
57
+ };
58
+ };
59
+ return new UpdateUserHandler(operation, mux, new UpdateUserSerializer(), Aws_restJson1_1.serializeFrameworkException, customizer);
60
+ };
61
+ exports.getUpdateUserHandler = getUpdateUserHandler;
62
+ const serdeContextBase = {
63
+ base64Encoder: util_base64_1.toBase64,
64
+ base64Decoder: util_base64_1.fromBase64,
65
+ utf8Encoder: util_utf8_1.toUtf8,
66
+ utf8Decoder: util_utf8_1.fromUtf8,
67
+ streamCollector: node_http_handler_1.streamCollector,
68
+ requestHandler: new node_http_handler_1.NodeHttpHandler(),
69
+ disableHostPrefix: true
70
+ };
71
+ async function handle(request, context, operationName, serializer, operation, serializeFrameworkException, validationFn, validationCustomizer) {
72
+ let input;
73
+ try {
74
+ input = await serializer.deserialize(request, {
75
+ endpoint: () => Promise.resolve(request), ...serdeContextBase
76
+ });
77
+ }
78
+ catch (error) {
79
+ if ((0, server_common_1.isFrameworkException)(error)) {
80
+ return serializeFrameworkException(error, serdeContextBase);
81
+ }
82
+ ;
83
+ return serializeFrameworkException(new server_common_1.SerializationException(), serdeContextBase);
84
+ }
85
+ try {
86
+ let validationFailures = validationFn(input);
87
+ if (validationFailures && validationFailures.length > 0) {
88
+ let validationException = validationCustomizer({ operation: operationName }, validationFailures);
89
+ if (validationException) {
90
+ return serializer.serializeError(validationException, serdeContextBase);
91
+ }
92
+ }
93
+ let output = await operation(input, context);
94
+ return serializer.serialize(output, serdeContextBase);
95
+ }
96
+ catch (error) {
97
+ if (serializer.isOperationError(error)) {
98
+ return serializer.serializeError(error, serdeContextBase);
99
+ }
100
+ console.log('Received an unexpected error', error);
101
+ return serializeFrameworkException(new server_common_1.InternalFailureException(), serdeContextBase);
102
+ }
103
+ }
104
+ class UpdateUserHandler {
105
+ constructor(operation, mux, serializer, serializeFrameworkException, validationCustomizer) {
106
+ this.operation = operation;
107
+ this.mux = mux;
108
+ this.serializer = serializer;
109
+ this.serializeFrameworkException = serializeFrameworkException;
110
+ this.validationCustomizer = validationCustomizer;
111
+ }
112
+ async handle(request, context) {
113
+ const target = this.mux.match(request);
114
+ if (target === undefined) {
115
+ console.log('Received a request that did not match software.amazon.smithy.app#AppAPI.UpdateUser. This indicates a misconfiguration.');
116
+ return this.serializeFrameworkException(new server_common_1.InternalFailureException(), serdeContextBase);
117
+ }
118
+ return handle(request, context, "UpdateUser", this.serializer, this.operation, this.serializeFrameworkException, UpdateUserServerInput.validate, this.validationCustomizer);
119
+ }
120
+ }
121
+ exports.UpdateUserHandler = UpdateUserHandler;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./DeleteUser"), exports);
5
+ tslib_1.__exportStar(require("./FavoritePlans"), exports);
6
+ tslib_1.__exportStar(require("./FavoriteShops"), exports);
7
+ tslib_1.__exportStar(require("./GetShop"), exports);
8
+ tslib_1.__exportStar(require("./GetShopPublic"), exports);
9
+ tslib_1.__exportStar(require("./GetUser"), exports);
10
+ tslib_1.__exportStar(require("./LikeOrg"), exports);
11
+ tslib_1.__exportStar(require("./NearbyShops"), exports);
12
+ tslib_1.__exportStar(require("./NearbyShopsPublic"), exports);
13
+ tslib_1.__exportStar(require("./NearestShop"), exports);
14
+ tslib_1.__exportStar(require("./OnboardUser"), exports);
15
+ tslib_1.__exportStar(require("./PinnedShop"), exports);
16
+ tslib_1.__exportStar(require("./PinnedShopPublic"), exports);
17
+ tslib_1.__exportStar(require("./Plan"), exports);
18
+ tslib_1.__exportStar(require("./PlanPublic"), exports);
19
+ tslib_1.__exportStar(require("./Plans"), exports);
20
+ tslib_1.__exportStar(require("./PopularShops"), exports);
21
+ tslib_1.__exportStar(require("./PopularShopsPublic"), exports);
22
+ tslib_1.__exportStar(require("./RadiusShops"), exports);
23
+ tslib_1.__exportStar(require("./RecordVisit"), exports);
24
+ tslib_1.__exportStar(require("./RedeemFirstTimeReward"), exports);
25
+ tslib_1.__exportStar(require("./RedeemPointReward"), exports);
26
+ tslib_1.__exportStar(require("./RedeemVisitReward"), exports);
27
+ tslib_1.__exportStar(require("./SearchShopsPublic"), exports);
28
+ tslib_1.__exportStar(require("./SearchSuggestion"), exports);
29
+ tslib_1.__exportStar(require("./UpdateUser"), exports);
@@ -0,0 +1,4 @@
1
+ export * as Aws_restJson1 from "./protocols/Aws_restJson1";
2
+ export * from "./server/index";
3
+ export * from "./models";
4
+ export * from "./openapi";
@@ -0,0 +1 @@
1
+ export * from "./models_0";