@replit/connectors 0.20.0 → 0.21.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/CHANGELOG.md +25 -0
- package/client.d.mts +1 -1
- package/client.d.mts.map +1 -1
- package/client.d.ts +1 -1
- package/client.d.ts.map +1 -1
- package/client.js +8 -7
- package/client.js.map +1 -1
- package/client.mjs +8 -7
- package/client.mjs.map +1 -1
- package/internal/tslib.js +17 -17
- package/internal/utils/query.d.mts +2 -0
- package/internal/utils/query.d.mts.map +1 -0
- package/internal/utils/query.d.ts +2 -0
- package/internal/utils/query.d.ts.map +1 -0
- package/internal/utils/query.js +10 -0
- package/internal/utils/query.js.map +1 -0
- package/internal/utils/query.mjs +6 -0
- package/internal/utils/query.mjs.map +1 -0
- package/internal/utils.d.mts +1 -0
- package/internal/utils.d.ts +1 -0
- package/internal/utils.js +1 -0
- package/internal/utils.js.map +1 -1
- package/internal/utils.mjs +1 -0
- package/package.json +12 -1
- package/resources/top-level.d.mts +5153 -2243
- package/resources/top-level.d.mts.map +1 -1
- package/resources/top-level.d.ts +5153 -2243
- package/resources/top-level.d.ts.map +1 -1
- package/src/client.ts +11 -10
- package/src/internal/utils/query.ts +7 -0
- package/src/internal/utils.ts +1 -0
- package/src/resources/top-level.ts +7689 -3698
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
package/src/client.ts
CHANGED
|
@@ -11,7 +11,7 @@ import type { APIResponseProps } from './internal/parse';
|
|
|
11
11
|
import { getPlatformHeaders } from './internal/detect-platform';
|
|
12
12
|
import * as Shims from './internal/shims';
|
|
13
13
|
import * as Opts from './internal/request-options';
|
|
14
|
-
import
|
|
14
|
+
import { stringifyQuery } from './internal/utils/query';
|
|
15
15
|
import { VERSION } from './version';
|
|
16
16
|
import * as Errors from './core/error';
|
|
17
17
|
import * as Pagination from './core/pagination';
|
|
@@ -466,8 +466,8 @@ export class Replit {
|
|
|
466
466
|
return buildHeaders([{ Authorization: `Bearer ${this.token}` }]);
|
|
467
467
|
}
|
|
468
468
|
|
|
469
|
-
protected stringifyQuery(query: Record<string, unknown>): string {
|
|
470
|
-
return
|
|
469
|
+
protected stringifyQuery(query: object | Record<string, unknown>): string {
|
|
470
|
+
return stringifyQuery(query);
|
|
471
471
|
}
|
|
472
472
|
|
|
473
473
|
private getUserAgent(): string {
|
|
@@ -499,12 +499,13 @@ export class Replit {
|
|
|
499
499
|
: new URL(baseURL + (baseURL.endsWith('/') && path.startsWith('/') ? path.slice(1) : path));
|
|
500
500
|
|
|
501
501
|
const defaultQuery = this.defaultQuery();
|
|
502
|
-
|
|
503
|
-
|
|
502
|
+
const pathQuery = Object.fromEntries(url.searchParams);
|
|
503
|
+
if (!isEmptyObj(defaultQuery) || !isEmptyObj(pathQuery)) {
|
|
504
|
+
query = { ...pathQuery, ...defaultQuery, ...query };
|
|
504
505
|
}
|
|
505
506
|
|
|
506
507
|
if (typeof query === 'object' && query && !Array.isArray(query)) {
|
|
507
|
-
url.search = this.stringifyQuery(query
|
|
508
|
+
url.search = this.stringifyQuery(query);
|
|
508
509
|
}
|
|
509
510
|
|
|
510
511
|
return url.toString();
|
|
@@ -833,9 +834,9 @@ export class Replit {
|
|
|
833
834
|
}
|
|
834
835
|
}
|
|
835
836
|
|
|
836
|
-
// If the API asks us to wait a certain amount of time
|
|
837
|
-
//
|
|
838
|
-
if (
|
|
837
|
+
// If the API asks us to wait a certain amount of time, just do what it
|
|
838
|
+
// says, but otherwise calculate a default
|
|
839
|
+
if (timeoutMillis === undefined) {
|
|
839
840
|
const maxRetries = options.maxRetries ?? this.maxRetries;
|
|
840
841
|
timeoutMillis = this.calculateDefaultRetryTimeoutMillis(retriesRemaining, maxRetries);
|
|
841
842
|
}
|
|
@@ -967,7 +968,7 @@ export class Replit {
|
|
|
967
968
|
) {
|
|
968
969
|
return {
|
|
969
970
|
bodyHeaders: { 'content-type': 'application/x-www-form-urlencoded' },
|
|
970
|
-
body: this.stringifyQuery(body
|
|
971
|
+
body: this.stringifyQuery(body),
|
|
971
972
|
};
|
|
972
973
|
} else {
|
|
973
974
|
return this.#encoder({ body, headers });
|
package/src/internal/utils.ts
CHANGED