@niledatabase/server 5.3.3-alpha.0 → 5.3.3-alpha.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.
package/dist/index.d.mts CHANGED
@@ -33,6 +33,12 @@ declare class Config {
33
33
  extensions?: Extension[];
34
34
  logger: LogReturn;
35
35
  context: PartialContext;
36
+ /** @internal True for lightweight per-request scoped Server handles */
37
+ isScoped?: boolean;
38
+ /** @internal True once a scoped handle has already hydrated extensions */
39
+ skipDefaultExtensions?: boolean;
40
+ /** @internal ALS store associated with a callback-scoped handle */
41
+ boundStore?: PartialContext;
36
42
  /**
37
43
  * The nile-auth url
38
44
  */
@@ -70,6 +76,7 @@ type Routes = {
70
76
  ERROR: string;
71
77
  ME: string;
72
78
  USER_TENANTS: string;
79
+ USER: string;
73
80
  USERS: string;
74
81
  TENANTS: string;
75
82
  TENANT: string;
@@ -571,8 +578,7 @@ declare class Server {
571
578
  noContext(): Promise<this>;
572
579
  noContext<T>(fn: (sdk: this) => Promise<T>): Promise<T>;
573
580
  /**
574
- *
575
- * @returns the last used (basically global) context object, useful for debugging or making your own context
581
+ * Returns a snapshot of the active AsyncLocalStorage context, or this instance's bound context.
576
582
  */
577
583
  getContext(): Context;
578
584
  }
@@ -842,9 +848,11 @@ type CTXHandlerType = {
842
848
  PUT: <T = Response>(req: Request) => Promise<ContextReturn<T>>;
843
849
  };
844
850
 
851
+ declare const ctx: CTX;
852
+
845
853
  declare const TENANT_COOKIE = "nile.tenant-id";
846
854
  declare const USER_COOKIE = "nile.user-id";
847
855
  declare const HEADER_ORIGIN = "nile-origin";
848
856
  declare const HEADER_SECURE_COOKIES = "nile-secure-cookies";
849
857
 
850
- export { type APIError, APIErrorErrorCodeEnum, type ActiveSession, type AfterCreate, type CTX, type CTXHandlerType, type Context, type ContextReturn, type CreateBasicUserRequest, type CreateTenantUserRequest, type Extension, type ExtensionResult, ExtensionState, HEADER_ORIGIN, HEADER_SECURE_COOKIES, type Invite, type JWT, type LoggerType, type LoginUserResponse, type LoginUserResponseToken, LoginUserResponseTokenTypeEnum, create as Nile, type NileConfig, type NileDb, type NileHandlers, type NilePoolConfig, type NileRequest, type NileResponse, type Opts, type PartialContext, type Providers, type RouteFunctions, type RouteReturn, Server, TENANT_COOKIE, type Tenant, USER_COOKIE, type User, parseCSRF, parseCallback, parseResetToken, parseTenantId, parseToken };
858
+ export { type APIError, APIErrorErrorCodeEnum, type ActiveSession, type AfterCreate, type CTX, type CTXHandlerType, type Context, type ContextReturn, type CreateBasicUserRequest, type CreateTenantUserRequest, type Extension, type ExtensionResult, ExtensionState, HEADER_ORIGIN, HEADER_SECURE_COOKIES, type Invite, type JWT, type LoggerType, type LoginUserResponse, type LoginUserResponseToken, LoginUserResponseTokenTypeEnum, create as Nile, type NileConfig, type NileDb, type NileHandlers, type NilePoolConfig, type NileRequest, type NileResponse, type Opts, type PartialContext, type Providers, type RouteFunctions, type RouteReturn, Server, TENANT_COOKIE, type Tenant, USER_COOKIE, type User, ctx, parseCSRF, parseCallback, parseResetToken, parseTenantId, parseToken };
package/dist/index.d.ts CHANGED
@@ -33,6 +33,12 @@ declare class Config {
33
33
  extensions?: Extension[];
34
34
  logger: LogReturn;
35
35
  context: PartialContext;
36
+ /** @internal True for lightweight per-request scoped Server handles */
37
+ isScoped?: boolean;
38
+ /** @internal True once a scoped handle has already hydrated extensions */
39
+ skipDefaultExtensions?: boolean;
40
+ /** @internal ALS store associated with a callback-scoped handle */
41
+ boundStore?: PartialContext;
36
42
  /**
37
43
  * The nile-auth url
38
44
  */
@@ -70,6 +76,7 @@ type Routes = {
70
76
  ERROR: string;
71
77
  ME: string;
72
78
  USER_TENANTS: string;
79
+ USER: string;
73
80
  USERS: string;
74
81
  TENANTS: string;
75
82
  TENANT: string;
@@ -571,8 +578,7 @@ declare class Server {
571
578
  noContext(): Promise<this>;
572
579
  noContext<T>(fn: (sdk: this) => Promise<T>): Promise<T>;
573
580
  /**
574
- *
575
- * @returns the last used (basically global) context object, useful for debugging or making your own context
581
+ * Returns a snapshot of the active AsyncLocalStorage context, or this instance's bound context.
576
582
  */
577
583
  getContext(): Context;
578
584
  }
@@ -842,9 +848,11 @@ type CTXHandlerType = {
842
848
  PUT: <T = Response>(req: Request) => Promise<ContextReturn<T>>;
843
849
  };
844
850
 
851
+ declare const ctx: CTX;
852
+
845
853
  declare const TENANT_COOKIE = "nile.tenant-id";
846
854
  declare const USER_COOKIE = "nile.user-id";
847
855
  declare const HEADER_ORIGIN = "nile-origin";
848
856
  declare const HEADER_SECURE_COOKIES = "nile-secure-cookies";
849
857
 
850
- export { type APIError, APIErrorErrorCodeEnum, type ActiveSession, type AfterCreate, type CTX, type CTXHandlerType, type Context, type ContextReturn, type CreateBasicUserRequest, type CreateTenantUserRequest, type Extension, type ExtensionResult, ExtensionState, HEADER_ORIGIN, HEADER_SECURE_COOKIES, type Invite, type JWT, type LoggerType, type LoginUserResponse, type LoginUserResponseToken, LoginUserResponseTokenTypeEnum, create as Nile, type NileConfig, type NileDb, type NileHandlers, type NilePoolConfig, type NileRequest, type NileResponse, type Opts, type PartialContext, type Providers, type RouteFunctions, type RouteReturn, Server, TENANT_COOKIE, type Tenant, USER_COOKIE, type User, parseCSRF, parseCallback, parseResetToken, parseTenantId, parseToken };
858
+ export { type APIError, APIErrorErrorCodeEnum, type ActiveSession, type AfterCreate, type CTX, type CTXHandlerType, type Context, type ContextReturn, type CreateBasicUserRequest, type CreateTenantUserRequest, type Extension, type ExtensionResult, ExtensionState, HEADER_ORIGIN, HEADER_SECURE_COOKIES, type Invite, type JWT, type LoggerType, type LoginUserResponse, type LoginUserResponseToken, LoginUserResponseTokenTypeEnum, create as Nile, type NileConfig, type NileDb, type NileHandlers, type NilePoolConfig, type NileRequest, type NileResponse, type Opts, type PartialContext, type Providers, type RouteFunctions, type RouteReturn, Server, TENANT_COOKIE, type Tenant, USER_COOKIE, type User, ctx, parseCSRF, parseCallback, parseResetToken, parseTenantId, parseToken };