@cudenix/cudenix 0.0.1

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 (167) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +1 -0
  3. package/dist/app.d.ts +32 -0
  4. package/dist/app.d.ts.map +1 -0
  5. package/dist/app.js +331 -0
  6. package/dist/app.js.map +1 -0
  7. package/dist/context.d.ts +51 -0
  8. package/dist/context.d.ts.map +1 -0
  9. package/dist/context.js +123 -0
  10. package/dist/context.js.map +1 -0
  11. package/dist/ecosystem/client/client.d.ts +20 -0
  12. package/dist/ecosystem/client/client.d.ts.map +1 -0
  13. package/dist/ecosystem/client/client.js +129 -0
  14. package/dist/ecosystem/client/client.js.map +1 -0
  15. package/dist/ecosystem/client/index.d.ts +4 -0
  16. package/dist/ecosystem/client/index.d.ts.map +1 -0
  17. package/dist/ecosystem/client/index.js +4 -0
  18. package/dist/ecosystem/client/index.js.map +1 -0
  19. package/dist/ecosystem/client/sse.d.ts +9 -0
  20. package/dist/ecosystem/client/sse.d.ts.map +1 -0
  21. package/dist/ecosystem/client/sse.js +22 -0
  22. package/dist/ecosystem/client/sse.js.map +1 -0
  23. package/dist/ecosystem/client/ws.d.ts +10 -0
  24. package/dist/ecosystem/client/ws.d.ts.map +1 -0
  25. package/dist/ecosystem/client/ws.js +29 -0
  26. package/dist/ecosystem/client/ws.js.map +1 -0
  27. package/dist/ecosystem/cluster/cluster.d.ts +4 -0
  28. package/dist/ecosystem/cluster/cluster.d.ts.map +1 -0
  29. package/dist/ecosystem/cluster/cluster.js +32 -0
  30. package/dist/ecosystem/cluster/cluster.js.map +1 -0
  31. package/dist/ecosystem/cluster/index.d.ts +2 -0
  32. package/dist/ecosystem/cluster/index.d.ts.map +1 -0
  33. package/dist/ecosystem/cluster/index.js +2 -0
  34. package/dist/ecosystem/cluster/index.js.map +1 -0
  35. package/dist/ecosystem/events/events.d.ts +11 -0
  36. package/dist/ecosystem/events/events.d.ts.map +1 -0
  37. package/dist/ecosystem/events/events.js +10 -0
  38. package/dist/ecosystem/events/events.js.map +1 -0
  39. package/dist/ecosystem/events/index.d.ts +2 -0
  40. package/dist/ecosystem/events/index.d.ts.map +1 -0
  41. package/dist/ecosystem/events/index.js +2 -0
  42. package/dist/ecosystem/events/index.js.map +1 -0
  43. package/dist/ecosystem/i18n/i18n.d.ts +27 -0
  44. package/dist/ecosystem/i18n/i18n.d.ts.map +1 -0
  45. package/dist/ecosystem/i18n/i18n.js +90 -0
  46. package/dist/ecosystem/i18n/i18n.js.map +1 -0
  47. package/dist/ecosystem/i18n/index.d.ts +2 -0
  48. package/dist/ecosystem/i18n/index.d.ts.map +1 -0
  49. package/dist/ecosystem/i18n/index.js +2 -0
  50. package/dist/ecosystem/i18n/index.js.map +1 -0
  51. package/dist/error.d.ts +22 -0
  52. package/dist/error.d.ts.map +1 -0
  53. package/dist/error.js +7 -0
  54. package/dist/error.js.map +1 -0
  55. package/dist/group.d.ts +18 -0
  56. package/dist/group.d.ts.map +1 -0
  57. package/dist/group.js +8 -0
  58. package/dist/group.js.map +1 -0
  59. package/dist/index.d.ts +13 -0
  60. package/dist/index.d.ts.map +1 -0
  61. package/dist/index.js +12 -0
  62. package/dist/index.js.map +1 -0
  63. package/dist/middleware.d.ts +16 -0
  64. package/dist/middleware.d.ts.map +1 -0
  65. package/dist/middleware.js +6 -0
  66. package/dist/middleware.js.map +1 -0
  67. package/dist/module.d.ts +54 -0
  68. package/dist/module.d.ts.map +1 -0
  69. package/dist/module.js +37 -0
  70. package/dist/module.js.map +1 -0
  71. package/dist/route.d.ts +48 -0
  72. package/dist/route.d.ts.map +1 -0
  73. package/dist/route.js +14 -0
  74. package/dist/route.js.map +1 -0
  75. package/dist/storage.d.ts +5 -0
  76. package/dist/storage.d.ts.map +1 -0
  77. package/dist/storage.js +6 -0
  78. package/dist/storage.js.map +1 -0
  79. package/dist/store.d.ts +14 -0
  80. package/dist/store.d.ts.map +1 -0
  81. package/dist/store.js +6 -0
  82. package/dist/store.js.map +1 -0
  83. package/dist/success.d.ts +21 -0
  84. package/dist/success.d.ts.map +1 -0
  85. package/dist/success.js +7 -0
  86. package/dist/success.js.map +1 -0
  87. package/dist/types/conditionally-omit.d.ts +7 -0
  88. package/dist/types/conditionally-omit.d.ts.map +1 -0
  89. package/dist/types/conditionally-omit.js +2 -0
  90. package/dist/types/conditionally-omit.js.map +1 -0
  91. package/dist/types/conditionally-optional.d.ts +6 -0
  92. package/dist/types/conditionally-optional.d.ts.map +1 -0
  93. package/dist/types/conditionally-optional.js +2 -0
  94. package/dist/types/conditionally-optional.js.map +1 -0
  95. package/dist/types/extends-type.d.ts +4 -0
  96. package/dist/types/extends-type.d.ts.map +1 -0
  97. package/dist/types/extends-type.js +2 -0
  98. package/dist/types/extends-type.js.map +1 -0
  99. package/dist/types/extract-content.d.ts +2 -0
  100. package/dist/types/extract-content.d.ts.map +1 -0
  101. package/dist/types/extract-content.js +2 -0
  102. package/dist/types/extract-content.js.map +1 -0
  103. package/dist/types/extract-url-params.d.ts +7 -0
  104. package/dist/types/extract-url-params.d.ts.map +1 -0
  105. package/dist/types/extract-url-params.js +2 -0
  106. package/dist/types/extract-url-params.js.map +1 -0
  107. package/dist/types/generator-sse.d.ts +9 -0
  108. package/dist/types/generator-sse.d.ts.map +1 -0
  109. package/dist/types/generator-sse.js +2 -0
  110. package/dist/types/generator-sse.js.map +1 -0
  111. package/dist/types/http-method.d.ts +2 -0
  112. package/dist/types/http-method.d.ts.map +1 -0
  113. package/dist/types/http-method.js +2 -0
  114. package/dist/types/http-method.js.map +1 -0
  115. package/dist/types/index.d.ts +14 -0
  116. package/dist/types/index.d.ts.map +1 -0
  117. package/dist/types/index.js +2 -0
  118. package/dist/types/index.js.map +1 -0
  119. package/dist/types/maybe-promise.d.ts +2 -0
  120. package/dist/types/maybe-promise.d.ts.map +1 -0
  121. package/dist/types/maybe-promise.js +2 -0
  122. package/dist/types/maybe-promise.js.map +1 -0
  123. package/dist/types/merge-paths.d.ts +4 -0
  124. package/dist/types/merge-paths.d.ts.map +1 -0
  125. package/dist/types/merge-paths.js +2 -0
  126. package/dist/types/merge-paths.js.map +1 -0
  127. package/dist/types/merge.d.ts +2 -0
  128. package/dist/types/merge.d.ts.map +1 -0
  129. package/dist/types/merge.js +2 -0
  130. package/dist/types/merge.js.map +1 -0
  131. package/dist/types/required-keys.d.ts +4 -0
  132. package/dist/types/required-keys.d.ts.map +1 -0
  133. package/dist/types/required-keys.js +2 -0
  134. package/dist/types/required-keys.js.map +1 -0
  135. package/dist/types/value-of.d.ts +2 -0
  136. package/dist/types/value-of.d.ts.map +1 -0
  137. package/dist/types/value-of.js +2 -0
  138. package/dist/types/value-of.js.map +1 -0
  139. package/dist/types/ws.d.ts +2 -0
  140. package/dist/types/ws.d.ts.map +1 -0
  141. package/dist/types/ws.js +2 -0
  142. package/dist/types/ws.js.map +1 -0
  143. package/dist/utils/empty.d.ts +2 -0
  144. package/dist/utils/empty.d.ts.map +1 -0
  145. package/dist/utils/empty.js +4 -0
  146. package/dist/utils/empty.js.map +1 -0
  147. package/dist/utils/file.d.ts +2 -0
  148. package/dist/utils/file.d.ts.map +1 -0
  149. package/dist/utils/file.js +4 -0
  150. package/dist/utils/file.js.map +1 -0
  151. package/dist/utils/get-cookies.d.ts +2 -0
  152. package/dist/utils/get-cookies.d.ts.map +1 -0
  153. package/dist/utils/get-cookies.js +15 -0
  154. package/dist/utils/get-cookies.js.map +1 -0
  155. package/dist/utils/merge.d.ts +2 -0
  156. package/dist/utils/merge.d.ts.map +1 -0
  157. package/dist/utils/merge.js +8 -0
  158. package/dist/utils/merge.js.map +1 -0
  159. package/dist/utils/regexp.d.ts +11 -0
  160. package/dist/utils/regexp.d.ts.map +1 -0
  161. package/dist/utils/regexp.js +41 -0
  162. package/dist/utils/regexp.js.map +1 -0
  163. package/dist/validator.d.ts +57 -0
  164. package/dist/validator.d.ts.map +1 -0
  165. package/dist/validator.js +11 -0
  166. package/dist/validator.js.map +1 -0
  167. package/package.json +75 -0
package/dist/index.js ADDED
@@ -0,0 +1,12 @@
1
+ export * from "./app";
2
+ export * from "./context";
3
+ export * from "./error";
4
+ export * from "./group";
5
+ export * from "./middleware";
6
+ export * from "./module";
7
+ export * from "./route";
8
+ export * from "./storage";
9
+ export * from "./store";
10
+ export * from "./success";
11
+ export * from "./validator";
12
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC;AACtB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAE1B,cAAc,aAAa,CAAC"}
@@ -0,0 +1,16 @@
1
+ import type { DeveloperContext } from "./context";
2
+ import type { AnyError } from "./error";
3
+ import type { AnySuccess } from "./success";
4
+ import type { MaybePromise } from "./types";
5
+ export type MiddlewareFn<Return extends MaybePromise<AnyError | AnySuccess | void>, Stores extends Record<PropertyKey, unknown>, Validators extends Record<PropertyKey, unknown>> = (context: DeveloperContext<Stores, Validators>, next: () => Promise<void>) => Return;
6
+ export type AnyMiddlewareFn = MiddlewareFn<any, any, any>;
7
+ export interface Middleware<Return extends MaybePromise<AnyError | AnySuccess | void>, Stores extends Record<PropertyKey, unknown>, Validators extends Record<PropertyKey, unknown>> {
8
+ middleware: MiddlewareFn<Return, Stores, Validators>;
9
+ type: "MIDDLEWARE";
10
+ }
11
+ export type AnyMiddleware = Middleware<any, any, any>;
12
+ type Constructor = new (middleware: AnyMiddlewareFn) => AnyMiddleware;
13
+ export declare const Middleware: Constructor;
14
+ export declare const middleware: <const Return extends MaybePromise<AnyError | AnySuccess | void>, const Stores extends Record<PropertyKey, unknown>, const Validators extends Record<PropertyKey, unknown>>(middleware: MiddlewareFn<Return, Stores, Validators>) => Middleware<Return, Stores, Validators>;
15
+ export {};
16
+ //# sourceMappingURL=middleware.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"middleware.d.ts","sourceRoot":"","sources":["../src/middleware.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAClD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,MAAM,MAAM,YAAY,CACvB,MAAM,SAAS,YAAY,CAAC,QAAQ,GAAG,UAAU,GAAG,IAAI,CAAC,EACzD,MAAM,SAAS,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,EAC3C,UAAU,SAAS,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,IAC5C,CACH,OAAO,EAAE,gBAAgB,CAAC,MAAM,EAAE,UAAU,CAAC,EAC7C,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,KACrB,MAAM,CAAC;AAEZ,MAAM,MAAM,eAAe,GAAG,YAAY,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;AAE1D,MAAM,WAAW,UAAU,CAC1B,MAAM,SAAS,YAAY,CAAC,QAAQ,GAAG,UAAU,GAAG,IAAI,CAAC,EACzD,MAAM,SAAS,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,EAC3C,UAAU,SAAS,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC;IAE/C,UAAU,EAAE,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC;IACrD,IAAI,EAAE,YAAY,CAAC;CACnB;AAED,MAAM,MAAM,aAAa,GAAG,UAAU,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;AAEtD,KAAK,WAAW,GAAG,KAAK,UAAU,EAAE,eAAe,KAAK,aAAa,CAAC;AAEtE,eAAO,MAAM,UAAU,EAMP,WAAW,CAAC;AAE5B,eAAO,MAAM,UAAU,SAChB,MAAM,SAAS,YAAY,CAAC,QAAQ,GAAG,UAAU,GAAG,IAAI,CAAC,QACzD,MAAM,SAAS,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,QAC3C,UAAU,SAAS,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,cAEzC,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,CAAC,KAClB,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC"}
@@ -0,0 +1,6 @@
1
+ export const Middleware = function (middleware) {
2
+ this.middleware = middleware;
3
+ this.type = "MIDDLEWARE";
4
+ };
5
+ export const middleware = (middleware) => new Middleware(middleware);
6
+ //# sourceMappingURL=middleware.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"middleware.js","sourceRoot":"","sources":["../src/middleware.ts"],"names":[],"mappings":"AA6BA,MAAM,CAAC,MAAM,UAAU,GAAG,UAEzB,UAA2B;IAE3B,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC7B,IAAI,CAAC,IAAI,GAAG,YAAY,CAAC;AAC1B,CAA2B,CAAC;AAE5B,MAAM,CAAC,MAAM,UAAU,GAAG,CAKzB,UAAoD,EACnD,EAAE,CAAC,IAAI,UAAU,CAAC,UAAU,CAA2C,CAAC"}
@@ -0,0 +1,54 @@
1
+ import type { DeveloperContext } from "./context";
2
+ import type { AnyError, FilterError, IgnoreError, MergeErrors, TransformError } from "./error";
3
+ import { type AnyGroup, type GroupFn, type GroupOptions } from "./group";
4
+ import { type AnyMiddleware, type MiddlewareFn } from "./middleware";
5
+ import { type AnyRoute, type ParseRoute, type PathToObject, type RouteFn, type RouteFnReturnGenerator, type RouteFnReturnWS, type RouteOptions } from "./route";
6
+ import { type AnyStore, type StoreFn } from "./store";
7
+ import type { AnySuccess, FilterSuccess, MergeSuccesses, TransformSuccess } from "./success";
8
+ import type { ConditionallyOmit, ExtendsType, ExtractUrlParams, HttpMethod, MaybePromise, MergePaths, RequiredKeys, ValueOf } from "./types";
9
+ import { type AnyValidator, type DeepInferValidatorError, type DeepInferValidatorInput, type DeepInferValidatorOutput, type MergeInferValidatorRequest, type TransformValidatorError, type ValidatorOptions, type ValidatorRequest } from "./validator";
10
+ export type ModuleChain = (AnyGroup | AnyMiddleware | AnyModule | AnyRoute | AnyStore | AnyValidator)[];
11
+ export interface Module<Errors extends Record<PropertyKey, unknown>, Prefix extends `/${string}`, Routes extends Record<PropertyKey, unknown>, Stores extends Record<PropertyKey, unknown>, Successes extends Record<PropertyKey, unknown>, Validators extends {
12
+ inputs: Record<PropertyKey, unknown>;
13
+ outputs: Record<PropertyKey, unknown>;
14
+ }> {
15
+ chain: ModuleChain;
16
+ extends<const ModuleErrors extends Record<PropertyKey, unknown>, const ModulePrefix extends `/${string}`, const ModuleRoutes extends Record<PropertyKey, unknown>, const ModuleStores extends Record<PropertyKey, unknown>, const ModuleSuccesses extends Record<PropertyKey, unknown>, const ModuleValidators extends {
17
+ inputs: Record<PropertyKey, unknown>;
18
+ outputs: Record<PropertyKey, unknown>;
19
+ }>(module: Module<ModuleErrors, ModulePrefix, ModuleRoutes, ModuleStores, ModuleSuccesses, ModuleValidators>): Module<MergeErrors<Errors, ModuleErrors>, MergePaths<Prefix, ModulePrefix>, Routes & (Prefix extends "/" ? ModuleRoutes : Prefix extends `/${infer Rest}` ? PathToObject<Rest, ModuleRoutes> : ModuleRoutes), Stores & ModuleStores, MergeSuccesses<Successes, ModuleSuccesses>, {
20
+ inputs: MergeInferValidatorRequest<Validators["inputs"], ModuleValidators["inputs"]>;
21
+ outputs: MergeInferValidatorRequest<Validators["outputs"], ModuleValidators["outputs"]>;
22
+ }>;
23
+ group<const GroupReturn extends AnyModule, const GroupPrefix extends `/${string}` = "/">(group: GroupFn<Module<Errors, MergePaths<Prefix, GroupPrefix>, NonNullable<unknown>, Stores, Successes, Validators>, GroupReturn>, options?: GroupOptions<GroupPrefix>): Module<Errors, Prefix, Routes & GroupReturn["routes"], Stores, Successes, Validators>;
24
+ middleware<const MiddlewareReturn extends MaybePromise<AnyError | AnySuccess | void> = void>(middleware: MiddlewareFn<MiddlewareReturn, Stores, Validators["outputs"]>): Module<MergeErrors<Errors, TransformError<FilterError<MiddlewareReturn>>>, Prefix, Routes, Stores, MergeSuccesses<Successes, TransformSuccess<FilterSuccess<MiddlewareReturn>>>, Validators>;
25
+ prefix: string;
26
+ route<const RouteMethod extends HttpMethod, const RoutePath extends `/${string}`, const RouteReturn extends RouteMethod extends "WS" ? RouteFnReturnWS<Omit<DeveloperContext<Stores, ExtendsType<ExtractUrlParams<RoutePath>, NonNullable<unknown>, MergeInferValidatorRequest<Validators["outputs"], DeepInferValidatorOutput<RouteValidatorOptions["request"]>>, MergeInferValidatorRequest<Validators["outputs"], DeepInferValidatorOutput<RouteValidatorOptions["request"]>> & ConditionallyOmit<{
27
+ params: ExtractUrlParams<RoutePath>;
28
+ }, NonNullable<unknown>>>>, "response">> : MaybePromise<AnyError | AnySuccess> | RouteFnReturnGenerator, const RouteValidatorOptions extends ValidatorOptions<Partial<ValidatorRequest>>>(method: RouteMethod, path: RoutePath, route: RouteFn<RouteMethod, RoutePath, RouteReturn, Stores, MergeInferValidatorRequest<Validators["outputs"], DeepInferValidatorOutput<RouteValidatorOptions["request"]>>>, options?: RouteOptions<RouteValidatorOptions>): Module<Errors, Prefix, Routes & ParseRoute<RouteMethod, MergePaths<Prefix, RoutePath>, MergeInferValidatorRequest<Validators["inputs"], DeepInferValidatorInput<RouteValidatorOptions["request"]>> & ExtendsType<ExtractUrlParams<MergePaths<Prefix, RoutePath>>, NonNullable<unknown>, NonNullable<unknown>, {
29
+ params: RequiredKeys<ExtractUrlParams<MergePaths<Prefix, RoutePath>>> extends never ? ExtractUrlParams<MergePaths<Prefix, RoutePath>> | undefined : ExtractUrlParams<MergePaths<Prefix, RoutePath>>;
30
+ }>, Awaited<ReturnType<RouteFn<RouteMethod, RoutePath, RouteReturn, Stores, MergeInferValidatorRequest<Validators["outputs"], DeepInferValidatorOutput<RouteValidatorOptions["request"]>>>>> | ValueOf<Errors> | ValueOf<Successes>>, Stores, Successes, Validators>;
31
+ routes: Routes;
32
+ store<const StoreReturn extends Record<PropertyKey, unknown> | AnyError>(store: StoreFn<StoreReturn, Stores, Validators["outputs"]>): Module<MergeErrors<Errors, TransformError<FilterError<StoreReturn>>>, Prefix, Routes, Stores & IgnoreError<StoreReturn>, Successes, Validators>;
33
+ type: "MODULE";
34
+ validator<const _ValidatorRequest extends Partial<ValidatorRequest>>(options: ValidatorOptions<_ValidatorRequest>): Module<MergeErrors<Errors, TransformValidatorError<DeepInferValidatorError<_ValidatorRequest>>>, Prefix, Routes, Stores, Successes, {
35
+ inputs: MergeInferValidatorRequest<Validators["inputs"], DeepInferValidatorInput<_ValidatorRequest>>;
36
+ outputs: MergeInferValidatorRequest<Validators["outputs"], DeepInferValidatorOutput<_ValidatorRequest>>;
37
+ }>;
38
+ }
39
+ export type AnyModule = Module<any, any, any, any, any, any>;
40
+ export interface ModuleOptions<Prefix extends `/${string}`> {
41
+ prefix?: Prefix;
42
+ }
43
+ export type AnyModuleOptions = ModuleOptions<any>;
44
+ type Constructor = new (options: AnyModuleOptions) => AnyModule;
45
+ export declare const Module: Constructor;
46
+ export declare const module: <const Errors extends Record<PropertyKey, unknown> = {}, const Prefix extends `/${string}` = "/", const Routes extends Record<PropertyKey, unknown> = {}, const Stores extends Record<PropertyKey, unknown> = {}, const Successes extends Record<PropertyKey, unknown> = {}, const Validators extends {
47
+ inputs: Record<PropertyKey, unknown>;
48
+ outputs: Record<PropertyKey, unknown>;
49
+ } = {
50
+ inputs: NonNullable<unknown>;
51
+ outputs: NonNullable<unknown>;
52
+ }>(options?: ModuleOptions<Prefix>) => Module<Errors, Prefix, Routes, Stores, Successes, Validators>;
53
+ export {};
54
+ //# sourceMappingURL=module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../src/module.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAClD,OAAO,KAAK,EACX,QAAQ,EACR,WAAW,EACX,WAAW,EACX,WAAW,EACX,cAAc,EACd,MAAM,SAAS,CAAC;AACjB,OAAO,EACN,KAAK,QAAQ,EAIb,KAAK,OAAO,EACZ,KAAK,YAAY,EACjB,MAAM,SAAS,CAAC;AACjB,OAAO,EACN,KAAK,aAAa,EAGlB,KAAK,YAAY,EACjB,MAAM,cAAc,CAAC;AACtB,OAAO,EACN,KAAK,QAAQ,EAGb,KAAK,UAAU,EACf,KAAK,YAAY,EAEjB,KAAK,OAAO,EACZ,KAAK,sBAAsB,EAC3B,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,KAAK,QAAQ,EAA0B,KAAK,OAAO,EAAE,MAAM,SAAS,CAAC;AAC9E,OAAO,KAAK,EACX,UAAU,EACV,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,EACX,iBAAiB,EACjB,WAAW,EACX,gBAAgB,EAChB,UAAU,EACV,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,OAAO,EACP,MAAM,SAAS,CAAC;AAEjB,OAAO,EACN,KAAK,YAAY,EAEjB,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,EAC5B,KAAK,wBAAwB,EAC7B,KAAK,0BAA0B,EAC/B,KAAK,uBAAuB,EAE5B,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,MAAM,aAAa,CAAC;AAErB,MAAM,MAAM,WAAW,GAAG,CACvB,QAAQ,GACR,aAAa,GACb,SAAS,GACT,QAAQ,GACR,QAAQ,GACR,YAAY,CACd,EAAE,CAAC;A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W,CAAC,OAAO,CAAC;aACnB,WAAW,CAAC,OAAO,CAAC;aAGrB,aAAa,CAAC,MAAM,CAAC,KAEP,MAAM,CAC5B,MAAM,EACN,MAAM,EACN,MAAM,EACN,MAAM,EACN,SAAS,EACT,UAAU,CACV,CAAC"}
package/dist/module.js ADDED
@@ -0,0 +1,37 @@
1
+ import { Group, } from "./group";
2
+ import { Middleware, } from "./middleware";
3
+ import { Route, } from "./route";
4
+ import { Store } from "./store";
5
+ import { Empty } from "./utils/empty";
6
+ import { Validator, } from "./validator";
7
+ export const Module = function ({ prefix } = new Empty()) {
8
+ this.chain = [];
9
+ this.prefix = prefix ?? "";
10
+ this.type = "MODULE";
11
+ };
12
+ Module.prototype.extends = function (module) {
13
+ this.chain.push(module);
14
+ return this;
15
+ };
16
+ Module.prototype.group = function (group, options = new Empty()) {
17
+ this.chain.push(new Group(group, options));
18
+ return this;
19
+ };
20
+ Module.prototype.middleware = function (middleware) {
21
+ this.chain.push(new Middleware(middleware));
22
+ return this;
23
+ };
24
+ Module.prototype.route = function (method, path, route, options = new Empty()) {
25
+ this.chain.push(new Route(method, path, route, options));
26
+ return this;
27
+ };
28
+ Module.prototype.store = function (store) {
29
+ this.chain.push(new Store(store));
30
+ return this;
31
+ };
32
+ Module.prototype.validator = function (options) {
33
+ this.chain.push(new Validator(options));
34
+ return this;
35
+ };
36
+ export const module = (options = new Empty()) => new Module(options);
37
+ //# sourceMappingURL=module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"module.js","sourceRoot":"","sources":["../src/module.ts"],"names":[],"mappings":"AAQA,OAAO,EAIN,KAAK,GAGL,MAAM,SAAS,CAAC;AACjB,OAAO,EAGN,UAAU,GAEV,MAAM,cAAc,CAAC;AACtB,OAAO,EAMN,KAAK,GAKL,MAAM,SAAS,CAAC;AACjB,OAAO,EAAkC,KAAK,EAAgB,MAAM,SAAS,CAAC;AAiB9E,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,E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K,CAAC,KAAK,CAAC,CAAC,CAAC;IAElC,OAAO,IAAI,CAAC;AACb,CAAC,CAAC;AAEF,MAAM,CAAC,SAAS,CAAC,SAAS,GAAG,UAE5B,OAA4B;IAE5B,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC;IAExC,OAAO,IAAI,CAAC;AACb,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,MAAM,GAAG,CAcrB,UAAiC,IAAI,KAAK,EAAE,EAC3C,EAAE,CACH,IAAI,MAAM,CAAC,OAAO,CAOjB,CAAC"}
@@ -0,0 +1,48 @@
1
+ import type { WebSocketHandler } from "bun";
2
+ import type { DeveloperContext } from "./context";
3
+ import type { AnyError } from "./error";
4
+ import type { AnySuccess } from "./success";
5
+ import type { ConditionallyOmit, ExtendsType, ExtractUrlParams, GeneratorSSE, HttpMethod, MaybePromise } from "./types";
6
+ import { type AnyValidator, type DeepInferValidatorOutput, type MergeInferValidatorRequest, type ValidatorOptions, type ValidatorRequest } from "./validator";
7
+ export type PathToObject<Path extends string, Value> = Path extends `${infer First}/${infer Rest}` ? {
8
+ [Key in First]: PathToObject<Rest, Value>;
9
+ } : {
10
+ [Key in Path]: Value;
11
+ };
12
+ export type ParseRoute<Method extends HttpMethod, Path extends `/${string}`, Request, Response> = PathToObject<Path extends "/" ? "index" : Path extends `/${infer Rest}` ? Rest : Path, {
13
+ [Key in Lowercase<Method>]: {
14
+ method: Uppercase<Method>;
15
+ path: Path;
16
+ request: Request;
17
+ response: Response;
18
+ };
19
+ }>;
20
+ export type RouteFnReturnWS<Context> = WebSocketHandler<Context>;
21
+ export type RouteFnReturnGenerator = Generator<GeneratorSSE<AnyError | AnySuccess>, AnyError | AnySuccess | void> | AsyncGenerator<GeneratorSSE<AnyError | AnySuccess>, AnyError | AnySuccess | void>;
22
+ export type RouteFn<Method extends HttpMethod, Path extends string, Return extends Method extends "WS" ? RouteFnReturnWS<Omit<DeveloperContext<Stores, ExtendsType<ExtractUrlParams<Path>, NonNullable<unknown>, Validators, Validators & ConditionallyOmit<{
23
+ params: ExtractUrlParams<Path>;
24
+ }, NonNullable<unknown>>>>, "response">> : MaybePromise<AnyError | AnySuccess> | RouteFnReturnGenerator, Stores extends Record<PropertyKey, unknown>, Validators extends Record<PropertyKey, unknown>> = (context: DeveloperContext<Stores, ExtendsType<ExtractUrlParams<Path>, NonNullable<unknown>, Validators, Validators & ConditionallyOmit<{
25
+ params: ExtractUrlParams<Path>;
26
+ }, NonNullable<unknown>>>>) => Return;
27
+ export type AnyRouteFn = RouteFn<any, any, any, any, any>;
28
+ export interface Route<Method extends HttpMethod, Path extends `/${string}`, Return extends Method extends "WS" ? RouteFnReturnWS<Omit<DeveloperContext<Stores, ExtendsType<ExtractUrlParams<Path>, NonNullable<unknown>, MergeInferValidatorRequest<Validators, DeepInferValidatorOutput<_ValidatorOptions["request"]>>, MergeInferValidatorRequest<Validators, DeepInferValidatorOutput<_ValidatorOptions["request"]>> & ConditionallyOmit<{
29
+ params: ExtractUrlParams<Path>;
30
+ }, NonNullable<unknown>>>>, "response">> : MaybePromise<AnyError | AnySuccess> | RouteFnReturnGenerator, Stores extends Record<PropertyKey, unknown>, _ValidatorOptions extends ValidatorOptions<Partial<ValidatorRequest>>, Validators extends Record<PropertyKey, unknown>> {
31
+ route: RouteFn<Method, Path, Return, Stores, MergeInferValidatorRequest<Validators, DeepInferValidatorOutput<_ValidatorOptions["request"]>>>;
32
+ method: Method;
33
+ path: Path;
34
+ type: "ROUTE";
35
+ validator?: AnyValidator;
36
+ }
37
+ export type AnyRoute = Route<any, any, any, any, any, any>;
38
+ export interface RouteOptions<_ValidatorOptions extends ValidatorOptions<Partial<ValidatorRequest>>> {
39
+ validator?: _ValidatorOptions;
40
+ }
41
+ export type AnyRouteOptions = RouteOptions<any>;
42
+ type Constructor = new (method: HttpMethod, path: `/${string}`, route: AnyRouteFn, options: AnyRouteOptions) => AnyRoute;
43
+ export declare const Route: Constructor;
44
+ export declare const route: <const Method extends HttpMethod, const Path extends `/${string}`, const Return extends Method extends "WS" ? RouteFnReturnWS<Omit<DeveloperContext<Stores, ExtendsType<ExtractUrlParams<Path>, NonNullable<unknown>, MergeInferValidatorRequest<Validators, DeepInferValidatorOutput<_ValidatorOptions["request"]>>, MergeInferValidatorRequest<Validators, DeepInferValidatorOutput<_ValidatorOptions["request"]>> & ConditionallyOmit<{
45
+ params: ExtractUrlParams<Path>;
46
+ }, NonNullable<unknown>>>>, "response">> : MaybePromise<AnyError | AnySuccess> | RouteFnReturnGenerator, const Stores extends Record<PropertyKey, unknown>, const _ValidatorOptions extends ValidatorOptions<Partial<ValidatorRequest>>, const Validators extends Record<PropertyKey, unknown>>(method: Method, path: Path, route: RouteFn<Method, Path, Return, Stores, MergeInferValidatorRequest<Validators, DeepInferValidatorOutput<_ValidatorOptions["request"]>>>, options?: RouteOptions<_ValidatorOptions>) => Route<Method, Path, Return, Stores, _ValidatorOptions, Validators>;
47
+ export {};
48
+ //# sourceMappingURL=route.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../src/route.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,KAAK,CAAC;AAE5C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAClD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,KAAK,EACX,iBAAiB,EACjB,WAAW,EACX,gBAAgB,EAChB,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,MAAM,SAAS,CAAC;AAEjB,OAAO,EACN,KAAK,YAAY,EACjB,KAAK,wBAAwB,EAC7B,KAAK,0BAA0B,EAE/B,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,MAAM,aAAa,CAAC;AAErB,MAAM,MAAM,YAAY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gB,CAAC,IAAI,CAAC,EACtB,WAAW,CAAC,OAAO,CAAC,EACpB,0BAA0B,CACzB,UAAU,EACV,wBAAwB,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC,CACtD,EACD,0BAA0B,CACzB,UAAU,EACV,wBAAwB,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC,CACtD,GACA,iBAAiB,CAChB;IACC,MAAM,EAAE,gBAAgB,CAAC,IAAI,CAAC,CAAC;CAC/B,EACD,WAAW,CAAC,OAAO,CAAC,CACpB,CACF,CACD,EACD,UAAU,CACV,CACD,GACA,YAAY,CAAC,QAAQ,GAAG,UAAU,CAAC,GAAG,sBAAsB,QACzD,MAAM,SAAS,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,QAC3C,iBAAiB,SAAS,gBAAgB,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC,QACrE,UAAU,SAAS,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,UAE7C,MAAM,QACR,IAAI,SACH,OAAO,CACb,MAAM,EACN,IAAI,EACJ,MAAM,EACN,MAAM,EACN,0BAA0B,CACzB,UAAU,EACV,wBAAwB,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC,CACtD,CACD,YACQ,YAAY,CAAC,iBAAiB,CAAC,KAEG,KAAK,CAC/C,MAAM,EACN,IAAI,EACJ,MAAM,EACN,MAAM,EACN,iBAAiB,EACjB,UAAU,CACV,CAAC"}
package/dist/route.js ADDED
@@ -0,0 +1,14 @@
1
+ import { Empty } from "./utils/empty";
2
+ import { Validator, } from "./validator";
3
+ export const Route = function (method, path, route, { validator } = new Empty()) {
4
+ this.method = method;
5
+ this.path = path;
6
+ this.route = route;
7
+ this.type = "ROUTE";
8
+ if (validator) {
9
+ this.validator =
10
+ validator instanceof Validator ? validator : new Validator(validator);
11
+ }
12
+ };
13
+ export const route = (method, path, route, options = new Empty()) => new Route(method, path, route, options);
14
+ //# sourceMappingURL=route.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"route.js","sourceRoot":"","sources":["../src/route.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAIN,SAAS,GAGT,MAAM,aAAa,CAAC;AA0JrB,MAAM,CAAC,MAAM,KAAK,GAAG,UAEpB,MAAkB,EAClB,IAAkB,EAClB,KAAiB,EACjB,EAAE,SAAS,KAAsB,IAAI,KAAK,EAAE;IAE5C,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACrB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACjB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACnB,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC;IAEpB,IAAI,SAAS,EAAE,CAAC;QACf,IAAI,CAAC,SAAS;YACb,SAAS,YAAY,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,SAAS,CAAC,SAAS,CAAC,CAAC;IACxE,CAAC;AACF,CAA2B,CAAC;AAE5B,MAAM,CAAC,MAAM,KAAK,GAAG,CAmCpB,MAAc,EACd,IAAU,EACV,KASC,EACD,UAA2C,IAAI,KAAK,EAAE,EACrD,EAAE,CACH,IAAI,KAAK,CAAC,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,CAOrC,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { AsyncLocalStorage } from "node:async_hooks";
2
+ import type { Context } from "./context";
3
+ export declare const asyncLocalStorage: AsyncLocalStorage<Context>;
4
+ export declare const getRequestContext: () => Context | undefined;
5
+ //# sourceMappingURL=storage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../src/storage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAErD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,eAAO,MAAM,iBAAiB,4BAAmC,CAAC;AAElE,eAAO,MAAM,iBAAiB,2BAE7B,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { AsyncLocalStorage } from "node:async_hooks";
2
+ export const asyncLocalStorage = new AsyncLocalStorage();
3
+ export const getRequestContext = () => {
4
+ return asyncLocalStorage.getStore();
5
+ };
6
+ //# sourceMappingURL=storage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage.js","sourceRoot":"","sources":["../src/storage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAIrD,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,iBAAiB,EAAW,CAAC;AAElE,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,EAAE;IACrC,OAAO,iBAAiB,CAAC,QAAQ,EAAE,CAAC;AACrC,CAAC,CAAC"}
@@ -0,0 +1,14 @@
1
+ import type { DeveloperContext } from "./context";
2
+ import type { AnyError } from "./error";
3
+ export type StoreFn<Return extends Record<PropertyKey, unknown> | AnyError, Stores extends Record<PropertyKey, unknown>, Validators extends Record<PropertyKey, unknown>> = (context: DeveloperContext<Stores, Validators>) => Return | Promise<Return>;
4
+ export type AnyStoreFn = StoreFn<any, any, any>;
5
+ export interface Store<Return extends Record<PropertyKey, unknown> | AnyError, Stores extends Record<PropertyKey, unknown>, Validators extends Record<PropertyKey, unknown>> {
6
+ store: StoreFn<Return, Stores, Validators>;
7
+ type: "STORE";
8
+ }
9
+ export type AnyStore = Store<any, any, any>;
10
+ type Constructor = new (store: AnyStoreFn) => AnyStore;
11
+ export declare const Store: Constructor;
12
+ export declare const store: <const Return extends Record<PropertyKey, unknown> | AnyError, const Stores extends Record<PropertyKey, unknown>, const Validators extends Record<PropertyKey, unknown>>(store: StoreFn<Return, Stores, Validators>) => Store<Return, Stores, Validators>;
13
+ export {};
14
+ //# sourceMappingURL=store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../src/store.ts"],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SAE9C,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,CAAC,KAClB,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC"}
package/dist/store.js ADDED
@@ -0,0 +1,6 @@
1
+ export const Store = function (store) {
2
+ this.store = store;
3
+ this.type = "STORE";
4
+ };
5
+ export const store = (store) => new Store(store);
6
+ //# sourceMappingURL=store.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"store.js","sourceRoot":"","sources":["../src/store.ts"],"names":[],"mappings":"AAwBA,MAAM,CAAC,MAAM,KAAK,GAAG,UAA0B,KAAiB;IAC/D,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACnB,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC;AACrB,CAA2B,CAAC;AAE5B,MAAM,CAAC,MAAM,KAAK,GAAG,CAKpB,KAA0C,EACzC,EAAE,CAAC,IAAI,KAAK,CAAC,KAAK,CAAsC,CAAC"}
@@ -0,0 +1,21 @@
1
+ import type { ExtractContent } from "./types";
2
+ export type FilterSuccess<Type> = Extract<Type, AnySuccess>;
3
+ export type TransformSuccess<Success extends AnySuccess> = {
4
+ [Key in Success["status"]]: Success;
5
+ };
6
+ export type MergeSuccesses<Successes, Success> = {
7
+ [Key in keyof Successes | keyof Success]: Key extends keyof Successes ? Key extends keyof Success ? {
8
+ [Key2 in keyof Successes[Key] | keyof Success[Key]]: Key2 extends keyof Successes[Key] ? Key2 extends keyof Success[Key] ? Successes[Key][Key2] | Success[Key][Key2] : Successes[Key][Key2] : Key2 extends keyof Success[Key] ? Success[Key][Key2] : never;
9
+ } : Successes[Key] : Key extends keyof Success ? Success[Key] : never;
10
+ };
11
+ export interface Success<Content, Status extends number> {
12
+ content: ExtractContent<Content>;
13
+ status: Status;
14
+ success: true;
15
+ }
16
+ export type AnySuccess = Success<any, any>;
17
+ type Constructor = new (content: unknown, status: number) => AnySuccess;
18
+ export declare const Success: Constructor;
19
+ export declare const success: <const Content, const Status extends number>(content: Content, status: Status) => Success<Content, Status>;
20
+ export {};
21
+ //# sourceMappingURL=success.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"success.d.ts","sourceRoot":"","sources":["../src/success.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C,MAAM,MAAM,aAAa,CAAC,IAAI,IAAI,OAAO,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;AAE5D,MAAM,MAAM,gBAAgB,CAAC,OAAO,SAAS,UAAU,IAAI;KACzD,GAAG,IAAI,OAAO,CAAC,QAAQ,CAAC,GAAG,OAAO;CACnC,CAAC;AAEF,MAAM,MAAM,cAAc,CAAC,SAAS,EAAE,OAAO,IAAI;KAC/C,GAAG,IAAI,MAAM,SAAS,GAAG,MAAM,OAAO,GAAG,GAAG,SAAS,MAAM,SAAS,GAClE,GAAG,SAAS,MAAM,OAAO,GACxB;SACC,IAAI,IACF,MAAM,SAAS,CAAC,GAAG,CAAC,GACpB,MAAM,OAAO,CAAC,GAAG,CAAC,GAAG,IAAI,SAAS,MAAM,SAAS,CAAC,GAAG,CAAC,GACtD,IAAI,SAAS,MAAM,OAAO,CAAC,GAAG,CAAC,GAC9B,SAAS,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GACzC,SAAS,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GACrB,IAAI,SAAS,MAAM,OAAO,CAAC,GAAG,CAAC,GAC9B,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAClB,KAAK;KACT,GACA,SAAS,CAAC,GAAG,CAAC,GACf,GAAG,SAAS,MAAM,OAAO,GACxB,OAAO,CAAC,GAAG,CAAC,GACZ,KAAK;CACT,CAAC;AAEF,MAAM,WAAW,OAAO,CAAC,OAAO,EAAE,MAAM,SAAS,MAAM;IACtD,OAAO,EAAE,cAAc,CAAC,OAAO,CAAC,CAAC;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,IAAI,CAAC;CACd;AAED,MAAM,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AAE3C,KAAK,WAAW,GAAG,KAAK,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,KAAK,UAAU,CAAC;AAExE,eAAO,MAAM,OAAO,EAQJ,WAAW,CAAC;AAE5B,eAAO,MAAM,OAAO,SAAU,OAAO,QAAQ,MAAM,SAAS,MAAM,WACxD,OAAO,UACR,MAAM,KACsB,OAAO,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC"}
@@ -0,0 +1,7 @@
1
+ export const Success = function (content, status) {
2
+ this.content = content;
3
+ this.status = status;
4
+ this.success = true;
5
+ };
6
+ export const success = (content, status) => new Success(content, status);
7
+ //# sourceMappingURL=success.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"success.js","sourceRoot":"","sources":["../src/success.ts"],"names":[],"mappings":"AAsCA,MAAM,CAAC,MAAM,OAAO,GAAG,UAEtB,OAAgB,EAChB,MAAc;IAEd,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACvB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACrB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;AACrB,CAA2B,CAAC;AAE5B,MAAM,CAAC,MAAM,OAAO,GAAG,CACtB,OAAgB,EAChB,MAAc,EACb,EAAE,CAAC,IAAI,OAAO,CAAC,OAAO,EAAE,MAAM,CAA6B,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { ExtendsType } from "../types";
2
+ type OmitKeys<Type extends Record<PropertyKey, unknown>, OmitType> = keyof {
3
+ [Key in keyof Type as ExtendsType<Type[Key], OmitType, Key, never>]: Type[Key];
4
+ };
5
+ export type ConditionallyOmit<Type extends Record<PropertyKey, unknown>, OptionalType> = Omit<Type, OmitKeys<Type, OptionalType>>;
6
+ export {};
7
+ //# sourceMappingURL=conditionally-omit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conditionally-omit.d.ts","sourceRoot":"","sources":["../../src/types/conditionally-omit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C,KAAK,QAAQ,CAAC,IAAI,SAAS,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,EAAE,QAAQ,IAAI,MAAM;KACzE,GAAG,IAAI,MAAM,IAAI,IAAI,WAAW,CAChC,IAAI,CAAC,GAAG,CAAC,EACT,QAAQ,EACR,GAAG,EACH,KAAK,CACL,GAAG,IAAI,CAAC,GAAG,CAAC;CACb,CAAC;AAEF,MAAM,MAAM,iBAAiB,CAC5B,IAAI,SAAS,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,EACzC,YAAY,IACT,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=conditionally-omit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conditionally-omit.js","sourceRoot":"","sources":["../../src/types/conditionally-omit.ts"],"names":[],"mappings":""}
@@ -0,0 +1,6 @@
1
+ type OptionalKeys<Type extends Record<PropertyKey, unknown>, OptionalType> = keyof {
2
+ [Key in keyof Type as OptionalType extends Type[Key] ? Key : never]: Type[Key];
3
+ };
4
+ export type ConditionallyOptional<Type extends Record<PropertyKey, unknown>, OptionalType> = Omit<Type, OptionalKeys<Type, OptionalType>> & Partial<Pick<Type, OptionalKeys<Type, OptionalType>>>;
5
+ export {};
6
+ //# sourceMappingURL=conditionally-optional.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conditionally-optional.d.ts","sourceRoot":"","sources":["../../src/types/conditionally-optional.ts"],"names":[],"mappings":"AAAA,KAAK,YAAY,CAChB,IAAI,SAAS,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,EACzC,YAAY,IACT,MAAM;KACR,GAAG,IAAI,MAAM,IAAI,IAAI,YAAY,SAAS,IAAI,CAAC,GAAG,CAAC,GACjD,GAAG,GACH,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,qBAAqB,CAChC,IAAI,SAAS,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,EACzC,YAAY,IACT,IAAI,CAAC,IAAI,EAAE,YAAY,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC,GAC/C,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,YAAY,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=conditionally-optional.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conditionally-optional.js","sourceRoot":"","sources":["../../src/types/conditionally-optional.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ export type ExtendsType<Type, Extends, True = Type, False = Type> = [
2
+ Type
3
+ ] extends [Extends] ? [Extends] extends [Type] ? True : False : False;
4
+ //# sourceMappingURL=extends-type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extends-type.d.ts","sourceRoot":"","sources":["../../src/types/extends-type.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,GAAG,IAAI,EAAE,KAAK,GAAG,IAAI,IAAI;IACnE,IAAI;CACJ,SAAS,CAAC,OAAO,CAAC,GAChB,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,GACvB,IAAI,GACJ,KAAK,GACN,KAAK,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=extends-type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extends-type.js","sourceRoot":"","sources":["../../src/types/extends-type.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export type ExtractContent<Content> = Content extends (...args: any[]) => any ? Awaited<ReturnType<Content>> : Content;
2
+ //# sourceMappingURL=extract-content.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extract-content.d.ts","sourceRoot":"","sources":["../../src/types/extract-content.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc,CAAC,OAAO,IAAI,OAAO,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,GAC1E,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,GAC5B,OAAO,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=extract-content.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extract-content.js","sourceRoot":"","sources":["../../src/types/extract-content.ts"],"names":[],"mappings":""}
@@ -0,0 +1,7 @@
1
+ type ParamType<Param extends string, Type extends string | string[]> = Param extends `${string}?` ? Type | undefined : Type;
2
+ type ParamEntry<Param extends string, Type extends string | string[]> = {
3
+ [Key in Param extends `${infer Name}?` ? Name : Param]: ParamType<Param, Type>;
4
+ };
5
+ export type ExtractUrlParams<Path extends string, Accumulated extends Record<string, string | string[]> = NonNullable<unknown>> = Path extends `${infer First}/${infer Rest}` ? First extends `:${infer Param}` | `...${infer Param}` ? ExtractUrlParams<Rest, Accumulated & ParamEntry<Param, First extends `...${string}` ? string[] : string>> : ExtractUrlParams<Rest, Accumulated> : Path extends `:${infer Param}` | `...${infer Param}` ? Accumulated & ParamEntry<Param, Path extends `...${string}` ? string[] : string> : Accumulated;
6
+ export {};
7
+ //# sourceMappingURL=extract-url-params.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extract-url-params.d.ts","sourceRoot":"","sources":["../../src/types/extract-url-params.ts"],"names":[],"mappings":"AAAA,KAAK,SAAS,CACb,KAAK,SAAS,MAAM,EACpB,IAAI,SAAS,MAAM,GAAG,MAAM,EAAE,IAC3B,KAAK,SAAS,GAAG,MAAM,GAAG,GAAG,IAAI,GAAG,SAAS,GAAG,IAAI,CAAC;AAEzD,KAAK,UAAU,CAAC,KAAK,SAAS,MAAM,EAAE,IAAI,SAAS,MAAM,GAAG,MAAM,EAAE,IAAI;KACtE,GAAG,IAAI,KAAK,SAAS,GAAG,MAAM,IAAI,GAAG,GAAG,IAAI,GAAG,KAAK,GAAG,SAAS,CAChE,KAAK,EACL,IAAI,CACJ;CACD,CAAC;AAEF,MAAM,MAAM,gBAAgB,CAC3B,IAAI,SAAS,MAAM,EACnB,WAAW,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,GAAG,WAAW,CAAC,OAAO,CAAC,IACzE,IAAI,SAAS,GAAG,MAAM,KAAK,IAAI,MAAM,IAAI,EAAE,GAE7C,KAAK,SAAS,IAAI,MAAM,KAAK,EAAE,GAAG,MAAM,MAAM,KAAK,EAAE,GACnD,gBAAgB,CAChB,IAAI,EACJ,WAAW,GACV,UAAU,CAAC,KAAK,EAAE,KAAK,SAAS,MAAM,MAAM,EAAE,GAAG,MAAM,EAAE,GAAG,MAAM,CAAC,CACpE,GACA,gBAAgB,CAAC,IAAI,EAAE,WAAW,CAAC,GAErC,IAAI,SAAS,IAAI,MAAM,KAAK,EAAE,GAAG,MAAM,MAAM,KAAK,EAAE,GAClD,WAAW,GACX,UAAU,CAAC,KAAK,EAAE,IAAI,SAAS,MAAM,MAAM,EAAE,GAAG,MAAM,EAAE,GAAG,MAAM,CAAC,GAClE,WAAW,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=extract-url-params.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extract-url-params.js","sourceRoot":"","sources":["../../src/types/extract-url-params.ts"],"names":[],"mappings":""}
@@ -0,0 +1,9 @@
1
+ import type { AnyError } from "../error";
2
+ import type { AnySuccess } from "../success";
3
+ export interface GeneratorSSE<Data extends AnyError | AnySuccess> {
4
+ data: Data;
5
+ event?: string;
6
+ id?: string;
7
+ retry?: number;
8
+ }
9
+ //# sourceMappingURL=generator-sse.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generator-sse.d.ts","sourceRoot":"","sources":["../../src/types/generator-sse.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAE5C,MAAM,WAAW,YAAY,CAAC,IAAI,SAAS,QAAQ,GAAG,UAAU;IAC/D,IAAI,EAAE,IAAI,CAAC;IACX,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;CACf"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=generator-sse.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generator-sse.js","sourceRoot":"","sources":["../../src/types/generator-sse.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export type HttpMethod = "DELETE" | "GET" | "OPTIONS" | "PATCH" | "POST" | "PUT" | "WS" | (Uppercase<string> & NonNullable<unknown>);
2
+ //# sourceMappingURL=http-method.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http-method.d.ts","sourceRoot":"","sources":["../../src/types/http-method.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GACnB,QAAQ,GACR,KAAK,GACL,SAAS,GACT,OAAO,GACP,MAAM,GACN,KAAK,GACL,IAAI,GACJ,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=http-method.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http-method.js","sourceRoot":"","sources":["../../src/types/http-method.ts"],"names":[],"mappings":""}
@@ -0,0 +1,14 @@
1
+ export type * from "../types/conditionally-omit";
2
+ export type * from "../types/conditionally-optional";
3
+ export type * from "../types/extends-type";
4
+ export type * from "../types/extract-content";
5
+ export type * from "../types/extract-url-params";
6
+ export type * from "../types/generator-sse";
7
+ export type * from "../types/http-method";
8
+ export type * from "../types/maybe-promise";
9
+ export type * from "../types/merge";
10
+ export type * from "../types/merge-paths";
11
+ export type * from "../types/required-keys";
12
+ export type * from "../types/value-of";
13
+ export type * from "../types/ws";
14
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,mBAAmB,4BAA4B,CAAC;AAChD,mBAAmB,gCAAgC,CAAC;AACpD,mBAAmB,sBAAsB,CAAC;AAC1C,mBAAmB,yBAAyB,CAAC;AAC7C,mBAAmB,4BAA4B,CAAC;AAChD,mBAAmB,uBAAuB,CAAC;AAC3C,mBAAmB,qBAAqB,CAAC;AACzC,mBAAmB,uBAAuB,CAAC;AAC3C,mBAAmB,eAAe,CAAC;AACnC,mBAAmB,qBAAqB,CAAC;AACzC,mBAAmB,uBAAuB,CAAC;AAC3C,mBAAmB,kBAAkB,CAAC;AACtC,mBAAmB,YAAY,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export type MaybePromise<Type> = Type | Promise<Type>;
2
+ //# sourceMappingURL=maybe-promise.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"maybe-promise.d.ts","sourceRoot":"","sources":["../../src/types/maybe-promise.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,CAAC,IAAI,IAAI,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=maybe-promise.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"maybe-promise.js","sourceRoot":"","sources":["../../src/types/maybe-promise.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ type RemoveTrailingSlash<Type extends string> = Type extends "/" ? Type : Type extends `${infer WithoutTrailingSlash}/` ? WithoutTrailingSlash : Type;
2
+ export type MergePaths<Prefix extends `/${string}`, Path extends `/${string}`> = Prefix extends "/" ? RemoveTrailingSlash<Path> : Path extends "/" ? RemoveTrailingSlash<Prefix> : `${RemoveTrailingSlash<Prefix>}${RemoveTrailingSlash<Path>}`;
3
+ export {};
4
+ //# sourceMappingURL=merge-paths.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"merge-paths.d.ts","sourceRoot":"","sources":["../../src/types/merge-paths.ts"],"names":[],"mappings":"AAAA,KAAK,mBAAmB,CAAC,IAAI,SAAS,MAAM,IAAI,IAAI,SAAS,GAAG,GAC7D,IAAI,GACJ,IAAI,SAAS,GAAG,MAAM,oBAAoB,GAAG,GAC5C,oBAAoB,GACpB,IAAI,CAAC;AAET,MAAM,MAAM,UAAU,CACrB,MAAM,SAAS,IAAI,MAAM,EAAE,EAC3B,IAAI,SAAS,IAAI,MAAM,EAAE,IACtB,MAAM,SAAS,GAAG,GACnB,mBAAmB,CAAC,IAAI,CAAC,GACzB,IAAI,SAAS,GAAG,GACf,mBAAmB,CAAC,MAAM,CAAC,GAC3B,GAAG,mBAAmB,CAAC,MAAM,CAAC,GAAG,mBAAmB,CAAC,IAAI,CAAC,EAAE,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=merge-paths.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"merge-paths.js","sourceRoot":"","sources":["../../src/types/merge-paths.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export type Merge<FirstType extends object, SecondType extends object> = Omit<FirstType, keyof SecondType> & SecondType;
2
+ //# sourceMappingURL=merge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"merge.d.ts","sourceRoot":"","sources":["../../src/types/merge.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,KAAK,CAAC,SAAS,SAAS,MAAM,EAAE,UAAU,SAAS,MAAM,IAAI,IAAI,CAC5E,SAAS,EACT,MAAM,UAAU,CAChB,GACA,UAAU,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=merge.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"merge.js","sourceRoot":"","sources":["../../src/types/merge.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ export type RequiredKeys<Type extends Record<PropertyKey, unknown>> = {
2
+ [Key in keyof Type]-?: undefined extends Type[Key] ? never : Key;
3
+ }[keyof Type];
4
+ //# sourceMappingURL=required-keys.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"required-keys.d.ts","sourceRoot":"","sources":["../../src/types/required-keys.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,CAAC,IAAI,SAAS,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,IAAI;KACpE,GAAG,IAAI,MAAM,IAAI,CAAC,CAAC,GAAG,SAAS,SAAS,IAAI,CAAC,GAAG,CAAC,GAAG,KAAK,GAAG,GAAG;CAChE,CAAC,MAAM,IAAI,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=required-keys.js.map