@plentymarkets/shop-api 0.115.0 → 0.116.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/lib/api/__tests__/unit/doSaveBlocks.unit.spec.d.ts +2 -0
- package/lib/api/__tests__/unit/doSaveBlocks.unit.spec.d.ts.map +1 -0
- package/lib/api/__tests__/unit/getBlocks.unit.spec.d.ts +2 -0
- package/lib/api/__tests__/unit/getBlocks.unit.spec.d.ts.map +1 -0
- package/lib/api/doSaveBlocks/index.d.ts +2 -1
- package/lib/api/doSaveBlocks/index.d.ts.map +1 -1
- package/lib/api/getBlocks/index.d.ts +2 -0
- package/lib/api/getBlocks/index.d.ts.map +1 -1
- package/lib/index.cjs.js +12 -3
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.es.js +12 -3
- package/lib/index.es.js.map +1 -1
- package/lib/types/api/blocks.d.ts +2 -0
- package/lib/types/api/blocks.d.ts.map +1 -1
- package/package.json +2 -2
- package/server/api/__tests__/unit/doSaveBlocks.unit.spec.d.ts +2 -0
- package/server/api/__tests__/unit/doSaveBlocks.unit.spec.d.ts.map +1 -0
- package/server/api/__tests__/unit/getBlocks.unit.spec.d.ts +2 -0
- package/server/api/__tests__/unit/getBlocks.unit.spec.d.ts.map +1 -0
- package/server/api/doSaveBlocks/index.d.ts +2 -1
- package/server/api/doSaveBlocks/index.d.ts.map +1 -1
- package/server/api/getBlocks/index.d.ts +2 -0
- package/server/api/getBlocks/index.d.ts.map +1 -1
- package/server/index.js +12 -3
- package/server/index.js.map +1 -1
- package/server/types/api/blocks.d.ts +2 -0
- package/server/types/api/blocks.d.ts.map +1 -1
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"doSaveBlocks.unit.spec.d.ts","sourceRoot":"","sources":["../../../../src/api/__tests__/unit/doSaveBlocks.unit.spec.ts"],"names":[],"mappings":""}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"getBlocks.unit.spec.d.ts","sourceRoot":"","sources":["../../../../src/api/__tests__/unit/getBlocks.unit.spec.ts"],"names":[],"mappings":""}
|
@@ -12,6 +12,7 @@ import { PlentysystemsIntegrationContext } from '../../types/context';
|
|
12
12
|
* entityType: category/item/immutable.
|
13
13
|
* entityId: id of the category/item.
|
14
14
|
* blocks: blocks JSON.
|
15
|
+
|
15
16
|
*
|
16
17
|
* @returns
|
17
18
|
* Category facets.
|
@@ -21,7 +22,7 @@ import { PlentysystemsIntegrationContext } from '../../types/context';
|
|
21
22
|
* const { data } = await useSdk().plentysystems.doSaveBlocks({
|
22
23
|
* identifier: "index",
|
23
24
|
* entityType: "immutable",
|
24
|
-
* blocks: []
|
25
|
+
* blocks: []
|
25
26
|
* });
|
26
27
|
* ```
|
27
28
|
*/
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/doSaveBlocks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAClE,OAAO,EAAE,+BAA+B,EAAE,MAAM,qBAAqB,CAAC;AAEtE
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/doSaveBlocks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAClE,OAAO,EAAE,+BAA+B,EAAE,MAAM,qBAAqB,CAAC;AAEtE;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,YAAY,YACd,+BAA+B,UAChC,kBAAkB,KACzB,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAmBvB,CAAC"}
|
@@ -10,6 +10,7 @@ import { PlentysystemsIntegrationContext } from '../../types/context';
|
|
10
10
|
* @param { GetBlocksParams } params
|
11
11
|
* identifier: id of the category/item or url of immutable page.
|
12
12
|
* type: category/item/immutable.
|
13
|
+
* blocks: blocks to fetch, comma-separated list of block names (e.g., 'TextCard,Carousel').
|
13
14
|
*
|
14
15
|
* @returns
|
15
16
|
* Category facets.
|
@@ -19,6 +20,7 @@ import { PlentysystemsIntegrationContext } from '../../types/context';
|
|
19
20
|
* const { data } = await useSdk().plentysystems.getBlocks({
|
20
21
|
* identifier: 'shipping',
|
21
22
|
* type: "immutable",
|
23
|
+
* blocks: 'TextCard,Carousel'
|
22
24
|
* });
|
23
25
|
* ```
|
24
26
|
*/
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/getBlocks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,EACL,IAAI,EAEJ,eAAe,EAChB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,+BAA+B,EAAE,MAAM,qBAAqB,CAAC;AAEtE
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/getBlocks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,EACL,IAAI,EAEJ,eAAe,EAChB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,+BAA+B,EAAE,MAAM,qBAAqB,CAAC;AAEtE;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,SAAS,YACX,+BAA+B,UAChC,eAAe,KACtB,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAiCvB,CAAC"}
|
package/lib/index.cjs.js
CHANGED
@@ -2613,6 +2613,7 @@ const doCaptureMolliePayment = async (context, params) => {
|
|
2613
2613
|
* @param { GetBlocksParams } params
|
2614
2614
|
* identifier: id of the category/item or url of immutable page.
|
2615
2615
|
* type: category/item/immutable.
|
2616
|
+
* blocks: blocks to fetch, comma-separated list of block names (e.g., 'TextCard,Carousel').
|
2616
2617
|
*
|
2617
2618
|
* @returns
|
2618
2619
|
* Category facets.
|
@@ -2622,6 +2623,7 @@ const doCaptureMolliePayment = async (context, params) => {
|
|
2622
2623
|
* const { data } = await useSdk().plentysystems.getBlocks({
|
2623
2624
|
* identifier: 'shipping',
|
2624
2625
|
* type: "immutable",
|
2626
|
+
* blocks: 'TextCard,Carousel'
|
2625
2627
|
* });
|
2626
2628
|
* ```
|
2627
2629
|
*/
|
@@ -2629,13 +2631,19 @@ const getBlocks = async (context, params) => {
|
|
2629
2631
|
try {
|
2630
2632
|
const identifier = params.identifier;
|
2631
2633
|
const url = new URL(`/rest/storefront/blocks/${identifier}`, context.config.api.url);
|
2632
|
-
|
2634
|
+
if (params.type) {
|
2635
|
+
url.searchParams.set('type', params.type);
|
2636
|
+
}
|
2637
|
+
if (params.blocks) {
|
2638
|
+
url.searchParams.append('blocks', params.blocks);
|
2639
|
+
}
|
2633
2640
|
const { data } = await context.client.get(url.href);
|
2634
2641
|
return { data: data.data.blocks };
|
2635
2642
|
}
|
2636
2643
|
catch (error) {
|
2637
2644
|
const statusCode = error?.response?.status.toString() || '500';
|
2638
|
-
const message = error?.response?.data?.error?.message ||
|
2645
|
+
const message = error?.response?.data?.error?.message ||
|
2646
|
+
error.message;
|
2639
2647
|
throw new ApiError({
|
2640
2648
|
key: 'unknownError',
|
2641
2649
|
code: statusCode,
|
@@ -2657,6 +2665,7 @@ const getBlocks = async (context, params) => {
|
|
2657
2665
|
* entityType: category/item/immutable.
|
2658
2666
|
* entityId: id of the category/item.
|
2659
2667
|
* blocks: blocks JSON.
|
2668
|
+
|
2660
2669
|
*
|
2661
2670
|
* @returns
|
2662
2671
|
* Category facets.
|
@@ -2666,7 +2675,7 @@ const getBlocks = async (context, params) => {
|
|
2666
2675
|
* const { data } = await useSdk().plentysystems.doSaveBlocks({
|
2667
2676
|
* identifier: "index",
|
2668
2677
|
* entityType: "immutable",
|
2669
|
-
* blocks: []
|
2678
|
+
* blocks: []
|
2670
2679
|
* });
|
2671
2680
|
* ```
|
2672
2681
|
*/
|
package/lib/index.cjs.js.map
CHANGED
@@ -1 +1 @@
|
|
1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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/lib/index.es.js
CHANGED
@@ -2605,6 +2605,7 @@ const doCaptureMolliePayment = async (context, params) => {
|
|
2605
2605
|
* @param { GetBlocksParams } params
|
2606
2606
|
* identifier: id of the category/item or url of immutable page.
|
2607
2607
|
* type: category/item/immutable.
|
2608
|
+
* blocks: blocks to fetch, comma-separated list of block names (e.g., 'TextCard,Carousel').
|
2608
2609
|
*
|
2609
2610
|
* @returns
|
2610
2611
|
* Category facets.
|
@@ -2614,6 +2615,7 @@ const doCaptureMolliePayment = async (context, params) => {
|
|
2614
2615
|
* const { data } = await useSdk().plentysystems.getBlocks({
|
2615
2616
|
* identifier: 'shipping',
|
2616
2617
|
* type: "immutable",
|
2618
|
+
* blocks: 'TextCard,Carousel'
|
2617
2619
|
* });
|
2618
2620
|
* ```
|
2619
2621
|
*/
|
@@ -2621,13 +2623,19 @@ const getBlocks = async (context, params) => {
|
|
2621
2623
|
try {
|
2622
2624
|
const identifier = params.identifier;
|
2623
2625
|
const url = new URL(`/rest/storefront/blocks/${identifier}`, context.config.api.url);
|
2624
|
-
|
2626
|
+
if (params.type) {
|
2627
|
+
url.searchParams.set('type', params.type);
|
2628
|
+
}
|
2629
|
+
if (params.blocks) {
|
2630
|
+
url.searchParams.append('blocks', params.blocks);
|
2631
|
+
}
|
2625
2632
|
const { data } = await context.client.get(url.href);
|
2626
2633
|
return { data: data.data.blocks };
|
2627
2634
|
}
|
2628
2635
|
catch (error) {
|
2629
2636
|
const statusCode = error?.response?.status.toString() || '500';
|
2630
|
-
const message = error?.response?.data?.error?.message ||
|
2637
|
+
const message = error?.response?.data?.error?.message ||
|
2638
|
+
error.message;
|
2631
2639
|
throw new ApiError({
|
2632
2640
|
key: 'unknownError',
|
2633
2641
|
code: statusCode,
|
@@ -2649,6 +2657,7 @@ const getBlocks = async (context, params) => {
|
|
2649
2657
|
* entityType: category/item/immutable.
|
2650
2658
|
* entityId: id of the category/item.
|
2651
2659
|
* blocks: blocks JSON.
|
2660
|
+
|
2652
2661
|
*
|
2653
2662
|
* @returns
|
2654
2663
|
* Category facets.
|
@@ -2658,7 +2667,7 @@ const getBlocks = async (context, params) => {
|
|
2658
2667
|
* const { data } = await useSdk().plentysystems.doSaveBlocks({
|
2659
2668
|
* identifier: "index",
|
2660
2669
|
* entityType: "immutable",
|
2661
|
-
* blocks: []
|
2670
|
+
* blocks: []
|
2662
2671
|
* });
|
2663
2672
|
* ```
|
2664
2673
|
*/
|
package/lib/index.es.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.es.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"index.es.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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
|
+
blocks?: string;
|
4
5
|
}
|
5
6
|
export interface Block {
|
6
7
|
name: string;
|
@@ -8,6 +9,7 @@ export interface Block {
|
|
8
9
|
configuration?: unknown;
|
9
10
|
meta: {
|
10
11
|
uuid: string;
|
12
|
+
isGlobalTemplate?: boolean;
|
11
13
|
};
|
12
14
|
content: unknown;
|
13
15
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"blocks.d.ts","sourceRoot":"","sources":["../../../src/types/api/blocks.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC9B,UAAU,EAAE,MAAM,GAAG,MAAM,CAAC;IAC5B,IAAI,EAAE,MAAM,CAAC;
|
1
|
+
{"version":3,"file":"blocks.d.ts","sourceRoot":"","sources":["../../../src/types/api/blocks.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC9B,UAAU,EAAE,MAAM,GAAG,MAAM,CAAC;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,KAAK;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,IAAI,EAAE;QACJ,IAAI,EAAE,MAAM,CAAC;QACb,gBAAgB,CAAC,EAAE,OAAO,CAAC;KAC5B,CAAC;IACF,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,kBAAkB;IACjC,UAAU,EAAE,MAAM,GAAG,MAAM,CAAC;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,SAAS;IACxB,UAAU,EAAE,MAAM,GAAG,MAAM,CAAC;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;CAChB"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@plentymarkets/shop-api",
|
3
|
-
"version": "0.
|
3
|
+
"version": "0.116.0",
|
4
4
|
"sideEffects": false,
|
5
5
|
"private": false,
|
6
6
|
"publishConfig": {
|
@@ -46,5 +46,5 @@
|
|
46
46
|
"lib/**/*",
|
47
47
|
"server/**/*"
|
48
48
|
],
|
49
|
-
"gitHead": "
|
49
|
+
"gitHead": "586c03d529739a983ba7228e3fa0b9406917c43c"
|
50
50
|
}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"doSaveBlocks.unit.spec.d.ts","sourceRoot":"","sources":["../../../../src/api/__tests__/unit/doSaveBlocks.unit.spec.ts"],"names":[],"mappings":""}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"getBlocks.unit.spec.d.ts","sourceRoot":"","sources":["../../../../src/api/__tests__/unit/getBlocks.unit.spec.ts"],"names":[],"mappings":""}
|
@@ -12,6 +12,7 @@ import { PlentysystemsIntegrationContext } from '../../types/context';
|
|
12
12
|
* entityType: category/item/immutable.
|
13
13
|
* entityId: id of the category/item.
|
14
14
|
* blocks: blocks JSON.
|
15
|
+
|
15
16
|
*
|
16
17
|
* @returns
|
17
18
|
* Category facets.
|
@@ -21,7 +22,7 @@ import { PlentysystemsIntegrationContext } from '../../types/context';
|
|
21
22
|
* const { data } = await useSdk().plentysystems.doSaveBlocks({
|
22
23
|
* identifier: "index",
|
23
24
|
* entityType: "immutable",
|
24
|
-
* blocks: []
|
25
|
+
* blocks: []
|
25
26
|
* });
|
26
27
|
* ```
|
27
28
|
*/
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/doSaveBlocks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAClE,OAAO,EAAE,+BAA+B,EAAE,MAAM,qBAAqB,CAAC;AAEtE
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/doSaveBlocks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAClE,OAAO,EAAE,+BAA+B,EAAE,MAAM,qBAAqB,CAAC;AAEtE;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,YAAY,YACd,+BAA+B,UAChC,kBAAkB,KACzB,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAmBvB,CAAC"}
|
@@ -10,6 +10,7 @@ import { PlentysystemsIntegrationContext } from '../../types/context';
|
|
10
10
|
* @param { GetBlocksParams } params
|
11
11
|
* identifier: id of the category/item or url of immutable page.
|
12
12
|
* type: category/item/immutable.
|
13
|
+
* blocks: blocks to fetch, comma-separated list of block names (e.g., 'TextCard,Carousel').
|
13
14
|
*
|
14
15
|
* @returns
|
15
16
|
* Category facets.
|
@@ -19,6 +20,7 @@ import { PlentysystemsIntegrationContext } from '../../types/context';
|
|
19
20
|
* const { data } = await useSdk().plentysystems.getBlocks({
|
20
21
|
* identifier: 'shipping',
|
21
22
|
* type: "immutable",
|
23
|
+
* blocks: 'TextCard,Carousel'
|
22
24
|
* });
|
23
25
|
* ```
|
24
26
|
*/
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/getBlocks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,EACL,IAAI,EAEJ,eAAe,EAChB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,+BAA+B,EAAE,MAAM,qBAAqB,CAAC;AAEtE
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/getBlocks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,EACL,IAAI,EAEJ,eAAe,EAChB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,+BAA+B,EAAE,MAAM,qBAAqB,CAAC;AAEtE;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,SAAS,YACX,+BAA+B,UAChC,eAAe,KACtB,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAiCvB,CAAC"}
|
package/server/index.js
CHANGED
@@ -2617,6 +2617,7 @@ const doCaptureMolliePayment = async (context, params) => {
|
|
2617
2617
|
* @param { GetBlocksParams } params
|
2618
2618
|
* identifier: id of the category/item or url of immutable page.
|
2619
2619
|
* type: category/item/immutable.
|
2620
|
+
* blocks: blocks to fetch, comma-separated list of block names (e.g., 'TextCard,Carousel').
|
2620
2621
|
*
|
2621
2622
|
* @returns
|
2622
2623
|
* Category facets.
|
@@ -2626,6 +2627,7 @@ const doCaptureMolliePayment = async (context, params) => {
|
|
2626
2627
|
* const { data } = await useSdk().plentysystems.getBlocks({
|
2627
2628
|
* identifier: 'shipping',
|
2628
2629
|
* type: "immutable",
|
2630
|
+
* blocks: 'TextCard,Carousel'
|
2629
2631
|
* });
|
2630
2632
|
* ```
|
2631
2633
|
*/
|
@@ -2633,13 +2635,19 @@ const getBlocks = async (context, params) => {
|
|
2633
2635
|
try {
|
2634
2636
|
const identifier = params.identifier;
|
2635
2637
|
const url = new URL(`/rest/storefront/blocks/${identifier}`, context.config.api.url);
|
2636
|
-
|
2638
|
+
if (params.type) {
|
2639
|
+
url.searchParams.set('type', params.type);
|
2640
|
+
}
|
2641
|
+
if (params.blocks) {
|
2642
|
+
url.searchParams.append('blocks', params.blocks);
|
2643
|
+
}
|
2637
2644
|
const { data } = await context.client.get(url.href);
|
2638
2645
|
return { data: data.data.blocks };
|
2639
2646
|
}
|
2640
2647
|
catch (error) {
|
2641
2648
|
const statusCode = error?.response?.status.toString() || '500';
|
2642
|
-
const message = error?.response?.data?.error?.message ||
|
2649
|
+
const message = error?.response?.data?.error?.message ||
|
2650
|
+
error.message;
|
2643
2651
|
throw new ApiError({
|
2644
2652
|
key: 'unknownError',
|
2645
2653
|
code: statusCode,
|
@@ -2661,6 +2669,7 @@ const getBlocks = async (context, params) => {
|
|
2661
2669
|
* entityType: category/item/immutable.
|
2662
2670
|
* entityId: id of the category/item.
|
2663
2671
|
* blocks: blocks JSON.
|
2672
|
+
|
2664
2673
|
*
|
2665
2674
|
* @returns
|
2666
2675
|
* Category facets.
|
@@ -2670,7 +2679,7 @@ const getBlocks = async (context, params) => {
|
|
2670
2679
|
* const { data } = await useSdk().plentysystems.doSaveBlocks({
|
2671
2680
|
* identifier: "index",
|
2672
2681
|
* entityType: "immutable",
|
2673
|
-
* blocks: []
|
2682
|
+
* blocks: []
|
2674
2683
|
* });
|
2675
2684
|
* ```
|
2676
2685
|
*/
|
package/server/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
@@ -1,6 +1,7 @@
|
|
1
1
|
export interface GetBlocksParams {
|
2
2
|
identifier: string | number;
|
3
3
|
type: string;
|
4
|
+
blocks?: string;
|
4
5
|
}
|
5
6
|
export interface Block {
|
6
7
|
name: string;
|
@@ -8,6 +9,7 @@ export interface Block {
|
|
8
9
|
configuration?: unknown;
|
9
10
|
meta: {
|
10
11
|
uuid: string;
|
12
|
+
isGlobalTemplate?: boolean;
|
11
13
|
};
|
12
14
|
content: unknown;
|
13
15
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"blocks.d.ts","sourceRoot":"","sources":["../../../src/types/api/blocks.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC9B,UAAU,EAAE,MAAM,GAAG,MAAM,CAAC;IAC5B,IAAI,EAAE,MAAM,CAAC;
|
1
|
+
{"version":3,"file":"blocks.d.ts","sourceRoot":"","sources":["../../../src/types/api/blocks.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC9B,UAAU,EAAE,MAAM,GAAG,MAAM,CAAC;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,KAAK;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,IAAI,EAAE;QACJ,IAAI,EAAE,MAAM,CAAC;QACb,gBAAgB,CAAC,EAAE,OAAO,CAAC;KAC5B,CAAC;IACF,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,kBAAkB;IACjC,UAAU,EAAE,MAAM,GAAG,MAAM,CAAC;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,SAAS;IACxB,UAAU,EAAE,MAAM,GAAG,MAAM,CAAC;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;CAChB"}
|