@assemblis/contracts 0.0.11 → 0.0.12

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 CHANGED
@@ -1 +1 @@
1
- import e from"zod";const t=e=>e.nullish().transform(e=>e??null),a=e.object({label:e.string(),value:e.coerce.number().int()}),r={payload:e.undefined(),response:e.object({id:e.string().uuid(),created_at:e.coerce.date(),updated_at:e.coerce.date(),sub:e.string(),is_mutirao:e.boolean()})},o=e.object({id:e.string().uuid(),text:e.string()}),n={payload:e.undefined(),response:e.object({id:e.string().uuid(),created_at:e.coerce.date(),updated_at:e.coerce.date(),name:e.string(),sections:e.object({primary:o,secondary:o.array(),options:a.array()}).array()})},i={payload:e.object({answers:e.object({question_id:e.string().uuid(),answer_value:e.coerce.number().int()}).array()}),response:e.object({total:e.number().int()})},s=e.object({visible_on_profile:e.boolean(),description:t(e.string())}),d=e.object({text:e.string(),agreed:t(e.coerce.number().int()),against:t(e.coerce.number().int()),abstained:t(e.coerce.number().int()),include_in_action_plan:e.boolean().default(!0),assembly_id:e.string().uuid()}),c=e.object({text:e.string(),complete:e.boolean().default(!1),action_id:e.string().uuid(),assembly_id:e.string().uuid()}),u=e.object({published_at:t(e.coerce.date()),name:e.string(),about:t(e.string()),topics:e.string().array(),country:t(e.string()),hide:e.boolean().default(!1)}),p={payload:u,response:u.extend({id:e.string().uuid(),created_at:e.coerce.date(),updated_at:e.coerce.date(),has_image:e.boolean(),image_src:t(e.string())})},l={payload:e.undefined(),response:e.object({assemblies:p.response.array()})},_=e.object({visible_on_profile:e.boolean(),name:t(e.string()),description:t(e.string()),type:t(e.string())}),b=e.object({visible_on_profile:e.boolean(),registration_link:t(e.string()),start_date:t(e.coerce.date())}),g=e.object({visible_on_profile:e.boolean(),background:t(e.string())}),y=e.object({visible_on_profile:e.boolean(),organisation_types:e.string().array(),description:t(e.string())}),m=e.object({visible_on_profile:e.boolean(),organisation_types:e.string().array(),description:t(e.string())}),j=e.object({visible_on_profile:e.boolean(),decision_method:t(e.string())}),f=e.object({visible_on_profile:e.boolean(),recruitment_method:t(e.string()),community:t(e.string())}),x=e.object({visible_on_profile:e.boolean(),support_options:e.string().array()}),E=e.object({visible_on_profile:e.boolean()}),S={payload:p.payload.extend({organisation:t(_.extend({id:e.string().uuid().optional()})),event_details:t(b),story:t(g),supporters:t(y),funders:t(m),facilitation:t(j),participants:t(f),support:t(x),action_plan:t(s.extend({actions:d.omit({assembly_id:!0}).extend({id:e.string().uuid().optional(),tasks:c.omit({action_id:!0,assembly_id:!0}).extend({id:e.string().uuid().optional()}).array(),updates:e.unknown().array()}).array(),updates:e.unknown().array()})),surveys:t(E)}),response:p.response.extend({is_own:e.boolean(),organisation:t(_.extend({id:e.string().uuid(),created_at:e.coerce.date(),updated_at:e.coerce.date()})),event_details:t(b.extend({created_at:e.coerce.date(),updated_at:e.coerce.date()})),story:t(g.extend({created_at:e.coerce.date(),updated_at:e.coerce.date()})),supporters:t(y.extend({created_at:e.coerce.date(),updated_at:e.coerce.date()})),funders:t(m.extend({created_at:e.coerce.date(),updated_at:e.coerce.date()})),facilitation:t(j.extend({created_at:e.coerce.date(),updated_at:e.coerce.date()})),participants:t(f.extend({created_at:e.coerce.date(),updated_at:e.coerce.date()})),support:t(x.extend({created_at:e.coerce.date(),updated_at:e.coerce.date()})),action_plan:t(s.extend({actions:d.omit({assembly_id:!0}).extend({id:e.string().uuid(),created_at:e.coerce.date(),updated_at:e.coerce.date(),tasks:c.omit({action_id:!0,assembly_id:!0}).extend({id:e.string().uuid(),created_at:e.coerce.date(),updated_at:e.coerce.date()}).array(),updates:e.unknown().array()}).extend({created_at:e.coerce.date(),updated_at:e.coerce.date()}).array(),updates:e.unknown().array()}).and(e.object({created_at:e.coerce.date(),updated_at:e.coerce.date()}))),surveys:t(E.extend({created_at:e.coerce.date(),updated_at:e.coerce.date()}).extend({data:e.record(e.string(),e.object({total:e.number().int(),responses:e.record(e.string(),a.array())}))}))})},v={payload:e.object({route:e.string(),text:e.string(),metadata:e.unknown()}),response:e.string()},T={payload:e.object({message:e.string().optional(),data:e.record(e.string(),e.string().optional()).optional(),metadata:e.object({origin:e.string(),route:e.string(),status:e.number()})}),response:e.string()},A={payload:e.object({type:e.literal("user.created"),object:e.literal("event"),data:e.object({id:e.string(),email_addresses:e.object({email_address:e.string()}).array()})}),response:e.string()},I={payload:e.object({country:e.string(),email:e.string(),text:t(e.string())}),response:e.object({id:e.string().uuid(),created_at:e.coerce.date(),updated_at:e.coerce.date(),country:e.string(),text:t(e.string()),hide:e.boolean(),has_image:e.boolean(),image_src:t(e.string())})},P={payload:e.undefined(),response:e.object({assemblies:p.response.array(),pins:I.response.array()})};var k,h,M,R;!function(e){e.GET="GET",e.POST="POST",e.PUT="PUT",e.PATCH="PATCH"}(k||(k={})),function(e){e.ID=":ID",e.NAME=":NAME"}(h||(h={})),function(e){e.ASSEMBLIES="/assemblies",e.FEEDBACK="/feedback",e.INTEREST_ASSEMBLIS="/interest/assemblis",e.INTEREST_MUTIRAO="/interest/mutirao",e.LOGS="/logs",e.PINS="/pins",e.SURVEYS="/surveys",e.SURVEY_RESPONSES="/assemblies/:ID/survey-responses/:NAME"}(M||(M={})),function(e){e.DELIBERATION="deliberation",e.DEMOGRAPHIC_DATA="demographic-data",e.PRE_ASSEMBLY="pre-assembly",e.POST_ASSEMBLY="post-assembly"}(R||(R={}));export{M as ApiEndpoint,k as ApiRestMethod,h as ApiRouteParameter,l as AssembliesListSchema,S as AssemblyDetailSchema,p as AssemblyOverviewSchema,v as FeedbackSchema,T as LogSchema,P as PinListSchema,I as PinSchema,A as RegisterSchema,R as SurveyName,i as SurveyResponseSchema,n as SurveySchema,r as UserSchema};
1
+ import e from"zod";const t=e=>e.nullish().transform(e=>e??null),a=e.object({label:e.string(),value:e.coerce.number().int()}),o={payload:e.undefined(),response:e.object({id:e.uuid(),created_at:e.coerce.date(),updated_at:e.coerce.date(),sub:e.string(),is_mutirao:e.boolean()})},r=e.object({id:e.uuid(),text:e.string()}),n={payload:e.undefined(),response:e.object({id:e.uuid(),created_at:e.coerce.date(),updated_at:e.coerce.date(),name:e.string(),sections:e.object({primary:r,secondary:r.array(),options:a.array()}).array()})},i={payload:e.object({answers:e.object({question_id:e.uuid(),answer_value:e.coerce.number().int()}).array()}),response:e.object({total:e.number().int()})},d=e.object({visible_on_profile:e.boolean(),description:t(e.string())}),s=e.object({text:e.string(),agreed:t(e.coerce.number().int()),against:t(e.coerce.number().int()),abstained:t(e.coerce.number().int()),include_in_action_plan:e.boolean().default(!0),assembly_id:e.uuid()}),c=e.object({text:e.string(),complete:e.boolean().default(!1),action_id:e.uuid(),assembly_id:e.uuid()}),u=e.object({published_at:t(e.coerce.date()),name:e.string(),about:t(e.string()),topics:e.string().array(),country:t(e.string()),hide:e.boolean().default(!1)}),p={payload:u,response:u.extend({id:e.uuid(),created_at:e.coerce.date(),updated_at:e.coerce.date(),has_image:e.boolean(),image_src:t(e.string()),user_id:e.uuid()})},l={payload:e.undefined(),response:e.object({assemblies:p.response.array()})},_=e.object({visible_on_profile:e.boolean(),name:t(e.string()),description:t(e.string()),type:t(e.string())}),b=e.object({visible_on_profile:e.boolean(),registration_link:t(e.string()),start_date:t(e.coerce.date())}),g=e.object({visible_on_profile:e.boolean(),background:t(e.string())}),y=e.object({visible_on_profile:e.boolean(),organisation_types:e.string().array(),description:t(e.string())}),m=e.object({visible_on_profile:e.boolean(),organisation_types:e.string().array(),description:t(e.string())}),j=e.object({visible_on_profile:e.boolean(),decision_method:t(e.string())}),f=e.object({visible_on_profile:e.boolean(),recruitment_method:t(e.string()),community:t(e.string())}),x=e.object({visible_on_profile:e.boolean(),support_options:e.string().array()}),E=e.object({visible_on_profile:e.boolean()}),S={payload:p.payload.extend({organisation:t(_.extend({id:e.uuid().optional()})),event_details:t(b),story:t(g),supporters:t(y),funders:t(m),facilitation:t(j),participants:t(f),support:t(x),action_plan:t(d.extend({actions:s.omit({assembly_id:!0}).extend({id:e.uuid().optional(),tasks:c.omit({action_id:!0,assembly_id:!0}).extend({id:e.uuid().optional()}).array(),updates:e.unknown().array()}).array(),updates:e.unknown().array()})),surveys:t(E)}),response:p.response.omit({user_id:!0}).extend({is_own:e.boolean(),organisation:t(_.extend({id:e.uuid(),created_at:e.coerce.date(),updated_at:e.coerce.date()})),event_details:t(b.extend({created_at:e.coerce.date(),updated_at:e.coerce.date()})),story:t(g.extend({created_at:e.coerce.date(),updated_at:e.coerce.date()})),supporters:t(y.extend({created_at:e.coerce.date(),updated_at:e.coerce.date()})),funders:t(m.extend({created_at:e.coerce.date(),updated_at:e.coerce.date()})),facilitation:t(j.extend({created_at:e.coerce.date(),updated_at:e.coerce.date()})),participants:t(f.extend({created_at:e.coerce.date(),updated_at:e.coerce.date()})),support:t(x.extend({created_at:e.coerce.date(),updated_at:e.coerce.date()})),action_plan:t(d.extend({actions:s.omit({assembly_id:!0}).extend({id:e.uuid(),created_at:e.coerce.date(),updated_at:e.coerce.date(),tasks:c.omit({action_id:!0,assembly_id:!0}).extend({id:e.uuid(),created_at:e.coerce.date(),updated_at:e.coerce.date()}).array(),updates:e.unknown().array()}).extend({created_at:e.coerce.date(),updated_at:e.coerce.date()}).array(),updates:e.unknown().array()}).and(e.object({created_at:e.coerce.date(),updated_at:e.coerce.date()}))),surveys:t(E.extend({created_at:e.coerce.date(),updated_at:e.coerce.date()}).extend({data:e.record(e.string(),e.object({total:e.number().int(),responses:e.record(e.string(),a.array())}))}))})},v={payload:e.object({route:e.string(),text:e.string(),metadata:e.unknown()}),response:e.string()},T={payload:e.object({message:e.string().optional(),data:e.record(e.string(),e.string().optional()).optional(),metadata:e.object({origin:e.string(),route:e.string(),status:e.number()})}),response:e.string()},A={payload:e.object({type:e.literal("user.created"),object:e.literal("event"),data:e.object({id:e.string(),email_addresses:e.object({email_address:e.string()}).array()})}),response:e.string()},I={payload:e.object({country:e.string(),email:e.string(),text:t(e.string())}),response:e.object({id:e.uuid(),created_at:e.coerce.date(),updated_at:e.coerce.date(),country:e.string(),text:t(e.string()),hide:e.boolean(),has_image:e.boolean(),image_src:t(e.string())})},P={payload:e.undefined(),response:e.object({assemblies:p.response.array(),pins:I.response.array()})};var k,h,M,R;!function(e){e.GET="GET",e.POST="POST",e.PUT="PUT",e.PATCH="PATCH"}(k||(k={})),function(e){e.ID=":ID",e.NAME=":NAME"}(h||(h={})),function(e){e.ASSEMBLIES="/assemblies",e.FEEDBACK="/feedback",e.INTEREST_ASSEMBLIS="/interest/assemblis",e.INTEREST_MUTIRAO="/interest/mutirao",e.LOGS="/logs",e.PINS="/pins",e.SURVEYS="/surveys",e.SURVEY_RESPONSES="/assemblies/:ID/survey-responses/:NAME"}(M||(M={})),function(e){e.DELIBERATION="deliberation",e.DEMOGRAPHIC_DATA="demographic-data",e.PRE_ASSEMBLY="pre-assembly",e.POST_ASSEMBLY="post-assembly"}(R||(R={}));export{M as ApiEndpoint,k as ApiRestMethod,h as ApiRouteParameter,l as AssembliesListSchema,S as AssemblyDetailSchema,p as AssemblyOverviewSchema,v as FeedbackSchema,T as LogSchema,P as PinListSchema,I as PinSchema,A as RegisterSchema,R as SurveyName,i as SurveyResponseSchema,n as SurveySchema,o as UserSchema};
package/dist/schemas.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- import z from "zod";
1
+ import z from 'zod';
2
2
  export declare const UserSchema: {
3
3
  payload: z.ZodUndefined;
4
4
  response: z.ZodObject<{
5
- id: z.ZodString;
5
+ id: z.ZodUUID;
6
6
  created_at: z.ZodCoercedDate<unknown>;
7
7
  updated_at: z.ZodCoercedDate<unknown>;
8
8
  sub: z.ZodString;
@@ -12,17 +12,17 @@ export declare const UserSchema: {
12
12
  export declare const SurveySchema: {
13
13
  payload: z.ZodUndefined;
14
14
  response: z.ZodObject<{
15
- id: z.ZodString;
15
+ id: z.ZodUUID;
16
16
  created_at: z.ZodCoercedDate<unknown>;
17
17
  updated_at: z.ZodCoercedDate<unknown>;
18
18
  name: z.ZodString;
19
19
  sections: z.ZodArray<z.ZodObject<{
20
20
  primary: z.ZodObject<{
21
- id: z.ZodString;
21
+ id: z.ZodUUID;
22
22
  text: z.ZodString;
23
23
  }, z.core.$strip>;
24
24
  secondary: z.ZodArray<z.ZodObject<{
25
- id: z.ZodString;
25
+ id: z.ZodUUID;
26
26
  text: z.ZodString;
27
27
  }, z.core.$strip>>;
28
28
  options: z.ZodArray<z.ZodObject<{
@@ -35,7 +35,7 @@ export declare const SurveySchema: {
35
35
  export declare const SurveyResponseSchema: {
36
36
  payload: z.ZodObject<{
37
37
  answers: z.ZodArray<z.ZodObject<{
38
- question_id: z.ZodString;
38
+ question_id: z.ZodUUID;
39
39
  answer_value: z.ZodCoercedNumber<unknown>;
40
40
  }, z.core.$strip>>;
41
41
  }, z.core.$strip>;
@@ -59,11 +59,12 @@ export declare const AssemblyOverviewSchema: {
59
59
  topics: z.ZodArray<z.ZodString>;
60
60
  country: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | null, string | null | undefined>>;
61
61
  hide: z.ZodDefault<z.ZodBoolean>;
62
- id: z.ZodString;
62
+ id: z.ZodUUID;
63
63
  created_at: z.ZodCoercedDate<unknown>;
64
64
  updated_at: z.ZodCoercedDate<unknown>;
65
65
  has_image: z.ZodBoolean;
66
66
  image_src: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | null, string | null | undefined>>;
67
+ user_id: z.ZodUUID;
67
68
  }, z.core.$strip>;
68
69
  };
69
70
  export declare const AssembliesListSchema: {
@@ -76,11 +77,12 @@ export declare const AssembliesListSchema: {
76
77
  topics: z.ZodArray<z.ZodString>;
77
78
  country: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | null, string | null | undefined>>;
78
79
  hide: z.ZodDefault<z.ZodBoolean>;
79
- id: z.ZodString;
80
+ id: z.ZodUUID;
80
81
  created_at: z.ZodCoercedDate<unknown>;
81
82
  updated_at: z.ZodCoercedDate<unknown>;
82
83
  has_image: z.ZodBoolean;
83
84
  image_src: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | null, string | null | undefined>>;
85
+ user_id: z.ZodUUID;
84
86
  }, z.core.$strip>>;
85
87
  }, z.core.$strip>;
86
88
  };
@@ -97,7 +99,7 @@ export declare const AssemblyDetailSchema: {
97
99
  name: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | null, string | null | undefined>>;
98
100
  description: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | null, string | null | undefined>>;
99
101
  type: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | null, string | null | undefined>>;
100
- id: z.ZodOptional<z.ZodString>;
102
+ id: z.ZodOptional<z.ZodUUID>;
101
103
  }, z.core.$strip>>>, z.ZodTransform<{
102
104
  visible_on_profile: boolean;
103
105
  name: string | null;
@@ -202,11 +204,11 @@ export declare const AssemblyDetailSchema: {
202
204
  against: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>, z.ZodTransform<number | null, number | null | undefined>>;
203
205
  abstained: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>, z.ZodTransform<number | null, number | null | undefined>>;
204
206
  include_in_action_plan: z.ZodDefault<z.ZodBoolean>;
205
- id: z.ZodOptional<z.ZodString>;
207
+ id: z.ZodOptional<z.ZodUUID>;
206
208
  tasks: z.ZodArray<z.ZodObject<{
207
209
  text: z.ZodString;
208
210
  complete: z.ZodDefault<z.ZodBoolean>;
209
- id: z.ZodOptional<z.ZodString>;
211
+ id: z.ZodOptional<z.ZodUUID>;
210
212
  }, z.core.$strip>>;
211
213
  updates: z.ZodArray<z.ZodUnknown>;
212
214
  }, z.core.$strip>>;
@@ -257,15 +259,15 @@ export declare const AssemblyDetailSchema: {
257
259
  } | null | undefined>>;
258
260
  }, z.core.$strip>;
259
261
  response: z.ZodObject<{
260
- published_at: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>, z.ZodTransform<Date | null, Date | null | undefined>>;
262
+ id: z.ZodUUID;
263
+ created_at: z.ZodCoercedDate<unknown>;
264
+ updated_at: z.ZodCoercedDate<unknown>;
261
265
  name: z.ZodString;
266
+ published_at: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>, z.ZodTransform<Date | null, Date | null | undefined>>;
262
267
  about: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | null, string | null | undefined>>;
263
268
  topics: z.ZodArray<z.ZodString>;
264
269
  country: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | null, string | null | undefined>>;
265
270
  hide: z.ZodDefault<z.ZodBoolean>;
266
- id: z.ZodString;
267
- created_at: z.ZodCoercedDate<unknown>;
268
- updated_at: z.ZodCoercedDate<unknown>;
269
271
  has_image: z.ZodBoolean;
270
272
  image_src: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | null, string | null | undefined>>;
271
273
  is_own: z.ZodBoolean;
@@ -274,7 +276,7 @@ export declare const AssemblyDetailSchema: {
274
276
  name: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | null, string | null | undefined>>;
275
277
  description: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | null, string | null | undefined>>;
276
278
  type: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | null, string | null | undefined>>;
277
- id: z.ZodString;
279
+ id: z.ZodUUID;
278
280
  created_at: z.ZodCoercedDate<unknown>;
279
281
  updated_at: z.ZodCoercedDate<unknown>;
280
282
  }, z.core.$strip>>>, z.ZodTransform<{
@@ -427,11 +429,11 @@ export declare const AssemblyDetailSchema: {
427
429
  against: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>, z.ZodTransform<number | null, number | null | undefined>>;
428
430
  abstained: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>, z.ZodTransform<number | null, number | null | undefined>>;
429
431
  include_in_action_plan: z.ZodDefault<z.ZodBoolean>;
430
- id: z.ZodString;
432
+ id: z.ZodUUID;
431
433
  tasks: z.ZodArray<z.ZodObject<{
432
434
  text: z.ZodString;
433
435
  complete: z.ZodDefault<z.ZodBoolean>;
434
- id: z.ZodString;
436
+ id: z.ZodUUID;
435
437
  created_at: z.ZodCoercedDate<unknown>;
436
438
  updated_at: z.ZodCoercedDate<unknown>;
437
439
  }, z.core.$strip>>;
@@ -570,7 +572,7 @@ export declare const PinSchema: {
570
572
  text: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | null, string | null | undefined>>;
571
573
  }, z.core.$strip>;
572
574
  response: z.ZodObject<{
573
- id: z.ZodString;
575
+ id: z.ZodUUID;
574
576
  created_at: z.ZodCoercedDate<unknown>;
575
577
  updated_at: z.ZodCoercedDate<unknown>;
576
578
  country: z.ZodString;
@@ -590,14 +592,15 @@ export declare const PinListSchema: {
590
592
  topics: z.ZodArray<z.ZodString>;
591
593
  country: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | null, string | null | undefined>>;
592
594
  hide: z.ZodDefault<z.ZodBoolean>;
593
- id: z.ZodString;
595
+ id: z.ZodUUID;
594
596
  created_at: z.ZodCoercedDate<unknown>;
595
597
  updated_at: z.ZodCoercedDate<unknown>;
596
598
  has_image: z.ZodBoolean;
597
599
  image_src: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | null, string | null | undefined>>;
600
+ user_id: z.ZodUUID;
598
601
  }, z.core.$strip>>;
599
602
  pins: z.ZodArray<z.ZodObject<{
600
- id: z.ZodString;
603
+ id: z.ZodUUID;
601
604
  created_at: z.ZodCoercedDate<unknown>;
602
605
  updated_at: z.ZodCoercedDate<unknown>;
603
606
  country: z.ZodString;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@assemblis/contracts",
3
- "version": "0.0.11",
3
+ "version": "0.0.12",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
package/src/schemas.ts CHANGED
@@ -1,4 +1,4 @@
1
- import z, {type ZodType} from "zod";
1
+ import z, { type ZodType } from 'zod';
2
2
 
3
3
  const maybe = <T extends ZodType<unknown>>(_: T) =>
4
4
  _.nullish().transform((_) => _ ?? null);
@@ -11,7 +11,7 @@ const OptionSchema = z.object({
11
11
  export const UserSchema = {
12
12
  payload: z.undefined(),
13
13
  response: z.object({
14
- id: z.string().uuid(),
14
+ id: z.uuid(),
15
15
  created_at: z.coerce.date(),
16
16
  updated_at: z.coerce.date(),
17
17
  sub: z.string(),
@@ -21,18 +21,19 @@ export const UserSchema = {
21
21
 
22
22
  // Surveys
23
23
  const SurveyQuestionSchema = z.object({
24
- id: z.string().uuid(),
24
+ id: z.uuid(),
25
25
  text: z.string()
26
26
  });
27
27
 
28
28
  export const SurveySchema = {
29
29
  payload: z.undefined(),
30
30
  response: z.object({
31
- id: z.string().uuid(),
31
+ id: z.uuid(),
32
32
  created_at: z.coerce.date(),
33
33
  updated_at: z.coerce.date(),
34
34
  name: z.string(),
35
- sections: z.object({
35
+ sections: z
36
+ .object({
36
37
  primary: SurveyQuestionSchema,
37
38
  secondary: SurveyQuestionSchema.array(),
38
39
  options: OptionSchema.array()
@@ -43,8 +44,9 @@ export const SurveySchema = {
43
44
 
44
45
  export const SurveyResponseSchema = {
45
46
  payload: z.object({
46
- answers: z.object({
47
- question_id: z.string().uuid(),
47
+ answers: z
48
+ .object({
49
+ question_id: z.uuid(),
48
50
  answer_value: z.coerce.number().int()
49
51
  })
50
52
  .array()
@@ -66,14 +68,14 @@ const ActionSchema = z.object({
66
68
  against: maybe(z.coerce.number().int()),
67
69
  abstained: maybe(z.coerce.number().int()),
68
70
  include_in_action_plan: z.boolean().default(true),
69
- assembly_id: z.string().uuid()
71
+ assembly_id: z.uuid()
70
72
  });
71
73
 
72
74
  const TaskSchema = z.object({
73
75
  text: z.string(),
74
76
  complete: z.boolean().default(false),
75
- action_id: z.string().uuid(),
76
- assembly_id: z.string().uuid()
77
+ action_id: z.uuid(),
78
+ assembly_id: z.uuid()
77
79
  });
78
80
 
79
81
  // Assembly Overviews
@@ -88,11 +90,12 @@ const BaseAssemblyOverviewSchema = z.object({
88
90
  export const AssemblyOverviewSchema = {
89
91
  payload: BaseAssemblyOverviewSchema,
90
92
  response: BaseAssemblyOverviewSchema.extend({
91
- id: z.string().uuid(),
93
+ id: z.uuid(),
92
94
  created_at: z.coerce.date(),
93
95
  updated_at: z.coerce.date(),
94
- has_image: z.boolean(),
95
- image_src: maybe(z.string())
96
+ image_src: maybe(z.string()),
97
+ has_image: z.boolean().meta({ deprecated: true }),
98
+ user_id: z.uuid().meta({ deprecated: true })
96
99
  })
97
100
  };
98
101
  export const AssembliesListSchema = {
@@ -148,7 +151,7 @@ export const AssemblyDetailSchema = {
148
151
  payload: AssemblyOverviewSchema.payload.extend({
149
152
  organisation: maybe(
150
153
  OrganisationSchema.extend({
151
- id: z.string().uuid().optional()
154
+ id: z.uuid().optional()
152
155
  })
153
156
  ),
154
157
  event_details: maybe(EventDetailsSchema),
@@ -162,13 +165,13 @@ export const AssemblyDetailSchema = {
162
165
  ActionPlanSchema.extend({
163
166
  actions: ActionSchema.omit({ assembly_id: true })
164
167
  .extend({
165
- id: z.string().uuid().optional(),
168
+ id: z.uuid().optional(),
166
169
  tasks: TaskSchema.omit({
167
170
  action_id: true,
168
171
  assembly_id: true
169
172
  })
170
173
  .extend({
171
- id: z.string().uuid().optional()
174
+ id: z.uuid().optional()
172
175
  })
173
176
  .array(),
174
177
  updates: z.unknown().array()
@@ -179,11 +182,11 @@ export const AssemblyDetailSchema = {
179
182
  ),
180
183
  surveys: maybe(SurveyDetailsSchema)
181
184
  }),
182
- response: AssemblyOverviewSchema.response.extend({
185
+ response: AssemblyOverviewSchema.response.omit({ user_id: true }).extend({
183
186
  is_own: z.boolean(),
184
187
  organisation: maybe(
185
188
  OrganisationSchema.extend({
186
- id: z.string().uuid(),
189
+ id: z.uuid(),
187
190
  created_at: z.coerce.date(),
188
191
  updated_at: z.coerce.date()
189
192
  })
@@ -234,7 +237,7 @@ export const AssemblyDetailSchema = {
234
237
  ActionPlanSchema.extend({
235
238
  actions: ActionSchema.omit({ assembly_id: true })
236
239
  .extend({
237
- id: z.string().uuid(),
240
+ id: z.uuid(),
238
241
  created_at: z.coerce.date(),
239
242
  updated_at: z.coerce.date(),
240
243
  tasks: TaskSchema.omit({
@@ -242,7 +245,7 @@ export const AssemblyDetailSchema = {
242
245
  assembly_id: true
243
246
  })
244
247
  .extend({
245
- id: z.string().uuid(),
248
+ id: z.uuid(),
246
249
  created_at: z.coerce.date(),
247
250
  updated_at: z.coerce.date()
248
251
  })
@@ -307,7 +310,8 @@ export const RegisterSchema = {
307
310
  object: z.literal('event'),
308
311
  data: z.object({
309
312
  id: z.string(),
310
- email_addresses: z.object({
313
+ email_addresses: z
314
+ .object({
311
315
  email_address: z.string()
312
316
  })
313
317
  .array()
@@ -323,14 +327,14 @@ export const PinSchema = {
323
327
  text: maybe(z.string())
324
328
  }),
325
329
  response: z.object({
326
- id: z.string().uuid(),
330
+ id: z.uuid(),
327
331
  created_at: z.coerce.date(),
328
332
  updated_at: z.coerce.date(),
329
333
  country: z.string(),
330
334
  text: maybe(z.string()),
331
335
  hide: z.boolean(),
332
- has_image: z.boolean(),
333
- image_src: maybe(z.string())
336
+ image_src: maybe(z.string()),
337
+ has_image: z.boolean().meta({ deprecated: true })
334
338
  })
335
339
  };
336
340
  export const PinListSchema = {