@magda/arbitraries 1.1.0-alpha.2 → 1.1.0-rc.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.
@@ -0,0 +1,157 @@
1
+ /// <reference types="node" />
2
+ import jsc from 'jsverify';
3
+
4
+ export declare function arbFlatMap<T, U>(arb: jsc.Arbitrary<T>, arbForward: (t: T) => jsc.Arbitrary<U>, backwards: (u: U) => T, show?: (u: U) => string | undefined): MonadicArb<U>;
5
+
6
+ /** Generates an array that is guaranteed to be of the supplied size */
7
+ export declare function arrayOfSizeArb<T>(size: number, arb: jsc.Arbitrary<T>): jsc.Arbitrary<T[]>;
8
+
9
+ /**
10
+ *
11
+ */
12
+ export declare const datasetFormatArb: ({ format }: DatasetFormatOverrideArbs) => jsc.Arbitrary<{
13
+ format: string;
14
+ }>;
15
+
16
+ /**
17
+ * Can be passed into datasetFormatArb to override the default arbitaries.
18
+ */
19
+ export declare type DatasetFormatOverrideArbs = {
20
+ format?: jsc.Arbitrary<string>;
21
+ };
22
+
23
+ export declare const dateStringArb: jsc.Arbitrary<string>;
24
+
25
+ /**
26
+ * Generates the content of a distribution's dcat-distribution-strings aspect.
27
+ */
28
+ export declare const distStringsArb: ({ url, license, format }: DistStringsOverrideArbs) => jsc.Arbitrary<{
29
+ downloadURL: string;
30
+ accessURL: string;
31
+ license: string;
32
+ format: string;
33
+ }>;
34
+
35
+ /**
36
+ * Can be passed into distStringsArb to override the default arbitraries.
37
+ */
38
+ export declare type DistStringsOverrideArbs = {
39
+ url?: jsc.Arbitrary<string>;
40
+ license?: jsc.Arbitrary<string>;
41
+ format?: jsc.Arbitrary<string>;
42
+ };
43
+
44
+ /** Generates a URL for a distribution - this could be ftp, http or https */
45
+ export declare const distUrlArb: ({ schemeArb, hostArb }?: UrlArbOptions) => jsc.Arbitrary<string>;
46
+
47
+ /**
48
+ * Fuzzes a string, changing the case and putting random strings around it
49
+ * and in spaces.
50
+ */
51
+ export declare function fuzzStringArb(string: string, fuzzArb?: jsc.Arbitrary<string>): jsc.Arbitrary<string>;
52
+
53
+ /**
54
+ * Gets the result of the passed string arbitrary and fuzzes it, changing
55
+ * the case and putting random strings around it and in spaces.
56
+ */
57
+ export declare function fuzzStringArbResult(stringArb: jsc.Arbitrary<string>, fuzzArb?: jsc.Arbitrary<string>): MonadicArb<string>;
58
+
59
+ export declare const lcAlphaNumCharArb: jsc.Arbitrary<string>;
60
+
61
+ export declare const lcAlphaNumStringArb: jsc.Arbitrary<string>;
62
+
63
+ export declare const lcAlphaNumStringArbNe: jsc.Arbitrary<string>;
64
+
65
+ export declare const lcAlphaStringArb: jsc.Arbitrary<string>;
66
+
67
+ export declare const lcAlphaStringArbNe: jsc.Arbitrary<string>;
68
+
69
+ export declare const lowerCaseAlphaCharArb: jsc.Arbitrary<string>;
70
+
71
+ export declare type MonadicArb<T> = jsc.Arbitrary<T> & {
72
+ flatMap<U>(arbForward: (t: T) => jsc.Arbitrary<U>, backwards: (u: U) => T): MonadicArb<U>;
73
+ };
74
+
75
+ export declare const numArb: jsc.Arbitrary<string>;
76
+
77
+ export declare const peopleNameArb: jsc.Arbitrary<string>;
78
+
79
+ /**
80
+ * A record in the registry, usually including data for one or more aspects, unique for a tenant.
81
+ */
82
+ declare class Record_2 {
83
+ /**
84
+ * The identifier of the record
85
+ */
86
+ 'id': string;
87
+ /**
88
+ * The name of the record
89
+ */
90
+ 'name': string;
91
+ /**
92
+ * The aspects included in this record
93
+ */
94
+ 'aspects': any;
95
+ /**
96
+ * The read authorization policy id of a record
97
+ */
98
+ 'authnReadPolicyId': string;
99
+ /**
100
+ * A tag representing the action by the source of this record (e.g. an id for a individual crawl of a data portal).
101
+ */
102
+ 'sourceTag': string;
103
+ /**
104
+ * The identifier of a tenant
105
+ */
106
+ 'tenantId': number;
107
+ }
108
+ export { Record_2 as Record }
109
+
110
+ export declare const recordArb: jsc.Arbitrary<Record_2>;
111
+
112
+ /**
113
+ * Generates records, allowing specific arbs to be defined for the distribution.
114
+ */
115
+ export declare const recordArbWithDistArbs: (distStringsOverrides?: DistStringsOverrideArbs, sourceLinkOverrides?: SourceLinkOverrideArbs, datasetFormatOverrides?: DatasetFormatOverrideArbs) => jsc.Arbitrary<Record_2>;
116
+
117
+ /**
118
+ * Randomly generates a record with the passed objects under its
119
+ * distributions' dcat-distribution-strings aspect.
120
+ */
121
+ export declare const recordArbWithDists: (dists: object[]) => jsc.Arbitrary<Record_2>;
122
+
123
+ /**
124
+ * Randomly returns a subset of the array, in-order.
125
+ */
126
+ export declare function someOf<T>(array: T[]): jsc.Arbitrary<T[]>;
127
+
128
+ /**
129
+ * Generates the content of source link status aspect
130
+ */
131
+ export declare const sourceLinkArb: ({ status }: SourceLinkOverrideArbs) => jsc.Arbitrary<{
132
+ status: string;
133
+ }>;
134
+
135
+ /**
136
+ * Can be passed into sourceLinkArb to override the default arbitraries.
137
+ */
138
+ export declare type SourceLinkOverrideArbs = {
139
+ status?: jsc.Arbitrary<string | undefined>;
140
+ };
141
+
142
+ export declare const specificRecordArb: (aspectArbs: {
143
+ [key: string]: jsc.Arbitrary<any>;
144
+ }) => jsc.Arbitrary<Record_2>;
145
+
146
+ /**
147
+ * Generates a random string with characters greater than code 32 (so no random
148
+ * TTY crap that can't be matched by any regex
149
+ */
150
+ export declare const stringArb: jsc.Arbitrary<string>;
151
+
152
+ declare type UrlArbOptions = {
153
+ schemeArb?: jsc.Arbitrary<string>;
154
+ hostArb?: jsc.Arbitrary<string>;
155
+ };
156
+
157
+ export { }