@bigfootai/bigfoot-types 2.1.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/.eslintignore ADDED
@@ -0,0 +1,3 @@
1
+ dist
2
+ .eslintrc.mjs
3
+ ./node_modules
package/.eslintrc.json ADDED
@@ -0,0 +1,10 @@
1
+ {
2
+ "root": true,
3
+ "env": { "node": true, "es2020": true },
4
+ "extends": ["eslint:recommended", "plugin:prettier/recommended"],
5
+ "parserOptions": {
6
+ "sourceType": "module",
7
+ "ecmaVersion": 2021
8
+ },
9
+ "plugins": ["prettier"]
10
+ }
package/.prettierrc ADDED
@@ -0,0 +1,9 @@
1
+ {
2
+ "semi": true,
3
+ "singleQuote": true,
4
+ "tabWidth": 4,
5
+ "useTabs": true,
6
+ "trailingComma": "es5",
7
+ "bracketSpacing": true,
8
+ "endOfLine": "lf"
9
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "editor.defaultFormatter": "esbenp.prettier-vscode",
3
+ "editor.formatOnSave": true,
4
+ "[typescript]": {
5
+ "editor.defaultFormatter": "esbenp.prettier-vscode"
6
+ },
7
+ "[javascript]": {
8
+ "editor.defaultFormatter": "esbenp.prettier-vscode"
9
+ }
10
+ }
package/README.md ADDED
@@ -0,0 +1,51 @@
1
+ https://auth0.com/docs/secure/security-guidance/data-security/allowlist
2
+ https://dev.to/stanbar/writing-mongo-realm-serverless-functions-in-typescript-5fdo
3
+
4
+ Need to set up API key for Auth0
5
+
6
+ Adding environment variables to atlas.d.ts
7
+
8
+ brew install curl
9
+ Get the domain from here: https://manage.auth0.com/dashboard/us/dev-h40ievkvqezopsav/tenant/admins (it's bolded at the top of the page in the intro content)
10
+ curl -s https://dev-h40ievkvqezopsav.us.auth0.com/pem | openssl x509 -pubkey -noout
11
+ Paste the contents into the Public Key (Secret Name) in the Custom JWT authentication provider
12
+
13
+ You need to get an example req.oidc.idToken from index.mjs in the server part of the bigfoot project
14
+ Past that into this tool: https://jwt.io/#debugger-io
15
+ Note down the "aud" property
16
+ Put the value of that in the Audience (Optional) in the authentication provider config
17
+
18
+ Auth0 stuff:
19
+ Dev
20
+ AUTH0_API_KEY: GCVzRnhjtBIAg0493d4v3yWCkRirft12s1BQAcHzkkcaPFKxUD9sWYeeYpYMG8sZ
21
+ AUTH0_HANDLER_ENDPOINT: https://us-east-1.aws.data.mongodb-api.com/app/bigfootbackend-xblwe/endpoint/api/v1/tenant/auth
22
+
23
+ Staging
24
+ AUTH0_API_KEY: ADXtN68db1do3ApsdyR5EfSkLnIL2hx6NuIJEeGYB0kNlIuyKjtgeAYPIqmGyat4
25
+ AUTH0_HANDLER_ENDPOINT: https://us-east-1.aws.data.mongodb-api.com/app/bigfootbackend-wstbt/endpoint/api/v1/tenant/auth
26
+
27
+ Production
28
+ AUTH0_API_KEY: 2OYocp1S6fIvSW3S8jQPd4iDhd8Q6syV8WqokemoKhilTn1FKix0om7Ctm0SqAH4
29
+ AUTH0_HANDLER_ENDPOINT: https://us-east-1.aws.data.mongodb-api.com/app/bigfootbackend-gxuab/endpoint/api/v1/tenant/auth
30
+
31
+ You need to set up the authentication stuff manually despite being in the deployment configuration...
32
+
33
+ {
34
+ "collection": "notes",
35
+ "database": "bigfoot-dev",
36
+ "filters": [
37
+ {
38
+ "name": "filterDocumentsForTenant",
39
+ "query": {
40
+ "%function": {
41
+ "name": "filterDocumentsForTenant"
42
+ }
43
+ },
44
+ "apply_when": {
45
+ "%%user.data": {
46
+ "%exists": "%%true"
47
+ }
48
+ }
49
+ }
50
+ ]
51
+ }
@@ -0,0 +1,231 @@
1
+ {
2
+ "label": "Account",
3
+ "name": "Account",
4
+ "references": [ "https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_account.htm" ],
5
+ "description": "Represents an individual account, which is an organization involved with your business (such as customers, competitors, and partners).",
6
+ "fields": [
7
+ {
8
+ "label": "Name",
9
+ "name": "Name",
10
+ "description": "A name for this account.",
11
+ "doMonitor": true,
12
+ "fieldType": "input",
13
+ "maximumCharacters": 255,
14
+ "order": 0,
15
+ "isReadOnly": false
16
+ },
17
+ {
18
+ "label": "Annual Revenue",
19
+ "name": "AnnualRevenue",
20
+ "description": "Estimated annual revenue of the account.",
21
+ "doMonitor": false,
22
+ "fieldType": "input",
23
+ "fieldVariation": "currency",
24
+ "order": 1,
25
+ "isReadOnly": false
26
+ },
27
+ {
28
+ "label": "Industry",
29
+ "name": "Industry",
30
+ "description": "An industry associated with this account.",
31
+ "doMonitor": false,
32
+ "fieldType": "select",
33
+ "order": 2,
34
+ "isReadOnly": false,
35
+ "options": [
36
+ {
37
+ "label": "Agriculture",
38
+ "value": "Agriculture"
39
+ },
40
+ {
41
+ "label": "Apparel",
42
+ "value": "Apparel"
43
+ },
44
+ {
45
+ "label": "Banking",
46
+ "value": "Banking"
47
+ },
48
+ {
49
+ "label": "Biotechnology",
50
+ "value": "Biotechnology"
51
+ },
52
+ {
53
+ "label": "Chemicals",
54
+ "value": "Chemicals"
55
+ },
56
+ {
57
+ "label": "Communications",
58
+ "value": "Communications"
59
+ },
60
+ {
61
+ "label": "Construction",
62
+ "value": "Construction"
63
+ },
64
+ {
65
+ "label": "Consulting",
66
+ "value": "Consulting"
67
+ },
68
+ {
69
+ "label": "Education",
70
+ "value": "Education"
71
+ },
72
+ {
73
+ "label": "Electronics",
74
+ "value": "Electronics"
75
+ },
76
+ {
77
+ "label": "Energy",
78
+ "value": "Energy"
79
+ },
80
+ {
81
+ "label": "Engineering",
82
+ "value": "Engineering"
83
+ },
84
+ {
85
+ "label": "Entertainment",
86
+ "value": "Entertainment"
87
+ },
88
+ {
89
+ "label": "Environmental",
90
+ "value": "Environmental"
91
+ },
92
+ {
93
+ "label": "Finance",
94
+ "value": "Finance"
95
+ },
96
+ {
97
+ "label": "Food & Beverage",
98
+ "value": "Food & Beverage"
99
+ },
100
+ {
101
+ "label": "Government",
102
+ "value": "Government"
103
+ },
104
+ {
105
+ "label": "Healthcare",
106
+ "value": "Healthcare"
107
+ },
108
+ {
109
+ "label": "Hospitality",
110
+ "value": "Hospitality"
111
+ },
112
+ {
113
+ "label": "Insurance",
114
+ "value": "Insurance"
115
+ },
116
+ {
117
+ "label": "Machinery",
118
+ "value": "Machinery"
119
+ },
120
+ {
121
+ "label": "Manufacturing",
122
+ "value": "Manufacturing"
123
+ },
124
+ {
125
+ "label": "Media",
126
+ "value": "Media"
127
+ },
128
+ {
129
+ "label": "Not For Profit",
130
+ "value": "Not For Profit"
131
+ },
132
+ {
133
+ "label": "Recreation",
134
+ "value": "Recreation"
135
+ },
136
+ {
137
+ "label": "Retail",
138
+ "value": "Retail"
139
+ },
140
+ {
141
+ "label": "Shipping",
142
+ "value": "Shipping"
143
+ },
144
+ {
145
+ "label": "Technology",
146
+ "value": "Technology"
147
+ },
148
+ {
149
+ "label": "Telecommunications",
150
+ "value": "Telecommunications"
151
+ },
152
+ {
153
+ "label": "Transportation",
154
+ "value": "Transportation"
155
+ },
156
+ {
157
+ "label": "Utilities",
158
+ "value": "Utilities"
159
+ },
160
+ {
161
+ "label": "Other",
162
+ "value": "Other"
163
+ }
164
+ ]
165
+ },
166
+ {
167
+ "label": "Phone",
168
+ "name": "Phone",
169
+ "description": "Phone number for this account.",
170
+ "doMonitor": false,
171
+ "fieldType": "input",
172
+ "fieldVariation": "phone",
173
+ "maximumCharacters": 40,
174
+ "order": 3,
175
+ "isReadOnly": false
176
+ },
177
+ {
178
+ "label": "Website",
179
+ "name": "Website",
180
+ "description": "The website of this account.",
181
+ "doMonitor": false,
182
+ "fieldType": "input",
183
+ "fieldVariation": "url",
184
+ "maximumCharacters": 255,
185
+ "order": 4,
186
+ "isReadOnly": false
187
+ },
188
+ {
189
+ "label": "Type",
190
+ "name": "Type",
191
+ "description": "Type of account.",
192
+ "doMonitor": true,
193
+ "fieldType": "select",
194
+ "order": 5,
195
+ "isReadOnly": false,
196
+ "options": [
197
+ {
198
+ "label": "Customer",
199
+ "value": "Customer"
200
+ },
201
+ {
202
+ "label": "Competitor",
203
+ "value": "Competitor"
204
+ },
205
+ {
206
+ "label": "Partner",
207
+ "value": "Partner"
208
+ }
209
+ ]
210
+ },
211
+ {
212
+ "label": "Owner.Name",
213
+ "name": "Owner",
214
+ "description": "Name of the User who has been assigned to work with this account.",
215
+ "doMonitor": true,
216
+ "fieldType": "input",
217
+ "order": 7,
218
+ "isReadOnly": false
219
+ },
220
+ {
221
+ "label": "Description",
222
+ "name": "Description",
223
+ "description": "Text description of the account.",
224
+ "doMonitor": false,
225
+ "fieldType": "textarea",
226
+ "maximumCharacters": 32000,
227
+ "order": 8,
228
+ "isReadOnly": false
229
+ }
230
+ ]
231
+ }
@@ -0,0 +1,95 @@
1
+ {
2
+ "label": "Contact",
3
+ "name": "Contact",
4
+ "references": [ "https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_contact.htm" ],
5
+ "description": "Represents a contact, which is a person associated with an account.",
6
+ "fields": [
7
+ {
8
+ "label": "First Name",
9
+ "name": "FirstName",
10
+ "description": "The first name of the contact.",
11
+ "doMonitor": true,
12
+ "fieldType": "input",
13
+ "maximumCharacters": 40,
14
+ "order": 0,
15
+ "isReadOnly": false
16
+ },
17
+ {
18
+ "label": "Last Name",
19
+ "name": "LastName",
20
+ "description": "The last name of the contact.",
21
+ "doMonitor": true,
22
+ "fieldType": "input",
23
+ "maximumCharacters": 80,
24
+ "order": 1,
25
+ "isReadOnly": false
26
+ },
27
+ {
28
+ "label": "Title",
29
+ "name": "Title",
30
+ "description": "A title for this contact.",
31
+ "doMonitor": true,
32
+ "fieldType": "input",
33
+ "order": 2,
34
+ "isReadOnly": false
35
+ },
36
+ {
37
+ "label": "Phone",
38
+ "name": "Phone",
39
+ "description": "The phone number for the contact.",
40
+ "doMonitor": true,
41
+ "fieldType": "input",
42
+ "fieldVariation": "phone",
43
+ "order": 3,
44
+ "isReadOnly": false
45
+ },
46
+ {
47
+ "label": "Email",
48
+ "name": "Email",
49
+ "description": "The email address for the contact.",
50
+ "doMonitor": true,
51
+ "fieldType": "input",
52
+ "fieldVariation": "email",
53
+ "order": 4,
54
+ "isReadOnly": false
55
+ },
56
+ {
57
+ "label": "Date of Birth",
58
+ "name": "Birthdate",
59
+ "description": "The date of birth of the contact.",
60
+ "doMonitor": true,
61
+ "fieldType": "input",
62
+ "fieldVariation": "date",
63
+ "order": 5,
64
+ "isReadOnly": false
65
+ },
66
+ {
67
+ "label": "Account",
68
+ "name": "Account.Name",
69
+ "description": "Name of the account associated with this contact.",
70
+ "doMonitor": true,
71
+ "fieldType": "input",
72
+ "order": 6,
73
+ "isReadOnly": false
74
+ },
75
+ {
76
+ "label": "Owner.Name",
77
+ "name": "Owner",
78
+ "description": "Name of the User who has been assigned to work with this contact.",
79
+ "doMonitor": true,
80
+ "fieldType": "input",
81
+ "order": 7,
82
+ "isReadOnly": false
83
+ },
84
+ {
85
+ "label": "Description",
86
+ "name": "Description",
87
+ "description": "Text description of the contact.",
88
+ "doMonitor": false,
89
+ "fieldType": "textarea",
90
+ "maximumCharacters": 32000,
91
+ "order": 8,
92
+ "isReadOnly": false
93
+ }
94
+ ]
95
+ }
@@ -0,0 +1,79 @@
1
+ {
2
+ "label": "Calendar Event",
3
+ "name": "Event",
4
+ "references": [ "https://developers.google.com/calendar/api/v3/reference/events" ],
5
+ "description": "Represents an event in a calendar.",
6
+ "fields": [
7
+ {
8
+ "label": "Summary",
9
+ "name": "Summary",
10
+ "description": "A summary description of the event.",
11
+ "doMonitor": true,
12
+ "fieldType": "input",
13
+ "maximumCharacters": 255,
14
+ "order": 0,
15
+ "isReadOnly": false
16
+ },
17
+ {
18
+ "label": "Status",
19
+ "name": "Status",
20
+ "description": "The status of the event.",
21
+ "doMonitor": true,
22
+ "fieldType": "select",
23
+ "order": 1,
24
+ "isReadOnly": false,
25
+ "options": [
26
+ {
27
+ "label": "Confirmed",
28
+ "value": "Confirmed"
29
+ },
30
+ {
31
+ "label": "Tentative",
32
+ "value": "Tentative"
33
+ },
34
+ {
35
+ "label": "Cancelled",
36
+ "value": "Cancelled"
37
+ }
38
+ ]
39
+ },
40
+ {
41
+ "label": "Date",
42
+ "name": "Date",
43
+ "description": "Date and time for the event.",
44
+ "doMonitor": true,
45
+ "fieldType": "input",
46
+ "fieldVariation": "datetime",
47
+ "order": 2,
48
+ "isReadOnly": false
49
+ },
50
+ {
51
+ "label": "Attendees",
52
+ "name": "Attendees",
53
+ "description": "A comma separated list of email addresses for those attending the event.",
54
+ "doMonitor": true,
55
+ "fieldType": "input",
56
+ "order": 3,
57
+ "isReadOnly": false
58
+ },
59
+ {
60
+ "label": "Attachments",
61
+ "name": "Attachments",
62
+ "description": "A comma separated list of links to any attachments.",
63
+ "doMonitor": true,
64
+ "fieldType": "input",
65
+ "order": 3,
66
+ "isReadOnly": false
67
+ },
68
+ {
69
+ "label": "Description",
70
+ "name": "Description",
71
+ "description": "Text description of the event.",
72
+ "doMonitor": false,
73
+ "fieldType": "textarea",
74
+ "maximumCharacters": 32000,
75
+ "order": 4,
76
+ "isReadOnly": false
77
+ }
78
+ ]
79
+ }
@@ -0,0 +1,127 @@
1
+ {
2
+ "label": "Issue",
3
+ "name": "Issue",
4
+ "references": [
5
+ "https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_case.htm",
6
+ "https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issues/#api-rest-api-3-issue-post",
7
+ "https://developer.zendesk.com/api-reference/ticketing/tickets/tickets/"
8
+ ],
9
+ "description": "Represents an issue/case/ticket, which is a problem that needs to be resolved.",
10
+ "fields": [
11
+ {
12
+ "label": "Summary",
13
+ "name": "Summary",
14
+ "description": "A summary description of the issue.",
15
+ "doMonitor": true,
16
+ "fieldType": "input",
17
+ "maximumCharacters": 255,
18
+ "order": 0,
19
+ "isReadOnly": false
20
+ },
21
+ {
22
+ "label": "Priority",
23
+ "name": "Priority",
24
+ "description": "The priority of the issue.",
25
+ "doMonitor": true,
26
+ "fieldType": "select",
27
+ "order": 1,
28
+ "isReadOnly": false,
29
+ "options": [
30
+ {
31
+ "label": "High",
32
+ "value": "High"
33
+ },
34
+ {
35
+ "label": "Medium",
36
+ "value": "Medium"
37
+ },
38
+ {
39
+ "label": "Low",
40
+ "value": "Low"
41
+ }
42
+ ]
43
+ },
44
+ {
45
+ "label": "Status",
46
+ "name": "Status",
47
+ "description": "The status of the issue.",
48
+ "doMonitor": true,
49
+ "fieldType": "select",
50
+ "order": 2,
51
+ "isReadOnly": false,
52
+ "options": [
53
+ {
54
+ "label": "New",
55
+ "value": "New"
56
+ },
57
+ {
58
+ "label": "Open",
59
+ "value": "Open"
60
+ },
61
+ {
62
+ "label": "Pending",
63
+ "value": "Pending"
64
+ },
65
+ {
66
+ "label": "Hold",
67
+ "value": "Hold"
68
+ },
69
+ {
70
+ "label": "Solved",
71
+ "value": "Solved"
72
+ },
73
+ {
74
+ "label": "Closed",
75
+ "value": "Closed"
76
+ }
77
+ ]
78
+ },
79
+ {
80
+ "label": "Account",
81
+ "name": "Account.Name",
82
+ "description": "Name of the account associated with this issue.",
83
+ "doMonitor": true,
84
+ "fieldType": "input",
85
+ "order": 3,
86
+ "isReadOnly": false
87
+ },
88
+ {
89
+ "label": "Contact Name",
90
+ "name": "Contact.Name",
91
+ "description": "Name of the contact associated with this issue.",
92
+ "doMonitor": true,
93
+ "fieldType": "input",
94
+ "order": 4,
95
+ "isReadOnly": false
96
+ },
97
+ {
98
+ "label": "Due Date",
99
+ "name": "DueDate",
100
+ "description": "Date and time when the issue is due to be completed.",
101
+ "doMonitor": true,
102
+ "fieldType": "input",
103
+ "fieldVariation": "datetime",
104
+ "order": 5,
105
+ "isReadOnly": false
106
+ },
107
+ {
108
+ "label": "Owner.Name",
109
+ "name": "Owner",
110
+ "description": "Name of the User who has been assigned to work on this issue.",
111
+ "doMonitor": true,
112
+ "fieldType": "input",
113
+ "order": 6,
114
+ "isReadOnly": false
115
+ },
116
+ {
117
+ "label": "Description",
118
+ "name": "Description",
119
+ "description": "Text description of the issue.",
120
+ "doMonitor": false,
121
+ "fieldType": "textarea",
122
+ "maximumCharacters": 32000,
123
+ "order": 7,
124
+ "isReadOnly": false
125
+ }
126
+ ]
127
+ }
@@ -0,0 +1,127 @@
1
+ {
2
+ "label": "Opportunity",
3
+ "name": "Opportunity",
4
+ "references": [ "https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_opportunity.htm" ],
5
+ "description": "Represents an opportunity, which is a sale or pending deal.",
6
+ "fields": [
7
+ {
8
+ "label": "Name",
9
+ "name": "Name",
10
+ "description": "A name for this opportunity.",
11
+ "doMonitor": true,
12
+ "fieldType": "input",
13
+ "maximumCharacters": 120,
14
+ "order": 0,
15
+ "isReadOnly": false
16
+ },
17
+ {
18
+ "label": "Account",
19
+ "name": "Account.Name",
20
+ "description": "Name of the account associated with this opportunity.",
21
+ "doMonitor": true,
22
+ "fieldType": "input",
23
+ "order": 1,
24
+ "isReadOnly": false
25
+ },
26
+ {
27
+ "label": "Amount",
28
+ "name": "Amount",
29
+ "description": "Estimated total sale amount.",
30
+ "doMonitor": true,
31
+ "fieldType": "input",
32
+ "fieldVariation": "currency",
33
+ "order": 2,
34
+ "isReadOnly": false
35
+ },
36
+ {
37
+ "label": "Close Date",
38
+ "name": "CloseDate",
39
+ "description": "Date when the opportunity is expected to close.",
40
+ "doMonitor": true,
41
+ "fieldType": "input",
42
+ "fieldVariation": "date",
43
+ "order": 3,
44
+ "isReadOnly": false
45
+ },
46
+ {
47
+ "label": "Stage",
48
+ "name": "StageName",
49
+ "description": "Current stage of this opportunity.",
50
+ "doMonitor": true,
51
+ "fieldType": "select",
52
+ "order": 4,
53
+ "isReadOnly": false,
54
+ "options": [
55
+ {
56
+ "label": "Prospecting",
57
+ "value": "Prospecting"
58
+ },
59
+ {
60
+ "label": "Qualification",
61
+ "value": "Qualification"
62
+ },
63
+ {
64
+ "label": "Needs Analysis",
65
+ "value": "Needs Analysis"
66
+ },
67
+ {
68
+ "label": "Value Proposition",
69
+ "value": "Value Proposition"
70
+ },
71
+ {
72
+ "label": "Id. Decision Makers",
73
+ "value": "Id. Decision Makers"
74
+ },
75
+ {
76
+ "label": "Perception Analysis",
77
+ "value": "Perception Analysis"
78
+ },
79
+ {
80
+ "label": "Proposal/Price Quote",
81
+ "value": "Proposal/Price Quote"
82
+ },
83
+ {
84
+ "label": "Negotiation/Review",
85
+ "value": "Negotiation/Review"
86
+ },
87
+ {
88
+ "label": "Closed Won",
89
+ "value": "Closed Won"
90
+ },
91
+ {
92
+ "label": "Closed Lost",
93
+ "value": "Closed Lost"
94
+ }
95
+ ]
96
+ },
97
+ {
98
+ "label": "Owner.Name",
99
+ "name": "Owner",
100
+ "description": "Name of the User who has been assigned to work on this opportunity.",
101
+ "doMonitor": true,
102
+ "fieldType": "input",
103
+ "order": 5,
104
+ "isReadOnly": false
105
+ },
106
+ {
107
+ "label": "Next Step",
108
+ "name": "NextStep",
109
+ "description": "A short description of next task in closing opportunity.",
110
+ "doMonitor": true,
111
+ "fieldType": "input",
112
+ "maximumCharacters": 250,
113
+ "order": 6,
114
+ "isReadOnly": false
115
+ },
116
+ {
117
+ "label": "Description",
118
+ "name": "Description",
119
+ "description": "Text description of the opportunity.",
120
+ "doMonitor": false,
121
+ "fieldType": "textarea",
122
+ "maximumCharacters": 32000,
123
+ "order": 7,
124
+ "isReadOnly": false
125
+ }
126
+ ]
127
+ }
package/model.ts ADDED
@@ -0,0 +1,380 @@
1
+ import { v4 as uuidv4 } from 'uuid';
2
+
3
+ /*
4
+ These are the core primitives of our model. These represent the entities that show
5
+ up in our Graph QL CRUD operations and set out the fundamental building blocks of
6
+ the platform.
7
+ */
8
+ // CORE START
9
+ export enum BusinessObjectType {
10
+ Event = 'event',
11
+ Task = 'task',
12
+ Document = 'document',
13
+ Record = 'record',
14
+ Conference = 'conference',
15
+ Message = 'message',
16
+ Website = 'website',
17
+ }
18
+
19
+ export enum BlockType {
20
+ Section = 'section', // It's a fragment of content
21
+ Task = 'task', // It's a task
22
+ Data = 'data', // It's a record or set of records belonging to a specific metadata definition
23
+ }
24
+
25
+ export enum TagType {
26
+ Person = 'person',
27
+ Topic = 'topic',
28
+ }
29
+
30
+ export enum SharingLevel {
31
+ ReadOnly = 0,
32
+ Editor = 1,
33
+ Owner = 2, // Only an owner can make you an owner - and the initial creator is always the owner
34
+ }
35
+
36
+ export enum TaskStatus {
37
+ NotStarted = 0,
38
+ InProgress = 1,
39
+ Completed = 10,
40
+ }
41
+
42
+ export enum StepStatus {
43
+ NotStarted = 0,
44
+ Completed = 10,
45
+ }
46
+
47
+ export enum SharingApproach {
48
+ Inline = 0, // As in, the user has used this tag in the note
49
+ Explicit = 1, // The system has assigned the sharing to the tenant based on access rules
50
+ Automated = 2, // The settings on the tag have caused the sharing to happen
51
+ }
52
+
53
+ export enum InviteStatus {
54
+ NotInvited = 0,
55
+ InviteSent = 1,
56
+ InviteAccepted = 2,
57
+ }
58
+
59
+ export enum RecurrenceRFC {
60
+ FREQ = 'FREQ', // The frequency of the event (e.g., DAILY, WEEKLY, MONTHLY, YEARLY).
61
+ UNTIL = 'UNTIL', // A date until when the event should occur.
62
+ COUNT = 'COUNT', // How many occurrences of the event will take place.
63
+ INTERVAL = 'INTERVAL', // How often the event repeats within the frequency period.
64
+ BYDAY = 'BYDAY', // Specifies the days of the week when the event should occur.
65
+ BYMONTH = 'BYMONTH', // Specifies months of the year.
66
+ BYMONTHDAY = 'BYMONTHDAY', // Specifies days of the month.
67
+ BYYEARDAY = 'BYYEARDAY', // Specifies days of the year.
68
+ BYWEEKNO = 'BYWEEKNO', // Specifies the week numbers in the year.
69
+ BYHOUR = 'BYHOUR',
70
+ BYMINUTE = 'BYMINUTE',
71
+ BYSECOND = 'BYSECOND', // Specifies the time of the event.
72
+ MONDAY = 'MO',
73
+ TUESDAY = 'TU',
74
+ WEDNESDAY = 'WE',
75
+ THURSDAY = 'TH',
76
+ FRIDAY = 'FR',
77
+ SATURDAY = 'SA',
78
+ SUNDAY = 'SU',
79
+ }
80
+
81
+ export interface Mark {
82
+ type: string;
83
+ }
84
+
85
+ export interface Document {
86
+ attrs: Map<string, string>;
87
+ content: Document;
88
+ text: string;
89
+ type: string;
90
+ marks: Mark[];
91
+ }
92
+
93
+ export interface Editor {
94
+ client: string;
95
+ clientId: string;
96
+ tagId: string;
97
+ }
98
+
99
+ export interface SharingTag {
100
+ tagId: string;
101
+ isShared: boolean;
102
+ sharingApproach: SharingApproach;
103
+ sharingLevel: SharingLevel;
104
+ }
105
+
106
+ export interface SharingDomain {
107
+ domainId: string;
108
+ isArchived: boolean; // Indicates if the tag has been archived for the domain, but is shared
109
+ sharingLevel: SharingLevel; // Determines what domains can do with the tag beyond domain specific settings above
110
+ }
111
+
112
+ export interface SharingTenant {
113
+ tenantId: string;
114
+ hasAutoShareNotesOn: boolean; // Indicates if the tenant has auto sharing of notes switched on
115
+ hasAutoShareTasksOn: boolean; // Indicates if the tenant has auto sharing of tasks switched on
116
+ sharingLevel: SharingLevel; // Determines what tenants can do with the tag beyond tenant specific settings above
117
+ }
118
+
119
+ export interface Reaction {
120
+ skinTones: ReactionSkinTone[];
121
+ unified: string;
122
+ }
123
+
124
+ export interface ReactionSkinTone {
125
+ skinTone: string;
126
+ tenantIds: string[];
127
+ }
128
+
129
+ export interface Step {
130
+ content: string;
131
+ status: StepStatus;
132
+ }
133
+
134
+ export class Primitive {
135
+ _id: string;
136
+ dateCreated: number;
137
+ dateUpdated: number;
138
+
139
+ constructor() {
140
+ this._id = uuidv4();
141
+
142
+ const now = Date.now();
143
+ this.dateCreated = now;
144
+ this.dateUpdated = now;
145
+ }
146
+ }
147
+
148
+ export class Tag extends Primitive {
149
+ tenantIdCreated: string; // The tenant._id that created the note initially
150
+ alias: string;
151
+ friendlyName?: string;
152
+ sharingDomains?: SharingDomain[]; // The domains this tag is shared with plus domain settings for the tag
153
+ sharingTenants?: SharingTenant[]; // The tenants this tag is shared with plus tenant settings for the tag
154
+ tagType: TagType;
155
+ }
156
+
157
+ export class BusinessObject extends Primitive {
158
+ provider: string; // A unique string representing the provider e.g. "salesforce", "jira", etc
159
+ uri: string; // A uri to locate the specific instance of the business object
160
+ iconUrl?: string; // The url of an icon that represents the business object
161
+ externalId: string; // An identifier that allows us to do entity resolution
162
+ businessObjectType: BusinessObjectType;
163
+ externalResponse: string; // The full response from the external system that created this object
164
+ document: Document; // The business object formatted as a document for ML to ingest
165
+ }
166
+
167
+ export class Tenant extends Primitive {
168
+ domainMemberships: string[]; // The list of all domains this tenant belongs
169
+ email: string;
170
+ emailVerified: boolean;
171
+ domainIdEmail: string; // The domain for which the tenant is a member because of their email
172
+ tagId: string;
173
+ picture?: string;
174
+ familyName?: string;
175
+ givenName?: string;
176
+ }
177
+
178
+ export class Domain extends Primitive {
179
+ domain: string;
180
+ public: boolean;
181
+ }
182
+
183
+ export class Person extends Tag {
184
+ tenantIdVerified: string; // The tenant._id that claimed/verified this tag as being them
185
+ email: string;
186
+ inviteStatus?: InviteStatus;
187
+ }
188
+
189
+ export class Note extends Primitive {
190
+ tenantIdCreated: string; // The tenant._id that created the note initially
191
+ document: Document;
192
+ editors: Editor[]; // The list of people/devices that were used in creating this note
193
+ sharingTags: SharingTag[]; // The list of tags that this note is shared with
194
+ reactions?: Reaction[]; // Reactions from tenants to this primitive
195
+ }
196
+
197
+ export class Block extends Note {
198
+ blockType: BlockType; // The type of block being stored
199
+ }
200
+
201
+ export class Task extends Block {
202
+ status: TaskStatus;
203
+ steps?: Step[];
204
+ dateRemindMe?: Date;
205
+ dateDue: Date;
206
+ recurrence?: RecurrenceRFC[];
207
+ }
208
+ // CORE END
209
+
210
+ /*
211
+ These are the business objects we explicitly support and have a standardized description
212
+ of across all systems. This allows these business objects to interact with each other
213
+ regardless of underpinning system.
214
+ */
215
+ // BUSINESS OBJECTS START
216
+
217
+ //// CONFERENCE START
218
+ export interface TranscriptionEntry {
219
+ person: Person;
220
+ text: string;
221
+ language: string;
222
+ startDate: Date;
223
+ endDate: Date;
224
+ }
225
+
226
+ export interface Transcription {
227
+ entries: TranscriptionEntry[];
228
+ }
229
+
230
+ export interface ConferenceEntrypoint {
231
+ entryPointType: string;
232
+ uri?: string;
233
+ label?: string;
234
+ pin?: string;
235
+ accessCode?: string;
236
+ meetingCode?: string;
237
+ passcode?: string;
238
+ password?: string;
239
+ }
240
+
241
+ export class Conference extends BusinessObject {
242
+ entryPoints: ConferenceEntrypoint[];
243
+ transcription: Transcription;
244
+ }
245
+ //// CONFERENCE END
246
+
247
+ //// EVENT START
248
+ export enum EventStatus {
249
+ Confirmed = 'confirmed',
250
+ Tentative = 'tentative',
251
+ Cancelled = 'cancelled',
252
+ }
253
+
254
+ export interface PersonAcceptance {
255
+ tagId: string;
256
+ accepted: boolean;
257
+ }
258
+
259
+ export interface Calendar extends BusinessObject {
260
+ description?: string;
261
+ location?: string;
262
+ timeZone: string;
263
+ }
264
+
265
+ export interface Event extends BusinessObject {
266
+ calendarId: string;
267
+ status: EventStatus;
268
+ subject?: string;
269
+ description?: string;
270
+ location: string;
271
+ startDate: Date;
272
+ endDate?: Date;
273
+ recurrence: RecurrenceRFC[];
274
+ originalStartDate: Date;
275
+ organizedBy: Person;
276
+ attendees?: PersonAcceptance[];
277
+ conference?: Conference;
278
+ businessObjectIds?: string[]; // Attachments
279
+ }
280
+ //// EVENT END
281
+
282
+ //// EXTERNAL TASK START
283
+ export class ExternalTask extends BusinessObject {
284
+ status: TaskStatus;
285
+ steps?: Step[];
286
+ dateRemindMe?: Date;
287
+ dateDue: Date;
288
+ recurrence?: RecurrenceRFC[];
289
+ }
290
+ //// EXTERNAL TASK END
291
+
292
+ //// MESSAGING START
293
+ export class Thread extends BusinessObject {}
294
+ //// MESSAGING END
295
+
296
+ //// WEBSITE START
297
+ export interface Website extends BusinessObject {}
298
+ //// WEBSITE END
299
+
300
+ // BUSINESS OBJECTS END
301
+
302
+ // METADATA OBJECTS START
303
+
304
+ //// FOR DOCUMENTS START
305
+ export interface BlockDescription {
306
+ title?: string;
307
+ name: string;
308
+ description: string;
309
+ blockType: BlockType;
310
+ }
311
+
312
+ export interface DocumentMetadata {
313
+ contentBlocks: BlockDescription[];
314
+ }
315
+
316
+ export class Template extends BusinessObject {
317
+ metadata: DocumentMetadata;
318
+ }
319
+ //// FOR DOCUMENTS END
320
+
321
+ //// FOR RECORDS START
322
+ export enum FieldType {
323
+ Text = 'input',
324
+ Select = 'select',
325
+ Checkbox = 'checkbox',
326
+ Identifier = 'identifier',
327
+ }
328
+
329
+ export enum FieldVariation {
330
+ Multi = 'multi',
331
+ Password = 'password',
332
+ Email = 'email',
333
+ Date = 'date',
334
+ Currency = 'currency',
335
+ DateTime = 'datetime',
336
+ Phone = 'phone',
337
+ Url = 'url',
338
+ }
339
+
340
+ export interface Option {
341
+ label: string;
342
+ value: string;
343
+ }
344
+
345
+ export interface Field {
346
+ label?: string;
347
+ name: string;
348
+ description: string;
349
+ doMonitor: boolean;
350
+ fieldType: FieldType;
351
+ fieldVariation?: FieldVariation;
352
+ order: number;
353
+ maximumCharacters?: number;
354
+ isReadOnly: boolean;
355
+ options?: Option[];
356
+ }
357
+
358
+ export interface FieldValue {
359
+ name: string;
360
+ previousValue: string;
361
+ nextValue: string;
362
+ value: string;
363
+ changed: boolean;
364
+ }
365
+
366
+ export interface TableMetadata {
367
+ label: string;
368
+ name: string;
369
+ description: string;
370
+ fields: Field[];
371
+ }
372
+
373
+ export class Table extends BusinessObject {
374
+ recordType: string;
375
+ metadata: TableMetadata;
376
+ values: FieldValue[];
377
+ }
378
+ //// FOR RECORDS END
379
+
380
+ // METADATA OBJECTS END
package/package.json ADDED
@@ -0,0 +1,15 @@
1
+ {
2
+ "author": "Bigfoot",
3
+ "name": "@bigfootai/bigfoot-types",
4
+ "version": "2.1.0",
5
+ "description": "The internal library for the types used in the Bigfoot platform",
6
+ "main": "index.js",
7
+ "license": "ISC",
8
+ "repository": "Notify-AI/bigfoot-types",
9
+ "dependencies": {
10
+ "uuid": "^9.0.1"
11
+ },
12
+ "devDependencies": {
13
+ "ts-node": "^10.9.2"
14
+ }
15
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,12 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2020",
4
+ "module": "ESNext",
5
+ "skipLibCheck": true,
6
+
7
+ /* Linting */
8
+ "noUnusedLocals": true,
9
+ "noUnusedParameters": true,
10
+ "noFallthroughCasesInSwitch": true
11
+ }
12
+ }