b23-lib 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -0
- package/dist/index.d.mts +279 -0
- package/dist/index.d.ts +279 -0
- package/dist/index.js +569 -0
- package/dist/index.mjs +542 -0
- package/package.json +33 -0
package/README.md
ADDED
|
Binary file
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
import * as _aws_sdk_util_dynamodb from '@aws-sdk/util-dynamodb';
|
|
2
|
+
import { marshall } from '@aws-sdk/util-dynamodb';
|
|
3
|
+
import { AttributeValue, ReturnItemCollectionMetrics, ReturnValue, ReturnValuesOnConditionCheckFailure, TransactWriteItem } from '@aws-sdk/client-dynamodb';
|
|
4
|
+
import * as jose from 'jose';
|
|
5
|
+
|
|
6
|
+
declare class DynamoDBUtility {
|
|
7
|
+
private client;
|
|
8
|
+
private returnItemCollectionMetrics;
|
|
9
|
+
private logCapacity;
|
|
10
|
+
private region;
|
|
11
|
+
marshall: typeof marshall;
|
|
12
|
+
unmarshall: (data: Record<string, AttributeValue> | AttributeValue, options?: _aws_sdk_util_dynamodb.unmarshallOptions) => Record<string, _aws_sdk_util_dynamodb.NativeAttributeValue>;
|
|
13
|
+
ReturnValue: {
|
|
14
|
+
readonly ALL_NEW: "ALL_NEW";
|
|
15
|
+
readonly ALL_OLD: "ALL_OLD";
|
|
16
|
+
readonly NONE: "NONE";
|
|
17
|
+
readonly UPDATED_NEW: "UPDATED_NEW";
|
|
18
|
+
readonly UPDATED_OLD: "UPDATED_OLD";
|
|
19
|
+
};
|
|
20
|
+
ReturnItemCollectionMetrics: {
|
|
21
|
+
readonly NONE: "NONE";
|
|
22
|
+
readonly SIZE: "SIZE";
|
|
23
|
+
};
|
|
24
|
+
ReturnValuesOnConditionCheckFailure: {
|
|
25
|
+
readonly ALL_OLD: "ALL_OLD";
|
|
26
|
+
readonly NONE: "NONE";
|
|
27
|
+
};
|
|
28
|
+
constructor({ region, returnItemCollectionMetrics, logCapacity }: {
|
|
29
|
+
region: string;
|
|
30
|
+
returnItemCollectionMetrics: ReturnItemCollectionMetrics;
|
|
31
|
+
logCapacity: boolean;
|
|
32
|
+
});
|
|
33
|
+
private log;
|
|
34
|
+
putItem(TableName: string, item: object, condition: string, attributeName?: Record<string, string>, attributeValue?: Record<string, AttributeValue>, ReturnValues?: ReturnValue, ReturnValuesOnFailure?: ReturnValuesOnConditionCheckFailure): Promise<Record<string, any>>;
|
|
35
|
+
transactWriteItems(transactItems: TransactWriteItem[]): Promise<void>;
|
|
36
|
+
getItem(TableName: string, key: object, consistent?: boolean, projection?: string, attributeName?: Record<string, string>): Promise<Record<string, any>>;
|
|
37
|
+
batchGetItem(TableName: string, keys: object[], consistent?: boolean, projection?: string, attributeName?: Record<string, string>): Promise<Record<string, any>[]>;
|
|
38
|
+
queryItems(TableName: string, keyCondition: string, consistent?: boolean, projection?: string, attributeName?: Record<string, string>, attributeValue?: Record<string, AttributeValue>, lastEvaluatedKey?: Record<string, AttributeValue>): Promise<{
|
|
39
|
+
items: Record<string, any>[];
|
|
40
|
+
lastEvaluatedKey: Record<string, AttributeValue> | undefined;
|
|
41
|
+
}>;
|
|
42
|
+
scanItems(TableName: string, filterExpression?: string, consistent?: boolean, projection?: string, attributeName?: Record<string, string>, attributeValue?: Record<string, AttributeValue>, lastEvaluatedKey?: Record<string, AttributeValue>): Promise<{
|
|
43
|
+
items: Record<string, any>[];
|
|
44
|
+
lastEvaluatedKey: Record<string, AttributeValue> | undefined;
|
|
45
|
+
}>;
|
|
46
|
+
partiQL(statement: string, parameter?: AttributeValue[], nextToken?: string, consistent?: boolean): Promise<{
|
|
47
|
+
Items: Record<string, any>[];
|
|
48
|
+
nextToken: string | undefined;
|
|
49
|
+
lastEvaluatedKey: Record<string, AttributeValue> | undefined;
|
|
50
|
+
}>;
|
|
51
|
+
updateItem(TableName: string, key: object, condition: string, update: string, attributeName?: Record<string, string>, attributeValue?: Record<string, AttributeValue>, ReturnValues?: ReturnValue, ReturnValuesOnFailure?: ReturnValuesOnConditionCheckFailure): Promise<Record<string, any>>;
|
|
52
|
+
deleteItem(TableName: string, key: object, condition: string, attributeName?: Record<string, string>, attributeValue?: Record<string, AttributeValue>, ReturnValues?: ReturnValue, ReturnValuesOnFailure?: ReturnValuesOnConditionCheckFailure): Promise<Record<string, any>>;
|
|
53
|
+
getItemByIndex(TableName: string, index: string, keyCondition: string, consistent?: boolean, projection?: string, attributeName?: Record<string, string>, attributeValue?: Record<string, AttributeValue>): Promise<{
|
|
54
|
+
Items: Record<string, any>[];
|
|
55
|
+
}>;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
declare const Schema: {
|
|
59
|
+
getStandardSchemaDefinition(): {
|
|
60
|
+
$id: string;
|
|
61
|
+
definitions: {
|
|
62
|
+
lowercaseText: {
|
|
63
|
+
type: string;
|
|
64
|
+
pattern: string;
|
|
65
|
+
};
|
|
66
|
+
lowercaseText10: {
|
|
67
|
+
type: string;
|
|
68
|
+
pattern: string;
|
|
69
|
+
};
|
|
70
|
+
lowercaseText16: {
|
|
71
|
+
type: string;
|
|
72
|
+
pattern: string;
|
|
73
|
+
};
|
|
74
|
+
lowercaseText30: {
|
|
75
|
+
type: string;
|
|
76
|
+
pattern: string;
|
|
77
|
+
};
|
|
78
|
+
lowercaseText50: {
|
|
79
|
+
type: string;
|
|
80
|
+
pattern: string;
|
|
81
|
+
};
|
|
82
|
+
lowercaseText256: {
|
|
83
|
+
type: string;
|
|
84
|
+
pattern: string;
|
|
85
|
+
};
|
|
86
|
+
text: {
|
|
87
|
+
type: string;
|
|
88
|
+
pattern: string;
|
|
89
|
+
};
|
|
90
|
+
text10: {
|
|
91
|
+
type: string;
|
|
92
|
+
pattern: string;
|
|
93
|
+
};
|
|
94
|
+
text16: {
|
|
95
|
+
type: string;
|
|
96
|
+
pattern: string;
|
|
97
|
+
};
|
|
98
|
+
text30: {
|
|
99
|
+
type: string;
|
|
100
|
+
pattern: string;
|
|
101
|
+
};
|
|
102
|
+
text50: {
|
|
103
|
+
type: string;
|
|
104
|
+
pattern: string;
|
|
105
|
+
};
|
|
106
|
+
text256: {
|
|
107
|
+
type: string;
|
|
108
|
+
pattern: string;
|
|
109
|
+
};
|
|
110
|
+
requiredText: {
|
|
111
|
+
type: string;
|
|
112
|
+
pattern: string;
|
|
113
|
+
};
|
|
114
|
+
requiredText10: {
|
|
115
|
+
type: string;
|
|
116
|
+
pattern: string;
|
|
117
|
+
};
|
|
118
|
+
requiredText16: {
|
|
119
|
+
type: string;
|
|
120
|
+
pattern: string;
|
|
121
|
+
};
|
|
122
|
+
requiredText30: {
|
|
123
|
+
type: string;
|
|
124
|
+
pattern: string;
|
|
125
|
+
};
|
|
126
|
+
requiredText50: {
|
|
127
|
+
type: string;
|
|
128
|
+
pattern: string;
|
|
129
|
+
};
|
|
130
|
+
requiredText256: {
|
|
131
|
+
type: string;
|
|
132
|
+
pattern: string;
|
|
133
|
+
};
|
|
134
|
+
url: {
|
|
135
|
+
type: string;
|
|
136
|
+
pattern: string;
|
|
137
|
+
maxLength: number;
|
|
138
|
+
};
|
|
139
|
+
uuid: {
|
|
140
|
+
type: string;
|
|
141
|
+
minLength: number;
|
|
142
|
+
pattern: string;
|
|
143
|
+
};
|
|
144
|
+
productKey: {
|
|
145
|
+
type: string;
|
|
146
|
+
pattern: string;
|
|
147
|
+
};
|
|
148
|
+
variantId: {
|
|
149
|
+
type: string;
|
|
150
|
+
pattern: string;
|
|
151
|
+
};
|
|
152
|
+
firstName: {
|
|
153
|
+
$ref: string;
|
|
154
|
+
};
|
|
155
|
+
lastName: {
|
|
156
|
+
$ref: string;
|
|
157
|
+
};
|
|
158
|
+
phone: {
|
|
159
|
+
type: string;
|
|
160
|
+
pattern: string;
|
|
161
|
+
};
|
|
162
|
+
email: {
|
|
163
|
+
type: string;
|
|
164
|
+
pattern: string;
|
|
165
|
+
};
|
|
166
|
+
addressLine1: {
|
|
167
|
+
$ref: string;
|
|
168
|
+
};
|
|
169
|
+
addressLine2: {
|
|
170
|
+
$ref: string;
|
|
171
|
+
};
|
|
172
|
+
city: {
|
|
173
|
+
$ref: string;
|
|
174
|
+
};
|
|
175
|
+
postalCode: {
|
|
176
|
+
$ref: string;
|
|
177
|
+
};
|
|
178
|
+
state: {
|
|
179
|
+
type: string;
|
|
180
|
+
enum: string[];
|
|
181
|
+
};
|
|
182
|
+
country: {
|
|
183
|
+
type: string;
|
|
184
|
+
enum: string[];
|
|
185
|
+
};
|
|
186
|
+
currency: {
|
|
187
|
+
type: string;
|
|
188
|
+
enum: string[];
|
|
189
|
+
};
|
|
190
|
+
locale: {
|
|
191
|
+
type: string;
|
|
192
|
+
enum: string[];
|
|
193
|
+
};
|
|
194
|
+
addressType: {
|
|
195
|
+
type: string;
|
|
196
|
+
enum: string[];
|
|
197
|
+
};
|
|
198
|
+
address: {
|
|
199
|
+
type: string;
|
|
200
|
+
properties: {
|
|
201
|
+
firstName: {
|
|
202
|
+
$ref: string;
|
|
203
|
+
};
|
|
204
|
+
lastName: {
|
|
205
|
+
$ref: string;
|
|
206
|
+
};
|
|
207
|
+
phone: {
|
|
208
|
+
$ref: string;
|
|
209
|
+
};
|
|
210
|
+
email: {
|
|
211
|
+
$ref: string;
|
|
212
|
+
};
|
|
213
|
+
addressLine1: {
|
|
214
|
+
$ref: string;
|
|
215
|
+
};
|
|
216
|
+
addressLine2: {
|
|
217
|
+
$ref: string;
|
|
218
|
+
};
|
|
219
|
+
city: {
|
|
220
|
+
$ref: string;
|
|
221
|
+
};
|
|
222
|
+
postalCode: {
|
|
223
|
+
$ref: string;
|
|
224
|
+
};
|
|
225
|
+
state: {
|
|
226
|
+
$ref: string;
|
|
227
|
+
};
|
|
228
|
+
country: {
|
|
229
|
+
$ref: string;
|
|
230
|
+
};
|
|
231
|
+
};
|
|
232
|
+
required: string[];
|
|
233
|
+
};
|
|
234
|
+
};
|
|
235
|
+
};
|
|
236
|
+
};
|
|
237
|
+
|
|
238
|
+
declare class AuthUtility {
|
|
239
|
+
private secretToken;
|
|
240
|
+
private maxTokenAge;
|
|
241
|
+
constructor({ secret, maxTokenAge }: {
|
|
242
|
+
secret: string;
|
|
243
|
+
maxTokenAge: string;
|
|
244
|
+
});
|
|
245
|
+
createToken(id: string, additionalData: object): Promise<string>;
|
|
246
|
+
verifyToken(token: string): Promise<jose.JWTPayload>;
|
|
247
|
+
AuthMiddleware(): (req: any, res: any, next: any) => Promise<void>;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
declare const ResponseUtility: {
|
|
251
|
+
handleException: (functionName: string, error: any, res: any) => void;
|
|
252
|
+
generateResponse: (status: number, data?: any, error?: string) => {
|
|
253
|
+
status: number;
|
|
254
|
+
data: any;
|
|
255
|
+
error: string | undefined;
|
|
256
|
+
};
|
|
257
|
+
generateError: (status: number, error: string, knownError?: Boolean, logError?: boolean) => {
|
|
258
|
+
status: number;
|
|
259
|
+
error: string;
|
|
260
|
+
knownError: Boolean;
|
|
261
|
+
logError: boolean;
|
|
262
|
+
};
|
|
263
|
+
};
|
|
264
|
+
|
|
265
|
+
type SuccessType = {
|
|
266
|
+
status: number;
|
|
267
|
+
statusText: string;
|
|
268
|
+
data: any;
|
|
269
|
+
};
|
|
270
|
+
declare const Fetch: (baseURL: string, endpoint: string, method?: "GET" | "POST" | "PATCH" | "DELETE", headers?: Record<string, string>, payload?: any) => Promise<SuccessType>;
|
|
271
|
+
|
|
272
|
+
declare const Logger: {
|
|
273
|
+
logException: (functionName: string, error: any) => void;
|
|
274
|
+
logError: (functionName: string, errorMessage: string) => void;
|
|
275
|
+
logMessage: (functionName: string, message: any) => void;
|
|
276
|
+
logInvalidPayload: (functionName: string, errorMessage: string) => void;
|
|
277
|
+
};
|
|
278
|
+
|
|
279
|
+
export { AuthUtility as Auth, DynamoDBUtility as DynamoDB, Fetch, Logger, ResponseUtility, Schema };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
import * as _aws_sdk_util_dynamodb from '@aws-sdk/util-dynamodb';
|
|
2
|
+
import { marshall } from '@aws-sdk/util-dynamodb';
|
|
3
|
+
import { AttributeValue, ReturnItemCollectionMetrics, ReturnValue, ReturnValuesOnConditionCheckFailure, TransactWriteItem } from '@aws-sdk/client-dynamodb';
|
|
4
|
+
import * as jose from 'jose';
|
|
5
|
+
|
|
6
|
+
declare class DynamoDBUtility {
|
|
7
|
+
private client;
|
|
8
|
+
private returnItemCollectionMetrics;
|
|
9
|
+
private logCapacity;
|
|
10
|
+
private region;
|
|
11
|
+
marshall: typeof marshall;
|
|
12
|
+
unmarshall: (data: Record<string, AttributeValue> | AttributeValue, options?: _aws_sdk_util_dynamodb.unmarshallOptions) => Record<string, _aws_sdk_util_dynamodb.NativeAttributeValue>;
|
|
13
|
+
ReturnValue: {
|
|
14
|
+
readonly ALL_NEW: "ALL_NEW";
|
|
15
|
+
readonly ALL_OLD: "ALL_OLD";
|
|
16
|
+
readonly NONE: "NONE";
|
|
17
|
+
readonly UPDATED_NEW: "UPDATED_NEW";
|
|
18
|
+
readonly UPDATED_OLD: "UPDATED_OLD";
|
|
19
|
+
};
|
|
20
|
+
ReturnItemCollectionMetrics: {
|
|
21
|
+
readonly NONE: "NONE";
|
|
22
|
+
readonly SIZE: "SIZE";
|
|
23
|
+
};
|
|
24
|
+
ReturnValuesOnConditionCheckFailure: {
|
|
25
|
+
readonly ALL_OLD: "ALL_OLD";
|
|
26
|
+
readonly NONE: "NONE";
|
|
27
|
+
};
|
|
28
|
+
constructor({ region, returnItemCollectionMetrics, logCapacity }: {
|
|
29
|
+
region: string;
|
|
30
|
+
returnItemCollectionMetrics: ReturnItemCollectionMetrics;
|
|
31
|
+
logCapacity: boolean;
|
|
32
|
+
});
|
|
33
|
+
private log;
|
|
34
|
+
putItem(TableName: string, item: object, condition: string, attributeName?: Record<string, string>, attributeValue?: Record<string, AttributeValue>, ReturnValues?: ReturnValue, ReturnValuesOnFailure?: ReturnValuesOnConditionCheckFailure): Promise<Record<string, any>>;
|
|
35
|
+
transactWriteItems(transactItems: TransactWriteItem[]): Promise<void>;
|
|
36
|
+
getItem(TableName: string, key: object, consistent?: boolean, projection?: string, attributeName?: Record<string, string>): Promise<Record<string, any>>;
|
|
37
|
+
batchGetItem(TableName: string, keys: object[], consistent?: boolean, projection?: string, attributeName?: Record<string, string>): Promise<Record<string, any>[]>;
|
|
38
|
+
queryItems(TableName: string, keyCondition: string, consistent?: boolean, projection?: string, attributeName?: Record<string, string>, attributeValue?: Record<string, AttributeValue>, lastEvaluatedKey?: Record<string, AttributeValue>): Promise<{
|
|
39
|
+
items: Record<string, any>[];
|
|
40
|
+
lastEvaluatedKey: Record<string, AttributeValue> | undefined;
|
|
41
|
+
}>;
|
|
42
|
+
scanItems(TableName: string, filterExpression?: string, consistent?: boolean, projection?: string, attributeName?: Record<string, string>, attributeValue?: Record<string, AttributeValue>, lastEvaluatedKey?: Record<string, AttributeValue>): Promise<{
|
|
43
|
+
items: Record<string, any>[];
|
|
44
|
+
lastEvaluatedKey: Record<string, AttributeValue> | undefined;
|
|
45
|
+
}>;
|
|
46
|
+
partiQL(statement: string, parameter?: AttributeValue[], nextToken?: string, consistent?: boolean): Promise<{
|
|
47
|
+
Items: Record<string, any>[];
|
|
48
|
+
nextToken: string | undefined;
|
|
49
|
+
lastEvaluatedKey: Record<string, AttributeValue> | undefined;
|
|
50
|
+
}>;
|
|
51
|
+
updateItem(TableName: string, key: object, condition: string, update: string, attributeName?: Record<string, string>, attributeValue?: Record<string, AttributeValue>, ReturnValues?: ReturnValue, ReturnValuesOnFailure?: ReturnValuesOnConditionCheckFailure): Promise<Record<string, any>>;
|
|
52
|
+
deleteItem(TableName: string, key: object, condition: string, attributeName?: Record<string, string>, attributeValue?: Record<string, AttributeValue>, ReturnValues?: ReturnValue, ReturnValuesOnFailure?: ReturnValuesOnConditionCheckFailure): Promise<Record<string, any>>;
|
|
53
|
+
getItemByIndex(TableName: string, index: string, keyCondition: string, consistent?: boolean, projection?: string, attributeName?: Record<string, string>, attributeValue?: Record<string, AttributeValue>): Promise<{
|
|
54
|
+
Items: Record<string, any>[];
|
|
55
|
+
}>;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
declare const Schema: {
|
|
59
|
+
getStandardSchemaDefinition(): {
|
|
60
|
+
$id: string;
|
|
61
|
+
definitions: {
|
|
62
|
+
lowercaseText: {
|
|
63
|
+
type: string;
|
|
64
|
+
pattern: string;
|
|
65
|
+
};
|
|
66
|
+
lowercaseText10: {
|
|
67
|
+
type: string;
|
|
68
|
+
pattern: string;
|
|
69
|
+
};
|
|
70
|
+
lowercaseText16: {
|
|
71
|
+
type: string;
|
|
72
|
+
pattern: string;
|
|
73
|
+
};
|
|
74
|
+
lowercaseText30: {
|
|
75
|
+
type: string;
|
|
76
|
+
pattern: string;
|
|
77
|
+
};
|
|
78
|
+
lowercaseText50: {
|
|
79
|
+
type: string;
|
|
80
|
+
pattern: string;
|
|
81
|
+
};
|
|
82
|
+
lowercaseText256: {
|
|
83
|
+
type: string;
|
|
84
|
+
pattern: string;
|
|
85
|
+
};
|
|
86
|
+
text: {
|
|
87
|
+
type: string;
|
|
88
|
+
pattern: string;
|
|
89
|
+
};
|
|
90
|
+
text10: {
|
|
91
|
+
type: string;
|
|
92
|
+
pattern: string;
|
|
93
|
+
};
|
|
94
|
+
text16: {
|
|
95
|
+
type: string;
|
|
96
|
+
pattern: string;
|
|
97
|
+
};
|
|
98
|
+
text30: {
|
|
99
|
+
type: string;
|
|
100
|
+
pattern: string;
|
|
101
|
+
};
|
|
102
|
+
text50: {
|
|
103
|
+
type: string;
|
|
104
|
+
pattern: string;
|
|
105
|
+
};
|
|
106
|
+
text256: {
|
|
107
|
+
type: string;
|
|
108
|
+
pattern: string;
|
|
109
|
+
};
|
|
110
|
+
requiredText: {
|
|
111
|
+
type: string;
|
|
112
|
+
pattern: string;
|
|
113
|
+
};
|
|
114
|
+
requiredText10: {
|
|
115
|
+
type: string;
|
|
116
|
+
pattern: string;
|
|
117
|
+
};
|
|
118
|
+
requiredText16: {
|
|
119
|
+
type: string;
|
|
120
|
+
pattern: string;
|
|
121
|
+
};
|
|
122
|
+
requiredText30: {
|
|
123
|
+
type: string;
|
|
124
|
+
pattern: string;
|
|
125
|
+
};
|
|
126
|
+
requiredText50: {
|
|
127
|
+
type: string;
|
|
128
|
+
pattern: string;
|
|
129
|
+
};
|
|
130
|
+
requiredText256: {
|
|
131
|
+
type: string;
|
|
132
|
+
pattern: string;
|
|
133
|
+
};
|
|
134
|
+
url: {
|
|
135
|
+
type: string;
|
|
136
|
+
pattern: string;
|
|
137
|
+
maxLength: number;
|
|
138
|
+
};
|
|
139
|
+
uuid: {
|
|
140
|
+
type: string;
|
|
141
|
+
minLength: number;
|
|
142
|
+
pattern: string;
|
|
143
|
+
};
|
|
144
|
+
productKey: {
|
|
145
|
+
type: string;
|
|
146
|
+
pattern: string;
|
|
147
|
+
};
|
|
148
|
+
variantId: {
|
|
149
|
+
type: string;
|
|
150
|
+
pattern: string;
|
|
151
|
+
};
|
|
152
|
+
firstName: {
|
|
153
|
+
$ref: string;
|
|
154
|
+
};
|
|
155
|
+
lastName: {
|
|
156
|
+
$ref: string;
|
|
157
|
+
};
|
|
158
|
+
phone: {
|
|
159
|
+
type: string;
|
|
160
|
+
pattern: string;
|
|
161
|
+
};
|
|
162
|
+
email: {
|
|
163
|
+
type: string;
|
|
164
|
+
pattern: string;
|
|
165
|
+
};
|
|
166
|
+
addressLine1: {
|
|
167
|
+
$ref: string;
|
|
168
|
+
};
|
|
169
|
+
addressLine2: {
|
|
170
|
+
$ref: string;
|
|
171
|
+
};
|
|
172
|
+
city: {
|
|
173
|
+
$ref: string;
|
|
174
|
+
};
|
|
175
|
+
postalCode: {
|
|
176
|
+
$ref: string;
|
|
177
|
+
};
|
|
178
|
+
state: {
|
|
179
|
+
type: string;
|
|
180
|
+
enum: string[];
|
|
181
|
+
};
|
|
182
|
+
country: {
|
|
183
|
+
type: string;
|
|
184
|
+
enum: string[];
|
|
185
|
+
};
|
|
186
|
+
currency: {
|
|
187
|
+
type: string;
|
|
188
|
+
enum: string[];
|
|
189
|
+
};
|
|
190
|
+
locale: {
|
|
191
|
+
type: string;
|
|
192
|
+
enum: string[];
|
|
193
|
+
};
|
|
194
|
+
addressType: {
|
|
195
|
+
type: string;
|
|
196
|
+
enum: string[];
|
|
197
|
+
};
|
|
198
|
+
address: {
|
|
199
|
+
type: string;
|
|
200
|
+
properties: {
|
|
201
|
+
firstName: {
|
|
202
|
+
$ref: string;
|
|
203
|
+
};
|
|
204
|
+
lastName: {
|
|
205
|
+
$ref: string;
|
|
206
|
+
};
|
|
207
|
+
phone: {
|
|
208
|
+
$ref: string;
|
|
209
|
+
};
|
|
210
|
+
email: {
|
|
211
|
+
$ref: string;
|
|
212
|
+
};
|
|
213
|
+
addressLine1: {
|
|
214
|
+
$ref: string;
|
|
215
|
+
};
|
|
216
|
+
addressLine2: {
|
|
217
|
+
$ref: string;
|
|
218
|
+
};
|
|
219
|
+
city: {
|
|
220
|
+
$ref: string;
|
|
221
|
+
};
|
|
222
|
+
postalCode: {
|
|
223
|
+
$ref: string;
|
|
224
|
+
};
|
|
225
|
+
state: {
|
|
226
|
+
$ref: string;
|
|
227
|
+
};
|
|
228
|
+
country: {
|
|
229
|
+
$ref: string;
|
|
230
|
+
};
|
|
231
|
+
};
|
|
232
|
+
required: string[];
|
|
233
|
+
};
|
|
234
|
+
};
|
|
235
|
+
};
|
|
236
|
+
};
|
|
237
|
+
|
|
238
|
+
declare class AuthUtility {
|
|
239
|
+
private secretToken;
|
|
240
|
+
private maxTokenAge;
|
|
241
|
+
constructor({ secret, maxTokenAge }: {
|
|
242
|
+
secret: string;
|
|
243
|
+
maxTokenAge: string;
|
|
244
|
+
});
|
|
245
|
+
createToken(id: string, additionalData: object): Promise<string>;
|
|
246
|
+
verifyToken(token: string): Promise<jose.JWTPayload>;
|
|
247
|
+
AuthMiddleware(): (req: any, res: any, next: any) => Promise<void>;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
declare const ResponseUtility: {
|
|
251
|
+
handleException: (functionName: string, error: any, res: any) => void;
|
|
252
|
+
generateResponse: (status: number, data?: any, error?: string) => {
|
|
253
|
+
status: number;
|
|
254
|
+
data: any;
|
|
255
|
+
error: string | undefined;
|
|
256
|
+
};
|
|
257
|
+
generateError: (status: number, error: string, knownError?: Boolean, logError?: boolean) => {
|
|
258
|
+
status: number;
|
|
259
|
+
error: string;
|
|
260
|
+
knownError: Boolean;
|
|
261
|
+
logError: boolean;
|
|
262
|
+
};
|
|
263
|
+
};
|
|
264
|
+
|
|
265
|
+
type SuccessType = {
|
|
266
|
+
status: number;
|
|
267
|
+
statusText: string;
|
|
268
|
+
data: any;
|
|
269
|
+
};
|
|
270
|
+
declare const Fetch: (baseURL: string, endpoint: string, method?: "GET" | "POST" | "PATCH" | "DELETE", headers?: Record<string, string>, payload?: any) => Promise<SuccessType>;
|
|
271
|
+
|
|
272
|
+
declare const Logger: {
|
|
273
|
+
logException: (functionName: string, error: any) => void;
|
|
274
|
+
logError: (functionName: string, errorMessage: string) => void;
|
|
275
|
+
logMessage: (functionName: string, message: any) => void;
|
|
276
|
+
logInvalidPayload: (functionName: string, errorMessage: string) => void;
|
|
277
|
+
};
|
|
278
|
+
|
|
279
|
+
export { AuthUtility as Auth, DynamoDBUtility as DynamoDB, Fetch, Logger, ResponseUtility, Schema };
|