Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
tinacms-contentful
Advanced tools
Readme
tinacms-contentful
A library for using Contentful with TinaCMS
To install the package, run:
npm install tinacms-contentful contentful contentful-management
To setup TinaCMS with Contentful, you must create an instance of the TinaCMS ContentfulClient
for each space you want to edit content from.
For a single space:
import { ContentfulClient } from 'tinacms-contentful'
const contentful = new ContentfulClient({
spaceId: /* Contentful Space ID */,
defaultEnvironmentId: /* Contentful environment ID to use by default. Default: master */,
accessTokens: {
delivery: /* Contentful delivery access token for the space */,
preview: /* Contentful preview access token for the space */,
}
clientId: /* OAuth App Client ID */,
redirectUrl: /* OAuth App Callback URL */,
rateLimit: /* API Rate Limit for your Contentful Plan (Requests per second). Default: 4 */,
insecure: /* If true, uses same-site HTTPS cookies to create a session. Default: false */
})
const cms = new TinaCMS({
apis: {
contentful
}
})
Or if the CMS has already been created:
cms.registerApi('contentful', contentful)
For multiple spaces:
import { createContentfulClientForSpaces } from 'tinacms-contentful';
const spaces = [
{
spaceId: /* Contentful Space ID */,
defaultEnvironmentId: /* Contentful environment ID to use by default. Default: master */,
accessTokens: {
delivery: /* Contentful delivery access token for the space */,
preview: /* Contentful preview access token for the space */,
}
},
{
spaceId: /* Contentful Space ID */,
defaultEnvironmentId: /* Contentful environment ID to use by default. Default: master */,
accessTokens: {
delivery: /* Contentful delivery access token for the space */,
preview: /* Contentful preview access token for the space */,
}
}
]
const contentful = createClientForSpaces(spaces, {
clientId: /* OAuth App Client ID */,
redirectUrl: /* OAuth App Callback URL */,
rateLimit: /* API Rate Limit for your Contentful Plan (Requests per second). Default: 4 */,
insecure: /* If true, uses same-site HTTPS cookies to create a session. Default: false */
})
To add support for media, you must setup a media store for the space media should be uploaded to.
For a single space:
import { ContentfulClient, ContentfulMediaStore } from 'tinacms-contentful'
const contentful = new ContentfulClient({
spaceId: /* Contentful Space ID */,
defaultEnvironmentId: /* Contentful environment ID to use by default. Default: master */,
accessTokens: {
delivery: /* Contentful delivery access token for the space */,
preview: /* Contentful preview access token for the space */,
}
clientId: /* OAuth App Client ID */,
redirectUrl: /* OAuth App Callback URL */,
rateLimit: /* API Rate Limit for your Contentful Plan (Requests per second). Default: 4 */,
insecure: /* If true, uses same-site HTTPS cookies to create a session. Default: false */
})
const contentfulMediaStore = new ContentfulMediaStore(contentful);
const cms = new TinaCMS({
apis: {
contentful
},
media: contentfulMediaStore
})
For multiple spaces:
The media store is only capable of acting on a single space at a time. To change spaces dynamically, run:
const spaceId = 'example-id'
const space = cms.api.contentful[spaceId]
cms.media.store = new ContentfulMediaStore(space)
The library has the following core APIs:
There are other public APIs as well. To learn more, read the full API documentation.
Creates a TinaCMS API client for communicating with a Contentful Space.
The client takes the following constructor arguments.
The Client has the following properties:
allowedOrigins
: the FQDNs allowed to receive Oauth bearer tokens. Defaults to the window hostname.environment
: the current Contentful environment the space is communicating with.rateLimit
: the rate limit at which API operation will be throttled to.sdks
: the Contentful SDK Client instances for this space.The Client has the following methods:
authenticate
: triggers a popup window OAuth workflow .setEnvironment
: changes the environment the space is communicating with.getEntry
: fetch a published delivery
, draft preview
, or editable management
entry.getEntries
: fetch multiple published delivery
, draft preview
, or editable management
entries.createEntry
: create a new entry for a specific content model.updateEntry
: update an existing entry with new data.deleteEntry
: delete a specific entry.publishEntry
: publish a specific entry.unpublishEntry
: unpublish a specific entry.archiveEntry
: archive a specific entry.getAsset
: fetch a published delivery
, or draft preview
asset.getAssets
: fetch multiple published delivery
, or draft preview
assets.getAssetCollection
: fetch a paginated collection of published delivery
, or draft preview
assets.createAsset
: create a new asset from a file upload.updateAsset
: update an existing asset from a file upload.deleteAsset
: delete a specific asset.archiveAsset
: archive a specific asset.getContentType
: fetch a specific content type.sync
: [EXPERIMENTAL] Fetch all entries and assets from the space in the given environment to allow access without network connection.FAQs
TinaCMS API Client, Media Client, and utilities for the Contentful APIs
The npm package tinacms-contentful receives a total of 1 weekly downloads. As such, tinacms-contentful popularity was classified as not popular.
We found that tinacms-contentful demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.