Skip to content

Commit 1d1c6cd

Browse files
authored
Merge branch 'main' into CHORE/Upgrade-Analytic-Dependencies
2 parents c0d311c + 247f1e9 commit 1d1c6cd

File tree

2 files changed

+20
-5
lines changed

2 files changed

+20
-5
lines changed

packages/components/nodes/documentloaders/Airtable/Airtable.ts

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class Airtable_DocumentLoaders implements INode {
2020
constructor() {
2121
this.label = 'Airtable'
2222
this.name = 'airtable'
23-
this.version = 1.0
23+
this.version = 2.0
2424
this.type = 'Document'
2525
this.icon = 'airtable.svg'
2626
this.category = 'Document Loaders'
@@ -55,6 +55,15 @@ class Airtable_DocumentLoaders implements INode {
5555
description:
5656
'If your table URL looks like: https://airtable.com/app11RobdGoX0YNsC/tblJdmvbrgizbYICO/viw9UrP77Id0CE4ee, tblJdmvbrgizbYICO is the table id'
5757
},
58+
{
59+
label: 'View Id',
60+
name: 'viewId',
61+
type: 'string',
62+
placeholder: 'viw9UrP77Id0CE4ee',
63+
description:
64+
'If your view URL looks like: https://airtable.com/app11RobdGoX0YNsC/tblJdmvbrgizbYICO/viw9UrP77Id0CE4ee, viw9UrP77Id0CE4ee is the view id',
65+
optional: true
66+
},
5867
{
5968
label: 'Return All',
6069
name: 'returnAll',
@@ -83,6 +92,7 @@ class Airtable_DocumentLoaders implements INode {
8392
async init(nodeData: INodeData, _: string, options: ICommonObject): Promise<any> {
8493
const baseId = nodeData.inputs?.baseId as string
8594
const tableId = nodeData.inputs?.tableId as string
95+
const viewId = nodeData.inputs?.viewId as string
8696
const returnAll = nodeData.inputs?.returnAll as boolean
8797
const limit = nodeData.inputs?.limit as string
8898
const textSplitter = nodeData.inputs?.textSplitter as TextSplitter
@@ -94,6 +104,7 @@ class Airtable_DocumentLoaders implements INode {
94104
const airtableOptions: AirtableLoaderParams = {
95105
baseId,
96106
tableId,
107+
viewId,
97108
returnAll,
98109
accessToken,
99110
limit: limit ? parseInt(limit, 10) : 100
@@ -133,6 +144,7 @@ interface AirtableLoaderParams {
133144
baseId: string
134145
tableId: string
135146
accessToken: string
147+
viewId?: string
136148
limit?: number
137149
returnAll?: boolean
138150
}
@@ -153,16 +165,19 @@ class AirtableLoader extends BaseDocumentLoader {
153165

154166
public readonly tableId: string
155167

168+
public readonly viewId?: string
169+
156170
public readonly accessToken: string
157171

158172
public readonly limit: number
159173

160174
public readonly returnAll: boolean
161175

162-
constructor({ baseId, tableId, accessToken, limit = 100, returnAll = false }: AirtableLoaderParams) {
176+
constructor({ baseId, tableId, viewId, accessToken, limit = 100, returnAll = false }: AirtableLoaderParams) {
163177
super()
164178
this.baseId = baseId
165179
this.tableId = tableId
180+
this.viewId = viewId
166181
this.accessToken = accessToken
167182
this.limit = limit
168183
this.returnAll = returnAll
@@ -203,7 +218,7 @@ class AirtableLoader extends BaseDocumentLoader {
203218
}
204219

205220
private async loadLimit(): Promise<Document[]> {
206-
const params = { maxRecords: this.limit }
221+
const params = { maxRecords: this.limit, view: this.viewId }
207222
const data = await this.fetchAirtableData(`https://api.airtable.com/v0/${this.baseId}/${this.tableId}`, params)
208223
if (data.records.length === 0) {
209224
return []
@@ -212,7 +227,7 @@ class AirtableLoader extends BaseDocumentLoader {
212227
}
213228

214229
private async loadAll(): Promise<Document[]> {
215-
const params: ICommonObject = { pageSize: 100 }
230+
const params: ICommonObject = { pageSize: 100, view: this.viewId }
216231
let data: AirtableLoaderResponse
217232
let returnPages: AirtableLoaderPage[] = []
218233

packages/components/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
"html-to-text": "^9.0.5",
5353
"husky": "^8.0.3",
5454
"ioredis": "^5.3.2",
55-
"langchain": "^0.0.213",
55+
"langchain": "^0.0.214",
5656
"langfuse": "2.0.2",
5757
"langfuse-langchain": "2.0.2",
5858
"langsmith": "0.0.53",

0 commit comments

Comments
 (0)