spooder 4.5.2 → 4.5.4
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/README.md +1 -1
- package/package.json +1 -1
- package/src/api.ts +8 -3
package/README.md
CHANGED
|
@@ -1485,7 +1485,7 @@ const connection = await pool.getConnection();
|
|
|
1485
1485
|
The schema directory is expected to contain an SQL file for each table in the database with the file name matching the name of the table.
|
|
1486
1486
|
|
|
1487
1487
|
> [!NOTE]
|
|
1488
|
-
>
|
|
1488
|
+
> The schema directory is searched recursively and files without the `.sql` extension (case-insensitive) will be ignored.
|
|
1489
1489
|
|
|
1490
1490
|
```
|
|
1491
1491
|
- database.sqlite
|
package/package.json
CHANGED
package/src/api.ts
CHANGED
|
@@ -104,8 +104,9 @@ export async function caution(err_message_or_obj: string | object, ...err: objec
|
|
|
104
104
|
await handle_error('caution: ', err_message_or_obj, ...err);
|
|
105
105
|
}
|
|
106
106
|
|
|
107
|
+
type WebsocketAcceptReturn = object | boolean;
|
|
107
108
|
type WebsocketHandlers = {
|
|
108
|
-
accept?: (req: Request) =>
|
|
109
|
+
accept?: (req: Request) => WebsocketAcceptReturn | Promise<WebsocketAcceptReturn>,
|
|
109
110
|
message?: (ws: WebSocket, message: string) => void,
|
|
110
111
|
message_json?: (ws: WebSocket, message: JsonSerializable) => void,
|
|
111
112
|
open?: (ws: WebSocket) => void,
|
|
@@ -231,9 +232,13 @@ type SchemaVersionMap = Map<string, number>;
|
|
|
231
232
|
|
|
232
233
|
async function db_load_schema(schema_dir: string, schema_versions: SchemaVersionMap) {
|
|
233
234
|
const schema_out = [];
|
|
234
|
-
const schema_files = await fs.readdir(schema_dir);
|
|
235
|
+
const schema_files = await fs.readdir(schema_dir, { recursive: true, withFileTypes: true });
|
|
235
236
|
|
|
236
|
-
for (const
|
|
237
|
+
for (const schema_file_ent of schema_files) {
|
|
238
|
+
if (schema_file_ent.isDirectory())
|
|
239
|
+
continue;
|
|
240
|
+
|
|
241
|
+
const schema_file = schema_file_ent.name;
|
|
237
242
|
const schema_file_lower = schema_file.toLowerCase();
|
|
238
243
|
if (!schema_file_lower.endsWith('.sql'))
|
|
239
244
|
continue;
|