@turbofy-ai/app-runtime 0.0.18 → 0.0.20

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/dsl.d.ts CHANGED
@@ -826,6 +826,34 @@ export interface IPageMetaDictionary {
826
826
  "twitter:url"?: string;
827
827
  [key: string]: LocalizationValue | undefined;
828
828
  }
829
+ export interface IBranchParams {
830
+ branches: {
831
+ [k: string]: boolean;
832
+ };
833
+ }
834
+ export interface IBranchResult {
835
+ matchedSteps: string[];
836
+ }
837
+ export interface IForEachParams {
838
+ /**
839
+ * @maxItems 10000
840
+ */
841
+ items: unknown[];
842
+ bodyStep: string | null;
843
+ }
844
+ export type IForEachResult = {
845
+ /**
846
+ * @maxItems 10000
847
+ */
848
+ items: unknown[];
849
+ /**
850
+ * @maxItems 10000
851
+ */
852
+ result?: unknown[];
853
+ } | {
854
+ item: unknown;
855
+ index: number;
856
+ };
829
857
  export interface IBatchCreateTypeParams {
830
858
  ofType: string;
831
859
  namespace: string;
@@ -1138,31 +1166,6 @@ export interface INotifyWebSocketParams {
1138
1166
  export interface INotifyWebSocketResult {
1139
1167
  [k: string]: unknown;
1140
1168
  }
1141
- export type IOpenAIImageGenerationParams = {
1142
- model: "dall-e-3";
1143
- prompt: string;
1144
- quality?: "standard" | "hd";
1145
- size?: "1024x1024" | "1792x1024" | "1024x1792";
1146
- style?: "vivid" | "natural";
1147
- outputFilename?: string;
1148
- apiKey?: string;
1149
- } | {
1150
- model: "dall-e-2";
1151
- prompt: string;
1152
- size?: "256x256" | "512x512" | "1024x1024";
1153
- n?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10;
1154
- outputFilename?: string;
1155
- apiKey?: string;
1156
- };
1157
- export type IOpenAIImageGenerationResult = {
1158
- type: "result";
1159
- url: string;
1160
- key: string;
1161
- mimeType: string;
1162
- } | {
1163
- type: "error";
1164
- value: string;
1165
- };
1166
1169
  export interface ITypeParams {
1167
1170
  id: string;
1168
1171
  ofType: string;
@@ -1694,6 +1697,8 @@ export interface IStripeSyncResult {
1694
1697
  recordId?: string;
1695
1698
  }
1696
1699
  export type IStepParamsMap = {
1700
+ branch: IBranchParams;
1701
+ forEach: IForEachParams;
1697
1702
  batchCreateType: IBatchCreateTypeParams;
1698
1703
  batchGetType: IBatchGetTypeParams;
1699
1704
  createType: ICreateTypeParams;
@@ -1707,7 +1712,6 @@ export type IStepParamsMap = {
1707
1712
  listTypeByParent: IListTypeByParentParams;
1708
1713
  listType: IListTypeParams;
1709
1714
  notifyWebSocket: INotifyWebSocketParams;
1710
- openAIImageGeneration: IOpenAIImageGenerationParams;
1711
1715
  type: ITypeParams;
1712
1716
  updateType: IUpdateTypeParams;
1713
1717
  extractImageMetadata: IExtractImageMetadataParams;
@@ -1716,6 +1720,8 @@ export type IStepParamsMap = {
1716
1720
  stripeSync: IStripeSyncParams;
1717
1721
  };
1718
1722
  export type IStepResultMap = {
1723
+ branch: IBranchResult;
1724
+ forEach: IForEachResult;
1719
1725
  batchCreateType: IBatchCreateTypeResult;
1720
1726
  batchGetType: IBatchGetTypeResult;
1721
1727
  createType: ICreateTypeResult;
@@ -1729,7 +1735,6 @@ export type IStepResultMap = {
1729
1735
  listTypeByParent: IListTypeByParentResult;
1730
1736
  listType: IListTypeResult;
1731
1737
  notifyWebSocket: INotifyWebSocketResult;
1732
- openAIImageGeneration: IOpenAIImageGenerationResult;
1733
1738
  type: ITypeResult;
1734
1739
  updateType: IUpdateTypeResult;
1735
1740
  extractImageMetadata: IExtractImageMetadataResult;
@@ -1738,6 +1743,8 @@ export type IStepResultMap = {
1738
1743
  stripeSync: IStripeSyncResult;
1739
1744
  };
1740
1745
  declare enum StepType {
1746
+ branch = "branch",
1747
+ forEach = "forEach",
1741
1748
  batchCreateType = "batchCreateType",
1742
1749
  batchGetType = "batchGetType",
1743
1750
  createType = "createType",
@@ -1751,7 +1758,6 @@ declare enum StepType {
1751
1758
  listTypeByParent = "listTypeByParent",
1752
1759
  listType = "listType",
1753
1760
  notifyWebSocket = "notifyWebSocket",
1754
- openAIImageGeneration = "openAIImageGeneration",
1755
1761
  type = "type",
1756
1762
  updateType = "updateType",
1757
1763
  extractImageMetadata = "extractImageMetadata",
@@ -1890,8 +1896,15 @@ export interface IFlowDeclaration<TName extends string, TSteps extends Record<st
1890
1896
  steps: TSteps;
1891
1897
  debug?: boolean;
1892
1898
  disabled?: boolean;
1893
- /** Dashboard accent color id (e.g. "blue"). UI-only; ignored by the runtime. */
1899
+ /** Short dashboard card description. UI-only; ignored by the runtime. */
1900
+ description?: string;
1901
+ /** Dashboard accent color id (e.g. "blue") or a `#rrggbb` hex. UI-only; ignored by the runtime. */
1894
1902
  color?: string;
1903
+ /**
1904
+ * Dashboard card icon id (e.g. "mail"). UI-only; ignored by the runtime.
1905
+ * Omit for the default robot mark.
1906
+ */
1907
+ icon?: string;
1895
1908
  }
1896
1909
  export type INonGenericIFlowDeclaration = IFlowDeclaration<string, Record<string, IStep>>;
1897
1910
  export type II18nSettings = {
@@ -2116,6 +2129,12 @@ export interface IAppOptions {
2116
2129
  i18n?: II18nSettings;
2117
2130
  /** End-user authentication settings persisted to `app.settings.auth`. */
2118
2131
  auth?: IAppAuthSettings;
2132
+ /** Short dashboard card description. Persisted to `app.settings.description`. */
2133
+ description?: string;
2134
+ /** Dashboard card background. Persisted to `app.settings.color`. */
2135
+ color?: string;
2136
+ /** Dashboard card icon id. Persisted to `app.settings.icon`. Omit for the default mark. */
2137
+ icon?: string;
2119
2138
  /** @deprecated Use `i18n.locales` instead. */
2120
2139
  locale?: string;
2121
2140
  /** @deprecated Use `i18n.locales` instead. */
@@ -2128,8 +2147,25 @@ export interface IAppOutput {
2128
2147
  slugConfig?: IAppSlugConfig;
2129
2148
  i18n?: II18nSettings;
2130
2149
  auth?: IAppAuthSettings;
2150
+ description?: string;
2151
+ color?: string;
2152
+ icon?: string;
2131
2153
  }
2132
2154
  declare function buildApp(opts: IAppOptions): IAppOutput;
2155
+ export type CloudFunctionRuntime = "NODEJS_22_X" | "NODEJS_24_X" | "DOCKER";
2156
+ export type ICloudFunctionDefinition = {
2157
+ name: string;
2158
+ } & ({
2159
+ runtime: "NODEJS_22_X" | "NODEJS_24_X";
2160
+ entry: string;
2161
+ } | {
2162
+ runtime: "DOCKER";
2163
+ entry?: never;
2164
+ });
2165
+ declare const CLOUD_FUNCTION_REFERENCE_PREFIX = "cloud-function:";
2166
+ declare const validateCloudFunctionName: (name: string) => void;
2167
+ declare const buildFunction: (definition: ICloudFunctionDefinition) => ICloudFunctionDefinition;
2168
+ declare const ref: (name: string) => string;
2133
2169
  export interface IJsParam {
2134
2170
  readonly __flowParam: "js";
2135
2171
  readonly code: string;
@@ -2244,11 +2280,24 @@ export interface IFlowStepDefinition<T extends StepType = StepType> {
2244
2280
  type: T;
2245
2281
  description?: string;
2246
2282
  params: Record<string, unknown>;
2283
+ branches?: IFlowBranchDefinition[];
2284
+ steps?: IFlowStepDefinition[];
2247
2285
  next?: string | null;
2248
2286
  skipIf?: string;
2249
2287
  continueIf?: string;
2250
2288
  passThroughCondition?: string;
2251
2289
  }
2290
+ export interface IFlowBranchDefinition {
2291
+ when: DeepParam<boolean>;
2292
+ steps: IFlowStepDefinition[];
2293
+ }
2294
+ export interface IFlowBranchOptions extends Omit<IFlowStepOptions<StepType.branch>, "params" | "next"> {
2295
+ branches: IFlowBranchDefinition[];
2296
+ }
2297
+ export interface IFlowForEachOptions extends Omit<IFlowStepOptions<StepType.forEach>, "params"> {
2298
+ items: DeepParam<unknown[]>;
2299
+ steps: IFlowStepDefinition[];
2300
+ }
2252
2301
  declare const step: {
2253
2302
  batchCreateType: (name: string, opts: IFlowStepOptions<StepType.batchCreateType>) => IFlowStepDefinition<StepType.batchCreateType>;
2254
2303
  batchGetType: (name: string, opts: IFlowStepOptions<StepType.batchGetType>) => IFlowStepDefinition<StepType.batchGetType>;
@@ -2263,13 +2312,14 @@ declare const step: {
2263
2312
  listTypeByParent: (name: string, opts: IFlowStepOptions<StepType.listTypeByParent>) => IFlowStepDefinition<StepType.listTypeByParent>;
2264
2313
  listType: (name: string, opts: IFlowStepOptions<StepType.listType>) => IFlowStepDefinition<StepType.listType>;
2265
2314
  notifyWebSocket: (name: string, opts: IFlowStepOptions<StepType.notifyWebSocket>) => IFlowStepDefinition<StepType.notifyWebSocket>;
2266
- openAIImageGeneration: (name: string, opts: IFlowStepOptions<StepType.openAIImageGeneration>) => IFlowStepDefinition<StepType.openAIImageGeneration>;
2267
2315
  type: (name: string, opts: IFlowStepOptions<StepType.type>) => IFlowStepDefinition<StepType.type>;
2268
2316
  updateType: (name: string, opts: IFlowStepOptions<StepType.updateType>) => IFlowStepDefinition<StepType.updateType>;
2269
2317
  extractImageMetadata: (name: string, opts: IFlowStepOptions<StepType.extractImageMetadata>) => IFlowStepDefinition<StepType.extractImageMetadata>;
2270
2318
  cloudFunction: (name: string, opts: IFlowStepOptions<StepType.cloudFunction>) => IFlowStepDefinition<StepType.cloudFunction>;
2271
2319
  genericAI: (name: string, opts: IFlowStepOptions<StepType.genericAI>) => IFlowStepDefinition<StepType.genericAI>;
2272
2320
  stripeSync: (name: string, opts: IFlowStepOptions<StepType.stripeSync>) => IFlowStepDefinition<StepType.stripeSync>;
2321
+ forEach(name: string, opts: IFlowForEachOptions): IFlowStepDefinition<StepType.forEach>;
2322
+ branch(name: string, opts: IFlowBranchOptions): IFlowStepDefinition<StepType.branch>;
2273
2323
  };
2274
2324
  export interface IFlowOptions {
2275
2325
  /** Flow record name — stored next to the declaration, not inside it. */
@@ -2278,14 +2328,18 @@ export interface IFlowOptions {
2278
2328
  /** Executed in order; each step's nextStep defaults to the next entry. */
2279
2329
  steps: IFlowStepDefinition[];
2280
2330
  /**
2281
- * Steps not reachable from the main chain (each needs an explicit `next`).
2282
- * Exists for round-trip fidelity of pulled declarations — avoid in new flows.
2331
+ * Unconnected steps preserved on pull/push (each needs an explicit `next`).
2332
+ * Branch paths belong in the branch step's nested `branches` sequences.
2283
2333
  */
2284
2334
  detachedSteps?: IFlowStepDefinition[];
2285
2335
  debug?: boolean;
2286
2336
  disabled?: boolean;
2287
- /** Dashboard accent color id. UI-only; ignored by the runtime. */
2337
+ /** Short dashboard card description. UI-only; ignored by the runtime. */
2338
+ description?: string;
2339
+ /** Dashboard accent color id or `#rrggbb`. UI-only; ignored by the runtime. */
2288
2340
  color?: string;
2341
+ /** Dashboard card icon id (e.g. "mail"). UI-only; ignored by the runtime. */
2342
+ icon?: string;
2289
2343
  }
2290
2344
  export interface IFlowOutput {
2291
2345
  name?: string;
@@ -2320,7 +2374,7 @@ export interface IValidateFlowContext {
2320
2374
  */
2321
2375
  export declare function collectSecretIds(declaration: INonGenericIFlowDeclaration): string[];
2322
2376
  /**
2323
- * Validates a single flow declaration: linked-list step integrity, param
2377
+ * Validates a single flow declaration: step graph integrity, param
2324
2378
  * shapes, secret hygiene, and self-retriggering write steps.
2325
2379
  */
2326
2380
  export declare function validateFlow(declaration: INonGenericIFlowDeclaration, ctx?: IValidateFlowContext): IFlowValidationResult;
@@ -2344,7 +2398,7 @@ export interface IValidateFlowsOptions {
2344
2398
  export declare function validateFlows(flows: IValidatableFlow[], opts?: IValidateFlowsOptions): IFlowValidationResult;
2345
2399
 
2346
2400
  declare namespace flowBuilder {
2347
- export { IFlowOptions, IFlowOutput, IFlowStepDefinition, IFlowStepOptions, IFlowTriggerDefinition, IScheduleTriggerOptions, ISharedTriggerOptions, IStepParamsInput, ITableDataChangeTriggerOptions, TABLE_ID_PARAM_NAMES, buildFlow, js, secret, step, trigger };
2401
+ export { IFlowBranchDefinition, IFlowBranchOptions, IFlowForEachOptions, IFlowOptions, IFlowOutput, IFlowStepDefinition, IFlowStepOptions, IFlowTriggerDefinition, IScheduleTriggerOptions, ISharedTriggerOptions, IStepParamsInput, ITableDataChangeTriggerOptions, TABLE_ID_PARAM_NAMES, buildFlow, js, secret, step, trigger };
2348
2402
  }
2349
2403
  declare namespace dataBuilder {
2350
2404
  export { TableDef, TableOpts, TableSearchConfig, build, enumType, fields, table };
@@ -2355,9 +2409,13 @@ declare namespace macros {
2355
2409
  declare namespace appBuilder {
2356
2410
  export { block, blockType, buildApp, buildBlockTypes, buildPages, flattenBlocks, page };
2357
2411
  }
2412
+ declare namespace cloudFunctionBuilder {
2413
+ export { CLOUD_FUNCTION_REFERENCE_PREFIX, CloudFunctionRuntime, ICloudFunctionDefinition, buildFunction, ref, validateCloudFunctionName };
2414
+ }
2358
2415
 
2359
2416
  export {
2360
2417
  appBuilder,
2418
+ cloudFunctionBuilder,
2361
2419
  dataBuilder,
2362
2420
  flowBuilder,
2363
2421
  macros,