@assemblis/contracts 0.0.3 → 0.0.5
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/dist/index.js +2 -18
- package/dist/schemas.js +145 -150
- package/dist/types.js +6 -9
- package/package.json +1 -1
- package/tsconfig.json +1 -5
package/dist/index.js
CHANGED
|
@@ -1,18 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./schemas"), exports);
|
|
18
|
-
__exportStar(require("./types"), exports);
|
|
1
|
+
export * from './schemas';
|
|
2
|
+
export * from './types';
|
package/dist/schemas.js
CHANGED
|
@@ -1,142 +1,137 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
var OptionSchema = (0, zod_1.object)({ label: (0, zod_1.string)(), value: zod_1.coerce.number().int() });
|
|
10
|
-
exports.UserSchema = {
|
|
11
|
-
payload: (0, zod_1.undefined)(),
|
|
12
|
-
response: (0, zod_1.object)({
|
|
13
|
-
id: (0, zod_1.string)().uuid(),
|
|
1
|
+
import { boolean, coerce, literal, number, object, record, string, unknown, undefined } from 'zod';
|
|
2
|
+
const coercedDate = coerce.date;
|
|
3
|
+
const maybe = (_) => _.nullish().transform((_) => _ ?? null);
|
|
4
|
+
const OptionSchema = object({ label: string(), value: coerce.number().int() });
|
|
5
|
+
export const UserSchema = {
|
|
6
|
+
payload: undefined(),
|
|
7
|
+
response: object({
|
|
8
|
+
id: string().uuid(),
|
|
14
9
|
created_at: coercedDate(),
|
|
15
10
|
updated_at: coercedDate(),
|
|
16
|
-
sub:
|
|
17
|
-
is_mutirao:
|
|
11
|
+
sub: string(),
|
|
12
|
+
is_mutirao: boolean()
|
|
18
13
|
})
|
|
19
14
|
};
|
|
20
15
|
// Surveys
|
|
21
|
-
|
|
22
|
-
id:
|
|
23
|
-
text:
|
|
16
|
+
const SurveyQuestionSchema = object({
|
|
17
|
+
id: string().uuid(),
|
|
18
|
+
text: string()
|
|
24
19
|
});
|
|
25
|
-
|
|
26
|
-
payload:
|
|
27
|
-
response:
|
|
28
|
-
id:
|
|
20
|
+
export const SurveySchema = {
|
|
21
|
+
payload: undefined(),
|
|
22
|
+
response: object({
|
|
23
|
+
id: string().uuid(),
|
|
29
24
|
created_at: coercedDate(),
|
|
30
25
|
updated_at: coercedDate(),
|
|
31
|
-
name:
|
|
32
|
-
sections:
|
|
26
|
+
name: string(),
|
|
27
|
+
sections: object({
|
|
33
28
|
primary: SurveyQuestionSchema,
|
|
34
29
|
secondary: SurveyQuestionSchema.array(),
|
|
35
30
|
options: OptionSchema.array()
|
|
36
31
|
}).array()
|
|
37
32
|
})
|
|
38
33
|
};
|
|
39
|
-
|
|
40
|
-
payload:
|
|
41
|
-
answers:
|
|
42
|
-
question_id:
|
|
43
|
-
answer_value:
|
|
34
|
+
export const SurveyResponseSchema = {
|
|
35
|
+
payload: object({
|
|
36
|
+
answers: object({
|
|
37
|
+
question_id: string().uuid(),
|
|
38
|
+
answer_value: coerce.number().int()
|
|
44
39
|
}).array()
|
|
45
40
|
}),
|
|
46
|
-
response:
|
|
47
|
-
total:
|
|
41
|
+
response: object({
|
|
42
|
+
total: number().int()
|
|
48
43
|
})
|
|
49
44
|
};
|
|
50
45
|
// Action Plans
|
|
51
|
-
|
|
52
|
-
visible_on_profile:
|
|
53
|
-
description: maybe(
|
|
46
|
+
const ActionPlanSchema = object({
|
|
47
|
+
visible_on_profile: boolean(),
|
|
48
|
+
description: maybe(string())
|
|
54
49
|
});
|
|
55
|
-
|
|
56
|
-
text:
|
|
57
|
-
agreed: maybe(
|
|
58
|
-
against: maybe(
|
|
59
|
-
abstained: maybe(
|
|
60
|
-
include_in_action_plan:
|
|
61
|
-
assembly_id:
|
|
50
|
+
const ActionSchema = object({
|
|
51
|
+
text: string(),
|
|
52
|
+
agreed: maybe(coerce.number().int()),
|
|
53
|
+
against: maybe(coerce.number().int()),
|
|
54
|
+
abstained: maybe(coerce.number().int()),
|
|
55
|
+
include_in_action_plan: boolean().default(true),
|
|
56
|
+
assembly_id: string().uuid()
|
|
62
57
|
});
|
|
63
|
-
|
|
64
|
-
text:
|
|
65
|
-
complete:
|
|
66
|
-
action_id:
|
|
67
|
-
assembly_id:
|
|
58
|
+
const TaskSchema = object({
|
|
59
|
+
text: string(),
|
|
60
|
+
complete: boolean().default(false),
|
|
61
|
+
action_id: string().uuid(),
|
|
62
|
+
assembly_id: string().uuid()
|
|
68
63
|
});
|
|
69
64
|
// Assembly Overviews
|
|
70
|
-
|
|
65
|
+
const BaseAssemblyOverviewSchema = object({
|
|
71
66
|
published_at: maybe(coercedDate()),
|
|
72
|
-
name:
|
|
73
|
-
about: maybe(
|
|
74
|
-
topics:
|
|
75
|
-
country: maybe(
|
|
76
|
-
hide:
|
|
67
|
+
name: string(),
|
|
68
|
+
about: maybe(string()),
|
|
69
|
+
topics: string().array(),
|
|
70
|
+
country: maybe(string()),
|
|
71
|
+
hide: boolean().default(false)
|
|
77
72
|
});
|
|
78
|
-
|
|
73
|
+
export const AssemblyOverviewSchema = {
|
|
79
74
|
payload: BaseAssemblyOverviewSchema,
|
|
80
75
|
response: BaseAssemblyOverviewSchema.extend({
|
|
81
|
-
id:
|
|
76
|
+
id: string().uuid(),
|
|
82
77
|
created_at: coercedDate(),
|
|
83
78
|
updated_at: coercedDate(),
|
|
84
|
-
has_image:
|
|
85
|
-
image_src: maybe(
|
|
79
|
+
has_image: boolean(),
|
|
80
|
+
image_src: maybe(string())
|
|
86
81
|
})
|
|
87
82
|
};
|
|
88
|
-
|
|
89
|
-
payload:
|
|
90
|
-
response:
|
|
91
|
-
assemblies:
|
|
83
|
+
export const AssembliesListSchema = {
|
|
84
|
+
payload: undefined(),
|
|
85
|
+
response: object({
|
|
86
|
+
assemblies: AssemblyOverviewSchema.response.array()
|
|
92
87
|
})
|
|
93
88
|
};
|
|
94
89
|
// Assembly Details
|
|
95
|
-
|
|
96
|
-
visible_on_profile:
|
|
97
|
-
name: maybe(
|
|
98
|
-
description: maybe(
|
|
99
|
-
type: maybe(
|
|
90
|
+
const OrganisationSchema = object({
|
|
91
|
+
visible_on_profile: boolean(),
|
|
92
|
+
name: maybe(string()),
|
|
93
|
+
description: maybe(string()),
|
|
94
|
+
type: maybe(string())
|
|
100
95
|
});
|
|
101
|
-
|
|
102
|
-
visible_on_profile:
|
|
103
|
-
registration_link: maybe(
|
|
96
|
+
const EventDetailsSchema = object({
|
|
97
|
+
visible_on_profile: boolean(),
|
|
98
|
+
registration_link: maybe(string()),
|
|
104
99
|
start_date: maybe(coercedDate())
|
|
105
100
|
});
|
|
106
|
-
|
|
107
|
-
visible_on_profile:
|
|
108
|
-
background: maybe(
|
|
101
|
+
const StorySchema = object({
|
|
102
|
+
visible_on_profile: boolean(),
|
|
103
|
+
background: maybe(string())
|
|
109
104
|
});
|
|
110
|
-
|
|
111
|
-
visible_on_profile:
|
|
112
|
-
organisation_types:
|
|
113
|
-
description: maybe(
|
|
105
|
+
const SupportersSchema = object({
|
|
106
|
+
visible_on_profile: boolean(),
|
|
107
|
+
organisation_types: string().array(),
|
|
108
|
+
description: maybe(string())
|
|
114
109
|
});
|
|
115
|
-
|
|
116
|
-
visible_on_profile:
|
|
117
|
-
organisation_types:
|
|
118
|
-
description: maybe(
|
|
110
|
+
const FundersSchema = object({
|
|
111
|
+
visible_on_profile: boolean(),
|
|
112
|
+
organisation_types: string().array(),
|
|
113
|
+
description: maybe(string())
|
|
119
114
|
});
|
|
120
|
-
|
|
121
|
-
visible_on_profile:
|
|
122
|
-
decision_method: maybe(
|
|
115
|
+
const FacilitationSchema = object({
|
|
116
|
+
visible_on_profile: boolean(),
|
|
117
|
+
decision_method: maybe(string())
|
|
123
118
|
});
|
|
124
|
-
|
|
125
|
-
visible_on_profile:
|
|
126
|
-
recruitment_method: maybe(
|
|
127
|
-
community: maybe(
|
|
119
|
+
const ParticipantsSchema = object({
|
|
120
|
+
visible_on_profile: boolean(),
|
|
121
|
+
recruitment_method: maybe(string()),
|
|
122
|
+
community: maybe(string())
|
|
128
123
|
});
|
|
129
|
-
|
|
130
|
-
visible_on_profile:
|
|
131
|
-
support_options:
|
|
124
|
+
const SupportSchema = object({
|
|
125
|
+
visible_on_profile: boolean(),
|
|
126
|
+
support_options: string().array()
|
|
132
127
|
});
|
|
133
|
-
|
|
134
|
-
visible_on_profile:
|
|
128
|
+
const SurveyDetailsSchema = object({
|
|
129
|
+
visible_on_profile: boolean()
|
|
135
130
|
});
|
|
136
|
-
|
|
137
|
-
payload:
|
|
131
|
+
export const AssemblyDetailSchema = {
|
|
132
|
+
payload: AssemblyOverviewSchema.payload.extend({
|
|
138
133
|
organisation: maybe(OrganisationSchema.extend({
|
|
139
|
-
id:
|
|
134
|
+
id: string().uuid().optional()
|
|
140
135
|
})),
|
|
141
136
|
event_details: maybe(EventDetailsSchema),
|
|
142
137
|
story: maybe(StorySchema),
|
|
@@ -148,26 +143,26 @@ exports.AssemblyDetailSchema = {
|
|
|
148
143
|
action_plan: maybe(ActionPlanSchema.extend({
|
|
149
144
|
actions: ActionSchema.omit({ assembly_id: true })
|
|
150
145
|
.extend({
|
|
151
|
-
id:
|
|
146
|
+
id: string().uuid().optional(),
|
|
152
147
|
tasks: TaskSchema.omit({
|
|
153
148
|
action_id: true,
|
|
154
149
|
assembly_id: true
|
|
155
150
|
})
|
|
156
151
|
.extend({
|
|
157
|
-
id:
|
|
152
|
+
id: string().uuid().optional()
|
|
158
153
|
})
|
|
159
154
|
.array(),
|
|
160
|
-
updates:
|
|
155
|
+
updates: unknown().array()
|
|
161
156
|
})
|
|
162
157
|
.array(),
|
|
163
|
-
updates:
|
|
158
|
+
updates: unknown().array()
|
|
164
159
|
})),
|
|
165
160
|
surveys: maybe(SurveyDetailsSchema)
|
|
166
161
|
}),
|
|
167
|
-
response:
|
|
168
|
-
is_own:
|
|
162
|
+
response: AssemblyOverviewSchema.response.extend({
|
|
163
|
+
is_own: boolean(),
|
|
169
164
|
organisation: maybe(OrganisationSchema.extend({
|
|
170
|
-
id:
|
|
165
|
+
id: string().uuid(),
|
|
171
166
|
created_at: coercedDate(),
|
|
172
167
|
updated_at: coercedDate()
|
|
173
168
|
})),
|
|
@@ -202,7 +197,7 @@ exports.AssemblyDetailSchema = {
|
|
|
202
197
|
action_plan: maybe(ActionPlanSchema.extend({
|
|
203
198
|
actions: ActionSchema.omit({ assembly_id: true })
|
|
204
199
|
.extend({
|
|
205
|
-
id:
|
|
200
|
+
id: string().uuid(),
|
|
206
201
|
created_at: coercedDate(),
|
|
207
202
|
updated_at: coercedDate(),
|
|
208
203
|
tasks: TaskSchema.omit({
|
|
@@ -210,20 +205,20 @@ exports.AssemblyDetailSchema = {
|
|
|
210
205
|
assembly_id: true
|
|
211
206
|
})
|
|
212
207
|
.extend({
|
|
213
|
-
id:
|
|
208
|
+
id: string().uuid(),
|
|
214
209
|
created_at: coercedDate(),
|
|
215
210
|
updated_at: coercedDate()
|
|
216
211
|
})
|
|
217
212
|
.array(),
|
|
218
|
-
updates:
|
|
213
|
+
updates: unknown().array()
|
|
219
214
|
})
|
|
220
215
|
.extend({
|
|
221
216
|
created_at: coercedDate(),
|
|
222
217
|
updated_at: coercedDate()
|
|
223
218
|
})
|
|
224
219
|
.array(),
|
|
225
|
-
updates:
|
|
226
|
-
}).and(
|
|
220
|
+
updates: unknown().array()
|
|
221
|
+
}).and(object({
|
|
227
222
|
created_at: coercedDate(),
|
|
228
223
|
updated_at: coercedDate()
|
|
229
224
|
}))),
|
|
@@ -231,67 +226,67 @@ exports.AssemblyDetailSchema = {
|
|
|
231
226
|
created_at: coercedDate(),
|
|
232
227
|
updated_at: coercedDate()
|
|
233
228
|
}).extend({
|
|
234
|
-
data:
|
|
235
|
-
total:
|
|
236
|
-
responses:
|
|
229
|
+
data: record(string(), object({
|
|
230
|
+
total: number().int(),
|
|
231
|
+
responses: record(string(), OptionSchema.array())
|
|
237
232
|
}))
|
|
238
233
|
}))
|
|
239
234
|
})
|
|
240
235
|
};
|
|
241
|
-
|
|
242
|
-
payload:
|
|
243
|
-
route:
|
|
244
|
-
text:
|
|
245
|
-
metadata:
|
|
236
|
+
export const FeedbackSchema = {
|
|
237
|
+
payload: object({
|
|
238
|
+
route: string(),
|
|
239
|
+
text: string(),
|
|
240
|
+
metadata: unknown()
|
|
246
241
|
}),
|
|
247
|
-
response:
|
|
242
|
+
response: string()
|
|
248
243
|
};
|
|
249
|
-
|
|
250
|
-
payload:
|
|
251
|
-
message:
|
|
252
|
-
data:
|
|
253
|
-
metadata:
|
|
254
|
-
origin:
|
|
255
|
-
route:
|
|
256
|
-
status:
|
|
244
|
+
export const LogSchema = {
|
|
245
|
+
payload: object({
|
|
246
|
+
message: string().optional(),
|
|
247
|
+
data: record(string(), string().optional()).optional(),
|
|
248
|
+
metadata: object({
|
|
249
|
+
origin: string(),
|
|
250
|
+
route: string(),
|
|
251
|
+
status: number()
|
|
257
252
|
})
|
|
258
253
|
}),
|
|
259
|
-
response:
|
|
254
|
+
response: string()
|
|
260
255
|
};
|
|
261
|
-
|
|
262
|
-
payload:
|
|
263
|
-
type:
|
|
264
|
-
object:
|
|
265
|
-
data:
|
|
266
|
-
id:
|
|
267
|
-
email_addresses:
|
|
268
|
-
email_address:
|
|
256
|
+
export const RegisterSchema = {
|
|
257
|
+
payload: object({
|
|
258
|
+
type: literal('user.created'),
|
|
259
|
+
object: literal('event'),
|
|
260
|
+
data: object({
|
|
261
|
+
id: string(),
|
|
262
|
+
email_addresses: object({
|
|
263
|
+
email_address: string()
|
|
269
264
|
}).array()
|
|
270
265
|
})
|
|
271
266
|
}),
|
|
272
|
-
response:
|
|
267
|
+
response: string()
|
|
273
268
|
};
|
|
274
|
-
|
|
275
|
-
payload:
|
|
276
|
-
country:
|
|
277
|
-
email:
|
|
278
|
-
text: maybe(
|
|
269
|
+
export const PinSchema = {
|
|
270
|
+
payload: object({
|
|
271
|
+
country: string(),
|
|
272
|
+
email: string(),
|
|
273
|
+
text: maybe(string())
|
|
279
274
|
}),
|
|
280
|
-
response:
|
|
281
|
-
id:
|
|
275
|
+
response: object({
|
|
276
|
+
id: string().uuid(),
|
|
282
277
|
created_at: coercedDate(),
|
|
283
278
|
updated_at: coercedDate(),
|
|
284
|
-
country:
|
|
285
|
-
text: maybe(
|
|
286
|
-
hide:
|
|
287
|
-
has_image:
|
|
288
|
-
image_src: maybe(
|
|
279
|
+
country: string(),
|
|
280
|
+
text: maybe(string()),
|
|
281
|
+
hide: boolean(),
|
|
282
|
+
has_image: boolean(),
|
|
283
|
+
image_src: maybe(string())
|
|
289
284
|
})
|
|
290
285
|
};
|
|
291
|
-
|
|
292
|
-
payload:
|
|
293
|
-
response:
|
|
294
|
-
assemblies:
|
|
295
|
-
pins:
|
|
286
|
+
export const PinListSchema = {
|
|
287
|
+
payload: undefined(),
|
|
288
|
+
response: object({
|
|
289
|
+
assemblies: AssemblyOverviewSchema.response.array(),
|
|
290
|
+
pins: PinSchema.response.array()
|
|
296
291
|
})
|
|
297
292
|
};
|
package/dist/types.js
CHANGED
|
@@ -1,19 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Endpoint = exports.RouteParameters = exports.Method = void 0;
|
|
4
|
-
var Method;
|
|
1
|
+
export var Method;
|
|
5
2
|
(function (Method) {
|
|
6
3
|
Method["GET"] = "GET";
|
|
7
4
|
Method["POST"] = "POST";
|
|
8
5
|
Method["PUT"] = "PUT";
|
|
9
6
|
Method["PATCH"] = "PATCH";
|
|
10
|
-
})(Method || (
|
|
11
|
-
var RouteParameters;
|
|
7
|
+
})(Method || (Method = {}));
|
|
8
|
+
export var RouteParameters;
|
|
12
9
|
(function (RouteParameters) {
|
|
13
10
|
RouteParameters["ID"] = ":ID";
|
|
14
11
|
RouteParameters["NAME"] = ":NAME";
|
|
15
|
-
})(RouteParameters || (
|
|
16
|
-
var Endpoint;
|
|
12
|
+
})(RouteParameters || (RouteParameters = {}));
|
|
13
|
+
export var Endpoint;
|
|
17
14
|
(function (Endpoint) {
|
|
18
15
|
Endpoint["ASSEMBLIES"] = "/assemblies";
|
|
19
16
|
Endpoint["FEEDBACK"] = "/feedback";
|
|
@@ -23,4 +20,4 @@ var Endpoint;
|
|
|
23
20
|
Endpoint["PINS"] = "/pins";
|
|
24
21
|
Endpoint["SURVEYS"] = "/surveys";
|
|
25
22
|
Endpoint["SURVEY_RESPONSES"] = "/assemblies/:ID/survey-responses/:NAME";
|
|
26
|
-
})(Endpoint || (
|
|
23
|
+
})(Endpoint || (Endpoint = {}));
|
package/package.json
CHANGED
package/tsconfig.json
CHANGED