Merge branch 'master' into feature/signature-field-and-component
This commit is contained in:
commit
0ffa9d768a
|
@ -73,12 +73,15 @@ export function basicProcessing({
|
||||||
// filter the row down to what is actually the row (not joined)
|
// filter the row down to what is actually the row (not joined)
|
||||||
for (let field of Object.values(table.schema)) {
|
for (let field of Object.values(table.schema)) {
|
||||||
const fieldName = field.name
|
const fieldName = field.name
|
||||||
const value = extractFieldValue({
|
let value = extractFieldValue({
|
||||||
row,
|
row,
|
||||||
tableName: table.name,
|
tableName: table.name,
|
||||||
fieldName,
|
fieldName,
|
||||||
isLinked,
|
isLinked,
|
||||||
})
|
})
|
||||||
|
if (value instanceof Buffer) {
|
||||||
|
value = value.toString()
|
||||||
|
}
|
||||||
// all responses include "select col as table.col" so that overlaps are handled
|
// all responses include "select col as table.col" so that overlaps are handled
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
thisRow[fieldName] = value
|
thisRow[fieldName] = value
|
||||||
|
|
|
@ -1200,4 +1200,38 @@ describe("postgres integrations", () => {
|
||||||
expect(Object.keys(schema).sort()).toEqual(["id", "val1"])
|
expect(Object.keys(schema).sort()).toEqual(["id", "val1"])
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
describe("check custom column types", () => {
|
||||||
|
beforeAll(async () => {
|
||||||
|
await rawQuery(
|
||||||
|
rawDatasource,
|
||||||
|
`CREATE TABLE binaryTable (
|
||||||
|
id BYTEA PRIMARY KEY,
|
||||||
|
column1 TEXT,
|
||||||
|
column2 INT
|
||||||
|
);
|
||||||
|
`
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
|
it("should handle binary columns", async () => {
|
||||||
|
const response = await makeRequest(
|
||||||
|
"post",
|
||||||
|
`/api/datasources/${datasource._id}/schema`
|
||||||
|
)
|
||||||
|
expect(response.body).toBeDefined()
|
||||||
|
expect(response.body.datasource.entities).toBeDefined()
|
||||||
|
const table = response.body.datasource.entities["binarytable"]
|
||||||
|
expect(table).toBeDefined()
|
||||||
|
expect(table.schema.id.externalType).toBe("bytea")
|
||||||
|
const row = await config.api.row.save(table._id, {
|
||||||
|
id: "1111",
|
||||||
|
column1: "hello",
|
||||||
|
column2: 222,
|
||||||
|
})
|
||||||
|
expect(row._id).toBeDefined()
|
||||||
|
const decoded = decodeURIComponent(row._id!).replace(/'/g, '"')
|
||||||
|
expect(JSON.parse(decoded)[0]).toBe("1111")
|
||||||
|
})
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
|
@ -192,6 +192,11 @@ export function generateRowIdField(keyProps: any[] = []) {
|
||||||
if (!Array.isArray(keyProps)) {
|
if (!Array.isArray(keyProps)) {
|
||||||
keyProps = [keyProps]
|
keyProps = [keyProps]
|
||||||
}
|
}
|
||||||
|
for (let index in keyProps) {
|
||||||
|
if (keyProps[index] instanceof Buffer) {
|
||||||
|
keyProps[index] = keyProps[index].toString()
|
||||||
|
}
|
||||||
|
}
|
||||||
// this conserves order and types
|
// this conserves order and types
|
||||||
// we have to swap the double quotes to single quotes for use in HBS statements
|
// we have to swap the double quotes to single quotes for use in HBS statements
|
||||||
// when using the literal helper the double quotes can break things
|
// when using the literal helper the double quotes can break things
|
||||||
|
|
Loading…
Reference in New Issue