@remkoj/optimizely-graph-functions 2.0.3 → 2.1.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 CHANGED
@@ -1,99 +1,137 @@
1
- # Optimizely GraphQL Codegen Plugin
2
- GraphQL Codegen plugin and preset which generate both the GraphQL type definitions and a few convenienece methods for useage with [Optimizely Graph Client](../optimizely-graph-client/README.md).
3
-
4
- ## Install package
5
- This package is provided as part of the example site mono-repository and thus doesn't need to be installed separately.
6
-
7
- ## Configure package
8
- Create a codegen.ts within your application root folder (e.g. apps/frontend/codegen.ts within the example site). Within the codegen.ts create the following configuration:
9
-
10
- ```typescript
11
- import type { CodegenConfig } from '@graphql-codegen/cli'
12
- import getSchemaInfo from '@remkoj/optimizely-graph-client/codegen'
13
- import OptimizelyGraphPreset, {type PresetOptions as OptimizelyGraphPresetOptions} from '@remkoj/optimizely-graph-functions/preset'
14
-
15
- // This example assumes the configuration can be read from the environment variables, make sure .env files (if you use them) are processed prior to invoking getSchemaInfo()
16
-
17
- // Create the configuration itself
18
- const config: CodegenConfig = {
19
- schema: getSchemaInfo(),
20
- documents: [
21
- // Add local GQL files
22
- 'src/**/*.graphql',
23
-
24
- // Add Definitions from components
25
- 'src/**/!(*.d).{ts,tsx}'
26
- ],
27
- generates: {
28
- './gql/': {
29
- preset: OptimizelyGraphPreset,
30
- presetConfig: {
31
- gqlTagName: 'gql',
32
- injections: [
33
- {
34
- // Add from all pages, except colocated blocks
35
- into: "PageData",
36
- pathRegex: "src\/components\/page.*(?<!block\.tsx)$"
37
- },
38
- {
39
- // Add from all blocks, included blocks colocated with pages
40
- into: "BlockData",
41
- pathRegex: "src\/components\/(block.*|page.*block.[tj]s[x]{0,1})$"
42
- },
43
- {
44
- // Add from all blocks
45
- into: "BlockData",
46
- pathRegex: "src\/components\/block"
47
- }
48
- ],
49
- } as OptimizelyGraphPresetOptions
50
- }
51
- },
52
- ignoreNoDocuments: false
53
- }
54
-
55
- export default config
56
- ```
57
-
58
- ## Usage
59
- After running the code generation, you can use the following API's (assuming the folder where the generated files are stored is available at '@gql'):
60
-
61
- ### Option 1: Direct methods
62
- ```typescript
63
- import { getContentById, getContentByPath } from '@gql'
64
-
65
- const client = /* fetch your client */
66
-
67
- const contentFromId = await getContentById(client, { guidValue: '00000000-0000-0000-0000-000000000000', locale: 'en' })
68
- const contentFromPath = await getContentByPath(client, { path: '/en' })
69
- ```
70
-
71
- ### Option 2: Enhanced Client
72
- ```typescript
73
- import { OptimizelyGraphClient, Schema } from '@gql'
74
-
75
- const client = new OptimizelyGraphClient({
76
- single_key: "your single key here"
77
- })
78
- const contentId = '00000000-0000-0000-0000-000000000000'
79
- const locale = Schema.Locales.En
80
-
81
- const contentItem = await client.getContentById({ guidValue: contentId, locale })
82
- ```
83
-
84
- ## Query Fragments
85
- The preset automatically injects the following fragments into your list of documents when generating the code. This allows optimization of the generated query size and normalize output so it can be used by the `CmsContent` and `CmsContentArea` components (Which are available in the `@remkoj/optimizely-dxp-react` package).
86
-
87
- The following GraphQL Fragments are available:
88
-
89
- | Name | Description |
90
- | --- | --- |
91
- | ContentLink | Get the fields needed from a ContentLink field, so it can be used to look up content |
92
- | ContentLinkSearch | Get the fields needed from a ContentLink field, so it can be used to look up content, within a searchable context |
93
- | IContentData | The fields on an IContent item needed by the `CmsContent` component to reliably determine the content type and load it's data
94
- | ContentAreaItemData | Retrieve the items within a *searchable* ContentArea on a **Page** component, so that the content can be rendered by the `CmsContentArea` component
95
- | BlockContentAreaItemData | Retrieve the items within a *non-searchable* ContentArea on a **Block** component, so that the content can be rendered by the `CmsContentArea` component |
96
- | BlockContentAreaItemSearchData | Retrieve the items within a *searchable* ContentArea on a **Block** component, so that the content can be rendered by the `CmsContentArea` component |
97
- | LinkItemData | |
98
- | ImageData | |
99
- | ImageDataSearch | |
1
+ # Optimizely GraphQL Codegen Plugin
2
+ GraphQL Codegen plugin and preset which generate both the GraphQL type definitions and a few convenienece methods for useage with [Optimizely Graph Client](../optimizely-graph-client/README.md).
3
+
4
+ ## Install package
5
+ To install using Yarn, use the following command:
6
+
7
+ ```bash
8
+ yarn add --dev @remkoj/optimizely-graph-functions
9
+ ```
10
+
11
+ ## Configure package
12
+ Create a codegen.ts within your application root folder (e.g. apps/frontend/codegen.ts within the example site). Within the codegen.ts create the following configuration:
13
+
14
+ ```typescript
15
+ import type { CodegenConfig } from '@graphql-codegen/cli'
16
+ import getSchemaInfo from '@remkoj/optimizely-graph-client/codegen'
17
+ import OptimizelyGraphPreset, {type PresetOptions as OptimizelyGraphPresetOptions} from '@remkoj/optimizely-graph-functions/preset'
18
+
19
+ // This example assumes the configuration can be read from the environment variables, make sure .env files (if you use them) are processed prior to invoking getSchemaInfo()
20
+
21
+ // Create the configuration itself
22
+ const config: CodegenConfig = {
23
+ schema: getSchemaInfo(),
24
+ documents: [
25
+ // Add local GQL files
26
+ 'src/**/*.graphql',
27
+
28
+ // Add Definitions from components
29
+ 'src/**/!(*.d).{ts,tsx}'
30
+ ],
31
+ generates: {
32
+ './src/gql/': {
33
+ preset: OptimizelyGraphPreset,
34
+ presetConfig: {
35
+ // By default the preset will not support recursive queries,
36
+ // however if your content model requires it, you can enable
37
+ // it here.
38
+ //
39
+ // When setting recursion to `true` it requires additional
40
+ // steps to work
41
+ recursion: false,
42
+
43
+ // The GQL tag to be used to identify inline GraphQL queries
44
+ gqlTagName: 'gql',
45
+
46
+ // Configure the fragments that will be spread into the utility
47
+ // partial fragments. You can use any fragment here, however
48
+ // the system is designed for the following receiving
49
+ // fragments:
50
+ // - PageData => For all page-level components
51
+ // - BlockData => For everyting that can be rendered as
52
+ // individual component
53
+ // - ElementData => For all element types that are useable
54
+ // within Visual Builder
55
+ injections: [
56
+ {
57
+ // Add from all Pages, as .page.graphql file
58
+ into: "PageData",
59
+ pathRegex: "src\/components\/cms\/.*\.page\.graphql$"
60
+ },
61
+ {
62
+ // Add from all Experiences, as .experience.graphql file
63
+ into: "PageData",
64
+ pathRegex: "src\/components\/cms\/.*\.experience\.graphql$"
65
+ },
66
+ {
67
+ // Add from all Blocks, as .component.graphql file
68
+ into: "BlockData",
69
+ pathRegex: "src\/components\/cms\/.*\.component\.graphql$"
70
+ },
71
+ {
72
+ // Add from all Elements, as .element.graphql file
73
+ into: "ElementData",
74
+ pathRegex: "src\/components\/cms\/.*\.element\.graphql$"
75
+ }
76
+ ],
77
+ } as OptimizelyGraphPresetOptions
78
+ }
79
+ },
80
+ ignoreNoDocuments: false
81
+ }
82
+
83
+ export default config
84
+ ```
85
+
86
+ The presetConfig of the `OptimizelyGraphPreset` is an extension of the configuration for the [Client Preset](https://the-guild.dev/graphql/codegen/plugins/presets/preset-client) of GraphQL Codegen. It adds the following configuration options:
87
+
88
+ | Configuration option | Usage |
89
+ | --- | --- |
90
+ | recursion | Set to `true` to automatically generate recursive queries to iterate down the result.<br><br>The default logic of GraphQL Codegen contains an infite loop when disabling the recursion check. To patch this, a custom resolution must be added to the root `package.json`. This resolution must set the resolution for `@graphql-codegen/visitor-plugin-common` to the patched file [provided within this repository](../../dependencies/graphql-codegen-visitor-plugin-common-v5.3.1-patched.tgz) |
91
+ | injections | A set of rules to define how individual fragments will be used to construct the master queries. Each rule has the following options: <br/>- `into`: The name of the Fragment to inject into<br/>- `pathRegex`: The regular expression to be applied ot the file name to see if the fragment should be included with the `into` Fragment<br/>- `nameRegex`: The regular expression to be applied to the name of the Fragment
92
+ | documents | The standard rules for preset specific documents, however there are four standard documents available:<br/>- `opti-cms:/queries/13` (included by default)<br/>- `opti-cms:/queries/12`<br/>- `opti-cms:/fragments/13` (included by default)<br/>- `opti-cms:/fragments/12`<br/>*The defaults are only applied when there's no document starting with `opti-cms:` defined*
93
+ | functions | The list of GraphQL Functions that should be made available in the `functions.ts` file. When specified, this overrides the default list.<br/>*Default value: `['getContentType','getContentByPath','getContentById']`*
94
+ | verbose | Set to `true` to enable debugging output of the preset, loader, plugin and transform |
95
+
96
+
97
+ ## Usage
98
+ After running the code generation, you can use the following API's (assuming the folder where the generated files are stored is available at `@/gql`):
99
+
100
+ ### Option 1: Direct methods
101
+ Only the methods specified by the `functions` preset configuration are available using this method.
102
+
103
+ ```typescript
104
+ import { getContentById, getContentByPath } from "@/gql/functions"
105
+ import createClient from "@remkoj/optimizely-graph-client"
106
+
107
+ const client = createClient({
108
+ single_key: "your single key here"
109
+ })
110
+
111
+ const contentFromId = await getContentById(client, { guidValue: '00000000-0000-0000-0000-000000000000', locale: 'en' })
112
+ const contentFromPath = await getContentByPath(client, { path: '/en' })
113
+ ```
114
+
115
+ ### Option 2: Enhanced Client
116
+ All GraphQL operations (e.g. Queries, Mutations, ...) defined within the documents are available using this method.
117
+
118
+ ```typescript
119
+ import { getSdk } from "@/gql/client"
120
+ import createClient from "@remkoj/optimizely-graph-client"
121
+
122
+ const client = getSdk(createClient({
123
+ single_key: "your single key here"
124
+ }))
125
+ const contentId = '00000000-0000-0000-0000-000000000000'
126
+ const locale = Schema.Locales.En
127
+
128
+ const contentItem = await client.getContentById({ guidValue: contentId, locale })
129
+ ```
130
+
131
+ ## Query Fragments
132
+ The preset automatically injects a number of fragments and documents into the generated code. These can be found in their respective document:
133
+
134
+ - [`opti-cms:/queries/13`](./src/documents/queries.cms13.ts)
135
+ - [`opti-cms:/queries/12`](./src/documents/queries.cms12.ts)
136
+ - [`opti-cms:/fragments/13`](./src/documents/fragments.cms13.ts)
137
+ - [`opti-cms:/fragments/12`](./src/documents/fragments.cms12.ts)
@@ -0,0 +1,2 @@
1
+ declare const _default: string[];
2
+ export default _default;
@@ -0,0 +1,142 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = [
4
+ // Global required fragments
5
+ `fragment BlockData on IContent {
6
+ ...IContentData
7
+ }`,
8
+ `fragment PageData on IContent {
9
+ ...IContentData
10
+ }`,
11
+ // NextJS:Create CLI Compatibility
12
+ `fragment PageIContentListItem on ContentAreaItemModel {
13
+ item: ContentLink {
14
+ data: Expanded {
15
+ ...BlockData
16
+ }
17
+ }
18
+ displayOption:DisplayOption
19
+ }`,
20
+ `fragment PageIContentListItemSearch on ContentAreaItemModelSearch {
21
+ item: ContentLink {
22
+ data: Expanded {
23
+ ...BlockData
24
+ }
25
+ }
26
+ displayOption:DisplayOption
27
+ }`,
28
+ `fragment IContentListItem on ContentAreaItemModel {
29
+ item: ContentLink {
30
+ data: Expanded {
31
+ ...RecursiveBlockData
32
+ }
33
+ }
34
+ displayOption:DisplayOption
35
+ }`,
36
+ `fragment IContentListItemSearch on ContentAreaItemModelSearch {
37
+ item: ContentLink {
38
+ data: Expanded {
39
+ ...RecursiveBlockData
40
+ }
41
+ }
42
+ displayOption:DisplayOption
43
+ }`,
44
+ `fragment RecursiveBlockData on IContent {
45
+ ...IContentData
46
+ }`,
47
+ `fragment ReferenceData on ContentModelReference {
48
+ id: Id,
49
+ version: WorkId,
50
+ key: GuidValue
51
+ data: Expanded {
52
+ ...RecursiveBlockData
53
+ }
54
+ }`,
55
+ `fragment ReferenceDataSearch on ContentModelReferenceSearch {
56
+ id: Id,
57
+ version: WorkId,
58
+ key: GuidValue
59
+ data: Expanded {
60
+ ...RecursiveBlockData
61
+ }
62
+ }`,
63
+ `fragment BinaryData on BlobModel {
64
+ id: Id
65
+ url: Url
66
+ }`,
67
+ `fragment ContentLink on ContentModelReference {
68
+ id: Id,
69
+ version: WorkId,
70
+ key: GuidValue
71
+ data: Expanded {
72
+ ...RecursiveBlockData
73
+ }
74
+ }`,
75
+ `fragment ContentLinkSearch on ContentModelReferenceSearch {
76
+ id: Id,
77
+ version: WorkId,
78
+ key: GuidValue
79
+ data: Expanded {
80
+ ...RecursiveBlockData
81
+ }
82
+ }`,
83
+ `fragment LinkItemData on LinkItemNode {
84
+ children: Text
85
+ title: Title
86
+ href: Href
87
+ target: Target
88
+ content: ContentLink {
89
+ href: Url
90
+ data: Expanded {
91
+ path: RelativePath
92
+ }
93
+ }
94
+ }`,
95
+ `fragment LinkItemDataSearch on LinkItemNodeSearch {
96
+ children: Text
97
+ title: Title
98
+ href: Href
99
+ target: Target
100
+ content: ContentLink {
101
+ href: Url
102
+ data: Expanded {
103
+ path: RelativePath
104
+ }
105
+ }
106
+ }`,
107
+ // Original CMS 12 Fragments
108
+ `fragment IContentData on IContent {
109
+ contentType: ContentType
110
+ _metadata: ContentLink {
111
+ id: Id,
112
+ version: WorkId,
113
+ key: GuidValue
114
+ }
115
+ locale: Language {
116
+ name: Name
117
+ }
118
+ path:RelativePath
119
+ _type: __typename
120
+ }`,
121
+ `fragment ImageData on ContentModelReference {
122
+ ...ContentLink
123
+ url: Url
124
+ data: Expanded {
125
+ ...IContentData
126
+ url: Url
127
+ alt: Name
128
+ path: RelativePath
129
+ }
130
+ }`,
131
+ `fragment ImageDataSearch on ContentModelReferenceSearch {
132
+ ...ContentLinkSearch
133
+ url: Url
134
+ data: Expanded {
135
+ ...IContentData
136
+ url: Url
137
+ alt: Name
138
+ path: RelativePath
139
+ }
140
+ }`
141
+ ];
142
+ //# sourceMappingURL=fragments.cms12.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fragments.cms12.js","sourceRoot":"","sources":["../../src/documents/fragments.cms12.ts"],"names":[],"mappings":";;AAAA,kBAAe;IACb,4BAA4B;IAC5B;;IAEE;IACF;;IAEE;IAEF,kCAAkC;IAClC;;;;;;;IAOE;IACF;;;;;;;IAOE;IACF;;;;;;;IAOE;IACF;;;;;;;IAOE;IACF;;IAEE;IACF;;;;;;;IAOE;IACF;;;;;;;IAOE;IACF;;;IAGE;IAEF;;;;;;;IAOE;IACF;;;;;;;IAOE;IACF;;;;;;;;;;;IAWE;IACF;;;;;;;;;;;IAWE;IAEF,4BAA4B;IAC5B;;;;;;;;;;;;IAYE;IACA;;;;;;;;;MASE;IACF;;;;;;;;;MASE;CACL,CAAA"}
@@ -0,0 +1,2 @@
1
+ declare const _default: string[];
2
+ export default _default;
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = [
4
+ `fragment IContentData on _IContent
5
+ {
6
+ _metadata {
7
+ ...IContentInfo
8
+ }
9
+ _type: __typename
10
+ }`,
11
+ `fragment CompositionData on ICompositionNode {
12
+ name: displayName
13
+ layoutType: nodeType
14
+ type
15
+ key
16
+ template: displayTemplateKey
17
+ settings: displaySettings {
18
+ key
19
+ value
20
+ }
21
+ ... on ICompositionStructureNode {
22
+ nodes @recursive(depth: 10) {
23
+ name: displayName
24
+ }
25
+ }
26
+ ... on ICompositionElementNode {
27
+ element {
28
+ ...ElementData
29
+ }
30
+ }
31
+ }`,
32
+ `fragment IElementData on _IElement {
33
+ _metadata {
34
+ ...IContentInfo
35
+ }
36
+ _type: __typename
37
+ }`,
38
+ `fragment ElementData on _IElement {
39
+ ...IElementData
40
+ }`,
41
+ `fragment BlockData on _IContent {
42
+ ...IContentData
43
+ }`,
44
+ `fragment PageData on _IContent {
45
+ ...IContentData
46
+ }`,
47
+ `fragment LinkData on ContentUrl {
48
+ base
49
+ hierarchical
50
+ default
51
+ }`,
52
+ `fragment ReferenceData on ContentReference {
53
+ key
54
+ url {
55
+ ...LinkData
56
+ }
57
+ }`,
58
+ `fragment IContentInfo on IContentMetadata {
59
+ key
60
+ locale
61
+ types
62
+ displayName
63
+ version
64
+ url {
65
+ ...LinkData
66
+ }
67
+ }`,
68
+ `fragment IContentListItem on _IContent {
69
+ ...IContentData
70
+ }`,
71
+ `fragment ExperienceData on _IExperience {
72
+ composition {
73
+ ...CompositionData
74
+ }
75
+ }`,
76
+ `fragment LinkItemData on Link {
77
+ title
78
+ text
79
+ target
80
+ url {
81
+ ...LinkData
82
+ }
83
+ }`
84
+ ];
85
+ //# sourceMappingURL=fragments.cms13.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fragments.cms13.js","sourceRoot":"","sources":["../../src/documents/fragments.cms13.ts"],"names":[],"mappings":";;AAAA,kBAAe;IACX;;;;;;MAME;IACF;;;;;;;;;;;;;;;;;;;;MAoBE;IACF;;;;;MAKE;IACF;;MAEE;IACF;;MAEE;IACF;;MAEE;IACF;;;;MAIE;IACF;;;;;MAKE;IACF;;;;;;;;;MASE;IACF;;MAEE;IACF;;;;MAIE;IACF;;;;;;;MAOE;CACL,CAAA"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * The list of standard properties
3
+ *
4
+ * @deprecated Should not be used from @remkoj/optimizely-graph-functions, as it's a development only package
5
+ */
6
+ export declare const IContentDataProps: string[];
7
+ /**
8
+ * The standard (rawSDL) fragments for Optimizely CMS 13
9
+ *
10
+ * @deprecated Not intended to be used outside of the @remkoj/optimizely-graph-functions package
11
+ */
12
+ export declare const fragments: string[];
13
+ /**
14
+ * The standard (rawSDL) fragments for Optimizely CMS 13
15
+ *
16
+ * @deprecated Not intended to be used outside of the @remkoj/optimizely-graph-functions package
17
+ */
18
+ export declare const queries: string[];
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.queries = exports.fragments = exports.IContentDataProps = void 0;
7
+ const fragments_cms13_1 = __importDefault(require("./fragments.cms13"));
8
+ const queries_cms13_1 = __importDefault(require("./queries.cms13"));
9
+ /**
10
+ * The list of standard properties
11
+ *
12
+ * @deprecated Should not be used from @remkoj/optimizely-graph-functions, as it's a development only package
13
+ */
14
+ exports.IContentDataProps = ["contentType", "id", "locale", "path", "__typename"];
15
+ /**
16
+ * The standard (rawSDL) fragments for Optimizely CMS 13
17
+ *
18
+ * @deprecated Not intended to be used outside of the @remkoj/optimizely-graph-functions package
19
+ */
20
+ exports.fragments = fragments_cms13_1.default;
21
+ /**
22
+ * The standard (rawSDL) fragments for Optimizely CMS 13
23
+ *
24
+ * @deprecated Not intended to be used outside of the @remkoj/optimizely-graph-functions package
25
+ */
26
+ exports.queries = queries_cms13_1.default;
27
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/documents/index.ts"],"names":[],"mappings":";;;;;;AAAA,wEAA8C;AAC9C,oEAA0C;AAE1C;;;;GAIG;AACU,QAAA,iBAAiB,GAAG,CAAC,aAAa,EAAC,IAAI,EAAC,QAAQ,EAAC,MAAM,EAAC,YAAY,CAAC,CAAA;AAElF;;;;GAIG;AACU,QAAA,SAAS,GAAG,yBAAc,CAAA;AAEvC;;;;GAIG;AACU,QAAA,OAAO,GAAG,uBAAY,CAAA"}
@@ -0,0 +1,2 @@
1
+ declare const _default: string[];
2
+ export default _default;
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = [
4
+ `query getContentById($id: Int, $workId: Int, $guidValue: String, $locale: [Locales!], $isCommonDraft: Boolean) {
5
+ content: Content(
6
+ where: {
7
+ ContentLink: {
8
+ Id: { eq: $id },
9
+ WorkId: { eq: $workId },
10
+ GuidValue: { eq: $guidValue }
11
+ }
12
+ IsCommonDraft: { eq: $isCommonDraft }
13
+ }
14
+ locale: $locale
15
+ ) {
16
+ total
17
+ items {
18
+ ...IContentData
19
+ ...PageData
20
+ ...BlockData
21
+ }
22
+ }
23
+ }`,
24
+ `query getContentByPath($path: String!, $locale: [Locales], $siteId: String) {
25
+ content: Content(
26
+ where: {
27
+ RelativePath: {
28
+ eq: $path
29
+ }
30
+ SiteId: {
31
+ eq: $siteId
32
+ }
33
+ },
34
+ locale: $locale
35
+ ) {
36
+ items {
37
+ ...PageData
38
+ }
39
+ }
40
+ }`,
41
+ `query getContentType($id: Int, $workId: Int, $guidValue: String, $locale: [Locales]) {
42
+ content: Content(
43
+ where: {
44
+ ContentLink: {
45
+ GuidValue: {
46
+ eq: $guidValue
47
+ }
48
+ Id: {
49
+ eq: $id
50
+ },
51
+ WorkId: {
52
+ eq: $workId
53
+ }
54
+ }
55
+ },
56
+ locale: $locale
57
+ limit: 1
58
+ ) {
59
+ items {
60
+ ContentType
61
+ },
62
+ total
63
+ }
64
+ }`
65
+ ];
66
+ //# sourceMappingURL=queries.cms12.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"queries.cms12.js","sourceRoot":"","sources":["../../src/documents/queries.cms12.ts"],"names":[],"mappings":";;AAAA,kBAAe;IACX;;;;;;;;;;;;;;;;;;;MAmBE;IACF;;;;;;;;;;;;;;;;MAgBE;IACF;;;;;;;;;;;;;;;;;;;;;;;MAuBE;CACL,CAAA"}
@@ -0,0 +1,2 @@
1
+ declare const _default: string[];
2
+ export default _default;
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = [
4
+ `query getContentById($key: String!, $version: String, $locale: [Locales!], $path: String, $domain: String) {
5
+ content: _Content(
6
+ where: {
7
+ _or: [
8
+ { _metadata: { key: { eq: $key }, version: { eq: $version } } }
9
+ { _metadata: { url: { hierarchical: { eq: $path }, base: { eq: $domain } }, version: { eq: $version } } }
10
+ ]
11
+ }
12
+ locale: $locale
13
+ ) {
14
+ total
15
+ items {
16
+ ...BlockData
17
+ ...PageData
18
+ }
19
+ }
20
+ }`,
21
+ `query getContentByPath($path: String!, $version: String, $locale: [Locales!], $domain: String) {
22
+ content: _Content(
23
+ where: {
24
+ _metadata: { url: { default: { eq: $path }, base: { eq: $domain } }, version: { eq: $version }}
25
+ }
26
+ locale: $locale
27
+ ) {
28
+ total
29
+ items {
30
+ ...PageData
31
+ }
32
+ }
33
+ }`,
34
+ `query getContentType($key: String!, $version: String, $locale: [Locales!], $path: String, $domain: String) {
35
+ content: _Content(
36
+ where: {
37
+ _or: [
38
+ { _metadata: { key: { eq: $key }, version: { eq: $version } } }
39
+ { _metadata: { url: { hierarchical: { eq: $path }, base: { eq: $domain } }, version: { eq: $version } } }
40
+ ]
41
+ }
42
+ locale: $locale
43
+ ) {
44
+ total
45
+ items {
46
+ _metadata {
47
+ types
48
+ }
49
+ }
50
+ }
51
+ }`
52
+ ];
53
+ //# sourceMappingURL=queries.cms13.js.map