@snowplow/node-tracker
Advanced tools
Comparing version 3.20.0 to 3.21.0
@@ -1,30 +0,1 @@ | ||
/* | ||
* Copyright (c) 2022 Snowplow Analytics Ltd | ||
* All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions are met: | ||
* | ||
* 1. Redistributions of source code must retain the above copyright notice, this | ||
* list of conditions and the following disclaimer. | ||
* | ||
* 2. Redistributions in binary form must reproduce the above copyright notice, | ||
* this list of conditions and the following disclaimer in the documentation | ||
* and/or other materials provided with the distribution. | ||
* | ||
* 3. Neither the name of the copyright holder nor the names of its | ||
* contributors may be used to endorse or promote products derived from | ||
* this software without specific prior written permission. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | ||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | ||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
import { Payload, TrackerCore } from "@snowplow/tracker-core"; | ||
@@ -35,2 +6,4 @@ import { Response, RequestError, Agents, RequiredRetryOptions, ToughCookieJar, PromiseCookieJar } from "got"; | ||
input: (payload: Payload) => void; | ||
/** Set if the requests from the emitter should be anonymized. Read more about anonymization used at https://docs.snowplow.io/docs/collecting-data/collecting-from-own-applications/snowplow-tracker-protocol/going-deeper/http-headers/. */ | ||
setAnonymization?: (shouldAnonymize: boolean) => void; | ||
} | ||
@@ -57,4 +30,5 @@ declare enum HttpProtocol { | ||
* @param agents - Set new http.Agent and https.Agent objects on `got` requests - https://github.com/sindresorhus/got/blob/v11.5.2/readme.md#agent | ||
* @param serverAnonymization - If the request should undergo server anonymization. | ||
*/ | ||
declare function gotEmitter(endpoint: string, protocol?: HttpProtocol, port?: number, method?: HttpMethod, bufferSize?: number, retry?: number | Partial<RequiredRetryOptions>, cookieJar?: PromiseCookieJar | ToughCookieJar, callback?: (error?: RequestError, response?: Response<string>) => void, agents?: Agents): Emitter; | ||
declare function gotEmitter(endpoint: string, protocol?: HttpProtocol, port?: number, method?: HttpMethod, bufferSize?: number, retry?: number | Partial<RequiredRetryOptions>, cookieJar?: PromiseCookieJar | ToughCookieJar, callback?: (error?: RequestError, response?: Response<string>) => void, agents?: Agents, serverAnonymization?: boolean): Emitter; | ||
interface Tracker extends TrackerCore { | ||
@@ -61,0 +35,0 @@ /** |
/*! | ||
* Node tracker for Snowplow v3.20.0 (https://docs.snowplowanalytics.com/docs/collecting-data/collecting-from-own-applications/node-js-tracker/) | ||
* Node tracker for Snowplow v3.21.0 (https://docs.snowplowanalytics.com/docs/collecting-data/collecting-from-own-applications/node-js-tracker/) | ||
* Copyright 2022 Snowplow Analytics Ltd | ||
@@ -20,31 +20,2 @@ * Licensed under BSD-3-Clause | ||
/* | ||
* Copyright (c) 2022 Snowplow Analytics Ltd | ||
* All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions are met: | ||
* | ||
* 1. Redistributions of source code must retain the above copyright notice, this | ||
* list of conditions and the following disclaimer. | ||
* | ||
* 2. Redistributions in binary form must reproduce the above copyright notice, | ||
* this list of conditions and the following disclaimer in the documentation | ||
* and/or other materials provided with the distribution. | ||
* | ||
* 3. Neither the name of the copyright holder nor the names of its | ||
* contributors may be used to endorse or promote products derived from | ||
* this software without specific prior written permission. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | ||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | ||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
exports.HttpProtocol = void 0; | ||
@@ -84,31 +55,2 @@ (function (HttpProtocol) { | ||
/* | ||
* Copyright (c) 2022 Snowplow Analytics Ltd | ||
* All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions are met: | ||
* | ||
* 1. Redistributions of source code must retain the above copyright notice, this | ||
* list of conditions and the following disclaimer. | ||
* | ||
* 2. Redistributions in binary form must reproduce the above copyright notice, | ||
* this list of conditions and the following disclaimer in the documentation | ||
* and/or other materials provided with the distribution. | ||
* | ||
* 3. Neither the name of the copyright holder nor the names of its | ||
* contributors may be used to endorse or promote products derived from | ||
* this software without specific prior written permission. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | ||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | ||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
/** | ||
@@ -126,4 +68,5 @@ * Create an emitter object, which uses the `got` library, that will send events to a collector | ||
* @param agents - Set new http.Agent and https.Agent objects on `got` requests - https://github.com/sindresorhus/got/blob/v11.5.2/readme.md#agent | ||
* @param serverAnonymization - If the request should undergo server anonymization. | ||
*/ | ||
function gotEmitter(endpoint, protocol = exports.HttpProtocol.HTTPS, port, method, bufferSize, retry, cookieJar, callback, agents) { | ||
function gotEmitter(endpoint, protocol = exports.HttpProtocol.HTTPS, port, method, bufferSize, retry, cookieJar, callback, agents, serverAnonymization = false) { | ||
const maxBufferLength = bufferSize !== null && bufferSize !== void 0 ? bufferSize : (method === exports.HttpMethod.GET ? 0 : 10); | ||
@@ -171,2 +114,7 @@ const path = method === exports.HttpMethod.GET ? '/i' : '/com.snowplowanalytics.snowplow/tp2'; | ||
} | ||
const headers = { | ||
'user-agent': `snowplow-nodejs-tracker/${trackerCore.version}`, | ||
...(serverAnonymization && { 'SP-Anonymous': '*' }), | ||
...(method === exports.HttpMethod.POST && { 'content-type': 'application/json; charset=utf-8' }), | ||
}; | ||
if (method === exports.HttpMethod.POST) { | ||
@@ -180,9 +128,6 @@ const postJson = { | ||
json: postJson, | ||
headers: { | ||
'content-type': 'application/json; charset=utf-8', | ||
'user-agent': `snowplow-nodejs-tracker/${trackerCore.version}`, | ||
}, | ||
agent: agents, | ||
retry: retry, | ||
cookieJar: cookieJar, | ||
headers, | ||
retry, | ||
cookieJar, | ||
}) | ||
@@ -196,8 +141,6 @@ .then(handleSuccess, handleFailure); | ||
searchParams: preparePayload(bufferCopy[i]), | ||
headers: { | ||
'user-agent': `snowplow-nodejs-tracker/${trackerCore.version}`, | ||
}, | ||
agent: agents, | ||
retry: retry, | ||
cookieJar: cookieJar, | ||
headers, | ||
retry, | ||
cookieJar, | ||
}) | ||
@@ -218,2 +161,5 @@ .then(handleSuccess, handleFailure); | ||
}; | ||
const setAnonymization = (shouldAnonymize) => { | ||
serverAnonymization = shouldAnonymize; | ||
}; | ||
return { | ||
@@ -225,2 +171,3 @@ /** | ||
input, | ||
setAnonymization, | ||
}; | ||
@@ -227,0 +174,0 @@ } |
@@ -1,30 +0,1 @@ | ||
/* | ||
* Copyright (c) 2022 Snowplow Analytics Ltd | ||
* All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions are met: | ||
* | ||
* 1. Redistributions of source code must retain the above copyright notice, this | ||
* list of conditions and the following disclaimer. | ||
* | ||
* 2. Redistributions in binary form must reproduce the above copyright notice, | ||
* this list of conditions and the following disclaimer in the documentation | ||
* and/or other materials provided with the distribution. | ||
* | ||
* 3. Neither the name of the copyright holder nor the names of its | ||
* contributors may be used to endorse or promote products derived from | ||
* this software without specific prior written permission. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | ||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | ||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
import { Payload, TrackerCore } from "@snowplow/tracker-core"; | ||
@@ -35,2 +6,4 @@ import { Response, RequestError, Agents, RequiredRetryOptions, ToughCookieJar, PromiseCookieJar } from "got"; | ||
input: (payload: Payload) => void; | ||
/** Set if the requests from the emitter should be anonymized. Read more about anonymization used at https://docs.snowplow.io/docs/collecting-data/collecting-from-own-applications/snowplow-tracker-protocol/going-deeper/http-headers/. */ | ||
setAnonymization?: (shouldAnonymize: boolean) => void; | ||
} | ||
@@ -57,4 +30,5 @@ declare enum HttpProtocol { | ||
* @param agents - Set new http.Agent and https.Agent objects on `got` requests - https://github.com/sindresorhus/got/blob/v11.5.2/readme.md#agent | ||
* @param serverAnonymization - If the request should undergo server anonymization. | ||
*/ | ||
declare function gotEmitter(endpoint: string, protocol?: HttpProtocol, port?: number, method?: HttpMethod, bufferSize?: number, retry?: number | Partial<RequiredRetryOptions>, cookieJar?: PromiseCookieJar | ToughCookieJar, callback?: (error?: RequestError, response?: Response<string>) => void, agents?: Agents): Emitter; | ||
declare function gotEmitter(endpoint: string, protocol?: HttpProtocol, port?: number, method?: HttpMethod, bufferSize?: number, retry?: number | Partial<RequiredRetryOptions>, cookieJar?: PromiseCookieJar | ToughCookieJar, callback?: (error?: RequestError, response?: Response<string>) => void, agents?: Agents, serverAnonymization?: boolean): Emitter; | ||
interface Tracker extends TrackerCore { | ||
@@ -61,0 +35,0 @@ /** |
/*! | ||
* Node tracker for Snowplow v3.20.0 (https://docs.snowplowanalytics.com/docs/collecting-data/collecting-from-own-applications/node-js-tracker/) | ||
* Node tracker for Snowplow v3.21.0 (https://docs.snowplowanalytics.com/docs/collecting-data/collecting-from-own-applications/node-js-tracker/) | ||
* Copyright 2022 Snowplow Analytics Ltd | ||
@@ -12,31 +12,2 @@ * Licensed under BSD-3-Clause | ||
/* | ||
* Copyright (c) 2022 Snowplow Analytics Ltd | ||
* All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions are met: | ||
* | ||
* 1. Redistributions of source code must retain the above copyright notice, this | ||
* list of conditions and the following disclaimer. | ||
* | ||
* 2. Redistributions in binary form must reproduce the above copyright notice, | ||
* this list of conditions and the following disclaimer in the documentation | ||
* and/or other materials provided with the distribution. | ||
* | ||
* 3. Neither the name of the copyright holder nor the names of its | ||
* contributors may be used to endorse or promote products derived from | ||
* this software without specific prior written permission. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | ||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | ||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
var HttpProtocol; | ||
@@ -76,31 +47,2 @@ (function (HttpProtocol) { | ||
/* | ||
* Copyright (c) 2022 Snowplow Analytics Ltd | ||
* All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions are met: | ||
* | ||
* 1. Redistributions of source code must retain the above copyright notice, this | ||
* list of conditions and the following disclaimer. | ||
* | ||
* 2. Redistributions in binary form must reproduce the above copyright notice, | ||
* this list of conditions and the following disclaimer in the documentation | ||
* and/or other materials provided with the distribution. | ||
* | ||
* 3. Neither the name of the copyright holder nor the names of its | ||
* contributors may be used to endorse or promote products derived from | ||
* this software without specific prior written permission. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | ||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | ||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
/** | ||
@@ -118,4 +60,5 @@ * Create an emitter object, which uses the `got` library, that will send events to a collector | ||
* @param agents - Set new http.Agent and https.Agent objects on `got` requests - https://github.com/sindresorhus/got/blob/v11.5.2/readme.md#agent | ||
* @param serverAnonymization - If the request should undergo server anonymization. | ||
*/ | ||
function gotEmitter(endpoint, protocol = HttpProtocol.HTTPS, port, method, bufferSize, retry, cookieJar, callback, agents) { | ||
function gotEmitter(endpoint, protocol = HttpProtocol.HTTPS, port, method, bufferSize, retry, cookieJar, callback, agents, serverAnonymization = false) { | ||
const maxBufferLength = bufferSize !== null && bufferSize !== void 0 ? bufferSize : (method === HttpMethod.GET ? 0 : 10); | ||
@@ -163,2 +106,7 @@ const path = method === HttpMethod.GET ? '/i' : '/com.snowplowanalytics.snowplow/tp2'; | ||
} | ||
const headers = { | ||
'user-agent': `snowplow-nodejs-tracker/${version}`, | ||
...(serverAnonymization && { 'SP-Anonymous': '*' }), | ||
...(method === HttpMethod.POST && { 'content-type': 'application/json; charset=utf-8' }), | ||
}; | ||
if (method === HttpMethod.POST) { | ||
@@ -172,9 +120,6 @@ const postJson = { | ||
json: postJson, | ||
headers: { | ||
'content-type': 'application/json; charset=utf-8', | ||
'user-agent': `snowplow-nodejs-tracker/${version}`, | ||
}, | ||
agent: agents, | ||
retry: retry, | ||
cookieJar: cookieJar, | ||
headers, | ||
retry, | ||
cookieJar, | ||
}) | ||
@@ -188,8 +133,6 @@ .then(handleSuccess, handleFailure); | ||
searchParams: preparePayload(bufferCopy[i]), | ||
headers: { | ||
'user-agent': `snowplow-nodejs-tracker/${version}`, | ||
}, | ||
agent: agents, | ||
retry: retry, | ||
cookieJar: cookieJar, | ||
headers, | ||
retry, | ||
cookieJar, | ||
}) | ||
@@ -210,2 +153,5 @@ .then(handleSuccess, handleFailure); | ||
}; | ||
const setAnonymization = (shouldAnonymize) => { | ||
serverAnonymization = shouldAnonymize; | ||
}; | ||
return { | ||
@@ -217,2 +163,3 @@ /** | ||
input, | ||
setAnonymization, | ||
}; | ||
@@ -219,0 +166,0 @@ } |
{ | ||
"name": "@snowplow/node-tracker", | ||
"version": "3.20.0", | ||
"version": "3.21.0", | ||
"description": "Node tracker for Snowplow", | ||
@@ -40,3 +40,3 @@ "keywords": [ | ||
"dependencies": { | ||
"@snowplow/tracker-core": "3.20.0", | ||
"@snowplow/tracker-core": "3.21.0", | ||
"got": "^11.8.5", | ||
@@ -43,0 +43,0 @@ "tslib": "^2.3.1" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
105540
741
+ Added@snowplow/tracker-core@3.21.0(transitive)
- Removed@snowplow/tracker-core@3.20.0(transitive)