@memberjunction/predictive-studio 6.2.0-edge.3 → 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 (46) hide show
  1. package/dist/actions/promote-model.action.d.ts +3 -0
  2. package/dist/actions/promote-model.action.d.ts.map +1 -1
  3. package/dist/actions/promote-model.action.js +2 -0
  4. package/dist/actions/promote-model.action.js.map +1 -1
  5. package/dist/actions/promote-model.gate.d.ts.map +1 -1
  6. package/dist/actions/promote-model.gate.js +8 -0
  7. package/dist/actions/promote-model.gate.js.map +1 -1
  8. package/dist/actions/score-record-set.runner.d.ts.map +1 -1
  9. package/dist/actions/score-record-set.runner.js +6 -4
  10. package/dist/actions/score-record-set.runner.js.map +1 -1
  11. package/dist/feature-assembly/data-access.d.ts.map +1 -1
  12. package/dist/feature-assembly/data-access.js +4 -0
  13. package/dist/feature-assembly/data-access.js.map +1 -1
  14. package/dist/operations/promote-model.operation.d.ts.map +1 -1
  15. package/dist/operations/promote-model.operation.js +2 -0
  16. package/dist/operations/promote-model.operation.js.map +1 -1
  17. package/dist/operations/run-feature-pipeline.operation.d.ts +3 -1
  18. package/dist/operations/run-feature-pipeline.operation.d.ts.map +1 -1
  19. package/dist/operations/run-feature-pipeline.operation.js +12 -8
  20. package/dist/operations/run-feature-pipeline.operation.js.map +1 -1
  21. package/dist/scoring/auto-train.d.ts +75 -0
  22. package/dist/scoring/auto-train.d.ts.map +1 -0
  23. package/dist/scoring/auto-train.js +201 -0
  24. package/dist/scoring/auto-train.js.map +1 -0
  25. package/dist/scoring/index.d.ts +2 -0
  26. package/dist/scoring/index.d.ts.map +1 -1
  27. package/dist/scoring/index.js +2 -0
  28. package/dist/scoring/index.js.map +1 -1
  29. package/dist/scoring/ml-model-inference-processor.d.ts +17 -1
  30. package/dist/scoring/ml-model-inference-processor.d.ts.map +1 -1
  31. package/dist/scoring/ml-model-inference-processor.js +59 -11
  32. package/dist/scoring/ml-model-inference-processor.js.map +1 -1
  33. package/dist/scoring/model-readiness.d.ts +51 -0
  34. package/dist/scoring/model-readiness.d.ts.map +1 -0
  35. package/dist/scoring/model-readiness.js +57 -0
  36. package/dist/scoring/model-readiness.js.map +1 -0
  37. package/dist/scoring/register.d.ts +11 -5
  38. package/dist/scoring/register.d.ts.map +1 -1
  39. package/dist/scoring/register.js +9 -6
  40. package/dist/scoring/register.js.map +1 -1
  41. package/dist/scoring/startup-register.d.ts.map +1 -1
  42. package/dist/scoring/startup-register.js +3 -1
  43. package/dist/scoring/startup-register.js.map +1 -1
  44. package/dist/scoring/types.d.ts +61 -0
  45. package/dist/scoring/types.d.ts.map +1 -1
  46. package/package.json +13 -13
@@ -20,7 +20,7 @@
20
20
  * required, so the package stays Predictive-Studio-free.
21
21
  */
22
22
  import { type IRecordProcessor } from '@memberjunction/record-set-processor-base';
23
- import type { MLInferenceDeps, MLModelInferenceProcessorOptions } from './types.js';
23
+ import type { IModelAutoTrainer, MLAutoTrainConfig, MLInferenceDeps, MLModelInferenceProcessorOptions } from './types.js';
24
24
  import type { DatedSourceSpec } from '../feature-assembly/index.js';
25
25
  /**
26
26
  * The set of work-type keys the scoring processor is registered under. A
@@ -55,12 +55,18 @@ export declare function resolveMLInferenceProcessor(workType: string | null | un
55
55
  * the factory), NOT in this config, so the config stays declarative + storable on the Record Process row.
56
56
  */
57
57
  export interface MLScoringConfiguration {
58
- /** The `MJ: ML Models` id this Record Process scores with. */
59
- modelId: string;
58
+ /**
59
+ * The `MJ: ML Models` id this Record Process scores with. May be omitted only when
60
+ * {@link autoTrain} is declared — the first run then trains the pipeline and writes
61
+ * the resulting model id back here.
62
+ */
63
+ modelId?: string;
60
64
  /** Primary-key field on the target entity (defaults to `ID`). */
61
65
  primaryKeyField?: string;
62
66
  /** Optional dated sources supplying point-in-time ("as-of") features. */
63
67
  datedSources?: DatedSourceSpec[];
68
+ /** Opt-in train-if-untrained (see {@link MLAutoTrainConfig}). Off unless declared. */
69
+ autoTrain?: MLAutoTrainConfig;
64
70
  }
65
71
  /**
66
72
  * Register the {@link MLModelInferenceProcessor} into the Record Set Processing
@@ -75,9 +81,9 @@ export interface MLScoringConfiguration {
75
81
  *
76
82
  * @param deps the injected runtime seams the ML scorer needs (model loader, artifact loader, sidecar)
77
83
  */
78
- export declare function RegisterMLScoringProcessor(deps: MLInferenceDeps): void;
84
+ export declare function RegisterMLScoringProcessor(deps: MLInferenceDeps, autoTrainer?: IModelAutoTrainer): void;
79
85
  /** @deprecated Use {@link RegisterMLScoringProcessor}. */
80
- export declare function registerMLScoringProcessor(deps: MLInferenceDeps): void;
86
+ export declare function registerMLScoringProcessor(deps: MLInferenceDeps, autoTrainer?: IModelAutoTrainer): void;
81
87
  /**
82
88
  * Tree-shaking anchor — call from a server bootstrap to guarantee the
83
89
  * `@RegisterClass` registration is not eliminated by the bundler. Referencing the
@@ -1 +1 @@
1
- {"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../src/scoring/register.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAGH,OAAO,EAEL,KAAK,gBAAgB,EAEtB,MAAM,2CAA2C,CAAC;AAOnD,OAAO,KAAK,EAAE,eAAe,EAAE,gCAAgC,EAAE,MAAM,SAAS,CAAC;AACjF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAO3D;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,EAAE,SAAS,MAAM,EAA2D,CAAC;AAEjH;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAElF;AAED,qDAAqD;AACrD,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAElF;AAED;;;;;;;;GAQG;AACH,wBAAgB,2BAA2B,CACzC,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACnC,OAAO,EAAE,g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;GAQG;AACH,wBAAgB,2BAA2B,CACzC,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACnC,OAAO,EAAE,gCAAgC,GACxC,gBAAgB,GAAG,IAAI,CAczB;AAED,2DAA2D;AAC3D,wBAAgB,2BAA2B,CACzC,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACnC,OAAO,EAAE,gCAAgC,GACxC,gBAAgB,GAAG,IAAI,CAEzB;AAED;;;;;GAKG;AACH,MAAM,WAAW,sBAAsB;IACrC;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iEAAiE;IACjE,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,yEAAyE;IACzE,YAAY,CAAC,EAAE,eAAe,EAAE,CAAC;IACjC,sFAAsF;IACtF,SAAS,CAAC,EAAE,iBAAiB,CAAC;CAC/B;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,eAAe,EAAE,WAAW,CAAC,EAAE,iBAAiB,GAAG,IAAI,CAyBvG;AAED,0DAA0D;AAC1D,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,eAAe,EAAE,WAAW,CAAC,EAAE,iBAAiB,GAAG,IAAI,CAEvG;AAED;;;;GAIG;AACH,wBAAgB,6BAA6B,IAAI,IAAI,CAGpD"}
@@ -81,17 +81,20 @@ export function resolveMLInferenceProcessor(workType, options) {
81
81
  *
82
82
  * @param deps the injected runtime seams the ML scorer needs (model loader, artifact loader, sidecar)
83
83
  */
84
- export function RegisterMLScoringProcessor(deps) {
84
+ export function RegisterMLScoringProcessor(deps, autoTrainer) {
85
85
  const factory = (context) => {
86
86
  const config = context.Configuration ? SafeJSONParse(context.Configuration) : undefined;
87
- if (!config || !config.modelId) {
88
- throw new Error(`Record Process '${context.RecordProcessName ?? context.RecordProcessID ?? ''}': WorkType=${context.WorkType} requires a Configuration with a 'modelId'`);
87
+ const autoTrain = config?.autoTrain?.pipelineId ? config.autoTrain : undefined;
88
+ if (!config || (!config.modelId && !autoTrain)) {
89
+ throw new Error(`Record Process '${context.RecordProcessName ?? context.RecordProcessID ?? ''}': WorkType=${context.WorkType} requires a Configuration with a 'modelId' (or an 'autoTrain.pipelineId')`);
89
90
  }
90
91
  const options = {
91
- modelId: config.modelId,
92
+ modelId: config.modelId ?? '',
92
93
  deps,
93
94
  primaryKeyField: config.primaryKeyField,
94
95
  datedSources: config.datedSources,
96
+ autoTrain,
97
+ autoTrainer: autoTrain ? autoTrainer : undefined,
95
98
  };
96
99
  // Resolve through the ClassFactory so a higher-priority subclass registration (if any) wins.
97
100
  return ResolveMLInferenceProcessor(context.WorkType, options) ?? new MLModelInferenceProcessor(options);
@@ -102,8 +105,8 @@ export function RegisterMLScoringProcessor(deps) {
102
105
  }
103
106
  }
104
107
  /** @deprecated Use {@link RegisterMLScoringProcessor}. */
105
- export function registerMLScoringProcessor(deps) {
106
- return RegisterMLScoringProcessor(deps);
108
+ export function registerMLScoringProcessor(deps, autoTrainer) {
109
+ return RegisterMLScoringProcessor(deps, autoTrainer);
107
110
  }
108
111
  /**
109
112
  * Tree-shaking anchor — call from a server bootstrap to guarantee the
@@ -1 +1 @@
1
- {"version":3,"file":"register.js","sourceRoot":"","sources":["../../src/scoring/register.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAChF,OAAO,EACL,uBAAuB,GAGxB,MAAM,2CAA2C,CAAC;AAEnD,OAAO,EACL,yBAAyB,EACzB,sBAAsB,EACtB,4BAA4B,GAC7B,MAAM,gCAAgC,CAAC;AAIxC,kFAAkF;AAClF,gFAAgF;AAChF,6EAA6E;AAC7E,aAAa,CAAC,yBAAyB,EAAE,4BAA4B,CAAC,CAAC,yBAAyB,CAAC,CAAC;AAElG;;;;GAIG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAsB,CAAC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],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAmC,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAClH,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAKvD;;;;;;;;GAQG;AACH,qBAGa,8BAA+B,SAAQ,aAAa,CAAC,8BAA8B,CAAE,YAAW,YAAY;IACvH,iHAAiH;IACjH,WAAkB,QAAQ,IAAI,8BAA8B,CAE3D;IAED;;;;;;;;OAQG;IACU,aAAa,CAAC,YAAY,CAAC,EAAE,QAAQ,EAAE,SAAS,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;CAQlG"}
1
+ {"version":3,"file":"startup-register.d.ts","sourceRoot":"","sources":["../../src/scoring/startup-register.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAmC,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAClH,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAMvD;;;;;;;;GAQG;AACH,qBAGa,8BAA+B,SAAQ,aAAa,CAAC,8BAA8B,CAAE,YAAW,YAAY;IACvH,iHAAiH;IACjH,WAAkB,QAAQ,IAAI,8BAA8B,CAE3D;IAED;;;;;;;;OAQG;IACU,aAAa,CAAC,YAAY,CAAC,EAAE,QAAQ,EAAE,SAAS,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;CASlG"}
@@ -30,6 +30,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
30
30
  import { LogStatusEx, RegisterForStartup } from '@memberjunction/core';
31
31
  import { BaseSingleton } from '@memberjunction/global';
32
32
  import { RegisterMLScoringProcessor } from './register.js';
33
+ import { PipelineAutoTrainer } from './auto-train.js';
33
34
  import { BuildProductionMLInferenceDeps } from '../operations/delegation.js';
34
35
  /**
35
36
  * Startup sink that registers the Predictive Studio `'ML Model'` (and `'MLModelInference'` alias)
@@ -55,7 +56,8 @@ let PredictiveStudioScoringStartup = class PredictiveStudioScoringStartup extend
55
56
  * @param _provider unused — see above
56
57
  */
57
58
  async HandleStartup(_contextUser, _provider) {
58
- RegisterMLScoringProcessor(BuildProductionMLInferenceDeps());
59
+ // The auto-trainer only acts for Record Processes that declare `Configuration.autoTrain`.
60
+ RegisterMLScoringProcessor(BuildProductionMLInferenceDeps(), new PipelineAutoTrainer());
59
61
  // Routine boot registration — only surface it under verbose logging to keep startup quiet.
60
62
  LogStatusEx({
61
63
  message: '[PredictiveStudioScoringStartup] Registered ML Model scoring processor for Record Set Processing.',
@@ -1 +1 @@
1
- {"version":3,"file":"startup-register.js","sourceRoot":"","sources":["../../src/scoring/startup-register.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;;;;;;;AAEH,OAAO,EAAmC,WAAW,EAAE,kBAAkB,EAAY,MAAM,sBAAsB,CAAC;AAClH,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEvD,OAAO,EAAE,0BAA0B,EAAE,MAAM,YAAY,CAAC;AACxD,OAAO,EAAE,8BAA8B,EAAE,MAAM,0BAA0B,CAAC;AAE1E;;;;;;;;GAQG;AAII,IAAM,8BAA8B,GAApC,MAAM,8BAA+B,SAAQ,aAA6C;IAC/F,iHAAiH;IAC1G,MAAM,KAAK,QAAQ;QACxB,OAAO,KAAK,CAAC,WAAW,EAAkC,CAAC;IAC7D,CAAC;IAED;;;;;;;;OAQG;IACI,KAAK,CAAC,aAAa,CAAC,YAAuB,EAAE,SAA6B;QAC/E,0BAA0B,CAAC,8BAA8B,EAAE,CAAC,CAAC;QAC7D,2FAA2F;QAC3F,WAAW,CAAC;YACV,OAAO,EAAE,mGAAmG;YAC5G,WAAW,EAAE,IAAI;SAClB,CAAC,CAAC;IACL,CAAC;CACF,CAAA;AAvBY,8BAA8B;IAH1C,kBAAkB,CAAC;QAClB,WAAW,EAAE,2DAA2D;KACzE,CAAC;GACW,8BAA8B,CAuB1C"}
1
+ {"version":3,"file":"startup-register.js","sourceRoot":"","sources":["../../src/scoring/startup-register.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;;;;;;;AAEH,OAAO,EAAmC,WAAW,EAAE,kBAAkB,EAAY,MAAM,sBAAsB,CAAC;AAClH,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEvD,OAAO,EAAE,0BAA0B,EAAE,MAAM,YAAY,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,8BAA8B,EAAE,MAAM,0BAA0B,CAAC;AAE1E;;;;;;;;GAQG;AAII,IAAM,8BAA8B,GAApC,MAAM,8BAA+B,SAAQ,aAA6C;IAC/F,iHAAiH;IAC1G,MAAM,KAAK,QAAQ;QACxB,OAAO,KAAK,CAAC,WAAW,EAAkC,CAAC;IAC7D,CAAC;IAED;;;;;;;;OAQG;IACI,KAAK,CAAC,aAAa,CAAC,YAAuB,EAAE,SAA6B;QAC/E,0FAA0F;QAC1F,0BAA0B,CAAC,8BAA8B,EAAE,EAAE,IAAI,mBAAmB,EAAE,CAAC,CAAC;QACxF,2FAA2F;QAC3F,WAAW,CAAC;YACV,OAAO,EAAE,mGAAmG;YAC5G,WAAW,EAAE,IAAI;SAClB,CAAC,CAAC;IACL,CAAC;CACF,CAAA;AAxBY,8BAA8B;IAH1C,kBAAkB,CAAC;QAClB,WAAW,EAAE,2DAA2D;KACzE,CAAC;GACW,8BAA8B,CAwB1C"}
@@ -130,6 +130,67 @@ export interface MLModelInferenceProcessorOptions {
130
130
  * model's pipeline uses them. Carried through to the FeatureAssembly executor.
131
131
  */
132
132
  datedSources?: DatedSourceSpec[];
133
+ /**
134
+ * Opt-in **train-if-untrained** behavior (see {@link MLAutoTrainConfig}). When set
135
+ * together with {@link autoTrainer}, a run whose model needs training trains the
136
+ * declared pipeline, publishes the result, repoints the run's Record Process and
137
+ * bindings at it, and then scores — instead of refusing the run. When absent, a
138
+ * model that needs training refuses the run with a clear message.
139
+ */
140
+ autoTrain?: MLAutoTrainConfig;
141
+ /** The trainer that fulfils {@link autoTrain}. Required for auto-train to take effect. */
142
+ autoTrainer?: IModelAutoTrainer;
143
+ }
144
+ /**
145
+ * Opt-in **train-if-untrained** declaration carried in an `'ML Model'` Record
146
+ * Process's `Configuration` (`{ "modelId": "...", "autoTrain": { ... } }`).
147
+ *
148
+ * Why it exists: a trained model artifact is per-host (its bytes live on the server
149
+ * that trained it) and training always creates a NEW immutable model row. So an app
150
+ * that ships a scoring process can't ship a usable model — on a fresh install the
151
+ * model has to be trained there. Declaring `autoTrain` lets the scoring run itself do
152
+ * that, once, with no hand steps. Processes that don't declare it are unaffected.
153
+ */
154
+ export interface MLAutoTrainConfig {
155
+ /** The `MJ: ML Training Pipelines` id to train when the configured model needs training. */
156
+ pipelineId: string;
157
+ /**
158
+ * Optional scoring binding to ensure for the trained model when the process has none
159
+ * yet (bindings that already point at this process are always repointed). Lets an
160
+ * app declare where scores land without shipping a binding row that would have to
161
+ * reference a model id that doesn't exist on a fresh install.
162
+ */
163
+ binding?: {
164
+ /** The target-entity column the process writes the score to (shown by the prediction panel). */
165
+ targetColumn?: string;
166
+ /** Binding mode; defaults to `Scheduled` when the process is scheduled, else `OnDemand`. */
167
+ mode?: 'OnDemand' | 'Scheduled';
168
+ };
169
+ }
170
+ /** Input to {@link IModelAutoTrainer.EnsureTrainedModel}. */
171
+ export interface AutoTrainRequest {
172
+ /** The pipeline to train. */
173
+ pipelineId: string;
174
+ /** The model the process currently points at (may be empty or missing). */
175
+ currentModelId: string | null;
176
+ /** The `MJ: Record Processes` row driving this run, to repoint at the trained model. */
177
+ recordProcessId: string | null;
178
+ /** Optional binding to ensure (see {@link MLAutoTrainConfig.binding}). */
179
+ binding?: MLAutoTrainConfig['binding'];
180
+ }
181
+ /**
182
+ * Seam that turns "this model needs training" into a published, scoreable model.
183
+ * Production: `PipelineAutoTrainer` (train via the real `TrainingEngine`, publish via
184
+ * the promotion gate, repoint the Record Process + bindings). Injected so the
185
+ * processor stays free of training dependencies and is unit-testable.
186
+ */
187
+ export interface IModelAutoTrainer {
188
+ /**
189
+ * Ensure a published, artifact-backed model exists for the pipeline and that the
190
+ * Record Process + its bindings point at it. Returns that model's id.
191
+ * @throws when training or publishing fails (e.g. leakage-flagged model needing sign-off)
192
+ */
193
+ EnsureTrainedModel(request: AutoTrainRequest, contextUser: UserInfo, provider: IMetadataProvider): Promise<string>;
133
194
  }
134
195
  /** Re-export for downstream scoring consumers without reaching into core. */
135
196
  export type { ProblemType };
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/scoring/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACxE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,KAAK,EACV,cAAc,EACd,eAAe,EACf,kBAAkB,EAClB,mBAAmB,EACnB,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,gBAAgB,EAChB,aAAa,EACd,MAAM,wCAAwC,CAAC;AAEhD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAE3D;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B;;;;;;OAMG;IACH,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,QAAQ,EAAE,QAAQ,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,CAAC;CACnH;AAED;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B;;;;;;OAMG;IACH,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,C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AAED,6DAA6D;AAC7D,MAAM,WAAW,gBAAgB;IAC/B,6BAA6B;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,2EAA2E;IAC3E,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,wFAAwF;IACxF,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,0EAA0E;IAC1E,OAAO,CAAC,EAAE,iBAAiB,CAAC,SAAS,CAAC,CAAC;CACxC;AAED;;;;;GAKG;AACH,MAAM,WAAW,iBAAiB;IAChC;;;;OAIG;IACH,kBAAkB,CAAC,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,iBAAiB,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CACpH;AAED,6EAA6E;AAC7E,YAAY,EAAE,WAAW,EAAE,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@memberjunction/predictive-studio",
3
3
  "type": "module",
4
- "version": "6.2.0-edge.3",
4
+ "version": "6.2.0-edge.5",
5
5
  "description": "MemberJunction: Predictive Studio server-side engine (feature assembly, training, inference, experiment orchestration)",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -11,18 +11,18 @@
11
11
  "author": "MemberJunction.com",
12
12
  "license": "BUSL-1.1",
13
13
  "dependencies": {
14
- "@memberjunction/actions": "6.2.0-edge.3",
15
- "@memberjunction/actions-base": "6.2.0-edge.3",
16
- "@memberjunction/ai": "6.2.0-edge.3",
17
- "@memberjunction/ai-agents": "6.2.0-edge.3",
18
- "@memberjunction/ai-core-plus": "6.2.0-edge.3",
19
- "@memberjunction/core": "6.2.0-edge.3",
20
- "@memberjunction/core-entities": "6.2.0-edge.3",
21
- "@memberjunction/global": "6.2.0-edge.3",
22
- "@memberjunction/predictive-studio-core": "6.2.0-edge.3",
23
- "@memberjunction/predictive-studio-sidecar": "6.2.0-edge.3",
24
- "@memberjunction/record-set-processor": "6.2.0-edge.3",
25
- "@memberjunction/record-set-processor-base": "6.2.0-edge.3",
14
+ "@memberjunction/actions": "6.2.0-edge.5",
15
+ "@memberjunction/actions-base": "6.2.0-edge.5",
16
+ "@memberjunction/ai": "6.2.0-edge.5",
17
+ "@memberjunction/ai-agents": "6.2.0-edge.5",
18
+ "@memberjunction/ai-core-plus": "6.2.0-edge.5",
19
+ "@memberjunction/core": "6.2.0-edge.5",
20
+ "@memberjunction/core-entities": "6.2.0-edge.5",
21
+ "@memberjunction/global": "6.2.0-edge.5",
22
+ "@memberjunction/predictive-studio-core": "6.2.0-edge.5",
23
+ "@memberjunction/predictive-studio-sidecar": "6.2.0-edge.5",
24
+ "@memberjunction/record-set-processor": "6.2.0-edge.5",
25
+ "@memberjunction/record-set-processor-base": "6.2.0-edge.5",
26
26
  "rxjs": "^7.8.2"
27
27
  },
28
28
  "devDependencies": {