mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-10-01 14:41:32 +00:00
[ACS-6630] Added models, APIs and docs to js-api for extension-manager feature
This commit is contained in:
@@ -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)
|
||||
|
@@ -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';
|
||||
|
67
lib/js-api/src/api/content-rest-api/api/settings.api.ts
Normal file
67
lib/js-api/src/api/content-rest-api/api/settings.api.ts
Normal 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
|
||||
});
|
||||
}
|
||||
}
|
129
lib/js-api/src/api/content-rest-api/docs/SettingsApi.md
Normal file
129
lib/js-api/src/api/content-rest-api/docs/SettingsApi.md
Normal 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 |
|
22
lib/js-api/src/api/content-rest-api/model/actionRef.ts
Normal file
22
lib/js-api/src/api/content-rest-api/model/actionRef.ts
Normal 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;
|
||||
}
|
@@ -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;
|
||||
};
|
||||
}
|
31
lib/js-api/src/api/content-rest-api/model/extensionConfig.ts
Normal file
31
lib/js-api/src/api/content-rest-api/model/extensionConfig.ts
Normal 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;
|
||||
};
|
||||
}
|
@@ -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;
|
||||
}
|
@@ -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';
|
||||
|
26
lib/js-api/src/api/content-rest-api/model/routeRef.ts
Normal file
26
lib/js-api/src/api/content-rest-api/model/routeRef.ts
Normal 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 };
|
||||
}
|
28
lib/js-api/src/api/content-rest-api/model/ruleRef.ts
Normal file
28
lib/js-api/src/api/content-rest-api/model/ruleRef.ts
Normal 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>;
|
||||
}
|
Reference in New Issue
Block a user