@forge/util 0.0.0-experimental-383053a → 0.0.0-experimental-c3d0263

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,6 +1,54 @@
1
1
  # @forge/util
2
2
 
3
- ## 0.0.0-experimental-383053a
3
+ ## 0.0.0-experimental-c3d0263
4
+
5
+ ### Minor Changes
6
+
7
+ - 88e57a12: Add metrics interface dependency
8
+
9
+ ## 1.2.0-next.0
10
+
11
+ ### Minor Changes
12
+
13
+ - 88e57a1: Add metrics interface dependency
14
+
15
+ ## 1.1.0
16
+
17
+ ### Minor Changes
18
+
19
+ - 037c31a5: Upgrade webpack from 4 to 5 and other relavent packages to fix the issue for node17+ (openssl change)
20
+
21
+ ## 1.1.0-next.0
22
+
23
+ ### Minor Changes
24
+
25
+ - 037c31a: Upgrade webpack from 4 to 5 and other relavent packages to fix the issue for node17+ (openssl change)
26
+
27
+ ## 1.0.1
28
+
29
+ ### Patch Changes
30
+
31
+ - 4608ccd: Update version of analytics client
32
+
33
+ ## 1.0.1-next.0
34
+
35
+ ### Patch Changes
36
+
37
+ - 4608ccd: Update version of analytics client
38
+
39
+ ## 1.0.0
40
+
41
+ ### Major Changes
42
+
43
+ - 1daf2c5: Forge packages to 1.0.0 for upcoming platform GA 🎉
44
+
45
+ ## 1.0.0-next.0
46
+
47
+ ### Major Changes
48
+
49
+ - 1daf2c5: Forge is now generally available 🎉
50
+
51
+ ## 0.4.17
4
52
 
5
53
  ### Patch Changes
6
54
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forge/util",
3
- "version": "0.0.0-experimental-383053a",
3
+ "version": "0.0.0-experimental-c3d0263",
4
4
  "description": "",
5
5
  "module": "./packages",
6
6
  "scripts": {
@@ -10,7 +10,7 @@
10
10
  "author": "Daniel Winter-Wijntjes",
11
11
  "license": "UNLICENSED",
12
12
  "dependencies": {
13
- "webpack": "^4.42.1",
14
- "webpack-cli": "^3.3.11"
13
+ "webpack": "^5.66.0",
14
+ "webpack-cli": "^4.9.1"
15
15
  }
16
16
  }
@@ -0,0 +1,71 @@
1
+ # Change log
2
+
3
+ ## 2.1.1
4
+
5
+ Use `https://` instead of `git://` as it is no longer allowed
6
+ https://github.blog/2021-09-01-improving-git-protocol-security-github/
7
+
8
+ ## 2.1.0
9
+
10
+ Added Halp as a valid userIdType
11
+
12
+ ## 2.0.3
13
+
14
+ Updated analytics-node from [5.0.0 to 5.1.0](https://github.com/segmentio/analytics-node/releases).
15
+ Added mechanism for comsumers to pass in their own retry delay function. See readme [Custom retryDelayFn](./README.md#markdown-header-custom-retrydelayfn).
16
+
17
+ ## 2.0.2
18
+
19
+ Patch axios in our lock files while waiting for segment to release a version which patches the exposed version of axios. [reference](https://github.com/segmentio/analytics-node/pull/295).
20
+
21
+ ## 2.0.1
22
+
23
+ Changes from [analytics-node v5](https://github.com/segmentio/analytics-node/releases/tag/v5.0.0):
24
+
25
+ - Breaking: Dropped support for Node 8,
26
+ - Flush queue when maximum storage has been reached,
27
+ - Return a promise from flush,
28
+ - Upgrade uuid package to support treeshaking,
29
+ - Dependency upgrades
30
+
31
+ ## 1.2.2
32
+
33
+ Added request timeout option. Default is 60 seconds.
34
+
35
+ Added logger option which takes the same shape as console. Default is console.
36
+
37
+ ## 1.2.1
38
+
39
+ Note: Firing events over 32kb in size will now throw errors.
40
+ [Bumped analytics-node from 3.5.0 to 4.0.1](https://github.com/segmentio/analytics-node/releases).
41
+
42
+ HTTP requests now have KeepAlive headers.
43
+
44
+ ## 1.1.6
45
+
46
+ Fixed an issue with the generated TypeScript typings files. (Importing `AnalyticsClient` was broken).
47
+ The Typing Definitions should be more accurate now, and are included for all package files.
48
+
49
+ ## 1.1.5
50
+
51
+ Added hashedEmail and opsgenie userIdTypes support
52
+
53
+ ## 1.1.4
54
+
55
+ Upgraded lodash to fix security vulnerability
56
+
57
+ ## 1.1.3
58
+
59
+ Added security assistant configuration
60
+
61
+ ## 1.1.2
62
+
63
+ Bumped `analytics-node` to include security fix for `axios` dependency
64
+
65
+ ## 1.1.1
66
+
67
+ Added artifacts to the deploy process to fix issues of missing declaration files in package
68
+
69
+ ## 1.1.0
70
+
71
+ Added Typescript type declaration files for Typescript compatibility
@@ -2,13 +2,13 @@
2
2
 
3
3
  Analytics Client NodeJS services. Uses the GASv3 platform.
4
4
 
5
- * [Builds](https://engservices-bamboo.internal.atlassian.com/browse/DS-ANCBUILD)
6
5
  * [Event Guidelines](http://go.atlassian.com/analytics)
6
+ * [Trait Guidelines](https://developer.atlassian.com/platform/targeting/overview/concepts/traits/)
7
7
  * Questions / Other support: visit us in Slack: #product-analytics-dev "Product Analytics Dev"
8
8
 
9
9
  ## Usage
10
10
 
11
- #### Creating a client
11
+ ### Creating a client
12
12
 
13
13
  ```javascript
14
14
  const { analyticsClient } = require('@atlassiansox/analytics-node-client');
@@ -21,23 +21,25 @@ const client = analyticsClient({
21
21
  });
22
22
  ```
23
23
 
24
- #### User information
24
+ #### User information
25
25
 
26
26
  If a `userId` is specified, then a valid `userIdType` is also required. If no `userId` is specified, then `anonymousId` must be used.
27
27
 
28
- We support the following `userIdType`s:
28
+ We support the following `userIdType`s:
29
29
 
30
30
  * `ATLASSIAN_ACCOUNT`
31
- * `TRELLO`
31
+ * `TRELLO`
32
+ * `HASHED_EMAIL`
33
+ * `OPSGENIE`
34
+ * `HALP`
32
35
 
36
+ #### Tenant information
33
37
 
34
- #### Tenant information
38
+ If a `tenantId` is specified, then a valid `tenantIdType` is also required.
35
39
 
36
- If a `tenantId` is specified, then a valid `tenantIdType` is also required.
40
+ We support the following `tenantIdType`s:
37
41
 
38
- We support the following `tenantIdType`s:
39
-
40
- * `CLOUD_ID` - Atlassian Cloud
42
+ * `CLOUD_ID` - Atlassian Cloud
41
43
  * `NONE` - Products without a tenant concept
42
44
 
43
45
  #### Containers
@@ -48,7 +50,8 @@ There is no strict definition or schema for the fields allowed in the containers
48
50
  The `containers` field will be validated, and will throw and `Error` if the validation does not pass, preventing the event from being sent.
49
51
  You need to put the values that will make the analytical events valuable to your use case; most probayly matching the expectations set by some analyst's queries on top of the Socrates, Redash or Amplitude tables.
50
52
  An example of a `containers` structure:
51
- ```
53
+
54
+ ```json
52
55
  "containers": {
53
56
  "project": {
54
57
  "id": "projectId",
@@ -65,9 +68,10 @@ An example of a `containers` structure:
65
68
  }
66
69
  ```
67
70
 
68
-
69
71
  #### Reporting OS info/version
72
+
70
73
  OS version can be optionally reported with `os` attribute of an event:
74
+
71
75
  ```javascript
72
76
  {
73
77
  ...
@@ -79,16 +83,41 @@ OS version can be optionally reported with `os` attribute of an event:
79
83
  ```
80
84
 
81
85
  #### Reporting event creation time
86
+
82
87
  Creation time of the analytics event can be optionally reported with the `timestamp` attribute of an event:
88
+
83
89
  ```javascript
84
90
  this.analyticsClient.track({
85
91
  ...
86
92
  timestamp: new Date()
87
93
  })
88
94
  ```
95
+
89
96
  For compatibility with the underlying `node-analytics` library the timestamp must be supplied as a Date object.
90
97
  This creation timestamp will be reflected as `originalTimestamp` after processing.
91
98
 
99
+ #### Custom retryDelayFn
100
+
101
+ This client uses [analytics-node](https://github.com/segmentio/analytics-node) under the hood which uses [axios](https://github.com/axios/axios) to send events and [axios-retry](https://github.com/softonic/axios-retry) to retry sending events in case of failure.
102
+
103
+ axios-retry uses a function parameter to determine how long the client should wait after a failed HTTP request before trying again. By default, [analytics-node](https://github.com/segmentio/analytics-node/blob/master/index.js#L62) uses [exponential-delay](https://github.com/softonic/axios-retry/blob/master/es/index.js#L77).
104
+
105
+ If you wish to change this behaviour, you can provide the client with `retryDelayFn` in the main argument object when creating the client.
106
+
107
+ ```javascript
108
+ const { analyticsClient } = require('@atlassiansox/analytics-node-client');
109
+
110
+ const client = analyticsClient({
111
+ env: 'prod', // prod, stg or dev
112
+ product: 'jira', // required
113
+ subproduct: 'software' // Optional
114
+ sendEventHook: (event) => {} // Optional callback\
115
+
116
+ // Please dont actually use this, its just an example
117
+ retryDelayFn: (retryAtempt) => retryAtempt * 10 * (0.5 + Math.random()),
118
+ });
119
+ ```
120
+
92
121
 
93
122
 
94
123
  ## Sending a TrackEvent
@@ -122,7 +151,7 @@ client.sendTrackEvent({
122
151
  });
123
152
  ```
124
153
 
125
- #### TrackEvent with OS details:
154
+ ### TrackEvent with OS details:
126
155
 
127
156
  ```javascript
128
157
  client.sendTrackEvent({
@@ -157,7 +186,7 @@ client.sendTrackEvent({
157
186
  });
158
187
  ```
159
188
 
160
- ## Sending a UIEvent
189
+ ## Sending an UIEvent
161
190
 
162
191
  ```javascript
163
192
  client.sendUIEvent({
@@ -218,7 +247,7 @@ client.sendScreenEvent({
218
247
  });
219
248
  ```
220
249
 
221
- ## Sending a OperationalEvent
250
+ ## Sending an OperationalEvent
222
251
 
223
252
  ```javascript
224
253
  client.sendOperationalEvent({
@@ -249,9 +278,23 @@ client.sendOperationalEvent({
249
278
  });
250
279
  ```
251
280
 
281
+ ## Sending a TraitEvent
282
+
283
+ ```javascript
284
+ client.sendTraitEvent({
285
+ entityType: entityTypes.ATLASSIAN_ACCOUNT, // required
286
+ entityId: '557058:qweqwe-1793-45a0-9732-9ef656b7ab43', // required
287
+ entityTraits: { // required
288
+ 'first-logged-in-to-your-service': new Date() // at least one trait required
289
+ }
290
+ });
291
+ ```
292
+
252
293
  ## Developing Locally
253
294
 
254
295
  Setup: `npm install`
296
+ Generating Typescript Types: `npm run generateTypes`
297
+ Cleaning up Typescript Types: `npm run cleanTypes`
255
298
 
256
299
  ### Tests:
257
300
 
@@ -1,10 +1,13 @@
1
1
  {
2
2
  "name": "analytics-node-client",
3
- "version": "1.0.111",
3
+ "version": "2.1.2",
4
4
  "description": "Analytics Serverside client for Node JS",
5
5
  "main": "src/index.js",
6
+ "types": "src/index.d.ts",
6
7
  "scripts": {
7
8
  "build": "run-s test",
9
+ "generateTypes": "npm run cleanTypes && tsc",
10
+ "cleanTypes": "find src/ -name '*.d.ts' -delete",
8
11
  "test:unit": "jasmine JASMINE_CONFIG_PATH=jasmine.json",
9
12
  "test:lint": "eslint src test --fix",
10
13
  "test": "run-s -s test:unit test:lint",
@@ -27,11 +30,12 @@
27
30
  "jasmine-reporters": "^2.2.0",
28
31
  "npm-run-all": "^3.1.0",
29
32
  "proxyquire": "^1.7.2",
30
- "watch": "git://github.com/jbunton-atlassian/watch#5de0fc9c13df5ebc3320c1cbe275916cc954142d"
33
+ "typescript": "^4.2.3",
34
+ "watch": "https://github.com/jbunton-atlassian/watch#5de0fc9c13df5ebc3320c1cbe275916cc954142d"
31
35
  },
32
36
  "dependencies": {
33
- "analytics-node": "^3.4.0-beta.1",
34
- "lodash": "^4.17.5"
37
+ "analytics-node": "^5.1.0",
38
+ "lodash": "^4.17.21"
35
39
  },
36
40
  "files": [
37
41
  "src"