@prestizni-software/client-dem 0.1.26 → 0.2.2

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.
@@ -5,7 +5,6 @@ import { Constructor, IsData, LoggersType } from "./CommonTypes.js";
5
5
  export type WrappedInstances<T extends Record<string, Constructor<any>>> = {
6
6
  [K in keyof T]: AutoUpdateClientManager<T[K]>;
7
7
  };
8
-
9
8
  // ---------------------- Factory ----------------------
10
9
  export async function AUCManagerFactory<
11
10
  T extends Record<string, Constructor<any>>
package/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [0.2.2](https://github.com/Prestizni-Software/client-dem/compare/v0.2.1...v0.2.2) (2025-11-04)
6
+
7
+ ### [0.2.1](https://github.com/Prestizni-Software/client-dem/compare/v0.1.27...v0.2.1) (2025-11-04)
8
+
9
+ ### [0.1.27](https://github.com/Prestizni-Software/client-dem/compare/v0.1.26...v0.1.27) (2025-11-04)
10
+
5
11
  ### 0.1.26 (2025-11-04)
6
12
 
7
13
  # Changelog
package/client.ts CHANGED
@@ -1,120 +1,11 @@
1
- import { io } from "socket.io-client";
2
- import readline from "readline";
3
- import { classProp, classRef, LoggersType } from "./CommonTypes.js";
4
- import { AUCManagerFactory } from "./AutoUpdateClientManagerClass.js";
5
-
6
- class Test2 {
7
- @classProp public _id!: string;
8
- @classProp public login!: string;
9
- @classProp public loggers!: LoggersType;
10
- public func = () => {
11
- console.log("func");
12
- };
13
- }
14
-
15
- class Test {
16
- @classProp public _id!: string;
17
- @classProp public login!: string[];
18
- @classProp public loggers!: LoggersType;
19
-
20
- // mark as compile-time Ref<Test2> (runtime is still string id)
21
- @classProp @classRef public test2!: Test2;
22
-
23
- // force-loaded ref
24
- @classProp @classRef public test3!: Test2;
25
- }
26
- const loggers: LoggersType = {
27
- info: console.log,
28
- debug: console.debug,
29
- error: console.error,
30
- warn: console.warn,
31
- };
32
-
33
- const socket = io("http://localhost:3000", {
34
- extraHeaders: {
35
- //HEADRY
36
- Authorization: "Bearer " + "token",
37
- },
38
- });
39
- socket.on("connect", async () => {
40
-
41
- const classers = await AUCManagerFactory({ Test, Test2 }, loggers, socket);
42
-
43
- // ---------------------- Setup CLI ----------------------
44
- const rl = readline.createInterface({
45
- input: process.stdin,
46
- output: process.stdout,
47
- });
48
-
49
- setTimeout(async () => {
50
- const ass = ((classers).Test.getObject("68c9f23872cff1778cb1abe2"));
51
- ass?.test2.loggers.info("test");
52
- ass?.test2.func();
53
- }, 100);
54
-
55
- // ---------------------- Interactive CLI ----------------------
56
- function prompt() {
57
- rl.question(
58
- "\nCommands:\n[list] List all collections\n[show <collection> <id> <field?>] Show object\n[set <collection> <id> <field> <value>] Update field\n[new <collection>] Request new object\n[exit] Exit\n> ",
59
- async (input) => {
60
- const args = input.trim().split(" ");
61
- const cmd = args[0];
62
-
63
- switch (cmd) {
64
- case "list":
65
- console.log("Collections:");
66
- for (const classer of Object.values(classers)) {
67
- console.log(`- ${classer.className}`);
68
- for (const id of classer.objectIDs) {
69
- console.log(` • ${id}`);
70
- }
71
- }
72
- break;
73
-
74
- case "show":
75
- if (args.length < 3)
76
- return console.log("❌ Usage: show <collection> <id> <field?>");
77
-
78
- const objShow = await (classers as any)[args[1]]?.getClass(args[2]);
79
- if (!objShow) return console.log("❌ Collection not found");
80
-
81
- if (args[3]) {
82
- const val = objShow.getValue(args[3]);
83
- console.log(val !== undefined ? val : "❌ Field not found");
84
- } else {
85
- console.log(objShow.extractData);
86
- }
87
- break;
88
-
89
- case "set":
90
- if (args.length < 5)
91
- return console.log(
92
- "❌ Usage: set <collection> <id> <field> <value>"
93
- );
94
-
95
- const objSet = await (classers as any)[args[1]]?.getClass(args[2]);
96
- if (!objSet) return console.log("❌ Object not found");
97
-
98
- const fieldPath = args[3];
99
- const value = args.slice(4).join(" "); // allow spaces in value
100
-
101
- if (fieldPath === "_id") return console.log("❌ Cannot change _id");
102
-
103
- objSet.setValue(fieldPath, value);
104
- console.log(`✅ Updated ${fieldPath} = ${value}`);
105
- break;
106
-
107
- case "exit":
108
- console.log("👋 Exiting...");
109
- process.exit(0);
110
-
111
- default:
112
- console.log("❌ Unknown command");
113
- }
114
-
115
- prompt();
116
- }
117
- );
118
- }
119
- prompt();
120
- });
1
+ import * as AutoUpdateClientManagerClass from "./AutoUpdateClientManagerClass.js";
2
+ import * as AutoUpdateManagerClass from "./AutoUpdateManagerClass.js";
3
+ import * as AutoUpdatedClientObjectClass from "./AutoUpdatedClientObjectClass.js";
4
+ import * as CommonTypes from "./CommonTypes.js";
5
+
6
+ module.exports = {
7
+ AutoUpdateClientManagerClass,
8
+ AutoUpdateManagerClass,
9
+ AutoUpdatedClientObjectClass,
10
+ CommonTypes,
11
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prestizni-software/client-dem",
3
- "version": "0.1.26",
3
+ "version": "0.2.2",
4
4
  "description": "An solution for when making http requests is not a good solution",
5
5
  "keywords": [
6
6
  "websockets"