diff --git a/.eslintrc.js b/.eslintrc.js index 69bdc79c15f..ff24c95d596 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,4 +1,4 @@ -const TYPES = `AnyType|Arena|ArenaChild|ArenaFrame|ArenaFrameCell|ArenaFrameGrid|ArenaFrameRow|Arg|ArgType|BindingStruct|BoolType|Choice|ClassNamePropType|CodeComponentHelper|CodeComponentMeta|CodeComponentVariantMeta|CodeLibrary|CollectionExpr|ColorPropType|ColumnsConfig|ColumnsSetting|Component|ComponentArena|ComponentDataQuery|ComponentInstance|ComponentSwapSplitContent|ComponentTemplateInfo|ComponentVariantGroup|ComponentVariantSplitContent|CompositeExpr|CustomCode|CustomFunction|DataSourceOpExpr|DataSourceTemplate|DateRangeStrings|DateString|DefaultStylesClassNamePropType|DefaultStylesPropType|EventHandler|Expr|ExprText|FigmaComponentMapping|FunctionArg|FunctionExpr|FunctionType|GenericEventHandler|GlobalVariantGroup|GlobalVariantGroupParam|GlobalVariantSplitContent|HostLessPackageInfo|HrefType|ImageAsset|ImageAssetRef|Img|Interaction|LabeledSelector|MapExpr|Marker|Mixin|NameArg|NamedState|NodeMarker|Num|ObjectPath|PageArena|PageHref|PageMeta|Param|PlumeInfo|PlumeInstance|PrimitiveType|ProjectDependency|PropParam|QueryData|QueryInvalidationExpr|QueryRef|RandomSplitSlice|RawText|RenderExpr|RenderFuncType|RenderableType|Rep|RichText|Rule|RuleSet|Scalar|SegmentSplitSlice|SelectorRuleSet|Site|SlotParam|Split|SplitContent|SplitSlice|State|StateChangeHandlerParam|StateParam|StrongFunctionArg|StyleExpr|StyleMarker|StyleNode|StylePropType|StyleScopeClassNamePropType|StyleToken|StyleTokenRef|TargetType|TemplatedString|Text|Theme|ThemeLayoutSettings|ThemeStyle|TplComponent|TplNode|TplRef|TplSlot|TplTag|Var|VarRef|Variant|VariantGroup|VariantGroupState|VariantSetting|VariantedRuleSet|VariantedValue|VariantsRef|VirtualRenderExpr`; +const TYPES = `AnyType|Arena|ArenaChild|ArenaFrame|ArenaFrameCell|ArenaFrameGrid|ArenaFrameRow|Arg|ArgType|BindingStruct|BoolType|Choice|ClassNamePropType|CodeComponentHelper|CodeComponentMeta|CodeComponentVariantMeta|CodeLibrary|CollectionExpr|ColorPropType|ColumnsConfig|ColumnsSetting|Component|ComponentArena|ComponentDataQuery|ComponentInstance|ComponentServerQuery|ComponentSwapSplitContent|ComponentTemplateInfo|ComponentVariantGroup|ComponentVariantSplitContent|CompositeExpr|CustomCode|CustomFunction|CustomFunctionExpr|DataSourceOpExpr|DataSourceTemplate|DateRangeStrings|DateString|DefaultStylesClassNamePropType|DefaultStylesPropType|EventHandler|Expr|ExprText|FigmaComponentMapping|FunctionArg|FunctionExpr|FunctionType|GenericEventHandler|GlobalVariantGroup|GlobalVariantGroupParam|GlobalVariantSplitContent|HostLessPackageInfo|HrefType|ImageAsset|ImageAssetRef|Img|Interaction|LabeledSelector|MapExpr|Marker|Mixin|NameArg|NamedState|NodeMarker|Num|ObjectPath|PageArena|PageHref|PageMeta|Param|PlumeInfo|PlumeInstance|PrimitiveType|ProjectDependency|PropParam|QueryData|QueryInvalidationExpr|QueryRef|RandomSplitSlice|RawText|RenderExpr|RenderFuncType|RenderableType|Rep|RichText|Rule|RuleSet|Scalar|SegmentSplitSlice|SelectorRuleSet|Site|SlotParam|Split|SplitContent|SplitSlice|State|StateChangeHandlerParam|StateParam|StrongFunctionArg|StyleExpr|StyleMarker|StyleNode|StylePropType|StyleScopeClassNamePropType|StyleToken|StyleTokenRef|TargetType|TemplatedString|Text|Theme|ThemeLayoutSettings|ThemeStyle|TplComponent|TplNode|TplRef|TplSlot|TplTag|Var|VarRef|Variant|VariantGroup|VariantGroupState|VariantSetting|VariantedRuleSet|VariantedValue|VariantsRef|VirtualRenderExpr`; const clientFiles = [ "platform/wab/src/wab/main.tsx", diff --git a/platform/wab/src/wab/server/bundle-migrations/239-add-server-queries.ts b/platform/wab/src/wab/server/bundle-migrations/239-add-server-queries.ts new file mode 100644 index 00000000000..1d9dddbc2cd --- /dev/null +++ b/platform/wab/src/wab/server/bundle-migrations/239-add-server-queries.ts @@ -0,0 +1,14 @@ +import { BundleMigrationType } from "@/wab/server/db/bundle-migration-utils"; +import { BundledMigrationFn } from "@/wab/server/db/BundleMigrator"; + +export const migrate: BundledMigrationFn = async (bundle) => { + for (const inst of Object.values(bundle.map)) { + if (inst["__type"] === "CustomFunction") { + inst["params"] = []; + } else if (inst["__type"] === "Component") { + inst["serverQueries"] = []; + } + } +}; + +export const MIGRATION_TYPE: BundleMigrationType = "bundled"; diff --git a/platform/wab/src/wab/server/db/migrations-list.txt b/platform/wab/src/wab/server/db/migrations-list.txt index bd61fe993fb..84fe7d7a96e 100644 --- a/platform/wab/src/wab/server/db/migrations-list.txt +++ b/platform/wab/src/wab/server/db/migrations-list.txt @@ -235,4 +235,5 @@ platform/wab/src/wab/server/bundle-migrations/234-variant-selectors-no-display-n platform/wab/src/wab/server/bundle-migrations/235-variant-selectors-no-display-name-corrected.ts platform/wab/src/wab/server/bundle-migrations/236-rename-duplicated-components.ts platform/wab/src/wab/server/bundle-migrations/237-code-component-variants-add-fields.ts -platform/wab/src/wab/server/bundle-migrations/238-code-component-variants-update-fields.ts \ No newline at end of file +platform/wab/src/wab/server/bundle-migrations/238-code-component-variants-update-fields.ts +platform/wab/src/wab/server/bundle-migrations/239-add-server-queries.ts \ No newline at end of file diff --git a/platform/wab/src/wab/shared/model/model-schema.ts b/platform/wab/src/wab/shared/model/model-schema.ts index 639ecc97932..7d5485d1509 100755 --- a/platform/wab/src/wab/shared/model/model-schema.ts +++ b/platform/wab/src/wab/shared/model/model-schema.ts @@ -224,6 +224,7 @@ CustomFunction importName: String defaultExport: Bool namespace: String? + params: [ArgType] CodeLibrary name: String @@ -346,6 +347,10 @@ ComponentDataQuery @Const uuid: String name: String op: DataSourceOpExpr? +ComponentServerQuery + @Const uuid: String + name: String + op: CustomFunctionExpr? CodeComponentHelper importPath: String importName: String @@ -398,6 +403,7 @@ Component templateInfo: ComponentTemplateInfo? metadata: Map[String, String] dataQueries: [ComponentDataQuery] + serverQueries: [ComponentServerQuery] figmaMappings: [FigmaComponentMapping] alwaysAutoName: Bool trapsFocus: Bool @@ -563,6 +569,9 @@ Expr queryInvalidation: QueryInvalidationExpr? # Minimum role necessary to execute this operation roleId: String? + CustomFunctionExpr + @WeakRef func: CustomFunction + args: [FunctionArg] VarRef @WeakRef variable: Var TplRef diff --git a/platform/wab/src/wab/shared/site-diffs/model-conflicts-meta.ts b/platform/wab/src/wab/shared/site-diffs/model-conflicts-meta.ts index 60025cac475..fb71d86a05e 100644 --- a/platform/wab/src/wab/shared/site-diffs/model-conflicts-meta.ts +++ b/platform/wab/src/wab/shared/site-diffs/model-conflicts-meta.ts @@ -436,6 +436,16 @@ export const modelConflictsMeta: ModelConflictsMeta = { importName: "generic", importPath: "generic", namespace: "generic", + params: { + arrayType: "ordered", + conflictType: "merge", + mergeKey: "argName", + contents: true, + handleUpdatedValues: (params, parent, bundler) => + shallowCloneArrayValuesAndAddToBundle(params, parent, bundler, [ + classes.ArgType, + ]), + }, }, CodeLibrary: { importType: "generic", @@ -646,6 +656,11 @@ export const modelConflictsMeta: ModelConflictsMeta = { name: "generic", op: "generic", }, + ComponentServerQuery: { + uuid: "unexpected", + name: "generic", + op: "generic", + }, CodeComponentHelper: { importName: "generic", importPath: "generic", @@ -740,6 +755,11 @@ export const modelConflictsMeta: ModelConflictsMeta = { conflictType: "rename", nameKey: `name`, }, + serverQueries: { + arrayType: "ordered", + conflictType: "rename", + nameKey: `name`, + }, figmaMappings: { arrayType: "unordered", conflictType: `merge`, @@ -1060,6 +1080,14 @@ export const modelConflictsMeta: ModelConflictsMeta = { mergeKeyIsIdentity: true, }, }, + CustomFunctionExpr: { + func: "generic", + args: { + arrayType: "ordered", + conflictType: "merge", + mergeKeyIsIdentity: true, + }, + }, MapExpr: { mapExpr: "contents", },