@shopware-ag/app-server-sdk 1.1.15 → 1.1.17
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/dist/commonjs/helper/admin-api.d.ts +27 -3
- package/dist/commonjs/helper/admin-api.d.ts.map +1 -1
- package/dist/commonjs/helper/admin-api.js +24 -0
- package/dist/commonjs/helper/admin-api.js.map +1 -1
- package/dist/commonjs/helper/criteria.d.ts +19 -3
- package/dist/commonjs/helper/criteria.d.ts.map +1 -1
- package/dist/commonjs/helper/criteria.js +2 -9
- package/dist/commonjs/helper/criteria.js.map +1 -1
- package/dist/commonjs/integration/dynamodb.d.ts.map +1 -1
- package/dist/commonjs/integration/dynamodb.js +12 -8
- package/dist/commonjs/integration/dynamodb.js.map +1 -1
- package/dist/commonjs/integration/hono.d.ts +1 -1
- package/dist/commonjs/integration/hono.d.ts.map +1 -1
- package/dist/commonjs/integration/hono.js +4 -0
- package/dist/commonjs/integration/hono.js.map +1 -1
- package/dist/commonjs/registration.d.ts +3 -3
- package/dist/commonjs/registration.d.ts.map +1 -1
- package/dist/commonjs/registration.js +8 -7
- package/dist/commonjs/registration.js.map +1 -1
- package/dist/esm/helper/admin-api.d.ts +27 -3
- package/dist/esm/helper/admin-api.d.ts.map +1 -1
- package/dist/esm/helper/admin-api.js +24 -0
- package/dist/esm/helper/admin-api.js.map +1 -1
- package/dist/esm/helper/criteria.d.ts +19 -3
- package/dist/esm/helper/criteria.d.ts.map +1 -1
- package/dist/esm/helper/criteria.js +2 -9
- package/dist/esm/helper/criteria.js.map +1 -1
- package/dist/esm/integration/dynamodb.d.ts.map +1 -1
- package/dist/esm/integration/dynamodb.js +13 -9
- package/dist/esm/integration/dynamodb.js.map +1 -1
- package/dist/esm/integration/hono.d.ts +1 -1
- package/dist/esm/integration/hono.d.ts.map +1 -1
- package/dist/esm/integration/hono.js +4 -0
- package/dist/esm/integration/hono.js.map +1 -1
- package/dist/esm/registration.d.ts +3 -3
- package/dist/esm/registration.d.ts.map +1 -1
- package/dist/esm/registration.js +8 -7
- package/dist/esm/registration.js.map +1 -1
- package/package.json +1 -1
|
@@ -15,9 +15,21 @@ export declare class EntityRepository<Entity extends object = object> {
|
|
|
15
15
|
private client;
|
|
16
16
|
private entityName;
|
|
17
17
|
constructor(client: HttpClient, entityName: string);
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
/**
|
|
19
|
+
* Search for entities with the given criteria
|
|
20
|
+
*
|
|
21
|
+
* When using Criteria<T>, the returned entities will have type-safe associations
|
|
22
|
+
* based on which associations were added to the criteria.
|
|
23
|
+
*/
|
|
24
|
+
search<T extends Entity, Aggregations = object>(criteria: Criteria<T>, context?: ApiContext): Promise<EntitySearchResult<T, Aggregations>>;
|
|
25
|
+
/**
|
|
26
|
+
* Search for entity IDs with the given criteria
|
|
27
|
+
*/
|
|
28
|
+
searchIds(criteria: Criteria<Entity>, context?: ApiContext): Promise<string[]>;
|
|
29
|
+
/**
|
|
30
|
+
* Aggregate entities with the given criteria
|
|
31
|
+
*/
|
|
32
|
+
aggregate<Aggregations>(criteria: Criteria<Entity>, context?: ApiContext): Promise<EntitySearchResult<object, Aggregations>>;
|
|
21
33
|
upsert(payload: Entity[], context?: ApiContext): Promise<void>;
|
|
22
34
|
delete<DeleteType extends object = {
|
|
23
35
|
id: string;
|
|
@@ -37,11 +49,23 @@ export declare class SyncOperation {
|
|
|
37
49
|
criteria: SingleFilter[] | null;
|
|
38
50
|
constructor(key: string, entity: string, action: "upsert" | "delete", payload: object[], criteria?: SingleFilter[] | null);
|
|
39
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
* Result of an entity search operation
|
|
54
|
+
*
|
|
55
|
+
* Contains the search results with proper typing for associated entities
|
|
56
|
+
* when used with the enhanced Criteria<T> class.
|
|
57
|
+
*/
|
|
40
58
|
export declare class EntitySearchResult<Entity = unknown, Aggregations = object> {
|
|
41
59
|
total: number;
|
|
42
60
|
aggregations: Aggregations;
|
|
43
61
|
data: Entity[];
|
|
44
62
|
constructor(total: number, aggregations: Aggregations, data: Entity[]);
|
|
63
|
+
/**
|
|
64
|
+
* Get the first result or null if no results
|
|
65
|
+
*
|
|
66
|
+
* The returned entity will be properly typed with all associations
|
|
67
|
+
* that were added to the criteria.
|
|
68
|
+
*/
|
|
45
69
|
first(): Entity | null;
|
|
46
70
|
}
|
|
47
71
|
export declare const Defaults: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin-api.d.ts","sourceRoot":"","sources":["../../../src/helper/admin-api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAElD,qBAAa,UAAU;IACtB,OAAO,CAAC,UAAU,CAAgB;IAClC,WAAW,EAAE,OAAO,GAAG,IAAI,CAAC;IAC5B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,gBAAgB,EAAE,OAAO,GAAG,IAAI,CAAC;IACjC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;gBAGhC,UAAU,GAAE,MAAM,GAAG,IAAW,EAChC,WAAW,GAAE,OAAO,GAAG,IAAW,EAClC,SAAS,GAAE,MAAM,GAAG,IAAW,EAC/B,gBAAgB,GAAE,OAAO,GAAG,IAAW,EACvC,YAAY,GAAE,MAAM,GAAG,IAAW,EAClC,iBAAiB,GAAE,MAAM,GAAG,IAAW;IAUxC,SAAS,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;CAqBnC;AAED,qBAAa,gBAAgB,CAAC,MAAM,SAAS,MAAM,GAAG,MAAM;IAE1D,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,UAAU;gBADV,MAAM,EAAE,UAAU,EAClB,UAAU,EAA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KAAK,EAAE,MAAM;IACb,YAAY,EAAE,YAAY;IAC1B,IAAI,EAAE,MAAM,EAAE;gBAFd,KAAK,EAAE,MAAM,EACb,YAAY,EAAE,YAAY,EAC1B,IAAI,EAAE,MAAM,EAAE;IAOtB;;;;;OAKG;IACH,KAAK,IAAI,MAAM,GAAG,IAAI;CAGtB;AAED,eAAO,MAAM,QAAQ;;;;;;;CAOpB,CAAC;AAEF,wBAAgB,IAAI,IAAI,MAAM,CAE7B"}
|
|
@@ -47,14 +47,26 @@ class EntityRepository {
|
|
|
47
47
|
this.client = client;
|
|
48
48
|
this.entityName = entityName;
|
|
49
49
|
}
|
|
50
|
+
/**
|
|
51
|
+
* Search for entities with the given criteria
|
|
52
|
+
*
|
|
53
|
+
* When using Criteria<T>, the returned entities will have type-safe associations
|
|
54
|
+
* based on which associations were added to the criteria.
|
|
55
|
+
*/
|
|
50
56
|
async search(criteria, context = new ApiContext()) {
|
|
51
57
|
const response = await this.client.post(`/search/${this.entityName.replaceAll("_", "-")}`, criteria.toPayload(), context.toHeaders());
|
|
52
58
|
return new EntitySearchResult(response.body.total, response.body.aggregations, response.body.data);
|
|
53
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* Search for entity IDs with the given criteria
|
|
62
|
+
*/
|
|
54
63
|
async searchIds(criteria, context = new ApiContext()) {
|
|
55
64
|
const response = await this.client.post(`/search-ids/${this.entityName.replaceAll("_", "-")}`, criteria.toPayload(), context.toHeaders());
|
|
56
65
|
return response.body.data;
|
|
57
66
|
}
|
|
67
|
+
/**
|
|
68
|
+
* Aggregate entities with the given criteria
|
|
69
|
+
*/
|
|
58
70
|
async aggregate(criteria, context = new ApiContext()) {
|
|
59
71
|
criteria.setLimit(1);
|
|
60
72
|
const response = await this.client.post(`/search/${this.entityName.replaceAll("_", "-")}`, criteria.toPayload(), context.toHeaders());
|
|
@@ -102,6 +114,12 @@ class SyncOperation {
|
|
|
102
114
|
}
|
|
103
115
|
}
|
|
104
116
|
exports.SyncOperation = SyncOperation;
|
|
117
|
+
/**
|
|
118
|
+
* Result of an entity search operation
|
|
119
|
+
*
|
|
120
|
+
* Contains the search results with proper typing for associated entities
|
|
121
|
+
* when used with the enhanced Criteria<T> class.
|
|
122
|
+
*/
|
|
105
123
|
class EntitySearchResult {
|
|
106
124
|
total;
|
|
107
125
|
aggregations;
|
|
@@ -114,6 +132,12 @@ class EntitySearchResult {
|
|
|
114
132
|
this.aggregations = aggregations;
|
|
115
133
|
this.data = data;
|
|
116
134
|
}
|
|
135
|
+
/**
|
|
136
|
+
* Get the first result or null if no results
|
|
137
|
+
*
|
|
138
|
+
* The returned entity will be properly typed with all associations
|
|
139
|
+
* that were added to the criteria.
|
|
140
|
+
*/
|
|
117
141
|
first() {
|
|
118
142
|
return this.data[0] || null;
|
|
119
143
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin-api.js","sourceRoot":"","sources":["../../../src/helper/admin-api.ts"],"names":[],"mappings":";;;AA8NA,oBAEC;AA5ND,MAAa,UAAU;IACd,UAAU,CAAgB;IAClC,WAAW,CAAiB;IAC5B,SAAS,CAAgB;IACzB,gBAAgB,CAAiB;IACjC,YAAY,CAAgB;IAC5B,iBAAiB,CAAgB;IAEjC,YACC,aAA4B,IAAI,EAChC,cAA8B,IAAI,EAClC,YAA2B,IAAI,EAC/B,mBAAmC,IAAI,EACvC,eAA8B,IAAI,EAClC,oBAAmC,IAAI;QAEvC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;QACzC,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;IAC5C,CAAC;IAED,SAAS;QACR,MAAM,OAAO,GAAG;YACf,gBAAgB,EAAE,IAAI,CAAC,UAA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EtB;IACA;IACA;IAHR,YACQ,KAAa,EACb,YAA0B,EAC1B,IAAc;QAFd,UAAK,GAAL,KAAK,CAAQ;QACb,iBAAY,GAAZ,YAAY,CAAc;QAC1B,SAAI,GAAJ,IAAI,CAAU;QAErB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IAClB,CAAC;IAED,KAAK;QACJ,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC;IAC7B,CAAC;CACD;AAdD,gDAcC;AAEY,QAAA,QAAQ,GAAG;IACvB,gBAAgB,EAAE,kCAAkC;IACpD,WAAW,EAAE,kCAAkC;IAC/C,gBAAgB,EAAE,kCAAkC;IACpD,mBAAmB,EAAE,kCAAkC;IACvD,4BAA4B,EAAE,kCAAkC;IAChE,kCAAkC,EAAE,kCAAkC;CACtE,CAAC;AAEF,SAAgB,IAAI;IACnB,OAAO,MAAM,CAAC,UAAU,EAAE,CAAC,UAAU,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;AAChD,CAAC","sourcesContent":["import type { HttpClient } from \"../http-client.js\";\nimport type { Criteria } from \"./criteria.js\";\nimport type { SingleFilter } from \"./criteria.js\";\n\nexport class ApiContext {\n\tprivate languageId: string | null;\n\tinheritance: boolean | null;\n\tversionId: string | null;\n\tskipTriggerFlows: boolean | null;\n\tindexingSkip: string | null;\n\tindexingBehaviour: string | null;\n\n\tconstructor(\n\t\tlanguageId: string | null = null,\n\t\tinheritance: boolean | null = null,\n\t\tversionId: string | null = null,\n\t\tskipTriggerFlows: boolean | null = null,\n\t\tindexingSkip: string | null = null,\n\t\tindexingBehaviour: string | null = null,\n\t) {\n\t\tthis.languageId = languageId;\n\t\tthis.inheritance = inheritance;\n\t\tthis.versionId = versionId;\n\t\tthis.skipTriggerFlows = skipTriggerFlows;\n\t\tthis.indexingSkip = indexingSkip;\n\t\tthis.indexingBehaviour = indexingBehaviour;\n\t}\n\n\ttoHeaders(): Record<string, string> {\n\t\tconst headers = {\n\t\t\t\"sw-language-id\": this.languageId,\n\t\t\t\"sw-inheritance\": this.inheritance === true ? \"1\" : \"0\",\n\t\t\t\"sw-version-id\": this.versionId,\n\t\t\t\"sw-skip-trigger-flow\": this.skipTriggerFlows === true ? \"1\" : \"0\",\n\t\t\t\"indexing-skip\": this.indexingSkip,\n\t\t\t\"indexing-behavior\": this.indexingBehaviour,\n\t\t};\n\n\t\tfor (const key of Object.keys(headers)) {\n\t\t\t// @ts-expect-error\n\t\t\tif (headers[key] === null) {\n\t\t\t\t// @ts-expect-error\n\t\t\t\tdelete headers[key];\n\t\t\t}\n\t\t}\n\n\t\t// @ts-expect-error\n\t\treturn headers;\n\t}\n}\n\nexport class EntityRepository<Entity extends object = object> {\n\tconstructor(\n\t\tprivate client: HttpClient,\n\t\tprivate entityName: string,\n\t) {\n\t\tthis.client = client;\n\t\tthis.entityName = entityName;\n\t}\n\n\tasync search<Aggregations = object>(\n\t\tcriteria: Criteria,\n\t\tcontext: ApiContext = new ApiContext(),\n\t): Promise<EntitySearchResult<Entity, Aggregations>> {\n\t\tconst response = await this.client.post<\n\t\t\tEntitySearchResponse<Entity, Aggregations>\n\t\t>(\n\t\t\t`/search/${this.entityName.replaceAll(\"_\", \"-\")}`,\n\t\t\tcriteria.toPayload(),\n\t\t\tcontext.toHeaders(),\n\t\t);\n\n\t\treturn new EntitySearchResult<Entity, Aggregations>(\n\t\t\tresponse.body.total,\n\t\t\tresponse.body.aggregations,\n\t\t\tresponse.body.data,\n\t\t);\n\t}\n\n\tasync searchIds(\n\t\tcriteria: Criteria,\n\t\tcontext: ApiContext = new ApiContext(),\n\t): Promise<string[]> {\n\t\tconst response = await this.client.post<{ data: string[] }>(\n\t\t\t`/search-ids/${this.entityName.replaceAll(\"_\", \"-\")}`,\n\t\t\tcriteria.toPayload(),\n\t\t\tcontext.toHeaders(),\n\t\t);\n\n\t\treturn response.body.data;\n\t}\n\n\tasync aggregate<Aggregations>(\n\t\tcriteria: Criteria,\n\t\tcontext: ApiContext = new ApiContext(),\n\t): Promise<EntitySearchResult<object, Aggregations>> {\n\t\tcriteria.setLimit(1);\n\n\t\tconst response = await this.client.post<\n\t\t\tEntitySearchResponse<object, Aggregations>\n\t\t>(\n\t\t\t`/search/${this.entityName.replaceAll(\"_\", \"-\")}`,\n\t\t\tcriteria.toPayload(),\n\t\t\tcontext.toHeaders(),\n\t\t);\n\n\t\treturn new EntitySearchResult<object, Aggregations>(\n\t\t\tresponse.body.total,\n\t\t\tresponse.body.aggregations,\n\t\t\tresponse.body.data,\n\t\t);\n\t}\n\n\tasync upsert(\n\t\tpayload: Entity[],\n\t\tcontext: ApiContext = new ApiContext(),\n\t): Promise<void> {\n\t\tawait new SyncService(this.client).sync(\n\t\t\t[\n\t\t\t\tnew SyncOperation(\n\t\t\t\t\t\"upsert\",\n\t\t\t\t\tthis.entityName.replaceAll(\"-\", \"_\"),\n\t\t\t\t\t\"upsert\",\n\t\t\t\t\tpayload,\n\t\t\t\t),\n\t\t\t],\n\t\t\tcontext,\n\t\t);\n\t}\n\n\tasync delete<DeleteType extends object = { id: string }>(\n\t\tpayload: DeleteType[],\n\t\tcontext: ApiContext = new ApiContext(),\n\t): Promise<void> {\n\t\tawait new SyncService(this.client).sync(\n\t\t\t[\n\t\t\t\tnew SyncOperation(\n\t\t\t\t\t\"delete\",\n\t\t\t\t\tthis.entityName.replaceAll(\"-\", \"_\"),\n\t\t\t\t\t\"delete\",\n\t\t\t\t\tpayload,\n\t\t\t\t),\n\t\t\t],\n\t\t\tcontext,\n\t\t);\n\t}\n\n\tasync deleteByFilters(\n\t\tfilters: SingleFilter[],\n\t\tcontext: ApiContext = new ApiContext(),\n\t): Promise<void> {\n\t\tawait new SyncService(this.client).sync(\n\t\t\t[\n\t\t\t\tnew SyncOperation(\n\t\t\t\t\t\"delete\",\n\t\t\t\t\tthis.entityName.replaceAll(\"-\", \"_\"),\n\t\t\t\t\t\"delete\",\n\t\t\t\t\t[],\n\t\t\t\t\tfilters,\n\t\t\t\t),\n\t\t\t],\n\t\t\tcontext,\n\t\t);\n\t}\n}\n\nexport class SyncService {\n\tconstructor(private client: HttpClient) {}\n\n\tasync sync(\n\t\toperations: SyncOperation[],\n\t\tcontext: ApiContext = new ApiContext(),\n\t): Promise<void> {\n\t\tawait this.client.post<{ notFound: string[]; deleted: string[] }>(\n\t\t\t\"/_action/sync\",\n\t\t\toperations,\n\t\t\tcontext.toHeaders(),\n\t\t);\n\t}\n}\n\nexport class SyncOperation {\n\tconstructor(\n\t\tpublic key: string,\n\t\tpublic entity: string,\n\t\tpublic action: \"upsert\" | \"delete\",\n\t\tpublic payload: object[],\n\t\tpublic criteria: SingleFilter[] | null = null,\n\t) {}\n}\n\ntype EntitySearchResponse<Entity = unknown, Aggregations = object> = {\n\ttotal: number;\n\taggregations: Aggregations;\n\tdata: Entity[];\n};\n\nexport class EntitySearchResult<Entity = unknown, Aggregations = object> {\n\tconstructor(\n\t\tpublic total: number,\n\t\tpublic aggregations: Aggregations,\n\t\tpublic data: Entity[],\n\t) {\n\t\tthis.total = total;\n\t\tthis.aggregations = aggregations;\n\t\tthis.data = data;\n\t}\n\n\tfirst(): Entity | null {\n\t\treturn this.data[0] || null;\n\t}\n}\n\nexport const Defaults = {\n\tsystemLanguageId: \"2fbb5fe2e29a4d70aa5854ce7ce3e20b\",\n\tliveVersion: \"0fa91ce3e96a4bc2be4bd9ce752c3425\",\n\tsystemCurrencyId: \"b7d2554b0ce847cd82f3ac9bd1c0dfca\",\n\tsalesChannelTypeApi: \"f183ee5650cf4bdb8a774337575067a6\",\n\tsalesChannelTypeSalesChannel: \"8a243080f92e4c719546314b577cf82b\",\n\tsalesChannelTypeProductComparision: \"ed535e5722134ac1aa6524f73e26881b\",\n};\n\nexport function uuid(): string {\n\treturn crypto.randomUUID().replaceAll(\"-\", \"\");\n}\n"]}
|
|
1
|
+
{"version":3,"file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AAE,kCAAkC;IAC/C,gBAAgB,EAAE,kCAAkC;IACpD,mBAAmB,EAAE,kCAAkC;IACvD,4BAA4B,EAAE,kCAAkC;IAChE,kCAAkC,EAAE,kCAAkC;CACtE,CAAC;AAEF,SAAgB,IAAI;IACnB,OAAO,MAAM,CAAC,UAAU,EAAE,CAAC,UAAU,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;AAChD,CAAC","sourcesContent":["import type { HttpClient } from \"../http-client.js\";\nimport type { Criteria } from \"./criteria.js\";\nimport type { SingleFilter } from \"./criteria.js\";\n\nexport class ApiContext {\n\tprivate languageId: string | null;\n\tinheritance: boolean | null;\n\tversionId: string | null;\n\tskipTriggerFlows: boolean | null;\n\tindexingSkip: string | null;\n\tindexingBehaviour: string | null;\n\n\tconstructor(\n\t\tlanguageId: string | null = null,\n\t\tinheritance: boolean | null = null,\n\t\tversionId: string | null = null,\n\t\tskipTriggerFlows: boolean | null = null,\n\t\tindexingSkip: string | null = null,\n\t\tindexingBehaviour: string | null = null,\n\t) {\n\t\tthis.languageId = languageId;\n\t\tthis.inheritance = inheritance;\n\t\tthis.versionId = versionId;\n\t\tthis.skipTriggerFlows = skipTriggerFlows;\n\t\tthis.indexingSkip = indexingSkip;\n\t\tthis.indexingBehaviour = indexingBehaviour;\n\t}\n\n\ttoHeaders(): Record<string, string> {\n\t\tconst headers = {\n\t\t\t\"sw-language-id\": this.languageId,\n\t\t\t\"sw-inheritance\": this.inheritance === true ? \"1\" : \"0\",\n\t\t\t\"sw-version-id\": this.versionId,\n\t\t\t\"sw-skip-trigger-flow\": this.skipTriggerFlows === true ? \"1\" : \"0\",\n\t\t\t\"indexing-skip\": this.indexingSkip,\n\t\t\t\"indexing-behavior\": this.indexingBehaviour,\n\t\t};\n\n\t\tfor (const key of Object.keys(headers)) {\n\t\t\t// @ts-expect-error\n\t\t\tif (headers[key] === null) {\n\t\t\t\t// @ts-expect-error\n\t\t\t\tdelete headers[key];\n\t\t\t}\n\t\t}\n\n\t\t// @ts-expect-error\n\t\treturn headers;\n\t}\n}\n\nexport class EntityRepository<Entity extends object = object> {\n\tconstructor(\n\t\tprivate client: HttpClient,\n\t\tprivate entityName: string,\n\t) {\n\t\tthis.client = client;\n\t\tthis.entityName = entityName;\n\t}\n\n\t/**\n\t * Search for entities with the given criteria\n\t *\n\t * When using Criteria<T>, the returned entities will have type-safe associations\n\t * based on which associations were added to the criteria.\n\t */\n\tasync search<T extends Entity, Aggregations = object>(\n\t\tcriteria: Criteria<T>,\n\t\tcontext: ApiContext = new ApiContext(),\n\t): Promise<EntitySearchResult<T, Aggregations>> {\n\t\tconst response = await this.client.post<\n\t\t\tEntitySearchResponse<T, Aggregations>\n\t\t>(\n\t\t\t`/search/${this.entityName.replaceAll(\"_\", \"-\")}`,\n\t\t\tcriteria.toPayload(),\n\t\t\tcontext.toHeaders(),\n\t\t);\n\n\t\treturn new EntitySearchResult<T, Aggregations>(\n\t\t\tresponse.body.total,\n\t\t\tresponse.body.aggregations,\n\t\t\tresponse.body.data,\n\t\t);\n\t}\n\n\t/**\n\t * Search for entity IDs with the given criteria\n\t */\n\tasync searchIds(\n\t\tcriteria: Criteria<Entity>,\n\t\tcontext: ApiContext = new ApiContext(),\n\t): Promise<string[]> {\n\t\tconst response = await this.client.post<{ data: string[] }>(\n\t\t\t`/search-ids/${this.entityName.replaceAll(\"_\", \"-\")}`,\n\t\t\tcriteria.toPayload(),\n\t\t\tcontext.toHeaders(),\n\t\t);\n\n\t\treturn response.body.data;\n\t}\n\n\t/**\n\t * Aggregate entities with the given criteria\n\t */\n\tasync aggregate<Aggregations>(\n\t\tcriteria: Criteria<Entity>,\n\t\tcontext: ApiContext = new ApiContext(),\n\t): Promise<EntitySearchResult<object, Aggregations>> {\n\t\tcriteria.setLimit(1);\n\n\t\tconst response = await this.client.post<\n\t\t\tEntitySearchResponse<object, Aggregations>\n\t\t>(\n\t\t\t`/search/${this.entityName.replaceAll(\"_\", \"-\")}`,\n\t\t\tcriteria.toPayload(),\n\t\t\tcontext.toHeaders(),\n\t\t);\n\n\t\treturn new EntitySearchResult<object, Aggregations>(\n\t\t\tresponse.body.total,\n\t\t\tresponse.body.aggregations,\n\t\t\tresponse.body.data,\n\t\t);\n\t}\n\n\tasync upsert(\n\t\tpayload: Entity[],\n\t\tcontext: ApiContext = new ApiContext(),\n\t): Promise<void> {\n\t\tawait new SyncService(this.client).sync(\n\t\t\t[\n\t\t\t\tnew SyncOperation(\n\t\t\t\t\t\"upsert\",\n\t\t\t\t\tthis.entityName.replaceAll(\"-\", \"_\"),\n\t\t\t\t\t\"upsert\",\n\t\t\t\t\tpayload,\n\t\t\t\t),\n\t\t\t],\n\t\t\tcontext,\n\t\t);\n\t}\n\n\tasync delete<DeleteType extends object = { id: string }>(\n\t\tpayload: DeleteType[],\n\t\tcontext: ApiContext = new ApiContext(),\n\t): Promise<void> {\n\t\tawait new SyncService(this.client).sync(\n\t\t\t[\n\t\t\t\tnew SyncOperation(\n\t\t\t\t\t\"delete\",\n\t\t\t\t\tthis.entityName.replaceAll(\"-\", \"_\"),\n\t\t\t\t\t\"delete\",\n\t\t\t\t\tpayload,\n\t\t\t\t),\n\t\t\t],\n\t\t\tcontext,\n\t\t);\n\t}\n\n\tasync deleteByFilters(\n\t\tfilters: SingleFilter[],\n\t\tcontext: ApiContext = new ApiContext(),\n\t): Promise<void> {\n\t\tawait new SyncService(this.client).sync(\n\t\t\t[\n\t\t\t\tnew SyncOperation(\n\t\t\t\t\t\"delete\",\n\t\t\t\t\tthis.entityName.replaceAll(\"-\", \"_\"),\n\t\t\t\t\t\"delete\",\n\t\t\t\t\t[],\n\t\t\t\t\tfilters,\n\t\t\t\t),\n\t\t\t],\n\t\t\tcontext,\n\t\t);\n\t}\n}\n\nexport class SyncService {\n\tconstructor(private client: HttpClient) {}\n\n\tasync sync(\n\t\toperations: SyncOperation[],\n\t\tcontext: ApiContext = new ApiContext(),\n\t): Promise<void> {\n\t\tawait this.client.post<{ notFound: string[]; deleted: string[] }>(\n\t\t\t\"/_action/sync\",\n\t\t\toperations,\n\t\t\tcontext.toHeaders(),\n\t\t);\n\t}\n}\n\nexport class SyncOperation {\n\tconstructor(\n\t\tpublic key: string,\n\t\tpublic entity: string,\n\t\tpublic action: \"upsert\" | \"delete\",\n\t\tpublic payload: object[],\n\t\tpublic criteria: SingleFilter[] | null = null,\n\t) {}\n}\n\ntype EntitySearchResponse<Entity = unknown, Aggregations = object> = {\n\ttotal: number;\n\taggregations: Aggregations;\n\tdata: Entity[];\n};\n\n/**\n * Result of an entity search operation\n *\n * Contains the search results with proper typing for associated entities\n * when used with the enhanced Criteria<T> class.\n */\nexport class EntitySearchResult<Entity = unknown, Aggregations = object> {\n\tconstructor(\n\t\tpublic total: number,\n\t\tpublic aggregations: Aggregations,\n\t\tpublic data: Entity[],\n\t) {\n\t\tthis.total = total;\n\t\tthis.aggregations = aggregations;\n\t\tthis.data = data;\n\t}\n\n\t/**\n\t * Get the first result or null if no results\n\t *\n\t * The returned entity will be properly typed with all associations\n\t * that were added to the criteria.\n\t */\n\tfirst(): Entity | null {\n\t\treturn this.data[0] || null;\n\t}\n}\n\nexport const Defaults = {\n\tsystemLanguageId: \"2fbb5fe2e29a4d70aa5854ce7ce3e20b\",\n\tliveVersion: \"0fa91ce3e96a4bc2be4bd9ce752c3425\",\n\tsystemCurrencyId: \"b7d2554b0ce847cd82f3ac9bd1c0dfca\",\n\tsalesChannelTypeApi: \"f183ee5650cf4bdb8a774337575067a6\",\n\tsalesChannelTypeSalesChannel: \"8a243080f92e4c719546314b577cf82b\",\n\tsalesChannelTypeProductComparision: \"ed535e5722134ac1aa6524f73e26881b\",\n};\n\nexport function uuid(): string {\n\treturn crypto.randomUUID().replaceAll(\"-\", \"\");\n}\n"]}
|
|
@@ -150,7 +150,18 @@ interface RequestParams {
|
|
|
150
150
|
includes?: Include;
|
|
151
151
|
"total-count-mode"?: TotalCountMode;
|
|
152
152
|
}
|
|
153
|
-
|
|
153
|
+
type DeepNonNullable<T> = T extends object ? {
|
|
154
|
+
[P in keyof T]: DeepNonNullable<NonNullable<T[P]>>;
|
|
155
|
+
} : NonNullable<T>;
|
|
156
|
+
type MakeRequired<T, K extends keyof T> = Omit<T, K> & {
|
|
157
|
+
[P in K]-?: DeepNonNullable<T[P]>;
|
|
158
|
+
};
|
|
159
|
+
type NestedMakeRequired<T, Path extends string> = Path extends `${infer First}.${infer Rest}` ? First extends keyof T ? Omit<T, First> & {
|
|
160
|
+
[K in First]-?: NestedMakeRequired<NonNullable<T[First]>, Rest>;
|
|
161
|
+
} : T : Path extends keyof T ? MakeRequired<T, Path> : T;
|
|
162
|
+
type PropertyType<T, K extends keyof T> = NonNullable<T[K]>;
|
|
163
|
+
export type Autoloadable<T> = T;
|
|
164
|
+
export declare class Criteria<T = object> {
|
|
154
165
|
title: string | null;
|
|
155
166
|
page: number | null;
|
|
156
167
|
limit: number | null;
|
|
@@ -222,13 +233,18 @@ export declare class Criteria {
|
|
|
222
233
|
* Ensures that a criterion is created for each segment of the passed path.
|
|
223
234
|
* Existing Criteria objects are not overwritten.
|
|
224
235
|
* Returns the own instance
|
|
236
|
+
*
|
|
237
|
+
* When used with a type parameter T, provides type-safe access to ensure fields are
|
|
238
|
+
* defined when accessing results from a Repository search.
|
|
225
239
|
*/
|
|
226
|
-
addAssociation(
|
|
240
|
+
addAssociation<K extends keyof T & string>(field: K): Criteria<MakeRequired<T, K>>;
|
|
241
|
+
addAssociation<P extends string & `${string}.${string}`>(path: P): Criteria<NestedMakeRequired<T, P>>;
|
|
227
242
|
/**
|
|
228
243
|
* Ensures that a criterion is created for each segment of the passed path.
|
|
229
244
|
* Returns the criteria instance of the last path segment
|
|
230
245
|
*/
|
|
231
|
-
getAssociation(
|
|
246
|
+
getAssociation<K extends keyof T & string>(field: K): Criteria<PropertyType<T, K>>;
|
|
247
|
+
getAssociation<P extends string>(path: P): Criteria<T>;
|
|
232
248
|
private getAssociationCriteria;
|
|
233
249
|
getLimit(): number;
|
|
234
250
|
getPage(): number;
|
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U,CAAC,EACpC,OAAO,GAAE,YAAY,EAAO,GAC1B,OAAO,CAAC,KAAK,CAAC;IAIjB;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,KAAK,CACX,QAAQ,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC,UAAU,CAAC,EACtC,OAAO,GAAE,YAAY,EAAO,GAC1B,OAAO,CAAC,OAAO,CAAC;CAGnB"}
|
|
@@ -204,19 +204,12 @@ class Criteria {
|
|
|
204
204
|
this.aggregations.push(aggregation);
|
|
205
205
|
return this;
|
|
206
206
|
}
|
|
207
|
-
|
|
208
|
-
* Ensures that a criterion is created for each segment of the passed path.
|
|
209
|
-
* Existing Criteria objects are not overwritten.
|
|
210
|
-
* Returns the own instance
|
|
211
|
-
*/
|
|
207
|
+
// Implementation with traditional behavior
|
|
212
208
|
addAssociation(path) {
|
|
213
209
|
this.getAssociation(path);
|
|
214
210
|
return this;
|
|
215
211
|
}
|
|
216
|
-
|
|
217
|
-
* Ensures that a criterion is created for each segment of the passed path.
|
|
218
|
-
* Returns the criteria instance of the last path segment
|
|
219
|
-
*/
|
|
212
|
+
// Implementation with traditional behavior
|
|
220
213
|
getAssociation(path) {
|
|
221
214
|
const parts = path.split(".");
|
|
222
215
|
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"criteria.js","sourceRoot":"","sources":["../../../src/helper/criteria.ts"],"names":[],"mappings":";;;AAAA,IAAY,cAOX;AAPD,WAAY,cAAc;IACzB,yFAAyF;IACzF,uEAAkB,CAAA;IAClB,kGAAkG;IAClG,6EAAqB,CAAA;IACrB,iGAAiG;IACjG,uFAA0B,CAAA;AAC3B,CAAC,EAPW,cAAc,8BAAd,cAAc,QAOzB;AAyJD,MAAa,QAAQ;IACpB,KAAK,CAAgB;IAErB,IAAI,CAAgB;IAEpB,KAAK,CAAgB;IAErB,IAAI,CAAgB;IAEpB,OAAO,CAAiB;IAExB,GAAG,CAAW;IAEd,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AK,EAAE,KAAK,EAAE,CAAC;IACnD,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,KAAK,CACX,KAAa,EACb,KAAqC;QAErC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC;IACpD,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,MAAM,CACZ,KAAa,EACb,KAAuC;QAEvC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;IACzC,CAAC;IAED;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,GAAG,CACT,QAAoC,EACpC,UAA0B,EAAE;QAE5B,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;IAC9D,CAAC;IAED;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,KAAK,CACX,QAAsC,EACtC,UAA0B,EAAE;QAE5B,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC;IAC7C,CAAC;CACD;AAvjBD,4BAujBC","sourcesContent":["export enum TotalCountMode {\n\t/* No total count will be selected. Should be used if no pagination required (fastest) */\n\tNO_TOTAL_COUNT = 0,\n\t/* Exact total count will be selected. Should be used if an exact pagination is required (slow) */\n\tEXACT_TOTAL_COUNT = 1,\n\t/* Fetches limit * 5 + 1. Should be used if pagination can work with \"next page exists\" (fast) */\n\tPAGINATION_TOTAL_COUNT = 2,\n}\n\ninterface Filters {\n\tcontains: {\n\t\ttype: \"contains\";\n\t\tfield: string;\n\t\tvalue: string;\n\t};\n\tprefix: {\n\t\ttype: \"prefix\";\n\t\tfield: string;\n\t\tvalue: string;\n\t};\n\tsuffix: {\n\t\ttype: \"suffix\";\n\t\tfield: string;\n\t\tvalue: string;\n\t};\n\tequalsAny: {\n\t\ttype: \"equalsAny\";\n\t\tfield: string;\n\t\tvalue: (string | number | boolean | null)[];\n\t};\n\tequals: {\n\t\ttype: \"equals\";\n\t\tfield: string;\n\t\tvalue: string | number | boolean | null;\n\t};\n\trange: {\n\t\ttype: \"range\";\n\t\tfield: string;\n\t\tparameters: {\n\t\t\tlte?: string | number;\n\t\t\tlt?: string | number;\n\t\t\tgte?: string | number;\n\t\t\tgt?: string | number;\n\t\t};\n\t};\n\tnot: {\n\t\ttype: \"not\";\n\t\toperator: \"and\" | \"AND\" | \"or\" | \"OR\";\n\t\tqueries: SingleFilter[];\n\t};\n\tmulti: {\n\t\ttype: \"multi\";\n\t\toperator: \"and\" | \"AND\" | \"or\" | \"OR\";\n\t\tqueries: SingleFilter[];\n\t};\n}\n\ninterface Aggregations {\n\thistogram: {\n\t\ttype: \"histogram\";\n\t\tname: string;\n\t\tfield: string;\n\t\tinterval: string | null;\n\t\tformat: string | null;\n\t\taggregation: Aggregation | null;\n\t\ttimeZone: string | null;\n\t};\n\tterms: {\n\t\ttype: \"terms\";\n\t\tname: string;\n\t\tfield: string;\n\t\tlimit?: number | null;\n\t\tsort?: Sorting | null;\n\t\taggregation?: Aggregation | null;\n\t};\n\tsum: {\n\t\ttype: \"sum\";\n\t\tname: string;\n\t\tfield: string;\n\t};\n\tstats: {\n\t\ttype: \"stats\";\n\t\tname: string;\n\t\tfield: string;\n\t};\n\tmin: {\n\t\ttype: \"min\";\n\t\tname: string;\n\t\tfield: string;\n\t};\n\tmax: {\n\t\ttype: \"max\";\n\t\tname: string;\n\t\tfield: string;\n\t};\n\tcount: {\n\t\ttype: \"count\";\n\t\tname: string;\n\t\tfield: string;\n\t};\n\tavg: {\n\t\ttype: \"avg\";\n\t\tname: string;\n\t\tfield: string;\n\t};\n\tentity: {\n\t\ttype: \"entity\";\n\t\tname: string;\n\t\tfield: string;\n\t\tdefinition: string;\n\t};\n\tfilter: {\n\t\ttype: \"filter\";\n\t\tname: string;\n\t\tfilter: SingleFilter[];\n\t\taggregation: Aggregation;\n\t};\n}\n\ntype ValueOf<T> = T[keyof T];\nexport type SingleFilter = ValueOf<Filters>;\ntype Aggregation = ValueOf<Aggregations>;\n\ninterface Include {\n\t[entityName: string]: string[];\n}\ninterface Association {\n\tassociation: string;\n\tcriteria: Criteria;\n}\ninterface Query {\n\tscore: number;\n\tquery: SingleFilter;\n\tscoreField?: string;\n}\ninterface Sorting {\n\tfield: string;\n\torder: \"ASC\" | \"DESC\";\n\tnaturalSorting: boolean;\n\ttype?: string;\n}\ninterface RequestParams {\n\tids?: string[];\n\tpage?: number;\n\tlimit?: number;\n\tterm?: string;\n\tquery?: Query[];\n\tfilter?: SingleFilter[];\n\t\"post-filter\"?: SingleFilter[];\n\tsort?: Sorting[];\n\taggregations?: Aggregation[];\n\tgrouping?: string[];\n\tfields?: string[];\n\tassociations?: {\n\t\t[association: string]: RequestParams;\n\t};\n\tincludes?: Include;\n\t\"total-count-mode\"?: TotalCountMode;\n}\n\nexport class Criteria {\n\ttitle: string | null;\n\n\tpage: number | null;\n\n\tlimit: number | null;\n\n\tterm: string | null;\n\n\tfilters: SingleFilter[];\n\n\tids: string[];\n\n\tqueries: Query[];\n\n\tassociations: Association[];\n\n\tpostFilter: SingleFilter[];\n\n\tsortings: Sorting[];\n\n\taggregations: Aggregation[];\n\n\tgrouping: string[];\n\n\tfields: string[];\n\n\ttotalCountMode: TotalCountMode | null;\n\n\tincludes: Include | null;\n\n\tconstructor(ids: string[] = []) {\n\t\tthis.page = null;\n\t\tthis.limit = null;\n\t\tthis.term = null;\n\t\tthis.title = null;\n\t\tthis.filters = [];\n\t\tthis.includes = null;\n\t\tthis.ids = ids;\n\t\tthis.queries = [];\n\t\tthis.associations = [];\n\t\tthis.postFilter = [];\n\t\tthis.sortings = [];\n\t\tthis.aggregations = [];\n\t\tthis.grouping = [];\n\t\tthis.fields = [];\n\t\tthis.totalCountMode = null;\n\t}\n\n\t/**\n\t * Parses the current criteria and generates an object which can be provided to the api\n\t */\n\ttoPayload(): RequestParams {\n\t\tconst params: RequestParams = {};\n\n\t\tif (this.ids.length > 0) {\n\t\t\tparams.ids = this.ids;\n\t\t}\n\t\tif (this.page !== null) {\n\t\t\tparams.page = this.page;\n\t\t}\n\t\tif (this.limit !== null) {\n\t\t\tparams.limit = this.limit;\n\t\t}\n\t\tif (this.term !== null) {\n\t\t\tparams.term = this.term;\n\t\t}\n\t\tif (this.queries.length > 0) {\n\t\t\tparams.query = this.queries;\n\t\t}\n\t\tif (this.filters.length > 0) {\n\t\t\tparams.filter = this.filters;\n\t\t}\n\t\tif (this.postFilter.length > 0) {\n\t\t\tparams[\"post-filter\"] = this.postFilter;\n\t\t}\n\t\tif (this.sortings.length > 0) {\n\t\t\tparams.sort = this.sortings;\n\t\t}\n\t\tif (this.aggregations.length > 0) {\n\t\t\tparams.aggregations = this.aggregations;\n\t\t}\n\t\tif (this.grouping.length > 0) {\n\t\t\tparams.grouping = this.grouping;\n\t\t}\n\t\tif (this.fields.length > 0) {\n\t\t\tparams.fields = this.fields;\n\t\t}\n\t\tif (this.associations.length > 0) {\n\t\t\tparams.associations = {};\n\n\t\t\tfor (const item of this.associations) {\n\t\t\t\tif (!params.associations) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tparams.associations[item.association] = item.criteria.toPayload();\n\t\t\t}\n\t\t}\n\t\tif (this.includes !== null) {\n\t\t\tparams.includes = this.includes;\n\t\t}\n\n\t\tif (this.totalCountMode !== null) {\n\t\t\tparams[\"total-count-mode\"] = this.totalCountMode;\n\t\t}\n\n\t\treturn params;\n\t}\n\n\t/**\n\t * Allows to provide a title for the criteria. This title will be shown in the `repository.search` request url so it can be used for debugging in network's tab\n\t */\n\tsetTitle(title: string): this {\n\t\tthis.title = title;\n\t\treturn this;\n\t}\n\n\tgetTitle(): string | null {\n\t\treturn this.title;\n\t}\n\t/**\n\t * Allows to provide a list of ids which are used as a filter\n\t */\n\tsetIds(ids: string[]): this {\n\t\tthis.ids = ids;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Allows to configure the total value of a search result.\n\t * 0 - no total count will be selected. Should be used if no pagination required (fastest)\n\t * 1 - exact total count will be selected. Should be used if an exact pagination is required (slow)\n\t * 2 - fetches limit * 5 + 1. Should be used if pagination can work with \"next page exists\" (fast)\n\t */\n\tsetTotalCountMode(mode: TotalCountMode): this {\n\t\tif (typeof mode !== \"number\") {\n\t\t\tthis.totalCountMode = null;\n\t\t}\n\n\t\tthis.totalCountMode = mode < 0 || mode > 2 ? null : mode;\n\t\treturn this;\n\t}\n\n\tsetPage(page: number): this {\n\t\tthis.page = page;\n\t\treturn this;\n\t}\n\n\tsetLimit(limit: number): this {\n\t\tthis.limit = limit;\n\t\treturn this;\n\t}\n\n\tsetTerm(term: string): this {\n\t\tthis.term = term;\n\t\treturn this;\n\t}\n\n\taddFilter(filter: SingleFilter): this {\n\t\tthis.filters.push(filter);\n\n\t\treturn this;\n\t}\n\n\taddIncludes(include: Include): this {\n\t\tfor (const [entityName, includeValues] of Object.entries(include)) {\n\t\t\tif (this.includes === null) {\n\t\t\t\tthis.includes = {};\n\t\t\t}\n\t\t\tif (!this.includes[entityName]) {\n\t\t\t\tthis.includes[entityName] = [];\n\t\t\t}\n\n\t\t\tthis.includes[entityName].push(...includeValues);\n\t\t}\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Adds the provided filter as post filter.\n\t * Post filter will be considered for the documents query but not for the aggregations.\n\t */\n\taddPostFilter(filter: SingleFilter): this {\n\t\tthis.postFilter.push(filter);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Allows to add different sortings for the criteria, to sort the entity result.\n\t */\n\taddSorting(sorting: Sorting): this {\n\t\tthis.sortings.push(sorting);\n\t\treturn this;\n\t}\n\n\t/**\n\t * @see \\Shopware\\Core\\Framework\\DataAbstractionLayer\\Search\\Query\\ScoreQuery.\n\t * These queries are used to search for documents and score them with a ranking\n\t */\n\taddQuery(\n\t\tfilter: SingleFilter,\n\t\tscore: number,\n\t\tscoreField: string | null = null,\n\t): this {\n\t\tconst query: Query = { score: score, query: filter };\n\n\t\tif (scoreField) {\n\t\t\tquery.scoreField = scoreField;\n\t\t}\n\n\t\tthis.queries.push(query);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Allows grouping the result by a specific field\n\t */\n\taddGrouping(field: string): this {\n\t\tthis.grouping.push(field);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Allows loading partial fields for the result.\n\t */\n\taddFields(...field: string[]): this {\n\t\tthis.fields.push(...field);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * @param {Object} aggregation\n\t */\n\taddAggregation(aggregation: Aggregation): this {\n\t\tthis.aggregations.push(aggregation);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Ensures that a criterion is created for each segment of the passed path.\n\t * Existing Criteria objects are not overwritten.\n\t * Returns the own instance\n\t */\n\taddAssociation(path: string): this {\n\t\tthis.getAssociation(path);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Ensures that a criterion is created for each segment of the passed path.\n\t * Returns the criteria instance of the last path segment\n\t */\n\tgetAssociation(path: string): Criteria {\n\t\tconst parts = path.split(\".\");\n\n\t\t// eslint-disable-next-line @typescript-eslint/no-this-alias\n\t\tlet criteria = this;\n\n\t\tfor (const part of parts) {\n\t\t\tif (!criteria.hasAssociation(part)) {\n\t\t\t\tcriteria.associations.push({\n\t\t\t\t\tassociation: part,\n\t\t\t\t\tcriteria: new Criteria(),\n\t\t\t\t});\n\t\t\t}\n\n\t\t\t// @ts-expect-error - another this instance\n\t\t\tcriteria = criteria.getAssociationCriteria(part);\n\t\t}\n\n\t\treturn criteria;\n\t}\n\n\tprivate getAssociationCriteria(part: string): Criteria {\n\t\tlet criteria = null;\n\n\t\tfor (const association of this.associations) {\n\t\t\tif (association.association === part) {\n\t\t\t\tcriteria = association.criteria;\n\t\t\t}\n\t\t}\n\n\t\tif (!criteria) {\n\t\t\tcriteria = new Criteria();\n\t\t\tthis.associations.push({\n\t\t\t\tassociation: part,\n\t\t\t\tcriteria,\n\t\t\t});\n\t\t}\n\n\t\treturn criteria;\n\t}\n\n\tgetLimit(): number {\n\t\treturn this.limit ?? 0;\n\t}\n\n\tgetPage(): number {\n\t\treturn this.page ?? 0;\n\t}\n\n\thasAssociation(property: string): boolean {\n\t\treturn this.associations.some((assocation) => {\n\t\t\treturn assocation.association === property;\n\t\t});\n\t}\n\n\t/**\n\t * Resets the sorting parameter\n\t */\n\tresetSorting(): void {\n\t\tthis.sortings = [];\n\t}\n\n\t/**\n\t * @see \\Shopware\\Core\\Framework\\DataAbstractionLayer\\Search\\Aggregation\\Metric\\AvgAggregation\n\t * Allows to calculate the avg value for the provided field\n\t */\n\tstatic avg(name: string, field: string): Aggregations[\"avg\"] {\n\t\treturn { type: \"avg\", name, field };\n\t}\n\n\t/**\n\t * @see \\Shopware\\Core\\Framework\\DataAbstractionLayer\\Search\\Aggregation\\Metric\\CountAggregation\n\t * Allows to calculate the count value for the provided field\n\t */\n\tstatic count(name: string, field: string): Aggregations[\"count\"] {\n\t\treturn { type: \"count\", name, field };\n\t}\n\n\t/**\n\t * @see \\Shopware\\Core\\Framework\\DataAbstractionLayer\\Search\\Aggregation\\Metric\\MaxAggregation\n\t * Allows to calculate the max value for the provided field\n\t */\n\tstatic max(name: string, field: string): Aggregations[\"max\"] {\n\t\treturn { type: \"max\", name, field };\n\t}\n\n\t/**\n\t * @see \\Shopware\\Core\\Framework\\DataAbstractionLayer\\Search\\Aggregation\\Metric\\MinAggregation\n\t * Allows to calculate the min value for the provided field\n\t */\n\tstatic min(name: string, field: string): Aggregations[\"min\"] {\n\t\treturn { type: \"min\", name, field };\n\t}\n\n\t/**\n\t * @see \\Shopware\\Core\\Framework\\DataAbstractionLayer\\Search\\Aggregation\\Metric\\StatsAggregation\n\t * Allows to calculate the sum, max, min, avg, count values for the provided field\n\t */\n\tstatic stats(name: string, field: string): Aggregations[\"stats\"] {\n\t\treturn { type: \"stats\", name, field };\n\t}\n\n\t/**\n\t * @see \\Shopware\\Core\\Framework\\DataAbstractionLayer\\Search\\Aggregation\\Metric\\SumAggregation\n\t * Allows to calculate the sum value for the provided field\n\t */\n\tstatic sum(name: string, field: string): Aggregations[\"sum\"] {\n\t\treturn { type: \"sum\", name, field };\n\t}\n\n\t/**\n\t * @see \\Shopware\\Core\\Framework\\DataAbstractionLayer\\Search\\Aggregation\\Bucket\\TermsAggregation\n\t * Allows to fetch term buckets for the provided field\n\t */\n\tstatic terms(\n\t\tname: string,\n\t\tfield: string,\n\t\tlimit: number | null = null,\n\t\tsort: Sorting | null = null,\n\t\taggregation: Aggregation | null = null,\n\t): Aggregations[\"terms\"] {\n\t\treturn { type: \"terms\", name, field, limit, sort, aggregation };\n\t}\n\n\t/**\n\t * @see \\Shopware\\Core\\Framework\\DataAbstractionLayer\\Search\\Aggregation\\Metric\\EntityAggregation\n\t * Allows to filter an aggregation result\n\t */\n\tstatic entityAggregation(\n\t\tname: string,\n\t\tfield: string,\n\t\tdefinition: string,\n\t): Aggregations[\"entity\"] {\n\t\treturn { type: \"entity\", name, field, definition };\n\t}\n\n\t/**\n\t * @see \\Shopware\\Core\\Framework\\DataAbstractionLayer\\Search\\Aggregation\\Bucket\\FilterAggregation\n\t * Allows to filter an aggregation result\n\t */\n\tstatic filter(\n\t\tname: string,\n\t\tfilter: SingleFilter[],\n\t\taggregation: Aggregation,\n\t): Aggregations[\"filter\"] {\n\t\treturn { type: \"filter\", name, filter, aggregation };\n\t}\n\n\t/**\n\t * @see \\Shopware\\Core\\Framework\\DataAbstractionLayer\\Search\\Aggregation\\Bucket\\DateHistogramAggregation\n\t * Allows to fetch date buckets for the provided date interval\n\t */\n\tstatic histogram(\n\t\tname: string,\n\t\tfield: string,\n\t\tinterval: string | null = null,\n\t\tformat: string | null = null,\n\t\taggregation: Aggregation | null = null,\n\t\ttimeZone: string | null = null,\n\t): Aggregations[\"histogram\"] {\n\t\treturn {\n\t\t\ttype: \"histogram\",\n\t\t\tname,\n\t\t\tfield,\n\t\t\tinterval,\n\t\t\tformat,\n\t\t\taggregation,\n\t\t\ttimeZone,\n\t\t};\n\t}\n\n\t/**\n\t * @see \\Shopware\\Core\\Framework\\DataAbstractionLayer\\Search\\Sorting\\FieldSorting.\n\t * Allows to sort the documents by the provided field\n\t */\n\tstatic sort(\n\t\tfield: string,\n\t\torder: Sorting[\"order\"] = \"ASC\",\n\t\tnaturalSorting = false,\n\t): Sorting {\n\t\treturn { field, order, naturalSorting };\n\t}\n\n\t/**\n\t * @see \\Shopware\\Core\\Framework\\DataAbstractionLayer\\Search\\Sorting\\FieldSorting.\n\t * Allows to sort the documents by the provided field naturally\n\t */\n\tstatic naturalSorting(\n\t\tfield: string,\n\t\torder: Sorting[\"order\"] = \"ASC\",\n\t): Sorting {\n\t\treturn { field, order, naturalSorting: true };\n\t}\n\n\t/**\n\t * @see \\Shopware\\Core\\Framework\\DataAbstractionLayer\\Search\\Sorting\\CountSorting.\n\t * Allows to sort the documents by counting associations via the provided field\n\t *\n\t * Sql representation: `ORDER BY COUNT({field}) {order}`\n\t */\n\tstatic countSorting(field: string, order: Sorting[\"order\"] = \"ASC\"): Sorting {\n\t\treturn { field, order, naturalSorting: false, type: \"count\" };\n\t}\n\n\t/**\n\t * @see \\Shopware\\Core\\Framework\\DataAbstractionLayer\\Search\\Filter\\ContainsFilter.\n\t * This allows to filter documents where the value are contained in the provided field.\n\t *\n\t * Sql representation: `{field} LIKE %{value}%`\n\t */\n\tstatic contains(field: string, value: string): Filters[\"contains\"] {\n\t\treturn { type: \"contains\", field, value };\n\t}\n\n\t/**\n\t * @see \\Shopware\\Core\\Framework\\DataAbstractionLayer\\Search\\Filter\\PrefixFilter.\n\t * This allows to filter documents where the value marks the beginning of the provided field.\n\t *\n\t * Sql representation: `{field} LIKE {value}%`\n\t */\n\tstatic prefix(field: string, value: string): Filters[\"prefix\"] {\n\t\treturn { type: \"prefix\", field, value };\n\t}\n\n\t/**\n\t * @see \\Shopware\\Core\\Framework\\DataAbstractionLayer\\Search\\Filter\\SuffixFilter.\n\t * This allows to filter documents where the value marks the end of the provided field.\n\t *\n\t * Sql representation: `{field} LIKE %{value}`\n\t */\n\tstatic suffix(field: string, value: string): Filters[\"suffix\"] {\n\t\treturn { type: \"suffix\", field, value };\n\t}\n\n\t/**\n\t * @see \\Shopware\\Core\\Framework\\DataAbstractionLayer\\Search\\Filter\\EqualsAnyFilter.\n\t * This allows to filter documents where the field matches one of the provided values\n\t *\n\t * Sql representation: `{field} IN ({value}, {value})`\n\t */\n\tstatic equalsAny(\n\t\tfield: string,\n\t\tvalue: (string | number | boolean | null)[],\n\t): Filters[\"equalsAny\"] {\n\t\treturn { type: \"equalsAny\", field, value: value };\n\t}\n\n\t/**\n\t * @see \\Shopware\\Core\\Framework\\DataAbstractionLayer\\Search\\Filter\\RangeFilter.\n\t * This allows to filter documents where the field matches a defined range\n\t *\n\t * Sql representation: `{field} >= {value}`, `{field} <= {value}`, ...\n\t */\n\tstatic range(\n\t\tfield: string,\n\t\trange: Filters[\"range\"][\"parameters\"],\n\t): Filters[\"range\"] {\n\t\treturn { type: \"range\", field, parameters: range };\n\t}\n\n\t/**\n\t * @see \\Shopware\\Core\\Framework\\DataAbstractionLayer\\Search\\Filter\\EqualsFilter.\n\t * This allows to filter documents where the field matches a defined range\n\t *\n\t * Sql representation: `{field} = {value}`\n\t */\n\tstatic equals(\n\t\tfield: string,\n\t\tvalue: string | number | boolean | null,\n\t): Filters[\"equals\"] {\n\t\treturn { type: \"equals\", field, value };\n\t}\n\n\t/**\n\t * @see \\Shopware\\Core\\Framework\\DataAbstractionLayer\\Search\\Filter\\NotFilter.\n\t * This allows to filter documents which not matches for the provided filters\n\t * All above listed queries can be provided (equals, equalsAny, range, contains)\n\t *\n\t * Sql representation: `NOT({query} {operator} {query} {operator} {query})`\n\t *\n\t * @param {string} operator - and/or\n\t * @param {array} queries\n\t *\n\t * @returns {Object}\n\t */\n\tstatic not(\n\t\toperator: Filters[\"not\"][\"operator\"],\n\t\tqueries: SingleFilter[] = [],\n\t): Filters[\"not\"] {\n\t\treturn { type: \"not\", operator: operator, queries: queries };\n\t}\n\n\t/**\n\t * @see \\Shopware\\Core\\Framework\\DataAbstractionLayer\\Search\\Filter\\NotFilter.\n\t * This allows to filter documents which matches for the provided filters\n\t * All above listed queries can be provided (equals, equalsAny, range, contains)\n\t *\n\t * Sql representation: `({query} {operator} {query} {operator} {query})`\n\t *\n\t * @param {string} operator - and/or\n\t * @param {array} queries\n\t *\n\t * @returns {Object}\n\t */\n\tstatic multi(\n\t\toperator: Filters[\"multi\"][\"operator\"],\n\t\tqueries: SingleFilter[] = [],\n\t): Filters[\"multi\"] {\n\t\treturn { type: \"multi\", operator, queries };\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"criteria.js","sourceRoot":"","sources":["../../../src/helper/criteria.ts"],"names":[],"mappings":";;;AAAA,IAAY,cAOX;AAPD,WAAY,cAAc;IACzB,yFAAyF;IACzF,uEAAkB,CAAA;IAClB,kGAAkG;IAClG,6EAAqB,CAAA;IACrB,iGAAiG;IACjG,uFAA0B,CAAA;AAC3B,CAAC,EAPW,cAAc,8BAAd,cAAc,QAOzB;AAkMD,MAAa,QAAQ;IACpB,KAAK,CAAgB;IAErB,IAAI,CAAgB;IAEpB,KAAK,CAAgB;IAErB,IAAI,CAAgB;IAEpB,OAAO,CAAiB;IAExB,GAAG,CAAW;IAEd,OAAO,CAAU;IAEjB,YAAY,CAAgB;IAE5B,UAAU,CAAiB;IAE3B,QAAQ,CAAY;IAEpB,YAAY,CAAgB;IAE5B,QAAQ,CAAW;IAEnB,MAAM,CAAW;IAEjB,cAAc,CAAwB;IAEtC,QAAQ,CAAiB;IAEzB,YAAY,MAAgB,EAAE;QAC7B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;QAClB,IAAI,CA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E;QAE5B,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;IAC9D,CAAC;IAED;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,KAAK,CACX,QAAsC,EACtC,UAA0B,EAAE;QAE5B,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC;IAC7C,CAAC;CACD;AA7kBD,4BA6kBC","sourcesContent":["export enum TotalCountMode {\n\t/* No total count will be selected. Should be used if no pagination required (fastest) */\n\tNO_TOTAL_COUNT = 0,\n\t/* Exact total count will be selected. Should be used if an exact pagination is required (slow) */\n\tEXACT_TOTAL_COUNT = 1,\n\t/* Fetches limit * 5 + 1. Should be used if pagination can work with \"next page exists\" (fast) */\n\tPAGINATION_TOTAL_COUNT = 2,\n}\n\ninterface Filters {\n\tcontains: {\n\t\ttype: \"contains\";\n\t\tfield: string;\n\t\tvalue: string;\n\t};\n\tprefix: {\n\t\ttype: \"prefix\";\n\t\tfield: string;\n\t\tvalue: string;\n\t};\n\tsuffix: {\n\t\ttype: \"suffix\";\n\t\tfield: string;\n\t\tvalue: string;\n\t};\n\tequalsAny: {\n\t\ttype: \"equalsAny\";\n\t\tfield: string;\n\t\tvalue: (string | number | boolean | null)[];\n\t};\n\tequals: {\n\t\ttype: \"equals\";\n\t\tfield: string;\n\t\tvalue: string | number | boolean | null;\n\t};\n\trange: {\n\t\ttype: \"range\";\n\t\tfield: string;\n\t\tparameters: {\n\t\t\tlte?: string | number;\n\t\t\tlt?: string | number;\n\t\t\tgte?: string | number;\n\t\t\tgt?: string | number;\n\t\t};\n\t};\n\tnot: {\n\t\ttype: \"not\";\n\t\toperator: \"and\" | \"AND\" | \"or\" | \"OR\";\n\t\tqueries: SingleFilter[];\n\t};\n\tmulti: {\n\t\ttype: \"multi\";\n\t\toperator: \"and\" | \"AND\" | \"or\" | \"OR\";\n\t\tqueries: SingleFilter[];\n\t};\n}\n\ninterface Aggregations {\n\thistogram: {\n\t\ttype: \"histogram\";\n\t\tname: string;\n\t\tfield: string;\n\t\tinterval: string | null;\n\t\tformat: string | null;\n\t\taggregation: Aggregation | null;\n\t\ttimeZone: string | null;\n\t};\n\tterms: {\n\t\ttype: \"terms\";\n\t\tname: string;\n\t\tfield: string;\n\t\tlimit?: number | null;\n\t\tsort?: Sorting | null;\n\t\taggregation?: Aggregation | null;\n\t};\n\tsum: {\n\t\ttype: \"sum\";\n\t\tname: string;\n\t\tfield: string;\n\t};\n\tstats: {\n\t\ttype: \"stats\";\n\t\tname: string;\n\t\tfield: string;\n\t};\n\tmin: {\n\t\ttype: \"min\";\n\t\tname: string;\n\t\tfield: string;\n\t};\n\tmax: {\n\t\ttype: \"max\";\n\t\tname: string;\n\t\tfield: string;\n\t};\n\tcount: {\n\t\ttype: \"count\";\n\t\tname: string;\n\t\tfield: string;\n\t};\n\tavg: {\n\t\ttype: \"avg\";\n\t\tname: string;\n\t\tfield: string;\n\t};\n\tentity: {\n\t\ttype: \"entity\";\n\t\tname: string;\n\t\tfield: string;\n\t\tdefinition: string;\n\t};\n\tfilter: {\n\t\ttype: \"filter\";\n\t\tname: string;\n\t\tfilter: SingleFilter[];\n\t\taggregation: Aggregation;\n\t};\n}\n\ntype ValueOf<T> = T[keyof T];\nexport type SingleFilter = ValueOf<Filters>;\ntype Aggregation = ValueOf<Aggregations>;\n\ninterface Include {\n\t[entityName: string]: string[];\n}\ninterface Association {\n\tassociation: string;\n\tcriteria: Criteria;\n}\ninterface Query {\n\tscore: number;\n\tquery: SingleFilter;\n\tscoreField?: string;\n}\ninterface Sorting {\n\tfield: string;\n\torder: \"ASC\" | \"DESC\";\n\tnaturalSorting: boolean;\n\ttype?: string;\n}\ninterface RequestParams {\n\tids?: string[];\n\tpage?: number;\n\tlimit?: number;\n\tterm?: string;\n\tquery?: Query[];\n\tfilter?: SingleFilter[];\n\t\"post-filter\"?: SingleFilter[];\n\tsort?: Sorting[];\n\taggregations?: Aggregation[];\n\tgrouping?: string[];\n\tfields?: string[];\n\tassociations?: {\n\t\t[association: string]: RequestParams;\n\t};\n\tincludes?: Include;\n\t\"total-count-mode\"?: TotalCountMode;\n}\n\n// Type utilities for enhanced type safety with nested paths\ntype DeepNonNullable<T> = T extends object\n\t? {\n\t\t\t[P in keyof T]: DeepNonNullable<NonNullable<T[P]>>;\n\t\t}\n\t: NonNullable<T>;\n\ntype MakeRequired<T, K extends keyof T> = Omit<T, K> & {\n\t[P in K]-?: DeepNonNullable<T[P]>;\n};\n\n// Type for handling nested paths\ntype NestedMakeRequired<\n\tT,\n\tPath extends string,\n> = Path extends `${infer First}.${infer Rest}`\n\t? First extends keyof T\n\t\t? Omit<T, First> & {\n\t\t\t\t[K in First]-?: NestedMakeRequired<NonNullable<T[First]>, Rest>;\n\t\t\t}\n\t\t: T\n\t: Path extends keyof T\n\t\t? MakeRequired<T, Path>\n\t\t: T;\n\ntype PropertyType<T, K extends keyof T> = NonNullable<T[K]>;\n\n// Get nested property type\ntype NestedPropertyType<\n\tT,\n\tPath extends string,\n> = Path extends `${infer First}.${infer Rest}`\n\t? First extends keyof T\n\t\t? NestedPropertyType<NonNullable<T[First]>, Rest>\n\t\t: never\n\t: Path extends keyof T\n\t\t? NonNullable<T[Path]>\n\t\t: never;\n\nexport type Autoloadable<T> = T;\n\nexport class Criteria<T = object> {\n\ttitle: string | null;\n\n\tpage: number | null;\n\n\tlimit: number | null;\n\n\tterm: string | null;\n\n\tfilters: SingleFilter[];\n\n\tids: string[];\n\n\tqueries: Query[];\n\n\tassociations: Association[];\n\n\tpostFilter: SingleFilter[];\n\n\tsortings: Sorting[];\n\n\taggregations: Aggregation[];\n\n\tgrouping: string[];\n\n\tfields: string[];\n\n\ttotalCountMode: TotalCountMode | null;\n\n\tincludes: Include | null;\n\n\tconstructor(ids: string[] = []) {\n\t\tthis.page = null;\n\t\tthis.limit = null;\n\t\tthis.term = null;\n\t\tthis.title = null;\n\t\tthis.filters = [];\n\t\tthis.includes = null;\n\t\tthis.ids = ids;\n\t\tthis.queries = [];\n\t\tthis.associations = [];\n\t\tthis.postFilter = [];\n\t\tthis.sortings = [];\n\t\tthis.aggregations = [];\n\t\tthis.grouping = [];\n\t\tthis.fields = [];\n\t\tthis.totalCountMode = null;\n\t}\n\n\t/**\n\t * Parses the current criteria and generates an object which can be provided to the api\n\t */\n\ttoPayload(): RequestParams {\n\t\tconst params: RequestParams = {};\n\n\t\tif (this.ids.length > 0) {\n\t\t\tparams.ids = this.ids;\n\t\t}\n\t\tif (this.page !== null) {\n\t\t\tparams.page = this.page;\n\t\t}\n\t\tif (this.limit !== null) {\n\t\t\tparams.limit = this.limit;\n\t\t}\n\t\tif (this.term !== null) {\n\t\t\tparams.term = this.term;\n\t\t}\n\t\tif (this.queries.length > 0) {\n\t\t\tparams.query = this.queries;\n\t\t}\n\t\tif (this.filters.length > 0) {\n\t\t\tparams.filter = this.filters;\n\t\t}\n\t\tif (this.postFilter.length > 0) {\n\t\t\tparams[\"post-filter\"] = this.postFilter;\n\t\t}\n\t\tif (this.sortings.length > 0) {\n\t\t\tparams.sort = this.sortings;\n\t\t}\n\t\tif (this.aggregations.length > 0) {\n\t\t\tparams.aggregations = this.aggregations;\n\t\t}\n\t\tif (this.grouping.length > 0) {\n\t\t\tparams.grouping = this.grouping;\n\t\t}\n\t\tif (this.fields.length > 0) {\n\t\t\tparams.fields = this.fields;\n\t\t}\n\t\tif (this.associations.length > 0) {\n\t\t\tparams.associations = {};\n\n\t\t\tfor (const item of this.associations) {\n\t\t\t\tif (!params.associations) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tparams.associations[item.association] = item.criteria.toPayload();\n\t\t\t}\n\t\t}\n\t\tif (this.includes !== null) {\n\t\t\tparams.includes = this.includes;\n\t\t}\n\n\t\tif (this.totalCountMode !== null) {\n\t\t\tparams[\"total-count-mode\"] = this.totalCountMode;\n\t\t}\n\n\t\treturn params;\n\t}\n\n\t/**\n\t * Allows to provide a title for the criteria. This title will be shown in the `repository.search` request url so it can be used for debugging in network's tab\n\t */\n\tsetTitle(title: string): this {\n\t\tthis.title = title;\n\t\treturn this;\n\t}\n\n\tgetTitle(): string | null {\n\t\treturn this.title;\n\t}\n\t/**\n\t * Allows to provide a list of ids which are used as a filter\n\t */\n\tsetIds(ids: string[]): this {\n\t\tthis.ids = ids;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Allows to configure the total value of a search result.\n\t * 0 - no total count will be selected. Should be used if no pagination required (fastest)\n\t * 1 - exact total count will be selected. Should be used if an exact pagination is required (slow)\n\t * 2 - fetches limit * 5 + 1. Should be used if pagination can work with \"next page exists\" (fast)\n\t */\n\tsetTotalCountMode(mode: TotalCountMode): this {\n\t\tif (typeof mode !== \"number\") {\n\t\t\tthis.totalCountMode = null;\n\t\t}\n\n\t\tthis.totalCountMode = mode < 0 || mode > 2 ? null : mode;\n\t\treturn this;\n\t}\n\n\tsetPage(page: number): this {\n\t\tthis.page = page;\n\t\treturn this;\n\t}\n\n\tsetLimit(limit: number): this {\n\t\tthis.limit = limit;\n\t\treturn this;\n\t}\n\n\tsetTerm(term: string): this {\n\t\tthis.term = term;\n\t\treturn this;\n\t}\n\n\taddFilter(filter: SingleFilter): this {\n\t\tthis.filters.push(filter);\n\n\t\treturn this;\n\t}\n\n\taddIncludes(include: Include): this {\n\t\tfor (const [entityName, includeValues] of Object.entries(include)) {\n\t\t\tif (this.includes === null) {\n\t\t\t\tthis.includes = {};\n\t\t\t}\n\t\t\tif (!this.includes[entityName]) {\n\t\t\t\tthis.includes[entityName] = [];\n\t\t\t}\n\n\t\t\tthis.includes[entityName].push(...includeValues);\n\t\t}\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Adds the provided filter as post filter.\n\t * Post filter will be considered for the documents query but not for the aggregations.\n\t */\n\taddPostFilter(filter: SingleFilter): this {\n\t\tthis.postFilter.push(filter);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Allows to add different sortings for the criteria, to sort the entity result.\n\t */\n\taddSorting(sorting: Sorting): this {\n\t\tthis.sortings.push(sorting);\n\t\treturn this;\n\t}\n\n\t/**\n\t * @see \\Shopware\\Core\\Framework\\DataAbstractionLayer\\Search\\Query\\ScoreQuery.\n\t * These queries are used to search for documents and score them with a ranking\n\t */\n\taddQuery(\n\t\tfilter: SingleFilter,\n\t\tscore: number,\n\t\tscoreField: string | null = null,\n\t): this {\n\t\tconst query: Query = { score: score, query: filter };\n\n\t\tif (scoreField) {\n\t\t\tquery.scoreField = scoreField;\n\t\t}\n\n\t\tthis.queries.push(query);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Allows grouping the result by a specific field\n\t */\n\taddGrouping(field: string): this {\n\t\tthis.grouping.push(field);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Allows loading partial fields for the result.\n\t */\n\taddFields(...field: string[]): this {\n\t\tthis.fields.push(...field);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * @param {Object} aggregation\n\t */\n\taddAggregation(aggregation: Aggregation): this {\n\t\tthis.aggregations.push(aggregation);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Ensures that a criterion is created for each segment of the passed path.\n\t * Existing Criteria objects are not overwritten.\n\t * Returns the own instance\n\t *\n\t * When used with a type parameter T, provides type-safe access to ensure fields are\n\t * defined when accessing results from a Repository search.\n\t */\n\t// For direct field association\n\taddAssociation<K extends keyof T & string>(\n\t\tfield: K,\n\t): Criteria<MakeRequired<T, K>>;\n\n\t// For nested path association\n\taddAssociation<P extends string & `${string}.${string}`>(\n\t\tpath: P,\n\t): Criteria<NestedMakeRequired<T, P>>;\n\n\t// Implementation with traditional behavior\n\taddAssociation(path: string): this {\n\t\tthis.getAssociation(path);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Ensures that a criterion is created for each segment of the passed path.\n\t * Returns the criteria instance of the last path segment\n\t */\n\t// For direct field association\n\tgetAssociation<K extends keyof T & string>(\n\t\tfield: K,\n\t): Criteria<PropertyType<T, K>>;\n\n\t// For nested path association\n\tgetAssociation<P extends string>(path: P): Criteria<T>;\n\n\t// Implementation with traditional behavior\n\tgetAssociation(path: string): Criteria {\n\t\tconst parts = path.split(\".\");\n\n\t\t// eslint-disable-next-line @typescript-eslint/no-this-alias\n\t\tlet criteria = this;\n\n\t\tfor (const part of parts) {\n\t\t\tif (!criteria.hasAssociation(part)) {\n\t\t\t\tcriteria.associations.push({\n\t\t\t\t\tassociation: part,\n\t\t\t\t\tcriteria: new Criteria(),\n\t\t\t\t});\n\t\t\t}\n\n\t\t\t// @ts-expect-error - another this instance\n\t\t\tcriteria = criteria.getAssociationCriteria(part);\n\t\t}\n\n\t\treturn criteria;\n\t}\n\n\tprivate getAssociationCriteria(part: string): Criteria {\n\t\tlet criteria = null;\n\n\t\tfor (const association of this.associations) {\n\t\t\tif (association.association === part) {\n\t\t\t\tcriteria = association.criteria;\n\t\t\t}\n\t\t}\n\n\t\tif (!criteria) {\n\t\t\tcriteria = new Criteria();\n\t\t\tthis.associations.push({\n\t\t\t\tassociation: part,\n\t\t\t\tcriteria,\n\t\t\t});\n\t\t}\n\n\t\treturn criteria;\n\t}\n\n\tgetLimit(): number {\n\t\treturn this.limit ?? 0;\n\t}\n\n\tgetPage(): number {\n\t\treturn this.page ?? 0;\n\t}\n\n\thasAssociation(property: string): boolean {\n\t\treturn this.associations.some((assocation) => {\n\t\t\treturn assocation.association === property;\n\t\t});\n\t}\n\n\t/**\n\t * Resets the sorting parameter\n\t */\n\tresetSorting(): void {\n\t\tthis.sortings = [];\n\t}\n\n\t/**\n\t * @see \\Shopware\\Core\\Framework\\DataAbstractionLayer\\Search\\Aggregation\\Metric\\AvgAggregation\n\t * Allows to calculate the avg value for the provided field\n\t */\n\tstatic avg(name: string, field: string): Aggregations[\"avg\"] {\n\t\treturn { type: \"avg\", name, field };\n\t}\n\n\t/**\n\t * @see \\Shopware\\Core\\Framework\\DataAbstractionLayer\\Search\\Aggregation\\Metric\\CountAggregation\n\t * Allows to calculate the count value for the provided field\n\t */\n\tstatic count(name: string, field: string): Aggregations[\"count\"] {\n\t\treturn { type: \"count\", name, field };\n\t}\n\n\t/**\n\t * @see \\Shopware\\Core\\Framework\\DataAbstractionLayer\\Search\\Aggregation\\Metric\\MaxAggregation\n\t * Allows to calculate the max value for the provided field\n\t */\n\tstatic max(name: string, field: string): Aggregations[\"max\"] {\n\t\treturn { type: \"max\", name, field };\n\t}\n\n\t/**\n\t * @see \\Shopware\\Core\\Framework\\DataAbstractionLayer\\Search\\Aggregation\\Metric\\MinAggregation\n\t * Allows to calculate the min value for the provided field\n\t */\n\tstatic min(name: string, field: string): Aggregations[\"min\"] {\n\t\treturn { type: \"min\", name, field };\n\t}\n\n\t/**\n\t * @see \\Shopware\\Core\\Framework\\DataAbstractionLayer\\Search\\Aggregation\\Metric\\StatsAggregation\n\t * Allows to calculate the sum, max, min, avg, count values for the provided field\n\t */\n\tstatic stats(name: string, field: string): Aggregations[\"stats\"] {\n\t\treturn { type: \"stats\", name, field };\n\t}\n\n\t/**\n\t * @see \\Shopware\\Core\\Framework\\DataAbstractionLayer\\Search\\Aggregation\\Metric\\SumAggregation\n\t * Allows to calculate the sum value for the provided field\n\t */\n\tstatic sum(name: string, field: string): Aggregations[\"sum\"] {\n\t\treturn { type: \"sum\", name, field };\n\t}\n\n\t/**\n\t * @see \\Shopware\\Core\\Framework\\DataAbstractionLayer\\Search\\Aggregation\\Bucket\\TermsAggregation\n\t * Allows to fetch term buckets for the provided field\n\t */\n\tstatic terms(\n\t\tname: string,\n\t\tfield: string,\n\t\tlimit: number | null = null,\n\t\tsort: Sorting | null = null,\n\t\taggregation: Aggregation | null = null,\n\t): Aggregations[\"terms\"] {\n\t\treturn { type: \"terms\", name, field, limit, sort, aggregation };\n\t}\n\n\t/**\n\t * @see \\Shopware\\Core\\Framework\\DataAbstractionLayer\\Search\\Aggregation\\Metric\\EntityAggregation\n\t * Allows to filter an aggregation result\n\t */\n\tstatic entityAggregation(\n\t\tname: string,\n\t\tfield: string,\n\t\tdefinition: string,\n\t): Aggregations[\"entity\"] {\n\t\treturn { type: \"entity\", name, field, definition };\n\t}\n\n\t/**\n\t * @see \\Shopware\\Core\\Framework\\DataAbstractionLayer\\Search\\Aggregation\\Bucket\\FilterAggregation\n\t * Allows to filter an aggregation result\n\t */\n\tstatic filter(\n\t\tname: string,\n\t\tfilter: SingleFilter[],\n\t\taggregation: Aggregation,\n\t): Aggregations[\"filter\"] {\n\t\treturn { type: \"filter\", name, filter, aggregation };\n\t}\n\n\t/**\n\t * @see \\Shopware\\Core\\Framework\\DataAbstractionLayer\\Search\\Aggregation\\Bucket\\DateHistogramAggregation\n\t * Allows to fetch date buckets for the provided date interval\n\t */\n\tstatic histogram(\n\t\tname: string,\n\t\tfield: string,\n\t\tinterval: string | null = null,\n\t\tformat: string | null = null,\n\t\taggregation: Aggregation | null = null,\n\t\ttimeZone: string | null = null,\n\t): Aggregations[\"histogram\"] {\n\t\treturn {\n\t\t\ttype: \"histogram\",\n\t\t\tname,\n\t\t\tfield,\n\t\t\tinterval,\n\t\t\tformat,\n\t\t\taggregation,\n\t\t\ttimeZone,\n\t\t};\n\t}\n\n\t/**\n\t * @see \\Shopware\\Core\\Framework\\DataAbstractionLayer\\Search\\Sorting\\FieldSorting.\n\t * Allows to sort the documents by the provided field\n\t */\n\tstatic sort(\n\t\tfield: string,\n\t\torder: Sorting[\"order\"] = \"ASC\",\n\t\tnaturalSorting = false,\n\t): Sorting {\n\t\treturn { field, order, naturalSorting };\n\t}\n\n\t/**\n\t * @see \\Shopware\\Core\\Framework\\DataAbstractionLayer\\Search\\Sorting\\FieldSorting.\n\t * Allows to sort the documents by the provided field naturally\n\t */\n\tstatic naturalSorting(\n\t\tfield: string,\n\t\torder: Sorting[\"order\"] = \"ASC\",\n\t): Sorting {\n\t\treturn { field, order, naturalSorting: true };\n\t}\n\n\t/**\n\t * @see \\Shopware\\Core\\Framework\\DataAbstractionLayer\\Search\\Sorting\\CountSorting.\n\t * Allows to sort the documents by counting associations via the provided field\n\t *\n\t * Sql representation: `ORDER BY COUNT({field}) {order}`\n\t */\n\tstatic countSorting(field: string, order: Sorting[\"order\"] = \"ASC\"): Sorting {\n\t\treturn { field, order, naturalSorting: false, type: \"count\" };\n\t}\n\n\t/**\n\t * @see \\Shopware\\Core\\Framework\\DataAbstractionLayer\\Search\\Filter\\ContainsFilter.\n\t * This allows to filter documents where the value are contained in the provided field.\n\t *\n\t * Sql representation: `{field} LIKE %{value}%`\n\t */\n\tstatic contains(field: string, value: string): Filters[\"contains\"] {\n\t\treturn { type: \"contains\", field, value };\n\t}\n\n\t/**\n\t * @see \\Shopware\\Core\\Framework\\DataAbstractionLayer\\Search\\Filter\\PrefixFilter.\n\t * This allows to filter documents where the value marks the beginning of the provided field.\n\t *\n\t * Sql representation: `{field} LIKE {value}%`\n\t */\n\tstatic prefix(field: string, value: string): Filters[\"prefix\"] {\n\t\treturn { type: \"prefix\", field, value };\n\t}\n\n\t/**\n\t * @see \\Shopware\\Core\\Framework\\DataAbstractionLayer\\Search\\Filter\\SuffixFilter.\n\t * This allows to filter documents where the value marks the end of the provided field.\n\t *\n\t * Sql representation: `{field} LIKE %{value}`\n\t */\n\tstatic suffix(field: string, value: string): Filters[\"suffix\"] {\n\t\treturn { type: \"suffix\", field, value };\n\t}\n\n\t/**\n\t * @see \\Shopware\\Core\\Framework\\DataAbstractionLayer\\Search\\Filter\\EqualsAnyFilter.\n\t * This allows to filter documents where the field matches one of the provided values\n\t *\n\t * Sql representation: `{field} IN ({value}, {value})`\n\t */\n\tstatic equalsAny(\n\t\tfield: string,\n\t\tvalue: (string | number | boolean | null)[],\n\t): Filters[\"equalsAny\"] {\n\t\treturn { type: \"equalsAny\", field, value: value };\n\t}\n\n\t/**\n\t * @see \\Shopware\\Core\\Framework\\DataAbstractionLayer\\Search\\Filter\\RangeFilter.\n\t * This allows to filter documents where the field matches a defined range\n\t *\n\t * Sql representation: `{field} >= {value}`, `{field} <= {value}`, ...\n\t */\n\tstatic range(\n\t\tfield: string,\n\t\trange: Filters[\"range\"][\"parameters\"],\n\t): Filters[\"range\"] {\n\t\treturn { type: \"range\", field, parameters: range };\n\t}\n\n\t/**\n\t * @see \\Shopware\\Core\\Framework\\DataAbstractionLayer\\Search\\Filter\\EqualsFilter.\n\t * This allows to filter documents where the field matches a defined range\n\t *\n\t * Sql representation: `{field} = {value}`\n\t */\n\tstatic equals(\n\t\tfield: string,\n\t\tvalue: string | number | boolean | null,\n\t): Filters[\"equals\"] {\n\t\treturn { type: \"equals\", field, value };\n\t}\n\n\t/**\n\t * @see \\Shopware\\Core\\Framework\\DataAbstractionLayer\\Search\\Filter\\NotFilter.\n\t * This allows to filter documents which not matches for the provided filters\n\t * All above listed queries can be provided (equals, equalsAny, range, contains)\n\t *\n\t * Sql representation: `NOT({query} {operator} {query} {operator} {query})`\n\t *\n\t * @param {string} operator - and/or\n\t * @param {array} queries\n\t *\n\t * @returns {Object}\n\t */\n\tstatic not(\n\t\toperator: Filters[\"not\"][\"operator\"],\n\t\tqueries: SingleFilter[] = [],\n\t): Filters[\"not\"] {\n\t\treturn { type: \"not\", operator: operator, queries: queries };\n\t}\n\n\t/**\n\t * @see \\Shopware\\Core\\Framework\\DataAbstractionLayer\\Search\\Filter\\NotFilter.\n\t * This allows to filter documents which matches for the provided filters\n\t * All above listed queries can be provided (equals, equalsAny, range, contains)\n\t *\n\t * Sql representation: `({query} {operator} {query} {operator} {query})`\n\t *\n\t * @param {string} operator - and/or\n\t * @param {array} queries\n\t *\n\t * @returns {Object}\n\t */\n\tstatic multi(\n\t\toperator: Filters[\"multi\"][\"operator\"],\n\t\tqueries: SingleFilter[] = [],\n\t): Filters[\"multi\"] {\n\t\treturn { type: \"multi\", operator, queries };\n\t}\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dynamodb.d.ts","sourceRoot":"","sources":["../../../src/integration/dynamodb.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAEN,sBAAsB,
|
|
1
|
+
{"version":3,"file":"dynamodb.d.ts","sourceRoot":"","sources":["../../../src/integration/dynamodb.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAEN,sBAAsB,EAItB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,KAAK,uBAAuB,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE5E,qBAAa,kBAAmB,YAAW,uBAAuB,CAAC,UAAU,CAAC;IAC7E,SAAS,EAAE,sBAAsB,CAAC;IAClC,SAAS,EAAE,MAAM,CAAC;gBAEN,MAAM,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM;IAK/C,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAgBlE,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC;IAoCnD,UAAU,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IAqB3C,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAU3C"}
|
|
@@ -46,15 +46,19 @@ class DynamoDBRepository {
|
|
|
46
46
|
return shop;
|
|
47
47
|
}
|
|
48
48
|
async updateShop(shop) {
|
|
49
|
-
const cmd = new lib_dynamodb_1.
|
|
49
|
+
const cmd = new lib_dynamodb_1.UpdateCommand({
|
|
50
50
|
TableName: this.tableName,
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
51
|
+
Key: { id: shop.getShopId() },
|
|
52
|
+
UpdateExpression: "SET active = :active, #u = :url, secret = :secret, clientId = :clientId, clientSecret = :clientSecret",
|
|
53
|
+
ExpressionAttributeNames: {
|
|
54
|
+
"#u": "url",
|
|
55
|
+
},
|
|
56
|
+
ExpressionAttributeValues: {
|
|
57
|
+
":active": shop.getShopActive(),
|
|
58
|
+
":url": shop.getShopUrl(),
|
|
59
|
+
":secret": shop.getShopSecret(),
|
|
60
|
+
":clientId": shop.getShopClientId(),
|
|
61
|
+
":clientSecret": shop.getShopClientSecret(),
|
|
58
62
|
},
|
|
59
63
|
});
|
|
60
64
|
await this.docClient.send(cmd);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dynamodb.js","sourceRoot":"","sources":["../../../src/integration/dynamodb.ts"],"names":[],"mappings":";;;AACA,
|
|
1
|
+
{"version":3,"file":"dynamodb.js","sourceRoot":"","sources":["../../../src/integration/dynamodb.ts"],"names":[],"mappings":";;;AACA,wDAM+B;AAC/B,oDAA4E;AAE5E,MAAa,kBAAkB;IAC9B,SAAS,CAAyB;IAClC,SAAS,CAAS;IAElB,YAAY,MAAsB,EAAE,SAAiB;QACpD,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,SAAS,GAAG,qCAAsB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACtD,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,EAAU,EAAE,GAAW,EAAE,MAAc;QACvD,MAAM,GAAG,GAAG,IAAI,yBAAU,CAAC;YAC1B,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,IAAI,EAAE;gBACL,EAAE,EAAE,EAAE;gBACN,MAAM,EAAE,KAAK;gBACb,GAAG,EAAE,GAAG;gBACR,MAAM,EAAE,MAAM;gBACd,QAAQ,EAAE,IAAI;gBACd,YAAY,EAAE,IAAI;aAClB;SACD,CAAC,CAAC;QAEH,MAAM,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAChC,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,EAAU;QAC3B,MAAM,GAAG,GAAG,IAAI,yBAAU,CAAC;Y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BACzB,SAAS,EAAE,IAAI,CAAC,aAAa,EAAE;gBAC/B,WAAW,EAAE,IAAI,CAAC,eAAe,EAAE;gBACnC,eAAe,EAAE,IAAI,CAAC,mBAAmB,EAAE;aAC3C;SACD,CAAC,CAAC;QAEH,MAAM,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAChC,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,EAAU;QAC1B,MAAM,GAAG,GAAG,IAAI,4BAAa,CAAC;YAC7B,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,GAAG,EAAE;gBACJ,EAAE,EAAE,EAAE;aACN;SACD,CAAC,CAAC;QAEH,MAAM,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAChC,CAAC;CACD;AA5FD,gDA4FC","sourcesContent":["import type { DynamoDBClient } from \"@aws-sdk/client-dynamodb\";\nimport {\n\tDeleteCommand,\n\tDynamoDBDocumentClient,\n\tGetCommand,\n\tPutCommand,\n\tUpdateCommand,\n} from \"@aws-sdk/lib-dynamodb\";\nimport { type ShopRepositoryInterface, SimpleShop } from \"../repository.js\";\n\nexport class DynamoDBRepository implements ShopRepositoryInterface<SimpleShop> {\n\tdocClient: DynamoDBDocumentClient;\n\ttableName: string;\n\n\tconstructor(client: DynamoDBClient, tableName: string) {\n\t\tthis.tableName = tableName;\n\t\tthis.docClient = DynamoDBDocumentClient.from(client);\n\t}\n\n\tasync createShop(id: string, url: string, secret: string): Promise<void> {\n\t\tconst cmd = new PutCommand({\n\t\t\tTableName: this.tableName,\n\t\t\tItem: {\n\t\t\t\tid: id,\n\t\t\t\tactive: false,\n\t\t\t\turl: url,\n\t\t\t\tsecret: secret,\n\t\t\t\tclientId: null,\n\t\t\t\tclientSecret: null,\n\t\t\t},\n\t\t});\n\n\t\tawait this.docClient.send(cmd);\n\t}\n\n\tasync getShopById(id: string): Promise<SimpleShop | null> {\n\t\tconst cmd = new GetCommand({\n\t\t\tTableName: this.tableName,\n\t\t\tKey: {\n\t\t\t\tid: id,\n\t\t\t},\n\t\t});\n\n\t\tconst response = await this.docClient.send(cmd);\n\n\t\tif (!response.Item) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst shop = new SimpleShop(\n\t\t\tresponse.Item.id,\n\t\t\tresponse.Item.url,\n\t\t\tresponse.Item.secret,\n\t\t);\n\n\t\tif (response.Item.active === undefined) {\n\t\t\tresponse.Item.active = true;\n\t\t}\n\n\t\tshop.setShopActive(response.Item.active);\n\n\t\tif (response.Item.clientId) {\n\t\t\tshop.setShopCredentials(\n\t\t\t\tresponse.Item.clientId,\n\t\t\t\tresponse.Item.clientSecret,\n\t\t\t);\n\t\t}\n\n\t\treturn shop;\n\t}\n\n\tasync updateShop(shop: SimpleShop): Promise<void> {\n\t\tconst cmd = new UpdateCommand({\n\t\t\tTableName: this.tableName,\n\t\t\tKey: { id: shop.getShopId() },\n\t\t\tUpdateExpression:\n\t\t\t\t\"SET active = :active, #u = :url, secret = :secret, clientId = :clientId, clientSecret = :clientSecret\",\n\t\t\tExpressionAttributeNames: {\n\t\t\t\t\"#u\": \"url\",\n\t\t\t},\n\t\t\tExpressionAttributeValues: {\n\t\t\t\t\":active\": shop.getShopActive(),\n\t\t\t\t\":url\": shop.getShopUrl(),\n\t\t\t\t\":secret\": shop.getShopSecret(),\n\t\t\t\t\":clientId\": shop.getShopClientId(),\n\t\t\t\t\":clientSecret\": shop.getShopClientSecret(),\n\t\t\t},\n\t\t});\n\n\t\tawait this.docClient.send(cmd);\n\t}\n\n\tasync deleteShop(id: string): Promise<void> {\n\t\tconst cmd = new DeleteCommand({\n\t\t\tTableName: this.tableName,\n\t\t\tKey: {\n\t\t\t\tid: id,\n\t\t\t},\n\t\t});\n\n\t\tawait this.docClient.send(cmd);\n\t}\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AppServer } from "../app.js";
|
|
2
|
-
import
|
|
2
|
+
import { Context } from "../context-resolver.js";
|
|
3
3
|
import type { ShopInterface, ShopRepositoryInterface } from "../repository.js";
|
|
4
4
|
import type { Hono, Context as HonoContext } from "hono";
|
|
5
5
|
declare module "hono" {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hono.d.ts","sourceRoot":"","sources":["../../../src/integration/hono.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,
|
|
1
|
+
{"version":3,"file":"hono.d.ts","sourceRoot":"","sources":["../../../src/integration/hono.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,KAAK,EAAE,aAAa,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAE/E,OAAO,KAAK,EAAE,IAAI,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,MAAM,CAAC;AAGzD,OAAO,QAAQ,MAAM,CAAC;IACrB,UAAU,kBAAkB;QAE3B,GAAG,EAAE,SAAS,CAAC,aAAa,CAAC,CAAC;QAC9B,IAAI,EAAE,aAAa,CAAC;QAEpB,OAAO,EAAE,OAAO,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;KACzC;CACD;AAED,UAAU,gBAAgB;IACzB;;OAEG;IACH,OAAO,EAAE,MAAM,GAAG,CAAC,CAAC,CAAC,EAAE,WAAW,KAAK,MAAM,CAAC,CAAC;IAC/C;;OAEG;IACH,SAAS,EAAE,MAAM,GAAG,CAAC,CAAC,CAAC,EAAE,WAAW,KAAK,MAAM,CAAC,CAAC;IAEjD;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAEvB;;;;OAIG;IACH,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAEhC;;;;OAIG;IACH,uBAAuB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAExC;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAE9B;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAE/B;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAE7B;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAEjC;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAE7B;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAExB;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAE1B;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAE9B;;;;;;OAMG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAE5C;;OAEG;IACH,cAAc,EACX,uBAAuB,GACvB,CAAC,CAAC,CAAC,EAAE,WAAW,KAAK,uBAAuB,CAAC,CAAC;IAEjD;;OAEG;IACH,KAAK,CAAC,EAAE,CAAC,GAAG,EAAE,SAAS,KAAK,IAAI,CAAC;CACjC;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,gBAAgB,QA+LnE"}
|
|
@@ -3,6 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.configureAppServer = configureAppServer;
|
|
4
4
|
const cookie_1 = require("hono/cookie");
|
|
5
5
|
const app_js_1 = require("../app.js");
|
|
6
|
+
const context_resolver_js_1 = require("../context-resolver.js");
|
|
7
|
+
const http_client_js_1 = require("../http-client.js");
|
|
6
8
|
/**
|
|
7
9
|
* Configure the Hono server to handle the app registration and context resolution
|
|
8
10
|
*/
|
|
@@ -115,6 +117,8 @@ function configureAppServer(hono, cfg) {
|
|
|
115
117
|
return ctx.json({ message: "Shop not found" }, { status: 400 });
|
|
116
118
|
}
|
|
117
119
|
ctx.set("shop", shop);
|
|
120
|
+
// @ts-ignore
|
|
121
|
+
ctx.set("context", new context_resolver_js_1.Context(shop, {}, new http_client_js_1.HttpClient(shop)));
|
|
118
122
|
await next();
|
|
119
123
|
});
|
|
120
124
|
for (let [path, redirect] of Object.entries(cfg.appIframeRedirects || {})) {
|