New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@integration-app/sdk

Package Overview
Dependencies
Maintainers
4
Versions
445
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@integration-app/sdk - npm Package Compare versions

Comparing version 0.1.56 to 0.2.0

.eslintrc.js

19

data-composer.d.ts

@@ -30,5 +30,2 @@ import { JSONSchema } from './json-schema';

TEMPLATE = "template",
LITERAL = "literal",
OBJECT = "object",
ARRAY = "array",
PLAIN = "plain"

@@ -52,15 +49,3 @@ }

}
export declare class DataComposerRecipeLiteral extends DataComposerRecipeBase {
value: any;
constructor(value: any);
}
export declare class DataComposerRecipeObject extends DataComposerRecipeBase {
value: any;
constructor(value: any);
}
export declare class DataComposerRecipeArray extends DataComposerRecipeBase {
value: any;
constructor(value: any);
}
export declare type DataComposerRecipe = DataComposerRecipeLiteral | DataComposerRecipeRef | DataComposerRecipeTemplate | DataComposerRecipePlain | DataComposerRecipeObject | DataComposerRecipeArray;
export declare type DataComposerRecipe = DataComposerRecipeRef | DataComposerRecipeTemplate | DataComposerRecipePlain;
export declare class InvalidLocatorError extends Error {

@@ -73,2 +58,4 @@ }

export declare function locatorToSteps(sourceLocator: string | DataLocator): DataLocatorStep[];
export declare function locatorToString(locator: DataLocator): string;
export declare function stepsToLocator(steps: DataLocatorStep[]): string;
export declare function getSchemaByLocator(schema: any, locator: DataLocator): any;

@@ -75,0 +62,0 @@ export interface DataField {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.walkSchema = exports.makeSchemaForLocator = exports.setValueAtLocator = exports.getDataFields = exports.getSchemaByLocator = exports.locatorToSteps = exports.extractLocatorsFromTemplate = exports.makeRecipeValue = exports.getRecipe = exports.isRecipe = exports.InvalidLocatorError = exports.DataComposerRecipeArray = exports.DataComposerRecipeObject = exports.DataComposerRecipeLiteral = exports.DataComposerRecipePlain = exports.DataComposerRecipeTemplate = exports.DataComposerRecipeRef = exports.DataComposerRecipeBase = exports.DataComposerRecipeType = exports.DataLocatorAnyOfOption = exports.DataLocatorCurrentArrayItem = exports.DataLocatorArrayItem = exports.DataLocatorObjectProperty = exports.DataLocatorStep = exports.DataLocatorStepType = void 0;
exports.walkSchema = exports.makeSchemaForLocator = exports.setValueAtLocator = exports.getDataFields = exports.getSchemaByLocator = exports.stepsToLocator = exports.locatorToString = exports.locatorToSteps = exports.extractLocatorsFromTemplate = exports.makeRecipeValue = exports.getRecipe = exports.isRecipe = exports.InvalidLocatorError = exports.DataComposerRecipePlain = exports.DataComposerRecipeTemplate = exports.DataComposerRecipeRef = exports.DataComposerRecipeBase = exports.DataComposerRecipeType = exports.DataLocatorAnyOfOption = exports.DataLocatorCurrentArrayItem = exports.DataLocatorArrayItem = exports.DataLocatorObjectProperty = exports.DataLocatorStep = exports.DataLocatorStepType = void 0;
const tslib_1 = require("tslib");

@@ -52,5 +52,2 @@ const lodash_1 = (0, tslib_1.__importDefault)(require("lodash"));

DataComposerRecipeType["TEMPLATE"] = "template";
DataComposerRecipeType["LITERAL"] = "literal";
DataComposerRecipeType["OBJECT"] = "object";
DataComposerRecipeType["ARRAY"] = "array";
DataComposerRecipeType["PLAIN"] = "plain";

@@ -86,26 +83,2 @@ })(DataComposerRecipeType = exports.DataComposerRecipeType || (exports.DataComposerRecipeType = {}));

exports.DataComposerRecipePlain = DataComposerRecipePlain;
class DataComposerRecipeLiteral extends DataComposerRecipeBase {
constructor(value) {
super();
this.value = value;
this.type = DataComposerRecipeType.LITERAL;
}
}
exports.DataComposerRecipeLiteral = DataComposerRecipeLiteral;
class DataComposerRecipeObject extends DataComposerRecipeBase {
constructor(value) {
super();
this.value = value;
this.type = DataComposerRecipeType.OBJECT;
}
}
exports.DataComposerRecipeObject = DataComposerRecipeObject;
class DataComposerRecipeArray extends DataComposerRecipeBase {
constructor(value) {
super();
this.value = value;
this.type = DataComposerRecipeType.ARRAY;
}
}
exports.DataComposerRecipeArray = DataComposerRecipeArray;
class InvalidLocatorError extends Error {

@@ -188,2 +161,34 @@ }

exports.locatorToSteps = locatorToSteps;
function locatorToString(locator) {
if (typeof locator === 'object' && Array.isArray(locator)) {
return stepsToLocator(locator);
}
else {
return locator;
}
}
exports.locatorToString = locatorToString;
function stepsToLocator(steps) {
let locator = '$';
(steps !== null && steps !== void 0 ? steps : []).forEach((step) => {
switch (step.type) {
case DataLocatorStepType.OBJECT_PROPERTY:
locator += `.${step.propertyName}`;
break;
case DataLocatorStepType.ARRAY_ITEM:
locator += `[${step.index}]`;
break;
case DataLocatorStepType.CURRENT_ARRAY_ITEM:
locator += '.$current';
break;
case DataLocatorStepType.ANY_OF_OPTION:
locator += `<${step.index}>`;
break;
default:
throw new Error(`Unknown locator step type: ${step.type}`);
}
});
return locator;
}
exports.stepsToLocator = stepsToLocator;
function getSchemaByLocator(schema, locator) {

@@ -190,0 +195,0 @@ if (schema) {

@@ -6,7 +6,5 @@ import { FlowNodeLink } from './flow-nodes';

blueprintKey?: string;
parameters?: any;
userParametersSchema?: JSONSchema;
input?: any;
inputBatchSize?: number;
userInputSchema?: JSONSchema;
config?: any;
userConfigSchema?: JSONSchema;
links: FlowNodeLink[];

@@ -13,0 +11,0 @@ }

@@ -0,13 +1,8 @@

import { FlowNodeType } from './flow-nodes';
import { JSONSchema } from './json-schema';
export declare enum FlowNodeBlueprintType {
TASK = "task",
TRIGGER = "trigger"
}
export interface FlowNodeBlueprint {
key: string;
type: FlowNodeBlueprintType;
type: FlowNodeType;
name: string;
parametersSchema?: JSONSchema;
inputSchema?: JSONSchema;
outputSchema?: JSONSchema;
configScema?: JSONSchema;
setupRequestKey?: string;

@@ -14,0 +9,0 @@ destroyRequestKey?: string;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.FlowNodeBlueprintType = void 0;
var FlowNodeBlueprintType;
(function (FlowNodeBlueprintType) {
FlowNodeBlueprintType["TASK"] = "task";
FlowNodeBlueprintType["TRIGGER"] = "trigger";
})(FlowNodeBlueprintType = exports.FlowNodeBlueprintType || (exports.FlowNodeBlueprintType = {}));
//# sourceMappingURL=flow-node-blueprints.js.map

@@ -26,11 +26,8 @@ import { ErrorData } from './errors';

type: FlowNodeType;
parameters?: any;
parametersSchema?: JSONSchema;
userParameters?: any;
userParametersSchema?: any;
input?: any;
inputSchema?: JSONSchema;
userInput?: any;
userInputSchema?: JSONSchema;
inputVariablesSchema: JSONSchema;
links: FlowNodeLink[];
configSchema?: JSONSchema;
config?: any;
userConfigSchema?: JSONSchema;
userConfig?: any;
inputVariablesSchema?: JSONSchema;
inputBatchSize?: number;

@@ -44,7 +41,5 @@ outputSchema?: JSONSchema;

testRequestKey?: string;
testRecords: any[];
missingTestRecordSchema: JSONSchema;
testRecords?: any[];
missingTestRecordSchema?: JSONSchema;
latestTestRunId?: string;
links: FlowNodeLink[];
deletedTime?: Date;
}

@@ -54,6 +49,19 @@ export interface FlowNodeLink {

}
export interface CreateFlowNodeRequest {
name?: string;
userConfig?: any;
}
export interface UpdateFlowNodeRequest {
name?: string;
userConfig?: any;
outputSchema?: JSONSchema;
configurationState?: FlowNodeConfigurationState;
runStateData?: any;
testRecords?: any[];
latestTestRunId?: string;
}
export interface FlowNodeSetupPayload {
flow: Flow;
node: FlowNode;
nodeParameters: any;
config: any;
}

@@ -68,4 +76,3 @@ export interface FlowNodeSetupResponse {

node: FlowNode;
nodeParameters: any;
input: any;
config: any;
iterationData?: any;

@@ -72,0 +79,0 @@ }

@@ -1,2 +0,2 @@

import { FlowNode } from './flow-nodes';
import { CreateFlowNodeRequest, FlowNode } from './flow-nodes';
import { JSONSchema } from './json-schema';

@@ -7,3 +7,2 @@ export interface Flow {

blueprintKey?: string;
connectionKey?: string;
name: string;

@@ -17,4 +16,14 @@ parameters?: any;

}
export interface CreateFlowRequest {
blueprintKey: string;
name?: string;
parameters?: any;
nodes?: Record<string, CreateFlowNodeRequest>;
}
export interface UpdateFlowRequest {
name?: string;
parameters?: any;
}
export declare function getLinkedNodes(flow: Flow, node: FlowNode): FlowNode[];
export declare function getDownstreamNodes(flow: Flow, node: FlowNode): FlowNode[];
export declare function getUpstreamNodes(flow: Flow, node: FlowNode): FlowNode[];
{
"name": "@integration-app/sdk",
"version": "0.1.56",
"version": "0.2.0",
"description": "JavaScript SDK for Integration.app",

@@ -12,3 +12,3 @@ "main": "index.js",

"build:bundle": "rollup -c rollup.config.js",
"watch": "tsc --watch",
"dev": "tsc --watch",
"lint": "eslint -c .eslintrc .",

@@ -15,0 +15,0 @@ "test": "jest",

@@ -13,2 +13,4 @@ import {

extractLocatorsFromTemplate,
stepsToLocator,
locatorToString,
} from './data-composer'

@@ -415,2 +417,42 @@ import { JSONSchemaType } from './json-schema'

})
describe('stepsToLocator', () => {
it('should convert undefined, null, and empty array values to a root locator', () => {
expect(stepsToLocator(undefined)).toEqual('$')
expect(stepsToLocator(null)).toEqual('$')
expect(stepsToLocator([])).toEqual('$')
})
it('should convert steps to corresponding locator parts', () => {
expect(
stepsToLocator([
new DataLocatorObjectProperty('friends'),
new DataLocatorCurrentArrayItem(),
new DataLocatorObjectProperty('names'),
new DataLocatorArrayItem(2),
new DataLocatorAnyOfOption(5),
new DataLocatorObjectProperty('firstName'),
]),
).toEqual('$.friends.$current.names[2]<5>.firstName')
})
})
describe('locatorToString', () => {
it('should keep empty values empty', () => {
expect(locatorToString(undefined)).toBeUndefined()
expect(locatorToString(null)).toEqual(null)
})
it('should keep string values string', () => {
expect(locatorToString('')).toEqual('')
expect(locatorToString('$')).toEqual('$')
expect(locatorToString('$.name')).toEqual('$.name')
})
it('should convert locator steps to string', () => {
expect(
locatorToString([
new DataLocatorObjectProperty('posts'),
new DataLocatorCurrentArrayItem(),
]),
).toEqual('$.posts.$current')
})
})
})

@@ -48,5 +48,2 @@ import _ from 'lodash'

TEMPLATE = 'template', // template. e.g. "The value is {$.record.value}"
LITERAL = 'literal', // deprecated in favor of 'OBJECT' or 'ARRAY'
OBJECT = 'object', // object with each property a recipe
ARRAY = 'array', // array with each property a recipe
PLAIN = 'plain', // plain JSON object

@@ -80,30 +77,6 @@ }

export class DataComposerRecipeLiteral extends DataComposerRecipeBase {
constructor(public value: any) {
super()
this.type = DataComposerRecipeType.LITERAL
}
}
export class DataComposerRecipeObject extends DataComposerRecipeBase {
constructor(public value) {
super()
this.type = DataComposerRecipeType.OBJECT
}
}
export class DataComposerRecipeArray extends DataComposerRecipeBase {
constructor(public value) {
super()
this.type = DataComposerRecipeType.ARRAY
}
}
export type DataComposerRecipe =
| DataComposerRecipeLiteral
| DataComposerRecipeRef
| DataComposerRecipeTemplate
| DataComposerRecipePlain
| DataComposerRecipeObject
| DataComposerRecipeArray

@@ -216,2 +189,33 @@ export class InvalidLocatorError extends Error {}

export function locatorToString(locator: DataLocator): string {
if (typeof locator === 'object' && Array.isArray(locator)) {
return stepsToLocator(locator)
} else {
return locator
}
}
export function stepsToLocator(steps: DataLocatorStep[]): string {
let locator = '$'
;(steps ?? []).forEach((step) => {
switch (step.type) {
case DataLocatorStepType.OBJECT_PROPERTY:
locator += `.${(step as DataLocatorObjectProperty).propertyName}`
break
case DataLocatorStepType.ARRAY_ITEM:
locator += `[${(step as DataLocatorArrayItem).index}]`
break
case DataLocatorStepType.CURRENT_ARRAY_ITEM:
locator += '.$current'
break
case DataLocatorStepType.ANY_OF_OPTION:
locator += `<${(step as DataLocatorAnyOfOption).index}>`
break
default:
throw new Error(`Unknown locator step type: ${step.type}`)
}
})
return locator
}
/*

@@ -218,0 +222,0 @@ Extract sub-schema that pointer points at.

@@ -9,12 +9,14 @@ import { FlowNodeLink } from './flow-nodes'

parameters?: any
inputBatchSize?: number
userParametersSchema?: JSONSchema
/**
* Node configuration provided by the developer
*/
config?: any
input?: any
/**
* Schema user's configuration must match.
*/
userConfigSchema?: JSONSchema
inputBatchSize?: number
userInputSchema?: JSONSchema
links: FlowNodeLink[]

@@ -21,0 +23,0 @@ }

@@ -0,21 +1,13 @@

import { FlowNodeType } from './flow-nodes'
import { JSONSchema } from './json-schema'
export enum FlowNodeBlueprintType {
TASK = 'task',
TRIGGER = 'trigger',
}
export interface FlowNodeBlueprint {
key: string
type: FlowNodeBlueprintType
type: FlowNodeType
name: string
parametersSchema?: JSONSchema
configScema?: JSONSchema
inputSchema?: JSONSchema
outputSchema?: JSONSchema
setupRequestKey?: string

@@ -22,0 +14,0 @@

@@ -53,55 +53,45 @@ import { ErrorData } from './errors'

type: FlowNodeType
/**
* Flow node parameters. May contain `DataComposerRecipe`s.
* Type (copied from blueprint)
*/
parameters?: any
type: FlowNodeType
/**
* Schema `parameters` must match before node can be setup.
* Links to subsequent nodes.
* When this node finishes run within a flow run,
* runs for linked nodes will be started.
*/
parametersSchema?: JSONSchema
links: FlowNodeLink[]
/**
* Part of the parameters provided by the end-user.
* Can be used in recipes inside `parameters`.
* Schema configuration must match.
* Copied from blueprint and cannot be changed.
*/
userParameters?: any
configSchema?: JSONSchema
/**
* Schema `userParameters` must match.
* Node configuration by the flow's developer.
*/
userParametersSchema?: any
config?: any
/**
* Input provied to the node's `run` and `test` functions.
* May contain `DataComposerRecipe`s
* Schema userConfig must match.
* Used to display node configuration screen to the user.
*/
input?: any
userConfigSchema?: JSONSchema
/**
* Schema `input` must match to be considered valid.
* Node configuration provided by the user.
* Can be used as Data Composer variable in `config`.
*/
inputSchema?: JSONSchema
userConfig?: any
/**
* Part of the input provided by user.
* Can be used in recipes inside `input`.
* Calculated schema for variables available for Data Composer Recipes
* inside `config` and `userConfig`.
* They come from previous nodes output and other places.
*/
userInput?: any
inputVariablesSchema?: JSONSchema
/**
* Schema `userInput` must match to be considered valid.
*/
userInputSchema?: JSONSchema
/**
* Variables available for Data Composer Recipes
* inside `input` and `userInput`.
* They come from previous nodes and other places.
*/
inputVariablesSchema: JSONSchema
/**
* If node processes input records in batch, this variable is set

@@ -159,3 +149,3 @@ * to the size of the batch.

*/
testRecords: any[]
testRecords?: any[]

@@ -166,3 +156,3 @@ /**

*/
missingTestRecordSchema: JSONSchema
missingTestRecordSchema?: JSONSchema

@@ -174,14 +164,2 @@ /**

latestTestRunId?: string
/**
* Links to subsequent nodes.
* When this node finishes run within a flow run,
* runs for linked nodes will be started.
*/
links: FlowNodeLink[]
/**
* When this node was deleted
*/
deletedTime?: Date
}

@@ -198,6 +176,28 @@

export interface CreateFlowNodeRequest {
name?: string
userConfig?: any
}
export interface UpdateFlowNodeRequest {
name?: string
userConfig?: any
outputSchema?: JSONSchema
configurationState?: FlowNodeConfigurationState
runStateData?: any
testRecords?: any[]
latestTestRunId?: string
}
export interface FlowNodeSetupPayload {
flow: Flow
node: FlowNode
nodeParameters: any
config: any
}

@@ -215,4 +215,3 @@

node: FlowNode
nodeParameters: any
input: any
config: any
iterationData?: any

@@ -219,0 +218,0 @@ }

@@ -1,2 +0,2 @@

import { FlowNode } from './flow-nodes'
import { CreateFlowNodeRequest, FlowNode } from './flow-nodes'
import { JSONSchema } from './json-schema'

@@ -9,12 +9,28 @@

/**
* Key of a FlowBlueprint this flow was created from.
*/
blueprintKey?: string
connectionKey?: string
/**
* This flow's unique user-readable name.
*/
name: string
/**
* This flow's parameters.
* Can be used as variables in FlowNode.config
*/
parameters?: any
/**
* Schema of parameters the flow accepts.
* Copied from FlowBlueprint
*/
parametersSchema?: JSONSchema
/**
* Dictionary of flow's nodes:
* <key>: <node>
*/
nodes?: Record<string, FlowNode>

@@ -27,2 +43,18 @@ }

export interface CreateFlowRequest {
blueprintKey: string
name?: string
parameters?: any
nodes?: Record<string, CreateFlowNodeRequest>
}
export interface UpdateFlowRequest {
name?: string
parameters?: any
}
/**

@@ -29,0 +61,0 @@ * Returns nodes of a given flow linked from the given node via `node.links`

@@ -34,10 +34,8 @@ {

"include": [
"src/**/*.ts"
"src/**/*.ts",
".eslintrc.js",
],
"exclude": [
"node_modules",
"./*.ts",
"./*.d.ts",
"./*.js"
]
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc