@niledatabase/server 5.0.0-alpha.13 → 5.0.0-alpha.14
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 +44 -43
- package/dist/index.d.ts +44 -43
- package/dist/index.js.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -607,92 +607,93 @@ type LoggerType = {
|
|
|
607
607
|
error: (args: unknown | unknown[]) => void;
|
|
608
608
|
debug: (args: unknown | unknown[]) => void;
|
|
609
609
|
};
|
|
610
|
+
/**
|
|
611
|
+
* Configuration options used by the {@link Server} class.
|
|
612
|
+
* Most values can be provided via environment variables if not set here.
|
|
613
|
+
*/
|
|
610
614
|
type NileConfig = {
|
|
611
615
|
/**
|
|
612
|
-
*
|
|
613
|
-
*
|
|
616
|
+
* Unique ID of the database.
|
|
617
|
+
* If omitted, the value is derived from `NILEDB_API_URL`.
|
|
618
|
+
* Environment variable: `NILEDB_ID`.
|
|
614
619
|
*/
|
|
615
620
|
databaseId?: string;
|
|
616
621
|
/**
|
|
617
|
-
*
|
|
618
|
-
*
|
|
622
|
+
* Database user used for authentication.
|
|
623
|
+
* Environment variable: `NILEDB_USER`.
|
|
619
624
|
*/
|
|
620
625
|
user?: string;
|
|
621
626
|
/**
|
|
622
|
-
*
|
|
623
|
-
*
|
|
627
|
+
* Password for the configured user.
|
|
628
|
+
* Environment variable: `NILEDB_PASSWORD`.
|
|
624
629
|
*/
|
|
625
630
|
password?: string;
|
|
626
631
|
/**
|
|
627
|
-
*
|
|
628
|
-
*
|
|
632
|
+
* Database name. Defaults to the name parsed from
|
|
633
|
+
* `NILEDB_POSTGRES_URL` when not provided.
|
|
634
|
+
* Environment variable: `NILEDB_NAME`.
|
|
629
635
|
*/
|
|
630
636
|
databaseName?: string;
|
|
631
637
|
/**
|
|
632
|
-
*
|
|
633
|
-
*
|
|
638
|
+
* Tenant context used for scoping API and DB calls.
|
|
639
|
+
* Environment variable: `NILEDB_TENANT`.
|
|
634
640
|
*/
|
|
635
641
|
tenantId?: string | null | undefined;
|
|
636
642
|
/**
|
|
637
|
-
*
|
|
638
|
-
*
|
|
643
|
+
* Optional user identifier to apply when interacting with the database.
|
|
644
|
+
* In most cases nile-auth injects the logged in user automatically so this
|
|
645
|
+
* value rarely needs to be specified directly. It can be useful when
|
|
646
|
+
* performing administrative actions on behalf of another user.
|
|
639
647
|
*/
|
|
640
648
|
userId?: string | null | undefined;
|
|
641
|
-
/**
|
|
642
|
-
* Shows a bunch of logging on the server side to see what's being done between the sdk and nile-auth
|
|
643
|
-
*/
|
|
649
|
+
/** Enable verbose logging of SDK behaviour. */
|
|
644
650
|
debug?: boolean;
|
|
645
651
|
/**
|
|
646
|
-
*
|
|
652
|
+
* Optional Postgres connection configuration.
|
|
653
|
+
* Environment variables will be used for any values not set here.
|
|
647
654
|
*/
|
|
648
655
|
db?: NilePoolConfig;
|
|
649
|
-
/**
|
|
650
|
-
* Some kind of logger if you want to send to an external service
|
|
651
|
-
*/
|
|
656
|
+
/** Custom logger implementation. */
|
|
652
657
|
logger?: LogReturn;
|
|
653
658
|
/**
|
|
654
|
-
*
|
|
659
|
+
* Base URL for nile-auth requests.
|
|
660
|
+
* Environment variable: `NILEDB_API_URL`.
|
|
655
661
|
*/
|
|
656
662
|
apiUrl?: string | undefined;
|
|
657
663
|
/**
|
|
658
|
-
*
|
|
659
|
-
*
|
|
664
|
+
* Override the client provided callback URL during authentication.
|
|
665
|
+
* Environment variable: `NILEDB_CALLBACK_URL`.
|
|
660
666
|
*/
|
|
661
667
|
callbackUrl?: string | undefined;
|
|
662
|
-
/**
|
|
663
|
-
* Need to override some routes? Change it here
|
|
664
|
-
*/
|
|
668
|
+
/** Override default API routes. */
|
|
665
669
|
routes?: Partial<Routes>;
|
|
666
|
-
/**
|
|
667
|
-
* don't like the default `/api`? change it here
|
|
668
|
-
*/
|
|
670
|
+
/** Prefix applied to all generated routes. */
|
|
669
671
|
routePrefix?: string | undefined;
|
|
670
672
|
/**
|
|
671
|
-
*
|
|
672
|
-
*
|
|
673
|
-
*
|
|
673
|
+
* Force usage of secure cookies when communicating with nile-auth.
|
|
674
|
+
* Defaults to `true` when `NODE_ENV` is `production`.
|
|
675
|
+
* Environment variable: `NILEDB_SECURECOOKIES`.
|
|
674
676
|
*/
|
|
675
677
|
secureCookies?: boolean;
|
|
676
678
|
/**
|
|
677
|
-
*
|
|
678
|
-
*
|
|
679
|
-
*
|
|
680
|
-
*
|
|
681
|
-
*
|
|
679
|
+
* Origin for requests made to nile-auth. This controls where users are
|
|
680
|
+
* redirected after authentication. For single-page apps running on a
|
|
681
|
+
* different port than the API, set this to the front-end origin
|
|
682
|
+
* (e.g. `http://localhost:3001`). In a full-stack setup the value defaults
|
|
683
|
+
* to the `host` header of the incoming request. When using secure cookies on
|
|
684
|
+
* server-to-server calls, explicitly setting the origin ensures nile-auth
|
|
685
|
+
* knows whether TLS is being used and which cookies to send.
|
|
682
686
|
*/
|
|
683
687
|
origin?: null | undefined | string;
|
|
684
688
|
/**
|
|
685
|
-
*
|
|
686
|
-
*
|
|
689
|
+
* Additional headers sent with every API request.
|
|
690
|
+
* Include a `cookie` header to forward session information.
|
|
687
691
|
*/
|
|
688
692
|
headers?: null | Headers | Record<string, string>;
|
|
689
|
-
/**
|
|
690
|
-
* Functions to run at various points to make life easier
|
|
691
|
-
*/
|
|
693
|
+
/** Hooks executed before and after each request. */
|
|
692
694
|
extensions?: Extension[];
|
|
693
695
|
/**
|
|
694
|
-
*
|
|
695
|
-
* regardless of what an extension might do
|
|
696
|
+
* Preserve incoming request headers when running extensions.
|
|
696
697
|
*/
|
|
697
698
|
preserveHeaders?: boolean;
|
|
698
699
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -607,92 +607,93 @@ type LoggerType = {
|
|
|
607
607
|
error: (args: unknown | unknown[]) => void;
|
|
608
608
|
debug: (args: unknown | unknown[]) => void;
|
|
609
609
|
};
|
|
610
|
+
/**
|
|
611
|
+
* Configuration options used by the {@link Server} class.
|
|
612
|
+
* Most values can be provided via environment variables if not set here.
|
|
613
|
+
*/
|
|
610
614
|
type NileConfig = {
|
|
611
615
|
/**
|
|
612
|
-
*
|
|
613
|
-
*
|
|
616
|
+
* Unique ID of the database.
|
|
617
|
+
* If omitted, the value is derived from `NILEDB_API_URL`.
|
|
618
|
+
* Environment variable: `NILEDB_ID`.
|
|
614
619
|
*/
|
|
615
620
|
databaseId?: string;
|
|
616
621
|
/**
|
|
617
|
-
*
|
|
618
|
-
*
|
|
622
|
+
* Database user used for authentication.
|
|
623
|
+
* Environment variable: `NILEDB_USER`.
|
|
619
624
|
*/
|
|
620
625
|
user?: string;
|
|
621
626
|
/**
|
|
622
|
-
*
|
|
623
|
-
*
|
|
627
|
+
* Password for the configured user.
|
|
628
|
+
* Environment variable: `NILEDB_PASSWORD`.
|
|
624
629
|
*/
|
|
625
630
|
password?: string;
|
|
626
631
|
/**
|
|
627
|
-
*
|
|
628
|
-
*
|
|
632
|
+
* Database name. Defaults to the name parsed from
|
|
633
|
+
* `NILEDB_POSTGRES_URL` when not provided.
|
|
634
|
+
* Environment variable: `NILEDB_NAME`.
|
|
629
635
|
*/
|
|
630
636
|
databaseName?: string;
|
|
631
637
|
/**
|
|
632
|
-
*
|
|
633
|
-
*
|
|
638
|
+
* Tenant context used for scoping API and DB calls.
|
|
639
|
+
* Environment variable: `NILEDB_TENANT`.
|
|
634
640
|
*/
|
|
635
641
|
tenantId?: string | null | undefined;
|
|
636
642
|
/**
|
|
637
|
-
*
|
|
638
|
-
*
|
|
643
|
+
* Optional user identifier to apply when interacting with the database.
|
|
644
|
+
* In most cases nile-auth injects the logged in user automatically so this
|
|
645
|
+
* value rarely needs to be specified directly. It can be useful when
|
|
646
|
+
* performing administrative actions on behalf of another user.
|
|
639
647
|
*/
|
|
640
648
|
userId?: string | null | undefined;
|
|
641
|
-
/**
|
|
642
|
-
* Shows a bunch of logging on the server side to see what's being done between the sdk and nile-auth
|
|
643
|
-
*/
|
|
649
|
+
/** Enable verbose logging of SDK behaviour. */
|
|
644
650
|
debug?: boolean;
|
|
645
651
|
/**
|
|
646
|
-
*
|
|
652
|
+
* Optional Postgres connection configuration.
|
|
653
|
+
* Environment variables will be used for any values not set here.
|
|
647
654
|
*/
|
|
648
655
|
db?: NilePoolConfig;
|
|
649
|
-
/**
|
|
650
|
-
* Some kind of logger if you want to send to an external service
|
|
651
|
-
*/
|
|
656
|
+
/** Custom logger implementation. */
|
|
652
657
|
logger?: LogReturn;
|
|
653
658
|
/**
|
|
654
|
-
*
|
|
659
|
+
* Base URL for nile-auth requests.
|
|
660
|
+
* Environment variable: `NILEDB_API_URL`.
|
|
655
661
|
*/
|
|
656
662
|
apiUrl?: string | undefined;
|
|
657
663
|
/**
|
|
658
|
-
*
|
|
659
|
-
*
|
|
664
|
+
* Override the client provided callback URL during authentication.
|
|
665
|
+
* Environment variable: `NILEDB_CALLBACK_URL`.
|
|
660
666
|
*/
|
|
661
667
|
callbackUrl?: string | undefined;
|
|
662
|
-
/**
|
|
663
|
-
* Need to override some routes? Change it here
|
|
664
|
-
*/
|
|
668
|
+
/** Override default API routes. */
|
|
665
669
|
routes?: Partial<Routes>;
|
|
666
|
-
/**
|
|
667
|
-
* don't like the default `/api`? change it here
|
|
668
|
-
*/
|
|
670
|
+
/** Prefix applied to all generated routes. */
|
|
669
671
|
routePrefix?: string | undefined;
|
|
670
672
|
/**
|
|
671
|
-
*
|
|
672
|
-
*
|
|
673
|
-
*
|
|
673
|
+
* Force usage of secure cookies when communicating with nile-auth.
|
|
674
|
+
* Defaults to `true` when `NODE_ENV` is `production`.
|
|
675
|
+
* Environment variable: `NILEDB_SECURECOOKIES`.
|
|
674
676
|
*/
|
|
675
677
|
secureCookies?: boolean;
|
|
676
678
|
/**
|
|
677
|
-
*
|
|
678
|
-
*
|
|
679
|
-
*
|
|
680
|
-
*
|
|
681
|
-
*
|
|
679
|
+
* Origin for requests made to nile-auth. This controls where users are
|
|
680
|
+
* redirected after authentication. For single-page apps running on a
|
|
681
|
+
* different port than the API, set this to the front-end origin
|
|
682
|
+
* (e.g. `http://localhost:3001`). In a full-stack setup the value defaults
|
|
683
|
+
* to the `host` header of the incoming request. When using secure cookies on
|
|
684
|
+
* server-to-server calls, explicitly setting the origin ensures nile-auth
|
|
685
|
+
* knows whether TLS is being used and which cookies to send.
|
|
682
686
|
*/
|
|
683
687
|
origin?: null | undefined | string;
|
|
684
688
|
/**
|
|
685
|
-
*
|
|
686
|
-
*
|
|
689
|
+
* Additional headers sent with every API request.
|
|
690
|
+
* Include a `cookie` header to forward session information.
|
|
687
691
|
*/
|
|
688
692
|
headers?: null | Headers | Record<string, string>;
|
|
689
|
-
/**
|
|
690
|
-
* Functions to run at various points to make life easier
|
|
691
|
-
*/
|
|
693
|
+
/** Hooks executed before and after each request. */
|
|
692
694
|
extensions?: Extension[];
|
|
693
695
|
/**
|
|
694
|
-
*
|
|
695
|
-
* regardless of what an extension might do
|
|
696
|
+
* Preserve incoming request headers when running extensions.
|
|
696
697
|
*/
|
|
697
698
|
preserveHeaders?: boolean;
|
|
698
699
|
};
|