syncCategories.buildActions returns action in the wrong format (array of arrays)
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 45/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 停滞
- 技術スタック
- javascript, nodejs
- 領域
- api
調査の方向性
createSyncCategories とそのエントリーポイントである buildActions から始め、提供されている asset 名更新の例を再現します。結果が removeAsset アクションと addAsset アクションを含む 1 つのフラットな配列であり、配列の配列ではないことを確認します。
索引モデルが issue の本文から書いたものです。
説明
Support reference number
Description
const { createSyncCategories } = require('@commercetools/sync-actions')
const syncCategories = createSyncCategories()
const newCategory = {
key: 'category-8accca22-4d57-4692-bee0-483e43502088',
name: {
de: 'Test',
},
slug: {
en: 'category-8accca22-4d57-4692-bee0-483e43502088-slug',
},
assets: [
{
key: 'asset-key-1-4ab57b6d-3a0e-46a3-b9b2-539ce4fde618',
name: {
en: 'asset name - 1',
},
description: {
en: 'asset description - 1',
},
sources: [
{
key: 'source-key-138d0808-f4f4-4fa8-a9de-48d803eec277',
uri: 'https://google.com',
},
],
tags: ['tag-1', 'tag-2'],
},
{
key: 'asset-key-3-551a2305-25cc-4fb3-a79c-fcb272be3b89',
name: {
en: 'asset name - 3',
},
description: {
en: 'asset description - 3',
},
sources: [
{
key: 'source-key-ca27d6c8-5b65-431f-ad65-21bed9abd2a9',
uri: 'https://google.com',
},
],
tags: ['tag-5', 'tag-6'],
},
{
key: 'asset-key-2-986daecf-f793-462f-a598-0ee769af331d',
name: {
en: 'asset name - updated',
},
description: {
en: 'asset description - 2',
},
sources: [
{
key: 'source-key-8ccb652c-6abc-4c6b-bec0-071ca8948106',
uri: 'https://google.com',
},
],
tags: ['tag-3', 'tag-4'],
},
],
orderHint: '0.000017176731611011768329613',
}
const category = {
id: '5cd1b242-9e27-4199-9cc5-f7057c5f988d',
version: 1,
versionModifiedAt: '2024-06-06T11:26:01.104Z',
lastMessageSequenceNumber: 1,
createdAt: '2024-06-06T11:26:01.104Z',
lastModifiedAt: '2024-06-06T11:26:01.104Z',
lastModifiedBy: {
clientId: 'REDACTED',
isPlatformClient: false,
},
createdBy: {
clientId: 'REDACTED',
isPlatformClient: false,
},
key: 'category-8accca22-4d57-4692-bee0-483e43502088',
name: {
en: 'Category 8accca22-4d57-4692-bee0-483e43502088',
},
slug: {
en: 'category-8accca22-4d57-4692-bee0-483e43502088-slug',
},
ancestors: [],
orderHint: '0.000017176731611011768329613',
assets: [
{
id: 'a7112cd1-0e67-4b35-84a3-3ede87d392e7',
sources: [
{
uri: 'https://google.com',
key: 'source-key-138d0808-f4f4-4fa8-a9de-48d803eec277',
},
],
name: {
en: 'asset name - 1',
},
key: 'asset-key-1-4ab57b6d-3a0e-46a3-b9b2-539ce4fde618',
description: {
en: 'asset description - 1',
},
tags: ['tag-1', 'tag-2'],
},
{
id: '4ed62080-ce1e-4f92-93e7-e07e2a6e06bc',
sources: [
{
uri: 'https://google.com',
key: 'source-key-8ccb652c-6abc-4c6b-bec0-071ca8948106',
},
],
name: {
en: 'asset name - 2',
},
key: 'asset-key-2-986daecf-f793-462f-a598-0ee769af331d',
description: {
en: 'asset description - 2',
},
tags: ['tag-3', 'tag-4'],
},
{
id: '38acda20-4722-4d84-8bcd-b7a8dc33f096',
sources: [
{
uri: 'https://google.com',
key: 'source-key-ca27d6c8-5b65-431f-ad65-21bed9abd2a9',
},
],
name: {
en: 'asset name - 3',
},
key: 'asset-key-3-551a2305-25cc-4fb3-a79c-fcb272be3b89',
description: {
en: 'asset description - 3',
},
tags: ['tag-5', 'tag-6'],
},
],
}
const onlyAssetNameChanged = {
...category,
assets: category.assets.map((asset, index) => {
if (index !== 1) return asset
return {
...asset,
name: {
...asset.name,
en: asset.name.en + ' - updated',
},
}
}),
}
const actions = syncCategories.buildActions(onlyAssetNameChanged, category)
console.log(JSON.stringify(actions, null, 2))
Expected Behavior
I expect to get array of actions
[
{
"action": "removeAsset",
"assetId": "4ed62080-ce1e-4f92-93e7-e07e2a6e06bc"
},
{
"action": "addAsset",
"asset": {
"id": "4ed62080-ce1e-4f92-93e7-e07e2a6e06bc",
"sources": [
{
"uri": "https://google.com",
"key": "source-key-8ccb652c-6abc-4c6b-bec0-071ca8948106"
}
],
"name": {
"en": "asset name - 2 - updated"
},
"key": "asset-key-2-986daecf-f793-462f-a598-0ee769af331d",
"description": {
"en": "asset description - 2"
},
"tags": [
"tag-3",
"tag-4"
]
}
}
]
Current Behavior
Currently I get, array of array of actions
[
[
{
"action": "removeAsset",
"assetId": "4ed62080-ce1e-4f92-93e7-e07e2a6e06bc"
},
{
"action": "addAsset",
"asset": {
"id": "4ed62080-ce1e-4f92-93e7-e07e2a6e06bc",
"sources": [
{
"uri": "https://google.com",
"key": "source-key-8ccb652c-6abc-4c6b-bec0-071ca8948106"
}
],
"name": {
"en": "asset name - 2 - updated"
},
"key": "asset-key-2-986daecf-f793-462f-a598-0ee769af331d",
"description": {
"en": "asset description - 2"
},
"tags": [
"tag-3",
"tag-4"
]
}
}
]
]
Context
Possible Solution
- 主要言語
- JavaScript
- スター
- 77
- フォーク
- 70
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
commercetools/nodejs のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 35/100
commercetools/nodejs#1901 ·
-
難易度 1/5 1〜3時間 初心者へのやさしさ 55/100
commercetools/nodejs#1891 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 20/100
commercetools/nodejs#1889 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
commercetools/nodejs#1884 · リアクション 4 件 ·
-
Unhandled Promise Rejections coming from sdk-middleware-http再び着手できるかも @ajimae が 1203 日前に担当しましたが、オープン中のプルリクエストはありません。 オープンType: Bug
commercetools/nodejs#1858 · コメント 1 件 · リアクション 1 件 · 担当者 1 名 ·
commercetools/nodejs の issue をすべて見る
似ている issue
-
[Bug] @deck.gl/arcgis dist import resolves to unpublished @deck.gl/core source path (9.3.11, 9.4.0)オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
stac-utils/stac-fields#42 ·
-
[sec-check] SVG remote-reference gate misses src attributes, link hrefs and bare-string @importオープンagent/security hive/hosted-available-lke648397-260827-5n31 security
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
メンテナーはふだん 1 日以内に返信
-
channels:add check:passed
難易度 1/5 1時間未満 初心者へのやさしさ 75/100
メンテナーはふだん 2 日以内に返信