Skip to content

Commit

Permalink
Update to 1.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
eagle23 committed Mar 26, 2021
1 parent 2631257 commit 3d26938
Show file tree
Hide file tree
Showing 6 changed files with 24,177 additions and 11,015 deletions.
20 changes: 20 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@

# source
lib
tests
index.ts
package-lock.json
tslint.json
tsconfig.json
.prettierrc

# github
.github
CONTRIBUTING.md
renovate.json

# misc
.commitlintrc.json
.release-it.json
.eslintignore
.eslintrc.js
87 changes: 87 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@

<h1 align="center">NestJS Simple Soap Client</h1>

### Installation

**Yarn**
```bash
yarn add simplesoapclient
```

Let's register the config module in `app.module.ts`

```ts
import { Module } from '@nestjs/common';
import { SimpleSoapModule } from './simplesoap/simplesoap.module';

@Module({
imports: [
SimpleSoapModule.forRoot({
name: 'SUPER_WSDL_SERVICE',
wsdl: 'https://example.com/service.svc?singlewsdl',
})
],
})
export class AppModule {}
```

In `app.service.ts`

```ts
import { Injectable } from '@nestjs/common';
import { InjectSoapClient, SimpleSoapService } from 'simplesoapclient';

@Injectable()
export class AppService {
constructor(
@InjectSoapClient('SUPER_WSDL_SERVICE') private readonly service: SimpleSoapService
){}

getHello(args): any {
return this.service.request<any>('SuperMethod', args)
}
}
```

Extended config for module

```ts

import {
httpClient,
fileCacher,
ISimplesoapOptions
} from 'simplesoapclient';

const wsdlHeaders = {
'User-Agent': 'My Super Agent',
}

export const config: ISimplesoapOptions = {
name: PUMPING_NAME,
wsdl: 'https://mtapi.contentdatapro.com:8443/PumpingGateway/MtPumpingApi.svc?singlewsdl',
soapOptions: {
httpClient: httpClient, // axios client
wsdl_headers: wsdlHeaders,

wsdl_options: {
timeout: 5000,
forever: true, // keep-alive
cacher: fileCacher // custom chacher
}
},
};
```

Cacher interface

```ts
interface ISimplesoapCacher {
get: (key: string) => Promise<string | null>
save: (key: string, data: string) => Promise<void>
}
```


-----

6 changes: 6 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
exports.__esModule = true;
__export(require("./dist"));
Loading

0 comments on commit 3d26938

Please # to comment.