@sanity/assist 1.2.13 → 1.2.15-ui2.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/index.esm.js +32 -27
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +32 -27
- package/dist/index.js.map +1 -1
- package/package.json +11 -11
- package/src/_lib/form/DocumentForm.tsx +1 -1
- package/src/assistInspector/InstructionTaskHistoryButton.tsx +2 -3
- package/src/node_modules/.vitest/results.json +1 -0
- package/src/plugin.tsx +6 -2
- package/src/schemas/serialize/serializeSchema.test.ts +15 -2
- package/src/schemas/serialize/serializeSchema.ts +2 -1
package/dist/index.esm.js
CHANGED
|
@@ -166,7 +166,7 @@ function isUnsupportedType(type) {
|
|
|
166
166
|
}
|
|
167
167
|
const inlineTypes = ["document", "object", "image", "file"];
|
|
168
168
|
function serializeSchema(schema, options) {
|
|
169
|
-
const list = schema.getTypeNames().filter(t => !(hiddenTypes.includes(t) || t.startsWith("sanity."))).map(t => schema.get(t)).filter(t => !!t).filter(t =>
|
|
169
|
+
const list = schema.getTypeNames().filter(t => !(hiddenTypes.includes(t) || t.startsWith("sanity."))).map(t => schema.get(t)).filter(t => !!t).filter(t => !t.hidden && !t.readOnly).map(t => getSchemaStub(t, schema, options)).filter(t => {
|
|
170
170
|
if ("to" in t && t.to && !t.to.length) {
|
|
171
171
|
return false;
|
|
172
172
|
}
|
|
@@ -720,7 +720,7 @@ function asStudioInstruction(instruction, run, validation) {
|
|
|
720
720
|
});
|
|
721
721
|
return {
|
|
722
722
|
...instruction,
|
|
723
|
-
tasks: run.filter(task => task.instructionKey === instruction._key).filter(task => task.started && /* @__PURE__ */new Date().getTime() - new Date(task.started).getTime() < maxHistoryVisibilityMs),
|
|
723
|
+
tasks: run.filter(task => task.instructionKey === instruction._key).filter(task => task.started && ( /* @__PURE__ */new Date()).getTime() - new Date(task.started).getTime() < maxHistoryVisibilityMs),
|
|
724
724
|
validation: errors.filter(marker => fieldRefs.map(r => r.path).filter(p => !!p).find(path => pathToString(marker.path) === path))
|
|
725
725
|
};
|
|
726
726
|
}
|
|
@@ -802,13 +802,13 @@ function InstructionTaskHistoryButton(props) {
|
|
|
802
802
|
const statusDocId = assistTasksStatusId(documentId);
|
|
803
803
|
const basePath = "".concat(typed("tasks"), '[_key=="').concat(taskKey, '"]');
|
|
804
804
|
client.patch(statusDocId).set({
|
|
805
|
-
["".concat(basePath, ".").concat(typed("ended"))]: /* @__PURE__ */new Date().toISOString(),
|
|
805
|
+
["".concat(basePath, ".").concat(typed("ended"))]: ( /* @__PURE__ */new Date()).toISOString(),
|
|
806
806
|
["".concat(basePath, ".").concat(typed("reason"))]: typed("aborted")
|
|
807
807
|
}).commit().catch(console.error);
|
|
808
808
|
}, [client, documentId]);
|
|
809
809
|
const titledTasks = useMemo(() => {
|
|
810
810
|
var _a2;
|
|
811
|
-
const t = (_a2 = tasks == null ? void 0 : tasks.filter(task => task.started && /* @__PURE__ */new Date().getTime() - new Date(task.started).getTime() < maxHistoryVisibilityMs).map(task => {
|
|
811
|
+
const t = (_a2 = tasks == null ? void 0 : tasks.filter(task => task.started && ( /* @__PURE__ */new Date()).getTime() - new Date(task.started).getTime() < maxHistoryVisibilityMs).map(task => {
|
|
812
812
|
var _a3;
|
|
813
813
|
const instruction = instructions == null ? void 0 : instructions.find(i => i._key === task.instructionKey);
|
|
814
814
|
return {
|
|
@@ -875,11 +875,10 @@ const TaskStatusButton = forwardRef(function TaskStatusButton2(props, ref) {
|
|
|
875
875
|
mode: "bleed",
|
|
876
876
|
onClick,
|
|
877
877
|
tone: hasErrors ? "critical" : void 0,
|
|
878
|
-
fontSize: 1,
|
|
879
878
|
disabled,
|
|
880
879
|
ref,
|
|
881
880
|
selected,
|
|
882
|
-
|
|
881
|
+
tooltipProps: TASK_STATUS_BUTTON_TOOLTIP_PROPS
|
|
883
882
|
});
|
|
884
883
|
});
|
|
885
884
|
function TaskList(props) {
|
|
@@ -2161,7 +2160,7 @@ function useAssistPresence(path, showFocusWithin) {
|
|
|
2161
2160
|
const activePresence = (_b = (_a = tasks == null ? void 0 : tasks.filter(task => !task.ended)) == null ? void 0 : _a.flatMap(task => {
|
|
2162
2161
|
var _a2;
|
|
2163
2162
|
return (_a2 = task.presence) != null ? _a2 : [];
|
|
2164
|
-
})) == null ? void 0 : _b.filter(p => p.started && /* @__PURE__ */new Date().getTime() - new Date(p.started).getTime() < maxHistoryVisibilityMs).filter(presence => {
|
|
2163
|
+
})) == null ? void 0 : _b.filter(p => p.started && ( /* @__PURE__ */new Date()).getTime() - new Date(p.started).getTime() < maxHistoryVisibilityMs).filter(presence => {
|
|
2165
2164
|
if (!presence.path || !path.length) {
|
|
2166
2165
|
return false;
|
|
2167
2166
|
}
|
|
@@ -2195,7 +2194,7 @@ function aiPresence(presence, path, title) {
|
|
|
2195
2194
|
},
|
|
2196
2195
|
path,
|
|
2197
2196
|
sessionId: "not-available",
|
|
2198
|
-
lastActiveAt: (_a = presence == null ? void 0 : presence.started) != null ? _a : /* @__PURE__ */new Date().toISOString()
|
|
2197
|
+
lastActiveAt: (_a = presence == null ? void 0 : presence.started) != null ? _a : ( /* @__PURE__ */new Date()).toISOString()
|
|
2199
2198
|
};
|
|
2200
2199
|
}
|
|
2201
2200
|
var __freeze$3 = Object.freeze;
|
|
@@ -2222,47 +2221,47 @@ const FadeInContent = forwardRef(function FadeInContent2(_ref9, ref) {
|
|
|
2222
2221
|
const purple = {
|
|
2223
2222
|
"50": {
|
|
2224
2223
|
title: "Purple 50",
|
|
2225
|
-
hex: "#
|
|
2224
|
+
hex: "#f8f5ff"
|
|
2226
2225
|
},
|
|
2227
2226
|
"100": {
|
|
2228
2227
|
title: "Purple 100",
|
|
2229
|
-
hex: "#
|
|
2228
|
+
hex: "#f1ebff"
|
|
2230
2229
|
},
|
|
2231
2230
|
"200": {
|
|
2232
2231
|
title: "Purple 200",
|
|
2233
|
-
hex: "#
|
|
2232
|
+
hex: "#ece1fe"
|
|
2234
2233
|
},
|
|
2235
2234
|
"300": {
|
|
2236
2235
|
title: "Purple 300",
|
|
2237
|
-
hex: "#
|
|
2236
|
+
hex: "#ccb1fc"
|
|
2238
2237
|
},
|
|
2239
2238
|
"400": {
|
|
2240
2239
|
title: "Purple 400",
|
|
2241
|
-
hex: "#
|
|
2240
|
+
hex: "#b087f7"
|
|
2242
2241
|
},
|
|
2243
2242
|
"500": {
|
|
2244
2243
|
title: "Purple 500",
|
|
2245
|
-
hex: "#
|
|
2244
|
+
hex: "#8f57ef"
|
|
2246
2245
|
},
|
|
2247
2246
|
"600": {
|
|
2248
2247
|
title: "Purple 600",
|
|
2249
|
-
hex: "#
|
|
2248
|
+
hex: "#721fe5"
|
|
2250
2249
|
},
|
|
2251
2250
|
"700": {
|
|
2252
2251
|
title: "Purple 700",
|
|
2253
|
-
hex: "#
|
|
2252
|
+
hex: "#4c1a9e"
|
|
2254
2253
|
},
|
|
2255
2254
|
"800": {
|
|
2256
2255
|
title: "Purple 800",
|
|
2257
|
-
hex: "#
|
|
2256
|
+
hex: "#2f1862"
|
|
2258
2257
|
},
|
|
2259
2258
|
"900": {
|
|
2260
2259
|
title: "Purple 900",
|
|
2261
|
-
hex: "#
|
|
2260
|
+
hex: "#23173f"
|
|
2262
2261
|
},
|
|
2263
2262
|
"950": {
|
|
2264
2263
|
title: "Purple 950",
|
|
2265
|
-
hex: "#
|
|
2264
|
+
hex: "#181128"
|
|
2266
2265
|
}
|
|
2267
2266
|
};
|
|
2268
2267
|
var __freeze$2 = Object.freeze;
|
|
@@ -2959,7 +2958,6 @@ function AssistConnectorsOverlay(props) {
|
|
|
2959
2958
|
zIndex: 150
|
|
2960
2959
|
// zIndex,
|
|
2961
2960
|
},
|
|
2962
|
-
|
|
2963
2961
|
children: connectors.map(connector => /* @__PURE__ */jsx(ConnectorPath, {
|
|
2964
2962
|
from: connector.from,
|
|
2965
2963
|
options,
|
|
@@ -3974,7 +3972,6 @@ const prompt = defineType({
|
|
|
3974
3972
|
type: userInput.name,
|
|
3975
3973
|
}),*/]
|
|
3976
3974
|
});
|
|
3977
|
-
|
|
3978
3975
|
const instruction = defineType({
|
|
3979
3976
|
type: "object",
|
|
3980
3977
|
name: instructionTypeName,
|
|
@@ -4703,11 +4700,11 @@ function AssistDocumentPresence(props) {
|
|
|
4703
4700
|
const anyPresence2 = (_b = (_a = assistDocument == null ? void 0 : assistDocument.tasks) == null ? void 0 : _a.filter(run => !run.ended && !run.reason)) == null ? void 0 : _b.flatMap(run => {
|
|
4704
4701
|
var _a2;
|
|
4705
4702
|
return (_a2 = run.presence) != null ? _a2 : [];
|
|
4706
|
-
}).find(f => f.started && /* @__PURE__ */new Date().getTime() - new Date(f.started).getTime() < 3e4);
|
|
4703
|
+
}).find(f => f.started && ( /* @__PURE__ */new Date()).getTime() - new Date(f.started).getTime() < 3e4);
|
|
4707
4704
|
if (anyPresence2) {
|
|
4708
4705
|
return aiPresence(anyPresence2, []);
|
|
4709
4706
|
}
|
|
4710
|
-
const anyRun = (_d = (_c = assistDocument == null ? void 0 : assistDocument.tasks) == null ? void 0 : _c.filter(run => !run.ended && !run.reason)) == null ? void 0 : _d.find(f => f.started && /* @__PURE__ */new Date().getTime() - new Date(f.started).getTime() < 3e4);
|
|
4707
|
+
const anyRun = (_d = (_c = assistDocument == null ? void 0 : assistDocument.tasks) == null ? void 0 : _c.filter(run => !run.ended && !run.reason)) == null ? void 0 : _d.find(f => f.started && ( /* @__PURE__ */new Date()).getTime() - new Date(f.started).getTime() < 3e4);
|
|
4711
4708
|
return anyRun ? aiPresence({
|
|
4712
4709
|
started: anyRun.started,
|
|
4713
4710
|
path: documentRootKey,
|
|
@@ -4744,15 +4741,23 @@ const assist = definePlugin(config => {
|
|
|
4744
4741
|
}
|
|
4745
4742
|
return prev;
|
|
4746
4743
|
},
|
|
4747
|
-
unstable_fieldActions: prev => {
|
|
4748
|
-
|
|
4744
|
+
unstable_fieldActions: (prev, _ref17) => {
|
|
4745
|
+
let {
|
|
4746
|
+
documentType,
|
|
4747
|
+
schema
|
|
4748
|
+
} = _ref17;
|
|
4749
|
+
const docSchema = schema.get(documentType);
|
|
4750
|
+
if (docSchema && isSchemaAssistEnabled(docSchema)) {
|
|
4751
|
+
return [...prev, assistFieldActions];
|
|
4752
|
+
}
|
|
4753
|
+
return prev;
|
|
4749
4754
|
},
|
|
4750
|
-
unstable_languageFilter: (prev,
|
|
4755
|
+
unstable_languageFilter: (prev, _ref18) => {
|
|
4751
4756
|
let {
|
|
4752
4757
|
documentId,
|
|
4753
4758
|
schema,
|
|
4754
4759
|
schemaType
|
|
4755
|
-
} =
|
|
4760
|
+
} = _ref18;
|
|
4756
4761
|
const docSchema = schema.get(schemaType);
|
|
4757
4762
|
if (docSchema && isObjectSchemaType(docSchema) && isSchemaAssistEnabled(docSchema)) {
|
|
4758
4763
|
return [...prev, createAssistDocumentPresence(documentId, docSchema)];
|