@flatfile/hooks
Advanced tools
Comparing version 1.2.0 to 1.2.1
@@ -1,3 +0,3 @@ | ||
declare type TPrimitive = string | boolean | number | null; | ||
declare type TRecordData<T extends TPrimitive | undefined = TPrimitive> = { | ||
type TPrimitive = string | boolean | number | null; | ||
type TRecordData<T extends TPrimitive | undefined = TPrimitive> = { | ||
[key: string]: T; | ||
@@ -7,6 +7,6 @@ }; | ||
rawData: TRecordData; | ||
rowId: number; | ||
rowId: number | string; | ||
} | ||
declare type TRecordInfoLevel = 'error' | 'warn' | 'info'; | ||
declare type TRecordStageLevel = 'onCast' | 'onEmpty' | 'onValue' | 'onValidate' | 'apply' | 'other'; | ||
type TRecordInfoLevel = 'error' | 'warn' | 'info'; | ||
type TRecordStageLevel = 'cast' | 'empty' | 'required' | 'compute' | 'validate' | 'apply' | 'other'; | ||
interface IRecordInfo<M extends TRecordData = TRecordData, K = keyof M> { | ||
@@ -22,3 +22,2 @@ level: TRecordInfoLevel; | ||
} | ||
interface IPayload { | ||
@@ -35,3 +34,2 @@ workspaceId: string; | ||
} | ||
declare class FlatfileRecord<M extends TRecordData = TRecordData> { | ||
@@ -43,3 +41,3 @@ private readonly data; | ||
constructor(raw: IRawRecord); | ||
get rowId(): number; | ||
get rowId(): string | number; | ||
get originalValue(): M; | ||
@@ -49,3 +47,5 @@ get value(): M; | ||
set(field: string, value: TPrimitive): this; | ||
setLinkedValue(linkedFieldKey: string, childKey: string, value: TPrimitive): this; | ||
get(field: string): null | TPrimitive; | ||
getLinkedValue(linkedFieldKey: string, childKey: string): string | number | boolean | null; | ||
addInfo(fields: string | string[], message: string): this; | ||
@@ -83,2 +83,2 @@ /** | ||
export { FlatfileRecord, FlatfileRecords, FlatfileSession, IPayload, IRawRecord, IRawRecordWithInfo, IRecordInfo, TPrimitive, TRecordData, TRecordInfoLevel }; | ||
export { FlatfileRecord, FlatfileRecords, FlatfileSession, IPayload, IRawRecord, IRawRecordWithInfo, IRecordInfo, TPrimitive, TRecordData, TRecordInfoLevel, TRecordStageLevel }; |
@@ -62,2 +62,9 @@ "use strict"; | ||
} | ||
setLinkedValue(linkedFieldKey, childKey, value) { | ||
if (!this.verifyField(linkedFieldKey)) { | ||
return this; | ||
} | ||
Object.assign(this.mutated, { [`${linkedFieldKey}::${childKey}`]: value }); | ||
return this; | ||
} | ||
get(field) { | ||
@@ -69,2 +76,9 @@ if (this.verifyField(field)) { | ||
} | ||
getLinkedValue(linkedFieldKey, childKey) { | ||
var _a; | ||
if (this.verifyField(linkedFieldKey)) { | ||
return (_a = this.mutated[`${linkedFieldKey}::${childKey}`]) != null ? _a : null; | ||
} | ||
return null; | ||
} | ||
addInfo(fields, message) { | ||
@@ -110,3 +124,5 @@ return this.pushInfoMessage(fields, message, "info", "other"); | ||
constructor(rawRecords) { | ||
this._records = rawRecords.map((rawRecord) => new FlatfileRecord(rawRecord)); | ||
this._records = rawRecords.map( | ||
(rawRecord) => new FlatfileRecord(rawRecord) | ||
); | ||
} | ||
@@ -113,0 +129,0 @@ get records() { |
{ | ||
"name": "@flatfile/hooks", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
@@ -9,1 +9,11 @@ # Hooks | ||
## Testing layer versions | ||
1. build the `/hooks` package `npm run build` | ||
2. move `/hooks/dist` directory to `/Downloads`, rename it `Downloads/data-hooks-sdk` and compress it in a .zip file | ||
3. log into aws Flatfile Developers management console > Lambda > Layers > data-hooks-sdk | ||
4. click create version, upload .zip and add a description | ||
5. find an active data hook id in your local database `data_hooks.lambda_arn` (id starts with "generate:") | ||
6. navigate to Lambda > Functions and search for the data hook by id | ||
7. update the hook's layer version to the new one you just created | ||
8. run the hook in the management console Test tab with a sample payload |
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
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
12353
384
19