google-ads-api 22.0.0-beta.0 → 22.0.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/build/src/parserRest.d.ts +0 -3
- package/build/src/parserRest.js +29 -19
- package/package.json +2 -3
package/build/src/parserRest.js
CHANGED
|
@@ -1,13 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* JSON Rest parsing
|
|
4
|
-
*/
|
|
5
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
6
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
7
|
-
};
|
|
8
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
3
|
exports.decamelizeKeys = void 0;
|
|
10
|
-
const map_obj_1 = __importDefault(require("map-obj"));
|
|
11
4
|
const circ_json_1 = require("circ-json");
|
|
12
5
|
const utils_1 = require("./utils");
|
|
13
6
|
const fields_1 = require("./protos/autogen/fields");
|
|
@@ -20,20 +13,37 @@ const decamelizeKeys = (input) => {
|
|
|
20
13
|
if (!isObject(input)) {
|
|
21
14
|
return input;
|
|
22
15
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
if (isObject(value)) {
|
|
26
|
-
|
|
27
|
-
// @ts-ignore
|
|
28
|
-
value = (0, map_obj_1.default)(value, makeMapper(path));
|
|
16
|
+
return transform(input);
|
|
17
|
+
function transform(value, parentPath) {
|
|
18
|
+
if (!isObject(value)) {
|
|
19
|
+
return value;
|
|
29
20
|
}
|
|
30
|
-
|
|
31
|
-
|
|
21
|
+
if (Array.isArray(value)) {
|
|
22
|
+
const length = value.length;
|
|
23
|
+
const result = new Array(length);
|
|
24
|
+
for (let i = 0; i < length; i += 1) {
|
|
25
|
+
const item = value[i];
|
|
26
|
+
result[i] = isObject(item) ? transformObject(item, parentPath) : item;
|
|
27
|
+
}
|
|
28
|
+
return result;
|
|
32
29
|
}
|
|
33
|
-
return
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
|
|
30
|
+
return transformObject(value, parentPath);
|
|
31
|
+
}
|
|
32
|
+
function transformObject(obj, parentPath) {
|
|
33
|
+
const output = {};
|
|
34
|
+
for (const key of Object.keys(obj)) {
|
|
35
|
+
const rawValue = obj[key];
|
|
36
|
+
const newKey = cachedDecamelize(key);
|
|
37
|
+
if (isObject(rawValue)) {
|
|
38
|
+
const nextParentPath = parentPath === undefined ? newKey : `${parentPath}.${newKey}`;
|
|
39
|
+
output[newKey] = transform(rawValue, nextParentPath);
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
output[newKey] = cachedValueParser(newKey, parentPath, rawValue);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return output;
|
|
46
|
+
}
|
|
37
47
|
};
|
|
38
48
|
exports.decamelizeKeys = decamelizeKeys;
|
|
39
49
|
const cachedDecamelize = (key) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "google-ads-api",
|
|
3
|
-
"version": "22.0.0
|
|
3
|
+
"version": "22.0.0",
|
|
4
4
|
"description": "Google Ads API Client Library for Node.js",
|
|
5
5
|
"repository": "https://github.com/Opteo/google-ads-api",
|
|
6
6
|
"main": "build/src/index.js",
|
|
@@ -21,11 +21,10 @@
|
|
|
21
21
|
"@isaacs/ttlcache": "^1.2.2",
|
|
22
22
|
"axios": "^1.6.7",
|
|
23
23
|
"circ-json": "^1.0.4",
|
|
24
|
-
"google-ads-node": "19.0.0
|
|
24
|
+
"google-ads-node": "19.0.0",
|
|
25
25
|
"google-auth-library": "^9.15.1",
|
|
26
26
|
"google-gax": "^5.0.6",
|
|
27
27
|
"long": "^4.0.0",
|
|
28
|
-
"map-obj": "^4.0.0",
|
|
29
28
|
"stream-json": "^1.8.0"
|
|
30
29
|
},
|
|
31
30
|
"devDependencies": {
|