@fayz-ai/sdk 0.9.0-next.1 → 0.10.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 +2 -2
- package/dist/ai-builder.js +1 -1
- package/dist/{chunk-2YJXKDHO.js → chunk-6UZOXHGJ.js} +11 -6
- package/dist/chunk-6UZOXHGJ.js.map +1 -0
- package/dist/{chunk-V4GWI7WH.js → chunk-7UXTYT6I.js} +65 -4
- package/dist/chunk-7UXTYT6I.js.map +1 -0
- package/dist/{chunk-7XM4LONE.js → chunk-BJFMBVMP.js} +2 -2
- package/dist/chunk-BJFMBVMP.js.map +1 -0
- package/dist/chunk-HA5O3CW7.js +181 -0
- package/dist/chunk-HA5O3CW7.js.map +1 -0
- package/dist/chunk-VRUPJGFZ.js +135 -0
- package/dist/chunk-VRUPJGFZ.js.map +1 -0
- package/dist/deprecations.d.ts +98 -0
- package/dist/deprecations.d.ts.map +1 -0
- package/dist/deprecations.js +3 -0
- package/dist/deprecations.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -4
- package/dist/release-channels.js +1 -1
- package/dist/shop.d.ts +32 -0
- package/dist/shop.d.ts.map +1 -1
- package/dist/shop.js +2 -1
- package/dist/supported-surface.d.ts +8 -1
- package/dist/supported-surface.d.ts.map +1 -1
- package/dist/supported-surface.js +1 -1
- package/dist/vite.d.ts +30 -1
- package/dist/vite.d.ts.map +1 -1
- package/dist/vite.js +10 -2
- package/dist/vite.js.map +1 -1
- package/package.json +7 -14
- package/dist/chunk-2YJXKDHO.js.map +0 -1
- package/dist/chunk-7XM4LONE.js.map +0 -1
- package/dist/chunk-V4GWI7WH.js.map +0 -1
- package/dist/chunk-YZQW3BJA.js +0 -135
- package/dist/chunk-YZQW3BJA.js.map +0 -1
- package/src/agent.test.ts +0 -114
- package/src/agent.ts +0 -335
- package/src/ai-builder.ts +0 -115
- package/src/app-params.ts +0 -69
- package/src/client.test.ts +0 -176
- package/src/client.ts +0 -229
- package/src/index.ts +0 -94
- package/src/release-channels.json +0 -103
- package/src/release-channels.test.ts +0 -41
- package/src/release-channels.ts +0 -41
- package/src/runtime.test.ts +0 -123
- package/src/runtime.ts +0 -211
- package/src/shop.test.ts +0 -114
- package/src/shop.ts +0 -1118
- package/src/supported-surface.json +0 -40
- package/src/supported-surface.ts +0 -33
- package/src/types.ts +0 -67
- package/src/vite.ts +0 -121
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"surfaceVersion": 1,
|
|
3
|
-
"description": "Packages a generated Fayz app may depend on. fayz doctor warns on any app dependency outside this list. See docs/ARCHITECTURE.md (boundary model).",
|
|
4
|
-
"tiers": {
|
|
5
|
-
"stable": "semver-tracked, supported public API"
|
|
6
|
-
},
|
|
7
|
-
"supported": {
|
|
8
|
-
"@fayz-ai/auth": "stable",
|
|
9
|
-
"@fayz-ai/core": "stable",
|
|
10
|
-
"@fayz-ai/courses": "stable",
|
|
11
|
-
"@fayz-ai/db": "stable",
|
|
12
|
-
"@fayz-ai/portal": "stable",
|
|
13
|
-
"@fayz-ai/saas": "stable",
|
|
14
|
-
"@fayz-ai/sdk": "stable",
|
|
15
|
-
"@fayz-ai/shop": "stable",
|
|
16
|
-
"@fayz-ai/storefront": "stable",
|
|
17
|
-
"@fayz-ai/ui": "stable",
|
|
18
|
-
"@fayz-ai/plugin-agenda": "stable",
|
|
19
|
-
"@fayz-ai/plugin-automations": "stable",
|
|
20
|
-
"@fayz-ai/plugin-conversations": "stable",
|
|
21
|
-
"@fayz-ai/plugin-courses": "stable",
|
|
22
|
-
"@fayz-ai/plugin-crm": "stable",
|
|
23
|
-
"@fayz-ai/plugin-dashboard": "stable",
|
|
24
|
-
"@fayz-ai/plugin-financial": "stable",
|
|
25
|
-
"@fayz-ai/plugin-forms": "stable",
|
|
26
|
-
"@fayz-ai/plugin-inventory": "stable",
|
|
27
|
-
"@fayz-ai/plugin-marketing": "stable",
|
|
28
|
-
"@fayz-ai/plugin-menu": "stable",
|
|
29
|
-
"@fayz-ai/plugin-orders": "stable",
|
|
30
|
-
"@fayz-ai/plugin-reports": "stable",
|
|
31
|
-
"@fayz-ai/plugin-reputation": "stable",
|
|
32
|
-
"@fayz-ai/plugin-shop": "stable",
|
|
33
|
-
"@fayz-ai/plugin-sites": "stable",
|
|
34
|
-
"@fayz-ai/plugin-tables": "stable",
|
|
35
|
-
"@fayz-ai/plugin-tasks": "stable"
|
|
36
|
-
},
|
|
37
|
-
"internal": [
|
|
38
|
-
"@fayz-ai/app-runtime"
|
|
39
|
-
]
|
|
40
|
-
}
|
package/src/supported-surface.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import supportedSurface from './supported-surface.json'
|
|
2
|
-
|
|
3
|
-
export type FayzPackageTier = 'stable'
|
|
4
|
-
|
|
5
|
-
export interface FayzSupportedSurface {
|
|
6
|
-
surfaceVersion: number
|
|
7
|
-
supported: Record<string, FayzPackageTier>
|
|
8
|
-
internal: string[]
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
const surface = supportedSurface as unknown as FayzSupportedSurface
|
|
12
|
-
|
|
13
|
-
/** Every package a generated Fayz app is allowed to depend on (the public surface). */
|
|
14
|
-
export function getSupportedPackages(): string[] {
|
|
15
|
-
return Object.keys(surface.supported)
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
/** Packages that exist but are NOT part of the public surface (deprecated/internal). */
|
|
19
|
-
export function getInternalPackages(): string[] {
|
|
20
|
-
return [...surface.internal]
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* True when `packageName` is part of the supported public surface. Used by
|
|
25
|
-
* `fayz doctor` to warn (never fail) when an app depends on something off-surface.
|
|
26
|
-
* Non-Fayz packages (no `@fayz-ai/` prefix) are out of scope and return true.
|
|
27
|
-
*/
|
|
28
|
-
export function isSupportedPackage(packageName: string): boolean {
|
|
29
|
-
if (!packageName.startsWith('@fayz-ai/')) return true
|
|
30
|
-
return packageName in surface.supported
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export { surface as fayzSupportedSurface }
|
package/src/types.ts
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
export type FayzRuntimeEnvironment = 'preview' | 'production'
|
|
2
|
-
|
|
3
|
-
export interface FayzUser {
|
|
4
|
-
id: string
|
|
5
|
-
email?: string | null
|
|
6
|
-
name?: string | null
|
|
7
|
-
avatarUrl?: string | null
|
|
8
|
-
isGuest?: boolean
|
|
9
|
-
createdAt?: string
|
|
10
|
-
updatedAt?: string
|
|
11
|
-
[key: string]: unknown
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export interface FayzAuthMeResponse {
|
|
15
|
-
user: FayzUser
|
|
16
|
-
impersonation?: unknown
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export interface FayzApiErrorBody {
|
|
20
|
-
message?: string
|
|
21
|
-
error?: string
|
|
22
|
-
code?: string
|
|
23
|
-
[key: string]: unknown
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export interface FayzAppParams {
|
|
27
|
-
appId?: string
|
|
28
|
-
apiBaseUrl: string
|
|
29
|
-
token?: string
|
|
30
|
-
projectId?: string
|
|
31
|
-
environment: FayzRuntimeEnvironment
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export interface AppManifest {
|
|
35
|
-
manifestVersion: number
|
|
36
|
-
id: string
|
|
37
|
-
name: string
|
|
38
|
-
backend?: { provider?: string; [key: string]: unknown }
|
|
39
|
-
locale?: Record<string, unknown>
|
|
40
|
-
theme?: Record<string, unknown>
|
|
41
|
-
permissions?: Record<string, unknown>
|
|
42
|
-
billing?: Record<string, unknown>
|
|
43
|
-
entities?: unknown[]
|
|
44
|
-
surfaces?: Record<string, SurfaceManifest>
|
|
45
|
-
[key: string]: unknown
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export interface SurfaceManifest {
|
|
49
|
-
scaffold: string
|
|
50
|
-
options?: Record<string, unknown>
|
|
51
|
-
plugins?: PluginRef[]
|
|
52
|
-
pages?: PageManifest[]
|
|
53
|
-
[key: string]: unknown
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export interface PluginRef {
|
|
57
|
-
id: string
|
|
58
|
-
config?: Record<string, unknown>
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export interface PageManifest {
|
|
62
|
-
path: string
|
|
63
|
-
label?: string
|
|
64
|
-
component?: string
|
|
65
|
-
blocks?: unknown[]
|
|
66
|
-
[key: string]: unknown
|
|
67
|
-
}
|
package/src/vite.ts
DELETED
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
import { existsSync } from 'node:fs'
|
|
2
|
-
import { resolve } from 'node:path'
|
|
3
|
-
import type { UserConfig, PluginOption, AliasOptions } from 'vite'
|
|
4
|
-
|
|
5
|
-
// All publishable @fayz-ai/* packages (root src). Subpaths (e.g.
|
|
6
|
-
// @fayz-ai/saas/ui, @fayz-ai/storefront/catalog) resolve automatically via
|
|
7
|
-
// Vite's prefix alias matching — the shim files mirror the subpath under src/.
|
|
8
|
-
const SDK_PACKAGES = [
|
|
9
|
-
'sdk', 'core', 'auth', 'ui', 'saas', 'shop', 'storefront', 'portal', 'courses', 'db',
|
|
10
|
-
] as const
|
|
11
|
-
|
|
12
|
-
const SDK_PLUGINS = [
|
|
13
|
-
'agenda', 'auth', 'automations', 'blog', 'conversations', 'courses', 'crm', 'dashboard',
|
|
14
|
-
'financial', 'forms', 'inventory', 'marketing', 'menu', 'orders', 'payments', 'reports',
|
|
15
|
-
'reputation', 'shop', 'sites', 'tables', 'tasks',
|
|
16
|
-
] as const
|
|
17
|
-
|
|
18
|
-
export interface FayzViteOptions {
|
|
19
|
-
/** Dev server port. */
|
|
20
|
-
port?: number
|
|
21
|
-
/** Fail instead of incrementing if the port is taken. */
|
|
22
|
-
strictPort?: boolean
|
|
23
|
-
/** Extra app-specific aliases, merged after the SDK aliases. */
|
|
24
|
-
aliases?: Record<string, string>
|
|
25
|
-
/** Extra Vite plugins, appended after @vitejs/plugin-react. */
|
|
26
|
-
plugins?: PluginOption[]
|
|
27
|
-
/** SDK source location relative to the app root (default ../../fayz-sdk). */
|
|
28
|
-
sdkDir?: string
|
|
29
|
-
/** App root directory (default process.cwd()). */
|
|
30
|
-
root?: string
|
|
31
|
-
/**
|
|
32
|
-
* Extra Vite `server` config, merged over the SDK server defaults. The
|
|
33
|
-
* preview-container contract (host/cors/allowedHosts/headers) is applied
|
|
34
|
-
* first, so an override can add e.g. `proxy` without dropping it.
|
|
35
|
-
*/
|
|
36
|
-
server?: UserConfig['server']
|
|
37
|
-
/**
|
|
38
|
-
* Extra Vite `resolve` config, merged over the SDK resolve defaults. The SDK
|
|
39
|
-
* alias map / dedupe / conditions win for `@fayz-ai/*` local-source
|
|
40
|
-
* resolution; any other resolve keys (and extra aliases) are merged in.
|
|
41
|
-
*/
|
|
42
|
-
resolve?: UserConfig['resolve']
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Shared Vite config for Fayz dogfood apps. Resolves `@fayz-ai/*` from the local
|
|
47
|
-
* SDK source when it is checked out next to the app AND `FAYZ_SDK_SOURCE` is not
|
|
48
|
-
* `published`; otherwise from node_modules (the Fayz editor sandbox / published
|
|
49
|
-
* npm). Apps no longer hand-maintain alias maps or the local-vs-npm guard.
|
|
50
|
-
*
|
|
51
|
-
* import { defineConfig } from 'vite'
|
|
52
|
-
* import react from '@vitejs/plugin-react'
|
|
53
|
-
* import { fayzVite } from '@fayz-ai/sdk/vite'
|
|
54
|
-
* export default defineConfig(fayzVite({ port: 5185, plugins: [react()] }))
|
|
55
|
-
*
|
|
56
|
-
* The app passes its own `@vitejs/plugin-react` so `@fayz-ai/sdk` carries no
|
|
57
|
-
* build-tool peer deps (which otherwise choke npm's peer resolution, since sdk
|
|
58
|
-
* sits in every dependency path).
|
|
59
|
-
*/
|
|
60
|
-
export function fayzVite(opts: FayzViteOptions = {}): UserConfig {
|
|
61
|
-
const root = opts.root ?? process.cwd()
|
|
62
|
-
const fayzSdk = resolve(root, opts.sdkDir ?? '../../fayz-sdk')
|
|
63
|
-
const wantLocal = process.env.FAYZ_SDK_SOURCE !== 'published'
|
|
64
|
-
const localPresent = existsSync(resolve(fayzSdk, 'packages/core/src/index.ts'))
|
|
65
|
-
const useLocal = wantLocal && localPresent
|
|
66
|
-
|
|
67
|
-
const localAliases: Record<string, string> = {}
|
|
68
|
-
if (useLocal) {
|
|
69
|
-
for (const p of SDK_PACKAGES) localAliases[`@fayz-ai/${p}`] = resolve(fayzSdk, `packages/${p}/src`)
|
|
70
|
-
for (const p of SDK_PLUGINS) localAliases[`@fayz-ai/plugin-${p}`] = resolve(fayzSdk, `plugins/plugin-${p}/src`)
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
// Pull SDK-owned resolve keys out of any caller override so they can't clobber
|
|
74
|
-
// local-source @fayz-ai/* resolution; the rest of `resolve` is merged in.
|
|
75
|
-
const { alias: userAlias, dedupe: userDedupe, conditions: _ignore, ...restResolve } =
|
|
76
|
-
(opts.resolve ?? {}) as Exclude<UserConfig['resolve'], undefined>
|
|
77
|
-
|
|
78
|
-
return {
|
|
79
|
-
plugins: [...(opts.plugins ?? [])],
|
|
80
|
-
envPrefix: ['VITE_', 'PUBLIC_'],
|
|
81
|
-
resolve: {
|
|
82
|
-
...restResolve,
|
|
83
|
-
alias: {
|
|
84
|
-
'@': resolve(root, 'src'),
|
|
85
|
-
...localAliases,
|
|
86
|
-
...(opts.aliases ?? {}),
|
|
87
|
-
...((userAlias as Record<string, string> | undefined) ?? {}),
|
|
88
|
-
} as AliasOptions,
|
|
89
|
-
// lucide-react is a direct dep of both the app and every @fayz-ai/*
|
|
90
|
-
// package; without dedupe a version skew installs two copies and esbuild
|
|
91
|
-
// pre-bundles each barrel separately (~1,500 icon modules each).
|
|
92
|
-
// Collapsing to one copy is the single biggest cut to the editor-container
|
|
93
|
-
// optimize RAM/CPU spike. Only dedupe deps the *app* directly depends on
|
|
94
|
-
// (so they're hoisted to its root node_modules) — deduping a transitive
|
|
95
|
-
// like @tanstack/react-table makes Vite resolve it from the app root,
|
|
96
|
-
// which fails in local-source mode and 500s the aliased UI source.
|
|
97
|
-
dedupe: userDedupe ?? ['react', 'react-dom', 'zustand', 'lucide-react', 'react-router-dom', '@supabase/supabase-js', 'sonner'],
|
|
98
|
-
conditions: useLocal ? ['source', 'browser', 'module', 'jsnext:main', 'jsnext'] : undefined,
|
|
99
|
-
},
|
|
100
|
-
optimizeDeps: { exclude: useLocal ? Object.keys(localAliases) : [] },
|
|
101
|
-
// The preview-container runtime contract: Vite's host-check 403s any
|
|
102
|
-
// non-local Host (browser iframe via Caddy, health probe via
|
|
103
|
-
// host.docker.internal) unless allowedHosts is set. host/cors/headers keep
|
|
104
|
-
// the proxied iframe + cross-origin asset fetches working. Owned here
|
|
105
|
-
// because the app's vite.config has no literal `server: {` for the
|
|
106
|
-
// container's text patchers to anchor on. Caller `server` merges last.
|
|
107
|
-
server: {
|
|
108
|
-
host: true,
|
|
109
|
-
port: opts.port,
|
|
110
|
-
strictPort: opts.strictPort,
|
|
111
|
-
cors: true,
|
|
112
|
-
allowedHosts: true,
|
|
113
|
-
headers: {
|
|
114
|
-
'Access-Control-Allow-Origin': '*',
|
|
115
|
-
'Cross-Origin-Resource-Policy': 'cross-origin',
|
|
116
|
-
},
|
|
117
|
-
fs: { allow: [root, fayzSdk] },
|
|
118
|
-
...(opts.server ?? {}),
|
|
119
|
-
},
|
|
120
|
-
}
|
|
121
|
-
}
|