@webiny/api-aco 5.34.8 → 5.35.0-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.
- package/README.md +15 -0
- package/createAcoContext.d.ts +3 -0
- package/createAcoContext.js +63 -0
- package/createAcoContext.js.map +1 -0
- package/createAcoCrud.d.ts +2 -0
- package/createAcoCrud.js +17 -0
- package/createAcoCrud.js.map +1 -0
- package/createAcoFields.d.ts +2 -0
- package/createAcoFields.js +40 -0
- package/createAcoFields.js.map +1 -0
- package/createAcoGraphQL.d.ts +3 -0
- package/createAcoGraphQL.js +92 -0
- package/createAcoGraphQL.js.map +1 -0
- package/createAcoHooks.d.ts +2 -0
- package/createAcoHooks.js +11 -0
- package/createAcoHooks.js.map +1 -0
- package/createAcoModels.d.ts +2 -0
- package/createAcoModels.js +65 -0
- package/createAcoModels.js.map +1 -0
- package/createAcoStorageOperations.d.ts +10 -0
- package/createAcoStorageOperations.js +19 -0
- package/createAcoStorageOperations.js.map +1 -0
- package/folder/folder.crud.d.ts +3 -0
- package/folder/folder.crud.js +92 -0
- package/folder/folder.crud.js.map +1 -0
- package/folder/folder.gql.d.ts +3 -0
- package/folder/folder.gql.js +103 -0
- package/folder/folder.gql.js.map +1 -0
- package/folder/folder.model.d.ts +4 -0
- package/folder/folder.model.js +75 -0
- package/folder/folder.model.js.map +1 -0
- package/folder/folder.so.d.ts +3 -0
- package/folder/folder.so.js +151 -0
- package/folder/folder.so.js.map +1 -0
- package/folder/folder.types.d.ts +83 -0
- package/folder/folder.types.js +5 -0
- package/folder/folder.types.js.map +1 -0
- package/folder/onFolderBeforeDelete.hook.d.ts +2 -0
- package/folder/onFolderBeforeDelete.hook.js +53 -0
- package/folder/onFolderBeforeDelete.hook.js.map +1 -0
- package/index.d.ts +3 -9
- package/index.js +22 -65
- package/index.js.map +1 -1
- package/package.json +23 -20
- package/record/record.crud.d.ts +3 -0
- package/record/record.crud.js +92 -0
- package/record/record.crud.js.map +1 -0
- package/record/record.gql.d.ts +3 -0
- package/record/record.gql.js +133 -0
- package/record/record.gql.js.map +1 -0
- package/record/record.model.d.ts +4 -0
- package/record/record.model.js +62 -0
- package/record/record.model.js.map +1 -0
- package/record/record.so.d.ts +3 -0
- package/record/record.so.js +105 -0
- package/record/record.so.js.map +1 -0
- package/record/record.types.d.ts +96 -0
- package/record/record.types.js +5 -0
- package/record/record.types.js.map +1 -0
- package/types.d.ts +32 -202
- package/types.js +35 -1
- package/types.js.map +1 -1
- package/utils/acoRecordId.d.ts +6 -0
- package/utils/acoRecordId.js +33 -0
- package/utils/acoRecordId.js.map +1 -0
- package/utils/createListSort.d.ts +2 -0
- package/utils/createListSort.js +13 -0
- package/utils/createListSort.js.map +1 -0
- package/utils/createModelField.d.ts +5 -0
- package/utils/createModelField.js +37 -0
- package/utils/createModelField.js.map +1 -0
- package/utils/createOperationsWrapper.d.ts +9 -0
- package/utils/createOperationsWrapper.js +29 -0
- package/utils/createOperationsWrapper.js.map +1 -0
- package/utils/fieldResolver.d.ts +16 -0
- package/utils/fieldResolver.js +44 -0
- package/utils/fieldResolver.js.map +1 -0
- package/utils/getFieldValues.d.ts +5 -0
- package/utils/getFieldValues.js +16 -0
- package/utils/getFieldValues.js.map +1 -0
- package/utils/isInstallationPending.d.ts +4 -0
- package/utils/isInstallationPending.js +21 -0
- package/utils/isInstallationPending.js.map +1 -0
- package/utils/modelFactory.d.ts +15 -0
- package/utils/modelFactory.js +25 -0
- package/utils/modelFactory.js.map +1 -0
- package/utils/resolve.d.ts +2 -0
- package/utils/resolve.js +15 -0
- package/utils/resolve.js.map +1 -0
package/types.d.ts
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
import { TenancyContext } from "@webiny/api-tenancy/types";
|
|
1
|
+
import { Tenant, TenancyContext } from "@webiny/api-tenancy/types";
|
|
2
2
|
import { Context as BaseContext } from "@webiny/handler/types";
|
|
3
|
-
import { I18NContext } from "@webiny/api-i18n/types";
|
|
3
|
+
import { I18NContext, I18NLocale } from "@webiny/api-i18n/types";
|
|
4
4
|
import { SecurityContext, SecurityIdentity } from "@webiny/api-security/types";
|
|
5
|
-
import {
|
|
6
|
-
|
|
5
|
+
import { CmsContext } from "@webiny/api-headless-cms/types";
|
|
6
|
+
import { AcoSearchRecordCrud, AcoSearchRecordStorageOperations } from "./record/record.types";
|
|
7
|
+
import { AcoFolderCrud, AcoFolderStorageOperations } from "./folder/folder.types";
|
|
8
|
+
export * from "./folder/folder.types";
|
|
9
|
+
export * from "./record/record.types";
|
|
10
|
+
export interface User {
|
|
7
11
|
id: string;
|
|
8
12
|
type: string;
|
|
9
13
|
displayName: string | null;
|
|
@@ -13,207 +17,33 @@ export interface ListMeta {
|
|
|
13
17
|
totalCount: number;
|
|
14
18
|
hasMoreItems: boolean;
|
|
15
19
|
}
|
|
16
|
-
export
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
slug: string;
|
|
20
|
-
type: string;
|
|
21
|
-
parentId?: string;
|
|
22
|
-
createdOn: string;
|
|
23
|
-
createdBy: CreatedBy;
|
|
24
|
-
tenant: string;
|
|
25
|
-
locale: string;
|
|
26
|
-
webinyVersion: string;
|
|
27
|
-
}
|
|
28
|
-
export declare type FolderInput = Pick<Folder, "name" | "slug" | "type" | "parentId">;
|
|
29
|
-
export interface GetFolderParams {
|
|
30
|
-
id: string;
|
|
31
|
-
}
|
|
32
|
-
export interface ListFoldersWhere {
|
|
33
|
-
type: string;
|
|
34
|
-
}
|
|
35
|
-
export interface ListFoldersParams {
|
|
36
|
-
where: ListFoldersWhere;
|
|
37
|
-
}
|
|
38
|
-
export interface CreateFolderParams {
|
|
39
|
-
folder: Folder;
|
|
40
|
-
}
|
|
41
|
-
export interface UpdateFolderParams {
|
|
42
|
-
original: Folder;
|
|
43
|
-
folder: Folder;
|
|
20
|
+
export declare enum ListSortDirection {
|
|
21
|
+
ASC = 0,
|
|
22
|
+
DESC = 1
|
|
44
23
|
}
|
|
45
|
-
export
|
|
46
|
-
|
|
47
|
-
}
|
|
48
|
-
export interface StorageOperationsGetFolderParams {
|
|
49
|
-
id?: string;
|
|
50
|
-
slug?: string;
|
|
51
|
-
type?: string;
|
|
52
|
-
parentId?: string;
|
|
53
|
-
tenant: string;
|
|
54
|
-
locale: string;
|
|
55
|
-
}
|
|
56
|
-
export interface StorageOperationsListFoldersParams extends ListFoldersParams {
|
|
57
|
-
where: ListFoldersParams["where"] & {
|
|
58
|
-
tenant: string;
|
|
59
|
-
locale: string;
|
|
60
|
-
};
|
|
61
|
-
sort: string[];
|
|
62
|
-
}
|
|
63
|
-
export declare type StorageOperationsCreateFolderParams = CreateFolderParams;
|
|
64
|
-
export declare type StorageOperationsUpdateFolderParams = UpdateFolderParams;
|
|
65
|
-
export declare type StorageOperationsDeleteFolderParams = DeleteFolderParams;
|
|
66
|
-
export interface OnFolderBeforeCreateTopicParams {
|
|
67
|
-
folder: Folder;
|
|
68
|
-
}
|
|
69
|
-
export interface OnFolderAfterCreateTopicParams {
|
|
70
|
-
folder: Folder;
|
|
71
|
-
}
|
|
72
|
-
export interface OnFolderBeforeUpdateTopicParams {
|
|
73
|
-
folder: Folder;
|
|
74
|
-
original: Folder;
|
|
75
|
-
}
|
|
76
|
-
export interface OnFolderAfterUpdateTopicParams {
|
|
77
|
-
folder: Folder;
|
|
78
|
-
original: Folder;
|
|
79
|
-
}
|
|
80
|
-
export interface OnFolderBeforeDeleteTopicParams {
|
|
81
|
-
folder: Folder;
|
|
82
|
-
}
|
|
83
|
-
export interface OnFolderAfterDeleteTopicParams {
|
|
84
|
-
folder: Folder;
|
|
85
|
-
}
|
|
86
|
-
export interface Link {
|
|
24
|
+
export declare type ListSort = Record<string, ListSortDirection>;
|
|
25
|
+
export interface AcoBaseFields {
|
|
87
26
|
id: string;
|
|
88
|
-
|
|
89
|
-
folderId: string;
|
|
27
|
+
entryId: string;
|
|
90
28
|
createdOn: string;
|
|
91
|
-
createdBy:
|
|
92
|
-
|
|
93
|
-
locale: string;
|
|
94
|
-
webinyVersion: string;
|
|
95
|
-
}
|
|
96
|
-
export declare type LinkInput = Pick<Link, "id" | "folderId">;
|
|
97
|
-
export interface ListLinksWhere {
|
|
98
|
-
folderId: string;
|
|
29
|
+
createdBy: User;
|
|
30
|
+
savedOn: string;
|
|
99
31
|
}
|
|
100
|
-
export interface
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
after?: string | null;
|
|
32
|
+
export interface AdvancedContentOrganisation {
|
|
33
|
+
folder: AcoFolderCrud;
|
|
34
|
+
search: AcoSearchRecordCrud;
|
|
104
35
|
}
|
|
105
|
-
export
|
|
106
|
-
export interface CreateLinkParams {
|
|
107
|
-
link: Link;
|
|
108
|
-
}
|
|
109
|
-
export interface UpdateLinkParams {
|
|
110
|
-
original: Link;
|
|
111
|
-
link: Link;
|
|
112
|
-
}
|
|
113
|
-
export interface DeleteLinkParams {
|
|
114
|
-
link: Link;
|
|
115
|
-
}
|
|
116
|
-
export interface DeleteLinksParams {
|
|
117
|
-
tenant: string;
|
|
118
|
-
locale: string;
|
|
119
|
-
folderIds: string[];
|
|
120
|
-
}
|
|
121
|
-
export interface StorageOperationsGetLinkParams {
|
|
122
|
-
id?: string;
|
|
123
|
-
folderId?: string;
|
|
124
|
-
tenant: string;
|
|
125
|
-
locale: string;
|
|
126
|
-
}
|
|
127
|
-
export interface StorageOperationsListLinksParams extends ListLinksParams {
|
|
128
|
-
where: ListLinksParams["where"] & {
|
|
129
|
-
tenant: string;
|
|
130
|
-
locale: string;
|
|
131
|
-
};
|
|
132
|
-
sort: string[];
|
|
133
|
-
}
|
|
134
|
-
export declare type StorageOperationListLinksResponse = ListLinksResponse;
|
|
135
|
-
export declare type StorageOperationsCreateLinkParams = CreateLinkParams;
|
|
136
|
-
export declare type StorageOperationsUpdateLinkParams = UpdateLinkParams;
|
|
137
|
-
export declare type StorageOperationsDeleteLinkParams = DeleteLinkParams;
|
|
138
|
-
export declare type StorageOperationsDeleteLinksParams = DeleteLinksParams;
|
|
139
|
-
export interface OnLinkBeforeCreateTopicParams {
|
|
140
|
-
link: Link;
|
|
141
|
-
}
|
|
142
|
-
export interface OnLinkAfterCreateTopicParams {
|
|
143
|
-
link: Link;
|
|
144
|
-
}
|
|
145
|
-
export interface OnLinkBeforeUpdateTopicParams {
|
|
146
|
-
link: Link;
|
|
147
|
-
original: Link;
|
|
148
|
-
}
|
|
149
|
-
export interface OnLinkAfterUpdateTopicParams {
|
|
150
|
-
link: Link;
|
|
151
|
-
original: Link;
|
|
152
|
-
}
|
|
153
|
-
export interface OnLinkBeforeDeleteTopicParams {
|
|
154
|
-
link: Link;
|
|
155
|
-
}
|
|
156
|
-
export interface OnLinkAfterDeleteTopicParams {
|
|
157
|
-
link: Link;
|
|
158
|
-
}
|
|
159
|
-
export interface OnLinkBeforeDeleteBatchTopicParams {
|
|
160
|
-
folderIds: string[];
|
|
161
|
-
}
|
|
162
|
-
export interface OnLinkAfterDeleteBatchTopicParams {
|
|
163
|
-
folderIds: string[];
|
|
164
|
-
}
|
|
165
|
-
export interface ACOContext extends BaseContext, I18NContext, TenancyContext, SecurityContext {
|
|
166
|
-
folders: Folders;
|
|
167
|
-
}
|
|
168
|
-
export declare type Folders = IFolders & ILinks;
|
|
169
|
-
export interface IFolders {
|
|
170
|
-
getFolder(params: GetFolderParams): Promise<Folder>;
|
|
171
|
-
listFolders(params: ListFoldersParams): Promise<Folder[]>;
|
|
172
|
-
createFolder(input: FolderInput): Promise<Folder>;
|
|
173
|
-
updateFolder(id: string, input: Partial<Folder>): Promise<Folder>;
|
|
174
|
-
deleteFolder(id: string): Promise<void>;
|
|
175
|
-
onFolderBeforeCreate: Topic<OnFolderBeforeCreateTopicParams>;
|
|
176
|
-
onFolderAfterCreate: Topic<OnFolderAfterCreateTopicParams>;
|
|
177
|
-
onFolderBeforeUpdate: Topic<OnFolderBeforeUpdateTopicParams>;
|
|
178
|
-
onFolderAfterUpdate: Topic<OnFolderAfterUpdateTopicParams>;
|
|
179
|
-
onFolderBeforeDelete: Topic<OnFolderBeforeDeleteTopicParams>;
|
|
180
|
-
onFolderAfterDelete: Topic<OnFolderAfterDeleteTopicParams>;
|
|
181
|
-
}
|
|
182
|
-
export interface ILinks {
|
|
183
|
-
getLink(id: string): Promise<Link>;
|
|
184
|
-
listLinks(params: ListLinksParams): Promise<ListLinksResponse>;
|
|
185
|
-
createLink(input: LinkInput): Promise<Link>;
|
|
186
|
-
updateLink(id: string, input: Partial<Link>): Promise<Link>;
|
|
187
|
-
deleteLink(id: string): Promise<void>;
|
|
188
|
-
deleteLinks(folderIds: string[]): Promise<void>;
|
|
189
|
-
onLinkBeforeCreate: Topic<OnLinkBeforeCreateTopicParams>;
|
|
190
|
-
onLinkAfterCreate: Topic<OnLinkAfterCreateTopicParams>;
|
|
191
|
-
onLinkBeforeUpdate: Topic<OnLinkBeforeUpdateTopicParams>;
|
|
192
|
-
onLinkAfterUpdate: Topic<OnLinkAfterUpdateTopicParams>;
|
|
193
|
-
onLinkBeforeDelete: Topic<OnLinkBeforeDeleteTopicParams>;
|
|
194
|
-
onLinkAfterDelete: Topic<OnLinkAfterDeleteTopicParams>;
|
|
195
|
-
onLinkBeforeDeleteBatch: Topic<OnLinkBeforeDeleteBatchTopicParams>;
|
|
196
|
-
onLinkAfterDeleteBatch: Topic<OnLinkAfterDeleteBatchTopicParams>;
|
|
197
|
-
}
|
|
198
|
-
export interface FoldersConfig {
|
|
199
|
-
getTenantId: () => string;
|
|
200
|
-
getLocaleCode: () => string;
|
|
36
|
+
export interface CreateAcoParams {
|
|
201
37
|
getIdentity: () => SecurityIdentity;
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
listLinks(params: StorageOperationsListLinksParams): Promise<StorageOperationListLinksResponse>;
|
|
215
|
-
createLink(params: StorageOperationsCreateLinkParams): Promise<Link>;
|
|
216
|
-
updateLink(params: StorageOperationsUpdateLinkParams): Promise<Link>;
|
|
217
|
-
deleteLink(params: StorageOperationsDeleteLinkParams): Promise<void>;
|
|
218
|
-
deleteLinks(params: StorageOperationsDeleteLinksParams): Promise<void>;
|
|
219
|
-
}
|
|
38
|
+
getLocale: () => I18NLocale;
|
|
39
|
+
getTenant: () => Tenant;
|
|
40
|
+
storageOperations: AcoStorageOperations;
|
|
41
|
+
}
|
|
42
|
+
export declare type AcoStorageOperations = AcoFolderStorageOperations & AcoSearchRecordStorageOperations;
|
|
43
|
+
export interface AcoContext extends BaseContext, I18NContext, TenancyContext, SecurityContext, CmsContext {
|
|
44
|
+
aco: AdvancedContentOrganisation;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* @deprecated Use AcoContext instead
|
|
48
|
+
*/
|
|
49
|
+
export declare type ACOContext = AcoContext;
|
package/types.js
CHANGED
|
@@ -2,4 +2,38 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
|
-
});
|
|
5
|
+
});
|
|
6
|
+
var _exportNames = {
|
|
7
|
+
ListSortDirection: true
|
|
8
|
+
};
|
|
9
|
+
exports.ListSortDirection = void 0;
|
|
10
|
+
var _folder = require("./folder/folder.types");
|
|
11
|
+
Object.keys(_folder).forEach(function (key) {
|
|
12
|
+
if (key === "default" || key === "__esModule") return;
|
|
13
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
14
|
+
if (key in exports && exports[key] === _folder[key]) return;
|
|
15
|
+
Object.defineProperty(exports, key, {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
get: function () {
|
|
18
|
+
return _folder[key];
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
var _record = require("./record/record.types");
|
|
23
|
+
Object.keys(_record).forEach(function (key) {
|
|
24
|
+
if (key === "default" || key === "__esModule") return;
|
|
25
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
26
|
+
if (key in exports && exports[key] === _record[key]) return;
|
|
27
|
+
Object.defineProperty(exports, key, {
|
|
28
|
+
enumerable: true,
|
|
29
|
+
get: function () {
|
|
30
|
+
return _record[key];
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
let ListSortDirection;
|
|
35
|
+
exports.ListSortDirection = ListSortDirection;
|
|
36
|
+
(function (ListSortDirection) {
|
|
37
|
+
ListSortDirection[ListSortDirection["ASC"] = 0] = "ASC";
|
|
38
|
+
ListSortDirection[ListSortDirection["DESC"] = 1] = "DESC";
|
|
39
|
+
})(ListSortDirection || (exports.ListSortDirection = ListSortDirection = {}));
|
package/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import { TenancyContext } from \"@webiny/api-tenancy/types\";\nimport { Context as BaseContext } from \"@webiny/handler/types\";\nimport { I18NContext } from \"@webiny/api-i18n/types\";\nimport { SecurityContext, SecurityIdentity } from \"@webiny/api-security/types\";\nimport {
|
|
1
|
+
{"version":3,"names":["ListSortDirection"],"sources":["types.ts"],"sourcesContent":["import { Tenant, TenancyContext } from \"@webiny/api-tenancy/types\";\nimport { Context as BaseContext } from \"@webiny/handler/types\";\nimport { I18NContext, I18NLocale } from \"@webiny/api-i18n/types\";\nimport { SecurityContext, SecurityIdentity } from \"@webiny/api-security/types\";\nimport { CmsContext } from \"@webiny/api-headless-cms/types\";\nimport { AcoSearchRecordCrud, AcoSearchRecordStorageOperations } from \"~/record/record.types\";\nimport { AcoFolderCrud, AcoFolderStorageOperations } from \"~/folder/folder.types\";\n\nexport * from \"./folder/folder.types\";\nexport * from \"./record/record.types\";\n\nexport interface User {\n id: string;\n type: string;\n displayName: string | null;\n}\n\nexport interface ListMeta {\n cursor: string | null;\n totalCount: number;\n hasMoreItems: boolean;\n}\n\nexport enum ListSortDirection {\n ASC,\n DESC\n}\n\nexport type ListSort = Record<string, ListSortDirection>;\n\nexport interface AcoBaseFields {\n id: string;\n entryId: string;\n createdOn: string;\n createdBy: User;\n savedOn: string;\n}\n\nexport interface AdvancedContentOrganisation {\n folder: AcoFolderCrud;\n search: AcoSearchRecordCrud;\n}\n\nexport interface CreateAcoParams {\n getIdentity: () => SecurityIdentity;\n getLocale: () => I18NLocale;\n getTenant: () => Tenant;\n storageOperations: AcoStorageOperations;\n}\n\nexport type AcoStorageOperations = AcoFolderStorageOperations & AcoSearchRecordStorageOperations;\n\nexport interface AcoContext\n extends BaseContext,\n I18NContext,\n TenancyContext,\n SecurityContext,\n CmsContext {\n aco: AdvancedContentOrganisation;\n}\n\n/**\n * @deprecated Use AcoContext instead\n */\nexport type ACOContext = AcoContext;\n"],"mappings":";;;;;;;;;AAQA;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AAAsC,IAc1BA,iBAAiB;AAAA;AAAA,WAAjBA,iBAAiB;EAAjBA,iBAAiB,CAAjBA,iBAAiB;EAAjBA,iBAAiB,CAAjBA,iBAAiB;AAAA,GAAjBA,iBAAiB,iCAAjBA,iBAAiB"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.removeAcoRecordPrefix = exports.attachAcoRecordPrefix = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* !!! DO NOT CHANGE THIS !!!
|
|
9
|
+
* If this is changed, you will need to create new migration which changes the IDs for the users.
|
|
10
|
+
*
|
|
11
|
+
* packages/migrations/src/migrations/5.35.0/006/ddb/PageDataMigration.ts:236
|
|
12
|
+
* packages/migrations/src/migrations/5.35.0/006/ddb-es/PageDataMigration.ts:419
|
|
13
|
+
*/
|
|
14
|
+
const WBY_ACO_PREFIX = "wby-aco-";
|
|
15
|
+
/**
|
|
16
|
+
* 006
|
|
17
|
+
* PageDataMigration in ddb-es and ddb
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
const attachAcoRecordPrefix = id => {
|
|
21
|
+
if (id.startsWith(WBY_ACO_PREFIX)) {
|
|
22
|
+
return id;
|
|
23
|
+
}
|
|
24
|
+
return `${WBY_ACO_PREFIX}${id}`;
|
|
25
|
+
};
|
|
26
|
+
exports.attachAcoRecordPrefix = attachAcoRecordPrefix;
|
|
27
|
+
const removeAcoRecordPrefix = id => {
|
|
28
|
+
if (id.startsWith(WBY_ACO_PREFIX) === false) {
|
|
29
|
+
return id;
|
|
30
|
+
}
|
|
31
|
+
return id.substring(WBY_ACO_PREFIX.length);
|
|
32
|
+
};
|
|
33
|
+
exports.removeAcoRecordPrefix = removeAcoRecordPrefix;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["WBY_ACO_PREFIX","attachAcoRecordPrefix","id","startsWith","removeAcoRecordPrefix","substring","length"],"sources":["acoRecordId.ts"],"sourcesContent":["/**\n * !!! DO NOT CHANGE THIS !!!\n * If this is changed, you will need to create new migration which changes the IDs for the users.\n *\n * packages/migrations/src/migrations/5.35.0/006/ddb/PageDataMigration.ts:236\n * packages/migrations/src/migrations/5.35.0/006/ddb-es/PageDataMigration.ts:419\n */\nconst WBY_ACO_PREFIX = \"wby-aco-\";\n/**\n * 006\n * PageDataMigration in ddb-es and ddb\n */\n\nexport const attachAcoRecordPrefix = (id: string) => {\n if (id.startsWith(WBY_ACO_PREFIX)) {\n return id;\n }\n return `${WBY_ACO_PREFIX}${id}`;\n};\n\nexport const removeAcoRecordPrefix = (id: string) => {\n if (id.startsWith(WBY_ACO_PREFIX) === false) {\n return id;\n }\n return id.substring(WBY_ACO_PREFIX.length);\n};\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,cAAc,GAAG,UAAU;AACjC;AACA;AACA;AACA;;AAEO,MAAMC,qBAAqB,GAAIC,EAAU,IAAK;EACjD,IAAIA,EAAE,CAACC,UAAU,CAACH,cAAc,CAAC,EAAE;IAC/B,OAAOE,EAAE;EACb;EACA,OAAQ,GAAEF,cAAe,GAAEE,EAAG,EAAC;AACnC,CAAC;AAAC;AAEK,MAAME,qBAAqB,GAAIF,EAAU,IAAK;EACjD,IAAIA,EAAE,CAACC,UAAU,CAACH,cAAc,CAAC,KAAK,KAAK,EAAE;IACzC,OAAOE,EAAE;EACb;EACA,OAAOA,EAAE,CAACG,SAAS,CAACL,cAAc,CAACM,MAAM,CAAC;AAC9C,CAAC;AAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createListSort = void 0;
|
|
7
|
+
const createListSort = sort => {
|
|
8
|
+
if (!sort) {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
return Object.keys(sort).map(key => `${key}_${sort[key]}`);
|
|
12
|
+
};
|
|
13
|
+
exports.createListSort = createListSort;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createListSort","sort","Object","keys","map","key"],"sources":["createListSort.ts"],"sourcesContent":["import { ListSort } from \"~/types\";\n\nexport const createListSort = (sort?: ListSort): string[] | undefined => {\n if (!sort) {\n return;\n }\n\n return Object.keys(sort).map(key => `${key}_${sort[key]}`);\n};\n"],"mappings":";;;;;;AAEO,MAAMA,cAAc,GAAIC,IAAe,IAA2B;EACrE,IAAI,CAACA,IAAI,EAAE;IACP;EACJ;EAEA,OAAOC,MAAM,CAACC,IAAI,CAACF,IAAI,CAAC,CAACG,GAAG,CAACC,GAAG,IAAK,GAAEA,GAAI,IAAGJ,IAAI,CAACI,GAAG,CAAE,EAAC,CAAC;AAC9D,CAAC;AAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { CmsModelField } from "@webiny/api-headless-cms/types";
|
|
2
|
+
export interface CreateModelFieldParams extends Omit<CmsModelField, "id" | "storageId" | "fieldId"> {
|
|
3
|
+
fieldId?: string;
|
|
4
|
+
}
|
|
5
|
+
export declare const createModelField: (params: CreateModelFieldParams) => CmsModelField;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.createModelField = void 0;
|
|
8
|
+
var _camelCase = _interopRequireDefault(require("lodash/camelCase"));
|
|
9
|
+
const createModelField = params => {
|
|
10
|
+
const {
|
|
11
|
+
label,
|
|
12
|
+
fieldId: initialFieldId,
|
|
13
|
+
type,
|
|
14
|
+
settings = {},
|
|
15
|
+
listValidation = [],
|
|
16
|
+
validation = [],
|
|
17
|
+
multipleValues = false,
|
|
18
|
+
predefinedValues = {
|
|
19
|
+
values: [],
|
|
20
|
+
enabled: false
|
|
21
|
+
}
|
|
22
|
+
} = params;
|
|
23
|
+
const fieldId = initialFieldId ? (0, _camelCase.default)(initialFieldId) : (0, _camelCase.default)(label);
|
|
24
|
+
return {
|
|
25
|
+
id: fieldId,
|
|
26
|
+
storageId: `${type}@${fieldId}`,
|
|
27
|
+
fieldId,
|
|
28
|
+
label,
|
|
29
|
+
type,
|
|
30
|
+
settings,
|
|
31
|
+
listValidation,
|
|
32
|
+
validation,
|
|
33
|
+
multipleValues,
|
|
34
|
+
predefinedValues
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
exports.createModelField = createModelField;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createModelField","params","label","fieldId","initialFieldId","type","settings","listValidation","validation","multipleValues","predefinedValues","values","enabled","camelCase","id","storageId"],"sources":["createModelField.ts"],"sourcesContent":["import { CmsModelField } from \"@webiny/api-headless-cms/types\";\nimport camelCase from \"lodash/camelCase\";\n\nexport interface CreateModelFieldParams\n extends Omit<CmsModelField, \"id\" | \"storageId\" | \"fieldId\"> {\n fieldId?: string;\n}\n\nexport const createModelField = (params: CreateModelFieldParams): CmsModelField => {\n const {\n label,\n fieldId: initialFieldId,\n type,\n settings = {},\n listValidation = [],\n validation = [],\n multipleValues = false,\n predefinedValues = {\n values: [],\n enabled: false\n }\n } = params;\n\n const fieldId = initialFieldId ? camelCase(initialFieldId) : camelCase(label);\n\n return {\n id: fieldId,\n storageId: `${type}@${fieldId}`,\n fieldId,\n label,\n type,\n settings,\n listValidation,\n validation,\n multipleValues,\n predefinedValues\n };\n};\n"],"mappings":";;;;;;;AACA;AAOO,MAAMA,gBAAgB,GAAIC,MAA8B,IAAoB;EAC/E,MAAM;IACFC,KAAK;IACLC,OAAO,EAAEC,cAAc;IACvBC,IAAI;IACJC,QAAQ,GAAG,CAAC,CAAC;IACbC,cAAc,GAAG,EAAE;IACnBC,UAAU,GAAG,EAAE;IACfC,cAAc,GAAG,KAAK;IACtBC,gBAAgB,GAAG;MACfC,MAAM,EAAE,EAAE;MACVC,OAAO,EAAE;IACb;EACJ,CAAC,GAAGX,MAAM;EAEV,MAAME,OAAO,GAAGC,cAAc,GAAG,IAAAS,kBAAS,EAACT,cAAc,CAAC,GAAG,IAAAS,kBAAS,EAACX,KAAK,CAAC;EAE7E,OAAO;IACHY,EAAE,EAAEX,OAAO;IACXY,SAAS,EAAG,GAAEV,IAAK,IAAGF,OAAQ,EAAC;IAC/BA,OAAO;IACPD,KAAK;IACLG,IAAI;IACJC,QAAQ;IACRC,cAAc;IACdC,UAAU;IACVC,cAAc;IACdC;EACJ,CAAC;AACL,CAAC;AAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { CreateAcoStorageOperationsParams } from "../createAcoStorageOperations";
|
|
2
|
+
import { CmsModel } from "@webiny/api-headless-cms/types";
|
|
3
|
+
interface CreateOperationsWrapperParams extends CreateAcoStorageOperationsParams {
|
|
4
|
+
modelName: string;
|
|
5
|
+
}
|
|
6
|
+
export declare const createOperationsWrapper: (params: CreateOperationsWrapperParams) => {
|
|
7
|
+
withModel: <TResult>(cb: (model: CmsModel) => Promise<TResult>) => Promise<TResult>;
|
|
8
|
+
};
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.createOperationsWrapper = void 0;
|
|
8
|
+
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
9
|
+
const createOperationsWrapper = params => {
|
|
10
|
+
const {
|
|
11
|
+
cms,
|
|
12
|
+
security,
|
|
13
|
+
modelName
|
|
14
|
+
} = params;
|
|
15
|
+
const withModel = async cb => {
|
|
16
|
+
return security.withoutAuthorization(async () => {
|
|
17
|
+
const model = await cms.getModel(modelName);
|
|
18
|
+
if (!model) {
|
|
19
|
+
throw new _error.default(`Could not find "${modelName}" model.`, "MODEL_NOT_FOUND_ERROR");
|
|
20
|
+
}
|
|
21
|
+
const result = await cb(model);
|
|
22
|
+
return result;
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
return {
|
|
26
|
+
withModel
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
exports.createOperationsWrapper = createOperationsWrapper;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createOperationsWrapper","params","cms","security","modelName","withModel","cb","withoutAuthorization","model","getModel","WebinyError","result"],"sources":["createOperationsWrapper.ts"],"sourcesContent":["import { CreateAcoStorageOperationsParams } from \"~/createAcoStorageOperations\";\nimport { CmsModel } from \"@webiny/api-headless-cms/types\";\nimport WebinyError from \"@webiny/error\";\n\ninterface CreateOperationsWrapperParams extends CreateAcoStorageOperationsParams {\n modelName: string;\n}\n\nexport const createOperationsWrapper = (params: CreateOperationsWrapperParams) => {\n const { cms, security, modelName } = params;\n\n const withModel = async <TResult>(\n cb: (model: CmsModel) => Promise<TResult>\n ): Promise<TResult> => {\n return security.withoutAuthorization(async () => {\n const model = await cms.getModel(modelName);\n\n if (!model) {\n throw new WebinyError(\n `Could not find \"${modelName}\" model.`,\n \"MODEL_NOT_FOUND_ERROR\"\n );\n }\n\n const result = await cb(model);\n\n return result;\n });\n };\n\n return {\n withModel\n };\n};\n"],"mappings":";;;;;;;AAEA;AAMO,MAAMA,uBAAuB,GAAIC,MAAqC,IAAK;EAC9E,MAAM;IAAEC,GAAG;IAAEC,QAAQ;IAAEC;EAAU,CAAC,GAAGH,MAAM;EAE3C,MAAMI,SAAS,GAAG,MACdC,EAAyC,IACtB;IACnB,OAAOH,QAAQ,CAACI,oBAAoB,CAAC,YAAY;MAC7C,MAAMC,KAAK,GAAG,MAAMN,GAAG,CAACO,QAAQ,CAACL,SAAS,CAAC;MAE3C,IAAI,CAACI,KAAK,EAAE;QACR,MAAM,IAAIE,cAAW,CAChB,mBAAkBN,SAAU,UAAS,EACtC,uBAAuB,CAC1B;MACL;MAEA,MAAMO,MAAM,GAAG,MAAML,EAAE,CAACE,KAAK,CAAC;MAE9B,OAAOG,MAAM;IACjB,CAAC,CAAC;EACN,CAAC;EAED,OAAO;IACHN;EACJ,CAAC;AACL,CAAC;AAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { CmsContext, CmsEntry, CmsModel } from "@webiny/api-headless-cms/types";
|
|
2
|
+
import { AcoBaseFields } from "../types";
|
|
3
|
+
interface Transformer {
|
|
4
|
+
fieldId: keyof AcoBaseFields;
|
|
5
|
+
model: any;
|
|
6
|
+
field: any;
|
|
7
|
+
}
|
|
8
|
+
interface GetFieldValuesParams {
|
|
9
|
+
entry: CmsEntry;
|
|
10
|
+
fields: string[];
|
|
11
|
+
transformers?: Transformer[];
|
|
12
|
+
context: CmsContext;
|
|
13
|
+
}
|
|
14
|
+
export declare const getFieldValues: <T extends AcoBaseFields>(params: GetFieldValuesParams) => Promise<T>;
|
|
15
|
+
export declare const getTransformer: (model: CmsModel, fieldId: string) => Transformer;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.getTransformer = exports.getFieldValues = void 0;
|
|
8
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
9
|
+
var _pick = _interopRequireDefault(require("lodash/pick"));
|
|
10
|
+
var _apiHeadlessCms = require("@webiny/api-headless-cms");
|
|
11
|
+
const getFieldValues = async params => {
|
|
12
|
+
const {
|
|
13
|
+
entry,
|
|
14
|
+
context,
|
|
15
|
+
transformers = [],
|
|
16
|
+
fields
|
|
17
|
+
} = params;
|
|
18
|
+
const values = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, (0, _pick.default)(entry, fields)), entry.values);
|
|
19
|
+
/**
|
|
20
|
+
* Transform field value for each transformers.
|
|
21
|
+
*/
|
|
22
|
+
for (const transformer of transformers) {
|
|
23
|
+
const {
|
|
24
|
+
fieldId,
|
|
25
|
+
model,
|
|
26
|
+
field
|
|
27
|
+
} = transformer;
|
|
28
|
+
// Get transformed value (eg. data decompression)
|
|
29
|
+
values[fieldId] = await (0, _apiHeadlessCms.entryFieldFromStorageTransform)({
|
|
30
|
+
context,
|
|
31
|
+
model,
|
|
32
|
+
field,
|
|
33
|
+
value: values[fieldId]
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
return values;
|
|
37
|
+
};
|
|
38
|
+
exports.getFieldValues = getFieldValues;
|
|
39
|
+
const getTransformer = (model, fieldId) => ({
|
|
40
|
+
fieldId: fieldId,
|
|
41
|
+
model: model,
|
|
42
|
+
field: model.fields.find(field => field.fieldId === fieldId)
|
|
43
|
+
});
|
|
44
|
+
exports.getTransformer = getTransformer;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["getFieldValues","params","entry","context","transformers","fields","values","pick","transformer","fieldId","model","field","entryFieldFromStorageTransform","value","getTransformer","find"],"sources":["fieldResolver.ts"],"sourcesContent":["import pick from \"lodash/pick\";\nimport { CmsContext, CmsEntry, CmsModel } from \"@webiny/api-headless-cms/types\";\nimport { entryFieldFromStorageTransform } from \"@webiny/api-headless-cms\";\nimport { AcoBaseFields } from \"~/types\";\n\ninterface Transformer {\n fieldId: keyof AcoBaseFields;\n model: any;\n field: any;\n}\n\ninterface GetFieldValuesParams {\n entry: CmsEntry;\n fields: string[];\n transformers?: Transformer[];\n context: CmsContext;\n}\n\nexport const getFieldValues = async <T extends AcoBaseFields>(\n params: GetFieldValuesParams\n): Promise<T> => {\n const { entry, context, transformers = [], fields } = params;\n const values = {\n ...pick(entry, fields),\n ...entry.values\n } as T;\n /**\n * Transform field value for each transformers.\n */\n for (const transformer of transformers) {\n const { fieldId, model, field } = transformer;\n // Get transformed value (eg. data decompression)\n values[fieldId] = await entryFieldFromStorageTransform({\n context,\n model,\n field,\n value: values[fieldId]\n });\n }\n\n return values;\n};\n\nexport const getTransformer = (model: CmsModel, fieldId: string): Transformer => ({\n fieldId: fieldId as unknown as keyof AcoBaseFields,\n model: model,\n field: model.fields.find(field => field.fieldId === fieldId)\n});\n"],"mappings":";;;;;;;;AAAA;AAEA;AAgBO,MAAMA,cAAc,GAAG,MAC1BC,MAA4B,IACf;EACb,MAAM;IAAEC,KAAK;IAAEC,OAAO;IAAEC,YAAY,GAAG,EAAE;IAAEC;EAAO,CAAC,GAAGJ,MAAM;EAC5D,MAAMK,MAAM,+DACL,IAAAC,aAAI,EAACL,KAAK,EAAEG,MAAM,CAAC,GACnBH,KAAK,CAACI,MAAM,CACb;EACN;AACJ;AACA;EACI,KAAK,MAAME,WAAW,IAAIJ,YAAY,EAAE;IACpC,MAAM;MAAEK,OAAO;MAAEC,KAAK;MAAEC;IAAM,CAAC,GAAGH,WAAW;IAC7C;IACAF,MAAM,CAACG,OAAO,CAAC,GAAG,MAAM,IAAAG,8CAA8B,EAAC;MACnDT,OAAO;MACPO,KAAK;MACLC,KAAK;MACLE,KAAK,EAAEP,MAAM,CAACG,OAAO;IACzB,CAAC,CAAC;EACN;EAEA,OAAOH,MAAM;AACjB,CAAC;AAAC;AAEK,MAAMQ,cAAc,GAAG,CAACJ,KAAe,EAAED,OAAe,MAAmB;EAC9EA,OAAO,EAAEA,OAAyC;EAClDC,KAAK,EAAEA,KAAK;EACZC,KAAK,EAAED,KAAK,CAACL,MAAM,CAACU,IAAI,CAACJ,KAAK,IAAIA,KAAK,CAACF,OAAO,KAAKA,OAAO;AAC/D,CAAC,CAAC;AAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { CmsEntry } from "@webiny/api-headless-cms/types";
|
|
2
|
+
import { SearchRecord } from "../record/record.types";
|
|
3
|
+
import { Folder } from "../folder/folder.types";
|
|
4
|
+
export declare function getRecordFieldValues(entry: CmsEntry, fields: string[]): SearchRecord<any>;
|
|
5
|
+
export declare function getFolderFieldValues(entry: CmsEntry, fields: string[]): Folder;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.getFolderFieldValues = getFolderFieldValues;
|
|
8
|
+
exports.getRecordFieldValues = getRecordFieldValues;
|
|
9
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
10
|
+
var _pick = _interopRequireDefault(require("lodash/pick"));
|
|
11
|
+
function getRecordFieldValues(entry, fields) {
|
|
12
|
+
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, (0, _pick.default)(entry, fields)), entry.values);
|
|
13
|
+
}
|
|
14
|
+
function getFolderFieldValues(entry, fields) {
|
|
15
|
+
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, (0, _pick.default)(entry, fields)), entry.values);
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["getRecordFieldValues","entry","fields","pick","values","getFolderFieldValues"],"sources":["getFieldValues.ts"],"sourcesContent":["import pick from \"lodash/pick\";\nimport { CmsEntry } from \"@webiny/api-headless-cms/types\";\nimport { SearchRecord } from \"~/record/record.types\";\nimport { Folder } from \"~/folder/folder.types\";\n\nexport function getRecordFieldValues(entry: CmsEntry, fields: string[]) {\n return {\n ...pick(entry, fields),\n ...entry.values\n } as SearchRecord<any>;\n}\n\nexport function getFolderFieldValues(entry: CmsEntry, fields: string[]) {\n return { ...pick(entry, fields), ...entry.values } as Folder;\n}\n"],"mappings":";;;;;;;;;AAAA;AAKO,SAASA,oBAAoB,CAACC,KAAe,EAAEC,MAAgB,EAAE;EACpE,mEACO,IAAAC,aAAI,EAACF,KAAK,EAAEC,MAAM,CAAC,GACnBD,KAAK,CAACG,MAAM;AAEvB;AAEO,SAASC,oBAAoB,CAACJ,KAAe,EAAEC,MAAgB,EAAE;EACpE,mEAAY,IAAAC,aAAI,EAACF,KAAK,EAAEC,MAAM,CAAC,GAAKD,KAAK,CAACG,MAAM;AACpD"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.isInstallationPending = void 0;
|
|
7
|
+
const isInstallationPending = ({
|
|
8
|
+
tenancy,
|
|
9
|
+
i18n
|
|
10
|
+
}) => {
|
|
11
|
+
/**
|
|
12
|
+
* In case of a fresh webiny project "tenant" and "locale" won't be there until
|
|
13
|
+
* installation is completed. So, we need to skip "ACO" creation till then.
|
|
14
|
+
*/
|
|
15
|
+
const tenant = tenancy.getCurrentTenant();
|
|
16
|
+
if (!tenant) {
|
|
17
|
+
return true;
|
|
18
|
+
}
|
|
19
|
+
return !i18n.getContentLocale();
|
|
20
|
+
};
|
|
21
|
+
exports.isInstallationPending = isInstallationPending;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["isInstallationPending","tenancy","i18n","tenant","getCurrentTenant","getContentLocale"],"sources":["isInstallationPending.ts"],"sourcesContent":["import { AcoContext } from \"~/types\";\n\ntype CheckInstallationParams = Pick<AcoContext, \"tenancy\" | \"i18n\">;\nexport const isInstallationPending = ({ tenancy, i18n }: CheckInstallationParams): boolean => {\n /**\n * In case of a fresh webiny project \"tenant\" and \"locale\" won't be there until\n * installation is completed. So, we need to skip \"ACO\" creation till then.\n */\n const tenant = tenancy.getCurrentTenant();\n if (!tenant) {\n return true;\n }\n\n return !i18n.getContentLocale();\n};\n"],"mappings":";;;;;;AAGO,MAAMA,qBAAqB,GAAG,CAAC;EAAEC,OAAO;EAAEC;AAA8B,CAAC,KAAc;EAC1F;AACJ;AACA;AACA;EACI,MAAMC,MAAM,GAAGF,OAAO,CAACG,gBAAgB,EAAE;EACzC,IAAI,CAACD,MAAM,EAAE;IACT,OAAO,IAAI;EACf;EAEA,OAAO,CAACD,IAAI,CAACG,gBAAgB,EAAE;AACnC,CAAC;AAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { CmsModelPlugin, CmsPrivateModelFull } from "@webiny/api-headless-cms";
|
|
2
|
+
import { CmsGroup } from "@webiny/api-headless-cms/types";
|
|
3
|
+
interface Params {
|
|
4
|
+
group: Pick<CmsGroup, "id" | "name">;
|
|
5
|
+
/**
|
|
6
|
+
* Locale and tenant do not need to be defined.
|
|
7
|
+
* In that case model is not bound to any locale or tenant.
|
|
8
|
+
* You can bind it to locale, tenant, both or none.
|
|
9
|
+
*/
|
|
10
|
+
locale?: string;
|
|
11
|
+
tenant?: string;
|
|
12
|
+
modelDefinition: Omit<CmsPrivateModelFull, "noValidate" | "group">;
|
|
13
|
+
}
|
|
14
|
+
export declare const modelFactory: (params: Params) => CmsModelPlugin;
|
|
15
|
+
export {};
|