-
Notifications
You must be signed in to change notification settings - Fork 7
Add Sanity Plugin #71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
62f026e
Add a Sanity.io plugin
andrewmumblebee 5d1b417
index sanity datasets using dependent imports
andrewmumblebee f171092
Use scoped dataset datastreams
andrewmumblebee 73234fe
Add dataset stats dataStream
andrewmumblebee a2c35e7
Update Sanity data stream tags
andrewmumblebee cc6b60b
Sanity plugin cleanup
andrewmumblebee ee7c40a
Reduce dataStreams down to useful ones
andrewmumblebee 84b9f9a
Show recently updated documents in the GROQ tile
andrewmumblebee 5344250
Show dataset limit usage on the Dataset dashboard
andrewmumblebee a3c49a9
Add an Overview dashboard summarising the org
andrewmumblebee 8b341ad
Explain the missing token when content tiles fail
andrewmumblebee 775897c
Index only projects with a configured token
andrewmumblebee f3e34cd
Show every project's token status on the Overview
andrewmumblebee 5980e03
Keep description to one sentence
andrewmumblebee 9c165a0
update readme
andrewmumblebee 5b262e7
Escape project names in token error messages
andrewmumblebee 4e3f674
Derive dataset uid and displayName in the script
andrewmumblebee 1d60cc4
Parse project createdAt as a date
andrewmumblebee 1c79d86
Describe the document type counts query
andrewmumblebee 31d1a2d
Match dashboard timeframes to their tiles
andrewmumblebee b25f397
Give overview project tiles distinct titles
andrewmumblebee c1b60f1
Give each dashboard tile a unique GUID
andrewmumblebee 42a15a8
Document correct admin token creation steps
andrewmumblebee 0342043
Index members per project membership
andrewmumblebee f2fe474
Scope member roles to the imported project
andrewmumblebee 056f59e
Load error handling scripts from script files
andrewmumblebee 4745823
Remove error handling from Sanity
andrewmumblebee 36d980b
Remove users from Sanity index
andrewmumblebee c697725
Update readme to match skill template for Sanity
andrewmumblebee 5083023
Add sanity screenshots
andrewmumblebee 65c7956
Update Sanity metadata to remove members object type
andrewmumblebee 824e40d
update projects screenshot
andrewmumblebee File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| { | ||
| "steps": [ | ||
| { | ||
| "displayName": "Authenticate", | ||
| "dataStream": { | ||
| "name": "listProjects" | ||
| }, | ||
| "required": true, | ||
| "success": "Connected to the Sanity management API.", | ||
| "error": "Could not list projects. Check your Admin API token is valid and has access to your projects." | ||
| } | ||
| ] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| [ | ||
| { | ||
| "name": "Project", | ||
| "sourceType": "Project", | ||
| "icon": "layer-group", | ||
| "singular": "Project", | ||
| "plural": "Projects" | ||
| }, | ||
| { | ||
| "name": "Dataset", | ||
| "sourceType": "Dataset", | ||
| "icon": "layer-group", | ||
| "singular": "Dataset", | ||
| "plural": "Datasets" | ||
| } | ||
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| { | ||
| "name": "allProjects", | ||
| "displayName": "All Projects", | ||
| "description": "Every project the admin token can see, flagging which have a content API token configured", | ||
| "tags": ["Project"], | ||
| "baseDataSourceName": "httpRequestUnscoped", | ||
| "config": { | ||
| "httpMethod": "get", | ||
| "paging": { | ||
| "mode": "none" | ||
| }, | ||
| "expandInnerObjects": false, | ||
| "endpointPath": "projects", | ||
| "getArgs": [], | ||
| "headers": [], | ||
| "postRequestScript": "allProjects.js" | ||
| }, | ||
| "metadata": [ | ||
| { | ||
| "name": "displayName", | ||
| "shape": "string", | ||
| "displayName": "Name", | ||
| "role": "label" | ||
| }, | ||
| { | ||
| "name": "tokenStatus", | ||
| "displayName": "Token Status", | ||
| "shape": [ | ||
| "state", | ||
| { | ||
| "map": { | ||
| "success": ["configured"], | ||
| "error": ["missing"] | ||
| } | ||
| } | ||
| ] | ||
| }, | ||
| { | ||
| "name": "id", | ||
| "shape": "string", | ||
| "displayName": "Project ID" | ||
| } | ||
| ], | ||
| "timeframes": false | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| { | ||
| "name": "customQuery", | ||
| "displayName": "Custom GROQ Query", | ||
| "description": "Run an arbitrary GROQ query against a dataset", | ||
| "tags": ["Documents"], | ||
| "baseDataSourceName": "httpRequestScopedSingle", | ||
| "matches": { | ||
| "sourceType": { | ||
| "type": "equals", | ||
| "value": "Dataset" | ||
| } | ||
| }, | ||
| "providesPluginDiagnostics": true, | ||
| "config": { | ||
| "baseUrl": "https://{{object.projectId}}.api.sanity.io/{{dataSource.apiVersion}}/", | ||
| "httpMethod": "get", | ||
| "paging": { | ||
| "mode": "none" | ||
| }, | ||
| "expandInnerObjects": true, | ||
| "endpointPath": "data/query/{{object.datasetId}}", | ||
| "pathToData": "result", | ||
| "getArgs": [ | ||
| { | ||
| "key": "query", | ||
| "value": "{{query}}" | ||
| }, | ||
| { | ||
| "key": "perspective", | ||
| "value": "{{perspective}}" | ||
| } | ||
| ], | ||
| "headers": [ | ||
| { | ||
| "key": "Authorization", | ||
| "value": "Bearer {{ ((dataSource.projects || []).find(p => p.key === object.projectId) || {}).value }}" | ||
| } | ||
| ] | ||
| }, | ||
| "ui": [ | ||
| { | ||
| "type": "code", | ||
| "name": "query", | ||
| "language": "groq", | ||
| "label": "GROQ query", | ||
| "defaultValue": "*[ !(_id in path(\"_.**\")) ] | order(_updatedAt desc) [0...20] {_id, _type, _updatedAt}", | ||
| "validation": { "required": true }, | ||
| "help": "See [GROQ query cheat sheet](https://www.sanity.io/docs/content-lake/query-cheat-sheet) for patterns" | ||
| }, | ||
| { | ||
| "type": "switch", | ||
| "name": "perspective", | ||
| "label": "Perspective", | ||
| "defaultValue": "published", | ||
| "options": [ | ||
| { "value": "published", "label": "Published" }, | ||
| { "value": "drafts", "label": "Drafts" }, | ||
| { "value": "raw", "label": "Raw" } | ||
| ] | ||
| } | ||
| ], | ||
| "metadata": [{ "pattern": ".*" }], | ||
| "timeframes": false, | ||
| "manualConfigApply": true | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,93 @@ | ||
| { | ||
| "name": "datasetStats", | ||
| "displayName": "Dataset Stats", | ||
| "description": "Get stats on how close to usage limits this dataset is", | ||
| "tags": ["Analytics"], | ||
| "baseDataSourceName": "httpRequestScopedSingle", | ||
| "matches": { | ||
| "sourceType": { | ||
| "type": "equals", | ||
| "value": "Dataset" | ||
| } | ||
| }, | ||
| "config": { | ||
| "baseUrl": "https://{{object.projectId}}.api.sanity.io/v1/", | ||
| "httpMethod": "get", | ||
| "paging": { | ||
| "mode": "none" | ||
| }, | ||
| "endpointPath": "data/stats/{{object.datasetId}}", | ||
| "getArgs": [], | ||
| "headers": [ | ||
| { | ||
| "key": "Authorization", | ||
| "value": "Bearer {{ ((dataSource.projects || []).find(p => p.key === object.projectId) || {}).value }}" | ||
| } | ||
| ], | ||
| "expandInnerObjects": true, | ||
| "postRequestScript": "datasetStats.js" | ||
| }, | ||
| "metadata": [ | ||
| { | ||
| "name": "dataset", | ||
| "displayName": "Dataset", | ||
| "shape": "string", | ||
| "role": "label" | ||
| }, | ||
| { | ||
| "name": "documentsPctOfLimit", | ||
| "displayName": "Documents (% of limit)", | ||
| "shape": "percent", | ||
| "role": "value" | ||
| }, | ||
| { | ||
| "name": "fieldsPctOfLimit", | ||
| "displayName": "Fields (% of limit)", | ||
| "shape": "percent" | ||
| }, | ||
| { | ||
| "name": "jsonSizePctOfLimit", | ||
| "displayName": "JSON Size (% of limit)", | ||
| "shape": "percent" | ||
| }, | ||
| { | ||
| "name": "releasesPctOfLimit", | ||
| "displayName": "Releases (% of limit)", | ||
| "shape": "percent" | ||
| }, | ||
| { | ||
| "name": "documents.count.value", | ||
| "displayName": "Documents", | ||
| "shape": "number" | ||
| }, | ||
| { | ||
| "name": "documents.count.limit", | ||
| "displayName": "Document Limit", | ||
| "shape": "number" | ||
| }, | ||
| { | ||
| "name": "fields.count.value", | ||
| "displayName": "Fields", | ||
| "shape": "number" | ||
| }, | ||
| { | ||
| "name": "fields.count.limit", | ||
| "displayName": "Field Limit", | ||
| "shape": "number" | ||
| }, | ||
| { | ||
| "name": "documents.jsonSizeSum.value", | ||
| "displayName": "JSON Size", | ||
| "shape": "bytes" | ||
| }, | ||
| { | ||
| "name": "documents.jsonSizeSum.limit", | ||
| "displayName": "JSON Size Limit", | ||
| "shape": "bytes" | ||
| }, | ||
| { | ||
| "pattern": ".*" | ||
| } | ||
| ], | ||
| "timeframes": false | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| { | ||
| "name": "datasets", | ||
| "displayName": "Datasets", | ||
| "description": "Lists the datasets in a project, with their access-control mode", | ||
| "tags": ["Datasets"], | ||
| "baseDataSourceName": "httpRequestScopedSingle", | ||
| "matches": { | ||
| "sourceType": { | ||
| "type": "equals", | ||
| "value": "Project" | ||
| } | ||
| }, | ||
| "config": { | ||
| "httpMethod": "get", | ||
| "errorHandling": { | ||
| "type": "script", | ||
| "script": "errorHandling/datasets.js" | ||
| }, | ||
| "paging": { | ||
| "mode": "none" | ||
| }, | ||
| "expandInnerObjects": true, | ||
| "endpointPath": "projects/{{object.rawId}}/datasets", | ||
| "getArgs": [], | ||
| "postRequestScript": "datasets.js", | ||
| "headers": [ | ||
| { | ||
| "key": "Authorization", | ||
| "value": "Bearer {{ ((dataSource.projects || []).find(p => p.key === object.rawId) || {}).value }}" | ||
| } | ||
| ] | ||
| }, | ||
| "metadata": [ | ||
| { | ||
| "name": "projectId", | ||
| "displayName": "Project ID", | ||
| "shape": "string", | ||
| "visible": false | ||
| }, | ||
| { | ||
| "name": "datasetId", | ||
| "shape": "string", | ||
| "displayName": "Dataset", | ||
| "role": "label" | ||
| }, | ||
| { | ||
| "name": "aclMode", | ||
| "shape": "string", | ||
| "displayName": "Access mode" | ||
| }, | ||
| { | ||
| "name": "createdAt", | ||
| "shape": "date", | ||
| "displayName": "Created At" | ||
| }, | ||
| { | ||
| "name": "createdByUserId", | ||
| "shape": "string", | ||
| "displayName": "Created By User Id" | ||
| }, | ||
| { | ||
| "name": "projectName", | ||
| "displayName": "Project Name", | ||
| "shape": "string" | ||
| }, | ||
| { | ||
| "name": "uid", | ||
| "displayName": "uid", | ||
| "shape": "string", | ||
| "visible": false | ||
| }, | ||
| { | ||
| "name": "displayName", | ||
| "displayName": "Display Name", | ||
| "shape": "string", | ||
| "visible": false | ||
|
andrewmumblebee marked this conversation as resolved.
|
||
| } | ||
| ], | ||
| "timeframes": false | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| { | ||
| "name": "listProjects", | ||
| "displayName": "Projects", | ||
| "description": "Lists the projects that have a content API token configured", | ||
| "tags": ["Project"], | ||
| "baseDataSourceName": "httpRequestUnscoped", | ||
| "config": { | ||
| "httpMethod": "get", | ||
| "paging": { | ||
| "mode": "none" | ||
| }, | ||
| "expandInnerObjects": false, | ||
| "endpointPath": "projects", | ||
| "getArgs": [], | ||
| "headers": [], | ||
| "postRequestScript": "listProjects.js" | ||
| }, | ||
| "metadata": [ | ||
| { | ||
| "name": "id", | ||
| "shape": "string", | ||
| "displayName": "Project ID" | ||
| }, | ||
| { | ||
| "name": "displayName", | ||
| "shape": "string", | ||
| "displayName": "Name" | ||
| }, | ||
| { | ||
| "name": "organizationId", | ||
| "shape": "string", | ||
| "displayName": "Organization ID" | ||
| }, | ||
| { | ||
| "name": "studioHost", | ||
| "shape": "string", | ||
| "displayName": "Studio host" | ||
| }, | ||
| { | ||
| "name": "createdAt", | ||
| "shape": "date", | ||
| "displayName": "Created" | ||
|
andrewmumblebee marked this conversation as resolved.
|
||
| }, | ||
| { | ||
| "pattern": ".*" | ||
| } | ||
| ], | ||
| "timeframes": false, | ||
| "visibility": { | ||
| "type": "hidden" | ||
| } | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.