@openora/core 0.4.1-canary.27 → 0.4.1-canary.30
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/dist/.tsbuildinfo +1 -1
- package/dist/audit/plugin.d.ts.map +1 -1
- package/dist/audit/plugin.js +58 -0
- package/dist/audit/plugin.js.map +1 -1
- package/dist/contracts/adapters/rate-limit.d.ts +2 -0
- package/dist/contracts/adapters/rate-limit.d.ts.map +1 -1
- package/dist/contracts/adapters/rate-limit.js +2 -0
- package/dist/contracts/adapters/rate-limit.js.map +1 -1
- package/dist/contracts/adapters/realtime.d.ts +4 -3
- package/dist/contracts/adapters/realtime.d.ts.map +1 -1
- package/dist/contracts/adapters/realtime.js.map +1 -1
- package/dist/contracts/schemas/events.d.ts +52 -0
- package/dist/contracts/schemas/events.d.ts.map +1 -1
- package/dist/contracts/schemas/events.js +33 -0
- package/dist/contracts/schemas/events.js.map +1 -1
- package/dist/engagement/chat/__tests__/chat.service.test.js +266 -5
- package/dist/engagement/chat/__tests__/chat.service.test.js.map +1 -1
- package/dist/engagement/chat/contract/constants.d.ts +11 -0
- package/dist/engagement/chat/contract/constants.d.ts.map +1 -0
- package/dist/engagement/chat/contract/constants.js +11 -0
- package/dist/engagement/chat/contract/constants.js.map +1 -0
- package/dist/engagement/chat/contract/index.d.ts +223 -2
- package/dist/engagement/chat/contract/index.d.ts.map +1 -1
- package/dist/engagement/chat/contract/index.js +104 -7
- package/dist/engagement/chat/contract/index.js.map +1 -1
- package/dist/engagement/chat/drizzle/migrations/0001_cloudy_groot.sql +32 -0
- package/dist/engagement/chat/drizzle/migrations/meta/0001_snapshot.json +557 -0
- package/dist/engagement/chat/drizzle/migrations/meta/_journal.json +7 -0
- package/dist/engagement/chat/index.d.ts +1 -2
- package/dist/engagement/chat/index.d.ts.map +1 -1
- package/dist/engagement/chat/index.js +1 -2
- package/dist/engagement/chat/index.js.map +1 -1
- package/dist/engagement/chat/plugin.d.ts.map +1 -1
- package/dist/engagement/chat/plugin.js +8 -3
- package/dist/engagement/chat/plugin.js.map +1 -1
- package/dist/engagement/chat/react/use-join-room.d.ts +13 -0
- package/dist/engagement/chat/react/use-join-room.d.ts.map +1 -0
- package/dist/engagement/chat/react/use-join-room.js +25 -0
- package/dist/engagement/chat/react/use-join-room.js.map +1 -0
- package/dist/engagement/chat/router/index.d.ts +184 -4
- package/dist/engagement/chat/router/index.d.ts.map +1 -1
- package/dist/engagement/chat/router/index.js +105 -20
- package/dist/engagement/chat/router/index.js.map +1 -1
- package/dist/engagement/chat/schema/index.d.ts +256 -0
- package/dist/engagement/chat/schema/index.d.ts.map +1 -1
- package/dist/engagement/chat/schema/index.js +40 -2
- package/dist/engagement/chat/schema/index.js.map +1 -1
- package/dist/engagement/chat/service/chat.service.d.ts +151 -4
- package/dist/engagement/chat/service/chat.service.d.ts.map +1 -1
- package/dist/engagement/chat/service/chat.service.js +391 -16
- package/dist/engagement/chat/service/chat.service.js.map +1 -1
- package/dist/engagement/react.d.ts +1 -0
- package/dist/engagement/react.d.ts.map +1 -1
- package/dist/engagement/react.js +1 -0
- package/dist/engagement/react.js.map +1 -1
- package/dist/iam/service/iam.service.d.ts +1 -1
- package/dist/react/context/realtime-client.d.ts +1 -0
- package/dist/react/context/realtime-client.d.ts.map +1 -1
- package/dist/react/context/realtime-client.js.map +1 -1
- package/dist/server/auth/permissions.d.ts +12 -0
- package/dist/server/auth/permissions.d.ts.map +1 -1
- package/dist/server/auth/permissions.js +2 -0
- package/dist/server/auth/permissions.js.map +1 -1
- package/dist/server/db/__tests__/migrate.test.d.ts +2 -0
- package/dist/server/db/__tests__/migrate.test.d.ts.map +1 -0
- package/dist/server/db/__tests__/migrate.test.js +50 -0
- package/dist/server/db/__tests__/migrate.test.js.map +1 -0
- package/dist/server/db/migrate.d.ts +14 -0
- package/dist/server/db/migrate.d.ts.map +1 -1
- package/dist/server/db/migrate.js +70 -12
- package/dist/server/db/migrate.js.map +1 -1
- package/dist/server/kernel/index.d.ts +2 -0
- package/dist/server/kernel/index.d.ts.map +1 -1
- package/dist/server/kernel/index.js +2 -0
- package/dist/server/kernel/index.js.map +1 -1
- package/dist/server/kernel/realtime-authorizer.d.ts +8 -0
- package/dist/server/kernel/realtime-authorizer.d.ts.map +1 -0
- package/dist/server/kernel/realtime-authorizer.js +11 -0
- package/dist/server/kernel/realtime-authorizer.js.map +1 -0
- package/dist/server/kernel/realtime-transport.d.ts +9 -0
- package/dist/server/kernel/realtime-transport.d.ts.map +1 -0
- package/dist/server/kernel/realtime-transport.js +63 -0
- package/dist/server/kernel/realtime-transport.js.map +1 -0
- package/dist/server/plugin-host/core-plugins.d.ts +16 -0
- package/dist/server/plugin-host/core-plugins.d.ts.map +1 -0
- package/dist/server/plugin-host/core-plugins.js +36 -0
- package/dist/server/plugin-host/core-plugins.js.map +1 -0
- package/dist/server/plugin-host/index.d.ts +1 -0
- package/dist/server/plugin-host/index.d.ts.map +1 -1
- package/dist/server/plugin-host/index.js +1 -0
- package/dist/server/plugin-host/index.js.map +1 -1
- package/dist/server/runtime/assert-durable-seams.d.ts +3 -2
- package/dist/server/runtime/assert-durable-seams.d.ts.map +1 -1
- package/dist/server/runtime/assert-durable-seams.js.map +1 -1
- package/dist/server/runtime/create-app.d.ts +1 -2
- package/dist/server/runtime/create-app.d.ts.map +1 -1
- package/dist/server/runtime/create-app.js +5 -4
- package/dist/server/runtime/create-app.js.map +1 -1
- package/dist/testing/fakes/__tests__/realtime-transport.test.js +6 -4
- package/dist/testing/fakes/__tests__/realtime-transport.test.js.map +1 -1
- package/dist/testing/fakes/realtime-transport.d.ts +1 -7
- package/dist/testing/fakes/realtime-transport.d.ts.map +1 -1
- package/dist/testing/fakes/realtime-transport.js +1 -58
- package/dist/testing/fakes/realtime-transport.js.map +1 -1
- package/package.json +1 -1
|
@@ -16,6 +16,7 @@ export declare const statement: {
|
|
|
16
16
|
readonly sessions: readonly ["view", "revoke"];
|
|
17
17
|
readonly 'player-note': readonly ["view", "create"];
|
|
18
18
|
readonly 'tag-rule': readonly ["view", "update"];
|
|
19
|
+
readonly 'chat-room': readonly ["view", "create", "update", "delete"];
|
|
19
20
|
};
|
|
20
21
|
export declare const ac: {
|
|
21
22
|
newRole<const TRoleStatements extends import("better-auth/plugins/access").Statements>(statements: import("better-auth/plugins/access").RoleInput<{
|
|
@@ -36,6 +37,7 @@ export declare const ac: {
|
|
|
36
37
|
readonly sessions: readonly ["view", "revoke"];
|
|
37
38
|
readonly 'player-note': readonly ["view", "create"];
|
|
38
39
|
readonly 'tag-rule': readonly ["view", "update"];
|
|
40
|
+
readonly 'chat-room': readonly ["view", "create", "update", "delete"];
|
|
39
41
|
}, TRoleStatements>): import("better-auth/plugins/access").Role<import("better-auth/plugins/access").ExactRoleStatements<TRoleStatements>, {
|
|
40
42
|
readonly player: readonly ["view", "update", "ban", "adjust-balance"];
|
|
41
43
|
readonly transaction: readonly ["view", "refund"];
|
|
@@ -54,6 +56,7 @@ export declare const ac: {
|
|
|
54
56
|
readonly sessions: readonly ["view", "revoke"];
|
|
55
57
|
readonly 'player-note': readonly ["view", "create"];
|
|
56
58
|
readonly 'tag-rule': readonly ["view", "update"];
|
|
59
|
+
readonly 'chat-room': readonly ["view", "create", "update", "delete"];
|
|
57
60
|
}>;
|
|
58
61
|
statements: {
|
|
59
62
|
readonly player: readonly ["view", "update", "ban", "adjust-balance"];
|
|
@@ -73,6 +76,7 @@ export declare const ac: {
|
|
|
73
76
|
readonly sessions: readonly ["view", "revoke"];
|
|
74
77
|
readonly 'player-note': readonly ["view", "create"];
|
|
75
78
|
readonly 'tag-rule': readonly ["view", "update"];
|
|
79
|
+
readonly 'chat-room': readonly ["view", "create", "update", "delete"];
|
|
76
80
|
};
|
|
77
81
|
};
|
|
78
82
|
export declare const adminRole: import("better-auth/plugins/access").Role<import("better-auth/plugins/access").ExactRoleStatements<{
|
|
@@ -93,6 +97,7 @@ export declare const adminRole: import("better-auth/plugins/access").Role<import
|
|
|
93
97
|
readonly sessions: ["view", "revoke"];
|
|
94
98
|
readonly 'player-note': ["view", "create"];
|
|
95
99
|
readonly 'tag-rule': ["view", "update"];
|
|
100
|
+
readonly 'chat-room': ["view", "create", "update", "delete"];
|
|
96
101
|
}>, {
|
|
97
102
|
readonly player: readonly ["view", "update", "ban", "adjust-balance"];
|
|
98
103
|
readonly transaction: readonly ["view", "refund"];
|
|
@@ -111,6 +116,7 @@ export declare const adminRole: import("better-auth/plugins/access").Role<import
|
|
|
111
116
|
readonly sessions: readonly ["view", "revoke"];
|
|
112
117
|
readonly 'player-note': readonly ["view", "create"];
|
|
113
118
|
readonly 'tag-rule': readonly ["view", "update"];
|
|
119
|
+
readonly 'chat-room': readonly ["view", "create", "update", "delete"];
|
|
114
120
|
}>;
|
|
115
121
|
export declare const supportRole: import("better-auth/plugins/access").Role<import("better-auth/plugins/access").ExactRoleStatements<{
|
|
116
122
|
readonly player: ["view", "update"];
|
|
@@ -136,6 +142,7 @@ export declare const supportRole: import("better-auth/plugins/access").Role<impo
|
|
|
136
142
|
readonly sessions: readonly ["view", "revoke"];
|
|
137
143
|
readonly 'player-note': readonly ["view", "create"];
|
|
138
144
|
readonly 'tag-rule': readonly ["view", "update"];
|
|
145
|
+
readonly 'chat-room': readonly ["view", "create", "update", "delete"];
|
|
139
146
|
}>;
|
|
140
147
|
export declare const contentManagerRole: import("better-auth/plugins/access").Role<import("better-auth/plugins/access").ExactRoleStatements<{
|
|
141
148
|
readonly content: ["create", "update", "delete", "publish"];
|
|
@@ -158,6 +165,7 @@ export declare const contentManagerRole: import("better-auth/plugins/access").Ro
|
|
|
158
165
|
readonly sessions: readonly ["view", "revoke"];
|
|
159
166
|
readonly 'player-note': readonly ["view", "create"];
|
|
160
167
|
readonly 'tag-rule': readonly ["view", "update"];
|
|
168
|
+
readonly 'chat-room': readonly ["view", "create", "update", "delete"];
|
|
161
169
|
}>;
|
|
162
170
|
export declare const roles: {
|
|
163
171
|
readonly admin: import("better-auth/plugins/access").Role<import("better-auth/plugins/access").ExactRoleStatements<{
|
|
@@ -178,6 +186,7 @@ export declare const roles: {
|
|
|
178
186
|
readonly sessions: ["view", "revoke"];
|
|
179
187
|
readonly 'player-note': ["view", "create"];
|
|
180
188
|
readonly 'tag-rule': ["view", "update"];
|
|
189
|
+
readonly 'chat-room': ["view", "create", "update", "delete"];
|
|
181
190
|
}>, {
|
|
182
191
|
readonly player: readonly ["view", "update", "ban", "adjust-balance"];
|
|
183
192
|
readonly transaction: readonly ["view", "refund"];
|
|
@@ -196,6 +205,7 @@ export declare const roles: {
|
|
|
196
205
|
readonly sessions: readonly ["view", "revoke"];
|
|
197
206
|
readonly 'player-note': readonly ["view", "create"];
|
|
198
207
|
readonly 'tag-rule': readonly ["view", "update"];
|
|
208
|
+
readonly 'chat-room': readonly ["view", "create", "update", "delete"];
|
|
199
209
|
}>;
|
|
200
210
|
readonly support: import("better-auth/plugins/access").Role<import("better-auth/plugins/access").ExactRoleStatements<{
|
|
201
211
|
readonly player: ["view", "update"];
|
|
@@ -221,6 +231,7 @@ export declare const roles: {
|
|
|
221
231
|
readonly sessions: readonly ["view", "revoke"];
|
|
222
232
|
readonly 'player-note': readonly ["view", "create"];
|
|
223
233
|
readonly 'tag-rule': readonly ["view", "update"];
|
|
234
|
+
readonly 'chat-room': readonly ["view", "create", "update", "delete"];
|
|
224
235
|
}>;
|
|
225
236
|
readonly 'content-manager': import("better-auth/plugins/access").Role<import("better-auth/plugins/access").ExactRoleStatements<{
|
|
226
237
|
readonly content: ["create", "update", "delete", "publish"];
|
|
@@ -243,6 +254,7 @@ export declare const roles: {
|
|
|
243
254
|
readonly sessions: readonly ["view", "revoke"];
|
|
244
255
|
readonly 'player-note': readonly ["view", "create"];
|
|
245
256
|
readonly 'tag-rule': readonly ["view", "update"];
|
|
257
|
+
readonly 'chat-room': readonly ["view", "create", "update", "delete"];
|
|
246
258
|
}>;
|
|
247
259
|
};
|
|
248
260
|
export type RoleName = keyof typeof roles;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"permissions.d.ts","sourceRoot":"","sources":["../../../src/server/auth/permissions.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,SAAS
|
|
1
|
+
{"version":3,"file":"permissions.d.ts","sourceRoot":"","sources":["../../../src/server/auth/permissions.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;CAmBZ,CAAC;AAEX,eAAO,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAAiC,CAAC;AAEjD,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmBpB,CAAC;AAEH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;EAMtB,CAAC;AAEH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;EAG7B,CAAC;AAEH,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAIR,CAAC;AAEX,MAAM,MAAM,QAAQ,GAAG,MAAM,OAAO,KAAK,CAAC;AAC1C,MAAM,MAAM,YAAY,GAAG,MAAM,OAAO,SAAS,CAAC;AAClD,MAAM,MAAM,QAAQ,CAAC,CAAC,SAAS,YAAY,IAAI,CAAC,OAAO,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC"}
|
|
@@ -17,6 +17,7 @@ export const statement = {
|
|
|
17
17
|
sessions: ['view', 'revoke'],
|
|
18
18
|
'player-note': ['view', 'create'],
|
|
19
19
|
'tag-rule': ['view', 'update'],
|
|
20
|
+
'chat-room': ['view', 'create', 'update', 'delete'],
|
|
20
21
|
};
|
|
21
22
|
export const ac = createAccessControl(statement);
|
|
22
23
|
export const adminRole = ac.newRole({
|
|
@@ -37,6 +38,7 @@ export const adminRole = ac.newRole({
|
|
|
37
38
|
sessions: ['view', 'revoke'],
|
|
38
39
|
'player-note': ['view', 'create'],
|
|
39
40
|
'tag-rule': ['view', 'update'],
|
|
41
|
+
'chat-room': ['view', 'create', 'update', 'delete'],
|
|
40
42
|
});
|
|
41
43
|
export const supportRole = ac.newRole({
|
|
42
44
|
player: ['view', 'update'],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"permissions.js","sourceRoot":"","sources":["../../../src/server/auth/permissions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEjE,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,MAAM,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,gBAAgB,CAAU;IAC5D,WAAW,EAAE,CAAC,MAAM,EAAE,QAAQ,CAAU;IACxC,IAAI,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,SAAS,CAAU;IAC5C,OAAO,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,CAAU;IAC3D,UAAU,EAAE,CAAC,MAAM,EAAE,gBAAgB,EAAE,WAAW,CAAU;IAC5D,MAAM,EAAE,CAAC,MAAM,CAAU;IACzB,UAAU,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,CAAU;IACvE,KAAK,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,CAAU;IAC/D,KAAK,EAAE,CAAC,MAAM,EAAE,QAAQ,CAAU;IAClC,KAAK,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,CAAU;IACjE,aAAa,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,UAAU,CAAU;IACtD,SAAS,EAAE,CAAC,MAAM,CAAU;IAC5B,UAAU,EAAE,CAAC,MAAM,EAAE,WAAW,EAAE,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,CAAC;IAC5C,SAAS,EAAE,CAAC,MAAM,EAAE,QAAQ,CAAC;IAC7B,QAAQ,EAAE,CAAC,MAAM,EAAE,QAAQ,CAAC;IAC5B,aAAa,EAAE,CAAC,MAAM,EAAE,QAAQ,CAAC;IACjC,UAAU,EAAE,CAAC,MAAM,EAAE,QAAQ,CAAC;IAC9B,WAAW,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,CAAC;CACpD,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,WAAW,GAAG,EAAE,CAAC,OAAO,CAAC;IACpC,MAAM,EAAE,CAAC,MAAM,EAAE,QAAQ,CAAC;IAC1B,WAAW,EAAE,CAAC,MAAM,CAAC;IACrB,UAAU,EAAE,CAAC,MAAM,CAAC;IACpB,MAAM,EAAE,CAAC,MAAM,CAAC;IAChB,SAAS,EAAE,CAAC,MAAM,CAAC;CACpB,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,kBAAkB,GAAG,EAAE,CAAC,OAAO,CAAC;IAC3C,OAAO,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,CAAC;IAClD,IAAI,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,SAAS,CAAC;CACpC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,KAAK,GAAG;IACnB,KAAK,EAAE,SAAS;IAChB,OAAO,EAAE,WAAW;IACpB,iBAAiB,EAAE,kBAAkB;CAC7B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migrate.test.d.ts","sourceRoot":"","sources":["../../../../src/server/db/__tests__/migrate.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
2
|
+
import { applyMigrationsIndividually, withMigrationAdvisoryLock } from '../migrate.js';
|
|
3
|
+
const migrations = [
|
|
4
|
+
{
|
|
5
|
+
sql: ["ALTER TYPE room_category ADD VALUE 'private-chats';"],
|
|
6
|
+
folderMillis: 1,
|
|
7
|
+
hash: 'one',
|
|
8
|
+
bps: true,
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
sql: ["UPDATE chat_room SET category = 'private-chats';"],
|
|
12
|
+
folderMillis: 2,
|
|
13
|
+
hash: 'two',
|
|
14
|
+
bps: true,
|
|
15
|
+
},
|
|
16
|
+
];
|
|
17
|
+
describe('applyMigrationsIndividually', () => {
|
|
18
|
+
it('commits each migration file before applying the next one', async () => {
|
|
19
|
+
const apply = vi.fn(async () => undefined);
|
|
20
|
+
await applyMigrationsIndividually({ migrations, apply });
|
|
21
|
+
expect(apply).toHaveBeenCalledTimes(2);
|
|
22
|
+
expect(apply).toHaveBeenNthCalledWith(1, migrations[0]);
|
|
23
|
+
expect(apply).toHaveBeenNthCalledWith(2, migrations[1]);
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
describe('withMigrationAdvisoryLock', () => {
|
|
27
|
+
it('holds the journal lock until the migration work completes', async () => {
|
|
28
|
+
const query = vi.fn(async () => undefined);
|
|
29
|
+
const action = vi.fn(async () => undefined);
|
|
30
|
+
await withMigrationAdvisoryLock({ query }, 'drizzle.__drizzle_migrations_chat', action);
|
|
31
|
+
expect(query).toHaveBeenNthCalledWith(1, 'SELECT pg_advisory_lock(hashtext($1))', [
|
|
32
|
+
'drizzle.__drizzle_migrations_chat',
|
|
33
|
+
]);
|
|
34
|
+
expect(action).toHaveBeenCalledOnce();
|
|
35
|
+
expect(query).toHaveBeenNthCalledWith(2, 'SELECT pg_advisory_unlock(hashtext($1))', [
|
|
36
|
+
'drizzle.__drizzle_migrations_chat',
|
|
37
|
+
]);
|
|
38
|
+
});
|
|
39
|
+
it('releases the lock when migration work fails', async () => {
|
|
40
|
+
const query = vi.fn(async () => undefined);
|
|
41
|
+
const failure = new Error('migration failed');
|
|
42
|
+
await expect(withMigrationAdvisoryLock({ query }, 'drizzle.__drizzle_migrations_chat', async () => {
|
|
43
|
+
throw failure;
|
|
44
|
+
})).rejects.toThrow(failure);
|
|
45
|
+
expect(query).toHaveBeenNthCalledWith(2, 'SELECT pg_advisory_unlock(hashtext($1))', [
|
|
46
|
+
'drizzle.__drizzle_migrations_chat',
|
|
47
|
+
]);
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
//# sourceMappingURL=migrate.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migrate.test.js","sourceRoot":"","sources":["../../../../src/server/db/__tests__/migrate.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAElD,OAAO,EAAE,2BAA2B,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAEvF,MAAM,UAAU,GAAoB;IAClC;QACE,GAAG,EAAE,CAAC,qDAAqD,CAAC;QAC5D,YAAY,EAAE,CAAC;QACf,IAAI,EAAE,KAAK;QACX,GAAG,EAAE,IAAI;KACV;IACD;QACE,GAAG,EAAE,CAAC,kDAAkD,CAAC;QACzD,YAAY,EAAE,CAAC;QACf,IAAI,EAAE,KAAK;QACX,GAAG,EAAE,IAAI;KACV;CACF,CAAC;AAEF,QAAQ,CAAC,6BAA6B,EAAE,GAAG,EAAE;IAC3C,EAAE,CAAC,0DAA0D,EAAE,KAAK,IAAI,EAAE;QACxE,MAAM,KAAK,GAAG,EAAE,CAAC,EAAE,CAAC,KAAK,IAAI,EAAE,CAAC,SAAS,CAAC,CAAC;QAE3C,MAAM,2BAA2B,CAAC,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,CAAC;QAEzD,MAAM,CAAC,KAAK,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;QACvC,MAAM,CAAC,KAAK,CAAC,CAAC,uBAAuB,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;QACxD,MAAM,CAAC,KAAK,CAA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EAAE,yCAAyC,EAAE;YAClF,mCAAmC;SACpC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import 'dotenv/config';
|
|
2
|
+
import { type MigrationMeta } from 'drizzle-orm/migrator';
|
|
2
3
|
export type RunMigrationsOptions = {
|
|
3
4
|
/** Absolute path to the drizzle migrations folder (the dir holding the .sql + meta/). */
|
|
4
5
|
migrationsFolder: string;
|
|
@@ -15,8 +16,21 @@ export type RunMigrationsOptions = {
|
|
|
15
16
|
*/
|
|
16
17
|
extensions?: string[];
|
|
17
18
|
};
|
|
19
|
+
type SqlClient = {
|
|
20
|
+
query(sql: string, values?: unknown[]): Promise<unknown>;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Serializes migration runners for one journal. The lock is session-scoped, so
|
|
24
|
+
* it remains held while each migration uses its own transaction connection.
|
|
25
|
+
*/
|
|
26
|
+
export declare function withMigrationAdvisoryLock<T>(client: SqlClient, lockName: string, action: () => Promise<T>): Promise<T>;
|
|
27
|
+
export declare function applyMigrationsIndividually({ migrations, apply, }: {
|
|
28
|
+
migrations: MigrationMeta[];
|
|
29
|
+
apply: (migration: MigrationMeta) => Promise<void>;
|
|
30
|
+
}): Promise<void>;
|
|
18
31
|
/** Apply one migration set against the admin connection. Idempotent: drizzle skips already-recorded migrations. */
|
|
19
32
|
export declare function runMigrations(opts: RunMigrationsOptions): Promise<void>;
|
|
20
33
|
/** Apply the engine `outbox` migration set (the only engine-owned table); domain modules ship their own `migrate`. */
|
|
21
34
|
export declare function migrate(databaseUrl?: string): Promise<void>;
|
|
35
|
+
export {};
|
|
22
36
|
//# sourceMappingURL=migrate.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migrate.d.ts","sourceRoot":"","sources":["../../../src/server/db/migrate.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"migrate.d.ts","sourceRoot":"","sources":["../../../src/server/db/migrate.ts"],"names":[],"mappings":"AAMA,OAAO,eAAe,CAAC;AAEvB,OAAO,EAAsB,KAAK,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAG9E,MAAM,MAAM,oBAAoB,GAAG;IACjC,yFAAyF;IACzF,gBAAgB,EAAE,MAAM,CAAC;IACzB,yEAAyE;IACzE,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,6DAA6D;IAC7D,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,2EAA2E;IAC3E,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB,CAAC;AAcF,KAAK,SAAS,GAAG;IACf,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CAC1D,CAAC;AAEF;;;GAGG;AACH,wBAAsB,yBAAyB,CAAC,CAAC,EAC/C,MAAM,EAAE,SAAS,EACjB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,cAQzB;AAED,wBAAsB,2BAA2B,CAAC,EAChD,UAAU,EACV,KAAK,GACN,EAAE;IACD,UAAU,EAAE,aAAa,EAAE,CAAC;IAC5B,KAAK,EAAE,CAAC,SAAS,EAAE,aAAa,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACpD,iBAIA;AAED,mHAAmH;AACnH,wBAAsB,aAAa,CAAC,IAAI,EAAE,oBAAoB,iBAiE7D;AAED,sHAAsH;AACtH,wBAAgB,OAAO,CAAC,WAAW,CAAC,EAAE,MAAM,iBAO3C"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
// Uses
|
|
2
|
-
//
|
|
3
|
-
//
|
|
4
|
-
//
|
|
5
|
-
//
|
|
1
|
+
// Uses Drizzle's generated migration journal, but executes one file per database transaction.
|
|
2
|
+
// PostgreSQL enum values cannot be used until the transaction that adds them has committed.
|
|
3
|
+
// Each migration set ships its compiled SQL in the package tarball (the per-module `drizzle/`
|
|
4
|
+
// dirs land in `dist/**` via copy-drizzle), so a consumer runs migrations straight from
|
|
5
|
+
// node_modules with no source checkout. Every module owns its own journal + tracking table and
|
|
6
|
+
// calls `runMigrations`; this file owns only the engine `outbox` set. See ADR-0022/0020/0027.
|
|
6
7
|
import 'dotenv/config';
|
|
7
8
|
import { fileURLToPath } from 'node:url';
|
|
8
|
-
import {
|
|
9
|
-
import { migrate as drizzleMigrate } from 'drizzle-orm/node-postgres/migrator';
|
|
9
|
+
import { readMigrationFiles } from 'drizzle-orm/migrator';
|
|
10
10
|
import { Pool } from 'pg';
|
|
11
11
|
function migrateUrl(override) {
|
|
12
12
|
const url = override ?? process.env['DATABASE_ADMIN_URL'] ?? process.env['DATABASE_URL'];
|
|
@@ -15,6 +15,27 @@ function migrateUrl(override) {
|
|
|
15
15
|
}
|
|
16
16
|
return url;
|
|
17
17
|
}
|
|
18
|
+
function quoteIdentifier(identifier) {
|
|
19
|
+
return `"${identifier.replaceAll('"', '""')}"`;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Serializes migration runners for one journal. The lock is session-scoped, so
|
|
23
|
+
* it remains held while each migration uses its own transaction connection.
|
|
24
|
+
*/
|
|
25
|
+
export async function withMigrationAdvisoryLock(client, lockName, action) {
|
|
26
|
+
await client.query('SELECT pg_advisory_lock(hashtext($1))', [lockName]);
|
|
27
|
+
try {
|
|
28
|
+
return await action();
|
|
29
|
+
}
|
|
30
|
+
finally {
|
|
31
|
+
await client.query('SELECT pg_advisory_unlock(hashtext($1))', [lockName]);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
export async function applyMigrationsIndividually({ migrations, apply, }) {
|
|
35
|
+
for (const migration of migrations) {
|
|
36
|
+
await apply(migration);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
18
39
|
/** Apply one migration set against the admin connection. Idempotent: drizzle skips already-recorded migrations. */
|
|
19
40
|
export async function runMigrations(opts) {
|
|
20
41
|
const pool = new Pool({ connectionString: migrateUrl(opts.databaseUrl) });
|
|
@@ -25,12 +46,49 @@ export async function runMigrations(opts) {
|
|
|
25
46
|
}
|
|
26
47
|
await pool.query(`CREATE EXTENSION IF NOT EXISTS ${ext}`);
|
|
27
48
|
}
|
|
28
|
-
const
|
|
29
|
-
|
|
49
|
+
const migrationsTable = opts.migrationsTable ?? '__drizzle_migrations';
|
|
50
|
+
const migrationsSchema = opts.migrationsSchema ?? 'drizzle';
|
|
51
|
+
const migrationConfig = {
|
|
30
52
|
migrationsFolder: opts.migrationsFolder,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
53
|
+
migrationsTable,
|
|
54
|
+
migrationsSchema,
|
|
55
|
+
};
|
|
56
|
+
const schema = quoteIdentifier(migrationsSchema);
|
|
57
|
+
const table = quoteIdentifier(migrationsTable);
|
|
58
|
+
await pool.query(`CREATE SCHEMA IF NOT EXISTS ${schema}`);
|
|
59
|
+
await pool.query(`CREATE TABLE IF NOT EXISTS ${schema}.${table} (id SERIAL PRIMARY KEY, hash text NOT NULL, created_at bigint)`);
|
|
60
|
+
const lockClient = await pool.connect();
|
|
61
|
+
try {
|
|
62
|
+
await withMigrationAdvisoryLock(lockClient, `${migrationsSchema}.${migrationsTable}`, async () => {
|
|
63
|
+
const applied = await lockClient.query(`SELECT hash FROM ${schema}.${table}`);
|
|
64
|
+
const appliedHashes = new Set(applied.rows.map(({ hash }) => hash));
|
|
65
|
+
const pending = readMigrationFiles(migrationConfig).filter((migration) => !appliedHashes.has(migration.hash));
|
|
66
|
+
await applyMigrationsIndividually({
|
|
67
|
+
migrations: pending,
|
|
68
|
+
apply: async (migration) => {
|
|
69
|
+
const client = await pool.connect();
|
|
70
|
+
try {
|
|
71
|
+
await client.query('BEGIN');
|
|
72
|
+
for (const statement of migration.sql) {
|
|
73
|
+
await client.query(statement);
|
|
74
|
+
}
|
|
75
|
+
await client.query(`INSERT INTO ${schema}.${table} (hash, created_at) VALUES ($1, $2)`, [migration.hash, migration.folderMillis]);
|
|
76
|
+
await client.query('COMMIT');
|
|
77
|
+
}
|
|
78
|
+
catch (error) {
|
|
79
|
+
await client.query('ROLLBACK');
|
|
80
|
+
throw error;
|
|
81
|
+
}
|
|
82
|
+
finally {
|
|
83
|
+
client.release();
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
finally {
|
|
90
|
+
lockClient.release();
|
|
91
|
+
}
|
|
34
92
|
}
|
|
35
93
|
finally {
|
|
36
94
|
await pool.end();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migrate.js","sourceRoot":"","sources":["../../../src/server/db/migrate.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"migrate.js","sourceRoot":"","sources":["../../../src/server/db/migrate.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,4FAA4F;AAC5F,8FAA8F;AAC9F,wFAAwF;AACxF,+FAA+F;AAC/F,8FAA8F;AAC9F,OAAO,eAAe,CAAC;AACvB,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAsB,MAAM,sBAAsB,CAAC;AAC9E,OAAO,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAmB1B,SAAS,UAAU,CAAC,QAAiB;IACnC,MAAM,GAAG,GAAG,QAAQ,IAAI,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IACzF,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,MAAM,IAAI,KAAK,CAAC,kEAAkE,CAAC,CAAC;IACtF,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,SAAS,eAAe,CAAC,UAAkB;IACzC,OAAO,IAAI,UAAU,CAAC,UAAU,CAAC,GA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,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;4BAChC,CAAC;4BACD,MAAM,MAAM,CAAC,KAAK,CAChB,eAAe,MAAM,IAAI,KAAK,qCAAqC,EACnE,CAAC,SAAS,CAAC,IAAI,EAAE,SAAS,CAAC,YAAY,CAAC,CACzC,CAAC;4BACF,MAAM,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;wBAC/B,CAAC;wBAAC,OAAO,KAAK,EAAE,CAAC;4BACf,MAAM,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;4BAC/B,MAAM,KAAK,CAAC;wBACd,CAAC;gCAAS,CAAC;4BACT,MAAM,CAAC,OAAO,EAAE,CAAC;wBACnB,CAAC;oBACH,CAAC;iBACF,CAAC,CAAC;YACL,CAAC,CACF,CAAC;QACJ,CAAC;gBAAS,CAAC;YACT,UAAU,CAAC,OAAO,EAAE,CAAC;QACvB,CAAC;IACH,CAAC;YAAS,CAAC;QACT,MAAM,IAAI,CAAC,GAAG,EAAE,CAAC;IACnB,CAAC;AACH,CAAC;AAED,sHAAsH;AACtH,MAAM,UAAU,OAAO,CAAC,WAAoB;IAC1C,OAAO,aAAa,CAAC;QACnB,gBAAgB,EAAE,aAAa,CAAC,IAAI,GAAG,CAAC,6BAA6B,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACxF,eAAe,EAAE,6BAA6B;QAC9C,gBAAgB,EAAE,SAAS;QAC3B,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACxC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -9,6 +9,8 @@ export { createRedisClient, type RedisClient } from './redis-client.js';
|
|
|
9
9
|
export { RedisCache } from './redis-cache.js';
|
|
10
10
|
export { RedisRateLimiter } from './redis-rate-limiter.js';
|
|
11
11
|
export { RedisStreamsBroker } from './redis-streams-broker.js';
|
|
12
|
+
export { InProcessRealtimeTransport } from './realtime-transport.js';
|
|
13
|
+
export { SseClientAuthorizer } from './realtime-authorizer.js';
|
|
12
14
|
export { Container } from './container.js';
|
|
13
15
|
export type { Factory } from './container.js';
|
|
14
16
|
export { createLogger } from './logger.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/server/kernel/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3E,OAAO,EACL,cAAc,EACd,wBAAwB,EACxB,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,sBAAsB,CAAC;AAE9B,YAAY,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAE3D,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACxE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACxE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAE/D,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,YAAY,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAE9C,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACpE,YAAY,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD,OAAO,EAAE,S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|
export { RedisRateLimiter } from './redis-rate-limiter.js';
|
|
9
9
|
export { RedisStreamsBroker } from './redis-streams-broker.js';
|
|
10
|
+
export { InProcessRealtimeTransport } from './realtime-transport.js';
|
|
11
|
+
export { SseClientAuthorizer } from './realtime-authorizer.js';
|
|
10
12
|
export { Container } from './container.js';
|
|
11
13
|
export { createLogger } from './logger.js';
|
|
12
14
|
export { setErrorReporter, reportError } from './error-reporter.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/server/kernel/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,cAAc,EACd,wBAAwB,EACxB,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAE3D,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACxE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAoB,MAAM,mBAAmB,CAAC;AACxE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAE/D,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAG3C,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAGpE,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE9C,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,mBAAm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M,mBAAmB,CAAC;AAE9C,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEhD,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAE,0BAA0B,EAAE,MAAM,mBAAmB,CAAC;AAG/D,iDAAiD;AACjD,OAAO,EAAE,kBAAkB,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { RealtimeClientAuthorizer, RealtimeClientAuthorizerInput, RealtimeConnectionGrant } from '@openora/core/contracts';
|
|
2
|
+
/** First-party SSE grant; the session cookie authorizes the stream itself. */
|
|
3
|
+
export declare class SseClientAuthorizer implements RealtimeClientAuthorizer {
|
|
4
|
+
private readonly streamPath;
|
|
5
|
+
constructor(streamPath?: string);
|
|
6
|
+
issueGrant(input: RealtimeClientAuthorizerInput): RealtimeConnectionGrant;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=realtime-authorizer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"realtime-authorizer.d.ts","sourceRoot":"","sources":["../../../src/server/kernel/realtime-authorizer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,wBAAwB,EACxB,6BAA6B,EAC7B,uBAAuB,EACxB,MAAM,yBAAyB,CAAC;AAEjC,8EAA8E;AAC9E,qBAAa,mBAAoB,YAAW,wBAAwB;IACtD,OAAO,CAAC,QAAQ,CAAC,UAAU;gBAAV,UAAU,SAAiB;IAExD,UAAU,CAAC,KAAK,EAAE,6BAA6B,GAAG,uBAAuB;CAG1E"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** First-party SSE grant; the session cookie authorizes the stream itself. */
|
|
2
|
+
export class SseClientAuthorizer {
|
|
3
|
+
streamPath;
|
|
4
|
+
constructor(streamPath = '/chat/stream') {
|
|
5
|
+
this.streamPath = streamPath;
|
|
6
|
+
}
|
|
7
|
+
issueGrant(input) {
|
|
8
|
+
return { provider: 'sse', streamPath: this.streamPath, channels: input.channels };
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=realtime-authorizer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"realtime-authorizer.js","sourceRoot":"","sources":["../../../src/server/kernel/realtime-authorizer.ts"],"names":[],"mappings":"AAMA,8EAA8E;AAC9E,MAAM,OAAO,mBAAmB;IACD;IAA7B,YAA6B,aAAa,cAAc;QAA3B,eAAU,GAAV,UAAU,CAAiB;IAAG,CAAC;IAE5D,UAAU,CAAC,KAAoC;QAC7C,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,CAAC;IACpF,CAAC;CACF"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { RealtimePresence, RealtimeTransport } from '@openora/core/contracts';
|
|
2
|
+
/** First-party process-local fan-out used by the default SSE transport. */
|
|
3
|
+
export declare class InProcessRealtimeTransport implements RealtimeTransport {
|
|
4
|
+
private readonly channels;
|
|
5
|
+
readonly presence: RealtimePresence;
|
|
6
|
+
publish<T>(channel: string, event: T): void;
|
|
7
|
+
subscribe<T>(channel: string, handler: (event: T) => void): () => void;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=realtime-transport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"realtime-transport.d.ts","sourceRoot":"","sources":["../../../src/server/kernel/realtime-transport.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAmCnF,2EAA2E;AAC3E,qBAAa,0BAA2B,YAAW,iBAAiB;IAClE,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAmC;IAC5D,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAA2B;IAE9D,OAAO,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI;IAe3C,SAAS,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,GAAG,MAAM,IAAI;CAevE"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
class InProcessPresence {
|
|
2
|
+
members = new Map();
|
|
3
|
+
join(channel, memberId, connectionId) {
|
|
4
|
+
const channelMembers = this.members.get(channel) ?? new Map();
|
|
5
|
+
const connections = channelMembers.get(memberId) ?? new Set();
|
|
6
|
+
connections.add(connectionId);
|
|
7
|
+
channelMembers.set(memberId, connections);
|
|
8
|
+
this.members.set(channel, channelMembers);
|
|
9
|
+
}
|
|
10
|
+
leave(channel, memberId, connectionId) {
|
|
11
|
+
const channelMembers = this.members.get(channel);
|
|
12
|
+
const connections = channelMembers?.get(memberId);
|
|
13
|
+
if (!channelMembers || !connections) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
connections.delete(connectionId);
|
|
17
|
+
if (connections.size === 0) {
|
|
18
|
+
channelMembers.delete(memberId);
|
|
19
|
+
}
|
|
20
|
+
if (channelMembers.size === 0) {
|
|
21
|
+
this.members.delete(channel);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
count(channel) {
|
|
25
|
+
return this.members.get(channel)?.size ?? 0;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
/** First-party process-local fan-out used by the default SSE transport. */
|
|
29
|
+
export class InProcessRealtimeTransport {
|
|
30
|
+
channels = new Map();
|
|
31
|
+
presence = new InProcessPresence();
|
|
32
|
+
publish(channel, event) {
|
|
33
|
+
const subscribers = this.channels.get(channel);
|
|
34
|
+
if (!subscribers) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
// Snapshot so a handler that unsubscribes mid-iteration can't corrupt the loop.
|
|
38
|
+
for (const handler of Array.from(subscribers)) {
|
|
39
|
+
try {
|
|
40
|
+
handler(event);
|
|
41
|
+
}
|
|
42
|
+
catch {
|
|
43
|
+
// One disconnected subscriber must not stop fan-out to others.
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
subscribe(channel, handler) {
|
|
48
|
+
const subscribers = this.channels.get(channel) ?? new Set();
|
|
49
|
+
subscribers.add(handler);
|
|
50
|
+
this.channels.set(channel, subscribers);
|
|
51
|
+
return () => {
|
|
52
|
+
const current = this.channels.get(channel);
|
|
53
|
+
if (!current) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
current.delete(handler);
|
|
57
|
+
if (current.size === 0) {
|
|
58
|
+
this.channels.delete(channel);
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=realtime-transport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"realtime-transport.js","sourceRoot":"","sources":["../../../src/server/kernel/realtime-transport.ts"],"names":[],"mappings":"AAIA,MAAM,iBAAiB;IACJ,OAAO,GAAG,IAAI,GAAG,EAAoC,CAAC;IAEvE,IAAI,CAAC,OAAe,EAAE,QAAgB,EAAE,YAAoB;QAC1D,MAAM,cAAc,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,IAAI,GAAG,EAAuB,CAAC;QACnF,MAAM,WAAW,GAAG,cAAc,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,IAAI,GAAG,EAAU,CAAC;QACtE,WAAW,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;QAC9B,cAAc,CAAC,GAAG,CAAC,QAAQ,EAAE,WA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ACH,OAAO,CAAC,KAAK,CAAC,CAAC;YACjB,CAAC;YAAC,MAAM,CAAC;gBACP,+DAA+D;YACjE,CAAC;QACH,CAAC;IACH,CAAC;IAED,SAAS,CAAI,OAAe,EAAE,OAA2B;QACvD,MAAM,WAAW,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,IAAI,GAAG,EAAW,CAAC;QACrE,WAAW,CAAC,GAAG,CAAC,OAAkB,CAAC,CAAC;QACpC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;QACxC,OAAO,GAAG,EAAE;YACV,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;YAC3C,IAAI,CAAC,OAAO,EAAE,CAAC;gBACb,OAAO;YACT,CAAC;YACD,OAAO,CAAC,MAAM,CAAC,OAAkB,CAAC,CAAC;YACnC,IAAI,OAAO,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC;gBACvB,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;YAChC,CAAC;QACH,CAAC,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { PluginEntry } from './load-plugins.js';
|
|
2
|
+
/**
|
|
3
|
+
* The full set of built-in platform plugins, as a ready-to-spread
|
|
4
|
+
* `PluginEntry[]` for a consumer's `extensions.config.ts`.
|
|
5
|
+
*
|
|
6
|
+
* Each path is resolved through `@openora/core`'s own package exports, so it
|
|
7
|
+
* points at the installed package's compiled plugin - the npm dependency in a
|
|
8
|
+
* deployed consumer, or the linked workspace checkout in local development.
|
|
9
|
+
* This replaces hand-maintained filesystem paths that assumed an adjacent core
|
|
10
|
+
* checkout.
|
|
11
|
+
*
|
|
12
|
+
* Compose your registry as `[...corePlugins(), ...overlays]`. To opt a module
|
|
13
|
+
* out, filter by id: `corePlugins().filter((p) => p.id !== 'chat')`.
|
|
14
|
+
*/
|
|
15
|
+
export declare function corePlugins(): PluginEntry[];
|
|
16
|
+
//# sourceMappingURL=core-plugins.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core-plugins.d.ts","sourceRoot":"","sources":["../../../src/server/plugin-host/core-plugins.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAmBrD;;;;;;;;;;;;GAYG;AACH,wBAAgB,WAAW,IAAI,WAAW,EAAE,CAK3C"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';
|
|
2
|
+
const nodeRequire = createRequire(import.meta.url);
|
|
3
|
+
const CORE_PLUGIN_MODULES = [
|
|
4
|
+
{ id: 'audit', specifier: '@openora/core/audit/plugin' },
|
|
5
|
+
{ id: 'iam', specifier: '@openora/core/iam/plugin' },
|
|
6
|
+
{ id: 'identity', specifier: '@openora/core/pam/plugins/identity' },
|
|
7
|
+
{ id: 'notifications', specifier: '@openora/core/engagement/plugins/notifications' },
|
|
8
|
+
{ id: 'compliance', specifier: '@openora/core/compliance/plugins/compliance' },
|
|
9
|
+
{ id: 'wallet', specifier: '@openora/core/wallet/plugins/wallet' },
|
|
10
|
+
{ id: 'gaming', specifier: '@openora/core/casino/plugins/gaming' },
|
|
11
|
+
{ id: 'lobby', specifier: '@openora/core/casino/plugins/lobby' },
|
|
12
|
+
{ id: 'chat', specifier: '@openora/core/engagement/plugins/chat' },
|
|
13
|
+
{ id: 'profile', specifier: '@openora/core/pam/plugins/profile' },
|
|
14
|
+
{ id: 'admin-console', specifier: '@openora/core/admin-console/plugin' },
|
|
15
|
+
{ id: 'cms', specifier: '@openora/core/cms/plugins/cms' },
|
|
16
|
+
];
|
|
17
|
+
/**
|
|
18
|
+
* The full set of built-in platform plugins, as a ready-to-spread
|
|
19
|
+
* `PluginEntry[]` for a consumer's `extensions.config.ts`.
|
|
20
|
+
*
|
|
21
|
+
* Each path is resolved through `@openora/core`'s own package exports, so it
|
|
22
|
+
* points at the installed package's compiled plugin - the npm dependency in a
|
|
23
|
+
* deployed consumer, or the linked workspace checkout in local development.
|
|
24
|
+
* This replaces hand-maintained filesystem paths that assumed an adjacent core
|
|
25
|
+
* checkout.
|
|
26
|
+
*
|
|
27
|
+
* Compose your registry as `[...corePlugins(), ...overlays]`. To opt a module
|
|
28
|
+
* out, filter by id: `corePlugins().filter((p) => p.id !== 'chat')`.
|
|
29
|
+
*/
|
|
30
|
+
export function corePlugins() {
|
|
31
|
+
return CORE_PLUGIN_MODULES.map(({ id, specifier }) => ({
|
|
32
|
+
id,
|
|
33
|
+
path: nodeRequire.resolve(specifier),
|
|
34
|
+
}));
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=core-plugins.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core-plugins.js","sourceRoot":"","sources":["../../../src/server/plugin-host/core-plugins.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAG5C,MAAM,WAAW,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAEnD,MAAM,mBAAmB,GAAqD;IAC5E,EAAE,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,4BAA4B,EAAE;IACxD,EAAE,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,0BAA0B,EAAE;IACpD,EAAE,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,oCAAoC,EAAE;IACnE,EAAE,EAAE,EAAE,eAAe,EAAE,SAAS,EAAE,gDAAgD,EAAE;IACpF,EAAE,EAAE,EAAE,YAAY,EAAE,SAAS,EAAE,6CAA6C,EAAE;IAC9E,EAAE,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,qCAAqC,EAAE;IAClE,EAAE,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,qCAAqC,EAAE;IAClE,EAAE,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,oCAAoC,EAAE;IAChE,EAAE,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,uCAAuC,EAAE;IAClE,EAAE,EAAE,EAAE,SAAS,EAAE,SAAS,EAAE,mCAAmC,EAAE;IACjE,EAAE,EAAE,EAAE,eAAe,EAAE,SAAS,EAAE,oCAAoC,EAAE;IACxE,EAAE,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,+BAA+B,EAAE;CAC1D,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,WAAW;IACzB,OAAO,mBAAmB,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC,CAAC;QACrD,EAAE;QACF,IAAI,EAAE,WAAW,CAAC,OAAO,CAAC,SAAS,CAAC;KACrC,CAAC,CAAC,CAAC;AACN,CAAC"}
|
|
@@ -5,4 +5,5 @@ export { loadPlugins } from './load-plugins.js';
|
|
|
5
5
|
export type { PluginEntry } from './load-plugins.js';
|
|
6
6
|
export { applyServiceManifest, parseServiceManifest } from './service-manifest.js';
|
|
7
7
|
export { loadExtensions } from './load-extensions.js';
|
|
8
|
+
export { corePlugins } from './core-plugins.js';
|
|
8
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/server/plugin-host/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,YAAY,EACV,MAAM,EACN,gBAAgB,EAChB,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,YAAY,GACb,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,YAAY,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AACnF,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/server/plugin-host/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,YAAY,EACV,MAAM,EACN,gBAAgB,EAChB,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,YAAY,GACb,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,YAAY,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AACnF,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -3,4 +3,5 @@ export { ModuleRegistryImpl } from './module-registry.js';
|
|
|
3
3
|
export { loadPlugins } from './load-plugins.js';
|
|
4
4
|
export { applyServiceManifest, parseServiceManifest } from './service-manifest.js';
|
|
5
5
|
export { loadExtensions } from './load-extensions.js';
|
|
6
|
+
export { corePlugins } from './core-plugins.js';
|
|
6
7
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/server/plugin-host/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AASlD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AACnF,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/server/plugin-host/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AASlD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AACnF,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -8,8 +8,9 @@ import { type AnyToken } from '@openora/core/contracts';
|
|
|
8
8
|
* Modeled on `assertSealedServicesBound` (`compliance/assert.ts`) - same `has(token)`
|
|
9
9
|
* shape, same "list every gap, don't stop at the first" style.
|
|
10
10
|
*
|
|
11
|
-
* `REALTIME_TRANSPORT` is
|
|
12
|
-
*
|
|
11
|
+
* `REALTIME_TRANSPORT` is excluded: `createApp` binds `InProcessRealtimeTransport` as
|
|
12
|
+
* the default for single-process SSE deployments. Infra overlays (e.g. Ably) rebind it
|
|
13
|
+
* via last-wins `container.register`. Not listed here because it always has a binding.
|
|
13
14
|
*/
|
|
14
15
|
export type DurableSeamContainerView = {
|
|
15
16
|
has(token: AnyToken<unknown>): boolean;
|