@docstack/client 0.0.1

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.
Files changed (77) hide show
  1. package/README.md +214 -0
  2. package/lib/core/attribute.d.ts +174 -0
  3. package/lib/core/attribute.js +296 -0
  4. package/lib/core/attribute.js.map +1 -0
  5. package/lib/core/class.d.ts +340 -0
  6. package/lib/core/class.js +540 -0
  7. package/lib/core/class.js.map +1 -0
  8. package/lib/core/crypto-engine/index.d.ts +121 -0
  9. package/lib/core/crypto-engine/index.js +130 -0
  10. package/lib/core/crypto-engine/index.js.map +1 -0
  11. package/lib/core/crypto-engine/utils.d.ts +20 -0
  12. package/lib/core/crypto-engine/utils.js +76 -0
  13. package/lib/core/crypto-engine/utils.js.map +1 -0
  14. package/lib/core/datamodel/index.d.ts +3 -0
  15. package/lib/core/datamodel/index.js +1186 -0
  16. package/lib/core/datamodel/index.js.map +1 -0
  17. package/lib/core/domain.d.ts +200 -0
  18. package/lib/core/domain.js +285 -0
  19. package/lib/core/domain.js.map +1 -0
  20. package/lib/core/index.d.ts +176 -0
  21. package/lib/core/index.js +379 -0
  22. package/lib/core/index.js.map +1 -0
  23. package/lib/core/job-engine/index.d.ts +110 -0
  24. package/lib/core/job-engine/index.js +116 -0
  25. package/lib/core/job-engine/index.js.map +1 -0
  26. package/lib/core/policy-engine/index.d.ts +97 -0
  27. package/lib/core/policy-engine/index.js +150 -0
  28. package/lib/core/policy-engine/index.js.map +1 -0
  29. package/lib/core/query-engine/accumulators.d.ts +9 -0
  30. package/lib/core/query-engine/accumulators.js +258 -0
  31. package/lib/core/query-engine/accumulators.js.map +1 -0
  32. package/lib/core/query-engine/evaluator.d.ts +37 -0
  33. package/lib/core/query-engine/evaluator.js +179 -0
  34. package/lib/core/query-engine/evaluator.js.map +1 -0
  35. package/lib/core/query-engine/executor.d.ts +14 -0
  36. package/lib/core/query-engine/executor.js +405 -0
  37. package/lib/core/query-engine/executor.js.map +1 -0
  38. package/lib/core/query-engine/index.d.ts +4 -0
  39. package/lib/core/query-engine/index.js +4 -0
  40. package/lib/core/query-engine/index.js.map +1 -0
  41. package/lib/core/query-engine/parser.d.ts +10 -0
  42. package/lib/core/query-engine/parser.js +515 -0
  43. package/lib/core/query-engine/parser.js.map +1 -0
  44. package/lib/core/query-engine/planner.d.ts +27 -0
  45. package/lib/core/query-engine/planner.js +330 -0
  46. package/lib/core/query-engine/planner.js.map +1 -0
  47. package/lib/core/stack.d.ts +497 -0
  48. package/lib/core/stack.js +1507 -0
  49. package/lib/core/stack.js.map +1 -0
  50. package/lib/core/test-utils/docstack.d.ts +29 -0
  51. package/lib/core/test-utils/docstack.js +222 -0
  52. package/lib/core/test-utils/docstack.js.map +1 -0
  53. package/lib/core/trigger/index.d.ts +31 -0
  54. package/lib/core/trigger/index.js +81 -0
  55. package/lib/core/trigger/index.js.map +1 -0
  56. package/lib/index.d.ts +4 -0
  57. package/lib/index.js +8237 -0
  58. package/lib/index.js.map +1 -0
  59. package/lib/plugins/pouchdb.d.ts +9 -0
  60. package/lib/plugins/pouchdb.js +403 -0
  61. package/lib/plugins/pouchdb.js.map +1 -0
  62. package/lib/utils/crypto/index.d.ts +3 -0
  63. package/lib/utils/crypto/index.js +34 -0
  64. package/lib/utils/crypto/index.js.map +1 -0
  65. package/lib/utils/index.d.ts +4 -0
  66. package/lib/utils/index.js +58 -0
  67. package/lib/utils/index.js.map +1 -0
  68. package/lib/utils/logger/index.d.ts +4 -0
  69. package/lib/utils/logger/index.js +20 -0
  70. package/lib/utils/logger/index.js.map +1 -0
  71. package/lib/utils/logger/transport.d.ts +11 -0
  72. package/lib/utils/logger/transport.js +28 -0
  73. package/lib/utils/logger/transport.js.map +1 -0
  74. package/lib/workers/dataModel.d.ts +1 -0
  75. package/lib/workers/dataModel.js +48 -0
  76. package/lib/workers/dataModel.js.map +1 -0
  77. package/package.json +60 -0
@@ -0,0 +1,48 @@
1
+ import createLogger from "../utils/logger/index.js";
2
+ const logger = createLogger().child({ module: "dataModel" });
3
+ logger.info("Worker successfully registered");
4
+ // Implement a message queue to handle requests sequentially.
5
+ const messageQueue = [];
6
+ let isProcessing = false;
7
+ // Function to process messages from the queue.
8
+ const processQueue = async () => {
9
+ const fnLogger = logger.child({ method: "processQueue" });
10
+ fnLogger.info("Started to process model worker queue");
11
+ if (isProcessing || messageQueue.length === 0) {
12
+ return;
13
+ }
14
+ isProcessing = true;
15
+ const nextMessage = messageQueue.shift();
16
+ if (nextMessage) {
17
+ const { command, payload } = nextMessage;
18
+ try {
19
+ //
20
+ }
21
+ catch (error) {
22
+ // If anything goes wrong, send an error message back.
23
+ self.postMessage({
24
+ status: 'error',
25
+ message: `Failed.`,
26
+ error: error.message
27
+ });
28
+ }
29
+ finally {
30
+ // We are done with the current message.
31
+ isProcessing = false;
32
+ // Check if there are more messages to process.
33
+ processQueue();
34
+ }
35
+ }
36
+ };
37
+ // Listen for messages from the main application thread.
38
+ self.onmessage = (event) => {
39
+ if (event.data.command) {
40
+ messageQueue.push(event.data);
41
+ // Start processing the queue if not already busy.
42
+ processQueue();
43
+ }
44
+ };
45
+ self.onmessageerror = (event) => {
46
+ logger.error("Got error", { event });
47
+ };
48
+ //# sourceMappingURL=dataModel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dataModel.js","sourceRoot":"","sources":["../../src/workers/dataModel.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,0BAA0B,CAAC;AAEpD,MAAM,MAAM,GAAG,YAAY,EAAE,CAAC,KAAK,CAAC,EAAC,MAAM,EAAE,WAAW,EAAC,CAAC,CAAC;AAE3D,MAAM,CAAC,IAAI,CAAC,gCAAgC,CAAC,CAAC;AAO9C,6DAA6D;AAC7D,MAAM,YAAY,GAAmB,EAAE,CAAC;AACxC,IAAI,YAAY,GAAG,KAAK,CAAC;AAEzB,+CAA+C;AAC/C,MAAM,YAAY,GAAG,KAAK,IAAI,EAAE;IAC5B,MAAM,QAAQ,GAAG,MAAM,CAAC,KAAK,CAAC,EAAC,MAAM,EAAE,cAAc,EAAC,CAAC,CAAC;IACxD,QAAQ,CAAC,IAAI,CAAC,uCAAuC,CAAC,CAAC;IACvD,IAAI,YAAY,IAAI,YAAY,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC5C,OAAO;IACX,CAAC;IAED,YAAY,GAAG,IAAI,CAAC;IACpB,MAAM,WAAW,GAAG,YAAY,CAAC,KAAK,EAAE,CAAC;IACzC,IAAI,WAAW,EAAE,CAAC;QACd,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,WAAW,CAAC;QAEzC,IAAI,CAAC;YACD,EAAE;QACN,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YAClB,sDAAsD;YACtD,IAAI,CAAC,WAAW,CAAC;gBACb,MAAM,EAAE,OAAO;gBACf,OAAO,EAAE,SAAS;gBAClB,KAAK,EAAE,KAAK,CAAC,OAAO;aACvB,CAAC,CAAC;QACP,CAAC;gBAAS,CAAC;YACP,wCAAwC;YACxC,YAAY,GAAG,KAAK,CAAC;YACrB,+CAA+C;YAC/C,YAAY,EAAE,CAAC;QACnB,CAAC;IACL,CAAC;AAEL,CAAC,CAAC;AAEF,wDAAwD;AACxD,IAAI,CAAC,SAAS,GAAG,CAAC,KAAiC,EAAE,EAAE;IACnD,IAAI,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;QACrB,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC9B,kDAAkD;QAClD,YAAY,EAAE,CAAC;IACnB,CAAC;AACL,CAAC,CAAC;AAEF,IAAI,CAAC,cAAc,GAAG,CAAC,KAAmB,EAAE,EAAE;IAC1C,MAAM,CAAC,KAAK,CAAC,WAAW,EAAE,EAAC,KAAK,EAAC,CAAC,CAAC;AACvC,CAAC,CAAA"}
package/package.json ADDED
@@ -0,0 +1,60 @@
1
+ {
2
+ "name": "@docstack/client",
3
+ "description": "One does not simply stack documents.",
4
+ "version": "0.0.1",
5
+ "main": "lib/index.js",
6
+ "src": "src/index.ts",
7
+ "publishConfig": {
8
+ "access": "public"
9
+ },
10
+ "type": "module",
11
+ "scripts": {
12
+ "build:types": "npx tsc -build --force ./tsconfig.json",
13
+ "build": "rollup --config ./rollup.config.js",
14
+ "build:vendor": "rollup --config ./rollup.vendor.js",
15
+ "lint": "eslint ./src --ext .ts,.tsx",
16
+ "test": "playwright test"
17
+ },
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "git+https://github.com/onyx-og/docstack.git"
21
+ },
22
+ "keywords": [
23
+ "nosql",
24
+ "db",
25
+ "storage",
26
+ "management"
27
+ ],
28
+ "author": "Onyx <hello@onyx.ac> (https://onyx.ac)",
29
+ "license": "CC-BY-SA-4.0",
30
+ "bugs": {
31
+ "url": "https://github.com/onyx-og/docstack/issues"
32
+ },
33
+ "homepage": "https://github.com/onyx-og/docstack#readme",
34
+ "dependencies": {
35
+ "jsondiffpatch": "^0.6.0",
36
+ "pouchdb-browser": "^9.0.0",
37
+ "pouchdb-find": "^9.0.0",
38
+ "semver": "^7.7.3",
39
+ "setimmediate": "^1.0.5",
40
+ "winston": "^3.17.0",
41
+ "winston-transport": "^4.9.0",
42
+ "zod": "^3.24.1"
43
+ },
44
+ "devDependencies": {
45
+ "@docstack/shared": "file:../shared",
46
+ "@playwright/test": "^1.57.0",
47
+ "@rollup/plugin-commonjs": "^25.0.0",
48
+ "@rollup/plugin-json": "^6.1.0",
49
+ "@rollup/plugin-node-resolve": "^15.0.0",
50
+ "@rollup/plugin-replace": "^5.0.7",
51
+ "@rollup/plugin-typescript": "^12.3.0",
52
+ "@types/semver": "^7.7.1",
53
+ "http-server": "^14.1.1",
54
+ "rollup": "^4.53.1",
55
+ "rollup-plugin-polyfill-node": "^0.13.0"
56
+ },
57
+ "optionalDependencies": {
58
+ "@rollup/rollup-win32-x64-msvc": "*"
59
+ }
60
+ }