@eminuckan/spine 0.2.4 → 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.
Files changed (112) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/CODE_OF_CONDUCT.md +39 -0
  3. package/CONTRIBUTING.md +78 -0
  4. package/MAINTAINERS.md +43 -0
  5. package/README.md +66 -49
  6. package/ROADMAP.md +58 -0
  7. package/SECURITY.md +37 -0
  8. package/dist/access/evaluator.d.ts.map +1 -1
  9. package/dist/access/index.js +1 -1
  10. package/dist/access/types.d.ts +10 -2
  11. package/dist/access/types.d.ts.map +1 -1
  12. package/dist/{access-DlAqsVGQ.js → access-CGrsDMwu.js} +9 -7
  13. package/dist/access-CGrsDMwu.js.map +1 -0
  14. package/dist/api-client/api-config.server.d.ts +27 -0
  15. package/dist/api-client/api-config.server.d.ts.map +1 -1
  16. package/dist/api-client/error-codes.d.ts +6 -31
  17. package/dist/api-client/error-codes.d.ts.map +1 -1
  18. package/dist/api-client/index.js +2 -2
  19. package/dist/api-client/server.d.ts +1 -1
  20. package/dist/api-client/server.d.ts.map +1 -1
  21. package/dist/api-client/server.js +3 -3
  22. package/dist/{api-client-CZapXIF8.js → api-client-CgZUMukO.js} +9 -26
  23. package/dist/api-client-CgZUMukO.js.map +1 -0
  24. package/dist/auth/auth.server.d.ts.map +1 -1
  25. package/dist/auth/authorization-parameters.d.ts +5 -0
  26. package/dist/auth/authorization-parameters.d.ts.map +1 -0
  27. package/dist/auth/route-protection.server.d.ts +20 -4
  28. package/dist/auth/route-protection.server.d.ts.map +1 -1
  29. package/dist/auth/server.d.ts +1 -1
  30. package/dist/auth/server.d.ts.map +1 -1
  31. package/dist/auth/server.js +5 -5
  32. package/dist/auth/types.d.ts +24 -2
  33. package/dist/auth/types.d.ts.map +1 -1
  34. package/dist/{auth.server-B3ODGIX4.js → auth.server-D5oiz9aF.js} +62 -53
  35. package/dist/auth.server-D5oiz9aF.js.map +1 -0
  36. package/dist/{auth.server-wdKsjQsn.js → auth.server-lC94lmlx.js} +3 -3
  37. package/dist/identity/identity-context.server.d.ts +2 -0
  38. package/dist/identity/identity-context.server.d.ts.map +1 -1
  39. package/dist/identity/identity-store.d.ts +19 -2
  40. package/dist/identity/identity-store.d.ts.map +1 -1
  41. package/dist/identity/index.js +2 -2
  42. package/dist/identity/server.js +2 -2
  43. package/dist/identity/types.d.ts +3 -1
  44. package/dist/identity/types.d.ts.map +1 -1
  45. package/dist/{identity-yT2ijZF0.js → identity-C5un-xAs.js} +104 -60
  46. package/dist/identity-C5un-xAs.js.map +1 -0
  47. package/dist/index.js +8 -8
  48. package/dist/logging/index.js +1 -1
  49. package/dist/{logging-_h2mi3L9.js → logging-DviiAkLx.js} +2 -2
  50. package/dist/{logging-_h2mi3L9.js.map → logging-DviiAkLx.js.map} +1 -1
  51. package/dist/permissions/constants.d.ts +3 -0
  52. package/dist/permissions/constants.d.ts.map +1 -1
  53. package/dist/permissions/index.js +1 -1
  54. package/dist/permissions/permission-store.d.ts +1 -1
  55. package/dist/permissions/types.d.ts +1 -1
  56. package/dist/permissions/types.d.ts.map +1 -1
  57. package/dist/{permissions-OUK8Eql2.js → permissions-_n1hIG7Q.js} +6 -12
  58. package/dist/permissions-_n1hIG7Q.js.map +1 -0
  59. package/dist/query-client/types.d.ts +9 -9
  60. package/dist/query-client/types.d.ts.map +1 -1
  61. package/dist/query-client-Bh3TyB8W.js.map +1 -1
  62. package/dist/react-router/index.js +8 -8
  63. package/dist/react-router/server.js +14 -14
  64. package/dist/{redis-session-storage.server-D0-72FV-.js → redis-session-storage.server-v2VcpFsQ.js} +2 -2
  65. package/dist/{redis-session-storage.server-D0-72FV-.js.map → redis-session-storage.server-v2VcpFsQ.js.map} +1 -1
  66. package/dist/{server-B7JN86_0.js → server-B6PCxc-T.js} +31 -83
  67. package/dist/server-B6PCxc-T.js.map +1 -0
  68. package/dist/{server-DeBlxoaW.js → server-C96NMFBy.js} +17 -9
  69. package/dist/server-C96NMFBy.js.map +1 -0
  70. package/dist/{server-Ce9jQRdL.js → server-Ca-3DJf2.js} +44 -11
  71. package/dist/server-Ca-3DJf2.js.map +1 -0
  72. package/dist/{server-BmiuV28c.js → server-Dxsww9v9.js} +5 -4
  73. package/dist/server-Dxsww9v9.js.map +1 -0
  74. package/dist/server.js +14 -14
  75. package/dist/signalr/index.js +1 -1
  76. package/dist/signalr/types.d.ts +1 -1
  77. package/dist/{signalr-CSfCz1Ik.js → signalr-k-70VHKo.js} +3 -2
  78. package/dist/signalr-k-70VHKo.js.map +1 -0
  79. package/dist/tenant/index.js +2 -2
  80. package/dist/tenant/server.js +4 -4
  81. package/dist/tenant/tenant-context.d.ts +17 -1
  82. package/dist/tenant/tenant-context.d.ts.map +1 -1
  83. package/dist/tenant/tenant-cookie.server.d.ts.map +1 -1
  84. package/dist/tenant/tenant-store.d.ts +54 -9
  85. package/dist/tenant/tenant-store.d.ts.map +1 -1
  86. package/dist/tenant/tenant.server.d.ts +20 -1
  87. package/dist/tenant/tenant.server.d.ts.map +1 -1
  88. package/dist/tenant/types.d.ts +29 -9
  89. package/dist/tenant/types.d.ts.map +1 -1
  90. package/dist/tenant-DfLemb6n.js +384 -0
  91. package/dist/tenant-DfLemb6n.js.map +1 -0
  92. package/docs/adapters.md +87 -0
  93. package/docs/architecture.md +193 -0
  94. package/docs/backend-adaptation.md +249 -0
  95. package/docs/codex-for-oss-application.md +31 -0
  96. package/docs/codex-maintenance.md +47 -0
  97. package/docs/installation.md +213 -0
  98. package/docs/module-reference.md +207 -0
  99. package/docs/releasing.md +92 -0
  100. package/package.json +21 -3
  101. package/dist/access-DlAqsVGQ.js.map +0 -1
  102. package/dist/api-client-CZapXIF8.js.map +0 -1
  103. package/dist/auth.server-B3ODGIX4.js.map +0 -1
  104. package/dist/identity-yT2ijZF0.js.map +0 -1
  105. package/dist/permissions-OUK8Eql2.js.map +0 -1
  106. package/dist/server-B7JN86_0.js.map +0 -1
  107. package/dist/server-BmiuV28c.js.map +0 -1
  108. package/dist/server-Ce9jQRdL.js.map +0 -1
  109. package/dist/server-DeBlxoaW.js.map +0 -1
  110. package/dist/signalr-CSfCz1Ik.js.map +0 -1
  111. package/dist/tenant-BErqEENp.js +0 -256
  112. package/dist/tenant-BErqEENp.js.map +0 -1
@@ -25,6 +25,33 @@ export interface APIConfigFactoryOptions {
25
25
  * Default timeout in milliseconds
26
26
  */
27
27
  timeout?: number;
28
+ /**
29
+ * Header name used for bearer-style auth. Set to null when buildHeaders owns auth.
30
+ * @default 'Authorization'
31
+ */
32
+ authHeaderName?: string | null;
33
+ /**
34
+ * Build an auth header value from the resolved access token.
35
+ * @default token => `Bearer ${token}`
36
+ */
37
+ authHeaderValue?: (accessToken: string) => string;
38
+ /**
39
+ * Header name used for tenant context. Set to null when buildHeaders owns tenancy.
40
+ * @default 'X-Tenant-Id'
41
+ */
42
+ tenantHeaderName?: string | null;
43
+ /**
44
+ * Final app-specific header hook. Returned headers are merged last.
45
+ */
46
+ buildHeaders?: (context: APIHeaderStrategyContext) => Record<string, string>;
47
+ }
48
+ export interface APIHeaderStrategyContext {
49
+ request: Request;
50
+ options: CreateAPIConfigOptions;
51
+ accessToken?: string;
52
+ tenantId: string | null;
53
+ includeAuth: boolean;
54
+ requireTenant: boolean;
28
55
  }
29
56
  /**
30
57
  * Create API Config Factory
@@ -1 +1 @@
1
- {"version":3,"file":"api-config.server.d.ts","sourceRoot":"","sources":["../../src/api-client/api-config.server.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAiBlH;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACxC;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,cAAc,EAAE,gBAAgB,EAChC,gBAAgB,EAAE,kBAAkB,EACpC,MAAM,CAAC,EAAE,SAAS,EAClB,cAAc,GAAE,uBAA4B;+BA+DjC,OAAO,YACP,sBAAsB,KAC9B,OAAO,CAAC,SAAS,CAAC;yBAgEK,MAAM;EAQjC;AAED,MAAM,MAAM,gBAAgB,GAAG,UAAU,CAAC,OAAO,sBAAsB,CAAC,CAAC"}
1
+ {"version":3,"file":"api-config.server.d.ts","sourceRoot":"","sources":["../../src/api-client/api-config.server.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAiBlH;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACxC;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B;;;OAGG;IACH,eAAe,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,MAAM,CAAC;IAClD;;;OAGG;IACH,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC;;OAEG;IACH,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,wBAAwB,KAAK,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC9E;AAED,MAAM,WAAW,wBAAwB;IACvC,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,sBAAsB,CAAC;IAChC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,WAAW,EAAE,OAAO,CAAC;IACrB,aAAa,EAAE,OAAO,CAAC;CACxB;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,cAAc,EAAE,gBAAgB,EAChC,gBAAgB,EAAE,kBAAkB,EACpC,MAAM,CAAC,EAAE,SAAS,EAClB,cAAc,GAAE,uBAA4B;+BAmEjC,OAAO,YACP,sBAAsB,KAC9B,OAAO,CAAC,SAAS,CAAC;yBA+EK,MAAM;EAQjC;AAED,MAAM,MAAM,gBAAgB,GAAG,UAAU,CAAC,OAAO,sBAAsB,CAAC,CAAC"}
@@ -1,7 +1,8 @@
1
1
  /**
2
2
  * Error Codes
3
3
  *
4
- * Standard error codes from backend.
4
+ * Generic error codes that apps can use as a starter vocabulary.
5
+ * Domain-specific codes should live in the consuming app.
5
6
  */
6
7
  export declare const ErrorCodes: {
7
8
  readonly Validation: {
@@ -17,41 +18,15 @@ export declare const ErrorCodes: {
17
18
  readonly UserNotFound: "UserNotFound";
18
19
  readonly EmailAlreadyExists: "EmailAlreadyExists";
19
20
  };
20
- readonly Accounting: {
21
- readonly OpeningBalanceLockedReconciliation: "OpeningBalanceLockedReconciliation";
22
- readonly OpeningBalanceLockedJournal: "OpeningBalanceLockedJournal";
23
- readonly SystemLocked: "SystemLocked";
24
- readonly AccountsDuplicate: "AccountsDuplicate";
25
- readonly AccountNotFound: "AccountNotFound";
26
- };
27
- readonly Subscription: {
28
- readonly SubscriptionRequired: "SubscriptionRequired";
29
- readonly SubscriptionExpired: "SubscriptionExpired";
21
+ readonly Access: {
22
+ readonly EntitlementRequired: "EntitlementRequired";
23
+ readonly EntitlementExpired: "EntitlementExpired";
30
24
  readonly FeatureNotAvailable: "FeatureNotAvailable";
31
- };
32
- readonly PropertyManagement: {
33
- readonly PropertyNotFound: "PropertyNotFound";
34
- readonly UnitNotFound: "UnitNotFound";
35
- readonly DuplicateProperty: "DuplicateProperty";
36
- readonly DuplicateUnit: "DuplicateUnit";
37
- };
38
- readonly Leasing: {
39
- readonly LeaseNotFound: "LeaseNotFound";
40
- readonly LeaseConflict: "LeaseConflict";
41
- readonly TenantNotFound: "TenantNotFound";
42
- readonly LateFeeValidationError: "LateFeeValidationError";
25
+ readonly TenantContextMissing: "TenantContextMissing";
43
26
  };
44
27
  readonly NotFound: "NotFound";
45
28
  readonly Unauthorized: "Unauthorized";
46
29
  readonly Forbidden: "Forbidden";
47
30
  readonly InternalError: "InternalError";
48
31
  };
49
- /**
50
- * Check if error code is from PropertyManagement module
51
- */
52
- export declare function isPropertyManagementError(code: string): boolean;
53
- /**
54
- * Check if error code is from Leasing module
55
- */
56
- export declare function isLeasingError(code: string): boolean;
57
32
  //# sourceMappingURL=error-codes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"error-codes.d.ts","sourceRoot":"","sources":["../../src/api-client/error-codes.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuDb,CAAC;AAEX;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAE/D;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEpD"}
1
+ {"version":3,"file":"error-codes.d.ts","sourceRoot":"","sources":["../../src/api-client/error-codes.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;CA+Bb,CAAC"}
@@ -1,5 +1,5 @@
1
- import "../logging-_h2mi3L9.js";
1
+ import "../logging-DviiAkLx.js";
2
2
  import { isApiClientError } from "../types-BaaE6wjY.js";
3
- import { ApiError, ErrorCodes, ErrorHandler, calculateBackoffDelay, createRetryFetch, fetchWithTimeout, handleApiError, isRetryableError, withRetry } from "../api-client-CZapXIF8.js";
3
+ import { ApiError, ErrorCodes, ErrorHandler, calculateBackoffDelay, createRetryFetch, fetchWithTimeout, handleApiError, isRetryableError, withRetry } from "../api-client-CgZUMukO.js";
4
4
 
5
5
  export { ApiError, ErrorCodes, ErrorHandler, calculateBackoffDelay, createRetryFetch, fetchWithTimeout, handleApiError, isApiClientError, isRetryableError, withRetry };
@@ -4,6 +4,6 @@
4
4
  * Server-side exports for API client module.
5
5
  */
6
6
  export * from './index';
7
- export { createAPIConfigFactory, type APIConfigFactory, type APIConfigFactoryOptions, } from './api-config.server';
7
+ export { createAPIConfigFactory, type APIConfigFactory, type APIConfigFactoryOptions, type APIHeaderStrategyContext, } from './api-config.server';
8
8
  export { createFetchMiddleware, createApiClient, type FetchSetupOptions, type CreateApiClientOptions, } from './fetch-client.server';
9
9
  //# sourceMappingURL=server.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/api-client/server.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,cAAc,SAAS,CAAC;AAGxB,OAAO,EACL,sBAAsB,EACtB,KAAK,gBAAgB,EACrB,KAAK,uBAAuB,GAC7B,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EACL,qBAAqB,EACrB,eAAe,EACf,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,GAC5B,MAAM,uBAAuB,CAAC"}
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/api-client/server.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,cAAc,SAAS,CAAC;AAGxB,OAAO,EACL,sBAAsB,EACtB,KAAK,gBAAgB,EACrB,KAAK,uBAAuB,EAC5B,KAAK,wBAAwB,GAC9B,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EACL,qBAAqB,EACrB,eAAe,EACf,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,GAC5B,MAAM,uBAAuB,CAAC"}
@@ -1,6 +1,6 @@
1
- import "../logging-_h2mi3L9.js";
1
+ import "../logging-DviiAkLx.js";
2
2
  import { isApiClientError } from "../types-BaaE6wjY.js";
3
- import { ApiError, ErrorCodes, ErrorHandler, calculateBackoffDelay, createRetryFetch, fetchWithTimeout, handleApiError, isRetryableError, withRetry } from "../api-client-CZapXIF8.js";
4
- import { createAPIConfigFactory, createApiClient, createFetchMiddleware } from "../server-DeBlxoaW.js";
3
+ import { ApiError, ErrorCodes, ErrorHandler, calculateBackoffDelay, createRetryFetch, fetchWithTimeout, handleApiError, isRetryableError, withRetry } from "../api-client-CgZUMukO.js";
4
+ import { createAPIConfigFactory, createApiClient, createFetchMiddleware } from "../server-C96NMFBy.js";
5
5
 
6
6
  export { ApiError, ErrorCodes, ErrorHandler, calculateBackoffDelay, createAPIConfigFactory, createApiClient, createFetchMiddleware, createRetryFetch, fetchWithTimeout, handleApiError, isApiClientError, isRetryableError, withRetry };
@@ -1,10 +1,11 @@
1
- import { logger } from "./logging-_h2mi3L9.js";
1
+ import { logger } from "./logging-DviiAkLx.js";
2
2
 
3
3
  //#region src/api-client/error-codes.ts
4
4
  /**
5
5
  * Error Codes
6
6
  *
7
- * Standard error codes from backend.
7
+ * Generic error codes that apps can use as a starter vocabulary.
8
+ * Domain-specific codes should live in the consuming app.
8
9
  */
9
10
  const ErrorCodes = {
10
11
  Validation: { Failed: "ValidationFailed" },
@@ -18,29 +19,11 @@ const ErrorCodes = {
18
19
  UserNotFound: "UserNotFound",
19
20
  EmailAlreadyExists: "EmailAlreadyExists"
20
21
  },
21
- Accounting: {
22
- OpeningBalanceLockedReconciliation: "OpeningBalanceLockedReconciliation",
23
- OpeningBalanceLockedJournal: "OpeningBalanceLockedJournal",
24
- SystemLocked: "SystemLocked",
25
- AccountsDuplicate: "AccountsDuplicate",
26
- AccountNotFound: "AccountNotFound"
27
- },
28
- Subscription: {
29
- SubscriptionRequired: "SubscriptionRequired",
30
- SubscriptionExpired: "SubscriptionExpired",
31
- FeatureNotAvailable: "FeatureNotAvailable"
32
- },
33
- PropertyManagement: {
34
- PropertyNotFound: "PropertyNotFound",
35
- UnitNotFound: "UnitNotFound",
36
- DuplicateProperty: "DuplicateProperty",
37
- DuplicateUnit: "DuplicateUnit"
38
- },
39
- Leasing: {
40
- LeaseNotFound: "LeaseNotFound",
41
- LeaseConflict: "LeaseConflict",
42
- TenantNotFound: "TenantNotFound",
43
- LateFeeValidationError: "LateFeeValidationError"
22
+ Access: {
23
+ EntitlementRequired: "EntitlementRequired",
24
+ EntitlementExpired: "EntitlementExpired",
25
+ FeatureNotAvailable: "FeatureNotAvailable",
26
+ TenantContextMissing: "TenantContextMissing"
44
27
  },
45
28
  NotFound: "NotFound",
46
29
  Unauthorized: "Unauthorized",
@@ -209,4 +192,4 @@ function createRetryFetch(config) {
209
192
 
210
193
  //#endregion
211
194
  export { ApiError, ErrorCodes, ErrorHandler, calculateBackoffDelay, createRetryFetch, fetchWithTimeout, handleApiError, isRetryableError, withRetry };
212
- //# sourceMappingURL=api-client-CZapXIF8.js.map
195
+ //# sourceMappingURL=api-client-CgZUMukO.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-client-CgZUMukO.js","names":["problemDetails: ProblemDetails","response: Response","config: ErrorHandlerConfig","error: ApiError","message: string","type: 'error' | 'success' | 'info'","DEFAULT_RETRY_CONFIG: Required<RetryConfig>","error: unknown","attempt: number","baseDelay: number","maxDelay: number","fn: () => Promise<T>","config?: RetryConfig","lastError: unknown","input: RequestInfo | URL","init?: RequestInit & { timeout?: number }","init?: RequestInit"],"sources":["../src/api-client/error-codes.ts","../src/api-client/error-handler.ts","../src/api-client/retry-handler.ts"],"sourcesContent":["/**\n * Error Codes\n * \n * Generic error codes that apps can use as a starter vocabulary.\n * Domain-specific codes should live in the consuming app.\n */\n\nexport const ErrorCodes = {\n // Validation\n Validation: {\n Failed: 'ValidationFailed',\n },\n\n // Identity\n Identity: {\n InvalidCredentials: 'InvalidCredentials',\n UserInactive: 'UserInactive',\n TenantContextMissing: 'TenantContextMissing',\n InvalidCurrentPassword: 'InvalidCurrentPassword',\n OwnerCannotDisableMembership: 'OwnerCannotDisableMembership',\n CurrentUserMissing: 'CurrentUserMissing',\n UserNotFound: 'UserNotFound',\n EmailAlreadyExists: 'EmailAlreadyExists',\n },\n\n // Access and entitlement\n Access: {\n EntitlementRequired: 'EntitlementRequired',\n EntitlementExpired: 'EntitlementExpired',\n FeatureNotAvailable: 'FeatureNotAvailable',\n TenantContextMissing: 'TenantContextMissing',\n },\n\n // General\n NotFound: 'NotFound',\n Unauthorized: 'Unauthorized',\n Forbidden: 'Forbidden',\n InternalError: 'InternalError',\n} as const;\n","/**\n * Error Handler\n * \n * Centralized error handling with ProblemDetails parsing.\n */\n\nimport type { ProblemDetails, ValidationError } from './types';\nimport { ErrorCodes } from './error-codes';\nimport { logger } from '../logging';\n\n/**\n * API Error Class\n */\nexport class ApiError extends Error {\n constructor(\n public problemDetails: ProblemDetails,\n public response: Response\n ) {\n super(problemDetails.detail);\n this.name = 'ApiError';\n }\n\n get code(): string {\n return this.problemDetails.title;\n }\n\n get status(): number {\n return this.problemDetails.status;\n }\n\n get isValidationError(): boolean {\n return this.code === ErrorCodes.Validation.Failed;\n }\n\n get validationErrors(): ValidationError[] {\n return this.problemDetails.meta?.errors ?? [];\n }\n\n get traceId(): string {\n return this.problemDetails.traceId;\n }\n}\n\n/**\n * Parse API error response\n */\nexport async function handleApiError(response: Response): Promise<never> {\n let problemDetails: ProblemDetails;\n\n try {\n problemDetails = await response.json();\n } catch {\n problemDetails = {\n type: `https://httpstatuses.com/${response.status}`,\n title: 'UnknownError',\n status: response.status,\n detail: response.statusText || 'An unknown error occurred',\n traceId: response.headers.get('x-trace-id') ?? 'unknown',\n };\n }\n\n logger.error('API request failed', undefined, {\n code: problemDetails.title,\n status: problemDetails.status,\n detail: problemDetails.detail,\n traceId: problemDetails.traceId,\n });\n\n throw new ApiError(problemDetails, response);\n}\n\n/**\n * Error Handler Configuration\n */\nexport interface ErrorHandlerConfig {\n handlers?: Partial<Record<string, (error: ApiError) => void>>;\n showToast?: boolean;\n toastMessages?: Partial<Record<string, string>>;\n onError?: (error: ApiError) => void;\n toast?: (message: string, type: 'error' | 'success' | 'info') => void;\n}\n\n/**\n * Error Handler Class\n */\nexport class ErrorHandler {\n private config: ErrorHandlerConfig;\n\n constructor(config: ErrorHandlerConfig = {}) {\n this.config = {\n showToast: true,\n ...config,\n };\n }\n\n handle(error: ApiError): void {\n const code = error.code;\n\n logger.error('Handling API Error', undefined, {\n code,\n status: error.status,\n traceId: error.traceId,\n });\n\n // Try custom handler first\n if (this.config.handlers?.[code]) {\n this.config.handlers[code]!(error);\n return;\n }\n\n // Fallback\n if (this.config.onError) {\n this.config.onError(error);\n } else {\n this.showDefaultToast(error);\n }\n }\n\n private showToast(message: string, type: 'error' | 'success' | 'info'): void {\n if (this.config.showToast && this.config.toast) {\n this.config.toast(message, type);\n }\n }\n\n private showDefaultToast(error: ApiError): void {\n const message =\n this.config.toastMessages?.[error.code] ||\n error.problemDetails.detail ||\n 'An error occurred';\n this.showToast(message, 'error');\n }\n}\n\n/**\n * Create global error handler\n */\nexport function createErrorHandler(config?: ErrorHandlerConfig): ErrorHandler {\n return new ErrorHandler(config);\n}\n\n/**\n * Map validation errors to form fields\n */\nexport function mapValidationErrors(errors: ValidationError[]): Record<string, string> {\n const mapped: Record<string, string> = {};\n for (const error of errors) {\n const fieldName = error.field.charAt(0).toLowerCase() + error.field.slice(1);\n mapped[fieldName] = error.message;\n }\n return mapped;\n}\n","/**\n * Retry Handler\n * \n * Retry logic for API requests.\n */\n\nimport type { RetryConfig } from './types';\n\nconst DEFAULT_RETRY_CONFIG: Required<RetryConfig> = {\n maxRetries: 3,\n baseDelay: 1000,\n maxDelay: 10000,\n retryCondition: (error: unknown) => {\n if (error instanceof Response) {\n return error.status >= 500 || error.status === 429;\n }\n return false;\n },\n};\n\n/**\n * Calculate backoff delay\n */\nexport function calculateBackoffDelay(\n attempt: number,\n baseDelay: number,\n maxDelay: number\n): number {\n const delay = baseDelay * Math.pow(2, attempt);\n const jitter = Math.random() * 0.3 * delay;\n return Math.min(delay + jitter, maxDelay);\n}\n\n/**\n * Check if error is retryable\n */\nexport function isRetryableError(error: unknown): boolean {\n if (error instanceof Response) {\n return error.status >= 500 || error.status === 429;\n }\n if (error instanceof TypeError) {\n // Network errors\n return true;\n }\n return false;\n}\n\n/**\n * Execute function with retry logic\n */\nexport async function withRetry<T>(\n fn: () => Promise<T>,\n config?: RetryConfig\n): Promise<T> {\n const { maxRetries, baseDelay, maxDelay, retryCondition } = {\n ...DEFAULT_RETRY_CONFIG,\n ...config,\n };\n\n let lastError: unknown;\n\n for (let attempt = 0; attempt <= maxRetries; attempt++) {\n try {\n return await fn();\n } catch (error) {\n lastError = error;\n\n if (attempt === maxRetries || !retryCondition(error)) {\n throw error;\n }\n\n const delay = calculateBackoffDelay(attempt, baseDelay, maxDelay);\n console.log(`Retry attempt ${attempt + 1}/${maxRetries} after ${delay}ms`);\n await new Promise((resolve) => setTimeout(resolve, delay));\n }\n }\n\n throw lastError;\n}\n\n/**\n * Fetch with timeout\n */\nexport async function fetchWithTimeout(\n input: RequestInfo | URL,\n init?: RequestInit & { timeout?: number }\n): Promise<Response> {\n const { timeout = 30000, ...fetchInit } = init || {};\n\n const controller = new AbortController();\n const timeoutId = setTimeout(() => controller.abort(), timeout);\n\n try {\n const response = await fetch(input, {\n ...fetchInit,\n signal: controller.signal,\n });\n return response;\n } finally {\n clearTimeout(timeoutId);\n }\n}\n\n/**\n * Create fetch function with retry\n */\nexport function createRetryFetch(config?: RetryConfig) {\n return async (input: RequestInfo | URL, init?: RequestInit): Promise<Response> => {\n return withRetry(() => fetch(input, init), config);\n };\n}\n"],"mappings":";;;;;;;;;AAOA,MAAa,aAAa;CAExB,YAAY,EACV,QAAQ,mBACT;CAGD,UAAU;EACR,oBAAoB;EACpB,cAAc;EACd,sBAAsB;EACtB,wBAAwB;EACxB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,KAAK,CACzB,OAAO,EAAE,OAAO,EAChB,kBAAkB,CAAC,EAAE,MAAM,GAAG,YAAY,GACzC,OAAO,CAAC,QAAQ,CAAC,CAgGnB;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,cAAc,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,CA0OxE;AAED;;;;;;;GAOG;AACH,wBAAsB,MAAM,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,CAkGhE;AAED;;;;;;;GAOG;AACH,wBAAsB,uBAAuB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,CA8CjF;AAED;;;;;GAKG;AACH,wBAAsB,wBAAwB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,CAmClF;AAED;;GAEG;AACH,wBAAsB,OAAO,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CAQxE;AAED;;GAEG;AACH,wBAAsB,WAAW,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,CAWrE;AAED;;GAEG;AACH,wBAAsB,cAAc,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAQ7E;AAED;;GAEG;AACH,wBAAsB,aAAa,CACjC,OAAO,EAAE,OAAO,EAChB,YAAY,CAAC,EAAE,MAAM,GACpB,OAAO,CAAC,kBAAkB,CAAC,CAiD7B;AAGD,OAAO,EAAE,cAAc,EAAE,CAAC;AAE1B;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,IAAI,CAG3C"}
@@ -0,0 +1,5 @@
1
+ import type { LoginOptions } from './types';
2
+ export declare function sanitizeExtraAuthorizationParameters(params: LoginOptions['extraAuthParams'] | undefined, options?: Pick<LoginOptions, 'extraAuthParamNames' | 'extraAuthParamPrefixes'>): Record<string, string>;
3
+ export declare function normalizePublicAuthorizationStateContext(context: LoginOptions['publicStateContext']): Record<string, string> | null;
4
+ export declare function buildAuthorizationState(baseState: string, publicStateContext: LoginOptions['publicStateContext']): string;
5
+ //# sourceMappingURL=authorization-parameters.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authorization-parameters.d.ts","sourceRoot":"","sources":["../../src/auth/authorization-parameters.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAgC5C,wBAAgB,oCAAoC,CAClD,MAAM,EAAE,YAAY,CAAC,iBAAiB,CAAC,GAAG,SAAS,EACnD,OAAO,GAAE,IAAI,CAAC,YAAY,EAAE,qBAAqB,GAAG,wBAAwB,CAAM,GACjF,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAmCxB;AAED,wBAAgB,wCAAwC,CACtD,OAAO,EAAE,YAAY,CAAC,oBAAoB,CAAC,GAC1C,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CA2B/B;AAED,wBAAgB,uBAAuB,CACrC,SAAS,EAAE,MAAM,EACjB,kBAAkB,EAAE,YAAY,CAAC,oBAAoB,CAAC,GACrD,MAAM,CAOR"}
@@ -13,6 +13,8 @@ export declare function shouldRefreshToken(request: Request): Promise<boolean>;
13
13
  */
14
14
  export interface DefaultRouteIdentityContext {
15
15
  hasAnyMembership: boolean;
16
+ hasEntitlement?: boolean;
17
+ /** @deprecated Use hasEntitlement or app-specific fields instead. */
16
18
  hasSubscription: boolean;
17
19
  isOnboarded: boolean;
18
20
  }
@@ -30,7 +32,9 @@ export interface TenantChecker {
30
32
  } | null>;
31
33
  }
32
34
  /**
33
- * Subscription checker configuration
35
+ * Legacy subscription checker configuration
36
+ *
37
+ * @deprecated Put entitlement policy in resolveRoute or app-level route loaders.
34
38
  */
35
39
  export interface SubscriptionChecker {
36
40
  checkTenantSubscriptionStatus: (request: Request, tenantId: string) => Promise<boolean>;
@@ -77,7 +81,7 @@ export interface RouteProtectionConfig<TIdentityContext = DefaultRouteIdentityCo
77
81
  createAutomaticLogoutRequest?: (context: AutomaticLogoutRequestContext) => Promise<Request> | Request;
78
82
  }
79
83
  /**
80
- * Configure route protection with identity/tenant/subscription checkers
84
+ * Configure route protection with identity, tenant, and app policy checkers
81
85
  */
82
86
  export declare function configureRouteProtection<TIdentityContext = DefaultRouteIdentityContext>(config: RouteProtectionConfig<TIdentityContext>): void;
83
87
  /**
@@ -97,11 +101,23 @@ export declare const publicRoute: <T>(request: Request, loaderFn: (user?: UserIn
97
101
  */
98
102
  export declare const authRoute: <T>(request: Request, loaderFn: (user: UserInfo) => Promise<T> | T) => Promise<T>;
99
103
  /**
100
- * Onboarding route
104
+ * Generic policy-protected route. Apps define policy in configureRouteProtection.
105
+ */
106
+ export declare const policyRoute: <T>(request: Request, loaderFn: (user: UserInfo) => Promise<T> | T) => Promise<T>;
107
+ /**
108
+ * Alias for auth-protected routes.
109
+ */
110
+ export declare const protectedRoute: <T>(request: Request, loaderFn: (user: UserInfo) => Promise<T> | T) => Promise<T>;
111
+ /**
112
+ * Setup policy route
113
+ *
114
+ * @deprecated Use policyRoute with configureRouteProtection instead.
101
115
  */
102
116
  export declare const onboardingRoute: <T>(request: Request, loaderFn: (user: UserInfo) => Promise<T> | T) => Promise<T>;
103
117
  /**
104
- * Subscription route
118
+ * Entitlement policy route
119
+ *
120
+ * @deprecated Use policyRoute with configureRouteProtection instead.
105
121
  */
106
122
  export declare const subscriptionRoute: <T>(request: Request, loaderFn: (user: UserInfo) => Promise<T> | T) => Promise<T>;
107
123
  //# sourceMappingURL=route-protection.server.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"route-protection.server.d.ts","sourceRoot":"","sources":["../../src/auth/route-protection.server.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAazD;;GAEG;AACH,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,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,CAAC,IAAI,EAAE,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,eAcP,CAAC;AAExC;;;;GAIG;AACH,eAAO,MAAM,eAAe,GAAI,CAAC,EAC/B,SAAS,OAAO,EAChB,UAAU,CAAC,IAAI,EAAE,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,eACoD,CAAC;AAEnG;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,GAAI,CAAC,EACjC,SAAS,OAAO,EAChB,UAAU,CAAC,IAAI,EAAE,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,eACsD,CAAC"}
@@ -8,6 +8,6 @@ export * from './auth.server';
8
8
  export * from './redis-session-storage.server';
9
9
  export * from './route-protection.server';
10
10
  export * from './token-refresh.server';
11
- export type { ApplicationType, AuthSessionSummary, AuthClaimMapping, AuthConfig, AuthError, BackChannelLogoutResult, FrontChannelLogoutResult, LoginOptions, OAuthState, OidcClientAuthMethod, ProtectedLoaderFn, ProtectionLevel, SessionData, SessionFlashData, UserInfo, } from './types';
11
+ export type { ApplicationType, AuthSessionSummary, AuthClaimMapping, AuthConfig, AuthError, BackChannelLogoutResult, FrontChannelLogoutResult, LoginOptions, OAuthState, OidcClientAuthMethod, ProtectedLoaderFn, ProtectionLevel, PublicAuthorizationStateContext, SessionData, SessionFlashData, UserInfo, } from './types';
12
12
  export type { TokenRefreshResult as AuthTokenRefreshResult, } from './types';
13
13
  //# sourceMappingURL=server.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/auth/server.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,cAAc,eAAe,CAAC;AAC9B,cAAc,gCAAgC,CAAC;AAC/C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC;AACvC,YAAY,EACV,eAAe,EACf,kBAAkB,EAClB,gBAAgB,EAChB,UAAU,EACV,SAAS,EACT,uBAAuB,EACvB,wBAAwB,EACxB,YAAY,EACZ,UAAU,EACV,oBAAoB,EACpB,iBAAiB,EACjB,eAAe,EACf,WAAW,EACX,gBAAgB,EAChB,QAAQ,GACT,MAAM,SAAS,CAAC;AACjB,YAAY,EACV,kBAAkB,IAAI,sBAAsB,GAC7C,MAAM,SAAS,CAAC"}
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/auth/server.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,cAAc,eAAe,CAAC;AAC9B,cAAc,gCAAgC,CAAC;AAC/C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC;AACvC,YAAY,EACV,eAAe,EACf,kBAAkB,EAClB,gBAAgB,EAChB,UAAU,EACV,SAAS,EACT,uBAAuB,EACvB,wBAAwB,EACxB,YAAY,EACZ,UAAU,EACV,oBAAoB,EACpB,iBAAiB,EACjB,eAAe,EACf,+BAA+B,EAC/B,WAAW,EACX,gBAAgB,EAChB,QAAQ,GACT,MAAM,SAAS,CAAC;AACjB,YAAY,EACV,kBAAkB,IAAI,sBAAsB,GAC7C,MAAM,SAAS,CAAC"}
@@ -1,6 +1,6 @@
1
- import "../logging-_h2mi3L9.js";
2
- import { AUTH_ERROR_COOKIE_PREFIX, cleanupExpiredOAuthStates, closeRedisConnection, createAuthSession, createOAuthState, deleteOAuthState, destroyAuthSession, destroyAuthSessionById, destroyAuthSessionsByIdentitySession, destroyAuthSessionsBySessionState, destroyAuthSessionsBySid, destroyAuthSessionsForUser, getAuthSession, getAuthSessionById, getCurrentAuthSessionId, getOAuthState, isSessionValid, listAuthSessionDataForUser, listAuthSessionsForUser, listCurrentUserAuthSessions, requireAuthSession, updateAuthSession } from "../redis-session-storage.server-D0-72FV-.js";
3
- import { clearAuthErrorHeaders, clearAuthServerCache, configureAuthClaimMapping, extractUserInfo, getAccessToken, getAuthError, getUser, handleBackChannelLogout, handleCallback, handleFrontChannelLogout, hasAuthError, login, logout, refreshTokens, requireAuth, resetAuthClaimMapping } from "../auth.server-B3ODGIX4.js";
4
- import { attemptTokenRefresh, authRoute, configureRouteProtection, isTokenExpiredResponse, onboardingRoute, protectRoute, publicRoute, resetRouteProtectionConfig, shouldAttemptTokenRefresh, shouldRefreshToken, subscriptionRoute } from "../server-B7JN86_0.js";
1
+ import "../logging-DviiAkLx.js";
2
+ import { AUTH_ERROR_COOKIE_PREFIX, cleanupExpiredOAuthStates, closeRedisConnection, createAuthSession, createOAuthState, deleteOAuthState, destroyAuthSession, destroyAuthSessionById, destroyAuthSessionsByIdentitySession, destroyAuthSessionsBySessionState, destroyAuthSessionsBySid, destroyAuthSessionsForUser, getAuthSession, getAuthSessionById, getCurrentAuthSessionId, getOAuthState, isSessionValid, listAuthSessionDataForUser, listAuthSessionsForUser, listCurrentUserAuthSessions, requireAuthSession, updateAuthSession } from "../redis-session-storage.server-v2VcpFsQ.js";
3
+ import { clearAuthErrorHeaders, clearAuthServerCache, configureAuthClaimMapping, extractUserInfo, getAccessToken, getAuthError, getUser, handleBackChannelLogout, handleCallback, handleFrontChannelLogout, hasAuthError, login, logout, refreshTokens, requireAuth, resetAuthClaimMapping } from "../auth.server-D5oiz9aF.js";
4
+ import { attemptTokenRefresh, authRoute, configureRouteProtection, isTokenExpiredResponse, onboardingRoute, policyRoute, protectRoute, protectedRoute, publicRoute, resetRouteProtectionConfig, shouldAttemptTokenRefresh, shouldRefreshToken, subscriptionRoute } from "../server-B6PCxc-T.js";
5
5
 
6
- export { AUTH_ERROR_COOKIE_PREFIX, attemptTokenRefresh, authRoute, cleanupExpiredOAuthStates, clearAuthErrorHeaders, clearAuthServerCache, closeRedisConnection, configureAuthClaimMapping, configureRouteProtection, createAuthSession, createOAuthState, deleteOAuthState, destroyAuthSession, destroyAuthSessionById, destroyAuthSessionsByIdentitySession, destroyAuthSessionsBySessionState, destroyAuthSessionsBySid, destroyAuthSessionsForUser, extractUserInfo, getAccessToken, getAuthError, getAuthSession, getAuthSessionById, getCurrentAuthSessionId, getOAuthState, getUser, handleBackChannelLogout, handleCallback, handleFrontChannelLogout, hasAuthError, isSessionValid, isTokenExpiredResponse, listAuthSessionDataForUser, listAuthSessionsForUser, listCurrentUserAuthSessions, login, logout, onboardingRoute, protectRoute, publicRoute, refreshTokens, requireAuth, requireAuthSession, resetAuthClaimMapping, resetRouteProtectionConfig, shouldAttemptTokenRefresh, shouldRefreshToken, subscriptionRoute, updateAuthSession };
6
+ export { AUTH_ERROR_COOKIE_PREFIX, attemptTokenRefresh, authRoute, cleanupExpiredOAuthStates, clearAuthErrorHeaders, clearAuthServerCache, closeRedisConnection, configureAuthClaimMapping, configureRouteProtection, createAuthSession, createOAuthState, deleteOAuthState, destroyAuthSession, destroyAuthSessionById, destroyAuthSessionsByIdentitySession, destroyAuthSessionsBySessionState, destroyAuthSessionsBySid, destroyAuthSessionsForUser, extractUserInfo, getAccessToken, getAuthError, getAuthSession, getAuthSessionById, getCurrentAuthSessionId, getOAuthState, getUser, handleBackChannelLogout, handleCallback, handleFrontChannelLogout, hasAuthError, isSessionValid, isTokenExpiredResponse, listAuthSessionDataForUser, listAuthSessionsForUser, listCurrentUserAuthSessions, login, logout, onboardingRoute, policyRoute, protectRoute, protectedRoute, publicRoute, refreshTokens, requireAuth, requireAuthSession, resetAuthClaimMapping, resetRouteProtectionConfig, shouldAttemptTokenRefresh, shouldRefreshToken, subscriptionRoute, updateAuthSession };
@@ -162,11 +162,16 @@ export interface TokenRefreshResult {
162
162
  /**
163
163
  * Route protection levels
164
164
  */
165
- export type ProtectionLevel = 'public' | 'auth' | 'onboarding-required' | 'subscription-required';
165
+ export type ProtectionLevel = 'public' | 'auth' | 'policy'
166
+ /** @deprecated Use policy with configureRouteProtection instead. */
167
+ | 'onboarding-required'
168
+ /** @deprecated Use policy with configureRouteProtection instead. */
169
+ | 'subscription-required';
166
170
  /**
167
171
  * Protected route loader function type
168
172
  */
169
173
  export type ProtectedLoaderFn<T> = (user?: UserInfo) => Promise<T> | T;
174
+ export type PublicAuthorizationStateContext = Record<string, string | number | boolean | null | undefined>;
170
175
  /**
171
176
  * Login options
172
177
  */
@@ -179,12 +184,29 @@ export interface LoginOptions {
179
184
  * Additional authorization request parameters.
180
185
  *
181
186
  * Use this for safe provider hints: `login_hint`, `ui_locales`,
182
- * `acr_values`, `kc_idp_hint`, or custom `uf_` theme context parameters.
187
+ * `acr_values`, `kc_idp_hint`, or app-specific provider hints allowed by
188
+ * `extraAuthParamNames` / `extraAuthParamPrefixes`.
183
189
  * Security-sensitive protocol parameters such as state, nonce, redirect_uri,
184
190
  * scope, PKCE, prompt, and kc_action are managed by Spine and cannot be
185
191
  * overridden.
186
192
  */
187
193
  extraAuthParams?: Record<string, string | number | boolean | null | undefined>;
194
+ /**
195
+ * Additional non-sensitive authorization parameter names allowed for this
196
+ * login request. Use this for app-specific identity-provider theme hints.
197
+ */
198
+ extraAuthParamNames?: string[];
199
+ /**
200
+ * Additional non-sensitive authorization parameter prefixes allowed for this
201
+ * login request. Prefixes should be narrow and app-owned.
202
+ */
203
+ extraAuthParamPrefixes?: string[];
204
+ /**
205
+ * Optional public, non-secret UI context appended to the OAuth state value.
206
+ * This exists for identity-provider themes that need display hints while the
207
+ * server still validates the full exact state value during callback handling.
208
+ */
209
+ publicStateContext?: PublicAuthorizationStateContext;
188
210
  /**
189
211
  * Keycloak application initiated action.
190
212
  *
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/auth/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;GAGG;AACH,MAAM,MAAM,eAAe,GACvB,iBAAiB,GACjB,cAAc,GACd,WAAW,GACX,YAAY,GACZ,QAAQ,CAAC;AAEb,MAAM,MAAM,oBAAoB,GAC5B,MAAM,GACN,oBAAoB,GACpB,qBAAqB,CAAC;AAE1B;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAA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,GAAG,OAAO,GAAG,IAAI,GAAG,SAAS,CAAC,CAAC;IAC/E;;;OAGG;IACH,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC/B;;;OAGG;IACH,sBAAsB,CAAC,EAAE,MAAM,EAAE,CAAC;IAClC;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,+BAA+B,CAAC;IACrD;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,2DAA2D;IAC3D,KAAK,EAAE,MAAM,CAAC;IACd,uCAAuC;IACvC,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB"}
@@ -1,5 +1,5 @@
1
- import { logger } from "./logging-_h2mi3L9.js";
2
- import { AUTH_ERROR_COOKIE_PREFIX, createAuthSession, createOAuthState, deleteOAuthState, destroyAuthSession, destroyAuthSessionsByIdentitySession, destroyAuthSessionsBySid, destroyAuthSessionsForUser, getAuthSession, getOAuthState, listAuthSessionDataForUser, updateAuthSession } from "./redis-session-storage.server-D0-72FV-.js";
1
+ import { logger } from "./logging-DviiAkLx.js";
2
+ import { AUTH_ERROR_COOKIE_PREFIX, createAuthSession, createOAuthState, deleteOAuthState, destroyAuthSession, destroyAuthSessionsByIdentitySession, destroyAuthSessionsBySid, destroyAuthSessionsForUser, getAuthSession, getOAuthState, listAuthSessionDataForUser, updateAuthSession } from "./redis-session-storage.server-v2VcpFsQ.js";
3
3
  import * as oidc from "openid-client";
4
4
  import { createRemoteJWKSet, jwtVerify } from "jose";
5
5
 
@@ -16,6 +16,63 @@ function createRedirectResponse(location, init = {}) {
16
16
  });
17
17
  }
18
18
 
19
+ //#endregion
20
+ //#region src/auth/authorization-parameters.ts
21
+ const RESERVED_AUTHORIZATION_PARAMETER_NAMES = new Set([
22
+ "client_id",
23
+ "code_challenge",
24
+ "code_challenge_method",
25
+ "kc_action",
26
+ "nonce",
27
+ "prompt",
28
+ "redirect_uri",
29
+ "response_mode",
30
+ "response_type",
31
+ "scope",
32
+ "state"
33
+ ]);
34
+ const DEFAULT_EXTRA_AUTHORIZATION_PARAMETER_NAMES = new Set([
35
+ "acr_values",
36
+ "kc_idp_hint",
37
+ "login_hint",
38
+ "ui_locales"
39
+ ]);
40
+ function isAllowedExtraAuthorizationParameter(key, allowedNames, allowedPrefixes) {
41
+ const normalized = key.toLowerCase();
42
+ return allowedNames.has(normalized) || allowedPrefixes.some((prefix) => normalized.startsWith(prefix));
43
+ }
44
+ function sanitizeExtraAuthorizationParameters(params, options = {}) {
45
+ if (!params) return {};
46
+ const allowedNames = new Set([...DEFAULT_EXTRA_AUTHORIZATION_PARAMETER_NAMES, ...(options.extraAuthParamNames ?? []).map((name) => name.trim().toLowerCase()).filter(Boolean)]);
47
+ const allowedPrefixes = (options.extraAuthParamPrefixes ?? []).map((prefix) => prefix.trim().toLowerCase()).filter(Boolean);
48
+ const sanitized = {};
49
+ for (const [key, value] of Object.entries(params)) {
50
+ const normalizedKey = key.trim();
51
+ if (normalizedKey.length === 0 || RESERVED_AUTHORIZATION_PARAMETER_NAMES.has(normalizedKey.toLowerCase()) || !isAllowedExtraAuthorizationParameter(normalizedKey, allowedNames, allowedPrefixes) || value === null || value === void 0) continue;
52
+ const normalizedValue = String(value).trim();
53
+ if (normalizedValue.length === 0) continue;
54
+ sanitized[normalizedKey] = normalizedValue;
55
+ }
56
+ return sanitized;
57
+ }
58
+ function normalizePublicAuthorizationStateContext(context) {
59
+ if (!context) return null;
60
+ const normalized = {};
61
+ for (const [key, value] of Object.entries(context)) {
62
+ const normalizedKey = key.trim();
63
+ if (normalizedKey.length === 0 || RESERVED_AUTHORIZATION_PARAMETER_NAMES.has(normalizedKey.toLowerCase()) || value === null || value === void 0) continue;
64
+ const normalizedValue = String(value).trim();
65
+ if (normalizedValue.length === 0) continue;
66
+ normalized[normalizedKey] = normalizedValue;
67
+ }
68
+ return Object.keys(normalized).length > 0 ? normalized : null;
69
+ }
70
+ function buildAuthorizationState(baseState, publicStateContext) {
71
+ const normalizedContext = normalizePublicAuthorizationStateContext(publicStateContext);
72
+ if (!normalizedContext) return baseState;
73
+ return `${baseState}.${Buffer.from(JSON.stringify(normalizedContext), "utf8").toString("base64url")}`;
74
+ }
75
+
19
76
  //#endregion
20
77
  //#region src/auth/auth.server.ts
21
78
  /**
@@ -82,25 +139,6 @@ function getAuthConfig() {
82
139
  let authServerCache = null;
83
140
  const CACHE_TTL = 60 * 60 * 1e3;
84
141
  const jwksCache = new Map();
85
- const RESERVED_AUTHORIZATION_PARAMETER_NAMES = new Set([
86
- "client_id",
87
- "code_challenge",
88
- "code_challenge_method",
89
- "kc_action",
90
- "nonce",
91
- "prompt",
92
- "redirect_uri",
93
- "response_mode",
94
- "response_type",
95
- "scope",
96
- "state"
97
- ]);
98
- const ALLOWED_EXTRA_AUTHORIZATION_PARAMETER_NAMES = new Set([
99
- "acr_values",
100
- "kc_idp_hint",
101
- "login_hint",
102
- "ui_locales"
103
- ]);
104
142
  function normalizeIssuer(value) {
105
143
  const normalized = value?.trim().replace(/\/+$/, "");
106
144
  return normalized && normalized.length > 0 ? normalized : null;
@@ -186,35 +224,6 @@ function getDiscoveryOptions() {
186
224
  function getClientMetadata(config) {
187
225
  return config.clientAuthMethod === "none" ? void 0 : config.clientSecret;
188
226
  }
189
- function sanitizeExtraAuthorizationParameters(params) {
190
- if (!params) return {};
191
- const sanitized = {};
192
- for (const [key, value] of Object.entries(params)) {
193
- const normalizedKey = key.trim();
194
- if (normalizedKey.length === 0 || RESERVED_AUTHORIZATION_PARAMETER_NAMES.has(normalizedKey.toLowerCase()) || !isAllowedExtraAuthorizationParameter(normalizedKey) || value === null || value === void 0) continue;
195
- const normalizedValue = String(value).trim();
196
- if (normalizedValue.length === 0) continue;
197
- sanitized[normalizedKey] = normalizedValue;
198
- }
199
- return sanitized;
200
- }
201
- function isAllowedExtraAuthorizationParameter(key) {
202
- const normalized = key.toLowerCase();
203
- return ALLOWED_EXTRA_AUTHORIZATION_PARAMETER_NAMES.has(normalized) || normalized.startsWith("uf_");
204
- }
205
- function buildAuthorizationState(baseState, extraParams) {
206
- const uiContext = buildPublicAuthorizationUiContext(extraParams);
207
- if (!uiContext) return baseState;
208
- return `${baseState}.${Buffer.from(JSON.stringify(uiContext), "utf8").toString("base64url")}`;
209
- }
210
- function buildPublicAuthorizationUiContext(extraParams) {
211
- const inviteKind = extraParams.uf_invite;
212
- if (inviteKind !== "organization") return null;
213
- const context = { uf_invite: inviteKind };
214
- if (extraParams.uf_invite_mode) context.uf_invite_mode = extraParams.uf_invite_mode;
215
- if (extraParams.login_hint) context.login_hint = extraParams.login_hint;
216
- return context;
217
- }
218
227
  function getClientAuthentication(config) {
219
228
  switch (config.clientAuthMethod) {
220
229
  case "client_secret_basic":
@@ -615,8 +624,8 @@ async function login(request, returnUrlOrOptions) {
615
624
  const oidcConfig = await getOAuthConfig();
616
625
  const codeVerifier = oidc.randomPKCECodeVerifier();
617
626
  const codeChallenge = await oidc.calculatePKCECodeChallenge(codeVerifier);
618
- const extraAuthParams = sanitizeExtraAuthorizationParameters(options.extraAuthParams);
619
- const state = buildAuthorizationState(oidc.randomState(), extraAuthParams);
627
+ const extraAuthParams = sanitizeExtraAuthorizationParameters(options.extraAuthParams, options);
628
+ const state = buildAuthorizationState(oidc.randomState(), options.publicStateContext);
620
629
  const nonce = oidc.randomNonce();
621
630
  const oauthState = {
622
631
  state,
@@ -1054,4 +1063,4 @@ function clearAuthServerCache() {
1054
1063
 
1055
1064
  //#endregion
1056
1065
  export { clearAuthErrorHeaders, clearAuthServerCache, configureAuthClaimMapping, createRedirectResponse, extractUserInfo, getAccessToken, getAuthError, getUser, handleBackChannelLogout, handleCallback, handleFrontChannelLogout, hasAuthError, login, logout, refreshTokens, requireAuth, resetAuthClaimMapping };
1057
- //# sourceMappingURL=auth.server-B3ODGIX4.js.map
1066
+ //# sourceMappingURL=auth.server-D5oiz9aF.js.map