@umbraco-cms/backoffice 14.0.0--preview004-7a741834 → 14.0.0--preview004-e1502383

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (23) hide show
  1. package/dist-cms/packages/core/data-type/repository/detail/data-type-detail.repository.d.ts +3 -20
  2. package/dist-cms/packages/core/data-type/repository/detail/data-type-detail.repository.js +3 -71
  3. package/dist-cms/packages/core/data-type/repository/detail/data-type-detail.store.d.ts +4 -10
  4. package/dist-cms/packages/core/data-type/repository/detail/data-type-detail.store.js +4 -13
  5. package/dist-cms/packages/core/repository/data-source/data-source.interface.d.ts +0 -7
  6. package/dist-cms/packages/core/repository/detail/detail-data-source.interface.d.ts +12 -0
  7. package/dist-cms/packages/core/repository/detail/detail-data-source.interface.js +1 -0
  8. package/dist-cms/packages/core/repository/detail/detail-repository-base.d.ts +63 -0
  9. package/dist-cms/packages/core/repository/detail/detail-repository-base.js +120 -0
  10. package/dist-cms/packages/core/repository/detail/index.d.ts +2 -0
  11. package/dist-cms/packages/core/repository/detail/index.js +1 -0
  12. package/dist-cms/packages/core/repository/index.d.ts +1 -0
  13. package/dist-cms/packages/core/repository/index.js +1 -0
  14. package/dist-cms/packages/core/repository/repository-base.d.ts +1 -1
  15. package/dist-cms/packages/core/repository/repository-base.js +1 -0
  16. package/dist-cms/packages/core/store/detail-store-base.d.ts +25 -0
  17. package/dist-cms/packages/core/store/detail-store-base.js +26 -0
  18. package/dist-cms/packages/core/store/detail-store.interface.d.ts +8 -0
  19. package/dist-cms/packages/core/store/detail-store.interface.js +1 -0
  20. package/dist-cms/packages/core/store/index.d.ts +2 -0
  21. package/dist-cms/packages/core/store/index.js +1 -0
  22. package/dist-cms/tsconfig.build.tsbuildinfo +1 -1
  23. package/package.json +1 -1
@@ -1,25 +1,8 @@
1
1
  import { UmbDataTypeDetailModel } from '../../types.js';
2
2
  import { type UmbControllerHost } from '../../../../../libs/controller-api/index.js';
3
- import { UmbRepositoryBase } from '../../../repository/index.js';
4
- export declare class UmbDataTypeDetailRepository extends UmbRepositoryBase {
3
+ import { UmbDetailRepositoryBase } from '../../../repository/index.js';
4
+ export declare class UmbDataTypeDetailRepository extends UmbDetailRepositoryBase<UmbDataTypeDetailModel> {
5
5
  #private;
6
6
  constructor(host: UmbControllerHost);
7
- createScaffold(parentUnique: string | null): Promise<import("../../../repository/index.js").DataSourceResponse<UmbDataTypeDetailModel>>;
8
- requestByUnique(unique: string): Promise<{
9
- data: UmbDataTypeDetailModel | undefined;
10
- error: import("../../../../../external/backend-api/index.js").ApiError | import("../../../../../external/backend-api/index.js").CancelError | undefined;
11
- asObservable: () => import("rxjs").Observable<UmbDataTypeDetailModel | undefined>;
12
- }>;
13
- byUnique(unique: string): Promise<import("rxjs").Observable<UmbDataTypeDetailModel | undefined>>;
14
- byPropertyEditorUiAlias(propertyEditorUiAlias: string): Promise<import("rxjs").Observable<UmbDataTypeDetailModel[]>>;
15
- create(dataType: UmbDataTypeDetailModel): Promise<{
16
- error: import("../../../../../external/backend-api/index.js").ApiError | import("../../../../../external/backend-api/index.js").CancelError | undefined;
17
- }>;
18
- save(dataType: UmbDataTypeDetailModel): Promise<{
19
- data: UmbDataTypeDetailModel | undefined;
20
- error: import("../../../../../external/backend-api/index.js").ApiError | import("../../../../../external/backend-api/index.js").CancelError | undefined;
21
- }>;
22
- delete(unique: string): Promise<{
23
- error: import("../../../../../external/backend-api/index.js").ApiError | import("../../../../../external/backend-api/index.js").CancelError | undefined;
24
- }>;
7
+ byPropertyEditorUiAlias(propertyEditorUiAlias: string): Promise<import("rxjs").Observable<any[]>>;
25
8
  }
@@ -1,89 +1,21 @@
1
1
  import { UmbDataTypeServerDataSource } from './data-type-detail.server.data-source.js';
2
2
  import { UMB_DATA_TYPE_DETAIL_STORE_CONTEXT } from './data-type-detail.store.js';
3
- import { UmbRepositoryBase } from '../../../repository/index.js';
4
- import { UMB_NOTIFICATION_CONTEXT_TOKEN } from '../../../notification/index.js';
5
- export class UmbDataTypeDetailRepository extends UmbRepositoryBase {
3
+ import { UmbDetailRepositoryBase } from '../../../repository/index.js';
4
+ export class UmbDataTypeDetailRepository extends UmbDetailRepositoryBase {
6
5
  #init;
7
6
  #detailStore;
8
- #detailSource;
9
- #notificationContext;
10
7
  constructor(host) {
11
- super(host);
12
- this.#detailSource = new UmbDataTypeServerDataSource(host);
8
+ super(host, UmbDataTypeServerDataSource, UMB_DATA_TYPE_DETAIL_STORE_CONTEXT);
13
9
  this.#init = Promise.all([
14
10
  this.consumeContext(UMB_DATA_TYPE_DETAIL_STORE_CONTEXT, (instance) => {
15
11
  this.#detailStore = instance;
16
12
  }).asPromise(),
17
- this.consumeContext(UMB_NOTIFICATION_CONTEXT_TOKEN, (instance) => {
18
- this.#notificationContext = instance;
19
- }).asPromise(),
20
13
  ]);
21
14
  }
22
- async createScaffold(parentUnique) {
23
- if (parentUnique === undefined)
24
- throw new Error('Parent unique is missing');
25
- return this.#detailSource.createScaffold(parentUnique);
26
- }
27
- async requestByUnique(unique) {
28
- if (!unique)
29
- throw new Error('Key is missing');
30
- await this.#init;
31
- const { data, error } = await this.#detailSource.read(unique);
32
- if (data) {
33
- this.#detailStore.append(data);
34
- }
35
- return { data, error, asObservable: () => this.#detailStore.byUnique(unique) };
36
- }
37
- async byUnique(unique) {
38
- if (!unique)
39
- throw new Error('Unique is missing');
40
- await this.#init;
41
- return this.#detailStore.byUnique(unique);
42
- }
43
15
  async byPropertyEditorUiAlias(propertyEditorUiAlias) {
44
16
  if (!propertyEditorUiAlias)
45
17
  throw new Error('propertyEditorUiAlias is missing');
46
18
  await this.#init;
47
19
  return this.#detailStore.withPropertyEditorUiAlias(propertyEditorUiAlias);
48
20
  }
49
- async create(dataType) {
50
- if (!dataType)
51
- throw new Error('Data Type is missing');
52
- if (!dataType.unique)
53
- throw new Error('Data Type unique is missing');
54
- await this.#init;
55
- const { error } = await this.#detailSource.create(dataType);
56
- if (!error) {
57
- this.#detailStore?.append(dataType);
58
- const notification = { data: { message: `Data Type created` } };
59
- this.#notificationContext.peek('positive', notification);
60
- }
61
- return { error };
62
- }
63
- async save(dataType) {
64
- if (!dataType)
65
- throw new Error('Data Type is missing');
66
- if (!dataType.unique)
67
- throw new Error('Data Type unique is missing');
68
- await this.#init;
69
- const { data, error } = await this.#detailSource.update(dataType);
70
- if (data) {
71
- this.#detailStore.updateItem(data.unique, data);
72
- const notification = { data: { message: `Data Type saved` } };
73
- this.#notificationContext.peek('positive', notification);
74
- }
75
- return { data, error };
76
- }
77
- async delete(unique) {
78
- if (!unique)
79
- throw new Error('Data Type unique is missing');
80
- await this.#init;
81
- const { error } = await this.#detailSource.delete(unique);
82
- if (!error) {
83
- this.#detailStore.removeItem(unique);
84
- const notification = { data: { message: `Data Type deleted` } };
85
- this.#notificationContext.peek('positive', notification);
86
- }
87
- return { error };
88
- }
89
21
  }
@@ -1,26 +1,20 @@
1
1
  import { UmbDataTypeDetailModel } from '../../types.js';
2
2
  import { UmbContextToken } from '../../../../../libs/context-api/index.js';
3
- import { UmbStoreBase } from '../../../store/index.js';
3
+ import { UmbDetailStoreBase } from '../../../store/index.js';
4
4
  import { UmbControllerHostElement } from '../../../../../libs/controller-api/index.js';
5
- export declare const UMB_DATA_TYPE_DETAIL_STORE_CONTEXT: UmbContextToken<UmbDataTypeDetailStore, UmbDataTypeDetailStore>;
6
5
  /**
7
6
  * @export
8
7
  * @class UmbDataTypeDetailStore
9
8
  * @extends {UmbStoreBase}
10
9
  * @description - Data Store for Data Type Details
11
10
  */
12
- export declare class UmbDataTypeDetailStore extends UmbStoreBase<UmbDataTypeDetailModel> {
11
+ export declare class UmbDataTypeDetailStore extends UmbDetailStoreBase<UmbDataTypeDetailModel> {
13
12
  /**
14
13
  * Creates an instance of UmbDataTypeDetailStore.
15
14
  * @param {UmbControllerHostElement} host
16
15
  * @memberof UmbDataTypeDetailStore
17
16
  */
18
17
  constructor(host: UmbControllerHostElement);
19
- /**
20
- * Retrieve a data-type from the store
21
- * @param {unique} string unique
22
- * @memberof UmbDataTypeDetailStore
23
- */
24
- byUnique(unique: UmbDataTypeDetailModel['unique']): import("rxjs").Observable<UmbDataTypeDetailModel | undefined>;
25
- withPropertyEditorUiAlias(propertyEditorUiAlias: string): import("rxjs").Observable<UmbDataTypeDetailModel[]>;
18
+ withPropertyEditorUiAlias(propertyEditorUiAlias: string): import("rxjs").Observable<any[]>;
26
19
  }
20
+ export declare const UMB_DATA_TYPE_DETAIL_STORE_CONTEXT: UmbContextToken<UmbDataTypeDetailStore, UmbDataTypeDetailStore>;
@@ -1,32 +1,23 @@
1
1
  import { UmbContextToken } from '../../../../../libs/context-api/index.js';
2
- import { UmbArrayState } from '../../../../../libs/observable-api/index.js';
3
- import { UmbStoreBase } from '../../../store/index.js';
4
- export const UMB_DATA_TYPE_DETAIL_STORE_CONTEXT = new UmbContextToken('UmbDataTypeDetailStore');
2
+ import { UmbDetailStoreBase } from '../../../store/index.js';
5
3
  /**
6
4
  * @export
7
5
  * @class UmbDataTypeDetailStore
8
6
  * @extends {UmbStoreBase}
9
7
  * @description - Data Store for Data Type Details
10
8
  */
11
- export class UmbDataTypeDetailStore extends UmbStoreBase {
9
+ export class UmbDataTypeDetailStore extends UmbDetailStoreBase {
12
10
  /**
13
11
  * Creates an instance of UmbDataTypeDetailStore.
14
12
  * @param {UmbControllerHostElement} host
15
13
  * @memberof UmbDataTypeDetailStore
16
14
  */
17
15
  constructor(host) {
18
- super(host, UMB_DATA_TYPE_DETAIL_STORE_CONTEXT.toString(), new UmbArrayState([], (x) => x.unique));
19
- }
20
- /**
21
- * Retrieve a data-type from the store
22
- * @param {unique} string unique
23
- * @memberof UmbDataTypeDetailStore
24
- */
25
- byUnique(unique) {
26
- return this._data.asObservablePart((x) => x.find((y) => y.unique === unique));
16
+ super(host, UMB_DATA_TYPE_DETAIL_STORE_CONTEXT.toString());
27
17
  }
28
18
  withPropertyEditorUiAlias(propertyEditorUiAlias) {
29
19
  // TODO: Use a model for the data-type tree items: ^^Most likely it should be parsed to the UmbEntityTreeStore as a generic type.
30
20
  return this._data.asObservablePart((items) => items.filter((item) => item.propertyEditorUiAlias === propertyEditorUiAlias));
31
21
  }
32
22
  }
23
+ export const UMB_DATA_TYPE_DETAIL_STORE_CONTEXT = new UmbContextToken('UmbDataTypeDetailStore');
@@ -6,10 +6,3 @@ export interface UmbDataSource<CreateRequestType, CreateResponseType, UpdateRequ
6
6
  update(unique: string, data: UpdateRequestType): Promise<DataSourceResponse<ResponseType>>;
7
7
  delete(unique: string): Promise<DataSourceResponse>;
8
8
  }
9
- export interface UmbDetailDataSource<DetailType> {
10
- createScaffold(parentUnique: string | null, preset?: Partial<DetailType>): Promise<DataSourceResponse<DetailType>>;
11
- create(data: DetailType): Promise<DataSourceResponse<DetailType>>;
12
- read(unique: string): Promise<DataSourceResponse<DetailType>>;
13
- update(data: DetailType): Promise<DataSourceResponse<DetailType>>;
14
- delete(unique: string): Promise<DataSourceResponse>;
15
- }
@@ -0,0 +1,12 @@
1
+ import { DataSourceResponse } from '../data-source/index.js';
2
+ import { UmbControllerHost } from '../../../../libs/controller-api/index.js';
3
+ export interface UmbDetailDataSourceConstructor<DetailType = any> {
4
+ new (host: UmbControllerHost): UmbDetailDataSource<DetailType>;
5
+ }
6
+ export interface UmbDetailDataSource<DetailType> {
7
+ createScaffold(parentUnique: string | null, preset?: Partial<DetailType>): Promise<DataSourceResponse<DetailType>>;
8
+ create(data: DetailType): Promise<DataSourceResponse<DetailType>>;
9
+ read(unique: string): Promise<DataSourceResponse<DetailType>>;
10
+ update(data: DetailType): Promise<DataSourceResponse<DetailType>>;
11
+ delete(unique: string): Promise<DataSourceResponse>;
12
+ }
@@ -0,0 +1,63 @@
1
+ import { UmbRepositoryBase } from '../repository-base.js';
2
+ import { UmbDetailDataSourceConstructor } from './detail-data-source.interface.js';
3
+ import { type UmbControllerHost } from '../../../../libs/controller-api/index.js';
4
+ import { UmbContextToken } from '../../../../libs/context-api/index.js';
5
+ export declare abstract class UmbDetailRepositoryBase<DetailModelType extends {
6
+ unique: string;
7
+ }> extends UmbRepositoryBase {
8
+ #private;
9
+ constructor(host: UmbControllerHost, detailSource: UmbDetailDataSourceConstructor<DetailModelType>, itemStoreContextAlias: string | UmbContextToken<any, any>);
10
+ /**
11
+ * Creates a scaffold
12
+ * @param {(string | null)} parentUnique
13
+ * @return {*}
14
+ * @memberof UmbDetailRepositoryBase
15
+ */
16
+ createScaffold(parentUnique: string | null): Promise<import("../index.js").DataSourceResponse<DetailModelType>>;
17
+ /**
18
+ * Requests the detail for the given unique
19
+ * @param {string} unique
20
+ * @return {*}
21
+ * @memberof UmbDetailRepositoryBase
22
+ */
23
+ requestByUnique(unique: string): Promise<{
24
+ data: DetailModelType | undefined;
25
+ error: import("../../../../external/backend-api/index.js").ApiError | import("../../../../external/backend-api/index.js").CancelError | undefined;
26
+ asObservable: () => import("rxjs").Observable<DetailModelType>;
27
+ }>;
28
+ /**
29
+ * Returns a promise with an observable of the detail for the given unique
30
+ * @param {string} unique
31
+ * @return {*}
32
+ * @memberof UmbDetailRepositoryBase
33
+ */
34
+ create(data: DetailModelType): Promise<{
35
+ error: import("../../../../external/backend-api/index.js").ApiError | import("../../../../external/backend-api/index.js").CancelError | undefined;
36
+ }>;
37
+ /**
38
+ * Saves the given data
39
+ * @param {DetailModelType} data
40
+ * @return {*}
41
+ * @memberof UmbDetailRepositoryBase
42
+ */
43
+ save(data: DetailModelType): Promise<{
44
+ data: DetailModelType;
45
+ error: import("../../../../external/backend-api/index.js").ApiError | import("../../../../external/backend-api/index.js").CancelError | undefined;
46
+ }>;
47
+ /**
48
+ * Deletes the detail for the given unique
49
+ * @param {string} unique
50
+ * @return {*}
51
+ * @memberof UmbDetailRepositoryBase
52
+ */
53
+ delete(unique: string): Promise<{
54
+ error: import("../../../../external/backend-api/index.js").ApiError | import("../../../../external/backend-api/index.js").CancelError | undefined;
55
+ }>;
56
+ /**
57
+ * Returns a promise with an observable of the detail for the given unique
58
+ * @param {string} unique
59
+ * @return {*}
60
+ * @memberof UmbDetailRepositoryBase
61
+ */
62
+ byUnique(unique: string): Promise<import("rxjs").Observable<DetailModelType>>;
63
+ }
@@ -0,0 +1,120 @@
1
+ import { UmbRepositoryBase } from '../repository-base.js';
2
+ import { UMB_NOTIFICATION_CONTEXT_TOKEN } from '../../notification/index.js';
3
+ export class UmbDetailRepositoryBase extends UmbRepositoryBase {
4
+ #init;
5
+ #detailStore;
6
+ #detailSource;
7
+ #notificationContext;
8
+ constructor(host, detailSource, itemStoreContextAlias) {
9
+ super(host);
10
+ this.#detailSource = new detailSource(host);
11
+ this.#init = Promise.all([
12
+ this.consumeContext(itemStoreContextAlias, (instance) => {
13
+ this.#detailStore = instance;
14
+ }).asPromise(),
15
+ this.consumeContext(UMB_NOTIFICATION_CONTEXT_TOKEN, (instance) => {
16
+ this.#notificationContext = instance;
17
+ }).asPromise(),
18
+ ]);
19
+ }
20
+ /**
21
+ * Creates a scaffold
22
+ * @param {(string | null)} parentUnique
23
+ * @return {*}
24
+ * @memberof UmbDetailRepositoryBase
25
+ */
26
+ async createScaffold(parentUnique) {
27
+ if (parentUnique === undefined)
28
+ throw new Error('Parent unique is missing');
29
+ return this.#detailSource.createScaffold(parentUnique);
30
+ }
31
+ /**
32
+ * Requests the detail for the given unique
33
+ * @param {string} unique
34
+ * @return {*}
35
+ * @memberof UmbDetailRepositoryBase
36
+ */
37
+ async requestByUnique(unique) {
38
+ if (!unique)
39
+ throw new Error('Key is missing');
40
+ await this.#init;
41
+ const { data, error } = await this.#detailSource.read(unique);
42
+ if (data) {
43
+ this.#detailStore.append(data);
44
+ }
45
+ return { data, error, asObservable: () => this.#detailStore.byUnique(unique) };
46
+ }
47
+ /**
48
+ * Returns a promise with an observable of the detail for the given unique
49
+ * @param {string} unique
50
+ * @return {*}
51
+ * @memberof UmbDetailRepositoryBase
52
+ */
53
+ async create(data) {
54
+ if (!data)
55
+ throw new Error('Data is missing');
56
+ if (!data.unique)
57
+ throw new Error('Unique is missing');
58
+ await this.#init;
59
+ const { data: createdData, error } = await this.#detailSource.create(data);
60
+ if (createdData) {
61
+ this.#detailStore?.append(createdData);
62
+ // TODO: how do we handle generic notifications? Is this the correct place to do it?
63
+ const notification = { data: { message: `Created` } };
64
+ this.#notificationContext.peek('positive', notification);
65
+ }
66
+ return { error };
67
+ }
68
+ /**
69
+ * Saves the given data
70
+ * @param {DetailModelType} data
71
+ * @return {*}
72
+ * @memberof UmbDetailRepositoryBase
73
+ */
74
+ async save(data) {
75
+ if (!data)
76
+ throw new Error('Data is missing');
77
+ if (!data.unique)
78
+ throw new Error('Unique is missing');
79
+ await this.#init;
80
+ const { data: updatedData, error } = await this.#detailSource.update(data);
81
+ if (updatedData) {
82
+ this.#detailStore.updateItem(data.unique, updatedData);
83
+ // TODO: how do we handle generic notifications? Is this the correct place to do it?
84
+ const notification = { data: { message: `Saved` } };
85
+ this.#notificationContext.peek('positive', notification);
86
+ }
87
+ return { data, error };
88
+ }
89
+ /**
90
+ * Deletes the detail for the given unique
91
+ * @param {string} unique
92
+ * @return {*}
93
+ * @memberof UmbDetailRepositoryBase
94
+ */
95
+ async delete(unique) {
96
+ if (!unique)
97
+ throw new Error('Unique is missing');
98
+ await this.#init;
99
+ const { error } = await this.#detailSource.delete(unique);
100
+ if (!error) {
101
+ this.#detailStore.removeItem(unique);
102
+ // TODO: how do we handle generic notifications? Is this the correct place to do it?
103
+ const notification = { data: { message: `Deleted` } };
104
+ this.#notificationContext.peek('positive', notification);
105
+ }
106
+ return { error };
107
+ }
108
+ /**
109
+ * Returns a promise with an observable of the detail for the given unique
110
+ * @param {string} unique
111
+ * @return {*}
112
+ * @memberof UmbDetailRepositoryBase
113
+ */
114
+ async byUnique(unique) {
115
+ if (!unique)
116
+ throw new Error('Unique is missing');
117
+ await this.#init;
118
+ return this.#detailStore.byUnique(unique);
119
+ }
120
+ }
@@ -0,0 +1,2 @@
1
+ export type { UmbDetailDataSource, UmbDetailDataSourceConstructor } from './detail-data-source.interface.js';
2
+ export { UmbDetailRepositoryBase } from './detail-repository-base.js';
@@ -0,0 +1 @@
1
+ export { UmbDetailRepositoryBase } from './detail-repository-base.js';
@@ -7,3 +7,4 @@ export * from './copy-repository.interface.js';
7
7
  export * from './repository-items.manager.js';
8
8
  export * from './repository-base.js';
9
9
  export * from './item/index.js';
10
+ export * from './detail/index.js';
@@ -7,3 +7,4 @@ export * from './copy-repository.interface.js';
7
7
  export * from './repository-items.manager.js';
8
8
  export * from './repository-base.js';
9
9
  export * from './item/index.js';
10
+ export * from './detail/index.js';
@@ -1,4 +1,4 @@
1
1
  import { UmbBaseController, UmbControllerHost } from '../../../libs/controller-api/index.js';
2
- export declare class UmbRepositoryBase extends UmbBaseController {
2
+ export declare abstract class UmbRepositoryBase extends UmbBaseController {
3
3
  constructor(host: UmbControllerHost);
4
4
  }
@@ -1,4 +1,5 @@
1
1
  import { UmbBaseController } from '../../../libs/controller-api/index.js';
2
+ // TODO: Revisit if constructor method should be omitted
2
3
  export class UmbRepositoryBase extends UmbBaseController {
3
4
  constructor(host) {
4
5
  super(host);
@@ -0,0 +1,25 @@
1
+ import { UmbDetailStore } from './detail-store.interface.js';
2
+ import { UmbControllerHost } from '../../../libs/controller-api/index.js';
3
+ import { UmbStoreBase } from './index.js';
4
+ /**
5
+ * @export
6
+ * @class UmbDetailStoreBase
7
+ * @extends {UmbStoreBase}
8
+ * @description - Data Store for Data Type items
9
+ */
10
+ export declare abstract class UmbDetailStoreBase<T extends {
11
+ unique: string;
12
+ }> extends UmbStoreBase implements UmbDetailStore<T> {
13
+ /**
14
+ * Creates an instance of UmbDetailStoreBase.
15
+ * @param {UmbControllerHost} host
16
+ * @memberof UmbDetailStoreBase
17
+ */
18
+ constructor(host: UmbControllerHost, storeAlias: string);
19
+ /**
20
+ * Retrieve a detail model from the store
21
+ * @param {unique} string unique
22
+ * @memberof UmbDetailStoreBase
23
+ */
24
+ byUnique(unique: string): import("rxjs").Observable<any>;
25
+ }
@@ -0,0 +1,26 @@
1
+ import { UmbStoreBase } from './index.js';
2
+ import { UmbArrayState } from '../../../libs/observable-api/index.js';
3
+ /**
4
+ * @export
5
+ * @class UmbDetailStoreBase
6
+ * @extends {UmbStoreBase}
7
+ * @description - Data Store for Data Type items
8
+ */
9
+ export class UmbDetailStoreBase extends UmbStoreBase {
10
+ /**
11
+ * Creates an instance of UmbDetailStoreBase.
12
+ * @param {UmbControllerHost} host
13
+ * @memberof UmbDetailStoreBase
14
+ */
15
+ constructor(host, storeAlias) {
16
+ super(host, storeAlias, new UmbArrayState([], (x) => x.unique));
17
+ }
18
+ /**
19
+ * Retrieve a detail model from the store
20
+ * @param {unique} string unique
21
+ * @memberof UmbDetailStoreBase
22
+ */
23
+ byUnique(unique) {
24
+ return this._data.asObservablePart((x) => x.find((y) => y.unique === unique));
25
+ }
26
+ }
@@ -0,0 +1,8 @@
1
+ import { UmbStore } from './store.interface.js';
2
+ import type { Observable } from '../../../external/rxjs/index.js';
3
+ import type { UmbApi } from '../../../libs/extension-api/index.js';
4
+ export interface UmbDetailStore<T extends {
5
+ unique: string;
6
+ }> extends UmbStore<T>, UmbApi {
7
+ byUnique: (unique: string) => Observable<T>;
8
+ }
@@ -5,3 +5,5 @@ export * from './store.js';
5
5
  export * from './entity-item.store.js';
6
6
  export * from './file-system-item.store.js';
7
7
  export { UmbStoreConnector } from './store-connector.js';
8
+ export { UmbDetailStoreBase } from './detail-store-base.js';
9
+ export type { UmbDetailStore } from './detail-store.interface.js';
@@ -5,3 +5,4 @@ export * from './store.js';
5
5
  export * from './entity-item.store.js';
6
6
  export * from './file-system-item.store.js';
7
7
  export { UmbStoreConnector } from './store-connector.js';
8
+ export { UmbDetailStoreBase } from './detail-store-base.js';