Skip to content

Commit

Permalink
Merge pull request #3 from weisenburger/feature/WBDSBLA-4056
Browse files Browse the repository at this point in the history
Feature/wbdsbla 4056
  • Loading branch information
wbdsnbraun authored Dec 21, 2023
2 parents 1166530 + 6c8fcfe commit 82152f4
Show file tree
Hide file tree
Showing 23 changed files with 94 additions and 48 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Global build

on:
pull_request:
branches: [ master ]

jobs:
build:

runs-on: ubuntu-latest
timeout-minutes: 25
strategy:
matrix:
node-version: [ 20.x ]

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- run: git fetch --no-tags --prune --depth=5 origin master
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- uses: actions/cache@v1
with:
path: node_modules
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-modules-
- run: npm install --legacy-peer-deps
- run: npm run build
env:
CI: true
28 changes: 14 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@wbds/angular-web-worker",
"version": "15.2.2",
"version": "17.0.0",
"description": "Library to assist with web worker communication in Angular apps",
"main": "y",
"scripts": {
Expand All @@ -24,15 +24,15 @@
"reflect-metadata": "^0.1.13"
},
"devDependencies": {
"@angular-devkit/core": "^15.2.2",
"@angular-devkit/schematics": "^15.2.2",
"@angular/common": "^15.2.2",
"@angular/compiler": "^15.2.2",
"@angular/compiler-cli": "^15.2.2",
"@angular/core": "^15.2.2",
"@angular/platform-browser": "^15.2.2",
"@angular/platform-browser-dynamic": "^15.2.2",
"@schematics/angular": "^15.2.2",
"@angular-devkit/core": "^17.0.3",
"@angular-devkit/schematics": "^17.0.3",
"@angular/common": "^17.0.4",
"@angular/compiler": "^17.0.4",
"@angular/compiler-cli": "^17.0.4",
"@angular/core": "^17.0.4",
"@angular/platform-browser": "^17.0.4",
"@angular/platform-browser-dynamic": "^17.0.4",
"@schematics/angular": "^17.0.3",
"@types/jasmine": "^3.3.16",
"@types/sinon": "^7.0.13",
"copyfiles": "^2.1.1",
Expand All @@ -49,16 +49,16 @@
"karma-sourcemap-loader": "^0.4.0",
"karma-typescript": "^5.0.0",
"karma-webpack": "^5.0.0",
"ng-packagr": "^15.2.2",
"ng-packagr": "^17.0.2",
"rimraf": "^3.0.2",
"rxjs": "^7.5.2",
"rxjs": "^7.5.7",
"ts-loader": "^9.2.6",
"ts-node": "^10.4.0",
"tsconfig-paths-webpack-plugin": "^4.1.0",
"tslib": "^2.0.0",
"tslint": "^6.1.3",
"typescript": "4.8.3",
"typescript": "5.2.2",
"webpack": "^5.68.0",
"zone.js": "^0.13.1"
"zone.js": "^0.14.2"
}
}
10 changes: 5 additions & 5 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Schematics from the original package are not supported at the moment.

# Getting Started

### 1. Use an existing, or create a new Angular (v15+) app
### 1. Use an existing, or create a new Angular (v17+) app

### 2. Install the library

Expand All @@ -18,7 +18,7 @@ An example web worker could look like this:

*app.worker.ts*
```typescript
import { AngularWebWorker, bootstrapWorker, OnWorkerInit } from '@wbds/angular-web-worker';
import { AngularWebWorker, bootstrapWorker, OnWorkerInit } from '@wbds/angular-web-worker/web-worker';
/// <reference lib="webworker" />

@AngularWebWorker()
Expand Down Expand Up @@ -73,9 +73,9 @@ import { WorkerManager, WorkerClient } from '@wbds/angular-web-worker';
})
export class AppComponent implements OnInit {

private client: WorkerClient<AppWorker>;
private readonly client: WorkerClient<AppWorker>;

constructor(private workerManager: WorkerManager) { }
constructor(private readonly workerManager: WorkerManager) { }

ngOnInit() {
if (this.workerManager.isBrowserCompatible) {
Expand All @@ -102,7 +102,7 @@ Any logic or initialization of variables in the constructor of the worker class

*app.worker.ts*
```typescript
import { AngularWebWorker, bootstrapWorker, OnWorkerInit } from '@wbds/angular-web-worker';
import { AngularWebWorker, bootstrapWorker, OnWorkerInit } from '@wbds/angular-web-worker/web-worker';
import { Subject } from 'rxjs';
/// <reference lib="webworker" />

Expand Down
2 changes: 1 addition & 1 deletion src/lib/angular/worker-client-types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Subject, Subscription, Observable } from 'rxjs';
import {SecretResult, WorkerAccessableBody, WorkerCallableBody, WorkerEvents, WorkerResponseEvent, WorkerSubscribableBody} from '../common/worker-events';
import {SecretResult, WorkerAccessableBody, WorkerCallableBody, WorkerEvents, WorkerResponseEvent, WorkerSubscribableBody} from '../common';

/**
* A dictionary of client observables that have been created to listen to events trigger by RxJS subjects in the worker.
Expand Down
2 changes: 1 addition & 1 deletion src/lib/angular/worker-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {Observable, Subject, Subscription} from 'rxjs';
import {WorkerClientObservablesDict, WorkerClientRequestOpts} from './worker-client-types';
import {WorkerDefinition} from './worker.module';
import {ClientWebWorker} from './client-web-worker';
import {SecretResult, WorkerEvent, WorkerEvents, WorkerObservableMessage, WorkerObservableMessageTypes, WorkerRequestEvent, WorkerResponseEvent} from '../common/worker-events';
import {SecretResult, WorkerEvent, WorkerEvents, WorkerObservableMessage, WorkerObservableMessageTypes, WorkerRequestEvent, WorkerResponseEvent} from '../common';
import {AccessableMetaData, CallableMetaData, FunctionsOnly, NonObservablesOnly, ObservablesOnly, WorkerAnnotations, WorkerObservableType, WorkerUtils} from '../common';


Expand Down
6 changes: 1 addition & 5 deletions src/lib/common/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
export * from './annotations';
export * from './worker-utils';
export * from './worker-types';
export * from './worker-events';
export * from './message-bus';
export * from '../worker/common';
3 changes: 1 addition & 2 deletions src/lib/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
export * from './worker';
export * from './angular';
export * from './common';
export * from './worker/common';
4 changes: 2 additions & 2 deletions src/lib/worker/accessable-decorator.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'reflect-metadata';
import {WorkerUtils} from '../common/worker-utils';
import {AccessableMetaData, WorkerAnnotations} from '../common/annotations';
import {WorkerUtils} from './common/worker-utils';
import {AccessableMetaData, WorkerAnnotations} from './common/annotations';

/**
* Configurable options for the `@Accessable()` decorator, defining how the decorated property can be interacted with from a `WorkerClient`.
Expand Down
4 changes: 2 additions & 2 deletions src/lib/worker/bootstrap-worker.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

import { WorkerController } from './worker-controller';
import {WebWorkerType} from '../common/worker-types';
import {WorkerMessageBus} from '../common/message-bus';
import {WebWorkerType} from './common/worker-types';
import {WorkerMessageBus} from './common/message-bus';

/**
* Bootstraps the worker class when a new worker script is created in the browser. The class must be decorated with `@AngularWebWorker()`
Expand Down
6 changes: 3 additions & 3 deletions src/lib/worker/callable-decorator.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'reflect-metadata';
import {CallableMetaData, WorkerAnnotations, WorkerConfig} from '../common/annotations';
import {WorkerUtils} from '../common/worker-utils';
import {SecretResult, WorkerEvents} from '../common/worker-events';
import {CallableMetaData, WorkerAnnotations, WorkerConfig} from './common/annotations';
import {WorkerUtils} from './common/worker-utils';
import {SecretResult, WorkerEvents} from './common/worker-events';

/**
* Configurable options for the `@Callable()` decorator, defining how the decorated method is called from a `WorkerClient`.
Expand Down
File renamed without changes.
5 changes: 5 additions & 0 deletions src/lib/worker/common/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export * from './annotations';
export * from './worker-utils';
export * from './worker-types';
export * from './worker-events';
export * from './message-bus';
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
7 changes: 7 additions & 0 deletions src/lib/worker/public_api.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export * from './web-worker-decorator';
export * from './bootstrap-worker';
export * from './callable-decorator';
export * from './accessable-decorator';
export * from './subscribable-decorator';
export * from './shallow-transfer-decorator';
export * from './lifecycle-hooks';
4 changes: 2 additions & 2 deletions src/lib/worker/shallow-transfer-decorator.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {ShallowTransferParamMetaData, WorkerAnnotations} from '../common/annotations';
import {WorkerUtils} from '../common/worker-utils';
import {ShallowTransferParamMetaData, WorkerAnnotations} from './common/annotations';
import {WorkerUtils} from './common/worker-utils';

/**
* Transfers the decorated argument's prototype when it is serialized and unserialized when the method is called from `WorkerClient.call()`. This will only have an effect if
Expand Down
6 changes: 3 additions & 3 deletions src/lib/worker/subscribable-decorator.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'reflect-metadata';
import {ObservablesOnly} from '../common/worker-types';
import {SubscribableMetaData, WorkerAnnotations} from '../common/annotations';
import {WorkerUtils} from '../common/worker-utils';
import {ObservablesOnly} from './common/worker-types';
import {SubscribableMetaData, WorkerAnnotations} from './common/annotations';
import {WorkerUtils} from './common/worker-utils';

/**
* Allows the decorated worker property to be subscribed to, or observed through the `WorkerClient.subscribe()` and `WorkerClient.observe()` methods.
Expand Down
6 changes: 3 additions & 3 deletions src/lib/worker/web-worker-decorator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
/*
* Collection of factory functions for the factory as attached to a single object which allows for testing of imported function
*/
import {AccessableMetaData, SubscribableMetaData, WorkerAnnotations, WorkerConfig} from '../common/annotations';
import {WorkerUtils} from '../common/worker-utils';
import {SecretResult, WorkerEvents} from '../common/worker-events';
import {AccessableMetaData, SubscribableMetaData, WorkerAnnotations, WorkerConfig} from './common/annotations';
import {WorkerUtils} from './common/worker-utils';
import {SecretResult, WorkerEvents} from './common/worker-events';

export interface WorkerFactoryFunctionsDict {
/*
Expand Down
10 changes: 5 additions & 5 deletions src/lib/worker/worker-controller.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Subject, Subscription } from 'rxjs';
import {WebWorkerType} from '../common/worker-types';
import {WorkerUtils} from '../common/worker-utils';
import {AccessableMetaData, ShallowTransferParamMetaData, WorkerAnnotations} from '../common/annotations';
import {WorkerMessageBus} from '../common/message-bus';
import {WorkerEvent, WorkerEvents, WorkerObservableMessage, WorkerObservableMessageTypes, WorkerRequestEvent, WorkerResponseEvent} from '../common/worker-events';
import {WebWorkerType} from './common/worker-types';
import {WorkerUtils} from './common/worker-utils';
import {AccessableMetaData, ShallowTransferParamMetaData, WorkerAnnotations} from './common/annotations';
import {WorkerMessageBus} from './common/message-bus';
import {WorkerEvent, WorkerEvents, WorkerObservableMessage, WorkerObservableMessageTypes, WorkerRequestEvent, WorkerResponseEvent} from './common/worker-events';
/**
* Handles communication to and from a `WorkerClient` and triggers work with the worker class.
*/
Expand Down
5 changes: 5 additions & 0 deletions web-worker/ng-package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"lib": {
"entryFile": "../src/lib/worker/public_api.ts"
}
}

0 comments on commit 82152f4

Please sign in to comment.