diff --git a/.changeset/tiny-dodos-glow.md b/.changeset/tiny-dodos-glow.md new file mode 100644 index 0000000..605b645 --- /dev/null +++ b/.changeset/tiny-dodos-glow.md @@ -0,0 +1,5 @@ +--- +'@cosmicjs/sdk': patch +--- + +FIX: Includes type fixes and promise logic updates for catching errors correctly diff --git a/CHANGELOG.md b/CHANGELOG.md index e40ee48..9834c8d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/README.md b/README.md index 1d25e10..40fcb30 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ - + Cosmic dashboard darkmode @@ -6,7 +6,7 @@ [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 @@ -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({ @@ -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. @@ -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. @@ -83,7 +83,7 @@ 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. @@ -91,8 +91,8 @@ Use the `objects.insertOne()` method to create an Object. 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'], @@ -100,20 +100,20 @@ await cosmic.objects.insertOne({ }); ``` -### 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`. @@ -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. diff --git a/package.json b/package.json index 31ff1ce..bc8934b 100644 --- a/package.json +++ b/package.json @@ -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", @@ -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" }, @@ -62,4 +63,4 @@ "npx eslint --fix" ] } -} \ No newline at end of file +}