@holo-js/core 0.2.6 → 0.3.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/dist/{chunk-H43SANQQ.mjs → chunk-M7ZDJZQ7.mjs} +1011 -840
- package/dist/errors.d.ts +1 -11
- package/dist/errors.mjs +4 -101
- package/dist/index.d.ts +5 -4
- package/dist/index.mjs +1 -1
- package/dist/runtime/index.d.ts +158 -165
- package/dist/runtime/index.mjs +1 -1
- package/package.json +32 -27
package/dist/errors.d.ts
CHANGED
|
@@ -1,11 +1 @@
|
|
|
1
|
-
|
|
2
|
-
type NormalizedHoloHttpError = {
|
|
3
|
-
readonly status: HoloHttpErrorStatus;
|
|
4
|
-
readonly message: string;
|
|
5
|
-
readonly code?: string;
|
|
6
|
-
readonly cause: unknown;
|
|
7
|
-
};
|
|
8
|
-
declare function isHoloHttpErrorStatus(status: number): status is HoloHttpErrorStatus;
|
|
9
|
-
declare function normalizeHoloHttpError(error: unknown): NormalizedHoloHttpError | undefined;
|
|
10
|
-
|
|
11
|
-
export { type HoloHttpErrorStatus, type NormalizedHoloHttpError, isHoloHttpErrorStatus, normalizeHoloHttpError };
|
|
1
|
+
export { HoloHttpErrorStatus, NormalizedHoloHttpError, isHoloHttpErrorStatus, normalizeHoloHttpError } from '@holo-js/kernel';
|
package/dist/errors.mjs
CHANGED
|
@@ -1,105 +1,8 @@
|
|
|
1
1
|
// src/errors.ts
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
403,
|
|
7
|
-
404,
|
|
8
|
-
405,
|
|
9
|
-
406,
|
|
10
|
-
407,
|
|
11
|
-
408,
|
|
12
|
-
409,
|
|
13
|
-
410,
|
|
14
|
-
411,
|
|
15
|
-
412,
|
|
16
|
-
413,
|
|
17
|
-
414,
|
|
18
|
-
415,
|
|
19
|
-
416,
|
|
20
|
-
417,
|
|
21
|
-
418,
|
|
22
|
-
421,
|
|
23
|
-
422,
|
|
24
|
-
423,
|
|
25
|
-
424,
|
|
26
|
-
425,
|
|
27
|
-
426,
|
|
28
|
-
428,
|
|
29
|
-
429,
|
|
30
|
-
431,
|
|
31
|
-
451,
|
|
32
|
-
500,
|
|
33
|
-
501,
|
|
34
|
-
502,
|
|
35
|
-
503,
|
|
36
|
-
504,
|
|
37
|
-
505,
|
|
38
|
-
506,
|
|
39
|
-
507,
|
|
40
|
-
508,
|
|
41
|
-
510,
|
|
42
|
-
511
|
|
43
|
-
]);
|
|
44
|
-
function isObject(value) {
|
|
45
|
-
return !!value && typeof value === "object";
|
|
46
|
-
}
|
|
47
|
-
function readNumber(value) {
|
|
48
|
-
return typeof value === "number" && Number.isInteger(value) ? value : void 0;
|
|
49
|
-
}
|
|
50
|
-
function readString(value) {
|
|
51
|
-
return typeof value === "string" && value.length > 0 ? value : void 0;
|
|
52
|
-
}
|
|
53
|
-
function readStatus(error) {
|
|
54
|
-
if (!isObject(error)) {
|
|
55
|
-
return void 0;
|
|
56
|
-
}
|
|
57
|
-
const directStatus = readNumber(error.status);
|
|
58
|
-
if (directStatus) {
|
|
59
|
-
return directStatus;
|
|
60
|
-
}
|
|
61
|
-
const statusCode = readNumber(error.statusCode);
|
|
62
|
-
if (statusCode) {
|
|
63
|
-
return statusCode;
|
|
64
|
-
}
|
|
65
|
-
const digest = readString(error.digest);
|
|
66
|
-
const nextHttpStatus = digest?.match(/^NEXT_HTTP_ERROR_FALLBACK;(\d{3})$/)?.[1];
|
|
67
|
-
return nextHttpStatus ? Number(nextHttpStatus) : void 0;
|
|
68
|
-
}
|
|
69
|
-
function readMessage(error) {
|
|
70
|
-
if (error instanceof Error && error.message.length > 0) {
|
|
71
|
-
return error.message;
|
|
72
|
-
}
|
|
73
|
-
if (isObject(error)) {
|
|
74
|
-
const message = readString(error.message);
|
|
75
|
-
if (message) {
|
|
76
|
-
return message;
|
|
77
|
-
}
|
|
78
|
-
const statusText = readString(error.statusText);
|
|
79
|
-
if (statusText) {
|
|
80
|
-
return statusText;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
return "An unexpected error occurred.";
|
|
84
|
-
}
|
|
85
|
-
function readCode(error) {
|
|
86
|
-
return isObject(error) ? readString(error.code) : void 0;
|
|
87
|
-
}
|
|
88
|
-
function isHoloHttpErrorStatus(status) {
|
|
89
|
-
return httpStatuses.has(status);
|
|
90
|
-
}
|
|
91
|
-
function normalizeHoloHttpError(error) {
|
|
92
|
-
const status = readStatus(error);
|
|
93
|
-
if (!status || !isHoloHttpErrorStatus(status)) {
|
|
94
|
-
return void 0;
|
|
95
|
-
}
|
|
96
|
-
return {
|
|
97
|
-
status,
|
|
98
|
-
message: readMessage(error),
|
|
99
|
-
code: readCode(error),
|
|
100
|
-
cause: error
|
|
101
|
-
};
|
|
102
|
-
}
|
|
2
|
+
import {
|
|
3
|
+
isHoloHttpErrorStatus,
|
|
4
|
+
normalizeHoloHttpError
|
|
5
|
+
} from "@holo-js/kernel";
|
|
103
6
|
export {
|
|
104
7
|
isHoloHttpErrorStatus,
|
|
105
8
|
normalizeHoloHttpError
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { GeneratedProjectRegistry, HoloRuntime, HoloSessionRuntimeBinding, HoloAuthRuntimeBinding, CreateHoloOptions } from './runtime/index.js';
|
|
2
2
|
export { GeneratedBroadcastManifest, GeneratedBroadcastManifestChannel, GeneratedBroadcastManifestEvent, HoloQueueRuntimeBinding, HoloServerViewRenderInput, HoloServerViewRenderer, configureHoloRenderingRuntime, createHolo, ensureHolo, getHolo, holoRuntimeInternals, initializeHolo, loadGeneratedBroadcastManifest, loadGeneratedProjectRegistry, peekHolo, reconfigureOptionalHoloSubsystems, registryInternals, resetHoloRenderingRuntime, resetHoloRuntime, resetOptionalHoloSubsystems, resolveGeneratedProjectRegistryPath } from './runtime/index.js';
|
|
3
|
-
import { HoloConfigMap, LoadedHoloConfig, DotPath, ValueAtPath } from '@holo-js/config';
|
|
3
|
+
import { HoloConfigMap, LoadedHoloConfig, HoloConfigValues, DotPath, ValueAtPath } from '@holo-js/config';
|
|
4
4
|
export { createRuntimeConnectionOptions, resolveRuntimeConnectionManagerOptions } from '@holo-js/db';
|
|
5
|
+
import '@holo-js/auth';
|
|
5
6
|
|
|
6
7
|
declare function resolveStorageKeyPath(root: string, key: string): string;
|
|
7
8
|
|
|
@@ -23,9 +24,9 @@ interface HoloAdapterProjectAccessors<TCustom extends HoloConfigMap = HoloConfig
|
|
|
23
24
|
getProject(): Promise<HoloAdapterProject<TCustom>>;
|
|
24
25
|
getSession(): Promise<HoloSessionRuntimeBinding | undefined>;
|
|
25
26
|
getAuth(): Promise<HoloAuthRuntimeBinding | undefined>;
|
|
26
|
-
useConfig<TKey extends Extract<keyof
|
|
27
|
-
useConfig<TPath extends DotPath<
|
|
28
|
-
config<TPath extends DotPath<
|
|
27
|
+
useConfig<TKey extends Extract<keyof HoloConfigValues<TCustom>, string>>(key: TKey): Promise<HoloConfigValues<TCustom>[TKey]>;
|
|
28
|
+
useConfig<TPath extends DotPath<HoloConfigValues<TCustom>>>(path: TPath): Promise<ValueAtPath<HoloConfigValues<TCustom>, TPath>>;
|
|
29
|
+
config<TPath extends DotPath<HoloConfigValues<TCustom>>>(path: TPath): Promise<ValueAtPath<HoloConfigValues<TCustom>, TPath>>;
|
|
29
30
|
}
|
|
30
31
|
interface HoloFrameworkAdapterState<TProject extends HoloAdapterProject = HoloAdapterProject> {
|
|
31
32
|
readonly projectRoot?: string;
|
package/dist/index.mjs
CHANGED
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
resolveGeneratedProjectRegistryPath,
|
|
18
18
|
resolveRuntimeConnectionManagerOptions,
|
|
19
19
|
resolveStorageKeyPath
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-M7ZDJZQ7.mjs";
|
|
21
21
|
|
|
22
22
|
// src/adapter.ts
|
|
23
23
|
import { readdir, stat } from "node:fs/promises";
|
package/dist/runtime/index.d.ts
CHANGED
|
@@ -1,7 +1,20 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AuthHostedIdentityStore } from '@holo-js/auth';
|
|
2
|
+
import { HoloConfigMap, LoadedHoloConfig, HoloConfigValues, DotPath, ValueAtPath } from '@holo-js/config';
|
|
2
3
|
import { resolveRuntimeConnectionManagerOptions } from '@holo-js/db';
|
|
3
4
|
export { RuntimeConfigInput, RuntimeConnectionConfig, RuntimeDatabaseConfig, RuntimeHoloConfig, SupportedDatabaseDriver, createAdapter, createDialect, createRuntimeConnectionOptions, createRuntimeLogger, isSupportedDatabaseDriver, parseDatabaseDriver, resolveRuntimeConnectionManagerOptions } from '@holo-js/db';
|
|
4
5
|
|
|
6
|
+
interface OptionalFeatureModuleLoader<TModule> {
|
|
7
|
+
(required: true, options?: {
|
|
8
|
+
readonly projectRoot?: string;
|
|
9
|
+
}): Promise<TModule>;
|
|
10
|
+
(required?: false, options?: {
|
|
11
|
+
readonly projectRoot?: string;
|
|
12
|
+
}): Promise<TModule | undefined>;
|
|
13
|
+
(required: boolean, options?: {
|
|
14
|
+
readonly projectRoot?: string;
|
|
15
|
+
}): Promise<TModule | undefined>;
|
|
16
|
+
}
|
|
17
|
+
|
|
5
18
|
interface GeneratedModelRegistryEntry {
|
|
6
19
|
readonly sourcePath: string;
|
|
7
20
|
readonly name: string;
|
|
@@ -136,19 +149,144 @@ declare const registryInternals: {
|
|
|
136
149
|
normalizeLegacyGeneratedProjectRegistry: typeof normalizeLegacyGeneratedProjectRegistry;
|
|
137
150
|
};
|
|
138
151
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
readonly
|
|
142
|
-
|
|
152
|
+
interface HoloServerViewRenderInput {
|
|
153
|
+
readonly view: string;
|
|
154
|
+
readonly props?: Readonly<Record<string, unknown>>;
|
|
155
|
+
}
|
|
156
|
+
type HoloServerViewRenderer = (input: HoloServerViewRenderInput) => string | Promise<string>;
|
|
157
|
+
declare function configureHoloRenderingRuntime(bindings?: {
|
|
158
|
+
readonly renderView?: HoloServerViewRenderer;
|
|
159
|
+
}): void;
|
|
160
|
+
declare function resetHoloRenderingRuntime(): void;
|
|
161
|
+
|
|
162
|
+
declare function normalizeDateValue(value: unknown): Date;
|
|
163
|
+
declare function normalizeJsonValue(value: unknown): unknown;
|
|
164
|
+
type EmailVerificationTokenRecord = {
|
|
165
|
+
readonly id: string;
|
|
166
|
+
readonly provider: string;
|
|
167
|
+
readonly userId: string | number;
|
|
168
|
+
readonly email: string;
|
|
169
|
+
readonly tokenHash: string;
|
|
170
|
+
readonly createdAt: Date;
|
|
171
|
+
readonly expiresAt: Date;
|
|
143
172
|
};
|
|
173
|
+
declare function normalizeEmailVerificationTokenRecord(row: Record<string, unknown>): EmailVerificationTokenRecord;
|
|
174
|
+
type PasswordResetTokenRecord = {
|
|
175
|
+
readonly id: string;
|
|
176
|
+
readonly provider: string;
|
|
177
|
+
readonly email: string;
|
|
178
|
+
readonly table?: string;
|
|
179
|
+
readonly tokenHash: string;
|
|
180
|
+
readonly createdAt: Date;
|
|
181
|
+
readonly expiresAt: Date;
|
|
182
|
+
};
|
|
183
|
+
declare function normalizePasswordResetTokenRecord(row: Record<string, unknown>): PasswordResetTokenRecord;
|
|
184
|
+
|
|
185
|
+
type CoreQueueDriverFactory = {
|
|
186
|
+
readonly driver: string;
|
|
187
|
+
create(...parameters: readonly unknown[]): unknown;
|
|
188
|
+
};
|
|
189
|
+
|
|
144
190
|
type CoreNotificationJsonPrimitive = string | number | boolean | null;
|
|
145
191
|
type CoreNotificationJsonValue = CoreNotificationJsonPrimitive | readonly CoreNotificationJsonValue[] | {
|
|
146
192
|
readonly [key: string]: CoreNotificationJsonValue;
|
|
147
193
|
};
|
|
194
|
+
interface CoreNotificationRecord<TData extends CoreNotificationJsonValue = CoreNotificationJsonValue> {
|
|
195
|
+
readonly id: string;
|
|
196
|
+
readonly type?: string;
|
|
197
|
+
readonly notifiableType: string;
|
|
198
|
+
readonly notifiableId: string | number;
|
|
199
|
+
readonly data: TData;
|
|
200
|
+
readonly readAt?: Date | null;
|
|
201
|
+
readonly createdAt: Date;
|
|
202
|
+
readonly updatedAt: Date;
|
|
203
|
+
}
|
|
204
|
+
declare function normalizeNotificationRecordFromRow(row: Record<string, unknown>): CoreNotificationRecord<CoreNotificationJsonValue>;
|
|
205
|
+
declare function serializeNotificationRecordForRow(record: {
|
|
206
|
+
readonly id: string;
|
|
207
|
+
readonly type?: string;
|
|
208
|
+
readonly notifiableType: string;
|
|
209
|
+
readonly notifiableId: string | number;
|
|
210
|
+
readonly data: unknown;
|
|
211
|
+
readonly readAt?: Date | null;
|
|
212
|
+
readonly createdAt: Date;
|
|
213
|
+
readonly updatedAt: Date;
|
|
214
|
+
}): Record<string, unknown>;
|
|
215
|
+
|
|
148
216
|
interface CoreNotificationDatabaseRoute {
|
|
149
217
|
readonly id: string | number;
|
|
150
218
|
readonly type: string;
|
|
151
219
|
}
|
|
220
|
+
interface CoreNotificationStore {
|
|
221
|
+
create(record: CoreNotificationRecord): Promise<void>;
|
|
222
|
+
list(notifiable: CoreNotificationDatabaseRoute): Promise<readonly CoreNotificationRecord[]>;
|
|
223
|
+
unread(notifiable: CoreNotificationDatabaseRoute): Promise<readonly CoreNotificationRecord[]>;
|
|
224
|
+
markAsRead(ids: readonly string[]): Promise<number>;
|
|
225
|
+
markAsUnread(ids: readonly string[]): Promise<number>;
|
|
226
|
+
delete(ids: readonly string[]): Promise<number>;
|
|
227
|
+
}
|
|
228
|
+
declare function createCoreNotificationStore<TCustom extends HoloConfigMap>(loadedConfig: LoadedHoloConfig<TCustom>): CoreNotificationStore;
|
|
229
|
+
|
|
230
|
+
type MailSender = {
|
|
231
|
+
sendMail(mail: {
|
|
232
|
+
readonly to: unknown;
|
|
233
|
+
readonly subject: string;
|
|
234
|
+
readonly text?: string;
|
|
235
|
+
readonly html?: string;
|
|
236
|
+
readonly metadata?: Readonly<Record<string, unknown>>;
|
|
237
|
+
}): PromiseLike<unknown>;
|
|
238
|
+
};
|
|
239
|
+
type NotificationMailMessage = {
|
|
240
|
+
readonly subject: string;
|
|
241
|
+
readonly greeting?: string;
|
|
242
|
+
readonly lines?: readonly string[];
|
|
243
|
+
readonly action?: {
|
|
244
|
+
readonly label: string;
|
|
245
|
+
readonly url: string;
|
|
246
|
+
};
|
|
247
|
+
readonly html?: string;
|
|
248
|
+
readonly text?: string;
|
|
249
|
+
readonly metadata?: Readonly<Record<string, unknown>>;
|
|
250
|
+
};
|
|
251
|
+
declare function createNotificationMailText(message: Omit<NotificationMailMessage, 'subject'>): string | undefined;
|
|
252
|
+
declare function createCoreNotificationMailSender(mailModule: MailSender): {
|
|
253
|
+
send(message: NotificationMailMessage, context: {
|
|
254
|
+
readonly route?: string | {
|
|
255
|
+
readonly email: string;
|
|
256
|
+
readonly name?: string;
|
|
257
|
+
};
|
|
258
|
+
}): Promise<void>;
|
|
259
|
+
};
|
|
260
|
+
declare function createAuthMailDeliveryHook(mailModule: MailSender, appUrl: string): Readonly<{
|
|
261
|
+
sendEmailVerification(input: {
|
|
262
|
+
readonly provider: string;
|
|
263
|
+
readonly user: unknown;
|
|
264
|
+
readonly email: string;
|
|
265
|
+
readonly token: {
|
|
266
|
+
readonly id: string;
|
|
267
|
+
readonly plainTextToken: string;
|
|
268
|
+
readonly expiresAt: Date;
|
|
269
|
+
};
|
|
270
|
+
readonly route: string;
|
|
271
|
+
}): Promise<void>;
|
|
272
|
+
sendPasswordReset(input: {
|
|
273
|
+
readonly broker: string;
|
|
274
|
+
readonly provider: string;
|
|
275
|
+
readonly email: string;
|
|
276
|
+
readonly token: {
|
|
277
|
+
readonly id: string;
|
|
278
|
+
readonly plainTextToken: string;
|
|
279
|
+
readonly expiresAt: Date;
|
|
280
|
+
};
|
|
281
|
+
readonly route: string;
|
|
282
|
+
}): Promise<void>;
|
|
283
|
+
}>;
|
|
284
|
+
|
|
285
|
+
type RuntimeConfigRegistry<TCustom extends HoloConfigMap> = HoloConfigValues<TCustom>;
|
|
286
|
+
type PortableRuntimeConfig<TCustom extends HoloConfigMap> = {
|
|
287
|
+
readonly db: LoadedHoloConfig<TCustom>['database'];
|
|
288
|
+
readonly queue: LoadedHoloConfig<TCustom>['queue'];
|
|
289
|
+
};
|
|
152
290
|
type HoloAuthResult<TData> = {
|
|
153
291
|
readonly data: TData;
|
|
154
292
|
readonly error: null;
|
|
@@ -176,24 +314,6 @@ type CoreHostedIdentityRecord = {
|
|
|
176
314
|
type CoreHostedIdentityStore = AuthHostedIdentityStore & {
|
|
177
315
|
claim(record: CoreHostedIdentityRecord): Promise<CoreHostedIdentityRecord>;
|
|
178
316
|
};
|
|
179
|
-
interface CoreNotificationRecord<TData extends CoreNotificationJsonValue = CoreNotificationJsonValue> {
|
|
180
|
-
readonly id: string;
|
|
181
|
-
readonly type?: string;
|
|
182
|
-
readonly notifiableType: string;
|
|
183
|
-
readonly notifiableId: string | number;
|
|
184
|
-
readonly data: TData;
|
|
185
|
-
readonly readAt?: Date | null;
|
|
186
|
-
readonly createdAt: Date;
|
|
187
|
-
readonly updatedAt: Date;
|
|
188
|
-
}
|
|
189
|
-
interface CoreNotificationStore {
|
|
190
|
-
create(record: CoreNotificationRecord): Promise<void>;
|
|
191
|
-
list(notifiable: CoreNotificationDatabaseRoute): Promise<readonly CoreNotificationRecord[]>;
|
|
192
|
-
unread(notifiable: CoreNotificationDatabaseRoute): Promise<readonly CoreNotificationRecord[]>;
|
|
193
|
-
markAsRead(ids: readonly string[]): Promise<number>;
|
|
194
|
-
markAsUnread(ids: readonly string[]): Promise<number>;
|
|
195
|
-
delete(ids: readonly string[]): Promise<number>;
|
|
196
|
-
}
|
|
197
317
|
interface HoloSessionRuntimeBinding {
|
|
198
318
|
create(input?: {
|
|
199
319
|
readonly store?: string;
|
|
@@ -236,13 +356,13 @@ interface HoloAuthRuntimeBinding {
|
|
|
236
356
|
login(credentials: Readonly<Record<string, unknown>> & {
|
|
237
357
|
readonly password: string;
|
|
238
358
|
readonly remember?: boolean;
|
|
239
|
-
}): Promise<
|
|
359
|
+
}): Promise<{
|
|
240
360
|
readonly guard: string;
|
|
241
361
|
readonly user: unknown;
|
|
242
362
|
readonly sessionId: string;
|
|
243
363
|
readonly rememberToken?: string;
|
|
244
364
|
readonly cookies: readonly string[];
|
|
245
|
-
}
|
|
365
|
+
}>;
|
|
246
366
|
loginUsing(user: unknown, options?: {
|
|
247
367
|
readonly remember?: boolean;
|
|
248
368
|
}): Promise<{
|
|
@@ -305,13 +425,13 @@ interface HoloAuthRuntimeBinding {
|
|
|
305
425
|
login(credentials: Readonly<Record<string, unknown>> & {
|
|
306
426
|
readonly password: string;
|
|
307
427
|
readonly remember?: boolean;
|
|
308
|
-
}): Promise<
|
|
428
|
+
}): Promise<{
|
|
309
429
|
readonly guard: string;
|
|
310
430
|
readonly user: unknown;
|
|
311
431
|
readonly sessionId: string;
|
|
312
432
|
readonly rememberToken?: string;
|
|
313
433
|
readonly cookies: readonly string[];
|
|
314
|
-
}
|
|
434
|
+
}>;
|
|
315
435
|
loginUsing(user: unknown, options?: {
|
|
316
436
|
readonly remember?: boolean;
|
|
317
437
|
}): Promise<{
|
|
@@ -435,16 +555,13 @@ interface HoloQueueDriverBinding {
|
|
|
435
555
|
readonly driver: string;
|
|
436
556
|
readonly mode: 'async' | 'sync';
|
|
437
557
|
}
|
|
438
|
-
interface HoloServerViewRenderInput {
|
|
439
|
-
readonly view: string;
|
|
440
|
-
readonly props?: Readonly<Record<string, unknown>>;
|
|
441
|
-
}
|
|
442
|
-
type HoloServerViewRenderer = (input: HoloServerViewRenderInput) => string | Promise<string>;
|
|
443
558
|
type QueueModule = {
|
|
444
559
|
configureQueueRuntime(options: {
|
|
445
560
|
config: LoadedHoloConfig['queue'];
|
|
446
561
|
redisConfig?: LoadedHoloConfig['redis'];
|
|
447
562
|
} & Record<string, unknown>): void;
|
|
563
|
+
loadQueuePluginDriverFactories(projectRoot?: string, pluginNames?: readonly string[]): Promise<readonly CoreQueueDriverFactory[]>;
|
|
564
|
+
loadQueuePluginDrivers?(projectRoot?: string, pluginNames?: readonly string[]): Promise<void>;
|
|
448
565
|
getRegisteredQueueJob(name: string): {
|
|
449
566
|
sourcePath?: string;
|
|
450
567
|
} | undefined;
|
|
@@ -457,6 +574,7 @@ type QueueModule = {
|
|
|
457
574
|
replaceExisting?: boolean;
|
|
458
575
|
}): void;
|
|
459
576
|
shutdownQueueRuntime(): Promise<void>;
|
|
577
|
+
resetQueueRuntime?(): void;
|
|
460
578
|
unregisterQueueJob(name: string): void;
|
|
461
579
|
};
|
|
462
580
|
type SessionModule = {
|
|
@@ -501,6 +619,9 @@ type SessionRedisAdapter = {
|
|
|
501
619
|
type NotificationsModule = {
|
|
502
620
|
configureNotificationsRuntime(options?: {
|
|
503
621
|
readonly config: LoadedHoloConfig['notifications'];
|
|
622
|
+
readonly deferAfterCommit?: (callback: () => Promise<void>) => boolean;
|
|
623
|
+
readonly projectRoot?: string;
|
|
624
|
+
readonly plugins?: readonly string[];
|
|
504
625
|
readonly mailer?: {
|
|
505
626
|
send(message: {
|
|
506
627
|
readonly subject: string;
|
|
@@ -592,6 +713,8 @@ type NotificationsModule = {
|
|
|
592
713
|
type BroadcastModule = {
|
|
593
714
|
configureBroadcastRuntime(options?: {
|
|
594
715
|
readonly config: LoadedHoloConfig['broadcast'];
|
|
716
|
+
readonly projectRoot?: string;
|
|
717
|
+
readonly plugins?: readonly string[];
|
|
595
718
|
readonly publish?: (input: {
|
|
596
719
|
readonly connection: string;
|
|
597
720
|
readonly event: string;
|
|
@@ -629,48 +752,6 @@ type BroadcastModule = {
|
|
|
629
752
|
}): PromiseLike<unknown>;
|
|
630
753
|
resetBroadcastRuntime(): void;
|
|
631
754
|
};
|
|
632
|
-
type MailModule = {
|
|
633
|
-
configureMailRuntime(options?: {
|
|
634
|
-
readonly config: LoadedHoloConfig['mail'];
|
|
635
|
-
readonly renderView?: HoloServerViewRenderer;
|
|
636
|
-
}): void;
|
|
637
|
-
getMailRuntimeBindings(): {
|
|
638
|
-
readonly send?: unknown;
|
|
639
|
-
readonly preview?: unknown;
|
|
640
|
-
readonly renderPreview?: unknown;
|
|
641
|
-
readonly renderView?: HoloServerViewRenderer;
|
|
642
|
-
};
|
|
643
|
-
sendMail(mail: {
|
|
644
|
-
readonly mailer?: string;
|
|
645
|
-
readonly from?: unknown;
|
|
646
|
-
readonly replyTo?: unknown;
|
|
647
|
-
readonly to: unknown;
|
|
648
|
-
readonly cc?: unknown;
|
|
649
|
-
readonly bcc?: unknown;
|
|
650
|
-
readonly subject: string;
|
|
651
|
-
readonly text?: string;
|
|
652
|
-
readonly html?: string;
|
|
653
|
-
readonly markdown?: string;
|
|
654
|
-
readonly render?: {
|
|
655
|
-
readonly view: string;
|
|
656
|
-
readonly props?: Readonly<Record<string, unknown>>;
|
|
657
|
-
};
|
|
658
|
-
readonly markdownWrapper?: string;
|
|
659
|
-
readonly attachments?: readonly unknown[];
|
|
660
|
-
readonly headers?: Readonly<Record<string, string>>;
|
|
661
|
-
readonly tags?: readonly string[];
|
|
662
|
-
readonly metadata?: Readonly<Record<string, unknown>>;
|
|
663
|
-
readonly priority?: 'high' | 'normal' | 'low';
|
|
664
|
-
readonly queue?: boolean | {
|
|
665
|
-
readonly queued?: boolean;
|
|
666
|
-
readonly connection?: string;
|
|
667
|
-
readonly queue?: string;
|
|
668
|
-
readonly afterCommit?: boolean;
|
|
669
|
-
};
|
|
670
|
-
readonly delay?: number | Date;
|
|
671
|
-
}): PromiseLike<unknown>;
|
|
672
|
-
resetMailRuntime(): void;
|
|
673
|
-
};
|
|
674
755
|
type AuthorizationModule = {
|
|
675
756
|
isAuthorizationPolicyDefinition(value: unknown): boolean;
|
|
676
757
|
isAuthorizationAbilityDefinition(value: unknown): boolean;
|
|
@@ -747,38 +828,21 @@ interface HoloRuntime<TCustom extends HoloConfigMap = HoloConfigMap> {
|
|
|
747
828
|
readonly initialized: boolean;
|
|
748
829
|
initialize(): Promise<void>;
|
|
749
830
|
shutdown(): Promise<void>;
|
|
750
|
-
runWithAuthRequestAccessors<TValue>(accessors: NonNullable<CreateHoloOptions['authRequest']>, callback: () =>
|
|
831
|
+
runWithAuthRequestAccessors<TValue>(accessors: NonNullable<CreateHoloOptions['authRequest']>, callback: () => TValue): TValue;
|
|
751
832
|
useConfig<TKey extends Extract<keyof RuntimeConfigRegistry<TCustom>, string>>(key: TKey): RuntimeConfigRegistry<TCustom>[TKey];
|
|
752
833
|
useConfig<TPath extends DotPath<RuntimeConfigRegistry<TCustom>>>(path: TPath): ValueAtPath<RuntimeConfigRegistry<TCustom>, TPath>;
|
|
753
834
|
config<TPath extends DotPath<RuntimeConfigRegistry<TCustom>>>(path: TPath): ValueAtPath<RuntimeConfigRegistry<TCustom>, TPath>;
|
|
754
835
|
}
|
|
755
|
-
declare function configureHoloRenderingRuntime(bindings?: {
|
|
756
|
-
readonly renderView?: HoloServerViewRenderer;
|
|
757
|
-
}): void;
|
|
758
|
-
declare function resetHoloRenderingRuntime(): void;
|
|
759
836
|
declare function importOptionalModule<TModule>(specifier: string, options?: {
|
|
760
837
|
readonly projectRoot?: string;
|
|
761
838
|
}): Promise<TModule | undefined>;
|
|
762
|
-
declare function loadAuthorizationModule(required?: boolean): Promise<AuthorizationModule | undefined>;
|
|
763
839
|
declare function resolveAuthorizationDefinitionExport(moduleValue: unknown, exportName: string | undefined, matcher: (value: unknown) => boolean): unknown | undefined;
|
|
764
|
-
declare function normalizeNotificationRecordFromRow(row: Record<string, unknown>): CoreNotificationRecord<CoreNotificationJsonValue>;
|
|
765
|
-
declare function serializeNotificationRecordForRow(record: {
|
|
766
|
-
readonly id: string;
|
|
767
|
-
readonly type?: string;
|
|
768
|
-
readonly notifiableType: string;
|
|
769
|
-
readonly notifiableId: string | number;
|
|
770
|
-
readonly data: unknown;
|
|
771
|
-
readonly readAt?: Date | null;
|
|
772
|
-
readonly createdAt: Date;
|
|
773
|
-
readonly updatedAt: Date;
|
|
774
|
-
}): Record<string, unknown>;
|
|
775
840
|
declare function markProviderUser<T>(value: T, providerName: string): T;
|
|
776
841
|
declare function createCoreSessionStores<TCustom extends HoloConfigMap>(projectRoot: string, loadedConfig: LoadedHoloConfig<TCustom>, sessionModule: SessionModule): Promise<Readonly<Record<string, {
|
|
777
842
|
read(sessionId: string): Promise<unknown | null>;
|
|
778
843
|
write(record: unknown): Promise<void>;
|
|
779
844
|
delete(sessionId: string): Promise<void>;
|
|
780
845
|
}>>>;
|
|
781
|
-
declare function createCoreNotificationStore<TCustom extends HoloConfigMap>(loadedConfig: LoadedHoloConfig<TCustom>): CoreNotificationStore;
|
|
782
846
|
declare function createAuthNotificationsDeliveryHook(notificationsModule: NotificationsModule, appUrl: string, projectRoot?: string): {
|
|
783
847
|
sendEmailVerification(input: {
|
|
784
848
|
readonly provider: string;
|
|
@@ -812,78 +876,7 @@ declare function createCoreNotificationBroadcaster(broadcastModule: BroadcastMod
|
|
|
812
876
|
readonly notificationType?: string;
|
|
813
877
|
}): Promise<void>;
|
|
814
878
|
};
|
|
815
|
-
declare function createNotificationMailText(message: {
|
|
816
|
-
readonly greeting?: string;
|
|
817
|
-
readonly lines?: readonly string[];
|
|
818
|
-
readonly action?: {
|
|
819
|
-
readonly label: string;
|
|
820
|
-
readonly url: string;
|
|
821
|
-
};
|
|
822
|
-
}): string | undefined;
|
|
823
|
-
declare function createCoreNotificationMailSender(mailModule: MailModule): {
|
|
824
|
-
send(message: {
|
|
825
|
-
readonly subject: string;
|
|
826
|
-
readonly greeting?: string;
|
|
827
|
-
readonly lines?: readonly string[];
|
|
828
|
-
readonly action?: {
|
|
829
|
-
readonly label: string;
|
|
830
|
-
readonly url: string;
|
|
831
|
-
};
|
|
832
|
-
readonly html?: string;
|
|
833
|
-
readonly text?: string;
|
|
834
|
-
readonly metadata?: Readonly<Record<string, unknown>>;
|
|
835
|
-
}, context: {
|
|
836
|
-
readonly route?: string | {
|
|
837
|
-
readonly email: string;
|
|
838
|
-
readonly name?: string;
|
|
839
|
-
};
|
|
840
|
-
}): Promise<void>;
|
|
841
|
-
};
|
|
842
|
-
declare function createAuthMailDeliveryHook(mailModule: MailModule, appUrl: string): {
|
|
843
|
-
sendEmailVerification(input: {
|
|
844
|
-
readonly provider: string;
|
|
845
|
-
readonly user: unknown;
|
|
846
|
-
readonly email: string;
|
|
847
|
-
readonly token: {
|
|
848
|
-
readonly id: string;
|
|
849
|
-
readonly plainTextToken: string;
|
|
850
|
-
readonly expiresAt: Date;
|
|
851
|
-
};
|
|
852
|
-
readonly route: string;
|
|
853
|
-
}): Promise<void>;
|
|
854
|
-
sendPasswordReset(input: {
|
|
855
|
-
readonly broker: string;
|
|
856
|
-
readonly provider: string;
|
|
857
|
-
readonly email: string;
|
|
858
|
-
readonly token: {
|
|
859
|
-
readonly id: string;
|
|
860
|
-
readonly plainTextToken: string;
|
|
861
|
-
readonly expiresAt: Date;
|
|
862
|
-
};
|
|
863
|
-
readonly route: string;
|
|
864
|
-
}): Promise<void>;
|
|
865
|
-
};
|
|
866
879
|
declare function loadConfiguredSocialProviders<TCustom extends HoloConfigMap>(projectRootOrLoadedConfig: string | LoadedHoloConfig<TCustom>, maybeLoadedConfig?: LoadedHoloConfig<TCustom>): Promise<Readonly<Record<string, unknown>>>;
|
|
867
|
-
declare function normalizeDateValue(value: unknown): Date;
|
|
868
|
-
declare function normalizeJsonValue(value: unknown): unknown;
|
|
869
|
-
declare function normalizeEmailVerificationTokenRecord(row: Record<string, unknown>): {
|
|
870
|
-
readonly id: string;
|
|
871
|
-
readonly provider: string;
|
|
872
|
-
readonly userId: string | number;
|
|
873
|
-
readonly email: string;
|
|
874
|
-
readonly tokenHash: string;
|
|
875
|
-
readonly createdAt: Date;
|
|
876
|
-
readonly expiresAt: Date;
|
|
877
|
-
};
|
|
878
|
-
declare function normalizePasswordResetTokenRecord(row: Record<string, unknown>): {
|
|
879
|
-
readonly id: string;
|
|
880
|
-
readonly provider: string;
|
|
881
|
-
readonly email: string;
|
|
882
|
-
readonly table?: string;
|
|
883
|
-
readonly tokenHash: string;
|
|
884
|
-
readonly createdAt: Date;
|
|
885
|
-
readonly expiresAt: Date;
|
|
886
|
-
};
|
|
887
880
|
declare function createCoreSocialBindings<TCustom extends HoloConfigMap>(projectRootOrLoadedConfig: string | LoadedHoloConfig<TCustom>, loadedConfigOrSessionModule: LoadedHoloConfig<TCustom> | SessionModule, maybeSessionModule?: SessionModule): Promise<{
|
|
888
881
|
readonly providers: Readonly<Record<string, unknown>>;
|
|
889
882
|
readonly stateStore: {
|
|
@@ -958,7 +951,7 @@ declare function reconfigureOptionalHoloSubsystems<TCustom extends HoloConfigMap
|
|
|
958
951
|
readonly authContext?: {
|
|
959
952
|
activate(): void;
|
|
960
953
|
setRequestAccessors?(accessors?: CreateHoloOptions['authRequest']): void;
|
|
961
|
-
runWithRequestAccessors?<TValue>(accessors: NonNullable<CreateHoloOptions['authRequest']>, callback: () =>
|
|
954
|
+
runWithRequestAccessors?<TValue>(accessors: NonNullable<CreateHoloOptions['authRequest']>, callback: () => TValue): TValue;
|
|
962
955
|
};
|
|
963
956
|
}>;
|
|
964
957
|
declare function resetOptionalHoloSubsystems(): Promise<void>;
|
|
@@ -990,7 +983,7 @@ declare const holoRuntimeInternals: {
|
|
|
990
983
|
createCoreSocialBindings: typeof createCoreSocialBindings;
|
|
991
984
|
normalizeNotificationRecordFromRow: typeof normalizeNotificationRecordFromRow;
|
|
992
985
|
loadConfiguredSocialProviders: typeof loadConfiguredSocialProviders;
|
|
993
|
-
loadAuthorizationModule:
|
|
986
|
+
loadAuthorizationModule: OptionalFeatureModuleLoader<AuthorizationModule>;
|
|
994
987
|
markProviderUser: typeof markProviderUser;
|
|
995
988
|
normalizeDateValue: typeof normalizeDateValue;
|
|
996
989
|
normalizeEmailVerificationTokenRecord: typeof normalizeEmailVerificationTokenRecord;
|
package/dist/runtime/index.mjs
CHANGED