@contentful/content-source-maps
Advanced tools
Comparing version 0.11.5 to 0.11.6
@@ -1,2 +0,5 @@ | ||
import type { CreateSourceMapParams, GraphQLResponse } from '../types.js'; | ||
export declare const encodeGraphQLResponse: (originalGraphqlResponse: GraphQLResponse, targetOrigin?: CreateSourceMapParams["targetOrigin"], platform?: CreateSourceMapParams["platform"]) => GraphQLResponse; | ||
import type { CreateSourceMapParams } from '../types.js'; | ||
export declare const encodeGraphQLResponse: <TResponse extends { | ||
data: any; | ||
extensions: any; | ||
}>(originalGraphqlResponse: TResponse, targetOrigin?: CreateSourceMapParams["targetOrigin"], platform?: CreateSourceMapParams["platform"]) => TResponse; |
@@ -24,5 +24,5 @@ var R = { 0: 8203, 1: 8204, 2: 8205, 3: 8290, 4: 8291, 5: 8288, 6: 65279, 7: 8289, 8: 119155, 9: 119156, a: 119157, b: 119158, c: 119159, d: 119160, e: 119161, f: 119162 }, b = { 0: 8203, 1: 8204, 2: 8205, 3: 65279 }, V = new Array(4).fill(String.fromCodePoint(b[0])).join(""), J = "\0"; | ||
} | ||
var Z = Object.fromEntries(Object.entries(b).map((e) => e.reverse())), k = Object.fromEntries(Object.entries(R).map((e) => e.reverse())), G = `${Object.values(R).map((e) => `\\u{${e.toString(16)}}`).join("")}`, I = new RegExp(`[${G}]{4,}`, "gu"); | ||
var Z = Object.fromEntries(Object.entries(b).map((e) => e.reverse())), k = Object.fromEntries(Object.entries(R).map((e) => e.reverse())), G = `${Object.values(R).map((e) => `\\u{${e.toString(16)}}`).join("")}`, O = new RegExp(`[${G}]{4,}`, "gu"); | ||
function H(e) { | ||
let t = e.match(I); | ||
let t = e.match(O); | ||
if (t) return K(t[0], !0)[0]; | ||
@@ -70,3 +70,3 @@ } | ||
var t; | ||
return { cleaned: e.replace(I, ""), encoded: ((t = e.match(I)) == null ? void 0 : t[0]) || "" }; | ||
return { cleaned: e.replace(O, ""), encoded: ((t = e.match(O)) == null ? void 0 : t[0]) || "" }; | ||
} | ||
@@ -215,8 +215,2 @@ function T(e, t) { | ||
contentful: { | ||
space: o, | ||
environment: n, | ||
field: r, | ||
locale: s, | ||
entity: e, | ||
entityType: t, | ||
editorInterface: i, | ||
@@ -226,3 +220,3 @@ fieldType: c | ||
}; | ||
return f === "vercel" && delete d.contentful, f === "contentful" && delete d.href, d; | ||
return f === "vercel" && delete d.contentful, d; | ||
}, W = (e) => ["builtin", "sidebar-builtin", "editor-builtin"].includes(e), U = (e) => oe.includes(e); | ||
@@ -281,5 +275,3 @@ function j(e) { | ||
), e; | ||
const n = j( | ||
e | ||
), { | ||
const n = j(e), { | ||
spaces: r, | ||
@@ -299,4 +291,4 @@ environments: s, | ||
return n; | ||
const S = r[m.space], A = s[m.environment], E = m.id, w = c[l.field], N = u[l.locale], O = i[l.editorInterface], L = v[l.fieldType]; | ||
if (!(W(O.widgetNamespace) && !U(O.widgetId)) && y.has(h, d)) { | ||
const S = r[m.space], A = s[m.environment], E = m.id, w = c[l.field], I = u[l.locale], N = i[l.editorInterface], L = v[l.fieldType]; | ||
if (!(W(N.widgetNamespace) && !U(N.widgetId)) && y.has(h, d)) { | ||
const M = y.get(h, d); | ||
@@ -310,4 +302,4 @@ if (M !== null) { | ||
field: w, | ||
locale: N, | ||
editorInterface: O, | ||
locale: I, | ||
editorInterface: N, | ||
fieldType: L, | ||
@@ -362,3 +354,3 @@ targetOrigin: t, | ||
Object.keys(m).forEach((w) => { | ||
const N = x({ | ||
const I = x({ | ||
entityId: g, | ||
@@ -378,3 +370,3 @@ entityType: v, | ||
m, | ||
N, | ||
I, | ||
e, | ||
@@ -381,0 +373,0 @@ `${l}/${w}`, |
import type { AssetSys, Entry as ContentfulEntry, EntryCollection as ContentfulEntryCollection, EntrySys as ContentfulEntrySys, EntrySkeletonType } from 'contentful'; | ||
type ContentfulMetadata = { | ||
space: string; | ||
environment: string; | ||
entity: string; | ||
entityType: string; | ||
field: string; | ||
locale: string; | ||
editorInterface: { | ||
@@ -26,3 +20,3 @@ widgetNamespace: string; | ||
entityId: string; | ||
entityType: string; | ||
entityType: 'Entry' | 'Asset'; | ||
space: string; | ||
@@ -93,6 +87,7 @@ environment: string; | ||
} | ||
export interface GraphQLResponse { | ||
data: any; | ||
export interface GraphQLResponse<TData = any> { | ||
data: TData; | ||
extensions: { | ||
contentSourceMaps: GraphQLContentSourceMaps; | ||
contentSourceMaps?: GraphQLContentSourceMaps; | ||
[key: string]: any; | ||
}; | ||
@@ -99,0 +94,0 @@ } |
{ | ||
"name": "@contentful/content-source-maps", | ||
"author": "Contentful GmbH", | ||
"version": "0.11.5", | ||
"version": "0.11.6", | ||
"description": "Base SDK for building Content Source Maps with Contentful", | ||
@@ -49,3 +49,3 @@ "license": "MIT", | ||
}, | ||
"gitHead": "16e800bb2d08441635243906545ef6b360e6658b" | ||
"gitHead": "99360eebf6fd0f39f26aa0180ba113d6b6a762f6" | ||
} |
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
107848
604