Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: update for rejection response plugin updates #34

Merged
merged 2 commits into from
Dec 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 1 addition & 13 deletions javascript/shared/workbook_submit.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,19 +51,7 @@ export default function flatfileEventListener(listener) {
if (response.status === 200) {
const rejections = response.data.rejections;
if (rejections) {
const totalRejectedRecords = await responseRejectionHandler(
rejections
);
return await api.jobs.complete(jobId, {
outcome: {
next: {
type: "id",
id: rejections.id,
label: "See rejections...",
},
message: `Data was submission was partially successful. ${totalRejectedRecords} record(s) were rejected.`,
},
});
return await responseRejectionHandler(rejections);
}
return await api.jobs.complete(jobId, {
outcome: {
Expand Down
10 changes: 5 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"@flatfile/plugin-xlsx-extractor": "^0.0.6",
"@flatfile/plugin-xml-extractor": "^0.5.0",
"@flatfile/plugin-zip-extractor": "^0.3.6",
"@flatfile/util-response-rejection": "^0.1.0",
"@flatfile/util-response-rejection": "^0.1.4",
"axios": "^1.5.0",
"flatfile": "^3.5.9",
"form-data": "^4.0.0",
Expand Down
21 changes: 6 additions & 15 deletions typescript/shared/workbook_submit.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import api from "@flatfile/api";
import { FlatfileEvent, FlatfileListener } from "@flatfile/listener";
import { responseRejectionHandler } from "@flatfile/util-response-rejection";
import {
RejectionResponse,
responseRejectionHandler,
} from "@flatfile/util-response-rejection";
import axios from "axios";

export default function flatfileEventListener(listener: FlatfileListener) {
Expand Down Expand Up @@ -52,21 +55,9 @@ export default function flatfileEventListener(listener: FlatfileListener) {
);

if (response.status === 200) {
const rejections = response.data.rejections;
const rejections: RejectionResponse = response.data.rejections;
if (rejections) {
const totalRejectedRecords = await responseRejectionHandler(
rejections
);
return await api.jobs.complete(jobId, {
outcome: {
next: {
type: "id",
id: rejections.id,
label: "See rejections...",
},
message: `Data was submission was partially successful. ${totalRejectedRecords} record(s) were rejected.`,
},
});
return await responseRejectionHandler(rejections);
}
return await api.jobs.complete(jobId, {
outcome: {
Expand Down