diff --git a/docs/.nojekyll b/docs/.nojekyll new file mode 100644 index 0000000..e2ac661 --- /dev/null +++ b/docs/.nojekyll @@ -0,0 +1 @@ +TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false. \ No newline at end of file diff --git a/docs/README.md b/docs/README.md new file mode 100644 index 0000000..cabf259 --- /dev/null +++ b/docs/README.md @@ -0,0 +1,9 @@ +# bir1 + +## Modules + +- [\](modules/internal_.md) + +## Classes + +- [Bir](classes/Bir.md) diff --git a/docs/classes/Bir.md b/docs/classes/Bir.md new file mode 100644 index 0000000..c72f020 --- /dev/null +++ b/docs/classes/Bir.md @@ -0,0 +1,177 @@ +# Class: Bir + +Class Bir provides access to REGON API + +**`Example`** + +```js + import Bir from 'bir1' + const bir = new Bir() + await bir.login() + console.log(await bir.search({ nip: '5261040567' })) + // output: + // { + // regon: '011417295', + // nip: '5261040567', + // statusNip: '', + // nazwa: 'T-MOBILE POLSKA SPÓŁKA AKCYJNA', + // ... + // } +``` + +## Constructors + +### constructor + +• **new Bir**(`options?`): [`Bir`](Bir.md) + +Create a new Bir instance + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `options` | `Object` | - | +| `options.key?` | `string` | API key provided by GUS. **`Remarks`** If `options.key` is not provided, the internally stored public API key is used to access non-production GUS database. It allows quick start, however non-production database contains old and anonymized data. Providing GUS provided key connects to the production database. | +| `options.parseOptions?` | [`ParseOptions`](../interfaces/internal_.ParseOptions.md) | Additional parse options for XML parser | + +#### Returns + +[`Bir`](Bir.md) + +#### Defined in + +[bir.ts:53](https://github.com/pawel-id/bir1/blob/140054f/src/bir.ts#L53) + +## Methods + +### login + +▸ **login**(): `Promise`\<`void`\> + +Login to the API (method: Zaloguj) + +#### Returns + +`Promise`\<`void`\> + +**`Remarks`** + +This method must be called before any other method. It is not called +automatically to allow for more control over the login process. + +#### Defined in + +[bir.ts:113](https://github.com/pawel-id/bir1/blob/140054f/src/bir.ts#L113) + +___ + +### value + +▸ **value**(`value`): `Promise`\<`string`\> + +Get diagnostic information (method: GetValue) + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `value` | [`GetValueOptions`](../modules/internal_.md#getvalueoptions) | value to retrieve | + +#### Returns + +`Promise`\<`string`\> + +#### Defined in + +[bir.ts:126](https://github.com/pawel-id/bir1/blob/140054f/src/bir.ts#L126) + +___ + +### search + +▸ **search**(`query`): `Promise`\<`any`\> + +Search (method: DaneSzukajPodmioty) + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `query` | \{ `nip`: `string` } \| \{ `regon`: `string` } \| \{ `krs`: `string` } | + +#### Returns + +`Promise`\<`any`\> + +**`Remarks`** + +Only one of the query parameters can be used at a time. + +#### Defined in + +[bir.ts:142](https://github.com/pawel-id/bir1/blob/140054f/src/bir.ts#L142) + +___ + +### report + +▸ **report**(`query`): `Promise`\<`any`\> + +Retrive report (method: DanePobierzPelnyRaport) + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `query` | `Object` | - | +| `query.regon` | `string` | REGON number | +| `query.report` | [`DanePobierzPelnyRaportOptions`](../modules/internal_.md#danepobierzpelnyraportoptions) | report name | + +#### Returns + +`Promise`\<`any`\> + +#### Defined in + +[bir.ts:153](https://github.com/pawel-id/bir1/blob/140054f/src/bir.ts#L153) + +___ + +### summary + +▸ **summary**(`query`): `Promise`\<`any`\> + +Retrive summary report (method: DanePobierzRaportZbiorczy) + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `query` | `Object` | - | +| `query.date` | `string` | date in format YYYY-MM-DD not earlier than week before | +| `query.report` | [`DanePobierzRaportZbiorczyOptions`](../modules/internal_.md#danepobierzraportzbiorczyoptions) | report name | + +#### Returns + +`Promise`\<`any`\> + +#### Defined in + +[bir.ts:167](https://github.com/pawel-id/bir1/blob/140054f/src/bir.ts#L167) + +___ + +### logout + +▸ **logout**(): `Promise`\<`void`\> + +Logout (method: Wyloguj) + +#### Returns + +`Promise`\<`void`\> + +#### Defined in + +[bir.ts:179](https://github.com/pawel-id/bir1/blob/140054f/src/bir.ts#L179) diff --git a/docs/classes/internal_.Xml.md b/docs/classes/internal_.Xml.md new file mode 100644 index 0000000..611e7fc --- /dev/null +++ b/docs/classes/internal_.Xml.md @@ -0,0 +1,43 @@ +# Class: Xml + +[\](../modules/internal_.md).Xml + +## Constructors + +### constructor + +• **new Xml**(`options?`): [`Xml`](internal_.Xml.md) + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `options` | `Partial`\<[`ParseOptions`](../interfaces/internal_.ParseOptions.md)\> | + +#### Returns + +[`Xml`](internal_.Xml.md) + +#### Defined in + +[xml.ts:62](https://github.com/pawel-id/bir1/blob/140054f/src/xml.ts#L62) + +## Methods + +### parse + +▸ **parse**(`xml`): `any` + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `xml` | `string` | + +#### Returns + +`any` + +#### Defined in + +[xml.ts:74](https://github.com/pawel-id/bir1/blob/140054f/src/xml.ts#L74) diff --git a/docs/interfaces/internal_.ParseOptions.md b/docs/interfaces/internal_.ParseOptions.md new file mode 100644 index 0000000..0ade739 --- /dev/null +++ b/docs/interfaces/internal_.ParseOptions.md @@ -0,0 +1,33 @@ +# Interface: ParseOptions + +[\](../modules/internal_.md).ParseOptions + +## Properties + +### emptyTag + +• `Optional` **emptyTag**: [`EmptyTag`](../modules/internal_.md#emptytag) + +When parsing XML the empty tags are replaced by '' - this is the default +behavior of fast-ml-parser. When this variable is set to any other value, +the empty tags are futher replaced by that value, overriding default ''. + +#### Defined in + +[xml.ts:14](https://github.com/pawel-id/bir1/blob/140054f/src/xml.ts#L14) + +___ + +### xmlOptions + +• `Optional` **xmlOptions**: `Partial`\<`X2jOptions`\> + +Additional parse options for XML parser. Any option of fast-xml-parser +can be used here. This object is passed to the constructor of +fast-xml-parser. Then parser is used to parse XML response from GUS. + +See [fast-xml-parser](https://github.com/NaturalIntelligence/fast-xml-parser/blob/HEAD/docs/v4/2.XMLparseOptions.md) + +#### Defined in + +[xml.ts:23](https://github.com/pawel-id/bir1/blob/140054f/src/xml.ts#L23) diff --git a/docs/modules/internal_.md b/docs/modules/internal_.md new file mode 100644 index 0000000..15fbad6 --- /dev/null +++ b/docs/modules/internal_.md @@ -0,0 +1,55 @@ +# Module: \ + +## Classes + +- [Xml](../classes/internal_.Xml.md) + +## Interfaces + +- [ParseOptions](../interfaces/internal_.ParseOptions.md) + +## Type Aliases + +### GetValueOptions + +Ƭ **GetValueOptions**: ``"StanDanych"`` \| ``"KomunikatKod"`` \| ``"KomunikatTresc"`` \| ``"StatusSesji"`` \| ``"StatusUslugi"`` \| ``"KomunikatUslugi"`` + +Options for method `GetValue`. + +#### Defined in + +[types.ts:4](https://github.com/pawel-id/bir1/blob/140054f/src/types.ts#L4) + +___ + +### DanePobierzPelnyRaportOptions + +Ƭ **DanePobierzPelnyRaportOptions**: ``"PublDaneRaportFizycznaOsoba"`` \| ``"PublDaneRaportDzialalnoscFizycznejCeidg"`` \| ``"PublDaneRaportDzialalnoscFizycznejRolnicza"`` \| ``"PublDaneRaportDzialalnoscFizycznejPozostala"`` \| ``"PublDaneRaportDzialalnoscFizycznejWKrupgn"`` \| ``"PublDaneRaportDzialalnosciFizycznej"`` \| ``"PublDaneRaportLokalneFizycznej"`` \| ``"PublDaneRaportLokalnaFizycznej"`` \| ``"PublDaneRaportDzialalnosciLokalnejFizycznej"`` \| ``"PublDaneRaportPrawna"`` \| ``"PublDaneRaportDzialalnosciPrawnej"`` \| ``"PublDaneRaportLokalnePrawnej"`` \| ``"PublDaneRaportLokalnaPrawnej"`` \| ``"PublDaneRaportDzialalnosciLokalnejPrawnej"`` \| ``"PublDaneRaportWspolnicyPrawnej"`` \| ``"PublDaneRaportTypJednostki"`` \| ``"BIR11OsFizycznaDaneOgolne"`` \| ``"BIR11OsFizycznaDzialalnoscCeidg"`` \| ``"BIR11OsFizycznaDzialalnoscRolnicza"`` \| ``"BIR11OsFizycznaDzialalnoscPozostala"`` \| ``"BIR11OsFizycznaDzialalnoscSkreslonaDo20141108"`` \| ``"BIR11OsFizycznaPkd"`` \| ``"BIR11OsFizycznaListaJednLokalnych"`` \| ``"BIR11JednLokalnaOsFizycznej"`` \| ``"BIR11JednLokalnaOsFizycznejPkd"`` \| ``"BIR11OsPrawna"`` \| ``"BIR11OsPrawnaPkd"`` \| ``"BIR11OsPrawnaListaJednLokalnych"`` \| ``"BIR11JednLokalnaOsPrawnej"`` \| ``"BIR11JednLokalnaOsPrawnejPkd"`` \| ``"BIR11OsPrawnaSpCywilnaWspolnicy"`` \| ``"BIR11TypPodmiotu"`` + +Reports for method `DanePobierzPelnyRaport`. + +#### Defined in + +[types.ts:28](https://github.com/pawel-id/bir1/blob/140054f/src/types.ts#L28) + +___ + +### DanePobierzRaportZbiorczyOptions + +Ƭ **DanePobierzRaportZbiorczyOptions**: ``"BIR11NowePodmiotyPrawneOrazDzialalnosciOsFizycznych"`` \| ``"BIR11AktualizowanePodmiotyPrawneOrazDzialalnosciOsFizycznych"`` \| ``"BIR11SkreslonePodmiotyPrawneOrazDzialalnosciOsFizycznych"`` \| ``"BIR11NoweJednostkiLokalne"`` \| ``"BIR11AktualizowaneJednostkiLokalne"`` \| ``"BIR11SkresloneJednostkiLokalne"`` + +Reports for method `DanePobierzRaportZbiorczy`. + +#### Defined in + +[types.ts:65](https://github.com/pawel-id/bir1/blob/140054f/src/types.ts#L65) + +___ + +### EmptyTag + +Ƭ **EmptyTag**: `string` \| ``null`` \| `undefined` + +#### Defined in + +[xml.ts:5](https://github.com/pawel-id/bir1/blob/140054f/src/xml.ts#L5) diff --git a/package.json b/package.json index e8586b4..24735f9 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "templates" ], "scripts": { - "build": "rimraf dist && tsc", + "build": "rimraf docs dist && typedoc && tsc", "dev": "tsc -w", "test": "tap" }, diff --git a/typedoc.json b/typedoc.json index 9a13263..5a0e303 100644 --- a/typedoc.json +++ b/typedoc.json @@ -14,5 +14,5 @@ "sort": ["source-order"], "entryPoints": ["./src/"], "readme": "none", - "out": "./doc" + "out": "./docs" }