@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.
- package/LICENSE +201 -0
- package/dist-cjs/index.js +8 -0
- package/dist-cjs/models/index.js +4 -0
- package/dist-cjs/models/models_0.js +1901 -0
- package/dist-cjs/openapi.js +7 -0
- package/dist-cjs/openapi.json +2864 -0
- package/dist-cjs/protocols/Aws_restJson1.js +2939 -0
- package/dist-cjs/server/AppAPIService.js +371 -0
- package/dist-cjs/server/index.js +5 -0
- package/dist-cjs/server/operations/DeleteUser.js +121 -0
- package/dist-cjs/server/operations/FavoritePlans.js +125 -0
- package/dist-cjs/server/operations/FavoriteShops.js +122 -0
- package/dist-cjs/server/operations/GetShop.js +126 -0
- package/dist-cjs/server/operations/GetShopPublic.js +127 -0
- package/dist-cjs/server/operations/GetUser.js +121 -0
- package/dist-cjs/server/operations/LikeOrg.js +124 -0
- package/dist-cjs/server/operations/NearbyShops.js +121 -0
- package/dist-cjs/server/operations/NearbyShopsPublic.js +122 -0
- package/dist-cjs/server/operations/NearestShop.js +126 -0
- package/dist-cjs/server/operations/OnboardUser.js +122 -0
- package/dist-cjs/server/operations/PinnedShop.js +126 -0
- package/dist-cjs/server/operations/PinnedShopPublic.js +127 -0
- package/dist-cjs/server/operations/Plan.js +123 -0
- package/dist-cjs/server/operations/PlanPublic.js +124 -0
- package/dist-cjs/server/operations/Plans.js +124 -0
- package/dist-cjs/server/operations/PopularShops.js +122 -0
- package/dist-cjs/server/operations/PopularShopsPublic.js +123 -0
- package/dist-cjs/server/operations/RadiusShops.js +123 -0
- package/dist-cjs/server/operations/RecordVisit.js +129 -0
- package/dist-cjs/server/operations/RedeemFirstTimeReward.js +125 -0
- package/dist-cjs/server/operations/RedeemPointReward.js +126 -0
- package/dist-cjs/server/operations/RedeemVisitReward.js +125 -0
- package/dist-cjs/server/operations/SearchShopsPublic.js +125 -0
- package/dist-cjs/server/operations/SearchSuggestion.js +126 -0
- package/dist-cjs/server/operations/UpdateUser.js +121 -0
- package/dist-cjs/server/operations/index.js +29 -0
- package/dist-es/index.js +4 -0
- package/dist-es/models/index.js +1 -0
- package/dist-es/models/models_0.js +1893 -0
- package/dist-es/openapi.js +3 -0
- package/dist-es/openapi.json +2864 -0
- package/dist-es/protocols/Aws_restJson1.js +2878 -0
- package/dist-es/server/AppAPIService.js +366 -0
- package/dist-es/server/index.js +2 -0
- package/dist-es/server/operations/DeleteUser.js +115 -0
- package/dist-es/server/operations/FavoritePlans.js +119 -0
- package/dist-es/server/operations/FavoriteShops.js +116 -0
- package/dist-es/server/operations/GetShop.js +120 -0
- package/dist-es/server/operations/GetShopPublic.js +121 -0
- package/dist-es/server/operations/GetUser.js +115 -0
- package/dist-es/server/operations/LikeOrg.js +118 -0
- package/dist-es/server/operations/NearbyShops.js +115 -0
- package/dist-es/server/operations/NearbyShopsPublic.js +116 -0
- package/dist-es/server/operations/NearestShop.js +120 -0
- package/dist-es/server/operations/OnboardUser.js +116 -0
- package/dist-es/server/operations/PinnedShop.js +120 -0
- package/dist-es/server/operations/PinnedShopPublic.js +121 -0
- package/dist-es/server/operations/Plan.js +117 -0
- package/dist-es/server/operations/PlanPublic.js +118 -0
- package/dist-es/server/operations/Plans.js +118 -0
- package/dist-es/server/operations/PopularShops.js +116 -0
- package/dist-es/server/operations/PopularShopsPublic.js +117 -0
- package/dist-es/server/operations/RadiusShops.js +117 -0
- package/dist-es/server/operations/RecordVisit.js +123 -0
- package/dist-es/server/operations/RedeemFirstTimeReward.js +119 -0
- package/dist-es/server/operations/RedeemPointReward.js +120 -0
- package/dist-es/server/operations/RedeemVisitReward.js +119 -0
- package/dist-es/server/operations/SearchShopsPublic.js +119 -0
- package/dist-es/server/operations/SearchSuggestion.js +120 -0
- package/dist-es/server/operations/UpdateUser.js +115 -0
- package/dist-es/server/operations/index.js +26 -0
- package/dist-types/index.d.ts +9 -0
- package/dist-types/models/index.d.ts +1 -0
- package/dist-types/models/models_0.d.ts +832 -0
- package/dist-types/openapi.d.ts +7 -0
- package/dist-types/protocols/Aws_restJson1.d.ts +87 -0
- package/dist-types/server/AppAPIService.d.ts +76 -0
- package/dist-types/server/index.d.ts +2 -0
- package/dist-types/server/operations/DeleteUser.d.ts +41 -0
- package/dist-types/server/operations/FavoritePlans.d.ts +41 -0
- package/dist-types/server/operations/FavoriteShops.d.ts +41 -0
- package/dist-types/server/operations/GetShop.d.ts +41 -0
- package/dist-types/server/operations/GetShopPublic.d.ts +41 -0
- package/dist-types/server/operations/GetUser.d.ts +41 -0
- package/dist-types/server/operations/LikeOrg.d.ts +41 -0
- package/dist-types/server/operations/NearbyShops.d.ts +41 -0
- package/dist-types/server/operations/NearbyShopsPublic.d.ts +41 -0
- package/dist-types/server/operations/NearestShop.d.ts +41 -0
- package/dist-types/server/operations/OnboardUser.d.ts +41 -0
- package/dist-types/server/operations/PinnedShop.d.ts +41 -0
- package/dist-types/server/operations/PinnedShopPublic.d.ts +41 -0
- package/dist-types/server/operations/Plan.d.ts +41 -0
- package/dist-types/server/operations/PlanPublic.d.ts +41 -0
- package/dist-types/server/operations/Plans.d.ts +41 -0
- package/dist-types/server/operations/PopularShops.d.ts +41 -0
- package/dist-types/server/operations/PopularShopsPublic.d.ts +41 -0
- package/dist-types/server/operations/RadiusShops.d.ts +41 -0
- package/dist-types/server/operations/RecordVisit.d.ts +41 -0
- package/dist-types/server/operations/RedeemFirstTimeReward.d.ts +41 -0
- package/dist-types/server/operations/RedeemPointReward.d.ts +41 -0
- package/dist-types/server/operations/RedeemVisitReward.d.ts +41 -0
- package/dist-types/server/operations/SearchShopsPublic.d.ts +41 -0
- package/dist-types/server/operations/SearchSuggestion.d.ts +41 -0
- package/dist-types/server/operations/UpdateUser.d.ts +41 -0
- package/dist-types/server/operations/index.d.ts +26 -0
- package/package.json +66 -0
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NearbyShopsHandler = exports.getNearbyShopsHandler = exports.NearbyShopsSerializer = exports.NearbyShopsServerInput = 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 NearbyShopsServerInput;
|
|
11
|
+
(function (NearbyShopsServerInput) {
|
|
12
|
+
NearbyShopsServerInput.validate = models_0_1.ShopListInput.validate;
|
|
13
|
+
})(NearbyShopsServerInput = exports.NearbyShopsServerInput || (exports.NearbyShopsServerInput = {}));
|
|
14
|
+
class NearbyShopsSerializer {
|
|
15
|
+
constructor() {
|
|
16
|
+
this.serialize = Aws_restJson1_1.serializeNearbyShopsResponse;
|
|
17
|
+
this.deserialize = Aws_restJson1_1.deserializeNearbyShopsRequest;
|
|
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.NearbyShopsSerializer = NearbyShopsSerializer;
|
|
39
|
+
const getNearbyShopsHandler = (operation) => {
|
|
40
|
+
const mux = new server_common_1.httpbinding.HttpBindingMux([
|
|
41
|
+
new server_common_1.httpbinding.UriSpec('GET', [
|
|
42
|
+
{ type: 'path_literal', value: "shops" },
|
|
43
|
+
], [], { service: "AppAPI", operation: "NearbyShops" }),
|
|
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 NearbyShopsHandler(operation, mux, new NearbyShopsSerializer(), Aws_restJson1_1.serializeFrameworkException, customizer);
|
|
60
|
+
};
|
|
61
|
+
exports.getNearbyShopsHandler = getNearbyShopsHandler;
|
|
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 NearbyShopsHandler {
|
|
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.NearbyShops. This indicates a misconfiguration.');
|
|
116
|
+
return this.serializeFrameworkException(new server_common_1.InternalFailureException(), serdeContextBase);
|
|
117
|
+
}
|
|
118
|
+
return handle(request, context, "NearbyShops", this.serializer, this.operation, this.serializeFrameworkException, NearbyShopsServerInput.validate, this.validationCustomizer);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
exports.NearbyShopsHandler = NearbyShopsHandler;
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NearbyShopsPublicHandler = exports.getNearbyShopsPublicHandler = exports.NearbyShopsPublicSerializer = exports.NearbyShopsPublicServerInput = 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 NearbyShopsPublicServerInput;
|
|
11
|
+
(function (NearbyShopsPublicServerInput) {
|
|
12
|
+
NearbyShopsPublicServerInput.validate = models_0_1.ShopListInput.validate;
|
|
13
|
+
})(NearbyShopsPublicServerInput = exports.NearbyShopsPublicServerInput || (exports.NearbyShopsPublicServerInput = {}));
|
|
14
|
+
class NearbyShopsPublicSerializer {
|
|
15
|
+
constructor() {
|
|
16
|
+
this.serialize = Aws_restJson1_1.serializeNearbyShopsPublicResponse;
|
|
17
|
+
this.deserialize = Aws_restJson1_1.deserializeNearbyShopsPublicRequest;
|
|
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.NearbyShopsPublicSerializer = NearbyShopsPublicSerializer;
|
|
39
|
+
const getNearbyShopsPublicHandler = (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
|
+
], [], { service: "AppAPI", operation: "NearbyShopsPublic" }),
|
|
45
|
+
]);
|
|
46
|
+
const customizer = (ctx, failures) => {
|
|
47
|
+
if (!failures) {
|
|
48
|
+
return undefined;
|
|
49
|
+
}
|
|
50
|
+
return {
|
|
51
|
+
name: "ValidationException",
|
|
52
|
+
$fault: "client",
|
|
53
|
+
message: (0, server_common_1.generateValidationSummary)(failures),
|
|
54
|
+
fieldList: failures.map(failure => ({
|
|
55
|
+
path: failure.path,
|
|
56
|
+
message: (0, server_common_1.generateValidationMessage)(failure)
|
|
57
|
+
}))
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
return new NearbyShopsPublicHandler(operation, mux, new NearbyShopsPublicSerializer(), Aws_restJson1_1.serializeFrameworkException, customizer);
|
|
61
|
+
};
|
|
62
|
+
exports.getNearbyShopsPublicHandler = getNearbyShopsPublicHandler;
|
|
63
|
+
const serdeContextBase = {
|
|
64
|
+
base64Encoder: util_base64_1.toBase64,
|
|
65
|
+
base64Decoder: util_base64_1.fromBase64,
|
|
66
|
+
utf8Encoder: util_utf8_1.toUtf8,
|
|
67
|
+
utf8Decoder: util_utf8_1.fromUtf8,
|
|
68
|
+
streamCollector: node_http_handler_1.streamCollector,
|
|
69
|
+
requestHandler: new node_http_handler_1.NodeHttpHandler(),
|
|
70
|
+
disableHostPrefix: true
|
|
71
|
+
};
|
|
72
|
+
async function handle(request, context, operationName, serializer, operation, serializeFrameworkException, validationFn, validationCustomizer) {
|
|
73
|
+
let input;
|
|
74
|
+
try {
|
|
75
|
+
input = await serializer.deserialize(request, {
|
|
76
|
+
endpoint: () => Promise.resolve(request), ...serdeContextBase
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
catch (error) {
|
|
80
|
+
if ((0, server_common_1.isFrameworkException)(error)) {
|
|
81
|
+
return serializeFrameworkException(error, serdeContextBase);
|
|
82
|
+
}
|
|
83
|
+
;
|
|
84
|
+
return serializeFrameworkException(new server_common_1.SerializationException(), serdeContextBase);
|
|
85
|
+
}
|
|
86
|
+
try {
|
|
87
|
+
let validationFailures = validationFn(input);
|
|
88
|
+
if (validationFailures && validationFailures.length > 0) {
|
|
89
|
+
let validationException = validationCustomizer({ operation: operationName }, validationFailures);
|
|
90
|
+
if (validationException) {
|
|
91
|
+
return serializer.serializeError(validationException, serdeContextBase);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
let output = await operation(input, context);
|
|
95
|
+
return serializer.serialize(output, serdeContextBase);
|
|
96
|
+
}
|
|
97
|
+
catch (error) {
|
|
98
|
+
if (serializer.isOperationError(error)) {
|
|
99
|
+
return serializer.serializeError(error, serdeContextBase);
|
|
100
|
+
}
|
|
101
|
+
console.log('Received an unexpected error', error);
|
|
102
|
+
return serializeFrameworkException(new server_common_1.InternalFailureException(), serdeContextBase);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
class NearbyShopsPublicHandler {
|
|
106
|
+
constructor(operation, mux, serializer, serializeFrameworkException, validationCustomizer) {
|
|
107
|
+
this.operation = operation;
|
|
108
|
+
this.mux = mux;
|
|
109
|
+
this.serializer = serializer;
|
|
110
|
+
this.serializeFrameworkException = serializeFrameworkException;
|
|
111
|
+
this.validationCustomizer = validationCustomizer;
|
|
112
|
+
}
|
|
113
|
+
async handle(request, context) {
|
|
114
|
+
const target = this.mux.match(request);
|
|
115
|
+
if (target === undefined) {
|
|
116
|
+
console.log('Received a request that did not match software.amazon.smithy.app#AppAPI.NearbyShopsPublic. This indicates a misconfiguration.');
|
|
117
|
+
return this.serializeFrameworkException(new server_common_1.InternalFailureException(), serdeContextBase);
|
|
118
|
+
}
|
|
119
|
+
return handle(request, context, "NearbyShopsPublic", this.serializer, this.operation, this.serializeFrameworkException, NearbyShopsPublicServerInput.validate, this.validationCustomizer);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
exports.NearbyShopsPublicHandler = NearbyShopsPublicHandler;
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NearestShopHandler = exports.getNearestShopHandler = exports.NearestShopSerializer = exports.NearestShopServerInput = 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 NearestShopServerInput;
|
|
11
|
+
(function (NearestShopServerInput) {
|
|
12
|
+
NearestShopServerInput.validate = models_0_1.NearestShopInput.validate;
|
|
13
|
+
})(NearestShopServerInput = exports.NearestShopServerInput || (exports.NearestShopServerInput = {}));
|
|
14
|
+
class NearestShopSerializer {
|
|
15
|
+
constructor() {
|
|
16
|
+
this.serialize = Aws_restJson1_1.serializeNearestShopResponse;
|
|
17
|
+
this.deserialize = Aws_restJson1_1.deserializeNearestShopRequest;
|
|
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.NearestShopSerializer = NearestShopSerializer;
|
|
39
|
+
const getNearestShopHandler = (operation) => {
|
|
40
|
+
const mux = new server_common_1.httpbinding.HttpBindingMux([
|
|
41
|
+
new server_common_1.httpbinding.UriSpec('GET', [
|
|
42
|
+
{ type: 'path_literal', value: "shops" },
|
|
43
|
+
{ type: 'path_literal', value: "nearest" },
|
|
44
|
+
], [
|
|
45
|
+
{ type: 'query', key: "shop_name" },
|
|
46
|
+
{ type: 'query', key: "lat" },
|
|
47
|
+
{ type: 'query', key: "lon" },
|
|
48
|
+
], { service: "AppAPI", operation: "NearestShop" }),
|
|
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 NearestShopHandler(operation, mux, new NearestShopSerializer(), Aws_restJson1_1.serializeFrameworkException, customizer);
|
|
65
|
+
};
|
|
66
|
+
exports.getNearestShopHandler = getNearestShopHandler;
|
|
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 NearestShopHandler {
|
|
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.NearestShop. This indicates a misconfiguration.');
|
|
121
|
+
return this.serializeFrameworkException(new server_common_1.InternalFailureException(), serdeContextBase);
|
|
122
|
+
}
|
|
123
|
+
return handle(request, context, "NearestShop", this.serializer, this.operation, this.serializeFrameworkException, NearestShopServerInput.validate, this.validationCustomizer);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
exports.NearestShopHandler = NearestShopHandler;
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OnboardUserHandler = exports.getOnboardUserHandler = exports.OnboardUserSerializer = exports.OnboardUserServerInput = 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 OnboardUserServerInput;
|
|
11
|
+
(function (OnboardUserServerInput) {
|
|
12
|
+
OnboardUserServerInput.validate = models_0_1.OnboardUserInput.validate;
|
|
13
|
+
})(OnboardUserServerInput = exports.OnboardUserServerInput || (exports.OnboardUserServerInput = {}));
|
|
14
|
+
class OnboardUserSerializer {
|
|
15
|
+
constructor() {
|
|
16
|
+
this.serialize = Aws_restJson1_1.serializeOnboardUserResponse;
|
|
17
|
+
this.deserialize = Aws_restJson1_1.deserializeOnboardUserRequest;
|
|
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.OnboardUserSerializer = OnboardUserSerializer;
|
|
39
|
+
const getOnboardUserHandler = (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
|
+
{ type: 'path_literal', value: "onboard" },
|
|
44
|
+
], [], { service: "AppAPI", operation: "OnboardUser" }),
|
|
45
|
+
]);
|
|
46
|
+
const customizer = (ctx, failures) => {
|
|
47
|
+
if (!failures) {
|
|
48
|
+
return undefined;
|
|
49
|
+
}
|
|
50
|
+
return {
|
|
51
|
+
name: "ValidationException",
|
|
52
|
+
$fault: "client",
|
|
53
|
+
message: (0, server_common_1.generateValidationSummary)(failures),
|
|
54
|
+
fieldList: failures.map(failure => ({
|
|
55
|
+
path: failure.path,
|
|
56
|
+
message: (0, server_common_1.generateValidationMessage)(failure)
|
|
57
|
+
}))
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
return new OnboardUserHandler(operation, mux, new OnboardUserSerializer(), Aws_restJson1_1.serializeFrameworkException, customizer);
|
|
61
|
+
};
|
|
62
|
+
exports.getOnboardUserHandler = getOnboardUserHandler;
|
|
63
|
+
const serdeContextBase = {
|
|
64
|
+
base64Encoder: util_base64_1.toBase64,
|
|
65
|
+
base64Decoder: util_base64_1.fromBase64,
|
|
66
|
+
utf8Encoder: util_utf8_1.toUtf8,
|
|
67
|
+
utf8Decoder: util_utf8_1.fromUtf8,
|
|
68
|
+
streamCollector: node_http_handler_1.streamCollector,
|
|
69
|
+
requestHandler: new node_http_handler_1.NodeHttpHandler(),
|
|
70
|
+
disableHostPrefix: true
|
|
71
|
+
};
|
|
72
|
+
async function handle(request, context, operationName, serializer, operation, serializeFrameworkException, validationFn, validationCustomizer) {
|
|
73
|
+
let input;
|
|
74
|
+
try {
|
|
75
|
+
input = await serializer.deserialize(request, {
|
|
76
|
+
endpoint: () => Promise.resolve(request), ...serdeContextBase
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
catch (error) {
|
|
80
|
+
if ((0, server_common_1.isFrameworkException)(error)) {
|
|
81
|
+
return serializeFrameworkException(error, serdeContextBase);
|
|
82
|
+
}
|
|
83
|
+
;
|
|
84
|
+
return serializeFrameworkException(new server_common_1.SerializationException(), serdeContextBase);
|
|
85
|
+
}
|
|
86
|
+
try {
|
|
87
|
+
let validationFailures = validationFn(input);
|
|
88
|
+
if (validationFailures && validationFailures.length > 0) {
|
|
89
|
+
let validationException = validationCustomizer({ operation: operationName }, validationFailures);
|
|
90
|
+
if (validationException) {
|
|
91
|
+
return serializer.serializeError(validationException, serdeContextBase);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
let output = await operation(input, context);
|
|
95
|
+
return serializer.serialize(output, serdeContextBase);
|
|
96
|
+
}
|
|
97
|
+
catch (error) {
|
|
98
|
+
if (serializer.isOperationError(error)) {
|
|
99
|
+
return serializer.serializeError(error, serdeContextBase);
|
|
100
|
+
}
|
|
101
|
+
console.log('Received an unexpected error', error);
|
|
102
|
+
return serializeFrameworkException(new server_common_1.InternalFailureException(), serdeContextBase);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
class OnboardUserHandler {
|
|
106
|
+
constructor(operation, mux, serializer, serializeFrameworkException, validationCustomizer) {
|
|
107
|
+
this.operation = operation;
|
|
108
|
+
this.mux = mux;
|
|
109
|
+
this.serializer = serializer;
|
|
110
|
+
this.serializeFrameworkException = serializeFrameworkException;
|
|
111
|
+
this.validationCustomizer = validationCustomizer;
|
|
112
|
+
}
|
|
113
|
+
async handle(request, context) {
|
|
114
|
+
const target = this.mux.match(request);
|
|
115
|
+
if (target === undefined) {
|
|
116
|
+
console.log('Received a request that did not match software.amazon.smithy.app#AppAPI.OnboardUser. This indicates a misconfiguration.');
|
|
117
|
+
return this.serializeFrameworkException(new server_common_1.InternalFailureException(), serdeContextBase);
|
|
118
|
+
}
|
|
119
|
+
return handle(request, context, "OnboardUser", this.serializer, this.operation, this.serializeFrameworkException, OnboardUserServerInput.validate, this.validationCustomizer);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
exports.OnboardUserHandler = OnboardUserHandler;
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PinnedShopHandler = exports.getPinnedShopHandler = exports.PinnedShopSerializer = exports.PinnedShopServerInput = 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 PinnedShopServerInput;
|
|
11
|
+
(function (PinnedShopServerInput) {
|
|
12
|
+
PinnedShopServerInput.validate = models_0_1.PinnedShopInput.validate;
|
|
13
|
+
})(PinnedShopServerInput = exports.PinnedShopServerInput || (exports.PinnedShopServerInput = {}));
|
|
14
|
+
class PinnedShopSerializer {
|
|
15
|
+
constructor() {
|
|
16
|
+
this.serialize = Aws_restJson1_1.serializePinnedShopResponse;
|
|
17
|
+
this.deserialize = Aws_restJson1_1.deserializePinnedShopRequest;
|
|
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.PinnedShopSerializer = PinnedShopSerializer;
|
|
39
|
+
const getPinnedShopHandler = (operation) => {
|
|
40
|
+
const mux = new server_common_1.httpbinding.HttpBindingMux([
|
|
41
|
+
new server_common_1.httpbinding.UriSpec('GET', [
|
|
42
|
+
{ type: 'path_literal', value: "shops" },
|
|
43
|
+
{ type: 'path_literal', value: "pinned" },
|
|
44
|
+
], [
|
|
45
|
+
{ type: 'query', key: "shop_id" },
|
|
46
|
+
{ type: 'query', key: "lat" },
|
|
47
|
+
{ type: 'query', key: "lon" },
|
|
48
|
+
], { service: "AppAPI", operation: "PinnedShop" }),
|
|
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 PinnedShopHandler(operation, mux, new PinnedShopSerializer(), Aws_restJson1_1.serializeFrameworkException, customizer);
|
|
65
|
+
};
|
|
66
|
+
exports.getPinnedShopHandler = getPinnedShopHandler;
|
|
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 PinnedShopHandler {
|
|
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.PinnedShop. This indicates a misconfiguration.');
|
|
121
|
+
return this.serializeFrameworkException(new server_common_1.InternalFailureException(), serdeContextBase);
|
|
122
|
+
}
|
|
123
|
+
return handle(request, context, "PinnedShop", this.serializer, this.operation, this.serializeFrameworkException, PinnedShopServerInput.validate, this.validationCustomizer);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
exports.PinnedShopHandler = PinnedShopHandler;
|