@membranehq/sdk 0.28.1 → 0.28.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/bundle.d.ts +53 -4
- package/dist/bundle.js +75 -9
- package/dist/bundle.js.map +1 -1
- package/dist/dts/accessors/actions-accessors.d.ts +1 -0
- package/dist/dts/accessors/connections-accessors.d.ts +4 -0
- package/dist/dts/accessors/integrations-accessors.d.ts +3 -0
- package/dist/dts/agent/session.d.ts +10 -1
- package/dist/dts/ai-gateway/models.d.ts +43 -0
- package/dist/dts/ai-gateway/models.test.d.ts +1 -0
- package/dist/dts/alerts/types.d.ts +7 -0
- package/dist/dts/api-client.d.ts +22 -3
- package/dist/dts/api-version.generated.d.ts +1 -1
- package/dist/dts/index.browser.d.ts +1 -0
- package/dist/dts/membrane-instances/types.d.ts +23 -35
- package/dist/dts/membrane-instances/types.test.d.ts +1 -0
- package/dist/dts/orgs/types.d.ts +55 -11
- package/dist/dts/webhooks/types.d.ts +3 -2
- package/dist/dts/workspace-elements/api/act-api.d.ts +33 -0
- package/dist/dts/workspace-elements/api/action-run-log-records-api.d.ts +2 -0
- package/dist/dts/workspace-elements/api/actions-api.d.ts +3 -0
- package/dist/dts/workspace-elements/api/connections-api.d.ts +15 -2
- package/dist/dts/workspace-elements/api/data-link-table-instances-api.d.ts +2 -0
- package/dist/dts/workspace-elements/api/data-sources-api.d.ts +4 -0
- package/dist/dts/workspace-elements/api/external-api-logs-api.d.ts +1 -0
- package/dist/dts/workspace-elements/api/external-event-log-records-api.d.ts +1 -0
- package/dist/dts/workspace-elements/api/external-event-pulls-api.d.ts +1 -0
- package/dist/dts/workspace-elements/api/external-event-subscriptions-api.d.ts +4 -1
- package/dist/dts/workspace-elements/api/field-mappings-api.d.ts +4 -0
- package/dist/dts/workspace-elements/api/flow-runs-api.d.ts +2 -0
- package/dist/dts/workspace-elements/api/flows-api.d.ts +3 -0
- package/dist/dts/workspace-elements/api/incoming-webhooks-api.d.ts +1 -0
- package/dist/dts/workspace-elements/api/index.d.ts +1 -0
- package/dist/dts/workspace-elements/api/integrations-api.d.ts +112 -0
- package/dist/dts/workspace-elements/api/packages-api.d.ts +1 -0
- package/dist/dts/workspace-elements/base/connection-requests/index.d.ts +2 -0
- package/dist/dts/workspace-elements/base/connections/index.d.ts +2 -0
- package/dist/dts/workspace-elements/types.d.ts +4 -1
- package/dist/dts/workspaces/api.d.ts +20 -0
- package/dist/dts/workspaces/compare.d.ts +2 -0
- package/dist/dts/workspaces/types.d.ts +29 -0
- package/dist/index.browser.d.mts +417 -57
- package/dist/index.browser.d.ts +417 -57
- package/dist/index.browser.js +236 -27
- package/dist/index.browser.js.map +1 -1
- package/dist/index.browser.mjs +226 -28
- package/dist/index.browser.mjs.map +1 -1
- package/dist/index.node.d.mts +417 -57
- package/dist/index.node.d.ts +417 -57
- package/dist/index.node.js +236 -27
- package/dist/index.node.js.map +1 -1
- package/dist/index.node.mjs +226 -28
- package/dist/index.node.mjs.map +1 -1
- package/package.json +1 -1
package/dist/bundle.d.ts
CHANGED
|
@@ -25,24 +25,42 @@ interface LogRecord {
|
|
|
25
25
|
data?: any;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
interface
|
|
29
|
-
token?: string;
|
|
30
|
-
fetchToken?: () => Promise<string>;
|
|
28
|
+
interface BaseClientOptions {
|
|
31
29
|
credentials?: any;
|
|
32
30
|
fetchCredentials?: () => Promise<any>;
|
|
33
31
|
apiUri?: string;
|
|
34
32
|
uiUri?: string;
|
|
33
|
+
}
|
|
34
|
+
interface TokenBasedClientOptions extends BaseClientOptions {
|
|
35
|
+
token?: string;
|
|
36
|
+
fetchToken?: () => Promise<string>;
|
|
37
|
+
workspaceKey?: never;
|
|
38
|
+
workspaceSecret?: never;
|
|
39
|
+
tenantKey?: never;
|
|
35
40
|
accessToken?: string;
|
|
36
41
|
}
|
|
42
|
+
interface WorkspaceCredentialClientOptions extends BaseClientOptions {
|
|
43
|
+
token?: never;
|
|
44
|
+
fetchToken?: never;
|
|
45
|
+
workspaceKey: string;
|
|
46
|
+
workspaceSecret: string;
|
|
47
|
+
tenantKey: string;
|
|
48
|
+
accessToken?: never;
|
|
49
|
+
}
|
|
50
|
+
type MembraneClientOptions = TokenBasedClientOptions | WorkspaceCredentialClientOptions;
|
|
37
51
|
declare class MembraneApiClient {
|
|
38
52
|
apiUri: string;
|
|
39
53
|
uiUri: string;
|
|
40
54
|
token?: string;
|
|
41
55
|
protected fetchToken?: () => Promise<string>;
|
|
42
56
|
private logs;
|
|
57
|
+
private _workspaceKey?;
|
|
58
|
+
private _workspaceSecret?;
|
|
59
|
+
private _tenantKey?;
|
|
43
60
|
constructor(options?: MembraneClientOptions);
|
|
44
61
|
setCredentials(credentials: any): Promise<any>;
|
|
45
62
|
getToken(): Promise<string>;
|
|
63
|
+
private mintToken;
|
|
46
64
|
get<T = any>(uri: string, queryParams?: Record<string, any>, options?: AxiosRequestConfig): Promise<T>;
|
|
47
65
|
post<T = any>(uri: string, data?: any, options?: AxiosRequestConfig): Promise<T>;
|
|
48
66
|
put<T = any>(uri: string, data?: any, options?: AxiosRequestConfig): Promise<T>;
|
|
@@ -129,7 +147,8 @@ declare enum WorkspaceElementState {
|
|
|
129
147
|
CLIENT_ACTION_REQUIRED = "CLIENT_ACTION_REQUIRED",
|
|
130
148
|
CONFIGURATION_ERROR = "CONFIGURATION_ERROR",
|
|
131
149
|
SETUP_FAILED = "SETUP_FAILED",
|
|
132
|
-
READY = "READY"
|
|
150
|
+
READY = "READY",
|
|
151
|
+
DISCONNECTING = "DISCONNECTING"
|
|
133
152
|
}
|
|
134
153
|
|
|
135
154
|
interface BaseElementInstance {
|
|
@@ -370,6 +389,7 @@ declare const CreateConnectionRequest: z.ZodObject<{
|
|
|
370
389
|
name: z.ZodOptional<z.ZodString>;
|
|
371
390
|
meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
372
391
|
authOptionKey: z.ZodOptional<z.ZodString>;
|
|
392
|
+
key: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
373
393
|
integrationId: z.ZodOptional<z.ZodString>;
|
|
374
394
|
integrationUuid: z.ZodOptional<z.ZodString>;
|
|
375
395
|
integrationKey: z.ZodOptional<z.ZodString>;
|
|
@@ -389,6 +409,7 @@ declare const UpdateConnectionRequest: z.ZodObject<{
|
|
|
389
409
|
name: z.ZodOptional<z.ZodString>;
|
|
390
410
|
meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
391
411
|
authOptionKey: z.ZodOptional<z.ZodString>;
|
|
412
|
+
key: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
392
413
|
integrationId: z.ZodOptional<z.ZodString>;
|
|
393
414
|
integrationUuid: z.ZodOptional<z.ZodString>;
|
|
394
415
|
integrationKey: z.ZodOptional<z.ZodString>;
|
|
@@ -409,11 +430,13 @@ declare const ConnectionSelector: z.ZodObject<{
|
|
|
409
430
|
integrationKey: z.ZodOptional<z.ZodString>;
|
|
410
431
|
integrationId: z.ZodOptional<z.ZodString>;
|
|
411
432
|
connectionId: z.ZodOptional<z.ZodString>;
|
|
433
|
+
connectionKey: z.ZodOptional<z.ZodString>;
|
|
412
434
|
}, z.core.$strip>;
|
|
413
435
|
type ConnectionSelector = z.infer<typeof ConnectionSelector>;
|
|
414
436
|
declare const ConnectionApiResponse: z.ZodObject<{
|
|
415
437
|
id: z.ZodString;
|
|
416
438
|
name: z.ZodString;
|
|
439
|
+
key: z.ZodOptional<z.ZodString>;
|
|
417
440
|
isTest: z.ZodOptional<z.ZodBoolean>;
|
|
418
441
|
connected: z.ZodOptional<z.ZodBoolean>;
|
|
419
442
|
disconnected: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -511,6 +534,8 @@ declare const ConnectionApiResponse: z.ZodObject<{
|
|
|
511
534
|
parameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
512
535
|
}, z.core.$strip>>>;
|
|
513
536
|
}, z.core.$strip>>;
|
|
537
|
+
connectorParameters: z.ZodOptional<z.ZodUnknown>;
|
|
538
|
+
input: z.ZodOptional<z.ZodUnknown>;
|
|
514
539
|
}, z.core.$strip>;
|
|
515
540
|
type ConnectionApiResponse = z.infer<typeof ConnectionApiResponse>;
|
|
516
541
|
declare const ConnectPayload: z.ZodObject<{
|
|
@@ -521,6 +546,7 @@ declare const ConnectPayload: z.ZodObject<{
|
|
|
521
546
|
connectorKey: z.ZodOptional<z.ZodString>;
|
|
522
547
|
connectorVersion: z.ZodOptional<z.ZodString>;
|
|
523
548
|
connectionId: z.ZodOptional<z.ZodString>;
|
|
549
|
+
connectionKey: z.ZodOptional<z.ZodString>;
|
|
524
550
|
name: z.ZodOptional<z.ZodString>;
|
|
525
551
|
input: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
526
552
|
connectionParameters: z.ZodOptional<z.ZodAny>;
|
|
@@ -539,6 +565,7 @@ declare const ConnectUIOptions: z.ZodObject<{
|
|
|
539
565
|
integrationKey: z.ZodOptional<z.ZodString>;
|
|
540
566
|
name: z.ZodOptional<z.ZodString>;
|
|
541
567
|
intent: z.ZodOptional<z.ZodString>;
|
|
568
|
+
connectionKey: z.ZodOptional<z.ZodString>;
|
|
542
569
|
authOptionKey: z.ZodOptional<z.ZodString>;
|
|
543
570
|
connectorParameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
544
571
|
connectorId: z.ZodOptional<z.ZodString>;
|
|
@@ -798,6 +825,7 @@ declare const FindActionsQuery: z.ZodObject<{
|
|
|
798
825
|
integrationKey: z.ZodOptional<z.ZodString>;
|
|
799
826
|
integrationId: z.ZodOptional<z.ZodString>;
|
|
800
827
|
connectionId: z.ZodOptional<z.ZodString>;
|
|
828
|
+
connectionKey: z.ZodOptional<z.ZodString>;
|
|
801
829
|
instanceKey: z.ZodOptional<z.ZodString>;
|
|
802
830
|
search: z.ZodOptional<z.ZodString>;
|
|
803
831
|
limit: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
@@ -942,6 +970,7 @@ declare class ActionAccessor<RunInput = any, RunOutput = any> extends ElementAcc
|
|
|
942
970
|
run(input?: RunInput, options?: {
|
|
943
971
|
integrationKey?: string;
|
|
944
972
|
connectionId?: string;
|
|
973
|
+
connectionKey?: string;
|
|
945
974
|
}): Promise<ActionRunResponse<RunOutput>>;
|
|
946
975
|
}
|
|
947
976
|
declare class IntegrationLevelActionAccessor extends IntegrationLevelElementAccessor<ActionApiResponse, UpdateActionRequest> {
|
|
@@ -3633,6 +3662,7 @@ declare const FlowRunApiResponse: z.ZodObject<{
|
|
|
3633
3662
|
connection: z.ZodOptional<z.ZodObject<{
|
|
3634
3663
|
id: z.ZodString;
|
|
3635
3664
|
name: z.ZodString;
|
|
3665
|
+
key: z.ZodOptional<z.ZodString>;
|
|
3636
3666
|
isTest: z.ZodOptional<z.ZodBoolean>;
|
|
3637
3667
|
connected: z.ZodOptional<z.ZodBoolean>;
|
|
3638
3668
|
disconnected: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -3837,6 +3867,7 @@ declare const FindFlowRunsResponse: z.ZodObject<{
|
|
|
3837
3867
|
connection: z.ZodOptional<z.ZodObject<{
|
|
3838
3868
|
id: z.ZodString;
|
|
3839
3869
|
name: z.ZodString;
|
|
3870
|
+
key: z.ZodOptional<z.ZodString>;
|
|
3840
3871
|
isTest: z.ZodOptional<z.ZodBoolean>;
|
|
3841
3872
|
connected: z.ZodOptional<z.ZodBoolean>;
|
|
3842
3873
|
disconnected: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -4191,6 +4222,7 @@ declare const FlowApiResponse: z.ZodObject<{
|
|
|
4191
4222
|
connection: z.ZodOptional<z.ZodObject<{
|
|
4192
4223
|
id: z.ZodString;
|
|
4193
4224
|
name: z.ZodString;
|
|
4225
|
+
key: z.ZodOptional<z.ZodString>;
|
|
4194
4226
|
isTest: z.ZodOptional<z.ZodBoolean>;
|
|
4195
4227
|
connected: z.ZodOptional<z.ZodBoolean>;
|
|
4196
4228
|
disconnected: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -4316,6 +4348,7 @@ declare const FindFlowsQuery: z.ZodObject<{
|
|
|
4316
4348
|
integration: "integration";
|
|
4317
4349
|
universal: "universal";
|
|
4318
4350
|
}>>;
|
|
4351
|
+
connectionKey: z.ZodOptional<z.ZodString>;
|
|
4319
4352
|
universalParentId: z.ZodOptional<z.ZodString>;
|
|
4320
4353
|
tenantId: z.ZodOptional<z.ZodString>;
|
|
4321
4354
|
flowId: z.ZodOptional<z.ZodString>;
|
|
@@ -4875,6 +4908,7 @@ declare const DataSourceApiResponse: z.ZodObject<{
|
|
|
4875
4908
|
connection: z.ZodOptional<z.ZodObject<{
|
|
4876
4909
|
id: z.ZodString;
|
|
4877
4910
|
name: z.ZodString;
|
|
4911
|
+
key: z.ZodOptional<z.ZodString>;
|
|
4878
4912
|
isTest: z.ZodOptional<z.ZodBoolean>;
|
|
4879
4913
|
connected: z.ZodOptional<z.ZodBoolean>;
|
|
4880
4914
|
disconnected: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -5083,6 +5117,7 @@ declare const FindDataSourcesQuery: z.ZodObject<{
|
|
|
5083
5117
|
integration: "integration";
|
|
5084
5118
|
universal: "universal";
|
|
5085
5119
|
}>>;
|
|
5120
|
+
connectionKey: z.ZodOptional<z.ZodString>;
|
|
5086
5121
|
universalParentId: z.ZodOptional<z.ZodString>;
|
|
5087
5122
|
tenantId: z.ZodOptional<z.ZodString>;
|
|
5088
5123
|
dataSourceId: z.ZodOptional<z.ZodString>;
|
|
@@ -5238,6 +5273,9 @@ declare const UpdateIntegrationRequest: z.ZodObject<{
|
|
|
5238
5273
|
type UpdateIntegrationRequest = z.infer<typeof UpdateIntegrationRequest>;
|
|
5239
5274
|
declare const FindIntegrationsQuery: z.ZodObject<{
|
|
5240
5275
|
appUuid: z.ZodOptional<z.ZodString>;
|
|
5276
|
+
connectors: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
5277
|
+
externalApps: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
5278
|
+
websearch: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
5241
5279
|
limit: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
5242
5280
|
cursor: z.ZodOptional<z.ZodString>;
|
|
5243
5281
|
search: z.ZodOptional<z.ZodString>;
|
|
@@ -5297,6 +5335,7 @@ declare const IntegrationApiResponse: z.ZodObject<{
|
|
|
5297
5335
|
connection: z.ZodOptional<z.ZodObject<{
|
|
5298
5336
|
id: z.ZodString;
|
|
5299
5337
|
name: z.ZodString;
|
|
5338
|
+
key: z.ZodOptional<z.ZodString>;
|
|
5300
5339
|
isTest: z.ZodOptional<z.ZodBoolean>;
|
|
5301
5340
|
connected: z.ZodOptional<z.ZodBoolean>;
|
|
5302
5341
|
disconnected: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -5360,6 +5399,7 @@ declare const FindPackagesQuery: z.ZodObject<{
|
|
|
5360
5399
|
integrationKey: z.ZodOptional<z.ZodString>;
|
|
5361
5400
|
integrationId: z.ZodOptional<z.ZodString>;
|
|
5362
5401
|
connectionId: z.ZodOptional<z.ZodString>;
|
|
5402
|
+
connectionKey: z.ZodOptional<z.ZodString>;
|
|
5363
5403
|
instanceKey: z.ZodOptional<z.ZodString>;
|
|
5364
5404
|
search: z.ZodOptional<z.ZodString>;
|
|
5365
5405
|
limit: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
@@ -5807,6 +5847,7 @@ declare const FieldMappingApiResponse: z.ZodObject<{
|
|
|
5807
5847
|
connection: z.ZodOptional<z.ZodObject<{
|
|
5808
5848
|
id: z.ZodString;
|
|
5809
5849
|
name: z.ZodString;
|
|
5850
|
+
key: z.ZodOptional<z.ZodString>;
|
|
5810
5851
|
isTest: z.ZodOptional<z.ZodBoolean>;
|
|
5811
5852
|
connected: z.ZodOptional<z.ZodBoolean>;
|
|
5812
5853
|
disconnected: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -5913,6 +5954,7 @@ declare const FindFieldMappingsQuery: z.ZodObject<{
|
|
|
5913
5954
|
integration: "integration";
|
|
5914
5955
|
universal: "universal";
|
|
5915
5956
|
}>>;
|
|
5957
|
+
connectionKey: z.ZodOptional<z.ZodString>;
|
|
5916
5958
|
universalParentId: z.ZodOptional<z.ZodString>;
|
|
5917
5959
|
tenantId: z.ZodOptional<z.ZodString>;
|
|
5918
5960
|
fieldMappingId: z.ZodOptional<z.ZodString>;
|
|
@@ -6369,6 +6411,7 @@ declare const ExternalEventSubscriptionApiResponse: z.ZodObject<{
|
|
|
6369
6411
|
connection: z.ZodOptional<z.ZodObject<{
|
|
6370
6412
|
id: z.ZodString;
|
|
6371
6413
|
name: z.ZodString;
|
|
6414
|
+
key: z.ZodOptional<z.ZodString>;
|
|
6372
6415
|
isTest: z.ZodOptional<z.ZodBoolean>;
|
|
6373
6416
|
connected: z.ZodOptional<z.ZodBoolean>;
|
|
6374
6417
|
disconnected: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -6620,6 +6663,7 @@ declare class ConnectionAccessor {
|
|
|
6620
6663
|
createdAt: string;
|
|
6621
6664
|
updatedAt: string;
|
|
6622
6665
|
userId: string;
|
|
6666
|
+
key?: string | undefined;
|
|
6623
6667
|
isTest?: boolean | undefined;
|
|
6624
6668
|
connected?: boolean | undefined;
|
|
6625
6669
|
disconnected?: boolean | undefined;
|
|
@@ -6704,6 +6748,8 @@ declare class ConnectionAccessor {
|
|
|
6704
6748
|
parameters?: Record<string, any> | undefined;
|
|
6705
6749
|
}> | undefined;
|
|
6706
6750
|
} | undefined;
|
|
6751
|
+
connectorParameters?: unknown;
|
|
6752
|
+
input?: unknown;
|
|
6707
6753
|
} | null>;
|
|
6708
6754
|
openReconnectUI(_options?: OpenConfigurationOptions): Promise<ConnectionApiResponse | null>;
|
|
6709
6755
|
refreshCredentials(): Promise<void>;
|
|
@@ -6857,6 +6903,7 @@ declare class IntegrationAccessor extends ElementAccessor<IntegrationApiResponse
|
|
|
6857
6903
|
createdAt: string;
|
|
6858
6904
|
updatedAt: string;
|
|
6859
6905
|
userId: string;
|
|
6906
|
+
key?: string | undefined;
|
|
6860
6907
|
isTest?: boolean | undefined;
|
|
6861
6908
|
connected?: boolean | undefined;
|
|
6862
6909
|
disconnected?: boolean | undefined;
|
|
@@ -6941,6 +6988,8 @@ declare class IntegrationAccessor extends ElementAccessor<IntegrationApiResponse
|
|
|
6941
6988
|
parameters?: Record<string, any> | undefined;
|
|
6942
6989
|
}> | undefined;
|
|
6943
6990
|
} | undefined;
|
|
6991
|
+
connectorParameters?: unknown;
|
|
6992
|
+
input?: unknown;
|
|
6944
6993
|
} | null>;
|
|
6945
6994
|
createConnection({ parameters, name, }: {
|
|
6946
6995
|
parameters?: any;
|
package/dist/bundle.js
CHANGED
|
@@ -20675,6 +20675,7 @@
|
|
|
20675
20675
|
? {
|
|
20676
20676
|
integrationKey: options.integrationKey,
|
|
20677
20677
|
connectionId: options.connectionId,
|
|
20678
|
+
connectionKey: options.connectionKey,
|
|
20678
20679
|
}
|
|
20679
20680
|
: {};
|
|
20680
20681
|
return this.options.client.post(this.getPath('run'), { input }, { params: queryParams });
|
|
@@ -22259,6 +22260,7 @@
|
|
|
22259
22260
|
WorkspaceElementState["CONFIGURATION_ERROR"] = "CONFIGURATION_ERROR";
|
|
22260
22261
|
WorkspaceElementState["SETUP_FAILED"] = "SETUP_FAILED";
|
|
22261
22262
|
WorkspaceElementState["READY"] = "READY";
|
|
22263
|
+
WorkspaceElementState["DISCONNECTING"] = "DISCONNECTING";
|
|
22262
22264
|
})(WorkspaceElementState || (WorkspaceElementState = {}));
|
|
22263
22265
|
var WorkspaceElementDependencyType;
|
|
22264
22266
|
(function (WorkspaceElementDependencyType) {
|
|
@@ -22377,6 +22379,11 @@
|
|
|
22377
22379
|
filterTitle: 'Connection',
|
|
22378
22380
|
referenceElementType: WorkspaceElementType.Connection,
|
|
22379
22381
|
}),
|
|
22382
|
+
connectionKey: string$1()
|
|
22383
|
+
.optional()
|
|
22384
|
+
.meta({
|
|
22385
|
+
hidden: true,
|
|
22386
|
+
}),
|
|
22380
22387
|
instanceKey: string$1()
|
|
22381
22388
|
.optional()
|
|
22382
22389
|
.meta({
|
|
@@ -22942,7 +22949,7 @@
|
|
|
22942
22949
|
}
|
|
22943
22950
|
}
|
|
22944
22951
|
async function createOrUpdateConnection(options) {
|
|
22945
|
-
const { client, connectionId, integrationKey, integrationId, connectorId, connectorVersion, name, input, connectorParameters, allowMultipleConnections, authOptionKey, connectionRequestId, apiUri, redirectUri, onPopupClosed, } = options !== null && options !== void 0 ? options : {};
|
|
22952
|
+
const { client, connectionId, connectionKey, integrationKey, integrationId, connectorId, connectorVersion, name, input, connectorParameters, allowMultipleConnections, authOptionKey, connectionRequestId, apiUri, redirectUri, onPopupClosed, } = options !== null && options !== void 0 ? options : {};
|
|
22946
22953
|
let connectionType = await detectConnectionType(options);
|
|
22947
22954
|
if (redirectUri) {
|
|
22948
22955
|
connectionType = ConnectionType.REDIRECT;
|
|
@@ -22960,6 +22967,7 @@
|
|
|
22960
22967
|
connectorId,
|
|
22961
22968
|
connectorVersion,
|
|
22962
22969
|
connectionId,
|
|
22970
|
+
connectionKey,
|
|
22963
22971
|
name,
|
|
22964
22972
|
authOptionKey,
|
|
22965
22973
|
allowMultipleConnections,
|
|
@@ -26605,7 +26613,7 @@
|
|
|
26605
26613
|
Response,
|
|
26606
26614
|
}))(utils$1.global);
|
|
26607
26615
|
|
|
26608
|
-
const { ReadableStream: ReadableStream$1, TextEncoder } = utils$1.global;
|
|
26616
|
+
const { ReadableStream: ReadableStream$1, TextEncoder: TextEncoder$1 } = utils$1.global;
|
|
26609
26617
|
|
|
26610
26618
|
const test = (fn, ...args) => {
|
|
26611
26619
|
try {
|
|
@@ -26637,11 +26645,11 @@
|
|
|
26637
26645
|
|
|
26638
26646
|
const encodeText =
|
|
26639
26647
|
isFetchSupported &&
|
|
26640
|
-
(typeof TextEncoder === 'function'
|
|
26648
|
+
(typeof TextEncoder$1 === 'function'
|
|
26641
26649
|
? (
|
|
26642
26650
|
(encoder) => (str) =>
|
|
26643
26651
|
encoder.encode(str)
|
|
26644
|
-
)(new TextEncoder())
|
|
26652
|
+
)(new TextEncoder$1())
|
|
26645
26653
|
: async (str) => new Uint8Array(await new Request(str).arrayBuffer()));
|
|
26646
26654
|
|
|
26647
26655
|
const supportsRequestStream =
|
|
@@ -28172,6 +28180,9 @@
|
|
|
28172
28180
|
apiUri: string$1().nullish(),
|
|
28173
28181
|
uiUri: string$1().nullish(),
|
|
28174
28182
|
accessToken: string$1().nullish(),
|
|
28183
|
+
workspaceKey: string$1().nullish(),
|
|
28184
|
+
workspaceSecret: string$1().nullish(),
|
|
28185
|
+
tenantKey: string$1().nullish(),
|
|
28175
28186
|
})
|
|
28176
28187
|
.strict();
|
|
28177
28188
|
function validateClientOptions(options) {
|
|
@@ -28186,6 +28197,8 @@
|
|
|
28186
28197
|
}
|
|
28187
28198
|
}
|
|
28188
28199
|
const REFETCH_EXPIRATION_THRESHOLD = 10 * 1000;
|
|
28200
|
+
const TOKEN_TTL_SECONDS = 3600;
|
|
28201
|
+
const TOKEN_MINT_THRESHOLD_SECONDS = 60;
|
|
28189
28202
|
function decodeToken(token) {
|
|
28190
28203
|
if (token.startsWith('pat-')) {
|
|
28191
28204
|
return null;
|
|
@@ -28200,11 +28213,25 @@
|
|
|
28200
28213
|
constructor(options = {}) {
|
|
28201
28214
|
this.logs = [];
|
|
28202
28215
|
validateClientOptions(options);
|
|
28203
|
-
const { uiUri, apiUri,
|
|
28216
|
+
const { uiUri, apiUri, fetchCredentials, credentials } = options;
|
|
28204
28217
|
this.apiUri = apiUri !== null && apiUri !== void 0 ? apiUri : DEFAULT_API_URI;
|
|
28205
28218
|
this.uiUri = uiUri !== null && uiUri !== void 0 ? uiUri : DEFAULT_UI_URI;
|
|
28206
|
-
|
|
28207
|
-
|
|
28219
|
+
if ('workspaceSecret' in options && options.workspaceSecret) {
|
|
28220
|
+
if (typeof window !== 'undefined') {
|
|
28221
|
+
throw new Error('MembraneClient: workspaceSecret must not be used in browser code. ' +
|
|
28222
|
+
'The workspace secret is a server-side credential that would be exposed to end users if included in a browser bundle.');
|
|
28223
|
+
}
|
|
28224
|
+
this._workspaceKey = options.workspaceKey;
|
|
28225
|
+
this._workspaceSecret = options.workspaceSecret;
|
|
28226
|
+
this._tenantKey = options.tenantKey;
|
|
28227
|
+
}
|
|
28228
|
+
else {
|
|
28229
|
+
const token = 'token' in options ? options.token : undefined;
|
|
28230
|
+
const accessToken = 'accessToken' in options ? options.accessToken : undefined;
|
|
28231
|
+
const fetchToken = 'fetchToken' in options ? options.fetchToken : undefined;
|
|
28232
|
+
this.token = token !== null && token !== void 0 ? token : accessToken;
|
|
28233
|
+
this.fetchToken = fetchToken;
|
|
28234
|
+
}
|
|
28208
28235
|
if (fetchCredentials) {
|
|
28209
28236
|
void fetchCredentials().then((c) => this.setCredentials(c));
|
|
28210
28237
|
}
|
|
@@ -28216,6 +28243,9 @@
|
|
|
28216
28243
|
return this.patch('/self', { credentials });
|
|
28217
28244
|
}
|
|
28218
28245
|
async getToken() {
|
|
28246
|
+
if (this._workspaceSecret) {
|
|
28247
|
+
return this.mintToken();
|
|
28248
|
+
}
|
|
28219
28249
|
if (this.fetchToken) {
|
|
28220
28250
|
if (!this.token) {
|
|
28221
28251
|
this.token = await this.fetchToken();
|
|
@@ -28236,6 +28266,38 @@
|
|
|
28236
28266
|
decodeToken(this.token);
|
|
28237
28267
|
return this.token;
|
|
28238
28268
|
}
|
|
28269
|
+
async mintToken() {
|
|
28270
|
+
if (this.token) {
|
|
28271
|
+
const payload = decodeToken(this.token);
|
|
28272
|
+
if (payload === null || payload === void 0 ? void 0 : payload.exp) {
|
|
28273
|
+
const remainingSeconds = payload.exp - Math.floor(Date.now() / 1000);
|
|
28274
|
+
if (remainingSeconds > TOKEN_MINT_THRESHOLD_SECONDS) {
|
|
28275
|
+
return this.token;
|
|
28276
|
+
}
|
|
28277
|
+
}
|
|
28278
|
+
}
|
|
28279
|
+
const payload = {
|
|
28280
|
+
id: this._tenantKey,
|
|
28281
|
+
iss: this._workspaceKey,
|
|
28282
|
+
exp: Math.floor(Date.now() / 1000) + TOKEN_TTL_SECONDS,
|
|
28283
|
+
};
|
|
28284
|
+
const header = { alg: 'HS256', typ: 'JWT' };
|
|
28285
|
+
const encoder = new TextEncoder();
|
|
28286
|
+
const toB64Url = (bytes) => {
|
|
28287
|
+
let s = '';
|
|
28288
|
+
for (let i = 0; i < bytes.length; i++)
|
|
28289
|
+
s += String.fromCharCode(bytes[i]);
|
|
28290
|
+
return btoa(s).replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, '');
|
|
28291
|
+
};
|
|
28292
|
+
const headerB64 = toB64Url(encoder.encode(JSON.stringify(header)));
|
|
28293
|
+
const payloadB64 = toB64Url(encoder.encode(JSON.stringify(payload)));
|
|
28294
|
+
const input = `${headerB64}.${payloadB64}`;
|
|
28295
|
+
const key = await crypto.subtle.importKey('raw', encoder.encode(this._workspaceSecret), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign']);
|
|
28296
|
+
const signatureBuffer = await crypto.subtle.sign('HMAC', key, encoder.encode(input));
|
|
28297
|
+
const signature = toB64Url(new Uint8Array(signatureBuffer));
|
|
28298
|
+
this.token = `${input}.${signature}`;
|
|
28299
|
+
return this.token;
|
|
28300
|
+
}
|
|
28239
28301
|
async get(uri, queryParams, options) {
|
|
28240
28302
|
if (queryParams) {
|
|
28241
28303
|
uri += `${uri.includes('?') ? '&' : '?'}${new URLSearchParams(omitBy(queryParams, isEmptyValue)).toString()}`;
|
|
@@ -28434,6 +28496,7 @@
|
|
|
28434
28496
|
name: string$1().optional(),
|
|
28435
28497
|
meta: record(string$1(), any()).optional(),
|
|
28436
28498
|
authOptionKey: string$1().optional(),
|
|
28499
|
+
key: string$1().min(1).max(100).optional().nullable(),
|
|
28437
28500
|
integrationId: string$1().optional(),
|
|
28438
28501
|
integrationUuid: string$1().optional(),
|
|
28439
28502
|
integrationKey: string$1().optional(),
|
|
@@ -28456,6 +28519,7 @@
|
|
|
28456
28519
|
const BaseConnection = BaseWorkspaceElement.extend({
|
|
28457
28520
|
...TenantLayerElement.shape,
|
|
28458
28521
|
name: string$1(),
|
|
28522
|
+
key: string$1().optional(),
|
|
28459
28523
|
isTest: boolean$1().optional(),
|
|
28460
28524
|
connected: boolean$1().optional(),
|
|
28461
28525
|
disconnected: boolean$1().optional().describe('[DEPRECATED] Use `connected` instead.'),
|
|
@@ -29613,15 +29677,16 @@
|
|
|
29613
29677
|
integrationKey: string$1().optional(),
|
|
29614
29678
|
integrationId: string$1().optional(),
|
|
29615
29679
|
connectionId: string$1().optional(),
|
|
29680
|
+
connectionKey: string$1().optional(),
|
|
29616
29681
|
});
|
|
29617
29682
|
const ConnectionApiResponse = BaseConnection.extend({
|
|
29618
29683
|
user: BaseCustomer.optional(),
|
|
29619
29684
|
integration: BaseIntegration.optional(),
|
|
29685
|
+
connectorParameters: unknown().optional(),
|
|
29686
|
+
input: unknown().optional(),
|
|
29620
29687
|
});
|
|
29621
29688
|
ConnectionApiResponse.extend({
|
|
29622
29689
|
credentials: unknown().optional(),
|
|
29623
|
-
input: unknown().optional(),
|
|
29624
|
-
connectorParameters: unknown().optional(),
|
|
29625
29690
|
});
|
|
29626
29691
|
discriminatedUnion('type', [
|
|
29627
29692
|
object({
|
|
@@ -29656,6 +29721,7 @@
|
|
|
29656
29721
|
connectorKey: string$1().optional(),
|
|
29657
29722
|
connectorVersion: string$1().optional(),
|
|
29658
29723
|
connectionId: string$1().optional(),
|
|
29724
|
+
connectionKey: string$1().min(1).max(100).optional(),
|
|
29659
29725
|
name: string$1().optional(),
|
|
29660
29726
|
input: record(string$1(), unknown()).optional(),
|
|
29661
29727
|
connectionParameters: any().optional().describe('[INTERNAL] Deprecated: Use input instead'),
|