@pomeloanalytics/api 0.1.0-beta.4 → 0.1.0-beta.6
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/CHANGELOG.md +22 -0
- package/README.md +16 -0
- package/dist/client.d.ts +10 -1
- package/dist/client.js +7 -1
- package/dist/generated/openapi.d.ts +345 -14
- package/dist/index.d.ts +1 -1
- package/dist/transport.d.ts +2 -0
- package/dist/transport.js +21 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.1.0-beta.6
|
|
4
|
+
|
|
5
|
+
- Add paginated lists. `reports.content`, `reports.acquisition` and
|
|
6
|
+
`metrics.breakdown` accept `list`, `listLimit`, `offset`, `sort`, `order` and
|
|
7
|
+
`search`; the page is `current.lists.<list>` (`rows`, `next_offset`,
|
|
8
|
+
`total_rows`, `totals`, `other`), or `page` on a breakdown. `other` is `null`
|
|
9
|
+
(under 10) when a hidden part of 1 to 9 is all that is left, never `0`.
|
|
10
|
+
Additive: without `list`, responses are unchanged.
|
|
11
|
+
|
|
12
|
+
## 0.1.0-beta.5
|
|
13
|
+
|
|
14
|
+
- **Type break.** `quotas` of `/v1/me`, and `meta.usage` and `meta.billable_overage`
|
|
15
|
+
of metered responses, are now optional: an API token limited to followed
|
|
16
|
+
workspaces does not receive the organization's consumption. Narrow them
|
|
17
|
+
before use (`data.quotas?.used_units`). Unrestricted tokens still receive them.
|
|
18
|
+
- Add `pomelo.tenants.write(body, options?)` for `POST /v1/tenants` (scope
|
|
19
|
+
`tenants:write`, never restricted to some tenants): additive, idempotent
|
|
20
|
+
registration of up to 100 tenants of a site. New types `TenantsWriteBody` and
|
|
21
|
+
`TenantsWriteData`; the body keeps wire field names.
|
|
22
|
+
- The client sends one JSON POST for this operation; every other operation
|
|
23
|
+
remains a single GET.
|
|
24
|
+
|
|
3
25
|
## 0.1.0-beta.4
|
|
4
26
|
|
|
5
27
|
- Sync the reviewed public contract for a single audience measurement and the
|
package/README.md
CHANGED
|
@@ -88,6 +88,7 @@ The default timeout is 30 seconds and covers reading the response body.
|
|
|
88
88
|
| `pomelo.me(options?)` | `/v1/me` |
|
|
89
89
|
| `pomelo.sites.list(options?)` | `/v1/sites` |
|
|
90
90
|
| `pomelo.tenants.list(params, options?)` | `/v1/tenants` |
|
|
91
|
+
| `pomelo.tenants.write(body, options?)` | `POST /v1/tenants` |
|
|
91
92
|
| `pomelo.metrics.timeseries(params, options?)` | `/v1/metrics/timeseries` |
|
|
92
93
|
| `pomelo.metrics.breakdown(params, options?)` | `/v1/metrics/breakdown` |
|
|
93
94
|
| `pomelo.reports.overview(params, options?)` | `/v1/reports/overview` |
|
|
@@ -99,6 +100,15 @@ The default timeout is 30 seconds and covers reading the response body.
|
|
|
99
100
|
| `pomelo.usage.current(options?)` | `/v1/usage/current` |
|
|
100
101
|
| `pomelo.usage.history(params?, options?)` | `/v1/usage/history` |
|
|
101
102
|
|
|
103
|
+
`tenants.write` is the only operation that is not a GET. It needs a token with the
|
|
104
|
+
dedicated `tenants:write` scope (never restricted to some tenants), takes the
|
|
105
|
+
wire body (`{ site_id, tenants: [{ tenant_id, tenant_slug, tenant_name, status? }] }`,
|
|
106
|
+
at most 100 tenants) and is additive and idempotent.
|
|
107
|
+
|
|
108
|
+
A token restricted to followed workspaces does not see the organization's
|
|
109
|
+
consumption: `/v1/me` has no `quotas`, and `meta.usage` and `meta.billable_overage`
|
|
110
|
+
are absent from metered responses. Treat them as optional.
|
|
111
|
+
|
|
102
112
|
Parameters use camelCase (`siteId`, `tenantId`, `actionFamily`, `actionKey`) and map
|
|
103
113
|
to the API's exact wire names. Other names, such as `from`, `to`, `metric`, and
|
|
104
114
|
`include`, are unchanged. `filters` is a JSON string, as defined by the API.
|
|
@@ -109,6 +119,12 @@ The server owns defaults, period validation, entitlements, and numeric limits;
|
|
|
109
119
|
the SDK does not choose content depth, clamp limits, or change a requested range.
|
|
110
120
|
Content `include` accepts `summary` or `full`.
|
|
111
121
|
|
|
122
|
+
Lists are read page by page with `list`, `limit` or `listLimit`, `offset`, `sort`,
|
|
123
|
+
`order` and `search` on `reports.content`, `reports.acquisition` and
|
|
124
|
+
`metrics.breakdown`. The page is in `current.lists.<list>` (`rows`, `next_offset`,
|
|
125
|
+
`total_rows`, `totals`, `other`); a count of 1 to 9 on a protected list is `null`
|
|
126
|
+
(under 10), never zero. Follow `next_offset` until it is `null`.
|
|
127
|
+
|
|
112
128
|
Full Content responses can include `current.metric_method` and
|
|
113
129
|
`current.pages[].performance.n_lcp`, `n_fcp`, `n_inp`, `n_cls` and `n_ttfb`.
|
|
114
130
|
These optional fields identify the selected measurement method and each metric's
|
package/dist/client.d.ts
CHANGED
|
@@ -9,6 +9,9 @@ export type ApiParams<Path extends ApiPath> = [WireParams<Path>] extends [never]
|
|
|
9
9
|
[Key in keyof WireParams<Path> as Key extends string ? CamelCase<Key> : never]: WireParams<Path>[Key];
|
|
10
10
|
};
|
|
11
11
|
export type TenantsParams = ApiParams<'/v1/tenants'>;
|
|
12
|
+
/** Body of `POST /v1/tenants`: wire field names (`site_id`, `tenant_slug`, ...). */
|
|
13
|
+
export type TenantsWriteBody = paths['/v1/tenants']['post']['requestBody']['content']['application/json'];
|
|
14
|
+
export type TenantsWriteData = paths['/v1/tenants']['post']['responses'][200]['content']['application/json'];
|
|
12
15
|
export type TimeseriesParams = ApiParams<'/v1/metrics/timeseries'>;
|
|
13
16
|
export type BreakdownParams = ApiParams<'/v1/metrics/breakdown'>;
|
|
14
17
|
export type OverviewParams = ApiParams<'/v1/reports/overview'>;
|
|
@@ -18,7 +21,7 @@ export type ActionsParams = ApiParams<'/v1/reports/actions'>;
|
|
|
18
21
|
export type GoalsParams = ApiParams<'/v1/goals'>;
|
|
19
22
|
export type GoalConversionsParams = ApiParams<'/v1/goals/conversions'>;
|
|
20
23
|
export type UsageHistoryParams = ApiParams<'/v1/usage/history'>;
|
|
21
|
-
/** Server-side API client. Each operation performs exactly one GET
|
|
24
|
+
/** Server-side API client. Each operation performs exactly one request: GET, except `tenants.write` (POST). */
|
|
22
25
|
export declare class PomeloClient {
|
|
23
26
|
#private;
|
|
24
27
|
constructor(options: PomeloClientOptions);
|
|
@@ -28,6 +31,12 @@ export declare class PomeloClient {
|
|
|
28
31
|
};
|
|
29
32
|
readonly tenants: {
|
|
30
33
|
list: (params: TenantsParams, options?: RequestOptions) => Promise<ApiResponse<ApiData<"/v1/tenants">>>;
|
|
34
|
+
/**
|
|
35
|
+
* Registers or updates tenants of a site (additive, idempotent). Requires a token
|
|
36
|
+
* with the `tenants:write` scope, which cannot be restricted to some tenants.
|
|
37
|
+
* The body keeps the wire field names of the public contract.
|
|
38
|
+
*/
|
|
39
|
+
write: (body: TenantsWriteBody, options?: RequestOptions) => Promise<ApiResponse<TenantsWriteData>>;
|
|
31
40
|
};
|
|
32
41
|
readonly metrics: {
|
|
33
42
|
timeseries: (params: TimeseriesParams, options?: RequestOptions) => Promise<ApiResponse<ApiData<"/v1/metrics/timeseries">>>;
|
package/dist/client.js
CHANGED
|
@@ -10,7 +10,7 @@ function wireQuery(params) {
|
|
|
10
10
|
}
|
|
11
11
|
return query;
|
|
12
12
|
}
|
|
13
|
-
/** Server-side API client. Each operation performs exactly one GET
|
|
13
|
+
/** Server-side API client. Each operation performs exactly one request: GET, except `tenants.write` (POST). */
|
|
14
14
|
export class PomeloClient {
|
|
15
15
|
#transport;
|
|
16
16
|
constructor(options) {
|
|
@@ -22,6 +22,12 @@ export class PomeloClient {
|
|
|
22
22
|
};
|
|
23
23
|
tenants = {
|
|
24
24
|
list: (params, options) => this.#transport.get('/v1/tenants', wireQuery(params), options),
|
|
25
|
+
/**
|
|
26
|
+
* Registers or updates tenants of a site (additive, idempotent). Requires a token
|
|
27
|
+
* with the `tenants:write` scope, which cannot be restricted to some tenants.
|
|
28
|
+
* The body keeps the wire field names of the public contract.
|
|
29
|
+
*/
|
|
30
|
+
write: (body, options) => this.#transport.post('/v1/tenants', body, options),
|
|
25
31
|
};
|
|
26
32
|
metrics = {
|
|
27
33
|
timeseries: (params, options) => this.#transport.get('/v1/metrics/timeseries', wireQuery(params), options),
|
|
@@ -179,7 +179,7 @@ export interface paths {
|
|
|
179
179
|
/**
|
|
180
180
|
* @description Grouping dimension for breakdown endpoint.
|
|
181
181
|
* When `dimension=tenant`, rows are grouped by stable `tenant_id`. The
|
|
182
|
-
* statistics of a tenant are those of the page's
|
|
182
|
+
* statistics of a tenant are those of the page's tracked space. The
|
|
183
183
|
* response also includes `tenant_slug` and `tenant_name` as display labels.
|
|
184
184
|
*/
|
|
185
185
|
dimension?: components["parameters"]["BreakdownDimension"];
|
|
@@ -192,6 +192,22 @@ export interface paths {
|
|
|
192
192
|
from?: components["parameters"]["FromDate"];
|
|
193
193
|
/** @description Number of rows returned by breakdown endpoint. */
|
|
194
194
|
limit?: components["parameters"]["BreakdownLimit"];
|
|
195
|
+
/**
|
|
196
|
+
* @description Reads the breakdown as the paginated list of its dimension (`device`:
|
|
197
|
+
* `devices`, `referrer`: `referrers`, `page`: `pages`, `browser`:
|
|
198
|
+
* `browsers`, `os`: `systems`, `country`: `countries`). Whole site, no
|
|
199
|
+
* `filters` and no `tenant_id`. `rows[].value` is the main measure of the
|
|
200
|
+
* list (pageviews for `pages`, visits for the others); a `metric` other
|
|
201
|
+
* than `pageviews` for `pages` or `sessions` for the others is refused and `page` carries `next_offset`, `total_rows`, `totals` and
|
|
202
|
+
* `other`.
|
|
203
|
+
*/
|
|
204
|
+
list?: components["parameters"]["BreakdownListParam"];
|
|
205
|
+
/**
|
|
206
|
+
* @description Page size of `list`, when it is not `limit`. Without it `limit` is the
|
|
207
|
+
* page size (25 when `limit` is absent too); `offset + page size` is at
|
|
208
|
+
* most 10 000.
|
|
209
|
+
*/
|
|
210
|
+
list_limit?: components["parameters"]["ListPageSize"];
|
|
195
211
|
/**
|
|
196
212
|
* @description Metric to aggregate (default `pageviews`). `sessions` uses the same
|
|
197
213
|
* visit model as the dashboard: a `visit_id` starts from the
|
|
@@ -199,7 +215,22 @@ export interface paths {
|
|
|
199
215
|
* inactivity.
|
|
200
216
|
*/
|
|
201
217
|
metric?: components["parameters"]["Metric"];
|
|
218
|
+
/** @description Rank of the first row of the page of `list`. */
|
|
219
|
+
offset?: components["parameters"]["ListOffset"];
|
|
220
|
+
/** @description Order of `sort` (`desc` for a measure, `asc` for `value`). */
|
|
221
|
+
order?: components["parameters"]["ListOrder"];
|
|
222
|
+
/**
|
|
223
|
+
* @description Rows of `list` whose value (path, domain, name) or title contains the
|
|
224
|
+
* text, case-insensitive, accents significant. A value under ten visits
|
|
225
|
+
* that the list hides is never found. `other` is null with a search.
|
|
226
|
+
*/
|
|
227
|
+
search?: components["parameters"]["ListSearch"];
|
|
202
228
|
site_id: components["parameters"]["SiteId"];
|
|
229
|
+
/**
|
|
230
|
+
* @description Sort of `list`: one of its measures or `value` (alphabetical). The
|
|
231
|
+
* default is its main measure, descending, ties broken by the value.
|
|
232
|
+
*/
|
|
233
|
+
sort?: components["parameters"]["ListSort"];
|
|
203
234
|
/**
|
|
204
235
|
* @description Stable tenant identifier. Use this for tenant-scoped analytics and
|
|
205
236
|
* tenant-scoped access control. `site_id` identifies the shared product,
|
|
@@ -385,7 +416,37 @@ export interface paths {
|
|
|
385
416
|
include?: components["parameters"]["ReportInclude"];
|
|
386
417
|
/** @description Number of rows returned by top lists for report endpoints. */
|
|
387
418
|
limit?: components["parameters"]["ReportLimit"];
|
|
419
|
+
/**
|
|
420
|
+
* @description A list of the report read page by page (see Pagination). Content serves
|
|
421
|
+
* `pages`, `entry_pages` and `exit_pages`; Acquisition serves
|
|
422
|
+
* `landing_pages`, `referrers` and the Campagnes lists. The page is
|
|
423
|
+
* returned in `current.lists.<list>` next to the report, which keeps its
|
|
424
|
+
* own arrays. Needs `include=full` (the default when `list` is given);
|
|
425
|
+
* not served with a client space (`tenant_id`).
|
|
426
|
+
*/
|
|
427
|
+
list?: components["parameters"]["ListParam"];
|
|
428
|
+
/**
|
|
429
|
+
* @description Page size of `list`, when it is not `limit`. Without it `limit` is the
|
|
430
|
+
* page size (25 when `limit` is absent too); `offset + page size` is at
|
|
431
|
+
* most 10 000.
|
|
432
|
+
*/
|
|
433
|
+
list_limit?: components["parameters"]["ListPageSize"];
|
|
434
|
+
/** @description Rank of the first row of the page of `list`. */
|
|
435
|
+
offset?: components["parameters"]["ListOffset"];
|
|
436
|
+
/** @description Order of `sort` (`desc` for a measure, `asc` for `value`). */
|
|
437
|
+
order?: components["parameters"]["ListOrder"];
|
|
438
|
+
/**
|
|
439
|
+
* @description Rows of `list` whose value (path, domain, name) or title contains the
|
|
440
|
+
* text, case-insensitive, accents significant. A value under ten visits
|
|
441
|
+
* that the list hides is never found. `other` is null with a search.
|
|
442
|
+
*/
|
|
443
|
+
search?: components["parameters"]["ListSearch"];
|
|
388
444
|
site_id: components["parameters"]["SiteId"];
|
|
445
|
+
/**
|
|
446
|
+
* @description Sort of `list`: one of its measures or `value` (alphabetical). The
|
|
447
|
+
* default is its main measure, descending, ties broken by the value.
|
|
448
|
+
*/
|
|
449
|
+
sort?: components["parameters"]["ListSort"];
|
|
389
450
|
/**
|
|
390
451
|
* @description Stable tenant identifier. Use this for tenant-scoped analytics and
|
|
391
452
|
* tenant-scoped access control. `site_id` identifies the shared product,
|
|
@@ -555,7 +616,37 @@ export interface paths {
|
|
|
555
616
|
include?: components["parameters"]["ContentInclude"];
|
|
556
617
|
/** @description Number of rows returned by top lists for report endpoints. */
|
|
557
618
|
limit?: components["parameters"]["ReportLimit"];
|
|
619
|
+
/**
|
|
620
|
+
* @description A list of the report read page by page (see Pagination). Content serves
|
|
621
|
+
* `pages`, `entry_pages` and `exit_pages`; Acquisition serves
|
|
622
|
+
* `landing_pages`, `referrers` and the Campagnes lists. The page is
|
|
623
|
+
* returned in `current.lists.<list>` next to the report, which keeps its
|
|
624
|
+
* own arrays. Needs `include=full` (the default when `list` is given);
|
|
625
|
+
* not served with a client space (`tenant_id`).
|
|
626
|
+
*/
|
|
627
|
+
list?: components["parameters"]["ListParam"];
|
|
628
|
+
/**
|
|
629
|
+
* @description Page size of `list`, when it is not `limit`. Without it `limit` is the
|
|
630
|
+
* page size (25 when `limit` is absent too); `offset + page size` is at
|
|
631
|
+
* most 10 000.
|
|
632
|
+
*/
|
|
633
|
+
list_limit?: components["parameters"]["ListPageSize"];
|
|
634
|
+
/** @description Rank of the first row of the page of `list`. */
|
|
635
|
+
offset?: components["parameters"]["ListOffset"];
|
|
636
|
+
/** @description Order of `sort` (`desc` for a measure, `asc` for `value`). */
|
|
637
|
+
order?: components["parameters"]["ListOrder"];
|
|
638
|
+
/**
|
|
639
|
+
* @description Rows of `list` whose value (path, domain, name) or title contains the
|
|
640
|
+
* text, case-insensitive, accents significant. A value under ten visits
|
|
641
|
+
* that the list hides is never found. `other` is null with a search.
|
|
642
|
+
*/
|
|
643
|
+
search?: components["parameters"]["ListSearch"];
|
|
558
644
|
site_id: components["parameters"]["SiteId"];
|
|
645
|
+
/**
|
|
646
|
+
* @description Sort of `list`: one of its measures or `value` (alphabetical). The
|
|
647
|
+
* default is its main measure, descending, ties broken by the value.
|
|
648
|
+
*/
|
|
649
|
+
sort?: components["parameters"]["ListSort"];
|
|
559
650
|
/**
|
|
560
651
|
* @description Stable tenant identifier. Use this for tenant-scoped analytics and
|
|
561
652
|
* tenant-scoped access control. `site_id` identifies the shared product,
|
|
@@ -764,7 +855,65 @@ export interface paths {
|
|
|
764
855
|
};
|
|
765
856
|
};
|
|
766
857
|
put?: never;
|
|
767
|
-
|
|
858
|
+
/**
|
|
859
|
+
* Register or update tenants of a site
|
|
860
|
+
* @description Requires the dedicated `tenants:write` scope, distinct from the read
|
|
861
|
+
* scopes; a token restricted to some tenants cannot hold it.
|
|
862
|
+
*
|
|
863
|
+
* Additive and idempotent. The listed tenants are created or updated;
|
|
864
|
+
* tenants that are not listed are never changed. Sending the same body
|
|
865
|
+
* again changes nothing (`unchanged`). A tenant is deactivated only by
|
|
866
|
+
* an explicit `status: INACTIVE`. The whole body is validated before
|
|
867
|
+
* the first write; a batch interrupted by a failure is resumed by
|
|
868
|
+
* sending it again. At most 100 tenants per request: send larger
|
|
869
|
+
* registries in several requests. A slug already used by another tenant
|
|
870
|
+
* of the site is refused with `409 TENANT_SLUG_CONFLICT`. A tenant
|
|
871
|
+
* changed by another write between the read and the write is refused with
|
|
872
|
+
* `409 TENANT_CONFLICT`: nothing is overwritten, send the request again.
|
|
873
|
+
*/
|
|
874
|
+
post: {
|
|
875
|
+
parameters: {
|
|
876
|
+
query?: never;
|
|
877
|
+
header?: {
|
|
878
|
+
/** @description Optional idempotency/request correlation identifier. */
|
|
879
|
+
"X-Request-Id"?: components["parameters"]["RequestIdHeader"];
|
|
880
|
+
};
|
|
881
|
+
path?: never;
|
|
882
|
+
cookie?: never;
|
|
883
|
+
};
|
|
884
|
+
requestBody: {
|
|
885
|
+
content: {
|
|
886
|
+
"application/json": components["schemas"]["TenantsWriteRequest"];
|
|
887
|
+
};
|
|
888
|
+
};
|
|
889
|
+
responses: {
|
|
890
|
+
/** @description OK */
|
|
891
|
+
200: {
|
|
892
|
+
headers: {
|
|
893
|
+
"X-Pomelo-Usage-Warning": components["headers"]["XPomeloUsageWarning"];
|
|
894
|
+
"X-Request-Id": components["headers"]["XRequestId"];
|
|
895
|
+
[name: string]: unknown;
|
|
896
|
+
};
|
|
897
|
+
content: {
|
|
898
|
+
"application/json": components["schemas"]["TenantsWriteResponse"];
|
|
899
|
+
};
|
|
900
|
+
};
|
|
901
|
+
401: components["responses"]["Unauthorized"];
|
|
902
|
+
403: components["responses"]["Forbidden"];
|
|
903
|
+
/** @description `TENANT_SLUG_CONFLICT`: a slug is already used by another tenant of the site. `TENANT_CONFLICT`: a tenant was changed concurrently; send the request again. */
|
|
904
|
+
409: {
|
|
905
|
+
headers: {
|
|
906
|
+
"X-Request-Id": components["headers"]["XRequestId"];
|
|
907
|
+
[name: string]: unknown;
|
|
908
|
+
};
|
|
909
|
+
content: {
|
|
910
|
+
"application/json": components["schemas"]["TenantConflictErrorResponse"];
|
|
911
|
+
};
|
|
912
|
+
};
|
|
913
|
+
422: components["responses"]["InvalidParams"];
|
|
914
|
+
429: components["responses"]["RateLimited"];
|
|
915
|
+
};
|
|
916
|
+
};
|
|
768
917
|
delete?: never;
|
|
769
918
|
options?: never;
|
|
770
919
|
head?: never;
|
|
@@ -782,6 +931,8 @@ export interface paths {
|
|
|
782
931
|
* Current billing period usage
|
|
783
932
|
* @description Requires `usage:read` scope. Tokens with `metrics:read` also
|
|
784
933
|
* have implicit access to this endpoint.
|
|
934
|
+
* A token restricted to tenants (`allowed_tenant_ids`) is refused with
|
|
935
|
+
* `403 FORBIDDEN`: it cannot read the organization's consumption.
|
|
785
936
|
*/
|
|
786
937
|
get: {
|
|
787
938
|
parameters: {
|
|
@@ -829,6 +980,8 @@ export interface paths {
|
|
|
829
980
|
* Usage history by month
|
|
830
981
|
* @description Requires `usage:read` scope. Tokens with `metrics:read` also
|
|
831
982
|
* have implicit access to this endpoint.
|
|
983
|
+
* A token restricted to tenants (`allowed_tenant_ids`) is refused with
|
|
984
|
+
* `403 FORBIDDEN`: it cannot read the organization's consumption.
|
|
832
985
|
*/
|
|
833
986
|
get: {
|
|
834
987
|
parameters: {
|
|
@@ -1066,6 +1219,16 @@ export interface components {
|
|
|
1066
1219
|
BreakdownResponse: {
|
|
1067
1220
|
availability: components["schemas"]["ReportAvailability"];
|
|
1068
1221
|
meta: components["schemas"]["MeteredMeta"];
|
|
1222
|
+
page?: components["schemas"]["ReportListPaging"];
|
|
1223
|
+
/**
|
|
1224
|
+
* @description Values of ten visits or more, except the whole-site breakdowns
|
|
1225
|
+
* exact from 1. With a filter, a client space or a raw referrer, the
|
|
1226
|
+
* values under ten visits are grouped in one last row,
|
|
1227
|
+
* `key: "(other)"`, summed before the cut to `limit`; its `value` is
|
|
1228
|
+
* exact from 10 and `null` from 1 to 9, and the row is absent when
|
|
1229
|
+
* nothing is grouped. A client that reads the rows as entities must
|
|
1230
|
+
* skip it.
|
|
1231
|
+
*/
|
|
1069
1232
|
rows: components["schemas"]["BreakdownRow"][];
|
|
1070
1233
|
};
|
|
1071
1234
|
BreakdownRow: {
|
|
@@ -1097,6 +1260,7 @@ export interface components {
|
|
|
1097
1260
|
}[];
|
|
1098
1261
|
/** @enum {string} */
|
|
1099
1262
|
include: "full";
|
|
1263
|
+
lists?: components["schemas"]["ReportLists"];
|
|
1100
1264
|
/**
|
|
1101
1265
|
* @description The only Web Vitals measurement method served.
|
|
1102
1266
|
* @enum {string}
|
|
@@ -1156,10 +1320,11 @@ export interface components {
|
|
|
1156
1320
|
* @description Dense, strictly increasing daily series in the site's time zone. It
|
|
1157
1321
|
* contains exactly one point per requested day, including zero-valued
|
|
1158
1322
|
* empty days. The
|
|
1159
|
-
* exact daily pageviews add up to the exact period total
|
|
1160
|
-
* point and `totals.pageviews` are published
|
|
1161
|
-
* from 1
|
|
1162
|
-
*
|
|
1323
|
+
* exact daily pageviews add up to the exact period total. Without
|
|
1324
|
+
* any filter, each point and `totals.pageviews` are published
|
|
1325
|
+
* exactly from 1. With a filter, a count from 1 to 9 is published
|
|
1326
|
+
* as `null` (« < 10 »; zero stays `0`), so the returned points
|
|
1327
|
+
* cannot be added up; use `totals.pageviews`.
|
|
1163
1328
|
*/
|
|
1164
1329
|
timeseries: {
|
|
1165
1330
|
/** Format: date */
|
|
@@ -1245,17 +1410,17 @@ export interface components {
|
|
|
1245
1410
|
docs_url: string;
|
|
1246
1411
|
org_id: string;
|
|
1247
1412
|
product: components["schemas"]["WorkspaceProductConfiguration"];
|
|
1248
|
-
quotas
|
|
1413
|
+
quotas?: components["schemas"]["Quotas"];
|
|
1249
1414
|
rate_limits: {
|
|
1250
1415
|
rps: number;
|
|
1251
1416
|
};
|
|
1252
1417
|
};
|
|
1253
1418
|
MeteredMeta: {
|
|
1254
|
-
billable_overage
|
|
1419
|
+
billable_overage?: boolean;
|
|
1255
1420
|
request_id: string;
|
|
1256
1421
|
surface?: components["schemas"]["SurfaceMeta"];
|
|
1257
1422
|
units_charged: number;
|
|
1258
|
-
usage
|
|
1423
|
+
usage?: components["schemas"]["UsageMeta"];
|
|
1259
1424
|
};
|
|
1260
1425
|
OverviewCurrent: {
|
|
1261
1426
|
acquisition: {
|
|
@@ -1271,39 +1436,80 @@ export interface components {
|
|
|
1271
1436
|
}[];
|
|
1272
1437
|
/**
|
|
1273
1438
|
* @description Named sources, all visits: the domains of one service under
|
|
1274
|
-
* its name, counted before the ten-visit threshold.
|
|
1439
|
+
* its name, counted before the ten-visit threshold. Outside the
|
|
1440
|
+
* whole-site view the sources under ten visits are grouped in
|
|
1441
|
+
* one last row, `source: "(other)"` of type `other`, counted as
|
|
1442
|
+
* `audience.countries`.
|
|
1275
1443
|
*/
|
|
1276
1444
|
top_referrer_sources: components["schemas"]["TopReferrerSource"][];
|
|
1445
|
+
/**
|
|
1446
|
+
* @description Raw referring domains of ten visits or more. The domains under
|
|
1447
|
+
* ten visits are grouped in one last row, `domain: "(other)"`;
|
|
1448
|
+
* its `sessions` is exact from 10 and `null` from 1 to 9, and
|
|
1449
|
+
* the row is absent when nothing is grouped.
|
|
1450
|
+
*/
|
|
1277
1451
|
top_referrers: components["schemas"]["TopReferrer"][];
|
|
1278
1452
|
};
|
|
1279
1453
|
audience: {
|
|
1454
|
+
/**
|
|
1455
|
+
* @description Browser families. Outside the whole-site view the families
|
|
1456
|
+
* under ten visits are grouped in one last row,
|
|
1457
|
+
* `browser_family: "(other)"`, counted as `countries`.
|
|
1458
|
+
*/
|
|
1280
1459
|
browsers: {
|
|
1281
1460
|
browser_family: string;
|
|
1282
1461
|
sessions: number | null;
|
|
1283
1462
|
}[];
|
|
1284
1463
|
/**
|
|
1285
|
-
* @description Cities of ten visits or more. The
|
|
1286
|
-
*
|
|
1464
|
+
* @description Cities of ten visits or more. The cities under ten visits are
|
|
1465
|
+
* grouped in one last row, `city: "(other)"` and
|
|
1466
|
+
* `country: "(other)"`; its `sessions` is exact from 10 and
|
|
1467
|
+
* `null` from 1 to 9, and the row is absent when nothing is
|
|
1468
|
+
* grouped. The city is read alone: the list is empty with a
|
|
1469
|
+
* hostname, client space, filter or segment.
|
|
1287
1470
|
*/
|
|
1288
1471
|
cities?: {
|
|
1289
1472
|
city: string;
|
|
1290
1473
|
country: string;
|
|
1291
1474
|
sessions: number | null;
|
|
1292
1475
|
}[];
|
|
1476
|
+
/**
|
|
1477
|
+
* @description Countries of ten visits or more (exact from 1 on the whole
|
|
1478
|
+
* site with no filter). Elsewhere the countries under ten visits
|
|
1479
|
+
* are grouped in one last row, `country: "(other)"`; its
|
|
1480
|
+
* `sessions` is exact from 10 and `null` from 1 to 9, and the row
|
|
1481
|
+
* is absent when nothing is grouped.
|
|
1482
|
+
*/
|
|
1293
1483
|
countries: {
|
|
1294
1484
|
country: string;
|
|
1295
1485
|
sessions: number | null;
|
|
1296
1486
|
}[];
|
|
1487
|
+
/**
|
|
1488
|
+
* @description Device types. Outside the whole-site view the types under ten
|
|
1489
|
+
* visits are grouped in one last row, `device_type: "(other)"`,
|
|
1490
|
+
* counted as `countries`; its averages are `null`.
|
|
1491
|
+
*/
|
|
1297
1492
|
devices: {
|
|
1298
1493
|
avg_pages_per_session?: number | null;
|
|
1299
1494
|
avg_session_eng_time_ms?: number | null;
|
|
1300
1495
|
device_type: string;
|
|
1301
1496
|
sessions: number | null;
|
|
1302
1497
|
}[];
|
|
1498
|
+
/**
|
|
1499
|
+
* @description Operating system families. Outside the whole-site view the
|
|
1500
|
+
* families under ten visits are grouped in one last row,
|
|
1501
|
+
* `os_family: "(other)"`, counted as `countries`.
|
|
1502
|
+
*/
|
|
1303
1503
|
os: {
|
|
1304
1504
|
os_family: string;
|
|
1305
1505
|
sessions: number | null;
|
|
1306
1506
|
}[];
|
|
1507
|
+
/**
|
|
1508
|
+
* @description Regions of ten visits or more (exact from 1 on the whole site
|
|
1509
|
+
* with no filter). Elsewhere the regions under ten visits are
|
|
1510
|
+
* grouped in one last row, `region: "(other)"` and
|
|
1511
|
+
* `country: "(other)"`, counted as `countries`.
|
|
1512
|
+
*/
|
|
1307
1513
|
regions: {
|
|
1308
1514
|
country: string;
|
|
1309
1515
|
region: string;
|
|
@@ -1452,6 +1658,42 @@ export interface components {
|
|
|
1452
1658
|
ReportAvailabilitySectionId: string;
|
|
1453
1659
|
/** @enum {string} */
|
|
1454
1660
|
ReportAvailabilityStatus: "available" | "partially_available_outside_source_coverage" | "not_available_for_requested_period";
|
|
1661
|
+
/** @description Counts by measure; `null` is "< 10". */
|
|
1662
|
+
ReportListMeasures: {
|
|
1663
|
+
[key: string]: number | null;
|
|
1664
|
+
};
|
|
1665
|
+
ReportListPage: components["schemas"]["ReportListPaging"] & {
|
|
1666
|
+
rows: components["schemas"]["ReportListRow"][];
|
|
1667
|
+
};
|
|
1668
|
+
/**
|
|
1669
|
+
* @description Paging of a list, present when `list` is given. `totals` is the total
|
|
1670
|
+
* of the whole list. `other` is `totals` minus the rows of ranks 1 to
|
|
1671
|
+
* `offset` + page size; a hidden part of 1 to 9 that would leave it at
|
|
1672
|
+
* zero is published "< 10" (`null`), never a zero; it is `null` with a
|
|
1673
|
+
* `search`. Present with `list` on `GET /v1/metrics/breakdown` as `page`.
|
|
1674
|
+
*/
|
|
1675
|
+
ReportListPaging: {
|
|
1676
|
+
/** @description Offset of the next page; null on the last one. */
|
|
1677
|
+
next_offset: number | null;
|
|
1678
|
+
other: components["schemas"]["ReportListMeasures"] | null;
|
|
1679
|
+
/**
|
|
1680
|
+
* @description Rows after masking and search; null when the head of the ranking
|
|
1681
|
+
* proves the order without counting the rest.
|
|
1682
|
+
*/
|
|
1683
|
+
total_rows: number | null;
|
|
1684
|
+
totals: components["schemas"]["ReportListMeasures"];
|
|
1685
|
+
};
|
|
1686
|
+
ReportListRow: {
|
|
1687
|
+
measures: components["schemas"]["ReportListMeasures"];
|
|
1688
|
+
previous?: components["schemas"]["ReportListMeasures"] | null;
|
|
1689
|
+
title: string | null;
|
|
1690
|
+
/** @description Path, domain or name. */
|
|
1691
|
+
value: string;
|
|
1692
|
+
};
|
|
1693
|
+
/** @description The page of the list asked by `list`, keyed by its identifier. */
|
|
1694
|
+
ReportLists: {
|
|
1695
|
+
[key: string]: components["schemas"]["ReportListPage"];
|
|
1696
|
+
};
|
|
1455
1697
|
ReportPeriodAvailability: {
|
|
1456
1698
|
/** Format: date-time */
|
|
1457
1699
|
compatibleEnd: string | null;
|
|
@@ -1488,6 +1730,7 @@ export interface components {
|
|
|
1488
1730
|
siteId: string;
|
|
1489
1731
|
/** @enum {string} */
|
|
1490
1732
|
status: "ACTIVE" | "SUSPENDED";
|
|
1733
|
+
timezone: string;
|
|
1491
1734
|
};
|
|
1492
1735
|
SiteProductConfiguration: {
|
|
1493
1736
|
api: components["schemas"]["ProductApi"];
|
|
@@ -1559,7 +1802,7 @@ export interface components {
|
|
|
1559
1802
|
compareWindow: components["schemas"]["SurfaceCompareWindow"];
|
|
1560
1803
|
dataFreshness: components["schemas"]["SurfaceDataFreshness"];
|
|
1561
1804
|
exportCapability: components["schemas"]["SurfaceExportCapability"];
|
|
1562
|
-
/** @description
|
|
1805
|
+
/** @description On the whole site, with no filter and no client space, these counts are exact from 1: the totals and the per-day series (visitors, visits, page views, events, and the `period_total` and points of a `day` series), the breakdowns by country, region, device, system, browser, language and screen size, the pages and entry pages, the named sources and the types of referring site, and the goals with their conversions. The cities (a list of those with at least ten visits), the raw referring domains, the `hour` series, every filtered or crossed report and the Campagnes sections publish counts exact from 10; a count of 1..9 is `null`: render it as less than 10, never as a number. 0 is a measured empty count. A filtered report keeps the complement rule. Totals are computed on exact values, then published by the same rule; never add up displayed values. A share follows its count: it is `null` when the count is. A change (`delta`, `delta_pct`) is published only when both counts are 0 or at least 10, and `delta_pct` is a ratio (0.56 is +56%). Rates are published to the percent; 0.005 and 0.995 represent the open tails below 1% and above 99%. Rates, means, durations and percentiles are null under 10 contributors. Last conversion dates have day precision. Usage metering, billing, limits and diagnostics remain exact. This policy reduces detail; it is not a guarantee of anonymity. */
|
|
1563
1806
|
reportingPrecision?: {
|
|
1564
1807
|
/** @enum {integer} */
|
|
1565
1808
|
minimumCount: 10;
|
|
@@ -1569,6 +1812,18 @@ export interface components {
|
|
|
1569
1812
|
version: "exact-masked-counts-v1";
|
|
1570
1813
|
};
|
|
1571
1814
|
};
|
|
1815
|
+
TenantConflictErrorBody: {
|
|
1816
|
+
/** @enum {string} */
|
|
1817
|
+
code: "TENANT_SLUG_CONFLICT" | "TENANT_CONFLICT";
|
|
1818
|
+
details?: {
|
|
1819
|
+
[key: string]: unknown;
|
|
1820
|
+
} | null;
|
|
1821
|
+
message: string;
|
|
1822
|
+
request_id: string;
|
|
1823
|
+
};
|
|
1824
|
+
TenantConflictErrorResponse: {
|
|
1825
|
+
error: components["schemas"]["TenantConflictErrorBody"];
|
|
1826
|
+
};
|
|
1572
1827
|
TenantItem: {
|
|
1573
1828
|
/** @enum {string} */
|
|
1574
1829
|
status: "ACTIVE" | "INACTIVE";
|
|
@@ -1582,6 +1837,34 @@ export interface components {
|
|
|
1582
1837
|
TenantsResponse: {
|
|
1583
1838
|
items: components["schemas"]["TenantItem"][];
|
|
1584
1839
|
};
|
|
1840
|
+
TenantsWriteRequest: {
|
|
1841
|
+
site_id: string;
|
|
1842
|
+
tenants: components["schemas"]["TenantWriteItem"][];
|
|
1843
|
+
};
|
|
1844
|
+
TenantsWriteResponse: {
|
|
1845
|
+
created: number;
|
|
1846
|
+
items: components["schemas"]["TenantWriteResultItem"][];
|
|
1847
|
+
unchanged: number;
|
|
1848
|
+
updated: number;
|
|
1849
|
+
};
|
|
1850
|
+
TenantWriteItem: {
|
|
1851
|
+
/**
|
|
1852
|
+
* @description Omitted keeps the stored status (`ACTIVE` for a new tenant).
|
|
1853
|
+
* `INACTIVE` is the only way to deactivate a tenant.
|
|
1854
|
+
* @enum {string}
|
|
1855
|
+
*/
|
|
1856
|
+
status?: "ACTIVE" | "INACTIVE";
|
|
1857
|
+
/** @description Stable tenant identifier chosen by the platform. */
|
|
1858
|
+
tenant_id: string;
|
|
1859
|
+
/** @description Display name. */
|
|
1860
|
+
tenant_name: string;
|
|
1861
|
+
/** @description Routing slug, unique within the site. */
|
|
1862
|
+
tenant_slug: string;
|
|
1863
|
+
};
|
|
1864
|
+
TenantWriteResultItem: components["schemas"]["TenantItem"] & {
|
|
1865
|
+
/** @enum {string} */
|
|
1866
|
+
result: "created" | "updated" | "unchanged";
|
|
1867
|
+
};
|
|
1585
1868
|
TimeseriesPoint: {
|
|
1586
1869
|
ts: string;
|
|
1587
1870
|
value: number | null;
|
|
@@ -1647,6 +1930,7 @@ export interface components {
|
|
|
1647
1930
|
campaigns_enabled: boolean;
|
|
1648
1931
|
/** @description Visits with Campagnes consent in the period, published like the other counts. `0` when the option is off. */
|
|
1649
1932
|
consented_sessions: number | null;
|
|
1933
|
+
lists?: components["schemas"]["ReportLists"];
|
|
1650
1934
|
/**
|
|
1651
1935
|
* @description Visits with consent by campaign (Campagnes option, section
|
|
1652
1936
|
* `acquisition_attribution`); empty without the option.
|
|
@@ -1903,12 +2187,22 @@ export interface components {
|
|
|
1903
2187
|
/**
|
|
1904
2188
|
* @description Grouping dimension for breakdown endpoint.
|
|
1905
2189
|
* When `dimension=tenant`, rows are grouped by stable `tenant_id`. The
|
|
1906
|
-
* statistics of a tenant are those of the page's
|
|
2190
|
+
* statistics of a tenant are those of the page's tracked space. The
|
|
1907
2191
|
* response also includes `tenant_slug` and `tenant_name` as display labels.
|
|
1908
2192
|
*/
|
|
1909
2193
|
BreakdownDimension: "device" | "referrer" | "page" | "browser" | "os" | "country" | "tenant";
|
|
1910
2194
|
/** @description Number of rows returned by breakdown endpoint. */
|
|
1911
2195
|
BreakdownLimit: number;
|
|
2196
|
+
/**
|
|
2197
|
+
* @description Reads the breakdown as the paginated list of its dimension (`device`:
|
|
2198
|
+
* `devices`, `referrer`: `referrers`, `page`: `pages`, `browser`:
|
|
2199
|
+
* `browsers`, `os`: `systems`, `country`: `countries`). Whole site, no
|
|
2200
|
+
* `filters` and no `tenant_id`. `rows[].value` is the main measure of the
|
|
2201
|
+
* list (pageviews for `pages`, visits for the others); a `metric` other
|
|
2202
|
+
* than `pageviews` for `pages` or `sessions` for the others is refused and `page` carries `next_offset`, `total_rows`, `totals` and
|
|
2203
|
+
* `other`.
|
|
2204
|
+
*/
|
|
2205
|
+
BreakdownListParam: "devices" | "referrers" | "pages" | "browsers" | "systems" | "countries";
|
|
1912
2206
|
/** @description Compare current range against the previous equivalent period. */
|
|
1913
2207
|
CompareParam: "prev_period";
|
|
1914
2208
|
/**
|
|
@@ -1928,6 +2222,36 @@ export interface components {
|
|
|
1928
2222
|
FromDate: string;
|
|
1929
2223
|
/** @description Granularity (`day` or `hour`, on every plan with API access). */
|
|
1930
2224
|
Interval: "day" | "hour";
|
|
2225
|
+
/** @description Rank of the first row of the page of `list`. */
|
|
2226
|
+
ListOffset: number;
|
|
2227
|
+
/** @description Order of `sort` (`desc` for a measure, `asc` for `value`). */
|
|
2228
|
+
ListOrder: "asc" | "desc";
|
|
2229
|
+
/**
|
|
2230
|
+
* @description Page size of `list`, when it is not `limit`. Without it `limit` is the
|
|
2231
|
+
* page size (25 when `limit` is absent too); `offset + page size` is at
|
|
2232
|
+
* most 10 000.
|
|
2233
|
+
*/
|
|
2234
|
+
ListPageSize: number;
|
|
2235
|
+
/**
|
|
2236
|
+
* @description A list of the report read page by page (see Pagination). Content serves
|
|
2237
|
+
* `pages`, `entry_pages` and `exit_pages`; Acquisition serves
|
|
2238
|
+
* `landing_pages`, `referrers` and the Campagnes lists. The page is
|
|
2239
|
+
* returned in `current.lists.<list>` next to the report, which keeps its
|
|
2240
|
+
* own arrays. Needs `include=full` (the default when `list` is given);
|
|
2241
|
+
* not served with a client space (`tenant_id`).
|
|
2242
|
+
*/
|
|
2243
|
+
ListParam: "pages" | "entry_pages" | "exit_pages" | "landing_pages" | "referrers" | "campaign_channels" | "campaign_sources" | "campaign_mediums" | "campaigns" | "campaign_contents" | "campaign_terms";
|
|
2244
|
+
/**
|
|
2245
|
+
* @description Rows of `list` whose value (path, domain, name) or title contains the
|
|
2246
|
+
* text, case-insensitive, accents significant. A value under ten visits
|
|
2247
|
+
* that the list hides is never found. `other` is null with a search.
|
|
2248
|
+
*/
|
|
2249
|
+
ListSearch: string;
|
|
2250
|
+
/**
|
|
2251
|
+
* @description Sort of `list`: one of its measures or `value` (alphabetical). The
|
|
2252
|
+
* default is its main measure, descending, ties broken by the value.
|
|
2253
|
+
*/
|
|
2254
|
+
ListSort: string;
|
|
1931
2255
|
/**
|
|
1932
2256
|
* @description Metric to aggregate (default `pageviews`). `sessions` uses the same
|
|
1933
2257
|
* visit model as the dashboard: a `visit_id` starts from the
|
|
@@ -1955,6 +2279,13 @@ export interface components {
|
|
|
1955
2279
|
};
|
|
1956
2280
|
requestBodies: never;
|
|
1957
2281
|
headers: {
|
|
2282
|
+
/**
|
|
2283
|
+
* @description Present with the value `near_hard_cap` once the workspace has used 80 %
|
|
2284
|
+
* of its monthly API hard cap. Plan for the ceiling before requests are
|
|
2285
|
+
* refused with `HARD_CAP_REACHED`. Never sent to a token restricted to
|
|
2286
|
+
* tenants.
|
|
2287
|
+
*/
|
|
2288
|
+
XPomeloUsageWarning: "near_hard_cap";
|
|
1958
2289
|
/** @description Maximum requests allowed during current short window. */
|
|
1959
2290
|
XRateLimitLimit: number;
|
|
1960
2291
|
/** @description Remaining requests in current short window. */
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { createPomeloClient, PomeloClient } from './client.js';
|
|
2
|
-
export type { ApiPath, ApiData, ApiParams, TenantsParams, TimeseriesParams, BreakdownParams, OverviewParams, ContentParams, AcquisitionParams, ActionsParams, GoalsParams, GoalConversionsParams, UsageHistoryParams } from './client.js';
|
|
2
|
+
export type { ApiPath, ApiData, ApiParams, TenantsParams, TenantsWriteBody, TenantsWriteData, TimeseriesParams, BreakdownParams, OverviewParams, ContentParams, AcquisitionParams, ActionsParams, GoalsParams, GoalConversionsParams, UsageHistoryParams } from './client.js';
|
|
3
3
|
export type { components, paths } from './generated/openapi.js';
|
|
4
4
|
export { PomeloApiError, PomeloTransportError } from './errors.js';
|
|
5
5
|
export type { ApiResponse, Fetch, PomeloClientOptions, RequestOptions, ResponseMetadata, TransportErrorCode } from './types.js';
|
package/dist/transport.d.ts
CHANGED
|
@@ -5,5 +5,7 @@ export declare class Transport {
|
|
|
5
5
|
#private;
|
|
6
6
|
constructor(options: PomeloClientOptions);
|
|
7
7
|
get<T>(path: string, query: Query, options?: RequestOptions): Promise<ApiResponse<T>>;
|
|
8
|
+
/** Single JSON POST. Only used for the reviewed `POST /v1/tenants` operation. */
|
|
9
|
+
post<T>(path: string, body: object, options?: RequestOptions): Promise<ApiResponse<T>>;
|
|
8
10
|
}
|
|
9
11
|
export {};
|
package/dist/transport.js
CHANGED
|
@@ -61,7 +61,14 @@ export class Transport {
|
|
|
61
61
|
throw new PomeloTransportError('INVALID_OPTIONS');
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
|
-
|
|
64
|
+
get(path, query, options = {}) {
|
|
65
|
+
return this.#request('GET', path, query, undefined, options);
|
|
66
|
+
}
|
|
67
|
+
/** Single JSON POST. Only used for the reviewed `POST /v1/tenants` operation. */
|
|
68
|
+
post(path, body, options = {}) {
|
|
69
|
+
return this.#request('POST', path, {}, body, options);
|
|
70
|
+
}
|
|
71
|
+
async #request(method, path, query, body, options) {
|
|
65
72
|
assertServer();
|
|
66
73
|
if (!/^\/v1\/[a-z/]+$/.test(path) || (options.requestId !== undefined && !identifier.test(options.requestId))) {
|
|
67
74
|
throw new PomeloTransportError('INVALID_OPTIONS');
|
|
@@ -77,6 +84,18 @@ export class Transport {
|
|
|
77
84
|
const requestId = options.requestId ?? globalThis.crypto.randomUUID();
|
|
78
85
|
const headers = new Headers({ Accept: 'application/json', Authorization: `Bearer ${this.#token}` });
|
|
79
86
|
headers.set('X-Request-Id', requestId);
|
|
87
|
+
let serialized;
|
|
88
|
+
if (body !== undefined) {
|
|
89
|
+
try {
|
|
90
|
+
serialized = JSON.stringify(body);
|
|
91
|
+
}
|
|
92
|
+
catch {
|
|
93
|
+
throw new PomeloTransportError('INVALID_OPTIONS');
|
|
94
|
+
}
|
|
95
|
+
if (typeof serialized !== 'string')
|
|
96
|
+
throw new PomeloTransportError('INVALID_OPTIONS');
|
|
97
|
+
headers.set('Content-Type', 'application/json');
|
|
98
|
+
}
|
|
80
99
|
const controller = new AbortController();
|
|
81
100
|
let timedOut = false;
|
|
82
101
|
const abort = () => controller.abort();
|
|
@@ -89,7 +108,7 @@ export class Transport {
|
|
|
89
108
|
controller.signal.addEventListener('abort', abortRequest, { once: true });
|
|
90
109
|
});
|
|
91
110
|
try {
|
|
92
|
-
const response = await Promise.race([this.#fetch(url, { method
|
|
111
|
+
const response = await Promise.race([this.#fetch(url, { method, headers, ...(serialized !== undefined ? { body: serialized } : {}), signal: controller.signal, redirect: 'error', credentials: 'omit', cache: 'no-store' }), aborted]);
|
|
93
112
|
metadata = responseMetadata(response.headers, requestId);
|
|
94
113
|
let payload;
|
|
95
114
|
try {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pomeloanalytics/api",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.6",
|
|
4
4
|
"description": "TypeScript client for reading Pomelo Analytics reports, sites and goals from Node.js servers.",
|
|
5
5
|
"homepage": "https://www.pomeloanalytics.com/",
|
|
6
6
|
"keywords": ["pomelo", "analytics", "web-analytics", "typescript", "nodejs", "sdk", "api-client"],
|