@postgres.ai/shared 4.0.2-pr-1149 → 4.0.2-pr-1148.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/package.json +1 -1
- package/pages/Instance/Configuration/PhysicalMode/EnvsEditor/index.d.ts +11 -0
- package/pages/Instance/Configuration/PhysicalMode/EnvsEditor/index.js +24 -0
- package/pages/Instance/Configuration/PhysicalMode/PgBackRest/index.d.ts +10 -0
- package/pages/Instance/Configuration/PhysicalMode/PgBackRest/index.js +29 -0
- package/pages/Instance/Configuration/PhysicalMode/Sync/index.d.ts +9 -0
- package/pages/Instance/Configuration/PhysicalMode/Sync/index.js +14 -0
- package/pages/Instance/Configuration/PhysicalMode/Walg/index.d.ts +10 -0
- package/pages/Instance/Configuration/PhysicalMode/Walg/index.js +21 -0
- package/pages/Instance/Configuration/PhysicalMode/index.d.ts +10 -0
- package/pages/Instance/Configuration/PhysicalMode/index.js +17 -0
- package/pages/Instance/Configuration/SimpleMode/PreviewCard.d.ts +11 -0
- package/pages/Instance/Configuration/SimpleMode/PreviewCard.js +14 -0
- package/pages/Instance/Configuration/SimpleMode/index.d.ts +14 -0
- package/pages/Instance/Configuration/SimpleMode/index.js +107 -0
- package/pages/Instance/Configuration/configMode.d.ts +2 -0
- package/pages/Instance/Configuration/configMode.js +7 -0
- package/pages/Instance/Configuration/configOptions.d.ts +6 -0
- package/pages/Instance/Configuration/configOptions.js +48 -0
- package/pages/Instance/Configuration/connectionString.d.ts +20 -0
- package/pages/Instance/Configuration/connectionString.js +129 -0
- package/pages/Instance/Configuration/dockerCatalog.d.ts +2 -0
- package/pages/Instance/Configuration/dockerCatalog.js +19 -0
- package/pages/Instance/Configuration/index.d.ts +1 -2
- package/pages/Instance/Configuration/index.js +115 -86
- package/pages/Instance/Configuration/useForm.d.ts +20 -0
- package/pages/Instance/Configuration/useForm.js +126 -5
- package/pages/Instance/Configuration/utils/index.js +1 -17
- package/pages/Instance/index.js +1 -3
- package/pages/Instance/stores/Main.d.ts +20 -0
- package/pages/Instance/stores/Main.js +9 -0
- package/types/api/endpoints/probeSource.d.ts +32 -0
- package/types/api/endpoints/probeSource.js +1 -0
- package/types/api/entities/config.d.ts +32 -0
- package/types/api/entities/config.js +45 -18
|
@@ -216,6 +216,15 @@ export class MainStore {
|
|
|
216
216
|
error,
|
|
217
217
|
};
|
|
218
218
|
};
|
|
219
|
+
this.probeSource = async (values) => {
|
|
220
|
+
if (!this.api.probeSource)
|
|
221
|
+
return;
|
|
222
|
+
const { response, error } = await this.api.probeSource(values);
|
|
223
|
+
return {
|
|
224
|
+
response,
|
|
225
|
+
error,
|
|
226
|
+
};
|
|
227
|
+
};
|
|
219
228
|
this.resetClone = async (cloneId, snapshotId) => {
|
|
220
229
|
if (!this.instance || !this.api.resetClone)
|
|
221
230
|
return;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export declare type ProbeSourceRequest = {
|
|
2
|
+
url: string;
|
|
3
|
+
password: string;
|
|
4
|
+
};
|
|
5
|
+
export declare type SourceConnection = {
|
|
6
|
+
host: string;
|
|
7
|
+
port: number;
|
|
8
|
+
username: string;
|
|
9
|
+
dbname: string;
|
|
10
|
+
};
|
|
11
|
+
export declare type ProposedConfig = {
|
|
12
|
+
source: SourceConnection;
|
|
13
|
+
detectedProvider: string;
|
|
14
|
+
dockerImage: string;
|
|
15
|
+
dockerTag: string;
|
|
16
|
+
pgMajorVersion: number;
|
|
17
|
+
databases: string[];
|
|
18
|
+
sharedBuffers: string;
|
|
19
|
+
memoryProbed: boolean;
|
|
20
|
+
sharedPreloadLibraries: string;
|
|
21
|
+
queryTuning: {
|
|
22
|
+
[key: string]: string;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
export declare type ProbeSourceError = {
|
|
26
|
+
status: number;
|
|
27
|
+
message: string;
|
|
28
|
+
};
|
|
29
|
+
export declare type ProbeSource = (req: ProbeSourceRequest) => Promise<{
|
|
30
|
+
response: ProposedConfig | null;
|
|
31
|
+
error: ProbeSourceError | null;
|
|
32
|
+
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
export interface DatabaseType {
|
|
2
2
|
[name: string]: string | Object;
|
|
3
3
|
}
|
|
4
|
+
export declare type RetrievalMode = 'logical' | 'physical' | 'unknown' | '';
|
|
4
5
|
export declare type configTypes = {
|
|
5
6
|
global?: {
|
|
6
7
|
debug?: boolean;
|
|
7
8
|
};
|
|
9
|
+
retrievalMode?: RetrievalMode;
|
|
8
10
|
databaseContainer?: {
|
|
9
11
|
dockerImage?: string;
|
|
10
12
|
dockerPath?: string;
|
|
@@ -46,6 +48,25 @@ export declare type configTypes = {
|
|
|
46
48
|
};
|
|
47
49
|
};
|
|
48
50
|
};
|
|
51
|
+
physicalRestore?: {
|
|
52
|
+
options?: {
|
|
53
|
+
tool?: string;
|
|
54
|
+
dockerImage?: string;
|
|
55
|
+
sync?: {
|
|
56
|
+
enabled?: boolean;
|
|
57
|
+
};
|
|
58
|
+
walg?: {
|
|
59
|
+
backupName?: string;
|
|
60
|
+
};
|
|
61
|
+
pgbackrest?: {
|
|
62
|
+
stanza?: string;
|
|
63
|
+
delta?: boolean;
|
|
64
|
+
};
|
|
65
|
+
envs?: {
|
|
66
|
+
[key: string]: string | number | boolean;
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
};
|
|
49
70
|
};
|
|
50
71
|
};
|
|
51
72
|
};
|
|
@@ -71,6 +92,17 @@ export declare const formatConfig: (config: configTypes) => {
|
|
|
71
92
|
dockerTag?: string | undefined;
|
|
72
93
|
dockerImageType?: string | undefined;
|
|
73
94
|
debug: boolean | undefined;
|
|
95
|
+
retrievalMode: RetrievalMode;
|
|
96
|
+
physicalTool: string;
|
|
97
|
+
physicalDockerImage: string;
|
|
98
|
+
physicalSyncEnabled: boolean;
|
|
99
|
+
physicalWalgBackupName: string;
|
|
100
|
+
physicalPgbackrestStanza: string;
|
|
101
|
+
physicalPgbackrestDelta: boolean;
|
|
102
|
+
physicalEnvs: {
|
|
103
|
+
key: string;
|
|
104
|
+
value: string;
|
|
105
|
+
}[];
|
|
74
106
|
dockerImage: string | undefined;
|
|
75
107
|
};
|
|
76
108
|
export declare type Config = ReturnType<typeof formatConfig>;
|
|
@@ -1,10 +1,37 @@
|
|
|
1
1
|
import { formatDatabases, formatDumpCustomOptions, getImageMajorVersion, getImageType, isSeDockerImage, } from '@postgres.ai/shared/pages/Instance/Configuration/utils';
|
|
2
2
|
import { formatTuningParams } from '../endpoints/testDbSource';
|
|
3
|
+
const formatPhysicalEnvs = (envs) => {
|
|
4
|
+
if (!envs)
|
|
5
|
+
return [];
|
|
6
|
+
return Object.entries(envs).map(([key, value]) => ({
|
|
7
|
+
key,
|
|
8
|
+
value: typeof value === 'string' ? value : String(value),
|
|
9
|
+
}));
|
|
10
|
+
};
|
|
11
|
+
const inferRetrievalMode = (config) => {
|
|
12
|
+
var _a, _b, _c, _d;
|
|
13
|
+
if (config.retrievalMode)
|
|
14
|
+
return config.retrievalMode;
|
|
15
|
+
if ((_b = (_a = config.retrieval) === null || _a === void 0 ? void 0 : _a.spec) === null || _b === void 0 ? void 0 : _b.physicalRestore)
|
|
16
|
+
return 'physical';
|
|
17
|
+
if ((_d = (_c = config.retrieval) === null || _c === void 0 ? void 0 : _c.spec) === null || _d === void 0 ? void 0 : _d.logicalDump)
|
|
18
|
+
return 'logical';
|
|
19
|
+
return '';
|
|
20
|
+
};
|
|
3
21
|
export const formatConfig = (config) => {
|
|
4
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45;
|
|
22
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58;
|
|
5
23
|
const dockerImage = (_a = config.databaseContainer) === null || _a === void 0 ? void 0 : _a.dockerImage;
|
|
24
|
+
const physical = (_d = (_c = (_b = config.retrieval) === null || _b === void 0 ? void 0 : _b.spec) === null || _c === void 0 ? void 0 : _c.physicalRestore) === null || _d === void 0 ? void 0 : _d.options;
|
|
6
25
|
return {
|
|
7
|
-
debug: (
|
|
26
|
+
debug: (_e = config.global) === null || _e === void 0 ? void 0 : _e.debug,
|
|
27
|
+
retrievalMode: inferRetrievalMode(config),
|
|
28
|
+
physicalTool: (_f = physical === null || physical === void 0 ? void 0 : physical.tool) !== null && _f !== void 0 ? _f : '',
|
|
29
|
+
physicalDockerImage: (_g = physical === null || physical === void 0 ? void 0 : physical.dockerImage) !== null && _g !== void 0 ? _g : '',
|
|
30
|
+
physicalSyncEnabled: (_j = (_h = physical === null || physical === void 0 ? void 0 : physical.sync) === null || _h === void 0 ? void 0 : _h.enabled) !== null && _j !== void 0 ? _j : false,
|
|
31
|
+
physicalWalgBackupName: (_l = (_k = physical === null || physical === void 0 ? void 0 : physical.walg) === null || _k === void 0 ? void 0 : _k.backupName) !== null && _l !== void 0 ? _l : '',
|
|
32
|
+
physicalPgbackrestStanza: (_o = (_m = physical === null || physical === void 0 ? void 0 : physical.pgbackrest) === null || _m === void 0 ? void 0 : _m.stanza) !== null && _o !== void 0 ? _o : '',
|
|
33
|
+
physicalPgbackrestDelta: (_q = (_p = physical === null || physical === void 0 ? void 0 : physical.pgbackrest) === null || _p === void 0 ? void 0 : _p.delta) !== null && _q !== void 0 ? _q : false,
|
|
34
|
+
physicalEnvs: formatPhysicalEnvs(physical === null || physical === void 0 ? void 0 : physical.envs),
|
|
8
35
|
dockerImage: isSeDockerImage(dockerImage)
|
|
9
36
|
? getImageMajorVersion(dockerImage)
|
|
10
37
|
: dockerImage && getImageType(dockerImage) === 'Generic Postgres'
|
|
@@ -18,20 +45,20 @@ export const formatConfig = (config) => {
|
|
|
18
45
|
dockerTag: dockerImage.split(':')[1],
|
|
19
46
|
}),
|
|
20
47
|
dockerPath: dockerImage,
|
|
21
|
-
tuningParams: formatTuningParams((
|
|
22
|
-
sharedBuffers: (
|
|
23
|
-
sharedPreloadLibraries: (
|
|
24
|
-
timetable: (
|
|
25
|
-
dbname: (
|
|
26
|
-
host: (
|
|
27
|
-
port: (
|
|
28
|
-
username: (
|
|
29
|
-
password: (
|
|
30
|
-
databases: formatDatabases((
|
|
31
|
-
dumpParallelJobs: (
|
|
32
|
-
dumpIgnoreErrors: (
|
|
33
|
-
restoreParallelJobs: (
|
|
34
|
-
restoreIgnoreErrors: (
|
|
48
|
+
tuningParams: formatTuningParams((_r = config.databaseConfigs) === null || _r === void 0 ? void 0 : _r.configs),
|
|
49
|
+
sharedBuffers: (_t = (_s = config.databaseConfigs) === null || _s === void 0 ? void 0 : _s.configs) === null || _t === void 0 ? void 0 : _t.shared_buffers,
|
|
50
|
+
sharedPreloadLibraries: (_v = (_u = config.databaseConfigs) === null || _u === void 0 ? void 0 : _u.configs) === null || _v === void 0 ? void 0 : _v.shared_preload_libraries,
|
|
51
|
+
timetable: (_x = (_w = config.retrieval) === null || _w === void 0 ? void 0 : _w.refresh) === null || _x === void 0 ? void 0 : _x.timetable,
|
|
52
|
+
dbname: (_3 = (_2 = (_1 = (_0 = (_z = (_y = config.retrieval) === null || _y === void 0 ? void 0 : _y.spec) === null || _z === void 0 ? void 0 : _z.logicalDump) === null || _0 === void 0 ? void 0 : _0.options) === null || _1 === void 0 ? void 0 : _1.source) === null || _2 === void 0 ? void 0 : _2.connection) === null || _3 === void 0 ? void 0 : _3.dbname,
|
|
53
|
+
host: (_9 = (_8 = (_7 = (_6 = (_5 = (_4 = config.retrieval) === null || _4 === void 0 ? void 0 : _4.spec) === null || _5 === void 0 ? void 0 : _5.logicalDump) === null || _6 === void 0 ? void 0 : _6.options) === null || _7 === void 0 ? void 0 : _7.source) === null || _8 === void 0 ? void 0 : _8.connection) === null || _9 === void 0 ? void 0 : _9.host,
|
|
54
|
+
port: (_15 = (_14 = (_13 = (_12 = (_11 = (_10 = config.retrieval) === null || _10 === void 0 ? void 0 : _10.spec) === null || _11 === void 0 ? void 0 : _11.logicalDump) === null || _12 === void 0 ? void 0 : _12.options) === null || _13 === void 0 ? void 0 : _13.source) === null || _14 === void 0 ? void 0 : _14.connection) === null || _15 === void 0 ? void 0 : _15.port,
|
|
55
|
+
username: (_21 = (_20 = (_19 = (_18 = (_17 = (_16 = config.retrieval) === null || _16 === void 0 ? void 0 : _16.spec) === null || _17 === void 0 ? void 0 : _17.logicalDump) === null || _18 === void 0 ? void 0 : _18.options) === null || _19 === void 0 ? void 0 : _19.source) === null || _20 === void 0 ? void 0 : _20.connection) === null || _21 === void 0 ? void 0 : _21.username,
|
|
56
|
+
password: (_27 = (_26 = (_25 = (_24 = (_23 = (_22 = config.retrieval) === null || _22 === void 0 ? void 0 : _22.spec) === null || _23 === void 0 ? void 0 : _23.logicalDump) === null || _24 === void 0 ? void 0 : _24.options) === null || _25 === void 0 ? void 0 : _25.source) === null || _26 === void 0 ? void 0 : _26.connection) === null || _27 === void 0 ? void 0 : _27.password,
|
|
57
|
+
databases: formatDatabases((_32 = (_31 = (_30 = (_29 = (_28 = config.retrieval) === null || _28 === void 0 ? void 0 : _28.spec) === null || _29 === void 0 ? void 0 : _29.logicalDump) === null || _30 === void 0 ? void 0 : _30.options) === null || _31 === void 0 ? void 0 : _31.databases) !== null && _32 !== void 0 ? _32 : null),
|
|
58
|
+
dumpParallelJobs: (_36 = (_35 = (_34 = (_33 = config.retrieval) === null || _33 === void 0 ? void 0 : _33.spec) === null || _34 === void 0 ? void 0 : _34.logicalDump) === null || _35 === void 0 ? void 0 : _35.options) === null || _36 === void 0 ? void 0 : _36.parallelJobs,
|
|
59
|
+
dumpIgnoreErrors: (_40 = (_39 = (_38 = (_37 = config.retrieval) === null || _37 === void 0 ? void 0 : _37.spec) === null || _38 === void 0 ? void 0 : _38.logicalDump) === null || _39 === void 0 ? void 0 : _39.options) === null || _40 === void 0 ? void 0 : _40.ignoreErrors,
|
|
60
|
+
restoreParallelJobs: (_44 = (_43 = (_42 = (_41 = config.retrieval) === null || _41 === void 0 ? void 0 : _41.spec) === null || _42 === void 0 ? void 0 : _42.logicalRestore) === null || _43 === void 0 ? void 0 : _43.options) === null || _44 === void 0 ? void 0 : _44.parallelJobs,
|
|
61
|
+
restoreIgnoreErrors: (_48 = (_47 = (_46 = (_45 = config.retrieval) === null || _45 === void 0 ? void 0 : _45.spec) === null || _46 === void 0 ? void 0 : _46.logicalRestore) === null || _47 === void 0 ? void 0 : _47.options) === null || _48 === void 0 ? void 0 : _48.ignoreErrors,
|
|
35
62
|
restoreConfigs: (() => {
|
|
36
63
|
var _a, _b, _c, _d;
|
|
37
64
|
const configs = (_d = (_c = (_b = (_a = config.retrieval) === null || _a === void 0 ? void 0 : _a.spec) === null || _b === void 0 ? void 0 : _b.logicalRestore) === null || _c === void 0 ? void 0 : _c.options) === null || _d === void 0 ? void 0 : _d.configs;
|
|
@@ -41,7 +68,7 @@ export const formatConfig = (config) => {
|
|
|
41
68
|
.map(([k, v]) => `${k}=${v}`)
|
|
42
69
|
.join('\n');
|
|
43
70
|
})(),
|
|
44
|
-
pgDumpCustomOptions: formatDumpCustomOptions((
|
|
45
|
-
pgRestoreCustomOptions: formatDumpCustomOptions((
|
|
71
|
+
pgDumpCustomOptions: formatDumpCustomOptions((_53 = (_52 = (_51 = (_50 = (_49 = config.retrieval) === null || _49 === void 0 ? void 0 : _49.spec) === null || _50 === void 0 ? void 0 : _50.logicalDump) === null || _51 === void 0 ? void 0 : _51.options) === null || _52 === void 0 ? void 0 : _52.customOptions) !== null && _53 !== void 0 ? _53 : null),
|
|
72
|
+
pgRestoreCustomOptions: formatDumpCustomOptions((_58 = (_57 = (_56 = (_55 = (_54 = config.retrieval) === null || _54 === void 0 ? void 0 : _54.spec) === null || _55 === void 0 ? void 0 : _55.logicalRestore) === null || _56 === void 0 ? void 0 : _56.options) === null || _57 === void 0 ? void 0 : _57.customOptions) !== null && _58 !== void 0 ? _58 : null),
|
|
46
73
|
};
|
|
47
74
|
};
|