Skip to content

Commit 31bf4f7

Browse files
committed
refactor: remove unused Warp 10 client wiring
Now that cc-tile-metrics, cc-tile-status-codes, cc-tile-requests and cc-logsmap fetch their data through the new cc-api-client, nothing in the repo still calls sendToWarp. Drop the helper, the Warp10ApiConfig type, and the WARP_10_HOST plumbing in the storybook auth plugin so the API config surface only carries what is actually used.
1 parent be35e08 commit 31bf4f7

3 files changed

Lines changed: 2 additions & 44 deletions

File tree

src/lib/send-to-api.js

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { addOauthHeader } from '@clevercloud/client/esm/oauth.js';
22
import { prefixUrl } from '@clevercloud/client/esm/prefix-url.js';
3-
import { execWarpscript } from '@clevercloud/client/esm/request-warp10.fetch.js';
43
import { request } from '@clevercloud/client/esm/request.fetch.js';
54
import { withCache } from '@clevercloud/client/esm/with-cache.js';
65
import { withOptions } from '@clevercloud/client/esm/with-options.js';
@@ -10,7 +9,6 @@ import { CcApiErrorEvent } from './send-to-api.events.js';
109
// See: https://github.com/microsoft/TypeScript/issues/60908/
1110
/**
1211
* @typedef {import('./send-to-api.types.js').ApiConfig} ApiConfig
13-
* @typedef {import('./send-to-api.types.js').Warp10ApiConfig} Warp10ApiConfig
1412
*/
1513

1614
/**
@@ -42,28 +40,3 @@ export function sendToApi({ apiConfig, signal, cacheDelay, timeout }) {
4240
});
4341
};
4442
}
45-
46-
/**
47-
* @param {Object} settings
48-
* @param {Warp10ApiConfig} settings.apiConfig
49-
* @param {AbortSignal} [settings.signal]
50-
* @param {number} [settings.cacheDelay]
51-
* @param {number} [settings.timeout]
52-
* @return {(requestParams: Object) => Promise<any>}
53-
*/
54-
export function sendToWarp({ apiConfig, signal, cacheDelay, timeout }) {
55-
return (requestParams) => {
56-
const cacheParams = { ...apiConfig, ...requestParams };
57-
return withCache(cacheParams, cacheDelay, () => {
58-
const { WARP_10_HOST } = apiConfig;
59-
return (
60-
Promise.resolve(requestParams)
61-
// @ts-expect-error FIXME: will become irrelevant when we switch to the new client and fixing it seems to lead to many fixes in places everywhere sendToApi is used
62-
.then(prefixUrl(WARP_10_HOST))
63-
.then(withOptions({ signal, timeout }))
64-
// @ts-expect-error FIXME: will become irrelevant when we switch to the new client and fixing it seems to lead to many fixes in places everywhere sendToApi is used
65-
.then(execWarpscript)
66-
);
67-
});
68-
};
69-
}

src/lib/send-to-api.types.d.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,6 @@ export interface ApiConfig {
66
OAUTH_CONSUMER_SECRET: string;
77
}
88

9-
export interface Warp10ApiConfig {
10-
WARP_10_HOST: string;
11-
API_OAUTH_TOKEN: string;
12-
API_OAUTH_TOKEN_SECRET: string;
13-
OAUTH_CONSUMER_KEY: string;
14-
OAUTH_CONSUMER_SECRET: string;
15-
}
16-
179
export interface AuthBridgeConfig {
1810
AUTH_BRIDGE_HOST: string;
1911
API_OAUTH_TOKEN: string;

src/stories/lib/smart-auth-plugin.js

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,13 @@ export const injectAuthForSmartComponentsPlugin = {
1717
const isSandboxIndex = id.includes('/sandbox/index.js');
1818

1919
if (isSmartStory || isDemoSmartIndex || isSandboxIndex) {
20-
const {
21-
WARP_10_HOST,
22-
API_HOST,
23-
API_OAUTH_TOKEN,
24-
API_OAUTH_TOKEN_SECRET,
25-
OAUTH_CONSUMER_KEY,
26-
OAUTH_CONSUMER_SECRET,
27-
} = process.env;
20+
const { API_HOST, API_OAUTH_TOKEN, API_OAUTH_TOKEN_SECRET, OAUTH_CONSUMER_KEY, OAUTH_CONSUMER_SECRET } =
21+
process.env;
2822

2923
// language=JavaScript
3024
code += `
3125
updateRootContext({
3226
apiConfig: {
33-
WARP_10_HOST: '${WARP_10_HOST}',
3427
API_HOST: '${API_HOST}',
3528
API_OAUTH_TOKEN: '${API_OAUTH_TOKEN}',
3629
API_OAUTH_TOKEN_SECRET: '${API_OAUTH_TOKEN_SECRET}',

0 commit comments

Comments
 (0)