revisium 2.2.0 → 2.4.0
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/e2e/utils/cli-runner.d.ts +1 -0
- package/dist/e2e/utils/cli-runner.js +3 -2
- package/dist/e2e/utils/cli-runner.js.map +1 -1
- package/dist/package.json +1 -1
- package/dist/src/commands/migration/apply-migrations.command.d.ts +2 -0
- package/dist/src/commands/migration/apply-migrations.command.js +16 -1
- package/dist/src/commands/migration/apply-migrations.command.js.map +1 -1
- package/dist/src/services/connection/connection-factory.service.d.ts +3 -0
- package/dist/src/services/connection/connection-factory.service.js +30 -5
- package/dist/src/services/connection/connection-factory.service.js.map +1 -1
- package/dist/src/services/connection/connection.service.d.ts +1 -0
- package/dist/src/services/connection/connection.service.js +3 -1
- package/dist/src/services/connection/connection.service.js.map +1 -1
- package/dist/src/services/url/url-parser.service.d.ts +1 -1
- package/dist/src/services/url/url-parser.service.js +12 -6
- package/dist/src/services/url/url-parser.service.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/docs/migrate-commands.md +6 -1
- package/docs/url-format.md +25 -0
- package/e2e/tests/01-auth.e2e-spec.ts +19 -0
- package/e2e/tests/03-migrate.e2e-spec.ts +49 -1
- package/e2e/utils/cli-runner.ts +11 -3
- package/package.json +1 -1
- package/src/commands/migration/apply-migrations.command.ts +14 -1
- package/src/services/connection/__tests__/connection-factory.service.spec.ts +141 -0
- package/src/services/connection/__tests__/connection.service.spec.ts +1 -0
- package/src/services/connection/connection-factory.service.ts +47 -5
- package/src/services/connection/connection.service.ts +4 -1
- package/src/services/url/__tests__/url-parser.service.spec.ts +162 -0
- package/src/services/url/url-parser.service.ts +21 -6
|
@@ -27,6 +27,14 @@ function validatePort(port: number, context: string): void {
|
|
|
27
27
|
@Injectable()
|
|
28
28
|
export class UrlParserService {
|
|
29
29
|
parse(input: string): RevisiumUrl {
|
|
30
|
+
if (input.startsWith('revisium+http://')) {
|
|
31
|
+
return this.parseRevisiumUrl(input, 'http');
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (input.startsWith('revisium+https://')) {
|
|
35
|
+
return this.parseRevisiumUrl(input, 'https');
|
|
36
|
+
}
|
|
37
|
+
|
|
30
38
|
if (input.startsWith('revisium://')) {
|
|
31
39
|
return this.parseRevisiumUrl(input);
|
|
32
40
|
}
|
|
@@ -39,7 +47,10 @@ export class UrlParserService {
|
|
|
39
47
|
return `${protocol}://${host}${portSuffix}`;
|
|
40
48
|
}
|
|
41
49
|
|
|
42
|
-
buildBaseUrlFromHost(
|
|
50
|
+
buildBaseUrlFromHost(
|
|
51
|
+
hostWithPort: string,
|
|
52
|
+
protocolOverride?: 'http' | 'https',
|
|
53
|
+
): string {
|
|
43
54
|
const [host, portStr] = hostWithPort.split(':');
|
|
44
55
|
const port = portStr ? Number.parseInt(portStr, 10) : undefined;
|
|
45
56
|
|
|
@@ -47,8 +58,9 @@ export class UrlParserService {
|
|
|
47
58
|
validatePort(port, `in "${hostWithPort}"`);
|
|
48
59
|
}
|
|
49
60
|
|
|
50
|
-
const
|
|
51
|
-
|
|
61
|
+
const protocol =
|
|
62
|
+
protocolOverride ??
|
|
63
|
+
(LOCALHOST_HOSTS.has(host.toLowerCase()) ? 'http' : 'https');
|
|
52
64
|
|
|
53
65
|
if (port) {
|
|
54
66
|
return this.buildBaseUrl(protocol, host, port);
|
|
@@ -65,8 +77,11 @@ export class UrlParserService {
|
|
|
65
77
|
validatePort(port, context);
|
|
66
78
|
}
|
|
67
79
|
|
|
68
|
-
private parseRevisiumUrl(
|
|
69
|
-
|
|
80
|
+
private parseRevisiumUrl(
|
|
81
|
+
url: string,
|
|
82
|
+
forceProtocol?: 'http' | 'https',
|
|
83
|
+
): RevisiumUrl {
|
|
84
|
+
const withoutProtocol = url.replace(/^revisium(\+https?)?:\/\//, '');
|
|
70
85
|
|
|
71
86
|
const [mainPart, queryString] = withoutProtocol.split('?');
|
|
72
87
|
const queryParams = this.parseQueryParams(queryString);
|
|
@@ -104,7 +119,7 @@ export class UrlParserService {
|
|
|
104
119
|
const pathParts = hostAndPath.split('/');
|
|
105
120
|
const hostWithPort = pathParts[0];
|
|
106
121
|
|
|
107
|
-
const baseUrl = this.buildBaseUrlFromHost(hostWithPort);
|
|
122
|
+
const baseUrl = this.buildBaseUrlFromHost(hostWithPort, forceProtocol);
|
|
108
123
|
|
|
109
124
|
const branchWithRevision = pathParts[3] || undefined;
|
|
110
125
|
let branch: string | undefined;
|