@sanity/util 6.19.0-next.36 → 6.19.0-next.40

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.
package/lib/content.d.ts CHANGED
@@ -33,4 +33,5 @@ export declare function isShallowEmptyObject(value: {
33
33
  }): boolean;
34
34
  export declare function randomKey(length?: number): string;
35
35
  export declare function resolveTypeName(value: unknown): string;
36
+ export {};
36
37
  //# sourceMappingURL=content.d.ts.map
@@ -1,6 +1,12 @@
1
+ /**
2
+ * @internal
3
+ */
1
4
  interface Options {
2
5
  errorLabel: string;
3
6
  }
7
+ /**
8
+ * @internal
9
+ */
4
10
  type Parser<Type> = (line: string) => Type;
5
11
  /**
6
12
  * Create a safe JSON parser that is able to handle lines interrupted by an error object.
@@ -11,4 +17,5 @@ type Parser<Type> = (line: string) => Type;
11
17
  * @see {@link https://github.com/sanity-io/sanity/pull/1787 | Initial pull request}
12
18
  */
13
19
  export declare function createSafeJsonParser<Type>({ errorLabel }: Options): Parser<Type>;
20
+ export type { Options, Parser };
14
21
  //# sourceMappingURL=createSafeJsonParser.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"createSafeJsonParser.js","names":[],"sources":["../src/createSafeJsonParser.ts"],"sourcesContent":["interface Options {\n errorLabel: string\n}\n\ntype Parser<Type> = (line: string) => Type\n\n/**\n * Create a safe JSON parser that is able to handle lines interrupted by an error object.\n *\n * This may occur when streaming NDJSON from the Export HTTP API.\n *\n * @internal\n * @see {@link https://github.com/sanity-io/sanity/pull/1787 | Initial pull request}\n */\nexport function createSafeJsonParser<Type>({errorLabel}: Options): Parser<Type> {\n return function safeJsonParser(line) {\n try {\n return JSON.parse(line)\n } catch (err) {\n // Catch half-done lines with an error at the end\n const errorPosition = line.lastIndexOf('{\"error\":')\n if (errorPosition === -1) {\n err.message = `${err.message} (${line})`\n throw err\n }\n\n const errorJson = line.slice(errorPosition)\n const errorLine = JSON.parse(errorJson)\n const error = errorLine && errorLine.error\n if (error && error.description) {\n throw new Error(`${errorLabel}: ${error.description}\\n\\n${errorJson}\\n`, {cause: err})\n }\n\n throw err\n }\n }\n}\n"],"mappings":";;;;;;;;AAcA,SAAgB,qBAA2B,EAAC,cAAoC;CAC9E,OAAO,SAAS,eAAe,MAAM;EACnC,IAAI;GACF,OAAO,KAAK,MAAM,IAAI;EACxB,SAAS,KAAK;GAEZ,IAAM,gBAAgB,KAAK,YAAY,aAAW;GAClD,IAAI,kBAAkB,IAEpB,MADA,IAAI,UAAU,GAAG,IAAI,QAAQ,IAAI,KAAK,IAChC;GAGR,IAAM,YAAY,KAAK,MAAM,aAAa,GACpC,YAAY,KAAK,MAAM,SAAS,GAChC,QAAQ,aAAa,UAAU;GAKrC,MAJI,SAAS,MAAM,cACP,MAAM,GAAG,WAAW,IAAI,MAAM,YAAY,MAAM,UAAU,KAAK,EAAC,OAAO,IAAG,CAAC,IAGjF;EACR;CACF;AACF"}
1
+ {"version":3,"file":"createSafeJsonParser.js","names":[],"sources":["../src/createSafeJsonParser.ts"],"sourcesContent":["/**\n * @internal\n */\nexport interface Options {\n errorLabel: string\n}\n\n/**\n * @internal\n */\nexport type Parser<Type> = (line: string) => Type\n\n/**\n * Create a safe JSON parser that is able to handle lines interrupted by an error object.\n *\n * This may occur when streaming NDJSON from the Export HTTP API.\n *\n * @internal\n * @see {@link https://github.com/sanity-io/sanity/pull/1787 | Initial pull request}\n */\nexport function createSafeJsonParser<Type>({errorLabel}: Options): Parser<Type> {\n return function safeJsonParser(line) {\n try {\n return JSON.parse(line)\n } catch (err) {\n // Catch half-done lines with an error at the end\n const errorPosition = line.lastIndexOf('{\"error\":')\n if (errorPosition === -1) {\n err.message = `${err.message} (${line})`\n throw err\n }\n\n const errorJson = line.slice(errorPosition)\n const errorLine = JSON.parse(errorJson)\n const error = errorLine && errorLine.error\n if (error && error.description) {\n throw new Error(`${errorLabel}: ${error.description}\\n\\n${errorJson}\\n`, {cause: err})\n }\n\n throw err\n }\n }\n}\n"],"mappings":";;;;;;;;AAoBA,SAAgB,qBAA2B,EAAC,cAAoC;CAC9E,OAAO,SAAS,eAAe,MAAM;EACnC,IAAI;GACF,OAAO,KAAK,MAAM,IAAI;EACxB,SAAS,KAAK;GAEZ,IAAM,gBAAgB,KAAK,YAAY,aAAW;GAClD,IAAI,kBAAkB,IAEpB,MADA,IAAI,UAAU,GAAG,IAAI,QAAQ,IAAI,KAAK,IAChC;GAGR,IAAM,YAAY,KAAK,MAAM,aAAa,GACpC,YAAY,KAAK,MAAM,SAAS,GAChC,QAAQ,aAAa,UAAU;GAKrC,MAJI,SAAS,MAAM,cACP,MAAM,GAAG,WAAW,IAAI,MAAM,YAAY,MAAM,UAAU,KAAK,EAAC,OAAO,IAAG,CAAC,IAGjF;EACR;CACF;AACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/util",
3
- "version": "6.19.0-next.36",
3
+ "version": "6.19.0-next.40",
4
4
  "description": "Utilities shared across projects of Sanity",
5
5
  "keywords": [
6
6
  "cms",
@@ -67,7 +67,7 @@
67
67
  "@date-fns/tz": "^1.5.0",
68
68
  "@date-fns/utc": "^2.1.1",
69
69
  "@sanity/client": "^8.9.0",
70
- "@sanity/types": "6.19.0-next.36+12b7afda89",
70
+ "@sanity/types": "6.19.0-next.40+00c89636c4",
71
71
  "date-fns": "^4.4.0",
72
72
  "get-it": "^9.6.1",
73
73
  "rxjs": "^7.8.2"
@@ -77,7 +77,7 @@
77
77
  "@repo/tsconfig": "6.9.2",
78
78
  "@repo/tsdown.config": "6.9.2",
79
79
  "@types/node": "^24.13.3",
80
- "tsdown": "^0.23.0",
80
+ "tsdown": "^0.23.1",
81
81
  "typescript": "^7.0.2",
82
82
  "vite": "^8.3.4",
83
83
  "vitest": "^5.0.3"