@assemblis/contracts 1.2.0 → 1.3.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_REPORTS="/account/reports",e.ADMIN="/admin",e.ADMIN_HEALTHCHECK="/admin/healthcheck",e.ADMIN_PINS="/admin/pins",e.ADMIN_REPORTS="/admin/reports",e.INTEREST="/interest",e.LOGS="/logs",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 i=e.coerce.date().transform(e=>e.toISOString()),r=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:i,updated_at:i,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:r(i),title:r(e.string()),description:r(e.string()),location:r(e.string()),outputs:r(e.string().array()),initiation_type:r(e.string()),recruitment_method:r(e.string()),recruitment_description:r(e.string()),participant_count:r(e.int()),organiser_reflections:r(e.string()),organiser_report_url:r(e.string()),location_details:r(e.string()),date:r(e.string()),duration:r(e.int()),contact_information_url:r(e.string()),cover_image_id:r(e.string())}),l=e.object({server_id:e.uuid(),client_id:e.uuid(),display_seq:e.int(),created_at:i,updated_at:i,published_at:r(i),state:e.enum(["DISCARDED","DRAFTED","PUBLISHED","CHANGED"]),slug:r(e.string()),draft_content:r(p),published_content:r(p),media:e.object({images:s.array()})});e.object({id:e.uuid(),created_at:i,updated_at:i,sub:e.string(),is_mutirao:e.boolean()});const c=e.object({id:e.uuid(),created_at:i,updated_at:i,image_src:r(e.string()),has_image:e.boolean().meta({deprecated:!0}),user_id:e.uuid().meta({deprecated:!0}),published_at:r(i),name:e.string(),about:r(e.string()),topics:e.string().array(),country:r(e.string()),hide:e.boolean().default(!1)}),m=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:r(e.string()),hide:e.boolean(),image_src:r(e.string()),has_image:e.boolean().meta({deprecated:!0})}),u=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()})}),_=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()})}),g={endpoint:t.ACCOUNT_REPORTS,method:n.GET,payload:e.never(),response:e.object({reports:l.array(),total:e.int()})},T={endpoint:`${t.ACCOUNT_REPORTS}/:client_id`,method:n.GET,payload:e.never(),response:r(l)},h={endpoint:t.ACCOUNT_REPORTS,method:n.POST,payload:e.object({client_id:e.uuid(),content:r(p.omit({cover_image_id:!0}))}),response:l},b={endpoint:`${t.ACCOUNT_REPORTS}/:client_id/content`,method:n.PUT,payload:p.omit({published_at:!0,cover_image_id:!0}),response:l},E={endpoint:`${t.ACCOUNT_REPORTS}/:client_id/discard`,method:n.PATCH,payload:e.nullish(e.object()),response:r(l)},S={endpoint:`${t.ACCOUNT_REPORTS}/:client_id/publish`,method:n.PATCH,payload:e.object({published_at:i}),response:l},P={endpoint:`${t.ACCOUNT_REPORTS}/:client_id/unpublish`,method:n.PATCH,payload:e.nullish(e.object()),response:l},y={endpoint:`${t.ACCOUNT_REPORTS}/:client_id/cover-image`,method:n.POST,payload:s.pick({alt:!0}),response:l},O={endpoint:t.INTEREST,method:n.POST,payload:d,response:e.string()},R={endpoint:`${t.INTEREST}/assemblis`,method:n.POST,payload:d.omit({listIds:!0}),response:e.string()},C={endpoint:t.REPORTS,method:n.GET,payload:e.never(),response:e.object({reports:l.array(),total:e.int()})},A={endpoint:`${t.REPORTS}/:slug`,method:n.GET,payload:e.never(),response:r(l)},I={endpoint:t.PINS,method:n.GET,payload:e.never(),response:e.object({assemblies:c.array(),pins:m.array()})},N={endpoint:t.PINS,method:n.POST,payload:e.object({country:e.string(),email:e.string(),text:r(e.string())}),response:m},D={endpoint:t.ADMIN_REPORTS,method:n.GET,payload:e.never(),response:e.object({reports:l.array(),total:e.int()})},j={endpoint:t.ADMIN_PINS,method:n.GET,payload:e.never(),response:e.object({pins:m.array()})},v={endpoint:`${t.ADMIN_PINS}/:id/hide`,method:n.PATCH,payload:e.never(),response:m},G={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"])})})},f={endpoint:t.PING,method:n.GET,payload:e.never(),response:e.never()},H={endpoint:`${t.LOGS}/info`,method:n.POST,payload:u,response:e.string()},U={endpoint:`${t.LOGS}/error`,method:n.POST,payload:u,response:e.string()},$={endpoint:t.REGISTER,method:n.POST,payload:_,response:e.string()};export{t as ApiEndpoint,n as ApiRestMethod,T as GetAccountReportsIdSchema,g as GetAccountReportsSchema,G as GetAdminHealthcheckSchema,j as GetAdminPinsSchema,D as GetAdminReportsSchema,f as GetPingSchema,I as GetPinsSchema,C as GetReportsSchema,A as GetReportsSlugSchema,E as PatchAccountReportsIdDiscardSchema,S as PatchAccountReportsIdPublishSchema,P as PatchAccountReportsIdUnpublishSchema,v as PatchAdminPinHideSchema,y as PostAccountReportsIdCoverImageSchema,h as PostAccountReportsSchema,R as PostInterestAssemblisSchema,O as PostInterestSchema,U as PostLogsErrorSchema,H as PostLogsInfoSchema,N as PostPinSchema,$ as PostRegisterSchema,b as PutAccountReportsIdContentSchema,o as ReportState,a as resolvePath};
1
+ import e from"zod";var t,n,o;!function(e){e.ACCOUNT="/account",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.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 i=e.coerce.date().transform(e=>e.toISOString()),r=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:i,updated_at:i,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:r(i),title:r(e.string()),description:r(e.string()),location:r(e.string()),outputs:r(e.string().array()),initiation_type:r(e.string()),recruitment_method:r(e.string()),recruitment_description:r(e.string()),participant_count:r(e.int()),organiser_reflections:r(e.string()),organiser_report_url:r(e.string()),location_details:r(e.string()),date:r(e.string()),duration:r(e.int()),contact_information_url:r(e.string()),cover_image_id:r(e.string())}),l=e.object({server_id:e.uuid(),client_id:e.uuid(),display_seq:e.int(),created_at:i,updated_at:i,published_at:r(i),state:e.enum(["DISCARDED","DRAFTED","PUBLISHED","CHANGED"]),slug:r(e.string()),draft_content:r(p),published_content:r(p),media:e.object({images:s.array()})});e.object({id:e.uuid(),created_at:i,updated_at:i,sub:e.string(),is_mutirao:e.boolean()});const c=e.object({id:e.uuid(),sub:e.string(),created_at:i,updated_at:i,report_count:e.int(),email:r(e.string())}),u=e.object({id:e.uuid(),created_at:i,updated_at:i,image_src:r(e.string()),has_image:e.boolean().meta({deprecated:!0}),user_id:e.uuid().meta({deprecated:!0}),published_at:r(i),name:e.string(),about:r(e.string()),topics:e.string().array(),country:r(e.string()),hide:e.boolean().default(!1)}),m=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:r(e.string()),hide:e.boolean(),image_src:r(e.string()),has_image:e.boolean().meta({deprecated:!0})}),_=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()})}),g=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()})}),T={endpoint:t.ACCOUNT_REPORTS,method:n.GET,payload:e.never(),response:e.object({reports:l.array(),total:e.int()})},h={endpoint:`${t.ACCOUNT_REPORTS}/:client_id`,method:n.GET,payload:e.never(),response:r(l)},b={endpoint:t.ACCOUNT_REPORTS,method:n.POST,payload:e.object({client_id:e.uuid(),content:r(p.omit({cover_image_id:!0}))}),response:l},S={endpoint:`${t.ACCOUNT_REPORTS}/:client_id/content`,method:n.PUT,payload:p.omit({published_at:!0,cover_image_id:!0}),response:l},E={endpoint:`${t.ACCOUNT_REPORTS}/:client_id/discard`,method:n.PATCH,payload:e.nullish(e.object()),response:r(l)},y={endpoint:`${t.ACCOUNT_REPORTS}/:client_id/publish`,method:n.PATCH,payload:e.object({published_at:i}),response:l},P={endpoint:`${t.ACCOUNT_REPORTS}/:client_id/unpublish`,method:n.PATCH,payload:e.nullish(e.object()),response:l},R={endpoint:`${t.ACCOUNT_REPORTS}/:client_id/cover-image`,method:n.POST,payload:s.pick({alt:!0}),response:l},O={endpoint:t.INTEREST,method:n.POST,payload:d,response:e.string()},A={endpoint:`${t.INTEREST}/assemblis`,method:n.POST,payload:d.omit({listIds:!0}),response:e.string()},C={endpoint:t.REPORTS,method:n.GET,payload:e.never(),response:e.object({reports:l.array(),total:e.int()})},I={endpoint:`${t.REPORTS}/:slug`,method:n.GET,payload:e.never(),response:r(l)},N={endpoint:t.PINS,method:n.GET,payload:e.never(),response:e.object({assemblies:u.array(),pins:m.array()})},D={endpoint:t.PINS,method:n.POST,payload:e.object({country:e.string(),email:e.string(),text:r(e.string())}),response:m},j={endpoint:t.ADMIN_REPORTS,method:n.GET,payload:e.never(),response:e.object({reports:l.array(),total:e.int()})},v={endpoint:t.ADMIN_USERS,method:n.GET,payload:e.never(),response:e.object({users:c.array(),total:e.int()})},G={endpoint:t.ADMIN_PINS,method:n.GET,payload:e.never(),response:e.object({pins:m.array()})},f={endpoint:`${t.ADMIN_PINS}/:id/hide`,method:n.PATCH,payload:e.never(),response:m},H={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"])})})},U={endpoint:t.PING,method:n.GET,payload:e.never(),response:e.never()},$={endpoint:`${t.LOGS}/info`,method:n.POST,payload:_,response:e.string()},M={endpoint:`${t.LOGS}/error`,method:n.POST,payload:_,response:e.string()},L={endpoint:t.REGISTER,method:n.POST,payload:g,response:e.string()};export{t as ApiEndpoint,n as ApiRestMethod,h as GetAccountReportsIdSchema,T as GetAccountReportsSchema,H as GetAdminHealthcheckSchema,G as GetAdminPinsSchema,j as GetAdminReportsSchema,v as GetAdminUsersSchema,U as GetPingSchema,N as GetPinsSchema,C as GetReportsSchema,I as GetReportsSlugSchema,E as PatchAccountReportsIdDiscardSchema,y as PatchAccountReportsIdPublishSchema,P as PatchAccountReportsIdUnpublishSchema,f as PatchAdminPinHideSchema,R as PostAccountReportsIdCoverImageSchema,b as PostAccountReportsSchema,A as PostInterestAssemblisSchema,O as PostInterestSchema,M as PostLogsErrorSchema,$ as PostLogsInfoSchema,D as PostPinSchema,L as PostRegisterSchema,S as PutAccountReportsIdContentSchema,o as ReportState,a as resolvePath};
@@ -1979,6 +1979,22 @@ export declare const GetAdminReportsSchema: {
1979
1979
  total: z.ZodInt;
1980
1980
  }, z.core.$strip>;
1981
1981
  };
1982
+ export declare const GetAdminUsersSchema: {
1983
+ endpoint: ApiEndpoint.ADMIN_USERS;
1984
+ method: ApiRestMethod;
1985
+ payload: z.ZodNever;
1986
+ response: z.ZodObject<{
1987
+ users: z.ZodArray<z.ZodObject<{
1988
+ id: z.ZodUUID;
1989
+ sub: z.ZodString;
1990
+ created_at: z.ZodPipe<z.ZodCoercedDate<unknown>, z.ZodTransform<string, Date>>;
1991
+ updated_at: z.ZodPipe<z.ZodCoercedDate<unknown>, z.ZodTransform<string, Date>>;
1992
+ report_count: z.ZodInt;
1993
+ email: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | null, string | null | undefined>>;
1994
+ }, z.core.$strip>>;
1995
+ total: z.ZodInt;
1996
+ }, z.core.$strip>;
1997
+ };
1982
1998
  export declare const GetAdminPinsSchema: {
1983
1999
  endpoint: ApiEndpoint.ADMIN_PINS;
1984
2000
  method: ApiRestMethod;
@@ -173,6 +173,14 @@ export declare const UserSchema: z.ZodObject<{
173
173
  sub: z.ZodString;
174
174
  is_mutirao: z.ZodBoolean;
175
175
  }, z.core.$strip>;
176
+ export declare const AdminUserSchema: z.ZodObject<{
177
+ id: z.ZodUUID;
178
+ sub: z.ZodString;
179
+ created_at: z.ZodPipe<z.ZodCoercedDate<unknown>, z.ZodTransform<string, Date>>;
180
+ updated_at: z.ZodPipe<z.ZodCoercedDate<unknown>, z.ZodTransform<string, Date>>;
181
+ report_count: z.ZodInt;
182
+ email: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | null, string | null | undefined>>;
183
+ }, z.core.$strip>;
176
184
  export declare const AssemblySchema: z.ZodObject<{
177
185
  id: z.ZodUUID;
178
186
  created_at: z.ZodPipe<z.ZodCoercedDate<unknown>, z.ZodTransform<string, Date>>;
@@ -5,6 +5,7 @@ export declare enum ApiEndpoint {
5
5
  ADMIN_HEALTHCHECK = "/admin/healthcheck",
6
6
  ADMIN_PINS = "/admin/pins",
7
7
  ADMIN_REPORTS = "/admin/reports",
8
+ ADMIN_USERS = "/admin/users",
8
9
  INTEREST = "/interest",
9
10
  LOGS = "/logs",
10
11
  PING = "/ping",
@@ -1,5 +1,6 @@
1
1
  import z from 'zod';
2
- import { ImageSchema, PinSchema, ReportContentSchema, ReportSchema, UserSchema } from '../schemas/base';
2
+ import { AdminUserSchema, ImageSchema, PinSchema, ReportContentSchema, ReportSchema, UserSchema } from '../schemas/base';
3
+ export type AdminUser = z.infer<typeof AdminUserSchema>;
3
4
  export type Image = z.infer<typeof ImageSchema>;
4
5
  export type Pin = z.infer<typeof PinSchema>;
5
6
  export type Report = z.infer<typeof ReportSchema>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@assemblis/contracts",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -3,6 +3,7 @@ import z from 'zod';
3
3
  import { ApiEndpoint, ApiRestMethod } from '../types';
4
4
 
5
5
  import {
6
+ AdminUserSchema,
6
7
  AssemblySchema,
7
8
  ImageSchema,
8
9
  InterestSchema,
@@ -138,6 +139,16 @@ export const GetAdminReportsSchema = {
138
139
  })
139
140
  };
140
141
 
142
+ export const GetAdminUsersSchema = {
143
+ endpoint: ApiEndpoint.ADMIN_USERS as const,
144
+ method: ApiRestMethod.GET,
145
+ payload: z.never(),
146
+ response: z.object({
147
+ users: AdminUserSchema.array(),
148
+ total: z.int()
149
+ })
150
+ };
151
+
141
152
  export const GetAdminPinsSchema = {
142
153
  endpoint: ApiEndpoint.ADMIN_PINS as const,
143
154
  method: ApiRestMethod.GET,
@@ -81,6 +81,15 @@ export const UserSchema = z.object({
81
81
  is_mutirao: z.boolean()
82
82
  });
83
83
 
84
+ export const AdminUserSchema = z.object({
85
+ id: z.uuid(),
86
+ sub: z.string(),
87
+ created_at: isoDateString,
88
+ updated_at: isoDateString,
89
+ report_count: z.int(),
90
+ email: maybe(z.string())
91
+ });
92
+
84
93
  // Pins
85
94
  export const AssemblySchema = z.object({
86
95
  id: z.uuid(),
@@ -5,6 +5,7 @@ export enum ApiEndpoint {
5
5
  ADMIN_HEALTHCHECK = '/admin/healthcheck',
6
6
  ADMIN_PINS = '/admin/pins',
7
7
  ADMIN_REPORTS = '/admin/reports',
8
+ ADMIN_USERS = '/admin/users',
8
9
  INTEREST = '/interest',
9
10
  LOGS = '/logs',
10
11
  PING = '/ping',
@@ -1,6 +1,7 @@
1
1
  import z from 'zod';
2
2
 
3
3
  import {
4
+ AdminUserSchema,
4
5
  ImageSchema,
5
6
  PinSchema,
6
7
  ReportContentSchema,
@@ -8,6 +9,7 @@ import {
8
9
  UserSchema
9
10
  } from '../schemas/base';
10
11
 
12
+ export type AdminUser = z.infer<typeof AdminUserSchema>;
11
13
  export type Image = z.infer<typeof ImageSchema>;
12
14
  export type Pin = z.infer<typeof PinSchema>;
13
15
  export type Report = z.infer<typeof ReportSchema>;