@memberjunction/integration-engine 6.2.0-edge.5 → 6.2.0-edge.7

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 (88) hide show
  1. package/dist/ActionMetadataGenerator.d.ts +45 -0
  2. package/dist/ActionMetadataGenerator.d.ts.map +1 -1
  3. package/dist/ActionMetadataGenerator.js +75 -5
  4. package/dist/ActionMetadataGenerator.js.map +1 -1
  5. package/dist/AdaptiveConcurrency.d.ts +15 -0
  6. package/dist/AdaptiveConcurrency.d.ts.map +1 -1
  7. package/dist/AdaptiveConcurrency.js +21 -0
  8. package/dist/AdaptiveConcurrency.js.map +1 -1
  9. package/dist/BaseIntegrationConnector.d.ts +70 -0
  10. package/dist/BaseIntegrationConnector.d.ts.map +1 -1
  11. package/dist/BaseIntegrationConnector.js +112 -9
  12. package/dist/BaseIntegrationConnector.js.map +1 -1
  13. package/dist/BaseRESTIntegrationConnector.d.ts +2 -2
  14. package/dist/BaseRESTIntegrationConnector.d.ts.map +1 -1
  15. package/dist/BaseRESTIntegrationConnector.js +43 -4
  16. package/dist/BaseRESTIntegrationConnector.js.map +1 -1
  17. package/dist/CatalogScope.d.ts +152 -0
  18. package/dist/CatalogScope.d.ts.map +1 -0
  19. package/dist/CatalogScope.js +399 -0
  20. package/dist/CatalogScope.js.map +1 -0
  21. package/dist/CatalogSource.d.ts +53 -0
  22. package/dist/CatalogSource.d.ts.map +1 -0
  23. package/dist/CatalogSource.js +82 -0
  24. package/dist/CatalogSource.js.map +1 -0
  25. package/dist/CatalogWriter.d.ts +216 -0
  26. package/dist/CatalogWriter.d.ts.map +1 -0
  27. package/dist/CatalogWriter.js +457 -0
  28. package/dist/CatalogWriter.js.map +1 -0
  29. package/dist/CompanyIntegrationCatalogStore.d.ts +109 -0
  30. package/dist/CompanyIntegrationCatalogStore.d.ts.map +1 -0
  31. package/dist/CompanyIntegrationCatalogStore.js +229 -0
  32. package/dist/CompanyIntegrationCatalogStore.js.map +1 -0
  33. package/dist/DeclaredSampleMerge.d.ts +10 -4
  34. package/dist/DeclaredSampleMerge.d.ts.map +1 -1
  35. package/dist/DeclaredSampleMerge.js +17 -6
  36. package/dist/DeclaredSampleMerge.js.map +1 -1
  37. package/dist/DiscoveryWatchdog.d.ts +38 -1
  38. package/dist/DiscoveryWatchdog.d.ts.map +1 -1
  39. package/dist/DiscoveryWatchdog.js +56 -1
  40. package/dist/DiscoveryWatchdog.js.map +1 -1
  41. package/dist/IntegrationActionGenerator.d.ts.map +1 -1
  42. package/dist/IntegrationActionGenerator.js +36 -26
  43. package/dist/IntegrationActionGenerator.js.map +1 -1
  44. package/dist/IntegrationConnectorCreationPipeline.d.ts +181 -4
  45. package/dist/IntegrationConnectorCreationPipeline.d.ts.map +1 -1
  46. package/dist/IntegrationConnectorCreationPipeline.js +646 -68
  47. package/dist/IntegrationConnectorCreationPipeline.js.map +1 -1
  48. package/dist/IntegrationEngine.d.ts +86 -2
  49. package/dist/IntegrationEngine.d.ts.map +1 -1
  50. package/dist/IntegrationEngine.js +760 -209
  51. package/dist/IntegrationEngine.js.map +1 -1
  52. package/dist/IntegrationSchemaSync.d.ts +97 -0
  53. package/dist/IntegrationSchemaSync.d.ts.map +1 -1
  54. package/dist/IntegrationSchemaSync.js +302 -49
  55. package/dist/IntegrationSchemaSync.js.map +1 -1
  56. package/dist/MatchEngine.d.ts.map +1 -1
  57. package/dist/MatchEngine.js +6 -0
  58. package/dist/MatchEngine.js.map +1 -1
  59. package/dist/MemoryGovernor.d.ts +183 -0
  60. package/dist/MemoryGovernor.d.ts.map +1 -0
  61. package/dist/MemoryGovernor.js +225 -0
  62. package/dist/MemoryGovernor.js.map +1 -0
  63. package/dist/ResourcePressure.d.ts +80 -0
  64. package/dist/ResourcePressure.d.ts.map +1 -0
  65. package/dist/ResourcePressure.js +143 -0
  66. package/dist/ResourcePressure.js.map +1 -0
  67. package/dist/RunMemoryControl.d.ts +122 -0
  68. package/dist/RunMemoryControl.d.ts.map +1 -0
  69. package/dist/RunMemoryControl.js +237 -0
  70. package/dist/RunMemoryControl.js.map +1 -0
  71. package/dist/SchemaPersistCounts.d.ts +29 -0
  72. package/dist/SchemaPersistCounts.d.ts.map +1 -0
  73. package/dist/SchemaPersistCounts.js +27 -0
  74. package/dist/SchemaPersistCounts.js.map +1 -0
  75. package/dist/SyncLogger.d.ts +21 -0
  76. package/dist/SyncLogger.d.ts.map +1 -1
  77. package/dist/SyncLogger.js +92 -1
  78. package/dist/SyncLogger.js.map +1 -1
  79. package/dist/WatermarkService.d.ts.map +1 -1
  80. package/dist/WatermarkService.js +1 -0
  81. package/dist/WatermarkService.js.map +1 -1
  82. package/dist/index.d.ts +12 -0
  83. package/dist/index.d.ts.map +1 -1
  84. package/dist/index.js +8 -0
  85. package/dist/index.js.map +1 -1
  86. package/dist/types.d.ts +46 -0
  87. package/dist/types.d.ts.map +1 -1
  88. package/package.json +7 -7
@@ -0,0 +1,229 @@
1
+ import { CompositeKey, Metadata, RunView } from '@memberjunction/core';
2
+ import { EscapeSQLString } from '@memberjunction/global';
3
+ import { CATALOG_FIELD_COLUMNS, CATALOG_OBJECT_COLUMNS, CompanyIntegrationCatalogSchemaMismatch, ENTITY_COMPANY_INTEGRATION_OBJECTS, ENTITY_COMPANY_INTEGRATION_OBJECT_FIELDS, } from '@memberjunction/integration-engine-base';
4
+ import { CompanyIntegrationCatalogReadFailed } from './CatalogWriter.js';
5
+ /** Entities whose column set has already been checked, so the check costs one pass per process. */
6
+ const verified = new Set();
7
+ function requiredColumnsFor(entityName) {
8
+ return entityName === ENTITY_COMPANY_INTEGRATION_OBJECTS
9
+ ? CATALOG_OBJECT_COLUMNS
10
+ : CATALOG_FIELD_COLUMNS;
11
+ }
12
+ /**
13
+ * Assert the loaded entity carries every column the engine writes.
14
+ *
15
+ * Checked against a real row rather than against metadata alone, because a row is what `Set` will
16
+ * be called on. Runs once per entity per process: the alternative is a migration-shaped failure
17
+ * appearing as scattered missing values hours later, in a run that reported success.
18
+ *
19
+ * The virtual view aliases are excluded — they exist on the row but are not writable, and
20
+ * `AssertWritable` below is what keeps a write off them.
21
+ */
22
+ function assertShape(entityName, row) {
23
+ if (verified.has(entityName))
24
+ return;
25
+ const present = new Set((row.Fields ?? []).map(f => f.Name));
26
+ const missing = requiredColumnsFor(entityName).filter(c => !present.has(c));
27
+ if (missing.length > 0)
28
+ throw new CompanyIntegrationCatalogSchemaMismatch(entityName, missing);
29
+ verified.add(entityName);
30
+ }
31
+ /**
32
+ * Columns the view exposes as aliases of a real column. Writing one would be accepted by the row
33
+ * and dropped by the CRUD procedure, which has no parameter for it — the same silent loss this
34
+ * class exists to prevent, one layer down.
35
+ */
36
+ const VIRTUAL_COLUMNS = new Set([
37
+ 'IntegrationObjectID',
38
+ 'RelatedIntegrationObjectID',
39
+ 'RelatedIntegrationObject',
40
+ 'Integration',
41
+ 'IntegrationObject',
42
+ ]);
43
+ /**
44
+ * A per-connection catalog row, writable only through `Set`.
45
+ *
46
+ * Note `IntegrationObjectID` is virtual on the FIELD entity (a view alias) and REAL on the OBJECT
47
+ * entity (the provenance foreign key). `Set` resolves that from the row's own field list rather
48
+ * than from the name, so the object's provenance link stays writable and the field's alias does
49
+ * not.
50
+ */
51
+ export class CatalogRow {
52
+ constructor(entityName, row) {
53
+ this.entityName = entityName;
54
+ this.row = row;
55
+ }
56
+ /** @internal */
57
+ static Wrap(entityName, row) {
58
+ assertShape(entityName, row);
59
+ return new CatalogRow(entityName, row);
60
+ }
61
+ get ID() {
62
+ return this.row.Get('ID');
63
+ }
64
+ /** The underlying row, for a caller that needs to enlist it in a transaction group. */
65
+ get Entity() {
66
+ return this.row;
67
+ }
68
+ Get(column) {
69
+ return this.row.Get(column);
70
+ }
71
+ /**
72
+ * Write one column.
73
+ *
74
+ * Throws on a column the entity does not have and on a view alias, because both would otherwise
75
+ * be accepted and discarded. That is the whole point of this class: the failure is loud, at the
76
+ * assignment, naming the column.
77
+ */
78
+ Set(column, value) {
79
+ const field = (this.row.Fields ?? []).find(f => f.Name === column);
80
+ if (!field) {
81
+ throw new Error(`${this.entityName} has no column '${column}'. Assigning it would create a property `
82
+ + `beside the entity's field list, and the row would save clean while writing nothing.`);
83
+ }
84
+ if (VIRTUAL_COLUMNS.has(column) && field.EntityFieldInfo?.IsVirtual === true) {
85
+ throw new Error(`${this.entityName}.${column} is a view alias, not a stored column. The CRUD `
86
+ + `procedure has no parameter for it, so this write would be silently dropped. `
87
+ + `Write the real column instead.`);
88
+ }
89
+ this.row.Set(column, value);
90
+ return this;
91
+ }
92
+ /** Set several columns. Skips `undefined` so a caller can pass a sparse patch. */
93
+ SetMany(values) {
94
+ for (const [k, v] of Object.entries(values))
95
+ if (v !== undefined)
96
+ this.Set(k, v);
97
+ return this;
98
+ }
99
+ async Save() {
100
+ return await this.row.Save();
101
+ }
102
+ async Delete() {
103
+ return await this.row.Delete();
104
+ }
105
+ /** The row's own error text after a failed Save, for logging. */
106
+ get LastError() {
107
+ // CompleteMessage, not Message: a Save refused by validation leaves Message empty and puts
108
+ // the reason in Errors, which CompleteMessage includes.
109
+ return this.row.LatestResult?.CompleteMessage ?? '';
110
+ }
111
+ }
112
+ /** Reads and writes for the per-connection catalog. */
113
+ export class CompanyIntegrationCatalogStore {
114
+ /** `provider` is the caller's bound provider; without one the store uses the default. */
115
+ constructor(contextUser, provider) {
116
+ this.contextUser = contextUser;
117
+ this.provider = provider;
118
+ }
119
+ get md() {
120
+ return this.provider ?? new Metadata();
121
+ }
122
+ async newRow(entityName) {
123
+ const row = await this.md.GetEntityObject(entityName, this.contextUser);
124
+ if (!row) {
125
+ throw new CompanyIntegrationCatalogSchemaMismatch(entityName, ['<entity not registered>']);
126
+ }
127
+ row.NewRecord();
128
+ return CatalogRow.Wrap(entityName, row);
129
+ }
130
+ NewObject() {
131
+ return this.newRow(ENTITY_COMPANY_INTEGRATION_OBJECTS);
132
+ }
133
+ NewField() {
134
+ return this.newRow(ENTITY_COMPANY_INTEGRATION_OBJECT_FIELDS);
135
+ }
136
+ async loadRow(entityName, id) {
137
+ const row = await this.md.GetEntityObject(entityName, this.contextUser);
138
+ if (!row)
139
+ return null;
140
+ // `Load(id)` is a GENERATED-subclass convenience. These entities have none, so the entry
141
+ // point is the base one — the same call the existing shared-catalog code makes.
142
+ const loaded = await row.InnerLoad(CompositeKey.FromID(id)); // first-pk-ok: entityName is one of the two per-connection catalog core tables ('MJ: Company Integration Objects' / '... Object Fields'), both keyed by ID
143
+ return loaded ? CatalogRow.Wrap(entityName, row) : null;
144
+ }
145
+ LoadObject(id) {
146
+ return this.loadRow(ENTITY_COMPANY_INTEGRATION_OBJECTS, id);
147
+ }
148
+ LoadField(id) {
149
+ return this.loadRow(ENTITY_COMPANY_INTEGRATION_OBJECT_FIELDS, id);
150
+ }
151
+ /**
152
+ * Read straight from the database rather than the engine cache — and around the query-result
153
+ * cache too.
154
+ *
155
+ * Used by the write path, which must see rows another pass of the same run just persisted. The
156
+ * engine cache is refreshed between passes, not within one.
157
+ *
158
+ * `BypassCache` is load-bearing, not a tuning knob. The query-result cache is keyed by the exact
159
+ * query text and filled by whoever asks first. Within one discovery that is Introspect, which
160
+ * asks for an object's fields BEFORE Persist has written any, so the cached answer is the empty
161
+ * set; Persist writes the rows; the reads after it issue the byte-identical query and are handed
162
+ * that empty answer. These entities are registered by a migration rather than CodeGen, so
163
+ * nothing invalidates the entry when the rows are saved, and where the cache is shared and
164
+ * external to the process a restart does not clear it either. Observed 2026-09-27: a discovery
165
+ * skipped all 34 objects for having no primary key although the 30 declared ones each had one;
166
+ * on another tenant, fetches aborted reporting "no columns persisted" for objects holding 41,
167
+ * 81, 31 and 704 persisted fields.
168
+ */
169
+ async runView(entityName, filter) {
170
+ const rv = this.newRunView();
171
+ const result = await rv.RunView({
172
+ EntityName: entityName,
173
+ ExtraFilter: filter,
174
+ ResultType: 'entity_object',
175
+ BypassCache: true,
176
+ Telemetry: { Exempt: true, Reason: 'Per-connection catalog read inside a run; a cached answer predates the write it must observe' },
177
+ }, this.contextUser);
178
+ // A failed read is an ERROR, never an empty catalog — the rule CatalogWriter.viewRows applies.
179
+ // Returning [] here would hand a caller "this connection has no catalog" on a database error.
180
+ if (!result?.Success) {
181
+ throw new CompanyIntegrationCatalogReadFailed(entityName, filter, result?.ErrorMessage ?? 'RunView returned no result');
182
+ }
183
+ return result.Results ?? [];
184
+ }
185
+ /**
186
+ * A RunView on the store's provider — the one its writes use — so a server with more than one
187
+ * provider never reads from one and writes to another. Server-side providers are
188
+ * DatabaseProviderBase (an IRunViewProvider), which the IMetadataProvider type does not declare;
189
+ * same narrowing as CatalogWriter.
190
+ */
191
+ newRunView() {
192
+ return new RunView(this.provider);
193
+ }
194
+ /**
195
+ * Every object row for a connection, INCLUDING disabled ones.
196
+ *
197
+ * Disabled rows are load-bearing here: the overlay reactivates an object that reappeared rather
198
+ * than inserting a second one, and the unique constraint on (connection, name) means matching
199
+ * active rows only would turn a reappearance into a constraint violation.
200
+ */
201
+ async ObjectsForConnection(companyIntegrationID) {
202
+ const rows = await this.runView(ENTITY_COMPANY_INTEGRATION_OBJECTS, `CompanyIntegrationID = '${EscapeSQLString(companyIntegrationID)}'`);
203
+ return rows.map(r => CatalogRow.Wrap(ENTITY_COMPANY_INTEGRATION_OBJECTS, r));
204
+ }
205
+ /** Every field row for one object, including disabled ones, for the same reason. */
206
+ async FieldsForObject(companyIntegrationObjectID) {
207
+ const rows = await this.runView(ENTITY_COMPANY_INTEGRATION_OBJECT_FIELDS, `CompanyIntegrationObjectID = '${EscapeSQLString(companyIntegrationObjectID)}'`);
208
+ return rows.map(r => CatalogRow.Wrap(ENTITY_COMPANY_INTEGRATION_OBJECT_FIELDS, r));
209
+ }
210
+ /** Whether this connection has a per-connection catalog at all. Cheap existence check. */
211
+ async HasCatalog(companyIntegrationID) {
212
+ const rv = this.newRunView();
213
+ const filter = `CompanyIntegrationID = '${EscapeSQLString(companyIntegrationID)}'`;
214
+ const result = await rv.RunView({
215
+ EntityName: ENTITY_COMPANY_INTEGRATION_OBJECTS,
216
+ ExtraFilter: filter,
217
+ ResultType: 'count_only',
218
+ // Same reason as runView: a cached zero taken before the first persist would route
219
+ // the run down the no-catalog path for the rest of its life.
220
+ BypassCache: true,
221
+ Telemetry: { Exempt: true, Reason: 'Existence check for a catalog being written in this same run; a cached count predates the write' },
222
+ }, this.contextUser);
223
+ if (!result?.Success) {
224
+ throw new CompanyIntegrationCatalogReadFailed(ENTITY_COMPANY_INTEGRATION_OBJECTS, filter, result?.ErrorMessage ?? 'RunView returned no result');
225
+ }
226
+ return (result.TotalRowCount ?? 0) > 0;
227
+ }
228
+ }
229
+ //# sourceMappingURL=CompanyIntegrationCatalogStore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CompanyIntegrationCatalogStore.js","sourceRoot":"","sources":["../src/CompanyIntegrationCatalogStore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,YAAY,EAA2C,QAAQ,EAAE,OAAO,EAAY,MAAM,sBAAsB,CAAC;AACtI,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EACH,qBAAqB,EACrB,sBAAsB,EACtB,uCAAuC,EACvC,kCAAkC,EAClC,wCAAwC,GAC3C,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAE,mCAAmC,EAAE,MAAM,iBAAiB,CAAC;AA0BtE,mGAAmG;AACnG,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAU,CAAC;AAEnC,SAAS,kBAAkB,CAAC,UAA6B;IACrD,OAAO,UAAU,KAAK,kCAAkC;QACpD,CAAC,CAAC,sBAAsB;QACxB,CAAC,CAAC,qBAAqB,CAAC;AAChC,CAAC;AAED;;;;;;;;;GASG;AACH,SAAS,WAAW,CAAC,UAA6B,EAAE,GAAe;IAC/D,IAAI,QAAQ,CAAC,GAAG,CAAC,UAAU,CAAC;QAAE,OAAO;IACrC,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,CAAC,MAAM,IAAI,EAAE,CAAC,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C,CAAC,CAAC,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,kCAAkC,EAAE,CAAC,CAAC,CAAC,CAAC;IACjF,CAAC;IAED,oFAAoF;IAC7E,KAAK,CAAC,eAAe,CAAC,0BAAkC;QAC3D,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,OAAO,CAC3B,wCAAwC,EACxC,iCAAiC,eAAe,CAAC,0BAA0B,CAAC,GAAG,CAClF,CAAC;QACF,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,wCAAwC,EAAE,CAAC,CAAC,CAAC,CAAC;IACvF,CAAC;IAED,0FAA0F;IACnF,KAAK,CAAC,UAAU,CAAC,oBAA4B;QAChD,MAAM,EAAE,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;QAC7B,MAAM,MAAM,GAAG,2BAA2B,eAAe,CAAC,oBAAoB,CAAC,GAAG,CAAC;QACnF,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC,OAAO,CAC3B;YACI,UAAU,EAAE,kCAAkC;YAC9C,WAAW,EAAE,MAAM;YACnB,UAAU,EAAE,YAAY;YACxB,mFAAmF;YACnF,6DAA6D;YAC7D,WAAW,EAAE,IAAI;YACjB,SAAS,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,iGAAiG,EAAE;SACzI,EACD,IAAI,CAAC,WAAW,CACnB,CAAC;QACF,IAAI,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC;YACnB,MAAM,IAAI,mCAAmC,CAAC,kCAAkC,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,IAAI,4BAA4B,CAAC,CAAC;QACpJ,CAAC;QACD,OAAO,CAAC,MAAM,CAAC,aAAa,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;IAC3C,CAAC;CACJ"}
@@ -48,10 +48,16 @@ export type FieldLength = number | null | undefined;
48
48
  /**
49
49
  * Effective length for a field the source both declared and was observed producing.
50
50
  *
51
- * `null` (unbounded) beats every number, on either side: a declaration of "unbounded" is a
52
- * deliberate statement that no width is safe, and an observation that exceeded the bounded ceiling
53
- * is the data saying the same thing. Otherwise the larger wins, and a missing side yields to the
54
- * present one.
51
+ * Unbounded beats every number, on either side: a declaration of "unbounded" is a deliberate
52
+ * statement that no width is safe, and an observation that exceeded the bounded ceiling is the data
53
+ * saying the same thing. Otherwise the larger wins, and a missing side yields to the present one.
54
+ *
55
+ * UNBOUNDED HAS TWO SPELLINGS and this function has to know both. This module writes it as `null`;
56
+ * the catalog and the dialects write it as `-1`, which is what `decideLengthOverlay` and both
57
+ * TypeMappers render as `(MAX)`. Treating `-1` as an ordinary number made `MergeLength(255, -1)`
58
+ * return 255 — a numeric comparison reading the WIDEST possible width as the narrowest — so a
59
+ * sample that proved no bounded width was safe was silently merged away, and records too long for
60
+ * the resulting column stopped arriving with the run still reporting success.
55
61
  */
56
62
  export declare function MergeLength(declared: FieldLength, observed: FieldLength): FieldLength;
57
63
  /** The outcome of merging one object's declared fields with a sample, for logging and tests. */
@@ -1 +1 @@
1
- {"version":3,"file":"DeclaredSampleMerge.d.ts","sourceRoot":"","sources":["../src/DeclaredSampleMerge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,YAAY,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,iGAAiG;AACjG,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;AAEpD;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,WAAW,GAAG,WAAW,CAKrF;AAED,gGAAgG;AAChG,MAAM,WAAW,YAAY,CAAC,MAAM,SAAS,cAAc;IACvD,MAAM,EA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,CAAC,EAC/B,QAAQ,EAAE,aAAa,CAAC,MAAM,CAAC,GAChC,YAAY,CAAC,MAAM,CAAC,CA6CtB"}
@@ -36,14 +36,25 @@
36
36
  /**
37
37
  * Effective length for a field the source both declared and was observed producing.
38
38
  *
39
- * `null` (unbounded) beats every number, on either side: a declaration of "unbounded" is a
40
- * deliberate statement that no width is safe, and an observation that exceeded the bounded ceiling
41
- * is the data saying the same thing. Otherwise the larger wins, and a missing side yields to the
42
- * present one.
39
+ * Unbounded beats every number, on either side: a declaration of "unbounded" is a deliberate
40
+ * statement that no width is safe, and an observation that exceeded the bounded ceiling is the data
41
+ * saying the same thing. Otherwise the larger wins, and a missing side yields to the present one.
42
+ *
43
+ * UNBOUNDED HAS TWO SPELLINGS and this function has to know both. This module writes it as `null`;
44
+ * the catalog and the dialects write it as `-1`, which is what `decideLengthOverlay` and both
45
+ * TypeMappers render as `(MAX)`. Treating `-1` as an ordinary number made `MergeLength(255, -1)`
46
+ * return 255 — a numeric comparison reading the WIDEST possible width as the narrowest — so a
47
+ * sample that proved no bounded width was safe was silently merged away, and records too long for
48
+ * the resulting column stopped arriving with the run still reporting success.
43
49
  */
44
50
  export function MergeLength(declared, observed) {
45
- if (declared === null || observed === null)
46
- return null;
51
+ const unbounded = (v) => v === null || v === -1;
52
+ // Preserve the caller's own spelling: a source that said -1 gets -1 back, so the value stays
53
+ // legible to the catalog path that produced it.
54
+ if (unbounded(declared))
55
+ return declared;
56
+ if (unbounded(observed))
57
+ return observed;
47
58
  if (declared === undefined)
48
59
  return observed;
49
60
  if (observed === undefined)
@@ -1 +1 @@
1
- {"version":3,"file":"DeclaredSampleMerge.js","sourceRoot":"","sources":["../src/DeclaredSampleMerge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAgBH;;;;;;;GAOG;AACH,MAAM,UAAU,WAAW,CAAC,QAAqB,EAAE,QAAqB;IACpE,IAAI,QAAQ,KAAK,IAAI,IAA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,cAAc,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY;SAC3D,CAAC,CAAC;QACH,IAAI,CAAC,cAAc,IAAI,IAAI,CAAC,YAAY,KAAK,IAAI;YAAE,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACnF,CAAC;IAED,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,eAAe,EAAE,KAAK,EAAE,iBAAiB,EAAE,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,CAAC;AAChH,CAAC"}
@@ -44,7 +44,26 @@ export type DiscoveryWatchdogOptions = {
44
44
  /** Timer factory, injectable for tests. Must return something `Clear` accepts. */
45
45
  SetInterval?: (fn: () => void, ms: number) => unknown;
46
46
  Clear?: (handle: unknown) => void;
47
+ /**
48
+ * How long an entry may sit in flight before it is treated as abandoned. `<= 0` disables
49
+ * eviction. See {@link DEFAULT_STALE_AFTER_MS} for why one exists at all.
50
+ */
51
+ StaleAfterMs?: number;
47
52
  };
53
+ /**
54
+ * When an in-flight entry stops being evidence and starts being noise.
55
+ *
56
+ * `End` is called in a `finally`, so an entry survives its owner only when the owner did not
57
+ * unwind at all: the process was killed mid-discovery and the registry was rebuilt from a stale
58
+ * source, or an await never settled and never rejected. In both cases the entry is not a slow
59
+ * object — it is a dead one, and the watchdog reporting it as "still in flight, oldest 4211s"
60
+ * is precisely the under-reporting-the-truth failure this class exists to prevent. An operator
61
+ * reading that line chases a sample that stopped existing an hour ago.
62
+ *
63
+ * One hour is deliberately far beyond any real discovery. This is not a timeout and it cancels
64
+ * nothing — it only decides when the watchdog should stop asserting something it cannot know.
65
+ */
66
+ export declare const DEFAULT_STALE_AFTER_MS: number;
48
67
  /**
49
68
  * Resolves the report interval: `MJ_INTEGRATION_DISCOVERY_WATCHDOG_MS`, default 15s, `0` to
50
69
  * silence it. A malformed value falls back to the default rather than disabling the reporting an
@@ -66,6 +85,7 @@ export declare class DiscoveryWatchdog extends BaseSingleton<DiscoveryWatchdog>
66
85
  readonly ShutdownName = "DiscoveryWatchdog";
67
86
  private readonly inFlight;
68
87
  private intervalMs;
88
+ private staleAfterMs;
69
89
  private now;
70
90
  private log;
71
91
  private setIntervalFn;
@@ -95,7 +115,24 @@ export declare class DiscoveryWatchdog extends BaseSingleton<DiscoveryWatchdog>
95
115
  Peek(key: string | undefined): Readonly<DiscoveryWatchEntry> | undefined;
96
116
  /** The report line, or `null` when nothing is in flight. Pure — this is what the ticker logs. */
97
117
  BuildReport(): string | null;
98
- /** Emits one report immediately. Exposed so the ticker and tests drive the same path. */
118
+ /**
119
+ * Removes entries too old to be believed, naming each one.
120
+ *
121
+ * Eviction is loud on purpose. A sample vanishing from the report silently would look like it
122
+ * completed, which is the opposite of what happened — so the line says the entry was abandoned
123
+ * and how long it had been sitting there, and that is the last thing anyone hears about it.
124
+ *
125
+ * Returns the number evicted, so the caller (and tests) can distinguish "nothing was stale"
126
+ * from "eviction is switched off".
127
+ */
128
+ EvictStale(): number;
129
+ /**
130
+ * Emits one report immediately. Exposed so the ticker and tests drive the same path.
131
+ *
132
+ * Eviction runs FIRST, so a report never describes an entry this same tick has already
133
+ * decided is dead — otherwise the report and the eviction line would contradict each other
134
+ * within a few lines of the same log.
135
+ */
99
136
  Tick(): void;
100
137
  private ensureTicker;
101
138
  private stopTicker;
@@ -1 +1 @@
1
- {"version":3,"file":"DiscoveryWatchdog.d.ts","sourceRoot":"","sources":["../src/DiscoveryWatchdog.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,aAAa,EAAoB,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAExF,oDAAoD;AACpD,MAAM,MAAM,mBAAmB,GAAG;IAC9B,yCAAyC;IACzC,MAAM,EAAE,MAAM,CAAC;IACf,mCAAmC;IACnC,SAAS,EAAE,MAAM,CAAC;IAClB,8CAA8C;IAC9C,KAAK,EAAE,MAAM,CAAC;IACd,2CAA2C;IAC3C,KA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,SAAS,CAAC,OAAO,GAAE,wBAA6B,GAAG,IAAI;IAa9D,2FAA2F;IACpF,KAAK,IAAI,IAAI;IAMpB,wFAAwF;IAC3E,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAItC,wEAAwE;IACjE,KAAK,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM;IAc7D,4EAA4E;IACrE,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,EAAE,KAAK,EAAE,mBAAmB,GAAG,IAAI;IAMtE,6EAA6E;IACtE,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI;IAMzC,yFAAyF;IAClF,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,QAAQ,CAAC,mBAAmB,CAAC,GAAG,SAAS;IAI/E,iGAAiG;IAC1F,WAAW,IAAI,MAAM,GAAG,IAAI;IAWnC;;;;;;;;;OASG;IACI,UAAU,IAAI,MAAM;IAqB3B;;;;;;OAMG;IACI,IAAI,IAAI,IAAI;IAUnB,OAAO,CAAC,YAAY;IAKpB,OAAO,CAAC,UAAU;CAKrB"}
@@ -17,6 +17,20 @@
17
17
  * can never be the reason Node stays alive, and it exists only while samples are in flight.
18
18
  */
19
19
  import { BaseSingleton, ShutdownRegistry } from '@memberjunction/global';
20
+ /**
21
+ * When an in-flight entry stops being evidence and starts being noise.
22
+ *
23
+ * `End` is called in a `finally`, so an entry survives its owner only when the owner did not
24
+ * unwind at all: the process was killed mid-discovery and the registry was rebuilt from a stale
25
+ * source, or an await never settled and never rejected. In both cases the entry is not a slow
26
+ * object — it is a dead one, and the watchdog reporting it as "still in flight, oldest 4211s"
27
+ * is precisely the under-reporting-the-truth failure this class exists to prevent. An operator
28
+ * reading that line chases a sample that stopped existing an hour ago.
29
+ *
30
+ * One hour is deliberately far beyond any real discovery. This is not a timeout and it cancels
31
+ * nothing — it only decides when the watchdog should stop asserting something it cannot know.
32
+ */
33
+ export const DEFAULT_STALE_AFTER_MS = 60 * 60 * 1000;
20
34
  /**
21
35
  * Resolves the report interval: `MJ_INTEGRATION_DISCOVERY_WATCHDOG_MS`, default 15s, `0` to
22
36
  * silence it. A malformed value falls back to the default rather than disabling the reporting an
@@ -48,6 +62,7 @@ export class DiscoveryWatchdog extends BaseSingleton {
48
62
  super();
49
63
  this.ShutdownName = 'DiscoveryWatchdog';
50
64
  this.inFlight = new Map();
65
+ this.staleAfterMs = DEFAULT_STALE_AFTER_MS;
51
66
  this.ticker = null;
52
67
  this.keySeq = 0;
53
68
  this.intervalMs = ResolveWatchdogIntervalMs(process.env.MJ_INTEGRATION_DISCOVERY_WATCHDOG_MS);
@@ -81,6 +96,8 @@ export class DiscoveryWatchdog extends BaseSingleton {
81
96
  this.setIntervalFn = options.SetInterval;
82
97
  if (options.Clear)
83
98
  this.clearFn = options.Clear;
99
+ if (options.StaleAfterMs !== undefined)
100
+ this.staleAfterMs = options.StaleAfterMs;
84
101
  if (this.ticker !== null) {
85
102
  this.stopTicker();
86
103
  this.ensureTicker();
@@ -141,8 +158,46 @@ export class DiscoveryWatchdog extends BaseSingleton {
141
158
  (e.DeadlineMs !== undefined ? ` deadlineIn=${Math.round((e.DeadlineMs - now) / 1000)}s` : ''));
142
159
  return `[DiscoveryWatchdog] ${entries.length} object(s) still in flight, oldest ${oldestSec}s:\n ${rows.join('\n ')}`;
143
160
  }
144
- /** Emits one report immediately. Exposed so the ticker and tests drive the same path. */
161
+ /**
162
+ * Removes entries too old to be believed, naming each one.
163
+ *
164
+ * Eviction is loud on purpose. A sample vanishing from the report silently would look like it
165
+ * completed, which is the opposite of what happened — so the line says the entry was abandoned
166
+ * and how long it had been sitting there, and that is the last thing anyone hears about it.
167
+ *
168
+ * Returns the number evicted, so the caller (and tests) can distinguish "nothing was stale"
169
+ * from "eviction is switched off".
170
+ */
171
+ EvictStale() {
172
+ if (this.staleAfterMs <= 0)
173
+ return 0;
174
+ const now = this.now();
175
+ const dead = [];
176
+ for (const [key, entry] of this.inFlight) {
177
+ if (now - entry.StartedMs >= this.staleAfterMs)
178
+ dead.push(key);
179
+ }
180
+ for (const key of dead) {
181
+ const entry = this.inFlight.get(key);
182
+ if (entry) {
183
+ this.log(`[DiscoveryWatchdog] evicting "${entry.Object}" — in flight ${Math.round((now - entry.StartedMs) / 1000)}s ` +
184
+ `with no completion (stage=${entry.Stage} pages=${entry.Pages} records=${entry.Records}); treating it as abandoned, not running.`);
185
+ }
186
+ this.inFlight.delete(key);
187
+ }
188
+ if (this.inFlight.size === 0)
189
+ this.stopTicker();
190
+ return dead.length;
191
+ }
192
+ /**
193
+ * Emits one report immediately. Exposed so the ticker and tests drive the same path.
194
+ *
195
+ * Eviction runs FIRST, so a report never describes an entry this same tick has already
196
+ * decided is dead — otherwise the report and the eviction line would contradict each other
197
+ * within a few lines of the same log.
198
+ */
145
199
  Tick() {
200
+ this.EvictStale();
146
201
  if (this.inFlight.size === 0) {
147
202
  this.stopTicker();
148
203
  return;
@@ -1 +1 @@
1
- {"version":3,"file":"DiscoveryWatchdog.js","sourceRoot":"","sources":["../src/DiscoveryWatchdog.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAiB,MAAM,wBAAwB,CAAC;AAiCxF;;;;GAIG;AACH,MAAM,UAAU,yBAAyB,CAAC,GAAuB,EAAE,SAAS,GAAG,MAAM;IACjF,IAAI,GAAG,KAAK,SAAS,IAAI,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE;QAAE,OAAO,SAAS,CAAC;IAC7D,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;IACxC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC;QAAE,OAAO,SAAS,CAAC;IAC/C,OAAO,MAAM,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM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;IACpB,IAAI,EAAE,qBAAqB,CAAC;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,kFAAkF;IAClF,cAAc,EAAE,OAAO,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;CACnB;AAkBD;;;;GAIG;AACH,qBAAa,0BAA0B;IAEnC,qEAAqE;IACrE,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAE9B;IAEF;;;OAGG;IACU,cAAc,CACvB,eAAe,EAAE,MAAM,EACvB,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,qBAAqB,EAC3B,WAAW,EAAE,QAAQ,EACrB,QAAQ,CAAC,EAAE,iBAAiB,GAC7B,OAAO,CAAC,+BAA+B,CAAC;IA0B3C;;;OAGG;IACU,wBAAwB,CACjC,eAAe,EAAE,MAAM,EACvB,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,QAAQ,EACrB,QAAQ,CAAC,EAAE,iBAAiB,GAC7B,OAAO,CAAC,+BAA+B,EAAE,CAAC;IAqB7C,OAAO,CAAC,eAAe;IAIvB,OAAO,CAAC,eAAe;IASvB;;;OAGG;YACW,cAAc;YA+Bd,gBAAgB;IAiB9B,OAAO,CAAC,QAAQ;IAchB;;;;OAIG;IACH,OAAO,CAAC,iBAAiB;IAwBzB,+EAA+E;YACjE,cAAc;IAgC5B,OAAO,CAAC,YAAY;IAMpB;;;OAGG;YACW,aAAa;YAwCb,kBAAkB;IAiBhC,OAAO,CAAC,iBAAiB;IAiBzB;;;OAGG;YACW,aAAa;IA6B3B;;;OAGG;YACW,kBAAkB;IA0BhC,iFAAiF;YACnE,aAAa;IAwB3B,OAAO,CAAC,MAAM;IAId,OAAO,CAAC,OAAO;CAOlB"}
@@ -19,6 +19,7 @@
19
19
  * IntegrationActionExecutor (CoreActions) is the single runtime dispatcher.
20
20
  */
21
21
  import { Metadata, RunView, LogError } from '@memberjunction/core';
22
+ import { RunOutsideCatalogScope } from './CatalogScope.js';
22
23
  import { ActionMetadataGenerator, } from './ActionMetadataGenerator.js';
23
24
  // ─── Service ─────────────────────────────────────────────────────────
24
25
  /**
@@ -36,40 +37,46 @@ export class IntegrationActionGenerator {
36
37
  * Idempotent on the deterministic Name "<Integration> - <Verb> <DisplayName>".
37
38
  */
38
39
  async GenerateAction(integrationName, objectName, verb, contextUser, provider) {
39
- const md = this.resolveProvider(provider);
40
- try {
41
- const objectInfo = await this.loadObjectInfo(md, integrationName, objectName, contextUser);
42
- if (!objectInfo) {
43
- return this.failure(verb, objectName, `IntegrationObject "${objectName}" not found for integration "${integrationName}"`);
40
+ // An Action describes the vendor's API, not one connection's projection of it.
41
+ return RunOutsideCatalogScope(async () => {
42
+ const md = this.resolveProvider(provider);
43
+ try {
44
+ const objectInfo = await this.loadObjectInfo(md, integrationName, objectName, contextUser);
45
+ if (!objectInfo) {
46
+ return this.failure(verb, objectName, `IntegrationObject "${objectName}" not found for integration "${integrationName}"`);
47
+ }
48
+ const record = this.buildActionRecord(integrationName, objectInfo, verb);
49
+ if (!record) {
50
+ return this.failure(verb, objectName, `Verb "${verb}" is not applicable to object "${objectName}" (write not supported)`);
51
+ }
52
+ const categoryID = await this.ensureCategory(md, integrationName, contextUser);
53
+ return await this.persistAction(md, record, verb, objectName, categoryID, contextUser);
44
54
  }
45
- const record = this.buildActionRecord(integrationName, objectInfo, verb);
46
- if (!record) {
47
- return this.failure(verb, objectName, `Verb "${verb}" is not applicable to object "${objectName}" (write not supported)`);
55
+ catch (err) {
56
+ const msg = err instanceof Error ? err.message : String(err);
57
+ return this.failure(verb, objectName, `Unexpected error: ${msg}`);
48
58
  }
49
- const categoryID = await this.ensureCategory(md, integrationName, contextUser);
50
- return await this.persistAction(md, record, verb, objectName, categoryID, contextUser);
51
- }
52
- catch (err) {
53
- const msg = err instanceof Error ? err.message : String(err);
54
- return this.failure(verb, objectName, `Unexpected error: ${msg}`);
55
- }
59
+ });
56
60
  }
57
61
  /**
58
62
  * Generate all applicable verbs for an object. Get/Search/List are always
59
63
  * applicable; Create/Update/Delete/Upsert only when the object SupportsWrite.
60
64
  */
61
65
  async GenerateActionsForObject(integrationName, objectName, contextUser, provider) {
62
- const md = this.resolveProvider(provider);
63
- const objectInfo = await this.loadObjectInfo(md, integrationName, objectName, contextUser);
64
- if (!objectInfo) {
65
- return [this.failure('Get', objectName, `IntegrationObject "${objectName}" not found for integration "${integrationName}"`)];
66
- }
67
- const verbs = this.applicableVerbs(objectInfo.SupportsWrite);
68
- const results = [];
69
- for (const verb of verbs) {
70
- results.push(await this.GenerateAction(integrationName, objectName, verb, contextUser, provider));
71
- }
72
- return results;
66
+ // An Action describes the vendor's API, not one connection's projection of it.
67
+ return RunOutsideCatalogScope(async () => {
68
+ const md = this.resolveProvider(provider);
69
+ const objectInfo = await this.loadObjectInfo(md, integrationName, objectName, contextUser);
70
+ if (!objectInfo) {
71
+ return [this.failure('Get', objectName, `IntegrationObject "${objectName}" not found for integration "${integrationName}"`)];
72
+ }
73
+ const verbs = this.applicableVerbs(objectInfo.SupportsWrite);
74
+ const results = [];
75
+ for (const verb of verbs) {
76
+ results.push(await this.GenerateAction(integrationName, objectName, verb, contextUser, provider));
77
+ }
78
+ return results;
79
+ });
73
80
  }
74
81
  // ─── Provider ────────────────────────────────────────────────────
75
82
  resolveProvider(provider) {
@@ -93,6 +100,7 @@ export class IntegrationActionGenerator {
93
100
  EntityName: 'MJ: Integration Objects',
94
101
  ExtraFilter: `Integration='${this.escape(integrationName)}' AND Name='${this.escape(objectName)}'`,
95
102
  MaxRows: 1,
103
+ SkipTotalRowCount: true,
96
104
  ResultType: 'entity_object',
97
105
  }, contextUser);
98
106
  if (!objResult.Success || objResult.Results.length === 0) {
@@ -160,6 +168,7 @@ export class IntegrationActionGenerator {
160
168
  EntityName: 'MJ: Action Categories',
161
169
  ExtraFilter: `Name='${this.escape(name)}'`,
162
170
  MaxRows: 1,
171
+ SkipTotalRowCount: true,
163
172
  ResultType: 'entity_object',
164
173
  }, contextUser);
165
174
  if (existing.Success && existing.Results.length > 0) {
@@ -218,6 +227,7 @@ export class IntegrationActionGenerator {
218
227
  EntityName: 'MJ: Actions',
219
228
  ExtraFilter: `Name='${this.escape(actionName)}'`,
220
229
  MaxRows: 1,
230
+ SkipTotalRowCount: true,
221
231
  ResultType: 'entity_object',
222
232
  }, contextUser);
223
233
  return result.Success && result.Results.length > 0 ? result.Results[0] : null;