@flatfile/hooks
Advanced tools
Comparing version 1.1.0 to 1.2.0
@@ -10,2 +10,3 @@ declare type TPrimitive = string | boolean | number | null; | ||
declare type TRecordInfoLevel = 'error' | 'warn' | 'info'; | ||
declare type TRecordStageLevel = 'onCast' | 'onEmpty' | 'onValue' | 'onValidate' | 'apply' | 'other'; | ||
interface IRecordInfo<M extends TRecordData = TRecordData, K = keyof M> { | ||
@@ -15,2 +16,3 @@ level: TRecordInfoLevel; | ||
message: string; | ||
stage: TRecordStageLevel; | ||
} | ||
@@ -22,2 +24,14 @@ interface IRawRecordWithInfo<M extends TRecordData = TRecordData> { | ||
interface IPayload { | ||
workspaceId: string; | ||
workbookId: string; | ||
schemaId: number; | ||
schemaSlug: string; | ||
uploads: string[]; | ||
endUser?: any; | ||
env?: Record<string, string | boolean | number>; | ||
envSignature?: string; | ||
rows: IRawRecord[]; | ||
} | ||
declare class FlatfileRecord<M extends TRecordData = TRecordData> { | ||
@@ -42,3 +56,3 @@ private readonly data; | ||
addWarning(fields: string | string[], message: string): this; | ||
pushInfoMessage(fields: string | string[], message: string, level: IRecordInfo['level']): this; | ||
pushInfoMessage(fields: string | string[], message: string, level: IRecordInfo['level'], stage: TRecordStageLevel): this; | ||
toJSON(): IRawRecordWithInfo<M>; | ||
@@ -54,14 +68,2 @@ } | ||
interface IPayload { | ||
workspaceId: string; | ||
workbookId: string; | ||
schemaId: number; | ||
schemaSlug: string; | ||
uploads: string[]; | ||
endUser?: any; | ||
env?: Record<string, string | boolean | number>; | ||
envSignature?: string; | ||
rows: IRawRecord[]; | ||
} | ||
declare class FlatfileSession { | ||
@@ -81,2 +83,2 @@ private payload; | ||
export { FlatfileRecord, FlatfileRecords, FlatfileSession }; | ||
export { FlatfileRecord, FlatfileRecords, FlatfileSession, IPayload, IRawRecord, IRawRecordWithInfo, IRecordInfo, TPrimitive, TRecordData, TRecordInfoLevel }; |
@@ -20,5 +20,5 @@ "use strict"; | ||
// index.ts | ||
var hooks_exports = {}; | ||
__export(hooks_exports, { | ||
// src/index.ts | ||
var src_exports = {}; | ||
__export(src_exports, { | ||
FlatfileRecord: () => FlatfileRecord, | ||
@@ -28,3 +28,3 @@ FlatfileRecords: () => FlatfileRecords, | ||
}); | ||
module.exports = __toCommonJS(hooks_exports); | ||
module.exports = __toCommonJS(src_exports); | ||
@@ -49,3 +49,3 @@ // src/classes/FlatfileRecord.ts | ||
verifyField(field) { | ||
if (!this.data.hasOwnProperty(field)) { | ||
if (!Object.prototype.hasOwnProperty.call(this.data, field)) { | ||
console.error(`Record does not have field "${field}".`); | ||
@@ -72,3 +72,3 @@ return false; | ||
addInfo(fields, message) { | ||
return this.pushInfoMessage(fields, message, "info"); | ||
return this.pushInfoMessage(fields, message, "info", "other"); | ||
} | ||
@@ -79,8 +79,8 @@ addComment(fields, message) { | ||
addError(fields, message) { | ||
return this.pushInfoMessage(fields, message, "error"); | ||
return this.pushInfoMessage(fields, message, "error", "other"); | ||
} | ||
addWarning(fields, message) { | ||
return this.pushInfoMessage(fields, message, "warn"); | ||
return this.pushInfoMessage(fields, message, "warn", "other"); | ||
} | ||
pushInfoMessage(fields, message, level) { | ||
pushInfoMessage(fields, message, level, stage) { | ||
fields = Array.isArray(fields) ? fields : [fields]; | ||
@@ -92,3 +92,4 @@ fields.forEach((field) => { | ||
message, | ||
level | ||
level, | ||
stage | ||
}); | ||
@@ -95,0 +96,0 @@ } |
{ | ||
"name": "@flatfile/hooks", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "", | ||
"main": "index.js", | ||
"main": "./dist/index.js", | ||
"module": "./dist/index.mjs", | ||
"types": "./dist/index.d.ts", | ||
"private": false, | ||
"repository": { | ||
@@ -16,3 +19,2 @@ "type": "git", | ||
"homepage": "https://github.com/FlatFilers/platform-sdk-mono#readme", | ||
"files": [ | ||
@@ -22,9 +24,11 @@ "dist/**" | ||
"scripts": { | ||
"build": "tsup index.ts --format esm,cjs --dts --external react", | ||
"dev": "tsup index.ts --format esm,cjs --watch --dts --external react", | ||
"build": "tsup src/index.ts --format esm,cjs --dts", | ||
"dev": "tsup src/index.ts --format esm,cjs --watch --dts", | ||
"lint": "TIMING=1 eslint \"src/**/*.{ts,tsx,js,jsx}\" --fix", | ||
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist", | ||
"test": "jest --runInBand --detectOpenHandles --forceExit" | ||
"test": "jest --runInBand --detectOpenHandles --forceExit --passWithNoTests" | ||
}, | ||
"devDependencies": { | ||
"@flatfile/eslint-config-platform-sdk": "*", | ||
"@flatfile/jest-preset-platform-sdk": "*", | ||
"@flatfile/ts-config-platform-sdk": "*", | ||
@@ -37,30 +41,5 @@ "@types/jest": "^28.1.4", | ||
}, | ||
"jest": { | ||
"roots": [ | ||
"<rootDir>/src" | ||
], | ||
"collectCoverage": false, | ||
"moduleNameMapper": { | ||
"src/(.*)": "<rootDir>/src/$1" | ||
}, | ||
"transform": { | ||
"^.+\\.tsx?$": "ts-jest" | ||
}, | ||
"testMatch": [ | ||
"**/__tests__/**/*.+(ts|tsx|js)", | ||
"**/?(*.)+(spec|test).+(ts|tsx|js)" | ||
], | ||
"testPathIgnorePatterns": [ | ||
"<rootdir>/node_modules/" | ||
], | ||
"moduleFileExtensions": [ | ||
"js", | ||
"ts", | ||
"tsx", | ||
"json" | ||
] | ||
}, | ||
"ts-jest": { | ||
"isolatedModules": false | ||
"publishConfig": { | ||
"access": "public" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
10603
5
350
0
9
1
8