ag-common 0.0.672 → 0.0.673

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.
@@ -1,5 +1,5 @@
1
1
  import type { APIGatewayProxyResult, DYNAMOKEYS } from '../types';
2
- export declare const returnCode: <T>(statusCode: number, body?: T | undefined, extraHeaders?: {
2
+ export declare const returnCode: <T>(statusCode: number, body?: T, extraHeaders?: {
3
3
  [a: string]: string;
4
4
  } | undefined, fullSiteUrl?: string) => APIGatewayProxyResult;
5
5
  /**
@@ -95,7 +95,7 @@ const batchWrite = (tableName, itemsIn) => __awaiter(void 0, void 0, void 0, fun
95
95
  }
96
96
  });
97
97
  exports.batchWrite = batchWrite;
98
- const batchDelete = ({ tableName, keys, pkName, }) => __awaiter(void 0, void 0, void 0, function* () {
98
+ const batchDelete = (_a) => __awaiter(void 0, [_a], void 0, function* ({ tableName, keys, pkName, }) {
99
99
  //batch up to 20, so we can retry.
100
100
  let chunked = (0, array_1.chunk)(keys, 20);
101
101
  try {
@@ -173,8 +173,8 @@ const scan = (tableName, opt) => __awaiter(void 0, void 0, void 0, function* ()
173
173
  }
174
174
  });
175
175
  exports.scan = scan;
176
- const getItemsDynamo = ({ tableName, items, }) => __awaiter(void 0, void 0, void 0, function* () {
177
- var _a, _b;
176
+ const getItemsDynamo = (_b) => __awaiter(void 0, [_b], void 0, function* ({ tableName, items, }) {
177
+ var _c, _d;
178
178
  const params = new lib_dynamodb_1.BatchGetCommand({
179
179
  RequestItems: {
180
180
  [tableName]: {
@@ -186,7 +186,7 @@ const getItemsDynamo = ({ tableName, items, }) => __awaiter(void 0, void 0, void
186
186
  });
187
187
  try {
188
188
  let res = yield exports.dynamoDb.send(params);
189
- let data = (_b = (_a = res.Responses) === null || _a === void 0 ? void 0 : _a[tableName].map((r) => r)) !== null && _b !== void 0 ? _b : [];
189
+ let data = (_d = (_c = res.Responses) === null || _c === void 0 ? void 0 : _c[tableName].map((r) => r)) !== null && _d !== void 0 ? _d : [];
190
190
  return { data };
191
191
  }
192
192
  catch (e) {
@@ -196,7 +196,7 @@ const getItemsDynamo = ({ tableName, items, }) => __awaiter(void 0, void 0, void
196
196
  }
197
197
  });
198
198
  exports.getItemsDynamo = getItemsDynamo;
199
- const getItemDynamo = ({ tableName, pkName, pkValue, }) => __awaiter(void 0, void 0, void 0, function* () {
199
+ const getItemDynamo = (_e) => __awaiter(void 0, [_e], void 0, function* ({ tableName, pkName, pkValue, }) {
200
200
  let r = yield (0, exports.getItemsDynamo)({ tableName, items: [{ pkName, pkValue }] });
201
201
  if ('error' in r) {
202
202
  return { error: r.error };
@@ -204,7 +204,7 @@ const getItemDynamo = ({ tableName, pkName, pkValue, }) => __awaiter(void 0, voi
204
204
  return { data: r.data[0] };
205
205
  });
206
206
  exports.getItemDynamo = getItemDynamo;
207
- const queryDynamo = ({ tableName, pkName, pkValue, pkOperator = '=', skName, skValue, skOperator = '=', indexName, limit = 1000, startKey, filterName, filterValue, filterOperator = '=', sortAscending = true, }) => __awaiter(void 0, void 0, void 0, function* () {
207
+ const queryDynamo = (_f) => __awaiter(void 0, [_f], void 0, function* ({ tableName, pkName, pkValue, pkOperator = '=', skName, skValue, skOperator = '=', indexName, limit = 1000, startKey, filterName, filterValue, filterOperator = '=', sortAscending = true, }) {
208
208
  let kce = `#${pkName.toLowerCase()} ${pkOperator} :${pkName.toLowerCase()}`;
209
209
  const ean = { [`#${pkName.toLowerCase()}`]: pkName };
210
210
  const eav = {
@@ -282,7 +282,7 @@ exports.getDynamoTtlDays = getDynamoTtlDays;
282
282
  const getDynamoTtlMinutes = (mins) => Math.ceil(new Date().getTime() / 1000) + mins * 60;
283
283
  exports.getDynamoTtlMinutes = getDynamoTtlMinutes;
284
284
  const wipeTable = (tableName) => __awaiter(void 0, void 0, void 0, function* () {
285
- var _c;
285
+ var _g;
286
286
  try {
287
287
  let infoV = yield exports.dynamoDb.send(new client_dynamodb_1.DescribeTableCommand({ TableName: tableName }));
288
288
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -296,7 +296,7 @@ const wipeTable = (tableName) => __awaiter(void 0, void 0, void 0, function* ()
296
296
  throw allraw.error;
297
297
  }
298
298
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
299
- let all = ((_c = allraw === null || allraw === void 0 ? void 0 : allraw.data) === null || _c === void 0 ? void 0 : _c.map((d) => d)) || [];
299
+ let all = ((_g = allraw === null || allraw === void 0 ? void 0 : allraw.data) === null || _g === void 0 ? void 0 : _g.map((d) => d)) || [];
300
300
  (0, log_1.warn)(`will delete ${all === null || all === void 0 ? void 0 : all.length} items from ${tableName}`);
301
301
  yield (0, exports.batchDelete)({
302
302
  tableName,
@@ -33,7 +33,7 @@ const setS3 = (region) => {
33
33
  };
34
34
  exports.setS3 = setS3;
35
35
  exports.s3 = (0, exports.setS3)('ap-southeast-2');
36
- const getS3Object = ({ fileurl: { Bucket, Key }, }) => __awaiter(void 0, void 0, void 0, function* () {
36
+ const getS3Object = (_a) => __awaiter(void 0, [_a], void 0, function* ({ fileurl: { Bucket, Key }, }) {
37
37
  try {
38
38
  const r = yield exports.s3.send(new client_s3_1.GetObjectCommand({ Bucket, Key }));
39
39
  if (!r.Body) {
@@ -52,8 +52,8 @@ const getS3Object = ({ fileurl: { Bucket, Key }, }) => __awaiter(void 0, void 0,
52
52
  });
53
53
  exports.getS3Object = getS3Object;
54
54
  /** function generator to get s3 files */
55
- function getS3Objects({ bucket, keys, }) {
56
- return __asyncGenerator(this, arguments, function* getS3Objects_1() {
55
+ function getS3Objects(_a) {
56
+ return __asyncGenerator(this, arguments, function* getS3Objects_1({ bucket, keys, }) {
57
57
  let toProcess = keys.map((Key) => ({
58
58
  Bucket: bucket,
59
59
  Key,
@@ -73,7 +73,7 @@ function getS3Objects({ bucket, keys, }) {
73
73
  });
74
74
  }
75
75
  exports.getS3Objects = getS3Objects;
76
- const putS3Object = ({ Body, Bucket, Key, ContentType, }) => __awaiter(void 0, void 0, void 0, function* () {
76
+ const putS3Object = (_b) => __awaiter(void 0, [_b], void 0, function* ({ Body, Bucket, Key, ContentType, }) {
77
77
  try {
78
78
  yield exports.s3.send(new client_s3_1.PutObjectCommand({ Body, Bucket, Key, ContentType }));
79
79
  return {};
@@ -83,7 +83,7 @@ const putS3Object = ({ Body, Bucket, Key, ContentType, }) => __awaiter(void 0, v
83
83
  }
84
84
  });
85
85
  exports.putS3Object = putS3Object;
86
- const deleteFile = ({ Bucket, Key, }) => __awaiter(void 0, void 0, void 0, function* () {
86
+ const deleteFile = (_c) => __awaiter(void 0, [_c], void 0, function* ({ Bucket, Key, }) {
87
87
  try {
88
88
  yield exports.s3.send(new client_s3_1.DeleteObjectCommand({ Bucket, Key }));
89
89
  return {};
@@ -93,8 +93,8 @@ const deleteFile = ({ Bucket, Key, }) => __awaiter(void 0, void 0, void 0, funct
93
93
  }
94
94
  });
95
95
  exports.deleteFile = deleteFile;
96
- const deleteFiles = ({ Bucket, Keys, }) => __awaiter(void 0, void 0, void 0, function* () {
97
- var _a;
96
+ const deleteFiles = (_d) => __awaiter(void 0, [_d], void 0, function* ({ Bucket, Keys, }) {
97
+ var _e;
98
98
  try {
99
99
  let toDelete = Keys.map((Key) => ({ Key }));
100
100
  let deleted = 0;
@@ -105,7 +105,7 @@ const deleteFiles = ({ Bucket, Keys, }) => __awaiter(void 0, void 0, void 0, fun
105
105
  Bucket,
106
106
  Delete: { Objects: part },
107
107
  }));
108
- if (!((_a = res.Deleted) === null || _a === void 0 ? void 0 : _a.length)) {
108
+ if (!((_e = res.Deleted) === null || _e === void 0 ? void 0 : _e.length)) {
109
109
  throw new Error('no deleted files');
110
110
  }
111
111
  deleted += res.Deleted.length;
@@ -118,7 +118,7 @@ const deleteFiles = ({ Bucket, Keys, }) => __awaiter(void 0, void 0, void 0, fun
118
118
  }
119
119
  });
120
120
  exports.deleteFiles = deleteFiles;
121
- const copyFile = ({ Bucket, fromKey, toKey, deleteSource = false, }) => __awaiter(void 0, void 0, void 0, function* () {
121
+ const copyFile = (_f) => __awaiter(void 0, [_f], void 0, function* ({ Bucket, fromKey, toKey, deleteSource = false, }) {
122
122
  try {
123
123
  (0, log_1.debug)(`copying s3 file from ${Bucket}- ${fromKey} to ${toKey}`);
124
124
  yield exports.s3.send(new client_s3_1.CopyObjectCommand({
@@ -142,8 +142,8 @@ const copyFile = ({ Bucket, fromKey, toKey, deleteSource = false, }) => __awaite
142
142
  });
143
143
  exports.copyFile = copyFile;
144
144
  function listFiles(bucketName, opt) {
145
- var _a, _b;
146
145
  return __awaiter(this, void 0, void 0, function* () {
146
+ var _a, _b;
147
147
  try {
148
148
  const ret = [];
149
149
  let response;
@@ -179,8 +179,8 @@ exports.listFiles = listFiles;
179
179
  formData.append('file', file);
180
180
  fetch.POST(url,formData)
181
181
  */
182
- function getPresignedPostURL({ bucket, key, maxMb = 5, }) {
183
- return __awaiter(this, void 0, void 0, function* () {
182
+ function getPresignedPostURL(_a) {
183
+ return __awaiter(this, arguments, void 0, function* ({ bucket, key, maxMb = 5, }) {
184
184
  try {
185
185
  const ps = yield (0, s3_presigned_post_1.createPresignedPost)(exports.s3, {
186
186
  Bucket: bucket,
@@ -17,7 +17,7 @@ const setSes = (region) => {
17
17
  };
18
18
  exports.setSes = setSes;
19
19
  exports.ses = (0, exports.setSes)('ap-southeast-2');
20
- const sendEmail = ({ to, message, subject, sourceArn, from, }) => __awaiter(void 0, void 0, void 0, function* () {
20
+ const sendEmail = (_a) => __awaiter(void 0, [_a], void 0, function* ({ to, message, subject, sourceArn, from, }) {
21
21
  try {
22
22
  yield exports.ses.send(new client_ses_1.SendEmailCommand({
23
23
  Destination: {
@@ -22,8 +22,8 @@ exports.sts = (0, exports.setSts)('ap-southeast-2');
22
22
  * assume sts role
23
23
  * @returns {string} assumed accountId
24
24
  */
25
- function assumeRole({ assumeRoleArn, region, }) {
26
- return __awaiter(this, void 0, void 0, function* () {
25
+ function assumeRole(_a) {
26
+ return __awaiter(this, arguments, void 0, function* ({ assumeRoleArn, region, }) {
27
27
  try {
28
28
  (0, log_1.info)(`assuming:${assumeRoleArn} in region:${region}`);
29
29
  const data = yield exports.sts.send(new client_sts_1.AssumeRoleCommand({
@@ -43,9 +43,9 @@ const getOperation = ({ path, method, resource, schema, }) => {
43
43
  const pathParams = (re === null || re === void 0 ? void 0 : re.groups) && JSON.parse(JSON.stringify(re === null || re === void 0 ? void 0 : re.groups));
44
44
  return { operation, pathParams };
45
45
  };
46
- function validateOpenApi({ event, next, authorized, schema, COGNITO_USER_POOL_ID, jwksRegion = 'ap-southeast-2', getAndValidateTokenOverride, }) {
47
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
48
- return __awaiter(this, void 0, void 0, function* () {
46
+ function validateOpenApi(_a) {
47
+ return __awaiter(this, arguments, void 0, function* ({ event, next, authorized, schema, COGNITO_USER_POOL_ID, jwksRegion = 'ap-southeast-2', getAndValidateTokenOverride, }) {
48
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k;
49
49
  if (!schema) {
50
50
  throw new Error('schema undefined!');
51
51
  }
@@ -62,8 +62,8 @@ function validateOpenApi({ event, next, authorized, schema, COGNITO_USER_POOL_ID
62
62
  headers: (0, object_1.objectKeysToLowerCase)(event === null || event === void 0 ? void 0 : event.headers),
63
63
  };
64
64
  const method = event.requestContext.httpMethod.toLowerCase();
65
- const pathParameters = (_a = event.pathParameters) !== null && _a !== void 0 ? _a : {};
66
- const queryStringParameters = (_b = event.queryStringParameters) !== null && _b !== void 0 ? _b : {};
65
+ const pathParameters = (_b = event.pathParameters) !== null && _b !== void 0 ? _b : {};
66
+ const queryStringParameters = (_c = event.queryStringParameters) !== null && _c !== void 0 ? _c : {};
67
67
  //
68
68
  const opm = getOperation({
69
69
  path: event.path,
@@ -86,7 +86,7 @@ function validateOpenApi({ event, next, authorized, schema, COGNITO_USER_POOL_ID
86
86
  else {
87
87
  try {
88
88
  request.params = opm.pathParams;
89
- (0, log_1.debug)('req=', JSON.stringify(Object.assign(Object.assign({}, request), { body: ((_d = (_c = request.body) === null || _c === void 0 ? void 0 : _c.length) !== null && _d !== void 0 ? _d : 0) > 2000
89
+ (0, log_1.debug)('req=', JSON.stringify(Object.assign(Object.assign({}, request), { body: ((_e = (_d = request.body) === null || _d === void 0 ? void 0 : _d.length) !== null && _e !== void 0 ? _e : 0) > 2000
90
90
  ? '(truncating long body)'
91
91
  : request.body }), null, 2));
92
92
  const resp = new openapi_request_validator_1.default(Object.assign(Object.assign({}, opm.operation), { schemas: schema.components.schemas })).validateRequest(request);
@@ -94,7 +94,7 @@ function validateOpenApi({ event, next, authorized, schema, COGNITO_USER_POOL_ID
94
94
  (0, log_1.warn)('bad request');
95
95
  (0, log_1.debug)('opm=', JSON.stringify(opm, null, 2));
96
96
  (0, log_1.debug)('resp=', JSON.stringify(resp, null, 2));
97
- return (0, api_1.returnCode)(400, `error:${(_f = (_e = resp === null || resp === void 0 ? void 0 : resp.errors) === null || _e === void 0 ? void 0 : _e[0]) === null || _f === void 0 ? void 0 : _f.message}`);
97
+ return (0, api_1.returnCode)(400, `error:${(_g = (_f = resp === null || resp === void 0 ? void 0 : resp.errors) === null || _f === void 0 ? void 0 : _f[0]) === null || _g === void 0 ? void 0 : _g.message}`);
98
98
  }
99
99
  (0, log_1.debug)(`validated request:`, event.path);
100
100
  }
@@ -104,7 +104,7 @@ function validateOpenApi({ event, next, authorized, schema, COGNITO_USER_POOL_ID
104
104
  }
105
105
  let userProfile;
106
106
  let error;
107
- const authHeader = ((_g = event.headers) === null || _g === void 0 ? void 0 : _g.Authorization) || ((_h = event.headers) === null || _h === void 0 ? void 0 : _h.authorization);
107
+ const authHeader = ((_h = event.headers) === null || _h === void 0 ? void 0 : _h.Authorization) || ((_j = event.headers) === null || _j === void 0 ? void 0 : _j.authorization);
108
108
  if (authorized === true || (authorized === 'optional' && authHeader)) {
109
109
  const vf = getAndValidateTokenOverride !== null && getAndValidateTokenOverride !== void 0 ? getAndValidateTokenOverride : validations_1.getAndValidateToken;
110
110
  ({ error, userProfile } = yield vf({
@@ -122,7 +122,7 @@ function validateOpenApi({ event, next, authorized, schema, COGNITO_USER_POOL_ID
122
122
  event,
123
123
  body: (0, object_1.tryJsonParse)(event.body, event.body),
124
124
  userProfile,
125
- lang: (0, i18n_1.getValidatedLang)((_j = event.headers['x-lang']) !== null && _j !== void 0 ? _j : ''),
125
+ lang: (0, i18n_1.getValidatedLang)((_k = event.headers['x-lang']) !== null && _k !== void 0 ? _k : ''),
126
126
  });
127
127
  return res;
128
128
  });
@@ -20,7 +20,7 @@ const jwks_rsa_1 = __importDefault(require("jwks-rsa"));
20
20
  const log_1 = require("../../common/helpers/log");
21
21
  const api_1 = require("./api");
22
22
  let jwksClient;
23
- const jwtVerify = ({ token, jwksUri, issuer, }) => __awaiter(void 0, void 0, void 0, function* () {
23
+ const jwtVerify = (_a) => __awaiter(void 0, [_a], void 0, function* ({ token, jwksUri, issuer, }) {
24
24
  return new Promise((resolve, reject) => {
25
25
  (0, jsonwebtoken_1.verify)(token, (header, callback) => {
26
26
  if (!jwksClient) {
@@ -63,8 +63,8 @@ const jwtVerify = ({ token, jwksUri, issuer, }) => __awaiter(void 0, void 0, voi
63
63
  });
64
64
  });
65
65
  /** extracts user details from oauth token */
66
- const getAndValidateToken = ({ tokenRaw, jwksRegion = 'ap-southeast-2', COGNITO_USER_POOL_ID, }) => __awaiter(void 0, void 0, void 0, function* () {
67
- var _a, _b;
66
+ const getAndValidateToken = (_b) => __awaiter(void 0, [_b], void 0, function* ({ tokenRaw, jwksRegion = 'ap-southeast-2', COGNITO_USER_POOL_ID, }) {
67
+ var _c, _d;
68
68
  const jwksUri = `https://cognito-idp.${jwksRegion}.amazonaws.com/${COGNITO_USER_POOL_ID}/.well-known/jwks.json`;
69
69
  const issuer = `https://cognito-idp.${jwksRegion}.amazonaws.com/${COGNITO_USER_POOL_ID}`;
70
70
  let token = '';
@@ -103,7 +103,7 @@ const getAndValidateToken = ({ tokenRaw, jwksRegion = 'ap-southeast-2', COGNITO_
103
103
  throw new Error(mess);
104
104
  }
105
105
  let { picture } = decoded;
106
- if (((_b = (_a = decoded === null || decoded === void 0 ? void 0 : decoded.identities) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.providerName) === 'Facebook') {
106
+ if (((_d = (_c = decoded === null || decoded === void 0 ? void 0 : decoded.identities) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.providerName) === 'Facebook') {
107
107
  picture = JSON.parse(decoded.picture).data.url;
108
108
  }
109
109
  const userId = decoded.email.toLowerCase();
@@ -7,7 +7,7 @@ export declare const take: <T>(array: T[], num: number) => {
7
7
  export declare const chunk: <T>(array: T[], max: number) => T[][];
8
8
  export declare const partition: <T>(array: T[], func: (v: T) => boolean) => T[][] | null;
9
9
  /** removes null, undefined, false, empty string */
10
- export declare const notEmpty: <TValue>(value: false | "" | TValue | null | undefined) => value is TValue;
10
+ export declare const notEmpty: <TValue>(value: TValue | null | undefined | false | '') => value is TValue;
11
11
  /**
12
12
  * return a distinct array of items determined by a key function
13
13
  * @param data
@@ -17,8 +17,8 @@ const array_1 = require("./array");
17
17
  * @param callback
18
18
  */
19
19
  function asyncForEach(array, callback, opt) {
20
- var _a;
21
20
  return __awaiter(this, void 0, void 0, function* () {
21
+ var _a;
22
22
  const maxConcurrency = (_a = opt === null || opt === void 0 ? void 0 : opt.maxConcurrency) !== null && _a !== void 0 ? _a : 1;
23
23
  let rem = array;
24
24
  let start = 0;
@@ -39,8 +39,8 @@ exports.asyncForEach = asyncForEach;
39
39
  * @returns
40
40
  */
41
41
  function asyncMap(array, callback, opt) {
42
- var _a;
43
42
  return __awaiter(this, void 0, void 0, function* () {
43
+ var _a;
44
44
  const ret = [];
45
45
  const maxConcurrency = (_a = opt === null || opt === void 0 ? void 0 : opt.maxConcurrency) !== null && _a !== void 0 ? _a : 1;
46
46
  let rem = array;
@@ -1,4 +1,4 @@
1
- export declare const tryJsonParse: <T>(str: string | undefined | null, defaultValue: T | null | undefined) => T | null | undefined;
1
+ export declare const tryJsonParse: <T>(str: string | undefined | null, defaultValue: T | undefined | null) => T | null | undefined;
2
2
  export declare function isJson(str: unknown): boolean;
3
3
  export declare const objectKeysToLowerCase: <T>(origObj: {
4
4
  [a: string]: T;
@@ -22,7 +22,7 @@ const Modal_1 = require("./Modal");
22
22
  * @param param0
23
23
  * @returns
24
24
  */
25
- const ConfirmDialog = ({ bottomText, topText, style, }) => __awaiter(void 0, void 0, void 0, function* () {
25
+ const ConfirmDialog = (_a) => __awaiter(void 0, [_a], void 0, function* ({ bottomText, topText, style, }) {
26
26
  return new Promise((res) => {
27
27
  const idName = 'ag-confirm-dialog';
28
28
  if (document.body.querySelectorAll('#' + idName).length !== 0) {
@@ -4,4 +4,4 @@ export declare const DropdownListDialog: <T>(p: {
4
4
  x: number;
5
5
  y: number;
6
6
  };
7
- } & Omit<IDropdownList<T>, "onChange">) => Promise<[v: T, index: number] | undefined>;
7
+ } & Omit<IDropdownList<T>, 'onChange'>) => Promise<undefined | [v: T, index: number]>;
@@ -14,4 +14,4 @@ export declare const axiosHelper: <TOut>({ verb, url, body, headers, timeout, re
14
14
  timeout?: number | undefined;
15
15
  retryMax?: number | undefined;
16
16
  onStaleAuth?: (() => void) | undefined;
17
- }) => Promise<AxiosResponse<TOut, any>>;
17
+ }) => Promise<AxiosResponse<TOut>>;
@@ -23,8 +23,8 @@ const sleep_1 = require("../../common/helpers/sleep");
23
23
  * @param body accepts object or json, and passes as-is
24
24
  * @returns
25
25
  */
26
- const axiosHelper = ({ verb, url, body, headers, timeout = 30000, retryMax = 0, onStaleAuth, }) => __awaiter(void 0, void 0, void 0, function* () {
27
- var _a;
26
+ const axiosHelper = (_a) => __awaiter(void 0, [_a], void 0, function* ({ verb, url, body, headers, timeout = 30000, retryMax = 0, onStaleAuth, }) {
27
+ var _b;
28
28
  let retry = 0;
29
29
  let ret;
30
30
  do {
@@ -73,7 +73,7 @@ const axiosHelper = ({ verb, url, body, headers, timeout = 30000, retryMax = 0,
73
73
  }
74
74
  catch (e) {
75
75
  const em = e;
76
- const c = Number((_a = em.code) !== null && _a !== void 0 ? _a : '500');
76
+ const c = Number((_b = em.code) !== null && _b !== void 0 ? _b : '500');
77
77
  // jwt expired or bad response
78
78
  // 403 returned for old token - will be refreshed
79
79
  if (c === 401 || c === 403) {
@@ -44,15 +44,15 @@ exports.getIdTokenAuthHeaderRaw = getIdTokenAuthHeaderRaw;
44
44
  /**
45
45
  * get id_token, and then refresh
46
46
  */
47
- function getIdTokenAuthHeader({ overrideAuth, refreshToken, }) {
48
- var _a, _b;
49
- return __awaiter(this, void 0, void 0, function* () {
47
+ function getIdTokenAuthHeader(_a) {
48
+ return __awaiter(this, arguments, void 0, function* ({ overrideAuth, refreshToken, }) {
49
+ var _b, _c;
50
50
  let idToken = getIdTokenAuthHeaderRaw({ overrideAuth });
51
51
  //if we have a cookie token, can try to refresh
52
52
  if (idToken) {
53
53
  const updated = yield refreshToken();
54
- if ((_a = updated === null || updated === void 0 ? void 0 : updated.jwt) === null || _a === void 0 ? void 0 : _a.id_token) {
55
- idToken = (_b = updated === null || updated === void 0 ? void 0 : updated.jwt) === null || _b === void 0 ? void 0 : _b.id_token;
54
+ if ((_b = updated === null || updated === void 0 ? void 0 : updated.jwt) === null || _b === void 0 ? void 0 : _b.id_token) {
55
+ idToken = (_c = updated === null || updated === void 0 ? void 0 : updated.jwt) === null || _c === void 0 ? void 0 : _c.id_token;
56
56
  }
57
57
  }
58
58
  return idToken;
@@ -6,4 +6,4 @@ import type { ApiResponse } from './types';
6
6
  * @param p
7
7
  * @returns
8
8
  */
9
- export declare const apiResponseToAxiosResponse: <T>(p: () => Promise<ApiResponse<T>>) => Promise<AxiosResponse<T, any>>;
9
+ export declare const apiResponseToAxiosResponse: <T>(p: () => Promise<ApiResponse<T>>) => Promise<AxiosResponse<T>>;
@@ -17,7 +17,7 @@ export declare const useTooltip: <T>() => {
17
17
  element: MouseEvent;
18
18
  parent: Element | null;
19
19
  data: T;
20
- } | undefined) => void;
20
+ }) => void;
21
21
  pos: IPos<T> | undefined;
22
22
  };
23
23
  export {};
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.0.672",
2
+ "version": "0.0.673",
3
3
  "name": "ag-common",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
@@ -39,12 +39,12 @@
39
39
  "typescript": "^5"
40
40
  },
41
41
  "devDependencies": {
42
- "@babel/core": "7.24.0",
43
- "@babel/preset-typescript": "7.23.3",
42
+ "@babel/core": "7.24.3",
43
+ "@babel/preset-typescript": "7.24.1",
44
44
  "@babel/types": "7.24.0",
45
45
  "@emotion/react": "11.11.4",
46
46
  "@emotion/styled": "11.11.0",
47
- "@smithy/types": "2.10.1",
47
+ "@smithy/types": "2.12.0",
48
48
  "@storybook/addon-actions": "7.6.17",
49
49
  "@storybook/addon-docs": "7.6.17",
50
50
  "@storybook/addon-essentials": "7.6.17",
@@ -55,9 +55,9 @@
55
55
  "@storybook/react-webpack5": "7.6.17",
56
56
  "@storybook/theming": "7.6.17",
57
57
  "@types/jsonwebtoken": "9.0.6",
58
- "@types/node": "20.11.21",
59
- "@types/react": "18.2.60",
60
- "@types/react-dom": "18.2.19",
58
+ "@types/node": "20.11.30",
59
+ "@types/react": "18.2.67",
60
+ "@types/react-dom": "18.2.22",
61
61
  "cross-env": "7.0.3",
62
62
  "eslint-config-e7npm": "0.0.87",
63
63
  "globstar": "^1.0.0",