@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 +1 -1
- package/dist/schemas/api.d.ts +16 -0
- package/dist/schemas/base.d.ts +8 -0
- package/dist/types/enums.d.ts +1 -0
- package/dist/types/types.d.ts +2 -1
- package/package.json +1 -1
- package/src/schemas/api.ts +11 -0
- package/src/schemas/base.ts +9 -0
- package/src/types/enums.ts +1 -0
- package/src/types/types.ts +2 -0
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})}),
|
|
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};
|
package/dist/schemas/api.d.ts
CHANGED
|
@@ -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;
|
package/dist/schemas/base.d.ts
CHANGED
|
@@ -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>>;
|
package/dist/types/enums.d.ts
CHANGED
package/dist/types/types.d.ts
CHANGED
|
@@ -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
package/src/schemas/api.ts
CHANGED
|
@@ -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,
|
package/src/schemas/base.ts
CHANGED
|
@@ -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(),
|
package/src/types/enums.ts
CHANGED
package/src/types/types.ts
CHANGED
|
@@ -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>;
|