@joystick.js/node-canary 0.0.0-canary.47 → 0.0.0-canary.470
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/.build/getFilesToBuild.js +26 -0
- package/.build/getPlatformSafeFilePath.js +6 -0
- package/.build/getPlatformSafePath.js +6 -0
- package/.build/index.js +88 -0
- package/.build/isWindows.js +3 -0
- package/dist/action/class.js +1 -82
- package/dist/action/index.js +1 -8
- package/dist/app/accounts/default_user_output_fields.js +1 -0
- package/dist/app/accounts/delete_user.js +1 -0
- package/dist/app/accounts/generate_account_session.js +1 -0
- package/dist/app/accounts/generate_password_reset_token.js +1 -0
- package/dist/app/accounts/get_browser_safe_user.js +1 -0
- package/dist/app/accounts/has_login_token_expired.js +1 -0
- package/dist/app/accounts/index.js +1 -29
- package/dist/app/accounts/login.js +1 -59
- package/dist/app/accounts/recover_password.js +1 -0
- package/dist/app/accounts/reset_password.js +1 -0
- package/dist/app/accounts/roles/add.js +1 -7
- package/dist/app/accounts/roles/grant.js +1 -7
- package/dist/app/accounts/roles/index.js +1 -17
- package/dist/app/accounts/roles/list.js +1 -7
- package/dist/app/accounts/roles/remove.js +1 -7
- package/dist/app/accounts/roles/revoke.js +1 -7
- package/dist/app/accounts/roles/user_has_role.js +1 -0
- package/dist/app/accounts/send_email_verification.js +1 -0
- package/dist/app/accounts/set_account_cookie.js +1 -0
- package/dist/app/accounts/set_password.js +1 -0
- package/dist/app/accounts/signup.js +1 -97
- package/dist/app/accounts/unset_account_cookie.js +1 -0
- package/dist/app/accounts/verify_email.js +1 -0
- package/dist/app/api/accounts/authenticated.js +1 -0
- package/dist/app/api/accounts/login.js +1 -0
- package/dist/app/api/accounts/logout.js +1 -0
- package/dist/app/api/accounts/recover_password.js +1 -0
- package/dist/app/api/accounts/reset_password.js +1 -0
- package/dist/app/api/accounts/signup.js +1 -0
- package/dist/app/api/accounts/user.js +1 -0
- package/dist/app/api/accounts/verify_email.js +1 -0
- package/dist/app/api/format_api_error.js +1 -0
- package/dist/app/api/get.js +2 -0
- package/dist/app/api/get_api_context.js +1 -0
- package/dist/app/api/get_api_for_data_functions.js +1 -0
- package/dist/app/api/get_api_url_component.js +1 -0
- package/dist/app/api/get_output.js +1 -0
- package/dist/app/api/get_value_from_object.js +1 -0
- package/dist/app/api/handle_api_error.js +1 -0
- package/dist/app/api/input_validators.js +1 -0
- package/dist/app/api/is_array_path.js +1 -0
- package/dist/app/api/push/health.js +2 -0
- package/dist/app/api/register_getters.js +1 -0
- package/dist/app/api/register_setters.js +1 -0
- package/dist/app/api/sanitize_api_response.js +1 -0
- package/dist/app/api/set.js +2 -0
- package/dist/app/api/test/accounts/delete.js +1 -0
- package/dist/app/api/test/accounts/signup.js +1 -0
- package/dist/app/api/test/bootstrap.js +1 -0
- package/dist/app/api/test/process.js +1 -0
- package/dist/app/api/test/queues.js +1 -0
- package/dist/app/api/validate_input.js +1 -0
- package/dist/app/api/validate_session.js +1 -0
- package/dist/app/api/validate_type.js +1 -0
- package/dist/app/browser/hmr_client.js +1 -0
- package/dist/app/browser/process_polyfill.js +1 -0
- package/dist/app/cron_jobs/register.js +1 -0
- package/dist/app/databases/database_type_map.js +1 -0
- package/dist/app/databases/get_target_database_connection.js +1 -0
- package/dist/app/databases/mongodb/available_query_parameters.js +1 -0
- package/dist/app/databases/mongodb/build_connection_string.js +1 -0
- package/dist/app/databases/mongodb/build_query_parameters.js +1 -0
- package/dist/app/databases/mongodb/connect.js +6 -0
- package/dist/app/databases/mongodb/create_indexes.js +1 -0
- package/dist/app/databases/postgresql/accounts/create_accounts_metadata_table_columns.js +1 -0
- package/dist/app/databases/postgresql/connect.js +30 -0
- package/dist/app/databases/postgresql/create_indexes.js +1 -0
- package/dist/app/databases/postgresql/create_tables.js +1 -0
- package/dist/app/databases/postgresql/handle_cleanup_queues.js +5 -0
- package/dist/app/databases/postgresql/handle_cleanup_sessions.js +1 -0
- package/dist/app/databases/queries/accounts.js +1 -0
- package/dist/app/databases/queries/map.js +1 -0
- package/dist/app/databases/queries/mongodb/accounts.js +1 -0
- package/dist/app/databases/queries/mongodb/queues.js +1 -0
- package/dist/app/databases/queries/mongodb/sessions.js +1 -0
- package/dist/app/databases/queries/postgresql/accounts.js +1 -0
- package/dist/app/databases/queries/postgresql/queues.js +123 -0
- package/dist/app/databases/queries/postgresql/sessions.js +14 -0
- package/dist/app/databases/queries/sessions.js +1 -0
- package/dist/app/databases/register_database.js +1 -0
- package/dist/app/databases/sql.js +1 -0
- package/dist/app/email/send.js +1 -0
- package/dist/app/email/validate_smtp_settings.js +1 -0
- package/dist/app/fixture/index.js +1 -0
- package/dist/app/generate_machine_id.js +1 -0
- package/dist/app/generate_process_id.js +1 -0
- package/dist/app/get_ssl_certificates.js +1 -0
- package/dist/app/handle_process_errors.js +1 -0
- package/dist/app/index.js +1 -656
- package/dist/app/middleware/account.js +1 -0
- package/dist/app/middleware/body_parser.js +1 -0
- package/dist/app/middleware/build_error.js +1 -0
- package/dist/app/middleware/built_in.js +1 -0
- package/dist/app/middleware/context.js +1 -0
- package/dist/app/middleware/cors.js +1 -22
- package/dist/app/middleware/csp.js +1 -48
- package/dist/app/middleware/generate_insecure_page.js +65 -0
- package/dist/app/middleware/generate_joystick_error_page.js +147 -0
- package/dist/app/middleware/hmr_client.js +1 -0
- package/dist/app/middleware/insecure.js +1 -11
- package/dist/app/middleware/process_browser_polyfill.js +1 -0
- package/dist/app/middleware/render/get_url.js +1 -0
- package/dist/app/middleware/render/index.js +1 -0
- package/dist/app/middleware/request_methods.js +1 -0
- package/dist/app/middleware/session.js +1 -24
- package/dist/app/push_logs.js +1 -0
- package/dist/app/queues/index.js +1 -119
- package/dist/app/register_app_options.js +1 -0
- package/dist/app/routes/register_route_from_function.js +1 -0
- package/dist/app/routes/register_route_from_object.js +1 -0
- package/dist/app/routes/supported_http_methods.js +1 -0
- package/dist/app/settings/load.js +1 -0
- package/dist/app/ssr/index.js +33 -0
- package/dist/app/ssr/set_base_attributes_in_html.js +1 -0
- package/dist/app/ssr/set_head_tags_in_html.js +1 -0
- package/dist/app/start_express.js +1 -0
- package/dist/app/start_node_as_cluster.js +1 -0
- package/dist/app/uploaders/local_upload_progress_middleware.js +1 -0
- package/dist/app/uploaders/register.js +1 -0
- package/dist/app/uploaders/run_upload.js +1 -0
- package/dist/app/uploaders/validate_options.js +1 -0
- package/dist/app/uploaders/validate_uploads.js +1 -0
- package/dist/app/websockets/emit_event.js +1 -0
- package/dist/app/websockets/index.js +1 -0
- package/dist/app/websockets/register.js +1 -0
- package/dist/index.js +4 -76
- package/dist/lib/camel_pascal_to_snake.js +1 -0
- package/dist/lib/constants.js +1 -13
- package/dist/lib/dynamic_import.js +1 -0
- package/dist/lib/escape_html.js +1 -0
- package/dist/lib/escape_key_value_pair.js +1 -0
- package/dist/lib/float_to_decimal_place.js +1 -0
- package/dist/lib/generate_id.js +1 -0
- package/dist/lib/get_browser_safe_request.js +1 -0
- package/dist/lib/get_joystick_build_path.js +1 -0
- package/dist/lib/get_origin.js +1 -0
- package/dist/lib/get_platform_safe_path.js +1 -0
- package/dist/lib/get_sanitized_context.js +1 -0
- package/dist/lib/get_translations.js +1 -0
- package/dist/lib/hash_string.js +1 -0
- package/dist/lib/is_valid_json.js +1 -0
- package/dist/lib/log.js +13 -49
- package/dist/lib/node_path_polyfills.js +1 -0
- package/dist/lib/parse_json.js +1 -0
- package/dist/lib/path_exists.js +1 -0
- package/dist/lib/rainbow_road.js +1 -0
- package/dist/lib/serialize_query_parameters.js +1 -0
- package/dist/lib/set_cookie.js +1 -0
- package/dist/lib/string_to_slug.js +1 -0
- package/dist/lib/timestamps.js +1 -0
- package/dist/lib/types.js +1 -0
- package/dist/lib/unset_cookie.js +1 -0
- package/dist/lib/wait.js +1 -0
- package/dist/test/track_function_call.js +1 -0
- package/increment_version.js +3 -0
- package/package.json +27 -44
- package/src/action/class.js +137 -0
- package/src/action/index.js +8 -0
- package/src/app/accounts/default_user_output_fields.js +10 -0
- package/src/app/accounts/delete_user.js +18 -0
- package/src/app/accounts/generate_account_session.js +11 -0
- package/src/app/accounts/generate_password_reset_token.js +16 -0
- package/src/app/accounts/get_browser_safe_user.js +29 -0
- package/src/app/accounts/has_login_token_expired.js +9 -0
- package/src/app/accounts/index.js +38 -0
- package/src/app/accounts/login.js +82 -0
- package/src/app/accounts/recover_password.js +58 -0
- package/src/app/accounts/reset_password.js +69 -0
- package/src/app/accounts/roles/add.js +7 -0
- package/src/app/accounts/roles/grant.js +7 -0
- package/src/app/accounts/roles/index.js +18 -0
- package/src/app/accounts/roles/list.js +7 -0
- package/src/app/accounts/roles/remove.js +7 -0
- package/src/app/accounts/roles/revoke.js +7 -0
- package/src/app/accounts/roles/user_has_role.js +7 -0
- package/src/app/accounts/send_email_verification.js +48 -0
- package/src/app/accounts/set_account_cookie.js +12 -0
- package/src/app/accounts/set_password.js +46 -0
- package/src/app/accounts/signup.js +158 -0
- package/src/app/accounts/unset_account_cookie.js +12 -0
- package/src/app/accounts/verify_email.js +32 -0
- package/src/app/api/accounts/authenticated.js +17 -0
- package/src/app/api/accounts/login.js +36 -0
- package/src/app/api/accounts/logout.js +20 -0
- package/src/app/api/accounts/recover_password.js +16 -0
- package/src/app/api/accounts/reset_password.js +24 -0
- package/src/app/api/accounts/signup.js +49 -0
- package/src/app/api/accounts/user.js +21 -0
- package/src/app/api/accounts/verify_email.js +11 -0
- package/src/app/api/format_api_error.js +10 -0
- package/src/app/api/get.js +119 -0
- package/src/app/api/get_api_context.js +27 -0
- package/src/app/api/get_api_for_data_functions.js +37 -0
- package/src/app/api/get_api_url_component.js +5 -0
- package/src/app/api/get_output.js +116 -0
- package/src/app/api/get_value_from_object.js +8 -0
- package/src/app/api/handle_api_error.js +28 -0
- package/src/app/api/input_validators.js +227 -0
- package/src/app/api/is_array_path.js +6 -0
- package/src/app/api/push/health.js +17 -0
- package/src/app/api/register_getters.js +57 -0
- package/src/app/api/register_setters.js +55 -0
- package/src/app/api/sanitize_api_response.js +35 -0
- package/src/app/api/set.js +119 -0
- package/src/app/api/test/accounts/delete.js +8 -0
- package/src/app/api/test/accounts/signup.js +50 -0
- package/src/app/api/test/bootstrap.js +39 -0
- package/src/app/api/test/process.js +7 -0
- package/src/app/api/test/queues.js +25 -0
- package/src/app/api/validate_input.js +130 -0
- package/src/app/api/validate_session.js +20 -0
- package/src/app/api/validate_type.js +24 -0
- package/src/app/browser/hmr_client.js +196 -0
- package/src/app/browser/process_polyfill.js +11 -0
- package/src/app/cron_jobs/register.js +29 -0
- package/src/app/databases/database_type_map.js +6 -0
- package/src/app/databases/get_target_database_connection.js +25 -0
- package/{dist/app/databases/mongodb/availableQueryParameters.js → src/app/databases/mongodb/available_query_parameters.js} +3 -4
- package/src/app/databases/mongodb/build_connection_string.js +30 -0
- package/src/app/databases/mongodb/build_query_parameters.js +17 -0
- package/src/app/databases/mongodb/connect.js +42 -0
- package/src/app/databases/mongodb/create_indexes.js +35 -0
- package/src/app/databases/postgresql/accounts/create_accounts_metadata_table_columns.js +18 -0
- package/src/app/databases/postgresql/connect.js +128 -0
- package/src/app/databases/postgresql/create_indexes.js +58 -0
- package/src/app/databases/postgresql/create_tables.js +70 -0
- package/src/app/databases/postgresql/handle_cleanup_queues.js +36 -0
- package/src/app/databases/postgresql/handle_cleanup_sessions.js +5 -0
- package/src/app/databases/queries/accounts.js +17 -0
- package/src/app/databases/queries/map.js +21 -0
- package/src/app/databases/queries/mongodb/accounts.js +360 -0
- package/src/app/databases/queries/mongodb/queues.js +164 -0
- package/src/app/databases/queries/mongodb/sessions.js +22 -0
- package/src/app/databases/queries/postgresql/accounts.js +379 -0
- package/src/app/databases/queries/postgresql/queues.js +294 -0
- package/src/app/databases/queries/postgresql/sessions.js +37 -0
- package/src/app/databases/queries/sessions.js +17 -0
- package/src/app/databases/register_database.js +30 -0
- package/src/app/databases/sql.js +63 -0
- package/src/app/email/send.js +108 -0
- package/src/app/email/validate_smtp_settings.js +53 -0
- package/src/app/fixture/index.js +50 -0
- package/src/app/generate_machine_id.js +26 -0
- package/src/app/generate_process_id.js +30 -0
- package/src/app/get_ssl_certificates.js +23 -0
- package/src/app/handle_process_errors.js +101 -0
- package/src/app/index.js +253 -0
- package/src/app/middleware/account.js +28 -0
- package/src/app/middleware/body_parser.js +18 -0
- package/src/app/middleware/build_error.js +18 -0
- package/src/app/middleware/built_in.js +76 -0
- package/src/app/middleware/context.js +34 -0
- package/src/app/middleware/cors.js +23 -0
- package/src/app/middleware/csp.js +54 -0
- package/src/app/middleware/generate_insecure_page.js +71 -0
- package/{dist/lib/generateErrorPage.js → src/app/middleware/generate_joystick_error_page.js} +25 -21
- package/src/app/middleware/hmr_client.js +12 -0
- package/src/app/middleware/insecure.js +22 -0
- package/src/app/middleware/process_browser_polyfill.js +12 -0
- package/src/app/middleware/render/get_url.js +15 -0
- package/src/app/middleware/render/index.js +93 -0
- package/src/app/middleware/request_methods.js +21 -0
- package/src/app/middleware/session.js +31 -0
- package/src/app/push_logs.js +44 -0
- package/src/app/queues/index.js +268 -0
- package/src/app/register_app_options.js +7 -0
- package/src/app/routes/register_route_from_function.js +10 -0
- package/src/app/routes/register_route_from_object.js +34 -0
- package/src/app/routes/supported_http_methods.js +9 -0
- package/src/app/settings/load.js +33 -0
- package/src/app/ssr/index.js +133 -0
- package/src/app/ssr/set_base_attributes_in_html.js +43 -0
- package/src/app/ssr/set_head_tags_in_html.js +104 -0
- package/src/app/start_express.js +50 -0
- package/src/app/start_node_as_cluster.js +30 -0
- package/src/app/uploaders/local_upload_progress_middleware.js +24 -0
- package/src/app/uploaders/register.js +169 -0
- package/src/app/uploaders/run_upload.js +136 -0
- package/src/app/uploaders/validate_options.js +74 -0
- package/src/app/uploaders/validate_uploads.js +127 -0
- package/src/app/websockets/emit_event.js +14 -0
- package/src/app/websockets/index.js +16 -0
- package/src/app/websockets/register.js +175 -0
- package/src/index.js +81 -0
- package/{dist/lib/camelPascalToSnake.js → src/lib/camel_pascal_to_snake.js} +3 -4
- package/src/lib/constants.js +21 -0
- package/src/lib/dynamic_import.js +8 -0
- package/src/lib/escape_html.js +9 -0
- package/src/lib/escape_key_value_pair.js +15 -0
- package/src/lib/float_to_decimal_place.js +5 -0
- package/src/lib/generate_id.js +15 -0
- package/src/lib/get_browser_safe_request.js +17 -0
- package/src/lib/get_joystick_build_path.js +22 -0
- package/src/lib/get_origin.js +7 -0
- package/src/lib/get_platform_safe_path.js +8 -0
- package/src/lib/get_sanitized_context.js +51 -0
- package/src/lib/get_translations.js +109 -0
- package/src/lib/hash_string.js +7 -0
- package/src/lib/is_valid_json.js +10 -0
- package/src/lib/log.js +42 -0
- package/src/lib/node_path_polyfills.js +23 -0
- package/src/lib/parse_json.js +9 -0
- package/src/lib/path_exists.js +12 -0
- package/src/lib/rainbow_road.js +7 -0
- package/src/lib/serialize_query_parameters.js +7 -0
- package/src/lib/set_cookie.js +16 -0
- package/src/lib/string_to_slug.js +14 -0
- package/src/lib/timestamps.js +48 -0
- package/src/lib/types.js +59 -0
- package/src/lib/unset_cookie.js +11 -0
- package/src/lib/wait.js +9 -0
- package/src/test/track_function_call.js +16 -0
- package/README.md +0 -8
- package/_package.json +0 -63
- package/canary.js +0 -12
- package/dist/api/get.js +0 -29
- package/dist/api/getOrigin.js +0 -6
- package/dist/api/index.js +0 -9
- package/dist/api/set.js +0 -29
- package/dist/app/accounts/defaultUserOutputFields.js +0 -9
- package/dist/app/accounts/generateResetToken.js +0 -28
- package/dist/app/accounts/generateSession.js +0 -15
- package/dist/app/accounts/getBrowserSafeUser.js +0 -24
- package/dist/app/accounts/hasLoginTokenExpired.js +0 -17
- package/dist/app/accounts/hashString.js +0 -7
- package/dist/app/accounts/recoverPassword.js +0 -30
- package/dist/app/accounts/resetPassword.js +0 -73
- package/dist/app/accounts/roles/userHasRole.js +0 -7
- package/dist/app/accounts/runUserQuery.js +0 -15
- package/dist/app/accounts/sendEmailVerification.js +0 -65
- package/dist/app/accounts/setAuthenticationCookie.js +0 -11
- package/dist/app/accounts/setPassword.js +0 -45
- package/dist/app/accounts/unsetAuthenticationCookie.js +0 -11
- package/dist/app/accounts/verifyEmail.js +0 -46
- package/dist/app/databases/getTargetDatabase.js +0 -10
- package/dist/app/databases/getTargetDatabaseConnection.js +0 -19
- package/dist/app/databases/getTargetDatabaseProvider.js +0 -10
- package/dist/app/databases/mongodb/buildConnectionString.js +0 -22
- package/dist/app/databases/mongodb/buildQueryParameters.js +0 -14
- package/dist/app/databases/mongodb/index.js +0 -40
- package/dist/app/databases/mongodb/queries/accounts.js +0 -266
- package/dist/app/databases/mongodb/queries/queues.js +0 -111
- package/dist/app/databases/postgresql/addColumnToTable.js +0 -6
- package/dist/app/databases/postgresql/createAccountsIndexes.js +0 -21
- package/dist/app/databases/postgresql/createAccountsTables.js +0 -39
- package/dist/app/databases/postgresql/createDatabase.js +0 -0
- package/dist/app/databases/postgresql/index.js +0 -55
- package/dist/app/databases/postgresql/queries/accounts.js +0 -186
- package/dist/app/databases/postgresql/queries/queues.js +0 -211
- package/dist/app/databases/queryMap.js +0 -17
- package/dist/app/databases/typesMap.js +0 -7
- package/dist/app/getAPIContext.js +0 -25
- package/dist/app/getAPIURLComponent.js +0 -6
- package/dist/app/getBrowserSafeRequest.js +0 -14
- package/dist/app/getOutput.js +0 -74
- package/dist/app/handleProcessErrors.js +0 -73
- package/dist/app/initExpress.js +0 -41
- package/dist/app/middleware/bodyParser.js +0 -16
- package/dist/app/middleware/hmr/client.js +0 -113
- package/dist/app/middleware/index.js +0 -89
- package/dist/app/middleware/render.js +0 -213
- package/dist/app/middleware/requestMethods.js +0 -19
- package/dist/app/registerGetters.js +0 -45
- package/dist/app/registerSetters.js +0 -45
- package/dist/app/runGetter.js +0 -103
- package/dist/app/runSetter.js +0 -103
- package/dist/app/runUploader.js +0 -143
- package/dist/app/sanitizeAPIResponse.js +0 -27
- package/dist/app/utils/process.js +0 -193
- package/dist/app/validateSession.js +0 -19
- package/dist/app/validateUploaderOptions.js +0 -53
- package/dist/app/validateUploads.js +0 -102
- package/dist/email/render.js +0 -50
- package/dist/email/send.js +0 -55
- package/dist/email/templates/base.css +0 -194
- package/dist/email/templates/base.html +0 -28
- package/dist/email/templates/reset-password.js +0 -13
- package/dist/email/validateSMTPSettings.js +0 -27
- package/dist/lib/escapeHTML.js +0 -9
- package/dist/lib/escapeKeyValuePair.js +0 -13
- package/dist/lib/formatAPIError.js +0 -12
- package/dist/lib/formatErrorString.js +0 -8
- package/dist/lib/generateCookie.js +0 -14
- package/dist/lib/generateId.js +0 -13
- package/dist/lib/generateMachineId.js +0 -15
- package/dist/lib/getBuildPath.js +0 -10
- package/dist/lib/getErrorObject.js +0 -9
- package/dist/lib/getPlatformSafeFilePath.js +0 -8
- package/dist/lib/getPlatformSafePath.js +0 -8
- package/dist/lib/getSSLCertificates.js +0 -19
- package/dist/lib/isValidHTTPMethod.js +0 -7
- package/dist/lib/isValidJSONString.js +0 -11
- package/dist/lib/nodeUrlPolyfills.js +0 -14
- package/dist/lib/objectToSQLKeysString.js +0 -18
- package/dist/lib/objectToSQLValuesString.js +0 -16
- package/dist/lib/obscenedb/debounce.js +0 -12
- package/dist/lib/obscenedb/index.js +0 -61
- package/dist/lib/parseDatabasesFromEnvironment.js +0 -9
- package/dist/lib/rainbowRoad.js +0 -7
- package/dist/lib/readDirectory.js +0 -24
- package/dist/lib/replaceBackslashesWithForwardSlashes.js +0 -8
- package/dist/lib/replaceFileProtocol.js +0 -8
- package/dist/lib/replaceForwardSlashesWithBackslashes.js +0 -8
- package/dist/lib/serializeQueryParameters.js +0 -8
- package/dist/lib/serverAvailable.js +0 -0
- package/dist/lib/setCookie.js +0 -16
- package/dist/lib/supportedHTTPMethods.js +0 -4
- package/dist/lib/unsetCookie.js +0 -13
- package/dist/push/logs/index.js +0 -55
- package/dist/settings/index.js +0 -5
- package/dist/settings/load.js +0 -30
- package/dist/ssr/compileCSS.js +0 -85
- package/dist/ssr/findComponentInTree.js +0 -29
- package/dist/ssr/formatCSS.js +0 -6
- package/dist/ssr/getCSSFromTree.js +0 -33
- package/dist/ssr/index.js +0 -441
- package/dist/ssr/replaceWhenTags.js +0 -37
- package/dist/ssr/setHeadTagsInHTML.js +0 -84
- package/dist/validation/index.js +0 -10
- package/dist/validation/index.test.js +0 -463
- package/dist/validation/inputWithSchema/index.js +0 -105
- package/dist/validation/lib/constants.js +0 -162
- package/dist/validation/lib/getValueFromObject.js +0 -12
- package/dist/validation/lib/getValueFromObject.test.js +0 -7
- package/dist/validation/lib/isArrayPath.js +0 -6
- package/dist/validation/lib/throwError.js +0 -6
- package/dist/validation/lib/typeValidators.js +0 -38
- package/dist/validation/lib/validateType.js +0 -33
- package/dist/validation/schema/index.js +0 -44
- package/dist/websockets/emitWebsocketEvent.js +0 -12
- package/dist/websockets/index.js +0 -12
- package/notes +0 -1
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import util from "util";
|
|
2
|
-
import escapeHTML from "../lib/escapeHTML.js";
|
|
3
|
-
const sanitizeAPIResponse = (data = null) => {
|
|
4
|
-
let sanitizedData = data;
|
|
5
|
-
if (!util.isString(sanitizedData) && !util.isObject(sanitizedData) && !Array.isArray(sanitizedData)) {
|
|
6
|
-
return sanitizedData;
|
|
7
|
-
}
|
|
8
|
-
if (util.isString(sanitizedData)) {
|
|
9
|
-
sanitizedData = escapeHTML(sanitizedData)?.trim();
|
|
10
|
-
}
|
|
11
|
-
if (util.isObject(sanitizedData) && !Array.isArray(sanitizedData)) {
|
|
12
|
-
sanitizedData = Object.entries(sanitizedData)?.reduce((result = {}, [key, value]) => {
|
|
13
|
-
result[key] = sanitizeAPIResponse(value);
|
|
14
|
-
return result;
|
|
15
|
-
}, {});
|
|
16
|
-
}
|
|
17
|
-
if (Array.isArray(sanitizedData)) {
|
|
18
|
-
sanitizedData = sanitizedData.map((arrayItem = null) => {
|
|
19
|
-
return sanitizeAPIResponse(arrayItem);
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
return sanitizedData;
|
|
23
|
-
};
|
|
24
|
-
var sanitizeAPIResponse_default = sanitizeAPIResponse;
|
|
25
|
-
export {
|
|
26
|
-
sanitizeAPIResponse_default as default
|
|
27
|
-
};
|
|
@@ -1,193 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
-
var __commonJS = (cb, mod) => function __require() {
|
|
9
|
-
return mod || (0, cb[Object.keys(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
10
|
-
};
|
|
11
|
-
var __reExport = (target, module, desc) => {
|
|
12
|
-
if (module && typeof module === "object" || typeof module === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(module))
|
|
14
|
-
if (!__hasOwnProp.call(target, key) && key !== "default")
|
|
15
|
-
__defProp(target, key, { get: () => module[key], enumerable: !(desc = __getOwnPropDesc(module, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return target;
|
|
18
|
-
};
|
|
19
|
-
var __toModule = (module) => {
|
|
20
|
-
return __reExport(__markAsModule(__defProp(module != null ? __create(__getProtoOf(module)) : {}, "default", module && module.__esModule && "default" in module ? { get: () => module.default, enumerable: true } : { value: module, enumerable: true })), module);
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
// node_modules/process/browser.js
|
|
24
|
-
var require_browser = __commonJS({
|
|
25
|
-
"node_modules/process/browser.js"(exports, module) {
|
|
26
|
-
var process2 = module.exports = {};
|
|
27
|
-
var cachedSetTimeout;
|
|
28
|
-
var cachedClearTimeout;
|
|
29
|
-
function defaultSetTimout() {
|
|
30
|
-
throw new Error("setTimeout has not been defined");
|
|
31
|
-
}
|
|
32
|
-
function defaultClearTimeout() {
|
|
33
|
-
throw new Error("clearTimeout has not been defined");
|
|
34
|
-
}
|
|
35
|
-
(function() {
|
|
36
|
-
try {
|
|
37
|
-
if (typeof setTimeout === "function") {
|
|
38
|
-
cachedSetTimeout = setTimeout;
|
|
39
|
-
} else {
|
|
40
|
-
cachedSetTimeout = defaultSetTimout;
|
|
41
|
-
}
|
|
42
|
-
} catch (e) {
|
|
43
|
-
cachedSetTimeout = defaultSetTimout;
|
|
44
|
-
}
|
|
45
|
-
try {
|
|
46
|
-
if (typeof clearTimeout === "function") {
|
|
47
|
-
cachedClearTimeout = clearTimeout;
|
|
48
|
-
} else {
|
|
49
|
-
cachedClearTimeout = defaultClearTimeout;
|
|
50
|
-
}
|
|
51
|
-
} catch (e) {
|
|
52
|
-
cachedClearTimeout = defaultClearTimeout;
|
|
53
|
-
}
|
|
54
|
-
})();
|
|
55
|
-
function runTimeout(fun) {
|
|
56
|
-
if (cachedSetTimeout === setTimeout) {
|
|
57
|
-
return setTimeout(fun, 0);
|
|
58
|
-
}
|
|
59
|
-
if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
|
|
60
|
-
cachedSetTimeout = setTimeout;
|
|
61
|
-
return setTimeout(fun, 0);
|
|
62
|
-
}
|
|
63
|
-
try {
|
|
64
|
-
return cachedSetTimeout(fun, 0);
|
|
65
|
-
} catch (e) {
|
|
66
|
-
try {
|
|
67
|
-
return cachedSetTimeout.call(null, fun, 0);
|
|
68
|
-
} catch (e2) {
|
|
69
|
-
return cachedSetTimeout.call(this, fun, 0);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
function runClearTimeout(marker) {
|
|
74
|
-
if (cachedClearTimeout === clearTimeout) {
|
|
75
|
-
return clearTimeout(marker);
|
|
76
|
-
}
|
|
77
|
-
if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
|
|
78
|
-
cachedClearTimeout = clearTimeout;
|
|
79
|
-
return clearTimeout(marker);
|
|
80
|
-
}
|
|
81
|
-
try {
|
|
82
|
-
return cachedClearTimeout(marker);
|
|
83
|
-
} catch (e) {
|
|
84
|
-
try {
|
|
85
|
-
return cachedClearTimeout.call(null, marker);
|
|
86
|
-
} catch (e2) {
|
|
87
|
-
return cachedClearTimeout.call(this, marker);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
var queue = [];
|
|
92
|
-
var draining = false;
|
|
93
|
-
var currentQueue;
|
|
94
|
-
var queueIndex = -1;
|
|
95
|
-
function cleanUpNextTick() {
|
|
96
|
-
if (!draining || !currentQueue) {
|
|
97
|
-
return;
|
|
98
|
-
}
|
|
99
|
-
draining = false;
|
|
100
|
-
if (currentQueue.length) {
|
|
101
|
-
queue = currentQueue.concat(queue);
|
|
102
|
-
} else {
|
|
103
|
-
queueIndex = -1;
|
|
104
|
-
}
|
|
105
|
-
if (queue.length) {
|
|
106
|
-
drainQueue();
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
function drainQueue() {
|
|
110
|
-
if (draining) {
|
|
111
|
-
return;
|
|
112
|
-
}
|
|
113
|
-
var timeout = runTimeout(cleanUpNextTick);
|
|
114
|
-
draining = true;
|
|
115
|
-
var len = queue.length;
|
|
116
|
-
while (len) {
|
|
117
|
-
currentQueue = queue;
|
|
118
|
-
queue = [];
|
|
119
|
-
while (++queueIndex < len) {
|
|
120
|
-
if (currentQueue) {
|
|
121
|
-
currentQueue[queueIndex].run();
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
queueIndex = -1;
|
|
125
|
-
len = queue.length;
|
|
126
|
-
}
|
|
127
|
-
currentQueue = null;
|
|
128
|
-
draining = false;
|
|
129
|
-
runClearTimeout(timeout);
|
|
130
|
-
}
|
|
131
|
-
process2.nextTick = function(fun) {
|
|
132
|
-
var args = new Array(arguments.length - 1);
|
|
133
|
-
if (arguments.length > 1) {
|
|
134
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
135
|
-
args[i - 1] = arguments[i];
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
queue.push(new Item(fun, args));
|
|
139
|
-
if (queue.length === 1 && !draining) {
|
|
140
|
-
runTimeout(drainQueue);
|
|
141
|
-
}
|
|
142
|
-
};
|
|
143
|
-
function Item(fun, array) {
|
|
144
|
-
this.fun = fun;
|
|
145
|
-
this.array = array;
|
|
146
|
-
}
|
|
147
|
-
Item.prototype.run = function() {
|
|
148
|
-
this.fun.apply(null, this.array);
|
|
149
|
-
};
|
|
150
|
-
process2.title = "browser";
|
|
151
|
-
process2.browser = true;
|
|
152
|
-
process2.env = {};
|
|
153
|
-
process2.argv = [];
|
|
154
|
-
process2.version = "";
|
|
155
|
-
process2.versions = {};
|
|
156
|
-
function noop() {
|
|
157
|
-
}
|
|
158
|
-
process2.on = noop;
|
|
159
|
-
process2.addListener = noop;
|
|
160
|
-
process2.once = noop;
|
|
161
|
-
process2.off = noop;
|
|
162
|
-
process2.removeListener = noop;
|
|
163
|
-
process2.removeAllListeners = noop;
|
|
164
|
-
process2.emit = noop;
|
|
165
|
-
process2.prependListener = noop;
|
|
166
|
-
process2.prependOnceListener = noop;
|
|
167
|
-
process2.listeners = function(name) {
|
|
168
|
-
return [];
|
|
169
|
-
};
|
|
170
|
-
process2.binding = function(name) {
|
|
171
|
-
throw new Error("process.binding is not supported");
|
|
172
|
-
};
|
|
173
|
-
process2.cwd = function() {
|
|
174
|
-
return "/";
|
|
175
|
-
};
|
|
176
|
-
process2.chdir = function(dir) {
|
|
177
|
-
throw new Error("process.chdir is not supported");
|
|
178
|
-
};
|
|
179
|
-
process2.umask = function() {
|
|
180
|
-
return 0;
|
|
181
|
-
};
|
|
182
|
-
}
|
|
183
|
-
});
|
|
184
|
-
|
|
185
|
-
// src/app/utils/process.js
|
|
186
|
-
var import_browser = __toModule(require_browser());
|
|
187
|
-
window.process = import_browser.default;
|
|
188
|
-
var env = {
|
|
189
|
-
NODE_ENV: "${NODE_ENV}"
|
|
190
|
-
};
|
|
191
|
-
if (window.process) {
|
|
192
|
-
window.process.env = env;
|
|
193
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import formatAPIError from "../lib/formatAPIError.js";
|
|
2
|
-
var validateSession_default = (req = null, res = null, sessions = null) => {
|
|
3
|
-
const sessionToken = req?.cookies?.joystickSession;
|
|
4
|
-
const csrfToken = req?.headers["x-joystick-csrf"];
|
|
5
|
-
const session = sessions?.get(sessionToken);
|
|
6
|
-
if (process.env.NODE_ENV === "test" && csrfToken === "joystick_test") {
|
|
7
|
-
return true;
|
|
8
|
-
}
|
|
9
|
-
if (!session || session && session.csrf !== csrfToken) {
|
|
10
|
-
res.status(403).send(JSON.stringify({
|
|
11
|
-
errors: [formatAPIError(new Error("Unauthorized request."))]
|
|
12
|
-
}));
|
|
13
|
-
return false;
|
|
14
|
-
}
|
|
15
|
-
return true;
|
|
16
|
-
};
|
|
17
|
-
export {
|
|
18
|
-
validateSession_default as default
|
|
19
|
-
};
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
const allowedOptions = [
|
|
2
|
-
"mimeTypes",
|
|
3
|
-
"maxSizeInMegabytes",
|
|
4
|
-
"fileName",
|
|
5
|
-
"providers",
|
|
6
|
-
"local",
|
|
7
|
-
"s3",
|
|
8
|
-
"onBeforeUpload",
|
|
9
|
-
"onAfterUpload"
|
|
10
|
-
];
|
|
11
|
-
const allowedLocalOptions = [
|
|
12
|
-
"path"
|
|
13
|
-
];
|
|
14
|
-
const allowedS3Options = [
|
|
15
|
-
"region",
|
|
16
|
-
"accessKeyId",
|
|
17
|
-
"secretAccessKey",
|
|
18
|
-
"bucket",
|
|
19
|
-
"acl"
|
|
20
|
-
];
|
|
21
|
-
var validateUploaderOptions_default = (options = {}) => {
|
|
22
|
-
const errors = [];
|
|
23
|
-
const optionNames = Object.keys(options);
|
|
24
|
-
optionNames.forEach((optionName) => {
|
|
25
|
-
if (!allowedOptions.includes(optionName)) {
|
|
26
|
-
errors.push(`${optionName} is not an allowed uploader option.`);
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
if (options?.providers?.includes("local") && !options?.local) {
|
|
30
|
-
errors.push(`If an uploader provider is 'local', local object must be specified in options with a storage path.`);
|
|
31
|
-
}
|
|
32
|
-
if (options?.providers?.includes("s3") && !options?.s3) {
|
|
33
|
-
errors.push(`If an uploader provider is 's3', s3 object must be specified with configuration.`);
|
|
34
|
-
}
|
|
35
|
-
if (options?.provider?.includes("local") && options.local) {
|
|
36
|
-
Object.keys(options.local).forEach((optionName) => {
|
|
37
|
-
if (!allowedLocalOptions.includes(optionName)) {
|
|
38
|
-
errors.push(`local.${optionName} is not an allowed uploader option.`);
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
if (options?.provider?.includes("s3") && options.s3) {
|
|
43
|
-
Object.keys(options.s3).forEach((optionName) => {
|
|
44
|
-
if (!allowedS3Options.includes(optionName)) {
|
|
45
|
-
errors.push(`s3.${optionName} is not an allowed uploader option.`);
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
return errors;
|
|
50
|
-
};
|
|
51
|
-
export {
|
|
52
|
-
validateUploaderOptions_default as default
|
|
53
|
-
};
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import log from "../lib/log";
|
|
2
|
-
const handleCheckUpload = ({
|
|
3
|
-
uploaderName,
|
|
4
|
-
maxSizeInMegabytes,
|
|
5
|
-
mimeTypes,
|
|
6
|
-
originalFileName,
|
|
7
|
-
fileSize,
|
|
8
|
-
mimeType
|
|
9
|
-
}) => {
|
|
10
|
-
try {
|
|
11
|
-
const maxSizeInBytes = maxSizeInMegabytes * 1024 * 1024;
|
|
12
|
-
const errors = [];
|
|
13
|
-
if (maxSizeInBytes && !isNaN(maxSizeInBytes) && fileSize && fileSize > maxSizeInBytes) {
|
|
14
|
-
const error = `The file ${originalFileName} is too big. Max file size for the uploader ${uploaderName} is ${maxSizeInMegabytes}MB.`;
|
|
15
|
-
log(error, {
|
|
16
|
-
level: "danger",
|
|
17
|
-
docs: "https://github.com/cheatcode/joystick#uploaders"
|
|
18
|
-
});
|
|
19
|
-
errors.push({ message: error });
|
|
20
|
-
}
|
|
21
|
-
if (mimeTypes?.length > 0 && !mimeTypes.includes(mimeType)) {
|
|
22
|
-
const error = `The MIME type for the file ${originalFileName} is not supported by the uploader ${uploaderName} (only ${mimeTypes?.join(", ")}).`;
|
|
23
|
-
log(error, {
|
|
24
|
-
level: "danger",
|
|
25
|
-
docs: "https://github.com/cheatcode/joystick#uploaders"
|
|
26
|
-
});
|
|
27
|
-
errors.push({ message: error });
|
|
28
|
-
}
|
|
29
|
-
return errors;
|
|
30
|
-
} catch (exception) {
|
|
31
|
-
throw new Error(`[validateUploads.handleCheckUpload] ${exception.message}`);
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
const handleCheckUploads = (uploads = []) => {
|
|
35
|
-
try {
|
|
36
|
-
return uploads.flatMap((upload) => {
|
|
37
|
-
return handleCheckUpload(upload);
|
|
38
|
-
});
|
|
39
|
-
} catch (exception) {
|
|
40
|
-
throw new Error(`[validateUploads.handleCheckUploads] ${exception.message}`);
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
const formatUploads = ({
|
|
44
|
-
files: uploads = [],
|
|
45
|
-
uploaderName = "",
|
|
46
|
-
uploaderOptions = {},
|
|
47
|
-
input = {}
|
|
48
|
-
}) => {
|
|
49
|
-
try {
|
|
50
|
-
return Promise.all(uploads.map(async (upload) => {
|
|
51
|
-
const fileExtension = upload?.mimeType?.split("/").pop();
|
|
52
|
-
return {
|
|
53
|
-
uploaderName,
|
|
54
|
-
providers: uploaderOptions?.providers,
|
|
55
|
-
local: uploaderOptions?.local,
|
|
56
|
-
s3: uploaderOptions?.s3,
|
|
57
|
-
maxSizeInMegabytes: typeof uploaderOptions?.maxSizeInMegabytes === "function" ? await uploaderOptions?.maxSizeInMegabytes({ input, upload }) : uploaderOptions?.maxSizeInMegabytes,
|
|
58
|
-
mimeTypes: uploaderOptions?.mimeTypes,
|
|
59
|
-
fileName: typeof uploaderOptions?.fileName === "function" ? uploaderOptions.fileName({ input, fileName: upload?.originalname, fileSize: upload?.size, fileExtension, mimeType: upload?.mimetype }) : upload?.originalname,
|
|
60
|
-
originalFileName: upload?.originalname,
|
|
61
|
-
fileSize: upload?.size,
|
|
62
|
-
mimeType: upload?.mimetype,
|
|
63
|
-
content: upload?.buffer
|
|
64
|
-
};
|
|
65
|
-
}));
|
|
66
|
-
} catch (exception) {
|
|
67
|
-
throw new Error(`[validateUploads.formatUploads] ${exception.message}`);
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
const validateOptions = (options) => {
|
|
71
|
-
try {
|
|
72
|
-
if (!options)
|
|
73
|
-
throw new Error("options object is required.");
|
|
74
|
-
if (!options.files)
|
|
75
|
-
throw new Error("options.files is required.");
|
|
76
|
-
if (!options.uploaderName)
|
|
77
|
-
throw new Error("options.uploaderName is required.");
|
|
78
|
-
if (!options.uploaderOptions)
|
|
79
|
-
throw new Error("options.uploaderOptions is required.");
|
|
80
|
-
} catch (exception) {
|
|
81
|
-
throw new Error(`[validateUploads.validateOptions] ${exception.message}`);
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
const validateUploads = async (options, promise = {}) => {
|
|
85
|
-
try {
|
|
86
|
-
validateOptions(options);
|
|
87
|
-
const formattedUploads = await formatUploads(options);
|
|
88
|
-
const errors = handleCheckUploads(formattedUploads);
|
|
89
|
-
if (errors?.length > 0) {
|
|
90
|
-
return promise.reject(errors);
|
|
91
|
-
}
|
|
92
|
-
return promise.resolve(formattedUploads);
|
|
93
|
-
} catch (exception) {
|
|
94
|
-
promise.reject(exception);
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
var validateUploads_default = (options) => new Promise((resolve, reject) => {
|
|
98
|
-
validateUploads(options, { resolve, reject });
|
|
99
|
-
});
|
|
100
|
-
export {
|
|
101
|
-
validateUploads_default as default
|
|
102
|
-
};
|
package/dist/email/render.js
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import fs from "fs";
|
|
2
|
-
import ssr from "../ssr";
|
|
3
|
-
import getBuildPath from "../lib/getBuildPath";
|
|
4
|
-
import { isObject } from "../validation/lib/typeValidators";
|
|
5
|
-
const getFile = async (buildPath = "") => {
|
|
6
|
-
const file = await import(buildPath);
|
|
7
|
-
return file.default;
|
|
8
|
-
};
|
|
9
|
-
const getTranslations = async (buildPath = "", templateName = "", user = {}, settings = {}) => {
|
|
10
|
-
const language = user?.language || settings?.config?.i18n?.defaultLanguage;
|
|
11
|
-
const languageFilePath = `${process.cwd()}/${buildPath}i18n/email/${templateName}_${language}.js`;
|
|
12
|
-
const hasLanguageFile = fs.existsSync(languageFilePath);
|
|
13
|
-
if (hasLanguageFile) {
|
|
14
|
-
const languageFile = await getFile(languageFilePath);
|
|
15
|
-
const isValidLanguageFile = languageFile && isObject(languageFile);
|
|
16
|
-
return isValidLanguageFile ? languageFile : {};
|
|
17
|
-
}
|
|
18
|
-
return {};
|
|
19
|
-
};
|
|
20
|
-
var render_default = async ({
|
|
21
|
-
templateName,
|
|
22
|
-
baseName,
|
|
23
|
-
settings,
|
|
24
|
-
Component,
|
|
25
|
-
props,
|
|
26
|
-
subject,
|
|
27
|
-
preheader,
|
|
28
|
-
user,
|
|
29
|
-
hmrToken
|
|
30
|
-
}) => {
|
|
31
|
-
try {
|
|
32
|
-
const buildPath = getBuildPath();
|
|
33
|
-
const translations = await getTranslations(buildPath, templateName, user, settings);
|
|
34
|
-
return ssr({
|
|
35
|
-
email: true,
|
|
36
|
-
emailSubject: subject,
|
|
37
|
-
emailPreheader: preheader,
|
|
38
|
-
componentFunction: Component,
|
|
39
|
-
baseEmailHTMLName: baseName,
|
|
40
|
-
props,
|
|
41
|
-
translations,
|
|
42
|
-
hmrToken
|
|
43
|
-
});
|
|
44
|
-
} catch (exception) {
|
|
45
|
-
console.warn(exception);
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
export {
|
|
49
|
-
render_default as default
|
|
50
|
-
};
|
package/dist/email/send.js
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import chalk from "chalk";
|
|
2
|
-
import nodemailer from "nodemailer";
|
|
3
|
-
import fs from "fs";
|
|
4
|
-
import { htmlToText } from "html-to-text";
|
|
5
|
-
import juice from "juice";
|
|
6
|
-
import settings from "../settings";
|
|
7
|
-
import validateSMTPSettings from "./validateSMTPSettings";
|
|
8
|
-
import render from "./render";
|
|
9
|
-
import getBuildPath from "../lib/getBuildPath";
|
|
10
|
-
var send_default = async ({ template: templateName, props, base: baseName, ...restOfOptions }) => {
|
|
11
|
-
const validSMTPSettings = validateSMTPSettings(settings?.config?.email?.smtp);
|
|
12
|
-
if (!validSMTPSettings) {
|
|
13
|
-
console.warn(chalk.redBright("Cannot send email, invalid SMTP settings."));
|
|
14
|
-
return Promise.resolve(null);
|
|
15
|
-
}
|
|
16
|
-
const isNoSecurePort = [587, 25, "587", "25"].includes(settings?.config?.email?.smtp?.port);
|
|
17
|
-
const smtp = validSMTPSettings ? nodemailer.createTransport({
|
|
18
|
-
host: settings?.config?.email?.smtp?.host,
|
|
19
|
-
port: settings?.config?.email?.smtp?.port,
|
|
20
|
-
secure: !isNoSecurePort && process.env.NODE_ENV !== "development",
|
|
21
|
-
auth: {
|
|
22
|
-
user: settings?.config?.email?.smtp?.username,
|
|
23
|
-
pass: settings?.config?.email?.smtp?.password
|
|
24
|
-
}
|
|
25
|
-
}) : null;
|
|
26
|
-
let templatePath = `${process.cwd()}/${getBuildPath()}email/${templateName}.js`;
|
|
27
|
-
const templateExists = templateName && fs.existsSync(templatePath);
|
|
28
|
-
const options = {
|
|
29
|
-
from: settings?.config?.email?.from,
|
|
30
|
-
...restOfOptions
|
|
31
|
-
};
|
|
32
|
-
if (templateExists) {
|
|
33
|
-
const template = (await import(templatePath)).default;
|
|
34
|
-
const html = await render({
|
|
35
|
-
templateName,
|
|
36
|
-
baseName,
|
|
37
|
-
settings,
|
|
38
|
-
Component: template,
|
|
39
|
-
props,
|
|
40
|
-
subject: restOfOptions?.subject,
|
|
41
|
-
preheader: restOfOptions?.preheader,
|
|
42
|
-
user: restOfOptions?.user
|
|
43
|
-
});
|
|
44
|
-
const text = htmlToText(html);
|
|
45
|
-
const htmlWithStylesInlined = juice(html);
|
|
46
|
-
options.html = htmlWithStylesInlined;
|
|
47
|
-
options.text = text;
|
|
48
|
-
return smtp.sendMail(options);
|
|
49
|
-
}
|
|
50
|
-
console.warn(`Template ${templateName} could not be found in /email. Double-check the template exists and try again.`);
|
|
51
|
-
return Promise.resolve();
|
|
52
|
-
};
|
|
53
|
-
export {
|
|
54
|
-
send_default as default
|
|
55
|
-
};
|
|
@@ -1,194 +0,0 @@
|
|
|
1
|
-
/* http://meyerweb.com/eric/tools/css/reset/
|
|
2
|
-
v2.0 | 20110126
|
|
3
|
-
License: none (public domain)
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
html,
|
|
7
|
-
body,
|
|
8
|
-
div,
|
|
9
|
-
span,
|
|
10
|
-
applet,
|
|
11
|
-
object,
|
|
12
|
-
iframe,
|
|
13
|
-
h1,
|
|
14
|
-
h2,
|
|
15
|
-
h3,
|
|
16
|
-
h4,
|
|
17
|
-
h5,
|
|
18
|
-
h6,
|
|
19
|
-
p,
|
|
20
|
-
blockquote,
|
|
21
|
-
pre,
|
|
22
|
-
a,
|
|
23
|
-
abbr,
|
|
24
|
-
acronym,
|
|
25
|
-
address,
|
|
26
|
-
big,
|
|
27
|
-
cite,
|
|
28
|
-
code,
|
|
29
|
-
del,
|
|
30
|
-
dfn,
|
|
31
|
-
em,
|
|
32
|
-
img,
|
|
33
|
-
ins,
|
|
34
|
-
kbd,
|
|
35
|
-
q,
|
|
36
|
-
s,
|
|
37
|
-
samp,
|
|
38
|
-
small,
|
|
39
|
-
strike,
|
|
40
|
-
strong,
|
|
41
|
-
sub,
|
|
42
|
-
sup,
|
|
43
|
-
tt,
|
|
44
|
-
var,
|
|
45
|
-
b,
|
|
46
|
-
u,
|
|
47
|
-
i,
|
|
48
|
-
center,
|
|
49
|
-
dl,
|
|
50
|
-
dt,
|
|
51
|
-
dd,
|
|
52
|
-
ol,
|
|
53
|
-
ul,
|
|
54
|
-
li,
|
|
55
|
-
fieldset,
|
|
56
|
-
form,
|
|
57
|
-
label,
|
|
58
|
-
legend,
|
|
59
|
-
table,
|
|
60
|
-
caption,
|
|
61
|
-
tbody,
|
|
62
|
-
tfoot,
|
|
63
|
-
thead,
|
|
64
|
-
tr,
|
|
65
|
-
th,
|
|
66
|
-
td,
|
|
67
|
-
article,
|
|
68
|
-
aside,
|
|
69
|
-
canvas,
|
|
70
|
-
details,
|
|
71
|
-
embed,
|
|
72
|
-
figure,
|
|
73
|
-
figcaption,
|
|
74
|
-
footer,
|
|
75
|
-
header,
|
|
76
|
-
hgroup,
|
|
77
|
-
menu,
|
|
78
|
-
nav,
|
|
79
|
-
output,
|
|
80
|
-
ruby,
|
|
81
|
-
section,
|
|
82
|
-
summary,
|
|
83
|
-
time,
|
|
84
|
-
mark,
|
|
85
|
-
audio,
|
|
86
|
-
video {
|
|
87
|
-
margin: 0;
|
|
88
|
-
padding: 0;
|
|
89
|
-
border: 0;
|
|
90
|
-
font-size: 100%;
|
|
91
|
-
font: inherit;
|
|
92
|
-
vertical-align: baseline;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
article,
|
|
96
|
-
aside,
|
|
97
|
-
details,
|
|
98
|
-
figcaption,
|
|
99
|
-
figure,
|
|
100
|
-
footer,
|
|
101
|
-
header,
|
|
102
|
-
hgroup,
|
|
103
|
-
menu,
|
|
104
|
-
nav,
|
|
105
|
-
section {
|
|
106
|
-
display: block;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
body {
|
|
110
|
-
line-height: 1;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
ol,
|
|
114
|
-
ul {
|
|
115
|
-
list-style: none;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
blockquote,
|
|
119
|
-
q {
|
|
120
|
-
quotes: none;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
blockquote:before,
|
|
124
|
-
blockquote:after,
|
|
125
|
-
q:before,
|
|
126
|
-
q:after {
|
|
127
|
-
content: "";
|
|
128
|
-
content: none;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
table {
|
|
132
|
-
border-collapse: collapse;
|
|
133
|
-
border-spacing: 0;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
img {
|
|
137
|
-
border: none;
|
|
138
|
-
-ms-interpolation-mode: bicubic;
|
|
139
|
-
max-width: 100%;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
body {
|
|
143
|
-
background-color: #fff;
|
|
144
|
-
font-family: "Helvetica Neue", "Helvetica", "Arial", sans-serif;
|
|
145
|
-
-webkit-font-smoothing: antialiased;
|
|
146
|
-
font-size: 14px;
|
|
147
|
-
line-height: 1.4;
|
|
148
|
-
margin: 0;
|
|
149
|
-
padding: 0;
|
|
150
|
-
-ms-text-size-adjust: 100%;
|
|
151
|
-
-webkit-text-size-adjust: 100%;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
table {
|
|
155
|
-
border-collapse: separate;
|
|
156
|
-
mso-table-lspace: 0pt;
|
|
157
|
-
mso-table-rspace: 0pt;
|
|
158
|
-
width: 100%;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
.body {
|
|
162
|
-
background-color: #fff;
|
|
163
|
-
width: 100%;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
.container {
|
|
167
|
-
display: block;
|
|
168
|
-
margin: 0 auto !important;
|
|
169
|
-
max-width: 675px;
|
|
170
|
-
width: 100%;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
.content {
|
|
174
|
-
box-sizing: border-box;
|
|
175
|
-
display: block;
|
|
176
|
-
margin: 0 auto;
|
|
177
|
-
width: 100%;
|
|
178
|
-
max-width: 675px;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
.content > table {
|
|
182
|
-
width: 100%;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
@media only screen and (max-width: 620px) {
|
|
186
|
-
table.body .content {
|
|
187
|
-
padding: 0 !important;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
table.body .container {
|
|
191
|
-
padding: 0 !important;
|
|
192
|
-
width: 100% !important;
|
|
193
|
-
}
|
|
194
|
-
}
|