Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,22 @@ The AI services are containerized and deployed using:
- **Data Retention**: Configurable retention policies for processed content
- **Access Control**: Role-based access to AI capabilities

## Monorepo & pnpm notes

- This repository is a pnpm workspace (monorepo). You can run package scripts from the repository root using the package filter syntax. For example, to run the `lint` script in the `api` service from the project root run:

`pnpm --filter api run lint` (or the shorthand `pnpm api lint` when using pnpm's workspace command aliases)

- Always check your current working directory before running pnpm commands. If you're inside a package folder (for example, `services/api`), you can run scripts without the workspace filter, e.g.:

`pnpm run lint` (when your shell cwd is `/path/to/lies.exposed/services/api`)

- If you need to change directory from scripts or automation, prefer using absolute paths to avoid ambiguity. Example in a shell script:

`cd /home/andreaascari/Workspace/lies-exposed/services/api && pnpm run migration:run`

This ensures scripts behave the same regardless of the caller's current directory.

---

*This documentation is maintained alongside the codebase. For technical implementation details, refer to the source code in `services/ai-bot/` and `services/worker/`.*
*This documentation is maintained alongside the codebase. For technical implementation details, refer to the source code in `services/ai-bot/` and `services/worker/`.*
3 changes: 2 additions & 1 deletion packages/@liexp/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@
"vitest-mock-extended": "^3.1.0"
},
"peerDependencies": {
"@langchain/core": "^0.3.19",
"@langchain/core": "^0.3.78",
"@langchain/langgraph": "^0.4.9",
"@napi-rs/canvas": "^0.1.73",
"debug": "^4.4.0",
"effect": "^3.17.13",
Expand Down
6 changes: 6 additions & 0 deletions packages/@liexp/backend/src/entities/Media.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { AreaEntity } from "./Area.entity.js";
import { EventV2Entity } from "./Event.v2.entity.js";
import { KeywordEntity } from "./Keyword.entity.js";
import { LinkEntity } from "./Link.entity.js";
import { ProjectEntity } from "./Project.entity.js";
import { type SocialPostEntity } from "./SocialPost.entity.js";
import { StoryEntity } from "./Story.entity.js";
import { UserEntity } from "./User.entity.js";
Expand Down Expand Up @@ -92,5 +93,10 @@ export class MediaEntity extends DeletableEntity {
})
keywords: Relation<KeywordEntity[]>;

@ManyToMany(() => ProjectEntity, (p) => p.media, {
cascade: false,
})
projects?: Relation<ProjectEntity[]>;

socialPosts?: Relation<SocialPostEntity>[];
}
17 changes: 6 additions & 11 deletions packages/@liexp/backend/src/entities/Project.entity.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
import {
Column,
Entity,
JoinTable,
ManyToMany,
OneToMany,
type Relation,
} from "typeorm";
import { Column, Entity, JoinTable, ManyToMany, type Relation } from "typeorm";
import { AreaEntity } from "./Area.entity.js";
import { ProjectImageEntity } from "./ProjectImage.entity.js";
import { MediaEntity } from "./Media.entity.js";
import { DeletableEntity } from "./abstract/deletable.entity.js";

@Entity("project")
Expand All @@ -27,10 +20,12 @@ export class ProjectEntity extends DeletableEntity {
@Column({ type: "varchar", nullable: false })
body: string;

@OneToMany(() => ProjectImageEntity, (a) => a.project, {
@ManyToMany(() => MediaEntity, (a) => a.projects, {
cascade: ["insert"],
nullable: true,
})
media: Relation<ProjectImageEntity[]>;
@JoinTable()
media: Relation<MediaEntity[] | string[]>;

@ManyToMany(() => AreaEntity, { cascade: ["insert"] })
@JoinTable()
Expand Down
25 changes: 0 additions & 25 deletions packages/@liexp/backend/src/entities/ProjectImage.entity.ts

This file was deleted.

2 changes: 0 additions & 2 deletions packages/@liexp/backend/src/utils/data-source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import { MediaEntity } from "../entities/Media.entity.js";
import { NationEntity } from "../entities/Nation.entity.js";
import { PageEntity } from "../entities/Page.entity.js";
import { ProjectEntity } from "../entities/Project.entity.js";
import { ProjectImageEntity } from "../entities/ProjectImage.entity.js";
import { SettingEntity } from "../entities/Setting.entity.js";
import { SocialPostEntity } from "../entities/SocialPost.entity.js";
import { StoryEntity } from "../entities/Story.entity.js";
Expand Down Expand Up @@ -50,7 +49,6 @@ export const getORMConfig = (env: BACKEND_ENV): DataSourceOptions => {
GroupMemberEntity,
StoryEntity,
ProjectEntity,
ProjectImageEntity,
AreaEntity,
EventV2Entity,
MediaEntity,
Expand Down
57 changes: 0 additions & 57 deletions packages/@liexp/shared/src/endpoints/ProjectImage.endpoints.ts

This file was deleted.

4 changes: 1 addition & 3 deletions packages/@liexp/shared/src/endpoints/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { type EndpointsMapType } from "@ts-endpoint/core";
import * as GroupMember from "./GroupMember.endpoints.js";
import * as Networks from "./Network.endpoints.js";
import * as OpenGraph from "./OpenGraph.endpoints.js";
import * as ProjectImage from "./ProjectImage.endpoints.js";
import * as Stats from "./Stats.endpoints.js";
import * as User from "./User.endpoints.js";
import * as Actor from "./actor.endpoints.js";
Expand Down Expand Up @@ -55,7 +54,6 @@ interface Endpoints extends EndpointsMapType {
OpenGraph: typeof OpenGraph.openGraphs;
Page: typeof Page.pages;
Project: typeof Project.projects;
ProjectImage: typeof ProjectImage.projectImages;
Queues: typeof Queues.queues;
Stats: typeof Stats.stats;
Networks: typeof Networks.networks;
Expand Down Expand Up @@ -98,7 +96,7 @@ const Endpoints: Endpoints = {
OpenGraph: OpenGraph.openGraphs,
Page: Page.pages,
Project: Project.projects,
ProjectImage: ProjectImage.projectImages,
// ProjectImage endpoints removed
Stats: Stats.stats,
Networks: Networks.networks,
Healthcheck: Healthcheck.healthcheck,
Expand Down
3 changes: 0 additions & 3 deletions packages/@liexp/shared/src/endpoints/project.endpoints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { OptionFromNullishToNull } from "../io/http/Common/OptionFromNullishToNu
import { ListOutput, Output } from "../io/http/Common/Output.js";
import { UUID } from "../io/http/Common/UUID.js";
import * as Project from "../io/http/Project.js";
import * as ProjectImage from "../io/http/ProjectImage.js";
import { GetListQuery } from "../io/http/Query/index.js";

const SingleGroupOutput = Output(Project.Project).annotations({
Expand All @@ -32,7 +31,6 @@ const CreateBody = Schema.Struct({
color: Schema.String,
media: Schema.Array(
Schema.Struct({
kind: ProjectImage.Kind,
description: Schema.String,
location: Schema.String,
}),
Expand Down Expand Up @@ -69,7 +67,6 @@ const EditBody = nonEmptyRecordFromType({
media: OptionFromNullishToNull(
Schema.Array(
Schema.Struct({
kind: ProjectImage.Kind,
description: Schema.String,
location: Schema.String,
}),
Expand Down
2 changes: 0 additions & 2 deletions packages/@liexp/shared/src/io/http/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import * as Nation from "./Nation.js";
import * as Network from "./Network/Network.js";
import * as Page from "./Page.js";
import * as Project from "./Project.js";
import * as ProjectImage from "./ProjectImage.js";
import * as Query from "./Query/index.js";
import * as Queue from "./Queue/index.js";
import { ResourcesNames } from "./ResourcesNames.js";
Expand Down Expand Up @@ -43,7 +42,6 @@ export {
Network,
Page,
Project,
ProjectImage,
Query,
Queue,
ResourcesNames,
Expand Down
3 changes: 3 additions & 0 deletions packages/@liexp/test/src/arbitrary/Page.arbitrary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ export const PageArb: fc.Arbitrary<http.Page.Page> = Arbitrary.make(
http.Page.Page,
).map((p) => ({
...p,
path: fc
.sample(HumanReadableStringArb({ count: 5 }), 1)
.reduce((acc, s) => acc.concat(s), ""),
title: fc
.sample(HumanReadableStringArb({ count: 10 }), 1)
.reduce((acc, s) => acc.concat(s), ""),
Expand Down
67 changes: 13 additions & 54 deletions packages/@liexp/ui/src/components/Common/MarkdownRenderer.tsx
Original file line number Diff line number Diff line change
@@ -1,60 +1,19 @@
import { useBlockNoteEditor } from "@blocknote/react";
import { type BNESchemaEditor } from "@liexp/shared/lib/providers/blocknote/type.js";
import * as React from "react";
import { BNEditor } from "./BlockNote/index.js";

// export const components: MDXProviderComponentsProp = {
// // layout
// MainContent,
// // counters
// CO2LeftBudgetCounter,
// WorldPopulationCounter,
// // graphs
// CO2LevelsGraph,
// HumanPopulationGrowthGraph,
// SocietyCollapseForecastGraph: SocietyCollapseForecastGraphContainer,
// // graph examples
// NetworkExample,
// BubbleGraphExample,
// // maps
// AreasMap,
// // page content examples
// ActorPageContentExample,
// GroupPageContentExample,
// ProjectPageContentExample,
// KeywordPageContentExample,
// EventPageContentExample,
// EventSliderExample,
// // lists
// ProjectImageList,
// // components
// // DisplayXSmall,
// // DisplaySmall,
// // DisplayMedium,
// // DisplayLarge,
// FullSizeSection,
// Video,
// // GQLVoyager,
// // common tags
// // p: ParagraphMedium,
// li: ListItem,
// blockquote: BlockQuote,
// h1: ({ children }) => <Typography variant="h1">{children}</Typography>,
// h2: ({ children }) => <Typography variant="h2">{children}</Typography>,
// h3: ({ children }) => <Typography variant="h3">{children}</Typography>,
// h4: ({ children }) => <Typography variant="h4">{children}</Typography>,
// h5: ({ children }) => <Typography variant="h5">{children}</Typography>,
// h6: ({ children }) => <Typography variant="h6">{children}</Typography>,
// p: ({ children }) => (
// <Typography className="body" style={{ marginBottom: 20 }}>
// {children}
// </Typography>
// ),
// };
export const MarkdownRenderer: React.FC<{ children: string }> = ({
children,
}) => {
const [blocks, setBlocks] = React.useState<BNESchemaEditor["document"]>([]);
const editor = useBlockNoteEditor();

// export const MarkdownRenderer: React.FC = ({ children }): React.ReactElement => {
// // eslint-disable-next-line react/no-children-prop
// return <MDX components={components}>{children}</MDX>;
// };
React.useEffect(() => {
void editor.tryParseMarkdownToBlocks(children).then((blocks) => {
setBlocks(blocks as BNESchemaEditor["document"]);
});
}, [children]);

export const MarkdownRenderer: React.FC<{ children: any }> = ({ children }) => {
return <BNEditor content={children} readOnly />;
return <BNEditor content={blocks} readOnly />;
};
35 changes: 2 additions & 33 deletions packages/@liexp/ui/src/components/ProjectPageContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { formatDate } from "@liexp/shared/lib/utils/date.utils.js";
import * as O from "fp-ts/lib/Option.js";
import { pipe } from "fp-ts/lib/function.js";
import * as React from "react";

import { MarkdownRenderer } from "./Common/MarkdownRenderer.js";
import { ProjectAreasMap } from "./Graph/ProjectAreasMap.js";
import { Grid, Typography } from "./mui/index.js";
Expand All @@ -18,32 +19,6 @@ export const ProjectPageContent: React.FC<ProjectPageContentProps> = ({
...props
}) => {
const totalFunded = 0;
// const investors: Common.ByGroupOrActor[] = [];
// const totalFunded = pipe(
// metadata.ProjectTransaction,
// A.reduce(0, (acc, f) => f.transaction.amount + acc)
// );

// const investors = pipe(
// metadata.ProjectTransaction,
// A.map((f) => f.transaction.by),
// A.uniq(
// Eq.eq.contramap(Eq.eqString, (e: Common.ByGroupOrActor) =>
// e.type === "Group" ? e.group.id : e.actor.id
// )
// )
// );

// const arrested = pipe(
// metadata.Arrest,
// A.map((a) => a.who)
// );

// const protesters = pipe(
// metadata.Protest,
// A.map((p) => p.organizers),
// A.flatten
// );

return (
<Grid container>
Expand Down Expand Up @@ -81,13 +56,7 @@ export const ProjectPageContent: React.FC<ProjectPageContentProps> = ({
<Grid>
<ProjectAreasMap project={{ ...props, body }} />
<div>
<Typography variant="h4">Fondi: {totalFunded}</Typography>
{/* <GroupOrActorList
by={investors}
onByClick={() => {}}
avatarScale="scale1000"
/> */}
{/* <ProjectFundsPieGraph funds={metadata.ProjectTransaction} /> */}
<Typography variant="h4">Funds: {totalFunded}</Typography>
</div>
</Grid>
</Grid>
Expand Down
Loading
Loading