@sanity/cli 3.36.4 → 3.36.5-canary.34
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/_chunks-cjs/cli.js +1779 -1317
- package/lib/_chunks-cjs/cli.js.map +1 -1
- package/lib/_chunks-cjs/journeyConfig.js +11 -11
- package/lib/_chunks-cjs/journeyConfig.js.map +1 -1
- package/lib/_chunks-cjs/loadEnv.js +105 -2719
- package/lib/_chunks-cjs/loadEnv.js.map +1 -1
- package/lib/cli.d.ts +10 -0
- package/lib/index.d.ts +448 -0
- package/lib/index.esm.js +449 -5
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +3 -3
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +452 -0
- package/lib/index.mjs.map +1 -0
- package/lib/run.d.ts +1 -0
- package/lib/workers/getAndWriteJourneySchema.d.ts +1 -0
- package/lib/workers/getCliConfig.d.ts +1 -0
- package/lib/workers/typegenGenerate.d.ts +37 -0
- package/lib/workers/typegenGenerate.js +6 -2
- package/lib/workers/typegenGenerate.js.map +1 -1
- package/package.json +18 -21
- package/src/actions/init-project/templates/shopify.ts +7 -0
- package/src/util/journeyConfig.ts +5 -5
- package/templates/ecommerce/plugins/barcode-input/BarcodeInput.js +1 -1
- package/templates/get-started/plugins/sanity-plugin-tutorial/GetStartedTutorial.tsx +1 -1
- package/templates/shared/tsconfig.json +2 -4
- package/templates/shopify/README.md +3 -3
- package/templates/shopify/components/hotspots/ProductTooltip.tsx +1 -1
- package/templates/shopify/components/icons/Shopify.tsx +1 -1
- package/templates/shopify/components/inputs/CollectionHidden.tsx +1 -1
- package/templates/shopify/components/media/ColorTheme.tsx +1 -1
- package/templates/shopify/components/studio/Navbar.tsx +29 -0
- package/templates/shopify/constants.ts +31 -1
- package/templates/shopify/docs/features.md +6 -7
- package/templates/shopify/schemaTypes/documents/collection.tsx +11 -47
- package/templates/shopify/schemaTypes/documents/colorTheme.tsx +2 -17
- package/templates/shopify/schemaTypes/documents/page.ts +10 -37
- package/templates/shopify/schemaTypes/documents/product.tsx +4 -27
- package/templates/shopify/schemaTypes/documents/productVariant.tsx +4 -13
- package/templates/shopify/schemaTypes/index.ts +97 -126
- package/templates/shopify/schemaTypes/objects/collection/{group.ts → collectionGroupType.ts} +7 -10
- package/templates/shopify/schemaTypes/objects/collection/{links.ts → collectionLinksType.ts} +4 -4
- package/templates/shopify/schemaTypes/objects/customProductOption/{colorObject.tsx → customProductOptionColorObjectType.tsx} +3 -6
- package/templates/shopify/schemaTypes/objects/customProductOption/{color.tsx → customProductOptionColorType.tsx} +2 -10
- package/templates/shopify/schemaTypes/objects/customProductOption/{sizeObject.ts → customProductOptionSizeObjectType.ts} +3 -7
- package/templates/shopify/schemaTypes/objects/customProductOption/{size.ts → customProductOptionSizeType.ts} +3 -12
- package/templates/shopify/schemaTypes/objects/global/footerType.ts +22 -0
- package/templates/shopify/schemaTypes/objects/global/menuLinksType.ts +21 -0
- package/templates/shopify/schemaTypes/objects/global/{menu.ts → menuType.ts} +2 -4
- package/templates/shopify/schemaTypes/objects/global/{notFoundPage.ts → notFoundPageType.ts} +1 -6
- package/templates/shopify/schemaTypes/objects/hotspot/{imageWithProductHotspots.ts → imageWithProductHotspotsType.ts} +4 -6
- package/templates/shopify/schemaTypes/objects/hotspot/{productHotspots.tsx → productHotspotsType.tsx} +3 -5
- package/templates/shopify/schemaTypes/objects/hotspot/{spot.tsx → spotType.tsx} +1 -3
- package/templates/shopify/schemaTypes/{annotations/linkEmail.tsx → objects/link/linkEmailType.tsx} +5 -13
- package/templates/shopify/schemaTypes/{annotations/linkExternal.tsx → objects/link/linkExternalType.tsx} +6 -13
- package/templates/shopify/schemaTypes/{annotations/linkInternal.tsx → objects/link/linkInternalType.tsx} +5 -12
- package/templates/shopify/schemaTypes/{annotations/product.tsx → objects/link/linkProductType.tsx} +4 -16
- package/templates/shopify/schemaTypes/objects/module/{accordionGroup.ts → accordionGroupType.ts} +6 -9
- package/templates/shopify/schemaTypes/objects/module/{accordion.ts → accordionType.ts} +4 -11
- package/templates/shopify/schemaTypes/objects/module/{callToAction.tsx → callToActionType.tsx} +10 -23
- package/templates/shopify/schemaTypes/objects/module/{callout.ts → calloutType.ts} +4 -10
- package/templates/shopify/schemaTypes/objects/module/{collection.tsx → collectionReferenceType.tsx} +4 -9
- package/templates/shopify/schemaTypes/objects/module/gridItemType.ts +41 -0
- package/templates/shopify/schemaTypes/objects/module/{grid.ts → gridType.ts} +7 -15
- package/templates/shopify/schemaTypes/objects/{hero/home.tsx → module/heroType.tsx} +14 -17
- package/templates/shopify/schemaTypes/objects/module/{imageCallToAction.tsx → imageCallToActionType.tsx} +6 -10
- package/templates/shopify/schemaTypes/objects/module/{image.ts → imageFeatureType.ts} +6 -18
- package/templates/shopify/schemaTypes/objects/module/{images.tsx → imageFeaturesType.tsx} +7 -25
- package/templates/shopify/schemaTypes/objects/module/{instagram.ts → instagramType.ts} +2 -2
- package/templates/shopify/schemaTypes/objects/module/{products.tsx → productFeaturesType.tsx} +6 -11
- package/templates/shopify/schemaTypes/objects/module/{product.tsx → productReferenceType.tsx} +6 -8
- package/templates/shopify/schemaTypes/objects/{seo/seo.ts → seoType.ts} +7 -6
- package/templates/shopify/schemaTypes/objects/shopify/{shopifyCollectionRule.tsx → collectionRuleType.tsx} +2 -10
- package/templates/shopify/schemaTypes/objects/shopify/{inventory.ts → inventoryType.ts} +7 -12
- package/templates/shopify/schemaTypes/objects/shopify/{option.tsx → optionType.tsx} +6 -12
- package/templates/shopify/schemaTypes/objects/shopify/{placeholderString.ts → placeholderStringType.ts} +3 -1
- package/templates/shopify/schemaTypes/objects/shopify/{priceRange.ts → priceRangeType.ts} +5 -7
- package/templates/shopify/schemaTypes/objects/shopify/{productWithVariant.tsx → productWithVariantType.tsx} +2 -2
- package/templates/shopify/schemaTypes/objects/shopify/{proxyString.ts → proxyStringType.ts} +1 -1
- package/templates/shopify/schemaTypes/objects/shopify/{shopifyCollection.ts → shopifyCollectionType.ts} +4 -25
- package/templates/shopify/schemaTypes/objects/shopify/{shopifyProduct.ts → shopifyProductType.ts} +5 -35
- package/templates/shopify/schemaTypes/objects/shopify/{shopifyProductVariant.ts → shopifyProductVariantType.ts} +1 -27
- package/templates/shopify/schemaTypes/portableText/portableTextSimpleType.tsx +45 -0
- package/templates/shopify/schemaTypes/portableText/portableTextType.tsx +52 -0
- package/templates/shopify/schemaTypes/singletons/homeType.ts +49 -0
- package/templates/shopify/schemaTypes/singletons/{settings.ts → settingsType.ts} +7 -9
- package/templates/shopify/utils/shopifyUrls.ts +3 -3
- package/templates/shopify/utils/validateSlug.ts +3 -7
- package/lib/_chunks-cjs/index.js +0 -547
- package/lib/_chunks-cjs/index.js.map +0 -1
- package/lib/_chunks-cjs/node.js +0 -213
- package/lib/_chunks-cjs/node.js.map +0 -1
- package/lib/_chunks-cjs/stegaEncodeSourceMap.js +0 -357
- package/lib/_chunks-cjs/stegaEncodeSourceMap.js.map +0 -1
- package/lib/_chunks-es/index.js +0 -3336
- package/lib/_chunks-es/index.js.map +0 -1
- package/lib/_chunks-es/node.js +0 -216
- package/lib/_chunks-es/node.js.map +0 -1
- package/lib/_chunks-es/stegaEncodeSourceMap.js +0 -358
- package/lib/_chunks-es/stegaEncodeSourceMap.js.map +0 -1
- package/lib/index.cjs.mjs +0 -7
- package/templates/shopify/schemaTypes/blocks/body.tsx +0 -70
- package/templates/shopify/schemaTypes/objects/global/footer.ts +0 -57
- package/templates/shopify/schemaTypes/objects/global/linkExternal.ts +0 -52
- package/templates/shopify/schemaTypes/objects/global/linkInternal.ts +0 -65
- package/templates/shopify/schemaTypes/objects/global/links.ts +0 -16
- package/templates/shopify/schemaTypes/objects/hero/collection.tsx +0 -42
- package/templates/shopify/schemaTypes/objects/hero/page.tsx +0 -35
- package/templates/shopify/schemaTypes/objects/module/accordionBody.ts +0 -45
- package/templates/shopify/schemaTypes/objects/module/gridItem.ts +0 -91
- package/templates/shopify/schemaTypes/objects/seo/description.tsx +0 -10
- package/templates/shopify/schemaTypes/objects/seo/home.tsx +0 -31
- package/templates/shopify/schemaTypes/objects/seo/page.tsx +0 -37
- package/templates/shopify/schemaTypes/objects/seo/shopify.tsx +0 -40
- package/templates/shopify/schemaTypes/singletons/home.ts +0 -62
- /package/lib/{dts/src/index.d.ts → index.d.mts} +0 -0
package/lib/_chunks-es/node.js
DELETED
@@ -1,216 +0,0 @@
|
|
1
|
-
import { g as getDefaultExportFromCjs } from "./index.js";
|
2
|
-
import require$$0 from "url";
|
3
|
-
import require$$1 from "events";
|
4
|
-
import require$$2 from "https";
|
5
|
-
import require$$3 from "http";
|
6
|
-
import require$$1$1 from "util";
|
7
|
-
var parse = require$$0.parse, events = require$$1, https = require$$2, http = require$$3, util = require$$1$1, httpsOptions = [
|
8
|
-
"pfx",
|
9
|
-
"key",
|
10
|
-
"passphrase",
|
11
|
-
"cert",
|
12
|
-
"ca",
|
13
|
-
"ciphers",
|
14
|
-
"rejectUnauthorized",
|
15
|
-
"secureProtocol",
|
16
|
-
"servername",
|
17
|
-
"checkServerIdentity"
|
18
|
-
], bom = [239, 187, 191], colon = 58, space = 32, lineFeed = 10, carriageReturn = 13, maxBufferAheadAllocation = 1024 * 256, reUnsafeHeader = /^(cookie|authorization)$/i;
|
19
|
-
function hasBom(buf) {
|
20
|
-
return bom.every(function(charCode, index) {
|
21
|
-
return buf[index] === charCode;
|
22
|
-
});
|
23
|
-
}
|
24
|
-
function EventSource(url, eventSourceInitDict) {
|
25
|
-
var readyState = EventSource.CONNECTING, headers = eventSourceInitDict && eventSourceInitDict.headers, hasNewOrigin = !1;
|
26
|
-
Object.defineProperty(this, "readyState", {
|
27
|
-
get: function() {
|
28
|
-
return readyState;
|
29
|
-
}
|
30
|
-
}), Object.defineProperty(this, "url", {
|
31
|
-
get: function() {
|
32
|
-
return url;
|
33
|
-
}
|
34
|
-
});
|
35
|
-
var self = this;
|
36
|
-
self.reconnectInterval = 1e3, self.connectionInProgress = !1;
|
37
|
-
function onConnectionClosed(message) {
|
38
|
-
readyState !== EventSource.CLOSED && (readyState = EventSource.CONNECTING, _emit("error", new Event("error", { message })), reconnectUrl && (url = reconnectUrl, reconnectUrl = null, hasNewOrigin = !1), setTimeout(function() {
|
39
|
-
readyState !== EventSource.CONNECTING || self.connectionInProgress || (self.connectionInProgress = !0, connect());
|
40
|
-
}, self.reconnectInterval));
|
41
|
-
}
|
42
|
-
var req, lastEventId = "";
|
43
|
-
headers && headers["Last-Event-ID"] && (lastEventId = headers["Last-Event-ID"], delete headers["Last-Event-ID"]);
|
44
|
-
var discardTrailingNewline = !1, data = "", eventName = "", reconnectUrl = null;
|
45
|
-
function connect() {
|
46
|
-
var options = parse(url), isSecure = options.protocol === "https:";
|
47
|
-
if (options.headers = { "Cache-Control": "no-cache", Accept: "text/event-stream" }, lastEventId && (options.headers["Last-Event-ID"] = lastEventId), headers) {
|
48
|
-
var reqHeaders = hasNewOrigin ? removeUnsafeHeaders(headers) : headers;
|
49
|
-
for (var i in reqHeaders) {
|
50
|
-
var header = reqHeaders[i];
|
51
|
-
header && (options.headers[i] = header);
|
52
|
-
}
|
53
|
-
}
|
54
|
-
options.rejectUnauthorized = !(eventSourceInitDict && !eventSourceInitDict.rejectUnauthorized), eventSourceInitDict && eventSourceInitDict.createConnection !== void 0 && (options.createConnection = eventSourceInitDict.createConnection);
|
55
|
-
var useProxy = eventSourceInitDict && eventSourceInitDict.proxy;
|
56
|
-
if (useProxy) {
|
57
|
-
var proxy = parse(eventSourceInitDict.proxy);
|
58
|
-
isSecure = proxy.protocol === "https:", options.protocol = isSecure ? "https:" : "http:", options.path = url, options.headers.Host = options.host, options.hostname = proxy.hostname, options.host = proxy.host, options.port = proxy.port;
|
59
|
-
}
|
60
|
-
if (eventSourceInitDict && eventSourceInitDict.https) {
|
61
|
-
for (var optName in eventSourceInitDict.https)
|
62
|
-
if (httpsOptions.indexOf(optName) !== -1) {
|
63
|
-
var option = eventSourceInitDict.https[optName];
|
64
|
-
option !== void 0 && (options[optName] = option);
|
65
|
-
}
|
66
|
-
}
|
67
|
-
eventSourceInitDict && eventSourceInitDict.withCredentials !== void 0 && (options.withCredentials = eventSourceInitDict.withCredentials), req = (isSecure ? https : http).request(options, function(res) {
|
68
|
-
if (self.connectionInProgress = !1, res.statusCode === 500 || res.statusCode === 502 || res.statusCode === 503 || res.statusCode === 504) {
|
69
|
-
_emit("error", new Event("error", { status: res.statusCode, message: res.statusMessage })), onConnectionClosed();
|
70
|
-
return;
|
71
|
-
}
|
72
|
-
if (res.statusCode === 301 || res.statusCode === 302 || res.statusCode === 307) {
|
73
|
-
var location = res.headers.location;
|
74
|
-
if (!location) {
|
75
|
-
_emit("error", new Event("error", { status: res.statusCode, message: res.statusMessage }));
|
76
|
-
return;
|
77
|
-
}
|
78
|
-
var prevOrigin = new URL(url).origin, nextOrigin = new URL(location).origin;
|
79
|
-
hasNewOrigin = prevOrigin !== nextOrigin, res.statusCode === 307 && (reconnectUrl = url), url = location, process.nextTick(connect);
|
80
|
-
return;
|
81
|
-
}
|
82
|
-
if (res.statusCode !== 200)
|
83
|
-
return _emit("error", new Event("error", { status: res.statusCode, message: res.statusMessage })), self.close();
|
84
|
-
readyState = EventSource.OPEN, res.on("close", function() {
|
85
|
-
res.removeAllListeners("close"), res.removeAllListeners("end"), onConnectionClosed();
|
86
|
-
}), res.on("end", function() {
|
87
|
-
res.removeAllListeners("close"), res.removeAllListeners("end"), onConnectionClosed();
|
88
|
-
}), _emit("open", new Event("open"));
|
89
|
-
var buf, newBuffer, startingPos = 0, startingFieldLength = -1, newBufferSize = 0, bytesUsed = 0;
|
90
|
-
res.on("data", function(chunk) {
|
91
|
-
buf ? (chunk.length > buf.length - bytesUsed && (newBufferSize = buf.length * 2 + chunk.length, newBufferSize > maxBufferAheadAllocation && (newBufferSize = buf.length + chunk.length + maxBufferAheadAllocation), newBuffer = Buffer.alloc(newBufferSize), buf.copy(newBuffer, 0, 0, bytesUsed), buf = newBuffer), chunk.copy(buf, bytesUsed), bytesUsed += chunk.length) : (buf = chunk, hasBom(buf) && (buf = buf.slice(bom.length)), bytesUsed = buf.length);
|
92
|
-
for (var pos = 0, length = bytesUsed; pos < length; ) {
|
93
|
-
discardTrailingNewline && (buf[pos] === lineFeed && ++pos, discardTrailingNewline = !1);
|
94
|
-
for (var lineLength = -1, fieldLength = startingFieldLength, c, i2 = startingPos; lineLength < 0 && i2 < length; ++i2)
|
95
|
-
c = buf[i2], c === colon ? fieldLength < 0 && (fieldLength = i2 - pos) : c === carriageReturn ? (discardTrailingNewline = !0, lineLength = i2 - pos) : c === lineFeed && (lineLength = i2 - pos);
|
96
|
-
if (lineLength < 0) {
|
97
|
-
startingPos = length - pos, startingFieldLength = fieldLength;
|
98
|
-
break;
|
99
|
-
} else
|
100
|
-
startingPos = 0, startingFieldLength = -1;
|
101
|
-
parseEventStreamLine(buf, pos, fieldLength, lineLength), pos += lineLength + 1;
|
102
|
-
}
|
103
|
-
pos === length ? (buf = void 0, bytesUsed = 0) : pos > 0 && (buf = buf.slice(pos, bytesUsed), bytesUsed = buf.length);
|
104
|
-
});
|
105
|
-
}), req.on("error", function(err) {
|
106
|
-
self.connectionInProgress = !1, onConnectionClosed(err.message);
|
107
|
-
}), req.setNoDelay && req.setNoDelay(!0), req.end();
|
108
|
-
}
|
109
|
-
connect();
|
110
|
-
function _emit() {
|
111
|
-
self.listeners(arguments[0]).length > 0 && self.emit.apply(self, arguments);
|
112
|
-
}
|
113
|
-
this._close = function() {
|
114
|
-
readyState !== EventSource.CLOSED && (readyState = EventSource.CLOSED, req.abort && req.abort(), req.xhr && req.xhr.abort && req.xhr.abort());
|
115
|
-
};
|
116
|
-
function parseEventStreamLine(buf, pos, fieldLength, lineLength) {
|
117
|
-
if (lineLength === 0) {
|
118
|
-
if (data.length > 0) {
|
119
|
-
var type = eventName || "message";
|
120
|
-
_emit(type, new MessageEvent(type, {
|
121
|
-
data: data.slice(0, -1),
|
122
|
-
// remove trailing newline
|
123
|
-
lastEventId,
|
124
|
-
origin: new URL(url).origin
|
125
|
-
})), data = "";
|
126
|
-
}
|
127
|
-
eventName = void 0;
|
128
|
-
} else if (fieldLength > 0) {
|
129
|
-
var noValue = fieldLength < 0, step = 0, field = buf.slice(pos, pos + (noValue ? lineLength : fieldLength)).toString();
|
130
|
-
noValue ? step = lineLength : buf[pos + fieldLength + 1] !== space ? step = fieldLength + 1 : step = fieldLength + 2, pos += step;
|
131
|
-
var valueLength = lineLength - step, value = buf.slice(pos, pos + valueLength).toString();
|
132
|
-
if (field === "data")
|
133
|
-
data += value + `
|
134
|
-
`;
|
135
|
-
else if (field === "event")
|
136
|
-
eventName = value;
|
137
|
-
else if (field === "id")
|
138
|
-
lastEventId = value;
|
139
|
-
else if (field === "retry") {
|
140
|
-
var retry = parseInt(value, 10);
|
141
|
-
Number.isNaN(retry) || (self.reconnectInterval = retry);
|
142
|
-
}
|
143
|
-
}
|
144
|
-
}
|
145
|
-
}
|
146
|
-
var eventsource = EventSource;
|
147
|
-
util.inherits(EventSource, events.EventEmitter);
|
148
|
-
EventSource.prototype.constructor = EventSource;
|
149
|
-
["open", "error", "message"].forEach(function(method) {
|
150
|
-
Object.defineProperty(EventSource.prototype, "on" + method, {
|
151
|
-
/**
|
152
|
-
* Returns the current listener
|
153
|
-
*
|
154
|
-
* @return {Mixed} the set function or undefined
|
155
|
-
* @api private
|
156
|
-
*/
|
157
|
-
get: function() {
|
158
|
-
var listener = this.listeners(method)[0];
|
159
|
-
return listener ? listener._listener ? listener._listener : listener : void 0;
|
160
|
-
},
|
161
|
-
/**
|
162
|
-
* Start listening for events
|
163
|
-
*
|
164
|
-
* @param {Function} listener the listener
|
165
|
-
* @return {Mixed} the set function or undefined
|
166
|
-
* @api private
|
167
|
-
*/
|
168
|
-
set: function(listener) {
|
169
|
-
this.removeAllListeners(method), this.addEventListener(method, listener);
|
170
|
-
}
|
171
|
-
});
|
172
|
-
});
|
173
|
-
Object.defineProperty(EventSource, "CONNECTING", { enumerable: !0, value: 0 });
|
174
|
-
Object.defineProperty(EventSource, "OPEN", { enumerable: !0, value: 1 });
|
175
|
-
Object.defineProperty(EventSource, "CLOSED", { enumerable: !0, value: 2 });
|
176
|
-
EventSource.prototype.CONNECTING = 0;
|
177
|
-
EventSource.prototype.OPEN = 1;
|
178
|
-
EventSource.prototype.CLOSED = 2;
|
179
|
-
EventSource.prototype.close = function() {
|
180
|
-
this._close();
|
181
|
-
};
|
182
|
-
EventSource.prototype.addEventListener = function(type, listener) {
|
183
|
-
typeof listener == "function" && (listener._listener = listener, this.on(type, listener));
|
184
|
-
};
|
185
|
-
EventSource.prototype.dispatchEvent = function(event) {
|
186
|
-
if (!event.type)
|
187
|
-
throw new Error("UNSPECIFIED_EVENT_TYPE_ERR");
|
188
|
-
this.emit(event.type, event.detail);
|
189
|
-
};
|
190
|
-
EventSource.prototype.removeEventListener = function(type, listener) {
|
191
|
-
typeof listener == "function" && (listener._listener = void 0, this.removeListener(type, listener));
|
192
|
-
};
|
193
|
-
function Event(type, optionalProperties) {
|
194
|
-
if (Object.defineProperty(this, "type", { writable: !1, value: type, enumerable: !0 }), optionalProperties)
|
195
|
-
for (var f in optionalProperties)
|
196
|
-
optionalProperties.hasOwnProperty(f) && Object.defineProperty(this, f, { writable: !1, value: optionalProperties[f], enumerable: !0 });
|
197
|
-
}
|
198
|
-
function MessageEvent(type, eventInitDict) {
|
199
|
-
Object.defineProperty(this, "type", { writable: !1, value: type, enumerable: !0 });
|
200
|
-
for (var f in eventInitDict)
|
201
|
-
eventInitDict.hasOwnProperty(f) && Object.defineProperty(this, f, { writable: !1, value: eventInitDict[f], enumerable: !0 });
|
202
|
-
}
|
203
|
-
function removeUnsafeHeaders(headers) {
|
204
|
-
var safe = {};
|
205
|
-
for (var key in headers)
|
206
|
-
reUnsafeHeader.test(key) || (safe[key] = headers[key]);
|
207
|
-
return safe;
|
208
|
-
}
|
209
|
-
var node = eventsource, node$1 = /* @__PURE__ */ getDefaultExportFromCjs(node), node$2 = /* @__PURE__ */ Object.freeze({
|
210
|
-
__proto__: null,
|
211
|
-
default: node$1
|
212
|
-
});
|
213
|
-
export {
|
214
|
-
node$2 as n
|
215
|
-
};
|
216
|
-
//# sourceMappingURL=node.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"node.js","sources":["../../../../../node_modules/.pnpm/eventsource@2.0.2/node_modules/eventsource/lib/eventsource.js","../../../../../node_modules/.pnpm/@sanity+eventsource@5.0.1/node_modules/@sanity/eventsource/node.js"],"sourcesContent":["var parse = require('url').parse\nvar events = require('events')\nvar https = require('https')\nvar http = require('http')\nvar util = require('util')\n\nvar httpsOptions = [\n 'pfx', 'key', 'passphrase', 'cert', 'ca', 'ciphers',\n 'rejectUnauthorized', 'secureProtocol', 'servername', 'checkServerIdentity'\n]\n\nvar bom = [239, 187, 191]\nvar colon = 58\nvar space = 32\nvar lineFeed = 10\nvar carriageReturn = 13\n// Beyond 256KB we could not observe any gain in performance\nvar maxBufferAheadAllocation = 1024 * 256\n// Headers matching the pattern should be removed when redirecting to different origin\nvar reUnsafeHeader = /^(cookie|authorization)$/i\n\nfunction hasBom (buf) {\n return bom.every(function (charCode, index) {\n return buf[index] === charCode\n })\n}\n\n/**\n * Creates a new EventSource object\n *\n * @param {String} url the URL to which to connect\n * @param {Object} [eventSourceInitDict] extra init params. See README for details.\n * @api public\n **/\nfunction EventSource (url, eventSourceInitDict) {\n var readyState = EventSource.CONNECTING\n var headers = eventSourceInitDict && eventSourceInitDict.headers\n var hasNewOrigin = false\n Object.defineProperty(this, 'readyState', {\n get: function () {\n return readyState\n }\n })\n\n Object.defineProperty(this, 'url', {\n get: function () {\n return url\n }\n })\n\n var self = this\n self.reconnectInterval = 1000\n self.connectionInProgress = false\n\n function onConnectionClosed (message) {\n if (readyState === EventSource.CLOSED) return\n readyState = EventSource.CONNECTING\n _emit('error', new Event('error', {message: message}))\n\n // The url may have been changed by a temporary redirect. If that's the case,\n // revert it now, and flag that we are no longer pointing to a new origin\n if (reconnectUrl) {\n url = reconnectUrl\n reconnectUrl = null\n hasNewOrigin = false\n }\n setTimeout(function () {\n if (readyState !== EventSource.CONNECTING || self.connectionInProgress) {\n return\n }\n self.connectionInProgress = true\n connect()\n }, self.reconnectInterval)\n }\n\n var req\n var lastEventId = ''\n if (headers && headers['Last-Event-ID']) {\n lastEventId = headers['Last-Event-ID']\n delete headers['Last-Event-ID']\n }\n\n var discardTrailingNewline = false\n var data = ''\n var eventName = ''\n\n var reconnectUrl = null\n\n function connect () {\n var options = parse(url)\n var isSecure = options.protocol === 'https:'\n options.headers = { 'Cache-Control': 'no-cache', 'Accept': 'text/event-stream' }\n if (lastEventId) options.headers['Last-Event-ID'] = lastEventId\n if (headers) {\n var reqHeaders = hasNewOrigin ? removeUnsafeHeaders(headers) : headers\n for (var i in reqHeaders) {\n var header = reqHeaders[i]\n if (header) {\n options.headers[i] = header\n }\n }\n }\n\n // Legacy: this should be specified as `eventSourceInitDict.https.rejectUnauthorized`,\n // but for now exists as a backwards-compatibility layer\n options.rejectUnauthorized = !(eventSourceInitDict && !eventSourceInitDict.rejectUnauthorized)\n\n if (eventSourceInitDict && eventSourceInitDict.createConnection !== undefined) {\n options.createConnection = eventSourceInitDict.createConnection\n }\n\n // If specify http proxy, make the request to sent to the proxy server,\n // and include the original url in path and Host headers\n var useProxy = eventSourceInitDict && eventSourceInitDict.proxy\n if (useProxy) {\n var proxy = parse(eventSourceInitDict.proxy)\n isSecure = proxy.protocol === 'https:'\n\n options.protocol = isSecure ? 'https:' : 'http:'\n options.path = url\n options.headers.Host = options.host\n options.hostname = proxy.hostname\n options.host = proxy.host\n options.port = proxy.port\n }\n\n // If https options are specified, merge them into the request options\n if (eventSourceInitDict && eventSourceInitDict.https) {\n for (var optName in eventSourceInitDict.https) {\n if (httpsOptions.indexOf(optName) === -1) {\n continue\n }\n\n var option = eventSourceInitDict.https[optName]\n if (option !== undefined) {\n options[optName] = option\n }\n }\n }\n\n // Pass this on to the XHR\n if (eventSourceInitDict && eventSourceInitDict.withCredentials !== undefined) {\n options.withCredentials = eventSourceInitDict.withCredentials\n }\n\n req = (isSecure ? https : http).request(options, function (res) {\n self.connectionInProgress = false\n // Handle HTTP errors\n if (res.statusCode === 500 || res.statusCode === 502 || res.statusCode === 503 || res.statusCode === 504) {\n _emit('error', new Event('error', {status: res.statusCode, message: res.statusMessage}))\n onConnectionClosed()\n return\n }\n\n // Handle HTTP redirects\n if (res.statusCode === 301 || res.statusCode === 302 || res.statusCode === 307) {\n var location = res.headers.location\n if (!location) {\n // Server sent redirect response without Location header.\n _emit('error', new Event('error', {status: res.statusCode, message: res.statusMessage}))\n return\n }\n var prevOrigin = new URL(url).origin\n var nextOrigin = new URL(location).origin\n hasNewOrigin = prevOrigin !== nextOrigin\n if (res.statusCode === 307) reconnectUrl = url\n url = location\n process.nextTick(connect)\n return\n }\n\n if (res.statusCode !== 200) {\n _emit('error', new Event('error', {status: res.statusCode, message: res.statusMessage}))\n return self.close()\n }\n\n readyState = EventSource.OPEN\n res.on('close', function () {\n res.removeAllListeners('close')\n res.removeAllListeners('end')\n onConnectionClosed()\n })\n\n res.on('end', function () {\n res.removeAllListeners('close')\n res.removeAllListeners('end')\n onConnectionClosed()\n })\n _emit('open', new Event('open'))\n\n // text/event-stream parser adapted from webkit's\n // Source/WebCore/page/EventSource.cpp\n var buf\n var newBuffer\n var startingPos = 0\n var startingFieldLength = -1\n var newBufferSize = 0\n var bytesUsed = 0\n\n res.on('data', function (chunk) {\n if (!buf) {\n buf = chunk\n if (hasBom(buf)) {\n buf = buf.slice(bom.length)\n }\n bytesUsed = buf.length\n } else {\n if (chunk.length > buf.length - bytesUsed) {\n newBufferSize = (buf.length * 2) + chunk.length\n if (newBufferSize > maxBufferAheadAllocation) {\n newBufferSize = buf.length + chunk.length + maxBufferAheadAllocation\n }\n newBuffer = Buffer.alloc(newBufferSize)\n buf.copy(newBuffer, 0, 0, bytesUsed)\n buf = newBuffer\n }\n chunk.copy(buf, bytesUsed)\n bytesUsed += chunk.length\n }\n\n var pos = 0\n var length = bytesUsed\n\n while (pos < length) {\n if (discardTrailingNewline) {\n if (buf[pos] === lineFeed) {\n ++pos\n }\n discardTrailingNewline = false\n }\n\n var lineLength = -1\n var fieldLength = startingFieldLength\n var c\n\n for (var i = startingPos; lineLength < 0 && i < length; ++i) {\n c = buf[i]\n if (c === colon) {\n if (fieldLength < 0) {\n fieldLength = i - pos\n }\n } else if (c === carriageReturn) {\n discardTrailingNewline = true\n lineLength = i - pos\n } else if (c === lineFeed) {\n lineLength = i - pos\n }\n }\n\n if (lineLength < 0) {\n startingPos = length - pos\n startingFieldLength = fieldLength\n break\n } else {\n startingPos = 0\n startingFieldLength = -1\n }\n\n parseEventStreamLine(buf, pos, fieldLength, lineLength)\n\n pos += lineLength + 1\n }\n\n if (pos === length) {\n buf = void 0\n bytesUsed = 0\n } else if (pos > 0) {\n buf = buf.slice(pos, bytesUsed)\n bytesUsed = buf.length\n }\n })\n })\n\n req.on('error', function (err) {\n self.connectionInProgress = false\n onConnectionClosed(err.message)\n })\n\n if (req.setNoDelay) req.setNoDelay(true)\n req.end()\n }\n\n connect()\n\n function _emit () {\n if (self.listeners(arguments[0]).length > 0) {\n self.emit.apply(self, arguments)\n }\n }\n\n this._close = function () {\n if (readyState === EventSource.CLOSED) return\n readyState = EventSource.CLOSED\n if (req.abort) req.abort()\n if (req.xhr && req.xhr.abort) req.xhr.abort()\n }\n\n function parseEventStreamLine (buf, pos, fieldLength, lineLength) {\n if (lineLength === 0) {\n if (data.length > 0) {\n var type = eventName || 'message'\n _emit(type, new MessageEvent(type, {\n data: data.slice(0, -1), // remove trailing newline\n lastEventId: lastEventId,\n origin: new URL(url).origin\n }))\n data = ''\n }\n eventName = void 0\n } else if (fieldLength > 0) {\n var noValue = fieldLength < 0\n var step = 0\n var field = buf.slice(pos, pos + (noValue ? lineLength : fieldLength)).toString()\n\n if (noValue) {\n step = lineLength\n } else if (buf[pos + fieldLength + 1] !== space) {\n step = fieldLength + 1\n } else {\n step = fieldLength + 2\n }\n pos += step\n\n var valueLength = lineLength - step\n var value = buf.slice(pos, pos + valueLength).toString()\n\n if (field === 'data') {\n data += value + '\\n'\n } else if (field === 'event') {\n eventName = value\n } else if (field === 'id') {\n lastEventId = value\n } else if (field === 'retry') {\n var retry = parseInt(value, 10)\n if (!Number.isNaN(retry)) {\n self.reconnectInterval = retry\n }\n }\n }\n }\n}\n\nmodule.exports = EventSource\n\nutil.inherits(EventSource, events.EventEmitter)\nEventSource.prototype.constructor = EventSource; // make stacktraces readable\n\n['open', 'error', 'message'].forEach(function (method) {\n Object.defineProperty(EventSource.prototype, 'on' + method, {\n /**\n * Returns the current listener\n *\n * @return {Mixed} the set function or undefined\n * @api private\n */\n get: function get () {\n var listener = this.listeners(method)[0]\n return listener ? (listener._listener ? listener._listener : listener) : undefined\n },\n\n /**\n * Start listening for events\n *\n * @param {Function} listener the listener\n * @return {Mixed} the set function or undefined\n * @api private\n */\n set: function set (listener) {\n this.removeAllListeners(method)\n this.addEventListener(method, listener)\n }\n })\n})\n\n/**\n * Ready states\n */\nObject.defineProperty(EventSource, 'CONNECTING', {enumerable: true, value: 0})\nObject.defineProperty(EventSource, 'OPEN', {enumerable: true, value: 1})\nObject.defineProperty(EventSource, 'CLOSED', {enumerable: true, value: 2})\n\nEventSource.prototype.CONNECTING = 0\nEventSource.prototype.OPEN = 1\nEventSource.prototype.CLOSED = 2\n\n/**\n * Closes the connection, if one is made, and sets the readyState attribute to 2 (closed)\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/EventSource/close\n * @api public\n */\nEventSource.prototype.close = function () {\n this._close()\n}\n\n/**\n * Emulates the W3C Browser based WebSocket interface using addEventListener.\n *\n * @param {String} type A string representing the event type to listen out for\n * @param {Function} listener callback\n * @see https://developer.mozilla.org/en/DOM/element.addEventListener\n * @see http://dev.w3.org/html5/websockets/#the-websocket-interface\n * @api public\n */\nEventSource.prototype.addEventListener = function addEventListener (type, listener) {\n if (typeof listener === 'function') {\n // store a reference so we can return the original function again\n listener._listener = listener\n this.on(type, listener)\n }\n}\n\n/**\n * Emulates the W3C Browser based WebSocket interface using dispatchEvent.\n *\n * @param {Event} event An event to be dispatched\n * @see https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/dispatchEvent\n * @api public\n */\nEventSource.prototype.dispatchEvent = function dispatchEvent (event) {\n if (!event.type) {\n throw new Error('UNSPECIFIED_EVENT_TYPE_ERR')\n }\n // if event is instance of an CustomEvent (or has 'details' property),\n // send the detail object as the payload for the event\n this.emit(event.type, event.detail)\n}\n\n/**\n * Emulates the W3C Browser based WebSocket interface using removeEventListener.\n *\n * @param {String} type A string representing the event type to remove\n * @param {Function} listener callback\n * @see https://developer.mozilla.org/en/DOM/element.removeEventListener\n * @see http://dev.w3.org/html5/websockets/#the-websocket-interface\n * @api public\n */\nEventSource.prototype.removeEventListener = function removeEventListener (type, listener) {\n if (typeof listener === 'function') {\n listener._listener = undefined\n this.removeListener(type, listener)\n }\n}\n\n/**\n * W3C Event\n *\n * @see http://www.w3.org/TR/DOM-Level-3-Events/#interface-Event\n * @api private\n */\nfunction Event (type, optionalProperties) {\n Object.defineProperty(this, 'type', { writable: false, value: type, enumerable: true })\n if (optionalProperties) {\n for (var f in optionalProperties) {\n if (optionalProperties.hasOwnProperty(f)) {\n Object.defineProperty(this, f, { writable: false, value: optionalProperties[f], enumerable: true })\n }\n }\n }\n}\n\n/**\n * W3C MessageEvent\n *\n * @see http://www.w3.org/TR/webmessaging/#event-definitions\n * @api private\n */\nfunction MessageEvent (type, eventInitDict) {\n Object.defineProperty(this, 'type', { writable: false, value: type, enumerable: true })\n for (var f in eventInitDict) {\n if (eventInitDict.hasOwnProperty(f)) {\n Object.defineProperty(this, f, { writable: false, value: eventInitDict[f], enumerable: true })\n }\n }\n}\n\n/**\n * Returns a new object of headers that does not include any authorization and cookie headers\n *\n * @param {Object} headers An object of headers ({[headerName]: headerValue})\n * @return {Object} a new object of headers\n * @api private\n */\nfunction removeUnsafeHeaders (headers) {\n var safe = {}\n for (var key in headers) {\n if (reUnsafeHeader.test(key)) {\n continue\n }\n\n safe[key] = headers[key]\n }\n\n return safe\n}\n","module.exports = require('eventsource')\n"],"names":["require$$4","i","require$$0"],"mappings":";;;;;;AAAA,IAAI,QAAQ,WAAe,OACvB,SAAS,YACT,QAAQ,YACR,OAAO,YACP,OAAOA,cAEP,eAAe;AAAA,EACjB;AAAA,EAAO;AAAA,EAAO;AAAA,EAAc;AAAA,EAAQ;AAAA,EAAM;AAAA,EAC1C;AAAA,EAAsB;AAAA,EAAkB;AAAA,EAAc;AACxD,GAEI,MAAM,CAAC,KAAK,KAAK,GAAG,GACpB,QAAQ,IACR,QAAQ,IACR,WAAW,IACX,iBAAiB,IAEjB,2BAA2B,OAAO,KAElC,iBAAiB;AAErB,SAAS,OAAQ,KAAK;AACpB,SAAO,IAAI,MAAM,SAAU,UAAU,OAAO;AAC1C,WAAO,IAAI,KAAK,MAAM;AAAA,EAC1B,CAAG;AACH;AASA,SAAS,YAAa,KAAK,qBAAqB;AAC9C,MAAI,aAAa,YAAY,YACzB,UAAU,uBAAuB,oBAAoB,SACrD,eAAe;AACnB,SAAO,eAAe,MAAM,cAAc;AAAA,IACxC,KAAK,WAAY;AACf,aAAO;AAAA,IACR;AAAA,EACL,CAAG,GAED,OAAO,eAAe,MAAM,OAAO;AAAA,IACjC,KAAK,WAAY;AACf,aAAO;AAAA,IACR;AAAA,EACL,CAAG;AAED,MAAI,OAAO;AACX,OAAK,oBAAoB,KACzB,KAAK,uBAAuB;AAE5B,WAAS,mBAAoB,SAAS;AACpC,IAAI,eAAe,YAAY,WAC/B,aAAa,YAAY,YACzB,MAAM,SAAS,IAAI,MAAM,SAAS,EAAC,QAAgB,CAAC,CAAC,GAIjD,iBACF,MAAM,cACN,eAAe,MACf,eAAe,KAEjB,WAAW,WAAY;AACrB,MAAI,eAAe,YAAY,cAAc,KAAK,yBAGlD,KAAK,uBAAuB,IAC5B,QAAS;AAAA,IACf,GAAO,KAAK,iBAAiB;AAAA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,IAAO,OAAO,MAAM,YAAY,GAAI,CAAE,GAClF;AACF,aAAS,KAAK;AACZ,MAAI,mBAAmB,eAAe,CAAC,KACrC,OAAO,eAAe,MAAM,GAAG,EAAE,UAAU,IAAO,OAAO,mBAAmB,CAAC,GAAG,YAAY,GAAI,CAAE;AAI1G;AAQA,SAAS,aAAc,MAAM,eAAe;AAC1C,SAAO,eAAe,MAAM,QAAQ,EAAE,UAAU,IAAO,OAAO,MAAM,YAAY,GAAI,CAAE;AACtF,WAAS,KAAK;AACZ,IAAI,cAAc,eAAe,CAAC,KAChC,OAAO,eAAe,MAAM,GAAG,EAAE,UAAU,IAAO,OAAO,cAAc,CAAC,GAAG,YAAY,GAAI,CAAE;AAGnG;AASA,SAAS,oBAAqB,SAAS;AACrC,MAAI,OAAO,CAAE;AACb,WAAS,OAAO;AACd,IAAI,eAAe,KAAK,GAAG,MAI3B,KAAK,GAAG,IAAI,QAAQ,GAAG;AAGzB,SAAO;AACT;AC9eA,IAAA,OAAiBC;;;;","x_google_ignoreList":[0,1]}
|
@@ -1,358 +0,0 @@
|
|
1
|
-
import "get-it";
|
2
|
-
import "get-it/middleware";
|
3
|
-
var s = { 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 }, c = { 0: 8203, 1: 8204, 2: 8205, 3: 65279 }, d = new Array(4).fill(String.fromCodePoint(c[0])).join("");
|
4
|
-
function E(t) {
|
5
|
-
let e = JSON.stringify(t);
|
6
|
-
return `${d}${Array.from(e).map((r) => {
|
7
|
-
let n = r.charCodeAt(0);
|
8
|
-
if (n > 255)
|
9
|
-
throw new Error(`Only ASCII edit info can be encoded. Error attempting to encode ${e} on character ${r} (${n})`);
|
10
|
-
return Array.from(n.toString(4).padStart(4, "0")).map((o) => String.fromCodePoint(c[o])).join("");
|
11
|
-
}).join("")}`;
|
12
|
-
}
|
13
|
-
function I(t) {
|
14
|
-
return Number.isNaN(Number(t)) ? !!Date.parse(t) : !1;
|
15
|
-
}
|
16
|
-
function x(t) {
|
17
|
-
try {
|
18
|
-
new URL(t, t.startsWith("/") ? "https://acme.com" : void 0);
|
19
|
-
} catch {
|
20
|
-
return !1;
|
21
|
-
}
|
22
|
-
return !0;
|
23
|
-
}
|
24
|
-
function b(t, e, r = "auto") {
|
25
|
-
return r === !0 || r === "auto" && (I(t) || x(t)) ? t : `${t}${E(e)}`;
|
26
|
-
}
|
27
|
-
Object.fromEntries(Object.entries(c).map((t) => t.reverse()));
|
28
|
-
Object.fromEntries(Object.entries(s).map((t) => t.reverse()));
|
29
|
-
`${Object.values(s).map((t) => `\\u{${t.toString(16)}}`).join("")}`;
|
30
|
-
const reKeySegment = /_key\s*==\s*['"](.*)['"]/;
|
31
|
-
function isKeySegment(segment) {
|
32
|
-
return typeof segment == "string" ? reKeySegment.test(segment.trim()) : typeof segment == "object" && "_key" in segment;
|
33
|
-
}
|
34
|
-
function toString(path) {
|
35
|
-
if (!Array.isArray(path))
|
36
|
-
throw new Error("Path is not an array");
|
37
|
-
return path.reduce((target, segment, i) => {
|
38
|
-
const segmentType = typeof segment;
|
39
|
-
if (segmentType === "number")
|
40
|
-
return `${target}[${segment}]`;
|
41
|
-
if (segmentType === "string")
|
42
|
-
return `${target}${i === 0 ? "" : "."}${segment}`;
|
43
|
-
if (isKeySegment(segment) && segment._key)
|
44
|
-
return `${target}[_key=="${segment._key}"]`;
|
45
|
-
if (Array.isArray(segment)) {
|
46
|
-
const [from, to] = segment;
|
47
|
-
return `${target}[${from}:${to}]`;
|
48
|
-
}
|
49
|
-
throw new Error(`Unsupported path segment \`${JSON.stringify(segment)}\``);
|
50
|
-
}, "");
|
51
|
-
}
|
52
|
-
const ESCAPE = {
|
53
|
-
"\f": "\\f",
|
54
|
-
"\n": "\\n",
|
55
|
-
"\r": "\\r",
|
56
|
-
" ": "\\t",
|
57
|
-
"'": "\\'",
|
58
|
-
"\\": "\\\\"
|
59
|
-
}, UNESCAPE = {
|
60
|
-
"\\f": "\f",
|
61
|
-
"\\n": `
|
62
|
-
`,
|
63
|
-
"\\r": "\r",
|
64
|
-
"\\t": " ",
|
65
|
-
"\\'": "'",
|
66
|
-
"\\\\": "\\"
|
67
|
-
};
|
68
|
-
function jsonPath(path) {
|
69
|
-
return `$${path.map((segment) => typeof segment == "string" ? `['${segment.replace(/[\f\n\r\t'\\]/g, (match) => ESCAPE[match])}']` : typeof segment == "number" ? `[${segment}]` : segment._key !== "" ? `[?(@._key=='${segment._key.replace(/['\\]/g, (match) => ESCAPE[match])}')]` : `[${segment._index}]`).join("")}`;
|
70
|
-
}
|
71
|
-
function parseJsonPath(path) {
|
72
|
-
const parsed = [], parseRe = /\['(.*?)'\]|\[(\d+)\]|\[\?\(@\._key=='(.*?)'\)\]/g;
|
73
|
-
let match;
|
74
|
-
for (; (match = parseRe.exec(path)) !== null; ) {
|
75
|
-
if (match[1] !== void 0) {
|
76
|
-
const key = match[1].replace(/\\(\\|f|n|r|t|')/g, (m) => UNESCAPE[m]);
|
77
|
-
parsed.push(key);
|
78
|
-
continue;
|
79
|
-
}
|
80
|
-
if (match[2] !== void 0) {
|
81
|
-
parsed.push(parseInt(match[2], 10));
|
82
|
-
continue;
|
83
|
-
}
|
84
|
-
if (match[3] !== void 0) {
|
85
|
-
const _key = match[3].replace(/\\(\\')/g, (m) => UNESCAPE[m]);
|
86
|
-
parsed.push({
|
87
|
-
_key,
|
88
|
-
_index: -1
|
89
|
-
});
|
90
|
-
continue;
|
91
|
-
}
|
92
|
-
}
|
93
|
-
return parsed;
|
94
|
-
}
|
95
|
-
function jsonPathToStudioPath(path) {
|
96
|
-
return path.map((segment) => {
|
97
|
-
if (typeof segment == "string" || typeof segment == "number")
|
98
|
-
return segment;
|
99
|
-
if (segment._key !== "")
|
100
|
-
return { _key: segment._key };
|
101
|
-
if (segment._index !== -1)
|
102
|
-
return segment._index;
|
103
|
-
throw new Error(`invalid segment:${JSON.stringify(segment)}`);
|
104
|
-
});
|
105
|
-
}
|
106
|
-
function jsonPathToMappingPath(path) {
|
107
|
-
return path.map((segment) => {
|
108
|
-
if (typeof segment == "string" || typeof segment == "number")
|
109
|
-
return segment;
|
110
|
-
if (segment._index !== -1)
|
111
|
-
return segment._index;
|
112
|
-
throw new Error(`invalid segment:${JSON.stringify(segment)}`);
|
113
|
-
});
|
114
|
-
}
|
115
|
-
function resolveMapping(resultPath, csm) {
|
116
|
-
if (!(csm != null && csm.mappings))
|
117
|
-
return;
|
118
|
-
const resultMappingPath = jsonPath(jsonPathToMappingPath(resultPath));
|
119
|
-
if (csm.mappings[resultMappingPath] !== void 0)
|
120
|
-
return {
|
121
|
-
mapping: csm.mappings[resultMappingPath],
|
122
|
-
matchedPath: resultMappingPath,
|
123
|
-
pathSuffix: ""
|
124
|
-
};
|
125
|
-
const mappings = Object.entries(csm.mappings).filter(([key]) => resultMappingPath.startsWith(key)).sort(([key1], [key2]) => key2.length - key1.length);
|
126
|
-
if (mappings.length == 0)
|
127
|
-
return;
|
128
|
-
const [matchedPath, mapping] = mappings[0], pathSuffix = resultMappingPath.substring(matchedPath.length);
|
129
|
-
return { mapping, matchedPath, pathSuffix };
|
130
|
-
}
|
131
|
-
function isArray(value) {
|
132
|
-
return value !== null && Array.isArray(value);
|
133
|
-
}
|
134
|
-
function isRecord(value) {
|
135
|
-
return typeof value == "object" && value !== null;
|
136
|
-
}
|
137
|
-
function walkMap(value, mappingFn, path = []) {
|
138
|
-
return isArray(value) ? value.map((v, idx) => {
|
139
|
-
if (isRecord(v)) {
|
140
|
-
const _key = v._key;
|
141
|
-
if (typeof _key == "string")
|
142
|
-
return walkMap(v, mappingFn, path.concat({ _key, _index: idx }));
|
143
|
-
}
|
144
|
-
return walkMap(v, mappingFn, path.concat(idx));
|
145
|
-
}) : isRecord(value) ? Object.fromEntries(
|
146
|
-
Object.entries(value).map(([k, v]) => [k, walkMap(v, mappingFn, path.concat(k))])
|
147
|
-
) : mappingFn(value, path);
|
148
|
-
}
|
149
|
-
function encodeIntoResult(result, csm, encoder) {
|
150
|
-
return walkMap(result, (value, path) => {
|
151
|
-
if (typeof value != "string")
|
152
|
-
return value;
|
153
|
-
const resolveMappingResult = resolveMapping(path, csm);
|
154
|
-
if (!resolveMappingResult)
|
155
|
-
return value;
|
156
|
-
const { mapping, matchedPath } = resolveMappingResult;
|
157
|
-
if (mapping.type !== "value" || mapping.source.type !== "documentValue")
|
158
|
-
return value;
|
159
|
-
const sourceDocument = csm.documents[mapping.source.document], sourcePath = csm.paths[mapping.source.path], matchPathSegments = parseJsonPath(matchedPath), fullSourceSegments = parseJsonPath(sourcePath).concat(path.slice(matchPathSegments.length));
|
160
|
-
return encoder({
|
161
|
-
sourcePath: fullSourceSegments,
|
162
|
-
sourceDocument,
|
163
|
-
resultPath: path,
|
164
|
-
value
|
165
|
-
});
|
166
|
-
});
|
167
|
-
}
|
168
|
-
const DRAFTS_PREFIX = "drafts.";
|
169
|
-
function getPublishedId(id) {
|
170
|
-
return id.startsWith(DRAFTS_PREFIX) ? id.slice(DRAFTS_PREFIX.length) : id;
|
171
|
-
}
|
172
|
-
function createEditUrl(options) {
|
173
|
-
const {
|
174
|
-
baseUrl,
|
175
|
-
workspace: _workspace = "default",
|
176
|
-
tool: _tool = "default",
|
177
|
-
id: _id,
|
178
|
-
type,
|
179
|
-
path,
|
180
|
-
projectId,
|
181
|
-
dataset
|
182
|
-
} = options;
|
183
|
-
if (!baseUrl)
|
184
|
-
throw new Error("baseUrl is required");
|
185
|
-
if (!path)
|
186
|
-
throw new Error("path is required");
|
187
|
-
if (!_id)
|
188
|
-
throw new Error("id is required");
|
189
|
-
if (baseUrl !== "/" && baseUrl.endsWith("/"))
|
190
|
-
throw new Error("baseUrl must not end with a slash");
|
191
|
-
const workspace = _workspace === "default" ? void 0 : _workspace, tool = _tool === "default" ? void 0 : _tool, id = getPublishedId(_id), stringifiedPath = Array.isArray(path) ? toString(jsonPathToStudioPath(path)) : path, searchParams = new URLSearchParams({
|
192
|
-
baseUrl,
|
193
|
-
id,
|
194
|
-
type,
|
195
|
-
path: stringifiedPath
|
196
|
-
});
|
197
|
-
workspace && searchParams.set("workspace", workspace), tool && searchParams.set("tool", tool), projectId && searchParams.set("projectId", projectId), dataset && searchParams.set("dataset", dataset), _id.startsWith(DRAFTS_PREFIX) && searchParams.set("isDraft", "");
|
198
|
-
const segments = [baseUrl === "/" ? "" : baseUrl];
|
199
|
-
workspace && segments.push(workspace);
|
200
|
-
const routerParams = [
|
201
|
-
"mode=presentation",
|
202
|
-
`id=${id}`,
|
203
|
-
`type=${type}`,
|
204
|
-
`path=${encodeURIComponent(stringifiedPath)}`
|
205
|
-
];
|
206
|
-
return tool && routerParams.push(`tool=${tool}`), segments.push("intent", "edit", `${routerParams.join(";")}?${searchParams}`), segments.join("/");
|
207
|
-
}
|
208
|
-
function resolveStudioBaseRoute(studioUrl) {
|
209
|
-
let baseUrl = typeof studioUrl == "string" ? studioUrl : studioUrl.baseUrl;
|
210
|
-
return baseUrl !== "/" && (baseUrl = baseUrl.replace(/\/$/, "")), typeof studioUrl == "string" ? { baseUrl } : { ...studioUrl, baseUrl };
|
211
|
-
}
|
212
|
-
const filterDefault = ({ sourcePath, value }) => {
|
213
|
-
if (isValidDate(value) || isValidURL(value))
|
214
|
-
return !1;
|
215
|
-
const endPath = sourcePath.at(-1);
|
216
|
-
return !(sourcePath.at(-2) === "slug" && endPath === "current" || typeof endPath == "string" && endPath.startsWith("_") || typeof endPath == "number" && sourcePath.at(-2) === "marks" || endPath === "href" && typeof sourcePath.at(-2) == "number" && sourcePath.at(-3) === "markDefs" || endPath === "style" || endPath === "listItem" || sourcePath.some(
|
217
|
-
(path) => path === "meta" || path === "metadata" || path === "openGraph" || path === "seo"
|
218
|
-
) || typeof endPath == "string" && denylist.has(endPath));
|
219
|
-
}, denylist = /* @__PURE__ */ new Set([
|
220
|
-
"color",
|
221
|
-
"colour",
|
222
|
-
"currency",
|
223
|
-
"email",
|
224
|
-
"format",
|
225
|
-
"gid",
|
226
|
-
"hex",
|
227
|
-
"href",
|
228
|
-
"hsl",
|
229
|
-
"hsla",
|
230
|
-
"icon",
|
231
|
-
"id",
|
232
|
-
"index",
|
233
|
-
"key",
|
234
|
-
"language",
|
235
|
-
"layout",
|
236
|
-
"link",
|
237
|
-
"linkAction",
|
238
|
-
"locale",
|
239
|
-
"lqip",
|
240
|
-
"page",
|
241
|
-
"path",
|
242
|
-
"ref",
|
243
|
-
"rgb",
|
244
|
-
"rgba",
|
245
|
-
"route",
|
246
|
-
"secret",
|
247
|
-
"slug",
|
248
|
-
"status",
|
249
|
-
"tag",
|
250
|
-
"template",
|
251
|
-
"theme",
|
252
|
-
"type",
|
253
|
-
"unit",
|
254
|
-
"url",
|
255
|
-
"username",
|
256
|
-
"variant",
|
257
|
-
"website"
|
258
|
-
]);
|
259
|
-
function isValidDate(dateString) {
|
260
|
-
return /^\d{4}-\d{2}-\d{2}/.test(dateString) ? !!Date.parse(dateString) : !1;
|
261
|
-
}
|
262
|
-
function isValidURL(url) {
|
263
|
-
try {
|
264
|
-
new URL(url, url.startsWith("/") ? "https://acme.com" : void 0);
|
265
|
-
} catch {
|
266
|
-
return !1;
|
267
|
-
}
|
268
|
-
return !0;
|
269
|
-
}
|
270
|
-
const TRUNCATE_LENGTH = 20;
|
271
|
-
function stegaEncodeSourceMap(result, resultSourceMap, config) {
|
272
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
273
|
-
const { filter, logger, enabled } = config;
|
274
|
-
if (!enabled) {
|
275
|
-
const msg = "config.enabled must be true, don't call this function otherwise";
|
276
|
-
throw (_a = logger?.error) == null || _a.call(logger, `[@sanity/client]: ${msg}`, { result, resultSourceMap, config }), new TypeError(msg);
|
277
|
-
}
|
278
|
-
if (!resultSourceMap)
|
279
|
-
return (_b = logger?.error) == null || _b.call(logger, "[@sanity/client]: Missing Content Source Map from response body", {
|
280
|
-
result,
|
281
|
-
resultSourceMap,
|
282
|
-
config
|
283
|
-
}), result;
|
284
|
-
if (!config.studioUrl) {
|
285
|
-
const msg = "config.studioUrl must be defined";
|
286
|
-
throw (_c = logger?.error) == null || _c.call(logger, `[@sanity/client]: ${msg}`, { result, resultSourceMap, config }), new TypeError(msg);
|
287
|
-
}
|
288
|
-
const report = {
|
289
|
-
encoded: [],
|
290
|
-
skipped: []
|
291
|
-
}, resultWithStega = encodeIntoResult(
|
292
|
-
result,
|
293
|
-
resultSourceMap,
|
294
|
-
({ sourcePath, sourceDocument, resultPath, value }) => {
|
295
|
-
if ((typeof filter == "function" ? filter({ sourcePath, resultPath, filterDefault, sourceDocument, value }) : filterDefault({ sourcePath, resultPath, filterDefault, sourceDocument, value })) === !1)
|
296
|
-
return logger && report.skipped.push({
|
297
|
-
path: prettyPathForLogging(sourcePath),
|
298
|
-
value: `${value.slice(0, TRUNCATE_LENGTH)}${value.length > TRUNCATE_LENGTH ? "..." : ""}`,
|
299
|
-
length: value.length
|
300
|
-
}), value;
|
301
|
-
logger && report.encoded.push({
|
302
|
-
path: prettyPathForLogging(sourcePath),
|
303
|
-
value: `${value.slice(0, TRUNCATE_LENGTH)}${value.length > TRUNCATE_LENGTH ? "..." : ""}`,
|
304
|
-
length: value.length
|
305
|
-
});
|
306
|
-
const { baseUrl, workspace, tool } = resolveStudioBaseRoute(
|
307
|
-
typeof config.studioUrl == "function" ? config.studioUrl(sourceDocument) : config.studioUrl
|
308
|
-
);
|
309
|
-
if (!baseUrl)
|
310
|
-
return value;
|
311
|
-
const { _id: id, _type: type, _projectId: projectId, _dataset: dataset } = sourceDocument;
|
312
|
-
return b(
|
313
|
-
value,
|
314
|
-
{
|
315
|
-
origin: "sanity.io",
|
316
|
-
href: createEditUrl({
|
317
|
-
baseUrl,
|
318
|
-
workspace,
|
319
|
-
tool,
|
320
|
-
id,
|
321
|
-
type,
|
322
|
-
path: sourcePath,
|
323
|
-
...!config.omitCrossDatasetReferenceData && { dataset, projectId }
|
324
|
-
})
|
325
|
-
},
|
326
|
-
// We use custom logic to determine if we should skip encoding
|
327
|
-
!1
|
328
|
-
);
|
329
|
-
}
|
330
|
-
);
|
331
|
-
if (logger) {
|
332
|
-
const isSkipping = report.skipped.length, isEncoding = report.encoded.length;
|
333
|
-
if ((isSkipping || isEncoding) && ((_d = logger?.groupCollapsed || logger.log) == null || _d("[@sanity/client]: Encoding source map into result"), (_e = logger.log) == null || _e.call(
|
334
|
-
logger,
|
335
|
-
`[@sanity/client]: Paths encoded: ${report.encoded.length}, skipped: ${report.skipped.length}`
|
336
|
-
)), report.encoded.length > 0 && ((_f = logger?.log) == null || _f.call(logger, "[@sanity/client]: Table of encoded paths"), (_g = logger?.table || logger.log) == null || _g(report.encoded)), report.skipped.length > 0) {
|
337
|
-
const skipped = /* @__PURE__ */ new Set();
|
338
|
-
for (const { path } of report.skipped)
|
339
|
-
skipped.add(path.replace(reKeySegment, "0").replace(/\[\d+\]/g, "[]"));
|
340
|
-
(_h = logger?.log) == null || _h.call(logger, "[@sanity/client]: List of skipped paths", [...skipped.values()]);
|
341
|
-
}
|
342
|
-
(isSkipping || isEncoding) && ((_i = logger?.groupEnd) == null || _i.call(logger));
|
343
|
-
}
|
344
|
-
return resultWithStega;
|
345
|
-
}
|
346
|
-
function prettyPathForLogging(path) {
|
347
|
-
return toString(jsonPathToStudioPath(path));
|
348
|
-
}
|
349
|
-
var stegaEncodeSourceMap$1 = /* @__PURE__ */ Object.freeze({
|
350
|
-
__proto__: null,
|
351
|
-
stegaEncodeSourceMap
|
352
|
-
});
|
353
|
-
export {
|
354
|
-
stegaEncodeSourceMap$1 as a,
|
355
|
-
encodeIntoResult as e,
|
356
|
-
stegaEncodeSourceMap as s
|
357
|
-
};
|
358
|
-
//# sourceMappingURL=stegaEncodeSourceMap.js.map
|