@webiny/api-headless-cms 5.25.0 → 5.25.1-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/content/graphQLHandlerFactory.js +3 -1
  2. package/content/graphQLHandlerFactory.js.map +1 -1
  3. package/content/plugins/crud/contentEntry/afterDelete.js +1 -2
  4. package/content/plugins/crud/contentEntry/afterDelete.js.map +1 -1
  5. package/content/plugins/crud/contentEntry.crud.d.ts +2 -0
  6. package/content/plugins/crud/contentEntry.crud.js +71 -72
  7. package/content/plugins/crud/contentEntry.crud.js.map +1 -1
  8. package/content/plugins/crud/contentModel/beforeDelete.js +0 -2
  9. package/content/plugins/crud/contentModel/beforeDelete.js.map +1 -1
  10. package/content/plugins/crud/contentModel.crud.js +21 -12
  11. package/content/plugins/crud/contentModel.crud.js.map +1 -1
  12. package/content/plugins/crud/contentModelGroup.crud.js +38 -45
  13. package/content/plugins/crud/contentModelGroup.crud.js.map +1 -1
  14. package/content/plugins/crud/index.js +5 -3
  15. package/content/plugins/crud/index.js.map +1 -1
  16. package/content/plugins/graphqlFields/longText.js +1 -0
  17. package/content/plugins/graphqlFields/longText.js.map +1 -1
  18. package/content/plugins/graphqlFields/text.js +1 -0
  19. package/content/plugins/graphqlFields/text.js.map +1 -1
  20. package/content/plugins/schema/contentEntries.js +6 -9
  21. package/content/plugins/schema/contentEntries.js.map +1 -1
  22. package/content/plugins/validators/unique.js +0 -1
  23. package/content/plugins/validators/unique.js.map +1 -1
  24. package/package.json +24 -25
  25. package/plugins/context.js +9 -3
  26. package/plugins/context.js.map +1 -1
  27. package/plugins/crud/index.js +7 -4
  28. package/plugins/crud/index.js.map +1 -1
  29. package/plugins/crud/settings.crud.js +0 -1
  30. package/plugins/crud/settings.crud.js.map +1 -1
  31. package/plugins/crud/system.crud.d.ts +2 -0
  32. package/plugins/crud/system.crud.js +5 -4
  33. package/plugins/crud/system.crud.js.map +1 -1
  34. package/types.d.ts +51 -105
  35. package/types.js.map +1 -1
package/types.d.ts CHANGED
@@ -3,7 +3,6 @@ import { I18NContext, I18NLocale } from "@webiny/api-i18n/types";
3
3
  import { Context } from "@webiny/handler/types";
4
4
  import { TenancyContext } from "@webiny/api-tenancy/types";
5
5
  import { GraphQLFieldResolver, GraphQLSchemaDefinition, Resolvers } from "@webiny/handler-graphql/types";
6
- import { I18NContentContext } from "@webiny/api-i18n-content/types";
7
6
  import { SecurityPermission } from "@webiny/api-security/types";
8
7
  import { HttpContext } from "@webiny/handler-http/types";
9
8
  import { DbContext } from "@webiny/handler-db/types";
@@ -46,7 +45,7 @@ export interface HeadlessCms extends CmsSettingsContext, CmsSystemContext, CmsGr
46
45
  *
47
46
  * @category Context
48
47
  */
49
- export interface CmsContext extends Context, DbContext, HttpContext, I18NContext, FileManagerContext, I18NContentContext, TenancyContext {
48
+ export interface CmsContext extends Context, DbContext, HttpContext, I18NContext, FileManagerContext, TenancyContext {
50
49
  cms: HeadlessCms;
51
50
  }
52
51
  interface CmsModelFieldPredefinedValuesValue {
@@ -320,6 +319,10 @@ export interface CmsModel {
320
319
  * Unique ID for the content model. Created from name if not defined by user.
321
320
  */
322
321
  modelId: string;
322
+ /**
323
+ * Model tenant.
324
+ */
325
+ tenant: string;
323
326
  /**
324
327
  * Locale this model belongs to.
325
328
  */
@@ -340,7 +343,7 @@ export interface CmsModel {
340
343
  /**
341
344
  * Description for the content model.
342
345
  */
343
- description?: string | null;
346
+ description: string;
344
347
  /**
345
348
  * Date created
346
349
  */
@@ -381,10 +384,6 @@ export interface CmsModel {
381
384
  * The version of Webiny which this record was stored with.
382
385
  */
383
386
  webinyVersion: string;
384
- /**
385
- * Model tenant.
386
- */
387
- tenant: string;
388
387
  }
389
388
  /**
390
389
  * @category ModelField
@@ -432,6 +431,15 @@ export interface CmsModelFieldToGraphQLPlugin extends Plugin {
432
431
  * ```
433
432
  */
434
433
  isSearchable: boolean;
434
+ /**
435
+ * Is the field searchable via full text search?
436
+ *
437
+ * Field is not full text searchable by default.
438
+ * ```ts
439
+ * fullTextSearch: false
440
+ * ```
441
+ */
442
+ fullTextSearch?: boolean;
435
443
  /**
436
444
  * Is the field sortable via the GraphQL?
437
445
  *
@@ -730,9 +738,11 @@ export interface CmsSettingsContext {
730
738
  }
731
739
  export interface BeforeInstallTopicParams {
732
740
  tenant: string;
741
+ locale: string;
733
742
  }
734
743
  export interface AfterInstallTopicParams {
735
744
  tenant: string;
745
+ locale: string;
736
746
  }
737
747
  export declare type CmsSystemContext = {
738
748
  getSystemVersion: () => Promise<string | null>;
@@ -789,6 +799,10 @@ export interface CmsGroup {
789
799
  * Slug for the group. Must be unique.
790
800
  */
791
801
  slug: string;
802
+ /**
803
+ * Group tenant.
804
+ */
805
+ tenant: string;
792
806
  /**
793
807
  * Locale this group belongs to.
794
808
  */
@@ -796,11 +810,11 @@ export interface CmsGroup {
796
810
  /**
797
811
  * Description for the group.
798
812
  */
799
- description?: string;
813
+ description: string;
800
814
  /**
801
815
  * Icon for the group. In a form of "ico/ico".
802
816
  */
803
- icon?: string;
817
+ icon: string;
804
818
  /**
805
819
  * CreatedBy reference object.
806
820
  */
@@ -817,10 +831,6 @@ export interface CmsGroup {
817
831
  * Which Webiny version was this record stored with.
818
832
  */
819
833
  webinyVersion: string;
820
- /**
821
- * Group tenant.
822
- */
823
- tenant: string;
824
834
  }
825
835
  /**
826
836
  * A data.where parameter received when listing content model groups.
@@ -906,6 +916,10 @@ export interface CmsGroupContext {
906
916
  * Delete content model group by given id.
907
917
  */
908
918
  deleteGroup: (id: string) => Promise<boolean>;
919
+ /**
920
+ * Clear the cached groups.
921
+ */
922
+ clearGroupsCache: () => void;
909
923
  /**
910
924
  * Events.
911
925
  */
@@ -1296,13 +1310,22 @@ export interface CmsModelContext {
1296
1310
  * Get a instance of CmsModelManager for given content modelId.
1297
1311
  *
1298
1312
  * @see CmsModelManager
1313
+ *
1314
+ * @deprecated use the getEntryManager() method instead
1299
1315
  */
1300
1316
  getModelManager: (model: CmsModel | string) => Promise<CmsModelManager>;
1317
+ getEntryManager: (model: CmsModel | string) => Promise<CmsModelManager>;
1301
1318
  /**
1302
1319
  * Get all content model managers mapped by modelId.
1303
1320
  * @see CmsModelManager
1321
+ * @deprecated use getEntryManagers instead
1304
1322
  */
1305
1323
  getManagers: () => Map<string, CmsModelManager>;
1324
+ getEntryManagers: () => Map<string, CmsModelManager>;
1325
+ /**
1326
+ * Clear all the model caches.
1327
+ */
1328
+ clearModelsCache: () => void;
1306
1329
  /**
1307
1330
  * Events.
1308
1331
  */
@@ -1320,7 +1343,7 @@ export interface CmsModelContext {
1320
1343
  *
1321
1344
  * @category CmsEntry
1322
1345
  */
1323
- declare type CmsEntryStatus = "published" | "unpublished" | "reviewRequested" | "changesRequested" | "draft";
1346
+ export declare type CmsEntryStatus = "published" | "unpublished" | "reviewRequested" | "changesRequested" | "draft";
1324
1347
  export interface CmsEntryListWhereRef {
1325
1348
  id?: string;
1326
1349
  id_in?: string[];
@@ -1393,19 +1416,6 @@ export interface CmsEntryListWhere {
1393
1416
  * @internal
1394
1417
  */
1395
1418
  latest?: boolean;
1396
- /**
1397
- * Search for exact locale.
1398
- * This will most likely be populated, but leave it as optional.
1399
- */
1400
- locale?: string;
1401
- /**
1402
- * Exact tenant. No multi-tenancy search.
1403
- */
1404
- tenant: string;
1405
- /**
1406
- * Can be reference field or, actually, anything else.
1407
- */
1408
- [key: string]: any | CmsEntryListWhereRef;
1409
1419
  }
1410
1420
  /**
1411
1421
  * Entry listing sort.
@@ -1431,8 +1441,10 @@ export interface CmsEntryGetParams {
1431
1441
  * @category GraphQL params
1432
1442
  */
1433
1443
  export interface CmsEntryListParams {
1434
- where: CmsEntryListWhere;
1444
+ where?: CmsEntryListWhere;
1435
1445
  sort?: CmsEntryListSort;
1446
+ search?: string;
1447
+ fields?: string[];
1436
1448
  limit?: number;
1437
1449
  after?: string | null;
1438
1450
  }
@@ -1786,13 +1798,10 @@ export interface CmsGroupStorageOperationsListParams {
1786
1798
  sort?: string[];
1787
1799
  }
1788
1800
  export interface CmsGroupStorageOperationsCreateParams {
1789
- input: CmsGroupCreateInput;
1790
1801
  group: CmsGroup;
1791
1802
  }
1792
1803
  export interface CmsGroupStorageOperationsUpdateParams {
1793
- original: CmsGroup;
1794
1804
  group: CmsGroup;
1795
- input: CmsGroupUpdateInput;
1796
1805
  }
1797
1806
  export interface CmsGroupStorageOperationsDeleteParams {
1798
1807
  group: CmsGroup;
@@ -1838,13 +1847,10 @@ export interface CmsModelStorageOperationsListParams {
1838
1847
  where: CmsModelStorageOperationsListWhereParams;
1839
1848
  }
1840
1849
  export interface CmsModelStorageOperationsCreateParams {
1841
- input: CmsModelCreateInput;
1842
1850
  model: CmsModel;
1843
1851
  }
1844
1852
  export interface CmsModelStorageOperationsUpdateParams {
1845
- original: CmsModel;
1846
1853
  model: CmsModel;
1847
- input: CmsModelUpdateInput;
1848
1854
  }
1849
1855
  export interface CmsModelStorageOperationsDeleteParams {
1850
1856
  model: CmsModel;
@@ -1884,14 +1890,12 @@ export interface CmsEntryStorageOperationsGetParams {
1884
1890
  export interface CmsEntryStorageOperationsListParams {
1885
1891
  where: CmsEntryListWhere;
1886
1892
  sort?: CmsEntryListSort;
1893
+ search?: string;
1894
+ fields?: string[];
1887
1895
  limit?: number;
1888
1896
  after?: string | null;
1889
1897
  }
1890
1898
  export interface CmsEntryStorageOperationsCreateParams<T extends CmsStorageEntry = CmsStorageEntry> {
1891
- /**
1892
- * Input received from the user.
1893
- */
1894
- input: Record<string, any>;
1895
1899
  /**
1896
1900
  * Real entry, with no transformations on it.
1897
1901
  */
@@ -1902,14 +1906,6 @@ export interface CmsEntryStorageOperationsCreateParams<T extends CmsStorageEntry
1902
1906
  storageEntry: T;
1903
1907
  }
1904
1908
  export interface CmsEntryStorageOperationsCreateRevisionFromParams<T extends CmsStorageEntry = CmsStorageEntry> {
1905
- /**
1906
- * The entry we are creating new one from.
1907
- */
1908
- originalEntry: CmsEntry;
1909
- /**
1910
- * The entry we are creating new one from, directly from storage, with transformations on it.
1911
- */
1912
- originalStorageEntry: T;
1913
1909
  /**
1914
1910
  * Latest entry, used to calculate the new version.
1915
1911
  */
@@ -1928,18 +1924,6 @@ export interface CmsEntryStorageOperationsCreateRevisionFromParams<T extends Cms
1928
1924
  storageEntry: T;
1929
1925
  }
1930
1926
  export interface CmsEntryStorageOperationsUpdateParams<T extends CmsStorageEntry = CmsStorageEntry> {
1931
- /**
1932
- * Input received from the user.
1933
- */
1934
- input: Record<string, any>;
1935
- /**
1936
- * Used to compare IDs, versions and passed into storage operations to be used if required.
1937
- */
1938
- originalEntry: CmsEntry;
1939
- /**
1940
- * Directly from storage, with transformations on it.
1941
- */
1942
- originalStorageEntry: T;
1943
1927
  /**
1944
1928
  * Real entry, with no transformations on it.
1945
1929
  */
@@ -1953,39 +1937,27 @@ export interface CmsEntryStorageOperationsDeleteRevisionParams<T extends CmsStor
1953
1937
  /**
1954
1938
  * Entry that was deleted.
1955
1939
  */
1956
- entryToDelete: CmsEntry;
1940
+ entry: CmsEntry;
1957
1941
  /**
1958
1942
  * Entry that was deleted, directly from storage, with transformations.
1959
1943
  */
1960
- storageEntryToDelete: T;
1944
+ storageEntry: T;
1961
1945
  /**
1962
1946
  * Entry that was set as latest.
1963
1947
  */
1964
- entryToSetAsLatest: CmsEntry | null;
1948
+ latestEntry: CmsEntry | null;
1965
1949
  /**
1966
1950
  * Entry that was set as latest, directly from storage, with transformations.
1967
1951
  */
1968
- storageEntryToSetAsLatest: T | null;
1952
+ latestStorageEntry: T | null;
1969
1953
  }
1970
- export interface CmsEntryStorageOperationsDeleteParams<T extends CmsStorageEntry = CmsStorageEntry> {
1954
+ export interface CmsEntryStorageOperationsDeleteParams {
1971
1955
  /**
1972
1956
  * Entry that is going to be deleted.
1973
1957
  */
1974
1958
  entry: CmsEntry;
1975
- /**
1976
- * Entry that is going to be deleted, directly from storage.
1977
- */
1978
- storageEntry: T;
1979
1959
  }
1980
1960
  export interface CmsEntryStorageOperationsPublishParams<T extends CmsStorageEntry = CmsStorageEntry> {
1981
- /**
1982
- * The entry record before it was published.
1983
- */
1984
- originalEntry: CmsEntry;
1985
- /**
1986
- * Directly from storage, with transformations on it.
1987
- */
1988
- originalStorageEntry: T;
1989
1961
  /**
1990
1962
  * The modified entry that is going to be saved as published.
1991
1963
  * Entry is in its original form.
@@ -1997,14 +1969,6 @@ export interface CmsEntryStorageOperationsPublishParams<T extends CmsStorageEntr
1997
1969
  storageEntry: T;
1998
1970
  }
1999
1971
  export interface CmsEntryStorageOperationsUnpublishParams<T extends CmsStorageEntry = CmsStorageEntry> {
2000
- /**
2001
- * The entry record before it was unpublished.
2002
- */
2003
- originalEntry: CmsEntry;
2004
- /**
2005
- * The entry record before it was unpublished, with transformations on it.
2006
- */
2007
- originalStorageEntry: T;
2008
1972
  /**
2009
1973
  * The modified entry that is going to be saved as unpublished.
2010
1974
  */
@@ -2023,14 +1987,6 @@ export interface CmsEntryStorageOperationsRequestChangesParams<T extends CmsStor
2023
1987
  * Entry that is prepared for the storageOperations, with the transformations.
2024
1988
  */
2025
1989
  storageEntry: T;
2026
- /**
2027
- * Original entry from the storage.
2028
- */
2029
- originalEntry: CmsEntry;
2030
- /**
2031
- * Original entry to be updated, directly from storage, with the transformations.
2032
- */
2033
- originalStorageEntry: T;
2034
1990
  }
2035
1991
  export interface CmsEntryStorageOperationsRequestReviewParams<T extends CmsStorageEntry = CmsStorageEntry> {
2036
1992
  /**
@@ -2041,14 +1997,6 @@ export interface CmsEntryStorageOperationsRequestReviewParams<T extends CmsStora
2041
1997
  * Entry that is prepared for the storageOperations, with the transformations.
2042
1998
  */
2043
1999
  storageEntry: T;
2044
- /**
2045
- * Original entry from the storage.
2046
- */
2047
- originalEntry: CmsEntry;
2048
- /**
2049
- * Original entry to be updated, directly from storage, with the transformations.
2050
- */
2051
- originalStorageEntry: T;
2052
2000
  }
2053
2001
  export interface CmsEntryStorageOperationsGetByIdsParams {
2054
2002
  ids: readonly string[];
@@ -2165,7 +2113,7 @@ export interface CmsEntryStorageOperations<T extends CmsStorageEntry = CmsStorag
2165
2113
  /**
2166
2114
  * Delete the entry.
2167
2115
  */
2168
- delete: (model: CmsModel, params: CmsEntryStorageOperationsDeleteParams<T>) => Promise<void>;
2116
+ delete: (model: CmsModel, params: CmsEntryStorageOperationsDeleteParams) => Promise<void>;
2169
2117
  /**
2170
2118
  * Publish the entry.
2171
2119
  */
@@ -2198,7 +2146,6 @@ export interface CmsSettingsStorageOperationsCreateParams {
2198
2146
  settings: CmsSettings;
2199
2147
  }
2200
2148
  export interface CmsSettingsStorageOperationsUpdateParams {
2201
- original: CmsSettings;
2202
2149
  settings: CmsSettings;
2203
2150
  }
2204
2151
  export interface CmsSettingsStorageOperations {
@@ -2231,7 +2178,6 @@ export interface CmsSystemStorageOperationsCreateParams {
2231
2178
  }
2232
2179
  export interface CmsSystemStorageOperationsUpdateParams {
2233
2180
  system: CmsSystem;
2234
- original: CmsSystem;
2235
2181
  }
2236
2182
  export interface CmsSystemStorageOperations {
2237
2183
  /**
@@ -2253,11 +2199,11 @@ export interface HeadlessCmsStorageOperations {
2253
2199
  groups: CmsGroupStorageOperations;
2254
2200
  models: CmsModelStorageOperations;
2255
2201
  entries: CmsEntryStorageOperations;
2256
- init?: (cms: HeadlessCms) => Promise<void>;
2257
2202
  /**
2258
- * Plugins to be attached to the main context.
2203
+ * Either attach something from the storage operations or run something in it.
2259
2204
  */
2260
- plugins?: Plugin[] | Plugin[][];
2205
+ beforeInit?: (context: CmsContext) => Promise<void>;
2206
+ init?: (context: CmsContext) => Promise<void>;
2261
2207
  /**
2262
2208
  * An upgrade to run if necessary.
2263
2209
  */