{"id":22661361,"url":"https://github.com/realityloop/drupal_jsonapi_entities","last_synced_at":"2025-04-12T06:11:12.036Z","repository":{"id":44103975,"uuid":"198764132","full_name":"Realityloop/drupal_jsonapi_entities","owner":"Realityloop","description":"Drupal JSON:API Entities","archived":false,"fork":false,"pushed_at":"2025-03-28T09:41:17.000Z","size":3480,"stargazers_count":6,"open_issues_count":32,"forks_count":1,"subscribers_count":2,"default_branch":"develop","last_synced_at":"2025-03-28T10:42:28.443Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Realityloop.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2019-07-25T05:35:49.000Z","updated_at":"2022-10-25T21:31:11.000Z","dependencies_parsed_at":"2025-03-28T10:39:34.879Z","dependency_job_id":null,"html_url":"https://github.com/Realityloop/drupal_jsonapi_entities","commit_stats":{"total_commits":59,"total_committers":3,"mean_commits":"19.666666666666668","dds":0.0847457627118644,"last_synced_commit":"d94b5f9e9e676aac6c7b79786cde35d10d7c2ab0"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Realityloop%2Fdrupal_jsonapi_entities","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Realityloop%2Fdrupal_jsonapi_entities/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Realityloop%2Fdrupal_jsonapi_entities/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Realityloop%2Fdrupal_jsonapi_entities/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Realityloop","download_url":"https://codeload.github.com/Realityloop/drupal_jsonapi_entities/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248525138,"owners_count":21118619,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2024-12-09T11:15:22.838Z","updated_at":"2025-04-12T06:11:12.016Z","avatar_url":"https://github.com/Realityloop.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Drupal JSON:API Entities\n\n[![CircleCI](https://circleci.com/gh/Realityloop/drupal_jsonapi_entities.svg?style=svg)](https://circleci.com/gh/Realityloop/drupal_jsonapi_entities)\n[![Known Vulnerabilities](https://snyk.io//test/github/Realityloop/drupal_jsonapi_entities/badge.svg?targetFile=package.json)](https://snyk.io//test/github/Realityloop/drupal_jsonapi_entities?targetFile=package.json)\n[![codecov](https://codecov.io/gh/Realityloop/drupal_jsonapi_entities/branch/develop/graph/badge.svg)](https://codecov.io/gh/Realityloop/drupal_jsonapi_entities)\n\nBuild a Drupal Entity form/view field schema from your Drupal JSON:API entitiy\nwith ease.\n\n## Installation\n\n`$ npm install drupal_jsonapi_entities`\n\n## Documentation\n\n### new drupalJSONAPIEntities()\n\n```js\nimport drupalJSONAPIEntities from 'drupal_jsonapi_entities'\n\nconst drupalEntities = new drupalJSONAPIEntities(url, options)\n```\n\nThe constructor takes two arguments:\n\n- `url`: The base URL of the Drupal instance.\n- `options`: The API options.\n\n#### Available API options (`options` argument)\n\n- **auth**: An array for use authorizing the client with the Drupal instance.\n  Currently only supports OAuth2 password flow.\n  - **clientId**: The Oauth 2 Client ID.\n  - **clientSecret**: The Oauth 2 Client secret.\n  - **user**: The Drupal username.\n  - **pass**: The Drupal user passsword.\n\n### getFormSchema()\n\n```js\nconst formSchema = await drupalEntities.getFormSchema(entityType, bundle, mode)\n```\n\nThe method takes three arguments:\n\n- `entityType`: The Drupal entity type ID.\n- `bundle`: The Drupal bundle ID for the entity type.\n- `mode`: The form display mode. Default: `default`.\n\nReturns a JSON object:\n\n- **fields**: An array of field objects, sorted by weight.\n  - **cardinality**: Allowed number of values.\n  - **description**: Help text.\n  - **id**: Machine name.\n  - **property**: True if field is a property on the Drupal entity.\n  - **label**: Label.\n  - **required**: Required field.\n  - **settings**: Merged object of field settings.\n  - **type**: Field type machine name.\n  - **weight**: Form display field weight.\n  - **group**: (optional) Group.\n- **groups**: An array of Drupal Field Group module group objects, sorted by weight.\n  - **children**: Array of fields in group.\n  - **format_settings**: Settings for the display of the group.\n  - **format_type**: Type of group for display.\n  - **id**: Machine name.\n  - **label**: Label.\n  - **weight**: Weight.\n\n#### Drupal requirements\n\nJSON:API resources:\n\n- `entity_form_display--entity_form_display`\n- `field_config--field_config`\n- `field_storage_config--field_storage_config`\n\nPermissions:\n\n- `administer display modes`\n- `administer ENTITY_TYPE fields`\n\n### getViewSchema()\n\n```js\nconst viewSchema = await drupalEntities.getViewSchema(entityType, bundle, mode)\n```\n\nThe method takes three arguments:\n\n- `entityType`: The Drupal entity type ID.\n- `bundle`: The Drupal bundle ID for the entity type.\n- `mode`: The view display mode. Default: `default`.\n\nReturns a JSON object:\n\n- **fields**: An array of field objects, sorted by weight.\n  - **description**: Help text.\n  - **id**: Machine name.\n  - **property**: True if field is a property on the Drupal entity.\n  - **label**: Label.\n  - **labelPosition**: Label position.\n  - **required**: Required field.\n  - **settings**: Merged object of field settings.\n  - **thirdPartySettings**: Settings of any third party modules.\n  - **type**: Field type machine name.\n  - **weight**: Form display field weight.\n  - **group**: (optional) Group.\n- **groups**: An array of Drupal Field Group module group objects, sorted by weight.\n  - **children**: Array of fields in group.\n  - **format_settings**: Settings for the display of the group.\n  - **format_type**: Type of group for display.\n  - **id**: Machine name.\n  - **label**: Label.\n  - **weight**: Weight.\n\n#### Drupal requirements\n\nJSON:API resources:\n\n- `entity_form_display--entity_form_display`\n- `entity_view_display--entity_view_display`\n- `field_config--field_config`\n- `field_storage_config--field_storage_config`\n\nPermissions:\n\n- `administer display modes`\n- `administer ENTITY_TYPE fields`\n\n## Nuxt.js module\n\nDrupal JSON:API Entities provides a Nuxt.js module for easily caching the\nschema(s).\n\n### Getting started with Nuxt.js\n\nAdd `drupal_jsonapi_entities/nuxt` to the modules section of your\n`nuxt.config.js` file.\n\n```js\nmodule.exports = {\n  modules: [\n    // Drupal JSON:API entities.\n    [\n      'drupal_jsonapi_entities/nuxt',\n      {\n        baseUrl: process.env.API_URL,\n        auth: {\n          clientId: process.env.API_CONSUMER_CLIENT_ID,\n          clientSecret: process.env.API_CONSUMER_CLIENT_SECRET,\n          user: process.env.API_CONSUMER_USERNAME,\n          pass: process.env.API_CONSUMER_PASSWORD\n        }\n      }\n    ],\n  ]\n}\n```\n\nAdd a `drupalJSONAPIEntities` section to your `nuxt.config.js` file in the\nfollowing format for all required Entity types, Bundles, Schema types and\nModes:\n\n```js\nmodule.exports = {\n  drupalJSONAPIEntities: {\n    'entityType': { 'bundle': { 'type': [ 'mode' ] } }\n  }\n}\n```\n\nExample:\n```js\nmodule.exports = {\n  drupalJSONAPIEntities: {\n    'node': {\n      'recipe': {\n        form: [ 'default' ],\n        view: [ 'default' ],\n      }\n    }\n  }\n}\n```\n\nThe module provides a plugin, which returns the Drupal JSON:API Entities\nschema(s).\n\n```js\nthis.$drupalJSONAPIEntities()\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frealityloop%2Fdrupal_jsonapi_entities","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frealityloop%2Fdrupal_jsonapi_entities","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frealityloop%2Fdrupal_jsonapi_entities/lists"}