diff --git a/.changeset/dry-apples-teach.md b/.changeset/dry-apples-teach.md new file mode 100644 index 000000000..74caaf8d5 --- /dev/null +++ b/.changeset/dry-apples-teach.md @@ -0,0 +1,5 @@ +--- +'@flatfile/plugin-zip-egress': minor +--- + +Introducing the @flatfile/plugin-zip-egress diff --git a/package-lock.json b/package-lock.json index 2b621a504..045d2326d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -43,7 +43,7 @@ }, "bundlers/rollup-config": { "name": "@flatfile/rollup-config", - "version": "0.0.0", + "version": "0.1.0", "license": "ISC", "dependencies": { "@rollup/plugin-commonjs": "^25.0.7", @@ -79,9 +79,8 @@ }, "node_modules/@apidevtools/json-schema-ref-parser": { "version": "9.0.9", - "resolved": "https://registry.npmjs.org/@apidevtools/json-schema-ref-parser/-/json-schema-ref-parser-9.0.9.tgz", - "integrity": "sha512-GBD2Le9w2+lVFoc4vswGI/TjkNIZSVp7+9xPf+X3uidBfWnAeUWmquteSyt0+VCrhNMWj/FTABISQrD3Z/YA+w==", "dev": true, + "license": "MIT", "dependencies": { "@jsdevtools/ono": "^7.1.3", "@types/json-schema": "^7.0.6", @@ -91,15 +90,13 @@ }, "node_modules/@apidevtools/json-schema-ref-parser/node_modules/argparse": { "version": "2.0.1", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", - "dev": true + "dev": true, + "license": "Python-2.0" }, "node_modules/@apidevtools/json-schema-ref-parser/node_modules/js-yaml": { "version": "4.1.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", - "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", "dev": true, + "license": "MIT", "dependencies": { "argparse": "^2.0.1" }, @@ -1128,8 +1125,6 @@ }, "node_modules/@flatfile/blueprint": { "version": "0.0.9", - "resolved": "https://registry.npmjs.org/@flatfile/blueprint/-/blueprint-0.0.9.tgz", - "integrity": "sha512-MfHea4Gp/0pEBaWU91DsrvVa2FFmFCop2WplA1pU6gD1JI8eDqS8+KyJQks07qRSdicifbdOsmQM6C7t3dSuew==", "dev": true, "dependencies": { "openapi-typescript-codegen": "^0.23.0" @@ -1145,9 +1140,8 @@ }, "node_modules/@flatfile/configure": { "version": "0.5.39", - "resolved": "https://registry.npmjs.org/@flatfile/configure/-/configure-0.5.39.tgz", - "integrity": "sha512-J6y7GbfKKWWdT8FciKbYlfKlfaY838q9Sm0+MURuO0UcuBLpM+HQ0D0kWq4tOeODvuKeWsEV28Zvi+4kT9jZ0Q==", "dev": true, + "license": "ISC", "dependencies": { "@flatfile/hooks": "^1.3.1", "@flatfile/schema": "^0.2.16", @@ -1296,6 +1290,10 @@ "resolved": "plugins/xml-extractor", "link": true }, + "node_modules/@flatfile/plugin-zip-egress": { + "resolved": "plugins/zip-egress", + "link": true + }, "node_modules/@flatfile/plugin-zip-extractor": { "resolved": "plugins/zip-extractor", "link": true @@ -1306,8 +1304,6 @@ }, "node_modules/@flatfile/schema": { "version": "0.2.17", - "resolved": "https://registry.npmjs.org/@flatfile/schema/-/schema-0.2.17.tgz", - "integrity": "sha512-zVafqWP/NFyePnfmCyqMK1ahJgKktG+n5v2CHo74lvLa0viilc9B+lX8BF0KMmRuKGOfsGIi3jbv19p6Pp95WQ==", "dev": true, "dependencies": { "@flatfile/blueprint": "^0.0.9" @@ -2102,9 +2098,8 @@ }, "node_modules/@jsdevtools/ono": { "version": "7.1.3", - "resolved": "https://registry.npmjs.org/@jsdevtools/ono/-/ono-7.1.3.tgz", - "integrity": "sha512-4JQNk+3mVzK3xh2rqd6RB4J46qUR19azEHBneZyTZM+c456qOrbbM/5xcR8huNCCcbVt7+UmizG6GuUvPvKUYg==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@lezer/common": { "version": "1.2.1", @@ -3071,9 +3066,8 @@ }, "node_modules/@parcel/packager-ts": { "version": "2.12.0", - "resolved": "https://registry.npmjs.org/@parcel/packager-ts/-/packager-ts-2.12.0.tgz", - "integrity": "sha512-8wR0BNN2NBD+IIU0tjioK+lRD4p2Qi/fKxDH5ixEW912tRV+Vd4kE8k++U6YQIpSlK4FRnjFod5zYYhNSLuiXg==", "dev": true, + "license": "MIT", "dependencies": { "@parcel/plugin": "2.12.0" }, @@ -3609,9 +3603,8 @@ }, "node_modules/@parcel/transformer-typescript-types": { "version": "2.12.0", - "resolved": "https://registry.npmjs.org/@parcel/transformer-typescript-types/-/transformer-typescript-types-2.12.0.tgz", - "integrity": "sha512-uxF4UBMYvbjiV3zHTWMrZX8cFD92VUvD3ArcGi5WEtuVROUm9Sc47o0mOzxKfMFlJu2KOfZVHYlzK9f/UKA2kQ==", "dev": true, + "license": "MIT", "dependencies": { "@parcel/diagnostic": "2.12.0", "@parcel/plugin": "2.12.0", @@ -3634,9 +3627,8 @@ }, "node_modules/@parcel/ts-utils": { "version": "2.12.0", - "resolved": "https://registry.npmjs.org/@parcel/ts-utils/-/ts-utils-2.12.0.tgz", - "integrity": "sha512-zou+W6dcqnXXUOfN5zGM+ePIWbYOhGp8bVB2jICoNkoKmNAHd4l4zeHl5yQXnbZfynVw88cZVqxtXS8tYebelg==", "dev": true, + "license": "MIT", "dependencies": { "nullthrows": "^1.1.1" }, @@ -4138,8 +4130,7 @@ }, "node_modules/@rollup/plugin-sucrase": { "version": "5.0.2", - "resolved": "https://registry.npmjs.org/@rollup/plugin-sucrase/-/plugin-sucrase-5.0.2.tgz", - "integrity": "sha512-4MhIVH9Dy2Hwose1/x5QMs0XF7yn9jDd/yozHqzdIrMWIolgFpGnrnVhQkqTaK1RALY/fpyrEKmwH/04vr1THA==", + "license": "MIT", "dependencies": { "@rollup/pluginutils": "^5.0.1", "sucrase": "^3.27.0" @@ -4292,9 +4283,9 @@ ] }, "node_modules/@rollup/rollup-linux-x64-gnu": { - "version": "4.14.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.14.0.tgz", - "integrity": "sha512-C6y6z2eCNCfhZxT9u+jAM2Fup89ZjiG5pIzZIDycs1IwESviLxwkQcFRGLjnDrP+PT+v5i4YFvlcfAs+LnreXg==", + "version": "4.14.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.14.1.tgz", + "integrity": "sha512-9Q7DGjZN+hTdJomaQ3Iub4m6VPu1r94bmK2z3UeWP3dGUecRC54tmVu9vKHTm1bOt3ASoYtEz6JSRLFzrysKlA==", "cpu": [ "x64" ], @@ -4561,9 +4552,8 @@ }, "node_modules/@types/json-schema": { "version": "7.0.15", - "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", - "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@types/jsonfile": { "version": "6.1.4", @@ -4691,8 +4681,9 @@ } }, "node_modules/adm-zip": { - "version": "0.5.10", - "license": "MIT", + "version": "0.5.12", + "resolved": "https://registry.npmjs.org/adm-zip/-/adm-zip-0.5.12.tgz", + "integrity": "sha512-6TVU49mK6KZb4qG6xWaaM4C7sA/sgUMLy/JYMOzkcp3BvVLpW0fXDFQiIzAuxFCt/2+xD7fNIiPFAoLZPhVNLQ==", "engines": { "node": ">=6.0" } @@ -5351,9 +5342,8 @@ }, "node_modules/call-me-maybe": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/call-me-maybe/-/call-me-maybe-1.0.2.tgz", - "integrity": "sha512-HpX65o1Hnr9HH25ojC1YGs7HCQLq0GCOibSaWER0eNpgJ/Z1MZv2mTc7+xh6WOPxbRVcmgbv4hGU+uSQ/2xFZQ==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/callsites": { "version": "3.1.0", @@ -5406,9 +5396,8 @@ }, "node_modules/case-anything": { "version": "2.1.13", - "resolved": "https://registry.npmjs.org/case-anything/-/case-anything-2.1.13.tgz", - "integrity": "sha512-zlOQ80VrQ2Ue+ymH5OuM/DlDq64mEm+B9UTdHULv5osUMD6HalNTblf2b1u/m6QecjsnOkBpqVZ+XPwIVsy7Ng==", "dev": true, + "license": "MIT", "engines": { "node": ">=12.13" }, @@ -5962,9 +5951,8 @@ }, "node_modules/date-fns": { "version": "2.30.0", - "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.30.0.tgz", - "integrity": "sha512-fnULvOpxnC5/Vg3NCiWelDsLiUc9bRwAPs/+LfTLNvetFCtCTN+yQz15C/fs4AwX1R9K5GLtLfn8QW+dWisaAw==", "dev": true, + "license": "MIT", "dependencies": { "@babel/runtime": "^7.21.0" }, @@ -7385,9 +7373,8 @@ }, "node_modules/handlebars": { "version": "4.7.8", - "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.8.tgz", - "integrity": "sha512-vafaFqs8MZkRrSX7sFVUdo3ap/eNiLnb4IakshzvP56X5Nr1iGKAIqdX6tMlm6HcNRIkr6AxO5jFEoJzzpT8aQ==", "dev": true, + "license": "MIT", "dependencies": { "minimist": "^1.2.5", "neo-async": "^2.6.2", @@ -9855,10 +9842,8 @@ }, "node_modules/json-schema-ref-parser": { "version": "9.0.9", - "resolved": "https://registry.npmjs.org/json-schema-ref-parser/-/json-schema-ref-parser-9.0.9.tgz", - "integrity": "sha512-qcP2lmGy+JUoQJ4DOQeLaZDqH9qSkeGCK3suKWxJXS82dg728Mn3j97azDMaOUmJAN4uCq91LdPx4K7E8F1a7Q==", - "deprecated": "Please switch to @apidevtools/json-schema-ref-parser", "dev": true, + "license": "MIT", "dependencies": { "@apidevtools/json-schema-ref-parser": "9.0.9" }, @@ -10583,9 +10568,8 @@ }, "node_modules/neo-async": { "version": "2.6.2", - "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", - "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/netmask": { "version": "2.0.2", @@ -10794,9 +10778,8 @@ }, "node_modules/openapi-typescript-codegen": { "version": "0.23.0", - "resolved": "https://registry.npmjs.org/openapi-typescript-codegen/-/openapi-typescript-codegen-0.23.0.tgz", - "integrity": "sha512-gOJXy5g3H3HlLpVNN+USrNK2i2KYBmDczk9Xk34u6JorwrGiDJZUj+al4S+i9TXdfUQ/ZaLxE59Xf3wqkxGfqA==", "dev": true, + "license": "MIT", "dependencies": { "camelcase": "^6.3.0", "commander": "^9.3.0", @@ -10810,9 +10793,8 @@ }, "node_modules/openapi-typescript-codegen/node_modules/camelcase": { "version": "6.3.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", - "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", "dev": true, + "license": "MIT", "engines": { "node": ">=10" }, @@ -10822,18 +10804,16 @@ }, "node_modules/openapi-typescript-codegen/node_modules/commander": { "version": "9.5.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-9.5.0.tgz", - "integrity": "sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ==", "dev": true, + "license": "MIT", "engines": { "node": "^12.20.0 || >=14" } }, "node_modules/openapi-typescript-codegen/node_modules/fs-extra": { "version": "10.1.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz", - "integrity": "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==", "dev": true, + "license": "MIT", "dependencies": { "graceful-fs": "^4.2.0", "jsonfile": "^6.0.1", @@ -10845,9 +10825,8 @@ }, "node_modules/openapi-typescript-codegen/node_modules/jsonfile": { "version": "6.1.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", - "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", "dev": true, + "license": "MIT", "dependencies": { "universalify": "^2.0.0" }, @@ -10857,9 +10836,8 @@ }, "node_modules/openapi-typescript-codegen/node_modules/universalify": { "version": "2.0.1", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", - "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", "dev": true, + "license": "MIT", "engines": { "node": ">= 10.0.0" } @@ -13702,9 +13680,8 @@ }, "node_modules/uglify-js": { "version": "3.17.4", - "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.17.4.tgz", - "integrity": "sha512-T9q82TJI9e/C1TAxYvfb16xO120tMVFZrGA3f9/P4424DNu6ypK103y0GPFVa17yotwSyZW5iYXgjYHkGrJW/g==", "dev": true, + "license": "BSD-2-Clause", "optional": true, "bin": { "uglifyjs": "bin/uglifyjs" @@ -13953,9 +13930,8 @@ }, "node_modules/wordwrap": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", - "integrity": "sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/wrap-ansi": { "version": "7.0.0", @@ -14166,16 +14142,16 @@ }, "plugins/autocast": { "name": "@flatfile/plugin-autocast", - "version": "0.7.9", + "version": "0.7.10", "license": "ISC", "dependencies": { "@flatfile/api": "^1.7.4", "@flatfile/hooks": "^1.3.2", - "@flatfile/plugin-record-hook": "^1.4.6", - "@flatfile/util-common": "^1.0.3" + "@flatfile/plugin-record-hook": "^1.4.7", + "@flatfile/util-common": "^1.1.1" }, "devDependencies": { - "@flatfile/rollup-config": "0.0.0" + "@flatfile/rollup-config": "0.1.0" }, "engines": { "node": ">= 16" @@ -14186,15 +14162,15 @@ }, "plugins/automap": { "name": "@flatfile/plugin-automap", - "version": "0.2.2", + "version": "0.2.3", "license": "ISC", "dependencies": { "@flatfile/api": "^1.7.4", - "@flatfile/common-plugin-utils": "^1.0.1", + "@flatfile/common-plugin-utils": "^1.0.2", "remeda": "^1.23.0" }, "devDependencies": { - "@flatfile/utils-testing": "^0.1.3" + "@flatfile/utils-testing": "^0.1.4" }, "engines": { "node": ">= 16" @@ -14205,14 +14181,14 @@ }, "plugins/constraints": { "name": "@flatfile/plugin-constraints", - "version": "1.1.7", + "version": "1.1.8", "license": "ISC", "dependencies": { "@flatfile/api": "^1.7.4", - "@flatfile/plugin-record-hook": "^1.4.6" + "@flatfile/plugin-record-hook": "^1.4.7" }, "devDependencies": { - "@flatfile/rollup-config": "0.0.0" + "@flatfile/rollup-config": "0.1.0" }, "engines": { "node": ">= 16" @@ -14223,16 +14199,16 @@ }, "plugins/dedupe": { "name": "@flatfile/plugin-dedupe", - "version": "1.0.1", + "version": "1.0.2", "license": "ISC", "dependencies": { "@flatfile/api": "^1.7.4", - "@flatfile/plugin-job-handler": "^0.4.1", - "@flatfile/util-common": "^1.0.3" + "@flatfile/plugin-job-handler": "^0.4.2", + "@flatfile/util-common": "^1.1.1" }, "devDependencies": { "@faker-js/faker": "^7.6.0", - "@flatfile/rollup-config": "0.0.0" + "@flatfile/rollup-config": "0.1.0" }, "engines": { "node": ">= 16" @@ -14261,14 +14237,14 @@ }, "plugins/dxp-configure": { "name": "@flatfile/plugin-dxp-configure", - "version": "1.0.0", + "version": "1.0.1", "license": "ISC", "dependencies": { "@flatfile/api": "^1.7.4" }, "devDependencies": { "@flatfile/configure": "^0.5.39", - "@flatfile/rollup-config": "0.0.0" + "@flatfile/rollup-config": "0.1.0" }, "engines": { "node": ">= 16" @@ -14279,11 +14255,11 @@ }, "plugins/export-workbook": { "name": "@flatfile/plugin-export-workbook", - "version": "0.1.6", + "version": "0.1.7", "license": "ISC", "dependencies": { "@flatfile/api": "^1.7.4", - "@flatfile/util-common": "^1.0.0", + "@flatfile/util-common": "^1.1.1", "remeda": "^1.14.0", "xlsx": "https://cdn.sheetjs.com/xlsx-0.20.0/xlsx-0.20.0.tgz" }, @@ -14296,7 +14272,7 @@ }, "plugins/foreign-db-extractor": { "name": "@flatfile/plugin-foreign-db-extractor", - "version": "0.0.4", + "version": "0.0.5", "license": "ISC", "dependencies": { "@flatfile/api": "^1.7.1", @@ -14304,7 +14280,7 @@ "mssql": "^10.0.1" }, "devDependencies": { - "@flatfile/rollup-config": "0.0.0" + "@flatfile/rollup-config": "0.1.0" }, "engines": { "node": ">= 18" @@ -14318,35 +14294,17 @@ "version": "0.0.2", "license": "ISC" }, - "plugins/graphql-schema": { - "name": "@flatfile/plugin-graphql-schema", - "version": "0.0.0", - "extraneous": true, - "license": "ISC", - "dependencies": { - "@flatfile/plugin-space-configure": "^0.3.3", - "change-case": "^5.4.3", - "cross-fetch": "^4.0.0", - "graphql": "^16.8.1" - }, - "devDependencies": { - "@flatfile/api": "^1.7.1" - }, - "peerDependencies": { - "@flatfile/listener": "^1.0.1" - } - }, "plugins/job-handler": { "name": "@flatfile/plugin-job-handler", - "version": "0.4.1", + "version": "0.4.2", "license": "ISC", "dependencies": { "@flatfile/api": "^1.7.4", - "@flatfile/util-common": "^1.0.3" + "@flatfile/util-common": "^1.1.1" }, "devDependencies": { - "@flatfile/rollup-config": "0.0.0", - "@flatfile/utils-testing": "^0.1.3" + "@flatfile/rollup-config": "0.1.0", + "@flatfile/utils-testing": "^0.1.4" }, "engines": { "node": ">= 16" @@ -14357,11 +14315,11 @@ }, "plugins/json-extractor": { "name": "@flatfile/plugin-json-extractor", - "version": "0.7.1", + "version": "0.7.2", "license": "ISC", "dependencies": { - "@flatfile/rollup-config": "0.0.0", - "@flatfile/util-extractor": "^0.5.2" + "@flatfile/rollup-config": "0.1.0", + "@flatfile/util-extractor": "^0.5.6" }, "engines": { "node": ">= 16" @@ -14369,11 +14327,11 @@ }, "plugins/json-schema": { "name": "@flatfile/plugin-convert-json-schema", - "version": "0.2.2", + "version": "0.2.3", "license": "ISC", "dependencies": { "@flatfile/api": "^1.7.4", - "@flatfile/plugin-space-configure": "^0.3.2", + "@flatfile/plugin-space-configure": "^0.3.5", "cross-fetch": "^4.0.0" }, "engines": { @@ -14385,12 +14343,12 @@ }, "plugins/merge-connection": { "name": "@flatfile/plugin-connect-via-merge", - "version": "0.2.2", + "version": "0.2.3", "license": "ISC", "dependencies": { "@flatfile/api": "^1.7.4", - "@flatfile/plugin-convert-openapi-schema": "^0.1.2", - "@flatfile/plugin-job-handler": "^0.4.1", + "@flatfile/plugin-convert-openapi-schema": "^0.1.3", + "@flatfile/plugin-job-handler": "^0.4.2", "@mergeapi/merge-node-client": "^1.0.4" }, "engines": { @@ -14400,28 +14358,17 @@ "@flatfile/listener": "^1.0.1" } }, - "plugins/merge-connection/node_modules/@mergeapi/merge-node-client/node_modules/axios": { - "version": "0.27.2", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.27.2.tgz", - "integrity": "sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==", - "extraneous": true, - "license": "MIT", - "dependencies": { - "follow-redirects": "^1.14.9", - "form-data": "^4.0.0" - } - }, "plugins/openapi-schema": { "name": "@flatfile/plugin-convert-openapi-schema", - "version": "0.1.2", + "version": "0.1.3", "license": "ISC", "dependencies": { "@flatfile/api": "^1.7.4", - "@flatfile/plugin-space-configure": "^0.3.2", + "@flatfile/plugin-space-configure": "^0.3.5", "cross-fetch": "^4.0.0" }, "devDependencies": { - "@flatfile/rollup-config": "0.0.0" + "@flatfile/rollup-config": "0.1.0" }, "engines": { "node": ">= 16" @@ -14432,12 +14379,12 @@ }, "plugins/pdf-extractor": { "name": "@flatfile/plugin-pdf-extractor", - "version": "0.1.2", + "version": "0.1.3", "license": "ISC", "dependencies": { "@flatfile/api": "^1.7.4", - "@flatfile/util-common": "^1.0.3", - "@flatfile/util-file-buffer": "^0.2.1", + "@flatfile/util-common": "^1.1.1", + "@flatfile/util-file-buffer": "^0.2.2", "cross-fetch": "^4.0.0", "form-data": "^4.0.0", "fs-extra": "^11.1.1", @@ -14484,7 +14431,7 @@ }, "plugins/psv-extractor": { "name": "@flatfile/plugin-psv-extractor", - "version": "1.7.1", + "version": "1.7.2", "license": "ISC", "dependencies": { "@flatfile/api": "^1.7.4" @@ -14498,14 +14445,14 @@ }, "plugins/record-hook": { "name": "@flatfile/plugin-record-hook", - "version": "1.4.6", + "version": "1.4.7", "license": "ISC", "dependencies": { - "@flatfile/util-common": "^1.0.3" + "@flatfile/util-common": "^1.1.1" }, "devDependencies": { "@flatfile/hooks": "^1.3.1", - "@flatfile/rollup-config": "0.0.0" + "@flatfile/rollup-config": "0.1.0" }, "engines": { "node": ">= 16" @@ -14517,15 +14464,15 @@ }, "plugins/space-configure": { "name": "@flatfile/plugin-space-configure", - "version": "0.3.4", + "version": "0.3.5", "license": "ISC", "dependencies": { "@flatfile/api": "^1.7.4", - "@flatfile/plugin-job-handler": "^0.4.1" + "@flatfile/plugin-job-handler": "^0.4.2" }, "devDependencies": { - "@flatfile/rollup-config": "0.0.0", - "@flatfile/utils-testing": "^0.1.3" + "@flatfile/rollup-config": "0.1.0", + "@flatfile/utils-testing": "^0.1.4" }, "engines": { "node": ">= 16" @@ -14536,12 +14483,12 @@ }, "plugins/sql-ddl-converter": { "name": "@flatfile/plugin-convert-sql-ddl", - "version": "0.0.5", + "version": "0.0.6", "license": "ISC", "dependencies": { "@flatfile/api": "^1.7.4", - "@flatfile/plugin-convert-json-schema": "^0.2.2", - "@flatfile/plugin-space-configure": "^0.3.2", + "@flatfile/plugin-convert-json-schema": "^0.2.3", + "@flatfile/plugin-space-configure": "^0.3.5", "sql-ddl-to-json-schema": "^4.1.0" }, "engines": { @@ -14553,7 +14500,7 @@ }, "plugins/tsv-extractor": { "name": "@flatfile/plugin-tsv-extractor", - "version": "1.6.1", + "version": "1.6.2", "license": "ISC", "dependencies": { "@flatfile/api": "^1.7.4" @@ -14567,18 +14514,18 @@ }, "plugins/webhook-egress": { "name": "@flatfile/plugin-webhook-egress", - "version": "1.2.5", + "version": "1.2.6", "license": "ISC", "dependencies": { "@flatfile/api": "^1.7.4", - "@flatfile/plugin-job-handler": "^0.4.1", - "@flatfile/util-common": "^1.0.3", - "@flatfile/util-response-rejection": "^1.2.4", + "@flatfile/plugin-job-handler": "^0.4.2", + "@flatfile/util-common": "^1.1.1", + "@flatfile/util-response-rejection": "^1.2.5", "cross-fetch": "^4.0.0" }, "devDependencies": { - "@flatfile/rollup-config": "0.0.0", - "@flatfile/utils-testing": "^0.1.3", + "@flatfile/rollup-config": "0.1.0", + "@flatfile/utils-testing": "^0.1.4", "jest-fetch-mock": "^3.0.3" }, "engines": { @@ -14590,14 +14537,14 @@ }, "plugins/webhook-event-forwarder": { "name": "@flatfile/plugin-webhook-event-forwarder", - "version": "0.2.2", + "version": "0.2.3", "license": "ISC", "dependencies": { "@flatfile/api": "^1.7.4", "cross-fetch": "^4.0.0" }, "devDependencies": { - "@flatfile/rollup-config": "0.0.0", + "@flatfile/rollup-config": "0.1.0", "jest-fetch-mock": "^3.0.3" }, "engines": { @@ -14609,10 +14556,10 @@ }, "plugins/xlsx-extractor": { "name": "@flatfile/plugin-xlsx-extractor", - "version": "1.11.4", + "version": "1.11.5", "license": "ISC", "dependencies": { - "@flatfile/util-extractor": "^0.5.5", + "@flatfile/util-extractor": "^0.5.6", "remeda": "^1.14.0", "xlsx": "https://cdn.sheetjs.com/xlsx-0.20.0/xlsx-0.20.0.tgz" }, @@ -14625,10 +14572,10 @@ }, "plugins/xml-extractor": { "name": "@flatfile/plugin-xml-extractor", - "version": "0.5.13", + "version": "0.5.14", "license": "ISC", "dependencies": { - "@flatfile/util-extractor": "^0.5.0", + "@flatfile/util-extractor": "^0.5.6", "remeda": "^1.24.0", "xml-json-format": "^1.0.8" }, @@ -14641,17 +14588,17 @@ }, "plugins/yaml-schema": { "name": "@flatfile/plugin-convert-yaml-schema", - "version": "0.1.2", + "version": "0.1.3", "license": "ISC", "dependencies": { "@flatfile/api": "^1.7.4", - "@flatfile/plugin-convert-json-schema": "^0.2.2", - "@flatfile/plugin-space-configure": "^0.3.2", + "@flatfile/plugin-convert-json-schema": "^0.2.3", + "@flatfile/plugin-space-configure": "^0.3.5", "cross-fetch": "^4.0.0", "js-yaml": "^4.1.0" }, "devDependencies": { - "@flatfile/utils-testing": "^0.1.3", + "@flatfile/utils-testing": "^0.1.4", "express": "^4.18.2", "jest-fetch-mock": "^3.0.3" }, @@ -14676,18 +14623,42 @@ "js-yaml": "bin/js-yaml.js" } }, + "plugins/zip-egress": { + "name": "@flatfile/plugin-zip-egress", + "version": "0.0.0", + "license": "ISC", + "dependencies": { + "@flatfile/api": "^1.7.4", + "@flatfile/listener": "^1.0.1", + "@flatfile/plugin-job-handler": "^0.4.1", + "@flatfile/util-common": "^1.0.0", + "adm-zip": "^0.5.12", + "csv-stringify": "^6.4.6" + }, + "engines": { + "node": ">= 16" + }, + "peerDependencies": { + "@flatfile/listener": "^1.0.1" + } + }, + "plugins/zip-egress/node_modules/csv-stringify": { + "version": "6.4.6", + "resolved": "https://registry.npmjs.org/csv-stringify/-/csv-stringify-6.4.6.tgz", + "integrity": "sha512-h2V2XZ3uOTLilF5dPIptgUfN/o2ia/80Ie0Lly18LAnw5s8Eb7kt8rfxSUy24AztJZas9f6DPZpVlzDUtFt/ag==" + }, "plugins/zip-extractor": { "name": "@flatfile/plugin-zip-extractor", - "version": "0.4.3", + "version": "0.4.4", "license": "ISC", "dependencies": { "@flatfile/api": "^1.7.4", - "@flatfile/util-common": "^1.0.0", - "@flatfile/util-file-buffer": "^0.2.1", + "@flatfile/util-common": "^1.1.1", + "@flatfile/util-file-buffer": "^0.2.2", "adm-zip": "^0.5.10" }, "devDependencies": { - "@flatfile/utils-testing": "^0.1.3", + "@flatfile/utils-testing": "^0.1.4", "@types/adm-zip": "^0.4.3" }, "engines": { @@ -14699,7 +14670,7 @@ }, "support/common-utils": { "name": "@flatfile/common-plugin-utils", - "version": "1.0.1", + "version": "1.0.2", "license": "ISC", "engines": { "node": ">= 16" @@ -14707,7 +14678,7 @@ }, "utils/common": { "name": "@flatfile/util-common", - "version": "1.1.0", + "version": "1.1.1", "license": "ISC", "dependencies": { "@flatfile/api": "^1.7.4", @@ -14715,7 +14686,7 @@ "cross-fetch": "^4.0.0" }, "devDependencies": { - "@flatfile/rollup-config": "0.0.0" + "@flatfile/rollup-config": "0.1.0" }, "engines": { "node": ">= 16" @@ -14730,12 +14701,12 @@ }, "utils/extractor": { "name": "@flatfile/util-extractor", - "version": "0.5.5", + "version": "0.5.6", "license": "ISC", "dependencies": { "@flatfile/api": "^1.7.4", - "@flatfile/util-common": "^1.0.0", - "@flatfile/util-file-buffer": "^0.2.1" + "@flatfile/util-common": "^1.1.1", + "@flatfile/util-file-buffer": "^0.2.2" }, "engines": { "node": ">= 16" @@ -14746,7 +14717,7 @@ }, "utils/fetch-schema": { "name": "@flatfile/util-fetch-schema", - "version": "0.1.2", + "version": "0.1.3", "license": "ISC", "dependencies": { "@flatfile/api": "^1.7.4", @@ -14758,7 +14729,7 @@ }, "utils/file-buffer": { "name": "@flatfile/util-file-buffer", - "version": "0.2.1", + "version": "0.2.2", "license": "ISC", "dependencies": { "@flatfile/api": "^1.7.4", @@ -14770,38 +14741,22 @@ }, "utils/response-rejection": { "name": "@flatfile/util-response-rejection", - "version": "1.2.4", + "version": "1.2.5", "license": "ISC", "dependencies": { "@flatfile/api": "^1.7.4", - "@flatfile/util-common": "^1.0.3" + "@flatfile/util-common": "^1.1.1" }, "devDependencies": { - "@flatfile/rollup-config": "0.0.0" + "@flatfile/rollup-config": "0.1.0" }, "engines": { "node": ">= 16" } }, - "utils/rollup-config": { - "name": "@flatfile/rollup-config", - "version": "0.0.0", - "extraneous": true, - "license": "ISC", - "dependencies": { - "@rollup/plugin-commonjs": "^25.0.7", - "@rollup/plugin-json": "^6.1.0", - "@rollup/plugin-node-resolve": "^15.2.3", - "@rollup/plugin-sucrase": "^5.0.2", - "@rollup/plugin-terser": "^0.4.4", - "rollup": "^4.12.0", - "rollup-plugin-dts": "^6.1.0", - "rollup-plugin-peer-deps-external": "^2.2.4" - } - }, "utils/testing": { "name": "@flatfile/utils-testing", - "version": "0.1.3", + "version": "0.1.4", "license": "ISC", "dependencies": { "@flatfile/api": "^1.7.4", diff --git a/plugins/zip-egress/README.md b/plugins/zip-egress/README.md new file mode 100644 index 000000000..e66ba07ac --- /dev/null +++ b/plugins/zip-egress/README.md @@ -0,0 +1 @@ +# @flatfile/plugin-zip-egress \ No newline at end of file diff --git a/plugins/zip-egress/package.json b/plugins/zip-egress/package.json new file mode 100644 index 000000000..68de33c6a --- /dev/null +++ b/plugins/zip-egress/package.json @@ -0,0 +1,40 @@ +{ + "name": "@flatfile/plugin-zip-egress", + "version": "0.0.0", + "description": "A plugin for egressing a Flatfile Workbook as a collection of zipped CSV files.", + "registryMetadata": { + "category": "egress" + }, + "engines": { + "node": ">= 16" + }, + "source": "src/index.ts", + "main": "dist/main.js", + "module": "dist/module.mjs", + "types": "dist/types.d.ts", + "scripts": { + "build": "parcel build", + "dev": "parcel watch", + "check": "tsc ./**/*.ts --noEmit --esModuleInterop", + "test": "jest --passWithNoTests" + }, + "keywords": [], + "author": "Flatfile, Inc.", + "repository": { + "type": "git", + "url": "https://github.com/FlatFilers/flatfile-plugins.git", + "directory": "plugins/zip-egress" + }, + "license": "ISC", + "dependencies": { + "@flatfile/api": "^1.7.4", + "@flatfile/listener": "^1.0.1", + "@flatfile/plugin-job-handler": "^0.4.1", + "@flatfile/util-common": "^1.0.0", + "adm-zip": "^0.5.12", + "csv-stringify": "^6.4.6" + }, + "peerDependencies": { + "@flatfile/listener": "^1.0.1" + } +} diff --git a/plugins/zip-egress/src/index.ts b/plugins/zip-egress/src/index.ts new file mode 100644 index 000000000..a5f20775e --- /dev/null +++ b/plugins/zip-egress/src/index.ts @@ -0,0 +1 @@ +export * from './zip.egress' diff --git a/plugins/zip-egress/src/utils.ts b/plugins/zip-egress/src/utils.ts new file mode 100644 index 000000000..0db1601ca --- /dev/null +++ b/plugins/zip-egress/src/utils.ts @@ -0,0 +1,3 @@ +export const castBoolean = (value) => { + return value ? 'true' : 'false' +} diff --git a/plugins/zip-egress/src/zip.egress.ts b/plugins/zip-egress/src/zip.egress.ts new file mode 100644 index 000000000..d1a556859 --- /dev/null +++ b/plugins/zip-egress/src/zip.egress.ts @@ -0,0 +1,116 @@ +import type { Flatfile } from '@flatfile/api' +import api from '@flatfile/api' +import type { FlatfileEvent } from '@flatfile/listener' +import { jobHandler } from '@flatfile/plugin-job-handler' +import { processRecords } from '@flatfile/util-common' +import AdmZip from 'adm-zip' +import { ColumnOption, stringify } from 'csv-stringify/sync' +import fs from 'fs' +import path from 'path' +import { castBoolean } from './utils' + +export const zipEgressPlugin = (job, opts: PluginOptions = {}) => { + return jobHandler(job, async (event: FlatfileEvent, tick) => { + const { workbookId, spaceId, environmentId } = event.context + const timestamp = new Date().toISOString() + await tick(0, 'Preparing workbook...') + + try { + const { data: workbook } = await api.workbooks.get(workbookId) + const sheets = workbook.sheets.filter( + (sheet) => !opts.excludedSheets?.includes(sheet.config.slug) + ) + + const zip = new AdmZip() + let i = 0 + for (const sheet of sheets) { + const { fields } = sheet.config + const columns: ColumnOption[] = [] + fields.forEach((field) => { + if (!!field.metadata?.excludeFromExport) return + columns.push({ key: field.key, header: field.label }) + }) + + const csvFilePath = path.join( + '/tmp', + `${sheet.config.slug}-${timestamp}.csv` + ) + fs.closeSync(fs.openSync(csvFilePath, 'w')) + await processRecords( + sheet.id, + async (records, pageNumber) => { + let normalizedRecords = records.map(({ values }) => { + const result = fields.reduce((acc, { key }) => { + acc[key] = values[key] ? values[key].value : '' + return acc + }, {}) + return result + }) + + if (pageNumber === 1 && records?.length === 0) { + const emptyRecord = fields.reduce( + (acc, { key }) => ({ ...acc, [key]: '' }), + {} + ) + normalizedRecords = [emptyRecord] + } + const rows = stringify(normalizedRecords, { + header: pageNumber === 1, + columns: columns, + cast: { boolean: castBoolean }, + }) + + await fs.promises.appendFile(csvFilePath, rows) + }, + opts.getRecordsRequest + ) + + zip.addLocalFile(csvFilePath) + + await tick( + 10 + Math.round(((i + 1) / sheets.length) * 70), + `${sheet.name} Prepared` + ) + await fs.promises.unlink(csvFilePath) + i++ + } + + await tick(81, `Uploading file...`) + + const zipFilePath = path.join('/tmp', `${workbook.name}-${timestamp}.zip`) + zip.writeZip(zipFilePath) + const stream = fs.createReadStream(zipFilePath) + + await api.files.upload(stream, { + spaceId, + environmentId, + mode: 'export', + }) + + await fs.promises.unlink(zipFilePath) + + return { + outcome: { + acknowledge: true, + message: 'Successfully exported workbook', + next: { + type: 'id', + id: spaceId, + path: 'files', + query: 'mode=export', + label: 'See all downloads', + }, + }, + } + } catch (error) { + console.error(error) + throw new Error('Failed to export workbook') + } + }) +} + +export interface PluginOptions { + readonly excludedSheets?: string[] + readonly getRecordsRequest?: Flatfile.GetRecordsRequest + readonly debug?: boolean +}