clean up
This commit is contained in:
@@ -0,0 +1 @@
|
||||
export * from './repository/index.js';
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
export * from './repository/manifests.js';
|
||||
@@ -1 +1 @@
|
||||
export const UMB_USER_CLIENT_CREDENTIALS_REPOSITORY_ALIAS = 'Umb.Repository.User.ClientCredentials';
|
||||
export const UMB_USER_CLIENT_CREDENTIAL_REPOSITORY_ALIAS = 'Umb.Repository.User.ClientCredential';
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
export * from './types.js';
|
||||
export * from './user-client-credentials.server.data-source.js';
|
||||
export * from './user-client-credential.server.data-source.js';
|
||||
|
||||
@@ -1,24 +1,13 @@
|
||||
import type { UmbUserClientCredentialModel } from '../types.js';
|
||||
import type {
|
||||
UmbCreateUserClientCredentialRequestArgs,
|
||||
UmbDeleteUserClientCredentialRequestArgs,
|
||||
UmbUserClientCredentialModel,
|
||||
UmbUserClientCredentialRequestArgs,
|
||||
} from '../types.js';
|
||||
import type { UmbDataSourceErrorResponse, UmbDataSourceResponse } from '@umbraco-cms/backoffice/repository';
|
||||
|
||||
export interface UmbUserClientCredentialsDataSourceCreateArgs {
|
||||
user: { unique: string };
|
||||
client: { unique: string; secret: string };
|
||||
}
|
||||
|
||||
export interface UmbUserClientCredentialsDataSourceReadArgs {
|
||||
user: { unique: string };
|
||||
}
|
||||
|
||||
export interface UmbUserClientCredentialsDataSourceDeleteArgs {
|
||||
user: { unique: string };
|
||||
client: { unique: string };
|
||||
}
|
||||
|
||||
export interface UmbUserClientCredentialsDataSource {
|
||||
create(args: UmbUserClientCredentialsDataSourceCreateArgs): Promise<UmbDataSourceErrorResponse>;
|
||||
read(
|
||||
args: UmbUserClientCredentialsDataSourceReadArgs,
|
||||
): Promise<UmbDataSourceResponse<Array<UmbUserClientCredentialModel>>>;
|
||||
delete: (args: UmbUserClientCredentialsDataSourceDeleteArgs) => Promise<UmbDataSourceErrorResponse>;
|
||||
export interface UmbUserClientCredentialDataSource {
|
||||
create(args: UmbCreateUserClientCredentialRequestArgs): Promise<UmbDataSourceErrorResponse>;
|
||||
read(args: UmbUserClientCredentialRequestArgs): Promise<UmbDataSourceResponse<Array<UmbUserClientCredentialModel>>>;
|
||||
delete: (args: UmbDeleteUserClientCredentialRequestArgs) => Promise<UmbDataSourceErrorResponse>;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import type {
|
||||
UmbUserClientCredentialsDataSource,
|
||||
UmbUserClientCredentialsDataSourceCreateArgs,
|
||||
UmbUserClientCredentialsDataSourceDeleteArgs,
|
||||
UmbUserClientCredentialsDataSourceReadArgs,
|
||||
} from './types.js';
|
||||
UmbCreateUserClientCredentialRequestArgs,
|
||||
UmbDeleteUserClientCredentialRequestArgs,
|
||||
UmbUserClientCredentialRequestArgs,
|
||||
} from '../types.js';
|
||||
import type { UmbUserClientCredentialDataSource } from './types.js';
|
||||
import { UserService } from '@umbraco-cms/backoffice/external/backend-api';
|
||||
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
|
||||
import { tryExecuteAndNotify } from '@umbraco-cms/backoffice/resources';
|
||||
@@ -11,10 +11,10 @@ import { tryExecuteAndNotify } from '@umbraco-cms/backoffice/resources';
|
||||
/**
|
||||
* Server data source for user client credentials
|
||||
* @export
|
||||
* @class UmbUserClientCredentialsServerDataSource
|
||||
* @implements {UmbUserClientCredentialsDataSource}
|
||||
* @class UmbUserClientCredentialServerDataSource
|
||||
* @implements {UmbUserClientCredentialDataSource}
|
||||
*/
|
||||
export class UmbUserClientCredentialsServerDataSource implements UmbUserClientCredentialsDataSource {
|
||||
export class UmbUserClientCredentialServerDataSource implements UmbUserClientCredentialDataSource {
|
||||
#host: UmbControllerHost;
|
||||
|
||||
constructor(host: UmbControllerHost) {
|
||||
@@ -23,11 +23,11 @@ export class UmbUserClientCredentialsServerDataSource implements UmbUserClientCr
|
||||
|
||||
/**
|
||||
* Creates a new client credentials for a user
|
||||
* @param {UmbUserClientCredentialsDataSourceCreateArgs} args - The user and client to create the credentials for
|
||||
* @param {UmbCreateUserClientCredentialRequestArgs} args - The user and client to create the credentials for
|
||||
* @returns {*}
|
||||
* @memberof UmbUserClientCredentialsServerDataSource
|
||||
* @memberof UmbUserClientCredentialServerDataSource
|
||||
*/
|
||||
create(args: UmbUserClientCredentialsDataSourceCreateArgs) {
|
||||
create(args: UmbCreateUserClientCredentialRequestArgs) {
|
||||
return tryExecuteAndNotify(
|
||||
this.#host,
|
||||
UserService.postUserByIdClientCredentials({
|
||||
@@ -42,11 +42,11 @@ export class UmbUserClientCredentialsServerDataSource implements UmbUserClientCr
|
||||
|
||||
/**
|
||||
* Reads the client credentials for a user
|
||||
* @param {UmbUserClientCredentialsDataSourceReadArgs} args - The user to read the credentials for
|
||||
* @param {UmbUserClientCredentialRequestArgs} args - The user to read the credentials for
|
||||
* @returns {*}
|
||||
* @memberof UmbUserClientCredentialsServerDataSource
|
||||
* @memberof UmbUserClientCredentialServerDataSource
|
||||
*/
|
||||
async read(args: UmbUserClientCredentialsDataSourceReadArgs) {
|
||||
async read(args: UmbUserClientCredentialRequestArgs) {
|
||||
const { data, error } = await tryExecuteAndNotify(
|
||||
this.#host,
|
||||
UserService.getUserByIdClientCredentials({
|
||||
@@ -67,11 +67,11 @@ export class UmbUserClientCredentialsServerDataSource implements UmbUserClientCr
|
||||
|
||||
/**
|
||||
* Deletes the client credentials for a user
|
||||
* @param {UmbUserClientCredentialsDataSourceDeleteArgs} args - The user and client unique to delete the credentials for
|
||||
* @param {UmbDeleteUserClientCredentialRequestArgs} args - The user and client unique to delete the credentials for
|
||||
* @returns {*}
|
||||
* @memberof UmbUserClientCredentialsServerDataSource
|
||||
* @memberof UmbUserClientCredentialServerDataSource
|
||||
*/
|
||||
delete(args: UmbUserClientCredentialsDataSourceDeleteArgs) {
|
||||
delete(args: UmbDeleteUserClientCredentialRequestArgs) {
|
||||
return tryExecuteAndNotify(
|
||||
this.#host,
|
||||
UserService.deleteUserByIdClientCredentialsByClientId({
|
||||
@@ -1,2 +1,3 @@
|
||||
export * from './user-client-credentials.repository.js';
|
||||
export * from './user-client-credential.repository.js';
|
||||
export * from './constants.js';
|
||||
export * from './types.js';
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { UMB_USER_CLIENT_CREDENTIALS_REPOSITORY_ALIAS } from './constants.js';
|
||||
import { UMB_USER_CLIENT_CREDENTIAL_REPOSITORY_ALIAS } from './constants.js';
|
||||
import type { ManifestTypes, UmbBackofficeManifestKind } from '@umbraco-cms/backoffice/extension-registry';
|
||||
|
||||
export const manifests: Array<ManifestTypes | UmbBackofficeManifestKind> = [
|
||||
{
|
||||
type: 'repository',
|
||||
alias: UMB_USER_CLIENT_CREDENTIALS_REPOSITORY_ALIAS,
|
||||
alias: UMB_USER_CLIENT_CREDENTIAL_REPOSITORY_ALIAS,
|
||||
name: 'User Client Credentials Repository',
|
||||
api: () => import('./user-client-credentials.repository.js'),
|
||||
api: () => import('./user-client-credential.repository.js'),
|
||||
},
|
||||
];
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
import type {
|
||||
UmbUserClientCredentialsDataSourceCreateArgs,
|
||||
UmbUserClientCredentialsDataSourceDeleteArgs,
|
||||
UmbUserClientCredentialsDataSourceReadArgs,
|
||||
} from './data-source/index.js';
|
||||
export interface UmbCreateUserClientCredentialRequestArgs {
|
||||
user: { unique: string };
|
||||
client: { unique: string; secret: string };
|
||||
}
|
||||
|
||||
export type UmbUserClientCredentialsRepositoryCreateArgs = UmbUserClientCredentialsDataSourceCreateArgs;
|
||||
export type UmbUserClientCredentialsRepositoryReadArgs = UmbUserClientCredentialsDataSourceReadArgs;
|
||||
export type UmbUserClientCredentialsRepositoryDeleteArgs = UmbUserClientCredentialsDataSourceDeleteArgs;
|
||||
export interface UmbUserClientCredentialRequestArgs {
|
||||
user: { unique: string };
|
||||
}
|
||||
|
||||
export interface UmbDeleteUserClientCredentialRequestArgs {
|
||||
user: { unique: string };
|
||||
client: { unique: string };
|
||||
}
|
||||
|
||||
export interface UmbUserClientCredentialModel {
|
||||
unique: string;
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
import type { UmbUserClientCredentialDataSource } from './data-source/index.js';
|
||||
import { UmbUserClientCredentialServerDataSource } from './data-source/user-client-credential.server.data-source.js';
|
||||
import type {
|
||||
UmbCreateUserClientCredentialRequestArgs,
|
||||
UmbDeleteUserClientCredentialRequestArgs,
|
||||
UmbUserClientCredentialRequestArgs,
|
||||
} from './types.js';
|
||||
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
|
||||
import { UmbRepositoryBase } from '@umbraco-cms/backoffice/repository';
|
||||
|
||||
/**
|
||||
* UmbUserClientCredentialRepository
|
||||
* @export
|
||||
* @class UmbUserClientCredentialRepository
|
||||
* @extends {UmbRepositoryBase}
|
||||
*/
|
||||
export class UmbUserClientCredentialRepository extends UmbRepositoryBase {
|
||||
#source: UmbUserClientCredentialDataSource;
|
||||
|
||||
/**
|
||||
* Creates an instance of UmbUserClientCredentialRepository.
|
||||
* @param {UmbControllerHost} host - The controller host
|
||||
* @memberof UmbUserClientCredentialRepository
|
||||
*/
|
||||
constructor(host: UmbControllerHost) {
|
||||
super(host);
|
||||
this.#source = new UmbUserClientCredentialServerDataSource(host);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new client credentials for a user
|
||||
* @param {UmbCreateUserClientCredentialRequestArgs} args - The user and client to create the credentials for
|
||||
* @returns {*}
|
||||
* @memberof UmbUserClientCredentialRepository
|
||||
*/
|
||||
async requestCreate(args: UmbCreateUserClientCredentialRequestArgs) {
|
||||
return this.#source.create(args);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads the client credentials for a user
|
||||
* @param {UmbUserClientCredentialRequestArgs} args - The user to read the credentials for
|
||||
* @returns {*}
|
||||
* @memberof UmbUserClientCredentialRepository
|
||||
*/
|
||||
async requestClientCredentials(args: UmbUserClientCredentialRequestArgs) {
|
||||
return this.#source.read(args);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes the client credentials for a user
|
||||
* @param {UmbDeleteUserClientCredentialRequestArgs} args - The user and client unique to delete the credentials for
|
||||
* @returns {*}
|
||||
* @memberof UmbUserClientCredentialRepository
|
||||
*/
|
||||
async requestDelete(args: UmbDeleteUserClientCredentialRequestArgs) {
|
||||
return this.#source.delete(args);
|
||||
}
|
||||
}
|
||||
|
||||
export { UmbUserClientCredentialRepository as api };
|
||||
@@ -1,61 +0,0 @@
|
||||
import type { UmbUserClientCredentialsDataSource } from './data-source/index.js';
|
||||
import { UmbUserClientCredentialsServerDataSource } from './data-source/user-client-credentials.server.data-source.js';
|
||||
import type {
|
||||
UmbUserClientCredentialsRepositoryCreateArgs,
|
||||
UmbUserClientCredentialsRepositoryDeleteArgs,
|
||||
UmbUserClientCredentialsRepositoryReadArgs,
|
||||
} from './types.js';
|
||||
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
|
||||
import { UmbRepositoryBase } from '@umbraco-cms/backoffice/repository';
|
||||
|
||||
/**
|
||||
* UmbUserClientCredentialsRepository
|
||||
* @export
|
||||
* @class UmbUserClientCredentialsRepository
|
||||
* @extends {UmbRepositoryBase}
|
||||
*/
|
||||
export class UmbUserClientCredentialsRepository extends UmbRepositoryBase {
|
||||
#source: UmbUserClientCredentialsDataSource;
|
||||
|
||||
/**
|
||||
* Creates an instance of UmbUserClientCredentialsRepository.
|
||||
* @param {UmbControllerHost} host - The controller host
|
||||
* @memberof UmbUserClientCredentialsRepository
|
||||
*/
|
||||
constructor(host: UmbControllerHost) {
|
||||
super(host);
|
||||
this.#source = new UmbUserClientCredentialsServerDataSource(host);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new client credentials for a user
|
||||
* @param {UmbUserClientCredentialsRepositoryCreateArgs} args - The user and client to create the credentials for
|
||||
* @returns {*}
|
||||
* @memberof UmbUserClientCredentialsRepository
|
||||
*/
|
||||
async create(args: UmbUserClientCredentialsRepositoryCreateArgs) {
|
||||
return this.#source.create(args);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads the client credentials for a user
|
||||
* @param {UmbUserClientCredentialsRepositoryReadArgs} args - The user to read the credentials for
|
||||
* @returns {*}
|
||||
* @memberof UmbUserClientCredentialsRepository
|
||||
*/
|
||||
async read(args: UmbUserClientCredentialsRepositoryReadArgs) {
|
||||
return this.#source.read(args);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes the client credentials for a user
|
||||
* @param {UmbUserClientCredentialsRepositoryDeleteArgs} args - The user and client unique to delete the credentials for
|
||||
* @returns {*}
|
||||
* @memberof UmbUserClientCredentialsRepository
|
||||
*/
|
||||
async delete(args: UmbUserClientCredentialsRepositoryDeleteArgs) {
|
||||
return this.#source.delete(args);
|
||||
}
|
||||
}
|
||||
|
||||
export { UmbUserClientCredentialsRepository as api };
|
||||
@@ -1,24 +1,26 @@
|
||||
import { manifests as clientCredentialManifests } from './client-credential/manifests.js';
|
||||
import { manifests as collectionManifests } from './collection/manifests.js';
|
||||
import { manifests as conditionsManifests } from './conditions/manifests.js';
|
||||
import { manifests as entityActionsManifests } from './entity-actions/manifests.js';
|
||||
import { manifests as entityBulkActionManifests } from './entity-bulk-actions/manifests.js';
|
||||
import { manifests as inviteManifests } from './invite/manifests.js';
|
||||
import { manifests as modalManifests } from './modals/manifests.js';
|
||||
import { manifests as propertyEditorManifests } from './property-editor/manifests.js';
|
||||
import { manifests as repositoryManifests } from './repository/manifests.js';
|
||||
import { manifests as sectionViewManifests } from './section-view/manifests.js';
|
||||
import { manifests as propertyEditorManifests } from './property-editor/manifests.js';
|
||||
import { manifests as workspaceManifests } from './workspace/manifests.js';
|
||||
import type { ManifestTypes } from '@umbraco-cms/backoffice/extension-registry';
|
||||
import type { ManifestTypes, UmbBackofficeManifestKind } from '@umbraco-cms/backoffice/extension-registry';
|
||||
|
||||
export const manifests: Array<ManifestTypes> = [
|
||||
export const manifests: Array<ManifestTypes | UmbBackofficeManifestKind> = [
|
||||
...clientCredentialManifests,
|
||||
...collectionManifests,
|
||||
...conditionsManifests,
|
||||
...entityActionsManifests,
|
||||
...entityBulkActionManifests,
|
||||
...inviteManifests,
|
||||
...modalManifests,
|
||||
...propertyEditorManifests,
|
||||
...repositoryManifests,
|
||||
...sectionViewManifests,
|
||||
...propertyEditorManifests,
|
||||
...workspaceManifests,
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user