@niledatabase/server 5.3.3-alpha.1 → 5.3.3-alpha.3
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 +24 -5
- package/dist/index.d.ts +24 -5
- package/dist/index.js +712 -325
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +712 -325
- package/dist/index.mjs.map +1 -1
- package/package.json +25 -38
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import pg, { Pool,
|
|
1
|
+
import pg, { Pool, PoolClient, PoolConfig } from 'pg';
|
|
2
2
|
|
|
3
3
|
type LogFunction = (message: string | unknown, meta?: Record<string, unknown>) => void;
|
|
4
4
|
type Loggable = {
|
|
@@ -553,7 +553,7 @@ declare class Server {
|
|
|
553
553
|
* Does not have a context by default
|
|
554
554
|
*/
|
|
555
555
|
get db(): pg.Pool & {
|
|
556
|
-
clearConnections: () => void
|
|
556
|
+
clearConnections: () => Promise<void>;
|
|
557
557
|
};
|
|
558
558
|
get logger(): LogReturn;
|
|
559
559
|
get extensions(): {
|
|
@@ -611,11 +611,11 @@ type ExtensionResult<TParams> = {
|
|
|
611
611
|
id: string;
|
|
612
612
|
withContext?: (ctx: CTX) => Promise<void>;
|
|
613
613
|
onRequest?: (params: TParams, ctx: CTX) => void | Promise<void | RequestInit>;
|
|
614
|
-
onResponse?: (params: TParams, ctx: CTX) => void | Promise<void>;
|
|
614
|
+
onResponse?: (params: TParams, ctx: CTX) => void | Response | Promise<void | Response>;
|
|
615
615
|
onHandleRequest?: (params?: TParams) => RouteReturn | Promise<RouteReturn>;
|
|
616
616
|
onConfigure?: (instance: Server) => void;
|
|
617
|
-
withUserId?: () => string
|
|
618
|
-
withTenantId?: () => string
|
|
617
|
+
withUserId?: () => string | null | undefined | Promise<string | null | undefined>;
|
|
618
|
+
withTenantId?: () => string | null | undefined | Promise<string | null | undefined>;
|
|
619
619
|
replace?: {
|
|
620
620
|
handlers: (handlers: NileHandlers) => Any;
|
|
621
621
|
};
|
|
@@ -634,6 +634,8 @@ declare enum ExtensionState {
|
|
|
634
634
|
}
|
|
635
635
|
type NilePoolConfig = PoolConfig & {
|
|
636
636
|
afterCreate?: AfterCreate;
|
|
637
|
+
/** Maximum number of tenant/user pools retained simultaneously (LRU evicted). Defaults to 100. */
|
|
638
|
+
maxPools?: number;
|
|
637
639
|
};
|
|
638
640
|
type LoggerType = {
|
|
639
641
|
info: (args: unknown | unknown[]) => void;
|
|
@@ -791,17 +793,34 @@ type NileRequest<T> = NRequest<T> | T;
|
|
|
791
793
|
declare const APIErrorErrorCodeEnum: {
|
|
792
794
|
readonly InternalError: "internal_error";
|
|
793
795
|
readonly BadRequest: "bad_request";
|
|
796
|
+
readonly UnsupportedOperation: "unsupported_operation";
|
|
794
797
|
readonly EntityNotFound: "entity_not_found";
|
|
795
798
|
readonly DuplicateEntity: "duplicate_entity";
|
|
796
799
|
readonly InvalidCredentials: "invalid_credentials";
|
|
797
800
|
readonly UnknownOidcProvider: "unknown_oidc_provider";
|
|
801
|
+
readonly UnknownOidcParty: "unknown_oidc_party";
|
|
798
802
|
readonly ProviderAlreadyExists: "provider_already_exists";
|
|
799
803
|
readonly ProviderConfigError: "provider_config_error";
|
|
800
804
|
readonly ProviderMismatch: "provider_mismatch";
|
|
801
805
|
readonly ProviderUpdateError: "provider_update_error";
|
|
806
|
+
readonly ProviderDisabled: "provider_disabled";
|
|
802
807
|
readonly SessionStateMissing: "session_state_missing";
|
|
803
808
|
readonly SessionStateMismatch: "session_state_mismatch";
|
|
804
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";
|
|
805
824
|
};
|
|
806
825
|
type APIErrorErrorCodeEnum = (typeof APIErrorErrorCodeEnum)[keyof typeof APIErrorErrorCodeEnum];
|
|
807
826
|
interface APIError {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import pg, { Pool,
|
|
1
|
+
import pg, { Pool, PoolClient, PoolConfig } from 'pg';
|
|
2
2
|
|
|
3
3
|
type LogFunction = (message: string | unknown, meta?: Record<string, unknown>) => void;
|
|
4
4
|
type Loggable = {
|
|
@@ -553,7 +553,7 @@ declare class Server {
|
|
|
553
553
|
* Does not have a context by default
|
|
554
554
|
*/
|
|
555
555
|
get db(): pg.Pool & {
|
|
556
|
-
clearConnections: () => void
|
|
556
|
+
clearConnections: () => Promise<void>;
|
|
557
557
|
};
|
|
558
558
|
get logger(): LogReturn;
|
|
559
559
|
get extensions(): {
|
|
@@ -611,11 +611,11 @@ type ExtensionResult<TParams> = {
|
|
|
611
611
|
id: string;
|
|
612
612
|
withContext?: (ctx: CTX) => Promise<void>;
|
|
613
613
|
onRequest?: (params: TParams, ctx: CTX) => void | Promise<void | RequestInit>;
|
|
614
|
-
onResponse?: (params: TParams, ctx: CTX) => void | Promise<void>;
|
|
614
|
+
onResponse?: (params: TParams, ctx: CTX) => void | Response | Promise<void | Response>;
|
|
615
615
|
onHandleRequest?: (params?: TParams) => RouteReturn | Promise<RouteReturn>;
|
|
616
616
|
onConfigure?: (instance: Server) => void;
|
|
617
|
-
withUserId?: () => string
|
|
618
|
-
withTenantId?: () => string
|
|
617
|
+
withUserId?: () => string | null | undefined | Promise<string | null | undefined>;
|
|
618
|
+
withTenantId?: () => string | null | undefined | Promise<string | null | undefined>;
|
|
619
619
|
replace?: {
|
|
620
620
|
handlers: (handlers: NileHandlers) => Any;
|
|
621
621
|
};
|
|
@@ -634,6 +634,8 @@ declare enum ExtensionState {
|
|
|
634
634
|
}
|
|
635
635
|
type NilePoolConfig = PoolConfig & {
|
|
636
636
|
afterCreate?: AfterCreate;
|
|
637
|
+
/** Maximum number of tenant/user pools retained simultaneously (LRU evicted). Defaults to 100. */
|
|
638
|
+
maxPools?: number;
|
|
637
639
|
};
|
|
638
640
|
type LoggerType = {
|
|
639
641
|
info: (args: unknown | unknown[]) => void;
|
|
@@ -791,17 +793,34 @@ type NileRequest<T> = NRequest<T> | T;
|
|
|
791
793
|
declare const APIErrorErrorCodeEnum: {
|
|
792
794
|
readonly InternalError: "internal_error";
|
|
793
795
|
readonly BadRequest: "bad_request";
|
|
796
|
+
readonly UnsupportedOperation: "unsupported_operation";
|
|
794
797
|
readonly EntityNotFound: "entity_not_found";
|
|
795
798
|
readonly DuplicateEntity: "duplicate_entity";
|
|
796
799
|
readonly InvalidCredentials: "invalid_credentials";
|
|
797
800
|
readonly UnknownOidcProvider: "unknown_oidc_provider";
|
|
801
|
+
readonly UnknownOidcParty: "unknown_oidc_party";
|
|
798
802
|
readonly ProviderAlreadyExists: "provider_already_exists";
|
|
799
803
|
readonly ProviderConfigError: "provider_config_error";
|
|
800
804
|
readonly ProviderMismatch: "provider_mismatch";
|
|
801
805
|
readonly ProviderUpdateError: "provider_update_error";
|
|
806
|
+
readonly ProviderDisabled: "provider_disabled";
|
|
802
807
|
readonly SessionStateMissing: "session_state_missing";
|
|
803
808
|
readonly SessionStateMismatch: "session_state_mismatch";
|
|
804
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";
|
|
805
824
|
};
|
|
806
825
|
type APIErrorErrorCodeEnum = (typeof APIErrorErrorCodeEnum)[keyof typeof APIErrorErrorCodeEnum];
|
|
807
826
|
interface APIError {
|