sanity 5.0.0-next-major.20251210134624 → 5.0.0-next-major.20251215093220
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-es/_internal.js +2 -2
- package/lib/_chunks-es/_internal.js.map +1 -1
- package/lib/_chunks-es/exportAssetsAction.js.map +1 -1
- package/lib/_chunks-es/package.js +1 -1
- package/lib/_chunks-es/pane.js +45 -33
- package/lib/_chunks-es/pane.js.map +1 -1
- package/lib/_chunks-es/resources7.js +6 -0
- package/lib/_chunks-es/resources7.js.map +1 -1
- package/lib/_chunks-es/upgradePackages.js +6 -6
- package/lib/_chunks-es/upgradePackages.js.map +1 -1
- package/lib/_chunks-es/version.js +1 -1
- package/lib/_singletons.d.ts +1 -2
- package/lib/desk.d.ts +6 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +103 -104
- package/lib/index.js.map +1 -1
- package/lib/structure.d.ts +6 -0
- package/package.json +22 -22
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exportAssetsAction.js","sources":["../../src/_internal/cli/actions/media/exportAssetsAction.ts"],"sourcesContent":["import path from 'node:path'\n\nimport {type CliCommandAction} from '@sanity/cli'\nimport {exportDataset} from '@sanity/export'\n\nimport {
|
|
1
|
+
{"version":3,"file":"exportAssetsAction.js","sources":["../../src/_internal/cli/actions/media/exportAssetsAction.ts"],"sourcesContent":["import path from 'node:path'\n\nimport {type CliCommandAction} from '@sanity/cli'\nimport {exportDataset, type ExportProgress} from '@sanity/export'\n\nimport {MINIMUM_API_VERSION} from './constants'\nimport {determineTargetMediaLibrary} from './lib/determineTargetMediaLibrary'\n\ninterface ExportAssetsFlags {\n 'media-library-id'?: string\n}\n\nconst DEFAULT_CONCURRENCY = 6\n\nconst exportAssetsAction: CliCommandAction<ExportAssetsFlags> = async (args, context) => {\n const {apiClient, output, chalk} = context\n\n const mediaLibraryId =\n args.extOptions['media-library-id'] ?? (await determineTargetMediaLibrary(context))\n\n const client = apiClient().withConfig({\n apiVersion: MINIMUM_API_VERSION,\n requestTagPrefix: 'sanity.mediaLibraryCli.export',\n })\n\n const outputPath = path.join(\n process.cwd(),\n `media-library-${mediaLibraryId}-${Date.now()}.tar.gz`,\n )\n\n output.print()\n output.print(`Exporting from media library: ${chalk.bold(mediaLibraryId)}`)\n output.print(`Exporting to path: ${chalk.bold(outputPath)}`)\n output.print()\n\n let currentStep = 'Beginning export…'\n let spinner = output.spinner(currentStep).start()\n\n try {\n await exportDataset({\n client,\n mediaLibraryId,\n outputPath,\n drafts: false,\n types: ['sanity.asset'],\n assetConcurrency: DEFAULT_CONCURRENCY,\n mode: 'stream',\n onProgress: (progress: ExportProgress) => {\n if (progress.step !== currentStep) {\n spinner.succeed()\n spinner = output.spinner(progress.step).start()\n } else if (progress.step === currentStep && progress.update) {\n spinner.text = `${progress.step} (${progress.current}/${progress.total})`\n }\n currentStep = progress.step\n },\n // The `assets.json` assets map is not required for Media Library archives, because the\n // import process reads asset files directly from the archive.\n assetsMap: false,\n // The documents listed in `data.ndjson` are only used for recording aspect data. If there\n // is no aspect data, the document can safely be omitted.\n filterDocument: (doc: unknown) => {\n if (typeof doc !== 'object' || doc === null || !('aspects' in doc)) {\n return false\n }\n\n // Filter out video assets (we dont have access to the raw video file for now)\n if ('assetType' in doc && doc.assetType === 'sanity.videoAsset') {\n return false\n }\n\n return (\n typeof doc.aspects === 'object' &&\n doc.aspects !== null &&\n Object.keys(doc.aspects).length !== 0\n )\n },\n // Media Library archives only record asset aspect data. All other data can be safely\n // ommitted.\n transformDocument: (doc) => {\n if (\n typeof doc !== 'object' ||\n doc === null ||\n !('currentVersion' in doc) ||\n !('aspects' in doc)\n ) {\n return doc\n }\n\n if (\n typeof doc.currentVersion !== 'object' ||\n doc.currentVersion === null ||\n !('_ref' in doc.currentVersion) ||\n typeof doc.currentVersion._ref !== 'string'\n ) {\n return doc\n }\n\n // Determine the asset's path inside the archive: either \"images\" or \"files\".\n const pathPrefix = [doc.currentVersion._ref.split('-')[0], 's'].join('')\n\n return {\n filename: [pathPrefix, generateFilename(doc.currentVersion._ref)].join('/'),\n aspects: doc.aspects,\n }\n },\n })\n } catch (error) {\n spinner.fail(`Failed to export media library`)\n throw error\n }\n\n spinner.succeed(`Exported media library to ${chalk.bold(outputPath)}`)\n}\n\nexport default exportAssetsAction\n\nfunction generateFilename(assetId: string): string {\n const [, , asset, ext] = assetId.match(/^(image|file)-(.*?)(-[a-z]+)?$/) || []\n const extension = (ext || 'bin').replace(/^-/, '')\n return asset ? `${asset}.${extension}` : `${assetId}.bin`\n}\n"],"names":["DEFAULT_CONCURRENCY","exportAssetsAction","args","context","apiClient","output","chalk","mediaLibraryId","extOptions","determineTargetMediaLibrary","client","withConfig","apiVersion","MINIMUM_API_VERSION","requestTagPrefix","outputPath","path","join","process","cwd","Date","now","print","bold","currentStep","spinner","start","exportDataset","drafts","types","assetConcurrency","mode","onProgress","progress","step","succeed","update","text","current","total","assetsMap","filterDocument","doc","assetType","aspects","Object","keys","length","transformDocument","currentVersion","_ref","filename","split","generateFilename","error","fail","assetId","asset","ext","match","extension","replace"],"mappings":";;;AAYA,MAAMA,sBAAsB,GAEtBC,qBAA0D,OAAOC,MAAMC,YAAY;AACvF,QAAM;AAAA,IAACC;AAAAA,IAAWC;AAAAA,IAAQC;AAAAA,EAAAA,IAASH,SAE7BI,iBACJL,KAAKM,WAAW,kBAAkB,KAAM,MAAMC,4BAA4BN,OAAO,GAE7EO,SAASN,UAAAA,EAAYO,WAAW;AAAA,IACpCC,YAAYC;AAAAA,IACZC,kBAAkB;AAAA,EAAA,CACnB,GAEKC,aAAaC,KAAKC,KACtBC,QAAQC,IAAAA,GACR,iBAAiBZ,cAAc,IAAIa,KAAKC,IAAAA,CAAK,SAC/C;AAEAhB,SAAOiB,SACPjB,OAAOiB,MAAM,iCAAiChB,MAAMiB,KAAKhB,cAAc,CAAC,EAAE,GAC1EF,OAAOiB,MAAM,sBAAsBhB,MAAMiB,KAAKR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AAK,GAAG;AAAA,QAC1E2B,SAASF,IAAIE;AAAAA,MAAAA;AAAAA,IACf,CAEH;AAAA,EACH,SAASU,OAAO;AACd7B,UAAAA,QAAQ8B,KAAK,gCAAgC,GACvCD;AAAAA,EACR;AAEA7B,UAAQU,QAAQ,6BAA6B7B,MAAMiB,KAAKR,UAAU,CAAC,EAAE;AACvE;AAIA,SAASsC,iBAAiBG,SAAyB;AACjD,QAAM,CAAA,EAAA,EAAKC,OAAOC,GAAG,IAAIF,QAAQG,MAAM,gCAAgC,KAAK,CAAA,GACtEC,aAAaF,OAAO,OAAOG,QAAQ,MAAM,EAAE;AACjD,SAAOJ,QAAQ,GAAGA,KAAK,IAAIG,SAAS,KAAK,GAAGJ,OAAO;AACrD;"}
|
package/lib/_chunks-es/pane.js
CHANGED
|
@@ -3106,85 +3106,97 @@ const Image = styled.img`
|
|
|
3106
3106
|
height: 180px;
|
|
3107
3107
|
display: flex;
|
|
3108
3108
|
`, CANVAS_IMAGE_URL = "https://cdn.sanity.io/images/pyrmmpch/production/b47224e2f3a7d1747e43b9da1ac31739250e628b-632x376.png", CANVAS_APP_NAME = "Canvas", CanvasPopoverContent = (t0) => {
|
|
3109
|
-
const $ = c(
|
|
3110
|
-
onClose
|
|
3109
|
+
const $ = c(24), {
|
|
3110
|
+
onClose,
|
|
3111
|
+
isLockedByCanvas
|
|
3111
3112
|
} = t0, {
|
|
3112
3113
|
t
|
|
3113
3114
|
} = useTranslation(structureLocaleNamespace), ref = useRef(null);
|
|
3114
3115
|
let t1;
|
|
3115
3116
|
$[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t1 = () => [ref.current], $[0] = t1) : t1 = $[0], useClickOutsideEvent(onClose, t1);
|
|
3116
3117
|
let t2;
|
|
3117
|
-
$[1]
|
|
3118
|
+
$[1] !== isLockedByCanvas || $[2] !== t ? (t2 = t(isLockedByCanvas ? "canvas.banner.popover-heading" : "canvas.banner.editable.popover-heading"), $[1] = isLockedByCanvas, $[2] = t, $[3] = t2) : t2 = $[3];
|
|
3119
|
+
const popoverHeading = t2;
|
|
3118
3120
|
let t3;
|
|
3119
|
-
$[
|
|
3121
|
+
$[4] !== isLockedByCanvas || $[5] !== t ? (t3 = t(isLockedByCanvas ? "canvas.banner.popover-description" : "canvas.banner.editable.popover-description"), $[4] = isLockedByCanvas, $[5] = t, $[6] = t3) : t3 = $[6];
|
|
3122
|
+
const popoverDescription = t3;
|
|
3120
3123
|
let t4;
|
|
3121
|
-
$[
|
|
3122
|
-
t3,
|
|
3123
|
-
/* @__PURE__ */ jsx(Text, { size: 1, muted: !0, children: /* @__PURE__ */ jsx(ComposeSparklesIcon, {}) })
|
|
3124
|
-
] }), $[3] = t4) : t4 = $[3];
|
|
3124
|
+
$[7] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t4 = /* @__PURE__ */ jsx(Image, { src: CANVAS_IMAGE_URL, alt: "Canvas" }), $[7] = t4) : t4 = $[7];
|
|
3125
3125
|
let t5;
|
|
3126
|
-
$[
|
|
3126
|
+
$[8] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t5 = /* @__PURE__ */ jsx(Text, { size: 1, weight: "semibold", children: CANVAS_APP_NAME }), $[8] = t5) : t5 = $[8];
|
|
3127
3127
|
let t6;
|
|
3128
|
-
$[
|
|
3128
|
+
$[9] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t6 = /* @__PURE__ */ jsxs(Flex, { paddingY: 1, gap: 2, children: [
|
|
3129
|
+
t5,
|
|
3130
|
+
/* @__PURE__ */ jsx(Text, { size: 1, muted: !0, children: /* @__PURE__ */ jsx(ComposeSparklesIcon, {}) })
|
|
3131
|
+
] }), $[9] = t6) : t6 = $[9];
|
|
3129
3132
|
let t7;
|
|
3130
|
-
$[
|
|
3133
|
+
$[10] !== popoverHeading ? (t7 = /* @__PURE__ */ jsx(Box, { paddingTop: 3, children: /* @__PURE__ */ jsx(Heading, { size: 1, children: popoverHeading }) }), $[10] = popoverHeading, $[11] = t7) : t7 = $[11];
|
|
3131
3134
|
let t8;
|
|
3132
|
-
$[
|
|
3135
|
+
$[12] !== popoverDescription ? (t8 = /* @__PURE__ */ jsx(Box, { paddingTop: 4, children: /* @__PURE__ */ jsx(Text, { size: 1, children: popoverDescription }) }), $[12] = popoverDescription, $[13] = t8) : t8 = $[13];
|
|
3133
3136
|
let t9;
|
|
3134
|
-
$[
|
|
3135
|
-
t4,
|
|
3137
|
+
$[14] !== t7 || $[15] !== t8 ? (t9 = /* @__PURE__ */ jsxs(Flex, { paddingX: 4, paddingBottom: 4, paddingTop: 3, direction: "column", children: [
|
|
3136
3138
|
t6,
|
|
3139
|
+
t7,
|
|
3137
3140
|
t8
|
|
3138
|
-
] }), $[
|
|
3141
|
+
] }), $[14] = t7, $[15] = t8, $[16] = t9) : t9 = $[16];
|
|
3139
3142
|
let t10;
|
|
3140
|
-
$[
|
|
3143
|
+
$[17] !== t ? (t10 = t("canvas.banner.popover-button-text"), $[17] = t, $[18] = t10) : t10 = $[18];
|
|
3141
3144
|
let t11;
|
|
3142
|
-
$[
|
|
3145
|
+
$[19] !== t10 ? (t11 = /* @__PURE__ */ jsx(Flex, { width: "full", gap: 3, justify: "flex-end", paddingX: 4, paddingBottom: 4, children: /* @__PURE__ */ jsx(Button$1, { mode: "bleed", text: t10, autoFocus: !0, tone: "primary", href: "https://snty.link/canvas-docs", target: "_blank", rel: "noopener noreferrer", as: "a", iconRight: LaunchIcon }) }), $[19] = t10, $[20] = t11) : t11 = $[20];
|
|
3143
3146
|
let t12;
|
|
3144
|
-
return $[
|
|
3145
|
-
|
|
3147
|
+
return $[21] !== t11 || $[22] !== t9 ? (t12 = /* @__PURE__ */ jsx(Card, { radius: 3, overflow: "hidden", width: 0, ref, children: /* @__PURE__ */ jsxs(Container$1, { width: 0, children: [
|
|
3148
|
+
t4,
|
|
3146
3149
|
t9,
|
|
3147
3150
|
t11
|
|
3148
|
-
] }) }), $[
|
|
3151
|
+
] }) }), $[21] = t11, $[22] = t9, $[23] = t12) : t12 = $[23], t12;
|
|
3149
3152
|
}, CanvasLinkedBannerContent = (t0) => {
|
|
3150
|
-
const $ = c(
|
|
3153
|
+
const $ = c(21), {
|
|
3151
3154
|
documentId
|
|
3152
3155
|
} = t0, {
|
|
3153
3156
|
t
|
|
3154
|
-
} = useTranslation(structureLocaleNamespace), [open, setOpen] = useState(!1), documentVariantType = getDocumentVariantType(documentId)
|
|
3157
|
+
} = useTranslation(structureLocaleNamespace), [open, setOpen] = useState(!1), documentVariantType = getDocumentVariantType(documentId), {
|
|
3158
|
+
isLockedByCanvas
|
|
3159
|
+
} = useCanvasCompanionDoc(documentId);
|
|
3155
3160
|
let t1;
|
|
3156
3161
|
bb0: {
|
|
3162
|
+
if (!isLockedByCanvas) {
|
|
3163
|
+
let t23;
|
|
3164
|
+
$[0] !== t ? (t23 = t("canvas.banner.editable.linked-text"), $[0] = t, $[1] = t23) : t23 = $[1], t1 = t23;
|
|
3165
|
+
break bb0;
|
|
3166
|
+
}
|
|
3157
3167
|
if (documentVariantType === "published") {
|
|
3158
3168
|
let t23;
|
|
3159
|
-
$[
|
|
3169
|
+
$[2] !== t ? (t23 = t("canvas.banner.linked-text.published"), $[2] = t, $[3] = t23) : t23 = $[3], t1 = t23;
|
|
3160
3170
|
break bb0;
|
|
3161
3171
|
}
|
|
3162
3172
|
if (documentVariantType === "draft") {
|
|
3163
3173
|
let t23;
|
|
3164
|
-
$[
|
|
3174
|
+
$[4] !== t ? (t23 = t("canvas.banner.linked-text.draft"), $[4] = t, $[5] = t23) : t23 = $[5], t1 = t23;
|
|
3165
3175
|
break bb0;
|
|
3166
3176
|
}
|
|
3167
3177
|
let t22;
|
|
3168
|
-
$[
|
|
3178
|
+
$[6] !== t ? (t22 = t("canvas.banner.linked-text.version"), $[6] = t, $[7] = t22) : t22 = $[7], t1 = t22;
|
|
3169
3179
|
}
|
|
3170
3180
|
const variantText = t1;
|
|
3171
3181
|
let t2;
|
|
3172
|
-
$[
|
|
3182
|
+
$[8] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t2 = () => setOpen(_temp$y), $[8] = t2) : t2 = $[8];
|
|
3173
3183
|
const togglePopover = t2;
|
|
3174
3184
|
let t3;
|
|
3175
|
-
$[
|
|
3185
|
+
$[9] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t3 = () => setOpen(!1), $[9] = t3) : t3 = $[9];
|
|
3176
3186
|
const onClose = t3;
|
|
3177
3187
|
let t4;
|
|
3178
|
-
$[
|
|
3179
|
-
let t5
|
|
3180
|
-
$[
|
|
3188
|
+
$[10] !== variantText ? (t4 = /* @__PURE__ */ jsx(Text, { size: 1, weight: "medium", children: variantText }), $[10] = variantText, $[11] = t4) : t4 = $[11];
|
|
3189
|
+
let t5;
|
|
3190
|
+
$[12] !== isLockedByCanvas ? (t5 = /* @__PURE__ */ jsx(CanvasPopoverContent, { onClose, isLockedByCanvas }), $[12] = isLockedByCanvas, $[13] = t5) : t5 = $[13];
|
|
3191
|
+
let t6;
|
|
3192
|
+
$[14] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t6 = /* @__PURE__ */ jsx(Button$1, { tooltipProps: null, mode: "bleed", tone: "default", icon: InfoOutlineIcon, onClick: togglePopover }), $[14] = t6) : t6 = $[14];
|
|
3181
3193
|
let t7;
|
|
3182
|
-
$[
|
|
3194
|
+
$[15] !== open || $[16] !== t5 ? (t7 = /* @__PURE__ */ jsx(Popover, { open, size: 0, tone: "default", portal: !0, placement: "bottom-start", content: t5, children: t6 }), $[15] = open, $[16] = t5, $[17] = t7) : t7 = $[17];
|
|
3183
3195
|
let t8;
|
|
3184
|
-
return $[
|
|
3196
|
+
return $[18] !== t4 || $[19] !== t7 ? (t8 = /* @__PURE__ */ jsxs(Flex, { align: "center", gap: 2, children: [
|
|
3185
3197
|
t4,
|
|
3186
3198
|
t7
|
|
3187
|
-
] }), $[
|
|
3199
|
+
] }), $[18] = t4, $[19] = t7, $[20] = t8) : t8 = $[20], t8;
|
|
3188
3200
|
};
|
|
3189
3201
|
function CanvasLinkedBanner() {
|
|
3190
3202
|
const $ = c(10), {
|