client-ts icon indicating copy to clipboard operation
client-ts copied to clipboard

Add all XataFile attributes to `summarize` response

Open mkurczewski opened this issue 7 months ago • 0 comments

Is your feature request related to a problem? Please describe.

When calling summarize on a given table (e.g. table) and there is a nested (linked) record (e.g. nested) containing XataFile column type (e.g. image), only basic metadata of it are returned.

const xata = getXataClient()

// Example request
const values = await xata.db.table.summarize({
    filter: {
		nested: {
			id: { $any:  ["rec_abc", "rec_def", "rec_ghi"] },
		}
    },
    columns: ["nested"],
    summaries: {
		recordsCount: { count: "*" },
    },
})

// Example response
{
"summaries": [
	{
		"recordsCount": 3,
		"nested": {
			"id": "rec_abc",
			"image": {
				"name": "image.png",
				"mediaType": "image/jpeg",
				"enablePublicUrl": true,
				"signedUrlTimeout": 600,
				"uploadUrlTimeout": 86400,
				"size": 171092,
				"version": 3,
				"attributes": {
					"height": 800,
					"width": 1200
				}
			},
			"xata": {
				// ...
			}
		}
	}
]
}

Describe the solution you'd like

I'd like to see the rest of fields from XataFile column type, like: url, base64Content etc.

Describe alternatives you've considered

The only alternative I can think of is to add another call like

await xata.db.table.filter(...).select(["image"]).getAll()

and then map the response result with the summarize response.

Additional context

mkurczewski avatar Jun 30 '24 21:06 mkurczewski