@bagelink/sdk 0.0.476 → 0.0.481
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/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
- package/src/index.ts +1 -2
- package/src/openAPITools/functionGenerator.ts +1 -0
- package/src/openAPITools/utils.ts +1 -0
package/dist/index.cjs
CHANGED
|
@@ -477,7 +477,7 @@ class Bagel {
|
|
|
477
477
|
this._setAuthorization();
|
|
478
478
|
endpoint = this._endpointCleaner(endpoint);
|
|
479
479
|
if (endpoint.match(/undefined|null/))
|
|
480
|
-
throw new Error(
|
|
480
|
+
throw new Error(`Invalid endpoint: ${endpoint}`);
|
|
481
481
|
if (query) {
|
|
482
482
|
const queryParams = Object.entries(query).filter(([_, value]) => !!value).map(([key, value]) => `${key}=${value}`).join("&");
|
|
483
483
|
if (queryParams)
|
package/dist/index.mjs
CHANGED
|
@@ -471,7 +471,7 @@ class Bagel {
|
|
|
471
471
|
this._setAuthorization();
|
|
472
472
|
endpoint = this._endpointCleaner(endpoint);
|
|
473
473
|
if (endpoint.match(/undefined|null/))
|
|
474
|
-
throw new Error(
|
|
474
|
+
throw new Error(`Invalid endpoint: ${endpoint}`);
|
|
475
475
|
if (query) {
|
|
476
476
|
const queryParams = Object.entries(query).filter(([_, value]) => !!value).map(([key, value]) => `${key}=${value}`).join("&");
|
|
477
477
|
if (queryParams)
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -237,10 +237,9 @@ export class Bagel {
|
|
|
237
237
|
): Promise<T> {
|
|
238
238
|
this._setAuthorization()
|
|
239
239
|
endpoint = this._endpointCleaner(endpoint)
|
|
240
|
-
if (endpoint.match(/undefined|null/)) throw new Error(
|
|
240
|
+
if (endpoint.match(/undefined|null/)) throw new Error(`Invalid endpoint: ${endpoint}`)
|
|
241
241
|
if (query) {
|
|
242
242
|
const queryParams = Object.entries(query)
|
|
243
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
244
243
|
.filter(([_, value]) => !!value)
|
|
245
244
|
.map(([key, value]) => `${key}=${value}`)
|
|
246
245
|
.join('&')
|
|
@@ -87,6 +87,7 @@ function generateAxiosFunction(
|
|
|
87
87
|
return axiosFunction
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
+
// eslint-disable-next-line regexp/no-unused-capturing-group
|
|
90
91
|
const pathParamRegex = /\{([^}]+)\}/g
|
|
91
92
|
function getParamsFromPath(path: string) {
|
|
92
93
|
const params = path.match(pathParamRegex)?.map(p => p.slice(1, -1))
|
|
@@ -4,6 +4,7 @@ export const toCamelCase = (str?: string) => str?.replace(/[-._\s]+(.)?/g, (_, c
|
|
|
4
4
|
export const toPascalCase = (str?: string) => str?.replace(/[-_\s]+(.)?/g, (_, c) => c?.toUpperCase() || '').replace(/^./, str => str.toUpperCase()) || str
|
|
5
5
|
|
|
6
6
|
export function formatType(typeName: string): string {
|
|
7
|
+
// eslint-disable-next-line regexp/no-unused-capturing-group
|
|
7
8
|
typeName = typeName.replace(/-/g, '').replace(/(post|put)$/gi, '').replace(/^body_/gi, '')
|
|
8
9
|
return toPascalCase(typeName)!
|
|
9
10
|
}
|