@withwiz/toolkit 0.6.0 → 0.6.1

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.
@@ -1,38 +1,38 @@
1
- import {
2
- createLogoutHandler
3
- } from "../../chunk-WNEXLSDB.js";
4
- import {
5
- createMeHandler
6
- } from "../../chunk-4YQ6YBM7.js";
7
- import {
8
- createOAuthAuthorizeHandler
9
- } from "../../chunk-6JY6NUR6.js";
10
- import {
11
- createOAuthCallbackHandler
12
- } from "../../chunk-S7OQWKUJ.js";
13
- import "../../chunk-6B7VU6RZ.js";
14
1
  import {
15
2
  createRefreshHandler
16
3
  } from "../../chunk-FI46LV42.js";
17
- import "../../chunk-JQFQT4S2.js";
18
4
  import {
19
5
  createRegisterHandler
20
6
  } from "../../chunk-Q7VFOUFI.js";
21
- import "../../chunk-ETMTDHK2.js";
22
7
  import {
23
8
  createResetPasswordHandler
24
9
  } from "../../chunk-TFZOOP3V.js";
25
10
  import {
26
11
  createVerifyEmailHandler
27
12
  } from "../../chunk-QYXI45KH.js";
28
- import "../../chunk-N6TMHITU.js";
29
13
  import {
30
14
  createForgotPasswordHandler
31
15
  } from "../../chunk-FRY3TNJ6.js";
32
- import "../../chunk-WC2IYFGC.js";
33
16
  import {
34
17
  createLoginHandler
35
18
  } from "../../chunk-MGQV723O.js";
19
+ import {
20
+ createLogoutHandler
21
+ } from "../../chunk-WNEXLSDB.js";
22
+ import {
23
+ createMeHandler
24
+ } from "../../chunk-4YQ6YBM7.js";
25
+ import {
26
+ createOAuthAuthorizeHandler
27
+ } from "../../chunk-6JY6NUR6.js";
28
+ import {
29
+ createOAuthCallbackHandler
30
+ } from "../../chunk-S7OQWKUJ.js";
31
+ import "../../chunk-JQFQT4S2.js";
32
+ import "../../chunk-N6TMHITU.js";
33
+ import "../../chunk-6B7VU6RZ.js";
34
+ import "../../chunk-WC2IYFGC.js";
35
+ import "../../chunk-ETMTDHK2.js";
36
36
  import "../../chunk-HZLJYEOO.js";
37
37
  import "../../chunk-T4MDCVUQ.js";
38
38
  import "../../chunk-2QQNL4ND.js";
@@ -1,3 +1,9 @@
1
+ import {
2
+ TokenRefreshService
3
+ } from "../../chunk-JQFQT4S2.js";
4
+ import {
5
+ EmailVerificationService
6
+ } from "../../chunk-N6TMHITU.js";
1
7
  import {
2
8
  LoginService
3
9
  } from "../../chunk-DFSNHVXF.js";
@@ -5,17 +11,11 @@ import {
5
11
  OAuthCallbackService
6
12
  } from "../../chunk-6B7VU6RZ.js";
7
13
  import {
8
- TokenRefreshService
9
- } from "../../chunk-JQFQT4S2.js";
14
+ PasswordResetService
15
+ } from "../../chunk-WC2IYFGC.js";
10
16
  import {
11
17
  RegisterService
12
18
  } from "../../chunk-ETMTDHK2.js";
13
- import {
14
- EmailVerificationService
15
- } from "../../chunk-N6TMHITU.js";
16
- import {
17
- PasswordResetService
18
- } from "../../chunk-WC2IYFGC.js";
19
19
  import "../../chunk-GDWEDUHO.js";
20
20
  import "../../chunk-ITGUSYUH.js";
21
21
  import "../../chunk-YZXGOOFC.js";
@@ -0,0 +1,30 @@
1
+ // src/config/registry.ts
2
+ var MODULE_KEYS = {
3
+ common: "__withwiz_common_config",
4
+ auth: "__withwiz_auth_config",
5
+ logger: "__withwiz_logger_config",
6
+ cache: "__withwiz_cache_config",
7
+ storage: "__withwiz_storage_config",
8
+ geolocation: "__withwiz_geolocation_config",
9
+ cors: "__withwiz_cors_config"
10
+ };
11
+ var config = new Proxy({}, {
12
+ get(_target, prop) {
13
+ const globalKey = MODULE_KEYS[prop];
14
+ if (!globalKey) return void 0;
15
+ return globalThis[globalKey];
16
+ },
17
+ set() {
18
+ throw new TypeError("config is read-only");
19
+ }
20
+ });
21
+ function resetConfig() {
22
+ for (const globalKey of Object.values(MODULE_KEYS)) {
23
+ globalThis[globalKey] = void 0;
24
+ }
25
+ }
26
+
27
+ export {
28
+ config,
29
+ resetConfig
30
+ };
@@ -1,9 +1,11 @@
1
1
  /**
2
2
  * Unified Config Registry
3
3
  *
4
- * Single entry point for all withwiz configuration.
5
- * Stores resolved configs in globalThis.__withwiz_config and exposes
6
- * them via a read-only Proxy (`config`).
4
+ * Live read-only view over individual module stores
5
+ * (`globalThis.__withwiz_*_config`).
6
+ *
7
+ * `config.auth` and `getAuthConfig()` return the same object —
8
+ * there is only one source of truth per module.
7
9
  */
8
10
  import type { ResolvedCommonConfig } from './common';
9
11
  import type { ResolvedAuthConfig } from '../auth/config';
@@ -21,22 +23,13 @@ export interface ConfigRegistry {
21
23
  geolocation?: ResolvedGeolocationConfig;
22
24
  cors?: ResolvedCorsConfig;
23
25
  }
24
- declare global {
25
- var __withwiz_config: ConfigRegistry | undefined;
26
- }
27
- /**
28
- * Initialise the unified config registry.
29
- * Idempotent — a second call is silently ignored.
30
- * The stored object is frozen to prevent mutation.
31
- */
32
- export declare function initConfig(entries: ConfigRegistry): void;
33
26
  /**
34
- * Read-only Proxy that delegates to `globalThis.__withwiz_config`.
35
- * Throws `ConfigurationError` if accessed before `initConfig()`.
27
+ * Read-only Proxy that delegates to each module's globalThis store.
28
+ * Returns `undefined` for optional modules that haven't been initialized.
36
29
  * Throws `TypeError` on any setter attempt.
37
30
  */
38
31
  export declare const config: ConfigRegistry;
39
32
  /**
40
- * Reset the registry to uninitialised state. For test cleanup only.
33
+ * Reset all module stores. For test cleanup only.
41
34
  */
42
35
  export declare function resetConfig(): void;
@@ -1,12 +1,9 @@
1
1
  import {
2
2
  config,
3
- initConfig,
4
3
  resetConfig
5
- } from "../chunk-6PGZTY4N.js";
6
- import "../chunk-2QH66EVQ.js";
4
+ } from "../chunk-GTPUVHSV.js";
7
5
  import "../chunk-ORMEWXMH.js";
8
6
  export {
9
7
  config,
10
- initConfig,
11
8
  resetConfig
12
9
  };
@@ -16,5 +16,5 @@ export interface ToolkitConfig {
16
16
  }
17
17
  export declare function initialize(config: ToolkitConfig): void;
18
18
  export type { AuthConfig, LoggerConfig, CacheConfigInput as CacheConfig, StorageConfig, GeolocationConfig, CorsConfig, };
19
- export { initConfig, config, resetConfig } from './config/registry';
19
+ export { config, resetConfig } from './config/registry';
20
20
  export type { ConfigRegistry } from './config/registry';
@@ -9,9 +9,8 @@ import {
9
9
  } from "./chunk-3CBGGMIY.js";
10
10
  import {
11
11
  config,
12
- initConfig,
13
12
  resetConfig
14
- } from "./chunk-6PGZTY4N.js";
13
+ } from "./chunk-GTPUVHSV.js";
15
14
  import {
16
15
  initializeAuth
17
16
  } from "./chunk-A2XAOU55.js";
@@ -43,7 +42,6 @@ function initialize(config2) {
43
42
  }
44
43
  export {
45
44
  config,
46
- initConfig,
47
45
  initialize,
48
46
  resetConfig
49
47
  };
@@ -1,11 +1,3 @@
1
- import {
2
- removeEventHandlers,
3
- sanitizeArray,
4
- sanitizeHtml,
5
- sanitizeInput,
6
- sanitizeObjectFields,
7
- sanitizeUrl
8
- } from "../chunk-N54KGJPU.js";
9
1
  import {
10
2
  isApiErrorResponse,
11
3
  isApiSuccessResponse,
@@ -34,6 +26,14 @@ import {
34
26
  isValidJSON,
35
27
  isValidUrl
36
28
  } from "../chunk-EUQATJLI.js";
29
+ import {
30
+ removeEventHandlers,
31
+ sanitizeArray,
32
+ sanitizeHtml,
33
+ sanitizeInput,
34
+ sanitizeObjectFields,
35
+ sanitizeUrl
36
+ } from "../chunk-N54KGJPU.js";
37
37
  import {
38
38
  createPaginatedResponse,
39
39
  getReferer,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@withwiz/toolkit",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "description": "Shared utility library for withwiz projects",
5
5
  "license": "MIT",
6
6
  "private": false,
@@ -1,30 +0,0 @@
1
- import {
2
- ConfigurationError
3
- } from "./chunk-2QH66EVQ.js";
4
-
5
- // src/config/registry.ts
6
- function initConfig(entries) {
7
- if (globalThis.__withwiz_config) return;
8
- globalThis.__withwiz_config = Object.freeze(entries);
9
- }
10
- var config = new Proxy({}, {
11
- get(_target, prop, _receiver) {
12
- const store = globalThis.__withwiz_config;
13
- if (!store) {
14
- throw new ConfigurationError("Config", "Not initialized. Call initConfig() first.");
15
- }
16
- return store[prop];
17
- },
18
- set() {
19
- throw new TypeError("config is read-only");
20
- }
21
- });
22
- function resetConfig() {
23
- globalThis.__withwiz_config = void 0;
24
- }
25
-
26
- export {
27
- initConfig,
28
- config,
29
- resetConfig
30
- };