@datapos/datapos-development 0.3.94 â 0.3.101
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.
|
@@ -2,62 +2,62 @@ import { exec as m } from "child_process";
|
|
|
2
2
|
import { promises as e } from "fs";
|
|
3
3
|
import { nanoid as w } from "nanoid";
|
|
4
4
|
import { promisify as y } from "util";
|
|
5
|
-
const h = ["createObject", "dropObject", "removeRecords", "upsertRecords"],
|
|
5
|
+
const h = ["createObject", "dropObject", "removeRecords", "upsertRecords"], b = ["findObject", "getRecord", "listNodes", "previewObject", "retrieveRecords"], g = y(m);
|
|
6
6
|
async function S() {
|
|
7
7
|
try {
|
|
8
8
|
console.info("đ Building configuration...");
|
|
9
9
|
const o = JSON.parse(await e.readFile("package.json", "utf8")), n = JSON.parse(await e.readFile("config.json", "utf8"));
|
|
10
|
-
o.name && (n.id = o.name.replace("@datapos/", "").replace("@data-positioning/", "")), o.version && (n.version = o.version), await e.writeFile("config.json", JSON.stringify(n, void 0, 4), "utf8"), console.info("â
Configuration built.");
|
|
10
|
+
o.name != null && (n.id = o.name.replace("@datapos/", "").replace("@data-positioning/", "")), o.version != null && (n.version = o.version), await e.writeFile("config.json", JSON.stringify(n, void 0, 4), "utf8"), console.info("â
Configuration built.");
|
|
11
11
|
} catch (o) {
|
|
12
12
|
console.error("â Error building configuration.", o);
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
|
-
async function
|
|
15
|
+
async function O(o) {
|
|
16
16
|
try {
|
|
17
17
|
console.info(`đ Building public directory index for identifier '${o}'...`);
|
|
18
18
|
const n = {};
|
|
19
|
-
async function
|
|
19
|
+
async function t(r, s) {
|
|
20
20
|
console.info(`âī¸ Processing directory '${r}'...`);
|
|
21
|
-
const
|
|
22
|
-
n[a] =
|
|
23
|
-
for (const c of
|
|
21
|
+
const d = [], a = r.substring(`public/${o}`.length);
|
|
22
|
+
n[a] = d;
|
|
23
|
+
for (const c of s) {
|
|
24
24
|
const l = `${r}/${c}`;
|
|
25
25
|
try {
|
|
26
|
-
const
|
|
27
|
-
if (
|
|
26
|
+
const f = await e.stat(l);
|
|
27
|
+
if (f.isDirectory()) {
|
|
28
28
|
const p = await e.readdir(l), u = { childCount: p.length, name: `${c}`, typeId: "folder" };
|
|
29
|
-
|
|
29
|
+
d.push(u), await t(l, p);
|
|
30
30
|
} else {
|
|
31
|
-
const p = { id: w(), lastModifiedAt:
|
|
32
|
-
|
|
31
|
+
const p = { id: w(), lastModifiedAt: f.mtimeMs, name: c, size: f.size, typeId: "object" };
|
|
32
|
+
d.push(p);
|
|
33
33
|
}
|
|
34
|
-
} catch (
|
|
35
|
-
throw new Error(`Unable to get information for '${c}' in 'buildPublicDirectoryIndex'. ${String(
|
|
34
|
+
} catch (f) {
|
|
35
|
+
throw new Error(`Unable to get information for '${c}' in 'buildPublicDirectoryIndex'. ${String(f)}`);
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
|
|
39
|
-
const
|
|
40
|
-
return
|
|
38
|
+
d.sort((c, l) => {
|
|
39
|
+
const f = c.typeId.localeCompare(l.typeId);
|
|
40
|
+
return f === 0 ? c.name.localeCompare(l.name) : f;
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
|
-
const
|
|
44
|
-
await
|
|
43
|
+
const i = await e.readdir(`public/${o}`);
|
|
44
|
+
await t(`public/${o}`, i), await e.writeFile(`./public/${o}Index.json`, JSON.stringify(n), "utf8"), console.info("â
Public directory index built.");
|
|
45
45
|
} catch (n) {
|
|
46
46
|
console.error("â Error building public directory index.", n);
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
|
-
async function
|
|
49
|
+
async function J() {
|
|
50
50
|
try {
|
|
51
51
|
console.info("đ Building connector configuration...");
|
|
52
|
-
const o = JSON.parse(await e.readFile("package.json", "utf8")), n = JSON.parse(await e.readFile("config.json", "utf8")),
|
|
53
|
-
let
|
|
54
|
-
const
|
|
52
|
+
const o = JSON.parse(await e.readFile("package.json", "utf8")), n = JSON.parse(await e.readFile("config.json", "utf8")), t = await e.readFile("src/index.ts", "utf8");
|
|
53
|
+
let i = !1, r = !1;
|
|
54
|
+
const s = /^\s{4}(?:async\s+)?(private\s+)?(?:public\s+|protected\s+)?([A-Za-z_]\w*)\s*\(/gm, d = [...t.matchAll(s)].filter((c) => !c[1] && c[2] !== "constructor").map((c) => {
|
|
55
55
|
const l = c[2];
|
|
56
|
-
return
|
|
56
|
+
return i = i || h.includes(l), r = r || b.includes(l), l;
|
|
57
57
|
});
|
|
58
|
-
|
|
59
|
-
const a = r &&
|
|
60
|
-
a
|
|
58
|
+
d.length > 0 ? console.info(`âšī¸ Implements ${d.length} operations.`) : console.warn("â ī¸ Implements no operations.");
|
|
59
|
+
const a = r && i ? "bidirectional" : r ? "source" : i ? "destination" : "unknown";
|
|
60
|
+
a && console.info(`âšī¸ Supports ${a} usage.`), o.name != null && (n.id = o.name), n.operations = d, n.usageId = a, o.version != null && (n.version = o.version), await e.writeFile("config.json", JSON.stringify(n, void 0, 4), "utf8"), console.info("â
Connector configuration built.");
|
|
61
61
|
} catch (o) {
|
|
62
62
|
console.error("â Error building connector configuration.", o);
|
|
63
63
|
}
|
|
@@ -65,61 +65,65 @@ async function j() {
|
|
|
65
65
|
async function x() {
|
|
66
66
|
try {
|
|
67
67
|
console.info("đ Building context configuration...");
|
|
68
|
-
const o = JSON.parse(await e.readFile("package.json", "utf8")), n = JSON.parse(await e.readFile("config.json", "utf8")),
|
|
69
|
-
o.name && (n.id = o.name), n.operations = r, o.version && (n.version = o.version), await e.writeFile("config.json", JSON.stringify(n, void 0, 4), "utf8"), console.info("â
Context configuration built.");
|
|
68
|
+
const o = JSON.parse(await e.readFile("package.json", "utf8")), n = JSON.parse(await e.readFile("config.json", "utf8")), t = await e.readFile("src/index.ts", "utf8"), i = /^\s{4}(?:async\s+)?(private\s+)?(?:public\s+|protected\s+)?([A-Za-z_]\w*)\s*\(/gm, r = [...t.matchAll(i)].filter((s) => !s[1] && s[2] !== "constructor").map((s) => s[2]);
|
|
69
|
+
o.name != null && (n.id = o.name), n.operations = r, o.version != null && (n.version = o.version), await e.writeFile("config.json", JSON.stringify(n, void 0, 4), "utf8"), console.info("â
Context configuration built.");
|
|
70
70
|
} catch (o) {
|
|
71
71
|
console.error("â Error building context configuration.", o);
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
|
-
async function
|
|
75
|
-
try {
|
|
76
|
-
console.info("đ Building informer configuration...");
|
|
77
|
-
const o = JSON.parse(await e.readFile("package.json", "utf8")), n = JSON.parse(await e.readFile("config.json", "utf8")), i = await e.readFile("src/index.ts", "utf8"), s = /^\s{4}(?:async\s+)?(private\s+)?(?:public\s+|protected\s+)?([A-Za-z_]\w*)\s*\(/gm, r = [...i.matchAll(s)].filter((t) => !t[1] && t[2] !== "constructor").map((t) => t[2]);
|
|
78
|
-
o.name && (n.id = o.name), n.operations = r, o.version && (n.version = o.version), await e.writeFile("config.json", JSON.stringify(n, void 0, 4), "utf8"), console.info("â
Informer configuration built.");
|
|
79
|
-
} catch (o) {
|
|
80
|
-
console.error("â Error building informer configuration.", o);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
async function C() {
|
|
74
|
+
async function j() {
|
|
84
75
|
try {
|
|
85
76
|
console.info("đ Building presenter configuration...");
|
|
86
|
-
const o = JSON.parse(await e.readFile("package.json", "utf8")), n = JSON.parse(await e.readFile("config.json", "utf8")),
|
|
87
|
-
o.name && (n.id = o.name), n.operations = r, o.version && (n.version = o.version), await e.writeFile("config.json", JSON.stringify(n, void 0, 4), "utf8"), console.info("â
Presenter configuration built.");
|
|
77
|
+
const o = JSON.parse(await e.readFile("package.json", "utf8")), n = JSON.parse(await e.readFile("config.json", "utf8")), t = await e.readFile("src/index.ts", "utf8"), i = /^\s{4}(?:async\s+)?(private\s+)?(?:public\s+|protected\s+)?([A-Za-z_]\w*)\s*\(/gm, r = [...t.matchAll(i)].filter((s) => !s[1] && s[2] !== "constructor").map((s) => s[2]);
|
|
78
|
+
o.name != null && (n.id = o.name), n.operations = r, o.version != null && (n.version = o.version), await e.writeFile("config.json", JSON.stringify(n, void 0, 4), "utf8"), console.info("â
Presenter configuration built.");
|
|
88
79
|
} catch (o) {
|
|
89
80
|
console.error("â Error building context configuration.", o);
|
|
90
81
|
}
|
|
91
82
|
}
|
|
92
|
-
async function
|
|
83
|
+
async function C() {
|
|
93
84
|
try {
|
|
94
85
|
console.info("đ Bumping version...");
|
|
95
86
|
const o = JSON.parse(await e.readFile("package.json", "utf8"));
|
|
96
|
-
if (o.version) {
|
|
97
|
-
const n = o.version,
|
|
98
|
-
o.version = `${
|
|
87
|
+
if (o.version != null) {
|
|
88
|
+
const n = o.version, t = o.version.split(".");
|
|
89
|
+
o.version = `${t[0]}.${t[1]}.${Number(t[2]) + 1}`, await e.writeFile("package.json", JSON.stringify(o, void 0, 4), "utf8"), console.info(`â
Version bumped from ${n} to ${o.version}.`);
|
|
99
90
|
} else
|
|
100
91
|
o.version = "0.0.001", await e.writeFile("package.json", JSON.stringify(o, void 0, 4), "utf8"), console.warn(`â ī¸ Version initialised to ${o.version}.`);
|
|
101
92
|
} catch (o) {
|
|
102
93
|
console.error("â Error bumping package version.", o);
|
|
103
94
|
}
|
|
104
95
|
}
|
|
105
|
-
function
|
|
96
|
+
function F(o) {
|
|
106
97
|
console.error(`â ${o} script not implemented.`);
|
|
107
98
|
}
|
|
108
|
-
async function
|
|
99
|
+
async function R() {
|
|
100
|
+
const o = "<!-- DEPENDENCY_LICENSES_START -->", n = "<!-- DEPENDENCY_LICENSES_END -->";
|
|
101
|
+
try {
|
|
102
|
+
const t = (await e.readFile("./licenses.md", "utf8")).trim(), i = await e.readFile("./README.md", "utf8"), r = i.indexOf(o), s = i.indexOf(n);
|
|
103
|
+
(r === -1 || s === -1) && (console.error("Error: Markers not found in README.md"), process.exit(1));
|
|
104
|
+
const d = i.substring(0, r + o.length) + `
|
|
105
|
+
` + t + `
|
|
106
|
+
` + i.substring(s);
|
|
107
|
+
await e.writeFile("README.md", d, "utf8"), console.log("â README.md updated with license information");
|
|
108
|
+
} catch (t) {
|
|
109
|
+
console.error("Error updating README:", t), process.exit(1);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
async function k() {
|
|
109
113
|
try {
|
|
110
114
|
console.info("đ Sending deployment notice...");
|
|
111
115
|
const o = JSON.parse(await e.readFile("config.json", "utf8")), n = {
|
|
112
116
|
body: JSON.stringify(o),
|
|
113
117
|
headers: { "Content-Type": "application/json" },
|
|
114
118
|
method: "PUT"
|
|
115
|
-
},
|
|
116
|
-
if (!
|
|
119
|
+
}, t = await fetch(`https://api.datapos.app/states/${o.id}`, n);
|
|
120
|
+
if (!t.ok) throw new Error(await t.text());
|
|
117
121
|
console.info("â
Deployment notice sent.");
|
|
118
122
|
} catch (o) {
|
|
119
123
|
console.error("â Error sending deployment notice.", o);
|
|
120
124
|
}
|
|
121
125
|
}
|
|
122
|
-
async function
|
|
126
|
+
async function I() {
|
|
123
127
|
try {
|
|
124
128
|
console.info("đ Synchronising with GitHub....");
|
|
125
129
|
const o = JSON.parse(await e.readFile("package.json", "utf8"));
|
|
@@ -128,75 +132,75 @@ async function R() {
|
|
|
128
132
|
console.error("â Error synchronising with GitHub.", o);
|
|
129
133
|
}
|
|
130
134
|
}
|
|
131
|
-
async function
|
|
135
|
+
async function D(o, n) {
|
|
132
136
|
try {
|
|
133
137
|
console.info("đ Uploading directory to R2....");
|
|
134
|
-
async function
|
|
135
|
-
for (const a of
|
|
136
|
-
const c = `${r}/${a}`, l = `${
|
|
138
|
+
async function t(r, s, d) {
|
|
139
|
+
for (const a of d) {
|
|
140
|
+
const c = `${r}/${a}`, l = `${s}/${a}`;
|
|
137
141
|
if ((await e.stat(c)).isDirectory()) {
|
|
138
142
|
const p = await e.readdir(c);
|
|
139
|
-
await
|
|
143
|
+
await t(c, l, p);
|
|
140
144
|
} else {
|
|
141
145
|
console.info(`âī¸ Uploading '${r}/${a}'...`);
|
|
142
|
-
const p = `wrangler r2 object put "datapos-sample-data-eu/${
|
|
146
|
+
const p = `wrangler r2 object put "datapos-sample-data-eu/${s}/${a}" --file="${r}/${a}" --jurisdiction=eu --remote`, u = await g(p);
|
|
143
147
|
if (u.stderr) throw new Error(u.stderr);
|
|
144
148
|
}
|
|
145
149
|
}
|
|
146
150
|
}
|
|
147
|
-
const
|
|
148
|
-
await
|
|
149
|
-
} catch (
|
|
150
|
-
console.error("â Error uploading directory to R2.",
|
|
151
|
+
const i = await e.readdir(`${o}/${n}/`);
|
|
152
|
+
await t(`${o}/${n}`, n, i), console.info("â
Directory uploaded to R2.");
|
|
153
|
+
} catch (t) {
|
|
154
|
+
console.error("â Error uploading directory to R2.", t);
|
|
151
155
|
}
|
|
152
156
|
}
|
|
153
157
|
async function A() {
|
|
154
158
|
try {
|
|
155
159
|
console.info("đ Uploading module configuration....");
|
|
156
|
-
const o = JSON.parse(await e.readFile("config.json", "utf8")), n = o.id,
|
|
160
|
+
const o = JSON.parse(await e.readFile("config.json", "utf8")), n = o.id, t = {
|
|
157
161
|
body: JSON.stringify(o),
|
|
158
162
|
headers: { "Content-Type": "application/json" },
|
|
159
163
|
method: "PUT"
|
|
160
|
-
},
|
|
161
|
-
if (!
|
|
164
|
+
}, i = await fetch(`https://api.datapos.app/states/${n}`, t);
|
|
165
|
+
if (!i.ok) throw new Error(await i.text());
|
|
162
166
|
console.info("â
Module configuration uploaded.");
|
|
163
167
|
} catch (o) {
|
|
164
168
|
console.error("â Error uploading module configuration.", o);
|
|
165
169
|
}
|
|
166
170
|
}
|
|
167
|
-
async function
|
|
171
|
+
async function P(o) {
|
|
168
172
|
try {
|
|
169
173
|
console.info("đ Uploading module to R2...");
|
|
170
|
-
const
|
|
171
|
-
async function
|
|
172
|
-
const
|
|
173
|
-
for (const a of
|
|
174
|
-
const c = `${r}/${a.name}`, l =
|
|
174
|
+
const t = `v${JSON.parse(await e.readFile("package.json", "utf8")).version}`;
|
|
175
|
+
async function i(r, s = "") {
|
|
176
|
+
const d = await e.readdir(r, { withFileTypes: !0 });
|
|
177
|
+
for (const a of d) {
|
|
178
|
+
const c = `${r}/${a.name}`, l = s ? `${s}/${a.name}` : a.name;
|
|
175
179
|
if (!a.isDirectory()) {
|
|
176
|
-
const
|
|
177
|
-
console.info(`âī¸ Uploading '${l}' â '${
|
|
178
|
-
const { stderr: u } = await g(`wrangler r2 object put "${
|
|
180
|
+
const f = `${o}_${t}/${l}`.replace(/\\/g, "/"), p = a.name.endsWith(".js") ? "application/javascript" : a.name.endsWith(".css") ? "text/css" : "application/octet-stream";
|
|
181
|
+
console.info(`âī¸ Uploading '${l}' â '${f}'...`);
|
|
182
|
+
const { stderr: u } = await g(`wrangler r2 object put "${f}" --file="${c}" --content-type ${p} --jurisdiction=eu --remote`);
|
|
179
183
|
if (u) throw new Error(u);
|
|
180
184
|
}
|
|
181
185
|
}
|
|
182
186
|
}
|
|
183
|
-
await
|
|
187
|
+
await i("dist"), console.info("â
Module uploaded to R2.");
|
|
184
188
|
} catch (n) {
|
|
185
189
|
console.error("â Error uploading module to R2.", n);
|
|
186
190
|
}
|
|
187
191
|
}
|
|
188
192
|
export {
|
|
189
193
|
S as buildConfig,
|
|
190
|
-
|
|
194
|
+
J as buildConnectorConfig,
|
|
191
195
|
x as buildContextConfig,
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
196
|
+
j as buildPresenterConfig,
|
|
197
|
+
O as buildPublicDirectoryIndex,
|
|
198
|
+
C as bumpVersion,
|
|
199
|
+
F as echoScriptNotImplemented,
|
|
200
|
+
R as insertLicensesIntoReadme,
|
|
201
|
+
k as sendDeploymentNotice,
|
|
202
|
+
I as syncWithGitHub,
|
|
203
|
+
D as uploadDirectoryToR2,
|
|
200
204
|
A as uploadModuleConfigToDO,
|
|
201
|
-
|
|
205
|
+
P as uploadModuleToR2
|
|
202
206
|
};
|
|
@@ -5,13 +5,13 @@ declare function buildConfig(): Promise<void>;
|
|
|
5
5
|
declare function buildPublicDirectoryIndex(id: string): Promise<void>;
|
|
6
6
|
declare function buildConnectorConfig(): Promise<void>;
|
|
7
7
|
declare function buildContextConfig(): Promise<void>;
|
|
8
|
-
declare function buildInformerConfig(): Promise<void>;
|
|
9
8
|
declare function buildPresenterConfig(): Promise<void>;
|
|
10
9
|
declare function bumpVersion(): Promise<void>;
|
|
11
10
|
declare function echoScriptNotImplemented(name: string): void;
|
|
11
|
+
declare function insertLicensesIntoReadme(): Promise<void>;
|
|
12
12
|
declare function sendDeploymentNotice(): Promise<void>;
|
|
13
13
|
declare function syncWithGitHub(): Promise<void>;
|
|
14
14
|
declare function uploadDirectoryToR2(sourceDirectory: string, uploadDirectory: string): Promise<void>;
|
|
15
15
|
declare function uploadModuleConfigToDO(): Promise<void>;
|
|
16
16
|
declare function uploadModuleToR2(uploadDirPath: string): Promise<void>;
|
|
17
|
-
export { buildConfig, buildConnectorConfig, buildContextConfig,
|
|
17
|
+
export { buildConfig, buildConnectorConfig, buildContextConfig, buildPresenterConfig, buildPublicDirectoryIndex, bumpVersion, echoScriptNotImplemented, insertLicensesIntoReadme, sendDeploymentNotice, syncWithGitHub, uploadDirectoryToR2, uploadModuleConfigToDO, uploadModuleToR2 };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@datapos/datapos-development",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.101",
|
|
4
4
|
"description": "A TypeScript library of utilities for managing the Data Positioning repositories.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Jonathan Terrell <terrell.jm@gmail.com>",
|
|
@@ -26,12 +26,12 @@
|
|
|
26
26
|
"dist"
|
|
27
27
|
],
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@datapos/datapos-shared": "^0.3.
|
|
29
|
+
"@datapos/datapos-shared": "^0.3.252"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@types/node": "^24.10.1",
|
|
33
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
34
|
-
"@typescript-eslint/parser": "^8.
|
|
33
|
+
"@typescript-eslint/eslint-plugin": "^8.48.0",
|
|
34
|
+
"@typescript-eslint/parser": "^8.48.0",
|
|
35
35
|
"eslint": "^9.39.1",
|
|
36
36
|
"eslint-plugin-import": "^2.32.0",
|
|
37
37
|
"jiti": "^2.6.1",
|
|
@@ -42,12 +42,12 @@
|
|
|
42
42
|
"prettier": "^3.6.2",
|
|
43
43
|
"retire": "^5.3.0",
|
|
44
44
|
"rollup-plugin-visualizer": "^6.0.5",
|
|
45
|
-
"ts-to-zod": "^5.0
|
|
45
|
+
"ts-to-zod": "^5.1.0",
|
|
46
46
|
"type-fest": "^5.2.0",
|
|
47
47
|
"typescript": "^5.9.3",
|
|
48
|
-
"vite": "^7.2.
|
|
48
|
+
"vite": "^7.2.4",
|
|
49
49
|
"vite-plugin-dts": "^4.5.4",
|
|
50
|
-
"zod": "^4.1.
|
|
50
|
+
"zod": "^4.1.13"
|
|
51
51
|
},
|
|
52
52
|
"scripts": {
|
|
53
53
|
"audit": "npm audit",
|