eco-helpers 3.2.22 → 3.2.23
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +22 -8
- data/lib/eco/api/usecases/graphql/compat/ooze_redirect.rb +2 -13
- data/lib/eco/api/usecases/graphql/helpers/pages.rb +1 -1
- data/lib/eco/api/usecases/graphql/samples/pages/template.rb +1 -1
- data/lib/eco/version.rb +1 -1
- metadata +1 -6
- data/lib/eco/api/usecases/CLAUDE.md +0 -78
- data/lib/eco/api/usecases/graphql/CLAUDE.md +0 -120
- data/lib/eco/api/usecases/graphql/helpers/CLAUDE.md +0 -79
- data/lib/eco/api/usecases/graphql/samples/CLAUDE.md +0 -76
- data/lib/eco/api/usecases/graphql/samples/pages/CLAUDE.md +0 -59
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2803cb1dc211ef8682ebcd33e4007f4e748b5eb42f56ecbaa931b5258064ead8
|
|
4
|
+
data.tar.gz: 7c0f5f66654761ce6ee5cb37ca4eb354054161c0fc3914c37da27f7f6fce4273
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 10235574cf1a38826f4de995d715747b65fd657e0ef4e183b04644f8e26bebb2471c4d118fbbc00eac72e174d74c72d4685c9fb49a9a3667d8320c005ef7983a
|
|
7
|
+
data.tar.gz: e9f15c9f0e9c5243c835402fe64efd1384021773d3e0c0d65fbbfe17bd10128e944932e9a8ac21501cf31025040c9fcc0b2b26b8eb70844fd631f899008c822c
|
data/CHANGELOG.md
CHANGED
|
@@ -2,13 +2,27 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## [3.2.23] - 2026-09-30
|
|
6
|
+
|
|
7
|
+
Security republish of 3.2.22. **Backwards-compatible; no code change**: same dependencies, same
|
|
8
|
+
behaviour. Supersedes the published versions of this line, which are to be yanked.
|
|
9
|
+
|
|
10
|
+
### Security
|
|
11
|
+
|
|
12
|
+
- Removed customer and internal identifiers from shipped code comments and this changelog (a
|
|
13
|
+
comment listing customer organisations and their case names; internal repository names and
|
|
14
|
+
internal documentation paths). Comments and changelog only. It also carries the full-path packaging allowlist from 3.3.2, so the five internal
|
|
15
|
+
`CLAUDE.md` files that 3.2.22 packaged under `lib/` no longer ship.
|
|
16
|
+
- Packaging: the three runtime JSON files are declared in `.release-smoke-allow`, and the release
|
|
17
|
+
tasks accept `release/*` maintenance branches.
|
|
18
|
+
|
|
5
19
|
## [3.2.22] - 2026-08-14
|
|
6
20
|
|
|
7
21
|
### Fixed
|
|
8
22
|
|
|
9
23
|
- Republish of `3.2.21`: its `lib/eco/version.rb` shipped with doubled carriage returns
|
|
10
|
-
(`
|
|
11
|
-
` line endings), causing a `warning: encountered
|
|
12
24
|
in middle of line` on every
|
|
25
|
+
(`
|
|
26
|
+
` line endings), causing a `warning: encountered in middle of line` on every
|
|
13
27
|
load. Functionally identical otherwise; `3.2.21` will be yanked.
|
|
14
28
|
|
|
15
29
|
## [3.2.21] - 2026-08-14
|
|
@@ -16,7 +30,7 @@ All notable changes to this project will be documented in this file.
|
|
|
16
30
|
### Fixed
|
|
17
31
|
|
|
18
32
|
- Packaging-only republish of `3.2.19` with an allowlisted gemspec (backported from `3.3.0`).
|
|
19
|
-
Versions `3.2.16`-`3.2.19` shipped internal repository content (
|
|
33
|
+
Versions `3.2.16`-`3.2.19` shipped internal repository content (the repo's internal docs tooling,
|
|
20
34
|
`.claude/settings.json`) to rubygems.org via the old denylist `spec.files`; `3.2.19` is
|
|
21
35
|
yanked and `3.2.16`/`3.2.18` are queued for deletion by RubyGems support. `3.2.21` is the
|
|
22
36
|
identical `lib/` code packaged clean, so constraints like `'~> 3.2.0', '>= 3.2.19'` keep
|
|
@@ -26,7 +40,7 @@ All notable changes to this project will be documented in this file.
|
|
|
26
40
|
|
|
27
41
|
## [3.2.19] - 2026-07-16
|
|
28
42
|
|
|
29
|
-
|
|
43
|
+
A customer's `cans-upsert` reliability adoption + an ooze KPI counter fix. **Backwards-compatible.**
|
|
30
44
|
Cut from the `v3.2.18` tag (not `master`, which carries the native GraphQL activity/dashboard
|
|
31
45
|
readers depending on the unreleased gem `1.4.0`), so this ships needing only the published
|
|
32
46
|
`ecoportal-api-graphql 1.3.14`.
|
|
@@ -59,7 +73,7 @@ guard so the dead-fragment class of bug can't reach production again.
|
|
|
59
73
|
on 2026-07-04 (`243822b9`), then the live-crash fix `352a9657` (LocationDraft dead-fragment
|
|
60
74
|
convention) landed on 2026-07-05 — keeping the same `3.2.17` label. Because `3.2.17` is installed
|
|
61
75
|
from git/path (unpublished), a consumer bundled in that ~26h window reports `3.2.17` yet lacks the
|
|
62
|
-
fix. This crashed the **live
|
|
76
|
+
fix. This crashed the **live customer** org-structure sync again on 2026-07-09 with the exact
|
|
63
77
|
`uninitialized constant …Fragment::LocationDraft (NameError)`. Bumping to `3.2.18` makes the fixed
|
|
64
78
|
build unambiguously identifiable: any consumer on `>= 3.2.18` provably has the fix.
|
|
65
79
|
|
|
@@ -68,7 +82,7 @@ build unambiguously identifiable: any consumer on `>= 3.2.18` provably has the f
|
|
|
68
82
|
- **Regression-guard spec for the dead-fragment convention.**
|
|
69
83
|
`spec/…/helpers/location/command/end_points/optimizations_spec.rb` scans every file under
|
|
70
84
|
`usecases/graphql/` and fails if any references a fragment via the removed `___Const__Fragment` /
|
|
71
|
-
`::Fragment::<Name>` constant convention (the exact NameError that crashed
|
|
85
|
+
`::Fragment::<Name>` constant convention (the exact NameError that crashed a customer sync), and asserts
|
|
72
86
|
the three Location command payload procs still route fragments through the `spread :Name` registry
|
|
73
87
|
DSL. It is a SOURCE lint, not a full offline render: rendering needs the graphlient fork's
|
|
74
88
|
`to_query_string`/`spread` DSL, but eco-helpers' own bundle resolves stock graphlient `0.8.0` (the
|
|
@@ -93,7 +107,7 @@ to the gem's `Diff` module (gem v1.3.11), which is tagged but unpublished.
|
|
|
93
107
|
`___Const__Fragment` constant convention (`___Ecoportal__API__GraphQL__Fragment__LocationDraft` /
|
|
94
108
|
`…__LocationsError`), which the gem's registry-based fragments no longer expose as Ruby constants →
|
|
95
109
|
`uninitialized constant … Fragment::LocationDraft (NameError)` when building a locations-draft
|
|
96
|
-
`addCommands`/`create`/`publish` request. Crashed
|
|
110
|
+
`addCommands`/`create`/`publish` request. Crashed a customer's live tagtree / org-structure sync.
|
|
97
111
|
Now `spread :LocationDraft` / `spread :LocationsError`, matching the gem.
|
|
98
112
|
|
|
99
113
|
### Dependencies
|
|
@@ -101,7 +115,7 @@ to the gem's `Diff` module (gem v1.3.11), which is tagged but unpublished.
|
|
|
101
115
|
- **Raised floors to the fixed stack: `ecoportal-api-graphql >= 1.3.11`, `ecoportal-api-v2 >= 3.3.3`.**
|
|
102
116
|
Stops the stale gem 1.3.9 (missing the LocationStructure `updatedAt`/`createdAt` selection fixes from
|
|
103
117
|
1.3.10) and the buggy v2 3.3.2 (Ruby-3.x `DoubleModel` cascade `TypeError`) from resolving on
|
|
104
|
-
consumers — both crashed
|
|
118
|
+
consumers — both crashed a customer's live integration.
|
|
105
119
|
|
|
106
120
|
### Added
|
|
107
121
|
|
|
@@ -62,19 +62,8 @@ module Eco::API::UseCases::GraphQL::Compat
|
|
|
62
62
|
# force.custom_script = new_script → write the LISP script
|
|
63
63
|
# force.script → raw script content (alias)
|
|
64
64
|
#
|
|
65
|
-
# Affected cases currently blocked
|
|
66
|
-
#
|
|
67
|
-
# act-gov: 5 x 20240130_act_*_case, rearrage_page_sites_case
|
|
68
|
-
# briscoes: remove_induction_sections, 310524_Briscoes_Remove_Tasks
|
|
69
|
-
# chorus: 4 x audit_update cases
|
|
70
|
-
# hcc: update_enterprise_risk_case
|
|
71
|
-
# lic: update_life_cycle_force_case
|
|
72
|
-
# mitre10: rich_text_update, update_location_force, updating_template
|
|
73
|
-
# npdc: contractor_title_force, risk_titile_force, fix_title_syncing,
|
|
74
|
-
# reminder_date_fields, 10092024_NPDC_CP_Add_Force
|
|
75
|
-
# profile-group: int_training_review, 20231026_profile_wellness
|
|
76
|
-
# turners-growers: event_changes, inj_cost_calc, remove_line_force
|
|
77
|
-
# twg: hide_attached_risks, add_new_force
|
|
65
|
+
# Affected cases currently blocked: roughly half of all ooze cases in the internal script repos'
|
|
66
|
+
# survey (per-customer breakdown kept in the internal migration notes, not in this gem).
|
|
78
67
|
#
|
|
79
68
|
# Implementation sketch (to be built when the endpoint lands):
|
|
80
69
|
#
|
|
@@ -7,7 +7,7 @@ module Eco::API::UseCases::GraphQL::Helpers
|
|
|
7
7
|
# with duck-typing so they work against the GraphQL page/section/field models.
|
|
8
8
|
#
|
|
9
9
|
# This is Phase 1 of the ooze -> native GraphQL migration (build the shared substrate before
|
|
10
|
-
# any case). See ecoportal-api-graphql
|
|
10
|
+
# any case). See the ecoportal-api-graphql repo's internal docs.
|
|
11
11
|
module Pages
|
|
12
12
|
end
|
|
13
13
|
end
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
module Eco::API::UseCases::GraphQL::Samples::Pages
|
|
2
2
|
# Template (workflow) build-from-scratch + (later) diff-and-update samples.
|
|
3
|
-
# See ecoportal-api-graphql
|
|
3
|
+
# See the ecoportal-api-graphql repo's internal docs.
|
|
4
4
|
module Template
|
|
5
5
|
end
|
|
6
6
|
end
|
data/lib/eco/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: eco-helpers
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.2.
|
|
4
|
+
version: 3.2.23
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Oscar Segura
|
|
@@ -730,7 +730,6 @@ files:
|
|
|
730
730
|
- lib/eco/api/session/config/tagtree.rb
|
|
731
731
|
- lib/eco/api/session/config/workflow.rb
|
|
732
732
|
- lib/eco/api/usecases.rb
|
|
733
|
-
- lib/eco/api/usecases/CLAUDE.md
|
|
734
733
|
- lib/eco/api/usecases/base_case.rb
|
|
735
734
|
- lib/eco/api/usecases/base_case/model.rb
|
|
736
735
|
- lib/eco/api/usecases/base_case/type.rb
|
|
@@ -817,7 +816,6 @@ files:
|
|
|
817
816
|
- lib/eco/api/usecases/default_cases/update_case.rb
|
|
818
817
|
- lib/eco/api/usecases/default_cases/upsert_case.rb
|
|
819
818
|
- lib/eco/api/usecases/graphql.rb
|
|
820
|
-
- lib/eco/api/usecases/graphql/CLAUDE.md
|
|
821
819
|
- lib/eco/api/usecases/graphql/base.rb
|
|
822
820
|
- lib/eco/api/usecases/graphql/compat.rb
|
|
823
821
|
- lib/eco/api/usecases/graphql/compat/ooze_redirect.rb
|
|
@@ -828,7 +826,6 @@ files:
|
|
|
828
826
|
- lib/eco/api/usecases/graphql/compat/parity/harness.rb
|
|
829
827
|
- lib/eco/api/usecases/graphql/compat/parity/run_result.rb
|
|
830
828
|
- lib/eco/api/usecases/graphql/helpers.rb
|
|
831
|
-
- lib/eco/api/usecases/graphql/helpers/CLAUDE.md
|
|
832
829
|
- lib/eco/api/usecases/graphql/helpers/base.rb
|
|
833
830
|
- lib/eco/api/usecases/graphql/helpers/base/case_env.rb
|
|
834
831
|
- lib/eco/api/usecases/graphql/helpers/base/error_handling.rb
|
|
@@ -869,7 +866,6 @@ files:
|
|
|
869
866
|
- lib/eco/api/usecases/graphql/helpers/pages/shortcuts.rb
|
|
870
867
|
- lib/eco/api/usecases/graphql/helpers/pages/typed_fields_pairing.rb
|
|
871
868
|
- lib/eco/api/usecases/graphql/samples.rb
|
|
872
|
-
- lib/eco/api/usecases/graphql/samples/CLAUDE.md
|
|
873
869
|
- lib/eco/api/usecases/graphql/samples/contractors.rb
|
|
874
870
|
- lib/eco/api/usecases/graphql/samples/contractors/dsl.rb
|
|
875
871
|
- lib/eco/api/usecases/graphql/samples/location.rb
|
|
@@ -897,7 +893,6 @@ files:
|
|
|
897
893
|
- lib/eco/api/usecases/graphql/samples/location/service/tree_to_list/converter/parser.rb
|
|
898
894
|
- lib/eco/api/usecases/graphql/samples/location/service/tree_to_list/output.rb
|
|
899
895
|
- lib/eco/api/usecases/graphql/samples/pages.rb
|
|
900
|
-
- lib/eco/api/usecases/graphql/samples/pages/CLAUDE.md
|
|
901
896
|
- lib/eco/api/usecases/graphql/samples/pages/org_page.rb
|
|
902
897
|
- lib/eco/api/usecases/graphql/samples/pages/org_page/base.rb
|
|
903
898
|
- lib/eco/api/usecases/graphql/samples/pages/org_page/dsl.rb
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
# usecases
|
|
2
|
-
|
|
3
|
-
The use-case registry and all built-in case base classes for scripting against EcoPortal.
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## What a use case is
|
|
8
|
-
|
|
9
|
-
A use case is a self-contained, named, runnable unit of work. It registers itself with
|
|
10
|
-
the CLI framework, receives `session`, `options`, and `usecase` from the runner, and
|
|
11
|
-
executes its `process` (or `process_ooze` / `process_page`) method.
|
|
12
|
-
|
|
13
|
-
```
|
|
14
|
-
CLI invokes rake → rake finds registered case → UseCase#launch → main() → process()
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
---
|
|
18
|
-
|
|
19
|
-
## Directory structure
|
|
20
|
-
|
|
21
|
-
| Path | What lives there |
|
|
22
|
-
|------|-----------------|
|
|
23
|
-
| `graphql/` | GraphQL-native base cases + samples (see `graphql/CLAUDE.md`) |
|
|
24
|
-
| `ooze_samples/` | APIv2/REST base cases: `OozeBaseCase`, `RegisterUpdateCase` |
|
|
25
|
-
| `ooze_cases/` | Concrete built-in ooze cases (export register, etc.) |
|
|
26
|
-
| `default/` | Built-in people, location, and utility cases |
|
|
27
|
-
| `default_cases/` | Loader and samples for default cases |
|
|
28
|
-
| `samples/` | Misc driver samples |
|
|
29
|
-
| `graphql.rb` | GraphQL use case loader |
|
|
30
|
-
| `ooze_samples.rb` | Ooze/REST use case loader |
|
|
31
|
-
| `default.rb` | Default use case loader |
|
|
32
|
-
|
|
33
|
-
---
|
|
34
|
-
|
|
35
|
-
## Adding a new use case
|
|
36
|
-
|
|
37
|
-
1. Subclass the appropriate base:
|
|
38
|
-
|
|
39
|
-
| Your use case | Inherit from |
|
|
40
|
-
|---|---|
|
|
41
|
-
| Process pages in a register (update workflow) | `Eco::API::UseCases::GraphQL::PageCase` |
|
|
42
|
-
| Process pages org-wide (cross-register, audit) | `Eco::API::UseCases::GraphQL::OrgPageCase` |
|
|
43
|
-
| Custom GraphQL script (export, report, one-off) | `Eco::API::UseCases::GraphQL::Base` |
|
|
44
|
-
| Legacy APIv2 register update | `Eco::API::UseCases::OozeSamples::RegisterUpdateCase` |
|
|
45
|
-
|
|
46
|
-
2. Set `name` and `type`:
|
|
47
|
-
```ruby
|
|
48
|
-
name 'my-case-name' # CLI identifier: called with -my-case-name
|
|
49
|
-
type :other # :people | :contractors | :other
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
3. Override the entry point (`process_page`, `process`, or `process_ooze`).
|
|
53
|
-
|
|
54
|
-
4. Register in the org's `config/cli.rb`:
|
|
55
|
-
```ruby
|
|
56
|
-
cases.add('-my-case-name', :other, 'Description')
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
---
|
|
60
|
-
|
|
61
|
-
## How cases are launched
|
|
62
|
-
|
|
63
|
-
`Eco::API::UseCases::UseCase#launch` calls `callback.call(*uio.params)` where the
|
|
64
|
-
callback is bound to `method(:main)`. Before launch, `@session` and `@options` are
|
|
65
|
-
injected into the instance — subclasses access them via the `attr_reader` in `CaseEnv`.
|
|
66
|
-
|
|
67
|
-
The `:other` type passes `(session, options, usecase)` positionally to `main`.
|
|
68
|
-
For `GraphQL::Base` subclasses the signature is `main(*_args)` — `session` and
|
|
69
|
-
`options` are already available via the helpers module before `main` is called.
|
|
70
|
-
|
|
71
|
-
---
|
|
72
|
-
|
|
73
|
-
## Related
|
|
74
|
-
|
|
75
|
-
- `graphql/CLAUDE.md` — GraphQL case hierarchy, PageCase/OrgPageCase
|
|
76
|
-
- `ooze_samples/` — legacy v2 cases (RegisterUpdateCase, OozeBaseCase)
|
|
77
|
-
- `eco-helpers/CLAUDE.md` — top-level gem context
|
|
78
|
-
- `ecoportal-api-graphql` — upstream gem providing `SearchConf`, `Compat::Pages`, etc.
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
# usecases/graphql
|
|
2
|
-
|
|
3
|
-
GraphQL-native use case base classes and helpers. All cases here work directly with
|
|
4
|
-
`ecoportal-api-graphql` — no v2 REST layer, no ooze objects.
|
|
5
|
-
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
## Class hierarchy
|
|
9
|
-
|
|
10
|
-
```
|
|
11
|
-
Eco::API::Common::Loaders::UseCase (registration + launch)
|
|
12
|
-
↓
|
|
13
|
-
Eco::API::UseCases::GraphQL::Base ← universal GraphQL env
|
|
14
|
-
├── GraphQL::Samples::Pages::Page::Base ← register-scoped pages
|
|
15
|
-
│ ├── GraphQL::Samples::Pages::OrgPage::Base ← org-wide pages
|
|
16
|
-
│ └── your subclass (process_page, search_conf)
|
|
17
|
-
└── your subclass directly (custom scripts: exports, reports, one-offs)
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
Samples live under `samples/pages/` — NOT in the `graphql/` root. The root only
|
|
21
|
-
has `base.rb`, `helpers.rb`, `utils.rb`, and `samples.rb`.
|
|
22
|
-
|
|
23
|
-
---
|
|
24
|
-
|
|
25
|
-
## Base — `graphql/base.rb`
|
|
26
|
-
|
|
27
|
-
Universal GraphQL environment. Provides `graphql`, `session`, `options`, `config`,
|
|
28
|
-
`simulate?`, `log`, `backup` via `Helpers::Base` (see `helpers/CLAUDE.md`).
|
|
29
|
-
|
|
30
|
-
Override `process` to write your script:
|
|
31
|
-
```ruby
|
|
32
|
-
class MyCase < Eco::API::UseCases::GraphQL::Base
|
|
33
|
-
name 'my-case'
|
|
34
|
-
def process
|
|
35
|
-
graphql.currentOrganization.contractorEntities.each { |c| puts c.name }
|
|
36
|
-
end
|
|
37
|
-
end
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
---
|
|
41
|
-
|
|
42
|
-
## Pages — `samples/pages/`
|
|
43
|
-
|
|
44
|
-
Page processing base cases. Follow the hierarchy: `page/base` → `org_page/base`.
|
|
45
|
-
|
|
46
|
-
### `samples/pages/page/base.rb` — `Samples::Pages::Page::Base`
|
|
47
|
-
|
|
48
|
-
For **register-scoped** page update workflows.
|
|
49
|
-
|
|
50
|
-
**Class methods:** `register_id 'REG_ID'`, `batch_size 50` (default)
|
|
51
|
-
|
|
52
|
-
**Override points:**
|
|
53
|
-
- `process_page(page)` — **required** — transformation for one page
|
|
54
|
-
- `search_conf` — optional — call `super` to keep register scope, then add filters
|
|
55
|
-
|
|
56
|
-
**Protected helpers:** `update_page`, `skip(reason)`, `each_page`
|
|
57
|
-
|
|
58
|
-
**KPI readers:** `total_pages`, `processed_pages`, `updated_pages`, `skipped_pages`, `failed_pages`
|
|
59
|
-
|
|
60
|
-
**DSL (via `samples/pages/page/dsl.rb`):** `sc`, `in_register`, `state_is`, `external_id_eq`, `updated_since`
|
|
61
|
-
|
|
62
|
-
```ruby
|
|
63
|
-
class Custom::UseCase::UpdateStatus < Eco::API::UseCases::GraphQL::Samples::Pages::Page::Base
|
|
64
|
-
name 'update-status'
|
|
65
|
-
register_id 'REG_ABC'
|
|
66
|
-
|
|
67
|
-
def search_conf
|
|
68
|
-
super.filter(state_is(:active))
|
|
69
|
-
end
|
|
70
|
-
|
|
71
|
-
def process_page(page)
|
|
72
|
-
page.name = page.name.upcase
|
|
73
|
-
update_page(page)
|
|
74
|
-
end
|
|
75
|
-
end
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
### `samples/pages/org_page/base.rb` — `Samples::Pages::OrgPage::Base`
|
|
79
|
-
|
|
80
|
-
Inherits `Page::Base`. `search_conf` starts empty (org-wide, no register scope).
|
|
81
|
-
Use for: archive sweeps, cross-register audits, bulk org operations.
|
|
82
|
-
|
|
83
|
-
---
|
|
84
|
-
|
|
85
|
-
## Samples — `graphql/samples/`
|
|
86
|
-
|
|
87
|
-
Built-in ready-to-use case implementations:
|
|
88
|
-
- `samples/location.rb` — location structure management cases
|
|
89
|
-
- `samples/contractors.rb` — contractor entity cases
|
|
90
|
-
|
|
91
|
-
See `samples/CLAUDE.md` for details.
|
|
92
|
-
|
|
93
|
-
---
|
|
94
|
-
|
|
95
|
-
## Helpers — `graphql/helpers/`
|
|
96
|
-
|
|
97
|
-
Mixins providing domain-specific access patterns. See `helpers/CLAUDE.md`.
|
|
98
|
-
|
|
99
|
-
---
|
|
100
|
-
|
|
101
|
-
## Loader order in `graphql.rb`
|
|
102
|
-
|
|
103
|
-
```ruby
|
|
104
|
-
require 'graphql/helpers' # environment mixins (graphql, session, simulate? etc.)
|
|
105
|
-
require 'graphql/utils' # utility modules (SFTP etc.)
|
|
106
|
-
require 'graphql/base' # GraphQL::Base — universal foundation
|
|
107
|
-
require 'graphql/samples' # sample cases: location, contractors, pages, ...
|
|
108
|
-
# └─ graphql/samples/pages.rb
|
|
109
|
-
# └─ pages/page.rb → page/dsl.rb, page/base.rb
|
|
110
|
-
# └─ pages/org_page.rb → org_page/dsl.rb, org_page/base.rb
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
Page base cases are in `samples/pages/` — NOT in the `graphql/` root.
|
|
114
|
-
Custom org cases are NOT loaded here — they live in the implementation repo.
|
|
115
|
-
|
|
116
|
-
## default/pages/
|
|
117
|
-
|
|
118
|
-
CLI-integrated page use cases go in `default/pages/` (mirroring `default/locations/`
|
|
119
|
-
and `default/people/`). Currently empty — add cases there when a pattern is common
|
|
120
|
-
enough to expose to all org environments. See `default/pages.rb` for the convention.
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
# usecases/graphql/helpers
|
|
2
|
-
|
|
3
|
-
Mixin modules providing domain-specific helper methods for GraphQL use cases.
|
|
4
|
-
All modules are ultimately included via `Helpers::Base` into `GraphQL::Base`.
|
|
5
|
-
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
## Include chain
|
|
9
|
-
|
|
10
|
-
```
|
|
11
|
-
GraphQL::Base
|
|
12
|
-
includes Helpers::Base
|
|
13
|
-
includes CaseEnv → session, options, config, simulate?, log, ErrorHandling
|
|
14
|
-
includes GraphQLEnv → graphql (lazy, memoized)
|
|
15
|
-
includes Helpers (loader)
|
|
16
|
-
includes Helpers::Location → location tree helpers
|
|
17
|
-
includes Helpers::Contractors → contractor entity helpers
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
---
|
|
21
|
-
|
|
22
|
-
## Helpers::Base (`helpers/base.rb`)
|
|
23
|
-
|
|
24
|
-
Core environment — included in every GraphQL use case.
|
|
25
|
-
|
|
26
|
-
| Method | Source | Description |
|
|
27
|
-
|--------|--------|-------------|
|
|
28
|
-
| `session` | `CaseEnv` | Current `Eco::API::Session` |
|
|
29
|
-
| `options` | `CaseEnv` | Options hash from CLI/runner |
|
|
30
|
-
| `config` | `CaseEnv` | `session.config` shortcut |
|
|
31
|
-
| `simulate?` | `CaseEnv` | `options[:simulate] \|\| options[:dry_run]` |
|
|
32
|
-
| `log(level)` | `CaseEnv` | Logger proxy |
|
|
33
|
-
| `graphql` | `GraphQLEnv` | Lazy-loaded `Ecoportal::API::GraphQL` instance |
|
|
34
|
-
| `backup(data, type:)` | `Helpers::Base` | Save JSON to requests folder |
|
|
35
|
-
| `exit_error(msg)` | `Helpers::Base` | Log error and `exit(1)` |
|
|
36
|
-
|
|
37
|
-
---
|
|
38
|
-
|
|
39
|
-
## Helpers::Location (`helpers/location/`)
|
|
40
|
-
|
|
41
|
-
Location tree access, tag remapping, classification parsing.
|
|
42
|
-
|
|
43
|
-
- `helpers/location/base.rb` — `Location::Base` mixin
|
|
44
|
-
- `helpers/location/base/tree_tracking.rb` — track tree mutations
|
|
45
|
-
- `helpers/location/base/classifications_parser.rb` — parse location classifications
|
|
46
|
-
- `helpers/location/tags_remap/` — remapping tags across location changes
|
|
47
|
-
- `helpers/location/command/` — apply/diff location structure commands
|
|
48
|
-
|
|
49
|
-
---
|
|
50
|
-
|
|
51
|
-
## Helpers::Contractors (`helpers/contractors/`)
|
|
52
|
-
|
|
53
|
-
Contractor entity loading helpers.
|
|
54
|
-
|
|
55
|
-
- `helpers/contractors/base.rb` — base contractor helpers
|
|
56
|
-
- `helpers/contractors/base/load.rb` — batch load contractor entities
|
|
57
|
-
|
|
58
|
-
---
|
|
59
|
-
|
|
60
|
-
## Adding a new helper
|
|
61
|
-
|
|
62
|
-
1. Create `helpers/my_domain/base.rb`:
|
|
63
|
-
```ruby
|
|
64
|
-
module Eco::API::UseCases::GraphQL::Helpers
|
|
65
|
-
module MyDomain
|
|
66
|
-
module Base
|
|
67
|
-
private
|
|
68
|
-
def my_helper_method
|
|
69
|
-
graphql.myDomainQuery(...)
|
|
70
|
-
end
|
|
71
|
-
end
|
|
72
|
-
end
|
|
73
|
-
end
|
|
74
|
-
```
|
|
75
|
-
2. Create `helpers/my_domain.rb` as a loader that includes `Base`
|
|
76
|
-
3. Add `require_relative 'my_domain'` to `helpers.rb`
|
|
77
|
-
|
|
78
|
-
The helper is then available in all cases that include `Helpers::Base` (i.e., all
|
|
79
|
-
subclasses of `GraphQL::Base` including `PageCase` and `OrgPageCase`).
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
# usecases/graphql/samples
|
|
2
|
-
|
|
3
|
-
Built-in GraphQL sample base classes shipped with the gem.
|
|
4
|
-
These are abstract/semi-abstract classes that org scripts inherit from.
|
|
5
|
-
Concrete, CLI-integrated cases go in `usecases/default/` instead.
|
|
6
|
-
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
## Hierarchy convention
|
|
10
|
-
|
|
11
|
-
Each domain follows:
|
|
12
|
-
```
|
|
13
|
-
samples/<domain>.rb ← namespace loader (may also BE the base class)
|
|
14
|
-
samples/<domain>/
|
|
15
|
-
<level>/
|
|
16
|
-
dsl.rb ← DSL concern — include in base, available to subclasses
|
|
17
|
-
base.rb ← Base class (inherits from GraphQL::Base or parent level)
|
|
18
|
-
<functional_level>.rb ← Optional: opinionated subclass, inherit directly
|
|
19
|
-
<functional_level>/
|
|
20
|
-
dsl.rb ← Further DSL for that functional level
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
DSLs are always **concerns (modules)** to include — never classes.
|
|
24
|
-
Bases are **classes** with the scaffolding logic.
|
|
25
|
-
Functional levels add opinionated defaults on top of base.
|
|
26
|
-
|
|
27
|
-
---
|
|
28
|
-
|
|
29
|
-
## Contents
|
|
30
|
-
|
|
31
|
-
| File | Class | Purpose |
|
|
32
|
-
|------|-------|---------|
|
|
33
|
-
| `samples/location.rb` | `Samples::Location` | Location structure management |
|
|
34
|
-
| `samples/location/command.rb` | `Samples::Location::Command` | Apply location tree commands |
|
|
35
|
-
| `samples/location/service.rb` | `Samples::Location::Service` | Tree diffing and conversion service |
|
|
36
|
-
| `samples/contractors.rb` | `Samples::Contractors` | Contractor entity base case |
|
|
37
|
-
| `samples/contractors/dsl.rb` | `Contractors::DSL` | Contractor helper mixin |
|
|
38
|
-
| `samples/pages.rb` | `Samples::Pages` (namespace) | Page processing cases loader |
|
|
39
|
-
| `samples/pages/page/dsl.rb` | `Pages::Page::DSL` | SearchConf helpers mixin |
|
|
40
|
-
| `samples/pages/page/base.rb` | `Pages::Page::Base` | Register-scoped page iteration |
|
|
41
|
-
| `samples/pages/org_page/dsl.rb` | `Pages::OrgPage::DSL` | Org-page DSL (extends Page::DSL) |
|
|
42
|
-
| `samples/pages/org_page/base.rb` | `Pages::OrgPage::Base` | Org-wide page iteration |
|
|
43
|
-
|
|
44
|
-
---
|
|
45
|
-
|
|
46
|
-
## Difference: samples vs org-specific cases vs default
|
|
47
|
-
|
|
48
|
-
| Layer | Location | Purpose |
|
|
49
|
-
|---|---|---|
|
|
50
|
-
| **samples** (here) | `eco-helpers/lib/.../graphql/samples/` | Abstract base classes — org scripts inherit |
|
|
51
|
-
| **default** | `eco-helpers/lib/.../usecases/default/` | Concrete CLI-integrated cases for ALL orgs |
|
|
52
|
-
| **org-specific** | `multi_org_api/{org}/config/graphql_cases/` | Org-specific implementations |
|
|
53
|
-
|
|
54
|
-
Org scripts inherit from `samples/`, optionally via `default/` as an intermediate layer.
|
|
55
|
-
|
|
56
|
-
---
|
|
57
|
-
|
|
58
|
-
## Adding a new built-in sample
|
|
59
|
-
|
|
60
|
-
1. Create the case file in `samples/`:
|
|
61
|
-
```ruby
|
|
62
|
-
# lib/eco/api/usecases/graphql/samples/my_domain.rb
|
|
63
|
-
class Eco::API::UseCases::GraphQL::Samples::MyDomain < Eco::API::UseCases::GraphQL::Base
|
|
64
|
-
name 'my-domain-case'
|
|
65
|
-
type :other
|
|
66
|
-
|
|
67
|
-
def process
|
|
68
|
-
# ...
|
|
69
|
-
end
|
|
70
|
-
end
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
2. Add `require_relative 'samples/my_domain'` to `samples.rb`.
|
|
74
|
-
|
|
75
|
-
If the case is page-centric, inherit from `PageCase` instead of `Base` to get
|
|
76
|
-
pagination, KPI tracking, and `update_page` for free.
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
# samples/pages
|
|
2
|
-
|
|
3
|
-
Base classes for GraphQL-native page processing use cases.
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## Structure
|
|
8
|
-
|
|
9
|
-
```
|
|
10
|
-
pages/
|
|
11
|
-
page/
|
|
12
|
-
dsl.rb ← Page::DSL — SearchConf helpers mixin (sc, in_register, state_is, ...)
|
|
13
|
-
base.rb ← Page::Base — register-scoped page iteration + KPI scaffolding
|
|
14
|
-
org_page/
|
|
15
|
-
dsl.rb ← OrgPage::DSL — extends Page::DSL (org-wide helpers)
|
|
16
|
-
base.rb ← OrgPage::Base — org-wide iteration (no default register scope)
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
---
|
|
20
|
-
|
|
21
|
-
## Inheritance
|
|
22
|
-
|
|
23
|
-
```
|
|
24
|
-
GraphQL::Base
|
|
25
|
-
↓
|
|
26
|
-
Samples::Pages::Page::Base (register-scoped, inherits Page::DSL)
|
|
27
|
-
↓
|
|
28
|
-
Samples::Pages::OrgPage::Base (org-wide, overrides search_conf)
|
|
29
|
-
↓
|
|
30
|
-
your org subclass
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
---
|
|
34
|
-
|
|
35
|
-
## Page::Base — register-scoped scripts
|
|
36
|
-
|
|
37
|
-
Override `process_page(page)` and optionally `search_conf`.
|
|
38
|
-
Set `register_id` and `batch_size` on the class.
|
|
39
|
-
|
|
40
|
-
## OrgPage::Base — org-wide scripts
|
|
41
|
-
|
|
42
|
-
Same as Page::Base but `search_conf` starts empty.
|
|
43
|
-
Add your own filters via `super.filter(state_is(:active))` etc.
|
|
44
|
-
|
|
45
|
-
---
|
|
46
|
-
|
|
47
|
-
## Adding a functional level
|
|
48
|
-
|
|
49
|
-
If a common pattern emerges (e.g., "stage-submit scripts"), add:
|
|
50
|
-
|
|
51
|
-
```
|
|
52
|
-
pages/page/
|
|
53
|
-
stage_submitter.rb ← Page::StageSubmitter < Page::Base
|
|
54
|
-
stage_submitter/
|
|
55
|
-
dsl.rb ← StageSubmitter::DSL
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
Keep base.rb for the pure iteration scaffolding; put opinionated defaults in
|
|
59
|
-
the functional level so scripts can choose their entry point.
|