@ttoss/aws-appsync-nodejs 1.8.25 → 1.8.26
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/dist/esm/index.js +15 -10
- package/dist/index.js +14 -10
- package/package.json +2 -2
package/dist/esm/index.js
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
/** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __name = (target, value) => __defProp(target, "name", {
|
|
4
|
+
value,
|
|
5
|
+
configurable: true
|
|
6
|
+
});
|
|
2
7
|
|
|
3
8
|
// src/index.ts
|
|
4
9
|
import { HttpRequest } from "@smithy/protocol-http";
|
|
@@ -6,10 +11,10 @@ import { Sha256 } from "@aws-crypto/sha256-js";
|
|
|
6
11
|
import { SignatureV4 } from "@smithy/signature-v4";
|
|
7
12
|
import { defaultProvider } from "@aws-sdk/credential-provider-node";
|
|
8
13
|
var _config;
|
|
9
|
-
var setConfig = config => {
|
|
14
|
+
var setConfig = /* @__PURE__ */__name(config => {
|
|
10
15
|
_config = config;
|
|
11
|
-
};
|
|
12
|
-
var queryWithApiKey = async (query2, variables) => {
|
|
16
|
+
}, "setConfig");
|
|
17
|
+
var queryWithApiKey = /* @__PURE__ */__name(async (query2, variables) => {
|
|
13
18
|
const {
|
|
14
19
|
endpoint,
|
|
15
20
|
apiKey
|
|
@@ -31,8 +36,8 @@ var queryWithApiKey = async (query2, variables) => {
|
|
|
31
36
|
const response = await fetch(request);
|
|
32
37
|
const body = await response.json();
|
|
33
38
|
return body;
|
|
34
|
-
};
|
|
35
|
-
var getRegionFromEndpoint = endpoint => {
|
|
39
|
+
}, "queryWithApiKey");
|
|
40
|
+
var getRegionFromEndpoint = /* @__PURE__ */__name(endpoint => {
|
|
36
41
|
const matcher = /\.[a-z]+-[a-z]+-[0-9]\./;
|
|
37
42
|
const regexResponse = endpoint.match(matcher);
|
|
38
43
|
let region = "";
|
|
@@ -40,8 +45,8 @@ var getRegionFromEndpoint = endpoint => {
|
|
|
40
45
|
region = regexResponse[0].replace(/\./g, "");
|
|
41
46
|
}
|
|
42
47
|
return region;
|
|
43
|
-
};
|
|
44
|
-
var queryWithCredentials = async (query2, variables) => {
|
|
48
|
+
}, "getRegionFromEndpoint");
|
|
49
|
+
var queryWithCredentials = /* @__PURE__ */__name(async (query2, variables) => {
|
|
45
50
|
const endpoint = new URL(_config.endpoint);
|
|
46
51
|
const region = _config.region || getRegionFromEndpoint(_config.endpoint);
|
|
47
52
|
const signer = new SignatureV4({
|
|
@@ -69,13 +74,13 @@ var queryWithCredentials = async (query2, variables) => {
|
|
|
69
74
|
const response = await fetch(request);
|
|
70
75
|
const body = await response.json();
|
|
71
76
|
return body;
|
|
72
|
-
};
|
|
73
|
-
var query = async (query2, variables) => {
|
|
77
|
+
}, "queryWithCredentials");
|
|
78
|
+
var query = /* @__PURE__ */__name(async (query2, variables) => {
|
|
74
79
|
if (_config.apiKey) {
|
|
75
80
|
return queryWithApiKey(query2, variables);
|
|
76
81
|
}
|
|
77
82
|
return queryWithCredentials(query2, variables);
|
|
78
|
-
};
|
|
83
|
+
}, "query");
|
|
79
84
|
var appSyncClient = {
|
|
80
85
|
query,
|
|
81
86
|
setConfig,
|
package/dist/index.js
CHANGED
|
@@ -5,6 +5,10 @@ var __defProp = Object.defineProperty;
|
|
|
5
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __name = (target, value) => __defProp(target, "name", {
|
|
9
|
+
value,
|
|
10
|
+
configurable: true
|
|
11
|
+
});
|
|
8
12
|
var __export = (target, all) => {
|
|
9
13
|
for (var name in all) __defProp(target, name, {
|
|
10
14
|
get: all[name],
|
|
@@ -35,10 +39,10 @@ var import_sha256_js = require("@aws-crypto/sha256-js");
|
|
|
35
39
|
var import_signature_v4 = require("@smithy/signature-v4");
|
|
36
40
|
var import_credential_provider_node = require("@aws-sdk/credential-provider-node");
|
|
37
41
|
var _config;
|
|
38
|
-
var setConfig = config => {
|
|
42
|
+
var setConfig = /* @__PURE__ */__name(config => {
|
|
39
43
|
_config = config;
|
|
40
|
-
};
|
|
41
|
-
var queryWithApiKey = async (query2, variables) => {
|
|
44
|
+
}, "setConfig");
|
|
45
|
+
var queryWithApiKey = /* @__PURE__ */__name(async (query2, variables) => {
|
|
42
46
|
const {
|
|
43
47
|
endpoint,
|
|
44
48
|
apiKey
|
|
@@ -60,8 +64,8 @@ var queryWithApiKey = async (query2, variables) => {
|
|
|
60
64
|
const response = await fetch(request);
|
|
61
65
|
const body = await response.json();
|
|
62
66
|
return body;
|
|
63
|
-
};
|
|
64
|
-
var getRegionFromEndpoint = endpoint => {
|
|
67
|
+
}, "queryWithApiKey");
|
|
68
|
+
var getRegionFromEndpoint = /* @__PURE__ */__name(endpoint => {
|
|
65
69
|
const matcher = /\.[a-z]+-[a-z]+-[0-9]\./;
|
|
66
70
|
const regexResponse = endpoint.match(matcher);
|
|
67
71
|
let region = "";
|
|
@@ -69,8 +73,8 @@ var getRegionFromEndpoint = endpoint => {
|
|
|
69
73
|
region = regexResponse[0].replace(/\./g, "");
|
|
70
74
|
}
|
|
71
75
|
return region;
|
|
72
|
-
};
|
|
73
|
-
var queryWithCredentials = async (query2, variables) => {
|
|
76
|
+
}, "getRegionFromEndpoint");
|
|
77
|
+
var queryWithCredentials = /* @__PURE__ */__name(async (query2, variables) => {
|
|
74
78
|
const endpoint = new URL(_config.endpoint);
|
|
75
79
|
const region = _config.region || getRegionFromEndpoint(_config.endpoint);
|
|
76
80
|
const signer = new import_signature_v4.SignatureV4({
|
|
@@ -98,13 +102,13 @@ var queryWithCredentials = async (query2, variables) => {
|
|
|
98
102
|
const response = await fetch(request);
|
|
99
103
|
const body = await response.json();
|
|
100
104
|
return body;
|
|
101
|
-
};
|
|
102
|
-
var query = async (query2, variables) => {
|
|
105
|
+
}, "queryWithCredentials");
|
|
106
|
+
var query = /* @__PURE__ */__name(async (query2, variables) => {
|
|
103
107
|
if (_config.apiKey) {
|
|
104
108
|
return queryWithApiKey(query2, variables);
|
|
105
109
|
}
|
|
106
110
|
return queryWithCredentials(query2, variables);
|
|
107
|
-
};
|
|
111
|
+
}, "query");
|
|
108
112
|
var appSyncClient = {
|
|
109
113
|
query,
|
|
110
114
|
setConfig,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ttoss/aws-appsync-nodejs",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.26",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "ttoss",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"@types/jest": "^30.0.0",
|
|
34
34
|
"jest": "^30.0.4",
|
|
35
35
|
"tsup": "^8.5.0",
|
|
36
|
-
"@ttoss/config": "^1.35.
|
|
36
|
+
"@ttoss/config": "^1.35.7"
|
|
37
37
|
},
|
|
38
38
|
"keywords": [],
|
|
39
39
|
"publishConfig": {
|