@webiny/api-headless-cms-sql 0.0.0-unstable.0d717d18dd → 0.0.0-unstable.a4f3e4ea8b
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/features/entryTableManager/EntryTableManager.d.ts +0 -2
- package/features/entryTableManager/EntryTableManager.js +26 -39
- package/features/entryTableManager/EntryTableManager.js.map +1 -1
- package/index.d.ts +1 -4
- package/index.js +71 -24
- package/index.js.map +1 -1
- package/operations/entry/index.d.ts +13 -0
- package/operations/entry/index.js +373 -0
- package/operations/entry/index.js.map +1 -0
- package/operations/group/index.d.ts +5 -0
- package/operations/group/index.js +58 -0
- package/operations/group/index.js.map +1 -0
- package/operations/model/index.d.ts +5 -0
- package/operations/model/index.js +50 -0
- package/operations/model/index.js.map +1 -0
- package/package.json +12 -15
- package/types.d.ts +10 -0
- package/types.js +0 -0
- package/operations/entry/SqlCreateEntry.d.ts +0 -15
- package/operations/entry/SqlCreateEntry.js +0 -35
- package/operations/entry/SqlCreateEntry.js.map +0 -1
- package/operations/entry/SqlCreateEntryRevisionFrom.d.ts +0 -15
- package/operations/entry/SqlCreateEntryRevisionFrom.js +0 -55
- package/operations/entry/SqlCreateEntryRevisionFrom.js.map +0 -1
- package/operations/entry/SqlDeleteEntry.d.ts +0 -15
- package/operations/entry/SqlDeleteEntry.js +0 -29
- package/operations/entry/SqlDeleteEntry.js.map +0 -1
- package/operations/entry/SqlDeleteEntryRevision.d.ts +0 -15
- package/operations/entry/SqlDeleteEntryRevision.js +0 -39
- package/operations/entry/SqlDeleteEntryRevision.js.map +0 -1
- package/operations/entry/SqlDeleteMultipleEntries.d.ts +0 -15
- package/operations/entry/SqlDeleteMultipleEntries.js +0 -29
- package/operations/entry/SqlDeleteMultipleEntries.js.map +0 -1
- package/operations/entry/SqlGetEntriesByIds.d.ts +0 -15
- package/operations/entry/SqlGetEntriesByIds.js +0 -35
- package/operations/entry/SqlGetEntriesByIds.js.map +0 -1
- package/operations/entry/SqlGetEntry.d.ts +0 -25
- package/operations/entry/SqlGetEntry.js +0 -56
- package/operations/entry/SqlGetEntry.js.map +0 -1
- package/operations/entry/SqlGetLatestEntriesByIds.d.ts +0 -15
- package/operations/entry/SqlGetLatestEntriesByIds.js +0 -37
- package/operations/entry/SqlGetLatestEntriesByIds.js.map +0 -1
- package/operations/entry/SqlGetLatestRevisionByEntryId.d.ts +0 -15
- package/operations/entry/SqlGetLatestRevisionByEntryId.js +0 -32
- package/operations/entry/SqlGetLatestRevisionByEntryId.js.map +0 -1
- package/operations/entry/SqlGetPreviousRevision.d.ts +0 -15
- package/operations/entry/SqlGetPreviousRevision.js +0 -30
- package/operations/entry/SqlGetPreviousRevision.js.map +0 -1
- package/operations/entry/SqlGetPublishedEntriesByIds.d.ts +0 -15
- package/operations/entry/SqlGetPublishedEntriesByIds.js +0 -37
- package/operations/entry/SqlGetPublishedEntriesByIds.js.map +0 -1
- package/operations/entry/SqlGetPublishedRevisionByEntryId.d.ts +0 -15
- package/operations/entry/SqlGetPublishedRevisionByEntryId.js +0 -32
- package/operations/entry/SqlGetPublishedRevisionByEntryId.js.map +0 -1
- package/operations/entry/SqlGetRevisionById.d.ts +0 -15
- package/operations/entry/SqlGetRevisionById.js +0 -30
- package/operations/entry/SqlGetRevisionById.js.map +0 -1
- package/operations/entry/SqlGetRevisions.d.ts +0 -15
- package/operations/entry/SqlGetRevisions.js +0 -31
- package/operations/entry/SqlGetRevisions.js.map +0 -1
- package/operations/entry/SqlGetUniqueFieldValues.d.ts +0 -25
- package/operations/entry/SqlGetUniqueFieldValues.js +0 -58
- package/operations/entry/SqlGetUniqueFieldValues.js.map +0 -1
- package/operations/entry/SqlListEntries.d.ts +0 -25
- package/operations/entry/SqlListEntries.js +0 -52
- package/operations/entry/SqlListEntries.js.map +0 -1
- package/operations/entry/SqlMoveEntry.d.ts +0 -14
- package/operations/entry/SqlMoveEntry.js +0 -30
- package/operations/entry/SqlMoveEntry.js.map +0 -1
- package/operations/entry/SqlMoveToBin.d.ts +0 -14
- package/operations/entry/SqlMoveToBin.js +0 -35
- package/operations/entry/SqlMoveToBin.js.map +0 -1
- package/operations/entry/SqlPublishEntry.d.ts +0 -15
- package/operations/entry/SqlPublishEntry.js +0 -51
- package/operations/entry/SqlPublishEntry.js.map +0 -1
- package/operations/entry/SqlRestoreFromBin.d.ts +0 -14
- package/operations/entry/SqlRestoreFromBin.js +0 -36
- package/operations/entry/SqlRestoreFromBin.js.map +0 -1
- package/operations/entry/SqlUnpublishEntry.d.ts +0 -15
- package/operations/entry/SqlUnpublishEntry.js +0 -38
- package/operations/entry/SqlUnpublishEntry.js.map +0 -1
- package/operations/entry/SqlUpdateEntry.d.ts +0 -15
- package/operations/entry/SqlUpdateEntry.js +0 -36
- package/operations/entry/SqlUpdateEntry.js.map +0 -1
- package/operations/entry/feature.d.ts +0 -4
- package/operations/entry/feature.js +0 -53
- package/operations/entry/feature.js.map +0 -1
- package/operations/entry/queryHelpers.d.ts +0 -23
- package/operations/entry/queryHelpers.js +0 -105
- package/operations/entry/queryHelpers.js.map +0 -1
- package/operations/group/SqlCreateGroup.d.ts +0 -16
- package/operations/group/SqlCreateGroup.js +0 -28
- package/operations/group/SqlCreateGroup.js.map +0 -1
- package/operations/group/SqlDeleteGroup.d.ts +0 -16
- package/operations/group/SqlDeleteGroup.js +0 -26
- package/operations/group/SqlDeleteGroup.js.map +0 -1
- package/operations/group/SqlGetGroup.d.ts +0 -16
- package/operations/group/SqlGetGroup.js +0 -29
- package/operations/group/SqlGetGroup.js.map +0 -1
- package/operations/group/SqlListGroups.d.ts +0 -16
- package/operations/group/SqlListGroups.js +0 -43
- package/operations/group/SqlListGroups.js.map +0 -1
- package/operations/group/SqlUpdateGroup.d.ts +0 -16
- package/operations/group/SqlUpdateGroup.js +0 -28
- package/operations/group/SqlUpdateGroup.js.map +0 -1
- package/operations/group/feature.d.ts +0 -4
- package/operations/group/feature.js +0 -19
- package/operations/group/feature.js.map +0 -1
- package/operations/model/SqlCreateModel.d.ts +0 -16
- package/operations/model/SqlCreateModel.js +0 -30
- package/operations/model/SqlCreateModel.js.map +0 -1
- package/operations/model/SqlDeleteModel.d.ts +0 -16
- package/operations/model/SqlDeleteModel.js +0 -26
- package/operations/model/SqlDeleteModel.js.map +0 -1
- package/operations/model/SqlGetModel.d.ts +0 -16
- package/operations/model/SqlGetModel.js +0 -29
- package/operations/model/SqlGetModel.js.map +0 -1
- package/operations/model/SqlListModels.d.ts +0 -16
- package/operations/model/SqlListModels.js +0 -31
- package/operations/model/SqlListModels.js.map +0 -1
- package/operations/model/SqlUpdateModel.d.ts +0 -16
- package/operations/model/SqlUpdateModel.js +0 -30
- package/operations/model/SqlUpdateModel.js.map +0 -1
- package/operations/model/feature.d.ts +0 -4
- package/operations/model/feature.js +0 -19
- package/operations/model/feature.js.map +0 -1
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { CmsEntryStorageOperationsGetLatestRevisionParams, CmsEntryValues, CmsModel } from "@webiny/api-headless-cms/types/index.js";
|
|
2
|
-
import { GetLatestRevisionByEntryIdStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/GetLatestRevisionByEntryIdStorageOperation.js";
|
|
3
|
-
import { KnexClient } from "@webiny/api-core-sql";
|
|
4
|
-
import { EntryTableManager } from "../../features/entryTableManager/abstractions.js";
|
|
5
|
-
declare class SqlGetLatestRevisionByEntryIdImpl implements GetLatestRevisionByEntryIdStorageOperation.Interface {
|
|
6
|
-
private readonly entryTableManager;
|
|
7
|
-
private readonly knex;
|
|
8
|
-
constructor(knexClient: KnexClient.Interface, entryTableManager: EntryTableManager.Interface);
|
|
9
|
-
private query;
|
|
10
|
-
execute<T extends CmsEntryValues>(model: CmsModel, params: CmsEntryStorageOperationsGetLatestRevisionParams): Promise<import("@webiny/api-headless-cms/types/types.js").CmsEntry<T> | null>;
|
|
11
|
-
}
|
|
12
|
-
export declare const SqlGetLatestRevisionByEntryId: typeof SqlGetLatestRevisionByEntryIdImpl & {
|
|
13
|
-
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-headless-cms/features/shared/storageOperations/entry/GetLatestRevisionByEntryIdStorageOperation.js").IGetLatestRevisionByEntryIdStorageOperation>;
|
|
14
|
-
};
|
|
15
|
-
export {};
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { GetLatestRevisionByEntryIdStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/GetLatestRevisionByEntryIdStorageOperation.js";
|
|
2
|
-
import { KnexClient } from "@webiny/api-core-sql";
|
|
3
|
-
import { EntryTableManager } from "../../features/entryTableManager/abstractions.js";
|
|
4
|
-
import { parseIdentifier } from "@webiny/utils";
|
|
5
|
-
import { rowToEntry } from "./mappers.js";
|
|
6
|
-
import { createEntryQuery } from "./queryHelpers.js";
|
|
7
|
-
class SqlGetLatestRevisionByEntryIdImpl {
|
|
8
|
-
constructor(knexClient, entryTableManager){
|
|
9
|
-
this.entryTableManager = entryTableManager;
|
|
10
|
-
this.knex = knexClient.client;
|
|
11
|
-
}
|
|
12
|
-
query() {
|
|
13
|
-
return createEntryQuery(this.knex, this.entryTableManager.getTableName());
|
|
14
|
-
}
|
|
15
|
-
async execute(model, params) {
|
|
16
|
-
await this.entryTableManager.ensureTable();
|
|
17
|
-
const { id: entryId } = parseIdentifier(params.id);
|
|
18
|
-
const row = await this.query().where("tenant", model.tenant).andWhere("modelId", model.modelId).where("entryId", entryId).andWhere("isLatest", true).first();
|
|
19
|
-
if (!row) return null;
|
|
20
|
-
return rowToEntry(row);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
const SqlGetLatestRevisionByEntryId = GetLatestRevisionByEntryIdStorageOperation.createImplementation({
|
|
24
|
-
implementation: SqlGetLatestRevisionByEntryIdImpl,
|
|
25
|
-
dependencies: [
|
|
26
|
-
KnexClient,
|
|
27
|
-
EntryTableManager
|
|
28
|
-
]
|
|
29
|
-
});
|
|
30
|
-
export { SqlGetLatestRevisionByEntryId };
|
|
31
|
-
|
|
32
|
-
//# sourceMappingURL=SqlGetLatestRevisionByEntryId.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"operations/entry/SqlGetLatestRevisionByEntryId.js","sources":["../../../src/operations/entry/SqlGetLatestRevisionByEntryId.ts"],"sourcesContent":["import type { Knex } from \"knex\";\nimport type {\n CmsEntryStorageOperationsGetLatestRevisionParams,\n CmsEntryValues,\n CmsModel\n} from \"@webiny/api-headless-cms/types/index.js\";\nimport { GetLatestRevisionByEntryIdStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/entry/GetLatestRevisionByEntryIdStorageOperation.js\";\nimport { KnexClient } from \"@webiny/api-core-sql\";\nimport { EntryTableManager } from \"~/features/entryTableManager/abstractions.js\";\nimport { parseIdentifier } from \"@webiny/utils\";\nimport type { IEntryRow } from \"./types.js\";\nimport { rowToEntry } from \"./mappers.js\";\nimport { createEntryQuery } from \"./queryHelpers.js\";\n\nclass SqlGetLatestRevisionByEntryIdImpl\n implements GetLatestRevisionByEntryIdStorageOperation.Interface\n{\n private readonly knex: Knex;\n\n public constructor(\n knexClient: KnexClient.Interface,\n private readonly entryTableManager: EntryTableManager.Interface\n ) {\n this.knex = knexClient.client;\n }\n\n private query(): Knex.QueryBuilder<IEntryRow> {\n return createEntryQuery(this.knex, this.entryTableManager.getTableName());\n }\n\n async execute<T extends CmsEntryValues>(\n model: CmsModel,\n params: CmsEntryStorageOperationsGetLatestRevisionParams\n ) {\n await this.entryTableManager.ensureTable();\n\n const { id: entryId } = parseIdentifier(params.id);\n\n const row = await this.query()\n .where(\"tenant\", model.tenant)\n .andWhere(\"modelId\", model.modelId)\n .where(\"entryId\", entryId)\n .andWhere(\"isLatest\", true)\n .first();\n\n if (!row) {\n return null;\n }\n\n return rowToEntry<T>(row);\n }\n}\n\nexport const SqlGetLatestRevisionByEntryId =\n GetLatestRevisionByEntryIdStorageOperation.createImplementation({\n implementation: SqlGetLatestRevisionByEntryIdImpl,\n dependencies: [KnexClient, EntryTableManager]\n });\n"],"names":["SqlGetLatestRevisionByEntryIdImpl","knexClient","entryTableManager","createEntryQuery","model","params","entryId","parseIdentifier","row","rowToEntry","SqlGetLatestRevisionByEntryId","GetLatestRevisionByEntryIdStorageOperation","KnexClient","EntryTableManager"],"mappings":";;;;;;AAcA,MAAMA;IAKF,YACIC,UAAgC,EACfC,iBAA8C,CACjE;aADmBA,iBAAiB,GAAjBA;QAEjB,IAAI,CAAC,IAAI,GAAGD,WAAW,MAAM;IACjC;IAEQ,QAAsC;QAC1C,OAAOE,iBAAiB,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,iBAAiB,CAAC,YAAY;IAC1E;IAEA,MAAM,QACFC,KAAe,EACfC,MAAwD,EAC1D;QACE,MAAM,IAAI,CAAC,iBAAiB,CAAC,WAAW;QAExC,MAAM,EAAE,IAAIC,OAAO,EAAE,GAAGC,gBAAgBF,OAAO,EAAE;QAEjD,MAAMG,MAAM,MAAM,IAAI,CAAC,KAAK,GACvB,KAAK,CAAC,UAAUJ,MAAM,MAAM,EAC5B,QAAQ,CAAC,WAAWA,MAAM,OAAO,EACjC,KAAK,CAAC,WAAWE,SACjB,QAAQ,CAAC,YAAY,MACrB,KAAK;QAEV,IAAI,CAACE,KACD,OAAO;QAGX,OAAOC,WAAcD;IACzB;AACJ;AAEO,MAAME,gCACTC,2CAA2C,oBAAoB,CAAC;IAC5D,gBAAgBX;IAChB,cAAc;QAACY;QAAYC;KAAkB;AACjD"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { CmsEntryStorageOperationsGetPreviousRevisionParams, CmsEntryValues, CmsModel } from "@webiny/api-headless-cms/types/index.js";
|
|
2
|
-
import { GetPreviousRevisionStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/GetPreviousRevisionStorageOperation.js";
|
|
3
|
-
import { KnexClient } from "@webiny/api-core-sql";
|
|
4
|
-
import { EntryTableManager } from "../../features/entryTableManager/abstractions.js";
|
|
5
|
-
declare class SqlGetPreviousRevisionImpl implements GetPreviousRevisionStorageOperation.Interface {
|
|
6
|
-
private readonly entryTableManager;
|
|
7
|
-
private readonly knex;
|
|
8
|
-
constructor(knexClient: KnexClient.Interface, entryTableManager: EntryTableManager.Interface);
|
|
9
|
-
private query;
|
|
10
|
-
execute<T extends CmsEntryValues>(model: CmsModel, params: CmsEntryStorageOperationsGetPreviousRevisionParams): Promise<import("@webiny/api-headless-cms/types/types.js").CmsEntry<T> | null>;
|
|
11
|
-
}
|
|
12
|
-
export declare const SqlGetPreviousRevision: typeof SqlGetPreviousRevisionImpl & {
|
|
13
|
-
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-headless-cms/features/shared/storageOperations/entry/GetPreviousRevisionStorageOperation.js").IGetPreviousRevisionStorageOperation>;
|
|
14
|
-
};
|
|
15
|
-
export {};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { GetPreviousRevisionStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/GetPreviousRevisionStorageOperation.js";
|
|
2
|
-
import { KnexClient } from "@webiny/api-core-sql";
|
|
3
|
-
import { EntryTableManager } from "../../features/entryTableManager/abstractions.js";
|
|
4
|
-
import { rowToEntry } from "./mappers.js";
|
|
5
|
-
import { createEntryQuery } from "./queryHelpers.js";
|
|
6
|
-
class SqlGetPreviousRevisionImpl {
|
|
7
|
-
constructor(knexClient, entryTableManager){
|
|
8
|
-
this.entryTableManager = entryTableManager;
|
|
9
|
-
this.knex = knexClient.client;
|
|
10
|
-
}
|
|
11
|
-
query() {
|
|
12
|
-
return createEntryQuery(this.knex, this.entryTableManager.getTableName());
|
|
13
|
-
}
|
|
14
|
-
async execute(model, params) {
|
|
15
|
-
await this.entryTableManager.ensureTable();
|
|
16
|
-
const row = await this.query().where("tenant", model.tenant).andWhere("modelId", model.modelId).where("entryId", params.entryId).andWhere("version", "<", params.version).orderBy("version", "desc").first();
|
|
17
|
-
if (!row) return null;
|
|
18
|
-
return rowToEntry(row);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
const SqlGetPreviousRevision = GetPreviousRevisionStorageOperation.createImplementation({
|
|
22
|
-
implementation: SqlGetPreviousRevisionImpl,
|
|
23
|
-
dependencies: [
|
|
24
|
-
KnexClient,
|
|
25
|
-
EntryTableManager
|
|
26
|
-
]
|
|
27
|
-
});
|
|
28
|
-
export { SqlGetPreviousRevision };
|
|
29
|
-
|
|
30
|
-
//# sourceMappingURL=SqlGetPreviousRevision.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"operations/entry/SqlGetPreviousRevision.js","sources":["../../../src/operations/entry/SqlGetPreviousRevision.ts"],"sourcesContent":["import type { Knex } from \"knex\";\nimport type {\n CmsEntryStorageOperationsGetPreviousRevisionParams,\n CmsEntryValues,\n CmsModel\n} from \"@webiny/api-headless-cms/types/index.js\";\nimport { GetPreviousRevisionStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/entry/GetPreviousRevisionStorageOperation.js\";\nimport { KnexClient } from \"@webiny/api-core-sql\";\nimport { EntryTableManager } from \"~/features/entryTableManager/abstractions.js\";\nimport type { IEntryRow } from \"./types.js\";\nimport { rowToEntry } from \"./mappers.js\";\nimport { createEntryQuery } from \"./queryHelpers.js\";\n\nclass SqlGetPreviousRevisionImpl implements GetPreviousRevisionStorageOperation.Interface {\n private readonly knex: Knex;\n\n public constructor(\n knexClient: KnexClient.Interface,\n private readonly entryTableManager: EntryTableManager.Interface\n ) {\n this.knex = knexClient.client;\n }\n\n private query(): Knex.QueryBuilder<IEntryRow> {\n return createEntryQuery(this.knex, this.entryTableManager.getTableName());\n }\n\n async execute<T extends CmsEntryValues>(\n model: CmsModel,\n params: CmsEntryStorageOperationsGetPreviousRevisionParams\n ) {\n await this.entryTableManager.ensureTable();\n\n const row = await this.query()\n .where(\"tenant\", model.tenant)\n .andWhere(\"modelId\", model.modelId)\n .where(\"entryId\", params.entryId)\n .andWhere(\"version\", \"<\", params.version)\n .orderBy(\"version\", \"desc\")\n .first();\n\n if (!row) {\n return null;\n }\n\n return rowToEntry<T>(row);\n }\n}\n\nexport const SqlGetPreviousRevision = GetPreviousRevisionStorageOperation.createImplementation({\n implementation: SqlGetPreviousRevisionImpl,\n dependencies: [KnexClient, EntryTableManager]\n});\n"],"names":["SqlGetPreviousRevisionImpl","knexClient","entryTableManager","createEntryQuery","model","params","row","rowToEntry","SqlGetPreviousRevision","GetPreviousRevisionStorageOperation","KnexClient","EntryTableManager"],"mappings":";;;;;AAaA,MAAMA;IAGF,YACIC,UAAgC,EACfC,iBAA8C,CACjE;aADmBA,iBAAiB,GAAjBA;QAEjB,IAAI,CAAC,IAAI,GAAGD,WAAW,MAAM;IACjC;IAEQ,QAAsC;QAC1C,OAAOE,iBAAiB,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,iBAAiB,CAAC,YAAY;IAC1E;IAEA,MAAM,QACFC,KAAe,EACfC,MAA0D,EAC5D;QACE,MAAM,IAAI,CAAC,iBAAiB,CAAC,WAAW;QAExC,MAAMC,MAAM,MAAM,IAAI,CAAC,KAAK,GACvB,KAAK,CAAC,UAAUF,MAAM,MAAM,EAC5B,QAAQ,CAAC,WAAWA,MAAM,OAAO,EACjC,KAAK,CAAC,WAAWC,OAAO,OAAO,EAC/B,QAAQ,CAAC,WAAW,KAAKA,OAAO,OAAO,EACvC,OAAO,CAAC,WAAW,QACnB,KAAK;QAEV,IAAI,CAACC,KACD,OAAO;QAGX,OAAOC,WAAcD;IACzB;AACJ;AAEO,MAAME,yBAAyBC,oCAAoC,oBAAoB,CAAC;IAC3F,gBAAgBT;IAChB,cAAc;QAACU;QAAYC;KAAkB;AACjD"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { CmsEntry, CmsEntryStorageOperationsGetPublishedByIdsParams, CmsEntryValues, CmsModel } from "@webiny/api-headless-cms/types/index.js";
|
|
2
|
-
import { GetPublishedEntriesByIdsStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/GetPublishedEntriesByIdsStorageOperation.js";
|
|
3
|
-
import { KnexClient } from "@webiny/api-core-sql";
|
|
4
|
-
import { EntryTableManager } from "../../features/entryTableManager/abstractions.js";
|
|
5
|
-
declare class SqlGetPublishedEntriesByIdsImpl implements GetPublishedEntriesByIdsStorageOperation.Interface {
|
|
6
|
-
private readonly entryTableManager;
|
|
7
|
-
private readonly knex;
|
|
8
|
-
constructor(knexClient: KnexClient.Interface, entryTableManager: EntryTableManager.Interface);
|
|
9
|
-
private query;
|
|
10
|
-
execute<T extends CmsEntryValues = CmsEntryValues>(model: CmsModel, params: CmsEntryStorageOperationsGetPublishedByIdsParams): Promise<CmsEntry<T>[]>;
|
|
11
|
-
}
|
|
12
|
-
export declare const SqlGetPublishedEntriesByIds: typeof SqlGetPublishedEntriesByIdsImpl & {
|
|
13
|
-
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-headless-cms/features/shared/storageOperations/entry/GetPublishedEntriesByIdsStorageOperation.js").IGetPublishedEntriesByIdsStorageOperation>;
|
|
14
|
-
};
|
|
15
|
-
export {};
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { GetPublishedEntriesByIdsStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/GetPublishedEntriesByIdsStorageOperation.js";
|
|
2
|
-
import { KnexClient } from "@webiny/api-core-sql";
|
|
3
|
-
import { EntryTableManager } from "../../features/entryTableManager/abstractions.js";
|
|
4
|
-
import { parseIdentifier } from "@webiny/utils";
|
|
5
|
-
import { rowToEntry } from "./mappers.js";
|
|
6
|
-
import { createEntryQuery } from "./queryHelpers.js";
|
|
7
|
-
class SqlGetPublishedEntriesByIdsImpl {
|
|
8
|
-
constructor(knexClient, entryTableManager){
|
|
9
|
-
this.entryTableManager = entryTableManager;
|
|
10
|
-
this.knex = knexClient.client;
|
|
11
|
-
}
|
|
12
|
-
query() {
|
|
13
|
-
return createEntryQuery(this.knex, this.entryTableManager.getTableName());
|
|
14
|
-
}
|
|
15
|
-
async execute(model, params) {
|
|
16
|
-
await this.entryTableManager.ensureTable();
|
|
17
|
-
const idList = params.ids;
|
|
18
|
-
const entryIds = idList.map((id)=>parseIdentifier(id).id);
|
|
19
|
-
const rows = await this.query().where("tenant", model.tenant).andWhere("modelId", model.modelId).whereIn("entryId", entryIds).andWhere("isPublished", true);
|
|
20
|
-
const entries = rows.map((row)=>rowToEntry(row));
|
|
21
|
-
const byEntryId = new Map(entries.map((e)=>[
|
|
22
|
-
e.entryId,
|
|
23
|
-
e
|
|
24
|
-
]));
|
|
25
|
-
return entryIds.map((eid)=>byEntryId.get(eid)).filter(Boolean);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
const SqlGetPublishedEntriesByIds = GetPublishedEntriesByIdsStorageOperation.createImplementation({
|
|
29
|
-
implementation: SqlGetPublishedEntriesByIdsImpl,
|
|
30
|
-
dependencies: [
|
|
31
|
-
KnexClient,
|
|
32
|
-
EntryTableManager
|
|
33
|
-
]
|
|
34
|
-
});
|
|
35
|
-
export { SqlGetPublishedEntriesByIds };
|
|
36
|
-
|
|
37
|
-
//# sourceMappingURL=SqlGetPublishedEntriesByIds.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"operations/entry/SqlGetPublishedEntriesByIds.js","sources":["../../../src/operations/entry/SqlGetPublishedEntriesByIds.ts"],"sourcesContent":["import type { Knex } from \"knex\";\nimport type {\n CmsEntry,\n CmsEntryStorageOperationsGetPublishedByIdsParams,\n CmsEntryValues,\n CmsModel\n} from \"@webiny/api-headless-cms/types/index.js\";\nimport { GetPublishedEntriesByIdsStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/entry/GetPublishedEntriesByIdsStorageOperation.js\";\nimport { KnexClient } from \"@webiny/api-core-sql\";\nimport { EntryTableManager } from \"~/features/entryTableManager/abstractions.js\";\nimport { parseIdentifier } from \"@webiny/utils\";\nimport type { IEntryRow } from \"./types.js\";\nimport { rowToEntry } from \"./mappers.js\";\nimport { createEntryQuery } from \"./queryHelpers.js\";\n\nclass SqlGetPublishedEntriesByIdsImpl\n implements GetPublishedEntriesByIdsStorageOperation.Interface\n{\n private readonly knex: Knex;\n\n public constructor(\n knexClient: KnexClient.Interface,\n private readonly entryTableManager: EntryTableManager.Interface\n ) {\n this.knex = knexClient.client;\n }\n\n private query(): Knex.QueryBuilder<IEntryRow> {\n return createEntryQuery(this.knex, this.entryTableManager.getTableName());\n }\n\n async execute<T extends CmsEntryValues = CmsEntryValues>(\n model: CmsModel,\n params: CmsEntryStorageOperationsGetPublishedByIdsParams\n ) {\n await this.entryTableManager.ensureTable();\n\n const idList = params.ids as string[];\n const entryIds = idList.map(id => parseIdentifier(id).id);\n\n const rows: IEntryRow[] = await this.query()\n .where(\"tenant\", model.tenant)\n .andWhere(\"modelId\", model.modelId)\n .whereIn(\"entryId\", entryIds)\n .andWhere(\"isPublished\", true);\n\n const entries = rows.map(row => rowToEntry(row));\n const byEntryId = new Map(entries.map(e => [e.entryId, e]));\n\n return entryIds.map(eid => byEntryId.get(eid)).filter(Boolean) as CmsEntry<T>[];\n }\n}\n\nexport const SqlGetPublishedEntriesByIds =\n GetPublishedEntriesByIdsStorageOperation.createImplementation({\n implementation: SqlGetPublishedEntriesByIdsImpl,\n dependencies: [KnexClient, EntryTableManager]\n });\n"],"names":["SqlGetPublishedEntriesByIdsImpl","knexClient","entryTableManager","createEntryQuery","model","params","idList","entryIds","id","parseIdentifier","rows","entries","row","rowToEntry","byEntryId","Map","e","eid","Boolean","SqlGetPublishedEntriesByIds","GetPublishedEntriesByIdsStorageOperation","KnexClient","EntryTableManager"],"mappings":";;;;;;AAeA,MAAMA;IAKF,YACIC,UAAgC,EACfC,iBAA8C,CACjE;aADmBA,iBAAiB,GAAjBA;QAEjB,IAAI,CAAC,IAAI,GAAGD,WAAW,MAAM;IACjC;IAEQ,QAAsC;QAC1C,OAAOE,iBAAiB,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,iBAAiB,CAAC,YAAY;IAC1E;IAEA,MAAM,QACFC,KAAe,EACfC,MAAwD,EAC1D;QACE,MAAM,IAAI,CAAC,iBAAiB,CAAC,WAAW;QAExC,MAAMC,SAASD,OAAO,GAAG;QACzB,MAAME,WAAWD,OAAO,GAAG,CAACE,CAAAA,KAAMC,gBAAgBD,IAAI,EAAE;QAExD,MAAME,OAAoB,MAAM,IAAI,CAAC,KAAK,GACrC,KAAK,CAAC,UAAUN,MAAM,MAAM,EAC5B,QAAQ,CAAC,WAAWA,MAAM,OAAO,EACjC,OAAO,CAAC,WAAWG,UACnB,QAAQ,CAAC,eAAe;QAE7B,MAAMI,UAAUD,KAAK,GAAG,CAACE,CAAAA,MAAOC,WAAWD;QAC3C,MAAME,YAAY,IAAIC,IAAIJ,QAAQ,GAAG,CAACK,CAAAA,IAAK;gBAACA,EAAE,OAAO;gBAAEA;aAAE;QAEzD,OAAOT,SAAS,GAAG,CAACU,CAAAA,MAAOH,UAAU,GAAG,CAACG,MAAM,MAAM,CAACC;IAC1D;AACJ;AAEO,MAAMC,8BACTC,yCAAyC,oBAAoB,CAAC;IAC1D,gBAAgBpB;IAChB,cAAc;QAACqB;QAAYC;KAAkB;AACjD"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { CmsEntryStorageOperationsGetPublishedRevisionParams, CmsEntryValues, CmsModel } from "@webiny/api-headless-cms/types/index.js";
|
|
2
|
-
import { GetPublishedRevisionByEntryIdStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/GetPublishedRevisionByEntryIdStorageOperation.js";
|
|
3
|
-
import { KnexClient } from "@webiny/api-core-sql";
|
|
4
|
-
import { EntryTableManager } from "../../features/entryTableManager/abstractions.js";
|
|
5
|
-
declare class SqlGetPublishedRevisionByEntryIdImpl implements GetPublishedRevisionByEntryIdStorageOperation.Interface {
|
|
6
|
-
private readonly entryTableManager;
|
|
7
|
-
private readonly knex;
|
|
8
|
-
constructor(knexClient: KnexClient.Interface, entryTableManager: EntryTableManager.Interface);
|
|
9
|
-
private query;
|
|
10
|
-
execute<T extends CmsEntryValues>(model: CmsModel, params: CmsEntryStorageOperationsGetPublishedRevisionParams): Promise<import("@webiny/api-headless-cms/types/types.js").CmsEntry<T> | null>;
|
|
11
|
-
}
|
|
12
|
-
export declare const SqlGetPublishedRevisionByEntryId: typeof SqlGetPublishedRevisionByEntryIdImpl & {
|
|
13
|
-
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-headless-cms/features/shared/storageOperations/entry/GetPublishedRevisionByEntryIdStorageOperation.js").IGetPublishedRevisionByEntryIdStorageOperation>;
|
|
14
|
-
};
|
|
15
|
-
export {};
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { GetPublishedRevisionByEntryIdStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/GetPublishedRevisionByEntryIdStorageOperation.js";
|
|
2
|
-
import { KnexClient } from "@webiny/api-core-sql";
|
|
3
|
-
import { EntryTableManager } from "../../features/entryTableManager/abstractions.js";
|
|
4
|
-
import { parseIdentifier } from "@webiny/utils";
|
|
5
|
-
import { rowToEntry } from "./mappers.js";
|
|
6
|
-
import { createEntryQuery } from "./queryHelpers.js";
|
|
7
|
-
class SqlGetPublishedRevisionByEntryIdImpl {
|
|
8
|
-
constructor(knexClient, entryTableManager){
|
|
9
|
-
this.entryTableManager = entryTableManager;
|
|
10
|
-
this.knex = knexClient.client;
|
|
11
|
-
}
|
|
12
|
-
query() {
|
|
13
|
-
return createEntryQuery(this.knex, this.entryTableManager.getTableName());
|
|
14
|
-
}
|
|
15
|
-
async execute(model, params) {
|
|
16
|
-
await this.entryTableManager.ensureTable();
|
|
17
|
-
const { id: entryId } = parseIdentifier(params.id);
|
|
18
|
-
const row = await this.query().where("tenant", model.tenant).andWhere("modelId", model.modelId).where("entryId", entryId).andWhere("isPublished", true).first();
|
|
19
|
-
if (!row) return null;
|
|
20
|
-
return rowToEntry(row);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
const SqlGetPublishedRevisionByEntryId = GetPublishedRevisionByEntryIdStorageOperation.createImplementation({
|
|
24
|
-
implementation: SqlGetPublishedRevisionByEntryIdImpl,
|
|
25
|
-
dependencies: [
|
|
26
|
-
KnexClient,
|
|
27
|
-
EntryTableManager
|
|
28
|
-
]
|
|
29
|
-
});
|
|
30
|
-
export { SqlGetPublishedRevisionByEntryId };
|
|
31
|
-
|
|
32
|
-
//# sourceMappingURL=SqlGetPublishedRevisionByEntryId.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"operations/entry/SqlGetPublishedRevisionByEntryId.js","sources":["../../../src/operations/entry/SqlGetPublishedRevisionByEntryId.ts"],"sourcesContent":["import type { Knex } from \"knex\";\nimport type {\n CmsEntryStorageOperationsGetPublishedRevisionParams,\n CmsEntryValues,\n CmsModel\n} from \"@webiny/api-headless-cms/types/index.js\";\nimport { GetPublishedRevisionByEntryIdStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/entry/GetPublishedRevisionByEntryIdStorageOperation.js\";\nimport { KnexClient } from \"@webiny/api-core-sql\";\nimport { EntryTableManager } from \"~/features/entryTableManager/abstractions.js\";\nimport { parseIdentifier } from \"@webiny/utils\";\nimport type { IEntryRow } from \"./types.js\";\nimport { rowToEntry } from \"./mappers.js\";\nimport { createEntryQuery } from \"./queryHelpers.js\";\n\nclass SqlGetPublishedRevisionByEntryIdImpl\n implements GetPublishedRevisionByEntryIdStorageOperation.Interface\n{\n private readonly knex: Knex;\n\n public constructor(\n knexClient: KnexClient.Interface,\n private readonly entryTableManager: EntryTableManager.Interface\n ) {\n this.knex = knexClient.client;\n }\n\n private query(): Knex.QueryBuilder<IEntryRow> {\n return createEntryQuery(this.knex, this.entryTableManager.getTableName());\n }\n\n async execute<T extends CmsEntryValues>(\n model: CmsModel,\n params: CmsEntryStorageOperationsGetPublishedRevisionParams\n ) {\n await this.entryTableManager.ensureTable();\n\n const { id: entryId } = parseIdentifier(params.id);\n\n const row = await this.query()\n .where(\"tenant\", model.tenant)\n .andWhere(\"modelId\", model.modelId)\n .where(\"entryId\", entryId)\n .andWhere(\"isPublished\", true)\n .first();\n\n if (!row) {\n return null;\n }\n\n return rowToEntry<T>(row);\n }\n}\n\nexport const SqlGetPublishedRevisionByEntryId =\n GetPublishedRevisionByEntryIdStorageOperation.createImplementation({\n implementation: SqlGetPublishedRevisionByEntryIdImpl,\n dependencies: [KnexClient, EntryTableManager]\n });\n"],"names":["SqlGetPublishedRevisionByEntryIdImpl","knexClient","entryTableManager","createEntryQuery","model","params","entryId","parseIdentifier","row","rowToEntry","SqlGetPublishedRevisionByEntryId","GetPublishedRevisionByEntryIdStorageOperation","KnexClient","EntryTableManager"],"mappings":";;;;;;AAcA,MAAMA;IAKF,YACIC,UAAgC,EACfC,iBAA8C,CACjE;aADmBA,iBAAiB,GAAjBA;QAEjB,IAAI,CAAC,IAAI,GAAGD,WAAW,MAAM;IACjC;IAEQ,QAAsC;QAC1C,OAAOE,iBAAiB,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,iBAAiB,CAAC,YAAY;IAC1E;IAEA,MAAM,QACFC,KAAe,EACfC,MAA2D,EAC7D;QACE,MAAM,IAAI,CAAC,iBAAiB,CAAC,WAAW;QAExC,MAAM,EAAE,IAAIC,OAAO,EAAE,GAAGC,gBAAgBF,OAAO,EAAE;QAEjD,MAAMG,MAAM,MAAM,IAAI,CAAC,KAAK,GACvB,KAAK,CAAC,UAAUJ,MAAM,MAAM,EAC5B,QAAQ,CAAC,WAAWA,MAAM,OAAO,EACjC,KAAK,CAAC,WAAWE,SACjB,QAAQ,CAAC,eAAe,MACxB,KAAK;QAEV,IAAI,CAACE,KACD,OAAO;QAGX,OAAOC,WAAcD;IACzB;AACJ;AAEO,MAAME,mCACTC,8CAA8C,oBAAoB,CAAC;IAC/D,gBAAgBX;IAChB,cAAc;QAACY;QAAYC;KAAkB;AACjD"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { CmsEntryStorageOperationsGetRevisionParams, CmsEntryValues, CmsModel } from "@webiny/api-headless-cms/types/index.js";
|
|
2
|
-
import { GetRevisionByIdStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/GetRevisionByIdStorageOperation.js";
|
|
3
|
-
import { KnexClient } from "@webiny/api-core-sql";
|
|
4
|
-
import { EntryTableManager } from "../../features/entryTableManager/abstractions.js";
|
|
5
|
-
declare class SqlGetRevisionByIdImpl implements GetRevisionByIdStorageOperation.Interface {
|
|
6
|
-
private readonly entryTableManager;
|
|
7
|
-
private readonly knex;
|
|
8
|
-
constructor(knexClient: KnexClient.Interface, entryTableManager: EntryTableManager.Interface);
|
|
9
|
-
private query;
|
|
10
|
-
execute<T extends CmsEntryValues>(model: CmsModel, params: CmsEntryStorageOperationsGetRevisionParams): Promise<import("@webiny/api-headless-cms/types/types.js").CmsEntry<T> | null>;
|
|
11
|
-
}
|
|
12
|
-
export declare const SqlGetRevisionById: typeof SqlGetRevisionByIdImpl & {
|
|
13
|
-
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-headless-cms/features/shared/storageOperations/entry/GetRevisionByIdStorageOperation.js").IGetRevisionByIdStorageOperation>;
|
|
14
|
-
};
|
|
15
|
-
export {};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { GetRevisionByIdStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/GetRevisionByIdStorageOperation.js";
|
|
2
|
-
import { KnexClient } from "@webiny/api-core-sql";
|
|
3
|
-
import { EntryTableManager } from "../../features/entryTableManager/abstractions.js";
|
|
4
|
-
import { rowToEntry } from "./mappers.js";
|
|
5
|
-
import { createEntryQuery } from "./queryHelpers.js";
|
|
6
|
-
class SqlGetRevisionByIdImpl {
|
|
7
|
-
constructor(knexClient, entryTableManager){
|
|
8
|
-
this.entryTableManager = entryTableManager;
|
|
9
|
-
this.knex = knexClient.client;
|
|
10
|
-
}
|
|
11
|
-
query() {
|
|
12
|
-
return createEntryQuery(this.knex, this.entryTableManager.getTableName());
|
|
13
|
-
}
|
|
14
|
-
async execute(model, params) {
|
|
15
|
-
await this.entryTableManager.ensureTable();
|
|
16
|
-
const row = await this.query().where("tenant", model.tenant).andWhere("modelId", model.modelId).where("id", params.id).first();
|
|
17
|
-
if (!row) return null;
|
|
18
|
-
return rowToEntry(row);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
const SqlGetRevisionById = GetRevisionByIdStorageOperation.createImplementation({
|
|
22
|
-
implementation: SqlGetRevisionByIdImpl,
|
|
23
|
-
dependencies: [
|
|
24
|
-
KnexClient,
|
|
25
|
-
EntryTableManager
|
|
26
|
-
]
|
|
27
|
-
});
|
|
28
|
-
export { SqlGetRevisionById };
|
|
29
|
-
|
|
30
|
-
//# sourceMappingURL=SqlGetRevisionById.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"operations/entry/SqlGetRevisionById.js","sources":["../../../src/operations/entry/SqlGetRevisionById.ts"],"sourcesContent":["import type { Knex } from \"knex\";\nimport type {\n CmsEntryStorageOperationsGetRevisionParams,\n CmsEntryValues,\n CmsModel\n} from \"@webiny/api-headless-cms/types/index.js\";\nimport { GetRevisionByIdStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/entry/GetRevisionByIdStorageOperation.js\";\nimport { KnexClient } from \"@webiny/api-core-sql\";\nimport { EntryTableManager } from \"~/features/entryTableManager/abstractions.js\";\nimport type { IEntryRow } from \"./types.js\";\nimport { rowToEntry } from \"./mappers.js\";\nimport { createEntryQuery } from \"./queryHelpers.js\";\n\nclass SqlGetRevisionByIdImpl implements GetRevisionByIdStorageOperation.Interface {\n private readonly knex: Knex;\n\n public constructor(\n knexClient: KnexClient.Interface,\n private readonly entryTableManager: EntryTableManager.Interface\n ) {\n this.knex = knexClient.client;\n }\n\n private query(): Knex.QueryBuilder<IEntryRow> {\n return createEntryQuery(this.knex, this.entryTableManager.getTableName());\n }\n\n async execute<T extends CmsEntryValues>(\n model: CmsModel,\n params: CmsEntryStorageOperationsGetRevisionParams\n ) {\n await this.entryTableManager.ensureTable();\n\n const row = await this.query()\n .where(\"tenant\", model.tenant)\n .andWhere(\"modelId\", model.modelId)\n .where(\"id\", params.id)\n .first();\n\n if (!row) {\n return null;\n }\n\n return rowToEntry<T>(row);\n }\n}\n\nexport const SqlGetRevisionById = GetRevisionByIdStorageOperation.createImplementation({\n implementation: SqlGetRevisionByIdImpl,\n dependencies: [KnexClient, EntryTableManager]\n});\n"],"names":["SqlGetRevisionByIdImpl","knexClient","entryTableManager","createEntryQuery","model","params","row","rowToEntry","SqlGetRevisionById","GetRevisionByIdStorageOperation","KnexClient","EntryTableManager"],"mappings":";;;;;AAaA,MAAMA;IAGF,YACIC,UAAgC,EACfC,iBAA8C,CACjE;aADmBA,iBAAiB,GAAjBA;QAEjB,IAAI,CAAC,IAAI,GAAGD,WAAW,MAAM;IACjC;IAEQ,QAAsC;QAC1C,OAAOE,iBAAiB,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,iBAAiB,CAAC,YAAY;IAC1E;IAEA,MAAM,QACFC,KAAe,EACfC,MAAkD,EACpD;QACE,MAAM,IAAI,CAAC,iBAAiB,CAAC,WAAW;QAExC,MAAMC,MAAM,MAAM,IAAI,CAAC,KAAK,GACvB,KAAK,CAAC,UAAUF,MAAM,MAAM,EAC5B,QAAQ,CAAC,WAAWA,MAAM,OAAO,EACjC,KAAK,CAAC,MAAMC,OAAO,EAAE,EACrB,KAAK;QAEV,IAAI,CAACC,KACD,OAAO;QAGX,OAAOC,WAAcD;IACzB;AACJ;AAEO,MAAME,qBAAqBC,gCAAgC,oBAAoB,CAAC;IACnF,gBAAgBT;IAChB,cAAc;QAACU;QAAYC;KAAkB;AACjD"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { CmsEntryStorageOperationsGetRevisionsParams, CmsEntryValues, CmsModel } from "@webiny/api-headless-cms/types/index.js";
|
|
2
|
-
import { GetRevisionsStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/GetRevisionsStorageOperation.js";
|
|
3
|
-
import { KnexClient } from "@webiny/api-core-sql";
|
|
4
|
-
import { EntryTableManager } from "../../features/entryTableManager/abstractions.js";
|
|
5
|
-
declare class SqlGetRevisionsImpl implements GetRevisionsStorageOperation.Interface {
|
|
6
|
-
private readonly entryTableManager;
|
|
7
|
-
private readonly knex;
|
|
8
|
-
constructor(knexClient: KnexClient.Interface, entryTableManager: EntryTableManager.Interface);
|
|
9
|
-
private query;
|
|
10
|
-
execute<T extends CmsEntryValues>(model: CmsModel, params: CmsEntryStorageOperationsGetRevisionsParams): Promise<import("@webiny/api-headless-cms/types/types.js").CmsEntry<T>[]>;
|
|
11
|
-
}
|
|
12
|
-
export declare const SqlGetRevisions: typeof SqlGetRevisionsImpl & {
|
|
13
|
-
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-headless-cms/features/shared/storageOperations/entry/GetRevisionsStorageOperation.js").IGetRevisionsStorageOperation>;
|
|
14
|
-
};
|
|
15
|
-
export {};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { GetRevisionsStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/GetRevisionsStorageOperation.js";
|
|
2
|
-
import { KnexClient } from "@webiny/api-core-sql";
|
|
3
|
-
import { EntryTableManager } from "../../features/entryTableManager/abstractions.js";
|
|
4
|
-
import { parseIdentifier } from "@webiny/utils";
|
|
5
|
-
import { rowToEntry } from "./mappers.js";
|
|
6
|
-
import { createEntryQuery } from "./queryHelpers.js";
|
|
7
|
-
class SqlGetRevisionsImpl {
|
|
8
|
-
constructor(knexClient, entryTableManager){
|
|
9
|
-
this.entryTableManager = entryTableManager;
|
|
10
|
-
this.knex = knexClient.client;
|
|
11
|
-
}
|
|
12
|
-
query() {
|
|
13
|
-
return createEntryQuery(this.knex, this.entryTableManager.getTableName());
|
|
14
|
-
}
|
|
15
|
-
async execute(model, params) {
|
|
16
|
-
await this.entryTableManager.ensureTable();
|
|
17
|
-
const { id: entryId } = parseIdentifier(params.id);
|
|
18
|
-
const rows = await this.query().where("tenant", model.tenant).andWhere("modelId", model.modelId).where("entryId", entryId).orderBy("version", "desc");
|
|
19
|
-
return rows.map((row)=>rowToEntry(row));
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
const SqlGetRevisions = GetRevisionsStorageOperation.createImplementation({
|
|
23
|
-
implementation: SqlGetRevisionsImpl,
|
|
24
|
-
dependencies: [
|
|
25
|
-
KnexClient,
|
|
26
|
-
EntryTableManager
|
|
27
|
-
]
|
|
28
|
-
});
|
|
29
|
-
export { SqlGetRevisions };
|
|
30
|
-
|
|
31
|
-
//# sourceMappingURL=SqlGetRevisions.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"operations/entry/SqlGetRevisions.js","sources":["../../../src/operations/entry/SqlGetRevisions.ts"],"sourcesContent":["import type { Knex } from \"knex\";\nimport type {\n CmsEntryStorageOperationsGetRevisionsParams,\n CmsEntryValues,\n CmsModel\n} from \"@webiny/api-headless-cms/types/index.js\";\nimport { GetRevisionsStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/entry/GetRevisionsStorageOperation.js\";\nimport { KnexClient } from \"@webiny/api-core-sql\";\nimport { EntryTableManager } from \"~/features/entryTableManager/abstractions.js\";\nimport { parseIdentifier } from \"@webiny/utils\";\nimport type { IEntryRow } from \"./types.js\";\nimport { rowToEntry } from \"./mappers.js\";\nimport { createEntryQuery } from \"./queryHelpers.js\";\n\nclass SqlGetRevisionsImpl implements GetRevisionsStorageOperation.Interface {\n private readonly knex: Knex;\n\n public constructor(\n knexClient: KnexClient.Interface,\n private readonly entryTableManager: EntryTableManager.Interface\n ) {\n this.knex = knexClient.client;\n }\n\n private query(): Knex.QueryBuilder<IEntryRow> {\n return createEntryQuery(this.knex, this.entryTableManager.getTableName());\n }\n\n async execute<T extends CmsEntryValues>(\n model: CmsModel,\n params: CmsEntryStorageOperationsGetRevisionsParams\n ) {\n await this.entryTableManager.ensureTable();\n\n const { id: entryId } = parseIdentifier(params.id);\n\n const rows: IEntryRow[] = await this.query()\n .where(\"tenant\", model.tenant)\n .andWhere(\"modelId\", model.modelId)\n .where(\"entryId\", entryId)\n .orderBy(\"version\", \"desc\");\n\n return rows.map(row => rowToEntry<T>(row));\n }\n}\n\nexport const SqlGetRevisions = GetRevisionsStorageOperation.createImplementation({\n implementation: SqlGetRevisionsImpl,\n dependencies: [KnexClient, EntryTableManager]\n});\n"],"names":["SqlGetRevisionsImpl","knexClient","entryTableManager","createEntryQuery","model","params","entryId","parseIdentifier","rows","row","rowToEntry","SqlGetRevisions","GetRevisionsStorageOperation","KnexClient","EntryTableManager"],"mappings":";;;;;;AAcA,MAAMA;IAGF,YACIC,UAAgC,EACfC,iBAA8C,CACjE;aADmBA,iBAAiB,GAAjBA;QAEjB,IAAI,CAAC,IAAI,GAAGD,WAAW,MAAM;IACjC;IAEQ,QAAsC;QAC1C,OAAOE,iBAAiB,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,iBAAiB,CAAC,YAAY;IAC1E;IAEA,MAAM,QACFC,KAAe,EACfC,MAAmD,EACrD;QACE,MAAM,IAAI,CAAC,iBAAiB,CAAC,WAAW;QAExC,MAAM,EAAE,IAAIC,OAAO,EAAE,GAAGC,gBAAgBF,OAAO,EAAE;QAEjD,MAAMG,OAAoB,MAAM,IAAI,CAAC,KAAK,GACrC,KAAK,CAAC,UAAUJ,MAAM,MAAM,EAC5B,QAAQ,CAAC,WAAWA,MAAM,OAAO,EACjC,KAAK,CAAC,WAAWE,SACjB,OAAO,CAAC,WAAW;QAExB,OAAOE,KAAK,GAAG,CAACC,CAAAA,MAAOC,WAAcD;IACzC;AACJ;AAEO,MAAME,kBAAkBC,6BAA6B,oBAAoB,CAAC;IAC7E,gBAAgBZ;IAChB,cAAc;QAACa;QAAYC;KAAkB;AACjD"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { CmsEntryStorageOperationsGetUniqueFieldValuesParams, CmsModel } from "@webiny/api-headless-cms/types/index.js";
|
|
2
|
-
import { GetUniqueFieldValuesStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/GetUniqueFieldValuesStorageOperation.js";
|
|
3
|
-
import { KnexClient } from "@webiny/api-core-sql";
|
|
4
|
-
import { EntryTableManager } from "../../features/entryTableManager/abstractions.js";
|
|
5
|
-
import { StorageTransformRegistry } from "@webiny/api-headless-cms/exports/api/cms/storage.js";
|
|
6
|
-
import { CmsStorageModelProvider } from "@webiny/api-headless-cms/features/shared/abstractions.js";
|
|
7
|
-
import { ValueFilterRegistry } from "@webiny/db-utils";
|
|
8
|
-
import { FieldFilterPathRegistry, FieldFilterValueTransformRegistry, FieldFilterCreateRegistry, FieldSortingRegistry } from "@webiny/api-headless-cms-storage";
|
|
9
|
-
declare class SqlGetUniqueFieldValuesImpl implements GetUniqueFieldValuesStorageOperation.Interface {
|
|
10
|
-
private readonly entryTableManager;
|
|
11
|
-
private readonly storageTransformRegistry;
|
|
12
|
-
private readonly storageModelProvider;
|
|
13
|
-
private readonly pathRegistry;
|
|
14
|
-
private readonly transformRegistry;
|
|
15
|
-
private readonly filterCreateRegistry;
|
|
16
|
-
private readonly sortingRegistry;
|
|
17
|
-
private readonly valueFilterRegistry;
|
|
18
|
-
private readonly knex;
|
|
19
|
-
constructor(knexClient: KnexClient.Interface, entryTableManager: EntryTableManager.Interface, storageTransformRegistry: StorageTransformRegistry.Interface, storageModelProvider: CmsStorageModelProvider.Interface, pathRegistry: FieldFilterPathRegistry.Interface, transformRegistry: FieldFilterValueTransformRegistry.Interface, filterCreateRegistry: FieldFilterCreateRegistry.Interface, sortingRegistry: FieldSortingRegistry.Interface, valueFilterRegistry: ValueFilterRegistry.Interface);
|
|
20
|
-
execute(model: CmsModel, params: CmsEntryStorageOperationsGetUniqueFieldValuesParams): Promise<import("@webiny/api-headless-cms/types/types.js").CmsEntryUniqueValue[]>;
|
|
21
|
-
}
|
|
22
|
-
export declare const SqlGetUniqueFieldValues: typeof SqlGetUniqueFieldValuesImpl & {
|
|
23
|
-
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-headless-cms/features/shared/storageOperations/entry/GetUniqueFieldValuesStorageOperation.js").IGetUniqueFieldValuesStorageOperation>;
|
|
24
|
-
};
|
|
25
|
-
export {};
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { GetUniqueFieldValuesStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/GetUniqueFieldValuesStorageOperation.js";
|
|
2
|
-
import { KnexClient } from "@webiny/api-core-sql";
|
|
3
|
-
import { EntryTableManager } from "../../features/entryTableManager/abstractions.js";
|
|
4
|
-
import { StorageTransformRegistry } from "@webiny/api-headless-cms/exports/api/cms/storage.js";
|
|
5
|
-
import { CmsStorageModelProvider } from "@webiny/api-headless-cms/features/shared/abstractions.js";
|
|
6
|
-
import { ValueFilterRegistry } from "@webiny/db-utils";
|
|
7
|
-
import { FieldFilterCreateRegistry, FieldFilterPathRegistry, FieldFilterValueTransformRegistry, FieldSortingRegistry, aggregateUniqueFieldValues } from "@webiny/api-headless-cms-storage";
|
|
8
|
-
import { MAX_LIST_LIMIT, listEntries } from "./queryHelpers.js";
|
|
9
|
-
class SqlGetUniqueFieldValuesImpl {
|
|
10
|
-
constructor(knexClient, entryTableManager, storageTransformRegistry, storageModelProvider, pathRegistry, transformRegistry, filterCreateRegistry, sortingRegistry, valueFilterRegistry){
|
|
11
|
-
this.entryTableManager = entryTableManager;
|
|
12
|
-
this.storageTransformRegistry = storageTransformRegistry;
|
|
13
|
-
this.storageModelProvider = storageModelProvider;
|
|
14
|
-
this.pathRegistry = pathRegistry;
|
|
15
|
-
this.transformRegistry = transformRegistry;
|
|
16
|
-
this.filterCreateRegistry = filterCreateRegistry;
|
|
17
|
-
this.sortingRegistry = sortingRegistry;
|
|
18
|
-
this.valueFilterRegistry = valueFilterRegistry;
|
|
19
|
-
this.knex = knexClient.client;
|
|
20
|
-
}
|
|
21
|
-
async execute(model, params) {
|
|
22
|
-
const field = model.fields.find((f)=>f.fieldId === params.fieldId);
|
|
23
|
-
if (!field) return [];
|
|
24
|
-
await this.entryTableManager.ensureTable();
|
|
25
|
-
const { items } = await listEntries({
|
|
26
|
-
knex: this.knex,
|
|
27
|
-
tableName: this.entryTableManager.getTableName(),
|
|
28
|
-
storageModelProvider: this.storageModelProvider,
|
|
29
|
-
storageTransformRegistry: this.storageTransformRegistry,
|
|
30
|
-
pathRegistry: this.pathRegistry,
|
|
31
|
-
transformRegistry: this.transformRegistry,
|
|
32
|
-
filterCreateRegistry: this.filterCreateRegistry,
|
|
33
|
-
sortingRegistry: this.sortingRegistry,
|
|
34
|
-
valueFilterRegistry: this.valueFilterRegistry
|
|
35
|
-
}, model, {
|
|
36
|
-
where: params.where,
|
|
37
|
-
limit: MAX_LIST_LIMIT
|
|
38
|
-
});
|
|
39
|
-
return aggregateUniqueFieldValues(items, field.fieldId);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
const SqlGetUniqueFieldValues = GetUniqueFieldValuesStorageOperation.createImplementation({
|
|
43
|
-
implementation: SqlGetUniqueFieldValuesImpl,
|
|
44
|
-
dependencies: [
|
|
45
|
-
KnexClient,
|
|
46
|
-
EntryTableManager,
|
|
47
|
-
StorageTransformRegistry,
|
|
48
|
-
CmsStorageModelProvider,
|
|
49
|
-
FieldFilterPathRegistry,
|
|
50
|
-
FieldFilterValueTransformRegistry,
|
|
51
|
-
FieldFilterCreateRegistry,
|
|
52
|
-
FieldSortingRegistry,
|
|
53
|
-
ValueFilterRegistry
|
|
54
|
-
]
|
|
55
|
-
});
|
|
56
|
-
export { SqlGetUniqueFieldValues };
|
|
57
|
-
|
|
58
|
-
//# sourceMappingURL=SqlGetUniqueFieldValues.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"operations/entry/SqlGetUniqueFieldValues.js","sources":["../../../src/operations/entry/SqlGetUniqueFieldValues.ts"],"sourcesContent":["import type { Knex } from \"knex\";\nimport type {\n CmsEntryStorageOperationsGetUniqueFieldValuesParams,\n CmsModel\n} from \"@webiny/api-headless-cms/types/index.js\";\nimport { GetUniqueFieldValuesStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/entry/GetUniqueFieldValuesStorageOperation.js\";\nimport { KnexClient } from \"@webiny/api-core-sql\";\nimport { EntryTableManager } from \"~/features/entryTableManager/abstractions.js\";\nimport { StorageTransformRegistry } from \"@webiny/api-headless-cms/exports/api/cms/storage.js\";\nimport { CmsStorageModelProvider } from \"@webiny/api-headless-cms/features/shared/abstractions.js\";\nimport { ValueFilterRegistry } from \"@webiny/db-utils\";\nimport {\n aggregateUniqueFieldValues,\n FieldFilterPathRegistry,\n FieldFilterValueTransformRegistry,\n FieldFilterCreateRegistry,\n FieldSortingRegistry\n} from \"@webiny/api-headless-cms-storage\";\nimport { listEntries, MAX_LIST_LIMIT } from \"./queryHelpers.js\";\n\nclass SqlGetUniqueFieldValuesImpl implements GetUniqueFieldValuesStorageOperation.Interface {\n private readonly knex: Knex;\n\n public constructor(\n knexClient: KnexClient.Interface,\n private readonly entryTableManager: EntryTableManager.Interface,\n private readonly storageTransformRegistry: StorageTransformRegistry.Interface,\n private readonly storageModelProvider: CmsStorageModelProvider.Interface,\n private readonly pathRegistry: FieldFilterPathRegistry.Interface,\n private readonly transformRegistry: FieldFilterValueTransformRegistry.Interface,\n private readonly filterCreateRegistry: FieldFilterCreateRegistry.Interface,\n private readonly sortingRegistry: FieldSortingRegistry.Interface,\n private readonly valueFilterRegistry: ValueFilterRegistry.Interface\n ) {\n this.knex = knexClient.client;\n }\n\n async execute(model: CmsModel, params: CmsEntryStorageOperationsGetUniqueFieldValuesParams) {\n const field = model.fields.find(f => f.fieldId === params.fieldId);\n\n if (!field) {\n return [];\n }\n\n await this.entryTableManager.ensureTable();\n\n const { items } = await listEntries(\n {\n knex: this.knex,\n tableName: this.entryTableManager.getTableName(),\n storageModelProvider: this.storageModelProvider,\n storageTransformRegistry: this.storageTransformRegistry,\n pathRegistry: this.pathRegistry,\n transformRegistry: this.transformRegistry,\n filterCreateRegistry: this.filterCreateRegistry,\n sortingRegistry: this.sortingRegistry,\n valueFilterRegistry: this.valueFilterRegistry\n },\n model,\n {\n where: params.where,\n limit: MAX_LIST_LIMIT\n }\n );\n\n return aggregateUniqueFieldValues(items, field.fieldId);\n }\n}\n\nexport const SqlGetUniqueFieldValues = GetUniqueFieldValuesStorageOperation.createImplementation({\n implementation: SqlGetUniqueFieldValuesImpl,\n dependencies: [\n KnexClient,\n EntryTableManager,\n StorageTransformRegistry,\n CmsStorageModelProvider,\n FieldFilterPathRegistry,\n FieldFilterValueTransformRegistry,\n FieldFilterCreateRegistry,\n FieldSortingRegistry,\n ValueFilterRegistry\n ]\n});\n"],"names":["SqlGetUniqueFieldValuesImpl","knexClient","entryTableManager","storageTransformRegistry","storageModelProvider","pathRegistry","transformRegistry","filterCreateRegistry","sortingRegistry","valueFilterRegistry","model","params","field","f","items","listEntries","MAX_LIST_LIMIT","aggregateUniqueFieldValues","SqlGetUniqueFieldValues","GetUniqueFieldValuesStorageOperation","KnexClient","EntryTableManager","StorageTransformRegistry","CmsStorageModelProvider","FieldFilterPathRegistry","FieldFilterValueTransformRegistry","FieldFilterCreateRegistry","FieldSortingRegistry","ValueFilterRegistry"],"mappings":";;;;;;;;AAoBA,MAAMA;IAGF,YACIC,UAAgC,EACfC,iBAA8C,EAC9CC,wBAA4D,EAC5DC,oBAAuD,EACvDC,YAA+C,EAC/CC,iBAA8D,EAC9DC,oBAAyD,EACzDC,eAA+C,EAC/CC,mBAAkD,CACrE;aARmBP,iBAAiB,GAAjBA;aACAC,wBAAwB,GAAxBA;aACAC,oBAAoB,GAApBA;aACAC,YAAY,GAAZA;aACAC,iBAAiB,GAAjBA;aACAC,oBAAoB,GAApBA;aACAC,eAAe,GAAfA;aACAC,mBAAmB,GAAnBA;QAEjB,IAAI,CAAC,IAAI,GAAGR,WAAW,MAAM;IACjC;IAEA,MAAM,QAAQS,KAAe,EAAEC,MAA2D,EAAE;QACxF,MAAMC,QAAQF,MAAM,MAAM,CAAC,IAAI,CAACG,CAAAA,IAAKA,EAAE,OAAO,KAAKF,OAAO,OAAO;QAEjE,IAAI,CAACC,OACD,OAAO,EAAE;QAGb,MAAM,IAAI,CAAC,iBAAiB,CAAC,WAAW;QAExC,MAAM,EAAEE,KAAK,EAAE,GAAG,MAAMC,YACpB;YACI,MAAM,IAAI,CAAC,IAAI;YACf,WAAW,IAAI,CAAC,iBAAiB,CAAC,YAAY;YAC9C,sBAAsB,IAAI,CAAC,oBAAoB;YAC/C,0BAA0B,IAAI,CAAC,wBAAwB;YACvD,cAAc,IAAI,CAAC,YAAY;YAC/B,mBAAmB,IAAI,CAAC,iBAAiB;YACzC,sBAAsB,IAAI,CAAC,oBAAoB;YAC/C,iBAAiB,IAAI,CAAC,eAAe;YACrC,qBAAqB,IAAI,CAAC,mBAAmB;QACjD,GACAL,OACA;YACI,OAAOC,OAAO,KAAK;YACnB,OAAOK;QACX;QAGJ,OAAOC,2BAA2BH,OAAOF,MAAM,OAAO;IAC1D;AACJ;AAEO,MAAMM,0BAA0BC,qCAAqC,oBAAoB,CAAC;IAC7F,gBAAgBnB;IAChB,cAAc;QACVoB;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;KACH;AACL"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { CmsEntryStorageOperationsListParams, CmsEntryValues, CmsModel } from "@webiny/api-headless-cms/types/index.js";
|
|
2
|
-
import { ListEntriesStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/ListEntriesStorageOperation.js";
|
|
3
|
-
import { KnexClient } from "@webiny/api-core-sql";
|
|
4
|
-
import { EntryTableManager } from "../../features/entryTableManager/abstractions.js";
|
|
5
|
-
import { StorageTransformRegistry } from "@webiny/api-headless-cms/exports/api/cms/storage.js";
|
|
6
|
-
import { CmsStorageModelProvider } from "@webiny/api-headless-cms/features/shared/abstractions.js";
|
|
7
|
-
import { ValueFilterRegistry } from "@webiny/db-utils";
|
|
8
|
-
import { FieldFilterPathRegistry, FieldFilterValueTransformRegistry, FieldFilterCreateRegistry, FieldSortingRegistry } from "@webiny/api-headless-cms-storage";
|
|
9
|
-
declare class SqlListEntriesImpl implements ListEntriesStorageOperation.Interface {
|
|
10
|
-
private readonly entryTableManager;
|
|
11
|
-
private readonly storageTransformRegistry;
|
|
12
|
-
private readonly storageModelProvider;
|
|
13
|
-
private readonly pathRegistry;
|
|
14
|
-
private readonly transformRegistry;
|
|
15
|
-
private readonly filterCreateRegistry;
|
|
16
|
-
private readonly sortingRegistry;
|
|
17
|
-
private readonly valueFilterRegistry;
|
|
18
|
-
private readonly knex;
|
|
19
|
-
constructor(knexClient: KnexClient.Interface, entryTableManager: EntryTableManager.Interface, storageTransformRegistry: StorageTransformRegistry.Interface, storageModelProvider: CmsStorageModelProvider.Interface, pathRegistry: FieldFilterPathRegistry.Interface, transformRegistry: FieldFilterValueTransformRegistry.Interface, filterCreateRegistry: FieldFilterCreateRegistry.Interface, sortingRegistry: FieldSortingRegistry.Interface, valueFilterRegistry: ValueFilterRegistry.Interface);
|
|
20
|
-
execute<T extends CmsEntryValues = CmsEntryValues>(model: CmsModel, params: CmsEntryStorageOperationsListParams): Promise<import("@webiny/api-headless-cms/types/types.js").CmsEntryStorageOperationsListResponse<import("@webiny/api-headless-cms/types/types.js").CmsEntry<T>>>;
|
|
21
|
-
}
|
|
22
|
-
export declare const SqlListEntries: typeof SqlListEntriesImpl & {
|
|
23
|
-
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-headless-cms/features/shared/storageOperations/entry/ListEntriesStorageOperation.js").IListEntriesStorageOperation>;
|
|
24
|
-
};
|
|
25
|
-
export {};
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { ListEntriesStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/ListEntriesStorageOperation.js";
|
|
2
|
-
import { KnexClient } from "@webiny/api-core-sql";
|
|
3
|
-
import { EntryTableManager } from "../../features/entryTableManager/abstractions.js";
|
|
4
|
-
import { StorageTransformRegistry } from "@webiny/api-headless-cms/exports/api/cms/storage.js";
|
|
5
|
-
import { CmsStorageModelProvider } from "@webiny/api-headless-cms/features/shared/abstractions.js";
|
|
6
|
-
import { ValueFilterRegistry } from "@webiny/db-utils";
|
|
7
|
-
import { FieldFilterCreateRegistry, FieldFilterPathRegistry, FieldFilterValueTransformRegistry, FieldSortingRegistry } from "@webiny/api-headless-cms-storage";
|
|
8
|
-
import { listEntries } from "./queryHelpers.js";
|
|
9
|
-
class SqlListEntriesImpl {
|
|
10
|
-
constructor(knexClient, entryTableManager, storageTransformRegistry, storageModelProvider, pathRegistry, transformRegistry, filterCreateRegistry, sortingRegistry, valueFilterRegistry){
|
|
11
|
-
this.entryTableManager = entryTableManager;
|
|
12
|
-
this.storageTransformRegistry = storageTransformRegistry;
|
|
13
|
-
this.storageModelProvider = storageModelProvider;
|
|
14
|
-
this.pathRegistry = pathRegistry;
|
|
15
|
-
this.transformRegistry = transformRegistry;
|
|
16
|
-
this.filterCreateRegistry = filterCreateRegistry;
|
|
17
|
-
this.sortingRegistry = sortingRegistry;
|
|
18
|
-
this.valueFilterRegistry = valueFilterRegistry;
|
|
19
|
-
this.knex = knexClient.client;
|
|
20
|
-
}
|
|
21
|
-
async execute(model, params) {
|
|
22
|
-
await this.entryTableManager.ensureTable();
|
|
23
|
-
return listEntries({
|
|
24
|
-
knex: this.knex,
|
|
25
|
-
tableName: this.entryTableManager.getTableName(),
|
|
26
|
-
storageModelProvider: this.storageModelProvider,
|
|
27
|
-
storageTransformRegistry: this.storageTransformRegistry,
|
|
28
|
-
pathRegistry: this.pathRegistry,
|
|
29
|
-
transformRegistry: this.transformRegistry,
|
|
30
|
-
filterCreateRegistry: this.filterCreateRegistry,
|
|
31
|
-
sortingRegistry: this.sortingRegistry,
|
|
32
|
-
valueFilterRegistry: this.valueFilterRegistry
|
|
33
|
-
}, model, params);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
const SqlListEntries = ListEntriesStorageOperation.createImplementation({
|
|
37
|
-
implementation: SqlListEntriesImpl,
|
|
38
|
-
dependencies: [
|
|
39
|
-
KnexClient,
|
|
40
|
-
EntryTableManager,
|
|
41
|
-
StorageTransformRegistry,
|
|
42
|
-
CmsStorageModelProvider,
|
|
43
|
-
FieldFilterPathRegistry,
|
|
44
|
-
FieldFilterValueTransformRegistry,
|
|
45
|
-
FieldFilterCreateRegistry,
|
|
46
|
-
FieldSortingRegistry,
|
|
47
|
-
ValueFilterRegistry
|
|
48
|
-
]
|
|
49
|
-
});
|
|
50
|
-
export { SqlListEntries };
|
|
51
|
-
|
|
52
|
-
//# sourceMappingURL=SqlListEntries.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"operations/entry/SqlListEntries.js","sources":["../../../src/operations/entry/SqlListEntries.ts"],"sourcesContent":["import type { Knex } from \"knex\";\nimport type {\n CmsEntryStorageOperationsListParams,\n CmsEntryValues,\n CmsModel\n} from \"@webiny/api-headless-cms/types/index.js\";\nimport { ListEntriesStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/entry/ListEntriesStorageOperation.js\";\nimport { KnexClient } from \"@webiny/api-core-sql\";\nimport { EntryTableManager } from \"~/features/entryTableManager/abstractions.js\";\nimport { StorageTransformRegistry } from \"@webiny/api-headless-cms/exports/api/cms/storage.js\";\nimport { CmsStorageModelProvider } from \"@webiny/api-headless-cms/features/shared/abstractions.js\";\nimport { ValueFilterRegistry } from \"@webiny/db-utils\";\nimport {\n FieldFilterPathRegistry,\n FieldFilterValueTransformRegistry,\n FieldFilterCreateRegistry,\n FieldSortingRegistry\n} from \"@webiny/api-headless-cms-storage\";\nimport { listEntries } from \"./queryHelpers.js\";\n\nclass SqlListEntriesImpl implements ListEntriesStorageOperation.Interface {\n private readonly knex: Knex;\n\n public constructor(\n knexClient: KnexClient.Interface,\n private readonly entryTableManager: EntryTableManager.Interface,\n private readonly storageTransformRegistry: StorageTransformRegistry.Interface,\n private readonly storageModelProvider: CmsStorageModelProvider.Interface,\n private readonly pathRegistry: FieldFilterPathRegistry.Interface,\n private readonly transformRegistry: FieldFilterValueTransformRegistry.Interface,\n private readonly filterCreateRegistry: FieldFilterCreateRegistry.Interface,\n private readonly sortingRegistry: FieldSortingRegistry.Interface,\n private readonly valueFilterRegistry: ValueFilterRegistry.Interface\n ) {\n this.knex = knexClient.client;\n }\n\n async execute<T extends CmsEntryValues = CmsEntryValues>(\n model: CmsModel,\n params: CmsEntryStorageOperationsListParams\n ) {\n await this.entryTableManager.ensureTable();\n\n return listEntries<T>(\n {\n knex: this.knex,\n tableName: this.entryTableManager.getTableName(),\n storageModelProvider: this.storageModelProvider,\n storageTransformRegistry: this.storageTransformRegistry,\n pathRegistry: this.pathRegistry,\n transformRegistry: this.transformRegistry,\n filterCreateRegistry: this.filterCreateRegistry,\n sortingRegistry: this.sortingRegistry,\n valueFilterRegistry: this.valueFilterRegistry\n },\n model,\n params\n );\n }\n}\n\nexport const SqlListEntries = ListEntriesStorageOperation.createImplementation({\n implementation: SqlListEntriesImpl,\n dependencies: [\n KnexClient,\n EntryTableManager,\n StorageTransformRegistry,\n CmsStorageModelProvider,\n FieldFilterPathRegistry,\n FieldFilterValueTransformRegistry,\n FieldFilterCreateRegistry,\n FieldSortingRegistry,\n ValueFilterRegistry\n ]\n});\n"],"names":["SqlListEntriesImpl","knexClient","entryTableManager","storageTransformRegistry","storageModelProvider","pathRegistry","transformRegistry","filterCreateRegistry","sortingRegistry","valueFilterRegistry","model","params","listEntries","SqlListEntries","ListEntriesStorageOperation","KnexClient","EntryTableManager","StorageTransformRegistry","CmsStorageModelProvider","FieldFilterPathRegistry","FieldFilterValueTransformRegistry","FieldFilterCreateRegistry","FieldSortingRegistry","ValueFilterRegistry"],"mappings":";;;;;;;;AAoBA,MAAMA;IAGF,YACIC,UAAgC,EACfC,iBAA8C,EAC9CC,wBAA4D,EAC5DC,oBAAuD,EACvDC,YAA+C,EAC/CC,iBAA8D,EAC9DC,oBAAyD,EACzDC,eAA+C,EAC/CC,mBAAkD,CACrE;aARmBP,iBAAiB,GAAjBA;aACAC,wBAAwB,GAAxBA;aACAC,oBAAoB,GAApBA;aACAC,YAAY,GAAZA;aACAC,iBAAiB,GAAjBA;aACAC,oBAAoB,GAApBA;aACAC,eAAe,GAAfA;aACAC,mBAAmB,GAAnBA;QAEjB,IAAI,CAAC,IAAI,GAAGR,WAAW,MAAM;IACjC;IAEA,MAAM,QACFS,KAAe,EACfC,MAA2C,EAC7C;QACE,MAAM,IAAI,CAAC,iBAAiB,CAAC,WAAW;QAExC,OAAOC,YACH;YACI,MAAM,IAAI,CAAC,IAAI;YACf,WAAW,IAAI,CAAC,iBAAiB,CAAC,YAAY;YAC9C,sBAAsB,IAAI,CAAC,oBAAoB;YAC/C,0BAA0B,IAAI,CAAC,wBAAwB;YACvD,cAAc,IAAI,CAAC,YAAY;YAC/B,mBAAmB,IAAI,CAAC,iBAAiB;YACzC,sBAAsB,IAAI,CAAC,oBAAoB;YAC/C,iBAAiB,IAAI,CAAC,eAAe;YACrC,qBAAqB,IAAI,CAAC,mBAAmB;QACjD,GACAF,OACAC;IAER;AACJ;AAEO,MAAME,iBAAiBC,4BAA4B,oBAAoB,CAAC;IAC3E,gBAAgBd;IAChB,cAAc;QACVe;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;KACH;AACL"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { CmsModel } from "@webiny/api-headless-cms/types/index.js";
|
|
2
|
-
import { MoveEntryStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/MoveEntryStorageOperation.js";
|
|
3
|
-
import { KnexClient } from "@webiny/api-core-sql";
|
|
4
|
-
import { EntryTableManager } from "../../features/entryTableManager/abstractions.js";
|
|
5
|
-
declare class SqlMoveEntryImpl implements MoveEntryStorageOperation.Interface {
|
|
6
|
-
private readonly entryTableManager;
|
|
7
|
-
private readonly knex;
|
|
8
|
-
constructor(knexClient: KnexClient.Interface, entryTableManager: EntryTableManager.Interface);
|
|
9
|
-
execute(model: CmsModel, id: string, folderId: string): Promise<void>;
|
|
10
|
-
}
|
|
11
|
-
export declare const SqlMoveEntry: typeof SqlMoveEntryImpl & {
|
|
12
|
-
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-headless-cms/features/shared/storageOperations/entry/MoveEntryStorageOperation.js").IMoveEntryStorageOperation>;
|
|
13
|
-
};
|
|
14
|
-
export {};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { MoveEntryStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/MoveEntryStorageOperation.js";
|
|
2
|
-
import { KnexClient } from "@webiny/api-core-sql";
|
|
3
|
-
import { EntryTableManager } from "../../features/entryTableManager/abstractions.js";
|
|
4
|
-
import { parseIdentifier } from "@webiny/utils";
|
|
5
|
-
import { patchAllEntryRevisions } from "./queryHelpers.js";
|
|
6
|
-
class SqlMoveEntryImpl {
|
|
7
|
-
constructor(knexClient, entryTableManager){
|
|
8
|
-
this.entryTableManager = entryTableManager;
|
|
9
|
-
this.knex = knexClient.client;
|
|
10
|
-
}
|
|
11
|
-
async execute(model, id, folderId) {
|
|
12
|
-
await this.entryTableManager.ensureTable();
|
|
13
|
-
const { id: entryId } = parseIdentifier(id);
|
|
14
|
-
await patchAllEntryRevisions(this.knex, this.entryTableManager.getTableName(), entryId, model.tenant, (parsed)=>{
|
|
15
|
-
parsed.location = {
|
|
16
|
-
folderId
|
|
17
|
-
};
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
const SqlMoveEntry = MoveEntryStorageOperation.createImplementation({
|
|
22
|
-
implementation: SqlMoveEntryImpl,
|
|
23
|
-
dependencies: [
|
|
24
|
-
KnexClient,
|
|
25
|
-
EntryTableManager
|
|
26
|
-
]
|
|
27
|
-
});
|
|
28
|
-
export { SqlMoveEntry };
|
|
29
|
-
|
|
30
|
-
//# sourceMappingURL=SqlMoveEntry.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"operations/entry/SqlMoveEntry.js","sources":["../../../src/operations/entry/SqlMoveEntry.ts"],"sourcesContent":["import type { Knex } from \"knex\";\nimport type { CmsModel } from \"@webiny/api-headless-cms/types/index.js\";\nimport { MoveEntryStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/entry/MoveEntryStorageOperation.js\";\nimport { KnexClient } from \"@webiny/api-core-sql\";\nimport { EntryTableManager } from \"~/features/entryTableManager/abstractions.js\";\nimport { parseIdentifier } from \"@webiny/utils\";\nimport { patchAllEntryRevisions } from \"./queryHelpers.js\";\n\nclass SqlMoveEntryImpl implements MoveEntryStorageOperation.Interface {\n private readonly knex: Knex;\n\n public constructor(\n knexClient: KnexClient.Interface,\n private readonly entryTableManager: EntryTableManager.Interface\n ) {\n this.knex = knexClient.client;\n }\n\n async execute(model: CmsModel, id: string, folderId: string) {\n await this.entryTableManager.ensureTable();\n\n const { id: entryId } = parseIdentifier(id);\n\n await patchAllEntryRevisions(\n this.knex,\n this.entryTableManager.getTableName(),\n entryId,\n model.tenant,\n parsed => {\n parsed.location = { folderId };\n }\n );\n }\n}\n\nexport const SqlMoveEntry = MoveEntryStorageOperation.createImplementation({\n implementation: SqlMoveEntryImpl,\n dependencies: [KnexClient, EntryTableManager]\n});\n"],"names":["SqlMoveEntryImpl","knexClient","entryTableManager","model","id","folderId","entryId","parseIdentifier","patchAllEntryRevisions","parsed","SqlMoveEntry","MoveEntryStorageOperation","KnexClient","EntryTableManager"],"mappings":";;;;;AAQA,MAAMA;IAGF,YACIC,UAAgC,EACfC,iBAA8C,CACjE;aADmBA,iBAAiB,GAAjBA;QAEjB,IAAI,CAAC,IAAI,GAAGD,WAAW,MAAM;IACjC;IAEA,MAAM,QAAQE,KAAe,EAAEC,EAAU,EAAEC,QAAgB,EAAE;QACzD,MAAM,IAAI,CAAC,iBAAiB,CAAC,WAAW;QAExC,MAAM,EAAE,IAAIC,OAAO,EAAE,GAAGC,gBAAgBH;QAExC,MAAMI,uBACF,IAAI,CAAC,IAAI,EACT,IAAI,CAAC,iBAAiB,CAAC,YAAY,IACnCF,SACAH,MAAM,MAAM,EACZM,CAAAA;YACIA,OAAO,QAAQ,GAAG;gBAAEJ;YAAS;QACjC;IAER;AACJ;AAEO,MAAMK,eAAeC,0BAA0B,oBAAoB,CAAC;IACvE,gBAAgBX;IAChB,cAAc;QAACY;QAAYC;KAAkB;AACjD"}
|