@zerotal/flow 1.0.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/CHANGELOG.md +61 -0
- package/LICENSE +21 -0
- package/README.md +148 -0
- package/package.json +84 -0
- package/src/Component.ts +1498 -0
- package/src/Form.ts +189 -0
- package/src/Layout.ts +47 -0
- package/src/augment.ts +94 -0
- package/src/client/FlowClientError.ts +12 -0
- package/src/client/FlowComponent.ts +96 -0
- package/src/client/alpinejs-morph.d.ts +5 -0
- package/src/client/bridge.ts +3463 -0
- package/src/client/confirm.ts +338 -0
- package/src/client/cspAdapter.ts +79 -0
- package/src/client/cspEvaluator.ts +494 -0
- package/src/client/errorOverlay.ts +124 -0
- package/src/client/headless.ts +948 -0
- package/src/client/index.csp.ts +47 -0
- package/src/client/index.ts +56 -0
- package/src/client/optimistic.ts +52 -0
- package/src/client/timeline.ts +160 -0
- package/src/client/url.ts +51 -0
- package/src/commands/MakeFlowCommand.ts +290 -0
- package/src/compiler/cache.ts +101 -0
- package/src/compiler/directives.ts +107 -0
- package/src/compiler/helpers.ts +26 -0
- package/src/compiler/index.ts +172 -0
- package/src/compiler/transform.ts +2070 -0
- package/src/components.ts +1465 -0
- package/src/config.ts +52 -0
- package/src/decorators.ts +978 -0
- package/src/dehydrate.ts +333 -0
- package/src/durable.ts +243 -0
- package/src/events.ts +118 -0
- package/src/frameworkEvents.ts +40 -0
- package/src/headless.ts +1147 -0
- package/src/index.ts +267 -0
- package/src/jsx-dev-runtime.ts +14 -0
- package/src/jsx-runtime.ts +1272 -0
- package/src/mixins.ts +199 -0
- package/src/observability.ts +167 -0
- package/src/pagination.ts +300 -0
- package/src/presence.ts +81 -0
- package/src/provider/FlowProvider.ts +1401 -0
- package/src/registry.ts +118 -0
- package/src/renderContext.ts +55 -0
- package/src/router.ts +401 -0
- package/src/shared.ts +226 -0
- package/src/store.ts +116 -0
- package/src/synths/CarbonIntervalSynth.ts +22 -0
- package/src/synths/CarbonSynth.ts +20 -0
- package/src/synths/CollectionSynth.ts +62 -0
- package/src/synths/DateSynth.ts +24 -0
- package/src/synths/ModelSynth.ts +78 -0
- package/src/synths/TemporaryUploadedFileSynth.ts +19 -0
- package/src/synths/index.ts +148 -0
- package/src/testing.ts +361 -0
- package/src/types.ts +315 -0
- package/src/uploads/FileUploads.ts +94 -0
- package/src/uploads/TemporaryUploadedFile.ts +274 -0
- package/src/uploads/sign.ts +18 -0
- package/src/urlSafety.ts +0 -0
- package/src/utils.ts +216 -0
- package/src/validation.ts +55 -0
package/src/config.ts
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { deepMerge, env } from "@zerotal/core";
|
|
2
|
+
import type { MiddlewareClass } from "@zerotal/core";
|
|
3
|
+
|
|
4
|
+
export interface FlowConfigShape {
|
|
5
|
+
/**
|
|
6
|
+
* Serve the client runtime in CSP-safe mode — no `'unsafe-eval'` required.
|
|
7
|
+
*
|
|
8
|
+
* Costs a little payload and start-up time, so it is off unless you actually
|
|
9
|
+
* ship a Content-Security-Policy without `unsafe-eval`.
|
|
10
|
+
*
|
|
11
|
+
* Default: `false`, or the `ZT_FLOW_CSP_SAFE` / `APP_CSP_SAFE` env flag.
|
|
12
|
+
*/
|
|
13
|
+
cspSafe: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Global middleware re-applied on every WebSocket update (Livewire-style
|
|
16
|
+
* persistent middleware). Entries are matched against the app's global
|
|
17
|
+
* pipeline by class reference or by class name.
|
|
18
|
+
*
|
|
19
|
+
* Route middleware always re-runs and does not need to be listed here.
|
|
20
|
+
*
|
|
21
|
+
* Default: `["SessionMiddleware", "PersistUserMiddleware", "BearerTokenMiddleware"]`
|
|
22
|
+
*/
|
|
23
|
+
persistentMiddleware: (string | MiddlewareClass)[];
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** Global middleware re-run on every WebSocket action unless overridden. */
|
|
27
|
+
export const DEFAULT_PERSISTENT_MIDDLEWARE: (string | MiddlewareClass)[] = [
|
|
28
|
+
"SessionMiddleware",
|
|
29
|
+
"PersistUserMiddleware",
|
|
30
|
+
"BearerTokenMiddleware",
|
|
31
|
+
];
|
|
32
|
+
|
|
33
|
+
const defaults: FlowConfigShape = {
|
|
34
|
+
cspSafe: env("ZT_FLOW_CSP_SAFE", false) || env("APP_CSP_SAFE", false),
|
|
35
|
+
persistentMiddleware: [...DEFAULT_PERSISTENT_MIDDLEWARE],
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* @example
|
|
40
|
+
* import { FlowConfig } from '@zerotal/flow';
|
|
41
|
+
* export default FlowConfig({ cspSafe: true });
|
|
42
|
+
*/
|
|
43
|
+
export function FlowConfig(options: Partial<FlowConfigShape> = {}): FlowConfigShape {
|
|
44
|
+
return deepMerge(defaults, options);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// Register this package's config namespace for typed config() dot-paths.
|
|
48
|
+
declare module "@zerotal/core" {
|
|
49
|
+
interface ConfigRegistry {
|
|
50
|
+
flow: FlowConfigShape;
|
|
51
|
+
}
|
|
52
|
+
}
|