@platecms/delta-client 0.13.0 → 1.2.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.
Files changed (41) hide show
  1. package/package.json +5 -3
  2. package/src/__generated__/gql.ts +93 -3
  3. package/src/__generated__/graphql.ts +679 -82
  4. package/src/api/fetchContentExperiences.spec.ts +82 -0
  5. package/src/api/fetchContentExperiences.ts +42 -0
  6. package/src/api/fetchContentItems.spec.ts +62 -0
  7. package/src/api/fetchContentItems.ts +42 -0
  8. package/src/api/fetchPathParts.spec.ts +62 -0
  9. package/src/api/fetchPathParts.ts +42 -0
  10. package/src/api/fetchTags.spec.ts +61 -0
  11. package/src/api/fetchTags.ts +38 -0
  12. package/src/api/index.ts +4 -1
  13. package/src/api/types.ts +35 -0
  14. package/src/apollo/index.ts +1 -1
  15. package/src/app/utils/paginated-response.type.ts +19 -0
  16. package/src/factories/BaseFactory.ts +19 -0
  17. package/src/factories/ChannelFactory.ts +19 -0
  18. package/src/factories/ContentExperienceFactory.ts +54 -0
  19. package/src/factories/PathPartFactory.ts +26 -0
  20. package/src/factories/TagFactory.ts +30 -0
  21. package/src/graphql/content-experiences/content-experiences.query.gql +82 -0
  22. package/src/graphql/content-items/content-items.query.gql +47 -0
  23. package/src/graphql/fragments/asset.fragment.gql +10 -0
  24. package/src/graphql/fragments/asset.fragments.gql +10 -0
  25. package/src/graphql/fragments/building-block-field-fullfillment.fragments.gql +45 -0
  26. package/src/graphql/fragments/building-block-field.fragments.gql +8 -0
  27. package/src/graphql/fragments/building-block.fragments.gql +11 -0
  28. package/src/graphql/fragments/content-experience.fragments.gql +8 -0
  29. package/src/graphql/fragments/content-field.fragments.gql +7 -0
  30. package/src/graphql/fragments/content-item.fragments.gql +11 -0
  31. package/src/graphql/fragments/content-type.fragments.gql +11 -0
  32. package/src/graphql/fragments/content-values.fragments.gql +33 -0
  33. package/src/graphql/fragments/experience-component.fragments.gql +13 -0
  34. package/src/graphql/fragments/grid-placement.fragments.gql +7 -0
  35. package/src/graphql/fragments/path-part.fragments.gql +8 -0
  36. package/src/graphql/fragments/tag.fragment.gql +17 -0
  37. package/src/graphql/path-parts/path-parts.query.gql +52 -0
  38. package/src/graphql/tags/tag.query.gql +15 -3
  39. package/src/index.ts +1 -1
  40. package/src/slate/index.ts +21 -3
  41. package/src/utils/index.ts +8 -0
@@ -0,0 +1,82 @@
1
+ query contentExperiences(
2
+ $paginate: PaginationOptionsInput!
3
+ $where: [ContentExperiencesFilterInput!]
4
+ $orderBy: OrderOptionsInput
5
+ $optionsList: [ProcessedAssetOptionsInput!]!
6
+ ) {
7
+ contentExperiences(paginate: $paginate, where: $where, orderBy: $orderBy) {
8
+ pageInfo {
9
+ endCursor
10
+ hasNextPage
11
+ hasPreviousPage
12
+ startCursor
13
+ }
14
+ totalCount
15
+ edges {
16
+ cursor
17
+ node {
18
+ ...contentExperienceFragment
19
+ preview {
20
+ ...assetFragment
21
+ processedUrls(optionsList: $optionsList)
22
+ }
23
+ pathPart {
24
+ ...pathPartFragment
25
+ }
26
+ experienceComponent {
27
+ ...experienceComponentFragment
28
+ buildingBlock {
29
+ ...buildingBlockFragment
30
+ }
31
+ buildingBlockFieldFulfillments {
32
+ ...buildingBlockFieldFulfillmentFragment
33
+ buildingBlockField {
34
+ ...buildingBlockFieldFragment
35
+ }
36
+ contentValue {
37
+ ...comprehensiveContentValueFragment
38
+ contentItem {
39
+ prn
40
+ }
41
+ relatedAsset {
42
+ ...assetFragment
43
+ processedUrls(optionsList: $optionsList)
44
+ }
45
+ linkedGridPlacement {
46
+ ...gridPlacementFragment
47
+ experienceComponent {
48
+ ...experienceComponentFragment
49
+ buildingBlock {
50
+ ...buildingBlockFragment
51
+ }
52
+ }
53
+ }
54
+ relatedContentItem {
55
+ ...contentItemFragment
56
+ contentType {
57
+ ...contentTypeFragment
58
+ contentFields {
59
+ ...contentFieldFragment
60
+ }
61
+ }
62
+ contentValues {
63
+ ...comprehensiveContentValueFragment
64
+ contentField {
65
+ ...contentFieldFragment
66
+ }
67
+ relatedAsset {
68
+ ...assetFragment
69
+ processedUrls(optionsList: $optionsList)
70
+ }
71
+ }
72
+ }
73
+ }
74
+ }
75
+ }
76
+ tags {
77
+ ...tagFragment
78
+ }
79
+ }
80
+ }
81
+ }
82
+ }
@@ -0,0 +1,47 @@
1
+ query contentItems(
2
+ $paginate: PaginationOptionsInput!
3
+ $where: [ContentItemsFilterInput!]
4
+ $orderBy: OrderOptionsInput
5
+ $optionsList: [ProcessedAssetOptionsInput!]!
6
+ ) {
7
+ contentItems(paginate: $paginate, where: $where, orderBy: $orderBy) {
8
+ pageInfo {
9
+ endCursor
10
+ hasNextPage
11
+ hasPreviousPage
12
+ startCursor
13
+ }
14
+ totalCount
15
+ edges {
16
+ cursor
17
+ node {
18
+ ...contentItemFragment
19
+ contentValues {
20
+ ...contentValueFragment
21
+ contentField {
22
+ ...contentFieldFragment
23
+ }
24
+ relatedAsset {
25
+ ...assetFragment
26
+ processedUrls(optionsList: $optionsList)
27
+ }
28
+ relatedContentItem {
29
+ ...contentItemFragment
30
+ contentValues {
31
+ ...contentValueFragment
32
+ }
33
+ }
34
+ }
35
+ contentType {
36
+ ...contentTypeFragment
37
+ contentFields {
38
+ ...contentFieldFragment
39
+ }
40
+ }
41
+ tags {
42
+ ...tagFragment
43
+ }
44
+ }
45
+ }
46
+ }
47
+ }
@@ -0,0 +1,10 @@
1
+ fragment assetFragment on Asset {
2
+ _id: prn
3
+ prn
4
+ fileName
5
+ fileSize
6
+ mimeType
7
+ url
8
+ createdAt
9
+ updatedAt
10
+ }
@@ -0,0 +1,10 @@
1
+ fragment assetFragment on Asset {
2
+ _id: prn
3
+ prn
4
+ fileName
5
+ fileSize
6
+ mimeType
7
+ url
8
+ createdAt
9
+ updatedAt
10
+ }
@@ -0,0 +1,45 @@
1
+ fragment buildingBlockFieldFulfillmentFragment on BuildingBlockFieldFulfillment {
2
+ _id: prn
3
+ prn
4
+ contentValue {
5
+ ...contentValueFragment
6
+ contentItem {
7
+ prn
8
+ }
9
+ relatedAsset {
10
+ ...assetFragment
11
+ }
12
+ linkedPathPart {
13
+ ...pathPartFragment
14
+ }
15
+ linkedGridPlacement {
16
+ ...gridPlacementFragment
17
+ experienceComponent {
18
+ ...experienceComponentFragment
19
+ buildingBlock {
20
+ ...buildingBlockFragment
21
+ }
22
+ }
23
+ }
24
+ relatedContentItem {
25
+ ...contentItemFragment
26
+ contentType {
27
+ ...contentTypeFragment
28
+ contentFields {
29
+ ...contentFieldFragment
30
+ }
31
+ }
32
+ contentValues {
33
+ ...contentValueFragment
34
+ contentField {
35
+ ...contentFieldFragment
36
+ }
37
+ relatedAsset {
38
+ ...assetFragment
39
+ }
40
+ }
41
+ }
42
+ }
43
+ createdAt
44
+ updatedAt
45
+ }
@@ -0,0 +1,8 @@
1
+ fragment buildingBlockFieldFragment on BuildingBlockField {
2
+ _id: prn
3
+ prn
4
+ slug
5
+ title
6
+ createdAt
7
+ updatedAt
8
+ }
@@ -0,0 +1,11 @@
1
+ fragment buildingBlockFragment on BuildingBlock {
2
+ _id: prn
3
+ prn
4
+ slug
5
+ title
6
+ preview {
7
+ ...assetFragment
8
+ }
9
+ createdAt
10
+ updatedAt
11
+ }
@@ -0,0 +1,8 @@
1
+ fragment contentExperienceFragment on ContentExperience {
2
+ _id: prn
3
+ slug
4
+ prn
5
+ title
6
+ createdAt
7
+ updatedAt
8
+ }
@@ -0,0 +1,7 @@
1
+ fragment contentFieldFragment on ContentField {
2
+ _id: prn
3
+ prn
4
+ name
5
+ createdAt
6
+ updatedAt
7
+ }
@@ -0,0 +1,11 @@
1
+ fragment contentItemFragment on ContentItem {
2
+ _id: prn
3
+ prn
4
+ isDraft
5
+ displayName
6
+ displayImage {
7
+ ...assetFragment
8
+ }
9
+ updatedAt
10
+ createdAt
11
+ }
@@ -0,0 +1,11 @@
1
+ fragment contentTypeFragment on ContentType {
2
+ _id: prn
3
+ prn
4
+ name
5
+ displayNameTemplate
6
+ displayImageField {
7
+ ...contentFieldFragment
8
+ }
9
+ createdAt
10
+ updatedAt
11
+ }
@@ -0,0 +1,33 @@
1
+ fragment contentValueFragment on ContentValue {
2
+ _id: prn
3
+ prn
4
+ primitiveValue
5
+ interpolatedSmartText
6
+ createdAt
7
+ updatedAt
8
+ }
9
+
10
+ fragment comprehensiveContentValueFragment on ContentValue {
11
+ ...contentValueFragment
12
+ contentField {
13
+ ...contentFieldFragment
14
+ }
15
+ relatedAsset {
16
+ ...assetFragment
17
+ }
18
+ linkedPathPart {
19
+ ...pathPartFragment
20
+ }
21
+ linkedGridPlacement {
22
+ ...gridPlacementFragment
23
+ }
24
+ linkedContentType {
25
+ ...contentTypeFragment
26
+ }
27
+ linkedTag {
28
+ ...tagFragment
29
+ }
30
+ relatedContentItem {
31
+ ...contentItemFragment
32
+ }
33
+ }
@@ -0,0 +1,13 @@
1
+ fragment experienceComponentFragment on ExperienceComponent {
2
+ _id: prn
3
+ prn
4
+ stage
5
+ name
6
+ isDraft
7
+ preview {
8
+ ...assetFragment
9
+ }
10
+ isGlobal
11
+ createdAt
12
+ updatedAt
13
+ }
@@ -0,0 +1,7 @@
1
+ fragment gridPlacementFragment on GridPlacement {
2
+ _id: prn
3
+ prn,
4
+ row
5
+ updatedAt
6
+ createdAt
7
+ }
@@ -0,0 +1,8 @@
1
+ fragment pathPartFragment on PathPart {
2
+ _id: prn
3
+ prn
4
+ slug
5
+ path
6
+ createdAt
7
+ updatedAt
8
+ }
@@ -0,0 +1,17 @@
1
+ fragment tagFragment on Tag {
2
+ _id: prn
3
+ prn
4
+ name
5
+ path
6
+ color
7
+ visibility
8
+ forceVisibilityOnDescendants
9
+ stage
10
+ amountOfChildren
11
+ amountOfContentExperiences
12
+ amountOfContentItems
13
+ hasForcedVisibility
14
+ nestingLevel
15
+ createdAt
16
+ updatedAt
17
+ }
@@ -0,0 +1,52 @@
1
+ query pathParts(
2
+ $paginate: PaginationOptionsInput!
3
+ $where: [PathPartsFilterInput!]
4
+ $orderBy: OrderOptionsInput
5
+ $optionsList: [ProcessedAssetOptionsInput!]!
6
+ ) {
7
+ pathParts(paginate: $paginate, where: $where, orderBy: $orderBy) {
8
+ pageInfo {
9
+ endCursor
10
+ hasNextPage
11
+ hasPreviousPage
12
+ startCursor
13
+ }
14
+ totalCount
15
+ edges {
16
+ cursor
17
+ node {
18
+ ...pathPartFragment
19
+ contentExperience {
20
+ ...contentExperienceFragment
21
+ preview {
22
+ ...assetFragment
23
+ processedUrls(optionsList: $optionsList)
24
+ }
25
+ experienceComponent {
26
+ ...experienceComponentFragment
27
+ buildingBlock {
28
+ ...buildingBlockFragment
29
+ }
30
+ buildingBlockFieldFulfillments {
31
+ buildingBlockField {
32
+ ...buildingBlockFieldFragment
33
+ }
34
+ contentValue {
35
+ ...contentValueFragment
36
+ contentItem {
37
+ prn
38
+ }
39
+ relatedAsset {
40
+ ...assetFragment
41
+ }
42
+ }
43
+ }
44
+ }
45
+ }
46
+ children {
47
+ ...pathPartFragment
48
+ }
49
+ }
50
+ }
51
+ }
52
+ }
@@ -1,5 +1,17 @@
1
- query tag($prn: [PRN!]!) {
2
- tag(prn: $prn) {
3
- ...tagFragment
1
+ query tags($paginate: PaginationOptionsInput!, $where: [TagsFilterInput!], $orderBy: OrderOptionsInput) {
2
+ tags(paginate: $paginate, where: $where, orderBy: $orderBy) {
3
+ pageInfo {
4
+ endCursor
5
+ hasNextPage
6
+ hasPreviousPage
7
+ startCursor
8
+ }
9
+ totalCount
10
+ edges {
11
+ cursor
12
+ node {
13
+ ...tagFragment
14
+ }
15
+ }
4
16
  }
5
17
  }
package/src/index.ts CHANGED
@@ -1 +1 @@
1
- export {};
1
+ export * from "./api";
@@ -1,6 +1,6 @@
1
1
  import { BaseEditor } from "slate";
2
2
  import { ReactEditor } from "slate-react";
3
- import { Root } from "@platecms/delta-cast";
3
+ import { Content, Root } from "@platecms/delta-cast";
4
4
 
5
5
  declare module "slate" {
6
6
  interface CustomTypes {
@@ -21,11 +21,13 @@ export type DeltaElement =
21
21
  | BlockquoteElement
22
22
  | CodeElement
23
23
  | ContentValueElement
24
+ | ContentValueSuggestionElement
24
25
  | HeadingElement
25
26
  | LinkElement
26
27
  | ListElement
27
28
  | ListItemElement
28
- | ParagraphElement;
29
+ | ParagraphElement
30
+ | Suggestion;
29
31
 
30
32
  export type DeltaLeaf = DeltaLeafMarkdown & {
31
33
  text: string;
@@ -39,7 +41,7 @@ export type DeltaLeaf = DeltaLeafMarkdown & {
39
41
 
40
42
  export interface ParagraphElement {
41
43
  type: "paragraph";
42
- children: (ContentValueElement | DeltaLeaf | LinkElement)[];
44
+ children: (ContentValueElement | ContentValueSuggestionElement | DeltaLeaf | LinkElement | Suggestion)[];
43
45
  }
44
46
  export interface HeadingElement {
45
47
  type: "heading";
@@ -70,6 +72,13 @@ export interface ContentValueElement {
70
72
  children: DeltaLeaf[];
71
73
  }
72
74
 
75
+ export interface ContentValueSuggestionElement {
76
+ type: "contentValueSuggestion";
77
+ prn: string;
78
+ root: Root | undefined;
79
+ children: DeltaLeaf[];
80
+ }
81
+
73
82
  export interface LinkElement {
74
83
  type: "link";
75
84
  url: string;
@@ -82,3 +91,12 @@ export interface LinkElement {
82
91
  anchor?: boolean;
83
92
  };
84
93
  }
94
+
95
+ export interface Suggestion {
96
+ type: "suggestion";
97
+ suggested: Content[];
98
+ original: Content[];
99
+ message: string;
100
+ method: string;
101
+ children: DeltaLeaf[];
102
+ }
@@ -1,3 +1,5 @@
1
+ import { Mode } from "../api/types";
2
+
1
3
  export * from "./lib/connectors/WindowConnector";
2
4
  export * from "./lib/events/ConnectorEvents";
3
5
 
@@ -5,3 +7,9 @@ export type Draft<T> = T & {
5
7
  isDraft: boolean;
6
8
  uuid: string;
7
9
  };
10
+
11
+ export const API_VERSION = "v0";
12
+
13
+ export function apiBaseUrl(mode: Mode): string {
14
+ return `https://api.delta-${mode}.getplate.rocks`;
15
+ }