@memberjunction/ng-record-process-studio 0.0.1 → 5.44.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/README.md CHANGED
@@ -1,45 +1,67 @@
1
1
  # @memberjunction/ng-record-process-studio
2
2
 
3
- ## ⚠️ IMPORTANT NOTICE ⚠️
3
+ The generic **Bulk Operations studio** — reusable Angular UI for authoring, running, and auditing
4
+ **Record Processes** (rules-driven bulk operations). MJExplorer's *Bulk Operations* app is a thin host over
5
+ these components, but any MJ Angular app can drop them in.
4
6
 
5
- **This package is created solely for the purpose of setting up OIDC (OpenID Connect) trusted publishing with npm.**
7
+ A "Record Process" is a saved, reusable operation that runs over a set of an entity's records. The flagship
8
+ work type is **FieldRules** — declarative rules that set fields from a fixed value, another field, a
9
+ formula, an entity lookup, or an **AI prompt** — always previewed as an exact per-record diff before any
10
+ write happens.
6
11
 
7
- This is **NOT** a functional package and contains **NO** code or functionality beyond the OIDC setup configuration.
12
+ ## Components
8
13
 
9
- ## Purpose
14
+ | Component | Selector | Purpose |
15
+ |---|---|---|
16
+ | `RecordProcessStudioComponent` | `<mj-record-process-studio>` | The hub — list / search / create / edit / run bulk operations. |
17
+ | `RecordProcessEditorComponent` | `<mj-record-process-editor>` | Author one process: basics + target entity + scope + the embedded visual rules builder + an inline dry-run **Preview**. |
18
+ | `RecordProcessHistoryComponent` | `<mj-record-process-history>` | Run history with per-record drill-in (the field diff persisted on each Process Run Detail). |
10
19
 
11
- This package exists to:
12
- 1. Configure OIDC trusted publishing for the package name `@memberjunction/ng-record-process-studio`
13
- 2. Enable secure, token-less publishing from CI/CD workflows
14
- 3. Establish provenance for packages published under this name
20
+ All three are **standalone**, `OnPush`, extend `BaseAngularComponent` (so they accept `[Provider]` for
21
+ multi-provider), use **`--mj-*` design tokens** only (light + dark), and import nothing from
22
+ `@angular/router` (Generic-package rule).
15
23
 
16
- ## What is OIDC Trusted Publishing?
24
+ ## Quick use
17
25
 
18
- OIDC trusted publishing allows package maintainers to publish packages directly from their CI/CD workflows without needing to manage npm access tokens. Instead, it uses OpenID Connect to establish trust between the CI/CD provider (like GitHub Actions) and npm.
26
+ ```html
27
+ <!-- the whole hub -->
28
+ <mj-record-process-studio [Provider]="ProviderToUse"></mj-record-process-studio>
19
29
 
20
- ## Setup Instructions
30
+ <!-- just the authoring editor for one record (e.g. embedded in an entity form) -->
31
+ <mj-record-process-editor [Record]="record" [ShowToolbar]="false" [Provider]="ProviderToUse"></mj-record-process-editor>
21
32
 
22
- To properly configure OIDC trusted publishing for this package:
33
+ <!-- run history, optionally scoped to one process -->
34
+ <mj-record-process-history [RecordProcessID]="id" [Provider]="ProviderToUse"></mj-record-process-history>
35
+ ```
23
36
 
24
- 1. Go to [npmjs.com](https://www.npmjs.com/) and navigate to your package settings
25
- 2. Configure the trusted publisher (e.g., GitHub Actions)
26
- 3. Specify the repository and workflow that should be allowed to publish
27
- 4. Use the configured workflow to publish your actual package
37
+ Call `LoadRecordProcessStudio()` once from your app bootstrap to keep the components through tree-shaking.
28
38
 
29
- ## DO NOT USE THIS PACKAGE
39
+ ## How it composes
30
40
 
31
- This package is a placeholder for OIDC configuration only. It:
32
- - Contains no executable code
33
- - Provides no functionality
34
- - Should not be installed as a dependency
35
- - Exists only for administrative purposes
41
+ ```
42
+ ng-record-process-studio
43
+ ├─ embeds <mj-field-rules-builder> ← @memberjunction/ng-entity-action-ux (visual rule authoring)
44
+ ├─ embeds <mj-ai-prompt-selector> ← (grouped AI-prompt picker, via the builder)
45
+ ├─ mounts RecordProcessRunnerUX ← @memberjunction/ng-entity-action-ux (dry-run → confirm runner)
46
+ └─ runs RunRecordProcess ← @memberjunction/graphql-dataprovider → RecordProcessExecutor engine
47
+ ```
36
48
 
37
- ## More Information
49
+ The studio is intentionally **thin orchestration** over already-tested primitives: the rule engine
50
+ (`@memberjunction/global` field-rules, 25 tests), its metadata-aware layer (`@memberjunction/core`
51
+ `EntityFieldRules`), the transform plugins (`@memberjunction/field-rules-transforms`, 8 tests), the
52
+ builder/runner/serialization (`@memberjunction/ng-entity-action-ux`, 23 tests), and the executor +
53
+ scope-override (`@memberjunction/record-set-processor`, 24 facade tests). The studio adds the
54
+ list/edit/run/history surfaces around them.
38
55
 
39
- For more details about npm's trusted publishing feature, see:
40
- - [npm Trusted Publishing Documentation](https://docs.npmjs.com/generating-provenance-statements)
41
- - [GitHub Actions OIDC Documentation](https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect)
56
+ ## The editor, embedded two ways
42
57
 
43
- ---
58
+ - **In the Bulk Operations app** — `RecordProcessStudioComponent` shows it with its Save / Preview toolbar.
59
+ - **In the custom `MJ: Record Processes` entity form** — `ShowToolbar=false`; the form's
60
+ `<mj-record-form-container>` owns Save while the editor mutates the record in place. So editing a process
61
+ from anywhere in Explorer gets the same visual rules builder instead of a raw `Configuration` JSON field.
44
62
 
45
- **Maintained for OIDC setup purposes only**
63
+ ## Conventions held
64
+
65
+ Standalone + `inject()` · `@if`/`@for`/`@switch` · **PascalCase public members** · `--mj-*` tokens only ·
66
+ multi-provider via `[Provider]` / `ProviderToUse` · no Router imports · self-contained chrome (each component
67
+ owns its own toolbar so it drops into any host).
@@ -0,0 +1,61 @@
1
+ /**
2
+ * @fileoverview The authoring surface for a single Record Process (a reusable bulk operation). Edits the
3
+ * basics + target entity + scope, and — for the FieldRules work type — embeds the visual
4
+ * `<mj-field-rules-builder>` so a business user defines rules without touching JSON. An inline "Preview"
5
+ * runs the same server dry-run + diff runner used at invocation time.
6
+ *
7
+ * Reused in two places: standalone in the Bulk Operations hub (owns its Save/Preview toolbar), and inside
8
+ * the custom Record Process entity form (toolbar hidden — the form owns Save).
9
+ * @module @memberjunction/ng-record-process-studio
10
+ */
11
+ import { EventEmitter, OnInit } from '@angular/core';
12
+ import { BaseAngularComponent } from '@memberjunction/ng-base-types';
13
+ import { type EntityInfo } from '@memberjunction/core';
14
+ import { type FieldRuleSet } from '@memberjunction/global';
15
+ import { MJRecordProcessEntity } from '@memberjunction/core-entities';
16
+ import { type EntityActionUXContext, type EntityActionUXResult } from '@memberjunction/ng-entity-action-ux';
17
+ import * as i0 from "@angular/core";
18
+ export declare class RecordProcessEditorComponent extends BaseAngularComponent implements OnInit {
19
+ private cdr;
20
+ /** The process being edited. Set this OR `RecordProcessID` (or neither, for a new draft). */
21
+ Record: MJRecordProcessEntity | null;
22
+ /** Load an existing process by ID (alternative to passing `Record`). */
23
+ RecordProcessID: string | null;
24
+ /** Default EntityID for a brand-new process (e.g. the grid the user came from). */
25
+ DefaultEntityID: string | null;
26
+ /** Show the built-in Save / Preview / Cancel toolbar. Set false when an outer form owns Save. */
27
+ ShowToolbar: boolean;
28
+ /** Emitted after a successful Save (the persisted record). */
29
+ Saved: EventEmitter<MJRecordProcessEntity>;
30
+ /** Emitted when the user cancels. */
31
+ Cancelled: EventEmitter<void>;
32
+ Entities: EntityInfo[];
33
+ SelectedEntityName: string;
34
+ RuleSet: FieldRuleSet;
35
+ RulesValid: boolean;
36
+ Saving: boolean;
37
+ ErrorMessage: string;
38
+ PreviewDriver: {
39
+ DriverClass: string;
40
+ Context: EntityActionUXContext;
41
+ } | null;
42
+ get CanSave(): boolean;
43
+ get CanPreview(): boolean;
44
+ ngOnInit(): Promise<void>;
45
+ /** Resolves the record to edit: passed instance → by ID → a fresh draft. */
46
+ private loadRecord;
47
+ /** Generic setter for the simple string/enum fields, driven by the template inputs. */
48
+ set(field: 'Name' | 'Description' | 'Status' | 'ScopeType' | 'ScopeFilter' | 'WorkType', event: Event): void;
49
+ onEntityChange(event: Event): void;
50
+ onRulesChange(ruleSet: FieldRuleSet): void;
51
+ /** Saves the record (and emits). Returns success. */
52
+ Save(): Promise<boolean>;
53
+ /** Saves (if needed) then mounts the dry-run runner against the process's default scope. */
54
+ Preview(): Promise<void>;
55
+ onPreviewDone(_result: EntityActionUXResult): void;
56
+ Cancel(): void;
57
+ private resolveEntityName;
58
+ static ɵfac: i0.ɵɵFactoryDeclaration<RecordProcessEditorComponent, never>;
59
+ static ɵcmp: i0.ɵɵComponentDeclaration<RecordProcessEditorComponent, "mj-record-process-editor", never, { "Record": { "alias": "Record"; "required": false; }; "RecordProcessID": { "alias": "RecordProcessID"; "required": false; }; "DefaultEntityID": { "alias": "DefaultEntityID"; "required": false; }; "ShowToolbar": { "alias": "ShowToolbar"; "required": false; }; }, { "Saved": "Saved"; "Cancelled": "Cancelled"; }, never, never, true, never>;
60
+ }
61
+ //# sourceMappingURL=record-process-editor.component.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"record-process-editor.component.d.ts","sourceRoot":"","sources":["../../../src/lib/record-process-editor/record-process-editor.component.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAyD,YAAY,EAAS,MAAM,EAAkB,MAAM,eAAe,CAAC;AACnI,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAiB,KAAK,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC1E,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAA2D,KAAK,qBAAqB,EAAE,KAAK,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;;AAKrK,qBA6Ga,4BAA6B,SAAQ,oBAAqB,YAAW,MAAM;IACpF,OAAO,CAAC,GAAG,CAA6B;IAExC,6FAA6F;IACpF,MAAM,EAAE,qBAAqB,GAAG,IAAI,CAAQ;IACrD,wEAAwE;IAC/D,eAAe,EAAE,MAAM,GAAG,IAAI,CAAQ;IAC/C,mFAAmF;IAC1E,eAAe,EAAE,MAAM,GAAG,IAAI,CAAQ;IAC/C,iGAAiG;IACxF,WAAW,UAAQ;IAE5B,8DAA8D;IACpD,KAAK,sCAA6C;IAC5D,qCAAqC;IAC3B,SAAS,qBAA4B;IAExC,QAAQ,EAAE,UAAU,EAAE,CA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