@jskit-ai/kernel 0.1.62 → 0.1.64
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/client/appConfig.js +16 -2
- package/client/appConfig.test.js +71 -0
- package/client/index.d.ts +24 -0
- package/client/index.js +2 -1
- package/client/mobileLaunchRouting.js +231 -0
- package/client/mobileLaunchRouting.test.js +230 -0
- package/client/shellBootstrap.js +15 -0
- package/client/shellBootstrap.test.js +4 -0
- package/package.json +1 -1
- package/server/http/lib/kernel.test.js +71 -0
- package/server/http/lib/routeRegistration.js +4 -3
- package/server/http/lib/router.js +28 -10
- package/server/support/appConfig.js +93 -2
- package/server/support/appConfig.test.js +102 -1
- package/server/support/appConfigFiles.js +26 -8
- package/server/support/appConfigFiles.test.js +25 -1
- package/server/support/index.js +2 -2
- package/shared/support/normalize.js +92 -0
- package/shared/support/normalize.test.js +112 -0
- package/test/barrelExposure.test.js +4 -0
|
@@ -8,6 +8,8 @@ import {
|
|
|
8
8
|
normalizeFiniteNumber,
|
|
9
9
|
normalizeIfInSource,
|
|
10
10
|
normalizeIfPresent,
|
|
11
|
+
normalizeMobileCallbackPath,
|
|
12
|
+
normalizeMobileConfig,
|
|
11
13
|
normalizeOrNull,
|
|
12
14
|
normalizeRecordId,
|
|
13
15
|
normalizeOpaqueId,
|
|
@@ -212,3 +214,113 @@ test("normalizeUniqueTextList trims, dedupes, and supports optional single value
|
|
|
212
214
|
["one"]
|
|
213
215
|
);
|
|
214
216
|
});
|
|
217
|
+
|
|
218
|
+
test("normalizeMobileCallbackPath normalizes auth callback paths", () => {
|
|
219
|
+
assert.equal(normalizeMobileCallbackPath("auth/login"), "/auth/login");
|
|
220
|
+
assert.equal(normalizeMobileCallbackPath("/auth/login"), "/auth/login");
|
|
221
|
+
assert.equal(
|
|
222
|
+
normalizeMobileCallbackPath("", {
|
|
223
|
+
fallback: "/login/callback"
|
|
224
|
+
}),
|
|
225
|
+
"/login/callback"
|
|
226
|
+
);
|
|
227
|
+
});
|
|
228
|
+
|
|
229
|
+
test("normalizeMobileConfig normalizes the mobile config contract", () => {
|
|
230
|
+
const mobileConfig = normalizeMobileConfig({
|
|
231
|
+
enabled: true,
|
|
232
|
+
strategy: " Capacitor ",
|
|
233
|
+
appId: "com.example.convict",
|
|
234
|
+
appName: "Convict",
|
|
235
|
+
assetMode: " dev_server ",
|
|
236
|
+
devServerUrl: " http://192.168.1.10:5173 ",
|
|
237
|
+
apiBaseUrl: " https://api.example.com ",
|
|
238
|
+
auth: {
|
|
239
|
+
callbackPath: "auth/login",
|
|
240
|
+
customScheme: " Convict ",
|
|
241
|
+
appLinkDomains: ["App.Example.com", " app.example.com "]
|
|
242
|
+
},
|
|
243
|
+
android: {
|
|
244
|
+
packageName: "com.example.convict",
|
|
245
|
+
minSdk: "28",
|
|
246
|
+
targetSdk: "35",
|
|
247
|
+
versionCode: "4",
|
|
248
|
+
versionName: "2.0.0"
|
|
249
|
+
}
|
|
250
|
+
});
|
|
251
|
+
|
|
252
|
+
assert.deepEqual(mobileConfig, {
|
|
253
|
+
enabled: true,
|
|
254
|
+
strategy: "capacitor",
|
|
255
|
+
appId: "com.example.convict",
|
|
256
|
+
appName: "Convict",
|
|
257
|
+
assetMode: "dev_server",
|
|
258
|
+
devServerUrl: "http://192.168.1.10:5173",
|
|
259
|
+
apiBaseUrl: "https://api.example.com",
|
|
260
|
+
auth: {
|
|
261
|
+
callbackPath: "/auth/login",
|
|
262
|
+
customScheme: "convict",
|
|
263
|
+
appLinkDomains: ["app.example.com"]
|
|
264
|
+
},
|
|
265
|
+
android: {
|
|
266
|
+
packageName: "com.example.convict",
|
|
267
|
+
minSdk: 28,
|
|
268
|
+
targetSdk: 35,
|
|
269
|
+
versionCode: 4,
|
|
270
|
+
versionName: "2.0.0"
|
|
271
|
+
}
|
|
272
|
+
});
|
|
273
|
+
});
|
|
274
|
+
|
|
275
|
+
test("normalizeMobileConfig applies defaults for missing fields", () => {
|
|
276
|
+
const mobileConfig = normalizeMobileConfig({
|
|
277
|
+
auth: {
|
|
278
|
+
appLinkDomains: "app.example.com"
|
|
279
|
+
},
|
|
280
|
+
android: {
|
|
281
|
+
minSdk: "bad",
|
|
282
|
+
targetSdk: 0,
|
|
283
|
+
versionCode: "",
|
|
284
|
+
versionName: ""
|
|
285
|
+
}
|
|
286
|
+
});
|
|
287
|
+
|
|
288
|
+
assert.deepEqual(mobileConfig, {
|
|
289
|
+
enabled: false,
|
|
290
|
+
strategy: "",
|
|
291
|
+
appId: "",
|
|
292
|
+
appName: "",
|
|
293
|
+
assetMode: "bundled",
|
|
294
|
+
devServerUrl: "",
|
|
295
|
+
apiBaseUrl: "",
|
|
296
|
+
auth: {
|
|
297
|
+
callbackPath: "/auth/login",
|
|
298
|
+
customScheme: "",
|
|
299
|
+
appLinkDomains: ["app.example.com"]
|
|
300
|
+
},
|
|
301
|
+
android: {
|
|
302
|
+
packageName: "",
|
|
303
|
+
minSdk: 26,
|
|
304
|
+
targetSdk: 35,
|
|
305
|
+
versionCode: 1,
|
|
306
|
+
versionName: "1.0.0"
|
|
307
|
+
}
|
|
308
|
+
});
|
|
309
|
+
});
|
|
310
|
+
|
|
311
|
+
test("normalizeMobileConfig preserves explicit false values from string input", () => {
|
|
312
|
+
const mobileConfig = normalizeMobileConfig({
|
|
313
|
+
enabled: "false"
|
|
314
|
+
});
|
|
315
|
+
|
|
316
|
+
assert.equal(mobileConfig.enabled, false);
|
|
317
|
+
});
|
|
318
|
+
|
|
319
|
+
test("normalizeMobileConfig rejects invalid assetMode values", () => {
|
|
320
|
+
assert.throws(
|
|
321
|
+
() => normalizeMobileConfig({
|
|
322
|
+
assetMode: "weird"
|
|
323
|
+
}),
|
|
324
|
+
/config\.mobile\.assetMode must be "bundled" or "dev_server"\./u
|
|
325
|
+
);
|
|
326
|
+
});
|
|
@@ -83,7 +83,11 @@ const BARREL_EXPECTATIONS = Object.freeze([
|
|
|
83
83
|
"bootstrapClientShellApp",
|
|
84
84
|
"createComponentInteractionEmitter",
|
|
85
85
|
"createShellRouter",
|
|
86
|
+
"resolveClientAssetMode",
|
|
86
87
|
"getClientAppConfig",
|
|
88
|
+
"normalizeIncomingAppUrl",
|
|
89
|
+
"registerMobileLaunchRouting",
|
|
90
|
+
"resolveMobileConfig",
|
|
87
91
|
"resolveClientBootstrapDebugEnabled"
|
|
88
92
|
])
|
|
89
93
|
}),
|