loopbackio / loopbackio/strong-soap

Y'all want some types?

Open
#709 0 comments 7 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
410
Forks
162
Avg merge
4h 36m
Merged PRs (30d)
7

Description

I wrote a small .d.ts for part of the codebase, and I'd love it if it was on definitelyTyped instead. Would you want me to open this there or anything? I figure even if its only a tiny part of the code, it might be nice to have as a starting point.

```
type SoapOptions = {
timeout?: number;
time?: boolean;
} & Record;

type SoapReturnCallback = (
error: any,
envelope: string,
result?: {
return: TYPE;
},
soapHeader: any
) => void;

type SoapReturnPromise = Promise<{
envelope: string;
result?: {
return: TYPE;
};
soapHeader: any;
}>;

interface SoapOperation {
(
args: Parameters[0],
opts?: SoapOptions,
extraHeaders?: any
): SoapReturnPromise>;
(
args: Parameters[0],
callback: SoapReturnCallback>,
opts?: SoapOptions,
extraHeaders?: any
): void;
(
args: Parameters[0],
opts: SoapOptions | undefined,
callback: SoapReturnCallback>
): void;
(
args: Parameters[0],
opts: SoapOptions | undefined,
extraHeaders: any,
callback: SoapReturnCallback>
): void;
}

/**
* Converts a function map into a SOAP API
*/
export type SoapAPI = {
[Prop in keyof API]: API[Prop] extends Function
? SoapOperation
: SoapAPI;
};

declare module 'strong-soap' {
export const soap: {
BasicAuthSecurity: new (username: string, password: string) => {};
Client: new () => SoapAPI & {
describe(): any;
setEndpoint(endpoint: string): void;
setSecurity(security: BasicAuthSecurity): void;
};
createClient(
url: string,
options: {endpoint?: string} & Record,
callback: (err: Error, client: InstanceOf>) => void,
endpoint?: string
): void;
createClient(
url: string,
callback: (err: Error, client: InstanceOf>) => void,
endpoint?: string
): void;
};
}
```

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the supplied .d.ts declaration and the DefinitelyTyped request; no project file or test is named. Compare the declarations with the strong-soap module surface shown in the issue, and consider the work complete when the typings are accepted in the appropriate DefinitelyTyped package.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
api
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.