@multiplatform.one/utils 1.0.0 → 5.0.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/lib/chunk-55ZF3CTQ.cjs +84 -0
- package/lib/chunk-QMKU5DBF.js +84 -0
- package/lib/dev.cjs +102 -0
- package/lib/dev.js +102 -0
- package/lib/index.cjs +5 -0
- package/lib/index.js +5 -1
- package/lib/meshConfig.cjs +98 -0
- package/lib/meshConfig.js +98 -0
- package/lib/wait.cjs +16 -0
- package/lib/wait.js +16 -0
- package/package.json +38 -35
- package/src/dev.ts +132 -0
- package/src/index.ts +4 -4
- package/src/meshConfig.ts +130 -0
- package/src/wait.ts +99 -0
- package/types/.tsbuildinfo +1 -0
- package/types/dev.d.ts +12 -0
- package/types/dev.d.ts.map +1 -0
- package/{transpileModules → types}/index.d.ts +6 -5
- package/types/index.d.ts.map +1 -0
- package/types/meshConfig.d.ts +86 -0
- package/types/meshConfig.d.ts.map +1 -0
- package/types/wait.d.ts +8 -0
- package/types/wait.d.ts.map +1 -0
- package/lib/index.d.ts +0 -2
- package/lib/transpileModules.d.ts +0 -10
- package/lib/transpileModules.js +0 -48
- package/src/transpileModules.ts +0 -68
- package/transpileModules/index.js +0 -22
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }// src/wait.ts
|
|
2
|
+
var _axios = require('axios'); var _axios2 = _interopRequireDefault(_axios);
|
|
3
|
+
var _pg = require('pg'); var _pg2 = _interopRequireDefault(_pg);
|
|
4
|
+
async function waitForApi(interval) {
|
|
5
|
+
try {
|
|
6
|
+
const res = await _axios2.default.get(
|
|
7
|
+
`http://localhost:${process.env.API_PORT || "5001"}/healthz`
|
|
8
|
+
);
|
|
9
|
+
if ((_optionalChain([res, 'optionalAccess', _ => _.status]) || 500) < 300) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
} catch (err) {
|
|
13
|
+
}
|
|
14
|
+
await new Promise((resolve) => setTimeout(resolve, interval));
|
|
15
|
+
return waitForApi(interval);
|
|
16
|
+
}
|
|
17
|
+
async function waitForFrappe(interval) {
|
|
18
|
+
try {
|
|
19
|
+
const res = await _axios2.default.get(
|
|
20
|
+
`${process.env.FRAPPE_BASE_URL || "http://frappe.localhost"}/api/method/ping`
|
|
21
|
+
);
|
|
22
|
+
if ((_optionalChain([res, 'optionalAccess', _2 => _2.status]) || 500) < 300) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
} catch (err) {
|
|
26
|
+
}
|
|
27
|
+
await new Promise((resolve) => setTimeout(resolve, interval));
|
|
28
|
+
return waitForFrappe(interval);
|
|
29
|
+
}
|
|
30
|
+
async function waitForPostgres(interval) {
|
|
31
|
+
const client = new _pg2.default.Client({
|
|
32
|
+
database: process.env.POSTGRES_DATABASE || "postgres",
|
|
33
|
+
host: process.env.POSTGRES_HOSTNAME || "localhost",
|
|
34
|
+
password: process.env.POSTGRES_PASSWORD || "postgres",
|
|
35
|
+
port: Number.parseInt(process.env.POSTGRES_PORT || "5432"),
|
|
36
|
+
user: process.env.POSTGRES_USERNAME || "postgres"
|
|
37
|
+
});
|
|
38
|
+
try {
|
|
39
|
+
await client.connect();
|
|
40
|
+
while (true) {
|
|
41
|
+
try {
|
|
42
|
+
await client.query("SELECT 1");
|
|
43
|
+
return;
|
|
44
|
+
} catch (error) {
|
|
45
|
+
}
|
|
46
|
+
await new Promise((resolve) => setTimeout(resolve, interval));
|
|
47
|
+
}
|
|
48
|
+
} finally {
|
|
49
|
+
await client.end();
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
async function waitForKeycloak(interval) {
|
|
53
|
+
try {
|
|
54
|
+
const res = await _axios2.default.get(
|
|
55
|
+
`${process.env.KEYCLOAK_BASE_URL || "http://localhost:8080"}/realms/master/.well-known/openid-configuration`
|
|
56
|
+
);
|
|
57
|
+
if ((_optionalChain([res, 'optionalAccess', _3 => _3.status]) || 500) < 300) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
} catch (err) {
|
|
61
|
+
}
|
|
62
|
+
await new Promise((resolve) => setTimeout(resolve, interval));
|
|
63
|
+
return waitForKeycloak(interval);
|
|
64
|
+
}
|
|
65
|
+
function formatServiceList(services) {
|
|
66
|
+
if (services.length === 1) return services[0];
|
|
67
|
+
if (services.length === 2) return `${services[0]} and ${services[1]}`;
|
|
68
|
+
return `${services.slice(0, -1).join(", ")} and ${services[services.length - 1]}`;
|
|
69
|
+
}
|
|
70
|
+
var waitServices = [
|
|
71
|
+
"graphql",
|
|
72
|
+
"frappe",
|
|
73
|
+
"postgres",
|
|
74
|
+
"keycloak"
|
|
75
|
+
];
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
exports.waitForApi = waitForApi; exports.waitForFrappe = waitForFrappe; exports.waitForPostgres = waitForPostgres; exports.waitForKeycloak = waitForKeycloak; exports.formatServiceList = formatServiceList; exports.waitServices = waitServices;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
// src/wait.ts
|
|
2
|
+
import axios from "axios";
|
|
3
|
+
import pg from "pg";
|
|
4
|
+
async function waitForApi(interval) {
|
|
5
|
+
try {
|
|
6
|
+
const res = await axios.get(
|
|
7
|
+
`http://localhost:${process.env.API_PORT || "5001"}/healthz`
|
|
8
|
+
);
|
|
9
|
+
if ((res?.status || 500) < 300) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
} catch (err) {
|
|
13
|
+
}
|
|
14
|
+
await new Promise((resolve) => setTimeout(resolve, interval));
|
|
15
|
+
return waitForApi(interval);
|
|
16
|
+
}
|
|
17
|
+
async function waitForFrappe(interval) {
|
|
18
|
+
try {
|
|
19
|
+
const res = await axios.get(
|
|
20
|
+
`${process.env.FRAPPE_BASE_URL || "http://frappe.localhost"}/api/method/ping`
|
|
21
|
+
);
|
|
22
|
+
if ((res?.status || 500) < 300) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
} catch (err) {
|
|
26
|
+
}
|
|
27
|
+
await new Promise((resolve) => setTimeout(resolve, interval));
|
|
28
|
+
return waitForFrappe(interval);
|
|
29
|
+
}
|
|
30
|
+
async function waitForPostgres(interval) {
|
|
31
|
+
const client = new pg.Client({
|
|
32
|
+
database: process.env.POSTGRES_DATABASE || "postgres",
|
|
33
|
+
host: process.env.POSTGRES_HOSTNAME || "localhost",
|
|
34
|
+
password: process.env.POSTGRES_PASSWORD || "postgres",
|
|
35
|
+
port: Number.parseInt(process.env.POSTGRES_PORT || "5432"),
|
|
36
|
+
user: process.env.POSTGRES_USERNAME || "postgres"
|
|
37
|
+
});
|
|
38
|
+
try {
|
|
39
|
+
await client.connect();
|
|
40
|
+
while (true) {
|
|
41
|
+
try {
|
|
42
|
+
await client.query("SELECT 1");
|
|
43
|
+
return;
|
|
44
|
+
} catch (error) {
|
|
45
|
+
}
|
|
46
|
+
await new Promise((resolve) => setTimeout(resolve, interval));
|
|
47
|
+
}
|
|
48
|
+
} finally {
|
|
49
|
+
await client.end();
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
async function waitForKeycloak(interval) {
|
|
53
|
+
try {
|
|
54
|
+
const res = await axios.get(
|
|
55
|
+
`${process.env.KEYCLOAK_BASE_URL || "http://localhost:8080"}/realms/master/.well-known/openid-configuration`
|
|
56
|
+
);
|
|
57
|
+
if ((res?.status || 500) < 300) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
} catch (err) {
|
|
61
|
+
}
|
|
62
|
+
await new Promise((resolve) => setTimeout(resolve, interval));
|
|
63
|
+
return waitForKeycloak(interval);
|
|
64
|
+
}
|
|
65
|
+
function formatServiceList(services) {
|
|
66
|
+
if (services.length === 1) return services[0];
|
|
67
|
+
if (services.length === 2) return `${services[0]} and ${services[1]}`;
|
|
68
|
+
return `${services.slice(0, -1).join(", ")} and ${services[services.length - 1]}`;
|
|
69
|
+
}
|
|
70
|
+
var waitServices = [
|
|
71
|
+
"graphql",
|
|
72
|
+
"frappe",
|
|
73
|
+
"postgres",
|
|
74
|
+
"keycloak"
|
|
75
|
+
];
|
|
76
|
+
|
|
77
|
+
export {
|
|
78
|
+
waitForApi,
|
|
79
|
+
waitForFrappe,
|
|
80
|
+
waitForPostgres,
|
|
81
|
+
waitForKeycloak,
|
|
82
|
+
formatServiceList,
|
|
83
|
+
waitServices
|
|
84
|
+
};
|
package/lib/dev.cjs
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
var _chunk55ZF3CTQcjs = require('./chunk-55ZF3CTQ.cjs');
|
|
9
|
+
|
|
10
|
+
// src/dev.ts
|
|
11
|
+
var _fs = require('fs'); var _fs2 = _interopRequireDefault(_fs);
|
|
12
|
+
var _path = require('path'); var _path2 = _interopRequireDefault(_path);
|
|
13
|
+
var logger = console;
|
|
14
|
+
function lookupTranspileModules(packageDirs, { log = true } = {}) {
|
|
15
|
+
const transpileModules = [
|
|
16
|
+
...new Set(
|
|
17
|
+
[
|
|
18
|
+
.../* @__PURE__ */ new Set([
|
|
19
|
+
projectRoot,
|
|
20
|
+
_path2.default.resolve(projectRoot, "app"),
|
|
21
|
+
_path2.default.resolve(projectRoot, "packages", "ui"),
|
|
22
|
+
...packageDirs || []
|
|
23
|
+
])
|
|
24
|
+
].map((packageDir) => {
|
|
25
|
+
try {
|
|
26
|
+
return JSON.parse(
|
|
27
|
+
_fs2.default.readFileSync(_path2.default.join(packageDir, "package.json"), "utf-8")
|
|
28
|
+
).transpileModules || [];
|
|
29
|
+
} catch (err) {
|
|
30
|
+
if (log) logger.error(err);
|
|
31
|
+
return [];
|
|
32
|
+
}
|
|
33
|
+
})
|
|
34
|
+
)
|
|
35
|
+
].flat();
|
|
36
|
+
if (log) logger.debug("transpileModules:", transpileModules.join(", "));
|
|
37
|
+
return transpileModules;
|
|
38
|
+
}
|
|
39
|
+
function lookupTamaguiModules(packageDirs, { log = true } = {}) {
|
|
40
|
+
const tamaguiModules = [
|
|
41
|
+
.../* @__PURE__ */ new Set([
|
|
42
|
+
"tamagui",
|
|
43
|
+
...[
|
|
44
|
+
.../* @__PURE__ */ new Set([
|
|
45
|
+
projectRoot,
|
|
46
|
+
_path2.default.resolve(projectRoot, "app"),
|
|
47
|
+
_path2.default.resolve(projectRoot, "packages", "ui"),
|
|
48
|
+
...packageDirs || []
|
|
49
|
+
])
|
|
50
|
+
].map((packageDir) => {
|
|
51
|
+
try {
|
|
52
|
+
return JSON.parse(
|
|
53
|
+
_fs2.default.readFileSync(_path2.default.join(packageDir, "package.json"), "utf-8")
|
|
54
|
+
).tamaguiModules || [];
|
|
55
|
+
} catch (err) {
|
|
56
|
+
if (log) logger.error(err);
|
|
57
|
+
return [];
|
|
58
|
+
}
|
|
59
|
+
})
|
|
60
|
+
])
|
|
61
|
+
].flat();
|
|
62
|
+
if (log) logger.debug("tamaguiModules:", tamaguiModules.join(", "));
|
|
63
|
+
return tamaguiModules;
|
|
64
|
+
}
|
|
65
|
+
function resolveConfig(keys = []) {
|
|
66
|
+
return keys.reduce(
|
|
67
|
+
(acc, key) => {
|
|
68
|
+
if (process.env[key]) acc[key] = process.env[key];
|
|
69
|
+
return acc;
|
|
70
|
+
},
|
|
71
|
+
{}
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
var projectRoot = (() => {
|
|
75
|
+
const rootDir = _path2.default.parse(new URL(import.meta.url).pathname).root;
|
|
76
|
+
let projectRoot2 = _path2.default.dirname(new URL(import.meta.url).pathname);
|
|
77
|
+
while (projectRoot2 !== rootDir) {
|
|
78
|
+
const packageJsonPath = _path2.default.join(projectRoot2, "package.json");
|
|
79
|
+
const packageJsonExists = _fs2.default.existsSync(packageJsonPath) && _fs2.default.statSync(packageJsonPath).isFile();
|
|
80
|
+
if (packageJsonExists) {
|
|
81
|
+
const npmrcPath = _path2.default.join(projectRoot2, ".npmrc");
|
|
82
|
+
const nodeModulesPath = _path2.default.join(projectRoot2, "node_modules");
|
|
83
|
+
const npmrcExists = _fs2.default.existsSync(npmrcPath) && _fs2.default.statSync(npmrcPath).isFile();
|
|
84
|
+
const nodeModulesExists = _fs2.default.existsSync(nodeModulesPath) && _fs2.default.statSync(nodeModulesPath).isDirectory();
|
|
85
|
+
if (npmrcExists && nodeModulesExists) return projectRoot2;
|
|
86
|
+
}
|
|
87
|
+
projectRoot2 = _path2.default.dirname(projectRoot2);
|
|
88
|
+
}
|
|
89
|
+
return process.cwd();
|
|
90
|
+
})();
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
exports.formatServiceList = _chunk55ZF3CTQcjs.formatServiceList; exports.lookupTamaguiModules = lookupTamaguiModules; exports.lookupTranspileModules = lookupTranspileModules; exports.projectRoot = projectRoot; exports.resolveConfig = resolveConfig; exports.waitForApi = _chunk55ZF3CTQcjs.waitForApi; exports.waitForFrappe = _chunk55ZF3CTQcjs.waitForFrappe; exports.waitForKeycloak = _chunk55ZF3CTQcjs.waitForKeycloak; exports.waitForPostgres = _chunk55ZF3CTQcjs.waitForPostgres; exports.waitServices = _chunk55ZF3CTQcjs.waitServices;
|
package/lib/dev.js
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import {
|
|
2
|
+
formatServiceList,
|
|
3
|
+
waitForApi,
|
|
4
|
+
waitForFrappe,
|
|
5
|
+
waitForKeycloak,
|
|
6
|
+
waitForPostgres,
|
|
7
|
+
waitServices
|
|
8
|
+
} from "./chunk-QMKU5DBF.js";
|
|
9
|
+
|
|
10
|
+
// src/dev.ts
|
|
11
|
+
import fs from "node:fs";
|
|
12
|
+
import path from "node:path";
|
|
13
|
+
var logger = console;
|
|
14
|
+
function lookupTranspileModules(packageDirs, { log = true } = {}) {
|
|
15
|
+
const transpileModules = [
|
|
16
|
+
...new Set(
|
|
17
|
+
[
|
|
18
|
+
.../* @__PURE__ */ new Set([
|
|
19
|
+
projectRoot,
|
|
20
|
+
path.resolve(projectRoot, "app"),
|
|
21
|
+
path.resolve(projectRoot, "packages", "ui"),
|
|
22
|
+
...packageDirs || []
|
|
23
|
+
])
|
|
24
|
+
].map((packageDir) => {
|
|
25
|
+
try {
|
|
26
|
+
return JSON.parse(
|
|
27
|
+
fs.readFileSync(path.join(packageDir, "package.json"), "utf-8")
|
|
28
|
+
).transpileModules || [];
|
|
29
|
+
} catch (err) {
|
|
30
|
+
if (log) logger.error(err);
|
|
31
|
+
return [];
|
|
32
|
+
}
|
|
33
|
+
})
|
|
34
|
+
)
|
|
35
|
+
].flat();
|
|
36
|
+
if (log) logger.debug("transpileModules:", transpileModules.join(", "));
|
|
37
|
+
return transpileModules;
|
|
38
|
+
}
|
|
39
|
+
function lookupTamaguiModules(packageDirs, { log = true } = {}) {
|
|
40
|
+
const tamaguiModules = [
|
|
41
|
+
.../* @__PURE__ */ new Set([
|
|
42
|
+
"tamagui",
|
|
43
|
+
...[
|
|
44
|
+
.../* @__PURE__ */ new Set([
|
|
45
|
+
projectRoot,
|
|
46
|
+
path.resolve(projectRoot, "app"),
|
|
47
|
+
path.resolve(projectRoot, "packages", "ui"),
|
|
48
|
+
...packageDirs || []
|
|
49
|
+
])
|
|
50
|
+
].map((packageDir) => {
|
|
51
|
+
try {
|
|
52
|
+
return JSON.parse(
|
|
53
|
+
fs.readFileSync(path.join(packageDir, "package.json"), "utf-8")
|
|
54
|
+
).tamaguiModules || [];
|
|
55
|
+
} catch (err) {
|
|
56
|
+
if (log) logger.error(err);
|
|
57
|
+
return [];
|
|
58
|
+
}
|
|
59
|
+
})
|
|
60
|
+
])
|
|
61
|
+
].flat();
|
|
62
|
+
if (log) logger.debug("tamaguiModules:", tamaguiModules.join(", "));
|
|
63
|
+
return tamaguiModules;
|
|
64
|
+
}
|
|
65
|
+
function resolveConfig(keys = []) {
|
|
66
|
+
return keys.reduce(
|
|
67
|
+
(acc, key) => {
|
|
68
|
+
if (process.env[key]) acc[key] = process.env[key];
|
|
69
|
+
return acc;
|
|
70
|
+
},
|
|
71
|
+
{}
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
var projectRoot = (() => {
|
|
75
|
+
const rootDir = path.parse(new URL(import.meta.url).pathname).root;
|
|
76
|
+
let projectRoot2 = path.dirname(new URL(import.meta.url).pathname);
|
|
77
|
+
while (projectRoot2 !== rootDir) {
|
|
78
|
+
const packageJsonPath = path.join(projectRoot2, "package.json");
|
|
79
|
+
const packageJsonExists = fs.existsSync(packageJsonPath) && fs.statSync(packageJsonPath).isFile();
|
|
80
|
+
if (packageJsonExists) {
|
|
81
|
+
const npmrcPath = path.join(projectRoot2, ".npmrc");
|
|
82
|
+
const nodeModulesPath = path.join(projectRoot2, "node_modules");
|
|
83
|
+
const npmrcExists = fs.existsSync(npmrcPath) && fs.statSync(npmrcPath).isFile();
|
|
84
|
+
const nodeModulesExists = fs.existsSync(nodeModulesPath) && fs.statSync(nodeModulesPath).isDirectory();
|
|
85
|
+
if (npmrcExists && nodeModulesExists) return projectRoot2;
|
|
86
|
+
}
|
|
87
|
+
projectRoot2 = path.dirname(projectRoot2);
|
|
88
|
+
}
|
|
89
|
+
return process.cwd();
|
|
90
|
+
})();
|
|
91
|
+
export {
|
|
92
|
+
formatServiceList,
|
|
93
|
+
lookupTamaguiModules,
|
|
94
|
+
lookupTranspileModules,
|
|
95
|
+
projectRoot,
|
|
96
|
+
resolveConfig,
|
|
97
|
+
waitForApi,
|
|
98
|
+
waitForFrappe,
|
|
99
|
+
waitForKeycloak,
|
|
100
|
+
waitForPostgres,
|
|
101
|
+
waitServices
|
|
102
|
+
};
|
package/lib/index.cjs
ADDED
package/lib/index.js
CHANGED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/meshConfig.ts
|
|
2
|
+
var meshConfig = {
|
|
3
|
+
sources: [
|
|
4
|
+
...process.env.MESH_API === "1" ? [
|
|
5
|
+
{
|
|
6
|
+
name: "API",
|
|
7
|
+
handler: {
|
|
8
|
+
graphql: {
|
|
9
|
+
endpoint: `http://localhost:${process.env.API_PORT}/graphql`,
|
|
10
|
+
subscriptionsEndpoint: `ws://localhost:${process.env.API_PORT}/graphql`,
|
|
11
|
+
subscriptionsProtocol: "WS",
|
|
12
|
+
operationHeaders: {
|
|
13
|
+
Authorization: "{context.headers.Authorization}",
|
|
14
|
+
Cookie: "{context.headers.Cookie}"
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
transforms: [
|
|
19
|
+
{
|
|
20
|
+
prefix: {
|
|
21
|
+
mode: "wrap",
|
|
22
|
+
value: "API"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
filterSchema: {
|
|
27
|
+
mode: "wrap",
|
|
28
|
+
filters: []
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
] : [],
|
|
34
|
+
...process.env.MESH_FRAPPE === "1" ? [
|
|
35
|
+
{
|
|
36
|
+
name: "Frappe",
|
|
37
|
+
handler: {
|
|
38
|
+
graphql: {
|
|
39
|
+
endpoint: `${process.env.FRAPPE_BASE_URL}/api/method/graphql`,
|
|
40
|
+
subscriptionsEndpoint: `${process.env.FRAPPE_BASE_URL}/api/method/graphql`.replace(
|
|
41
|
+
/^https?/,
|
|
42
|
+
"ws"
|
|
43
|
+
),
|
|
44
|
+
subscriptionsProtocol: "WS",
|
|
45
|
+
operationHeaders: {
|
|
46
|
+
Authorization: "{context.headers.Authorization}",
|
|
47
|
+
Cookie: "{context.headers.Cookie}"
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
transforms: [
|
|
52
|
+
{
|
|
53
|
+
prefix: {
|
|
54
|
+
mode: "wrap",
|
|
55
|
+
value: "Frappe"
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
filterSchema: {
|
|
60
|
+
mode: "wrap",
|
|
61
|
+
filters: ["Subscription.doc_events"]
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
]
|
|
65
|
+
}
|
|
66
|
+
] : []
|
|
67
|
+
],
|
|
68
|
+
additionalEnvelopPlugins: "./envelopPlugins.js",
|
|
69
|
+
serve: {
|
|
70
|
+
browser: false
|
|
71
|
+
},
|
|
72
|
+
plugins: [
|
|
73
|
+
{
|
|
74
|
+
rateLimit: {
|
|
75
|
+
config: []
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
maxTokens: {
|
|
80
|
+
n: 1e3
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
maxDepth: {
|
|
85
|
+
n: 10
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
blockFieldSuggestions: {}
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
responseCache: {}
|
|
93
|
+
}
|
|
94
|
+
]
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
exports.meshConfig = meshConfig;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
// src/meshConfig.ts
|
|
2
|
+
var meshConfig = {
|
|
3
|
+
sources: [
|
|
4
|
+
...process.env.MESH_API === "1" ? [
|
|
5
|
+
{
|
|
6
|
+
name: "API",
|
|
7
|
+
handler: {
|
|
8
|
+
graphql: {
|
|
9
|
+
endpoint: `http://localhost:${process.env.API_PORT}/graphql`,
|
|
10
|
+
subscriptionsEndpoint: `ws://localhost:${process.env.API_PORT}/graphql`,
|
|
11
|
+
subscriptionsProtocol: "WS",
|
|
12
|
+
operationHeaders: {
|
|
13
|
+
Authorization: "{context.headers.Authorization}",
|
|
14
|
+
Cookie: "{context.headers.Cookie}"
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
transforms: [
|
|
19
|
+
{
|
|
20
|
+
prefix: {
|
|
21
|
+
mode: "wrap",
|
|
22
|
+
value: "API"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
filterSchema: {
|
|
27
|
+
mode: "wrap",
|
|
28
|
+
filters: []
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
] : [],
|
|
34
|
+
...process.env.MESH_FRAPPE === "1" ? [
|
|
35
|
+
{
|
|
36
|
+
name: "Frappe",
|
|
37
|
+
handler: {
|
|
38
|
+
graphql: {
|
|
39
|
+
endpoint: `${process.env.FRAPPE_BASE_URL}/api/method/graphql`,
|
|
40
|
+
subscriptionsEndpoint: `${process.env.FRAPPE_BASE_URL}/api/method/graphql`.replace(
|
|
41
|
+
/^https?/,
|
|
42
|
+
"ws"
|
|
43
|
+
),
|
|
44
|
+
subscriptionsProtocol: "WS",
|
|
45
|
+
operationHeaders: {
|
|
46
|
+
Authorization: "{context.headers.Authorization}",
|
|
47
|
+
Cookie: "{context.headers.Cookie}"
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
transforms: [
|
|
52
|
+
{
|
|
53
|
+
prefix: {
|
|
54
|
+
mode: "wrap",
|
|
55
|
+
value: "Frappe"
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
filterSchema: {
|
|
60
|
+
mode: "wrap",
|
|
61
|
+
filters: ["Subscription.doc_events"]
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
]
|
|
65
|
+
}
|
|
66
|
+
] : []
|
|
67
|
+
],
|
|
68
|
+
additionalEnvelopPlugins: "./envelopPlugins.js",
|
|
69
|
+
serve: {
|
|
70
|
+
browser: false
|
|
71
|
+
},
|
|
72
|
+
plugins: [
|
|
73
|
+
{
|
|
74
|
+
rateLimit: {
|
|
75
|
+
config: []
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
maxTokens: {
|
|
80
|
+
n: 1e3
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
maxDepth: {
|
|
85
|
+
n: 10
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
blockFieldSuggestions: {}
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
responseCache: {}
|
|
93
|
+
}
|
|
94
|
+
]
|
|
95
|
+
};
|
|
96
|
+
export {
|
|
97
|
+
meshConfig
|
|
98
|
+
};
|
package/lib/wait.cjs
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
var _chunk55ZF3CTQcjs = require('./chunk-55ZF3CTQ.cjs');
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
exports.formatServiceList = _chunk55ZF3CTQcjs.formatServiceList; exports.waitForApi = _chunk55ZF3CTQcjs.waitForApi; exports.waitForFrappe = _chunk55ZF3CTQcjs.waitForFrappe; exports.waitForKeycloak = _chunk55ZF3CTQcjs.waitForKeycloak; exports.waitForPostgres = _chunk55ZF3CTQcjs.waitForPostgres; exports.waitServices = _chunk55ZF3CTQcjs.waitServices;
|
package/lib/wait.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import {
|
|
2
|
+
formatServiceList,
|
|
3
|
+
waitForApi,
|
|
4
|
+
waitForFrappe,
|
|
5
|
+
waitForKeycloak,
|
|
6
|
+
waitForPostgres,
|
|
7
|
+
waitServices
|
|
8
|
+
} from "./chunk-QMKU5DBF.js";
|
|
9
|
+
export {
|
|
10
|
+
formatServiceList,
|
|
11
|
+
waitForApi,
|
|
12
|
+
waitForFrappe,
|
|
13
|
+
waitForKeycloak,
|
|
14
|
+
waitForPostgres,
|
|
15
|
+
waitServices
|
|
16
|
+
};
|