@liveblocks/zustand 0.18.3 → 0.18.4
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.
- package/{index.d.ts → dist/index.d.ts} +31 -30
- package/{index.js → dist/index.js} +64 -86
- package/{index.mjs → dist/index.mjs} +0 -0
- package/package.json +39 -12
- package/LICENSE +0 -201
|
@@ -2,39 +2,40 @@ import { JsonObject, LsonObject, BaseUserMeta, Json, Room, User, Client } from '
|
|
|
2
2
|
import { StateCreator, SetState, GetState, StoreApi } from 'zustand';
|
|
3
3
|
|
|
4
4
|
declare type ZustandState = Record<string, unknown>;
|
|
5
|
+
declare type LiveblocksContext<TState extends ZustandState, TPresence extends JsonObject, TStorage extends LsonObject, TUserMeta extends BaseUserMeta, TRoomEvent extends Json> = {
|
|
6
|
+
/**
|
|
7
|
+
* Enters a room and starts sync it with zustand state
|
|
8
|
+
* @param roomId The id of the room
|
|
9
|
+
* @param initialState The initial state of the room storage. If a key does not exist if your room storage root, initialState[key] will be used.
|
|
10
|
+
*/
|
|
11
|
+
readonly enterRoom: (roomId: string, initialState: Partial<TState>) => void;
|
|
12
|
+
/**
|
|
13
|
+
* Leaves a room and stops sync it with zustand state.
|
|
14
|
+
* @param roomId The id of the room
|
|
15
|
+
*/
|
|
16
|
+
readonly leaveRoom: (roomId: string) => void;
|
|
17
|
+
/**
|
|
18
|
+
* The room currently synced to your zustand state.
|
|
19
|
+
*/
|
|
20
|
+
readonly room: Room<TPresence, TStorage, TUserMeta, TRoomEvent> | null;
|
|
21
|
+
/**
|
|
22
|
+
* Other users in the room. Empty no room is currently synced
|
|
23
|
+
*/
|
|
24
|
+
readonly others: readonly User<TPresence, TUserMeta>[];
|
|
25
|
+
/**
|
|
26
|
+
* Whether or not the room storage is currently loading
|
|
27
|
+
*/
|
|
28
|
+
readonly isStorageLoading: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Connection state of the room
|
|
31
|
+
*/
|
|
32
|
+
readonly connection: "closed" | "authenticating" | "unavailable" | "failed" | "open" | "connecting";
|
|
33
|
+
};
|
|
5
34
|
declare type LiveblocksState<TState extends ZustandState, TPresence extends JsonObject = JsonObject, TStorage extends LsonObject = LsonObject, TUserMeta extends BaseUserMeta = BaseUserMeta, TRoomEvent extends Json = Json> = TState & {
|
|
6
35
|
/**
|
|
7
36
|
* Liveblocks extra state attached by the middleware
|
|
8
37
|
*/
|
|
9
|
-
readonly liveblocks:
|
|
10
|
-
/**
|
|
11
|
-
* Enters a room and starts sync it with zustand state
|
|
12
|
-
* @param roomId The id of the room
|
|
13
|
-
* @param initialState The initial state of the room storage. If a key does not exist if your room storage root, initialState[key] will be used.
|
|
14
|
-
*/
|
|
15
|
-
readonly enterRoom: (roomId: string, initialState: Partial<TState>) => void;
|
|
16
|
-
/**
|
|
17
|
-
* Leaves a room and stops sync it with zustand state.
|
|
18
|
-
* @param roomId The id of the room
|
|
19
|
-
*/
|
|
20
|
-
readonly leaveRoom: (roomId: string) => void;
|
|
21
|
-
/**
|
|
22
|
-
* The room currently synced to your zustand state.
|
|
23
|
-
*/
|
|
24
|
-
readonly room: Room<TPresence, TStorage, TUserMeta, TRoomEvent> | null;
|
|
25
|
-
/**
|
|
26
|
-
* Other users in the room. Empty no room is currently synced
|
|
27
|
-
*/
|
|
28
|
-
readonly others: readonly User<TPresence, TUserMeta>[];
|
|
29
|
-
/**
|
|
30
|
-
* Whether or not the room storage is currently loading
|
|
31
|
-
*/
|
|
32
|
-
readonly isStorageLoading: boolean;
|
|
33
|
-
/**
|
|
34
|
-
* Connection state of the room
|
|
35
|
-
*/
|
|
36
|
-
readonly connection: "closed" | "authenticating" | "unavailable" | "failed" | "open" | "connecting";
|
|
37
|
-
};
|
|
38
|
+
readonly liveblocks: LiveblocksContext<TState, TPresence, TStorage, TUserMeta, TRoomEvent>;
|
|
38
39
|
};
|
|
39
40
|
declare type Mapping<T> = {
|
|
40
41
|
[K in keyof T]?: boolean;
|
|
@@ -55,4 +56,4 @@ declare type Options<T> = {
|
|
|
55
56
|
};
|
|
56
57
|
declare function middleware<T extends ZustandState, TPresence extends JsonObject = JsonObject, TStorage extends LsonObject = LsonObject, TUserMeta extends BaseUserMeta = BaseUserMeta, TRoomEvent extends Json = Json>(config: StateCreator<T, SetState<T>, GetState<LiveblocksState<T, TPresence, TStorage, TUserMeta, TRoomEvent>>, StoreApi<T>>, options: Options<T>): StateCreator<LiveblocksState<T, TPresence, TStorage, TUserMeta, TRoomEvent>, SetState<LiveblocksState<T, TPresence, TStorage, TUserMeta, TRoomEvent>>, GetState<LiveblocksState<T, TPresence, TStorage, TUserMeta, TRoomEvent>>, StoreApi<LiveblocksState<T, TPresence, TStorage, TUserMeta, TRoomEvent>>>;
|
|
57
58
|
|
|
58
|
-
export { LiveblocksState, Mapping, ZustandState, middleware };
|
|
59
|
+
export { LiveblocksContext, LiveblocksState, Mapping, ZustandState, middleware };
|
|
@@ -23,92 +23,25 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
|
|
26
|
-
var _internal = require('@liveblocks/client/internal');
|
|
27
26
|
|
|
28
|
-
|
|
27
|
+
var _core = require('@liveblocks/core');
|
|
29
28
|
var ERROR_PREFIX = "Invalid @liveblocks/zustand middleware config.";
|
|
30
|
-
function missingClient() {
|
|
31
|
-
return new Error(`${ERROR_PREFIX} client is missing`);
|
|
32
|
-
}
|
|
33
|
-
function missingMapping(mappingType) {
|
|
34
|
-
return new Error(`${ERROR_PREFIX} ${mappingType} is missing.`);
|
|
35
|
-
}
|
|
36
|
-
function mappingShouldBeAnObject(mappingType) {
|
|
37
|
-
return new Error(
|
|
38
|
-
`${ERROR_PREFIX} ${mappingType} should be an object where the values are boolean.`
|
|
39
|
-
);
|
|
40
|
-
}
|
|
41
|
-
function mappingValueShouldBeABoolean(mappingType, key) {
|
|
42
|
-
return new Error(
|
|
43
|
-
`${ERROR_PREFIX} ${mappingType}.${key} value should be a boolean`
|
|
44
|
-
);
|
|
45
|
-
}
|
|
46
|
-
function mappingShouldNotHaveTheSameKeys(key) {
|
|
47
|
-
return new Error(
|
|
48
|
-
`${ERROR_PREFIX} "${key}" is mapped on presenceMapping and storageMapping. A key shouldn't exist on both mapping.`
|
|
49
|
-
);
|
|
50
|
-
}
|
|
51
29
|
function mappingToFunctionIsNotAllowed(key) {
|
|
52
30
|
return new Error(
|
|
53
31
|
`${ERROR_PREFIX} mapping.${key} is invalid. Mapping to a function is not allowed.`
|
|
54
32
|
);
|
|
55
33
|
}
|
|
56
|
-
|
|
57
|
-
// src/index.ts
|
|
58
34
|
function isJson(value) {
|
|
59
35
|
return value === null || typeof value === "string" || typeof value === "number" || typeof value === "boolean" || Array.isArray(value) && value.every(isJson) || typeof value === "object" && Object.values(value).every(isJson);
|
|
60
36
|
}
|
|
61
37
|
function middleware(config, options) {
|
|
62
|
-
|
|
63
|
-
throw missingClient();
|
|
64
|
-
}
|
|
65
|
-
const client = options.client;
|
|
66
|
-
const storageMapping = validateMapping(
|
|
67
|
-
options.storageMapping || {},
|
|
68
|
-
"storageMapping"
|
|
69
|
-
);
|
|
70
|
-
const presenceMapping = validateMapping(
|
|
71
|
-
options.presenceMapping || {},
|
|
72
|
-
"presenceMapping"
|
|
73
|
-
);
|
|
74
|
-
if (process.env.NODE_ENV !== "production") {
|
|
75
|
-
validateNoDuplicateKeys(storageMapping, presenceMapping);
|
|
76
|
-
}
|
|
38
|
+
const { client, presenceMapping, storageMapping } = validateOptions(options);
|
|
77
39
|
return (set, get, api) => {
|
|
78
40
|
const typedSet = set;
|
|
79
41
|
let room = null;
|
|
80
42
|
let isPatching = false;
|
|
81
43
|
let storageRoot = null;
|
|
82
44
|
let unsubscribeCallbacks = [];
|
|
83
|
-
const store = config(
|
|
84
|
-
(args) => {
|
|
85
|
-
const oldState = get();
|
|
86
|
-
set(args);
|
|
87
|
-
const newState = get();
|
|
88
|
-
if (room) {
|
|
89
|
-
isPatching = true;
|
|
90
|
-
updatePresence(
|
|
91
|
-
room,
|
|
92
|
-
oldState,
|
|
93
|
-
newState,
|
|
94
|
-
presenceMapping
|
|
95
|
-
);
|
|
96
|
-
room.batch(() => {
|
|
97
|
-
if (storageRoot) {
|
|
98
|
-
patchLiveblocksStorage(
|
|
99
|
-
storageRoot,
|
|
100
|
-
oldState,
|
|
101
|
-
newState,
|
|
102
|
-
storageMapping
|
|
103
|
-
);
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
isPatching = false;
|
|
107
|
-
}
|
|
108
|
-
},
|
|
109
|
-
get,
|
|
110
|
-
api
|
|
111
|
-
);
|
|
112
45
|
function enterRoom(roomId, initialState) {
|
|
113
46
|
if (storageRoot) {
|
|
114
47
|
return;
|
|
@@ -122,7 +55,7 @@ function middleware(config, options) {
|
|
|
122
55
|
broadcastInitialPresence(room, state, presenceMapping);
|
|
123
56
|
unsubscribeCallbacks.push(
|
|
124
57
|
room.events.others.subscribe(({ others }) => {
|
|
125
|
-
updateZustandLiveblocksState(set, { others
|
|
58
|
+
updateZustandLiveblocksState(set, { others });
|
|
126
59
|
})
|
|
127
60
|
);
|
|
128
61
|
unsubscribeCallbacks.push(
|
|
@@ -148,9 +81,9 @@ function middleware(config, options) {
|
|
|
148
81
|
const liveblocksStatePart = root.get(key);
|
|
149
82
|
if (liveblocksStatePart == null) {
|
|
150
83
|
updates[key] = initialState[key];
|
|
151
|
-
|
|
84
|
+
_core.patchLiveObjectKey.call(void 0, root, key, void 0, initialState[key]);
|
|
152
85
|
} else {
|
|
153
|
-
updates[key] =
|
|
86
|
+
updates[key] = _core.lsonToJson.call(void 0, liveblocksStatePart);
|
|
154
87
|
}
|
|
155
88
|
}
|
|
156
89
|
});
|
|
@@ -186,6 +119,35 @@ function middleware(config, options) {
|
|
|
186
119
|
room: null
|
|
187
120
|
});
|
|
188
121
|
}
|
|
122
|
+
const store = config(
|
|
123
|
+
(args) => {
|
|
124
|
+
const oldState = get();
|
|
125
|
+
set(args);
|
|
126
|
+
const newState = get();
|
|
127
|
+
if (room) {
|
|
128
|
+
isPatching = true;
|
|
129
|
+
updatePresence(
|
|
130
|
+
room,
|
|
131
|
+
oldState,
|
|
132
|
+
newState,
|
|
133
|
+
presenceMapping
|
|
134
|
+
);
|
|
135
|
+
room.batch(() => {
|
|
136
|
+
if (storageRoot) {
|
|
137
|
+
patchLiveblocksStorage(
|
|
138
|
+
storageRoot,
|
|
139
|
+
oldState,
|
|
140
|
+
newState,
|
|
141
|
+
storageMapping
|
|
142
|
+
);
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
isPatching = false;
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
get,
|
|
149
|
+
api
|
|
150
|
+
);
|
|
189
151
|
return __spreadProps(__spreadValues({}, store), {
|
|
190
152
|
liveblocks: {
|
|
191
153
|
enterRoom,
|
|
@@ -203,7 +165,7 @@ function patchState(state, updates, mapping) {
|
|
|
203
165
|
for (const key in mapping) {
|
|
204
166
|
partialState[key] = state[key];
|
|
205
167
|
}
|
|
206
|
-
const patched =
|
|
168
|
+
const patched = _core.legacy_patchImmutableObject.call(void 0, partialState, updates);
|
|
207
169
|
const result = {};
|
|
208
170
|
for (const key in mapping) {
|
|
209
171
|
result[key] = patched[key];
|
|
@@ -245,7 +207,7 @@ function patchLiveblocksStorage(root, oldState, newState, mapping) {
|
|
|
245
207
|
const oldVal = oldState[key];
|
|
246
208
|
const newVal = newState[key];
|
|
247
209
|
if ((oldVal === void 0 || isJson(oldVal)) && (newVal === void 0 || isJson(newVal))) {
|
|
248
|
-
|
|
210
|
+
_core.patchLiveObjectKey.call(void 0, root, key, oldVal, newVal);
|
|
249
211
|
}
|
|
250
212
|
}
|
|
251
213
|
}
|
|
@@ -256,30 +218,46 @@ function isObject(value) {
|
|
|
256
218
|
function validateNoDuplicateKeys(storageMapping, presenceMapping) {
|
|
257
219
|
for (const key in storageMapping) {
|
|
258
220
|
if (presenceMapping[key] !== void 0) {
|
|
259
|
-
throw
|
|
221
|
+
throw new Error(
|
|
222
|
+
`${ERROR_PREFIX} "${key}" is mapped on both presenceMapping and storageMapping. A key shouldn't exist on both mapping.`
|
|
223
|
+
);
|
|
260
224
|
}
|
|
261
225
|
}
|
|
262
226
|
}
|
|
263
227
|
function validateMapping(mapping, mappingType) {
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
if (!isObject(mapping)) {
|
|
269
|
-
throw mappingShouldBeAnObject(mappingType);
|
|
270
|
-
}
|
|
271
|
-
}
|
|
228
|
+
_core.errorIf.call(void 0,
|
|
229
|
+
!isObject(mapping),
|
|
230
|
+
`${ERROR_PREFIX} ${mappingType} should be an object where the values are boolean.`
|
|
231
|
+
);
|
|
272
232
|
const result = {};
|
|
273
233
|
for (const key in mapping) {
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
234
|
+
_core.errorIf.call(void 0,
|
|
235
|
+
typeof mapping[key] !== "boolean",
|
|
236
|
+
`${ERROR_PREFIX} ${mappingType}.${key} value should be a boolean`
|
|
237
|
+
);
|
|
277
238
|
if (mapping[key] === true) {
|
|
278
239
|
result[key] = true;
|
|
279
240
|
}
|
|
280
241
|
}
|
|
281
242
|
return result;
|
|
282
243
|
}
|
|
244
|
+
function validateOptions(options) {
|
|
245
|
+
var _a, _b;
|
|
246
|
+
const client = options.client;
|
|
247
|
+
_core.errorIf.call(void 0, !client, `${ERROR_PREFIX} client is missing`);
|
|
248
|
+
const storageMapping = validateMapping(
|
|
249
|
+
(_a = options.storageMapping) != null ? _a : {},
|
|
250
|
+
"storageMapping"
|
|
251
|
+
);
|
|
252
|
+
const presenceMapping = validateMapping(
|
|
253
|
+
(_b = options.presenceMapping) != null ? _b : {},
|
|
254
|
+
"presenceMapping"
|
|
255
|
+
);
|
|
256
|
+
if (process.env.NODE_ENV !== "production") {
|
|
257
|
+
validateNoDuplicateKeys(storageMapping, presenceMapping);
|
|
258
|
+
}
|
|
259
|
+
return { client, storageMapping, presenceMapping };
|
|
260
|
+
}
|
|
283
261
|
|
|
284
262
|
|
|
285
263
|
exports.middleware = middleware;
|
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@liveblocks/zustand",
|
|
3
|
-
"version": "0.18.
|
|
3
|
+
"version": "0.18.4",
|
|
4
4
|
"description": "A middleware to integrate Liveblocks into Zustand stores.",
|
|
5
|
-
"main": "./index.js",
|
|
6
|
-
"module": "./index.mjs",
|
|
7
|
-
"types": "./index.d.ts",
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
"types": "./index.d.ts"
|
|
13
|
-
}
|
|
14
|
-
},
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"module": "./dist/index.mjs",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist/**",
|
|
10
|
+
"README.md"
|
|
11
|
+
],
|
|
15
12
|
"keywords": [
|
|
16
13
|
"zustand",
|
|
17
14
|
"react",
|
|
@@ -20,15 +17,45 @@
|
|
|
20
17
|
"live-cursors",
|
|
21
18
|
"collaborative"
|
|
22
19
|
],
|
|
20
|
+
"scripts": {
|
|
21
|
+
"build": "tsup && ../../scripts/build.sh",
|
|
22
|
+
"format": "eslint --fix src/ && prettier --write src/",
|
|
23
|
+
"lint": "eslint src/",
|
|
24
|
+
"test": "jest --watch --silent --verbose",
|
|
25
|
+
"test-ci": "jest --silent --verbose",
|
|
26
|
+
"dtslint": "dtslint --localTs node_modules/typescript/lib --expectOnly types"
|
|
27
|
+
},
|
|
23
28
|
"license": "Apache-2.0",
|
|
24
29
|
"repository": {
|
|
25
30
|
"type": "git",
|
|
26
31
|
"url": "https://github.com/liveblocks/liveblocks.git",
|
|
27
32
|
"directory": "packages/liveblocks-zustand"
|
|
28
33
|
},
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"@liveblocks/core": "0.18.4",
|
|
36
|
+
"@liveblocks/client": "0.18.4"
|
|
37
|
+
},
|
|
29
38
|
"peerDependencies": {
|
|
30
|
-
"@liveblocks/client": "0.18.3",
|
|
31
39
|
"zustand": "^3"
|
|
32
40
|
},
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"@definitelytyped/dtslint": "^0.0.103",
|
|
43
|
+
"@testing-library/jest-dom": "^5.16.5",
|
|
44
|
+
"@types/jest": "^29.1.2",
|
|
45
|
+
"@typescript-eslint/eslint-plugin": "^5.26.0",
|
|
46
|
+
"@typescript-eslint/parser": "^5.26.0",
|
|
47
|
+
"eslint": "^8.12.0",
|
|
48
|
+
"eslint-plugin-import": "^2.26.0",
|
|
49
|
+
"eslint-plugin-simple-import-sort": "^7.0.0",
|
|
50
|
+
"jest": "^29.1.2",
|
|
51
|
+
"jest-environment-jsdom": "^29.1.2",
|
|
52
|
+
"msw": "^0.36.4",
|
|
53
|
+
"prettier": "^2.7.1",
|
|
54
|
+
"ts-jest": "^29.0.3",
|
|
55
|
+
"tsup": "^6.2.2",
|
|
56
|
+
"typescript": "^4.7.2",
|
|
57
|
+
"whatwg-fetch": "^3.6.2",
|
|
58
|
+
"zustand": "^3.6.9"
|
|
59
|
+
},
|
|
33
60
|
"sideEffects": false
|
|
34
61
|
}
|
package/LICENSE
DELETED
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
Apache License
|
|
2
|
-
Version 2.0, January 2004
|
|
3
|
-
http://www.apache.org/licenses/
|
|
4
|
-
|
|
5
|
-
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
-
|
|
7
|
-
1. Definitions.
|
|
8
|
-
|
|
9
|
-
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
-
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
-
|
|
12
|
-
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
-
the copyright owner that is granting the License.
|
|
14
|
-
|
|
15
|
-
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
-
other entities that control, are controlled by, or are under common
|
|
17
|
-
control with that entity. For the purposes of this definition,
|
|
18
|
-
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
-
direction or management of such entity, whether by contract or
|
|
20
|
-
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
-
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
-
|
|
23
|
-
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
-
exercising permissions granted by this License.
|
|
25
|
-
|
|
26
|
-
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
-
including but not limited to software source code, documentation
|
|
28
|
-
source, and configuration files.
|
|
29
|
-
|
|
30
|
-
"Object" form shall mean any form resulting from mechanical
|
|
31
|
-
transformation or translation of a Source form, including but
|
|
32
|
-
not limited to compiled object code, generated documentation,
|
|
33
|
-
and conversions to other media types.
|
|
34
|
-
|
|
35
|
-
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
-
Object form, made available under the License, as indicated by a
|
|
37
|
-
copyright notice that is included in or attached to the work
|
|
38
|
-
(an example is provided in the Appendix below).
|
|
39
|
-
|
|
40
|
-
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
-
form, that is based on (or derived from) the Work and for which the
|
|
42
|
-
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
-
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
-
of this License, Derivative Works shall not include works that remain
|
|
45
|
-
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
-
the Work and Derivative Works thereof.
|
|
47
|
-
|
|
48
|
-
"Contribution" shall mean any work of authorship, including
|
|
49
|
-
the original version of the Work and any modifications or additions
|
|
50
|
-
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
-
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
-
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
-
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
-
means any form of electronic, verbal, or written communication sent
|
|
55
|
-
to the Licensor or its representatives, including but not limited to
|
|
56
|
-
communication on electronic mailing lists, source code control systems,
|
|
57
|
-
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
-
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
-
excluding communication that is conspicuously marked or otherwise
|
|
60
|
-
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
-
|
|
62
|
-
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
-
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
-
subsequently incorporated within the Work.
|
|
65
|
-
|
|
66
|
-
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
-
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
-
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
-
Work and such Derivative Works in Source or Object form.
|
|
72
|
-
|
|
73
|
-
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
-
(except as stated in this section) patent license to make, have made,
|
|
77
|
-
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
-
where such license applies only to those patent claims licensable
|
|
79
|
-
by such Contributor that are necessarily infringed by their
|
|
80
|
-
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
-
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
-
institute patent litigation against any entity (including a
|
|
83
|
-
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
-
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
-
or contributory patent infringement, then any patent licenses
|
|
86
|
-
granted to You under this License for that Work shall terminate
|
|
87
|
-
as of the date such litigation is filed.
|
|
88
|
-
|
|
89
|
-
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
-
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
-
modifications, and in Source or Object form, provided that You
|
|
92
|
-
meet the following conditions:
|
|
93
|
-
|
|
94
|
-
(a) You must give any other recipients of the Work or
|
|
95
|
-
Derivative Works a copy of this License; and
|
|
96
|
-
|
|
97
|
-
(b) You must cause any modified files to carry prominent notices
|
|
98
|
-
stating that You changed the files; and
|
|
99
|
-
|
|
100
|
-
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
-
that You distribute, all copyright, patent, trademark, and
|
|
102
|
-
attribution notices from the Source form of the Work,
|
|
103
|
-
excluding those notices that do not pertain to any part of
|
|
104
|
-
the Derivative Works; and
|
|
105
|
-
|
|
106
|
-
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
-
distribution, then any Derivative Works that You distribute must
|
|
108
|
-
include a readable copy of the attribution notices contained
|
|
109
|
-
within such NOTICE file, excluding those notices that do not
|
|
110
|
-
pertain to any part of the Derivative Works, in at least one
|
|
111
|
-
of the following places: within a NOTICE text file distributed
|
|
112
|
-
as part of the Derivative Works; within the Source form or
|
|
113
|
-
documentation, if provided along with the Derivative Works; or,
|
|
114
|
-
within a display generated by the Derivative Works, if and
|
|
115
|
-
wherever such third-party notices normally appear. The contents
|
|
116
|
-
of the NOTICE file are for informational purposes only and
|
|
117
|
-
do not modify the License. You may add Your own attribution
|
|
118
|
-
notices within Derivative Works that You distribute, alongside
|
|
119
|
-
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
-
that such additional attribution notices cannot be construed
|
|
121
|
-
as modifying the License.
|
|
122
|
-
|
|
123
|
-
You may add Your own copyright statement to Your modifications and
|
|
124
|
-
may provide additional or different license terms and conditions
|
|
125
|
-
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
-
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
-
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
-
the conditions stated in this License.
|
|
129
|
-
|
|
130
|
-
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
-
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
-
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
-
this License, without any additional terms or conditions.
|
|
134
|
-
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
-
the terms of any separate license agreement you may have executed
|
|
136
|
-
with Licensor regarding such Contributions.
|
|
137
|
-
|
|
138
|
-
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
-
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
-
except as required for reasonable and customary use in describing the
|
|
141
|
-
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
-
|
|
143
|
-
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
-
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
-
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
-
implied, including, without limitation, any warranties or conditions
|
|
148
|
-
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
-
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
-
appropriateness of using or redistributing the Work and assume any
|
|
151
|
-
risks associated with Your exercise of permissions under this License.
|
|
152
|
-
|
|
153
|
-
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
-
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
-
unless required by applicable law (such as deliberate and grossly
|
|
156
|
-
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
-
liable to You for damages, including any direct, indirect, special,
|
|
158
|
-
incidental, or consequential damages of any character arising as a
|
|
159
|
-
result of this License or out of the use or inability to use the
|
|
160
|
-
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
-
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
-
other commercial damages or losses), even if such Contributor
|
|
163
|
-
has been advised of the possibility of such damages.
|
|
164
|
-
|
|
165
|
-
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
-
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
-
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
-
or other liability obligations and/or rights consistent with this
|
|
169
|
-
License. However, in accepting such obligations, You may act only
|
|
170
|
-
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
-
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
-
defend, and hold each Contributor harmless for any liability
|
|
173
|
-
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
-
of your accepting any such warranty or additional liability.
|
|
175
|
-
|
|
176
|
-
END OF TERMS AND CONDITIONS
|
|
177
|
-
|
|
178
|
-
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
-
|
|
180
|
-
To apply the Apache License to your work, attach the following
|
|
181
|
-
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
-
replaced with your own identifying information. (Don't include
|
|
183
|
-
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
-
comment syntax for the file format. We also recommend that a
|
|
185
|
-
file or class name and description of purpose be included on the
|
|
186
|
-
same "printed page" as the copyright notice for easier
|
|
187
|
-
identification within third-party archives.
|
|
188
|
-
|
|
189
|
-
Copyright 2021 LIVEBLOCKS PTY LTD
|
|
190
|
-
|
|
191
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
-
you may not use this file except in compliance with the License.
|
|
193
|
-
You may obtain a copy of the License at
|
|
194
|
-
|
|
195
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
-
|
|
197
|
-
Unless required by applicable law or agreed to in writing, software
|
|
198
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
-
See the License for the specific language governing permissions and
|
|
201
|
-
limitations under the License.
|