@holo-js/core 0.1.5 → 0.1.7

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.
@@ -2460,7 +2460,14 @@ async function reconfigureOptionalHoloSubsystems(projectRoot, loadedConfig, opti
2460
2460
  emailVerificationTokens: authStores.emailVerificationTokens,
2461
2461
  passwordResetTokens: authStores.passwordResetTokens,
2462
2462
  ...notificationsModule && (mailModule || notificationsRuntimeBindings?.mailer) ? { delivery: createAuthNotificationsDeliveryHook(notificationsModule, loadedConfig.app.url, projectRoot) } : mailModule ? { delivery: createAuthMailDeliveryHook(mailModule, loadedConfig.app.url) } : {},
2463
- context: authContext
2463
+ context: authContext,
2464
+ ...authorizationModule ? {
2465
+ authorization: {
2466
+ can(user, action, target) {
2467
+ return authorizationModule.forUser(user).can(action, target);
2468
+ }
2469
+ }
2470
+ } : {}
2464
2471
  });
2465
2472
  const authRuntime = authModule.getAuthRuntime();
2466
2473
  if (authorizationModule) {
package/dist/index.mjs CHANGED
@@ -17,7 +17,7 @@ import {
17
17
  resolveGeneratedProjectRegistryPath,
18
18
  resolveRuntimeConnectionManagerOptions,
19
19
  resolveStorageKeyPath
20
- } from "./chunk-5ZJO35LB.mjs";
20
+ } from "./chunk-OAA4RKVE.mjs";
21
21
 
22
22
  // src/adapter.ts
23
23
  import { readdir, stat } from "node:fs/promises";
@@ -407,6 +407,23 @@ interface HoloAuthRuntimeBinding {
407
407
  readonly passwordConfirmation: string;
408
408
  }): Promise<HoloAuthResult<unknown>>;
409
409
  }
410
+ interface HoloAuthAuthorizationTargetConstructor<TInstance = object> {
411
+ readonly prototype: TInstance;
412
+ }
413
+ interface HoloAuthAuthorizationTargetModelDefinition {
414
+ readonly name: string;
415
+ readonly table?: {
416
+ readonly tableName?: string;
417
+ };
418
+ }
419
+ interface HoloAuthAuthorizationTargetModel<TInstance extends object = object> {
420
+ readonly definition: HoloAuthAuthorizationTargetModelDefinition;
421
+ query(): {
422
+ first(): Promise<TInstance | undefined>;
423
+ firstOrFail(): Promise<TInstance>;
424
+ };
425
+ }
426
+ type HoloAuthAuthorizationSubject = object | HoloAuthAuthorizationTargetConstructor | HoloAuthAuthorizationTargetModel;
410
427
  interface HoloQueueRuntimeBinding {
411
428
  readonly config: LoadedHoloConfig['queue'];
412
429
  readonly drivers: ReadonlyMap<string, HoloQueueDriverBinding>;
@@ -655,6 +672,9 @@ type MailModule = {
655
672
  type AuthorizationModule = {
656
673
  isAuthorizationPolicyDefinition(value: unknown): boolean;
657
674
  isAuthorizationAbilityDefinition(value: unknown): boolean;
675
+ forUser(actor: object | null): {
676
+ can(action: string, target: HoloAuthAuthorizationSubject): Promise<boolean>;
677
+ };
658
678
  authorizationInternals: {
659
679
  getAuthorizationRuntimeState(): {
660
680
  policiesByName: Map<string, unknown>;
@@ -22,7 +22,7 @@ import {
22
22
  resetOptionalHoloSubsystems,
23
23
  resolveGeneratedProjectRegistryPath,
24
24
  resolveRuntimeConnectionManagerOptions
25
- } from "../chunk-5ZJO35LB.mjs";
25
+ } from "../chunk-OAA4RKVE.mjs";
26
26
  export {
27
27
  configureHoloRenderingRuntime,
28
28
  createAdapter,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@holo-js/core",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "description": "Holo-JS Framework - Portable runtime core",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -28,26 +28,26 @@
28
28
  "test": "vitest --run"
29
29
  },
30
30
  "dependencies": {
31
- "@holo-js/config": "^0.1.5",
32
- "@holo-js/db": "^0.1.5",
31
+ "@holo-js/config": "^0.1.7",
32
+ "@holo-js/db": "^0.1.7",
33
33
  "esbuild": "^0.27.4"
34
34
  },
35
35
  "peerDependencies": {
36
- "@holo-js/auth": "^0.1.5",
37
- "@holo-js/auth-clerk": "^0.1.5",
38
- "@holo-js/auth-social": "^0.1.5",
39
- "@holo-js/auth-workos": "^0.1.5",
40
- "@holo-js/authorization": "^0.1.5",
41
- "@holo-js/broadcast": "^0.1.5",
42
- "@holo-js/cache": "^0.1.5",
43
- "@holo-js/events": "^0.1.5",
44
- "@holo-js/mail": "^0.1.5",
45
- "@holo-js/notifications": "^0.1.5",
46
- "@holo-js/queue": "^0.1.5",
47
- "@holo-js/queue-db": "^0.1.5",
48
- "@holo-js/security": "^0.1.5",
49
- "@holo-js/session": "^0.1.5",
50
- "@holo-js/storage": "^0.1.5"
36
+ "@holo-js/auth": "^0.1.7",
37
+ "@holo-js/auth-clerk": "^0.1.7",
38
+ "@holo-js/auth-social": "^0.1.7",
39
+ "@holo-js/auth-workos": "^0.1.7",
40
+ "@holo-js/authorization": "^0.1.7",
41
+ "@holo-js/broadcast": "^0.1.7",
42
+ "@holo-js/cache": "^0.1.7",
43
+ "@holo-js/events": "^0.1.7",
44
+ "@holo-js/mail": "^0.1.7",
45
+ "@holo-js/notifications": "^0.1.7",
46
+ "@holo-js/queue": "^0.1.7",
47
+ "@holo-js/queue-db": "^0.1.7",
48
+ "@holo-js/security": "^0.1.7",
49
+ "@holo-js/session": "^0.1.7",
50
+ "@holo-js/storage": "^0.1.7"
51
51
  },
52
52
  "peerDependenciesMeta": {
53
53
  "@holo-js/auth": {
@@ -97,15 +97,15 @@
97
97
  }
98
98
  },
99
99
  "devDependencies": {
100
- "@holo-js/auth": "^0.1.5",
101
- "@holo-js/auth-social-google": "^0.1.5",
102
- "@holo-js/authorization": "^0.1.5",
103
- "@holo-js/events": "^0.1.5",
104
- "@holo-js/mail": "^0.1.5",
105
- "@holo-js/notifications": "^0.1.5",
106
- "@holo-js/queue-db": "^0.1.5",
107
- "@holo-js/session": "^0.1.5",
108
- "@holo-js/storage": "^0.1.5",
100
+ "@holo-js/auth": "^0.1.7",
101
+ "@holo-js/auth-social-google": "^0.1.7",
102
+ "@holo-js/authorization": "^0.1.7",
103
+ "@holo-js/events": "^0.1.7",
104
+ "@holo-js/mail": "^0.1.7",
105
+ "@holo-js/notifications": "^0.1.7",
106
+ "@holo-js/queue-db": "^0.1.7",
107
+ "@holo-js/session": "^0.1.7",
108
+ "@holo-js/storage": "^0.1.7",
109
109
  "@types/node": "^22.10.2",
110
110
  "tsup": "^8.3.5",
111
111
  "typescript": "^5.7.2",