@contember/react-client 1.1.0-rc.5 → 1.1.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.
- package/dist/development/ContemberClient.js +23 -42
- package/dist/development/ContemberClient.js.map +1 -1
- package/dist/development/apiRequest/apiRequestReducer.js.map +1 -1
- package/dist/development/components/RichTextRenderer/ElementRenderer.js +4 -13
- package/dist/development/components/RichTextRenderer/ElementRenderer.js.map +1 -1
- package/dist/development/components/RichTextRenderer/LeafRenderer.js +12 -11
- package/dist/development/components/RichTextRenderer/LeafRenderer.js.map +1 -1
- package/dist/development/components/RichTextRenderer/RenderElementFallback.js +65 -113
- package/dist/development/components/RichTextRenderer/RenderElementFallback.js.map +1 -1
- package/dist/development/components/RichTextRenderer/RenderLeafFallback.js +26 -38
- package/dist/development/components/RichTextRenderer/RenderLeafFallback.js.map +1 -1
- package/dist/development/components/RichTextRenderer/RichTextRenderer.js +54 -34
- package/dist/development/components/RichTextRenderer/RichTextRenderer.js.map +1 -1
- package/dist/development/components/RichTextRenderer/renderChildren.js +22 -28
- package/dist/development/components/RichTextRenderer/renderChildren.js.map +1 -1
- package/dist/development/upload/fileUploadReducer.js +31 -45
- package/dist/development/upload/fileUploadReducer.js.map +1 -1
- package/dist/development/upload/toFileId.js.map +1 -1
- package/dist/development/upload/useFileUpload.js +24 -64
- package/dist/development/upload/useFileUpload.js.map +1 -1
- package/dist/production/ContemberClient.js +2 -20
- package/dist/production/ContemberClient.js.map +1 -1
- package/dist/production/apiRequest/apiRequestReducer.js.map +1 -1
- package/dist/production/components/RichTextRenderer/ElementRenderer.js +3 -11
- package/dist/production/components/RichTextRenderer/ElementRenderer.js.map +1 -1
- package/dist/production/components/RichTextRenderer/LeafRenderer.js +11 -9
- package/dist/production/components/RichTextRenderer/LeafRenderer.js.map +1 -1
- package/dist/production/components/RichTextRenderer/RenderElementFallback.js +34 -89
- package/dist/production/components/RichTextRenderer/RenderElementFallback.js.map +1 -1
- package/dist/production/components/RichTextRenderer/RenderLeafFallback.js +13 -28
- package/dist/production/components/RichTextRenderer/RenderLeafFallback.js.map +1 -1
- package/dist/production/components/RichTextRenderer/RichTextRenderer.js +41 -31
- package/dist/production/components/RichTextRenderer/RichTextRenderer.js.map +1 -1
- package/dist/production/components/RichTextRenderer/renderChildren.js +10 -19
- package/dist/production/components/RichTextRenderer/renderChildren.js.map +1 -1
- package/dist/production/upload/fileUploadReducer.js +31 -45
- package/dist/production/upload/fileUploadReducer.js.map +1 -1
- package/dist/production/upload/toFileId.js.map +1 -1
- package/dist/production/upload/useFileUpload.js +24 -64
- package/dist/production/upload/useFileUpload.js.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/dist/types/upload/FileUploadAction.d.ts +0 -2
- package/dist/types/upload/FileUploadAction.d.ts.map +1 -1
- package/dist/types/upload/FileUploadMultiTemporalState.d.ts +1 -4
- package/dist/types/upload/FileUploadMultiTemporalState.d.ts.map +1 -1
- package/dist/types/upload/fileUploadReducer.d.ts.map +1 -1
- package/dist/types/upload/toFileId.d.ts.map +1 -1
- package/dist/types/upload/useFileUpload.d.ts +1 -2
- package/dist/types/upload/useFileUpload.d.ts.map +1 -1
- package/package.json +8 -9
- package/src/upload/FileUploadAction.ts +0 -3
- package/src/upload/FileUploadMultiTemporalState.ts +1 -4
- package/src/upload/fileUploadReducer.ts +33 -53
- package/src/upload/toFileId.ts +1 -1
- package/src/upload/useFileUpload.ts +23 -67
- package/LICENSE +0 -186
|
@@ -5,66 +5,42 @@ import type { FileUploadAction } from './FileUploadAction'
|
|
|
5
5
|
import type { FileUploadMultiTemporalState } from './FileUploadMultiTemporalState'
|
|
6
6
|
import { toFileId } from './toFileId'
|
|
7
7
|
|
|
8
|
-
export const initializeFileUploadState = <Result = unknown, Metadata = undefined>(): FileUploadMultiTemporalState<
|
|
9
|
-
Result,
|
|
10
|
-
Metadata
|
|
11
|
-
> => ({
|
|
12
|
-
lastUpdateTime: 0,
|
|
8
|
+
export const initializeFileUploadState = <Result = unknown, Metadata = undefined>(): FileUploadMultiTemporalState<Result, Metadata> => ({
|
|
13
9
|
fileIdByFile: new WeakMap<File, FileId>(),
|
|
14
|
-
|
|
15
|
-
publicState: new Map(),
|
|
16
|
-
isLiveStateDirty: false,
|
|
10
|
+
state: new Map(),
|
|
17
11
|
})
|
|
18
12
|
|
|
19
13
|
export const fileUploadReducer = <Result = unknown, Metadata = undefined>(
|
|
20
14
|
previousState: FileUploadMultiTemporalState<Result, Metadata>,
|
|
21
15
|
action: FileUploadAction<Result, Metadata>,
|
|
22
16
|
): FileUploadMultiTemporalState<Result, Metadata> => {
|
|
23
|
-
|
|
24
|
-
publicState: previousState.liveState,
|
|
25
|
-
fileIdByFile: previousState.fileIdByFile,
|
|
26
|
-
lastUpdateTime: previousState.lastUpdateTime,
|
|
27
|
-
isLiveStateDirty: false,
|
|
17
|
+
let newState: undefined | FileUploadMultiTemporalState<Result, Metadata>['state'] = undefined
|
|
28
18
|
|
|
29
|
-
// Immediately make the live state referentially unequal so that this doesn't have to happen during each action
|
|
30
|
-
// several times between two publishes.
|
|
31
|
-
liveState: new Map(previousState.liveState),
|
|
32
|
-
})
|
|
33
|
-
const getNewDirtyState = (): FileUploadMultiTemporalState<Result, Metadata> => ({
|
|
34
|
-
fileIdByFile: previousState.fileIdByFile,
|
|
35
|
-
liveState: previousState.liveState,
|
|
36
|
-
publicState: previousState.publicState,
|
|
37
|
-
isLiveStateDirty: true,
|
|
38
|
-
lastUpdateTime: Date.now(),
|
|
39
|
-
})
|
|
40
19
|
switch (action.type) {
|
|
41
|
-
case 'publishNewestState': {
|
|
42
|
-
return publishNewState()
|
|
43
|
-
}
|
|
44
20
|
case 'initialize': {
|
|
45
21
|
for (const [fileId, metadata] of action.files) {
|
|
46
22
|
// Deliberately allowing starting a new upload with the same id
|
|
47
|
-
|
|
48
|
-
previousState.liveState.set(fileId, {
|
|
23
|
+
(newState ??= new Map(previousState.state)).set(fileId, {
|
|
49
24
|
readyState: 'initializing',
|
|
50
25
|
abortController: metadata.abortController,
|
|
51
26
|
previewUrl: metadata.previewUrl,
|
|
52
27
|
file: metadata.file,
|
|
53
28
|
})
|
|
29
|
+
// Deliberately mutating
|
|
54
30
|
previousState.fileIdByFile.set(metadata.file, fileId)
|
|
55
31
|
}
|
|
56
|
-
|
|
32
|
+
break
|
|
57
33
|
}
|
|
58
34
|
case 'startUploading': {
|
|
59
35
|
for (const [fileOrId, metadata] of action.files) {
|
|
60
36
|
const fileId = toFileId(previousState, fileOrId)
|
|
61
|
-
const fileState = previousState.
|
|
37
|
+
const fileState = (newState ?? previousState.state).get(fileId)
|
|
62
38
|
|
|
63
39
|
if (fileState === undefined || fileState.readyState !== 'initializing') {
|
|
64
40
|
continue
|
|
65
41
|
}
|
|
66
42
|
|
|
67
|
-
previousState.
|
|
43
|
+
(newState ??= new Map(previousState.state)).set(fileId, {
|
|
68
44
|
readyState: 'uploading',
|
|
69
45
|
abortController: fileState.abortController,
|
|
70
46
|
file: fileState.file,
|
|
@@ -74,16 +50,16 @@ export const fileUploadReducer = <Result = unknown, Metadata = undefined>(
|
|
|
74
50
|
uploader: metadata.uploader,
|
|
75
51
|
})
|
|
76
52
|
}
|
|
77
|
-
|
|
53
|
+
break
|
|
78
54
|
}
|
|
79
55
|
case 'finishSuccessfully': {
|
|
80
56
|
for (const [fileOrId, result] of action.result) {
|
|
81
57
|
const fileId = toFileId(previousState, fileOrId)
|
|
82
|
-
const previousFileState = previousState.
|
|
58
|
+
const previousFileState = (newState ?? previousState.state).get(fileId)
|
|
83
59
|
if (previousFileState === undefined || previousFileState.readyState !== 'uploading') {
|
|
84
60
|
continue
|
|
85
61
|
}
|
|
86
|
-
previousState.
|
|
62
|
+
(newState ??= new Map(previousState.state)).set(fileId, {
|
|
87
63
|
readyState: 'success',
|
|
88
64
|
file: previousFileState.file,
|
|
89
65
|
metadata: previousFileState.metadata,
|
|
@@ -92,8 +68,7 @@ export const fileUploadReducer = <Result = unknown, Metadata = undefined>(
|
|
|
92
68
|
uploader: previousFileState.uploader,
|
|
93
69
|
})
|
|
94
70
|
}
|
|
95
|
-
|
|
96
|
-
return getNewDirtyState()
|
|
71
|
+
break
|
|
97
72
|
}
|
|
98
73
|
case 'finishWithError': {
|
|
99
74
|
for (const errorSpec of action.error) {
|
|
@@ -120,7 +95,7 @@ export const fileUploadReducer = <Result = unknown, Metadata = undefined>(
|
|
|
120
95
|
}
|
|
121
96
|
|
|
122
97
|
const fileId = toFileId(previousState, fileOrId)
|
|
123
|
-
const previousFileState = previousState.
|
|
98
|
+
const previousFileState = (newState ?? previousState.state).get(fileId)
|
|
124
99
|
if (
|
|
125
100
|
previousFileState === undefined ||
|
|
126
101
|
(previousFileState.readyState !== 'initializing' && previousFileState.readyState !== 'uploading')
|
|
@@ -129,7 +104,7 @@ export const fileUploadReducer = <Result = unknown, Metadata = undefined>(
|
|
|
129
104
|
}
|
|
130
105
|
const uploader = previousFileState.readyState === 'uploading' ? previousFileState.uploader : undefined
|
|
131
106
|
const metadata = previousFileState.readyState === 'uploading' ? previousFileState.metadata : undefined
|
|
132
|
-
previousState.
|
|
107
|
+
;(newState ??= new Map(previousState.state)).set(fileId, {
|
|
133
108
|
readyState: 'error',
|
|
134
109
|
errors: errors.length ? errors : undefined,
|
|
135
110
|
rawError,
|
|
@@ -139,47 +114,52 @@ export const fileUploadReducer = <Result = unknown, Metadata = undefined>(
|
|
|
139
114
|
uploader,
|
|
140
115
|
})
|
|
141
116
|
}
|
|
142
|
-
|
|
117
|
+
break
|
|
143
118
|
}
|
|
144
119
|
case 'purge': {
|
|
145
|
-
let atLeastOnePurged = false
|
|
146
120
|
for (const fileOrId of action.files) {
|
|
147
121
|
const fileId = toFileId(previousState, fileOrId)
|
|
148
|
-
const fileState = previousState.
|
|
122
|
+
const fileState = (newState ?? previousState.state).get(fileId)
|
|
149
123
|
|
|
150
124
|
if (fileState === undefined) {
|
|
151
125
|
continue
|
|
152
126
|
}
|
|
153
|
-
|
|
127
|
+
URL.revokeObjectURL(fileState.previewUrl)
|
|
154
128
|
if (fileState.readyState === 'initializing' || fileState.readyState === 'uploading') {
|
|
155
129
|
fileState.abortController.abort() // This is a bit naughty… We shouldn't do this from here.
|
|
156
130
|
}
|
|
157
|
-
previousState.
|
|
158
|
-
}
|
|
159
|
-
if (atLeastOnePurged) {
|
|
160
|
-
return getNewDirtyState()
|
|
131
|
+
(newState ??= new Map(previousState.state)).delete(fileId)
|
|
161
132
|
}
|
|
162
|
-
|
|
133
|
+
break
|
|
163
134
|
}
|
|
164
135
|
case 'updateUploadProgress': {
|
|
165
136
|
for (const [fileOrId, { progress }] of action.progress) {
|
|
166
137
|
const fileId = toFileId(previousState, fileOrId)
|
|
167
|
-
const previousFileState = previousState.
|
|
138
|
+
const previousFileState = (newState ?? previousState.state).get(fileId)
|
|
168
139
|
if (progress === undefined || previousFileState === undefined || previousFileState.readyState !== 'uploading') {
|
|
169
140
|
continue
|
|
170
141
|
}
|
|
171
|
-
|
|
142
|
+
const roundedProgress = Math.floor(progress) // throttling
|
|
143
|
+
if (roundedProgress === previousFileState.progress) {
|
|
144
|
+
continue
|
|
145
|
+
}
|
|
146
|
+
(newState ??= new Map(previousState.state)).set(fileId, {
|
|
172
147
|
readyState: 'uploading',
|
|
173
148
|
file: previousFileState.file,
|
|
174
149
|
uploader: previousFileState.uploader,
|
|
175
150
|
abortController: previousFileState.abortController,
|
|
176
151
|
previewUrl: previousFileState.previewUrl,
|
|
177
152
|
metadata: previousFileState.metadata,
|
|
178
|
-
progress,
|
|
153
|
+
progress: roundedProgress,
|
|
179
154
|
})
|
|
180
155
|
}
|
|
181
|
-
|
|
156
|
+
break
|
|
182
157
|
}
|
|
158
|
+
default:
|
|
159
|
+
assertNever(action)
|
|
160
|
+
}
|
|
161
|
+
if (newState === undefined) {
|
|
162
|
+
return previousState
|
|
183
163
|
}
|
|
184
|
-
|
|
164
|
+
return { ...previousState, state: newState }
|
|
185
165
|
}
|
package/src/upload/toFileId.ts
CHANGED
|
@@ -4,7 +4,7 @@ import type { FileUploadMultiTemporalState } from './FileUploadMultiTemporalStat
|
|
|
4
4
|
export const toFileId = <Result = unknown, Metadata = undefined>(
|
|
5
5
|
state: FileUploadMultiTemporalState<Result, Metadata>,
|
|
6
6
|
fileOrId: File | FileId,
|
|
7
|
-
) => {
|
|
7
|
+
): FileId => {
|
|
8
8
|
if (fileOrId instanceof File) {
|
|
9
9
|
return state.fileIdByFile.get(fileOrId)! // Should we throw instead of the yolo "!"?
|
|
10
10
|
}
|
|
@@ -16,7 +16,6 @@ import type {
|
|
|
16
16
|
} from './FileUploadOperations'
|
|
17
17
|
import { fileUploadReducer, initializeFileUploadState } from './fileUploadReducer'
|
|
18
18
|
import type { FileWithMetadata } from './FileWithMetadata'
|
|
19
|
-
import { toFileId } from './toFileId'
|
|
20
19
|
|
|
21
20
|
export type FileUpload<Result = unknown, Metadata = undefined> = [
|
|
22
21
|
FileUploadCompoundState<Result, Metadata>,
|
|
@@ -24,32 +23,20 @@ export type FileUpload<Result = unknown, Metadata = undefined> = [
|
|
|
24
23
|
]
|
|
25
24
|
|
|
26
25
|
export interface FileUploadOptions {
|
|
27
|
-
maxUpdateFrequency?: number // This does NOT apply to all kinds of updates.
|
|
28
26
|
}
|
|
29
27
|
|
|
30
|
-
export const useFileUpload = <Result = unknown, Metadata = undefined>(
|
|
31
|
-
options?: FileUploadOptions,
|
|
32
|
-
): FileUpload<Result, Metadata> => {
|
|
33
|
-
const maxUpdateFrequency = options?.maxUpdateFrequency ?? 100
|
|
34
|
-
|
|
28
|
+
export const useFileUpload = <Result = unknown, Metadata = undefined>({}: FileUploadOptions = {}): FileUpload<Result, Metadata> => {
|
|
35
29
|
const contentApiClient = useCurrentContentGraphQlClient()
|
|
36
30
|
|
|
37
|
-
const updateTimeoutRef = useRef<number | undefined>(undefined)
|
|
38
|
-
const isFirstRenderRef = useRef(true)
|
|
39
31
|
const fileIdSeedRef = useRef(1)
|
|
40
32
|
|
|
41
|
-
const [
|
|
33
|
+
const [internalState, dispatch] = useReducer<
|
|
42
34
|
Reducer<FileUploadMultiTemporalState<Result, Metadata>, FileUploadAction<Result, Metadata>>,
|
|
43
35
|
undefined
|
|
44
36
|
>(fileUploadReducer, undefined, initializeFileUploadState)
|
|
45
|
-
const multiTemporalStateRef = useRef(multiTemporalState)
|
|
46
37
|
|
|
47
38
|
const defaultUploader = useMemo(() => new S3FileUploader(), [])
|
|
48
39
|
|
|
49
|
-
useEffect(() => {
|
|
50
|
-
multiTemporalStateRef.current = multiTemporalState
|
|
51
|
-
})
|
|
52
|
-
|
|
53
40
|
const purgeUpload = useCallback<PurgeUpload>(files => {
|
|
54
41
|
dispatch({
|
|
55
42
|
type: 'purge',
|
|
@@ -62,6 +49,11 @@ export const useFileUpload = <Result = unknown, Metadata = undefined>(
|
|
|
62
49
|
error,
|
|
63
50
|
})
|
|
64
51
|
}, [])
|
|
52
|
+
|
|
53
|
+
const previewUrls = useRef(new Set<string>())
|
|
54
|
+
const fileIds = useRef(new WeakMap<File, FileId>())
|
|
55
|
+
const filesWithMetadataById = useRef(new Map<FileId, WeakRef<FileWithMetadata>>)
|
|
56
|
+
|
|
65
57
|
const initializeUpload = useCallback<InitializeUpload>(
|
|
66
58
|
files => {
|
|
67
59
|
const newFileIds = new Set<FileId>()
|
|
@@ -85,14 +77,20 @@ export const useFileUpload = <Result = unknown, Metadata = undefined>(
|
|
|
85
77
|
purgeUpload([fileId])
|
|
86
78
|
})
|
|
87
79
|
|
|
88
|
-
|
|
89
|
-
|
|
80
|
+
const previewUrl = URL.createObjectURL(file)
|
|
81
|
+
const fileWithMetadata: FileWithMetadata = {
|
|
82
|
+
previewUrl: previewUrl,
|
|
90
83
|
abortController,
|
|
91
84
|
file,
|
|
92
85
|
fileId,
|
|
93
|
-
}
|
|
86
|
+
}
|
|
87
|
+
fileWithMetadataByFileConfig.set(fileId, fileWithMetadata)
|
|
94
88
|
|
|
95
89
|
newFileIds.add(fileId)
|
|
90
|
+
|
|
91
|
+
previewUrls.current.add(previewUrl)
|
|
92
|
+
fileIds.current.set(file, fileId)
|
|
93
|
+
filesWithMetadataById.current.set(fileId, new WeakRef(fileWithMetadata))
|
|
96
94
|
}
|
|
97
95
|
if (fileWithMetadataByFileConfig.size === 0) {
|
|
98
96
|
return fileWithMetadataByFileConfig
|
|
@@ -119,8 +117,6 @@ export const useFileUpload = <Result = unknown, Metadata = undefined>(
|
|
|
119
117
|
const filesById = new Map<FileId, FileUploadMetadata<Metadata>>()
|
|
120
118
|
const groupedByUploader: Map<FileUploader, Map<File, UploadedFileMetadata>> = new Map()
|
|
121
119
|
|
|
122
|
-
const currentState = multiTemporalStateRef.current
|
|
123
|
-
|
|
124
120
|
for (const fileOrIdMaybeWithOptions of files) {
|
|
125
121
|
let fileOrId: File | FileId
|
|
126
122
|
let options: StartUploadFileOptions<Metadata>
|
|
@@ -134,16 +130,17 @@ export const useFileUpload = <Result = unknown, Metadata = undefined>(
|
|
|
134
130
|
}
|
|
135
131
|
const { uploader = defaultUploader, metadata } = options
|
|
136
132
|
|
|
137
|
-
const fileId =
|
|
138
|
-
const fileState =
|
|
133
|
+
const fileId = fileOrId instanceof File ? fileIds.current.get(fileOrId) : fileOrId
|
|
134
|
+
const fileState = fileId ? filesWithMetadataById.current.get(fileId)?.deref() : undefined
|
|
139
135
|
|
|
140
|
-
if (
|
|
136
|
+
if (fileId === undefined || fileState === undefined) {
|
|
141
137
|
throw new Error(
|
|
142
138
|
`Trying to startUpload a file that hasn't been previously initialized. ` +
|
|
143
139
|
`This will be possible in future, but isn't yet.`,
|
|
144
140
|
)
|
|
145
141
|
}
|
|
146
142
|
|
|
143
|
+
|
|
147
144
|
filesById.set(fileId, {
|
|
148
145
|
uploader,
|
|
149
146
|
metadata,
|
|
@@ -207,56 +204,15 @@ export const useFileUpload = <Result = unknown, Metadata = undefined>(
|
|
|
207
204
|
[failUpload, initializeUpload, purgeUpload, startUpload],
|
|
208
205
|
)
|
|
209
206
|
|
|
210
|
-
useEffect(() => {
|
|
211
|
-
if (isFirstRenderRef.current) {
|
|
212
|
-
return
|
|
213
|
-
}
|
|
214
|
-
if (multiTemporalState.isLiveStateDirty) {
|
|
215
|
-
const now = Date.now()
|
|
216
|
-
const timeDelta = Math.max(now - multiTemporalState.lastUpdateTime, 0) // The max is just a sanity check
|
|
217
|
-
if (timeDelta > maxUpdateFrequency) {
|
|
218
|
-
if (updateTimeoutRef.current !== undefined) {
|
|
219
|
-
clearTimeout(updateTimeoutRef.current)
|
|
220
|
-
}
|
|
221
|
-
dispatch({
|
|
222
|
-
type: 'publishNewestState',
|
|
223
|
-
})
|
|
224
|
-
} else {
|
|
225
|
-
if (updateTimeoutRef.current !== undefined) {
|
|
226
|
-
return
|
|
227
|
-
}
|
|
228
|
-
updateTimeoutRef.current = window.setTimeout(() => {
|
|
229
|
-
dispatch({
|
|
230
|
-
type: 'publishNewestState',
|
|
231
|
-
})
|
|
232
|
-
updateTimeoutRef.current = undefined
|
|
233
|
-
}, maxUpdateFrequency - timeDelta)
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
}, [
|
|
237
|
-
multiTemporalState.isLiveStateDirty,
|
|
238
|
-
multiTemporalState.lastUpdateTime,
|
|
239
|
-
multiTemporalState.liveState,
|
|
240
|
-
multiTemporalState.publicState,
|
|
241
|
-
maxUpdateFrequency,
|
|
242
|
-
])
|
|
243
207
|
|
|
244
208
|
useEffect(
|
|
245
209
|
() => () => {
|
|
246
|
-
for (const
|
|
247
|
-
URL.revokeObjectURL(
|
|
248
|
-
}
|
|
249
|
-
for (const [, state] of multiTemporalStateRef.current.publicState) {
|
|
250
|
-
URL.revokeObjectURL(state.previewUrl)
|
|
210
|
+
for (const previewUrl of Array.from(previewUrls.current)) {
|
|
211
|
+
URL.revokeObjectURL(previewUrl)
|
|
251
212
|
}
|
|
252
213
|
},
|
|
253
214
|
[],
|
|
254
215
|
)
|
|
255
216
|
|
|
256
|
-
|
|
257
|
-
useEffect(() => {
|
|
258
|
-
isFirstRenderRef.current = false
|
|
259
|
-
}, [])
|
|
260
|
-
|
|
261
|
-
return [multiTemporalState.publicState, operations]
|
|
217
|
+
return [internalState.state, operations]
|
|
262
218
|
}
|
package/LICENSE
DELETED
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
Copyright (c) 2022 Contember Limited
|
|
2
|
-
|
|
3
|
-
Portions of this software are licensed as follows:
|
|
4
|
-
|
|
5
|
-
* All content that resides under the "EE/" directory of this repository, if that directory exists, is licensed under the license defined in "EE/LICENSE".
|
|
6
|
-
* All third party components incorporated into the Contember/Admin are licensed under the original license provided by the owner of the applicable component.
|
|
7
|
-
* Content outside of the above mentioned directories or restrictions above is available under the Apache License, Version 2.0 (the "License") as defined below.
|
|
8
|
-
|
|
9
|
-
-------------------------------------------------------------------------
|
|
10
|
-
Apache License
|
|
11
|
-
Version 2.0, January 2004
|
|
12
|
-
http://www.apache.org/licenses/
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
16
|
-
|
|
17
|
-
1. Definitions.
|
|
18
|
-
|
|
19
|
-
"License" shall mean the terms and conditions for use, reproduction,
|
|
20
|
-
and distribution as defined by Sections 1 through 9 of this document.
|
|
21
|
-
|
|
22
|
-
"Licensor" shall mean the copyright owner or entity authorized by
|
|
23
|
-
the copyright owner that is granting the License.
|
|
24
|
-
|
|
25
|
-
"Legal Entity" shall mean the union of the acting entity and all
|
|
26
|
-
other entities that control, are controlled by, or are under common
|
|
27
|
-
control with that entity. For the purposes of this definition,
|
|
28
|
-
"control" means (i) the power, direct or indirect, to cause the
|
|
29
|
-
direction or management of such entity, whether by contract or
|
|
30
|
-
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
31
|
-
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
32
|
-
|
|
33
|
-
"You" (or "Your") shall mean an individual or Legal Entity
|
|
34
|
-
exercising permissions granted by this License.
|
|
35
|
-
|
|
36
|
-
"Source" form shall mean the preferred form for making modifications,
|
|
37
|
-
including but not limited to software source code, documentation
|
|
38
|
-
source, and configuration files.
|
|
39
|
-
|
|
40
|
-
"Object" form shall mean any form resulting from mechanical
|
|
41
|
-
transformation or translation of a Source form, including but
|
|
42
|
-
not limited to compiled object code, generated documentation,
|
|
43
|
-
and conversions to other media types.
|
|
44
|
-
|
|
45
|
-
"Work" shall mean the work of authorship, whether in Source or
|
|
46
|
-
Object form, made available under the License, as indicated by a
|
|
47
|
-
copyright notice that is included in or attached to the work
|
|
48
|
-
(an example is provided in the Appendix below).
|
|
49
|
-
|
|
50
|
-
"Derivative Works" shall mean any work, whether in Source or Object
|
|
51
|
-
form, that is based on (or derived from) the Work and for which the
|
|
52
|
-
editorial revisions, annotations, elaborations, or other modifications
|
|
53
|
-
represent, as a whole, an original work of authorship. For the purposes
|
|
54
|
-
of this License, Derivative Works shall not include works that remain
|
|
55
|
-
separable from, or merely link (or bind by name) to the interfaces of,
|
|
56
|
-
the Work and Derivative Works thereof.
|
|
57
|
-
|
|
58
|
-
"Contribution" shall mean any work of authorship, including
|
|
59
|
-
the original version of the Work and any modifications or additions
|
|
60
|
-
to that Work or Derivative Works thereof, that is intentionally
|
|
61
|
-
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
62
|
-
or by an individual or Legal Entity authorized to submit on behalf of
|
|
63
|
-
the copyright owner. For the purposes of this definition, "submitted"
|
|
64
|
-
means any form of electronic, verbal, or written communication sent
|
|
65
|
-
to the Licensor or its representatives, including but not limited to
|
|
66
|
-
communication on electronic mailing lists, source code control systems,
|
|
67
|
-
and issue tracking systems that are managed by, or on behalf of, the
|
|
68
|
-
Licensor for the purpose of discussing and improving the Work, but
|
|
69
|
-
excluding communication that is conspicuously marked or otherwise
|
|
70
|
-
designated in writing by the copyright owner as "Not a Contribution."
|
|
71
|
-
|
|
72
|
-
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
73
|
-
on behalf of whom a Contribution has been received by Licensor and
|
|
74
|
-
subsequently incorporated within the Work.
|
|
75
|
-
|
|
76
|
-
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
77
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
78
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
79
|
-
copyright license to reproduce, prepare Derivative Works of,
|
|
80
|
-
publicly display, publicly perform, sublicense, and distribute the
|
|
81
|
-
Work and such Derivative Works in Source or Object form.
|
|
82
|
-
|
|
83
|
-
3. Grant of Patent License. Subject to the terms and conditions of
|
|
84
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
85
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
86
|
-
(except as stated in this section) patent license to make, have made,
|
|
87
|
-
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
88
|
-
where such license applies only to those patent claims licensable
|
|
89
|
-
by such Contributor that are necessarily infringed by their
|
|
90
|
-
Contribution(s) alone or by combination of their Contribution(s)
|
|
91
|
-
with the Work to which such Contribution(s) was submitted. If You
|
|
92
|
-
institute patent litigation against any entity (including a
|
|
93
|
-
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
94
|
-
or a Contribution incorporated within the Work constitutes direct
|
|
95
|
-
or contributory patent infringement, then any patent licenses
|
|
96
|
-
granted to You under this License for that Work shall terminate
|
|
97
|
-
as of the date such litigation is filed.
|
|
98
|
-
|
|
99
|
-
4. Redistribution. You may reproduce and distribute copies of the
|
|
100
|
-
Work or Derivative Works thereof in any medium, with or without
|
|
101
|
-
modifications, and in Source or Object form, provided that You
|
|
102
|
-
meet the following conditions:
|
|
103
|
-
|
|
104
|
-
(a) You must give any other recipients of the Work or
|
|
105
|
-
Derivative Works a copy of this License; and
|
|
106
|
-
|
|
107
|
-
(b) You must cause any modified files to carry prominent notices
|
|
108
|
-
stating that You changed the files; and
|
|
109
|
-
|
|
110
|
-
(c) You must retain, in the Source form of any Derivative Works
|
|
111
|
-
that You distribute, all copyright, patent, trademark, and
|
|
112
|
-
attribution notices from the Source form of the Work,
|
|
113
|
-
excluding those notices that do not pertain to any part of
|
|
114
|
-
the Derivative Works; and
|
|
115
|
-
|
|
116
|
-
(d) If the Work includes a "NOTICE" text file as part of its
|
|
117
|
-
distribution, then any Derivative Works that You distribute must
|
|
118
|
-
include a readable copy of the attribution notices contained
|
|
119
|
-
within such NOTICE file, excluding those notices that do not
|
|
120
|
-
pertain to any part of the Derivative Works, in at least one
|
|
121
|
-
of the following places: within a NOTICE text file distributed
|
|
122
|
-
as part of the Derivative Works; within the Source form or
|
|
123
|
-
documentation, if provided along with the Derivative Works; or,
|
|
124
|
-
within a display generated by the Derivative Works, if and
|
|
125
|
-
wherever such third-party notices normally appear. The contents
|
|
126
|
-
of the NOTICE file are for informational purposes only and
|
|
127
|
-
do not modify the License. You may add Your own attribution
|
|
128
|
-
notices within Derivative Works that You distribute, alongside
|
|
129
|
-
or as an addendum to the NOTICE text from the Work, provided
|
|
130
|
-
that such additional attribution notices cannot be construed
|
|
131
|
-
as modifying the License.
|
|
132
|
-
|
|
133
|
-
You may add Your own copyright statement to Your modifications and
|
|
134
|
-
may provide additional or different license terms and conditions
|
|
135
|
-
for use, reproduction, or distribution of Your modifications, or
|
|
136
|
-
for any such Derivative Works as a whole, provided Your use,
|
|
137
|
-
reproduction, and distribution of the Work otherwise complies with
|
|
138
|
-
the conditions stated in this License.
|
|
139
|
-
|
|
140
|
-
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
141
|
-
any Contribution intentionally submitted for inclusion in the Work
|
|
142
|
-
by You to the Licensor shall be under the terms and conditions of
|
|
143
|
-
this License, without any additional terms or conditions.
|
|
144
|
-
Notwithstanding the above, nothing herein shall supersede or modify
|
|
145
|
-
the terms of any separate license agreement you may have executed
|
|
146
|
-
with Licensor regarding such Contributions.
|
|
147
|
-
|
|
148
|
-
6. Trademarks. This License does not grant permission to use the trade
|
|
149
|
-
names, trademarks, service marks, or product names of the Licensor,
|
|
150
|
-
except as required for reasonable and customary use in describing the
|
|
151
|
-
origin of the Work and reproducing the content of the NOTICE file.
|
|
152
|
-
|
|
153
|
-
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
154
|
-
agreed to in writing, Licensor provides the Work (and each
|
|
155
|
-
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
156
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
157
|
-
implied, including, without limitation, any warranties or conditions
|
|
158
|
-
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
159
|
-
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
160
|
-
appropriateness of using or redistributing the Work and assume any
|
|
161
|
-
risks associated with Your exercise of permissions under this License.
|
|
162
|
-
|
|
163
|
-
8. Limitation of Liability. In no event and under no legal theory,
|
|
164
|
-
whether in tort (including negligence), contract, or otherwise,
|
|
165
|
-
unless required by applicable law (such as deliberate and grossly
|
|
166
|
-
negligent acts) or agreed to in writing, shall any Contributor be
|
|
167
|
-
liable to You for damages, including any direct, indirect, special,
|
|
168
|
-
incidental, or consequential damages of any character arising as a
|
|
169
|
-
result of this License or out of the use or inability to use the
|
|
170
|
-
Work (including but not limited to damages for loss of goodwill,
|
|
171
|
-
work stoppage, computer failure or malfunction, or any and all
|
|
172
|
-
other commercial damages or losses), even if such Contributor
|
|
173
|
-
has been advised of the possibility of such damages.
|
|
174
|
-
|
|
175
|
-
9. Accepting Warranty or Additional Liability. While redistributing
|
|
176
|
-
the Work or Derivative Works thereof, You may choose to offer,
|
|
177
|
-
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
178
|
-
or other liability obligations and/or rights consistent with this
|
|
179
|
-
License. However, in accepting such obligations, You may act only
|
|
180
|
-
on Your own behalf and on Your sole responsibility, not on behalf
|
|
181
|
-
of any other Contributor, and only if You agree to indemnify,
|
|
182
|
-
defend, and hold each Contributor harmless for any liability
|
|
183
|
-
incurred by, or claims asserted against, such Contributor by reason
|
|
184
|
-
of your accepting any such warranty or additional liability.
|
|
185
|
-
|
|
186
|
-
END OF TERMS AND CONDITIONS
|