@bitakit/core 0.1.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 +21 -0
- package/README.md +382 -0
- package/discovery/entries.mjs +124 -0
- package/discovery/generate.mjs +327 -0
- package/discovery/host.mjs +12 -0
- package/discovery/index.d.ts +41 -0
- package/discovery/index.mjs +4 -0
- package/discovery/modules.mjs +13 -0
- package/discovery/packages.mjs +57 -0
- package/discovery/watch.mjs +23 -0
- package/dist/actions/action-list.d.ts +69 -0
- package/dist/actions/action-list.js +247 -0
- package/dist/actions/action.d.ts +96 -0
- package/dist/actions/action.js +145 -0
- package/dist/actions/base/url-action.d.ts +8 -0
- package/dist/actions/base/url-action.js +15 -0
- package/dist/actions/core.d.ts +14 -0
- package/dist/actions/core.js +8 -0
- package/dist/actions/dependencies.d.ts +8 -0
- package/dist/actions/dependencies.js +34 -0
- package/dist/actions/execution.d.ts +4 -0
- package/dist/actions/execution.js +64 -0
- package/dist/actions/feedback.d.ts +17 -0
- package/dist/actions/feedback.js +21 -0
- package/dist/actions/groups.d.ts +13 -0
- package/dist/actions/groups.js +21 -0
- package/dist/actions/instance-bindings.d.ts +16 -0
- package/dist/actions/instance-bindings.js +93 -0
- package/dist/actions/interceptors.d.ts +24 -0
- package/dist/actions/interceptors.js +42 -0
- package/dist/actions/navigation.d.ts +12 -0
- package/dist/actions/navigation.js +42 -0
- package/dist/actions/reference.d.ts +17 -0
- package/dist/actions/reference.js +39 -0
- package/dist/actions/state.d.ts +11 -0
- package/dist/actions/state.js +8 -0
- package/dist/actions/types.d.ts +99 -0
- package/dist/actions/types.js +1 -0
- package/dist/app/access.d.ts +4 -0
- package/dist/app/access.js +85 -0
- package/dist/app/action-access.d.ts +4 -0
- package/dist/app/action-access.js +20 -0
- package/dist/app/service-error.d.ts +8 -0
- package/dist/app/service-error.js +19 -0
- package/dist/app/types.d.ts +47 -0
- package/dist/app/types.js +1 -0
- package/dist/config-service.d.ts +49 -0
- package/dist/config-service.js +83 -0
- package/dist/configuration.d.ts +4 -0
- package/dist/configuration.js +42 -0
- package/dist/confirmation.d.ts +14 -0
- package/dist/confirmation.js +26 -0
- package/dist/contracts.d.ts +27 -0
- package/dist/contracts.js +3 -0
- package/dist/contribution-origin.d.ts +3 -0
- package/dist/contribution-origin.js +13 -0
- package/dist/contributions/command.d.ts +8 -0
- package/dist/contributions/command.js +50 -0
- package/dist/contributions/dialog.d.ts +8 -0
- package/dist/contributions/dialog.js +18 -0
- package/dist/contributions/form.d.ts +10 -0
- package/dist/contributions/form.js +67 -0
- package/dist/contributions/host.d.ts +40 -0
- package/dist/contributions/host.js +1 -0
- package/dist/contributions/index.d.ts +26 -0
- package/dist/contributions/index.js +18 -0
- package/dist/contributions/native.d.ts +11 -0
- package/dist/contributions/native.js +87 -0
- package/dist/contributions/shared.d.ts +19 -0
- package/dist/contributions/shared.js +48 -0
- package/dist/contributions/stateful-action.d.ts +29 -0
- package/dist/contributions/stateful-action.js +33 -0
- package/dist/conventions.d.ts +4 -0
- package/dist/conventions.js +38 -0
- package/dist/core.d.ts +21 -0
- package/dist/core.js +18 -0
- package/dist/definitions.d.ts +356 -0
- package/dist/definitions.js +60 -0
- package/dist/discovered.d.ts +49 -0
- package/dist/discovered.js +120 -0
- package/dist/interceptors/service-observers.d.ts +3 -0
- package/dist/interceptors/service-observers.js +80 -0
- package/dist/interceptors/service.d.ts +37 -0
- package/dist/interceptors/service.js +7 -0
- package/dist/messages.d.ts +9 -0
- package/dist/messages.js +21 -0
- package/dist/metadata.d.ts +3 -0
- package/dist/metadata.js +13 -0
- package/dist/pages.d.ts +8 -0
- package/dist/pages.js +22 -0
- package/dist/presentation.d.ts +4 -0
- package/dist/presentation.js +1 -0
- package/dist/replacements.d.ts +22 -0
- package/dist/replacements.js +54 -0
- package/dist/runtime.d.ts +88 -0
- package/dist/runtime.js +445 -0
- package/dist/scope.d.ts +34 -0
- package/dist/scope.js +78 -0
- package/dist/service-key.d.ts +13 -0
- package/dist/service-key.js +14 -0
- package/dist/services.d.ts +6 -0
- package/dist/services.js +53 -0
- package/dist/translation.d.ts +13 -0
- package/dist/translation.js +43 -0
- package/dist/validation.d.ts +2 -0
- package/dist/validation.js +16 -0
- package/docs/file-contributions.md +161 -0
- package/package.json +48 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { provideService } from './service-key.js';
|
|
2
|
+
import { definePlugin } from './definitions.js';
|
|
3
|
+
import { translationService } from './contracts.js';
|
|
4
|
+
/** Shared key-or-literal resolution for automatic and imperatively registered Actions. */
|
|
5
|
+
export function resolveText(translate, value, fallback = value ?? '', values) {
|
|
6
|
+
if (!value || (translate.has && !translate.has(value)))
|
|
7
|
+
return fallback;
|
|
8
|
+
try {
|
|
9
|
+
const translated = translate(value, values);
|
|
10
|
+
return typeof translated === 'string' && translated !== value ? translated : fallback;
|
|
11
|
+
}
|
|
12
|
+
catch {
|
|
13
|
+
return fallback;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
/** Adapter primitive. No locale store: the current translator delegates to its provider. */
|
|
17
|
+
export function createTranslationPlugin(initial, catalog) {
|
|
18
|
+
let current = initial;
|
|
19
|
+
let currentCatalog = catalog;
|
|
20
|
+
const listeners = new Set();
|
|
21
|
+
const translate = (key, values) => current(key, values);
|
|
22
|
+
translate.has = (key) => current.has?.(key) ?? true;
|
|
23
|
+
const service = {
|
|
24
|
+
translate,
|
|
25
|
+
getCatalog: (namespace) => currentCatalog?.(namespace),
|
|
26
|
+
subscribe(listener) {
|
|
27
|
+
listeners.add(listener);
|
|
28
|
+
return () => {
|
|
29
|
+
listeners.delete(listener);
|
|
30
|
+
};
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
return definePlugin({
|
|
34
|
+
id: 'translation',
|
|
35
|
+
services: [provideService(translationService, { create: () => service })],
|
|
36
|
+
translation: service,
|
|
37
|
+
update(next, nextCatalog = currentCatalog) {
|
|
38
|
+
current = next;
|
|
39
|
+
currentCatalog = nextCatalog;
|
|
40
|
+
listeners.forEach((listener) => listener());
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export function validateFields(fields, input) {
|
|
2
|
+
if (!input || typeof input !== 'object')
|
|
3
|
+
throw new Error('Invalid form input.');
|
|
4
|
+
const values = Object.create(null);
|
|
5
|
+
for (const [name, field] of Object.entries(fields)) {
|
|
6
|
+
const value = input[name];
|
|
7
|
+
if (typeof value !== 'string' || (field.required && !value.trim()))
|
|
8
|
+
throw new Error(`Invalid field: ${name}`);
|
|
9
|
+
if (value && field.type === 'email' && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value))
|
|
10
|
+
throw new Error(`Invalid email: ${name}`);
|
|
11
|
+
if (field.type === 'select' && !field.options?.some((option) => option.value === value))
|
|
12
|
+
throw new Error(`Invalid option: ${name}`);
|
|
13
|
+
values[name] = value;
|
|
14
|
+
}
|
|
15
|
+
return values;
|
|
16
|
+
}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
# Dateibasierte Beiträge und Config
|
|
2
|
+
|
|
3
|
+
## Verbindlicher Stand
|
|
4
|
+
|
|
5
|
+
Core erkennt Actions, Services, Interceptors und Config über dieselbe Dateipfad-Normalisierung. Die Node-Discovery generiert statische Imports; sie führt Beitragscode nicht aus. App-/Plugin-Manifeste und die Build-Konfiguration werden dagegen geladen und müssen vertrauenswürdig sein.
|
|
6
|
+
|
|
7
|
+
```text
|
|
8
|
+
actions.refresh.ts = actions/refresh.ts
|
|
9
|
+
services.logging.ts = services/logging.ts
|
|
10
|
+
interceptors.log.ts = interceptors/log.ts
|
|
11
|
+
configs.actions.refresh.ts = configs/actions/refresh.ts
|
|
12
|
+
actions.documents.publish.ts = actions/documents/publish.ts
|
|
13
|
+
= actions/documents.publish.ts
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Der erste Abschnitt bezeichnet die Beitragsart. Weitere Punkte und Ordner sind gleichwertige Pfadsegmente. `index.ts` bezeichnet die Sammlung am Elternpfad, etwa `actions/index.ts` = `actions.ts`. Bestehende Suffixe wie `refresh.action.ts`, `invite.form-action.ts` und `logging.service.ts` bleiben Migrationsaliase; `index.action.ts` bleibt ausdrücklich eine Action namens `index`.
|
|
17
|
+
|
|
18
|
+
Nur TypeScript-/TSX-Dateien mit Default-Export werden importiert. Der TypeScript-Parser erkennt diese Exporte, ohne die Module auszuführen. Hilfsdateien ohne Default-Export sowie Pfadsegmente mit führendem `-` werden nicht registriert. `.d.ts` und `server`-Pfadsegmente sind ausgeschlossen. Diese Erkennung ersetzt keine Prüfung transitiver Imports durch das jeweilige Framework: Ein Client-Beitrag darf weiterhin keinen Server-Code importieren. Es gibt noch keine generische Server-Discovery.
|
|
19
|
+
|
|
20
|
+
Each immediate folder under `src/plugins` defines a local plugin; `plugin.config.ts` is optional and overrides the inferred folder ID. Explicit nested plugin manifests retain their own boundaries. Symlinks are rejected. `foundation.config.ts` can customize the plugin root and explicit directories. Public service names use the relative service path or explicit ID, while internal service keys retain their module namespace.
|
|
21
|
+
|
|
22
|
+
## Modul und IDs
|
|
23
|
+
|
|
24
|
+
```ts
|
|
25
|
+
// src/plugins/content/plugin.config.ts
|
|
26
|
+
export default { id: 'content' };
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
`actions.refresh.ts` erzeugt `content.refresh`; `services.logging.ts` erzeugt `content.logging`. Explizite Action-/Service-IDs bleiben vorrangig, insbesondere geteilte `serviceKey`-Verträge. Bei Services ohne explizite ID kann `defineService({ create })` verwendet werden. Manuelle Plugin-Registrierung benötigt weiterhin vollständige Service-Definitionen mit ID.
|
|
30
|
+
|
|
31
|
+
Auch die App verwendet dieselben Beiträge unter `src` (änderbar mit `directory`). Mit `src/plugin.config.ts` und `{ id: 'app' }` entstehen IDs wie `app.refresh`. Ohne App-Manifest bleiben bestehende App-IDs ohne Präfix erhalten; ihr Config-Modul heißt intern `@foundation/app`. Das optionale App-Manifest legt derzeit die Modul-ID fest; Host-Auswahl und Verzeichnisse werden weiterhin in `foundation.config.ts` konfiguriert.
|
|
32
|
+
|
|
33
|
+
Eine explizite Action-ID verändert nicht den entdeckten Config-Pfad. Bei manueller Registrierung ohne Discovery kann `configPath: ['refresh']` den lokalen Pfad vorgeben; andernfalls werden die Segmente der expliziten ID verwendet. Eine registrierte globale ID wird niemals zur nachträglichen Ermittlung eines Plugin-Präfixes zerlegt.
|
|
34
|
+
|
|
35
|
+
## Sammlung oder Einzeldateien
|
|
36
|
+
|
|
37
|
+
```ts
|
|
38
|
+
// actions.ts
|
|
39
|
+
export default {
|
|
40
|
+
refresh: defineAction({ execute: () => 'refreshed' }),
|
|
41
|
+
publish: defineAction({ execute: () => 'published' }),
|
|
42
|
+
};
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Dies entspricht zwei Dateien `actions.refresh.ts` und `actions.publish.ts`. Verschachtelte Sammlungen sind erlaubt. Services verwenden Definitionen mit `create`, Interceptors `before` oder `create`. Ein direkt exportierter Interceptor-Handler wird als `before` normalisiert. Eine Action-Funktion bleibt entsprechend der bestehenden API eine Factory, die eine `Action`-Instanz zurückgibt; sie wird nicht als Execute-Handler interpretiert. Klassen bleiben `Action`-Unterklassen.
|
|
46
|
+
|
|
47
|
+
Die Define-Helfer bleiben sinnvoll für Callback-Typen und besondere Action-Funktionen. Ein einfaches Action-Objekt mit `execute` wird auch ohne Helper normalisiert. Nicht jede Beitragsart unterstützt jede Exportform; reine Config-Klassen und Decorators sind noch nicht implementiert.
|
|
48
|
+
|
|
49
|
+
Sammlungen und Einzeldateien dürfen unterschiedliche Einträge liefern. Doppelte logische Einträge sind Fehler, auch wenn die Schreibweisen verschieden sind. Fehler nennen die Quellen. Config-Teilbäume werden zusammengefügt; derselbe Blattwert oder ein Skalar anstelle eines Teilbaums darf nicht zweimal definiert werden. Absichtliche Overrides sind ein eigener Schritt.
|
|
50
|
+
|
|
51
|
+
## Konfiguration und Nutzung
|
|
52
|
+
|
|
53
|
+
```ts
|
|
54
|
+
// configs.ts
|
|
55
|
+
export default {
|
|
56
|
+
pageSize: 20,
|
|
57
|
+
actions: {
|
|
58
|
+
refresh: { pageSize: 50 },
|
|
59
|
+
publish: { pageSize: 5 },
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Alternativ enthalten `configs.actions.refresh.ts` und `configs.actions.publish.ts` die jeweiligen `{ pageSize }`-Objekte. `configs.ts` enthält dann nur den allgemeinen Wert. `configs.refresh.ts` ist ausdrücklich ein anderer Pfad: `refresh`, nicht `actions.refresh`.
|
|
65
|
+
|
|
66
|
+
```ts
|
|
67
|
+
// actions.refresh.ts
|
|
68
|
+
import { defineAction } from '@bitakit/core';
|
|
69
|
+
export default defineAction({
|
|
70
|
+
execute({ config }) {
|
|
71
|
+
return {
|
|
72
|
+
shared: config.plugin.get('pageSize', 20),
|
|
73
|
+
own: config.action.get('pageSize', 50),
|
|
74
|
+
};
|
|
75
|
+
},
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
// services.logging.ts
|
|
79
|
+
import { defineService } from '@bitakit/core';
|
|
80
|
+
export default defineService({
|
|
81
|
+
create({ config }) {
|
|
82
|
+
const pageSize = config.plugin.get('pageSize', 20);
|
|
83
|
+
return { pageSize };
|
|
84
|
+
},
|
|
85
|
+
});
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Der Plugin-Scope zeigt auf die aufgelöste Modul-Konfiguration. Der Action-Scope zeigt auf `actions.<lokaler Action-Pfad>` desselben Baums. Es gibt keinen impliziten Fallback zum allgemeinen Plugin-Wert und keinen globalen „current action“-Zustand. Beide Scopes werden auch an Action-Factories und Klassen-Konstruktoren über `ActionEnvironment` übergeben. Dienste erhalten den Plugin-Scope bei `create`. Config wird vor dem Erzeugen der Services aufgelöst.
|
|
89
|
+
|
|
90
|
+
`get('actions.refresh')` kann einen kompletten Teilbaum liefern. Ein Segmentarray adressiert literal benannte Schlüssel. Standardmäßig ist ein unbekannter Zugriff `unknown`; ein Fallback liefert einen nutzbaren Typ, stellt aber keine Laufzeitvalidierung dar. Für eine ausdrücklich typisierte Sicht gibt es `ConfigScope<T>` beziehungsweise `runtime.configuration.plugin<T>(id)`.
|
|
91
|
+
|
|
92
|
+
Discovery erzeugt `ConfigMap`, `ServiceMap` und `ActionMap` auch für Sammlungen. `runtime.configuration.plugin('content')` erhält dadurch den entdeckten Config-Typ. Die automatische Runtime-Zuordnung typisiert jedoch nicht magisch den Parameter einer frei exportierten Funktion. Hier weiterhin Helfer oder Annotationen verwenden. Klassen-/Factory-Action-IDs werden wie bisher nicht automatisch in die `ActionMap` aufgenommen.
|
|
93
|
+
|
|
94
|
+
## Overrides und optionale Schemas
|
|
95
|
+
|
|
96
|
+
```ts
|
|
97
|
+
// foundation.config.ts (Build-Komposition)
|
|
98
|
+
export default {
|
|
99
|
+
configOverrides: {
|
|
100
|
+
content: { actions: { refresh: { pageSize: 100 } } },
|
|
101
|
+
},
|
|
102
|
+
};
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Dasselbe Feld ist bei manueller `FoundationConfig` verfügbar. Objekte werden rekursiv überschrieben, Arrays ersetzt und `undefined` übernimmt den Default. `null` ist ein ausdrücklicher Wert. Nur Config-Overrides, nicht doppelte Quelldefinitionen, verwenden diese Regel. Unbekannte Modulnamen in Overrides werden abgewiesen. Discovery und `resolveFoundationConfig` entfernen Overrides bekannter deaktivierter beziehungsweise abgewählter Plugins zusammen mit deren Beiträgen.
|
|
106
|
+
|
|
107
|
+
```ts
|
|
108
|
+
// configs.actions.refresh.ts
|
|
109
|
+
import { defineConfig } from '@bitakit/core';
|
|
110
|
+
import { z } from 'zod';
|
|
111
|
+
|
|
112
|
+
export default defineConfig({
|
|
113
|
+
schema: z.object({ pageSize: z.number().int().positive().default(50) }),
|
|
114
|
+
});
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Schema-Bibliotheken bleiben optional beim Verbraucher. Core akzeptiert einen synchronen `parse(unknown)`-Vertrag und ruft ihn auf den zusammengeführten Werten auf. Eine Root-Schema-Definition muss die vollständige Config besitzen; sie wird nicht zusätzlich mit Config-Dateien zusammengesetzt. Alternativ können einzelne Teilbäume eigene Schemas tragen. Ein Validierungsfehler verhindert Service-Erstellung und Action-Registrierung.
|
|
118
|
+
|
|
119
|
+
Config ist ein eingefrorener Snapshot pro Runtime, für Plain Objects, Arrays und primitive Werte. Keine Laufzeit-Schreib-API, keine automatische Service-Neuerstellung. Der React-Hook `usePluginConfig(moduleId, path[, fallback])` liest denselben Snapshot und erhält bei Austausch der Provider-Komposition einen neuen Stand; er verspricht keine Updates durch Mutation. Implizites `useConfig` ohne Modul-Kontext wird noch nicht angeboten. Bestätigte Benutzerpräferenzen gehören weiter zu `AppPreferences`.
|
|
120
|
+
|
|
121
|
+
## Interceptors
|
|
122
|
+
|
|
123
|
+
Plugin-Interceptors gelten standardmäßig nur für registrierte Actions ihres Plugins, einschließlich interner Formular-Submits. `scope: 'global'` erweitert dies ausdrücklich. Host-Interceptors bleiben aus Kompatibilitätsgründen standardmäßig global; `scope: 'plugin'` begrenzt sie auf das App-Modul. `before` bekommt den Config-Scope der ausgeführten Action. Factory-`create` bekommt den Scope des besitzenden Moduls.
|
|
124
|
+
|
|
125
|
+
`order` sortiert aufsteigend; Gleichstände behalten die Registrierungsreihenfolge. Fachlich notwendige Reihenfolgen ausdrücklich angeben. App-Discovery aktiviert ohne `interceptors.enabled` alle erkannten Interceptors; ein angegebenes Array wählt sie ausdrücklich aus, `[]` deaktiviert sie. Vorhandene Listen bleiben erhalten. React-Provider werden weiterhin über eine explizite `enabled`-Liste ausgewählt.
|
|
126
|
+
|
|
127
|
+
## Interne Erweiterungspunkte
|
|
128
|
+
|
|
129
|
+
- `discovery/entries.mjs`: eine Dateierfassung, ein Pfad-Normalisierer, Default-Export-Erkennung für alle Arten.
|
|
130
|
+
- `discovery/generate.mjs`: Komposition der Module und statische Imports/Typen.
|
|
131
|
+
- `src/discovered.ts`: Sammlungen auflösen und in vorhandene Verträge normalisieren.
|
|
132
|
+
- `src/config-service.ts`: Auflösung, optionale Schemas und unveränderliche Scopes.
|
|
133
|
+
- `src/contributions`: bestehende Action-Adapter; sie erhalten den zugeordneten Config-Kontext ausdrücklich.
|
|
134
|
+
- `src/runtime.ts`: Lebenszyklus und Integration, kein Dateiscanner.
|
|
135
|
+
|
|
136
|
+
Für weitere Arten den Kind-Katalog, Normalisierung und Generierung erweitern, nicht erneut Dateien durchsuchen. Ein öffentliches dynamisches Adapter-Plugin-API ist noch nicht implementiert. Pages und Views verwenden dieselbe Pfaderkennung, behalten aber ihre bisherigen Einzeldefinitionen; Sammeldateien sind dafür noch nicht vorgesehen.
|
|
137
|
+
|
|
138
|
+
Zurückgestellt: Decorators, YAML, Remote-Konfiguration, reaktive Config-Updates und automatische UI-Bindungen, Server-Discovery, sowie Co-Location wie `actions/publish/action.ts` plus `config.ts`. Unter der aktuellen Grammatik hätten diese Dateien gewöhnliche zusätzliche Pfadsegmente; sie sind keine Spezialkonvention.
|
|
139
|
+
|
|
140
|
+
## Prüfung und Migration
|
|
141
|
+
|
|
142
|
+
`npm test --workspace @bitakit/core` prüft Runtime, Typverträge, Isolation, Config und die gemeinsame Discovery. Die Tests im Next-Paket prüfen weiterhin Generator- und Watcher-Integration. Vor der Migration vorhandene Hilfsdateien mit Default-Export aus Beitragsordnern verschieben oder mit `-` ausschließen. Alte Suffix-Dateien und neue äquivalente Pfade dürfen nicht gleichzeitig denselben Beitrag definieren. Automatisch erzeugte IDs ändern sich nur bei einer Änderung des logischen Pfads.
|
|
143
|
+
|
|
144
|
+
## Root application lifecycle
|
|
145
|
+
|
|
146
|
+
The root application may declare dependencies and metadata in src/plugin.config.ts. Its discovered pages and views are rendered alongside plugin contributions. Root setup.ts participates in dependency ordering and reverse cleanup. The app is not listed as a removable plugin and does not require a nested plugins directory. Root page/view support is an optional runtime capability, not a recommendation to replace host routing. In Next.js, app-owned pages and layouts use src/app/**/page.tsx and layout.tsx. Only independent plugin pages use Discovery through the host catch-all; do not create root pages.*.tsx files for app routes.
|
|
147
|
+
|
|
148
|
+
## Direct configuration access
|
|
149
|
+
|
|
150
|
+
`app.config.documents.editor.pageSize` reads the existing immutable module snapshot.
|
|
151
|
+
A config file may export `defineConfig({ defaults: { pageSize: 20 } })` without a schema.
|
|
152
|
+
Schemas remain optional. Scoped callback access and runtime.configuration are unchanged.
|
|
153
|
+
|
|
154
|
+
## Mixed interceptor collections
|
|
155
|
+
|
|
156
|
+
`interceptors/` accepts Action and Service definitions in one default export, including named
|
|
157
|
+
object collections and arrays. `interceptors/actions/save.ts` and
|
|
158
|
+
`interceptors/actions.save.ts` have the same organizational path; it does not determine the kind.
|
|
159
|
+
Use defineActionInterceptor or defineServiceInterceptor to set that discriminator automatically.
|
|
160
|
+
The legacy defineInterceptor remains an Action definition. Service observers can select one method
|
|
161
|
+
or all methods; see the Core README for lifecycle and observation boundaries.
|
package/package.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@bitakit/core",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"sideEffects": false,
|
|
6
|
+
"files": [
|
|
7
|
+
"dist",
|
|
8
|
+
"README.md",
|
|
9
|
+
"discovery",
|
|
10
|
+
"docs"
|
|
11
|
+
],
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"types": "./dist/core.d.ts",
|
|
15
|
+
"default": "./dist/core.js"
|
|
16
|
+
},
|
|
17
|
+
"./actions": {
|
|
18
|
+
"types": "./dist/actions/core.d.ts",
|
|
19
|
+
"default": "./dist/actions/core.js"
|
|
20
|
+
},
|
|
21
|
+
"./discovery": {
|
|
22
|
+
"types": "./discovery/index.d.ts",
|
|
23
|
+
"default": "./discovery/index.mjs"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"scripts": {
|
|
27
|
+
"build": "tsc -p tsconfig.json",
|
|
28
|
+
"test": "npm run build && tsc -p tsconfig.test.json && node --test tests/*.test.mjs action-tests/*.test.mjs",
|
|
29
|
+
"prepack": "npm run build",
|
|
30
|
+
"dev": "tsc -p tsconfig.json --watch"
|
|
31
|
+
},
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"jiti": "^2.7.0",
|
|
34
|
+
"typescript": "^5.9.3",
|
|
35
|
+
"zustand": "^5.0.0"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {},
|
|
38
|
+
"description": "Framework-independent Foundation runtime, actions, and typed services.",
|
|
39
|
+
"license": "MIT",
|
|
40
|
+
"repository": {
|
|
41
|
+
"type": "git",
|
|
42
|
+
"url": "git+https://github.com/mvavesal/bitakit.git",
|
|
43
|
+
"directory": "packages/core"
|
|
44
|
+
},
|
|
45
|
+
"publishConfig": {
|
|
46
|
+
"access": "public"
|
|
47
|
+
}
|
|
48
|
+
}
|