@turbofy-ai/app-runtime 0.0.10 → 0.0.11
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/dist/src/api/types.d.ts +6 -0
- package/dist/src/dsl.d.ts +11 -0
- package/dist/src/dsl.js +18 -1
- package/dist/src/lib/content-hash.d.ts +3 -0
- package/dist/src/lib/content-hash.test.d.ts +1 -0
- package/dist/src/navigation/index.d.ts +2 -1
- package/dist/src/navigation/navigate.d.ts +7 -1
- package/dist/src/navigation/search-params.d.ts +5 -0
- package/package.json +1 -1
package/dist/src/api/types.d.ts
CHANGED
|
@@ -159,6 +159,12 @@ export type IWsSubscribePayload = {
|
|
|
159
159
|
export type IWsEvent = {
|
|
160
160
|
operation: IWsOperation;
|
|
161
161
|
record: Record<string, unknown>;
|
|
162
|
+
/**
|
|
163
|
+
* The record's type, named on the envelope. Blocks receive events already
|
|
164
|
+
* routed by subscription id, so this is informational for them — the parent
|
|
165
|
+
* frame is what filters by type.
|
|
166
|
+
*/
|
|
167
|
+
ofType?: string;
|
|
162
168
|
};
|
|
163
169
|
export type IWsEventPayload = {
|
|
164
170
|
subscriptionId: string;
|
package/dist/src/dsl.d.ts
CHANGED
|
@@ -1707,6 +1707,8 @@ export interface IFlowDeclaration<TName extends string, TSteps extends Record<st
|
|
|
1707
1707
|
steps: TSteps;
|
|
1708
1708
|
debug?: boolean;
|
|
1709
1709
|
disabled?: boolean;
|
|
1710
|
+
/** Dashboard accent color id (e.g. "blue"). UI-only; ignored by the runtime. */
|
|
1711
|
+
color?: string;
|
|
1710
1712
|
}
|
|
1711
1713
|
export type INonGenericIFlowDeclaration = IFlowDeclaration<string, Record<string, IStep>>;
|
|
1712
1714
|
export type II18nSettings = {
|
|
@@ -1856,6 +1858,12 @@ export interface IPageOptions {
|
|
|
1856
1858
|
param?: IPageParamConfig;
|
|
1857
1859
|
/** Default English localization dictionary for this page. */
|
|
1858
1860
|
defaultLocalization?: LocalizationDictionary;
|
|
1861
|
+
/**
|
|
1862
|
+
* Per-locale page copies / SEO meta, keyed by locale. Takes precedence over
|
|
1863
|
+
* `defaultLocalization` and `meta`; embed each locale's `meta` entries in
|
|
1864
|
+
* its dictionary.
|
|
1865
|
+
*/
|
|
1866
|
+
localizations?: ILocalizationsByLocale;
|
|
1859
1867
|
/** SEO metadata (title, description, og:* and twitter:* tags) rendered as `<meta>` tags */
|
|
1860
1868
|
meta?: IPageMetaDictionary;
|
|
1861
1869
|
/** Localized config (e.g. canonicalPath, notFound). Preserved through pull/push. */
|
|
@@ -1876,6 +1884,7 @@ export interface IPageDefinition {
|
|
|
1876
1884
|
parent?: IPageDefinition;
|
|
1877
1885
|
params: Record<string, IPageParamConfig>;
|
|
1878
1886
|
defaultLocalization?: LocalizationDictionary;
|
|
1887
|
+
localizations?: ILocalizationsByLocale;
|
|
1879
1888
|
localizedConfig?: string;
|
|
1880
1889
|
visibility?: PageVisibility;
|
|
1881
1890
|
blocks: IBlockDefinition[];
|
|
@@ -2085,6 +2094,8 @@ export interface IFlowOptions {
|
|
|
2085
2094
|
detachedSteps?: IFlowStepDefinition[];
|
|
2086
2095
|
debug?: boolean;
|
|
2087
2096
|
disabled?: boolean;
|
|
2097
|
+
/** Dashboard accent color id. UI-only; ignored by the runtime. */
|
|
2098
|
+
color?: string;
|
|
2088
2099
|
}
|
|
2089
2100
|
export interface IFlowOutput {
|
|
2090
2101
|
name?: string;
|
package/dist/src/dsl.js
CHANGED
|
@@ -22652,6 +22652,7 @@ function page(opts) {
|
|
|
22652
22652
|
opts.defaultLocalization,
|
|
22653
22653
|
opts.meta
|
|
22654
22654
|
),
|
|
22655
|
+
...opts.localizations ? { localizations: opts.localizations } : {},
|
|
22655
22656
|
localizedConfig: opts.localizedConfig,
|
|
22656
22657
|
...opts.visibility ? { visibility: opts.visibility } : {},
|
|
22657
22658
|
blocks: opts.blocks ?? []
|
|
@@ -22838,6 +22839,7 @@ function buildPages(pages, opts) {
|
|
|
22838
22839
|
name: p.name,
|
|
22839
22840
|
slugConfig,
|
|
22840
22841
|
...p.defaultLocalization ? { defaultLocalization: p.defaultLocalization } : {},
|
|
22842
|
+
...p.localizations ? { localizations: p.localizations } : {},
|
|
22841
22843
|
...p.localizedConfig ? { localizedConfig: p.localizedConfig } : {},
|
|
22842
22844
|
blocks: flattenBlocks(p.blocks, {
|
|
22843
22845
|
fallbackLocale: opts?.fallbackLocale
|
|
@@ -22878,6 +22880,7 @@ function buildApp(opts) {
|
|
|
22878
22880
|
if (i18n) {
|
|
22879
22881
|
validateBlockTypeLocalizations(appBlockTypes, i18n.locales);
|
|
22880
22882
|
validateBlockLocalizations(opts.pages, i18n.locales);
|
|
22883
|
+
validatePageLocalizations(opts.pages, i18n.locales);
|
|
22881
22884
|
}
|
|
22882
22885
|
const pages = buildPages(opts.pages, buildPagesOpts);
|
|
22883
22886
|
const blockTypes = buildBlockTypes(appBlockTypes, { fallbackLocale });
|
|
@@ -22919,6 +22922,19 @@ function validateBlockTypeLocalizations(blockTypes, supportedLocales) {
|
|
|
22919
22922
|
}
|
|
22920
22923
|
}
|
|
22921
22924
|
}
|
|
22925
|
+
function validatePageLocalizations(pages, supportedLocales) {
|
|
22926
|
+
const supported = new Set(supportedLocales);
|
|
22927
|
+
for (const p of pages) {
|
|
22928
|
+
if (!p.localizations) continue;
|
|
22929
|
+
for (const locale of Object.keys(p.localizations)) {
|
|
22930
|
+
if (!supported.has(locale)) {
|
|
22931
|
+
throw new Error(
|
|
22932
|
+
`Page "${p.name}": localizations contain unsupported locale "${locale}". Supported: ${supportedLocales.join(", ")}`
|
|
22933
|
+
);
|
|
22934
|
+
}
|
|
22935
|
+
}
|
|
22936
|
+
}
|
|
22937
|
+
}
|
|
22922
22938
|
function validateBlockLocalizations(pages, supportedLocales) {
|
|
22923
22939
|
const supported = new Set(supportedLocales);
|
|
22924
22940
|
const visit = (blocks, pageName) => {
|
|
@@ -23582,7 +23598,8 @@ function buildFlow(opts) {
|
|
|
23582
23598
|
startStep: chainSteps.length > 0 ? chainSteps[0].name : null,
|
|
23583
23599
|
steps,
|
|
23584
23600
|
...opts.debug !== void 0 ? { debug: opts.debug } : {},
|
|
23585
|
-
...opts.disabled !== void 0 ? { disabled: opts.disabled } : {}
|
|
23601
|
+
...opts.disabled !== void 0 ? { disabled: opts.disabled } : {},
|
|
23602
|
+
...opts.color !== void 0 ? { color: opts.color } : {}
|
|
23586
23603
|
};
|
|
23587
23604
|
const validation = validateFlow(declaration, { name: opts.name });
|
|
23588
23605
|
errors.push(...validation.errors.map((issue2) => issue2.message));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type INavigateOptions = {
|
|
2
|
+
/** Update the URL without re-resolving the page or re-rendering blocks. */
|
|
3
|
+
shallow?: boolean;
|
|
4
|
+
/** Replace the current history entry instead of pushing a new one. */
|
|
5
|
+
replace?: boolean;
|
|
6
|
+
};
|
|
7
|
+
export declare const navigate: (path: string, options?: INavigateOptions) => void;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const SEARCH_PARAMS_GLOBAL = "__APP_SEARCH_PARAMS__";
|
|
2
|
+
export declare const SEARCH_PARAMS_EVENT = "app:search-params-update";
|
|
3
|
+
export declare const publishSearchParams: (next: Record<string, string>) => void;
|
|
4
|
+
export declare const parseSearchParamsFromPath: (path: string) => Record<string, string>;
|
|
5
|
+
export declare const useSearchParams: () => Record<string, string>;
|