@skillswaveca/nova-shared-libraries 4.25.0 → 4.26.0
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/.eslintrc.yaml +2 -0
- package/docs-base/package-info.js +5 -5
- package/package.json +1 -1
- package/packages/drivers/README.md +1 -1
- package/packages/drivers/package-lock.json +3906 -0
- package/packages/drivers/package.json +7 -4
- package/packages/nova-middleware/package.json +1 -1
- package/packages/nova-model/package.json +1 -1
- package/packages/nova-router/package.json +1 -1
- package/packages/nova-utils/package-lock.json +2 -2
- package/packages/nova-utils/package.json +1 -1
- package/packages/nova-utils/src/event-definitions.js +139 -6
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"name": "@skillswaveca/nova-drivers",
|
|
4
4
|
"description": "Some helper drivers for AWS services",
|
|
5
5
|
"repository": "https://github.com/SkillsWave/nova-shared-libraries",
|
|
6
|
-
"version": "4.
|
|
6
|
+
"version": "4.26.0",
|
|
7
7
|
"main": "index.js",
|
|
8
8
|
"scripts": {
|
|
9
9
|
"pre-release": "pnpm run create-index",
|
|
@@ -16,17 +16,20 @@
|
|
|
16
16
|
"devDependencies": {
|
|
17
17
|
"chai": "^5.1.0",
|
|
18
18
|
"eslint": "^9.0.0",
|
|
19
|
-
"mocha": "^10.4.0"
|
|
19
|
+
"mocha": "^10.4.0",
|
|
20
|
+
"sinon": "^21.0.0",
|
|
21
|
+
"sinon-chai": "^4.0.0"
|
|
20
22
|
},
|
|
21
23
|
"dependencies": {
|
|
22
|
-
"simple-oauth2": "^5.0.0",
|
|
23
24
|
"@aws-sdk/client-dynamodb": "^3.572.0",
|
|
24
25
|
"@aws-sdk/client-secrets-manager": "^3.572.0",
|
|
25
26
|
"@aws-sdk/client-sqs": "^3.572.0",
|
|
26
27
|
"@aws-sdk/lib-dynamodb": "^3.572.0",
|
|
28
|
+
"@hubspot/api-client": "^13.0.0",
|
|
27
29
|
"aws-xray-sdk-core": "^3.6.0",
|
|
28
30
|
"lodash.chunk": "^4.2.0",
|
|
29
31
|
"node-fetch": "^3.1.0",
|
|
30
|
-
"pino": "^9.0.0"
|
|
32
|
+
"pino": "^9.0.0",
|
|
33
|
+
"simple-oauth2": "^5.0.0"
|
|
31
34
|
}
|
|
32
35
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"name": "@skillswaveca/nova-middleware",
|
|
4
4
|
"description": "A collection of middleware used by nova projects",
|
|
5
5
|
"repository": "https://github.com/SkillsWave/nova-shared-libraries",
|
|
6
|
-
"version": "4.
|
|
6
|
+
"version": "4.26.0",
|
|
7
7
|
"main": "index.js",
|
|
8
8
|
"scripts": {
|
|
9
9
|
"pre-release": "pnpm run create-index",
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"name": "@skillswaveca/nova-model",
|
|
4
4
|
"description": "Nova model stuff",
|
|
5
5
|
"repository": "https://github.com/SkillsWave/nova-shared-libraries",
|
|
6
|
-
"version": "4.
|
|
6
|
+
"version": "4.26.0",
|
|
7
7
|
"main": "index.js",
|
|
8
8
|
"scripts": {
|
|
9
9
|
"pre-release": "pnpm run create-index",
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"name": "@skillswaveca/nova-router",
|
|
4
4
|
"description": "An extended Koa router that enables better validation",
|
|
5
5
|
"repository": "https://github.com/SkillsWave/nova-shared-libraries",
|
|
6
|
-
"version": "4.
|
|
6
|
+
"version": "4.26.0",
|
|
7
7
|
"main": "index.js",
|
|
8
8
|
"scripts": {
|
|
9
9
|
"pre-release": "pnpm run create-index",
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skillswaveca/nova-utils",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.25.0",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@skillswaveca/nova-utils",
|
|
9
|
-
"version": "4.
|
|
9
|
+
"version": "4.25.0",
|
|
10
10
|
"license": "UNLICENSED",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"yup": "^1.4.0"
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"name": "@skillswaveca/nova-utils",
|
|
4
4
|
"description": "A collection of random utils used in nova repos",
|
|
5
5
|
"repository": "https://github.com/SkillsWave/nova-shared-libraries",
|
|
6
|
-
"version": "4.
|
|
6
|
+
"version": "4.26.0",
|
|
7
7
|
"main": "index.js",
|
|
8
8
|
"scripts": {
|
|
9
9
|
"pre-release": "pnpm run create-index",
|
|
@@ -11,15 +11,145 @@ import * as yup from 'yup';
|
|
|
11
11
|
* - validator: Yup validation schema for the event data
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
-
const
|
|
15
|
-
name: '
|
|
16
|
-
description: '
|
|
14
|
+
const clientOnboardingCompletedEventDefinition = {
|
|
15
|
+
name: 'client_onboarding_completed',
|
|
16
|
+
description: 'Client has finished PLG onboarding and pressed "create workspace."',
|
|
17
17
|
properties: {
|
|
18
18
|
email: {
|
|
19
19
|
type: 'string',
|
|
20
20
|
required: true,
|
|
21
21
|
description: 'Email address of the user',
|
|
22
22
|
},
|
|
23
|
+
tenant_id: {
|
|
24
|
+
type: 'string',
|
|
25
|
+
required: true,
|
|
26
|
+
description: 'The ID of the tenant that was created',
|
|
27
|
+
},
|
|
28
|
+
tenant_name: {
|
|
29
|
+
type: 'string',
|
|
30
|
+
required: true,
|
|
31
|
+
description: 'The name of the tenant that was created',
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
validator: yup.object({
|
|
35
|
+
email: yup.string().email('Must be a valid email').required('Email is required'),
|
|
36
|
+
}),
|
|
37
|
+
getMetadata: eventData => {
|
|
38
|
+
return {
|
|
39
|
+
email: eventData.email,
|
|
40
|
+
};
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const usersInvitedEventDefinition = {
|
|
45
|
+
name: 'users_invited',
|
|
46
|
+
description: 'PLG Admin has invited one or more users to their workspace.',
|
|
47
|
+
properties: {
|
|
48
|
+
email: {
|
|
49
|
+
type: 'string',
|
|
50
|
+
required: true,
|
|
51
|
+
description: 'Email address of the user',
|
|
52
|
+
},
|
|
53
|
+
tenant_id: {
|
|
54
|
+
type: 'string',
|
|
55
|
+
required: true,
|
|
56
|
+
description: 'The ID of the tenant that was created',
|
|
57
|
+
},
|
|
58
|
+
tenant_name: {
|
|
59
|
+
type: 'string',
|
|
60
|
+
required: true,
|
|
61
|
+
description: 'The name of the tenant that was created',
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
validator: yup.object({
|
|
65
|
+
email: yup.string().email('Must be a valid email').required('Email is required'),
|
|
66
|
+
}),
|
|
67
|
+
getMetadata: eventData => {
|
|
68
|
+
return {
|
|
69
|
+
email: eventData.email,
|
|
70
|
+
};
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
const creditCardEventDefinition = {
|
|
75
|
+
name: 'credit_card_added',
|
|
76
|
+
description: 'PLG Admin added a credit card in Stripe.',
|
|
77
|
+
properties: {
|
|
78
|
+
email: {
|
|
79
|
+
type: 'string',
|
|
80
|
+
required: true,
|
|
81
|
+
description: 'Email address of the user',
|
|
82
|
+
},
|
|
83
|
+
tenant_id: {
|
|
84
|
+
type: 'string',
|
|
85
|
+
required: true,
|
|
86
|
+
description: 'The ID of the tenant that was created',
|
|
87
|
+
},
|
|
88
|
+
tenant_name: {
|
|
89
|
+
type: 'string',
|
|
90
|
+
required: true,
|
|
91
|
+
description: 'The name of the tenant that was created',
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
validator: yup.object({
|
|
95
|
+
email: yup.string().email('Must be a valid email').required('Email is required'),
|
|
96
|
+
}),
|
|
97
|
+
getMetadata: eventData => {
|
|
98
|
+
return {
|
|
99
|
+
email: eventData.email,
|
|
100
|
+
};
|
|
101
|
+
},
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
const firstRequestSubmittedEventDefinition = {
|
|
105
|
+
name: 'first_request_submitted',
|
|
106
|
+
description: 'A user in the PLG workspace has submitted the first request.',
|
|
107
|
+
properties: {
|
|
108
|
+
email: {
|
|
109
|
+
type: 'string',
|
|
110
|
+
required: true,
|
|
111
|
+
description: 'Email address of the user',
|
|
112
|
+
},
|
|
113
|
+
tenant_id: {
|
|
114
|
+
type: 'string',
|
|
115
|
+
required: true,
|
|
116
|
+
description: 'The ID of the tenant that was created',
|
|
117
|
+
},
|
|
118
|
+
tenant_name: {
|
|
119
|
+
type: 'string',
|
|
120
|
+
required: true,
|
|
121
|
+
description: 'The name of the tenant that was created',
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
validator: yup.object({
|
|
125
|
+
email: yup.string().email('Must be a valid email').required('Email is required'),
|
|
126
|
+
}),
|
|
127
|
+
getMetadata: eventData => {
|
|
128
|
+
return {
|
|
129
|
+
email: eventData.email,
|
|
130
|
+
};
|
|
131
|
+
},
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
const transactionsThresholdMetEventDefinition = {
|
|
135
|
+
name: 'transactions_threshold_met',
|
|
136
|
+
description: 'The PLG tenant has completed a specified number of transactions.',
|
|
137
|
+
properties: {
|
|
138
|
+
email: {
|
|
139
|
+
type: 'string',
|
|
140
|
+
required: true,
|
|
141
|
+
description: 'Email address of the user',
|
|
142
|
+
},
|
|
143
|
+
tenant_id: {
|
|
144
|
+
type: 'string',
|
|
145
|
+
required: true,
|
|
146
|
+
description: 'The ID of the tenant that was created',
|
|
147
|
+
},
|
|
148
|
+
tenant_name: {
|
|
149
|
+
type: 'string',
|
|
150
|
+
required: true,
|
|
151
|
+
description: 'The name of the tenant that was created',
|
|
152
|
+
},
|
|
23
153
|
},
|
|
24
154
|
validator: yup.object({
|
|
25
155
|
email: yup.string().email('Must be a valid email').required('Email is required'),
|
|
@@ -36,9 +166,12 @@ const testEventDefinition = {
|
|
|
36
166
|
* Key: event name, Value: event definition object
|
|
37
167
|
*/
|
|
38
168
|
export const eventDefinitions = {
|
|
39
|
-
[
|
|
169
|
+
[clientOnboardingCompletedEventDefinition.name]: clientOnboardingCompletedEventDefinition,
|
|
170
|
+
[usersInvitedEventDefinition.name]: usersInvitedEventDefinition,
|
|
171
|
+
[creditCardEventDefinition.name]: creditCardEventDefinition,
|
|
172
|
+
[firstRequestSubmittedEventDefinition.name]: firstRequestSubmittedEventDefinition,
|
|
173
|
+
[transactionsThresholdMetEventDefinition.name]: transactionsThresholdMetEventDefinition,
|
|
40
174
|
};
|
|
41
|
-
|
|
42
175
|
/**
|
|
43
176
|
* Get event definition by name
|
|
44
177
|
* @param {string} eventName - The name of the event
|
|
@@ -84,7 +217,7 @@ export const validateEvent = async(eventName, eventData) => {
|
|
|
84
217
|
* @returns {boolean} True if the event exists, false otherwise
|
|
85
218
|
*/
|
|
86
219
|
export const isValidEventName = eventName => {
|
|
87
|
-
return
|
|
220
|
+
return Object.hasOwn(eventDefinitions, eventName);
|
|
88
221
|
};
|
|
89
222
|
|
|
90
223
|
/**
|