@integration-app/sdk
Advanced tools
Comparing version 0.17.0 to 0.17.1
{ | ||
"name": "@integration-app/sdk", | ||
"version": "0.17.0", | ||
"version": "0.17.1", | ||
"description": "JavaScript SDK for Integration.app", | ||
@@ -5,0 +5,0 @@ "author": "Integration.app", |
@@ -1,54 +0,4 @@ | ||
## Releasing Package | ||
# Integration.app / SDK | ||
To release a new version of a package (@integration-app/sdk, @integration-app/ui, @integration-app/react), do the following: | ||
* Go to the package and type `npm version -- patch` (or `npm version -- minor` or `npm version -- major`) to bump the version. | ||
* Create a PR with the changes. | ||
* Merge the PR. | ||
* Run a Github Action to publish a package. | ||
# Rollup Configuration | ||
To see the complete configuration, refer to the `rollup.config.mjs` and `rollup.dts.config.mjs` files. Although these files are self-explanatory, here's some additional information: | ||
In `rollup.config.mjs`, we set `{external: [/node_modules/]}` to exclude our dependencies from being bundled. | ||
## Bundle and DTS File Generation Workflow | ||
When using `rollup-plugin-dts` and `@rollup/plugin-typescript` in the same configuration, we experienced issues with generating incorrect DTS files. To solve this, we use two Rollup configurations: | ||
- `rollup.config.mjs` for generating bundles | ||
- `rollup.dts.config.mjs` for generating DTS files. | ||
### Build | ||
For build, the following steps are taken: | ||
- Clean the `/dist` folder and `./bundle.*` files. | ||
- Rollup with `rollup.config.mjs` configuration generates bundle files and basic DTS files, which are placed in the `dist/dts` folder. | ||
- Rollup with `rollup.dts.config.mjs` configuration uses the basic DTS files to generate `*.d.ts` files for each bundle. | ||
### Development | ||
During development, the following steps are taken: | ||
- Run `build` to generate bundle and DTS files. | ||
- If not, Rollup with `rollup.dts.config.mjs` in watch mode fails due to missing DTS files (race condition). | ||
- Concurrently run two Rollup processes **in watch mode**: | ||
- Rollup with `rollup.config.mjs` configuration to generate bundle files and basic DTS files. | ||
- Rollup with `rollup.dts.config.mjs` configuration to generate DTS files for each bundle. | ||
# Package.json exports | ||
```json5 | ||
{ | ||
"exports": { | ||
"types": "./dist/index.d.ts", // TypeScript typings for NodeNext modules | ||
"require": "./dist/index.js", // used for require() in Node 12+ | ||
"import": "./dist/index.module.mjs" // ESM bundle | ||
}, | ||
"types": "./dist/index.d.ts", // TypeScript typings | ||
"main": "./dist/index.js", // CommonJS bundle | ||
"module": "./dist/index.module.mjs", // ESM bundle | ||
"unpkg": "./bundle.js", // UMD bundle | ||
} | ||
``` | ||
- [Developers documentation](https://console.integration.app/docs) | ||
- [Rest API](https://console.integration.app/ref/rest-api/index.html) |
@@ -120,3 +120,3 @@ import { | ||
const uri = this.client.getEmbedUri( | ||
const uri = await this.client.getEmbedUri( | ||
`action-instances/${id}/configuration`, | ||
@@ -123,0 +123,0 @@ { showPoweredBy: showPoweredBy ?? true }, |
@@ -25,3 +25,3 @@ import jwt from 'jsonwebtoken' | ||
it('should return "token" passed in custructor params', async () => { | ||
it('should return "token" passed in constructor params', async () => { | ||
const token = jwt.sign({ data: 'test' }, 'secret') | ||
@@ -190,4 +190,4 @@ | ||
it('should add token to the query', () => { | ||
expect(apiClient.getEmbedUri('')).toEqual( | ||
it('should add token to the query', async () => { | ||
expect(await apiClient.getEmbedUri('')).toEqual( | ||
`https://localhost:3000/embed/?token=${TOKEN}`, | ||
@@ -197,10 +197,10 @@ ) | ||
it('should add token and additional query params', () => { | ||
expect(new URL(apiClient.getEmbedUri('', { a: 'b' })).search).toEqual( | ||
`?token=${TOKEN}&a=b`, | ||
) | ||
it('should add token and additional query params', async () => { | ||
expect( | ||
new URL(await apiClient.getEmbedUri('', { a: 'b' })).search, | ||
).toEqual(`?token=${TOKEN}&a=b`) | ||
}) | ||
it('should add use sub-page', () => { | ||
expect(new URL(apiClient.getEmbedUri('index')).pathname).toEqual( | ||
it('should add use sub-page', async () => { | ||
expect(new URL(await apiClient.getEmbedUri('index')).pathname).toEqual( | ||
'/embed/index', | ||
@@ -210,6 +210,6 @@ ) | ||
it('should convert boolean to strings', () => { | ||
it('should convert boolean to strings', async () => { | ||
expect( | ||
new URL( | ||
apiClient.getEmbedUri('index', { | ||
await apiClient.getEmbedUri('index', { | ||
flag1: true, | ||
@@ -222,5 +222,5 @@ flag2: false, | ||
it('should skip query undefined query parameters', () => { | ||
it('should skip query undefined query parameters', async () => { | ||
expect( | ||
apiClient.getEmbedUri('index', { | ||
await apiClient.getEmbedUri('index', { | ||
undefined: undefined, | ||
@@ -227,0 +227,0 @@ }), |
@@ -132,4 +132,4 @@ import axiosOriginal, { AxiosRequestConfig, AxiosStatic } from 'axios' | ||
public getEmbedUri(page: string, params?: Record<string, any>) { | ||
const paramsWithToken = { token: this.token, ...(params ?? {}) } | ||
public async getEmbedUri(page: string, params?: Record<string, any>) { | ||
const paramsWithToken = { token: await this.getToken(), ...(params ?? {}) } | ||
const queryParams = qs.stringify(paramsWithToken) | ||
@@ -136,0 +136,0 @@ |
@@ -1,2 +0,2 @@ | ||
import { Self } from '.' | ||
import { Customer } from '../users' | ||
import { IntegrationAppApiClient } from '../api-client' | ||
@@ -7,9 +7,9 @@ | ||
async get(): Promise<Self> { | ||
async get(): Promise<Customer> { | ||
return this.client.get('self') | ||
} | ||
async patch(data: Partial<Self>): Promise<Self> { | ||
async patch(data: Partial<{ credentials: any }>): Promise<Customer> { | ||
return this.client.patch('self', data) | ||
} | ||
} |
@@ -97,3 +97,3 @@ import { | ||
) { | ||
const uri = this.getEmbedUri('main', { | ||
const uri = await this.getEmbedUri('main', { | ||
showPoweredBy: showPoweredBy ?? true, | ||
@@ -100,0 +100,0 @@ }) |
@@ -41,2 +41,15 @@ import urljoin from 'url-join' | ||
import { InstanceKeyQuery } from '../integration-elements/common' | ||
import { | ||
ConnectionLevelDataSourceAccessor, | ||
ConnectionLevelDataSourcesAccessor, | ||
} from '../data-sources' | ||
import { | ||
ConnectionLevelFieldMappingAccessor, | ||
ConnectionLevelFieldMappingsAccessor, | ||
} from '../field-mappings' | ||
import { | ||
ConnectionLevelFlowAccessor, | ||
ConnectionLevelFlowsAccessor, | ||
} from '../flows' | ||
export class ConnectionsAccessor extends ElementInstanceListAccessor< | ||
@@ -77,2 +90,50 @@ Connection, | ||
get flows() { | ||
return new ConnectionLevelFlowsAccessor( | ||
this.client, | ||
this.connectionSelector, | ||
) | ||
} | ||
flow(flowSelector: string, query?: InstanceKeyQuery) { | ||
return new ConnectionLevelFlowAccessor( | ||
this.client, | ||
this.connectionSelector, | ||
flowSelector, | ||
query ?? {}, | ||
) | ||
} | ||
get dataSources() { | ||
return new ConnectionLevelDataSourcesAccessor( | ||
this.client, | ||
this.connectionSelector, | ||
) | ||
} | ||
dataSource(dataSourceSelector: string, query?: InstanceKeyQuery) { | ||
return new ConnectionLevelDataSourceAccessor( | ||
this.client, | ||
this.connectionSelector, | ||
dataSourceSelector, | ||
query ?? {}, | ||
) | ||
} | ||
get fieldMappings() { | ||
return new ConnectionLevelFieldMappingsAccessor( | ||
this.client, | ||
this.connectionSelector, | ||
) | ||
} | ||
fieldMapping(fieldMappingSelector: string, query?: InstanceKeyQuery) { | ||
return new ConnectionLevelFieldMappingAccessor( | ||
this.client, | ||
this.connectionSelector, | ||
fieldMappingSelector, | ||
query ?? {}, | ||
) | ||
} | ||
async get(): Promise<Connection> { | ||
@@ -139,3 +200,3 @@ return this.client.get(`/connections/${this.connectionSelector}`) | ||
): Promise<void> { | ||
const uri = this.client.getEmbedUri( | ||
const uri = await this.client.getEmbedUri( | ||
`connections/${this.connectionSelector}/refresh`, | ||
@@ -142,0 +203,0 @@ { |
@@ -180,4 +180,10 @@ import { | ||
export interface DataCollectionListResponseDrilldown { | ||
parameters?: Record<string, any> | ||
filter?: Record<string, any> | ||
} | ||
export interface DataCollectionListResponse { | ||
records: DataRecord[] | ||
drilldowns?: Array<DataCollectionListResponseDrilldown> | ||
cursor?: string | ||
@@ -184,0 +190,0 @@ } |
@@ -59,4 +59,5 @@ import { HttpRequestMethod } from '../http-requests' | ||
responseHandlers?: Array<RestApiClientResponseHandler> | ||
binary?: boolean | ||
dynamicOptions?: (input: RestApiClientInput) => RestApiClientOptions | ||
onError?: (error: any) => any | ||
} |
@@ -34,5 +34,16 @@ import { DataSource, DataSourceInstance, DataSourceSelector } from '.' | ||
FindDataSourcesQuery, | ||
ListDataSourceInstancesForConnectionQuery, | ||
ListDataSourcesForIntegrationQuery, | ||
UpdateDataSourceInstanceRequest, | ||
UpdateDataSourceRequest, | ||
} from './api' | ||
import { | ||
ConnectionLevelElementAccessor, | ||
ConnectionLevelElementsListAccessor, | ||
} from '../integration-elements/connection-level-element.accessor' | ||
import { | ||
IntegrationLevelElementAccessor, | ||
IntegrationLevelElementsListAccessor, | ||
} from '../integration-elements/integration-level-element.accessor' | ||
import { InstanceKeyQuery } from '../integration-elements/common' | ||
@@ -126,3 +137,3 @@ export interface OpenDataSourceConfigurationOptions | ||
const id = await this.getId() | ||
const uri = this.client.getEmbedUri( | ||
const uri = await this.client.getEmbedUri( | ||
`data-source-instances/${id}/configuration`, | ||
@@ -197,1 +208,53 @@ { showPoweredBy: showPoweredBy ?? true }, | ||
} | ||
export class IntegrationLevelDataSourceAccessor extends IntegrationLevelElementAccessor< | ||
DataSource, | ||
UpdateDataSourceRequest | ||
> { | ||
constructor( | ||
public client: IntegrationAppApiClient, | ||
public integrationSelector: string, | ||
public dataSourceSelector: string, | ||
) { | ||
super(client, integrationSelector, dataSourceSelector, 'data-sources') | ||
} | ||
} | ||
export class IntegrationLevelDataSourcesListAccessor extends IntegrationLevelElementsListAccessor< | ||
DataSource, | ||
ListDataSourcesForIntegrationQuery, | ||
Omit<CreateDataSourceRequest, 'integrationId'> | ||
> { | ||
constructor( | ||
public client: IntegrationAppApiClient, | ||
public integrationSelector: string, | ||
) { | ||
super(client, integrationSelector, 'data-sources') | ||
} | ||
} | ||
export class ConnectionLevelDataSourceAccessor extends ConnectionLevelElementAccessor< | ||
DataSourceInstance, | ||
UpdateDataSourceInstanceRequest | ||
> { | ||
constructor( | ||
public client: IntegrationAppApiClient, | ||
public connectionSelector: string, | ||
public dataSourceSelector: string, | ||
public query: InstanceKeyQuery, | ||
) { | ||
super(client, connectionSelector, dataSourceSelector, 'data-sources', query) | ||
} | ||
} | ||
export class ConnectionLevelDataSourcesAccessor extends ConnectionLevelElementsListAccessor< | ||
DataSource, | ||
ListDataSourceInstancesForConnectionQuery | ||
> { | ||
constructor( | ||
public client: IntegrationAppApiClient, | ||
public connectionSelector: string, | ||
) { | ||
super(client, connectionSelector, 'data-sources') | ||
} | ||
} |
@@ -7,8 +7,11 @@ import { PaginationQuery, PaginationResponse } from '../entity-repository' | ||
export interface FindDataSourcesQuery extends PaginationQuery { | ||
integrationId?: string | 'null' | ||
export interface ListDataSourcesForIntegrationQuery extends PaginationQuery { | ||
universalDataSourceId?: string | 'null' | ||
} | ||
export interface FindDataSourcesQuery | ||
extends ListDataSourcesForIntegrationQuery { | ||
integrationId?: string | 'null' | ||
} | ||
export type CreateDataSourceRequest = { | ||
@@ -126,7 +129,10 @@ key: string | ||
export interface FindDataSourceInstanceSyncsQuery extends PaginationQuery { | ||
export type ListDataSourceInstancesForConnectionQuery = PaginationQuery & { | ||
dataSourceId?: string | ||
} | ||
export interface FindDataSourceInstanceSyncsQuery | ||
extends ListDataSourceInstancesForConnectionQuery { | ||
userId?: string | ||
dataSourceId?: string | ||
connectionId?: string | ||
@@ -133,0 +139,0 @@ |
@@ -5,2 +5,16 @@ export type CommonListElementsQuery = SearchQuery & | ||
export type CommonInstancesListQuery = CommonListElementsQuery & { | ||
userId?: string | ||
instanceKey?: string | ||
} | ||
export type CommonIntegrationOrConnectionQuery = { | ||
connectionId?: string | ||
integrationId?: string | ||
integrationKey?: string | ||
} | ||
export type IncludeArchivedQuery = { | ||
@@ -7,0 +21,0 @@ includeArchived?: boolean |
@@ -16,5 +16,16 @@ import { FieldMapping, FieldMappingInstance, FieldMappingSelector } from '.' | ||
FindFieldMappingsQuery, | ||
ListFieldMappingInstancesForConnectionQuery, | ||
ListFieldMappingsForIntegrationQuery, | ||
UpdateFieldMappingInstanceRequest, | ||
UpdateFieldMappingRequest, | ||
} from './api' | ||
import { | ||
ConnectionLevelElementAccessor, | ||
ConnectionLevelElementsListAccessor, | ||
} from '../integration-elements/connection-level-element.accessor' | ||
import { | ||
IntegrationLevelElementAccessor, | ||
IntegrationLevelElementsListAccessor, | ||
} from '../integration-elements/integration-level-element.accessor' | ||
import { InstanceKeyQuery } from '../integration-elements/common' | ||
@@ -107,3 +118,3 @@ export interface OpenFieldMappingInstanceConfigurationOptions | ||
const id = await this.getId() | ||
const uri = this.client.getEmbedUri( | ||
const uri = await this.client.getEmbedUri( | ||
`field-mapping-instances/${id}/configuration`, | ||
@@ -119,1 +130,72 @@ { showPoweredBy: showPoweredBy ?? true }, | ||
} | ||
export class IntegrationLevelFieldMappingAccessor extends IntegrationLevelElementAccessor< | ||
FieldMapping, | ||
UpdateFieldMappingRequest | ||
> { | ||
constructor( | ||
public client: IntegrationAppApiClient, | ||
public integrationSelector: string, | ||
public fieldMappingSelector: string, | ||
) { | ||
super(client, integrationSelector, fieldMappingSelector, 'field-mappings') | ||
} | ||
} | ||
export class IntegrationLevelFieldMappingsListAccessor extends IntegrationLevelElementsListAccessor< | ||
FieldMapping, | ||
ListFieldMappingsForIntegrationQuery, | ||
Omit<CreateFieldMappingRequest, 'integrationId'> | ||
> { | ||
constructor( | ||
public client: IntegrationAppApiClient, | ||
public integrationSelector: string, | ||
) { | ||
super(client, integrationSelector, 'field-mappings') | ||
} | ||
} | ||
export class ConnectionLevelFieldMappingAccessor extends ConnectionLevelElementAccessor< | ||
FieldMappingInstance, | ||
UpdateFieldMappingInstanceRequest | ||
> { | ||
constructor( | ||
public client: IntegrationAppApiClient, | ||
public connectionSelector: string, | ||
public fieldMappingSelector: string, | ||
public query: InstanceKeyQuery, | ||
) { | ||
super( | ||
client, | ||
connectionSelector, | ||
fieldMappingSelector, | ||
'field-mappings', | ||
query, | ||
) | ||
} | ||
async openConfiguration( | ||
{ showPoweredBy, onClose }: OpenFieldMappingInstanceConfigurationOptions = { | ||
showPoweredBy: true, | ||
}, | ||
): Promise<void> { | ||
const fm = await this.get() | ||
const uri = await this.client.getEmbedUri( | ||
`field-mapping-instances/${fm.id}/configuration`, | ||
{ showPoweredBy: showPoweredBy ?? true }, | ||
) | ||
return openIframe(uri, { onClose: onClose ?? (() => {}) }) | ||
} | ||
} | ||
export class ConnectionLevelFieldMappingsAccessor extends ConnectionLevelElementsListAccessor< | ||
FieldMapping, | ||
ListFieldMappingInstancesForConnectionQuery | ||
> { | ||
constructor( | ||
public client: IntegrationAppApiClient, | ||
public connectionSelector: string, | ||
) { | ||
super(client, connectionSelector, 'field-mappings') | ||
} | ||
} |
import { | ||
CommonInstancesListQuery, | ||
CommonIntegrationOrConnectionQuery, | ||
CommonListElementsQuery, | ||
PaginationResponse, | ||
} from '../entity-repository' | ||
import { FieldMapping, FieldMappingDirection } from '.' | ||
import { FieldMappingDirection } from '.' | ||
import { ConnectionSelector } from '../connections/api' | ||
@@ -14,27 +15,25 @@ import { | ||
export interface FindFieldMappingsQuery extends CommonListElementsQuery { | ||
integrationId?: string | 'null' | ||
export interface ListFieldMappingsForIntegrationQuery | ||
extends CommonListElementsQuery { | ||
universalFieldMappingId?: string | 'null' | ||
} | ||
export type FindFieldMappingsResponse = PaginationResponse<FieldMapping> | ||
export interface FindFieldMappingsQuery | ||
extends ListFieldMappingsForIntegrationQuery { | ||
integrationId?: string | 'null' | ||
} | ||
export interface FindFieldMappingInstancesQuery | ||
extends CommonListElementsQuery { | ||
userId?: string | ||
export type ListFieldMappingInstancesForConnectionQuery = | ||
CommonInstancesListQuery & { | ||
fieldMappingId?: string | ||
fieldMappingId?: string | ||
universalFieldMappingId?: string | ||
universalFieldMappingId?: string | ||
dataSourceInstanceId?: string | ||
} | ||
connectionId?: string | ||
export type FindFieldMappingInstancesQuery = | ||
ListFieldMappingInstancesForConnectionQuery & | ||
CommonIntegrationOrConnectionQuery | ||
dataSourceInstanceId?: string | ||
integrationKey?: string | ||
integrationId?: string | ||
} | ||
export interface UpdateFieldMappingRequest { | ||
@@ -41,0 +40,0 @@ key?: string |
@@ -11,2 +11,3 @@ import { | ||
import { FlowInstanceAccessor } from '../flows' | ||
import qs from 'qs' | ||
@@ -43,11 +44,31 @@ export class FlowRunsAccessor { | ||
async getOutput(parameters?: { | ||
cursor?: string | ||
nodeKey: string | ||
}): Promise<any> { | ||
async getOutput() { | ||
return this.client.get(`${this.baseUri}/output`) | ||
} | ||
async getNodeRuns(nodeKey: string, parameters?: { cursor?: string }) { | ||
return this.client.get( | ||
`${this.baseUri}/output?${new URLSearchParams(parameters).toString()}`, | ||
`${this.baseUri}/nodes${nodeKey}/runs/${qs.stringify(parameters)}`, | ||
) | ||
} | ||
async getNodeRun(nodeKey: string, runId: string) { | ||
return this.client.get(`${this.baseUri}/nodes${nodeKey}/runs/${runId}`) | ||
} | ||
async getNodeOutputs( | ||
nodeKey: string, | ||
parameters?: { cursor?: string }, | ||
): Promise<any> { | ||
return this.client.get( | ||
`${this.baseUri}/nodes/${nodeKey}/outputs?${qs.stringify(parameters)}`, | ||
) | ||
} | ||
async getNodeOutput(nodeKey: string, outputId: string): Promise<any> { | ||
return this.client.get( | ||
`${this.baseUri}/nodes/${nodeKey}/output/${outputId}`, | ||
) | ||
} | ||
async repeat(): Promise<FlowRun> { | ||
@@ -54,0 +75,0 @@ const flowRun = await this.get() |
@@ -8,4 +8,6 @@ import { FlowRun, FlowRunState } from '../flow-runs' | ||
FindFlowInstancesQuery, | ||
FindFlowsRequest, | ||
FindFlowsQuery, | ||
FlowInstanceSelector, | ||
ListFlowInstancesForConnectionQuery, | ||
ListFlowsForIntegrationQuery, | ||
RunFlowOptions, | ||
@@ -23,2 +25,11 @@ UpdateFlowInstanceRequest, | ||
import { FlowRunsAccessor, FlowRunAccessor } from '../flow-runs' | ||
import { | ||
IntegrationLevelElementAccessor, | ||
IntegrationLevelElementsListAccessor, | ||
} from '../integration-elements/integration-level-element.accessor' | ||
import { | ||
ConnectionLevelElementAccessor, | ||
ConnectionLevelElementsListAccessor, | ||
} from '../integration-elements/connection-level-element.accessor' | ||
import { InstanceKeyQuery } from '../integration-elements/common' | ||
@@ -34,3 +45,3 @@ const MAX_POLLING_ERRORS = 10 | ||
Flow, | ||
FindFlowsRequest, | ||
FindFlowsQuery, | ||
CreateFlowRequest | ||
@@ -125,6 +136,9 @@ > { | ||
const id = await this.getId() | ||
const uri = this.client.getEmbedUri(`flow-instances/${id}/configuration`, { | ||
nodeKey: options.nodeKey, | ||
showPoweredBy: options.showPoweredBy ?? true, | ||
}) | ||
const uri = await this.client.getEmbedUri( | ||
`flow-instances/${id}/configuration`, | ||
{ | ||
nodeKey: options.nodeKey, | ||
showPoweredBy: options.showPoweredBy ?? true, | ||
}, | ||
) | ||
@@ -218,1 +232,86 @@ return openIframe(uri, { | ||
} | ||
export class IntegrationLevelFlowAccessor extends IntegrationLevelElementAccessor< | ||
Flow, | ||
UpdateFlowRequest | ||
> { | ||
constructor( | ||
public client: IntegrationAppApiClient, | ||
public integrationSelector: string, | ||
public flowSelector: string, | ||
) { | ||
super(client, integrationSelector, flowSelector, 'flows') | ||
} | ||
} | ||
export class IntegrationLevelFlowsListAccessor extends IntegrationLevelElementsListAccessor< | ||
Flow, | ||
ListFlowsForIntegrationQuery, | ||
Omit<CreateFlowRequest, 'integrationId'> | ||
> { | ||
constructor( | ||
public client: IntegrationAppApiClient, | ||
public integrationSelector: string, | ||
) { | ||
super(client, integrationSelector, 'flows') | ||
} | ||
} | ||
export class ConnectionLevelFlowAccessor extends ConnectionLevelElementAccessor< | ||
FlowInstance, | ||
UpdateFlowInstanceRequest | ||
> { | ||
constructor( | ||
public client: IntegrationAppApiClient, | ||
public connectionSelector: string, | ||
public flowSelector: string, | ||
public query: InstanceKeyQuery, | ||
) { | ||
super(client, connectionSelector, flowSelector, 'flows', query) | ||
} | ||
async enable(): Promise<FlowInstance> { | ||
return this.patch({ enabled: true }) | ||
} | ||
async disable(): Promise<FlowInstance> { | ||
return this.patch({ enabled: false }) | ||
} | ||
async openConfiguration(options: OpenFlowInstanceConfigurationOptions) { | ||
const instance = await this.get() | ||
const uri = await this.client.getEmbedUri( | ||
`flow-instances/${instance.id}/configuration`, | ||
{ | ||
nodeKey: options.nodeKey, | ||
showPoweredBy: options.showPoweredBy ?? true, | ||
}, | ||
) | ||
return openIframe(uri, { onClose: options.onClose ?? (() => {}) }) | ||
} | ||
async startRun(options: RunFlowOptions = {}): Promise<FlowRun> { | ||
const instance = await this.get() | ||
const flowRun = await this.client.post('/flow-runs', { | ||
flowInstanceId: instance.id, | ||
nodeKey: options.nodeKey, | ||
input: options.input, | ||
}) | ||
return flowRun | ||
} | ||
} | ||
export class ConnectionLevelFlowsAccessor extends ConnectionLevelElementsListAccessor< | ||
Flow, | ||
ListFlowInstancesForConnectionQuery | ||
> { | ||
constructor( | ||
public client: IntegrationAppApiClient, | ||
public connectionSelector: string, | ||
) { | ||
super(client, connectionSelector, 'flows') | ||
} | ||
} |
@@ -1,2 +0,6 @@ | ||
import { PaginationQuery } from '../entity-repository' | ||
import { | ||
CommonInstancesListQuery, | ||
CommonIntegrationOrConnectionQuery, | ||
CommonListElementsQuery, | ||
} from '../entity-repository' | ||
import { FlowNodeLink } from '.' | ||
@@ -10,10 +14,8 @@ import { ConnectionSelector } from '../connections' | ||
export interface FindFlowsRequest extends PaginationQuery { | ||
includeArchived?: boolean | ||
export interface ListFlowsForIntegrationQuery extends CommonListElementsQuery { | ||
universalFlowId?: string | 'null' | ||
} | ||
integrationKey?: string | ||
export interface FindFlowsQuery extends ListFlowsForIntegrationQuery { | ||
integrationId?: string | 'null' | ||
universalFlowId?: string | 'null' | ||
} | ||
@@ -51,15 +53,13 @@ | ||
export interface FindFlowInstancesQuery extends PaginationQuery { | ||
id?: string | ||
userId?: string | ||
export type ListFlowInstancesForConnectionQuery = CommonInstancesListQuery & { | ||
flowId?: string | ||
flowKey?: string | ||
integrationKey?: string | ||
integrationId?: string | ||
connectionId?: string | ||
instanceKey?: string | ||
enabled?: boolean | ||
dependencyInstanceId?: string | ||
} | ||
export type FindFlowInstancesQuery = ListFlowInstancesForConnectionQuery & | ||
CommonIntegrationOrConnectionQuery | ||
/** | ||
@@ -66,0 +66,0 @@ * @deprecated |
@@ -132,2 +132,3 @@ import { insertCss } from 'insert-css' | ||
display: none; | ||
pointer-events: auto; | ||
} | ||
@@ -134,0 +135,0 @@ .${CONTAINER_ELEMENT_CLASS}.${CONTAINER_ELEMENT_CLASS__LOADER}:not(.${CONTAINER_ELEMENT_CLASS__VISIBLE}):empty { |
@@ -20,2 +20,14 @@ import { IntegrationAppError } from '../errors' | ||
} from '../actions' | ||
import { | ||
IntegrationLevelDataSourceAccessor, | ||
IntegrationLevelDataSourcesListAccessor, | ||
} from '../data-sources' | ||
import { | ||
IntegrationLevelFieldMappingAccessor, | ||
IntegrationLevelFieldMappingsListAccessor, | ||
} from '../field-mappings' | ||
import { | ||
IntegrationLevelFlowAccessor, | ||
IntegrationLevelFlowsListAccessor, | ||
} from '../flows' | ||
@@ -69,2 +81,47 @@ interface OpenIntegrationUIIntegrationConfigurationOptions | ||
get flows() { | ||
return new IntegrationLevelFlowsListAccessor( | ||
this.client, | ||
this.integrationSelector, | ||
) | ||
} | ||
flow(flowSelector: string) { | ||
return new IntegrationLevelFlowAccessor( | ||
this.client, | ||
this.integrationSelector, | ||
flowSelector, | ||
) | ||
} | ||
get dataSources() { | ||
return new IntegrationLevelDataSourcesListAccessor( | ||
this.client, | ||
this.integrationSelector, | ||
) | ||
} | ||
dataSource(dataSourceSelector: string) { | ||
return new IntegrationLevelDataSourceAccessor( | ||
this.client, | ||
this.integrationSelector, | ||
dataSourceSelector, | ||
) | ||
} | ||
get fieldMappings() { | ||
return new IntegrationLevelFieldMappingsListAccessor( | ||
this.client, | ||
this.integrationSelector, | ||
) | ||
} | ||
fieldMapping(fieldMappingSelector: string) { | ||
return new IntegrationLevelFieldMappingAccessor( | ||
this.client, | ||
this.integrationSelector, | ||
fieldMappingSelector, | ||
) | ||
} | ||
async setup(): Promise<Integration> { | ||
@@ -99,5 +156,8 @@ return this.client.post(`/integrations/${this.integrationSelector}/setup`) | ||
const uri = this.client.getEmbedUri(`integrations/${integration.id}`, { | ||
showPoweredBy: showPoweredBy ?? true, | ||
}) | ||
const uri = await this.client.getEmbedUri( | ||
`integrations/${integration.id}`, | ||
{ | ||
showPoweredBy: showPoweredBy ?? true, | ||
}, | ||
) | ||
@@ -120,3 +180,3 @@ return openIframe(uri, { | ||
): Promise<Connection> { | ||
const uri = this.client.getEmbedUri( | ||
const uri = await this.client.getEmbedUri( | ||
`integrations/${this.integrationSelector}/connect`, | ||
@@ -123,0 +183,0 @@ { |
@@ -106,2 +106,3 @@ import { DataSchema } from './data-schema' | ||
id: { type: 'string' }, | ||
key: { type: 'string' }, | ||
name: { type: 'string' }, | ||
@@ -108,0 +109,0 @@ }, |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
4843165
293
78329
4