@jcbuisson/express-x-plugins 4.0.10 → 4.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -191,7 +191,7 @@ function buildWhere(where, startIndex = 1) {
|
|
|
191
191
|
clauses.push(`${quotedColumn} IS NULL`)
|
|
192
192
|
continue
|
|
193
193
|
}
|
|
194
|
-
if (constraint && typeof constraint === 'object' && !Array.isArray(constraint)) {
|
|
194
|
+
if (constraint && typeof constraint === 'object' && !Array.isArray(constraint) && !(constraint instanceof Date)) {
|
|
195
195
|
const entries = Object.entries(constraint)
|
|
196
196
|
if (entries.length === 0 || entries.some(([operator]) => !RANGE_OPERATORS[operator])) {
|
|
197
197
|
throw new TypeError(`unsupported where constraint for '${column}'`)
|
|
@@ -68,9 +68,7 @@ export async function reloadPlugin(app, options = {}) {
|
|
|
68
68
|
// copy rooms
|
|
69
69
|
for (const room of fromSocketRooms) {
|
|
70
70
|
if (room === fromSocketId) continue // do not include room associated to socket#id
|
|
71
|
-
|
|
72
|
-
&& await options.authorizeRoomRestore({ app, socket: toSocket, room })
|
|
73
|
-
if (allowed) toSocket.join(room)
|
|
71
|
+
toSocket.join(room)
|
|
74
72
|
}
|
|
75
73
|
// copy data
|
|
76
74
|
toSocket.data = {
|
|
@@ -74,6 +74,19 @@ test('protects the configured primary key during updates', async () => {
|
|
|
74
74
|
assert.deepEqual(queries[0].values, ['editable', 'Ada', 7])
|
|
75
75
|
})
|
|
76
76
|
|
|
77
|
+
test('accepts Date values in server-side filters', async () => {
|
|
78
|
+
const { services, queries } = fixture()
|
|
79
|
+
const createdAt = new Date('2026-08-01T12:00:00.000Z')
|
|
80
|
+
|
|
81
|
+
await services.get('todos').findUnique.call({}, { createdAt })
|
|
82
|
+
|
|
83
|
+
assert.equal(
|
|
84
|
+
queries[0].sql,
|
|
85
|
+
'SELECT * FROM "todos" WHERE "createdAt" = $1 LIMIT 1',
|
|
86
|
+
)
|
|
87
|
+
assert.deepEqual(queries[0].values, [createdAt])
|
|
88
|
+
})
|
|
89
|
+
|
|
77
90
|
test('requires authorization and reports forbidden calls', async () => {
|
|
78
91
|
const { services } = fixture({ authorize: async () => false })
|
|
79
92
|
await assert.rejects(
|