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
package/build/src/hooks.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { errors, services } from "./protos";
|
|
2
2
|
import { CustomerCredentials, MutateOperation, ReportOptions, RequestOptions, MutateOptions } from "./types";
|
|
3
|
-
export
|
|
3
|
+
export type BaseRequestHookArgs = {
|
|
4
4
|
credentials: CustomerCredentials;
|
|
5
5
|
query: string;
|
|
6
6
|
reportOptions?: ReportOptions;
|
|
7
7
|
};
|
|
8
|
-
export
|
|
8
|
+
export type BaseMutationHookArgs = {
|
|
9
9
|
credentials: CustomerCredentials;
|
|
10
10
|
method: `${keyof typeof services}.${string}`;
|
|
11
11
|
} & (// Mutation was executed with customer.mutateResources
|
|
@@ -16,37 +16,37 @@ export declare type BaseMutationHookArgs = {
|
|
|
16
16
|
mutation: any;
|
|
17
17
|
isServiceCall: true;
|
|
18
18
|
});
|
|
19
|
-
export
|
|
19
|
+
export type BaseServiceHookArgs = {
|
|
20
20
|
credentials: CustomerCredentials;
|
|
21
21
|
method: `${keyof typeof services}.${string}`;
|
|
22
22
|
requestOptions: any;
|
|
23
23
|
};
|
|
24
|
-
|
|
24
|
+
type StartHookArgs<T = RequestOptions | MutateOptions | any, A = void> = {
|
|
25
25
|
cancel: A extends void ? () => void : (args?: A) => void;
|
|
26
26
|
editOptions: (options: Partial<T>) => void;
|
|
27
27
|
};
|
|
28
|
-
|
|
28
|
+
type ErrorHookArgs = {
|
|
29
29
|
error: errors.GoogleAdsFailure | Error;
|
|
30
30
|
};
|
|
31
|
-
|
|
31
|
+
type EndHookArgs<T = services.IGoogleAdsRow[] | services.MutateGoogleAdsResponse> = {
|
|
32
32
|
response?: T;
|
|
33
33
|
resolve: (args: any) => void;
|
|
34
34
|
};
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
export
|
|
40
|
-
export
|
|
41
|
-
export
|
|
42
|
-
export
|
|
43
|
-
export
|
|
44
|
-
export
|
|
45
|
-
export
|
|
46
|
-
export
|
|
47
|
-
export
|
|
48
|
-
export
|
|
49
|
-
export
|
|
35
|
+
type HookArgs = StartHookArgs | ErrorHookArgs | EndHookArgs;
|
|
36
|
+
type RequestHook<H extends HookArgs> = (a: BaseRequestHookArgs & H) => void;
|
|
37
|
+
type MutationHook<H extends HookArgs> = (a: BaseMutationHookArgs & H) => void;
|
|
38
|
+
type ServiceHook<H extends HookArgs> = (a: BaseServiceHookArgs & H) => void;
|
|
39
|
+
export type OnQueryStart = RequestHook<StartHookArgs<RequestOptions, any>>;
|
|
40
|
+
export type OnQueryError = RequestHook<ErrorHookArgs>;
|
|
41
|
+
export type OnQueryEnd = RequestHook<EndHookArgs<services.IGoogleAdsRow[]>>;
|
|
42
|
+
export type OnStreamStart = RequestHook<StartHookArgs<RequestOptions, void>>;
|
|
43
|
+
export type OnStreamError = RequestHook<ErrorHookArgs>;
|
|
44
|
+
export type OnMutationStart = MutationHook<StartHookArgs<MutateOptions, any>>;
|
|
45
|
+
export type OnMutationError = MutationHook<ErrorHookArgs>;
|
|
46
|
+
export type OnMutationEnd = MutationHook<EndHookArgs<services.MutateGoogleAdsResponse>>;
|
|
47
|
+
export type OnServiceStart = ServiceHook<StartHookArgs<any, any>>;
|
|
48
|
+
export type OnServiceError = ServiceHook<ErrorHookArgs>;
|
|
49
|
+
export type OnServiceEnd = ServiceHook<EndHookArgs<any>>;
|
|
50
50
|
export interface Hooks {
|
|
51
51
|
/**
|
|
52
52
|
* @description Hook called before execution of a query in the `query` and `report` methods
|
|
@@ -149,11 +149,11 @@ export interface Hooks {
|
|
|
149
149
|
*/
|
|
150
150
|
onServiceEnd?: OnServiceEnd;
|
|
151
151
|
}
|
|
152
|
-
export
|
|
152
|
+
export type HookedCancellation = {
|
|
153
153
|
cancelled: boolean;
|
|
154
154
|
res?: any;
|
|
155
155
|
};
|
|
156
|
-
export
|
|
156
|
+
export type HookedResolution = {
|
|
157
157
|
resolved: boolean;
|
|
158
158
|
res?: any;
|
|
159
159
|
};
|
package/build/src/parser.js
CHANGED
|
@@ -3,7 +3,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.ParsingError = void 0;
|
|
7
|
+
exports.parse = parse;
|
|
8
|
+
exports.getGAQLFields = getGAQLFields;
|
|
9
|
+
exports.getReportOptionFields = getReportOptionFields;
|
|
10
|
+
exports.parseRows = parseRows;
|
|
7
11
|
const long_1 = __importDefault(require("long"));
|
|
8
12
|
const protos_1 = require("./protos");
|
|
9
13
|
const utils_1 = require("./utils");
|
|
@@ -35,7 +39,6 @@ function parse({ results, reportOptions, gaqlString, }) {
|
|
|
35
39
|
const allFields = [...queryFields, ...resourceNameFields];
|
|
36
40
|
return parseRows(results, allFields);
|
|
37
41
|
}
|
|
38
|
-
exports.parse = parse;
|
|
39
42
|
// This function assumes that a gaql query is of the format "select * * * from * ...".
|
|
40
43
|
// Queries that are not in this format should have thrown an error when called.
|
|
41
44
|
function getGAQLFields(gaqlString) {
|
|
@@ -50,7 +53,6 @@ function getGAQLFields(gaqlString) {
|
|
|
50
53
|
}
|
|
51
54
|
return fields;
|
|
52
55
|
}
|
|
53
|
-
exports.getGAQLFields = getGAQLFields;
|
|
54
56
|
function getReportOptionFields(reportOptions) {
|
|
55
57
|
const fields = [
|
|
56
58
|
...(reportOptions.attributes || []),
|
|
@@ -62,7 +64,6 @@ function getReportOptionFields(reportOptions) {
|
|
|
62
64
|
}
|
|
63
65
|
return fields;
|
|
64
66
|
}
|
|
65
|
-
exports.getReportOptionFields = getReportOptionFields;
|
|
66
67
|
function parseRows(rows, fields) {
|
|
67
68
|
const fieldsPreSplit = {};
|
|
68
69
|
// pre-split all the field strings for performance reasons (increases speed by ~5x for large number of rows)
|
|
@@ -86,7 +87,6 @@ function parseRows(rows, fields) {
|
|
|
86
87
|
}
|
|
87
88
|
return newRows;
|
|
88
89
|
}
|
|
89
|
-
exports.parseRows = parseRows;
|
|
90
90
|
function parseNestedValues(row, data, field, paths) {
|
|
91
91
|
if (!data)
|
|
92
92
|
return null;
|