From a1be2ae5de584d086f02ef69d2838272bcb39353 Mon Sep 17 00:00:00 2001 From: Kevin Aleman Date: Wed, 18 Oct 2023 13:07:08 -0600 Subject: [PATCH] refactor: Small files to typescript (#30665) --- .../federation/server/lib/getFederationDiscoveryMethod.js | 3 --- .../federation/server/lib/getFederationDiscoveryMethod.ts | 3 +++ .../meteor/app/federation/server/lib/getFederationDomain.js | 3 --- .../meteor/app/federation/server/lib/getFederationDomain.ts | 3 +++ .../meteor/app/federation/server/lib/isFederationEnabled.js | 3 --- .../meteor/app/federation/server/lib/isFederationEnabled.ts | 3 +++ .../app/federation/server/lib/{logger.js => logger.ts} | 0 apps/meteor/definition/externals/meteor/meteor.d.ts | 6 ++++++ .../lib/{addRoleRestrictions.js => addRoleRestrictions.ts} | 0 .../lib/{guestPermissions.js => guestPermissions.ts} | 0 apps/meteor/ee/app/settings/server/{index.js => index.ts} | 0 apps/meteor/server/startup/{appcache.js => appcache.ts} | 0 apps/meteor/server/startup/migrations/{xrun.js => xrun.ts} | 0 apps/meteor/tests/data/api-data.js | 4 ++-- apps/meteor/tests/data/{channel.js => channel.ts} | 0 apps/meteor/tests/data/{interactions.js => interactions.ts} | 0 apps/meteor/tests/data/{role.js => role.ts} | 0 apps/meteor/tests/data/uploads.helper.ts | 2 +- apps/meteor/tests/end-to-end/api/01-users.js | 2 +- apps/meteor/tests/end-to-end/api/09-rooms.js | 2 +- apps/meteor/tests/end-to-end/api/14-assets.js | 2 +- 21 files changed, 21 insertions(+), 15 deletions(-) delete mode 100644 apps/meteor/app/federation/server/lib/getFederationDiscoveryMethod.js create mode 100644 apps/meteor/app/federation/server/lib/getFederationDiscoveryMethod.ts delete mode 100644 apps/meteor/app/federation/server/lib/getFederationDomain.js create mode 100644 apps/meteor/app/federation/server/lib/getFederationDomain.ts delete mode 100644 apps/meteor/app/federation/server/lib/isFederationEnabled.js create mode 100644 apps/meteor/app/federation/server/lib/isFederationEnabled.ts rename apps/meteor/app/federation/server/lib/{logger.js => logger.ts} (100%) rename apps/meteor/ee/app/authorization/lib/{addRoleRestrictions.js => addRoleRestrictions.ts} (100%) rename apps/meteor/ee/app/authorization/lib/{guestPermissions.js => guestPermissions.ts} (100%) rename apps/meteor/ee/app/settings/server/{index.js => index.ts} (100%) rename apps/meteor/server/startup/{appcache.js => appcache.ts} (100%) rename apps/meteor/server/startup/migrations/{xrun.js => xrun.ts} (100%) rename apps/meteor/tests/data/{channel.js => channel.ts} (100%) rename apps/meteor/tests/data/{interactions.js => interactions.ts} (100%) rename apps/meteor/tests/data/{role.js => role.ts} (100%) diff --git a/apps/meteor/app/federation/server/lib/getFederationDiscoveryMethod.js b/apps/meteor/app/federation/server/lib/getFederationDiscoveryMethod.js deleted file mode 100644 index 2da490942fdce..0000000000000 --- a/apps/meteor/app/federation/server/lib/getFederationDiscoveryMethod.js +++ /dev/null @@ -1,3 +0,0 @@ -import { settings } from '../../../settings/server'; - -export const getFederationDiscoveryMethod = () => settings.get('FEDERATION_Discovery_Method'); diff --git a/apps/meteor/app/federation/server/lib/getFederationDiscoveryMethod.ts b/apps/meteor/app/federation/server/lib/getFederationDiscoveryMethod.ts new file mode 100644 index 0000000000000..b8ea8c4f6ce6e --- /dev/null +++ b/apps/meteor/app/federation/server/lib/getFederationDiscoveryMethod.ts @@ -0,0 +1,3 @@ +import { settings } from '../../../settings/server'; + +export const getFederationDiscoveryMethod = () => settings.get('FEDERATION_Discovery_Method'); diff --git a/apps/meteor/app/federation/server/lib/getFederationDomain.js b/apps/meteor/app/federation/server/lib/getFederationDomain.js deleted file mode 100644 index c5e67629db75f..0000000000000 --- a/apps/meteor/app/federation/server/lib/getFederationDomain.js +++ /dev/null @@ -1,3 +0,0 @@ -import { settings } from '../../../settings/server'; - -export const getFederationDomain = () => settings.get('FEDERATION_Domain').replace('@', ''); diff --git a/apps/meteor/app/federation/server/lib/getFederationDomain.ts b/apps/meteor/app/federation/server/lib/getFederationDomain.ts new file mode 100644 index 0000000000000..80f683743f2d7 --- /dev/null +++ b/apps/meteor/app/federation/server/lib/getFederationDomain.ts @@ -0,0 +1,3 @@ +import { settings } from '../../../settings/server'; + +export const getFederationDomain = () => settings.get('FEDERATION_Domain').replace('@', ''); diff --git a/apps/meteor/app/federation/server/lib/isFederationEnabled.js b/apps/meteor/app/federation/server/lib/isFederationEnabled.js deleted file mode 100644 index 9e46d3004acef..0000000000000 --- a/apps/meteor/app/federation/server/lib/isFederationEnabled.js +++ /dev/null @@ -1,3 +0,0 @@ -import { settings } from '../../../settings/server'; - -export const isFederationEnabled = () => settings.get('FEDERATION_Enabled'); diff --git a/apps/meteor/app/federation/server/lib/isFederationEnabled.ts b/apps/meteor/app/federation/server/lib/isFederationEnabled.ts new file mode 100644 index 0000000000000..e3edb818e602d --- /dev/null +++ b/apps/meteor/app/federation/server/lib/isFederationEnabled.ts @@ -0,0 +1,3 @@ +import { settings } from '../../../settings/server'; + +export const isFederationEnabled = () => settings.get('FEDERATION_Enabled'); diff --git a/apps/meteor/app/federation/server/lib/logger.js b/apps/meteor/app/federation/server/lib/logger.ts similarity index 100% rename from apps/meteor/app/federation/server/lib/logger.js rename to apps/meteor/app/federation/server/lib/logger.ts diff --git a/apps/meteor/definition/externals/meteor/meteor.d.ts b/apps/meteor/definition/externals/meteor/meteor.d.ts index 622f3032b4840..4854d24a37bab 100644 --- a/apps/meteor/definition/externals/meteor/meteor.d.ts +++ b/apps/meteor/definition/externals/meteor/meteor.d.ts @@ -130,5 +130,11 @@ declare module 'meteor/meteor' { ...args: StringifyBuffers> ) => ReturnType | Promise>; }): void; + + const AppCache: + | { + config: (config: { onlineOnly: string[] }) => void; + } + | undefined; } } diff --git a/apps/meteor/ee/app/authorization/lib/addRoleRestrictions.js b/apps/meteor/ee/app/authorization/lib/addRoleRestrictions.ts similarity index 100% rename from apps/meteor/ee/app/authorization/lib/addRoleRestrictions.js rename to apps/meteor/ee/app/authorization/lib/addRoleRestrictions.ts diff --git a/apps/meteor/ee/app/authorization/lib/guestPermissions.js b/apps/meteor/ee/app/authorization/lib/guestPermissions.ts similarity index 100% rename from apps/meteor/ee/app/authorization/lib/guestPermissions.js rename to apps/meteor/ee/app/authorization/lib/guestPermissions.ts diff --git a/apps/meteor/ee/app/settings/server/index.js b/apps/meteor/ee/app/settings/server/index.ts similarity index 100% rename from apps/meteor/ee/app/settings/server/index.js rename to apps/meteor/ee/app/settings/server/index.ts diff --git a/apps/meteor/server/startup/appcache.js b/apps/meteor/server/startup/appcache.ts similarity index 100% rename from apps/meteor/server/startup/appcache.js rename to apps/meteor/server/startup/appcache.ts diff --git a/apps/meteor/server/startup/migrations/xrun.js b/apps/meteor/server/startup/migrations/xrun.ts similarity index 100% rename from apps/meteor/server/startup/migrations/xrun.js rename to apps/meteor/server/startup/migrations/xrun.ts diff --git a/apps/meteor/tests/data/api-data.js b/apps/meteor/tests/data/api-data.js index 25e89c2ef99af..d08e4cc50c54e 100644 --- a/apps/meteor/tests/data/api-data.js +++ b/apps/meteor/tests/data/api-data.js @@ -1,7 +1,7 @@ import supertest from 'supertest'; -import { publicChannelName, privateChannelName } from './channel.js'; -import { roleNameUsers, roleNameSubscriptions, roleScopeUsers, roleScopeSubscriptions, roleDescription } from './role.js'; +import { publicChannelName, privateChannelName } from './channel'; +import { roleNameUsers, roleNameSubscriptions, roleScopeUsers, roleScopeSubscriptions, roleDescription } from './role'; import { username, email, adminUsername, adminPassword } from './user'; const apiUrl = process.env.TEST_API_URL || 'http://localhost:3000'; diff --git a/apps/meteor/tests/data/channel.js b/apps/meteor/tests/data/channel.ts similarity index 100% rename from apps/meteor/tests/data/channel.js rename to apps/meteor/tests/data/channel.ts diff --git a/apps/meteor/tests/data/interactions.js b/apps/meteor/tests/data/interactions.ts similarity index 100% rename from apps/meteor/tests/data/interactions.js rename to apps/meteor/tests/data/interactions.ts diff --git a/apps/meteor/tests/data/role.js b/apps/meteor/tests/data/role.ts similarity index 100% rename from apps/meteor/tests/data/role.js rename to apps/meteor/tests/data/role.ts diff --git a/apps/meteor/tests/data/uploads.helper.ts b/apps/meteor/tests/data/uploads.helper.ts index 194b19df34c82..29c7a143484ce 100644 --- a/apps/meteor/tests/data/uploads.helper.ts +++ b/apps/meteor/tests/data/uploads.helper.ts @@ -5,7 +5,7 @@ import { after, before, it } from 'mocha'; import { api, request, credentials } from './api-data.js'; import { password } from './user'; import { createUser, login } from './users.helper'; -import { imgURL } from './interactions.js'; +import { imgURL } from './interactions'; import { updateSetting } from './permissions.helper'; import { createRoom } from './rooms.helper'; import { createVisitor } from './livechat/rooms'; diff --git a/apps/meteor/tests/end-to-end/api/01-users.js b/apps/meteor/tests/end-to-end/api/01-users.js index d99fa68a036f8..b8343dc015da1 100644 --- a/apps/meteor/tests/end-to-end/api/01-users.js +++ b/apps/meteor/tests/end-to-end/api/01-users.js @@ -19,7 +19,7 @@ import { } from '../../data/api-data.js'; import { MAX_BIO_LENGTH, MAX_NICKNAME_LENGTH } from '../../data/constants.ts'; import { customFieldText, clearCustomFields, setCustomFields } from '../../data/custom-fields.js'; -import { imgURL } from '../../data/interactions.js'; +import { imgURL } from '../../data/interactions'; import { updatePermission, updateSetting } from '../../data/permissions.helper'; import { createRoom } from '../../data/rooms.helper'; import { adminEmail, preferences, password, adminUsername } from '../../data/user'; diff --git a/apps/meteor/tests/end-to-end/api/09-rooms.js b/apps/meteor/tests/end-to-end/api/09-rooms.js index 10d576c316a24..533c0b63da444 100644 --- a/apps/meteor/tests/end-to-end/api/09-rooms.js +++ b/apps/meteor/tests/end-to-end/api/09-rooms.js @@ -7,7 +7,7 @@ import { after, afterEach, before, beforeEach, describe, it } from 'mocha'; import { sleep } from '../../../lib/utils/sleep'; import { getCredentials, api, request, credentials } from '../../data/api-data.js'; import { sendSimpleMessage, deleteMessage } from '../../data/chat.helper'; -import { imgURL } from '../../data/interactions.js'; +import { imgURL } from '../../data/interactions'; import { updateEEPermission, updatePermission, updateSetting } from '../../data/permissions.helper'; import { closeRoom, createRoom } from '../../data/rooms.helper'; import { password } from '../../data/user'; diff --git a/apps/meteor/tests/end-to-end/api/14-assets.js b/apps/meteor/tests/end-to-end/api/14-assets.js index 4e9c61b53301c..8248e8c04f090 100644 --- a/apps/meteor/tests/end-to-end/api/14-assets.js +++ b/apps/meteor/tests/end-to-end/api/14-assets.js @@ -2,7 +2,7 @@ import { expect } from 'chai'; import { before, describe, it } from 'mocha'; import { getCredentials, api, request, credentials } from '../../data/api-data.js'; -import { imgURL } from '../../data/interactions.js'; +import { imgURL } from '../../data/interactions'; describe('[Assets]', function () { this.retries(0);