MCPcopy Create free account
hub / github.com/cloudquery/cloudquery / resolver

Function resolver

plugins/source/airtable/src/tables.ts:129–146  ·  view source on GitHub ↗
(client, resource, column)

Source from the content-addressed store, hash-verified

127 case APIFieldType.createdTime:
128 case APIFieldType.lastModifiedTime: {
129 const resolver: ColumnResolver = (client, resource, column) => {
130 const data = getProperty(resource.getItem(), field.name);
131 if (!data) {
132 return Promise.resolve(resource.setColumData(column.name, null));
133 }
134
135 const dateFormat = normalizeDateFormat(field.options.result.options.dateFormat.format);
136 if (field.options.result.type === 'date') {
137 const formatted = dayjs(data as string, dateFormat).toDate();
138 return Promise.resolve(resource.setColumData(column.name, formatted));
139 }
140
141 const timeFormat = field.options.result.options.timeFormat.format;
142 const format = `${dateFormat} ${timeFormat}`;
143 const timezone = normalizeTimeZone(field.options.result.options.timeZone);
144 const formatted = dayjs.tz(data as string, format, timezone).toDate();
145 return Promise.resolve(resource.setColumData(column.name, formatted));
146 };
147 return resolver;
148 }
149 case APIFieldType.date: {

Callers

nothing calls this directly

Calls 4

normalizeDateFormatFunction · 0.85
normalizeTimeZoneFunction · 0.85
resolveMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected