cursedbelt-core 1.0.0
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 +15 -0
- package/dist/client/wsWire.d.ts +49 -0
- package/dist/client/wsWire.js +57 -0
- package/dist/config/appConfig.d.ts +361 -0
- package/dist/config/appConfig.js +308 -0
- package/dist/core/activity/index.d.ts +8 -0
- package/dist/core/activity/index.js +7 -0
- package/dist/core/activity/model.d.ts +115 -0
- package/dist/core/activity/model.js +63 -0
- package/dist/core/analytics/index.d.ts +18 -0
- package/dist/core/analytics/index.js +18 -0
- package/dist/core/analytics/range.d.ts +186 -0
- package/dist/core/analytics/range.js +271 -0
- package/dist/core/analytics/schedule.d.ts +301 -0
- package/dist/core/analytics/schedule.js +372 -0
- package/dist/core/category/index.d.ts +3 -0
- package/dist/core/category/index.js +6 -0
- package/dist/core/category/memoryStore.d.ts +21 -0
- package/dist/core/category/memoryStore.js +97 -0
- package/dist/core/category/tree.d.ts +26 -0
- package/dist/core/category/tree.js +113 -0
- package/dist/core/category/types.d.ts +48 -0
- package/dist/core/category/types.js +8 -0
- package/dist/core/color.d.ts +14 -0
- package/dist/core/color.js +32 -0
- package/dist/core/colorScheme/colorSchemeStore.d.ts +70 -0
- package/dist/core/colorScheme/colorSchemeStore.js +123 -0
- package/dist/core/colorScheme/index.d.ts +7 -0
- package/dist/core/colorScheme/index.js +7 -0
- package/dist/core/domainOwners.d.ts +19 -0
- package/dist/core/domainOwners.js +15 -0
- package/dist/core/download.d.ts +14 -0
- package/dist/core/download.js +37 -0
- package/dist/core/events/ccEventBus.d.ts +44 -0
- package/dist/core/events/ccEventBus.js +70 -0
- package/dist/core/file-tree/fileTreeModel.d.ts +276 -0
- package/dist/core/file-tree/fileTreeModel.js +312 -0
- package/dist/core/folder-tree/actions.d.ts +84 -0
- package/dist/core/folder-tree/actions.js +119 -0
- package/dist/core/folder-tree/index.d.ts +3 -0
- package/dist/core/folder-tree/index.js +20 -0
- package/dist/core/folder-tree/path.d.ts +76 -0
- package/dist/core/folder-tree/path.js +146 -0
- package/dist/core/folder-tree/tree.d.ts +86 -0
- package/dist/core/folder-tree/tree.js +184 -0
- package/dist/core/layout/index.d.ts +1 -0
- package/dist/core/layout/index.js +7 -0
- package/dist/core/master-lock/index.d.ts +14 -0
- package/dist/core/master-lock/index.js +14 -0
- package/dist/core/master-lock/kdf.d.ts +63 -0
- package/dist/core/master-lock/kdf.js +117 -0
- package/dist/core/master-lock/policy.d.ts +32 -0
- package/dist/core/master-lock/policy.js +52 -0
- package/dist/core/master-lock/presence.d.ts +52 -0
- package/dist/core/master-lock/presence.js +61 -0
- package/dist/core/master-lock/wire.d.ts +139 -0
- package/dist/core/master-lock/wire.js +81 -0
- package/dist/core/media/bgRemoval.d.ts +27 -0
- package/dist/core/media/bgRemoval.js +101 -0
- package/dist/core/media/ffmpeg.d.ts +57 -0
- package/dist/core/media/ffmpeg.js +126 -0
- package/dist/core/media/format.d.ts +20 -0
- package/dist/core/media/format.js +54 -0
- package/dist/core/media/index.d.ts +12 -0
- package/dist/core/media/index.js +18 -0
- package/dist/core/media/mediaItem.d.ts +15 -0
- package/dist/core/media/mediaItem.js +34 -0
- package/dist/core/media/renderPlan.d.ts +63 -0
- package/dist/core/media/renderPlan.js +232 -0
- package/dist/core/media/segment.d.ts +79 -0
- package/dist/core/media/segment.js +247 -0
- package/dist/core/media/size.d.ts +1 -0
- package/dist/core/media/size.js +3 -0
- package/dist/core/media/trim.d.ts +21 -0
- package/dist/core/media/trim.js +40 -0
- package/dist/core/media/types.d.ts +148 -0
- package/dist/core/media/types.js +11 -0
- package/dist/core/media/uploadLimits.d.ts +7 -0
- package/dist/core/media/uploadLimits.js +16 -0
- package/dist/core/media/validate.d.ts +9 -0
- package/dist/core/media/validate.js +121 -0
- package/dist/core/media/videoCuts.d.ts +152 -0
- package/dist/core/media/videoCuts.js +284 -0
- package/dist/core/navigation/breadcrumbCompat.d.ts +24 -0
- package/dist/core/navigation/breadcrumbCompat.js +21 -0
- package/dist/core/navigation/coverageTest.d.ts +24 -0
- package/dist/core/navigation/coverageTest.js +48 -0
- package/dist/core/navigation/index.d.ts +6 -0
- package/dist/core/navigation/index.js +10 -0
- package/dist/core/navigation/migrateNavPreferences.d.ts +55 -0
- package/dist/core/navigation/migrateNavPreferences.js +63 -0
- package/dist/core/navigation/navigationModel.d.ts +165 -0
- package/dist/core/navigation/navigationModel.js +14 -0
- package/dist/core/navigation/navigationSelectors.d.ts +63 -0
- package/dist/core/navigation/navigationSelectors.js +167 -0
- package/dist/core/navigation/searchCatalogue.d.ts +23 -0
- package/dist/core/navigation/searchCatalogue.js +76 -0
- package/dist/core/net/reconnectSchedule.d.ts +46 -0
- package/dist/core/net/reconnectSchedule.js +38 -0
- package/dist/core/palette/ShortcutRegistry.d.ts +33 -0
- package/dist/core/palette/ShortcutRegistry.js +52 -0
- package/dist/core/palette/fuzzyRank.d.ts +18 -0
- package/dist/core/palette/fuzzyRank.js +73 -0
- package/dist/core/palette/hotkeys.d.ts +28 -0
- package/dist/core/palette/hotkeys.js +118 -0
- package/dist/core/palette/index.d.ts +3 -0
- package/dist/core/palette/index.js +8 -0
- package/dist/core/schema/projection.d.ts +84 -0
- package/dist/core/schema/projection.js +184 -0
- package/dist/core/session/claims.d.ts +145 -0
- package/dist/core/session/claims.js +157 -0
- package/dist/core/sharing/index.d.ts +5 -0
- package/dist/core/sharing/index.js +4 -0
- package/dist/core/sharing/model.d.ts +195 -0
- package/dist/core/sharing/model.js +150 -0
- package/dist/core/site/siteCopy.d.ts +92 -0
- package/dist/core/site/siteCopy.js +91 -0
- package/dist/core/slots.d.ts +22 -0
- package/dist/core/slots.js +31 -0
- package/dist/core/styles/constructableSheet.d.ts +51 -0
- package/dist/core/styles/constructableSheet.js +80 -0
- package/dist/core/tokens/registry.d.ts +119 -0
- package/dist/core/tokens/registry.js +447 -0
- package/dist/core/uiScale/index.d.ts +8 -0
- package/dist/core/uiScale/index.js +8 -0
- package/dist/core/uiScale/scale.d.ts +36 -0
- package/dist/core/uiScale/scale.js +47 -0
- package/dist/core/uiScale/uiScaleStore.d.ts +47 -0
- package/dist/core/uiScale/uiScaleStore.js +63 -0
- package/dist/core/wire/__fixtures__/rowsMarshalWorker.d.ts +1 -0
- package/dist/core/wire/__fixtures__/rowsMarshalWorker.js +23 -0
- package/dist/core/wire/index.d.ts +17 -0
- package/dist/core/wire/index.js +17 -0
- package/dist/core/wire/ingress.d.ts +44 -0
- package/dist/core/wire/ingress.js +134 -0
- package/dist/core/wire/marshalWorker.d.ts +70 -0
- package/dist/core/wire/marshalWorker.js +273 -0
- package/dist/core/wire/marshalling.d.ts +122 -0
- package/dist/core/wire/marshalling.js +126 -0
- package/dist/core/wire/wireHub.d.ts +80 -0
- package/dist/core/wire/wireHub.js +116 -0
- package/dist/ctgr/base64url.d.ts +8 -0
- package/dist/ctgr/base64url.js +39 -0
- package/dist/ctgr/chunkAccumulator.d.ts +214 -0
- package/dist/ctgr/chunkAccumulator.js +307 -0
- package/dist/ctgr/chunkStore.d.ts +24 -0
- package/dist/ctgr/chunkStore.js +125 -0
- package/dist/ctgr/codec.d.ts +44 -0
- package/dist/ctgr/codec.js +153 -0
- package/dist/ctgr/compress.d.ts +2 -0
- package/dist/ctgr/compress.js +20 -0
- package/dist/ctgr/crc32.d.ts +2 -0
- package/dist/ctgr/crc32.js +23 -0
- package/dist/ctgr/digest.d.ts +1 -0
- package/dist/ctgr/digest.js +15 -0
- package/dist/ctgr/index.d.ts +9 -0
- package/dist/ctgr/index.js +17 -0
- package/dist/ctgr/types.d.ts +64 -0
- package/dist/ctgr/types.js +21 -0
- package/dist/ctgr/v0compat.d.ts +27 -0
- package/dist/ctgr/v0compat.js +128 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +17 -0
- package/dist/shared/errors.d.ts +101 -0
- package/dist/shared/errors.js +99 -0
- package/dist/testing/bytes.d.ts +32 -0
- package/dist/testing/bytes.js +33 -0
- package/dist/testing/domInspect.d.ts +59 -0
- package/dist/testing/domInspect.js +115 -0
- package/dist/testing/fakeFetch.d.ts +23 -0
- package/dist/testing/fakeFetch.js +21 -0
- package/dist/testing/index.d.ts +3 -0
- package/dist/testing/index.js +11 -0
- package/package.json +373 -0
- package/src/client/wsWire.ts +83 -0
- package/src/config/appConfig.spec.ts +158 -0
- package/src/config/appConfig.ts +372 -0
- package/src/core/activity/index.ts +21 -0
- package/src/core/activity/model.ts +160 -0
- package/src/core/analytics/index.ts +18 -0
- package/src/core/analytics/range.spec.ts +280 -0
- package/src/core/analytics/range.ts +383 -0
- package/src/core/analytics/schedule.spec.ts +311 -0
- package/src/core/analytics/schedule.ts +624 -0
- package/src/core/category/category.spec.ts +144 -0
- package/src/core/category/index.ts +19 -0
- package/src/core/category/memoryStore.ts +104 -0
- package/src/core/category/tree.ts +118 -0
- package/src/core/category/types.ts +59 -0
- package/src/core/color.spec.ts +35 -0
- package/src/core/color.ts +35 -0
- package/src/core/colorScheme/colorScheme.spec.ts +127 -0
- package/src/core/colorScheme/colorSchemeStore.ts +184 -0
- package/src/core/colorScheme/index.ts +23 -0
- package/src/core/domainOwners.ts +32 -0
- package/src/core/download.spec.ts +38 -0
- package/src/core/download.ts +35 -0
- package/src/core/events/ccEventBus.spec.ts +90 -0
- package/src/core/events/ccEventBus.ts +120 -0
- package/src/core/file-tree/fileTreeModel.spec.ts +462 -0
- package/src/core/file-tree/fileTreeModel.ts +511 -0
- package/src/core/folder-tree/actions.spec.ts +103 -0
- package/src/core/folder-tree/actions.ts +153 -0
- package/src/core/folder-tree/index.ts +46 -0
- package/src/core/folder-tree/path.spec.ts +113 -0
- package/src/core/folder-tree/path.ts +148 -0
- package/src/core/folder-tree/tree.spec.ts +157 -0
- package/src/core/folder-tree/tree.ts +244 -0
- package/src/core/layout/index.ts +7 -0
- package/src/core/master-lock/index.ts +50 -0
- package/src/core/master-lock/kdf.spec.ts +95 -0
- package/src/core/master-lock/kdf.ts +145 -0
- package/src/core/master-lock/policy.ts +55 -0
- package/src/core/master-lock/presence.spec.ts +73 -0
- package/src/core/master-lock/presence.ts +71 -0
- package/src/core/master-lock/wire.ts +155 -0
- package/src/core/media/bgRemoval.spec.ts +120 -0
- package/src/core/media/bgRemoval.ts +123 -0
- package/src/core/media/ffmpeg.spec.ts +135 -0
- package/src/core/media/ffmpeg.ts +162 -0
- package/src/core/media/format.spec.ts +41 -0
- package/src/core/media/format.ts +58 -0
- package/src/core/media/index.ts +105 -0
- package/src/core/media/mediaItem.spec.ts +46 -0
- package/src/core/media/mediaItem.ts +40 -0
- package/src/core/media/renderPlan.spec.ts +140 -0
- package/src/core/media/renderPlan.ts +318 -0
- package/src/core/media/segment.spec.ts +159 -0
- package/src/core/media/segment.ts +352 -0
- package/src/core/media/size.spec.ts +19 -0
- package/src/core/media/size.ts +3 -0
- package/src/core/media/trim.spec.ts +75 -0
- package/src/core/media/trim.ts +60 -0
- package/src/core/media/types.ts +147 -0
- package/src/core/media/uploadLimits.ts +18 -0
- package/src/core/media/validate.spec.ts +106 -0
- package/src/core/media/validate.ts +131 -0
- package/src/core/media/videoCuts.spec.ts +327 -0
- package/src/core/media/videoCuts.ts +355 -0
- package/src/core/navigation/breadcrumbCompat.ts +44 -0
- package/src/core/navigation/coverageTest.ts +54 -0
- package/src/core/navigation/index.ts +50 -0
- package/src/core/navigation/migrateNavPreferences.ts +119 -0
- package/src/core/navigation/navigation.spec.ts +388 -0
- package/src/core/navigation/navigationModel.ts +185 -0
- package/src/core/navigation/navigationSelectors.ts +206 -0
- package/src/core/navigation/searchCatalogue.ts +89 -0
- package/src/core/net/reconnectSchedule.spec.ts +49 -0
- package/src/core/net/reconnectSchedule.ts +78 -0
- package/src/core/palette/ShortcutRegistry.ts +69 -0
- package/src/core/palette/fuzzyRank.ts +78 -0
- package/src/core/palette/hotkeys.ts +132 -0
- package/src/core/palette/index.ts +22 -0
- package/src/core/palette/palette.spec.ts +160 -0
- package/src/core/schema/projection.spec.ts +122 -0
- package/src/core/schema/projection.ts +225 -0
- package/src/core/session/claims.ts +181 -0
- package/src/core/sharing/index.ts +33 -0
- package/src/core/sharing/model.spec.ts +104 -0
- package/src/core/sharing/model.ts +296 -0
- package/src/core/site/siteCopy.ts +115 -0
- package/src/core/slots.ts +38 -0
- package/src/core/styles/constructableSheet.ts +86 -0
- package/src/core/tokens/registry.spec.ts +160 -0
- package/src/core/tokens/registry.ts +536 -0
- package/src/core/uiScale/index.ts +32 -0
- package/src/core/uiScale/scale.ts +63 -0
- package/src/core/uiScale/uiScale.spec.ts +77 -0
- package/src/core/uiScale/uiScaleStore.ts +100 -0
- package/src/core/wire/__fixtures__/rowsMarshalWorker.ts +24 -0
- package/src/core/wire/index.ts +56 -0
- package/src/core/wire/ingress.spec.ts +276 -0
- package/src/core/wire/ingress.ts +182 -0
- package/src/core/wire/marshalWorker.spec.ts +196 -0
- package/src/core/wire/marshalWorker.ts +361 -0
- package/src/core/wire/marshalling.spec.ts +139 -0
- package/src/core/wire/marshalling.ts +238 -0
- package/src/core/wire/wireHub.spec.ts +137 -0
- package/src/core/wire/wireHub.ts +213 -0
- package/src/ctgr/base64url.ts +44 -0
- package/src/ctgr/chunkAccumulator.ts +403 -0
- package/src/ctgr/chunkStore.spec.ts +101 -0
- package/src/ctgr/chunkStore.ts +168 -0
- package/src/ctgr/codec.spec.ts +208 -0
- package/src/ctgr/codec.ts +202 -0
- package/src/ctgr/compress.ts +21 -0
- package/src/ctgr/crc32.ts +23 -0
- package/src/ctgr/digest.ts +14 -0
- package/src/ctgr/index.ts +39 -0
- package/src/ctgr/types.ts +80 -0
- package/src/ctgr/v0compat.spec.ts +73 -0
- package/src/ctgr/v0compat.ts +156 -0
- package/src/declaredDepsAreImported.spec.ts +87 -0
- package/src/index.ts +25 -0
- package/src/leafSubpathsImportNothing.spec.ts +287 -0
- package/src/lockfileIsTracked.spec.ts +50 -0
- package/src/namedSubpathsResolve.spec.ts +122 -0
- package/src/noPathDeps.spec.ts +24 -0
- package/src/publishShape.spec.ts +89 -0
- package/src/shared/errors.ts +153 -0
- package/src/skippedTestsAreAnswered.spec.ts +221 -0
- package/src/testTmpRoot.spec.ts +102 -0
- package/src/testing/bytes.ts +38 -0
- package/src/testing/domInspect.spec.ts +79 -0
- package/src/testing/domInspect.ts +127 -0
- package/src/testing/fakeFetch.ts +26 -0
- package/src/testing/index.ts +11 -0
package/package.json
ADDED
|
@@ -0,0 +1,373 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "cursedbelt-core",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"license": "ISC",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"description": "Framework-agnostic core of the cursedbelt split \u2014 isomorphic domain logic. cwip below it, cursedbelt-server and cursedbelt (react) above it.",
|
|
7
|
+
"cursed": {
|
|
8
|
+
"schemaVersion": 1,
|
|
9
|
+
"app": {
|
|
10
|
+
"name": "cursedbelt-core",
|
|
11
|
+
"commands": {
|
|
12
|
+
"test": "test",
|
|
13
|
+
"typecheck": "typecheck",
|
|
14
|
+
"build": "build"
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"scripts": {
|
|
19
|
+
"clean": "rm -rf dist",
|
|
20
|
+
"typecheck": "tsc -p tsconfig.build.json --noEmit",
|
|
21
|
+
"test": "NODE_ENV=development bun test src",
|
|
22
|
+
"build": "bun run clean && tsc -p tsconfig.build.json",
|
|
23
|
+
"paths": "bun ../../tools/check-paths.ts .",
|
|
24
|
+
"verify": "bun run paths && bun run typecheck && bun run build && bun run test",
|
|
25
|
+
"prepublishOnly": "bun run verify"
|
|
26
|
+
},
|
|
27
|
+
"files": [
|
|
28
|
+
"dist",
|
|
29
|
+
"src"
|
|
30
|
+
],
|
|
31
|
+
"exports": {
|
|
32
|
+
".": {
|
|
33
|
+
"types": "./dist/index.d.ts",
|
|
34
|
+
"bun": "./src/index.ts",
|
|
35
|
+
"source": "./src/index.ts",
|
|
36
|
+
"import": "./dist/index.js"
|
|
37
|
+
},
|
|
38
|
+
"./activity": {
|
|
39
|
+
"types": "./dist/core/activity/index.d.ts",
|
|
40
|
+
"bun": "./src/core/activity/index.ts",
|
|
41
|
+
"source": "./src/core/activity/index.ts",
|
|
42
|
+
"import": "./dist/core/activity/index.js"
|
|
43
|
+
},
|
|
44
|
+
"./activity/model": {
|
|
45
|
+
"types": "./dist/core/activity/model.d.ts",
|
|
46
|
+
"bun": "./src/core/activity/model.ts",
|
|
47
|
+
"source": "./src/core/activity/model.ts",
|
|
48
|
+
"import": "./dist/core/activity/model.js"
|
|
49
|
+
},
|
|
50
|
+
"./analytics": {
|
|
51
|
+
"types": "./dist/core/analytics/index.d.ts",
|
|
52
|
+
"bun": "./src/core/analytics/index.ts",
|
|
53
|
+
"source": "./src/core/analytics/index.ts",
|
|
54
|
+
"import": "./dist/core/analytics/index.js"
|
|
55
|
+
},
|
|
56
|
+
"./analytics/range": {
|
|
57
|
+
"types": "./dist/core/analytics/range.d.ts",
|
|
58
|
+
"bun": "./src/core/analytics/range.ts",
|
|
59
|
+
"source": "./src/core/analytics/range.ts",
|
|
60
|
+
"import": "./dist/core/analytics/range.js"
|
|
61
|
+
},
|
|
62
|
+
"./analytics/schedule": {
|
|
63
|
+
"types": "./dist/core/analytics/schedule.d.ts",
|
|
64
|
+
"bun": "./src/core/analytics/schedule.ts",
|
|
65
|
+
"source": "./src/core/analytics/schedule.ts",
|
|
66
|
+
"import": "./dist/core/analytics/schedule.js"
|
|
67
|
+
},
|
|
68
|
+
"./app-config": {
|
|
69
|
+
"types": "./dist/config/appConfig.d.ts",
|
|
70
|
+
"bun": "./src/config/appConfig.ts",
|
|
71
|
+
"source": "./src/config/appConfig.ts",
|
|
72
|
+
"import": "./dist/config/appConfig.js"
|
|
73
|
+
},
|
|
74
|
+
"./category": {
|
|
75
|
+
"types": "./dist/core/category/index.d.ts",
|
|
76
|
+
"bun": "./src/core/category/index.ts",
|
|
77
|
+
"source": "./src/core/category/index.ts",
|
|
78
|
+
"import": "./dist/core/category/index.js"
|
|
79
|
+
},
|
|
80
|
+
"./color": {
|
|
81
|
+
"types": "./dist/core/color.d.ts",
|
|
82
|
+
"bun": "./src/core/color.ts",
|
|
83
|
+
"source": "./src/core/color.ts",
|
|
84
|
+
"import": "./dist/core/color.js"
|
|
85
|
+
},
|
|
86
|
+
"./color-scheme": {
|
|
87
|
+
"types": "./dist/core/colorScheme/index.d.ts",
|
|
88
|
+
"bun": "./src/core/colorScheme/index.ts",
|
|
89
|
+
"source": "./src/core/colorScheme/index.ts",
|
|
90
|
+
"import": "./dist/core/colorScheme/index.js"
|
|
91
|
+
},
|
|
92
|
+
"./ctgr": {
|
|
93
|
+
"types": "./dist/ctgr/index.d.ts",
|
|
94
|
+
"bun": "./src/ctgr/index.ts",
|
|
95
|
+
"source": "./src/ctgr/index.ts",
|
|
96
|
+
"import": "./dist/ctgr/index.js"
|
|
97
|
+
},
|
|
98
|
+
"./ctgr/chunk-store": {
|
|
99
|
+
"types": "./dist/ctgr/chunkStore.d.ts",
|
|
100
|
+
"bun": "./src/ctgr/chunkStore.ts",
|
|
101
|
+
"source": "./src/ctgr/chunkStore.ts",
|
|
102
|
+
"import": "./dist/ctgr/chunkStore.js"
|
|
103
|
+
},
|
|
104
|
+
"./ctgr/types": {
|
|
105
|
+
"types": "./dist/ctgr/types.d.ts",
|
|
106
|
+
"bun": "./src/ctgr/types.ts",
|
|
107
|
+
"source": "./src/ctgr/types.ts",
|
|
108
|
+
"import": "./dist/ctgr/types.js"
|
|
109
|
+
},
|
|
110
|
+
"./ctgr/v0compat": {
|
|
111
|
+
"types": "./dist/ctgr/v0compat.d.ts",
|
|
112
|
+
"bun": "./src/ctgr/v0compat.ts",
|
|
113
|
+
"source": "./src/ctgr/v0compat.ts",
|
|
114
|
+
"import": "./dist/ctgr/v0compat.js"
|
|
115
|
+
},
|
|
116
|
+
"./domain-owners": {
|
|
117
|
+
"types": "./dist/core/domainOwners.d.ts",
|
|
118
|
+
"bun": "./src/core/domainOwners.ts",
|
|
119
|
+
"source": "./src/core/domainOwners.ts",
|
|
120
|
+
"import": "./dist/core/domainOwners.js"
|
|
121
|
+
},
|
|
122
|
+
"./download": {
|
|
123
|
+
"types": "./dist/core/download.d.ts",
|
|
124
|
+
"bun": "./src/core/download.ts",
|
|
125
|
+
"source": "./src/core/download.ts",
|
|
126
|
+
"import": "./dist/core/download.js"
|
|
127
|
+
},
|
|
128
|
+
"./errors": {
|
|
129
|
+
"types": "./dist/shared/errors.d.ts",
|
|
130
|
+
"bun": "./src/shared/errors.ts",
|
|
131
|
+
"source": "./src/shared/errors.ts",
|
|
132
|
+
"import": "./dist/shared/errors.js"
|
|
133
|
+
},
|
|
134
|
+
"./events/cc-event-bus": {
|
|
135
|
+
"types": "./dist/core/events/ccEventBus.d.ts",
|
|
136
|
+
"bun": "./src/core/events/ccEventBus.ts",
|
|
137
|
+
"source": "./src/core/events/ccEventBus.ts",
|
|
138
|
+
"import": "./dist/core/events/ccEventBus.js"
|
|
139
|
+
},
|
|
140
|
+
"./file-tree/file-tree-model": {
|
|
141
|
+
"types": "./dist/core/file-tree/fileTreeModel.d.ts",
|
|
142
|
+
"bun": "./src/core/file-tree/fileTreeModel.ts",
|
|
143
|
+
"source": "./src/core/file-tree/fileTreeModel.ts",
|
|
144
|
+
"import": "./dist/core/file-tree/fileTreeModel.js"
|
|
145
|
+
},
|
|
146
|
+
"./folder-tree": {
|
|
147
|
+
"types": "./dist/core/folder-tree/index.d.ts",
|
|
148
|
+
"bun": "./src/core/folder-tree/index.ts",
|
|
149
|
+
"source": "./src/core/folder-tree/index.ts",
|
|
150
|
+
"import": "./dist/core/folder-tree/index.js"
|
|
151
|
+
},
|
|
152
|
+
"./folder-tree/actions": {
|
|
153
|
+
"types": "./dist/core/folder-tree/actions.d.ts",
|
|
154
|
+
"bun": "./src/core/folder-tree/actions.ts",
|
|
155
|
+
"source": "./src/core/folder-tree/actions.ts",
|
|
156
|
+
"import": "./dist/core/folder-tree/actions.js"
|
|
157
|
+
},
|
|
158
|
+
"./folder-tree/path": {
|
|
159
|
+
"types": "./dist/core/folder-tree/path.d.ts",
|
|
160
|
+
"bun": "./src/core/folder-tree/path.ts",
|
|
161
|
+
"source": "./src/core/folder-tree/path.ts",
|
|
162
|
+
"import": "./dist/core/folder-tree/path.js"
|
|
163
|
+
},
|
|
164
|
+
"./folder-tree/tree": {
|
|
165
|
+
"types": "./dist/core/folder-tree/tree.d.ts",
|
|
166
|
+
"bun": "./src/core/folder-tree/tree.ts",
|
|
167
|
+
"source": "./src/core/folder-tree/tree.ts",
|
|
168
|
+
"import": "./dist/core/folder-tree/tree.js"
|
|
169
|
+
},
|
|
170
|
+
"./layout": {
|
|
171
|
+
"types": "./dist/core/layout/index.d.ts",
|
|
172
|
+
"bun": "./src/core/layout/index.ts",
|
|
173
|
+
"source": "./src/core/layout/index.ts",
|
|
174
|
+
"import": "./dist/core/layout/index.js"
|
|
175
|
+
},
|
|
176
|
+
"./master-lock": {
|
|
177
|
+
"types": "./dist/core/master-lock/index.d.ts",
|
|
178
|
+
"bun": "./src/core/master-lock/index.ts",
|
|
179
|
+
"source": "./src/core/master-lock/index.ts",
|
|
180
|
+
"import": "./dist/core/master-lock/index.js"
|
|
181
|
+
},
|
|
182
|
+
"./master-lock/kdf": {
|
|
183
|
+
"types": "./dist/core/master-lock/kdf.d.ts",
|
|
184
|
+
"bun": "./src/core/master-lock/kdf.ts",
|
|
185
|
+
"source": "./src/core/master-lock/kdf.ts",
|
|
186
|
+
"import": "./dist/core/master-lock/kdf.js"
|
|
187
|
+
},
|
|
188
|
+
"./master-lock/policy": {
|
|
189
|
+
"types": "./dist/core/master-lock/policy.d.ts",
|
|
190
|
+
"bun": "./src/core/master-lock/policy.ts",
|
|
191
|
+
"source": "./src/core/master-lock/policy.ts",
|
|
192
|
+
"import": "./dist/core/master-lock/policy.js"
|
|
193
|
+
},
|
|
194
|
+
"./media": {
|
|
195
|
+
"types": "./dist/core/media/index.d.ts",
|
|
196
|
+
"bun": "./src/core/media/index.ts",
|
|
197
|
+
"source": "./src/core/media/index.ts",
|
|
198
|
+
"import": "./dist/core/media/index.js"
|
|
199
|
+
},
|
|
200
|
+
"./media/ffmpeg": {
|
|
201
|
+
"types": "./dist/core/media/ffmpeg.d.ts",
|
|
202
|
+
"bun": "./src/core/media/ffmpeg.ts",
|
|
203
|
+
"source": "./src/core/media/ffmpeg.ts",
|
|
204
|
+
"import": "./dist/core/media/ffmpeg.js"
|
|
205
|
+
},
|
|
206
|
+
"./media/render-plan": {
|
|
207
|
+
"types": "./dist/core/media/renderPlan.d.ts",
|
|
208
|
+
"bun": "./src/core/media/renderPlan.ts",
|
|
209
|
+
"source": "./src/core/media/renderPlan.ts",
|
|
210
|
+
"import": "./dist/core/media/renderPlan.js"
|
|
211
|
+
},
|
|
212
|
+
"./media/size": {
|
|
213
|
+
"types": "./dist/core/media/size.d.ts",
|
|
214
|
+
"bun": "./src/core/media/size.ts",
|
|
215
|
+
"source": "./src/core/media/size.ts",
|
|
216
|
+
"import": "./dist/core/media/size.js"
|
|
217
|
+
},
|
|
218
|
+
"./media/types": {
|
|
219
|
+
"types": "./dist/core/media/types.d.ts",
|
|
220
|
+
"bun": "./src/core/media/types.ts",
|
|
221
|
+
"source": "./src/core/media/types.ts",
|
|
222
|
+
"import": "./dist/core/media/types.js"
|
|
223
|
+
},
|
|
224
|
+
"./media/upload-limits": {
|
|
225
|
+
"types": "./dist/core/media/uploadLimits.d.ts",
|
|
226
|
+
"bun": "./src/core/media/uploadLimits.ts",
|
|
227
|
+
"source": "./src/core/media/uploadLimits.ts",
|
|
228
|
+
"import": "./dist/core/media/uploadLimits.js"
|
|
229
|
+
},
|
|
230
|
+
"./media/video-cuts": {
|
|
231
|
+
"types": "./dist/core/media/videoCuts.d.ts",
|
|
232
|
+
"bun": "./src/core/media/videoCuts.ts",
|
|
233
|
+
"source": "./src/core/media/videoCuts.ts",
|
|
234
|
+
"import": "./dist/core/media/videoCuts.js"
|
|
235
|
+
},
|
|
236
|
+
"./navigation": {
|
|
237
|
+
"types": "./dist/core/navigation/index.d.ts",
|
|
238
|
+
"bun": "./src/core/navigation/index.ts",
|
|
239
|
+
"source": "./src/core/navigation/index.ts",
|
|
240
|
+
"import": "./dist/core/navigation/index.js"
|
|
241
|
+
},
|
|
242
|
+
"./net/reconnect-schedule": {
|
|
243
|
+
"types": "./dist/core/net/reconnectSchedule.d.ts",
|
|
244
|
+
"bun": "./src/core/net/reconnectSchedule.ts",
|
|
245
|
+
"source": "./src/core/net/reconnectSchedule.ts",
|
|
246
|
+
"import": "./dist/core/net/reconnectSchedule.js"
|
|
247
|
+
},
|
|
248
|
+
"./palette": {
|
|
249
|
+
"types": "./dist/core/palette/index.d.ts",
|
|
250
|
+
"bun": "./src/core/palette/index.ts",
|
|
251
|
+
"source": "./src/core/palette/index.ts",
|
|
252
|
+
"import": "./dist/core/palette/index.js"
|
|
253
|
+
},
|
|
254
|
+
"./palette/fuzzy-rank": {
|
|
255
|
+
"types": "./dist/core/palette/fuzzyRank.d.ts",
|
|
256
|
+
"bun": "./src/core/palette/fuzzyRank.ts",
|
|
257
|
+
"source": "./src/core/palette/fuzzyRank.ts",
|
|
258
|
+
"import": "./dist/core/palette/fuzzyRank.js"
|
|
259
|
+
},
|
|
260
|
+
"./palette/hotkeys": {
|
|
261
|
+
"types": "./dist/core/palette/hotkeys.d.ts",
|
|
262
|
+
"bun": "./src/core/palette/hotkeys.ts",
|
|
263
|
+
"source": "./src/core/palette/hotkeys.ts",
|
|
264
|
+
"import": "./dist/core/palette/hotkeys.js"
|
|
265
|
+
},
|
|
266
|
+
"./palette/shortcut-registry": {
|
|
267
|
+
"types": "./dist/core/palette/ShortcutRegistry.d.ts",
|
|
268
|
+
"bun": "./src/core/palette/ShortcutRegistry.ts",
|
|
269
|
+
"source": "./src/core/palette/ShortcutRegistry.ts",
|
|
270
|
+
"import": "./dist/core/palette/ShortcutRegistry.js"
|
|
271
|
+
},
|
|
272
|
+
"./session/claims": {
|
|
273
|
+
"types": "./dist/core/session/claims.d.ts",
|
|
274
|
+
"bun": "./src/core/session/claims.ts",
|
|
275
|
+
"source": "./src/core/session/claims.ts",
|
|
276
|
+
"import": "./dist/core/session/claims.js"
|
|
277
|
+
},
|
|
278
|
+
"./sharing": {
|
|
279
|
+
"types": "./dist/core/sharing/index.d.ts",
|
|
280
|
+
"bun": "./src/core/sharing/index.ts",
|
|
281
|
+
"source": "./src/core/sharing/index.ts",
|
|
282
|
+
"import": "./dist/core/sharing/index.js"
|
|
283
|
+
},
|
|
284
|
+
"./sharing/model": {
|
|
285
|
+
"types": "./dist/core/sharing/model.d.ts",
|
|
286
|
+
"bun": "./src/core/sharing/model.ts",
|
|
287
|
+
"source": "./src/core/sharing/model.ts",
|
|
288
|
+
"import": "./dist/core/sharing/model.js"
|
|
289
|
+
},
|
|
290
|
+
"./site/site-copy": {
|
|
291
|
+
"types": "./dist/core/site/siteCopy.d.ts",
|
|
292
|
+
"bun": "./src/core/site/siteCopy.ts",
|
|
293
|
+
"source": "./src/core/site/siteCopy.ts",
|
|
294
|
+
"import": "./dist/core/site/siteCopy.js"
|
|
295
|
+
},
|
|
296
|
+
"./slots": {
|
|
297
|
+
"types": "./dist/core/slots.d.ts",
|
|
298
|
+
"bun": "./src/core/slots.ts",
|
|
299
|
+
"source": "./src/core/slots.ts",
|
|
300
|
+
"import": "./dist/core/slots.js"
|
|
301
|
+
},
|
|
302
|
+
"./styles/constructable-sheet": {
|
|
303
|
+
"types": "./dist/core/styles/constructableSheet.d.ts",
|
|
304
|
+
"bun": "./src/core/styles/constructableSheet.ts",
|
|
305
|
+
"source": "./src/core/styles/constructableSheet.ts",
|
|
306
|
+
"import": "./dist/core/styles/constructableSheet.js"
|
|
307
|
+
},
|
|
308
|
+
"./testing": {
|
|
309
|
+
"types": "./dist/testing/index.d.ts",
|
|
310
|
+
"bun": "./src/testing/index.ts",
|
|
311
|
+
"source": "./src/testing/index.ts",
|
|
312
|
+
"import": "./dist/testing/index.js"
|
|
313
|
+
},
|
|
314
|
+
"./testing/dom-inspect": {
|
|
315
|
+
"types": "./dist/testing/domInspect.d.ts",
|
|
316
|
+
"bun": "./src/testing/domInspect.ts",
|
|
317
|
+
"source": "./src/testing/domInspect.ts",
|
|
318
|
+
"import": "./dist/testing/domInspect.js"
|
|
319
|
+
},
|
|
320
|
+
"./tokens/registry": {
|
|
321
|
+
"types": "./dist/core/tokens/registry.d.ts",
|
|
322
|
+
"bun": "./src/core/tokens/registry.ts",
|
|
323
|
+
"source": "./src/core/tokens/registry.ts",
|
|
324
|
+
"import": "./dist/core/tokens/registry.js"
|
|
325
|
+
},
|
|
326
|
+
"./ui-scale": {
|
|
327
|
+
"types": "./dist/core/uiScale/index.d.ts",
|
|
328
|
+
"bun": "./src/core/uiScale/index.ts",
|
|
329
|
+
"source": "./src/core/uiScale/index.ts",
|
|
330
|
+
"import": "./dist/core/uiScale/index.js"
|
|
331
|
+
},
|
|
332
|
+
"./wire": {
|
|
333
|
+
"types": "./dist/core/wire/index.d.ts",
|
|
334
|
+
"bun": "./src/core/wire/index.ts",
|
|
335
|
+
"source": "./src/core/wire/index.ts",
|
|
336
|
+
"import": "./dist/core/wire/index.js"
|
|
337
|
+
},
|
|
338
|
+
"./wire/marshalling": {
|
|
339
|
+
"types": "./dist/core/wire/marshalling.d.ts",
|
|
340
|
+
"bun": "./src/core/wire/marshalling.ts",
|
|
341
|
+
"source": "./src/core/wire/marshalling.ts",
|
|
342
|
+
"import": "./dist/core/wire/marshalling.js"
|
|
343
|
+
},
|
|
344
|
+
"./wire/wire-hub": {
|
|
345
|
+
"types": "./dist/core/wire/wireHub.d.ts",
|
|
346
|
+
"bun": "./src/core/wire/wireHub.ts",
|
|
347
|
+
"source": "./src/core/wire/wireHub.ts",
|
|
348
|
+
"import": "./dist/core/wire/wireHub.js"
|
|
349
|
+
},
|
|
350
|
+
"./ws-wire": {
|
|
351
|
+
"types": "./dist/client/wsWire.d.ts",
|
|
352
|
+
"bun": "./src/client/wsWire.ts",
|
|
353
|
+
"source": "./src/client/wsWire.ts",
|
|
354
|
+
"import": "./dist/client/wsWire.js"
|
|
355
|
+
}
|
|
356
|
+
},
|
|
357
|
+
"dependencies": {
|
|
358
|
+
"@leeoniya/ufuzzy": "^1.0.19",
|
|
359
|
+
"cwip": "^3.0.2"
|
|
360
|
+
},
|
|
361
|
+
"peerDependencies": {
|
|
362
|
+
"zod": "^4.4.0"
|
|
363
|
+
},
|
|
364
|
+
"devDependencies": {
|
|
365
|
+
"@biomejs/biome": "^2.5.0",
|
|
366
|
+
"@types/bun": "^1.3.14",
|
|
367
|
+
"@types/node": "^24",
|
|
368
|
+
"typescript": "^6.0.3",
|
|
369
|
+
"zod": "4.4.3",
|
|
370
|
+
"@happy-dom/global-registrator": "^20.10.6",
|
|
371
|
+
"hono": "4.12.28"
|
|
372
|
+
}
|
|
373
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The WS hub's WIRE, with no socket attached.
|
|
3
|
+
*
|
|
4
|
+
* ── Why this is a module of its own ─────────────────────────────────────────
|
|
5
|
+
* `./ws` imports `partysocket/ws` at the top of the file to build the
|
|
6
|
+
* auto-reconnecting socket. `partysocket` is an OPTIONAL peer of cursedbelt, so
|
|
7
|
+
* a consumer that brings its own socket — because it already has a reconnect
|
|
8
|
+
* strategy, or because its entry chunk is measured to the byte and it will not
|
|
9
|
+
* spend it on a reconnect library — could not touch the URL builder or the
|
|
10
|
+
* envelope helpers without pulling the library in. They are twenty lines of pure
|
|
11
|
+
* string handling and they were only ever in that file because they were written
|
|
12
|
+
* on the same afternoon.
|
|
13
|
+
*
|
|
14
|
+
* So: the WIRE lives here and is free of dependencies, and `./ws` re-exports it
|
|
15
|
+
* beside the socket factory. Nothing moved for the callers that already had it —
|
|
16
|
+
* `cursedbelt-cc/client` still exports all of it from one place — and the split is
|
|
17
|
+
* what makes `cursedbelt-core/ws-wire` a thing an app can import.
|
|
18
|
+
*
|
|
19
|
+
* 🔴 The contract is that the envelope has ONE definition. An app that hand-rolls
|
|
20
|
+
* `JSON.stringify({ event, data })` is an app whose frames drift from the hub's
|
|
21
|
+
* the day the envelope gains a field, and the drift presents as a message the
|
|
22
|
+
* server silently ignores — `createWsHub` returns from `message` rather than
|
|
23
|
+
* throwing, on purpose. Take the helpers.
|
|
24
|
+
*
|
|
25
|
+
* `apps/family` (cursed-satellites) is the first consumer of this subpath.
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
/** The minimal shape of `window.location` {@link buildChannelSocketUrl} needs. Injectable
|
|
29
|
+
* so the URL builder is pure + testable (no `window` at module scope). */
|
|
30
|
+
export interface WsLocation {
|
|
31
|
+
protocol: string;
|
|
32
|
+
host: string;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** The hub's wire envelope, mirroring `cursedbelt-server`'s `WsMessage`. Re-declared here
|
|
36
|
+
* (not imported) because the server module is Bun-typed and must not leak into the browser
|
|
37
|
+
* surface. */
|
|
38
|
+
export interface WsMessage<T = unknown> {
|
|
39
|
+
event: string;
|
|
40
|
+
data: T;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** Build the `ws(s)://host/ws/<channel>[?room=<roomId>]` URL the hub upgrades. `wss` is
|
|
44
|
+
* chosen iff the page is `https`. Pure — pass `loc` in tests. */
|
|
45
|
+
export function buildChannelSocketUrl(
|
|
46
|
+
channel: string,
|
|
47
|
+
roomId: string | undefined,
|
|
48
|
+
loc: WsLocation,
|
|
49
|
+
): string {
|
|
50
|
+
const scheme = loc.protocol === 'https:' ? 'wss' : 'ws';
|
|
51
|
+
const base = `${scheme}://${loc.host}/ws/${encodeURIComponent(channel)}`;
|
|
52
|
+
return roomId ? `${base}?room=${encodeURIComponent(roomId)}` : base;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** Send a `{ event, data }` frame the hub understands. */
|
|
56
|
+
export function sendWsMessage(
|
|
57
|
+
socket: { send(data: string): void },
|
|
58
|
+
event: string,
|
|
59
|
+
data: unknown,
|
|
60
|
+
): void {
|
|
61
|
+
socket.send(JSON.stringify({ event, data }));
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/** Parse an inbound frame into a `{ event, data }` envelope, or `null` if it isn't valid
|
|
65
|
+
* JSON of that shape (so a stray non-envelope frame can't throw in a message handler). */
|
|
66
|
+
export function parseWsMessage<T = unknown>(raw: unknown): WsMessage<T> | null {
|
|
67
|
+
if (typeof raw !== 'string') return null;
|
|
68
|
+
let parsed: unknown;
|
|
69
|
+
try {
|
|
70
|
+
parsed = JSON.parse(raw);
|
|
71
|
+
} catch {
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
if (
|
|
75
|
+
parsed &&
|
|
76
|
+
typeof parsed === 'object' &&
|
|
77
|
+
'event' in parsed &&
|
|
78
|
+
typeof parsed.event === 'string'
|
|
79
|
+
) {
|
|
80
|
+
return parsed as WsMessage<T>;
|
|
81
|
+
}
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { describe, expect, it } from 'bun:test';
|
|
2
|
+
import { AppConfigSchema, effectiveSignupMode, featureKeysOf, resolveInstanceFeatures, ROUTE_PATH_RE } from './appConfig';
|
|
3
|
+
|
|
4
|
+
const base = (over: Record<string, unknown> = {}) => ({
|
|
5
|
+
configVersion: 1,
|
|
6
|
+
app: { id: 'demo', title: 'Demo' },
|
|
7
|
+
engines: ['asset'],
|
|
8
|
+
instances: [{ engine: 'asset', id: 'gallery' }],
|
|
9
|
+
...over,
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
const parse = (config: unknown) => AppConfigSchema.safeParse(config);
|
|
13
|
+
const messages = (config: unknown) => parse(config).error?.issues.map((i) => i.message) ?? [];
|
|
14
|
+
|
|
15
|
+
describe('strictness (02 §2.2)', () => {
|
|
16
|
+
it('accepts a minimal config and fills every default', () => {
|
|
17
|
+
const result = parse(base());
|
|
18
|
+
expect(result.success).toBe(true);
|
|
19
|
+
expect(result.data?.profile).toBe('local');
|
|
20
|
+
expect(result.data?.connections).toEqual([]);
|
|
21
|
+
expect(result.data?.instances[0]?.cssIsolation).toBe('none');
|
|
22
|
+
expect(result.data?.deployTarget.capabilities).toEqual({});
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it('refuses an unknown top-level key rather than stripping it', () => {
|
|
26
|
+
const result = parse(base({ theeme: {} }));
|
|
27
|
+
expect(result.success).toBe(false);
|
|
28
|
+
expect(result.error?.issues[0]?.code).toBe('unrecognized_keys');
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it('refuses an unknown key inside a per-engine features block', () => {
|
|
32
|
+
const result = parse(base({ instances: [{ engine: 'asset', id: 'gallery', features: { alowVideoHLS: true } }] }));
|
|
33
|
+
expect(result.success).toBe(false);
|
|
34
|
+
expect(messages(base({ instances: [{ engine: 'asset', id: 'gallery', features: { alowVideoHLS: true } }] })).join(' ')).toContain(
|
|
35
|
+
'alowVideoHLS',
|
|
36
|
+
);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it('refuses an unknown configVersion instead of guessing', () => {
|
|
40
|
+
expect(parse(base({ configVersion: 2 })).success).toBe(false);
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it('refuses an instance id that is not kebab-case', () => {
|
|
44
|
+
expect(parse(base({ instances: [{ engine: 'asset', id: 'Gallery Main' }] })).success).toBe(false);
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it('refuses a port outside the unprivileged range', () => {
|
|
48
|
+
expect(parse(base({ app: { id: 'demo', title: 'Demo', port: 80 } })).success).toBe(false);
|
|
49
|
+
expect(parse(base({ app: { id: 'demo', title: 'Demo', port: 4747 } })).success).toBe(true);
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
describe('cross-engine dependencies are code, not comments (J2-1)', () => {
|
|
54
|
+
it('blocks privateMedia without the guard engine', () => {
|
|
55
|
+
const config = base({ instances: [{ engine: 'asset', id: 'gallery', features: { privateMedia: true } }] });
|
|
56
|
+
expect(parse(config).success).toBe(false);
|
|
57
|
+
expect(messages(config).join(' ')).toContain("'privateMedia' requires the 'guard' engine");
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
it('allows privateMedia once guard is activated', () => {
|
|
61
|
+
const config = base({
|
|
62
|
+
engines: ['asset', 'guard'],
|
|
63
|
+
instances: [
|
|
64
|
+
{ engine: 'asset', id: 'gallery', features: { privateMedia: true } },
|
|
65
|
+
{ engine: 'guard', id: 'guard-main' },
|
|
66
|
+
],
|
|
67
|
+
});
|
|
68
|
+
expect(parse(config).success).toBe(true);
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
it('blocks oralHistory without the asset engine', () => {
|
|
72
|
+
const config = base({ engines: ['knowledge'], instances: [{ engine: 'knowledge', id: 'stories', features: { oralHistory: true } }] });
|
|
73
|
+
expect(messages(config).join(' ')).toContain("'oralHistory' requires the 'asset' engine");
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
it('blocks auth.enabled without the guard engine', () => {
|
|
77
|
+
const config = base({ auth: { enabled: true } });
|
|
78
|
+
expect(messages(config).join(' ')).toContain("auth.enabled requires the 'guard' engine");
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
it('blocks an instance whose engine is absent from engines[]', () => {
|
|
82
|
+
const config = base({ engines: ['asset'], instances: [{ engine: 'knowledge', id: 'notes' }] });
|
|
83
|
+
expect(messages(config).join(' ')).toContain("absent from engines[]");
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
it('forces guard + rbac in the saas profile', () => {
|
|
87
|
+
const noGuard = base({ profile: 'saas', engines: ['knowledge'], instances: [{ engine: 'knowledge', id: 'notes' }] });
|
|
88
|
+
expect(messages(noGuard).join(' ')).toContain("structurally requires the 'guard' engine");
|
|
89
|
+
|
|
90
|
+
const noRbac = base({
|
|
91
|
+
profile: 'saas',
|
|
92
|
+
engines: ['guard', 'knowledge'],
|
|
93
|
+
instances: [
|
|
94
|
+
{ engine: 'guard', id: 'guard-main' },
|
|
95
|
+
{ engine: 'knowledge', id: 'notes' },
|
|
96
|
+
],
|
|
97
|
+
});
|
|
98
|
+
expect(messages(noRbac).join(' ')).toContain("'features.rbac: true'");
|
|
99
|
+
|
|
100
|
+
const ok = base({
|
|
101
|
+
profile: 'saas',
|
|
102
|
+
engines: ['guard', 'knowledge'],
|
|
103
|
+
instances: [
|
|
104
|
+
{ engine: 'guard', id: 'guard-main', features: { rbac: true } },
|
|
105
|
+
{ engine: 'knowledge', id: 'notes' },
|
|
106
|
+
],
|
|
107
|
+
});
|
|
108
|
+
expect(parse(ok).success).toBe(true);
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
describe('route paths (03 §3)', () => {
|
|
113
|
+
it('accepts kebab segments with camelCase params', () => {
|
|
114
|
+
for (const path of ['/', '/chat', '/chat/:conversationId', '/apps/:appId/logs']) expect(ROUTE_PATH_RE.test(path)).toBe(true);
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
it('rejects capitalized literal segments, trailing slashes and query strings', () => {
|
|
118
|
+
for (const path of ['/Chat', '/chat/', '/chat?x=1', 'chat']) expect(ROUTE_PATH_RE.test(path)).toBe(false);
|
|
119
|
+
});
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
describe('feature resolution', () => {
|
|
123
|
+
it('resolves declared features through the FULL engine schema (the V0 preview)', () => {
|
|
124
|
+
const effective = resolveInstanceFeatures('asset', { video: false });
|
|
125
|
+
expect(effective.video).toBe(false);
|
|
126
|
+
expect(effective.hls).toBe(true); // untouched default, present rather than undefined
|
|
127
|
+
expect(effective.galleryLayouts).toEqual(['rows']);
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
it('exposes every declared feature key for the V1 requiredFeatures check', () => {
|
|
131
|
+
expect(featureKeysOf('guard')).toContain('rbac');
|
|
132
|
+
expect(featureKeysOf('guard')).not.toContain('video');
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
it('defaults signupMode to open (the pre-D33 behavior, and every existing config)', () => {
|
|
136
|
+
expect(resolveInstanceFeatures('guard', {}).signupMode).toBe('open');
|
|
137
|
+
});
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
describe('effectiveSignupMode — the launch gate (D33)', () => {
|
|
141
|
+
const guard = (signupMode?: string): { engine: string; effective: Record<string, string> } => ({
|
|
142
|
+
engine: 'guard',
|
|
143
|
+
effective: signupMode === undefined ? {} : { signupMode },
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
it('is open for no guard instance, and for a manifest predating the field', () => {
|
|
147
|
+
expect(effectiveSignupMode([])).toBe('open');
|
|
148
|
+
expect(effectiveSignupMode([{ engine: 'asset', effective: { signupMode: 'closed' } }])).toBe('open');
|
|
149
|
+
expect(effectiveSignupMode([guard()])).toBe('open');
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
it('the STRICTEST configured value wins across guard instances', () => {
|
|
153
|
+
// A second, more open instance must never reopen a closed door.
|
|
154
|
+
expect(effectiveSignupMode([guard('open'), guard('invite')])).toBe('invite');
|
|
155
|
+
expect(effectiveSignupMode([guard('invite'), guard('closed')])).toBe('closed');
|
|
156
|
+
expect(effectiveSignupMode([guard('closed'), guard('open')])).toBe('closed');
|
|
157
|
+
});
|
|
158
|
+
});
|