@replit/connectors 0.19.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 +33 -0
- package/client.d.mts +9 -9
- package/client.d.mts.map +1 -1
- package/client.d.ts +9 -9
- package/client.d.ts.map +1 -1
- package/client.js +16 -15
- package/client.js.map +1 -1
- package/client.mjs +16 -15
- 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/index.d.mts +1 -1
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +1 -1
- package/resources/index.d.ts.map +1 -1
- package/resources/top-level.d.mts +4854 -1944
- package/resources/top-level.d.mts.map +1 -1
- package/resources/top-level.d.ts +4854 -1944
- package/resources/top-level.d.ts.map +1 -1
- package/src/client.ts +48 -47
- package/src/internal/utils/query.ts +7 -0
- package/src/internal/utils.ts +1 -0
- package/src/resources/index.ts +7 -7
- package/src/resources/top-level.ts +7062 -3071
- 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';
|
|
@@ -27,8 +27,8 @@ import {
|
|
|
27
27
|
ConnectorRpcResponse,
|
|
28
28
|
CreateConnectionParams,
|
|
29
29
|
CreateConnectionResponse,
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
CreateConnectorConfigParams,
|
|
31
|
+
CreateConnectorConfigResponse,
|
|
32
32
|
CreateTokenParams,
|
|
33
33
|
CreateTokenResponse,
|
|
34
34
|
DeleteAssignmentParams,
|
|
@@ -44,12 +44,12 @@ import {
|
|
|
44
44
|
ListConnectionsParams,
|
|
45
45
|
ListConnectionsResponse,
|
|
46
46
|
ListConnectionsResponsesOffsetPagination,
|
|
47
|
+
ListConnectorConfigsParams,
|
|
48
|
+
ListConnectorConfigsResponse,
|
|
49
|
+
ListConnectorConfigsResponsesOffsetPagination,
|
|
47
50
|
ListConnectorsParams,
|
|
48
51
|
ListConnectorsResponse,
|
|
49
52
|
ListConnectorsResponsesOffsetPagination,
|
|
50
|
-
ListConnnectorConfigsParams,
|
|
51
|
-
ListConnnectorConfigsResponse,
|
|
52
|
-
ListConnnectorConfigsResponsesOffsetPagination,
|
|
53
53
|
ListEventsParams,
|
|
54
54
|
ListEventsResponse,
|
|
55
55
|
ListEventsResponsesOffsetPagination,
|
|
@@ -59,8 +59,8 @@ import {
|
|
|
59
59
|
PreConfigureConnectorResponse,
|
|
60
60
|
PreConnectParams,
|
|
61
61
|
PreConnectResponse,
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
UpsertConnectorConfigParams,
|
|
63
|
+
UpsertConnectorConfigResponse,
|
|
64
64
|
} from './resources/top-level';
|
|
65
65
|
import { APIPromise } from './core/api-promise';
|
|
66
66
|
import { type Fetch } from './internal/builtin-types';
|
|
@@ -283,10 +283,10 @@ export class Replit {
|
|
|
283
283
|
return this.post('/v2/connection', { body, ...options });
|
|
284
284
|
}
|
|
285
285
|
|
|
286
|
-
|
|
287
|
-
body: TopLevelAPI.
|
|
286
|
+
createConnectorConfig(
|
|
287
|
+
body: TopLevelAPI.CreateConnectorConfigParams,
|
|
288
288
|
options?: RequestOptions,
|
|
289
|
-
): APIPromise<TopLevelAPI.
|
|
289
|
+
): APIPromise<TopLevelAPI.CreateConnectorConfigResponse> {
|
|
290
290
|
return this.post('/v2/connector-config', { body, ...options });
|
|
291
291
|
}
|
|
292
292
|
|
|
@@ -370,6 +370,23 @@ export class Replit {
|
|
|
370
370
|
);
|
|
371
371
|
}
|
|
372
372
|
|
|
373
|
+
/**
|
|
374
|
+
* List Configured Connectors
|
|
375
|
+
*/
|
|
376
|
+
listConnectorConfigs(
|
|
377
|
+
query: TopLevelAPI.ListConnectorConfigsParams | null | undefined = {},
|
|
378
|
+
options?: RequestOptions,
|
|
379
|
+
): Pagination.PagePromise<
|
|
380
|
+
ListConnectorConfigsResponsesOffsetPagination,
|
|
381
|
+
TopLevelAPI.ListConnectorConfigsResponse
|
|
382
|
+
> {
|
|
383
|
+
return this.getAPIList(
|
|
384
|
+
'/v2/connector-config',
|
|
385
|
+
Pagination.OffsetPagination<TopLevelAPI.ListConnectorConfigsResponse>,
|
|
386
|
+
{ query, ...options },
|
|
387
|
+
);
|
|
388
|
+
}
|
|
389
|
+
|
|
373
390
|
/**
|
|
374
391
|
* List all connectors to understand what integrations are available to configure
|
|
375
392
|
*/
|
|
@@ -383,23 +400,6 @@ export class Replit {
|
|
|
383
400
|
});
|
|
384
401
|
}
|
|
385
402
|
|
|
386
|
-
/**
|
|
387
|
-
* List Configured Connectors
|
|
388
|
-
*/
|
|
389
|
-
listConnnectorConfigs(
|
|
390
|
-
query: TopLevelAPI.ListConnnectorConfigsParams | null | undefined = {},
|
|
391
|
-
options?: RequestOptions,
|
|
392
|
-
): Pagination.PagePromise<
|
|
393
|
-
ListConnnectorConfigsResponsesOffsetPagination,
|
|
394
|
-
TopLevelAPI.ListConnnectorConfigsResponse
|
|
395
|
-
> {
|
|
396
|
-
return this.getAPIList(
|
|
397
|
-
'/v2/connector-config',
|
|
398
|
-
Pagination.OffsetPagination<TopLevelAPI.ListConnnectorConfigsResponse>,
|
|
399
|
-
{ query, ...options },
|
|
400
|
-
);
|
|
401
|
-
}
|
|
402
|
-
|
|
403
403
|
/**
|
|
404
404
|
* List all events for an organization
|
|
405
405
|
*/
|
|
@@ -434,11 +434,11 @@ export class Replit {
|
|
|
434
434
|
return this.post('/v1/connect/pre-connect', { body, ...options });
|
|
435
435
|
}
|
|
436
436
|
|
|
437
|
-
|
|
437
|
+
upsertConnectorConfig(
|
|
438
438
|
id: string,
|
|
439
|
-
body: TopLevelAPI.
|
|
439
|
+
body: TopLevelAPI.UpsertConnectorConfigParams,
|
|
440
440
|
options?: RequestOptions,
|
|
441
|
-
): APIPromise<TopLevelAPI.
|
|
441
|
+
): APIPromise<TopLevelAPI.UpsertConnectorConfigResponse> {
|
|
442
442
|
return this.put(path`/v2/connector-config/${id}`, { body, ...options });
|
|
443
443
|
}
|
|
444
444
|
|
|
@@ -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 });
|
|
@@ -1010,7 +1011,7 @@ export declare namespace Replit {
|
|
|
1010
1011
|
type CheckConnectionResponse as CheckConnectionResponse,
|
|
1011
1012
|
type ConnectorRpcResponse as ConnectorRpcResponse,
|
|
1012
1013
|
type CreateConnectionResponse as CreateConnectionResponse,
|
|
1013
|
-
type
|
|
1014
|
+
type CreateConnectorConfigResponse as CreateConnectorConfigResponse,
|
|
1014
1015
|
type CreateTokenResponse as CreateTokenResponse,
|
|
1015
1016
|
type DeleteAssignmentResponse as DeleteAssignmentResponse,
|
|
1016
1017
|
type DeleteConnectionResponse as DeleteConnectionResponse,
|
|
@@ -1019,32 +1020,32 @@ export declare namespace Replit {
|
|
|
1019
1020
|
type GetConnectionResponse as GetConnectionResponse,
|
|
1020
1021
|
type ListAssignmentsResponse as ListAssignmentsResponse,
|
|
1021
1022
|
type ListConnectionsResponse as ListConnectionsResponse,
|
|
1023
|
+
type ListConnectorConfigsResponse as ListConnectorConfigsResponse,
|
|
1022
1024
|
type ListConnectorsResponse as ListConnectorsResponse,
|
|
1023
|
-
type ListConnnectorConfigsResponse as ListConnnectorConfigsResponse,
|
|
1024
1025
|
type ListEventsResponse as ListEventsResponse,
|
|
1025
1026
|
type PostConnectResponse as PostConnectResponse,
|
|
1026
1027
|
type PreConfigureConnectorResponse as PreConfigureConnectorResponse,
|
|
1027
1028
|
type PreConnectResponse as PreConnectResponse,
|
|
1028
|
-
type
|
|
1029
|
+
type UpsertConnectorConfigResponse as UpsertConnectorConfigResponse,
|
|
1029
1030
|
type ListConnectionsResponsesOffsetPagination as ListConnectionsResponsesOffsetPagination,
|
|
1031
|
+
type ListConnectorConfigsResponsesOffsetPagination as ListConnectorConfigsResponsesOffsetPagination,
|
|
1030
1032
|
type ListConnectorsResponsesOffsetPagination as ListConnectorsResponsesOffsetPagination,
|
|
1031
|
-
type ListConnnectorConfigsResponsesOffsetPagination as ListConnnectorConfigsResponsesOffsetPagination,
|
|
1032
1033
|
type ListEventsResponsesOffsetPagination as ListEventsResponsesOffsetPagination,
|
|
1033
1034
|
type AssignConnectionParams as AssignConnectionParams,
|
|
1034
1035
|
type ConnectorRpcParams as ConnectorRpcParams,
|
|
1035
1036
|
type CreateConnectionParams as CreateConnectionParams,
|
|
1036
|
-
type
|
|
1037
|
+
type CreateConnectorConfigParams as CreateConnectorConfigParams,
|
|
1037
1038
|
type CreateTokenParams as CreateTokenParams,
|
|
1038
1039
|
type DeleteAssignmentParams as DeleteAssignmentParams,
|
|
1039
1040
|
type GetConectorConfigParams as GetConectorConfigParams,
|
|
1040
1041
|
type GetConnectionParams as GetConnectionParams,
|
|
1041
1042
|
type ListConnectionsParams as ListConnectionsParams,
|
|
1043
|
+
type ListConnectorConfigsParams as ListConnectorConfigsParams,
|
|
1042
1044
|
type ListConnectorsParams as ListConnectorsParams,
|
|
1043
|
-
type ListConnnectorConfigsParams as ListConnnectorConfigsParams,
|
|
1044
1045
|
type ListEventsParams as ListEventsParams,
|
|
1045
1046
|
type PostConnectParams as PostConnectParams,
|
|
1046
1047
|
type PreConfigureConnectorParams as PreConfigureConnectorParams,
|
|
1047
1048
|
type PreConnectParams as PreConnectParams,
|
|
1048
|
-
type
|
|
1049
|
+
type UpsertConnectorConfigParams as UpsertConnectorConfigParams,
|
|
1049
1050
|
};
|
|
1050
1051
|
}
|
package/src/internal/utils.ts
CHANGED
package/src/resources/index.ts
CHANGED
|
@@ -7,7 +7,7 @@ export {
|
|
|
7
7
|
type CheckConnectionResponse,
|
|
8
8
|
type ConnectorRpcResponse,
|
|
9
9
|
type CreateConnectionResponse,
|
|
10
|
-
type
|
|
10
|
+
type CreateConnectorConfigResponse,
|
|
11
11
|
type CreateTokenResponse,
|
|
12
12
|
type DeleteAssignmentResponse,
|
|
13
13
|
type DeleteConnectionResponse,
|
|
@@ -16,31 +16,31 @@ export {
|
|
|
16
16
|
type GetConnectionResponse,
|
|
17
17
|
type ListAssignmentsResponse,
|
|
18
18
|
type ListConnectionsResponse,
|
|
19
|
+
type ListConnectorConfigsResponse,
|
|
19
20
|
type ListConnectorsResponse,
|
|
20
|
-
type ListConnnectorConfigsResponse,
|
|
21
21
|
type ListEventsResponse,
|
|
22
22
|
type PostConnectResponse,
|
|
23
23
|
type PreConfigureConnectorResponse,
|
|
24
24
|
type PreConnectResponse,
|
|
25
|
-
type
|
|
25
|
+
type UpsertConnectorConfigResponse,
|
|
26
26
|
type AssignConnectionParams,
|
|
27
27
|
type ConnectorRpcParams,
|
|
28
28
|
type CreateConnectionParams,
|
|
29
|
-
type
|
|
29
|
+
type CreateConnectorConfigParams,
|
|
30
30
|
type CreateTokenParams,
|
|
31
31
|
type DeleteAssignmentParams,
|
|
32
32
|
type GetConectorConfigParams,
|
|
33
33
|
type GetConnectionParams,
|
|
34
34
|
type ListConnectionsParams,
|
|
35
|
+
type ListConnectorConfigsParams,
|
|
35
36
|
type ListConnectorsParams,
|
|
36
|
-
type ListConnnectorConfigsParams,
|
|
37
37
|
type ListEventsParams,
|
|
38
38
|
type PostConnectParams,
|
|
39
39
|
type PreConfigureConnectorParams,
|
|
40
40
|
type PreConnectParams,
|
|
41
|
-
type
|
|
41
|
+
type UpsertConnectorConfigParams,
|
|
42
42
|
type ListConnectionsResponsesOffsetPagination,
|
|
43
|
+
type ListConnectorConfigsResponsesOffsetPagination,
|
|
43
44
|
type ListConnectorsResponsesOffsetPagination,
|
|
44
|
-
type ListConnnectorConfigsResponsesOffsetPagination,
|
|
45
45
|
type ListEventsResponsesOffsetPagination,
|
|
46
46
|
} from './top-level';
|