toga-ai 1.0.215 → 1.0.216
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/knowledge/2.0/apps/worker2/INDEX.md +2 -0
- package/knowledge/2.0/apps/worker2/features/etilize-catalog-item-import.md +105 -0
- package/knowledge/2.0/apps/worker2/features/etilize-item-translation-import.md +69 -0
- package/knowledge/INDEX.md +1 -1
- package/knowledge/clients/compass-canada/profile.md +2 -1
- package/knowledge/clients/quad/profile.md +3 -2
- package/package.json +1 -1
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
| [ClickUp Work Type Automation (Committed / Conditional / Stretch)](features/clickup-work-type-automation.md) | The ClickUp webhook handler (`_Worker_Clickup`) automatically maintains each task's **Work Type** custom field — `Committed`, `Conditional`, or `Stretch` — base | worker2/Worker/Clickup.php, worker2/Tests/Worker/ClickupWorkTypeTest.php |
|
|
9
9
|
| [Creating Worker Actions](features/creating-worker-actions.md) | How to add a new callable Worker action — a PHP class whose `public static` methods are invoked as background jobs (via webhook, cron, or `_Worker::runTask()`). | worker2/Worker/, worker2/Controller/Index.php, _underscore/Worker.php |
|
|
10
10
|
| [Elite Freshservice Sync (worker2)](features/elite-freshservice-sync.md) | `_Worker_Elite` processes Freshservice webhook events and syncs them into TOGA 2. | worker2/Worker/Elite.php, worker2/Config/dev-kmaramreddy-laptop.ini |
|
|
11
|
+
| [Etilize Catalog Item Import & Refresh](features/etilize-catalog-item-import.md) | Client-generic catalog onboarding from an S3 CSV plus an Etilize re-pull. | worker2/Worker/Etilize/Items.php |
|
|
12
|
+
| [Etilize Item Translation Import](features/etilize-item-translation-import.md) | The abstract worker class `_Worker_Etilize_ItemTranslations` imports **non-English** item text from Etilize into the client's `ItemTranslations` table. | worker2/Worker/Etilize/ItemTranslations.php |
|
|
11
13
|
| [Monitoring Framework (Orchestrator + Child Monitors)](features/monitoring-framework.md) | A unified, DB-driven monitoring framework for business-critical data flows (Compass POs, Prudential asset imports, AIG closed claims, …). | worker2/Worker/Monitor.php, worker2/Worker/Monitors/, worker2/Worker/Notification/Email.php, dbchanges2/Core/2026-05-21 - Monitors.sql |
|
|
12
14
|
| [NetSuite → TOGA Opportunity Sync (API Message Queue + worker2 webhook)](features/netsuite-opportunity-sync.md) | Outbound sync from NetSuite to TOGA for the record types the Forecast2 importer pulls (opportunities first; sales/items/etc. | worker2/Worker/Netsuite.php, worker2/Worker/Netsuite/Opportunity.php, worker2/Controller/Index.php, _underscore/Worker.php, test/@dave/NetSuite/api-message-queue/lib_amq_queue.js, test/@dave/NetSuite/api-message-queue/ue_api_msg_queue_enqueue.js, test/@dave/NetSuite/api-message-queue/ue_amq_drain.js, test/@dave/NetSuite/api-message-queue/ss_amq_drain.js, test/@dave/NetSuite/api-message-queue/DEPLOY_RUNBOOK.md, test/@dave/clickup/backfill_opportunity_numbers.php, test/@dave/clickup/probe_opportunity_fields.php, test/@dave/probe_clickup_desc_match.php, test/@dave/test_model_load_behavior.php, dbchanges2/Forecast/2026-06-25a - Add unique index on Opportunities netsuiteOpportunityInternalId.sql, worker/crons/toga2/forecast2/common_import_sales_from_netsuite.php |
|
|
13
15
|
| [NetSuite → Forecast Open-Orders Sync (salesOrder webhook → OpenOrderItems)](features/netsuite-salesorder-open-orders-sync.md) | Webhook-driven, single-record port of the legacy open-orders importer (TRUE-79142). | worker2/Worker/Netsuite/SalesOrder.php, worker2/Worker/Netsuite.php, test/@dave/probe_salesorder_rest_shape.php, test/@dave/probe_open_order_lines.php, test/@dave/check_so_status.php, test/@dave/check_so_history.php, test/@dave/probe_so_rest_lines.php, test/@dave/probe_missing_oo_timing.php, test/@dave/probe_missing_oo_createdby.php, test/@dave/probe_drift_so_dates.php, test/@dave/probe_open_order_gating.php, worker/crons/toga2/forecast2/import_open_orders.php, worker/crons/toga2/forecast2/common_import_sales_from_netsuite.php |
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Etilize Catalog Item Import & Refresh
|
|
3
|
+
framework: "2.0"
|
|
4
|
+
repo: worker2
|
|
5
|
+
project: Worker
|
|
6
|
+
client: shared
|
|
7
|
+
type: feature
|
|
8
|
+
status: active
|
|
9
|
+
updated: 2026-06-26
|
|
10
|
+
owners: [bala]
|
|
11
|
+
files:
|
|
12
|
+
- worker2/Worker/Etilize/Items.php
|
|
13
|
+
related:
|
|
14
|
+
- ./creating-worker-actions.md
|
|
15
|
+
- ./etilize-item-translation-import.md
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Summary
|
|
19
|
+
|
|
20
|
+
Client-generic catalog onboarding from an S3 CSV plus an Etilize re-pull. The
|
|
21
|
+
abstract worker class `_Worker_Etilize_Items` ingests an item catalog (items, vendor
|
|
22
|
+
items, costs, prices, personas) and enriches each item with features and images from
|
|
23
|
+
the Etilize datasheet. All three actions write **directly to `DB_CLIENT`** via raw
|
|
24
|
+
`_Query` — there is **no api2 round-trip**. Used today by **Compass Canada** (single
|
|
25
|
+
price) and **Quad** (multi-currency), but nothing in the code is client-specific.
|
|
26
|
+
|
|
27
|
+
## Public actions
|
|
28
|
+
|
|
29
|
+
Routes are `Etilize/Items/<Method>` (see [creating-worker-actions](./creating-worker-actions.md)).
|
|
30
|
+
|
|
31
|
+
1. `ImportItemsFromCsvFile(string $client, string $s3Url, string $catalogUuid)`
|
|
32
|
+
— **normal import**: one `ItemPrice` + `VendorItemCost` per item with **NULL
|
|
33
|
+
currency**, using the Cost / Lease Price columns (e.g. Compass).
|
|
34
|
+
2. `ImportItemsWithCurrencyPricesFromCsvFile(string $client, string $s3Url, string $catalogUuid)`
|
|
35
|
+
— **per-currency import**: each currency-coded column becomes its own
|
|
36
|
+
`ItemPrice` + `VendorItemCost` (e.g. Quad).
|
|
37
|
+
3. `RefreshItemsFromEtilize(string $client, array $items, ?string $catalog = null)`
|
|
38
|
+
where `items = [{partNumber, etilizeId}]` — looks each item up by `partNumber`
|
|
39
|
+
and, only if its stored `c_etilizeProductId` differs from the supplied `etilizeId`,
|
|
40
|
+
updates it and re-pulls the item's features + images from the Etilize datasheet.
|
|
41
|
+
Returns a per-item changed/unchanged summary.
|
|
42
|
+
|
|
43
|
+
## How the import works
|
|
44
|
+
|
|
45
|
+
Both import actions delegate to the shared private
|
|
46
|
+
`runItemCsvImport(..., bool $useCurrencyPrices)` — `useCurrencyPrices` is the only
|
|
47
|
+
difference between the two public entry points.
|
|
48
|
+
|
|
49
|
+
1. **Setup** — resolve `clientId` from `Core.Clients` by `clientIdentifier`, register
|
|
50
|
+
the client DB, and resolve `catalogId` from `catalogUuid` against the `Catalogs` table.
|
|
51
|
+
2. **Download & parse CSV** — pulled from S3 with `_Cloud::getFileFromS3`. **Row 1 =
|
|
52
|
+
headers, row 2 = a field-description row that is skipped, data starts at row 3.**
|
|
53
|
+
Columns are mapped **by header name** via case-insensitive regex patterns, so clients
|
|
54
|
+
whose columns are in a **different order** both work (Compass vs. Quad) — order is never
|
|
55
|
+
assumed.
|
|
56
|
+
3. **Per data row, find-or-create:**
|
|
57
|
+
- the **Item** — resolving `manufacturerId` / `itemCategoryId` / `itemTypeId` /
|
|
58
|
+
`assetTypeId` by name via a generic find-or-create over `Manufacturers`,
|
|
59
|
+
`ItemCategories`, `ItemTypes`, `AssetTypes`; set in the catalog with flags.
|
|
60
|
+
- the **VendorItem** — vendor resolved by name; `overridePoSubmissionIntegrationId`
|
|
61
|
+
left NULL.
|
|
62
|
+
- **pricing** — either a single NULL-currency row, or one row per currency column
|
|
63
|
+
(see Multi-currency below).
|
|
64
|
+
- **personas** — each CSV persona token resolved by numeric id **or** by name against
|
|
65
|
+
`Personas`, linked through the `Personas_Items` bridge table.
|
|
66
|
+
4. **Etilize enrichment** (from the `getProduct` datasheet):
|
|
67
|
+
- **features** → `Features` (find-or-create by name, Text measure) + `ItemFeatures` +
|
|
68
|
+
`ItemCategoryFeatureGroups` + `ItemCategoryFeatures`.
|
|
69
|
+
- **images** → `Images` (find-or-create by `sourceUrl`) + a single `ItemImages` row
|
|
70
|
+
holding the four size-slot FKs: thumbnail / low / medium / high mapped to Etilize
|
|
71
|
+
sizes **160 / 225 / 650 / 900**.
|
|
72
|
+
|
|
73
|
+
## Multi-currency
|
|
74
|
+
|
|
75
|
+
- The set of **valid currency codes is read per-client at runtime** from that client's own
|
|
76
|
+
`Currencies` table via `loadClientCurrencyCodes()` — **never hardcoded** — so each client
|
|
77
|
+
only uses the currencies it actually has configured.
|
|
78
|
+
- A small **alias map** normalizes CSV header spellings to the real `Currencies.code`
|
|
79
|
+
(e.g. a `PER` header → `PEN`).
|
|
80
|
+
- A CSV currency column is used **only if** its normalized code matches one of the client's
|
|
81
|
+
configured currencies. For each match the import creates an `ItemPrice` + `VendorItemCost`
|
|
82
|
+
with that `currencyId` (`priceType` `each`).
|
|
83
|
+
|
|
84
|
+
## Etilize re-pull (`RefreshItemsFromEtilize`)
|
|
85
|
+
|
|
86
|
+
- Item located by `partNumber`. The Etilize id is updated **only when** the supplied
|
|
87
|
+
`etilizeId` differs from the stored `c_etilizeProductId`.
|
|
88
|
+
- The feature/image re-pull is **find-or-create** and **does not delete stale features**
|
|
89
|
+
— this is intentional.
|
|
90
|
+
|
|
91
|
+
## Gotchas
|
|
92
|
+
|
|
93
|
+
- CSV layout is fixed at the top: header row, a **skipped** description row, then data
|
|
94
|
+
from row 3. Feeding a two-row (header+data) file would treat the first data row as the
|
|
95
|
+
description row.
|
|
96
|
+
- Columns are matched by header regex, not position — a renamed/missing header silently
|
|
97
|
+
drops that column rather than mis-mapping by index.
|
|
98
|
+
- Currency columns not present in the client's `Currencies` table are ignored, so a
|
|
99
|
+
catalog that ships an unconfigured currency simply won't price it.
|
|
100
|
+
|
|
101
|
+
## Change history
|
|
102
|
+
- 2026-06-26 — Documented `_Worker_Etilize_Items`: header-mapped S3 CSV import with
|
|
103
|
+
shared `runItemCsvImport`, normal (NULL-currency) vs. per-currency pricing, per-client
|
|
104
|
+
runtime currency resolution, persona linking, Etilize feature/image enrichment, and the
|
|
105
|
+
id-diff-only `RefreshItemsFromEtilize` re-pull. (bala)
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Etilize Item Translation Import
|
|
3
|
+
framework: "2.0"
|
|
4
|
+
repo: worker2
|
|
5
|
+
project: Worker
|
|
6
|
+
client: shared
|
|
7
|
+
type: feature
|
|
8
|
+
status: active
|
|
9
|
+
updated: 2026-06-26
|
|
10
|
+
owners: [bala]
|
|
11
|
+
files:
|
|
12
|
+
- worker2/Worker/Etilize/ItemTranslations.php
|
|
13
|
+
related:
|
|
14
|
+
- ./creating-worker-actions.md
|
|
15
|
+
- ./etilize-catalog-item-import.md
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Summary
|
|
19
|
+
|
|
20
|
+
The abstract worker class `_Worker_Etilize_ItemTranslations` imports **non-English**
|
|
21
|
+
item text from Etilize into the client's `ItemTranslations` table. English is never
|
|
22
|
+
written — it stays in the `Items` table. The class writes **directly to `DB_CLIENT`**
|
|
23
|
+
via raw `_Query` (**no api2**). Used today to give **Compass Canada** French (fr-CA)
|
|
24
|
+
catalog text without duplicating English, but the code is client-generic.
|
|
25
|
+
|
|
26
|
+
`ItemTranslations` columns: `itemId`, `languageId`, `title`, `description`,
|
|
27
|
+
`longDescription`, with `UNIQUE(itemId, languageId)`.
|
|
28
|
+
|
|
29
|
+
## Public actions
|
|
30
|
+
|
|
31
|
+
Routes are `Etilize/ItemTranslations/<Method>` (see
|
|
32
|
+
[creating-worker-actions](./creating-worker-actions.md)).
|
|
33
|
+
|
|
34
|
+
1. `ImportAllItemsForLanguage(string $client, string $languageCode, ?string $languageName = null, ?string $catalog = null)`
|
|
35
|
+
— translates **all** items that have a `c_etilizeProductId`.
|
|
36
|
+
2. `ImportItemsLanguageByPartNumbers(string $client, string $languageCode, array $partNumbers, ?string $languageName = null, ?string $catalog = null)`
|
|
37
|
+
— translates only the given part numbers (uses a `partNumber IN (...)` filter).
|
|
38
|
+
|
|
39
|
+
## How it works
|
|
40
|
+
|
|
41
|
+
1. Resolve `clientId` from `Core.Clients` by `clientIdentifier` and register the client DB.
|
|
42
|
+
2. **Find-or-create the Language** by `code` (e.g. `fr-CA`).
|
|
43
|
+
3. **Derive the Etilize locale** from the language code: `fr-CA` → `fr_ca` (lowercased,
|
|
44
|
+
hyphen → underscore).
|
|
45
|
+
4. Load the client's `Items` that have a **non-empty `c_etilizeProductId`** (scoped to the
|
|
46
|
+
given part numbers for the by-part-numbers action).
|
|
47
|
+
5. For each item, call the Etilize **Spex Live `getProduct`** API (`appId` 231136, catalog
|
|
48
|
+
default `na`) for that locale.
|
|
49
|
+
6. Extract the translated **`title`** (Etilize description **type 2**) and
|
|
50
|
+
**`longDescription`** (Etilize description **type 1**).
|
|
51
|
+
7. **Upsert** into `ItemTranslations` via `INSERT ... ON DUPLICATE KEY UPDATE` using
|
|
52
|
+
`COALESCE(VALUES(col), col)` so a blank new value never overwrites existing text.
|
|
53
|
+
|
|
54
|
+
Items **not published in the requested locale are skipped**.
|
|
55
|
+
|
|
56
|
+
## Gotchas
|
|
57
|
+
|
|
58
|
+
- The unique key is `(itemId, languageId)`; re-running an import upserts rather than
|
|
59
|
+
duplicating, and the `COALESCE` guard means a blank Etilize value will not clear an
|
|
60
|
+
existing translation.
|
|
61
|
+
- Only items with a `c_etilizeProductId` are translatable — items without an Etilize id
|
|
62
|
+
are silently skipped.
|
|
63
|
+
- English is intentionally never written here; it lives in the `Items` table.
|
|
64
|
+
|
|
65
|
+
## Change history
|
|
66
|
+
- 2026-06-26 — Documented `_Worker_Etilize_ItemTranslations`: per-language Etilize
|
|
67
|
+
`getProduct` import into `ItemTranslations` (title=desc type 2, longDescription=type 1),
|
|
68
|
+
locale derived from language code, COALESCE upsert that never overwrites with blanks,
|
|
69
|
+
all-items vs. by-part-numbers actions. (bala)
|
package/knowledge/INDEX.md
CHANGED
|
@@ -17,7 +17,7 @@ _Auto-generated by `knowledge.js index`. Do not hand-edit._
|
|
|
17
17
|
## 2.0 framework
|
|
18
18
|
|
|
19
19
|
- **_underscore** (_Underscore) _(framework core)_ — 16 doc(s) → [2.0/apps/_underscore/INDEX.md](2.0/apps/_underscore/INDEX.md)
|
|
20
|
-
- **worker2** (Worker) —
|
|
20
|
+
- **worker2** (Worker) — 17 doc(s) → [2.0/apps/worker2/INDEX.md](2.0/apps/worker2/INDEX.md)
|
|
21
21
|
- **api2** (API) — 7 doc(s) → [2.0/apps/api2/INDEX.md](2.0/apps/api2/INDEX.md)
|
|
22
22
|
- **dbchanges2** (Database Changes) _(framework core)_ — 3 doc(s) → [2.0/apps/dbchanges2/INDEX.md](2.0/apps/dbchanges2/INDEX.md)
|
|
23
23
|
- **toga2-supply** (TOGa Supply) — 3 doc(s) → [2.0/apps/toga2-supply/INDEX.md](2.0/apps/toga2-supply/INDEX.md)
|
|
@@ -7,12 +7,13 @@ apps:
|
|
|
7
7
|
- toga2-supply
|
|
8
8
|
- toga2-commerce
|
|
9
9
|
- worker
|
|
10
|
+
- worker2
|
|
10
11
|
- dbchanges2
|
|
11
12
|
project: _Underscore
|
|
12
13
|
client: compass-canada
|
|
13
14
|
type: profile
|
|
14
15
|
status: active
|
|
15
|
-
updated: 2026-06-
|
|
16
|
+
updated: 2026-06-26
|
|
16
17
|
owners: [jcardinal, bala]
|
|
17
18
|
files: []
|
|
18
19
|
related:
|
|
@@ -6,13 +6,14 @@ apps:
|
|
|
6
6
|
- api2
|
|
7
7
|
- toga2-supply
|
|
8
8
|
- toga2-commerce
|
|
9
|
+
- worker2
|
|
9
10
|
- dbchanges2
|
|
10
11
|
project: _Underscore
|
|
11
12
|
client: quad
|
|
12
13
|
type: profile
|
|
13
14
|
status: active
|
|
14
|
-
updated: 2026-06-
|
|
15
|
-
owners: ["jcardinal"]
|
|
15
|
+
updated: 2026-06-26
|
|
16
|
+
owners: ["jcardinal", "bala"]
|
|
16
17
|
files: []
|
|
17
18
|
related:
|
|
18
19
|
- ../../2.0/apps/_underscore/features/tracking-number-bridges.md
|
package/package.json
CHANGED