@sitecore-content-sdk/core 1.0.0 → 1.1.0-canary.2
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/LICENSE.txt +202 -202
- package/README.md +7 -7
- package/dist/cjs/client/sitecore-client.js +0 -7
- package/dist/cjs/editing/component-layout-service.js +2 -4
- package/dist/cjs/editing/editing-service.js +6 -105
- package/dist/esm/client/sitecore-client.js +0 -7
- package/dist/esm/editing/component-layout-service.js +2 -4
- package/dist/esm/editing/editing-service.js +5 -104
- package/package.json +2 -2
- package/types/editing/component-layout-service.d.ts +2 -1
- package/types/editing/editing-service.d.ts +3 -39
package/LICENSE.txt
CHANGED
|
@@ -1,202 +1,202 @@
|
|
|
1
|
-
|
|
2
|
-
Apache License
|
|
3
|
-
Version 2.0, January 2004
|
|
4
|
-
http://www.apache.org/licenses/
|
|
5
|
-
|
|
6
|
-
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
-
|
|
8
|
-
1. Definitions.
|
|
9
|
-
|
|
10
|
-
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
-
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
-
|
|
13
|
-
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
-
the copyright owner that is granting the License.
|
|
15
|
-
|
|
16
|
-
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
-
other entities that control, are controlled by, or are under common
|
|
18
|
-
control with that entity. For the purposes of this definition,
|
|
19
|
-
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
-
direction or management of such entity, whether by contract or
|
|
21
|
-
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
-
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
-
|
|
24
|
-
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
-
exercising permissions granted by this License.
|
|
26
|
-
|
|
27
|
-
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
-
including but not limited to software source code, documentation
|
|
29
|
-
source, and configuration files.
|
|
30
|
-
|
|
31
|
-
"Object" form shall mean any form resulting from mechanical
|
|
32
|
-
transformation or translation of a Source form, including but
|
|
33
|
-
not limited to compiled object code, generated documentation,
|
|
34
|
-
and conversions to other media types.
|
|
35
|
-
|
|
36
|
-
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
-
Object form, made available under the License, as indicated by a
|
|
38
|
-
copyright notice that is included in or attached to the work
|
|
39
|
-
(an example is provided in the Appendix below).
|
|
40
|
-
|
|
41
|
-
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
-
form, that is based on (or derived from) the Work and for which the
|
|
43
|
-
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
-
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
-
of this License, Derivative Works shall not include works that remain
|
|
46
|
-
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
-
the Work and Derivative Works thereof.
|
|
48
|
-
|
|
49
|
-
"Contribution" shall mean any work of authorship, including
|
|
50
|
-
the original version of the Work and any modifications or additions
|
|
51
|
-
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
-
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
-
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
-
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
-
means any form of electronic, verbal, or written communication sent
|
|
56
|
-
to the Licensor or its representatives, including but not limited to
|
|
57
|
-
communication on electronic mailing lists, source code control systems,
|
|
58
|
-
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
-
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
-
excluding communication that is conspicuously marked or otherwise
|
|
61
|
-
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
-
|
|
63
|
-
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
-
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
-
subsequently incorporated within the Work.
|
|
66
|
-
|
|
67
|
-
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
-
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
-
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
-
Work and such Derivative Works in Source or Object form.
|
|
73
|
-
|
|
74
|
-
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
-
(except as stated in this section) patent license to make, have made,
|
|
78
|
-
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
-
where such license applies only to those patent claims licensable
|
|
80
|
-
by such Contributor that are necessarily infringed by their
|
|
81
|
-
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
-
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
-
institute patent litigation against any entity (including a
|
|
84
|
-
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
-
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
-
or contributory patent infringement, then any patent licenses
|
|
87
|
-
granted to You under this License for that Work shall terminate
|
|
88
|
-
as of the date such litigation is filed.
|
|
89
|
-
|
|
90
|
-
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
-
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
-
modifications, and in Source or Object form, provided that You
|
|
93
|
-
meet the following conditions:
|
|
94
|
-
|
|
95
|
-
(a) You must give any other recipients of the Work or
|
|
96
|
-
Derivative Works a copy of this License; and
|
|
97
|
-
|
|
98
|
-
(b) You must cause any modified files to carry prominent notices
|
|
99
|
-
stating that You changed the files; and
|
|
100
|
-
|
|
101
|
-
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
-
that You distribute, all copyright, patent, trademark, and
|
|
103
|
-
attribution notices from the Source form of the Work,
|
|
104
|
-
excluding those notices that do not pertain to any part of
|
|
105
|
-
the Derivative Works; and
|
|
106
|
-
|
|
107
|
-
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
-
distribution, then any Derivative Works that You distribute must
|
|
109
|
-
include a readable copy of the attribution notices contained
|
|
110
|
-
within such NOTICE file, excluding those notices that do not
|
|
111
|
-
pertain to any part of the Derivative Works, in at least one
|
|
112
|
-
of the following places: within a NOTICE text file distributed
|
|
113
|
-
as part of the Derivative Works; within the Source form or
|
|
114
|
-
documentation, if provided along with the Derivative Works; or,
|
|
115
|
-
within a display generated by the Derivative Works, if and
|
|
116
|
-
wherever such third-party notices normally appear. The contents
|
|
117
|
-
of the NOTICE file are for informational purposes only and
|
|
118
|
-
do not modify the License. You may add Your own attribution
|
|
119
|
-
notices within Derivative Works that You distribute, alongside
|
|
120
|
-
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
-
that such additional attribution notices cannot be construed
|
|
122
|
-
as modifying the License.
|
|
123
|
-
|
|
124
|
-
You may add Your own copyright statement to Your modifications and
|
|
125
|
-
may provide additional or different license terms and conditions
|
|
126
|
-
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
-
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
-
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
-
the conditions stated in this License.
|
|
130
|
-
|
|
131
|
-
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
-
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
-
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
-
this License, without any additional terms or conditions.
|
|
135
|
-
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
-
the terms of any separate license agreement you may have executed
|
|
137
|
-
with Licensor regarding such Contributions.
|
|
138
|
-
|
|
139
|
-
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
-
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
-
except as required for reasonable and customary use in describing the
|
|
142
|
-
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
-
|
|
144
|
-
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
-
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
-
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
-
implied, including, without limitation, any warranties or conditions
|
|
149
|
-
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
-
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
-
appropriateness of using or redistributing the Work and assume any
|
|
152
|
-
risks associated with Your exercise of permissions under this License.
|
|
153
|
-
|
|
154
|
-
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
-
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
-
unless required by applicable law (such as deliberate and grossly
|
|
157
|
-
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
-
liable to You for damages, including any direct, indirect, special,
|
|
159
|
-
incidental, or consequential damages of any character arising as a
|
|
160
|
-
result of this License or out of the use or inability to use the
|
|
161
|
-
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
-
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
-
other commercial damages or losses), even if such Contributor
|
|
164
|
-
has been advised of the possibility of such damages.
|
|
165
|
-
|
|
166
|
-
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
-
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
-
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
-
or other liability obligations and/or rights consistent with this
|
|
170
|
-
License. However, in accepting such obligations, You may act only
|
|
171
|
-
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
-
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
-
defend, and hold each Contributor harmless for any liability
|
|
174
|
-
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
-
of your accepting any such warranty or additional liability.
|
|
176
|
-
|
|
177
|
-
END OF TERMS AND CONDITIONS
|
|
178
|
-
|
|
179
|
-
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
-
|
|
181
|
-
To apply the Apache License to your work, attach the following
|
|
182
|
-
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
-
replaced with your own identifying information. (Don't include
|
|
184
|
-
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
-
comment syntax for the file format. We also recommend that a
|
|
186
|
-
file or class name and description of purpose be included on the
|
|
187
|
-
same "printed page" as the copyright notice for easier
|
|
188
|
-
identification within third-party archives.
|
|
189
|
-
|
|
190
|
-
Copyright [yyyy] [name of copyright owner]
|
|
191
|
-
|
|
192
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
-
you may not use this file except in compliance with the License.
|
|
194
|
-
You may obtain a copy of the License at
|
|
195
|
-
|
|
196
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
-
|
|
198
|
-
Unless required by applicable law or agreed to in writing, software
|
|
199
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
-
See the License for the specific language governing permissions and
|
|
202
|
-
limitations under the License.
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
# Sitecore Content SDK Core
|
|
2
|
-
|
|
3
|
-
This module is provided as a part of Sitecore Content SDK. It contains the core Sitecore Content SDK APIs and utilities.
|
|
4
|
-
|
|
5
|
-
[Documentation](https://doc.sitecore.com/xmc/en/developers/content-sdk/index.html)
|
|
6
|
-
|
|
7
|
-
[API reference documentation](/ref-docs/core/)
|
|
1
|
+
# Sitecore Content SDK Core
|
|
2
|
+
|
|
3
|
+
This module is provided as a part of Sitecore Content SDK. It contains the core Sitecore Content SDK APIs and utilities.
|
|
4
|
+
|
|
5
|
+
[Documentation](https://doc.sitecore.com/xmc/en/developers/content-sdk/index.html)
|
|
6
|
+
|
|
7
|
+
[API reference documentation](/ref-docs/core/)
|
|
@@ -151,7 +151,6 @@ class SitecoreClient {
|
|
|
151
151
|
// If we're in Pages preview (editing) mode, prefetch the editing data
|
|
152
152
|
const { site, itemId, language, version, variantIds, layoutKind, mode, } = previewData;
|
|
153
153
|
const data = await this.editingService.fetchEditingData({
|
|
154
|
-
siteName: site,
|
|
155
154
|
itemId,
|
|
156
155
|
language,
|
|
157
156
|
version,
|
|
@@ -164,7 +163,6 @@ class SitecoreClient {
|
|
|
164
163
|
const page = {
|
|
165
164
|
locale: language,
|
|
166
165
|
layout: data.layoutData,
|
|
167
|
-
dictionary: data.dictionary,
|
|
168
166
|
siteName: ((_a = data.layoutData.sitecore.context.site) === null || _a === void 0 ? void 0 : _a.name) || site,
|
|
169
167
|
mode: this.getPageMode(mode),
|
|
170
168
|
};
|
|
@@ -193,10 +191,6 @@ class SitecoreClient {
|
|
|
193
191
|
dataSourceId,
|
|
194
192
|
version,
|
|
195
193
|
mode,
|
|
196
|
-
});
|
|
197
|
-
const dictionaryData = await this.editingService.fetchDictionaryData({
|
|
198
|
-
siteName: site,
|
|
199
|
-
language,
|
|
200
194
|
}, fetchOptions);
|
|
201
195
|
if (!componentData) {
|
|
202
196
|
throw new Error(`Unable to fetch editing data for preview ${JSON.stringify(designLibData)}`);
|
|
@@ -204,7 +198,6 @@ class SitecoreClient {
|
|
|
204
198
|
const page = {
|
|
205
199
|
locale: designLibData.language,
|
|
206
200
|
layout: componentData,
|
|
207
|
-
dictionary: dictionaryData,
|
|
208
201
|
siteName: ((_a = componentData.sitecore.context.site) === null || _a === void 0 ? void 0 : _a.name) || site,
|
|
209
202
|
mode: this.getPageMode(mode),
|
|
210
203
|
};
|
|
@@ -17,13 +17,11 @@ class ComponentLayoutService {
|
|
|
17
17
|
constructor(config) {
|
|
18
18
|
this.config = config;
|
|
19
19
|
}
|
|
20
|
-
fetchComponentData(params) {
|
|
20
|
+
fetchComponentData(params, fetchOptions) {
|
|
21
21
|
const fetcher = new native_fetcher_1.NativeDataFetcher({ debugger: debug_1.default.layout });
|
|
22
22
|
debug_1.default.layout('fetching component with uid %s for %s %s %s %s', params.componentUid, params.itemId, params.language, params.siteName, params.dataSourceId);
|
|
23
23
|
return fetcher
|
|
24
|
-
.get(this.getFetchUrl(params), {
|
|
25
|
-
headers: { sc_editMode: `${params.mode === models_1.DesignLibraryMode.Metadata}` },
|
|
26
|
-
})
|
|
24
|
+
.get(this.getFetchUrl(params), Object.assign(Object.assign({}, fetchOptions), { headers: Object.assign(Object.assign({}, fetchOptions === null || fetchOptions === void 0 ? void 0 : fetchOptions.headers), { sc_editMode: `${params.mode === models_1.DesignLibraryMode.Metadata}` }) }))
|
|
27
25
|
.then((response) => response.data)
|
|
28
26
|
.catch((error) => {
|
|
29
27
|
var _a;
|
|
@@ -3,69 +3,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.EditingService = exports.
|
|
6
|
+
exports.EditingService = exports.query = void 0;
|
|
7
7
|
const debug_1 = __importDefault(require("../debug"));
|
|
8
8
|
const models_1 = require("./models");
|
|
9
|
-
/**
|
|
10
|
-
* The dictionary query default page size.
|
|
11
|
-
*/
|
|
12
|
-
const PAGE_SIZE = 1000;
|
|
13
9
|
/**
|
|
14
10
|
* GraphQL query for fetching editing data.
|
|
15
11
|
*/
|
|
16
12
|
exports.query = `
|
|
17
|
-
|
|
18
|
-
$siteName: String!
|
|
19
|
-
$itemId: String!
|
|
20
|
-
$language: String!
|
|
21
|
-
$version: String
|
|
22
|
-
$after: String
|
|
23
|
-
$pageSize: Int = ${PAGE_SIZE}
|
|
24
|
-
) {
|
|
13
|
+
query EditingQuery($itemId: String!, $language: String!, $version: String) {
|
|
25
14
|
item(path: $itemId, language: $language, version: $version) {
|
|
26
15
|
rendered
|
|
27
16
|
}
|
|
28
|
-
site {
|
|
29
|
-
siteInfo(site: $siteName) {
|
|
30
|
-
dictionary(language: $language, first: $pageSize, after: $after) {
|
|
31
|
-
results {
|
|
32
|
-
key
|
|
33
|
-
value
|
|
34
|
-
}
|
|
35
|
-
pageInfo {
|
|
36
|
-
endCursor
|
|
37
|
-
hasNext
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
`;
|
|
44
|
-
/**
|
|
45
|
-
* GraphQL query for fetching dictionary data.
|
|
46
|
-
* This query is used when the dictionary data is paginated.
|
|
47
|
-
*/
|
|
48
|
-
exports.dictionaryQuery = `
|
|
49
|
-
query EditingDictionaryQuery(
|
|
50
|
-
$siteName: String!
|
|
51
|
-
$language: String!
|
|
52
|
-
$after: String
|
|
53
|
-
$pageSize: Int = ${PAGE_SIZE}
|
|
54
|
-
) {
|
|
55
|
-
site {
|
|
56
|
-
siteInfo(site: $siteName) {
|
|
57
|
-
dictionary(language: $language, first: $pageSize, after: $after) {
|
|
58
|
-
results {
|
|
59
|
-
key
|
|
60
|
-
value
|
|
61
|
-
}
|
|
62
|
-
pageInfo {
|
|
63
|
-
endCursor
|
|
64
|
-
hasNext
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
17
|
}
|
|
70
18
|
`;
|
|
71
19
|
/**
|
|
@@ -84,7 +32,6 @@ class EditingService {
|
|
|
84
32
|
/**
|
|
85
33
|
* Fetches editing data. Provides the layout data and dictionary phrases
|
|
86
34
|
* @param {object} variables - The parameters for fetching editing data.
|
|
87
|
-
* @param {string} variables.siteName - The site name.
|
|
88
35
|
* @param {string} variables.itemId - The item id (path) to fetch layout data for.
|
|
89
36
|
* @param {string} variables.language - The language to fetch layout data for.
|
|
90
37
|
* @param {string} variables.mode - The editing mode to fetch layout data for.
|
|
@@ -93,21 +40,14 @@ class EditingService {
|
|
|
93
40
|
* @param {FetchOptions} [fetchOptions] Options to override graphQL client details like retries and fetch implementation
|
|
94
41
|
* @returns {Promise} The layout data and dictionary phrases.
|
|
95
42
|
*/
|
|
96
|
-
async fetchEditingData({
|
|
97
|
-
var _a
|
|
98
|
-
debug_1.default.editing('fetching editing data for %s %s %s %s',
|
|
99
|
-
if (!siteName) {
|
|
100
|
-
throw new RangeError('The site name must be a non-empty string');
|
|
101
|
-
}
|
|
43
|
+
async fetchEditingData({ itemId, language, version, layoutKind = models_1.LayoutKind.Final, mode }, fetchOptions) {
|
|
44
|
+
var _a;
|
|
45
|
+
debug_1.default.editing('fetching editing data for %s %s %s %s', itemId, language, version, layoutKind);
|
|
102
46
|
if (!language) {
|
|
103
47
|
throw new RangeError('The language must be a non-empty string');
|
|
104
48
|
}
|
|
105
|
-
let initDictionary = [];
|
|
106
|
-
let hasNext = true;
|
|
107
|
-
let after = '';
|
|
108
49
|
const editModeHeader = mode === 'edit' ? 'true' : 'false';
|
|
109
50
|
const editingData = await this.graphQLClient.request(exports.query, {
|
|
110
|
-
siteName,
|
|
111
51
|
itemId,
|
|
112
52
|
version,
|
|
113
53
|
language,
|
|
@@ -115,54 +55,15 @@ class EditingService {
|
|
|
115
55
|
sc_layoutKind: layoutKind,
|
|
116
56
|
sc_editMode: editModeHeader,
|
|
117
57
|
} }));
|
|
118
|
-
if ((_b = (_a = editingData === null || editingData === void 0 ? void 0 : editingData.site) === null || _a === void 0 ? void 0 : _a.siteInfo) === null || _b === void 0 ? void 0 : _b.dictionary) {
|
|
119
|
-
initDictionary = editingData.site.siteInfo.dictionary.results;
|
|
120
|
-
hasNext = editingData.site.siteInfo.dictionary.pageInfo.hasNext;
|
|
121
|
-
after = editingData.site.siteInfo.dictionary.pageInfo.endCursor;
|
|
122
|
-
}
|
|
123
|
-
else {
|
|
124
|
-
hasNext = false;
|
|
125
|
-
}
|
|
126
|
-
const dictionary = await this.fetchDictionaryData({
|
|
127
|
-
siteName,
|
|
128
|
-
language,
|
|
129
|
-
initDictionary,
|
|
130
|
-
hasNext,
|
|
131
|
-
after,
|
|
132
|
-
}, fetchOptions);
|
|
133
58
|
return {
|
|
134
|
-
layoutData: ((
|
|
59
|
+
layoutData: ((_a = editingData === null || editingData === void 0 ? void 0 : editingData.item) === null || _a === void 0 ? void 0 : _a.rendered) || {
|
|
135
60
|
sitecore: {
|
|
136
61
|
context: { pageEditing: true, language },
|
|
137
62
|
route: null,
|
|
138
63
|
},
|
|
139
64
|
},
|
|
140
|
-
dictionary,
|
|
141
65
|
};
|
|
142
66
|
}
|
|
143
|
-
async fetchDictionaryData({ siteName, language, initDictionary, hasNext, after, }, fetchOptions) {
|
|
144
|
-
var _a, _b;
|
|
145
|
-
hasNext = hasNext !== undefined ? hasNext : true;
|
|
146
|
-
let dictionaryResults = initDictionary || [];
|
|
147
|
-
const dictionary = {};
|
|
148
|
-
while (hasNext) {
|
|
149
|
-
const data = await this.graphQLClient.request(exports.dictionaryQuery, {
|
|
150
|
-
siteName,
|
|
151
|
-
language,
|
|
152
|
-
after,
|
|
153
|
-
}, fetchOptions);
|
|
154
|
-
if ((_b = (_a = data === null || data === void 0 ? void 0 : data.site) === null || _a === void 0 ? void 0 : _a.siteInfo) === null || _b === void 0 ? void 0 : _b.dictionary) {
|
|
155
|
-
dictionaryResults = dictionaryResults.concat(data.site.siteInfo.dictionary.results);
|
|
156
|
-
hasNext = data.site.siteInfo.dictionary.pageInfo.hasNext;
|
|
157
|
-
after = data.site.siteInfo.dictionary.pageInfo.endCursor;
|
|
158
|
-
}
|
|
159
|
-
else {
|
|
160
|
-
hasNext = false;
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
dictionaryResults.forEach((item) => (dictionary[item.key] = item.value));
|
|
164
|
-
return dictionary;
|
|
165
|
-
}
|
|
166
67
|
/**
|
|
167
68
|
* Gets a GraphQL client that can make requests to the API.
|
|
168
69
|
* @returns {GraphQLClient} implementation
|
|
@@ -148,7 +148,6 @@ export class SitecoreClient {
|
|
|
148
148
|
// If we're in Pages preview (editing) mode, prefetch the editing data
|
|
149
149
|
const { site, itemId, language, version, variantIds, layoutKind, mode, } = previewData;
|
|
150
150
|
const data = await this.editingService.fetchEditingData({
|
|
151
|
-
siteName: site,
|
|
152
151
|
itemId,
|
|
153
152
|
language,
|
|
154
153
|
version,
|
|
@@ -161,7 +160,6 @@ export class SitecoreClient {
|
|
|
161
160
|
const page = {
|
|
162
161
|
locale: language,
|
|
163
162
|
layout: data.layoutData,
|
|
164
|
-
dictionary: data.dictionary,
|
|
165
163
|
siteName: ((_a = data.layoutData.sitecore.context.site) === null || _a === void 0 ? void 0 : _a.name) || site,
|
|
166
164
|
mode: this.getPageMode(mode),
|
|
167
165
|
};
|
|
@@ -190,10 +188,6 @@ export class SitecoreClient {
|
|
|
190
188
|
dataSourceId,
|
|
191
189
|
version,
|
|
192
190
|
mode,
|
|
193
|
-
});
|
|
194
|
-
const dictionaryData = await this.editingService.fetchDictionaryData({
|
|
195
|
-
siteName: site,
|
|
196
|
-
language,
|
|
197
191
|
}, fetchOptions);
|
|
198
192
|
if (!componentData) {
|
|
199
193
|
throw new Error(`Unable to fetch editing data for preview ${JSON.stringify(designLibData)}`);
|
|
@@ -201,7 +195,6 @@ export class SitecoreClient {
|
|
|
201
195
|
const page = {
|
|
202
196
|
locale: designLibData.language,
|
|
203
197
|
layout: componentData,
|
|
204
|
-
dictionary: dictionaryData,
|
|
205
198
|
siteName: ((_a = componentData.sitecore.context.site) === null || _a === void 0 ? void 0 : _a.name) || site,
|
|
206
199
|
mode: this.getPageMode(mode),
|
|
207
200
|
};
|
|
@@ -11,13 +11,11 @@ export class ComponentLayoutService {
|
|
|
11
11
|
constructor(config) {
|
|
12
12
|
this.config = config;
|
|
13
13
|
}
|
|
14
|
-
fetchComponentData(params) {
|
|
14
|
+
fetchComponentData(params, fetchOptions) {
|
|
15
15
|
const fetcher = new NativeDataFetcher({ debugger: debug.layout });
|
|
16
16
|
debug.layout('fetching component with uid %s for %s %s %s %s', params.componentUid, params.itemId, params.language, params.siteName, params.dataSourceId);
|
|
17
17
|
return fetcher
|
|
18
|
-
.get(this.getFetchUrl(params), {
|
|
19
|
-
headers: { sc_editMode: `${params.mode === DesignLibraryMode.Metadata}` },
|
|
20
|
-
})
|
|
18
|
+
.get(this.getFetchUrl(params), Object.assign(Object.assign({}, fetchOptions), { headers: Object.assign(Object.assign({}, fetchOptions === null || fetchOptions === void 0 ? void 0 : fetchOptions.headers), { sc_editMode: `${params.mode === DesignLibraryMode.Metadata}` }) }))
|
|
21
19
|
.then((response) => response.data)
|
|
22
20
|
.catch((error) => {
|
|
23
21
|
var _a;
|
|
@@ -1,65 +1,13 @@
|
|
|
1
1
|
import debug from '../debug';
|
|
2
2
|
import { LayoutKind } from './models';
|
|
3
|
-
/**
|
|
4
|
-
* The dictionary query default page size.
|
|
5
|
-
*/
|
|
6
|
-
const PAGE_SIZE = 1000;
|
|
7
3
|
/**
|
|
8
4
|
* GraphQL query for fetching editing data.
|
|
9
5
|
*/
|
|
10
6
|
export const query = /* GraphQL */ `
|
|
11
|
-
|
|
12
|
-
$siteName: String!
|
|
13
|
-
$itemId: String!
|
|
14
|
-
$language: String!
|
|
15
|
-
$version: String
|
|
16
|
-
$after: String
|
|
17
|
-
$pageSize: Int = ${PAGE_SIZE}
|
|
18
|
-
) {
|
|
7
|
+
query EditingQuery($itemId: String!, $language: String!, $version: String) {
|
|
19
8
|
item(path: $itemId, language: $language, version: $version) {
|
|
20
9
|
rendered
|
|
21
10
|
}
|
|
22
|
-
site {
|
|
23
|
-
siteInfo(site: $siteName) {
|
|
24
|
-
dictionary(language: $language, first: $pageSize, after: $after) {
|
|
25
|
-
results {
|
|
26
|
-
key
|
|
27
|
-
value
|
|
28
|
-
}
|
|
29
|
-
pageInfo {
|
|
30
|
-
endCursor
|
|
31
|
-
hasNext
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
`;
|
|
38
|
-
/**
|
|
39
|
-
* GraphQL query for fetching dictionary data.
|
|
40
|
-
* This query is used when the dictionary data is paginated.
|
|
41
|
-
*/
|
|
42
|
-
export const dictionaryQuery = /* GraphQL */ `
|
|
43
|
-
query EditingDictionaryQuery(
|
|
44
|
-
$siteName: String!
|
|
45
|
-
$language: String!
|
|
46
|
-
$after: String
|
|
47
|
-
$pageSize: Int = ${PAGE_SIZE}
|
|
48
|
-
) {
|
|
49
|
-
site {
|
|
50
|
-
siteInfo(site: $siteName) {
|
|
51
|
-
dictionary(language: $language, first: $pageSize, after: $after) {
|
|
52
|
-
results {
|
|
53
|
-
key
|
|
54
|
-
value
|
|
55
|
-
}
|
|
56
|
-
pageInfo {
|
|
57
|
-
endCursor
|
|
58
|
-
hasNext
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
11
|
}
|
|
64
12
|
`;
|
|
65
13
|
/**
|
|
@@ -78,7 +26,6 @@ export class EditingService {
|
|
|
78
26
|
/**
|
|
79
27
|
* Fetches editing data. Provides the layout data and dictionary phrases
|
|
80
28
|
* @param {object} variables - The parameters for fetching editing data.
|
|
81
|
-
* @param {string} variables.siteName - The site name.
|
|
82
29
|
* @param {string} variables.itemId - The item id (path) to fetch layout data for.
|
|
83
30
|
* @param {string} variables.language - The language to fetch layout data for.
|
|
84
31
|
* @param {string} variables.mode - The editing mode to fetch layout data for.
|
|
@@ -87,21 +34,14 @@ export class EditingService {
|
|
|
87
34
|
* @param {FetchOptions} [fetchOptions] Options to override graphQL client details like retries and fetch implementation
|
|
88
35
|
* @returns {Promise} The layout data and dictionary phrases.
|
|
89
36
|
*/
|
|
90
|
-
async fetchEditingData({
|
|
91
|
-
var _a
|
|
92
|
-
debug.editing('fetching editing data for %s %s %s %s',
|
|
93
|
-
if (!siteName) {
|
|
94
|
-
throw new RangeError('The site name must be a non-empty string');
|
|
95
|
-
}
|
|
37
|
+
async fetchEditingData({ itemId, language, version, layoutKind = LayoutKind.Final, mode }, fetchOptions) {
|
|
38
|
+
var _a;
|
|
39
|
+
debug.editing('fetching editing data for %s %s %s %s', itemId, language, version, layoutKind);
|
|
96
40
|
if (!language) {
|
|
97
41
|
throw new RangeError('The language must be a non-empty string');
|
|
98
42
|
}
|
|
99
|
-
let initDictionary = [];
|
|
100
|
-
let hasNext = true;
|
|
101
|
-
let after = '';
|
|
102
43
|
const editModeHeader = mode === 'edit' ? 'true' : 'false';
|
|
103
44
|
const editingData = await this.graphQLClient.request(query, {
|
|
104
|
-
siteName,
|
|
105
45
|
itemId,
|
|
106
46
|
version,
|
|
107
47
|
language,
|
|
@@ -109,54 +49,15 @@ export class EditingService {
|
|
|
109
49
|
sc_layoutKind: layoutKind,
|
|
110
50
|
sc_editMode: editModeHeader,
|
|
111
51
|
} }));
|
|
112
|
-
if ((_b = (_a = editingData === null || editingData === void 0 ? void 0 : editingData.site) === null || _a === void 0 ? void 0 : _a.siteInfo) === null || _b === void 0 ? void 0 : _b.dictionary) {
|
|
113
|
-
initDictionary = editingData.site.siteInfo.dictionary.results;
|
|
114
|
-
hasNext = editingData.site.siteInfo.dictionary.pageInfo.hasNext;
|
|
115
|
-
after = editingData.site.siteInfo.dictionary.pageInfo.endCursor;
|
|
116
|
-
}
|
|
117
|
-
else {
|
|
118
|
-
hasNext = false;
|
|
119
|
-
}
|
|
120
|
-
const dictionary = await this.fetchDictionaryData({
|
|
121
|
-
siteName,
|
|
122
|
-
language,
|
|
123
|
-
initDictionary,
|
|
124
|
-
hasNext,
|
|
125
|
-
after,
|
|
126
|
-
}, fetchOptions);
|
|
127
52
|
return {
|
|
128
|
-
layoutData: ((
|
|
53
|
+
layoutData: ((_a = editingData === null || editingData === void 0 ? void 0 : editingData.item) === null || _a === void 0 ? void 0 : _a.rendered) || {
|
|
129
54
|
sitecore: {
|
|
130
55
|
context: { pageEditing: true, language },
|
|
131
56
|
route: null,
|
|
132
57
|
},
|
|
133
58
|
},
|
|
134
|
-
dictionary,
|
|
135
59
|
};
|
|
136
60
|
}
|
|
137
|
-
async fetchDictionaryData({ siteName, language, initDictionary, hasNext, after, }, fetchOptions) {
|
|
138
|
-
var _a, _b;
|
|
139
|
-
hasNext = hasNext !== undefined ? hasNext : true;
|
|
140
|
-
let dictionaryResults = initDictionary || [];
|
|
141
|
-
const dictionary = {};
|
|
142
|
-
while (hasNext) {
|
|
143
|
-
const data = await this.graphQLClient.request(dictionaryQuery, {
|
|
144
|
-
siteName,
|
|
145
|
-
language,
|
|
146
|
-
after,
|
|
147
|
-
}, fetchOptions);
|
|
148
|
-
if ((_b = (_a = data === null || data === void 0 ? void 0 : data.site) === null || _a === void 0 ? void 0 : _a.siteInfo) === null || _b === void 0 ? void 0 : _b.dictionary) {
|
|
149
|
-
dictionaryResults = dictionaryResults.concat(data.site.siteInfo.dictionary.results);
|
|
150
|
-
hasNext = data.site.siteInfo.dictionary.pageInfo.hasNext;
|
|
151
|
-
after = data.site.siteInfo.dictionary.pageInfo.endCursor;
|
|
152
|
-
}
|
|
153
|
-
else {
|
|
154
|
-
hasNext = false;
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
dictionaryResults.forEach((item) => (dictionary[item.key] = item.value));
|
|
158
|
-
return dictionary;
|
|
159
|
-
}
|
|
160
61
|
/**
|
|
161
62
|
* Gets a GraphQL client that can make requests to the API.
|
|
162
63
|
* @returns {GraphQLClient} implementation
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sitecore-content-sdk/core",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.1.0-canary.2",
|
|
4
4
|
"main": "dist/cjs/index.js",
|
|
5
5
|
"module": "dist/esm/index.js",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
},
|
|
79
79
|
"description": "",
|
|
80
80
|
"types": "types/index.d.ts",
|
|
81
|
-
"gitHead": "
|
|
81
|
+
"gitHead": "67b62a1d840977f00d59e870369ee454dcc89fa2",
|
|
82
82
|
"files": [
|
|
83
83
|
"dist",
|
|
84
84
|
"types",
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { LayoutServiceData } from '../layout/models';
|
|
2
2
|
import { DesignLibraryMode } from './models';
|
|
3
|
+
import { FetchOptions } from '../models';
|
|
3
4
|
/**
|
|
4
5
|
* Params for requesting component data in Design Library mode
|
|
5
6
|
*/
|
|
@@ -64,7 +65,7 @@ export interface ComponentLayoutServiceConfig {
|
|
|
64
65
|
export declare class ComponentLayoutService {
|
|
65
66
|
private config;
|
|
66
67
|
constructor(config: ComponentLayoutServiceConfig);
|
|
67
|
-
fetchComponentData(params: ComponentLayoutRequestParams): Promise<LayoutServiceData>;
|
|
68
|
+
fetchComponentData(params: ComponentLayoutRequestParams, fetchOptions?: FetchOptions): Promise<LayoutServiceData>;
|
|
68
69
|
protected getComponentFetchParams(params: ComponentLayoutRequestParams): any;
|
|
69
70
|
/**
|
|
70
71
|
* Get the fetch URL for the partial layout data endpoint
|
|
@@ -1,38 +1,15 @@
|
|
|
1
|
-
import { PageInfo } from '../client';
|
|
2
1
|
import { GraphQLClient, GraphQLRequestClientFactory } from '../graphql-request-client';
|
|
3
|
-
import { DictionaryPhrases } from '../i18n';
|
|
4
2
|
import { LayoutServiceData, LayoutServicePageState } from '../layout';
|
|
5
3
|
import { LayoutKind } from './models';
|
|
6
4
|
import { FetchOptions } from '../models';
|
|
7
5
|
/**
|
|
8
6
|
* GraphQL query for fetching editing data.
|
|
9
7
|
*/
|
|
10
|
-
export declare const query = "\n
|
|
11
|
-
/**
|
|
12
|
-
* GraphQL query for fetching dictionary data.
|
|
13
|
-
* This query is used when the dictionary data is paginated.
|
|
14
|
-
*/
|
|
15
|
-
export declare const dictionaryQuery = "\n query EditingDictionaryQuery(\n $siteName: String!\n $language: String!\n $after: String\n $pageSize: Int = 1000\n ) {\n site {\n siteInfo(site: $siteName) {\n dictionary(language: $language, first: $pageSize, after: $after) {\n results {\n key\n value\n }\n pageInfo {\n endCursor\n hasNext\n }\n }\n }\n }\n }\n";
|
|
16
|
-
/**
|
|
17
|
-
* Response from the GraphQL Dictionary query.
|
|
18
|
-
*/
|
|
19
|
-
export type GraphQLDictionaryQueryResponse = {
|
|
20
|
-
site: {
|
|
21
|
-
siteInfo: {
|
|
22
|
-
dictionary: {
|
|
23
|
-
results: {
|
|
24
|
-
key: string;
|
|
25
|
-
value: string;
|
|
26
|
-
}[];
|
|
27
|
-
pageInfo: PageInfo;
|
|
28
|
-
};
|
|
29
|
-
};
|
|
30
|
-
};
|
|
31
|
-
};
|
|
8
|
+
export declare const query = "\n query EditingQuery($itemId: String!, $language: String!, $version: String) {\n item(path: $itemId, language: $language, version: $version) {\n rendered\n }\n }\n";
|
|
32
9
|
/**
|
|
33
10
|
* Response from the GraphQL Editing query.
|
|
34
11
|
*/
|
|
35
|
-
export type GraphQLEditingQueryResponse =
|
|
12
|
+
export type GraphQLEditingQueryResponse = {
|
|
36
13
|
item: {
|
|
37
14
|
rendered: LayoutServiceData;
|
|
38
15
|
};
|
|
@@ -45,7 +22,6 @@ export interface EditingServiceConfig {
|
|
|
45
22
|
clientFactory: GraphQLRequestClientFactory;
|
|
46
23
|
}
|
|
47
24
|
export type EditingOptions = {
|
|
48
|
-
siteName: string;
|
|
49
25
|
itemId: string;
|
|
50
26
|
language: string;
|
|
51
27
|
version?: string;
|
|
@@ -67,7 +43,6 @@ export declare class EditingService {
|
|
|
67
43
|
/**
|
|
68
44
|
* Fetches editing data. Provides the layout data and dictionary phrases
|
|
69
45
|
* @param {object} variables - The parameters for fetching editing data.
|
|
70
|
-
* @param {string} variables.siteName - The site name.
|
|
71
46
|
* @param {string} variables.itemId - The item id (path) to fetch layout data for.
|
|
72
47
|
* @param {string} variables.language - The language to fetch layout data for.
|
|
73
48
|
* @param {string} variables.mode - The editing mode to fetch layout data for.
|
|
@@ -76,20 +51,9 @@ export declare class EditingService {
|
|
|
76
51
|
* @param {FetchOptions} [fetchOptions] Options to override graphQL client details like retries and fetch implementation
|
|
77
52
|
* @returns {Promise} The layout data and dictionary phrases.
|
|
78
53
|
*/
|
|
79
|
-
fetchEditingData({
|
|
54
|
+
fetchEditingData({ itemId, language, version, layoutKind, mode }: EditingOptions, fetchOptions?: FetchOptions): Promise<{
|
|
80
55
|
layoutData: LayoutServiceData;
|
|
81
|
-
dictionary: DictionaryPhrases;
|
|
82
56
|
}>;
|
|
83
|
-
fetchDictionaryData({ siteName, language, initDictionary, hasNext, after, }: {
|
|
84
|
-
siteName: string;
|
|
85
|
-
language: string;
|
|
86
|
-
hasNext?: boolean;
|
|
87
|
-
initDictionary?: {
|
|
88
|
-
key: string;
|
|
89
|
-
value: string;
|
|
90
|
-
}[];
|
|
91
|
-
after?: string;
|
|
92
|
-
}, fetchOptions?: FetchOptions): Promise<DictionaryPhrases>;
|
|
93
57
|
/**
|
|
94
58
|
* Gets a GraphQL client that can make requests to the API.
|
|
95
59
|
* @returns {GraphQLClient} implementation
|