Skip to content

Commit

Permalink
feat(constants): Export DEFAULT_API_BASE_URL
Browse files Browse the repository at this point in the history
  • Loading branch information
donmccurdy committed Nov 4, 2024
1 parent ea9f615 commit 0fa0d9c
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 14 deletions.
3 changes: 0 additions & 3 deletions src/constants-internal.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
/** @internalRemarks Source: @carto/constants, @deck.gl/carto */
export const DEFAULT_API_BASE_URL = 'https://gcp-us-east1.api.carto.com';

/**
* Current version of @carto/api-client.
* @internal
Expand Down
3 changes: 3 additions & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,6 @@ export enum ApiVersion {
V2 = 'v2',
V3 = 'v3',
}

/** @internalRemarks Source: @carto/constants, @deck.gl/carto */
export const DEFAULT_API_BASE_URL = 'https://gcp-us-east1.api.carto.com';
7 changes: 2 additions & 5 deletions src/sources/base-source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,8 @@
// SPDX-License-Identifier: MIT
// Copyright (c) vis.gl contributors

/* eslint-disable camelcase */
import {
DEFAULT_API_BASE_URL,
DEFAULT_MAX_LENGTH_URL,
} from '../constants-internal';
import {DEFAULT_API_BASE_URL} from '../constants';
import {DEFAULT_MAX_LENGTH_URL} from '../constants-internal';
import {buildSourceUrl} from '../api/endpoints';
import {requestWithParameters} from '../api/request-with-parameters';
import type {
Expand Down
7 changes: 2 additions & 5 deletions src/widget-sources/widget-base-source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,8 @@ import {getApplicableFilters, normalizeObjectKeys} from '../utils.js';
import {getClient} from '../client.js';
import {ModelSource} from '../models/model.js';
import {SourceOptions} from '../sources/index.js';
import {ApiVersion} from '../constants.js';
import {
DEFAULT_API_BASE_URL,
DEFAULT_GEO_COLUMN,
} from '../constants-internal.js';
import {ApiVersion, DEFAULT_API_BASE_URL} from '../constants.js';
import {DEFAULT_GEO_COLUMN} from '../constants-internal.js';

export interface WidgetBaseSourceProps extends Omit<SourceOptions, 'filters'> {
apiVersion?: ApiVersion;
Expand Down
6 changes: 5 additions & 1 deletion test/constants.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import {expect, test} from 'vitest';
import {FilterType} from '@carto/api-client';
import {FilterType, DEFAULT_API_BASE_URL} from '@carto/api-client';

test('FilterType', () => {
expect(FilterType.IN).toBe('in');
expect(FilterType.STRING_SEARCH).toBe('stringSearch');
expect(FilterType.CLOSED_OPEN).toBe('closed_open');
});

test('DEFAULT_API_BASE_URL', () => {
expect(DEFAULT_API_BASE_URL).toMatch(/^https:\/\//);
});

0 comments on commit 0fa0d9c

Please sign in to comment.