my-q-format-response-aws-lambda 1.0.62 → 1.0.63

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/index.js +6 -2
  2. package/index.ts +10 -0
  3. package/package.json +1 -1
package/index.js CHANGED
@@ -71,6 +71,7 @@ class ResponseBodyVO {
71
71
  this.info = null;
72
72
  this.identity = null;
73
73
  this.redirectTo = undefined;
74
+ this.token = null;
74
75
  }
75
76
  }
76
77
  exports.ResponseBodyVO = ResponseBodyVO;
@@ -82,7 +83,7 @@ class ResponseVO {
82
83
  }
83
84
  exports.ResponseVO = ResponseVO;
84
85
  class Result {
85
- constructor({ statusCode = StatusCode.OK, statusResult = StatusResult.ok, message, data = null, count = null, error = null, info = null, identity = null, redirectTo = undefined, bodyWrap = true, }) {
86
+ constructor({ statusCode = StatusCode.OK, statusResult = StatusResult.ok, message, data = null, count = null, error = null, info = null, identity = null, redirectTo = undefined, token = null, bodyWrap = true, }) {
86
87
  this.statusCode = statusCode;
87
88
  this.statusResult = statusResult;
88
89
  this.message = !message ? '' : message;
@@ -92,6 +93,7 @@ class Result {
92
93
  this.info = info;
93
94
  this.identity = identity;
94
95
  this.redirectTo = redirectTo;
96
+ this.token = token;
95
97
  this.bodyWrap = bodyWrap;
96
98
  }
97
99
  /**
@@ -108,6 +110,7 @@ class Result {
108
110
  error: _err,
109
111
  info: this.info,
110
112
  identity: this.identity,
113
+ token: this.token,
111
114
  };
112
115
  if (this.redirectTo)
113
116
  valueBody.redirectTo = this.redirectTo;
@@ -126,7 +129,7 @@ class CreateResponse {
126
129
  * @param message
127
130
  * @param bodyWrap
128
131
  */
129
- static success({ data = null, count = null, message = 'success', bodyWrap = true, info = null, identity = null, }) {
132
+ static success({ data = null, count = null, message = 'success', bodyWrap = true, info = null, identity = null, token = null, }) {
130
133
  const result = new Result({
131
134
  statusCode: StatusCode.OK,
132
135
  statusResult: StatusResult.ok,
@@ -136,6 +139,7 @@ class CreateResponse {
136
139
  bodyWrap,
137
140
  info,
138
141
  identity,
142
+ token,
139
143
  });
140
144
  return result.bodyToString();
141
145
  }
package/index.ts CHANGED
@@ -76,6 +76,7 @@ type TError = any | null
76
76
  type TInfo = any | null
77
77
  type TIdentity = any | null
78
78
  type TRedirectTo = string | undefined
79
+ type TToken = string | null
79
80
 
80
81
  interface TResultIn {
81
82
  statusCode?: StatusCode
@@ -87,6 +88,7 @@ interface TResultIn {
87
88
  info?: TInfo
88
89
  identity?: TIdentity
89
90
  redirectTo?: TRedirectTo
91
+ token?: TToken
90
92
  bodyWrap: boolean
91
93
  }
92
94
 
@@ -100,6 +102,7 @@ interface TFuncParams {
100
102
  data?: TData
101
103
  count?: TCount
102
104
  redirectTo?: TRedirectTo
105
+ token?: TToken
103
106
  bodyWrap?: boolean
104
107
  }
105
108
 
@@ -112,6 +115,7 @@ export class ResponseBodyVO {
112
115
  info: TInfo = null
113
116
  identity: TIdentity = null
114
117
  redirectTo?: TRedirectTo = undefined
118
+ token?: TToken = null
115
119
  }
116
120
 
117
121
  export class ResponseVO {
@@ -131,6 +135,7 @@ class Result {
131
135
  private info: any
132
136
  private identity: any
133
137
  private redirectTo: TRedirectTo
138
+ private token: TToken
134
139
  private bodyWrap: boolean
135
140
 
136
141
  constructor({
@@ -143,6 +148,7 @@ class Result {
143
148
  info = null,
144
149
  identity = null,
145
150
  redirectTo = undefined,
151
+ token = null,
146
152
  bodyWrap = true,
147
153
  }: TResultIn) {
148
154
  this.statusCode = statusCode
@@ -154,6 +160,7 @@ class Result {
154
160
  this.info = info
155
161
  this.identity = identity
156
162
  this.redirectTo = redirectTo
163
+ this.token = token
157
164
  this.bodyWrap = bodyWrap
158
165
  }
159
166
 
@@ -172,6 +179,7 @@ class Result {
172
179
  error: _err,
173
180
  info: this.info,
174
181
  identity: this.identity,
182
+ token: this.token,
175
183
  }
176
184
  if (this.redirectTo) valueBody.redirectTo = this.redirectTo
177
185
  const valueBodyWrap: ResponseVO = {
@@ -198,6 +206,7 @@ export class CreateResponse {
198
206
  bodyWrap = true,
199
207
  info = null,
200
208
  identity = null,
209
+ token = null,
201
210
  }: TFuncParams): ResponseVoAWS {
202
211
  const result = new Result({
203
212
  statusCode: StatusCode.OK,
@@ -208,6 +217,7 @@ export class CreateResponse {
208
217
  bodyWrap,
209
218
  info,
210
219
  identity,
220
+ token,
211
221
  })
212
222
  return result.bodyToString()
213
223
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "my-q-format-response-aws-lambda",
3
- "version": "1.0.62",
3
+ "version": "1.0.63",
4
4
  "homepage": "https://github.com/zhukyuri/my-q-format-response-aws-lambda",
5
5
  "description": "my-q-format-response-aws-lambda",
6
6
  "main": "index.js",