@fixefy/fixefy-ui-utils 0.0.19 → 0.0.20

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/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "fs": false
5
5
  },
6
6
  "dependencies": {
7
- "@fixefy/fixefy-ui-components": "0.0.50",
7
+ "@fixefy/fixefy-ui-components": "0.0.52",
8
8
  "@mui/material": "^5.14.11",
9
9
  "@mui/styled-engine": "^5.14.11",
10
10
  "@mui/styles": "^5.14.11",
@@ -63,5 +63,5 @@
63
63
  "require": "./dist/index.js"
64
64
  }
65
65
  },
66
- "version": "0.0.19"
66
+ "version": "0.0.20"
67
67
  }
@@ -1 +0,0 @@
1
- export {};
@@ -1,465 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- const _react = /*#__PURE__*/ _interop_require_default(require("react" // //@ts-nocheck
6
- // import { ListObjectOutput } from './data_models'
7
- // import { SignedUrl } from './data_models'
8
- // import AWS from 'aws-sdk'
9
- // import PaginationHelper from './pagination_helper'
10
- // const s3Credentials: AWS.Credentials = new AWS.Credentials({
11
- // accessKeyId: process.env.AWS_S3_ACCESS_KEY || '',
12
- // secretAccessKey: process.env.AWS_S3_SECRET_KEY || '',
13
- // }),
14
- // awsS3: AWS.S3 = new AWS.S3({ credentials: s3Credentials })
15
- // const AwsS3Helper = {
16
- // copyMyReport: async (args: any): Promise<any> => {
17
- // const {
18
- // data: { from, to },
19
- // }: { data: { from: string; to: string } } = args
20
- // // set the params
21
- // const prefixFrom = `fixefy-reports${AwsS3Helper.getBucketEnvSuffix(
22
- // parent,
23
- // args,
24
- // ctx,
25
- // info,
26
- // rest,
27
- // )}/${ctx.workspace?.readable_id}/${ctx.user?.username}/${from}`,
28
- // prefixTo = `${ctx.workspace?.readable_id}/${ctx.user?.username}/${to}`,
29
- // params: any = {
30
- // Bucket: `fixefy-reports${AwsS3Helper.getBucketEnvSuffix(
31
- // parent,
32
- // args,
33
- // ctx,
34
- // info,
35
- // rest,
36
- // )}`,
37
- // CopySource: prefixFrom,
38
- // Key: prefixTo,
39
- // }
40
- // const rv: any = await awsS3.copyObject(params).promise()
41
- // // notify
42
- // NotifyHelper.notify(parent, { data: { payload: rv } }, ctx, info, rest)
43
- // return rv
44
- // },
45
- // createBucket: async (args: any): Promise<AWS.S3.Types.CreateBucketOutput> => {
46
- // const {
47
- // data: { name },
48
- // }: { data: { name: string } } = args,
49
- // params: AWS.S3.Types.CreateBucketRequest = { Bucket: name }
50
- // // create bucket
51
- // const rv = await awsS3.createBucket(params).promise()
52
- // // notify
53
- // NotifyHelper.notify(parent, { data: { payload: rv } }, ctx, info, rest)
54
- // return rv
55
- // },
56
- // deleteBucket: async (args: any): Promise<any> => {
57
- // const {
58
- // data: { name },
59
- // }: { data: { name: string } } = args,
60
- // params: AWS.S3.Types.DeleteBucketRequest = { Bucket: name }
61
- // const rv: any = await awsS3.deleteBucket(params).promise()
62
- // // notify
63
- // NotifyHelper.notify(parent, { data: { payload: rv } }, ctx, info, rest)
64
- // return rv
65
- // },
66
- // deleteMyReport: async (args: any): Promise<any> => {
67
- // const {
68
- // data: { is_notify: isNotify = true, name },
69
- // }: { data: { is_notify: boolean; name: string } } = args
70
- // // set the prefix
71
- // const prefix = `${ctx.workspace?.readable_id}/${ctx.user?.username}/${name}`
72
- // // set the params
73
- // const params: AWS.S3.Types.DeleteObjectRequest = {
74
- // Bucket: `fixefy-reports${AwsS3Helper.getBucketEnvSuffix(
75
- // parent,
76
- // args,
77
- // ctx,
78
- // info,
79
- // rest,
80
- // )}`,
81
- // Key: prefix,
82
- // }
83
- // // delete object
84
- // const rv: any = await awsS3.deleteObject(params).promise()
85
- // // input check - if is_notify
86
- // if (isNotify) {
87
- // // notify
88
- // NotifyHelper.notify(parent, { data: { payload: rv } }, ctx, info, rest)
89
- // }
90
- // return rv
91
- // },
92
- // deleteMyReports: async (args: any): Promise<any> => {
93
- // const {
94
- // data: { names },
95
- // }: { data: { names: Array<string> } } = args
96
- // // set the prefix
97
- // const prefix = `${ctx.workspace?.readable_id}/${ctx.user?.username}`
98
- // const promises: Array<Promise<any>> = []
99
- // let currentPromise: Promise<any>
100
- // for (const name of names) {
101
- // currentPromise = AwsS3Helper.deleteMyReport(
102
- // parent,
103
- // { data: { is_notify: false, name } },
104
- // ctx,
105
- // info,
106
- // rest,
107
- // )
108
- // promises.push(currentPromise)
109
- // }
110
- // const resultArray: Array<any> = await Promise.all(promises),
111
- // rv: any = {}
112
- // // set the params
113
- // const params: AWS.S3.Types.DeleteObjectRequest = {
114
- // Bucket: `fixefy-reports${AwsS3Helper.getBucketEnvSuffix(
115
- // parent,
116
- // args,
117
- // ctx,
118
- // info,
119
- // rest,
120
- // )}`,
121
- // Key: prefix,
122
- // }
123
- // for (let i = 0; i < resultArray.length; ++i) {
124
- // rv[names[i]] = resultArray[i]
125
- // }
126
- // // notify
127
- // NotifyHelper.notify(parent, { data: { payload: rv } }, ctx, info, rest)
128
- // return rv
129
- // },
130
- // deleteBucket: async (
131
- // parent: any,
132
- // args: any,
133
- // ctx: Context,
134
- // info: any,
135
- // rest: any,
136
- // ): Promise<DeleteBucketCommandOutput> => {
137
- // const {
138
- // data: { name },
139
- // } = args
140
- // // create the delete command
141
- // const command: DeleteBucketCommand = new DeleteBucketCommand({
142
- // Bucket: name,
143
- // })
144
- // // delete bucket
145
- // const rv: DeleteBucketCommandOutput = await s3.deleteBucket(command)
146
- // return rv
147
- // },
148
- // deleteFile: async (
149
- // parent: any,
150
- // args: any,
151
- // ctx: Context,
152
- // info: any,
153
- // rest: any,
154
- // ): Promise<DeleteObjectCommandOutput> => {
155
- // const {
156
- // data: { bucket_name, name },
157
- // } = args
158
- // // create the delete command
159
- // const command: DeleteObjectCommand = new DeleteObjectCommand({
160
- // Bucket: bucket_name,
161
- // Key: name,
162
- // })
163
- // // delete bucket
164
- // const rv: DeleteObjectCommandOutput = await s3Client.send(command)
165
- // return rv
166
- // },
167
- // downloadObject: async (args: any): Promise<AWS.S3.Types.GetObjectOutput> => {
168
- // const {
169
- // data: { bucket_name, name },
170
- // } = args,
171
- // params: AWS.S3.Types.GetObjectRequest = { Bucket: bucket_name, Key: name }
172
- // const rv: AWS.S3.Types.GetObjectOutput = await s3
173
- // .getObject(params)
174
- // .promise()
175
- // return rv
176
- // },
177
- // getBucketEnvSuffix: (args: any): string => {
178
- // const { env } = args
179
- // let rv: string
180
- // switch (env) {
181
- // case 'local':
182
- // rv = '-dev'
183
- // break
184
- // case 'prod':
185
- // rv = ''
186
- // break
187
- // default:
188
- // rv = `-${env}`
189
- // break
190
- // }
191
- // return rv
192
- // },
193
- // getFuegoUploadUrl: (args: any): SignedUrl => {
194
- // const {
195
- // username,
196
- // workspace,
197
- // where: { expires_in, name },
198
- // } = args
199
- // if (name == null || name.length == 0)
200
- // throw new Error('name is an empty string')
201
- // const currentPrefix = `${workspace}/${username}/${name}`,
202
- // currentParams: unknown = {
203
- // Bucket: `fixefy-fuegos${AwsS3Helper.getBucketEnvSuffix(args)}`,
204
- // Key: currentPrefix,
205
- // Expires: expires_in || 3600,
206
- // },
207
- // url: string = awsS3.getSignedUrl('putObject', currentParams),
208
- // rv: SignedUrl = { name, url }
209
- // return rv
210
- // },
211
- // getReportDownloadUrl: (args: any): string => {
212
- // const {
213
- // where: { expires_in, name },
214
- // }: { where: { expires_in: string; name: string } } = args,
215
- // prefix = `${ctx.workspace?.readable_id}/${ctx.user?.username}/${name}`,
216
- // params: any = {
217
- // Bucket: `fixefy-reports${AwsS3Helper.getBucketEnvSuffix(
218
- // parent,
219
- // args,
220
- // ctx,
221
- // info,
222
- // rest,
223
- // )}`,
224
- // Key: prefix,
225
- // Expires: expires_in || 3600,
226
- // }
227
- // // get the signed url
228
- // const rv: string = awsS3.getSignedUrl('getObject', params)
229
- // return rv
230
- // },
231
- // getMyReports: async (args: any): Promise<Array<ListObjectOutput>> => {
232
- // // set limits
233
- // PaginationHelper.limitPagination(parent, args, ctx, info, rest)
234
- // const prefix = `${ctx.workspace?.readable_id}/${ctx.user?.username}/`,
235
- // params: AWS.S3.ListObjectsV2Request = {
236
- // Bucket: `fixefy-reports${AwsS3Helper.getBucketEnvSuffix(
237
- // parent,
238
- // args,
239
- // ctx,
240
- // info,
241
- // rest,
242
- // )}`,
243
- // Prefix: prefix,
244
- // },
245
- // result: AWS.S3.ListObjectsV2Output = await awsS3
246
- // .listObjectsV2(params)
247
- // .promise(),
248
- // rv: Array<ListObjectOutput> = []
249
- // let headParams: AWS.S3.Types.HeadObjectRequest,
250
- // headResult: AWS.S3.Types.HeadObjectOutput,
251
- // currentObject: ListObjectOutput,
252
- // currentFileName: Maybe<string>,
253
- // currentUrl: Maybe<string>
254
- // for (const content of result?.Contents || []) {
255
- // // input check - if key is invalid - continue loop
256
- // if (ValidateHelper.isStringValid(content?.Key) == false) continue
257
- // currentFileName = content?.Key?.split('/').pop()
258
- // // input check - if file_name is invalid - continue loop
259
- // if (ValidateHelper.isStringValid(currentFileName) == false) continue
260
- // currentUrl = AwsS3Helper.getReportDownloadUrl(
261
- // parent,
262
- // { where: { name: currentFileName } },
263
- // ctx,
264
- // info,
265
- // rest,
266
- // )
267
- // currentObject = {
268
- // name: currentFileName,
269
- // size: content.Size,
270
- // updated_at: content.LastModified?.getTime(),
271
- // url: currentUrl,
272
- // }
273
- // headParams = {
274
- // Bucket: `fixefy-reports${AwsS3Helper.getBucketEnvSuffix(
275
- // parent,
276
- // args,
277
- // ctx,
278
- // info,
279
- // rest,
280
- // )}`,
281
- // Key: content.Key as string,
282
- // }
283
- // headResult = await awsS3.headObject(headParams).promise()
284
- // // input check - if headResult.Metadata is valid
285
- // if (ValidateHelper.isObjectValid(headResult?.Metadata)) {
286
- // currentObject.description = headResult?.Metadata?.description
287
- // currentObject.report = headResult?.Metadata?.report
288
- // currentObject.title = headResult?.Metadata?.title
289
- // currentObject.updated_by = headResult?.Metadata?.updated_by
290
- // }
291
- // rv.push(currentObject)
292
- // }
293
- // return rv
294
- // },
295
- // listObjectsV2: async (args: any): Promise<AWS.S3.ListObjectsV2Output> => {
296
- // // set first/last limits
297
- // PaginationHelper.limitPagination(parent, args, ctx, info, rest)
298
- // const {
299
- // where: { bucket_name },
300
- // first,
301
- // skip,
302
- // } = args
303
- // const params: AWS.S3.ListObjectsV2Request = {
304
- // Bucket: `${bucket_name}${AwsS3Helper.getBucketEnvSuffix(
305
- // parent,
306
- // args,
307
- // ctx,
308
- // info,
309
- // rest,
310
- // )}`,
311
- // MaxKeys: first,
312
- // StartAfter: `${skip}`,
313
- // }
314
- // const rv: AWS.S3.ListObjectsV2Output = await awsS3
315
- // .listObjectsV2(params)
316
- // .promise()
317
- // return rv
318
- // },
319
- // moveMyReport: async (args: any): Promise<never> => {
320
- // throw new ApolloError('not yet implemented')
321
- // },
322
- // renameMyReport: async (args: any): Promise<any> => {
323
- // const {
324
- // data: { from },
325
- // }: { data: { from: string } } = args
326
- // const copyResult: any = await AwsS3Helper.copyMyReport(
327
- // parent,
328
- // args,
329
- // ctx,
330
- // info,
331
- // rest,
332
- // ),
333
- // rv: any = await AwsS3Helper.deleteMyReport(
334
- // parent,
335
- // { data: { name: from } },
336
- // ctx,
337
- // info,
338
- // rest,
339
- // )
340
- // // notify
341
- // NotifyHelper.notify(parent, { data: { payload: rv } }, ctx, info, rest)
342
- // return rv
343
- // },
344
- // toListObject: (args: any): ListObject => {
345
- // const result: AWS.S3.ListObjectsV2Output = args.data.result,
346
- // rv: ListObject = {
347
- // common_prefixes: AwsHelper.toListObjectCommonPrefixArray(
348
- // parent,
349
- // { data: { prefixes: result.CommonPrefixes } },
350
- // ctx,
351
- // info,
352
- // rest,
353
- // ),
354
- // contents: AwsHelper.toListObjectContentArray(
355
- // parent,
356
- // { data: { contents: result.Contents } },
357
- // ctx,
358
- // info,
359
- // rest,
360
- // ),
361
- // is_truncated: result.IsTruncated,
362
- // key_count: result.KeyCount,
363
- // max_keys: result.MaxKeys,
364
- // name: result.Name,
365
- // prefix: result.Prefix,
366
- // start_after: result.StartAfter,
367
- // }
368
- // return rv
369
- // },
370
- // toListObjectCommonPrefixArray: (args: any): Array<ListObjectCommonPrefix> => {
371
- // const prefixes: Array<AWS.S3.Types.CommonPrefix> = args.data.prefixes,
372
- // rv: Array<ListObjectCommonPrefix> = prefixes.map((p) => {
373
- // return { prefix: p.Prefix }
374
- // })
375
- // return rv
376
- // },
377
- // toListObjectContentArray: (args: any): Array<ListObjectContent> => {
378
- // const contents: Array<AWS.S3.Types.Object> = args.data.contents,
379
- // rv: Array<ListObjectContent> = contents.map((c) => {
380
- // return {
381
- // e_tag: c.ETag,
382
- // name: c.Key,
383
- // last_modified:
384
- // c.LastModified != null
385
- // ? new Date(c.LastModified).getTime()
386
- // : undefined,
387
- // size: c.Size,
388
- // storage_class: c.StorageClass,
389
- // }
390
- // })
391
- // return rv
392
- // },
393
- // uploadObject: async (args: any): Promise<AWS.S3.ManagedUpload.SendData> => {
394
- // const {
395
- // data: {
396
- // bucket_name,
397
- // content,
398
- // description = '',
399
- // file_name: fileName,
400
- // name,
401
- // title = '',
402
- // },
403
- // }: {
404
- // data: {
405
- // bucket_name: string
406
- // content: string
407
- // description: string
408
- // file_name: string
409
- // name: string
410
- // title: string
411
- // }
412
- // } = args
413
- // const params: AWS.S3.Types.PutObjectRequest = {
414
- // Bucket: `${bucket_name}${AwsS3Helper.getBucketEnvSuffix(
415
- // parent,
416
- // args,
417
- // ctx,
418
- // info,
419
- // rest,
420
- // )}`,
421
- // Key: fileName,
422
- // Body: content,
423
- // Metadata: {
424
- // description,
425
- // name,
426
- // //report: report?.readable_id,
427
- // title,
428
- // updated_by: ctx.user.username,
429
- // },
430
- // }
431
- // const rv: AWS.S3.ManagedUpload.SendData = await awsS3
432
- // .upload(params)
433
- // .promise()
434
- // // notify
435
- // NotifyHelper.notify(parent, { data: { payload: rv } }, ctx, info, rest)
436
- // return rv
437
- // },
438
- // validateCreateFolder: async (
439
- // parent: any,
440
- // args: any,
441
- // ctx: Context,
442
- // info: any,
443
- // rest: any,
444
- // ): Promise<any> => {
445
- // let {
446
- // data: { bucket_name, name },
447
- // } = args
448
- // if (name == null) throw new ApolloError('name cannot be null')
449
- // name = name.trim()
450
- // if (ValidateHelper.isStringValid(name) == false)
451
- // throw new ApolloError(
452
- // 'name must contain at least one non-space character',
453
- // )
454
- // if (name.includes('/')) throw new ApolloError('name cannot contain slashes')
455
- // // const headRes = await s3.headObject({ Bucket: bucket_name, Key: name }, () => { })).promise()
456
- // // if(headRes. )
457
- // },
458
- // }
459
- // export { AwsS3Helper }
460
- ));
461
- function _interop_require_default(obj) {
462
- return obj && obj.__esModule ? obj : {
463
- default: obj
464
- };
465
- }