@sanity/cli 7.17.0 → 8.0.0
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/README.md +81 -6
- package/dist/SanityHelp.js +1 -35
- package/dist/SanityHelp.js.map +1 -1
- package/dist/actions/assets/assetFileError.js +9 -0
- package/dist/actions/assets/assetFileError.js.map +1 -0
- package/dist/actions/assets/uploadAssetFromFile.js +40 -0
- package/dist/actions/assets/uploadAssetFromFile.js.map +1 -0
- package/dist/actions/assets/uploadAssetWithProgress.js +76 -0
- package/dist/actions/assets/uploadAssetWithProgress.js.map +1 -0
- package/dist/actions/deploy/deployApp.js +39 -44
- package/dist/actions/deploy/deployApp.js.map +1 -1
- package/dist/actions/deploy/deployChecks.js +21 -13
- package/dist/actions/deploy/deployChecks.js.map +1 -1
- package/dist/actions/deploy/deployRunner.js +8 -7
- package/dist/actions/deploy/deployRunner.js.map +1 -1
- package/dist/actions/deploy/deployStudio.js +55 -35
- package/dist/actions/deploy/deployStudio.js.map +1 -1
- package/dist/actions/deploy/deploymentPlan.js +17 -29
- package/dist/actions/deploy/deploymentPlan.js.map +1 -1
- package/dist/actions/deploy/resolveDeployTarget.js +2 -8
- package/dist/actions/deploy/resolveDeployTarget.js.map +1 -1
- package/dist/actions/dev/servers/getDevServerConfig.js +2 -8
- package/dist/actions/dev/servers/getDevServerConfig.js.map +1 -1
- package/dist/actions/dev/servers/startStudioDevServer.js +7 -1
- package/dist/actions/dev/servers/startStudioDevServer.js.map +1 -1
- package/dist/actions/init/bootstrapRemoteTemplate.js +2 -2
- package/dist/actions/init/bootstrapRemoteTemplate.js.map +1 -1
- package/dist/actions/schema/listSchemas.js +1 -1
- package/dist/actions/schema/listSchemas.js.map +1 -1
- package/dist/actions/tokens/constants.js +2 -2
- package/dist/actions/tokens/constants.js.map +1 -1
- package/dist/actions/tokens/expiry.js +35 -0
- package/dist/actions/tokens/expiry.js.map +1 -0
- package/dist/actions/tokens/types.js.map +1 -1
- package/dist/actions/tokens/validateRole.js +5 -2
- package/dist/actions/tokens/validateRole.js.map +1 -1
- package/dist/actions/typegen/count.js +6 -0
- package/dist/actions/typegen/count.js.map +1 -0
- package/dist/actions/typegen/formatPath.js +5 -0
- package/dist/actions/typegen/formatPath.js.map +1 -0
- package/dist/actions/typegen/percent.js +8 -0
- package/dist/actions/typegen/percent.js.map +1 -0
- package/dist/actions/typegen/renderTypegenProgress.js +88 -0
- package/dist/actions/typegen/renderTypegenProgress.js.map +1 -0
- package/dist/actions/undeploy/adapters.js +6 -9
- package/dist/actions/undeploy/adapters.js.map +1 -1
- package/dist/actions/undeploy/runUndeploy.js +12 -4
- package/dist/actions/undeploy/runUndeploy.js.map +1 -1
- package/dist/actions/undeploy/undeployPlan.js +6 -14
- package/dist/actions/undeploy/undeployPlan.js.map +1 -1
- package/dist/commands/assets/upload.js +126 -0
- package/dist/commands/assets/upload.js.map +1 -0
- package/dist/commands/backups/list.js +1 -1
- package/dist/commands/backups/list.js.map +1 -1
- package/dist/commands/datasets/copy.js +1 -1
- package/dist/commands/datasets/copy.js.map +1 -1
- package/dist/commands/login.js +2 -8
- package/dist/commands/login.js.map +1 -1
- package/dist/commands/mcp/configure.js.map +1 -1
- package/dist/commands/migrations/list.js +1 -1
- package/dist/commands/migrations/list.js.map +1 -1
- package/dist/commands/migrations/run.js +67 -3
- package/dist/commands/migrations/run.js.map +1 -1
- package/dist/commands/new.js +56 -4
- package/dist/commands/new.js.map +1 -1
- package/dist/commands/organizations/list.js +1 -1
- package/dist/commands/organizations/list.js.map +1 -1
- package/dist/commands/projects/list.js +39 -12
- package/dist/commands/projects/list.js.map +1 -1
- package/dist/commands/projects/unclaimed.js +39 -33
- package/dist/commands/projects/unclaimed.js.map +1 -1
- package/dist/commands/tokens/create.js +92 -7
- package/dist/commands/tokens/create.js.map +1 -1
- package/dist/commands/tokens/delete.js +2 -2
- package/dist/commands/tokens/delete.js.map +1 -1
- package/dist/commands/tokens/list.js +12 -11
- package/dist/commands/tokens/list.js.map +1 -1
- package/dist/commands/tokens/rotate.js +95 -0
- package/dist/commands/tokens/rotate.js.map +1 -0
- package/dist/commands/typegen/generate.js +222 -0
- package/dist/commands/typegen/generate.js.map +1 -0
- package/dist/commands/users/list.js +8 -8
- package/dist/commands/users/list.js.map +1 -1
- package/dist/exports/_internal.d.ts +29 -0
- package/dist/exports/_internal.js +1 -0
- package/dist/exports/_internal.js.map +1 -1
- package/dist/exports/invokeSanityCli/commandPolicies/mcpPolicy.js +29 -14
- package/dist/exports/invokeSanityCli/commandPolicies/mcpPolicy.js.map +1 -1
- package/dist/exports/invokeSanityCli/help.js +4 -0
- package/dist/exports/invokeSanityCli/help.js.map +1 -1
- package/dist/exports/invokeSanityCli/index.js +2 -0
- package/dist/exports/invokeSanityCli/index.js.map +1 -1
- package/dist/hooks/commandNotFound/topicAliases.js +13 -40
- package/dist/hooks/commandNotFound/topicAliases.js.map +1 -1
- package/dist/hooks/prerun/setupTelemetry.js +3 -2
- package/dist/hooks/prerun/setupTelemetry.js.map +1 -1
- package/dist/server/vite/plugin-typegen.js +4 -16
- package/dist/server/vite/plugin-typegen.js.map +1 -1
- package/dist/services/assets.js +46 -0
- package/dist/services/assets.js.map +1 -0
- package/dist/services/newInstructions.js +48 -0
- package/dist/services/newInstructions.js.map +1 -0
- package/dist/services/tokens.js +81 -31
- package/dist/services/tokens.js.map +1 -1
- package/dist/topicAliases.js +43 -0
- package/dist/topicAliases.js.map +1 -1
- package/dist/util/parseArguments.js +7 -2
- package/dist/util/parseArguments.js.map +1 -1
- package/dist/util/readTokenFromStdin.js +17 -0
- package/dist/util/readTokenFromStdin.js.map +1 -0
- package/dist/util/responsiveTable.js +97 -0
- package/dist/util/responsiveTable.js.map +1 -0
- package/dist/util/telemetry/commandTelemetry.js +34 -0
- package/dist/util/telemetry/commandTelemetry.js.map +1 -0
- package/dist/util/unclaimedProjects.js +10 -0
- package/dist/util/unclaimedProjects.js.map +1 -1
- package/oclif.config.js +2 -4
- package/oclif.manifest.json +224 -2
- package/package.json +12 -10
- package/templates/shopify/components/inputs/ShopifyMetafield.tsx +20 -0
- package/templates/shopify/docs/features.md +24 -0
- package/templates/shopify/schemaTypes/index.ts +2 -0
- package/templates/shopify/schemaTypes/objects/shopify/shopifyCollectionType.ts +18 -1
- package/templates/shopify/schemaTypes/objects/shopify/shopifyMetafieldType.ts +47 -0
- package/templates/shopify/schemaTypes/objects/shopify/shopifyProductType.ts +17 -0
- package/templates/shopify/utils/formatMetafieldValue.ts +30 -0
- package/templates/shopify-online-storefront/components/inputs/ShopifyMetafield.tsx +22 -0
- package/templates/shopify-online-storefront/schemaTypes/index.ts +4 -0
- package/templates/shopify-online-storefront/schemaTypes/objects/shop.ts +16 -0
- package/templates/shopify-online-storefront/schemaTypes/objects/shopifyCollection.ts +19 -0
- package/templates/shopify-online-storefront/schemaTypes/objects/shopifyMetafield.ts +53 -0
- package/templates/shopify-online-storefront/schemaTypes/objects/shopifyProduct.ts +19 -0
- package/templates/shopify-online-storefront/utils/formatMetafieldValue.ts +30 -0
|
@@ -14,6 +14,14 @@ export default defineType({
|
|
|
14
14
|
name: 'status',
|
|
15
15
|
title: 'Status',
|
|
16
16
|
},
|
|
17
|
+
{
|
|
18
|
+
name: 'metafields',
|
|
19
|
+
title: 'Metafields',
|
|
20
|
+
options: {
|
|
21
|
+
collapsed: true,
|
|
22
|
+
collapsible: true,
|
|
23
|
+
},
|
|
24
|
+
},
|
|
17
25
|
],
|
|
18
26
|
fields: [
|
|
19
27
|
// Created at
|
|
@@ -98,6 +106,17 @@ export default defineType({
|
|
|
98
106
|
title: 'Sort order',
|
|
99
107
|
type: 'string',
|
|
100
108
|
}),
|
|
109
|
+
// Metafields
|
|
110
|
+
defineField({
|
|
111
|
+
fieldset: 'metafields',
|
|
112
|
+
name: 'metafields',
|
|
113
|
+
title: 'Metafields',
|
|
114
|
+
type: 'array',
|
|
115
|
+
description: 'Read-only. Replaced in full on every sync',
|
|
116
|
+
// Shopify owns the order, and `readOnly` does not remove the drag handles on its own.
|
|
117
|
+
options: {sortable: false},
|
|
118
|
+
of: [{type: 'shopifyMetafield'}],
|
|
119
|
+
}),
|
|
101
120
|
// Shop details
|
|
102
121
|
defineField({
|
|
103
122
|
name: 'shop',
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import {TagIcon} from '@sanity/icons/Tag'
|
|
2
|
+
import {defineField, defineType} from 'sanity'
|
|
3
|
+
|
|
4
|
+
import ShopifyMetafield from '../../components/inputs/ShopifyMetafield'
|
|
5
|
+
import {formatMetafieldValue} from '../../utils/formatMetafieldValue'
|
|
6
|
+
|
|
7
|
+
export default defineType({
|
|
8
|
+
title: 'Metafield',
|
|
9
|
+
name: 'shopifyMetafield',
|
|
10
|
+
type: 'object',
|
|
11
|
+
icon: TagIcon,
|
|
12
|
+
readOnly: true,
|
|
13
|
+
components: {
|
|
14
|
+
input: ShopifyMetafield,
|
|
15
|
+
},
|
|
16
|
+
fields: [
|
|
17
|
+
// Namespace
|
|
18
|
+
defineField({
|
|
19
|
+
title: 'Namespace',
|
|
20
|
+
name: 'namespace',
|
|
21
|
+
type: 'string',
|
|
22
|
+
}),
|
|
23
|
+
// Key
|
|
24
|
+
defineField({
|
|
25
|
+
title: 'Key',
|
|
26
|
+
name: 'key',
|
|
27
|
+
type: 'string',
|
|
28
|
+
}),
|
|
29
|
+
// Type
|
|
30
|
+
defineField({
|
|
31
|
+
title: 'Type',
|
|
32
|
+
name: 'type',
|
|
33
|
+
type: 'string',
|
|
34
|
+
}),
|
|
35
|
+
// `value` is deliberately left undeclared: it can be a string, number, boolean, list or object
|
|
36
|
+
// depending on the metafield type, and a declared field is type-checked even when hidden.
|
|
37
|
+
],
|
|
38
|
+
preview: {
|
|
39
|
+
select: {
|
|
40
|
+
key: 'key',
|
|
41
|
+
namespace: 'namespace',
|
|
42
|
+
type: 'type',
|
|
43
|
+
value: 'value',
|
|
44
|
+
},
|
|
45
|
+
prepare({key, namespace, type, value}) {
|
|
46
|
+
const name = [namespace, key].filter(Boolean).join('.')
|
|
47
|
+
return {
|
|
48
|
+
subtitle: formatMetafieldValue(type, value),
|
|
49
|
+
title: type ? `${name} (${type})` : name,
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
})
|
|
@@ -29,6 +29,14 @@ export default defineType({
|
|
|
29
29
|
collapsible: true,
|
|
30
30
|
},
|
|
31
31
|
},
|
|
32
|
+
{
|
|
33
|
+
name: 'metafields',
|
|
34
|
+
title: 'Metafields',
|
|
35
|
+
options: {
|
|
36
|
+
collapsed: true,
|
|
37
|
+
collapsible: true,
|
|
38
|
+
},
|
|
39
|
+
},
|
|
32
40
|
],
|
|
33
41
|
fields: [
|
|
34
42
|
// Created at
|
|
@@ -154,6 +162,17 @@ export default defineType({
|
|
|
154
162
|
},
|
|
155
163
|
],
|
|
156
164
|
}),
|
|
165
|
+
// Metafields
|
|
166
|
+
defineField({
|
|
167
|
+
fieldset: 'metafields',
|
|
168
|
+
name: 'metafields',
|
|
169
|
+
title: 'Metafields',
|
|
170
|
+
type: 'array',
|
|
171
|
+
description: 'Read-only. Replaced in full on every sync',
|
|
172
|
+
// Shopify owns the order, and `readOnly` does not remove the drag handles on its own.
|
|
173
|
+
options: {sortable: false},
|
|
174
|
+
of: [{type: 'shopifyMetafield'}],
|
|
175
|
+
}),
|
|
157
176
|
// Shop details
|
|
158
177
|
defineField({
|
|
159
178
|
name: 'shop',
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shows a synced Shopify metafield value as text, based on its metafield `type`.
|
|
3
|
+
*
|
|
4
|
+
* The types below are examples. Anything not listed falls back to the raw value, so your own
|
|
5
|
+
* metafields still display — add an entry here to show one of them nicely. Every type and the shape
|
|
6
|
+
* of its value: https://shopify.dev/docs/apps/build/custom-data/metafields/list-of-data-types
|
|
7
|
+
*/
|
|
8
|
+
const measurement = ({value, unit}: {value: number; unit: string}) => `${value} ${unit}`
|
|
9
|
+
|
|
10
|
+
const formatters: Record<string, (value: any) => string> = {
|
|
11
|
+
dimension: measurement,
|
|
12
|
+
weight: measurement,
|
|
13
|
+
volume: measurement,
|
|
14
|
+
money: ({amount, currency_code: currencyCode}) => `${amount} ${currencyCode}`,
|
|
15
|
+
rating: ({value, scale_max: scaleMax}) => `${value} / ${scaleMax}`,
|
|
16
|
+
'list.single_line_text_field': (values: string[]) => values.join(', '),
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const formatMetafieldValue = (type: string | undefined, value: unknown) => {
|
|
20
|
+
if (value === null || typeof value === 'undefined') {
|
|
21
|
+
return ''
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const format = type ? formatters[type] : undefined
|
|
25
|
+
if (format) {
|
|
26
|
+
return format(value)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return typeof value === 'string' ? value : JSON.stringify(value)
|
|
30
|
+
}
|