@umbraco-cms/backoffice 1.0.0-next.de0ffca0 → 1.0.0-next.e3cf00d3
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/backend-api.d.ts +1023 -282
- package/collection.d.ts +32 -0
- package/content-type.d.ts +127 -0
- package/context-api.d.ts +65 -5
- package/controller.d.ts +3 -2
- package/custom-elements.json +1716 -1202
- package/element.d.ts +5 -5
- package/entity-action.d.ts +19 -9
- package/extensions-api.d.ts +13 -12
- package/extensions-registry.d.ts +290 -88
- package/id.d.ts +6 -0
- package/modal.d.ts +48 -335
- package/models.d.ts +27 -10
- package/notification.d.ts +1 -1
- package/observable-api.d.ts +75 -49
- package/package.json +1 -1
- package/picker-input.d.ts +24 -0
- package/repository.d.ts +114 -44
- package/resources.d.ts +24 -15
- package/router.d.ts +263 -25
- package/section.d.ts +31 -0
- package/sorter.d.ts +103 -0
- package/store.d.ts +51 -56
- package/umbraco-package-schema.json +37755 -0
- package/utils.d.ts +1 -9
- package/vscode-html-custom-data.json +552 -419
- package/workspace.d.ts +40 -22
- package/property-editor.d.ts +0 -8
package/observable-api.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as rxjs from 'rxjs';
|
|
2
2
|
import { Observable, BehaviorSubject } from 'rxjs';
|
|
3
|
-
import { UmbControllerInterface, UmbControllerHostElement } from '
|
|
3
|
+
import { UmbControllerInterface, UmbControllerHostElement } from '@umbraco-cms/backoffice/controller';
|
|
4
4
|
|
|
5
5
|
declare class UmbObserver<T> {
|
|
6
6
|
#private;
|
|
@@ -18,55 +18,55 @@ declare class UmbObserverController<T = unknown> extends UmbObserver<T> implemen
|
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
20
|
* @export
|
|
21
|
-
* @class
|
|
21
|
+
* @class UmbBasicState
|
|
22
22
|
* @extends {BehaviorSubject<T>}
|
|
23
23
|
* @description - A RxJS BehaviorSubject this Subject ensures the data is unique, not updating any Observes unless there is an actual change of the value.
|
|
24
24
|
*/
|
|
25
|
-
declare class
|
|
25
|
+
declare class UmbBasicState<T> extends BehaviorSubject<T> {
|
|
26
26
|
constructor(initialData: T);
|
|
27
27
|
next(newData: T): void;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
/**
|
|
31
31
|
* @export
|
|
32
|
-
* @class
|
|
32
|
+
* @class UmbBooleanState
|
|
33
33
|
* @extends {BehaviorSubject<T>}
|
|
34
34
|
* @description - A RxJS BehaviorSubject this Subject ensures the data is unique, not updating any Observes unless there is an actual change of the value.
|
|
35
35
|
*/
|
|
36
|
-
declare class
|
|
36
|
+
declare class UmbBooleanState<T> extends UmbBasicState<T | boolean> {
|
|
37
37
|
constructor(initialData: T | boolean);
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
/**
|
|
41
41
|
* @export
|
|
42
|
-
* @class
|
|
42
|
+
* @class UmbNumberState
|
|
43
43
|
* @extends {BehaviorSubject<T>}
|
|
44
44
|
* @description - A RxJS BehaviorSubject this Subject ensures the data is unique, not updating any Observes unless there is an actual change of the value.
|
|
45
45
|
*/
|
|
46
|
-
declare class
|
|
46
|
+
declare class UmbNumberState<T> extends UmbBasicState<T | number> {
|
|
47
47
|
constructor(initialData: T | number);
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
/**
|
|
51
51
|
* @export
|
|
52
|
-
* @class
|
|
53
|
-
* @extends {
|
|
52
|
+
* @class UmbStringState
|
|
53
|
+
* @extends {UmbBasicState<T>}
|
|
54
54
|
* @description - A RxJS BehaviorSubject this Subject ensures the data is unique, not updating any Observes unless there is an actual change of the value.
|
|
55
55
|
*/
|
|
56
|
-
declare class
|
|
56
|
+
declare class UmbStringState<T> extends UmbBasicState<T | string> {
|
|
57
57
|
constructor(initialData: T | string);
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
interface
|
|
61
|
-
equal(otherClass:
|
|
60
|
+
interface UmbClassStateData {
|
|
61
|
+
equal(otherClass: UmbClassStateData): boolean;
|
|
62
62
|
}
|
|
63
63
|
/**
|
|
64
64
|
* @export
|
|
65
|
-
* @class
|
|
65
|
+
* @class UmbClassState
|
|
66
66
|
* @extends {BehaviorSubject<T>}
|
|
67
67
|
* @description - A RxJS BehaviorSubject which can hold class instance which has a equal method to compare in coming instances for changes.
|
|
68
68
|
*/
|
|
69
|
-
declare class
|
|
69
|
+
declare class UmbClassState<T extends UmbClassStateData | undefined | null> extends BehaviorSubject<T> {
|
|
70
70
|
constructor(initialData: T);
|
|
71
71
|
next(newData: T): void;
|
|
72
72
|
}
|
|
@@ -77,12 +77,12 @@ type MemoizationFunction<R> = (previousResult: R, currentResult: R) => boolean;
|
|
|
77
77
|
|
|
78
78
|
/**
|
|
79
79
|
* @export
|
|
80
|
-
* @class
|
|
80
|
+
* @class UmbDeepState
|
|
81
81
|
* @extends {BehaviorSubject<T>}
|
|
82
82
|
* @description - A RxJS BehaviorSubject which deepFreezes the data to ensure its not manipulated from any implementations.
|
|
83
83
|
* Additionally the Subject ensures the data is unique, not updating any Observes unless there is an actual change of the content.
|
|
84
84
|
*/
|
|
85
|
-
declare class
|
|
85
|
+
declare class UmbDeepState<T> extends BehaviorSubject<T> {
|
|
86
86
|
constructor(initialData: T);
|
|
87
87
|
getObservablePart<ReturnType>(mappingFunction: MappingFunction<T, ReturnType>, memoizationFunction?: MemoizationFunction<ReturnType>): rxjs.Observable<ReturnType>;
|
|
88
88
|
next(newData: T): void;
|
|
@@ -90,48 +90,62 @@ declare class DeepState<T> extends BehaviorSubject<T> {
|
|
|
90
90
|
|
|
91
91
|
/**
|
|
92
92
|
* @export
|
|
93
|
-
* @class
|
|
94
|
-
* @extends {
|
|
93
|
+
* @class UmbArrayState
|
|
94
|
+
* @extends {UmbDeepState<T>}
|
|
95
95
|
* @description - A RxJS BehaviorSubject which deepFreezes the object-data to ensure its not manipulated from any implementations.
|
|
96
96
|
* Additionally the Subject ensures the data is unique, not updating any Observes unless there is an actual change of the content.
|
|
97
97
|
*
|
|
98
98
|
* The ArrayState provides methods to append data when the data is an Object.
|
|
99
99
|
*/
|
|
100
|
-
declare class
|
|
101
|
-
private
|
|
100
|
+
declare class UmbArrayState<T> extends UmbDeepState<T[]> {
|
|
101
|
+
#private;
|
|
102
102
|
constructor(initialData: T[], getUniqueMethod?: (entry: T) => unknown);
|
|
103
|
+
/**
|
|
104
|
+
* @method sortBy
|
|
105
|
+
* @param {(a: T, b: T) => number} sortMethod - A method to be used for sorting everytime data is set.
|
|
106
|
+
* @description - A sort method to this Subject.
|
|
107
|
+
* @example <caption>Example add sort method</caption>
|
|
108
|
+
* const data = [
|
|
109
|
+
* { key: 1, value: 'foo'},
|
|
110
|
+
* { key: 2, value: 'bar'}
|
|
111
|
+
* ];
|
|
112
|
+
* const myState = new UmbArrayState(data, (x) => x.key);
|
|
113
|
+
* myState.sortBy((a, b) => (a.sortOrder || 0) - (b.sortOrder || 0));
|
|
114
|
+
*/
|
|
115
|
+
sortBy(sortMethod?: (a: T, b: T) => number): this;
|
|
116
|
+
next(value: T[]): void;
|
|
103
117
|
/**
|
|
104
118
|
* @method remove
|
|
105
119
|
* @param {unknown[]} uniques - The unique values to remove.
|
|
106
|
-
* @return {
|
|
120
|
+
* @return {UmbArrayState<T>} Reference to it self.
|
|
107
121
|
* @description - Remove some new data of this Subject.
|
|
108
|
-
* @example <caption>Example remove entry with
|
|
122
|
+
* @example <caption>Example remove entry with id '1' and '2'</caption>
|
|
109
123
|
* const data = [
|
|
110
|
-
* {
|
|
111
|
-
* {
|
|
124
|
+
* { id: 1, value: 'foo'},
|
|
125
|
+
* { id: 2, value: 'bar'}
|
|
112
126
|
* ];
|
|
113
|
-
* const myState = new
|
|
127
|
+
* const myState = new UmbArrayState(data, (x) => x.id);
|
|
114
128
|
* myState.remove([1, 2]);
|
|
115
129
|
*/
|
|
116
130
|
remove(uniques: unknown[]): this;
|
|
117
131
|
/**
|
|
118
132
|
* @method removeOne
|
|
119
133
|
* @param {unknown} unique - The unique value to remove.
|
|
120
|
-
* @return {
|
|
134
|
+
* @return {UmbArrayState<T>} Reference to it self.
|
|
121
135
|
* @description - Remove some new data of this Subject.
|
|
122
|
-
* @example <caption>Example remove entry with
|
|
136
|
+
* @example <caption>Example remove entry with id '1'</caption>
|
|
123
137
|
* const data = [
|
|
124
|
-
* {
|
|
125
|
-
* {
|
|
138
|
+
* { id: 1, value: 'foo'},
|
|
139
|
+
* { id: 2, value: 'bar'}
|
|
126
140
|
* ];
|
|
127
|
-
* const myState = new
|
|
141
|
+
* const myState = new UmbArrayState(data, (x) => x.id);
|
|
128
142
|
* myState.removeOne(1);
|
|
129
143
|
*/
|
|
130
144
|
removeOne(unique: unknown): this;
|
|
131
145
|
/**
|
|
132
146
|
* @method filter
|
|
133
147
|
* @param {unknown} filterMethod - The unique value to remove.
|
|
134
|
-
* @return {
|
|
148
|
+
* @return {UmbArrayState<T>} Reference to it self.
|
|
135
149
|
* @description - Remove some new data of this Subject.
|
|
136
150
|
* @example <caption>Example remove entry with key '1'</caption>
|
|
137
151
|
* const data = [
|
|
@@ -139,7 +153,7 @@ declare class ArrayState<T> extends DeepState<T[]> {
|
|
|
139
153
|
* { key: 2, value: 'bar'},
|
|
140
154
|
* { key: 3, value: 'poo'}
|
|
141
155
|
* ];
|
|
142
|
-
* const myState = new
|
|
156
|
+
* const myState = new UmbArrayState(data, (x) => x.key);
|
|
143
157
|
* myState.filter((entry) => entry.key !== 1);
|
|
144
158
|
*
|
|
145
159
|
* Result:
|
|
@@ -153,28 +167,28 @@ declare class ArrayState<T> extends DeepState<T[]> {
|
|
|
153
167
|
/**
|
|
154
168
|
* @method appendOne
|
|
155
169
|
* @param {T} entry - new data to be added in this Subject.
|
|
156
|
-
* @return {
|
|
170
|
+
* @return {UmbArrayState<T>} Reference to it self.
|
|
157
171
|
* @description - Append some new data to this Subject.
|
|
158
172
|
* @example <caption>Example append some data.</caption>
|
|
159
173
|
* const data = [
|
|
160
174
|
* { key: 1, value: 'foo'},
|
|
161
175
|
* { key: 2, value: 'bar'}
|
|
162
176
|
* ];
|
|
163
|
-
* const myState = new
|
|
177
|
+
* const myState = new UmbArrayState(data);
|
|
164
178
|
* myState.append({ key: 1, value: 'replaced-foo'});
|
|
165
179
|
*/
|
|
166
180
|
appendOne(entry: T): this;
|
|
167
181
|
/**
|
|
168
182
|
* @method append
|
|
169
183
|
* @param {T[]} entries - A array of new data to be added in this Subject.
|
|
170
|
-
* @return {
|
|
184
|
+
* @return {UmbArrayState<T>} Reference to it self.
|
|
171
185
|
* @description - Append some new data to this Subject, if it compares to existing data it will replace it.
|
|
172
186
|
* @example <caption>Example append some data.</caption>
|
|
173
187
|
* const data = [
|
|
174
188
|
* { key: 1, value: 'foo'},
|
|
175
189
|
* { key: 2, value: 'bar'}
|
|
176
190
|
* ];
|
|
177
|
-
* const myState = new
|
|
191
|
+
* const myState = new UmbArrayState(data);
|
|
178
192
|
* myState.append([
|
|
179
193
|
* { key: 1, value: 'replaced-foo'},
|
|
180
194
|
* { key: 3, value: 'another-bla'}
|
|
@@ -185,14 +199,14 @@ declare class ArrayState<T> extends DeepState<T[]> {
|
|
|
185
199
|
* @method updateOne
|
|
186
200
|
* @param {unknown} unique - Unique value to find entry to update.
|
|
187
201
|
* @param {Partial<T>} entry - new data to be added in this Subject.
|
|
188
|
-
* @return {
|
|
202
|
+
* @return {UmbArrayState<T>} Reference to it self.
|
|
189
203
|
* @description - Update a item with some new data, requires the ArrayState to be constructed with a getUnique method.
|
|
190
204
|
* @example <caption>Example append some data.</caption>
|
|
191
205
|
* const data = [
|
|
192
206
|
* { key: 1, value: 'foo'},
|
|
193
207
|
* { key: 2, value: 'bar'}
|
|
194
208
|
* ];
|
|
195
|
-
* const myState = new
|
|
209
|
+
* const myState = new UmbArrayState(data, (x) => x.key);
|
|
196
210
|
* myState.updateOne(2, {value: 'updated-bar'});
|
|
197
211
|
*/
|
|
198
212
|
updateOne(unique: unknown, entry: Partial<T>): this;
|
|
@@ -200,22 +214,22 @@ declare class ArrayState<T> extends DeepState<T[]> {
|
|
|
200
214
|
|
|
201
215
|
/**
|
|
202
216
|
* @export
|
|
203
|
-
* @class
|
|
204
|
-
* @extends {
|
|
217
|
+
* @class UmbObjectState
|
|
218
|
+
* @extends {UmbDeepState<T>}
|
|
205
219
|
* @description - A RxJS BehaviorSubject which deepFreezes the object-data to ensure its not manipulated from any implementations.
|
|
206
220
|
* Additionally the Subject ensures the data is unique, not updating any Observes unless there is an actual change of the content.
|
|
207
221
|
*
|
|
208
|
-
* The
|
|
222
|
+
* The UmbObjectState provides methods to append data when the data is an Object.
|
|
209
223
|
*/
|
|
210
|
-
declare class
|
|
224
|
+
declare class UmbObjectState<T> extends UmbDeepState<T> {
|
|
211
225
|
/**
|
|
212
226
|
* @method update
|
|
213
227
|
* @param {Partial<T>} partialData - A object containing some of the data to update in this Subject.
|
|
214
228
|
* @description - Append some new data to this Object.
|
|
215
|
-
* @return {
|
|
229
|
+
* @return {UmbObjectState<T>} Reference to it self.
|
|
216
230
|
* @example <caption>Example append some data.</caption>
|
|
217
231
|
* const data = {key: 'myKey', value: 'myInitialValue'};
|
|
218
|
-
* const myState = new
|
|
232
|
+
* const myState = new UmbObjectState(data);
|
|
219
233
|
* myState.update({value: 'myNewValue'});
|
|
220
234
|
*/
|
|
221
235
|
update(partialData: Partial<T>): this;
|
|
@@ -240,13 +254,25 @@ declare function createObservablePart<R, T>(source$: Observable<T>, mappingFunct
|
|
|
240
254
|
* @param {(mappable: T) => R} mappingFunction - Method to return the part for this Observable to return.
|
|
241
255
|
* @param {(previousResult: R, currentResult: R) => boolean} [memoizationFunction] - Method to Compare if the data has changed. Should return true when data is different.
|
|
242
256
|
* @description - Creates a RxJS Observable from RxJS Subject.
|
|
243
|
-
* @example <caption>Example append new entry for a ArrayState or a part of
|
|
244
|
-
* const entry = {
|
|
245
|
-
* const newDataSet = appendToFrozenArray(mySubject.getValue(), entry, x => x.
|
|
257
|
+
* @example <caption>Example append new entry for a ArrayState or a part of UmbDeepState/UmbObjectState it which is an array. Where the key is unique and the item will be updated if matched with existing.</caption>
|
|
258
|
+
* const entry = {id: 'myKey', value: 'myValue'};
|
|
259
|
+
* const newDataSet = appendToFrozenArray(mySubject.getValue(), entry, x => x.id === id);
|
|
246
260
|
* mySubject.next(newDataSet);
|
|
247
261
|
*/
|
|
248
262
|
declare function appendToFrozenArray<T>(data: T[], entry: T, getUniqueMethod?: (entry: T) => unknown): T[];
|
|
249
263
|
|
|
264
|
+
/**
|
|
265
|
+
* @export
|
|
266
|
+
* @method filterFrozenArray
|
|
267
|
+
* @param {Array<T>} data - RxJS Subject to use for this Observable.
|
|
268
|
+
* @param {(entry: T) => boolean} filterMethod - Method to filter the array.
|
|
269
|
+
* @description - Creates a RxJS Observable from RxJS Subject.
|
|
270
|
+
* @example <caption>Example remove an entry of a ArrayState or a part of DeepState/ObjectState it which is an array. Where the key is unique and the item will be updated if matched with existing.</caption>
|
|
271
|
+
* const newDataSet = filterFrozenArray(mySubject.getValue(), x => x.id !== "myKey");
|
|
272
|
+
* mySubject.next(newDataSet);
|
|
273
|
+
*/
|
|
274
|
+
declare function filterFrozenArray<T>(data: T[], filterMethod: (entry: T) => boolean): T[];
|
|
275
|
+
|
|
250
276
|
/**
|
|
251
277
|
* @export
|
|
252
278
|
* @method partialUpdateFrozenArray
|
|
@@ -254,11 +280,11 @@ declare function appendToFrozenArray<T>(data: T[], entry: T, getUniqueMethod?: (
|
|
|
254
280
|
* @param {(mappable: T) => R} mappingFunction - Method to return the part for this Observable to return.
|
|
255
281
|
* @param {(previousResult: R, currentResult: R) => boolean} [memoizationFunction] - Method to Compare if the data has changed. Should return true when data is different.
|
|
256
282
|
* @description - Creates a RxJS Observable from RxJS Subject.
|
|
257
|
-
* @example <caption>Example append new entry for a ArrayState or a part of
|
|
283
|
+
* @example <caption>Example append new entry for a ArrayState or a part of UmbDeepState/UmbObjectState it which is an array. Where the key is unique and the item will be updated if matched with existing.</caption>
|
|
258
284
|
* const partialEntry = {value: 'myValue'};
|
|
259
285
|
* const newDataSet = partialUpdateFrozenArray(mySubject.getValue(), partialEntry, x => x.key === 'myKey');
|
|
260
286
|
* mySubject.next(newDataSet);
|
|
261
287
|
*/
|
|
262
288
|
declare function partialUpdateFrozenArray<T>(data: T[], partialEntry: Partial<T>, findMethod: (entry: T) => boolean): T[];
|
|
263
289
|
|
|
264
|
-
export {
|
|
290
|
+
export { MappingFunction, UmbArrayState, UmbBasicState, UmbBooleanState, UmbClassState, UmbDeepState, UmbNumberState, UmbObjectState, UmbObserver, UmbObserverController, UmbStringState, appendToFrozenArray, createObservablePart, filterFrozenArray, partialUpdateFrozenArray };
|
package/package.json
CHANGED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as rxjs from 'rxjs';
|
|
2
|
+
import { UmbItemRepository } from '@umbraco-cms/backoffice/repository';
|
|
3
|
+
import { UmbControllerHostElement } from '@umbraco-cms/backoffice/controller';
|
|
4
|
+
import { UmbModalToken, UmbModalContext } from '@umbraco-cms/backoffice/modal';
|
|
5
|
+
import { ItemResponseModelBaseModel } from '@umbraco-cms/backoffice/backend-api';
|
|
6
|
+
|
|
7
|
+
declare class UmbPickerInputContext<ItemType extends ItemResponseModelBaseModel> {
|
|
8
|
+
#private;
|
|
9
|
+
host: UmbControllerHostElement;
|
|
10
|
+
modalAlias: string | UmbModalToken;
|
|
11
|
+
repository?: UmbItemRepository<ItemType>;
|
|
12
|
+
modalContext?: UmbModalContext;
|
|
13
|
+
selection: rxjs.Observable<string[]>;
|
|
14
|
+
selectedItems: rxjs.Observable<ItemType[]>;
|
|
15
|
+
max: number;
|
|
16
|
+
min: number;
|
|
17
|
+
constructor(host: UmbControllerHostElement, repositoryAlias: string, modalAlias: string | UmbModalToken, getUniqueMethod?: (entry: ItemType) => string | undefined);
|
|
18
|
+
getSelection(): string[];
|
|
19
|
+
setSelection(selection: string[]): void;
|
|
20
|
+
openPicker(pickerData?: any): void;
|
|
21
|
+
requestRemoveItem(unique: string): Promise<void>;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export { UmbPickerInputContext };
|
package/repository.d.ts
CHANGED
|
@@ -1,69 +1,139 @@
|
|
|
1
|
-
import { ProblemDetailsModel } from '
|
|
2
|
-
import { DataSourceResponse as DataSourceResponse$1 } from '
|
|
1
|
+
import { ApiError, CancelError, FolderReponseModel, CreateFolderRequestModel, UpdateFolderReponseModel, TreeItemPresentationModel, ProblemDetailsModel, FolderModelBaseModel, ItemResponseModelBaseModel } from '@umbraco-cms/backoffice/backend-api';
|
|
2
|
+
import { DataSourceResponse as DataSourceResponse$1, UmbDataSourceErrorResponse as UmbDataSourceErrorResponse$1 } from '@umbraco-cms/backoffice/repository';
|
|
3
3
|
import { Observable } from 'rxjs';
|
|
4
|
+
import { UmbTreeRootModel, UmbTreeRootEntityModel } from '@umbraco-cms/backoffice/models';
|
|
4
5
|
|
|
5
|
-
interface DataSourceResponse<T = undefined> {
|
|
6
|
+
interface DataSourceResponse<T = undefined> extends UmbDataSourceErrorResponse {
|
|
6
7
|
data?: T;
|
|
7
|
-
|
|
8
|
+
}
|
|
9
|
+
interface UmbDataSourceErrorResponse {
|
|
10
|
+
error?: ApiError | CancelError;
|
|
8
11
|
}
|
|
9
12
|
|
|
10
|
-
interface UmbDataSource<
|
|
11
|
-
createScaffold(
|
|
12
|
-
get(
|
|
13
|
-
insert(data:
|
|
14
|
-
update(data:
|
|
15
|
-
delete(
|
|
13
|
+
interface UmbDataSource<CreateRequestType, CreateResponseType, UpdateRequestType, ResponseType> {
|
|
14
|
+
createScaffold(parentId: string | null): Promise<DataSourceResponse$1<CreateRequestType>>;
|
|
15
|
+
get(unique: string): Promise<DataSourceResponse$1<ResponseType>>;
|
|
16
|
+
insert(data: CreateRequestType): Promise<DataSourceResponse$1<CreateResponseType>>;
|
|
17
|
+
update(unique: string, data: UpdateRequestType): Promise<DataSourceResponse$1<ResponseType>>;
|
|
18
|
+
delete(unique: string): Promise<DataSourceResponse$1>;
|
|
16
19
|
}
|
|
17
20
|
|
|
18
|
-
interface
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
interface UmbFolderDataSource {
|
|
22
|
+
createScaffold(parentId: string | null): Promise<DataSourceResponse<FolderReponseModel>>;
|
|
23
|
+
get(unique: string): Promise<DataSourceResponse<FolderReponseModel>>;
|
|
24
|
+
insert(data: CreateFolderRequestModel): Promise<DataSourceResponse<string>>;
|
|
25
|
+
update(unique: string, data: CreateFolderRequestModel): Promise<DataSourceResponse<UpdateFolderReponseModel>>;
|
|
26
|
+
delete(unique: string): Promise<DataSourceResponse>;
|
|
22
27
|
}
|
|
23
28
|
|
|
24
|
-
interface
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
data?:
|
|
29
|
+
interface UmbPagedData<T> {
|
|
30
|
+
total: number;
|
|
31
|
+
items: Array<T>;
|
|
32
|
+
}
|
|
33
|
+
interface UmbTreeRepository<TreeItemType extends TreeItemPresentationModel, TreeRootType extends UmbTreeRootModel = UmbTreeRootEntityModel> {
|
|
34
|
+
requestTreeRoot: () => Promise<{
|
|
35
|
+
data?: TreeRootType;
|
|
31
36
|
error?: ProblemDetailsModel;
|
|
32
37
|
}>;
|
|
33
|
-
|
|
38
|
+
requestRootTreeItems: () => Promise<{
|
|
39
|
+
data?: UmbPagedData<TreeItemType>;
|
|
34
40
|
error?: ProblemDetailsModel;
|
|
41
|
+
asObservable?: () => Observable<TreeItemType[]>;
|
|
35
42
|
}>;
|
|
36
|
-
|
|
43
|
+
requestTreeItemsOf: (parentUnique: string | null) => Promise<{
|
|
44
|
+
data?: UmbPagedData<TreeItemType>;
|
|
37
45
|
error?: ProblemDetailsModel;
|
|
46
|
+
asObservable?: () => Observable<TreeItemType[]>;
|
|
38
47
|
}>;
|
|
39
|
-
|
|
48
|
+
requestItemsLegacy?: (uniques: string[]) => Promise<{
|
|
49
|
+
data?: Array<TreeItemType>;
|
|
40
50
|
error?: ProblemDetailsModel;
|
|
51
|
+
asObservable?: () => Observable<any[]>;
|
|
41
52
|
}>;
|
|
53
|
+
rootTreeItems: () => Promise<Observable<TreeItemType[]>>;
|
|
54
|
+
treeItemsOf: (parentUnique: string | null) => Promise<Observable<TreeItemType[]>>;
|
|
55
|
+
itemsLegacy?: (uniques: string[]) => Promise<Observable<any[]>>;
|
|
42
56
|
}
|
|
43
57
|
|
|
44
|
-
interface UmbPagedData<
|
|
45
|
-
|
|
46
|
-
|
|
58
|
+
interface UmbTreeDataSource<ItemType = any, PagedItemType = UmbPagedData<ItemType>> {
|
|
59
|
+
getRootItems(): Promise<DataSourceResponse<PagedItemType>>;
|
|
60
|
+
getChildrenOf(parentUnique: string | null): Promise<DataSourceResponse<PagedItemType>>;
|
|
61
|
+
getItems(unique: Array<string>): Promise<DataSourceResponse<Array<any>>>;
|
|
47
62
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
63
|
+
|
|
64
|
+
interface UmbItemDataSource<ItemType> {
|
|
65
|
+
getItems(unique: Array<string>): Promise<DataSourceResponse$1<Array<ItemType>>>;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
interface UmbMoveDataSource {
|
|
69
|
+
move(unique: string, targetUnique: string | null): Promise<UmbDataSourceErrorResponse$1>;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
interface UmbCopyDataSource {
|
|
73
|
+
copy(unique: string, targetUnique: string | null): Promise<DataSourceResponse$1<string>>;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
interface UmbCollectionDataSource<ItemType = any, PagedItemType = UmbPagedData<ItemType>> {
|
|
77
|
+
getCollection(): Promise<DataSourceResponse<PagedItemType>>;
|
|
78
|
+
filterCollection(filter: any): Promise<DataSourceResponse<PagedItemType>>;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
interface UmbRepositoryErrorResponse {
|
|
82
|
+
error?: ProblemDetailsModel;
|
|
83
|
+
}
|
|
84
|
+
interface UmbRepositoryResponse<T> extends UmbRepositoryErrorResponse {
|
|
85
|
+
data?: T;
|
|
86
|
+
}
|
|
87
|
+
interface UmbDetailRepository<CreateRequestType = any, CreateResponseType = any, UpdateRequestType = any, ResponseType = any> {
|
|
88
|
+
createScaffold(parentId: string | null): Promise<UmbRepositoryResponse<CreateRequestType>>;
|
|
89
|
+
requestById(id: string): Promise<UmbRepositoryResponse<ResponseType>>;
|
|
90
|
+
byId(id: string): Promise<Observable<ResponseType>>;
|
|
91
|
+
create(data: CreateRequestType): Promise<UmbRepositoryResponse<CreateResponseType>>;
|
|
92
|
+
save(id: string, data: UpdateRequestType): Promise<UmbRepositoryErrorResponse>;
|
|
93
|
+
delete(id: string): Promise<UmbRepositoryErrorResponse>;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
interface UmbFolderRepository {
|
|
97
|
+
createFolderScaffold(parentId: string | null): Promise<{
|
|
98
|
+
data?: FolderReponseModel;
|
|
99
|
+
error?: ProblemDetailsModel;
|
|
53
100
|
}>;
|
|
54
|
-
|
|
55
|
-
data
|
|
56
|
-
error
|
|
57
|
-
asObservable?: () => Observable<ItemType[]>;
|
|
101
|
+
createFolder(folderRequest: CreateFolderRequestModel): Promise<{
|
|
102
|
+
data?: string;
|
|
103
|
+
error?: ProblemDetailsModel;
|
|
58
104
|
}>;
|
|
59
|
-
|
|
60
|
-
data
|
|
61
|
-
error
|
|
62
|
-
|
|
105
|
+
requestFolder(unique: string): Promise<{
|
|
106
|
+
data?: FolderReponseModel;
|
|
107
|
+
error?: ProblemDetailsModel;
|
|
108
|
+
}>;
|
|
109
|
+
updateFolder(unique: string, folder: FolderModelBaseModel): Promise<{
|
|
110
|
+
data?: UpdateFolderReponseModel;
|
|
111
|
+
error?: ProblemDetailsModel;
|
|
63
112
|
}>;
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
113
|
+
deleteFolder(id: string): Promise<{
|
|
114
|
+
error?: ProblemDetailsModel;
|
|
115
|
+
}>;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
interface UmbCollectionRepository {
|
|
119
|
+
requestCollection(filter?: any): Promise<any>;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
interface UmbItemRepository<ItemType extends ItemResponseModelBaseModel> {
|
|
123
|
+
requestItems: (uniques: string[]) => Promise<{
|
|
124
|
+
data?: Array<ItemType> | undefined;
|
|
125
|
+
error?: ProblemDetailsModel | undefined;
|
|
126
|
+
asObservable?: () => Observable<Array<ItemType>>;
|
|
127
|
+
}>;
|
|
128
|
+
items: (uniques: string[]) => Promise<Observable<Array<ItemType>>>;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
interface UmbMoveRepository {
|
|
132
|
+
move(unique: string, targetUnique: string): Promise<UmbRepositoryErrorResponse>;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
interface UmbCopyRepository {
|
|
136
|
+
copy(unique: string, targetUnique: string): Promise<UmbRepositoryResponse<string>>;
|
|
67
137
|
}
|
|
68
138
|
|
|
69
|
-
export { DataSourceResponse, UmbDataSource, UmbDetailRepository, UmbPagedData, UmbTreeDataSource, UmbTreeRepository };
|
|
139
|
+
export { DataSourceResponse, UmbCollectionDataSource, UmbCollectionRepository, UmbCopyDataSource, UmbCopyRepository, UmbDataSource, UmbDataSourceErrorResponse, UmbDetailRepository, UmbFolderDataSource, UmbFolderRepository, UmbItemDataSource, UmbItemRepository, UmbMoveDataSource, UmbMoveRepository, UmbPagedData, UmbRepositoryErrorResponse, UmbRepositoryResponse, UmbTreeDataSource, UmbTreeRepository };
|
package/resources.d.ts
CHANGED
|
@@ -1,25 +1,20 @@
|
|
|
1
|
-
import { UmbNotificationOptions } from '
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { UmbNotificationOptions } from '@umbraco-cms/backoffice/notification';
|
|
2
|
+
import { UmbController, UmbControllerHostElement } from '@umbraco-cms/backoffice/controller';
|
|
3
|
+
import { DataSourceResponse as DataSourceResponse$1 } from '@umbraco-cms/backoffice/repository';
|
|
4
|
+
import { UmbContextToken } from '@umbraco-cms/backoffice/context-api';
|
|
5
|
+
import { ApiError, CancelError } from '@umbraco-cms/backoffice/backend-api';
|
|
5
6
|
|
|
6
7
|
declare class UmbResourceController extends UmbController {
|
|
7
8
|
#private;
|
|
8
9
|
constructor(host: UmbControllerHostElement, promise: Promise<any>, alias?: string);
|
|
9
10
|
hostConnected(): void;
|
|
10
11
|
hostDisconnected(): void;
|
|
11
|
-
/**
|
|
12
|
-
* Extract the ProblemDetailsModel object from an ApiError.
|
|
13
|
-
*
|
|
14
|
-
* This assumes that all ApiErrors contain a ProblemDetailsModel object in their body.
|
|
15
|
-
*/
|
|
16
|
-
static toProblemDetailsModel(error: unknown): ProblemDetailsModel | undefined;
|
|
17
12
|
/**
|
|
18
13
|
* Base execute function with a try/catch block and return a tuple with the result and the error.
|
|
19
14
|
*/
|
|
20
15
|
static tryExecute<T>(promise: Promise<T>): Promise<DataSourceResponse$1<T>>;
|
|
21
16
|
/**
|
|
22
|
-
* Wrap the {
|
|
17
|
+
* Wrap the {tryExecute} function in a try/catch block and return the result.
|
|
23
18
|
* If the executor function throws an error, then show the details in a notification.
|
|
24
19
|
*/
|
|
25
20
|
tryExecuteAndNotify<T>(options?: UmbNotificationOptions): Promise<DataSourceResponse$1<T>>;
|
|
@@ -38,13 +33,27 @@ declare class UmbResourceController extends UmbController {
|
|
|
38
33
|
destroy(): void;
|
|
39
34
|
}
|
|
40
35
|
|
|
41
|
-
|
|
36
|
+
/**
|
|
37
|
+
* The base URL of the configured Umbraco server.
|
|
38
|
+
* If the server is local, this will be an empty string.
|
|
39
|
+
*
|
|
40
|
+
* @remarks This is the base URL of the Umbraco server, not the base URL of the backoffice.
|
|
41
|
+
*
|
|
42
|
+
* @example https://localhost:44300
|
|
43
|
+
* @example https://my-umbraco-site.com
|
|
44
|
+
* @example ''
|
|
45
|
+
*/
|
|
46
|
+
declare const UMB_SERVER_URL: UmbContextToken<string>;
|
|
47
|
+
|
|
48
|
+
interface DataSourceResponse<T = undefined> extends UmbDataSourceErrorResponse {
|
|
42
49
|
data?: T;
|
|
43
|
-
|
|
50
|
+
}
|
|
51
|
+
interface UmbDataSourceErrorResponse {
|
|
52
|
+
error?: ApiError | CancelError;
|
|
44
53
|
}
|
|
45
54
|
|
|
46
55
|
declare function tryExecute<T>(promise: Promise<T>): Promise<DataSourceResponse<T>>;
|
|
47
56
|
|
|
48
|
-
declare function tryExecuteAndNotify<T>(host: UmbControllerHostElement, resource: Promise<T>, options?: UmbNotificationOptions
|
|
57
|
+
declare function tryExecuteAndNotify<T>(host: UmbControllerHostElement, resource: Promise<T>, options?: UmbNotificationOptions): Promise<DataSourceResponse<T>>;
|
|
49
58
|
|
|
50
|
-
export { UmbResourceController, tryExecute, tryExecuteAndNotify };
|
|
59
|
+
export { UMB_SERVER_URL, UmbResourceController, tryExecute, tryExecuteAndNotify };
|