@niledatabase/server 5.3.3-alpha.0 → 5.3.3-alpha.2
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 +31 -4
- package/dist/index.d.ts +31 -4
- package/dist/index.js +1464 -784
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1464 -785
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
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;
|
|
@@ -546,7 +553,7 @@ declare class Server {
|
|
|
546
553
|
* Does not have a context by default
|
|
547
554
|
*/
|
|
548
555
|
get db(): pg.Pool & {
|
|
549
|
-
clearConnections: () => void
|
|
556
|
+
clearConnections: () => Promise<void>;
|
|
550
557
|
};
|
|
551
558
|
get logger(): LogReturn;
|
|
552
559
|
get extensions(): {
|
|
@@ -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
|
}
|
|
@@ -628,6 +634,8 @@ declare enum ExtensionState {
|
|
|
628
634
|
}
|
|
629
635
|
type NilePoolConfig = PoolConfig & {
|
|
630
636
|
afterCreate?: AfterCreate;
|
|
637
|
+
/** Maximum number of tenant/user pools retained simultaneously (LRU evicted). Defaults to 100. */
|
|
638
|
+
maxPools?: number;
|
|
631
639
|
};
|
|
632
640
|
type LoggerType = {
|
|
633
641
|
info: (args: unknown | unknown[]) => void;
|
|
@@ -785,17 +793,34 @@ type NileRequest<T> = NRequest<T> | T;
|
|
|
785
793
|
declare const APIErrorErrorCodeEnum: {
|
|
786
794
|
readonly InternalError: "internal_error";
|
|
787
795
|
readonly BadRequest: "bad_request";
|
|
796
|
+
readonly UnsupportedOperation: "unsupported_operation";
|
|
788
797
|
readonly EntityNotFound: "entity_not_found";
|
|
789
798
|
readonly DuplicateEntity: "duplicate_entity";
|
|
790
799
|
readonly InvalidCredentials: "invalid_credentials";
|
|
791
800
|
readonly UnknownOidcProvider: "unknown_oidc_provider";
|
|
801
|
+
readonly UnknownOidcParty: "unknown_oidc_party";
|
|
792
802
|
readonly ProviderAlreadyExists: "provider_already_exists";
|
|
793
803
|
readonly ProviderConfigError: "provider_config_error";
|
|
794
804
|
readonly ProviderMismatch: "provider_mismatch";
|
|
795
805
|
readonly ProviderUpdateError: "provider_update_error";
|
|
806
|
+
readonly ProviderDisabled: "provider_disabled";
|
|
796
807
|
readonly SessionStateMissing: "session_state_missing";
|
|
797
808
|
readonly SessionStateMismatch: "session_state_mismatch";
|
|
798
809
|
readonly OidcCodeMissing: "oidc_code_missing";
|
|
810
|
+
readonly TenantNotFound: "tenant_not_found";
|
|
811
|
+
readonly ConstraintViolation: "constraint_violation";
|
|
812
|
+
readonly SqlException: "sql_exception";
|
|
813
|
+
readonly DbCreationFailure: "db_creation_failure";
|
|
814
|
+
readonly DbStatusFailure: "db_status_failure";
|
|
815
|
+
readonly DbInitializationFailure: "db_initialization_failure";
|
|
816
|
+
readonly DbConfigMissing: "db_config_missing";
|
|
817
|
+
readonly UnauthorizedWorkspaceAccess: "unauthorized_workspace_access";
|
|
818
|
+
readonly EmailSendFailure: "email_send_failure";
|
|
819
|
+
readonly JdbcException: "jdbc_exception";
|
|
820
|
+
readonly OidcException: "oidc_exception";
|
|
821
|
+
readonly RegionMismatch: "region_mismatch";
|
|
822
|
+
readonly CredentialCreationFailure: "credential_creation_failure";
|
|
823
|
+
readonly CredentialPropagationFailure: "credential_propagation_failure";
|
|
799
824
|
};
|
|
800
825
|
type APIErrorErrorCodeEnum = (typeof APIErrorErrorCodeEnum)[keyof typeof APIErrorErrorCodeEnum];
|
|
801
826
|
interface APIError {
|
|
@@ -842,9 +867,11 @@ type CTXHandlerType = {
|
|
|
842
867
|
PUT: <T = Response>(req: Request) => Promise<ContextReturn<T>>;
|
|
843
868
|
};
|
|
844
869
|
|
|
870
|
+
declare const ctx: CTX;
|
|
871
|
+
|
|
845
872
|
declare const TENANT_COOKIE = "nile.tenant-id";
|
|
846
873
|
declare const USER_COOKIE = "nile.user-id";
|
|
847
874
|
declare const HEADER_ORIGIN = "nile-origin";
|
|
848
875
|
declare const HEADER_SECURE_COOKIES = "nile-secure-cookies";
|
|
849
876
|
|
|
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 };
|
|
877
|
+
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;
|
|
@@ -546,7 +553,7 @@ declare class Server {
|
|
|
546
553
|
* Does not have a context by default
|
|
547
554
|
*/
|
|
548
555
|
get db(): pg.Pool & {
|
|
549
|
-
clearConnections: () => void
|
|
556
|
+
clearConnections: () => Promise<void>;
|
|
550
557
|
};
|
|
551
558
|
get logger(): LogReturn;
|
|
552
559
|
get extensions(): {
|
|
@@ -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
|
}
|
|
@@ -628,6 +634,8 @@ declare enum ExtensionState {
|
|
|
628
634
|
}
|
|
629
635
|
type NilePoolConfig = PoolConfig & {
|
|
630
636
|
afterCreate?: AfterCreate;
|
|
637
|
+
/** Maximum number of tenant/user pools retained simultaneously (LRU evicted). Defaults to 100. */
|
|
638
|
+
maxPools?: number;
|
|
631
639
|
};
|
|
632
640
|
type LoggerType = {
|
|
633
641
|
info: (args: unknown | unknown[]) => void;
|
|
@@ -785,17 +793,34 @@ type NileRequest<T> = NRequest<T> | T;
|
|
|
785
793
|
declare const APIErrorErrorCodeEnum: {
|
|
786
794
|
readonly InternalError: "internal_error";
|
|
787
795
|
readonly BadRequest: "bad_request";
|
|
796
|
+
readonly UnsupportedOperation: "unsupported_operation";
|
|
788
797
|
readonly EntityNotFound: "entity_not_found";
|
|
789
798
|
readonly DuplicateEntity: "duplicate_entity";
|
|
790
799
|
readonly InvalidCredentials: "invalid_credentials";
|
|
791
800
|
readonly UnknownOidcProvider: "unknown_oidc_provider";
|
|
801
|
+
readonly UnknownOidcParty: "unknown_oidc_party";
|
|
792
802
|
readonly ProviderAlreadyExists: "provider_already_exists";
|
|
793
803
|
readonly ProviderConfigError: "provider_config_error";
|
|
794
804
|
readonly ProviderMismatch: "provider_mismatch";
|
|
795
805
|
readonly ProviderUpdateError: "provider_update_error";
|
|
806
|
+
readonly ProviderDisabled: "provider_disabled";
|
|
796
807
|
readonly SessionStateMissing: "session_state_missing";
|
|
797
808
|
readonly SessionStateMismatch: "session_state_mismatch";
|
|
798
809
|
readonly OidcCodeMissing: "oidc_code_missing";
|
|
810
|
+
readonly TenantNotFound: "tenant_not_found";
|
|
811
|
+
readonly ConstraintViolation: "constraint_violation";
|
|
812
|
+
readonly SqlException: "sql_exception";
|
|
813
|
+
readonly DbCreationFailure: "db_creation_failure";
|
|
814
|
+
readonly DbStatusFailure: "db_status_failure";
|
|
815
|
+
readonly DbInitializationFailure: "db_initialization_failure";
|
|
816
|
+
readonly DbConfigMissing: "db_config_missing";
|
|
817
|
+
readonly UnauthorizedWorkspaceAccess: "unauthorized_workspace_access";
|
|
818
|
+
readonly EmailSendFailure: "email_send_failure";
|
|
819
|
+
readonly JdbcException: "jdbc_exception";
|
|
820
|
+
readonly OidcException: "oidc_exception";
|
|
821
|
+
readonly RegionMismatch: "region_mismatch";
|
|
822
|
+
readonly CredentialCreationFailure: "credential_creation_failure";
|
|
823
|
+
readonly CredentialPropagationFailure: "credential_propagation_failure";
|
|
799
824
|
};
|
|
800
825
|
type APIErrorErrorCodeEnum = (typeof APIErrorErrorCodeEnum)[keyof typeof APIErrorErrorCodeEnum];
|
|
801
826
|
interface APIError {
|
|
@@ -842,9 +867,11 @@ type CTXHandlerType = {
|
|
|
842
867
|
PUT: <T = Response>(req: Request) => Promise<ContextReturn<T>>;
|
|
843
868
|
};
|
|
844
869
|
|
|
870
|
+
declare const ctx: CTX;
|
|
871
|
+
|
|
845
872
|
declare const TENANT_COOKIE = "nile.tenant-id";
|
|
846
873
|
declare const USER_COOKIE = "nile.user-id";
|
|
847
874
|
declare const HEADER_ORIGIN = "nile-origin";
|
|
848
875
|
declare const HEADER_SECURE_COOKIES = "nile-secure-cookies";
|
|
849
876
|
|
|
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 };
|
|
877
|
+
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 };
|