@memberjunction/core-entities-server 6.2.0-edge.4 → 6.2.0-edge.6

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 (109) hide show
  1. package/dist/custom/MJAIAgentSessionEntityServer.server.d.ts +9 -3
  2. package/dist/custom/MJAIAgentSessionEntityServer.server.d.ts.map +1 -1
  3. package/dist/custom/MJAIAgentSessionEntityServer.server.js +21 -6
  4. package/dist/custom/MJAIAgentSessionEntityServer.server.js.map +1 -1
  5. package/dist/custom/MJComponentEntityServer.server.d.ts +9 -0
  6. package/dist/custom/MJComponentEntityServer.server.d.ts.map +1 -1
  7. package/dist/custom/MJComponentEntityServer.server.js +25 -1
  8. package/dist/custom/MJComponentEntityServer.server.js.map +1 -1
  9. package/dist/custom/MJConversationEntityServer.server.d.ts +13 -0
  10. package/dist/custom/MJConversationEntityServer.server.d.ts.map +1 -0
  11. package/dist/custom/MJConversationEntityServer.server.js +33 -0
  12. package/dist/custom/MJConversationEntityServer.server.js.map +1 -0
  13. package/dist/custom/MJDashboardEntityServer.server.d.ts +14 -0
  14. package/dist/custom/MJDashboardEntityServer.server.d.ts.map +1 -0
  15. package/dist/custom/MJDashboardEntityServer.server.js +38 -0
  16. package/dist/custom/MJDashboardEntityServer.server.js.map +1 -0
  17. package/dist/custom/MJDataContextItemEntityServer.server.d.ts +33 -0
  18. package/dist/custom/MJDataContextItemEntityServer.server.d.ts.map +1 -0
  19. package/dist/custom/MJDataContextItemEntityServer.server.js +84 -0
  20. package/dist/custom/MJDataContextItemEntityServer.server.js.map +1 -0
  21. package/dist/custom/MJDuplicateRunEntityServer.server.d.ts +34 -2
  22. package/dist/custom/MJDuplicateRunEntityServer.server.d.ts.map +1 -1
  23. package/dist/custom/MJDuplicateRunEntityServer.server.js +103 -23
  24. package/dist/custom/MJDuplicateRunEntityServer.server.js.map +1 -1
  25. package/dist/custom/MJEntityAlternateBaseViewEntityServer.server.d.ts +73 -0
  26. package/dist/custom/MJEntityAlternateBaseViewEntityServer.server.d.ts.map +1 -0
  27. package/dist/custom/MJEntityAlternateBaseViewEntityServer.server.js +391 -0
  28. package/dist/custom/MJEntityAlternateBaseViewEntityServer.server.js.map +1 -0
  29. package/dist/custom/MJEntityFieldPermissionEntityServer.server.d.ts +96 -22
  30. package/dist/custom/MJEntityFieldPermissionEntityServer.server.d.ts.map +1 -1
  31. package/dist/custom/MJEntityFieldPermissionEntityServer.server.js +239 -55
  32. package/dist/custom/MJEntityFieldPermissionEntityServer.server.js.map +1 -1
  33. package/dist/custom/MJFileEntityServer.server.d.ts +45 -0
  34. package/dist/custom/MJFileEntityServer.server.d.ts.map +1 -0
  35. package/dist/custom/MJFileEntityServer.server.js +101 -0
  36. package/dist/custom/MJFileEntityServer.server.js.map +1 -0
  37. package/dist/custom/MJQueryEntityServer.server.d.ts +13 -1
  38. package/dist/custom/MJQueryEntityServer.server.d.ts.map +1 -1
  39. package/dist/custom/MJQueryEntityServer.server.js +56 -8
  40. package/dist/custom/MJQueryEntityServer.server.js.map +1 -1
  41. package/dist/custom/MJQuerySQLEntityServer.server.js +3 -3
  42. package/dist/custom/MJQuerySQLEntityServer.server.js.map +1 -1
  43. package/dist/custom/MJRowLevelSecurityFilterEntityServer.server.d.ts +26 -14
  44. package/dist/custom/MJRowLevelSecurityFilterEntityServer.server.d.ts.map +1 -1
  45. package/dist/custom/MJRowLevelSecurityFilterEntityServer.server.js +57 -32
  46. package/dist/custom/MJRowLevelSecurityFilterEntityServer.server.js.map +1 -1
  47. package/dist/custom/MJUserRoleEntityServer.server.d.ts +74 -7
  48. package/dist/custom/MJUserRoleEntityServer.server.d.ts.map +1 -1
  49. package/dist/custom/MJUserRoleEntityServer.server.js +206 -20
  50. package/dist/custom/MJUserRoleEntityServer.server.js.map +1 -1
  51. package/dist/custom/MJUserRoutineEntityServer.server.d.ts.map +1 -1
  52. package/dist/custom/MJUserRoutineEntityServer.server.js +12 -3
  53. package/dist/custom/MJUserRoutineEntityServer.server.js.map +1 -1
  54. package/dist/custom/MJUserViewEntityServer.server.d.ts +43 -1
  55. package/dist/custom/MJUserViewEntityServer.server.d.ts.map +1 -1
  56. package/dist/custom/MJUserViewEntityServer.server.js +169 -11
  57. package/dist/custom/MJUserViewEntityServer.server.js.map +1 -1
  58. package/dist/custom/MJVectorIndexEntityServer.server.d.ts +83 -11
  59. package/dist/custom/MJVectorIndexEntityServer.server.d.ts.map +1 -1
  60. package/dist/custom/MJVectorIndexEntityServer.server.js +285 -42
  61. package/dist/custom/MJVectorIndexEntityServer.server.js.map +1 -1
  62. package/dist/custom/anonymousOwnershipKeyGuard.d.ts +42 -0
  63. package/dist/custom/anonymousOwnershipKeyGuard.d.ts.map +1 -0
  64. package/dist/custom/anonymousOwnershipKeyGuard.js +36 -0
  65. package/dist/custom/anonymousOwnershipKeyGuard.js.map +1 -0
  66. package/dist/custom/approvalStamp.d.ts +37 -0
  67. package/dist/custom/approvalStamp.d.ts.map +1 -0
  68. package/dist/custom/approvalStamp.js +67 -0
  69. package/dist/custom/approvalStamp.js.map +1 -0
  70. package/dist/custom/fieldPermissionAccess.d.ts +31 -0
  71. package/dist/custom/fieldPermissionAccess.d.ts.map +1 -0
  72. package/dist/custom/fieldPermissionAccess.js +38 -0
  73. package/dist/custom/fieldPermissionAccess.js.map +1 -0
  74. package/dist/custom/fieldPermissionReconciler.d.ts.map +1 -1
  75. package/dist/custom/fieldPermissionReconciler.js +12 -2
  76. package/dist/custom/fieldPermissionReconciler.js.map +1 -1
  77. package/dist/custom/query-extraction/pipeline.d.ts.map +1 -1
  78. package/dist/custom/query-extraction/pipeline.js +56 -5
  79. package/dist/custom/query-extraction/pipeline.js.map +1 -1
  80. package/dist/custom/query-extraction/resolve.d.ts.map +1 -1
  81. package/dist/custom/query-extraction/resolve.js +25 -7
  82. package/dist/custom/query-extraction/resolve.js.map +1 -1
  83. package/dist/custom/query-extraction/sync.d.ts +1 -1
  84. package/dist/custom/query-extraction/sync.d.ts.map +1 -1
  85. package/dist/custom/query-extraction/sync.js +84 -21
  86. package/dist/custom/query-extraction/sync.js.map +1 -1
  87. package/dist/custom/query-extraction/types.d.ts +7 -0
  88. package/dist/custom/query-extraction/types.d.ts.map +1 -1
  89. package/dist/custom/rowFilterValidation.d.ts +47 -2
  90. package/dist/custom/rowFilterValidation.d.ts.map +1 -1
  91. package/dist/custom/rowFilterValidation.js +122 -11
  92. package/dist/custom/rowFilterValidation.js.map +1 -1
  93. package/dist/custom/systemUserGuardState.d.ts +73 -0
  94. package/dist/custom/systemUserGuardState.d.ts.map +1 -0
  95. package/dist/custom/systemUserGuardState.js +161 -0
  96. package/dist/custom/systemUserGuardState.js.map +1 -0
  97. package/dist/custom/template-extraction/parser.js +5 -2
  98. package/dist/custom/template-extraction/parser.js.map +1 -1
  99. package/dist/custom/template-extraction/pipeline.d.ts +6 -1
  100. package/dist/custom/template-extraction/pipeline.d.ts.map +1 -1
  101. package/dist/custom/template-extraction/pipeline.js +15 -6
  102. package/dist/custom/template-extraction/pipeline.js.map +1 -1
  103. package/dist/custom/template-extraction/types.d.ts +2 -2
  104. package/dist/custom/template-extraction/types.d.ts.map +1 -1
  105. package/dist/index.d.ts +7 -0
  106. package/dist/index.d.ts.map +1 -1
  107. package/dist/index.js +7 -0
  108. package/dist/index.js.map +1 -1
  109. package/package.json +30 -30
@@ -4,25 +4,159 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
4
4
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  };
7
+ var MJUserViewEntityServer_1;
7
8
  import { RegisterClass, CleanAndParseJSON } from "@memberjunction/global";
8
- import { BaseEntity, LogError, ValidationErrorInfo, ValidationErrorType } from "@memberjunction/core";
9
- import { MJUserViewEntityExtended } from '@memberjunction/core-entities';
9
+ import { BaseEntity, ExtractAlternateBaseViewFromDisplayState, LogError, ValidationErrorInfo, ValidationErrorType } from "@memberjunction/core";
10
+ import { ComputeUserViewFingerprintAsync, MJUserViewEntityExtended } from '@memberjunction/core-entities';
10
11
  import { AIPromptParams } from "@memberjunction/ai-core-plus";
11
12
  import { AIEngine } from "@memberjunction/aiengine";
12
13
  import { AIPromptRunner } from "@memberjunction/ai-prompts";
13
- let MJUserViewEntityServer = class MJUserViewEntityServer extends MJUserViewEntityExtended {
14
+ import { ApplyApprovalRulesAsync, ApprovalRefusalResult } from "./approvalStamp.js";
15
+ import { IsClientClauseScreeningProvider } from "@memberjunction/generic-database-provider";
16
+ let MJUserViewEntityServer = MJUserViewEntityServer_1 = class MJUserViewEntityServer extends MJUserViewEntityExtended {
14
17
  /**
15
18
  * This property is hard-coded to true in this class because we DO support smart filters in this class. If you want to disable smart filters for a specific view you can override this property in your subclass and set it to false.
16
19
  */
17
20
  get SmartFilterImplemented() {
18
21
  return true;
19
22
  }
23
+ /**
24
+ * Applies the approval rules (see `ApplyApprovalRulesAsync`). The base save regenerates the
25
+ * WhereClause before it writes, so an approving save stamps the fingerprint after the write,
26
+ * from the definition as stored, with one more write.
27
+ */
28
+ async Save(options) {
29
+ let approving;
30
+ try {
31
+ approving = !options?.ReplayOnly && await ApplyApprovalRulesAsync(this, 'ApprovalStatus', this.ApprovalStatus);
32
+ }
33
+ catch (e) {
34
+ this.RegisterResultHistoryEntry(ApprovalRefusalResult(this, e));
35
+ return false;
36
+ }
37
+ if (!await super.Save(options)) {
38
+ return false;
39
+ }
40
+ if (approving) {
41
+ try {
42
+ this.ApprovedFingerprint = await ComputeUserViewFingerprintAsync(this);
43
+ if (!await super.Save(options)) {
44
+ LogError(`[MJUserViewEntityServer] View "${this.Name}" was approved but its fingerprint was not saved: ${this.LatestResult?.CompleteMessage}`);
45
+ }
46
+ }
47
+ catch (e) {
48
+ LogError(`[MJUserViewEntityServer] View "${this.Name}" was approved but its fingerprint could not be computed: ${e instanceof Error ? e.message : String(e)}`);
49
+ }
50
+ }
51
+ return true;
52
+ }
20
53
  Validate() {
21
54
  const result = super.Validate();
22
55
  this.validateCustomWhereClauseAuthorization(result);
56
+ this.validatePinnedAlternateBaseView(result);
57
+ this.validateStoredClauses(result);
23
58
  result.Success = result.Success && result.Errors.length === 0;
24
59
  return result;
25
60
  }
61
+ /**
62
+ * Validates that a pinned `DisplayState.alternateBaseView` (if newly set or changed)
63
+ * corresponds to a registered, usable alternate base view on the view's target entity.
64
+ * Existing saved views whose pinned alternate base view did not change are allowed to save
65
+ * other edits (e.g. renaming or clearing the pin after an admin disabled the alternate view).
66
+ */
67
+ validatePinnedAlternateBaseView(result) {
68
+ const pinnedName = this.AlternateBaseView;
69
+ if (!pinnedName || !this.ViewEntityInfo) {
70
+ return;
71
+ }
72
+ const smartPromptModified = Boolean(this.SmartFilterEnabled &&
73
+ (this.GetFieldByName('SmartFilterPrompt')?.Dirty === true ||
74
+ this.GetFieldByName('SmartFilterEnabled')?.Dirty === true));
75
+ if (this.IsSaved && !this.hasAlternateBaseViewChanged() && !smartPromptModified) {
76
+ return;
77
+ }
78
+ const abv = this.ViewEntityInfo.GetAlternateBaseView(pinnedName);
79
+ if (!abv) {
80
+ result.Errors.push(new ValidationErrorInfo('DisplayState', `Alternate Base View '${pinnedName}' is not registered on entity '${this.ViewEntityInfo.Name}'.`, pinnedName, ValidationErrorType.Failure));
81
+ }
82
+ else if (!abv.IsUsable) {
83
+ result.Errors.push(new ValidationErrorInfo('DisplayState', `Alternate Base View '${pinnedName}' on entity '${this.ViewEntityInfo.Name}' has status '${abv.Status}' and cannot be used.`, pinnedName, ValidationErrorType.Failure));
84
+ }
85
+ }
86
+ hasAlternateBaseViewChanged() {
87
+ const displayStateField = this.GetFieldByName('DisplayState');
88
+ if (!displayStateField?.Dirty) {
89
+ return false;
90
+ }
91
+ const oldPinned = ExtractAlternateBaseViewFromDisplayState(typeof displayStateField.OldValue === 'string' ? displayStateField.OldValue : null);
92
+ return (oldPinned ?? null) !== (this.AlternateBaseView ?? null);
93
+ }
94
+ /**
95
+ * SECURITY: screens the SQL this view stores with the clause screen the RunView API applies to
96
+ * client filters — its WhereClause (set directly, compiled from FilterState, or made by a Smart
97
+ * Filter) and the ORDER BY built from SortState / GridState. Any user who can save a view can
98
+ * write these, and the provider splices them into view SQL. A CustomWhereClause is left to the
99
+ * Owner gate above. Only a new view or a changed clause is screened here; the provider screens
100
+ * every stored clause again when the view runs. Both use the provider's own screen, so a clause
101
+ * is judged the same way at save and at run.
102
+ */
103
+ validateStoredClauses(result) {
104
+ const changed = (...fields) => !this.IsSaved || fields.some(f => this.GetFieldByName(f)?.Dirty === true);
105
+ if (!this.CustomWhereClause && changed('WhereClause', 'CustomWhereClause')) {
106
+ const where = MJUserViewEntityServer_1.neutralizeViewTemplates(this.WhereClause ?? '');
107
+ this.screenStoredClause(result, 'WhereClause', where, 'view WhereClause');
108
+ }
109
+ const orderBy = changed('SortState', 'GridState') ? this.storedOrderBy() : null;
110
+ if (orderBy) {
111
+ // The provider transforms a stored sort for its platform before running it; screen that form.
112
+ this.screenStoredClause(result, 'SortState', orderBy, 'OrderBy', this.ViewEntityInfo);
113
+ }
114
+ }
115
+ /**
116
+ * The ORDER BY built from SortState / GridState, or null when SortState is not valid JSON. Such
117
+ * a view cannot build an ORDER BY when it runs either, so there is nothing to screen.
118
+ */
119
+ storedOrderBy() {
120
+ try {
121
+ return this.OrderByClause;
122
+ }
123
+ catch {
124
+ return null;
125
+ }
126
+ }
127
+ /**
128
+ * Adds a validation failure on `field` when the provider's client-clause screen refuses `clause`,
129
+ * or when the provider cannot screen (fails closed).
130
+ */
131
+ screenStoredClause(result, field, clause, label, entityInfo) {
132
+ if (!clause.trim())
133
+ return;
134
+ const provider = this.ProviderToUse;
135
+ // When MJUserViewEntityServer is resolved in a mixed-tier process (e.g. CLI test runner)
136
+ // against a Network provider (GraphQLDataProvider), defer SQL AST screening to MJServer's
137
+ // Database provider when the GraphQL mutation executes on the server.
138
+ if (provider && provider.ProviderType === 'Network') {
139
+ return;
140
+ }
141
+ try {
142
+ if (!IsClientClauseScreeningProvider(provider)) {
143
+ throw new Error(`Invalid ${label}: the data provider cannot screen client SQL`);
144
+ }
145
+ provider.ScreenClientClause(clause, label, this.ActiveUser, entityInfo);
146
+ }
147
+ catch (e) {
148
+ const message = e instanceof Error ? e.message : String(e);
149
+ result.Errors.push(new ValidationErrorInfo(field, message, clause, ValidationErrorType.Failure));
150
+ }
151
+ }
152
+ /**
153
+ * A `{%UserView "id"%}` template becomes a subquery only when the view runs, and the provider
154
+ * screens that rendered clause. Here each template stands in as `SELECT NULL` so the rest of
155
+ * the clause can be parsed.
156
+ */
157
+ static neutralizeViewTemplates(whereClause) {
158
+ return whereClause.replace(/{%[^%]+%}/g, 'SELECT NULL');
159
+ }
26
160
  /**
27
161
  * SECURITY gate: `CustomWhereClause = 1` tells the platform to fold the stored
28
162
  * `WhereClause` into view SQL verbatim — it bypasses both the auto-generation in
@@ -39,8 +173,9 @@ let MJUserViewEntityServer = class MJUserViewEntityServer extends MJUserViewEnti
39
173
  }
40
174
  const customDirty = this.GetFieldByName('CustomWhereClause')?.Dirty === true;
41
175
  const whereDirty = this.GetFieldByName('WhereClause')?.Dirty === true;
42
- if (!customDirty && !whereDirty) {
43
- // Neither sensitive field changed on this save — nothing new to authorize.
176
+ // A new record is always authorized: a field first written without NewRecord() seeding it
177
+ // does not read as dirty. On an existing record, only a change needs authorizing.
178
+ if (this.IsSaved && !customDirty && !whereDirty) {
44
179
  return;
45
180
  }
46
181
  const user = this.ContextCurrentUser
@@ -56,6 +191,12 @@ let MJUserViewEntityServer = class MJUserViewEntityServer extends MJUserViewEnti
56
191
  */
57
192
  async GenerateSmartFilterWhereClause(prompt, entityInfo) {
58
193
  try {
194
+ if (this.AlternateBaseView && entityInfo) {
195
+ const pinnedAbv = entityInfo.GetAlternateBaseView(this.AlternateBaseView);
196
+ if (!pinnedAbv || !pinnedAbv.IsUsable) {
197
+ return { whereClause: '', userExplanation: '' };
198
+ }
199
+ }
59
200
  // Ensure AIEngine is configured
60
201
  await AIEngine.Instance.Config(false, this.ContextCurrentUser);
61
202
  // Find the Smart Filter Generation prompt
@@ -129,18 +270,30 @@ let MJUserViewEntityServer = class MJUserViewEntityServer extends MJUserViewEnti
129
270
  * This data is used to populate the Nunjucks template variables.
130
271
  */
131
272
  BuildTemplateData(entityInfo) {
273
+ const pinnedAbv = this.AlternateBaseView
274
+ ? entityInfo.GetAlternateBaseView(this.AlternateBaseView)
275
+ : undefined;
276
+ const effectiveBaseView = pinnedAbv && pinnedAbv.IsUsable ? pinnedAbv.ViewName : entityInfo.BaseView;
132
277
  const processedViews = [entityInfo.BaseView];
278
+ if (effectiveBaseView !== entityInfo.BaseView) {
279
+ processedViews.push(effectiveBaseView);
280
+ }
133
281
  const md = this.ProviderToUse;
134
282
  const listsEntity = md.EntityByName("MJ: Lists");
135
283
  const listDetailsEntity = md.EntityByName("MJ: List Details");
136
284
  // Build fields description
137
- const fieldsDescription = entityInfo.Fields.map(f => {
285
+ let fieldsDescription = entityInfo.Fields.map(f => {
138
286
  let ret = `${f.Name} (${f.Type})`;
139
287
  if (f.RelatedEntity) {
140
288
  ret += ` (fkey to ${f.RelatedEntityBaseView})`;
141
289
  }
142
290
  return ret;
143
291
  }).join(',');
292
+ if (pinnedAbv && pinnedAbv.IsUsable) {
293
+ fieldsDescription +=
294
+ `\n[Base View Context: Reading from alternate base view '${pinnedAbv.EffectiveDisplayName}' (${pinnedAbv.ViewName}): ${pinnedAbv.Description}. ` +
295
+ `Do NOT duplicate conditions already enforced by this base view unless the user explicitly asks to refine them.]`;
296
+ }
144
297
  // Build related views description
145
298
  const relatedViewsDescription = this.BuildRelatedViewsDescription(entityInfo, md, processedViews);
146
299
  // Build lists fields
@@ -151,16 +304,21 @@ let MJUserViewEntityServer = class MJUserViewEntityServer extends MJUserViewEnti
151
304
  const listDetailsFields = listDetailsEntity ? listDetailsEntity.Fields.map(f => {
152
305
  return f.Name + ' (' + f.SQLFullType + ')';
153
306
  }).join(', ') : '';
154
- return {
307
+ const templateData = {
155
308
  entityName: entityInfo.Name,
156
309
  entityId: entityInfo.ID,
157
- baseView: entityInfo.BaseView,
310
+ baseView: effectiveBaseView,
158
311
  fieldsDescription,
159
- relatedViewsDescription: processedViews.length > 1 ? relatedViewsDescription : '',
312
+ relatedViewsDescription: relatedViewsDescription.length > 0 ? relatedViewsDescription : '',
160
313
  listsSchema: listsEntity?.SchemaName || '__mj',
161
314
  listsFields,
162
- listDetailsFields
315
+ listDetailsFields,
163
316
  };
317
+ if (pinnedAbv && pinnedAbv.IsUsable) {
318
+ templateData.alternateBaseViewName = pinnedAbv.Name;
319
+ templateData.alternateBaseViewDescription = pinnedAbv.Description;
320
+ }
321
+ return templateData;
164
322
  }
165
323
  /**
166
324
  * Builds the description of related views for the prompt template.
@@ -199,7 +357,7 @@ let MJUserViewEntityServer = class MJUserViewEntityServer extends MJUserViewEnti
199
357
  return [fkeyViewsDesc, relatedEntitiesDesc].filter(s => s.length > 0).join('\n');
200
358
  }
201
359
  };
202
- MJUserViewEntityServer = __decorate([
360
+ MJUserViewEntityServer = MJUserViewEntityServer_1 = __decorate([
203
361
  RegisterClass(BaseEntity, 'MJ: User Views')
204
362
  ], MJUserViewEntityServer);
205
363
  export { MJUserViewEntityServer };
@@ -1 +1 @@
1
- {"version":3,"file":"MJUserViewEntityServer.server.js","sourceRoot":"","sources":["../../src/custom/MJUserViewEntityServer.server.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC1E,OAAO,EAAE,UAAU,EAAc,QAAQ,EAA+B,mBAAmB,EAAE,mBAAmB,EAAoB,MAAM,sBAAsB,CAAC;AACjK,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAA;AACxE,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OA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,OAAO,GAAG,CAAC;gBACf,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAE,EAAE,CAAC;YACpB,CAAC;YACD,OAAO,EAAE,CAAC;QACd,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAExC,OAAO,CAAC,aAAa,EAAE,mBAAmB,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACrF,CAAC;CACJ,CAAA;AA3YY,sBAAsB;IADlC,aAAa,CAAC,UAAU,EAAE,gBAAgB,CAAC;GAC/B,sBAAsB,CA2YlC"}
@@ -7,20 +7,29 @@ import { MJVectorIndexEntity } from "@memberjunction/core-entities";
7
7
  *
8
8
  * Provisioning is DETACHED from the save that triggers it: the save returns once the metadata row is
9
9
  * written, and the provider call runs afterwards (see {@link Save}). That call is bounded by
10
- * {@link CREATE_INDEX_TIMEOUT_MS}: past it the hook stops waiting, logs, and skips the metadata
11
- * write-back. The provider call itself is abandoned, not cancelled (there is no cancellation handle),
12
- * so the bound limits how long this record's provisioning stays open, not the provider's work.
10
+ * {@link CREATE_INDEX_TIMEOUT_MS}: past it the hook stops waiting and records `timed-out`. The provider
11
+ * call itself is abandoned, not cancelled (there is no cancellation handle), so the bound limits how
12
+ * long this record's provisioning stays open, not the provider's work.
13
13
  * Pinecone's createIndex returns as soon as the request is accepted (we never pass waitUntilReady),
14
14
  * so the bound only ever trips on a hung connection, not on a slow index build.
15
+ *
16
+ * Whatever the outcome, it is written onto the row's `ProviderConfig` as a {@link VectorIndexProvisionState}.
15
17
  */
16
18
  export declare class MJVectorIndexEntityServer extends MJVectorIndexEntity {
17
19
  /** Upper bound on one provider CreateIndex call. */
18
20
  static readonly CREATE_INDEX_TIMEOUT_MS = 60000;
21
+ /** Upper bound on the one embedding call that learns a model's width (see resolveDimensions). */
22
+ static readonly DIMENSION_PROBE_TIMEOUT_MS = 30000;
23
+ /** Width used only when the record has none and the probe cannot answer (OpenAI text-embedding-3-small). */
24
+ static readonly DEFAULT_DIMENSIONS = 1536;
25
+ /** The one string embedded to learn a model's width; its content is irrelevant, only the vector's length is read. */
26
+ private static readonly DIMENSION_PROBE_TEXT;
19
27
  /**
20
28
  * After saving, if this is a new record, create the index in the provider.
21
29
  * The provider call is deliberately NOT awaited: the client only needs the metadata row, and the
22
30
  * request that triggered the save (an "Auto" index from the UI, or the Config page) must not wait
23
- * on the provider. Failures are logged; the record keeps its metadata row either way.
31
+ * on the provider. Save() never throws over provisioning; the outcome is recorded on the row's
32
+ * `ProviderConfig` instead (see {@link createIndexInProvider}).
24
33
  */
25
34
  Save(options?: EntitySaveOptions): Promise<boolean>;
26
35
  /**
@@ -34,9 +43,23 @@ export declare class MJVectorIndexEntityServer extends MJVectorIndexEntity {
34
43
  */
35
44
  private sanitizeIndexName;
36
45
  /**
37
- * Create the index in the vector database provider.
46
+ * The detached half of {@link Save}: provision, then write the outcome onto the row.
47
+ *
48
+ * Before this, a provider that refused (`success: false`), threw, or never answered reached only
49
+ * the server log, and the committed row looked exactly like one with an index behind it. The
50
+ * row's `ProviderConfig` now says which of the {@link VectorIndexProvisionState}s it is in.
51
+ *
52
+ * Keep this name: the integration suite's content-vectorization fixture stubs it by name to keep
53
+ * the provider out of the run.
38
54
  */
39
55
  private createIndexInProvider;
56
+ /**
57
+ * Create the index in the vector database provider and report what happened.
58
+ *
59
+ * Returns rather than logs, so {@link createIndexInProvider} records every outcome the same way.
60
+ * Throws only when the driver throws or the call times out; the caller classifies both.
61
+ */
62
+ private provisionIndexInProvider;
40
63
  /**
41
64
  * Delete the index from the vector database provider.
42
65
  */
@@ -50,14 +73,34 @@ export declare class MJVectorIndexEntityServer extends MJVectorIndexEntity {
50
73
  * Resolve the embedding dimensions to create the provider index at.
51
74
  *
52
75
  * Prefers this index's own `Dimensions` column, which is where the operator states it and what the
53
- * embedding call already honors. Falling straight through to 1536 ignored that column entirely, so
54
- * an index for any other model was created at the wrong width — harmless with providers that don't
55
- * enforce it, and fatal with ones that do: a colocated SQL Server index is a `VECTOR(n)` column, and
56
- * inserting 384-dimension vectors into a `VECTOR(1536)` is rejected outright.
76
+ * embedding call already honors. When the record carries none (every index created from the UI:
77
+ * the Config page's Create Index and the "Vector Index: Auto" path both leave it null, and
78
+ * `MJ: AI Models` has no width column to copy from), the width is learned by embedding one short
79
+ * string with the index's own model and reading the vector's length. Every provider fixes the width
80
+ * at create time, so guessing it wrong gives an index the sync can never write to: a 384-dimension
81
+ * model's vectors are rejected by a `VECTOR(1536)` column or a 1536-wide Pinecone index outright.
57
82
  *
58
- * 1536 (OpenAI text-embedding-3-small) remains the fallback for records that never set it.
83
+ * 1536 (OpenAI text-embedding-3-small) remains the fallback only when the probe cannot run or
84
+ * fails, and the failure is logged so the width can be set by hand. A wrong fallback does not go
85
+ * unnoticed: the vectorize pipeline compares every returned vector against the index's width and
86
+ * refuses the batch before upserting it.
59
87
  */
60
88
  private resolveDimensions;
89
+ /**
90
+ * Embed one short string with this index's embedding model and return the vector's length, or null
91
+ * when there is no model, no user context, or the call fails. `ModelID` is pinned so the answer
92
+ * comes from the model the index is for; the run row is skipped since this is not a real workload.
93
+ */
94
+ private probeModelDimensions;
95
+ /**
96
+ * Resolve the distance metric to request the provider index be created with.
97
+ *
98
+ * `Metric` on this row is what the operator asked for; `cosine` is the fallback. This used to be
99
+ * hardcoded to `cosine` at the call site, which made the `Metric` write-back a tautology: the
100
+ * column simply echoed a constant this file had chosen, so it could never disagree with the
101
+ * provider and could never tell you the provider had done something else.
102
+ */
103
+ private resolveMetric;
61
104
  /**
62
105
  * Resolve `work` or reject after `timeoutMs`, whichever comes first. The timer is cleared when the
63
106
  * work settles, so a fast provider leaves nothing behind. On timeout the provider may still finish
@@ -66,8 +109,37 @@ export declare class MJVectorIndexEntityServer extends MJVectorIndexEntity {
66
109
  private static withTimeout;
67
110
  /**
68
111
  * After provider creates the index, save the returned metadata back to our record.
69
- * Stores ExternalID, Dimensions, Metric, and full provider config as JSON.
112
+ * Stores ExternalID, Dimensions, Metric, the provisioning state, and provider config as JSON.
113
+ *
114
+ * **Provider truth beats our request.** `Dimensions` and `Metric` are read off the provider's
115
+ * own response when it reports them, and only fall back to what we asked for. A provider is
116
+ * free to round, clamp or ignore a requested dimension, and the whole point of these two
117
+ * columns is to be checkable against the embeddings we later generate; a column that can
118
+ * only ever repeat our own request is not a check.
119
+ *
120
+ * A failed write-back is logged rather than recorded: the index exists, and the only way to
121
+ * record anything on the row is the same save that just failed.
70
122
  */
71
123
  private saveProviderMetadata;
124
+ private writeBackFailureMessage;
125
+ /** The provider's own dimension, when it reported a usable one. */
126
+ private readProviderDimension;
127
+ /** The provider's own metric, when it reported a recognized one. */
128
+ private readProviderMetric;
129
+ /**
130
+ * Write the provisioning outcome onto the row, so a row that has no index behind it says so
131
+ * instead of looking identical to one that does.
132
+ *
133
+ * Best-effort by construction: this runs after the caller's save has already returned, and a
134
+ * second failure here must not replace the original diagnosis with a save error.
135
+ */
136
+ private recordProvisionState;
137
+ /** The `provisionState` recorded on `ProviderConfig`, or undefined when there is none or it cannot be read. */
138
+ private readProvisionState;
139
+ /**
140
+ * Merge the provisioning outcome into the existing `ProviderConfig` JSON bag, preserving any
141
+ * driver-specific keys already there (e.g. Pinecone's `namespaceField`).
142
+ */
143
+ private buildProviderConfig;
72
144
  }
73
145
  //# sourceMappingURL=MJVectorIndexEntityServer.server.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"MJVectorIndexEntityServer.server.d.ts","sourceRoot":"","sources":["../../src/custom/MJVectorIndexEntityServer.server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,iBAAiB,EAA0C,MAAM,sBAAsB,CAAC;AAE7G,OAAO,EAAE,mBAAmB,EAA0B,MAAM,+BAA+B,CAAC;AAK5F;;;;;;;;;;;;GAYG;AACH,qBACa,yBAA0B,SAAQ,mBAAmB;IAC9D,oDAAoD;IACpD,gBAAuB,uBAAuB,SAAU;IAExD;;;;;OAKG;IACmB,IAAI,CAAC,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,OAAO,CAAC;IAazE;;OAEG;IACmB,MAAM,IAAI,OAAO,CAAC,OAAO,CAAC;IAShD;;;;OAIG;IACH,OAAO,CAAC,iBAAiB;IAoBzB;;OAEG;YACW,qBAAqB;IA2CnC;;OAEG;YACW,uBAAuB;IAmBrC;;;OAGG;YACW,mBAAmB;IAgDjC;;;;;;;;;;OAUG;IACH,OAAO,CAAC,iBAAiB;IAIzB;;;;OAIG;IACH,OAAO,CAAC,MAAM,CAAC,WAAW;IAe1B;;;OAGG;YACW,oBAAoB;CAiCrC"}
1
+ {"version":3,"file":"MJVectorIndexEntityServer.server.d.ts","sourceRoot":"","sources":["../../src/custom/MJVectorIndexEntityServer.server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,iBAAiB,EAAmD,MAAM,sBAAsB,CAAC;AAEtH,OAAO,EAAE,mBAAmB,EAA0B,MAAM,+BAA+B,CAAC;AA0C5F;;;;;;;;;;;;;;GAcG;AACH,qBACa,yBAA0B,SAAQ,mBAAmB;IAC9D,oDAAoD;IACpD,gBAAuB,uBAAuB,SAAU;IACxD,iGAAiG;IACjG,gBAAuB,0BAA0B,SAAU;IAC3D,4GAA4G;IAC5G,gBAAuB,kBAAkB,QAAQ;IACjD,qHAAqH;IACrH,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,oBAAoB,CAAqB;IAEjE;;;;;;OAMG;IACmB,IAAI,CAAC,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,OAAO,CAAC;IAazE;;OAEG;IACmB,MAAM,IAAI,OAAO,CAAC,OAAO,CAAC;IAShD;;;;OAIG;IACH,OAAO,CAAC,iBAAiB;IAoBzB;;;;;;;;;OASG;YACW,qBAAqB;IAmCnC;;;;;O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