@umbraco-cms/backoffice 1.0.0-next.37dcc47c → 1.0.0-next.386e13e7

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/models.d.ts CHANGED
@@ -1,75 +1,17 @@
1
- import { EntityTreeItemResponseModel, FolderTreeItemResponseModel, PackageManifestResponseModel } from './backend-api';
2
-
3
- type HTMLElementConstructor<T = HTMLElement> = new (...args: any[]) => T;
4
- type ClassConstructor<T> = new (...args: any[]) => T;
5
- interface Entity {
6
- key: string;
7
- name: string;
8
- icon: string;
9
- type: string;
10
- hasChildren: boolean;
11
- parentKey: string | null;
12
- }
13
- interface UserEntity extends Entity {
14
- type: 'user';
15
- }
16
- type UserStatus = 'enabled' | 'inactive' | 'invited' | 'disabled';
17
- interface UserDetails extends UserEntity {
18
- email: string;
19
- status: UserStatus;
20
- language: string;
21
- lastLoginDate?: string;
22
- lastLockoutDate?: string;
23
- lastPasswordChangeDate?: string;
24
- updateDate: string;
25
- createDate: string;
26
- failedLoginAttempts: number;
27
- userGroups: Array<string>;
28
- contentStartNodes: Array<string>;
29
- mediaStartNodes: Array<string>;
30
- }
31
- interface UserGroupEntity extends Entity {
32
- type: 'user-group';
33
- }
34
- interface UserGroupDetails extends UserGroupEntity {
35
- sections: Array<string>;
36
- contentStartNode?: string;
37
- mediaStartNode?: string;
38
- permissions: Array<string>;
39
- }
40
- interface MemberTypeDetails extends EntityTreeItemResponseModel {
41
- key: string;
42
- alias: string;
43
- properties: [];
44
- }
45
- interface MediaTypeDetails extends FolderTreeItemResponseModel {
46
- key: string;
47
- alias: string;
48
- properties: [];
49
- }
50
- interface MemberGroupDetails extends EntityTreeItemResponseModel {
51
- key: string;
52
- }
53
- interface MemberDetails extends EntityTreeItemResponseModel {
54
- key: string;
55
- }
56
- interface DocumentBlueprintDetails {
57
- key: string;
58
- name: string;
59
- type: 'document-blueprint';
60
- properties: Array<any>;
61
- data: Array<any>;
62
- icon: string;
63
- documentTypeKey: string;
64
- }
65
- interface SwatchDetails {
1
+ /** Tried to find a common base of our entities — used by Entity Workspace Context */
2
+ type UmbEntityBase = {
3
+ id?: string;
4
+ name?: string;
5
+ };
6
+ interface UmbSwatchDetails {
66
7
  label: string;
67
8
  value: string;
68
9
  }
69
- type UmbPackage = PackageManifestResponseModel;
70
- type PackageManifestResponse = UmbPackage[];
71
- type UmbPackageWithMigrationStatus = UmbPackage & {
72
- hasPendingMigrations: boolean;
73
- };
10
+ interface ServertimeOffset {
11
+ /**
12
+ * offset in minutes relative to UTC
13
+ */
14
+ offset: number;
15
+ }
74
16
 
75
- export { ClassConstructor, DocumentBlueprintDetails, Entity, HTMLElementConstructor, MediaTypeDetails, MemberDetails, MemberGroupDetails, MemberTypeDetails, PackageManifestResponse, SwatchDetails, UmbPackage, UmbPackageWithMigrationStatus, UserDetails, UserEntity, UserGroupDetails, UserGroupEntity, UserStatus };
17
+ export { ServertimeOffset, UmbEntityBase, UmbSwatchDetails };
package/notification.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as rxjs from 'rxjs';
2
- import { UmbContextToken } from './context-api';
2
+ import { UmbContextToken } from '@umbraco-cms/backoffice/context-api';
3
3
 
4
4
  /**
5
5
  * @export
@@ -1,10 +1,11 @@
1
1
  import * as rxjs from 'rxjs';
2
2
  import { Observable, BehaviorSubject } from 'rxjs';
3
- import { UmbControllerInterface, UmbControllerHostInterface } from './controller';
3
+ import { UmbControllerInterface, UmbControllerHostElement } from '@umbraco-cms/backoffice/controller-api';
4
4
 
5
5
  declare class UmbObserver<T> {
6
6
  #private;
7
7
  constructor(source: Observable<T>, callback: (_value: T) => void);
8
+ asPromise(): Promise<T>;
8
9
  hostConnected(): void;
9
10
  hostDisconnected(): void;
10
11
  destroy(): void;
@@ -13,60 +14,60 @@ declare class UmbObserver<T> {
13
14
  declare class UmbObserverController<T = unknown> extends UmbObserver<T> implements UmbControllerInterface {
14
15
  _alias?: string;
15
16
  get unique(): string | undefined;
16
- constructor(host: UmbControllerHostInterface, source: Observable<T>, callback: (_value: T) => void, alias?: string);
17
+ constructor(host: UmbControllerHostElement, source: Observable<T>, callback: (_value: T) => void, alias?: string);
17
18
  }
18
19
 
19
20
  /**
20
21
  * @export
21
- * @class BasicState
22
+ * @class UmbBasicState
22
23
  * @extends {BehaviorSubject<T>}
23
24
  * @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
25
  */
25
- declare class BasicState<T> extends BehaviorSubject<T> {
26
+ declare class UmbBasicState<T> extends BehaviorSubject<T> {
26
27
  constructor(initialData: T);
27
28
  next(newData: T): void;
28
29
  }
29
30
 
30
31
  /**
31
32
  * @export
32
- * @class BooleanState
33
+ * @class UmbBooleanState
33
34
  * @extends {BehaviorSubject<T>}
34
35
  * @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
36
  */
36
- declare class BooleanState<T> extends BasicState<T | boolean> {
37
+ declare class UmbBooleanState<T> extends UmbBasicState<T | boolean> {
37
38
  constructor(initialData: T | boolean);
38
39
  }
39
40
 
40
41
  /**
41
42
  * @export
42
- * @class NumberState
43
+ * @class UmbNumberState
43
44
  * @extends {BehaviorSubject<T>}
44
45
  * @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
46
  */
46
- declare class NumberState<T> extends BasicState<T | number> {
47
+ declare class UmbNumberState<T> extends UmbBasicState<T | number> {
47
48
  constructor(initialData: T | number);
48
49
  }
49
50
 
50
51
  /**
51
52
  * @export
52
- * @class StringState
53
- * @extends {BasicState<T>}
53
+ * @class UmbStringState
54
+ * @extends {UmbBasicState<T>}
54
55
  * @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
56
  */
56
- declare class StringState<T> extends BasicState<T | string> {
57
+ declare class UmbStringState<T> extends UmbBasicState<T | string> {
57
58
  constructor(initialData: T | string);
58
59
  }
59
60
 
60
- interface ClassStateData {
61
- equal(otherClass: ClassStateData): boolean;
61
+ interface UmbClassStateData {
62
+ equal(otherClass: UmbClassStateData): boolean;
62
63
  }
63
64
  /**
64
65
  * @export
65
- * @class ClassState
66
+ * @class UmbClassState
66
67
  * @extends {BehaviorSubject<T>}
67
68
  * @description - A RxJS BehaviorSubject which can hold class instance which has a equal method to compare in coming instances for changes.
68
69
  */
69
- declare class ClassState<T extends ClassStateData | undefined | null> extends BehaviorSubject<T> {
70
+ declare class UmbClassState<T extends UmbClassStateData | undefined | null> extends BehaviorSubject<T> {
70
71
  constructor(initialData: T);
71
72
  next(newData: T): void;
72
73
  }
@@ -77,12 +78,12 @@ type MemoizationFunction<R> = (previousResult: R, currentResult: R) => boolean;
77
78
 
78
79
  /**
79
80
  * @export
80
- * @class DeepState
81
+ * @class UmbDeepState
81
82
  * @extends {BehaviorSubject<T>}
82
83
  * @description - A RxJS BehaviorSubject which deepFreezes the data to ensure its not manipulated from any implementations.
83
84
  * Additionally the Subject ensures the data is unique, not updating any Observes unless there is an actual change of the content.
84
85
  */
85
- declare class DeepState<T> extends BehaviorSubject<T> {
86
+ declare class UmbDeepState<T> extends BehaviorSubject<T> {
86
87
  constructor(initialData: T);
87
88
  getObservablePart<ReturnType>(mappingFunction: MappingFunction<T, ReturnType>, memoizationFunction?: MemoizationFunction<ReturnType>): rxjs.Observable<ReturnType>;
88
89
  next(newData: T): void;
@@ -90,48 +91,62 @@ declare class DeepState<T> extends BehaviorSubject<T> {
90
91
 
91
92
  /**
92
93
  * @export
93
- * @class ArrayState
94
- * @extends {DeepState<T>}
94
+ * @class UmbArrayState
95
+ * @extends {UmbDeepState<T>}
95
96
  * @description - A RxJS BehaviorSubject which deepFreezes the object-data to ensure its not manipulated from any implementations.
96
97
  * Additionally the Subject ensures the data is unique, not updating any Observes unless there is an actual change of the content.
97
98
  *
98
99
  * The ArrayState provides methods to append data when the data is an Object.
99
100
  */
100
- declare class ArrayState<T> extends DeepState<T[]> {
101
- private _getUnique?;
102
- constructor(initialData: T[], _getUnique?: ((entry: T) => unknown) | undefined);
101
+ declare class UmbArrayState<T> extends UmbDeepState<T[]> {
102
+ #private;
103
+ constructor(initialData: T[], getUniqueMethod?: (entry: T) => unknown);
104
+ /**
105
+ * @method sortBy
106
+ * @param {(a: T, b: T) => number} sortMethod - A method to be used for sorting everytime data is set.
107
+ * @description - A sort method to this Subject.
108
+ * @example <caption>Example add sort method</caption>
109
+ * const data = [
110
+ * { key: 1, value: 'foo'},
111
+ * { key: 2, value: 'bar'}
112
+ * ];
113
+ * const myState = new UmbArrayState(data, (x) => x.key);
114
+ * myState.sortBy((a, b) => (a.sortOrder || 0) - (b.sortOrder || 0));
115
+ */
116
+ sortBy(sortMethod?: (a: T, b: T) => number): this;
117
+ next(value: T[]): void;
103
118
  /**
104
119
  * @method remove
105
120
  * @param {unknown[]} uniques - The unique values to remove.
106
- * @return {ArrayState<T>} Reference to it self.
121
+ * @return {UmbArrayState<T>} Reference to it self.
107
122
  * @description - Remove some new data of this Subject.
108
- * @example <caption>Example remove entry with key '1' and '2'</caption>
123
+ * @example <caption>Example remove entry with id '1' and '2'</caption>
109
124
  * const data = [
110
- * { key: 1, value: 'foo'},
111
- * { key: 2, value: 'bar'}
125
+ * { id: 1, value: 'foo'},
126
+ * { id: 2, value: 'bar'}
112
127
  * ];
113
- * const myState = new ArrayState(data, (x) => x.key);
128
+ * const myState = new UmbArrayState(data, (x) => x.id);
114
129
  * myState.remove([1, 2]);
115
130
  */
116
131
  remove(uniques: unknown[]): this;
117
132
  /**
118
133
  * @method removeOne
119
134
  * @param {unknown} unique - The unique value to remove.
120
- * @return {ArrayState<T>} Reference to it self.
135
+ * @return {UmbArrayState<T>} Reference to it self.
121
136
  * @description - Remove some new data of this Subject.
122
- * @example <caption>Example remove entry with key '1'</caption>
137
+ * @example <caption>Example remove entry with id '1'</caption>
123
138
  * const data = [
124
- * { key: 1, value: 'foo'},
125
- * { key: 2, value: 'bar'}
139
+ * { id: 1, value: 'foo'},
140
+ * { id: 2, value: 'bar'}
126
141
  * ];
127
- * const myState = new ArrayState(data, (x) => x.key);
142
+ * const myState = new UmbArrayState(data, (x) => x.id);
128
143
  * myState.removeOne(1);
129
144
  */
130
145
  removeOne(unique: unknown): this;
131
146
  /**
132
147
  * @method filter
133
148
  * @param {unknown} filterMethod - The unique value to remove.
134
- * @return {ArrayState<T>} Reference to it self.
149
+ * @return {UmbArrayState<T>} Reference to it self.
135
150
  * @description - Remove some new data of this Subject.
136
151
  * @example <caption>Example remove entry with key '1'</caption>
137
152
  * const data = [
@@ -139,7 +154,7 @@ declare class ArrayState<T> extends DeepState<T[]> {
139
154
  * { key: 2, value: 'bar'},
140
155
  * { key: 3, value: 'poo'}
141
156
  * ];
142
- * const myState = new ArrayState(data, (x) => x.key);
157
+ * const myState = new UmbArrayState(data, (x) => x.key);
143
158
  * myState.filter((entry) => entry.key !== 1);
144
159
  *
145
160
  * Result:
@@ -153,54 +168,69 @@ declare class ArrayState<T> extends DeepState<T[]> {
153
168
  /**
154
169
  * @method appendOne
155
170
  * @param {T} entry - new data to be added in this Subject.
156
- * @return {ArrayState<T>} Reference to it self.
171
+ * @return {UmbArrayState<T>} Reference to it self.
157
172
  * @description - Append some new data to this Subject.
158
173
  * @example <caption>Example append some data.</caption>
159
174
  * const data = [
160
175
  * { key: 1, value: 'foo'},
161
176
  * { key: 2, value: 'bar'}
162
177
  * ];
163
- * const myState = new ArrayState(data);
178
+ * const myState = new UmbArrayState(data);
164
179
  * myState.append({ key: 1, value: 'replaced-foo'});
165
180
  */
166
181
  appendOne(entry: T): this;
167
182
  /**
168
183
  * @method append
169
184
  * @param {T[]} entries - A array of new data to be added in this Subject.
170
- * @return {ArrayState<T>} Reference to it self.
185
+ * @return {UmbArrayState<T>} Reference to it self.
171
186
  * @description - Append some new data to this Subject, if it compares to existing data it will replace it.
172
187
  * @example <caption>Example append some data.</caption>
173
188
  * const data = [
174
189
  * { key: 1, value: 'foo'},
175
190
  * { key: 2, value: 'bar'}
176
191
  * ];
177
- * const myState = new ArrayState(data);
192
+ * const myState = new UmbArrayState(data);
178
193
  * myState.append([
179
194
  * { key: 1, value: 'replaced-foo'},
180
195
  * { key: 3, value: 'another-bla'}
181
196
  * ]);
182
197
  */
183
198
  append(entries: T[]): this;
199
+ /**
200
+ * @method updateOne
201
+ * @param {unknown} unique - Unique value to find entry to update.
202
+ * @param {Partial<T>} entry - new data to be added in this Subject.
203
+ * @return {UmbArrayState<T>} Reference to it self.
204
+ * @description - Update a item with some new data, requires the ArrayState to be constructed with a getUnique method.
205
+ * @example <caption>Example append some data.</caption>
206
+ * const data = [
207
+ * { key: 1, value: 'foo'},
208
+ * { key: 2, value: 'bar'}
209
+ * ];
210
+ * const myState = new UmbArrayState(data, (x) => x.key);
211
+ * myState.updateOne(2, {value: 'updated-bar'});
212
+ */
213
+ updateOne(unique: unknown, entry: Partial<T>): this;
184
214
  }
185
215
 
186
216
  /**
187
217
  * @export
188
- * @class ObjectState
189
- * @extends {DeepState<T>}
218
+ * @class UmbObjectState
219
+ * @extends {UmbDeepState<T>}
190
220
  * @description - A RxJS BehaviorSubject which deepFreezes the object-data to ensure its not manipulated from any implementations.
191
221
  * Additionally the Subject ensures the data is unique, not updating any Observes unless there is an actual change of the content.
192
222
  *
193
- * The ObjectState provides methods to append data when the data is an Object.
223
+ * The UmbObjectState provides methods to append data when the data is an Object.
194
224
  */
195
- declare class ObjectState<T> extends DeepState<T> {
225
+ declare class UmbObjectState<T> extends UmbDeepState<T> {
196
226
  /**
197
227
  * @method update
198
228
  * @param {Partial<T>} partialData - A object containing some of the data to update in this Subject.
199
229
  * @description - Append some new data to this Object.
200
- * @return {ObjectState<T>} Reference to it self.
230
+ * @return {UmbObjectState<T>} Reference to it self.
201
231
  * @example <caption>Example append some data.</caption>
202
232
  * const data = {key: 'myKey', value: 'myInitialValue'};
203
- * const myState = new ObjectState(data);
233
+ * const myState = new UmbObjectState(data);
204
234
  * myState.update({value: 'myNewValue'});
205
235
  */
206
236
  update(partialData: Partial<T>): this;
@@ -225,13 +255,25 @@ declare function createObservablePart<R, T>(source$: Observable<T>, mappingFunct
225
255
  * @param {(mappable: T) => R} mappingFunction - Method to return the part for this Observable to return.
226
256
  * @param {(previousResult: R, currentResult: R) => boolean} [memoizationFunction] - Method to Compare if the data has changed. Should return true when data is different.
227
257
  * @description - Creates a RxJS Observable from RxJS Subject.
228
- * @example <caption>Example append new entry for 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>
229
- * const entry = {key: 'myKey', value: 'myValue'};
230
- * const newDataSet = appendToFrozenArray(mySubject.getValue(), entry, x => x.key === key);
258
+ * @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>
259
+ * const entry = {id: 'myKey', value: 'myValue'};
260
+ * const newDataSet = appendToFrozenArray(mySubject.getValue(), entry, x => x.id === id);
231
261
  * mySubject.next(newDataSet);
232
262
  */
233
263
  declare function appendToFrozenArray<T>(data: T[], entry: T, getUniqueMethod?: (entry: T) => unknown): T[];
234
264
 
265
+ /**
266
+ * @export
267
+ * @method filterFrozenArray
268
+ * @param {Array<T>} data - RxJS Subject to use for this Observable.
269
+ * @param {(entry: T) => boolean} filterMethod - Method to filter the array.
270
+ * @description - Creates a RxJS Observable from RxJS Subject.
271
+ * @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>
272
+ * const newDataSet = filterFrozenArray(mySubject.getValue(), x => x.id !== "myKey");
273
+ * mySubject.next(newDataSet);
274
+ */
275
+ declare function filterFrozenArray<T>(data: T[], filterMethod: (entry: T) => boolean): T[];
276
+
235
277
  /**
236
278
  * @export
237
279
  * @method partialUpdateFrozenArray
@@ -239,11 +281,11 @@ declare function appendToFrozenArray<T>(data: T[], entry: T, getUniqueMethod?: (
239
281
  * @param {(mappable: T) => R} mappingFunction - Method to return the part for this Observable to return.
240
282
  * @param {(previousResult: R, currentResult: R) => boolean} [memoizationFunction] - Method to Compare if the data has changed. Should return true when data is different.
241
283
  * @description - Creates a RxJS Observable from RxJS Subject.
242
- * @example <caption>Example append new entry for 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>
284
+ * @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>
243
285
  * const partialEntry = {value: 'myValue'};
244
286
  * const newDataSet = partialUpdateFrozenArray(mySubject.getValue(), partialEntry, x => x.key === 'myKey');
245
287
  * mySubject.next(newDataSet);
246
288
  */
247
289
  declare function partialUpdateFrozenArray<T>(data: T[], partialEntry: Partial<T>, findMethod: (entry: T) => boolean): T[];
248
290
 
249
- export { ArrayState, BooleanState, ClassState, DeepState, NumberState, ObjectState, StringState, UmbObserver, UmbObserverController, appendToFrozenArray, createObservablePart, partialUpdateFrozenArray };
291
+ export { MappingFunction, UmbArrayState, UmbBasicState, UmbBooleanState, UmbClassState, UmbDeepState, UmbNumberState, UmbObjectState, UmbObserver, UmbObserverController, UmbStringState, appendToFrozenArray, createObservablePart, filterFrozenArray, partialUpdateFrozenArray };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umbraco-cms/backoffice",
3
- "version": "1.0.0-next.37dcc47c",
3
+ "version": "1.0.0-next.386e13e7",
4
4
  "license": "MIT",
5
5
  "keywords": [
6
6
  "umbraco",
@@ -20,11 +20,14 @@
20
20
  },
21
21
  "type": "module",
22
22
  "files": [
23
- "*.d.ts"
23
+ "*.d.ts",
24
+ "*.json",
25
+ "*.md"
24
26
  ],
25
27
  "peerDependencies": {
26
28
  "@types/uuid": "^9.0.1",
27
- "@umbraco-ui/uui": "^1.2.0-rc.0",
29
+ "@umbraco-ui/uui": "1.2.1",
28
30
  "rxjs": "^7.8.0"
29
- }
31
+ },
32
+ "customElements": "custom-elements.json"
30
33
  }
@@ -0,0 +1,25 @@
1
+ import * as rxjs from 'rxjs';
2
+ import { UmbItemRepository } from '@umbraco-cms/backoffice/repository';
3
+ import { UmbControllerHostElement } from '@umbraco-cms/backoffice/controller-api';
4
+ import { UmbModalToken, UmbModalContext, UmbPickerModalData } 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
+ pickableFilter?: (item: ItemType) => boolean;
14
+ selection: rxjs.Observable<string[]>;
15
+ selectedItems: rxjs.Observable<ItemType[]>;
16
+ max: number;
17
+ min: number;
18
+ constructor(host: UmbControllerHostElement, repositoryAlias: string, modalAlias: string | UmbModalToken, getUniqueMethod?: (entry: ItemType) => string | undefined);
19
+ getSelection(): string[];
20
+ setSelection(selection: string[]): void;
21
+ openPicker(pickerData?: Partial<UmbPickerModalData<ItemType>>): void;
22
+ requestRemoveItem(unique: string): Promise<void>;
23
+ }
24
+
25
+ export { UmbPickerInputContext };
package/repository.d.ts CHANGED
@@ -1,65 +1,156 @@
1
- import { ProblemDetailsModel, PagedEntityTreeItemResponseModel, EntityTreeItemResponseModel } from './backend-api';
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, UmbItemRepository as UmbItemRepository$1 } from '@umbraco-cms/backoffice/repository';
3
+ import * as rxjs from 'rxjs';
2
4
  import { Observable } from 'rxjs';
3
- import { DataSourceResponse as DataSourceResponse$1 } from './repository';
5
+ import { UmbTreeRootModel, UmbTreeRootEntityModel } from '@umbraco-cms/backoffice/tree';
6
+ import { UmbControllerHostElement } from '@umbraco-cms/backoffice/controller-api';
7
+ import { UmbObserverController } from '@umbraco-cms/backoffice/observable-api';
4
8
 
5
- interface DataSourceResponse<T = undefined> {
9
+ interface DataSourceResponse<T = undefined> extends UmbDataSourceErrorResponse {
6
10
  data?: T;
11
+ }
12
+ interface UmbDataSourceErrorResponse {
13
+ error?: ApiError | CancelError;
14
+ }
15
+
16
+ interface UmbDataSource<CreateRequestType, CreateResponseType, UpdateRequestType, ResponseType> {
17
+ createScaffold(parentId: string | null): Promise<DataSourceResponse$1<CreateRequestType>>;
18
+ get(unique: string): Promise<DataSourceResponse$1<ResponseType>>;
19
+ insert(data: CreateRequestType): Promise<DataSourceResponse$1<CreateResponseType>>;
20
+ update(unique: string, data: UpdateRequestType): Promise<DataSourceResponse$1<ResponseType>>;
21
+ delete(unique: string): Promise<DataSourceResponse$1>;
22
+ }
23
+
24
+ interface UmbFolderDataSource {
25
+ createScaffold(parentId: string | null): Promise<DataSourceResponse<FolderReponseModel>>;
26
+ get(unique: string): Promise<DataSourceResponse<FolderReponseModel>>;
27
+ insert(data: CreateFolderRequestModel): Promise<DataSourceResponse<string>>;
28
+ update(unique: string, data: CreateFolderRequestModel): Promise<DataSourceResponse<UpdateFolderReponseModel>>;
29
+ delete(unique: string): Promise<DataSourceResponse>;
30
+ }
31
+
32
+ interface UmbPagedData<T> {
33
+ total: number;
34
+ items: Array<T>;
35
+ }
36
+ interface UmbTreeRepository<TreeItemType extends TreeItemPresentationModel, TreeRootType extends UmbTreeRootModel = UmbTreeRootEntityModel> {
37
+ requestTreeRoot: () => Promise<{
38
+ data?: TreeRootType;
39
+ error?: ProblemDetailsModel;
40
+ }>;
41
+ requestRootTreeItems: () => Promise<{
42
+ data?: UmbPagedData<TreeItemType>;
43
+ error?: ProblemDetailsModel;
44
+ asObservable?: () => Observable<TreeItemType[]>;
45
+ }>;
46
+ requestTreeItemsOf: (parentUnique: string | null) => Promise<{
47
+ data?: UmbPagedData<TreeItemType>;
48
+ error?: ProblemDetailsModel;
49
+ asObservable?: () => Observable<TreeItemType[]>;
50
+ }>;
51
+ requestItemsLegacy?: (uniques: string[]) => Promise<{
52
+ data?: Array<TreeItemType>;
53
+ error?: ProblemDetailsModel;
54
+ asObservable?: () => Observable<any[]>;
55
+ }>;
56
+ rootTreeItems: () => Promise<Observable<TreeItemType[]>>;
57
+ treeItemsOf: (parentUnique: string | null) => Promise<Observable<TreeItemType[]>>;
58
+ itemsLegacy?: (uniques: string[]) => Promise<Observable<any[]>>;
59
+ }
60
+
61
+ interface UmbTreeDataSource<ItemType = any, PagedItemType = UmbPagedData<ItemType>> {
62
+ getRootItems(): Promise<DataSourceResponse<PagedItemType>>;
63
+ getChildrenOf(parentUnique: string | null): Promise<DataSourceResponse<PagedItemType>>;
64
+ getItems(unique: Array<string>): Promise<DataSourceResponse<Array<any>>>;
65
+ }
66
+
67
+ interface UmbItemDataSource<ItemType> {
68
+ getItems(unique: Array<string>): Promise<DataSourceResponse$1<Array<ItemType>>>;
69
+ }
70
+
71
+ interface UmbMoveDataSource {
72
+ move(unique: string, targetUnique: string | null): Promise<UmbDataSourceErrorResponse$1>;
73
+ }
74
+
75
+ interface UmbCopyDataSource {
76
+ copy(unique: string, targetUnique: string | null): Promise<DataSourceResponse$1<string>>;
77
+ }
78
+
79
+ interface UmbCollectionDataSource<ItemType = any, PagedItemType = UmbPagedData<ItemType>> {
80
+ getCollection(): Promise<DataSourceResponse<PagedItemType>>;
81
+ filterCollection(filter: any): Promise<DataSourceResponse<PagedItemType>>;
82
+ }
83
+
84
+ interface UmbRepositoryErrorResponse {
7
85
  error?: ProblemDetailsModel;
8
86
  }
87
+ interface UmbRepositoryResponse<T> extends UmbRepositoryErrorResponse {
88
+ data?: T;
89
+ }
90
+ interface UmbDetailRepository<CreateRequestType = any, CreateResponseType = any, UpdateRequestType = any, ResponseType = any> {
91
+ createScaffold(parentId: string | null): Promise<UmbRepositoryResponse<CreateRequestType>>;
92
+ requestById(id: string): Promise<UmbRepositoryResponse<ResponseType>>;
93
+ byId(id: string): Promise<Observable<ResponseType>>;
94
+ create(data: CreateRequestType): Promise<UmbRepositoryResponse<CreateResponseType>>;
95
+ save(id: string, data: UpdateRequestType): Promise<UmbRepositoryErrorResponse>;
96
+ delete(id: string): Promise<UmbRepositoryErrorResponse>;
97
+ }
9
98
 
10
- interface UmbDetailRepository<DetailType> {
11
- createScaffold(parentKey: string | null): Promise<{
12
- data?: DetailType;
99
+ interface UmbFolderRepository {
100
+ createFolderScaffold(parentId: string | null): Promise<{
101
+ data?: FolderReponseModel;
13
102
  error?: ProblemDetailsModel;
14
103
  }>;
15
- requestByKey(key: string): Promise<{
16
- data?: DetailType;
104
+ createFolder(folderRequest: CreateFolderRequestModel): Promise<{
105
+ data?: string;
17
106
  error?: ProblemDetailsModel;
18
107
  }>;
19
- create(data: DetailType): Promise<{
108
+ requestFolder(unique: string): Promise<{
109
+ data?: FolderReponseModel;
20
110
  error?: ProblemDetailsModel;
21
111
  }>;
22
- save(data: DetailType): Promise<{
112
+ updateFolder(unique: string, folder: FolderModelBaseModel): Promise<{
113
+ data?: UpdateFolderReponseModel;
23
114
  error?: ProblemDetailsModel;
24
115
  }>;
25
- delete(key: string): Promise<{
116
+ deleteFolder(id: string): Promise<{
26
117
  error?: ProblemDetailsModel;
27
118
  }>;
28
119
  }
29
120
 
30
- interface UmbTreeRepository {
31
- requestRootTreeItems: () => Promise<{
32
- data: PagedEntityTreeItemResponseModel | undefined;
33
- error: ProblemDetailsModel | undefined;
34
- asObservable?: () => Observable<EntityTreeItemResponseModel[]>;
35
- }>;
36
- requestTreeItemsOf: (parentKey: string | null) => Promise<{
37
- data: PagedEntityTreeItemResponseModel | undefined;
38
- error: ProblemDetailsModel | undefined;
39
- asObservable?: () => Observable<EntityTreeItemResponseModel[]>;
40
- }>;
41
- requestTreeItems: (keys: string[]) => Promise<{
42
- data: Array<EntityTreeItemResponseModel> | undefined;
43
- error: ProblemDetailsModel | undefined;
44
- asObservable?: () => Observable<EntityTreeItemResponseModel[]>;
121
+ interface UmbCollectionRepository {
122
+ requestCollection(filter?: any): Promise<any>;
123
+ }
124
+
125
+ interface UmbItemRepository<ItemType extends ItemResponseModelBaseModel> {
126
+ requestItems: (uniques: string[]) => Promise<{
127
+ data?: Array<ItemType> | undefined;
128
+ error?: ProblemDetailsModel | undefined;
129
+ asObservable?: () => Observable<Array<ItemType>>;
45
130
  }>;
46
- rootTreeItems: () => Promise<Observable<EntityTreeItemResponseModel[]>>;
47
- treeItemsOf: (parentKey: string | null) => Promise<Observable<EntityTreeItemResponseModel[]>>;
48
- treeItems: (keys: string[]) => Promise<Observable<EntityTreeItemResponseModel[]>>;
131
+ items: (uniques: string[]) => Promise<Observable<Array<ItemType>>>;
132
+ }
133
+
134
+ interface UmbMoveRepository {
135
+ move(unique: string, targetUnique: string): Promise<UmbRepositoryErrorResponse>;
49
136
  }
50
137
 
51
- interface RepositoryTreeDataSource {
52
- getRootItems(): Promise<DataSourceResponse$1<PagedEntityTreeItemResponseModel>>;
53
- getChildrenOf(parentKey: string): Promise<DataSourceResponse$1<PagedEntityTreeItemResponseModel>>;
54
- getItems(key: Array<string>): Promise<DataSourceResponse$1<EntityTreeItemResponseModel[]>>;
138
+ interface UmbCopyRepository {
139
+ copy(unique: string, targetUnique: string): Promise<UmbRepositoryResponse<string>>;
55
140
  }
56
141
 
57
- interface RepositoryDetailDataSource<DetailType> {
58
- createScaffold(parentKey: string | null): Promise<DataSourceResponse$1<DetailType>>;
59
- get(key: string): Promise<DataSourceResponse$1<DetailType>>;
60
- insert(data: DetailType): Promise<DataSourceResponse$1<DetailType>>;
61
- update(data: DetailType): Promise<DataSourceResponse$1<DetailType>>;
62
- delete(key: string): Promise<DataSourceResponse$1<DetailType>>;
142
+ declare class UmbRepositoryItemsManager<ItemType extends ItemResponseModelBaseModel> {
143
+ #private;
144
+ host: UmbControllerHostElement;
145
+ repository?: UmbItemRepository$1<ItemType>;
146
+ init: Promise<unknown>;
147
+ uniques: rxjs.Observable<string[]>;
148
+ items: rxjs.Observable<ItemType[]>;
149
+ itemsObserver?: UmbObserverController<ItemType[]>;
150
+ constructor(host: UmbControllerHostElement, repositoryAlias: string, getUniqueMethod?: (entry: ItemType) => string | undefined);
151
+ getUniques(): string[];
152
+ setUniques(uniques: string[]): void;
153
+ getItems(): ItemType[];
63
154
  }
64
155
 
65
- export { DataSourceResponse, RepositoryDetailDataSource, RepositoryTreeDataSource, UmbDetailRepository, UmbTreeRepository };
156
+ export { DataSourceResponse, UmbCollectionDataSource, UmbCollectionRepository, UmbCopyDataSource, UmbCopyRepository, UmbDataSource, UmbDataSourceErrorResponse, UmbDetailRepository, UmbFolderDataSource, UmbFolderRepository, UmbItemDataSource, UmbItemRepository, UmbMoveDataSource, UmbMoveRepository, UmbPagedData, UmbRepositoryErrorResponse, UmbRepositoryItemsManager, UmbRepositoryResponse, UmbTreeDataSource, UmbTreeRepository };