Mirror of https://github.com/roostorg/coop
github.com/roostorg/coop
1declare module 'homoglyph-search';
2declare module 'nilsimsa';
3
4declare module 'uuid-apikey';
5
6declare interface String {
7 toUpperCase<T extends string>(this: T): Uppercase<T>;
8 toLowerCase<T extends string>(this: T): Lowercase<T>;
9}
10
11// Workaround for https://github.com/apollographql/apollo-server/issues/6868
12// At some point, we should just upgrade to Apollo Server 4, but that's a big lift.
13//
14// We also have to fork + override retry-axios, which we don't depend on
15// directly, but it's a dependency of the google maps sdk. However, the version
16// of retry-axios used by the SDK isn't compatible with moduleResolution=nodeNext,
17// so we were getting a type error. Forking the SDK to update retry-axios isn't
18// feasible, because the new version of retry-axios uses a newer axios version,
19// which contains some breaking changes (to param serialization; see
20// https://github.com/axios/axios/pull/4734), which would be hard to update the
21// SDK to account for.
22declare module '@graphql-tools/schema' {
23 import { GraphQLSchema } from 'graphql';
24
25 import { IExecutableSchemaDefinition } from './types.js';
26
27 export declare function makeExecutableSchema<TContext = any>({
28 typeDefs,
29 resolvers,
30 resolverValidationOptions,
31 parseOptions,
32 inheritResolversFromInterfaces,
33 pruningOptions,
34 updateResolversInPlace,
35 schemaExtensions,
36 }: IExecutableSchemaDefinition<TContext>): GraphQLSchema;
37}
38
39declare module 'stream-to-blob' {
40 export default function streamToBlob(
41 stream: NodeJS.ReadableStream,
42 mimeType?: string | null,
43 ): Promise<Blob>;
44}
45
46declare module 'latlon-geohash' {
47 export interface Point {
48 lat: number;
49 lon: number;
50 }
51
52 /**
53 * Encodes latitude/longitude to geohash, either to specified precision or to automatically
54 * evaluated precision.
55 *
56 * @param lat - Latitude in degrees.
57 * @param lng - Longitude in degrees.
58 * @param [precision] - Number of characters in resulting geohash.
59 * @returns Geohash of supplied latitude/longitude.
60 * @throws Invalid geohash.
61 *
62 * @example
63 * var geohash = Geohash.encode(52.205, 0.119, 7); // geohash: 'u120fxw'
64 */
65 export function encode(lat: number, lng: number, precision?: number): string;
66
67 /**
68 * Decode geohash to latitude/longitude (location is approximate centre of geohash cell,
69 * to reasonable precision).
70 *
71 * @param geohash - Geohash string to be converted to latitude/longitude.
72 * @returns (Center of) geohashed location.
73 * @throws Invalid geohash.
74 *
75 * @example
76 * var latlon = Geohash.decode('u120fxw'); // latlon: { lat: 52.205, lon: 0.1188 }
77 */
78 export function decode(geohash: string): Point;
79}
80
81declare module '@stdlib/stats-binomial-test' {
82 /**
83 * A [successes, failures] tuple.
84 */
85 type Tuple = [number, number];
86
87 /**
88 * Interface defining function options.
89 */
90 interface Options {
91 /**
92 * Significance level (default: 0.05).
93 */
94 alpha?: number;
95
96 /**
97 * Alternative hypothesis (`two-sided`, `less`, or `greater`; default: 'two-sided').
98 */
99 alternative?: 'two-sided' | 'less' | 'greater';
100
101 /**
102 * Success probability under H0 (default: 0.5)
103 */
104 p?: number;
105 }
106
107 /**
108 * Test result.
109 */
110 interface Results {
111 /**
112 * Used significance level.
113 */
114 alpha: number;
115
116 /**
117 * Test decision.
118 */
119 rejected: boolean;
120
121 /**
122 * p-value of the test.
123 */
124 pValue: number;
125
126 /**
127 * Sample proportion.
128 */
129 statistic: number;
130
131 /**
132 * 1-alpha confidence interval for the success probability.
133 */
134 ci: Array<number>;
135
136 /**
137 * Assumed success probability under H0.
138 */
139 nullValue: number;
140
141 /**
142 * Alternative hypothesis (`two-sided`, `less`, or `greater`).
143 */
144 alternative: string;
145
146 /**
147 * Name of test.
148 */
149 method: string;
150
151 /**
152 * Function to print formatted output.
153 */
154 print: Function;
155 }
156
157 /**
158 * Interface of test for the success probability in a Bernoulli experiment.
159 */
160 interface BinomialTest {
161 /**
162 * Computes an exact test for the success probability in a Bernoulli experiment.
163 *
164 * @param x - number of successes
165 * @param n - total number of observations
166 * @param options - function options
167 * @param options.alpha - significance level (default: 0.05)
168 * @param options.alternative - alternative hypothesis (`two-sided`, `less`, or `greater`; default: 'two-sided')
169 * @param options.p - success probability under H0 (default: 0.5)
170 * @throws must provide valid options
171 * @returns test results
172 *
173 * @example
174 * var out = binomialTest( 682, 925 );
175 * // returns {...}
176 *
177 * out = binomialTest( 682, 925, {
178 * 'p': 0.75,
179 * 'alpha': 0.05
180 * });
181 * // returns {...}
182 */
183 (x: number, n: number, options?: Options): Results;
184
185 /**
186 * Computes an exact test for the success probability in a Bernoulli experiment.
187 *
188 * @param x - two-element array with number of successes and number of failures
189 * @param options - function options
190 * @param options.alpha - significance level (default: 0.05)
191 * @param options.alternative - alternative hypothesis (`two-sided`, `less`, or `greater`; default: 'two-sided')
192 * @param options.p - success probability under H0 (default: 0.5)
193 * @throws must provide valid options
194 * @returns test results
195 *
196 * @example
197 * var out = binomialTest( [ 682, 243 ] );
198 * // returns {...}
199 *
200 * out = binomialTest( [ 682, 243 ], {
201 * 'p': 0.75,
202 * 'alpha': 0.05
203 * });
204 * // returns {...}
205 */
206 (x: Tuple, options?: Options): Results;
207 }
208
209 /**
210 * Computes an exact test for the success probability in a Bernoulli experiment.
211 *
212 * @param x - number of successes or two-element array with successes and failures
213 * @param n - total number of observations
214 * @param options - function options
215 * @param options.alpha - significance level (default: 0.05)
216 * @param options.alternative - alternative hypothesis (`two-sided`, `less`, or `greater`; default: 'two-sided')
217 * @param options.p - success probability under H0 (default: 0.5)
218 * @throws must provide valid options
219 * @returns test results
220 *
221 * @example
222 * var out = binomialTest( 682, 925 );
223 * // returns {...}
224 *
225 * @example
226 * var out = binomialTest( [ 682, 243 ] );
227 * // returns {...}
228 */
229 var binomialTest: BinomialTest;
230
231 // EXPORTS //
232
233 export = binomialTest;
234}
235
236namespace NodeJS {
237 interface ProcessEnv {
238 DATABASE_HOST?: string;
239 DATABASE_READ_ONLY_HOST?: string;
240 DATABASE_PORT?: string;
241 DATABASE_NAME?: string;
242 DATABASE_USER?: string;
243 DATABASE_PASSWORD?: string;
244 SESSION_SECRET?: string;
245 WAREHOUSE_ADAPTER?: string;
246 ANALYTICS_ADAPTER?: string;
247 DATA_WAREHOUSE_PROVIDER?: string;
248 NODE_ENV?: string;
249 EXPOSE_SENSITIVE_IMPLEMENTATION_DETAILS_IN_ERRORS?: string;
250 ALLOW_USER_INPUT_LOCALHOST_URIS?: string;
251 SEQUELIZE_PRINT_LOGS?: string;
252 REDIS_USE_CLUSTER?: string;
253 REDIS_HOST?: string;
254 REDIS_PORT?: string;
255 REDIS_USER?: string;
256 REDIS_PASSWORD?: string;
257 GROQ_SECRET_KEY?: string;
258 SENDGRID_API_KEY?: string;
259 GOOGLE_PLACES_API_KEY?: string;
260 READ_ME_JWT_SECRET?: string;
261 GOOGLE_TRANSLATE_API_KEY?: string;
262 OPEN_AI_API_KEY?: string;
263 SLACK_APP_BEARER_TOKEN?: string;
264 GRAPHQL_OPAQUE_SCALAR_SECRET?: string;
265 }
266}