[ACS-6630] Added models, APIs and docs to js-api for extension-manager feature

This commit is contained in:
swapnil.verma
2024-04-04 12:47:50 +05:30
parent e25fddf178
commit 35b6c05aae
20 changed files with 340 additions and 34 deletions

View File

@@ -26,7 +26,8 @@ https://localhost/alfresco/api/-default-/public/alfresco/versions/1
- [RatingsApi](docs/RatingsApi.md)
- [RenditionsApi](docs/RenditionsApi.md)
- [SharedlinksApi](docs/SharedlinksApi.md)
- [SettingsApi](docs/SettingsApi.md)
- [SitesApi](docs/SitesApi.md)
- [TagsApi](docs/TagsApi.md)
- [TrashcanApi](docs/TrashcanApi.md)
- [VersionsApi](docs/VersionsApi.md)
- [VersionsApi](docs/VersionsApi.md)

View File

@@ -34,6 +34,7 @@ export * from './queries.api';
export * from './ratings.api';
export * from './renditions.api';
export * from './search-ai.api';
export * from './settings.api';
export * from './sharedlinks.api';
export * from './sites.api';
export * from './tags.api';

View File

@@ -0,0 +1,67 @@
/*!
* @license
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { BaseApi } from './base.api';
import { throwIfNotDefined } from '../../../assert';
import { ExtensionConfig } from '../model/extensionConfig';
import { ExtensionConfigEntry } from '../model/extensionConfigEntry';
export class SettingsApi extends BaseApi {
/**
* Gets the published extension configuration from
* the database
*
* @param instanceId Unique ID for a running instance of ADW
* for which configuration is to be fetched
*/
getSavedExtensionState(instanceId: string): Promise<ExtensionConfigEntry> {
throwIfNotDefined(instanceId, 'instanceId');
const pathParams = {
instanceId
};
return this.get({
path: '/settings/{instanceId}',
pathParams
});
}
/**
* Publish the extension configuration for an ADW instance
* in the database
*
* @param instanceId Unique ID for a running instance of ADW
* for which configuration is to be published
* @param extensionConfig Extension configuration that is to
* be saved
*/
publishExtensionConfig(instanceId: string, extensionConfig: ExtensionConfig): Promise<void> {
throwIfNotDefined(instanceId, 'instanceId');
throwIfNotDefined(extensionConfig, 'extensionConfig');
const pathParams = {
instanceId
};
return this.put({
path: '/settings/{instanceId}',
pathParams,
bodyParam: extensionConfig
});
}
}

View File

@@ -0,0 +1,129 @@
# SitesApi
All URIs are relative to *https://localhost/alfresco/api/-default-/public/alfresco/versions/1/*
| Method | HTTP request | Description |
|---------------------------------------------------|--------------------------------|-------------------------------------------------------------------------------------|
| [getSavedExtensionState](#getSavedExtensionState) | **GET** /settings/{instanceId} | Gets the extension configuration saved for a running instance of ADW on the backend |
| [publishExtensionConfig](#publishExtensionConfig) | **PUT** /settings/{instanceId} | Saves an extension configuration for a running instance of ADW on the backend |
## getSavedExtensionState
Gets the extension configuration saved on the backend
> this endpoint is available in <GET VERSION INFO HERE>**Alfresco 7.0.0** and newer versions.
**Parameters**
| Name | Type | Description | Notes |
|----------------|--------|----------------------------------------------|-------|
| **instanceId** | string | The identifier of a running instance of ADW. | |
**Return type**: [ExtensionConfigEntry](#ExtensionConfigEntry)
## publishExtensionConfig
Saves an extension configuration on the backend
**Parameters**
| Name | Type | Description |
|---------------------|-------------------------------------|----------------------------------------------|
| **instanceId** | string | The identifier of a running instance of ADW. |
| **extensionConfig** | [ExtensionConfig](#ExtensionConfig) | The extension configuration to be saved. |
**Example**
```javascript
import {AlfrescoApi, SitesApi} from '@alfresco/js-api';
const alfrescoApi = new AlfrescoApi(/*..*/);
const settingsApi = new SettingsApi(alfrescoApi);
const extensionConfig = new ExtensionConfig();
extensionConfig = {
appConfig: {},
features: {},
actions: [],
rules: [],
routes: []
}
settingsApi.publishExtensionConfig(`<instanceId>`, extensionConfig).then(() => {
console.log('API called successfully.');
});
```
# Models
## ExtensionConfigEntry
**Properties**
| Name | Type |
|-----------|-------------------------------------|
| **entry** | [ExtensionConfig](#ExtensionConfig) |
## ExtensionConfig
**Properties**
| Name | Type |
|---------------|-------------------------------------------|
| **appConfig** | [AppConfigPluginRef](#AppConfigPluginRef) |
| **rules** | [RuleRef[]](#RuleRef) |
| **routes** | [RouteRef[]](#RouteRef) |
| **actions** | [ActionRef[]](#ActionRef) |
| **features** | [key: string]: any |
## AppConfigPluginRef
**Properties**
| Name | Type |
|-------------|----------------------------|
| **plugins** | { [key: string]: boolean } |
## RouteRef
**Properties**
| Name | Type |
|---------------|---------------------------|
| **id** | string |
| **path** | string |
| **component** | string |
| parentRoute | string |
| layout | string |
| auth | string[] |
| data | { [key: string]: string } |
## RuleRef
**Properties**
| Name | Type |
|------------|-----------------------------------|
| **type** | string |
| id | string |
| parameters | [RuleParameter[]](#RuleParameter) |
## RuleParameter
**Properties**
| Name | Type |
|------------|-----------------------------------|
| **type** | string |
| **value** | any |
| parameters | [RuleParameter[]](#RuleParameter) |
## ActionRef
**Properties**
| Name | Type |
|-------------|--------|
| **id** | string |
| **type** | string |
| **payload** | any |

View File

@@ -0,0 +1,22 @@
/*!
* @license
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export interface ActionRef {
id: string;
type: string;
payload?: any;
}

View File

@@ -0,0 +1,22 @@
/*!
* @license
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export interface AppConfigPluginRef {
plugins: {
[key: string]: boolean;
};
}

View File

@@ -0,0 +1,31 @@
/*!
* @license
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { AppConfigPluginRef } from './appConfigPluginRef';
import { RuleRef } from './ruleRef';
import { RouteRef } from './routeRef';
import { ActionRef } from './actionRef';
export class ExtensionConfig {
appConfig: AppConfigPluginRef;
rules?: Array<RuleRef>;
routes?: Array<RouteRef>;
actions?: Array<ActionRef>;
features?: {
[key: string]: any;
};
}

View File

@@ -0,0 +1,22 @@
/*!
* @license
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { ExtensionConfig } from './extensionConfig';
export class ExtensionConfigEntry {
entry: ExtensionConfig;
}

View File

@@ -23,10 +23,12 @@ export * from './actionDefinitionListList';
export * from './actionExecResult';
export * from './actionExecResultEntry';
export * from './actionParameterDefinition';
export * from './actionRef';
export * from './activity';
export * from './activityEntry';
export * from './activityPaging';
export * from './activityPagingList';
export * from './appConfigPluginRef';
export * from './agent';
export * from './agentEntry';
export * from './agentPaging';
@@ -79,6 +81,8 @@ export * from './download-status';
export * from './downloadBodyCreate';
export * from './downloadEntry';
export * from './errorError';
export * from './extensionConfig';
export * from './extensionConfigEntry';
export * from './favorite';
export * from './favoriteBodyCreate';
export * from './favoriteEntry';
@@ -156,6 +160,8 @@ export * from './renditionEntry';
export * from './renditionPaging';
export * from './renditionPagingList';
export * from './revertBody';
export * from './routeRef';
export * from './ruleRef';
export * from './sharedLink';
export * from './sharedLinkBodyCreate';
export * from './sharedLinkBodyEmail';

View File

@@ -0,0 +1,26 @@
/*!
* @license
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export interface RouteRef {
id: string;
path: string;
component: string;
parentRoute?: string;
layout?: string;
auth?: string[];
data?: { [key: string]: string };
}

View File

@@ -0,0 +1,28 @@
/*!
* @license
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export interface RuleParameter {
type: string;
value: any;
parameters?: Array<RuleParameter>;
}
export class RuleRef {
type: string;
id?: string;
parameters?: Array<RuleParameter>;
}