@memberjunction/metadata-sync 6.2.0-edge.4 → 6.2.0-edge.5

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.
Files changed (122) hide show
  1. package/README.md +115 -51
  2. package/dist/config.d.ts +5 -0
  3. package/dist/config.d.ts.map +1 -1
  4. package/dist/config.js.map +1 -1
  5. package/dist/index.d.ts +3 -0
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js +1 -0
  8. package/dist/index.js.map +1 -1
  9. package/dist/lib/RecordProcessor.d.ts +98 -0
  10. package/dist/lib/RecordProcessor.d.ts.map +1 -1
  11. package/dist/lib/RecordProcessor.js +424 -22
  12. package/dist/lib/RecordProcessor.js.map +1 -1
  13. package/dist/lib/RelatedEntityHandler.d.ts +4 -1
  14. package/dist/lib/RelatedEntityHandler.d.ts.map +1 -1
  15. package/dist/lib/RelatedEntityHandler.js +49 -11
  16. package/dist/lib/RelatedEntityHandler.js.map +1 -1
  17. package/dist/lib/created-record-key.d.ts +34 -0
  18. package/dist/lib/created-record-key.d.ts.map +1 -0
  19. package/dist/lib/created-record-key.js +46 -0
  20. package/dist/lib/created-record-key.js.map +1 -0
  21. package/dist/lib/deletion-auditor.d.ts.map +1 -1
  22. package/dist/lib/deletion-auditor.js +33 -2
  23. package/dist/lib/deletion-auditor.js.map +1 -1
  24. package/dist/lib/entity-field-names.d.ts +11 -0
  25. package/dist/lib/entity-field-names.d.ts.map +1 -0
  26. package/dist/lib/entity-field-names.js +15 -0
  27. package/dist/lib/entity-field-names.js.map +1 -0
  28. package/dist/lib/env-derived-fields.d.ts +23 -0
  29. package/dist/lib/env-derived-fields.d.ts.map +1 -0
  30. package/dist/lib/env-derived-fields.js +53 -0
  31. package/dist/lib/env-derived-fields.js.map +1 -0
  32. package/dist/lib/env-display.d.ts +54 -0
  33. package/dist/lib/env-display.d.ts.map +1 -0
  34. package/dist/lib/env-display.js +156 -0
  35. package/dist/lib/env-display.js.map +1 -0
  36. package/dist/lib/env-reference.d.ts +104 -0
  37. package/dist/lib/env-reference.d.ts.map +1 -0
  38. package/dist/lib/env-reference.js +241 -0
  39. package/dist/lib/env-reference.js.map +1 -0
  40. package/dist/lib/env-sql-redactor.d.ts +74 -0
  41. package/dist/lib/env-sql-redactor.d.ts.map +1 -0
  42. package/dist/lib/env-sql-redactor.js +297 -0
  43. package/dist/lib/env-sql-redactor.js.map +1 -0
  44. package/dist/lib/existing-record-index.d.ts +70 -0
  45. package/dist/lib/existing-record-index.d.ts.map +1 -0
  46. package/dist/lib/existing-record-index.js +158 -0
  47. package/dist/lib/existing-record-index.js.map +1 -0
  48. package/dist/lib/ignore-directories.d.ts +10 -0
  49. package/dist/lib/ignore-directories.d.ts.map +1 -0
  50. package/dist/lib/ignore-directories.js +12 -0
  51. package/dist/lib/ignore-directories.js.map +1 -0
  52. package/dist/lib/json-record-lines.d.ts +17 -0
  53. package/dist/lib/json-record-lines.d.ts.map +1 -0
  54. package/dist/lib/json-record-lines.js +170 -0
  55. package/dist/lib/json-record-lines.js.map +1 -0
  56. package/dist/lib/json-subproperty-externalization.d.ts.map +1 -1
  57. package/dist/lib/json-subproperty-externalization.js +3 -1
  58. package/dist/lib/json-subproperty-externalization.js.map +1 -1
  59. package/dist/lib/lookup-reference.d.ts +38 -0
  60. package/dist/lib/lookup-reference.d.ts.map +1 -0
  61. package/dist/lib/lookup-reference.js +62 -0
  62. package/dist/lib/lookup-reference.js.map +1 -0
  63. package/dist/lib/provider-utils.d.ts.map +1 -1
  64. package/dist/lib/provider-utils.js +2 -4
  65. package/dist/lib/provider-utils.js.map +1 -1
  66. package/dist/lib/pull-option-overrides.d.ts +24 -0
  67. package/dist/lib/pull-option-overrides.d.ts.map +1 -0
  68. package/dist/lib/pull-option-overrides.js +39 -0
  69. package/dist/lib/pull-option-overrides.js.map +1 -0
  70. package/dist/lib/push-directories.d.ts +42 -0
  71. package/dist/lib/push-directories.d.ts.map +1 -0
  72. package/dist/lib/push-directories.js +71 -0
  73. package/dist/lib/push-directories.js.map +1 -0
  74. package/dist/lib/push-when.d.ts +38 -0
  75. package/dist/lib/push-when.d.ts.map +1 -0
  76. package/dist/lib/push-when.js +84 -0
  77. package/dist/lib/push-when.js.map +1 -0
  78. package/dist/lib/record-dependency-analyzer.d.ts +2 -0
  79. package/dist/lib/record-dependency-analyzer.d.ts.map +1 -1
  80. package/dist/lib/record-dependency-analyzer.js.map +1 -1
  81. package/dist/lib/record-file-glob.d.ts +11 -0
  82. package/dist/lib/record-file-glob.d.ts.map +1 -0
  83. package/dist/lib/record-file-glob.js +10 -0
  84. package/dist/lib/record-file-glob.js.map +1 -0
  85. package/dist/lib/reference-parser.d.ts +3 -2
  86. package/dist/lib/reference-parser.d.ts.map +1 -1
  87. package/dist/lib/reference-parser.js +27 -27
  88. package/dist/lib/reference-parser.js.map +1 -1
  89. package/dist/lib/sync-engine.d.ts +46 -4
  90. package/dist/lib/sync-engine.d.ts.map +1 -1
  91. package/dist/lib/sync-engine.js +215 -59
  92. package/dist/lib/sync-engine.js.map +1 -1
  93. package/dist/lib/sync-state-manager.d.ts +7 -3
  94. package/dist/lib/sync-state-manager.d.ts.map +1 -1
  95. package/dist/lib/sync-state-manager.js +19 -4
  96. package/dist/lib/sync-state-manager.js.map +1 -1
  97. package/dist/lib/watch-file-filter.d.ts +31 -0
  98. package/dist/lib/watch-file-filter.d.ts.map +1 -0
  99. package/dist/lib/watch-file-filter.js +64 -0
  100. package/dist/lib/watch-file-filter.js.map +1 -0
  101. package/dist/plugins/index.d.ts.map +1 -1
  102. package/dist/plugins/index.js +44 -14
  103. package/dist/plugins/index.js.map +1 -1
  104. package/dist/services/PullService.d.ts +41 -1
  105. package/dist/services/PullService.d.ts.map +1 -1
  106. package/dist/services/PullService.js +261 -101
  107. package/dist/services/PullService.js.map +1 -1
  108. package/dist/services/PushService.d.ts +59 -0
  109. package/dist/services/PushService.d.ts.map +1 -1
  110. package/dist/services/PushService.js +435 -173
  111. package/dist/services/PushService.js.map +1 -1
  112. package/dist/services/ValidationService.d.ts +43 -8
  113. package/dist/services/ValidationService.d.ts.map +1 -1
  114. package/dist/services/ValidationService.js +338 -127
  115. package/dist/services/ValidationService.js.map +1 -1
  116. package/dist/services/WatchService.d.ts +26 -0
  117. package/dist/services/WatchService.d.ts.map +1 -1
  118. package/dist/services/WatchService.js +210 -75
  119. package/dist/services/WatchService.js.map +1 -1
  120. package/dist/types/validation.d.ts +6 -0
  121. package/dist/types/validation.d.ts.map +1 -1
  122. package/package.json +17 -16
package/README.md CHANGED
@@ -477,7 +477,6 @@ flowchart TD
477
477
  PARENT["@parent:\nParent record field"]
478
478
  ROOT["@root:\nRoot record field"]
479
479
  ENV["@env:\nEnvironment variable"]
480
- TEMPLATE["@template:\nJSON template merge"]
481
480
  INCLUDE["@include\nJSON composition"]
482
481
  end
483
482
 
@@ -509,7 +508,6 @@ flowchart TD
509
508
  PARENT --> PR
510
509
  ROOT --> RR
511
510
  ENV --> EV
512
- TEMPLATE --> EF
513
511
  INCLUDE --> EF
514
512
 
515
513
  style References fill:#64748b,stroke:#475569,color:#fff
@@ -664,9 +662,58 @@ Reference fields synchronously in-memory from the owner record for children nest
664
662
  - Cannot be used at root level; valid only within child collections, embeds, or extensions where an enclosing owner entity exists.
665
663
 
666
664
  ### @env: References
667
- Support environment-specific values:
668
- - `@env:VARIABLE_NAME`
669
- - Useful for different environments (dev/staging/prod)
665
+ Read a value from an environment variable at push time:
666
+ - `@env:VARIABLE_NAME` — push fails when the variable is not set.
667
+ - `@env:VARIABLE_NAME?optional` — when the variable is not set, push leaves the field out: an update keeps the database value, a create gets the column default, and push gives a warning. Not allowed in `primaryKey`.
668
+ - In `defaults` (`.mj-sync.json` or `.mj-folder.json`), an unset `?optional` variable skips that one default, with a warning. It does not fall back to a default from a higher folder or from the entity `.mj-sync.json`.
669
+ - On push, a missing `?optional` variable inside a JSON object field leaves out the whole field.
670
+
671
+ Pull keeps the reference. When a file holds `@env:VAR`, `mj sync pull` writes the reference back, not the database value, so the resolved value is not written to the file. If `VAR` is set and its value differs from the database, pull warns (it never prints either value). This applies to:
672
+ - a field (`"Token": "@env:VAR"`), also with `--multi-file`;
673
+ - a leaf inside a JSON object or array field, matched by path (array items by position). When the field is `@file:x.json`, pull updates `x.json` and keeps the `@file:` reference (not when `x.json` uses `@include` or a nested `@file:`; pull then warns and leaves `x.json` as it is);
674
+ - `@lookup:` criteria or create fields that use `@env:` (`@lookup:Entity.Field=@env:VAR`). Pull keeps the lookup. When the record that the database value points to is missing or does not match the criteria, pull warns (it does not check when a criteria variable is not set);
675
+ - the fields of `collections`, `embeds` and `extension` items;
676
+ - a primary key (`"primaryKey": { "ID": "@env:VAR" }`). Pull finds the existing record by the variable's value. When a key variable of a top-level record is not set, pull stops before it writes any file. When the key variable of a `relatedEntities` child, a `collections` child or an embed is not set, pull also stops, with an error that names the file and the variable.
677
+
678
+ When the database value of a JSON field that holds `@env:` is not JSON, pull keeps the file value and warns.
679
+
680
+ Pull leaves out a read-only field (one that push ignores) whose database value holds the value of an `@env:` reference in the record file, such as a key path that the database builds from an `@env:` key. A UUID value matches without case; another value matches when it has 6 or more characters. When the existing file already holds such a field, pull removes it from the file, with `merge` too. With `-v`, pull names the field and the variable, never the value.
681
+
682
+ With `--multi-file`, pull also finds an existing record in the folder's other record files, so it keeps the `@env:` references of that record in the multi-file. As in a single-file pull, a record file that cannot be read, or an unset key variable in any of them, stops pull before it writes.
683
+
684
+ `?optional` does not work inside `@lookup:`, because `?` starts the lookup flags. Validation and push report it as an error.
685
+
686
+ Push does not print values that come from `@env:`. The `--verbose` diff and the `--change-detail` report show `<hidden>` for the old value and `<from @env:VAR>` for the new one. Save errors replace each value of 6 or more characters with `<from @env:VAR>`; a shorter value can print. On create, push keeps an `@env:` `primaryKey` reference in the file when the database saved the variable's value as the key. Push also resolves an `@env:` `primaryKey` of a `collections` child (to find the existing child, or to set the key of a new one) and of a record to delete; an unset key variable stops push with an error that names the variable. When a variable that a record's `fields` or `primaryKey` uses is not set (and the reference is not `?optional`), push stops with an error that names the record file and the line where the record starts, the entity, the field and the variable, for example `/abs/path/.tags.json:12: MJ: Tags primaryKey.ID uses @env:MJ_KEY_ID, which is not set`. With SQL logging on, push leaves the `SET` line of an env-sourced field out of the log and writes `-- <Entity>.<Field>: not recorded, value comes from @env:VAR` in its place. A replayed update then keeps the target's value. A replayed create gets the column default, or fails if the column is NOT NULL with no default. This works for SQL Server logs only; other providers keep the value in the log, and push gives the names-only warning. A primary key from `@env:` stays in the log; push warns with names only. When a value of 6 or more characters is still in the log, push warns with the variable name.
687
+
688
+ `mj sync watch` resolves `@env:` as push does, for the parts of a record file that watch handles. See [Watch](#watch-mj-sync-watch).
689
+
690
+ #### Known limits
691
+ - When a save fails, MJCore's error log (for a composition graph save) and the SQL Server provider's execute error (`Query: …` with its parameters, logged by the provider) can print the SQL text with values. MetadataSync's own output masks these values (values of 6 or more characters), but the MJCore and provider logs do not.
692
+ - `mj sync watch` writes record-change data to its SQL log. On an update, this data can hold the OLD database value of an env-sourced field. The SQL-log warnings cannot detect old values. Check a watch log before you share it.
693
+ - An `@env:` reference that is only inside a file brought in by `@include`, or by a nested `@file:` inside a side file, is not kept. Pull writes the database value there.
694
+ - A dotted `externalizeFields` side file (`Field.sub`) that you write by hand with `@env:` references inside is not kept. Pull writes the database value there. Pull itself never moves a sub-object that holds `@env:` into a side file.
695
+ - A `@file:` JSON side file that pull rewrites, and a file that `externalizeFields` writes, are not part of the pull backup. A failed pull (for example, an unset key variable on a child) does not roll them back. A side file holds `@env:` references, never their values. An externalized file holds database values. It does not hold the value of an `@env:` reference that is in the record file, but it can hold one when the reference is only in a nested `@file:` or `@include` file (see above).
696
+ - Pull does not clean up a side file that an earlier version of pull wrote with a resolved value. Check old side files and replace those values with `@env:` references.
697
+ - When pull rewrites a `@file:` JSON side file to keep its `@env:` leaves, the other reference leaves in that file (such as `@lookup:` or `@file:`) get the database value.
698
+ - `mj sync status` does not resolve an `@env:` `primaryKey`. It counts such a record as deleted. It prints no value.
699
+ - For a delete record with an `@env:` `primaryKey`, push does not find the records that refer to it only in the database, so it does not list them. If such a record exists, the delete fails with a foreign-key error, or, for an entity with cascade deletes, the database removes or changes those records. MetadataSync masks values of 6 or more characters in the error text.
700
+ - A `collections` child that has no `primaryKey` in the file is not matched on pull, so its `@env:` fields get the database value. Give each child its key. Push writes keys back only for top-level records.
701
+ - `?optional` on an `@env:` value inside a lookup's create fields (`?create&Code=@env:C?optional`) is not an error. When `C` is not set, push leaves the whole foreign-key field out of the save, with a warning.
702
+
703
+ ### Push only in some environments (`pushWhen`)
704
+ An entity folder's `.mj-sync.json` can gate the whole folder on an environment variable:
705
+
706
+ ```json
707
+ { "entity": "MJ: AI Agents", "pushWhen": "@env:DEMO_AGENTS_ENABLED" }
708
+ ```
709
+
710
+ - The folder is pushed when the variable is `true` or `1` (any case, surrounding spaces ignored).
711
+ - Otherwise push skips the folder, logs `Skipped folder <name>: <VAR> is not set` (or `is not true`), and continues. `--format=json` lists them in `data.skippedDirectories`.
712
+ - Records and deletes in a skipped folder are not applied. Pull ignores `pushWhen`.
713
+ - The value must be a plain `@env:VAR`. `pushWhen` in the root `.mj-sync.json` is a validation error.
714
+ - `pushWhen` applies to the folders push runs over: the entity folders directly under the root, or the `--dir` folder. A `pushWhen` in a nested entity folder (for example `actions/runtime`) has no effect unless `--dir` names that folder.
715
+ - `mj sync push` does not validate a folder it will skip. `mj sync validate` validates every folder, and warns about a `pushWhen` in a nested folder.
716
+ - `mj sync watch` reads `pushWhen` too. See [Watch](#watch-mj-sync-watch).
670
717
 
671
718
  ### First-Class Composition Axes (`collections`, `embeds`, `extension`)
672
719
  MetadataSync natively supports three composition axes directly within `RecordData`, persisted in a single `Save()` call on the root entity graph:
@@ -839,56 +886,24 @@ Use dot notation (`@include.anything`) to include multiple files at different po
839
886
  #### Processing Order
840
887
  1. `@include` directives are processed first (recursively)
841
888
  2. `@file` references are recursively resolved (including nested ones in JSON)
842
- 3. Then `@template` references
843
- 4. Finally, other `@` references (`@lookup`, etc.)
889
+ 3. Finally, other `@` references (`@lookup`, etc.)
844
890
 
845
891
  This ensures that included content can contain other special references that will be properly resolved.
846
892
 
847
893
  ### @template: References
848
- Enable JSON template composition for reusable configurations:
849
-
850
- **String Template Reference:**
851
- ```json
852
- {
853
- "relatedEntities": {
854
- "MJ: AI Prompt Models": "@template:templates/standard-ai-models.json"
855
- }
856
- }
857
- ```
858
-
859
- **Object Template Merging:**
860
- ```json
861
- {
862
- "fields": {
863
- "Name": "My Prompt",
864
- "@template": "templates/standard-prompt-settings.json",
865
- "Temperature": 0.9
866
- }
867
- }
868
- ```
869
-
870
- **Multiple Template Merging** (later templates override earlier ones):
871
- ```json
872
- {
873
- "fields": {
874
- "@template": [
875
- "templates/base-settings.json",
876
- "templates/customer-service-defaults.json"
877
- ],
878
- "Name": "Customer Bot"
879
- }
880
- }
881
- ```
894
+ `mj sync push` does not support `@template:`. Push saves the literal text (for example `@template:templates/settings.json`), not the content of the file. `mj sync validate` reports a field value that starts with `@template:` as an error. Use `@file:` instead.
882
895
 
883
896
  ## Default Value Inheritance
884
897
 
885
898
  The tool implements a cascading inheritance system for field defaults, similar to CSS or OOP inheritance:
886
899
 
887
- 1. **Entity-level defaults** (in `.mj-sync.json`) -- Base defaults for all records
888
- 2. **Folder-level defaults** (in `.mj-folder.json`) -- Override/extend entity defaults
889
- 3. **Nested folder defaults** -- Override/extend parent folder defaults
900
+ 1. **Entity-level defaults** (in the entity folder's `.mj-sync.json`) -- Base defaults for all records
901
+ 2. **Folder-level defaults** (in `.mj-folder.json`) -- Every `.mj-folder.json` from the sync root down to the folder of the record file. Any of them, the root's too, wins over the entity's `.mj-sync.json` defaults
902
+ 3. **Nested folder defaults** -- A deeper `.mj-folder.json` wins over a higher one
890
903
  4. **Record-level values** -- Override all inherited defaults
891
904
 
905
+ Push and `mj sync watch` apply these defaults. See [Folder Defaults](#folder-defaults-metadataai-promptscustomer-servicemj-folderjson) for the details.
906
+
892
907
  ```mermaid
893
908
  flowchart TD
894
909
  ELD[".mj-sync.json\nTemperature: 0.7\nMaxTokens: 1500"] --> FD1[".mj-folder.json\nTemperature: 0.8\n(overrides entity)"]
@@ -1077,6 +1092,8 @@ mj sync pull --incremental
1077
1092
  mj sync pull --entity "MJ: AI Prompts" --since "2026-04-07T10:00:00Z"
1078
1093
  ```
1079
1094
 
1095
+ `--dir` can name the metadata root or one entity folder. For an entity folder, push walks up through parent folders that have a `.mj-sync.json` and reads its root settings from the first one that has no `entity`; if it finds none, it uses the folder's own file. `--include` and `--exclude` are not applied to a single entity folder. With `--incremental`, an entity-folder push shares the root's state file.
1096
+
1080
1097
  ### Incremental Push (`--incremental`)
1081
1098
 
1082
1099
  Skips unchanged files and records using stored checksums, significantly speeding up repeated pushes when only a few files have changed.
@@ -1087,13 +1104,14 @@ Skips unchanged files and records using stored checksums, significantly speeding
1087
1104
  - Unchanged files and records are skipped without any database calls
1088
1105
  - State is stored in `~/.mj/sync-state/` (machine-local, not committed to version control)
1089
1106
  - Combine freely with other flags: `mj sync push --dir ./metadata --incremental --verbose`
1107
+ - `--incremental` compares file content only. After you set a variable that `?optional` left out, push once without `--incremental`.
1090
1108
 
1091
1109
  ### Incremental Pull (`--incremental`)
1092
1110
 
1093
1111
  Only pulls records updated since the last successful pull, avoiding a full re-pull of every record.
1094
1112
 
1095
1113
  - Filters by the `__mj_UpdatedAt` column (maintained by database triggers on all tracked entities)
1096
- - Detects soft-deleted records (`__mj_DeletedAt`) and removes their local files
1114
+ - Detects soft-deleted records (`__mj_DeletedAt`) and removes their local files (with `--multi-file`, their entries in the file)
1097
1115
  - State is stored in `~/.mj/sync-state/`
1098
1116
 
1099
1117
  ### Pull Since Timestamp (`--since`)
@@ -1104,6 +1122,21 @@ Explicit alternative to `--incremental` -- pulls only records updated after a gi
1104
1122
  mj sync pull --entity "MJ: AI Prompts" --since "2026-04-07T10:00:00Z"
1105
1123
  ```
1106
1124
 
1125
+ ### Watch (`mj sync watch`)
1126
+
1127
+ `mj sync watch` pushes a record file each time it changes.
1128
+
1129
+ - **Folders.** It chooses folders as push does: `directoryOrder`, the root `ignoreDirectories`, and `pushWhen`. It reads `pushWhen` once when it starts and does not watch a skipped folder. When every folder is skipped, it stops with `No entity directories to watch: pushWhen skips every folder`. It has no `--include` or `--exclude` flag.
1130
+ - **Files.** It watches the record files push reads: the folder's `filePattern` (default `*.json`, dot files included), without `node_modules` and `.mj-*.json` files. It also watches `.md`, `.txt`, `.html`, `.liquid` and `.sql` files, which a record can bring in with `@file:`.
1131
+ - **Records.** It handles the `fields` and `primaryKey` of a file that holds one record. It does not handle `relatedEntities`, `collections`, `embeds` or `extension`. A file that holds an array of records fails. A relative `@file:` in a record field resolves from the folder of the record file (push resolves it from the entity folder).
1132
+ - **`@env:`.** It applies folder defaults, `@env:` references, `?optional` and an `@env:` primary key as push does. As in push, a name in `fields` or in defaults that matches an entity field without regard to case is set with the entity's spelling. Another name in `fields` is set as written, so a virtual property such as `TemplateText` works. Another default name applies only when the entity has a property with that exact name. With `-v`, it shows `<hidden>` / `<from @env:VAR>` in place of env values. Its SQL log leaves env-sourced fields out of the SQL statements, with the same names-only warnings as push. The record-change data in its log is not masked and can hold old database values (see [Known limits](#known-limits)).
1133
+ - **Differences from push.**
1134
+ - Watch creates a record whose key is not found in the database. It does not need `push.autoCreateMissingRecords`.
1135
+ - On create, watch sets only the `@env:` key fields from the file. A literal key gets a new value from the entity (a new UUID), and watch writes that value over the file key. Push uses the file key.
1136
+ - Watch does not run validation before a save.
1137
+ - Watch does not use `push.alwaysPush`.
1138
+ - When one file fails, watch prints the error and goes on watching the other files.
1139
+
1107
1140
  ### Performance Improvements
1108
1141
 
1109
1142
  The following improvements apply automatically with no flags required:
@@ -1202,6 +1235,11 @@ The tool uses the existing `mj.config.cjs` for database configuration and a hier
1202
1235
  }
1203
1236
  ```
1204
1237
 
1238
+ Push and `mj sync watch` apply `.mj-folder.json` defaults from the sync root down to the folder of the record file. A deeper folder wins over a higher one, and a field in the record wins over every default. A `.mj-folder.json` default (the root's too) wins over a default in the entity's `.mj-sync.json`. `.mj-folder.json` holds only `defaults`; the folder's entity comes from `.mj-sync.json`. Push applies them to records nested in a file (`relatedEntities`) too; watch does not handle nested records. A default applies when the nested record's entity has a field with that name. Default and record field names match the entity's fields without regard to case. A default whose name is not an entity field applies only when the entity has a property with that exact name, such as the virtual property `TemplateText`. Validation reports another spelling of such a name as an unknown field.
1239
+
1240
+ - A relative `@file:` in a default resolves from the folder of the record file, not from the folder of the `.mj-folder.json`.
1241
+ - An unset `@env:VAR?optional` variable in a default skips that one default, with a warning. It does not fall back to a default from a higher folder or from the entity `.mj-sync.json`.
1242
+
1205
1243
  ### Push Configuration Options
1206
1244
 
1207
1245
  #### autoCreateMissingRecords
@@ -1415,10 +1453,23 @@ A push is atomic by default, so every save runs inside the push transaction. Dur
1415
1453
 
1416
1454
  ### Merge Strategies
1417
1455
 
1418
- - **`merge`** (default): Combines fields from database and local file, with database values taking precedence for existing fields
1419
- - **`overwrite`**: Completely replaces local record with database version (except preserved fields)
1456
+ - **`merge`** (default): Combines fields from database and local file, with database values taking precedence for existing fields (except `@env:` references)
1457
+ - **`overwrite`**: Completely replaces local record with database version (except preserved fields and `@env:` references)
1420
1458
  - **`skip`**: Leaves existing records unchanged, only adds new records
1421
1459
 
1460
+ `mj sync pull` flags override the folder's `pull` settings for one run:
1461
+ - `--merge-strategy=merge|overwrite|skip` replaces `pull.mergeStrategy`.
1462
+ - `--preserve-fields` and `--exclude-fields` add to `pull.preserveFields` and `pull.excludeFields`. Repeat the flag or separate names with commas.
1463
+ - `--update-existing` / `--no-update-existing` sets `pull.updateExistingRecords`, and `--create-new` / `--no-create-new` sets `pull.createNewFileIfNotFound`. Without the flag, the folder setting applies (default `true`).
1464
+
1465
+ `--preserve-fields` and `--exclude-fields` apply to the folder's own records, not to related (child) records.
1466
+
1467
+ Pull stops before it writes any file when a record file in the folder cannot be read (for example, it is not valid JSON). Otherwise pull would not find the records in that file and would write them again as new files.
1468
+
1469
+ `--multi-file` writes the query result to one file. With `--since`/`--incremental` it updates matched entries in place, adds new ones and keeps the rest. It uses `--exclude-fields`, and `--merge-strategy` only to decide if an externalized field keeps its existing `@file:` path. It does not use `--preserve-fields`, `--update-existing` or `--create-new`. An empty or whitespace-only file counts as no records. Pull stops, and does not write, when the file is not valid JSON. With `--since`/`--incremental`, pull removes the entries of records that were soft-deleted since the timestamp from the file; it does not delete the file.
1470
+
1471
+ With `mergeStrategy: "skip"`, existing records are left as they are and count as `skipped`; new records are still written.
1472
+
1422
1473
  ### Understanding excludeFields vs preserveFields
1423
1474
 
1424
1475
  | | excludeFields | preserveFields |
@@ -1641,7 +1692,7 @@ flowchart TD
1641
1692
 
1642
1693
  LOOP --> ENT["Validate Entity Names"]
1643
1694
  LOOP --> FLD["Validate Field Names & Types"]
1644
- LOOP --> REF["Validate References\n(@file, @lookup, @template)"]
1695
+ LOOP --> REF["Validate References\n(@file, @lookup, @env)"]
1645
1696
  LOOP --> DEP["Analyze Dependencies"]
1646
1697
 
1647
1698
  ENT --> COLLECT["Collect Errors & Warnings"]
@@ -1685,6 +1736,11 @@ mj sync pull --entity="AI Prompts" --no-validate
1685
1736
 
1686
1737
  ### What Gets Validated
1687
1738
 
1739
+ **Files Validated:**
1740
+ - The record files of each entity folder, found with the folder's `filePattern` (default `*.json`) the way push finds them. Files in sub-folders are included when the pattern matches them (for example `**/*.json`). `.mj-*.json` files and files under `node_modules` are left out. A file that is not valid JSON is an error.
1741
+ - Folders that push leaves out (dot folders and the root `ignoreDirectories`) are not validated.
1742
+ - Because validation reads the record files, `mj sync push --ci` can stop on errors that earlier versions did not find: unknown fields and unknown top-level keys, a `__mj_` field or the primary key in `fields`, `@template:` values, `?optional` in `@lookup:`, missing `@file:` targets and conflicting record entries. Fix the files, or push with `--no-validate`.
1743
+
1688
1744
  **Entity Validation:**
1689
1745
  - Entity names exist in database metadata
1690
1746
  - Entity is accessible to current user
@@ -1693,15 +1749,21 @@ mj sync pull --entity="AI Prompts" --no-validate
1693
1749
  **Field Validation:**
1694
1750
  - Field names exist on the entity
1695
1751
  - Virtual properties (getter/setter methods) are automatically detected
1696
- - Fields are settable (not system fields)
1752
+ - Fields are settable: a `__mj_` field or the primary key in `fields` is an error. Another read-only field (such as a joined display field that pull writes) is a warning, because push ignores it. For a virtual field, the warning says to set `pull.ignoreVirtualFields: true`; for another read-only field, it says to add the field to `pull.excludeFields`. Field names match the entity's fields without regard to case. A name that is not an entity field must match an entity property exactly (for example `TemplateText`); validation reports another spelling as an unknown field.
1697
1753
  - Field values match expected data types
1698
1754
  - Required fields are checked intelligently (skips fields with defaults, computed fields, ReadOnly fields)
1699
1755
  - Foreign key relationships are valid
1700
1756
 
1757
+ **Record Conflicts:**
1758
+ - Several entries (in one file or in several files) can describe the same record: the same entity and `primaryKey`. This is allowed when they do not disagree.
1759
+ - Two such entries that set the same field to different raw values are an error. The message names the entity, the `primaryKey` and the field, and gives the full path and start line (`path:line`) of each entry.
1760
+ - Entries whose `primaryKey` holds an `@parent:`, `@owner:` or `@root:` reference (also inside a `@lookup:`), or an object value, are not compared, because the same text can name different records.
1761
+
1701
1762
  **Reference Validation:**
1702
- - `@file:` references point to existing files
1763
+ - `@file:` references point to existing files. In record fields, the path resolves from the entity folder, as push does
1764
+ - `?optional` inside `@lookup:` is an error
1703
1765
  - `@lookup:` references find matching records
1704
- - `@template:` references load valid JSON
1766
+ - `@template:` values are errors, because push does not support them
1705
1767
  - `@parent:` and `@root:` have proper context
1706
1768
  - Circular references are detected
1707
1769
 
@@ -1767,6 +1829,8 @@ Errors
1767
1829
  | `Lookup not found` | No matching record | Verify lookup value or use ?create |
1768
1830
  | `Circular dependency` | A -> B -> A references | Restructure to avoid cycles |
1769
1831
  | `Required field missing` | Missing required field | Add field with appropriate value |
1832
+ | `Conflicting values for <entity> record …` | Two entries for one record set a field to different values | Set the same value in both entries, or set the field in one entry only |
1833
+ | `@template: is not supported by mj sync push` | A field value starts with `@template:` | Use `@file:` instead |
1770
1834
 
1771
1835
  ## Programmatic Usage
1772
1836
 
package/dist/config.d.ts CHANGED
@@ -236,6 +236,11 @@ export interface EntityConfig {
236
236
  * Examples: ["output", "examples", "temp"]
237
237
  */
238
238
  ignoreDirectories?: string[];
239
+ /**
240
+ * Pushes this folder only when the named environment variable is `true` or `1`,
241
+ * for example "@env:DEMO_AGENTS_ENABLED". Otherwise push skips the folder and logs it.
242
+ */
243
+ pushWhen?: string;
239
244
  /**
240
245
  * Declarative collection configuration for composition axes.
241
246
  * Key is collection property name (e.g. "Lines", "Payments").
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAMH;;;;;GAKG;AACH,MAAM,WAAW,QAAQ;IACvB,mGAAmG;IACnG,UAAU,CAAC,EAAE,WAAW,GAAG,YAAY,CAAC;IACxC,6CAA6C;IAC7C,MAAM,EAAE,MAAM,CAAC;IACf,kFAAkF;IAClF,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kCAAkC;IAClC,UAAU,EAAE,MAAM,CAAC;IACnB,uCAAuC;IACvC,UAAU,EAAE,MAAM,CAAC;IACnB,uCAAuC;IACvC,UAAU,EAAE,MAAM,CAAC;IACnB,oDAAoD;IACpD,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,2EAA2E;IAC3E,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qDAAqD;IACrD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;;;;OAMG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;;;;;OAMG;IACH,OAAO,CAAC,EAAE;QACR,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,CAAC;IACF,oEAAoE;IACpE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,oDAAoD;IACpD,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED;;;;;GAKG;AACH,MAAM,WAAW,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AAC;YACrD,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED,gDAAgD;AAChD,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,GAAW;IAChD,OAAO,gBAAgB,CAAC,GAAG,CAAC,CAAC;AAC/B,CAAC"}
package/dist/index.d.ts CHANGED
@@ -14,7 +14,10 @@ export { FileWriteBatch } from './lib/file-write-batch.js';
14
14
  export { JsonPreprocessor } from './lib/json-preprocessor.js';
15
15
  export type { IncludeDirective } from './lib/json-preprocessor.js';
16
16
  export { SyncStateManager } from './lib/sync-state-manager.js';
17
+ export { FindSyncRootDir } from './lib/push-directories.js';
17
18
  export type { SyncState } from './lib/sync-state-manager.js';
19
+ export type { SkippedDirectory } from './lib/push-when.js';
20
+ export type { PullFieldOverrides } from './lib/pull-option-overrides.js';
18
21
  export { ParseMetadataReference, parseMetadataReference } from './lib/reference-parser.js';
19
22
  /** @deprecated Import from `@memberjunction/record-graph`. */
20
23
  export { ResolveCollectionRelationship, resolveCollectionRelationship } from './lib/collection-resolver.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,8DAA8D,CAAC;AAGtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,YAAY,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,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,MAAM,0BAA0B,CAAC;AACzD,YAAY,EAAE,aAAa,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAE7F,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,YAAY,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAEzG,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEzF,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAGjE,OAAO,EACL,YAAY,EAAE,YAAY,EAC1B,cAAc,EAAE,cAAc,EAC9B,gBAAgB,EAAE,gBAAgB,EAClC,gBAAgB,EAAE,gBAAgB,EAClC,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACzB,MAAM,UAAU,CAAC;AAGlB,OAAO,EACL,kBAAkB,EAAE,kBAAkB,EACtC,eAAe,EAAE,eAAe,EAChC,aAAa,EAAE,aAAa,EAC5B,qBAAqB,EAAE,qBAAqB,EAC5C,eAAe,EAAE,eAAe,EACjC,MAAM,sBAAsB,CAAC;AAG9B,YAAY,EACV,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EAChB,oBAAoB,EACpB,iBAAiB,EACjB,aAAa,EACb,eAAe,EAChB,MAAM,oBAAoB,CAAC"}
package/dist/index.js CHANGED
@@ -13,6 +13,7 @@ export { JsonWriteHelper } from './lib/json-write-helper.js';
13
13
  export { FileWriteBatch } from './lib/file-write-batch.js';
14
14
  export { JsonPreprocessor } from './lib/json-preprocessor.js';
15
15
  export { SyncStateManager } from './lib/sync-state-manager.js';
16
+ export { FindSyncRootDir } from './lib/push-directories.js';
16
17
  export { ParseMetadataReference, parseMetadataReference } from './lib/reference-parser.js';
17
18
  /** @deprecated Import from `@memberjunction/record-graph`. */
18
19
  export { ResolveCollectionRelationship, resolveCollectionRelationship } from './lib/collection-resolver.js';
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,2FAA2F;AAC3F,OAAO,8DAA8D,CAAC;AAEtE,uBAAuB;AACvB,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAEhE,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAE9D,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AACzG,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE5D,OAAO,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AACxF,8DAA8D;AAC9D,OAAO,EAAE,6BAA6B,EAAE,6BAA6B,EAAE,MAAM,2BAA2B,CAAC;AAIzG,yBAAyB;AACzB,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAE5E,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAE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a,EAAE,aAAa,EAC5B,qBAAqB,EAAE,qBAAqB,EAC5C,eAAe,EAAE,eAAe,EACjC,MAAM,sBAAsB,CAAC"}
@@ -11,6 +11,10 @@ export declare class RecordProcessor {
11
11
  private propertyExtractor;
12
12
  private fieldExternalizer;
13
13
  private relatedEntityHandler;
14
+ /** Receives pull warnings. When not set, warnings go to the console. */
15
+ WarningSink: ((message: string) => void) | null;
16
+ /** For each record this processor returned, the read-only fields it left out because they hold an env value. */
17
+ private readonly envOmittedFields;
14
18
  constructor(syncEngine: SyncEngine, contextUser: UserInfo);
15
19
  /**
16
20
  * Batch pre-fetch related entities for a set of parent records.
@@ -23,6 +27,13 @@ export declare class RecordProcessor {
23
27
  * Processes a record into the standardized RecordData format
24
28
  */
25
29
  ProcessRecord(record: BaseEntity, primaryKey: Record<string, any>, targetDir: string, entityConfig: EntityConfig, verbose?: boolean, isNewRecord?: boolean, existingRecordData?: RecordData, currentDepth?: number, ancestryPath?: Set<string>, fieldOverrides?: Record<string, any>, batchedRelatedData?: Map<string, Map<string, BaseEntity[]>>): Promise<RecordData>;
30
+ /**
31
+ * The read-only fields left out of a record this processor returned, because their database
32
+ * value holds the value of an `@env:` reference in the record file. A merge removes them too.
33
+ */
34
+ EnvOmittedFieldsOf(recordData: RecordData): ReadonlySet<string>;
35
+ /** The key to write: the file's `@env:` key values that still resolve to the database key, else the database key. */
36
+ private keptPrimaryKey;
26
37
  /** @deprecated Use {@link ProcessRecord}. */
27
38
  processRecord(record: BaseEntity, primaryKey: Record<string, any>, targetDir: string, entityConfig: EntityConfig, verbose?: boolean, isNewRecord?: boolean, existingRecordData?: RecordData, currentDepth?: number, ancestryPath?: Set<string>, fieldOverrides?: Record<string, any>, batchedRelatedData?: Map<string, Map<string, BaseEntity[]>>): Promise<RecordData>;
28
39
  /**
@@ -33,10 +44,90 @@ export declare class RecordProcessor {
33
44
  * Processes individual fields from the entity
34
45
  */
35
46
  private processFields;
47
+ /**
48
+ * True when the field is read-only for push (not the key) and its database value holds the value of
49
+ * an `@env:` reference in the record file. Push ignores such a field, so pull leaves it out. With
50
+ * verbose, a note names the field and the variable, never the value.
51
+ */
52
+ private holdsEnvValueReadOnly;
53
+ /**
54
+ * The field value pull writes when the existing file value holds `@env:` references, so pull
55
+ * never writes a resolved environment value into a file.
56
+ * @returns The value to write, or null when the existing value holds no `@env:` reference
57
+ */
58
+ private keepEnvReferences;
59
+ /**
60
+ * Keeps an existing `@lookup:` whose criteria or create fields use `@env:`. Loads the record the
61
+ * database foreign key points at and compares each criteria field the way push looks it up: the
62
+ * field name and the value without case, the value not trimmed, and `null` matching a null value.
63
+ * Keeps the lookup in every case: silently when it matches, with a verbose note when it cannot be
64
+ * checked, with a warning when the record is missing, cannot be read or does not match.
65
+ * @returns The lookup to keep, or null when the existing value is not such a lookup
66
+ */
67
+ private keepEnvLookupReference;
68
+ /**
69
+ * Reads a `@lookup:` value for the `@env:` keep.
70
+ * @returns The parsed lookup; `'Unreadable'` when it holds `@env:` but cannot be parsed; null
71
+ * when it holds no `@env:` reference
72
+ */
73
+ private parseEnvLookup;
74
+ /** The lookup's create fields, or null when a value cannot be URI-decoded. */
75
+ private readLookupCreateFields;
76
+ /**
77
+ * The value each criteria field must have, with `@env:` values read from the environment.
78
+ * @returns The values, or the reason the lookup cannot be checked
79
+ */
80
+ private expectedLookupValues;
81
+ /**
82
+ * Checks the record the foreign key points at against the expected criteria values.
83
+ * @returns The warning text without values, or null when the record matches
84
+ */
85
+ private lookupTargetProblem;
86
+ /** Compares a row with the expected values: field names and values without case, values not trimmed. */
87
+ private lookupRowMatches;
88
+ /** Reads the record a foreign key points at, as plain values. */
89
+ private loadLookupTarget;
90
+ /**
91
+ * Returns the field's existing `@env:` reference. Warns when the variable differs from the database value.
92
+ * @returns The reference to keep, or null when the existing value is not an `@env:` reference
93
+ */
94
+ private keepEnvReference;
95
+ /**
96
+ * Keeps `@env:` references inside a JSON field. When the file value is kept whole, warns why
97
+ * (a verbose note only when the database value is null).
98
+ */
99
+ private keepNestedEnvReferences;
100
+ /**
101
+ * Gives the warnings and verbose notes for a nested keep. Messages name paths and variables only.
102
+ * @param sideFile The side file the references are in, named in each message when given
103
+ */
104
+ private reportNestedKeep;
105
+ /**
106
+ * Keeps `@env:` references in the `.json` side file that the field names with `@file:`. Writes the
107
+ * database JSON with the references put back to the side file when it differs, and keeps the
108
+ * `@file:` reference in the record. A side file with `@include` directives or nested `@file:`
109
+ * references is not rewritten.
110
+ * @returns The `@file:` reference to keep, or null when the field is not such a side file
111
+ */
112
+ private keepEnvReferencesInSideFile;
113
+ /**
114
+ * Reads a JSON side file as push does: a leading byte order mark is ignored.
115
+ * @returns The parsed JSON, or null when the file is missing or does not parse
116
+ */
117
+ private readJsonSideFile;
118
+ /** Warns on a drifted kept reference, and notes an unset variable when verbose. Never prints a value. */
119
+ private reportKeptReference;
120
+ /** Names a field in messages. An `@env:` key value is shown as the file has it, never resolved. */
121
+ private describeField;
122
+ private warn;
36
123
  /**
37
124
  * Determines if a field should be skipped during processing
38
125
  */
39
126
  private shouldSkipField;
127
+ /**
128
+ * True when the field is null and the config sets `ignoreNullFields`
129
+ */
130
+ private shouldSkipNullField;
40
131
  /**
41
132
  * Checks if a virtual field should be skipped
42
133
  */
@@ -104,6 +195,13 @@ export declare class RecordProcessor {
104
195
  * Processes first-class embeds on pull (§6)
105
196
  */
106
197
  private processEmbeds;
198
+ /**
199
+ * The key pull writes for an embed: the existing embed's `@env:` key values that still resolve to the database key.
200
+ * @throws UnsetPrimaryKeyVariableError when an existing embed key variable is not set
201
+ */
202
+ private keptEmbedPrimaryKey;
203
+ /** The fields of the existing extension, in its shorthand form or its map form keyed by entity name. */
204
+ private existingExtensionFields;
107
205
  /**
108
206
  * Checks if the record has externalized fields
109
207
  */
@@ -1 +1 @@
1
- {"version":3,"file":"RecordProcessor.d.ts","sourceRoot":"","sources":["../../src/lib/RecordProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAA+C,QAAQ,EAAE,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