@sanity/debug-preview-url-secret-plugin 1.0.0 → 1.0.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/CHANGELOG.md +6 -0
- package/LICENSE +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +46 -50
- package/dist/index.js.map +1 -1
- package/package.json +10 -15
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @sanity/debug-preview-url-secret-plugin
|
|
2
2
|
|
|
3
|
+
## 1.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#130](https://github.com/sanity-io/plugins/pull/130) [`4399a30`](https://github.com/sanity-io/plugins/commit/4399a3093607d330942791e2f23981906cb8b56d) Thanks [@stipsan](https://github.com/stipsan)! - Improve quality of generated dts
|
|
8
|
+
|
|
3
9
|
## 1.0.0
|
|
4
10
|
|
|
5
11
|
### Major Changes
|
package/LICENSE
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":["debugSecrets","sanity0","Plugin"],"sources":["../src/index.d.ts"],"sourcesContent":["export declare const debugSecrets: import(\"sanity\").Plugin<void>;\n//# sourceMappingURL=index.d.ts.map"],"mappings":";cAAqBA,cAA2CC,OAAAA,CAAZC"}
|
package/dist/index.js
CHANGED
|
@@ -1,56 +1,52 @@
|
|
|
1
|
-
import { definePlugin, defineType } from "sanity";
|
|
2
1
|
import { LockIcon, CloseCircleIcon, CheckmarkCircleIcon } from "@sanity/icons";
|
|
3
2
|
import { schemaType, SECRET_TTL } from "@sanity/preview-url-secret/constants";
|
|
4
|
-
|
|
3
|
+
import { defineType, definePlugin } from "sanity";
|
|
4
|
+
const schema = defineType({
|
|
5
|
+
type: "document",
|
|
6
|
+
icon: LockIcon,
|
|
7
|
+
name: schemaType,
|
|
8
|
+
title: "@sanity/preview-url-secret",
|
|
9
|
+
readOnly: !0,
|
|
10
|
+
fields: [
|
|
11
|
+
{
|
|
12
|
+
type: "string",
|
|
13
|
+
name: "secret",
|
|
14
|
+
title: "Secret"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
type: "string",
|
|
18
|
+
name: "source",
|
|
19
|
+
title: "Source Tool"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
type: "string",
|
|
23
|
+
name: "studioUrl",
|
|
24
|
+
title: "Studio URL"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
type: "string",
|
|
28
|
+
name: "userId",
|
|
29
|
+
title: "Sanity User ID"
|
|
30
|
+
}
|
|
31
|
+
],
|
|
32
|
+
preview: {
|
|
33
|
+
select: {
|
|
34
|
+
source: "source",
|
|
35
|
+
studioUrl: "studioUrl",
|
|
36
|
+
updatedAt: "_updatedAt"
|
|
37
|
+
},
|
|
38
|
+
prepare(data) {
|
|
39
|
+
const url = data.studioUrl ? new URL(data.studioUrl, location.origin) : void 0, updatedAt = new Date(data.updatedAt).getTime(), expiresAt = new Date(updatedAt + 1e3 * SECRET_TTL), expired = expiresAt < /* @__PURE__ */ new Date(), icon = expired ? CloseCircleIcon : CheckmarkCircleIcon;
|
|
40
|
+
return {
|
|
41
|
+
title: url ? `${url.host}${url.pathname}` : data.source,
|
|
42
|
+
subtitle: expired ? "Expired" : `Expires in ${Math.round((expiresAt.getTime() - Date.now()) / (1e3 * 60))} minutes`,
|
|
43
|
+
media: icon
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}), debugSecrets = definePlugin(() => ({
|
|
5
48
|
name: "sanity-plugin-debug-secrets",
|
|
6
|
-
schema: {
|
|
7
|
-
types: [
|
|
8
|
-
defineType({
|
|
9
|
-
type: "document",
|
|
10
|
-
icon: LockIcon,
|
|
11
|
-
name: schemaType,
|
|
12
|
-
title: "@sanity/preview-url-secret",
|
|
13
|
-
readOnly: !0,
|
|
14
|
-
fields: [
|
|
15
|
-
{
|
|
16
|
-
type: "string",
|
|
17
|
-
name: "secret",
|
|
18
|
-
title: "Secret"
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
type: "string",
|
|
22
|
-
name: "source",
|
|
23
|
-
title: "Source Tool"
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
type: "string",
|
|
27
|
-
name: "studioUrl",
|
|
28
|
-
title: "Studio URL"
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
type: "string",
|
|
32
|
-
name: "userId",
|
|
33
|
-
title: "Sanity User ID"
|
|
34
|
-
}
|
|
35
|
-
],
|
|
36
|
-
preview: {
|
|
37
|
-
select: {
|
|
38
|
-
source: "source",
|
|
39
|
-
studioUrl: "studioUrl",
|
|
40
|
-
updatedAt: "_updatedAt"
|
|
41
|
-
},
|
|
42
|
-
prepare(data) {
|
|
43
|
-
const url = data.studioUrl ? new URL(data.studioUrl, location.origin) : void 0, updatedAt = new Date(data.updatedAt).getTime(), expiresAt = new Date(updatedAt + 1e3 * SECRET_TTL), expired = expiresAt < /* @__PURE__ */ new Date(), icon = expired ? CloseCircleIcon : CheckmarkCircleIcon;
|
|
44
|
-
return {
|
|
45
|
-
title: url ? `${url.host}${url.pathname}` : data.source,
|
|
46
|
-
subtitle: expired ? "Expired" : `Expires in ${Math.round((expiresAt.getTime() - Date.now()) / (1e3 * 60))} minutes`,
|
|
47
|
-
media: icon
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
})
|
|
52
|
-
]
|
|
53
|
-
},
|
|
49
|
+
schema: { types: [schema] },
|
|
54
50
|
document: {
|
|
55
51
|
actions: (prev, context) => context.schemaType !== schemaType ? prev : prev.filter(({ action }) => action === "delete"),
|
|
56
52
|
inspectors: (prev, context) => context.documentType !== schemaType ? prev : [],
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["import {CheckmarkCircleIcon, CloseCircleIcon, LockIcon} from '@sanity/icons'\nimport {schemaType, SECRET_TTL} from '@sanity/preview-url-secret/constants'\nimport {definePlugin, defineType} from 'sanity'\n\nconst schema = defineType({\n type: 'document',\n icon: LockIcon,\n name: schemaType,\n title: '@sanity/preview-url-secret',\n readOnly: true,\n fields: [\n {\n type: 'string',\n name: 'secret',\n title: 'Secret',\n },\n {\n type: 'string',\n name: 'source',\n title: 'Source Tool',\n },\n {\n type: 'string',\n name: 'studioUrl',\n title: 'Studio URL',\n },\n {\n type: 'string',\n name: 'userId',\n title: 'Sanity User ID',\n },\n ],\n preview: {\n select: {\n source: 'source',\n studioUrl: 'studioUrl',\n updatedAt: '_updatedAt',\n },\n prepare(data) {\n const url = data.studioUrl ? new URL(data.studioUrl, location.origin) : undefined\n const updatedAt = new Date(data.updatedAt).getTime()\n const expiresAt = new Date(updatedAt + 1000 * SECRET_TTL)\n const expired = expiresAt < new Date()\n const icon = expired ? CloseCircleIcon : CheckmarkCircleIcon\n return {\n title: url ? `${url.host}${url.pathname}` : data.source,\n subtitle: expired\n ? 'Expired'\n : `Expires in ${Math.round((expiresAt.getTime() - Date.now()) / (1000 * 60))} minutes`,\n media: icon,\n }\n },\n },\n})\n\nexport const debugSecrets = definePlugin<void>(() => {\n return {\n name: 'sanity-plugin-debug-secrets',\n schema: {types: [schema]},\n document: {\n actions: (prev, context) => {\n if (context.schemaType !== schemaType) {\n return prev\n }\n return prev.filter(({action}) => action === 'delete')\n },\n inspectors: (prev, context) => {\n if (context.documentType !== schemaType) {\n return prev\n }\n return []\n },\n unstable_fieldActions: (prev, context) => {\n if (context.schemaType.name !== schemaType) {\n return prev\n }\n return []\n },\n },\n }\n})\n"],"names":[],"mappings":";;;AAIA,MAAM,SAAS,WAAW;AAAA,EACxB,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AA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,CAAA;AAAA,IAET,uBAAuB,CAAC,MAAM,YACxB,QAAQ,WAAW,SAAS,aACvB,OAEF,CAAA;AAAA,EAAC;AAGd,EACD;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sanity/debug-preview-url-secret-plugin",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"homepage": "https://github.com/sanity-io/plugins/tree/main/plugins/%40sanity/debug-preview-url-secret-plugin#readme",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/sanity-io/plugins/issues"
|
|
@@ -19,10 +19,7 @@
|
|
|
19
19
|
"author": "Sanity.io <hello@sanity.io>",
|
|
20
20
|
"type": "module",
|
|
21
21
|
"exports": {
|
|
22
|
-
".":
|
|
23
|
-
"source": "./src/index.ts",
|
|
24
|
-
"default": "./dist/index.js"
|
|
25
|
-
},
|
|
22
|
+
".": "./dist/index.js",
|
|
26
23
|
"./package.json": "./package.json"
|
|
27
24
|
},
|
|
28
25
|
"types": "./dist/index.d.ts",
|
|
@@ -35,13 +32,14 @@
|
|
|
35
32
|
"@sanity/preview-url-secret": "^3.0.0"
|
|
36
33
|
},
|
|
37
34
|
"devDependencies": {
|
|
38
|
-
"@sanity/pkg-utils": "^
|
|
39
|
-
"@types/react": "^19.2.
|
|
40
|
-
"@typescript/native-preview": "7.0.0-dev.
|
|
35
|
+
"@sanity/pkg-utils": "^10.0.0",
|
|
36
|
+
"@types/react": "^19.2.7",
|
|
37
|
+
"@typescript/native-preview": "7.0.0-dev.20251129.1",
|
|
41
38
|
"react": "^19.2.0",
|
|
42
|
-
"sanity": "^4.
|
|
39
|
+
"sanity": "^4.20.0",
|
|
43
40
|
"typescript": "5.9.3",
|
|
44
|
-
"@repo/package.config": "0.0.0"
|
|
41
|
+
"@repo/package.config": "0.0.0",
|
|
42
|
+
"@repo/tsconfig": "1.0.0"
|
|
45
43
|
},
|
|
46
44
|
"peerDependencies": {
|
|
47
45
|
"react": "^18.3 || ^19",
|
|
@@ -50,11 +48,8 @@
|
|
|
50
48
|
"engines": {
|
|
51
49
|
"node": ">=20.19 <22 || >=22.12"
|
|
52
50
|
},
|
|
53
|
-
"publishConfig": {
|
|
54
|
-
"access": "public"
|
|
55
|
-
},
|
|
56
51
|
"scripts": {
|
|
57
|
-
"
|
|
58
|
-
"
|
|
52
|
+
"build": "pkg build --strict --check --clean",
|
|
53
|
+
"typecheck": "(cd ../../.. && tsgo --project plugins/@sanity/debug-preview-url-secret-plugin/tsconfig.json)"
|
|
59
54
|
}
|
|
60
55
|
}
|