backend-manager 5.9.21 → 5.9.22
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/package.json +1 -1
- package/src/manager/libraries/ai/providers/openai.js +30 -2
- package/src/manager/libraries/email/data/disposable-domains.json +11 -0
- package/src/test/fixtures/firebase-project/.temp/test-mode.json +1 -1
- package/src/test/fixtures/firebase-project/database-debug.log +4 -8
- package/src/test/fixtures/firebase-project/firestore-debug.log +1 -101
- package/src/test/fixtures/firebase-project/pubsub-debug.log +2 -4
- package/test/helpers/ai-schema-resolve.js +119 -0
package/package.json
CHANGED
|
@@ -390,8 +390,8 @@ OpenAI.prototype.request = function (options) {
|
|
|
390
390
|
// Custom options
|
|
391
391
|
options.dedupeConsecutiveRoles = typeof options.dedupeConsecutiveRoles === 'undefined' ? true : options.dedupeConsecutiveRoles;
|
|
392
392
|
|
|
393
|
-
// Format schema
|
|
394
|
-
options.schema = options.schema
|
|
393
|
+
// Format schema — accept inline object or { path: '...' } to load from a JSON file
|
|
394
|
+
options.schema = resolveSchema(options.schema, _log);
|
|
395
395
|
|
|
396
396
|
// Reasons
|
|
397
397
|
options.reasoning = options.reasoning || undefined;
|
|
@@ -658,6 +658,33 @@ function normalizePrompt(input) {
|
|
|
658
658
|
});
|
|
659
659
|
}
|
|
660
660
|
|
|
661
|
+
function resolveSchema(schema, _log) {
|
|
662
|
+
if (!schema) {
|
|
663
|
+
return undefined;
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
// Already an inline schema object (has "type" or "properties")
|
|
667
|
+
if (!schema.path) {
|
|
668
|
+
return schema;
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
const filePath = schema.path;
|
|
672
|
+
const exists = jetpack.exists(filePath);
|
|
673
|
+
|
|
674
|
+
_log('Reading schema from path:', filePath);
|
|
675
|
+
|
|
676
|
+
if (!exists) {
|
|
677
|
+
throw new Error(`Schema path ${filePath} not found`);
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
if (exists === 'dir') {
|
|
681
|
+
throw new Error(`Schema path ${filePath} is a directory`);
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
const raw = jetpack.read(filePath);
|
|
685
|
+
return JSON5.parse(raw);
|
|
686
|
+
}
|
|
687
|
+
|
|
661
688
|
function loadContent(input, _log) {
|
|
662
689
|
// console.log('*** input!!!', input.content.slice(0, 50), input.path);
|
|
663
690
|
// console.log('*** input.content', input.content.slice(0, 50));
|
|
@@ -1321,5 +1348,6 @@ module.exports._internals = {
|
|
|
1321
1348
|
formatMessages,
|
|
1322
1349
|
normalizeToolEntry,
|
|
1323
1350
|
normalizeToolChoice,
|
|
1351
|
+
resolveSchema,
|
|
1324
1352
|
VALID_PROMPT_ROLES,
|
|
1325
1353
|
};
|
|
@@ -604,6 +604,7 @@
|
|
|
604
604
|
"aminating.com",
|
|
605
605
|
"amiri.net",
|
|
606
606
|
"amiriindustries.com",
|
|
607
|
+
"amiyiy.xyz",
|
|
607
608
|
"amplewe.us",
|
|
608
609
|
"amplifiedwe.us",
|
|
609
610
|
"amplifywe.us",
|
|
@@ -955,6 +956,7 @@
|
|
|
955
956
|
"bbmailku.com",
|
|
956
957
|
"bboys.fr.nf",
|
|
957
958
|
"bbroot.com",
|
|
959
|
+
"bbwg.one",
|
|
958
960
|
"bcaoo.com",
|
|
959
961
|
"bcast.ws",
|
|
960
962
|
"bcb.ro",
|
|
@@ -1249,6 +1251,7 @@
|
|
|
1249
1251
|
"candymail.de",
|
|
1250
1252
|
"cane.pw",
|
|
1251
1253
|
"canfga.org",
|
|
1254
|
+
"cangcud.com",
|
|
1252
1255
|
"cangcutku.pro",
|
|
1253
1256
|
"cantozil.com",
|
|
1254
1257
|
"canvect.com",
|
|
@@ -2369,6 +2372,8 @@
|
|
|
2369
2372
|
"fanclub.pm",
|
|
2370
2373
|
"fandoe.com",
|
|
2371
2374
|
"fangoh.com",
|
|
2375
|
+
"fangxiaobai.us.ci",
|
|
2376
|
+
"fangxiaobai1.us.ci",
|
|
2372
2377
|
"fanicle.com",
|
|
2373
2378
|
"fansworldwide.de",
|
|
2374
2379
|
"fantastu.com",
|
|
@@ -2487,6 +2492,7 @@
|
|
|
2487
2492
|
"flaimenet.ir",
|
|
2488
2493
|
"flameoflovedegree.com",
|
|
2489
2494
|
"flashemail.site",
|
|
2495
|
+
"flatimostore.cloud",
|
|
2490
2496
|
"flavourity.com",
|
|
2491
2497
|
"flayeraaron.eu.cc",
|
|
2492
2498
|
"flayerhu.eu.cc",
|
|
@@ -3159,11 +3165,13 @@
|
|
|
3159
3165
|
"herpderp.nl",
|
|
3160
3166
|
"hertz.ltd",
|
|
3161
3167
|
"hesoyam.shop",
|
|
3168
|
+
"hethongtudong.store",
|
|
3162
3169
|
"hetzez.com",
|
|
3163
3170
|
"heycmm.cn",
|
|
3164
3171
|
"hezll.com",
|
|
3165
3172
|
"hfogzua.top",
|
|
3166
3173
|
"hh7f.com",
|
|
3174
|
+
"hhan.top",
|
|
3167
3175
|
"hhe.org.uk",
|
|
3168
3176
|
"hhyru.us",
|
|
3169
3177
|
"hi2.in",
|
|
@@ -5496,6 +5504,7 @@
|
|
|
5496
5504
|
"premigu.co",
|
|
5497
5505
|
"premirum.shop",
|
|
5498
5506
|
"premium-mail.fr",
|
|
5507
|
+
"premiumonebd.store",
|
|
5499
5508
|
"premsy.net",
|
|
5500
5509
|
"prestige-leadership.org",
|
|
5501
5510
|
"prestore.space",
|
|
@@ -6995,6 +7004,7 @@
|
|
|
6995
7004
|
"ultralux.io.vn",
|
|
6996
7005
|
"ultravex.cfd",
|
|
6997
7006
|
"ultraz1.io.vn",
|
|
7007
|
+
"ultrmigos.online",
|
|
6998
7008
|
"uma3.be",
|
|
6999
7009
|
"umail.net",
|
|
7000
7010
|
"umil.net",
|
|
@@ -7505,6 +7515,7 @@
|
|
|
7505
7515
|
"xdnss.cc",
|
|
7506
7516
|
"xdpxdp.online",
|
|
7507
7517
|
"xehop.org",
|
|
7518
|
+
"xelio.sbs",
|
|
7508
7519
|
"xelu.space",
|
|
7509
7520
|
"xemaps.com",
|
|
7510
7521
|
"xemne.com",
|
|
@@ -2,11 +2,7 @@ WARNING: A terminally deprecated method in sun.misc.Unsafe has been called
|
|
|
2
2
|
WARNING: sun.misc.Unsafe::objectFieldOffset has been called by akka.util.Unsafe (file:/Users/ian/.cache/firebase/emulators/firebase-database-emulator-v4.11.2.jar)
|
|
3
3
|
WARNING: Please consider reporting this to the maintainers of class akka.util.Unsafe
|
|
4
4
|
WARNING: sun.misc.Unsafe::objectFieldOffset will be removed in a future release
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
04:15:02.979 [Thread-0] INFO com.firebase.server.forge.App$ - Attempting graceful shutdown.
|
|
10
|
-
04:15:03.025 [NamespaceSystem-akka.actor.default-dispatcher-7] INFO com.firebase.core.namespace.Terminator$Terminator - 1 actors left to terminate: demo-backend-manager-default-rtdb
|
|
11
|
-
04:15:03.028 [NamespaceSystem-akka.actor.default-dispatcher-5] INFO com.firebase.core.namespace.NamespaceActor - stopped namespace actor for demo-backend-manager-default-rtdb
|
|
12
|
-
04:15:03.034 [Thread-0] INFO com.firebase.server.forge.App$ - Graceful shutdown complete.
|
|
5
|
+
13:42:13.900 [NamespaceSystem-akka.actor.default-dispatcher-5] INFO akka.event.slf4j.Slf4jLogger - Slf4jLogger started
|
|
6
|
+
13:42:14.004 [main] INFO com.firebase.server.forge.App$ - Listening at 127.0.0.1:9000
|
|
7
|
+
13:42:23.201 [Thread-0] INFO com.firebase.server.forge.App$ - Attempting graceful shutdown.
|
|
8
|
+
13:42:23.204 [Thread-0] INFO com.firebase.server.forge.App$ - Graceful shutdown complete.
|
|
@@ -2,7 +2,7 @@ WARNING: A terminally deprecated method in sun.misc.Unsafe has been called
|
|
|
2
2
|
WARNING: sun.misc.Unsafe::allocateMemory has been called by io.netty.util.internal.PlatformDependent0$2 (file:/Users/ian/.cache/firebase/emulators/cloud-firestore-emulator-v1.21.0.jar)
|
|
3
3
|
WARNING: Please consider reporting this to the maintainers of class io.netty.util.internal.PlatformDependent0$2
|
|
4
4
|
WARNING: sun.misc.Unsafe::allocateMemory will be removed in a future release
|
|
5
|
-
Jun
|
|
5
|
+
Jun 28, 2026 1:42:12 PM com.google.cloud.datastore.emulator.firestore.websocket.WebSocketServer start
|
|
6
6
|
INFO: Started WebSocket server on ws://127.0.0.1:9150
|
|
7
7
|
|
|
8
8
|
API endpoint: http://127.0.0.1:8080
|
|
@@ -20,105 +20,5 @@ If you are running a Firestore in Datastore Mode project, run:
|
|
|
20
20
|
Note: Support for Datastore Mode is in preview. If you encounter any bugs please file at https://github.com/firebase/firebase-tools/issues.
|
|
21
21
|
Dev App Server is now running.
|
|
22
22
|
|
|
23
|
-
Jun 27, 2026 4:14:51 AM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
|
|
24
|
-
INFO: Detected non-HTTP/2 connection.
|
|
25
|
-
Jun 27, 2026 4:14:51 AM io.grpc.netty.TcpMetrics loadEpollInfo
|
|
26
|
-
INFO: Epoll available during static init of TcpMetrics:false
|
|
27
|
-
Jun 27, 2026 4:14:51 AM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
|
|
28
|
-
INFO: Detected HTTP/2 connection.
|
|
29
|
-
Jun 27, 2026 4:14:52 AM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
|
|
30
|
-
INFO: Detected HTTP/2 connection.
|
|
31
|
-
Jun 27, 2026 4:14:53 AM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
|
|
32
|
-
INFO: Detected HTTP/2 connection.
|
|
33
|
-
Jun 27, 2026 4:15:00 AM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
|
|
34
|
-
INFO: Detected HTTP/2 connection.
|
|
35
|
-
Jun 27, 2026 4:15:01 AM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
|
|
36
|
-
INFO: Detected HTTP/2 connection.
|
|
37
|
-
Jun 27, 2026 4:15:01 AM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
|
|
38
|
-
INFO: Detected HTTP/2 connection.
|
|
39
|
-
Jun 27, 2026 4:15:01 AM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
|
|
40
|
-
INFO: Detected HTTP/2 connection.
|
|
41
|
-
Jun 27, 2026 4:15:01 AM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
|
|
42
|
-
INFO: Detected HTTP/2 connection.
|
|
43
|
-
Jun 27, 2026 4:15:01 AM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
|
|
44
|
-
INFO: Detected HTTP/2 connection.
|
|
45
|
-
Jun 27, 2026 4:15:01 AM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
|
|
46
|
-
INFO: Detected HTTP/2 connection.
|
|
47
|
-
Jun 27, 2026 4:15:01 AM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
|
|
48
|
-
INFO: Detected HTTP/2 connection.
|
|
49
|
-
Jun 27, 2026 4:15:01 AM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
|
|
50
|
-
INFO: Detected HTTP/2 connection.
|
|
51
|
-
Jun 27, 2026 4:15:01 AM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
|
|
52
|
-
INFO: Detected HTTP/2 connection.
|
|
53
|
-
Jun 27, 2026 4:15:01 AM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
|
|
54
|
-
INFO: Detected HTTP/2 connection.
|
|
55
|
-
Jun 27, 2026 4:15:01 AM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
|
|
56
|
-
INFO: Detected HTTP/2 connection.
|
|
57
|
-
Jun 27, 2026 4:15:01 AM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
|
|
58
|
-
INFO: Detected HTTP/2 connection.
|
|
59
|
-
Jun 27, 2026 4:15:01 AM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
|
|
60
|
-
INFO: Detected HTTP/2 connection.
|
|
61
|
-
Jun 27, 2026 4:15:01 AM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
|
|
62
|
-
INFO: Detected HTTP/2 connection.
|
|
63
|
-
Jun 27, 2026 4:15:01 AM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
|
|
64
|
-
INFO: Detected HTTP/2 connection.
|
|
65
|
-
Jun 27, 2026 4:15:01 AM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
|
|
66
|
-
INFO: Detected HTTP/2 connection.
|
|
67
|
-
Jun 27, 2026 4:15:01 AM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
|
|
68
|
-
INFO: Detected HTTP/2 connection.
|
|
69
|
-
Jun 27, 2026 4:15:01 AM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
|
|
70
|
-
INFO: Detected HTTP/2 connection.
|
|
71
|
-
Jun 27, 2026 4:15:01 AM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
|
|
72
|
-
INFO: Detected HTTP/2 connection.
|
|
73
|
-
Jun 27, 2026 4:15:01 AM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
|
|
74
|
-
INFO: Detected HTTP/2 connection.
|
|
75
|
-
Jun 27, 2026 4:15:01 AM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
|
|
76
|
-
INFO: Detected HTTP/2 connection.
|
|
77
|
-
Jun 27, 2026 4:15:01 AM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
|
|
78
|
-
INFO: Detected HTTP/2 connection.
|
|
79
|
-
Jun 27, 2026 4:15:01 AM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
|
|
80
|
-
INFO: Detected HTTP/2 connection.
|
|
81
|
-
Jun 27, 2026 4:15:01 AM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
|
|
82
|
-
INFO: Detected HTTP/2 connection.
|
|
83
|
-
Jun 27, 2026 4:15:01 AM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
|
|
84
|
-
INFO: Detected HTTP/2 connection.
|
|
85
|
-
Jun 27, 2026 4:15:01 AM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
|
|
86
|
-
INFO: Detected HTTP/2 connection.
|
|
87
|
-
Jun 27, 2026 4:15:01 AM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
|
|
88
|
-
INFO: Detected HTTP/2 connection.
|
|
89
|
-
Jun 27, 2026 4:15:02 AM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
|
|
90
|
-
INFO: Detected HTTP/2 connection.
|
|
91
|
-
Jun 27, 2026 4:15:02 AM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
|
|
92
|
-
INFO: Detected HTTP/2 connection.
|
|
93
|
-
Jun 27, 2026 4:15:02 AM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
|
|
94
|
-
INFO: Detected HTTP/2 connection.
|
|
95
|
-
Jun 27, 2026 4:15:02 AM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
|
|
96
|
-
INFO: Detected HTTP/2 connection.
|
|
97
|
-
Jun 27, 2026 4:15:02 AM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
|
|
98
|
-
INFO: Detected HTTP/2 connection.
|
|
99
|
-
Jun 27, 2026 4:15:02 AM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
|
|
100
|
-
INFO: Detected HTTP/2 connection.
|
|
101
|
-
Jun 27, 2026 4:15:02 AM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
|
|
102
|
-
INFO: Detected HTTP/2 connection.
|
|
103
|
-
Jun 27, 2026 4:15:02 AM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
|
|
104
|
-
INFO: Detected HTTP/2 connection.
|
|
105
|
-
Jun 27, 2026 4:15:02 AM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
|
|
106
|
-
INFO: Detected HTTP/2 connection.
|
|
107
|
-
Jun 27, 2026 4:15:02 AM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
|
|
108
|
-
INFO: Detected HTTP/2 connection.
|
|
109
|
-
Jun 27, 2026 4:15:02 AM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
|
|
110
|
-
INFO: Detected HTTP/2 connection.
|
|
111
|
-
Jun 27, 2026 4:15:02 AM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
|
|
112
|
-
INFO: Detected HTTP/2 connection.
|
|
113
|
-
Jun 27, 2026 4:15:02 AM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
|
|
114
|
-
INFO: Detected HTTP/2 connection.
|
|
115
|
-
Jun 27, 2026 4:15:02 AM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
|
|
116
|
-
INFO: Detected HTTP/2 connection.
|
|
117
|
-
Jun 27, 2026 4:15:02 AM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
|
|
118
|
-
INFO: Detected HTTP/2 connection.
|
|
119
|
-
Jun 27, 2026 4:15:02 AM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
|
|
120
|
-
INFO: Detected HTTP/2 connection.
|
|
121
|
-
Jun 27, 2026 4:15:02 AM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
|
|
122
|
-
INFO: Detected HTTP/2 connection.
|
|
123
23
|
*** shutting down gRPC server since JVM is shutting down
|
|
124
24
|
*** server shut down
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
This is the Google Pub/Sub fake.
|
|
2
2
|
Implementation may be incomplete or differ from the real system.
|
|
3
|
-
Jun
|
|
3
|
+
Jun 28, 2026 1:42:17 PM com.google.cloud.pubsub.testing.v1.Main main
|
|
4
4
|
INFO: IAM integration is disabled. IAM policy methods and ACL checks are not supported
|
|
5
5
|
SLF4J(W): No SLF4J providers were found.
|
|
6
6
|
SLF4J(W): Defaulting to no-operation (NOP) logger implementation
|
|
@@ -9,9 +9,7 @@ WARNING: A terminally deprecated method in sun.misc.Unsafe has been called
|
|
|
9
9
|
WARNING: sun.misc.Unsafe::allocateMemory has been called by io.netty.util.internal.PlatformDependent0$2 (file:/Users/ian/.cache/firebase/emulators/pubsub-emulator-0.8.33/pubsub-emulator/lib/cloud-pubsub-emulator-0.8.33-all.jar)
|
|
10
10
|
WARNING: Please consider reporting this to the maintainers of class io.netty.util.internal.PlatformDependent0$2
|
|
11
11
|
WARNING: sun.misc.Unsafe::allocateMemory will be removed in a future release
|
|
12
|
-
Jun
|
|
12
|
+
Jun 28, 2026 1:42:17 PM com.google.cloud.pubsub.testing.v1.Main main
|
|
13
13
|
INFO: Server started, listening on 8085
|
|
14
|
-
Jun 27, 2026 4:14:51 AM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
|
|
15
|
-
INFO: Detected HTTP/2 connection.
|
|
16
14
|
*** shutting down gRPC server since JVM is shutting down
|
|
17
15
|
*** server shut down
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Test: AI schema resolution (libraries/ai/providers/openai.js)
|
|
3
|
+
*
|
|
4
|
+
* Verifies resolveSchema() — loading JSON Schema from inline objects or file paths.
|
|
5
|
+
*/
|
|
6
|
+
const path = require('path');
|
|
7
|
+
const jetpack = require('fs-jetpack');
|
|
8
|
+
const OpenAI = require('../../src/manager/libraries/ai/providers/openai.js');
|
|
9
|
+
const { resolveSchema } = OpenAI._internals;
|
|
10
|
+
|
|
11
|
+
function noopLog() {}
|
|
12
|
+
|
|
13
|
+
const FIXTURES_DIR = path.join(__dirname, '..', 'fixtures', 'ai-schema');
|
|
14
|
+
const VALID_SCHEMA_PATH = path.join(FIXTURES_DIR, 'valid.json');
|
|
15
|
+
const VALID_SCHEMA = {
|
|
16
|
+
type: 'object',
|
|
17
|
+
properties: {
|
|
18
|
+
name: { type: 'string', description: 'The name' },
|
|
19
|
+
tags: { type: 'array', items: { type: 'string' } },
|
|
20
|
+
},
|
|
21
|
+
required: ['name', 'tags'],
|
|
22
|
+
additionalProperties: false,
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
module.exports = {
|
|
26
|
+
description: 'AI schema resolution (inline vs file path)',
|
|
27
|
+
type: 'group',
|
|
28
|
+
|
|
29
|
+
before() {
|
|
30
|
+
jetpack.dir(FIXTURES_DIR);
|
|
31
|
+
jetpack.write(VALID_SCHEMA_PATH, VALID_SCHEMA);
|
|
32
|
+
jetpack.write(path.join(FIXTURES_DIR, 'invalid.json'), '{ not valid json !!!');
|
|
33
|
+
},
|
|
34
|
+
|
|
35
|
+
after() {
|
|
36
|
+
jetpack.remove(FIXTURES_DIR);
|
|
37
|
+
},
|
|
38
|
+
|
|
39
|
+
tests: [
|
|
40
|
+
{
|
|
41
|
+
name: 'undefined-returns-undefined',
|
|
42
|
+
async run({ assert }) {
|
|
43
|
+
assert.equal(resolveSchema(undefined, noopLog), undefined, 'undefined → undefined');
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
|
|
47
|
+
{
|
|
48
|
+
name: 'null-returns-undefined',
|
|
49
|
+
async run({ assert }) {
|
|
50
|
+
assert.equal(resolveSchema(null, noopLog), undefined, 'null → undefined');
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
|
|
54
|
+
{
|
|
55
|
+
name: 'false-returns-undefined',
|
|
56
|
+
async run({ assert }) {
|
|
57
|
+
assert.equal(resolveSchema(false, noopLog), undefined, 'false → undefined');
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
|
|
61
|
+
{
|
|
62
|
+
name: 'inline-object-returned-as-is',
|
|
63
|
+
async run({ assert }) {
|
|
64
|
+
const inline = { type: 'object', properties: { x: { type: 'string' } } };
|
|
65
|
+
const result = resolveSchema(inline, noopLog);
|
|
66
|
+
assert.deepEqual(result, inline, 'inline schema passed through unchanged');
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
|
|
70
|
+
{
|
|
71
|
+
name: 'path-loads-json-file',
|
|
72
|
+
async run({ assert }) {
|
|
73
|
+
const result = resolveSchema({ path: VALID_SCHEMA_PATH }, noopLog);
|
|
74
|
+
assert.deepEqual(result, VALID_SCHEMA, 'loaded schema matches fixture');
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
|
|
78
|
+
{
|
|
79
|
+
name: 'path-not-found-throws',
|
|
80
|
+
async run({ assert }) {
|
|
81
|
+
let threw = false;
|
|
82
|
+
try {
|
|
83
|
+
resolveSchema({ path: '/nonexistent/schema.json' }, noopLog);
|
|
84
|
+
} catch (e) {
|
|
85
|
+
threw = true;
|
|
86
|
+
assert.equal(e.message.includes('not found'), true, 'error mentions not found');
|
|
87
|
+
}
|
|
88
|
+
assert.equal(threw, true, 'should throw on missing file');
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
|
|
92
|
+
{
|
|
93
|
+
name: 'path-to-directory-throws',
|
|
94
|
+
async run({ assert }) {
|
|
95
|
+
let threw = false;
|
|
96
|
+
try {
|
|
97
|
+
resolveSchema({ path: FIXTURES_DIR }, noopLog);
|
|
98
|
+
} catch (e) {
|
|
99
|
+
threw = true;
|
|
100
|
+
assert.equal(e.message.includes('is a directory'), true, 'error mentions directory');
|
|
101
|
+
}
|
|
102
|
+
assert.equal(threw, true, 'should throw on directory path');
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
|
|
106
|
+
{
|
|
107
|
+
name: 'invalid-json-throws',
|
|
108
|
+
async run({ assert }) {
|
|
109
|
+
let threw = false;
|
|
110
|
+
try {
|
|
111
|
+
resolveSchema({ path: path.join(FIXTURES_DIR, 'invalid.json') }, noopLog);
|
|
112
|
+
} catch (e) {
|
|
113
|
+
threw = true;
|
|
114
|
+
}
|
|
115
|
+
assert.equal(threw, true, 'should throw on invalid JSON');
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
],
|
|
119
|
+
};
|