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.
@@ -1,11 +1,11 @@
1
1
  import { errors, services } from "./protos";
2
2
  import { CustomerCredentials, MutateOperation, ReportOptions, RequestOptions, MutateOptions } from "./types";
3
- export declare type BaseRequestHookArgs = {
3
+ export type BaseRequestHookArgs = {
4
4
  credentials: CustomerCredentials;
5
5
  query: string;
6
6
  reportOptions?: ReportOptions;
7
7
  };
8
- export declare type BaseMutationHookArgs = {
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 declare type BaseServiceHookArgs = {
19
+ export type BaseServiceHookArgs = {
20
20
  credentials: CustomerCredentials;
21
21
  method: `${keyof typeof services}.${string}`;
22
22
  requestOptions: any;
23
23
  };
24
- declare type StartHookArgs<T = RequestOptions | MutateOptions | any, A = void> = {
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
- declare type ErrorHookArgs = {
28
+ type ErrorHookArgs = {
29
29
  error: errors.GoogleAdsFailure | Error;
30
30
  };
31
- declare type EndHookArgs<T = services.IGoogleAdsRow[] | services.MutateGoogleAdsResponse> = {
31
+ type EndHookArgs<T = services.IGoogleAdsRow[] | services.MutateGoogleAdsResponse> = {
32
32
  response?: T;
33
33
  resolve: (args: any) => void;
34
34
  };
35
- declare type HookArgs = StartHookArgs | ErrorHookArgs | EndHookArgs;
36
- declare type RequestHook<H extends HookArgs> = (a: BaseRequestHookArgs & H) => void;
37
- declare type MutationHook<H extends HookArgs> = (a: BaseMutationHookArgs & H) => void;
38
- declare type ServiceHook<H extends HookArgs> = (a: BaseServiceHookArgs & H) => void;
39
- export declare type OnQueryStart = RequestHook<StartHookArgs<RequestOptions, any>>;
40
- export declare type OnQueryError = RequestHook<ErrorHookArgs>;
41
- export declare type OnQueryEnd = RequestHook<EndHookArgs<services.IGoogleAdsRow[]>>;
42
- export declare type OnStreamStart = RequestHook<StartHookArgs<RequestOptions, void>>;
43
- export declare type OnStreamError = RequestHook<ErrorHookArgs>;
44
- export declare type OnMutationStart = MutationHook<StartHookArgs<MutateOptions, any>>;
45
- export declare type OnMutationError = MutationHook<ErrorHookArgs>;
46
- export declare type OnMutationEnd = MutationHook<EndHookArgs<services.MutateGoogleAdsResponse>>;
47
- export declare type OnServiceStart = ServiceHook<StartHookArgs<any, any>>;
48
- export declare type OnServiceError = ServiceHook<ErrorHookArgs>;
49
- export declare type OnServiceEnd = ServiceHook<EndHookArgs<any>>;
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 declare type HookedCancellation = {
152
+ export type HookedCancellation = {
153
153
  cancelled: boolean;
154
154
  res?: any;
155
155
  };
156
- export declare type HookedResolution = {
156
+ export type HookedResolution = {
157
157
  resolved: boolean;
158
158
  res?: any;
159
159
  };
@@ -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.parseRows = exports.getReportOptionFields = exports.getGAQLFields = exports.parse = exports.ParsingError = void 0;
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;