@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.
- package/LICENSE +21 -0
- package/README.md +3 -0
- package/dist/api-key-shield.d.ts +16 -0
- package/dist/api-version.d.ts +8 -0
- package/dist/auth-shield.d.ts +32 -0
- package/dist/basic-auth-shield.d.ts +14 -0
- package/dist/bgord-bun.cjs +2 -0
- package/dist/bgord-bun.cjs.map +1 -0
- package/dist/bgord-bun.modern.js +2 -0
- package/dist/bgord-bun.modern.js.map +1 -0
- package/dist/bgord-bun.module.js +2 -0
- package/dist/bgord-bun.module.js.map +1 -0
- package/dist/bgord-bun.umd.js +2 -0
- package/dist/bgord-bun.umd.js.map +1 -0
- package/dist/build-info-repository.d.ts +8 -0
- package/dist/bun/api-key-shield.d.ts +16 -0
- package/dist/bun/api-version.d.ts +8 -0
- package/dist/bun/context.d.ts +12 -0
- package/dist/bun/etag-extractor.d.ts +17 -0
- package/dist/bun/graceful-shutdown.d.ts +6 -0
- package/dist/bun/healthcheck.d.ts +22 -0
- package/dist/bun/http-logger.d.ts +9 -0
- package/dist/bun/index.d.ts +9 -0
- package/dist/bun/rate-limit-shield.d.ts +11 -0
- package/dist/bun/time-zone-offset.d.ts +16 -0
- package/dist/cache-response.d.ts +15 -0
- package/dist/cache-static-files.d.ts +9 -0
- package/dist/cache.d.ts +1 -0
- package/dist/clock.d.ts +49 -0
- package/dist/context.d.ts +12 -0
- package/dist/credentials.d.ts +28 -0
- package/dist/dates.d.ts +37 -0
- package/dist/decorators.d.ts +8 -0
- package/dist/deep-merge.d.ts +7 -0
- package/dist/dll.d.ts +29 -0
- package/dist/download-file.d.ts +10 -0
- package/dist/email-censor.d.ts +4 -0
- package/dist/encryption.d.ts +20 -0
- package/dist/environment-validator.d.ts +23 -0
- package/dist/errors.d.ts +49 -0
- package/dist/etag-extractor.d.ts +17 -0
- package/dist/etag.d.ts +19 -0
- package/dist/event.d.ts +59 -0
- package/dist/express-essentials.d.ts +35 -0
- package/dist/feature-flag.d.ts +5 -0
- package/dist/file-location.d.ts +31 -0
- package/dist/file-uploader.d.ts +12 -0
- package/dist/file.d.ts +4 -0
- package/dist/filter.d.ts +17 -0
- package/dist/graceful-shutdown.d.ts +6 -0
- package/dist/gzip.d.ts +12 -0
- package/dist/handlebars.d.ts +10 -0
- package/dist/hcaptcha-shield.d.ts +24 -0
- package/dist/healthcheck.d.ts +20 -0
- package/dist/http-logger.d.ts +10 -0
- package/dist/i18n.d.ts +31 -0
- package/dist/image-compressor.d.ts +10 -0
- package/dist/image-converter.d.ts +11 -0
- package/dist/image-exif.d.ts +18 -0
- package/dist/image-resizer.d.ts +16 -0
- package/dist/index.d.ts +9 -0
- package/dist/jobs.d.ts +32 -0
- package/dist/leap-year-checker.d.ts +4 -0
- package/dist/logger.d.ts +53 -0
- package/dist/mailer.d.ts +16 -0
- package/dist/mean.d.ts +4 -0
- package/dist/memory-consumption.d.ts +4 -0
- package/dist/method-override.d.ts +4 -0
- package/dist/mime-types.d.ts +2 -0
- package/dist/mime.d.ts +10 -0
- package/dist/min-max-scaler.d.ts +36 -0
- package/dist/money.d.ts +24 -0
- package/dist/noop.d.ts +2 -0
- package/dist/open-graph.d.ts +91 -0
- package/dist/outlier-detector.d.ts +6 -0
- package/dist/package-version.d.ts +20 -0
- package/dist/pagination.d.ts +58 -0
- package/dist/percentage.d.ts +4 -0
- package/dist/policy.d.ts +11 -0
- package/dist/polyfills.d.ts +0 -0
- package/dist/population-standard-deviation.d.ts +4 -0
- package/dist/prerequisites/binary.d.ts +16 -0
- package/dist/prerequisites/bun.d.ts +13 -0
- package/dist/prerequisites/jobs.d.ts +13 -0
- package/dist/prerequisites/mailer.d.ts +13 -0
- package/dist/prerequisites/memory.d.ts +13 -0
- package/dist/prerequisites/node.d.ts +13 -0
- package/dist/prerequisites/outside-connectivity.d.ts +11 -0
- package/dist/prerequisites/path.d.ts +16 -0
- package/dist/prerequisites/port.d.ts +13 -0
- package/dist/prerequisites/ram.d.ts +13 -0
- package/dist/prerequisites/self.d.ts +11 -0
- package/dist/prerequisites/space.d.ts +13 -0
- package/dist/prerequisites/ssl-certificate-expiry.d.ts +13 -0
- package/dist/prerequisites/timezone-utc.d.ts +13 -0
- package/dist/prerequisites/translations.d.ts +14 -0
- package/dist/prerequisites.d.ts +44 -0
- package/dist/random.d.ts +8 -0
- package/dist/rate-limit-shield.d.ts +11 -0
- package/dist/rate-limiter.d.ts +18 -0
- package/dist/recaptcha-shield.d.ts +12 -0
- package/dist/redirector.d.ts +4 -0
- package/dist/reordering.d.ts +49 -0
- package/dist/request-id.d.ts +13 -0
- package/dist/response-body-in-locals.d.ts +4 -0
- package/dist/revision.d.ts +12 -0
- package/dist/rounding.d.ts +17 -0
- package/dist/schema.d.ts +189 -0
- package/dist/server-timing.d.ts +7 -0
- package/dist/simple-linear-regression.d.ts +18 -0
- package/dist/simulated-error.d.ts +4 -0
- package/dist/sitemap.d.ts +37 -0
- package/dist/size.d.ts +31 -0
- package/dist/sleep.d.ts +3 -0
- package/dist/slower.d.ts +8 -0
- package/dist/static-files.d.ts +14 -0
- package/dist/stepper.d.ts +23 -0
- package/dist/stopwatch.d.ts +14 -0
- package/dist/streak-calculator.d.ts +14 -0
- package/dist/sum.d.ts +3 -0
- package/dist/thousands-separator.d.ts +4 -0
- package/dist/time-zone-offset.d.ts +17 -0
- package/dist/time.d.ts +21 -0
- package/dist/timeout.d.ts +9 -0
- package/dist/ts-utils.d.ts +3 -0
- package/dist/uploaded-file-location.d.ts +10 -0
- package/dist/uptime.d.ts +9 -0
- package/dist/uuid.d.ts +3 -0
- package/dist/visually-unambiguous-characters-generator.d.ts +4 -0
- package/dist/z-score.d.ts +8 -0
- package/package.json +48 -0
- package/src/api-key-shield.ts +23 -0
- package/src/api-version.ts +19 -0
- package/src/context.ts +20 -0
- package/src/etag-extractor.ts +41 -0
- package/src/graceful-shutdown.ts +44 -0
- package/src/healthcheck.ts +58 -0
- package/src/http-logger.ts +123 -0
- package/src/index.ts +9 -0
- package/src/rate-limit-shield.ts +24 -0
- package/src/time-zone-offset.ts +44 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as Schema from "../schema";
|
|
2
|
+
import { PrerequisiteLabelType, PrerequisiteStrategyEnum, PrerequisiteStatusEnum, AbstractPrerequisite } from "../prerequisites";
|
|
3
|
+
export type PrerequisiteTimezoneUtcConfigType = {
|
|
4
|
+
timezone: Schema.TimezoneType;
|
|
5
|
+
label: PrerequisiteLabelType;
|
|
6
|
+
enabled?: boolean;
|
|
7
|
+
};
|
|
8
|
+
export declare class PrerequisiteTimezoneUTC extends AbstractPrerequisite<PrerequisiteTimezoneUtcConfigType> {
|
|
9
|
+
readonly config: PrerequisiteTimezoneUtcConfigType;
|
|
10
|
+
readonly strategy = PrerequisiteStrategyEnum.timezoneUTC;
|
|
11
|
+
constructor(config: PrerequisiteTimezoneUtcConfigType);
|
|
12
|
+
verify(): Promise<PrerequisiteStatusEnum>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { I18n, I18nConfigType } from "../i18n";
|
|
2
|
+
import { PrerequisiteLabelType, PrerequisiteStrategyEnum, PrerequisiteStatusEnum, AbstractPrerequisite } from "../prerequisites";
|
|
3
|
+
export type PrerequisiteTranslationsConfigType = {
|
|
4
|
+
translationsPath?: typeof I18n.DEFAULT_TRANSLATIONS_PATH;
|
|
5
|
+
supportedLanguages: I18nConfigType["supportedLanguages"];
|
|
6
|
+
label: PrerequisiteLabelType;
|
|
7
|
+
enabled?: boolean;
|
|
8
|
+
};
|
|
9
|
+
export declare class PrerequisiteTranslations extends AbstractPrerequisite<PrerequisiteTranslationsConfigType> {
|
|
10
|
+
readonly config: PrerequisiteTranslationsConfigType;
|
|
11
|
+
readonly strategy = PrerequisiteStrategyEnum.translations;
|
|
12
|
+
constructor(config: PrerequisiteTranslationsConfigType);
|
|
13
|
+
verify(): Promise<PrerequisiteStatusEnum>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export type PrerequisiteLabelType = string;
|
|
2
|
+
export declare enum PrerequisiteStrategyEnum {
|
|
3
|
+
binary = "binary",
|
|
4
|
+
mailer = "mailer",
|
|
5
|
+
self = "self",
|
|
6
|
+
timezoneUTC = "timezoneUTC",
|
|
7
|
+
path = "path",
|
|
8
|
+
node = "node",
|
|
9
|
+
bun = "bun",
|
|
10
|
+
RAM = "RAM",
|
|
11
|
+
space = "space",
|
|
12
|
+
translations = "translations",
|
|
13
|
+
port = "port",
|
|
14
|
+
jobs = "jobs",
|
|
15
|
+
memory = "memory",
|
|
16
|
+
outsideConnectivity = "outsideConnectivity",
|
|
17
|
+
sslCertificateExpiry = "sslCertificateExpiry",
|
|
18
|
+
/** @public */
|
|
19
|
+
custom = "custom"
|
|
20
|
+
}
|
|
21
|
+
export declare enum PrerequisiteStatusEnum {
|
|
22
|
+
success = "success",
|
|
23
|
+
failure = "failure",
|
|
24
|
+
undetermined = "undetermined"
|
|
25
|
+
}
|
|
26
|
+
export type BasePrerequisiteConfig = {
|
|
27
|
+
label: PrerequisiteLabelType;
|
|
28
|
+
enabled?: boolean;
|
|
29
|
+
} & Record<string, unknown>;
|
|
30
|
+
export declare abstract class AbstractPrerequisite<T extends BasePrerequisiteConfig> {
|
|
31
|
+
readonly label: PrerequisiteLabelType;
|
|
32
|
+
readonly enabled: boolean;
|
|
33
|
+
abstract readonly strategy: PrerequisiteStrategyEnum;
|
|
34
|
+
abstract readonly config: T;
|
|
35
|
+
status: PrerequisiteStatusEnum;
|
|
36
|
+
constructor(config: T);
|
|
37
|
+
abstract verify(): Promise<PrerequisiteStatusEnum>;
|
|
38
|
+
protected pass(): PrerequisiteStatusEnum.success;
|
|
39
|
+
protected reject(): PrerequisiteStatusEnum.failure;
|
|
40
|
+
report(): void;
|
|
41
|
+
}
|
|
42
|
+
export declare class Prerequisites {
|
|
43
|
+
static check(prerequisites: AbstractPrerequisite<BasePrerequisiteConfig>[]): Promise<void>;
|
|
44
|
+
}
|
package/dist/random.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as bg from "@bgord/node";
|
|
2
|
+
import { HTTPException } from "hono/http-exception";
|
|
3
|
+
declare type RateLimitShieldOptionsType = {
|
|
4
|
+
ms: bg.Schema.TimestampType;
|
|
5
|
+
};
|
|
6
|
+
export declare const TooManyRequestsError: HTTPException;
|
|
7
|
+
export declare const rateLimitShield: (options: RateLimitShieldOptionsType) => import("hono/types").MiddlewareHandler<{
|
|
8
|
+
Bindings: any;
|
|
9
|
+
Variables: any;
|
|
10
|
+
}, string, {}>;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { TimestampType } from "./schema";
|
|
2
|
+
export type RateLimiterOptionsType = {
|
|
3
|
+
ms: TimestampType;
|
|
4
|
+
};
|
|
5
|
+
export type RateLimiterResultSuccessType = {
|
|
6
|
+
allowed: true;
|
|
7
|
+
};
|
|
8
|
+
export type RateLimiterResultErrorType = {
|
|
9
|
+
allowed: false;
|
|
10
|
+
remainingMs: TimestampType;
|
|
11
|
+
};
|
|
12
|
+
export type RateLimiterResultType = RateLimiterResultSuccessType | RateLimiterResultErrorType;
|
|
13
|
+
export declare class RateLimiter {
|
|
14
|
+
private readonly options;
|
|
15
|
+
private lastInvocationTimestampMs;
|
|
16
|
+
constructor(options: RateLimiterOptionsType);
|
|
17
|
+
verify(currentTimestampMs: TimestampType): RateLimiterResultType;
|
|
18
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import express from "express";
|
|
2
|
+
import { RecaptchaSiteKeyType, RecaptchaSecretKeyType } from "./schema";
|
|
3
|
+
export type RecaptchaVerifierConfigType = {
|
|
4
|
+
siteKey: RecaptchaSiteKeyType;
|
|
5
|
+
secretKey: RecaptchaSecretKeyType;
|
|
6
|
+
};
|
|
7
|
+
export declare class RecaptchaShield {
|
|
8
|
+
private readonly siteKey;
|
|
9
|
+
private readonly secretKey;
|
|
10
|
+
constructor(config: RecaptchaVerifierConfigType);
|
|
11
|
+
build(): (request: express.Request, _response: express.Response, next: express.NextFunction) => Promise<void>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import * as Schema from "./schema";
|
|
2
|
+
export type WithReorderingPositionValue<T> = T & {
|
|
3
|
+
position: Schema.ReorderingItemPositionValueType;
|
|
4
|
+
};
|
|
5
|
+
export declare class ReorderingPosition {
|
|
6
|
+
readonly value: Schema.ReorderingItemPositionValueType;
|
|
7
|
+
constructor(value: Schema.ReorderingItemPositionValueType);
|
|
8
|
+
eq(another: ReorderingPosition): boolean;
|
|
9
|
+
}
|
|
10
|
+
declare class ReorderingItem {
|
|
11
|
+
readonly id: Schema.ReorderingItemIdType;
|
|
12
|
+
readonly position: ReorderingPosition;
|
|
13
|
+
constructor(id: Schema.ReorderingItemIdType, position: ReorderingPosition);
|
|
14
|
+
eq(anotherItemId: ReorderingItem["id"]): boolean;
|
|
15
|
+
}
|
|
16
|
+
declare enum ReorderingTransferDirection {
|
|
17
|
+
upwards = "upwards",
|
|
18
|
+
downwards = "downwards",
|
|
19
|
+
noop = "noop"
|
|
20
|
+
}
|
|
21
|
+
export declare class ReorderingTransfer {
|
|
22
|
+
readonly id: ReorderingItem["id"];
|
|
23
|
+
readonly to: ReorderingPosition;
|
|
24
|
+
constructor(config: {
|
|
25
|
+
id: ReorderingItem["id"];
|
|
26
|
+
to: Schema.ReorderingItemPositionValueType;
|
|
27
|
+
});
|
|
28
|
+
getDirection(currentPosition: ReorderingPosition): ReorderingTransferDirection;
|
|
29
|
+
}
|
|
30
|
+
export declare class ReorderingCalculator {
|
|
31
|
+
private dll;
|
|
32
|
+
constructor();
|
|
33
|
+
static fromArray(ids: ReorderingItem["id"][]): ReorderingCalculator;
|
|
34
|
+
add(id: ReorderingItem["id"]): ReorderingItem;
|
|
35
|
+
delete(id: ReorderingItem["id"]): void;
|
|
36
|
+
transfer(transfer: ReorderingTransfer): ReturnType<ReorderingCalculator["read"]>;
|
|
37
|
+
read(): {
|
|
38
|
+
ids: string[];
|
|
39
|
+
items: ReorderingItem[];
|
|
40
|
+
};
|
|
41
|
+
private recalculate;
|
|
42
|
+
}
|
|
43
|
+
export declare class ReorderingIntegrator {
|
|
44
|
+
static appendPosition(reordering: Schema.ReorderingType[]): <T extends {
|
|
45
|
+
id: Schema.ReorderingItemIdType;
|
|
46
|
+
}>(item: T) => WithReorderingPositionValue<T>;
|
|
47
|
+
static sortByPosition(): (a: WithReorderingPositionValue<unknown>, b: WithReorderingPositionValue<unknown>) => number;
|
|
48
|
+
}
|
|
49
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import express from "express";
|
|
2
|
+
import * as Schema from "./schema";
|
|
3
|
+
declare global {
|
|
4
|
+
namespace Express {
|
|
5
|
+
interface Request {
|
|
6
|
+
requestId: Schema.CorrelationIdType;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export declare class RequestId {
|
|
11
|
+
static CONTINUE_HEADER: string;
|
|
12
|
+
static applyTo(app: express.Application): void;
|
|
13
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as Schema from "./schema";
|
|
2
|
+
import { ETag, WeakETag } from "./etag";
|
|
3
|
+
export declare class Revision {
|
|
4
|
+
readonly value: Schema.RevisionType;
|
|
5
|
+
static initial: Schema.RevisionType;
|
|
6
|
+
constructor(value: unknown);
|
|
7
|
+
matches(another: Schema.RevisionType): boolean;
|
|
8
|
+
validate(another: Schema.RevisionType): void;
|
|
9
|
+
next(): Revision;
|
|
10
|
+
static fromETag(etag: ETag | null): Revision;
|
|
11
|
+
static fromWeakETag(weakEtag: WeakETag | null): Revision;
|
|
12
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare abstract class RoundingStrategy {
|
|
2
|
+
abstract round(value: number): number;
|
|
3
|
+
}
|
|
4
|
+
export declare class RoundToNearest extends RoundingStrategy {
|
|
5
|
+
round(value: number): number;
|
|
6
|
+
}
|
|
7
|
+
export declare class RoundUp extends RoundingStrategy {
|
|
8
|
+
round(value: number): number;
|
|
9
|
+
}
|
|
10
|
+
export declare class RoundDown extends RoundingStrategy {
|
|
11
|
+
round(value: number): number;
|
|
12
|
+
}
|
|
13
|
+
export declare class RoundToDecimal extends RoundingStrategy {
|
|
14
|
+
private readonly decimals;
|
|
15
|
+
constructor(decimals: number);
|
|
16
|
+
round(value: number): number;
|
|
17
|
+
}
|
package/dist/schema.d.ts
ADDED
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/** @public */
|
|
3
|
+
export declare enum NodeEnvironmentEnum {
|
|
4
|
+
local = "local",
|
|
5
|
+
test = "test",
|
|
6
|
+
staging = "staging",
|
|
7
|
+
production = "production"
|
|
8
|
+
}
|
|
9
|
+
export declare const NodeEnvironment: z.ZodNativeEnum<typeof NodeEnvironmentEnum>;
|
|
10
|
+
export declare const Port: z.ZodNumber;
|
|
11
|
+
export type PortType = z.infer<typeof Port>;
|
|
12
|
+
export declare const HCaptchaSecretKey: z.ZodString;
|
|
13
|
+
export declare const HCaptchaSiteKey: z.ZodString;
|
|
14
|
+
export declare const HCaptchaResponseToken: z.ZodString;
|
|
15
|
+
export declare const UUID: z.ZodDefault<z.ZodString>;
|
|
16
|
+
export type UUIDType = z.infer<typeof UUID>;
|
|
17
|
+
export declare const SmtpHost: z.ZodString;
|
|
18
|
+
export type SmtpHostType = z.infer<typeof SmtpHost>;
|
|
19
|
+
export declare const SmtpPort: z.ZodNumber;
|
|
20
|
+
export type SmtpPortType = z.infer<typeof SmtpPort>;
|
|
21
|
+
export declare const SmtpUser: z.ZodString;
|
|
22
|
+
export type SmtpUserType = z.infer<typeof SmtpUser>;
|
|
23
|
+
export declare const SmtpPass: z.ZodString;
|
|
24
|
+
export type SmtpPassType = z.infer<typeof SmtpPass>;
|
|
25
|
+
export declare const Email: z.ZodString;
|
|
26
|
+
export type EmailType = z.infer<typeof Email>;
|
|
27
|
+
export declare const CookieSecret: z.ZodString;
|
|
28
|
+
export type CookieSecretType = z.infer<typeof CookieSecret>;
|
|
29
|
+
export declare const ContentfulSpaceId: z.ZodString;
|
|
30
|
+
export type ContentfulSpaceIdType = z.infer<typeof ContentfulSpaceId>;
|
|
31
|
+
export declare const ContentfulAccessToken: z.ZodString;
|
|
32
|
+
export type ContentfulAccessTokenType = z.infer<typeof ContentfulAccessToken>;
|
|
33
|
+
export declare const UrlWithoutTrailingSlash: z.ZodEffects<z.ZodString, string, string>;
|
|
34
|
+
export type UrlWithoutTrailingSlashType = z.infer<typeof UrlWithoutTrailingSlash>;
|
|
35
|
+
export declare const TwitterApiBearerToken: z.ZodString;
|
|
36
|
+
export type TwitterApiBearerTokenType = z.infer<typeof TwitterApiBearerToken>;
|
|
37
|
+
export declare const ApiKey: z.ZodString;
|
|
38
|
+
export type ApiKeyType = z.infer<typeof ApiKey>;
|
|
39
|
+
export declare const TwitterAppKey: z.ZodString;
|
|
40
|
+
export type TwitterAppKeyType = z.infer<typeof TwitterAppKey>;
|
|
41
|
+
export declare const TwitterAppSecret: z.ZodString;
|
|
42
|
+
export type TwitterAppSecretType = z.infer<typeof TwitterAppSecret>;
|
|
43
|
+
export declare const TwitterAccessToken: z.ZodString;
|
|
44
|
+
export type TwitterAccessTokenType = z.infer<typeof TwitterAccessToken>;
|
|
45
|
+
export declare const TwitterAccessSecret: z.ZodString;
|
|
46
|
+
export type TwitterAccessSecretType = z.infer<typeof TwitterAccessSecret>;
|
|
47
|
+
export declare const RecaptchaSiteKey: z.ZodString;
|
|
48
|
+
export type RecaptchaSiteKeyType = z.infer<typeof RecaptchaSiteKey>;
|
|
49
|
+
export declare const RecaptchaSecretKey: z.ZodString;
|
|
50
|
+
export type RecaptchaSecretKeyType = z.infer<typeof RecaptchaSecretKey>;
|
|
51
|
+
export declare enum FeatureFlagEnum {
|
|
52
|
+
yes = "yes",
|
|
53
|
+
no = "no"
|
|
54
|
+
}
|
|
55
|
+
export declare const FeatureFlag: z.ZodNativeEnum<typeof FeatureFlagEnum>;
|
|
56
|
+
export type FeatureFlagType = z.infer<typeof FeatureFlag>;
|
|
57
|
+
export declare const Localhost: z.ZodLiteral<"127.0.0.1">;
|
|
58
|
+
export type LocalhostType = z.infer<typeof Localhost>;
|
|
59
|
+
export declare const AdminUsername: z.ZodString;
|
|
60
|
+
export type AdminUsernameType = z.infer<typeof AdminUsername>;
|
|
61
|
+
export declare const AdminPassword: z.ZodString;
|
|
62
|
+
export type AdminPasswordType = z.infer<typeof AdminPassword>;
|
|
63
|
+
export declare const Path: z.ZodBranded<z.ZodString, "path">;
|
|
64
|
+
export type PathType = z.infer<typeof Path>;
|
|
65
|
+
export declare const Timestamp: z.ZodDefault<z.ZodNumber>;
|
|
66
|
+
export type TimestampType = z.infer<typeof Timestamp>;
|
|
67
|
+
export declare const SizeInBytes: z.ZodBranded<z.ZodNumber, "size-in-bytes">;
|
|
68
|
+
export type SizeInBytesType = z.infer<typeof SizeInBytes>;
|
|
69
|
+
export declare const UploadedFile: z.ZodObject<{
|
|
70
|
+
fieldName: z.ZodString;
|
|
71
|
+
originalFilename: z.ZodString;
|
|
72
|
+
path: z.ZodBranded<z.ZodString, "path">;
|
|
73
|
+
headers: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
74
|
+
size: z.ZodBranded<z.ZodNumber, "size-in-bytes">;
|
|
75
|
+
}, "strip", z.ZodTypeAny, {
|
|
76
|
+
path: string & z.BRAND<"path">;
|
|
77
|
+
fieldName: string;
|
|
78
|
+
originalFilename: string;
|
|
79
|
+
headers: Record<string, string>;
|
|
80
|
+
size: number & z.BRAND<"size-in-bytes">;
|
|
81
|
+
}, {
|
|
82
|
+
path: string;
|
|
83
|
+
fieldName: string;
|
|
84
|
+
originalFilename: string;
|
|
85
|
+
headers: Record<string, string>;
|
|
86
|
+
size: number;
|
|
87
|
+
}>;
|
|
88
|
+
export type UploadedFileType = z.infer<typeof UploadedFile>;
|
|
89
|
+
export declare const TimeZoneOffsetHeaderValue: z.ZodEffects<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodUndefined]>, number, string | undefined>, number, string | undefined>;
|
|
90
|
+
export type TimeZoneOffsetType = z.infer<typeof TimeZoneOffsetHeaderValue>;
|
|
91
|
+
export declare const TimeZoneOffsetValue: z.ZodNumber;
|
|
92
|
+
export type TimeZoneOffsetValueType = z.infer<typeof TimeZoneOffsetValue>;
|
|
93
|
+
export declare const Language: z.ZodDefault<z.ZodString>;
|
|
94
|
+
export type LanguageType = z.infer<typeof Language>;
|
|
95
|
+
export declare const Width: z.ZodBranded<z.ZodNumber, "width">;
|
|
96
|
+
export type WidthType = z.infer<typeof Width>;
|
|
97
|
+
export declare const Height: z.ZodBranded<z.ZodNumber, "height">;
|
|
98
|
+
export type HeightType = z.infer<typeof Height>;
|
|
99
|
+
export declare const ImageCompressionQuality: z.ZodBranded<z.ZodDefault<z.ZodNumber>, "image-compression-quality">;
|
|
100
|
+
export type ImageCompressionQualityType = z.infer<typeof ImageCompressionQuality>;
|
|
101
|
+
export declare const OpenGraphTitleValue: z.ZodString;
|
|
102
|
+
export type OpenGraphTitleValueType = z.infer<typeof OpenGraphTitleValue>;
|
|
103
|
+
export declare const OpenGraphDescriptionValue: z.ZodString;
|
|
104
|
+
export type OpenGraphDescriptionValueType = z.infer<typeof OpenGraphDescriptionValue>;
|
|
105
|
+
export declare const OpenGraphUrlValue: z.ZodString;
|
|
106
|
+
export type OpenGraphUrlValueType = z.infer<typeof OpenGraphUrlValue>;
|
|
107
|
+
export declare const OpenGraphTypeValue: z.ZodUnion<[z.ZodLiteral<"website">, z.ZodLiteral<"article">]>;
|
|
108
|
+
export type OpenGraphTypeValueType = z.infer<typeof OpenGraphTypeValue>;
|
|
109
|
+
export declare const OpenGraphImageUrlValue: z.ZodString;
|
|
110
|
+
export type OpenGraphImageUrlValueType = z.infer<typeof OpenGraphImageUrlValue>;
|
|
111
|
+
export declare const OpenGraphImageTypeValue: z.ZodString;
|
|
112
|
+
export type OpenGraphImageTypeValueType = z.infer<typeof OpenGraphImageTypeValue>;
|
|
113
|
+
export declare const OpenGraphImageWidthValue: z.ZodEffects<z.ZodBranded<z.ZodNumber, "width">, number & z.BRAND<"width">, number>;
|
|
114
|
+
export type OpenGraphImageWidthValueType = z.infer<typeof OpenGraphImageWidthValue>;
|
|
115
|
+
export declare const OpenGraphImageHeightValue: z.ZodEffects<z.ZodBranded<z.ZodNumber, "height">, number & z.BRAND<"height">, number>;
|
|
116
|
+
export type OpenGraphImageHeightValueType = z.infer<typeof OpenGraphImageHeightValue>;
|
|
117
|
+
export declare const CorrelationId: z.ZodBranded<z.ZodDefault<z.ZodString>, "correlation-id">;
|
|
118
|
+
export type CorrelationIdType = z.infer<typeof CorrelationId>;
|
|
119
|
+
export declare enum LogLevelEnum {
|
|
120
|
+
/** @public */
|
|
121
|
+
silent = "silent",
|
|
122
|
+
error = "error",
|
|
123
|
+
warn = "warn",
|
|
124
|
+
info = "info",
|
|
125
|
+
http = "http",
|
|
126
|
+
verbose = "verbose"
|
|
127
|
+
}
|
|
128
|
+
export declare const LogLevel: z.ZodNativeEnum<typeof LogLevelEnum>;
|
|
129
|
+
export declare const AuthorizationHeader: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, {
|
|
130
|
+
username: string;
|
|
131
|
+
password: string;
|
|
132
|
+
}, string>;
|
|
133
|
+
export type AuthorizationHeaderType = z.infer<typeof AuthorizationHeader>;
|
|
134
|
+
export declare const BasicAuthUsername: z.ZodBranded<z.ZodString, "basic-auth-username">;
|
|
135
|
+
export type BasicAuthUsernameType = z.infer<typeof BasicAuthUsername>;
|
|
136
|
+
export declare const BasicAuthPassword: z.ZodBranded<z.ZodString, "basic-auth-password">;
|
|
137
|
+
export type BasicAuthPasswordType = z.infer<typeof BasicAuthPassword>;
|
|
138
|
+
export declare const EmailSubject: z.ZodBranded<z.ZodString, "email-subject">;
|
|
139
|
+
export type EmailSubjectType = z.infer<typeof EmailSubject>;
|
|
140
|
+
export declare const EmailContentHtml: z.ZodBranded<z.ZodString, "email-content-html">;
|
|
141
|
+
export type EmailContentHtmlType = z.infer<typeof EmailContentHtml>;
|
|
142
|
+
export declare const EmailTo: z.ZodBranded<z.ZodString, "email-to">;
|
|
143
|
+
export type EmailToType = z.infer<typeof EmailTo>;
|
|
144
|
+
export declare const EmailAttachment: z.ZodBranded<z.ZodObject<{
|
|
145
|
+
filename: z.ZodBranded<z.ZodString, "path">;
|
|
146
|
+
path: z.ZodBranded<z.ZodString, "path">;
|
|
147
|
+
}, "strip", z.ZodTypeAny, {
|
|
148
|
+
path: string & z.BRAND<"path">;
|
|
149
|
+
filename: string & z.BRAND<"path">;
|
|
150
|
+
}, {
|
|
151
|
+
path: string;
|
|
152
|
+
filename: string;
|
|
153
|
+
}>, "email-attachment">;
|
|
154
|
+
export type EmailAttachmentType = z.infer<typeof EmailAttachment>;
|
|
155
|
+
export declare const hours: number[];
|
|
156
|
+
export declare const Hour: z.ZodEffects<z.ZodNumber, number, number>;
|
|
157
|
+
export type HourType = z.infer<typeof Hour>;
|
|
158
|
+
export declare const Timezone: z.ZodEffects<z.ZodString, string, string>;
|
|
159
|
+
export type TimezoneType = z.infer<typeof Timezone>;
|
|
160
|
+
export declare const TimezoneUTC: z.ZodLiteral<"UTC">;
|
|
161
|
+
export type TimezoneUTCType = z.infer<typeof TimezoneUTC>;
|
|
162
|
+
export declare const BuildVersion: z.ZodBranded<z.ZodString, "build-version">;
|
|
163
|
+
export type BuildVersionType = z.infer<typeof BuildVersion>;
|
|
164
|
+
export declare const EncryptionIV: z.ZodEffects<z.ZodString, Buffer, string>;
|
|
165
|
+
export type EncryptionIVType = z.infer<typeof EncryptionIV>;
|
|
166
|
+
export declare const EncryptionSecret: z.ZodString;
|
|
167
|
+
export type EncryptionSecretType = z.infer<typeof EncryptionSecret>;
|
|
168
|
+
export declare const ReorderingItemPositionValue: z.ZodNumber;
|
|
169
|
+
export type ReorderingItemPositionValueType = z.infer<typeof ReorderingItemPositionValue>;
|
|
170
|
+
export declare const ReorderingCorrelationId: z.ZodString;
|
|
171
|
+
export type ReorderingCorrelationIdType = z.infer<typeof ReorderingCorrelationId>;
|
|
172
|
+
export declare const ReorderingItemId: z.ZodDefault<z.ZodString>;
|
|
173
|
+
export type ReorderingItemIdType = z.infer<typeof ReorderingItemId>;
|
|
174
|
+
export declare const Reordering: z.ZodObject<{
|
|
175
|
+
correlationId: z.ZodString;
|
|
176
|
+
id: z.ZodDefault<z.ZodString>;
|
|
177
|
+
position: z.ZodNumber;
|
|
178
|
+
}, "strip", z.ZodTypeAny, {
|
|
179
|
+
correlationId: string;
|
|
180
|
+
id: string;
|
|
181
|
+
position: number;
|
|
182
|
+
}, {
|
|
183
|
+
correlationId: string;
|
|
184
|
+
position: number;
|
|
185
|
+
id?: string | undefined;
|
|
186
|
+
}>;
|
|
187
|
+
export type ReorderingType = z.infer<typeof Reordering>;
|
|
188
|
+
export declare const Revision: z.ZodNumber;
|
|
189
|
+
export type RevisionType = z.infer<typeof Revision>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import express from "express";
|
|
2
|
+
export declare class ServerTiming {
|
|
3
|
+
static HEADER: string;
|
|
4
|
+
static MS_HEADER: string;
|
|
5
|
+
static applyTo(app: express.Application): void;
|
|
6
|
+
static handle(_request: express.Request, response: express.Response, next: express.NextFunction): Promise<void>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { RoundingStrategy } from "./rounding";
|
|
2
|
+
export type SLRPairType = {
|
|
3
|
+
x: number;
|
|
4
|
+
y: number;
|
|
5
|
+
};
|
|
6
|
+
export type SLRParamsType = {
|
|
7
|
+
a: number;
|
|
8
|
+
b: number;
|
|
9
|
+
};
|
|
10
|
+
export type SLRPredictionType = number;
|
|
11
|
+
export declare class SimpleLinearRegression {
|
|
12
|
+
private readonly params;
|
|
13
|
+
private readonly rounding;
|
|
14
|
+
constructor(params: SLRParamsType, rounding?: RoundingStrategy);
|
|
15
|
+
static fromPairs(pairs: SLRPairType[], rounding?: RoundingStrategy): SimpleLinearRegression;
|
|
16
|
+
predict(x: SLRPairType["x"], strategy?: RoundingStrategy): SLRPredictionType;
|
|
17
|
+
inspect(): SimpleLinearRegression["params"];
|
|
18
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import * as Schema from "./schema";
|
|
3
|
+
export declare const SitemapLoc: z.ZodBranded<z.ZodString, "sitemap-loc">;
|
|
4
|
+
export type SitemapLocType = z.infer<typeof SitemapLoc>;
|
|
5
|
+
export declare const SitemapLastmod: z.ZodBranded<z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>, "sitemap-lastmod">;
|
|
6
|
+
export type SitemapLastmodType = z.infer<typeof SitemapLastmod>;
|
|
7
|
+
export declare const SitemapChangefreq: z.ZodBranded<z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"always">, z.ZodLiteral<"hourly">, z.ZodLiteral<"daily">, z.ZodLiteral<"weekly">, z.ZodLiteral<"monthly">, z.ZodLiteral<"yearly">, z.ZodLiteral<"never">]>>, "sitemap-changefreq">;
|
|
8
|
+
export type SitemapChangefreqType = z.infer<typeof SitemapChangefreq>;
|
|
9
|
+
export declare const SitemapPriority: z.ZodBranded<z.ZodDefault<z.ZodNumber>, "sitemap-priority">;
|
|
10
|
+
export type SitemapPriorityType = z.infer<typeof SitemapPriority>;
|
|
11
|
+
export declare const SitemapEntry: z.ZodBranded<z.ZodObject<{
|
|
12
|
+
loc: z.ZodBranded<z.ZodString, "sitemap-loc">;
|
|
13
|
+
lastmod: z.ZodBranded<z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>, "sitemap-lastmod">;
|
|
14
|
+
changefreq: z.ZodBranded<z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"always">, z.ZodLiteral<"hourly">, z.ZodLiteral<"daily">, z.ZodLiteral<"weekly">, z.ZodLiteral<"monthly">, z.ZodLiteral<"yearly">, z.ZodLiteral<"never">]>>, "sitemap-changefreq">;
|
|
15
|
+
priority: z.ZodBranded<z.ZodDefault<z.ZodNumber>, "sitemap-priority">;
|
|
16
|
+
}, "strip", z.ZodTypeAny, {
|
|
17
|
+
loc: string & z.BRAND<"sitemap-loc">;
|
|
18
|
+
lastmod: string & z.BRAND<"sitemap-lastmod">;
|
|
19
|
+
changefreq: ("never" & z.BRAND<"sitemap-changefreq">) | ("always" & z.BRAND<"sitemap-changefreq">) | ("hourly" & z.BRAND<"sitemap-changefreq">) | ("daily" & z.BRAND<"sitemap-changefreq">) | ("weekly" & z.BRAND<"sitemap-changefreq">) | ("monthly" & z.BRAND<"sitemap-changefreq">) | ("yearly" & z.BRAND<"sitemap-changefreq">);
|
|
20
|
+
priority: number & z.BRAND<"sitemap-priority">;
|
|
21
|
+
}, {
|
|
22
|
+
loc: string;
|
|
23
|
+
lastmod?: string | undefined;
|
|
24
|
+
changefreq?: "never" | "always" | "hourly" | "daily" | "weekly" | "monthly" | "yearly" | undefined;
|
|
25
|
+
priority?: number | undefined;
|
|
26
|
+
}>, "sitemap-entry">;
|
|
27
|
+
export type SitemapEntryType = z.infer<typeof SitemapEntry>;
|
|
28
|
+
export type SitemapConfigType = {
|
|
29
|
+
path?: Schema.PathType;
|
|
30
|
+
entries: SitemapEntryType[];
|
|
31
|
+
BASE_URL: Schema.UrlWithoutTrailingSlashType;
|
|
32
|
+
};
|
|
33
|
+
export declare class Sitemap {
|
|
34
|
+
static DEFAULT_PATH: string & z.BRAND<"path">;
|
|
35
|
+
private static generate;
|
|
36
|
+
static save(config: SitemapConfigType): Promise<void>;
|
|
37
|
+
}
|
package/dist/size.d.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import * as Schema from "./schema";
|
|
3
|
+
export declare enum SizeUnit {
|
|
4
|
+
b = "b",
|
|
5
|
+
kB = "kB",
|
|
6
|
+
MB = "MB",
|
|
7
|
+
GB = "GB"
|
|
8
|
+
}
|
|
9
|
+
declare const SizeValue: z.ZodNumber;
|
|
10
|
+
export type SizeValueType = z.infer<typeof SizeValue>;
|
|
11
|
+
export type SizeConfigType = {
|
|
12
|
+
unit: SizeUnit;
|
|
13
|
+
value: SizeValueType;
|
|
14
|
+
};
|
|
15
|
+
export declare class Size {
|
|
16
|
+
private readonly unit;
|
|
17
|
+
private readonly value;
|
|
18
|
+
private readonly bytes;
|
|
19
|
+
private static readonly KB_MULTIPLIER;
|
|
20
|
+
private static readonly MB_MULTIPLIER;
|
|
21
|
+
private static readonly GB_MULTIPLIER;
|
|
22
|
+
constructor(config: SizeConfigType);
|
|
23
|
+
toString(): string;
|
|
24
|
+
toBytes(): Schema.SizeInBytesType;
|
|
25
|
+
isGreaterThan(another: Size): boolean;
|
|
26
|
+
format(unit: SizeUnit): string;
|
|
27
|
+
static toBytes(config: SizeConfigType): Schema.SizeInBytesType;
|
|
28
|
+
static unit: typeof SizeUnit;
|
|
29
|
+
private calculateBytes;
|
|
30
|
+
}
|
|
31
|
+
export {};
|
package/dist/sleep.d.ts
ADDED
package/dist/slower.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import express from "express";
|
|
2
|
+
type SlowerConfigType = {
|
|
3
|
+
ms?: number;
|
|
4
|
+
};
|
|
5
|
+
export declare class Slower {
|
|
6
|
+
static build(config?: SlowerConfigType): (_request: express.Request, _response: express.Response, next: express.NextFunction) => Promise<void>;
|
|
7
|
+
}
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import express from "express";
|
|
2
|
+
import expressStaticGzip from "express-static-gzip";
|
|
3
|
+
import * as Schema from "./schema";
|
|
4
|
+
type StaticGzipOptionsType = expressStaticGzip.ExpressStaticGzipOptions;
|
|
5
|
+
export type StaticFilesConfigType = Partial<{
|
|
6
|
+
path: Schema.PathType;
|
|
7
|
+
} & StaticGzipOptionsType>;
|
|
8
|
+
export declare class StaticFiles {
|
|
9
|
+
private readonly path;
|
|
10
|
+
private readonly staticGzipOptions;
|
|
11
|
+
constructor(config?: StaticFilesConfigType);
|
|
12
|
+
applyTo(app: express.Application): void;
|
|
13
|
+
}
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
type StepType = number;
|
|
2
|
+
type StepperConfigType = {
|
|
3
|
+
total: StepType;
|
|
4
|
+
};
|
|
5
|
+
export declare class Stepper {
|
|
6
|
+
static readonly DEFAULT_CURRENT = 1;
|
|
7
|
+
private current;
|
|
8
|
+
private readonly total;
|
|
9
|
+
constructor(config: StepperConfigType);
|
|
10
|
+
continue(): Stepper;
|
|
11
|
+
read(): {
|
|
12
|
+
finished: boolean;
|
|
13
|
+
raw: {
|
|
14
|
+
current: number;
|
|
15
|
+
total: number;
|
|
16
|
+
};
|
|
17
|
+
formatted: string;
|
|
18
|
+
};
|
|
19
|
+
reset(): Stepper;
|
|
20
|
+
format(): string;
|
|
21
|
+
isFinished(): boolean;
|
|
22
|
+
}
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { TimestampType } from "./schema";
|
|
2
|
+
export declare enum StopwatchState {
|
|
3
|
+
started = "started",
|
|
4
|
+
stopped = "finished"
|
|
5
|
+
}
|
|
6
|
+
export type StopwatchResultType = {
|
|
7
|
+
durationMs: TimestampType;
|
|
8
|
+
};
|
|
9
|
+
export declare class Stopwatch {
|
|
10
|
+
private state;
|
|
11
|
+
private readonly startMs;
|
|
12
|
+
private stopMs;
|
|
13
|
+
stop(): StopwatchResultType;
|
|
14
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { format } from "date-fns";
|
|
2
|
+
type DateType = string;
|
|
3
|
+
export type StreakType = {
|
|
4
|
+
cutoff: DateType;
|
|
5
|
+
dates: DateType[];
|
|
6
|
+
streak: number;
|
|
7
|
+
};
|
|
8
|
+
export declare class StreakCalculator {
|
|
9
|
+
private readonly cutoff;
|
|
10
|
+
constructor();
|
|
11
|
+
calculate(_dates: DateType[]): StreakType;
|
|
12
|
+
static format(date: Parameters<typeof format>[0]): DateType;
|
|
13
|
+
}
|
|
14
|
+
export {};
|
package/dist/sum.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as bg from "@bgord/node";
|
|
2
|
+
export declare type TimeZoneOffsetVariables = {
|
|
3
|
+
timeZoneOffset: {
|
|
4
|
+
minutes: bg.Schema.TimeZoneOffsetValueType;
|
|
5
|
+
seconds: bg.Schema.TimeZoneOffsetValueType;
|
|
6
|
+
miliseconds: bg.Schema.TimeZoneOffsetValueType;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
export declare class TimeZoneOffset {
|
|
10
|
+
static TIME_ZONE_OFFSET_HEADER_NAME: string;
|
|
11
|
+
static attach: import("hono/types").MiddlewareHandler<{
|
|
12
|
+
Bindings: any;
|
|
13
|
+
Variables: any;
|
|
14
|
+
}, string, {}>;
|
|
15
|
+
static adjustTimestamp(timestamp: bg.Schema.TimestampType, timeZoneOffsetMs: bg.Schema.TimeZoneOffsetValueType): bg.Schema.TimestampType;
|
|
16
|
+
static adjustDate(timestamp: bg.Schema.TimestampType, timeZoneOffsetMs: bg.Schema.TimeZoneOffsetValueType): Date;
|
|
17
|
+
}
|