From 11973397c812da59c2d544047bbb2d2d9ae583a7 Mon Sep 17 00:00:00 2001 From: Rory& Date: Wed, 17 Dec 2025 09:58:25 +0100 Subject: [PATCH] Prettier u15 --- package.json | 8 +- scripts/configTemplates/bundle.json | 28 +- scripts/configTemplates/split.json | 28 +- scripts/schema.js | 4 +- scripts/schemaExclusions.json | 822 +++++++++--------- .../channels/#channel_id/messages/index.ts | 17 +- src/api/routes/users/@me/settings-proto/1.ts | 3 +- src/api/routes/users/@me/settings-proto/2.ts | 3 +- src/cdn/util/Storage.ts | 2 +- src/gateway/events/Connection.ts | 17 +- src/gateway/opcodes/Identify.ts | 5 +- src/renderEnvConfigSchema.ts | 12 +- src/util/automod/AutomodExecutor.ts | 4 +- src/util/automod/AutomodMessageExecutor.ts | 1 - src/util/automod/index.ts | 2 +- .../envTypes/ConfigurationEnvConfiguration.ts | 33 +- .../envTypes/DatabaseEnvConfiguration.ts | 5 +- .../config/envTypes/LogEnvConfiguration.ts | 53 +- .../config/envTypes/WebRtcEnvConfiguration.ts | 19 +- src/util/index.ts | 2 +- src/util/util/Token.ts | 2 +- src/util/util/extensions/Array.ts | 3 +- src/webrtc/events/Connection.ts | 17 +- src/webrtc/util/Send.ts | 5 +- 24 files changed, 548 insertions(+), 547 deletions(-) diff --git a/package.json b/package.json index b6d6752ef..5e73272ed 100644 --- a/package.json +++ b/package.json @@ -12,9 +12,9 @@ "build": "npm run build:src && npm run generate:schema && npm run generate:openapi", "build:src": "tsc -b -v", "build:watch": "tsc -w -b .", - "clean": "rm -rf dist/", + "clean": "rm -rf dist/", "test": "node scripts/test.js", - "test:node": "node --test --enable-source-maps dist/**/*.test.js", + "test:node": "node --test --enable-source-maps dist/**/*.test.js", "lint": "eslint .", "setup": "npm run build && npm run generate:schema", "sync:db": "npm run build && node scripts/syncronise.js", @@ -22,7 +22,7 @@ "generate:schema": "node scripts/schema.js", "generate:migration": "node --enable-source-maps -r dotenv/config -r module-alias/register node_modules/typeorm/cli.js migration:generate -d dist/util/util/Database.js", "generate:openapi": "node scripts/openapi.js", - "generate:docs:envconfig": "node --enable-source-maps dist/renderEnvConfigSchema.js", + "generate:docs:envconfig": "node --enable-source-maps dist/renderEnvConfigSchema.js", "add:license": "node scripts/license.js", "migrate-from-staging": "node --enable-source-maps -r dotenv/config -r module-alias/register scripts/stagingMigration/index.js", "node:tests": "npm run build:src && node --enable-source-maps -r dotenv/config -r module-alias/register --test --experimental-test-coverage dist/**/*.test.js", @@ -133,4 +133,4 @@ "node-mailjet": "^6.0.11", "nodemailer": "^7.0.11" } -} \ No newline at end of file +} diff --git a/scripts/configTemplates/bundle.json b/scripts/configTemplates/bundle.json index e975a1d9c..9bcf9b182 100644 --- a/scripts/configTemplates/bundle.json +++ b/scripts/configTemplates/bundle.json @@ -1,15 +1,15 @@ { - "gateway": { - "endpointPublic": "ws://localhost:3001" - }, - "cdn": { - "endpointPrivate": "http://localhost:3001", - "endpointPublic": "http://localhost:3001" - }, - "api": { - "endpointPublic": "http://localhost:3001/api/v9/" - }, - "rabbitmq": { - "host": null - } -} \ No newline at end of file + "gateway": { + "endpointPublic": "ws://localhost:3001" + }, + "cdn": { + "endpointPrivate": "http://localhost:3001", + "endpointPublic": "http://localhost:3001" + }, + "api": { + "endpointPublic": "http://localhost:3001/api/v9/" + }, + "rabbitmq": { + "host": null + } +} diff --git a/scripts/configTemplates/split.json b/scripts/configTemplates/split.json index f58adc8df..ec18d27e2 100644 --- a/scripts/configTemplates/split.json +++ b/scripts/configTemplates/split.json @@ -1,15 +1,15 @@ { - "api": { - "endpointPublic": "http://localhost:3001/api/v9/" - }, - "cdn": { - "endpointPublic": "http://localhost:3003", - "endpointPrivate": "http://localhost:3003" - }, - "gateway": { - "endpointPublic": "ws://localhost:3002" - }, - "rabbitmq": { - "host": "amqp://guest:guest@localhost/" - } -} \ No newline at end of file + "api": { + "endpointPublic": "http://localhost:3001/api/v9/" + }, + "cdn": { + "endpointPublic": "http://localhost:3003", + "endpointPrivate": "http://localhost:3003" + }, + "gateway": { + "endpointPublic": "ws://localhost:3002" + }, + "rabbitmq": { + "host": "amqp://guest:guest@localhost/" + } +} diff --git a/scripts/schema.js b/scripts/schema.js index 5e4485d1c..1779c8d6d 100644 --- a/scripts/schema.js +++ b/scripts/schema.js @@ -114,12 +114,12 @@ const excludedLambdas = [ } }, (n, s) => { - if (s.properties && Object.keys(s.properties).every(x=> x[0] === x[0].toUpperCase())) { + if (s.properties && Object.keys(s.properties).every((x) => x[0] === x[0].toUpperCase())) { console.log(`\r${redBright("[WARN]")} Omitting schema ${n} as all its properties have uppercase characters.`); exclusionList.auto.push({ value: n, reason: "Schema with only uppercase properties" }); return true; } - } + }, // (n, s) => { // if (JSON.stringify(s).length <= 300) { // console.log({n, s}); diff --git a/scripts/schemaExclusions.json b/scripts/schemaExclusions.json index 64e2bbf00..389cb4f51 100644 --- a/scripts/schemaExclusions.json +++ b/scripts/schemaExclusions.json @@ -1,415 +1,409 @@ { - "include": [ - "MessageInteractionSchema" - ], - "includeRe": [ - "^MessageComponentType\\..*" - ], - "manual": [ - "DefaultSchema", - "Schema", - "EntitySchema", - "ReadableStream", - "SomeJSONSchema", - "UncheckedPartialSchema", - "PartialSchema", - "UncheckedPropertiesSchema", - "PropertiesSchema", - "AsyncSchema", - "AnySchema", - "SMTPConnection.CustomAuthenticationResponse", - "TransportMakeRequestResponse", - "StaticSchema", - "CSVImportResponse", - "NewMultipleMembersResponse", - "EventsResponse", - "NotificationAPIResponse", - "MetricsAPIResponse", - "ValidationResponse", - "MultipleValidationJobsListResponse", - "UpdateRouteResponse", - "MessagesSendAPIResponse", - "APIWebhook", - "WebhookResponse", - "WebhookValidationResponse", - "MessageResponse", - "ConnectionSettingsResponse", - "UpdatedDKIMSelectorResponse", - "UpdatedWebPrefixResponse", - "APIResponse", - "APIErrorOptions", - "APIErrorType", - "ListTagsForResourceResponse", - "GetContactResponse", - "LibraryResponse", - "LibraryLocalResponse", - "SchemaTraits", - "TraitsSchema", - "AbuseIpDbCheckResponse", - "IpDataIpLookupResponse" - ], - "manualRe": [ - ".*\\.Response$", - "^(Http2Server|Server|Express|(Resolved|)Http|Client|_|)Response$", - ".*\\..*", - "^Axios.*", - "^Internal", - "^Record<", - "^Omit<", - "^ListContact(s|Lists)Response$", - "^APIKeyConfiguration\\..*", - "^AccountSetting\\..*", - "^BulkContactManagement\\..*", - "^Campaign.*", - "^Contact.*", - "^DNS\\..*", - "^Delete.*", - "^Destroy.*", - "^Template\\..*", - "^Webhook\\..*", - "^(BigDecimal|BigInteger|Blob|Boolean|Document|Error|LazyRequest|List|Map|Normalized|Numeric|StreamingBlob|TimestampDateTime|TimestampHttpDate|TimestampEpochSeconds|Simple)Schema", - "^((Create|Update)Contact(|List))Response$", - "^(T|Unt)agResourceResponse$", - "^Put", - "^Inbox", - "^Seed", - "^DomainTag", - "^IpPool", - "DomainTemplate", - "^\\$", - "^Suppression", - "^Mail(|ing)List", - "DomainTracking", - "UpdatedDomain", - "ConfigurationSet", - "ContactList", - "^IPR", - "^Job" - ], - "manualWarn": [], - "manualWarnRe": [ - ".*<.*>$" - ], - "auto": [ - { - "value": "StringSchema", - "reason": "AWS Smithy schema" - }, - { - "value": "TimestampDefaultSchema", - "reason": "AWS Smithy schema" - }, - { - "value": "StaticSimpleSchema", - "reason": "Self-reference only schema" - }, - { - "value": "StaticListSchema", - "reason": "Self-reference only schema" - }, - { - "value": "StaticMapSchema", - "reason": "Self-reference only schema" - }, - { - "value": "StaticStructureSchema", - "reason": "Self-reference only schema" - }, - { - "value": "StaticErrorSchema", - "reason": "Self-reference only schema" - }, - { - "value": "StaticOperationSchema", - "reason": "Self-reference only schema" - }, - { - "value": "UnitSchema", - "reason": "AWS Smithy schema" - }, - { - "value": "MemberSchema", - "reason": "Self-reference only schema" - }, - { - "value": "StructureSchema", - "reason": "Self-reference only schema" - }, - { - "value": "OperationSchema", - "reason": "Self-reference only schema" - }, - { - "value": "BatchGetMetricDataResponse", - "reason": "HTML paragraph in description" - }, - { - "value": "CancelExportJobResponse", - "reason": "HTML paragraph in description" - }, - { - "value": "CreateCustomVerificationEmailTemplateResponse", - "reason": "HTML paragraph in description" - }, - { - "value": "CreateDedicatedIpPoolResponse", - "reason": "HTML paragraph in description" - }, - { - "value": "CreateDeliverabilityTestReportResponse", - "reason": "HTML paragraph in description" - }, - { - "value": "CreateEmailIdentityResponse", - "reason": "HTML paragraph in description" - }, - { - "value": "CreateEmailIdentityPolicyResponse", - "reason": "HTML paragraph in description" - }, - { - "value": "CreateEmailTemplateResponse", - "reason": "HTML paragraph in description" - }, - { - "value": "CreateExportJobResponse", - "reason": "HTML paragraph in description" - }, - { - "value": "CreateImportJobResponse", - "reason": "HTML paragraph in description" - }, - { - "value": "CreateMultiRegionEndpointResponse", - "reason": "HTML paragraph in description" - }, - { - "value": "CreateTenantResponse", - "reason": "HTML paragraph in description" - }, - { - "value": "CreateTenantResourceAssociationResponse", - "reason": "HTML paragraph in description" - }, - { - "value": "GetAccountResponse", - "reason": "HTML paragraph in description" - }, - { - "value": "GetBlacklistReportsResponse", - "reason": "HTML paragraph in description" - }, - { - "value": "GetCustomVerificationEmailTemplateResponse", - "reason": "HTML paragraph in description" - }, - { - "value": "GetDedicatedIpResponse", - "reason": "HTML paragraph in description" - }, - { - "value": "GetDedicatedIpPoolResponse", - "reason": "HTML paragraph in description" - }, - { - "value": "GetDedicatedIpsResponse", - "reason": "HTML paragraph in description" - }, - { - "value": "GetDeliverabilityDashboardOptionsResponse", - "reason": "HTML paragraph in description" - }, - { - "value": "GetDeliverabilityTestReportResponse", - "reason": "HTML paragraph in description" - }, - { - "value": "GetDomainDeliverabilityCampaignResponse", - "reason": "HTML paragraph in description" - }, - { - "value": "GetDomainStatisticsReportResponse", - "reason": "HTML paragraph in description" - }, - { - "value": "GetEmailIdentityResponse", - "reason": "HTML paragraph in description" - }, - { - "value": "GetEmailIdentityPoliciesResponse", - "reason": "HTML paragraph in description" - }, - { - "value": "GetEmailTemplateResponse", - "reason": "HTML paragraph in description" - }, - { - "value": "GetExportJobResponse", - "reason": "HTML paragraph in description" - }, - { - "value": "GetImportJobResponse", - "reason": "HTML paragraph in description" - }, - { - "value": "GetMessageInsightsResponse", - "reason": "HTML paragraph in description" - }, - { - "value": "GetMultiRegionEndpointResponse", - "reason": "HTML paragraph in description" - }, - { - "value": "GetReputationEntityResponse", - "reason": "HTML paragraph in description" - }, - { - "value": "GetSuppressedDestinationResponse", - "reason": "HTML paragraph in description" - }, - { - "value": "GetTenantResponse", - "reason": "HTML paragraph in description" - }, - { - "value": "ListCustomVerificationEmailTemplatesResponse", - "reason": "HTML paragraph in description" - }, - { - "value": "ListDedicatedIpPoolsResponse", - "reason": "HTML paragraph in description" - }, - { - "value": "ListDeliverabilityTestReportsResponse", - "reason": "HTML paragraph in description" - }, - { - "value": "ListDomainDeliverabilityCampaignsResponse", - "reason": "HTML paragraph in description" - }, - { - "value": "ListEmailIdentitiesResponse", - "reason": "HTML paragraph in description" - }, - { - "value": "ListEmailTemplatesResponse", - "reason": "HTML paragraph in description" - }, - { - "value": "ListExportJobsResponse", - "reason": "HTML paragraph in description" - }, - { - "value": "ListImportJobsResponse", - "reason": "HTML paragraph in description" - }, - { - "value": "ListMultiRegionEndpointsResponse", - "reason": "HTML paragraph in description" - }, - { - "value": "ListRecommendationsResponse", - "reason": "HTML paragraph in description" - }, - { - "value": "ListReputationEntitiesResponse", - "reason": "HTML paragraph in description" - }, - { - "value": "ListResourceTenantsResponse", - "reason": "HTML paragraph in description" - }, - { - "value": "ListSuppressedDestinationsResponse", - "reason": "HTML paragraph in description" - }, - { - "value": "ListTenantResourcesResponse", - "reason": "HTML paragraph in description" - }, - { - "value": "ListTenantsResponse", - "reason": "HTML paragraph in description" - }, - { - "value": "SendBulkEmailResponse", - "reason": "HTML paragraph in description" - }, - { - "value": "SendCustomVerificationEmailResponse", - "reason": "HTML paragraph in description" - }, - { - "value": "SendEmailResponse", - "reason": "HTML paragraph in description" - }, - { - "value": "TestRenderEmailTemplateResponse", - "reason": "HTML paragraph in description" - }, - { - "value": "UpdateCustomVerificationEmailTemplateResponse", - "reason": "HTML paragraph in description" - }, - { - "value": "UpdateEmailIdentityPolicyResponse", - "reason": "HTML paragraph in description" - }, - { - "value": "UpdateEmailTemplateResponse", - "reason": "HTML paragraph in description" - }, - { - "value": "UpdateReputationEntityCustomerManagedStatusResponse", - "reason": "HTML paragraph in description" - }, - { - "value": "UpdateReputationEntityPolicyResponse", - "reason": "HTML paragraph in description" - }, - { - "value": "UpdatedDKIMAuthorityResponse", - "reason": "Uses import()" - }, - { - "value": "ListRecipientResponse", - "reason": "Schema with only uppercase properties" - }, - { - "value": "TemplateResponse", - "reason": "Schema with only uppercase properties" - }, - { - "value": "TemplateDetailContentResponse", - "reason": "Schema with only uppercase properties" - }, - { - "value": "EventCallbackUrlResponse", - "reason": "Schema with only uppercase properties" - }, - { - "value": "ParseRouteResponse", - "reason": "Schema with only uppercase properties" - }, - { - "value": "SenderResponse", - "reason": "Schema with only uppercase properties" - }, - { - "value": "MetaSenderResponse", - "reason": "Schema with only uppercase properties" - }, - { - "value": "ApiKeyResponse", - "reason": "Schema with only uppercase properties" - }, - { - "value": "MyProfileResponse", - "reason": "Schema with only uppercase properties" - }, - { - "value": "UserResponse", - "reason": "Schema with only uppercase properties" - } - ] -} \ No newline at end of file + "include": ["MessageInteractionSchema"], + "includeRe": ["^MessageComponentType\\..*"], + "manual": [ + "DefaultSchema", + "Schema", + "EntitySchema", + "ReadableStream", + "SomeJSONSchema", + "UncheckedPartialSchema", + "PartialSchema", + "UncheckedPropertiesSchema", + "PropertiesSchema", + "AsyncSchema", + "AnySchema", + "SMTPConnection.CustomAuthenticationResponse", + "TransportMakeRequestResponse", + "StaticSchema", + "CSVImportResponse", + "NewMultipleMembersResponse", + "EventsResponse", + "NotificationAPIResponse", + "MetricsAPIResponse", + "ValidationResponse", + "MultipleValidationJobsListResponse", + "UpdateRouteResponse", + "MessagesSendAPIResponse", + "APIWebhook", + "WebhookResponse", + "WebhookValidationResponse", + "MessageResponse", + "ConnectionSettingsResponse", + "UpdatedDKIMSelectorResponse", + "UpdatedWebPrefixResponse", + "APIResponse", + "APIErrorOptions", + "APIErrorType", + "ListTagsForResourceResponse", + "GetContactResponse", + "LibraryResponse", + "LibraryLocalResponse", + "SchemaTraits", + "TraitsSchema", + "AbuseIpDbCheckResponse", + "IpDataIpLookupResponse" + ], + "manualRe": [ + ".*\\.Response$", + "^(Http2Server|Server|Express|(Resolved|)Http|Client|_|)Response$", + ".*\\..*", + "^Axios.*", + "^Internal", + "^Record<", + "^Omit<", + "^ListContact(s|Lists)Response$", + "^APIKeyConfiguration\\..*", + "^AccountSetting\\..*", + "^BulkContactManagement\\..*", + "^Campaign.*", + "^Contact.*", + "^DNS\\..*", + "^Delete.*", + "^Destroy.*", + "^Template\\..*", + "^Webhook\\..*", + "^(BigDecimal|BigInteger|Blob|Boolean|Document|Error|LazyRequest|List|Map|Normalized|Numeric|StreamingBlob|TimestampDateTime|TimestampHttpDate|TimestampEpochSeconds|Simple)Schema", + "^((Create|Update)Contact(|List))Response$", + "^(T|Unt)agResourceResponse$", + "^Put", + "^Inbox", + "^Seed", + "^DomainTag", + "^IpPool", + "DomainTemplate", + "^\\$", + "^Suppression", + "^Mail(|ing)List", + "DomainTracking", + "UpdatedDomain", + "ConfigurationSet", + "ContactList", + "^IPR", + "^Job" + ], + "manualWarn": [], + "manualWarnRe": [".*<.*>$"], + "auto": [ + { + "value": "StringSchema", + "reason": "AWS Smithy schema" + }, + { + "value": "TimestampDefaultSchema", + "reason": "AWS Smithy schema" + }, + { + "value": "StaticSimpleSchema", + "reason": "Self-reference only schema" + }, + { + "value": "StaticListSchema", + "reason": "Self-reference only schema" + }, + { + "value": "StaticMapSchema", + "reason": "Self-reference only schema" + }, + { + "value": "StaticStructureSchema", + "reason": "Self-reference only schema" + }, + { + "value": "StaticErrorSchema", + "reason": "Self-reference only schema" + }, + { + "value": "StaticOperationSchema", + "reason": "Self-reference only schema" + }, + { + "value": "UnitSchema", + "reason": "AWS Smithy schema" + }, + { + "value": "MemberSchema", + "reason": "Self-reference only schema" + }, + { + "value": "StructureSchema", + "reason": "Self-reference only schema" + }, + { + "value": "OperationSchema", + "reason": "Self-reference only schema" + }, + { + "value": "BatchGetMetricDataResponse", + "reason": "HTML paragraph in description" + }, + { + "value": "CancelExportJobResponse", + "reason": "HTML paragraph in description" + }, + { + "value": "CreateCustomVerificationEmailTemplateResponse", + "reason": "HTML paragraph in description" + }, + { + "value": "CreateDedicatedIpPoolResponse", + "reason": "HTML paragraph in description" + }, + { + "value": "CreateDeliverabilityTestReportResponse", + "reason": "HTML paragraph in description" + }, + { + "value": "CreateEmailIdentityResponse", + "reason": "HTML paragraph in description" + }, + { + "value": "CreateEmailIdentityPolicyResponse", + "reason": "HTML paragraph in description" + }, + { + "value": "CreateEmailTemplateResponse", + "reason": "HTML paragraph in description" + }, + { + "value": "CreateExportJobResponse", + "reason": "HTML paragraph in description" + }, + { + "value": "CreateImportJobResponse", + "reason": "HTML paragraph in description" + }, + { + "value": "CreateMultiRegionEndpointResponse", + "reason": "HTML paragraph in description" + }, + { + "value": "CreateTenantResponse", + "reason": "HTML paragraph in description" + }, + { + "value": "CreateTenantResourceAssociationResponse", + "reason": "HTML paragraph in description" + }, + { + "value": "GetAccountResponse", + "reason": "HTML paragraph in description" + }, + { + "value": "GetBlacklistReportsResponse", + "reason": "HTML paragraph in description" + }, + { + "value": "GetCustomVerificationEmailTemplateResponse", + "reason": "HTML paragraph in description" + }, + { + "value": "GetDedicatedIpResponse", + "reason": "HTML paragraph in description" + }, + { + "value": "GetDedicatedIpPoolResponse", + "reason": "HTML paragraph in description" + }, + { + "value": "GetDedicatedIpsResponse", + "reason": "HTML paragraph in description" + }, + { + "value": "GetDeliverabilityDashboardOptionsResponse", + "reason": "HTML paragraph in description" + }, + { + "value": "GetDeliverabilityTestReportResponse", + "reason": "HTML paragraph in description" + }, + { + "value": "GetDomainDeliverabilityCampaignResponse", + "reason": "HTML paragraph in description" + }, + { + "value": "GetDomainStatisticsReportResponse", + "reason": "HTML paragraph in description" + }, + { + "value": "GetEmailIdentityResponse", + "reason": "HTML paragraph in description" + }, + { + "value": "GetEmailIdentityPoliciesResponse", + "reason": "HTML paragraph in description" + }, + { + "value": "GetEmailTemplateResponse", + "reason": "HTML paragraph in description" + }, + { + "value": "GetExportJobResponse", + "reason": "HTML paragraph in description" + }, + { + "value": "GetImportJobResponse", + "reason": "HTML paragraph in description" + }, + { + "value": "GetMessageInsightsResponse", + "reason": "HTML paragraph in description" + }, + { + "value": "GetMultiRegionEndpointResponse", + "reason": "HTML paragraph in description" + }, + { + "value": "GetReputationEntityResponse", + "reason": "HTML paragraph in description" + }, + { + "value": "GetSuppressedDestinationResponse", + "reason": "HTML paragraph in description" + }, + { + "value": "GetTenantResponse", + "reason": "HTML paragraph in description" + }, + { + "value": "ListCustomVerificationEmailTemplatesResponse", + "reason": "HTML paragraph in description" + }, + { + "value": "ListDedicatedIpPoolsResponse", + "reason": "HTML paragraph in description" + }, + { + "value": "ListDeliverabilityTestReportsResponse", + "reason": "HTML paragraph in description" + }, + { + "value": "ListDomainDeliverabilityCampaignsResponse", + "reason": "HTML paragraph in description" + }, + { + "value": "ListEmailIdentitiesResponse", + "reason": "HTML paragraph in description" + }, + { + "value": "ListEmailTemplatesResponse", + "reason": "HTML paragraph in description" + }, + { + "value": "ListExportJobsResponse", + "reason": "HTML paragraph in description" + }, + { + "value": "ListImportJobsResponse", + "reason": "HTML paragraph in description" + }, + { + "value": "ListMultiRegionEndpointsResponse", + "reason": "HTML paragraph in description" + }, + { + "value": "ListRecommendationsResponse", + "reason": "HTML paragraph in description" + }, + { + "value": "ListReputationEntitiesResponse", + "reason": "HTML paragraph in description" + }, + { + "value": "ListResourceTenantsResponse", + "reason": "HTML paragraph in description" + }, + { + "value": "ListSuppressedDestinationsResponse", + "reason": "HTML paragraph in description" + }, + { + "value": "ListTenantResourcesResponse", + "reason": "HTML paragraph in description" + }, + { + "value": "ListTenantsResponse", + "reason": "HTML paragraph in description" + }, + { + "value": "SendBulkEmailResponse", + "reason": "HTML paragraph in description" + }, + { + "value": "SendCustomVerificationEmailResponse", + "reason": "HTML paragraph in description" + }, + { + "value": "SendEmailResponse", + "reason": "HTML paragraph in description" + }, + { + "value": "TestRenderEmailTemplateResponse", + "reason": "HTML paragraph in description" + }, + { + "value": "UpdateCustomVerificationEmailTemplateResponse", + "reason": "HTML paragraph in description" + }, + { + "value": "UpdateEmailIdentityPolicyResponse", + "reason": "HTML paragraph in description" + }, + { + "value": "UpdateEmailTemplateResponse", + "reason": "HTML paragraph in description" + }, + { + "value": "UpdateReputationEntityCustomerManagedStatusResponse", + "reason": "HTML paragraph in description" + }, + { + "value": "UpdateReputationEntityPolicyResponse", + "reason": "HTML paragraph in description" + }, + { + "value": "UpdatedDKIMAuthorityResponse", + "reason": "Uses import()" + }, + { + "value": "ListRecipientResponse", + "reason": "Schema with only uppercase properties" + }, + { + "value": "TemplateResponse", + "reason": "Schema with only uppercase properties" + }, + { + "value": "TemplateDetailContentResponse", + "reason": "Schema with only uppercase properties" + }, + { + "value": "EventCallbackUrlResponse", + "reason": "Schema with only uppercase properties" + }, + { + "value": "ParseRouteResponse", + "reason": "Schema with only uppercase properties" + }, + { + "value": "SenderResponse", + "reason": "Schema with only uppercase properties" + }, + { + "value": "MetaSenderResponse", + "reason": "Schema with only uppercase properties" + }, + { + "value": "ApiKeyResponse", + "reason": "Schema with only uppercase properties" + }, + { + "value": "MyProfileResponse", + "reason": "Schema with only uppercase properties" + }, + { + "value": "UserResponse", + "reason": "Schema with only uppercase properties" + } + ] +} diff --git a/src/api/routes/channels/#channel_id/messages/index.ts b/src/api/routes/channels/#channel_id/messages/index.ts index 0a84e6b0c..edca59dfe 100644 --- a/src/api/routes/channels/#channel_id/messages/index.ts +++ b/src/api/routes/channels/#channel_id/messages/index.ts @@ -19,7 +19,8 @@ import { handleMessage, postHandleMessage, route } from "@spacebar/api"; import { Attachment, - AutomodExecutor, AutomodInvocation, + AutomodExecutor, + AutomodInvocation, AutomodRule, AutomodTriggerTypes, Channel, @@ -443,13 +444,15 @@ router.post( // @ts-ignore message.member.roles = message.member.roles.filter((x) => x.id != x.guild_id).map((x) => x.id); - const automodResult = await AutomodExecutor.executeInvocation(new AutomodInvocation({ - eventType: AutomodRuleEventType.MESSAGE_SEND, - guildId: message.guild_id, - payload: message - })); + const automodResult = await AutomodExecutor.executeInvocation( + new AutomodInvocation({ + eventType: AutomodRuleEventType.MESSAGE_SEND, + guildId: message.guild_id, + payload: message, + }), + ); - if(automodResult.blocked) { + if (automodResult.blocked) { throw new HTTPError("Unhandled error sending message", 403); } } diff --git a/src/api/routes/users/@me/settings-proto/1.ts b/src/api/routes/users/@me/settings-proto/1.ts index c4fde496f..46b2f3b80 100644 --- a/src/api/routes/users/@me/settings-proto/1.ts +++ b/src/api/routes/users/@me/settings-proto/1.ts @@ -137,8 +137,7 @@ async function patchUserSettings(userId: string, updatedSettings: PreloadedUserS }; } - if (EnvConfig.get().logging.logProtoUpdates.includes("SETTINGS")) - console.log(`Updating user settings for user ${userId} with atomic=${atomic}:`, updatedSettings); + if (EnvConfig.get().logging.logProtoUpdates.includes("SETTINGS")) console.log(`Updating user settings for user ${userId} with atomic=${atomic}:`, updatedSettings); if (!atomic) { settings = PreloadedUserSettings.fromJson( diff --git a/src/api/routes/users/@me/settings-proto/2.ts b/src/api/routes/users/@me/settings-proto/2.ts index d162715d2..efc92faaf 100644 --- a/src/api/routes/users/@me/settings-proto/2.ts +++ b/src/api/routes/users/@me/settings-proto/2.ts @@ -137,8 +137,7 @@ async function patchUserSettings(userId: string, updatedSettings: FrecencyUserSe }; } - if (EnvConfig.get().logging.logProtoUpdates.includes("FRECENCY")) - console.log(`Updating frecency settings for user ${userId} with atomic=${atomic}:`, updatedSettings); + if (EnvConfig.get().logging.logProtoUpdates.includes("FRECENCY")) console.log(`Updating frecency settings for user ${userId} with atomic=${atomic}:`, updatedSettings); if (!atomic) { settings = FrecencyUserSettings.fromJson( diff --git a/src/cdn/util/Storage.ts b/src/cdn/util/Storage.ts index 1b02eb116..522a961da 100644 --- a/src/cdn/util/Storage.ts +++ b/src/cdn/util/Storage.ts @@ -33,7 +33,7 @@ export interface Storage { let storage: Storage; -if (EnvConfig.get().cdn.storageProvider === "file" || !EnvConfig.get().cdn.storageProvider ) { +if (EnvConfig.get().cdn.storageProvider === "file" || !EnvConfig.get().cdn.storageProvider) { let location = EnvConfig.get().cdn.storageLocation; if (location) { location = path.resolve(location); diff --git a/src/gateway/events/Connection.ts b/src/gateway/events/Connection.ts index 3e7e2f3af..ca4770b2b 100644 --- a/src/gateway/events/Connection.ts +++ b/src/gateway/events/Connection.ts @@ -79,18 +79,11 @@ export async function Connection(this: WS.Server, socket: WebSocket, request: In console.log(`[Gateway] New connection from ${ipAddress}, total ${this.clients.size}`); if (EnvConfig.get().logging.gatewayLogging.logHttp) - [ - "close", - "error", - "upgrade", - "open", - "ping", - "pong", - "unexpected-response", - ...(EnvConfig.get().logging.gatewayLogging.logHttpMessages ? ["message"] : []), - ].forEach((x) => { - socket.on(x, (y) => console.log(x, y)); - }); + ["close", "error", "upgrade", "open", "ping", "pong", "unexpected-response", ...(EnvConfig.get().logging.gatewayLogging.logHttpMessages ? ["message"] : [])].forEach( + (x) => { + socket.on(x, (y) => console.log(x, y)); + }, + ); const { searchParams } = new URL(`http://localhost${request.url}`); // @ts-ignore diff --git a/src/gateway/opcodes/Identify.ts b/src/gateway/opcodes/Identify.ts index 86a411247..2e77c6224 100644 --- a/src/gateway/opcodes/Identify.ts +++ b/src/gateway/opcodes/Identify.ts @@ -728,5 +728,8 @@ export async function onIdentify(this: WebSocket, data: Payload) { const setupListenerTime = Date.now(); - console.log(`[Gateway] IDENTIFY ${this.user_id} in ${totalSw.elapsed().totalMilliseconds}ms`, EnvConfig.get().logging.gatewayLogging.logTraces ? JSON.stringify(d._trace, null, 2) : ""); + console.log( + `[Gateway] IDENTIFY ${this.user_id} in ${totalSw.elapsed().totalMilliseconds}ms`, + EnvConfig.get().logging.gatewayLogging.logTraces ? JSON.stringify(d._trace, null, 2) : "", + ); } diff --git a/src/renderEnvConfigSchema.ts b/src/renderEnvConfigSchema.ts index e4d630e11..492e3774b 100755 --- a/src/renderEnvConfigSchema.ts +++ b/src/renderEnvConfigSchema.ts @@ -12,16 +12,16 @@ const schema = EnvConfig.schema(); const keyMap = [ { name: "Name", - selector: (v: {key: string}) => v.key + selector: (v: { key: string }) => v.key, }, { name: "Value", - selector: (v: {type: string}) => v.type + selector: (v: { type: string }) => v.type, }, { name: "Description", - selector: (v: {description: string}) => v.description - } + selector: (v: { description: string }) => v.description, + }, ]; // --- separators const startOfLine = dim("| "); // @@ -32,7 +32,7 @@ const headSeparator = dim("-"); const pad = true; // --- do not touch -const colWidths: {[key: string]: number} = {}; +const colWidths: { [key: string]: number } = {}; console.log(bgRedBright("Calculating column widths")); for (const key of keyMap) { @@ -72,4 +72,4 @@ for (const entry of schema) { process.stdout.write(cell); } process.stdout.write(endOfLine); -} \ No newline at end of file +} diff --git a/src/util/automod/AutomodExecutor.ts b/src/util/automod/AutomodExecutor.ts index cf3d32ebc..63267a3c6 100644 --- a/src/util/automod/AutomodExecutor.ts +++ b/src/util/automod/AutomodExecutor.ts @@ -55,7 +55,9 @@ export class AutomodExecutor { result = await this.executeMemberInvocation(); } else throw new Error("Unsupported automod invocation type"); - console.log(`[Automod] Executed automod invocation of type ${invocation.eventType} in ${Date.now() - startTime}ms with ${matchingRules.length} matching rules. Result: ${result.blocked ? "blocked" : "allowed"}`); + console.log( + `[Automod] Executed automod invocation of type ${invocation.eventType} in ${Date.now() - startTime}ms with ${matchingRules.length} matching rules. Result: ${result.blocked ? "blocked" : "allowed"}`, + ); return result; } diff --git a/src/util/automod/AutomodMessageExecutor.ts b/src/util/automod/AutomodMessageExecutor.ts index b77a50a36..d53cbc6e7 100644 --- a/src/util/automod/AutomodMessageExecutor.ts +++ b/src/util/automod/AutomodMessageExecutor.ts @@ -19,7 +19,6 @@ export async function internalExecuteMessageAutomod(context: AutomodMessageInvoc } let triggered = false; // if (rule.trigger_type == AutomodRuleTriggerType.KEYWORD) - } return result; diff --git a/src/util/automod/index.ts b/src/util/automod/index.ts index bc6cdcf08..4205761ce 100644 --- a/src/util/automod/index.ts +++ b/src/util/automod/index.ts @@ -1 +1 @@ -export * from './AutomodExecutor'; \ No newline at end of file +export * from "./AutomodExecutor"; diff --git a/src/util/config/envTypes/ConfigurationEnvConfiguration.ts b/src/util/config/envTypes/ConfigurationEnvConfiguration.ts index 4f6918d9c..fd25e408c 100644 --- a/src/util/config/envTypes/ConfigurationEnvConfiguration.ts +++ b/src/util/config/envTypes/ConfigurationEnvConfiguration.ts @@ -20,21 +20,24 @@ import { arrayOrderBy } from "@spacebar/util"; export class ConfigurationEnvConfiguration { static get schema() { - return arrayOrderBy([ - { key: "CONFIG_PATH", type: "string", description: "Path to a JSON file containing configuration data" }, - { key: "CONFIG_WRITEBACK", type: "boolean", description: "Whether to write back configuration changes to the specified JSON file" }, - { - key: "CONFIG_MODE", - type: "string", - description: - "How to treat the JSON config.
" + - "
    " + - "
  • **`override`**: Apply overrides without saving
  • " + - "
  • **`overwrite`**: Apply overrides, saving changes to the database
  • " + - "
  • **`single`**: Ignore database config outright
  • " + - "
", - }, - ], (e) => e.key); + return arrayOrderBy( + [ + { key: "CONFIG_PATH", type: "string", description: "Path to a JSON file containing configuration data" }, + { key: "CONFIG_WRITEBACK", type: "boolean", description: "Whether to write back configuration changes to the specified JSON file" }, + { + key: "CONFIG_MODE", + type: "string", + description: + "How to treat the JSON config.
" + + "
    " + + "
  • **`override`**: Apply overrides without saving
  • " + + "
  • **`overwrite`**: Apply overrides, saving changes to the database
  • " + + "
  • **`single`**: Ignore database config outright
  • " + + "
", + }, + ], + (e) => e.key, + ); } get enabled(): boolean { diff --git a/src/util/config/envTypes/DatabaseEnvConfiguration.ts b/src/util/config/envTypes/DatabaseEnvConfiguration.ts index e4cfb5f0c..8cb65e97d 100644 --- a/src/util/config/envTypes/DatabaseEnvConfiguration.ts +++ b/src/util/config/envTypes/DatabaseEnvConfiguration.ts @@ -27,7 +27,8 @@ export class DatabaseEnvConfiguration { { key: "DB_UNSAFE_SCHEMA_SYNC", type: "boolean", - description: "If true, the database schema will be forcibly synchronised. This is unsafe for production environments. **We claim no responsibility for data loss!**", + description: + "If true, the database schema will be forcibly synchronised. This is unsafe for production environments. **We claim no responsibility for data loss!**", }, { key: "DB_DISABLE_JOINS", @@ -37,7 +38,7 @@ export class DatabaseEnvConfiguration { ]; } - get url(): (string | undefined) { + get url(): string | undefined { return process.env.DATABASE; } diff --git a/src/util/config/envTypes/LogEnvConfiguration.ts b/src/util/config/envTypes/LogEnvConfiguration.ts index ab97503cc..68a70deda 100644 --- a/src/util/config/envTypes/LogEnvConfiguration.ts +++ b/src/util/config/envTypes/LogEnvConfiguration.ts @@ -30,23 +30,34 @@ interface GatewayLoggingConfigValue { export class LogEnvConfiguration { static get schema() { - return arrayOrderBy([ - { key: "LOG_CDN_SIGNATURES", type: "boolean", description: "Log CDN attachment signature checks - very noisy!" }, - { key: "LOG_DATABASE_QUERIES", type: "boolean", description: "Enable logging of database queries." }, - { key: "LOG_GATEWAY_EVENTS", type: "boolean", description: "Comma-separated list of flags. Any of: `TRACES`, `USER_ID`, `SESSION_ID`, `PAYLOAD`, `HTTP`, `HTTP_MESSAGES`." }, - { key: "LOG_WEBRTC_EVENTS", type: "boolean", description: "Comma-separated list of flags. Any of: `TRACES`, `USER_ID`, `SESSION_ID`, `PAYLOAD`, `HTTP`, `HTTP_MESSAGES`." }, - { key: "DUMP_GATEWAY_EVENT_PATH", type: "string", description: "Path to dump gateway events." }, - { key: "DUMP_WEBRTC_EVENT_PATH", type: "string", description: "Path to dump gateway events." }, - { key: "LOG_PROTO_UPDATES", type: "boolean or string", description: "`true`, or a list of proto schemas to log (`SETTINGS`, `FRECENCY`)" }, - { - key: "LOG_REQUESTS", - type: "string", - description: "Comma-separated list of requests to log by status code. Negated with a leading `-`. Example: `-204` (log everything except 204 No Content)", - }, - { key: "LOG_AUTHENTICATION", type: "boolean", description: "Log authentication debug messages - very noisy!" }, - { key: "LOG_VALIDATION_ERRORS", type: "boolean", description: "Enable logging of validation errors." }, - { key: "LOG_IMPORT_ERRORS", type: "boolean", description: "Enable logging of import errors." }, - ], (e) => e.key); + return arrayOrderBy( + [ + { key: "LOG_CDN_SIGNATURES", type: "boolean", description: "Log CDN attachment signature checks - very noisy!" }, + { key: "LOG_DATABASE_QUERIES", type: "boolean", description: "Enable logging of database queries." }, + { + key: "LOG_GATEWAY_EVENTS", + type: "boolean", + description: "Comma-separated list of flags. Any of: `TRACES`, `USER_ID`, `SESSION_ID`, `PAYLOAD`, `HTTP`, `HTTP_MESSAGES`.", + }, + { + key: "LOG_WEBRTC_EVENTS", + type: "boolean", + description: "Comma-separated list of flags. Any of: `TRACES`, `USER_ID`, `SESSION_ID`, `PAYLOAD`, `HTTP`, `HTTP_MESSAGES`.", + }, + { key: "DUMP_GATEWAY_EVENT_PATH", type: "string", description: "Path to dump gateway events." }, + { key: "DUMP_WEBRTC_EVENT_PATH", type: "string", description: "Path to dump gateway events." }, + { key: "LOG_PROTO_UPDATES", type: "boolean or string", description: "`true`, or a list of proto schemas to log (`SETTINGS`, `FRECENCY`)" }, + { + key: "LOG_REQUESTS", + type: "string", + description: "Comma-separated list of requests to log by status code. Negated with a leading `-`. Example: `-204` (log everything except 204 No Content)", + }, + { key: "LOG_AUTHENTICATION", type: "boolean", description: "Log authentication debug messages - very noisy!" }, + { key: "LOG_VALIDATION_ERRORS", type: "boolean", description: "Enable logging of validation errors." }, + { key: "LOG_IMPORT_ERRORS", type: "boolean", description: "Enable logging of import errors." }, + ], + (e) => e.key, + ); } get gatewayLogging(): GatewayLoggingConfigValue { @@ -96,9 +107,7 @@ export class LogEnvConfiguration { logTraces: envVal?.includes("TRACES") || logDeprecated("LOG_WEBRTC_TRACES", "LOG_WEBRTC_EVENTS=TRACES") === "true", logUserId: envVal?.includes("USER_ID") ?? false, logSessionId: envVal?.includes("SESSION_ID") ?? false, - logPayload: - envVal?.includes("PAYLOAD") || - logDeprecated("WRTC_WS_VERBOSE", "LOG_WEBRTC_EVENTS=PAYLOAD") === "true", + logPayload: envVal?.includes("PAYLOAD") || logDeprecated("WRTC_WS_VERBOSE", "LOG_WEBRTC_EVENTS=PAYLOAD") === "true", logHttp: envVal?.includes("HTTP") ?? false, logHttpMessages: envVal?.includes("HTTP_MESSAGES") ?? false, }; @@ -111,7 +120,7 @@ export class LogEnvConfiguration { } get dumpGatewayEventPath(): string | undefined { - if(process.env.DUMP_GATEWAY_EVENT_PATH !== undefined) return process.env.DUMP_GATEWAY_EVENT_PATH; + if (process.env.DUMP_GATEWAY_EVENT_PATH !== undefined) return process.env.DUMP_GATEWAY_EVENT_PATH; if (process.env.WS_DUMP !== undefined) { console.warn("[EnvConfig] WS_DUMP is deprecated. Please use DUMP_GATEWAY_EVENT_PATH=./dump instead."); return process.env.WS_DUMP ? "dump" : undefined; @@ -119,7 +128,7 @@ export class LogEnvConfiguration { } get dumpWebrtcEventPath(): string | undefined { - if(process.env.DUMP_WEBRTC_EVENT_PATH !== undefined) return process.env.DUMP_WEBRTC_EVENT_PATH; + if (process.env.DUMP_WEBRTC_EVENT_PATH !== undefined) return process.env.DUMP_WEBRTC_EVENT_PATH; if (process.env.WRTC_DUMP !== undefined) { console.warn("[EnvConfig] WRTC_DUMP is deprecated. Please use DUMP_WEBRTC_EVENT_PATH=./dump_wrtc instead."); return process.env.WRTC_DUMP ? "dump_wrtc" : undefined; diff --git a/src/util/config/envTypes/WebRtcEnvConfiguration.ts b/src/util/config/envTypes/WebRtcEnvConfiguration.ts index 2bcc28bf8..6fb33b569 100644 --- a/src/util/config/envTypes/WebRtcEnvConfiguration.ts +++ b/src/util/config/envTypes/WebRtcEnvConfiguration.ts @@ -20,12 +20,19 @@ import { arrayOrderBy } from "@spacebar/util"; export class WebRtcEnvConfiguration { static get schema() { - return arrayOrderBy([ - { key: "WRTC_PUBLIC_IP", type: "string", description: "Public IP of the server running the media server" }, - { key: "WRTC_PORT_MIN", type: "number", description: "Minimum port for WebRTC media server" }, - { key: "WRTC_PORT_MAX", type: "number", description: "Maximum port for WebRTC media server" }, - { key: "WRTC_LIBRARY", type: "string", description: "WebRTC library to use. One of `@spacebarchat/medooze-webrtc` (voice+video) or `@spacebarchat/mediasoup-webrtc` (voice only)" }, - ], (e) => e.key); + return arrayOrderBy( + [ + { key: "WRTC_PUBLIC_IP", type: "string", description: "Public IP of the server running the media server" }, + { key: "WRTC_PORT_MIN", type: "number", description: "Minimum port for WebRTC media server" }, + { key: "WRTC_PORT_MAX", type: "number", description: "Maximum port for WebRTC media server" }, + { + key: "WRTC_LIBRARY", + type: "string", + description: "WebRTC library to use. One of `@spacebarchat/medooze-webrtc` (voice+video) or `@spacebarchat/mediasoup-webrtc` (voice only)", + }, + ], + (e) => e.key, + ); } get publicIp(): string { diff --git a/src/util/index.ts b/src/util/index.ts index 65305a5d9..e0f83e060 100644 --- a/src/util/index.ts +++ b/src/util/index.ts @@ -28,4 +28,4 @@ export * from "./imports"; export * from "./config"; export * from "./connections"; export * from "./Signing"; -export * from "./automod"; \ No newline at end of file +export * from "./automod"; diff --git a/src/util/util/Token.ts b/src/util/util/Token.ts index a7c936489..580eef514 100644 --- a/src/util/util/Token.ts +++ b/src/util/util/Token.ts @@ -49,7 +49,7 @@ export type UserTokenData = { }; function logAuth(text: string) { - if(!EnvConfig.get().logging.logAuthentication) return; + if (!EnvConfig.get().logging.logAuthentication) return; console.log(`[AUTH] ${text}`); } diff --git a/src/util/util/extensions/Array.ts b/src/util/util/extensions/Array.ts index 355296b14..750e9ba5c 100644 --- a/src/util/util/extensions/Array.ts +++ b/src/util/util/extensions/Array.ts @@ -32,7 +32,6 @@ export function arrayPartition(array: T[], filter: (elem: T) => boolean): [T[ return [pass, fail]; } - export function arrayRemove(array: T[], item: T): void { const index = array.indexOf(item); if (index > -1) { @@ -62,4 +61,4 @@ export function arrayOrderByDescending(array: T[], keySelector: (elem: T) => if (keyA < keyB) return 1; return 0; }); -} \ No newline at end of file +} diff --git a/src/webrtc/events/Connection.ts b/src/webrtc/events/Connection.ts index d76b5bf00..27a8189fd 100644 --- a/src/webrtc/events/Connection.ts +++ b/src/webrtc/events/Connection.ts @@ -36,18 +36,11 @@ export async function Connection(this: WS.Server, socket: WebRtcWebSocket, reque console.log("[WebRTC] new connection", request.url); if (EnvConfig.get().logging.gatewayLogging.logHttp) { - [ - "close", - "error", - "upgrade", - "open", - "ping", - "pong", - "unexpected-response", - ...(EnvConfig.get().logging.gatewayLogging.logHttpMessages ? ["message"] : []), - ].forEach((x) => { - socket.on(x, (y) => console.log("[WebRTC]", x, y)); - }); + ["close", "error", "upgrade", "open", "ping", "pong", "unexpected-response", ...(EnvConfig.get().logging.gatewayLogging.logHttpMessages ? ["message"] : [])].forEach( + (x) => { + socket.on(x, (y) => console.log("[WebRTC]", x, y)); + }, + ); } const { searchParams } = new URL(`http://localhost${request.url}`); diff --git a/src/webrtc/util/Send.ts b/src/webrtc/util/Send.ts index c97a2bdc5..b3161f943 100644 --- a/src/webrtc/util/Send.ts +++ b/src/webrtc/util/Send.ts @@ -24,10 +24,7 @@ export async function Send(socket: WebRtcWebSocket, data: VoicePayload) { await fs.mkdir(path.join(dumpPath!, id), { recursive: true, }); - await fs.writeFile( - path.join(dumpPath!, id, `${Date.now()}.out.json`), - JSON.stringify(data, null, 2), - ); + await fs.writeFile(path.join(dumpPath!, id, `${Date.now()}.out.json`), JSON.stringify(data, null, 2)); } let buffer: Buffer | string;