From a1cfb935c24967a6306b012840936a704ad1e7a2 Mon Sep 17 00:00:00 2001 From: Seth Silesky <5115498+silesky@users.noreply.github.com> Date: Wed, 11 Jan 2023 14:23:45 -0600 Subject: [PATCH] node: export Param types (#767) --- .buildkite/pipeline.yml | 22 ++++++++++++++++++- .../src/durability-tests/durability-tests.ts | 2 +- .../src/perf-tests/perf-tests.ts | 2 +- packages/node/src/app/types/params.ts | 10 +++++++++ packages/node/src/index.ts | 11 +++++++++- 5 files changed, 43 insertions(+), 4 deletions(-) diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 9a68f2ee5..52f929565 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -85,8 +85,28 @@ steps: - echo "+++ Run tests" - yarn run -T node lint - yarn run -T node test - - yarn turbo run --filter=node-integration-tests test + plugins: + - ssh://git@github.com/segmentio/cache-buildkite-plugin#v2.0.0: + key: "v1.1-cache-dev-{{ checksum 'yarn.lock' }}" + paths: ['.yarn/cache/'] + + - label: '[Node] Integration Tests :perfection:' + key: analytics-node-lint-test + agents: + queue: v1 + commands: + - npm config set "//registry.npmjs.org/:_authToken" $${NPM_TOKEN} + - echo "--- Install dependencies" + - PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 HUSKY=0 yarn install --immutable + - echo "--- Build bundles" + - yarn turbo run --filter=node-integration-tests build + - echo "+++ Run tests" - yarn turbo run --filter=node-integration-tests lint + - yarn turbo run --filter=node-integration-tests test + retry: + automatic: + - exit_status: '*' + limit: 2 plugins: - ssh://git@github.com/segmentio/cache-buildkite-plugin#v2.0.0: key: "v1.1-cache-dev-{{ checksum 'yarn.lock' }}" diff --git a/packages/node-integration-tests/src/durability-tests/durability-tests.ts b/packages/node-integration-tests/src/durability-tests/durability-tests.ts index 9825f318f..d2ca67638 100644 --- a/packages/node-integration-tests/src/durability-tests/durability-tests.ts +++ b/packages/node-integration-tests/src/durability-tests/durability-tests.ts @@ -20,7 +20,7 @@ const execAndKill = async (moduleName: string) => { cp.stdout?.on('data', (msg) => console.log(msg)) cp.stderr?.on('data', (err) => console.error(err)) - await sleep(1000) // wait some amount of time for the server to come online before running autocannon, otherwise we will get connection errors. + await sleep(3000) // wait some amount of time for the server to come online before running autocannon, otherwise we will get connection errors. const { requests, errors } = await runAutocannon({ amount: TOTAL_REQUESTS }) diff --git a/packages/node-integration-tests/src/perf-tests/perf-tests.ts b/packages/node-integration-tests/src/perf-tests/perf-tests.ts index c38c7d056..dfc07f079 100644 --- a/packages/node-integration-tests/src/perf-tests/perf-tests.ts +++ b/packages/node-integration-tests/src/perf-tests/perf-tests.ts @@ -17,7 +17,7 @@ const execAndKill = async (moduleName: string) => { cp.stdout?.on('data', (msg) => console.log(msg)) cp.stderr?.on('data', (err) => console.error(err)) - await sleep(1000) // wait some amount of time for the server to come online before running autocannon, otherwise we will get connection errors. + await sleep(3000) // wait some amount of time for the server to come online before running autocannon, otherwise we will get connection errors. const { requests, errors } = await runAutocannon() diff --git a/packages/node/src/app/types/params.ts b/packages/node/src/app/types/params.ts index 7574f1978..7b75acca1 100644 --- a/packages/node/src/app/types/params.ts +++ b/packages/node/src/app/types/params.ts @@ -34,6 +34,11 @@ export type AliasParams = { export type GroupParams = { groupId: string + /** + * Traits are pieces of information you know about a group. + * This interface represents reserved traits that Segment has standardized. + * @link https://segment.com/docs/connections/spec/group/#traits + */ traits?: GroupTraits context?: ExtraContext timestamp?: Timestamp @@ -41,6 +46,11 @@ export type GroupParams = { } & IdentityOptions export type IdentifyParams = { + /** + * Traits are pieces of information you know about a group. + * This interface represents reserved traits that Segment has standardized. + * @link https://segment.com/docs/connections/spec/group/#traits + */ traits?: UserTraits context?: ExtraContext integrations?: Integrations diff --git a/packages/node/src/index.ts b/packages/node/src/index.ts index de0464cb2..d6294449a 100644 --- a/packages/node/src/index.ts +++ b/packages/node/src/index.ts @@ -1,6 +1,15 @@ export { Analytics } from './app/analytics-node' export { Context } from './app/context' -export { Plugin, GroupTraits, UserTraits } from './app/types' +export type { + Plugin, + GroupTraits, + UserTraits, + TrackParams, + IdentifyParams, + AliasParams, + GroupParams, + PageParams, +} from './app/types' export type { AnalyticsSettings } from './app/settings' // export Analytics as both a named export and a default export (for backwards-compat. reasons)