Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

next-sanity

Package Overview
Dependencies
Maintainers
1
Versions
393
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

next-sanity - npm Package Compare versions

Comparing version 0.4.0 to 0.4.1-beta.0

2

dist/next-sanity.cjs.development.js

@@ -103,2 +103,3 @@ 'use strict';

dataset = _ref.dataset,
useGroqBeta = _ref.useGroqBeta,
_ref$documentLimit = _ref.documentLimit,

@@ -136,2 +137,3 @@ documentLimit = _ref$documentLimit === void 0 ? 3000 : _ref$documentLimit;

documentLimit: documentLimit,
useGroqBeta: useGroqBeta,
listen: true,

@@ -138,0 +140,0 @@ overlayDrafts: true,

2

dist/next-sanity.cjs.production.min.js

@@ -1,2 +0,2 @@

"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=e(require("@sanity/client")),r=e(require("@sanity/image-url")),n=require("react"),o=e(n),i=require("use-deep-compare-effect"),a=e(require("@sanity/block-content-to-react")),u=e(require("groq"));function c(){return"undefined"==typeof AbortController?{signal:void 0,abort:s}:new AbortController}function s(){}function f(e,t){return fetch("https://"+e+".api.sanity.io/v1/users/me",{credentials:"include",signal:null==t?void 0:t.signal}).then((function(e){return e.json()})).then((function(e){return null!=e&&e.id?e:null})).catch((function(e){return"AbortError"===e.name?null:Promise.reject(e)}))}var l={};exports.groq=u,exports.createClient=function(e){return t(e)},exports.createCurrentUserHook=function(e){var t=e.projectId;return function(){return function(e){var t=n.useState(),r=t[0],o=t[1],i=n.useState(),a=i[0],u=i[1];return n.useEffect((function(){var t=c();return f(e,t).then(o).catch(u),function(){return t.abort()}}),[e]),{data:r,error:a,loading:null!==r||!a}}(t)}},exports.createImageUrlBuilder=function(e){return r({projectId:e.projectId,dataset:e.dataset})},exports.createPortableTextComponent=function(e){var t=e.projectId,r=e.dataset,n=e.serializers;return function(e){return o.createElement(a,Object.assign({projectId:t,dataset:r,serializers:n},e))}},exports.createPreviewSubscriptionHook=function(e){var t,r=e.projectId,o=e.dataset,a=e.documentLimit,u=void 0===a?3e3:a;return function(e,t){void 0===t&&(t={});var o=t.params;return function(e){var t=e.getStore,r=e.projectId,o=e.query,a=e.params,u=e.initialData,s=e.enabled,l=void 0!==s&&s,d=n.useState(),p=d[0],v=d[1],b=n.useState(!1),h=b[0],m=b[1],g=n.useState(),j=g[0],y=g[1];return i.useDeepCompareEffectNoCheck((function(){if(!l)return function(){};m(!0);var e,n=c();return f(r,n).then((function(e){if(!e)throw console.warn("Not authenticated - preview not available"),new Error("Not authenticated - preview not available")})).then(t).then((function(t){e=t.subscribe(o,a,(function(e,t){e?v(e):y(t)}))})).catch(v).finally((function(){return m(!1)})),function(){e&&e.unsubscribe(),n.abort()}}),[t,o,a,l]),{data:void 0===j?u:j,loading:h,error:p}}({getStore:s,projectId:r,query:e,params:void 0===o?l:o,initialData:t.initialData,enabled:!!t.enabled&&"undefined"!=typeof window})};function s(){return t||(t=new Promise((function(e){e(function(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach((function(r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})})),t.default=e,t}(require("@sanity/groq-store")))})).then((function(e){return(0,e.groqStore)({projectId:r,dataset:o,documentLimit:u,listen:!0,overlayDrafts:!0,subscriptionThrottleMs:10})}))),t}};
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=e(require("@sanity/client")),r=e(require("@sanity/image-url")),n=require("react"),o=e(n),i=require("use-deep-compare-effect"),a=e(require("@sanity/block-content-to-react")),u=e(require("groq"));function c(){return"undefined"==typeof AbortController?{signal:void 0,abort:s}:new AbortController}function s(){}function f(e,t){return fetch("https://"+e+".api.sanity.io/v1/users/me",{credentials:"include",signal:null==t?void 0:t.signal}).then((function(e){return e.json()})).then((function(e){return null!=e&&e.id?e:null})).catch((function(e){return"AbortError"===e.name?null:Promise.reject(e)}))}var l={};exports.groq=u,exports.createClient=function(e){return t(e)},exports.createCurrentUserHook=function(e){var t=e.projectId;return function(){return function(e){var t=n.useState(),r=t[0],o=t[1],i=n.useState(),a=i[0],u=i[1];return n.useEffect((function(){var t=c();return f(e,t).then(o).catch(u),function(){return t.abort()}}),[e]),{data:r,error:a,loading:null!==r||!a}}(t)}},exports.createImageUrlBuilder=function(e){return r({projectId:e.projectId,dataset:e.dataset})},exports.createPortableTextComponent=function(e){var t=e.projectId,r=e.dataset,n=e.serializers;return function(e){return o.createElement(a,Object.assign({projectId:t,dataset:r,serializers:n},e))}},exports.createPreviewSubscriptionHook=function(e){var t,r=e.projectId,o=e.dataset,a=e.useGroqBeta,u=e.documentLimit,s=void 0===u?3e3:u;return function(e,t){void 0===t&&(t={});var o=t.params;return function(e){var t=e.getStore,r=e.projectId,o=e.query,a=e.params,u=e.initialData,s=e.enabled,l=void 0!==s&&s,d=n.useState(),p=d[0],v=d[1],b=n.useState(!1),h=b[0],m=b[1],g=n.useState(),j=g[0],y=g[1];return i.useDeepCompareEffectNoCheck((function(){if(!l)return function(){};m(!0);var e,n=c();return f(r,n).then((function(e){if(!e)throw console.warn("Not authenticated - preview not available"),new Error("Not authenticated - preview not available")})).then(t).then((function(t){e=t.subscribe(o,a,(function(e,t){e?v(e):y(t)}))})).catch(v).finally((function(){return m(!1)})),function(){e&&e.unsubscribe(),n.abort()}}),[t,o,a,l]),{data:void 0===j?u:j,loading:h,error:p}}({getStore:d,projectId:r,query:e,params:void 0===o?l:o,initialData:t.initialData,enabled:!!t.enabled&&"undefined"!=typeof window})};function d(){return t||(t=new Promise((function(e){e(function(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach((function(r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})})),t.default=e,t}(require("@sanity/groq-store")))})).then((function(e){return(0,e.groqStore)({projectId:r,dataset:o,documentLimit:s,useGroqBeta:a,listen:!0,overlayDrafts:!0,subscriptionThrottleMs:10})}))),t}};
//# sourceMappingURL=next-sanity.cjs.production.min.js.map

@@ -77,2 +77,3 @@ import sanityClient from '@sanity/client';

dataset = _ref.dataset,
useGroqBeta = _ref.useGroqBeta,
_ref$documentLimit = _ref.documentLimit,

@@ -110,2 +111,3 @@ documentLimit = _ref$documentLimit === void 0 ? 3000 : _ref$documentLimit;

documentLimit: documentLimit,
useGroqBeta: useGroqBeta,
listen: true,

@@ -112,0 +114,0 @@ overlayDrafts: true,

@@ -7,4 +7,5 @@ import { ProjectConfig } from './types';

}
export declare function createPreviewSubscriptionHook({ projectId, dataset, documentLimit, }: ProjectConfig & {
export declare function createPreviewSubscriptionHook({ projectId, dataset, useGroqBeta, documentLimit, }: ProjectConfig & {
documentLimit?: number;
useGroqBeta?: boolean;
}): <R = any>(query: string, options?: SubscriptionOptions<R>) => {

@@ -11,0 +12,0 @@ data: R;

{
"name": "next-sanity",
"description": "Sanity.io toolkit for Next.js",
"version": "0.4.0",
"version": "0.4.1-beta.0",
"author": "Sanity.io <hello@sanity.io>",

@@ -29,6 +29,6 @@ "license": "MIT",

"@sanity/block-content-to-react": "^3.0.0",
"@sanity/client": "^2.14.0",
"@sanity/groq-store": "^0.2.1",
"@sanity/image-url": "^0.140.22",
"groq": "^2.14.0",
"@sanity/client": "^2.23.1",
"@sanity/groq-store": "^0.3.0-beta.0",
"@sanity/image-url": "^1.0.1",
"groq": "^2.15.0",
"use-deep-compare-effect": "^1.6.1"

@@ -35,0 +35,0 @@ },

@@ -74,3 +74,3 @@ # next-sanity

projectId: process.env.NEXT_PUBLIC_SANITY_PROJECT_ID,
apiVersion: '2021-03-25',
apiVersion: '2021-10-21', // Learn more: https://www.sanity.io/docs/api-versioning
/**

@@ -77,0 +77,0 @@ * Set useCdn to `false` if your application require the freshest possible

@@ -19,4 +19,5 @@ import {useState} from 'react'

dataset,
useGroqBeta,
documentLimit = 3000,
}: ProjectConfig & {documentLimit?: number}) {
}: ProjectConfig & {documentLimit?: number; useGroqBeta?: boolean}) {
// Only construct/setup the store when `getStore()` is called

@@ -47,2 +48,3 @@ let store: Promise<GroqStore>

documentLimit,
useGroqBeta,
listen: true,

@@ -49,0 +51,0 @@ overlayDrafts: true,

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc