@datapos/datapos-development 0.3.120 â 0.3.122
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/datapos-development.es.js +80 -80
- package/package.json +1 -1
|
@@ -2,24 +2,24 @@ import { exec as h } from "node:child_process";
|
|
|
2
2
|
import { promises as t } from "node:fs";
|
|
3
3
|
import { nanoid as b } from "nanoid";
|
|
4
4
|
import { promisify as $ } from "node:util";
|
|
5
|
-
const
|
|
5
|
+
const v = ["createObject", "dropObject", "removeRecords", "upsertRecords"], O = ["findObject", "getRecord", "listNodes", "previewObject", "retrieveRecords"], w = $(h);
|
|
6
6
|
async function j() {
|
|
7
7
|
try {
|
|
8
8
|
console.info("đ Building configuration...");
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
} catch (
|
|
12
|
-
console.error("â Error building configuration.",
|
|
9
|
+
const e = JSON.parse(await t.readFile("package.json", "utf8")), o = JSON.parse(await t.readFile("config.json", "utf8"));
|
|
10
|
+
e.name != null && (o.id = e.name.replace("@datapos/", "").replace("@data-positioning/", "")), e.version != null && (o.version = e.version), await t.writeFile("config.json", JSON.stringify(o, void 0, 4), "utf8"), console.info("â
Configuration built.");
|
|
11
|
+
} catch (e) {
|
|
12
|
+
console.error("â Error building configuration.", e);
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
|
-
async function C(
|
|
15
|
+
async function C(e) {
|
|
16
16
|
try {
|
|
17
|
-
console.info(`đ Building public directory index for identifier '${
|
|
18
|
-
const
|
|
17
|
+
console.info(`đ Building public directory index for identifier '${e}'...`);
|
|
18
|
+
const o = {};
|
|
19
19
|
async function i(s, r) {
|
|
20
20
|
console.info(`âī¸ Processing directory '${s}'...`);
|
|
21
|
-
const d = [], a = s.substring(`public/${
|
|
22
|
-
|
|
21
|
+
const d = [], a = s.substring(`public/${e}`.length);
|
|
22
|
+
o[a] = d;
|
|
23
23
|
for (const c of r) {
|
|
24
24
|
const l = `${s}/${c}`;
|
|
25
25
|
try {
|
|
@@ -40,78 +40,78 @@ async function C(o) {
|
|
|
40
40
|
return f === 0 ? c.name.localeCompare(l.name) : f;
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
|
-
const n = await t.readdir(`public/${
|
|
44
|
-
await i(`public/${
|
|
45
|
-
} catch (
|
|
46
|
-
console.error("â Error building public directory index.",
|
|
43
|
+
const n = await t.readdir(`public/${e}`);
|
|
44
|
+
await i(`public/${e}`, n), await t.writeFile(`./public/${e}Index.json`, JSON.stringify(o), "utf8"), console.info("â
Public directory index built.");
|
|
45
|
+
} catch (o) {
|
|
46
|
+
console.error("â Error building public directory index.", o);
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
|
-
async function
|
|
49
|
+
async function k() {
|
|
50
50
|
try {
|
|
51
51
|
console.info("đ Building connector configuration...");
|
|
52
|
-
const
|
|
52
|
+
const e = JSON.parse(await t.readFile("package.json", "utf8")), o = JSON.parse(await t.readFile("config.json", "utf8")), i = await t.readFile("src/index.ts", "utf8");
|
|
53
53
|
let n = !1, s = !1;
|
|
54
54
|
const r = /^\s{4}(?:async\s+)?(private\s+)?(?:public\s+|protected\s+)?([A-Za-z_]\w*)\s*\(/gm, d = [...i.matchAll(r)].filter((c) => c[1] == null && c[2] !== "constructor").map((c) => {
|
|
55
55
|
const l = c[2];
|
|
56
|
-
return n = n ||
|
|
56
|
+
return n = n || v.includes(l), s = s || O.includes(l), l;
|
|
57
57
|
});
|
|
58
58
|
d.length > 0 ? console.info(`âšī¸ Implements ${d.length} operations.`) : console.warn("â ī¸ Implements no operations.");
|
|
59
59
|
const a = s && n ? "bidirectional" : s ? "source" : n ? "destination" : "unknown";
|
|
60
|
-
a && console.info(`âšī¸ Supports ${a} usage.`),
|
|
61
|
-
} catch (
|
|
62
|
-
console.error("â Error building connector configuration.",
|
|
60
|
+
a && console.info(`âšī¸ Supports ${a} usage.`), e.name != null && (o.id = e.name), o.operations = d, o.usageId = a, e.version != null && (o.version = e.version), await t.writeFile("config.json", JSON.stringify(o, void 0, 4), "utf8"), console.info("â
Connector configuration built.");
|
|
61
|
+
} catch (e) {
|
|
62
|
+
console.error("â Error building connector configuration.", e);
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
|
-
async function
|
|
65
|
+
async function J() {
|
|
66
66
|
try {
|
|
67
67
|
console.info("đ Building context configuration...");
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
} catch (
|
|
71
|
-
console.error("â Error building context configuration.",
|
|
68
|
+
const e = JSON.parse(await t.readFile("package.json", "utf8")), o = JSON.parse(await t.readFile("config.json", "utf8")), i = await t.readFile("src/index.ts", "utf8"), n = /^\s{4}(?:async\s+)?(private\s+)?(?:public\s+|protected\s+)?([A-Za-z_]\w*)\s*\(/gm, s = [...i.matchAll(n)].filter((r) => r[1] == null && r[2] !== "constructor").map((r) => r[2]);
|
|
69
|
+
e.name != null && (o.id = e.name), o.operations = s, e.version != null && (o.version = e.version), await t.writeFile("config.json", JSON.stringify(o, void 0, 4), "utf8"), console.info("â
Context configuration built.");
|
|
70
|
+
} catch (e) {
|
|
71
|
+
console.error("â Error building context configuration.", e);
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
|
-
async function
|
|
74
|
+
async function R() {
|
|
75
75
|
try {
|
|
76
76
|
console.info("đ Building presenter configuration...");
|
|
77
|
-
const
|
|
78
|
-
|
|
79
|
-
} catch (
|
|
80
|
-
console.error("â Error building context configuration.",
|
|
77
|
+
const e = JSON.parse(await t.readFile("package.json", "utf8")), o = JSON.parse(await t.readFile("config.json", "utf8")), i = await t.readFile("src/index.ts", "utf8"), n = /^\s{4}(?:async\s+)?(private\s+)?(?:public\s+|protected\s+)?([A-Za-z_]\w*)\s*\(/gm, s = [...i.matchAll(n)].filter((r) => !r[1] && r[2] !== "constructor").map((r) => r[2]);
|
|
78
|
+
e.name != null && (o.id = e.name), o.operations = s, e.version != null && (o.version = e.version), await t.writeFile("config.json", JSON.stringify(o, void 0, 4), "utf8"), console.info("â
Presenter configuration built.");
|
|
79
|
+
} catch (e) {
|
|
80
|
+
console.error("â Error building context configuration.", e);
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
|
-
async function A(
|
|
83
|
+
async function A(e = "./") {
|
|
84
84
|
try {
|
|
85
85
|
console.info("đ Bumping version...");
|
|
86
|
-
const
|
|
87
|
-
if (
|
|
88
|
-
|
|
86
|
+
const o = JSON.parse(await t.readFile(`${e}package.json`, "utf8"));
|
|
87
|
+
if (o.version == null)
|
|
88
|
+
o.version = "0.0.001", await t.writeFile(`${e}package.json`, JSON.stringify(o, void 0, 4), "utf8"), console.warn(`â ī¸ Version initialised to ${o.version}.`);
|
|
89
89
|
else {
|
|
90
|
-
const i =
|
|
91
|
-
|
|
90
|
+
const i = o.version, n = o.version.split(".");
|
|
91
|
+
o.version = `${n[0]}.${n[1]}.${Number(n[2]) + 1}`, await t.writeFile(`${e}package.json`, JSON.stringify(o, void 0, 4), "utf8"), console.info(`â
Version bumped from ${i} to ${o.version}.`);
|
|
92
92
|
}
|
|
93
|
-
} catch (
|
|
94
|
-
console.error("â Error bumping package version.",
|
|
93
|
+
} catch (o) {
|
|
94
|
+
console.error("â Error bumping package version.", o);
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
|
-
function F(
|
|
98
|
-
console.error(`â ${
|
|
97
|
+
function F(e) {
|
|
98
|
+
console.error(`â ${e} script not implemented.`);
|
|
99
99
|
}
|
|
100
100
|
async function D() {
|
|
101
|
-
const
|
|
101
|
+
const e = "<!-- DEPENDENCY_LICENSES_START -->", o = "<!-- DEPENDENCY_LICENSES_END -->";
|
|
102
102
|
try {
|
|
103
|
-
const i = (await t.readFile("./licenses.md", "utf8")).trim(), n = await t.readFile("./README.md", "utf8"), s = n.indexOf(
|
|
104
|
-
(s === -1 || r === -1) && (console.error("
|
|
105
|
-
const d = n.substring(0, s +
|
|
103
|
+
const i = (await t.readFile("./licenses.md", "utf8")).trim(), n = await t.readFile("./README.md", "utf8"), s = n.indexOf(e), r = n.indexOf(o);
|
|
104
|
+
(s === -1 || r === -1) && (console.error("â Dependency license markers not found in readme file."), process.exit(1));
|
|
105
|
+
const d = n.substring(0, s + e.length) + `
|
|
106
106
|
` + i + `
|
|
107
107
|
` + n.substring(r);
|
|
108
|
-
await t.writeFile("README.md", d, "utf8"), console.log("
|
|
108
|
+
await t.writeFile("README.md", d, "utf8"), console.log("â
Readme file updated with license information");
|
|
109
109
|
} catch (i) {
|
|
110
|
-
console.error("Error updating
|
|
110
|
+
console.error("â Error updating readme file.", i), process.exit(1);
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
|
-
async function
|
|
114
|
-
const
|
|
113
|
+
async function I() {
|
|
114
|
+
const e = "<!-- OWASP_BADGE_START -->", o = "<!-- OWASP_BADGE_END -->";
|
|
115
115
|
try {
|
|
116
116
|
const i = JSON.parse(await t.readFile("./dependency-check-reports/dependency-check-report.json", "utf-8")), n = { critical: 0, high: 0, moderate: 0, low: 0, unknown: 0 };
|
|
117
117
|
for (const u of i.dependencies)
|
|
@@ -136,38 +136,38 @@ async function M() {
|
|
|
136
136
|
console.info(`â
Total vulnerabilities found: ${d}`), console.info(
|
|
137
137
|
` Critical: ${n.critical}, High: ${n.high}, Moderate: ${n.moderate}, Low: ${n.low}, Unknown: ${n.unknown}`
|
|
138
138
|
);
|
|
139
|
-
const a = await t.readFile("./README.md", "utf8"), c = a.indexOf(
|
|
140
|
-
(c === -1 || l === -1) && (console.error("â
|
|
141
|
-
const f = r.join(" "), p = a.substring(0, c +
|
|
139
|
+
const a = await t.readFile("./README.md", "utf8"), c = a.indexOf(e), l = a.indexOf(o);
|
|
140
|
+
(c === -1 || l === -1) && (console.error("â OWASP badge markers not found in README.md."), process.exit(1));
|
|
141
|
+
const f = r.join(" "), p = a.substring(0, c + e.length) + f + a.substring(l);
|
|
142
142
|
await t.writeFile("README.md", p, "utf8"), console.info("â
OWASP dependency check badges inserted into README.md");
|
|
143
143
|
} catch (i) {
|
|
144
144
|
console.error("â Error updating README with OWASP badges:", i), process.exit(1);
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
|
-
async function
|
|
147
|
+
async function P() {
|
|
148
148
|
try {
|
|
149
149
|
console.info("đ Sending deployment notice...");
|
|
150
|
-
const
|
|
151
|
-
body: JSON.stringify(
|
|
150
|
+
const e = JSON.parse(await t.readFile("config.json", "utf8")), o = {
|
|
151
|
+
body: JSON.stringify(e),
|
|
152
152
|
headers: { "Content-Type": "application/json" },
|
|
153
153
|
method: "PUT"
|
|
154
|
-
}, i = await fetch(`https://api.datapos.app/states/${
|
|
154
|
+
}, i = await fetch(`https://api.datapos.app/states/${e.id}`, o);
|
|
155
155
|
if (!i.ok) throw new Error(await i.text());
|
|
156
156
|
console.info("â
Deployment notice sent.");
|
|
157
|
-
} catch (
|
|
158
|
-
console.error("â Error sending deployment notice.",
|
|
157
|
+
} catch (e) {
|
|
158
|
+
console.error("â Error sending deployment notice.", e);
|
|
159
159
|
}
|
|
160
160
|
}
|
|
161
|
-
async function
|
|
161
|
+
async function M() {
|
|
162
162
|
try {
|
|
163
163
|
console.info("đ Synchronising with GitHub....");
|
|
164
|
-
const
|
|
165
|
-
await w("git add ."), await w(`git commit -m "v${
|
|
166
|
-
} catch (
|
|
167
|
-
console.error("â Error synchronising with GitHub.",
|
|
164
|
+
const e = JSON.parse(await t.readFile("package.json", "utf8"));
|
|
165
|
+
await w("git add ."), await w(`git commit -m "v${e.version}"`), await w("git push origin main:main"), console.info(`â
Synchronised version ${e.version} with GitHub.`);
|
|
166
|
+
} catch (e) {
|
|
167
|
+
console.error("â Error synchronising with GitHub.", e);
|
|
168
168
|
}
|
|
169
169
|
}
|
|
170
|
-
async function T(
|
|
170
|
+
async function T(e, o) {
|
|
171
171
|
try {
|
|
172
172
|
console.info("đ Uploading directory to R2....");
|
|
173
173
|
async function i(s, r, d) {
|
|
@@ -183,8 +183,8 @@ async function T(o, e) {
|
|
|
183
183
|
}
|
|
184
184
|
}
|
|
185
185
|
}
|
|
186
|
-
const n = await t.readdir(`${
|
|
187
|
-
await i(`${
|
|
186
|
+
const n = await t.readdir(`${e}/${o}/`);
|
|
187
|
+
await i(`${e}/${o}`, o, n), console.info("â
Directory uploaded to R2.");
|
|
188
188
|
} catch (i) {
|
|
189
189
|
console.error("â Error uploading directory to R2.", i);
|
|
190
190
|
}
|
|
@@ -192,18 +192,18 @@ async function T(o, e) {
|
|
|
192
192
|
async function _() {
|
|
193
193
|
try {
|
|
194
194
|
console.info("đ Uploading module configuration....");
|
|
195
|
-
const
|
|
196
|
-
body: JSON.stringify(
|
|
195
|
+
const e = JSON.parse(await t.readFile("config.json", "utf8")), o = e.id, i = {
|
|
196
|
+
body: JSON.stringify(e),
|
|
197
197
|
headers: { "Content-Type": "application/json" },
|
|
198
198
|
method: "PUT"
|
|
199
|
-
}, n = await fetch(`https://api.datapos.app/states/${
|
|
199
|
+
}, n = await fetch(`https://api.datapos.app/states/${o}`, i);
|
|
200
200
|
if (!n.ok) throw new Error(await n.text());
|
|
201
201
|
console.info("â
Module configuration uploaded.");
|
|
202
|
-
} catch (
|
|
203
|
-
console.error("â Error uploading module configuration.",
|
|
202
|
+
} catch (e) {
|
|
203
|
+
console.error("â Error uploading module configuration.", e);
|
|
204
204
|
}
|
|
205
205
|
}
|
|
206
|
-
async function U(
|
|
206
|
+
async function U(e) {
|
|
207
207
|
try {
|
|
208
208
|
console.info("đ Uploading module to R2...");
|
|
209
209
|
const i = `v${JSON.parse(await t.readFile("package.json", "utf8")).version}`;
|
|
@@ -212,7 +212,7 @@ async function U(o) {
|
|
|
212
212
|
for (const a of d) {
|
|
213
213
|
const c = `${s}/${a.name}`, l = r ? `${r}/${a.name}` : a.name;
|
|
214
214
|
if (!a.isDirectory()) {
|
|
215
|
-
const f = `${
|
|
215
|
+
const f = `${e}_${i}/${l}`.replace(/\\/g, "/"), p = a.name.endsWith(".js") ? "application/javascript" : a.name.endsWith(".css") ? "text/css" : "application/octet-stream";
|
|
216
216
|
console.info(`âī¸ Uploading '${l}' â '${f}'...`);
|
|
217
217
|
const { stderr: u } = await w(`wrangler r2 object put "${f}" --file="${c}" --content-type ${p} --jurisdiction=eu --remote`);
|
|
218
218
|
if (u) throw new Error(u);
|
|
@@ -220,22 +220,22 @@ async function U(o) {
|
|
|
220
220
|
}
|
|
221
221
|
}
|
|
222
222
|
await n("dist"), console.info("â
Module uploaded to R2.");
|
|
223
|
-
} catch (
|
|
224
|
-
console.error("â Error uploading module to R2.",
|
|
223
|
+
} catch (o) {
|
|
224
|
+
console.error("â Error uploading module to R2.", o);
|
|
225
225
|
}
|
|
226
226
|
}
|
|
227
227
|
export {
|
|
228
228
|
j as buildConfig,
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
229
|
+
k as buildConnectorConfig,
|
|
230
|
+
J as buildContextConfig,
|
|
231
|
+
R as buildPresenterConfig,
|
|
232
232
|
C as buildPublicDirectoryIndex,
|
|
233
233
|
A as bumpVersion,
|
|
234
234
|
F as echoScriptNotImplemented,
|
|
235
235
|
D as insertLicensesIntoReadme,
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
236
|
+
I as insertOWASPDependencyCheckBadgeIntoReadme,
|
|
237
|
+
P as sendDeploymentNotice,
|
|
238
|
+
M as syncWithGitHub,
|
|
239
239
|
T as uploadDirectoryToR2,
|
|
240
240
|
_ as uploadModuleConfigToDO,
|
|
241
241
|
U as uploadModuleToR2
|
package/package.json
CHANGED