google-ads-api 13.0.0 → 14.1.0-beta-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/README.md +1 -7
- package/build/src/customer.d.ts +6 -6
- package/build/src/customer.js +1 -2
- package/build/src/protos/autogen/enums.d.ts +463 -314
- package/build/src/protos/autogen/enums.js +464 -307
- package/build/src/protos/autogen/fields.d.ts +176 -162
- package/build/src/protos/autogen/fields.js +8 -3
- package/build/src/protos/autogen/resourceNames.d.ts +25 -13
- package/build/src/protos/autogen/resourceNames.js +34 -18
- package/build/src/protos/autogen/serviceFactory.d.ts +166 -168
- package/build/src/protos/autogen/serviceFactory.js +292 -404
- package/build/src/protos/index.d.ts +6 -6
- package/build/src/protos/index.js +5 -5
- package/build/src/query.d.ts +8 -8
- package/build/src/service.d.ts +0 -1
- package/build/src/service.js +18 -3
- package/build/src/version.d.ts +1 -1
- package/build/src/version.js +1 -1
- package/package.json +4 -3
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import allProtos, { protos } from "google-ads-node";
|
|
2
|
-
export declare const VERSION: "
|
|
3
|
-
export import common = protos.google.ads.googleads.
|
|
4
|
-
export import errors = protos.google.ads.googleads.
|
|
5
|
-
export import resources = protos.google.ads.googleads.
|
|
6
|
-
export import services = protos.google.ads.googleads.
|
|
7
|
-
export import internalEnums = protos.google.ads.googleads.
|
|
2
|
+
export declare const VERSION: "v14";
|
|
3
|
+
export import common = protos.google.ads.googleads.v14.common;
|
|
4
|
+
export import errors = protos.google.ads.googleads.v14.errors;
|
|
5
|
+
export import resources = protos.google.ads.googleads.v14.resources;
|
|
6
|
+
export import services = protos.google.ads.googleads.v14.services;
|
|
7
|
+
export import internalEnums = protos.google.ads.googleads.v14.enums;
|
|
8
8
|
export { enums } from "./autogen/enums";
|
|
9
9
|
export { fields } from "./autogen/fields";
|
|
10
10
|
export { GoogleAdsServiceClient } from "google-ads-node";
|
|
@@ -7,12 +7,12 @@ const version_1 = require("../version");
|
|
|
7
7
|
exports.VERSION = version_1.googleAdsVersion;
|
|
8
8
|
// -- Expose the googleads generated types --
|
|
9
9
|
// The namespace path is shortened for ease of use
|
|
10
|
-
exports.common = google_ads_node_1.protos.google.ads.googleads.
|
|
11
|
-
exports.errors = google_ads_node_1.protos.google.ads.googleads.
|
|
12
|
-
exports.resources = google_ads_node_1.protos.google.ads.googleads.
|
|
13
|
-
exports.services = google_ads_node_1.protos.google.ads.googleads.
|
|
10
|
+
exports.common = google_ads_node_1.protos.google.ads.googleads.v14.common;
|
|
11
|
+
exports.errors = google_ads_node_1.protos.google.ads.googleads.v14.errors;
|
|
12
|
+
exports.resources = google_ads_node_1.protos.google.ads.googleads.v14.resources;
|
|
13
|
+
exports.services = google_ads_node_1.protos.google.ads.googleads.v14.services;
|
|
14
14
|
// We compile enums ourselves, the Google ones should be used internally only
|
|
15
|
-
exports.internalEnums = google_ads_node_1.protos.google.ads.googleads.
|
|
15
|
+
exports.internalEnums = google_ads_node_1.protos.google.ads.googleads.v14.enums;
|
|
16
16
|
var enums_1 = require("./autogen/enums");
|
|
17
17
|
Object.defineProperty(exports, "enums", { enumerable: true, get: function () { return enums_1.enums; } });
|
|
18
18
|
var fields_1 = require("./autogen/fields");
|
package/build/src/query.d.ts
CHANGED
|
@@ -44,18 +44,18 @@ export declare function validateConstraintKeyAndValue(key: ConstraintKey, op: Co
|
|
|
44
44
|
val: ParsedConstraintValue;
|
|
45
45
|
};
|
|
46
46
|
export declare function convertNumericEnumToString(key: ConstraintKey, val: ParsedConstraintValue): ParsedConstraintValue;
|
|
47
|
-
export declare function extractConstraintConditions(constraints: ReportOptions["constraints"]): ConstraintString[];
|
|
47
|
+
export declare function extractConstraintConditions(constraints: Readonly<ReportOptions["constraints"]>): ConstraintString[];
|
|
48
48
|
export declare function extractDateConstantConditions(dateConstant: ReportOptions["date_constant"]): ConstraintString[];
|
|
49
49
|
export declare function extractDateConditions(fromDate: ReportOptions["from_date"], toDate: ReportOptions["to_date"]): ConstraintString[];
|
|
50
|
-
export declare function buildWhereClause(constraints: ReportOptions["constraints"]
|
|
50
|
+
export declare function buildWhereClause(constraints: Readonly<ReportOptions["constraints"]>, dateConstant: Readonly<ReportOptions["date_constant"]>, fromDate: Readonly<ReportOptions["from_date"]>, toDate: Readonly<ReportOptions["to_date"]>): WhereClause;
|
|
51
51
|
export declare function buildLimitClause(limit: ReportOptions["limit"]): LimitClause;
|
|
52
|
-
export declare function buildParametersClause(parameters: ReportOptions["parameters"]): ParametersClause;
|
|
52
|
+
export declare function buildParametersClause(parameters: Readonly<ReportOptions["parameters"]>): ParametersClause;
|
|
53
53
|
export declare function completeOrderly(orderly: string, entity: ReportOptions["entity"]): string;
|
|
54
|
-
export declare function buildOrderClauseOld(orderBy: ReportOptions["order_by"]
|
|
55
|
-
export declare function buildOrderClauseNew(order: Required<ReportOptions["order"]
|
|
56
|
-
export declare function buildOrderClause(order: ReportOptions["order"]
|
|
57
|
-
export declare function buildRequestOptions(reportOptions: ReportOptions): RequestOptions;
|
|
58
|
-
export declare function buildQuery(reportOptions: ReportOptions): {
|
|
54
|
+
export declare function buildOrderClauseOld(orderBy: Readonly<ReportOptions["order_by"]>, sortOrder: Readonly<ReportOptions["sort_order"]>, entity: Readonly<ReportOptions["entity"]>): OrderClause;
|
|
55
|
+
export declare function buildOrderClauseNew(order: Readonly<Required<ReportOptions["order"]>>, entity: Readonly<ReportOptions["entity"]>): OrderClause;
|
|
56
|
+
export declare function buildOrderClause(order: Readonly<ReportOptions["order"]>, orderBy: Readonly<ReportOptions["order_by"]>, sortOrder: Readonly<ReportOptions["sort_order"]>, entity: Readonly<ReportOptions["entity"]>): OrderClause;
|
|
57
|
+
export declare function buildRequestOptions(reportOptions: Readonly<ReportOptions>): RequestOptions;
|
|
58
|
+
export declare function buildQuery(reportOptions: Readonly<ReportOptions>): {
|
|
59
59
|
gaqlQuery: Query;
|
|
60
60
|
requestOptions: RequestOptions;
|
|
61
61
|
};
|
package/build/src/service.d.ts
CHANGED
|
@@ -12,7 +12,6 @@ export declare class Service {
|
|
|
12
12
|
protected readonly clientOptions: ClientOptions;
|
|
13
13
|
protected readonly customerOptions: CustomerOptions;
|
|
14
14
|
protected readonly hooks: Hooks;
|
|
15
|
-
private serviceCache;
|
|
16
15
|
constructor(clientOptions: ClientOptions, customerOptions: CustomerOptions, hooks?: Hooks);
|
|
17
16
|
get credentials(): CustomerCredentials;
|
|
18
17
|
protected get callHeaders(): CallHeaders;
|
package/build/src/service.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.Service = exports.FAILURE_KEY = void 0;
|
|
4
7
|
const google_gax_1 = require("google-gax");
|
|
@@ -6,8 +9,18 @@ const google_auth_library_1 = require("google-auth-library");
|
|
|
6
9
|
const protos_1 = require("./protos");
|
|
7
10
|
const utils_1 = require("./utils");
|
|
8
11
|
const version_1 = require("./version");
|
|
12
|
+
const ttlcache_1 = __importDefault(require("@isaacs/ttlcache"));
|
|
9
13
|
// Make sure to update this version number when upgrading
|
|
10
14
|
exports.FAILURE_KEY = `google.ads.googleads.${version_1.googleAdsVersion}.errors.googleadsfailure-bin`;
|
|
15
|
+
// A global service cache to avoid re-initialising services
|
|
16
|
+
const serviceCache = new ttlcache_1.default({
|
|
17
|
+
max: 1000,
|
|
18
|
+
ttl: 10 * 60 * 1000,
|
|
19
|
+
dispose: async (service) => {
|
|
20
|
+
// Close connections when services are removed from the cache
|
|
21
|
+
await service.close();
|
|
22
|
+
},
|
|
23
|
+
});
|
|
11
24
|
class Service {
|
|
12
25
|
constructor(clientOptions, customerOptions, hooks) {
|
|
13
26
|
this.clientOptions = clientOptions;
|
|
@@ -42,18 +55,20 @@ class Service {
|
|
|
42
55
|
return credentials;
|
|
43
56
|
}
|
|
44
57
|
loadService(service) {
|
|
45
|
-
|
|
46
|
-
|
|
58
|
+
const serviceCacheKey = `${service}_${this.customerOptions.refresh_token}`;
|
|
59
|
+
if (serviceCache.has(serviceCacheKey)) {
|
|
60
|
+
return serviceCache.get(serviceCacheKey);
|
|
47
61
|
}
|
|
48
62
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
49
63
|
const { [service]: protoService } = require("google-ads-node");
|
|
50
64
|
if (typeof protoService === "undefined") {
|
|
51
65
|
throw new Error(`Service "${service}" could not be found`);
|
|
52
66
|
}
|
|
67
|
+
// Initialising services can take a few ms, so we cache when possible.
|
|
53
68
|
const client = new protoService({
|
|
54
69
|
sslCreds: this.getCredentials(),
|
|
55
70
|
});
|
|
56
|
-
|
|
71
|
+
serviceCache.set(serviceCacheKey, client);
|
|
57
72
|
return client;
|
|
58
73
|
}
|
|
59
74
|
getGoogleAdsError(error) {
|
package/build/src/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const googleAdsVersion = "
|
|
1
|
+
export declare const googleAdsVersion = "v14";
|
package/build/src/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "google-ads-api",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "14.1.0-beta-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",
|
|
@@ -17,9 +17,10 @@
|
|
|
17
17
|
"author": "Opteo",
|
|
18
18
|
"license": "MIT",
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"
|
|
20
|
+
"@isaacs/ttlcache": "^1.2.2",
|
|
21
|
+
"google-ads-node": "^12.0.1",
|
|
21
22
|
"google-auth-library": "^7.1.0",
|
|
22
|
-
"google-gax": "^
|
|
23
|
+
"google-gax": "^4.0.3",
|
|
23
24
|
"long": "^4.0.0"
|
|
24
25
|
},
|
|
25
26
|
"devDependencies": {
|