Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AAE-20109] Move alfresco js-API and alfrescoapi service out from the core #9317

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion .github/workflows/release-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,21 @@ jobs:
with:
dry-run-flag: ${{ inputs.dry-run-flag }}
- uses: ./.github/actions/download-node-modules-and-artifacts
- name: build libraries
- name: Set libraries versions
run: |
set -u;
./scripts/update-version.sh -gnu || exit 1;
- name: Set migrations
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here we are setting migration version to e.g. 7.9.0-1234567890 (current release version) in lib/core/schematics/migrations/collection.json

uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with:
script: |
const setMigrations = require('./scripts/github/release/set-migrations.js');
setMigrations();
- name: Build libraries
run: |
npx nx affected:build $NX_CALCULATION_FLAGS --prod --exclude="demoshell" --skip-nx-cache
npx nx affected $NX_CALCULATION_FLAGS --target=pretheme
npx nx affected $NX_CALCULATION_FLAGS --target=build-schematics
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
name: release libraries GH registry
with:
Expand Down
11 changes: 10 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -182,12 +182,21 @@ jobs:
with:
dry-run-flag: ${{ inputs.dry-run-flag }}
- uses: ./.github/actions/download-node-modules-and-artifacts
- name: build libraries
- name: Set libraries versions
run: |
set -u;
./scripts/github/build/bumpversion.sh
- name: Set migrations
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with:
script: |
const setMigrations = require('./scripts/github/release/set-migrations.js');
setMigrations();
- name: build libraries
run: |
npx nx affected:build $NX_CALCULATION_FLAGS --prod --exclude="demoshell" --skip-nx-cache
npx nx affected $NX_CALCULATION_FLAGS --target=pretheme
npx nx affected $NX_CALCULATION_FLAGS --target=build-schematics
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
name: release libraries GH registry
with:
Expand Down
46 changes: 28 additions & 18 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,16 @@
},
"defaultConfiguration": "production"
},
"build-schematics": {
"executor": "nx:run-commands",
"options": {
"commands": [
{
"command": "npx tsc -p lib/core/tsconfig.schematics.json && cp lib/core/schematics/migrations/collection.json dist/libs/core/schematics/migrations/collection.json"
}
]
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
Expand Down Expand Up @@ -425,32 +435,32 @@
},
"stylelint": {
"executor": "nx:run-commands",
"options": {
"commands": [
{
"command": "npx stylelint lib/core/**/*.scss --config .stylelintrc.json"
}
]
"options": {
"commands": [
{
"command": "npx stylelint lib/core/**/*.scss --config .stylelintrc.json"
}
]
}
},
"license": {
"executor": "nx:run-commands",
"options": {
"commands": [
{
"command": "npx license-checker --production --failOn 'GPL;GPL-2.0' > licenses.txt"
}
]
"options": {
"commands": [
{
"command": "npx license-checker --production --failOn 'GPL;GPL-2.0' > licenses.txt"
}
]
}
},
"pretheme": {
"executor": "nx:run-commands",
"options": {
"commands": [
{
"command": "npx webpack -- --config ./lib/config/webpack.style.js --progress --profile --bail"
}
]
"options": {
"commands": [
{
"command": "npx webpack -- --config ./lib/config/webpack.style.js --progress --profile --bail"
}
]
}
},
"npm-publish": {
Expand Down
6 changes: 4 additions & 2 deletions demo-shell/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { NgChartsModule } from 'ng2-charts';
import { HttpClientModule } from '@angular/common/http';
import { BrowserAnimationsModule, NoopAnimationsModule } from '@angular/platform-browser/animations';
import { TranslateModule } from '@ngx-translate/core';
import { AppConfigService, DebugAppConfigService, CoreModule, CoreAutomationService, AuthModule, provideTranslations } from '@alfresco/adf-core';
import { AppConfigService, DebugAppConfigService, CoreModule, AuthModule, provideTranslations } from '@alfresco/adf-core';
import { ExtensionsModule } from '@alfresco/adf-extensions';
import { AppComponent } from './app.component';
import { MaterialModule } from './material.module';
Expand Down Expand Up @@ -67,6 +67,7 @@ import { CustomEditorComponent, CustomWidgetComponent } from './components/cloud
import { SearchFilterChipsComponent } from './components/search/search-filter-chips.component';
import { UserInfoComponent } from './components/app-layout/user-info/user-info.component';
import { FolderDirectiveModule } from './folder-directive';
import { CoreAutomationService } from './services/automation.service';

@NgModule({
imports: [
Expand Down Expand Up @@ -126,7 +127,8 @@ import { FolderDirectiveModule } from './folder-directive';
SearchFilterChipsComponent
],
providers: [
{ provide: AppConfigService, useClass: DebugAppConfigService }, // not use this service in production
{provide: AppConfigService, useClass: DebugAppConfigService }, // not use this service in production
CoreAutomationService,
provideTranslations('app', 'resources')
],
bootstrap: [AppComponent]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/

import { Component, ViewEncapsulation } from '@angular/core';
import { AlfrescoApiService } from '@alfresco/adf-core';
import { AlfrescoApiService } from '@alfresco/adf-content-services';

@Component({
templateUrl: './app-layout.component.html',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

import { Component, OnDestroy, OnInit } from '@angular/core';
import {
CoreAutomationService,
FormFieldModel,
FormModel,
FormRenderingService,
Expand All @@ -32,6 +31,7 @@ import {
CustomEditorComponent,
CustomWidgetComponent
} from '../../../cloud/custom-form-components/custom-editor.component';
import { CoreAutomationService } from '../../../../services/automation.service';

@Component({
templateUrl: './cloud-form-demo.component.html',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ const routes: Routes = [
CoreModule,
ContentModule,
InfoDrawerModule,
ContentModule,
ContentDirectiveModule,
ContentMetadataModule,
VersionManagerModule
Expand Down
2 changes: 1 addition & 1 deletion demo-shell/src/app/components/form/form.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ import {
FormService,
FormOutcomeEvent,
NotificationService,
CoreAutomationService,
FormRenderingService
} from '@alfresco/adf-core';
import { ProcessFormRenderingService } from '@alfresco/adf-process-services';
import { InMemoryFormService } from '../../services/in-memory-form.service';
import { Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
import { CoreAutomationService } from '../../services/automation.service';

@Component({
selector: 'app-form',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
// eslint-disable-next-line
import { AfterViewInit, Component, ElementRef, Input, OnDestroy, OnInit, ViewChild, ViewEncapsulation, EventEmitter, Output } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { AlfrescoApiService } from '@alfresco/adf-content-services';
import { Pagination, UserProcessInstanceFilterRepresentation, ScriptFilesApi, UserTaskFilterRepresentation } from '@alfresco/js-api';
import {
FORM_FIELD_VALIDATORS,
Expand All @@ -26,7 +27,6 @@ import {
AppConfigService,
PaginationComponent,
UserPreferenceValues,
AlfrescoApiService,
UserPreferencesService,
NotificationService
} from '@alfresco/adf-core';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,13 @@
*/

import { Component, Input, OnChanges, OnDestroy, OnInit, ViewChild, ViewEncapsulation } from '@angular/core';
import { TaskAttachmentListComponent, TaskListService, TaskUploadService } from '@alfresco/adf-process-services';
import { AlfrescoApiService, AppConfigService } from '@alfresco/adf-core';
import { DiscoveryApiService, UploadService } from '@alfresco/adf-content-services';
import {
TaskAttachmentListComponent,
TaskListService,
TaskUploadService
} from '@alfresco/adf-process-services';
import { AppConfigService } from '@alfresco/adf-core';
import { AlfrescoApiService, DiscoveryApiService, UploadService } from '@alfresco/adf-content-services';
import { PreviewService } from '../../services/preview.service';
import { Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@

import { Component, EventEmitter, Output, ViewEncapsulation, OnInit, Input } from '@angular/core';
import { Validators, UntypedFormGroup, UntypedFormBuilder, UntypedFormControl } from '@angular/forms';
import { AppConfigService, AppConfigValues, StorageService, AlfrescoApiService, AuthenticationService } from '@alfresco/adf-core';
import { AppConfigService, AppConfigValues, StorageService, AuthenticationService } from '@alfresco/adf-core';
import { ENTER } from '@angular/cdk/keycodes';
import { MAT_FORM_FIELD_DEFAULT_OPTIONS } from '@angular/material/form-field';
import { AlfrescoApiService } from '@alfresco/adf-content-services';

export const HOST_REGEX = '^(http|https)://.*[^/]$';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,10 @@
* limitations under the License.
*/

import { AppConfigService, UserPreferencesService, StorageService, AuthenticationService } from '@alfresco/adf-core';
import { Injectable } from '@angular/core';
import { AppConfigService } from '../app-config/app-config.service';
import { AlfrescoApiService } from '../services/alfresco-api.service';
import { StorageService } from '../common/services/storage.service';
import { UserPreferencesService } from '../common/services/user-preferences.service';
import { DemoForm } from '../mock/form/demo-form.mock';
import { AuthenticationService } from '../auth/services/authentication.service';
import { AlfrescoApiService } from '@alfresco/adf-content-services';
import { DemoForm } from 'lib/core/src/lib/mock/form/demo-form.mock';

@Injectable({
providedIn: 'root'
Expand Down
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ for more information about installing and using the source code.
| Name | Description | Source link |
| ---- | ----------- | ----------- |
| [APS Alfresco Content Service](core/services/activiti-alfresco.service.md) | Gets Alfresco Repository folder content based on a Repository account configured in Alfresco Process Services (APS). | [Source](../lib/process-services/src/lib/form/services/activiti-alfresco.service.ts) |
| [Alfresco Api Service](core/services/alfresco-api.service.md) | Provides access to an initialized AlfrescoJSApi instance. | [Source](../lib/core/src/lib/services/alfresco-api.service.ts) |
| [Alfresco Api Service](core/services/alfresco-api.service.md) | Provides access to an initialized AlfrescoJSApi instance. | [Source](lib/content-services/src/lib/services/alfresco-api.service.ts) |
| [App Config service](core/services/app-config.service.md) | Supports app configuration settings, stored server side. | [Source](../lib/core/src/lib/app-config/app-config.service.ts) |
| [Apps Process service](core/services/apps-process.service.md) | Gets details of the Process Services apps that are deployed for the user. | [Source](../lib/process-services/src/lib/app-list/services/apps-process.service.ts) |
| [Auth Guard Bpm service](core/services/auth-guard-bpm.service.md) | Adds authentication with Process Services to a route within the app. | [Source](../lib/core/src/lib/auth/guard/auth-guard-bpm.service.ts) |
Expand Down
6 changes: 3 additions & 3 deletions docs/core/pipes/localized-date.pipe.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ Converts a date to a given format and locale.

## Details

The pipe takes a date and formats it and localizes it so the date is displayed in the proper format for the region. It uses the [Angular Date Pipe](https://angular.io/api/common/DatePipe#custom-format-options) so all the pre-defined and custom formats can be used.
The pipe takes a date and formats it and localizes it so the date is displayed in the proper format for the region. It uses the [Angular Date Pipe](https://angular.io/api/common/DatePipe#custom-format-options) so all the pre-defined and custom formats can be used.

To localize the dates in your application, you will need to add the specific locale file for your region in order to use it. Read more about internationalization [here](https://angular.io/guide/i18n#i18n-pipes).

For example, if you want add the japanese date localization in your ADF app you can add in your `app.module.ts`:

```typescript
import { AppConfigService, TRANSLATION_PROVIDER, DebugAppConfigService, CoreModule, CoreAutomationService } from '@alfresco/adf-core';
import { AppConfigService, TRANSLATION_PROVIDER, DebugAppConfigService, CoreModule } from '@alfresco/adf-core';

.....
.....
Expand Down Expand Up @@ -65,4 +65,4 @@ You can overwrite the default values of this pipe by adding these properties to
| defaultDateTimeFormat | string | The format to apply to date-time values |
| defaultLocale | string | The locale id to apply |

This configuration overwrites the values in the [localized date pipe](../../core/pipes/localized-date.pipe.md) as well as other components to have more consistency across your app. However, you can still overwrite these values any time by using the pipe in your code.
This configuration overwrites the values in the [localized date pipe](../../core/pipes/localized-date.pipe.md) as well as other components to have more consistency across your app. However, you can still overwrite these values any time by using the pipe in your code.
2 changes: 1 addition & 1 deletion docs/core/services/alfresco-api.service.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Status: Active
Last reviewed: 2019-01-17
---

# [Alfresco Api Service](../../../lib/core/src/lib/services/alfresco-api.service.ts "Defined in alfresco-api.service.ts")
# [Alfresco Api Service](lib/content-services/src/lib/services/alfresco-api.service.ts "Defined in alfresco-api.service.ts")

Provides access to an initialized **AlfrescoJSApi** instance.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@
*/

import { AdfHttpClient } from '@alfresco/adf-core/api';
import { StorageService } from '../common/services/storage.service';
import { StorageService, AppConfigService } from '@alfresco/adf-core';
import { AlfrescoApi, AlfrescoApiConfig } from '@alfresco/js-api';
import { Injectable } from '@angular/core';
import { AppConfigService } from '../app-config';
import { AlfrescoApiService } from '../services/alfresco-api.service';

@Injectable()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@

import { AlfrescoApiConfig } from '@alfresco/js-api';
import { Injectable } from '@angular/core';
import { AppConfigService, AppConfigValues } from '../app-config/app-config.service';
import { AlfrescoApiService } from '../services/alfresco-api.service';
import { StorageService } from '../common/services/storage.service';
import { AppConfigService, AppConfigValues, StorageService } from '@alfresco/adf-core';
import { AlfrescoApiService } from '../services/alfresco-api.service';

/**
* Create a factory to resolve an api service instance
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*!
* @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 { APP_INITIALIZER, NgModule } from '@angular/core';
import { AlfrescoApiNoAuthService } from './alfresco-api-no-auth.service';
import { AlfrescoApiLoaderService, createAlfrescoApiInstance } from '../api-factories/alfresco-api-v2-loader.service';
import { AlfrescoApiService } from '../services';

@NgModule({
providers :[
{ provide: AlfrescoApiService, useClass: AlfrescoApiNoAuthService },
{
provide: APP_INITIALIZER,
useFactory: createAlfrescoApiInstance,
deps: [ AlfrescoApiLoaderService ],
multi: true
}
]
})
export class AlfrescoApiModule { }
21 changes: 21 additions & 0 deletions lib/content-services/src/lib/api-factories/public-api.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*!
* @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 * from './alfresco-api-no-auth.service';
export * from './alfresco-api-v2-loader.service';

export * from './alfresco-api.module';
Loading
Loading