@cumulus/api-client 18.2.2 → 18.3.1
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cumulusApiClient.d.ts","sourceRoot":"","sources":["src/cumulusApiClient.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cumulusApiClient.d.ts","sourceRoot":"","sources":["src/cumulusApiClient.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AAIjC;;;;;;;;;;;;;GAaG;AACH,wBAAsB,SAAS,CAC7B,MAAM,EAAE,KAAK,CAAC,uBAAuB,GACpC,OAAO,CAAC,KAAK,CAAC,iCAAiC,CAAC,CA+ClD"}
|
package/cumulusApiClient.js
CHANGED
|
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.invokeApi = void 0;
|
|
7
|
+
const client_lambda_1 = require("@aws-sdk/client-lambda");
|
|
7
8
|
const p_retry_1 = __importDefault(require("p-retry"));
|
|
8
9
|
const services_1 = require("@cumulus/aws-client/services");
|
|
9
10
|
const logger_1 = __importDefault(require("@cumulus/logger"));
|
|
@@ -27,10 +28,10 @@ async function invokeApi(params) {
|
|
|
27
28
|
const { prefix, payload, expectedStatusCodes = 200, pRetryOptions = {}, } = params;
|
|
28
29
|
const expectedStatusCodesFlat = [expectedStatusCodes].flat();
|
|
29
30
|
return await (0, p_retry_1.default)(async () => {
|
|
30
|
-
const apiOutput = await (0, services_1.lambda)().
|
|
31
|
+
const apiOutput = await (0, services_1.lambda)().send(new client_lambda_1.InvokeCommand({
|
|
31
32
|
Payload: new TextEncoder().encode(JSON.stringify(payload)),
|
|
32
33
|
FunctionName: `${prefix}-PrivateApiLambda`,
|
|
33
|
-
});
|
|
34
|
+
}));
|
|
34
35
|
if (!apiOutput.Payload) {
|
|
35
36
|
throw new Error('No payload received from lambda invocation');
|
|
36
37
|
}
|
package/cumulusApiClient.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cumulusApiClient.js","sourceRoot":"","sources":["src/cumulusApiClient.ts"],"names":[],"mappings":";;;;;;AAAA,sDAA6B;
|
|
1
|
+
{"version":3,"file":"cumulusApiClient.js","sourceRoot":"","sources":["src/cumulusApiClient.ts"],"names":[],"mappings":";;;;;;AAAA,0DAAuD;AAEvD,sDAA6B;AAC7B,2DAAsD;AACtD,6DAAqC;AAErC,mEAAgE;AAGhE,MAAM,MAAM,GAAG,IAAI,gBAAM,CAAC,EAAE,MAAM,EAAE,8BAA8B,EAAE,CAAC,CAAC;AAEtE;;;;;;;;;;;;;GAaG;AACI,KAAK,UAAU,SAAS,CAC7B,MAAqC;IAErC,MAAM,EACJ,MAAM,EACN,OAAO,EACP,mBAAmB,GAAG,GAAG,EACzB,aAAa,GAAG,EAAE,GACnB,GAAG,MAAM,CAAC;IAEX,MAAM,uBAAuB,GAAG,CAAC,mBAAmB,CAAC,CAAC,IAAI,EAAE,CAAC;IAE7D,OAAO,MAAM,IAAA,iBAAM,EACjB,KAAK,IAAI,EAAE;QACT,MAAM,SAAS,GAAG,MAAM,IAAA,iBAAM,GAAE,CAAC,IAAI,CAAC,IAAI,6BAAa,CAAC;YACtD,OAAO,EAAE,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;YAC1D,YAAY,EAAE,GAAG,MAAM,mBAAmB;SAC3C,CAAC,CAAC,CAAC;QAEJ,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE;YACtB,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;SAC/D;QAED,MAAM,aAAa,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,WAAW,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC;QAErF,IAAI,aAAa,EAAE,YAAY,EAAE,QAAQ,CAAC,gBAAgB,CAAC,EAAE;YAC3D,MAAM,IAAI,6CAAqB,CAC7B,iBAAiB,OAAO,CAAC,IAAI,KAAK,aAAa,CAAC,YAAY,EAAE,EAC9D,aAAa,EAAE,UAAU,EACzB,SAAS,CACV,CAAC;SACH;QAED,IAAI,CAAC,uBAAuB,CAAC,QAAQ,CAAC,aAAa,EAAE,UAAU,CAAC,EAAE;YAChE,MAAM,IAAI,6CAAqB,CAC7B,GAAG,OAAO,CAAC,IAAI,aAAa,aAAa,CAAC,UAAU,KAAK,aAAa,CAAC,IAAI,EAAE,EAC7E,aAAa,EAAE,UAAU,EACzB,aAAa,CAAC,IAAI,CACnB,CAAC;SACH;QACD,OAAO,aAAa,CAAC;IACvB,CAAC,EACD;QACE,OAAO,EAAE,CAAC;QACV,UAAU,EAAE,KAAK;QACjB,eAAe,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,aAAa,8BAA8B,CAAC,CAAC,OAAO,GAAG,CAAC;QAC1G,GAAG,aAAa;KACjB,CACF,CAAC;AACJ,CAAC;AAjDD,8BAiDC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cumulus/api-client",
|
|
3
|
-
"version": "18.
|
|
3
|
+
"version": "18.3.1",
|
|
4
4
|
"description": "API client for working with the Cumulus archive API",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"GIBS",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"NASA"
|
|
9
9
|
],
|
|
10
10
|
"engines": {
|
|
11
|
-
"node": ">=
|
|
11
|
+
"node": ">=20.12.2"
|
|
12
12
|
},
|
|
13
13
|
"publishConfig": {
|
|
14
14
|
"access": "public"
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
"scripts": {
|
|
23
23
|
"clean": "git clean -d -x -e node_modules -f",
|
|
24
24
|
"test": "../../node_modules/.bin/ava",
|
|
25
|
+
"test:ci": "../../scripts/run_package_ci_unit.sh",
|
|
25
26
|
"test:coverage": "../../node_modules/.bin/nyc npm test",
|
|
26
27
|
"prepare": "npm run tsc",
|
|
27
28
|
"tsc": "../../node_modules/.bin/tsc",
|
|
@@ -34,17 +35,19 @@
|
|
|
34
35
|
"tests/**"
|
|
35
36
|
],
|
|
36
37
|
"verbose": true,
|
|
37
|
-
"timeout": "15m"
|
|
38
|
+
"timeout": "15m",
|
|
39
|
+
"failFast": true
|
|
38
40
|
},
|
|
39
41
|
"author": "Cumulus Authors",
|
|
40
42
|
"license": "Apache-2.0",
|
|
41
43
|
"dependencies": {
|
|
42
|
-
"@
|
|
43
|
-
"@cumulus/
|
|
44
|
+
"@aws-sdk/client-lambda": "^3.529.1",
|
|
45
|
+
"@cumulus/aws-client": "18.3.1",
|
|
46
|
+
"@cumulus/logger": "18.3.1",
|
|
44
47
|
"p-retry": "^2.0.0"
|
|
45
48
|
},
|
|
46
49
|
"devDependencies": {
|
|
47
|
-
"@cumulus/types": "18.
|
|
50
|
+
"@cumulus/types": "18.3.1"
|
|
48
51
|
},
|
|
49
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "0393f90c6401ef0c524068e4636c1dcc389020b8"
|
|
50
53
|
}
|
package/src/cumulusApiClient.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { InvokeCommand } from '@aws-sdk/client-lambda';
|
|
2
2
|
|
|
3
|
+
import pRetry from 'p-retry';
|
|
3
4
|
import { lambda } from '@cumulus/aws-client/services';
|
|
4
5
|
import Logger from '@cumulus/logger';
|
|
5
6
|
|
|
@@ -36,10 +37,10 @@ export async function invokeApi(
|
|
|
36
37
|
|
|
37
38
|
return await pRetry(
|
|
38
39
|
async () => {
|
|
39
|
-
const apiOutput = await lambda().
|
|
40
|
+
const apiOutput = await lambda().send(new InvokeCommand({
|
|
40
41
|
Payload: new TextEncoder().encode(JSON.stringify(payload)),
|
|
41
42
|
FunctionName: `${prefix}-PrivateApiLambda`,
|
|
42
|
-
});
|
|
43
|
+
}));
|
|
43
44
|
|
|
44
45
|
if (!apiOutput.Payload) {
|
|
45
46
|
throw new Error('No payload received from lambda invocation');
|