Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

feat: add optional messageId field for NodeJS #285

Merged
merged 2 commits into from
Jan 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 20 additions & 5 deletions src/__tests__/commands/__snapshots__/build.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ function validateAgainstSchema(message, schema) {
function withTypewriterContext(message) {
return __assign(__assign({}, message), { context: __assign(__assign({}, (message.context || {})), { typewriter: {
language: 'typescript',
version: '8.0.8',
version: '8.0.10',
} }) });
}
/**
Expand Down Expand Up @@ -5363,7 +5363,7 @@ function withTypewriterContext(message: Options = {}): Options {
...(message.context || {}),
typewriter: {
language: 'typescript',
version: '8.0.8',
version: '8.0.10',
},
},
};
Expand Down Expand Up @@ -6679,6 +6679,11 @@ export type TrackMessage<PropertiesType> = Options & Record<string, any> & Ident
* a timestamp.
*/
timestamp?: Date
/**
* MessageId which can be optionally set to override the default one generated by the library.
* This is useful when you want to deduplicate messages.
*/
messageId?: string
}

/** The callback exposed by analytics-node. */
Expand Down Expand Up @@ -6887,7 +6892,7 @@ function withTypewriterContext<P, T extends TrackMessage<P>>(
...(message.context || {}),
typewriter: {
language: 'typescript',
version: '8.0.8',
version: '8.0.10',
},
},
}
Expand Down Expand Up @@ -8248,6 +8253,11 @@ export type TrackMessage<PropertiesType> = Options & Record<string, any> & Ident
* a timestamp.
*/
timestamp?: Date
/**
* MessageId which can be optionally set to override the default one generated by the library.
* This is useful when you want to deduplicate messages.
*/
messageId?: string
}

/** The callback exposed by analytics-node. */
Expand Down Expand Up @@ -8456,7 +8466,7 @@ function withTypewriterContext<P, T extends TrackMessage<P>>(
...(message.context || {}),
typewriter: {
language: 'typescript',
version: '8.0.8',
version: '8.0.10',
},
},
}
Expand Down Expand Up @@ -9778,6 +9788,11 @@ export type TrackMessage<PropertiesType> = Options & Record<string, any> & Ident
* a timestamp.
*/
timestamp?: Date
/**
* MessageId which can be optionally set to override the default one generated by the library.
* This is useful when you want to deduplicate messages.
*/
messageId?: string
}

/** The callback exposed by analytics-node. */
Expand Down Expand Up @@ -9986,7 +10001,7 @@ function withTypewriterContext<P, T extends TrackMessage<P>>(
...(message.context || {}),
typewriter: {
language: 'typescript',
version: '8.0.8',
version: '8.0.10',
},
},
}
Expand Down
9 changes: 7 additions & 2 deletions src/__tests__/commands/__snapshots__/production.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -852,7 +852,7 @@ function withTypewriterContext(message: Options = {}): Options {
...(message.context || {}),
typewriter: {
language: 'typescript',
version: '8.0.8',
version: '8.0.10',
},
},
};
Expand Down Expand Up @@ -2125,6 +2125,11 @@ export type TrackMessage<PropertiesType> = Options & Record<string, any> & Ident
* a timestamp.
*/
timestamp?: Date
/**
* MessageId which can be optionally set to override the default one generated by the library.
* This is useful when you want to deduplicate messages.
*/
messageId?: string
}

/** The callback exposed by analytics-node. */
Expand Down Expand Up @@ -2317,7 +2322,7 @@ function withTypewriterContext<P, T extends TrackMessage<P>>(
...(message.context || {}),
typewriter: {
language: 'typescript',
version: '8.0.8',
version: '8.0.10',
},
},
}
Expand Down
5 changes: 5 additions & 0 deletions src/languages/templates/typescript/node.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ export type TrackMessage<PropertiesType> = Options & Record<string, any> & Ident
* a timestamp.
*/
timestamp?: Date
/**
* MessageId which can be optionally set to override the default one generated by the library.
* This is useful when you want to deduplicate messages.
*/
messageId?: string
}

/** The callback exposed by analytics-node. */
Expand Down