@rentman/rm-core 66.6.4 → 66.8.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.
@@ -22,6 +22,20 @@ export type GlobalTransactionError = {
22
22
  string: string;
23
23
  level: TransactionErrorLevel;
24
24
  };
25
+ /**
26
+ * @description
27
+ * Tracks which items and fields on a transaction were changed by AI rather than by a human.
28
+ *
29
+ * Items are keyed by {@link ItemEntry.id}, which is unique within the RmCore, so these references stay valid when
30
+ * changes are moved from a child transaction to its parent.
31
+ */
32
+ export type TransactionAiChanges = {
33
+ created: Set<ItemEntry['id']>;
34
+ deleted: Set<ItemEntry['id']>;
35
+ fields: Partial<{
36
+ [itemEntryId: number]: Set<string>;
37
+ }>;
38
+ };
25
39
  /**
26
40
  * Converts child CollectionOptionsInterfaces to CollectionResources.
27
41
  */
@@ -85,13 +99,7 @@ export declare class TransactionCache extends AbstractCache {
85
99
  */
86
100
  tabRequestParameters: {};
87
101
  hasChangesSignal: WritableSignal<boolean>;
88
- aiChanges: WritableSignal<{
89
- created: Set<ItemEntry['id']>;
90
- deleted: Set<ItemEntry['id']>;
91
- fields: Partial<{
92
- [itemEntryId: number]: Set<string>;
93
- }>;
94
- }>;
102
+ aiChanges: WritableSignal<TransactionAiChanges>;
95
103
  /**
96
104
  * @description
97
105
  * The transaction's parent
@@ -354,7 +362,29 @@ export declare class TransactionCache extends AbstractCache {
354
362
  * before processing them. This assures that, when `applyChangesFromChild` is queued multiple times, the changes
355
363
  * are only applied once. (However, this is largely a theoretical issue.)
356
364
  */
357
- applyChangesFromChild(childTransaction: Pick<TransactionCache, 'getDelta' | 'cachedQueryHandler'>, tabRequestParameters: any): Promise<ChangesDeltaResult>;
365
+ applyChangesFromChild(childTransaction: Pick<TransactionCache, 'getDelta' | 'cachedQueryHandler'>, tabRequestParameters: any, aiChanges?: TransactionAiChanges): Promise<ChangesDeltaResult>;
366
+ /**
367
+ * @description
368
+ * Merges the AI changes of a child transaction into this transaction, so that they are preserved when a child
369
+ * transaction is saved into its parent (analogous to {@link tabRequestParameters}).
370
+ *
371
+ * Entries are tracked by {@link ItemEntry.id}, which is unique within the RmCore and therefore stays valid when
372
+ * moving between transactions.
373
+ */
374
+ mergeAiChanges(aiChanges: TransactionAiChanges): void;
375
+ /**
376
+ * @description
377
+ * Returns the AI request parameters for a single item entry, to be sent along to the backend when the transaction is
378
+ * saved. Returns `undefined` when the entry was not touched by AI.
379
+ *
380
+ * Note that these are deliberately not stored on {@link tabRequestParameters}, as that map is merged into the parent
381
+ * transaction when saving. The AI changes are tracked on {@link aiChanges} instead, so that they keep counting as AI
382
+ * changes on the parent transaction.
383
+ */
384
+ getAiRequestParameters(itemEntry: ItemEntry): {
385
+ aiTouched: boolean;
386
+ aiTouchedFields: string[];
387
+ } | undefined;
358
388
  private doApplyChangesFromChild;
359
389
  /**
360
390
  * @description
@@ -1,4 +1,4 @@
1
1
  export declare class CriticalBusinessLogicRuleException extends Error {
2
- readonly context?: any;
3
- constructor(message: string, context?: any);
2
+ readonly context?: any | undefined;
3
+ constructor(message: string, context?: any | undefined);
4
4
  }
package/package.json CHANGED
@@ -1,11 +1,14 @@
1
1
  {
2
2
  "name": "@rentman/rm-core",
3
- "version": "66.6.4",
3
+ "version": "66.8.0",
4
4
  "description": "Rentman core functionalities",
5
5
  "main": "./dist/rm-core.js",
6
6
  "types": "./dist/types/src/index.d.ts",
7
+ "publishConfig": {
8
+ "access": "restricted"
9
+ },
7
10
  "engines": {
8
- "node": "^22.17.0",
11
+ "node": "^22.22.3",
9
12
  "pnpm": ">= 11.0.0"
10
13
  },
11
14
  "repository": {
@@ -13,7 +16,7 @@
13
16
  "url": "https://github.com/rentmanpublic/frontend-core"
14
17
  },
15
18
  "devDependencies": {
16
- "@angular/core": "^20",
19
+ "@angular/core": "^22",
17
20
  "@eslint/js": "^9.8.0",
18
21
  "@rentman/backend-types": "4.896.0-15-gb92d0b7abe",
19
22
  "@stylistic/eslint-plugin-ts": "^2.7.2",
@@ -27,15 +30,15 @@
27
30
  "terser-webpack-plugin": "^4.2.3",
28
31
  "ts-loader": "^9.3.1",
29
32
  "tslib": "^2.8.1",
30
- "typescript": "5.5.4",
31
- "typescript-eslint": "^8.4.0",
33
+ "typescript": "6.0.3",
34
+ "typescript-eslint": "^8.65.0",
32
35
  "vitest": "^3.2.3",
33
36
  "webpack": "^5.74.0",
34
37
  "webpack-cli": "^5.1.4",
35
38
  "webpack-merge": "^6.0.1"
36
39
  },
37
40
  "peerDependencies": {
38
- "@angular/core": "^20",
41
+ "@angular/core": "^22",
39
42
  "@rentman/backend-types": "4.851.0-61-g004802329a",
40
43
  "moment": "^2.30.1",
41
44
  "rxjs": "^7"