@rebasepro/server-postgres 0.9.1-canary.fd3754b → 0.10.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 +21 -0
- package/dist/PostgresBackendDriver.d.ts +43 -2
- package/dist/PostgresBootstrapper.d.ts +17 -1
- package/dist/auth/services.d.ts +68 -52
- package/dist/collections/buildRegistry.d.ts +27 -0
- package/dist/connection.d.ts +21 -0
- package/dist/data-transformer.d.ts +9 -2
- package/dist/index.es.js +2711 -2772
- package/dist/index.es.js.map +1 -1
- package/dist/schema/auth-bootstrap-sql.d.ts +1 -1
- package/dist/schema/auth-schema.d.ts +24 -24
- package/dist/schema/doctor.d.ts +1 -1
- package/dist/schema/introspect-db-logic.d.ts +0 -5
- package/dist/schema/introspect-db-naming.d.ts +10 -0
- package/dist/security/policy-drift.d.ts +70 -5
- package/dist/security/rls-enforcement.d.ts +29 -4
- package/dist/services/FetchService.d.ts +4 -24
- package/dist/services/PersistService.d.ts +27 -1
- package/dist/services/RelationService.d.ts +34 -1
- package/dist/services/channel-history.d.ts +118 -0
- package/dist/services/collection-helpers.d.ts +79 -14
- package/dist/services/dataService.d.ts +3 -1
- package/dist/services/index.d.ts +1 -1
- package/dist/services/realtimeService.d.ts +76 -2
- package/dist/services/row-pipeline.d.ts +63 -0
- package/package.json +15 -40
- package/src/PostgresBackendDriver.ts +183 -18
- package/src/PostgresBootstrapper.ts +86 -27
- package/src/auth/ensure-tables.ts +170 -28
- package/src/auth/services.ts +181 -150
- package/src/cli-helpers.ts +2 -20
- package/src/cli.ts +60 -0
- package/src/collections/buildRegistry.ts +59 -0
- package/src/connection.ts +61 -1
- package/src/data-transformer.ts +11 -9
- package/src/databasePoolManager.ts +2 -0
- package/src/schema/auth-bootstrap-sql.ts +7 -1
- package/src/schema/auth-schema.ts +13 -13
- package/src/schema/doctor-cli.ts +5 -1
- package/src/schema/doctor.ts +45 -20
- package/src/schema/generate-drizzle-schema-logic.ts +24 -29
- package/src/schema/generate-postgres-ddl-logic.ts +76 -28
- package/src/schema/introspect-db-inference.ts +1 -1
- package/src/schema/introspect-db-logic.ts +1 -10
- package/src/schema/introspect-db-naming.ts +15 -0
- package/src/schema/introspect-db.ts +19 -2
- package/src/schema/introspect-runtime.ts +1 -1
- package/src/security/policy-drift.test.ts +199 -14
- package/src/security/policy-drift.ts +197 -13
- package/src/security/rls-enforcement.ts +74 -7
- package/src/services/BranchService.ts +42 -10
- package/src/services/FetchService.ts +65 -270
- package/src/services/PersistService.ts +130 -14
- package/src/services/RelationService.ts +153 -94
- package/src/services/channel-history.ts +343 -0
- package/src/services/collection-helpers.ts +164 -47
- package/src/services/dataService.ts +3 -2
- package/src/services/index.ts +1 -0
- package/src/services/realtimeService.ts +238 -29
- package/src/services/row-pipeline.ts +239 -0
- package/src/utils/drizzle-conditions.ts +13 -0
- package/src/websocket.ts +34 -12
- package/dist/chunk-DSJWtz9O.js +0 -40
- package/dist/schema/auth-default-policies.d.ts +0 -10
- package/dist/src-Eh-CZosp.js +0 -595
- package/dist/src-Eh-CZosp.js.map +0 -1
- package/src/schema/auth-default-policies.ts +0 -125
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { PgTable, AnyPgColumn } from "drizzle-orm/pg-core";
|
|
2
2
|
import { CollectionConfig } from "@rebasepro/types";
|
|
3
3
|
import { PostgresCollectionRegistry } from "../collections/PostgresCollectionRegistry";
|
|
4
|
+
export { buildCompositeId, parseIdValues, COMPOSITE_ID_SEPARATOR } from "@rebasepro/common";
|
|
5
|
+
export type { PrimaryKeyInfo } from "@rebasepro/common";
|
|
6
|
+
import type { PrimaryKeyInfo } from "@rebasepro/common";
|
|
4
7
|
/**
|
|
5
8
|
* Shared helper functions for row operations.
|
|
6
9
|
* These are used by FetchService, PersistService, and RelationService.
|
|
@@ -21,18 +24,80 @@ export interface DrizzleColumnMeta {
|
|
|
21
24
|
export declare function getColumnMeta(col: AnyPgColumn): DrizzleColumnMeta;
|
|
22
25
|
export declare function getCollectionByPath(collectionPath: string, registry: PostgresCollectionRegistry): CollectionConfig;
|
|
23
26
|
export declare function getTableForCollection(collection: CollectionConfig, registry: PostgresCollectionRegistry): PgTable<any>;
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
/**
|
|
28
|
+
* The key columns a collection's rows are addressed by.
|
|
29
|
+
*
|
|
30
|
+
* Three tiers, in order: properties marked `isId`, the primary keys of the
|
|
31
|
+
* drizzle schema, and finally a column literally named `id`. Only the first is
|
|
32
|
+
* visible to the browser, which is why a key known only to drizzle is reported
|
|
33
|
+
* at boot — see {@link warnOnKeysTheAdminCannotResolve}.
|
|
34
|
+
*
|
|
35
|
+
* Returns `[]` when nothing resolves, rather than throwing. It used to open by
|
|
36
|
+
* resolving the table, which throws when there is none — so the `isId` tier,
|
|
37
|
+
* which needs no table at all, was unreachable for exactly the collections
|
|
38
|
+
* most likely to have no table registered. Every caller that wanted "no keys"
|
|
39
|
+
* to mean "no keys" had to spell that out in a try/catch.
|
|
40
|
+
*
|
|
41
|
+
* Callers that cannot proceed without a key must say so themselves, naming the
|
|
42
|
+
* collection: an empty array here means "this collection has no address", which
|
|
43
|
+
* is a different answer in a notification (broadcast a wildcard) than in a save
|
|
44
|
+
* (fail).
|
|
45
|
+
*/
|
|
46
|
+
export declare function getPrimaryKeys(collection: CollectionConfig, registry: PostgresCollectionRegistry): PrimaryKeyInfo[];
|
|
47
|
+
/**
|
|
48
|
+
* The key columns, for callers that cannot do their job without one.
|
|
49
|
+
*
|
|
50
|
+
* {@link getPrimaryKeys} answers "what keys, if any" and returns `[]` for a
|
|
51
|
+
* collection with no address. Most of this driver, though, is building a WHERE
|
|
52
|
+
* clause and has no meaning without a key — for those, an empty array is not an
|
|
53
|
+
* answer, and indexing `[0]` into it produces `Cannot read properties of
|
|
54
|
+
* undefined` three frames from where the real problem is. This says what is
|
|
55
|
+
* wrong and which collection it is wrong about.
|
|
56
|
+
*/
|
|
57
|
+
export declare function requirePrimaryKeys(collection: CollectionConfig, registry: PostgresCollectionRegistry): PrimaryKeyInfo[];
|
|
58
|
+
/**
|
|
59
|
+
* Collections whose key the *browser* cannot resolve, and what it will do
|
|
60
|
+
* instead.
|
|
61
|
+
*
|
|
62
|
+
* The two sides resolve keys from different evidence. This driver reads, in
|
|
63
|
+
* order: properties marked `isId`, the primary keys of the Drizzle schema, then
|
|
64
|
+
* a column literally named `id`. The admin shares the `CollectionConfig` — it
|
|
65
|
+
* compiles the same collection files into its bundle — but never the Drizzle
|
|
66
|
+
* schema, so the middle tier is invisible to it.
|
|
67
|
+
*
|
|
68
|
+
* Nothing can normalize this at runtime: the server does not serve the admin
|
|
69
|
+
* its collections, so a key resolved here cannot be handed over there. The
|
|
70
|
+
* config files are the only thing both sides read, so the fix is an edit to
|
|
71
|
+
* them, and the most this can do is say exactly which edit.
|
|
72
|
+
*
|
|
73
|
+
* Two shapes, and the second is the dangerous one:
|
|
74
|
+
*
|
|
75
|
+
* - No `isId`, no `id` property → the admin resolves no address, warns in the
|
|
76
|
+
* console, and rows cannot be opened or linked.
|
|
77
|
+
* - No `isId`, but an `id` property that is *not* the key → the admin addresses
|
|
78
|
+
* rows by `id` while this driver reads the address as the real key. Nothing
|
|
79
|
+
* errors: the addresses look right and route wrong.
|
|
80
|
+
*/
|
|
81
|
+
export declare function findUnresolvableKeyCollections(collections: CollectionConfig[], registry: PostgresCollectionRegistry): {
|
|
82
|
+
collection: CollectionConfig;
|
|
83
|
+
keys: PrimaryKeyInfo[];
|
|
84
|
+
shadowedByIdProperty: boolean;
|
|
28
85
|
}[];
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
86
|
+
/**
|
|
87
|
+
* Report the collections from {@link findUnresolvableKeyCollections} at boot,
|
|
88
|
+
* with the edit that fixes each one.
|
|
89
|
+
*
|
|
90
|
+
* Grouped by failure, not by collection: the shadowed case is a routing bug and
|
|
91
|
+
* the silent case is a missing feature, and they deserve different urgency.
|
|
92
|
+
*/
|
|
93
|
+
export declare function warnOnKeysTheAdminCannotResolve(collections: CollectionConfig[], registry: PostgresCollectionRegistry): void;
|
|
94
|
+
/**
|
|
95
|
+
* The address of a row: derived from the collection's primary keys, because a
|
|
96
|
+
* row does not carry one — it is exactly its columns.
|
|
97
|
+
*
|
|
98
|
+
* Falls back to a literal `id` column, for a row that reached us from somewhere
|
|
99
|
+
* other than this driver. Returns `""` when there is no key and no `id` —
|
|
100
|
+
* callers decide what that means, since "unaddressable" is a different answer
|
|
101
|
+
* in a notification (broadcast a wildcard) than in a save (fail).
|
|
102
|
+
*/
|
|
103
|
+
export declare function deriveRowAddress(row: Record<string, unknown>, collection: CollectionConfig, registry: PostgresCollectionRegistry): string;
|
|
@@ -82,7 +82,9 @@ export declare class DataService implements DataRepository {
|
|
|
82
82
|
/**
|
|
83
83
|
* Save an row (create or update)
|
|
84
84
|
*/
|
|
85
|
-
save<M extends Record<string, unknown>>(collectionPath: string, values: Partial<M>, id?: string | number, databaseId?: string
|
|
85
|
+
save<M extends Record<string, unknown>>(collectionPath: string, values: Partial<M>, id?: string | number, databaseId?: string, options?: {
|
|
86
|
+
upsert?: boolean;
|
|
87
|
+
}): Promise<Record<string, unknown>>;
|
|
86
88
|
/**
|
|
87
89
|
* Delete an row by ID
|
|
88
90
|
*/
|
package/dist/services/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { FetchService } from "./FetchService";
|
|
2
2
|
export { PersistService } from "./PersistService";
|
|
3
3
|
export { RelationService } from "./RelationService";
|
|
4
|
-
export { getCollectionByPath, getTableForCollection, getPrimaryKeys, parseIdValues, buildCompositeId } from "./collection-helpers";
|
|
4
|
+
export { getCollectionByPath, getTableForCollection, getPrimaryKeys, deriveRowAddress, parseIdValues, buildCompositeId } from "./collection-helpers";
|
|
@@ -4,12 +4,13 @@ import { DataDriver, WebSocketMessage } from "@rebasepro/types";
|
|
|
4
4
|
import { NodePgDatabase } from "drizzle-orm/node-postgres";
|
|
5
5
|
import { RealtimeProvider, CollectionSubscriptionConfig, SingleSubscriptionConfig } from "../interfaces";
|
|
6
6
|
import { PostgresCollectionRegistry } from "../collections/PostgresCollectionRegistry";
|
|
7
|
+
import type { ChannelRetentionRule } from "@rebasepro/types";
|
|
7
8
|
/**
|
|
8
9
|
* Auth context stored per-subscription so real-time refetches respect RLS.
|
|
9
10
|
* Mirrors the session variables set by PostgresBackendDriver.withAuth().
|
|
10
11
|
*/
|
|
11
12
|
export interface SubscriptionAuthContext {
|
|
12
|
-
|
|
13
|
+
uid: string;
|
|
13
14
|
roles: string[];
|
|
14
15
|
}
|
|
15
16
|
/**
|
|
@@ -24,6 +25,26 @@ export declare class RealtimeService extends EventEmitter implements RealtimePro
|
|
|
24
25
|
private clients;
|
|
25
26
|
private channels;
|
|
26
27
|
private presence;
|
|
28
|
+
/**
|
|
29
|
+
* Ordered, replayable history for channels that opt into it.
|
|
30
|
+
*
|
|
31
|
+
* Undefined until {@link configureChannelHistory} is called, and inert even
|
|
32
|
+
* then unless retention rules were supplied — so presence and ephemeral
|
|
33
|
+
* notification channels never touch it. See `channel-history.ts`.
|
|
34
|
+
*/
|
|
35
|
+
private channelHistory?;
|
|
36
|
+
/**
|
|
37
|
+
* One promise chain per retained channel, so that assigning a sequence
|
|
38
|
+
* number and fanning the message out happen in the same order for every
|
|
39
|
+
* message on that channel.
|
|
40
|
+
*
|
|
41
|
+
* Without it, two concurrent broadcasts can be numbered 4 and 5 by the
|
|
42
|
+
* database and still reach subscribers as 5 then 4 — live order and replay
|
|
43
|
+
* order would disagree, which is exactly the divergence sequence numbers
|
|
44
|
+
* are supposed to rule out. Keyed by channel, so unrelated channels never
|
|
45
|
+
* wait on each other.
|
|
46
|
+
*/
|
|
47
|
+
private channelSendQueues;
|
|
27
48
|
private presenceInterval?;
|
|
28
49
|
private static readonly PRESENCE_TIMEOUT_MS;
|
|
29
50
|
private dataService;
|
|
@@ -177,8 +198,15 @@ export declare class RealtimeService extends EventEmitter implements RealtimePro
|
|
|
177
198
|
/**
|
|
178
199
|
* Send a lightweight row-level patch to a collection subscriber.
|
|
179
200
|
* The client can merge this into its cached data for instant feedback.
|
|
201
|
+
*
|
|
202
|
+
* The key columns ride along: the patch names a row by address, and the
|
|
203
|
+
* client has to find that row among the ones it cached — which carry
|
|
204
|
+
* columns and no address. The SDK holds no collection config to derive one
|
|
205
|
+
* from, so this is the only place the mapping can come from.
|
|
180
206
|
*/
|
|
181
207
|
private sendCollectionPatch;
|
|
208
|
+
/** The key columns of the collection at `path`, if they can be resolved. */
|
|
209
|
+
private primaryKeysForPath;
|
|
182
210
|
private sendError;
|
|
183
211
|
private sendMessage;
|
|
184
212
|
/**
|
|
@@ -190,8 +218,54 @@ export declare class RealtimeService extends EventEmitter implements RealtimePro
|
|
|
190
218
|
joinChannel(clientId: string, channel: string): void;
|
|
191
219
|
/** Leave a broadcast channel */
|
|
192
220
|
leaveChannel(clientId: string, channel: string): void;
|
|
193
|
-
/**
|
|
221
|
+
/**
|
|
222
|
+
* Broadcast a message to all clients in a channel except the sender.
|
|
223
|
+
*
|
|
224
|
+
* On a channel with no retention rule this is what it always was: a
|
|
225
|
+
* synchronous fan-out to whoever is connected, with no sequence number, no
|
|
226
|
+
* SQL and no await — the body below runs to completion before returning.
|
|
227
|
+
*
|
|
228
|
+
* On a retained channel the message is durably numbered first and only then
|
|
229
|
+
* delivered, through a per-channel queue so that delivery order matches
|
|
230
|
+
* sequence order. That ordering is the whole point: a client that catches up
|
|
231
|
+
* with `sinceSeq` has to arrive at the same state as one that never
|
|
232
|
+
* disconnected.
|
|
233
|
+
*/
|
|
194
234
|
broadcastToChannel(clientId: string, channel: string, event: string, payload: unknown): void;
|
|
235
|
+
/**
|
|
236
|
+
* Number a broadcast, store it, then deliver it.
|
|
237
|
+
*
|
|
238
|
+
* A message that cannot be stored is **not** delivered. Delivering it would
|
|
239
|
+
* put it in front of live subscribers while leaving it absent from every
|
|
240
|
+
* future replay — the two views of the channel would disagree permanently,
|
|
241
|
+
* and no later message could repair the gap. Failing loudly to the sender
|
|
242
|
+
* instead lets it retry, which for an operation stream is the only outcome
|
|
243
|
+
* that keeps clients convergent.
|
|
244
|
+
*/
|
|
245
|
+
private persistAndFanOut;
|
|
246
|
+
/** Deliver a broadcast frame to every member of a channel but the sender. */
|
|
247
|
+
private fanOutBroadcast;
|
|
248
|
+
/**
|
|
249
|
+
* Install retention rules and create the tables they need.
|
|
250
|
+
*
|
|
251
|
+
* Safe to call with no rules (and safe not to call at all): the store stays
|
|
252
|
+
* inert, no schema is created, and broadcast keeps its original
|
|
253
|
+
* fire-and-forget path.
|
|
254
|
+
*/
|
|
255
|
+
configureChannelHistory(rules: ChannelRetentionRule[] | undefined): Promise<void>;
|
|
256
|
+
/** Whether any channel is configured to retain messages. */
|
|
257
|
+
isChannelHistoryEnabled(): boolean;
|
|
258
|
+
/**
|
|
259
|
+
* Answer a client's catch-up request.
|
|
260
|
+
*
|
|
261
|
+
* A channel with no retention rule is answered with `retained: false`
|
|
262
|
+
* rather than an empty list, so the client can tell "you missed nothing"
|
|
263
|
+
* apart from "this channel never keeps anything" — the second means its
|
|
264
|
+
* reconnect strategy has to be a full resync, and silence would leave it
|
|
265
|
+
* guessing.
|
|
266
|
+
*/
|
|
267
|
+
private handleChannelHistoryRequest;
|
|
268
|
+
private sendChannelHistory;
|
|
195
269
|
/** Track presence in a channel */
|
|
196
270
|
trackPresence(clientId: string, channel: string, state: Record<string, unknown>): void;
|
|
197
271
|
/** Remove presence from a channel */
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { CollectionConfig, Relation } from "@rebasepro/types";
|
|
2
|
+
import { PostgresCollectionRegistry } from "../collections/PostgresCollectionRegistry";
|
|
3
|
+
/**
|
|
4
|
+
* Turning a drizzle result into a row we serve.
|
|
5
|
+
*
|
|
6
|
+
* There are two shapes, and they are the same walk. Both take a row whose
|
|
7
|
+
* relation fields hold nested objects, both unwrap junction rows to reach the
|
|
8
|
+
* target behind them, and both leave every other column alone. They differ only
|
|
9
|
+
* in what they put where the relation was:
|
|
10
|
+
*
|
|
11
|
+
* - `"ref"` — a `{ id, path, __type: "relation" }` reference carrying the
|
|
12
|
+
* target's values. This is what the admin renders.
|
|
13
|
+
* - `"inline"` — the target's own columns, flat. This is what REST serves.
|
|
14
|
+
*
|
|
15
|
+
* They used to be two functions that happened to agree, and the agreement was
|
|
16
|
+
* not enforced by anything: the row-identity bug had to be fixed five times
|
|
17
|
+
* across differently-shaped copies of this walk, and one of the copies was
|
|
18
|
+
* dead code nobody had noticed. Whatever the next cross-cutting change is, it
|
|
19
|
+
* is one edit here.
|
|
20
|
+
*/
|
|
21
|
+
export type RelationStyle = "ref" | "inline";
|
|
22
|
+
/**
|
|
23
|
+
* Whether a many-relation reaches its target through a junction table.
|
|
24
|
+
*
|
|
25
|
+
* Also used to build the drizzle `with` config, which is why it is exported:
|
|
26
|
+
* the query has to nest one level deeper for a junction, and the row walk has
|
|
27
|
+
* to unwrap that same level back out.
|
|
28
|
+
*/
|
|
29
|
+
export declare function isJunctionRelation(relation: Relation): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* The address a relation ref points at.
|
|
32
|
+
*
|
|
33
|
+
* The whole key, not its first column: a composite-keyed target addressed by
|
|
34
|
+
* `tenant_id` alone points at every row that shares it. A target whose key
|
|
35
|
+
* cannot be resolved at all used to throw here — reading `[0]` of an empty
|
|
36
|
+
* array — taking down the parent's fetch over a relation it may not even have
|
|
37
|
+
* asked for. The first column is a guess, but a ref that resolves to nothing
|
|
38
|
+
* beats no rows at all.
|
|
39
|
+
*/
|
|
40
|
+
export declare function relationTargetAddress(targetRow: Record<string, unknown>, targetCollection: CollectionConfig, registry: PostgresCollectionRegistry): string;
|
|
41
|
+
/**
|
|
42
|
+
* The row the admin renders: every column, with relations as references.
|
|
43
|
+
*
|
|
44
|
+
* Values are normalized (dates, numbers, NaN) because the admin's view-model
|
|
45
|
+
* expects real types. The row's own address is *not* among the columns — it is
|
|
46
|
+
* derived by the consumer from the collection's primary keys.
|
|
47
|
+
*/
|
|
48
|
+
export declare function toCmsRow(row: Record<string, unknown>, collection: CollectionConfig, registry: PostgresCollectionRegistry): Record<string, unknown>;
|
|
49
|
+
/**
|
|
50
|
+
* The row REST serves: every column under its own name, with the value Postgres
|
|
51
|
+
* returned, and relations inlined as the target's columns.
|
|
52
|
+
*
|
|
53
|
+
* Values are the ones the database returned, except where that contradicts the
|
|
54
|
+
* declared type: a `number` property is served as a number (see
|
|
55
|
+
* {@link coerceDeclaredNumber}). Dates stay as the database returned them —
|
|
56
|
+
* JSON has its own opinions about dates that the admin's view-model does not
|
|
57
|
+
* share.
|
|
58
|
+
*
|
|
59
|
+
* Keyed by the row rather than by the relation list — a REST fetch only loads
|
|
60
|
+
* the relations `include` asked for, so the row is the authority on which are
|
|
61
|
+
* actually there.
|
|
62
|
+
*/
|
|
63
|
+
export declare function toRestRow(row: Record<string, unknown>, collection: CollectionConfig, registry: PostgresCollectionRegistry): Record<string, unknown>;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rebasepro/server-postgres",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.10.0",
|
|
5
5
|
"description": "PostgreSQL data source backend implementation for Rebase with Drizzle ORM",
|
|
6
6
|
"funding": {
|
|
7
7
|
"url": "https://github.com/sponsors/rebaseco"
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"url": "https://github.com/rebasepro/rebase.git",
|
|
14
14
|
"directory": "packages/server-postgres"
|
|
15
15
|
},
|
|
16
|
-
"main": "./dist/index.
|
|
16
|
+
"main": "./dist/index.es.js",
|
|
17
17
|
"module": "./dist/index.es.js",
|
|
18
18
|
"types": "./dist/index.d.ts",
|
|
19
19
|
"source": "src/index.ts",
|
|
@@ -29,39 +29,11 @@
|
|
|
29
29
|
"backend",
|
|
30
30
|
"rebase"
|
|
31
31
|
],
|
|
32
|
-
"jest": {
|
|
33
|
-
"transform": {
|
|
34
|
-
"^.+\\.tsx?$": "ts-jest"
|
|
35
|
-
},
|
|
36
|
-
"testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.tsx?$",
|
|
37
|
-
"testPathIgnorePatterns": [
|
|
38
|
-
"/node_modules/",
|
|
39
|
-
"test/e2e/"
|
|
40
|
-
],
|
|
41
|
-
"moduleFileExtensions": [
|
|
42
|
-
"ts",
|
|
43
|
-
"tsx",
|
|
44
|
-
"js",
|
|
45
|
-
"jsx",
|
|
46
|
-
"json",
|
|
47
|
-
"node"
|
|
48
|
-
],
|
|
49
|
-
"moduleNameMapper": {
|
|
50
|
-
"^chalk$": "<rootDir>/test/mocks/chalk.cjs",
|
|
51
|
-
"^@rebasepro/client$": "<rootDir>/../client/src/index.ts",
|
|
52
|
-
"^@rebasepro/common$": "<rootDir>/../common/src/index.ts",
|
|
53
|
-
"^@rebasepro/types$": "<rootDir>/../types/src/index.ts",
|
|
54
|
-
"^@rebasepro/utils$": "<rootDir>/../utils/src/index.ts",
|
|
55
|
-
"^@rebasepro/server$": "<rootDir>/../server/src/index.ts",
|
|
56
|
-
"^(\\.{1,2}/.*)\\.js$": "$1"
|
|
57
|
-
}
|
|
58
|
-
},
|
|
59
32
|
"exports": {
|
|
60
33
|
".": {
|
|
61
34
|
"types": "./dist/index.d.ts",
|
|
62
35
|
"development": "./dist/index.es.js",
|
|
63
|
-
"import": "./dist/index.es.js"
|
|
64
|
-
"require": "./dist/index.umd.js"
|
|
36
|
+
"import": "./dist/index.es.js"
|
|
65
37
|
},
|
|
66
38
|
"./package.json": "./package.json"
|
|
67
39
|
},
|
|
@@ -73,21 +45,23 @@
|
|
|
73
45
|
"dotenv": "^17.4.2",
|
|
74
46
|
"drizzle-orm": "^0.45.2",
|
|
75
47
|
"execa": "^9.6.1",
|
|
76
|
-
"hono": "^4.12.25",
|
|
77
48
|
"pg": "^8.21.0",
|
|
78
49
|
"ws": "^8.21.0",
|
|
79
|
-
"@rebasepro/
|
|
80
|
-
"@rebasepro/
|
|
81
|
-
"@rebasepro/
|
|
82
|
-
"@rebasepro/
|
|
83
|
-
"@rebasepro/
|
|
50
|
+
"@rebasepro/codegen": "0.10.0",
|
|
51
|
+
"@rebasepro/common": "0.10.0",
|
|
52
|
+
"@rebasepro/types": "0.10.0",
|
|
53
|
+
"@rebasepro/utils": "0.10.0",
|
|
54
|
+
"@rebasepro/server": "0.10.0"
|
|
84
55
|
},
|
|
85
56
|
"devDependencies": {
|
|
57
|
+
"@hono/node-server": "^2.0.9",
|
|
58
|
+
"@jest/globals": "^30.4.1",
|
|
86
59
|
"@types/jest": "^30.0.0",
|
|
87
60
|
"@types/node": "^25.9.3",
|
|
88
61
|
"@types/pg": "^8.20.0",
|
|
89
62
|
"@types/ws": "^8.18.1",
|
|
90
63
|
"@vitejs/plugin-react": "^6.0.2",
|
|
64
|
+
"hono": "^4.12.25",
|
|
91
65
|
"jest": "^30.4.2",
|
|
92
66
|
"ts-jest": "^29.4.11",
|
|
93
67
|
"typescript": "^6.0.3",
|
|
@@ -104,10 +78,11 @@
|
|
|
104
78
|
],
|
|
105
79
|
"scripts": {
|
|
106
80
|
"watch": "vite build --watch",
|
|
107
|
-
"build": "vite build && tsc --emitDeclarationOnly -p tsconfig.prod.json",
|
|
81
|
+
"build": "vite build && tsc --emitDeclarationOnly -p tsconfig.prod.json && node ../../scripts/assert-build-output.mjs",
|
|
108
82
|
"test:lint": "eslint \"src/**\" --quiet",
|
|
109
|
-
"test": "jest
|
|
83
|
+
"test": "jest",
|
|
110
84
|
"test:e2e": "vitest run --config vitest.e2e.config.ts",
|
|
111
|
-
"clean": "rm -rf dist && find ./src -name '*.js' -type f | xargs rm -f"
|
|
85
|
+
"clean": "rm -rf dist && find ./src -name '*.js' -type f | xargs rm -f",
|
|
86
|
+
"smoke:baas": "tsx scripts/smoke-baas.ts"
|
|
112
87
|
}
|
|
113
88
|
}
|