( packedFile: Pick<PackedFile, "tableSchema">, columnName: string, executionContext?: FlowExecutionContext, )
| 82 | }; |
| 83 | |
| 84 | const getColumnIndexForPackedFile = ( |
| 85 | packedFile: Pick<PackedFile, "tableSchema">, |
| 86 | columnName: string, |
| 87 | executionContext?: FlowExecutionContext, |
| 88 | ): number => { |
| 89 | if (!packedFile.tableSchema) { |
| 90 | return -1; |
| 91 | } |
| 92 | |
| 93 | if (!executionContext) { |
| 94 | return packedFile.tableSchema.fields.findIndex((field) => field.name === columnName); |
| 95 | } |
| 96 | |
| 97 | let columnIndexes = executionContext.columnIndexesByPackedFile.get(packedFile as PackedFile); |
| 98 | if (!columnIndexes) { |
| 99 | columnIndexes = new Map<string, number>(); |
| 100 | packedFile.tableSchema.fields.forEach((field, index) => { |
| 101 | columnIndexes?.set(field.name, index); |
| 102 | }); |
| 103 | executionContext.columnIndexesByPackedFile.set(packedFile as PackedFile, columnIndexes); |
| 104 | } |
| 105 | |
| 106 | return columnIndexes.get(columnName) ?? -1; |
| 107 | }; |
| 108 | |
| 109 | const readPackCached = async ( |
| 110 | packPath: string, |
no test coverage detected