@basementuniverse/jsonpad-realtime-sdk 1.0.0 → 1.2.0

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 (143) hide show
  1. package/README.md +5 -3
  2. package/build/jsonpad-realtime-sdk.d.ts +81 -0
  3. package/build/jsonpad-realtime-sdk.js +1 -0
  4. package/package.json +2 -2
  5. package/resources/jsonpad-realtime-sdk-test/build/index.d.ts +1 -0
  6. package/resources/jsonpad-realtime-sdk-test/build/index.js +42 -0
  7. package/resources/jsonpad-realtime-sdk-test/index.html +52 -0
  8. package/resources/jsonpad-realtime-sdk-test/index.js +51 -0
  9. package/resources/jsonpad-realtime-sdk-test/index.ts +66 -0
  10. package/resources/jsonpad-realtime-sdk-test/node_modules/.package-lock.json +43 -0
  11. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/LICENSE.txt +55 -0
  12. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/README.md +50 -0
  13. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/SECURITY.md +41 -0
  14. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/ThirdPartyNoticeText.txt +193 -0
  15. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/bin/tsc +2 -0
  16. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/bin/tsserver +2 -0
  17. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/cancellationToken.js +90 -0
  18. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/cs/diagnosticMessages.generated.json +2087 -0
  19. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/de/diagnosticMessages.generated.json +2087 -0
  20. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/es/diagnosticMessages.generated.json +2087 -0
  21. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/fr/diagnosticMessages.generated.json +2087 -0
  22. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/it/diagnosticMessages.generated.json +2087 -0
  23. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/ja/diagnosticMessages.generated.json +2087 -0
  24. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/ko/diagnosticMessages.generated.json +2087 -0
  25. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.d.ts +22 -0
  26. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.decorators.d.ts +386 -0
  27. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.decorators.legacy.d.ts +22 -0
  28. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.dom.asynciterable.d.ts +41 -0
  29. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.dom.d.ts +28087 -0
  30. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.dom.iterable.d.ts +491 -0
  31. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2015.collection.d.ts +147 -0
  32. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2015.core.d.ts +597 -0
  33. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2015.d.ts +28 -0
  34. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2015.generator.d.ts +77 -0
  35. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2015.iterable.d.ts +527 -0
  36. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2015.promise.d.ts +81 -0
  37. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2015.proxy.d.ts +128 -0
  38. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2015.reflect.d.ts +144 -0
  39. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2015.symbol.d.ts +46 -0
  40. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts +326 -0
  41. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2016.array.include.d.ts +116 -0
  42. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2016.d.ts +21 -0
  43. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2016.full.d.ts +23 -0
  44. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2016.intl.d.ts +31 -0
  45. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2017.d.ts +25 -0
  46. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2017.date.d.ts +31 -0
  47. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2017.full.d.ts +23 -0
  48. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2017.intl.d.ts +44 -0
  49. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2017.object.d.ts +49 -0
  50. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts +135 -0
  51. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2017.string.d.ts +45 -0
  52. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts +53 -0
  53. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts +77 -0
  54. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2018.asynciterable.d.ts +53 -0
  55. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2018.d.ts +24 -0
  56. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2018.full.d.ts +24 -0
  57. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2018.intl.d.ts +83 -0
  58. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2018.promise.d.ts +30 -0
  59. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2018.regexp.d.ts +37 -0
  60. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2019.array.d.ts +79 -0
  61. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2019.d.ts +24 -0
  62. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2019.full.d.ts +24 -0
  63. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2019.intl.d.ts +23 -0
  64. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2019.object.d.ts +33 -0
  65. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2019.string.d.ts +37 -0
  66. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2019.symbol.d.ts +24 -0
  67. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2020.bigint.d.ts +727 -0
  68. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2020.d.ts +27 -0
  69. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2020.date.d.ts +42 -0
  70. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2020.full.d.ts +24 -0
  71. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2020.intl.d.ts +474 -0
  72. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2020.number.d.ts +28 -0
  73. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2020.promise.d.ts +47 -0
  74. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts +97 -0
  75. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2020.string.d.ts +42 -0
  76. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts +41 -0
  77. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2021.d.ts +23 -0
  78. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2021.full.d.ts +24 -0
  79. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2021.intl.d.ts +166 -0
  80. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2021.promise.d.ts +48 -0
  81. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2021.string.d.ts +33 -0
  82. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2021.weakref.d.ts +76 -0
  83. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2022.array.d.ts +121 -0
  84. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2022.d.ts +26 -0
  85. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2022.error.d.ts +73 -0
  86. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2022.full.d.ts +24 -0
  87. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2022.intl.d.ts +121 -0
  88. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2022.object.d.ts +26 -0
  89. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2022.regexp.d.ts +39 -0
  90. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2022.sharedmemory.d.ts +39 -0
  91. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2022.string.d.ts +25 -0
  92. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2023.array.d.ts +924 -0
  93. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2023.collection.d.ts +21 -0
  94. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2023.d.ts +22 -0
  95. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2023.full.d.ts +24 -0
  96. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2023.intl.d.ts +56 -0
  97. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es5.d.ts +4585 -0
  98. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es6.d.ts +23 -0
  99. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.esnext.array.d.ts +35 -0
  100. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.esnext.collection.d.ts +106 -0
  101. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.esnext.d.ts +29 -0
  102. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.esnext.decorators.d.ts +28 -0
  103. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.esnext.disposable.d.ts +193 -0
  104. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.esnext.full.d.ts +24 -0
  105. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.esnext.intl.d.ts +21 -0
  106. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.esnext.iterator.d.ts +148 -0
  107. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.esnext.object.d.ts +29 -0
  108. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.esnext.promise.d.ts +35 -0
  109. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.esnext.regexp.d.ts +25 -0
  110. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.esnext.string.d.ts +29 -0
  111. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.scripthost.d.ts +322 -0
  112. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.webworker.asynciterable.d.ts +41 -0
  113. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.webworker.d.ts +9410 -0
  114. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.webworker.importscripts.d.ts +23 -0
  115. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.webworker.iterable.d.ts +288 -0
  116. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/pl/diagnosticMessages.generated.json +2087 -0
  117. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/pt-br/diagnosticMessages.generated.json +2087 -0
  118. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/ru/diagnosticMessages.generated.json +2087 -0
  119. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/tr/diagnosticMessages.generated.json +2087 -0
  120. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/tsc.js +130769 -0
  121. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/tsserver.js +623 -0
  122. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/tsserverlibrary.d.ts +17 -0
  123. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/tsserverlibrary.js +21 -0
  124. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/typesMap.json +497 -0
  125. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/typescript.d.ts +11328 -0
  126. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/typescript.js +196068 -0
  127. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/typingsInstaller.js +236 -0
  128. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/watchGuard.js +53 -0
  129. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/zh-cn/diagnosticMessages.generated.json +2087 -0
  130. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/zh-tw/diagnosticMessages.generated.json +2087 -0
  131. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/package.json +121 -0
  132. package/resources/jsonpad-realtime-sdk-test/package-lock.json +54 -0
  133. package/resources/jsonpad-realtime-sdk-test/package.json +17 -0
  134. package/resources/jsonpad-realtime-sdk-test/tsconfig.json +25 -0
  135. package/src/events/index.ts +2 -0
  136. package/src/events/item-event.ts +12 -0
  137. package/src/events/list-event.ts +7 -0
  138. package/src/index.ts +14 -0
  139. package/src/jsonpad-realtime.ts +55 -3
  140. package/src/types/event-detail.ts +5 -0
  141. package/src/types/index.ts +3 -0
  142. package/src/types/item.ts +11 -0
  143. package/src/types/list.ts +25 -0
@@ -0,0 +1,121 @@
1
+ {
2
+ "name": "typescript",
3
+ "author": "Microsoft Corp.",
4
+ "homepage": "https://www.typescriptlang.org/",
5
+ "version": "5.6.3",
6
+ "license": "Apache-2.0",
7
+ "description": "TypeScript is a language for application scale JavaScript development",
8
+ "keywords": [
9
+ "TypeScript",
10
+ "Microsoft",
11
+ "compiler",
12
+ "language",
13
+ "javascript"
14
+ ],
15
+ "bugs": {
16
+ "url": "https://github.com/microsoft/TypeScript/issues"
17
+ },
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "https://github.com/microsoft/TypeScript.git"
21
+ },
22
+ "main": "./lib/typescript.js",
23
+ "typings": "./lib/typescript.d.ts",
24
+ "bin": {
25
+ "tsc": "./bin/tsc",
26
+ "tsserver": "./bin/tsserver"
27
+ },
28
+ "engines": {
29
+ "node": ">=14.17"
30
+ },
31
+ "files": [
32
+ "bin",
33
+ "lib",
34
+ "!lib/enu",
35
+ "LICENSE.txt",
36
+ "README.md",
37
+ "SECURITY.md",
38
+ "ThirdPartyNoticeText.txt",
39
+ "!**/.gitattributes"
40
+ ],
41
+ "devDependencies": {
42
+ "@dprint/formatter": "^0.4.1",
43
+ "@dprint/typescript": "0.91.6",
44
+ "@esfx/canceltoken": "^1.0.0",
45
+ "@eslint/js": "^9.9.0",
46
+ "@octokit/rest": "^21.0.1",
47
+ "@types/chai": "^4.3.17",
48
+ "@types/diff": "^5.2.1",
49
+ "@types/minimist": "^1.2.5",
50
+ "@types/mocha": "^10.0.7",
51
+ "@types/ms": "^0.7.34",
52
+ "@types/node": "latest",
53
+ "@types/source-map-support": "^0.5.10",
54
+ "@types/which": "^3.0.4",
55
+ "@typescript-eslint/rule-tester": "^8.1.0",
56
+ "@typescript-eslint/type-utils": "^8.1.0",
57
+ "@typescript-eslint/utils": "^8.1.0",
58
+ "azure-devops-node-api": "^14.0.2",
59
+ "c8": "^10.1.2",
60
+ "chai": "^4.5.0",
61
+ "chalk": "^4.1.2",
62
+ "chokidar": "^3.6.0",
63
+ "diff": "^5.2.0",
64
+ "dprint": "^0.47.2",
65
+ "esbuild": "^0.23.0",
66
+ "eslint": "^9.9.0",
67
+ "eslint-formatter-autolinkable-stylish": "^1.4.0",
68
+ "eslint-plugin-regexp": "^2.6.0",
69
+ "fast-xml-parser": "^4.4.1",
70
+ "glob": "^10.4.5",
71
+ "globals": "^15.9.0",
72
+ "hereby": "^1.9.0",
73
+ "jsonc-parser": "^3.3.1",
74
+ "knip": "^5.27.2",
75
+ "minimist": "^1.2.8",
76
+ "mocha": "^10.7.3",
77
+ "mocha-fivemat-progress-reporter": "^0.1.0",
78
+ "monocart-coverage-reports": "^2.10.2",
79
+ "ms": "^2.1.3",
80
+ "node-fetch": "^3.3.2",
81
+ "playwright": "^1.46.0",
82
+ "source-map-support": "^0.5.21",
83
+ "tslib": "^2.6.3",
84
+ "typescript": "^5.5.4",
85
+ "typescript-eslint": "^8.1.0",
86
+ "which": "^3.0.1"
87
+ },
88
+ "overrides": {
89
+ "typescript@*": "$typescript"
90
+ },
91
+ "scripts": {
92
+ "test": "hereby runtests-parallel --light=false",
93
+ "test:eslint-rules": "hereby run-eslint-rules-tests",
94
+ "build": "npm run build:compiler && npm run build:tests",
95
+ "build:compiler": "hereby local",
96
+ "build:tests": "hereby tests",
97
+ "build:tests:notypecheck": "hereby tests --no-typecheck",
98
+ "clean": "hereby clean",
99
+ "gulp": "hereby",
100
+ "lint": "hereby lint",
101
+ "knip": "hereby knip",
102
+ "format": "dprint fmt",
103
+ "setup-hooks": "node scripts/link-hooks.mjs"
104
+ },
105
+ "browser": {
106
+ "fs": false,
107
+ "os": false,
108
+ "path": false,
109
+ "crypto": false,
110
+ "buffer": false,
111
+ "source-map-support": false,
112
+ "inspector": false,
113
+ "perf_hooks": false
114
+ },
115
+ "packageManager": "npm@8.19.4",
116
+ "volta": {
117
+ "node": "20.1.0",
118
+ "npm": "8.19.4"
119
+ },
120
+ "gitHead": "d48a5cf89a62a62d6c6ed53ffa18f070d9458b85"
121
+ }
@@ -0,0 +1,54 @@
1
+ {
2
+ "name": "jsonpad-realtime-sdk-test",
3
+ "version": "1.0.0",
4
+ "lockfileVersion": 3,
5
+ "requires": true,
6
+ "packages": {
7
+ "": {
8
+ "name": "jsonpad-realtime-sdk-test",
9
+ "version": "1.0.0",
10
+ "license": "ISC",
11
+ "dependencies": {
12
+ "@basementuniverse/jsonpad-realtime-sdk": "file:../.."
13
+ },
14
+ "devDependencies": {
15
+ "typescript": "^5.6.3"
16
+ }
17
+ },
18
+ "../..": {
19
+ "version": "1.0.0",
20
+ "license": "MIT",
21
+ "dependencies": {
22
+ "socket.io-client": "^4.8.1"
23
+ },
24
+ "devDependencies": {
25
+ "-": "^0.0.1",
26
+ "@rollup/plugin-commonjs": "^28.0.1",
27
+ "@rollup/plugin-node-resolve": "^15.3.0",
28
+ "@rollup/plugin-terser": "^0.4.4",
29
+ "@rollup/plugin-typescript": "^12.1.1",
30
+ "rollup": "^4.24.3",
31
+ "rollup-plugin-dts": "^6.1.1",
32
+ "save-dev": "^0.0.1-security",
33
+ "tslib": "^2.8.1"
34
+ }
35
+ },
36
+ "node_modules/@basementuniverse/jsonpad-realtime-sdk": {
37
+ "resolved": "../..",
38
+ "link": true
39
+ },
40
+ "node_modules/typescript": {
41
+ "version": "5.6.3",
42
+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.6.3.tgz",
43
+ "integrity": "sha512-hjcS1mhfuyi4WW8IWtjP7brDrG2cuDZukyrYrSauoXGNgx0S7zceP07adYkJycEr56BOUTNPzbInooiN3fn1qw==",
44
+ "dev": true,
45
+ "bin": {
46
+ "tsc": "bin/tsc",
47
+ "tsserver": "bin/tsserver"
48
+ },
49
+ "engines": {
50
+ "node": ">=14.17"
51
+ }
52
+ }
53
+ }
54
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "name": "jsonpad-realtime-sdk-test",
3
+ "version": "1.0.0",
4
+ "description": "",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "build": "tsc"
8
+ },
9
+ "author": "",
10
+ "license": "ISC",
11
+ "dependencies": {
12
+ "@basementuniverse/jsonpad-realtime-sdk": "file:../.."
13
+ },
14
+ "devDependencies": {
15
+ "typescript": "^5.6.3"
16
+ }
17
+ }
@@ -0,0 +1,25 @@
1
+ {
2
+ "compileOnSave": false,
3
+ "compilerOptions": {
4
+ "target": "es2019",
5
+ "module": "commonjs",
6
+ "allowJs": false,
7
+ "declaration": true,
8
+ "outDir": "./build",
9
+ "rootDir": "./",
10
+ "strict": true,
11
+ "noImplicitAny": true,
12
+ "strictNullChecks": true,
13
+ "strictFunctionTypes": true,
14
+ "strictBindCallApply": true,
15
+ "strictPropertyInitialization": true,
16
+ "noImplicitThis": true,
17
+ "alwaysStrict": true,
18
+ "noUnusedLocals": true,
19
+ "noUnusedParameters": false,
20
+ "noImplicitReturns": true,
21
+ "esModuleInterop": true,
22
+ "inlineSourceMap": true,
23
+ },
24
+ "include": ["index.ts"]
25
+ }
@@ -0,0 +1,2 @@
1
+ export * from './item-event';
2
+ export * from './list-event';
@@ -0,0 +1,12 @@
1
+ import { EventDetail, Item, MessageType } from '../types';
2
+
3
+ export class ItemEvent extends CustomEvent<any> {
4
+ constructor(messageType: MessageType, detail: EventDetail<Item>) {
5
+ if (detail.model.data && typeof detail.model.data === 'string') {
6
+ try {
7
+ detail.model.data = JSON.parse(detail.model.data);
8
+ } catch (error) {}
9
+ }
10
+ super(messageType, { detail });
11
+ }
12
+ }
@@ -0,0 +1,7 @@
1
+ import { EventDetail, List, MessageType } from '../types';
2
+
3
+ export class ListEvent extends CustomEvent<any> {
4
+ constructor(messageType: MessageType, detail: EventDetail<List>) {
5
+ super(messageType, { detail });
6
+ }
7
+ }
package/src/index.ts CHANGED
@@ -0,0 +1,14 @@
1
+ import { ItemEvent, ListEvent } from './events';
2
+ import { JSONPadRealtime } from './jsonpad-realtime';
3
+ import { EventDetail, EventType, Item, List, MessageType } from './types';
4
+
5
+ export default JSONPadRealtime;
6
+ export {
7
+ EventDetail,
8
+ EventType,
9
+ Item,
10
+ ItemEvent,
11
+ List,
12
+ ListEvent,
13
+ MessageType,
14
+ };
@@ -1,6 +1,8 @@
1
1
  import { io, Socket } from 'socket.io-client';
2
2
  import * as constants from './constants';
3
- import { EventType, MessageType } from './types';
3
+ import { ItemEvent } from './events/item-event';
4
+ import { ListEvent } from './events/list-event';
5
+ import { EventDetail, EventType, Item, List, MessageType } from './types';
4
6
 
5
7
  export class JSONPadRealtime extends EventTarget {
6
8
  private static readonly connected = new Event('connected');
@@ -8,6 +10,10 @@ export class JSONPadRealtime extends EventTarget {
8
10
 
9
11
  private socket: Socket | null = null;
10
12
 
13
+ public get connected() {
14
+ return this.socket?.connected ?? false;
15
+ }
16
+
11
17
  /**
12
18
  * Create a new JSONPad realtime client instance
13
19
  */
@@ -63,6 +69,10 @@ export class JSONPadRealtime extends EventTarget {
63
69
  this.socket.on('list-deleted', this.handleEvent.bind(this, 'list-deleted'));
64
70
  this.socket.on('item-created', this.handleEvent.bind(this, 'item-created'));
65
71
  this.socket.on('item-updated', this.handleEvent.bind(this, 'item-updated'));
72
+ this.socket.on(
73
+ 'item-restored',
74
+ this.handleEvent.bind(this, 'item-restored')
75
+ );
66
76
  this.socket.on('item-deleted', this.handleEvent.bind(this, 'item-deleted'));
67
77
  }
68
78
 
@@ -79,7 +89,7 @@ export class JSONPadRealtime extends EventTarget {
79
89
  }
80
90
 
81
91
  private handleEvent(messageType: MessageType, data: string) {
82
- let parsedData: any;
92
+ let parsedData: EventDetail<any>;
83
93
  try {
84
94
  parsedData = JSON.parse(data);
85
95
  } catch (error) {
@@ -87,6 +97,48 @@ export class JSONPadRealtime extends EventTarget {
87
97
  return;
88
98
  }
89
99
 
90
- this.dispatchEvent(new CustomEvent(messageType, { detail: parsedData }));
100
+ switch (messageType) {
101
+ case 'list-created':
102
+ this.dispatchEvent(
103
+ new ListEvent('list-created', parsedData as EventDetail<List>)
104
+ );
105
+ break;
106
+
107
+ case 'list-updated':
108
+ this.dispatchEvent(
109
+ new ListEvent('list-updated', parsedData as EventDetail<List>)
110
+ );
111
+ break;
112
+
113
+ case 'list-deleted':
114
+ this.dispatchEvent(
115
+ new ListEvent('list-deleted', parsedData as EventDetail<List>)
116
+ );
117
+ break;
118
+
119
+ case 'item-created':
120
+ this.dispatchEvent(
121
+ new ItemEvent('item-created', parsedData as EventDetail<Item>)
122
+ );
123
+ break;
124
+
125
+ case 'item-updated':
126
+ this.dispatchEvent(
127
+ new ItemEvent('item-updated', parsedData as EventDetail<Item>)
128
+ );
129
+ break;
130
+
131
+ case 'item-restored':
132
+ this.dispatchEvent(
133
+ new ItemEvent('item-restored', parsedData as EventDetail<Item>)
134
+ );
135
+ break;
136
+
137
+ case 'item-deleted':
138
+ this.dispatchEvent(
139
+ new ItemEvent('item-deleted', parsedData as EventDetail<Item>)
140
+ );
141
+ break;
142
+ }
91
143
  }
92
144
  }
@@ -0,0 +1,5 @@
1
+ export type EventDetail<T extends object> = {
2
+ listId?: string;
3
+ itemId?: string;
4
+ model: T;
5
+ };
@@ -1,2 +1,5 @@
1
+ export * from './event-detail';
1
2
  export * from './event-type';
3
+ export * from './item';
4
+ export * from './list';
2
5
  export * from './message-type';
@@ -0,0 +1,11 @@
1
+ export type Item = {
2
+ id: string;
3
+ createdAt: Date;
4
+ updatedAt: Date;
5
+ data: any;
6
+ description: string;
7
+ version: string;
8
+ readonly: boolean;
9
+ activated: boolean;
10
+ size: number;
11
+ };
@@ -0,0 +1,25 @@
1
+ export type List = {
2
+ id: string;
3
+ createdAt: Date;
4
+ updatedAt: Date;
5
+ user: {
6
+ id: string;
7
+ createdAt: Date;
8
+ updatedAt: Date;
9
+ lastActiveAt: Date | null;
10
+ activated: boolean;
11
+ displayName: string;
12
+ description: string;
13
+ };
14
+ name: string;
15
+ description: string;
16
+ pathName: string;
17
+ schema: any;
18
+ pinned: boolean;
19
+ readonly: boolean;
20
+ realtime: boolean;
21
+ protected: boolean;
22
+ indexable: boolean;
23
+ activated: boolean;
24
+ itemCount: number;
25
+ };