nestjs-soap
Advanced tools
Comparing version
export declare const SOAP_MODULE_OPTIONS = "SOAP_MODULE_OPTIONS"; | ||
export declare const BASIC_AUTH = "basic"; | ||
export declare const WSSECURITY_AUTH = "wssecurity"; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.SOAP_MODULE_OPTIONS = void 0; | ||
exports.WSSECURITY_AUTH = exports.BASIC_AUTH = exports.SOAP_MODULE_OPTIONS = void 0; | ||
exports.SOAP_MODULE_OPTIONS = 'SOAP_MODULE_OPTIONS'; | ||
exports.BASIC_AUTH = 'basic'; | ||
exports.WSSECURITY_AUTH = 'wssecurity'; | ||
//# sourceMappingURL=soap-constants.js.map |
import { IOptions } from 'soap'; | ||
import { ModuleMetadata, Type } from '@nestjs/common'; | ||
import { BASIC_AUTH, WSSECURITY_AUTH } from './soap-constants'; | ||
export { Client, IOptions } from 'soap'; | ||
export declare type BasicAuth = { | ||
interface Auth { | ||
type: typeof BASIC_AUTH | typeof WSSECURITY_AUTH; | ||
username: string; | ||
password: string; | ||
} | ||
export interface BasicAuth extends Auth { | ||
} | ||
export interface WSSecurityAuth extends Auth { | ||
options?: WSSecurityOptions; | ||
} | ||
export declare type WSSecurityOptions = { | ||
passwordType?: string; | ||
hasTimeStamp?: boolean; | ||
hasTokenCreated?: boolean; | ||
hasNonce?: boolean; | ||
mustUnderstand?: boolean; | ||
actor?: string; | ||
}; | ||
@@ -11,3 +26,3 @@ export declare type SoapModuleOptions = { | ||
clientName: string; | ||
auth?: BasicAuth; | ||
auth?: BasicAuth | WSSecurityAuth; | ||
clientOptions?: IOptions; | ||
@@ -14,0 +29,0 @@ }; |
@@ -39,4 +39,7 @@ "use strict"; | ||
return client; | ||
const basicAuth = new soap_1.BasicAuthSecurity(options.auth.username, options.auth.password); | ||
client.setSecurity(basicAuth); | ||
const { username, password } = options.auth; | ||
const authMethod = options.auth.type === soap_constants_1.WSSECURITY_AUTH | ||
? new soap_1.WSSecurity(username, password, options.auth.options) | ||
: new soap_1.BasicAuthSecurity(username, password); | ||
client.setSecurity(authMethod); | ||
return client; | ||
@@ -43,0 +46,0 @@ } |
{ | ||
"name": "nestjs-soap", | ||
"version": "2.0.1", | ||
"version": "2.1.0", | ||
"description": "Nestjs module wrapper for soap", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -7,6 +7,4 @@ <a href="https://www.npmjs.com/nestjs-soap" target="_blank"><img src="https://img.shields.io/npm/v/nestjs-soap.svg?v2" alt="NPM Version" /></a> | ||
Nestjs module wrapper for soap | ||
### Nestjs module wrapper for [soap](https://www.npmjs.com/package/soap) npm package | ||
This package internally uses [soap](https://www.npmjs.com/package/soap) npm package | ||
## Install | ||
@@ -93,3 +91,3 @@ | ||
The injected Client is from the soap npm package. From here, please follow the use instructions on the [soap repository](https://www.npmjs.com/package/soap). | ||
The injected Client is from the soap npm package. This example is using the [soap method async](https://www.npmjs.com/package/soap#clientmethodasyncargs-options---call-method-on-the-soap-service) from soap package. From here, please follow the [Client](https://www.npmjs.com/package/soap#client) use instructions on the soap repository. | ||
@@ -115,2 +113,3 @@ ### Soap Module Factory | ||
auth: { | ||
type: 'basic', | ||
username: configService.get<string>('soap.username'), | ||
@@ -147,5 +146,5 @@ password: configService.get<string>('soap.password'), | ||
`auth`: Basic authentication filling in the `username` and `password` fields when needed. | ||
`auth` (optional): Basic or WSSecurity authentication. Fields `type` (basic or wssecurity), `username` and `password` are required. For the WSSecurity `options` field, refer to [soap-repository](https://www.npmjs.com/package/soap#wssecurity) | ||
`clientOptions`: The soap client options as in [soap repository](https://www.npmjs.com/package/soap#options). | ||
`clientOptions` (optional): The soap client options as in [soap repository](https://www.npmjs.com/package/soap#options). | ||
@@ -152,0 +151,0 @@ ### SoapModuleAsyncOptions |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Unpublished package
Supply chain riskPackage version was not found on the registry. It may exist on a different registry and need to be configured to pull from that registry.
Found 1 instance in 1 package
25840
5.79%273
8.76%159
-0.62%1
Infinity%