gatana-sdk 2.3.1 → 2.3.3
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/dist/api/index.cjs +31 -48
- package/dist/api/index.d.cts +2 -2
- package/dist/api/index.d.mts +2 -2
- package/dist/api/index.mjs +2 -2
- package/dist/apiv2/index.cjs +1 -1
- package/dist/apiv2/index.d.cts +2 -2
- package/dist/apiv2/index.d.mts +2 -2
- package/dist/apiv2/index.mjs +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +3 -3
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +3 -3
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/dist/{sdk.gen-DbvfIuwl.cjs → sdk.gen-BMl_z1y-.cjs} +180 -177
- package/dist/sdk.gen-Bxu43MTi.d.cts +4596 -0
- package/dist/sdk.gen-Bxu43MTi.d.cts.map +1 -0
- package/dist/sdk.gen-CfIkdlZG.cjs +3399 -0
- package/dist/{sdk.gen-JaJdVFlp.d.mts → sdk.gen-CxQneXhT.d.mts} +736 -707
- package/dist/sdk.gen-CxQneXhT.d.mts.map +1 -0
- package/dist/{sdk.gen-6_NSk1dc.d.cts → sdk.gen-D95pVzAJ.d.cts} +736 -707
- package/dist/sdk.gen-D95pVzAJ.d.cts.map +1 -0
- package/dist/sdk.gen-DObLA2c-.mjs +2567 -0
- package/dist/sdk.gen-DObLA2c-.mjs.map +1 -0
- package/dist/{sdk.gen-1fMdFWWC.mjs → sdk.gen-DUNHa0uM.mjs} +181 -178
- package/dist/sdk.gen-DUNHa0uM.mjs.map +1 -0
- package/dist/sdk.gen-M1zAzCGN.d.mts +4596 -0
- package/dist/sdk.gen-M1zAzCGN.d.mts.map +1 -0
- package/package.json +2 -2
- package/dist/sdk.gen-1fMdFWWC.mjs.map +0 -1
- package/dist/sdk.gen-6_NSk1dc.d.cts.map +0 -1
- package/dist/sdk.gen-B7HIkL3d.cjs +0 -4021
- package/dist/sdk.gen-BtALwwrp.d.cts +0 -5052
- package/dist/sdk.gen-BtALwwrp.d.cts.map +0 -1
- package/dist/sdk.gen-C1HW05Pw.d.mts +0 -5052
- package/dist/sdk.gen-C1HW05Pw.d.mts.map +0 -1
- package/dist/sdk.gen-COMJoQbu.mjs +0 -3087
- package/dist/sdk.gen-COMJoQbu.mjs.map +0 -1
- package/dist/sdk.gen-JaJdVFlp.d.mts.map +0 -1
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["debug","sdk","sdk"],"sources":["../src/v2.ts","../src/index.ts"],"sourcesContent":["import { client } from './apiv2/client.gen.js';\nimport * as sdk from './apiv2/sdk.gen.js';\nimport createDebug from 'debug';\nimport { Config } from './api/client/types.gen.js';\nimport {\n ConfigLoader,\n EnvConfigStrategy,\n FileConfigStrategy,\n GatanaConfig,\n GatanaOptions,\n OptionsConfigStrategy,\n} from './index.js';\nconst debug = createDebug('gatana');\n\n/**\n * Gatana2 is representing a more REST-ful API where the object returned from GET can be used directly in POST/PUT/PATCH requests.\n */\nexport class Gatana2 {\n public api = sdk;\n public readonly config: GatanaConfig;\n constructor(arg?: { options?: GatanaOptions; configLoader?: ConfigLoader; isCli?: boolean }) {\n // Try to get config from file if not provided via options or env vars\n const configLoader =\n arg?.configLoader ||\n new ConfigLoader([new OptionsConfigStrategy(arg?.options), new EnvConfigStrategy(), new FileConfigStrategy()]);\n\n try {\n this.config = configLoader.getConfig();\n\n const clientConfig = {\n baseUrl: new URL('/api/v2/', this.config.baseUrl).toString(),\n auth: this.config.token,\n } satisfies Config;\n client.setConfig(clientConfig);\n\n // Add verbose request/response logging via debug\n const debugHttp = createDebug('gatana:http');\n client.interceptors.request.use(request => {\n debugHttp(`→ ${request.method} ${request.url}`);\n return request;\n });\n client.interceptors.response.use((response, request) => {\n debugHttp(`← ${response.status} ${response.statusText} ${request.method} ${request.url}`);\n return response;\n });\n client.interceptors.error.use((error, response, request) => {\n debugHttp(`✗ ${response.status} ${response.statusText} ${request.method} ${request.url}`, error);\n return error;\n });\n\n debug('Gatana initialized with config', clientConfig);\n } catch (error: any) {\n debug('Failed to initialize', error);\n if (arg?.isCli && error.message === 'No valid configuration found from any strategy') {\n console.error('Warning: No valid configuration found. Run \"gatana config login\" to set up your credentials.');\n this.config = {\n baseUrl: 'https://NO_ORGANIZATION_SET.gatana.ai',\n token: async () => 'PLEASE_SET_UP_CONFIGURATION',\n };\n } else {\n console.error('Error initializing Gatana:', error.message);\n process.exit(1);\n }\n }\n }\n\n getOpenApiSpecUrl() {\n return new URL('/api/v2/openapi.json', this.config.baseUrl).toString();\n }\n}\n","import { client } from './api/client.gen.js';\nimport * as sdk from './api/sdk.gen.js';\nimport type { Agent } from './api/types.gen.js';\nimport createDebug from 'debug';\nimport { getOrganization, getDefaultOrganization, setOrganizationConfig } from './config.js';\nimport * as openidClient from 'openid-client';\nimport { Config } from './api/client/types.gen.js';\nconst debug = createDebug('gatana');\n\nexport interface GatanaOptions {\n apiKey: string;\n orgId?: string;\n baseUrl?: string;\n}\n\nexport type GatanaConfig = { baseUrl: string; token: () => Promise<string> };\nexport class ConfigLoader {\n constructor(private strategies: ConfigStrategy[]) {}\n\n getConfig(): GatanaConfig {\n for (const strategy of this.strategies) {\n const config = strategy.getConfig();\n if (config) {\n return config;\n }\n }\n throw new Error('No valid configuration found from any strategy');\n }\n}\n\nexport abstract class ConfigStrategy {\n abstract getConfig(): { baseUrl: string; token: () => Promise<string> } | null;\n}\n\nexport class OptionsConfigStrategy extends ConfigStrategy {\n constructor(private options?: GatanaOptions) {\n super();\n }\n\n getConfig() {\n if (!this.options) {\n return null;\n }\n if (this.options.apiKey && (this.options.orgId || this.options.baseUrl)) {\n const key = this.options.apiKey;\n const baseUrl = this.options.baseUrl || `https://${this.options.orgId}.gatana.ai`;\n return {\n baseUrl,\n token: async () => key,\n };\n }\n return null;\n }\n}\n\nexport class EnvConfigStrategy extends ConfigStrategy {\n getConfig() {\n const apiKey = process.env.GATANA_API_KEY;\n const orgId = process.env.GATANA_ORG_ID;\n const overrideBaseUrl = process.env.GATANA_BASE_URL;\n if (apiKey && (orgId || overrideBaseUrl)) {\n return {\n baseUrl: overrideBaseUrl || `https://${orgId}.gatana.ai`,\n token: async () => apiKey,\n };\n }\n return null;\n }\n}\n\nexport class FileConfigStrategy extends ConfigStrategy {\n constructor(private orgId?: string) {\n super();\n }\n\n getConfig() {\n let orgId = this.orgId || process.env.GATANA_ORG_ID || getDefaultOrganization();\n if (!orgId) {\n return null;\n }\n debug(`FileConfigLoader loading config for orgId=${orgId}`);\n const tenantConfig = getOrganization(orgId);\n if (!tenantConfig) {\n return null;\n }\n return {\n baseUrl: tenantConfig.baseUrl,\n token: async () => {\n if (tenantConfig?.apiKey) {\n return tenantConfig.apiKey;\n } else if (\n tenantConfig?.tokens?.access_token &&\n tenantConfig.tokens.expires_at &&\n tenantConfig.tokens.expires_at > Math.floor(Date.now() / 1000) + 60\n ) {\n return tenantConfig.tokens.access_token;\n } else if (tenantConfig.tokens?.refresh_token) {\n debug('Access token expired or about to expire, attempting to refresh');\n // Try to refresh the token\n const config = await openidClient.discovery(\n new URL(`/.well-known/openid-configuration`, tenantConfig.baseUrl),\n `${orgId}-cli`\n );\n try {\n const token = await openidClient.refreshTokenGrant(config, tenantConfig.tokens.refresh_token);\n if (token) {\n setOrganizationConfig(orgId, {\n tokens: {\n access_token: token.access_token,\n refresh_token: token.refresh_token || tenantConfig.tokens.refresh_token,\n expires_at: token.expires_in ? Math.floor(Date.now() / 1000) + token.expires_in : 0,\n },\n });\n debug('Token refreshed successfully');\n return token.access_token;\n }\n } catch (error) {\n debug('Failed to refresh token', error);\n throw new Error('Failed to refresh access token. Please log in again.');\n }\n }\n throw new Error('No valid API key, access token or refresh token available.');\n },\n };\n }\n}\n\nexport class Gatana {\n public api = sdk;\n public readonly config: GatanaConfig;\n constructor(arg?: { options?: GatanaOptions; configLoader?: ConfigLoader; isCli?: boolean }) {\n // Try to get config from file if not provided via options or env vars\n const configLoader =\n arg?.configLoader ||\n new ConfigLoader([new OptionsConfigStrategy(arg?.options), new EnvConfigStrategy(), new FileConfigStrategy()]);\n\n try {\n this.config = configLoader.getConfig();\n\n const clientConfig = {\n baseUrl: new URL('/api/v1/', this.config.baseUrl).toString(),\n auth: this.config.token,\n } satisfies Config;\n client.setConfig(clientConfig);\n\n // Add verbose request/response logging via debug\n const debugHttp = createDebug('gatana:http');\n client.interceptors.request.use(request => {\n debugHttp(`→ ${request.method} ${request.url}`);\n return request;\n });\n client.interceptors.response.use((response, request) => {\n debugHttp(`← ${response.status} ${response.statusText} ${request.method} ${request.url}`);\n return response;\n });\n client.interceptors.error.use((error, response, request) => {\n debugHttp(`✗ ${response.status} ${response.statusText} ${request.method} ${request.url}`, error);\n return error;\n });\n\n debug('Gatana initialized with config', clientConfig);\n } catch (error: any) {\n debug('Failed to initialize', error);\n if (arg?.isCli && error.message === 'No valid configuration found from any strategy') {\n console.error('Warning: No valid configuration found. Run \"gatana config login\" to set up your credentials.');\n this.config = {\n baseUrl: 'https://NO_ORGANIZATION_SET.gatana.ai',\n token: async () => 'PLEASE_SET_UP_CONFIGURATION',\n };\n } else {\n console.error('Error initializing Gatana:', error.message);\n process.exit(1);\n }\n }\n }\n}\n\nexport { Gatana2 } from './v2.js';\n"],"mappings":";;;;;;;AAYA,MAAMA,UAAQ,YAAY,SAAS;;;;AAKnC,IAAa,UAAb,MAAqB;CACnB,AAAO,MAAMC;CACb,AAAgB;CAChB,YAAY,KAAiF;EAE3F,MAAM,eACJ,KAAK,gBACL,IAAI,aAAa;GAAC,IAAI,sBAAsB,KAAK,QAAQ;GAAE,IAAI,mBAAmB;GAAE,IAAI,oBAAoB;GAAC,CAAC;AAEhH,MAAI;AACF,QAAK,SAAS,aAAa,WAAW;GAEtC,MAAM,eAAe;IACnB,SAAS,IAAI,IAAI,YAAY,KAAK,OAAO,QAAQ,CAAC,UAAU;IA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Q,MAAM,iGAA+F;AAC7G,SAAK,SAAS;KACZ,SAAS;KACT,OAAO,YAAY;KACpB;UACI;AACL,YAAQ,MAAM,8BAA8B,MAAM,QAAQ;AAC1D,YAAQ,KAAK,EAAE"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["debug","sdk","sdk"],"sources":["../src/v2.ts","../src/index.ts"],"sourcesContent":["import { client } from './apiv2/client.gen.js';\nimport * as sdk from './apiv2/sdk.gen.js';\nimport createDebug from 'debug';\nimport { Config } from './api/client/types.gen.js';\nimport {\n ConfigLoader,\n EnvConfigStrategy,\n FileConfigStrategy,\n GatanaConfig,\n GatanaOptions,\n OptionsConfigStrategy,\n} from './index.js';\nconst debug = createDebug('gatana');\n\n/**\n * Gatana2 is representing a more REST-ful API where the object returned from GET can be used directly in POST/PUT/PATCH requests.\n */\nexport class Gatana2 {\n public api = sdk;\n public readonly config: GatanaConfig;\n constructor(arg?: { options?: GatanaOptions; configLoader?: ConfigLoader; isCli?: boolean }) {\n // Try to get config from file if not provided via options or env vars\n const configLoader =\n arg?.configLoader ||\n new ConfigLoader([new OptionsConfigStrategy(arg?.options), new EnvConfigStrategy(), new FileConfigStrategy()]);\n\n try {\n this.config = configLoader.getConfig();\n\n const clientConfig = {\n baseUrl: new URL('/api/v2/', this.config.baseUrl).toString(),\n auth: this.config.token,\n } satisfies Config;\n client.setConfig(clientConfig);\n\n // Add verbose request/response logging via debug\n const debugHttp = createDebug('gatana:http');\n client.interceptors.request.use(request => {\n debugHttp(`→ ${request.method} ${request.url}`);\n return request;\n });\n client.interceptors.response.use((response, request) => {\n debugHttp(`← ${response.status} ${response.statusText} ${request.method} ${request.url}`);\n return response;\n });\n client.interceptors.error.use((error, response, request) => {\n debugHttp(`✗ ${response.status} ${response.statusText} ${request.method} ${request.url}`, error);\n return error;\n });\n\n debug('Gatana initialized with config', clientConfig);\n } catch (error: any) {\n debug('Failed to initialize', error);\n if (arg?.isCli && error.message === 'No valid configuration found from any strategy') {\n console.error('Warning: No valid configuration found. Run \"gatana config login\" to set up your credentials.');\n this.config = {\n baseUrl: 'https://NO_ORGANIZATION_SET.gatana.ai',\n token: async () => 'PLEASE_SET_UP_CONFIGURATION',\n };\n } else {\n console.error('Error initializing Gatana:', error.message);\n process.exit(1);\n }\n }\n }\n\n getOpenApiSpecUrl() {\n return new URL('/api/v2/openapi.json', this.config.baseUrl).toString();\n }\n}\n","import { client } from './api/client.gen.js';\nimport * as sdk from './api/sdk.gen.js';\nimport createDebug from 'debug';\nimport { getOrganization, getDefaultOrganization, setOrganizationConfig } from './config.js';\nimport * as openidClient from 'openid-client';\nimport { Config } from './api/client/types.gen.js';\nconst debug = createDebug('gatana');\n\nexport interface GatanaOptions {\n apiKey: string;\n orgId?: string;\n baseUrl?: string;\n}\n\nexport type GatanaConfig = { baseUrl: string; token: () => Promise<string> };\nexport class ConfigLoader {\n constructor(private strategies: ConfigStrategy[]) {}\n\n getConfig(): GatanaConfig {\n for (const strategy of this.strategies) {\n const config = strategy.getConfig();\n if (config) {\n return config;\n }\n }\n throw new Error('No valid configuration found from any strategy');\n }\n}\n\nexport abstract class ConfigStrategy {\n abstract getConfig(): { baseUrl: string; token: () => Promise<string> } | null;\n}\n\nexport class OptionsConfigStrategy extends ConfigStrategy {\n constructor(private options?: GatanaOptions) {\n super();\n }\n\n getConfig() {\n if (!this.options) {\n return null;\n }\n if (this.options.apiKey && (this.options.orgId || this.options.baseUrl)) {\n const key = this.options.apiKey;\n const baseUrl = this.options.baseUrl || `https://${this.options.orgId}.gatana.ai`;\n return {\n baseUrl,\n token: async () => key,\n };\n }\n return null;\n }\n}\n\nexport class EnvConfigStrategy extends ConfigStrategy {\n getConfig() {\n const apiKey = process.env.GATANA_API_KEY;\n const orgId = process.env.GATANA_ORG_ID;\n const overrideBaseUrl = process.env.GATANA_BASE_URL;\n if (apiKey && (orgId || overrideBaseUrl)) {\n return {\n baseUrl: overrideBaseUrl || `https://${orgId}.gatana.ai`,\n token: async () => apiKey,\n };\n }\n return null;\n }\n}\n\nexport class FileConfigStrategy extends ConfigStrategy {\n constructor(private orgId?: string) {\n super();\n }\n\n getConfig() {\n let orgId = this.orgId || process.env.GATANA_ORG_ID || getDefaultOrganization();\n if (!orgId) {\n return null;\n }\n debug(`FileConfigLoader loading config for orgId=${orgId}`);\n const tenantConfig = getOrganization(orgId);\n if (!tenantConfig) {\n return null;\n }\n return {\n baseUrl: tenantConfig.baseUrl,\n token: async () => {\n if (tenantConfig?.apiKey) {\n return tenantConfig.apiKey;\n } else if (\n tenantConfig?.tokens?.access_token &&\n tenantConfig.tokens.expires_at &&\n tenantConfig.tokens.expires_at > Math.floor(Date.now() / 1000) + 60\n ) {\n return tenantConfig.tokens.access_token;\n } else if (tenantConfig.tokens?.refresh_token) {\n debug('Access token expired or about to expire, attempting to refresh');\n // Try to refresh the token\n const config = await openidClient.discovery(\n new URL(`/.well-known/openid-configuration`, tenantConfig.baseUrl),\n `${orgId}-cli`\n );\n try {\n const token = await openidClient.refreshTokenGrant(config, tenantConfig.tokens.refresh_token);\n if (token) {\n setOrganizationConfig(orgId, {\n tokens: {\n access_token: token.access_token,\n refresh_token: token.refresh_token || tenantConfig.tokens.refresh_token,\n expires_at: token.expires_in ? Math.floor(Date.now() / 1000) + token.expires_in : 0,\n },\n });\n debug('Token refreshed successfully');\n return token.access_token;\n }\n } catch (error) {\n debug('Failed to refresh token', error);\n throw new Error('Failed to refresh access token. Please log in again.');\n }\n }\n throw new Error('No valid API key, access token or refresh token available.');\n },\n };\n }\n}\n\nexport class Gatana {\n public api = sdk;\n public config: GatanaConfig;\n constructor(arg?: { options?: GatanaOptions; configLoader?: ConfigLoader; isCli?: boolean }) {\n // Try to get config from file if not provided via options or env vars\n const configLoader =\n arg?.configLoader ||\n new ConfigLoader([new OptionsConfigStrategy(arg?.options), new EnvConfigStrategy(), new FileConfigStrategy()]);\n\n try {\n this.config = configLoader.getConfig();\n\n const clientConfig = {\n baseUrl: new URL('/api/v1/', this.config.baseUrl).toString(),\n auth: this.config.token,\n } satisfies Config;\n client.setConfig(clientConfig);\n\n // Add verbose request/response logging via debug\n const debugHttp = createDebug('gatana:http');\n client.interceptors.request.use(request => {\n debugHttp(`→ ${request.method} ${request.url}`);\n return request;\n });\n client.interceptors.response.use((response, request) => {\n debugHttp(`← ${response.status} ${response.statusText} ${request.method} ${request.url}`);\n return response;\n });\n client.interceptors.error.use((error, response, request) => {\n debugHttp(`✗ ${response.status} ${response.statusText} ${request.method} ${request.url}`, error);\n return error;\n });\n\n debug('Gatana initialized with config', clientConfig);\n } catch (error: any) {\n debug('Failed to initialize', error);\n if (arg?.isCli && error.message === 'No valid configuration found from any strategy') {\n console.error('Warning: No valid configuration found. Run \"gatana config login\" to set up your credentials.');\n this.config = {\n baseUrl: 'https://NO_ORGANIZATION_SET.gatana.ai',\n token: async () => 'PLEASE_SET_UP_CONFIGURATION',\n };\n } else {\n console.error('Error initializing Gatana:', error.message);\n process.exit(1);\n }\n }\n }\n}\n\nexport { Gatana2 } from './v2.js';\n"],"mappings":";;;;;;;AAYA,MAAMA,UAAQ,YAAY,SAAS;;;;AAKnC,IAAa,UAAb,MAAqB;CACnB,AAAO,MAAMC;CACb,AAAgB;CAChB,YAAY,KAAiF;EAE3F,MAAM,eACJ,KAAK,gBACL,IAAI,aAAa;GAAC,IAAI,sBAAsB,KAAK,QAAQ;GAAE,IAAI,mBAAmB;GAAE,IAAI,oBAAoB;GAAC,CAAC;AAEhH,MAAI;AACF,QAAK,SAAS,aAAa,WAAW;GAEtC,MAAM,eAAe;IACnB,SAAS,IAAI,IAAI,YAAY,KAAK,OAAO,QAAQ,CAAC,UAAU;IAC5D,MAAM,KAAK,OAAO;IACnB;AACD,YAAO,UAAU,aAAa;GAG9B,MAAM,YAAY,YAAY,cAAc;AAC5C,YAAO,aAAa,QAAQ,KAAI,YAAW;AACzC,cAAU,KAAK,QAAQ,OAAO,GAAG,QAAQ,MAAM;AAC/C,WAAO;KACP;AACF,YAAO,aAAa,SAAS,KAAK,UAAU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
16
16
|
//#region src/apiv2/core/serverSentEvents.gen.ts
|
|
17
|
-
|
|
17
|
+
function createSseClient({ onRequest, onSseError, onSseEvent, responseTransformer, responseValidator, sseDefaultRetryDelay, sseMaxRetryAttempts, sseMaxRetryDelay, sseSleepFn, url, ...options }) {
|
|
18
18
|
let lastEventId;
|
|
19
19
|
const sleep = sseSleepFn ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
|
|
20
20
|
const createStream = async function* () {
|
|
@@ -52,6 +52,7 @@ const createSseClient = ({ onRequest, onSseError, onSseEvent, responseTransforme
|
|
|
52
52
|
const { done, value } = await reader.read();
|
|
53
53
|
if (done) break;
|
|
54
54
|
buffer += value;
|
|
55
|
+
buffer = buffer.replace(/\r\n?/g, "\n");
|
|
55
56
|
const chunks = buffer.split("\n\n");
|
|
56
57
|
buffer = chunks.pop() ?? "";
|
|
57
58
|
for (const chunk of chunks) {
|
|
@@ -102,7 +103,7 @@ const createSseClient = ({ onRequest, onSseError, onSseEvent, responseTransforme
|
|
|
102
103
|
}
|
|
103
104
|
};
|
|
104
105
|
return { stream: createStream() };
|
|
105
|
-
}
|
|
106
|
+
}
|
|
106
107
|
|
|
107
108
|
//#endregion
|
|
108
109
|
//#region src/apiv2/core/pathSerializer.gen.ts
|
|
@@ -271,35 +272,36 @@ const getAuthToken = async (auth, callback) => {
|
|
|
271
272
|
|
|
272
273
|
//#endregion
|
|
273
274
|
//#region src/apiv2/client/utils.gen.ts
|
|
274
|
-
const createQuerySerializer = ({
|
|
275
|
+
const createQuerySerializer = ({ parameters = {}, ...args } = {}) => {
|
|
275
276
|
const querySerializer = (queryParams) => {
|
|
276
277
|
const search = [];
|
|
277
278
|
if (queryParams && typeof queryParams === "object") for (const name in queryParams) {
|
|
278
279
|
const value = queryParams[name];
|
|
279
280
|
if (value === void 0 || value === null) continue;
|
|
281
|
+
const options = parameters[name] || args;
|
|
280
282
|
if (Array.isArray(value)) {
|
|
281
283
|
const serializedArray = serializeArrayParam({
|
|
282
|
-
allowReserved,
|
|
284
|
+
allowReserved: options.allowReserved,
|
|
283
285
|
explode: true,
|
|
284
286
|
name,
|
|
285
287
|
style: "form",
|
|
286
288
|
value,
|
|
287
|
-
...array
|
|
289
|
+
...options.array
|
|
288
290
|
});
|
|
289
291
|
if (serializedArray) search.push(serializedArray);
|
|
290
292
|
} else if (typeof value === "object") {
|
|
291
293
|
const serializedObject = serializeObjectParam({
|
|
292
|
-
allowReserved,
|
|
294
|
+
allowReserved: options.allowReserved,
|
|
293
295
|
explode: true,
|
|
294
296
|
name,
|
|
295
297
|
style: "deepObject",
|
|
296
298
|
value,
|
|
297
|
-
...object
|
|
299
|
+
...options.object
|
|
298
300
|
});
|
|
299
301
|
if (serializedObject) search.push(serializedObject);
|
|
300
302
|
} else {
|
|
301
303
|
const serializedPrimitive = serializePrimitiveParam({
|
|
302
|
-
allowReserved,
|
|
304
|
+
allowReserved: options.allowReserved,
|
|
303
305
|
name,
|
|
304
306
|
value
|
|
305
307
|
});
|
|
@@ -387,35 +389,33 @@ const mergeHeaders = (...headers) => {
|
|
|
387
389
|
return mergedHeaders;
|
|
388
390
|
};
|
|
389
391
|
var Interceptors = class {
|
|
390
|
-
|
|
391
|
-
constructor() {
|
|
392
|
-
this._fns = [];
|
|
393
|
-
}
|
|
392
|
+
fns = [];
|
|
394
393
|
clear() {
|
|
395
|
-
this.
|
|
394
|
+
this.fns = [];
|
|
396
395
|
}
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
396
|
+
eject(id) {
|
|
397
|
+
const index = this.getInterceptorIndex(id);
|
|
398
|
+
if (this.fns[index]) this.fns[index] = null;
|
|
400
399
|
}
|
|
401
400
|
exists(id) {
|
|
402
401
|
const index = this.getInterceptorIndex(id);
|
|
403
|
-
return
|
|
402
|
+
return Boolean(this.fns[index]);
|
|
404
403
|
}
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
404
|
+
getInterceptorIndex(id) {
|
|
405
|
+
if (typeof id === "number") return this.fns[id] ? id : -1;
|
|
406
|
+
return this.fns.indexOf(id);
|
|
408
407
|
}
|
|
409
408
|
update(id, fn) {
|
|
410
409
|
const index = this.getInterceptorIndex(id);
|
|
411
|
-
if (this.
|
|
412
|
-
this.
|
|
410
|
+
if (this.fns[index]) {
|
|
411
|
+
this.fns[index] = fn;
|
|
413
412
|
return id;
|
|
414
|
-
}
|
|
413
|
+
}
|
|
414
|
+
return false;
|
|
415
415
|
}
|
|
416
416
|
use(fn) {
|
|
417
|
-
this.
|
|
418
|
-
return this.
|
|
417
|
+
this.fns.push(fn);
|
|
418
|
+
return this.fns.length - 1;
|
|
419
419
|
}
|
|
420
420
|
};
|
|
421
421
|
const createInterceptors = () => ({
|
|
@@ -468,9 +468,10 @@ const createClient = (config = {}) => {
|
|
|
468
468
|
if (opts.requestValidator) await opts.requestValidator(opts);
|
|
469
469
|
if (opts.body !== void 0 && opts.bodySerializer) opts.serializedBody = opts.bodySerializer(opts.body);
|
|
470
470
|
if (opts.body === void 0 || opts.serializedBody === "") opts.headers.delete("Content-Type");
|
|
471
|
+
const resolvedOpts = opts;
|
|
471
472
|
return {
|
|
472
|
-
opts,
|
|
473
|
-
url: buildUrl(
|
|
473
|
+
opts: resolvedOpts,
|
|
474
|
+
url: buildUrl(resolvedOpts)
|
|
474
475
|
};
|
|
475
476
|
};
|
|
476
477
|
const request = async (options) => {
|
|
@@ -481,10 +482,23 @@ const createClient = (config = {}) => {
|
|
|
481
482
|
body: getValidRequestBody(opts)
|
|
482
483
|
};
|
|
483
484
|
let request = new Request(url, requestInit);
|
|
484
|
-
for (const fn of interceptors.request.
|
|
485
|
+
for (const fn of interceptors.request.fns) if (fn) request = await fn(request, opts);
|
|
485
486
|
const _fetch = opts.fetch;
|
|
486
|
-
let response
|
|
487
|
-
|
|
487
|
+
let response;
|
|
488
|
+
try {
|
|
489
|
+
response = await _fetch(request);
|
|
490
|
+
} catch (error) {
|
|
491
|
+
let finalError = error;
|
|
492
|
+
for (const fn of interceptors.error.fns) if (fn) finalError = await fn(error, void 0, request, opts);
|
|
493
|
+
finalError = finalError || {};
|
|
494
|
+
if (opts.throwOnError) throw finalError;
|
|
495
|
+
return opts.responseStyle === "data" ? void 0 : {
|
|
496
|
+
error: finalError,
|
|
497
|
+
request,
|
|
498
|
+
response: void 0
|
|
499
|
+
};
|
|
500
|
+
}
|
|
501
|
+
for (const fn of interceptors.response.fns) if (fn) response = await fn(response, request, opts);
|
|
488
502
|
const result = {
|
|
489
503
|
request,
|
|
490
504
|
response
|
|
@@ -519,10 +533,14 @@ const createClient = (config = {}) => {
|
|
|
519
533
|
case "arrayBuffer":
|
|
520
534
|
case "blob":
|
|
521
535
|
case "formData":
|
|
522
|
-
case "json":
|
|
523
536
|
case "text":
|
|
524
537
|
data = await response[parseAs]();
|
|
525
538
|
break;
|
|
539
|
+
case "json": {
|
|
540
|
+
const text = await response.text();
|
|
541
|
+
data = text ? JSON.parse(text) : {};
|
|
542
|
+
break;
|
|
543
|
+
}
|
|
526
544
|
case "stream": return opts.responseStyle === "data" ? response.body : {
|
|
527
545
|
data: response.body,
|
|
528
546
|
...result
|
|
@@ -544,7 +562,7 @@ const createClient = (config = {}) => {
|
|
|
544
562
|
} catch {}
|
|
545
563
|
const error = jsonError ?? textError;
|
|
546
564
|
let finalError = error;
|
|
547
|
-
for (const fn of interceptors.error.
|
|
565
|
+
for (const fn of interceptors.error.fns) if (fn) finalError = await fn(error, response, request, opts);
|
|
548
566
|
finalError = finalError || {};
|
|
549
567
|
if (opts.throwOnError) throw finalError;
|
|
550
568
|
return opts.responseStyle === "data" ? void 0 : {
|
|
@@ -565,14 +583,19 @@ const createClient = (config = {}) => {
|
|
|
565
583
|
method,
|
|
566
584
|
onRequest: async (url, init) => {
|
|
567
585
|
let request = new Request(url, init);
|
|
568
|
-
for (const fn of interceptors.request.
|
|
586
|
+
for (const fn of interceptors.request.fns) if (fn) request = await fn(request, opts);
|
|
569
587
|
return request;
|
|
570
588
|
},
|
|
589
|
+
serializedBody: getValidRequestBody(opts),
|
|
571
590
|
url
|
|
572
591
|
});
|
|
573
592
|
};
|
|
593
|
+
const _buildUrl = (options) => buildUrl({
|
|
594
|
+
..._config,
|
|
595
|
+
...options
|
|
596
|
+
});
|
|
574
597
|
return {
|
|
575
|
-
buildUrl,
|
|
598
|
+
buildUrl: _buildUrl,
|
|
576
599
|
connect: makeMethodFn("CONNECT"),
|
|
577
600
|
delete: makeMethodFn("DELETE"),
|
|
578
601
|
get: makeMethodFn("GET"),
|
|
@@ -621,163 +644,143 @@ var sdk_gen_exports = /* @__PURE__ */ require_chunk.__exportAll({
|
|
|
621
644
|
/**
|
|
622
645
|
* List all MCP servers the caller has access to.
|
|
623
646
|
*/
|
|
624
|
-
const getServers = (options) => {
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
});
|
|
636
|
-
};
|
|
647
|
+
const getServers = (options) => (options?.client ?? client).get({
|
|
648
|
+
security: [{
|
|
649
|
+
scheme: "bearer",
|
|
650
|
+
type: "http"
|
|
651
|
+
}, {
|
|
652
|
+
scheme: "bearer",
|
|
653
|
+
type: "http"
|
|
654
|
+
}],
|
|
655
|
+
url: "/servers",
|
|
656
|
+
...options
|
|
657
|
+
});
|
|
637
658
|
/**
|
|
638
659
|
* Create a new MCP server. Requires `slug` and `transportConfig`. All other fields are optional with sensible defaults. Read-only fields are silently ignored.
|
|
639
660
|
*/
|
|
640
|
-
const postServers = (options) => {
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
});
|
|
656
|
-
};
|
|
661
|
+
const postServers = (options) => (options?.client ?? client).post({
|
|
662
|
+
security: [{
|
|
663
|
+
scheme: "bearer",
|
|
664
|
+
type: "http"
|
|
665
|
+
}, {
|
|
666
|
+
scheme: "bearer",
|
|
667
|
+
type: "http"
|
|
668
|
+
}],
|
|
669
|
+
url: "/servers",
|
|
670
|
+
...options,
|
|
671
|
+
headers: {
|
|
672
|
+
"Content-Type": "application/json",
|
|
673
|
+
...options?.headers
|
|
674
|
+
}
|
|
675
|
+
});
|
|
657
676
|
/**
|
|
658
677
|
* Delete an MCP server.
|
|
659
678
|
*/
|
|
660
|
-
const deleteServersBySlug = (options) => {
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
});
|
|
672
|
-
};
|
|
679
|
+
const deleteServersBySlug = (options) => (options.client ?? client).delete({
|
|
680
|
+
security: [{
|
|
681
|
+
scheme: "bearer",
|
|
682
|
+
type: "http"
|
|
683
|
+
}, {
|
|
684
|
+
scheme: "bearer",
|
|
685
|
+
type: "http"
|
|
686
|
+
}],
|
|
687
|
+
url: "/servers/{slug}",
|
|
688
|
+
...options
|
|
689
|
+
});
|
|
673
690
|
/**
|
|
674
691
|
* Get a single MCP server. The response body can be PUT back to update the server.
|
|
675
692
|
*/
|
|
676
|
-
const getServersBySlug = (options) => {
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
});
|
|
688
|
-
};
|
|
693
|
+
const getServersBySlug = (options) => (options.client ?? client).get({
|
|
694
|
+
security: [{
|
|
695
|
+
scheme: "bearer",
|
|
696
|
+
type: "http"
|
|
697
|
+
}, {
|
|
698
|
+
scheme: "bearer",
|
|
699
|
+
type: "http"
|
|
700
|
+
}],
|
|
701
|
+
url: "/servers/{slug}",
|
|
702
|
+
...options
|
|
703
|
+
});
|
|
689
704
|
/**
|
|
690
|
-
* Partially update an MCP server using JSON Merge Patch (RFC 7396). Send only the fields to change. Explicit `null` clears nullable fields (
|
|
705
|
+
* Partially update an MCP server using JSON Merge Patch (RFC 7396). Send only the fields to change. Explicit `null` clears nullable fields (oauthMetadata, oauthClientConfiguration). Absent fields are untouched. Read-only fields are silently ignored.
|
|
691
706
|
*/
|
|
692
|
-
const patchServersBySlug = (options) => {
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
});
|
|
708
|
-
};
|
|
707
|
+
const patchServersBySlug = (options) => (options.client ?? client).patch({
|
|
708
|
+
security: [{
|
|
709
|
+
scheme: "bearer",
|
|
710
|
+
type: "http"
|
|
711
|
+
}, {
|
|
712
|
+
scheme: "bearer",
|
|
713
|
+
type: "http"
|
|
714
|
+
}],
|
|
715
|
+
url: "/servers/{slug}",
|
|
716
|
+
...options,
|
|
717
|
+
headers: {
|
|
718
|
+
"Content-Type": "application/json",
|
|
719
|
+
...options.headers
|
|
720
|
+
}
|
|
721
|
+
});
|
|
709
722
|
/**
|
|
710
723
|
* Update an MCP server. Accepts the full server object from GET; read-only fields (id, tenantId, createdAt, updatedAt, lastToolRefreshAt) are silently ignored. Supports updating isEnabled, authorization, and config in a single call.
|
|
711
724
|
*/
|
|
712
|
-
const putServersBySlug = (options) => {
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
}
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
}
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
scheme: "bearer",
|
|
772
|
-
type: "http"
|
|
773
|
-
}, {
|
|
774
|
-
scheme: "bearer",
|
|
775
|
-
type: "http"
|
|
776
|
-
}],
|
|
777
|
-
url: "/credentials/{id}/secret",
|
|
778
|
-
...options
|
|
779
|
-
});
|
|
780
|
-
};
|
|
725
|
+
const putServersBySlug = (options) => (options.client ?? client).put({
|
|
726
|
+
security: [{
|
|
727
|
+
scheme: "bearer",
|
|
728
|
+
type: "http"
|
|
729
|
+
}, {
|
|
730
|
+
scheme: "bearer",
|
|
731
|
+
type: "http"
|
|
732
|
+
}],
|
|
733
|
+
url: "/servers/{slug}",
|
|
734
|
+
...options,
|
|
735
|
+
headers: {
|
|
736
|
+
"Content-Type": "application/json",
|
|
737
|
+
...options.headers
|
|
738
|
+
}
|
|
739
|
+
});
|
|
740
|
+
const getCredentials = (options) => (options?.client ?? client).get({
|
|
741
|
+
security: [{
|
|
742
|
+
scheme: "bearer",
|
|
743
|
+
type: "http"
|
|
744
|
+
}, {
|
|
745
|
+
scheme: "bearer",
|
|
746
|
+
type: "http"
|
|
747
|
+
}],
|
|
748
|
+
url: "/credentials",
|
|
749
|
+
...options
|
|
750
|
+
});
|
|
751
|
+
const deleteCredentialsById = (options) => (options.client ?? client).delete({
|
|
752
|
+
security: [{
|
|
753
|
+
scheme: "bearer",
|
|
754
|
+
type: "http"
|
|
755
|
+
}, {
|
|
756
|
+
scheme: "bearer",
|
|
757
|
+
type: "http"
|
|
758
|
+
}],
|
|
759
|
+
url: "/credentials/{id}",
|
|
760
|
+
...options
|
|
761
|
+
});
|
|
762
|
+
const getCredentialsById = (options) => (options.client ?? client).get({
|
|
763
|
+
security: [{
|
|
764
|
+
scheme: "bearer",
|
|
765
|
+
type: "http"
|
|
766
|
+
}, {
|
|
767
|
+
scheme: "bearer",
|
|
768
|
+
type: "http"
|
|
769
|
+
}],
|
|
770
|
+
url: "/credentials/{id}",
|
|
771
|
+
...options
|
|
772
|
+
});
|
|
773
|
+
const getCredentialsByIdSecret = (options) => (options.client ?? client).get({
|
|
774
|
+
security: [{
|
|
775
|
+
scheme: "bearer",
|
|
776
|
+
type: "http"
|
|
777
|
+
}, {
|
|
778
|
+
scheme: "bearer",
|
|
779
|
+
type: "http"
|
|
780
|
+
}],
|
|
781
|
+
url: "/credentials/{id}/secret",
|
|
782
|
+
...options
|
|
783
|
+
});
|
|
781
784
|
|
|
782
785
|
//#endregion
|
|
783
786
|
Object.defineProperty(exports, 'client', {
|