@bgord/bun 0.1.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.
Files changed (141) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +3 -0
  3. package/dist/api-key-shield.d.ts +16 -0
  4. package/dist/api-version.d.ts +8 -0
  5. package/dist/auth-shield.d.ts +32 -0
  6. package/dist/basic-auth-shield.d.ts +14 -0
  7. package/dist/bgord-bun.cjs +2 -0
  8. package/dist/bgord-bun.cjs.map +1 -0
  9. package/dist/bgord-bun.modern.js +2 -0
  10. package/dist/bgord-bun.modern.js.map +1 -0
  11. package/dist/bgord-bun.module.js +2 -0
  12. package/dist/bgord-bun.module.js.map +1 -0
  13. package/dist/bgord-bun.umd.js +2 -0
  14. package/dist/bgord-bun.umd.js.map +1 -0
  15. package/dist/build-info-repository.d.ts +8 -0
  16. package/dist/bun/api-key-shield.d.ts +16 -0
  17. package/dist/bun/api-version.d.ts +8 -0
  18. package/dist/bun/context.d.ts +12 -0
  19. package/dist/bun/etag-extractor.d.ts +17 -0
  20. package/dist/bun/graceful-shutdown.d.ts +6 -0
  21. package/dist/bun/healthcheck.d.ts +22 -0
  22. package/dist/bun/http-logger.d.ts +9 -0
  23. package/dist/bun/index.d.ts +9 -0
  24. package/dist/bun/rate-limit-shield.d.ts +11 -0
  25. package/dist/bun/time-zone-offset.d.ts +16 -0
  26. package/dist/cache-response.d.ts +15 -0
  27. package/dist/cache-static-files.d.ts +9 -0
  28. package/dist/cache.d.ts +1 -0
  29. package/dist/clock.d.ts +49 -0
  30. package/dist/context.d.ts +12 -0
  31. package/dist/credentials.d.ts +28 -0
  32. package/dist/dates.d.ts +37 -0
  33. package/dist/decorators.d.ts +8 -0
  34. package/dist/deep-merge.d.ts +7 -0
  35. package/dist/dll.d.ts +29 -0
  36. package/dist/download-file.d.ts +10 -0
  37. package/dist/email-censor.d.ts +4 -0
  38. package/dist/encryption.d.ts +20 -0
  39. package/dist/environment-validator.d.ts +23 -0
  40. package/dist/errors.d.ts +49 -0
  41. package/dist/etag-extractor.d.ts +17 -0
  42. package/dist/etag.d.ts +19 -0
  43. package/dist/event.d.ts +59 -0
  44. package/dist/express-essentials.d.ts +35 -0
  45. package/dist/feature-flag.d.ts +5 -0
  46. package/dist/file-location.d.ts +31 -0
  47. package/dist/file-uploader.d.ts +12 -0
  48. package/dist/file.d.ts +4 -0
  49. package/dist/filter.d.ts +17 -0
  50. package/dist/graceful-shutdown.d.ts +6 -0
  51. package/dist/gzip.d.ts +12 -0
  52. package/dist/handlebars.d.ts +10 -0
  53. package/dist/hcaptcha-shield.d.ts +24 -0
  54. package/dist/healthcheck.d.ts +20 -0
  55. package/dist/http-logger.d.ts +10 -0
  56. package/dist/i18n.d.ts +31 -0
  57. package/dist/image-compressor.d.ts +10 -0
  58. package/dist/image-converter.d.ts +11 -0
  59. package/dist/image-exif.d.ts +18 -0
  60. package/dist/image-resizer.d.ts +16 -0
  61. package/dist/index.d.ts +9 -0
  62. package/dist/jobs.d.ts +32 -0
  63. package/dist/leap-year-checker.d.ts +4 -0
  64. package/dist/logger.d.ts +53 -0
  65. package/dist/mailer.d.ts +16 -0
  66. package/dist/mean.d.ts +4 -0
  67. package/dist/memory-consumption.d.ts +4 -0
  68. package/dist/method-override.d.ts +4 -0
  69. package/dist/mime-types.d.ts +2 -0
  70. package/dist/mime.d.ts +10 -0
  71. package/dist/min-max-scaler.d.ts +36 -0
  72. package/dist/money.d.ts +24 -0
  73. package/dist/noop.d.ts +2 -0
  74. package/dist/open-graph.d.ts +91 -0
  75. package/dist/outlier-detector.d.ts +6 -0
  76. package/dist/package-version.d.ts +20 -0
  77. package/dist/pagination.d.ts +58 -0
  78. package/dist/percentage.d.ts +4 -0
  79. package/dist/policy.d.ts +11 -0
  80. package/dist/polyfills.d.ts +0 -0
  81. package/dist/population-standard-deviation.d.ts +4 -0
  82. package/dist/prerequisites/binary.d.ts +16 -0
  83. package/dist/prerequisites/bun.d.ts +13 -0
  84. package/dist/prerequisites/jobs.d.ts +13 -0
  85. package/dist/prerequisites/mailer.d.ts +13 -0
  86. package/dist/prerequisites/memory.d.ts +13 -0
  87. package/dist/prerequisites/node.d.ts +13 -0
  88. package/dist/prerequisites/outside-connectivity.d.ts +11 -0
  89. package/dist/prerequisites/path.d.ts +16 -0
  90. package/dist/prerequisites/port.d.ts +13 -0
  91. package/dist/prerequisites/ram.d.ts +13 -0
  92. package/dist/prerequisites/self.d.ts +11 -0
  93. package/dist/prerequisites/space.d.ts +13 -0
  94. package/dist/prerequisites/ssl-certificate-expiry.d.ts +13 -0
  95. package/dist/prerequisites/timezone-utc.d.ts +13 -0
  96. package/dist/prerequisites/translations.d.ts +14 -0
  97. package/dist/prerequisites.d.ts +44 -0
  98. package/dist/random.d.ts +8 -0
  99. package/dist/rate-limit-shield.d.ts +11 -0
  100. package/dist/rate-limiter.d.ts +18 -0
  101. package/dist/recaptcha-shield.d.ts +12 -0
  102. package/dist/redirector.d.ts +4 -0
  103. package/dist/reordering.d.ts +49 -0
  104. package/dist/request-id.d.ts +13 -0
  105. package/dist/response-body-in-locals.d.ts +4 -0
  106. package/dist/revision.d.ts +12 -0
  107. package/dist/rounding.d.ts +17 -0
  108. package/dist/schema.d.ts +189 -0
  109. package/dist/server-timing.d.ts +7 -0
  110. package/dist/simple-linear-regression.d.ts +18 -0
  111. package/dist/simulated-error.d.ts +4 -0
  112. package/dist/sitemap.d.ts +37 -0
  113. package/dist/size.d.ts +31 -0
  114. package/dist/sleep.d.ts +3 -0
  115. package/dist/slower.d.ts +8 -0
  116. package/dist/static-files.d.ts +14 -0
  117. package/dist/stepper.d.ts +23 -0
  118. package/dist/stopwatch.d.ts +14 -0
  119. package/dist/streak-calculator.d.ts +14 -0
  120. package/dist/sum.d.ts +3 -0
  121. package/dist/thousands-separator.d.ts +4 -0
  122. package/dist/time-zone-offset.d.ts +17 -0
  123. package/dist/time.d.ts +21 -0
  124. package/dist/timeout.d.ts +9 -0
  125. package/dist/ts-utils.d.ts +3 -0
  126. package/dist/uploaded-file-location.d.ts +10 -0
  127. package/dist/uptime.d.ts +9 -0
  128. package/dist/uuid.d.ts +3 -0
  129. package/dist/visually-unambiguous-characters-generator.d.ts +4 -0
  130. package/dist/z-score.d.ts +8 -0
  131. package/package.json +48 -0
  132. package/src/api-key-shield.ts +23 -0
  133. package/src/api-version.ts +19 -0
  134. package/src/context.ts +20 -0
  135. package/src/etag-extractor.ts +41 -0
  136. package/src/graceful-shutdown.ts +44 -0
  137. package/src/healthcheck.ts +58 -0
  138. package/src/http-logger.ts +123 -0
  139. package/src/index.ts +9 -0
  140. package/src/rate-limit-shield.ts +24 -0
  141. package/src/time-zone-offset.ts +44 -0
@@ -0,0 +1,18 @@
1
+ import sharp from "sharp";
2
+ import path from "node:path";
3
+ import * as Schema from "./schema";
4
+ import { MimeRawType } from "./mime";
5
+ export type ImageExifOutputType = {
6
+ width: Schema.WidthType;
7
+ height: Schema.HeightType;
8
+ name: path.ParsedPath["base"];
9
+ mimeType: MimeRawType;
10
+ };
11
+ export type ImageExifClearConfigType = {
12
+ input: Schema.PathType;
13
+ output: Schema.PathType;
14
+ };
15
+ export declare class ImageEXIF {
16
+ static read(input: Schema.PathType): Promise<ImageExifOutputType>;
17
+ static clear(config: ImageExifClearConfigType): Promise<sharp.OutputInfo>;
18
+ }
@@ -0,0 +1,16 @@
1
+ import sharp from "sharp";
2
+ import * as Schema from "./schema";
3
+ export type ImageResizerWidthConfigType = {
4
+ input: Schema.PathType;
5
+ output: Schema.PathType;
6
+ width: Schema.WidthType;
7
+ };
8
+ export type ImageResizerHeightConfigType = {
9
+ input: Schema.PathType;
10
+ output: Schema.PathType;
11
+ height: Schema.HeightType;
12
+ };
13
+ export declare class ImageResizer {
14
+ static resizeToWidth(config: ImageResizerWidthConfigType): Promise<sharp.OutputInfo>;
15
+ static resizeToHeight(config: ImageResizerHeightConfigType): Promise<sharp.OutputInfo>;
16
+ }
@@ -0,0 +1,9 @@
1
+ export * from "./graceful-shutdown";
2
+ export * from "./api-version";
3
+ export * from "./time-zone-offset";
4
+ export * from "./context";
5
+ export * from "./etag-extractor";
6
+ export * from "./http-logger";
7
+ export * from "./api-key-shield";
8
+ export * from "./rate-limit-shield";
9
+ export * from "./healthcheck";
package/dist/jobs.d.ts ADDED
@@ -0,0 +1,32 @@
1
+ import { Cron } from "croner";
2
+ import { Logger } from "./logger";
3
+ export type JobNameType = string;
4
+ export type MultipleJobsType = Record<JobNameType, Cron>;
5
+ export declare enum UTC_DAY_OF_THE_WEEK {
6
+ Monday = 1,
7
+ Tuesday = 2,
8
+ Wednesday = 3,
9
+ Thursday = 4,
10
+ Friday = 5,
11
+ Saturday = 6,
12
+ Sunday = 0
13
+ }
14
+ export declare class Jobs {
15
+ static SCHEDULES: {
16
+ EVERY_MINUTE: string;
17
+ EVERY_HOUR: string;
18
+ };
19
+ static stopAll(jobs: MultipleJobsType): void;
20
+ static areAllRunning(jobs: MultipleJobsType): boolean;
21
+ }
22
+ export type JobProcessorType = {
23
+ cron: string;
24
+ label: JobNameType;
25
+ process: () => Promise<void>;
26
+ };
27
+ export declare class JobHandler {
28
+ private readonly logger;
29
+ constructor(logger: Logger);
30
+ handle(jobProcessor: JobProcessorType): () => Promise<void>;
31
+ protect(cron: Cron): () => Promise<void>;
32
+ }
@@ -0,0 +1,4 @@
1
+ export declare class LeapYearChecker {
2
+ static isLeapYear(year: number): boolean;
3
+ static isCurrentYearLeapYear(): boolean;
4
+ }
@@ -0,0 +1,53 @@
1
+ import * as Schema from "./schema";
2
+ type LogTimestampType = number;
3
+ type LogAppType = string;
4
+ type LogEnvironmentType = Schema.NodeEnvironmentEnum;
5
+ type LogMessageType = string;
6
+ type LogOperationType = string;
7
+ type LogMetadataType = Record<string, any>;
8
+ type LogCorrelationIdType = Schema.CorrelationIdType;
9
+ type LogFullType = {
10
+ timestamp: LogTimestampType;
11
+ app: LogAppType;
12
+ environment: LogEnvironmentType;
13
+ level: Schema.LogLevelEnum;
14
+ message: LogMessageType;
15
+ operation: LogOperationType;
16
+ method: string;
17
+ url: string;
18
+ client: {
19
+ ip?: string;
20
+ userAgent?: string;
21
+ };
22
+ correlationId?: LogCorrelationIdType;
23
+ responseCode?: number;
24
+ durationMs?: Schema.TimestampType;
25
+ metadata?: LogMetadataType;
26
+ };
27
+ type LogErrorType = Omit<LogFullType, "app" | "client" | "environment" | "duration" | "level" | "method" | "responseCode" | "timestamp" | "url">;
28
+ type LogWarnType = Omit<LogFullType, "app" | "client" | "environment" | "duration" | "level" | "method" | "responseCode" | "timestamp" | "url">;
29
+ type LogInfoType = Omit<LogFullType, "app" | "client" | "environment" | "duration" | "level" | "method" | "responseCode" | "timestamp" | "url">;
30
+ type LogHttpType = Omit<LogFullType, "app" | "environment" | "timestamp" | "level">;
31
+ type LoggerOptionsType = {
32
+ app: LogAppType;
33
+ environment: Schema.NodeEnvironmentEnum;
34
+ level?: Schema.LogLevelEnum;
35
+ };
36
+ export declare class Logger {
37
+ private readonly instance;
38
+ private readonly app;
39
+ private readonly environment;
40
+ private readonly level;
41
+ constructor(options: LoggerOptionsType);
42
+ private getBase;
43
+ info(log: LogInfoType): void;
44
+ error(log: LogErrorType): void;
45
+ warn(log: LogWarnType): void;
46
+ http(log: LogHttpType): void;
47
+ formatError(_error: unknown): {
48
+ message: string;
49
+ name: string;
50
+ stack: string | undefined;
51
+ };
52
+ }
53
+ export {};
@@ -0,0 +1,16 @@
1
+ import { SendMailOptions } from "nodemailer";
2
+ import { SmtpHostType, SmtpPortType, SmtpUserType, SmtpPassType } from "./schema";
3
+ type MailerConfigType = {
4
+ SMTP_HOST: SmtpHostType;
5
+ SMTP_PORT: SmtpPortType;
6
+ SMTP_USER: SmtpUserType;
7
+ SMTP_PASS: SmtpPassType;
8
+ };
9
+ type MailerSendOptionsType = SendMailOptions;
10
+ export declare class Mailer {
11
+ private readonly transport;
12
+ constructor(config: MailerConfigType);
13
+ send(options: MailerSendOptionsType): Promise<unknown>;
14
+ verify(): Promise<true>;
15
+ }
16
+ export {};
package/dist/mean.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ import { RoundingStrategy } from "./rounding";
2
+ export declare class Mean {
3
+ static calculate(values: number[], rounding?: RoundingStrategy): number;
4
+ }
@@ -0,0 +1,4 @@
1
+ import { Size } from "./size";
2
+ export declare class MemoryConsumption {
3
+ static get(): Size;
4
+ }
@@ -0,0 +1,4 @@
1
+ import express from "express";
2
+ export declare class MethodOverride {
3
+ static applyTo(app: express.Application): void;
4
+ }
@@ -0,0 +1,2 @@
1
+ import type { MimeRawType } from "./mime";
2
+ export declare const MIME_TYPES: Record<string, MimeRawType[]>;
package/dist/mime.d.ts ADDED
@@ -0,0 +1,10 @@
1
+ export type MimeRawType = string;
2
+ export type MimeTypeType = string;
3
+ export type MimeSubtypeType = string;
4
+ export declare class Mime {
5
+ readonly raw: MimeRawType;
6
+ readonly type: MimeTypeType;
7
+ readonly subtype: MimeSubtypeType;
8
+ constructor(value: MimeRawType);
9
+ isSatisfiedBy(another: Mime): boolean;
10
+ }
@@ -0,0 +1,36 @@
1
+ import { RoundingStrategy } from "./rounding";
2
+ type MinMaxScalerValueType = number;
3
+ type MinMaxScalerConfigType = {
4
+ min: MinMaxScalerValueType;
5
+ max: MinMaxScalerValueType;
6
+ bound?: {
7
+ lower: MinMaxScalerValueType;
8
+ upper: MinMaxScalerValueType;
9
+ };
10
+ rounding?: RoundingStrategy;
11
+ };
12
+ export declare class MinMaxScaler {
13
+ private readonly min;
14
+ private readonly max;
15
+ private readonly lower;
16
+ private readonly upper;
17
+ private readonly rounding;
18
+ constructor(config: MinMaxScalerConfigType);
19
+ scale(value: MinMaxScalerValueType): {
20
+ original: number;
21
+ scaled: number;
22
+ isMin: boolean;
23
+ isMax: boolean;
24
+ };
25
+ descale(scaled: MinMaxScalerValueType): {
26
+ original: number;
27
+ scaled: number;
28
+ isLowerBound: boolean;
29
+ isUpperBound: boolean;
30
+ };
31
+ static getMinMax(values: MinMaxScalerValueType[]): {
32
+ min: number;
33
+ max: number;
34
+ };
35
+ }
36
+ export {};
@@ -0,0 +1,24 @@
1
+ import z from "zod";
2
+ import { RoundingStrategy } from "./rounding";
3
+ export declare const MoneyAmount: z.ZodBranded<z.ZodNumber, "money-amount">;
4
+ export type MoneyAmountType = z.infer<typeof MoneyAmount>;
5
+ export declare const MoneyMultiplicationFactor: z.ZodBranded<z.ZodNumber, "money-multiplication-factor">;
6
+ export type MoneyMultiplicationFactorType = z.infer<typeof MoneyMultiplicationFactor>;
7
+ export declare const MoneyDivisionFactor: z.ZodBranded<z.ZodEffects<z.ZodNumber, number, number>, "money-division-factor">;
8
+ export type MoneyDivisionFactorType = z.infer<typeof MoneyDivisionFactor>;
9
+ export declare class Money {
10
+ private static readonly ZERO;
11
+ private readonly amount;
12
+ private readonly rounding;
13
+ constructor(value?: number, rounding?: RoundingStrategy);
14
+ getAmount(): MoneyAmountType;
15
+ add(money: Money): Money;
16
+ multiply(factor: MoneyMultiplicationFactorType): Money;
17
+ subtract(money: Money): Money;
18
+ divide(factor: MoneyDivisionFactorType): Money;
19
+ equals(another: Money): boolean;
20
+ isGreaterThan(another: Money): boolean;
21
+ isLessThan(another: Money): boolean;
22
+ isZero(): boolean;
23
+ format(): string;
24
+ }
package/dist/noop.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export declare function noop(): void;
2
+ export declare function anoop(): Promise<void>;
@@ -0,0 +1,91 @@
1
+ import * as Schema from "./schema";
2
+ declare class OpenGraphTitle {
3
+ private readonly value;
4
+ constructor(value: Schema.OpenGraphTitleValueType);
5
+ toMetatag(): string;
6
+ toMeta(): string;
7
+ }
8
+ declare class OpenGraphDescription {
9
+ private readonly value;
10
+ constructor(value: Schema.OpenGraphDescriptionValueType);
11
+ toMetatag(): string;
12
+ toMeta(): string;
13
+ }
14
+ declare class OpenGraphUrl {
15
+ private readonly value;
16
+ constructor(value: Schema.OpenGraphUrlValueType);
17
+ toMetatag(): string;
18
+ toMeta(): string;
19
+ }
20
+ declare class OpenGraphType {
21
+ private readonly value;
22
+ constructor(value: Schema.OpenGraphTypeValueType);
23
+ toMetatag(): string;
24
+ toMeta(): string;
25
+ }
26
+ declare class OpenGraphImageUrl {
27
+ private readonly value;
28
+ constructor(path: Schema.PathType);
29
+ toMetatag(): string;
30
+ toMeta(): string;
31
+ }
32
+ declare class OpenGraphImageType {
33
+ private readonly value;
34
+ constructor(value: Schema.OpenGraphImageTypeValueType);
35
+ toMetatag(): string;
36
+ toMeta(): string;
37
+ }
38
+ declare class OpenGraphImageWidth {
39
+ private readonly value;
40
+ constructor(value: Schema.OpenGraphImageWidthValueType);
41
+ toMetatag(): string;
42
+ toMeta(): string;
43
+ }
44
+ declare class OpenGraphImageHeight {
45
+ private readonly value;
46
+ constructor(value: Schema.OpenGraphImageHeightValueType);
47
+ toMetatag(): string;
48
+ toMeta(): string;
49
+ }
50
+ export type OpenGraphImageConfigType = {
51
+ url: OpenGraphImageUrl;
52
+ width: OpenGraphImageWidth;
53
+ height: OpenGraphImageHeight;
54
+ type: OpenGraphImageType;
55
+ };
56
+ declare class OpenGraphImage {
57
+ private readonly value;
58
+ constructor(value: OpenGraphImageConfigType);
59
+ toString(): string;
60
+ }
61
+ declare class OpenGraphImageGenerator {
62
+ static generate(config: {
63
+ path: Schema.PathType;
64
+ BASE_URL: Schema.UrlWithoutTrailingSlashType;
65
+ }): Promise<OpenGraphImage>;
66
+ }
67
+ type OpenGraphConfigType = {
68
+ title: OpenGraphTitle;
69
+ description: OpenGraphDescription;
70
+ url: OpenGraphUrl;
71
+ type: OpenGraphType;
72
+ image?: OpenGraphImage;
73
+ };
74
+ declare class OpenGraphGenerator {
75
+ static toString(config: OpenGraphConfigType): string;
76
+ }
77
+ export declare const OpenGraph: {
78
+ generator: typeof OpenGraphGenerator;
79
+ title: typeof OpenGraphTitle;
80
+ description: typeof OpenGraphDescription;
81
+ url: typeof OpenGraphUrl;
82
+ type: typeof OpenGraphType;
83
+ image: {
84
+ generator: typeof OpenGraphImageGenerator;
85
+ url: typeof OpenGraphImageUrl;
86
+ width: typeof OpenGraphImageWidth;
87
+ height: typeof OpenGraphImageHeight;
88
+ type: typeof OpenGraphImageType;
89
+ };
90
+ };
91
+ export {};
@@ -0,0 +1,6 @@
1
+ export declare class OutlierDetector {
2
+ private readonly zScore;
3
+ private readonly threshold;
4
+ constructor(values: number[], threshold: number);
5
+ check(value: number): boolean;
6
+ }
@@ -0,0 +1,20 @@
1
+ import { z } from "zod";
2
+ type MajorType = number;
3
+ type MinorType = number;
4
+ type PatchType = number;
5
+ export declare const PackageVersionSchema: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, {
6
+ major: number;
7
+ minor: number;
8
+ patch: number;
9
+ }, string>;
10
+ export type PackageVersionSchemaType = z.infer<typeof PackageVersionSchema>;
11
+ export declare class PackageVersion {
12
+ readonly major: MajorType;
13
+ readonly minor: MinorType;
14
+ readonly patch: PatchType;
15
+ constructor(major: MajorType, minor: MinorType, patch: PatchType);
16
+ isGreaterThanOrEqual(another: PackageVersion): boolean;
17
+ static fromStringWithV(value: string): PackageVersion;
18
+ static fromString(value: string): PackageVersion;
19
+ }
20
+ export {};
@@ -0,0 +1,58 @@
1
+ import * as z from "zod";
2
+ declare const Take: z.ZodNumber;
3
+ type TakeType = z.infer<typeof Take>;
4
+ declare const Skip: z.ZodNumber;
5
+ type SkipType = z.infer<typeof Skip>;
6
+ declare const Page: z.ZodDefault<z.ZodNumber>;
7
+ export type PageType = z.infer<typeof Page>;
8
+ export type PaginationType = {
9
+ values: {
10
+ take: TakeType;
11
+ skip: SkipType;
12
+ };
13
+ page: PageType;
14
+ };
15
+ export type PaginationValuesType = Record<string, unknown>;
16
+ export type TotalType = number;
17
+ export type ExhaustedType = boolean;
18
+ export type PaginationExhaustedConfig = {
19
+ total: TotalType;
20
+ pagination: PaginationType;
21
+ };
22
+ export type PaginationPrepareConfigType<T> = {
23
+ total: TotalType;
24
+ pagination: PaginationType;
25
+ result: T[];
26
+ };
27
+ export declare class Pagination {
28
+ static parse(values: PaginationValuesType, _take: TakeType): PaginationType;
29
+ static prepare<T>(config: PaginationPrepareConfigType<T>): Paged<T>;
30
+ static isExhausted(config: PaginationExhaustedConfig): ExhaustedType;
31
+ private static getLastPage;
32
+ static empty: {
33
+ result: never[];
34
+ meta: {
35
+ exhausted: boolean;
36
+ currentPage: number;
37
+ previousPage: undefined;
38
+ nextPage: undefined;
39
+ lastPage: number;
40
+ total: number;
41
+ };
42
+ };
43
+ static getFirstPage({ take }: {
44
+ take: TakeType;
45
+ }): PaginationType;
46
+ }
47
+ export type Paged<T> = {
48
+ result: T[];
49
+ meta: {
50
+ exhausted: ExhaustedType;
51
+ currentPage: PageType;
52
+ previousPage: PageType | undefined;
53
+ nextPage: PageType | undefined;
54
+ lastPage: PageType;
55
+ total: TotalType;
56
+ };
57
+ };
58
+ export {};
@@ -0,0 +1,4 @@
1
+ import { RoundingStrategy } from "./rounding";
2
+ export declare class Percentage {
3
+ static of(numerator: number, denominator: number, rounding?: RoundingStrategy): number;
4
+ }
@@ -0,0 +1,11 @@
1
+ import * as ts from "./ts-utils";
2
+ type BasePolicyConfig = Record<string, unknown>;
3
+ export declare abstract class Policy<T extends BasePolicyConfig> {
4
+ abstract fails(config: T): Promise<boolean> | boolean;
5
+ abstract error: ts.Constructor<Error>;
6
+ abstract message: string;
7
+ throw(): void;
8
+ perform(config: T): Promise<void>;
9
+ passes(config: T): Promise<boolean>;
10
+ }
11
+ export {};
File without changes
@@ -0,0 +1,4 @@
1
+ import { RoundingStrategy } from "./rounding";
2
+ export declare class PopulationStandardDeviation {
3
+ static calculate(values: number[], rounding?: RoundingStrategy): number;
4
+ }
@@ -0,0 +1,16 @@
1
+ import z from "zod";
2
+ import { PrerequisiteLabelType, PrerequisiteStatusEnum, PrerequisiteStrategyEnum, AbstractPrerequisite } from "../prerequisites";
3
+ declare const PrerequisiteBinaryValue: z.ZodEffects<z.ZodString, string, string>;
4
+ type PrerequisiteBinaryValueType = z.infer<typeof PrerequisiteBinaryValue>;
5
+ type PrerequisiteBinaryConfigType = {
6
+ binary: PrerequisiteBinaryValueType;
7
+ label: PrerequisiteLabelType;
8
+ enabled?: boolean;
9
+ };
10
+ export declare class PrerequisiteBinary extends AbstractPrerequisite<PrerequisiteBinaryConfigType> {
11
+ readonly config: PrerequisiteBinaryConfigType;
12
+ readonly strategy = PrerequisiteStrategyEnum.binary;
13
+ constructor(config: PrerequisiteBinaryConfigType);
14
+ verify(): Promise<PrerequisiteStatusEnum>;
15
+ }
16
+ export {};
@@ -0,0 +1,13 @@
1
+ import { PackageVersion } from "../package-version";
2
+ import { PrerequisiteLabelType, PrerequisiteStrategyEnum, PrerequisiteStatusEnum, AbstractPrerequisite } from "../prerequisites";
3
+ export type PrerequisiteBunConfigType = {
4
+ version: PackageVersion;
5
+ label: PrerequisiteLabelType;
6
+ enabled?: boolean;
7
+ };
8
+ export declare class PrerequisiteBun extends AbstractPrerequisite<PrerequisiteBunConfigType> {
9
+ readonly config: PrerequisiteBunConfigType;
10
+ readonly strategy = PrerequisiteStrategyEnum.bun;
11
+ constructor(config: PrerequisiteBunConfigType);
12
+ verify(): Promise<PrerequisiteStatusEnum>;
13
+ }
@@ -0,0 +1,13 @@
1
+ import { MultipleJobsType } from "../jobs";
2
+ import { PrerequisiteLabelType, PrerequisiteStrategyEnum, PrerequisiteStatusEnum, AbstractPrerequisite } from "../prerequisites";
3
+ export type PrerequisiteJobsConfigType = {
4
+ jobs: MultipleJobsType;
5
+ label: PrerequisiteLabelType;
6
+ enabled?: boolean;
7
+ };
8
+ export declare class PrerequisiteJobs extends AbstractPrerequisite<PrerequisiteJobsConfigType> {
9
+ readonly config: PrerequisiteJobsConfigType;
10
+ readonly strategy = PrerequisiteStrategyEnum.jobs;
11
+ constructor(config: PrerequisiteJobsConfigType);
12
+ verify(): Promise<PrerequisiteStatusEnum>;
13
+ }
@@ -0,0 +1,13 @@
1
+ import { Mailer } from "../mailer";
2
+ import { PrerequisiteLabelType, PrerequisiteStrategyEnum, PrerequisiteStatusEnum, AbstractPrerequisite } from "../prerequisites";
3
+ export type PrerequisiteMailerConfigType = {
4
+ mailer: Mailer;
5
+ label: PrerequisiteLabelType;
6
+ enabled?: boolean;
7
+ };
8
+ export declare class PrerequisiteMailer extends AbstractPrerequisite<PrerequisiteMailerConfigType> {
9
+ readonly config: PrerequisiteMailerConfigType;
10
+ readonly strategy = PrerequisiteStrategyEnum.mailer;
11
+ constructor(config: PrerequisiteMailerConfigType);
12
+ verify(): Promise<PrerequisiteStatusEnum>;
13
+ }
@@ -0,0 +1,13 @@
1
+ import { Size } from "../size";
2
+ import { PrerequisiteLabelType, PrerequisiteStrategyEnum, PrerequisiteStatusEnum, AbstractPrerequisite } from "../prerequisites";
3
+ export type PrerequisiteMemoryConfigType = {
4
+ maximum: Size;
5
+ label: PrerequisiteLabelType;
6
+ enabled?: boolean;
7
+ };
8
+ export declare class PrerequisiteMemory extends AbstractPrerequisite<PrerequisiteMemoryConfigType> {
9
+ readonly config: PrerequisiteMemoryConfigType;
10
+ readonly strategy = PrerequisiteStrategyEnum.memory;
11
+ constructor(config: PrerequisiteMemoryConfigType);
12
+ verify(): Promise<PrerequisiteStatusEnum>;
13
+ }
@@ -0,0 +1,13 @@
1
+ import { PackageVersion } from "../package-version";
2
+ import { PrerequisiteLabelType, PrerequisiteStrategyEnum, PrerequisiteStatusEnum, AbstractPrerequisite } from "../prerequisites";
3
+ export type PrerequisiteNodeConfigType = {
4
+ version: PackageVersion;
5
+ label: PrerequisiteLabelType;
6
+ enabled?: boolean;
7
+ };
8
+ export declare class PrerequisiteNode extends AbstractPrerequisite<PrerequisiteNodeConfigType> {
9
+ readonly config: PrerequisiteNodeConfigType;
10
+ readonly strategy = PrerequisiteStrategyEnum.node;
11
+ constructor(config: PrerequisiteNodeConfigType);
12
+ verify(): Promise<PrerequisiteStatusEnum>;
13
+ }
@@ -0,0 +1,11 @@
1
+ import { PrerequisiteLabelType, PrerequisiteStrategyEnum, PrerequisiteStatusEnum, AbstractPrerequisite } from "../prerequisites";
2
+ export type PrerequisiteOutsideConnectivityConfigType = {
3
+ label: PrerequisiteLabelType;
4
+ enabled?: boolean;
5
+ };
6
+ export declare class PrerequisiteOutsideConnectivity extends AbstractPrerequisite<PrerequisiteOutsideConnectivityConfigType> {
7
+ readonly config: PrerequisiteOutsideConnectivityConfigType;
8
+ readonly strategy = PrerequisiteStrategyEnum.outsideConnectivity;
9
+ constructor(config: PrerequisiteOutsideConnectivityConfigType);
10
+ verify(): Promise<PrerequisiteStatusEnum>;
11
+ }
@@ -0,0 +1,16 @@
1
+ import { PrerequisiteLabelType, PrerequisiteStrategyEnum, PrerequisiteStatusEnum, AbstractPrerequisite } from "../prerequisites";
2
+ export type PrerequisitePathConfigType = {
3
+ path: string;
4
+ access?: {
5
+ write?: boolean;
6
+ execute?: boolean;
7
+ };
8
+ label: PrerequisiteLabelType;
9
+ enabled?: boolean;
10
+ };
11
+ export declare class PrerequisitePath extends AbstractPrerequisite<PrerequisitePathConfigType> {
12
+ readonly config: PrerequisitePathConfigType;
13
+ readonly strategy = PrerequisiteStrategyEnum.path;
14
+ constructor(config: PrerequisitePathConfigType);
15
+ verify(): Promise<PrerequisiteStatusEnum>;
16
+ }
@@ -0,0 +1,13 @@
1
+ import * as Schema from "../schema";
2
+ import { PrerequisiteLabelType, PrerequisiteStrategyEnum, PrerequisiteStatusEnum, AbstractPrerequisite } from "../prerequisites";
3
+ export type PrerequisitePortConfigType = {
4
+ port: Schema.PortType;
5
+ label: PrerequisiteLabelType;
6
+ enabled?: boolean;
7
+ };
8
+ export declare class PrerequisitePort extends AbstractPrerequisite<PrerequisitePortConfigType> {
9
+ readonly config: PrerequisitePortConfigType;
10
+ readonly strategy = PrerequisiteStrategyEnum.port;
11
+ constructor(config: PrerequisitePortConfigType);
12
+ verify(): Promise<PrerequisiteStatusEnum>;
13
+ }
@@ -0,0 +1,13 @@
1
+ import { Size } from "../size";
2
+ import { PrerequisiteLabelType, PrerequisiteStrategyEnum, PrerequisiteStatusEnum, AbstractPrerequisite } from "../prerequisites";
3
+ export type PrerequisiteRAMConfigType = {
4
+ minimum: Size;
5
+ label: PrerequisiteLabelType;
6
+ enabled?: boolean;
7
+ };
8
+ export declare class PrerequisiteRAM extends AbstractPrerequisite<PrerequisiteRAMConfigType> {
9
+ readonly config: PrerequisiteRAMConfigType;
10
+ readonly strategy = PrerequisiteStrategyEnum.RAM;
11
+ constructor(config: PrerequisiteRAMConfigType);
12
+ verify(): Promise<PrerequisiteStatusEnum>;
13
+ }
@@ -0,0 +1,11 @@
1
+ import { PrerequisiteLabelType, PrerequisiteStrategyEnum, PrerequisiteStatusEnum, AbstractPrerequisite } from "../prerequisites";
2
+ export type PrerequisiteSelfConfigType = {
3
+ label: PrerequisiteLabelType;
4
+ enabled?: boolean;
5
+ };
6
+ export declare class PrerequisiteSelf extends AbstractPrerequisite<PrerequisiteSelfConfigType> {
7
+ readonly config: PrerequisiteSelfConfigType;
8
+ readonly strategy = PrerequisiteStrategyEnum.self;
9
+ constructor(config: PrerequisiteSelfConfigType);
10
+ verify(): Promise<PrerequisiteStatusEnum>;
11
+ }
@@ -0,0 +1,13 @@
1
+ import { Size } from "../size";
2
+ import { PrerequisiteLabelType, PrerequisiteStrategyEnum, PrerequisiteStatusEnum, AbstractPrerequisite } from "../prerequisites";
3
+ export type PrerequisiteSpaceConfigType = {
4
+ minimum: Size;
5
+ label: PrerequisiteLabelType;
6
+ enabled?: boolean;
7
+ };
8
+ export declare class PrerequisiteSpace extends AbstractPrerequisite<PrerequisiteSpaceConfigType> {
9
+ readonly config: PrerequisiteSpaceConfigType;
10
+ readonly strategy = PrerequisiteStrategyEnum.space;
11
+ constructor(config: PrerequisiteSpaceConfigType);
12
+ verify(): Promise<PrerequisiteStatusEnum>;
13
+ }
@@ -0,0 +1,13 @@
1
+ import { PrerequisiteLabelType, PrerequisiteStrategyEnum, PrerequisiteStatusEnum, AbstractPrerequisite } from "../prerequisites";
2
+ export type PrerequisiteSSLCertificateExpiryConfigType = {
3
+ host: string;
4
+ validDaysMinimum: number;
5
+ label: PrerequisiteLabelType;
6
+ enabled?: boolean;
7
+ };
8
+ export declare class PrerequisiteSSLCertificateExpiry extends AbstractPrerequisite<PrerequisiteSSLCertificateExpiryConfigType> {
9
+ readonly config: PrerequisiteSSLCertificateExpiryConfigType;
10
+ readonly strategy = PrerequisiteStrategyEnum.sslCertificateExpiry;
11
+ constructor(config: PrerequisiteSSLCertificateExpiryConfigType);
12
+ verify(): Promise<PrerequisiteStatusEnum>;
13
+ }