Skip to content

Commit

Permalink
[#3688] Upgrade camelcase keys to v8 with necessary changes (#3698)
Browse files Browse the repository at this point in the history
* package upgrade

* removed log

* update model lib bazel build

* type websocket check
  • Loading branch information
AudreyKj authored Sep 7, 2022
1 parent cecf840 commit e35db22
Show file tree
Hide file tree
Showing 33 changed files with 60 additions and 79 deletions.
2 changes: 1 addition & 1 deletion frontend/chat-plugin/lib/publish_package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"linkify-react": "^3.0.1",
"react": "18.1.0",
"react-dom": "18.1.0",
"camelcase-keys": "7.0.0",
"camelcase-keys": "^8.0.2",
"emoji-mart": "5.2.0",
"@emoji-mart/data": "^1.0.3",
"@emoji-mart/react": "^1.0.0"
Expand Down
3 changes: 1 addition & 2 deletions frontend/chat-plugin/lib/src/components/chat/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ import {CommandUnion, SourceMessage} from 'render';
import {MessageWrapper} from 'components';
import {Source} from 'model';

/* eslint-disable @typescript-eslint/no-var-requires */
const camelcaseKeys = require('camelcase-keys');
import camelcaseKeys from 'camelcase-keys';
import {cyBubble, cyChatPluginMessageList, cyChatPluginEndChatModalButton} from 'chat-plugin-handles';
import {getResumeTokenFromStorage, resetStorage} from '../../storage';
import NewConversation from '../../components/newConversation';
Expand Down
4 changes: 1 addition & 3 deletions frontend/chat-plugin/lib/src/websocket/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ import {
} from 'render/providers/chatplugin/chatPluginModel';
import {Message} from 'model';
import {getResumeTokenFromStorage, resetStorage} from '../storage';

/* eslint-disable @typescript-eslint/no-var-requires */
const camelcaseKeys = require('camelcase-keys');
import camelcaseKeys from 'camelcase-keys';

// https: -> wss: and http: -> ws:
const protocol = location.protocol.replace('http', 'ws');
Expand Down
6 changes: 0 additions & 6 deletions frontend/control-center/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,6 @@ import styles from './App.module.scss';
import {getClientConfig} from './actions/config';
import {Navigate, Route, Routes} from 'react-router-dom';
import {INBOX_ROUTE, CATALOG_ROUTE, CONNECTORS_ROUTE, ROOT_ROUTE, STATUS_ROUTE, WEBHOOKS_ROUTE} from './routes/routes';
import FacebookConnect from './pages/Connectors/Providers/Facebook/Messenger/FacebookConnect';
import ChatPluginConnect from './pages/Connectors/Providers/Airy/ChatPlugin/ChatPluginConnect';
import TwilioSmsConnect from './pages/Connectors/Providers/Twilio/SMS/TwilioSmsConnect';
import TwilioWhatsappConnect from './pages/Connectors/Providers/Twilio/WhatsApp/TwilioWhatsappConnect';
import GoogleConnect from './pages/Connectors/Providers/Google/GoogleConnect';
import InstagramConnect from './pages/Connectors/Providers/Instagram/InstagramConnect';
import NotFound from './pages/NotFound';
import ConnectorsOutlet from './pages/Connectors/ConnectorsOutlet';
import Catalog from './pages/Catalog';
Expand Down
1 change: 1 addition & 0 deletions frontend/control-center/src/routes/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ export const CATALOG_ROUTE = '/catalog';
export const INBOX_ROUTE = '/inbox';

export const STATUS_ROUTE = '/status';

export const WEBHOOKS_ROUTE = '/webhooks';
2 changes: 1 addition & 1 deletion lib/typescript/httpclient/publish_package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"homepage": "https://github.com/airyhq/airy#readme",
"dependencies": {
"node-fetch": "^2.0.0",
"camelcase-keys": "^7.0.0",
"camelcase-keys": "^8.0.2",
"form-data": "^4.0.0"
},
"devDependencies": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* eslint-disable @typescript-eslint/no-var-requires */
const camelcaseKeys = require('camelcase-keys');
import camelcaseKeys from 'camelcase-keys';

export const connectChatPluginChannelDef = {
endpoint: 'channels.chatplugin.connect',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* eslint-disable @typescript-eslint/no-var-requires */
const camelcaseKeys = require('camelcase-keys');
import camelcaseKeys from 'camelcase-keys';

export const connectFacebookChannelDef = {
endpoint: 'channels.facebook.connect',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* eslint-disable @typescript-eslint/no-var-requires */
const camelcaseKeys = require('camelcase-keys');
import camelcaseKeys from 'camelcase-keys';

export const connectGoogleChannelDef = {
endpoint: 'channels.google.connect',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* eslint-disable @typescript-eslint/no-var-requires */
const camelcaseKeys = require('camelcase-keys');
import camelcaseKeys from 'camelcase-keys';

export const connectInstagramChannelDef = {
endpoint: 'channels.instagram.connect',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* eslint-disable @typescript-eslint/no-var-requires */
const camelcaseKeys = require('camelcase-keys');
import camelcaseKeys from 'camelcase-keys';

export const connectTwilioSmsChannelDef = {
endpoint: 'channels.twilio.sms.connect',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* eslint-disable @typescript-eslint/no-var-requires */
const camelcaseKeys = require('camelcase-keys');
import camelcaseKeys from 'camelcase-keys';

export const connectTwilioWhatsappChannelDef = {
endpoint: 'channels.twilio.whatsapp.connect',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* eslint-disable @typescript-eslint/no-var-requires */
const camelcaseKeys = require('camelcase-keys');
import camelcaseKeys from 'camelcase-keys';

export const exploreFacebookChannelsDef = {
endpoint: 'facebook.channels.explore',
Expand Down
1 change: 0 additions & 1 deletion lib/typescript/httpclient/src/endpoints/getConfig.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-var-requires */
import camelcaseKeys from 'camelcase-keys';

export const getConfigDef = {
Expand Down
3 changes: 1 addition & 2 deletions lib/typescript/httpclient/src/endpoints/getContactDetails.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* eslint-disable @typescript-eslint/no-var-requires */
const camelcaseKeys = require('camelcase-keys');
import camelcaseKeys from 'camelcase-keys';

export const getContactDetailsDef = {
endpoint: 'contacts.info',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* eslint-disable @typescript-eslint/no-var-requires */
const camelcaseKeys = require('camelcase-keys');
import camelcaseKeys from 'camelcase-keys';

export const getConversationInfoDef = {
endpoint: 'conversations.info',
Expand Down
3 changes: 1 addition & 2 deletions lib/typescript/httpclient/src/endpoints/listChannels.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* eslint-disable @typescript-eslint/no-var-requires */
const camelcaseKeys = require('camelcase-keys');
import camelcaseKeys from 'camelcase-keys';

export const listChannelsDef = {
endpoint: 'channels.list',
Expand Down
3 changes: 1 addition & 2 deletions lib/typescript/httpclient/src/endpoints/listContacts.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* eslint-disable @typescript-eslint/no-var-requires */
const camelcaseKeys = require('camelcase-keys');
import camelcaseKeys from 'camelcase-keys';

export const listContactsDef = {
endpoint: 'contacts.list',
Expand Down
4 changes: 2 additions & 2 deletions lib/typescript/httpclient/src/endpoints/listConversations.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {PaginatedPayload, ListConversationsRequestPayload} from '../payload';
/* eslint-disable @typescript-eslint/no-var-requires */
const camelcaseKeys = require('camelcase-keys');

import camelcaseKeys from 'camelcase-keys';
import {mapMessage} from 'model';

export const listConversationsDef = {
Expand Down
4 changes: 1 addition & 3 deletions lib/typescript/httpclient/src/endpoints/listMessages.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import {mapMessage} from 'model';

/* eslint-disable @typescript-eslint/no-var-requires */
const camelcaseKeys = require('camelcase-keys');
import camelcaseKeys from 'camelcase-keys';

export const listMessagesDef = {
endpoint: 'messages.list',
Expand Down
3 changes: 1 addition & 2 deletions lib/typescript/httpclient/src/endpoints/listTemplates.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* eslint-disable @typescript-eslint/no-var-requires */
const camelcaseKeys = require('camelcase-keys');
import camelcaseKeys from 'camelcase-keys';

export const listTemplatesDef = {
endpoint: 'templates.list',
Expand Down
3 changes: 1 addition & 2 deletions lib/typescript/httpclient/src/endpoints/listWebhooks.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* eslint-disable @typescript-eslint/no-var-requires */
const camelcaseKeys = require('camelcase-keys');
import camelcaseKeys from 'camelcase-keys';

export const listWebhooksDef = {
endpoint: 'webhooks.list',
Expand Down
3 changes: 1 addition & 2 deletions lib/typescript/httpclient/src/endpoints/subscribeWebhook.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* eslint-disable @typescript-eslint/no-var-requires */
const camelcaseKeys = require('camelcase-keys');
import camelcaseKeys from 'camelcase-keys';

export const subscribeWebhookDef = {
endpoint: 'webhooks.subscribe',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* eslint-disable @typescript-eslint/no-var-requires */
const camelcaseKeys = require('camelcase-keys');
import camelcaseKeys from 'camelcase-keys';

export const unsubscribeWebhookDef = {
endpoint: 'webhooks.unsubscribe',
Expand Down
3 changes: 1 addition & 2 deletions lib/typescript/httpclient/src/endpoints/updateChannel.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* eslint-disable @typescript-eslint/no-var-requires */
const camelcaseKeys = require('camelcase-keys');
import camelcaseKeys from 'camelcase-keys';

export const updateChannelDef = {
endpoint: 'channels.update',
Expand Down
3 changes: 1 addition & 2 deletions lib/typescript/httpclient/src/endpoints/updateWebhook.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* eslint-disable @typescript-eslint/no-var-requires */
const camelcaseKeys = require('camelcase-keys');
import camelcaseKeys from 'camelcase-keys';

export const updateWebhookDef = {
endpoint: 'webhooks.update',
Expand Down
3 changes: 1 addition & 2 deletions lib/typescript/httpclient/src/endpoints/uploadFile.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import _ from 'form-data';
import {UploadFileRequestPayload} from '../payload';
/* eslint-disable @typescript-eslint/no-var-requires */
const camelcaseKeys = require('camelcase-keys');
import camelcaseKeys from 'camelcase-keys';

export const uploadFileDef = {
endpoint: 'media.upload',
Expand Down
1 change: 1 addition & 0 deletions lib/typescript/model/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ ts_web_library(
name = "model",
deps = [
"@npm//@types/node",
"@npm//camelcase-keys",
],
)

Expand Down
3 changes: 1 addition & 2 deletions lib/typescript/model/Message.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* eslint-disable @typescript-eslint/no-var-requires */
const camelcaseKeys = require('camelcase-keys');
import camelcaseKeys from 'camelcase-keys';
import {Content} from './Content';
import {Suggestions} from './SuggestedReply';

Expand Down
3 changes: 1 addition & 2 deletions lib/typescript/websocketclient/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import {StompWrapper} from './stompWrapper';
import {Message, Channel, MetadataEvent, Tag} from 'model';
import {EventPayload} from './payload';
/* eslint-disable @typescript-eslint/no-var-requires */
const camelcaseKeys = require('camelcase-keys');
import camelcaseKeys from 'camelcase-keys';

type CallbackMap = {
onMessage?: (conversationId: string, channelId: string, message: Message) => void;
Expand Down
8 changes: 7 additions & 1 deletion lib/typescript/websocketclient/payload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ export interface MessageCreatedPayload extends Event {
delivery_state: DeliveryState;
from_contact: boolean;
sent_at: Date;
source: Source;
sender: {
id: string;
name?: string;
avatar_url?: string;
};
};
};
}
Expand Down Expand Up @@ -42,7 +48,7 @@ export interface ChannelUpdatedPayload extends Event {
type: 'channel.updated';
payload: {
id: string;
metadata?: Metadata & {
metadata: Metadata & {
name: string;
image_url?: string;
};
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"@testing-library/user-event": "^14.4.3",
"@types/jest": "^28.1.7",
"audio-recorder-polyfill": "^0.4.1",
"camelcase-keys": "^7.0.2",
"camelcase-keys": "^8.0.2",
"core-js": "3.25.0",
"emoji-mart": "^5.2.1",
"form-data": "^4.0.0",
Expand Down
41 changes: 23 additions & 18 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3017,26 +3017,31 @@ camel-case@^4.1.2:
pascal-case "^3.1.2"
tslib "^2.0.3"

camelcase-keys@^7.0.2:
version "7.0.2"
resolved "https://registry.yarnpkg.com/camelcase-keys/-/camelcase-keys-7.0.2.tgz#d048d8c69448745bb0de6fc4c1c52a30dfbe7252"
integrity sha512-Rjs1H+A9R+Ig+4E/9oyB66UC5Mj9Xq3N//vcLf2WzgdTi/3gUu3Z9KoqmlrEG4VuuLK8wJHofxzdQXz/knhiYg==
camelcase-keys@^8.0.2:
version "8.0.2"
resolved "https://registry.yarnpkg.com/camelcase-keys/-/camelcase-keys-8.0.2.tgz#a7140ba7c797aea32161d4ce5cdbda11d09eb414"
integrity sha512-qMKdlOfsjlezMqxkUGGMaWWs17i2HoL15tM+wtx8ld4nLrUwU58TFdvyGOz/piNP842KeO8yXvggVQSdQ828NA==
dependencies:
camelcase "^6.3.0"
map-obj "^4.1.0"
quick-lru "^5.1.1"
type-fest "^1.2.1"
camelcase "^7.0.0"
map-obj "^4.3.0"
quick-lru "^6.1.1"
type-fest "^2.13.0"

camelcase@^5.3.1:
version "5.3.1"
resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320"
integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==

camelcase@^6.2.0, camelcase@^6.3.0:
camelcase@^6.2.0:
version "6.3.0"
resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.3.0.tgz#5685b95eb209ac9c0c177467778c9c84df58ba9a"
integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==

camelcase@^7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-7.0.0.tgz#fd112621b212126741f998d614cbc2a8623fd174"
integrity sha512-JToIvOmz6nhGsUhAYScbo2d6Py5wojjNfoxoc2mEVLUdJ70gJK2gnd+ABY1Tc3sVMyK7QDPtN0T/XdlCQWITyQ==

caniuse-lite@^1.0.30001332:
version "1.0.30001342"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001342.tgz#87152b1e3b950d1fbf0093e23f00b6c8e8f1da96"
Expand Down Expand Up @@ -6067,7 +6072,7 @@ makeerror@1.0.12:
dependencies:
tmpl "1.0.5"

map-obj@^4.1.0:
map-obj@^4.3.0:
version "4.3.0"
resolved "https://registry.yarnpkg.com/map-obj/-/map-obj-4.3.0.tgz#9304f906e93faae70880da102a9f1df0ea8bb05a"
integrity sha512-hdN1wVrZbb29eBGiGjJbeP8JbKjq1urkHJ/LIP/NY48MZ1QVXUsQBV1G1zvYFHn1XE06cwjBsOI2K3Ulnj1YXQ==
Expand Down Expand Up @@ -7023,10 +7028,10 @@ queue-microtask@^1.2.2:
resolved "https://registry.yarnpkg.com/queue-microtask/-/queue-microtask-1.2.3.tgz#4929228bbc724dfac43e0efb058caf7b6cfb6243"
integrity sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==

quick-lru@^5.1.1:
version "5.1.1"
resolved "https://registry.yarnpkg.com/quick-lru/-/quick-lru-5.1.1.tgz#366493e6b3e42a3a6885e2e99d18f80fb7a8c932"
integrity sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA==
quick-lru@^6.1.1:
version "6.1.1"
resolved "https://registry.yarnpkg.com/quick-lru/-/quick-lru-6.1.1.tgz#f8e5bf9010376c126c80c1a62827a526c0e60adf"
integrity sha512-S27GBT+F0NTRiehtbrgaSE1idUAJ5bX8dPAQTdylEyNlrdcH5X4Lz7Edz3DYzecbsCluD5zO8ZNEe04z3D3u6Q==

randombytes@^2.1.0:
version "2.1.0"
Expand Down Expand Up @@ -8263,10 +8268,10 @@ type-fest@^0.21.3:
resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.21.3.tgz#d260a24b0198436e133fa26a524a6d65fa3b2e37"
integrity sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==

type-fest@^1.2.1:
version "1.4.0"
resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-1.4.0.tgz#e9fb813fe3bf1744ec359d55d1affefa76f14be1"
integrity sha512-yGSza74xk0UG8k+pLh5oeoYirvIiWo5t0/o3zHHAO2tRDiZcxWP7fywNlXhqb6/r6sWvwi+RsyQMWhVLe4BVuA==
type-fest@^2.13.0:
version "2.19.0"
resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-2.19.0.tgz#88068015bb33036a598b952e55e9311a60fd3a9b"
integrity sha512-RAH822pAdBgcNMAfWnCBU3CFZcfZ/i1eZjwFU/dsLKumyuuP3niueg2UAukXYF0E2AAoc82ZSSf9J0WQBinzHA==

type-is@~1.6.18:
version "1.6.18"
Expand Down

0 comments on commit e35db22

Please sign in to comment.