@cumulus/api-client 21.0.0 → 21.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/.nycrc.json +4 -4
- package/executions.d.ts +9 -0
- package/executions.d.ts.map +1 -1
- package/executions.js +28 -1
- package/executions.js.map +1 -1
- package/granules.d.ts +10 -0
- package/granules.d.ts.map +1 -1
- package/granules.js +52 -7
- package/granules.js.map +1 -1
- package/package.json +5 -5
- package/src/executions.ts +35 -1
- package/src/granules.ts +49 -0
- package/tsconfig.tsbuildinfo +1 -1
package/src/granules.ts
CHANGED
|
@@ -68,6 +68,7 @@ export const getGranuleResponse = async (params: {
|
|
|
68
68
|
collectionId,
|
|
69
69
|
query,
|
|
70
70
|
expectedStatusCodes,
|
|
71
|
+
/* istanbul ignore next */
|
|
71
72
|
callback = invokeApi,
|
|
72
73
|
} = params;
|
|
73
74
|
|
|
@@ -105,6 +106,7 @@ export const getGranule = async (params: {
|
|
|
105
106
|
granuleId: GranuleId,
|
|
106
107
|
collectionId?: CollectionId,
|
|
107
108
|
query?: { [key: string]: string },
|
|
109
|
+
/* istanbul ignore next */
|
|
108
110
|
callback?: InvokeApiFunction
|
|
109
111
|
}): Promise<ApiGranuleRecord> => {
|
|
110
112
|
const response = await getGranuleResponse(params);
|
|
@@ -139,6 +141,7 @@ export const waitForGranule = async (params: {
|
|
|
139
141
|
status,
|
|
140
142
|
retries = 10,
|
|
141
143
|
pRetryOptions = {},
|
|
144
|
+
/* istanbul ignore next */
|
|
142
145
|
callback = invokeApi,
|
|
143
146
|
} = params;
|
|
144
147
|
|
|
@@ -205,6 +208,7 @@ export const reingestGranule = async (params: {
|
|
|
205
208
|
collectionId,
|
|
206
209
|
workflowName,
|
|
207
210
|
executionArn,
|
|
211
|
+
/* istanbul ignore next */
|
|
208
212
|
callback = invokeApi,
|
|
209
213
|
} = params;
|
|
210
214
|
|
|
@@ -249,6 +253,7 @@ export const removeFromCMR = async (params: {
|
|
|
249
253
|
collectionId?: CollectionId,
|
|
250
254
|
callback?: InvokeApiFunction
|
|
251
255
|
}): Promise<ApiGatewayLambdaHttpProxyResponse> => {
|
|
256
|
+
/* istanbul ignore next */
|
|
252
257
|
const { prefix, granuleId, collectionId, callback = invokeApi } = params;
|
|
253
258
|
|
|
254
259
|
const path = encodeGranulesURIComponent(granuleId, collectionId);
|
|
@@ -298,6 +303,7 @@ export const applyWorkflow = async (params: {
|
|
|
298
303
|
collectionId,
|
|
299
304
|
workflow,
|
|
300
305
|
meta,
|
|
306
|
+
/* istanbul ignore next */
|
|
301
307
|
callback = invokeApi,
|
|
302
308
|
} = params;
|
|
303
309
|
|
|
@@ -345,6 +351,7 @@ export const deleteGranule = async (params: {
|
|
|
345
351
|
prefix,
|
|
346
352
|
granuleId,
|
|
347
353
|
collectionId,
|
|
354
|
+
/* istanbul ignore next */
|
|
348
355
|
callback = invokeApi,
|
|
349
356
|
} = params;
|
|
350
357
|
|
|
@@ -388,6 +395,7 @@ export const moveGranule = async (params: {
|
|
|
388
395
|
granuleId,
|
|
389
396
|
collectionId,
|
|
390
397
|
destinations,
|
|
398
|
+
/* istanbul ignore next */
|
|
391
399
|
callback = invokeApi,
|
|
392
400
|
} = params;
|
|
393
401
|
|
|
@@ -427,6 +435,7 @@ export const removePublishedGranule = async (params: {
|
|
|
427
435
|
collectionId?: CollectionId,
|
|
428
436
|
callback?: InvokeApiFunction
|
|
429
437
|
}): Promise<ApiGatewayLambdaHttpProxyResponse> => {
|
|
438
|
+
/* istanbul ignore next */
|
|
430
439
|
const { prefix, granuleId, collectionId, callback = invokeApi } = params;
|
|
431
440
|
|
|
432
441
|
// pre-delete: Remove the granule from CMR
|
|
@@ -456,6 +465,7 @@ export const listGranules = async (params: {
|
|
|
456
465
|
},
|
|
457
466
|
callback?: InvokeApiFunction
|
|
458
467
|
}): Promise<ApiGatewayLambdaHttpProxyResponse> => {
|
|
468
|
+
/* istanbul ignore next */
|
|
459
469
|
const { prefix, query, callback = invokeApi } = params;
|
|
460
470
|
|
|
461
471
|
return await callback({
|
|
@@ -487,6 +497,7 @@ export const createGranule = async (params: {
|
|
|
487
497
|
body: ApiGranuleRecord,
|
|
488
498
|
callback?: InvokeApiFunction
|
|
489
499
|
}): Promise<ApiGatewayLambdaHttpProxyResponse> => {
|
|
500
|
+
/* istanbul ignore next */
|
|
490
501
|
const { prefix, body, callback = invokeApi } = params;
|
|
491
502
|
|
|
492
503
|
return await callback({
|
|
@@ -521,6 +532,7 @@ export const replaceGranule = async (params: {
|
|
|
521
532
|
body: ApiGranuleRecord,
|
|
522
533
|
callback?: InvokeApiFunction
|
|
523
534
|
}): Promise<ApiGatewayLambdaHttpProxyResponse> => {
|
|
535
|
+
/* istanbul ignore next */
|
|
524
536
|
const { prefix, body, callback = invokeApi } = params;
|
|
525
537
|
|
|
526
538
|
const path = encodeGranulesURIComponent(body.granuleId, body.collectionId);
|
|
@@ -565,6 +577,7 @@ export const updateGranule = async (params: {
|
|
|
565
577
|
collectionId?: CollectionId,
|
|
566
578
|
callback?: InvokeApiFunction
|
|
567
579
|
}): Promise<ApiGatewayLambdaHttpProxyResponse> => {
|
|
580
|
+
/* istanbul ignore next */
|
|
568
581
|
const { prefix, granuleId, collectionId, body, callback = invokeApi } = params;
|
|
569
582
|
|
|
570
583
|
const path = encodeGranulesURIComponent(granuleId, collectionId);
|
|
@@ -600,6 +613,7 @@ export const associateExecutionWithGranule = async (params: {
|
|
|
600
613
|
body: AssociateExecutionRequest,
|
|
601
614
|
callback?: InvokeApiFunction
|
|
602
615
|
}): Promise<ApiGatewayLambdaHttpProxyResponse> => {
|
|
616
|
+
/* istanbul ignore next */
|
|
603
617
|
const { prefix, body, callback = invokeApi } = params;
|
|
604
618
|
|
|
605
619
|
const path = encodeGranulesURIComponent(body.granuleId, undefined);
|
|
@@ -634,6 +648,7 @@ export const bulkPatchGranuleCollection = async (params: {
|
|
|
634
648
|
body: BulkPatchGranuleCollection,
|
|
635
649
|
callback?: InvokeApiFunction
|
|
636
650
|
}): Promise<ApiGatewayLambdaHttpProxyResponse> => {
|
|
651
|
+
/* istanbul ignore next */
|
|
637
652
|
const { prefix, body, callback = invokeApi } = params;
|
|
638
653
|
return await callback({
|
|
639
654
|
prefix: prefix,
|
|
@@ -668,6 +683,7 @@ export const bulkPatch = async (params: {
|
|
|
668
683
|
body: BulkPatch,
|
|
669
684
|
callback?: InvokeApiFunction
|
|
670
685
|
}): Promise<ApiGatewayLambdaHttpProxyResponse> => {
|
|
686
|
+
/* istanbul ignore next */
|
|
671
687
|
const { prefix, body, callback = invokeApi } = params;
|
|
672
688
|
return await callback({
|
|
673
689
|
prefix: prefix,
|
|
@@ -702,6 +718,7 @@ export const bulkGranules = async (params: {
|
|
|
702
718
|
body: unknown,
|
|
703
719
|
callback?: InvokeApiFunction
|
|
704
720
|
}): Promise<ApiGatewayLambdaHttpProxyResponse> => {
|
|
721
|
+
/* istanbul ignore next */
|
|
705
722
|
const { prefix, body, callback = invokeApi } = params;
|
|
706
723
|
|
|
707
724
|
return await callback({
|
|
@@ -737,6 +754,7 @@ export const bulkDeleteGranules = async (params: {
|
|
|
737
754
|
body: unknown,
|
|
738
755
|
callback?: InvokeApiFunction
|
|
739
756
|
}): Promise<ApiGatewayLambdaHttpProxyResponse> => {
|
|
757
|
+
/* istanbul ignore next */
|
|
740
758
|
const { prefix, body, callback = invokeApi } = params;
|
|
741
759
|
|
|
742
760
|
return await callback({
|
|
@@ -758,6 +776,7 @@ export const getFileGranuleAndCollectionByBucketAndKey = async (params: {
|
|
|
758
776
|
prefix: string,
|
|
759
777
|
bucket: string,
|
|
760
778
|
key: string,
|
|
779
|
+
pRetryOptions?: pRetry.Options,
|
|
761
780
|
callback?: InvokeApiFunction
|
|
762
781
|
}): Promise<ApiGatewayLambdaHttpProxyResponse> => {
|
|
763
782
|
const { prefix, bucket, key, callback = invokeApi } = params;
|
|
@@ -769,6 +788,7 @@ export const getFileGranuleAndCollectionByBucketAndKey = async (params: {
|
|
|
769
788
|
resource: '/{proxy+}',
|
|
770
789
|
path: `/granules/files/get_collection_and_granule_id/${encodeURIComponent(bucket)}/${encodeURIComponent(key)}`,
|
|
771
790
|
},
|
|
791
|
+
pRetryOptions: params.pRetryOptions,
|
|
772
792
|
});
|
|
773
793
|
};
|
|
774
794
|
|
|
@@ -777,6 +797,7 @@ export const bulkReingestGranules = async (params: {
|
|
|
777
797
|
body: unknown,
|
|
778
798
|
callback?: InvokeApiFunction
|
|
779
799
|
}): Promise<ApiGatewayLambdaHttpProxyResponse> => {
|
|
800
|
+
/* istanbul ignore next */
|
|
780
801
|
const { prefix, body, callback = invokeApi } = params;
|
|
781
802
|
|
|
782
803
|
return await callback({
|
|
@@ -814,6 +835,7 @@ export const bulkOperation = async (params: {
|
|
|
814
835
|
workflowName: string,
|
|
815
836
|
callback?: InvokeApiFunction
|
|
816
837
|
}): Promise<ApiGatewayLambdaHttpProxyResponse> => {
|
|
838
|
+
/* istanbul ignore next */
|
|
817
839
|
const { prefix, granules, workflowName, callback = invokeApi } = params;
|
|
818
840
|
return await callback({
|
|
819
841
|
prefix: prefix,
|
|
@@ -830,6 +852,32 @@ export const bulkOperation = async (params: {
|
|
|
830
852
|
});
|
|
831
853
|
};
|
|
832
854
|
|
|
855
|
+
export const bulkArchiveGranules = async (params: {
|
|
856
|
+
prefix: string,
|
|
857
|
+
body: {
|
|
858
|
+
batchSize?: number,
|
|
859
|
+
expirationDays?: number,
|
|
860
|
+
updateLimit?: number,
|
|
861
|
+
},
|
|
862
|
+
callback?: InvokeApiFunction
|
|
863
|
+
}): Promise<ApiGatewayLambdaHttpProxyResponse> => {
|
|
864
|
+
/* istanbul ignore next */
|
|
865
|
+
const { prefix, body, callback = invokeApi } = params;
|
|
866
|
+
return await callback({
|
|
867
|
+
prefix: prefix,
|
|
868
|
+
payload: {
|
|
869
|
+
httpMethod: 'POST',
|
|
870
|
+
resource: '/{proxy+}',
|
|
871
|
+
path: '/granules/bulkArchive/',
|
|
872
|
+
headers: {
|
|
873
|
+
'Content-Type': 'application/json',
|
|
874
|
+
},
|
|
875
|
+
body: JSON.stringify(body),
|
|
876
|
+
},
|
|
877
|
+
expectedStatusCodes: 202,
|
|
878
|
+
});
|
|
879
|
+
};
|
|
880
|
+
|
|
833
881
|
/**
|
|
834
882
|
* Bulk Granule Operations
|
|
835
883
|
* POST /granules/bulkChangeCollection
|
|
@@ -852,6 +900,7 @@ export const bulkChangeCollection = async (params: {
|
|
|
852
900
|
},
|
|
853
901
|
callback?: InvokeApiFunction
|
|
854
902
|
}): Promise<ApiGatewayLambdaHttpProxyResponse> => {
|
|
903
|
+
/* istanbul ignore next */
|
|
855
904
|
const { prefix, body, callback = invokeApi } = params;
|
|
856
905
|
return await callback({
|
|
857
906
|
prefix: prefix,
|