sanity-plugin-workflow 1.0.6 → 2.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.
Files changed (52) hide show
  1. package/README.md +2 -17
  2. package/dist/index.d.ts +17 -0
  3. package/dist/index.d.ts.map +1 -0
  4. package/dist/index.js +1647 -0
  5. package/dist/index.js.map +1 -0
  6. package/package.json +32 -71
  7. package/lib/index.d.ts +0 -20
  8. package/lib/index.esm.js +0 -2135
  9. package/lib/index.esm.js.map +0 -1
  10. package/lib/index.js +0 -2147
  11. package/lib/index.js.map +0 -1
  12. package/sanity.json +0 -8
  13. package/src/actions/AssignWorkflow.tsx +0 -47
  14. package/src/actions/BeginWorkflow.tsx +0 -63
  15. package/src/actions/CompleteWorkflow.tsx +0 -64
  16. package/src/actions/UpdateWorkflow.tsx +0 -126
  17. package/src/badges/AssigneesBadge.tsx +0 -53
  18. package/src/badges/StateBadge.tsx +0 -28
  19. package/src/components/DocumentCard/AvatarGroup.tsx +0 -43
  20. package/src/components/DocumentCard/CompleteButton.tsx +0 -56
  21. package/src/components/DocumentCard/EditButton.tsx +0 -28
  22. package/src/components/DocumentCard/Field.tsx +0 -38
  23. package/src/components/DocumentCard/Validate.tsx +0 -21
  24. package/src/components/DocumentCard/ValidationStatus.tsx +0 -37
  25. package/src/components/DocumentCard/core/DraftStatus.tsx +0 -32
  26. package/src/components/DocumentCard/core/PublishedStatus.tsx +0 -39
  27. package/src/components/DocumentCard/core/TimeAgo.tsx +0 -11
  28. package/src/components/DocumentCard/index.tsx +0 -200
  29. package/src/components/DocumentList.tsx +0 -169
  30. package/src/components/Filters.tsx +0 -174
  31. package/src/components/FloatingCard.tsx +0 -36
  32. package/src/components/StateTitle/Status.tsx +0 -27
  33. package/src/components/StateTitle/index.tsx +0 -78
  34. package/src/components/UserAssignment.tsx +0 -121
  35. package/src/components/UserAssignmentInput.tsx +0 -27
  36. package/src/components/UserDisplay.tsx +0 -57
  37. package/src/components/Verify.tsx +0 -297
  38. package/src/components/WorkflowContext.tsx +0 -71
  39. package/src/components/WorkflowSignal.tsx +0 -30
  40. package/src/components/WorkflowTool.tsx +0 -437
  41. package/src/constants/index.ts +0 -31
  42. package/src/helpers/arraysContainMatchingString.ts +0 -6
  43. package/src/helpers/filterItemsAndSort.ts +0 -41
  44. package/src/helpers/generateMultipleOrderRanks.ts +0 -80
  45. package/src/helpers/initialRank.ts +0 -13
  46. package/src/hooks/useWorkflowDocuments.tsx +0 -167
  47. package/src/hooks/useWorkflowMetadata.tsx +0 -49
  48. package/src/index.ts +0 -97
  49. package/src/schema/workflow/workflow.metadata.ts +0 -68
  50. package/src/tools/index.ts +0 -15
  51. package/src/types/index.ts +0 -71
  52. package/v2-incompatible.js +0 -11
package/README.md CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  With Sanity Studio you can [customize your content tools to support arbitrary workflows like assignment and content pipelines](https://www.sanity.io/docs/custom-workflows).
4
4
 
5
- This plugin is distributed as an **example implementation** of customization APIs in the Sanity Studio V3 and is not considered to be a feature-complete implementation of what workflow management requires in production. It is meant as a starting point intended to be forked and customized to the needs of your organization and content creators, or simply as an illustration of what is possible in Sanity Studio V3.
5
+ This plugin is distributed as an **example implementation** of customization APIs in the Sanity Studio and is not considered to be a feature-complete implementation of what workflow management requires in production. It is meant as a starting point intended to be forked and customized to the needs of your organization and content creators, or simply as an illustration of what is possible in Sanity Studio.
6
6
 
7
7
  An intentional design choice of this plugin is that it **does not influence or modify whether a document is in draft or published**. It only tracks the values of a separate "metadata" document. In this implementation, an "Approved" document could be a draft but will still need publishing. "Approving" the document deletes the "metadata" and so removes it from the "Workflow" process. You choose if Publishing the document happens in the Studio like normal, using the [Scheduled Publishing plugin](https://www.sanity.io/plugins/scheduled-publishing) or the [Scheduling API](https://www.sanity.io/docs/scheduling-api#fa3bb95f83ed).
8
8
 
9
- This plugin is considered finished in its current form. Your feedback for workflow features you would like to see in Sanity Studio would be appreciated and can be [shared in our Slack community](https://slack.sanity.io/).
9
+ This plugin is considered finished in its current form. Your feedback for workflow features you would like to see in Sanity Studio would be appreciated and can be [shared in the Sanity Community Discord](https://snty.link/community).
10
10
 
11
11
  ![Screenshot 2023-03-21 at 12 11 24](https://user-images.githubusercontent.com/9684022/226602179-5bd3d91a-9c27-431e-be18-3c70f06c6ccb.png)
12
12
 
@@ -107,18 +107,3 @@ This plugin is largely based on the original Workflow Demo built into a Sanity S
107
107
  ## License
108
108
 
109
109
  [MIT](LICENSE) © Sanity.io
110
-
111
- ## Develop & test
112
-
113
- This plugin uses [@sanity/plugin-kit](https://github.com/sanity-io/plugin-kit)
114
- with default configuration for build & watch scripts.
115
-
116
- See [Testing a plugin in Sanity Studio](https://github.com/sanity-io/plugin-kit#testing-a-plugin-in-sanity-studio)
117
- on how to run this plugin with hot reload in the studio.
118
-
119
- ### Release new version
120
-
121
- Run ["CI & Release" workflow](https://github.com/sanity-io/sanity-plugin-workflow/actions/workflows/main.yml).
122
- Make sure to select the main branch and check "Release new version".
123
-
124
- Semantic release will only release on configured branches, so it is safe to run the release on any branch.
@@ -0,0 +1,17 @@
1
+ import { Plugin } from "sanity";
2
+ type State = {
3
+ id: string;
4
+ transitions: string[];
5
+ title: string;
6
+ roles?: string[];
7
+ requireAssignment?: boolean;
8
+ requireValidation?: boolean;
9
+ color?: 'primary' | 'success' | 'warning' | 'danger';
10
+ };
11
+ type WorkflowConfig = {
12
+ schemaTypes: string[];
13
+ states?: State[];
14
+ };
15
+ declare const workflow: Plugin<WorkflowConfig>;
16
+ export { workflow };
17
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","names":["SanityDocumentLike","State","StateCheck","Id","States","Id2","WorkflowConfig","defineStates","User","DragData","Metadata","KeyedMetadata","SanityDocumentWithMetadata","Plugin","WorkflowConfig","workflow"],"sources":["../src/types/index.d.ts","../src/index.d.ts"],"sourcesContent":["import type { SanityDocumentLike } from 'sanity';\nexport type State = {\n id: string;\n transitions: string[];\n title: string;\n roles?: string[];\n requireAssignment?: boolean;\n requireValidation?: boolean;\n color?: 'primary' | 'success' | 'warning' | 'danger';\n};\nexport type StateCheck<Id, States> = {\n id: Id;\n transitions?: States extends {\n id: infer Id2;\n }[] ? Id2[] : never;\n} & State;\nexport type WorkflowConfig = {\n schemaTypes: string[];\n states?: State[];\n};\nexport declare function defineStates<Id extends string, States extends StateCheck<Id, States>[]>(states: States): States;\nexport type User = {\n createdAt: string;\n displayName: string;\n email: string;\n familyName: string;\n givenName: string;\n id: string;\n imageUrl: string;\n isCurrentUser: boolean;\n middleName: string;\n projectId: string;\n provider: string;\n sanityUserId: string;\n updatedAt: string;\n};\nexport type DragData = {\n documentId?: string;\n x?: number;\n y?: number;\n state?: string;\n};\nexport type Metadata = SanityDocumentLike & {\n _rev: string;\n assignees: string[];\n documentId: string;\n state: string;\n orderRank: string;\n};\nexport type KeyedMetadata = {\n [key: string]: Metadata;\n};\nexport type SanityDocumentWithMetadata = {\n _metadata: Metadata;\n _id: string;\n _type: string;\n _rev: string;\n _updatedAt: string;\n};\n//# sourceMappingURL=index.d.ts.map","import { type Plugin } from 'sanity';\nimport type { WorkflowConfig } from './types';\nexport declare const workflow: Plugin<WorkflowConfig>;\n//# sourceMappingURL=index.d.ts.map"],"mappings":";KACYC,KAAAA;EAAAA,EAAAA,EAAAA,MAAK;EAeLK,WAAAA,EAAAA,MAAc,EAAA;;ECdLS,KAAAA,CAAAA,EAAAA,MAAgC,EAAA;;;;;KDczCT,cAAAA;;WAECL;;AAjBDA,cCCSc,QDDJ,ECCcF,MDDd,CCCqBC,cDDrB,CAAA"}