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

@flatfile/sdk

Package Overview
Dependencies
Maintainers
19
Versions
61
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@flatfile/sdk - npm Package Compare versions

Comparing version 2.0.0-rc1 to 2.0.0-rc10

dist/errors/ChunkTimeoutError.d.ts

1

dist/errors/FlatfileError.d.ts
export declare class FlatfileError extends Error {
code: string;
debug: string;
name: string;
userMessage: string;
constructor(message?: string);
}

55

dist/Flatfile.d.ts

@@ -1,26 +0,42 @@

import { ApiService } from './graphql/api';
import { ImportSession } from './importer/ImportSession';
import { IEvents, IFlatfileConfig, IFlatfileImporterConfig, IRawToken, JsonWebToken } from './types';
import { TypedEventManager } from './utils/TypedEventManager';
import { FlatfileError } from './errors/FlatfileError';
import { ApiService } from './graphql/ApiService';
import { IChunkOptions, ImportSession } from './importer/ImportSession';
import { IteratorCallback } from './lib/RecordChunkIterator';
import { TypedEventManager } from './lib/TypedEventManager';
import { UIService } from './service/UIService';
import { IEvents, IFlatfileConfig, IFlatfileImporterConfig, IImportSessionConfig, IRawToken, JsonWebToken } from './types';
export declare class Flatfile extends TypedEventManager<IEvents> {
/**
* The configuration of this instance of Flatfile with defaults merged in
*/
readonly config: IFlatfileConfig;
/**
* Reference to a pre-authenticated instance of the API service
*/
readonly api: ApiService;
api?: ApiService;
ui: UIService;
constructor(config: IFlatfileImporterConfig);
constructor(token: string, config: IFlatfileImporterConfig);
/**
* The configuration of this instance of Flatfile with defaults merged in
* Returns / resolves a token or generates a JWT from embedId, user & org
*/
readonly config: IFlatfileConfig;
token(): Promise<JsonWebToken>;
private extractToken;
/**
* JWT for securing user data while interacting with Flatfile
* Creates a new pre-authenticated instance of the API service
*/
readonly token: JsonWebToken;
constructor(token: JsonWebToken, config?: IFlatfileImporterConfig);
private initApi;
/**
* Start a new import or resume the one that's currently in progress
*/
startOrResumeImportSession(options?: {
open?: 'iframe' | 'window';
}): Promise<ImportSession>;
startOrResumeImportSession(options?: IOpenOptions & IChunkOptions & IImportSessionConfig): Promise<ImportSession>;
/**
* Simple function that abstracts away some of the complexity for a single line call
* also provides some level of backwards compatability
*/
requestDataFromUser(): void;
requestDataFromUser(opts: DataReqOptions): void;
requestDataFromUser(cb: IteratorCallback, opts?: DataReqOptions): void;
handleError(error: FlatfileError): void;
/**
* Generate a token that only works for an embed development mode.

@@ -35,2 +51,7 @@ * This keeps the "hello world" effort very low but doesn't impact security.

static getDevelopmentToken(embedId: string, body?: IRawToken, key?: string): Promise<JsonWebToken>;
static requestDataFromUser(options?: DataReqOptions & IFlatfileImporterConfig): void;
static extractImporterOptions(options: DataReqOptions & IFlatfileImporterConfig): {
sessionConfig: DataReqOptions;
importerConfig: IFlatfileImporterConfig;
};
/**

@@ -44,1 +65,9 @@ * Merge in any user provided configuration with defaults.

}
export declare const SESSION_CONFIG_KEYS: (keyof DataReqOptions)[];
export declare const IMPORTER_CONFIG_KEYS: (keyof IFlatfileImporterConfig)[];
interface IOpenOptions {
open?: 'iframe' | 'window';
autoContinue?: boolean;
}
declare type DataReqOptions = IOpenOptions & IChunkOptions & IImportSessionConfig;
export {};

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

import { ELevel, ERecordStatus, TRecordData } from '../service/FlatfileRecord';
import { ELevel, ERecordStatus, TRecordData } from '../../service/FlatfileRecord';
export interface IRowResponse {

@@ -3,0 +3,0 @@ id: number;

import { Flatfile } from '../Flatfile';
import { TypedEventManager } from '../lib/TypedEventManager';
import { IEvents } from '../types';
import { TypedEventManager } from '../utils/TypedEventManager';
export declare class DeprecatedImporter extends TypedEventManager<IEvents> {

@@ -5,0 +5,0 @@ ff: Flatfile;

@@ -1,7 +0,13 @@

import { ImportSession } from './ImportSession';
export declare class ImportFrame {
private batch;
import { TypedEventManager } from '../lib/TypedEventManager';
import { UIService } from '../service/UIService';
import { ImportSession, IUrlOptions } from './ImportSession';
export interface IImportFrameEvents {
load: void;
}
export declare class ImportFrame extends TypedEventManager<IImportFrameEvents> {
private session;
ui: UIService;
private $iframe?;
constructor(batch: ImportSession);
open(): this;
constructor(session: ImportSession);
open(options?: IUrlOptions): this;
/**

@@ -12,5 +18,2 @@ * todo: handle the close better, support cleaner transition

private createIFrameElement;
private initializeFlatfileWrapper;
private get $close();
private get $container();
}

@@ -1,13 +0,18 @@

import { Flatfile } from '../Flatfile';
import { Flatfile } from 'Flatfile';
import { UIService } from 'service/UIService';
import { ApiService } from '../graphql/ApiService';
import { GetFinalDatabaseViewResponse } from '../graphql/queries/GET_FINAL_DATABASE_VIEW';
import { PartialRejection } from '../graphql/service/PartialRejection';
import { RecordsChunk } from '../graphql/service/RecordsChunk';
import { TypedEventManager } from '../utils/TypedEventManager';
import { IteratorCallback, RecordChunkIterator } from '../lib/RecordChunkIterator';
import { TypedEventManager } from '../lib/TypedEventManager';
import { TPrimitive } from '../service/FlatfileRecord';
import { ImportFrame } from './ImportFrame';
export declare class ImportSession extends TypedEventManager<IBatchEvents> {
export declare class ImportSession extends TypedEventManager<IImportSessionEvents> {
flatfile: Flatfile;
meta: IImportMeta;
ui: UIService;
api: ApiService;
private $iframe?;
batchId: string;
constructor(flatfile: Flatfile, meta: IImportMeta);
get batchId(): string;
init(): IImportMeta;
/**

@@ -17,4 +22,8 @@ * Open the importer in an iframe (recommended)

*/
openInEmbeddedIframe(): ImportFrame;
openInEmbeddedIframe(options?: IUrlOptions): ImportFrame;
/**
* Open the import in a new window and listen for data
*/
openInNewWindow(options?: IUrlOptions): Window;
/**
* Returns the iframe helper, useful in more advanced implementations

@@ -24,2 +33,9 @@ */

/**
* Update the environment with unsigned values
* @param env
*/
updateEnvironment(env: Record<string, TPrimitive>): Promise<{
success: boolean;
}>;
/**
* Chunk and handle data response

@@ -29,12 +45,3 @@ * @param cb

*/
processPendingRecords(cb: (chunk: RecordsChunk, next: (res?: PartialRejection) => void) => Promise<void> | void, options?: {
chunkSize?: number;
}): Promise<this>;
/**
* Open the import in a new window and listen for data
*/
openInNewWindow(): Window;
/**
* @todo make this less lines and more readable
*/
processPendingRecords(cb: IteratorCallback, options?: IChunkOptions): Promise<RecordChunkIterator>;
private subscribeToBatchStatus;

@@ -45,6 +52,9 @@ /**

*/
get signedImportUrl(): string;
signedImportUrl(options?: IUrlOptions): string;
}
export interface IBatchEvents {
init: IImportMeta;
export interface IImportSessionEvents {
init: {
session: ImportSession;
meta: IImportMeta;
};
upload: {

@@ -56,2 +66,3 @@ uploadId: string;

};
/** @deprecated */
launch: {

@@ -69,5 +80,13 @@ batchId: string;

batchId: string;
mountUrl?: string;
workspaceId: string;
workbookId: string;
workbookId?: string;
schemaIds: string[];
}
export interface IChunkOptions {
chunkSize?: number;
chunkTimeout?: number;
}
export interface IUrlOptions {
autoContinue?: boolean;
}
export * from './types';
export * from './graphql/api';
export * from './importer/DeprecatedImporter';

@@ -8,1 +7,10 @@ export * from './importer/ImportFrame';

export * from './importer/flatfileImporter';
export * from './graphql/ApiService';
export * from './service/ClientResponse';
export * from './service/FlatfileRecord';
export * from './service/PartialRejection';
export * from './service/RecordError';
export * from './service/RecordMutation';
export * from './service/RecordsChunk';
export * from './lib/RecordChunkIterator';
export * from './lib/serializeHook';

@@ -0,1 +1,4 @@

import { IImportMeta, IImportSessionEvents, ImportSession } from 'importer/ImportSession';
import { IteratorCallback } from 'lib/RecordChunkIterator';
import { FlatfileError } from './errors/FlatfileError';
import { GetFinalDatabaseViewResponse } from './graphql/queries/GET_FINAL_DATABASE_VIEW';

@@ -5,14 +8,23 @@ export interface IFlatfileImporterConfig {

apiUrl?: string;
token?: JsonWebToken | (() => JsonWebToken | Promise<JsonWebToken>);
embedId?: string;
user?: IUser;
org?: IOrganization;
onError?: (payload: {
error: FlatfileError;
}) => void | Promise<void>;
}
export interface IFlatfileConfig {
export interface IFlatfileConfig extends IFlatfileImporterConfig {
mountUrl: string;
apiUrl: string;
}
export interface IImportSessionConfig {
onInit?: (payload: IImportSessionEvents['init']) => void | Promise<void>;
onData?: IteratorCallback;
onComplete?: (payload: IImportSessionEvents['complete']) => void | Promise<void>;
}
export interface IEvents {
init: {
batchId: string;
schemas: {
id: number;
}[];
workspaceId: string;
session: ImportSession;
meta: IImportMeta;
};

@@ -23,3 +35,3 @@ upload: {

error: {
error: Error;
error: FlatfileError;
};

@@ -26,0 +38,0 @@ launch: {

{
"name": "@flatfile/sdk",
"version": "2.0.0-rc1",
"version": "2.0.0-rc10",
"description": "Flatfile SDK",

@@ -37,8 +37,2 @@ "private": false,

"license": "ISC",
"dependencies": {
"eventemitter3": "^4.0.7",
"graphql": "^15.5.0",
"graphql-request": "^3.4.0",
"graphql-subscriptions-client": "^0.16.0"
},
"devDependencies": {

@@ -55,5 +49,6 @@ "@babel/cli": "^7.14.5",

"@types/backo2": "^1.0.1",
"@types/jest": "^26.0.23",
"@types/jest": "^27.0.3",
"@types/react": "^17.0.11",
"@types/react-dom": "^17.0.8",
"@types/simple-mock": "^0.8.2",
"@types/styled-components": "^5.1.10",

@@ -64,2 +59,4 @@ "@typescript-eslint/eslint-plugin": "^4.28.0",

"babel-loader": "^8.2.2",
"bulma": "^0.9.3",
"css-loader": "^6.6.0",
"cz-conventional-changelog": "^3.3.0",

@@ -71,13 +68,24 @@ "dotenv-webpack": "^7.0.3",

"eslint-plugin-simple-import-sort": "^7.0.0",
"eventemitter3": "^4.0.7",
"graphql": "^15.5.0",
"graphql-request": "^3.4.0",
"graphql-subscriptions-client": "^0.16.0",
"husky": "^6.0.0",
"jest": "^27.0.3",
"lint-staged": "^11.0.0",
"minify-graphql-loader": "^1.0.2",
"nock": "^13.2.2",
"nqr": "^1.0.0",
"prettier": "^2.3.1",
"react": "^17.0.2",
"react-bulma-components": "^4.0.7",
"react-dom": "^17.0.2",
"react-highlight": "^0.14.0",
"simple-mock": "^0.8.0",
"style-loader": "^3.3.1",
"styled-components": "^5.3.0",
"transferable-function": "^1.0.2",
"ts-jest": "^27.0.3",
"tslib": "^2.3.0",
"typedoc": "^0.22.11",
"typedoc-plugin-markdown": "^3.11.12",
"typescript": "^4.3.4",

@@ -94,2 +102,3 @@ "webpack": "^5.40.0",

],
"collectCoverage": false,
"moduleNameMapper": {

@@ -96,0 +105,0 @@ "src/(.*)": "<rootDir>/src/$1",

Sorry, the diff of this file is too big to display

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