arkos 2.0.0-next.25 → 2.0.0-next.26

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.
@@ -1,7 +1,6 @@
1
1
  import RouteConfigValidator from "../../route-config-validator.js";
2
2
  import { applyPrefix, getMiddlewareStack } from "./index.js";
3
3
  import { getUserFileExtension } from "../../../helpers/fs.helpers.js";
4
- import { getArkosConfig } from "../../../../server.js";
5
4
  import RouteConfigRegistry from "../../route-config-registry.js";
6
5
  import { catchAsync } from "../../../../exports/error-handler/index.js";
7
6
  import deepmerge from "../../../helpers/deepmerge.helper.js";
@@ -10,6 +9,7 @@ import uploadManager from "./upload-manager.js";
10
9
  import loadableRegistry from "../../../../components/arkos-loadable-registry/index.js";
11
10
  import { state } from "../../../../app.js";
12
11
  import { docsLink } from "../../../../app.js";
12
+ import { isUsingAuthentication, getArkosConfig } from "../../../helpers/arkos-config.helpers.js";
13
13
  const flattenHandlers = (arr) => {
14
14
  return arr.reduce((flat, item) => {
15
15
  return flat.concat(Array.isArray(item) ? flattenHandlers(item) : item);
@@ -98,7 +98,7 @@ For further help see https://www.arkosjs.com/docs/core-concepts/authentication/s
98
98
  const fullConfig = {
99
99
  ...config,
100
100
  path,
101
- authentication: config.authentication === undefined ? true : config.authentication
101
+ authentication: config.authentication === undefined && isUsingAuthentication() ? true : config.authentication
102
102
  };
103
103
  receiver[method](fullConfig, ...handlers);
104
104
  return routeChain;
@@ -115,6 +115,7 @@ For further help see https://www.arkosjs.com/docs/core-concepts/authentication/s
115
115
  return;
116
116
  const path = applyPrefix(options?.prefix, config.path);
117
117
  config = {
118
+ authentication: config?.authentication === undefined && isUsingAuthentication() ? true : config?.authentication,
118
119
  ...config,
119
120
  ...(options?.openapi
120
121
  ? {
@@ -177,7 +178,7 @@ For further help see https://www.arkosjs.com/docs/core-concepts/authentication/s
177
178
  if (!validationConfig?.resolver &&
178
179
  Object.keys(config.validation || {}).length > 0)
179
180
  throw ExitError(`Trying to pass validators into route ${route} config validation option without choosing a validation resolver under arkos.init({ validation: { resolver: '' } })`);
180
- if (config.authentication && !authenticationConfig?.mode)
181
+ if (config.authentication && !isUsingAuthentication())
181
182
  throw ExitError(`Trying to authenticate route ${route} without choosing an authentication mode under arkos.config.${getUserFileExtension()}
182
183
 
183
184
  For further help see https://www.arkosjs.com/docs/core-concepts/authentication/setup.`);
@@ -1 +1 @@
1
- {"version":3,"file":"apply-arkos-router-proxy.js","sourceRoot":"","sources":["../../../../../../src/utils/arkos-router/utils/helpers/apply-arkos-router-proxy.ts"],"names":[],"mappings":"AASA,OAAO,oBAAoB,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,GAAG,CAAC;AACpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,mBAAmB,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AAC/D,OAAO,SAAS,MAAM,mCAAmC,CAAC;AAC1D,OAAO,SAAS,MAAM,6BAA6B,CAAC;AACpD,OAAO,aAAa,MAAM,kBAAkB,CAAC;AAM7C,OAAO,gBAAgB,MAAM,gDAAgD,CAAC;AAC9E,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAE3C,MAAM,eAAe,GAAG,CAAC,GAAU,EAA4B,EAAE;IAC/D,OAAO,GAAG,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE;QAC/B,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IACzE,CAAC,EAAE,EAAE,CAAC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AC;oBAEJ,QAAQ,GAAG,CAAC,GAAG,kBAAkB,CAAC,MAAM,CAAC,EAAE,GAAG,QAAQ,CAAC,CAAC;oBAExD,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;wBACvB,MAAM,SAAS,CACb,kCAAkC,MAAM,CAAC,WAAW,EAAE,IAAI,IAAI,GAAG,CAClE,CAAC;oBAEJ,IACE,MAAM,CAAC,YAAY,EAAE,OAAO;wBAC5B,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,aAAa,KAAK,KAAK;wBAEnD,QAAQ,CAAC,IAAI,CACX,UAAU,CACR,aAAa,CAAC,iBAAiB,CAAC,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,EAC5D,EAAE,IAAI,EAAE,OAAO,EAAE,CAClB,CACF,CAAC;oBAEJ,OAAO,cAAc,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE,GAAG,QAAQ,CAAC,CAAC;gBACxD,CAAC,CAAC;YACJ,CAAC;YAED,OAAO,cAAc,CAAC;QACxB,CAAC;KACF,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { IRouter, RouterOptions } from \"express\";\nimport {\n ArkosRouteConfig,\n ArkosUseConfig,\n IArkosRoute,\n IArkosRouter,\n InternalIArkosRouter,\n PathParams,\n} from \"../../types\";\nimport RouteConfigValidator from \"../../route-config-validator\";\nimport { applyPrefix, getMiddlewareStack } from \".\";\nimport { getUserFileExtension } from \"../../../helpers/fs.helpers\";\nimport { getArkosConfig } from \"../../../../server\";\nimport RouteConfigRegistry from \"../../route-config-registry\";\nimport { catchAsync } from \"../../../../exports/error-handler\";\nimport deepmerge from \"../../../helpers/deepmerge.helper\";\nimport ExitError from \"../../../helpers/exit-error\";\nimport uploadManager from \"./upload-manager\";\nimport { ArkosAnyRequestHandler } from \"../../../../types\";\nimport { ArkosRouterOptions } from \"../..\";\nimport { UploadConfig } from \"../../types/upload-config\";\nimport { Arkos, ArkosLoadable } from \"../../../../types/arkos\";\nimport { Express } from \"express\";\nimport loadableRegistry from \"../../../../components/arkos-loadable-registry\";\nimport { state } from \"../../../../app\";\nimport { docsLink } from \"../../../../app\";\n\nconst flattenHandlers = (arr: any[]): ArkosAnyRequestHandler[] => {\n return arr.reduce((flat, item) => {\n return flat.concat(Array.isArray(item) ? flattenHandlers(item) : item);\n }, []);\n};\n\nexport function applyArkosRouterProxy<T extends Express | IRouter>(\n target: T,\n options?: RouterOptions & ArkosRouterOptions,\n component: \"app\" | \"router\" = \"router\"\n): T extends Express ? Arkos : IArkosRouter {\n (target as InternalIArkosRouter)._arkos = {\n options,\n routes: [],\n };\n\n (target as any).load = (...items: ArkosLoadable[]) => {\n if (state !== \"idle\")\n throw ExitError(\n `app.load() must be called before app.${state === \"listening\" ? \"listen\" : \"build\"}(), see ${docsLink}`\n );\n\n if (Array.isArray(items[0])) items = items[0];\n items = Array.isArray(items) ? items : [items];\n\n items.forEach((item) => loadableRegistry.register(item));\n return target;\n };\n\n return new Proxy(target as any, {\n get(target, prop, receiver) {\n const originalMethod = Reflect.get(target, prop, receiver) as Function;\n\n const httpMethods = [\n \"get\",\n \"post\",\n \"put\",\n \"patch\",\n \"delete\",\n \"all\",\n \"head\",\n \"trace\",\n \"options\",\n ] as const;\n\n if (prop === \"use\") {\n return function(\n config: ArkosUseConfig | PathParams | ArkosAnyRequestHandler,\n ...handlers: (ArkosAnyRequestHandler | IArkosRouter)[]\n ) {\n // normalize function/router to ArkosUseConfig\n if (typeof config === \"function\" || Array.isArray(config)) {\n handlers = [config as ArkosAnyRequestHandler, ...handlers];\n config = {} as ArkosUseConfig;\n } else if (\n !config ||\n typeof config !== \"object\" ||\n typeof config === \"string\" ||\n config instanceof RegExp\n ) {\n throw ExitError(\n `First argument of ${component}.use() must be a valid ArkosRouteConfig object or a middleware function, but received ${typeof config === \"object\" ? JSON.stringify(config, null, 2) : config}.`\n );\n }\n\n if ((config as ArkosUseConfig).disabled) return;\n\n const useConfig = config as ArkosUseConfig;\n const path = applyPrefix(options?.prefix, useConfig.path ?? \"/\");\n\n const arkosConfig = getArkosConfig();\n const authenticationConfig = arkosConfig.authentication;\n\n // This is done because of Express v5 no longer\n // contains layer.regexp so we gotta build\n // the route reverse feature from ground up\n handlers.forEach((h: any) => {\n if (h && typeof h === \"function\" && h._arkos) {\n h._arkos.options = {\n ...h._arkos.options,\n prefix: path,\n };\n }\n });\n\n if (useConfig.authentication && !authenticationConfig?.mode)\n throw ExitError(\n `Trying to authenticate route ${path ? `${path}` : \"\"} without choosing an authentication mode under arkos.config.${getUserFileExtension()}\n\nFor further help see https://www.arkosjs.com/docs/core-concepts/authentication/setup.`\n );\n\n const flatHandlers = flattenHandlers(handlers);\n\n handlers = flatHandlers.map((handler: ArkosAnyRequestHandler) => {\n if (!handler || typeof handler !== \"function\")\n throw ExitError(\n `Wrong value for handler in route ${path}, recevied ${handler}.`\n );\n\n return \"param\" in handler\n ? handler\n : catchAsync(handler, {\n type: handler.length > 3 ? \"error\" : \"normal\",\n });\n });\n\n const middlewareStack = getMiddlewareStack(useConfig);\n const allHandlers = [...middlewareStack, ...handlers];\n\n return originalMethod.call(target, path, ...allHandlers);\n };\n }\n\n if (prop === \"route\") {\n return function(path: PathParams) {\n const routeChain: any = {};\n\n httpMethods.forEach((method) => {\n routeChain[method] = function(\n config: ArkosAnyRequestHandler | Omit<ArkosRouteConfig, \"path\">,\n ...handlers: ArkosAnyRequestHandler[]\n ) {\n if (typeof config === \"function\" || Array.isArray(config))\n throw ExitError(\n `First argument of ${component}.route(\"${path}\").${method}() must be a valid ArkosRouteConfig object without path field, but received ${typeof config === \"object\" ? JSON.stringify(config, null, 2) : config}`\n );\n\n const fullConfig: ArkosRouteConfig = {\n ...config,\n path,\n authentication: config.authentication === undefined ? true : config.authentication\n };\n\n receiver[method](fullConfig, ...handlers);\n return routeChain as IArkosRoute;\n };\n });\n\n return routeChain;\n };\n }\n\n if (httpMethods.includes(prop as any)) {\n return function(\n config: ArkosRouteConfig,\n ...handlers: ArkosAnyRequestHandler[]\n ) {\n if (!config || !RouteConfigValidator.isArkosRouteConfig(config))\n throw ExitError(\n `First argument of ${component}.${prop as string}() must be a valid ArkosRouteConfig object with path field, but recevied ${typeof config === \"object\" ? JSON.stringify(config, null, 2) : config}`\n );\n\n if (config?.disabled) return;\n\n const path = applyPrefix(options?.prefix, config.path);\n\n config = {\n ...config,\n ...(options?.openapi\n ? {\n experimental: {\n ...config?.experimental,\n openapi: deepmerge(\n options.openapi || {},\n config?.experimental?.openapi || {}\n ),\n },\n }\n : {}),\n path,\n };\n\n config = {\n ...config,\n ...(options?.uploads\n ? {\n experimental: {\n ...config?.experimental,\n ...((config?.experimental?.uploads\n ? {\n uploads: deepmerge(\n options.uploads,\n config.experimental.uploads\n ),\n }\n : {}) as UploadConfig),\n },\n }\n : {}),\n path,\n };\n\n if ([null, undefined].includes(path as any))\n throw new Error(\n \"Please pass valid value for path field to use in your route\"\n );\n\n const method = prop as string;\n const UndefinedHandlerError = (handler: any) =>\n ExitError(\n `Wrong value for handler in route ${method.toUpperCase()} ${path}, recevied ${handler}.`\n );\n\n if (handlers.length > 0) {\n const flatHandlers = flattenHandlers(handlers);\n\n handlers = flatHandlers.map((handler: ArkosAnyRequestHandler) => {\n if (!handler || typeof handler !== \"function\")\n throw UndefinedHandlerError(handler);\n\n return catchAsync(handler, {\n type: handler.length > 3 ? \"error\" : \"normal\",\n });\n });\n\n const finalHandler = handlers[handlers.length - 1];\n RouteConfigRegistry.register(finalHandler, config, method);\n (target as InternalIArkosRouter)._arkos.routes.push({\n handler: finalHandler,\n config,\n method,\n });\n }\n\n const arkosConfig = getArkosConfig();\n const validationConfig = arkosConfig.validation;\n const authenticationConfig = arkosConfig.authentication;\n const strictValidation = validationConfig?.strict;\n const route = `${method.toUpperCase()} ${path}`;\n\n if (\n strictValidation &&\n (!(\"validation\" in config) ||\n (\"validation\" in config &&\n !config.validation &&\n config.validation !== undefined))\n )\n throw ExitError(\n \"When using strict validation you must either pass { validation: false } in order to explicitly tell that no input will be received, or pass `undefined` for each input type e.g { validation: { query: undefined } } in order to deny the input of given request input.\"\n );\n\n if (\n !validationConfig?.resolver &&\n Object.keys(config.validation || {}).length > 0\n )\n throw ExitError(\n `Trying to pass validators into route ${route} config validation option without choosing a validation resolver under arkos.init({ validation: { resolver: '' } })`\n );\n\n if (config.authentication && !authenticationConfig?.mode)\n throw ExitError(\n `Trying to authenticate route ${route} without choosing an authentication mode under arkos.config.${getUserFileExtension()}\n\nFor further help see https://www.arkosjs.com/docs/core-concepts/authentication/setup.`\n );\n\n handlers = [...getMiddlewareStack(config), ...handlers];\n\n if (handlers.length === 0)\n throw ExitError(\n `No handlers provided for route ${method.toUpperCase()} ${path}.`\n );\n\n if (\n config.experimental?.uploads &&\n config.experimental.uploads.deleteOnError !== false\n )\n handlers.push(\n catchAsync(\n uploadManager.handleFileCleanup(config.experimental.uploads),\n { type: \"error\" }\n )\n );\n\n return originalMethod.call(target, path, ...handlers);\n };\n }\n\n return originalMethod;\n },\n });\n}\n"]}
1
+ {"version":3,"file":"apply-arkos-router-proxy.js","sourceRoot":"","sources":["../../../../../../src/utils/arkos-router/utils/helpers/apply-arkos-router-proxy.ts"],"names":[],"mappings":"AASA,OAAO,oBAAoB,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,GAAG,CAAC;AACpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,mBAAmB,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AAC/D,OAAO,SAAS,MAAM,mCAAmC,CAAC;AAC1D,OAAO,SAAS,MAAM,6BAA6B,CAAC;AACpD,OAAO,aAAa,MAAM,kBAAkB,CAAC;AAM7C,OAAO,gBAAgB,MAAM,gDAAgD,CAAC;AAC9E,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,iBA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express\";\nimport {\n ArkosRouteConfig,\n ArkosUseConfig,\n IArkosRoute,\n IArkosRouter,\n InternalIArkosRouter,\n PathParams,\n} from \"../../types\";\nimport RouteConfigValidator from \"../../route-config-validator\";\nimport { applyPrefix, getMiddlewareStack } from \".\";\nimport { getUserFileExtension } from \"../../../helpers/fs.helpers\";\nimport RouteConfigRegistry from \"../../route-config-registry\";\nimport { catchAsync } from \"../../../../exports/error-handler\";\nimport deepmerge from \"../../../helpers/deepmerge.helper\";\nimport ExitError from \"../../../helpers/exit-error\";\nimport uploadManager from \"./upload-manager\";\nimport { ArkosAnyRequestHandler } from \"../../../../types\";\nimport { ArkosRouterOptions } from \"../..\";\nimport { UploadConfig } from \"../../types/upload-config\";\nimport { Arkos, ArkosLoadable } from \"../../../../types/arkos\";\nimport { Express } from \"express\";\nimport loadableRegistry from \"../../../../components/arkos-loadable-registry\";\nimport { state } from \"../../../../app\";\nimport { docsLink } from \"../../../../app\";\nimport { isUsingAuthentication, getArkosConfig } from \"../../../helpers/arkos-config.helpers\";\n\nconst flattenHandlers = (arr: any[]): ArkosAnyRequestHandler[] => {\n return arr.reduce((flat, item) => {\n return flat.concat(Array.isArray(item) ? flattenHandlers(item) : item);\n }, []);\n};\n\nexport function applyArkosRouterProxy<T extends Express | IRouter>(\n target: T,\n options?: RouterOptions & ArkosRouterOptions,\n component: \"app\" | \"router\" = \"router\"\n): T extends Express ? Arkos : IArkosRouter {\n (target as InternalIArkosRouter)._arkos = {\n options,\n routes: [],\n };\n\n (target as any).load = (...items: ArkosLoadable[]) => {\n if (state !== \"idle\")\n throw ExitError(\n `app.load() must be called before app.${state === \"listening\" ? \"listen\" : \"build\"}(), see ${docsLink}`\n );\n\n if (Array.isArray(items[0])) items = items[0];\n items = Array.isArray(items) ? items : [items];\n\n items.forEach((item) => loadableRegistry.register(item));\n return target;\n };\n\n return new Proxy(target as any, {\n get(target, prop, receiver) {\n const originalMethod = Reflect.get(target, prop, receiver) as Function;\n\n const httpMethods = [\n \"get\",\n \"post\",\n \"put\",\n \"patch\",\n \"delete\",\n \"all\",\n \"head\",\n \"trace\",\n \"options\",\n ] as const;\n\n if (prop === \"use\") {\n return function(\n config: ArkosUseConfig | PathParams | ArkosAnyRequestHandler,\n ...handlers: (ArkosAnyRequestHandler | IArkosRouter)[]\n ) {\n // normalize function/router to ArkosUseConfig\n if (typeof config === \"function\" || Array.isArray(config)) {\n handlers = [config as ArkosAnyRequestHandler, ...handlers];\n config = {} as ArkosUseConfig;\n } else if (\n !config ||\n typeof config !== \"object\" ||\n typeof config === \"string\" ||\n config instanceof RegExp\n ) {\n throw ExitError(\n `First argument of ${component}.use() must be a valid ArkosRouteConfig object or a middleware function, but received ${typeof config === \"object\" ? JSON.stringify(config, null, 2) : config}.`\n );\n }\n\n if ((config as ArkosUseConfig).disabled) return;\n\n const useConfig = config as ArkosUseConfig;\n const path = applyPrefix(options?.prefix, useConfig.path ?? \"/\");\n\n const arkosConfig = getArkosConfig();\n const authenticationConfig = arkosConfig.authentication;\n\n // This is done because of Express v5 no longer\n // contains layer.regexp so we gotta build\n // the route reverse feature from ground up\n handlers.forEach((h: any) => {\n if (h && typeof h === \"function\" && h._arkos) {\n h._arkos.options = {\n ...h._arkos.options,\n prefix: path,\n };\n }\n });\n\n if (useConfig.authentication && !authenticationConfig?.mode)\n throw ExitError(\n `Trying to authenticate route ${path ? `${path}` : \"\"} without choosing an authentication mode under arkos.config.${getUserFileExtension()}\n\nFor further help see https://www.arkosjs.com/docs/core-concepts/authentication/setup.`\n );\n\n const flatHandlers = flattenHandlers(handlers);\n\n handlers = flatHandlers.map((handler: ArkosAnyRequestHandler) => {\n if (!handler || typeof handler !== \"function\")\n throw ExitError(\n `Wrong value for handler in route ${path}, recevied ${handler}.`\n );\n\n return \"param\" in handler\n ? handler\n : catchAsync(handler, {\n type: handler.length > 3 ? \"error\" : \"normal\",\n });\n });\n\n const middlewareStack = getMiddlewareStack(useConfig);\n const allHandlers = [...middlewareStack, ...handlers];\n\n return originalMethod.call(target, path, ...allHandlers);\n };\n }\n\n if (prop === \"route\") {\n return function(path: PathParams) {\n const routeChain: any = {};\n\n httpMethods.forEach((method) => {\n routeChain[method] = function(\n config: ArkosAnyRequestHandler | Omit<ArkosRouteConfig, \"path\">,\n ...handlers: ArkosAnyRequestHandler[]\n ) {\n if (typeof config === \"function\" || Array.isArray(config))\n throw ExitError(\n `First argument of ${component}.route(\"${path}\").${method}() must be a valid ArkosRouteConfig object without path field, but received ${typeof config === \"object\" ? JSON.stringify(config, null, 2) : config}`\n );\n\n\n const fullConfig: ArkosRouteConfig = {\n ...config,\n path,\n authentication: config.authentication === undefined && isUsingAuthentication() ? true : config.authentication\n };\n\n receiver[method](fullConfig, ...handlers);\n return routeChain as IArkosRoute;\n };\n });\n\n return routeChain;\n };\n }\n\n if (httpMethods.includes(prop as any)) {\n return function(\n config: ArkosRouteConfig,\n ...handlers: ArkosAnyRequestHandler[]\n ) {\n if (!config || !RouteConfigValidator.isArkosRouteConfig(config))\n throw ExitError(\n `First argument of ${component}.${prop as string}() must be a valid ArkosRouteConfig object with path field, but recevied ${typeof config === \"object\" ? JSON.stringify(config, null, 2) : config}`\n );\n\n if (config?.disabled) return;\n\n const path = applyPrefix(options?.prefix, config.path);\n\n config = {\n authentication: config?.authentication === undefined && isUsingAuthentication() ? true : config?.authentication,\n ...config,\n ...(options?.openapi\n ? {\n experimental: {\n ...config?.experimental,\n openapi: deepmerge(\n options.openapi || {},\n config?.experimental?.openapi || {}\n ),\n },\n }\n : {}),\n path,\n };\n\n config = {\n ...config,\n ...(options?.uploads\n ? {\n experimental: {\n ...config?.experimental,\n ...((config?.experimental?.uploads\n ? {\n uploads: deepmerge(\n options.uploads,\n config.experimental.uploads\n ),\n }\n : {}) as UploadConfig),\n },\n }\n : {}),\n path,\n };\n\n if ([null, undefined].includes(path as any))\n throw new Error(\n \"Please pass valid value for path field to use in your route\"\n );\n\n const method = prop as string;\n const UndefinedHandlerError = (handler: any) =>\n ExitError(\n `Wrong value for handler in route ${method.toUpperCase()} ${path}, recevied ${handler}.`\n );\n\n if (handlers.length > 0) {\n const flatHandlers = flattenHandlers(handlers);\n\n handlers = flatHandlers.map((handler: ArkosAnyRequestHandler) => {\n if (!handler || typeof handler !== \"function\")\n throw UndefinedHandlerError(handler);\n\n return catchAsync(handler, {\n type: handler.length > 3 ? \"error\" : \"normal\",\n });\n });\n\n const finalHandler = handlers[handlers.length - 1];\n RouteConfigRegistry.register(finalHandler, config, method);\n (target as InternalIArkosRouter)._arkos.routes.push({\n handler: finalHandler,\n config,\n method,\n });\n }\n\n const arkosConfig = getArkosConfig();\n const validationConfig = arkosConfig.validation;\n const authenticationConfig = arkosConfig.authentication;\n const strictValidation = validationConfig?.strict;\n const route = `${method.toUpperCase()} ${path}`;\n\n if (\n strictValidation &&\n (!(\"validation\" in config) ||\n (\"validation\" in config &&\n !config.validation &&\n config.validation !== undefined))\n )\n throw ExitError(\n \"When using strict validation you must either pass { validation: false } in order to explicitly tell that no input will be received, or pass `undefined` for each input type e.g { validation: { query: undefined } } in order to deny the input of given request input.\"\n );\n\n if (\n !validationConfig?.resolver &&\n Object.keys(config.validation || {}).length > 0\n )\n throw ExitError(\n `Trying to pass validators into route ${route} config validation option without choosing a validation resolver under arkos.init({ validation: { resolver: '' } })`\n );\n\n if (config.authentication && !isUsingAuthentication())\n throw ExitError(\n `Trying to authenticate route ${route} without choosing an authentication mode under arkos.config.${getUserFileExtension()}\n\nFor further help see https://www.arkosjs.com/docs/core-concepts/authentication/setup.`\n );\n\n handlers = [...getMiddlewareStack(config), ...handlers];\n\n if (handlers.length === 0)\n throw ExitError(\n `No handlers provided for route ${method.toUpperCase()} ${path}.`\n );\n\n if (\n config.experimental?.uploads &&\n config.experimental.uploads.deleteOnError !== false\n )\n handlers.push(\n catchAsync(\n uploadManager.handleFileCleanup(config.experimental.uploads),\n { type: \"error\" }\n )\n );\n\n return originalMethod.call(target, path, ...handlers);\n };\n }\n\n return originalMethod;\n },\n });\n}\n"]}
@@ -11,6 +11,6 @@ export function killServerChildProcess() {
11
11
  killProductionServerChildProcess();
12
12
  }
13
13
  export function getVersion() {
14
- return "2.0.0-next.25";
14
+ return "2.0.0-next.26";
15
15
  }
16
16
  //# sourceMappingURL=cli.helpers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"arkos-config.helpers.js","sourceRoot":"","sources":["../../../../src/utils/helpers/arkos-config.helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAmB,MAAM,kBAAkB,CAAC;AACjE,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,SAAS,MAAM,cAAc,CAAC;AACrC,OAAO,KAAK,SAAS,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,CAAC,wCAAwC,CAAC,CAAC;AAE3C,IAAI,kBAAkB,GAAQ,EAAE,CAAC;AAEjC,IAAI,CAAC;IACH,kBAAkB,GAAG,0BAA0B,CAAC;AAClD,CAAC;AAAC,OAAO,GAAQ,EAAE,CAAC;IAClB,IAAI,GAAG,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,oBAAoB,CAAC;QAC1D,IAAI,CAAC,IAAI,CACP,+CAA+C,SAAS,CAAC,oBAAoB,EAAE,gBAAgB,EAC/F;YACE,SAAS,EAAE,IAAI;SAChB,CACF,CAAC;;QACC,MAAM,GAAG,CAAC;AACjB,CAAC;AAED,MAAM,UAAU,qBAAqB;IACnC,MAAM,EAAE,cAAc,EAAE,GAAG,cAAc,EAAE,CAAC;IAE5C,OAAO,cAAc,EAAE,IAAI,CAAC;AAC9B,CAAC;AAED,MAAM,UAAU,uBAAuB;IACrC,MAAM,EAAE,cAAc,EAAE,GAAG,cAAc,EAAE,CAAC;IAE5C,OAAO,cAAc,EAAE,IAAI,IAAI,cAAc,EAAE,OAAO,KAAK,KAAK,CAAC;AACnE,CAAC;AAOD,MAAM,UAAU,cAAc;IAC5B,MAAM,MAAM,GACV,OAAO,kBAAkB,KAAK,QAAQ;QACpC,CAAC,CAAC,EAAE,QAAQ,EAAE,cAAc,EAAE;QAC9B,CAAC,CAAE,kBAA0B,EAAE,OAAO,IAAI,EAAE,QAAQ,EAAE,cAAc,EAAE,CAAC;IAC3E,MAAM,UAAU,GAAG,gBAAgB,SAAS,CAAC,oBAAoB,EAAE,EAAE,CAAC;IAEtE,IACG,MAAc,CAAC,QAAQ,KAAK,cAAc;QAE3C,OAAO,IAAI,IAAI,WAAW;QAC1B,OAAO,kBAAkB,KAAK,QAAQ,EACtC,CAAC;QACD,IAAI,CAAC,KAAK,CACR,0BAA0B,UAAU,8GAA8G,UAAU;;;;;;;CAOjK,CACI,CAAC;QACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,OAAO,YAAY,CAAC,MAAM,CAAQ,CAAC;AACrC,CAAC;AAOD,MAAM,UAAU,YAAY;IAC1B,OAAO,OAAO,CAAC,GAAG,CAAC,WAAW,KAAK,MAAM,CAAC;AAC5C,CAAC;AAED,MAAM,UAAU,mBAAmB;IACjC,MAAM,MAAM,GAAG,cAAc,EAAE,CAAC;IAChC,MAAM,qBAAqB,GAAG,uBAAuB,EAAE,CAAC;IAExD,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU;QAC7B,MAAM,SAAS,CACb,gHAAgH,CACjH,CAAC;IAEJ,IACE,qBAAqB;QACrB,YAAY,EAAE;QACd,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU;QACvB,CAAC,MAAM,CAAC,cAAc,EAAE,GAAG,EAAE,MAAM;QAEnC,MAAM,SAAS,CACb,qHAAqH,CACtH,CAAC;IAEJ,IAAI,qBAAqB,IAAI,CAAC,iBAAiB,EAAE;QAC/C,MAAM,SAAS,CACb,2LAA2L,CAC5L,CAAC;AACN,CAAC","sourcesContent":["import { defineConfig, UserArkosConfig } from \"../define-config\";\nimport sheu from \"../sheu\";\nimport ExitError from \"./exit-error\";\nimport * as fsHelpers from \"./fs.helpers\";\nimport { getPrismaInstance } from \"./prisma.helpers\";\n(\"ReplaceWithNeededImportsForArkosConfig\"); // This will be filled by post build script\n\nlet definedArkosConfig: any = {};\n\ntry {\n definedArkosConfig = \"ReplaceWithDynamicImport\"; // This will be filled by post build script\n} catch (err: any) {\n if (err.message.toLowerCase().includes(\"cannot find module\"))\n sheu.warn(\n `Using default configs, because arkos.config.${fsHelpers.getUserFileExtension()} was not found`,\n {\n timestamp: true,\n }\n );\n else throw err;\n}\n\nexport function isUsingAuthentication() {\n const { authentication } = getArkosConfig();\n\n return authentication?.mode;\n}\n\nexport function isAuthenticationEnabled() {\n const { authentication } = getArkosConfig();\n\n return authentication?.mode && authentication?.enabled !== false;\n}\n\n/**\n * Gives access to the underlying current configurations being used by **Arkos** by default and also loaded through `arkos.config.{ts|js}`\n *\n * @returns {ArkosConfig}\n */\nexport function getArkosConfig(): UserArkosConfig {\n const config =\n typeof definedArkosConfig === \"string\"\n ? { __loader: \"defineConfig\" }\n : (definedArkosConfig as any)?.default || { __loader: \"defineConfig\" };\n const configFile = `arkos.config.${fsHelpers.getUserFileExtension()}`;\n\n if (\n (config as any).__loader !== \"defineConfig\" &&\n //@ts-ignore\n typeof jest == \"undefined\" &&\n typeof definedArkosConfig === \"object\"\n ) {\n sheu.error(\n `From v1.6 config under ${configFile} must be wrapped in \\`defineConfig()\\` function from \\`arkos/config\\`. You can do the following under your ${configFile}:\n\nimport { defineConfig } from \"arkos/config\"\n\nconst config = defineConfig({ ... })\n\nexport default config\n`\n );\n process.exit(1);\n }\n\n return defineConfig(config) as any;\n}\n\n/**\n * Returns true if application is being run through `arkos start` after `arkos build`\n *\n * @since 1.5.16-beta\n */\nexport function isProduction() {\n return process.env.ARKOS_BUILD === \"true\";\n}\n\nexport function validateArkosConfig() {\n const config = getArkosConfig();\n const authenticationEnabled = isAuthenticationEnabled();\n\n if (!config?.source?.entryPoint)\n throw ExitError(\n `Invalid value for 'arkosConfig.source.entryPoint', please pass a valid path from the current working directory`\n );\n\n if (\n authenticationEnabled &&\n isProduction() &&\n !process.env.JWT_SECRET &&\n !config.authentication?.jwt?.secret\n )\n throw ExitError(\n `Missing jwt secret in production, see https://www.arkosjs.com/docs/core-concepts/authentication/setup#configuration`\n );\n\n if (authenticationEnabled && !getPrismaInstance())\n throw ExitError(\n `Arkos' authentication system relies on prisma instance, please disabled your authentication or see https://www.arkosjs.com/docs/core-concepts/prisma-orm/setup to setup a prisma instance`\n );\n}\n"]}
1
+ {"version":3,"file":"arkos-config.helpers.js","sourceRoot":"","sources":["../../../../src/utils/helpers/arkos-config.helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAmB,MAAM,kBAAkB,CAAC;AACjE,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,SAAS,MAAM,cAAc,CAAC;AACrC,OAAO,KAAK,SAAS,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,CAAC,wCAAwC,CAAC,CAAC;AAE3C,IAAI,kBAAkB,GAAQ,EAAE,CAAC;AAEjC,IAAI,CAAC;IACH,kBAAkB,GAAG,0BAA0B,CAAC;AAClD,CAAC;AAAC,OAAO,GAAQ,EAAE,CAAC;IAClB,IAAI,GAAG,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,oBAAoB,CAAC;QAC1D,IAAI,CAAC,IAAI,CACP,+CAA+C,SAAS,CAAC,oBAAoB,EAAE,gBAAgB,EAC/F;YACE,SAAS,EAAE,IAAI;SAChB,CACF,CAAC;;QACC,MAAM,GAAG,CAAC;AACjB,CAAC;AAED,MAAM,UAAU,qBAAqB;IACnC,MAAM,EAAE,cAAc,EAAE,GAAG,cAAc,EAAE,CAAC;IAC5C,OAAO,cAAc,EAAE,IAAI,CAAC;AAC9B,CAAC;AAED,MAAM,UAAU,uBAAuB;IACrC,MAAM,EAAE,cAAc,EAAE,GAAG,cAAc,EAAE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M,SAAS,CACb,2LAA2L,CAC5L,CAAC;AACN,CAAC","sourcesContent":["import { defineConfig, UserArkosConfig } from \"../define-config\";\nimport sheu from \"../sheu\";\nimport ExitError from \"./exit-error\";\nimport * as fsHelpers from \"./fs.helpers\";\nimport { getPrismaInstance } from \"./prisma.helpers\";\n(\"ReplaceWithNeededImportsForArkosConfig\"); // This will be filled by post build script\n\nlet definedArkosConfig: any = {};\n\ntry {\n definedArkosConfig = \"ReplaceWithDynamicImport\"; // This will be filled by post build script\n} catch (err: any) {\n if (err.message.toLowerCase().includes(\"cannot find module\"))\n sheu.warn(\n `Using default configs, because arkos.config.${fsHelpers.getUserFileExtension()} was not found`,\n {\n timestamp: true,\n }\n );\n else throw err;\n}\n\nexport function isUsingAuthentication() {\n const { authentication } = getArkosConfig();\n return authentication?.mode;\n}\n\nexport function isAuthenticationEnabled() {\n const { authentication } = getArkosConfig();\n return authentication?.mode && authentication?.enabled !== false;\n}\n\n/**\n * Gives access to the underlying current configurations being used by **Arkos** by default and also loaded through `arkos.config.{ts|js}`\n *\n * @returns {ArkosConfig}\n */\nexport function getArkosConfig(): UserArkosConfig {\n const config =\n typeof definedArkosConfig === \"string\"\n ? { __loader: \"defineConfig\" }\n : (definedArkosConfig as any)?.default || { __loader: \"defineConfig\" };\n const configFile = `arkos.config.${fsHelpers.getUserFileExtension()}`;\n\n if (\n (config as any).__loader !== \"defineConfig\" &&\n //@ts-ignore\n typeof jest == \"undefined\" &&\n typeof definedArkosConfig === \"object\"\n ) {\n sheu.error(\n `From v1.6 config under ${configFile} must be wrapped in \\`defineConfig()\\` function from \\`arkos/config\\`. You can do the following under your ${configFile}:\n\nimport { defineConfig } from \"arkos/config\"\n\nconst config = defineConfig({ ... })\n\nexport default config\n`\n );\n process.exit(1);\n }\n\n return defineConfig(config) as any;\n}\n\n/**\n * Returns true if application is being run through `arkos start` after `arkos build`\n *\n * @since 1.5.16-beta\n */\nexport function isProduction() {\n return process.env.ARKOS_BUILD === \"true\";\n}\n\nexport function validateArkosConfig() {\n const config = getArkosConfig();\n const authenticationEnabled = isAuthenticationEnabled();\n\n if (!config?.source?.entryPoint)\n throw ExitError(\n `Invalid value for 'arkosConfig.source.entryPoint', please pass a valid path from the current working directory`\n );\n\n if (\n authenticationEnabled &&\n isProduction() &&\n !process.env.JWT_SECRET &&\n !config.authentication?.jwt?.secret\n )\n throw ExitError(\n `Missing jwt secret in production, see https://www.arkosjs.com/docs/core-concepts/authentication/setup#configuration`\n );\n\n if (authenticationEnabled && !getPrismaInstance())\n throw ExitError(\n `Arkos' authentication system relies on prisma instance, please disabled your authentication or see https://www.arkosjs.com/docs/core-concepts/prisma-orm/setup to setup a prisma instance`\n );\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arkos",
3
- "version": "2.0.0-next.25",
3
+ "version": "2.0.0-next.26",
4
4
  "type": "module",
5
5
  "description": "The Express & Prisma RESTful Framework",
6
6
  "main": "dist/esm/exports/index.js",