@assemblis/contracts 1.7.0 → 1.8.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 e from"zod";var t,n,o;!function(e){e.ACCOUNT="/account",e.ACCOUNT_PROFILE="/account/profile",e.ACCOUNT_REPORTS="/account/reports",e.ADMIN="/admin",e.ADMIN_HEALTHCHECK="/admin/healthcheck",e.ADMIN_PINS="/admin/pins",e.ADMIN_REPORTS="/admin/reports",e.ADMIN_USERS="/admin/users",e.INTEREST="/interest",e.LOGS="/logs",e.PEOPLE="/people",e.PING="/ping",e.PINS="/pins",e.REGISTER="/register",e.REPORTS="/reports"}(t||(t={})),function(e){e.GET="GET",e.POST="POST",e.PUT="PUT",e.PATCH="PATCH"}(n||(n={})),function(e){e.DISCARDED="DISCARDED",e.DRAFTED="DRAFT",e.PUBLISHED="PUBLISHED",e.CHANGED="CHANGED"}(o||(o={}));const r=e.coerce.date().transform(e=>e.toISOString()),i=e=>e.nullish().transform(e=>e??null);function a(e,t){return Object.keys(t).reduce((e,n)=>e.replace(`:${n}`,t[n]),e)}const s=e.object({id:e.uuid(),created_at:r,updated_at:r,alt:e.string(),srcset:e.string(),width:e.int(),height:e.int()}),d=e.object({recaptcha_token:e.string(),email:e.email().toLowerCase().trim(),listIds:e.int().array(),firstname:e.string().nullish().transform(e=>e??void 0),lastname:e.string().nullish().transform(e=>e??void 0),country:e.string().nullish().transform(e=>e??void 0),organisation:e.string().nullish().transform(e=>e??void 0),has_assemblis_account:e.boolean().nullish().transform(e=>e??!1)}),p=e.object({published_at:i(r),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()),language:i(e.string().regex(/^[a-z]{2,3}(-[A-Za-z0-9]{2,8})*$/)),cover_image_id:i(e.string())}),l=e.object({server_id:e.uuid(),client_id:e.uuid(),display_seq:e.int(),created_at:r,updated_at:r,published_at:i(r),state:e.enum(["DISCARDED","DRAFTED","PUBLISHED","CHANGED"]),slug:i(e.string()),draft_content:i(p),published_content:i(p),media:e.object({images:s.array()})}),c=l.extend({creator_id:e.uuid()}),u=e.object({url:e.url({protocol:/^https?$/}),title:i(e.string()),platform:i(e.string())}),m=e.object({name:i(e.string()),country:i(e.string()),introduction:i(e.string()),organization:i(e.string()),links:u.array().default([]),show_on_map:e.boolean().default(!1),avatar_image_id:i(e.string())}),_=e.object({server_id:e.uuid(),slug:e.string(),created_at:r,updated_at:r,content:m,media:e.object({images:s.array()})}),g=_.extend({joined_at:r});e.object({id:e.uuid(),created_at:r,updated_at:r,sub:e.string(),is_mutirao:e.boolean()});const T=e.object({id:e.uuid(),sub:e.string(),created_at:r,updated_at:r,report_count:e.int(),email:i(e.string()),profile:i(_)}),E=e.object({id:e.uuid(),created_at:r,updated_at:r,image_src:i(e.string()),has_image:e.boolean().meta({deprecated:!0}),user_id:e.uuid().meta({deprecated:!0}),published_at:i(r),name:e.string(),about:i(e.string()),topics:e.string().array(),country:i(e.string()),hide:e.boolean().default(!1)}),h=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})}),b=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()})}),S=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()})}),P={endpoint:t.ACCOUNT_REPORTS,method:n.GET,payload:e.never(),response:e.object({reports:l.array(),total:e.int()})},y={endpoint:`${t.ACCOUNT_REPORTS}/:client_id`,method:n.GET,payload:e.never(),response:i(l)},O={endpoint:t.ACCOUNT_REPORTS,method:n.POST,payload:e.object({client_id:e.uuid(),content:i(p.omit({cover_image_id:!0}))}),response:l},R={endpoint:`${t.ACCOUNT_REPORTS}/:client_id/content`,method:n.PUT,payload:p.omit({published_at:!0,cover_image_id:!0}),response:l},C={endpoint:`${t.ACCOUNT_REPORTS}/:client_id/discard`,method:n.PATCH,payload:e.nullish(e.object()),response:i(l)},A={endpoint:`${t.ACCOUNT_REPORTS}/:client_id/publish`,method:n.PATCH,payload:e.object({published_at:r}),response:l},I={endpoint:`${t.ACCOUNT_REPORTS}/:client_id/unpublish`,method:n.PATCH,payload:e.nullish(e.object()),response:l},N={endpoint:`${t.ACCOUNT_REPORTS}/:client_id/cover-image`,method:n.POST,payload:s.pick({alt:!0}),response:l},j=10,D={endpoint:t.ACCOUNT_PROFILE,method:n.GET,payload:e.never(),response:i(_)},v={endpoint:t.ACCOUNT_PROFILE,method:n.PUT,payload:m.omit({avatar_image_id:!0}).extend({links:u.pick({url:!0}).array().max(10).default([])}),response:_},f={endpoint:`${t.ACCOUNT_PROFILE}/avatar`,method:n.POST,payload:s.pick({alt:!0}),response:_},G={endpoint:`${t.PEOPLE}/:slug`,method:n.GET,payload:e.never(),response:i(g)},U={endpoint:t.INTEREST,method:n.POST,payload:d,response:e.string()},H={endpoint:`${t.INTEREST}/assemblis`,method:n.POST,payload:d.omit({listIds:!0}),response:e.string()},$={endpoint:t.REPORTS,method:n.GET,payload:e.never(),response:e.object({reports:l.array(),total:e.int()})},L={endpoint:`${t.REPORTS}/:slug`,method:n.GET,payload:e.never(),response:i(l)},k={endpoint:t.PINS,method:n.GET,payload:e.never(),response:e.object({assemblies:E.array(),pins:h.array()})},M={endpoint:t.PINS,method:n.POST,payload:e.object({country:e.string(),email:e.string(),text:i(e.string())}),response:h},x={endpoint:t.ADMIN_REPORTS,method:n.GET,payload:e.never(),response:e.object({reports:c.array(),total:e.int()})},F={endpoint:t.ADMIN_USERS,method:n.GET,payload:e.never(),response:e.object({users:T.array(),total:e.int()})},z={endpoint:t.ADMIN_PINS,method:n.GET,payload:e.never(),response:e.object({pins:h.array()})},w={endpoint:`${t.ADMIN_PINS}/:id/hide`,method:n.PATCH,payload:e.never(),response:h},B={endpoint:t.ADMIN_HEALTHCHECK,method:n.GET,payload:e.never(),response:e.object({commit_hash:e.string().nullable(),deployed_at:e.string().nullable(),uptime_ms:e.int().nullable(),checks:e.object({database:e.enum(["ok","error"]),clerk:e.enum(["ok","error"])})})},K={endpoint:t.PING,method:n.GET,payload:e.never(),response:e.never()},q={endpoint:`${t.LOGS}/info`,method:n.POST,payload:b,response:e.string()},Z={endpoint:`${t.LOGS}/error`,method:n.POST,payload:b,response:e.string()},J={endpoint:t.REGISTER,method:n.POST,payload:S,response:e.string()};export{t as ApiEndpoint,n as ApiRestMethod,D as GetAccountProfileSchema,y as GetAccountReportsIdSchema,P as GetAccountReportsSchema,B as GetAdminHealthcheckSchema,z as GetAdminPinsSchema,x as GetAdminReportsSchema,F as GetAdminUsersSchema,G as GetPeopleSlugSchema,K as GetPingSchema,k as GetPinsSchema,$ as GetReportsSchema,L as GetReportsSlugSchema,j as MAX_PROFILE_LINKS,C as PatchAccountReportsIdDiscardSchema,A as PatchAccountReportsIdPublishSchema,I as PatchAccountReportsIdUnpublishSchema,w as PatchAdminPinHideSchema,f as PostAccountProfileAvatarSchema,N as PostAccountReportsIdCoverImageSchema,O as PostAccountReportsSchema,H as PostInterestAssemblisSchema,U as PostInterestSchema,Z as PostLogsErrorSchema,q as PostLogsInfoSchema,M as PostPinSchema,J as PostRegisterSchema,v as PutAccountProfileSchema,R as PutAccountReportsIdContentSchema,o as ReportState,a as resolvePath};
1
+ import e from"zod";var t,n,o;!function(e){e.ACCOUNT="/account",e.ACCOUNT_PROFILE="/account/profile",e.ACCOUNT_REPORTS="/account/reports",e.ADMIN="/admin",e.ADMIN_HEALTHCHECK="/admin/healthcheck",e.ADMIN_PINS="/admin/pins",e.ADMIN_REPORTS="/admin/reports",e.ADMIN_USERS="/admin/users",e.INTEREST="/interest",e.LOGS="/logs",e.PEOPLE="/people",e.PING="/ping",e.PINS="/pins",e.REGISTER="/register",e.REPORTS="/reports"}(t||(t={})),function(e){e.GET="GET",e.POST="POST",e.PUT="PUT",e.PATCH="PATCH"}(n||(n={})),function(e){e.DISCARDED="DISCARDED",e.DRAFTED="DRAFT",e.PUBLISHED="PUBLISHED",e.CHANGED="CHANGED"}(o||(o={}));const r=e.coerce.date().transform(e=>e.toISOString()),i=e=>e.nullish().transform(e=>e??null);function a(e,t){return Object.keys(t).reduce((e,n)=>e.replace(`:${n}`,t[n]),e)}const s=e.object({id:e.uuid(),created_at:r,updated_at:r,alt:e.string(),srcset:e.string(),width:e.int(),height:e.int()}),d=e.object({recaptcha_token:e.string(),email:e.email().toLowerCase().trim(),listIds:e.int().array(),firstname:e.string().nullish().transform(e=>e??void 0),lastname:e.string().nullish().transform(e=>e??void 0),country:e.string().nullish().transform(e=>e??void 0),organisation:e.string().nullish().transform(e=>e??void 0),has_assemblis_account:e.boolean().nullish().transform(e=>e??!1)}),p=e.object({published_at:i(r),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()),language:i(e.string().regex(/^[a-z]{2,3}(-[A-Za-z0-9]{2,8})*$/)),cover_image_id:i(e.string())}),l=e.object({server_id:e.uuid(),client_id:e.uuid(),display_seq:e.int(),created_at:r,updated_at:r,published_at:i(r),state:e.enum(["DISCARDED","DRAFTED","PUBLISHED","CHANGED"]),slug:i(e.string()),draft_content:i(p),published_content:i(p),media:e.object({images:s.array()})}),c=l.extend({creator_id:e.uuid()}),u=e.object({url:e.url({protocol:/^https?$/}),title:i(e.string()),platform:i(e.string())}),m=e.object({name:i(e.string()),country:i(e.string()),introduction:i(e.string()),organization:i(e.string()),links:u.array().default([]),show_on_map:e.boolean().default(!1),avatar_image_id:i(e.string())}),_=e.object({server_id:e.uuid(),slug:e.string(),created_at:r,updated_at:r,content:m,media:e.object({images:s.array()})}),g=_.extend({joined_at:r});e.object({id:e.uuid(),created_at:r,updated_at:r,sub:e.string(),is_mutirao:e.boolean()});const T=e.object({id:e.uuid(),sub:e.string(),created_at:r,updated_at:r,report_count:e.int(),email:i(e.string()),profile:i(_)}),E=e.object({id:e.uuid(),created_at:r,updated_at:r,image_src:i(e.string()),has_image:e.boolean().meta({deprecated:!0}),user_id:e.uuid().meta({deprecated:!0}),published_at:i(r),name:e.string(),about:i(e.string()),topics:e.string().array(),country:i(e.string()),hide:e.boolean().default(!1)}),h=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})}),b=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()})}),P=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()})}),S={endpoint:t.ACCOUNT_REPORTS,method:n.GET,payload:e.never(),response:e.object({reports:l.array(),total:e.int()})},y={endpoint:`${t.ACCOUNT_REPORTS}/:client_id`,method:n.GET,payload:e.never(),response:i(l)},O={endpoint:t.ACCOUNT_REPORTS,method:n.POST,payload:e.object({client_id:e.uuid(),content:i(p.omit({cover_image_id:!0}))}),response:l},R={endpoint:`${t.ACCOUNT_REPORTS}/:client_id/content`,method:n.PUT,payload:p.omit({published_at:!0,cover_image_id:!0}),response:l},C={endpoint:`${t.ACCOUNT_REPORTS}/:client_id/discard`,method:n.PATCH,payload:e.nullish(e.object()),response:i(l)},A={endpoint:`${t.ACCOUNT_REPORTS}/:client_id/publish`,method:n.PATCH,payload:e.object({published_at:r}),response:l},I={endpoint:`${t.ACCOUNT_REPORTS}/:client_id/unpublish`,method:n.PATCH,payload:e.nullish(e.object()),response:l},N={endpoint:`${t.ACCOUNT_REPORTS}/:client_id/cover-image`,method:n.POST,payload:s.pick({alt:!0}),response:l},j=10,v={endpoint:t.ACCOUNT_PROFILE,method:n.GET,payload:e.never(),response:i(_)},D={endpoint:t.ACCOUNT_PROFILE,method:n.PUT,payload:m.omit({avatar_image_id:!0}).extend({links:u.pick({url:!0}).array().max(10).default([])}),response:_},f={endpoint:`${t.ACCOUNT_PROFILE}/avatar`,method:n.POST,payload:s.pick({alt:!0}),response:_},G={endpoint:t.PEOPLE,method:n.GET,payload:e.never(),response:e.object({people:g.array(),total:e.int()})},U={endpoint:`${t.PEOPLE}/:slug`,method:n.GET,payload:e.never(),response:i(g)},H={endpoint:t.INTEREST,method:n.POST,payload:d,response:e.string()},L={endpoint:`${t.INTEREST}/assemblis`,method:n.POST,payload:d.omit({listIds:!0}),response:e.string()},$={endpoint:t.REPORTS,method:n.GET,payload:e.never(),response:e.object({reports:l.array(),total:e.int()})},k={endpoint:`${t.REPORTS}/:slug`,method:n.GET,payload:e.never(),response:i(l)},M={endpoint:t.PINS,method:n.GET,payload:e.never(),response:e.object({assemblies:E.array(),pins:h.array()})},x={endpoint:t.PINS,method:n.POST,payload:e.object({country:e.string(),email:e.string(),text:i(e.string())}),response:h},F={endpoint:t.ADMIN_REPORTS,method:n.GET,payload:e.never(),response:e.object({reports:c.array(),total:e.int()})},z={endpoint:t.ADMIN_USERS,method:n.GET,payload:e.never(),response:e.object({users:T.array(),total:e.int()})},w={endpoint:t.ADMIN_PINS,method:n.GET,payload:e.never(),response:e.object({pins:h.array()})},B={endpoint:`${t.ADMIN_PINS}/:id/hide`,method:n.PATCH,payload:e.never(),response:h},K={endpoint:t.ADMIN_HEALTHCHECK,method:n.GET,payload:e.never(),response:e.object({commit_hash:e.string().nullable(),deployed_at:e.string().nullable(),uptime_ms:e.int().nullable(),checks:e.object({database:e.enum(["ok","error"]),clerk:e.enum(["ok","error"])})})},q={endpoint:t.PING,method:n.GET,payload:e.never(),response:e.never()},Z={endpoint:`${t.LOGS}/info`,method:n.POST,payload:b,response:e.string()},J={endpoint:`${t.LOGS}/error`,method:n.POST,payload:b,response:e.string()},Q={endpoint:t.REGISTER,method:n.POST,payload:P,response:e.string()};export{t as ApiEndpoint,n as ApiRestMethod,v as GetAccountProfileSchema,y as GetAccountReportsIdSchema,S as GetAccountReportsSchema,K as GetAdminHealthcheckSchema,w as GetAdminPinsSchema,F as GetAdminReportsSchema,z as GetAdminUsersSchema,G as GetPeopleSchema,U as GetPeopleSlugSchema,q as GetPingSchema,M as GetPinsSchema,$ as GetReportsSchema,k as GetReportsSlugSchema,j as MAX_PROFILE_LINKS,C as PatchAccountReportsIdDiscardSchema,A as PatchAccountReportsIdPublishSchema,I as PatchAccountReportsIdUnpublishSchema,B as PatchAdminPinHideSchema,f as PostAccountProfileAvatarSchema,N as PostAccountReportsIdCoverImageSchema,O as PostAccountReportsSchema,L as PostInterestAssemblisSchema,H as PostInterestSchema,J as PostLogsErrorSchema,Z as PostLogsInfoSchema,x as PostPinSchema,Q as PostRegisterSchema,D as PutAccountProfileSchema,R as PutAccountReportsIdContentSchema,o as ReportState,a as resolvePath};
@@ -1612,6 +1612,45 @@ export declare const PostAccountProfileAvatarSchema: {
1612
1612
  }, z.core.$strip>;
1613
1613
  }, z.core.$strip>;
1614
1614
  };
1615
+ export declare const GetPeopleSchema: {
1616
+ endpoint: ApiEndpoint.PEOPLE;
1617
+ method: ApiRestMethod;
1618
+ payload: z.ZodNever;
1619
+ response: z.ZodObject<{
1620
+ people: z.ZodArray<z.ZodObject<{
1621
+ server_id: z.ZodUUID;
1622
+ slug: z.ZodString;
1623
+ created_at: z.ZodPipe<z.ZodCoercedDate<unknown>, z.ZodTransform<string, Date>>;
1624
+ updated_at: z.ZodPipe<z.ZodCoercedDate<unknown>, z.ZodTransform<string, Date>>;
1625
+ content: z.ZodObject<{
1626
+ name: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | null, string | null | undefined>>;
1627
+ country: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | null, string | null | undefined>>;
1628
+ introduction: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | null, string | null | undefined>>;
1629
+ organization: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | null, string | null | undefined>>;
1630
+ links: z.ZodDefault<z.ZodArray<z.ZodObject<{
1631
+ url: z.ZodURL;
1632
+ title: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | null, string | null | undefined>>;
1633
+ platform: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | null, string | null | undefined>>;
1634
+ }, z.core.$strip>>>;
1635
+ show_on_map: z.ZodDefault<z.ZodBoolean>;
1636
+ avatar_image_id: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | null, string | null | undefined>>;
1637
+ }, z.core.$strip>;
1638
+ media: z.ZodObject<{
1639
+ images: z.ZodArray<z.ZodObject<{
1640
+ id: z.ZodUUID;
1641
+ created_at: z.ZodPipe<z.ZodCoercedDate<unknown>, z.ZodTransform<string, Date>>;
1642
+ updated_at: z.ZodPipe<z.ZodCoercedDate<unknown>, z.ZodTransform<string, Date>>;
1643
+ alt: z.ZodString;
1644
+ srcset: z.ZodString;
1645
+ width: z.ZodInt;
1646
+ height: z.ZodInt;
1647
+ }, z.core.$strip>>;
1648
+ }, z.core.$strip>;
1649
+ joined_at: z.ZodPipe<z.ZodCoercedDate<unknown>, z.ZodTransform<string, Date>>;
1650
+ }, z.core.$strip>>;
1651
+ total: z.ZodInt;
1652
+ }, z.core.$strip>;
1653
+ };
1615
1654
  export declare const GetPeopleSlugSchema: {
1616
1655
  endpoint: "/people/:slug";
1617
1656
  method: ApiRestMethod;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@assemblis/contracts",
3
- "version": "1.7.0",
3
+ "version": "1.8.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -110,6 +110,16 @@ export const PostAccountProfileAvatarSchema = {
110
110
  response: ProfileSchema
111
111
  };
112
112
 
113
+ export const GetPeopleSchema = {
114
+ endpoint: ApiEndpoint.PEOPLE as const,
115
+ method: ApiRestMethod.GET,
116
+ payload: z.never(),
117
+ response: z.object({
118
+ people: PublicProfileSchema.array(),
119
+ total: z.int()
120
+ })
121
+ };
122
+
113
123
  export const GetPeopleSlugSchema = {
114
124
  endpoint: `${ApiEndpoint.PEOPLE}/:slug` as const,
115
125
  method: ApiRestMethod.GET,