@antelopejs/interface-dms 0.17.4-next.1103.g1c1421b → 0.17.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +37 -0
- package/README.md +9 -9
- package/dist/auth/index.d.ts +42 -0
- package/dist/auth/index.js +40 -0
- package/dist/auth/index.js.map +1 -1
- package/dist/base/data-types/default/identifiers.d.ts +62 -0
- package/dist/base/data-types/default/identifiers.js +183 -0
- package/dist/base/data-types/default/identifiers.js.map +1 -0
- package/dist/base/data-types/default/options.d.ts +30 -0
- package/dist/base/data-types/default-types.d.ts +10 -0
- package/dist/base/data-types/default-types.js +5 -0
- package/dist/base/data-types/default-types.js.map +1 -1
- package/dist/base/data-types/internal/legal-identifiers.d.ts +36 -0
- package/dist/base/data-types/internal/legal-identifiers.js +191 -0
- package/dist/base/data-types/internal/legal-identifiers.js.map +1 -0
- package/dist/base/form-schema.d.ts +32 -0
- package/dist/base/form-schema.js +9 -0
- package/dist/base/form-schema.js.map +1 -1
- package/dist/base/internal/column-badges.d.ts +3 -2
- package/dist/base/internal/column-badges.js +4 -3
- package/dist/base/internal/column-badges.js.map +1 -1
- package/dist/base/layouts.d.ts +1 -1
- package/dist/base/layouts.js.map +1 -1
- package/dist/base/table-view/internal/group-order.d.ts +26 -0
- package/dist/base/table-view/internal/group-order.js +50 -0
- package/dist/base/table-view/internal/group-order.js.map +1 -0
- package/dist/base/table-view/internal/grouped-pinned.d.ts +6 -0
- package/dist/base/table-view/internal/grouped-pinned.js +19 -0
- package/dist/base/table-view/internal/grouped-pinned.js.map +1 -0
- package/dist/base/table-view/internal/option-contract.d.ts +3 -3
- package/dist/base/table-view/internal/option-displays.d.ts +30 -0
- package/dist/base/table-view/internal/option-expandable.d.ts +12 -0
- package/dist/base/table-view/internal/validation.d.ts +22 -4
- package/dist/base/table-view/internal/validation.js +29 -8
- package/dist/base/table-view/internal/validation.js.map +1 -1
- package/dist/base/table-view/options.d.ts +1 -0
- package/dist/base/table-view/schema.d.ts +2 -0
- package/dist/base/table-view/schema.js +8 -0
- package/dist/base/table-view/schema.js.map +1 -1
- package/dist/base/table-view.d.ts +1 -1
- package/dist/base/table-view.js.map +1 -1
- package/dist/component-options/data-type.js +3 -3
- package/dist/component-options/data-type.js.map +1 -1
- package/dist/component-options/internal/data-type-registry.d.ts +14 -0
- package/dist/component-options/internal/data-type-registry.js +19 -0
- package/dist/component-options/internal/data-type-registry.js.map +1 -0
- package/dist/component-options/page-layout.d.ts +29 -1
- package/dist/component-options/page-layout.js +8 -2
- package/dist/component-options/page-layout.js.map +1 -1
- package/dist/page/internal/layout-filter.js +1 -1
- package/dist/page/internal/layout-filter.js.map +1 -1
- package/dist/period-request.d.ts +66 -0
- package/dist/period-request.js +149 -0
- package/dist/period-request.js.map +1 -0
- package/dist/request-tenant.d.ts +2 -1
- package/dist/request-tenant.js +2 -1
- package/dist/request-tenant.js.map +1 -1
- package/docs/1.core/12.frontend-modules-and-request-helpers.md +21 -1
- package/docs/1.core/5.tenancy.md +1 -1
- package/docs/2.auth/1.introduction.md +1 -1
- package/docs/2.auth/2.authentication.md +68 -0
- package/docs/3.base/11.page-layouts.md +18 -1
- package/docs/3.base/16.identifier-types.md +27 -0
- package/docs/3.base/4.tables.md +3 -3
- package/docs/3.base/8.data-types.md +7 -0
- package/docs/5.html-render/2.built-in-emails.md +2 -0
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,42 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## v0.17.4
|
|
4
|
+
|
|
5
|
+
[compare changes](https://github.com/AntelopeJS/dms/compare/interface-v0.17.3...interface-v0.17.4)
|
|
6
|
+
|
|
7
|
+
### 🚀 Enhancements
|
|
8
|
+
|
|
9
|
+
- **interface-dms:** Add a createdAtThenId index to the tenant table ([#1317](https://github.com/AntelopeJS/dms/pull/1317))
|
|
10
|
+
- **dms:** Warn of the mockup keys a block does not know, and return every compiler warning ([#1327](https://github.com/AntelopeJS/dms/pull/1327))
|
|
11
|
+
- **interface-dms:** Let EmptyLayout hide its logo and footer and fill the window ([#1323](https://github.com/AntelopeJS/dms/pull/1323))
|
|
12
|
+
- **dms:** Order the groups of the grouped table display ([#1332](https://github.com/AntelopeJS/dms/pull/1332))
|
|
13
|
+
- **interface-dms:** Read a PeriodSelector's period in a route with @Period() ([#1328](https://github.com/AntelopeJS/dms/pull/1328))
|
|
14
|
+
- **interface-dms:** Export a public bind for a verified credential without a user ([#1319](https://github.com/AntelopeJS/dms/pull/1319))
|
|
15
|
+
- **interface-dms:** Add IBAN, BIC, VAT number and company number data types ([#1324](https://github.com/AntelopeJS/dms/pull/1324))
|
|
16
|
+
- **dms:** Show expanded row fields in full and hide the empty ones ([#1256](https://github.com/AntelopeJS/dms/pull/1256))
|
|
17
|
+
- **dms:** Pin rows in the grouped table display ([#1335](https://github.com/AntelopeJS/dms/pull/1335))
|
|
18
|
+
|
|
19
|
+
### 🩹 Fixes
|
|
20
|
+
|
|
21
|
+
- **dms:** Point mockup issues at the faulty key and list the allowed values ([#1336](https://github.com/AntelopeJS/dms/pull/1336))
|
|
22
|
+
- **dms:** Send the built-in emails with a plain-text part beside the HTML ([#1320](https://github.com/AntelopeJS/dms/pull/1320))
|
|
23
|
+
- **dms:** Draw the all tab of tabsFrom in the dashboard's locale ([#1337](https://github.com/AntelopeJS/dms/pull/1337))
|
|
24
|
+
|
|
25
|
+
### 📦 Build
|
|
26
|
+
|
|
27
|
+
- **deps:** Bump tooling-configs to 0.10.15 and run sync ([#1312](https://github.com/AntelopeJS/dms/pull/1312))
|
|
28
|
+
- **deps:** Update the AntelopeJS module locks ([#1297](https://github.com/AntelopeJS/dms/pull/1297))
|
|
29
|
+
|
|
30
|
+
### 🏡 Chore
|
|
31
|
+
|
|
32
|
+
- **deps:** Update @antelopejs/tooling-configs to 0.10.14 and sync ([#1305](https://github.com/AntelopeJS/dms/pull/1305))
|
|
33
|
+
|
|
34
|
+
### ❤️ Contributors
|
|
35
|
+
|
|
36
|
+
- Antony Rizzitelli
|
|
37
|
+
- Maxime Westhoven
|
|
38
|
+
- dada-sudo
|
|
39
|
+
|
|
3
40
|
## v0.17.3
|
|
4
41
|
|
|
5
42
|
[compare changes](https://github.com/AntelopeJS/dms/compare/interface-v0.17.2...interface-v0.17.3)
|
package/README.md
CHANGED
|
@@ -58,15 +58,15 @@ export class SalesPage extends PageController("sales", {
|
|
|
58
58
|
|
|
59
59
|
<!-- antelopejs-docs-compat:start -->
|
|
60
60
|
|
|
61
|
-
| Package | Supported
|
|
62
|
-
| ------------------------------------------- |
|
|
63
|
-
| `@antelopejs/interface-api` | `>=0.3.5 <0.4.0`
|
|
64
|
-
| `@antelopejs/interface-api-util` | `>=0.3.3 <0.4.0`
|
|
65
|
-
| `@antelopejs/interface-core` | `>=0.5.2 <0.6.0`
|
|
66
|
-
| `@antelopejs/interface-data-api` | `>=0.8.2 <0.9.0`
|
|
67
|
-
| `@antelopejs/interface-database` | `>=0.4.
|
|
68
|
-
| `@antelopejs/interface-database-decorators` | `>=0.5.4 <0.6.0`
|
|
69
|
-
| `@antelopejs/interface-file-storage` | `>=0.1.
|
|
61
|
+
| Package | Supported | Tested with |
|
|
62
|
+
| ------------------------------------------- | ----------------- | ----------- |
|
|
63
|
+
| `@antelopejs/interface-api` | `>=0.3.5 <0.4.0` | `0.3.5` |
|
|
64
|
+
| `@antelopejs/interface-api-util` | `>=0.3.3 <0.4.0` | `0.3.3` |
|
|
65
|
+
| `@antelopejs/interface-core` | `>=0.5.2 <0.6.0` | `0.5.2` |
|
|
66
|
+
| `@antelopejs/interface-data-api` | `>=0.8.2 <0.9.0` | `0.8.2` |
|
|
67
|
+
| `@antelopejs/interface-database` | `>=0.4.5 <0.5.0` | `0.4.5` |
|
|
68
|
+
| `@antelopejs/interface-database-decorators` | `>=0.5.4 <0.6.0` | `0.5.4` |
|
|
69
|
+
| `@antelopejs/interface-file-storage` | `>=0.1.10 <0.2.0` | `0.1.10` |
|
|
70
70
|
|
|
71
71
|
<!-- antelopejs-docs-compat:end -->
|
|
72
72
|
|
package/dist/auth/index.d.ts
CHANGED
|
@@ -26,6 +26,48 @@ export interface TenantTokenInput {
|
|
|
26
26
|
* `interfaces/dms/guards`).
|
|
27
27
|
*/
|
|
28
28
|
export declare function authenticateRequestUser(ctx: RequestContext): Promise<User>;
|
|
29
|
+
/**
|
|
30
|
+
* The caller of a credential that stands for no `User`: a machine token, a
|
|
31
|
+
* deploy key, a development environment.
|
|
32
|
+
*/
|
|
33
|
+
export interface VerifiedRequestIdentity {
|
|
34
|
+
/**
|
|
35
|
+
* The caller the credential stands for, in a form no `User._id` takes
|
|
36
|
+
* (`environment:<id>`). The DMS compares it with the identity the request
|
|
37
|
+
* already carries and reads nothing else from it.
|
|
38
|
+
*/
|
|
39
|
+
id: string;
|
|
40
|
+
/** The tenant the credential was issued for, read from the credential's stored record. */
|
|
41
|
+
tenantId: string;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Bind the identity of a credential you verified yourself to the request, for
|
|
45
|
+
* a credential that stands for no `User`. `getRequestTenantId` then answers
|
|
46
|
+
* `identity.tenantId` for this request, as it does after a DMS auth decorator.
|
|
47
|
+
*
|
|
48
|
+
* Call it once the credential in the request's `Authorization` header has
|
|
49
|
+
* passed every check that makes it valid: its secret or signature, its expiry
|
|
50
|
+
* and its revocation. Take both fields from the stored record of that
|
|
51
|
+
* credential, never from a claim, a header or a body the caller sent.
|
|
52
|
+
*
|
|
53
|
+
* It grants nothing. No membership, permission or tenant access gate is
|
|
54
|
+
* checked: the guard that calls it keeps those checks. A credential that
|
|
55
|
+
* stands for a `User` goes through a `RequestAuthenticator` instead
|
|
56
|
+
* (`authenticateTenantRequest`, `AuthTenantMember`, `AuthTenantOwner`), which
|
|
57
|
+
* reloads the user and checks its membership.
|
|
58
|
+
*
|
|
59
|
+
* A provider resolved alongside the guard (`TenantScopedModel`,
|
|
60
|
+
* `resolveRequestTenantId`) does not wait for this call. A request such a
|
|
61
|
+
* provider already read as anonymous refuses the identity, so read the tenant
|
|
62
|
+
* in the handler with `getRequestTenantId`.
|
|
63
|
+
*
|
|
64
|
+
* @param ctx The request context the guard's provider receives
|
|
65
|
+
* @param identity The caller and the tenant of the verified credential
|
|
66
|
+
* @throws HTTPResult 401 when `identity` has no id or no tenant, when the
|
|
67
|
+
* request already carries another identity or tenant, a failed authentication
|
|
68
|
+
* or an anonymous read, or when its `Authorization` header changed since
|
|
69
|
+
*/
|
|
70
|
+
export declare function bindVerifiedRequestIdentity(ctx: RequestContext, identity: VerifiedRequestIdentity): void;
|
|
29
71
|
/**
|
|
30
72
|
* @internal
|
|
31
73
|
*/
|
package/dist/auth/index.js
CHANGED
|
@@ -16,6 +16,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
exports.sanitizeUser = exports.sendAdminInviteEmail = exports.sendEmailForgotEmail = exports.sendEmailValidationEmail = exports.send2FAEmail = exports.validateTenantAssignmentToken = exports.generateTenantAssignmentToken = exports.validateTwoFactorToken = exports.generateTwoFactorToken = exports.validateRefreshToken = exports.generateRefreshToken = exports.generateAccessToken = exports.AuthOwnerOnly = exports.IfAuthUser = exports.AuthUser = exports.AuthRawUser = exports.internal = exports.ParseUserAgent = exports.NotifyCollaboratorJoined = exports.NotifyWelcome = void 0;
|
|
18
18
|
exports.authenticateRequestUser = authenticateRequestUser;
|
|
19
|
+
exports.bindVerifiedRequestIdentity = bindVerifiedRequestIdentity;
|
|
19
20
|
exports.linkExternalIdentity = linkExternalIdentity;
|
|
20
21
|
exports.getExternalIdentities = getExternalIdentities;
|
|
21
22
|
exports.announceRegistration = announceRegistration;
|
|
@@ -66,6 +67,45 @@ async function authenticateRequestUser(ctx) {
|
|
|
66
67
|
});
|
|
67
68
|
return validated;
|
|
68
69
|
}
|
|
70
|
+
/**
|
|
71
|
+
* Bind the identity of a credential you verified yourself to the request, for
|
|
72
|
+
* a credential that stands for no `User`. `getRequestTenantId` then answers
|
|
73
|
+
* `identity.tenantId` for this request, as it does after a DMS auth decorator.
|
|
74
|
+
*
|
|
75
|
+
* Call it once the credential in the request's `Authorization` header has
|
|
76
|
+
* passed every check that makes it valid: its secret or signature, its expiry
|
|
77
|
+
* and its revocation. Take both fields from the stored record of that
|
|
78
|
+
* credential, never from a claim, a header or a body the caller sent.
|
|
79
|
+
*
|
|
80
|
+
* It grants nothing. No membership, permission or tenant access gate is
|
|
81
|
+
* checked: the guard that calls it keeps those checks. A credential that
|
|
82
|
+
* stands for a `User` goes through a `RequestAuthenticator` instead
|
|
83
|
+
* (`authenticateTenantRequest`, `AuthTenantMember`, `AuthTenantOwner`), which
|
|
84
|
+
* reloads the user and checks its membership.
|
|
85
|
+
*
|
|
86
|
+
* A provider resolved alongside the guard (`TenantScopedModel`,
|
|
87
|
+
* `resolveRequestTenantId`) does not wait for this call. A request such a
|
|
88
|
+
* provider already read as anonymous refuses the identity, so read the tenant
|
|
89
|
+
* in the handler with `getRequestTenantId`.
|
|
90
|
+
*
|
|
91
|
+
* @param ctx The request context the guard's provider receives
|
|
92
|
+
* @param identity The caller and the tenant of the verified credential
|
|
93
|
+
* @throws HTTPResult 401 when `identity` has no id or no tenant, when the
|
|
94
|
+
* request already carries another identity or tenant, a failed authentication
|
|
95
|
+
* or an anonymous read, or when its `Authorization` header changed since
|
|
96
|
+
*/
|
|
97
|
+
function bindVerifiedRequestIdentity(ctx, identity) {
|
|
98
|
+
if (!(0, type_check_1.isString)(identity.id) ||
|
|
99
|
+
!identity.id ||
|
|
100
|
+
!(0, type_check_1.isString)(identity.tenantId) ||
|
|
101
|
+
!identity.tenantId) {
|
|
102
|
+
throw (0, request_authenticators_1.unauthorized)();
|
|
103
|
+
}
|
|
104
|
+
(0, request_authenticators_1.bindVerifiedRequestPrincipal)(ctx, {
|
|
105
|
+
userId: identity.id,
|
|
106
|
+
tenantId: identity.tenantId,
|
|
107
|
+
});
|
|
108
|
+
}
|
|
69
109
|
/**
|
|
70
110
|
* @internal
|
|
71
111
|
*/
|
package/dist/auth/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/auth/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/auth/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,6DAA4E;AAC5E,+DAA+D;AAC/D,gEAA6D;AAC7D,6FAAqE;AACrE,oCAA8C;AAC9C,6BAOc;AACd,8DAAyD;AAEzD,sEAAuE;AACvE,8EAG2C;AAC3C,4CAAiD;AACjD,6DAAmE;AAEnE,2DAAyC;AAEzC;;;;;;GAMG;AACU,QAAA,aAAa,GACxB,IAAA,kCAAiB,GAA0C,CAAC;AAE9D,gBAAgB;AACH,QAAA,wBAAwB,GACnC,IAAA,kCAAiB,GAEd,CAAC;AAEN,gBAAgB;AACH,QAAA,cAAc,GACzB,IAAA,kCAAiB,GAA0C,CAAC;AAE9D,MAAM,aAAa,GAAG,GAAG,CAAC;AAC1B,MAAM,+BAA+B,GAAG,qCAAqC,CAAC;AAQ9E;;;;;GAKG;AACI,KAAK,kCACV,GAAmB;IAEnB,MAAM,UAAU,GAAG,GAAG,CAAC,UAAU,EAAE,OAAO,EAAE,aAAa,CAAC;IAC1D,MAAM,KAAK,GAAG,IAAA,qBAAQ,EAAC,UAAU,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAC1E,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC;IAC5D,MAAM,SAAS,GAAG,MAAM,QAAQ,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;IAC5D,IAAI,CAAC,SAAS,IAAI,IAAA,sBAAS,EAAC,SAA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E,CAAC;IACvB,MAAM,GAAG,GAAG,MAAM,YAAY,CAAC,MAAM,CAAC;QACpC,MAAM;QACN,SAAS,EAAE,SAAS,IAAI,EAAE;QAC1B,EAAE,EAAE,EAAE,IAAI,EAAE;QACZ,OAAO,EAAE,OAAO,IAAI,SAAS;QAC7B,EAAE,EAAE,EAAE,IAAI,SAAS;QACnB,UAAU;QACV,QAAQ,EAAE,EAAE;QACZ,SAAS,EAAE,GAAG;QACd,YAAY,EAAE,GAAG;KAClB,CAAC,CAAC;IAEH,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/** Stable legal and bank identifier data types. @packageDocumentation */
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { FormComponents } from "../../form-schema";
|
|
4
|
+
import { DataType } from "../core";
|
|
5
|
+
import type { ValueProxyOrValue } from "@antelopejs/interface-database";
|
|
6
|
+
import { BicTypeOptions, CompanyNumberTypeOptions, IbanTypeOptions, VatNumberTypeOptions } from "./options";
|
|
7
|
+
type FilterArguments = Parameters<DataType["filter"]>;
|
|
8
|
+
/**
|
|
9
|
+
* The `iban` data type: an IBAN, checked against its check digits (ISO
|
|
10
|
+
* 13616, modulo 97) and stored without spaces in upper case
|
|
11
|
+
* (`BE68539007547034`).
|
|
12
|
+
*
|
|
13
|
+
* @docsApi
|
|
14
|
+
*/
|
|
15
|
+
export declare class IbanType extends DataType {
|
|
16
|
+
readonly options: IbanTypeOptions;
|
|
17
|
+
constructor(options?: IbanTypeOptions);
|
|
18
|
+
protected defaultInputComponent(): import("../../..").ComponentInfoSerialized<FormComponents.InputIdentifierOptions>;
|
|
19
|
+
filter(...args: FilterArguments): ValueProxyOrValue<boolean>;
|
|
20
|
+
getValidation(): z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* The `bic` data type: a BIC of 8 or 11 characters (ISO 9362), stored
|
|
24
|
+
* without spaces in upper case.
|
|
25
|
+
*
|
|
26
|
+
* @docsApi
|
|
27
|
+
*/
|
|
28
|
+
export declare class BicType extends DataType {
|
|
29
|
+
readonly options: BicTypeOptions;
|
|
30
|
+
constructor(options?: BicTypeOptions);
|
|
31
|
+
protected defaultInputComponent(): import("../../..").ComponentInfoSerialized<FormComponents.InputIdentifierOptions>;
|
|
32
|
+
filter(...args: FilterArguments): ValueProxyOrValue<boolean>;
|
|
33
|
+
getValidation(): z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* The `vat_number` data type: a VAT number of the EU, Northern Ireland or
|
|
37
|
+
* Great Britain, stored as VIES writes it (`BE0123456749`).
|
|
38
|
+
*
|
|
39
|
+
* @docsApi
|
|
40
|
+
*/
|
|
41
|
+
export declare class VatNumberType extends DataType {
|
|
42
|
+
readonly options: VatNumberTypeOptions;
|
|
43
|
+
constructor(options?: VatNumberTypeOptions);
|
|
44
|
+
protected defaultInputComponent(): import("../../..").ComponentInfoSerialized<FormComponents.InputIdentifierOptions>;
|
|
45
|
+
filter(...args: FilterArguments): ValueProxyOrValue<boolean>;
|
|
46
|
+
getValidation(): z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* The `company_number` data type: the registration number of a company in
|
|
50
|
+
* its country's register, stored as digits only.
|
|
51
|
+
*
|
|
52
|
+
* @docsApi
|
|
53
|
+
*/
|
|
54
|
+
export declare class CompanyNumberType extends DataType {
|
|
55
|
+
readonly options: CompanyNumberTypeOptions;
|
|
56
|
+
/** @throws When `options.country` is not a country it reads. */
|
|
57
|
+
constructor(options: CompanyNumberTypeOptions);
|
|
58
|
+
protected defaultInputComponent(): import("../../..").ComponentInfoSerialized<FormComponents.InputIdentifierOptions>;
|
|
59
|
+
filter(...args: FilterArguments): ValueProxyOrValue<boolean>;
|
|
60
|
+
getValidation(): z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
61
|
+
}
|
|
62
|
+
export {};
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.CompanyNumberType = exports.VatNumberType = exports.BicType = exports.IbanType = void 0;
|
|
13
|
+
/** Stable legal and bank identifier data types. @packageDocumentation */
|
|
14
|
+
const zod_1 = require("zod");
|
|
15
|
+
const form_schema_1 = require("../../form-schema");
|
|
16
|
+
const core_1 = require("../core");
|
|
17
|
+
const compare_types_1 = require("../compare-types");
|
|
18
|
+
const legal_identifiers_1 = require("../internal/legal-identifiers");
|
|
19
|
+
const IDENTIFIER_COMPARE_TYPES = [
|
|
20
|
+
compare_types_1.DefaultDataCompareTypes.Is,
|
|
21
|
+
compare_types_1.DefaultDataCompareTypes.IsNot,
|
|
22
|
+
compare_types_1.DefaultDataCompareTypes.Contains,
|
|
23
|
+
compare_types_1.DefaultDataCompareTypes.NotContains,
|
|
24
|
+
compare_types_1.DefaultDataCompareTypes.IsEmpty,
|
|
25
|
+
compare_types_1.DefaultDataCompareTypes.IsNotEmpty,
|
|
26
|
+
];
|
|
27
|
+
/**
|
|
28
|
+
* Filters an identifier column on the text `read` makes of the typed value,
|
|
29
|
+
* so `is` and `contains` find the stored compact identifier. `is` and
|
|
30
|
+
* `is_not` compare that text as text: a company number's digits are not a
|
|
31
|
+
* number.
|
|
32
|
+
*/
|
|
33
|
+
function filterIdentifier(type, read, [context, proxy, key, value, mode, row]) {
|
|
34
|
+
const text = (0, legal_identifiers_1.identifierFilterText)(String(value), read);
|
|
35
|
+
if (mode === "is")
|
|
36
|
+
return proxy.eq(text);
|
|
37
|
+
if (mode === "is_not")
|
|
38
|
+
return proxy.ne(text);
|
|
39
|
+
return core_1.DataType.prototype.filter.call(type, context, proxy, key, text, mode, row);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* A string schema that stores what `read` returns and refuses, with
|
|
43
|
+
* `message`, a value it cannot read.
|
|
44
|
+
*/
|
|
45
|
+
function identifierSchema(read, message) {
|
|
46
|
+
return zod_1.z.string().transform((value, context) => {
|
|
47
|
+
const canonical = read(value);
|
|
48
|
+
if (canonical !== undefined)
|
|
49
|
+
return canonical;
|
|
50
|
+
context.addIssue({ code: zod_1.z.ZodIssueCode.custom, message });
|
|
51
|
+
return zod_1.z.NEVER;
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* The `iban` data type: an IBAN, checked against its check digits (ISO
|
|
56
|
+
* 13616, modulo 97) and stored without spaces in upper case
|
|
57
|
+
* (`BE68539007547034`).
|
|
58
|
+
*
|
|
59
|
+
* @docsApi
|
|
60
|
+
*/
|
|
61
|
+
let IbanType = class IbanType extends core_1.DataType {
|
|
62
|
+
options;
|
|
63
|
+
constructor(options = {}) {
|
|
64
|
+
super(IDENTIFIER_COMPARE_TYPES, compare_types_1.DefaultDataCompareTypes.Contains, options);
|
|
65
|
+
this.options = options;
|
|
66
|
+
}
|
|
67
|
+
defaultInputComponent() {
|
|
68
|
+
return form_schema_1.FormComponents.InputIdentifier({
|
|
69
|
+
identifier: "iban",
|
|
70
|
+
placeholder: this.options.placeholder,
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
filter(...args) {
|
|
74
|
+
return filterIdentifier(this, legal_identifiers_1.readIban, args);
|
|
75
|
+
}
|
|
76
|
+
getValidation() {
|
|
77
|
+
return identifierSchema(legal_identifiers_1.readIban, "$dms.field_errors.invalid_iban");
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
exports.IbanType = IbanType;
|
|
81
|
+
exports.IbanType = IbanType = __decorate([
|
|
82
|
+
(0, core_1.RegisterDataType)("iban"),
|
|
83
|
+
__metadata("design:paramtypes", [Object])
|
|
84
|
+
], IbanType);
|
|
85
|
+
/**
|
|
86
|
+
* The `bic` data type: a BIC of 8 or 11 characters (ISO 9362), stored
|
|
87
|
+
* without spaces in upper case.
|
|
88
|
+
*
|
|
89
|
+
* @docsApi
|
|
90
|
+
*/
|
|
91
|
+
let BicType = class BicType extends core_1.DataType {
|
|
92
|
+
options;
|
|
93
|
+
constructor(options = {}) {
|
|
94
|
+
super(IDENTIFIER_COMPARE_TYPES, compare_types_1.DefaultDataCompareTypes.Contains, options);
|
|
95
|
+
this.options = options;
|
|
96
|
+
}
|
|
97
|
+
defaultInputComponent() {
|
|
98
|
+
return form_schema_1.FormComponents.InputIdentifier({
|
|
99
|
+
identifier: "bic",
|
|
100
|
+
placeholder: this.options.placeholder,
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
filter(...args) {
|
|
104
|
+
return filterIdentifier(this, legal_identifiers_1.readBic, args);
|
|
105
|
+
}
|
|
106
|
+
getValidation() {
|
|
107
|
+
return identifierSchema(legal_identifiers_1.readBic, "$dms.field_errors.invalid_bic");
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
exports.BicType = BicType;
|
|
111
|
+
exports.BicType = BicType = __decorate([
|
|
112
|
+
(0, core_1.RegisterDataType)("bic"),
|
|
113
|
+
__metadata("design:paramtypes", [Object])
|
|
114
|
+
], BicType);
|
|
115
|
+
/**
|
|
116
|
+
* The `vat_number` data type: a VAT number of the EU, Northern Ireland or
|
|
117
|
+
* Great Britain, stored as VIES writes it (`BE0123456749`).
|
|
118
|
+
*
|
|
119
|
+
* @docsApi
|
|
120
|
+
*/
|
|
121
|
+
let VatNumberType = class VatNumberType extends core_1.DataType {
|
|
122
|
+
options;
|
|
123
|
+
constructor(options = {}) {
|
|
124
|
+
super(IDENTIFIER_COMPARE_TYPES, compare_types_1.DefaultDataCompareTypes.Contains, options);
|
|
125
|
+
this.options = options;
|
|
126
|
+
}
|
|
127
|
+
defaultInputComponent() {
|
|
128
|
+
return form_schema_1.FormComponents.InputIdentifier({
|
|
129
|
+
identifier: "vat_number",
|
|
130
|
+
placeholder: this.options.placeholder,
|
|
131
|
+
defaultCountry: this.options.defaultCountry,
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
filter(...args) {
|
|
135
|
+
return filterIdentifier(this, (value) => (0, legal_identifiers_1.readVatNumber)(value, this.options.defaultCountry), args);
|
|
136
|
+
}
|
|
137
|
+
getValidation() {
|
|
138
|
+
const { defaultCountry } = this.options;
|
|
139
|
+
return identifierSchema((value) => (0, legal_identifiers_1.readVatNumber)(value, defaultCountry), "$dms.field_errors.invalid_vat_number");
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
exports.VatNumberType = VatNumberType;
|
|
143
|
+
exports.VatNumberType = VatNumberType = __decorate([
|
|
144
|
+
(0, core_1.RegisterDataType)("vat_number"),
|
|
145
|
+
__metadata("design:paramtypes", [Object])
|
|
146
|
+
], VatNumberType);
|
|
147
|
+
/**
|
|
148
|
+
* The `company_number` data type: the registration number of a company in
|
|
149
|
+
* its country's register, stored as digits only.
|
|
150
|
+
*
|
|
151
|
+
* @docsApi
|
|
152
|
+
*/
|
|
153
|
+
let CompanyNumberType = class CompanyNumberType extends core_1.DataType {
|
|
154
|
+
options;
|
|
155
|
+
/** @throws When `options.country` is not a country it reads. */
|
|
156
|
+
constructor(options) {
|
|
157
|
+
if (!(0, legal_identifiers_1.isCompanyNumberCountry)(options?.country)) {
|
|
158
|
+
throw new Error(`CompanyNumberType reads a company number of "BE" or "FR", not ${JSON.stringify(options?.country)}`);
|
|
159
|
+
}
|
|
160
|
+
super(IDENTIFIER_COMPARE_TYPES, compare_types_1.DefaultDataCompareTypes.Contains, options);
|
|
161
|
+
this.options = options;
|
|
162
|
+
}
|
|
163
|
+
defaultInputComponent() {
|
|
164
|
+
return form_schema_1.FormComponents.InputIdentifier({
|
|
165
|
+
identifier: "company_number",
|
|
166
|
+
placeholder: this.options.placeholder,
|
|
167
|
+
country: this.options.country,
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
filter(...args) {
|
|
171
|
+
return filterIdentifier(this, (value) => (0, legal_identifiers_1.readCompanyNumber)(value, this.options.country), args);
|
|
172
|
+
}
|
|
173
|
+
getValidation() {
|
|
174
|
+
const { country } = this.options;
|
|
175
|
+
return identifierSchema((value) => (0, legal_identifiers_1.readCompanyNumber)(value, country), "$dms.field_errors.invalid_company_number");
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
exports.CompanyNumberType = CompanyNumberType;
|
|
179
|
+
exports.CompanyNumberType = CompanyNumberType = __decorate([
|
|
180
|
+
(0, core_1.RegisterDataType)("company_number"),
|
|
181
|
+
__metadata("design:paramtypes", [Object])
|
|
182
|
+
], CompanyNumberType);
|
|
183
|
+
//# sourceMappingURL=identifiers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identifiers.js","sourceRoot":"","sources":["../../../../src/base/data-types/default/identifiers.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yEAAyE;AACzE,6BAAwB;AACxB,mDAAmD;AACnD,kCAAqD;AAErD,oDAA2D;AAO3D,qEAOuC;AAEvC,MAAM,wBAAwB,GAAG;IAC/B,uCAAuB,CAAC,EAAE;IAC1B,uCAAuB,CAAC,KAAK;IAC7B,uCAAuB,CAAC,QAAQ;IAChC,uCAAuB,CAAC,WAAW;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AC;uBANjD,OAAO;IAOnC,CAAC;IAES,qBAAqB;QAC7B,OAAO,4BAAc,CAAC,eAAe,CAAC;YACpC,UAAU,EAAE,gBAAgB;YAC5B,WAAW,EAAE,IAAI,CAAC,OAAO,CAAC,WAAW;YACrC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,OAAO;SAC9B,CAAC,CAAC;IACL,CAAC;IAEQ,MAAM,CAAC,GAAG,IAAqB;QACtC,OAAO,gBAAgB,CACrB,IAAI,EACJ,CAAC,KAAK,EAAE,EAAE,CAAC,IAAA,qCAAiB,EAAC,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,EACzD,IAAI,CACL,CAAC;IACJ,CAAC;IAED,aAAa;QACX,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC;QACjC,OAAO,gBAAgB,CACrB,CAAC,KAAK,EAAE,EAAE,CAAC,IAAA,qCAAiB,EAAC,KAAK,EAAE,OAAO,CAAC,EAC5C,0CAA0C,CAC3C,CAAC;IACJ,CAAC;CACF,CAAA;;4BAlCY,iBAAiB;IAD7B,IAAA,uBAAgB,EAAC,gBAAgB,CAAC;;GACtB,iBAAiB,CAkC7B"}
|
|
@@ -161,6 +161,36 @@ export type PhoneTypeOptions = {
|
|
|
161
161
|
defaultCountry?: string;
|
|
162
162
|
fallback?: string;
|
|
163
163
|
};
|
|
164
|
+
export type IbanTypeOptions = {
|
|
165
|
+
placeholder?: string;
|
|
166
|
+
fallback?: string;
|
|
167
|
+
};
|
|
168
|
+
export type BicTypeOptions = {
|
|
169
|
+
placeholder?: string;
|
|
170
|
+
fallback?: string;
|
|
171
|
+
};
|
|
172
|
+
export type VatNumberTypeOptions = {
|
|
173
|
+
placeholder?: string;
|
|
174
|
+
/**
|
|
175
|
+
* ISO 3166-1 alpha-2 code ("BE") a number typed without its country's
|
|
176
|
+
* code is read in. Valid values are stored as VIES writes them
|
|
177
|
+
* ("BE0123456749").
|
|
178
|
+
*/
|
|
179
|
+
defaultCountry?: string;
|
|
180
|
+
fallback?: string;
|
|
181
|
+
};
|
|
182
|
+
/** A country whose company registration number `CompanyNumberType` reads. */
|
|
183
|
+
export type CompanyNumberCountry = "BE" | "FR";
|
|
184
|
+
export type CompanyNumberTypeOptions = {
|
|
185
|
+
/**
|
|
186
|
+
* The register the number belongs to: `"BE"` an enterprise number of the
|
|
187
|
+
* Crossroads Bank for Enterprises (ten digits), `"FR"` a SIREN (nine
|
|
188
|
+
* digits). Valid values are stored as digits only.
|
|
189
|
+
*/
|
|
190
|
+
country: CompanyNumberCountry;
|
|
191
|
+
placeholder?: string;
|
|
192
|
+
fallback?: string;
|
|
193
|
+
};
|
|
164
194
|
export type RichTextTypeOptions = {
|
|
165
195
|
placeholder?: string;
|
|
166
196
|
fallback?: string;
|
|
@@ -18,6 +18,7 @@ import * as defaultStrings from "./default/strings";
|
|
|
18
18
|
import * as defaultRelations from "./default/relations";
|
|
19
19
|
import * as defaultAddress from "./default/address";
|
|
20
20
|
import * as defaultFiles from "./default/files";
|
|
21
|
+
import * as defaultIdentifiers from "./default/identifiers";
|
|
21
22
|
/** How a `SelectType` shows its options. */
|
|
22
23
|
export declare const SELECT_DISPLAYS: readonly ["dropdown", "cards", "segmented", "radio"];
|
|
23
24
|
/** How a `BooleanType` shows its value. */
|
|
@@ -37,6 +38,11 @@ export declare namespace DefaultDataTypes {
|
|
|
37
38
|
export import PhoneTypeOptions = defaultOptions.PhoneTypeOptions;
|
|
38
39
|
export import RichTextTypeOptions = defaultOptions.RichTextTypeOptions;
|
|
39
40
|
export import StringTimeTypeOptions = defaultOptions.StringTimeTypeOptions;
|
|
41
|
+
export import IbanTypeOptions = defaultOptions.IbanTypeOptions;
|
|
42
|
+
export import BicTypeOptions = defaultOptions.BicTypeOptions;
|
|
43
|
+
export import VatNumberTypeOptions = defaultOptions.VatNumberTypeOptions;
|
|
44
|
+
export import CompanyNumberCountry = defaultOptions.CompanyNumberCountry;
|
|
45
|
+
export import CompanyNumberTypeOptions = defaultOptions.CompanyNumberTypeOptions;
|
|
40
46
|
export import NumberType = defaultNumbers.NumberType;
|
|
41
47
|
export import StringType = defaultNumbers.StringType;
|
|
42
48
|
export import DateType = defaultNumbers.DateType;
|
|
@@ -49,6 +55,10 @@ export declare namespace DefaultDataTypes {
|
|
|
49
55
|
export import PasswordType = defaultStrings.PasswordType;
|
|
50
56
|
export import UrlType = defaultStrings.UrlType;
|
|
51
57
|
export import PhoneType = defaultStrings.PhoneType;
|
|
58
|
+
export import IbanType = defaultIdentifiers.IbanType;
|
|
59
|
+
export import BicType = defaultIdentifiers.BicType;
|
|
60
|
+
export import VatNumberType = defaultIdentifiers.VatNumberType;
|
|
61
|
+
export import CompanyNumberType = defaultIdentifiers.CompanyNumberType;
|
|
52
62
|
export import RelationFilterBy = defaultRelations.RelationFilterBy;
|
|
53
63
|
export import RelationType = defaultRelations.RelationType;
|
|
54
64
|
export import CascaderRelationType = defaultRelations.CascaderRelationType;
|
|
@@ -53,6 +53,7 @@ const defaultStrings = __importStar(require("./default/strings"));
|
|
|
53
53
|
const defaultRelations = __importStar(require("./default/relations"));
|
|
54
54
|
const defaultAddress = __importStar(require("./default/address"));
|
|
55
55
|
const defaultFiles = __importStar(require("./default/files"));
|
|
56
|
+
const defaultIdentifiers = __importStar(require("./default/identifiers"));
|
|
56
57
|
/** How a `SelectType` shows its options. */
|
|
57
58
|
exports.SELECT_DISPLAYS = [
|
|
58
59
|
"dropdown",
|
|
@@ -76,6 +77,10 @@ var DefaultDataTypes;
|
|
|
76
77
|
DefaultDataTypes.PasswordType = defaultStrings.PasswordType;
|
|
77
78
|
DefaultDataTypes.UrlType = defaultStrings.UrlType;
|
|
78
79
|
DefaultDataTypes.PhoneType = defaultStrings.PhoneType;
|
|
80
|
+
DefaultDataTypes.IbanType = defaultIdentifiers.IbanType;
|
|
81
|
+
DefaultDataTypes.BicType = defaultIdentifiers.BicType;
|
|
82
|
+
DefaultDataTypes.VatNumberType = defaultIdentifiers.VatNumberType;
|
|
83
|
+
DefaultDataTypes.CompanyNumberType = defaultIdentifiers.CompanyNumberType;
|
|
79
84
|
DefaultDataTypes.RelationType = defaultRelations.RelationType;
|
|
80
85
|
DefaultDataTypes.CascaderRelationType = defaultRelations.CascaderRelationType;
|
|
81
86
|
DefaultDataTypes.AddressType = defaultAddress.AddressType;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"default-types.js","sourceRoot":"","sources":["../../../src/base/data-types/default-types.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sCAAoC;AACpC,mDAAiD;AACjD,8CAA4C;AAC5C,eAAa;AACb,6CAA2C;AAC3C,2CAAyC;AACzC,6BAA2B;AAC3B,0BAAwB;AACxB,oBAAkB;AAClB,kBAAgB;AAChB,MAAY,UAAU,0CAAsB;AAC5C,oCAAkC;AAClC,2BAAyB;AAEzB,MAAY,cAAc,8CAA0B;AACpD,MAAY,cAAc,8CAA0B;AACpD,MAAY,cAAc,8CAA0B;AACpD,MAAY,gBAAgB,gDAA4B;AACxD,MAAY,cAAc,8CAA0B;AACpD,MAAY,YAAY,4CAAwB;AAChD,4CAA4C;AAC/B,QAAA,eAAe,GAAG;IAC7B,UAAU;IACV,OAAO;IACP,WAAW;IACX,OAAO;CACC,CAAC;AAEX,2CAA2C;AAC9B,QAAA,gBAAgB,GAAG,CAAC,QAAQ,EAAE,UAAU,EAAE,MAAM,CAAU,CAAC;AAIxE,IAAiB,gBAAgB,
|
|
1
|
+
{"version":3,"file":"default-types.js","sourceRoot":"","sources":["../../../src/base/data-types/default-types.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sCAAoC;AACpC,mDAAiD;AACjD,8CAA4C;AAC5C,eAAa;AACb,6CAA2C;AAC3C,2CAAyC;AACzC,6BAA2B;AAC3B,0BAAwB;AACxB,oBAAkB;AAClB,kBAAgB;AAChB,MAAY,UAAU,0CAAsB;AAC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BAAiB,GAAG,kBAAkB,CAAC,iBAAkB,CAAA;IAEzD,iBAAA,YAAY,GAAG,gBAAgB,CAAC,YAAa,CAAA;IAC7C,iBAAA,oBAAoB,GAAG,gBAAgB,CAAC,oBAAqB,CAAA;IAG7D,iBAAA,WAAW,GAAG,cAAc,CAAC,WAAY,CAAA;IACzC,iBAAA,YAAY,GAAG,YAAY,CAAC,YAAa,CAAA;IACzC,iBAAA,cAAc,GAAG,YAAY,CAAC,cAAe,CAAA;IAE7C,iBAAA,QAAQ,GAAG,YAAY,CAAC,QAAS,CAAA;IAGjC,iBAAA,SAAS,GAAG,YAAY,CAAC,SAAU,CAAA;IAEpC,0BAAS,GAAG,UAAU,CAAC,SAAS,CAAC;IAMjC,6BAAY,GAAG,UAAU,CAAC,YAAY,CAAC;IAMvC,2BAAU,GAAG,UAAU,CAAC,UAAU,CAAC;IAMnC,yBAAQ,GAAG,UAAU,CAAC,QAAQ,CAAC;IAM/B,yBAAQ,GAAG,UAAU,CAAC,QAAQ,CAAC;AAK9C,CAAC,EA9EgB,gBAAgB,aAAhB,gBAAgB,GAAhB,gBAAgB,QA8EhC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { CompanyNumberCountry } from "../default/options";
|
|
2
|
+
/**
|
|
3
|
+
* @internal What a filter of an identifier column looks for: the identifier
|
|
4
|
+
* `read` makes of the typed text, or else that text compacted, so a part of
|
|
5
|
+
* an identifier typed as printed (`BE68 5390`) finds the stored one.
|
|
6
|
+
*/
|
|
7
|
+
export declare function identifierFilterText(value: string, read: (value: string) => string | undefined): string;
|
|
8
|
+
/**
|
|
9
|
+
* @internal An IBAN without spaces (`BE68539007547034`), checked against its
|
|
10
|
+
* two check digits (ISO 13616, modulo 97); `undefined` when it is none.
|
|
11
|
+
*/
|
|
12
|
+
export declare function readIban(value: string): string | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* @internal A BIC of 8 or 11 characters (ISO 9362): party prefix, country,
|
|
15
|
+
* location and an optional branch; `undefined` when it is none.
|
|
16
|
+
*/
|
|
17
|
+
export declare function readBic(value: string): string | undefined;
|
|
18
|
+
/** @internal Whether `country` is one whose company number is read. */
|
|
19
|
+
export declare function isCompanyNumberCountry(country: unknown): country is CompanyNumberCountry;
|
|
20
|
+
/**
|
|
21
|
+
* @internal A company registration number of `country` as its register
|
|
22
|
+
* writes it, digits only: a Belgian enterprise number of ten digits (the
|
|
23
|
+
* nine of before 2005 get their leading zero), a French SIREN of nine.
|
|
24
|
+
* Typed with its country's code in front (`BE 0123.456.749`), it reads the
|
|
25
|
+
* same. `undefined` when it is none.
|
|
26
|
+
*/
|
|
27
|
+
export declare function readCompanyNumber(value: string, country: CompanyNumberCountry): string | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* @internal A VAT number as VIES writes it (`BE0123456749`): its country's
|
|
30
|
+
* code, then its number without spaces. The number must have its country's
|
|
31
|
+
* format; Belgium, Germany, France, Italy and Luxembourg also check its check
|
|
32
|
+
* digits. A number typed without its country's code reads in
|
|
33
|
+
* `defaultCountry`, and a Belgian one of nine digits gets its leading zero.
|
|
34
|
+
* `undefined` when it is none.
|
|
35
|
+
*/
|
|
36
|
+
export declare function readVatNumber(value: string, defaultCountry?: string): string | undefined;
|