@devmoods/express-extras 0.63.1 → 0.65.0
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 +0 -111
- package/dist/auth/emailAndPassword.js +2 -1
- package/dist/auth/google.d.ts +4 -4
- package/dist/auth/google.js +14 -11
- package/dist/auth/passwordless.js +2 -1
- package/dist/auth/token.js +6 -6
- package/dist/auth/types.d.ts +1 -1
- package/dist/auth.d.ts +1 -1
- package/dist/auth.js +17 -10
- package/dist/cache.d.ts +3 -0
- package/dist/cache.js +3 -2
- package/dist/channels.d.ts +9 -5
- package/dist/channels.js +115 -23
- package/dist/cli.js +1 -1
- package/dist/config.d.ts +66 -66
- package/dist/config.js +35 -36
- package/dist/context.d.ts +5 -2
- package/dist/context.js +10 -9
- package/dist/csrf.js +6 -6
- package/dist/email.d.ts +1 -1
- package/dist/email.js +3 -3
- package/dist/errors.js +1 -1
- package/dist/faktory.d.ts +1 -1
- package/dist/faktory.js +5 -15
- package/dist/index.d.ts +2 -2
- package/dist/index.js +4 -3
- package/dist/listen.d.ts +5 -4
- package/dist/listen.js +47 -45
- package/dist/logger.d.ts +1 -0
- package/dist/logger.js +11 -5
- package/dist/manage.d.ts +4 -6
- package/dist/manage.js +41 -37
- package/dist/middleware.d.ts +3 -0
- package/dist/middleware.js +24 -7
- package/dist/rate-limit.d.ts +1 -0
- package/dist/rate-limit.js +25 -3
- package/dist/redis.d.ts +3 -0
- package/dist/redis.js +25 -2
- package/dist/sentry.js +7 -3
- package/dist/setupTests.global.d.ts +2 -0
- package/dist/setupTests.global.js +4 -0
- package/dist/setupTests.js +5 -1
- package/dist/slack.js +2 -2
- package/dist/utils.d.ts +2 -14
- package/dist/utils.js +2 -21
- package/dist/validate.js +7 -4
- package/dist/vite/__tests__/fixtures/src/entry-server.d.ts +5 -0
- package/dist/vite/__tests__/fixtures/src/entry-server.js +15 -0
- package/dist/vite/defineViteConfig.js +11 -1
- package/dist/vite/index.d.ts +1 -0
- package/dist/vite/index.js +3 -0
- package/dist/vite/ssr.d.ts +1 -0
- package/dist/vite/ssr.js +9 -4
- package/dist/vitest/index.d.ts +6 -0
- package/dist/vitest/index.js +25 -0
- package/dist/vitest/matchers.d.ts +11 -0
- package/dist/vitest/matchers.js +65 -0
- package/dist/vitest/testClient.d.ts +30 -0
- package/dist/vitest/testClient.js +98 -0
- package/dist/webapi.js +4 -0
- package/package.json +38 -43
- package/dist/__tests__/__migrations__/1_a.d.ts +0 -3
- package/dist/__tests__/__migrations__/1_a.js +0 -9
- package/dist/migrate.d.ts +0 -47
- package/dist/migrate.js +0 -255
- package/dist/postgres-ts-generator.d.ts +0 -11
- package/dist/postgres-ts-generator.js +0 -114
- package/dist/postgres.d.ts +0 -71
- package/dist/postgres.js +0 -261
- package/dist/sql.d.ts +0 -33
- package/dist/sql.js +0 -135
- package/dist/vite/vitest.d.ts +0 -1
- package/dist/vite/vitest.js +0 -1
- package/dist/vite.d.ts +0 -1
- package/dist/vite.js +0 -1
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import {} from 'vitest';
|
|
2
|
+
export * from './matchers.js';
|
|
3
|
+
export * from './testClient.js';
|
|
4
|
+
class RollbackError extends Error {
|
|
5
|
+
}
|
|
6
|
+
export function createTransactionWrapper(wrapped) {
|
|
7
|
+
const wrapTransaction = (run) => {
|
|
8
|
+
return async (context) => {
|
|
9
|
+
try {
|
|
10
|
+
await wrapped.transaction(async () => {
|
|
11
|
+
await run(context);
|
|
12
|
+
throw new RollbackError();
|
|
13
|
+
/* c8 ignore next 1 */
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
catch (error) {
|
|
17
|
+
if (error instanceof RollbackError) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
throw error;
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
return wrapTransaction;
|
|
25
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type ExpectStatic } from 'vitest';
|
|
2
|
+
import failOnConsole from 'vitest-fail-on-console';
|
|
3
|
+
interface CustomMatchers<R = unknown> {
|
|
4
|
+
toMatchResponse: (statusCode: number, body?: unknown) => R;
|
|
5
|
+
}
|
|
6
|
+
declare module 'vitest' {
|
|
7
|
+
interface Matchers<T = any> extends CustomMatchers<T> {
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export { failOnConsole };
|
|
11
|
+
export declare function extendMatchers(expect: ExpectStatic): void;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import {} from 'vitest';
|
|
2
|
+
import failOnConsole from 'vitest-fail-on-console';
|
|
3
|
+
export { failOnConsole };
|
|
4
|
+
/* c8 ignore start */
|
|
5
|
+
export function extendMatchers(expect) {
|
|
6
|
+
expect.extend({
|
|
7
|
+
toMatchResponse(received, expectedStatusCode, expectedBody) {
|
|
8
|
+
const { isNot } = this;
|
|
9
|
+
// Check if received is a proper response object
|
|
10
|
+
if (!received ||
|
|
11
|
+
typeof received !== 'object' ||
|
|
12
|
+
!('status' in received || 'response' in received)) {
|
|
13
|
+
return {
|
|
14
|
+
pass: false,
|
|
15
|
+
message: () => `Expected response object with status property, but received: ${this.utils.printReceived(received)}`,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
const response = 'response' in received ? received.response : received;
|
|
19
|
+
const status = response.status;
|
|
20
|
+
const body = 'jsonData' in response ? response.jsonData : response.body;
|
|
21
|
+
// Check status code
|
|
22
|
+
const statusMatches = status === expectedStatusCode;
|
|
23
|
+
// Check body (if provided)
|
|
24
|
+
let bodyMatches = true;
|
|
25
|
+
let bodyMessage = '';
|
|
26
|
+
if (expectedBody !== undefined) {
|
|
27
|
+
if (typeof expectedBody === 'object' && expectedBody !== null) {
|
|
28
|
+
// For objects, do a deep equality check
|
|
29
|
+
bodyMatches = this.equals(body, expectedBody);
|
|
30
|
+
if (!bodyMatches) {
|
|
31
|
+
bodyMessage = `\n\nExpected body:\n${this.utils.printExpected(expectedBody)}\nReceived body:\n${this.utils.printReceived(body)}`;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
// For primitives, do a simple equality check
|
|
36
|
+
bodyMatches = body === expectedBody;
|
|
37
|
+
if (!bodyMatches) {
|
|
38
|
+
bodyMessage = `\n\nExpected body: ${this.utils.printExpected(expectedBody)}\nReceived body: ${this.utils.printReceived(body)}`;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
const pass = statusMatches && bodyMatches;
|
|
43
|
+
let message = '';
|
|
44
|
+
if (!statusMatches) {
|
|
45
|
+
message += `Expected status: ${this.utils.printExpected(expectedStatusCode)}\nReceived status: ${this.utils.printReceived(status)}`;
|
|
46
|
+
}
|
|
47
|
+
if (!bodyMatches) {
|
|
48
|
+
message += bodyMessage;
|
|
49
|
+
}
|
|
50
|
+
return {
|
|
51
|
+
pass,
|
|
52
|
+
message: () => {
|
|
53
|
+
if (pass && isNot) {
|
|
54
|
+
return `Expected response not to match status ${expectedStatusCode}${expectedBody !== undefined ? ` with body ${this.utils.printExpected(expectedBody)}` : ''}`;
|
|
55
|
+
}
|
|
56
|
+
if (!pass && !isNot) {
|
|
57
|
+
return `Expected response to match status ${expectedStatusCode}${expectedBody !== undefined ? ` with body ${this.utils.printExpected(expectedBody)}` : ''}\n\n${message}`;
|
|
58
|
+
}
|
|
59
|
+
return message;
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
/* c8 ignore stop */
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { type Server } from 'node:http';
|
|
2
|
+
import { type FetchClientOptions } from '@devmoods/fetch';
|
|
3
|
+
import { type Application } from 'express';
|
|
4
|
+
import * as tough from 'tough-cookie';
|
|
5
|
+
export declare function createTestClient(server: Server | Application, options?: FetchClientOptions): Promise<{
|
|
6
|
+
duplicate(): Promise</*elided*/ any>;
|
|
7
|
+
cookieJar: tough.CookieJar;
|
|
8
|
+
fetch: {
|
|
9
|
+
<TResponseData, TRequestData = any, TTransformedResponseData = TResponseData, TTransformedRequestData = TRequestData, TSchema extends import("@standard-schema/spec", { with: { "resolution-mode": "require" } }).StandardSchemaV1<TTransformedResponseData, any> = import("@standard-schema/spec", { with: { "resolution-mode": "require" } }).StandardSchemaV1<TTransformedResponseData, TTransformedResponseData>>(url: string, options?: import("@devmoods/fetch").RequestOptions<TRequestData, TTransformedRequestData, TResponseData, TTransformedResponseData, TSchema>): Promise<import("@devmoods/fetch").HttpResponse<import("@standard-schema/spec", { with: { "resolution-mode": "require" } }).StandardSchemaV1.InferOutput<TSchema>>>;
|
|
10
|
+
intercept(interceptor: import("@devmoods/fetch").FetchInterceptor): () => void;
|
|
11
|
+
};
|
|
12
|
+
post: {
|
|
13
|
+
<TResponseData, TRequestData = any, TTransformedResponseData = TResponseData, TTransformedRequestData = TRequestData, TSchema extends import("@standard-schema/spec", { with: { "resolution-mode": "require" } }).StandardSchemaV1<TTransformedResponseData, any> = import("@standard-schema/spec", { with: { "resolution-mode": "require" } }).StandardSchemaV1<TTransformedResponseData, TTransformedResponseData>>(url: string, options?: import("@devmoods/fetch").RequestOptions<TRequestData, TTransformedRequestData, TResponseData, TTransformedResponseData, TSchema>): Promise<import("@devmoods/fetch").HttpResponse<import("@standard-schema/spec", { with: { "resolution-mode": "require" } }).StandardSchemaV1.InferOutput<TSchema>>>;
|
|
14
|
+
intercept(interceptor: import("@devmoods/fetch").FetchInterceptor): () => void;
|
|
15
|
+
};
|
|
16
|
+
get: {
|
|
17
|
+
<TResponseData, TRequestData = any, TTransformedResponseData = TResponseData, TTransformedRequestData = TRequestData, TSchema extends import("@standard-schema/spec", { with: { "resolution-mode": "require" } }).StandardSchemaV1<TTransformedResponseData, any> = import("@standard-schema/spec", { with: { "resolution-mode": "require" } }).StandardSchemaV1<TTransformedResponseData, TTransformedResponseData>>(url: string, options?: import("@devmoods/fetch").RequestOptions<TRequestData, TTransformedRequestData, TResponseData, TTransformedResponseData, TSchema>): Promise<import("@devmoods/fetch").HttpResponse<import("@standard-schema/spec", { with: { "resolution-mode": "require" } }).StandardSchemaV1.InferOutput<TSchema>>>;
|
|
18
|
+
intercept(interceptor: import("@devmoods/fetch").FetchInterceptor): () => void;
|
|
19
|
+
};
|
|
20
|
+
put: {
|
|
21
|
+
<TResponseData, TRequestData = any, TTransformedResponseData = TResponseData, TTransformedRequestData = TRequestData, TSchema extends import("@standard-schema/spec", { with: { "resolution-mode": "require" } }).StandardSchemaV1<TTransformedResponseData, any> = import("@standard-schema/spec", { with: { "resolution-mode": "require" } }).StandardSchemaV1<TTransformedResponseData, TTransformedResponseData>>(url: string, options?: import("@devmoods/fetch").RequestOptions<TRequestData, TTransformedRequestData, TResponseData, TTransformedResponseData, TSchema>): Promise<import("@devmoods/fetch").HttpResponse<import("@standard-schema/spec", { with: { "resolution-mode": "require" } }).StandardSchemaV1.InferOutput<TSchema>>>;
|
|
22
|
+
intercept(interceptor: import("@devmoods/fetch").FetchInterceptor): () => void;
|
|
23
|
+
};
|
|
24
|
+
delete: {
|
|
25
|
+
<TResponseData, TRequestData = any, TTransformedResponseData = TResponseData, TTransformedRequestData = TRequestData, TSchema extends import("@standard-schema/spec", { with: { "resolution-mode": "require" } }).StandardSchemaV1<TTransformedResponseData, any> = import("@standard-schema/spec", { with: { "resolution-mode": "require" } }).StandardSchemaV1<TTransformedResponseData, TTransformedResponseData>>(url: string, options?: import("@devmoods/fetch").RequestOptions<TRequestData, TTransformedRequestData, TResponseData, TTransformedResponseData, TSchema>): Promise<import("@devmoods/fetch").HttpResponse<import("@standard-schema/spec", { with: { "resolution-mode": "require" } }).StandardSchemaV1.InferOutput<TSchema>>>;
|
|
26
|
+
intercept(interceptor: import("@devmoods/fetch").FetchInterceptor): () => void;
|
|
27
|
+
};
|
|
28
|
+
close: () => Promise<void>;
|
|
29
|
+
[Symbol.asyncDispose]: () => Promise<void>;
|
|
30
|
+
}>;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { createServer } from 'node:http';
|
|
2
|
+
import {} from 'node:net';
|
|
3
|
+
import { createFetch, HttpError, } from '@devmoods/fetch';
|
|
4
|
+
import {} from 'express';
|
|
5
|
+
import * as tough from 'tough-cookie';
|
|
6
|
+
export async function createTestClient(server, options) {
|
|
7
|
+
// Express app
|
|
8
|
+
if ('route' in server) {
|
|
9
|
+
server = createServer(server);
|
|
10
|
+
}
|
|
11
|
+
let address = server.address();
|
|
12
|
+
/* c8 ignore next 5 */
|
|
13
|
+
if (typeof address === 'string') {
|
|
14
|
+
throw new Error(`Can't use a server listening on a UNIX domain socket: ${address}`);
|
|
15
|
+
}
|
|
16
|
+
let started = false;
|
|
17
|
+
if (address == null) {
|
|
18
|
+
await new Promise((resolve) => {
|
|
19
|
+
server.once('listening', resolve);
|
|
20
|
+
server.listen(0);
|
|
21
|
+
});
|
|
22
|
+
started = true;
|
|
23
|
+
address = server.address();
|
|
24
|
+
}
|
|
25
|
+
const cookieJar = new tough.CookieJar();
|
|
26
|
+
const fetch = createFetch({
|
|
27
|
+
getRootUrl: () => `http://localhost:${address.port}`,
|
|
28
|
+
redirect: 'manual',
|
|
29
|
+
...options,
|
|
30
|
+
});
|
|
31
|
+
fetch.intercept({
|
|
32
|
+
request: async (req) => {
|
|
33
|
+
req.headers.set('cookie', await cookieJar.getCookieString(req.url));
|
|
34
|
+
},
|
|
35
|
+
response: async (response) => {
|
|
36
|
+
const cookies = response.headers.getSetCookie();
|
|
37
|
+
await Promise.all(cookies.map(async (cookie) => await cookieJar.setCookie(cookie, response.url, {
|
|
38
|
+
ignoreError: false,
|
|
39
|
+
})));
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
const post = async (url, opt) => {
|
|
43
|
+
return fetch(url, { method: 'POST', ...opt }).catch((e) => {
|
|
44
|
+
if (e instanceof HttpError) {
|
|
45
|
+
return e.response;
|
|
46
|
+
}
|
|
47
|
+
throw e;
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
post.intercept = fetch.intercept;
|
|
51
|
+
const get = async (url, opt) => {
|
|
52
|
+
return fetch(url, { method: 'GET', ...opt }).catch((e) => {
|
|
53
|
+
if (e instanceof HttpError) {
|
|
54
|
+
return e.response;
|
|
55
|
+
}
|
|
56
|
+
throw e;
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
|
+
get.intercept = fetch.intercept;
|
|
60
|
+
const put = async (url, opt) => {
|
|
61
|
+
return fetch(url, { method: 'PUT', ...opt }).catch((e) => {
|
|
62
|
+
if (e instanceof HttpError) {
|
|
63
|
+
return e.response;
|
|
64
|
+
}
|
|
65
|
+
throw e;
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
put.intercept = fetch.intercept;
|
|
69
|
+
const delete_ = async (url, opt) => {
|
|
70
|
+
return fetch(url, { method: 'DELETE', ...opt }).catch((e) => {
|
|
71
|
+
if (e instanceof HttpError) {
|
|
72
|
+
return e.response;
|
|
73
|
+
}
|
|
74
|
+
throw e;
|
|
75
|
+
});
|
|
76
|
+
};
|
|
77
|
+
delete_.intercept = fetch.intercept;
|
|
78
|
+
const close = async () => {
|
|
79
|
+
if (started) {
|
|
80
|
+
server.close();
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
return {
|
|
84
|
+
duplicate() {
|
|
85
|
+
return createTestClient(server, options);
|
|
86
|
+
},
|
|
87
|
+
cookieJar,
|
|
88
|
+
fetch,
|
|
89
|
+
post,
|
|
90
|
+
get,
|
|
91
|
+
put,
|
|
92
|
+
delete: delete_,
|
|
93
|
+
close,
|
|
94
|
+
[Symbol.asyncDispose]: async () => {
|
|
95
|
+
await close();
|
|
96
|
+
},
|
|
97
|
+
};
|
|
98
|
+
}
|
package/dist/webapi.js
CHANGED
|
@@ -4,6 +4,7 @@ export function createFetchHeaders(requestHeaders) {
|
|
|
4
4
|
const headers = new Headers();
|
|
5
5
|
for (const [key, values] of Object.entries(requestHeaders)) {
|
|
6
6
|
if (values) {
|
|
7
|
+
/* c8 ignore next 4 */
|
|
7
8
|
if (Array.isArray(values)) {
|
|
8
9
|
for (const value of values) {
|
|
9
10
|
headers.append(key, value);
|
|
@@ -20,8 +21,10 @@ export function createFetchRequest(req) {
|
|
|
20
21
|
try {
|
|
21
22
|
const origin = `${req.protocol}://${req.get('host')}`;
|
|
22
23
|
// Note: This had to take originalUrl into account for presumably vite's proxying
|
|
24
|
+
/* c8 ignore next 1 */
|
|
23
25
|
const url = new URL(req.originalUrl || req.url, origin);
|
|
24
26
|
const controller = new AbortController();
|
|
27
|
+
/* c8 ignore next 3 */
|
|
25
28
|
req.on('close', () => {
|
|
26
29
|
controller.abort();
|
|
27
30
|
});
|
|
@@ -34,6 +37,7 @@ export function createFetchRequest(req) {
|
|
|
34
37
|
init.body = req.body;
|
|
35
38
|
}
|
|
36
39
|
return new Request(url.href, init);
|
|
40
|
+
/* c8 ignore next 7 */
|
|
37
41
|
}
|
|
38
42
|
catch (error) {
|
|
39
43
|
if (error instanceof TypeError) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@devmoods/express-extras",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.65.0",
|
|
4
4
|
"description": "Kubernetes-ready utilities for rapid Node.js application development",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -12,10 +12,16 @@
|
|
|
12
12
|
"default": "./dist/index.js"
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
|
+
"./config": {
|
|
16
|
+
"import": {
|
|
17
|
+
"types": "./dist/config.d.ts",
|
|
18
|
+
"default": "./dist/config.js"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
15
21
|
"./vite": {
|
|
16
22
|
"import": {
|
|
17
23
|
"types": "./dist/vite/vite.d.ts",
|
|
18
|
-
"default": "./dist/vite.js"
|
|
24
|
+
"default": "./dist/vite/index.js"
|
|
19
25
|
}
|
|
20
26
|
},
|
|
21
27
|
"./vite/ssr": {
|
|
@@ -29,11 +35,21 @@
|
|
|
29
35
|
"types": "./dist/vite/types.d.ts",
|
|
30
36
|
"default": "./dist/vite/types.js"
|
|
31
37
|
}
|
|
38
|
+
},
|
|
39
|
+
"./vitest": {
|
|
40
|
+
"import": {
|
|
41
|
+
"types": "./dist/vitest/index.d.ts",
|
|
42
|
+
"default": "./dist/vitest/index.js"
|
|
43
|
+
}
|
|
32
44
|
}
|
|
33
45
|
},
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
46
|
+
"scripts": {
|
|
47
|
+
"clean": "rm -rf dist",
|
|
48
|
+
"lint": "eslint",
|
|
49
|
+
"test": "NODE_ENV=test DOTENV_CONFIG_PATH=.env.test vitest",
|
|
50
|
+
"test:coverage": "pnpm run test --coverage",
|
|
51
|
+
"build": "pnpm run clean && tsc",
|
|
52
|
+
"prepublishOnly": "pnpm run clean && pnpm run build"
|
|
37
53
|
},
|
|
38
54
|
"repository": {
|
|
39
55
|
"type": "git",
|
|
@@ -44,45 +60,36 @@
|
|
|
44
60
|
],
|
|
45
61
|
"license": "ISC",
|
|
46
62
|
"devDependencies": {
|
|
47
|
-
"@devmoods/eslint-config": "^2.12.0",
|
|
48
63
|
"@types/koa-compose": "^3.2.8",
|
|
49
|
-
"@
|
|
50
|
-
"@types/supertest": "^6.0.3",
|
|
51
|
-
"@vitejs/plugin-react": "^5.0.2",
|
|
52
|
-
"@vitest/coverage-v8": "^3.2.4",
|
|
64
|
+
"@vitejs/plugin-react": "^5.0.3",
|
|
53
65
|
"arktype": "^2.1.22",
|
|
54
|
-
"cookiejar": "^2.1.4",
|
|
55
|
-
"eslint": "^9.35.0",
|
|
56
66
|
"faktory-worker": "^4.7.1",
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"tsx": "^4.20.5",
|
|
61
|
-
"typescript": "5.9.2",
|
|
62
|
-
"vite": "^7.1.5",
|
|
63
|
-
"vitest": "^3.2.4",
|
|
64
|
-
"vitest-fail-on-console": "^0.10.1"
|
|
67
|
+
"react": "^19.1.1",
|
|
68
|
+
"react-dom": "^19.1.1",
|
|
69
|
+
"vite": "^7.1.7"
|
|
65
70
|
},
|
|
66
71
|
"dependencies": {
|
|
72
|
+
"@devmoods/config": "0.1.1",
|
|
67
73
|
"@devmoods/fetch": "^4.2.0",
|
|
68
|
-
"@
|
|
69
|
-
"@
|
|
70
|
-
"@
|
|
74
|
+
"@devmoods/observability": "0.1.1",
|
|
75
|
+
"@devmoods/postgres": "0.1.1",
|
|
76
|
+
"@hey-api/openapi-ts": "^0.84.3",
|
|
77
|
+
"@sentry/node": "^10.15.0",
|
|
78
|
+
"@sentry/node-native": "^10.15.0",
|
|
79
|
+
"@sentry/profiling-node": "^10.15.0",
|
|
71
80
|
"@standard-schema/spec": "^1.0.0",
|
|
72
81
|
"@types/bcrypt": "^6.0.0",
|
|
73
82
|
"@types/cookie-parser": "^1.4.9",
|
|
74
83
|
"@types/express": "^5.0.3",
|
|
75
84
|
"@types/jsonwebtoken": "^9.0.10",
|
|
76
85
|
"@types/nodemailer": "^7.0.1",
|
|
77
|
-
"@types/pg": "^8.15.5",
|
|
78
86
|
"@types/qs": "^6.14.0",
|
|
79
87
|
"@types/superagent": "^8.1.9",
|
|
80
|
-
"@types/uuid": "^10.0.0",
|
|
81
88
|
"ajv": "^8.17.1",
|
|
82
89
|
"argon2": "^0.44.0",
|
|
83
90
|
"bcrypt": "^6.0.0",
|
|
84
91
|
"chalk": "^5.6.2",
|
|
85
|
-
"commander": "^14.0.
|
|
92
|
+
"commander": "^14.0.1",
|
|
86
93
|
"compose-middleware": "^5.0.1",
|
|
87
94
|
"cookie-parser": "^1.4.7",
|
|
88
95
|
"dotenv": "^17.2.2",
|
|
@@ -91,15 +98,11 @@
|
|
|
91
98
|
"helmet": "^8.1.0",
|
|
92
99
|
"jsonwebtoken": "^9.0.2",
|
|
93
100
|
"nodemailer": "^7.0.6",
|
|
94
|
-
"pg": "^8.16.3",
|
|
95
|
-
"pg-structure": "^7.15.3",
|
|
96
101
|
"redis": "^5.8.2",
|
|
97
102
|
"sonda": "^0.9.0",
|
|
98
|
-
"
|
|
99
|
-
"uuid": "^
|
|
100
|
-
|
|
101
|
-
"prettier": {
|
|
102
|
-
"singleQuote": true
|
|
103
|
+
"tough-cookie": "^6.0.0",
|
|
104
|
+
"uuid": "^13.0.0",
|
|
105
|
+
"vitest-fail-on-console": "^0.10.1"
|
|
103
106
|
},
|
|
104
107
|
"peerDependencies": {
|
|
105
108
|
"@vitejs/plugin-react": ">=4.3.4",
|
|
@@ -111,13 +114,5 @@
|
|
|
111
114
|
"engines": {
|
|
112
115
|
"node": ">=20 <25"
|
|
113
116
|
},
|
|
114
|
-
"
|
|
115
|
-
|
|
116
|
-
"start:worker": "pushd example; pnpm run start:worker; popd example;",
|
|
117
|
-
"clean": "rm -rf dist",
|
|
118
|
-
"lint": "eslint",
|
|
119
|
-
"test": "./test.sh",
|
|
120
|
-
"build": "pnpm run clean && tsc --project tsconfig.build.json",
|
|
121
|
-
"format": "prettier --write '**/*.{js,css,md,ts,tsx}'"
|
|
122
|
-
}
|
|
123
|
-
}
|
|
117
|
+
"gitHead": "600a2c41cd71ae45a5fc01058b84eeeb48be63b1"
|
|
118
|
+
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import {} from '../../postgres.js';
|
|
2
|
-
export async function up(query) {
|
|
3
|
-
await query('CREATE TABLE baz (id serial primary key)');
|
|
4
|
-
await query('CREATE TABLE foo (id serial primary key)');
|
|
5
|
-
}
|
|
6
|
-
export async function down(query) {
|
|
7
|
-
await query('DROP TABLE foo');
|
|
8
|
-
await query('DROP TABLE baz');
|
|
9
|
-
}
|
package/dist/migrate.d.ts
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { type Command } from 'commander';
|
|
2
|
-
import { type CLI } from './cli.js';
|
|
3
|
-
import { createPostgres } from './postgres.js';
|
|
4
|
-
interface Migration {
|
|
5
|
-
name: string;
|
|
6
|
-
filename: string;
|
|
7
|
-
version: number;
|
|
8
|
-
}
|
|
9
|
-
interface MigrationFileAPI {
|
|
10
|
-
useTransaction?: boolean;
|
|
11
|
-
up(fn: any): Promise<void> | Promise<void> | string | undefined;
|
|
12
|
-
down(fn: any): Promise<string> | Promise<void> | string | undefined;
|
|
13
|
-
}
|
|
14
|
-
export declare const asCli: (command: Command, cli: CLI) => void;
|
|
15
|
-
export interface MigratorOptions {
|
|
16
|
-
postgres?: ReturnType<typeof createPostgres>;
|
|
17
|
-
migrationTableName?: string;
|
|
18
|
-
verbose?: boolean;
|
|
19
|
-
pathToMigrations?: string;
|
|
20
|
-
}
|
|
21
|
-
export declare class Migrator {
|
|
22
|
-
private postgres;
|
|
23
|
-
private migrationTableName;
|
|
24
|
-
private pathToMigrations;
|
|
25
|
-
private filenameRegExp;
|
|
26
|
-
private verbose;
|
|
27
|
-
constructor({ postgres, pathToMigrations, migrationTableName, verbose, }?: MigratorOptions);
|
|
28
|
-
end(): Promise<void>;
|
|
29
|
-
init(): Promise<boolean>;
|
|
30
|
-
isInstalled(): Promise<boolean>;
|
|
31
|
-
create(name: string | null | undefined, format?: 'ts' | 'sql'): Promise<string>;
|
|
32
|
-
runMigrations(direction: 'up' | 'down'): Promise<number>;
|
|
33
|
-
log(...args: any[]): void;
|
|
34
|
-
executeMigration(migrations: Migration[], currentVersion: number, direction: 'up' | 'down'): Promise<number>;
|
|
35
|
-
readMigrationFile(filename: string): Promise<MigrationFileAPI>;
|
|
36
|
-
migrate(migrator: MigrationFileAPI, direction: 'up' | 'down'): Promise<void>;
|
|
37
|
-
updateCurrentVersion(version: number): Promise<import("pg").QueryResult<import("pg").QueryResultRow>>;
|
|
38
|
-
getCurrentVersion(): Promise<number>;
|
|
39
|
-
getMigrations(): Promise<{
|
|
40
|
-
filename: string;
|
|
41
|
-
version: number;
|
|
42
|
-
name: string;
|
|
43
|
-
}[]>;
|
|
44
|
-
getPreviousMigrations(migrations: Migration[], currentVersion: number): Migration[];
|
|
45
|
-
getPendingMigrations(migrations: Migration[], currentVersion: number): Migration[];
|
|
46
|
-
}
|
|
47
|
-
export {};
|