@datapos/datapos-development 0.3.94 â 0.3.96
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.
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { exec as m } from "child_process";
|
|
2
|
-
import { promises as
|
|
2
|
+
import { promises as n } 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"], $ = ["findObject", "getRecord", "listNodes", "previewObject", "retrieveRecords"], g = y(m);
|
|
6
6
|
async function S() {
|
|
7
7
|
try {
|
|
8
8
|
console.info("đ Building configuration...");
|
|
9
|
-
const o = JSON.parse(await
|
|
10
|
-
o.name && (
|
|
9
|
+
const o = JSON.parse(await n.readFile("package.json", "utf8")), e = JSON.parse(await n.readFile("config.json", "utf8"));
|
|
10
|
+
o.name && (e.id = o.name.replace("@datapos/", "").replace("@data-positioning/", "")), o.version && (e.version = o.version), await n.writeFile("config.json", JSON.stringify(e, void 0, 4), "utf8"), console.info("â
Configuration built.");
|
|
11
11
|
} catch (o) {
|
|
12
12
|
console.error("â Error building configuration.", o);
|
|
13
13
|
}
|
|
@@ -15,49 +15,49 @@ async function S() {
|
|
|
15
15
|
async function J(o) {
|
|
16
16
|
try {
|
|
17
17
|
console.info(`đ Building public directory index for identifier '${o}'...`);
|
|
18
|
-
const
|
|
19
|
-
async function i(
|
|
20
|
-
console.info(`âī¸ Processing directory '${
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
for (const
|
|
24
|
-
const l = `${
|
|
18
|
+
const e = {};
|
|
19
|
+
async function i(t, r) {
|
|
20
|
+
console.info(`âī¸ Processing directory '${t}'...`);
|
|
21
|
+
const d = [], s = t.substring(`public/${o}`.length);
|
|
22
|
+
e[s] = d;
|
|
23
|
+
for (const a of r) {
|
|
24
|
+
const l = `${t}/${a}`;
|
|
25
25
|
try {
|
|
26
|
-
const
|
|
27
|
-
if (
|
|
28
|
-
const p = await
|
|
29
|
-
|
|
26
|
+
const f = await n.stat(l);
|
|
27
|
+
if (f.isDirectory()) {
|
|
28
|
+
const p = await n.readdir(l), u = { childCount: p.length, name: `${a}`, typeId: "folder" };
|
|
29
|
+
d.push(u), await i(l, p);
|
|
30
30
|
} else {
|
|
31
|
-
const p = { id: w(), lastModifiedAt:
|
|
32
|
-
|
|
31
|
+
const p = { id: w(), lastModifiedAt: f.mtimeMs, name: a, size: f.size, typeId: "object" };
|
|
32
|
+
d.push(p);
|
|
33
33
|
}
|
|
34
|
-
} catch (
|
|
35
|
-
throw new Error(`Unable to get information for '${
|
|
34
|
+
} catch (f) {
|
|
35
|
+
throw new Error(`Unable to get information for '${a}' in 'buildPublicDirectoryIndex'. ${String(f)}`);
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
|
|
39
|
-
const
|
|
40
|
-
return
|
|
38
|
+
d.sort((a, l) => {
|
|
39
|
+
const f = a.typeId.localeCompare(l.typeId);
|
|
40
|
+
return f !== 0 ? f : a.name.localeCompare(l.name);
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
|
-
const
|
|
44
|
-
await i(`public/${o}`,
|
|
45
|
-
} catch (
|
|
46
|
-
console.error("â Error building public directory index.",
|
|
43
|
+
const c = await n.readdir(`public/${o}`);
|
|
44
|
+
await i(`public/${o}`, c), await n.writeFile(`./public/${o}Index.json`, JSON.stringify(e), "utf8"), console.info("â
Public directory index built.");
|
|
45
|
+
} catch (e) {
|
|
46
|
+
console.error("â Error building public directory index.", e);
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
async function j() {
|
|
50
50
|
try {
|
|
51
51
|
console.info("đ Building connector configuration...");
|
|
52
|
-
const o = JSON.parse(await
|
|
53
|
-
let
|
|
54
|
-
const
|
|
55
|
-
const l =
|
|
56
|
-
return
|
|
52
|
+
const o = JSON.parse(await n.readFile("package.json", "utf8")), e = JSON.parse(await n.readFile("config.json", "utf8")), i = await n.readFile("src/index.ts", "utf8");
|
|
53
|
+
let c = !1, t = !1;
|
|
54
|
+
const r = /^\s{4}(?:async\s+)?(private\s+)?(?:public\s+|protected\s+)?([A-Za-z_]\w*)\s*\(/gm, d = [...i.matchAll(r)].filter((a) => !a[1] && a[2] !== "constructor").map((a) => {
|
|
55
|
+
const l = a[2];
|
|
56
|
+
return c = c || h.includes(l), t = t || $.includes(l), l;
|
|
57
57
|
});
|
|
58
|
-
|
|
59
|
-
const
|
|
60
|
-
|
|
58
|
+
d.length > 0 ? console.info(`âšī¸ Implements ${d.length} operations.`) : console.warn("â ī¸ Implements no operations.");
|
|
59
|
+
const s = t && c ? "bidirectional" : t ? "source" : c ? "destination" : "unknown";
|
|
60
|
+
s && console.info(`âšī¸ Supports ${s} usage.`), o.name && (e.id = o.name), e.operations = d, e.usageId = s, o.version && (e.version = o.version), await n.writeFile("config.json", JSON.stringify(e, 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,100 +65,91 @@ async function j() {
|
|
|
65
65
|
async function x() {
|
|
66
66
|
try {
|
|
67
67
|
console.info("đ Building context configuration...");
|
|
68
|
-
const o = JSON.parse(await
|
|
69
|
-
o.name && (
|
|
68
|
+
const o = JSON.parse(await n.readFile("package.json", "utf8")), e = JSON.parse(await n.readFile("config.json", "utf8")), i = await n.readFile("src/index.ts", "utf8"), c = /^\s{4}(?:async\s+)?(private\s+)?(?:public\s+|protected\s+)?([A-Za-z_]\w*)\s*\(/gm, t = [...i.matchAll(c)].filter((r) => !r[1] && r[2] !== "constructor").map((r) => r[2]);
|
|
69
|
+
o.name && (e.id = o.name), e.operations = t, o.version && (e.version = o.version), await n.writeFile("config.json", JSON.stringify(e, 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
74
|
async function F() {
|
|
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() {
|
|
84
75
|
try {
|
|
85
76
|
console.info("đ Building presenter configuration...");
|
|
86
|
-
const o = JSON.parse(await
|
|
87
|
-
o.name && (
|
|
77
|
+
const o = JSON.parse(await n.readFile("package.json", "utf8")), e = JSON.parse(await n.readFile("config.json", "utf8")), i = await n.readFile("src/index.ts", "utf8"), c = /^\s{4}(?:async\s+)?(private\s+)?(?:public\s+|protected\s+)?([A-Za-z_]\w*)\s*\(/gm, t = [...i.matchAll(c)].filter((r) => !r[1] && r[2] !== "constructor").map((r) => r[2]);
|
|
78
|
+
o.name && (e.id = o.name), e.operations = t, o.version && (e.version = o.version), await n.writeFile("config.json", JSON.stringify(e, 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 k() {
|
|
93
84
|
try {
|
|
94
85
|
console.info("đ Bumping version...");
|
|
95
|
-
const o = JSON.parse(await
|
|
86
|
+
const o = JSON.parse(await n.readFile("package.json", "utf8"));
|
|
96
87
|
if (o.version) {
|
|
97
|
-
const
|
|
98
|
-
o.version = `${i[0]}.${i[1]}.${Number(i[2]) + 1}`, await
|
|
88
|
+
const e = o.version, i = o.version.split(".");
|
|
89
|
+
o.version = `${i[0]}.${i[1]}.${Number(i[2]) + 1}`, await n.writeFile("package.json", JSON.stringify(o, void 0, 4), "utf8"), console.info(`â
Version bumped from ${e} to ${o.version}.`);
|
|
99
90
|
} else
|
|
100
|
-
o.version = "0.0.001", await
|
|
91
|
+
o.version = "0.0.001", await n.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 C(o) {
|
|
106
97
|
console.error(`â ${o} script not implemented.`);
|
|
107
98
|
}
|
|
108
|
-
async function
|
|
99
|
+
async function E() {
|
|
109
100
|
try {
|
|
110
101
|
console.info("đ Sending deployment notice...");
|
|
111
|
-
const o = JSON.parse(await
|
|
102
|
+
const o = JSON.parse(await n.readFile("config.json", "utf8")), e = {
|
|
112
103
|
body: JSON.stringify(o),
|
|
113
104
|
headers: { "Content-Type": "application/json" },
|
|
114
105
|
method: "PUT"
|
|
115
|
-
}, i = await fetch(`https://api.datapos.app/states/${o.id}`,
|
|
106
|
+
}, i = await fetch(`https://api.datapos.app/states/${o.id}`, e);
|
|
116
107
|
if (!i.ok) throw new Error(await i.text());
|
|
117
108
|
console.info("â
Deployment notice sent.");
|
|
118
109
|
} catch (o) {
|
|
119
110
|
console.error("â Error sending deployment notice.", o);
|
|
120
111
|
}
|
|
121
112
|
}
|
|
122
|
-
async function
|
|
113
|
+
async function I() {
|
|
123
114
|
try {
|
|
124
115
|
console.info("đ Synchronising with GitHub....");
|
|
125
|
-
const o = JSON.parse(await
|
|
116
|
+
const o = JSON.parse(await n.readFile("package.json", "utf8"));
|
|
126
117
|
await g("git add ."), await g(`git commit -m "v${o.version}"`), await g("git push origin main:main"), console.info(`â
Synchronised version ${o.version} with GitHub.`);
|
|
127
118
|
} catch (o) {
|
|
128
119
|
console.error("â Error synchronising with GitHub.", o);
|
|
129
120
|
}
|
|
130
121
|
}
|
|
131
|
-
async function
|
|
122
|
+
async function R(o, e) {
|
|
132
123
|
try {
|
|
133
124
|
console.info("đ Uploading directory to R2....");
|
|
134
|
-
async function i(
|
|
135
|
-
for (const
|
|
136
|
-
const
|
|
137
|
-
if ((await
|
|
138
|
-
const p = await
|
|
139
|
-
await i(
|
|
125
|
+
async function i(t, r, d) {
|
|
126
|
+
for (const s of d) {
|
|
127
|
+
const a = `${t}/${s}`, l = `${r}/${s}`;
|
|
128
|
+
if ((await n.stat(a)).isDirectory()) {
|
|
129
|
+
const p = await n.readdir(a);
|
|
130
|
+
await i(a, l, p);
|
|
140
131
|
} else {
|
|
141
|
-
console.info(`âī¸ Uploading '${
|
|
142
|
-
const p = `wrangler r2 object put "datapos-sample-data-eu/${
|
|
132
|
+
console.info(`âī¸ Uploading '${t}/${s}'...`);
|
|
133
|
+
const p = `wrangler r2 object put "datapos-sample-data-eu/${r}/${s}" --file="${t}/${s}" --jurisdiction=eu --remote`, u = await g(p);
|
|
143
134
|
if (u.stderr) throw new Error(u.stderr);
|
|
144
135
|
}
|
|
145
136
|
}
|
|
146
137
|
}
|
|
147
|
-
const
|
|
148
|
-
await i(`${o}/${
|
|
138
|
+
const c = await n.readdir(`${o}/${e}/`);
|
|
139
|
+
await i(`${o}/${e}`, e, c), console.info("â
Directory uploaded to R2.");
|
|
149
140
|
} catch (i) {
|
|
150
141
|
console.error("â Error uploading directory to R2.", i);
|
|
151
142
|
}
|
|
152
143
|
}
|
|
153
|
-
async function
|
|
144
|
+
async function P() {
|
|
154
145
|
try {
|
|
155
146
|
console.info("đ Uploading module configuration....");
|
|
156
|
-
const o = JSON.parse(await
|
|
147
|
+
const o = JSON.parse(await n.readFile("config.json", "utf8")), e = o.id, i = {
|
|
157
148
|
body: JSON.stringify(o),
|
|
158
149
|
headers: { "Content-Type": "application/json" },
|
|
159
150
|
method: "PUT"
|
|
160
|
-
},
|
|
161
|
-
if (!
|
|
151
|
+
}, c = await fetch(`https://api.datapos.app/states/${e}`, i);
|
|
152
|
+
if (!c.ok) throw new Error(await c.text());
|
|
162
153
|
console.info("â
Module configuration uploaded.");
|
|
163
154
|
} catch (o) {
|
|
164
155
|
console.error("â Error uploading module configuration.", o);
|
|
@@ -167,36 +158,35 @@ async function A() {
|
|
|
167
158
|
async function T(o) {
|
|
168
159
|
try {
|
|
169
160
|
console.info("đ Uploading module to R2...");
|
|
170
|
-
const i = `v${JSON.parse(await
|
|
171
|
-
async function
|
|
172
|
-
const
|
|
173
|
-
for (const
|
|
174
|
-
const
|
|
175
|
-
if (!
|
|
176
|
-
const
|
|
177
|
-
console.info(`âī¸ Uploading '${l}' â '${
|
|
178
|
-
const { stderr: u } = await g(`wrangler r2 object put "${
|
|
161
|
+
const i = `v${JSON.parse(await n.readFile("package.json", "utf8")).version}`;
|
|
162
|
+
async function c(t, r = "") {
|
|
163
|
+
const d = await n.readdir(t, { withFileTypes: !0 });
|
|
164
|
+
for (const s of d) {
|
|
165
|
+
const a = `${t}/${s.name}`, l = r ? `${r}/${s.name}` : s.name;
|
|
166
|
+
if (!s.isDirectory()) {
|
|
167
|
+
const f = `${o}_${i}/${l}`.replace(/\\/g, "/"), p = s.name.endsWith(".js") ? "application/javascript" : s.name.endsWith(".css") ? "text/css" : "application/octet-stream";
|
|
168
|
+
console.info(`âī¸ Uploading '${l}' â '${f}'...`);
|
|
169
|
+
const { stderr: u } = await g(`wrangler r2 object put "${f}" --file="${a}" --content-type ${p} --jurisdiction=eu --remote`);
|
|
179
170
|
if (u) throw new Error(u);
|
|
180
171
|
}
|
|
181
172
|
}
|
|
182
173
|
}
|
|
183
|
-
await
|
|
184
|
-
} catch (
|
|
185
|
-
console.error("â Error uploading module to R2.",
|
|
174
|
+
await c("dist"), console.info("â
Module uploaded to R2.");
|
|
175
|
+
} catch (e) {
|
|
176
|
+
console.error("â Error uploading module to R2.", e);
|
|
186
177
|
}
|
|
187
178
|
}
|
|
188
179
|
export {
|
|
189
180
|
S as buildConfig,
|
|
190
181
|
j as buildConnectorConfig,
|
|
191
182
|
x as buildContextConfig,
|
|
192
|
-
F as
|
|
193
|
-
C as buildPresenterConfig,
|
|
183
|
+
F as buildPresenterConfig,
|
|
194
184
|
J as buildPublicDirectoryIndex,
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
185
|
+
k as bumpVersion,
|
|
186
|
+
C as echoScriptNotImplemented,
|
|
187
|
+
E as sendDeploymentNotice,
|
|
188
|
+
I as syncWithGitHub,
|
|
189
|
+
R as uploadDirectoryToR2,
|
|
190
|
+
P as uploadModuleConfigToDO,
|
|
201
191
|
T as uploadModuleToR2
|
|
202
192
|
};
|
|
@@ -5,7 +5,6 @@ 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;
|
|
@@ -14,4 +13,4 @@ declare function syncWithGitHub(): Promise<void>;
|
|
|
14
13
|
declare function uploadDirectoryToR2(sourceDirectory: string, uploadDirectory: string): Promise<void>;
|
|
15
14
|
declare function uploadModuleConfigToDO(): Promise<void>;
|
|
16
15
|
declare function uploadModuleToR2(uploadDirPath: string): Promise<void>;
|
|
17
|
-
export { buildConfig, buildConnectorConfig, buildContextConfig,
|
|
16
|
+
export { buildConfig, buildConnectorConfig, buildContextConfig, buildPresenterConfig, buildPublicDirectoryIndex, bumpVersion, echoScriptNotImplemented, 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.96",
|
|
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",
|