@basementuniverse/jsonpad-realtime-sdk 1.5.1 → 1.6.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 (133) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/build/jsonpad-realtime-sdk.node.js +216 -0
  3. package/package.json +5 -2
  4. package/resources/jsonpad-realtime-sdk-test/build/index.d.ts +0 -1
  5. package/resources/jsonpad-realtime-sdk-test/build/index.js +0 -42
  6. package/resources/jsonpad-realtime-sdk-test/index.html +0 -52
  7. package/resources/jsonpad-realtime-sdk-test/index.js +0 -51
  8. package/resources/jsonpad-realtime-sdk-test/index.ts +0 -66
  9. package/resources/jsonpad-realtime-sdk-test/node_modules/.package-lock.json +0 -43
  10. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/LICENSE.txt +0 -55
  11. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/README.md +0 -50
  12. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/SECURITY.md +0 -41
  13. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/ThirdPartyNoticeText.txt +0 -193
  14. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/bin/tsc +0 -2
  15. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/bin/tsserver +0 -2
  16. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/cancellationToken.js +0 -90
  17. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/cs/diagnosticMessages.generated.json +0 -2087
  18. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/de/diagnosticMessages.generated.json +0 -2087
  19. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/es/diagnosticMessages.generated.json +0 -2087
  20. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/fr/diagnosticMessages.generated.json +0 -2087
  21. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/it/diagnosticMessages.generated.json +0 -2087
  22. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/ja/diagnosticMessages.generated.json +0 -2087
  23. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/ko/diagnosticMessages.generated.json +0 -2087
  24. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.d.ts +0 -22
  25. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.decorators.d.ts +0 -386
  26. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.decorators.legacy.d.ts +0 -22
  27. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.dom.asynciterable.d.ts +0 -41
  28. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.dom.d.ts +0 -28087
  29. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.dom.iterable.d.ts +0 -491
  30. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2015.collection.d.ts +0 -147
  31. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2015.core.d.ts +0 -597
  32. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2015.d.ts +0 -28
  33. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2015.generator.d.ts +0 -77
  34. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2015.iterable.d.ts +0 -527
  35. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2015.promise.d.ts +0 -81
  36. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2015.proxy.d.ts +0 -128
  37. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2015.reflect.d.ts +0 -144
  38. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2015.symbol.d.ts +0 -46
  39. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts +0 -326
  40. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2016.array.include.d.ts +0 -116
  41. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2016.d.ts +0 -21
  42. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2016.full.d.ts +0 -23
  43. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2016.intl.d.ts +0 -31
  44. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2017.d.ts +0 -25
  45. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2017.date.d.ts +0 -31
  46. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2017.full.d.ts +0 -23
  47. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2017.intl.d.ts +0 -44
  48. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2017.object.d.ts +0 -49
  49. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts +0 -135
  50. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2017.string.d.ts +0 -45
  51. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts +0 -53
  52. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts +0 -77
  53. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2018.asynciterable.d.ts +0 -53
  54. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2018.d.ts +0 -24
  55. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2018.full.d.ts +0 -24
  56. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2018.intl.d.ts +0 -83
  57. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2018.promise.d.ts +0 -30
  58. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2018.regexp.d.ts +0 -37
  59. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2019.array.d.ts +0 -79
  60. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2019.d.ts +0 -24
  61. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2019.full.d.ts +0 -24
  62. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2019.intl.d.ts +0 -23
  63. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2019.object.d.ts +0 -33
  64. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2019.string.d.ts +0 -37
  65. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2019.symbol.d.ts +0 -24
  66. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2020.bigint.d.ts +0 -727
  67. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2020.d.ts +0 -27
  68. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2020.date.d.ts +0 -42
  69. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2020.full.d.ts +0 -24
  70. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2020.intl.d.ts +0 -474
  71. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2020.number.d.ts +0 -28
  72. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2020.promise.d.ts +0 -47
  73. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts +0 -97
  74. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2020.string.d.ts +0 -42
  75. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts +0 -41
  76. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2021.d.ts +0 -23
  77. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2021.full.d.ts +0 -24
  78. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2021.intl.d.ts +0 -166
  79. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2021.promise.d.ts +0 -48
  80. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2021.string.d.ts +0 -33
  81. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2021.weakref.d.ts +0 -76
  82. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2022.array.d.ts +0 -121
  83. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2022.d.ts +0 -26
  84. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2022.error.d.ts +0 -73
  85. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2022.full.d.ts +0 -24
  86. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2022.intl.d.ts +0 -121
  87. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2022.object.d.ts +0 -26
  88. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2022.regexp.d.ts +0 -39
  89. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2022.sharedmemory.d.ts +0 -39
  90. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2022.string.d.ts +0 -25
  91. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2023.array.d.ts +0 -924
  92. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2023.collection.d.ts +0 -21
  93. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2023.d.ts +0 -22
  94. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2023.full.d.ts +0 -24
  95. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es2023.intl.d.ts +0 -56
  96. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es5.d.ts +0 -4585
  97. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.es6.d.ts +0 -23
  98. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.esnext.array.d.ts +0 -35
  99. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.esnext.collection.d.ts +0 -106
  100. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.esnext.d.ts +0 -29
  101. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.esnext.decorators.d.ts +0 -28
  102. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.esnext.disposable.d.ts +0 -193
  103. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.esnext.full.d.ts +0 -24
  104. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.esnext.intl.d.ts +0 -21
  105. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.esnext.iterator.d.ts +0 -148
  106. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.esnext.object.d.ts +0 -29
  107. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.esnext.promise.d.ts +0 -35
  108. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.esnext.regexp.d.ts +0 -25
  109. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.esnext.string.d.ts +0 -29
  110. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.scripthost.d.ts +0 -322
  111. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.webworker.asynciterable.d.ts +0 -41
  112. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.webworker.d.ts +0 -9410
  113. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.webworker.importscripts.d.ts +0 -23
  114. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/lib.webworker.iterable.d.ts +0 -288
  115. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/pl/diagnosticMessages.generated.json +0 -2087
  116. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/pt-br/diagnosticMessages.generated.json +0 -2087
  117. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/ru/diagnosticMessages.generated.json +0 -2087
  118. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/tr/diagnosticMessages.generated.json +0 -2087
  119. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/tsc.js +0 -130769
  120. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/tsserver.js +0 -623
  121. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/tsserverlibrary.d.ts +0 -17
  122. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/tsserverlibrary.js +0 -21
  123. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/typesMap.json +0 -497
  124. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/typescript.d.ts +0 -11328
  125. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/typescript.js +0 -196068
  126. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/typingsInstaller.js +0 -236
  127. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/watchGuard.js +0 -53
  128. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/zh-cn/diagnosticMessages.generated.json +0 -2087
  129. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/lib/zh-tw/diagnosticMessages.generated.json +0 -2087
  130. package/resources/jsonpad-realtime-sdk-test/node_modules/typescript/package.json +0 -121
  131. package/resources/jsonpad-realtime-sdk-test/package-lock.json +0 -54
  132. package/resources/jsonpad-realtime-sdk-test/package.json +0 -17
  133. package/resources/jsonpad-realtime-sdk-test/tsconfig.json +0 -25
package/CHANGELOG.md CHANGED
@@ -8,6 +8,32 @@ and this package adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
8
8
  Dates are npm publish dates. Entries up to and including 1.2.1 were backfilled
9
9
  on 2026-09-14 from git history and are deliberately brief.
10
10
 
11
+ ## [1.6.0] - 2026-09-16
12
+
13
+ ### Fixed
14
+
15
+ - The SDK now works in Node. `listen()` never connected there, and never
16
+ dispatched an error: the only build bundled socket.io-client's browser build,
17
+ which connects with `XMLHttpRequest`, and Node doesn't have one. A
18
+ `XMLHttpRequest` polyfill is no longer needed.
19
+
20
+ ### Changed
21
+
22
+ - The package has a separate CommonJS build for Node,
23
+ `build/jsonpad-realtime-sdk.node.js`, which `main` now points to. It loads
24
+ `socket.io-client` (already a dependency) instead of bundling it, so Node gets
25
+ socket.io-client's Node build. `require()` and `import` give the same exports
26
+ as before.
27
+ - The UMD build, `build/jsonpad-realtime-sdk.js`, is unchanged, and is still
28
+ what a script tag loads from a CDN. The `browser`, `jsdelivr` and `unpkg`
29
+ fields point to it, so bundlers targeting the browser keep using it.
30
+
31
+ ## [1.5.1] - 2026-09-14
32
+
33
+ ### Added
34
+
35
+ - This changelog was added in version 1.5.1.
36
+
11
37
  ## [1.5.0] - 2026-09-13
12
38
 
13
39
  ### Added
@@ -0,0 +1,216 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var socket_ioClient = require('socket.io-client');
6
+
7
+ class ItemEvent extends CustomEvent {
8
+ constructor(messageType, detail) {
9
+ if (detail.model.data && typeof detail.model.data === 'string') {
10
+ try {
11
+ detail.model.data = JSON.parse(detail.model.data);
12
+ }
13
+ catch (error) { }
14
+ }
15
+ super(messageType, { detail });
16
+ }
17
+ }
18
+
19
+ class ListEvent extends CustomEvent {
20
+ constructor(messageType, detail) {
21
+ super(messageType, { detail });
22
+ }
23
+ }
24
+
25
+ /**
26
+ * Dispatched as an 'error' event when the server refuses a connection, or when
27
+ * an event arrives that can't be parsed
28
+ *
29
+ * The detail is the error message, as it was before this class existed, so
30
+ * that anything already listening for 'error' keeps working
31
+ */
32
+ class RealtimeErrorEvent extends CustomEvent {
33
+ constructor(message, data, retryIn = null) {
34
+ var _a, _b, _c, _d;
35
+ super('error', { detail: message });
36
+ this.code = (_a = data === null || data === void 0 ? void 0 : data.code) !== null && _a !== void 0 ? _a : null;
37
+ this.errorName = (_b = data === null || data === void 0 ? void 0 : data.name) !== null && _b !== void 0 ? _b : null;
38
+ this.max = (_c = data === null || data === void 0 ? void 0 : data.max) !== null && _c !== void 0 ? _c : null;
39
+ this.retryAfter = (_d = data === null || data === void 0 ? void 0 : data.retryAfter) !== null && _d !== void 0 ? _d : null;
40
+ this.retryIn = retryIn;
41
+ }
42
+ }
43
+
44
+ const API_URL = 'https://realtime.jsonpad.io';
45
+ const API_TOKEN_HEADER = 'x-api-token';
46
+ // The longest we'll wait before retrying a connection the server refused, in
47
+ // seconds, and how much random jitter to add to each wait
48
+ const MAX_RETRY_DELAY = 300;
49
+ const RETRY_JITTER = 0.2;
50
+
51
+ class JSONPadRealtime extends EventTarget {
52
+ get connected() {
53
+ var _a, _b;
54
+ return (_b = (_a = this.socket) === null || _a === void 0 ? void 0 : _a.connected) !== null && _b !== void 0 ? _b : false;
55
+ }
56
+ /**
57
+ * Create a new JSONPad realtime client instance
58
+ */
59
+ constructor(token, options = {}) {
60
+ super();
61
+ this.token = token;
62
+ this.socket = null;
63
+ this.retryTimeout = null;
64
+ this.retryAttempt = 0;
65
+ this.options = { ...JSONPadRealtime.defaultOptions, ...options };
66
+ }
67
+ /**
68
+ * Close the connection to the realtime server
69
+ */
70
+ close() {
71
+ this.cancelRetry();
72
+ this.closeSocket();
73
+ }
74
+ /**
75
+ * Start listening for realtime events
76
+ */
77
+ listen(eventTypes, listIds, itemIds) {
78
+ var _a, _b;
79
+ this.cancelRetry();
80
+ this.closeSocket();
81
+ if (eventTypes.length === 0) {
82
+ throw new Error('At least one event type must be provided');
83
+ }
84
+ this.socket = socket_ioClient.io(`${API_URL}?${new URLSearchParams({
85
+ eventTypes: eventTypes.join(','),
86
+ listIds: (_a = listIds === null || listIds === void 0 ? void 0 : listIds.join(',')) !== null && _a !== void 0 ? _a : '',
87
+ itemIds: (_b = itemIds === null || itemIds === void 0 ? void 0 : itemIds.join(',')) !== null && _b !== void 0 ? _b : '',
88
+ })}`, {
89
+ extraHeaders: {
90
+ [API_TOKEN_HEADER]: this.token,
91
+ },
92
+ });
93
+ this.socket.on('connect', this.handleConnected.bind(this));
94
+ this.socket.on('connect_error', this.handleConnectError.bind(this));
95
+ this.socket.on('disconnect', this.handleDisconnected.bind(this));
96
+ this.socket.on('error', this.handleError.bind(this));
97
+ this.socket.on('list-created', this.handleEvent.bind(this, 'list-created'));
98
+ this.socket.on('list-updated', this.handleEvent.bind(this, 'list-updated'));
99
+ this.socket.on('list-deleted', this.handleEvent.bind(this, 'list-deleted'));
100
+ this.socket.on('item-created', this.handleEvent.bind(this, 'item-created'));
101
+ this.socket.on('item-updated', this.handleEvent.bind(this, 'item-updated'));
102
+ this.socket.on('item-restored', this.handleEvent.bind(this, 'item-restored'));
103
+ this.socket.on('item-deleted', this.handleEvent.bind(this, 'item-deleted'));
104
+ }
105
+ /**
106
+ * Close the current socket, if there is one
107
+ *
108
+ * A socket that is still connecting, or that is reconnecting in the
109
+ * background, is holding a connection slot on the server just like a
110
+ * connected one, so it gets closed too
111
+ */
112
+ closeSocket() {
113
+ if (this.socket) {
114
+ this.socket.removeAllListeners();
115
+ this.socket.close();
116
+ this.socket = null;
117
+ }
118
+ }
119
+ handleConnected() {
120
+ this.retryAttempt = 0;
121
+ this.dispatchEvent(JSONPadRealtime.connected);
122
+ }
123
+ handleDisconnected() {
124
+ this.dispatchEvent(JSONPadRealtime.disconnected);
125
+ }
126
+ /**
127
+ * A connection attempt failed
128
+ *
129
+ * Socket.IO retries by itself when it couldn't reach the server, and leaves
130
+ * the socket inactive when the server refused the connection instead. A
131
+ * refusal for holding too many concurrent connections is worth retrying,
132
+ * since a connection the client has already lost is released once the
133
+ * server notices it has gone.
134
+ */
135
+ handleConnectError(error) {
136
+ var _a, _b, _c;
137
+ if ((_a = this.socket) === null || _a === void 0 ? void 0 : _a.active) {
138
+ return;
139
+ }
140
+ const retryAfter = (_c = (_b = error.data) === null || _b === void 0 ? void 0 : _b.retryAfter) !== null && _c !== void 0 ? _c : null;
141
+ const retryIn = this.options.retry && retryAfter !== null
142
+ ? this.retryDelay(retryAfter)
143
+ : null;
144
+ this.dispatchEvent(new RealtimeErrorEvent(error.message, error.data, retryIn));
145
+ if (retryIn !== null) {
146
+ this.retryAttempt++;
147
+ this.retryTimeout = setTimeout(() => {
148
+ var _a;
149
+ this.retryTimeout = null;
150
+ (_a = this.socket) === null || _a === void 0 ? void 0 : _a.connect();
151
+ }, retryIn * 1000);
152
+ }
153
+ }
154
+ /**
155
+ * Back off exponentially from the delay the server asked for, with a little
156
+ * jitter so that clients refused at the same time don't all come back at the
157
+ * same time
158
+ */
159
+ retryDelay(retryAfter) {
160
+ const delay = Math.min(retryAfter * Math.pow(2, this.retryAttempt), MAX_RETRY_DELAY);
161
+ return Math.round(delay * (1 + Math.random() * RETRY_JITTER));
162
+ }
163
+ cancelRetry() {
164
+ if (this.retryTimeout !== null) {
165
+ clearTimeout(this.retryTimeout);
166
+ this.retryTimeout = null;
167
+ }
168
+ this.retryAttempt = 0;
169
+ }
170
+ handleError(message) {
171
+ this.dispatchEvent(new RealtimeErrorEvent(message));
172
+ }
173
+ handleEvent(messageType, data) {
174
+ let parsedData;
175
+ try {
176
+ parsedData = JSON.parse(data);
177
+ }
178
+ catch (error) {
179
+ this.handleError('Failed to parse data');
180
+ return;
181
+ }
182
+ switch (messageType) {
183
+ case 'list-created':
184
+ this.dispatchEvent(new ListEvent('list-created', parsedData));
185
+ break;
186
+ case 'list-updated':
187
+ this.dispatchEvent(new ListEvent('list-updated', parsedData));
188
+ break;
189
+ case 'list-deleted':
190
+ this.dispatchEvent(new ListEvent('list-deleted', parsedData));
191
+ break;
192
+ case 'item-created':
193
+ this.dispatchEvent(new ItemEvent('item-created', parsedData));
194
+ break;
195
+ case 'item-updated':
196
+ this.dispatchEvent(new ItemEvent('item-updated', parsedData));
197
+ break;
198
+ case 'item-restored':
199
+ this.dispatchEvent(new ItemEvent('item-restored', parsedData));
200
+ break;
201
+ case 'item-deleted':
202
+ this.dispatchEvent(new ItemEvent('item-deleted', parsedData));
203
+ break;
204
+ }
205
+ }
206
+ }
207
+ JSONPadRealtime.connected = new Event('connected');
208
+ JSONPadRealtime.disconnected = new Event('disconnected');
209
+ JSONPadRealtime.defaultOptions = {
210
+ retry: true,
211
+ };
212
+
213
+ exports.ItemEvent = ItemEvent;
214
+ exports.ListEvent = ListEvent;
215
+ exports.RealtimeErrorEvent = RealtimeErrorEvent;
216
+ exports.default = JSONPadRealtime;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@basementuniverse/jsonpad-realtime-sdk",
3
- "version": "1.5.1",
3
+ "version": "1.6.0",
4
4
  "description": "JSONPad Realtime SDK for Node and browser",
5
5
  "author": "Gordon Larrigan <gordonlarrigan@gmail.com> (https://gordonlarrigan.com)",
6
6
  "license": "MIT",
@@ -12,7 +12,10 @@
12
12
  "bugs": {
13
13
  "url": "https://github.com/basementuniverse/jsonpad-realtime-sdk/issues"
14
14
  },
15
- "main": "build/jsonpad-realtime-sdk.js",
15
+ "main": "build/jsonpad-realtime-sdk.node.js",
16
+ "browser": "build/jsonpad-realtime-sdk.js",
17
+ "jsdelivr": "build/jsonpad-realtime-sdk.js",
18
+ "unpkg": "build/jsonpad-realtime-sdk.js",
16
19
  "types": "build/jsonpad-realtime-sdk.d.ts",
17
20
  "scripts": {
18
21
  "build": "rollup -c && npm run clean",
@@ -1 +0,0 @@
1
- export {};
@@ -1,42 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const jsonpad_realtime_sdk_1 = __importDefault(require("@basementuniverse/jsonpad-realtime-sdk"));
7
- const jsonpadRealtime = new jsonpad_realtime_sdk_1.default('ZuzAL3tTRk+cLP9nKW3rhhPZ5A7cyaM3');
8
- jsonpadRealtime.listen([
9
- 'list-created',
10
- 'list-updated',
11
- 'list-deleted',
12
- 'item-created',
13
- 'item-updated',
14
- 'item-restored',
15
- 'item-deleted',
16
- ], [
17
- '23220075-e843-45de-a60b-135f77137b1a',
18
- ], [
19
- '*',
20
- ]);
21
- jsonpadRealtime.addEventListener('list-created', e => {
22
- console.log(`A list called ${e.detail.model.name} was created!`);
23
- });
24
- jsonpadRealtime.addEventListener('list-updated', e => {
25
- console.log(`A list called ${e.detail.model.name} was updated!`);
26
- });
27
- jsonpadRealtime.addEventListener('list-deleted', e => {
28
- console.log(`A list called ${e.detail.model.name} was deleted!`);
29
- });
30
- jsonpadRealtime.addEventListener('item-created', e => {
31
- console.log(`An item with id ${e.detail.model.id} was created!`);
32
- });
33
- jsonpadRealtime.addEventListener('item-updated', e => {
34
- console.log(`An item with id ${e.detail.model.id} was updated!`);
35
- });
36
- jsonpadRealtime.addEventListener('item-restored', e => {
37
- console.log(`An item with id ${e.detail.model.id} was restored!`);
38
- });
39
- jsonpadRealtime.addEventListener('item-deleted', e => {
40
- console.log(`An item with id ${e.detail.itemId} was deleted!`);
41
- });
42
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7OztBQUFBLGtHQUdnRDtBQUVoRCxNQUFNLGVBQWUsR0FBRyxJQUFJLDhCQUFlLENBQUMsa0NBQWtDLENBQUMsQ0FBQztBQUVoRixlQUFlLENBQUMsTUFBTSxDQUNwQjtJQUNFLGNBQWM7SUFDZCxjQUFjO0lBQ2QsY0FBYztJQUNkLGNBQWM7SUFDZCxjQUFjO0lBQ2QsZUFBZTtJQUNmLGNBQWM7Q0FDZixFQUNEO0lBQ0Usc0NBQXNDO0NBQ3ZDLEVBQ0Q7SUFDRSxHQUFHO0NBQ0osQ0FDRixDQUFDO0FBRUYsZUFBZSxDQUFDLGdCQUFnQixDQUFDLGNBQWMsRUFBRSxDQUFDLENBQUMsRUFBRTtJQUNuRCxPQUFPLENBQUMsR0FBRyxDQUNULGlCQUFrQixDQUFlLENBQUMsTUFBTSxDQUFDLEtBQUssQ0FBQyxJQUFJLGVBQWUsQ0FDbkUsQ0FBQztBQUNKLENBQUMsQ0FBQyxDQUFDO0FBRUgsZUFBZSxDQUFDLGdCQUFnQixDQUFDLGNBQWMsRUFBRSxDQUFDLENBQUMsRUFBRTtJQUNuRCxPQUFPLENBQUMsR0FBRyxDQUNULGlCQUFrQixDQUFlLENBQUMsTUFBTSxDQUFDLEtBQUssQ0FBQyxJQUFJLGVBQWUsQ0FDbkUsQ0FBQztBQUNKLENBQUMsQ0FBQyxDQUFDO0FBRUgsZUFBZSxDQUFDLGdCQUFnQixDQUFDLGNBQWMsRUFBRSxDQUFDLENBQUMsRUFBRTtJQUNuRCxPQUFPLENBQUMsR0FBRyxDQUNULGlCQUFrQixDQUFlLENBQUMsTUFBTSxDQUFDLEtBQUssQ0FBQyxJQUFJLGVBQWUsQ0FDbkUsQ0FBQztBQUNKLENBQUMsQ0FBQyxDQUFDO0FBRUgsZUFBZSxDQUFDLGdCQUFnQixDQUFDLGNBQWMsRUFBRSxDQUFDLENBQUMsRUFBRTtJQUNuRCxPQUFPLENBQUMsR0FBRyxDQUNULG1CQUFvQixDQUFlLENBQUMsTUFBTSxDQUFDLEtBQUssQ0FBQyxFQUFFLGVBQWUsQ0FDbkUsQ0FBQztBQUNKLENBQUMsQ0FBQyxDQUFDO0FBRUgsZUFBZSxDQUFDLGdCQUFnQixDQUFDLGNBQWMsRUFBRSxDQUFDLENBQUMsRUFBRTtJQUNuRCxPQUFPLENBQUMsR0FBRyxDQUNULG1CQUFvQixDQUFlLENBQUMsTUFBTSxDQUFDLEtBQUssQ0FBQyxFQUFFLGVBQWUsQ0FDbkUsQ0FBQztBQUNKLENBQUMsQ0FBQyxDQUFDO0FBRUgsZUFBZSxDQUFDLGdCQUFnQixDQUFDLGVBQWUsRUFBRSxDQUFDLENBQUMsRUFBRTtJQUNwRCxPQUFPLENBQUMsR0FBRyxDQUNULG1CQUFvQixDQUFlLENBQUMsTUFBTSxDQUFDLEtBQUssQ0FBQyxFQUFFLGdCQUFnQixDQUNwRSxDQUFDO0FBQ0osQ0FBQyxDQUFDLENBQUM7QUFFSCxlQUFlLENBQUMsZ0JBQWdCLENBQUMsY0FBYyxFQUFFLENBQUMsQ0FBQyxFQUFFO0lBQ25ELE9BQU8sQ0FBQyxHQUFHLENBQ1QsbUJBQW9CLENBQWUsQ0FBQyxNQUFNLENBQUMsTUFBTSxlQUFlLENBQ2pFLENBQUM7QUFDSixDQUFDLENBQUMsQ0FBQyJ9
@@ -1,52 +0,0 @@
1
- <script src="node_modules/@basementuniverse/jsonpad-realtime-sdk/build/jsonpad-realtime-sdk.js"></script>
2
- <script>
3
-
4
- const jsonpadRealtime = new JSONPadRealtime.default('ZuzAL3tTRk+cLP9nKW3rhhPZ5A7cyaM3');
5
-
6
- jsonpadRealtime.listen(
7
- [
8
- 'list-created',
9
- 'list-updated',
10
- 'list-deleted',
11
- 'item-created',
12
- 'item-updated',
13
- 'item-restored',
14
- 'item-deleted',
15
- ],
16
- [
17
- '23220075-e843-45de-a60b-135f77137b1a',
18
- ],
19
- [
20
- '*',
21
- ]
22
- );
23
-
24
- jsonpadRealtime.addEventListener('list-created', e => {
25
- console.log(`A list called ${e.detail.model.name} was created!`);
26
- });
27
-
28
- jsonpadRealtime.addEventListener('list-updated', e => {
29
- console.log(`A list called ${e.detail.model.name} was updated!`);
30
- });
31
-
32
- jsonpadRealtime.addEventListener('list-deleted', e => {
33
- console.log(`A list called ${e.detail.model.name} was deleted!`);
34
- });
35
-
36
- jsonpadRealtime.addEventListener('item-created', e => {
37
- console.log(`An item with id ${e.detail.model.id} was created!`);
38
- });
39
-
40
- jsonpadRealtime.addEventListener('item-updated', e => {
41
- console.log(`An item with id ${e.detail.model.id} was updated!`);
42
- });
43
-
44
- jsonpadRealtime.addEventListener('item-restored', e => {
45
- console.log(`An item with id ${e.detail.model.id} was restored!`);
46
- });
47
-
48
- jsonpadRealtime.addEventListener('item-deleted', e => {
49
- console.log(`An item with id ${e.detail.model.id} was deleted!`);
50
- });
51
-
52
- </script>
@@ -1,51 +0,0 @@
1
- const JSONPadRealtime = require(
2
- '@basementuniverse/jsonpad-realtime-sdk'
3
- ).default;
4
-
5
- const jsonpadRealtime = new JSONPadRealtime('ZuzAL3tTRk+cLP9nKW3rhhPZ5A7cyaM3');
6
-
7
- jsonpadRealtime.listen(
8
- [
9
- 'list-created',
10
- 'list-updated',
11
- 'list-deleted',
12
- 'item-created',
13
- 'item-updated',
14
- 'item-restored',
15
- 'item-deleted',
16
- ],
17
- [
18
- '23220075-e843-45de-a60b-135f77137b1a',
19
- ],
20
- [
21
- '*',
22
- ]
23
- );
24
-
25
- jsonpadRealtime.addEventListener('list-created', e => {
26
- console.log(`A list called ${e.detail.model.name} was created!`);
27
- });
28
-
29
- jsonpadRealtime.addEventListener('list-updated', e => {
30
- console.log(`A list called ${e.detail.model.name} was updated!`);
31
- });
32
-
33
- jsonpadRealtime.addEventListener('list-deleted', e => {
34
- console.log(`A list called ${e.detail.model.name} was deleted!`);
35
- });
36
-
37
- jsonpadRealtime.addEventListener('item-created', e => {
38
- console.log(`An item with id ${e.detail.model.id} was created!`);
39
- });
40
-
41
- jsonpadRealtime.addEventListener('item-updated', e => {
42
- console.log(`An item with id ${e.detail.model.id} was updated!`);
43
- });
44
-
45
- jsonpadRealtime.addEventListener('item-restored', e => {
46
- console.log(`An item with id ${e.detail.model.id} was restored!`);
47
- });
48
-
49
- jsonpadRealtime.addEventListener('item-deleted', e => {
50
- console.log(`An item with id ${e.detail.model.id} was deleted!`);
51
- });
@@ -1,66 +0,0 @@
1
- import JSONPadRealtime, {
2
- ListEvent,
3
- ItemEvent,
4
- } from '@basementuniverse/jsonpad-realtime-sdk';
5
-
6
- const jsonpadRealtime = new JSONPadRealtime('ZuzAL3tTRk+cLP9nKW3rhhPZ5A7cyaM3');
7
-
8
- jsonpadRealtime.listen(
9
- [
10
- 'list-created',
11
- 'list-updated',
12
- 'list-deleted',
13
- 'item-created',
14
- 'item-updated',
15
- 'item-restored',
16
- 'item-deleted',
17
- ],
18
- [
19
- '23220075-e843-45de-a60b-135f77137b1a',
20
- ],
21
- [
22
- '*',
23
- ]
24
- );
25
-
26
- jsonpadRealtime.addEventListener('list-created', e => {
27
- console.log(
28
- `A list called ${(e as ListEvent).detail.model.name} was created!`
29
- );
30
- });
31
-
32
- jsonpadRealtime.addEventListener('list-updated', e => {
33
- console.log(
34
- `A list called ${(e as ListEvent).detail.model.name} was updated!`
35
- );
36
- });
37
-
38
- jsonpadRealtime.addEventListener('list-deleted', e => {
39
- console.log(
40
- `A list called ${(e as ListEvent).detail.model.name} was deleted!`
41
- );
42
- });
43
-
44
- jsonpadRealtime.addEventListener('item-created', e => {
45
- console.log(
46
- `An item with id ${(e as ItemEvent).detail.model.id} was created!`
47
- );
48
- });
49
-
50
- jsonpadRealtime.addEventListener('item-updated', e => {
51
- console.log(
52
- `An item with id ${(e as ItemEvent).detail.model.id} was updated!`
53
- );
54
- });
55
-
56
- jsonpadRealtime.addEventListener('item-restored', e => {
57
- console.log(
58
- `An item with id ${(e as ItemEvent).detail.model.id} was restored!`
59
- );
60
- });
61
-
62
- jsonpadRealtime.addEventListener('item-deleted', e => {
63
- console.log(
64
- `An item with id ${(e as ItemEvent).detail.model.id} was deleted!`
65
- );
66
- });
@@ -1,43 +0,0 @@
1
- {
2
- "name": "jsonpad-realtime-sdk-test",
3
- "version": "1.0.0",
4
- "lockfileVersion": 3,
5
- "requires": true,
6
- "packages": {
7
- "../..": {
8
- "version": "1.0.0",
9
- "license": "MIT",
10
- "dependencies": {
11
- "socket.io-client": "^4.8.1"
12
- },
13
- "devDependencies": {
14
- "-": "^0.0.1",
15
- "@rollup/plugin-commonjs": "^28.0.1",
16
- "@rollup/plugin-node-resolve": "^15.3.0",
17
- "@rollup/plugin-terser": "^0.4.4",
18
- "@rollup/plugin-typescript": "^12.1.1",
19
- "rollup": "^4.24.3",
20
- "rollup-plugin-dts": "^6.1.1",
21
- "save-dev": "^0.0.1-security",
22
- "tslib": "^2.8.1"
23
- }
24
- },
25
- "node_modules/@basementuniverse/jsonpad-realtime-sdk": {
26
- "resolved": "../..",
27
- "link": true
28
- },
29
- "node_modules/typescript": {
30
- "version": "5.6.3",
31
- "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.6.3.tgz",
32
- "integrity": "sha512-hjcS1mhfuyi4WW8IWtjP7brDrG2cuDZukyrYrSauoXGNgx0S7zceP07adYkJycEr56BOUTNPzbInooiN3fn1qw==",
33
- "dev": true,
34
- "bin": {
35
- "tsc": "bin/tsc",
36
- "tsserver": "bin/tsserver"
37
- },
38
- "engines": {
39
- "node": ">=14.17"
40
- }
41
- }
42
- }
43
- }
@@ -1,55 +0,0 @@
1
- Apache License
2
-
3
- Version 2.0, January 2004
4
-
5
- http://www.apache.org/licenses/
6
-
7
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
8
-
9
- 1. Definitions.
10
-
11
- "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
12
-
13
- "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
14
-
15
- "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
16
-
17
- "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
18
-
19
- "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
20
-
21
- "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
22
-
23
- "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
24
-
25
- "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
26
-
27
- "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
28
-
29
- "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
30
-
31
- 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
32
-
33
- 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
34
-
35
- 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
36
-
37
- You must give any other recipients of the Work or Derivative Works a copy of this License; and
38
-
39
- You must cause any modified files to carry prominent notices stating that You changed the files; and
40
-
41
- You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
42
-
43
- If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
44
-
45
- 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
46
-
47
- 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
48
-
49
- 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
50
-
51
- 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
52
-
53
- 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
54
-
55
- END OF TERMS AND CONDITIONS
@@ -1,50 +0,0 @@
1
-
2
- # TypeScript
3
-
4
- [![GitHub Actions CI](https://github.com/microsoft/TypeScript/workflows/CI/badge.svg)](https://github.com/microsoft/TypeScript/actions?query=workflow%3ACI)
5
- [![npm version](https://badge.fury.io/js/typescript.svg)](https://www.npmjs.com/package/typescript)
6
- [![Downloads](https://img.shields.io/npm/dm/typescript.svg)](https://www.npmjs.com/package/typescript)
7
- [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/microsoft/TypeScript/badge)](https://securityscorecards.dev/viewer/?uri=github.com/microsoft/TypeScript)
8
-
9
-
10
- [TypeScript](https://www.typescriptlang.org/) is a language for application-scale JavaScript. TypeScript adds optional types to JavaScript that support tools for large-scale JavaScript applications for any browser, for any host, on any OS. TypeScript compiles to readable, standards-based JavaScript. Try it out at the [playground](https://www.typescriptlang.org/play/), and stay up to date via [our blog](https://blogs.msdn.microsoft.com/typescript) and [Twitter account](https://twitter.com/typescript).
11
-
12
- Find others who are using TypeScript at [our community page](https://www.typescriptlang.org/community/).
13
-
14
- ## Installing
15
-
16
- For the latest stable version:
17
-
18
- ```bash
19
- npm install -D typescript
20
- ```
21
-
22
- For our nightly builds:
23
-
24
- ```bash
25
- npm install -D typescript@next
26
- ```
27
-
28
- ## Contribute
29
-
30
- There are many ways to [contribute](https://github.com/microsoft/TypeScript/blob/main/CONTRIBUTING.md) to TypeScript.
31
- * [Submit bugs](https://github.com/microsoft/TypeScript/issues) and help us verify fixes as they are checked in.
32
- * Review the [source code changes](https://github.com/microsoft/TypeScript/pulls).
33
- * Engage with other TypeScript users and developers on [StackOverflow](https://stackoverflow.com/questions/tagged/typescript).
34
- * Help each other in the [TypeScript Community Discord](https://discord.gg/typescript).
35
- * Join the [#typescript](https://twitter.com/search?q=%23TypeScript) discussion on Twitter.
36
- * [Contribute bug fixes](https://github.com/microsoft/TypeScript/blob/main/CONTRIBUTING.md).
37
-
38
- This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see
39
- the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com)
40
- with any additional questions or comments.
41
-
42
- ## Documentation
43
-
44
- * [TypeScript in 5 minutes](https://www.typescriptlang.org/docs/handbook/typescript-in-5-minutes.html)
45
- * [Programming handbook](https://www.typescriptlang.org/docs/handbook/intro.html)
46
- * [Homepage](https://www.typescriptlang.org/)
47
-
48
- ## Roadmap
49
-
50
- For details on our planned features and future direction, please refer to our [roadmap](https://github.com/microsoft/TypeScript/wiki/Roadmap).