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

Fix various typings for FieldSet #390

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion build/airtable.browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ module.exports = objectToQueryParamString;

},{"lodash/isArray":79,"lodash/isNil":85,"lodash/keys":93}],12:[function(require,module,exports){
"use strict";
module.exports = "0.12.2";
module.exports = "0.12.3";

},{}],13:[function(require,module,exports){
"use strict";
Expand Down
4 changes: 2 additions & 2 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
@@ -1,6 +1,6 @@
{
"name": "airtable",
"version": "0.12.2",
"version": "0.12.3",
"license": "MIT",
"homepage": "https://github.com/airtable/airtable.js",
"repository": "git://github.com/airtable/airtable.js.git",
Expand Down
6 changes: 6 additions & 0 deletions src/ai_text.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export interface AiTextResult {
state: 'empty' | 'loading' | 'generated' | 'error';
isStale: boolean;
value?: string;
errorType?: string;
}
4 changes: 4 additions & 0 deletions src/barcode.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export interface Barcode {
type?: string;
text?: string;
}
4 changes: 4 additions & 0 deletions src/button.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export interface Button {
label: string;
url?: string;
}
5 changes: 3 additions & 2 deletions src/collaborator.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export interface Collaborator {
id: string;
email: string;
name: string;
email?: string;
name?: string;
profilePicUrl?: string;
}
60 changes: 51 additions & 9 deletions src/field_set.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,56 @@
import {Collaborator} from './collaborator';
import {Attachment} from './attachment';
import {Barcode} from './barcode';
import {Button} from './button';
import {SyncSource} from './sync_source';
import {AiTextResult} from './ai_text';

// Built from https://airtable.com/developers/web/api/field-model
// AI Text: AiTextResult
// Attachment: Attachment
// Auto number: number
// Barcode: Barcode
// Button: Button
// Checkbox: boolean
// Collaborator: Collaborator
// Count: number
// Created by: Collaborator
// Created time: string
// Currency: number
// Date: string
// Date and time: string
// Duration: number
// Email: string
// Formula: string | number
// Last modified by:
// Last modified time: string
// Link to another record: string[]
// Long text: string
// Lookup: FieldValue[]
// Multiple collaborator: Collaborator[]
// Multiple select: string[]
// Number: number
// Percent: number
// Phone: string
// Rating: number
// Rich text: string
// Rollup: ReadonlyArray<FieldArray> | string | number
// Single line text: string
// Single select: string
// Sync source: SyncSource
// Url: string
export type FieldValue =
undefined |
string |
number |
boolean |
AiTextResult |
Barcode |
Button |
Collaborator |
SyncSource |
ReadonlyArray<Attachment> |
ReadonlyArray<FieldValue>;
export interface FieldSet {
[key: string]:
| undefined
| string
| number
| boolean
| Collaborator
| ReadonlyArray<Collaborator>
| ReadonlyArray<string>
| ReadonlyArray<Attachment>;
[key: string]: FieldValue;
}
5 changes: 5 additions & 0 deletions src/sync_source.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export interface SyncSource {
id: string;
name: string;
color?: string;
}
2 changes: 1 addition & 1 deletion test/test_files/airtable.browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ module.exports = objectToQueryParamString;

},{"lodash/isArray":79,"lodash/isNil":85,"lodash/keys":93}],12:[function(require,module,exports){
"use strict";
module.exports = "0.12.2";
module.exports = "0.12.3";

},{}],13:[function(require,module,exports){
"use strict";
Expand Down