@haus-tech/product-import-export-plugin 3.3.11-next.1 → 3.3.11
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/CHANGELOG.md +6 -0
- package/package.json +1 -1
- package/src/api/plugin.controller.d.ts +32 -2
- package/src/api/plugin.controller.js +30 -4
- package/src/api/plugin.controller.js.map +1 -1
- package/src/api/product-export.controller.js +6 -0
- package/src/api/product-export.controller.js.map +1 -1
- package/src/api/product-import.controller.js +1 -0
- package/src/api/product-import.controller.js.map +1 -1
- package/src/dashboard/utils.ts +18 -3
- package/src/ui/components/product-import.component.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
## 3.3.11-next.1
|
|
2
|
+
|
|
3
|
+
### 🚀 Features
|
|
4
|
+
|
|
5
|
+
- **product-import-export-plugin:** backport id export field + customExportColumns to 3.5 line (3.3.11-next.0) ([#22](https://github.com/WeAreHausTech/haus-tech-vendure-plugins-public/pull/22))
|
|
6
|
+
|
|
1
7
|
## 3.3.11-next.0
|
|
2
8
|
|
|
3
9
|
### 🚀 Features
|
package/package.json
CHANGED
|
@@ -1,8 +1,38 @@
|
|
|
1
1
|
import { RequestContext } from '@vendure/core';
|
|
2
2
|
import { PluginInitOptions } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* The subset of plugin options that the admin UIs need. This is an explicit
|
|
5
|
+
* allow-list: the raw options object carries storage strategies (and therefore
|
|
6
|
+
* cloud credentials) and MUST never be serialized to a client.
|
|
7
|
+
*/
|
|
8
|
+
export type PublicPluginConfig = {
|
|
9
|
+
importOptions: {
|
|
10
|
+
visibleOptions?: PluginInitOptions['importOptions']['visibleOptions'];
|
|
11
|
+
defaultOptions: {
|
|
12
|
+
updateProductSlug?: boolean;
|
|
13
|
+
restoreSoftDeleted?: boolean;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
exportOptions: {
|
|
17
|
+
defaultFileName?: string;
|
|
18
|
+
exportAssetsAsOptions?: PluginInitOptions['exportOptions']['exportAssetsAsOptions'];
|
|
19
|
+
defaultExportAssetsAs?: PluginInitOptions['exportOptions']['defaultExportAssetsAs'];
|
|
20
|
+
defaultExportFields?: PluginInitOptions['exportOptions']['defaultExportFields'];
|
|
21
|
+
requiredExportFields?: PluginInitOptions['exportOptions']['requiredExportFields'];
|
|
22
|
+
customExportColumns?: Array<{
|
|
23
|
+
name: string;
|
|
24
|
+
}>;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
export type PublicChannelInfo = {
|
|
28
|
+
code: string;
|
|
29
|
+
defaultLanguageCode: string;
|
|
30
|
+
availableLanguageCodes: string[];
|
|
31
|
+
};
|
|
32
|
+
export declare function toPublicPluginConfig(options: PluginInitOptions): PublicPluginConfig;
|
|
3
33
|
export declare class ProductImportExportPluginController {
|
|
4
34
|
private options;
|
|
5
35
|
constructor(options: PluginInitOptions);
|
|
6
|
-
getConfig():
|
|
7
|
-
getChannel(ctx: RequestContext):
|
|
36
|
+
getConfig(): PublicPluginConfig;
|
|
37
|
+
getChannel(ctx: RequestContext): PublicChannelInfo;
|
|
8
38
|
}
|
|
@@ -13,34 +13,60 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.ProductImportExportPluginController = void 0;
|
|
16
|
+
exports.toPublicPluginConfig = toPublicPluginConfig;
|
|
16
17
|
const core_1 = require("@vendure/core");
|
|
17
18
|
const common_1 = require("@nestjs/common");
|
|
18
19
|
const constants_1 = require("../constants");
|
|
20
|
+
function toPublicPluginConfig(options) {
|
|
21
|
+
const { importOptions, exportOptions } = options;
|
|
22
|
+
return {
|
|
23
|
+
importOptions: {
|
|
24
|
+
visibleOptions: importOptions?.visibleOptions,
|
|
25
|
+
// Pick fields one by one: the ImportOptions type also permits storage
|
|
26
|
+
// strategies inside defaultOptions, so a raw copy could leak credentials.
|
|
27
|
+
defaultOptions: {
|
|
28
|
+
updateProductSlug: importOptions?.defaultOptions?.updateProductSlug,
|
|
29
|
+
restoreSoftDeleted: importOptions?.defaultOptions?.restoreSoftDeleted,
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
exportOptions: {
|
|
33
|
+
defaultFileName: exportOptions?.defaultFileName,
|
|
34
|
+
exportAssetsAsOptions: exportOptions?.exportAssetsAsOptions,
|
|
35
|
+
defaultExportAssetsAs: exportOptions?.defaultExportAssetsAs,
|
|
36
|
+
defaultExportFields: exportOptions?.defaultExportFields,
|
|
37
|
+
requiredExportFields: exportOptions?.requiredExportFields,
|
|
38
|
+
customExportColumns: exportOptions?.customExportColumns?.map(({ name }) => ({ name })),
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
}
|
|
19
42
|
let ProductImportExportPluginController = class ProductImportExportPluginController {
|
|
20
43
|
options;
|
|
21
44
|
constructor(options) {
|
|
22
45
|
this.options = options;
|
|
23
46
|
}
|
|
24
47
|
getConfig() {
|
|
25
|
-
return this.options;
|
|
48
|
+
return toPublicPluginConfig(this.options);
|
|
26
49
|
}
|
|
27
50
|
getChannel(ctx) {
|
|
28
|
-
|
|
51
|
+
const { code, defaultLanguageCode, availableLanguageCodes } = ctx.channel;
|
|
52
|
+
return { code, defaultLanguageCode, availableLanguageCodes };
|
|
29
53
|
}
|
|
30
54
|
};
|
|
31
55
|
exports.ProductImportExportPluginController = ProductImportExportPluginController;
|
|
32
56
|
__decorate([
|
|
33
57
|
(0, common_1.Get)('config'),
|
|
58
|
+
(0, core_1.Allow)(core_1.Permission.ReadCatalog, core_1.Permission.ReadProduct),
|
|
34
59
|
__metadata("design:type", Function),
|
|
35
60
|
__metadata("design:paramtypes", []),
|
|
36
|
-
__metadata("design:returntype",
|
|
61
|
+
__metadata("design:returntype", Object)
|
|
37
62
|
], ProductImportExportPluginController.prototype, "getConfig", null);
|
|
38
63
|
__decorate([
|
|
39
64
|
(0, common_1.Get)('channel'),
|
|
65
|
+
(0, core_1.Allow)(core_1.Permission.ReadCatalog, core_1.Permission.ReadProduct),
|
|
40
66
|
__param(0, (0, core_1.Ctx)()),
|
|
41
67
|
__metadata("design:type", Function),
|
|
42
68
|
__metadata("design:paramtypes", [core_1.RequestContext]),
|
|
43
|
-
__metadata("design:returntype",
|
|
69
|
+
__metadata("design:returntype", Object)
|
|
44
70
|
], ProductImportExportPluginController.prototype, "getChannel", null);
|
|
45
71
|
exports.ProductImportExportPluginController = ProductImportExportPluginController = __decorate([
|
|
46
72
|
(0, common_1.Controller)('product-import-export'),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.controller.js","sourceRoot":"","sources":["../../../../../packages/product-import-export-plugin/src/api/plugin.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"plugin.controller.js","sourceRoot":"","sources":["../../../../../packages/product-import-export-plugin/src/api/plugin.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAkCA,oDAqBC;AAvDD,wCAAsE;AACtE,2CAAwD;AACxD,4CAAmE;AAgCnE,SAAgB,oBAAoB,CAAC,OAA0B;IAC7D,MAAM,EAAE,aAAa,EAAE,aAAa,EAAE,GAAG,OAAO,CAAA;IAChD,OAAO;QACL,aAAa,EAAE;YACb,cAAc,EAAE,aAAa,EAAE,cAAc;YAC7C,sEAAsE;YACtE,0EAA0E;YAC1E,cAAc,EAAE;gBACd,iBAAiB,EAAE,aAAa,EAAE,cAAc,EAAE,iBAAiB;gBACnE,kBAAkB,EAAE,aAAa,EAAE,cAAc,EAAE,kBAAkB;aACtE;SACF;QACD,aAAa,EAAE;YACb,eAAe,EAAE,aAAa,EAAE,eAAe;YAC/C,qBAAqB,EAAE,aAAa,EAAE,qBAAqB;YAC3D,qBAAqB,EAAE,aAAa,EAAE,qBAAqB;YAC3D,mBAAmB,EAAE,aAAa,EAAE,mBAAmB;YACvD,oBAAoB,EAAE,aAAa,EAAE,oBAAoB;YACzD,mBAAmB,EAAE,aAAa,EAAE,mBAAmB,EAAE,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;SACvF;KACF,CAAA;AACH,CAAC;AAGM,IAAM,mCAAmC,GAAzC,MAAM,mCAAmC;IACoB;IAAlE,YAAkE,OAA0B;QAA1B,YAAO,GAAP,OAAO,CAAmB;IAAG,CAAC;IAIhG,SAAS;QACP,OAAO,oBAAoB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IAC3C,CAAC;IAID,UAAU,CAAQ,GAAmB;QACnC,MAAM,EAAE,IAAI,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,GAAG,GAAG,CAAC,OAAO,CAAA;QACzE,OAAO,EAAE,IAAI,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,CAAA;IAC9D,CAAC;CACF,CAAA;AAfY,kFAAmC;AAK9C;IAFC,IAAA,YAAG,EAAC,QAAQ,CAAC;IACb,IAAA,YAAK,EAAC,iBAAU,CAAC,WAAW,EAAE,iBAAU,CAAC,WAAW,CAAC;;;;oEAGrD;AAID;IAFC,IAAA,YAAG,EAAC,SAAS,CAAC;IACd,IAAA,YAAK,EAAC,iBAAU,CAAC,WAAW,EAAE,iBAAU,CAAC,WAAW,CAAC;IAC1C,WAAA,IAAA,UAAG,GAAE,CAAA;;qCAAM,qBAAc;;qEAGpC;8CAdU,mCAAmC;IAD/C,IAAA,mBAAU,EAAC,uBAAuB,CAAC;IAErB,WAAA,IAAA,eAAM,EAAC,gDAAoC,CAAC,CAAA;;GAD9C,mCAAmC,CAe/C"}
|
|
@@ -187,6 +187,7 @@ let ProductExportController = class ProductExportController {
|
|
|
187
187
|
exports.ProductExportController = ProductExportController;
|
|
188
188
|
__decorate([
|
|
189
189
|
(0, common_1.Post)('export'),
|
|
190
|
+
(0, core_1.Allow)(core_1.Permission.UpdateCatalog, core_1.Permission.UpdateProduct),
|
|
190
191
|
__param(0, (0, core_1.Ctx)()),
|
|
191
192
|
__param(1, (0, common_1.Res)()),
|
|
192
193
|
__param(2, (0, common_1.Query)('fileName')),
|
|
@@ -200,6 +201,7 @@ __decorate([
|
|
|
200
201
|
], ProductExportController.prototype, "exportProducts", null);
|
|
201
202
|
__decorate([
|
|
202
203
|
(0, common_1.Post)('export-all'),
|
|
204
|
+
(0, core_1.Allow)(core_1.Permission.UpdateCatalog, core_1.Permission.UpdateProduct),
|
|
203
205
|
__param(0, (0, core_1.Ctx)()),
|
|
204
206
|
__param(1, (0, common_1.Query)('fileName')),
|
|
205
207
|
__param(2, (0, common_1.Query)('customFields')),
|
|
@@ -211,6 +213,7 @@ __decorate([
|
|
|
211
213
|
], ProductExportController.prototype, "exportAllProducts", null);
|
|
212
214
|
__decorate([
|
|
213
215
|
(0, common_1.Get)('download/:fileName'),
|
|
216
|
+
(0, core_1.Allow)(core_1.Permission.ReadCatalog, core_1.Permission.ReadProduct),
|
|
214
217
|
__param(0, (0, core_1.Ctx)()),
|
|
215
218
|
__param(1, (0, common_1.Res)()),
|
|
216
219
|
__param(2, (0, common_1.Param)('fileName')),
|
|
@@ -220,6 +223,7 @@ __decorate([
|
|
|
220
223
|
], ProductExportController.prototype, "downloadExport", null);
|
|
221
224
|
__decorate([
|
|
222
225
|
(0, common_1.Delete)('delete/:fileName'),
|
|
226
|
+
(0, core_1.Allow)(core_1.Permission.UpdateCatalog, core_1.Permission.UpdateProduct),
|
|
223
227
|
__param(0, (0, core_1.Ctx)()),
|
|
224
228
|
__param(1, (0, common_1.Param)('fileName')),
|
|
225
229
|
__metadata("design:type", Function),
|
|
@@ -228,6 +232,7 @@ __decorate([
|
|
|
228
232
|
], ProductExportController.prototype, "deleteExport", null);
|
|
229
233
|
__decorate([
|
|
230
234
|
(0, common_1.Post)('custom-fields'),
|
|
235
|
+
(0, core_1.Allow)(core_1.Permission.ReadCatalog, core_1.Permission.ReadProduct),
|
|
231
236
|
__param(0, (0, core_1.Ctx)()),
|
|
232
237
|
__param(1, (0, common_1.Body)()),
|
|
233
238
|
__metadata("design:type", Function),
|
|
@@ -236,6 +241,7 @@ __decorate([
|
|
|
236
241
|
], ProductExportController.prototype, "getCustomFields", null);
|
|
237
242
|
__decorate([
|
|
238
243
|
(0, common_1.Get)('exported-files'),
|
|
244
|
+
(0, core_1.Allow)(core_1.Permission.ReadCatalog, core_1.Permission.ReadProduct),
|
|
239
245
|
__param(0, (0, core_1.Ctx)()),
|
|
240
246
|
__metadata("design:type", Function),
|
|
241
247
|
__metadata("design:paramtypes", [core_1.RequestContext]),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"product-export.controller.js","sourceRoot":"","sources":["../../../../../packages/product-import-export-plugin/src/api/product-export.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"product-export.controller.js","sourceRoot":"","sources":["../../../../../packages/product-import-export-plugin/src/api/product-export.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,wCAA0E;AAC1E,2CAWuB;AAEvB,+EAAyE;AACzE,2FAAoF;AACpF,4CAA4F;AAKrF,IAAM,uBAAuB,GAA7B,MAAM,uBAAuB;IAEsB;IACb;IACjC;IACA;IAJV,YACwD,OAA0B,EACvC,qBAA4C,EAC7E,oBAA0C,EAC1C,yBAAoD;QAHN,YAAO,GAAP,OAAO,CAAmB;QACvC,0BAAqB,GAArB,qBAAqB,CAAuB;QAC7E,yBAAoB,GAApB,oBAAoB,CAAsB;QAC1C,8BAAyB,GAAzB,yBAAyB,CAA2B;IAC3D,CAAC;IAEI,sBAAsB,CAAC,QAAgB;QAC7C,MAAM,OAAO,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAA;QAC/B,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAA;QACrC,CAAC;QAED,IAAI,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,OAAO,CAA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AC;IACrB,IAAA,YAAK,EAAC,iBAAU,CAAC,WAAW,EAAE,iBAAU,CAAC,WAAW,CAAC;IAC/B,WAAA,IAAA,UAAG,GAAE,CAAA;IAAuB,WAAA,IAAA,aAAI,GAAE,CAAA;;qCAAvB,qBAAc;;8DAE/C;AAIK;IAFL,IAAA,YAAG,EAAC,gBAAgB,CAAC;IACrB,IAAA,YAAK,EAAC,iBAAU,CAAC,WAAW,EAAE,iBAAU,CAAC,WAAW,CAAC;IAChC,WAAA,IAAA,UAAG,GAAE,CAAA;;qCAAM,qBAAc;;6DAM9C;kCA9OU,uBAAuB;IADnC,IAAA,mBAAU,EAAC,gBAAgB,CAAC;IAGxB,WAAA,IAAA,eAAM,EAAC,gDAAoC,CAAC,CAAA;IAC5C,WAAA,IAAA,eAAM,EAAC,mCAAuB,CAAC,CAAA;qDACF,6CAAoB;QACf,wDAAyB;GALnD,uBAAuB,CAyPnC"}
|
|
@@ -45,6 +45,7 @@ let ProductImportController = class ProductImportController {
|
|
|
45
45
|
exports.ProductImportController = ProductImportController;
|
|
46
46
|
__decorate([
|
|
47
47
|
(0, common_1.Post)('/upload'),
|
|
48
|
+
(0, core_1.Allow)(core_1.Permission.UpdateCatalog, core_1.Permission.UpdateProduct),
|
|
48
49
|
(0, common_1.UseInterceptors)((0, platform_express_1.FileInterceptor)('file')),
|
|
49
50
|
__param(0, (0, core_1.Ctx)()),
|
|
50
51
|
__param(1, (0, common_1.UploadedFile)()),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"product-import.controller.js","sourceRoot":"","sources":["../../../../../packages/product-import-export-plugin/src/api/product-import.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"product-import.controller.js","sourceRoot":"","sources":["../../../../../packages/product-import-export-plugin/src/api/product-import.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,wCAAoF;AACpF,2CAQuB;AAEvB,+DAA0D;AAC1D,4CAAm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C,MAAM,CAAC,CAAC;IAEtC,WAAA,IAAA,UAAG,GAAE,CAAA;IACL,WAAA,IAAA,qBAAY,GAAE,CAAA;IACd,WAAA,IAAA,aAAI,EAAC,mBAAmB,CAAC,CAAA;IAGzB,WAAA,IAAA,aAAI,EAAC,cAAc,CAAC,CAAA;IACpB,WAAA,IAAA,aAAI,EAAC,kBAAkB,CAAC,CAAA;IACxB,WAAA,IAAA,YAAG,GAAE,CAAA;;qCAPM,qBAAc;;6DA8B3B;kCAxCU,uBAAuB;IADnC,IAAA,mBAAU,EAAC,gBAAgB,CAAC;IAGxB,WAAA,IAAA,eAAM,EAAC,gDAAoC,CAAC,CAAA;6CAC5B,6CAAoB;GAH5B,uBAAuB,CAyCnC"}
|
package/src/dashboard/utils.ts
CHANGED
|
@@ -58,8 +58,23 @@ export const getServerLocation = (): string => {
|
|
|
58
58
|
return origin
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
//
|
|
61
|
+
// Same localStorage keys as @vendure/dashboard's own API client (LS_KEY_SELECTED_CHANNEL_TOKEN /
|
|
62
|
+
// LS_KEY_SESSION_TOKEN). The plugin's REST routes require admin permissions, so every fetch must
|
|
63
|
+
// carry the session token too, not only cookies: on a server configured with tokenMethod 'bearer'
|
|
64
|
+
// there is no session cookie and credentials: 'include' alone would yield 403.
|
|
65
|
+
const LS_KEY_SELECTED_CHANNEL_TOKEN = 'vendure-selected-channel-token'
|
|
66
|
+
const LS_KEY_SESSION_TOKEN = 'vendure-session-token'
|
|
67
|
+
|
|
68
|
+
// Return vendure-token (if a non-default channel is selected) and Authorization headers
|
|
62
69
|
export const getChannelHeader = (): Record<string, string> => {
|
|
63
|
-
const
|
|
64
|
-
|
|
70
|
+
const headers: Record<string, string> = {}
|
|
71
|
+
const channelToken = localStorage.getItem(LS_KEY_SELECTED_CHANNEL_TOKEN)
|
|
72
|
+
if (channelToken) {
|
|
73
|
+
headers['vendure-token'] = channelToken
|
|
74
|
+
}
|
|
75
|
+
const sessionToken = localStorage.getItem(LS_KEY_SESSION_TOKEN)
|
|
76
|
+
if (sessionToken) {
|
|
77
|
+
headers.authorization = `Bearer ${sessionToken}`
|
|
78
|
+
}
|
|
79
|
+
return headers
|
|
65
80
|
}
|