@open-commune/core 0.2.16 → 0.2.18
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/dtos.d.mts +1 -1
- package/dist/dtos.d.ts +1 -1
- package/dist/dtos.mjs +1 -1
- package/dist/index.d.mts +67 -56
- package/dist/index.d.ts +67 -56
- package/dist/index.mjs +3 -3
- package/dist/shared/core.BR6-3c3l.mjs +1 -0
- package/dist/shared/{core.7Us3D2yq.d.mts → core.C8czg6gz.d.mts} +31 -12
- package/dist/shared/{core.C6dz9OyV.d.ts → core.bkXizwPE.d.ts} +31 -12
- package/package.json +1 -1
- package/dist/shared/core.QEqE4rFK.mjs +0 -1
|
@@ -16,14 +16,14 @@ declare const definitionCreateDto: z.ZodObject<{
|
|
|
16
16
|
type: z.ZodEnum<{
|
|
17
17
|
number: "number";
|
|
18
18
|
boolean: "boolean";
|
|
19
|
+
json: "json";
|
|
20
|
+
date: "date";
|
|
19
21
|
text: "text";
|
|
20
22
|
"rich-text": "rich-text";
|
|
21
|
-
date: "date";
|
|
22
23
|
media: "media";
|
|
23
24
|
relation: "relation";
|
|
24
25
|
select: "select";
|
|
25
26
|
steps: "steps";
|
|
26
|
-
json: "json";
|
|
27
27
|
}>;
|
|
28
28
|
required: z.ZodDefault<z.ZodBoolean>;
|
|
29
29
|
hidden: z.ZodDefault<z.ZodBoolean>;
|
|
@@ -48,14 +48,14 @@ declare const definitionUpdateDto: z.ZodObject<{
|
|
|
48
48
|
type: z.ZodEnum<{
|
|
49
49
|
number: "number";
|
|
50
50
|
boolean: "boolean";
|
|
51
|
+
json: "json";
|
|
52
|
+
date: "date";
|
|
51
53
|
text: "text";
|
|
52
54
|
"rich-text": "rich-text";
|
|
53
|
-
date: "date";
|
|
54
55
|
media: "media";
|
|
55
56
|
relation: "relation";
|
|
56
57
|
select: "select";
|
|
57
58
|
steps: "steps";
|
|
58
|
-
json: "json";
|
|
59
59
|
}>;
|
|
60
60
|
required: z.ZodDefault<z.ZodBoolean>;
|
|
61
61
|
hidden: z.ZodDefault<z.ZodBoolean>;
|
|
@@ -151,7 +151,7 @@ declare const definitionDto: drizzle_zod.BuildSchema<"select", {
|
|
|
151
151
|
data: {
|
|
152
152
|
name: string;
|
|
153
153
|
label: string;
|
|
154
|
-
type: "number" | "boolean" | "
|
|
154
|
+
type: "number" | "boolean" | "json" | "date" | "text" | "rich-text" | "media" | "relation" | "select" | "steps";
|
|
155
155
|
required: boolean;
|
|
156
156
|
hidden: boolean;
|
|
157
157
|
options?: string[] | undefined;
|
|
@@ -171,7 +171,7 @@ declare const definitionDto: drizzle_zod.BuildSchema<"select", {
|
|
|
171
171
|
$type: {
|
|
172
172
|
name: string;
|
|
173
173
|
label: string;
|
|
174
|
-
type: "number" | "boolean" | "
|
|
174
|
+
type: "number" | "boolean" | "json" | "date" | "text" | "rich-text" | "media" | "relation" | "select" | "steps";
|
|
175
175
|
required: boolean;
|
|
176
176
|
hidden: boolean;
|
|
177
177
|
options?: string[] | undefined;
|
|
@@ -337,14 +337,14 @@ declare const definitionDto: drizzle_zod.BuildSchema<"select", {
|
|
|
337
337
|
type: z.ZodUnion<[z.ZodEnum<{
|
|
338
338
|
number: "number";
|
|
339
339
|
boolean: "boolean";
|
|
340
|
+
json: "json";
|
|
341
|
+
date: "date";
|
|
340
342
|
text: "text";
|
|
341
343
|
"rich-text": "rich-text";
|
|
342
|
-
date: "date";
|
|
343
344
|
media: "media";
|
|
344
345
|
relation: "relation";
|
|
345
346
|
select: "select";
|
|
346
347
|
steps: "steps";
|
|
347
|
-
json: "json";
|
|
348
348
|
}>, z.ZodString]>;
|
|
349
349
|
required: z.ZodDefault<z.ZodBoolean>;
|
|
350
350
|
hidden: z.ZodDefault<z.ZodBoolean>;
|
|
@@ -1945,7 +1945,7 @@ declare const collectionDefinitions: drizzle_orm_sqlite_core.SQLiteTableWithColu
|
|
|
1945
1945
|
data: {
|
|
1946
1946
|
name: string;
|
|
1947
1947
|
label: string;
|
|
1948
|
-
type: "number" | "boolean" | "
|
|
1948
|
+
type: "number" | "boolean" | "json" | "date" | "text" | "rich-text" | "media" | "relation" | "select" | "steps";
|
|
1949
1949
|
required: boolean;
|
|
1950
1950
|
hidden: boolean;
|
|
1951
1951
|
options?: string[] | undefined;
|
|
@@ -1965,7 +1965,7 @@ declare const collectionDefinitions: drizzle_orm_sqlite_core.SQLiteTableWithColu
|
|
|
1965
1965
|
$type: {
|
|
1966
1966
|
name: string;
|
|
1967
1967
|
label: string;
|
|
1968
|
-
type: "number" | "boolean" | "
|
|
1968
|
+
type: "number" | "boolean" | "json" | "date" | "text" | "rich-text" | "media" | "relation" | "select" | "steps";
|
|
1969
1969
|
required: boolean;
|
|
1970
1970
|
hidden: boolean;
|
|
1971
1971
|
options?: string[] | undefined;
|
|
@@ -2454,6 +2454,21 @@ declare const toPublicUser: ({ id, email, name, role }: User) => {
|
|
|
2454
2454
|
role: "admin" | "redacteur";
|
|
2455
2455
|
};
|
|
2456
2456
|
type PublicUser = ReturnType<typeof toPublicUser>;
|
|
2457
|
+
/**
|
|
2458
|
+
* The user as their own session sees them (`auth.login`, `auth.me`): the
|
|
2459
|
+
* public projection, and what the server decided they may see that their
|
|
2460
|
+
* role does not say. `audience`: the audience panels are shown to them.
|
|
2461
|
+
*/
|
|
2462
|
+
declare const toSessionUser: (user: User, grants: {
|
|
2463
|
+
audience: boolean;
|
|
2464
|
+
}) => {
|
|
2465
|
+
audience: boolean;
|
|
2466
|
+
id: string;
|
|
2467
|
+
email: string;
|
|
2468
|
+
name: string;
|
|
2469
|
+
role: "admin" | "redacteur";
|
|
2470
|
+
};
|
|
2471
|
+
type SessionUser = ReturnType<typeof toSessionUser>;
|
|
2457
2472
|
type InviteDto = z.infer<typeof inviteDto>;
|
|
2458
2473
|
type UserUpdateDto = z.infer<typeof userUpdateDto>;
|
|
2459
2474
|
type UpdateOwnProfileDto = z.infer<typeof updateOwnProfileDto>;
|
|
@@ -2513,6 +2528,10 @@ declare const audienceSummarySchema: z.ZodObject<{
|
|
|
2513
2528
|
name: z.ZodString;
|
|
2514
2529
|
share: z.ZodNumber;
|
|
2515
2530
|
}, z.core.$strip>>>;
|
|
2531
|
+
places: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
2532
|
+
name: z.ZodString;
|
|
2533
|
+
share: z.ZodNumber;
|
|
2534
|
+
}, z.core.$strip>>>;
|
|
2516
2535
|
campaigns: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
2517
2536
|
name: z.ZodString;
|
|
2518
2537
|
visits: z.ZodNumber;
|
|
@@ -2581,5 +2600,5 @@ type ErrorType = (typeof ERROR_TYPES)[keyof typeof ERROR_TYPES];
|
|
|
2581
2600
|
/** Narrows what a response carried to a type of the catalogue. */
|
|
2582
2601
|
declare const isErrorType: (value: unknown) => value is ErrorType;
|
|
2583
2602
|
|
|
2584
|
-
export {
|
|
2585
|
-
export type { ApiToken as A,
|
|
2603
|
+
export { entryCreateDto as $, acceptInvitationDto as G, addressSchema as H, apiTokenCreateDto as J, apiTokens as K, audienceAskDto as Q, audienceQuerySchema as T, audienceSummarySchema as V, collectionDefinitions as W, definitionCreateDto as X, definitionDto as Y, definitionUpdateDto as Z, entries as _, entryDto as a0, entrySearchHitDto as a1, entryUpdateDto as a2, invitations as a3, inviteDto as a4, isErrorType as a5, loginDto as a6, media as a7, mediaFinalizeDto as a8, mediaRequestUploadDto as a9, mediaUpdateDto as aa, organization as ab, organizationInitDto as ac, organizationUpdateDto as ad, requestPasswordResetDto as ae, sessions as af, toPublicUser as ag, toSessionUser as ah, updateOwnProfileDto as ai, userUpdateDto as aj, users as ak, AUDIENCE_PERIODS as o, schema as s, ERROR_TYPES as v };
|
|
2604
|
+
export type { ApiToken as A, UpdateOwnProfileDto as B, CollectionDefinition as C, DefinitionCreateDto as D, Entry as E, UserUpdateDto as F, Invitation as I, LoginDto as L, Media as M, NewOrganization as N, Organization as O, PublicUser as P, RequestPasswordResetDto as R, Session as S, User as U, OrganizationInitDto as a, OrganizationUpdateDto as b, NewMedia as c, MediaFinalizeDto as d, MediaUpdateDto as e, NewCollectionDefinition as f, NewEntry as g, DefinitionUpdateDto as h, EntrySearchHit as i, EntryCreateDto as j, EntryUpdateDto as k, AudienceAsk as l, AudiencePanelData as m, ErrorType as n, AcceptInvitationDto as p, Address as q, ApiTokenCreateDto as r, AudienceQuery as t, AudienceSummary as u, InviteDto as w, MediaRequestUploadDto as x, NewUser as y, SessionUser as z };
|
|
@@ -16,14 +16,14 @@ declare const definitionCreateDto: z.ZodObject<{
|
|
|
16
16
|
type: z.ZodEnum<{
|
|
17
17
|
number: "number";
|
|
18
18
|
boolean: "boolean";
|
|
19
|
+
json: "json";
|
|
20
|
+
date: "date";
|
|
19
21
|
text: "text";
|
|
20
22
|
"rich-text": "rich-text";
|
|
21
|
-
date: "date";
|
|
22
23
|
media: "media";
|
|
23
24
|
relation: "relation";
|
|
24
25
|
select: "select";
|
|
25
26
|
steps: "steps";
|
|
26
|
-
json: "json";
|
|
27
27
|
}>;
|
|
28
28
|
required: z.ZodDefault<z.ZodBoolean>;
|
|
29
29
|
hidden: z.ZodDefault<z.ZodBoolean>;
|
|
@@ -48,14 +48,14 @@ declare const definitionUpdateDto: z.ZodObject<{
|
|
|
48
48
|
type: z.ZodEnum<{
|
|
49
49
|
number: "number";
|
|
50
50
|
boolean: "boolean";
|
|
51
|
+
json: "json";
|
|
52
|
+
date: "date";
|
|
51
53
|
text: "text";
|
|
52
54
|
"rich-text": "rich-text";
|
|
53
|
-
date: "date";
|
|
54
55
|
media: "media";
|
|
55
56
|
relation: "relation";
|
|
56
57
|
select: "select";
|
|
57
58
|
steps: "steps";
|
|
58
|
-
json: "json";
|
|
59
59
|
}>;
|
|
60
60
|
required: z.ZodDefault<z.ZodBoolean>;
|
|
61
61
|
hidden: z.ZodDefault<z.ZodBoolean>;
|
|
@@ -151,7 +151,7 @@ declare const definitionDto: drizzle_zod.BuildSchema<"select", {
|
|
|
151
151
|
data: {
|
|
152
152
|
name: string;
|
|
153
153
|
label: string;
|
|
154
|
-
type: "number" | "boolean" | "
|
|
154
|
+
type: "number" | "boolean" | "json" | "date" | "text" | "rich-text" | "media" | "relation" | "select" | "steps";
|
|
155
155
|
required: boolean;
|
|
156
156
|
hidden: boolean;
|
|
157
157
|
options?: string[] | undefined;
|
|
@@ -171,7 +171,7 @@ declare const definitionDto: drizzle_zod.BuildSchema<"select", {
|
|
|
171
171
|
$type: {
|
|
172
172
|
name: string;
|
|
173
173
|
label: string;
|
|
174
|
-
type: "number" | "boolean" | "
|
|
174
|
+
type: "number" | "boolean" | "json" | "date" | "text" | "rich-text" | "media" | "relation" | "select" | "steps";
|
|
175
175
|
required: boolean;
|
|
176
176
|
hidden: boolean;
|
|
177
177
|
options?: string[] | undefined;
|
|
@@ -337,14 +337,14 @@ declare const definitionDto: drizzle_zod.BuildSchema<"select", {
|
|
|
337
337
|
type: z.ZodUnion<[z.ZodEnum<{
|
|
338
338
|
number: "number";
|
|
339
339
|
boolean: "boolean";
|
|
340
|
+
json: "json";
|
|
341
|
+
date: "date";
|
|
340
342
|
text: "text";
|
|
341
343
|
"rich-text": "rich-text";
|
|
342
|
-
date: "date";
|
|
343
344
|
media: "media";
|
|
344
345
|
relation: "relation";
|
|
345
346
|
select: "select";
|
|
346
347
|
steps: "steps";
|
|
347
|
-
json: "json";
|
|
348
348
|
}>, z.ZodString]>;
|
|
349
349
|
required: z.ZodDefault<z.ZodBoolean>;
|
|
350
350
|
hidden: z.ZodDefault<z.ZodBoolean>;
|
|
@@ -1945,7 +1945,7 @@ declare const collectionDefinitions: drizzle_orm_sqlite_core.SQLiteTableWithColu
|
|
|
1945
1945
|
data: {
|
|
1946
1946
|
name: string;
|
|
1947
1947
|
label: string;
|
|
1948
|
-
type: "number" | "boolean" | "
|
|
1948
|
+
type: "number" | "boolean" | "json" | "date" | "text" | "rich-text" | "media" | "relation" | "select" | "steps";
|
|
1949
1949
|
required: boolean;
|
|
1950
1950
|
hidden: boolean;
|
|
1951
1951
|
options?: string[] | undefined;
|
|
@@ -1965,7 +1965,7 @@ declare const collectionDefinitions: drizzle_orm_sqlite_core.SQLiteTableWithColu
|
|
|
1965
1965
|
$type: {
|
|
1966
1966
|
name: string;
|
|
1967
1967
|
label: string;
|
|
1968
|
-
type: "number" | "boolean" | "
|
|
1968
|
+
type: "number" | "boolean" | "json" | "date" | "text" | "rich-text" | "media" | "relation" | "select" | "steps";
|
|
1969
1969
|
required: boolean;
|
|
1970
1970
|
hidden: boolean;
|
|
1971
1971
|
options?: string[] | undefined;
|
|
@@ -2454,6 +2454,21 @@ declare const toPublicUser: ({ id, email, name, role }: User) => {
|
|
|
2454
2454
|
role: "admin" | "redacteur";
|
|
2455
2455
|
};
|
|
2456
2456
|
type PublicUser = ReturnType<typeof toPublicUser>;
|
|
2457
|
+
/**
|
|
2458
|
+
* The user as their own session sees them (`auth.login`, `auth.me`): the
|
|
2459
|
+
* public projection, and what the server decided they may see that their
|
|
2460
|
+
* role does not say. `audience`: the audience panels are shown to them.
|
|
2461
|
+
*/
|
|
2462
|
+
declare const toSessionUser: (user: User, grants: {
|
|
2463
|
+
audience: boolean;
|
|
2464
|
+
}) => {
|
|
2465
|
+
audience: boolean;
|
|
2466
|
+
id: string;
|
|
2467
|
+
email: string;
|
|
2468
|
+
name: string;
|
|
2469
|
+
role: "admin" | "redacteur";
|
|
2470
|
+
};
|
|
2471
|
+
type SessionUser = ReturnType<typeof toSessionUser>;
|
|
2457
2472
|
type InviteDto = z.infer<typeof inviteDto>;
|
|
2458
2473
|
type UserUpdateDto = z.infer<typeof userUpdateDto>;
|
|
2459
2474
|
type UpdateOwnProfileDto = z.infer<typeof updateOwnProfileDto>;
|
|
@@ -2513,6 +2528,10 @@ declare const audienceSummarySchema: z.ZodObject<{
|
|
|
2513
2528
|
name: z.ZodString;
|
|
2514
2529
|
share: z.ZodNumber;
|
|
2515
2530
|
}, z.core.$strip>>>;
|
|
2531
|
+
places: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
2532
|
+
name: z.ZodString;
|
|
2533
|
+
share: z.ZodNumber;
|
|
2534
|
+
}, z.core.$strip>>>;
|
|
2516
2535
|
campaigns: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
2517
2536
|
name: z.ZodString;
|
|
2518
2537
|
visits: z.ZodNumber;
|
|
@@ -2581,5 +2600,5 @@ type ErrorType = (typeof ERROR_TYPES)[keyof typeof ERROR_TYPES];
|
|
|
2581
2600
|
/** Narrows what a response carried to a type of the catalogue. */
|
|
2582
2601
|
declare const isErrorType: (value: unknown) => value is ErrorType;
|
|
2583
2602
|
|
|
2584
|
-
export {
|
|
2585
|
-
export type { ApiToken as A,
|
|
2603
|
+
export { entryCreateDto as $, acceptInvitationDto as G, addressSchema as H, apiTokenCreateDto as J, apiTokens as K, audienceAskDto as Q, audienceQuerySchema as T, audienceSummarySchema as V, collectionDefinitions as W, definitionCreateDto as X, definitionDto as Y, definitionUpdateDto as Z, entries as _, entryDto as a0, entrySearchHitDto as a1, entryUpdateDto as a2, invitations as a3, inviteDto as a4, isErrorType as a5, loginDto as a6, media as a7, mediaFinalizeDto as a8, mediaRequestUploadDto as a9, mediaUpdateDto as aa, organization as ab, organizationInitDto as ac, organizationUpdateDto as ad, requestPasswordResetDto as ae, sessions as af, toPublicUser as ag, toSessionUser as ah, updateOwnProfileDto as ai, userUpdateDto as aj, users as ak, AUDIENCE_PERIODS as o, schema as s, ERROR_TYPES as v };
|
|
2604
|
+
export type { ApiToken as A, UpdateOwnProfileDto as B, CollectionDefinition as C, DefinitionCreateDto as D, Entry as E, UserUpdateDto as F, Invitation as I, LoginDto as L, Media as M, NewOrganization as N, Organization as O, PublicUser as P, RequestPasswordResetDto as R, Session as S, User as U, OrganizationInitDto as a, OrganizationUpdateDto as b, NewMedia as c, MediaFinalizeDto as d, MediaUpdateDto as e, NewCollectionDefinition as f, NewEntry as g, DefinitionUpdateDto as h, EntrySearchHit as i, EntryCreateDto as j, EntryUpdateDto as k, AudienceAsk as l, AudiencePanelData as m, ErrorType as n, AcceptInvitationDto as p, Address as q, ApiTokenCreateDto as r, AudienceQuery as t, AudienceSummary as u, InviteDto as w, MediaRequestUploadDto as x, NewUser as y, SessionUser as z };
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{createInsertSchema as p,createUpdateSchema as c,createSelectSchema as f}from"drizzle-zod";import{z as e}from"zod";import{fieldDefinitionSchema as y,fieldReadSchema as R}from"../domains/collections/utils.mjs";import{sqliteTable as i,text as t,integer as h,uniqueIndex as C}from"drizzle-orm/sqlite-core";import{PUBLICATION_STATUSES as D,FIELD_TYPES as F}from"../domains/collections/constants.mjs";const I={id:!0,createdAt:!0,updatedAt:!0,legacyExtra:!0},z={createdBy:!0,updatedBy:!0},g={...I,...z},r=()=>t("id").primaryKey().$defaultFn(()=>crypto.randomUUID()),a=()=>t("created_at").notNull().$defaultFn(()=>new Date().toISOString()),l=()=>t("updated_at").notNull().$defaultFn(()=>new Date().toISOString()).$onUpdateFn(()=>new Date().toISOString()),u=()=>t("legacy_extra",{mode:"json"}).$type(),B=()=>t("status",{enum:D}).notNull().default("draft"),M=()=>t("published_at"),b=e.object({street:e.string().optional(),postalCode:e.string().optional(),city:e.string().optional()}),m=i("organization",{id:h("id").primaryKey().default(1),name:t("name").notNull(),type:t("type",{enum:["commune","intercommunality","syndicate","other"]}).notNull().default("commune"),slug:t("slug").notNull(),description:t("description"),address:t("address",{mode:"json"}).$type(),deployment:t("deployment",{mode:"json"}).$type(),settings:t("settings",{mode:"json"}).$type(),updatedBy:t("updated_by"),legacyExtra:u(),createdAt:a(),updatedAt:l()}),_=i("users",{id:r(),email:t("email").notNull().unique(),name:t("name").notNull(),passwordHash:t("password_hash"),role:t("role",{enum:["admin","redacteur"]}).notNull().default("redacteur"),createdAt:a(),updatedAt:l()}),A=i("sessions",{id:r(),userId:t("user_id").notNull().references(()=>_.id,{onDelete:"cascade"}),expiresAt:t("expires_at").notNull(),revokedAt:t("revoked_at"),ua:t("ua"),ip:t("ip"),createdAt:a()}),S=i("invitations",{id:r(),email:t("email").notNull(),tokenHash:t("token_hash").notNull().unique(),role:t("role",{enum:["admin","redacteur"]}).notNull().default("redacteur"),expiresAt:t("expires_at").notNull(),usedAt:t("used_at"),createdAt:a()}),E=i("api_tokens",{id:r(),name:t("name").notNull(),tokenHash:t("token_hash").notNull().unique(),lastUsedAt:t("last_used_at"),revokedAt:t("revoked_at"),createdAt:a()}),N=i("media",{id:r(),filename:t("filename").notNull(),mime:t("mime").notNull(),size:h("size").notNull(),alt:t("alt"),caption:t("caption"),objects:t("objects",{mode:"json"}).$type().notNull(),metaData:t("meta_data",{mode:"json"}).$type(),createdBy:t("created_by"),updatedBy:t("updated_by"),legacyExtra:u(),createdAt:a(),updatedAt:l()}),s=i("collection_definitions",{id:r(),name:t("name").notNull(),slug:t("slug").notNull().unique(),description:t("description"),fields:t("fields",{mode:"json"}).$type().notNull(),editor:t("editor",{mode:"json"}).$type(),display:t("display",{mode:"json"}).$type(),headings:t("headings",{mode:"json"}).$type(),createdBy:t("created_by"),updatedBy:t("updated_by"),legacyExtra:u(),createdAt:a(),updatedAt:l()}),d=i("entries",{id:r(),collectionId:t("collection_id").notNull().references(()=>s.id,{onDelete:"cascade"}),title:t("title").notNull(),slug:t("slug").notNull(),data:t("data",{mode:"json"}).$type().notNull(),related:t("related",{mode:"json"}).$type(),createdBy:t("created_by"),updatedBy:t("updated_by"),status:B(),publishedAt:M(),legacyExtra:u(),createdAt:a(),updatedAt:l()},n=>[C("entries_slug_unique").on(n.collectionId,n.slug)]),q={__proto__:null,FIELD_TYPES:F,PUBLICATION_STATUSES:D,addressSchema:b,apiTokens:E,collectionDefinitions:s,entries:d,fieldDefinitionSchema:y,invitations:S,media:N,organization:m,sessions:A,users:_},Y=p(s).omit(g).extend({fields:e.array(y).min(1),slug:e.string().optional()}),V=c(s).omit(g).extend({fields:e.array(y).min(1).optional()}),H=f(s,{fields:e.array(R).describe("The fields every entry of the collection is made of")}),O={...g,related:!0,collectionId:!0},G=p(d).omit(O).extend({slug:e.string().optional()}),Z=c(d).omit(O).extend({related:e.array(e.string()).optional()}),T=f(d,{collectionId:n=>n.describe("Id of the collection the entry belongs to"),slug:n=>n.describe("Route segment of the entry on the published site"),data:e.record(e.string(),e.unknown()).describe("Values of the collection\u2019s fields, keyed by field name"),related:e.array(e.string()).nullable().describe("Ids of the entries that reference this one"),status:n=>n.describe("Publication status; only `published` entries are on the public site")}),K=T.extend({collectionSlug:e.string().describe("Slug of the collection the entry belongs to")}),J=e.object({filename:e.string().min(1),mime:e.string().min(1),metaData:e.record(e.string(),e.string()).optional()}),Q=e.object({key:e.string().min(1),filename:e.string().min(1),mime:e.string().min(1),alt:e.string().optional(),metaData:e.record(e.string(),e.unknown()).optional()}),W=c(N).pick({alt:!0,caption:!0,filename:!0}),j={...I,updatedBy:!0},U={name:n=>n.trim().min(1)},X=p(m,U).omit(j),ee=c(m,U).omit(j),te=e.object({email:e.email(),password:e.string().min(1)}),ne=e.object({token:e.string().min(1),name:e.string().min(1).optional(),password:e.string().min(10)}),oe=e.object({email:e.email()}),ie=e.object({email:e.email(),role:e.enum(["admin","redacteur"])}),ae=e.object({id:e.string(),data:e.object({name:e.string().min(1).optional(),role:e.enum(["admin","redacteur"]).optional(),email:e.email().optional()})}),re=e.strictObject({name:e.string().trim().min(1).max(120)}),se=({id:n,email:x,name:P,role:w})=>({id:n,email:x,name:P,role:w}),le=e.object({name:e.string().min(1)}),v=[7,30,90],L=e.object({period:e.coerce.number().pipe(e.union(v.map(n=>e.literal(n)))),collection:e.string().min(1).optional(),entry:e.string().min(1).optional()}),k=e.object({name:e.string(),share:e.number()}),o=e.number().nonnegative(),de=e.object({period:e.object({from:e.string(),to:e.string(),days:e.number()}),visits:o,visitsPrevious:o.nullish(),visitors:o.nullish(),readingMs:o.nullish(),viewsPerVisit:o.nullish(),rightNow:o.nullish(),daily:e.array(e.object({day:e.string(),visits:o})),top:e.array(e.object({path:e.string(),collection:e.string().nullish(),views:o})).optional(),sources:e.array(k).optional(),devices:e.array(k).optional(),campaigns:e.array(e.object({name:e.string(),visits:o})).optional(),depth:e.object({reached25:o,reached50:o,reachedEnd:o}).nullish()}),ce=e.object({period:L.shape.period,collection:e.string().min(1).optional(),entry:e.string().min(1).optional()}).refine(n=>!n.entry||n.collection,{message:"an entry is asked within its collection",path:["collection"]}),$={AUDIENCE_UNAVAILABLE:"audience-unavailable-error",COLLECTION_NOT_FOUND:"collection-not-found-error",ENTRY_NOT_FOUND:"entry-not-found-error",INVALID_ENTRY_DATA:"invalid-entry-data-error",DUPLICATE_SLUG:"duplicate-slug-error",MEDIA_NOT_FOUND:"media-not-found-error",UNSUPPORTED_MIME:"unsupported-mime-error",UPLOAD_INCOMPLETE:"upload-incomplete-error",ORGANIZATION_NOT_INITIALIZED:"organization-not-initialized-error",ORGANIZATION_ALREADY_INITIALIZED:"organization-already-initialized-error",DEPLOY_HOOK_MISSING:"deploy-hook-missing-error",DEPLOY_FAILED:"deploy-failed-error",USER_NOT_FOUND:"user-not-found-error",SESSION_NOT_FOUND:"session-not-found-error",INVITATION_INVALID:"invitation-invalid-error",CANNOT_REMOVE_SELF:"cannot-remove-self-error",TOO_MANY_ATTEMPTS:"too-many-attempts-error"},ue=new Set(Object.values($)),me=n=>typeof n=="string"&&ue.has(n);export{v as A,A as B,S as C,E as D,$ as E,m as F,N as G,s as H,d as I,b as J,ne as a,le as b,ce as c,L as d,de as e,Y as f,H as g,V as h,G as i,T as j,K as k,Z as l,ie as m,me as n,te as o,Q as p,J as q,W as r,X as s,ee as t,oe as u,se as v,re as w,ae as x,q as y,_ as z};
|