@raketa-cloud/admin 1.8.9 → 1.8.11

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 (106) hide show
  1. package/dist/application.css +113 -24
  2. package/package.json +5 -3
  3. package/src/HonoAdapter.js +23 -23
  4. package/src/Logger.js +7 -8
  5. package/src/RaketaContext.js +1 -0
  6. package/src/cipher.js +2 -2
  7. package/src/cloud/ContentTasks.js +31 -0
  8. package/src/cloud/RaketaClient.js +1 -1
  9. package/src/cloud/Redirects.js +2 -2
  10. package/src/cloud/ResourceChanges.js +1 -1
  11. package/src/cloud/ResourceRevisions.js +2 -2
  12. package/src/cloud/Resources.js +28 -12
  13. package/src/cloud/Tags.js +4 -4
  14. package/src/cloud/documents/common.js +16 -0
  15. package/src/cloud/documents/contentTasksDocuments.js +59 -0
  16. package/src/cloud/documents/resourcesDocuments.js +12 -0
  17. package/src/filters.js +3 -3
  18. package/src/handlers/TagsHandler.js +2 -2
  19. package/src/handlers/_shared/getResourceUpdateDestination.js +1 -1
  20. package/src/handlers/categories/index.js +3 -3
  21. package/src/handlers/content_tasks/ContentTasksHandler.js +32 -0
  22. package/src/handlers/resource_revisions/LocksHandler.js +4 -1
  23. package/src/handlers/resources/ClonesHandler.js +1 -3
  24. package/src/handlers/resources/ExportsHandler.js +1 -5
  25. package/src/handlers/resources/ResourcesHandler.js +1 -1
  26. package/src/handlers/resources/TranslationsHandler.js +28 -19
  27. package/src/handlers/resources/URLsHandler.js +3 -1
  28. package/src/helpers/AuthHelper.js +1 -1
  29. package/src/helpers/FormBuilder.js +14 -14
  30. package/src/helpers/Pagination.js +5 -5
  31. package/src/helpers/historyUtils.js +3 -3
  32. package/src/helpers/utils.js +6 -1
  33. package/src/index.js +2 -1
  34. package/src/routeMember.js +9 -4
  35. package/src/routeNestedCollection.js +14 -29
  36. package/src/routeNestedMember.js +17 -6
  37. package/src/{routeResource.js → routeResourceModule.js} +25 -20
  38. package/src/routeStandard.js +8 -4
  39. package/src/setupAuthentication.js +1 -1
  40. package/src/setupCloud.js +5 -0
  41. package/src/tests/Adapter.test.js +2 -2
  42. package/src/tests/HonoAdapter.coverage.test.js +47 -25
  43. package/src/tests/HonoAdapter.filter.test.js +28 -18
  44. package/src/tests/HonoAdapter.test.js +3 -3
  45. package/src/tests/RaketaClient.test.js +427 -413
  46. package/src/tests/RaketaContext.test.js +1 -1
  47. package/src/tests/buildResourcePath.test.js +1 -1
  48. package/src/tests/cipher.test.js +16 -16
  49. package/src/tests/filters.test.js +24 -24
  50. package/src/tests/handlers/RedirectsHandler.test/destroy.test.js +1 -1
  51. package/src/tests/handlers/TagsHandler.test/create.test.js +2 -2
  52. package/src/tests/handlers/TagsHandler.test/destroy.test.js +1 -1
  53. package/src/tests/handlers/TagsHandler.test/update.test.js +2 -2
  54. package/src/tests/handlers/categories/create.test.js +2 -2
  55. package/src/tests/handlers/categories/destroy.test.js +1 -1
  56. package/src/tests/handlers/content_tasks/ContentTasksHandler.test/index.test.js +161 -0
  57. package/src/tests/handlers/resource_revisions/CancelSchedulesHandler.test/create.test.js +2 -2
  58. package/src/tests/handlers/resource_revisions/CodeHandler.test/update.test.js +1 -1
  59. package/src/tests/handlers/resource_revisions/GeneralHandler.test/update.test.js +1 -1
  60. package/src/tests/handlers/resource_revisions/LocksHandler.test/create.test.js +5 -5
  61. package/src/tests/handlers/resource_revisions/LocksHandler.test/create_form.test.js +6 -2
  62. package/src/tests/handlers/resource_revisions/MetaHandler.test/update.test.js +1 -1
  63. package/src/tests/handlers/resource_revisions/PublishesHandler.test/create.test.js +5 -5
  64. package/src/tests/handlers/resource_revisions/ResourceRevisionsHandler.test/create.test.js +2 -2
  65. package/src/tests/handlers/resource_revisions/ResourceRevisionsHandler.test/destroy.test.js +1 -1
  66. package/src/tests/handlers/resource_revisions/RevertsHandler.test/create.test.js +18 -3
  67. package/src/tests/handlers/resource_revisions/TagHandler.test/update.test.js +1 -1
  68. package/src/tests/handlers/resource_revisions/UnlocksHandler.test/create.test.js +2 -2
  69. package/src/tests/handlers/resource_revisions/VisualHandler.test/update.test.js +1 -1
  70. package/src/tests/handlers/resource_revisions/WidgetHandler.test/update.test.js +2 -2
  71. package/src/tests/handlers/resources/ChangeHandler.test/show.test.js +7 -2
  72. package/src/tests/handlers/resources/ClonesHandler.test/create.test.js +1 -3
  73. package/src/tests/handlers/resources/ExportsHandler.test/index.test.js +8 -8
  74. package/src/tests/handlers/resources/HistoryHandler.test/index.test.js +1 -1
  75. package/src/tests/handlers/resources/ResourcesAPIHandler.test/index.test.js +1 -5
  76. package/src/tests/handlers/resources/ResourcesHandler.test/create.test.js +2 -2
  77. package/src/tests/handlers/resources/ResourcesHandler.test/show.test.js +1 -1
  78. package/src/tests/handlers/resources/TranslationsHandler.test/create.test.js +24 -14
  79. package/src/tests/handlers/resources/TranslationsHandler.test/create_form.test.js +1 -1
  80. package/src/tests/handlers/resources/TranslationsHandler.test/index.test.js +3 -3
  81. package/src/tests/handlers/resources/URLsHandler.test/create.test.js +4 -6
  82. package/src/tests/helpers/AuthHelper.test.js +11 -12
  83. package/src/tests/helpers/CSVExportHelper.test.js +3 -3
  84. package/src/tests/helpers/FormBuilder.test.js +21 -21
  85. package/src/tests/helpers/HTMLBuilder.test.js +4 -4
  86. package/src/tests/helpers/Inflector.test.js +1 -1
  87. package/src/tests/helpers/Pagination.test.js +1 -1
  88. package/src/tests/helpers/utils.test.js +46 -0
  89. package/src/tests/routeCategoriesModule.test.js +10 -5
  90. package/src/tests/routeCollection.test.js +1 -1
  91. package/src/tests/routeMember.test.js +2 -2
  92. package/src/tests/routeNestedCollection.test.js +3 -3
  93. package/src/tests/routeNestedMember.test.js +3 -3
  94. package/src/tests/{routeResource.test.js → routeResourceModule.test.js} +28 -25
  95. package/src/tests/routeSettings.test.js +3 -3
  96. package/src/tests/routeStandard.test.js +31 -13
  97. package/src/tests/setupAuthentication.test.js +9 -6
  98. package/src/tests/support/factory.js +33 -0
  99. package/src/tests/utils.test.js +19 -19
  100. package/src/views/content_tasks/index.ejs +191 -0
  101. package/src/views/layouts/application.ejs +2 -1
  102. package/src/views/resources/_shared/_toolbar.ejs +33 -2
  103. package/src/views/resources/_shared/_translations_strip.ejs +71 -0
  104. package/src/views/resources/index.ejs +5 -0
  105. package/src/views/resources/show.ejs +1 -29
  106. package/src/views/resources/translations/create_form.ejs +13 -0
@@ -1566,14 +1566,6 @@ select {
1566
1566
  pointer-events: none;
1567
1567
  }
1568
1568
 
1569
- .visible {
1570
- visibility: visible;
1571
- }
1572
-
1573
- .collapse {
1574
- visibility: collapse;
1575
- }
1576
-
1577
1569
  .static {
1578
1570
  position: static;
1579
1571
  }
@@ -1594,10 +1586,26 @@ select {
1594
1586
  position: sticky;
1595
1587
  }
1596
1588
 
1589
+ .-right-0 {
1590
+ right: -0px;
1591
+ }
1592
+
1593
+ .-right-0\.5 {
1594
+ right: -0.125rem;
1595
+ }
1596
+
1597
1597
  .-right-4 {
1598
1598
  right: -1rem;
1599
1599
  }
1600
1600
 
1601
+ .-top-0 {
1602
+ top: -0px;
1603
+ }
1604
+
1605
+ .-top-0\.5 {
1606
+ top: -0.125rem;
1607
+ }
1608
+
1601
1609
  .bottom-20 {
1602
1610
  bottom: 5rem;
1603
1611
  }
@@ -1737,10 +1745,6 @@ select {
1737
1745
  display: inline-flex;
1738
1746
  }
1739
1747
 
1740
- .\!table {
1741
- display: table !important;
1742
- }
1743
-
1744
1748
  .table {
1745
1749
  display: table;
1746
1750
  }
@@ -1749,6 +1753,10 @@ select {
1749
1753
  display: grid;
1750
1754
  }
1751
1755
 
1756
+ .contents {
1757
+ display: contents;
1758
+ }
1759
+
1752
1760
  .hidden {
1753
1761
  display: none;
1754
1762
  }
@@ -1757,6 +1765,11 @@ select {
1757
1765
  aspect-ratio: 1 / 1;
1758
1766
  }
1759
1767
 
1768
+ .size-12 {
1769
+ width: 3rem;
1770
+ height: 3rem;
1771
+ }
1772
+
1760
1773
  .size-14 {
1761
1774
  width: 3.5rem;
1762
1775
  height: 3.5rem;
@@ -1782,6 +1795,10 @@ select {
1782
1795
  height: 2rem;
1783
1796
  }
1784
1797
 
1798
+ .h-3 {
1799
+ height: 0.75rem;
1800
+ }
1801
+
1785
1802
  .h-5 {
1786
1803
  height: 1.25rem;
1787
1804
  }
@@ -1819,10 +1836,18 @@ select {
1819
1836
  width: 50%;
1820
1837
  }
1821
1838
 
1839
+ .w-1\/3 {
1840
+ width: 33.333333%;
1841
+ }
1842
+
1822
1843
  .w-16 {
1823
1844
  width: 4rem;
1824
1845
  }
1825
1846
 
1847
+ .w-3 {
1848
+ width: 0.75rem;
1849
+ }
1850
+
1826
1851
  .w-48 {
1827
1852
  width: 12rem;
1828
1853
  }
@@ -1872,6 +1897,17 @@ select {
1872
1897
  transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
1873
1898
  }
1874
1899
 
1900
+ @keyframes ping {
1901
+ 75%, 100% {
1902
+ transform: scale(2);
1903
+ opacity: 0;
1904
+ }
1905
+ }
1906
+
1907
+ .animate-ping {
1908
+ animation: ping 1s cubic-bezier(0, 0, 0.2, 1) infinite;
1909
+ }
1910
+
1875
1911
  .cursor-not-allowed {
1876
1912
  cursor: not-allowed;
1877
1913
  }
@@ -1880,10 +1916,6 @@ select {
1880
1916
  cursor: pointer;
1881
1917
  }
1882
1918
 
1883
- .resize {
1884
- resize: both;
1885
- }
1886
-
1887
1919
  .flex-col {
1888
1920
  flex-direction: column;
1889
1921
  }
@@ -2015,6 +2047,16 @@ select {
2015
2047
  background-color: rgb(0 0 0 / var(--tw-bg-opacity));
2016
2048
  }
2017
2049
 
2050
+ .bg-blue-100 {
2051
+ --tw-bg-opacity: 1;
2052
+ background-color: rgb(219 234 254 / var(--tw-bg-opacity));
2053
+ }
2054
+
2055
+ .bg-emerald-100 {
2056
+ --tw-bg-opacity: 1;
2057
+ background-color: rgb(209 250 229 / var(--tw-bg-opacity));
2058
+ }
2059
+
2018
2060
  .bg-orange-100 {
2019
2061
  --tw-bg-opacity: 1;
2020
2062
  background-color: rgb(255 237 213 / var(--tw-bg-opacity));
@@ -2038,6 +2080,11 @@ select {
2038
2080
  background-color: rgba(var(--primary), 0.05);
2039
2081
  }
2040
2082
 
2083
+ .bg-red-100 {
2084
+ --tw-bg-opacity: 1;
2085
+ background-color: rgb(254 226 226 / var(--tw-bg-opacity));
2086
+ }
2087
+
2041
2088
  .bg-white {
2042
2089
  --tw-bg-opacity: 1;
2043
2090
  background-color: rgb(255 255 255 / var(--tw-bg-opacity));
@@ -2190,11 +2237,21 @@ select {
2190
2237
  color: rgb(60 64 67 / var(--tw-text-opacity));
2191
2238
  }
2192
2239
 
2240
+ .text-blue-700 {
2241
+ --tw-text-opacity: 1;
2242
+ color: rgb(29 78 216 / var(--tw-text-opacity));
2243
+ }
2244
+
2193
2245
  .text-emerald-600 {
2194
2246
  --tw-text-opacity: 1;
2195
2247
  color: rgb(5 150 105 / var(--tw-text-opacity));
2196
2248
  }
2197
2249
 
2250
+ .text-emerald-700 {
2251
+ --tw-text-opacity: 1;
2252
+ color: rgb(4 120 87 / var(--tw-text-opacity));
2253
+ }
2254
+
2198
2255
  .text-gray-400 {
2199
2256
  --tw-text-opacity: 1;
2200
2257
  color: rgb(156 163 175 / var(--tw-text-opacity));
@@ -2218,6 +2275,10 @@ select {
2218
2275
  color: rgba(var(--foreground), 0.5);
2219
2276
  }
2220
2277
 
2278
+ .text-raketa-foreground\/70 {
2279
+ color: rgba(var(--foreground), 0.7);
2280
+ }
2281
+
2221
2282
  .text-raketa-primary {
2222
2283
  --tw-text-opacity: 1;
2223
2284
  color: rgba(var(--primary), var(--tw-text-opacity));
@@ -2233,6 +2294,11 @@ select {
2233
2294
  color: rgb(220 38 38 / var(--tw-text-opacity));
2234
2295
  }
2235
2296
 
2297
+ .text-red-700 {
2298
+ --tw-text-opacity: 1;
2299
+ color: rgb(185 28 28 / var(--tw-text-opacity));
2300
+ }
2301
+
2236
2302
  .text-rose-600 {
2237
2303
  --tw-text-opacity: 1;
2238
2304
  color: rgb(225 29 72 / var(--tw-text-opacity));
@@ -2243,14 +2309,6 @@ select {
2243
2309
  color: rgb(255 255 255 / var(--tw-text-opacity));
2244
2310
  }
2245
2311
 
2246
- .underline {
2247
- text-decoration-line: underline;
2248
- }
2249
-
2250
- .overline {
2251
- text-decoration-line: overline;
2252
- }
2253
-
2254
2312
  .opacity-10 {
2255
2313
  opacity: 0.1;
2256
2314
  }
@@ -2267,6 +2325,10 @@ select {
2267
2325
  opacity: 0.6;
2268
2326
  }
2269
2327
 
2328
+ .opacity-75 {
2329
+ opacity: 0.75;
2330
+ }
2331
+
2270
2332
  .shadow-inner {
2271
2333
  --tw-shadow: inset 0 2px 4px 0 rgb(0 0 0 / 0.05);
2272
2334
  --tw-shadow-colored: inset 0 2px 4px 0 var(--tw-shadow-color);
@@ -3172,6 +3234,14 @@ body {
3172
3234
  border-color: rgb(64 64 64 / var(--tw-border-opacity));
3173
3235
  }
3174
3236
 
3237
+ .dark\:bg-blue-900\/50:where(.dark, .dark *) {
3238
+ background-color: rgb(30 58 138 / 0.5);
3239
+ }
3240
+
3241
+ .dark\:bg-emerald-900\/50:where(.dark, .dark *) {
3242
+ background-color: rgb(6 78 59 / 0.5);
3243
+ }
3244
+
3175
3245
  .dark\:bg-orange-900\/50:where(.dark, .dark *) {
3176
3246
  background-color: rgb(124 45 18 / 0.5);
3177
3247
  }
@@ -3180,11 +3250,30 @@ body {
3180
3250
  background-color: rgba(var(--primary), 0.15);
3181
3251
  }
3182
3252
 
3253
+ .dark\:bg-red-900\/50:where(.dark, .dark *) {
3254
+ background-color: rgb(127 29 29 / 0.5);
3255
+ }
3256
+
3257
+ .dark\:text-blue-300:where(.dark, .dark *) {
3258
+ --tw-text-opacity: 1;
3259
+ color: rgb(147 197 253 / var(--tw-text-opacity));
3260
+ }
3261
+
3262
+ .dark\:text-emerald-300:where(.dark, .dark *) {
3263
+ --tw-text-opacity: 1;
3264
+ color: rgb(110 231 183 / var(--tw-text-opacity));
3265
+ }
3266
+
3183
3267
  .dark\:text-orange-300:where(.dark, .dark *) {
3184
3268
  --tw-text-opacity: 1;
3185
3269
  color: rgb(253 186 116 / var(--tw-text-opacity));
3186
3270
  }
3187
3271
 
3272
+ .dark\:text-red-300:where(.dark, .dark *) {
3273
+ --tw-text-opacity: 1;
3274
+ color: rgb(252 165 165 / var(--tw-text-opacity));
3275
+ }
3276
+
3188
3277
  .dark\:invert:where(.dark, .dark *) {
3189
3278
  --tw-invert: invert(100%);
3190
3279
  filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@raketa-cloud/admin",
3
- "version": "1.8.9",
3
+ "version": "1.8.11",
4
4
  "main": "src/index.js",
5
5
  "files": [
6
6
  "src/",
@@ -9,10 +9,12 @@
9
9
  "scripts": {
10
10
  "dev": "npx tailwindcss -i ./src/styles/application.css -o ../../apps/admin/static/application.css --watch",
11
11
  "test": "jest --coverage --coverageReporters=html --coverageReporters=\"text-summary\"",
12
- "prepare": "npx tailwindcss -i ./src/styles/application.css -o ./dist/application.css"
12
+ "prepare": "npx tailwindcss -i ./src/styles/application.css -o ./dist/application.css",
13
+ "lint": "biome lint .",
14
+ "lint:fix": "biome lint --write --unsafe ."
13
15
  },
14
16
  "devDependencies": {
15
- "@babel/core": "7.29.0",
17
+ "@babel/core": "7.29.7",
16
18
  "@babel/preset-env": "7.29.0",
17
19
  "@babel/preset-typescript": "7.28.5",
18
20
  "@repo/typescript-config": "*",
@@ -65,19 +65,13 @@ function putIn(result, key, value) {
65
65
  const sanitizePath = (filePath) =>
66
66
  path.normalize(path.join("/", ...filePath.split("/")));
67
67
 
68
- function packageFallbackPaths(views, suffix) {
69
- const rest = views.split("/").slice(1);
70
- return ["resources", "resource_revisions"].map((base) =>
71
- sanitizePath(`${currentPath}/views/${[base, ...rest].join("/")}/${suffix}`),
72
- );
73
- }
74
-
75
68
  // Find template path, preferring an app override over the package template
76
- function getPartialPath(partialPath, views) {
69
+ function getPartialPath(partialPath, views, viewsFallback) {
77
70
  const paths = [
78
71
  sanitizePath(`${process.cwd()}/src/views/${views}/${partialPath}`),
79
72
  sanitizePath(`${currentPath}/views/${views}/${partialPath}`),
80
- ...packageFallbackPaths(views, partialPath),
73
+ viewsFallback &&
74
+ sanitizePath(`${currentPath}/views/${viewsFallback}/${partialPath}`),
81
75
  ].filter(Boolean);
82
76
 
83
77
  // Return first existing path
@@ -143,17 +137,14 @@ export default class HonoAdapter {
143
137
  this.globalAfterFilters.push({ pattern, filter });
144
138
  }
145
139
 
146
- getActionPath(views, action) {
147
- const appPath = `${process.cwd()}/src/views/${views}/${action}.ejs`;
148
- if (existsSync(appPath)) return appPath;
140
+ getActionPath(views, viewsFallback, action) {
141
+ const packagePath = viewsFallback
142
+ ? `${currentPath}/views/${viewsFallback}/${action}.ejs`
143
+ : `${currentPath}/views/${views}/${action}.ejs`;
149
144
 
150
- const packagePath = `${currentPath}/views/${views}/${action}.ejs`;
151
- if (existsSync(packagePath)) return packagePath;
145
+ const appPath = `${process.cwd()}/src/views/${views}/${action}.ejs`;
152
146
 
153
- const fallback = packageFallbackPaths(views, `${action}.ejs`).find(
154
- existsSync,
155
- );
156
- return fallback ?? packagePath;
147
+ return existsSync(appPath) ? appPath : packagePath;
157
148
  }
158
149
 
159
150
  getHelpers(viewHelpersConfig) {
@@ -181,9 +172,9 @@ export default class HonoAdapter {
181
172
  });
182
173
  }
183
174
 
184
- renderPartial(assigns, views) {
175
+ renderPartial(assigns, views, viewsFallback) {
185
176
  return function render(relativePath, localAssigns) {
186
- const partialPath = getPartialPath(relativePath, views);
177
+ const partialPath = getPartialPath(relativePath, views, viewsFallback);
187
178
 
188
179
  try {
189
180
  // Synchronously read the partial file as ejs does not support async/await
@@ -207,11 +198,18 @@ export default class HonoAdapter {
207
198
  };
208
199
  }
209
200
 
210
- async renderAction({ views, action, assigns }, viewHelpersConfig = {}) {
201
+ async renderAction(
202
+ { views, viewsFallback, action, assigns },
203
+ viewHelpersConfig = {},
204
+ ) {
211
205
  // Pick the parent here in the views so we can reuse stuff...
212
- const fullTemplatePath = this.getActionPath(views, action);
206
+ const fullTemplatePath = this.getActionPath(views, viewsFallback, action);
213
207
  const renderAssigns = { ...this.getHelpers(viewHelpersConfig), ...assigns };
214
- const renderPartialHelper = this.renderPartial(renderAssigns, views);
208
+ const renderPartialHelper = this.renderPartial(
209
+ renderAssigns,
210
+ views,
211
+ viewsFallback,
212
+ );
215
213
 
216
214
  try {
217
215
  // Synchronously read the full template file
@@ -315,6 +313,7 @@ export default class HonoAdapter {
315
313
  maxOpenRevisions: this.globalConfig?.maxOpenRevisions || 3,
316
314
  locale: currentLocale,
317
315
  remoteConfig: { ...this.globalConfig.remoteConfig },
316
+ globalConfig: this.globalConfig,
318
317
  logger: Logger,
319
318
  });
320
319
 
@@ -401,6 +400,7 @@ export default class HonoAdapter {
401
400
  const rendered = this.renderAction(
402
401
  {
403
402
  views,
403
+ viewsFallback: resourceConfig.viewsFallback,
404
404
  action,
405
405
  assigns: fullAssigns,
406
406
  },
package/src/Logger.js CHANGED
@@ -1,21 +1,20 @@
1
- import { inspect } from 'node:util';
1
+ import { inspect } from "node:util";
2
2
 
3
-
4
- const dump = (item) => inspect(item, { depth: null }).replace(/^\'/, '').replace(/\'$/, '')
3
+ const dump = (item) =>
4
+ inspect(item, { depth: null }).replace(/^\'/, "").replace(/\'$/, "");
5
5
 
6
6
  const Logger = {
7
7
  error: (item) => {
8
- console.error('[ERROR]', dump(item));
8
+ console.error("[ERROR]", dump(item));
9
9
  },
10
10
 
11
11
  info: (item) => {
12
- console.info('[INFO]', dump(item));
12
+ console.info("[INFO]", dump(item));
13
13
  },
14
14
 
15
15
  debug: (item) => {
16
- console.debug('[DEBUG]', dump(item));
16
+ console.debug("[DEBUG]", dump(item));
17
17
  },
18
- }
18
+ };
19
19
 
20
20
  export default Logger;
21
-
@@ -39,6 +39,7 @@ export default class RaketaContext {
39
39
 
40
40
  initGlobalContext() {
41
41
  const global = this.getGlobalCtx(this);
42
+
42
43
  for (const key in global) {
43
44
  this[key] = global[key];
44
45
  }
package/src/cipher.js CHANGED
@@ -17,7 +17,7 @@ function encrypt(plaintext, config) {
17
17
  const cipher = createCipheriv(
18
18
  ALGORITHM,
19
19
  deriveKey(config.secrets.crypto_secret),
20
- IV
20
+ IV,
21
21
  );
22
22
 
23
23
  let encrypted = cipher.update(plaintext, "utf8", "hex");
@@ -34,7 +34,7 @@ function decrypt(encryptedText, config) {
34
34
  const decipher = createDecipheriv(
35
35
  ALGORITHM,
36
36
  deriveKey(config.secrets.crypto_secret),
37
- iv
37
+ iv,
38
38
  );
39
39
 
40
40
  let decrypted = decipher.update(encrypted, "hex", "utf8");
@@ -0,0 +1,31 @@
1
+ import RaketaClient from "./RaketaClient.js";
2
+ import {
3
+ ContentTasksDocument,
4
+ ContentTaskEditorsDocument,
5
+ } from "./documents/contentTasksDocuments.js";
6
+
7
+ export default class ContentTasks extends RaketaClient {
8
+ async list(query) {
9
+ const vars = this.buildListInput(query);
10
+
11
+ // Format date filters if any
12
+ if (vars.input.filters) {
13
+ vars.input.filters = this.formatDateFilters(vars.input.filters);
14
+ }
15
+
16
+ const { contentTasks: items } = await this.query(ContentTasksDocument, {
17
+ input: vars.input.filters || vars.input.pagination ? vars.input : null,
18
+ });
19
+
20
+ return items;
21
+ }
22
+
23
+ async editors() {
24
+ const { contentTaskEditors } = await this.query(
25
+ ContentTaskEditorsDocument,
26
+ {},
27
+ );
28
+
29
+ return contentTaskEditors;
30
+ }
31
+ }
@@ -105,7 +105,7 @@ export default class RaketaClient {
105
105
  "x-raketa-project": this.getConfig().cloud.gateway_project,
106
106
  "x-raketa-service": this.getConfig().cloud.dxp_service_private,
107
107
  "x-raketa-identity": this.token,
108
- }
108
+ },
109
109
  );
110
110
  }
111
111
 
@@ -12,7 +12,7 @@ export default class Redirects extends RaketaClient {
12
12
  async list(query) {
13
13
  const { redirects: items } = await this.query(
14
14
  RedirectsDocument,
15
- this.buildListInput(query)
15
+ this.buildListInput(query),
16
16
  );
17
17
 
18
18
  return items;
@@ -73,7 +73,7 @@ export default class Redirects extends RaketaClient {
73
73
  id,
74
74
  locale: "en",
75
75
  },
76
- }
76
+ },
77
77
  );
78
78
 
79
79
  return items;
@@ -21,7 +21,7 @@ export default class ResourceChanges extends RaketaClient {
21
21
  page_size: 50,
22
22
  },
23
23
  },
24
- }
24
+ },
25
25
  );
26
26
 
27
27
  return items;
@@ -39,7 +39,7 @@ export default class ResourceRevisions extends RaketaClient {
39
39
  locale,
40
40
  resourceType,
41
41
  },
42
- }
42
+ },
43
43
  );
44
44
 
45
45
  return items;
@@ -121,7 +121,7 @@ export default class ResourceRevisions extends RaketaClient {
121
121
 
122
122
  async createBatch(revisionInputs) {
123
123
  const BatchStartRevisionDocument = buildBatchStartResourceRevisionDocument(
124
- revisionInputs.length
124
+ revisionInputs.length,
125
125
  );
126
126
 
127
127
  const variables = {};
@@ -133,40 +133,56 @@ export default class Resources extends RaketaClient {
133
133
  return { resource, errors };
134
134
  }
135
135
 
136
- async translate(id, locale, params, resourceType) {
136
+ async translate(id, locale, params, resourceType, workflow) {
137
137
  const paramsCopy = { ...params, resourceType };
138
138
  paramsCopy.widgets = JSON.stringify(paramsCopy.widgets);
139
139
  paramsCopy.settings = JSON.stringify(paramsCopy.settings);
140
140
 
141
+ const input = {
142
+ locale,
143
+ sourceResourceId: id,
144
+ resource: paramsCopy,
145
+ };
146
+
147
+ if (workflow) {
148
+ input.workflow = workflow;
149
+ }
150
+
141
151
  const {
142
152
  translateResource: { errors, resource },
143
- } = await this.query(TranslateResourceDocument, {
144
- input: {
145
- locale,
146
- sourceResourceId: id,
147
- resource: paramsCopy,
148
- },
149
- });
153
+ } = await this.query(TranslateResourceDocument, { input });
150
154
 
151
155
  return { resource, errors };
152
156
  }
153
157
 
154
- async translateBatch(sourceResourceId, locales, params, resourceType) {
158
+ async translateBatch(
159
+ sourceResourceId,
160
+ locales,
161
+ params,
162
+ resourceType,
163
+ workflow,
164
+ ) {
155
165
  const paramsCopy = { ...params, resourceType };
156
166
  paramsCopy.widgets = JSON.stringify(paramsCopy.widgets);
157
167
  paramsCopy.settings = JSON.stringify(paramsCopy.settings);
158
168
 
159
169
  const BatchTranslateDocument = buildBatchTranslateResourceDocument(
160
- locales.length
170
+ locales.length,
161
171
  );
162
172
 
163
173
  const variables = {};
164
174
  locales.forEach((locale, i) => {
165
- variables[`input${i}`] = {
175
+ const input = {
166
176
  locale,
167
177
  sourceResourceId,
168
178
  resource: paramsCopy,
169
179
  };
180
+
181
+ if (workflow) {
182
+ input.workflow = workflow;
183
+ }
184
+
185
+ variables[`input${i}`] = input;
170
186
  });
171
187
 
172
188
  const response = await this.query(BatchTranslateDocument, variables);
@@ -211,7 +227,7 @@ export default class Resources extends RaketaClient {
211
227
 
212
228
  const { resourceChangePreview } = await this.query(
213
229
  ResourceChangePreviewDocument,
214
- { input }
230
+ { input },
215
231
  );
216
232
 
217
233
  return resourceChangePreview;
package/src/cloud/Tags.js CHANGED
@@ -11,7 +11,7 @@ export default class Tags extends RaketaClient {
11
11
  async list(query, locale) {
12
12
  const { tags: items } = await this.query(
13
13
  TagsDocument,
14
- this.buildListInput(query, locale)
14
+ this.buildListInput(query, locale),
15
15
  );
16
16
 
17
17
  return items;
@@ -22,9 +22,9 @@ export default class Tags extends RaketaClient {
22
22
  input: {
23
23
  locale: locale,
24
24
  orderBy: {
25
- field: 'name',
26
- direction: 'ASC'
27
- }
25
+ field: "name",
26
+ direction: "ASC",
27
+ },
28
28
  },
29
29
  });
30
30
 
@@ -101,3 +101,19 @@ export function summaryChangeFragment() {
101
101
  }
102
102
  `;
103
103
  }
104
+
105
+ export function contentTaskFragment() {
106
+ return gql`
107
+ {
108
+ id
109
+ workflow
110
+ operator
111
+ operatorMeta
112
+ completedAt
113
+ failedAt
114
+ rejectedAt
115
+ insertedAt
116
+ updatedAt
117
+ }
118
+ `;
119
+ }