From 17c0eef881088fad99dd173be73da1586e63b2c1 Mon Sep 17 00:00:00 2001 From: Carl Brugger Date: Wed, 27 Mar 2024 17:01:09 -0500 Subject: [PATCH 1/2] fix: change retrieval of record count --- .changeset/thin-monkeys-remember.md | 5 ++++ package-lock.json | 32 ++++++++++++----------- plugins/merge-connection/src/sync.data.ts | 5 +++- 3 files changed, 26 insertions(+), 16 deletions(-) create mode 100644 .changeset/thin-monkeys-remember.md diff --git a/.changeset/thin-monkeys-remember.md b/.changeset/thin-monkeys-remember.md new file mode 100644 index 000000000..5ccd72ccd --- /dev/null +++ b/.changeset/thin-monkeys-remember.md @@ -0,0 +1,5 @@ +--- +'@flatfile/plugin-connect-via-merge': patch +--- + +Fix for deprecated api field diff --git a/package-lock.json b/package-lock.json index 81545538d..919c4e7a5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -53,7 +53,7 @@ "version": "0.0.0", "license": "ISC", "dependencies": { - "@flatfile/api": "^1.7.4", + "@flatfile/api": "^1.7.10", "@flatfile/listener": "^1.0.1", "flatfile": "^3.6.1" } @@ -1419,7 +1419,9 @@ } }, "node_modules/@flatfile/api": { - "version": "1.7.4", + "version": "1.7.10", + "resolved": "https://registry.npmjs.org/@flatfile/api/-/api-1.7.10.tgz", + "integrity": "sha512-jEptJHdkCO+ZUJ35dSZEykv6fF/5KbOaSNcNIoIMZJLIrZAey2n8HKhpLNA1yXpNQ8MuwOuAoKC4RaX9qoyjxw==", "dependencies": { "@flatfile/cross-env-config": "0.0.4", "@types/pako": "2.0.1", @@ -14721,12 +14723,12 @@ }, "plugins/dedupe": { "name": "@flatfile/plugin-dedupe", - "version": "0.1.1", + "version": "1.0.0", "license": "ISC", "dependencies": { "@flatfile/api": "^1.7.4", - "@flatfile/plugin-job-handler": "^0.3.3", - "@flatfile/util-common": "^1.0.1" + "@flatfile/plugin-job-handler": "^0.4.0", + "@flatfile/util-common": "^1.0.2" }, "devDependencies": { "@faker-js/faker": "^7.6.0" @@ -14814,12 +14816,12 @@ }, "plugins/job-handler": { "name": "@flatfile/plugin-job-handler", - "version": "0.3.3", + "version": "0.4.0", "license": "ISC", "dependencies": { "@flatfile/api": "^1.7.4", "@flatfile/listener": "^1.0.1", - "@flatfile/util-common": "^1.0.0" + "@flatfile/util-common": "^1.0.2" }, "devDependencies": { "@flatfile/utils-testing": "^0.1.3" @@ -14862,13 +14864,13 @@ }, "plugins/merge-connection": { "name": "@flatfile/plugin-connect-via-merge", - "version": "0.2.0", + "version": "0.2.1", "license": "ISC", "dependencies": { "@flatfile/api": "^1.7.4", "@flatfile/listener": "^1.0.1", "@flatfile/plugin-convert-openapi-schema": "^0.1.2", - "@flatfile/plugin-job-handler": "^0.3.3", + "@flatfile/plugin-job-handler": "^0.4.0", "@mergeapi/merge-node-client": "^1.0.4" }, "engines": { @@ -14984,12 +14986,12 @@ }, "plugins/space-configure": { "name": "@flatfile/plugin-space-configure", - "version": "0.3.2", + "version": "0.3.3", "license": "ISC", "dependencies": { "@flatfile/api": "^1.7.4", "@flatfile/listener": "^1.0.1", - "@flatfile/plugin-job-handler": "^0.3.2" + "@flatfile/plugin-job-handler": "^0.4.0" }, "devDependencies": { "@flatfile/utils-testing": "^0.1.3" @@ -15026,13 +15028,13 @@ }, "plugins/webhook-egress": { "name": "@flatfile/plugin-webhook-egress", - "version": "1.2.3", + "version": "1.2.4", "license": "ISC", "dependencies": { "@flatfile/api": "^1.7.4", "@flatfile/listener": "^1.0.1", - "@flatfile/plugin-job-handler": "^0.3.3", - "@flatfile/util-common": "^1.0.0", + "@flatfile/plugin-job-handler": "^0.4.0", + "@flatfile/util-common": "^1.0.2", "@flatfile/util-response-rejection": "^1.2.3", "node-fetch": "^3.3.2" }, @@ -15196,7 +15198,7 @@ }, "utils/common": { "name": "@flatfile/util-common", - "version": "1.0.1", + "version": "1.0.2", "license": "ISC", "dependencies": { "@flatfile/api": "^1.7.4", diff --git a/plugins/merge-connection/src/sync.data.ts b/plugins/merge-connection/src/sync.data.ts index a9df8ba3a..8ba6e39e0 100644 --- a/plugins/merge-connection/src/sync.data.ts +++ b/plugins/merge-connection/src/sync.data.ts @@ -34,7 +34,10 @@ export async function syncData( async function deleteSheetRecords(sheetId: string) { try { const { data: sheet } = await api.sheets.get(sheetId) - if (sheet.countRecords.total > 0) { + const { + data: { counts }, + } = await api.sheets.getRecordCounts(sheetId) + if (counts.total > 0) { await api.jobs.create({ type: 'workbook', operation: 'delete-records', From 91a0d2e8e92060610ee4309c8ee89d8e34871e88 Mon Sep 17 00:00:00 2001 From: Carl Brugger Date: Thu, 28 Mar 2024 12:22:07 -0500 Subject: [PATCH 2/2] bundling fixes --- .changeset/thin-monkeys-remember.md | 14 +++- package-lock.json | 8 +- plugins/autocast/rollup.config.mjs | 2 +- plugins/constraints/rollup.config.mjs | 2 +- plugins/dedupe/rollup.config.mjs | 2 +- .../foreign-db-extractor/rollup.config.mjs | 2 +- plugins/job-handler/package.json | 4 +- plugins/job-handler/rollup.config.mjs | 11 ++- plugins/job-handler/src/job.handler.ts | 5 +- plugins/record-hook/rollup.config.mjs | 2 +- plugins/space-configure/package.json | 29 +++++-- plugins/space-configure/rollup.config.mjs | 80 +++++++++++++++++++ .../space-configure/src/space.configure.ts | 9 ++- plugins/webhook-egress/rollup.config.mjs | 2 +- utils/common/rollup.config.mjs | 2 +- utils/response-rejection/rollup.config.mjs | 2 +- 16 files changed, 145 insertions(+), 31 deletions(-) create mode 100644 plugins/space-configure/rollup.config.mjs diff --git a/.changeset/thin-monkeys-remember.md b/.changeset/thin-monkeys-remember.md index 5ccd72ccd..dda0d41ed 100644 --- a/.changeset/thin-monkeys-remember.md +++ b/.changeset/thin-monkeys-remember.md @@ -1,5 +1,17 @@ --- +'@flatfile/plugin-foreign-db-extractor': patch '@flatfile/plugin-connect-via-merge': patch +'@flatfile/util-response-rejection': patch +'@flatfile/plugin-space-configure': patch +'@flatfile/plugin-webhook-egress': patch +'@flatfile/plugin-constraints': patch +'@flatfile/plugin-job-handler': patch +'@flatfile/plugin-record-hook': patch +'@flatfile/plugin-autocast': patch +'@flatfile/plugin-dedupe': patch +'@flatfile/util-common': patch --- -Fix for deprecated api field +`@flatfile/plugin-connect-via-merge`: `@flatfile/api@1.7.10` removes `countRecords` from the get sheet endpoint. This release switches to the get record count endpoint. + +This release also includes bundling fixes across the Flatfile plugin ecosystem. diff --git a/package-lock.json b/package-lock.json index 919c4e7a5..8414b423e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14820,7 +14820,6 @@ "license": "ISC", "dependencies": { "@flatfile/api": "^1.7.4", - "@flatfile/listener": "^1.0.1", "@flatfile/util-common": "^1.0.2" }, "devDependencies": { @@ -14828,6 +14827,9 @@ }, "engines": { "node": ">= 16" + }, + "peerDependencies": { + "@flatfile/listener": "^1.0.1" } }, "plugins/json-extractor": { @@ -14990,7 +14992,6 @@ "license": "ISC", "dependencies": { "@flatfile/api": "^1.7.4", - "@flatfile/listener": "^1.0.1", "@flatfile/plugin-job-handler": "^0.4.0" }, "devDependencies": { @@ -14998,6 +14999,9 @@ }, "engines": { "node": ">= 16" + }, + "peerDependencies": { + "@flatfile/listener": "^1.0.1" } }, "plugins/sql-ddl-converter": { diff --git a/plugins/autocast/rollup.config.mjs b/plugins/autocast/rollup.config.mjs index 957d1d5ac..74bf34ea0 100644 --- a/plugins/autocast/rollup.config.mjs +++ b/plugins/autocast/rollup.config.mjs @@ -22,7 +22,7 @@ function commonPlugins(browser, umd = false) { json(), commonjs({ include: '**/node_modules/**', - requireReturnsDefault: 'preferred', + requireReturnsDefault: 'auto', esmExternals: true, }), resolve({ browser, preferBuiltins: !browser }), diff --git a/plugins/constraints/rollup.config.mjs b/plugins/constraints/rollup.config.mjs index 07fa14b8b..8d52053c9 100644 --- a/plugins/constraints/rollup.config.mjs +++ b/plugins/constraints/rollup.config.mjs @@ -22,7 +22,7 @@ function commonPlugins(browser, umd = false) { json(), commonjs({ include: '**/node_modules/**', - requireReturnsDefault: 'preferred', + requireReturnsDefault: 'auto', }), resolve({ browser, preferBuiltins: !browser }), typescript({ diff --git a/plugins/dedupe/rollup.config.mjs b/plugins/dedupe/rollup.config.mjs index 957d1d5ac..74bf34ea0 100644 --- a/plugins/dedupe/rollup.config.mjs +++ b/plugins/dedupe/rollup.config.mjs @@ -22,7 +22,7 @@ function commonPlugins(browser, umd = false) { json(), commonjs({ include: '**/node_modules/**', - requireReturnsDefault: 'preferred', + requireReturnsDefault: 'auto', esmExternals: true, }), resolve({ browser, preferBuiltins: !browser }), diff --git a/plugins/foreign-db-extractor/rollup.config.mjs b/plugins/foreign-db-extractor/rollup.config.mjs index a7eded613..dbf6fe80d 100644 --- a/plugins/foreign-db-extractor/rollup.config.mjs +++ b/plugins/foreign-db-extractor/rollup.config.mjs @@ -20,7 +20,7 @@ function commonPlugins(browser, umd = false) { json(), commonjs({ include: '**/node_modules/**', - requireReturnsDefault: 'preferred', + requireReturnsDefault: 'auto', esmExternals: true, }), resolve({ browser, preferBuiltins: !browser }), diff --git a/plugins/job-handler/package.json b/plugins/job-handler/package.json index f66bfaed4..a27051a4a 100644 --- a/plugins/job-handler/package.json +++ b/plugins/job-handler/package.json @@ -42,9 +42,11 @@ "license": "ISC", "dependencies": { "@flatfile/api": "^1.7.4", - "@flatfile/listener": "^1.0.1", "@flatfile/util-common": "^1.0.2" }, + "peerDependencies": { + "@flatfile/listener": "^1.0.1" + }, "devDependencies": { "@flatfile/utils-testing": "^0.1.3" } diff --git a/plugins/job-handler/rollup.config.mjs b/plugins/job-handler/rollup.config.mjs index dd660b83a..6cf9b0f70 100644 --- a/plugins/job-handler/rollup.config.mjs +++ b/plugins/job-handler/rollup.config.mjs @@ -4,6 +4,7 @@ import resolve from '@rollup/plugin-node-resolve' import terser from '@rollup/plugin-terser' import typescript from '@rollup/plugin-typescript' import { dts } from 'rollup-plugin-dts' +import peerDepsExternal from 'rollup-plugin-peer-deps-external' import dotenv from 'dotenv' dotenv.config() @@ -13,14 +14,14 @@ if (!PROD) { console.log('Not in production mode - skipping minification') } -const external = ['@flatfile/listener', '@flatfile/util-common'] - -function commonPlugins(browser) { +function commonPlugins(browser, umd = false) { return [ + !umd ? peerDepsExternal() : undefined, json(), commonjs({ include: '**/node_modules/**', - requireReturnsDefault: 'preferred', + requireReturnsDefault: 'auto', + esmExternals: true, }), resolve({ browser, preferBuiltins: !browser }), typescript({ @@ -52,7 +53,6 @@ export default [ }, ], plugins: commonPlugins(false), - external, }, // Browser build { @@ -71,7 +71,6 @@ export default [ }, ], plugins: commonPlugins(true), - external, }, { input: 'src/index.ts', diff --git a/plugins/job-handler/src/job.handler.ts b/plugins/job-handler/src/job.handler.ts index a5db79ebd..dd2c4b134 100644 --- a/plugins/job-handler/src/job.handler.ts +++ b/plugins/job-handler/src/job.handler.ts @@ -1,5 +1,6 @@ -import api, { Flatfile } from '@flatfile/api' -import { +import type { Flatfile } from '@flatfile/api' +import api from '@flatfile/api' +import type { EventFilter, FlatfileEvent, FlatfileListener, diff --git a/plugins/record-hook/rollup.config.mjs b/plugins/record-hook/rollup.config.mjs index f2632e628..759824852 100644 --- a/plugins/record-hook/rollup.config.mjs +++ b/plugins/record-hook/rollup.config.mjs @@ -27,7 +27,7 @@ function commonPlugins(browser, umd = false) { json(), commonjs({ include: '**/node_modules/**', - requireReturnsDefault: 'preferred', + requireReturnsDefault: 'auto', esmExternals: true, }), resolve({ browser, preferBuiltins: !browser }), diff --git a/plugins/space-configure/package.json b/plugins/space-configure/package.json index 8e940e935..ffa41b616 100644 --- a/plugins/space-configure/package.json +++ b/plugins/space-configure/package.json @@ -8,13 +8,26 @@ "engines": { "node": ">= 16" }, - "source": "src/index.ts", - "main": "dist/main.js", - "module": "dist/module.mjs", - "types": "dist/types.d.ts", + "browser": { + "./dist/index.cjs": "./dist/index.browser.cjs", + "./dist/index.mjs": "./dist/index.browser.mjs" + }, + "exports": { + "types": "./dist/index.d.ts", + "import": "./dist/index.mjs", + "require": "./dist/index.cjs", + "default": "./dist/index.mjs" + }, + "main": "./dist/index.cjs", + "module": "./dist/index.mjs", + "source": "./src/index.ts", + "types": "./dist/index.d.ts", + "files": [ + "dist/**" + ], "scripts": { - "build": "parcel build", - "dev": "parcel watch", + "build": "rollup -c", + "build:prod": "rollup -c --environment NODE_ENV:production", "check": "tsc ./**/*.ts --noEmit --esModuleInterop", "test": "jest ./**/*.spec.ts --config=../../jest.config.js --runInBand" }, @@ -28,9 +41,11 @@ "license": "ISC", "dependencies": { "@flatfile/api": "^1.7.4", - "@flatfile/listener": "^1.0.1", "@flatfile/plugin-job-handler": "^0.4.0" }, + "peerDependencies": { + "@flatfile/listener": "^1.0.1" + }, "devDependencies": { "@flatfile/utils-testing": "^0.1.3" } diff --git a/plugins/space-configure/rollup.config.mjs b/plugins/space-configure/rollup.config.mjs new file mode 100644 index 000000000..6cf9b0f70 --- /dev/null +++ b/plugins/space-configure/rollup.config.mjs @@ -0,0 +1,80 @@ +import commonjs from '@rollup/plugin-commonjs' +import json from '@rollup/plugin-json' +import resolve from '@rollup/plugin-node-resolve' +import terser from '@rollup/plugin-terser' +import typescript from '@rollup/plugin-typescript' +import { dts } from 'rollup-plugin-dts' +import peerDepsExternal from 'rollup-plugin-peer-deps-external' + +import dotenv from 'dotenv' +dotenv.config() + +const PROD = process.env.NODE_ENV !== 'development' +if (!PROD) { + console.log('Not in production mode - skipping minification') +} + +function commonPlugins(browser, umd = false) { + return [ + !umd ? peerDepsExternal() : undefined, + json(), + commonjs({ + include: '**/node_modules/**', + requireReturnsDefault: 'auto', + esmExternals: true, + }), + resolve({ browser, preferBuiltins: !browser }), + typescript({ + tsconfig: '../../tsconfig.json', + declaration: false, + declarationMap: false, + declarationDir: './dist', + exclude: ['**/tests/*', '**/*.spec.ts'], + }), + PROD ? terser() : null, + ] +} + +export default [ + // Node.js build + { + input: 'src/index.ts', + output: [ + { + exports: 'auto', + file: 'dist/index.cjs', + format: 'cjs', + }, + { + exports: 'auto', + file: 'dist/index.mjs', + sourcemap: false, + format: 'es', + }, + ], + plugins: commonPlugins(false), + }, + // Browser build + { + input: 'src/index.ts', + output: [ + { + exports: 'auto', + file: 'dist/index.browser.cjs', + format: 'cjs', + }, + { + exports: 'auto', + file: 'dist/index.browser.mjs', + sourcemap: false, + format: 'es', + }, + ], + plugins: commonPlugins(true), + }, + { + input: 'src/index.ts', + output: [{ file: 'dist/index.d.ts', format: 'es' }], + plugins: [dts()], + }, +] diff --git a/plugins/space-configure/src/space.configure.ts b/plugins/space-configure/src/space.configure.ts index 08f302bb7..f4389e48b 100644 --- a/plugins/space-configure/src/space.configure.ts +++ b/plugins/space-configure/src/space.configure.ts @@ -1,5 +1,6 @@ -import api, { Flatfile } from '@flatfile/api' -import { FlatfileEvent, FlatfileListener } from '@flatfile/listener' +import type { Flatfile } from '@flatfile/api' +import api from '@flatfile/api' +import type { FlatfileEvent, FlatfileListener } from '@flatfile/listener' import { jobHandler } from '@flatfile/plugin-job-handler' /** @@ -71,9 +72,9 @@ export function configureSpace( export type SetupFactory = | Setup | ((event: FlatfileEvent) => Setup | Promise) -type Setup = { +export type Setup = { workbooks: PartialWb[] space?: Partial documents?: Flatfile.DocumentConfig[] } -type PartialWb = Partial +export type PartialWb = Partial diff --git a/plugins/webhook-egress/rollup.config.mjs b/plugins/webhook-egress/rollup.config.mjs index d73b8f6ab..c8dc2cf03 100644 --- a/plugins/webhook-egress/rollup.config.mjs +++ b/plugins/webhook-egress/rollup.config.mjs @@ -26,7 +26,7 @@ function commonPlugins(browser) { json(), commonjs({ include: '**/node_modules/**', - requireReturnsDefault: 'preferred', + requireReturnsDefault: 'auto', }), resolve({ browser, preferBuiltins: !browser }), typescript({ diff --git a/utils/common/rollup.config.mjs b/utils/common/rollup.config.mjs index 248e73c82..6cf9b0f70 100644 --- a/utils/common/rollup.config.mjs +++ b/utils/common/rollup.config.mjs @@ -20,7 +20,7 @@ function commonPlugins(browser, umd = false) { json(), commonjs({ include: '**/node_modules/**', - requireReturnsDefault: 'preferred', + requireReturnsDefault: 'auto', esmExternals: true, }), resolve({ browser, preferBuiltins: !browser }), diff --git a/utils/response-rejection/rollup.config.mjs b/utils/response-rejection/rollup.config.mjs index 30e94140f..0e47d4683 100644 --- a/utils/response-rejection/rollup.config.mjs +++ b/utils/response-rejection/rollup.config.mjs @@ -20,7 +20,7 @@ function commonPlugins(browser) { json(), commonjs({ include: '**/node_modules/**', - requireReturnsDefault: 'preferred', + requireReturnsDefault: 'auto', }), resolve({ browser, preferBuiltins: !browser }), typescript({