Skip to content

Commit

Permalink
fix: merge conflicts and changeset patch
Browse files Browse the repository at this point in the history
  • Loading branch information
Rajat Kaushik committed Jun 29, 2023
2 parents 58ab76f + 017332c commit 8294c73
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 15 deletions.
5 changes: 5 additions & 0 deletions .changeset/tiny-dodos-glow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@cosmicjs/sdk': patch
---

FIX: Includes type fixes and promise logic updates for catching errors correctly
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# @cosmicjs/sdk

## 1.0.8

### Patch Changes

- 70d40fa: Added contributing section in Readme

## 1.0.7

### Patch Changes

- 914eb19: Edit Readme links

## 1.0.6

### Patch Changes
Expand Down
37 changes: 24 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<a href="https://beta.cosmicjs.com/signup">
<a href="https://app.cosmicjs.com/signup">
<img src="https://imgix.cosmicjs.com/ca74e2f0-c8e4-11ed-b01d-23d7b265c299-cosmic-dashboard-dark.png?w=2000&auto=format" alt="Cosmic dashboard darkmode" />
</a>

<h1 align="center">Cosmic JavaScript SDK</h1>

[Cosmic](https://www.cosmicjs.com/) is a [headless CMS](https://www.cosmicjs.com/headless-cms) (content management system) that provides a web dashboard to create content and an API toolkit to deliver content to any website or application. Nearly any type of content can be built using the dashboard and delivered using this SDK.

[Get started free →](https://beta.cosmicjs.com/signup)
[Get started free →](https://app.cosmicjs.com/signup)

## Install

Expand All @@ -30,7 +30,7 @@ import { createBucketClient } from '@cosmicjs/sdk';

## Authentication

In the [Cosmic admin dashboard](https://beta.cosmicjs.com/login) go to _Bucket > Settings > API Access_ and get your Bucket slug and read key then set the variables in your app to connect to your Bucket.
In the [Cosmic admin dashboard](https://app.cosmicjs.com/login) go to _Bucket > Settings > API Access_ and get your Bucket slug and read key then set the variables in your app to connect to your Bucket.

```jsx
const cosmic = createBucketClient({
Expand All @@ -43,7 +43,7 @@ const cosmic = createBucketClient({

Objects are the basic building blocks of content in Cosmic.

### Get multiple Objects [[see docs](https://docs-v3.cosmicjs.com/docs/api/objects#get-objects)]
### Get multiple Objects [[see docs](https://www.cosmicjs.com/docs/api/objects#get-objects)]

Use the `objects.find()` method to fetch Objects.

Expand All @@ -58,7 +58,7 @@ const posts = await cosmic.objects

The above example fetches Objects in the `posts` Object type returning the `title`, `slug`, and `metadata` properties, limiting the response to `10` Objects.

### Get single Object by slug [[see docs](https://docs-v3.cosmicjs.com/docs/api/objects#get-a-single-object-by-slug)]
### Get single Object by slug [[see docs](https://www.cosmicjs.com/docs/api/objects#get-a-single-object-by-slug)]

Use the `objects.findOne()` method with `type` and `slug` to fetch a single Object.

Expand All @@ -83,37 +83,37 @@ const cosmic = createBucketClient({
});
```

### Create Object [[see docs](https://docs-v3.cosmicjs.com/docs/api/objects#create-an-object)]
### Create Object [[see docs](https://www.cosmicjs.com/docs/api/objects#create-an-object)]

Use the `objects.insertOne()` method to create an Object.

```jsx
await cosmic.objects.insertOne({
title: 'Blog Post Title',
type: 'posts',
content: 'Here is the blog post content... still learning',
metadata: {
content: 'Here is the blog post content... still learning',
seo_description: 'This is the blog post SEO description.',
featured_post: true,
tags: ['javascript', 'cms'],
},
});
```

### Update Object [[see docs](https://docs-v3.cosmicjs.com/docs/api/objects#update-an-object)]
### Update Object [[see docs](https://www.cosmicjs.com/docs/api/objects#update-an-object)]

Use the `objects.updateOne()` method to update an Object by specifying the Object `id` and include properties that you want to update.

```jsx
await cosmic.objects.updateOne('5ff75368c2dfa81a91695cec', {
content: 'This is the updated blog post content... I got it now!',
metadata: {
content: 'This is the updated blog post content... I got it now!',
featured_post: false,
},
});
```

### Delete Object [[see docs](https://docs-v3.cosmicjs.com/docs/api/objects#delete-an-object)]
### Delete Object [[see docs](https://www.cosmicjs.com/docs/api/objects#delete-an-object)]

Use the `objects.deleteOne()` method to delete an Object by specifying the Object `id`.

Expand All @@ -123,17 +123,28 @@ await cosmic.objects.deleteOne('5ff75368c2dfa81a91695cec');

## Learn more

Go to the [Cosmic docs](https://docs-v3.cosmicjs.com) to learn more capabilities.
Go to the [Cosmic docs](https://www.cosmicjs.com/docs) to learn more capabilities.

## Community support

For general help, please refer to [the official Cosmic documentation (v3)](https://docs-v3.cosmicjs.com). For additional help, you can use one of these channels to ask a question:
For additional help, you can use one of these channels to ask a question:

- [Slack](https://www.cosmicjs.com/community) (For live discussions with the Cosmic community and team)
- [GitHub](https://github.com/cosmicjs/cosmicjs/cosmic-sdk-js) (Bug reports, contributions)
- [Twitter](https://twitter.com/cosmicjs) (Get the latest news about Cosmic features and notifications)
- [YouTube](https://www.youtube.com/cosmicjs) (Learn from video tutorials)

## Cosmic support

- [Contact us](https://www.cosmicjs.com/contact) for help with any service questions and custom plan inquiries.

## Contributing

This project uses [changeset](https://www.npmjs.com/package/@changesets/cli) to manage releases. Follow the following steps to add a changeset:

- Run `npm run changeset` command and select type of release with description of changes.
- When PR with changeset is merged into `main` branch, Github will create a new PR with correct version change and changelog edits.
- When `codeowner` merges the generated PR, it will publish the package and create a Github release.

## License

This project is published under the [MIT](https://github.com/cosmicjs/cosmic-sdk-js/blob/HEAD/LICENSE) license.
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cosmicjs/sdk",
"version": "1.0.6",
"version": "1.0.8",
"description": "The official client module for Cosmic. This module helps you easily add dynamic content to your website or application using the Cosmic headless CMS.",
"keywords": [
"headlesscms",
Expand Down Expand Up @@ -33,6 +33,7 @@
"lint": "eslint --fix 'src/**/*.{ts,js}'",
"format": "prettier --write './src/**/*.{ts,js}'",
"release": "npm run build && changeset publish",
"changeset": "changeset",
"prepare": "husky install",
"prepublishOnly": "npm run build"
},
Expand Down Expand Up @@ -62,4 +63,4 @@
"npx eslint --fix"
]
}
}
}

0 comments on commit 8294c73

Please sign in to comment.