google-ads-api 14.1.0 → 16.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.
@@ -1,10 +1,10 @@
1
1
  import allProtos, { protos } from "google-ads-node";
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;
2
+ export declare const VERSION: "v16";
3
+ export import common = protos.google.ads.googleads.v16.common;
4
+ export import errors = protos.google.ads.googleads.v16.errors;
5
+ export import resources = protos.google.ads.googleads.v16.resources;
6
+ export import services = protos.google.ads.googleads.v16.services;
7
+ export import internalEnums = protos.google.ads.googleads.v16.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.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;
10
+ exports.common = google_ads_node_1.protos.google.ads.googleads.v16.common;
11
+ exports.errors = google_ads_node_1.protos.google.ads.googleads.v16.errors;
12
+ exports.resources = google_ads_node_1.protos.google.ads.googleads.v16.resources;
13
+ exports.services = google_ads_node_1.protos.google.ads.googleads.v16.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.v14.enums;
15
+ exports.internalEnums = google_ads_node_1.protos.google.ads.googleads.v16.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");
@@ -123,12 +123,20 @@ class Service {
123
123
  buildMutationRequestAndService(mutations, options) {
124
124
  const service = this.loadService("GoogleAdsServiceClient");
125
125
  const mutateOperations = mutations.map((mutation) => {
126
- var _a;
126
+ var _a, _b;
127
127
  const opKey = (0, utils_1.toSnakeCase)(`${mutation.entity}Operation`);
128
128
  const operation = {
129
129
  [(_a = mutation.operation) !== null && _a !== void 0 ? _a : "create"]: mutation.resource,
130
130
  };
131
- if (mutation.operation === "update") {
131
+ if (mutation.operation === "create" &&
132
+ (
133
+ //@ts-ignore
134
+ (_b = mutation === null || mutation === void 0 ? void 0 : mutation.exempt_policy_violation_keys) === null || _b === void 0 ? void 0 : _b.length)) {
135
+ //@ts-ignore
136
+ operation.exempt_policy_violation_keys =
137
+ mutation.exempt_policy_violation_keys;
138
+ }
139
+ else if (mutation.operation === "update") {
132
140
  // @ts-expect-error Resource operations should have updateMask defined
133
141
  operation.update_mask = (0, utils_1.getFieldMask)(mutation.resource);
134
142
  }
@@ -146,11 +154,19 @@ class Service {
146
154
  }
147
155
  buildOperations(type, entities, message) {
148
156
  const ops = entities.map((e) => {
157
+ var _a;
149
158
  const op = {
150
159
  [type]: e,
151
160
  operation: type,
152
161
  };
153
- if (type === "update") {
162
+ //@ts-ignore
163
+ if (type === "create" && ((_a = e === null || e === void 0 ? void 0 : e.exempt_policy_violation_keys) === null || _a === void 0 ? void 0 : _a.length)) {
164
+ // @ts-expect-error Field required for policy violation exemptions
165
+ op.exempt_policy_violation_keys = e.exempt_policy_violation_keys;
166
+ //@ts-ignore
167
+ delete e.exempt_policy_violation_keys;
168
+ }
169
+ else if (type === "update") {
154
170
  // @ts-expect-error Field required for updates
155
171
  op.update_mask = (0, utils_1.getFieldMask)(
156
172
  // @ts-expect-error Message types have a toObject method
@@ -53,5 +53,6 @@ export declare type MutateOperation<T> = {
53
53
  resource: T;
54
54
  entity: fields.Resource;
55
55
  operation?: "create" | "update" | "remove";
56
+ exempt_policy_violation_keys?: services.AdGroupCriterionOperation["exempt_policy_violation_keys"];
56
57
  } & Partial<Omit<T, "toJSON">>;
57
58
  export declare type PageToken = services.ISearchGoogleAdsResponse["next_page_token"];
@@ -1 +1 @@
1
- export declare const googleAdsVersion = "v14";
1
+ export declare const googleAdsVersion = "v16";
@@ -1,4 +1,20 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.googleAdsVersion = void 0;
4
- exports.googleAdsVersion = "v14";
4
+ /*
5
+ How to upgrade google ads version:
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 should be the same version as google-ads-node.
8
+ 3. Update the version in this file
9
+ 4. Update the versions in src/protos/index.ts
10
+ 5. Run `yarn compile` to update the generated files.
11
+ The `tsc` command might fail -- if so, temporarily add @ts-nocheck
12
+ to the top of problematic files so that the compile script can continue.
13
+ After the compile script has run, those @ts-nocheck lines should no longer be required.
14
+ 6. Prettify the generated files so the the diffs are easier to read.
15
+ 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
+ 8. Test with `yarn test`
17
+ 9. Test by linking to a real project and making some real requests.
18
+ 10. Once confident, bump the major version & publish to NPM.
19
+ */
20
+ exports.googleAdsVersion = "v16";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "google-ads-api",
3
- "version": "14.1.0",
3
+ "version": "16.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",
@@ -18,9 +18,9 @@
18
18
  "license": "MIT",
19
19
  "dependencies": {
20
20
  "@isaacs/ttlcache": "^1.2.2",
21
- "google-ads-node": "^12.0.2",
21
+ "google-ads-node": "^13.0.0",
22
22
  "google-auth-library": "^7.1.0",
23
- "google-gax": "^4.0.3",
23
+ "google-gax": "^4.3.1",
24
24
  "long": "^4.0.0"
25
25
  },
26
26
  "devDependencies": {