@sanity/document-internationalization 4.1.0 → 4.1.1
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/dist/_chunks-cjs/resources.js.map +1 -1
- package/dist/_chunks-es/resources.mjs.map +1 -1
- package/dist/_legacy/resources.esm.js.map +1 -1
- package/dist/index.d.mts +4 -6
- package/dist/index.d.ts +4 -6
- package/dist/index.esm.js +15 -37
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +15 -37
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -37
- package/dist/index.mjs.map +1 -1
- package/package.json +12 -12
- package/src/types.ts +2 -4
package/dist/index.mjs
CHANGED
|
@@ -112,7 +112,7 @@ function shallowEqualArrays(arrA, arrB, equal = (a, b) => a === b) {
|
|
|
112
112
|
return !1;
|
|
113
113
|
return !0;
|
|
114
114
|
}
|
|
115
|
-
function query$1(fn, keys = null, preload = !1,
|
|
115
|
+
function query$1(fn, keys = null, preload = !1, config = {}) {
|
|
116
116
|
keys === null && (keys = [fn]);
|
|
117
117
|
for (const entry2 of globalCache)
|
|
118
118
|
if (shallowEqualArrays(keys, entry2.keys, entry2.equal)) {
|
|
@@ -121,13 +121,13 @@ function query$1(fn, keys = null, preload = !1, config2 = {}) {
|
|
|
121
121
|
if (Object.prototype.hasOwnProperty.call(entry2, "error"))
|
|
122
122
|
throw entry2.error;
|
|
123
123
|
if (Object.prototype.hasOwnProperty.call(entry2, "response"))
|
|
124
|
-
return
|
|
124
|
+
return config.lifespan && config.lifespan > 0 && (entry2.timeout && clearTimeout(entry2.timeout), entry2.timeout = setTimeout(entry2.remove, config.lifespan)), entry2.response;
|
|
125
125
|
if (!preload)
|
|
126
126
|
throw entry2.promise;
|
|
127
127
|
}
|
|
128
128
|
const entry = {
|
|
129
129
|
keys,
|
|
130
|
-
equal:
|
|
130
|
+
equal: config.equal,
|
|
131
131
|
remove: () => {
|
|
132
132
|
const index = globalCache.indexOf(entry);
|
|
133
133
|
index !== -1 && globalCache.splice(index, 1);
|
|
@@ -135,14 +135,14 @@ function query$1(fn, keys = null, preload = !1, config2 = {}) {
|
|
|
135
135
|
promise: (
|
|
136
136
|
// Execute the promise
|
|
137
137
|
(isPromise(fn) ? fn : fn(...keys)).then((response) => {
|
|
138
|
-
entry.response = response,
|
|
138
|
+
entry.response = response, config.lifespan && config.lifespan > 0 && (entry.timeout = setTimeout(entry.remove, config.lifespan));
|
|
139
139
|
}).catch((error) => entry.error = error)
|
|
140
140
|
)
|
|
141
141
|
};
|
|
142
142
|
if (globalCache.push(entry), !preload)
|
|
143
143
|
throw entry.promise;
|
|
144
144
|
}
|
|
145
|
-
const suspend = (fn, keys,
|
|
145
|
+
const suspend = (fn, keys, config) => query$1(fn, keys, !1, config);
|
|
146
146
|
var __defProp$3 = Object.defineProperty, __defProps$2 = Object.defineProperties, __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$3 = Object.getOwnPropertySymbols, __hasOwnProp$3 = Object.prototype.hasOwnProperty, __propIsEnum$3 = Object.prototype.propertyIsEnumerable, __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, __spreadValues$3 = (a, b) => {
|
|
147
147
|
for (var prop in b || (b = {}))
|
|
148
148
|
__hasOwnProp$3.call(b, prop) && __defNormalProp$3(a, prop, b[prop]);
|
|
@@ -400,13 +400,7 @@ function isSubscription(value) {
|
|
|
400
400
|
function execFinalizer(finalizer) {
|
|
401
401
|
isFunction(finalizer) ? finalizer() : finalizer.unsubscribe();
|
|
402
402
|
}
|
|
403
|
-
var
|
|
404
|
-
onUnhandledError: null,
|
|
405
|
-
onStoppedNotification: null,
|
|
406
|
-
Promise: void 0,
|
|
407
|
-
useDeprecatedSynchronousErrorHandling: !1,
|
|
408
|
-
useDeprecatedNextContext: !1
|
|
409
|
-
}, timeoutProvider = {
|
|
403
|
+
var timeoutProvider = {
|
|
410
404
|
setTimeout: function(handler, timeout) {
|
|
411
405
|
for (var args = [], _i = 2; _i < arguments.length; _i++)
|
|
412
406
|
args[_i - 2] = arguments[_i];
|
|
@@ -455,11 +449,7 @@ var Subscriber = function(_super) {
|
|
|
455
449
|
this.unsubscribe();
|
|
456
450
|
}
|
|
457
451
|
}, Subscriber2;
|
|
458
|
-
}(Subscription),
|
|
459
|
-
function bind(fn, thisArg) {
|
|
460
|
-
return _bind.call(fn, thisArg);
|
|
461
|
-
}
|
|
462
|
-
var ConsumerObserver = function() {
|
|
452
|
+
}(Subscription), ConsumerObserver = function() {
|
|
463
453
|
function ConsumerObserver2(partialObserver) {
|
|
464
454
|
this.partialObserver = partialObserver;
|
|
465
455
|
}
|
|
@@ -494,23 +484,11 @@ var ConsumerObserver = function() {
|
|
|
494
484
|
__extends(SafeSubscriber2, _super);
|
|
495
485
|
function SafeSubscriber2(observerOrNext, error, complete) {
|
|
496
486
|
var _this = _super.call(this) || this, partialObserver;
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
};
|
|
503
|
-
else {
|
|
504
|
-
var context_1;
|
|
505
|
-
_this && config.useDeprecatedNextContext ? (context_1 = Object.create(observerOrNext), context_1.unsubscribe = function() {
|
|
506
|
-
return _this.unsubscribe();
|
|
507
|
-
}, partialObserver = {
|
|
508
|
-
next: observerOrNext.next && bind(observerOrNext.next, context_1),
|
|
509
|
-
error: observerOrNext.error && bind(observerOrNext.error, context_1),
|
|
510
|
-
complete: observerOrNext.complete && bind(observerOrNext.complete, context_1)
|
|
511
|
-
}) : partialObserver = observerOrNext;
|
|
512
|
-
}
|
|
513
|
-
return _this.destination = new ConsumerObserver(partialObserver), _this;
|
|
487
|
+
return isFunction(observerOrNext) || !observerOrNext ? partialObserver = {
|
|
488
|
+
next: observerOrNext != null ? observerOrNext : void 0,
|
|
489
|
+
error: error != null ? error : void 0,
|
|
490
|
+
complete: complete != null ? complete : void 0
|
|
491
|
+
} : partialObserver = observerOrNext, _this.destination = new ConsumerObserver(partialObserver), _this;
|
|
514
492
|
}
|
|
515
493
|
return SafeSubscriber2;
|
|
516
494
|
}(Subscriber);
|
|
@@ -585,7 +563,7 @@ var OperatorSubscriber = function(_super) {
|
|
|
585
563
|
_super(this), this.name = "EmptyError", this.message = "no elements in sequence";
|
|
586
564
|
};
|
|
587
565
|
});
|
|
588
|
-
function firstValueFrom(source,
|
|
566
|
+
function firstValueFrom(source, config) {
|
|
589
567
|
return new Promise(function(resolve, reject) {
|
|
590
568
|
var subscriber = new SafeSubscriber({
|
|
591
569
|
next: function(value) {
|
|
@@ -1477,8 +1455,8 @@ var metadata = (schemaTypes, metadataFields) => defineType({
|
|
|
1477
1455
|
return a;
|
|
1478
1456
|
}, __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
1479
1457
|
const documentInternationalization = definePlugin(
|
|
1480
|
-
(
|
|
1481
|
-
const pluginConfig = __spreadValues(__spreadValues({}, DEFAULT_CONFIG),
|
|
1458
|
+
(config) => {
|
|
1459
|
+
const pluginConfig = __spreadValues(__spreadValues({}, DEFAULT_CONFIG), config), {
|
|
1482
1460
|
supportedLanguages,
|
|
1483
1461
|
schemaTypes,
|
|
1484
1462
|
languageField,
|