@shivaedev/server 0.5.0 → 0.6.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/README.md +4 -2
- package/dist/AppHostFactory.d.ts +3 -3
- package/dist/AppHostFactory.d.ts.map +1 -1
- package/dist/AppHostInput.d.ts +2 -2
- package/dist/AppHostInput.d.ts.map +1 -1
- package/dist/MigrationOptions.d.ts +2 -2
- package/dist/MigrationOptions.d.ts.map +1 -1
- package/dist/appHost.d.ts +8 -8
- package/dist/appHost.d.ts.map +1 -1
- package/dist/appHost.js.map +1 -1
- package/dist/appHostHttp.d.ts +28 -28
- package/dist/appHostHttp.d.ts.map +1 -1
- package/dist/appHostHttp.js.map +1 -1
- package/dist/databaseLayer.d.ts +6 -6
- package/dist/databaseLayer.d.ts.map +1 -1
- package/dist/databaseLayer.js +15 -33
- package/dist/databaseLayer.js.map +1 -1
- package/dist/hostChanges.d.ts +1 -1
- package/dist/hostChanges.d.ts.map +1 -1
- package/dist/hostChanges.js +5 -5
- package/dist/hostChanges.js.map +1 -1
- package/dist/socketRpc.d.ts.map +1 -1
- package/dist/socketRpc.js +3 -0
- package/dist/socketRpc.js.map +1 -1
- package/package.json +11 -11
- package/src/AppHostFactory.ts +6 -3
- package/src/AppHostInput.ts +6 -3
- package/src/MigrationOptions.ts +2 -2
- package/src/appHost.ts +10 -6
- package/src/appHostHttp.ts +5 -3
- package/src/databaseLayer.ts +27 -43
- package/src/hostChanges.ts +6 -5
- package/src/socketRpc.ts +3 -0
- package/dist/databaseAddress.d.ts +0 -4
- package/dist/databaseAddress.d.ts.map +0 -1
- package/dist/databaseAddress.js +0 -25
- package/dist/databaseAddress.js.map +0 -1
- package/src/databaseAddress.ts +0 -25
package/dist/databaseAddress.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { Redacted } from "effect";
|
|
2
|
-
export function databaseAddress(value) {
|
|
3
|
-
try {
|
|
4
|
-
const url = new URL(Redacted.value(value));
|
|
5
|
-
if (url.protocol !== "postgres:" && url.protocol !== "postgresql:") {
|
|
6
|
-
return {};
|
|
7
|
-
}
|
|
8
|
-
const hostname = url.hostname.startsWith("[") ? url.hostname.slice(1, -1) : decodeURIComponent(url.hostname);
|
|
9
|
-
// PgConnection applies query parameters in order, after the authority.
|
|
10
|
-
const host = url.searchParams.getAll("host").at(-1) ?? hostname;
|
|
11
|
-
const rawPort = url.searchParams.getAll("port").at(-1) ?? url.port;
|
|
12
|
-
const port = rawPort === "" ? undefined : Number(rawPort);
|
|
13
|
-
if (host.includes(",") || (port !== undefined && (!Number.isInteger(port) || port < 1 || port > 65_535))) {
|
|
14
|
-
return {};
|
|
15
|
-
}
|
|
16
|
-
return {
|
|
17
|
-
...(host === "" && !url.searchParams.has("host") ? {} : { host }),
|
|
18
|
-
...(port === undefined ? {} : { port }),
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
catch {
|
|
22
|
-
return {};
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
//# sourceMappingURL=databaseAddress.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"databaseAddress.js","sourceRoot":"","sources":["../src/databaseAddress.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAElC,MAAM,UAAU,eAAe,CAAC,KAAgC;IAC/D,IAAI,CAAC;QACJ,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;QAC3C,IAAI,GAAG,CAAC,QAAQ,KAAK,WAAW,IAAI,GAAG,CAAC,QAAQ,KAAK,aAAa,EAAE,CAAC;YACpE,OAAO,EAAE,CAAC;QACX,CAAC;QACD,MAAM,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,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export function databaseAddress(value: Redacted.Redacted<string>): Pick<PgPoolConfig, "host" | "port"> {
|
|
5
|
-
try {
|
|
6
|
-
const url = new URL(Redacted.value(value));
|
|
7
|
-
if (url.protocol !== "postgres:" && url.protocol !== "postgresql:") {
|
|
8
|
-
return {};
|
|
9
|
-
}
|
|
10
|
-
const hostname = url.hostname.startsWith("[") ? url.hostname.slice(1, -1) : decodeURIComponent(url.hostname);
|
|
11
|
-
// PgConnection applies query parameters in order, after the authority.
|
|
12
|
-
const host = url.searchParams.getAll("host").at(-1) ?? hostname;
|
|
13
|
-
const rawPort = url.searchParams.getAll("port").at(-1) ?? url.port;
|
|
14
|
-
const port = rawPort === "" ? undefined : Number(rawPort);
|
|
15
|
-
if (host.includes(",") || (port !== undefined && (!Number.isInteger(port) || port < 1 || port > 65_535))) {
|
|
16
|
-
return {};
|
|
17
|
-
}
|
|
18
|
-
return {
|
|
19
|
-
...(host === "" && !url.searchParams.has("host") ? {} : { host }),
|
|
20
|
-
...(port === undefined ? {} : { port }),
|
|
21
|
-
};
|
|
22
|
-
} catch {
|
|
23
|
-
return {};
|
|
24
|
-
}
|
|
25
|
-
}
|