@svgrid/enterprise 2.2.1 → 2.3.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 +95 -81
- package/dist/cdn/svgrid-enterprise.svelte-external.js +22468 -10459
- package/dist/node/studio.js +11590 -2907
- package/package.json +31 -10
- package/src/SvAlertRuleEditor.svelte +294 -0
- package/src/SvAlertsManager.svelte +210 -0
- package/src/SvAlertsPanel.svelte +129 -0
- package/src/SvBoard.svelte +3 -1
- package/src/SvExpressionEditor.svelte +341 -0
- package/src/SvGridAlerts.dom.test.ts +113 -0
- package/src/SvGridAlerts.svelte +265 -0
- package/src/SvGridBoard.svelte +2355 -0
- package/src/SvGridEditPanel.svelte +849 -794
- package/src/SvGridScheduler.svelte +5334 -4410
- package/src/SvPivotDesigner.svelte +3 -3
- package/src/SvRecordDetail.svelte +6 -2
- package/src/SvSchedule.svelte +3 -1
- package/src/{ai-export-pdf.test.ts → ai-export-pdf.dom.test.ts} +4 -1
- package/src/{ai-export-xlsx.test.ts → ai-export-xlsx.dom.test.ts} +4 -1
- package/src/{ai-export.test.ts → ai-export.dom.test.ts} +5 -1
- package/src/alerts/alert-engine-attach.ts +165 -0
- package/src/alerts/alert-engine.test.ts +135 -0
- package/src/alerts/alert-engine.ts +260 -0
- package/src/alerts/alert-formats.test.ts +87 -0
- package/src/alerts/alert-formats.ts +77 -0
- package/src/alerts/alert-observer.test.ts +189 -0
- package/src/alerts/alert-observer.ts +208 -0
- package/src/alerts/alert-scheduler.ts +96 -0
- package/src/alerts/alert-storage.test.ts +54 -0
- package/src/alerts/alert-storage.ts +116 -0
- package/src/alerts/alert-store.svelte.ts +80 -0
- package/src/alerts/alert-types.ts +94 -0
- package/src/alerts.ts +28 -0
- package/src/board.dom.test.ts +941 -0
- package/src/board.ts +36 -0
- package/src/export.ts +6 -0
- package/src/expressions/evaluate.test.ts +111 -0
- package/src/expressions/evaluate.ts +228 -0
- package/src/expressions/expression-columns.ts +133 -0
- package/src/expressions/expression-types.ts +84 -0
- package/src/expressions/parse.test.ts +106 -0
- package/src/expressions/parse.ts +610 -0
- package/src/import.ts +2 -0
- package/src/index.ts +180 -46
- package/src/install.ts +12 -2
- package/src/pivot-enable.ts +44 -0
- package/src/scheduler-assignments.test.ts +97 -0
- package/src/scheduler-assignments.ts +134 -0
- package/src/scheduler-axis.test.ts +108 -0
- package/src/scheduler-axis.ts +238 -0
- package/src/scheduler-booking.test.ts +57 -0
- package/src/scheduler-booking.ts +63 -0
- package/src/scheduler-config.ts +179 -0
- package/src/scheduler-dependencies.test.ts +155 -0
- package/src/scheduler-dependencies.ts +223 -0
- package/src/scheduler-freebusy.test.ts +41 -0
- package/src/scheduler-freebusy.ts +36 -0
- package/src/scheduler-heatmap.test.ts +39 -0
- package/src/scheduler-heatmap.ts +55 -0
- package/src/scheduler-resource-tree.test.ts +84 -0
- package/src/scheduler-resource-tree.ts +107 -0
- package/src/scheduler-slots.test.ts +53 -0
- package/src/scheduler-slots.ts +94 -0
- package/src/scheduler-summary.test.ts +47 -0
- package/src/scheduler-summary.ts +81 -0
- package/src/sources/index.ts +1 -1
- package/src/sources/introspect-supabase.test.ts +13 -1
- package/src/sources/introspect-supabase.ts +20 -0
- package/src/studio/copilot-core.test.ts +45 -0
- package/src/studio/copilot-core.ts +65 -0
- package/src/studio/deploy-cli.test.ts +56 -0
- package/src/studio/deploy-cli.ts +100 -0
- package/src/studio/emit-project.test.ts +503 -18
- package/src/studio/emit-project.ts +829 -111
- package/src/studio/emit-schema.test.ts +17 -0
- package/src/studio/emit-schema.ts +166 -35
- package/src/studio/index.ts +25 -1
- package/src/studio/introspect-openapi.test.ts +84 -0
- package/src/studio/introspect-openapi.ts +252 -0
- package/src/studio/project.test.ts +57 -0
- package/src/studio/project.ts +193 -6
- package/src/studio/samples/crm.ts +282 -258
- package/src/studio/samples/fleet.ts +213 -186
- package/src/studio/samples/insurance.ts +223 -195
- package/src/studio/samples/inventory.ts +213 -182
- package/src/studio/samples/live-data.test.ts +99 -98
- package/src/studio/samples/live-data.ts +8 -10
- package/src/studio/samples/projects.ts +212 -190
- package/src/studio/samples/samples.test.ts +52 -0
- package/src/studio/samples/shared.ts +26 -6
- package/src/studio/samples/starter.ts +251 -0
- package/src/studio/samples/support.ts +209 -184
- package/src/studio/ui-components-surface.test.ts +185 -0
- package/src/studio/ui-components.generated.ts +5617 -0
- package/src/studio/ui-components.ts +641 -472
- package/src/sveltekit/sql-source.test.ts +13 -0
- package/src/sveltekit/sql-source.ts +11 -6
- package/src/upgrade-prompt.ts +2 -2
- package/src/watermark.ts +2 -2
- package/src/ai.test.ts +0 -522
- package/src/ai.ts +0 -1388
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `svgrid-studio deploy` - the pure, testable core. Resolves WHICH provider to
|
|
3
|
+
* deploy to (explicit flag > studio.config.json's deploy target > the SvelteKit
|
|
4
|
+
* adapter in svelte.config.js - never a guess) and WHAT commands that means.
|
|
5
|
+
* The thin CLI in @svgrid/studio does the file reads + process spawning.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
export type DeployProvider = 'vercel' | 'netlify' | 'cloudflare' | 'node'
|
|
9
|
+
|
|
10
|
+
export type DeployResolution =
|
|
11
|
+
| { ok: true; provider: DeployProvider; source: 'flag' | 'config' | 'adapter' }
|
|
12
|
+
| { ok: false; reason: string }
|
|
13
|
+
|
|
14
|
+
const PROVIDERS: DeployProvider[] = ['vercel', 'netlify', 'cloudflare', 'node']
|
|
15
|
+
|
|
16
|
+
/** Adapter package -> provider (what svelte.config.js imports). */
|
|
17
|
+
const ADAPTERS: Array<[string, DeployProvider]> = [
|
|
18
|
+
['@sveltejs/adapter-vercel', 'vercel'],
|
|
19
|
+
['@sveltejs/adapter-netlify', 'netlify'],
|
|
20
|
+
['@sveltejs/adapter-cloudflare', 'cloudflare'],
|
|
21
|
+
['@sveltejs/adapter-node', 'node'],
|
|
22
|
+
]
|
|
23
|
+
|
|
24
|
+
const GUIDANCE =
|
|
25
|
+
'Set a target: pass --target vercel|netlify|cloudflare|node, pick a deploy target in the Studio designer ' +
|
|
26
|
+
'(saved to studio.config.json), or pin a concrete SvelteKit adapter in svelte.config.js.'
|
|
27
|
+
|
|
28
|
+
/** Resolve the deploy provider from the inputs the CLI gathered (all optional). */
|
|
29
|
+
export function resolveDeployTarget(inputs: { flag?: string; configJson?: string | null; svelteConfig?: string | null }): DeployResolution {
|
|
30
|
+
const { flag, configJson, svelteConfig } = inputs
|
|
31
|
+
if (flag !== undefined) {
|
|
32
|
+
if ((PROVIDERS as string[]).includes(flag)) return { ok: true, provider: flag as DeployProvider, source: 'flag' }
|
|
33
|
+
return { ok: false, reason: `Unknown --target "${flag}". Use one of: ${PROVIDERS.join(' | ')}.` }
|
|
34
|
+
}
|
|
35
|
+
if (configJson) {
|
|
36
|
+
try {
|
|
37
|
+
const deploy = (JSON.parse(configJson) as { deploy?: string }).deploy
|
|
38
|
+
if (deploy && (PROVIDERS as string[]).includes(deploy)) return { ok: true, provider: deploy as DeployProvider, source: 'config' }
|
|
39
|
+
// 'auto' (or unset) means the project never chose a provider - don't guess one.
|
|
40
|
+
} catch {
|
|
41
|
+
/* unreadable config - fall through to the adapter */
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
if (svelteConfig) {
|
|
45
|
+
for (const [pkg, provider] of ADAPTERS) if (svelteConfig.includes(pkg)) return { ok: true, provider, source: 'adapter' }
|
|
46
|
+
}
|
|
47
|
+
return { ok: false, reason: `No deploy target configured. ${GUIDANCE}` }
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export type DeployPlanCommands = {
|
|
51
|
+
provider: DeployProvider
|
|
52
|
+
/** Run first - validates the app compiles before anything leaves the machine. */
|
|
53
|
+
build: string
|
|
54
|
+
/** The provider CLI command, or null when there's nothing to run (node target). */
|
|
55
|
+
deploy: string | null
|
|
56
|
+
/** Shown before running (login hints, what the command does). */
|
|
57
|
+
notes: string[]
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** The commands a provider deploy runs - same one-liners the generated `deploy` script uses. */
|
|
61
|
+
export function deployCommands(provider: DeployProvider): DeployPlanCommands {
|
|
62
|
+
switch (provider) {
|
|
63
|
+
case 'vercel':
|
|
64
|
+
return { provider, build: 'npm run build', deploy: 'npx vercel deploy --prod', notes: ['Needs a Vercel login (npx vercel login) and a linked project (first run prompts to link).'] }
|
|
65
|
+
case 'netlify':
|
|
66
|
+
return { provider, build: 'npm run build', deploy: 'npx netlify deploy --build --prod', notes: ['Needs a Netlify login (npx netlify login) and a linked site (npx netlify link).'] }
|
|
67
|
+
case 'cloudflare':
|
|
68
|
+
return { provider, build: 'npm run build', deploy: 'npx wrangler pages deploy', notes: ['Needs a Cloudflare login (npx wrangler login).'] }
|
|
69
|
+
case 'node':
|
|
70
|
+
return {
|
|
71
|
+
provider,
|
|
72
|
+
build: 'npm run build',
|
|
73
|
+
deploy: null,
|
|
74
|
+
notes: [
|
|
75
|
+
'The node target has no hosted provider - after the build, run it yourself:',
|
|
76
|
+
' node build # serves on PORT (default 3000)',
|
|
77
|
+
' docker build -t app . && docker run -p 3000:3000 --env-file .env app',
|
|
78
|
+
],
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/** Env keys declared in .env.example (uncommented `KEY=` lines) that are absent
|
|
84
|
+
* from the local .env - surfaced as a preflight warning before deploying. */
|
|
85
|
+
export function missingEnvKeys(envExample: string | null, envLocal: string | null): string[] {
|
|
86
|
+
if (!envExample) return []
|
|
87
|
+
const declared = envExample
|
|
88
|
+
.split('\n')
|
|
89
|
+
.map((l) => l.trim())
|
|
90
|
+
.filter((l) => /^[A-Z][A-Z0-9_]*=/.test(l))
|
|
91
|
+
.map((l) => l.slice(0, l.indexOf('=')))
|
|
92
|
+
const present = new Set(
|
|
93
|
+
(envLocal ?? '')
|
|
94
|
+
.split('\n')
|
|
95
|
+
.map((l) => l.trim())
|
|
96
|
+
.filter((l) => /^[A-Z][A-Z0-9_]*=.+/.test(l))
|
|
97
|
+
.map((l) => l.slice(0, l.indexOf('='))),
|
|
98
|
+
)
|
|
99
|
+
return declared.filter((k) => !present.has(k))
|
|
100
|
+
}
|