@carto/api-client 0.4.7 → 0.4.8-alpha.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/api-client.cjs +8 -2
- package/build/api-client.cjs.map +1 -1
- package/build/api-client.modern.js +8 -2
- package/build/api-client.modern.js.map +1 -1
- package/build/sources/base-source.d.ts +1 -1
- package/package.json +3 -2
- package/src/api/query.ts +2 -1
- package/src/sources/base-source.ts +4 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { GeojsonResult, JsonResult, SourceOptionalOptions, SourceRequiredOptions, TilejsonResult } from './types.js';
|
|
2
2
|
import { MapType } from '../types.js';
|
|
3
|
-
export declare const SOURCE_DEFAULTS: SourceOptionalOptions
|
|
3
|
+
export declare const SOURCE_DEFAULTS: Omit<SourceOptionalOptions, 'clientId'>;
|
|
4
4
|
export declare function baseSource<UrlParameters extends Record<string, unknown>>(endpoint: MapType, options: Partial<SourceOptionalOptions> & SourceRequiredOptions, urlParameters: UrlParameters): Promise<TilejsonResult | GeojsonResult | JsonResult>;
|
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"homepage": "https://github.com/CartoDB/carto-api-client#readme",
|
|
9
9
|
"author": "Don McCurdy <donmccurdy@carto.com>",
|
|
10
10
|
"packageManager": "yarn@4.3.1",
|
|
11
|
-
"version": "0.4.
|
|
11
|
+
"version": "0.4.8-alpha.0",
|
|
12
12
|
"license": "MIT",
|
|
13
13
|
"publishConfig": {
|
|
14
14
|
"access": "public"
|
|
@@ -112,5 +112,6 @@
|
|
|
112
112
|
"resolutions": {
|
|
113
113
|
"@carto/api-client": "portal:./",
|
|
114
114
|
"rollup": "^4.20.0"
|
|
115
|
-
}
|
|
115
|
+
},
|
|
116
|
+
"stableVersion": "0.4.7"
|
|
116
117
|
}
|
package/src/api/query.ts
CHANGED
|
@@ -11,6 +11,7 @@ import type {
|
|
|
11
11
|
import {buildQueryUrl} from './endpoints.js';
|
|
12
12
|
import {requestWithParameters} from './request-with-parameters.js';
|
|
13
13
|
import {APIErrorContext} from './carto-api-error.js';
|
|
14
|
+
import {getClient} from '../client.js';
|
|
14
15
|
|
|
15
16
|
export type QueryOptions = SourceOptions & QuerySourceOptions;
|
|
16
17
|
type UrlParameters = {q: string; queryParameters?: string};
|
|
@@ -20,8 +21,8 @@ export const query = async function (
|
|
|
20
21
|
): Promise<QueryResult> {
|
|
21
22
|
const {
|
|
22
23
|
apiBaseUrl = SOURCE_DEFAULTS.apiBaseUrl,
|
|
23
|
-
clientId = SOURCE_DEFAULTS.clientId,
|
|
24
24
|
maxLengthURL = SOURCE_DEFAULTS.maxLengthURL,
|
|
25
|
+
clientId = getClient(),
|
|
25
26
|
localCache,
|
|
26
27
|
connectionName,
|
|
27
28
|
sqlQuery,
|
|
@@ -18,9 +18,8 @@ import {MapType} from '../types.js';
|
|
|
18
18
|
import {APIErrorContext} from '../api/index.js';
|
|
19
19
|
import {getClient} from '../client.js';
|
|
20
20
|
|
|
21
|
-
export const SOURCE_DEFAULTS: SourceOptionalOptions = {
|
|
21
|
+
export const SOURCE_DEFAULTS: Omit<SourceOptionalOptions, 'clientId'> = {
|
|
22
22
|
apiBaseUrl: DEFAULT_API_BASE_URL,
|
|
23
|
-
clientId: getClient(),
|
|
24
23
|
format: 'tilejson',
|
|
25
24
|
headers: {},
|
|
26
25
|
maxLengthURL: DEFAULT_MAX_LENGTH_URL,
|
|
@@ -34,6 +33,7 @@ export async function baseSource<UrlParameters extends Record<string, unknown>>(
|
|
|
34
33
|
const {accessToken, connectionName, cache, ...optionalOptions} = options;
|
|
35
34
|
const mergedOptions = {
|
|
36
35
|
...SOURCE_DEFAULTS,
|
|
36
|
+
clientId: getClient(),
|
|
37
37
|
accessToken,
|
|
38
38
|
connectionName,
|
|
39
39
|
endpoint,
|
|
@@ -80,6 +80,7 @@ export async function baseSource<UrlParameters extends Record<string, unknown>>(
|
|
|
80
80
|
if (format === 'tilejson') {
|
|
81
81
|
const json = await requestWithParameters<TilejsonResult>({
|
|
82
82
|
baseUrl: dataUrl,
|
|
83
|
+
parameters: {client: clientId},
|
|
83
84
|
headers,
|
|
84
85
|
errorContext,
|
|
85
86
|
maxLengthURL,
|
|
@@ -93,6 +94,7 @@ export async function baseSource<UrlParameters extends Record<string, unknown>>(
|
|
|
93
94
|
|
|
94
95
|
return await requestWithParameters<GeojsonResult | JsonResult>({
|
|
95
96
|
baseUrl: dataUrl,
|
|
97
|
+
parameters: {client: clientId},
|
|
96
98
|
headers,
|
|
97
99
|
errorContext,
|
|
98
100
|
maxLengthURL,
|