diff --git a/CHANGELOG.md b/CHANGELOG.md index 4b3ba72..9638a4e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [0.0.4] - 2024-01-17 + +### Fixed + +- Added separate zip code generator for handling single line text vs. number fields. + ## [0.0.3] - 2022-10-25 ### Added diff --git a/frontend/lib/generators/generators/index.ts b/frontend/lib/generators/generators/index.ts index 7143aa2..cd3659d 100644 --- a/frontend/lib/generators/generators/index.ts +++ b/frontend/lib/generators/generators/index.ts @@ -11,6 +11,7 @@ import EmailHumanGenerator from './email-human' import AddressGenerator from './address' import CityGenerator from './city' import ZipGenerator from './zip' +import ZipStringGenerator from './zip-string' import StateAbbreviationGenerator from './state-abbreviation' import StateNameGenerator from './state-name' import CheckboxGenerator from './checkbox' @@ -40,6 +41,7 @@ const generators = [ AddressGenerator, CityGenerator, ZipGenerator, + ZipStringGenerator, StateAbbreviationGenerator, StateNameGenerator, CheckboxGenerator, diff --git a/frontend/lib/generators/generators/zip-string.ts b/frontend/lib/generators/generators/zip-string.ts new file mode 100644 index 0000000..70ddeb3 --- /dev/null +++ b/frontend/lib/generators/generators/zip-string.ts @@ -0,0 +1,11 @@ +import { FieldType } from '@airtable/blocks/models' +import Generator from './generator' + +const ZipStringGenerator = (): Generator => ({ + id: 'zip-string', + name: 'Zip code', + types: [FieldType.SINGLE_LINE_TEXT], + generate: () => (Math.floor(Math.random() * 90000) + 10000).toString(), +}) + +export default ZipStringGenerator diff --git a/frontend/lib/generators/generators/zip.ts b/frontend/lib/generators/generators/zip.ts index 64a2c15..8a5c722 100644 --- a/frontend/lib/generators/generators/zip.ts +++ b/frontend/lib/generators/generators/zip.ts @@ -4,7 +4,7 @@ import Generator from './generator' const ZipGenerator = (): Generator => ({ id: 'zip', name: 'Zip code', - types: [FieldType.SINGLE_LINE_TEXT, FieldType.NUMBER], + types: [FieldType.NUMBER], generate: () => Math.floor(Math.random() * 90000) + 10000, }) diff --git a/package.json b/package.json index 861787b..41beb95 100644 --- a/package.json +++ b/package.json @@ -2,6 +2,7 @@ "name": "airtable-extension-random-record-generator", "description": "Randomly generates Airtable records", "license": "Apache-2.0", + "version": "0.0.4", "scripts": { "lint": "eslint --ext .js,.jsx,.ts,.tsx frontend test", "test": "npm run lint && npm run test:jsdom",