Javascript client for Sanity. Works in node.js and modern browsers (older browsers needs a Promise polyfill).

Overview

@sanity/client

npm version

Javascript client for Sanity. Works in node.js and modern browsers (older browsers needs a Promise polyfill).

Requirements

Sanity Client requires the JavaScript runtime to have a global ES6-compliant Promise available. If your runtime environment doesn't provide a spec compliant Promise implementation, we recommend using native-promise-only, es6-promise or another spec-compliant implementation. See this article for more information.

Installation

The client can be installed from npm:

npm install -g @sanity/client

API

const sanityClient = require('@sanity/client')
const client = sanityClient({
  projectId: 'your-project-id',
  dataset: 'bikeshop',
  apiVersion: '2021-03-25', // use current UTC date - see "specifying API version"!
  token: 'sanity-auth-token', // or leave blank for unauthenticated usage
  useCdn: true, // `false` if you want to ensure fresh data
})

const client = sanityClient(options)

Initializes a new Sanity Client. Required options are projectId, dataset, and apiVersion. Setting a value for useCdn is encouraged.

Specifying API version

Sanity uses ISO dates (YYYY-MM-DD) in UTC timezone for versioning. The explanation for this can be found in the documentation

In general, unless you know what API version you want to use, you'll want to set it to today's UTC date. By doing this, you'll get all the latest bugfixes and features, while locking the API to prevent breaking changes.

Note: Do not be tempted to use a dynamic value for the apiVersion. The reason for setting a static value is to prevent unexpected, breaking changes.

In future versions, specifying an API version will be required. For now (to maintain backwards compatiblity) not specifying a version will trigger a deprecation warning and fall back to using v1.

Performing queries

= $minSeats] {name, seats}' const params = {minSeats: 2} client.fetch(query, params).then((bikes) => { console.log('Bikes with more than one seat:') bikes.forEach((bike) => { console.log(`${bike.name} (${bike.seats} seats)`) }) })">
const query = '*[_type == "bike" && seats >= $minSeats] {name, seats}'
const params = {minSeats: 2}

client.fetch(query, params).then((bikes) => {
  console.log('Bikes with more than one seat:')
  bikes.forEach((bike) => {
    console.log(`${bike.name} (${bike.seats} seats)`)
  })
})

client.fetch(query, params = {})

Perform a query using the given parameters (if any).

Listening to queries

{ const comment = update.result console.log(`${comment.author} commented: ${comment.text}`) }) // to unsubscribe later on subscription.unsubscribe()">
const query = '*[_type == "comment" && authorId != $ownerId]'
const params = {ownerId: 'bikeOwnerUserId'}

const subscription = client.listen(query, params).subscribe((update) => {
  const comment = update.result
  console.log(`${comment.author} commented: ${comment.text}`)
})

// to unsubscribe later on
subscription.unsubscribe()

client.listen(query, params = {}, options = {includeResult: true})

Open a query that listens for updates on matched documents, using the given parameters (if any). The return value is an RxJS Observable. When calling .subscribe() on the returned observable, a subscription is returned, and this can be used to unsubscribe from the query later on by calling subscription.unsubscribe()

The update events which are emitted always contain mutation, which is an object containing the mutation which triggered the document to appear as part of the query.

By default, the emitted update event will also contain a result property, which contains the document with the mutation applied to it. In case of a delete mutation, this property will not be present, however. You can also tell the client not to return the document (to save bandwidth, or in cases where the mutation or the document ID is the only relevant factor) by setting the includeResult property to false in the options.

Likewise, you can also have the client return the document before the mutation was applied, by setting includePreviousRevision to true in the options, which will include a previous property in each emitted object.

Fetch a single document

This will fetch a document from the Doc endpoint. This endpoint cuts through any caching/indexing middleware that may involve delayed processing. As it is less scalable/performant than the other query mechanisms, it should be used sparingly. Performing a query is usually a better option.

client.getDocument('bike-123').then((bike) => {
  console.log(`${bike.name} (${bike.seats} seats)`)
})

Fetch multiple documents in one go

This will fetch multiple documents in one request from the Doc endpoint. This endpoint cuts through any caching/indexing middleware that may involve delayed processing. As it is less scalable/performant than the other query mechanisms, it should be used sparingly. Performing a query is usually a better option.

client.getDocuments(['bike123', 'bike345']).then(([bike123, bike345]) => {
  console.log(`Bike 123: ${bike123.name} (${bike123.seats} seats)`)
  console.log(`Bike 345: ${bike345.name} (${bike345.seats} seats)`)
})

Note: Unlike in the HTTP API, the order/position of documents is preserved based on the original array of IDs. If any of the documents are missing, they will be replaced by a null entry in the returned array:

const ids = ['bike123', 'nonexistent-document', 'bike345']
client.getDocuments(ids).then((docs) => {
  // the docs array will be:
  // [{_id: 'bike123', ...}, null, {_id: 'bike345', ...}]
})

Creating documents

const doc = {
  _type: 'bike',
  name: 'Sanity Tandem Extraordinaire',
  seats: 2,
}

client.create(doc).then((res) => {
  console.log(`Bike was created, document ID is ${res._id}`)
})

client.create(doc)

Create a document. Argument is a plain JS object representing the document. It must contain a _type attribute. It may contain an _id. If an ID is not specified, it will automatically be created.

To create a draft document, add an _id attribute set to 'drafts.'.

Creating/replacing documents

const doc = {
  _id: 'my-bike',
  _type: 'bike',
  name: 'Sanity Tandem Extraordinaire',
  seats: 2,
}

client.createOrReplace(doc).then((res) => {
  console.log(`Bike was created, document ID is ${res._id}`)
})

client.createOrReplace(doc)

If you are not sure whether or not a document exists but want to overwrite it if it does, you can use the createOrReplace() method. When using this method, the document must contain an _id attribute.

Creating if not already present

const doc = {
  _id: 'my-bike',
  _type: 'bike',
  name: 'Sanity Tandem Extraordinaire',
  seats: 2,
}

client.createIfNotExists(doc).then((res) => {
  console.log('Bike was created (or was already present)')
})

client.createIfNotExists(doc)

If you want to create a document if it does not already exist, but fall back without error if it does, you can use the createIfNotExists() method. When using this method, the document must contain an _id attribute.

Patch/update a document

client
  .patch('bike-123') // Document ID to patch
  .set({inStock: false}) // Shallow merge
  .inc({numSold: 1}) // Increment field by count
  .commit() // Perform the patch and return a promise
  .then((updatedBike) => {
    console.log('Hurray, the bike is updated! New document:')
    console.log(updatedBike)
  })
  .catch((err) => {
    console.error('Oh no, the update failed: ', err.message)
  })

Modify a document. patch takes a document ID. set merges the partialDoc with the stored document. inc increments the given field with the given numeric value. commit executes the given patch. Returns the updated object.

Setting a field only if not already present

client.patch('bike-123').setIfMissing({title: 'Untitled bike'}).commit()

Removing/unsetting fields

client.patch('bike-123').unset(['title', 'price']).commit()

Incrementing/decrementing numbers

client
  .patch('bike-123')
  .inc({price: 88, numSales: 1}) // Increment `price` by 88, `numSales` by 1
  .dec({inStock: 1}) // Decrement `inStock` by 1
  .commit()

Patch a document only if revision matches

You can use the ifRevisionId(rev) method to specify that you only want the patch to be applied if the stored document matches a given revision.

client
  .patch('bike-123')
  .ifRevisionId('previously-known-revision')
  .set({title: 'Little Red Tricycle'})
  .commit()

Adding elements to an array

The patch operation insert takes a location (before, after or replace), a path selector and an array of elements to insert.

const {nanoid} = require('nanoid')

client
  .patch('bike-123')
  // Ensure that the `reviews` arrays exists before attempting to add items to it
  .setIfMissing({reviews: []})
  // Add the items after the last item in the array (append)
  .insert('after', 'reviews[-1]', [
    // Add a `_key` unique within the array to ensure it can be addressed uniquely
    // in a real-time collaboration context
    {_key: nanoid(), title: 'Great bike!', stars: 5},
  ])
  .commit()

Appending/prepending elements to an array

The operations of appending and prepending to an array are so common that they have been given their own methods for better readability:

const {nanoid} = require('nanoid')

client
  .patch('bike-123')
  .setIfMissing({reviews: []})
  .append('reviews', [{_key: nanoid(), title: 'Great bike!', stars: 5}])
  .commit()

Deleting an element from an array

Each entry in the unset array can be either an attribute or a JSON path.

In this example, we remove the first review and the review with _key: 'abc123' from the bike.reviews array:

const reviewsToRemove = ['reviews[0]', 'reviews[_key=="abc123"]']
client.patch('bike-123').unset(reviewsToRemove).commit()

Delete documents

A single document can be deleted by specifying a document ID:

client.delete(docId)

client
  .delete('bike-123')
  .then(() => {
    console.log('Bike deleted')
  })
  .catch((err) => {
    console.error('Delete failed: ', err.message)
  })

One or more documents can be deleted by specifying a GROQ query (and optionally, params):

client.delete({ query: "GROQ query", params: { key: value } })

{ console.log('The document matching *[_type == "bike"][0] was deleted') }) .catch((err) => { console.error('Delete failed: ', err.message) })">
// Without params

client
  .delete({query: '*[_type == "bike"][0]'})
  .then(() => {
    console.log('The document matching *[_type == "bike"][0] was deleted')
  })
  .catch((err) => {
    console.error('Delete failed: ', err.message)
  })
{ console.error('Delete failed: ', err.message) })">
// With params

client
  .delete({query: '*[_type == $type][0..1]', params: {type: 'bike'}})
  .then(() => {
    console.log('The documents matching *[_type == "bike"][0..1] was deleted')
  })
  .catch((err) => {
    console.error('Delete failed: ', err.message)
  })

Multiple mutations in a transaction

const namePatch = client.patch('bike-310').set({name: 'A Bike To Go'})

client
  .transaction()
  .create({name: 'Sanity Tandem Extraordinaire', seats: 2})
  .delete('bike-123')
  .patch(namePatch)
  .commit()
  .then((res) => {
    console.log('Whole lot of stuff just happened')
  })
  .catch((err) => {
    console.error('Transaction failed: ', err.message)
  })

client.transaction().create(doc).delete(docId).patch(patch).commit()

Create a transaction to perform chained mutations.

client
  .transaction()
  .create({name: 'Sanity Tandem Extraordinaire', seats: 2})
  .patch('bike-123', (p) => p.set({inStock: false}))
  .commit()
  .then((res) => {
    console.log('Bike created and a different bike is updated')
  })
  .catch((err) => {
    console.error('Transaction failed: ', err.message)
  })

client.transaction().create(doc).patch(docId, p => p.set(partialDoc)).commit()

A patch can be performed inline on a transaction.

Clientless patches & transactions

Transactions and patches can also be built outside the scope of a client:

const sanityClient = require('@sanity/client')
const client = sanityClient({
  projectId: 'your-project-id',
  dataset: 'bikeshop',
})

// Patches:
const patch = new sanityClient.Patch('
   
    '
   )
client.mutate(patch.inc({count: 1}).unset(['visits']))

// Transactions:
const transaction = new sanityClient.Transaction()
  .create({_id: '123', name: 'FooBike'})
  .delete('someDocId')

client.mutate(transaction)

const patch = new sanityClient.Patch(docId)

const transaction = new sanityClient.Transaction()

An important note on this approach is that you cannot call commit() on transactions or patches instantiated this way, instead you have to pass them to client.mutate()

Uploading assets

Assets can be uploaded using the client.assets.upload(...) method.

client.assets.upload(type: 'file' | image', body: File | Blob | Buffer | NodeStream, options = {}): Promise
   

   

👉 Read more about assets in Sanity

Examples: Uploading assets from Node.js

// Upload a file from the file system
client.assets
  .upload('file', fs.createReadStream('myFile.txt'), {filename: 'myFile.txt'})
  .then((document) => {
    console.log('The file was uploaded!', document)
  })
  .catch((error) => {
    console.error('Upload failed:', error.message)
  })
// Upload an image file from the file system
client.assets
  .upload('image', fs.createReadStream('myImage.jpg'), {filename: 'myImage.jpg'})
  .then((document) => {
    console.log('The image was uploaded!', document)
  })
  .catch((error) => {
    console.error('Upload failed:', error.message)
  })

Examples: Uploading assets from the Browser

{ console.log('The file was uploaded!', document) }) .catch((error) => { console.error('Upload failed:', error.message) })">
// Create a file with "foo" as its content
const file = new File(['foo'], 'foo.txt', {type: 'text/plain'})
// Upload it
client.assets
  .upload('file', file)
  .then((document) => {
    console.log('The file was uploaded!', document)
  })
  .catch((error) => {
    console.error('Upload failed:', error.message)
  })
// Draw something on a canvas and upload as image
const canvas = document.getElementById('someCanvas')
const ctx = canvas.getContext('2d')
ctx.fillStyle = '#f85040'
ctx.fillRect(0, 0, 50, 50)
ctx.fillStyle = '#fff'
ctx.font = '10px monospace'
ctx.fillText('Sanity', 8, 30)
canvas.toBlob(uploadImageBlob, 'image/png')

function uploadImageBlob(blob) {
  client.assets
    .upload('image', blob, {contentType: 'image/png', filename: 'someText.png'})
    .then((document) => {
      console.log('The image was uploaded!', document)
    })
    .catch((error) => {
      console.error('Upload failed:', error.message)
    })
}

Examples: Specify image metadata to extract

// Extract palette of colors as well as GPS location from exif
client.assets
  .upload('image', someFile, {extract: ['palette', 'location']})
  .then((document) => {
    console.log('The file was uploaded!', document)
  })
  .catch((error) => {
    console.error('Upload failed:', error.message)
  })

Deleting an asset

Deleting an asset document will also trigger deletion of the actual asset.

client.delete(id: string): Promise
client.delete('image-abc123_someAssetId-500x500-png').then((result) => {
  console.log('deleted imageAsset', result)
})

Get client configuration

const config = client.config()
console.log(config.dataset)

client.config()

Get client configuration.

Set client configuration

client.config({dataset: 'newDataset'})

client.config(options)

Set client configuration. Required options are projectId and dataset.

License

MIT © Sanity.io

Comments
  • Type errors

    Type errors

    The ObservableTransaction and ObservablePatch types are no longer correct. Projects with skipLibCheck: false will likely not compile when using the client.

    There are noe test or compile errors, but you get squiggles in the editor.

    Property 'clone' in type 'ObservablePatch' is not assignable to the same property in base type 'Patch'.
    

    Translated error

    Screenshot 2022-08-15 at 10 46 36

    opened by runeh 4
  • TypeError: generateHelpUrl is not a function

    TypeError: generateHelpUrl is not a function

    /node_modules/@sanity/client/lib/warnings.js:21:204

    var generateHelpUrl = require('@sanity/generate-help-url').generateHelpUrl;

    Seems as though @sanity/[email protected] returns a function that returns a string and does not have a key of generateHelpUrl.

    opened by georgebutter 3
  • Configure Renovate

    Configure Renovate

    Mend Renovate

    Welcome to Renovate! This is an onboarding PR to help you understand and configure settings before regular Pull Requests begin.

    🚦 To activate Renovate, merge this Pull Request. To disable Renovate, simply close this Pull Request unmerged.


    Detected Package Files

    • .github/workflows/bun.yml (github-actions)
    • .github/workflows/ci.yml (github-actions)
    • package.json (npm)
    • runtimes/edge/package.json (npm)

    Configuration

    🔡 Renovate has detected a custom config for this PR. Feel free to ask for help if you have any doubts and would like it reviewed.

    Important: Now that this branch is edited, Renovate can't rebase it from the base branch any more. If you make changes to the base branch that could impact this onboarding PR, please merge them manually.

    What to Expect

    With your current configuration, Renovate will create 8 Pull Requests:

    chore(deps): update dependency terser [security]
    • Branch name: renovate/npm-terser-vulnerability
    • Merge into: main
    • Upgrade terser to 5.14.2
    • Upgrade terser to 4.8.1
    chore(deps): pin dependencies
    fix(deps): update dependencies (non-major)
    chore(deps): update devdependencies (non-major)
    fix(deps): update dependency get-it to v7
    • Schedule: ["before 2am"]
    • Branch name: renovate/get-it-7.x
    • Merge into: main
    • Upgrade get-it to ^7.0.1
    fix(deps): update dependency jest to v29
    • Schedule: ["before 2am"]
    • Branch name: renovate/major-jest-monorepo
    • Merge into: main
    • Upgrade jest to ^29.0.3
    fix(deps): update dependency rxjs to v7
    • Schedule: ["before 2am"]
    • Branch name: renovate/rxjs-7.x
    • Merge into: main
    • Upgrade rxjs to ^7.5.7
    chore(deps): lock file maintenance
    • Schedule: ["before 3am on the first day of the month"]
    • Branch name: renovate/lock-file-maintenance
    • Merge into: main
    • Regenerate lock files to use latest dependency versions

    🚸 Branch creation will be limited to maximum 2 per hour, so it doesn't swamp any CI resources or spam the project. See docs for prhourlylimit for details.


    ❓ Got questions? Check out Renovate's Docs, particularly the Getting Started section. If you need any further assistance then you can also request help here.


    This PR has been generated by Mend Renovate using a preset from Sanity. View repository job log here

    released 
    opened by renovate[bot] 2
  • fix(typings): ObservableTranaction and Patch should not inherit from superclass

    fix(typings): ObservableTranaction and Patch should not inherit from superclass

    Fixes #18

    This seems like a reasonable fix to me, but I don't know the code.

    It's not possible to inherit from a superclass when the subclass changes the signatures of methods in the super afaik.

    opened by runeh 2
  • fix(deps): upgrade rxjs to v7

    fix(deps): upgrade rxjs to v7

    This upgrades rxjs from v6 to v7. This means that the observable instance returned from various client methods will now be an rxjs@v7 Observable. This should be a non-breaking since the Observable interface and behavior is from what I can tell largely kept intact between v6 => v7 (except for undocumented methods and a couple of minor type signature changes). In other words: a v6 Observable should be interoperable with a v7 Observable.

    I set the range of the rxjs dependency to ^7.0.0 to aid deduping, and verified that the test suite passes against every minor of rxjs from v7.0.0 to v7.8.0.

    Note: would prefer if the PR was rebase-merged since each individual commit makes sense on their own :)

    released 
    opened by bjoerge 1
  • build: replace browserify with rollup for UMD bundling

    build: replace browserify with rollup for UMD bundling

    This switches from browserify to rollup for generating UMD bundle. This should give us several improvements, most notably reduced bundle size due to tree shaking. We also need this to be able to upgrade rxjs to v7 since they have removed the ability to require internal individual files with commonjs.

    Some quick stats: Before (browserify): 127K ./umd/sanityClient.js 108K ./umd/sanityClient.min.js

    After (rollup): 174K ./umd/sanityClient.js 70K ./umd/sanityClient.min.js

    Note: I've only done a quick round of testing the bundle loaded through a script tag and it seems to work well. Let me know if there's a way to run a more extensive test suite against it.

    released 
    opened by bjoerge 1
  • chore(deps): pin dependencies

    chore(deps): pin dependencies

    Mend Renovate

    This PR contains the following updates:

    | Package | Type | Update | Change | |---|---|---|---| | actions/cache | action | pinDigest | -> 4723a57 | | actions/checkout | action | pinDigest | -> 755da8c | | actions/download-artifact | action | pinDigest | -> 9782bd6 |


    Configuration

    📅 Schedule: Branch creation - "every 3 months on the first day of the month" (UTC), Automerge - At any time (no schedule defined).

    🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

    Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

    🔕 Ignore: Close this PR and you won't be reminded about these updates again.


    • [ ] If you want to rebase/retry this PR, check this box

    This PR has been generated by Mend Renovate using a preset from Sanity. View repository job log here

    released 
    opened by renovate[bot] 1
  • chore(deps): update devdependencies (non-major)

    chore(deps): update devdependencies (non-major)

    Mend Renovate

    This PR contains the following updates:

    | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | @types/node (source) | ^18.11.17 -> ^18.11.18 | age | adoption | passing | confidence | | esbuild | ^0.16.10 -> ^0.16.12 | age | adoption | passing | confidence | | eslint (source) | ^8.30.0 -> ^8.31.0 | age | adoption | passing | confidence |


    Release Notes

    evanw/esbuild

    v0.16.12

    Compare Source

    • Loader defaults to js for extensionless files (#​2776)

      Certain packages contain files without an extension. For example, the yargs package contains the file yargs/yargs which has no extension. Node, Webpack, and Parcel can all understand code that imports yargs/yargs because they assume that the file is JavaScript. However, esbuild was previously unable to understand this code because it relies on the file extension to tell it how to interpret the file. With this release, esbuild will now assume files without an extension are JavaScript files. This can be customized by setting the loader for "" (the empty string, representing files without an extension) to another loader. For example, if you want files without an extension to be treated as CSS instead, you can do that like this:

      • CLI:

        esbuild --bundle --loader:=css
        
      • JS:

        esbuild.build({
          bundle: true,
          loader: { '': 'css' },
        })
        
      • Go:

        api.Build(api.BuildOptions{
          Bundle: true,
          Loader: map[string]api.Loader{"": api.LoaderCSS},
        })
        

      In addition, the "type" field in package.json files now only applies to files with an explicit .js, .jsx, .ts, or .tsx extension. Previously it was incorrectly applied by esbuild to all files that had an extension other than .mjs, .mts, .cjs, or .cts including extensionless files. So for example an extensionless file in a "type": "module" package is now treated as CommonJS instead of ESM.

    v0.16.11

    Compare Source

    • Avoid a syntax error in the presence of direct eval (#​2761)

      The behavior of nested function declarations in JavaScript depends on whether the code is run in strict mode or not. It would be problematic if esbuild preserved nested function declarations in its output because then the behavior would depend on whether the output was run in strict mode or not instead of respecting the strict mode behavior of the original source code. To avoid this, esbuild transforms nested function declarations to preserve the intended behavior of the original source code regardless of whether the output is run in strict mode or not:

      // Original code
      if (true) {
        function foo() {}
        console.log(!!foo)
        foo = null
        console.log(!!foo)
      }
      console.log(!!foo)
      
      // Transformed code
      if (true) {
        let foo2 = function() {
        };
        var foo = foo2;
        console.log(!!foo2);
        foo2 = null;
        console.log(!!foo2);
      }
      console.log(!!foo);
      

      In the above example, the original code should print true false true because it's not run in strict mode (it doesn't contain "use strict" and is not an ES module). The code that esbuild generates has been transformed such that it prints true false true regardless of whether it's run in strict mode or not.

      However, this transformation is impossible if the code contains direct eval because direct eval "poisons" all containing scopes by preventing anything in those scopes from being renamed. That prevents esbuild from splitting up accesses to foo into two separate variables with different names. Previously esbuild still did this transformation but with two variables both named foo, which is a syntax error. With this release esbuild will now skip doing this transformation when direct eval is present to avoid generating code with a syntax error. This means that the generated code may no longer behave as intended since the behavior depends on the run-time strict mode setting instead of the strict mode setting present in the original source code. To fix this problem, you will need to remove the use of direct eval.

    • Fix a bundling scenario involving multiple symlinks (#​2773, #​2774)

      This release contains a fix for a bundling scenario involving an import path where multiple path segments are symlinks. Previously esbuild was unable to resolve certain import paths in this scenario, but these import paths should now work starting with this release. This fix was contributed by @​onebytegone.

    eslint/eslint

    v8.31.0

    Compare Source

    Features

    • 52c7c73 feat: check assignment patterns in no-underscore-dangle (#​16693) (Milos Djermanovic)
    • b401cde feat: add options to check destructuring in no-underscore-dangle (#​16006) (Morten Kaltoft)
    • 30d0daf feat: group properties with values in parentheses in key-spacing (#​16677) (Francesco Trotta)

    Bug Fixes

    • 35439f1 fix: correct syntax error in prefer-arrow-callback autofix (#​16722) (Francesco Trotta)
    • 87b2470 fix: new instance of FlatESLint should load latest config file version (#​16608) (Milos Djermanovic)

    Documentation

    Chores


    Configuration

    📅 Schedule: Branch creation - "before 4am on sunday" (UTC), Automerge - At any time (no schedule defined).

    🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

    Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

    👻 Immortal: This PR will be recreated if closed unmerged. Get config help if that's undesired.


    • [ ] If you want to rebase/retry this PR, check this box

    This PR has been generated by Mend Renovate using a preset from Sanity. View repository job log here

    dependencies bump released 
    opened by renovate[bot] 1
  • chore(deps): lock file maintenance

    chore(deps): lock file maintenance

    Mend Renovate

    This PR contains the following updates:

    | Update | Change | |---|---| | lockFileMaintenance | All locks refreshed |

    🔧 This Pull Request updates lock files to use the latest dependency versions.


    Configuration

    📅 Schedule: Branch creation - "before 3am on the first day of the month" (UTC), Automerge - At any time (no schedule defined).

    🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

    Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

    👻 Immortal: This PR will be recreated if closed unmerged. Get config help if that's undesired.


    • [ ] If you want to rebase/retry this PR, check this box

    This PR has been generated by Mend Renovate using a preset from Sanity. View repository job log here

    dependencies lockFileMaintenance released 
    opened by renovate[bot] 1
  • chore(deps): update actions/checkout digest to 755da8c

    chore(deps): update actions/checkout digest to 755da8c

    Mend Renovate

    This PR contains the following updates:

    | Package | Type | Update | Change | |---|---|---|---| | actions/checkout | action | digest | 93ea575 -> 755da8c |


    Configuration

    📅 Schedule: Branch creation - "every 3 months on the first day of the month" (UTC), Automerge - At any time (no schedule defined).

    🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

    Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

    🔕 Ignore: Close this PR and you won't be reminded about this update again.


    • [ ] If you want to rebase/retry this PR, check this box

    This PR has been generated by Mend Renovate using a preset from Sanity. View repository job log here

    dependencies digest released 
    opened by renovate[bot] 1
  • chore(deps): update actions/cache digest to 4723a57

    chore(deps): update actions/cache digest to 4723a57

    Mend Renovate

    This PR contains the following updates:

    | Package | Type | Update | Change | |---|---|---|---| | actions/cache | action | digest | 1c73980 -> 4723a57 |


    Configuration

    📅 Schedule: Branch creation - "every 3 months on the first day of the month" (UTC), Automerge - At any time (no schedule defined).

    🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

    Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

    🔕 Ignore: Close this PR and you won't be reminded about this update again.


    • [ ] If you want to rebase/retry this PR, check this box

    This PR has been generated by Mend Renovate using a preset from Sanity. View repository job log here

    dependencies digest released 
    opened by renovate[bot] 1
  • chore(deps): update dependency @sanity/semantic-release-preset to v3

    chore(deps): update dependency @sanity/semantic-release-preset to v3

    Mend Renovate

    This PR contains the following updates:

    | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | @sanity/semantic-release-preset (source) | ^2.0.5 -> ^3.0.2 | age | adoption | passing | confidence |


    Release Notes

    sanity-io/semantic-release-preset

    v3.0.2

    Compare Source

    Bug Fixes
    • deps: update dependency semantic-release to v20.0.2 (#​48) (3a9554d)

    v3.0.1

    Compare Source

    Bug Fixes
    • deps: update dependency semantic-release to v20.0.1 (#​47) (c46e5a3)

    v3.0.0

    Compare Source

    ⚠ BREAKING CHANGES
    • deps: Drops support for Node v16 and older
    Bug Fixes
    • deps: update dependency semantic-release to v20 (#​40) (8dd50d9)

    Configuration

    📅 Schedule: Branch creation - "before 4am on sunday" (UTC), Automerge - At any time (no schedule defined).

    🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

    Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

    🔕 Ignore: Close this PR and you won't be reminded about this update again.


    • [ ] If you want to rebase/retry this PR, check this box

    This PR has been generated by Mend Renovate using a preset from Sanity. View repository job log here

    dependencies major 
    opened by renovate[bot] 0
  • chore(deps): update devdependencies (non-major)

    chore(deps): update devdependencies (non-major)

    Mend Renovate

    This PR contains the following updates:

    | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | @babel/core (source) | ^7.20.7 -> ^7.20.12 | age | adoption | passing | confidence | | esbuild | ^0.16.12 -> ^0.16.16 | age | adoption | passing | confidence | | eslint-config-prettier | ^8.5.0 -> ^8.6.0 | age | adoption | passing | confidence | | prettier (source) | ^2.8.1 -> ^2.8.2 | age | adoption | passing | confidence |


    Release Notes

    babel/babel

    v7.20.12

    Compare Source

    :bug: Bug Fix
    • babel-traverse
    • babel-helper-create-class-features-plugin, babel-plugin-proposal-class-properties
    :nail_care: Polish
    evanw/esbuild

    v0.16.16

    Compare Source

    • Fix a regression caused by comment preservation (#​2805)

      The new comment preservation behavior that was added in 0.16.14 introduced a regression where comments in certain locations could cause esbuild to omit certain necessary parentheses in the output. The outermost parentheses were incorrectly removed for the following syntax forms, which then introduced syntax errors:

      (/* comment */ { x: 0 }).x;
      (/* comment */ function () { })();
      (/* comment */ class { }).prototype;
      

      This regression has been fixed.

    v0.16.15

    Compare Source

    • Add format to input files in the JSON metafile data

      When --metafile is enabled, input files may now have an additional format field that indicates the export format used by this file. When present, the value will either be cjs for CommonJS-style exports or esm for ESM-style exports. This can be useful in bundle analysis.

      For example, esbuild's new Bundle Size Analyzer now uses this information to visualize whether ESM or CommonJS was used for each directory and file of source code (click on the CJS/ESM bar at the top).

      This information is helpful when trying to reduce the size of your bundle. Using the ESM variant of a dependency instead of the CommonJS variant always results in a faster and smaller bundle because it omits CommonJS wrappers, and also may result in better tree-shaking as it allows esbuild to perform tree-shaking at the statement level instead of the module level.

    • Fix a bundling edge case with dynamic import (#​2793)

      This release fixes a bug where esbuild's bundler could produce incorrect output. The problematic edge case involves the entry point importing itself using a dynamic import() expression in an imported file, like this:

      // src/a.js
      export const A = 42;
      
      // src/b.js
      export const B = async () => (await import(".")).A
      
      // src/index.js
      export * from "./a"
      export * from "./b"
      
    • Remove new type syntax from type declarations in the esbuild package (#​2798)

      Previously you needed to use TypeScript 4.3 or newer when using the esbuild package from TypeScript code due to the use of a getter in an interface in node_modules/esbuild/lib/main.d.ts. This release removes this newer syntax to allow people with versions of TypeScript as far back as TypeScript 3.5 to use this latest version of the esbuild package. Here is change that was made to esbuild's type declarations:

       export interface OutputFile {
         /** "text" as bytes */
         contents: Uint8Array;
         /** "contents" as text (changes automatically with "contents") */
      -  get text(): string;
      +  readonly text: string;
       }
      

    v0.16.14

    Compare Source

    • Preserve some comments in expressions (#​2721)

      Various tools give semantic meaning to comments embedded inside of expressions. For example, Webpack and Vite have special "magic comments" that can be used to affect code splitting behavior:

      import(/* webpackChunkName: "foo" */ '../foo');
      import(/* @​vite-ignore */ dynamicVar);
      new Worker(/* webpackChunkName: "bar" */ new URL("../bar.ts", import.meta.url));
      new Worker(new URL('./path', import.meta.url), /* @​vite-ignore */ dynamicOptions);
      

      Since esbuild can be used as a preprocessor for these tools (e.g. to strip TypeScript types), it can be problematic if esbuild doesn't do additional work to try to retain these comments. Previously esbuild special-cased Webpack comments in these specific locations in the AST. But Vite would now like to use similar comments, and likely other tools as well.

      So with this release, esbuild now will attempt to preserve some comments inside of expressions in more situations than before. This behavior is mainly intended to preserve these special "magic comments" that are meant for other tools to consume, although esbuild will no longer only preserve Webpack-specific comments so it should now be tool-agnostic. There is no guarantee that all such comments will be preserved (especially when --minify-syntax is enabled). So this change does not mean that esbuild is now usable as a code formatter. In particular comment preservation is more likely to happen with leading comments than with trailing comments. You should put comments that you want to be preserved before the relevant expression instead of after it. Also note that this change does not retain any more statement-level comments than before (i.e. comments not embedded inside of expressions). Comment preservation is not enabled when --minify-whitespace is enabled (which is automatically enabled when you use --minify).

    v0.16.13

    Compare Source

    • Publish a new bundle visualization tool

      While esbuild provides bundle metadata via the --metafile flag, previously esbuild left analysis of it completely up to third-party tools (well, outside of the rudimentary --analyze flag). However, the esbuild website now has a built-in bundle visualization tool:

      • https://esbuild.github.io/analyze/

      You can pass --metafile to esbuild to output bundle metadata, then upload that JSON file to this tool to visualize your bundle. This is helpful for answering questions such as:

      • Which packages are included in my bundle?
      • How did a specific file get included?
      • How small did a specific file compress to?
      • Was a specific file tree-shaken or not?

      I'm publishing this tool because I think esbuild should provide some answer to "how do I visualize my bundle" without requiring people to reach for third-party tools. At the moment the tool offers two types of visualizations: a radial "sunburst chart" and a linear "flame chart". They serve slightly different but overlapping use cases (e.g. the sunburst chart is more keyboard-accessible while the flame chart is easier with the mouse). This tool may continue to evolve over time.

    • Fix --metafile and --mangle-cache with --watch (#​1357)

      The CLI calls the Go API and then also writes out the metafile and/or mangle cache JSON files if those features are enabled. This extra step is necessary because these files are returned by the Go API as in-memory strings. However, this extra step accidentally didn't happen for all builds after the initial build when watch mode was enabled. This behavior used to work but it was broken in version 0.14.18 by the introduction of the mangle cache feature. This release fixes the combination of these features, so the metafile and mangle cache features should now work with watch mode. This behavior was only broken for the CLI, not for the JS or Go APIs.

    • Add an original field to the metafile

      The metadata file JSON now has an additional field: each import in an input file now contains the pre-resolved path in the original field in addition to the post-resolved path in the path field. This means it's now possible to run certain additional analysis over your bundle. For example, you should be able to use this to detect when the same package subpath is represented multiple times in the bundle, either because multiple versions of a package were bundled or because a package is experiencing the dual-package hazard.

    prettier/eslint-config-prettier

    v8.6.0

    Compare Source

    • Added: [vue/multiline-ternary]. Thanks to @​xcatliu!
    prettier/prettier

    v2.8.2

    Compare Source

    diff

    Don't lowercase link references (#​13155 by @​DerekNonGeneric & @​fisker)
    <!-- Input -->
    We now don't strictly follow the release notes format suggested by [Keep a Changelog].
    
    [Keep a Changelog]: https://example.com/
    
    <!-- Prettier 2.8.1 -->
    We now don't strictly follow the release notes format suggested by [Keep a Changelog].
    
    [keep a changelog]: https://example.com/
    <!--
    ^^^^^^^^^^^^^^^^^^ lowercased
    -->
    
    <!-- Prettier 2.8.2 -->
    <Same as input>
    
    Preserve self-closing tags (#​13691 by @​dcyriller)
    {{! Input }}
    <div />
    <div></div>
    <custom-component />
    <custom-component></custom-component>
    <i />
    <i></i>
    <Component />
    <Component></Component>
    
    {{! Prettier 2.8.1 }}
    <div></div>
    <div></div>
    <custom-component></custom-component>
    <custom-component></custom-component>
    <i></i>
    <i></i>
    <Component />
    <Component />
    
    {{! Prettier 2.8.2 }}
    <div />
    <div></div>
    <custom-component />
    <custom-component></custom-component>
    <i />
    <i></i>
    <Component />
    <Component />
    
    Allow custom "else if"-like blocks with block params (#​13930 by @​jamescdavis)

    #​13507 added support for custom block keywords used with else, but failed to allow block params. This updates printer-glimmer to allow block params with custom "else if"-like blocks.

    {{! Input }}
    {#when isAtWork as |work|}}
      Ship that
      {{work}}!
    {{else when isReading as |book|}}
      You can finish
      {{book}}
      eventually...
    {{else}}
      Go to bed!
    {{/when}}
    
    {{! Prettier 2.8.1 }}
    {{#when isAtWork as |work|}}
      Ship that
      {{work}}!
    {{else when isReading}}
      You can finish
      {{book}}
      eventually...
    {{else}}
      Go to bed!
    {{/when}}
    
    {{! Prettier 2.8.2 }}
    {#when isAtWork as |work|}}
      Ship that
      {{work}}!
    {{else when isReading as |book|}}
      You can finish
      {{book}}
      eventually...
    {{else}}
      Go to bed!
    {{/when}}
    
    Preserve empty lines between nested SCSS maps (#​13931 by @​jneander)
    /* Input */
    $map: (
      'one': (
         'key': 'value',
      ),
    
      'two': (
         'key': 'value',
      ),
    )
    
    /* Prettier 2.8.1 */
    $map: (
      'one': (
         'key': 'value',
      ),
      'two': (
         'key': 'value',
      ),
    )
    
    /* Prettier 2.8.2 */
    $map: (
      'one': (
         'key': 'value',
      ),
    
      'two': (
         'key': 'value',
      ),
    )
    
    Fix missing parentheses when an expression statement starts with let[ (#​14000, #​14044 by @​fisker, @​thorn0)
    // Input
    (let[0] = 2);
    
    // Prettier 2.8.1
    let[0] = 2;
    
    // Prettier 2.8.1 (second format)
    SyntaxError: Unexpected token (1:5)
    > 1 | let[0] = 2;
        |     ^
      2 |
    
    // Prettier 2.8.2
    (let)[0] = 2;
    
    Fix semicolon duplicated at the end of LESS file (#​14007 by @​mvorisek)
    // Input
    @&#8203;variable: {
      field: something;
    };
    
    // Prettier 2.8.1
    @&#8203;variable: {
      field: something;
    }; ;
    
    // Prettier 2.8.2
    @&#8203;variable: {
      field: something;
    };
    
    Fix no space after unary minus when followed by opening parenthesis in LESS (#​14008 by @​mvorisek)
    // Input
    .unary_minus_single {
      margin: -(@&#8203;a);
    }
    
    .unary_minus_multi {
      margin: 0 -(@&#8203;a);
    }
    
    .binary_minus {
      margin: 0 - (@&#8203;a);
    }
    
    // Prettier 2.8.1
    .unary_minus_single {
      margin: - (@&#8203;a);
    }
    
    .unary_minus_multi {
      margin: 0 - (@&#8203;a);
    }
    
    .binary_minus {
      margin: 0 - (@&#8203;a);
    }
    
    // Prettier 2.8.2
    .unary_minus_single {
      margin: -(@&#8203;a);
    }
    
    .unary_minus_multi {
      margin: 0 -(@&#8203;a);
    }
    
    .binary_minus {
      margin: 0 - (@&#8203;a);
    }
    
    Do not change case of property name if inside a variable declaration in LESS (#​14034 by @​mvorisek)
    // Input
    @&#8203;var: {
      preserveCase: 0;
    };
    
    // Prettier 2.8.1
    @&#8203;var: {
      preservecase: 0;
    };
    
    // Prettier 2.8.2
    @&#8203;var: {
      preserveCase: 0;
    };
    
    Fix formatting for auto-accessors with comments (#​14038 by @​fisker)
    // Input
    class A {
      @&#8203;dec()
      // comment
      accessor b;
    }
    
    // Prettier 2.8.1
    class A {
      @&#8203;dec()
      accessor // comment
      b;
    }
    
    // Prettier 2.8.1 (second format)
    class A {
      @&#8203;dec()
      accessor; // comment
      b;
    }
    
    // Prettier 2.8.2
    class A {
      @&#8203;dec()
      // comment
      accessor b;
    }
    
    Add parentheses for TSTypeQuery to improve readability (#​14042 by @​onishi-kohei)
    // Input
    a as (typeof node.children)[number]
    a as (typeof node.children)[]
    a as ((typeof node.children)[number])[]
    
    // Prettier 2.8.1
    a as typeof node.children[number];
    a as typeof node.children[];
    a as typeof node.children[number][];
    
    // Prettier 2.8.2
    a as (typeof node.children)[number];
    a as (typeof node.children)[];
    a as (typeof node.children)[number][];
    
    Fix displacing of comments in default switch case (#​14047 by @​thorn0)

    It was a regression in Prettier 2.6.0.

    // Input
    switch (state) {
      default:
        result = state; // no change
        break;
    }
    
    // Prettier 2.8.1
    switch (state) {
      default: // no change
        result = state;
        break;
    }
    
    // Prettier 2.8.2
    switch (state) {
      default:
        result = state; // no change
        break;
    }
    
    Support type annotations on auto accessors via babel-ts (#​14049 by @​sosukesuzuki)

    The bug that @babel/parser cannot parse auto accessors with type annotations has been fixed. So we now support it via babel-ts parser.

    class Foo {
      accessor prop: number;
    }
    
    Fix formatting of empty type parameters (#​14073 by @​fisker)
    // Input
    const foo: bar</* comment */> = () => baz;
    
    // Prettier 2.8.1
    Error: Comment "comment" was not printed. Please report this error!
    
    // Prettier 2.8.2
    const foo: bar</* comment */> = () => baz;
    
    Add parentheses to head of ExpressionStatement instead of the whole statement (#​14077 by @​fisker)
    // Input
    ({}).toString.call(foo) === "[object Array]"
      ? foo.forEach(iterateArray)
      : iterateObject(foo);
    
    // Prettier 2.8.1
    ({}.toString.call(foo) === "[object Array]"
      ? foo.forEach(iterateArray)
      : iterateObject(foo));
    
    // Prettier 2.8.2
    ({}).toString.call(foo.forEach) === "[object Array]"
      ? foo.forEach(iterateArray)
      : iterateObject(foo);
    
    Fix comments after directive (#​14081 by @​fisker)
    // Input
    "use strict" /* comment */;
    
    // Prettier 2.8.1 (with other js parsers except `babel`)
    Error: Comment "comment" was not printed. Please report this error!
    
    // Prettier 2.8.2
    <Same as input>
    
    Fix formatting for comments inside JSX attribute (#​14082 with by @​fisker)
    // Input
    function MyFunctionComponent() {
      <button label=/*old*/"new">button</button>
    }
    
    // Prettier 2.8.1
    Error: Comment "old" was not printed. Please report this error!
    
    // Prettier 2.8.2
    function MyFunctionComponent() {
      <button label=/*old*/ "new">button</button>;
    }
    
    Quote numeric keys for json-stringify parser (#​14083 by @​fisker)
    // Input
    {0: 'value'}
    
    // Prettier 2.8.1
    {
      0: "value"
    }
    
    // Prettier 2.8.2
    {
      "0": "value"
    }
    
    Fix removing commas from function arguments in maps (#​14089 by @​sosukesuzuki)
    /* Input */
    $foo: map-fn(
      (
        "#{prop}": inner-fn($first, $second),
      )
    );
    
    /* Prettier 2.8.1 */
    $foo: map-fn(("#{prop}": inner-fn($first $second)));
    
    /* Prettier 2.8.2 */
    $foo: map-fn(
      (
        "#{prop}": inner-fn($first, $second),
      )
    );
    
    
    Do not insert space in LESS property access (#​14103 by @​fisker)
    // Input
    a {
      color: @&#8203;colors[@&#8203;white];
    }
    
    // Prettier 2.8.1
    a {
      color: @&#8203;colors[ @&#8203;white];
    }
    
    // Prettier 2.8.2
    <Same as input>
    

    Configuration

    📅 Schedule: Branch creation - "before 4am on sunday" (UTC), Automerge - At any time (no schedule defined).

    🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

    Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

    👻 Immortal: This PR will be recreated if closed unmerged. Get config help if that's undesired.


    • [ ] If you want to rebase/retry this PR, check this box

    This PR has been generated by Mend Renovate using a preset from Sanity. View repository job log here

    dependencies bump 
    opened by renovate[bot] 0
  • fix(deps): update dependency get-it to v8

    fix(deps): update dependency get-it to v8

    Mend Renovate

    This PR contains the following updates:

    | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | get-it | ^7.0.2 -> ^8.0.2 | age | adoption | passing | confidence |


    Release Notes

    sanity-io/get-it

    v8.0.2

    Compare Source

    Bug Fixes

    v8.0.1

    Compare Source

    Bug Fixes
    • typo in pkg.typesVersions (03ead62)

    v8.0.0

    Compare Source

    ⚠ BREAKING CHANGES
    • umd builds are removed and all middleware imports are moved to get-it/middleware. Imports such as import promise from 'get-it/lib-node/middleware/promise' are no longer supported. The default import is replaced with a named one: change import getIt from 'get-it' to import {getIt} from 'get-it'

    Other changes

    • Migrated codebase to TypeScript, moving away from using any is out of scope for this PR but linter rules are setup to make it easier to do this refactor in a later PR.
    • The required Node.js version is moved from 12 to 14, as 12 does not support pkg.exports.
    • Tooling have moved to @sanity/pkg-utils, gone is @babel/cli, browserify, esbuild, uglifyjs, and more.
    • Replaced mocha testing suite with vitest to ensure the new ESM codebase runs the same way it'll run in production with codebases such as sanity.
    • The pkg.exports are refactored to follow our updated ESM best practices, spearheaded by @sanity/pkg-utils. It implements the Node.js dual package hazard technique to steer the Node.js ESM runtime back into CJS mode as half our dependencies aren't shipping ESM-runtime code yet.
    Features
    Bug Fixes

    Configuration

    📅 Schedule: Branch creation - "before 2am" (UTC), Automerge - At any time (no schedule defined).

    🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

    Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

    🔕 Ignore: Close this PR and you won't be reminded about this update again.


    • [ ] If you want to rebase/retry this PR, check this box

    This PR has been generated by Mend Renovate using a preset from Sanity. View repository job log here

    dependencies major 
    opened by renovate[bot] 0
  • fix(deps): update dependencies (non-major)

    fix(deps): update dependencies (non-major)

    Mend Renovate

    This PR contains the following updates:

    | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | @babel/core (source) | ^7.20.7 -> ^7.20.12 | age | adoption | passing | confidence | | rxjs (source) | ^7.0.0 -> ^7.8.0 | age | adoption | passing | confidence |


    Release Notes

    babel/babel

    v7.20.12

    Compare Source

    :bug: Bug Fix
    • babel-traverse
    • babel-helper-create-class-features-plugin, babel-plugin-proposal-class-properties
    :nail_care: Polish
    reactivex/rxjs

    v7.8.0

    Compare Source

    Features
    • buffer: closingNotifier now supports any ObservableInput (#​7073) (61b877a)
    • delayWhen: delayWhen's delayDurationSelector now supports any ObservableInput (#​7049) (dfd95db)
    • sequenceEqual: compareTo now supports any ObservableInput (#​7102) (d501961)
    • share: ShareConfig factory properties now supports any ObservableInput (#​7093) (cc3995a)
    • skipUntil: notifier now supports any ObservableInput (#​7091) (60d6c40)
    • window: windowBoundaries now supports any ObservableInput (#​7088) (8c4347c)

    v7.7.0

    Compare Source

    Features

    v7.6.0

    Compare Source

    Bug Fixes
    • schedulers: no longer cause TypeScript build failures when Node types aren't included (c1a07b7)
    • types: Improved subscribe and tap type overloads (#​6718) (af1a9f4), closes #​6717
    Features
    • onErrorResumeNextWith: renamed onErrorResumeNext and exported from the top level. (onErrorResumeNext operator is stil available, but deprecated) (#​6755) (51e3b2c)

    7.5.7 (2022-09-25)

    Bug Fixes
    Performance Improvements

    7.5.6 (2022-07-11)

    Bug Fixes
    • share: No longer results in a bad-state observable in an edge case where a synchronous source was shared and refCounted, and the result is subscribed to twice in a row synchronously. (#​7005) (5d4c1d9)
    • share & connect: share and connect no longer bundle scheduling code by default (#​6873) (9948dc2), closes #​6872
    • exhaustAll: Result will now complete properly when flattening all synchronous observables. (#​6911) (3c1c6b8), closes #​6910
    • TypeScript: Now compatible with TypeScript 4.6 type checks (#​6895) (fce9aa1)

    7.5.5 (2022-03-08)

    Bug Fixes
    Performance Improvements

    7.5.4 (2022-02-09)

    Performance Improvements

    7.5.3 (2022-02-08)

    Bug Fixes
    • subscribe: allow interop with Monio and other libraries that patch function bind (0ab91eb), closes #​6783

    7.5.2 (2022-01-11)

    Bug Fixes
    • operators that ignore input values now use unknown rather than any, which should resolve issues with eslint no-unsafe-argument (#​6738) (67cb317), closes #​6536
    • ajax: crossDomain flag deprecated and properly reported to consumers (#​6710) (7fd0575), closes #​6663

    7.5.1 (2021-12-28)

    Bug Fixes
    • export supporting interfaces from top-level rxjs site. (#​6733) (299a1e1)

    v7.5.7

    Compare Source

    Bug Fixes
    Performance Improvements

    v7.5.6

    Compare Source

    Bug Fixes
    • share: No longer results in a bad-state observable in an edge case where a synchronous source was shared and refCounted, and the result is subscribed to twice in a row synchronously. (#​7005) (5d4c1d9)
    • share & connect: share and connect no longer bundle scheduling code by default (#​6873) (9948dc2), closes #​6872
    • exhaustAll: Result will now complete properly when flattening all synchronous observables. (#​6911) (3c1c6b8), closes #​6910
    • TypeScript: Now compatible with TypeScript 4.6 type checks (#​6895) (fce9aa1)

    v7.5.5

    Compare Source

    Bug Fixes
    Performance Improvements

    v7.5.4

    Compare Source

    Performance Improvements

    v7.5.3

    Compare Source

    Bug Fixes
    • subscribe: allow interop with Monio and other libraries that patch function bind (0ab91eb), closes #​6783

    v7.5.2

    Compare Source

    Bug Fixes
    • operators that ignore input values now use unknown rather than any, which should resolve issues with eslint no-unsafe-argument (#​6738) (67cb317), closes #​6536
    • ajax: crossDomain flag deprecated and properly reported to consumers (#​6710) (7fd0575), closes #​6663

    v7.5.1

    Compare Source

    Bug Fixes
    • export supporting interfaces from top-level rxjs site. (#​6733) (299a1e1)

    v7.5.0

    Compare Source

    Bug Fixes
    Features

    v7.4.0

    Compare Source

    Features

    7.3.1 (2021-10-01)

    Bug Fixes
    • Schedulers: Throwing a falsy error in a scheduled function no longer results in strange error objects. (#​6594) (c70fcc0)
    • scheduling with Rx-provided schedulers will no longer leak action references (#​6562) (ff5a748), closes #​6561
    • forkJoin: now finalizes sources before emitting (#​6546) (c52ff2e), closes #​4914
    • observeOn: release action references on teardown (321d205)
    • types: update schedule signature overload (c61e57c)

    v7.3.1

    Compare Source

    Bug Fixes
    • Schedulers: Throwing a falsy error in a scheduled function no longer results in strange error objects. (#​6594) (c70fcc0)
    • scheduling with Rx-provided schedulers will no longer leak action references (#​6562) (ff5a748), closes #​6561
    • forkJoin: now finalizes sources before emitting (#​6546) (c52ff2e), closes #​4914
    • observeOn: release action references on teardown (321d205)
    • types: update schedule signature overload (c61e57c)

    v7.3.0

    Compare Source

    Bug Fixes
    Features
    • retry: Now supports configurable delay as a named argument (#​6421) (5f69795)
    • tap: Now supports subscribe, unsubscribe, and finalize handlers (#​6527) (eb26cbc)

    v7.2.0

    Compare Source

    Bug Fixes
    • debounceTime: unschedule dangling task on unsubscribe before complete (#​6464) (7ab0a4c)
    • fromEvent: Types now properly infer when resultSelector is provided (#​6447) (39b9d81)
    Features
    • Operators are all exported at the top level, from "rxjs". From here on out, we encourage top-level imports with RxJS. Importing from rxjs/operators will be deprecated soon. (#​6488) (512adc2), closes #​6242

    v7.1.0

    Compare Source

    Bug Fixes
    • returned operator functions from multicast operators share, publish, publishReplay are now referentially transparent. Meaning if you take the result of calling publishReplay(3) and pass it to more than one observable's pipe method, it will behave the same in each case, rather than having a cumulative effect, which was a regression introduced sometime in version 6. If you required this broken behavior, there is a workaround posted here (#​6410) (e2f2e51), closes /github.com/ReactiveX/rxjs/pull/6410#issuecomment-846087374 #​5411
    Features
    • All subjects now have an observed property. This will allow users to check whether a subject has current subscribers without us allowing access to the observers array, which is going to be made private in future versions. (#​6405) (f47425d)
    • groupBy: Support named arguments, support ObservableInputs for duration selector (#​5679) (7a99397)
    • share: use another observable to control resets (#​6169) (12c3716)

    7.0.1 (2021-05-12)

    Bug Fixes
    • bindCallback: resulting function now recreated underlying Subject and is reusable once again. (#​6369) (abf2bc1)
    • retry: properly handles retry counts smaller than 1. (#​6359) (e797bd7)
    • share: properly closes synchronous "firehose" sources. (#​6370) (2271a91)
    • Observable teardowns now properly called if useDeprecatedSynchronousErrorHandling is true. (#​6365) (e19e104), closes #​6364
    • Subscription: properly release parent subscriptions when unsubscribed. (#​6352) (88331d2), closes #​6351 #​6351
    • node: do not reference DOM-related imports to assist in node usage. (#​6305) (b24818e), closes #​6297

    v7.0.1

    Compare Source

    Bug Fixes
    • bindCallback: resulting function now recreated underlying Subject and is reusable once again. (#​6369) (abf2bc1)
    • retry: properly handles retry counts smaller than 1. (#​6359) (e797bd7)
    • share: properly closes synchronous "firehose" sources. (#​6370) (2271a91)
    • Observable teardowns now properly called if useDeprecatedSynchronousErrorHandling is true. (#​6365) (e19e104), closes #​6364
    • Subscription: properly release parent subscriptions when unsubscribed. (#​6352) (88331d2), closes #​6351 #​6351
    • node: do not reference DOM-related imports to assist in node usage. (#​6305) (b24818e), closes #​6297

    Configuration

    📅 Schedule: Branch creation - "before 2am" (UTC), Automerge - At any time (no schedule defined).

    🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

    Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

    👻 Immortal: This PR will be recreated if closed unmerged. Get config help if that's undesired.


    • [ ] If you want to rebase/retry this PR, check this box

    This PR has been generated by Mend Renovate using a preset from Sanity. View repository job log here

    dependencies bump 
    opened by renovate[bot] 0
  • client.users.getById() type is too strict

    client.users.getById() type is too strict

    user.getById() types feels too strict to me.

    Right not it looks like:

    getById<T extends 'me' | string>(
      id: T
    ): T extends 'me' ? Observable<CurrentSanityUser> : Observable<SanityUser>
    

    I am actually using this method by passing a string with several IDs separated with a comma, in this case the result looks like it should be typed with Observable<SanityUser[]> (it's an array).

    Also, the current type of SanityUser includes a required isCurrentUser boolean property which is missing from my requests.

    opened by thobas-dnvgl 0
  • Delete using query inside transaction is missing support

    Delete using query inside transaction is missing support

    According to the documentation (https://www.sanity.io/docs/http-mutations#d8ebd1878516l) one should be able to pass a query to delete inside a transaction:

    {
      "mutations": [
        {
          "delete": {
            "query": "*[_type == 'feature' && viewCount < $views]",
            "params": {
              "views": 5
            },
          }
        }
      ]
    }
    

    But doing the following gives an error:

        const transaction = new sanityClient.Transaction()
        transaction.delete({query: '*[_type == "apartment"]'})
        //... other operations
        accountClient.mutate(transaction)
    
    Error: delete(): "[object Object]" is not a valid document ID
        at Object.exports.validateDocumentId (node_modules/@sanity/client/lib/validators.js:42:11)
        at Transaction._delete [as delete] (node_modules/@sanity/client/lib/data/transaction.js:47:16)
        at Object.importApartmentsTo (/app/netlify/src/provider/accounts.js:45:29)
        at module.exports (app/netlify/src/usecase/handleSingleAccountImport.js:11:18)
        at processTicksAndRejections (node:internal/process/task_queues:96:5)
        at async Object.exports.handler (app/netlify/functions/fetch-account.js:19:5)
    

    node_modules/@sanity/client/lib/data/transaction.js:46:

      delete: function _delete(documentId) {
        validators.validateDocumentId('delete', documentId);
        return this._add({
          delete: {
            id: documentId
          }
        });
      },
    

    I'm using @sanity/client 3.4.1. is there a way to work around it?

    opened by eduardo-marcolino 0
Releases(v4.0.1)
Owner
Sanity
Sanity.io a platform for structured content that comes with an open source editor that you can customize with React.js.
Sanity
Inside-out promise; lets you call resolve and reject from outside the Promise constructor function.

Inside-out promise; lets you call resolve and reject from outside the Promise constructor function.

Lily Scott 3 Feb 28, 2022
Adds promise support (rejects(), doesNotReject()) to tape by decorating it using tape-promise.

Tape With Promises Adds promise support (rejects(), doesNotReject()) to tape by decorating it using tape-promise. Install npm install --save-dev @smal

Small Technology Foundation 3 Mar 21, 2022
Grupprojekt för kurserna 'Javascript med Ramverk' och 'Agil Utveckling'

JavaScript-med-Ramverk-Laboration-3 Grupprojektet för kurserna Javascript med Ramverk och Agil Utveckling. Utvecklingsguide För information om hur utv

Svante Jonsson IT-Högskolan 3 May 18, 2022
Hemsida för personer i Sverige som kan och vill erbjuda boende till människor på flykt

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

null 4 May 3, 2022
Kurs-repo för kursen Webbserver och Databaser

Webbserver och databaser This repository is meant for CME students to access exercises and codealongs that happen throughout the course. I hope you wi

null 14 Jan 3, 2023
Polyfill to remove click delays on browsers with touch UIs

FastClick FastClick is a simple, easy-to-use library for eliminating the 300ms delay between a physical tap and the firing of a click event on mobile

FT Labs 18.8k Jan 2, 2023
Promise based HTTP client for the browser and node.js

axios Promise based HTTP client for the browser and node.js New axios docs website: click here Table of Contents Features Browser Support Installing E

axios 98k Jan 5, 2023
Hacktoberfest is all about meeting up all brains. In this repository we are planning to come with many ideas and works. You all can share your ides/works here.

Hacktoberfest Submit your Work Hacktoberfest is all about meeting up all brains. In this repository we are planning to come with many ideas and works.

Chinmay Patil 3 Oct 5, 2022
GetOsLocalesCrossPlatform - A cross platform alternative to get locales used on the platform. Works on Node, Electron, NW.js and Browsers

getOsLocalesCrossPlatform A cross platform alternative to get locales used on the platform. Works on Node, Electron, NW.js and Browsers This script is

null 1 Jan 2, 2022
Fast and lightweight dependency-free vanilla JavaScript polyfill for native lazy loading / the awesome loading='lazy'-attribute.

loading="lazy" attribute polyfill Fast and lightweight vanilla JavaScript polyfill for native lazy loading, meaning the behaviour to load elements rig

Maximilian Franzke 571 Dec 30, 2022
A simple Node.js package that helps you not to look up JavaScript promise syntax every time you use it.

A simple Node.js package that helps you not to look up JavaScript promise syntax every time you use it. Simple: Provides abstraction of the promise sy

Saad Irfan ⚡️ 9 Oct 8, 2022
Snowfall effect written in pure JavaScript. No additional libraries, no dependencies. Works in every modern browser.

pureSnow.js Snow falling slowly on a winter night. Probably the most calming and peaceful snowfall effect written in pure JS/CSS. (No SCSS). Inspired

null 20 Dec 29, 2022
jQuery easy ticker is a news ticker like plugin, which scrolls the list infinitely. It is highly customizable, flexible with lot of features and works in all browsers.

jQuery Easy Ticker plugin jQuery easy ticker is a news ticker like plugin which scrolls a list infinitely. It is highly customizable, flexible with lo

Aakash Chakravarthy 208 Dec 20, 2022
Use plain functions as modifiers. Polyfill for RFC: 757 | Default Modifier Manager

Use plain functions as modifiers. Polyfill for RFC: 757 | Default Modifier Manager

null 7 Jan 14, 2022
PouchDB for Deno, leveraging polyfill for IndexedDB based on SQLite.

PouchDB for Deno PouchDB for Deno, leveraging polyfill for IndexedDB based on SQLite. Usage import PouchDB from 'https://deno.land/x/[email protected]

Aaron Huggins 19 Aug 2, 2022
Window.fetch polyfill

window.fetch polyfill This project adheres to the [Open Code of Conduct][code-of-conduct]. By participating, you are expected to uphold this code. [co

null 38 Sep 11, 2020
Polyfill `error.cause`

Polyfill error.cause. error.cause is a recent JavaScript feature to wrap errors. try { doSomething() } catch (cause) { throw new Error('message',

ehmicky 4 Dec 15, 2022
A polyfill for ES6-style Promises

ES6-Promise (subset of rsvp.js) This is a polyfill of the ES6 Promise. The implementation is a subset of rsvp.js extracted by @jakearchibald, if you'r

Stefan Penner 7.3k Dec 28, 2022
To-do list" is an app that helps to organize your day. the user simply lists the things that needs to done and the app allows the to mark them as complete when they are done. Made with webpack, JavaScript ES6 , HTML 5 and CSS 3.

Todo-list project This is a Microverse project that entails a to-do-list. Built With HTML CSS Javascript Webpack VS code Live Demo (if available) Live

Youta Lactio Christabelle 10 Aug 3, 2022