@assemblis/contracts 0.2.0 → 0.2.2

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 t from"zod";var e,n,i,o,r;!function(t){t.GET="GET",t.POST="POST",t.PUT="PUT",t.PATCH="PATCH"}(e||(e={})),function(t){t.ID=":ID",t.NAME=":NAME"}(n||(n={})),function(t){t.ACCOUNT_REPORTS="/account/reports",t.ASSEMBLIES="/assemblies",t.FEEDBACK="/feedback",t.INTEREST="/interest",t.INTEREST_ASSEMBLIS="/interest/assemblis",t.LOGS="/logs",t.PINS="/pins",t.REPORTS="/reports",t.SURVEYS="/surveys",t.SURVEY_RESPONSES="/assemblies/:ID/survey-responses/:NAME"}(i||(i={})),function(t){t.DISCARDED="DISCARDED",t.DRAFTED="DRAFT",t.PUBLISHED="PUBLISHED",t.CHANGED="CHANGED"}(o||(o={})),function(t){t.DELIBERATION="deliberation",t.DEMOGRAPHIC_DATA="demographic-data",t.PRE_ASSEMBLY="pre-assembly",t.POST_ASSEMBLY="post-assembly"}(r||(r={}));const s=t.coerce.date().transform(t=>t.toISOString()),a=t=>t.nullish().transform(t=>t??null),d=t.object({id:t.uuid(),created_at:s,updated_at:s,alt:t.string(),srcset:t.string(),width:t.int(),height:t.int()}),p=t.object({recaptcha_token:t.string(),email:t.email().toLowerCase().trim(),listIds:t.int().array(),firstname:t.string().nullish().transform(t=>t??void 0),lastname:t.string().nullish().transform(t=>t??void 0),country:t.string().nullish().transform(t=>t??void 0),organisation:t.string().nullish().transform(t=>t??void 0)});t.object({label:t.string(),value:t.coerce.number().int()});const l=t.object({published_at:a(s),title:a(t.string()),description:a(t.string()),location:a(t.string()),outputs:a(t.string().array()),initiation_type:a(t.string()),recruitment_method:a(t.string()),recruitment_description:a(t.string()),participant_count:a(t.int()),organiser_reflections:a(t.string()),organiser_report_url:a(t.string()),location_details:a(t.string()),date:a(t.string()),duration:a(t.int()),contact_information_url:a(t.string()),cover_image_id:a(t.string())}),c=t.object({id:t.uuid(),sequential_id:t.int(),created_at:s,updated_at:s,published_at:a(s),state:t.enum(["DISCARDED","DRAFTED","PUBLISHED","CHANGED"]),slug:a(t.string()),draft_content:a(l),published_content:a(l),media:t.object({images:d.array()})});t.object({id:t.uuid(),created_at:s,updated_at:s,sub:t.string(),is_mutirao:t.boolean()});const E={endpoint:()=>i.ACCOUNT_REPORTS,method:e.GET,payload:t.never(),response:t.object({reports:c.array()})},T={endpoint:t=>`${i.ACCOUNT_REPORTS}/${t}`,method:e.GET,payload:t.never(),response:a(c)},u={endpoint:()=>i.ACCOUNT_REPORTS,method:e.POST,payload:t.object({sequential_id:t.int(),content:a(l.omit({cover_image_id:!0}))}),response:c},S={endpoint:t=>`${i.ACCOUNT_REPORTS}/${t}/content`,method:e.PUT,payload:l.omit({published_at:!0,cover_image_id:!0}),response:c},_={endpoint:t=>`${i.ACCOUNT_REPORTS}/${t}/discard`,method:e.PATCH,payload:t.nullish(t.object()),response:a(c)},m={endpoint:t=>`${i.ACCOUNT_REPORTS}/${t}/publish`,method:e.PATCH,payload:t.object({published_at:s}),response:c},R={endpoint:t=>`${i.ACCOUNT_REPORTS}/${t}/unpublish`,method:e.PATCH,payload:t.nullish(t.object()),response:c},g={endpoint:t=>`${i.ACCOUNT_REPORTS}/${t}/cover-image`,method:e.POST,payload:d.pick({alt:!0}),response:c},A={endpoint:()=>i.INTEREST,method:e.POST,payload:p,response:t.string()},P={endpoint:()=>i.REPORTS,method:e.GET,payload:t.never(),response:t.object({reports:c.array()})},C={endpoint:t=>`${i.REPORTS}/${t}`,method:e.GET,payload:t.never(),response:a(c)};export{i as ApiEndpoint,e as ApiRestMethod,n as ApiRouteParameter,T as GetAccountReportsIdSchema,E as GetAccountReportsSchema,C as GetReportsIdSchema,P as GetReportsSchema,_ as PatchAccountReportsIdDiscardSchema,m as PatchAccountReportsIdPublishSchema,R as PatchAccountReportsIdUnpublishSchema,g as PostAccountReportsIdCoverImageSchema,u as PostAccountReportsSchema,A as PostInterestSchema,S as PutAccountReportsIdContentSchema,o as ReportState,r as SurveyName};
1
+ import t from"zod";var e,a,n,r,o;!function(t){t.GET="GET",t.POST="POST",t.PUT="PUT",t.PATCH="PATCH"}(e||(e={})),function(t){t.ID=":ID",t.NAME=":NAME"}(a||(a={})),function(t){t.ACCOUNT_REPORTS="/account/reports",t.ASSEMBLIES="/assemblies",t.FEEDBACK="/feedback",t.INTEREST="/interest",t.INTEREST_ASSEMBLIS="/interest/assemblis",t.LOGS="/logs",t.PINS="/pins",t.REPORTS="/reports",t.SURVEYS="/surveys",t.SURVEY_RESPONSES="/assemblies/:ID/survey-responses/:NAME"}(n||(n={})),function(t){t.DISCARDED="DISCARDED",t.DRAFTED="DRAFT",t.PUBLISHED="PUBLISHED",t.CHANGED="CHANGED"}(r||(r={})),function(t){t.DELIBERATION="deliberation",t.DEMOGRAPHIC_DATA="demographic-data",t.PRE_ASSEMBLY="pre-assembly",t.POST_ASSEMBLY="post-assembly"}(o||(o={}));const i=t.coerce.date().transform(t=>t.toISOString()),s=t=>t.nullish().transform(t=>t??null);t.object({route:t.string(),text:t.string(),metadata:t.unknown()}),t.string(),t.object({type:t.literal("user.created"),object:t.literal("event"),data:t.object({id:t.string(),email_addresses:t.object({email_address:t.string()}).array()})}),t.string();const d=t.object({id:t.uuid(),text:t.string()});t.undefined(),t.object({id:t.uuid(),created_at:i,updated_at:i,name:t.string(),sections:t.object({primary:d,secondary:d.array(),options:v.array()}).array()}),t.object({answers:t.object({question_id:t.uuid(),answer_value:t.coerce.number().int()}).array()}),t.object({total:t.number().int()});const c=t.object({visible_on_profile:t.boolean(),description:s(t.string())}),p=t.object({text:t.string(),agreed:s(t.coerce.number().int()),against:s(t.coerce.number().int()),abstained:s(t.coerce.number().int()),include_in_action_plan:t.boolean().default(!0),assembly_id:t.uuid()}),u=t.object({text:t.string(),complete:t.boolean().default(!1),action_id:t.uuid(),assembly_id:t.uuid()}),l=t.object({published_at:s(i),name:t.string(),about:s(t.string()),topics:t.string().array(),country:s(t.string()),hide:t.boolean().default(!1)}),_={payload:l,response:l.extend({id:t.uuid(),created_at:i,updated_at:i,image_src:s(t.string()),has_image:t.boolean().meta({deprecated:!0}),user_id:t.uuid().meta({deprecated:!0})})};t.undefined(),t.object({assemblies:_.response.array()});const b=t.object({visible_on_profile:t.boolean(),name:s(t.string()),description:s(t.string()),type:s(t.string())}),g=t.object({visible_on_profile:t.boolean(),registration_link:s(t.string()),start_date:s(i)}),m=t.object({visible_on_profile:t.boolean(),background:s(t.string())}),S=t.object({visible_on_profile:t.boolean(),organisation_types:t.string().array(),description:s(t.string())}),y=t.object({visible_on_profile:t.boolean(),organisation_types:t.string().array(),description:s(t.string())}),E=t.object({visible_on_profile:t.boolean(),decision_method:s(t.string())}),T=t.object({visible_on_profile:t.boolean(),recruitment_method:s(t.string()),community:s(t.string())}),f=t.object({visible_on_profile:t.boolean(),support_options:t.string().array()}),j=t.object({visible_on_profile:t.boolean()});_.payload.extend({organisation:s(b.extend({id:t.uuid().optional()})),event_details:s(g),story:s(m),supporters:s(S),funders:s(y),facilitation:s(E),participants:s(T),support:s(f),action_plan:s(c.extend({actions:p.omit({assembly_id:!0}).extend({id:t.uuid().optional(),tasks:u.omit({action_id:!0,assembly_id:!0}).extend({id:t.uuid().optional()}).array(),updates:t.unknown().array()}).array(),updates:t.unknown().array()})),surveys:s(j)}),_.response.omit({user_id:!0}).extend({is_own:t.boolean(),organisation:s(b.extend({id:t.uuid(),created_at:i,updated_at:i})),event_details:s(g.extend({created_at:i,updated_at:i})),story:s(m.extend({created_at:i,updated_at:i})),supporters:s(S.extend({created_at:i,updated_at:i})),funders:s(y.extend({created_at:i,updated_at:i})),facilitation:s(E.extend({created_at:i,updated_at:i})),participants:s(T.extend({created_at:i,updated_at:i})),support:s(f.extend({created_at:i,updated_at:i})),action_plan:s(c.extend({actions:p.omit({assembly_id:!0}).extend({id:t.uuid(),created_at:i,updated_at:t.coerce.date().transform(t=>t.toISOString()),tasks:u.omit({action_id:!0,assembly_id:!0}).extend({id:t.uuid(),created_at:t.coerce.date().transform(t=>t.toISOString()),updated_at:t.coerce.date().transform(t=>t.toISOString())}).array(),updates:t.unknown().array()}).extend({created_at:t.coerce.date().transform(t=>t.toISOString()),updated_at:t.coerce.date().transform(t=>t.toISOString())}).array(),updates:t.unknown().array()}).and(t.object({created_at:t.coerce.date().transform(t=>t.toISOString()),updated_at:t.coerce.date().transform(t=>t.toISOString())}))),surveys:s(j.extend({created_at:t.coerce.date().transform(t=>t.toISOString()),updated_at:t.coerce.date().transform(t=>t.toISOString())}).extend({data:t.record(t.string(),t.object({total:t.number().int(),responses:t.record(t.string(),v.array())}))}))});const O={payload:t.object({country:t.string(),email:t.string(),text:s(t.string())}),response:t.object({id:t.uuid(),created_at:t.coerce.date().transform(t=>t.toISOString()),updated_at:t.coerce.date().transform(t=>t.toISOString()),country:t.string(),text:s(t.string()),hide:t.boolean(),image_src:s(t.string()),has_image:t.boolean().meta({deprecated:!0})})},R={payload:t.undefined(),response:t.object({assemblies:_.response.array(),pins:O.response.array()})},h={payload:t.object({message:t.string().optional(),data:t.record(t.string(),t.string().optional()).optional(),metadata:t.object({origin:t.string(),route:t.string(),status:t.number()})}),response:t.string()},A=t.object({id:t.uuid(),created_at:i,updated_at:i,alt:t.string(),srcset:t.string(),width:t.int(),height:t.int()}),P=t.object({recaptcha_token:t.string(),email:t.email().toLowerCase().trim(),listIds:t.int().array(),firstname:t.string().nullish().transform(t=>t??void 0),lastname:t.string().nullish().transform(t=>t??void 0),country:t.string().nullish().transform(t=>t??void 0),organisation:t.string().nullish().transform(t=>t??void 0)}),v=t.object({label:t.string(),value:t.coerce.number().int()}),C=t.object({published_at:s(i),title:s(t.string()),description:s(t.string()),location:s(t.string()),outputs:s(t.string().array()),initiation_type:s(t.string()),recruitment_method:s(t.string()),recruitment_description:s(t.string()),participant_count:s(t.int()),organiser_reflections:s(t.string()),organiser_report_url:s(t.string()),location_details:s(t.string()),date:s(t.string()),duration:s(t.int()),contact_information_url:s(t.string()),cover_image_id:s(t.string())}),I=t.object({id:t.uuid(),sequential_id:t.int(),created_at:i,updated_at:i,published_at:s(i),state:t.enum(["DISCARDED","DRAFTED","PUBLISHED","CHANGED"]),slug:s(t.string()),draft_content:s(C),published_content:s(C),media:t.object({images:A.array()})}),x=t.object({id:t.uuid(),created_at:i,updated_at:i,sub:t.string(),is_mutirao:t.boolean()}),D={endpoint:()=>n.ACCOUNT_REPORTS,method:e.GET,payload:t.never(),response:t.object({reports:I.array(),total:t.int()})},N={endpoint:t=>`${n.ACCOUNT_REPORTS}/${t}`,method:e.GET,payload:t.never(),response:s(I)},U={endpoint:()=>n.ACCOUNT_REPORTS,method:e.POST,payload:t.object({sequential_id:t.int(),content:s(C.omit({cover_image_id:!0}))}),response:I},$={endpoint:t=>`${n.ACCOUNT_REPORTS}/${t}/content`,method:e.PUT,payload:C.omit({published_at:!0,cover_image_id:!0}),response:I},k={endpoint:t=>`${n.ACCOUNT_REPORTS}/${t}/discard`,method:e.PATCH,payload:t.nullish(t.object()),response:s(I)},H={endpoint:t=>`${n.ACCOUNT_REPORTS}/${t}/publish`,method:e.PATCH,payload:t.object({published_at:i}),response:I},G={endpoint:t=>`${n.ACCOUNT_REPORTS}/${t}/unpublish`,method:e.PATCH,payload:t.nullish(t.object()),response:I},w={endpoint:t=>`${n.ACCOUNT_REPORTS}/${t}/cover-image`,method:e.POST,payload:A.pick({alt:!0}),response:I},L={endpoint:()=>n.INTEREST,method:e.POST,payload:P,response:t.string()},B={endpoint:()=>n.REPORTS,method:e.GET,payload:t.never(),response:t.object({reports:I.array()})},M={endpoint:t=>`${n.REPORTS}/${t}`,method:e.GET,payload:t.never(),response:s(I)};export{n as ApiEndpoint,e as ApiRestMethod,a as ApiRouteParameter,N as GetAccountReportsIdSchema,D as GetAccountReportsSchema,M as GetReportsIdSchema,B as GetReportsSchema,A as ImageSchema,P as InterestSchema,h as LogSchema,v as OptionSchema,k as PatchAccountReportsIdDiscardSchema,H as PatchAccountReportsIdPublishSchema,G as PatchAccountReportsIdUnpublishSchema,R as PinListSchema,O as PinSchema,w as PostAccountReportsIdCoverImageSchema,U as PostAccountReportsSchema,L as PostInterestSchema,$ as PutAccountReportsIdContentSchema,C as ReportContentSchema,I as ReportSchema,r as ReportState,o as SurveyName,x as UserSchema};
@@ -135,6 +135,7 @@ export declare const GetAccountReportsSchema: {
135
135
  }, z.core.$strip>>;
136
136
  }, z.core.$strip>;
137
137
  }, z.core.$strip>>;
138
+ total: z.ZodInt;
138
139
  }, z.core.$strip>;
139
140
  };
140
141
  export declare const GetAccountReportsIdSchema: {
@@ -388,9 +389,9 @@ export declare const PostAccountReportsSchema: {
388
389
  sequential_id: z.ZodInt;
389
390
  content: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodObject<{
390
391
  date: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | null, string | null | undefined>>;
391
- published_at: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodCoercedDate<unknown>, z.ZodTransform<string, Date>>>>, z.ZodTransform<string | null, string | null | undefined>>;
392
392
  title: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | null, string | null | undefined>>;
393
393
  description: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | null, string | null | undefined>>;
394
+ published_at: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodCoercedDate<unknown>, z.ZodTransform<string, Date>>>>, z.ZodTransform<string | null, string | null | undefined>>;
394
395
  location: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | null, string | null | undefined>>;
395
396
  outputs: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>, z.ZodTransform<string[] | null, string[] | null | undefined>>;
396
397
  initiation_type: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | null, string | null | undefined>>;
@@ -404,9 +405,9 @@ export declare const PostAccountReportsSchema: {
404
405
  contact_information_url: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | null, string | null | undefined>>;
405
406
  }, z.core.$strip>>>, z.ZodTransform<{
406
407
  date: string | null;
407
- published_at: string | null;
408
408
  title: string | null;
409
409
  description: string | null;
410
+ published_at: string | null;
410
411
  location: string | null;
411
412
  outputs: string[] | null;
412
413
  initiation_type: string | null;
@@ -420,9 +421,9 @@ export declare const PostAccountReportsSchema: {
420
421
  contact_information_url: string | null;
421
422
  } | null, {
422
423
  date: string | null;
423
- published_at: string | null;
424
424
  title: string | null;
425
425
  description: string | null;
426
+ published_at: string | null;
426
427
  location: string | null;
427
428
  outputs: string[] | null;
428
429
  initiation_type: string | null;
@@ -1516,7 +1517,7 @@ export declare const GetReportsSchema: {
1516
1517
  }, z.core.$strip>;
1517
1518
  };
1518
1519
  export declare const GetReportsIdSchema: {
1519
- endpoint: (reportId: string) => string;
1520
+ endpoint: (slug: string) => string;
1520
1521
  method: ApiRestMethod;
1521
1522
  payload: z.ZodNever;
1522
1523
  response: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodObject<{
@@ -1,4 +1,62 @@
1
1
  import z from 'zod';
2
+ export declare const PinSchema: {
3
+ payload: z.ZodObject<{
4
+ country: z.ZodString;
5
+ email: z.ZodString;
6
+ text: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | null, string | null | undefined>>;
7
+ }, z.core.$strip>;
8
+ response: z.ZodObject<{
9
+ id: z.ZodUUID;
10
+ created_at: z.ZodPipe<z.ZodCoercedDate<unknown>, z.ZodTransform<string, Date>>;
11
+ updated_at: z.ZodPipe<z.ZodCoercedDate<unknown>, z.ZodTransform<string, Date>>;
12
+ country: z.ZodString;
13
+ text: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | null, string | null | undefined>>;
14
+ hide: z.ZodBoolean;
15
+ image_src: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | null, string | null | undefined>>;
16
+ has_image: z.ZodBoolean;
17
+ }, z.core.$strip>;
18
+ };
19
+ export declare const PinListSchema: {
20
+ payload: z.ZodUndefined;
21
+ response: z.ZodObject<{
22
+ assemblies: z.ZodArray<z.ZodObject<{
23
+ published_at: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodCoercedDate<unknown>, z.ZodTransform<string, Date>>>>, z.ZodTransform<string | null, string | null | undefined>>;
24
+ name: z.ZodString;
25
+ about: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | null, string | null | undefined>>;
26
+ topics: z.ZodArray<z.ZodString>;
27
+ country: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | null, string | null | undefined>>;
28
+ hide: z.ZodDefault<z.ZodBoolean>;
29
+ id: z.ZodUUID;
30
+ created_at: z.ZodPipe<z.ZodCoercedDate<unknown>, z.ZodTransform<string, Date>>;
31
+ updated_at: z.ZodPipe<z.ZodCoercedDate<unknown>, z.ZodTransform<string, Date>>;
32
+ image_src: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | null, string | null | undefined>>;
33
+ has_image: z.ZodBoolean;
34
+ user_id: z.ZodUUID;
35
+ }, z.core.$strip>>;
36
+ pins: z.ZodArray<z.ZodObject<{
37
+ id: z.ZodUUID;
38
+ created_at: z.ZodPipe<z.ZodCoercedDate<unknown>, z.ZodTransform<string, Date>>;
39
+ updated_at: z.ZodPipe<z.ZodCoercedDate<unknown>, z.ZodTransform<string, Date>>;
40
+ country: z.ZodString;
41
+ text: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | null, string | null | undefined>>;
42
+ hide: z.ZodBoolean;
43
+ image_src: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | null, string | null | undefined>>;
44
+ has_image: z.ZodBoolean;
45
+ }, z.core.$strip>>;
46
+ }, z.core.$strip>;
47
+ };
48
+ export declare const LogSchema: {
49
+ payload: z.ZodObject<{
50
+ message: z.ZodOptional<z.ZodString>;
51
+ data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodString>>>;
52
+ metadata: z.ZodObject<{
53
+ origin: z.ZodString;
54
+ route: z.ZodString;
55
+ status: z.ZodNumber;
56
+ }, z.core.$strip>;
57
+ }, z.core.$strip>;
58
+ response: z.ZodString;
59
+ };
2
60
  export declare const ImageSchema: z.ZodObject<{
3
61
  id: z.ZodUUID;
4
62
  created_at: z.ZodPipe<z.ZodCoercedDate<unknown>, z.ZodTransform<string, Date>>;
@@ -1 +1,2 @@
1
1
  export * from './api';
2
+ export * from './base';
@@ -7,18 +7,6 @@ export declare const FeedbackSchema: {
7
7
  }, z.core.$strip>;
8
8
  response: z.ZodString;
9
9
  };
10
- export declare const LogSchema: {
11
- payload: z.ZodObject<{
12
- message: z.ZodOptional<z.ZodString>;
13
- data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodString>>>;
14
- metadata: z.ZodObject<{
15
- origin: z.ZodString;
16
- route: z.ZodString;
17
- status: z.ZodNumber;
18
- }, z.core.$strip>;
19
- }, z.core.$strip>;
20
- response: z.ZodString;
21
- };
22
10
  export declare const RegisterSchema: {
23
11
  payload: z.ZodObject<{
24
12
  type: z.ZodLiteral<"user.created">;
@@ -282,17 +270,17 @@ export declare const AssemblyDetailSchema: {
282
270
  } | null | undefined>>;
283
271
  }, z.core.$strip>;
284
272
  response: z.ZodObject<{
273
+ country: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | null, string | null | undefined>>;
274
+ id: z.ZodUUID;
285
275
  created_at: z.ZodPipe<z.ZodCoercedDate<unknown>, z.ZodTransform<string, Date>>;
286
276
  updated_at: z.ZodPipe<z.ZodCoercedDate<unknown>, z.ZodTransform<string, Date>>;
287
- id: z.ZodUUID;
288
- country: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | null, string | null | undefined>>;
277
+ hide: z.ZodDefault<z.ZodBoolean>;
278
+ image_src: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | null, string | null | undefined>>;
279
+ has_image: z.ZodBoolean;
289
280
  published_at: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodCoercedDate<unknown>, z.ZodTransform<string, Date>>>>, z.ZodTransform<string | null, string | null | undefined>>;
290
281
  name: z.ZodString;
291
282
  about: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | null, string | null | undefined>>;
292
283
  topics: z.ZodArray<z.ZodString>;
293
- hide: z.ZodDefault<z.ZodBoolean>;
294
- image_src: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | null, string | null | undefined>>;
295
- has_image: z.ZodBoolean;
296
284
  is_own: z.ZodBoolean;
297
285
  organisation: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodObject<{
298
286
  visible_on_profile: z.ZodBoolean;
@@ -555,49 +543,3 @@ export declare const AssemblyDetailSchema: {
555
543
  } | null | undefined>>;
556
544
  }, z.core.$strip>;
557
545
  };
558
- export declare const PinSchema: {
559
- payload: z.ZodObject<{
560
- country: z.ZodString;
561
- email: z.ZodString;
562
- text: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | null, string | null | undefined>>;
563
- }, z.core.$strip>;
564
- response: z.ZodObject<{
565
- id: z.ZodUUID;
566
- created_at: z.ZodPipe<z.ZodCoercedDate<unknown>, z.ZodTransform<string, Date>>;
567
- updated_at: z.ZodPipe<z.ZodCoercedDate<unknown>, z.ZodTransform<string, Date>>;
568
- country: z.ZodString;
569
- text: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | null, string | null | undefined>>;
570
- hide: z.ZodBoolean;
571
- image_src: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | null, string | null | undefined>>;
572
- has_image: z.ZodBoolean;
573
- }, z.core.$strip>;
574
- };
575
- export declare const PinListSchema: {
576
- payload: z.ZodUndefined;
577
- response: z.ZodObject<{
578
- assemblies: z.ZodArray<z.ZodObject<{
579
- published_at: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodCoercedDate<unknown>, z.ZodTransform<string, Date>>>>, z.ZodTransform<string | null, string | null | undefined>>;
580
- name: z.ZodString;
581
- about: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | null, string | null | undefined>>;
582
- topics: z.ZodArray<z.ZodString>;
583
- country: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | null, string | null | undefined>>;
584
- hide: z.ZodDefault<z.ZodBoolean>;
585
- id: z.ZodUUID;
586
- created_at: z.ZodPipe<z.ZodCoercedDate<unknown>, z.ZodTransform<string, Date>>;
587
- updated_at: z.ZodPipe<z.ZodCoercedDate<unknown>, z.ZodTransform<string, Date>>;
588
- image_src: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | null, string | null | undefined>>;
589
- has_image: z.ZodBoolean;
590
- user_id: z.ZodUUID;
591
- }, z.core.$strip>>;
592
- pins: z.ZodArray<z.ZodObject<{
593
- id: z.ZodUUID;
594
- created_at: z.ZodPipe<z.ZodCoercedDate<unknown>, z.ZodTransform<string, Date>>;
595
- updated_at: z.ZodPipe<z.ZodCoercedDate<unknown>, z.ZodTransform<string, Date>>;
596
- country: z.ZodString;
597
- text: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | null, string | null | undefined>>;
598
- hide: z.ZodBoolean;
599
- image_src: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | null, string | null | undefined>>;
600
- has_image: z.ZodBoolean;
601
- }, z.core.$strip>>;
602
- }, z.core.$strip>;
603
- };
@@ -1,6 +1,6 @@
1
1
  import z from 'zod';
2
- import { PatchAccountReportsIdPublishSchema, PostAccountReportsIdCoverImageSchema, PutAccountReportsIdContentSchema } from '../schemas';
3
- import { AssembliesListSchema, AssemblyDetailSchema, AssemblyOverviewSchema, FeedbackSchema, LogSchema, PinListSchema, PinSchema, RegisterSchema, SurveyResponseSchema, SurveySchema } from '../schemas/legacy';
2
+ import { PatchAccountReportsIdPublishSchema, PostAccountReportsIdCoverImageSchema, PutAccountReportsIdContentSchema, LogSchema, PinListSchema, PinSchema } from '../schemas';
3
+ import { AssembliesListSchema, AssemblyDetailSchema, AssemblyOverviewSchema, FeedbackSchema, RegisterSchema, SurveyResponseSchema, SurveySchema } from '../schemas/legacy';
4
4
  export type PutAccountReportsIdContentPayload = z.infer<(typeof PutAccountReportsIdContentSchema)['payload']>;
5
5
  export type PublishReportPayload = z.infer<(typeof PatchAccountReportsIdPublishSchema)['payload']>;
6
6
  export type ImageMetadataPayload = z.infer<(typeof PostAccountReportsIdCoverImageSchema)['payload']>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@assemblis/contracts",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -16,7 +16,7 @@ export const GetAccountReportsSchema = {
16
16
  endpoint: (): AccountEndpoint => ApiEndpoint.ACCOUNT_REPORTS,
17
17
  method: ApiRestMethod.GET,
18
18
  payload: z.never(),
19
- response: z.object({ reports: ReportSchema.array() })
19
+ response: z.object({ reports: ReportSchema.array(), total: z.int() })
20
20
  };
21
21
 
22
22
  export const GetAccountReportsIdSchema = {
@@ -95,7 +95,7 @@ export const GetReportsSchema = {
95
95
  };
96
96
 
97
97
  export const GetReportsIdSchema = {
98
- endpoint: (reportId: string) => `${ApiEndpoint.REPORTS}/${reportId}`,
98
+ endpoint: (slug: string) => `${ApiEndpoint.REPORTS}/${slug}`,
99
99
  method: ApiRestMethod.GET,
100
100
  payload: z.never(),
101
101
  response: maybe(ReportSchema)
@@ -2,6 +2,46 @@
2
2
 
3
3
  import z from 'zod';
4
4
  import { isoDateString, maybe } from './utils';
5
+ import { AssemblyOverviewSchema } from './legacy';
6
+
7
+ // Pins
8
+ export const PinSchema = {
9
+ payload: z.object({
10
+ country: z.string(),
11
+ email: z.string(),
12
+ text: maybe(z.string())
13
+ }),
14
+ response: z.object({
15
+ id: z.uuid(),
16
+ created_at: z.coerce.date().transform((_) => _.toISOString()),
17
+ updated_at: z.coerce.date().transform((_) => _.toISOString()),
18
+ country: z.string(),
19
+ text: maybe(z.string()),
20
+ hide: z.boolean(),
21
+ image_src: maybe(z.string()),
22
+ has_image: z.boolean().meta({ deprecated: true })
23
+ })
24
+ };
25
+ export const PinListSchema = {
26
+ payload: z.undefined(),
27
+ response: z.object({
28
+ assemblies: AssemblyOverviewSchema.response.array(),
29
+ pins: PinSchema.response.array()
30
+ })
31
+ };
32
+
33
+ export const LogSchema = {
34
+ payload: z.object({
35
+ message: z.string().optional(),
36
+ data: z.record(z.string(), z.string().optional()).optional(),
37
+ metadata: z.object({
38
+ origin: z.string(),
39
+ route: z.string(),
40
+ status: z.number()
41
+ })
42
+ }),
43
+ response: z.string()
44
+ };
5
45
 
6
46
  export const ImageSchema = z.object({
7
47
  id: z.uuid(),
@@ -1 +1,2 @@
1
1
  export * from './api';
2
+ export * from './base';
@@ -11,19 +11,6 @@ export const FeedbackSchema = {
11
11
  response: z.string()
12
12
  };
13
13
 
14
- export const LogSchema = {
15
- payload: z.object({
16
- message: z.string().optional(),
17
- data: z.record(z.string(), z.string().optional()).optional(),
18
- metadata: z.object({
19
- origin: z.string(),
20
- route: z.string(),
21
- status: z.number()
22
- })
23
- }),
24
- response: z.string()
25
- };
26
-
27
14
  export const RegisterSchema = {
28
15
  payload: z.object({
29
16
  type: z.literal('user.created'),
@@ -300,29 +287,3 @@ export const AssemblyDetailSchema = {
300
287
  )
301
288
  })
302
289
  };
303
-
304
- // Pins
305
- export const PinSchema = {
306
- payload: z.object({
307
- country: z.string(),
308
- email: z.string(),
309
- text: maybe(z.string())
310
- }),
311
- response: z.object({
312
- id: z.uuid(),
313
- created_at: z.coerce.date().transform((_) => _.toISOString()),
314
- updated_at: z.coerce.date().transform((_) => _.toISOString()),
315
- country: z.string(),
316
- text: maybe(z.string()),
317
- hide: z.boolean(),
318
- image_src: maybe(z.string()),
319
- has_image: z.boolean().meta({ deprecated: true })
320
- })
321
- };
322
- export const PinListSchema = {
323
- payload: z.undefined(),
324
- response: z.object({
325
- assemblies: AssemblyOverviewSchema.response.array(),
326
- pins: PinSchema.response.array()
327
- })
328
- };
package/src/types/api.ts CHANGED
@@ -2,16 +2,16 @@ import z from 'zod';
2
2
  import {
3
3
  PatchAccountReportsIdPublishSchema,
4
4
  PostAccountReportsIdCoverImageSchema,
5
- PutAccountReportsIdContentSchema
5
+ PutAccountReportsIdContentSchema,
6
+ LogSchema,
7
+ PinListSchema,
8
+ PinSchema
6
9
  } from '../schemas';
7
10
  import {
8
11
  AssembliesListSchema,
9
12
  AssemblyDetailSchema,
10
13
  AssemblyOverviewSchema,
11
14
  FeedbackSchema,
12
- LogSchema,
13
- PinListSchema,
14
- PinSchema,
15
15
  RegisterSchema,
16
16
  SurveyResponseSchema,
17
17
  SurveySchema