google-ads-api 16.0.0 → 17.0.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/build/src/hooks.d.ts +23 -23
- package/build/src/parser.js +5 -5
- package/build/src/protos/autogen/enums.d.ts +3353 -3170
- package/build/src/protos/autogen/enums.js +562 -367
- package/build/src/protos/autogen/fields.d.ts +227 -171
- package/build/src/protos/autogen/fields.js +39 -1
- package/build/src/protos/autogen/resourceNames.d.ts +230 -178
- package/build/src/protos/autogen/resourceNames.js +239 -181
- package/build/src/protos/autogen/serviceFactory.d.ts +420 -383
- package/build/src/protos/autogen/serviceFactory.js +575 -228
- package/build/src/protos/index.d.ts +8 -8
- package/build/src/protos/index.js +5 -5
- package/build/src/query.d.ts +9 -9
- package/build/src/query.js +17 -17
- package/build/src/service.d.ts +1 -1
- package/build/src/service.js +1 -1
- package/build/src/testUtils.d.ts +0 -1
- package/build/src/testUtils.js +13 -13
- package/build/src/types.d.ts +14 -14
- package/build/src/utils.js +9 -10
- package/build/src/version.d.ts +1 -1
- package/build/src/version.js +4 -2
- package/package.json +5 -4
|
@@ -1,14 +1,14 @@
|
|
|
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: "v17";
|
|
3
|
+
export import common = protos.google.ads.googleads.v17.common;
|
|
4
|
+
export import errors = protos.google.ads.googleads.v17.errors;
|
|
5
|
+
export import resources = protos.google.ads.googleads.v17.resources;
|
|
6
|
+
export import services = protos.google.ads.googleads.v17.services;
|
|
7
|
+
export import internalEnums = protos.google.ads.googleads.v17.enums;
|
|
8
8
|
export { enums } from "./autogen/enums";
|
|
9
9
|
export { fields } from "./autogen/fields";
|
|
10
10
|
export { GoogleAdsServiceClient } from "google-ads-node";
|
|
11
|
-
export
|
|
12
|
-
export
|
|
11
|
+
export type AllServices = Omit<typeof allProtos, typeof VERSION>;
|
|
12
|
+
export type ServiceName = keyof Omit<typeof allProtos, typeof VERSION>;
|
|
13
13
|
export import protobuf = protos.google.protobuf;
|
|
14
14
|
export import longrunning = protos.google.longrunning;
|
|
@@ -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.v17.common;
|
|
11
|
+
exports.errors = google_ads_node_1.protos.google.ads.googleads.v17.errors;
|
|
12
|
+
exports.resources = google_ads_node_1.protos.google.ads.googleads.v17.resources;
|
|
13
|
+
exports.services = google_ads_node_1.protos.google.ads.googleads.v17.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.v17.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
|
@@ -10,15 +10,15 @@ declare enum QueryKeywords {
|
|
|
10
10
|
AND = "AND",
|
|
11
11
|
OR = "OR"
|
|
12
12
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
export
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
13
|
+
type ParsedConstraintValue = string | number | boolean;
|
|
14
|
+
type ConstraintString = `${string} ${ConstraintOperation} ${ParsedConstraintValue}`;
|
|
15
|
+
type SelectClause = `${QueryKeywords.SELECT} ${string}`;
|
|
16
|
+
type FromClause = ` ${QueryKeywords.FROM} ${fields.Resource}`;
|
|
17
|
+
type WhereClause = ` ${QueryKeywords.WHERE} ${string}` | ``;
|
|
18
|
+
export type OrderClause = ` ${QueryKeywords.ORDER_BY} ${string} ${SortOrder}` | ` ${QueryKeywords.ORDER_BY} ${string}` | ``;
|
|
19
|
+
type LimitClause = ` ${QueryKeywords.LIMIT} ${number}` | ``;
|
|
20
|
+
type ParametersClause = ` ${QueryKeywords.PARAMETERS} ${string}` | ``;
|
|
21
|
+
type Query = `${SelectClause}${FromClause}${WhereClause}${OrderClause}${LimitClause}${ParametersClause}`;
|
|
22
22
|
export declare const QueryError: {
|
|
23
23
|
INVALID_CONSTRAINTS_FORMAT: string;
|
|
24
24
|
INVALID_CONSTRAINT_KEY: string;
|
package/build/src/query.js
CHANGED
|
@@ -1,6 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.QueryError = void 0;
|
|
4
|
+
exports.buildSelectClause = buildSelectClause;
|
|
5
|
+
exports.buildFromClause = buildFromClause;
|
|
6
|
+
exports.validateConstraintKeyAndValue = validateConstraintKeyAndValue;
|
|
7
|
+
exports.convertNumericEnumToString = convertNumericEnumToString;
|
|
8
|
+
exports.extractConstraintConditions = extractConstraintConditions;
|
|
9
|
+
exports.extractDateConstantConditions = extractDateConstantConditions;
|
|
10
|
+
exports.extractDateConditions = extractDateConditions;
|
|
11
|
+
exports.buildWhereClause = buildWhereClause;
|
|
12
|
+
exports.buildLimitClause = buildLimitClause;
|
|
13
|
+
exports.buildParametersClause = buildParametersClause;
|
|
14
|
+
exports.completeOrderly = completeOrderly;
|
|
15
|
+
exports.buildOrderClauseOld = buildOrderClauseOld;
|
|
16
|
+
exports.buildOrderClauseNew = buildOrderClauseNew;
|
|
17
|
+
exports.buildOrderClause = buildOrderClause;
|
|
18
|
+
exports.buildRequestOptions = buildRequestOptions;
|
|
19
|
+
exports.buildQuery = buildQuery;
|
|
4
20
|
const protos_1 = require("./protos");
|
|
5
21
|
const types_1 = require("./types");
|
|
6
22
|
var QueryKeywords;
|
|
@@ -45,14 +61,12 @@ function buildSelectClause(attributes, metrics, segments) {
|
|
|
45
61
|
].join(", ");
|
|
46
62
|
return `${QueryKeywords.SELECT} ${selections}`;
|
|
47
63
|
}
|
|
48
|
-
exports.buildSelectClause = buildSelectClause;
|
|
49
64
|
function buildFromClause(entity) {
|
|
50
65
|
if (typeof entity === "undefined") {
|
|
51
66
|
throw new Error(exports.QueryError.UNDEFINED_ENTITY);
|
|
52
67
|
}
|
|
53
68
|
return ` ${QueryKeywords.FROM} ${entity}`;
|
|
54
69
|
}
|
|
55
|
-
exports.buildFromClause = buildFromClause;
|
|
56
70
|
function validateConstraintKeyAndValue(key, op, val) {
|
|
57
71
|
if (typeof val === "number" || typeof val === "boolean") {
|
|
58
72
|
return { op: "=", val: convertNumericEnumToString(key, val) };
|
|
@@ -81,7 +95,6 @@ function validateConstraintKeyAndValue(key, op, val) {
|
|
|
81
95
|
}
|
|
82
96
|
throw new Error(exports.QueryError.INVALID_CONSTRAINT_VALUE(key, val));
|
|
83
97
|
}
|
|
84
|
-
exports.validateConstraintKeyAndValue = validateConstraintKeyAndValue;
|
|
85
98
|
function convertNumericEnumToString(key, val) {
|
|
86
99
|
// @ts-expect-error key does not always match an enum field
|
|
87
100
|
if (protos_1.fields.enumFields[key] && typeof val === "number") {
|
|
@@ -93,7 +106,6 @@ function convertNumericEnumToString(key, val) {
|
|
|
93
106
|
}
|
|
94
107
|
return val;
|
|
95
108
|
}
|
|
96
|
-
exports.convertNumericEnumToString = convertNumericEnumToString;
|
|
97
109
|
function extractConstraintConditions(constraints) {
|
|
98
110
|
if (typeof constraints === "undefined") {
|
|
99
111
|
return [];
|
|
@@ -138,7 +150,6 @@ function extractConstraintConditions(constraints) {
|
|
|
138
150
|
throw new Error(exports.QueryError.INVALID_CONSTRAINTS_FORMAT);
|
|
139
151
|
}
|
|
140
152
|
}
|
|
141
|
-
exports.extractConstraintConditions = extractConstraintConditions;
|
|
142
153
|
function extractDateConstantConditions(dateConstant) {
|
|
143
154
|
if (typeof dateConstant === "undefined") {
|
|
144
155
|
return [];
|
|
@@ -148,7 +159,6 @@ function extractDateConstantConditions(dateConstant) {
|
|
|
148
159
|
}
|
|
149
160
|
return [`segments.date DURING ${dateConstant}`];
|
|
150
161
|
}
|
|
151
|
-
exports.extractDateConstantConditions = extractDateConstantConditions;
|
|
152
162
|
function extractDateConditions(fromDate, toDate) {
|
|
153
163
|
if (typeof fromDate === "undefined" && typeof toDate === "undefined") {
|
|
154
164
|
return [];
|
|
@@ -171,7 +181,6 @@ function extractDateConditions(fromDate, toDate) {
|
|
|
171
181
|
`segments.date <= "${toDate}"`,
|
|
172
182
|
];
|
|
173
183
|
}
|
|
174
|
-
exports.extractDateConditions = extractDateConditions;
|
|
175
184
|
function buildWhereClause(constraints, dateConstant, fromDate, toDate) {
|
|
176
185
|
const constraintClauses = extractConstraintConditions(constraints);
|
|
177
186
|
const dateConstantClauses = extractDateConstantConditions(dateConstant);
|
|
@@ -185,7 +194,6 @@ function buildWhereClause(constraints, dateConstant, fromDate, toDate) {
|
|
|
185
194
|
? ` ${QueryKeywords.WHERE} ${whereClauses}`
|
|
186
195
|
: ``;
|
|
187
196
|
}
|
|
188
|
-
exports.buildWhereClause = buildWhereClause;
|
|
189
197
|
function buildLimitClause(limit) {
|
|
190
198
|
if (typeof limit === "undefined") {
|
|
191
199
|
return ``;
|
|
@@ -195,7 +203,6 @@ function buildLimitClause(limit) {
|
|
|
195
203
|
}
|
|
196
204
|
return ` ${QueryKeywords.LIMIT} ${limit}`;
|
|
197
205
|
}
|
|
198
|
-
exports.buildLimitClause = buildLimitClause;
|
|
199
206
|
function buildParametersClause(parameters) {
|
|
200
207
|
if (typeof parameters === "undefined") {
|
|
201
208
|
return ``;
|
|
@@ -205,7 +212,6 @@ function buildParametersClause(parameters) {
|
|
|
205
212
|
}
|
|
206
213
|
return ` ${QueryKeywords.PARAMETERS} ${parameters}`;
|
|
207
214
|
}
|
|
208
|
-
exports.buildParametersClause = buildParametersClause;
|
|
209
215
|
function completeOrderly(orderly, entity) {
|
|
210
216
|
if (!orderly.length) {
|
|
211
217
|
throw new Error(exports.QueryError.INVALID_ORDERLY);
|
|
@@ -222,7 +228,6 @@ function completeOrderly(orderly, entity) {
|
|
|
222
228
|
throw new Error(exports.QueryError.INVALID_ORDERLY);
|
|
223
229
|
}
|
|
224
230
|
}
|
|
225
|
-
exports.completeOrderly = completeOrderly;
|
|
226
231
|
function buildOrderClauseOld(orderBy, sortOrder, entity) {
|
|
227
232
|
if (typeof orderBy === "undefined") {
|
|
228
233
|
return ``;
|
|
@@ -253,7 +258,6 @@ function buildOrderClauseOld(orderBy, sortOrder, entity) {
|
|
|
253
258
|
throw new Error(exports.QueryError.INVALID_ORDERBY);
|
|
254
259
|
}
|
|
255
260
|
}
|
|
256
|
-
exports.buildOrderClauseOld = buildOrderClauseOld;
|
|
257
261
|
function buildOrderClauseNew(order, entity) {
|
|
258
262
|
if (!order || !Array.isArray(order)) {
|
|
259
263
|
throw new Error(exports.QueryError.INVALID_ORDER);
|
|
@@ -270,7 +274,6 @@ function buildOrderClauseNew(order, entity) {
|
|
|
270
274
|
.join(", ");
|
|
271
275
|
return ` ${QueryKeywords.ORDER_BY} ${orders}`;
|
|
272
276
|
}
|
|
273
|
-
exports.buildOrderClauseNew = buildOrderClauseNew;
|
|
274
277
|
function buildOrderClause(order, orderBy, sortOrder, entity) {
|
|
275
278
|
if (order) {
|
|
276
279
|
return buildOrderClauseNew(order, entity);
|
|
@@ -279,12 +282,10 @@ function buildOrderClause(order, orderBy, sortOrder, entity) {
|
|
|
279
282
|
return buildOrderClauseOld(orderBy, sortOrder, entity);
|
|
280
283
|
}
|
|
281
284
|
}
|
|
282
|
-
exports.buildOrderClause = buildOrderClause;
|
|
283
285
|
function buildRequestOptions(reportOptions) {
|
|
284
286
|
const { page_size, page_token, validate_only, summary_row_setting } = reportOptions;
|
|
285
287
|
return { page_size, page_token, validate_only, summary_row_setting };
|
|
286
288
|
}
|
|
287
|
-
exports.buildRequestOptions = buildRequestOptions;
|
|
288
289
|
function buildQuery(reportOptions) {
|
|
289
290
|
const SELECT = buildSelectClause(reportOptions.attributes, reportOptions.metrics, reportOptions.segments);
|
|
290
291
|
const FROM = buildFromClause(reportOptions.entity);
|
|
@@ -298,4 +299,3 @@ function buildQuery(reportOptions) {
|
|
|
298
299
|
requestOptions,
|
|
299
300
|
};
|
|
300
301
|
}
|
|
301
|
-
exports.buildQuery = buildQuery;
|
package/build/src/service.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { ClientOptions } from "./client";
|
|
|
2
2
|
import { AllServices, errors, GoogleAdsServiceClient, ServiceName, services } from "./protos";
|
|
3
3
|
import { CustomerOptions, CustomerCredentials, RequestOptions, MutateOperation, MutateOptions } from "./types";
|
|
4
4
|
import { Hooks } from "./hooks";
|
|
5
|
-
export declare const FAILURE_KEY
|
|
5
|
+
export declare const FAILURE_KEY = "google.ads.googleads.v17.errors.googleadsfailure-bin";
|
|
6
6
|
export interface CallHeaders {
|
|
7
7
|
"developer-token": string;
|
|
8
8
|
"login-customer-id"?: string;
|
package/build/src/service.js
CHANGED
|
@@ -15,7 +15,7 @@ exports.FAILURE_KEY = `google.ads.googleads.${version_1.googleAdsVersion}.errors
|
|
|
15
15
|
// A global service cache to avoid re-initialising services
|
|
16
16
|
const serviceCache = new ttlcache_1.default({
|
|
17
17
|
max: 1000,
|
|
18
|
-
ttl: 10 * 60 * 1000,
|
|
18
|
+
ttl: 10 * 60 * 1000, // 10 minutes
|
|
19
19
|
dispose: async (service) => {
|
|
20
20
|
// Close connections when services are removed from the cache
|
|
21
21
|
await service.close();
|
package/build/src/testUtils.d.ts
CHANGED
package/build/src/testUtils.js
CHANGED
|
@@ -23,7 +23,19 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.
|
|
26
|
+
exports.mockParsedValues = exports.mockParseValue = exports.mockErrorMessage = exports.mockError = exports.mockMutationReturnValue = exports.mockTotalResultsCount = exports.mockSummaryRow = exports.mockQueryReturnValue = exports.mockMutations = exports.mockReportOptions = exports.mockGaqlQuery = exports.MOCK_LOGIN_CID = exports.MOCK_CID = exports.MOCK_REFRESH_TOKEN = exports.MOCK_DEVELOPER_TOKEN = exports.MOCK_CLIENT_SECRET = exports.MOCK_CLIENT_ID = void 0;
|
|
27
|
+
exports.mockPaginatedSearch = mockPaginatedSearch;
|
|
28
|
+
exports.mockSearchOnce = mockSearchOnce;
|
|
29
|
+
exports.mockBuildSearchStreamRequestAndService = mockBuildSearchStreamRequestAndService;
|
|
30
|
+
exports.mockBuildSearchRequestAndService = mockBuildSearchRequestAndService;
|
|
31
|
+
exports.mockBuildMutateRequestAndService = mockBuildMutateRequestAndService;
|
|
32
|
+
exports.mockGetGoogleAdsError = mockGetGoogleAdsError;
|
|
33
|
+
exports.mockQuery = mockQuery;
|
|
34
|
+
exports.mockParse = mockParse;
|
|
35
|
+
exports.noopParser = noopParser;
|
|
36
|
+
exports.mockMethod = mockMethod;
|
|
37
|
+
exports.failTestIfExecuted = failTestIfExecuted;
|
|
38
|
+
exports.newCustomer = newCustomer;
|
|
27
39
|
const stream_1 = require("stream");
|
|
28
40
|
const customer_1 = require("./customer");
|
|
29
41
|
const parser = __importStar(require("./parser"));
|
|
@@ -90,7 +102,6 @@ function mockPaginatedSearch(customer, includeTotalResultsCount = false) {
|
|
|
90
102
|
};
|
|
91
103
|
}));
|
|
92
104
|
}
|
|
93
|
-
exports.mockPaginatedSearch = mockPaginatedSearch;
|
|
94
105
|
function mockSearchOnce({ customer, response, nextPageToken, includeTotalResultsCount, }) {
|
|
95
106
|
return (jest
|
|
96
107
|
// @ts-expect-error private method
|
|
@@ -106,7 +117,6 @@ function mockSearchOnce({ customer, response, nextPageToken, includeTotalResults
|
|
|
106
117
|
};
|
|
107
118
|
}));
|
|
108
119
|
}
|
|
109
|
-
exports.mockSearchOnce = mockSearchOnce;
|
|
110
120
|
function mockBuildSearchStreamRequestAndService(customer) {
|
|
111
121
|
const mockStream = new stream_1.Readable({ objectMode: true });
|
|
112
122
|
const mockStreamData = (results) => {
|
|
@@ -145,7 +155,6 @@ function mockBuildSearchStreamRequestAndService(customer) {
|
|
|
145
155
|
mockStreamEnd,
|
|
146
156
|
};
|
|
147
157
|
}
|
|
148
|
-
exports.mockBuildSearchStreamRequestAndService = mockBuildSearchStreamRequestAndService;
|
|
149
158
|
function mockBuildSearchRequestAndService({ customer, shouldThrow = false, includeSummaryRow = false, includeTotalResultsCount = false, }) {
|
|
150
159
|
const mockService = {
|
|
151
160
|
search: () => {
|
|
@@ -173,7 +182,6 @@ function mockBuildSearchRequestAndService({ customer, shouldThrow = false, inclu
|
|
|
173
182
|
});
|
|
174
183
|
return { mockService, spyBuild };
|
|
175
184
|
}
|
|
176
|
-
exports.mockBuildSearchRequestAndService = mockBuildSearchRequestAndService;
|
|
177
185
|
function mockBuildMutateRequestAndService({ customer, shouldThrow = false, request, response, }) {
|
|
178
186
|
const mockService = {
|
|
179
187
|
mutate() {
|
|
@@ -195,7 +203,6 @@ function mockBuildMutateRequestAndService({ customer, shouldThrow = false, reque
|
|
|
195
203
|
});
|
|
196
204
|
return { mockService, spyBuild };
|
|
197
205
|
}
|
|
198
|
-
exports.mockBuildMutateRequestAndService = mockBuildMutateRequestAndService;
|
|
199
206
|
function mockGetGoogleAdsError(customer) {
|
|
200
207
|
return (jest
|
|
201
208
|
// @ts-expect-error protected method
|
|
@@ -203,7 +210,6 @@ function mockGetGoogleAdsError(customer) {
|
|
|
203
210
|
// @ts-expect-error
|
|
204
211
|
.mockImplementation(() => exports.mockError));
|
|
205
212
|
}
|
|
206
|
-
exports.mockGetGoogleAdsError = mockGetGoogleAdsError;
|
|
207
213
|
function mockQuery(customer) {
|
|
208
214
|
return (jest
|
|
209
215
|
// @ts-expect-error private method
|
|
@@ -216,15 +222,12 @@ function mockQuery(customer) {
|
|
|
216
222
|
};
|
|
217
223
|
}));
|
|
218
224
|
}
|
|
219
|
-
exports.mockQuery = mockQuery;
|
|
220
225
|
function mockParse(mockParsedValues) {
|
|
221
226
|
return jest.spyOn(parser, "parse").mockImplementation(() => mockParsedValues);
|
|
222
227
|
}
|
|
223
|
-
exports.mockParse = mockParse;
|
|
224
228
|
function noopParser(rows) {
|
|
225
229
|
return rows;
|
|
226
230
|
}
|
|
227
|
-
exports.noopParser = noopParser;
|
|
228
231
|
function mockMethod() {
|
|
229
232
|
return {
|
|
230
233
|
method() {
|
|
@@ -232,11 +235,9 @@ function mockMethod() {
|
|
|
232
235
|
},
|
|
233
236
|
};
|
|
234
237
|
}
|
|
235
|
-
exports.mockMethod = mockMethod;
|
|
236
238
|
function failTestIfExecuted() {
|
|
237
239
|
expect(true).toBeFalsy();
|
|
238
240
|
}
|
|
239
|
-
exports.failTestIfExecuted = failTestIfExecuted;
|
|
240
241
|
function newCustomer(hooks, disableParsing = false) {
|
|
241
242
|
return new customer_1.Customer({
|
|
242
243
|
client_id: exports.MOCK_CLIENT_ID,
|
|
@@ -249,4 +250,3 @@ function newCustomer(hooks, disableParsing = false) {
|
|
|
249
250
|
login_customer_id: exports.MOCK_LOGIN_CID,
|
|
250
251
|
}, hooks);
|
|
251
252
|
}
|
|
252
|
-
exports.newCustomer = newCustomer;
|
package/build/src/types.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export interface CustomerOptions {
|
|
|
5
5
|
login_customer_id?: string;
|
|
6
6
|
linked_customer_id?: string;
|
|
7
7
|
}
|
|
8
|
-
export
|
|
8
|
+
export type CustomerCredentials = Pick<CustomerOptions, "customer_id" | "login_customer_id" | "linked_customer_id">;
|
|
9
9
|
export interface ReportOptions extends RequestOptions {
|
|
10
10
|
entity: fields.Resource;
|
|
11
11
|
attributes?: fields.Attributes;
|
|
@@ -27,32 +27,32 @@ export interface ReportOptions extends RequestOptions {
|
|
|
27
27
|
from_date?: string;
|
|
28
28
|
to_date?: string;
|
|
29
29
|
}
|
|
30
|
-
export
|
|
30
|
+
export type DateConstant = "TODAY" | "YESTERDAY" | "LAST_7_DAYS" | "LAST_BUSINESS_WEEK" | "THIS_MONTH" | "LAST_MONTH" | "LAST_14_DAYS" | "LAST_30_DAYS" | "THIS_WEEK_SUN_TODAY" | "THIS_WEEK_MON_TODAY" | "LAST_WEEK_SUN_SAT" | "LAST_WEEK_MON_SUN";
|
|
31
31
|
export declare const dateConstants: DateConstant[];
|
|
32
|
-
export
|
|
32
|
+
export type SortOrder = "ASC" | "DESC";
|
|
33
33
|
export interface Order {
|
|
34
34
|
field: ConstraintKey;
|
|
35
35
|
sort_order?: SortOrder;
|
|
36
36
|
}
|
|
37
|
-
export
|
|
38
|
-
export
|
|
39
|
-
export
|
|
40
|
-
export
|
|
37
|
+
export type ConstraintKey = fields.Attribute | fields.Metric | fields.Segment;
|
|
38
|
+
export type ConstraintValue = number | string | boolean | (number | string)[];
|
|
39
|
+
export type ConstraintOperation = "=" | "!=" | ">" | ">=" | "<" | "<=" | "IN" | "NOT IN" | "LIKE" | "NOT LIKE" | "CONTAINS ANY" | "CONTAINS ALL" | "CONTAINS NONE" | "IS NULL" | "IS NOT NULL" | "DURING" | "BETWEEN" | "REGEXP_MATCH" | "NOT REGEXP_MATCH";
|
|
40
|
+
export type ConstraintType1 = {
|
|
41
41
|
key: ConstraintKey;
|
|
42
42
|
op: ConstraintOperation;
|
|
43
43
|
val: ConstraintValue;
|
|
44
44
|
};
|
|
45
|
-
export
|
|
45
|
+
export type ConstraintType2 = {
|
|
46
46
|
[C in ConstraintKey]?: ConstraintValue;
|
|
47
47
|
};
|
|
48
|
-
export
|
|
49
|
-
export
|
|
50
|
-
export
|
|
51
|
-
export
|
|
52
|
-
export
|
|
48
|
+
export type Constraint = string | ConstraintType1 | ConstraintType2;
|
|
49
|
+
export type Constraints = Constraint[] | ConstraintType2;
|
|
50
|
+
export type RequestOptions = Omit<services.ISearchGoogleAdsRequest, "customer_id" | "query" | "return_total_results_count">;
|
|
51
|
+
export type MutateOptions = Omit<services.IMutateGoogleAdsRequest, "customer_id" | "mutate_operations">;
|
|
52
|
+
export type MutateOperation<T> = {
|
|
53
53
|
resource: T;
|
|
54
54
|
entity: fields.Resource;
|
|
55
55
|
operation?: "create" | "update" | "remove";
|
|
56
56
|
exempt_policy_violation_keys?: services.AdGroupCriterionOperation["exempt_policy_violation_keys"];
|
|
57
57
|
} & Partial<Omit<T, "toJSON">>;
|
|
58
|
-
export
|
|
58
|
+
export type PageToken = services.ISearchGoogleAdsResponse["next_page_token"];
|
package/build/src/utils.js
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.fromMicros = fromMicros;
|
|
4
|
+
exports.toMicros = toMicros;
|
|
5
|
+
exports.normaliseQuery = normaliseQuery;
|
|
6
|
+
exports.capitaliseFirstLetter = capitaliseFirstLetter;
|
|
7
|
+
exports.toCamelCase = toCamelCase;
|
|
8
|
+
exports.toSnakeCase = toSnakeCase;
|
|
9
|
+
exports.recursiveFieldMaskSearch = recursiveFieldMaskSearch;
|
|
10
|
+
exports.getFieldMask = getFieldMask;
|
|
11
|
+
exports.createNextChunkArrivedPromise = createNextChunkArrivedPromise;
|
|
4
12
|
const protos_1 = require("./protos");
|
|
5
13
|
/**
|
|
6
14
|
* @param micros Money value in micros format
|
|
@@ -11,7 +19,6 @@ const protos_1 = require("./protos");
|
|
|
11
19
|
function fromMicros(micros) {
|
|
12
20
|
return micros / 1000000;
|
|
13
21
|
}
|
|
14
|
-
exports.fromMicros = fromMicros;
|
|
15
22
|
/**
|
|
16
23
|
* @param value Money value in decimal format
|
|
17
24
|
* @description Converts a number to micro format
|
|
@@ -21,7 +28,6 @@ exports.fromMicros = fromMicros;
|
|
|
21
28
|
function toMicros(value) {
|
|
22
29
|
return Math.round(value * 1000000);
|
|
23
30
|
}
|
|
24
|
-
exports.toMicros = toMicros;
|
|
25
31
|
/**
|
|
26
32
|
* @param query String gaql query
|
|
27
33
|
* @description Normalises a query by replacing multiple whitespace with single whitespace
|
|
@@ -35,7 +41,6 @@ exports.toMicros = toMicros;
|
|
|
35
41
|
function normaliseQuery(query) {
|
|
36
42
|
return `${query.replace(/\s{2,}/g, " ")}`;
|
|
37
43
|
}
|
|
38
|
-
exports.normaliseQuery = normaliseQuery;
|
|
39
44
|
/**
|
|
40
45
|
* @param str
|
|
41
46
|
* @description Capitalises the first letter of a string
|
|
@@ -45,7 +50,6 @@ exports.normaliseQuery = normaliseQuery;
|
|
|
45
50
|
function capitaliseFirstLetter(str) {
|
|
46
51
|
return (str.charAt(0).toUpperCase() + str.slice(1));
|
|
47
52
|
}
|
|
48
|
-
exports.capitaliseFirstLetter = capitaliseFirstLetter;
|
|
49
53
|
/**
|
|
50
54
|
* @param str
|
|
51
55
|
* @description Converts a string to a camel case string. Works on space case, snake case and title case strings.
|
|
@@ -58,7 +62,6 @@ function toCamelCase(str) {
|
|
|
58
62
|
.replace(/(_)([A-Za-z])/g, (pattern) => pattern[1].toUpperCase()) // replace "_x" patterns with "X"
|
|
59
63
|
.replace(/^([A-Z])/g, (pattern) => pattern.toLowerCase()); // capitalises the first letter of the string
|
|
60
64
|
}
|
|
61
|
-
exports.toCamelCase = toCamelCase;
|
|
62
65
|
/**
|
|
63
66
|
* @param str
|
|
64
67
|
* @description Converts a string to a snake case string. Works on space case, camel case and title case strings.
|
|
@@ -71,7 +74,6 @@ function toSnakeCase(str) {
|
|
|
71
74
|
.replace(/(?<!(^|_))([A-Z])/g, (pattern) => "_" + pattern) // places an underscore before any capital chars, unless there is already an underscore or it is the first char of the string
|
|
72
75
|
.toLowerCase();
|
|
73
76
|
}
|
|
74
|
-
exports.toSnakeCase = toSnakeCase;
|
|
75
77
|
function recursiveFieldMaskSearch(data) {
|
|
76
78
|
const paths = [];
|
|
77
79
|
for (const key of Object.keys(data)) {
|
|
@@ -91,7 +93,6 @@ function recursiveFieldMaskSearch(data) {
|
|
|
91
93
|
}
|
|
92
94
|
return paths;
|
|
93
95
|
}
|
|
94
|
-
exports.recursiveFieldMaskSearch = recursiveFieldMaskSearch;
|
|
95
96
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
96
97
|
function getFieldMask(data) {
|
|
97
98
|
const paths = recursiveFieldMaskSearch(data);
|
|
@@ -99,7 +100,6 @@ function getFieldMask(data) {
|
|
|
99
100
|
paths,
|
|
100
101
|
});
|
|
101
102
|
}
|
|
102
|
-
exports.getFieldMask = getFieldMask;
|
|
103
103
|
function createNextChunkArrivedPromise() {
|
|
104
104
|
let resolvePromise = () => {
|
|
105
105
|
return;
|
|
@@ -114,4 +114,3 @@ function createNextChunkArrivedPromise() {
|
|
|
114
114
|
});
|
|
115
115
|
return { newPromise, resolve: resolvePromise, reject: rejectPromise };
|
|
116
116
|
}
|
|
117
|
-
exports.createNextChunkArrivedPromise = createNextChunkArrivedPromise;
|
package/build/src/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const googleAdsVersion = "
|
|
1
|
+
export declare const googleAdsVersion = "v17";
|
package/build/src/version.js
CHANGED
|
@@ -4,17 +4,19 @@ exports.googleAdsVersion = void 0;
|
|
|
4
4
|
/*
|
|
5
5
|
How to upgrade google ads version:
|
|
6
6
|
1. Update google-ads-node & publish to NPM. Check that package for instructions.
|
|
7
|
-
2. Update google-ads-node & google-gax in package.json. google-gax
|
|
7
|
+
2. Update google-ads-node & google-gax in package.json. google-gax must be the same version as google-ads-node,
|
|
8
|
+
Otherwise you are likely to get a `TypeError: Channel credentials must be a ChannelCredentials object` error.
|
|
8
9
|
3. Update the version in this file
|
|
9
10
|
4. Update the versions in src/protos/index.ts
|
|
10
11
|
5. Run `yarn compile` to update the generated files.
|
|
11
12
|
The `tsc` command might fail -- if so, temporarily add @ts-nocheck
|
|
12
13
|
to the top of problematic files so that the compile script can continue.
|
|
13
14
|
After the compile script has run, those @ts-nocheck lines should no longer be required.
|
|
15
|
+
The compile step depends on some environment variables being set (see scripts/fields.ts), so make sure to set those.
|
|
14
16
|
6. Prettify the generated files so the the diffs are easier to read.
|
|
15
17
|
7. Check that the diffs are expected and that the generated files are correct. New Gads versions will often add new services, fields, and enums.
|
|
16
18
|
8. Test with `yarn test`
|
|
17
19
|
9. Test by linking to a real project and making some real requests.
|
|
18
20
|
10. Once confident, bump the major version & publish to NPM.
|
|
19
21
|
*/
|
|
20
|
-
exports.googleAdsVersion = "
|
|
22
|
+
exports.googleAdsVersion = "v17";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "google-ads-api",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "17.0.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",
|
|
@@ -18,13 +18,14 @@
|
|
|
18
18
|
"license": "MIT",
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@isaacs/ttlcache": "^1.2.2",
|
|
21
|
-
"google-ads-node": "^
|
|
21
|
+
"google-ads-node": "^14.0.0-beta.1",
|
|
22
22
|
"google-auth-library": "^7.1.0",
|
|
23
|
-
"google-gax": "^4.
|
|
23
|
+
"google-gax": "^4.4.1",
|
|
24
24
|
"long": "^4.0.0"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@types/jest": "^29.0.1",
|
|
28
|
+
"@types/node": "^22.5.4",
|
|
28
29
|
"@types/pluralize": "^0.0.29",
|
|
29
30
|
"@typescript-eslint/eslint-plugin": "^4.8.2",
|
|
30
31
|
"@typescript-eslint/parser": "^4.8.2",
|
|
@@ -32,7 +33,7 @@
|
|
|
32
33
|
"jest": "^29.0.3",
|
|
33
34
|
"pluralize": "^8.0.0",
|
|
34
35
|
"ts-jest": "^29.0.0",
|
|
35
|
-
"typescript": "^
|
|
36
|
+
"typescript": "^5.5.4"
|
|
36
37
|
},
|
|
37
38
|
"keywords": [
|
|
38
39
|
"google ads",
|