@memberjunction/unit-testing 6.1.0-edge.2 → 6.1.0-edge.4

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.
package/LICENSE CHANGED
@@ -1,7 +1,183 @@
1
- ISC License
1
+ Business Source License 1.1
2
2
 
3
- Copyright (c) 2023 MemberJunction
3
+ License text copyright (c) 2024 MariaDB plc, All Rights Reserved.
4
+ "Business Source License" is a trademark of MariaDB plc.
4
5
 
5
- Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
6
+ -----------------------------------------------------------------------------
6
7
 
7
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
8
+ Parameters
9
+
10
+ Licensor: Blue Cypress, Inc.
11
+
12
+ Licensed Work: MemberJunction.
13
+ The Licensed Work is (c) 2023-2026 Blue Cypress, Inc.
14
+
15
+ Additional Use Grant: Subject to the terms of this License, Licensor grants
16
+ you the following additional rights to make Production
17
+ Use of the Licensed Work.
18
+
19
+ 1. Internal Use
20
+
21
+ You may make production use of the Licensed Work for
22
+ your own internal business or organizational operations.
23
+
24
+ 2. Nonprofit Use
25
+
26
+ If you are a Nonprofit, you may make production use of
27
+ the Licensed Work for the operations and activities of
28
+ your Organizational Family.
29
+
30
+ 3. MemberJunction Certified Program Use
31
+
32
+ If you are authorized by Licensor under the
33
+ MemberJunction Certified Program to provide professional
34
+ services using the Licensed Work, you may make
35
+ production use of the Licensed Work in providing such
36
+ professional services to a client, provided that:
37
+
38
+ (a) the Licensed Work is deployed in, and the applicable
39
+ production use occurs within, an environment owned,
40
+ leased, licensed, subscribed to, or otherwise controlled
41
+ by that client; and
42
+
43
+ (b) the production use is for that client's own internal
44
+ business or organizational operations or is otherwise
45
+ independently permitted to that client under this
46
+ Additional Use Grant.
47
+
48
+ 4. Definitions Applicable to the Additional Use Grant
49
+
50
+ "Affiliate" means, with respect to a specified Person,
51
+ any other Person that directly or indirectly Controls,
52
+ is Controlled by, or is under common Control with such
53
+ specified Person.
54
+
55
+ "Control" (including the terms "Controls," "Controlled
56
+ by," and "under common Control with") means the direct
57
+ or indirect possession of the power to direct or cause
58
+ the direction of the management and policies of a
59
+ Person, whether through ownership of voting interests,
60
+ by contract, or otherwise.
61
+
62
+ "Organizational Family" means, with respect to a Person,
63
+ (a) such Person and its Affiliates, and (b) any
64
+ nonprofit organization, governmental entity, chapter,
65
+ division, local affiliate, regional affiliate, state
66
+ affiliate, national affiliate, or other entity that is
67
+ formally affiliated with such Person through governing
68
+ documents, a charter, bylaws, a membership agreement, or
69
+ another written organizational instrument, and is
70
+ recognized under such documents as part of the same
71
+ organizational structure.
72
+
73
+ "Nonprofit" means a Person recognized by the Internal
74
+ Revenue Service as exempt from federal income taxation
75
+ under Section 501(c)(3), 501(c)(4), 501(c)(5), or
76
+ 501(c)(6) of the Internal Revenue Code, or a foreign
77
+ organization recognized under substantially equivalent
78
+ laws.
79
+
80
+ A Person claiming eligibility as a Nonprofit shall, upon
81
+ Licensor's reasonable request, provide documentation
82
+ reasonably sufficient to demonstrate that it qualifies
83
+ as a Nonprofit. If such Person materially misrepresents,
84
+ or is unable to demonstrate, its qualification as a
85
+ Nonprofit, the rights granted to such Person under
86
+ Section 2 of this Additional Use Grant shall terminate.
87
+
88
+ "MemberJunction Certified Program" means Licensor's
89
+ then-current program for certifying and authorizing a
90
+ Person to provide professional services using the
91
+ Licensed Work.
92
+
93
+ "Person" means any individual, corporation, limited
94
+ liability company, partnership, association, nonprofit
95
+ organization, governmental entity, or other legal or
96
+ organizational entity.
97
+
98
+ Change Date: Four (4) years from the date the Licensed Work is first
99
+ made available.
100
+
101
+ Change License: MIT License.
102
+
103
+ For information about alternative licensing arrangements for the Licensed
104
+ Work, please contact Blue Cypress, Inc.
105
+
106
+ -----------------------------------------------------------------------------
107
+
108
+ Terms
109
+
110
+ The Licensor hereby grants you the right to copy, modify, create derivative
111
+ works, redistribute, and make non-production use of the Licensed Work. The
112
+ Licensor may make an Additional Use Grant, above, permitting limited
113
+ production use.
114
+
115
+ Effective on the Change Date, or the fourth anniversary of the first publicly
116
+ available distribution of a specific version of the Licensed Work under this
117
+ License, whichever comes first, the Licensor hereby grants you rights under
118
+ the terms of the Change License, and the rights granted in the paragraph
119
+ above terminate.
120
+
121
+ If your use of the Licensed Work does not comply with the requirements
122
+ currently in effect as described in this License, you must purchase a
123
+ commercial license from the Licensor, its affiliated entities, or authorized
124
+ resellers, or you must refrain from using the Licensed Work.
125
+
126
+ All copies of the original and modified Licensed Work, and derivative works
127
+ of the Licensed Work, are subject to this License. This License applies
128
+ separately for each version of the Licensed Work and the Change Date may vary
129
+ for each version of the Licensed Work released by Licensor.
130
+
131
+ You must conspicuously display this License on each original or modified copy
132
+ of the Licensed Work. If you receive the Licensed Work in original or
133
+ modified form from a third party, the terms and conditions set forth in this
134
+ License apply to your use of that work.
135
+
136
+ Any use of the Licensed Work in violation of this License will automatically
137
+ terminate your rights under this License for the current and all other
138
+ versions of the Licensed Work.
139
+
140
+ This License does not grant you any right in any trademark or logo of
141
+ Licensor or its affiliates (provided that you may use a trademark or logo of
142
+ Licensor as expressly required by this License).
143
+
144
+ TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON
145
+ AN "AS IS" BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS,
146
+ EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF
147
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
148
+ TITLE.
149
+
150
+ MariaDB hereby grants you permission to use this License's text to license
151
+ your works, and to refer to it using the trademark "Business Source License",
152
+ as long as you comply with the Covenants of Licensor below.
153
+
154
+ -----------------------------------------------------------------------------
155
+
156
+ Covenants of Licensor
157
+
158
+ In consideration of the right to use this License's text and the "Business
159
+ Source License" name and trademark, Licensor covenants to MariaDB, and to all
160
+ other recipients of the licensed work to be provided by Licensor:
161
+
162
+ 1. To specify as the Change License the GPL Version 2.0 or any later version,
163
+ or a license that is compatible with GPL Version 2.0 or a later version,
164
+ where "compatible" means that software provided under the Change License
165
+ can be included in a program with software provided under GPL Version 2.0
166
+ or a later version. Licensor may specify additional Change Licenses without
167
+ limitation.
168
+
169
+ 2. To either: (a) specify an additional grant of rights to use that does not
170
+ impose any additional restriction on the right granted in this License, as
171
+ the Additional Use Grant; or (b) insert the text "None".
172
+
173
+ 3. To specify a Change Date.
174
+
175
+ 4. Not to modify this License in any other way.
176
+
177
+ -----------------------------------------------------------------------------
178
+
179
+ Notice
180
+
181
+ The Business Source License (this document, or the "License") is not an Open
182
+ Source license. However, the Licensed Work will eventually be made available
183
+ under an Open Source License, as stated in this License.
@@ -0,0 +1,144 @@
1
+ /**
2
+ * Realistic AI-metadata catalog fixtures shared across AI-stack unit tests.
3
+ *
4
+ * These mirror the SHAPE and representative VALUES of the production seed data
5
+ * (metadata/ai-vendors, ai-models, ai-model-types, ai-vendor-type-definitions,
6
+ * ai-configurations) so model-selection / failover / execution tests exercise
7
+ * believable catalogs: real driver-class strings (AnthropicLLM / OpenAILLM /
8
+ * GeminiLLM / GroqLLM…), real API names, real PowerRanks, and the multi-vendor /
9
+ * multi-priority layout (a model offered by its developer + several inference
10
+ * providers at different priorities) that selection logic actually has to
11
+ * navigate.
12
+ *
13
+ * The IDs match the real hardcoded seed UUIDs where they are fixed (vendor type
14
+ * definitions, vendors, model types, configurations); model/prompt-model IDs are
15
+ * stable test UUIDs.
16
+ *
17
+ * Pure data only — no vitest/mock coupling. Tests wire these into whatever
18
+ * AIEngine mock their package uses (see the AIPromptRunner suites in
19
+ * packages/AI/Prompts for the reference wiring). Originally proven in
20
+ * packages/AI/Prompts/src/__tests__/__fixtures__/ai-metadata.fixtures.ts and
21
+ * promoted here so every AI package can build a models+vendors+prompts catalog
22
+ * without copying it.
23
+ */
24
+ export declare const VENDOR_TYPE: {
25
+ readonly ModelDeveloper: "10DB468E-F2CE-475D-9F39-2DF2DE75D257";
26
+ readonly InferenceProvider: "5B043EC3-1FF2-4730-B5D2-7CFDA50979B3";
27
+ };
28
+ export declare const VENDOR: {
29
+ readonly OpenAI: "D8A5CCEC-6A37-EF11-86D4-000D3A4E707E";
30
+ readonly Anthropic: "DAA5CCEC-6A37-EF11-86D4-000D3A4E707E";
31
+ readonly Google: "E4A5CCEC-6A37-EF11-86D4-000D3A4E707E";
32
+ readonly Groq: "E3A5CCEC-6A37-EF11-86D4-000D3A4E707E";
33
+ readonly Cerebras: "3EDA433E-F36B-1410-8DB6-00021F8B792E";
34
+ readonly AmazonBedrock: "59FA8F6E-F14C-4874-A69C-BAD794DDC3AA";
35
+ readonly VertexAI: "E41E970D-7D38-45D9-BBFC-4013FF7C5860";
36
+ readonly DeepSeek: "D13D6306-2098-44B8-AEFA-9CE3694335EC";
37
+ readonly xAI: "5483D98F-1F4E-40F4-91FC-EAA8EFDC90F1";
38
+ };
39
+ export declare const MODEL_TYPE: {
40
+ readonly LLM: "E8A5CCEC-6A37-EF11-86D4-000D3A4E707E";
41
+ readonly Embeddings: "EAA5CCEC-6A37-EF11-86D4-000D3A4E707E";
42
+ };
43
+ export declare const CONFIG: {
44
+ readonly Fast: "3A1C5A15-8DAA-44E5-A098-F20085E6C93F";
45
+ readonly Standard: "A76B1550-A6D8-4491-9EF6-A38A8F660FBC";
46
+ readonly HighPower: "B6B9D780-52B2-431B-93AB-AC83FEF78553";
47
+ };
48
+ export declare const MODEL: {
49
+ readonly ClaudeOpus45: "52B79053-6E59-44E9-B7D0-DA96C4EA3CF1";
50
+ readonly ClaudeSonnet45: "7D7C3623-34BC-4DE5-B940-EC09367CFB3E";
51
+ readonly ClaudeHaiku45: "0A1B2C3D-0000-0000-0000-00000000C001";
52
+ readonly GPT5: "0A1B2C3D-0000-0000-0000-00000000G001";
53
+ readonly GPT5Mini: "0A1B2C3D-0000-0000-0000-00000000G002";
54
+ readonly Gemini3Pro: "B7267218-302B-4C09-9875-8DF06AAA1695";
55
+ readonly Gemini3Flash: "7B31F48E-EDA3-47B4-9602-D98B7EB1AF45";
56
+ readonly Qwen3_32B: "C496B988-4EA4-4D7E-A6DD-255F56D93933";
57
+ readonly Llama70B: "0A1B2C3D-0000-0000-0000-00000000L001";
58
+ readonly DeepSeekV4: "DCDD6683-779F-4B03-89B5-746F95BB5293";
59
+ readonly GrokInactive: "8B309C04-F5DC-4619-BA5E-F7A3BD55A41B";
60
+ };
61
+ export interface FxVendorType {
62
+ ID: string;
63
+ Name: string;
64
+ }
65
+ export interface FxVendor {
66
+ ID: string;
67
+ Name: string;
68
+ CredentialTypeID?: string | null;
69
+ }
70
+ export interface FxModelType {
71
+ ID: string;
72
+ Name: string;
73
+ }
74
+ export interface FxConfiguration {
75
+ ID: string;
76
+ Name: string;
77
+ ParentID: string | null;
78
+ Status?: string;
79
+ }
80
+ export interface FxModelVendor {
81
+ ID: string;
82
+ ModelID: string;
83
+ VendorID: string;
84
+ Vendor: string;
85
+ TypeID: string;
86
+ DriverClass: string | null;
87
+ APIName: string | null;
88
+ Priority: number;
89
+ Status: 'Active' | 'Inactive';
90
+ SupportsEffortLevel: boolean | null;
91
+ }
92
+ export interface FxModel {
93
+ ID: string;
94
+ Name: string;
95
+ APIName: string | null;
96
+ DriverClass: string | null;
97
+ Vendor: string;
98
+ AIModelTypeID: string;
99
+ AIModelType: string;
100
+ PowerRank: number;
101
+ IsActive: boolean;
102
+ SupportsEffortLevel: boolean | null;
103
+ ModelVendors: FxModelVendor[];
104
+ }
105
+ export interface FxPromptModel {
106
+ ID: string;
107
+ PromptID: string;
108
+ ModelID: string;
109
+ VendorID: string | null;
110
+ ConfigurationID: string | null;
111
+ Priority: number;
112
+ Status: 'Active' | 'Preview' | 'Inactive';
113
+ EffortLevel: number | null;
114
+ }
115
+ export interface AICatalog {
116
+ vendorTypeDefinitions: FxVendorType[];
117
+ vendors: FxVendor[];
118
+ modelTypes: FxModelType[];
119
+ configurations: FxConfiguration[];
120
+ models: FxModel[];
121
+ modelVendors: FxModelVendor[];
122
+ promptModels: FxPromptModel[];
123
+ }
124
+ export declare function makeModelVendor(p: Partial<FxModelVendor> & {
125
+ ModelID: string;
126
+ VendorID: string;
127
+ }): FxModelVendor;
128
+ export declare function makeModel(p: Partial<FxModel> & {
129
+ ID: string;
130
+ Name: string;
131
+ }): FxModel;
132
+ export declare function makePromptModel(p: Partial<FxPromptModel> & {
133
+ PromptID: string;
134
+ ModelID: string;
135
+ }): FxPromptModel;
136
+ /**
137
+ * Builds a believable production-shaped catalog. Models carry their own
138
+ * ModelVendors array (the real engine attaches this during AdditionalLoading).
139
+ * `promptModels` starts empty — selection tests add the associations they need.
140
+ */
141
+ export declare function buildRealisticCatalog(): AICatalog;
142
+ /** Driver classes that have valid credentials by default in tests (the common LLM providers). */
143
+ export declare const DEFAULT_CONFIGURED_DRIVERS: string[];
144
+ //# sourceMappingURL=catalog-fixtures.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"catalog-fixtures.d.ts","sourceRoot":"","sources":["../../src/ai/catalog-fixtures.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAKH,eAAO,MAAM,WAAW;;;CAGd,CAAC;AAEX,eAAO,MAAM,MAAM;;;;;;;;;;CAUT,CAAC;AAEX,eAAO,MAAM,UAAU;;;CAGb,CAAC;AAEX,eAAO,MAAM,MAAM;;;;CAIT,CA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I,SAAS,CAuIjD;AAED,iGAAiG;AACjG,eAAO,MAAM,0BAA0B,UAEtC,CAAC"}
@@ -0,0 +1,205 @@
1
+ /**
2
+ * Realistic AI-metadata catalog fixtures shared across AI-stack unit tests.
3
+ *
4
+ * These mirror the SHAPE and representative VALUES of the production seed data
5
+ * (metadata/ai-vendors, ai-models, ai-model-types, ai-vendor-type-definitions,
6
+ * ai-configurations) so model-selection / failover / execution tests exercise
7
+ * believable catalogs: real driver-class strings (AnthropicLLM / OpenAILLM /
8
+ * GeminiLLM / GroqLLM…), real API names, real PowerRanks, and the multi-vendor /
9
+ * multi-priority layout (a model offered by its developer + several inference
10
+ * providers at different priorities) that selection logic actually has to
11
+ * navigate.
12
+ *
13
+ * The IDs match the real hardcoded seed UUIDs where they are fixed (vendor type
14
+ * definitions, vendors, model types, configurations); model/prompt-model IDs are
15
+ * stable test UUIDs.
16
+ *
17
+ * Pure data only — no vitest/mock coupling. Tests wire these into whatever
18
+ * AIEngine mock their package uses (see the AIPromptRunner suites in
19
+ * packages/AI/Prompts for the reference wiring). Originally proven in
20
+ * packages/AI/Prompts/src/__tests__/__fixtures__/ai-metadata.fixtures.ts and
21
+ * promoted here so every AI package can build a models+vendors+prompts catalog
22
+ * without copying it.
23
+ */
24
+ // ---------------------------------------------------------------------------
25
+ // Fixed seed UUIDs (match production)
26
+ // ---------------------------------------------------------------------------
27
+ export const VENDOR_TYPE = {
28
+ ModelDeveloper: '10DB468E-F2CE-475D-9F39-2DF2DE75D257',
29
+ InferenceProvider: '5B043EC3-1FF2-4730-B5D2-7CFDA50979B3',
30
+ };
31
+ export const VENDOR = {
32
+ OpenAI: 'D8A5CCEC-6A37-EF11-86D4-000D3A4E707E',
33
+ Anthropic: 'DAA5CCEC-6A37-EF11-86D4-000D3A4E707E',
34
+ Google: 'E4A5CCEC-6A37-EF11-86D4-000D3A4E707E',
35
+ Groq: 'E3A5CCEC-6A37-EF11-86D4-000D3A4E707E',
36
+ Cerebras: '3EDA433E-F36B-1410-8DB6-00021F8B792E',
37
+ AmazonBedrock: '59FA8F6E-F14C-4874-A69C-BAD794DDC3AA',
38
+ VertexAI: 'E41E970D-7D38-45D9-BBFC-4013FF7C5860',
39
+ DeepSeek: 'D13D6306-2098-44B8-AEFA-9CE3694335EC',
40
+ xAI: '5483D98F-1F4E-40F4-91FC-EAA8EFDC90F1',
41
+ };
42
+ export const MODEL_TYPE = {
43
+ LLM: 'E8A5CCEC-6A37-EF11-86D4-000D3A4E707E',
44
+ Embeddings: 'EAA5CCEC-6A37-EF11-86D4-000D3A4E707E',
45
+ };
46
+ export const CONFIG = {
47
+ Fast: '3A1C5A15-8DAA-44E5-A098-F20085E6C93F',
48
+ Standard: 'A76B1550-A6D8-4491-9EF6-A38A8F660FBC',
49
+ HighPower: 'B6B9D780-52B2-431B-93AB-AC83FEF78553',
50
+ };
51
+ // Stable test model UUIDs (real models in prod, fixed IDs here for assertions)
52
+ export const MODEL = {
53
+ ClaudeOpus45: '52B79053-6E59-44E9-B7D0-DA96C4EA3CF1',
54
+ ClaudeSonnet45: '7D7C3623-34BC-4DE5-B940-EC09367CFB3E',
55
+ ClaudeHaiku45: '0A1B2C3D-0000-0000-0000-00000000C001',
56
+ GPT5: '0A1B2C3D-0000-0000-0000-00000000G001',
57
+ GPT5Mini: '0A1B2C3D-0000-0000-0000-00000000G002',
58
+ Gemini3Pro: 'B7267218-302B-4C09-9875-8DF06AAA1695',
59
+ Gemini3Flash: '7B31F48E-EDA3-47B4-9602-D98B7EB1AF45',
60
+ Qwen3_32B: 'C496B988-4EA4-4D7E-A6DD-255F56D93933',
61
+ Llama70B: '0A1B2C3D-0000-0000-0000-00000000L001',
62
+ DeepSeekV4: 'DCDD6683-779F-4B03-89B5-746F95BB5293',
63
+ GrokInactive: '8B309C04-F5DC-4619-BA5E-F7A3BD55A41B',
64
+ };
65
+ // ---------------------------------------------------------------------------
66
+ // Builders
67
+ // ---------------------------------------------------------------------------
68
+ let _mvSeq = 0;
69
+ export function makeModelVendor(p) {
70
+ return {
71
+ ID: p.ID ?? `mv-${++_mvSeq}`,
72
+ Vendor: p.Vendor ?? 'UnknownVendor',
73
+ TypeID: p.TypeID ?? VENDOR_TYPE.InferenceProvider,
74
+ DriverClass: p.DriverClass ?? null,
75
+ APIName: p.APIName ?? null,
76
+ Priority: p.Priority ?? 0,
77
+ Status: p.Status ?? 'Active',
78
+ SupportsEffortLevel: p.SupportsEffortLevel ?? false,
79
+ ModelID: p.ModelID,
80
+ VendorID: p.VendorID,
81
+ };
82
+ }
83
+ export function makeModel(p) {
84
+ return {
85
+ APIName: p.APIName ?? null,
86
+ DriverClass: p.DriverClass ?? null,
87
+ Vendor: p.Vendor ?? '',
88
+ AIModelTypeID: p.AIModelTypeID ?? MODEL_TYPE.LLM,
89
+ AIModelType: p.AIModelType ?? 'LLM',
90
+ PowerRank: p.PowerRank ?? 0,
91
+ IsActive: p.IsActive ?? true,
92
+ SupportsEffortLevel: p.SupportsEffortLevel ?? false,
93
+ ModelVendors: p.ModelVendors ?? [],
94
+ ID: p.ID,
95
+ Name: p.Name,
96
+ };
97
+ }
98
+ export function makePromptModel(p) {
99
+ return {
100
+ ID: p.ID ?? `pm-${p.PromptID}-${p.ModelID}-${p.VendorID ?? 'any'}-${p.ConfigurationID ?? 'null'}`,
101
+ VendorID: p.VendorID ?? null,
102
+ ConfigurationID: p.ConfigurationID ?? null,
103
+ Priority: p.Priority ?? 0,
104
+ Status: p.Status ?? 'Active',
105
+ EffortLevel: p.EffortLevel ?? null,
106
+ PromptID: p.PromptID,
107
+ ModelID: p.ModelID,
108
+ };
109
+ }
110
+ /**
111
+ * Builds a believable production-shaped catalog. Models carry their own
112
+ * ModelVendors array (the real engine attaches this during AdditionalLoading).
113
+ * `promptModels` starts empty — selection tests add the associations they need.
114
+ */
115
+ export function buildRealisticCatalog() {
116
+ const vendorTypeDefinitions = [
117
+ { ID: VENDOR_TYPE.ModelDeveloper, Name: 'Model Developer' },
118
+ { ID: VENDOR_TYPE.InferenceProvider, Name: 'Inference Provider' },
119
+ ];
120
+ const vendors = [
121
+ { ID: VENDOR.OpenAI, Name: 'OpenAI' },
122
+ { ID: VENDOR.Anthropic, Name: 'Anthropic' },
123
+ { ID: VENDOR.Google, Name: 'Google' },
124
+ { ID: VENDOR.Groq, Name: 'Groq' },
125
+ { ID: VENDOR.Cerebras, Name: 'Cerebras' },
126
+ { ID: VENDOR.AmazonBedrock, Name: 'Amazon Bedrock' },
127
+ { ID: VENDOR.VertexAI, Name: 'Vertex AI' },
128
+ { ID: VENDOR.DeepSeek, Name: 'DeepSeek' },
129
+ { ID: VENDOR.xAI, Name: 'x.ai' },
130
+ ];
131
+ const modelTypes = [
132
+ { ID: MODEL_TYPE.LLM, Name: 'LLM' },
133
+ { ID: MODEL_TYPE.Embeddings, Name: 'Embeddings' },
134
+ ];
135
+ // Independent configs by default (matches prod). Inheritance is layered by a
136
+ // dedicated helper so tests opt into chains explicitly.
137
+ const configurations = [
138
+ { ID: CONFIG.Fast, Name: 'Fast', ParentID: null, Status: 'Active' },
139
+ { ID: CONFIG.Standard, Name: 'Standard', ParentID: null, Status: 'Active' },
140
+ { ID: CONFIG.HighPower, Name: 'High Power', ParentID: null, Status: 'Active' },
141
+ ];
142
+ // ---- Models + their vendor offerings ----
143
+ const models = [];
144
+ const modelVendors = [];
145
+ const add = (model, vendors) => {
146
+ model.ModelVendors = vendors;
147
+ models.push(model);
148
+ modelVendors.push(...vendors);
149
+ };
150
+ // Claude 4.5 Opus — Anthropic (developer + inference) + Bedrock (inference, lower priority)
151
+ add(makeModel({ ID: MODEL.ClaudeOpus45, Name: 'Claude 4.5 Opus', Vendor: 'Anthropic', PowerRank: 21, SupportsEffortLevel: true }), [
152
+ makeModelVendor({ ModelID: MODEL.ClaudeOpus45, VendorID: VENDOR.Anthropic, Vendor: 'Anthropic', TypeID: VENDOR_TYPE.ModelDeveloper, Priority: 0 }),
153
+ makeModelVendor({ ModelID: MODEL.ClaudeOpus45, VendorID: VENDOR.Anthropic, Vendor: 'Anthropic', DriverClass: 'AnthropicLLM', APIName: 'claude-opus-4-5-20251101', Priority: 1, SupportsEffortLevel: true }),
154
+ makeModelVendor({ ModelID: MODEL.ClaudeOpus45, VendorID: VENDOR.AmazonBedrock, Vendor: 'Amazon Bedrock', DriverClass: 'BedrockLLM', APIName: 'anthropic.claude-opus-4-5-20251101-v1:0', Priority: 5, SupportsEffortLevel: true }),
155
+ ]);
156
+ // Claude 4.5 Sonnet — Anthropic inference only
157
+ add(makeModel({ ID: MODEL.ClaudeSonnet45, Name: 'Claude 4.5 Sonnet', Vendor: 'Anthropic', PowerRank: 19, SupportsEffortLevel: true }), [
158
+ makeModelVendor({ ModelID: MODEL.ClaudeSonnet45, VendorID: VENDOR.Anthropic, Vendor: 'Anthropic', DriverClass: 'AnthropicLLM', APIName: 'claude-sonnet-4-5-20250929', Priority: 1, SupportsEffortLevel: true }),
159
+ ]);
160
+ // Claude Haiku 4.5 — fast/cheap
161
+ add(makeModel({ ID: MODEL.ClaudeHaiku45, Name: 'Claude Haiku 4.5', Vendor: 'Anthropic', PowerRank: 12, SupportsEffortLevel: true }), [
162
+ makeModelVendor({ ModelID: MODEL.ClaudeHaiku45, VendorID: VENDOR.Anthropic, Vendor: 'Anthropic', DriverClass: 'AnthropicLLM', APIName: 'claude-haiku-4-5', Priority: 1, SupportsEffortLevel: true }),
163
+ ]);
164
+ // GPT-5 — OpenAI + Azure-ish (use OpenAI inference here)
165
+ add(makeModel({ ID: MODEL.GPT5, Name: 'GPT-5', Vendor: 'OpenAI', PowerRank: 20, SupportsEffortLevel: true }), [
166
+ makeModelVendor({ ModelID: MODEL.GPT5, VendorID: VENDOR.OpenAI, Vendor: 'OpenAI', DriverClass: 'OpenAILLM', APIName: 'gpt-5', Priority: 1, SupportsEffortLevel: true }),
167
+ ]);
168
+ // GPT-5 Mini
169
+ add(makeModel({ ID: MODEL.GPT5Mini, Name: 'GPT-5 Mini', Vendor: 'OpenAI', PowerRank: 13 }), [
170
+ makeModelVendor({ ModelID: MODEL.GPT5Mini, VendorID: VENDOR.OpenAI, Vendor: 'OpenAI', DriverClass: 'OpenAILLM', APIName: 'gpt-5-mini', Priority: 1 }),
171
+ ]);
172
+ // Gemini 3 Pro — INACTIVE model (should be excluded from selection)
173
+ add(makeModel({ ID: MODEL.Gemini3Pro, Name: 'Gemini 3 Pro', Vendor: 'Google', PowerRank: 25, IsActive: false }), [
174
+ makeModelVendor({ ModelID: MODEL.Gemini3Pro, VendorID: VENDOR.Google, Vendor: 'Google', DriverClass: 'GeminiLLM', APIName: 'gemini-3-pro', Priority: 1 }),
175
+ ]);
176
+ // Gemini 3 Flash — two inference providers (Google priority 1, Vertex priority 1) + developer rows
177
+ add(makeModel({ ID: MODEL.Gemini3Flash, Name: 'Gemini 3 Flash', Vendor: 'Google', PowerRank: 22 }), [
178
+ makeModelVendor({ ModelID: MODEL.Gemini3Flash, VendorID: VENDOR.Google, Vendor: 'Google', TypeID: VENDOR_TYPE.ModelDeveloper, Priority: 0 }),
179
+ makeModelVendor({ ModelID: MODEL.Gemini3Flash, VendorID: VENDOR.Google, Vendor: 'Google', DriverClass: 'GeminiLLM', APIName: 'gemini-3-flash-preview', Priority: 2 }),
180
+ makeModelVendor({ ModelID: MODEL.Gemini3Flash, VendorID: VENDOR.VertexAI, Vendor: 'Vertex AI', DriverClass: 'VertexLLM', APIName: 'gemini-3-flash-preview', Priority: 1 }),
181
+ ]);
182
+ // Qwen 3 32B — Groq (active, effort) + Cerebras (INACTIVE vendor row) + Alibaba developer
183
+ add(makeModel({ ID: MODEL.Qwen3_32B, Name: 'Qwen 3 32B', Vendor: 'Alibaba Cloud', PowerRank: 11 }), [
184
+ makeModelVendor({ ModelID: MODEL.Qwen3_32B, VendorID: VENDOR.Cerebras, Vendor: 'Cerebras', DriverClass: 'CerebrasLLM', APIName: 'qwen-3-32b', Priority: 0, Status: 'Inactive' }),
185
+ makeModelVendor({ ModelID: MODEL.Qwen3_32B, VendorID: VENDOR.Groq, Vendor: 'Groq', DriverClass: 'GroqLLM', APIName: 'qwen/qwen3-32b', Priority: 1, SupportsEffortLevel: true }),
186
+ ]);
187
+ // Llama 70B on Groq
188
+ add(makeModel({ ID: MODEL.Llama70B, Name: 'Llama 3 70B', Vendor: 'Groq', PowerRank: 9 }), [
189
+ makeModelVendor({ ModelID: MODEL.Llama70B, VendorID: VENDOR.Groq, Vendor: 'Groq', DriverClass: 'GroqLLM', APIName: 'llama-3.3-70b', Priority: 1 }),
190
+ ]);
191
+ // DeepSeek V4
192
+ add(makeModel({ ID: MODEL.DeepSeekV4, Name: 'DeepSeek V4 Pro', Vendor: 'DeepSeek', PowerRank: 15 }), [
193
+ makeModelVendor({ ModelID: MODEL.DeepSeekV4, VendorID: VENDOR.DeepSeek, Vendor: 'DeepSeek', DriverClass: 'DeepSeekLLM', APIName: 'deepseek-v4-pro', Priority: 1 }),
194
+ ]);
195
+ // Grok 4 — INACTIVE model
196
+ add(makeModel({ ID: MODEL.GrokInactive, Name: 'Grok 4', Vendor: 'x.ai', PowerRank: 19, IsActive: false }), [
197
+ makeModelVendor({ ModelID: MODEL.GrokInactive, VendorID: VENDOR.xAI, Vendor: 'x.ai', DriverClass: 'xAILLM', APIName: 'grok-4-0709', Priority: 1 }),
198
+ ]);
199
+ return { vendorTypeDefinitions, vendors, modelTypes, configurations, models, modelVendors, promptModels: [] };
200
+ }
201
+ /** Driver classes that have valid credentials by default in tests (the common LLM providers). */
202
+ export const DEFAULT_CONFIGURED_DRIVERS = [
203
+ 'AnthropicLLM', 'OpenAILLM', 'GeminiLLM', 'VertexLLM', 'GroqLLM', 'BedrockLLM', 'DeepSeekLLM', 'CerebrasLLM', 'xAILLM',
204
+ ];
205
+ //# sourceMappingURL=catalog-fixtures.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"catalog-fixtures.js","sourceRoot":"","sources":["../../src/ai/catalog-fixtures.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,8EAA8E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EAAE,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC;KACnK,CACF,CAAC;IAEF,0BAA0B;IAC1B,GAAG,CACD,SAAS,CAAC,EAAE,EAAE,EAAE,KAAK,CAAC,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,EACrG;QACE,eAAe,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,YAAY,EAAE,QAAQ,EAAE,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC;KACnJ,CACF,CAAC;IAEF,OAAO,EAAE,qBAAqB,EAAE,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,EAAE,YAAY,EAAE,YAAY,EAAE,EAAE,EAAE,CAAC;AAChH,CAAC;AAED,iGAAiG;AACjG,MAAM,CAAC,MAAM,0BAA0B,GAAG;IACxC,cAAc,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,QAAQ;CACvH,CAAC"}
@@ -0,0 +1,90 @@
1
+ /**
2
+ * Factories producing REAL-typed `@memberjunction/ai` chat values for tests.
3
+ *
4
+ * Every value built here uses the real classes and interfaces exported by
5
+ * `@memberjunction/ai` (`ChatResult`, `ChatParams`, `ModelUsage`, `AIErrorInfo`) —
6
+ * never a structural look-alike. Hand-faked shapes silently drift as the real
7
+ * contracts evolve (the exact bug class behind the historical failover bug);
8
+ * building from the real types makes the compiler enforce the contract in test
9
+ * code too.
10
+ */
11
+ import { ChatParams, ChatResult, ModelUsage, type AIErrorInfo } from '@memberjunction/ai';
12
+ /** Overridable scalar fields of {@link ModelUsage} (`totalTokens` / `totalInputTokens` are computed getters). */
13
+ export interface ModelUsageOverrides {
14
+ promptTokens?: number;
15
+ completionTokens?: number;
16
+ /** Pass `undefined` explicitly to opt out of the default cost. */
17
+ cost?: number;
18
+ costCurrency?: string;
19
+ cacheReadTokens?: number;
20
+ cacheWriteTokens?: number;
21
+ queueTime?: number;
22
+ promptTime?: number;
23
+ completionTime?: number;
24
+ }
25
+ /**
26
+ * Builds a real {@link ModelUsage} instance. Defaults: 10 prompt tokens,
27
+ * 5 completion tokens, cost 0.001 — so `totalTokens` is 15 out of the box
28
+ * (the shape the AI-stack tests have standardized on).
29
+ */
30
+ export declare function makeModelUsage(overrides?: ModelUsageOverrides): ModelUsage;
31
+ /** Options for {@link makeSuccessChatResult}. */
32
+ export interface SuccessChatResultOptions {
33
+ usage?: ModelUsage;
34
+ /** API name of the model reported back by the provider (ChatResultData.model). */
35
+ model?: string;
36
+ /** Reasoning-model thinking content attached to the assistant message. */
37
+ thinking?: string;
38
+ finishReason?: string;
39
+ startTime?: Date;
40
+ endTime?: Date;
41
+ }
42
+ /**
43
+ * Builds a successful {@link ChatResult} the way real drivers do: one assistant
44
+ * choice carrying `content`, a real {@link ModelUsage}, `statusText: 'success'`.
45
+ */
46
+ export declare function makeSuccessChatResult(content?: string, options?: SuccessChatResultOptions): ChatResult;
47
+ /** Options for {@link makeFailedChatResult}. */
48
+ export interface FailedChatResultOptions {
49
+ errorMessage?: string;
50
+ /** Leave unset to model an undiagnosed driver failure (no errorInfo at all). */
51
+ errorInfo?: AIErrorInfo;
52
+ exception?: unknown;
53
+ statusText?: string;
54
+ startTime?: Date;
55
+ endTime?: Date;
56
+ /**
57
+ * When true, `data` is left unassigned (some driver failure paths return no
58
+ * data at all). Default builds the empty `{ choices: [], usage }` data that
59
+ * BaseLLM's own error paths produce.
60
+ */
61
+ omitData?: boolean;
62
+ }
63
+ /**
64
+ * Builds a failed {@link ChatResult} (`success: false`). By default the shape
65
+ * mirrors BaseLLM's own error construction: empty choices, zero usage,
66
+ * `statusText: 'error'`. `errorInfo` is only attached when supplied, so tests
67
+ * can model both diagnosed and undiagnosed failures.
68
+ */
69
+ export declare function makeFailedChatResult(options?: FailedChatResultOptions): ChatResult;
70
+ /**
71
+ * Builds a failed {@link ChatResult} exactly the way real provider drivers do:
72
+ * the `errorInfo` comes from the REAL `ErrorAnalyzer`, so `errorType`,
73
+ * `severity`, and `canFailover` match what AnthropicLLM / OpenAILLM / GeminiLLM
74
+ * would report for this error. This is the value to use when testing failover
75
+ * logic — drivers catch provider errors internally and RETURN this shape rather
76
+ * than throwing (the historical failover bug class).
77
+ */
78
+ export declare function makeDriverFailureChatResult(error: Error, providerName?: string): ChatResult;
79
+ /**
80
+ * Builds a real {@link AIErrorInfo} with sensible defaults
81
+ * (`Unknown` / `Retriable` / failover-eligible), overridable per test.
82
+ */
83
+ export declare function makeErrorInfo(overrides?: Partial<AIErrorInfo>): AIErrorInfo;
84
+ /**
85
+ * Builds a real {@link ChatParams} instance (so class-level defaults like
86
+ * `enableCaching` behave exactly as in production) with a default model and a
87
+ * single user message, overridable per test.
88
+ */
89
+ export declare function makeChatParams(overrides?: Partial<ChatParams>): ChatParams;
90
+ //# sourceMappingURL=chat-result-factories.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chat-result-factories.d.ts","sourceRoot":"","sources":["../../src/ai/chat-result-factories.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EACL,UAAU,EACV,UAAU,EAEV,UAAU,EACV,KAAK,WAAW,EAEjB,MAAM,oBAAoB,CAAC;AAE5B,iHAAiH;AACjH,MAAM,WAAW,mBAAmB;IAClC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,kEAAkE;IAClE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,SAAS,CAAC,E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