Skip to content

Commit

Permalink
fix: change retrieval of record count (#453)
Browse files Browse the repository at this point in the history
  • Loading branch information
carlbrugger authored Mar 28, 2024
1 parent 756410e commit 87711c6
Show file tree
Hide file tree
Showing 17 changed files with 170 additions and 46 deletions.
17 changes: 17 additions & 0 deletions .changeset/thin-monkeys-remember.md
Original file line number Diff line number Diff line change
@@ -0,0 +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
---

`@flatfile/plugin-connect-via-merge`: `@flatfile/[email protected]` 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.
40 changes: 23 additions & 17 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 plugins/autocast/rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function commonPlugins(browser, umd = false) {
json(),
commonjs({
include: '**/node_modules/**',
requireReturnsDefault: 'preferred',
requireReturnsDefault: 'auto',
esmExternals: true,
}),
resolve({ browser, preferBuiltins: !browser }),
Expand Down
2 changes: 1 addition & 1 deletion plugins/constraints/rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function commonPlugins(browser, umd = false) {
json(),
commonjs({
include: '**/node_modules/**',
requireReturnsDefault: 'preferred',
requireReturnsDefault: 'auto',
}),
resolve({ browser, preferBuiltins: !browser }),
typescript({
Expand Down
2 changes: 1 addition & 1 deletion plugins/dedupe/rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function commonPlugins(browser, umd = false) {
json(),
commonjs({
include: '**/node_modules/**',
requireReturnsDefault: 'preferred',
requireReturnsDefault: 'auto',
esmExternals: true,
}),
resolve({ browser, preferBuiltins: !browser }),
Expand Down
2 changes: 1 addition & 1 deletion plugins/foreign-db-extractor/rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function commonPlugins(browser, umd = false) {
json(),
commonjs({
include: '**/node_modules/**',
requireReturnsDefault: 'preferred',
requireReturnsDefault: 'auto',
esmExternals: true,
}),
resolve({ browser, preferBuiltins: !browser }),
Expand Down
4 changes: 3 additions & 1 deletion plugins/job-handler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand Down
11 changes: 5 additions & 6 deletions plugins/job-handler/rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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({
Expand Down Expand Up @@ -52,7 +53,6 @@ export default [
},
],
plugins: commonPlugins(false),
external,
},
// Browser build
{
Expand All @@ -71,7 +71,6 @@ export default [
},
],
plugins: commonPlugins(true),
external,
},
{
input: 'src/index.ts',
Expand Down
5 changes: 3 additions & 2 deletions plugins/job-handler/src/job.handler.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
5 changes: 4 additions & 1 deletion plugins/merge-connection/src/sync.data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion plugins/record-hook/rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function commonPlugins(browser, umd = false) {
json(),
commonjs({
include: '**/node_modules/**',
requireReturnsDefault: 'preferred',
requireReturnsDefault: 'auto',
esmExternals: true,
}),
resolve({ browser, preferBuiltins: !browser }),
Expand Down
29 changes: 22 additions & 7 deletions plugins/space-configure/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand All @@ -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"
}
Expand Down
80 changes: 80 additions & 0 deletions plugins/space-configure/rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -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()],
},
]
Loading

0 comments on commit 87711c6

Please sign in to comment.