@svadmin/app 0.2.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/README.md +40 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.js +24 -0
- package/package.json +58 -0
package/README.md
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# @svadmin/app
|
|
2
|
+
|
|
3
|
+
Application composition layer for svadmin.
|
|
4
|
+
|
|
5
|
+
[`@svadmin/core`](https://www.npmjs.com/package/@svadmin/core) owns contracts and
|
|
6
|
+
runtime hooks; `@svadmin/app` owns how an application is assembled:
|
|
7
|
+
|
|
8
|
+
- `defineAdminConfig` / `defineSvadminPlugin` — typed application config and
|
|
9
|
+
machine-readable plugin manifests.
|
|
10
|
+
- `resolveAdminConfig` / `assertAdminConfig` — fold plugin contributions into a
|
|
11
|
+
deterministic snapshot plus diagnostics.
|
|
12
|
+
- `createAdminApp` — one-call convenience returning the provider bundle and
|
|
13
|
+
normalized resource definitions.
|
|
14
|
+
- `provideAdminConfig` — install the resolved config into the scoped
|
|
15
|
+
`AdminContext`.
|
|
16
|
+
- `buildAdminManifest` — serialize the resolved config into the stable
|
|
17
|
+
`svadmin.ai.json` entrypoint that AI tooling and `svadmin doctor` read.
|
|
18
|
+
- `createProviderBundle` — first-class provider configuration object.
|
|
19
|
+
|
|
20
|
+
## Install
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
bun add @svadmin/app @svadmin/core
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Usage
|
|
27
|
+
|
|
28
|
+
```ts
|
|
29
|
+
import { createAdminApp, defineAdminConfig } from '@svadmin/app';
|
|
30
|
+
|
|
31
|
+
export const app = defineAdminConfig({
|
|
32
|
+
name: 'my-admin',
|
|
33
|
+
providers: createProviderBundle({ dataProvider }),
|
|
34
|
+
resources: [ordersDefinition],
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
export default createAdminApp(app);
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
See `docs/architecture/admin-platform.md` for the full platform model.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @svadmin/app — the application composition layer.
|
|
3
|
+
*
|
|
4
|
+
* Curated public surface over `@svadmin/core` for application wiring:
|
|
5
|
+
* `defineAdminConfig`, plugin manifests, runtime binding, AI manifest building,
|
|
6
|
+
* and the `createAdminApp` convenience. Keep app-level additions here so core
|
|
7
|
+
* can stay a lean contracts/runtime package.
|
|
8
|
+
*/
|
|
9
|
+
export { defineAdminConfig, defineSvadminPlugin, resolveAdminConfig, assertAdminConfig, toAdminContextSource, normalizeAdminResource, buildAdminManifest, provideAdminConfig, provideResourceScope, createProviderBundle, } from '@svadmin/core';
|
|
10
|
+
export type { AdminConfig, AdminConfigDiagnostic, AdminConfigDiagnosticCode, AdminConfigInput, AdminManifest, AdminManifestField, AdminManifestPlugin, AdminManifestProject, AdminManifestResource, AdminPluginCapability, AdminPluginContribution, AdminPluginDescriptor, AdminPluginDocs, AdminResourceDefinition, AdminResourceInput, ProviderBundle, ResolvedAdminConfig, ResolvedAdminContextSource, ResourceScope, } from '@svadmin/core';
|
|
11
|
+
import { type AdminConfig, type ProviderBundle, type ResourceDefinition, type ResolvedAdminConfig } from '@svadmin/core';
|
|
12
|
+
/** Runtime inputs derived from an application config. */
|
|
13
|
+
export interface AdminAppBundle {
|
|
14
|
+
readonly config: ResolvedAdminConfig;
|
|
15
|
+
readonly providers: ProviderBundle;
|
|
16
|
+
readonly resources: readonly ResourceDefinition[];
|
|
17
|
+
readonly diagnostics: ResolvedAdminConfig['diagnostics'];
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Resolves an application config once and exposes the provider bundle plus the
|
|
21
|
+
* normalized resource definitions. Inspect `diagnostics` before rendering; use
|
|
22
|
+
* `assertAdminConfig` when errors should throw at startup.
|
|
23
|
+
*/
|
|
24
|
+
export declare function createAdminApp(config: AdminConfig): AdminAppBundle;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @svadmin/app — the application composition layer.
|
|
3
|
+
*
|
|
4
|
+
* Curated public surface over `@svadmin/core` for application wiring:
|
|
5
|
+
* `defineAdminConfig`, plugin manifests, runtime binding, AI manifest building,
|
|
6
|
+
* and the `createAdminApp` convenience. Keep app-level additions here so core
|
|
7
|
+
* can stay a lean contracts/runtime package.
|
|
8
|
+
*/
|
|
9
|
+
export { defineAdminConfig, defineSvadminPlugin, resolveAdminConfig, assertAdminConfig, toAdminContextSource, normalizeAdminResource, buildAdminManifest, provideAdminConfig, provideResourceScope, createProviderBundle, } from '@svadmin/core';
|
|
10
|
+
import { resolveAdminConfig, } from '@svadmin/core';
|
|
11
|
+
/**
|
|
12
|
+
* Resolves an application config once and exposes the provider bundle plus the
|
|
13
|
+
* normalized resource definitions. Inspect `diagnostics` before rendering; use
|
|
14
|
+
* `assertAdminConfig` when errors should throw at startup.
|
|
15
|
+
*/
|
|
16
|
+
export function createAdminApp(config) {
|
|
17
|
+
const resolved = resolveAdminConfig(config);
|
|
18
|
+
return {
|
|
19
|
+
config: resolved,
|
|
20
|
+
providers: resolved.providers,
|
|
21
|
+
resources: resolved.resources,
|
|
22
|
+
diagnostics: resolved.diagnostics,
|
|
23
|
+
};
|
|
24
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@svadmin/app",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "Application composition layer for svadmin — defineAdminConfig, plugins, runtime binding, and the AI manifest",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"svadmin",
|
|
9
|
+
"admin",
|
|
10
|
+
"svelte",
|
|
11
|
+
"application",
|
|
12
|
+
"plugin",
|
|
13
|
+
"ai"
|
|
14
|
+
],
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "git+https://github.com/vibeunion/svadmin.git",
|
|
18
|
+
"directory": "packages/app"
|
|
19
|
+
},
|
|
20
|
+
"sideEffects": false,
|
|
21
|
+
"svadmin": {
|
|
22
|
+
"capabilities": [
|
|
23
|
+
"app-config",
|
|
24
|
+
"plugin-registry",
|
|
25
|
+
"runtime-binding",
|
|
26
|
+
"ai-manifest"
|
|
27
|
+
],
|
|
28
|
+
"core": "^0.55.0",
|
|
29
|
+
"stability": "experimental",
|
|
30
|
+
"migration": null
|
|
31
|
+
},
|
|
32
|
+
"exports": {
|
|
33
|
+
".": {
|
|
34
|
+
"types": "./dist/index.d.ts",
|
|
35
|
+
"import": "./dist/index.js"
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"main": "./dist/index.js",
|
|
39
|
+
"types": "./dist/index.d.ts",
|
|
40
|
+
"files": [
|
|
41
|
+
"dist",
|
|
42
|
+
"README.md"
|
|
43
|
+
],
|
|
44
|
+
"peerDependencies": {
|
|
45
|
+
"@svadmin/core": "^0.57.0"
|
|
46
|
+
},
|
|
47
|
+
"peerDependenciesMeta": {
|
|
48
|
+
"@svadmin/core": {
|
|
49
|
+
"optional": true
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
"devDependencies": {
|
|
53
|
+
"typescript": "^7.0.2"
|
|
54
|
+
},
|
|
55
|
+
"scripts": {
|
|
56
|
+
"build": "bun ../../scripts/build-node-package.ts"
|
|
57
|
+
}
|
|
58
|
+
}
|