@webiny/api-aco 5.40.5 → 5.41.0-dbt.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/apps/AcoApp.js CHANGED
@@ -21,7 +21,7 @@ class AcoApp {
21
21
  if (!this.onEntry) {
22
22
  return result;
23
23
  }
24
- return this.onEntry(result);
24
+ return await this.onEntry(result);
25
25
  },
26
26
  update: async (id, data) => {
27
27
  await this.execOnAnyRequest("update");
@@ -29,7 +29,7 @@ class AcoApp {
29
29
  if (!this.onEntry) {
30
30
  return result;
31
31
  }
32
- return this.onEntry(result);
32
+ return await this.onEntry(result);
33
33
  },
34
34
  move: async (id, folderId) => {
35
35
  await this.execOnAnyRequest("move");
@@ -41,7 +41,7 @@ class AcoApp {
41
41
  if (!result || !this.onEntry) {
42
42
  return result;
43
43
  }
44
- return this.onEntry(result);
44
+ return await this.onEntry(result);
45
45
  },
46
46
  list: async params => {
47
47
  await this.execOnAnyRequest("fetch");
@@ -1 +1 @@
1
- {"version":3,"names":["_error","_interopRequireDefault","require","_upperFirst","_camelCase","_record","createApiName","name","lodashUpperFirst","lodashCamelCase","AcoApp","search","create","data","execOnAnyRequest","result","context","aco","getModel","onEntry","update","id","move","folderId","get","list","params","onEntryList","entries","meta","items","delete","listTags","folder","tenant","tenancy","getCurrentTenant","locale","i18n","getContentLocale","code","model","constructor","structuredClone","modelId","toLowerCase","apiName","singularApiName","pluralApiName","index","fields","findIndex","f","fieldId","WebinyError","settings","push","getFields","addField","field","removeField","DEFAULT_FIELDS","includes","splice","modifyField","cb","action","onAnyRequest","exports"],"sources":["AcoApp.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport {\n AcoContext,\n AcoRequestAction,\n AcoSearchRecordCrudBase,\n CreateSearchRecordParams,\n IAcoApp,\n IAcoAppModifyFieldCallableCallback,\n IAcoAppOnAnyRequest,\n IAcoAppOnEntry,\n IAcoAppOnEntryList,\n IAcoAppParams,\n ListSearchRecordsParams,\n ListSearchRecordTagsParams,\n SearchRecord\n} from \"~/types\";\nimport { CmsModel, CmsModelField } from \"@webiny/api-headless-cms/types\";\nimport lodashUpperFirst from \"lodash/upperFirst\";\nimport lodashCamelCase from \"lodash/camelCase\";\nimport { DEFAULT_FIELDS } from \"~/record/record.model\";\n\nconst createApiName = (name: string) => {\n return lodashUpperFirst(lodashCamelCase(name));\n};\n\nexport class AcoApp implements IAcoApp {\n public readonly name: string;\n public readonly context: AcoContext;\n public readonly model: CmsModel;\n private readonly fields: CmsModelField[];\n private readonly onEntry?: IAcoAppOnEntry;\n private readonly onEntryList?: IAcoAppOnEntryList;\n private readonly onAnyRequest?: IAcoAppOnAnyRequest;\n\n public get search(): AcoSearchRecordCrudBase {\n return {\n create: async <TData>(data: CreateSearchRecordParams<TData>) => {\n await this.execOnAnyRequest(\"create\");\n const result = await this.context.aco.search.create<TData>(this.getModel(), data);\n if (!this.onEntry) {\n return result;\n }\n return this.onEntry(result);\n },\n update: async <TData>(id: string, data: SearchRecord<TData>) => {\n await this.execOnAnyRequest(\"update\");\n const result = await this.context.aco.search.update<TData>(\n this.getModel(),\n id,\n data\n );\n if (!this.onEntry) {\n return result;\n }\n return this.onEntry(result);\n },\n move: async (id: string, folderId?: string) => {\n await this.execOnAnyRequest(\"move\");\n return this.context.aco.search.move(this.getModel(), id, folderId);\n },\n get: async <TData>(id: string) => {\n await this.execOnAnyRequest(\"fetch\");\n const result = await this.context.aco.search.get<TData>(this.getModel(), id);\n if (!result || !this.onEntry) {\n return result;\n }\n return this.onEntry(result);\n },\n list: async <TData>(params: ListSearchRecordsParams) => {\n await this.execOnAnyRequest(\"fetch\");\n const result = await this.context.aco.search.list<TData>(this.getModel(), params);\n const onEntryList = this.onEntryList;\n if (!onEntryList) {\n return result;\n }\n const [entries, meta] = result;\n const items = await onEntryList(entries);\n return [items, meta];\n },\n delete: async (id: string): Promise<boolean> => {\n await this.execOnAnyRequest(\"delete\");\n return this.context.aco.search.delete(this.getModel(), id);\n },\n listTags: async (params: ListSearchRecordTagsParams) => {\n await this.execOnAnyRequest(\"fetch\");\n return this.context.aco.search.listTags(this.getModel(), params);\n }\n };\n }\n\n public get folder() {\n return this.context.aco.folder;\n }\n\n private getModel() {\n const tenant = this.context.tenancy.getCurrentTenant().id;\n const locale = this.context.i18n.getContentLocale()!.code;\n\n return { ...this.model, tenant, locale };\n }\n\n private constructor(context: AcoContext, params: IAcoAppParams) {\n this.context = context;\n this.name = params.name;\n this.onEntry = params.onEntry;\n this.onEntryList = params.onEntryList;\n this.model = structuredClone(params.model);\n /**\n * We can safely define the api name of the model as we control everything here.\n */\n this.model.name = `${this.model.name} ${this.name}`;\n this.model.modelId = `${this.model.modelId}-${this.name.toLowerCase()}`;\n const apiName = `AcoSearchRecord${createApiName(params.apiName)}`;\n this.model.singularApiName = apiName;\n this.model.pluralApiName = apiName;\n\n const index = this.model.fields.findIndex(f => f.fieldId === \"data\");\n if (index === -1) {\n throw new WebinyError(\n `The \"data\" field does not exist in model \"${this.model.modelId}\".`,\n \"MODEL_DATA_FIELD_ERROR\",\n {\n modelId: this.model.modelId\n }\n );\n } else if (!this.model.fields[index].settings?.fields) {\n this.model.fields[index].settings!.fields = [];\n }\n this.fields = this.model.fields[index].settings!.fields as CmsModelField[];\n this.fields.push(...params.fields);\n }\n\n public static create(context: AcoContext, params: IAcoAppParams) {\n return new AcoApp(context, params);\n }\n\n public getFields(): CmsModelField[] {\n return this.fields;\n }\n\n public addField(field: CmsModelField): void {\n this.fields.push(field);\n }\n\n public removeField(id: string): void {\n if (DEFAULT_FIELDS.includes(id)) {\n throw new WebinyError(\n `Cannot remove the default field from the ACO App.`,\n \"REMOVE_DEFAULT_FIELD_ERROR\",\n {\n fieldId: id\n }\n );\n }\n const index = this.fields.findIndex(field => field.id === id);\n if (index === -1) {\n return;\n }\n this.fields.splice(index, 1);\n }\n\n public modifyField(id: string, cb: IAcoAppModifyFieldCallableCallback): void {\n const index = this.fields.findIndex(field => field.id === id);\n if (index === -1) {\n throw new WebinyError(\n `There is no field \"${id}\" in app \"${this.name}\".`,\n \"FIELD_NOT_FOUND_ERROR\",\n {\n id\n }\n );\n }\n this.fields[index] = cb(structuredClone(this.fields[index]));\n }\n\n private async execOnAnyRequest(action: AcoRequestAction): Promise<void> {\n if (!this.onAnyRequest) {\n return;\n }\n await this.onAnyRequest(this.context, action);\n }\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAiBA,IAAAC,WAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,UAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AAEA,MAAMI,aAAa,GAAIC,IAAY,IAAK;EACpC,OAAO,IAAAC,mBAAgB,EAAC,IAAAC,kBAAe,EAACF,IAAI,CAAC,CAAC;AAClD,CAAC;AAEM,MAAMG,MAAM,CAAoB;EASnC,IAAWC,MAAMA,CAAA,EAA4B;IACzC,OAAO;MACHC,MAAM,EAAE,MAAcC,IAAqC,IAAK;QAC5D,MAAM,IAAI,CAACC,gBAAgB,CAAC,QAAQ,CAAC;QACrC,MAAMC,MAAM,GAAG,MAAM,IAAI,CAACC,OAAO,CAACC,GAAG,CAACN,MAAM,CAACC,MAAM,CAAQ,IAAI,CAACM,QAAQ,CAAC,CAAC,EAAEL,IAAI,CAAC;QACjF,IAAI,CAAC,IAAI,CAACM,OAAO,EAAE;UACf,OAAOJ,MAAM;QACjB;QACA,OAAO,IAAI,CAACI,OAAO,CAACJ,MAAM,CAAC;MAC/B,CAAC;MACDK,MAAM,EAAE,MAAAA,CAAcC,EAAU,EAAER,IAAyB,KAAK;QAC5D,MAAM,IAAI,CAACC,gBAAgB,CAAC,QAAQ,CAAC;QACrC,MAAMC,MAAM,GAAG,MAAM,IAAI,CAACC,OAAO,CAACC,GAAG,CAACN,MAAM,CAACS,MAAM,CAC/C,IAAI,CAACF,QAAQ,CAAC,CAAC,EACfG,EAAE,EACFR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,IAAI,CAACA,YAAY,CAAC,IAAI,CAACnD,OAAO,EAAEkD,MAAM,CAAC;EACjD;AACJ;AAACE,OAAA,CAAA1D,MAAA,GAAAA,MAAA","ignoreList":[]}
1
+ {"version":3,"names":["_error","_interopRequireDefault","require","_upperFirst","_camelCase","_record","createApiName","name","lodashUpperFirst","lodashCamelCase","AcoApp","search","create","data","execOnAnyRequest","result","context","aco","getModel","onEntry","update","id","move","folderId","get","list","params","onEntryList","entries","meta","items","delete","listTags","folder","tenant","tenancy","getCurrentTenant","locale","i18n","getContentLocale","code","model","constructor","structuredClone","modelId","toLowerCase","apiName","singularApiName","pluralApiName","index","fields","findIndex","f","fieldId","WebinyError","settings","push","getFields","addField","field","removeField","DEFAULT_FIELDS","includes","splice","modifyField","cb","action","onAnyRequest","exports"],"sources":["AcoApp.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport {\n AcoContext,\n AcoRequestAction,\n AcoSearchRecordCrudBase,\n CreateSearchRecordParams,\n GenericSearchData,\n IAcoApp,\n IAcoAppModifyFieldCallableCallback,\n IAcoAppOnAnyRequest,\n IAcoAppOnEntry,\n IAcoAppOnEntryList,\n IAcoAppParams,\n ListSearchRecordsParams,\n ListSearchRecordTagsParams,\n SearchRecord,\n UpdateSearchRecordParams\n} from \"~/types\";\nimport { CmsModel, CmsModelField } from \"@webiny/api-headless-cms/types\";\nimport lodashUpperFirst from \"lodash/upperFirst\";\nimport lodashCamelCase from \"lodash/camelCase\";\nimport { DEFAULT_FIELDS } from \"~/record/record.model\";\n\nconst createApiName = (name: string) => {\n return lodashUpperFirst(lodashCamelCase(name));\n};\n\nexport class AcoApp implements IAcoApp {\n public readonly name: string;\n public readonly context: AcoContext;\n public readonly model: CmsModel;\n private readonly fields: CmsModelField[];\n private readonly onEntry?: IAcoAppOnEntry;\n private readonly onEntryList?: IAcoAppOnEntryList;\n private readonly onAnyRequest?: IAcoAppOnAnyRequest;\n\n public get search(): AcoSearchRecordCrudBase {\n return {\n create: async <TData extends GenericSearchData = GenericSearchData>(\n data: CreateSearchRecordParams<TData>\n ) => {\n await this.execOnAnyRequest(\"create\");\n const result = await this.context.aco.search.create<TData>(this.getModel(), data);\n if (!this.onEntry) {\n return result;\n }\n return (await this.onEntry(result)) as SearchRecord<TData>;\n },\n update: async <TData extends GenericSearchData = GenericSearchData>(\n id: string,\n data: UpdateSearchRecordParams<TData>\n ) => {\n await this.execOnAnyRequest(\"update\");\n const result = await this.context.aco.search.update<TData>(\n this.getModel(),\n id,\n data\n );\n if (!this.onEntry) {\n return result;\n }\n return (await this.onEntry(result)) as SearchRecord<TData>;\n },\n move: async (id: string, folderId?: string) => {\n await this.execOnAnyRequest(\"move\");\n return this.context.aco.search.move(this.getModel(), id, folderId);\n },\n get: async <TData extends GenericSearchData = GenericSearchData>(id: string) => {\n await this.execOnAnyRequest(\"fetch\");\n const result = await this.context.aco.search.get<TData>(this.getModel(), id);\n if (!result || !this.onEntry) {\n return result;\n }\n return (await this.onEntry(result)) as SearchRecord<TData>;\n },\n list: async <TData extends GenericSearchData = GenericSearchData>(\n params: ListSearchRecordsParams\n ) => {\n await this.execOnAnyRequest(\"fetch\");\n const result = await this.context.aco.search.list<TData>(this.getModel(), params);\n const onEntryList = this.onEntryList;\n if (!onEntryList) {\n return result;\n }\n const [entries, meta] = result;\n const items = (await onEntryList(entries)) as SearchRecord<TData>[];\n return [items, meta];\n },\n delete: async (id: string): Promise<boolean> => {\n await this.execOnAnyRequest(\"delete\");\n return this.context.aco.search.delete(this.getModel(), id);\n },\n listTags: async (params: ListSearchRecordTagsParams) => {\n await this.execOnAnyRequest(\"fetch\");\n return this.context.aco.search.listTags(this.getModel(), params);\n }\n };\n }\n\n public get folder() {\n return this.context.aco.folder;\n }\n\n private getModel() {\n const tenant = this.context.tenancy.getCurrentTenant().id;\n const locale = this.context.i18n.getContentLocale()!.code;\n\n return { ...this.model, tenant, locale };\n }\n\n private constructor(context: AcoContext, params: IAcoAppParams) {\n this.context = context;\n this.name = params.name;\n this.onEntry = params.onEntry;\n this.onEntryList = params.onEntryList;\n this.model = structuredClone(params.model);\n /**\n * We can safely define the api name of the model as we control everything here.\n */\n this.model.name = `${this.model.name} ${this.name}`;\n this.model.modelId = `${this.model.modelId}-${this.name.toLowerCase()}`;\n const apiName = `AcoSearchRecord${createApiName(params.apiName)}`;\n this.model.singularApiName = apiName;\n this.model.pluralApiName = apiName;\n\n const index = this.model.fields.findIndex(f => f.fieldId === \"data\");\n if (index === -1) {\n throw new WebinyError(\n `The \"data\" field does not exist in model \"${this.model.modelId}\".`,\n \"MODEL_DATA_FIELD_ERROR\",\n {\n modelId: this.model.modelId\n }\n );\n } else if (!this.model.fields[index].settings?.fields) {\n this.model.fields[index].settings!.fields = [];\n }\n this.fields = this.model.fields[index].settings!.fields as CmsModelField[];\n this.fields.push(...params.fields);\n }\n\n public static create(context: AcoContext, params: IAcoAppParams) {\n return new AcoApp(context, params);\n }\n\n public getFields(): CmsModelField[] {\n return this.fields;\n }\n\n public addField(field: CmsModelField): void {\n this.fields.push(field);\n }\n\n public removeField(id: string): void {\n if (DEFAULT_FIELDS.includes(id)) {\n throw new WebinyError(\n `Cannot remove the default field from the ACO App.`,\n \"REMOVE_DEFAULT_FIELD_ERROR\",\n {\n fieldId: id\n }\n );\n }\n const index = this.fields.findIndex(field => field.id === id);\n if (index === -1) {\n return;\n }\n this.fields.splice(index, 1);\n }\n\n public modifyField(id: string, cb: IAcoAppModifyFieldCallableCallback): void {\n const index = this.fields.findIndex(field => field.id === id);\n if (index === -1) {\n throw new WebinyError(\n `There is no field \"${id}\" in app \"${this.name}\".`,\n \"FIELD_NOT_FOUND_ERROR\",\n {\n id\n }\n );\n }\n this.fields[index] = cb(structuredClone(this.fields[index]));\n }\n\n private async execOnAnyRequest(action: AcoRequestAction): Promise<void> {\n if (!this.onAnyRequest) {\n return;\n }\n await this.onAnyRequest(this.context, action);\n }\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC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,CAACzC,EAAE,CAAC,EAAE;MAC7B,MAAM,IAAIiC,cAAW,CAChB,mDAAkD,EACnD,4BAA4B,EAC5B;QACID,OAAO,EAAEhC;MACb,CACJ,CAAC;IACL;IACA,MAAM4B,KAAK,GAAG,IAAI,CAACC,MAAM,CAACC,SAAS,CAACQ,KAAK,IAAIA,KAAK,CAACtC,EAAE,KAAKA,EAAE,CAAC;IAC7D,IAAI4B,KAAK,KAAK,CAAC,CAAC,EAAE;MACd;IACJ;IACA,IAAI,CAACC,MAAM,CAACa,MAAM,CAACd,KAAK,EAAE,CAAC,CAAC;EAChC;EAEOe,WAAWA,CAAC3C,EAAU,EAAE4C,EAAsC,EAAQ;IACzE,MAAMhB,KAAK,GAAG,IAAI,CAACC,MAAM,CAACC,SAAS,CAACQ,KAAK,IAAIA,KAAK,CAACtC,EAAE,KAAKA,EAAE,CAAC;IAC7D,IAAI4B,KAAK,KAAK,CAAC,CAAC,EAAE;MACd,MAAM,IAAIK,cAAW,CAChB,sBAAqBjC,EAAG,aAAY,IAAI,CAACd,IAAK,IAAG,EAClD,uBAAuB,EACvB;QACIc;MACJ,CACJ,CAAC;IACL;IACA,IAAI,CAAC6B,MAAM,CAACD,KAAK,CAAC,GAAGgB,EAAE,CAACtB,eAAe,CAAC,IAAI,CAACO,MAAM,CAACD,KAAK,CAAC,CAAC,CAAC;EAChE;EAEA,MAAcnC,gBAAgBA,CAACoD,MAAwB,EAAiB;IACpE,IAAI,CAAC,IAAI,CAACC,YAAY,EAAE;MACpB;IACJ;IACA,MAAM,IAAI,CAACA,YAAY,CAAC,IAAI,CAACnD,OAAO,EAAEkD,MAAM,CAAC;EACjD;AACJ;AAACE,OAAA,CAAA1D,MAAA,GAAAA,MAAA","ignoreList":[]}
@@ -29,7 +29,7 @@ export interface ListFiltersParams {
29
29
  limit?: number;
30
30
  after?: string | null;
31
31
  }
32
- export declare type CreateFilterParams = Pick<Filter, "id" | "name" | "description" | "namespace" | "operation" | "groups">;
32
+ export type CreateFilterParams = Pick<Filter, "id" | "name" | "description" | "namespace" | "operation" | "groups">;
33
33
  export interface UpdateFilterParams {
34
34
  name?: string;
35
35
  description?: string;
@@ -43,7 +43,7 @@ export interface DeleteFilterParams {
43
43
  export interface StorageOperationsGetFilterParams {
44
44
  id: string;
45
45
  }
46
- export declare type StorageOperationsListFiltersParams = ListFiltersParams;
46
+ export type StorageOperationsListFiltersParams = ListFiltersParams;
47
47
  export interface StorageOperationsCreateFilterParams {
48
48
  data: CreateFilterParams;
49
49
  }
@@ -51,7 +51,7 @@ export interface StorageOperationsUpdateFilterParams {
51
51
  id: string;
52
52
  data: UpdateFilterParams;
53
53
  }
54
- export declare type StorageOperationsDeleteFilterParams = DeleteFilterParams;
54
+ export type StorageOperationsDeleteFilterParams = DeleteFilterParams;
55
55
  export interface OnFilterBeforeCreateTopicParams {
56
56
  input: CreateFilterParams;
57
57
  }
@@ -26,8 +26,8 @@ export interface ListFoldersParams {
26
26
  limit?: number;
27
27
  after?: string | null;
28
28
  }
29
- export declare type ListAllFoldersParams = Omit<ListFoldersParams, "limit" | "after">;
30
- export declare type CreateFolderParams = Pick<Folder, "title" | "slug" | "type" | "parentId">;
29
+ export type ListAllFoldersParams = Omit<ListFoldersParams, "limit" | "after">;
30
+ export type CreateFolderParams = Pick<Folder, "title" | "slug" | "type" | "parentId">;
31
31
  export interface UpdateFolderParams {
32
32
  title?: string;
33
33
  slug?: string;
@@ -53,7 +53,7 @@ export interface StorageOperationsGetFolderParams {
53
53
  type?: string;
54
54
  parentId?: string | null;
55
55
  }
56
- export declare type StorageOperationsListFoldersParams = ListFoldersParams;
56
+ export type StorageOperationsListFoldersParams = ListFoldersParams;
57
57
  export interface StorageOperationsCreateFolderParams {
58
58
  data: CreateFolderParams;
59
59
  }
@@ -61,7 +61,7 @@ export interface StorageOperationsUpdateFolderParams {
61
61
  id: string;
62
62
  data: UpdateFolderParams;
63
63
  }
64
- export declare type StorageOperationsDeleteFolderParams = DeleteFolderParams;
64
+ export type StorageOperationsDeleteFolderParams = DeleteFolderParams;
65
65
  export interface OnFolderBeforeCreateTopicParams {
66
66
  input: CreateFolderParams;
67
67
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webiny/api-aco",
3
- "version": "5.40.5",
3
+ "version": "5.41.0-dbt.0",
4
4
  "main": "index.js",
5
5
  "keywords": [
6
6
  "aco:base"
@@ -22,18 +22,18 @@
22
22
  "directory": "dist"
23
23
  },
24
24
  "dependencies": {
25
- "@webiny/api": "5.40.5",
26
- "@webiny/api-authentication": "5.40.5",
27
- "@webiny/api-headless-cms": "5.40.5",
28
- "@webiny/api-i18n": "5.40.5",
29
- "@webiny/api-security": "5.40.5",
30
- "@webiny/api-tenancy": "5.40.5",
31
- "@webiny/error": "5.40.5",
32
- "@webiny/handler": "5.40.5",
33
- "@webiny/handler-graphql": "5.40.5",
34
- "@webiny/pubsub": "5.40.5",
35
- "@webiny/utils": "5.40.5",
36
- "@webiny/validation": "5.40.5",
25
+ "@webiny/api": "5.41.0-dbt.0",
26
+ "@webiny/api-authentication": "5.41.0-dbt.0",
27
+ "@webiny/api-headless-cms": "5.41.0-dbt.0",
28
+ "@webiny/api-i18n": "5.41.0-dbt.0",
29
+ "@webiny/api-security": "5.41.0-dbt.0",
30
+ "@webiny/api-tenancy": "5.41.0-dbt.0",
31
+ "@webiny/error": "5.41.0-dbt.0",
32
+ "@webiny/handler": "5.41.0-dbt.0",
33
+ "@webiny/handler-graphql": "5.41.0-dbt.0",
34
+ "@webiny/pubsub": "5.41.0-dbt.0",
35
+ "@webiny/utils": "5.41.0-dbt.0",
36
+ "@webiny/validation": "5.41.0-dbt.0",
37
37
  "lodash": "4.17.21"
38
38
  },
39
39
  "devDependencies": {
@@ -42,22 +42,22 @@
42
42
  "@babel/preset-env": "7.24.3",
43
43
  "@babel/preset-typescript": "7.24.1",
44
44
  "@babel/runtime": "7.24.1",
45
- "@webiny/api-admin-users": "5.40.5",
46
- "@webiny/api-file-manager": "5.40.5",
47
- "@webiny/api-i18n-ddb": "5.40.5",
48
- "@webiny/api-security-so-ddb": "5.40.5",
49
- "@webiny/api-tenancy-so-ddb": "5.40.5",
50
- "@webiny/api-wcp": "5.40.5",
51
- "@webiny/cli": "5.40.5",
52
- "@webiny/handler-aws": "5.40.5",
53
- "@webiny/plugins": "5.40.5",
54
- "@webiny/project-utils": "5.40.5",
55
- "@webiny/wcp": "5.40.5",
45
+ "@webiny/api-admin-users": "5.41.0-dbt.0",
46
+ "@webiny/api-file-manager": "5.41.0-dbt.0",
47
+ "@webiny/api-i18n-ddb": "5.41.0-dbt.0",
48
+ "@webiny/api-security-so-ddb": "5.41.0-dbt.0",
49
+ "@webiny/api-tenancy-so-ddb": "5.41.0-dbt.0",
50
+ "@webiny/api-wcp": "5.41.0-dbt.0",
51
+ "@webiny/cli": "5.41.0-dbt.0",
52
+ "@webiny/handler-aws": "5.41.0-dbt.0",
53
+ "@webiny/plugins": "5.41.0-dbt.0",
54
+ "@webiny/project-utils": "5.41.0-dbt.0",
55
+ "@webiny/wcp": "5.41.0-dbt.0",
56
56
  "graphql": "15.8.0",
57
57
  "prettier": "2.8.8",
58
58
  "rimraf": "5.0.5",
59
59
  "ttypescript": "1.5.15",
60
- "typescript": "4.7.4"
60
+ "typescript": "4.9.5"
61
61
  },
62
- "gitHead": "f67778732392ed88f28da869ddacbf08a98cdec6"
62
+ "gitHead": "bbaec4dd1685579548c08bbde386aee5d96b80f8"
63
63
  }
@@ -39,5 +39,5 @@ export declare class AcoAppModifierPlugin<T extends Context = Context> extends P
39
39
  canUse(app: IAcoApp): boolean;
40
40
  modify(params: AcoAppModifierPluginModifyParams<T>): Promise<void>;
41
41
  }
42
- export declare type CreateAcoAppModifierCallable<T extends Context = AcoContext> = AcoAppModifierPluginParamsCallable<T>;
42
+ export type CreateAcoAppModifierCallable<T extends Context = AcoContext> = AcoAppModifierPluginParamsCallable<T>;
43
43
  export declare const createAcoAppModifier: <T extends Context = AcoContext>(name: string, cb: CreateAcoAppModifierCallable<T>) => AcoAppModifierPlugin<T>;
@@ -1,7 +1,7 @@
1
1
  import { AcoBaseFields, ListMeta } from "../types";
2
2
  import { Topic } from "@webiny/pubsub/types";
3
3
  import { CmsModel } from "@webiny/api-headless-cms/types";
4
- export declare type GenericSearchData = {
4
+ export type GenericSearchData = {
5
5
  [key: string]: any;
6
6
  };
7
7
  export interface Location {
@@ -36,7 +36,7 @@ export interface ListSearchRecordsParams {
36
36
  limit?: number;
37
37
  after?: string | null;
38
38
  }
39
- export declare type CreateSearchRecordParams<TData> = Pick<SearchRecord<TData>, "id" | "title" | "content" | "type" | "location" | "data" | "tags">;
39
+ export type CreateSearchRecordParams<TData extends GenericSearchData = GenericSearchData> = Pick<SearchRecord<TData>, "id" | "title" | "content" | "type" | "location" | "data" | "tags">;
40
40
  export interface UpdateSearchRecordParams<TData extends GenericSearchData> {
41
41
  title?: string;
42
42
  content?: string;
@@ -56,8 +56,8 @@ export interface ListSearchRecordTagsParams {
56
56
  export interface StorageOperationsGetSearchRecordParams {
57
57
  id: string;
58
58
  }
59
- export declare type StorageOperationsListSearchRecordsParams = ListSearchRecordsParams;
60
- export declare type StorageOperationsListSearchRecordTagsParams = ListSearchRecordTagsParams;
59
+ export type StorageOperationsListSearchRecordsParams = ListSearchRecordsParams;
60
+ export type StorageOperationsListSearchRecordTagsParams = ListSearchRecordTagsParams;
61
61
  export interface StorageOperationsCreateSearchRecordParams<TData extends GenericSearchData = GenericSearchData> {
62
62
  data: CreateSearchRecordParams<TData>;
63
63
  }
@@ -69,7 +69,7 @@ export interface StorageOperationsMoveSearchRecordParams {
69
69
  id: string;
70
70
  folderId?: string | null;
71
71
  }
72
- export declare type StorageOperationsDeleteSearchRecordParams = DeleteSearchRecordParams;
72
+ export type StorageOperationsDeleteSearchRecordParams = DeleteSearchRecordParams;
73
73
  export interface OnSearchRecordBeforeCreateTopicParams<TData extends GenericSearchData = GenericSearchData> {
74
74
  model: CmsModel;
75
75
  input: CreateSearchRecordParams<TData>;
@@ -117,11 +117,11 @@ export interface AcoSearchRecordCrudBase {
117
117
  delete(id: string): Promise<boolean>;
118
118
  }
119
119
  export interface AcoSearchRecordCrud extends Omit<AcoSearchRecordCrudBase, "get" | "list" | "create" | "update" | "delete" | "listTags" | "move"> {
120
- get<TData>(model: CmsModel, id: string): Promise<SearchRecord<TData>>;
121
- list<TData>(model: CmsModel, params: ListSearchRecordsParams): Promise<[SearchRecord<TData>[], ListMeta]>;
120
+ get<TData extends GenericSearchData = GenericSearchData>(model: CmsModel, id: string): Promise<SearchRecord<TData>>;
121
+ list<TData extends GenericSearchData = GenericSearchData>(model: CmsModel, params: ListSearchRecordsParams): Promise<[SearchRecord<TData>[], ListMeta]>;
122
122
  listTags(model: CmsModel, params: ListSearchRecordTagsParams): Promise<[SearchRecordTag[], ListMeta]>;
123
- create<TData>(model: CmsModel, data: CreateSearchRecordParams<TData>): Promise<SearchRecord<TData>>;
124
- update<TData>(model: CmsModel, id: string, data: UpdateSearchRecordParams<TData>): Promise<SearchRecord<TData>>;
123
+ create<TData extends GenericSearchData = GenericSearchData>(model: CmsModel, data: CreateSearchRecordParams<TData>): Promise<SearchRecord<TData>>;
124
+ update<TData extends GenericSearchData = GenericSearchData>(model: CmsModel, id: string, data: UpdateSearchRecordParams<TData>): Promise<SearchRecord<TData>>;
125
125
  move(model: CmsModel, id: string, folderId?: string | null): Promise<boolean>;
126
126
  delete(model: CmsModel, id: string): Promise<boolean>;
127
127
  onSearchRecordBeforeCreate: Topic<OnSearchRecordBeforeCreateTopicParams>;
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["record.types.ts"],"sourcesContent":["import { AcoBaseFields, ListMeta } from \"~/types\";\nimport { Topic } from \"@webiny/pubsub/types\";\nimport { CmsModel } from \"@webiny/api-headless-cms/types\";\n\nexport type GenericSearchData = {\n [key: string]: any;\n};\n\nexport interface Location {\n folderId: string;\n}\n\nexport interface SearchRecord<TData extends GenericSearchData = GenericSearchData>\n extends AcoBaseFields {\n type: string;\n title: string;\n content?: string;\n location: Location;\n data: TData;\n tags: string[];\n}\n\nexport interface SearchRecordTag {\n tag: string;\n count: number;\n}\n\nexport interface ListSearchRecordsWhere<TData extends GenericSearchData = GenericSearchData> {\n type: string;\n location?: {\n folderId: string;\n };\n tags_in?: string[];\n tags_startsWith?: string;\n tags_not_startsWith?: string;\n data?: TData;\n}\n\nexport interface ListSearchRecordsParams {\n where?: ListSearchRecordsWhere;\n search?: string;\n sort?: string[];\n limit?: number;\n after?: string | null;\n}\n\nexport type CreateSearchRecordParams<TData> = Pick<\n SearchRecord<TData>,\n \"id\" | \"title\" | \"content\" | \"type\" | \"location\" | \"data\" | \"tags\"\n>;\n\nexport interface UpdateSearchRecordParams<TData extends GenericSearchData> {\n title?: string;\n content?: string;\n location?: Location;\n data?: TData;\n tags?: string[];\n}\n\nexport interface DeleteSearchRecordParams {\n id: string;\n}\n\nexport interface ListSearchRecordTagsWhere {\n type: string;\n}\n\nexport interface ListSearchRecordTagsParams {\n where?: ListSearchRecordTagsWhere;\n}\n\nexport interface StorageOperationsGetSearchRecordParams {\n id: string;\n}\n\nexport type StorageOperationsListSearchRecordsParams = ListSearchRecordsParams;\nexport type StorageOperationsListSearchRecordTagsParams = ListSearchRecordTagsParams;\n\nexport interface StorageOperationsCreateSearchRecordParams<\n TData extends GenericSearchData = GenericSearchData\n> {\n data: CreateSearchRecordParams<TData>;\n}\n\nexport interface StorageOperationsUpdateSearchRecordParams<\n TData extends GenericSearchData = GenericSearchData\n> {\n id: string;\n data: UpdateSearchRecordParams<TData>;\n}\n\nexport interface StorageOperationsMoveSearchRecordParams {\n id: string;\n folderId?: string | null;\n}\n\nexport type StorageOperationsDeleteSearchRecordParams = DeleteSearchRecordParams;\n\nexport interface OnSearchRecordBeforeCreateTopicParams<\n TData extends GenericSearchData = GenericSearchData\n> {\n model: CmsModel;\n input: CreateSearchRecordParams<TData>;\n}\n\nexport interface OnSearchRecordAfterCreateTopicParams<\n TData extends GenericSearchData = GenericSearchData\n> {\n model: CmsModel;\n record: SearchRecord<TData>;\n}\n\nexport interface OnSearchRecordBeforeUpdateTopicParams<\n TData extends GenericSearchData = GenericSearchData\n> {\n model: CmsModel;\n original: SearchRecord<TData>;\n input: Record<string, any>;\n}\n\nexport interface OnSearchRecordBeforeMoveTopicParams<\n TData extends GenericSearchData = GenericSearchData\n> {\n model: CmsModel;\n original: SearchRecord<TData>;\n folderId?: string | null;\n}\n\nexport interface OnSearchRecordAfterMoveTopicParams<\n TData extends GenericSearchData = GenericSearchData\n> {\n model: CmsModel;\n original: SearchRecord<TData>;\n folderId?: string | null;\n}\n\nexport interface OnSearchRecordAfterUpdateTopicParams<\n TData extends GenericSearchData = GenericSearchData\n> {\n model: CmsModel;\n original: SearchRecord<TData>;\n record: SearchRecord<TData>;\n input: Record<string, any>;\n}\n\nexport interface OnSearchRecordBeforeDeleteTopicParams<\n TData extends GenericSearchData = GenericSearchData\n> {\n model: CmsModel;\n record: SearchRecord<TData>;\n}\n\nexport interface OnSearchRecordAfterDeleteTopicParams<\n TData extends GenericSearchData = GenericSearchData\n> {\n model: CmsModel;\n record: SearchRecord<TData>;\n}\n\nexport interface AcoSearchRecordCrudBase {\n get<TData extends GenericSearchData = GenericSearchData>(\n id: string\n ): Promise<SearchRecord<TData>>;\n list<TData extends GenericSearchData = GenericSearchData>(\n params: ListSearchRecordsParams\n ): Promise<[SearchRecord<TData>[], ListMeta]>;\n listTags(params: ListSearchRecordTagsParams): Promise<[SearchRecordTag[], ListMeta]>;\n create<TData extends GenericSearchData = GenericSearchData>(\n data: CreateSearchRecordParams<TData>\n ): Promise<SearchRecord<TData>>;\n update<TData extends GenericSearchData = GenericSearchData>(\n id: string,\n data: UpdateSearchRecordParams<TData>\n ): Promise<SearchRecord<TData>>;\n move(id: string, folderId?: string | null): Promise<boolean>;\n delete(id: string): Promise<boolean>;\n}\n\nexport interface AcoSearchRecordCrud\n extends Omit<\n AcoSearchRecordCrudBase,\n \"get\" | \"list\" | \"create\" | \"update\" | \"delete\" | \"listTags\" | \"move\"\n > {\n get<TData>(model: CmsModel, id: string): Promise<SearchRecord<TData>>;\n list<TData>(\n model: CmsModel,\n params: ListSearchRecordsParams\n ): Promise<[SearchRecord<TData>[], ListMeta]>;\n listTags(\n model: CmsModel,\n params: ListSearchRecordTagsParams\n ): Promise<[SearchRecordTag[], ListMeta]>;\n create<TData>(\n model: CmsModel,\n data: CreateSearchRecordParams<TData>\n ): Promise<SearchRecord<TData>>;\n update<TData>(\n model: CmsModel,\n id: string,\n data: UpdateSearchRecordParams<TData>\n ): Promise<SearchRecord<TData>>;\n move(model: CmsModel, id: string, folderId?: string | null): Promise<boolean>;\n delete(model: CmsModel, id: string): Promise<boolean>;\n onSearchRecordBeforeCreate: Topic<OnSearchRecordBeforeCreateTopicParams>;\n onSearchRecordAfterCreate: Topic<OnSearchRecordAfterCreateTopicParams>;\n onSearchRecordBeforeUpdate: Topic<OnSearchRecordBeforeUpdateTopicParams>;\n onSearchRecordAfterUpdate: Topic<OnSearchRecordAfterUpdateTopicParams>;\n onSearchRecordBeforeMove: Topic<OnSearchRecordBeforeMoveTopicParams>;\n onSearchRecordAfterMove: Topic<OnSearchRecordAfterMoveTopicParams>;\n onSearchRecordBeforeDelete: Topic<OnSearchRecordBeforeDeleteTopicParams>;\n onSearchRecordAfterDelete: Topic<OnSearchRecordAfterDeleteTopicParams>;\n}\n\nexport interface AcoSearchRecordStorageOperations {\n getRecord<TData extends GenericSearchData = GenericSearchData>(\n model: CmsModel,\n params: StorageOperationsGetSearchRecordParams\n ): Promise<SearchRecord<TData>>;\n listRecords<TData extends GenericSearchData = GenericSearchData>(\n model: CmsModel,\n params: StorageOperationsListSearchRecordsParams\n ): Promise<[SearchRecord<TData>[], ListMeta]>;\n listTags(\n model: CmsModel,\n params: StorageOperationsListSearchRecordTagsParams\n ): Promise<[SearchRecordTag[], ListMeta]>;\n createRecord<TData extends GenericSearchData = GenericSearchData>(\n model: CmsModel,\n params: StorageOperationsCreateSearchRecordParams<TData>\n ): Promise<SearchRecord<TData>>;\n updateRecord<TData extends GenericSearchData = GenericSearchData>(\n model: CmsModel,\n params: StorageOperationsUpdateSearchRecordParams<TData>\n ): Promise<SearchRecord<TData>>;\n moveRecord(model: CmsModel, params: StorageOperationsMoveSearchRecordParams): Promise<boolean>;\n deleteRecord(\n model: CmsModel,\n params: StorageOperationsDeleteSearchRecordParams\n ): Promise<boolean>;\n}\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["record.types.ts"],"sourcesContent":["import { AcoBaseFields, ListMeta } from \"~/types\";\nimport { Topic } from \"@webiny/pubsub/types\";\nimport { CmsModel } from \"@webiny/api-headless-cms/types\";\n\nexport type GenericSearchData = {\n [key: string]: any;\n};\n\nexport interface Location {\n folderId: string;\n}\n\nexport interface SearchRecord<TData extends GenericSearchData = GenericSearchData>\n extends AcoBaseFields {\n type: string;\n title: string;\n content?: string;\n location: Location;\n data: TData;\n tags: string[];\n}\n\nexport interface SearchRecordTag {\n tag: string;\n count: number;\n}\n\nexport interface ListSearchRecordsWhere<TData extends GenericSearchData = GenericSearchData> {\n type: string;\n location?: {\n folderId: string;\n };\n tags_in?: string[];\n tags_startsWith?: string;\n tags_not_startsWith?: string;\n data?: TData;\n}\n\nexport interface ListSearchRecordsParams {\n where?: ListSearchRecordsWhere;\n search?: string;\n sort?: string[];\n limit?: number;\n after?: string | null;\n}\n\nexport type CreateSearchRecordParams<TData extends GenericSearchData = GenericSearchData> = Pick<\n SearchRecord<TData>,\n \"id\" | \"title\" | \"content\" | \"type\" | \"location\" | \"data\" | \"tags\"\n>;\n\nexport interface UpdateSearchRecordParams<TData extends GenericSearchData> {\n title?: string;\n content?: string;\n location?: Location;\n data?: TData;\n tags?: string[];\n}\n\nexport interface DeleteSearchRecordParams {\n id: string;\n}\n\nexport interface ListSearchRecordTagsWhere {\n type: string;\n}\n\nexport interface ListSearchRecordTagsParams {\n where?: ListSearchRecordTagsWhere;\n}\n\nexport interface StorageOperationsGetSearchRecordParams {\n id: string;\n}\n\nexport type StorageOperationsListSearchRecordsParams = ListSearchRecordsParams;\nexport type StorageOperationsListSearchRecordTagsParams = ListSearchRecordTagsParams;\n\nexport interface StorageOperationsCreateSearchRecordParams<\n TData extends GenericSearchData = GenericSearchData\n> {\n data: CreateSearchRecordParams<TData>;\n}\n\nexport interface StorageOperationsUpdateSearchRecordParams<\n TData extends GenericSearchData = GenericSearchData\n> {\n id: string;\n data: UpdateSearchRecordParams<TData>;\n}\n\nexport interface StorageOperationsMoveSearchRecordParams {\n id: string;\n folderId?: string | null;\n}\n\nexport type StorageOperationsDeleteSearchRecordParams = DeleteSearchRecordParams;\n\nexport interface OnSearchRecordBeforeCreateTopicParams<\n TData extends GenericSearchData = GenericSearchData\n> {\n model: CmsModel;\n input: CreateSearchRecordParams<TData>;\n}\n\nexport interface OnSearchRecordAfterCreateTopicParams<\n TData extends GenericSearchData = GenericSearchData\n> {\n model: CmsModel;\n record: SearchRecord<TData>;\n}\n\nexport interface OnSearchRecordBeforeUpdateTopicParams<\n TData extends GenericSearchData = GenericSearchData\n> {\n model: CmsModel;\n original: SearchRecord<TData>;\n input: Record<string, any>;\n}\n\nexport interface OnSearchRecordBeforeMoveTopicParams<\n TData extends GenericSearchData = GenericSearchData\n> {\n model: CmsModel;\n original: SearchRecord<TData>;\n folderId?: string | null;\n}\n\nexport interface OnSearchRecordAfterMoveTopicParams<\n TData extends GenericSearchData = GenericSearchData\n> {\n model: CmsModel;\n original: SearchRecord<TData>;\n folderId?: string | null;\n}\n\nexport interface OnSearchRecordAfterUpdateTopicParams<\n TData extends GenericSearchData = GenericSearchData\n> {\n model: CmsModel;\n original: SearchRecord<TData>;\n record: SearchRecord<TData>;\n input: Record<string, any>;\n}\n\nexport interface OnSearchRecordBeforeDeleteTopicParams<\n TData extends GenericSearchData = GenericSearchData\n> {\n model: CmsModel;\n record: SearchRecord<TData>;\n}\n\nexport interface OnSearchRecordAfterDeleteTopicParams<\n TData extends GenericSearchData = GenericSearchData\n> {\n model: CmsModel;\n record: SearchRecord<TData>;\n}\n\nexport interface AcoSearchRecordCrudBase {\n get<TData extends GenericSearchData = GenericSearchData>(\n id: string\n ): Promise<SearchRecord<TData>>;\n list<TData extends GenericSearchData = GenericSearchData>(\n params: ListSearchRecordsParams\n ): Promise<[SearchRecord<TData>[], ListMeta]>;\n listTags(params: ListSearchRecordTagsParams): Promise<[SearchRecordTag[], ListMeta]>;\n create<TData extends GenericSearchData = GenericSearchData>(\n data: CreateSearchRecordParams<TData>\n ): Promise<SearchRecord<TData>>;\n update<TData extends GenericSearchData = GenericSearchData>(\n id: string,\n data: UpdateSearchRecordParams<TData>\n ): Promise<SearchRecord<TData>>;\n move(id: string, folderId?: string | null): Promise<boolean>;\n delete(id: string): Promise<boolean>;\n}\n\nexport interface AcoSearchRecordCrud\n extends Omit<\n AcoSearchRecordCrudBase,\n \"get\" | \"list\" | \"create\" | \"update\" | \"delete\" | \"listTags\" | \"move\"\n > {\n get<TData extends GenericSearchData = GenericSearchData>(\n model: CmsModel,\n id: string\n ): Promise<SearchRecord<TData>>;\n list<TData extends GenericSearchData = GenericSearchData>(\n model: CmsModel,\n params: ListSearchRecordsParams\n ): Promise<[SearchRecord<TData>[], ListMeta]>;\n listTags(\n model: CmsModel,\n params: ListSearchRecordTagsParams\n ): Promise<[SearchRecordTag[], ListMeta]>;\n create<TData extends GenericSearchData = GenericSearchData>(\n model: CmsModel,\n data: CreateSearchRecordParams<TData>\n ): Promise<SearchRecord<TData>>;\n update<TData extends GenericSearchData = GenericSearchData>(\n model: CmsModel,\n id: string,\n data: UpdateSearchRecordParams<TData>\n ): Promise<SearchRecord<TData>>;\n move(model: CmsModel, id: string, folderId?: string | null): Promise<boolean>;\n delete(model: CmsModel, id: string): Promise<boolean>;\n onSearchRecordBeforeCreate: Topic<OnSearchRecordBeforeCreateTopicParams>;\n onSearchRecordAfterCreate: Topic<OnSearchRecordAfterCreateTopicParams>;\n onSearchRecordBeforeUpdate: Topic<OnSearchRecordBeforeUpdateTopicParams>;\n onSearchRecordAfterUpdate: Topic<OnSearchRecordAfterUpdateTopicParams>;\n onSearchRecordBeforeMove: Topic<OnSearchRecordBeforeMoveTopicParams>;\n onSearchRecordAfterMove: Topic<OnSearchRecordAfterMoveTopicParams>;\n onSearchRecordBeforeDelete: Topic<OnSearchRecordBeforeDeleteTopicParams>;\n onSearchRecordAfterDelete: Topic<OnSearchRecordAfterDeleteTopicParams>;\n}\n\nexport interface AcoSearchRecordStorageOperations {\n getRecord<TData extends GenericSearchData = GenericSearchData>(\n model: CmsModel,\n params: StorageOperationsGetSearchRecordParams\n ): Promise<SearchRecord<TData>>;\n listRecords<TData extends GenericSearchData = GenericSearchData>(\n model: CmsModel,\n params: StorageOperationsListSearchRecordsParams\n ): Promise<[SearchRecord<TData>[], ListMeta]>;\n listTags(\n model: CmsModel,\n params: StorageOperationsListSearchRecordTagsParams\n ): Promise<[SearchRecordTag[], ListMeta]>;\n createRecord<TData extends GenericSearchData = GenericSearchData>(\n model: CmsModel,\n params: StorageOperationsCreateSearchRecordParams<TData>\n ): Promise<SearchRecord<TData>>;\n updateRecord<TData extends GenericSearchData = GenericSearchData>(\n model: CmsModel,\n params: StorageOperationsUpdateSearchRecordParams<TData>\n ): Promise<SearchRecord<TData>>;\n moveRecord(model: CmsModel, params: StorageOperationsMoveSearchRecordParams): Promise<boolean>;\n deleteRecord(\n model: CmsModel,\n params: StorageOperationsDeleteSearchRecordParams\n ): Promise<boolean>;\n}\n"],"mappings":"","ignoreList":[]}
package/types.d.ts CHANGED
@@ -5,7 +5,7 @@ import { SecurityContext } from "@webiny/api-security/types";
5
5
  import { AdminUsersContext } from "@webiny/api-admin-users/types";
6
6
  import { FileManagerContext } from "@webiny/api-file-manager/types";
7
7
  import { CmsContext, CmsModel, CmsModelField } from "@webiny/api-headless-cms/types";
8
- import { AcoSearchRecordCrud, AcoSearchRecordCrudBase, AcoSearchRecordStorageOperations, SearchRecord } from "./record/record.types";
8
+ import { AcoSearchRecordCrud, AcoSearchRecordCrudBase, AcoSearchRecordStorageOperations, GenericSearchData, SearchRecord } from "./record/record.types";
9
9
  import { AcoFolderCrud, AcoFolderStorageOperations } from "./folder/folder.types";
10
10
  import { AcoFilterCrud, AcoFilterStorageOperations } from "./filter/filter.types";
11
11
  import { FolderLevelPermissions } from "./utils/FolderLevelPermissions";
@@ -26,7 +26,7 @@ export declare enum ListSortDirection {
26
26
  ASC = 0,
27
27
  DESC = 1
28
28
  }
29
- export declare type ListSort = Record<string, ListSortDirection>;
29
+ export type ListSort = Record<string, ListSortDirection>;
30
30
  export interface AcoBaseFields {
31
31
  id: string;
32
32
  entryId: string;
@@ -53,14 +53,14 @@ export interface CreateAcoParams {
53
53
  storageOperations: AcoStorageOperations;
54
54
  folderLevelPermissions: FolderLevelPermissions;
55
55
  }
56
- export declare type AcoStorageOperations = AcoFolderStorageOperations & AcoSearchRecordStorageOperations & AcoFilterStorageOperations;
56
+ export type AcoStorageOperations = AcoFolderStorageOperations & AcoSearchRecordStorageOperations & AcoFilterStorageOperations;
57
57
  export interface AcoContext extends BaseContext, I18NContext, TenancyContext, SecurityContext, AdminUsersContext, CmsContext, FileManagerContext {
58
58
  aco: AdvancedContentOrganisation;
59
59
  }
60
60
  /**
61
61
  * @deprecated Use AcoContext instead
62
62
  */
63
- export declare type ACOContext = AcoContext;
63
+ export type ACOContext = AcoContext;
64
64
  /**
65
65
  * Apps
66
66
  */
@@ -87,10 +87,10 @@ export interface IAcoApp {
87
87
  removeField: IAcoAppRemoveFieldCallable;
88
88
  modifyField: IAcoAppModifyFieldCallable;
89
89
  }
90
- export declare type IAcoAppOnEntry<T = any> = (entry: SearchRecord<T>) => Promise<SearchRecord<T>>;
91
- export declare type IAcoAppOnEntryList<T = any> = (entry: SearchRecord<T>[]) => Promise<SearchRecord<T>[]>;
92
- export declare type AcoRequestAction = "create" | "update" | "delete" | "move" | "fetch";
93
- export declare type IAcoAppOnAnyRequest = (context: AcoContext, action: AcoRequestAction) => Promise<void>;
90
+ export type IAcoAppOnEntry<T extends GenericSearchData = GenericSearchData> = (entry: SearchRecord<T>) => Promise<SearchRecord<T>>;
91
+ export type IAcoAppOnEntryList<T extends GenericSearchData = GenericSearchData> = (entry: SearchRecord<T>[]) => Promise<SearchRecord<T>[]>;
92
+ export type AcoRequestAction = "create" | "update" | "delete" | "move" | "fetch";
93
+ export type IAcoAppOnAnyRequest = (context: AcoContext, action: AcoRequestAction) => Promise<void>;
94
94
  export interface IAcoAppParams {
95
95
  name: string;
96
96
  apiName: string;
@@ -100,9 +100,9 @@ export interface IAcoAppParams {
100
100
  onEntryList?: IAcoAppOnEntryList;
101
101
  onAnyRequest?: IAcoAppOnAnyRequest;
102
102
  }
103
- export declare type IAcoAppsOptions = CreateAcoParams;
103
+ export type IAcoAppsOptions = CreateAcoParams;
104
104
  export interface IAcoApps {
105
105
  list: () => IAcoApp[];
106
106
  register: (app: IAcoAppParams) => Promise<IAcoApp>;
107
107
  }
108
- export declare type IAcoAppRegisterParams = Omit<IAcoAppParams, "model">;
108
+ export type IAcoAppRegisterParams = Omit<IAcoAppParams, "model">;
package/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["_filter","require","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_folder","_record","ListSortDirection"],"sources":["types.ts"],"sourcesContent":["import { TenancyContext, Tenant } from \"@webiny/api-tenancy/types\";\nimport { Context as BaseContext } from \"@webiny/handler/types\";\nimport { I18NContext, I18NLocale } from \"@webiny/api-i18n/types\";\nimport { SecurityContext } from \"@webiny/api-security/types\";\nimport { AdminUsersContext } from \"@webiny/api-admin-users/types\";\nimport { FileManagerContext } from \"@webiny/api-file-manager/types\";\nimport { CmsContext, CmsModel, CmsModelField } from \"@webiny/api-headless-cms/types\";\nimport {\n AcoSearchRecordCrud,\n AcoSearchRecordCrudBase,\n AcoSearchRecordStorageOperations,\n SearchRecord\n} from \"~/record/record.types\";\nimport { AcoFolderCrud, AcoFolderStorageOperations } from \"~/folder/folder.types\";\nimport { AcoFilterCrud, AcoFilterStorageOperations } from \"~/filter/filter.types\";\nimport { FolderLevelPermissions } from \"~/utils/FolderLevelPermissions\";\n\nexport * from \"./filter/filter.types\";\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 modifiedOn: string | null;\n savedOn: string;\n createdBy: User;\n modifiedBy: User | null;\n savedBy: User;\n}\n\nexport interface AdvancedContentOrganisation {\n folder: AcoFolderCrud;\n search: AcoSearchRecordCrud;\n filter: AcoFilterCrud;\n folderLevelPermissions: FolderLevelPermissions;\n apps: IAcoApps;\n registerApp: (params: IAcoAppRegisterParams) => Promise<IAcoApp>;\n getApp: (name: string) => IAcoApp;\n listApps: () => IAcoApp[];\n}\n\nexport interface CreateAcoParams {\n getLocale: () => I18NLocale;\n getTenant: () => Tenant;\n storageOperations: AcoStorageOperations;\n folderLevelPermissions: FolderLevelPermissions;\n}\n\nexport type AcoStorageOperations = AcoFolderStorageOperations &\n AcoSearchRecordStorageOperations &\n AcoFilterStorageOperations;\n\nexport interface AcoContext\n extends BaseContext,\n I18NContext,\n TenancyContext,\n SecurityContext,\n AdminUsersContext,\n CmsContext,\n FileManagerContext {\n aco: AdvancedContentOrganisation;\n}\n\n/**\n * @deprecated Use AcoContext instead\n */\nexport type ACOContext = AcoContext;\n\n/**\n * Apps\n */\nexport interface IAcoAppAddFieldCallable {\n (field: CmsModelField): void;\n}\n\nexport interface IAcoAppRemoveFieldCallable {\n (id: string): void;\n}\n\nexport interface IAcoAppModifyFieldCallableCallback {\n (field: CmsModelField): CmsModelField;\n}\n\nexport interface IAcoAppModifyFieldCallable {\n (id: string, cb: IAcoAppModifyFieldCallableCallback): void;\n}\n\nexport interface IAcoApp {\n context: AcoContext;\n search: AcoSearchRecordCrudBase;\n folder: AcoFolderCrud;\n name: string;\n model: CmsModel;\n getFields: () => CmsModelField[];\n addField: IAcoAppAddFieldCallable;\n removeField: IAcoAppRemoveFieldCallable;\n modifyField: IAcoAppModifyFieldCallable;\n}\n// TODO: determine correct type\nexport type IAcoAppOnEntry<T = any> = (entry: SearchRecord<T>) => Promise<SearchRecord<T>>;\nexport type IAcoAppOnEntryList<T = any> = (entry: SearchRecord<T>[]) => Promise<SearchRecord<T>[]>;\nexport type AcoRequestAction = \"create\" | \"update\" | \"delete\" | \"move\" | \"fetch\";\nexport type IAcoAppOnAnyRequest = (context: AcoContext, action: AcoRequestAction) => Promise<void>;\n\nexport interface IAcoAppParams {\n name: string;\n apiName: string;\n model: CmsModel;\n fields: CmsModelField[];\n onEntry?: IAcoAppOnEntry;\n onEntryList?: IAcoAppOnEntryList;\n onAnyRequest?: IAcoAppOnAnyRequest;\n}\n\nexport type IAcoAppsOptions = CreateAcoParams;\n\nexport interface IAcoApps {\n list: () => IAcoApp[];\n register: (app: IAcoAppParams) => Promise<IAcoApp>;\n}\n\nexport type IAcoAppRegisterParams = Omit<IAcoAppParams, \"model\">;\n"],"mappings":";;;;;;;;;AAiBA,IAAAA,OAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,OAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAL,OAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;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Property","enumerable","get","_folder","_record","ListSortDirection"],"sources":["types.ts"],"sourcesContent":["import { TenancyContext, Tenant } from \"@webiny/api-tenancy/types\";\nimport { Context as BaseContext } from \"@webiny/handler/types\";\nimport { I18NContext, I18NLocale } from \"@webiny/api-i18n/types\";\nimport { SecurityContext } from \"@webiny/api-security/types\";\nimport { AdminUsersContext } from \"@webiny/api-admin-users/types\";\nimport { FileManagerContext } from \"@webiny/api-file-manager/types\";\nimport { CmsContext, CmsModel, CmsModelField } from \"@webiny/api-headless-cms/types\";\nimport {\n AcoSearchRecordCrud,\n AcoSearchRecordCrudBase,\n AcoSearchRecordStorageOperations,\n GenericSearchData,\n SearchRecord\n} from \"~/record/record.types\";\nimport { AcoFolderCrud, AcoFolderStorageOperations } from \"~/folder/folder.types\";\nimport { AcoFilterCrud, AcoFilterStorageOperations } from \"~/filter/filter.types\";\nimport { FolderLevelPermissions } from \"~/utils/FolderLevelPermissions\";\n\nexport * from \"./filter/filter.types\";\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 modifiedOn: string | null;\n savedOn: string;\n createdBy: User;\n modifiedBy: User | null;\n savedBy: User;\n}\n\nexport interface AdvancedContentOrganisation {\n folder: AcoFolderCrud;\n search: AcoSearchRecordCrud;\n filter: AcoFilterCrud;\n folderLevelPermissions: FolderLevelPermissions;\n apps: IAcoApps;\n registerApp: (params: IAcoAppRegisterParams) => Promise<IAcoApp>;\n getApp: (name: string) => IAcoApp;\n listApps: () => IAcoApp[];\n}\n\nexport interface CreateAcoParams {\n getLocale: () => I18NLocale;\n getTenant: () => Tenant;\n storageOperations: AcoStorageOperations;\n folderLevelPermissions: FolderLevelPermissions;\n}\n\nexport type AcoStorageOperations = AcoFolderStorageOperations &\n AcoSearchRecordStorageOperations &\n AcoFilterStorageOperations;\n\nexport interface AcoContext\n extends BaseContext,\n I18NContext,\n TenancyContext,\n SecurityContext,\n AdminUsersContext,\n CmsContext,\n FileManagerContext {\n aco: AdvancedContentOrganisation;\n}\n\n/**\n * @deprecated Use AcoContext instead\n */\nexport type ACOContext = AcoContext;\n\n/**\n * Apps\n */\nexport interface IAcoAppAddFieldCallable {\n (field: CmsModelField): void;\n}\n\nexport interface IAcoAppRemoveFieldCallable {\n (id: string): void;\n}\n\nexport interface IAcoAppModifyFieldCallableCallback {\n (field: CmsModelField): CmsModelField;\n}\n\nexport interface IAcoAppModifyFieldCallable {\n (id: string, cb: IAcoAppModifyFieldCallableCallback): void;\n}\n\nexport interface IAcoApp {\n context: AcoContext;\n search: AcoSearchRecordCrudBase;\n folder: AcoFolderCrud;\n name: string;\n model: CmsModel;\n getFields: () => CmsModelField[];\n addField: IAcoAppAddFieldCallable;\n removeField: IAcoAppRemoveFieldCallable;\n modifyField: IAcoAppModifyFieldCallable;\n}\n// TODO: determine correct type\nexport type IAcoAppOnEntry<T extends GenericSearchData = GenericSearchData> = (\n entry: SearchRecord<T>\n) => Promise<SearchRecord<T>>;\nexport type IAcoAppOnEntryList<T extends GenericSearchData = GenericSearchData> = (\n entry: SearchRecord<T>[]\n) => Promise<SearchRecord<T>[]>;\nexport type AcoRequestAction = \"create\" | \"update\" | \"delete\" | \"move\" | \"fetch\";\nexport type IAcoAppOnAnyRequest = (context: AcoContext, action: AcoRequestAction) => Promise<void>;\n\nexport interface IAcoAppParams {\n name: string;\n apiName: string;\n model: CmsModel;\n fields: CmsModelField[];\n onEntry?: IAcoAppOnEntry;\n onEntryList?: IAcoAppOnEntryList;\n onAnyRequest?: IAcoAppOnAnyRequest;\n}\n\nexport type IAcoAppsOptions = CreateAcoParams;\n\nexport interface IAcoApps {\n list: () => IAcoApp[];\n register: (app: IAc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K,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAU,OAAA,CAAAV,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAE,OAAA,CAAAV,GAAA;IAAA;EAAA;AAAA;AAAsC,IAc1BW,iBAAiB,GAAAN,OAAA,CAAAM,iBAAA,0BAAjBA,iBAAiB;EAAjBA,iBAAiB,CAAjBA,iBAAiB;EAAjBA,iBAAiB,CAAjBA,iBAAiB;EAAA,OAAjBA,iBAAiB;AAAA;AAmD7B;AACA;AACA;AAGA;AACA;AACA;AA4BA","ignoreList":[]}
@@ -1,7 +1,7 @@
1
1
  import { Authentication } from "@webiny/api-authentication/types";
2
2
  import { SecurityPermission, Team } from "@webiny/api-security/types";
3
3
  import { Folder } from "../folder/folder.types";
4
- export declare type FolderAccessLevel = "owner" | "viewer" | "editor" | "public";
4
+ export type FolderAccessLevel = "owner" | "viewer" | "editor" | "public";
5
5
  export interface FolderPermission {
6
6
  target: string;
7
7
  level: FolderAccessLevel;
@@ -11,7 +11,7 @@ export interface FolderPermissionsListItem {
11
11
  folderId: string;
12
12
  permissions: FolderPermission[];
13
13
  }
14
- export declare type FolderPermissionsList = FolderPermissionsListItem[];
14
+ export type FolderPermissionsList = FolderPermissionsListItem[];
15
15
  export interface CanAccessFolderContentParams {
16
16
  folder: Pick<Folder, "id" | "type" | "parentId">;
17
17
  rwd?: "r" | "w" | "d";
@@ -1,5 +1,5 @@
1
1
  import { AcoContext } from "../../types";
2
- declare type Context = Pick<AcoContext, "aco" | "cms">;
2
+ type Context = Pick<AcoContext, "aco" | "cms">;
3
3
  interface EntryManagerCrudDecoratorsParams {
4
4
  context: Context;
5
5
  }
@@ -2,11 +2,11 @@ import { CmsModel, HeadlessCms } from "@webiny/api-headless-cms/types";
2
2
  /**
3
3
  * This type matches any function that has a CmsModel as the first parameter.
4
4
  */
5
- declare type ModelCallable = (model: CmsModel, ...params: any[]) => any;
5
+ type ModelCallable = (model: CmsModel, ...params: any[]) => any;
6
6
  /**
7
7
  * This type filters only `ModelCallable` methods.
8
8
  */
9
- declare type FilterModelMethods<T> = {
9
+ type FilterModelMethods<T> = {
10
10
  [K in keyof T as ModelCallable extends T[K] ? K : never]: T[K];
11
11
  };
12
12
  /**
@@ -14,10 +14,10 @@ declare type FilterModelMethods<T> = {
14
14
  * E.g., `getEntryManager` has `model` typed as `CmsModel | string`.
15
15
  * Ideally, we would filter those out in the previous utility type, but I'm not sure how to achieve that.
16
16
  */
17
- declare type ModelMethods<T> = Omit<FilterModelMethods<T>, "getEntryManager">;
17
+ type ModelMethods<T> = Omit<FilterModelMethods<T>, "getEntryManager">;
18
18
  /**
19
19
  * Decorator takes the decoratee as the _first_ parameter, and then forwards the rest of the parameters.
20
20
  */
21
- declare type Decorator<T extends ModelCallable> = (decoratee: T, ...args: Parameters<T>) => ReturnType<T>;
21
+ type Decorator<T extends ModelCallable> = (decoratee: T, ...args: Parameters<T>) => ReturnType<T>;
22
22
  export declare const decorateIfModelAuthorizationEnabled: <M extends "getEntry" | "getEntriesByIds" | "getEntryById" | "listEntries" | "listLatestEntries" | "listPublishedEntries" | "listDeletedEntries" | "getPublishedEntriesByIds" | "getLatestEntriesByIds" | "createEntry" | "createEntryRevisionFrom" | "updateEntry" | "validateEntry" | "moveEntry" | "republishEntry" | "deleteEntryRevision" | "deleteEntry" | "restoreEntryFromBin" | "deleteMultipleEntries" | "publishEntry" | "unpublishEntry" | "getEntryRevisions" | "getUniqueFieldValues", D extends Decorator<ModelMethods<HeadlessCms>[M]>>(root: ModelMethods<HeadlessCms>, method: M, decorator: D) => void;
23
23
  export {};
@@ -1,6 +1,6 @@
1
1
  import { AcoContext } from "../../types";
2
2
  import { CmsEntry, CmsModel } from "@webiny/api-headless-cms/types";
3
3
  import { FolderLevelPermissions } from "../FolderLevelPermissions";
4
- declare type Context = Pick<AcoContext, "aco" | "cms">;
4
+ type Context = Pick<AcoContext, "aco" | "cms">;
5
5
  export declare const filterEntriesByFolderFactory: (context: Context, permissions: FolderLevelPermissions) => (model: CmsModel, entries: CmsEntry[]) => Promise<CmsEntry<import("@webiny/api-headless-cms/types").CmsEntryValues>[]>;
6
6
  export {};
@@ -1,3 +1,3 @@
1
1
  import { ErrorResponse, ListResponse, Response } from "@webiny/handler-graphql";
2
- export declare const resolve: (fn: () => Promise<any>) => Promise<Response<any> | ErrorResponse>;
2
+ export declare const resolve: (fn: () => Promise<any>) => Promise<ErrorResponse | Response<any>>;
3
3
  export declare const resolveList: (fn: () => Promise<any>) => Promise<ErrorResponse | ListResponse<unknown, any>>;