Skip to content

Commit

Permalink
Merge branch 'master' into poc-authenticated-iframe
Browse files Browse the repository at this point in the history
  • Loading branch information
shogunpurple authored Sep 2, 2024
2 parents 9924ad2 + fc36747 commit f7b2c77
Show file tree
Hide file tree
Showing 12 changed files with 44 additions and 22 deletions.
2 changes: 1 addition & 1 deletion packages/backend-core/src/features/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -267,5 +267,5 @@ export class FlagSet<V extends Flag<any>, T extends { [key: string]: V }> {
// default values set correctly and their types flow through the system.
export const flags = new FlagSet({
DEFAULT_VALUES: Flag.boolean(false),
SQS: Flag.boolean(false),
SQS: Flag.boolean(env.isDev()),
})
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
$: pendingSchema = getPendingSchema(schema)
$: userData = []
$: inviteUsersResponse = { successful: [], unsuccessful: [] }
$: setEnrichedUsers($fetch.rows)
$: setEnrichedUsers($fetch.rows, tenantOwnerLoaded)
const setEnrichedUsers = async rows => {
if (!tenantOwnerLoaded) {
Expand Down
1 change: 0 additions & 1 deletion packages/server/scripts/dev/manage.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ async function init() {
HTTP_LOGGING: "0",
VERSION: "0.0.0+local",
PASSWORD_MIN_LENGTH: "1",
TENANT_FEATURE_FLAGS: "*:SQS",
}

config = { ...config, ...existingConfig }
Expand Down
2 changes: 1 addition & 1 deletion packages/server/src/api/routes/tests/misc.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ describe("run misc tests", () => {
const rowThree = rows.find(row => row.e === 3)
expect(rowThree.a).toEqual("9")
expect(rowThree.f).toEqual(["Two", "Four"])
expect(rowThree.g).toEqual(null)
expect(rowThree.g).toEqual(undefined)

const rowFour = rows.find(row => row.e === 4)
expect(rowFour.a).toEqual("13")
Expand Down
8 changes: 5 additions & 3 deletions packages/server/src/api/routes/tests/row.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,11 @@ describe.each([
let envCleanup: (() => void) | undefined

beforeAll(async () => {
await withCoreEnv({ TENANT_FEATURE_FLAGS: "*SQS" }, () => config.init())
if (isSqs) {
envCleanup = setCoreEnv({ TENANT_FEATURE_FLAGS: "*SQS" })
await withCoreEnv({ TENANT_FEATURE_FLAGS: "*:SQS" }, () => config.init())
if (isLucene) {
envCleanup = setCoreEnv({ TENANT_FEATURE_FLAGS: "*:!SQS" })
} else if (isSqs) {
envCleanup = setCoreEnv({ TENANT_FEATURE_FLAGS: "*:SQS" })
}

if (dsProvider) {
Expand Down
6 changes: 5 additions & 1 deletion packages/server/src/api/routes/tests/search.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,11 @@ describe.each([

beforeAll(async () => {
await withCoreEnv({ TENANT_FEATURE_FLAGS: "*:SQS" }, () => config.init())
if (isSqs) {
if (isLucene) {
envCleanup = setCoreEnv({
TENANT_FEATURE_FLAGS: "*:!SQS",
})
} else if (isSqs) {
envCleanup = setCoreEnv({
TENANT_FEATURE_FLAGS: "*:SQS",
})
Expand Down
18 changes: 10 additions & 8 deletions packages/server/src/api/routes/tests/table.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const { basicTable } = setup.structures
const ISO_REGEX_PATTERN = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/

describe.each([
["internal", undefined],
["sqs", undefined],
[DatabaseName.POSTGRES, getDatasource(DatabaseName.POSTGRES)],
[DatabaseName.MYSQL, getDatasource(DatabaseName.MYSQL)],
[DatabaseName.SQL_SERVER, getDatasource(DatabaseName.SQL_SERVER)],
Expand Down Expand Up @@ -290,7 +290,7 @@ describe.each([
expected._rev = expect.stringMatching(/^2-.+/)
}

expect(updatedTable).toEqual(expected)
expect(updatedTable).toEqual(expect.objectContaining(expected))

const persistedTable = await config.api.table.get(updatedTable._id!)
expected = {
Expand All @@ -304,7 +304,7 @@ describe.each([
if (isInternal) {
expected._rev = expect.stringMatching(/^2-.+/)
}
expect(persistedTable).toEqual(expected)
expect(persistedTable).toEqual(expect.objectContaining(expected))
})
})

Expand Down Expand Up @@ -687,7 +687,7 @@ describe.each([
basicTable(datasource, { name: generator.guid() })
)
const res = await config.api.table.get(table._id!)
expect(res).toEqual(table)
expect(res).toEqual(expect.objectContaining(table))
})
})

Expand Down Expand Up @@ -727,10 +727,12 @@ describe.each([
body: { message: `Table ${testTable._id} deleted.` },
})
expect(events.table.deleted).toHaveBeenCalledTimes(1)
expect(events.table.deleted).toHaveBeenCalledWith({
...testTable,
tableId: testTable._id,
})
expect(events.table.deleted).toHaveBeenCalledWith(
expect.objectContaining({
...testTable,
tableId: testTable._id,
})
)
})

it("deletes linked references to the table after deletion", async () => {
Expand Down
10 changes: 8 additions & 2 deletions packages/server/src/api/routes/tests/view.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,10 @@ describe("/views", () => {

assertJsonExport(res)
expect(events.table.exported).toHaveBeenCalledTimes(1)
expect(events.table.exported).toHaveBeenCalledWith(table, "json")
expect(events.table.exported).toHaveBeenCalledWith(
expect.objectContaining(table),
"json"
)
})

it("should be able to export a table as CSV", async () => {
Expand All @@ -454,7 +457,10 @@ describe("/views", () => {

assertCSVExport(res)
expect(events.table.exported).toHaveBeenCalledTimes(1)
expect(events.table.exported).toHaveBeenCalledWith(table, "csv")
expect(events.table.exported).toHaveBeenCalledWith(
expect.objectContaining(table),
"csv"
)
})

it("should be able to export a view as JSON", async () => {
Expand Down
6 changes: 5 additions & 1 deletion packages/server/src/api/routes/tests/viewV2.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,11 @@ describe.each([
await withCoreEnv({ TENANT_FEATURE_FLAGS: isSqs ? "*:SQS" : "" }, () =>
config.init()
)
if (isSqs) {
if (isLucene) {
envCleanup = setCoreEnv({
TENANT_FEATURE_FLAGS: "*:!SQS",
})
} else if (isSqs) {
envCleanup = setCoreEnv({
TENANT_FEATURE_FLAGS: "*:SQS",
})
Expand Down
6 changes: 5 additions & 1 deletion packages/server/src/sdk/app/rows/search/tests/search.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,11 @@ describe.each([
config.init()
)

if (isSqs) {
if (isLucene) {
envCleanup = setCoreEnv({
TENANT_FEATURE_FLAGS: "*:!SQS",
})
} else if (isSqs) {
envCleanup = setCoreEnv({
TENANT_FEATURE_FLAGS: "*:SQS",
})
Expand Down
1 change: 0 additions & 1 deletion packages/worker/scripts/dev/manage.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ async function init() {
HTTP_LOGGING: "0",
VERSION: "0.0.0+local",
PASSWORD_MIN_LENGTH: "1",
TENANT_FEATURE_FLAGS: "*:SQS",
}

config = { ...config, ...existingConfig }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ describe.each(["lucene", "sql"])("/api/global/auditlogs (%s)", method => {
let envCleanup: (() => void) | undefined

beforeAll(async () => {
if (method === "sql") {
if (method === "lucene") {
envCleanup = setCoreEnv({ TENANT_FEATURE_FLAGS: "*:!SQS" })
} else if (method === "sql") {
envCleanup = setCoreEnv({ TENANT_FEATURE_FLAGS: "*:SQS" })
}
await config.beforeAll()
Expand Down

0 comments on commit f7b2c77

Please sign in to comment.