@jskit-ai/kernel 0.1.158 → 0.1.160

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. package/_testable/index.js +1 -3
  2. package/client/componentRegistry.js +44 -0
  3. package/client/componentRegistry.test.js +16 -0
  4. package/client/moduleBootstrap.js +54 -97
  5. package/client/moduleBootstrap.test.js +47 -32
  6. package/client/vite/clientBootstrapPlugin.js +12 -3
  7. package/client/vite/clientBootstrapPlugin.test.js +21 -6
  8. package/internal/node/installedPackages.js +2 -7
  9. package/internal/node/installedPackages.test.js +26 -5
  10. package/package.json +3 -5
  11. package/server/actions/actionCatalogue.js +162 -0
  12. package/server/actions/actionEvents.js +66 -0
  13. package/server/actions/actionProvider.js +23 -0
  14. package/server/actions/index.js +3 -6
  15. package/server/features/defineFeature.js +131 -0
  16. package/server/features/defineFeature.test.js +238 -0
  17. package/server/features/index.js +1 -0
  18. package/server/http/HttpProvider.js +23 -0
  19. package/server/http/_testable/index.js +0 -1
  20. package/server/http/capabilityHttpRuntime.js +123 -0
  21. package/server/http/capabilityHttpRuntime.test.js +161 -0
  22. package/server/http/directRequestActionExecutor.js +78 -0
  23. package/server/http/index.js +2 -1
  24. package/server/http/lib/index.js +1 -13
  25. package/server/http/lib/routeRegistration.js +9 -25
  26. package/server/platform/index.js +2 -2
  27. package/server/platform/installedRuntime.js +122 -0
  28. package/server/platform/installedRuntime.test.js +103 -0
  29. package/server/platform/providerRuntime/capabilityProviderLoader.js +100 -0
  30. package/server/platform/providerRuntime/capabilityProviderLoader.test.js +80 -0
  31. package/server/platform/providerRuntime/packageCatalog.js +4 -1
  32. package/server/platform/surfaceRuntime.js +1 -15
  33. package/server/runtime/BootstrapProvider.js +69 -0
  34. package/server/runtime/EventProvider.js +74 -0
  35. package/server/runtime/EventProvider.test.js +32 -0
  36. package/server/runtime/entityChangeEvents.js +7 -7
  37. package/server/runtime/entityChangeEvents.test.js +2 -2
  38. package/server/runtime/fastifyBootstrap.js +0 -40
  39. package/server/runtime/index.js +2 -3
  40. package/server/surface/index.js +0 -1
  41. package/shared/actions/actionDefinitions.js +20 -0
  42. package/shared/actions/pipeline.js +22 -0
  43. package/shared/actions/policies.js +1 -1
  44. package/shared/actions/registry.js +3 -0
  45. package/shared/capabilities/defineProvider.js +99 -0
  46. package/shared/capabilities/index.js +2 -0
  47. package/shared/capabilities/runtime.js +243 -0
  48. package/shared/capabilities/runtime.test.js +170 -0
  49. package/test/barrelExposure.test.js +36 -13
  50. package/test/exportsContract.test.js +8 -3
  51. package/server/actions/ActionRuntimeServiceProvider.js +0 -304
  52. package/server/actions/ActionRuntimeServiceProvider.test.js +0 -558
  53. package/server/container/ContainerCoreServiceProvider.js +0 -27
  54. package/server/container/index.js +0 -10
  55. package/server/http/HttpFastifyServiceProvider.js +0 -25
  56. package/server/http/lib/httpRuntime.js +0 -83
  57. package/server/http/lib/kernel.js +0 -15
  58. package/server/http/lib/kernel.test.js +0 -1565
  59. package/server/http/lib/requestActionExecutor.js +0 -265
  60. package/server/http/lib/requestScope.js +0 -57
  61. package/server/kernel/KernelCoreServiceProvider.js +0 -27
  62. package/server/kernel/index.js +0 -10
  63. package/server/platform/PlatformServerRuntimeServiceProvider.js +0 -30
  64. package/server/platform/providerRuntime/providerLoader.js +0 -283
  65. package/server/platform/providerRuntime.js +0 -146
  66. package/server/platform/providerRuntime.test.js +0 -214
  67. package/server/platform/runtime.js +0 -40
  68. package/server/registries/actionSurfaceSourceRegistry.js +0 -148
  69. package/server/registries/bootstrapPayloadContributorRegistry.js +0 -51
  70. package/server/registries/domainEventListenerRegistry.js +0 -58
  71. package/server/registries/index.js +0 -32
  72. package/server/registries/primitives.js +0 -63
  73. package/server/registries/routeVisibilityResolverRegistry.js +0 -84
  74. package/server/registries/serviceRegistrationRegistry.js +0 -488
  75. package/server/runtime/ServerRuntimeCoreServiceProvider.js +0 -64
  76. package/server/runtime/ServerRuntimeCoreServiceProvider.test.js +0 -53
  77. package/server/runtime/apiRoutePolicyParity.test.js +0 -109
  78. package/server/runtime/apiRouteRegistration.js +0 -65
  79. package/server/runtime/bootBootstrapRoutes.js +0 -29
  80. package/server/runtime/bootBootstrapRoutes.test.js +0 -69
  81. package/server/runtime/bootstrapContributors.test.js +0 -166
  82. package/server/runtime/composition.js +0 -142
  83. package/server/runtime/domainEvents.test.js +0 -114
  84. package/server/runtime/domainRules.js +0 -50
  85. package/server/runtime/domainRules.test.js +0 -87
  86. package/server/runtime/runtimeAssembly.js +0 -113
  87. package/server/runtime/runtimeKernel.js +0 -55
  88. package/server/runtime/serviceRegistration.test.js +0 -251
  89. package/server/support/SupportCoreServiceProvider.js +0 -27
  90. package/server/surface/SurfaceRoutingServiceProvider.js +0 -27
  91. package/shared/actions/index.js +0 -2
  92. package/shared/runtime/application.js +0 -324
  93. package/shared/runtime/container.js +0 -261
  94. package/shared/runtime/containerErrors.js +0 -22
  95. package/shared/runtime/index.js +0 -18
  96. package/shared/runtime/kernelErrors.js +0 -25
  97. package/shared/runtime/kernelErrors.test.js +0 -120
  98. package/shared/runtime/serviceProvider.js +0 -13
  99. package/shared/support/containerToken.js +0 -8
  100. package/shared/support/generatedUiContract.js +0 -542
  101. package/shared/support/generatedUiContract.test.js +0 -218
  102. package/shared/support/tokens.js +0 -1
  103. package/shared/support/tokens.test.js +0 -17
@@ -1,218 +0,0 @@
1
- import assert from "node:assert/strict";
2
- import test from "node:test";
3
- import {
4
- GENERATED_UI_NAVIGATION_ROLE_OPTION,
5
- GENERATED_UI_NAVIGATION_ROLE_VALUES,
6
- GENERATED_UI_SURFACE_PROFILES,
7
- assertGeneratedUiSourceContract,
8
- buildGeneratedUiScreenClassName,
9
- collectGeneratedUiSourceContractIssues,
10
- inferGeneratedUiNavigationRole,
11
- isGeneratedUiNoLinkNavigationRole,
12
- normalizeGeneratedUiNavigationRole,
13
- resolveGeneratedUiSurfaceProfile,
14
- resolveGeneratedUiNavigationRoleLinkPlacement,
15
- shouldCreateGeneratedUiNavigationLink
16
- } from "./generatedUiContract.js";
17
-
18
- test("generated UI navigation role metadata is package-ready", () => {
19
- assert.deepEqual(
20
- GENERATED_UI_NAVIGATION_ROLE_VALUES,
21
- ["primary", "secondary", "utility", "detail", "workflow", "none"]
22
- );
23
- assert.equal(GENERATED_UI_NAVIGATION_ROLE_OPTION.validationType, "enum");
24
- assert.deepEqual(GENERATED_UI_NAVIGATION_ROLE_OPTION.allowedValues, GENERATED_UI_NAVIGATION_ROLE_VALUES);
25
- assert.equal(GENERATED_UI_NAVIGATION_ROLE_OPTION.defaultValue, "");
26
- });
27
-
28
- test("generated UI surface profiles map app, operator, and settings density", () => {
29
- assert.deepEqual(Object.keys(GENERATED_UI_SURFACE_PROFILES), ["task", "operator", "settings"]);
30
- assert.equal(resolveGeneratedUiSurfaceProfile("").id, "task");
31
- assert.equal(resolveGeneratedUiSurfaceProfile("operator").id, "operator");
32
- assert.equal(resolveGeneratedUiSurfaceProfile("operator").density, "compact");
33
- assert.equal(resolveGeneratedUiSurfaceProfile("settings").id, "settings");
34
- assert.equal(
35
- buildGeneratedUiScreenClassName("generated-page-screen d-flex", {
36
- surfaceProfile: "operator"
37
- }),
38
- "generated-ui-screen generated-ui-screen--operator generated-page-screen d-flex"
39
- );
40
- });
41
-
42
- test("normalizeGeneratedUiNavigationRole defaults and validates roles", () => {
43
- assert.equal(normalizeGeneratedUiNavigationRole(""), "primary");
44
- assert.equal(normalizeGeneratedUiNavigationRole(" Secondary "), "secondary");
45
- assert.throws(
46
- () => normalizeGeneratedUiNavigationRole("drawer"),
47
- /navigation-role must be one of: primary, secondary, utility, detail, workflow, none/
48
- );
49
- });
50
-
51
- test("generated UI navigation roles resolve semantic link placements", () => {
52
- assert.equal(resolveGeneratedUiNavigationRoleLinkPlacement({}), "");
53
- assert.equal(resolveGeneratedUiNavigationRoleLinkPlacement({ "navigation-role": "secondary" }), "shell.secondary-nav");
54
- assert.equal(resolveGeneratedUiNavigationRoleLinkPlacement({ "navigation-role": "utility" }), "shell.global-actions");
55
- assert.equal(
56
- resolveGeneratedUiNavigationRoleLinkPlacement({
57
- "navigation-role": "secondary",
58
- "link-placement": "settings.sections"
59
- }),
60
- "settings.sections"
61
- );
62
- });
63
-
64
- test("generated UI navigation role inference keeps detail and workflow routes out of primary nav", () => {
65
- assert.equal(inferGeneratedUiNavigationRole({}, { routePath: "/reports" }), "primary");
66
- assert.equal(inferGeneratedUiNavigationRole({}, { routePath: "/reports/[reportId]" }), "detail");
67
- assert.equal(inferGeneratedUiNavigationRole({}, { routePath: "/reports/[reportId]/activity" }), "primary");
68
- assert.equal(
69
- inferGeneratedUiNavigationRole({}, {
70
- dynamicRoutePolicy: "any",
71
- routePath: "/reports/[reportId]/activity"
72
- }),
73
- "detail"
74
- );
75
- assert.equal(inferGeneratedUiNavigationRole({}, { routePath: "/reports/new" }), "workflow");
76
- assert.equal(
77
- inferGeneratedUiNavigationRole({ "navigation-role": "primary" }, { routePath: "/reports/[reportId]" }),
78
- "primary"
79
- );
80
- assert.equal(
81
- shouldCreateGeneratedUiNavigationLink({}, {
82
- allowLinkTo: true,
83
- routePath: "/reports/[reportId]"
84
- }),
85
- false
86
- );
87
- assert.equal(
88
- shouldCreateGeneratedUiNavigationLink({ "navigation-role": "primary" }, {
89
- allowLinkTo: true,
90
- routePath: "/reports/[reportId]"
91
- }),
92
- true
93
- );
94
- assert.equal(
95
- shouldCreateGeneratedUiNavigationLink({ "link-placement": "shell.secondary-nav" }, {
96
- allowLinkTo: true,
97
- routePath: "/reports/[reportId]"
98
- }),
99
- true
100
- );
101
- });
102
-
103
- test("generated UI no-link roles reject conflicting link options", () => {
104
- assert.equal(isGeneratedUiNoLinkNavigationRole("detail"), true);
105
- assert.equal(shouldCreateGeneratedUiNavigationLink({ "navigation-role": "workflow" }), false);
106
- assert.equal(shouldCreateGeneratedUiNavigationLink({ "navigation-role": "primary" }), true);
107
- assert.throws(
108
- () => shouldCreateGeneratedUiNavigationLink({
109
- "navigation-role": "detail",
110
- "link-placement": "shell.primary-nav"
111
- }),
112
- /navigation-role "detail" cannot be combined with --link-placement/
113
- );
114
- assert.throws(
115
- () => shouldCreateGeneratedUiNavigationLink({
116
- "navigation-role": "none",
117
- "link-to": "./details"
118
- }, {
119
- allowLinkTo: true
120
- }),
121
- /navigation-role "none" cannot be combined with --link-placement or --link-to/
122
- );
123
- });
124
-
125
- test("generated UI source contract flags placeholder copy and missing profile hooks", () => {
126
- const issues = collectGeneratedUiSourceContractIssues(
127
- `<template>
128
- <section>
129
- <v-card>Replace this content</v-card>
130
- </section>
131
- </template>`,
132
- {
133
- profile: "page"
134
- }
135
- );
136
-
137
- assert.deepEqual(
138
- issues.map((issue) => issue.id),
139
- [
140
- "replace-this-copy",
141
- "vuetify-card-shell",
142
- "shared-screen-class",
143
- "page-screen-title",
144
- "page-empty-state-sheet",
145
- "page-responsive-title-type",
146
- "page-compact-rules"
147
- ]
148
- );
149
- });
150
-
151
- test("generated UI source contract accepts compact-first CRUD detail structure", () => {
152
- assert.doesNotThrow(() => assertGeneratedUiSourceContract(
153
- `<template>
154
- <CrudAddEditScreen :screen="screen">
155
- <template #fields="{ formState, addEdit, resolveFieldErrors }"></template>
156
- </CrudAddEditScreen>
157
- </template>
158
-
159
- <script setup>
160
- const screen = useCrudAddEditScreen({
161
- title: "New Customer",
162
- resource: uiResource
163
- });
164
- </script>`,
165
- {
166
- profile: "crud-detail",
167
- sourceName: "NewElement.vue"
168
- }
169
- ));
170
- });
171
-
172
- test("generated UI source contract accepts compact-first CRUD list structure", () => {
173
- assert.doesNotThrow(() => assertGeneratedUiSourceContract(
174
- `<template>
175
- <CrudListScreen
176
- :screen="screen"
177
- empty-title="__JSKIT_UI_LIST_EMPTY_TITLE__"
178
- load-error-title="__JSKIT_UI_LIST_LOAD_ERROR_TITLE__"
179
- >
180
- <template #card-fields="{ record, records, formatListCardValue }"></template>
181
- <template #table-header></template>
182
- <template #table-row="{ record, records }"></template>
183
- </CrudListScreen>
184
- </template>
185
-
186
- <script setup>
187
- const screen = useCrudListScreen({
188
- resource: uiResource,
189
- listFilters,
190
- listBulkActions
191
- });
192
- </script>`,
193
- {
194
- profile: "crud-list",
195
- sourceName: "ListElement.vue"
196
- }
197
- ));
198
- });
199
-
200
- test("generated UI responsive smoke profile requires compact medium expanded checks", () => {
201
- assert.throws(
202
- () => assertGeneratedUiSourceContract("const width = 390; const selector = 'generated-ui-screen';", {
203
- profile: "responsive-smoke",
204
- sourceName: "tests/e2e/example.spec.ts"
205
- }),
206
- /missing:medium-viewport/
207
- );
208
- });
209
-
210
- test("generated UI responsive smoke profile accepts a Vuetify md viewport", () => {
211
- assert.doesNotThrow(() => assertGeneratedUiSourceContract(
212
- "390 1024 1280 scrollWidth toBeGreaterThanOrEqual(48) generated-ui-screen",
213
- {
214
- profile: "responsive-smoke",
215
- sourceName: "tests/e2e/example.spec.ts"
216
- }
217
- ));
218
- });
@@ -1 +0,0 @@
1
- export { isContainerToken } from "./containerToken.js";
@@ -1,17 +0,0 @@
1
- import test from "node:test";
2
- import assert from "node:assert/strict";
3
- import { isContainerToken } from "./containerToken.js";
4
-
5
- test("isContainerToken accepts valid container token types", () => {
6
- assert.equal(isContainerToken("appConfig"), true);
7
- assert.equal(isContainerToken("jskit.test"), true);
8
- assert.equal(isContainerToken(() => {}), true);
9
- });
10
-
11
- test("isContainerToken rejects empty and unsupported token values", () => {
12
- assert.equal(isContainerToken(""), false);
13
- assert.equal(isContainerToken(" "), false);
14
- assert.equal(isContainerToken(null), false);
15
- assert.equal(isContainerToken(123), false);
16
- assert.equal(isContainerToken({}), false);
17
- });