@nuffieldtechnologies/rugged-schema-types 1.0.9 → 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.
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports._AllUserFields = exports._UserInput = exports._User = void 0;
4
+ const Roles = require("./roles");
5
+ exports._User = `
6
+ type User {
7
+ id: ID
8
+ organisation: ID
9
+ firebaseId: ID
10
+ name: String
11
+ email: String
12
+ roles: Roles
13
+ permissions: String
14
+ }
15
+ `;
16
+ exports._UserInput = `
17
+ input UserInput {
18
+ id: ID
19
+ organisation: ID
20
+ firebaseId: ID
21
+ name: String
22
+ email: String
23
+ roles: RolesInput
24
+ }
25
+ `;
26
+ exports._AllUserFields = `{id, organisation, name, email, roles ${Roles._AllRolesFields}, permissions}`;
27
+ //# sourceMappingURL=user.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user.js","sourceRoot":"","sources":["../../schemas/user.ts"],"names":[],"mappings":";;;AAAA,iCAAgC;AAEnB,QAAA,KAAK,GAAG;;;;;;;;;;CAUpB,CAAC;AAEW,QAAA,UAAU,GAAG;;;;;;;;;CASzB,CAAC;AAEW,QAAA,cAAc,GAAG,yCAAyC,KAAK,CAAC,eAAe,gBAAgB,CAAC"}
package/index.ts CHANGED
@@ -1,306 +1,36 @@
1
- const _TimeStamps = `
2
- type TimeStamps {
3
- started: String,
4
- updated: String,
5
- discarded: String,
6
- submitted: String,
7
- processed: String,
8
- upgraded: String
9
- }
10
- `;
11
- const _TimeStampsInput = `
12
- input TimeStampsInput {
13
- started: String,
14
- updated: String,
15
- discarded: String,
16
- submitted: String,
17
- processed: String,
18
- upgraded: String
19
- }
20
- `;
21
-
22
- const _Event = `
23
- type Event {
24
- appVersion: String,
25
- at: Float,
26
- atForHumans: String,
27
- device: String,
28
- deviceModel: String,
29
- osVersion: String,
30
- user: String,
31
- userEmail: String
32
- }
33
- `
34
-
35
- const _EventInput = `
36
- input EventInput {
37
- appVersion: String,
38
- at: Float,
39
- atForHumans: String,
40
- device: String,
41
- deviceModel: String,
42
- osVersion: String,
43
- user: String,
44
- userEmail: String
45
- }
46
- `;
47
-
48
- const _Events = `
49
- type Events {
50
- started: Event,
51
- updated: Event,
52
- submitted: Event,
53
- discarded: Event,
54
- }
55
- `;
56
-
57
- const _EventsInput = `
58
- input EventsInput {
59
- started: EventInput,
60
- updated: EventInput,
61
- submitted: EventInput,
62
- discarded: EventInput,
63
- }
64
- `;
65
-
66
- const _TemplateInfo = `
67
- type TemplateInfo {
68
- name: String,
69
- shortName: String,
70
- type: String,
71
- id: String
72
- version: String
73
- }
74
- `;
75
-
76
- const _TemplateInfoInput = `
77
- input TemplateInfoInput {
78
- name: String,
79
- shortName: String,
80
- type: String,
81
- id: String
82
- version: String
83
- }
84
- `;
85
-
86
- const _TaskIdentifiers = `
87
- type TaskIdentifiers {
88
- primary: String
89
- secondary: String
90
- }
91
- `;
92
-
93
- const _TaskIdentifiersInput = `
94
- input TaskIdentifiersInput {
95
- primary: String
96
- secondary: String
97
- }
98
- `;
99
-
100
- const _Task = `
101
- type Task {
102
- id: ID,
103
- name: String
104
- definition: String
105
- user: ID
106
- userEmail: String
107
- form: ID
108
- organisation: ID
109
- timestamps: TimeStamps
110
- events: Events
111
- template: TemplateInfo
112
- identifiers: TaskIdentifiers
113
- status: String
114
- fails: [String]
115
- reportUrl: String
116
- data: String
117
- refNo: String
118
- }
119
- `;
120
-
121
- const _AllEventFields = `{appVersion, at, atForHumans, device, deviceModel, osVersion, user, userEmail}`;
122
-
123
- const _AllTaskFields = `{id, name, definition, user, userEmail, form, id, organisation, timestamps {started, updated, submitted, processed, upgraded} events {started ${_AllEventFields}, updated ${_AllEventFields}, submitted ${_AllEventFields}, discarded ${_AllEventFields}} , template { name, shortName, type, id, version}, identifiers { primary, secondary}, status, fails, reportUrl, data, refNo}`;
124
-
125
- const _TaskInput = `
126
- input TaskInput {
127
- # The name of the task. TODO does this actually exist?
128
- name: String,
129
-
130
- # A short description of the task
131
- description: String
132
-
133
- # The definition of the task
134
- definition: String!,
135
-
136
- # The id of the user who submitted the task TODO is this right?
137
- user: ID
138
-
139
- # The email of the user who submitted the task
140
- userEmail: String,
141
-
142
- form: ID
143
- id: ID
144
- organisation: ID
145
- status: String
146
- fails: [String]
147
- reportUrl: String
148
- timestamps: TimeStampsInput
149
- events: EventsInput
150
- template: TemplateInfoInput
151
- identifiers: TaskIdentifiersInput
152
- data: String
153
-
154
- #A unique identifier for the task that is intended to be human-readable.
155
- refNo: String
156
- }
157
- `;
158
-
159
- const _TaskFilter = `
160
- input TaskFilter {
161
- users: [ID]
162
- userEmails: [String]
163
- forms: [ID]
164
- after: String
165
- before: String
166
- },
167
- `;
168
-
169
- const _Roles = `
170
- type Roles {
171
- user: Boolean
172
- admin: Boolean
173
- api: Boolean
174
- uber: Boolean
175
- super: Boolean
176
- legacyPush: Boolean
177
- }
178
- `;
179
-
180
- const _RolesInput = `
181
- input RolesInput {
182
- user: Boolean
183
- admin: Boolean
184
- api: Boolean
185
- }
186
- `;
187
-
188
- const _User = `
189
- type User {
190
- id: ID
191
- organisation: ID
192
- firebaseId: ID
193
- name: String
194
- email: String
195
- roles: Roles
196
- permissions: String
197
- }
198
- `;
199
-
200
- const _UserInput = `
201
- input UserInput {
202
- id: ID
203
- organisation: ID
204
- firebaseId: ID
205
- name: String
206
- email: String
207
- roles: RolesInput
208
- }
209
- `;
210
-
211
- const _AllRolesFields = `{user, admin, api, uber, super, legacyPush}`;
212
- const _AllUserFields = `{id, organisation, name, email, roles ${_AllRolesFields}, permissions}`;
213
-
214
- const _FormInput = `
215
-
216
- input ParamInput {
217
- name: String
218
- value: String
219
- }
220
-
221
- input FormInput {
222
- id: ID
223
- name: String
224
- key: String
225
- definition: String
226
- version: String
227
- status: String
228
- updated: String
229
- params: [ParamInput]
230
- resources: String
231
- body: String
232
- }
233
- `;
234
-
235
- const _FormFilter = `
236
- input FormFilter {
237
- status: String
238
- }
239
- `;
240
-
241
- const _Form = `
242
-
243
- type Param {
244
- name: String
245
- value: String
246
- }
247
-
248
- type Form {
249
- id: ID
250
- name: String
251
- key: String
252
- definition: String
253
- version: String
254
- status: String
255
- updated: String
256
- params: [Param]
257
- resources: String
258
- body: String
259
- }
260
- `;
261
-
262
- const _AllFormFields = `{id, name, key, definition, status, updated, params {name, value}, resources, body}`;
263
-
264
- const _OrganisationInput = `
265
- input OrganisationInput {
266
- id: ID
267
- name: String
268
- logoUrl: String
269
- }
270
- `;
271
-
272
- const _Organisation = `
273
- type Organisation {
274
- id: ID
275
- name: String
276
- logoUrl: String
277
- }
278
- `;
279
-
280
- const _AllOrganisationFields = `{id, name, logoUrl}`;
281
-
282
- export const Task = _TimeStamps + _Event + _Events + _TemplateInfo + _Task + _TaskIdentifiers;
283
- export const TaskInput = _TimeStampsInput + _EventInput + _EventsInput + _TemplateInfoInput + _TaskInput + _TaskIdentifiersInput;
284
- export const TaskFilter = _TaskFilter;
285
- export const Tasks = Task + TaskInput + TaskFilter;
286
- export const AllTaskFields = _AllTaskFields;
287
-
288
- export const User = _Roles + _User;
289
- export const UserInput = _RolesInput + _UserInput;
1
+ import * as TimeStamps from './schemas/timestamps'
2
+ import * as Events from './schemas/events'
3
+ import * as TemplateInfo from './schemas/template-info'
4
+ import * as UserSchemas from './schemas/user'
5
+ import * as Roles from './schemas/roles'
6
+ import * as FormShemas from './schemas/form'
7
+ import * as OrganisationSchemas from './schemas/organisation'
8
+ import * as TaskIdentifiers from './schemas/task-identifiers'
9
+ import * as TaskOldSchemas from './schemas/task-old'
10
+ import * as TaskSchemas from './schemas/task'
11
+
12
+ export const Task = TimeStamps._TimeStamps + Events._Event + Events._Events + TemplateInfo._TemplateInfo + TaskSchemas._Task + TaskIdentifiers._TaskIdentifiers;
13
+ export const TaskInput = TimeStamps._TimeStampsInput + Events._EventInput + Events._EventsInput + TemplateInfo._TemplateInfoInput + TaskSchemas._TaskInput + TaskIdentifiers._TaskIdentifiersInput;
14
+ export const TaskFilter = TaskSchemas._TaskFilter;
15
+ export const Tasks = Task + TaskInput + TaskFilter + TaskOldSchemas._TaskOld + TaskSchemas._TaskInfo + TaskSchemas._TaskInfoInput;
16
+ export const AllTaskFields = TaskSchemas._AllTaskFields;
17
+
18
+ export const User = Roles._Roles + UserSchemas._User;
19
+ export const UserInput = Roles._RolesInput + UserSchemas._UserInput;
290
20
  export const Users = User + UserInput;
291
- export const AllUserFields = _AllUserFields;
292
- export const AllRolesFields = _AllRolesFields;
21
+ export const AllUserFields = UserSchemas._AllUserFields;
22
+ export const AllRolesFields = Roles._AllRolesFields;
293
23
 
294
- export const Form = _Form;
295
- export const FormInput = _FormInput;
296
- export const FormFilter = _FormFilter;
24
+ export const Form = FormShemas._Form;
25
+ export const FormInput = FormShemas._FormInput;
26
+ export const FormFilter = FormShemas._FormFilter;
297
27
  export const Forms = Form + FormInput + FormFilter;
298
- export const AllFormFields = _AllFormFields;
28
+ export const AllFormFields = FormShemas._AllFormFields;
299
29
 
300
- export const Organisation = _Organisation;
301
- export const OrganisationInput = _OrganisationInput;
30
+ export const Organisation = OrganisationSchemas._Organisation;
31
+ export const OrganisationInput = OrganisationSchemas._OrganisationInput;
302
32
  export const Organisations = Organisation + OrganisationInput;
303
- export const AllOrganisationFields = _AllOrganisationFields;
33
+ export const AllOrganisationFields = OrganisationSchemas._AllOrganisationFields;
304
34
 
305
35
  export const All = Tasks + Users + Forms + Organisations;
306
36
  export default All;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuffieldtechnologies/rugged-schema-types",
3
- "version": "1.0.9",
3
+ "version": "2.1.0",
4
4
  "description": "Graphql schema for rugged data",
5
5
  "main": "dist/index.js",
6
6
  "keywords": [
@@ -8,18 +8,22 @@
8
8
  "schema"
9
9
  ],
10
10
  "devDependencies": {
11
- "@types/chai": "^4.1.3",
12
- "@types/mocha": "^5.2.0",
13
- "chai": "^4.2.0",
14
- "mocha": "^6.1.3",
15
- "ts-node": "^6.0.3",
16
- "tslint": "^5.10.0",
17
- "typescript": "^3.4.3"
11
+ "@types/chai": "^4.3.4",
12
+ "@types/mocha": "^10.0.1",
13
+ "chai": "^4.3.7",
14
+ "mocha": "^10.2.0",
15
+ "ts-node": "^10.9.1",
16
+ "@typescript-eslint/eslint-plugin": "^5.48.2",
17
+ "@typescript-eslint/parser": "^5.48.2",
18
+ "eslint": "^8.32.0",
19
+ "typescript": "^4.9.4"
18
20
  },
19
21
  "author": "Tom Edge",
20
22
  "license": "UNLICENSED",
21
23
  "scripts": {
22
24
  "test": "echo \"Error: no test specified\" && exit 1",
25
+ "lint": "eslint --fix './**/*.ts'",
26
+ "prebuild": "npm run lint",
23
27
  "build": "tsc",
24
28
  "push": "npm run build && npm publish"
25
29
  }
@@ -0,0 +1,49 @@
1
+ export const _Event = `
2
+ type Event {
3
+ appVersion: String,
4
+ at: Float,
5
+ atForHumans: String,
6
+ device: String,
7
+ deviceModel: String,
8
+ osVersion: String,
9
+ user: String,
10
+ userEmail: String
11
+ }
12
+ `
13
+
14
+ export const _EventInput = `
15
+ input EventInput {
16
+ appVersion: String,
17
+ at: Float,
18
+ atForHumans: String,
19
+ device: String,
20
+ deviceModel: String,
21
+ osVersion: String,
22
+ user: String,
23
+ userEmail: String
24
+ }
25
+ `;
26
+
27
+ export const _Events = `
28
+ type Events {
29
+ started: Event,
30
+ updated: Event,
31
+ upgraded: Event,
32
+ processed: Event,
33
+ submitted: Event,
34
+ discarded: Event,
35
+ }
36
+ `;
37
+
38
+ export const _EventsInput = `
39
+ input EventsInput {
40
+ started: EventInput,
41
+ updated: EventInput,
42
+ upgraded: EventInput,
43
+ processed: EventInput,
44
+ submitted: EventInput,
45
+ discarded: EventInput,
46
+ }
47
+ `;
48
+
49
+ export const _AllEventFields = `{appVersion, at, atForHumans, device, deviceModel, osVersion, user, userEmail}`;
@@ -0,0 +1,49 @@
1
+ export const _FormInput = `
2
+
3
+ input ParamInput {
4
+ name: String
5
+ value: String
6
+ }
7
+
8
+ input FormInput {
9
+ id: ID
10
+ name: String
11
+ key: String
12
+ definition: String
13
+ version: String
14
+ status: String
15
+ updated: String
16
+ params: [ParamInput]
17
+ resources: String
18
+ body: String
19
+ }
20
+ `;
21
+
22
+ export const _Form = `
23
+
24
+ type Param {
25
+ name: String
26
+ value: String
27
+ }
28
+
29
+ type Form {
30
+ id: ID
31
+ name: String
32
+ key: String
33
+ definition: String
34
+ version: String
35
+ status: String
36
+ updated: String
37
+ params: [Param]
38
+ resources: String
39
+ body: String
40
+ }
41
+ `;
42
+
43
+ export const _FormFilter = `
44
+ input FormFilter {
45
+ status: String
46
+ }
47
+ `;
48
+
49
+ export const _AllFormFields = `{id, name, key, definition, status, updated, params {name, value}, resources, body}`;
@@ -0,0 +1,17 @@
1
+ export const _OrganisationInput = `
2
+ input OrganisationInput {
3
+ id: ID
4
+ name: String
5
+ logoUrl: String
6
+ }
7
+ `;
8
+
9
+ export const _Organisation = `
10
+ type Organisation {
11
+ id: ID
12
+ name: String
13
+ logoUrl: String
14
+ }
15
+ `;
16
+
17
+ export const _AllOrganisationFields = `{id, name, logoUrl}`;
@@ -0,0 +1,20 @@
1
+ export const _Roles = `
2
+ type Roles {
3
+ user: Boolean
4
+ admin: Boolean
5
+ api: Boolean
6
+ uber: Boolean
7
+ super: Boolean
8
+ legacyPush: Boolean
9
+ }
10
+ `;
11
+
12
+ export const _RolesInput = `
13
+ input RolesInput {
14
+ user: Boolean
15
+ admin: Boolean
16
+ api: Boolean
17
+ }
18
+ `;
19
+
20
+ export const _AllRolesFields = `{user, admin, api, uber, super, legacyPush}`;
@@ -0,0 +1,13 @@
1
+ export const _TaskIdentifiers = `
2
+ type TaskIdentifiers {
3
+ primary: String
4
+ secondary: String
5
+ }
6
+ `;
7
+
8
+ export const _TaskIdentifiersInput = `
9
+ input TaskIdentifiersInput {
10
+ primary: String
11
+ secondary: String
12
+ }
13
+ `;
@@ -0,0 +1,20 @@
1
+ export const _TaskOld = `
2
+ type Task {
3
+ id: ID,
4
+ name: String
5
+ definition: String
6
+ user: ID
7
+ userEmail: String
8
+ form: ID
9
+ organisation: ID
10
+ timestamps: TimeStamps
11
+ events: Events
12
+ template: TemplateInfo
13
+ identifiers: TaskIdentifiers
14
+ status: String
15
+ fails: [String]
16
+ reportUrl: String
17
+ data: String
18
+ refNo: String
19
+ }
20
+ `;
@@ -0,0 +1,61 @@
1
+ import * as Events from './events'
2
+
3
+ export const _Task = `
4
+ type Task {
5
+ collections: String
6
+ fields: String
7
+ info: TaskInfo
8
+ }
9
+ `;
10
+
11
+ export const _TaskInfo = `
12
+ type TaskInfo {
13
+ status: string
14
+ rootEntityId: string
15
+ id: string
16
+ refNo: number
17
+ name: string
18
+ events: Events
19
+ identifiers: TaskIdentifiers
20
+ template: TemplateInfo
21
+ userIds: String
22
+ users: String
23
+ timestamps: TimeStamps
24
+ }
25
+ `;
26
+
27
+ export const _TaskInput = `
28
+ input TaskInput {
29
+ collections: String
30
+ fields: String
31
+ info: TaskInfoInput
32
+ }
33
+ `;
34
+
35
+ export const _TaskInfoInput = `
36
+ input TaskInfoInput {
37
+ status: string
38
+ rootEntityId: string
39
+ id: string
40
+ refNo: number
41
+ name: string
42
+ events: EventInput
43
+ identifiers: TaskIdentifiersInput
44
+ template: TemplateInfoInput
45
+ userIds: String
46
+ users: String
47
+ timestamps: TimeStampsInput
48
+ }
49
+ `;
50
+
51
+ export const _TaskFilter = `
52
+ input TaskFilter {
53
+ users: [ID]
54
+ userEmails: [String]
55
+ forms: [ID]
56
+ after: String
57
+ before: String
58
+ },
59
+ `;
60
+
61
+ export const _AllTaskFields = `{collections, fields, info {status, id, rootEntityId, refNo, userIds, users, timestamps {started, updated, submitted, processed, upgraded, discarded}, events {started ${Events._AllEventFields}, updated ${Events._AllEventFields}, submitted ${Events._AllEventFields}, discarded ${Events._AllEventFields}, processed ${Events._AllEventFields}, upgraded ${Events._AllEventFields}}, template { name, shortName, type, id, version}, identifiers { primary, secondary}}}`;
@@ -0,0 +1,19 @@
1
+ export const _TemplateInfo = `
2
+ type TemplateInfo {
3
+ name: String,
4
+ shortName: String,
5
+ type: String,
6
+ id: String
7
+ version: String
8
+ }
9
+ `;
10
+
11
+ export const _TemplateInfoInput = `
12
+ input TemplateInfoInput {
13
+ name: String,
14
+ shortName: String,
15
+ type: String,
16
+ id: String
17
+ version: String
18
+ }
19
+ `;
@@ -0,0 +1,20 @@
1
+ export const _TimeStamps = `
2
+ type TimeStamps {
3
+ started: String,
4
+ updated: String,
5
+ discarded: String,
6
+ submitted: String,
7
+ processed: String,
8
+ upgraded: String
9
+ }
10
+ `;
11
+ export const _TimeStampsInput = `
12
+ input TimeStampsInput {
13
+ started: String,
14
+ updated: String,
15
+ discarded: String,
16
+ submitted: String,
17
+ processed: String,
18
+ upgraded: String
19
+ }
20
+ `;