mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-12 17:04:57 +00:00
[ACS-6630] Revert move of ActionRef, RuleRef and RouteRef from extensions library to js-api library
This commit is contained in:
parent
d855328efc
commit
6d201b108f
@ -18,10 +18,10 @@ Manages and runs basic extension functionality.
|
|||||||
- _ruleId:_ `string` - ID of the rule to evaluate
|
- _ruleId:_ `string` - ID of the rule to evaluate
|
||||||
- _context:_ [`RuleContext`](../../../lib/extensions/src/lib/config/rule.extensions.ts) - (Optional) Custom rule execution context.
|
- _context:_ [`RuleContext`](../../../lib/extensions/src/lib/config/rule.extensions.ts) - (Optional) Custom rule execution context.
|
||||||
- **Returns** `boolean` - True if the rule passed, false otherwise
|
- **Returns** `boolean` - True if the rule passed, false otherwise
|
||||||
- **getActionById**(id: `string`): [`ActionRef`](../../../lib/js-api/src/api/content-rest-api/model/actionRef.ts)<br/>
|
- **getActionById**(id: `string`): [`ActionRef`](../../../lib/extensions/src/lib/config/action.extensions.ts)<br/>
|
||||||
Retrieves an action using its ID value.
|
Retrieves an action using its ID value.
|
||||||
- _id:_ `string` - The ID value to look for
|
- _id:_ `string` - The ID value to look for
|
||||||
- **Returns** [`ActionRef`](../../../lib/js-api/src/api/content-rest-api/model/actionRef.ts) - Action or null if not found
|
- **Returns** [`ActionRef`](../../../lib/extensions/src/lib/config/action.extensions.ts) - Action or null if not found
|
||||||
- **getAuthGuards**(ids: `string[]`): `Array<Type<any>>`<br/>
|
- **getAuthGuards**(ids: `string[]`): `Array<Type<any>>`<br/>
|
||||||
Retrieves one or more auth guards using an array of ID values.
|
Retrieves one or more auth guards using an array of ID values.
|
||||||
- _ids:_ `string[]` - Array of ID value to look for
|
- _ids:_ `string[]` - Array of ID value to look for
|
||||||
@ -44,14 +44,14 @@ Manages and runs basic extension functionality.
|
|||||||
Gets features by key.
|
Gets features by key.
|
||||||
- _key:_ `string|string[]` - Key string using dot notation or array of strings
|
- _key:_ `string|string[]` - Key string using dot notation or array of strings
|
||||||
- _defaultValue:_ `any` - Default value returned if feature is not found, default is empty array
|
- _defaultValue:_ `any` - Default value returned if feature is not found, default is empty array
|
||||||
- **getRouteById**(id: `string`): [`RouteRef`](../../../lib/js-api/src/api/content-rest-api/model/routeRef.ts)<br/>
|
- **getRouteById**(id: `string`): [`RouteRef`](../../../lib/extensions/src/lib/config/routing.extensions.ts)<br/>
|
||||||
Retrieves a route using its ID value.
|
Retrieves a route using its ID value.
|
||||||
- _id:_ `string` - The ID value to look for
|
- _id:_ `string` - The ID value to look for
|
||||||
- **Returns** [`RouteRef`](../../../lib/js-api/src/api/content-rest-api/model/routeRef.ts) - The route or null if not found
|
- **Returns** [`RouteRef`](../../../lib/extensions/src/lib/config/routing.extensions.ts) - The route or null if not found
|
||||||
- **getRuleById**(id: `string`): [`RuleRef`](../../../lib/js-api/src/api/content-rest-api/model/ruleRef.ts)<br/>
|
- **getRuleById**(id: `string`): [`RuleRef`](../../../lib/extensions/src/lib/config/rule.extensions.ts)<br/>
|
||||||
Retrieves a rule using its ID value.
|
Retrieves a rule using its ID value.
|
||||||
- _id:_ `string` - The ID value to look for
|
- _id:_ `string` - The ID value to look for
|
||||||
- **Returns** [`RuleRef`](../../../lib/js-api/src/api/content-rest-api/model/ruleRef.ts) - The rule or null if not found
|
- **Returns** [`RuleRef`](../../../lib/extensions/src/lib/config/rule.extensions.ts) - The rule or null if not found
|
||||||
- **load**(): [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises)`<`[`ExtensionConfig`](../../../lib/extensions/src/lib/config/extension.config.ts)`>`<br/>
|
- **load**(): [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises)`<`[`ExtensionConfig`](../../../lib/extensions/src/lib/config/extension.config.ts)`>`<br/>
|
||||||
Loads and registers an extension config file and plugins (specified by path properties).
|
Loads and registers an extension config file and plugins (specified by path properties).
|
||||||
- **Returns** [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises)`<`[`ExtensionConfig`](../../../lib/extensions/src/lib/config/extension.config.ts)`>` - The loaded config data
|
- **Returns** [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises)`<`[`ExtensionConfig`](../../../lib/extensions/src/lib/config/extension.config.ts)`>` - The loaded config data
|
||||||
|
@ -215,7 +215,7 @@ following example:
|
|||||||
```
|
```
|
||||||
|
|
||||||
You can access routes from the config using the `getRouteById` method of the
|
You can access routes from the config using the `getRouteById` method of the
|
||||||
[Extension service,](../extensions/services/extension.service.md) which returns a [`RouteRef`](../../lib/js-api/src/api/content-rest-api/model/routeRef.ts) object. Note that the references
|
[Extension service,](../extensions/services/extension.service.md) which returns a [`RouteRef`](../../lib/extensions/src/lib/config/routing.extensions.ts) object. Note that the references
|
||||||
to the component and auth guards are extension IDs,
|
to the component and auth guards are extension IDs,
|
||||||
[as described above](#extension-points).
|
[as described above](#extension-points).
|
||||||
|
|
||||||
|
@ -47,3 +47,9 @@ export interface ContentActionRef extends ExtensionElement {
|
|||||||
visible?: string;
|
visible?: string;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface ActionRef {
|
||||||
|
id: string;
|
||||||
|
type: string;
|
||||||
|
payload?: string;
|
||||||
|
}
|
||||||
|
@ -15,7 +15,9 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { ActionRef, RouteRef, RuleRef } from '@alfresco/js-api';
|
import { RouteRef } from './routing.extensions';
|
||||||
|
import { RuleRef } from './rule.extensions';
|
||||||
|
import { ActionRef } from './action.extensions';
|
||||||
|
|
||||||
export interface ExtensionRef {
|
export interface ExtensionRef {
|
||||||
$id: string;
|
$id: string;
|
||||||
|
@ -33,3 +33,15 @@ export interface RuleContext {
|
|||||||
|
|
||||||
getEvaluator(key: string): RuleEvaluator;
|
getEvaluator(key: string): RuleEvaluator;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class RuleRef {
|
||||||
|
type: string;
|
||||||
|
id?: string;
|
||||||
|
parameters?: Array<RuleParameter>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface RuleParameter {
|
||||||
|
type: string;
|
||||||
|
value: any;
|
||||||
|
parameters?: Array<RuleParameter>;
|
||||||
|
}
|
||||||
|
@ -16,10 +16,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { every, not, some } from './core.evaluators';
|
import { every, not, some } from './core.evaluators';
|
||||||
import { RuleParameter } from '@alfresco/js-api';
|
import { RuleParameter } from '../config/rule.extensions';
|
||||||
|
|
||||||
describe('Core Evaluators', () => {
|
describe('Core Evaluators', () => {
|
||||||
|
|
||||||
const context: any = {
|
const context: any = {
|
||||||
getEvaluator: (key: string) => {
|
getEvaluator: (key: string) => {
|
||||||
switch (key) {
|
switch (key) {
|
||||||
|
@ -15,16 +15,14 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { RuleContext } from '../config/rule.extensions';
|
import { RuleContext, RuleParameter } from '../config/rule.extensions';
|
||||||
import { RuleParameter } from '@alfresco/js-api';
|
|
||||||
|
|
||||||
export const not = (context: RuleContext, ...args: RuleParameter[]): boolean => {
|
export const not = (context: RuleContext, ...args: RuleParameter[]): boolean => {
|
||||||
if (!args || args.length === 0) {
|
if (!args || args.length === 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return args
|
return args.every((arg) => {
|
||||||
.every((arg) => {
|
|
||||||
const evaluator = context.getEvaluator(arg.value);
|
const evaluator = context.getEvaluator(arg.value);
|
||||||
if (!evaluator) {
|
if (!evaluator) {
|
||||||
console.warn('evaluator not found: ' + arg.value);
|
console.warn('evaluator not found: ' + arg.value);
|
||||||
@ -39,8 +37,7 @@ export const every = (context: RuleContext, ...args: RuleParameter[]): boolean =
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return args
|
return args.every((arg) => {
|
||||||
.every((arg) => {
|
|
||||||
const evaluator = context.getEvaluator(arg.value);
|
const evaluator = context.getEvaluator(arg.value);
|
||||||
if (!evaluator) {
|
if (!evaluator) {
|
||||||
console.warn('evaluator not found: ' + arg.value);
|
console.warn('evaluator not found: ' + arg.value);
|
||||||
@ -55,8 +52,7 @@ export const some = (context: RuleContext, ...args: RuleParameter[]): boolean =>
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return args
|
return args.some((arg) => {
|
||||||
.some((arg) => {
|
|
||||||
const evaluator = context.getEvaluator(arg.value);
|
const evaluator = context.getEvaluator(arg.value);
|
||||||
if (!evaluator) {
|
if (!evaluator) {
|
||||||
console.warn('evaluator not found: ' + arg.value);
|
console.warn('evaluator not found: ' + arg.value);
|
||||||
|
@ -17,11 +17,12 @@
|
|||||||
|
|
||||||
import { HttpClient } from '@angular/common/http';
|
import { HttpClient } from '@angular/common/http';
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { ContentActionRef, ContentActionType } from '../config/action.extensions';
|
import { ActionRef, ContentActionRef, ContentActionType } from '../config/action.extensions';
|
||||||
import { ExtensionElement } from '../config/extension-element';
|
import { ExtensionElement } from '../config/extension-element';
|
||||||
import { filterEnabled, getValue, mergeObjects, sortByOrder } from '../config/extension-utils';
|
import { filterEnabled, getValue, mergeObjects, sortByOrder } from '../config/extension-utils';
|
||||||
import { ExtensionConfig, ExtensionRef } from '../config/extension.config';
|
import { ExtensionConfig, ExtensionRef } from '../config/extension.config';
|
||||||
import { ActionRef, RouteRef, RuleRef } from '@alfresco/js-api';
|
import { RouteRef } from '../config/routing.extensions';
|
||||||
|
import { RuleRef } from '../config/rule.extensions';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
|
@ -18,9 +18,11 @@
|
|||||||
import { ExtensionService } from './extension.service';
|
import { ExtensionService } from './extension.service';
|
||||||
import { ExtensionLoaderService } from './extension-loader.service';
|
import { ExtensionLoaderService } from './extension-loader.service';
|
||||||
import { ExtensionConfig } from '../config/extension.config';
|
import { ExtensionConfig } from '../config/extension.config';
|
||||||
import { ActionRef, RouteRef, RuleRef } from '@alfresco/js-api';
|
|
||||||
import { ComponentRegisterService } from './component-register.service';
|
import { ComponentRegisterService } from './component-register.service';
|
||||||
import { RuleService } from './rule.service';
|
import { RuleService } from './rule.service';
|
||||||
|
import { RuleRef } from '../config/rule.extensions';
|
||||||
|
import { RouteRef } from '../config/routing.extensions';
|
||||||
|
import { ActionRef } from '../config/action.extensions';
|
||||||
|
|
||||||
describe('ExtensionService', () => {
|
describe('ExtensionService', () => {
|
||||||
const blankConfig: ExtensionConfig = {
|
const blankConfig: ExtensionConfig = {
|
||||||
|
@ -16,16 +16,18 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Injectable, Type, InjectionToken, Inject } from '@angular/core';
|
import { Injectable, Type, InjectionToken, Inject } from '@angular/core';
|
||||||
import { RuleEvaluator, RuleContext } from '../config/rule.extensions';
|
import { RuleEvaluator, RuleRef, RuleContext } from '../config/rule.extensions';
|
||||||
import { ExtensionConfig } from '../config/extension.config';
|
import { ExtensionConfig } from '../config/extension.config';
|
||||||
import { ExtensionLoaderService } from './extension-loader.service';
|
import { ExtensionLoaderService } from './extension-loader.service';
|
||||||
|
import { RouteRef } from '../config/routing.extensions';
|
||||||
|
import { ActionRef } from '../config/action.extensions';
|
||||||
import * as core from '../evaluators/core.evaluators';
|
import * as core from '../evaluators/core.evaluators';
|
||||||
import { ComponentRegisterService } from './component-register.service';
|
import { ComponentRegisterService } from './component-register.service';
|
||||||
import { RuleService } from './rule.service';
|
import { RuleService } from './rule.service';
|
||||||
import { ExtensionElement } from '../config/extension-element';
|
import { ExtensionElement } from '../config/extension-element';
|
||||||
import { BehaviorSubject, Observable } from 'rxjs';
|
import { BehaviorSubject, Observable } from 'rxjs';
|
||||||
import { mergeArrays, mergeObjects } from '../config/extension-utils';
|
import { mergeArrays, mergeObjects } from '../config/extension-utils';
|
||||||
import { ActionRef, ExtensionComposition, RouteRef, RuleRef } from '@alfresco/js-api';
|
import { ExtensionComposition } from '@alfresco/js-api';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The default extensions factory
|
* The default extensions factory
|
||||||
@ -110,15 +112,14 @@ export class ExtensionService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
appendConfig(partialConfig: ExtensionComposition) {
|
appendConfig(partialConfig: ExtensionComposition) {
|
||||||
this.config = {
|
this.setup({
|
||||||
...this.config,
|
...this.config,
|
||||||
rules: mergeArrays(this.config.rules, partialConfig.rules),
|
rules: mergeArrays(this.config.rules, partialConfig.rules),
|
||||||
features: mergeObjects(this.config.features, partialConfig.features),
|
features: this.config.features ? mergeObjects(this.config.features, partialConfig.features) : partialConfig.features,
|
||||||
routes: mergeArrays(this.config.routes, partialConfig.routes),
|
routes: mergeArrays(this.config.routes, partialConfig.routes),
|
||||||
actions: mergeArrays(this.config.actions, partialConfig.actions),
|
actions: mergeArrays(this.config.actions, partialConfig.actions),
|
||||||
appConfig: mergeObjects(this.config.appConfig, partialConfig.appConfig)
|
appConfig: this.config.appConfig ? mergeObjects(this.config.appConfig, partialConfig.appConfig) : partialConfig.appConfig
|
||||||
};
|
});
|
||||||
this.setup(this.config);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -16,10 +16,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { RuleContext, RuleEvaluator } from '../config/rule.extensions';
|
import { RuleRef, RuleContext, RuleEvaluator, RuleParameter } from '../config/rule.extensions';
|
||||||
import { ExtensionConfig } from '../config/extension.config';
|
import { ExtensionConfig } from '../config/extension.config';
|
||||||
import { ExtensionLoaderService } from './extension-loader.service';
|
import { ExtensionLoaderService } from './extension-loader.service';
|
||||||
import { RuleParameter, RuleRef } from '@alfresco/js-api';
|
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
|
@ -23,6 +23,7 @@ export * from './lib/config/extension.config';
|
|||||||
export * from './lib/config/icon.extensions';
|
export * from './lib/config/icon.extensions';
|
||||||
export * from './lib/config/navbar.extensions';
|
export * from './lib/config/navbar.extensions';
|
||||||
export * from './lib/config/permission.extensions';
|
export * from './lib/config/permission.extensions';
|
||||||
|
export * from './lib/config/routing.extensions';
|
||||||
export * from './lib/config/rule.extensions';
|
export * from './lib/config/rule.extensions';
|
||||||
export * from './lib/config/sidebar.extensions';
|
export * from './lib/config/sidebar.extensions';
|
||||||
export * from './lib/config/viewer.extensions';
|
export * from './lib/config/viewer.extensions';
|
||||||
|
@ -1,22 +0,0 @@
|
|||||||
/*!
|
|
||||||
* @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?: string;
|
|
||||||
}
|
|
@ -23,7 +23,6 @@ export * from './actionDefinitionListList';
|
|||||||
export * from './actionExecResult';
|
export * from './actionExecResult';
|
||||||
export * from './actionExecResultEntry';
|
export * from './actionExecResultEntry';
|
||||||
export * from './actionParameterDefinition';
|
export * from './actionParameterDefinition';
|
||||||
export * from './actionRef';
|
|
||||||
export * from './activity';
|
export * from './activity';
|
||||||
export * from './activityEntry';
|
export * from './activityEntry';
|
||||||
export * from './activityPaging';
|
export * from './activityPaging';
|
||||||
@ -160,8 +159,6 @@ export * from './renditionEntry';
|
|||||||
export * from './renditionPaging';
|
export * from './renditionPaging';
|
||||||
export * from './renditionPagingList';
|
export * from './renditionPagingList';
|
||||||
export * from './revertBody';
|
export * from './revertBody';
|
||||||
export * from './routeRef';
|
|
||||||
export * from './ruleRef';
|
|
||||||
export * from './sharedLink';
|
export * from './sharedLink';
|
||||||
export * from './sharedLinkBodyCreate';
|
export * from './sharedLinkBodyCreate';
|
||||||
export * from './sharedLinkBodyEmail';
|
export * from './sharedLinkBodyEmail';
|
||||||
|
@ -1,28 +0,0 @@
|
|||||||
/*!
|
|
||||||
* @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: string;
|
|
||||||
parameters?: Array<RuleParameter>;
|
|
||||||
}
|
|
||||||
|
|
||||||
export class RuleRef {
|
|
||||||
type: string;
|
|
||||||
id?: string;
|
|
||||||
parameters?: Array<RuleParameter>;
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user