@membranehq/sdk 0.26.0 → 0.27.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/dist/bundle.js +213 -4447
- package/dist/bundle.js.map +1 -1
- package/dist/dts/api-client.d.ts +2 -2
- package/dist/dts/workspace-elements/base/connectors/functions.d.ts +3 -2
- package/dist/dts/workspace-elements/base/connectors/index.d.ts +1 -0
- package/dist/dts/workspace-elements/base/connectors/rest-api.d.ts +1 -1
- package/dist/index.browser.d.mts +4 -4
- package/dist/index.browser.d.ts +4 -4
- package/dist/index.browser.js +33 -5
- package/dist/index.browser.js.map +1 -1
- package/dist/index.browser.mjs +33 -5
- package/dist/index.browser.mjs.map +1 -1
- package/dist/index.node.d.mts +4 -4
- package/dist/index.node.d.ts +4 -4
- package/dist/index.node.js +33 -5
- package/dist/index.node.js.map +1 -1
- package/dist/index.node.mjs +33 -5
- package/dist/index.node.mjs.map +1 -1
- package/package.json +1 -1
package/dist/dts/api-client.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { AxiosRequestConfig } from 'axios';
|
|
1
|
+
import type { AxiosRequestConfig, AxiosInstance } from 'axios';
|
|
2
2
|
import { LogRecord } from './logging';
|
|
3
|
-
export declare const axios:
|
|
3
|
+
export declare const axios: AxiosInstance;
|
|
4
4
|
export declare const DEFAULT_API_URI = "https://api.getmembrane.com";
|
|
5
5
|
export declare const DEFAULT_UI_URI = "https://ui.getmembrane.com";
|
|
6
6
|
export interface MembraneClientOptions {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ConnectorVersionData } from '.';
|
|
2
|
+
import { ConnectorAuthWithFunctions, ConnectorOption } from '.';
|
|
2
3
|
import { DataSchema } from '../../../data-schema';
|
|
3
4
|
import { FunctionType } from '../../../functions/base';
|
|
4
5
|
import { ConnectorAuthType } from './auth';
|
|
5
|
-
export declare function getEffectiveConnectorOption(connector:
|
|
6
|
+
export declare function getEffectiveConnectorOption(connector: ConnectorVersionData, optionKey: string): ConnectorOption;
|
|
6
7
|
export interface ConnectorFunctionSpec {
|
|
7
8
|
authTypes?: ConnectorAuthType[];
|
|
8
9
|
getInputSchema?: (authConfig: ConnectorAuthWithFunctions) => DataSchema | undefined;
|
|
@@ -2887,6 +2887,7 @@ export declare const ConnectorVersionData: z.ZodObject<{
|
|
|
2887
2887
|
credentialsSchema: z.ZodOptional<z.ZodType<DataSchema, unknown, z.core.$ZodTypeInternals<DataSchema, unknown>>>;
|
|
2888
2888
|
}, z.core.$strip>>>;
|
|
2889
2889
|
}, z.core.$strip>;
|
|
2890
|
+
export type ConnectorVersionData = z.infer<typeof ConnectorVersionData>;
|
|
2890
2891
|
export declare const ConnectorVersion: z.ZodObject<{
|
|
2891
2892
|
baseUri: z.ZodString;
|
|
2892
2893
|
revision: z.ZodOptional<z.ZodString>;
|
package/dist/index.browser.d.mts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import z$1, { z } from 'zod';
|
|
2
|
-
import
|
|
3
|
-
import { AxiosRequestConfig } from 'axios';
|
|
2
|
+
import { AxiosRequestConfig, AxiosInstance } from 'axios';
|
|
4
3
|
import { Readable } from 'node:stream';
|
|
5
4
|
import https from 'https';
|
|
6
5
|
|
|
@@ -3651,7 +3650,7 @@ declare const GenericFunctionDefinition: z.ZodObject<{
|
|
|
3651
3650
|
type GenericFunctionDefinition = z.infer<typeof GenericFunctionDefinition>;
|
|
3652
3651
|
declare function validateFunctionDefinitions(functions: Record<string, GenericFunctionDefinition>, schema: z.ZodType): void;
|
|
3653
3652
|
|
|
3654
|
-
declare function getEffectiveConnectorOption(connector:
|
|
3653
|
+
declare function getEffectiveConnectorOption(connector: ConnectorVersionData, optionKey: string): ConnectorOption;
|
|
3655
3654
|
interface ConnectorFunctionSpec {
|
|
3656
3655
|
authTypes?: ConnectorAuthType[];
|
|
3657
3656
|
getInputSchema?: (authConfig: ConnectorAuthWithFunctions) => DataSchema | undefined;
|
|
@@ -6814,6 +6813,7 @@ declare const ConnectorVersionData: z.ZodObject<{
|
|
|
6814
6813
|
credentialsSchema: z.ZodOptional<z.ZodType<DataSchema, unknown, z.core.$ZodTypeInternals<DataSchema, unknown>>>;
|
|
6815
6814
|
}, z.core.$strip>>>;
|
|
6816
6815
|
}, z.core.$strip>;
|
|
6816
|
+
type ConnectorVersionData = z.infer<typeof ConnectorVersionData>;
|
|
6817
6817
|
declare const ConnectorVersion: z.ZodObject<{
|
|
6818
6818
|
baseUri: z.ZodString;
|
|
6819
6819
|
revision: z.ZodOptional<z.ZodString>;
|
|
@@ -10949,7 +10949,7 @@ interface BlobLike {
|
|
|
10949
10949
|
declare function isBlob(value: unknown): value is BlobLike;
|
|
10950
10950
|
declare function truncateData(data: any, depth?: number): any;
|
|
10951
10951
|
|
|
10952
|
-
declare const axios:
|
|
10952
|
+
declare const axios: AxiosInstance;
|
|
10953
10953
|
interface MembraneClientOptions {
|
|
10954
10954
|
token?: string;
|
|
10955
10955
|
fetchToken?: () => Promise<string>;
|
package/dist/index.browser.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import z$1, { z } from 'zod';
|
|
2
|
-
import
|
|
3
|
-
import { AxiosRequestConfig } from 'axios';
|
|
2
|
+
import { AxiosRequestConfig, AxiosInstance } from 'axios';
|
|
4
3
|
import { Readable } from 'node:stream';
|
|
5
4
|
import https from 'https';
|
|
6
5
|
|
|
@@ -3651,7 +3650,7 @@ declare const GenericFunctionDefinition: z.ZodObject<{
|
|
|
3651
3650
|
type GenericFunctionDefinition = z.infer<typeof GenericFunctionDefinition>;
|
|
3652
3651
|
declare function validateFunctionDefinitions(functions: Record<string, GenericFunctionDefinition>, schema: z.ZodType): void;
|
|
3653
3652
|
|
|
3654
|
-
declare function getEffectiveConnectorOption(connector:
|
|
3653
|
+
declare function getEffectiveConnectorOption(connector: ConnectorVersionData, optionKey: string): ConnectorOption;
|
|
3655
3654
|
interface ConnectorFunctionSpec {
|
|
3656
3655
|
authTypes?: ConnectorAuthType[];
|
|
3657
3656
|
getInputSchema?: (authConfig: ConnectorAuthWithFunctions) => DataSchema | undefined;
|
|
@@ -6814,6 +6813,7 @@ declare const ConnectorVersionData: z.ZodObject<{
|
|
|
6814
6813
|
credentialsSchema: z.ZodOptional<z.ZodType<DataSchema, unknown, z.core.$ZodTypeInternals<DataSchema, unknown>>>;
|
|
6815
6814
|
}, z.core.$strip>>>;
|
|
6816
6815
|
}, z.core.$strip>;
|
|
6816
|
+
type ConnectorVersionData = z.infer<typeof ConnectorVersionData>;
|
|
6817
6817
|
declare const ConnectorVersion: z.ZodObject<{
|
|
6818
6818
|
baseUri: z.ZodString;
|
|
6819
6819
|
revision: z.ZodOptional<z.ZodString>;
|
|
@@ -10949,7 +10949,7 @@ interface BlobLike {
|
|
|
10949
10949
|
declare function isBlob(value: unknown): value is BlobLike;
|
|
10950
10950
|
declare function truncateData(data: any, depth?: number): any;
|
|
10951
10951
|
|
|
10952
|
-
declare const axios:
|
|
10952
|
+
declare const axios: AxiosInstance;
|
|
10953
10953
|
interface MembraneClientOptions {
|
|
10954
10954
|
token?: string;
|
|
10955
10955
|
fetchToken?: () => Promise<string>;
|
package/dist/index.browser.js
CHANGED
|
@@ -12,7 +12,6 @@ var diff = require('diff');
|
|
|
12
12
|
var yaml = require('js-yaml');
|
|
13
13
|
var qs = require('qs');
|
|
14
14
|
var penpal = require('penpal');
|
|
15
|
-
var axiosOriginal = require('axios');
|
|
16
15
|
var zodValidationError = require('zod-validation-error');
|
|
17
16
|
|
|
18
17
|
function _interopNamespaceDefault(e) {
|
|
@@ -4618,6 +4617,9 @@ const CONNECTOR_EVENTS_DIR = 'events';
|
|
|
4618
4617
|
function getEffectiveConnectorOption(connector, optionKey) {
|
|
4619
4618
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
4620
4619
|
const option = (_a = connector.options) === null || _a === void 0 ? void 0 : _a[optionKey];
|
|
4620
|
+
if (!option) {
|
|
4621
|
+
throw new BadRequestError(`Connector doesn't have auth option ${optionKey}`);
|
|
4622
|
+
}
|
|
4621
4623
|
const connectorInputSchema = (_b = connector.inputSchema) !== null && _b !== void 0 ? _b : (_c = connector.ui) === null || _c === void 0 ? void 0 : _c.schema;
|
|
4622
4624
|
const optionInputSchema = (_d = option === null || option === void 0 ? void 0 : option.inputSchema) !== null && _d !== void 0 ? _d : (_e = option === null || option === void 0 ? void 0 : option.ui) === null || _e === void 0 ? void 0 : _e.schema;
|
|
4623
4625
|
return {
|
|
@@ -16079,8 +16081,34 @@ function decodeJWT(token) {
|
|
|
16079
16081
|
}
|
|
16080
16082
|
}
|
|
16081
16083
|
|
|
16082
|
-
|
|
16083
|
-
|
|
16084
|
+
let _axiosGlobal;
|
|
16085
|
+
let _axiosInstance;
|
|
16086
|
+
function getAxiosGlobal() {
|
|
16087
|
+
if (!_axiosGlobal) {
|
|
16088
|
+
let axiosOriginal;
|
|
16089
|
+
axiosOriginal = require('axios');
|
|
16090
|
+
_axiosGlobal = ((axiosOriginal === null || axiosOriginal === void 0 ? void 0 : axiosOriginal.default) || axiosOriginal);
|
|
16091
|
+
}
|
|
16092
|
+
return _axiosGlobal;
|
|
16093
|
+
}
|
|
16094
|
+
function getAxiosInstance() {
|
|
16095
|
+
if (!_axiosInstance) {
|
|
16096
|
+
_axiosInstance = getAxiosGlobal().create();
|
|
16097
|
+
}
|
|
16098
|
+
return _axiosInstance;
|
|
16099
|
+
}
|
|
16100
|
+
const axios = new Proxy(((...args) => getAxiosInstance()(...args)), {
|
|
16101
|
+
get(_, prop) {
|
|
16102
|
+
return getAxiosInstance()[prop];
|
|
16103
|
+
},
|
|
16104
|
+
set(_, prop, value) {
|
|
16105
|
+
getAxiosInstance()[prop] = value;
|
|
16106
|
+
return true;
|
|
16107
|
+
},
|
|
16108
|
+
apply(_, thisArg, args) {
|
|
16109
|
+
return getAxiosInstance().apply(thisArg, args);
|
|
16110
|
+
},
|
|
16111
|
+
});
|
|
16084
16112
|
const DEFAULT_API_URI = 'https://api.getmembrane.com';
|
|
16085
16113
|
const DEFAULT_UI_URI = 'https://ui.getmembrane.com';
|
|
16086
16114
|
const membraneClientOptionsSchema = z.z
|
|
@@ -16247,7 +16275,7 @@ class MembraneApiClient {
|
|
|
16247
16275
|
params.withCredentials = false;
|
|
16248
16276
|
let response;
|
|
16249
16277
|
try {
|
|
16250
|
-
response = await
|
|
16278
|
+
response = await getAxiosInstance().request(params);
|
|
16251
16279
|
}
|
|
16252
16280
|
catch (err) {
|
|
16253
16281
|
log.data.timeMs = new Date().getTime() - startTime.getTime();
|
|
@@ -16283,7 +16311,7 @@ class MembraneApiClient {
|
|
|
16283
16311
|
}
|
|
16284
16312
|
handleRequestError(err) {
|
|
16285
16313
|
var _a, _b;
|
|
16286
|
-
if (
|
|
16314
|
+
if (getAxiosGlobal().isAxiosError(err) && ((_b = (_a = err.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.type)) {
|
|
16287
16315
|
const error = getErrorFromData(err.response.data);
|
|
16288
16316
|
if (error)
|
|
16289
16317
|
throw error;
|