Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
sayan-das-in committed Sep 25, 2024
1 parent cae15b2 commit ac52c9f
Show file tree
Hide file tree
Showing 15 changed files with 5,308 additions and 6,979 deletions.
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18.12.1
18.18.1
60 changes: 30 additions & 30 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
]
},
"engines": {
"node": "14 || ^18.12"
"node": "^18.18"
},
"scripts": {
"alpha": "lerna version prerelease --allow-branch $(git branch --show-current) --preid $(git branch --show-current) --no-push --no-git-tag-version",
Expand Down Expand Up @@ -37,44 +37,44 @@
"validate": "./bin/run validate"
},
"devDependencies": {
"@peculiar/webcrypto": "^1.2.3",
"@types/aws4": "^1.11.2",
"@types/chance": "^1.1.3",
"@types/cors": "^2.8.12",
"@types/express": "^4.17.16",
"@types/jest": "^27.0.0",
"@types/ws": "^8.5.1",
"@typescript-eslint/eslint-plugin": "^4.14.0",
"@typescript-eslint/parser": "^4.14.0",
"@peculiar/webcrypto": "^1.5.0",
"@types/aws4": "^1.11.6",
"@types/chance": "^1.1.6",
"@types/cors": "^2.8.17",
"@types/express": "^4.17.21",
"@types/jest": "^27.5.2",
"@types/ws": "^8.5.12",
"@typescript-eslint/eslint-plugin": "^4.33.0",
"@typescript-eslint/parser": "^4.33.0",
"cors": "^2.8.5",
"eslint": "^7.25.0",
"eslint-config-prettier": "^6.15.0",
"eslint-plugin-jest": "^25.2.2",
"eslint-plugin-lodash": "^7.3.0",
"express": "^4.18.2",
"husky": "^7.0.0",
"jest": "^27.3.1",
"eslint-plugin-jest": "^25.7.0",
"eslint-plugin-lodash": "^7.4.0",
"express": "^4.21.0",
"husky": "^7.0.4",
"jest": "^27.5.1",
"jest-browser-globals": "^25.1.0-beta",
"jest-mock": "^29.3.1",
"karma": "^6.4.1",
"karma-chrome-launcher": "^3.1.1",
"jest-mock": "^29.7.0",
"karma": "^6.4.4",
"karma-chrome-launcher": "^3.2.0",
"karma-jasmine": "^5.1.0",
"karma-webkit-launcher": "^2.0.0",
"karma-webpack": "^5.0.0",
"lerna": "^6.5.0",
"lint-staged": "^10.5.3",
"open": "^8.4.0",
"karma-webkit-launcher": "^2.6.0",
"karma-webpack": "^5.0.1",
"lerna": "^6.6.2",
"lint-staged": "^10.5.4",
"open": "^8.4.2",
"os-browserify": "^0.3.0",
"path-browserify": "^1.0.1",
"playwright-chromium": "^1.29.2",
"playwright-webkit": "^1.29.2",
"prettier": "^2.4.1",
"playwright-chromium": "^1.47.2",
"playwright-webkit": "^1.47.2",
"prettier": "^2.8.8",
"process": "^0.11.10",
"timers-browserify": "^2.0.12",
"ts-jest": "^27.0.7",
"ts-jest": "^27.1.5",
"ts-node": "^9.1.1",
"typescript": "4.3.5",
"ws": "^8.5.0"
"typescript": "4.9.5",
"ws": "^8.18.0"
},
"resolutions": {
"**/@size-limit/preset-small-lib/**/glob-parent": "^6.0.1",
Expand Down Expand Up @@ -114,6 +114,6 @@
}
},
"dependencies": {
"chance": "^1.1.8"
"chance": "^1.1.12"
}
}
8 changes: 4 additions & 4 deletions packages/actions-shared/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"package.json"
],
"engines": {
"node": "14 || ^18.12"
"node": "^18.18"
},
"engineStrict": true,
"license": "MIT",
Expand All @@ -38,10 +38,10 @@
"dependencies": {
"@amplitude/ua-parser-js": "^0.7.25",
"@segment/actions-core": "^3.134.0",
"cheerio": "^1.0.0-rc.10",
"dayjs": "^1.10.7",
"cheerio": "^1.0.0",
"dayjs": "^1.11.13",
"escape-goat": "^3",
"liquidjs": "^10.8.4",
"liquidjs": "^10.16.7",
"lodash": "^4.17.21"
},
"jest": {
Expand Down
6 changes: 3 additions & 3 deletions packages/ajv-human-errors/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
},
"license": "MIT",
"devDependencies": {
"ajv": "^8.6.3",
"ajv-formats": "^2.1.1",
"jest": "^27.3.1"
"ajv": "^8.17.1",
"ajv-formats": "^3.0.1",
"jest": "^27.5.1"
},
"peerDependencies": {
"ajv": "^8.0.0"
Expand Down
26 changes: 13 additions & 13 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"directory": "packages/cli"
},
"engines": {
"node": "14 || ^18.12"
"node": "^18.18"
},
"engineStrict": true,
"bin": {
Expand Down Expand Up @@ -43,7 +43,7 @@
"@types/json-schema": "^7.0.7",
"@types/lodash": "^4.14.175",
"@types/mustache": "^4.1.0",
"@types/node": "^14.0.0",
"@types/node": "^18.18.1",
"@types/prompts": "^2.0.10",
"@types/rimraf": "^3.0.2",
"@types/to-title-case": "^1.0.0",
Expand All @@ -56,27 +56,27 @@
"@oclif/config": "^1.18.8",
"@oclif/errors": "^1.3.6",
"@oclif/plugin-help": "^3.3",
"@segment/action-destinations": "^3.288.0",
"@segment/actions-core": "^3.121.0",
"@segment/destinations-manifest": "^1.71.0",
"@types/node": "^18.11.15",
"chalk": "^4.1.1",
"@segment/action-destinations": "^3.337.4",
"@segment/actions-core": "^3.134.0",
"@segment/destinations-manifest": "^1.87.0",
"@types/node": "^18.18.1",
"chalk": "^4.1.2",
"chokidar": "^3.5.1",
"dotenv": "^10.0.0",
"ecs-logs-js": "^1.0.0",
"execa": "^5.1.1",
"fs-extra": "^10.0.0",
"globby": "^11.0.3",
"fs-extra": "^10.1.0",
"globby": "^11.1.0",
"jscodeshift": "^0.14.0",
"jscodeshift-add-imports": "^1.0.10",
"jscodeshift-add-imports": "^1.0.11",
"jsdom": "^24.1.1",
"json-diff": "^0.5.4",
"json-schema-to-typescript": "^10.1.5",
"lodash": "^4.17.20",
"lodash": "^4.17.21",
"mustache": "^4.2.0",
"ora": "^5.4.0",
"ora": "^5.4.1",
"prompts": "^2.4.2",
"slugify": "^1.6.1",
"slugify": "^1.6.6",
"to-title-case": "^1.0.0",
"tsconfig-paths": "^3.9.0",
"tslib": "^2.3.1"
Expand Down
18 changes: 9 additions & 9 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,27 +71,27 @@
"typecheck": "tsc -p tsconfig.build.json --noEmit"
},
"devDependencies": {
"@types/btoa-lite": "^1.0.0",
"@types/btoa-lite": "^1.0.2",
"@types/jest": "^27.0.0",
"@types/json-schema": "^7.0.7",
"benny": "^3.7.0",
"benny": "^3.7.1",
"create-test-server": "^3.0.1",
"jest": "^27.3.1"
},
"dependencies": {
"@lukeed/uuid": "^2.0.0",
"@lukeed/uuid": "^2.0.1",
"@segment/action-emitters": "^1.3.6",
"@segment/ajv-human-errors": "^2.13.0",
"@segment/destination-subscriptions": "^3.34.0",
"@types/node": "^18.11.15",
"@types/node": "^18.18.1",
"abort-controller": "^3.0.0",
"aggregate-error": "^3.1.0",
"ajv": "^8.6.3",
"ajv-formats": "^2.1.1",
"ajv": "^8.17.1",
"ajv-formats": "^3.0.1",
"btoa-lite": "^1.0.0",
"cross-fetch": "^3.1.4",
"dayjs": "^1.10.7",
"ts-custom-error": "^3.2.0"
"cross-fetch": "^3.1.8",
"dayjs": "^1.11.13",
"ts-custom-error": "^3.3.1"
},
"jest": {
"preset": "ts-jest",
Expand Down
1 change: 0 additions & 1 deletion packages/core/src/request-client.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import AbortController from 'abort-controller'
import { CustomError } from 'ts-custom-error'
import fetch, { Headers, Request, Response } from './fetch'
import { isObject } from './real-type-of'
Expand Down
32 changes: 16 additions & 16 deletions packages/destination-actions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"package.json"
],
"engines": {
"node": "14 || ^18.12"
"node": "^18.18"
},
"engineStrict": true,
"license": "MIT",
Expand All @@ -31,30 +31,30 @@
"typecheck": "tsc -p tsconfig.build.json --noEmit"
},
"devDependencies": {
"@types/google-libphonenumber": "^7.4.23",
"@types/jest": "^27.0.0",
"@types/ssh2-sftp-client": "^9.0.0",
"jest": "^27.3.1",
"nock": "^13.1.4"
"@types/google-libphonenumber": "^7.4.30",
"@types/jest": "^27.5.2",
"@types/ssh2-sftp-client": "^9.0.4",
"jest": "^27.5.1",
"nock": "^13.5.5"
},
"dependencies": {
"@amplitude/ua-parser-js": "^0.7.25",
"@aws-sdk/client-s3": "^3.600.0",
"@bufbuild/buf": "^1.28.0",
"@bufbuild/protobuf": "^1.4.2",
"@bufbuild/protoc-gen-es": "^1.4.2",
"@aws-sdk/client-s3": "^3.651.0",
"@bufbuild/buf": "^1.41.0",
"@bufbuild/protobuf": "^1.10.0",
"@bufbuild/protoc-gen-es": "^1.10.0",
"@segment/a1-notation": "^2.1.4",
"@segment/actions-core": "^3.134.0",
"@segment/actions-shared": "^1.115.0",
"@types/node": "^18.11.15",
"@types/node": "^18.18.1",
"ajv-formats": "^2.1.1",
"aws4": "^1.12.0",
"cheerio": "^1.0.0-rc.10",
"dayjs": "^1.10.7",
"aws4": "^1.13.2",
"cheerio": "^1.0.0",
"dayjs": "^1.11.13",
"escape-goat": "^3",
"google-libphonenumber": "^3.2.31",
"google-libphonenumber": "^3.2.38",
"kafkajs": "^2.2.4",
"liquidjs": "^10.8.4",
"liquidjs": "^10.16.7",
"lodash": "^4.17.21",
"lru-cache": "10.4.3",
"ssh2-sftp-client": "^9.1.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {

import { ListOperation, UpdateHandlerPayload, UserOperation } from './types'
import type { AudienceSettings } from './generated-types'
import { HTTPError } from '@segment/actions-core'

type DV360AuthCredentials = { refresh_token: string; access_token: string; client_id: string; client_secret: string }

Expand Down Expand Up @@ -197,11 +198,11 @@ export const sendUpdateRequest = async (

await bulkUploaderResponseHandler(response, statsName, statsContext)
} catch (error) {
if (error.response?.status === 500) {
throw new IntegrationError(error.response.message, 'INTERNAL_SERVER_ERROR', 500)
if ((error as HTTPError).response?.status === 500) {
throw new IntegrationError((error as HTTPError).message, 'INTERNAL_SERVER_ERROR', 500)
}

await bulkUploaderResponseHandler(error.response, statsName, statsContext)
await bulkUploaderResponseHandler((error as HTTPError).response, statsName, statsContext)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { ActionDefinition, RequestClient, RetryableError } from '@segment/action
import type { Settings } from '../generated-types'
import { convertValidTimestamp, getUniqueIntercomContact } from '../util'
import type { Payload } from './generated-types'
import { HTTPError } from '@segment/actions-core'

const action: ActionDefinition<Settings, Payload> = {
title: 'Identify Contact',
Expand Down Expand Up @@ -129,7 +130,7 @@ const action: ActionDefinition<Settings, Payload> = {
}
return await createIntercomContact(request, payload)
} catch (error) {
if (error?.response?.status === 409) {
if ((error as HTTPError)?.response?.status === 409) {
// The contact already exists but the Intercom cache most likely wasn't updated yet
throw new RetryableError(
'Contact was reported duplicated but could not be searched for, probably due to Intercom search cache not being updated'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { RequestClient } from '@segment/actions-core'
import { DynamicFieldResponse, HTTPError, RequestClient } from '@segment/actions-core'
import { VisitorAttribute, Event, ProjectConfig } from '../types'
import type { Settings } from '../generated-types'
import reduceRight from 'lodash/reduceRight'
Expand Down Expand Up @@ -51,7 +51,7 @@ function isValidValue(value: unknown) {
return ['string', 'number', 'boolean'].includes(typeof value)
}

export async function getEventKeys(request: RequestClient, settings: Settings) {
export async function getEventKeys(request: RequestClient, settings: Settings): Promise<DynamicFieldResponse> {
try {
const response = await request<ProjectConfig>(settings.dataFileUrl, {
skipResponseCloning: true
Expand All @@ -67,8 +67,8 @@ export async function getEventKeys(request: RequestClient, settings: Settings) {
return {
choices: [],
error: {
message: err?.response?.statusText ?? 'Unknown error',
code: err?.response?.status ?? 'Unknown code'
message: (err as HTTPError)?.response?.statusText ?? 'Unknown error',
code: `${(err as HTTPError)?.response?.status ?? 'Unknown code'}`
}
}
}
Expand Down
Loading

0 comments on commit ac52c9f

Please sign in to comment.