@assemblis/contracts 0.1.7 → 0.1.9
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 +1 -1
- package/dist/schemas/api.d.ts +5 -6
- package/dist/schemas/legacy.d.ts +1 -1
- package/dist/types/api.d.ts +2 -1
- package/package.json +1 -1
- package/src/schemas/api.ts +6 -3
- package/src/types/api.ts +4 -0
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"zod";var t,a,r,n;!function(e){e.GET="GET",e.POST="POST",e.PUT="PUT",e.PATCH="PATCH"}(t||(t={})),function(e){e.ID=":ID",e.NAME=":NAME"}(a||(a={})),function(e){e.ACCOUNT_REPORTS="/account/reports",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"}(r||(r={})),function(e){e.DELIBERATION="deliberation",e.DEMOGRAPHIC_DATA="demographic-data",e.PRE_ASSEMBLY="pre-assembly",e.POST_ASSEMBLY="post-assembly"}(n||(n={}));const o=e.coerce.date().transform(e=>e.toISOString()),i=e=>e.nullish().transform(e=>e??null),s=e.object({id:e.uuid(),created_at:o,updated_at:o,uri:e.string(),alt:e.string(),src:e.string(),sizes:e.string(),srcset:e.string()}),d=e.object({label:e.string(),value:e.coerce.number().int()}),c=e.object({published_at:i(o),title:i(e.string()),description:i(e.string()),location:i(e.string()),outputs:i(e.string().array()),initiation_type:i(e.string()),recruitment_method:i(e.string()),recruitment_description:i(e.string()),participant_count:i(e.int()),organiser_reflections:i(e.string()),organiser_report_url:i(e.string()),location_details:i(e.string()),date:i(e.string()),duration:i(e.int()),contact_information_url:i(e.string()),cover_image_id:i(e.string())}),p=e.object({id:e.uuid(),created_at:o,updated_at:o,published_at:i(o),state:e.enum(["DISCARDED","DRAFTED","PUBLISHED","CHANGED"]),viewer_password:e.string(),draft_content:i(c),published_content:i(c),media:e.object({images:s.array()})});e.object({id:e.uuid(),created_at:o,updated_at:o,sub:e.string(),is_mutirao:e.boolean()});const u={endpoint:()=>r.ACCOUNT_REPORTS,method:t.GET,payload:e.never(),response:e.object({reports:p.array()})},_={endpoint:e=>`${r.ACCOUNT_REPORTS}/${e}`,method:t.GET,payload:e.never(),response:p},l={endpoint:()=>r.ACCOUNT_REPORTS,method:t.POST,payload:i(c.omit({cover_image_id:!0})),response:p},b={endpoint:e=>`${r.ACCOUNT_REPORTS}/${e}/content`,method:t.PUT,payload:c.omit({cover_image_id:!0}),response:p},g={endpoint:e=>`${r.ACCOUNT_REPORTS}/${e}/discard`,method:t.PATCH,payload:e.
|
|
1
|
+
import e from"zod";var t,a,r,n;!function(e){e.GET="GET",e.POST="POST",e.PUT="PUT",e.PATCH="PATCH"}(t||(t={})),function(e){e.ID=":ID",e.NAME=":NAME"}(a||(a={})),function(e){e.ACCOUNT_REPORTS="/account/reports",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"}(r||(r={})),function(e){e.DELIBERATION="deliberation",e.DEMOGRAPHIC_DATA="demographic-data",e.PRE_ASSEMBLY="pre-assembly",e.POST_ASSEMBLY="post-assembly"}(n||(n={}));const o=e.coerce.date().transform(e=>e.toISOString()),i=e=>e.nullish().transform(e=>e??null),s=e.object({id:e.uuid(),created_at:o,updated_at:o,uri:e.string(),alt:e.string(),src:e.string(),sizes:e.string(),srcset:e.string()}),d=e.object({label:e.string(),value:e.coerce.number().int()}),c=e.object({published_at:i(o),title:i(e.string()),description:i(e.string()),location:i(e.string()),outputs:i(e.string().array()),initiation_type:i(e.string()),recruitment_method:i(e.string()),recruitment_description:i(e.string()),participant_count:i(e.int()),organiser_reflections:i(e.string()),organiser_report_url:i(e.string()),location_details:i(e.string()),date:i(e.string()),duration:i(e.int()),contact_information_url:i(e.string()),cover_image_id:i(e.string())}),p=e.object({id:e.uuid(),created_at:o,updated_at:o,published_at:i(o),state:e.enum(["DISCARDED","DRAFTED","PUBLISHED","CHANGED"]),viewer_password:e.string(),draft_content:i(c),published_content:i(c),media:e.object({images:s.array()})});e.object({id:e.uuid(),created_at:o,updated_at:o,sub:e.string(),is_mutirao:e.boolean()});const u={endpoint:()=>r.ACCOUNT_REPORTS,method:t.GET,payload:e.never(),response:e.object({reports:p.array()})},_={endpoint:e=>`${r.ACCOUNT_REPORTS}/${e}`,method:t.GET,payload:e.never(),response:p},l={endpoint:()=>r.ACCOUNT_REPORTS,method:t.POST,payload:i(c.omit({cover_image_id:!0})),response:p},b={endpoint:e=>`${r.ACCOUNT_REPORTS}/${e}/content`,method:t.PUT,payload:c.omit({published_at:!0,cover_image_id:!0}),response:p},g={endpoint:e=>`${r.ACCOUNT_REPORTS}/${e}/discard`,method:t.PATCH,payload:e.nullish(e.object()),response:i(p)},m={endpoint:e=>`${r.ACCOUNT_REPORTS}/${e}/publish`,method:t.PATCH,payload:e.object({published_at:o}),response:p},y={endpoint:e=>`${r.ACCOUNT_REPORTS}/${e}/unpublish`,method:t.PATCH,payload:e.nullish(e.object()),response:p},S={endpoint:e=>`${r.ACCOUNT_REPORTS}/${e}/cover-image`,method:t.POST,payload:s.pick({alt:!0}),response:p},T={payload:e.object({route:e.string(),text:e.string(),metadata:e.unknown()}),response:e.string()},f={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()},j={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()},O=e.object({id:e.uuid(),text:e.string()}),E={payload:e.undefined(),response:e.object({id:e.uuid(),created_at:o,updated_at:o,name:e.string(),sections:e.object({primary:O,secondary:O.array(),options:d.array()}).array()})},A={payload:e.object({answers:e.object({question_id:e.uuid(),answer_value:e.coerce.number().int()}).array()}),response:e.object({total:e.number().int()})},R=e.object({visible_on_profile:e.boolean(),description:i(e.string())}),x=e.object({text:e.string(),agreed:i(e.coerce.number().int()),against:i(e.coerce.number().int()),abstained:i(e.coerce.number().int()),include_in_action_plan:e.boolean().default(!0),assembly_id:e.uuid()}),h=e.object({text:e.string(),complete:e.boolean().default(!1),action_id:e.uuid(),assembly_id:e.uuid()}),v=e.object({published_at:i(o),name:e.string(),about:i(e.string()),topics:e.string().array(),country:i(e.string()),hide:e.boolean().default(!1)}),C={payload:v,response:v.extend({id:e.uuid(),created_at:o,updated_at:o,image_src:i(e.string()),has_image:e.boolean().meta({deprecated:!0}),user_id:e.uuid().meta({deprecated:!0})})},P={payload:e.undefined(),response:e.object({assemblies:C.response.array()})},I=e.object({visible_on_profile:e.boolean(),name:i(e.string()),description:i(e.string()),type:i(e.string())}),N=e.object({visible_on_profile:e.boolean(),registration_link:i(e.string()),start_date:i(o)}),U=e.object({visible_on_profile:e.boolean(),background:i(e.string())}),D=e.object({visible_on_profile:e.boolean(),organisation_types:e.string().array(),description:i(e.string())}),$=e.object({visible_on_profile:e.boolean(),organisation_types:e.string().array(),description:i(e.string())}),k=e.object({visible_on_profile:e.boolean(),decision_method:i(e.string())}),w=e.object({visible_on_profile:e.boolean(),recruitment_method:i(e.string()),community:i(e.string())}),M=e.object({visible_on_profile:e.boolean(),support_options:e.string().array()}),H=e.object({visible_on_profile:e.boolean()}),B={payload:C.payload.extend({organisation:i(I.extend({id:e.uuid().optional()})),event_details:i(N),story:i(U),supporters:i(D),funders:i($),facilitation:i(k),participants:i(w),support:i(M),action_plan:i(R.extend({actions:x.omit({assembly_id:!0}).extend({id:e.uuid().optional(),tasks:h.omit({action_id:!0,assembly_id:!0}).extend({id:e.uuid().optional()}).array(),updates:e.unknown().array()}).array(),updates:e.unknown().array()})),surveys:i(H)}),response:C.response.omit({user_id:!0}).extend({is_own:e.boolean(),organisation:i(I.extend({id:e.uuid(),created_at:o,updated_at:o})),event_details:i(N.extend({created_at:o,updated_at:o})),story:i(U.extend({created_at:o,updated_at:o})),supporters:i(D.extend({created_at:o,updated_at:o})),funders:i($.extend({created_at:o,updated_at:o})),facilitation:i(k.extend({created_at:o,updated_at:o})),participants:i(w.extend({created_at:o,updated_at:o})),support:i(M.extend({created_at:o,updated_at:o})),action_plan:i(R.extend({actions:x.omit({assembly_id:!0}).extend({id:e.uuid(),created_at:o,updated_at:e.coerce.date().transform(e=>e.toISOString()),tasks:h.omit({action_id:!0,assembly_id:!0}).extend({id:e.uuid(),created_at:e.coerce.date().transform(e=>e.toISOString()),updated_at:e.coerce.date().transform(e=>e.toISOString())}).array(),updates:e.unknown().array()}).extend({created_at:e.coerce.date().transform(e=>e.toISOString()),updated_at:e.coerce.date().transform(e=>e.toISOString())}).array(),updates:e.unknown().array()}).and(e.object({created_at:e.coerce.date().transform(e=>e.toISOString()),updated_at:e.coerce.date().transform(e=>e.toISOString())}))),surveys:i(H.extend({created_at:e.coerce.date().transform(e=>e.toISOString()),updated_at:e.coerce.date().transform(e=>e.toISOString())}).extend({data:e.record(e.string(),e.object({total:e.number().int(),responses:e.record(e.string(),d.array())}))}))})},G={payload:e.object({country:e.string(),email:e.string(),text:i(e.string())}),response:e.object({id:e.uuid(),created_at:e.coerce.date().transform(e=>e.toISOString()),updated_at:e.coerce.date().transform(e=>e.toISOString()),country:e.string(),text:i(e.string()),hide:e.boolean(),image_src:i(e.string()),has_image:e.boolean().meta({deprecated:!0})})},L={payload:e.undefined(),response:e.object({assemblies:C.response.array(),pins:G.response.array()})};export{r as ApiEndpoint,t as ApiRestMethod,a as ApiRouteParameter,P as AssembliesListSchema,B as AssemblyDetailSchema,C as AssemblyOverviewSchema,T as FeedbackSchema,_ as GetAccountReportsIdSchema,u as GetAccountReportsSchema,f as LogSchema,g as PatchAccountReportsIdDiscardSchema,m as PatchAccountReportsIdPublishSchema,y as PatchAccountReportsIdUnpublishSchema,L as PinListSchema,G as PinSchema,S as PostAccountReportsIdCoverImageSchema,l as PostAccountReportsSchema,b as PutAccountReportsIdContentSchema,j as RegisterSchema,n as SurveyName,A as SurveyResponseSchema,E as SurveySchema};
|
package/dist/schemas/api.d.ts
CHANGED
|
@@ -275,8 +275,8 @@ export declare const PostAccountReportsSchema: {
|
|
|
275
275
|
endpoint: () => AccountEndpoint;
|
|
276
276
|
method: ApiRestMethod;
|
|
277
277
|
payload: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
278
|
-
published_at: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodCoercedDate<unknown>, z.ZodTransform<string, Date>>>>, z.ZodTransform<string | null, string | null | undefined>>;
|
|
279
278
|
date: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | null, string | null | undefined>>;
|
|
279
|
+
published_at: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodCoercedDate<unknown>, z.ZodTransform<string, Date>>>>, z.ZodTransform<string | null, string | null | undefined>>;
|
|
280
280
|
title: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | null, string | null | undefined>>;
|
|
281
281
|
description: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | null, string | null | undefined>>;
|
|
282
282
|
location: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | null, string | null | undefined>>;
|
|
@@ -291,8 +291,8 @@ export declare const PostAccountReportsSchema: {
|
|
|
291
291
|
duration: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodInt>>, z.ZodTransform<number | null, number | null | undefined>>;
|
|
292
292
|
contact_information_url: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | null, string | null | undefined>>;
|
|
293
293
|
}, z.core.$strip>>>, z.ZodTransform<{
|
|
294
|
-
published_at: string | null;
|
|
295
294
|
date: string | null;
|
|
295
|
+
published_at: string | null;
|
|
296
296
|
title: string | null;
|
|
297
297
|
description: string | null;
|
|
298
298
|
location: string | null;
|
|
@@ -307,8 +307,8 @@ export declare const PostAccountReportsSchema: {
|
|
|
307
307
|
duration: number | null;
|
|
308
308
|
contact_information_url: string | null;
|
|
309
309
|
} | null, {
|
|
310
|
-
published_at: string | null;
|
|
311
310
|
date: string | null;
|
|
311
|
+
published_at: string | null;
|
|
312
312
|
title: string | null;
|
|
313
313
|
description: string | null;
|
|
314
314
|
location: string | null;
|
|
@@ -457,7 +457,6 @@ export declare const PutAccountReportsIdContentSchema: {
|
|
|
457
457
|
endpoint: (reportId: string) => AccountEndpoint;
|
|
458
458
|
method: ApiRestMethod;
|
|
459
459
|
payload: z.ZodObject<{
|
|
460
|
-
published_at: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodCoercedDate<unknown>, z.ZodTransform<string, Date>>>>, z.ZodTransform<string | null, string | null | undefined>>;
|
|
461
460
|
date: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | null, string | null | undefined>>;
|
|
462
461
|
title: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | null, string | null | undefined>>;
|
|
463
462
|
description: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | null, string | null | undefined>>;
|
|
@@ -606,7 +605,7 @@ export declare const PutAccountReportsIdContentSchema: {
|
|
|
606
605
|
export declare const PatchAccountReportsIdDiscardSchema: {
|
|
607
606
|
endpoint: (reportId: string) => AccountEndpoint;
|
|
608
607
|
method: ApiRestMethod;
|
|
609
|
-
payload: z.
|
|
608
|
+
payload: z.ZodOptional<z.ZodNullable<z.ZodObject<{}, z.core.$strip>>>;
|
|
610
609
|
response: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
611
610
|
id: z.ZodUUID;
|
|
612
611
|
created_at: z.ZodPipe<z.ZodCoercedDate<unknown>, z.ZodTransform<string, Date>>;
|
|
@@ -986,7 +985,7 @@ export declare const PatchAccountReportsIdPublishSchema: {
|
|
|
986
985
|
export declare const PatchAccountReportsIdUnpublishSchema: {
|
|
987
986
|
endpoint: (reportId: string) => AccountEndpoint;
|
|
988
987
|
method: ApiRestMethod;
|
|
989
|
-
payload: z.
|
|
988
|
+
payload: z.ZodOptional<z.ZodNullable<z.ZodObject<{}, z.core.$strip>>>;
|
|
990
989
|
response: z.ZodObject<{
|
|
991
990
|
id: z.ZodUUID;
|
|
992
991
|
created_at: z.ZodPipe<z.ZodCoercedDate<unknown>, z.ZodTransform<string, Date>>;
|
package/dist/schemas/legacy.d.ts
CHANGED
|
@@ -283,9 +283,9 @@ export declare const AssemblyDetailSchema: {
|
|
|
283
283
|
}, z.core.$strip>;
|
|
284
284
|
response: z.ZodObject<{
|
|
285
285
|
published_at: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodCoercedDate<unknown>, z.ZodTransform<string, Date>>>>, z.ZodTransform<string | null, string | null | undefined>>;
|
|
286
|
+
id: z.ZodUUID;
|
|
286
287
|
created_at: z.ZodPipe<z.ZodCoercedDate<unknown>, z.ZodTransform<string, Date>>;
|
|
287
288
|
updated_at: z.ZodPipe<z.ZodCoercedDate<unknown>, z.ZodTransform<string, Date>>;
|
|
288
|
-
id: z.ZodUUID;
|
|
289
289
|
name: z.ZodString;
|
|
290
290
|
about: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | null, string | null | undefined>>;
|
|
291
291
|
topics: z.ZodArray<z.ZodString>;
|
package/dist/types/api.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import z from 'zod';
|
|
2
|
-
import { AssembliesListSchema, AssemblyDetailSchema, AssemblyOverviewSchema, FeedbackSchema, LogSchema, PatchAccountReportsIdPublishSchema, PinListSchema, PinSchema, PostAccountReportsIdCoverImageSchema, RegisterSchema, SurveyResponseSchema, SurveySchema } from '../schemas';
|
|
2
|
+
import { AssembliesListSchema, AssemblyDetailSchema, AssemblyOverviewSchema, FeedbackSchema, LogSchema, PatchAccountReportsIdPublishSchema, PinListSchema, PinSchema, PostAccountReportsIdCoverImageSchema, PutAccountReportsIdContentSchema, RegisterSchema, SurveyResponseSchema, SurveySchema } from '../schemas';
|
|
3
|
+
export type PutAccountReportsIdContentPayload = z.infer<(typeof PutAccountReportsIdContentSchema)['payload']>;
|
|
3
4
|
export type PublishReportPayload = z.infer<(typeof PatchAccountReportsIdPublishSchema)['payload']>;
|
|
4
5
|
export type ImageMetadataPayload = z.infer<(typeof PostAccountReportsIdCoverImageSchema)['payload']>;
|
|
5
6
|
export type AssemblyDetailPayload = z.infer<(typeof AssemblyDetailSchema)['payload']>;
|
package/package.json
CHANGED
package/src/schemas/api.ts
CHANGED
|
@@ -33,7 +33,10 @@ export const PutAccountReportsIdContentSchema = {
|
|
|
33
33
|
endpoint: (reportId: string): AccountEndpoint =>
|
|
34
34
|
`${ApiEndpoint.ACCOUNT_REPORTS}/${reportId}/content`,
|
|
35
35
|
method: ApiRestMethod.PUT,
|
|
36
|
-
payload: ReportContentSchema.omit({
|
|
36
|
+
payload: ReportContentSchema.omit({
|
|
37
|
+
published_at: true,
|
|
38
|
+
cover_image_id: true
|
|
39
|
+
}),
|
|
37
40
|
response: ReportSchema
|
|
38
41
|
};
|
|
39
42
|
|
|
@@ -41,7 +44,7 @@ export const PatchAccountReportsIdDiscardSchema = {
|
|
|
41
44
|
endpoint: (reportId: string): AccountEndpoint =>
|
|
42
45
|
`${ApiEndpoint.ACCOUNT_REPORTS}/${reportId}/discard`,
|
|
43
46
|
method: ApiRestMethod.PATCH,
|
|
44
|
-
payload: z.
|
|
47
|
+
payload: z.nullish(z.object()),
|
|
45
48
|
response: maybe(ReportSchema)
|
|
46
49
|
};
|
|
47
50
|
|
|
@@ -57,7 +60,7 @@ export const PatchAccountReportsIdUnpublishSchema = {
|
|
|
57
60
|
endpoint: (reportId: string): AccountEndpoint =>
|
|
58
61
|
`${ApiEndpoint.ACCOUNT_REPORTS}/${reportId}/unpublish`,
|
|
59
62
|
method: ApiRestMethod.PATCH,
|
|
60
|
-
payload: z.
|
|
63
|
+
payload: z.nullish(z.object()),
|
|
61
64
|
response: ReportSchema
|
|
62
65
|
};
|
|
63
66
|
|
package/src/types/api.ts
CHANGED
|
@@ -9,11 +9,15 @@ import {
|
|
|
9
9
|
PinListSchema,
|
|
10
10
|
PinSchema,
|
|
11
11
|
PostAccountReportsIdCoverImageSchema,
|
|
12
|
+
PutAccountReportsIdContentSchema,
|
|
12
13
|
RegisterSchema,
|
|
13
14
|
SurveyResponseSchema,
|
|
14
15
|
SurveySchema
|
|
15
16
|
} from '../schemas';
|
|
16
17
|
|
|
18
|
+
export type PutAccountReportsIdContentPayload = z.infer<
|
|
19
|
+
(typeof PutAccountReportsIdContentSchema)['payload']
|
|
20
|
+
>;
|
|
17
21
|
export type PublishReportPayload = z.infer<
|
|
18
22
|
(typeof PatchAccountReportsIdPublishSchema)['payload']
|
|
19
23
|
>;
|