@assemblis/contracts 1.0.0 → 1.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.
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import t from"zod";var e,n,i;!function(t){t.ACCOUNT="/account",t.ACCOUNT_REPORTS="/account/reports",t.INTEREST="/interest",t.LOGS="/logs",t.PING="/ping",t.PINS="/pins",t.REGISTER="/register",t.REPORTS="/reports"}(e||(e={})),function(t){t.GET="GET",t.POST="POST",t.PUT="PUT",t.PATCH="PATCH"}(n||(n={})),function(t){t.DISCARDED="DISCARDED",t.DRAFTED="DRAFT",t.PUBLISHED="PUBLISHED",t.CHANGED="CHANGED"}(i||(i={}));const o=t.coerce.date().transform(t=>t.toISOString()),r=t=>t.nullish().transform(t=>t??null);function a(t,e){return Object.keys(e).reduce((t,n)=>t.replace(`:${n}`,e[n]),t)}const s=t.object({id:t.uuid(),created_at:o,updated_at:o,alt:t.string(),srcset:t.string(),width:t.int(),height:t.int()}),d=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)}),p=t.object({published_at:r(o),title:r(t.string()),description:r(t.string()),location:r(t.string()),outputs:r(t.string().array()),initiation_type:r(t.string()),recruitment_method:r(t.string()),recruitment_description:r(t.string()),participant_count:r(t.int()),organiser_reflections:r(t.string()),organiser_report_url:r(t.string()),location_details:r(t.string()),date:r(t.string()),duration:r(t.int()),contact_information_url:r(t.string()),cover_image_id:r(t.string())}),c=t.object({server_id:t.uuid(),client_id:t.uuid(),display_seq:t.int(),created_at:o,updated_at:o,published_at:r(o),state:t.enum(["DISCARDED","DRAFTED","PUBLISHED","CHANGED"]),slug:r(t.string()),draft_content:r(p),published_content:r(p),media:t.object({images:s.array()})});t.object({id:t.uuid(),created_at:o,updated_at:o,sub:t.string(),is_mutirao:t.boolean()});const l=t.object({id:t.uuid(),created_at:o,updated_at:o,image_src:r(t.string()),has_image:t.boolean().meta({deprecated:!0}),user_id:t.uuid().meta({deprecated:!0}),published_at:r(o),name:t.string(),about:r(t.string()),topics:t.string().array(),country:r(t.string()),hide:t.boolean().default(!1)}),u=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:r(t.string()),hide:t.boolean(),image_src:r(t.string()),has_image:t.boolean().meta({deprecated:!0})}),g=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()})}),m=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()})}),_={endpoint:e.ACCOUNT_REPORTS,method:n.GET,payload:t.never(),response:t.object({reports:c.array(),total:t.int()})},T={endpoint:`${e.ACCOUNT_REPORTS}/:client_id`,method:n.GET,payload:t.never(),response:r(c)},S={endpoint:e.ACCOUNT_REPORTS,method:n.POST,payload:t.object({client_id:t.uuid(),content:r(p.omit({cover_image_id:!0}))}),response:c},h={endpoint:`${e.ACCOUNT_REPORTS}/:client_id/content`,method:n.PUT,payload:p.omit({published_at:!0,cover_image_id:!0}),response:c},b={endpoint:`${e.ACCOUNT_REPORTS}/:client_id/discard`,method:n.PATCH,payload:t.nullish(t.object()),response:r(c)},E={endpoint:`${e.ACCOUNT_REPORTS}/:client_id/publish`,method:n.PATCH,payload:t.object({published_at:o}),response:c},P={endpoint:`${e.ACCOUNT_REPORTS}/:client_id/unpublish`,method:n.PATCH,payload:t.nullish(t.object()),response:c},O={endpoint:`${e.ACCOUNT_REPORTS}/:client_id/cover-image`,method:n.POST,payload:s.pick({alt:!0}),response:c},R={endpoint:e.INTEREST,method:n.POST,payload:d,response:t.string()},y={endpoint:`${e.INTEREST}/assemblis`,method:n.POST,payload:d.omit({listIds:!0}),response:t.string()},C={endpoint:e.REPORTS,method:n.GET,payload:t.never(),response:t.object({reports:c.array(),total:t.int()})},A={endpoint:`${e.REPORTS}/:slug`,method:n.GET,payload:t.never(),response:r(c)},j={endpoint:e.PINS,method:n.GET,payload:t.never(),response:t.object({assemblies:l.array(),pins:u.array()})},I={endpoint:e.PINS,method:n.POST,payload:t.object({country:t.string(),email:t.string(),text:r(t.string())}),response:u},N={endpoint:`${e.PINS}/:id/hide`,method:n.PATCH,payload:t.never(),response:u},D={endpoint:e.PING,method:n.GET,payload:t.never(),response:t.never()},f={endpoint:`${e.LOGS}/info`,method:n.POST,payload:g,response:t.string()},v={endpoint:`${e.LOGS}/error`,method:n.POST,payload:g,response:t.string()},G={endpoint:e.REGISTER,method:n.POST,payload:m,response:t.string()};export{e as ApiEndpoint,n as ApiRestMethod,T as GetAccountReportsIdSchema,_ as GetAccountReportsSchema,D as GetPingSchema,j as GetPinsSchema,C as GetReportsSchema,A as GetReportsSlugSchema,b as PatchAccountReportsIdDiscardSchema,E as PatchAccountReportsIdPublishSchema,P as PatchAccountReportsIdUnpublishSchema,N as PatchPinHideSchema,O as PostAccountReportsIdCoverImageSchema,S as PostAccountReportsSchema,y as PostInterestAssemblisSchema,R as PostInterestSchema,v as PostLogsErrorSchema,f as PostLogsInfoSchema,I as PostPinSchema,G as PostRegisterSchema,h as PutAccountReportsIdContentSchema,i as ReportState,a as resolvePath};
1
+ import t from"zod";var e,n,i;!function(t){t.ACCOUNT="/account",t.ACCOUNT_REPORTS="/account/reports",t.INTEREST="/interest",t.LOGS="/logs",t.PING="/ping",t.PINS="/pins",t.REGISTER="/register",t.REPORTS="/reports"}(e||(e={})),function(t){t.GET="GET",t.POST="POST",t.PUT="PUT",t.PATCH="PATCH"}(n||(n={})),function(t){t.DISCARDED="DISCARDED",t.DRAFTED="DRAFT",t.PUBLISHED="PUBLISHED",t.CHANGED="CHANGED"}(i||(i={}));const o=t.coerce.date().transform(t=>t.toISOString()),r=t=>t.nullish().transform(t=>t??null);function a(t,e){return Object.keys(e).reduce((t,n)=>t.replace(`:${n}`,e[n]),t)}const s=t.object({id:t.uuid(),created_at:o,updated_at:o,alt:t.string(),srcset:t.string(),width:t.int(),height:t.int()}),d=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),has_assemblis_account:t.boolean().nullish().transform(t=>t??!1)}),p=t.object({published_at:r(o),title:r(t.string()),description:r(t.string()),location:r(t.string()),outputs:r(t.string().array()),initiation_type:r(t.string()),recruitment_method:r(t.string()),recruitment_description:r(t.string()),participant_count:r(t.int()),organiser_reflections:r(t.string()),organiser_report_url:r(t.string()),location_details:r(t.string()),date:r(t.string()),duration:r(t.int()),contact_information_url:r(t.string()),cover_image_id:r(t.string())}),l=t.object({server_id:t.uuid(),client_id:t.uuid(),display_seq:t.int(),created_at:o,updated_at:o,published_at:r(o),state:t.enum(["DISCARDED","DRAFTED","PUBLISHED","CHANGED"]),slug:r(t.string()),draft_content:r(p),published_content:r(p),media:t.object({images:s.array()})});t.object({id:t.uuid(),created_at:o,updated_at:o,sub:t.string(),is_mutirao:t.boolean()});const c=t.object({id:t.uuid(),created_at:o,updated_at:o,image_src:r(t.string()),has_image:t.boolean().meta({deprecated:!0}),user_id:t.uuid().meta({deprecated:!0}),published_at:r(o),name:t.string(),about:r(t.string()),topics:t.string().array(),country:r(t.string()),hide:t.boolean().default(!1)}),u=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:r(t.string()),hide:t.boolean(),image_src:r(t.string()),has_image:t.boolean().meta({deprecated:!0})}),g=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()})}),m=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()})}),_={endpoint:e.ACCOUNT_REPORTS,method:n.GET,payload:t.never(),response:t.object({reports:l.array(),total:t.int()})},T={endpoint:`${e.ACCOUNT_REPORTS}/:client_id`,method:n.GET,payload:t.never(),response:r(l)},h={endpoint:e.ACCOUNT_REPORTS,method:n.POST,payload:t.object({client_id:t.uuid(),content:r(p.omit({cover_image_id:!0}))}),response:l},S={endpoint:`${e.ACCOUNT_REPORTS}/:client_id/content`,method:n.PUT,payload:p.omit({published_at:!0,cover_image_id:!0}),response:l},b={endpoint:`${e.ACCOUNT_REPORTS}/:client_id/discard`,method:n.PATCH,payload:t.nullish(t.object()),response:r(l)},E={endpoint:`${e.ACCOUNT_REPORTS}/:client_id/publish`,method:n.PATCH,payload:t.object({published_at:o}),response:l},P={endpoint:`${e.ACCOUNT_REPORTS}/:client_id/unpublish`,method:n.PATCH,payload:t.nullish(t.object()),response:l},O={endpoint:`${e.ACCOUNT_REPORTS}/:client_id/cover-image`,method:n.POST,payload:s.pick({alt:!0}),response:l},R={endpoint:e.INTEREST,method:n.POST,payload:d,response:t.string()},y={endpoint:`${e.INTEREST}/assemblis`,method:n.POST,payload:d.omit({listIds:!0}),response:t.string()},C={endpoint:e.REPORTS,method:n.GET,payload:t.never(),response:t.object({reports:l.array(),total:t.int()})},A={endpoint:`${e.REPORTS}/:slug`,method:n.GET,payload:t.never(),response:r(l)},j={endpoint:e.PINS,method:n.GET,payload:t.never(),response:t.object({assemblies:c.array(),pins:u.array()})},I={endpoint:e.PINS,method:n.POST,payload:t.object({country:t.string(),email:t.string(),text:r(t.string())}),response:u},N={endpoint:`${e.PINS}/:id/hide`,method:n.PATCH,payload:t.never(),response:u},f={endpoint:e.PING,method:n.GET,payload:t.never(),response:t.never()},D={endpoint:`${e.LOGS}/info`,method:n.POST,payload:g,response:t.string()},v={endpoint:`${e.LOGS}/error`,method:n.POST,payload:g,response:t.string()},G={endpoint:e.REGISTER,method:n.POST,payload:m,response:t.string()};export{e as ApiEndpoint,n as ApiRestMethod,T as GetAccountReportsIdSchema,_ as GetAccountReportsSchema,f as GetPingSchema,j as GetPinsSchema,C as GetReportsSchema,A as GetReportsSlugSchema,b as PatchAccountReportsIdDiscardSchema,E as PatchAccountReportsIdPublishSchema,P as PatchAccountReportsIdUnpublishSchema,N as PatchPinHideSchema,O as PostAccountReportsIdCoverImageSchema,h as PostAccountReportsSchema,y as PostInterestAssemblisSchema,R as PostInterestSchema,v as PostLogsErrorSchema,D as PostLogsInfoSchema,I as PostPinSchema,G as PostRegisterSchema,S as PutAccountReportsIdContentSchema,i as ReportState,a as resolvePath};
@@ -1388,6 +1388,7 @@ export declare const PostInterestSchema: {
1388
1388
  lastname: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | undefined, string | null | undefined>>;
1389
1389
  country: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | undefined, string | null | undefined>>;
1390
1390
  organisation: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | undefined, string | null | undefined>>;
1391
+ has_assemblis_account: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodBoolean>>, z.ZodTransform<boolean, boolean | null | undefined>>;
1391
1392
  }, z.core.$strip>;
1392
1393
  response: z.ZodString;
1393
1394
  };
@@ -1401,6 +1402,7 @@ export declare const PostInterestAssemblisSchema: {
1401
1402
  lastname: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | undefined, string | null | undefined>>;
1402
1403
  country: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | undefined, string | null | undefined>>;
1403
1404
  organisation: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | undefined, string | null | undefined>>;
1405
+ has_assemblis_account: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodBoolean>>, z.ZodTransform<boolean, boolean | null | undefined>>;
1404
1406
  }, z.core.$strip>;
1405
1407
  response: z.ZodString;
1406
1408
  };
@@ -16,6 +16,7 @@ export declare const InterestSchema: z.ZodObject<{
16
16
  lastname: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | undefined, string | null | undefined>>;
17
17
  country: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | undefined, string | null | undefined>>;
18
18
  organisation: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | undefined, string | null | undefined>>;
19
+ has_assemblis_account: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodBoolean>>, z.ZodTransform<boolean, boolean | null | undefined>>;
19
20
  }, z.core.$strip>;
20
21
  export declare const ReportContentSchema: z.ZodObject<{
21
22
  published_at: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodCoercedDate<unknown>, z.ZodTransform<string, Date>>>>, z.ZodTransform<string | null, string | null | undefined>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@assemblis/contracts",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -33,7 +33,11 @@ export const InterestSchema = z.object({
33
33
  organisation: z
34
34
  .string()
35
35
  .nullish()
36
- .transform((_) => _ ?? undefined)
36
+ .transform((_) => _ ?? undefined),
37
+ has_assemblis_account: z
38
+ .boolean()
39
+ .nullish()
40
+ .transform((_) => _ ?? false)
37
41
  });
38
42
 
39
43
  export const ReportContentSchema = z.object({