@sanity/client 6.11.2 → 6.11.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/dist/_chunks/{browserMiddleware-hi8PGbSU.cjs → browserMiddleware-1MULg59S.cjs} +377 -420
  2. package/dist/_chunks/{browserMiddleware-hi8PGbSU.cjs.map → browserMiddleware-1MULg59S.cjs.map} +1 -1
  3. package/dist/_chunks/{browserMiddleware-eLzHI4Fk.js → browserMiddleware-heyg-fDk.js} +377 -420
  4. package/dist/_chunks/{browserMiddleware-eLzHI4Fk.js.map → browserMiddleware-heyg-fDk.js.map} +1 -1
  5. package/dist/_chunks/{nodeMiddleware-SFcV9llR.cjs → nodeMiddleware-CHxg1-zH.cjs} +396 -440
  6. package/dist/_chunks/{nodeMiddleware-SFcV9llR.cjs.map → nodeMiddleware-CHxg1-zH.cjs.map} +1 -1
  7. package/dist/_chunks/{nodeMiddleware-dn4ZacKV.js → nodeMiddleware-u_fUUnxa.js} +396 -440
  8. package/dist/_chunks/{nodeMiddleware-dn4ZacKV.js.map → nodeMiddleware-u_fUUnxa.js.map} +1 -1
  9. package/dist/_chunks/{resolveEditInfo-TYjTkHKU.cjs → resolveEditInfo-dELeeJBE.cjs} +47 -70
  10. package/dist/_chunks/{resolveEditInfo-TYjTkHKU.cjs.map → resolveEditInfo-dELeeJBE.cjs.map} +1 -1
  11. package/dist/_chunks/{resolveEditInfo-FaeuCV4M.js → resolveEditInfo-uXvm6eWd.js} +47 -70
  12. package/dist/_chunks/{resolveEditInfo-FaeuCV4M.js.map → resolveEditInfo-uXvm6eWd.js.map} +1 -1
  13. package/dist/csm.cjs +20 -30
  14. package/dist/csm.cjs.map +1 -1
  15. package/dist/csm.js +19 -28
  16. package/dist/csm.js.map +1 -1
  17. package/dist/index.browser.cjs +8 -10
  18. package/dist/index.browser.cjs.map +1 -1
  19. package/dist/index.browser.js +5 -2
  20. package/dist/index.browser.js.map +1 -1
  21. package/dist/index.cjs +8 -10
  22. package/dist/index.cjs.map +1 -1
  23. package/dist/index.js +5 -2
  24. package/dist/index.js.map +1 -1
  25. package/dist/stega.browser.cjs +224 -257
  26. package/dist/stega.browser.cjs.map +1 -1
  27. package/dist/stega.browser.js +221 -249
  28. package/dist/stega.browser.js.map +1 -1
  29. package/dist/stega.cjs +193 -217
  30. package/dist/stega.cjs.map +1 -1
  31. package/dist/stega.js +190 -209
  32. package/dist/stega.js.map +1 -1
  33. package/package.json +3 -3
  34. package/umd/sanityClient.js +494 -528
  35. package/umd/sanityClient.min.js +3 -3
package/dist/csm.js CHANGED
@@ -1,10 +1,10 @@
1
- import { walkMap, resolveMapping, parseJsonPath, toString, DRAFTS_PREFIX, getPublishedId, get, jsonPath, studioPathToJsonPath, resolveEditInfo, createEditUrl } from './_chunks/resolveEditInfo-FaeuCV4M.js';
2
- export { jsonPathToStudioPath, studioPath } from './_chunks/resolveEditInfo-FaeuCV4M.js';
3
- const defaultUpdateFunction = changed => changed;
4
- function applySourceDocuments(result, resultSourceMap, getCachedDocument) {
5
- let updateFn = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : defaultUpdateFunction;
6
- let perspective = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : "raw";
7
- if (!resultSourceMap) return result;
1
+ import { walkMap, resolveMapping, parseJsonPath, toString, DRAFTS_PREFIX, getPublishedId, get, jsonPath, studioPathToJsonPath, resolveEditInfo, createEditUrl } from './_chunks/resolveEditInfo-uXvm6eWd.js';
2
+ export { jsonPathToStudioPath, studioPath } from './_chunks/resolveEditInfo-uXvm6eWd.js';
3
+
4
+ const defaultUpdateFunction = (changed) => changed;
5
+ function applySourceDocuments(result, resultSourceMap, getCachedDocument, updateFn = defaultUpdateFunction, perspective = "raw") {
6
+ if (!resultSourceMap)
7
+ return result;
8
8
  if (perspective !== "published" && perspective !== "raw" && perspective !== "previewDrafts") {
9
9
  throw new Error('Unknown perspective "'.concat(perspective, '"'));
10
10
  }
@@ -13,10 +13,7 @@ function applySourceDocuments(result, resultSourceMap, getCachedDocument) {
13
13
  if (!resolveMappingResult) {
14
14
  return value;
15
15
  }
16
- const {
17
- mapping,
18
- pathSuffix
19
- } = resolveMappingResult;
16
+ const { mapping, pathSuffix } = resolveMappingResult;
20
17
  if (mapping.type !== "value") {
21
18
  return value;
22
19
  }
@@ -33,15 +30,13 @@ function applySourceDocuments(result, resultSourceMap, getCachedDocument) {
33
30
  }
34
31
  let cachedDocument;
35
32
  if (perspective === "previewDrafts") {
36
- cachedDocument = getCachedDocument(sourceDocument._id.startsWith(DRAFTS_PREFIX) ? sourceDocument : {
37
- ...sourceDocument,
38
- _id: "".concat(DRAFTS_PREFIX, ".").concat(sourceDocument._id, "}")
39
- });
33
+ cachedDocument = getCachedDocument(
34
+ sourceDocument._id.startsWith(DRAFTS_PREFIX) ? sourceDocument : { ...sourceDocument, _id: "".concat(DRAFTS_PREFIX, ".").concat(sourceDocument._id, "}") }
35
+ );
40
36
  if (!cachedDocument) {
41
- cachedDocument = getCachedDocument(sourceDocument._id.startsWith(DRAFTS_PREFIX) ? {
42
- ...sourceDocument,
43
- _id: getPublishedId(sourceDocument._id)
44
- } : sourceDocument);
37
+ cachedDocument = getCachedDocument(
38
+ sourceDocument._id.startsWith(DRAFTS_PREFIX) ? { ...sourceDocument, _id: getPublishedId(sourceDocument._id) } : sourceDocument
39
+ );
45
40
  }
46
41
  if (cachedDocument) {
47
42
  cachedDocument = {
@@ -67,22 +62,17 @@ function applySourceDocuments(result, resultSourceMap, getCachedDocument) {
67
62
  return value;
68
63
  });
69
64
  }
65
+
70
66
  function resolvedKeyedSourcePath(options) {
71
- const {
72
- keyedResultPath,
73
- pathSuffix,
74
- sourceBasePath
75
- } = options;
67
+ const { keyedResultPath, pathSuffix, sourceBasePath } = options;
76
68
  const inferredResultPath = pathSuffix === void 0 ? [] : parseJsonPath(pathSuffix);
77
69
  const inferredPath = keyedResultPath.slice(keyedResultPath.length - inferredResultPath.length);
78
70
  const inferredPathSuffix = inferredPath.length ? jsonPath(inferredPath).slice(1) : "";
79
71
  return parseJsonPath(sourceBasePath + inferredPathSuffix);
80
72
  }
73
+
81
74
  function resolveEditUrl(options) {
82
- const {
83
- resultSourceMap,
84
- studioUrl
85
- } = options;
75
+ const { resultSourceMap, studioUrl } = options;
86
76
  const resultPath = studioPathToJsonPath(options.resultPath);
87
77
  const editInfo = resolveEditInfo({
88
78
  resultPath,
@@ -94,5 +84,6 @@ function resolveEditUrl(options) {
94
84
  }
95
85
  return createEditUrl(editInfo);
96
86
  }
87
+
97
88
  export { applySourceDocuments, createEditUrl, getPublishedId, jsonPath, parseJsonPath, resolveEditInfo, resolveEditUrl, resolveMapping, resolvedKeyedSourcePath, studioPathToJsonPath, walkMap };
98
89
  //# sourceMappingURL=csm.js.map
package/dist/csm.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"csm.js","sources":["../src/csm/applySourceDocuments.ts","../src/csm/resolvedKeyedSourcePath.ts","../src/csm/resolveEditUrl.ts"],"sourcesContent":["import {DRAFTS_PREFIX, getPublishedId} from './getPublishedId'\nimport {parseJsonPath} from './jsonPath'\nimport {resolveMapping} from './resolveMapping'\nimport * as paths from './studioPath'\nimport type {\n Any,\n ApplySourceDocumentsUpdateFunction,\n ClientPerspective,\n ContentSourceMap,\n ContentSourceMapDocuments,\n Path,\n SanityDocument,\n} from './types'\nimport {walkMap} from './walkMap'\n\nconst defaultUpdateFunction = <T = unknown>(changed: T): T => changed\n\n/**\n * Optimistically applies source documents to a result, using the content source map to trace fields.\n * Can be used to apply mutations to documents being edited in a Studio, or any mutation on Content Lake, to a result with extremely low latency.\n * @alpha\n */\nexport function applySourceDocuments<Result = unknown>(\n result: Result,\n resultSourceMap: ContentSourceMap | undefined,\n getCachedDocument: (\n sourceDocument: ContentSourceMapDocuments[number],\n ) => Partial<SanityDocument> | null | undefined,\n updateFn: ApplySourceDocumentsUpdateFunction = defaultUpdateFunction,\n perspective: ClientPerspective = 'raw',\n): Result {\n if (!resultSourceMap) return result\n\n if (perspective !== 'published' && perspective !== 'raw' && perspective !== 'previewDrafts') {\n throw new Error(`Unknown perspective \"${perspective}\"`)\n }\n\n return walkMap(JSON.parse(JSON.stringify(result)), (value, path) => {\n const resolveMappingResult = resolveMapping(path, resultSourceMap)\n if (!resolveMappingResult) {\n // console.warn('no mapping for path', path)\n return value\n }\n\n const {mapping, pathSuffix} = resolveMappingResult\n if (mapping.type !== 'value') {\n return value\n }\n\n if (mapping.source.type !== 'documentValue') {\n return value\n }\n\n const sourceDocument = resultSourceMap.documents[mapping.source.document]\n const sourcePath = resultSourceMap.paths[mapping.source.path]\n\n if (sourceDocument) {\n const parsedPath = parseJsonPath(sourcePath + pathSuffix)\n const stringifiedPath = paths.toString(parsedPath as Path)\n\n // The _id is sometimes used used as `key` in lists, and should not be changed optimistically\n if (stringifiedPath === '_id') {\n return value\n }\n\n let cachedDocument: Partial<SanityDocument> | null | undefined\n if (perspective === 'previewDrafts') {\n cachedDocument = getCachedDocument(\n sourceDocument._id.startsWith(DRAFTS_PREFIX)\n ? sourceDocument\n : {...sourceDocument, _id: `${DRAFTS_PREFIX}.${sourceDocument._id}}`},\n )\n if (!cachedDocument) {\n cachedDocument = getCachedDocument(\n sourceDocument._id.startsWith(DRAFTS_PREFIX)\n ? {...sourceDocument, _id: getPublishedId(sourceDocument._id)}\n : sourceDocument,\n )\n }\n if (cachedDocument) {\n cachedDocument = {\n ...cachedDocument,\n _id: getPublishedId(sourceDocument._id),\n _originalId: sourceDocument._id,\n }\n }\n } else {\n cachedDocument = getCachedDocument(sourceDocument)\n }\n\n if (!cachedDocument) {\n return value\n }\n\n const changedValue = cachedDocument\n ? paths.get<Result[keyof Result]>(cachedDocument, stringifiedPath, value)\n : value\n return value === changedValue\n ? value\n : updateFn<Result[keyof Result]>(changedValue as Any, {\n cachedDocument,\n previousValue: value as Result[keyof Result],\n sourceDocument,\n sourcePath: parsedPath,\n })\n }\n\n return value\n }) as Result\n}\n","import {jsonPath, parseJsonPath} from './jsonPath'\nimport type {ContentSourceMapParsedPath} from './types'\n\n/**\n * @internal\n */\nexport function resolvedKeyedSourcePath(options: {\n keyedResultPath: ContentSourceMapParsedPath\n pathSuffix?: string\n sourceBasePath: string\n}): ContentSourceMapParsedPath {\n const {keyedResultPath, pathSuffix, sourceBasePath} = options\n\n const inferredResultPath = pathSuffix === undefined ? [] : parseJsonPath(pathSuffix)\n\n const inferredPath = keyedResultPath.slice(keyedResultPath.length - inferredResultPath.length)\n\n const inferredPathSuffix = inferredPath.length ? jsonPath(inferredPath).slice(1) : ''\n\n return parseJsonPath(sourceBasePath + inferredPathSuffix)\n}\n","import {createEditUrl} from './createEditUrl'\nimport {studioPathToJsonPath} from './jsonPath'\nimport {resolveEditInfo} from './resolveEditInfo'\nimport type {ResolveEditUrlOptions} from './types'\n\n/** @alpha */\nexport function resolveEditUrl(\n options: ResolveEditUrlOptions,\n): ReturnType<typeof createEditUrl> | undefined {\n const {resultSourceMap, studioUrl} = options\n const resultPath = studioPathToJsonPath(options.resultPath)\n\n const editInfo = resolveEditInfo({\n resultPath,\n resultSourceMap,\n studioUrl,\n })\n if (!editInfo) {\n return undefined\n }\n\n return createEditUrl(editInfo)\n}\n"],"names":["defaultUpdateFunction","changed","applySourceDocuments","result","resultSourceMap","getCachedDocument","updateFn","arguments","length","undefined","perspective","Error","concat","walkMap","JSON","parse","stringify","value","path","resolveMappingResult","resolveMapping","mapping","pathSuffix","type","source","sourceDocument","documents","document","sourcePath","paths","parsedPath","parseJsonPath","stringifiedPath","paths.toString","cachedDocument","_id","startsWith","DRAFTS_PREFIX","getPublishedId","_originalId","changedValue","paths.get","previousValue","resolvedKeyedSourcePath","options","keyedResultPath","sourceBasePath","inferredResultPath","inferredPath","slice","inferredPathSuffix","jsonPath","resolveEditUrl","studioUrl","resultPath","studioPathToJsonPath","editInfo","resolveEditInfo","createEditUrl"],"mappings":";;AAeA,MAAMA,qBAAA,GAAsCC,OAAkB,IAAAA,OAAA;AAOvD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ACC,eAAA;IAAiBvB,UAAY;IAAAwB;EAAA,CAAkB,GAAAF,OAAA;EAEtD,MAAMG,qBAAqBzB,UAAe,KAAA,KAAA,CAAA,GAAY,EAAC,GAAIS,cAAcT,UAAU,CAAA;EAEnF,MAAM0B,eAAeH,eAAgB,CAAAI,KAAA,CAAMJ,eAAgB,CAAArC,MAAA,GAASuC,mBAAmBvC,MAAM,CAAA;EAEvF,MAAA0C,kBAAA,GAAqBF,aAAaxC,MAAS,GAAA2C,QAAA,CAASH,YAAY,CAAE,CAAAC,KAAA,CAAM,CAAC,CAAI,GAAA,EAAA;EAE5E,OAAAlB,aAAA,CAAce,iBAAiBI,kBAAkB,CAAA;AAC1D;ACdO,SAASE,eACdR,OAC8C,EAAA;EACxC,MAAA;IAACxC,eAAiB;IAAAiD;EAAa,CAAA,GAAAT,OAAA;EAC/B,MAAAU,UAAA,GAAaC,oBAAqB,CAAAX,OAAA,CAAQU,UAAU,CAAA;EAE1D,MAAME,WAAWC,eAAgB,CAAA;IAC/BH,UAAA;IACAlD,eAAA;IACAiD;EAAA,CACD,CAAA;EACD,IAAI,CAACG,QAAU,EAAA;IACN,OAAA,KAAA,CAAA;EACT;EAEA,OAAOE,cAAcF,QAAQ,CAAA;AAC/B;"}
1
+ {"version":3,"file":"csm.js","sources":["../src/csm/applySourceDocuments.ts","../src/csm/resolvedKeyedSourcePath.ts","../src/csm/resolveEditUrl.ts"],"sourcesContent":["import {DRAFTS_PREFIX, getPublishedId} from './getPublishedId'\nimport {parseJsonPath} from './jsonPath'\nimport {resolveMapping} from './resolveMapping'\nimport * as paths from './studioPath'\nimport type {\n Any,\n ApplySourceDocumentsUpdateFunction,\n ClientPerspective,\n ContentSourceMap,\n ContentSourceMapDocuments,\n Path,\n SanityDocument,\n} from './types'\nimport {walkMap} from './walkMap'\n\nconst defaultUpdateFunction = <T = unknown>(changed: T): T => changed\n\n/**\n * Optimistically applies source documents to a result, using the content source map to trace fields.\n * Can be used to apply mutations to documents being edited in a Studio, or any mutation on Content Lake, to a result with extremely low latency.\n * @alpha\n */\nexport function applySourceDocuments<Result = unknown>(\n result: Result,\n resultSourceMap: ContentSourceMap | undefined,\n getCachedDocument: (\n sourceDocument: ContentSourceMapDocuments[number],\n ) => Partial<SanityDocument> | null | undefined,\n updateFn: ApplySourceDocumentsUpdateFunction = defaultUpdateFunction,\n perspective: ClientPerspective = 'raw',\n): Result {\n if (!resultSourceMap) return result\n\n if (perspective !== 'published' && perspective !== 'raw' && perspective !== 'previewDrafts') {\n throw new Error(`Unknown perspective \"${perspective}\"`)\n }\n\n return walkMap(JSON.parse(JSON.stringify(result)), (value, path) => {\n const resolveMappingResult = resolveMapping(path, resultSourceMap)\n if (!resolveMappingResult) {\n // console.warn('no mapping for path', path)\n return value\n }\n\n const {mapping, pathSuffix} = resolveMappingResult\n if (mapping.type !== 'value') {\n return value\n }\n\n if (mapping.source.type !== 'documentValue') {\n return value\n }\n\n const sourceDocument = resultSourceMap.documents[mapping.source.document]\n const sourcePath = resultSourceMap.paths[mapping.source.path]\n\n if (sourceDocument) {\n const parsedPath = parseJsonPath(sourcePath + pathSuffix)\n const stringifiedPath = paths.toString(parsedPath as Path)\n\n // The _id is sometimes used used as `key` in lists, and should not be changed optimistically\n if (stringifiedPath === '_id') {\n return value\n }\n\n let cachedDocument: Partial<SanityDocument> | null | undefined\n if (perspective === 'previewDrafts') {\n cachedDocument = getCachedDocument(\n sourceDocument._id.startsWith(DRAFTS_PREFIX)\n ? sourceDocument\n : {...sourceDocument, _id: `${DRAFTS_PREFIX}.${sourceDocument._id}}`},\n )\n if (!cachedDocument) {\n cachedDocument = getCachedDocument(\n sourceDocument._id.startsWith(DRAFTS_PREFIX)\n ? {...sourceDocument, _id: getPublishedId(sourceDocument._id)}\n : sourceDocument,\n )\n }\n if (cachedDocument) {\n cachedDocument = {\n ...cachedDocument,\n _id: getPublishedId(sourceDocument._id),\n _originalId: sourceDocument._id,\n }\n }\n } else {\n cachedDocument = getCachedDocument(sourceDocument)\n }\n\n if (!cachedDocument) {\n return value\n }\n\n const changedValue = cachedDocument\n ? paths.get<Result[keyof Result]>(cachedDocument, stringifiedPath, value)\n : value\n return value === changedValue\n ? value\n : updateFn<Result[keyof Result]>(changedValue as Any, {\n cachedDocument,\n previousValue: value as Result[keyof Result],\n sourceDocument,\n sourcePath: parsedPath,\n })\n }\n\n return value\n }) as Result\n}\n","import {jsonPath, parseJsonPath} from './jsonPath'\nimport type {ContentSourceMapParsedPath} from './types'\n\n/**\n * @internal\n */\nexport function resolvedKeyedSourcePath(options: {\n keyedResultPath: ContentSourceMapParsedPath\n pathSuffix?: string\n sourceBasePath: string\n}): ContentSourceMapParsedPath {\n const {keyedResultPath, pathSuffix, sourceBasePath} = options\n\n const inferredResultPath = pathSuffix === undefined ? [] : parseJsonPath(pathSuffix)\n\n const inferredPath = keyedResultPath.slice(keyedResultPath.length - inferredResultPath.length)\n\n const inferredPathSuffix = inferredPath.length ? jsonPath(inferredPath).slice(1) : ''\n\n return parseJsonPath(sourceBasePath + inferredPathSuffix)\n}\n","import {createEditUrl} from './createEditUrl'\nimport {studioPathToJsonPath} from './jsonPath'\nimport {resolveEditInfo} from './resolveEditInfo'\nimport type {ResolveEditUrlOptions} from './types'\n\n/** @alpha */\nexport function resolveEditUrl(\n options: ResolveEditUrlOptions,\n): ReturnType<typeof createEditUrl> | undefined {\n const {resultSourceMap, studioUrl} = options\n const resultPath = studioPathToJsonPath(options.resultPath)\n\n const editInfo = resolveEditInfo({\n resultPath,\n resultSourceMap,\n studioUrl,\n })\n if (!editInfo) {\n return undefined\n }\n\n return createEditUrl(editInfo)\n}\n"],"names":["paths.toString","paths.get"],"mappings":";;;AAeA,MAAM,qBAAA,GAAwB,CAAc,OAAkB,KAAA,OAAA,CAAA;AAOvD,SAAS,qBACd,MACA,EAAA,eAAA,EACA,mBAGA,QAA+C,GAAA,qBAAA,EAC/C,cAAiC,KACzB,EAAA;AACR,EAAA,IAAI,CAAC,eAAA;AAAiB,IAAO,OAA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,OAAA,KAAA,CAAA;AAAA,GACR,CAAA,CAAA;AACH;;ACvGO,SAAS,wBAAwB,OAIT,EAAA;AAC7B,EAAA,MAAM,EAAC,eAAA,EAAiB,UAAY,EAAA,cAAA,EAAkB,GAAA,OAAA,CAAA;AAEtD,EAAA,MAAM,qBAAqB,UAAe,KAAA,KAAA,CAAA,GAAY,EAAC,GAAI,cAAc,UAAU,CAAA,CAAA;AAEnF,EAAA,MAAM,eAAe,eAAgB,CAAA,KAAA,CAAM,eAAgB,CAAA,MAAA,GAAS,mBAAmB,MAAM,CAAA,CAAA;AAE7F,EAAM,MAAA,kBAAA,GAAqB,aAAa,MAAS,GAAA,QAAA,CAAS,YAAY,CAAE,CAAA,KAAA,CAAM,CAAC,CAAI,GAAA,EAAA,CAAA;AAEnF,EAAO,OAAA,aAAA,CAAc,iBAAiB,kBAAkB,CAAA,CAAA;AAC1D;;ACdO,SAAS,eACd,OAC8C,EAAA;AAC9C,EAAM,MAAA,EAAC,eAAiB,EAAA,SAAA,EAAa,GAAA,OAAA,CAAA;AACrC,EAAM,MAAA,UAAA,GAAa,oBAAqB,CAAA,OAAA,CAAQ,UAAU,CAAA,CAAA;AAE1D,EAAA,MAAM,WAAW,eAAgB,CAAA;AAAA,IAC/B,UAAA;AAAA,IACA,eAAA;AAAA,IACA,SAAA;AAAA,GACD,CAAA,CAAA;AACD,EAAA,IAAI,CAAC,QAAU,EAAA;AACb,IAAO,OAAA,KAAA,CAAA,CAAA;AAAA,GACT;AAEA,EAAA,OAAO,cAAc,QAAQ,CAAA,CAAA;AAC/B;;;;"}
@@ -1,20 +1,22 @@
1
1
  'use strict';
2
2
 
3
- Object.defineProperty(exports, '__esModule', {
4
- value: true
5
- });
6
- var browserMiddleware = require('./_chunks/browserMiddleware-hi8PGbSU.cjs');
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var browserMiddleware = require('./_chunks/browserMiddleware-1MULg59S.cjs');
7
6
  var getIt = require('get-it');
7
+
8
8
  function defineDeprecatedCreateClient(createClient) {
9
9
  return function deprecatedCreateClient(config) {
10
10
  browserMiddleware.printNoDefaultExport();
11
11
  return createClient(config);
12
12
  };
13
13
  }
14
+
14
15
  const exp = browserMiddleware.defineCreateClientExports(browserMiddleware.envMiddleware, browserMiddleware.SanityClient);
15
16
  const requester = exp.requester;
16
17
  const createClient = exp.createClient;
17
18
  const deprecatedCreateClient = defineDeprecatedCreateClient(createClient);
19
+
18
20
  exports.BasePatch = browserMiddleware.BasePatch;
19
21
  exports.BaseTransaction = browserMiddleware.BaseTransaction;
20
22
  exports.ClientError = browserMiddleware.ClientError;
@@ -27,15 +29,11 @@ exports.ServerError = browserMiddleware.ServerError;
27
29
  exports.Transaction = browserMiddleware.Transaction;
28
30
  Object.defineProperty(exports, "unstable__adapter", {
29
31
  enumerable: true,
30
- get: function () {
31
- return getIt.adapter;
32
- }
32
+ get: function () { return getIt.adapter; }
33
33
  });
34
34
  Object.defineProperty(exports, "unstable__environment", {
35
35
  enumerable: true,
36
- get: function () {
37
- return getIt.environment;
38
- }
36
+ get: function () { return getIt.environment; }
39
37
  });
40
38
  exports.createClient = createClient;
41
39
  exports.default = deprecatedCreateClient;
@@ -1 +1 @@
1
- {"version":3,"file":"index.browser.cjs","sources":["../src/defineDeprecatedCreateClient.ts","../src/index.browser.ts"],"sourcesContent":["import {printNoDefaultExport} from './warnings'\n\n/* @internal */\nexport function defineDeprecatedCreateClient<SanityClientType, ClientConfigType>(\n createClient: (config: ClientConfigType) => SanityClientType,\n) {\n return function deprecatedCreateClient(config: ClientConfigType) {\n printNoDefaultExport()\n return createClient(config)\n }\n}\n","import defineCreateClientExports, {ClientConfig, SanityClient} from './defineCreateClient'\nimport {defineDeprecatedCreateClient} from './defineDeprecatedCreateClient'\nimport envMiddleware from './http/browserMiddleware'\n\nexport * from './defineCreateClient'\n\nconst exp = defineCreateClientExports<SanityClient, ClientConfig>(envMiddleware, SanityClient)\n\n/** @public */\nexport const requester = exp.requester\n\n/** @public */\nexport const createClient = exp.createClient\n\n/**\n * @public\n * @deprecated Use the named export `createClient` instead of the `default` export\n */\nconst deprecatedCreateClient = defineDeprecatedCreateClient(createClient)\nexport default deprecatedCreateClient\n"],"names":["defineDeprecatedCreateClient","createClient","deprecatedCreateClient","config","printNoDefaultExport","exp","defineCreateClientExports","envMiddleware","SanityClient","requester"],"mappings":";;;;;;;AAGO,SAASA,6BACdC,YACA,EAAA;EACO,OAAA,SAASC,uBAAuBC,MAA0B,EAAA;IAC1CC,iBAAAA,CAAAA,oBAAA,EAAA;IACrB,OAAOH,aAAaE,MAAM,CAAA;EAAA,CAC5B;AACF;ACJA,MAAME,GAAA,GAAMC,iBAAsD,CAAAA,yBAAA,CAAAC,+BAAA,EAAeC,iBAAAA,CAAAA,YAAY,CAAA;AAGtF,MAAMC,YAAYJ,GAAI,CAAAI,SAAA;AAGtB,MAAMR,eAAeI,GAAI,CAAAJ,YAAA;AAM1B,MAAAC,sBAAA,GAAyBF,6BAA6BC,YAAY,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.browser.cjs","sources":["../src/defineDeprecatedCreateClient.ts","../src/index.browser.ts"],"sourcesContent":["import {printNoDefaultExport} from './warnings'\n\n/* @internal */\nexport function defineDeprecatedCreateClient<SanityClientType, ClientConfigType>(\n createClient: (config: ClientConfigType) => SanityClientType,\n) {\n return function deprecatedCreateClient(config: ClientConfigType) {\n printNoDefaultExport()\n return createClient(config)\n }\n}\n","import defineCreateClientExports, {ClientConfig, SanityClient} from './defineCreateClient'\nimport {defineDeprecatedCreateClient} from './defineDeprecatedCreateClient'\nimport envMiddleware from './http/browserMiddleware'\n\nexport * from './defineCreateClient'\n\nconst exp = defineCreateClientExports<SanityClient, ClientConfig>(envMiddleware, SanityClient)\n\n/** @public */\nexport const requester = exp.requester\n\n/** @public */\nexport const createClient = exp.createClient\n\n/**\n * @public\n * @deprecated Use the named export `createClient` instead of the `default` export\n */\nconst deprecatedCreateClient = defineDeprecatedCreateClient(createClient)\nexport default deprecatedCreateClient\n"],"names":["printNoDefaultExport","defineCreateClientExports","envMiddleware","SanityClient"],"mappings":";;;;;;;AAGO,SAAS,6BACd,YACA,EAAA;AACA,EAAO,OAAA,SAAS,uBAAuB,MAA0B,EAAA;AAC/D,IAAqBA,sCAAA,EAAA,CAAA;AACrB,IAAA,OAAO,aAAa,MAAM,CAAA,CAAA;AAAA,GAC5B,CAAA;AACF;;ACJA,MAAM,GAAA,GAAMC,2CAAsD,CAAAC,+BAAA,EAAeC,8BAAY,CAAA,CAAA;AAGtF,MAAM,YAAY,GAAI,CAAA,UAAA;AAGtB,MAAM,eAAe,GAAI,CAAA,aAAA;AAM1B,MAAA,sBAAA,GAAyB,6BAA6B,YAAY;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,15 +1,18 @@
1
- import { printNoDefaultExport, defineCreateClientExports, SanityClient, envMiddleware } from './_chunks/browserMiddleware-eLzHI4Fk.js';
2
- export { BasePatch, BaseTransaction, ClientError, ObservablePatch, ObservableSanityClient, ObservableTransaction, Patch, ServerError, Transaction } from './_chunks/browserMiddleware-eLzHI4Fk.js';
1
+ import { printNoDefaultExport, defineCreateClientExports, SanityClient, envMiddleware } from './_chunks/browserMiddleware-heyg-fDk.js';
2
+ export { BasePatch, BaseTransaction, ClientError, ObservablePatch, ObservableSanityClient, ObservableTransaction, Patch, ServerError, Transaction } from './_chunks/browserMiddleware-heyg-fDk.js';
3
3
  export { adapter as unstable__adapter, environment as unstable__environment } from 'get-it';
4
+
4
5
  function defineDeprecatedCreateClient(createClient) {
5
6
  return function deprecatedCreateClient(config) {
6
7
  printNoDefaultExport();
7
8
  return createClient(config);
8
9
  };
9
10
  }
11
+
10
12
  const exp = defineCreateClientExports(envMiddleware, SanityClient);
11
13
  const requester = exp.requester;
12
14
  const createClient = exp.createClient;
13
15
  const deprecatedCreateClient = defineDeprecatedCreateClient(createClient);
16
+
14
17
  export { SanityClient, createClient, deprecatedCreateClient as default, requester };
15
18
  //# sourceMappingURL=index.browser.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.browser.js","sources":["../src/defineDeprecatedCreateClient.ts","../src/index.browser.ts"],"sourcesContent":["import {printNoDefaultExport} from './warnings'\n\n/* @internal */\nexport function defineDeprecatedCreateClient<SanityClientType, ClientConfigType>(\n createClient: (config: ClientConfigType) => SanityClientType,\n) {\n return function deprecatedCreateClient(config: ClientConfigType) {\n printNoDefaultExport()\n return createClient(config)\n }\n}\n","import defineCreateClientExports, {ClientConfig, SanityClient} from './defineCreateClient'\nimport {defineDeprecatedCreateClient} from './defineDeprecatedCreateClient'\nimport envMiddleware from './http/browserMiddleware'\n\nexport * from './defineCreateClient'\n\nconst exp = defineCreateClientExports<SanityClient, ClientConfig>(envMiddleware, SanityClient)\n\n/** @public */\nexport const requester = exp.requester\n\n/** @public */\nexport const createClient = exp.createClient\n\n/**\n * @public\n * @deprecated Use the named export `createClient` instead of the `default` export\n */\nconst deprecatedCreateClient = defineDeprecatedCreateClient(createClient)\nexport default deprecatedCreateClient\n"],"names":["defineDeprecatedCreateClient","createClient","deprecatedCreateClient","config","printNoDefaultExport","exp","defineCreateClientExports","envMiddleware","SanityClient","requester"],"mappings":";;;AAGO,SAASA,6BACdC,YACA,EAAA;EACO,OAAA,SAASC,uBAAuBC,MAA0B,EAAA;IAC1CC,oBAAA,EAAA;IACrB,OAAOH,aAAaE,MAAM,CAAA;EAAA,CAC5B;AACF;ACJA,MAAME,GAAA,GAAMC,yBAAsD,CAAAC,aAAA,EAAeC,YAAY,CAAA;AAGtF,MAAMC,YAAYJ,GAAI,CAAAI,SAAA;AAGtB,MAAMR,eAAeI,GAAI,CAAAJ,YAAA;AAM1B,MAAAC,sBAAA,GAAyBF,6BAA6BC,YAAY,CAAA;"}
1
+ {"version":3,"file":"index.browser.js","sources":["../src/defineDeprecatedCreateClient.ts","../src/index.browser.ts"],"sourcesContent":["import {printNoDefaultExport} from './warnings'\n\n/* @internal */\nexport function defineDeprecatedCreateClient<SanityClientType, ClientConfigType>(\n createClient: (config: ClientConfigType) => SanityClientType,\n) {\n return function deprecatedCreateClient(config: ClientConfigType) {\n printNoDefaultExport()\n return createClient(config)\n }\n}\n","import defineCreateClientExports, {ClientConfig, SanityClient} from './defineCreateClient'\nimport {defineDeprecatedCreateClient} from './defineDeprecatedCreateClient'\nimport envMiddleware from './http/browserMiddleware'\n\nexport * from './defineCreateClient'\n\nconst exp = defineCreateClientExports<SanityClient, ClientConfig>(envMiddleware, SanityClient)\n\n/** @public */\nexport const requester = exp.requester\n\n/** @public */\nexport const createClient = exp.createClient\n\n/**\n * @public\n * @deprecated Use the named export `createClient` instead of the `default` export\n */\nconst deprecatedCreateClient = defineDeprecatedCreateClient(createClient)\nexport default deprecatedCreateClient\n"],"names":[],"mappings":";;;;AAGO,SAAS,6BACd,YACA,EAAA;AACA,EAAO,OAAA,SAAS,uBAAuB,MAA0B,EAAA;AAC/D,IAAqB,oBAAA,EAAA,CAAA;AACrB,IAAA,OAAO,aAAa,MAAM,CAAA,CAAA;AAAA,GAC5B,CAAA;AACF;;ACJA,MAAM,GAAA,GAAM,yBAAsD,CAAA,aAAA,EAAe,YAAY,CAAA,CAAA;AAGtF,MAAM,YAAY,GAAI,CAAA,UAAA;AAGtB,MAAM,eAAe,GAAI,CAAA,aAAA;AAM1B,MAAA,sBAAA,GAAyB,6BAA6B,YAAY;;;;"}
package/dist/index.cjs CHANGED
@@ -1,20 +1,22 @@
1
1
  'use strict';
2
2
 
3
- Object.defineProperty(exports, '__esModule', {
4
- value: true
5
- });
6
- var nodeMiddleware = require('./_chunks/nodeMiddleware-SFcV9llR.cjs');
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var nodeMiddleware = require('./_chunks/nodeMiddleware-CHxg1-zH.cjs');
7
6
  var getIt = require('get-it');
7
+
8
8
  function defineDeprecatedCreateClient(createClient) {
9
9
  return function deprecatedCreateClient(config) {
10
10
  nodeMiddleware.printNoDefaultExport();
11
11
  return createClient(config);
12
12
  };
13
13
  }
14
+
14
15
  const exp = nodeMiddleware.defineCreateClientExports(nodeMiddleware.middleware, nodeMiddleware.SanityClient);
15
16
  const requester = exp.requester;
16
17
  const createClient = exp.createClient;
17
18
  const deprecatedCreateClient = defineDeprecatedCreateClient(createClient);
19
+
18
20
  exports.BasePatch = nodeMiddleware.BasePatch;
19
21
  exports.BaseTransaction = nodeMiddleware.BaseTransaction;
20
22
  exports.ClientError = nodeMiddleware.ClientError;
@@ -27,15 +29,11 @@ exports.ServerError = nodeMiddleware.ServerError;
27
29
  exports.Transaction = nodeMiddleware.Transaction;
28
30
  Object.defineProperty(exports, "unstable__adapter", {
29
31
  enumerable: true,
30
- get: function () {
31
- return getIt.adapter;
32
- }
32
+ get: function () { return getIt.adapter; }
33
33
  });
34
34
  Object.defineProperty(exports, "unstable__environment", {
35
35
  enumerable: true,
36
- get: function () {
37
- return getIt.environment;
38
- }
36
+ get: function () { return getIt.environment; }
39
37
  });
40
38
  exports.createClient = createClient;
41
39
  exports.default = deprecatedCreateClient;
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../src/defineDeprecatedCreateClient.ts","../src/index.ts"],"sourcesContent":["import {printNoDefaultExport} from './warnings'\n\n/* @internal */\nexport function defineDeprecatedCreateClient<SanityClientType, ClientConfigType>(\n createClient: (config: ClientConfigType) => SanityClientType,\n) {\n return function deprecatedCreateClient(config: ClientConfigType) {\n printNoDefaultExport()\n return createClient(config)\n }\n}\n","import defineCreateClientExports, {ClientConfig, SanityClient} from './defineCreateClient'\nimport {defineDeprecatedCreateClient} from './defineDeprecatedCreateClient'\nimport envMiddleware from './http/nodeMiddleware'\n\nexport * from './defineCreateClient'\n\nconst exp = defineCreateClientExports<SanityClient, ClientConfig>(envMiddleware, SanityClient)\n\n/** @public */\nexport const requester = exp.requester\n\n/** @public */\nexport const createClient = exp.createClient\n\n/**\n * @public\n * @deprecated Use the named export `createClient` instead of the `default` export\n */\nconst deprecatedCreateClient = defineDeprecatedCreateClient(createClient)\nexport default deprecatedCreateClient\n"],"names":["defineDeprecatedCreateClient","createClient","deprecatedCreateClient","config","printNoDefaultExport","exp","defineCreateClientExports","envMiddleware","SanityClient","requester"],"mappings":";;;;;;;AAGO,SAASA,6BACdC,YACA,EAAA;EACO,OAAA,SAASC,uBAAuBC,MAA0B,EAAA;IAC1CC,cAAAA,CAAAA,oBAAA,EAAA;IACrB,OAAOH,aAAaE,MAAM,CAAA;EAAA,CAC5B;AACF;ACJA,MAAME,GAAA,GAAMC,cAAsD,CAAAA,yBAAA,CAAAC,yBAAA,EAAeC,cAAAA,CAAAA,YAAY,CAAA;AAGtF,MAAMC,YAAYJ,GAAI,CAAAI,SAAA;AAGtB,MAAMR,eAAeI,GAAI,CAAAJ,YAAA;AAM1B,MAAAC,sBAAA,GAAyBF,6BAA6BC,YAAY,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.cjs","sources":["../src/defineDeprecatedCreateClient.ts","../src/index.ts"],"sourcesContent":["import {printNoDefaultExport} from './warnings'\n\n/* @internal */\nexport function defineDeprecatedCreateClient<SanityClientType, ClientConfigType>(\n createClient: (config: ClientConfigType) => SanityClientType,\n) {\n return function deprecatedCreateClient(config: ClientConfigType) {\n printNoDefaultExport()\n return createClient(config)\n }\n}\n","import defineCreateClientExports, {ClientConfig, SanityClient} from './defineCreateClient'\nimport {defineDeprecatedCreateClient} from './defineDeprecatedCreateClient'\nimport envMiddleware from './http/nodeMiddleware'\n\nexport * from './defineCreateClient'\n\nconst exp = defineCreateClientExports<SanityClient, ClientConfig>(envMiddleware, SanityClient)\n\n/** @public */\nexport const requester = exp.requester\n\n/** @public */\nexport const createClient = exp.createClient\n\n/**\n * @public\n * @deprecated Use the named export `createClient` instead of the `default` export\n */\nconst deprecatedCreateClient = defineDeprecatedCreateClient(createClient)\nexport default deprecatedCreateClient\n"],"names":["printNoDefaultExport","defineCreateClientExports","envMiddleware","SanityClient"],"mappings":";;;;;;;AAGO,SAAS,6BACd,YACA,EAAA;AACA,EAAO,OAAA,SAAS,uBAAuB,MAA0B,EAAA;AAC/D,IAAqBA,mCAAA,EAAA,CAAA;AACrB,IAAA,OAAO,aAAa,MAAM,CAAA,CAAA;AAAA,GAC5B,CAAA;AACF;;ACJA,MAAM,GAAA,GAAMC,wCAAsD,CAAAC,yBAAA,EAAeC,2BAAY,CAAA,CAAA;AAGtF,MAAM,YAAY,GAAI,CAAA,UAAA;AAGtB,MAAM,eAAe,GAAI,CAAA,aAAA;AAM1B,MAAA,sBAAA,GAAyB,6BAA6B,YAAY;;;;;;;;;;;;;;;;;;;;;;;;"}
package/dist/index.js CHANGED
@@ -1,15 +1,18 @@
1
- import { printNoDefaultExport, defineCreateClientExports, SanityClient, middleware } from './_chunks/nodeMiddleware-dn4ZacKV.js';
2
- export { BasePatch, BaseTransaction, ClientError, ObservablePatch, ObservableSanityClient, ObservableTransaction, Patch, ServerError, Transaction } from './_chunks/nodeMiddleware-dn4ZacKV.js';
1
+ import { printNoDefaultExport, defineCreateClientExports, SanityClient, middleware } from './_chunks/nodeMiddleware-u_fUUnxa.js';
2
+ export { BasePatch, BaseTransaction, ClientError, ObservablePatch, ObservableSanityClient, ObservableTransaction, Patch, ServerError, Transaction } from './_chunks/nodeMiddleware-u_fUUnxa.js';
3
3
  export { adapter as unstable__adapter, environment as unstable__environment } from 'get-it';
4
+
4
5
  function defineDeprecatedCreateClient(createClient) {
5
6
  return function deprecatedCreateClient(config) {
6
7
  printNoDefaultExport();
7
8
  return createClient(config);
8
9
  };
9
10
  }
11
+
10
12
  const exp = defineCreateClientExports(middleware, SanityClient);
11
13
  const requester = exp.requester;
12
14
  const createClient = exp.createClient;
13
15
  const deprecatedCreateClient = defineDeprecatedCreateClient(createClient);
16
+
14
17
  export { SanityClient, createClient, deprecatedCreateClient as default, requester };
15
18
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/defineDeprecatedCreateClient.ts","../src/index.ts"],"sourcesContent":["import {printNoDefaultExport} from './warnings'\n\n/* @internal */\nexport function defineDeprecatedCreateClient<SanityClientType, ClientConfigType>(\n createClient: (config: ClientConfigType) => SanityClientType,\n) {\n return function deprecatedCreateClient(config: ClientConfigType) {\n printNoDefaultExport()\n return createClient(config)\n }\n}\n","import defineCreateClientExports, {ClientConfig, SanityClient} from './defineCreateClient'\nimport {defineDeprecatedCreateClient} from './defineDeprecatedCreateClient'\nimport envMiddleware from './http/nodeMiddleware'\n\nexport * from './defineCreateClient'\n\nconst exp = defineCreateClientExports<SanityClient, ClientConfig>(envMiddleware, SanityClient)\n\n/** @public */\nexport const requester = exp.requester\n\n/** @public */\nexport const createClient = exp.createClient\n\n/**\n * @public\n * @deprecated Use the named export `createClient` instead of the `default` export\n */\nconst deprecatedCreateClient = defineDeprecatedCreateClient(createClient)\nexport default deprecatedCreateClient\n"],"names":["defineDeprecatedCreateClient","createClient","deprecatedCreateClient","config","printNoDefaultExport","exp","defineCreateClientExports","envMiddleware","SanityClient","requester"],"mappings":";;;AAGO,SAASA,6BACdC,YACA,EAAA;EACO,OAAA,SAASC,uBAAuBC,MAA0B,EAAA;IAC1CC,oBAAA,EAAA;IACrB,OAAOH,aAAaE,MAAM,CAAA;EAAA,CAC5B;AACF;ACJA,MAAME,GAAA,GAAMC,yBAAsD,CAAAC,UAAA,EAAeC,YAAY,CAAA;AAGtF,MAAMC,YAAYJ,GAAI,CAAAI,SAAA;AAGtB,MAAMR,eAAeI,GAAI,CAAAJ,YAAA;AAM1B,MAAAC,sBAAA,GAAyBF,6BAA6BC,YAAY,CAAA;"}
1
+ {"version":3,"file":"index.js","sources":["../src/defineDeprecatedCreateClient.ts","../src/index.ts"],"sourcesContent":["import {printNoDefaultExport} from './warnings'\n\n/* @internal */\nexport function defineDeprecatedCreateClient<SanityClientType, ClientConfigType>(\n createClient: (config: ClientConfigType) => SanityClientType,\n) {\n return function deprecatedCreateClient(config: ClientConfigType) {\n printNoDefaultExport()\n return createClient(config)\n }\n}\n","import defineCreateClientExports, {ClientConfig, SanityClient} from './defineCreateClient'\nimport {defineDeprecatedCreateClient} from './defineDeprecatedCreateClient'\nimport envMiddleware from './http/nodeMiddleware'\n\nexport * from './defineCreateClient'\n\nconst exp = defineCreateClientExports<SanityClient, ClientConfig>(envMiddleware, SanityClient)\n\n/** @public */\nexport const requester = exp.requester\n\n/** @public */\nexport const createClient = exp.createClient\n\n/**\n * @public\n * @deprecated Use the named export `createClient` instead of the `default` export\n */\nconst deprecatedCreateClient = defineDeprecatedCreateClient(createClient)\nexport default deprecatedCreateClient\n"],"names":["envMiddleware"],"mappings":";;;;AAGO,SAAS,6BACd,YACA,EAAA;AACA,EAAO,OAAA,SAAS,uBAAuB,MAA0B,EAAA;AAC/D,IAAqB,oBAAA,EAAA,CAAA;AACrB,IAAA,OAAO,aAAa,MAAM,CAAA,CAAA;AAAA,GAC5B,CAAA;AACF;;ACJA,MAAM,GAAA,GAAM,yBAAsD,CAAAA,UAAA,EAAe,YAAY,CAAA,CAAA;AAGtF,MAAM,YAAY,GAAI,CAAA,UAAA;AAGtB,MAAM,eAAe,GAAI,CAAA,aAAA;AAM1B,MAAA,sBAAA,GAAyB,6BAA6B,YAAY;;;;"}