@sales-planner/http-client 0.14.0 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +44 -363
- package/dist/clients/api-keys-client.d.ts +3 -3
- package/dist/clients/api-keys-client.d.ts.map +1 -1
- package/dist/clients/api-keys-client.js +3 -3
- package/dist/clients/brands-client.d.ts +18 -16
- package/dist/clients/brands-client.d.ts.map +1 -1
- package/dist/clients/brands-client.js +4 -37
- package/dist/clients/categories-client.d.ts +18 -16
- package/dist/clients/categories-client.d.ts.map +1 -1
- package/dist/clients/categories-client.js +4 -38
- package/dist/clients/coded-entity-client.d.ts +30 -0
- package/dist/clients/coded-entity-client.d.ts.map +1 -0
- package/dist/clients/coded-entity-client.js +60 -0
- package/dist/clients/crud-client.d.ts +14 -0
- package/dist/clients/crud-client.d.ts.map +1 -0
- package/dist/clients/crud-client.js +26 -0
- package/dist/clients/groups-client.d.ts +18 -16
- package/dist/clients/groups-client.d.ts.map +1 -1
- package/dist/clients/groups-client.js +4 -38
- package/dist/clients/marketplaces-client.d.ts +18 -16
- package/dist/clients/marketplaces-client.d.ts.map +1 -1
- package/dist/clients/marketplaces-client.js +4 -37
- package/dist/clients/roles-client.d.ts +6 -6
- package/dist/clients/sales-history-client.d.ts +29 -13
- package/dist/clients/sales-history-client.d.ts.map +1 -1
- package/dist/clients/sales-history-client.js +5 -5
- package/dist/clients/sales-planner-client.d.ts +12 -16
- package/dist/clients/sales-planner-client.d.ts.map +1 -1
- package/dist/clients/sales-planner-client.js +12 -17
- package/dist/clients/shop-scoped-client.d.ts +30 -0
- package/dist/clients/shop-scoped-client.d.ts.map +1 -0
- package/dist/clients/shop-scoped-client.js +58 -0
- package/dist/clients/shops-client.d.ts +6 -6
- package/dist/clients/shops-client.d.ts.map +1 -1
- package/dist/clients/shops-client.js +6 -6
- package/dist/clients/skus-client.d.ts +6 -6
- package/dist/clients/skus-client.d.ts.map +1 -1
- package/dist/clients/skus-client.js +6 -6
- package/dist/clients/statuses-client.d.ts +18 -16
- package/dist/clients/statuses-client.d.ts.map +1 -1
- package/dist/clients/statuses-client.js +4 -38
- package/dist/clients/suppliers-client.d.ts +18 -16
- package/dist/clients/suppliers-client.d.ts.map +1 -1
- package/dist/clients/suppliers-client.js +4 -37
- package/dist/clients/tenants-client.d.ts +6 -6
- package/dist/clients/tenants-client.d.ts.map +1 -1
- package/dist/clients/tenants-client.js +6 -6
- package/dist/clients/user-roles-client.d.ts +4 -4
- package/dist/clients/user-roles-client.d.ts.map +1 -1
- package/dist/clients/user-roles-client.js +4 -4
- package/dist/clients/users-client.d.ts +4 -4
- package/dist/clients/users-client.d.ts.map +1 -1
- package/dist/clients/users-client.js +4 -4
- package/package.json +2 -2
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { ImportResult, PaginatedResponse, PaginationQuery, ShopContextParams } from '@sales-planner/shared';
|
|
2
|
+
import type { ClientConfig } from './base-client.js';
|
|
3
|
+
import { ImportExportBaseClient } from './import-export-base-client.js';
|
|
4
|
+
/**
|
|
5
|
+
* Generic base client for coded shop-scoped entities.
|
|
6
|
+
* Provides standard CRUD, import/export, and example operations.
|
|
7
|
+
*
|
|
8
|
+
* @typeParam TEntity - The entity type (e.g., Brand, Category)
|
|
9
|
+
* @typeParam TCreateRequest - The create request type
|
|
10
|
+
* @typeParam TUpdateRequest - The update request type
|
|
11
|
+
* @typeParam TImportItem - The import item type
|
|
12
|
+
* @typeParam TExportItem - The export item type
|
|
13
|
+
*/
|
|
14
|
+
export declare class CodedEntityClient<TEntity, TCreateRequest, TUpdateRequest, TImportItem, TExportItem> extends ImportExportBaseClient {
|
|
15
|
+
protected readonly entityPath: string;
|
|
16
|
+
constructor(config: ClientConfig, entityPath: string);
|
|
17
|
+
getAll(ctx: ShopContextParams, query?: PaginationQuery): Promise<PaginatedResponse<TEntity>>;
|
|
18
|
+
getById(ctx: ShopContextParams, id: number): Promise<TEntity>;
|
|
19
|
+
getByCode(ctx: ShopContextParams, code: string): Promise<TEntity>;
|
|
20
|
+
create(ctx: ShopContextParams, request: TCreateRequest): Promise<TEntity>;
|
|
21
|
+
update(ctx: ShopContextParams, id: number, request: TUpdateRequest): Promise<TEntity>;
|
|
22
|
+
delete(ctx: ShopContextParams, id: number): Promise<void>;
|
|
23
|
+
importJson(ctx: ShopContextParams, items: TImportItem[]): Promise<ImportResult>;
|
|
24
|
+
importCsv(ctx: ShopContextParams, csvContent: string): Promise<ImportResult>;
|
|
25
|
+
exportJson(ctx: ShopContextParams): Promise<TExportItem[]>;
|
|
26
|
+
exportCsv(ctx: ShopContextParams): Promise<string>;
|
|
27
|
+
getExampleJson(): Promise<TImportItem[]>;
|
|
28
|
+
getExampleCsv(): Promise<string>;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=coded-entity-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coded-entity-client.d.ts","sourceRoot":"","sources":["../../src/clients/coded-entity-client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,iBAAiB,EACjB,eAAe,EACf,iBAAiB,EAClB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAExE;;;;;;;;;GASG;AACH,qBAAa,iBAAiB,CAC5B,OAAO,EACP,cAAc,EACd,cAAc,EACd,WAAW,EACX,WAAW,CACX,SAAQ,sBAAsB;IAG5B,SAAS,CAAC,QAAQ,CAAC,UAAU,EAAE,MAAM;gBADrC,MAAM,EAAE,YAAY,EACD,UAAU,EAAE,MAAM;IAOjC,MAAM,CACV,GAAG,EAAE,iBAAiB,EACtB,KAAK,CAAC,EAAE,eAAe,GACtB,OAAO,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;IAIhC,OAAO,CAAC,GAAG,EAAE,iBAAiB,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAI7D,SAAS,CAAC,GAAG,EAAE,iBAAiB,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAMjE,MAAM,CAAC,GAAG,EAAE,iBAAiB,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC;IAIzE,MAAM,CAAC,GAAG,EAAE,iBAAiB,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC;IAIrF,MAAM,CAAC,GAAG,EAAE,iBAAiB,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAMzD,UAAU,CAAC,GAAG,EAAE,iBAAiB,EAAE,KAAK,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,YAAY,CAAC;IAI/E,SAAS,CAAC,GAAG,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;IAM5E,UAAU,CAAC,GAAG,EAAE,iBAAiB,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IAI1D,SAAS,CAAC,GAAG,EAAE,iBAAiB,GAAG,OAAO,CAAC,MAAM,CAAC;IAMlD,cAAc,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;IAIxC,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC;CAGvC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { ImportExportBaseClient } from './import-export-base-client.js';
|
|
2
|
+
/**
|
|
3
|
+
* Generic base client for coded shop-scoped entities.
|
|
4
|
+
* Provides standard CRUD, import/export, and example operations.
|
|
5
|
+
*
|
|
6
|
+
* @typeParam TEntity - The entity type (e.g., Brand, Category)
|
|
7
|
+
* @typeParam TCreateRequest - The create request type
|
|
8
|
+
* @typeParam TUpdateRequest - The update request type
|
|
9
|
+
* @typeParam TImportItem - The import item type
|
|
10
|
+
* @typeParam TExportItem - The export item type
|
|
11
|
+
*/
|
|
12
|
+
export class CodedEntityClient extends ImportExportBaseClient {
|
|
13
|
+
entityPath;
|
|
14
|
+
constructor(config, entityPath) {
|
|
15
|
+
super(config);
|
|
16
|
+
this.entityPath = entityPath;
|
|
17
|
+
}
|
|
18
|
+
// CRUD operations
|
|
19
|
+
async getAll(ctx, query) {
|
|
20
|
+
return this.request('GET', `/${this.entityPath}`, { params: { ...ctx, ...query } });
|
|
21
|
+
}
|
|
22
|
+
async getById(ctx, id) {
|
|
23
|
+
return this.request('GET', `/${this.entityPath}/${id}`, { params: ctx });
|
|
24
|
+
}
|
|
25
|
+
async getByCode(ctx, code) {
|
|
26
|
+
return this.request('GET', `/${this.entityPath}/code/${encodeURIComponent(code)}`, {
|
|
27
|
+
params: ctx,
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
async create(ctx, request) {
|
|
31
|
+
return this.request('POST', `/${this.entityPath}`, { body: request, params: ctx });
|
|
32
|
+
}
|
|
33
|
+
async update(ctx, id, request) {
|
|
34
|
+
return this.request('PUT', `/${this.entityPath}/${id}`, { body: request, params: ctx });
|
|
35
|
+
}
|
|
36
|
+
async delete(ctx, id) {
|
|
37
|
+
return this.request('DELETE', `/${this.entityPath}/${id}`, { params: ctx });
|
|
38
|
+
}
|
|
39
|
+
// Import operations
|
|
40
|
+
async importJson(ctx, items) {
|
|
41
|
+
return this.request('POST', `/${this.entityPath}/import/json`, { body: items, params: ctx });
|
|
42
|
+
}
|
|
43
|
+
async importCsv(ctx, csvContent) {
|
|
44
|
+
return this.uploadCsv(`/${this.entityPath}/import/csv`, csvContent, ctx);
|
|
45
|
+
}
|
|
46
|
+
// Export operations
|
|
47
|
+
async exportJson(ctx) {
|
|
48
|
+
return this.request('GET', `/${this.entityPath}/export/json`, { params: ctx });
|
|
49
|
+
}
|
|
50
|
+
async exportCsv(ctx) {
|
|
51
|
+
return this.requestText('GET', `/${this.entityPath}/export/csv`, { params: ctx });
|
|
52
|
+
}
|
|
53
|
+
// Example operations (public, no auth required)
|
|
54
|
+
async getExampleJson() {
|
|
55
|
+
return this.requestPublic('GET', `/${this.entityPath}/examples/json`);
|
|
56
|
+
}
|
|
57
|
+
async getExampleCsv() {
|
|
58
|
+
return this.requestTextPublic('GET', `/${this.entityPath}/examples/csv`);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BaseClient, type ClientConfig } from './base-client.js';
|
|
2
|
+
/**
|
|
3
|
+
* Generic CRUD client for simple resources identified by numeric ID.
|
|
4
|
+
*/
|
|
5
|
+
export declare class CrudClient<TEntity, TCreateRequest, TUpdateRequest = TCreateRequest> extends BaseClient {
|
|
6
|
+
protected readonly resourcePath: string;
|
|
7
|
+
constructor(config: ClientConfig, resourcePath: string);
|
|
8
|
+
getAll(): Promise<TEntity[]>;
|
|
9
|
+
getById(id: number): Promise<TEntity>;
|
|
10
|
+
create(request: TCreateRequest): Promise<TEntity>;
|
|
11
|
+
update(id: number, request: TUpdateRequest): Promise<TEntity>;
|
|
12
|
+
delete(id: number): Promise<void>;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=crud-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crud-client.d.ts","sourceRoot":"","sources":["../../src/clients/crud-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,KAAK,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEjE;;GAEG;AACH,qBAAa,UAAU,CACrB,OAAO,EACP,cAAc,EACd,cAAc,GAAG,cAAc,CAC/B,SAAQ,UAAU;IAGhB,SAAS,CAAC,QAAQ,CAAC,YAAY,EAAE,MAAM;gBADvC,MAAM,EAAE,YAAY,EACD,YAAY,EAAE,MAAM;IAKnC,MAAM,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;IAI5B,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAIrC,MAAM,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC;IAIjD,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC;IAI7D,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAGxC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { BaseClient } from './base-client.js';
|
|
2
|
+
/**
|
|
3
|
+
* Generic CRUD client for simple resources identified by numeric ID.
|
|
4
|
+
*/
|
|
5
|
+
export class CrudClient extends BaseClient {
|
|
6
|
+
resourcePath;
|
|
7
|
+
constructor(config, resourcePath) {
|
|
8
|
+
super(config);
|
|
9
|
+
this.resourcePath = resourcePath;
|
|
10
|
+
}
|
|
11
|
+
async getAll() {
|
|
12
|
+
return this.request('GET', `/${this.resourcePath}`);
|
|
13
|
+
}
|
|
14
|
+
async getById(id) {
|
|
15
|
+
return this.request('GET', `/${this.resourcePath}/${id}`);
|
|
16
|
+
}
|
|
17
|
+
async create(request) {
|
|
18
|
+
return this.request('POST', `/${this.resourcePath}`, { body: request });
|
|
19
|
+
}
|
|
20
|
+
async update(id, request) {
|
|
21
|
+
return this.request('PUT', `/${this.resourcePath}/${id}`, { body: request });
|
|
22
|
+
}
|
|
23
|
+
async delete(id) {
|
|
24
|
+
return this.request('DELETE', `/${this.resourcePath}/${id}`);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
import type {
|
|
2
|
+
Group,
|
|
3
|
+
CreateGroupRequest,
|
|
4
|
+
UpdateGroupRequest,
|
|
5
|
+
ImportGroupItem,
|
|
6
|
+
GroupExportItem,
|
|
7
|
+
} from '@sales-planner/shared';
|
|
8
|
+
import type { ClientConfig } from './base-client.js';
|
|
9
|
+
import { CodedEntityClient } from './coded-entity-client.js';
|
|
10
|
+
export declare class GroupsClient extends CodedEntityClient<
|
|
11
|
+
Group,
|
|
12
|
+
CreateGroupRequest,
|
|
13
|
+
UpdateGroupRequest,
|
|
14
|
+
ImportGroupItem,
|
|
15
|
+
GroupExportItem
|
|
16
|
+
> {
|
|
17
|
+
constructor(config: ClientConfig);
|
|
16
18
|
}
|
|
17
|
-
//# sourceMappingURL=groups-client.d.ts.map
|
|
19
|
+
//# sourceMappingURL=groups-client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"groups-client.d.ts","sourceRoot":"","sources":["../../src/clients/groups-client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,KAAK,EACL,kBAAkB,EAClB,kBAAkB,EAClB,eAAe,EACf,eAAe,
|
|
1
|
+
{"version":3,"file":"groups-client.d.ts","sourceRoot":"","sources":["../../src/clients/groups-client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,KAAK,EACL,kBAAkB,EAClB,kBAAkB,EAClB,eAAe,EACf,eAAe,EAChB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAE7D,qBAAa,YAAa,SAAQ,iBAAiB,CACjD,KAAK,EACL,kBAAkB,EAClB,kBAAkB,EAClB,eAAe,EACf,eAAe,CAChB;gBACa,MAAM,EAAE,YAAY;CAGjC"}
|
|
@@ -1,40 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export class GroupsClient extends
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
async getGroup(ctx, id) {
|
|
7
|
-
return this.request('GET', `/groups/${id}`, { params: ctx });
|
|
8
|
-
}
|
|
9
|
-
async getGroupByCode(ctx, code) {
|
|
10
|
-
return this.request('GET', `/groups/code/${encodeURIComponent(code)}`, { params: ctx });
|
|
11
|
-
}
|
|
12
|
-
async createGroup(ctx, request) {
|
|
13
|
-
return this.request('POST', '/groups', { body: request, params: ctx });
|
|
14
|
-
}
|
|
15
|
-
async updateGroup(ctx, id, request) {
|
|
16
|
-
return this.request('PUT', `/groups/${id}`, { body: request, params: ctx });
|
|
17
|
-
}
|
|
18
|
-
async deleteGroup(ctx, id) {
|
|
19
|
-
return this.request('DELETE', `/groups/${id}`, { params: ctx });
|
|
20
|
-
}
|
|
21
|
-
// Import/Export methods
|
|
22
|
-
async importJson(ctx, items) {
|
|
23
|
-
return this.request('POST', '/groups/import/json', { body: items, params: ctx });
|
|
24
|
-
}
|
|
25
|
-
async importCsv(ctx, csvContent) {
|
|
26
|
-
return this.uploadCsv('/groups/import/csv', csvContent, ctx);
|
|
27
|
-
}
|
|
28
|
-
async exportJson(ctx) {
|
|
29
|
-
return this.request('GET', '/groups/export/json', { params: ctx });
|
|
30
|
-
}
|
|
31
|
-
async exportCsv(ctx) {
|
|
32
|
-
return this.requestText('GET', '/groups/export/csv', { params: ctx });
|
|
33
|
-
}
|
|
34
|
-
async getExampleJson() {
|
|
35
|
-
return this.requestPublic('GET', '/groups/examples/json');
|
|
36
|
-
}
|
|
37
|
-
async getExampleCsv() {
|
|
38
|
-
return this.requestTextPublic('GET', '/groups/examples/csv');
|
|
1
|
+
import { CodedEntityClient } from './coded-entity-client.js';
|
|
2
|
+
export class GroupsClient extends CodedEntityClient {
|
|
3
|
+
constructor(config) {
|
|
4
|
+
super(config, 'groups');
|
|
39
5
|
}
|
|
40
6
|
}
|
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
import type {
|
|
2
|
+
Marketplace,
|
|
3
|
+
CreateMarketplaceRequest,
|
|
4
|
+
UpdateMarketplaceRequest,
|
|
5
|
+
ImportMarketplaceItem,
|
|
6
|
+
MarketplaceExportItem,
|
|
7
|
+
} from '@sales-planner/shared';
|
|
8
|
+
import type { ClientConfig } from './base-client.js';
|
|
9
|
+
import { CodedEntityClient } from './coded-entity-client.js';
|
|
10
|
+
export declare class MarketplacesClient extends CodedEntityClient<
|
|
11
|
+
Marketplace,
|
|
12
|
+
CreateMarketplaceRequest,
|
|
13
|
+
UpdateMarketplaceRequest,
|
|
14
|
+
ImportMarketplaceItem,
|
|
15
|
+
MarketplaceExportItem
|
|
16
|
+
> {
|
|
17
|
+
constructor(config: ClientConfig);
|
|
16
18
|
}
|
|
17
|
-
//# sourceMappingURL=marketplaces-client.d.ts.map
|
|
19
|
+
//# sourceMappingURL=marketplaces-client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"marketplaces-client.d.ts","sourceRoot":"","sources":["../../src/clients/marketplaces-client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,wBAAwB,EACxB,wBAAwB,EACxB,qBAAqB,EACrB,qBAAqB,
|
|
1
|
+
{"version":3,"file":"marketplaces-client.d.ts","sourceRoot":"","sources":["../../src/clients/marketplaces-client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,wBAAwB,EACxB,wBAAwB,EACxB,qBAAqB,EACrB,qBAAqB,EACtB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAE7D,qBAAa,kBAAmB,SAAQ,iBAAiB,CACvD,WAAW,EACX,wBAAwB,EACxB,wBAAwB,EACxB,qBAAqB,EACrB,qBAAqB,CACtB;gBACa,MAAM,EAAE,YAAY;CAGjC"}
|
|
@@ -1,39 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export class MarketplacesClient extends
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
async getMarketplace(ctx, id) {
|
|
7
|
-
return this.request('GET', `/marketplaces/${id}`, { params: ctx });
|
|
8
|
-
}
|
|
9
|
-
async getMarketplaceByCode(ctx, code) {
|
|
10
|
-
return this.request('GET', `/marketplaces/code/${encodeURIComponent(code)}`, { params: ctx });
|
|
11
|
-
}
|
|
12
|
-
async createMarketplace(ctx, request) {
|
|
13
|
-
return this.request('POST', '/marketplaces', { body: request, params: ctx });
|
|
14
|
-
}
|
|
15
|
-
async updateMarketplace(ctx, id, request) {
|
|
16
|
-
return this.request('PUT', `/marketplaces/${id}`, { body: request, params: ctx });
|
|
17
|
-
}
|
|
18
|
-
async deleteMarketplace(ctx, id) {
|
|
19
|
-
return this.request('DELETE', `/marketplaces/${id}`, { params: ctx });
|
|
20
|
-
}
|
|
21
|
-
async importJson(ctx, items) {
|
|
22
|
-
return this.request('POST', '/marketplaces/import/json', { body: items, params: ctx });
|
|
23
|
-
}
|
|
24
|
-
async importCsv(ctx, csvContent) {
|
|
25
|
-
return this.uploadCsv('/marketplaces/import/csv', csvContent, ctx);
|
|
26
|
-
}
|
|
27
|
-
async exportJson(ctx) {
|
|
28
|
-
return this.request('GET', '/marketplaces/export/json', { params: ctx });
|
|
29
|
-
}
|
|
30
|
-
async exportCsv(ctx) {
|
|
31
|
-
return this.requestText('GET', '/marketplaces/export/csv', { params: ctx });
|
|
32
|
-
}
|
|
33
|
-
async getExampleJson() {
|
|
34
|
-
return this.requestPublic('GET', '/marketplaces/examples/json');
|
|
35
|
-
}
|
|
36
|
-
async getExampleCsv() {
|
|
37
|
-
return this.requestTextPublic('GET', '/marketplaces/examples/csv');
|
|
1
|
+
import { CodedEntityClient } from './coded-entity-client.js';
|
|
2
|
+
export class MarketplacesClient extends CodedEntityClient {
|
|
3
|
+
constructor(config) {
|
|
4
|
+
super(config, 'marketplaces');
|
|
38
5
|
}
|
|
39
6
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { Role, CreateRoleRequest, UpdateRoleRequest } from '@sales-planner/shared';
|
|
2
2
|
import { BaseClient } from './base-client.js';
|
|
3
3
|
export declare class RolesClient extends BaseClient {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
getRoles(): Promise<Role[]>;
|
|
5
|
+
getRole(id: number): Promise<Role>;
|
|
6
|
+
createRole(request: CreateRoleRequest): Promise<Role>;
|
|
7
|
+
updateRole(id: number, request: UpdateRoleRequest): Promise<Role>;
|
|
8
|
+
deleteRole(id: number): Promise<void>;
|
|
9
9
|
}
|
|
10
|
-
//# sourceMappingURL=roles-client.d.ts.map
|
|
10
|
+
//# sourceMappingURL=roles-client.d.ts.map
|
|
@@ -1,16 +1,32 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type {
|
|
2
|
+
SalesHistory,
|
|
3
|
+
CreateSalesHistoryRequest,
|
|
4
|
+
UpdateSalesHistoryRequest,
|
|
5
|
+
ImportSalesHistoryItem,
|
|
6
|
+
SalesHistoryExportItem,
|
|
7
|
+
SalesHistoryImportResult,
|
|
8
|
+
PeriodQuery,
|
|
9
|
+
ShopContextParams,
|
|
10
|
+
} from '@sales-planner/shared';
|
|
2
11
|
import { ImportExportBaseClient } from './import-export-base-client.js';
|
|
3
12
|
export declare class SalesHistoryClient extends ImportExportBaseClient {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
getAll(ctx: ShopContextParams, query?: PeriodQuery): Promise<SalesHistory[]>;
|
|
14
|
+
getById(ctx: ShopContextParams, id: number): Promise<SalesHistory>;
|
|
15
|
+
create(ctx: ShopContextParams, request: CreateSalesHistoryRequest): Promise<SalesHistory>;
|
|
16
|
+
update(
|
|
17
|
+
ctx: ShopContextParams,
|
|
18
|
+
id: number,
|
|
19
|
+
request: UpdateSalesHistoryRequest,
|
|
20
|
+
): Promise<SalesHistory>;
|
|
21
|
+
delete(ctx: ShopContextParams, id: number): Promise<void>;
|
|
22
|
+
importJson(
|
|
23
|
+
ctx: ShopContextParams,
|
|
24
|
+
items: ImportSalesHistoryItem[],
|
|
25
|
+
): Promise<SalesHistoryImportResult>;
|
|
26
|
+
importCsv(ctx: ShopContextParams, csvContent: string): Promise<SalesHistoryImportResult>;
|
|
27
|
+
exportJson(ctx: ShopContextParams, query?: PeriodQuery): Promise<SalesHistoryExportItem[]>;
|
|
28
|
+
exportCsv(ctx: ShopContextParams, query?: PeriodQuery): Promise<string>;
|
|
29
|
+
getExampleJson(): Promise<ImportSalesHistoryItem[]>;
|
|
30
|
+
getExampleCsv(): Promise<string>;
|
|
15
31
|
}
|
|
16
|
-
//# sourceMappingURL=sales-history-client.d.ts.map
|
|
32
|
+
//# sourceMappingURL=sales-history-client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sales-history-client.d.ts","sourceRoot":"","sources":["../../src/clients/sales-history-client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,yBAAyB,EACzB,yBAAyB,EACzB,sBAAsB,EACtB,sBAAsB,EACtB,wBAAwB,EACxB,WAAW,EACX,iBAAiB,EAClB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAExE,qBAAa,kBAAmB,SAAQ,sBAAsB;IACtD,
|
|
1
|
+
{"version":3,"file":"sales-history-client.d.ts","sourceRoot":"","sources":["../../src/clients/sales-history-client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,yBAAyB,EACzB,yBAAyB,EACzB,sBAAsB,EAC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ExportBaseClient } from './import-export-base-client.js';
|
|
2
2
|
export class SalesHistoryClient extends ImportExportBaseClient {
|
|
3
|
-
async
|
|
3
|
+
async getAll(ctx, query) {
|
|
4
4
|
return this.request('GET', '/sales-history', { params: { ...ctx, ...query } });
|
|
5
5
|
}
|
|
6
|
-
async
|
|
6
|
+
async getById(ctx, id) {
|
|
7
7
|
return this.request('GET', `/sales-history/${id}`, { params: ctx });
|
|
8
8
|
}
|
|
9
|
-
async
|
|
9
|
+
async create(ctx, request) {
|
|
10
10
|
return this.request('POST', '/sales-history', { body: request, params: ctx });
|
|
11
11
|
}
|
|
12
|
-
async
|
|
12
|
+
async update(ctx, id, request) {
|
|
13
13
|
return this.request('PUT', `/sales-history/${id}`, { body: request, params: ctx });
|
|
14
14
|
}
|
|
15
|
-
async
|
|
15
|
+
async delete(ctx, id) {
|
|
16
16
|
return this.request('DELETE', `/sales-history/${id}`, { params: ctx });
|
|
17
17
|
}
|
|
18
18
|
async importJson(ctx, items) {
|
|
@@ -1,18 +1,14 @@
|
|
|
1
|
+
import type { Brand, CreateBrandRequest, UpdateBrandRequest, ImportBrandItem, BrandExportItem, Category, CreateCategoryRequest, UpdateCategoryRequest, ImportCategoryItem, CategoryExportItem, Group, CreateGroupRequest, UpdateGroupRequest, ImportGroupItem, GroupExportItem, Status, CreateStatusRequest, UpdateStatusRequest, ImportStatusItem, StatusExportItem, Supplier, CreateSupplierRequest, UpdateSupplierRequest, ImportSupplierItem, SupplierExportItem, Marketplace, CreateMarketplaceRequest, UpdateMarketplaceRequest, ImportMarketplaceItem, MarketplaceExportItem, Role, CreateRoleRequest, UpdateRoleRequest, SalesHistory, CreateSalesHistoryRequest, UpdateSalesHistoryRequest, ImportSalesHistoryItem, SalesHistoryExportItem, SalesHistoryImportResult, SalesHistoryQuery } from '@sales-planner/shared';
|
|
1
2
|
import type { ClientConfig } from './base-client.js';
|
|
3
|
+
import { CodedEntityClient } from './coded-entity-client.js';
|
|
4
|
+
import { CrudClient } from './crud-client.js';
|
|
5
|
+
import { ShopScopedClient } from './shop-scoped-client.js';
|
|
2
6
|
import { MeClient } from './me-client.js';
|
|
3
7
|
import { MetadataClient } from './metadata-client.js';
|
|
4
8
|
import { UsersClient } from './users-client.js';
|
|
5
9
|
import { TenantsClient } from './tenants-client.js';
|
|
6
10
|
import { ShopsClient } from './shops-client.js';
|
|
7
11
|
import { SkusClient } from './skus-client.js';
|
|
8
|
-
import { BrandsClient } from './brands-client.js';
|
|
9
|
-
import { CategoriesClient } from './categories-client.js';
|
|
10
|
-
import { GroupsClient } from './groups-client.js';
|
|
11
|
-
import { StatusesClient } from './statuses-client.js';
|
|
12
|
-
import { SuppliersClient } from './suppliers-client.js';
|
|
13
|
-
import { SalesHistoryClient } from './sales-history-client.js';
|
|
14
|
-
import { MarketplacesClient } from './marketplaces-client.js';
|
|
15
|
-
import { RolesClient } from './roles-client.js';
|
|
16
12
|
import { UserRolesClient } from './user-roles-client.js';
|
|
17
13
|
import { ApiKeysClient } from './api-keys-client.js';
|
|
18
14
|
export declare class SalesPlannerClient {
|
|
@@ -23,14 +19,14 @@ export declare class SalesPlannerClient {
|
|
|
23
19
|
readonly tenants: TenantsClient;
|
|
24
20
|
readonly shops: ShopsClient;
|
|
25
21
|
readonly skus: SkusClient;
|
|
26
|
-
readonly brands:
|
|
27
|
-
readonly categories:
|
|
28
|
-
readonly groups:
|
|
29
|
-
readonly statuses:
|
|
30
|
-
readonly suppliers:
|
|
31
|
-
readonly
|
|
32
|
-
readonly
|
|
33
|
-
readonly roles:
|
|
22
|
+
readonly brands: CodedEntityClient<Brand, CreateBrandRequest, UpdateBrandRequest, ImportBrandItem, BrandExportItem>;
|
|
23
|
+
readonly categories: CodedEntityClient<Category, CreateCategoryRequest, UpdateCategoryRequest, ImportCategoryItem, CategoryExportItem>;
|
|
24
|
+
readonly groups: CodedEntityClient<Group, CreateGroupRequest, UpdateGroupRequest, ImportGroupItem, GroupExportItem>;
|
|
25
|
+
readonly statuses: CodedEntityClient<Status, CreateStatusRequest, UpdateStatusRequest, ImportStatusItem, StatusExportItem>;
|
|
26
|
+
readonly suppliers: CodedEntityClient<Supplier, CreateSupplierRequest, UpdateSupplierRequest, ImportSupplierItem, SupplierExportItem>;
|
|
27
|
+
readonly marketplaces: CodedEntityClient<Marketplace, CreateMarketplaceRequest, UpdateMarketplaceRequest, ImportMarketplaceItem, MarketplaceExportItem>;
|
|
28
|
+
readonly salesHistory: ShopScopedClient<SalesHistory, CreateSalesHistoryRequest, UpdateSalesHistoryRequest, ImportSalesHistoryItem, SalesHistoryExportItem, SalesHistoryImportResult, SalesHistoryQuery>;
|
|
29
|
+
readonly roles: CrudClient<Role, CreateRoleRequest, UpdateRoleRequest>;
|
|
34
30
|
readonly userRoles: UserRolesClient;
|
|
35
31
|
readonly apiKeys: ApiKeysClient;
|
|
36
32
|
constructor(config: ClientConfig);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sales-planner-client.d.ts","sourceRoot":"","sources":["../../src/clients/sales-planner-client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"sales-planner-client.d.ts","sourceRoot":"","sources":["../../src/clients/sales-planner-client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,KAAK,EACL,kBAAkB,EAClB,kBAAkB,EAClB,eAAe,EACf,eAAe,EACf,QAAQ,EACR,qBAAqB,EACrB,qBAAqB,EACrB,kBAAkB,EAClB,kBAAkB,EAClB,KAAK,EACL,kBAAkB,EAClB,kBAAkB,EAClB,eAAe,EACf,eAAe,EACf,MAAM,EACN,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,EAChB,gBAAgB,EAChB,QAAQ,EACR,qBAAqB,EACrB,qBAAqB,EACrB,kBAAkB,EAClB,kBAAkB,EAClB,WAAW,EACX,wBAAwB,EACxB,wBAAwB,EACxB,qBAAqB,EACrB,qBAAqB,EACrB,IAAI,EACJ,iBAAiB,EACjB,iBAAiB,EACjB,YAAY,EACZ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B,EACrB,qBAAqB,EACrB,kBAAkB,EAClB,kBAAkB,CACnB,CAAC;IACF,QAAQ,CAAC,MAAM,EAAE,iBAAiB,CAChC,KAAK,EACL,kBAAkB,EAClB,kBAAkB,EAClB,eAAe,EACf,eAAe,CAChB,CAAC;IACF,QAAQ,CAAC,QAAQ,EAAE,iBAAiB,CAClC,MAAM,EACN,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,EAChB,gBAAgB,CACjB,CAAC;IACF,QAAQ,CAAC,SAAS,EAAE,iBAAiB,CACnC,QAAQ,EACR,qBAAqB,EACrB,qBAAqB,EACrB,kBAAkB,EAClB,kBAAkB,CACnB,CAAC;IACF,QAAQ,CAAC,YAAY,EAAE,iBAAiB,CACtC,WAAW,EACX,wBAAwB,EACxB,wBAAwB,EACxB,qBAAqB,EACrB,qBAAqB,CACtB,CAAC;IACF,QAAQ,CAAC,YAAY,EAAE,gBAAgB,CACrC,YAAY,EACZ,yBAAyB,EACzB,yBAAyB,EACzB,sBAAsB,EACtB,sBAAsB,EACtB,wBAAwB,EACxB,iBAAiB,CAClB,CAAC;IACF,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC,IAAI,EAAE,iBAAiB,EAAE,iBAAiB,CAAC,CAAC;IACvE,QAAQ,CAAC,SAAS,EAAE,eAAe,CAAC;IACpC,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC;gBAEpB,MAAM,EAAE,YAAY;IAqB1B,OAAO,IAAI,OAAO,CAAC,MAAM,CAAC;IAQ1B,SAAS,IAAI,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;CAOhE"}
|
|
@@ -1,18 +1,13 @@
|
|
|
1
1
|
import { ApiError } from './base-client.js';
|
|
2
|
+
import { CodedEntityClient } from './coded-entity-client.js';
|
|
3
|
+
import { CrudClient } from './crud-client.js';
|
|
4
|
+
import { ShopScopedClient } from './shop-scoped-client.js';
|
|
2
5
|
import { MeClient } from './me-client.js';
|
|
3
6
|
import { MetadataClient } from './metadata-client.js';
|
|
4
7
|
import { UsersClient } from './users-client.js';
|
|
5
8
|
import { TenantsClient } from './tenants-client.js';
|
|
6
9
|
import { ShopsClient } from './shops-client.js';
|
|
7
10
|
import { SkusClient } from './skus-client.js';
|
|
8
|
-
import { BrandsClient } from './brands-client.js';
|
|
9
|
-
import { CategoriesClient } from './categories-client.js';
|
|
10
|
-
import { GroupsClient } from './groups-client.js';
|
|
11
|
-
import { StatusesClient } from './statuses-client.js';
|
|
12
|
-
import { SuppliersClient } from './suppliers-client.js';
|
|
13
|
-
import { SalesHistoryClient } from './sales-history-client.js';
|
|
14
|
-
import { MarketplacesClient } from './marketplaces-client.js';
|
|
15
|
-
import { RolesClient } from './roles-client.js';
|
|
16
11
|
import { UserRolesClient } from './user-roles-client.js';
|
|
17
12
|
import { ApiKeysClient } from './api-keys-client.js';
|
|
18
13
|
export class SalesPlannerClient {
|
|
@@ -29,8 +24,8 @@ export class SalesPlannerClient {
|
|
|
29
24
|
groups;
|
|
30
25
|
statuses;
|
|
31
26
|
suppliers;
|
|
32
|
-
salesHistory;
|
|
33
27
|
marketplaces;
|
|
28
|
+
salesHistory;
|
|
34
29
|
roles;
|
|
35
30
|
userRoles;
|
|
36
31
|
apiKeys;
|
|
@@ -42,14 +37,14 @@ export class SalesPlannerClient {
|
|
|
42
37
|
this.tenants = new TenantsClient(config);
|
|
43
38
|
this.shops = new ShopsClient(config);
|
|
44
39
|
this.skus = new SkusClient(config);
|
|
45
|
-
this.brands = new
|
|
46
|
-
this.categories = new
|
|
47
|
-
this.groups = new
|
|
48
|
-
this.statuses = new
|
|
49
|
-
this.suppliers = new
|
|
50
|
-
this.
|
|
51
|
-
this.
|
|
52
|
-
this.roles = new
|
|
40
|
+
this.brands = new CodedEntityClient(config, 'brands');
|
|
41
|
+
this.categories = new CodedEntityClient(config, 'categories');
|
|
42
|
+
this.groups = new CodedEntityClient(config, 'groups');
|
|
43
|
+
this.statuses = new CodedEntityClient(config, 'statuses');
|
|
44
|
+
this.suppliers = new CodedEntityClient(config, 'suppliers');
|
|
45
|
+
this.marketplaces = new CodedEntityClient(config, 'marketplaces');
|
|
46
|
+
this.salesHistory = new ShopScopedClient(config, 'sales-history');
|
|
47
|
+
this.roles = new CrudClient(config, 'roles');
|
|
53
48
|
this.userRoles = new UserRolesClient(config);
|
|
54
49
|
this.apiKeys = new ApiKeysClient(config);
|
|
55
50
|
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { PaginatedResponse, ShopContextParams } from '@sales-planner/shared';
|
|
2
|
+
import { ImportExportBaseClient } from './import-export-base-client.js';
|
|
3
|
+
import type { ClientConfig } from './base-client.js';
|
|
4
|
+
/**
|
|
5
|
+
* Generic client for shop-scoped resources with import/export capabilities.
|
|
6
|
+
*
|
|
7
|
+
* @typeParam TEntity - The entity type
|
|
8
|
+
* @typeParam TCreateRequest - The create request type
|
|
9
|
+
* @typeParam TUpdateRequest - The update request type
|
|
10
|
+
* @typeParam TImportItem - The import item type
|
|
11
|
+
* @typeParam TExportItem - The export item type
|
|
12
|
+
* @typeParam TImportResult - The import result type
|
|
13
|
+
* @typeParam TQuery - The query type for getAll/export (defaults to empty object)
|
|
14
|
+
*/
|
|
15
|
+
export declare class ShopScopedClient<TEntity, TCreateRequest, TUpdateRequest, TImportItem, TExportItem, TImportResult, TQuery = Record<string, never>> extends ImportExportBaseClient {
|
|
16
|
+
protected readonly resourcePath: string;
|
|
17
|
+
constructor(config: ClientConfig, resourcePath: string);
|
|
18
|
+
getAll(ctx: ShopContextParams, query?: TQuery): Promise<PaginatedResponse<TEntity>>;
|
|
19
|
+
getById(ctx: ShopContextParams, id: number): Promise<TEntity>;
|
|
20
|
+
create(ctx: ShopContextParams, request: TCreateRequest): Promise<TEntity>;
|
|
21
|
+
update(ctx: ShopContextParams, id: number, request: TUpdateRequest): Promise<TEntity>;
|
|
22
|
+
delete(ctx: ShopContextParams, id: number): Promise<void>;
|
|
23
|
+
importJson(ctx: ShopContextParams, items: TImportItem[]): Promise<TImportResult>;
|
|
24
|
+
importCsv(ctx: ShopContextParams, csvContent: string): Promise<TImportResult>;
|
|
25
|
+
exportJson(ctx: ShopContextParams, query?: TQuery): Promise<TExportItem[]>;
|
|
26
|
+
exportCsv(ctx: ShopContextParams, query?: TQuery): Promise<string>;
|
|
27
|
+
getExampleJson(): Promise<TImportItem[]>;
|
|
28
|
+
getExampleCsv(): Promise<string>;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=shop-scoped-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shop-scoped-client.d.ts","sourceRoot":"","sources":["../../src/clients/shop-scoped-client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAClF,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAErD;;;;;;;;;;GAUG;AACH,qBAAa,gBAAgB,CAC3B,OAAO,EACP,cAAc,EACd,cAAc,EACd,WAAW,EACX,WAAW,EACX,aAAa,EACb,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAC9B,SAAQ,sBAAsB;IAG5B,SAAS,CAAC,QAAQ,CAAC,YAAY,EAAE,MAAM;gBADvC,MAAM,EAAE,YAAY,EACD,YAAY,EAAE,MAAM;IAKnC,MAAM,CAAC,GAAG,EAAE,iBAAiB,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;IAMnF,OAAO,CAAC,GAAG,EAAE,iBAAiB,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAI7D,MAAM,CAAC,GAAG,EAAE,iBAAiB,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,O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