@parischap/conversions 0.1.0 → 0.3.0
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/README.md +50 -49
- package/cjs/BigDecimal.js +2 -2
- package/cjs/BigInt.js +7 -5
- package/cjs/BigInt.js.map +1 -1
- package/cjs/DateTime.js +144 -136
- package/cjs/DateTime.js.map +1 -1
- package/cjs/DateTimeFormat.js +7 -2
- package/cjs/DateTimeFormat.js.map +1 -1
- package/cjs/DateTimeFormatContext.js +11 -6
- package/cjs/DateTimeFormatContext.js.map +1 -1
- package/cjs/Email.js +11 -15
- package/cjs/Email.js.map +1 -1
- package/cjs/Integer.js +33 -23
- package/cjs/Integer.js.map +1 -1
- package/cjs/NumberBase10Format.js +65 -65
- package/cjs/PositiveInteger.js +44 -29
- package/cjs/PositiveInteger.js.map +1 -1
- package/cjs/PositiveReal.js +34 -24
- package/cjs/PositiveReal.js.map +1 -1
- package/cjs/Real.js +29 -18
- package/cjs/Real.js.map +1 -1
- package/cjs/RoundingMode.js +7 -4
- package/cjs/RoundingMode.js.map +1 -1
- package/cjs/RoundingOption.js +6 -6
- package/cjs/RoundingOption.js.map +1 -1
- package/cjs/Schema.js +29 -28
- package/cjs/Schema.js.map +1 -1
- package/cjs/SemVer.js +19 -20
- package/cjs/SemVer.js.map +1 -1
- package/cjs/Template.js +36 -31
- package/cjs/Template.js.map +1 -1
- package/cjs/TemplatePart.js +4 -4
- package/cjs/TemplateParts.js +3 -2
- package/cjs/TemplateParts.js.map +1 -1
- package/cjs/TemplatePlaceholder.js +56 -45
- package/cjs/TemplatePlaceholder.js.map +1 -1
- package/cjs/TemplateSeparator.js +17 -24
- package/cjs/TemplateSeparator.js.map +1 -1
- package/cjs/internal/Int.js +5 -8
- package/cjs/internal/Int.js.map +1 -1
- package/cjs/internal/Positive.js +5 -8
- package/cjs/internal/Positive.js.map +1 -1
- package/dts/BigDecimal.d.ts +2 -2
- package/dts/BigDecimal.d.ts.map +1 -1
- package/dts/BigInt.d.ts +7 -5
- package/dts/BigInt.d.ts.map +1 -1
- package/dts/DateTime.d.ts +145 -137
- package/dts/DateTime.d.ts.map +1 -1
- package/dts/DateTimeFormat.d.ts +7 -2
- package/dts/DateTimeFormat.d.ts.map +1 -1
- package/dts/DateTimeFormatContext.d.ts +17 -12
- package/dts/DateTimeFormatContext.d.ts.map +1 -1
- package/dts/Email.d.ts +16 -13
- package/dts/Email.d.ts.map +1 -1
- package/dts/Integer.d.ts +43 -21
- package/dts/Integer.d.ts.map +1 -1
- package/dts/NumberBase10Format.d.ts +68 -68
- package/dts/PositiveInteger.d.ts +54 -27
- package/dts/PositiveInteger.d.ts.map +1 -1
- package/dts/PositiveReal.d.ts +44 -22
- package/dts/PositiveReal.d.ts.map +1 -1
- package/dts/Real.d.ts +39 -16
- package/dts/Real.d.ts.map +1 -1
- package/dts/RoundingMode.d.ts +6 -3
- package/dts/RoundingMode.d.ts.map +1 -1
- package/dts/RoundingOption.d.ts +6 -6
- package/dts/Schema.d.ts +32 -33
- package/dts/Schema.d.ts.map +1 -1
- package/dts/SemVer.d.ts +25 -13
- package/dts/SemVer.d.ts.map +1 -1
- package/dts/Template.d.ts +30 -29
- package/dts/Template.d.ts.map +1 -1
- package/dts/TemplatePart.d.ts +4 -4
- package/dts/TemplateParts.d.ts +4 -3
- package/dts/TemplateParts.d.ts.map +1 -1
- package/dts/TemplatePlaceholder.d.ts +56 -44
- package/dts/TemplatePlaceholder.d.ts.map +1 -1
- package/dts/TemplateSeparator.d.ts +9 -51
- package/dts/TemplateSeparator.d.ts.map +1 -1
- package/dts/internal/Int.d.ts +0 -4
- package/dts/internal/Int.d.ts.map +1 -1
- package/dts/internal/Positive.d.ts +0 -4
- package/dts/internal/Positive.d.ts.map +1 -1
- package/esm/BigDecimal.js +2 -2
- package/esm/BigInt.js +7 -5
- package/esm/BigInt.js.map +1 -1
- package/esm/DateTime.js +144 -136
- package/esm/DateTime.js.map +1 -1
- package/esm/DateTimeFormat.js +7 -2
- package/esm/DateTimeFormat.js.map +1 -1
- package/esm/DateTimeFormatContext.js +11 -6
- package/esm/DateTimeFormatContext.js.map +1 -1
- package/esm/Email.js +10 -13
- package/esm/Email.js.map +1 -1
- package/esm/Integer.js +33 -23
- package/esm/Integer.js.map +1 -1
- package/esm/NumberBase10Format.js +65 -65
- package/esm/PositiveInteger.js +44 -29
- package/esm/PositiveInteger.js.map +1 -1
- package/esm/PositiveReal.js +34 -24
- package/esm/PositiveReal.js.map +1 -1
- package/esm/Real.js +29 -18
- package/esm/Real.js.map +1 -1
- package/esm/RoundingMode.js +6 -3
- package/esm/RoundingMode.js.map +1 -1
- package/esm/RoundingOption.js +6 -6
- package/esm/RoundingOption.js.map +1 -1
- package/esm/Schema.js +33 -34
- package/esm/Schema.js.map +1 -1
- package/esm/SemVer.js +18 -18
- package/esm/SemVer.js.map +1 -1
- package/esm/Template.js +36 -31
- package/esm/Template.js.map +1 -1
- package/esm/TemplatePart.js +4 -4
- package/esm/TemplateParts.js +3 -2
- package/esm/TemplateParts.js.map +1 -1
- package/esm/TemplatePlaceholder.js +55 -44
- package/esm/TemplatePlaceholder.js.map +1 -1
- package/esm/TemplateSeparator.js +16 -24
- package/esm/TemplateSeparator.js.map +1 -1
- package/esm/internal/Int.js +5 -7
- package/esm/internal/Int.js.map +1 -1
- package/esm/internal/Positive.js +5 -7
- package/esm/internal/Positive.js.map +1 -1
- package/package.json +2 -2
package/dts/SemVer.d.ts
CHANGED
@@ -1,6 +1,11 @@
|
|
1
|
-
/**
|
1
|
+
/**
|
2
|
+
* A module that implements a `CVSemVer` brand, i.e. a string that represents a valid semantic
|
3
|
+
* version. See the `Effect` documentation about Branding
|
4
|
+
* (https://effect.website/docs/code-style/branded-types/) if you are not familiar with this
|
5
|
+
* concept.
|
6
|
+
*/
|
2
7
|
import { MTypes } from '@parischap/effect-lib';
|
3
|
-
import { Brand, Either, Option } from 'effect';
|
8
|
+
import { Brand, Either, Option, Schema } from 'effect';
|
4
9
|
/**
|
5
10
|
* Module tag
|
6
11
|
*
|
@@ -15,47 +20,54 @@ export declare const moduleTag = "@parischap/conversions/SemVer/";
|
|
15
20
|
export declare const TypeId: unique symbol;
|
16
21
|
type _TypeId = typeof TypeId;
|
17
22
|
/**
|
18
|
-
*
|
23
|
+
* `CVSemVer` Type
|
19
24
|
*
|
20
25
|
* @category Models
|
21
26
|
*/
|
22
27
|
export type Type = Brand.Branded<string, _TypeId>;
|
23
28
|
/**
|
24
|
-
* Constructs a
|
29
|
+
* Constructs a `CVSemVer` without any verifications
|
25
30
|
*
|
26
31
|
* @category Constructors
|
27
32
|
*/
|
28
33
|
export declare const unsafeFromString: Brand.Brand.Constructor<Type>;
|
29
34
|
/**
|
30
|
-
*
|
31
|
-
* SemVer
|
35
|
+
* Brand constructor. Should not be used directly
|
32
36
|
*
|
33
|
-
* @
|
37
|
+
* @ignore
|
34
38
|
*/
|
35
39
|
export declare const constructor: Brand.Brand.Constructor<Type>;
|
36
40
|
/**
|
37
|
-
*
|
41
|
+
* Tries to construct a `CVSemVer` from a string. Returns a `Some` if the conversion can be
|
42
|
+
* performed, a `None` otherwise
|
38
43
|
*
|
39
44
|
* @category Constructors
|
40
45
|
*/
|
41
46
|
export declare const fromStringOption: MTypes.OneArgFunction<string, Option.Option<Type>>;
|
42
47
|
/**
|
43
|
-
*
|
48
|
+
* Tries to construct a `CVSemVer` from a string. Returns a `Right` if the conversion can be
|
49
|
+
* performed, a `Left` otherwise
|
44
50
|
*
|
45
51
|
* @category Constructors
|
46
52
|
*/
|
47
53
|
export declare const fromString: MTypes.OneArgFunction<string, Either.Either<Type, Brand.Brand.BrandErrors>>;
|
48
54
|
/**
|
49
|
-
* Constructs a
|
55
|
+
* Constructs a `CVSemVer` if possible. Throws otherwise.
|
50
56
|
*
|
51
57
|
* @category Constructors
|
52
58
|
*/
|
53
59
|
export declare const fromStringOrThrow: MTypes.OneArgFunction<string, Type>;
|
54
60
|
/**
|
55
|
-
*
|
61
|
+
* A `Schema` that transforms a string into a `CVSemVer`
|
62
|
+
*
|
63
|
+
* @ignore
|
64
|
+
*/
|
65
|
+
export declare const SchemaFromString: Schema.Schema<Type, string>;
|
66
|
+
/**
|
67
|
+
* A `Schema` that represents a `CVSemVer`
|
56
68
|
*
|
57
|
-
* @
|
69
|
+
* @ignore
|
58
70
|
*/
|
59
|
-
export declare const
|
71
|
+
export declare const SchemaFromSelf: Schema.Schema<Type>;
|
60
72
|
export {};
|
61
73
|
//# sourceMappingURL=SemVer.d.ts.map
|
package/dts/SemVer.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"SemVer.d.ts","sourceRoot":"","sources":["../../esm/SemVer.ts"],"names":[],"mappings":"AAAA
|
1
|
+
{"version":3,"file":"SemVer.d.ts","sourceRoot":"","sources":["../../esm/SemVer.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAW,MAAM,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEvD;;;;GAIG;AACH,eAAO,MAAM,SAAS,mCAAmC,CAAC;AAE1D;;;;GAIG;AACH,eAAO,MAAM,MAAM,EAAE,OAAO,MAAyC,CAAC;AACtE,KAAK,OAAO,GAAG,OAAO,MAAM,CAAC;AAE7B;;;;GAIG;AACH,MAAM,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAElD;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,+BAAwB,CAAC;AAEtD;;;;GAIG;AACH,eAAO,MAAM,WAAW,+BAEvB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,cAAc,CACnD,MAAM,EACN,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CACoB,CAAC;AAEzC;;;;;GAKG;AACH,eAAO,MAAM,UAAU,EAAE,MAAM,CAAC,cAAc,CAC7C,MAAM,EACN,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,CACL,CAAC;AAEzC;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,IAAI,CAAe,CAAC;AAElF;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAExD,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAuC,CAAC"}
|
package/dts/Template.d.ts
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
/**
|
2
|
-
*
|
3
|
-
* immutable and mutable parts. Let's take the following two
|
2
|
+
* This module implements a `CVTemplate` which is a model of a text that has always the same
|
3
|
+
* structure. In such a text, there are immutable and mutable parts. Let's take the following two
|
4
|
+
* texts as an example:
|
4
5
|
*
|
5
6
|
* - Text1 = "John is a 47-year old man."
|
6
7
|
* - Text2 = "Jehnny is a 5-year old girl."
|
@@ -10,37 +11,37 @@
|
|
10
11
|
* Placeholder1 is a Placeholder2-year old Placeholder3.
|
11
12
|
*
|
12
13
|
* Placeholder1, Placeholder2 and Placeholder3 are the mutable parts of the template. They contain
|
13
|
-
* valuable information. We call them `
|
14
|
+
* valuable information. We call them `CVTemplatePlaceholder`'s.
|
14
15
|
*
|
15
|
-
* " is a "
|
16
|
-
* `
|
16
|
+
* " is a ", "-year old " and "." are the immutable parts of the template. We call them
|
17
|
+
* `CVTemplateSeperator`'s.
|
17
18
|
*
|
18
19
|
* From a text with the above structure, we can extract the values of Placeholder1, Placeholder2,
|
19
20
|
* and Placeholder3. In the present case:
|
20
21
|
*
|
21
|
-
* - For text1: Placeholder1
|
22
|
-
* - For text2: Placeholder1
|
22
|
+
* - For text1: { Placeholder1 : 'John', Placeholder2 : '47', Placeholder3 : 'man' }
|
23
|
+
* - For text2: { Placeholder1 : 'Jehnny', Placeholder2 : '5', Placeholder3 : 'girl'}
|
23
24
|
*
|
24
|
-
* Extracting the values of placeholders from a text according to a template is called parsing.
|
25
|
+
* Extracting the values of placeholders from a text according to a template is called parsing. The
|
26
|
+
* result of parsing is an object whose properties are named after the name of the placeholders they
|
27
|
+
* represent.
|
25
28
|
*
|
26
|
-
* Inversely, given a template and the values of the placeholders that compose it
|
27
|
-
* text. This is called formatting. In the present case,
|
29
|
+
* Inversely, given a template and the values of the placeholders that compose it (provided as the
|
30
|
+
* properties of an object), we can generate a text. This is called formatting. In the present case,
|
31
|
+
* with the object:
|
28
32
|
*
|
29
|
-
* Placeholder1
|
33
|
+
* { Placeholder1 : 'Tom', Placeholder2 : '15', Placeholder3 : 'boy' }
|
30
34
|
*
|
31
35
|
* We will obtain the text: "Tom is a 15-year old boy."
|
32
36
|
*
|
33
|
-
*
|
34
|
-
*
|
35
|
-
*
|
36
|
-
*
|
37
|
-
*
|
38
|
-
*
|
39
|
-
*
|
40
|
-
*
|
41
|
-
* Schema.NumberFromString)`
|
42
|
-
*
|
43
|
-
* Would not work as the first NumberFromString combinator would read the whole date.
|
37
|
+
* Note that `Effect` does provide the `Schema.TemplateLiteralParser` API which partly addresses the
|
38
|
+
* same problem. But there are some limitations to that API. For instance, template literal types
|
39
|
+
* cannot represent a fixed-length string or a string composed only of capital letters... It is for
|
40
|
+
* instance impossible to represent a date in the form YYYYMMDD with the
|
41
|
+
* `Schema.TemplateLiteralParser`. A schema in the form `const schema =
|
42
|
+
* Schema.TemplateLiteralParser(Schema.NumberFromString,Schema.NumberFromString,
|
43
|
+
* Schema.NumberFromString)` does not work as the first NumberFromString combinator reads the whole
|
44
|
+
* date
|
44
45
|
*/
|
45
46
|
import { MInputError, MInspectable, MTypes } from '@parischap/effect-lib';
|
46
47
|
import { Either, Pipeable } from 'effect';
|
@@ -54,7 +55,7 @@ import * as CVTemplatePlaceholder from './TemplatePlaceholder.js';
|
|
54
55
|
*/
|
55
56
|
export declare const moduleTag = "@parischap/conversions/Template/";
|
56
57
|
/**
|
57
|
-
* Type
|
58
|
+
* `CVTemplate` Type
|
58
59
|
*
|
59
60
|
* @category Models
|
60
61
|
*/
|
@@ -81,13 +82,14 @@ export declare const make: <const PS extends CVTemplateParts.Type>(...templatePa
|
|
81
82
|
*/
|
82
83
|
export declare const templateParts: <const PS extends CVTemplateParts.Type>(self: Type<PS>) => PS;
|
83
84
|
/**
|
84
|
-
* Returns a function that
|
85
|
+
* Returns a function that tries to parse a text into an object according to 'self'. The generated
|
86
|
+
* parser returns a `Right` of an object upon success, a `Left` otherwise.
|
85
87
|
*
|
86
88
|
* @category Parsing
|
87
89
|
*/
|
88
90
|
export declare const toParser: <const PS extends CVTemplateParts.Type>(self: Type<PS>) => MTypes.OneArgFunction<string, Either.Either<{ readonly [k in keyof MTypes.ArrayKeys<PS> as PS[k] extends CVTemplatePlaceholder.All ? CVTemplatePlaceholder.ExtractName<PS[k]> : never]: PS[k] extends CVTemplatePlaceholder.All ? CVTemplatePlaceholder.ExtractType<PS[k]> : never; }, MInputError.Type>>;
|
89
91
|
/**
|
90
|
-
* Same as toParser but the
|
92
|
+
* Same as `toParser` but the generated parser throws in case of failure
|
91
93
|
*
|
92
94
|
* @category Parsing
|
93
95
|
*/
|
@@ -95,15 +97,14 @@ export declare const toThrowingParser: <const PS extends CVTemplateParts.Type>(s
|
|
95
97
|
readonly [k in keyof MTypes.ArrayKeys<PS> as PS[k] extends CVTemplatePlaceholder.All ? CVTemplatePlaceholder.ExtractName<PS[k]> : never]: PS[k] extends CVTemplatePlaceholder.All ? CVTemplatePlaceholder.ExtractType<PS[k]> : never;
|
96
98
|
}>;
|
97
99
|
/**
|
98
|
-
* Returns a function that
|
99
|
-
*
|
100
|
-
* function, i.e. no checks are carried out when encoding
|
100
|
+
* Returns a function that tries to format an object into a string according to 'self'. The
|
101
|
+
* generated formatter returns a `Right` of a string upon success, a `Left` otherwise.
|
101
102
|
*
|
102
103
|
* @category Formatting
|
103
104
|
*/
|
104
105
|
export declare const toFormatter: <const PS extends CVTemplateParts.Type>(self: Type<PS>) => MTypes.OneArgFunction<{ readonly [k in keyof MTypes.ArrayKeys<PS> as PS[k] extends CVTemplatePlaceholder.All ? CVTemplatePlaceholder.ExtractName<PS[k]> : never]: PS[k] extends CVTemplatePlaceholder.All ? CVTemplatePlaceholder.ExtractType<PS[k]> : never; }, Either.Either<string, MInputError.Type>>;
|
105
106
|
/**
|
106
|
-
* Same as toFormatter but the
|
107
|
+
* Same as `toFormatter` but the generated formatter throws in case of failure
|
107
108
|
*
|
108
109
|
* @category Formatting
|
109
110
|
*/
|
package/dts/Template.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Template.d.ts","sourceRoot":"","sources":["../../esm/Template.ts"],"names":[],"mappings":"AAAA
|
1
|
+
{"version":3,"file":"Template.d.ts","sourceRoot":"","sources":["../../esm/Template.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AAEH,OAAO,EACN,WAAW,EACX,YAAY,EAIZ,MAAM,EACN,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAEN,MAAM,EAMN,QAAQ,EAKR,MAAM,QAAQ,CAAC;AAChB,OAAO,KAAK,cAAc,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,eAAe,MAAM,oBAAoB,CAAC;AACtD,OAAO,KAAK,qBAAqB,MAAM,0BAA0B,CAAC;AAGlE;;;;GAIG;AACH,eAAO,MAAM,SAAS,qCAAqC,CAAC;AAI5D;;;;GAIG;AAEH,MAAM,WAAW,IAAI,CAAC,GAAG,CAAC,EAAE,SAAS,eAAe,CAAC,IAAI,CACxD,SAAQ,YAAY,CAAC,IAAI,EACxB,QAAQ,CAAC,QAAQ;IAClB,0DAA0D;IAC1D,QAAQ,CAAC,aAAa,EAAE,EAAE,CAAC;CAM3B;AAED;;;;GAIG;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AAE,CAAC,CAAC,CAAC,CAAC,GACvC,KAAK,GAAG,EAAE,CAAC,CAAC,CAAC,SAAS,qBAAqB,CAAC,GAAG,GAAG,qBAAqB,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,GAC1F,KAAK;CACP,EACD,MAAM,CACmF,CAAC"}
|
package/dts/TemplatePart.d.ts
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
/**
|
2
|
-
* This module implements
|
3
|
-
*
|
2
|
+
* This module implements `CVTemplatePart`'s which are the constituents of `CVTemplate`'s (see
|
3
|
+
* Template.ts).
|
4
4
|
*
|
5
|
-
* There are two kinds of
|
6
|
-
*
|
5
|
+
* There are two kinds of `CVTemplatePart`'s: `CVTemplateSeparator`'s (see TemplateSeparator.ts) and
|
6
|
+
* `CVTemplatePlaceholder`'s (see TemplatePlaceholder.ts)
|
7
7
|
*/
|
8
8
|
import * as CVTemplatePlaceholder from './TemplatePlaceholder.js';
|
9
9
|
import * as CVTemplateSeparator from './TemplateSeparator.js';
|
package/dts/TemplateParts.d.ts
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
/** This module implements an array of
|
1
|
+
/** This module implements an array of `CVTemplatePart`'s (see TemplatePart.ts) */
|
2
2
|
import { MTypes } from '@parischap/effect-lib';
|
3
3
|
import * as CVTemplatePart from './TemplatePart.js';
|
4
4
|
/**
|
5
|
-
* Type
|
5
|
+
* `CVTemplateParts` Type
|
6
6
|
*
|
7
7
|
* @category Models
|
8
8
|
*/
|
@@ -15,7 +15,8 @@ export interface Type<T = any> extends ReadonlyArray<CVTemplatePart.Type<string,
|
|
15
15
|
*/
|
16
16
|
export declare const getSyntheticDescription: MTypes.OneArgFunction<Type, string>;
|
17
17
|
/**
|
18
|
-
* Shows a description of the
|
18
|
+
* Shows a description of the `CVTemplatePlaceholder`'s of `self` (see description of
|
19
|
+
* `CVTemplatePlaceholder.getLabelledDescription`)
|
19
20
|
*
|
20
21
|
* @category Destructors
|
21
22
|
*/
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"TemplateParts.d.ts","sourceRoot":"","sources":["../../esm/TemplateParts.ts"],"names":[],"mappings":"AAAA,
|
1
|
+
{"version":3,"file":"TemplateParts.d.ts","sourceRoot":"","sources":["../../esm/TemplateParts.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAClF,OAAO,EAAU,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAEvD,OAAO,KAAK,cAAc,MAAM,mBAAmB,CAAC;AAIpD;;;;GAIG;AAEH,MAAM,WAAW,IAAI,CAAC,CAAC,GAAG,GAAG,CAAE,SAAQ,aAAa,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;CAAG;AAEvF;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,EAAE,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,MAAM,CAUvE,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB,EAAE,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,MAAM,CAazE,CAAC"}
|
@@ -1,16 +1,15 @@
|
|
1
1
|
/**
|
2
|
-
* This module implements a
|
3
|
-
* (see TemplatePart.ts)
|
2
|
+
* This module implements a `CVTemplatePlaceholder` type which is one of the constituents of
|
3
|
+
* `CVTemplate`'s (see Template.ts and TemplatePart.ts)
|
4
4
|
*
|
5
|
-
*
|
6
|
-
* parser and a formatter:
|
5
|
+
* Each `CVTemplatePlaceholder` defines a parser and a formatter:
|
7
6
|
*
|
8
|
-
* - The parser takes a
|
9
|
-
*
|
10
|
-
* consumed. In case of
|
7
|
+
* - The parser takes a text, consumes a part of that text, optionnally converts the consumed part to
|
8
|
+
* a value of type T and, if successful, returns a `Right` of that value and of what has not been
|
9
|
+
* consumed. In case of failure, it returns a `Left`.
|
11
10
|
* - The formatter takes a value of type T, converts it to a string (if T is not string), checks that
|
12
|
-
* the result is coherent and, if so, returns a
|
13
|
-
*
|
11
|
+
* the result is coherent and, if so, returns a `Right` of that string. Otherwise, it returns a
|
12
|
+
* `Left`
|
14
13
|
*/
|
15
14
|
import { MInputError, MInspectable, MString, MTypes } from '@parischap/effect-lib';
|
16
15
|
import { Either, Pipeable, Schema } from 'effect';
|
@@ -51,7 +50,7 @@ export declare namespace Formatter {
|
|
51
50
|
}
|
52
51
|
}
|
53
52
|
/**
|
54
|
-
* Type
|
53
|
+
* `CVTemplatePlaceholder` Type
|
55
54
|
*
|
56
55
|
* @category Models
|
57
56
|
*/
|
@@ -66,23 +65,24 @@ export interface Type<out N extends string, in out T> extends MInspectable.Type,
|
|
66
65
|
readonly parser: Parser.Type<T>;
|
67
66
|
/** Formatter of this TemplatePlaceholder */
|
68
67
|
readonly formatter: Formatter.Type<T>;
|
69
|
-
|
68
|
+
/** Schema instance that represents type T */
|
69
|
+
readonly tSchemaInstance: Schema.Schema<T, T>;
|
70
70
|
}
|
71
71
|
/**
|
72
|
-
* Type that represents a
|
72
|
+
* Type that represents a `CVTemplatePlaceholder` from and to any type
|
73
73
|
*
|
74
74
|
* @category Models
|
75
75
|
*/
|
76
76
|
export interface All extends Type<string, any> {
|
77
77
|
}
|
78
78
|
/**
|
79
|
-
* Utility type that extracts the Name type of a
|
79
|
+
* Utility type that extracts the Name type of a `CVTemplatePlaceholder`
|
80
80
|
*
|
81
81
|
* @category Utility types
|
82
82
|
*/
|
83
83
|
export type ExtractName<P extends All> = P extends Type<infer N, infer _> ? N : never;
|
84
84
|
/**
|
85
|
-
* Utility type that extracts the
|
85
|
+
* Utility type that extracts the output type of a `CVTemplatePlaceholder`
|
86
86
|
*
|
87
87
|
* @category Utility types
|
88
88
|
*/
|
@@ -130,20 +130,21 @@ export declare const parser: <const N extends string, T>(self: Type<N, T>) => Pa
|
|
130
130
|
*/
|
131
131
|
export declare const formatter: <const N extends string, T>(self: Type<N, T>) => Formatter.Type<T>;
|
132
132
|
/**
|
133
|
-
* Returns the `
|
133
|
+
* Returns the `tSchemaInstance` property of `self`
|
134
134
|
*
|
135
135
|
* @category Destructors
|
136
136
|
*/
|
137
|
-
export declare const
|
137
|
+
export declare const tSchemaInstance: <const N extends string, T>(self: Type<N, T>) => Schema.Schema<T, T>;
|
138
138
|
/**
|
139
|
-
* Returns
|
139
|
+
* Returns a description of `self`, e.g. "#dd: 2-character string left-padded with '0' to unsigned
|
140
|
+
* integer."
|
140
141
|
*
|
141
142
|
* @category Destructors
|
142
143
|
*/
|
143
144
|
export declare const getLabelledDescription: <N extends string, T>(self: Type<N, T>) => string;
|
144
145
|
/**
|
145
|
-
* Returns a
|
146
|
-
*
|
146
|
+
* Returns a copy of `self` where a postParser function is executed after the parser of `self` and a
|
147
|
+
* preFormatter function is executed before the formatter of `self`
|
147
148
|
*
|
148
149
|
* @category Destructors
|
149
150
|
*/
|
@@ -161,7 +162,7 @@ export declare const modify: {
|
|
161
162
|
}): <const N extends string>(self: Type<N, T>) => Type<N, T1>;
|
162
163
|
};
|
163
164
|
/**
|
164
|
-
* Builds a
|
165
|
+
* Builds a `CVTemplatePlaceholder` instance that parses/formats exactly `length` characters from a
|
165
166
|
* string. `length` must be a strictly positive integer.
|
166
167
|
*
|
167
168
|
* @category Constructors
|
@@ -171,10 +172,10 @@ export declare const fixedLength: <const N extends string>({ name, length }: {
|
|
171
172
|
readonly length: number;
|
172
173
|
}) => Type<N, string>;
|
173
174
|
/**
|
174
|
-
*
|
175
|
-
*
|
175
|
+
* Same as `fixedLength` but the consumed text is trimmed off of a `fillChar` at `fillPosition` and
|
176
|
+
* the written text is padded with a `fillChar` at `fillPosition`. `fillChar` should be a
|
176
177
|
* one-character string. `length` must be a strictly positive integer. See the meaning of
|
177
|
-
* `disallowEmptyString` in
|
178
|
+
* `disallowEmptyString` in `MString.trim`
|
178
179
|
*
|
179
180
|
* @category Constructors
|
180
181
|
*/
|
@@ -182,15 +183,16 @@ export declare const paddedFixedLength: <const N extends string>(params: {
|
|
182
183
|
readonly name: N;
|
183
184
|
readonly length: number;
|
184
185
|
readonly fillChar: string;
|
185
|
-
readonly
|
186
|
+
readonly fillPosition: MString.FillPosition;
|
186
187
|
readonly disallowEmptyString: boolean;
|
187
188
|
}) => Type<N, string>;
|
188
189
|
/**
|
189
|
-
*
|
190
|
-
* `
|
191
|
-
*
|
192
|
-
* fillChar
|
193
|
-
*
|
190
|
+
* Same as `fixedLength` but the parser tries to convert the consumed text into a `CVReal` using the
|
191
|
+
* passed `CVNumberBase10Format`. The formatter takes a `CVReal` and tries to convert and write it
|
192
|
+
* as an n-character string. If the number to parse/format is less than `length` characters,
|
193
|
+
* `fillChar` is trimmed/padded between the sign and the number so that the length condition is
|
194
|
+
* respected. `fillChar` must be a one-character string (but no error is triggered if you do not
|
195
|
+
* respect that condition)
|
194
196
|
*
|
195
197
|
* @category Constructors
|
196
198
|
*/
|
@@ -201,7 +203,9 @@ export declare const fixedLengthToReal: <const N extends string>(params: {
|
|
201
203
|
readonly numberBase10Format: CVNumberBase10Format.Type;
|
202
204
|
}) => Type<N, CVReal.Type>;
|
203
205
|
/**
|
204
|
-
* Builds a
|
206
|
+
* Builds a `CVTemplatePlaceholder` whose parser reads from the text all the characters that it can
|
207
|
+
* interpret as a number in the provided `numberBase10Format` and converts the consumed text into a
|
208
|
+
* `CVReal`. The formatter takes a `CVReal` and converts it into a string according to the provided
|
205
209
|
* `numberBase10Format`.
|
206
210
|
*
|
207
211
|
* @category Constructors
|
@@ -211,7 +215,7 @@ export declare const real: <const N extends string>({ name, numberBase10Format }
|
|
211
215
|
readonly numberBase10Format: CVNumberBase10Format.Type;
|
212
216
|
}) => Type<N, CVReal.Type>;
|
213
217
|
/**
|
214
|
-
* Builds a
|
218
|
+
* Builds a `CVTemplatePlaceholder` instance that works as a map:
|
215
219
|
*
|
216
220
|
* The parser expects one of the keys of `keyValuePairs` and will return the associated value. The
|
217
221
|
* formatter expects one of the values of `keyValuePairs` and will return the associated key.
|
@@ -220,11 +224,11 @@ export declare const real: <const N extends string>({ name, numberBase10Format }
|
|
220
224
|
* is best if the type of the values defines a toString method. Value equality is checked with The
|
221
225
|
* Effect Equal.equals function.
|
222
226
|
*
|
223
|
-
* `schemaInstance` is a Schema instance that transforms a value of type T into a value of type T.
|
224
|
-
* It is an optional parameter. You need only provide it if you intend to use a CVTemplate built
|
225
|
-
* from
|
226
|
-
* Schema.declare function
|
227
|
-
*
|
227
|
+
* `schemaInstance` is a `Schema` instance that transforms a value of type T into a value of type T.
|
228
|
+
* It is an optional parameter. You need only provide it if you intend to use a `CVTemplate` built
|
229
|
+
* from this `CVTemplatePlaceholder` within the `Effect.Schema` module. In that case, you can build
|
230
|
+
* such a `Schema` with the `Schema.declare` function (if you don't provide it, the `Schema` will
|
231
|
+
* return an error)
|
228
232
|
*
|
229
233
|
* @category Constructors
|
230
234
|
*/
|
@@ -234,8 +238,8 @@ export declare const mappedLiterals: <const N extends string, T>({ name, keyValu
|
|
234
238
|
readonly schemaInstance?: Schema.Schema<T, T>;
|
235
239
|
}) => Type<N, T>;
|
236
240
|
/**
|
237
|
-
* Same as `mappedLiterals` but `T` is assumed to be `CVReal
|
238
|
-
*
|
241
|
+
* Same as `mappedLiterals` but `T` is assumed to be `CVReal` which should be the most usual use
|
242
|
+
* case
|
239
243
|
*
|
240
244
|
* @category Constructors
|
241
245
|
*/
|
@@ -244,8 +248,10 @@ export declare const realMappedLiterals: <const N extends string>(params: {
|
|
244
248
|
readonly keyValuePairs: ReadonlyArray<readonly [string, CVReal.Type]>;
|
245
249
|
}) => Type<N, CVReal.Type>;
|
246
250
|
/**
|
247
|
-
* Builds a
|
248
|
-
*
|
251
|
+
* Builds a `CVTemplatePlaceholder` whose parser reads as much of the text as it can that fulfills
|
252
|
+
* the passed regular expression. The formatter only accepts a string that matches the passed
|
253
|
+
* regular expression and writes it into the text. `regExp` must start with the ^ character.
|
254
|
+
* Otherwise, the parser and formatter will not work properly.
|
249
255
|
*
|
250
256
|
* @category Constructors
|
251
257
|
*/
|
@@ -255,9 +261,12 @@ export declare const fulfilling: <const N extends string>({ name, regExp, regExp
|
|
255
261
|
readonly regExpDescriptor: string;
|
256
262
|
}) => Type<N, string>;
|
257
263
|
/**
|
258
|
-
*
|
259
|
-
*
|
260
|
-
*
|
264
|
+
* This `CVTemplatePlaceholder` instance is a special case of the `fulfilling`
|
265
|
+
* `CVTemplatePlaceholder` instance. The parser of this Placeholder reads from the text until it
|
266
|
+
* meets one of the `forbiddenChars` passed as parameter (the result must be a non-empty string).
|
267
|
+
* The formatter only accepts a non-empty string that does not contain any of the forbidden chars
|
268
|
+
* and write it to the text. `forbiddenChars` should be an array of 1-character strings (will not
|
269
|
+
* throw otherwise but strange behaviors can be expected)
|
261
270
|
*
|
262
271
|
* @category Constructors
|
263
272
|
*/
|
@@ -266,7 +275,10 @@ export declare const anythingBut: <const N extends string>({ name, forbiddenChar
|
|
266
275
|
readonly forbiddenChars: MTypes.OverOne<string>;
|
267
276
|
}) => Type<N, string>;
|
268
277
|
/**
|
269
|
-
*
|
278
|
+
* This `CVTemplatePlaceholder` instance is another special case of the `fulfilling`
|
279
|
+
* `CVTemplatePlaceholder` instance. The parser of this `CVTemplatePlaceholder` reads all the
|
280
|
+
* remaining text. The formatter accepts any string and writes it. This `CVTemplatePlaceholder`
|
281
|
+
* should only be used as the last `CVTemplatePart` of a `CVTemplate`.
|
270
282
|
*
|
271
283
|
* @category Constructors
|
272
284
|
*/
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"TemplatePlaceholder.d.ts","sourceRoot":"","sources":["../../esm/TemplatePlaceholder.ts"],"names":[],"mappings":"AAAA
|
1
|
+
{"version":3,"file":"TemplatePlaceholder.d.ts","sourceRoot":"","sources":["../../esm/TemplatePlaceholder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EACN,WAAW,EACX,YAAY,EAIZ,OAAO,EAGP,MAAM,EACN,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAEN,MAAM,EAKN,QAAQ,EAER,MAAM,EAKN,MAAM,QAAQ,CAAC;AAEhB,OAA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. Upon parsing, we must check that
|
6
|
-
* it is present as is in the text. Upon formatting, it must be inserted as is into the text. A
|
7
|
-
* Separator contains no valuable information
|
2
|
+
* This module implements a `CVTemplateSeparator` type which is one of the constituents of
|
3
|
+
* `CVTemplate`'s (see Template.ts and TemplatePart.ts)
|
8
4
|
*/
|
9
5
|
import { MInputError, MInspectable, MTypes } from '@parischap/effect-lib';
|
10
|
-
import { Either,
|
6
|
+
import { Either, Pipeable } from 'effect';
|
11
7
|
/**
|
12
8
|
* Module tag
|
13
9
|
*
|
@@ -15,45 +11,13 @@ import { Either, Function, Pipeable } from 'effect';
|
|
15
11
|
*/
|
16
12
|
export declare const moduleTag = "@parischap/conversions/TemplateSeparator/";
|
17
13
|
/**
|
18
|
-
*
|
19
|
-
*
|
20
|
-
* @category Models
|
21
|
-
*/
|
22
|
-
export declare namespace Parser {
|
23
|
-
/**
|
24
|
-
* Type that describes a Parser
|
25
|
-
*
|
26
|
-
* @category Models
|
27
|
-
*/
|
28
|
-
interface Type extends MTypes.OneArgFunction<number, MTypes.OneArgFunction<string, Either.Either<string, MInputError.Type>>> {
|
29
|
-
}
|
30
|
-
}
|
31
|
-
/**
|
32
|
-
* Namespace of a Formatter
|
33
|
-
*
|
34
|
-
* @category Models
|
35
|
-
*/
|
36
|
-
export declare namespace Formatter {
|
37
|
-
/**
|
38
|
-
* Type that describes a Formatter
|
39
|
-
*
|
40
|
-
* @category Models
|
41
|
-
*/
|
42
|
-
interface Type extends Function.LazyArg<string> {
|
43
|
-
}
|
44
|
-
}
|
45
|
-
/**
|
46
|
-
* Type that represents a TemplateSeparator
|
14
|
+
* `CVTemplateSeparator` Type
|
47
15
|
*
|
48
16
|
* @category Models
|
49
17
|
*/
|
50
18
|
export interface Type extends MInspectable.Type, Pipeable.Pipeable {
|
51
19
|
/** The string representing this separator */
|
52
20
|
readonly value: string;
|
53
|
-
/** Parser of this TemplateSeparator */
|
54
|
-
readonly parser: Parser.Type;
|
55
|
-
/** Formatter of this TemplateSeparator */
|
56
|
-
readonly formatter: Formatter.Type;
|
57
21
|
}
|
58
22
|
/**
|
59
23
|
* Type guard
|
@@ -62,29 +26,23 @@ export interface Type extends MInspectable.Type, Pipeable.Pipeable {
|
|
62
26
|
*/
|
63
27
|
export declare const has: (u: unknown) => u is Type;
|
64
28
|
/**
|
65
|
-
*
|
29
|
+
* Constructor
|
66
30
|
*
|
67
31
|
* @category Constructors
|
68
32
|
*/
|
69
33
|
export declare const make: (value: string) => Type;
|
70
34
|
/**
|
71
|
-
*
|
35
|
+
* Builds a parser that implements this `CVTemplateSeparator`
|
72
36
|
*
|
73
37
|
* @category Destructors
|
74
38
|
*/
|
75
|
-
export declare const
|
39
|
+
export declare const toParser: (self: Type) => (pos: number, text: string) => Either.Either<string, MInputError.Type>;
|
76
40
|
/**
|
77
|
-
* Returns the `
|
78
|
-
*
|
79
|
-
* @category Destructors
|
80
|
-
*/
|
81
|
-
export declare const parser: MTypes.OneArgFunction<Type, Parser.Type>;
|
82
|
-
/**
|
83
|
-
* Returns the `formatter` property of `self`
|
41
|
+
* Returns the `value` property of `self`
|
84
42
|
*
|
85
43
|
* @category Destructors
|
86
44
|
*/
|
87
|
-
export declare const
|
45
|
+
export declare const value: MTypes.OneArgFunction<Type, string>;
|
88
46
|
/**
|
89
47
|
* Slash Separator instance
|
90
48
|
*
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"TemplateSeparator.d.ts","sourceRoot":"","sources":["../../esm/TemplateSeparator.ts"],"names":[],"mappings":"AAAA
|
1
|
+
{"version":3,"file":"TemplateSeparator.d.ts","sourceRoot":"","sources":["../../esm/TemplateSeparator.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,YAAY,EAAsB,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE9F,OAAO,EAAE,MAAM,EAAQ,QAAQ,EAAqB,MAAM,QAAQ,CAAC;AAEnE;;;;GAIG;AACH,eAAO,MAAM,SAAS,8CAA8C,CA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