{"id":15380966,"url":"https://github.com/brrd/lodapi","last_synced_at":"2026-01-19T06:02:19.526Z","repository":{"id":66074117,"uuid":"62538804","full_name":"brrd/lodapi","owner":"brrd","description":"Node.js remote API for Lodel","archived":false,"fork":false,"pushed_at":"2024-01-19T16:23:21.000Z","size":234,"stargazers_count":1,"open_issues_count":14,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-06T15:16:38.163Z","etag":null,"topics":["api","cli","javascript","lodel","nodejs","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/brrd.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-07-04T06:57:11.000Z","updated_at":"2024-04-25T00:38:19.000Z","dependencies_parsed_at":"2024-01-12T17:49:32.534Z","dependency_job_id":"7f9922d0-a2da-4caf-a09e-6cedbe2e7709","html_url":"https://github.com/brrd/lodapi","commit_stats":{"total_commits":143,"total_committers":2,"mean_commits":71.5,"dds":0.006993006993006978,"last_synced_commit":"87f8a26ec267143d29cfcc7e757c97a7ed596731"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/brrd/lodapi","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brrd%2Flodapi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brrd%2Flodapi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brrd%2Flodapi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brrd%2Flodapi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/brrd","download_url":"https://codeload.github.com/brrd/lodapi/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brrd%2Flodapi/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28562238,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-19T03:31:16.861Z","status":"ssl_error","status_checked_at":"2026-01-19T03:31:15.069Z","response_time":67,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","cli","javascript","lodel","nodejs","typescript"],"created_at":"2024-10-01T14:25:11.936Z","updated_at":"2026-01-19T06:02:19.510Z","avatar_url":"https://github.com/brrd.png","language":"TypeScript","readme":"# Lodapi\n\n\u003e Node.js API for [Lodel](https://github.com/OpenEdition/lodel/)\n\nNote: The implementation of this toolbox is done according to my personal needs and this library is not intended to offer an exhaustive API. Feel free to contribute if you want to add your own features.\n\n## Installation\n\n```bash\nnpm i lodapi\n```\n\nor clone this repo and run:\n\n```bash\nnpm install\nnpm run build\n```\n\n## Usage\n\n```javascript\nconst LodelSession = require(\"lodapi\");\n\nconst options = {\n  concurrency: 2, // Default: Infinity\n  timeout: 10000 // Default: 30000\n};\n\n(async () =\u003e {\n  // Instantiate the class\n  const session = new LodelSession(\"https://url-to-lodel-website.com\", options);\n\n  try {\n    // Authenticate in Lodel\n    await session.auth({ login: \"user\", password: \"pwd\" });\n\n    // Then do stuff\n    const output = await session.getChildren(0);\n    console.log(output);\n\n  } catch (e) {\n    console.error(e);\n  }\n})();\n```\n\n## Warning\n\nMethods which submit data using the Lodel entity form can cause data loss depending on which type of field is visible in the form. This is due to some weird fields used by Lodel, especially for adding entities to entries. The safest way to avoid such problems is to hide those fields from the admin panel before using any dangerous method.\n\n## LodelSession methods\n\n### `auth({login: string, password: string})`\n\nAuthenticate in Lodel. See \"Usage\" on top.\n\n### `setConcurrency(concurrency: number)`\n\nSet request `concurrency` setting.\n\n### `checkLodelAdmin(noCache = false)`\n\nCheck if the current account has lodeladmin rights. The return boolean value is stored in `session.isLodelAdmin`.\n\n### `createEntity({ idParent: number, idType: number, data: {} }, defaultData: {})`\n\nCreate a new entity with type `idType` in parent `idParent`. `data` parameter contains the data sent in the form.\n\n### `createPublication({ idParent: number, idType: number, data: {}})`\n\nAlias to `createEntity()`.\n\nCreate a new publication with type `idType` in parent `idParent`. `data` parameter contains the data sent in the form.\n\n### `getAvailableTypes(idParent: number)`\n\nList possible types for children of `idParent`.\n\n### `getChildren(idParent: number)`\n\nList children entities of `idParent`.\n\n### `uploadDoc({ filepath: string, idParent: string, idType: string })`\n\nUpload a document (using OTX) located at `filepath` in publication `idParent` with type `idType`.\n\n### `uploadPdf({ filepath: string, docId: number })`\n\n**WARNING: this feature is still experimental and can potentially cause data loss.**\n\nUpload a PDF located a `filepath` as `docId` alterfichier.\n\n### `getIndex(id: number, type: \"entries\" | \"persons\")`\n\nGet information about index `id`:\n\n```javascript\n{\n  id: number,\n  idType: number;\n  relatedEntities?: number[],\n  data?: { [key: string]: string }\n}\n```\n\nThis method has two aliases: `getEntry(id: number)` and `getPerson(id: number)`.\n\n### `editIndex(id: number, type: \"entries\" | \"persons\", data: {})`\n\nEdit index `id` by posting `data` in the related edit form.\n\n### `deleteIndex(id: number, type: \"entries\" | \"persons\")`\n\nDelete index `id` with type \"entries\" or \"persons\".\n\nThis method has two aliases: `deleteEntry(id: number)` and `deletePerson(id: number)`.\n\n### `getEntryIdByName(name: string, idType: number)`\n\nGet the id of an entry from its name.\n\n### `editEntryName(id: number, name: string)`\n\nSet entry `id` name to `name`.\n\n### `editEntryType(id: number, type: number)`\n\nMove entry `id` to index `type` (it has to be within the same class). If an entry with the same name already exists in the target index, then the entry `id` will be merged into it.\n\n### `associateEntries(idEntities: number[], idEntries: number[], idType?: number)`\n\nConnect entities with entries.\n\nIf `idType` is declared then it will be used as `idtype` for all entries. Otherwise the script will run `getEntry()` on each individual entry in order to find its type (= additional requests).\n\n### `dissociateAllEntities(idEntry: number, idType?: number)`\n\nRemove association of `idEntry` with all entries.\n\nIf `idType` is not declared the script will run `getEntry()` to find it from idEntry (= additional request).\n\n### `deleteEntry(id: number)`\n\nDelete entry `id`.\n\n### `editPersonName(id: number, name?: string, familyName?: string)`\n\nSet person `id` name and/ou family name.\n\n### `resubmitEntity(docId: number)`\n\nResubmit entity form.\n\nThis is a workaround used in mergePersons(). When resubmitting an entity form, Lodel recreates the relations between entries and this entity. This is useful to remove duplicate entries : 1) rename all duplicate entries with the same (expected) name, 2) resubmit every associated entity. At the end all the entities will be related to the same entry (= the lowest id).\n\n**Since this method submits the entity form, it can cause data loss so be careful.**\n\n### `mergePersons(idBase: number, idPersons: number[])`\n\nMerge persons listed in `idPerson` in a person which will have the `idBase` data (the lowest id among all those persons will be kept by Lodel). It comes in very handy when cleaning the duplicates among authors.\n\n**Since this method submits the entity form, it can cause data loss so be careful.**\n\n### `mergeEntries(idTargetEntry: number, idEntries: number[])`\n\nMerge entries listed in `idEntries` in the entry with the id `idTargetEntry`. It comes in very handy when cleaning the duplicates among entries.\n\n### `restoreBackup(file: string)`\n\nRestore a backup. `file` is the path to the backup archive on the host.\n\n**WARNING: initial data will be lost after this.**\n\n### `sortEntities(sitename: string, list: number[])`\n\nSort entities according to `list` of ids. `sitename`, which is the name of the site in Lodel database, is required.\n\n### `listOptionsIds()`\n\nReturn a list of available options ids.\n\n### `listClasses(classType: \"entities\" | \"entries\" | \"persons\")`\n\nList classes defined in editorial model. `getDetail()` can be used to get more information about each individual class.\n\n### `getClassesData(classType: \"entities\" | \"entries\" | \"persons\")`\n\n**Lodeladmin access level is required.**\n\nGet the full data about fields and types of all classes.\n\n### `getTypes(classType: \"entities\" | \"entries\" | \"persons\", classname: string, deap: boolean)`\n\n**Lodeladmin access level is required.**\n\nList available types for an entity, entry or person class. `getDetail()` can be used to get more information about each individual type. If `deap` is true, a request is performed for each type to get its full details.\n\n### `getDetails(lo: \"entities\" | \"entries\" | \"persons\" | \"tablefields\" | \"options\", id: number)`\n\n**Lodeladmin access level is required.**\n\nGet information from the field definition form:\n\n* When `lo` is \"entities\", \"entries\" or \"persons\", get information about a type.\n* When `lo` is \"tablefields\", get information about a field.\n* When `lo` is \"options\", get information about an option field.\n\n### `getFields(classname: string, deap: boolean)`\n\n**Lodeladmin access level is required.**\n\nGet type fields. If `deap` is true, a request is performed for each field to get its full details.\n\n### `getEntityFieldsGroups()`\n\n**Lodeladmin access level is required.**\n\nGet groups of fields of the specified entity.\n\n### `listOptions()`\n\n**Lodeladmin access level is required.**\n\nList options defined in editorial model. `getDetail()` can be used to get more information about each individual option.\n\n### `listInternalStyles()`\n\n**Lodeladmin access level is required.**\n\nList internal styles defined in editorial model. `getDetail()` is not needed since this method already returns all the data about internal styles.\n\n## Examples\n\nSee `examples/` directory.\n\n## MIT License\n\nCopyright (c) 2022 Thomas Brouard\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrrd%2Flodapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrrd%2Flodapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrrd%2Flodapi/lists"}