@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,122 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FavoriteShopsHandler = exports.getFavoriteShopsHandler = exports.FavoriteShopsSerializer = exports.FavoriteShopsServerInput = 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 FavoriteShopsServerInput;
|
|
11
|
+
(function (FavoriteShopsServerInput) {
|
|
12
|
+
FavoriteShopsServerInput.validate = models_0_1.ShopListInput.validate;
|
|
13
|
+
})(FavoriteShopsServerInput = exports.FavoriteShopsServerInput || (exports.FavoriteShopsServerInput = {}));
|
|
14
|
+
class FavoriteShopsSerializer {
|
|
15
|
+
constructor() {
|
|
16
|
+
this.serialize = Aws_restJson1_1.serializeFavoriteShopsResponse;
|
|
17
|
+
this.deserialize = Aws_restJson1_1.deserializeFavoriteShopsRequest;
|
|
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.FavoriteShopsSerializer = FavoriteShopsSerializer;
|
|
39
|
+
const getFavoriteShopsHandler = (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: "favorite" },
|
|
44
|
+
], [], { service: "AppAPI", operation: "FavoriteShops" }),
|
|
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 FavoriteShopsHandler(operation, mux, new FavoriteShopsSerializer(), Aws_restJson1_1.serializeFrameworkException, customizer);
|
|
61
|
+
};
|
|
62
|
+
exports.getFavoriteShopsHandler = getFavoriteShopsHandler;
|
|
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 FavoriteShopsHandler {
|
|
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.FavoriteShops. This indicates a misconfiguration.');
|
|
117
|
+
return this.serializeFrameworkException(new server_common_1.InternalFailureException(), serdeContextBase);
|
|
118
|
+
}
|
|
119
|
+
return handle(request, context, "FavoriteShops", this.serializer, this.operation, this.serializeFrameworkException, FavoriteShopsServerInput.validate, this.validationCustomizer);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
exports.FavoriteShopsHandler = FavoriteShopsHandler;
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GetShopHandler = exports.getGetShopHandler = exports.GetShopSerializer = exports.GetShopServerInput = 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 GetShopServerInput;
|
|
11
|
+
(function (GetShopServerInput) {
|
|
12
|
+
GetShopServerInput.validate = models_0_1.GetShopInput.validate;
|
|
13
|
+
})(GetShopServerInput = exports.GetShopServerInput || (exports.GetShopServerInput = {}));
|
|
14
|
+
class GetShopSerializer {
|
|
15
|
+
constructor() {
|
|
16
|
+
this.serialize = Aws_restJson1_1.serializeGetShopResponse;
|
|
17
|
+
this.deserialize = Aws_restJson1_1.deserializeGetShopRequest;
|
|
18
|
+
}
|
|
19
|
+
isOperationError(error) {
|
|
20
|
+
const names = ["ValidationException", "RuntimeError", "NotFoundError"];
|
|
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
|
+
case "NotFoundError": {
|
|
33
|
+
return (0, Aws_restJson1_1.serializeNotFoundErrorError)(error, ctx);
|
|
34
|
+
}
|
|
35
|
+
default: {
|
|
36
|
+
throw error;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
exports.GetShopSerializer = GetShopSerializer;
|
|
42
|
+
const getGetShopHandler = (operation) => {
|
|
43
|
+
const mux = new server_common_1.httpbinding.HttpBindingMux([
|
|
44
|
+
new server_common_1.httpbinding.UriSpec('GET', [
|
|
45
|
+
{ type: 'path_literal', value: "shops" },
|
|
46
|
+
{ type: 'path_literal', value: "shop" },
|
|
47
|
+
{ type: 'path' },
|
|
48
|
+
], [], { service: "AppAPI", operation: "GetShop" }),
|
|
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 GetShopHandler(operation, mux, new GetShopSerializer(), Aws_restJson1_1.serializeFrameworkException, customizer);
|
|
65
|
+
};
|
|
66
|
+
exports.getGetShopHandler = getGetShopHandler;
|
|
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 GetShopHandler {
|
|
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.GetShop. This indicates a misconfiguration.');
|
|
121
|
+
return this.serializeFrameworkException(new server_common_1.InternalFailureException(), serdeContextBase);
|
|
122
|
+
}
|
|
123
|
+
return handle(request, context, "GetShop", this.serializer, this.operation, this.serializeFrameworkException, GetShopServerInput.validate, this.validationCustomizer);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
exports.GetShopHandler = GetShopHandler;
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GetShopPublicHandler = exports.getGetShopPublicHandler = exports.GetShopPublicSerializer = exports.GetShopPublicServerInput = 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 GetShopPublicServerInput;
|
|
11
|
+
(function (GetShopPublicServerInput) {
|
|
12
|
+
GetShopPublicServerInput.validate = models_0_1.GetShopInput.validate;
|
|
13
|
+
})(GetShopPublicServerInput = exports.GetShopPublicServerInput || (exports.GetShopPublicServerInput = {}));
|
|
14
|
+
class GetShopPublicSerializer {
|
|
15
|
+
constructor() {
|
|
16
|
+
this.serialize = Aws_restJson1_1.serializeGetShopPublicResponse;
|
|
17
|
+
this.deserialize = Aws_restJson1_1.deserializeGetShopPublicRequest;
|
|
18
|
+
}
|
|
19
|
+
isOperationError(error) {
|
|
20
|
+
const names = ["ValidationException", "RuntimeError", "NotFoundError"];
|
|
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
|
+
case "NotFoundError": {
|
|
33
|
+
return (0, Aws_restJson1_1.serializeNotFoundErrorError)(error, ctx);
|
|
34
|
+
}
|
|
35
|
+
default: {
|
|
36
|
+
throw error;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
exports.GetShopPublicSerializer = GetShopPublicSerializer;
|
|
42
|
+
const getGetShopPublicHandler = (operation) => {
|
|
43
|
+
const mux = new server_common_1.httpbinding.HttpBindingMux([
|
|
44
|
+
new server_common_1.httpbinding.UriSpec('GET', [
|
|
45
|
+
{ type: 'path_literal', value: "public" },
|
|
46
|
+
{ type: 'path_literal', value: "shops" },
|
|
47
|
+
{ type: 'path_literal', value: "shop" },
|
|
48
|
+
{ type: 'path' },
|
|
49
|
+
], [], { service: "AppAPI", operation: "GetShopPublic" }),
|
|
50
|
+
]);
|
|
51
|
+
const customizer = (ctx, failures) => {
|
|
52
|
+
if (!failures) {
|
|
53
|
+
return undefined;
|
|
54
|
+
}
|
|
55
|
+
return {
|
|
56
|
+
name: "ValidationException",
|
|
57
|
+
$fault: "client",
|
|
58
|
+
message: (0, server_common_1.generateValidationSummary)(failures),
|
|
59
|
+
fieldList: failures.map(failure => ({
|
|
60
|
+
path: failure.path,
|
|
61
|
+
message: (0, server_common_1.generateValidationMessage)(failure)
|
|
62
|
+
}))
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
return new GetShopPublicHandler(operation, mux, new GetShopPublicSerializer(), Aws_restJson1_1.serializeFrameworkException, customizer);
|
|
66
|
+
};
|
|
67
|
+
exports.getGetShopPublicHandler = getGetShopPublicHandler;
|
|
68
|
+
const serdeContextBase = {
|
|
69
|
+
base64Encoder: util_base64_1.toBase64,
|
|
70
|
+
base64Decoder: util_base64_1.fromBase64,
|
|
71
|
+
utf8Encoder: util_utf8_1.toUtf8,
|
|
72
|
+
utf8Decoder: util_utf8_1.fromUtf8,
|
|
73
|
+
streamCollector: node_http_handler_1.streamCollector,
|
|
74
|
+
requestHandler: new node_http_handler_1.NodeHttpHandler(),
|
|
75
|
+
disableHostPrefix: true
|
|
76
|
+
};
|
|
77
|
+
async function handle(request, context, operationName, serializer, operation, serializeFrameworkException, validationFn, validationCustomizer) {
|
|
78
|
+
let input;
|
|
79
|
+
try {
|
|
80
|
+
input = await serializer.deserialize(request, {
|
|
81
|
+
endpoint: () => Promise.resolve(request), ...serdeContextBase
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
catch (error) {
|
|
85
|
+
if ((0, server_common_1.isFrameworkException)(error)) {
|
|
86
|
+
return serializeFrameworkException(error, serdeContextBase);
|
|
87
|
+
}
|
|
88
|
+
;
|
|
89
|
+
return serializeFrameworkException(new server_common_1.SerializationException(), serdeContextBase);
|
|
90
|
+
}
|
|
91
|
+
try {
|
|
92
|
+
let validationFailures = validationFn(input);
|
|
93
|
+
if (validationFailures && validationFailures.length > 0) {
|
|
94
|
+
let validationException = validationCustomizer({ operation: operationName }, validationFailures);
|
|
95
|
+
if (validationException) {
|
|
96
|
+
return serializer.serializeError(validationException, serdeContextBase);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
let output = await operation(input, context);
|
|
100
|
+
return serializer.serialize(output, serdeContextBase);
|
|
101
|
+
}
|
|
102
|
+
catch (error) {
|
|
103
|
+
if (serializer.isOperationError(error)) {
|
|
104
|
+
return serializer.serializeError(error, serdeContextBase);
|
|
105
|
+
}
|
|
106
|
+
console.log('Received an unexpected error', error);
|
|
107
|
+
return serializeFrameworkException(new server_common_1.InternalFailureException(), serdeContextBase);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
class GetShopPublicHandler {
|
|
111
|
+
constructor(operation, mux, serializer, serializeFrameworkException, validationCustomizer) {
|
|
112
|
+
this.operation = operation;
|
|
113
|
+
this.mux = mux;
|
|
114
|
+
this.serializer = serializer;
|
|
115
|
+
this.serializeFrameworkException = serializeFrameworkException;
|
|
116
|
+
this.validationCustomizer = validationCustomizer;
|
|
117
|
+
}
|
|
118
|
+
async handle(request, context) {
|
|
119
|
+
const target = this.mux.match(request);
|
|
120
|
+
if (target === undefined) {
|
|
121
|
+
console.log('Received a request that did not match software.amazon.smithy.app#AppAPI.GetShopPublic. This indicates a misconfiguration.');
|
|
122
|
+
return this.serializeFrameworkException(new server_common_1.InternalFailureException(), serdeContextBase);
|
|
123
|
+
}
|
|
124
|
+
return handle(request, context, "GetShopPublic", this.serializer, this.operation, this.serializeFrameworkException, GetShopPublicServerInput.validate, this.validationCustomizer);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
exports.GetShopPublicHandler = GetShopPublicHandler;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GetUserHandler = exports.getGetUserHandler = exports.GetUserSerializer = exports.GetUserServerInput = 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 GetUserServerInput;
|
|
11
|
+
(function (GetUserServerInput) {
|
|
12
|
+
GetUserServerInput.validate = models_0_1.GetUserInput.validate;
|
|
13
|
+
})(GetUserServerInput = exports.GetUserServerInput || (exports.GetUserServerInput = {}));
|
|
14
|
+
class GetUserSerializer {
|
|
15
|
+
constructor() {
|
|
16
|
+
this.serialize = Aws_restJson1_1.serializeGetUserResponse;
|
|
17
|
+
this.deserialize = Aws_restJson1_1.deserializeGetUserRequest;
|
|
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.GetUserSerializer = GetUserSerializer;
|
|
39
|
+
const getGetUserHandler = (operation) => {
|
|
40
|
+
const mux = new server_common_1.httpbinding.HttpBindingMux([
|
|
41
|
+
new server_common_1.httpbinding.UriSpec('GET', [
|
|
42
|
+
{ type: 'path_literal', value: "user" },
|
|
43
|
+
], [], { service: "AppAPI", operation: "GetUser" }),
|
|
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 GetUserHandler(operation, mux, new GetUserSerializer(), Aws_restJson1_1.serializeFrameworkException, customizer);
|
|
60
|
+
};
|
|
61
|
+
exports.getGetUserHandler = getGetUserHandler;
|
|
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 GetUserHandler {
|
|
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.GetUser. This indicates a misconfiguration.');
|
|
116
|
+
return this.serializeFrameworkException(new server_common_1.InternalFailureException(), serdeContextBase);
|
|
117
|
+
}
|
|
118
|
+
return handle(request, context, "GetUser", this.serializer, this.operation, this.serializeFrameworkException, GetUserServerInput.validate, this.validationCustomizer);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
exports.GetUserHandler = GetUserHandler;
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LikeOrgHandler = exports.getLikeOrgHandler = exports.LikeOrgSerializer = exports.LikeOrgServerInput = 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 LikeOrgServerInput;
|
|
11
|
+
(function (LikeOrgServerInput) {
|
|
12
|
+
LikeOrgServerInput.validate = models_0_1.LikeOrgInput.validate;
|
|
13
|
+
})(LikeOrgServerInput = exports.LikeOrgServerInput || (exports.LikeOrgServerInput = {}));
|
|
14
|
+
class LikeOrgSerializer {
|
|
15
|
+
constructor() {
|
|
16
|
+
this.serialize = Aws_restJson1_1.serializeLikeOrgResponse;
|
|
17
|
+
this.deserialize = Aws_restJson1_1.deserializeLikeOrgRequest;
|
|
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.LikeOrgSerializer = LikeOrgSerializer;
|
|
39
|
+
const getLikeOrgHandler = (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: "like" },
|
|
44
|
+
], [
|
|
45
|
+
{ type: 'query', key: "org_id" },
|
|
46
|
+
], { service: "AppAPI", operation: "LikeOrg" }),
|
|
47
|
+
]);
|
|
48
|
+
const customizer = (ctx, failures) => {
|
|
49
|
+
if (!failures) {
|
|
50
|
+
return undefined;
|
|
51
|
+
}
|
|
52
|
+
return {
|
|
53
|
+
name: "ValidationException",
|
|
54
|
+
$fault: "client",
|
|
55
|
+
message: (0, server_common_1.generateValidationSummary)(failures),
|
|
56
|
+
fieldList: failures.map(failure => ({
|
|
57
|
+
path: failure.path,
|
|
58
|
+
message: (0, server_common_1.generateValidationMessage)(failure)
|
|
59
|
+
}))
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
return new LikeOrgHandler(operation, mux, new LikeOrgSerializer(), Aws_restJson1_1.serializeFrameworkException, customizer);
|
|
63
|
+
};
|
|
64
|
+
exports.getLikeOrgHandler = getLikeOrgHandler;
|
|
65
|
+
const serdeContextBase = {
|
|
66
|
+
base64Encoder: util_base64_1.toBase64,
|
|
67
|
+
base64Decoder: util_base64_1.fromBase64,
|
|
68
|
+
utf8Encoder: util_utf8_1.toUtf8,
|
|
69
|
+
utf8Decoder: util_utf8_1.fromUtf8,
|
|
70
|
+
streamCollector: node_http_handler_1.streamCollector,
|
|
71
|
+
requestHandler: new node_http_handler_1.NodeHttpHandler(),
|
|
72
|
+
disableHostPrefix: true
|
|
73
|
+
};
|
|
74
|
+
async function handle(request, context, operationName, serializer, operation, serializeFrameworkException, validationFn, validationCustomizer) {
|
|
75
|
+
let input;
|
|
76
|
+
try {
|
|
77
|
+
input = await serializer.deserialize(request, {
|
|
78
|
+
endpoint: () => Promise.resolve(request), ...serdeContextBase
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
catch (error) {
|
|
82
|
+
if ((0, server_common_1.isFrameworkException)(error)) {
|
|
83
|
+
return serializeFrameworkException(error, serdeContextBase);
|
|
84
|
+
}
|
|
85
|
+
;
|
|
86
|
+
return serializeFrameworkException(new server_common_1.SerializationException(), serdeContextBase);
|
|
87
|
+
}
|
|
88
|
+
try {
|
|
89
|
+
let validationFailures = validationFn(input);
|
|
90
|
+
if (validationFailures && validationFailures.length > 0) {
|
|
91
|
+
let validationException = validationCustomizer({ operation: operationName }, validationFailures);
|
|
92
|
+
if (validationException) {
|
|
93
|
+
return serializer.serializeError(validationException, serdeContextBase);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
let output = await operation(input, context);
|
|
97
|
+
return serializer.serialize(output, serdeContextBase);
|
|
98
|
+
}
|
|
99
|
+
catch (error) {
|
|
100
|
+
if (serializer.isOperationError(error)) {
|
|
101
|
+
return serializer.serializeError(error, serdeContextBase);
|
|
102
|
+
}
|
|
103
|
+
console.log('Received an unexpected error', error);
|
|
104
|
+
return serializeFrameworkException(new server_common_1.InternalFailureException(), serdeContextBase);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
class LikeOrgHandler {
|
|
108
|
+
constructor(operation, mux, serializer, serializeFrameworkException, validationCustomizer) {
|
|
109
|
+
this.operation = operation;
|
|
110
|
+
this.mux = mux;
|
|
111
|
+
this.serializer = serializer;
|
|
112
|
+
this.serializeFrameworkException = serializeFrameworkException;
|
|
113
|
+
this.validationCustomizer = validationCustomizer;
|
|
114
|
+
}
|
|
115
|
+
async handle(request, context) {
|
|
116
|
+
const target = this.mux.match(request);
|
|
117
|
+
if (target === undefined) {
|
|
118
|
+
console.log('Received a request that did not match software.amazon.smithy.app#AppAPI.LikeOrg. This indicates a misconfiguration.');
|
|
119
|
+
return this.serializeFrameworkException(new server_common_1.InternalFailureException(), serdeContextBase);
|
|
120
|
+
}
|
|
121
|
+
return handle(request, context, "LikeOrg", this.serializer, this.operation, this.serializeFrameworkException, LikeOrgServerInput.validate, this.validationCustomizer);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
exports.LikeOrgHandler = LikeOrgHandler;
|