@base44-preview/cli 0.0.25-pr.151.082c391 → 0.0.25-pr.151.1ef8126

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/index.js CHANGED
@@ -5747,77 +5747,6 @@ function handleIntersectionResults(result, left, right) {
5747
5747
  result.value = merged.data;
5748
5748
  return result;
5749
5749
  }
5750
- const $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
5751
- $ZodType.init(inst, def);
5752
- const items = def.items;
5753
- inst._zod.parse = (payload, ctx) => {
5754
- const input = payload.value;
5755
- if (!Array.isArray(input)) {
5756
- payload.issues.push({
5757
- input,
5758
- inst,
5759
- expected: "tuple",
5760
- code: "invalid_type"
5761
- });
5762
- return payload;
5763
- }
5764
- payload.value = [];
5765
- const proms = [];
5766
- const reversedIndex = [...items].reverse().findIndex((item) => item._zod.optin !== "optional");
5767
- const optStart = reversedIndex === -1 ? 0 : items.length - reversedIndex;
5768
- if (!def.rest) {
5769
- const tooBig = input.length > items.length;
5770
- const tooSmall = input.length < optStart - 1;
5771
- if (tooBig || tooSmall) {
5772
- payload.issues.push({
5773
- ...tooBig ? {
5774
- code: "too_big",
5775
- maximum: items.length,
5776
- inclusive: true
5777
- } : {
5778
- code: "too_small",
5779
- minimum: items.length
5780
- },
5781
- input,
5782
- inst,
5783
- origin: "array"
5784
- });
5785
- return payload;
5786
- }
5787
- }
5788
- let i$1 = -1;
5789
- for (const item of items) {
5790
- i$1++;
5791
- if (i$1 >= input.length) {
5792
- if (i$1 >= optStart) continue;
5793
- }
5794
- const result = item._zod.run({
5795
- value: input[i$1],
5796
- issues: []
5797
- }, ctx);
5798
- if (result instanceof Promise) proms.push(result.then((result$1) => handleTupleResult(result$1, payload, i$1)));
5799
- else handleTupleResult(result, payload, i$1);
5800
- }
5801
- if (def.rest) {
5802
- const rest = input.slice(items.length);
5803
- for (const el of rest) {
5804
- i$1++;
5805
- const result = def.rest._zod.run({
5806
- value: el,
5807
- issues: []
5808
- }, ctx);
5809
- if (result instanceof Promise) proms.push(result.then((result$1) => handleTupleResult(result$1, payload, i$1)));
5810
- else handleTupleResult(result, payload, i$1);
5811
- }
5812
- }
5813
- if (proms.length) return Promise.all(proms).then(() => payload);
5814
- return payload;
5815
- };
5816
- });
5817
- function handleTupleResult(result, final, index) {
5818
- if (result.issues.length) final.issues.push(...prefixIssues(index, result.issues));
5819
- final.value[index] = result.value;
5820
- }
5821
5750
  const $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
5822
5751
  $ZodType.init(inst, def);
5823
5752
  inst._zod.parse = (payload, ctx) => {
@@ -6140,17 +6069,6 @@ function handleReadonlyResult(payload) {
6140
6069
  payload.value = Object.freeze(payload.value);
6141
6070
  return payload;
6142
6071
  }
6143
- const $ZodLazy = /* @__PURE__ */ $constructor("$ZodLazy", (inst, def) => {
6144
- $ZodType.init(inst, def);
6145
- defineLazy(inst._zod, "innerType", () => def.getter());
6146
- defineLazy(inst._zod, "pattern", () => inst._zod.innerType?._zod?.pattern);
6147
- defineLazy(inst._zod, "propValues", () => inst._zod.innerType?._zod?.propValues);
6148
- defineLazy(inst._zod, "optin", () => inst._zod.innerType?._zod?.optin ?? void 0);
6149
- defineLazy(inst._zod, "optout", () => inst._zod.innerType?._zod?.optout ?? void 0);
6150
- inst._zod.parse = (payload, ctx) => {
6151
- return inst._zod.innerType._zod.run(payload, ctx);
6152
- };
6153
- });
6154
6072
  const $ZodCustom = /* @__PURE__ */ $constructor("$ZodCustom", (inst, def) => {
6155
6073
  $ZodCheck.init(inst, def);
6156
6074
  $ZodType.init(inst, def);
@@ -7211,44 +7129,6 @@ const intersectionProcessor = (schema, ctx, json, params) => {
7211
7129
  const isSimpleIntersection = (val) => "allOf" in val && Object.keys(val).length === 1;
7212
7130
  json.allOf = [...isSimpleIntersection(a$1) ? a$1.allOf : [a$1], ...isSimpleIntersection(b$2) ? b$2.allOf : [b$2]];
7213
7131
  };
7214
- const tupleProcessor = (schema, ctx, _json, params) => {
7215
- const json = _json;
7216
- const def = schema._zod.def;
7217
- json.type = "array";
7218
- const prefixPath$1 = ctx.target === "draft-2020-12" ? "prefixItems" : "items";
7219
- const restPath = ctx.target === "draft-2020-12" ? "items" : ctx.target === "openapi-3.0" ? "items" : "additionalItems";
7220
- const prefixItems = def.items.map((x$2, i$1) => process$3(x$2, ctx, {
7221
- ...params,
7222
- path: [
7223
- ...params.path,
7224
- prefixPath$1,
7225
- i$1
7226
- ]
7227
- }));
7228
- const rest = def.rest ? process$3(def.rest, ctx, {
7229
- ...params,
7230
- path: [
7231
- ...params.path,
7232
- restPath,
7233
- ...ctx.target === "openapi-3.0" ? [def.items.length] : []
7234
- ]
7235
- }) : null;
7236
- if (ctx.target === "draft-2020-12") {
7237
- json.prefixItems = prefixItems;
7238
- if (rest) json.items = rest;
7239
- } else if (ctx.target === "openapi-3.0") {
7240
- json.items = { anyOf: prefixItems };
7241
- if (rest) json.items.anyOf.push(rest);
7242
- json.minItems = prefixItems.length;
7243
- if (!rest) json.maxItems = prefixItems.length;
7244
- } else {
7245
- json.items = prefixItems;
7246
- if (rest) json.additionalItems = rest;
7247
- }
7248
- const { minimum, maximum } = schema._zod.bag;
7249
- if (typeof minimum === "number") json.minItems = minimum;
7250
- if (typeof maximum === "number") json.maxItems = maximum;
7251
- };
7252
7132
  const recordProcessor = (schema, ctx, _json, params) => {
7253
7133
  const json = _json;
7254
7134
  const def = schema._zod.def;
@@ -7344,12 +7224,6 @@ const optionalProcessor = (schema, ctx, _json, params) => {
7344
7224
  const seen = ctx.seen.get(schema);
7345
7225
  seen.ref = def.innerType;
7346
7226
  };
7347
- const lazyProcessor = (schema, ctx, _json, params) => {
7348
- const innerType = schema._zod.innerType;
7349
- process$3(innerType, ctx, params);
7350
- const seen = ctx.seen.get(schema);
7351
- seen.ref = innerType;
7352
- };
7353
7227
 
7354
7228
  //#endregion
7355
7229
  //#region node_modules/zod/v4/classic/iso.js
@@ -7806,25 +7680,6 @@ function intersection(left, right) {
7806
7680
  right
7807
7681
  });
7808
7682
  }
7809
- const ZodTuple = /* @__PURE__ */ $constructor("ZodTuple", (inst, def) => {
7810
- $ZodTuple.init(inst, def);
7811
- ZodType.init(inst, def);
7812
- inst._zod.processJSONSchema = (ctx, json, params) => tupleProcessor(inst, ctx, json, params);
7813
- inst.rest = (rest) => inst.clone({
7814
- ...inst._zod.def,
7815
- rest
7816
- });
7817
- });
7818
- function tuple(items, _paramsOrRest, _params) {
7819
- const hasRest = _paramsOrRest instanceof $ZodType;
7820
- const params = hasRest ? _params : _paramsOrRest;
7821
- return new ZodTuple({
7822
- type: "tuple",
7823
- items,
7824
- rest: hasRest ? _paramsOrRest : null,
7825
- ...normalizeParams(params)
7826
- });
7827
- }
7828
7683
  const ZodRecord = /* @__PURE__ */ $constructor("ZodRecord", (inst, def) => {
7829
7684
  $ZodRecord.init(inst, def);
7830
7685
  ZodType.init(inst, def);
@@ -8046,18 +7901,6 @@ function readonly(innerType) {
8046
7901
  innerType
8047
7902
  });
8048
7903
  }
8049
- const ZodLazy = /* @__PURE__ */ $constructor("ZodLazy", (inst, def) => {
8050
- $ZodLazy.init(inst, def);
8051
- ZodType.init(inst, def);
8052
- inst._zod.processJSONSchema = (ctx, json, params) => lazyProcessor(inst, ctx, json, params);
8053
- inst.unwrap = () => inst._zod.def.getter();
8054
- });
8055
- function lazy(getter) {
8056
- return new ZodLazy({
8057
- type: "lazy",
8058
- getter
8059
- });
8060
- }
8061
7904
  const ZodCustom = /* @__PURE__ */ $constructor("ZodCustom", (inst, def) => {
8062
7905
  $ZodCustom.init(inst, def);
8063
7906
  ZodType.init(inst, def);
@@ -16759,65 +16602,61 @@ const { convertPathToPattern } = import_out.default;
16759
16602
 
16760
16603
  //#endregion
16761
16604
  //#region src/core/resources/entity/schema.ts
16762
- /**
16763
- * Operator-based field condition (e.g., { $in: "{{user.id}}" })
16764
- */
16765
- const FieldConditionOperatorSchema = object({
16605
+ const FieldConditionSchema = union([string(), object({
16766
16606
  $in: unknown().optional(),
16767
16607
  $nin: unknown().optional(),
16768
16608
  $ne: unknown().optional(),
16769
16609
  $all: unknown().optional()
16770
- });
16771
- /**
16772
- * Field condition - either a string value/template or an operator object
16773
- */
16774
- const FieldConditionSchema = union([string(), FieldConditionOperatorSchema]);
16775
- /**
16776
- * User condition for direct property checks (equality only)
16777
- * Supports: role, email, id, and data.* pattern properties
16778
- */
16779
- const UserConditionSchema = object({
16610
+ })]);
16611
+ const userConditionAllowedKeys = new Set([
16612
+ "role",
16613
+ "email",
16614
+ "id"
16615
+ ]);
16616
+ const UserConditionSchema = looseObject({
16780
16617
  role: string().optional(),
16781
16618
  email: string().optional(),
16782
16619
  id: string().optional()
16783
- }).catchall(unknown()).refine((obj) => {
16784
- const allowedKeys = new Set([
16785
- "role",
16786
- "email",
16787
- "id"
16788
- ]);
16789
- const dataPattern = /^data\.[a-zA-Z0-9_]+$/;
16790
- for (const key of Object.keys(obj)) if (!allowedKeys.has(key) && !dataPattern.test(key)) return false;
16791
- return true;
16792
- }, { message: "User condition keys must be role, email, id, or match data.* pattern" });
16793
- const RLSConditionSchema = lazy(() => object({
16620
+ }).refine((val) => Object.keys(val).every((key) => userConditionAllowedKeys.has(key) || key.startsWith("data.")), "Keys must be role, email, id, or match data.* pattern");
16621
+ const rlsConditionAllowedKeys = new Set([
16622
+ "user_condition",
16623
+ "created_by",
16624
+ "created_by_id",
16625
+ "$or",
16626
+ "$and",
16627
+ "$nor"
16628
+ ]);
16629
+ const RLSConditionSchema = looseObject({
16794
16630
  user_condition: UserConditionSchema.optional(),
16795
- $or: array(RLSConditionSchema).optional(),
16796
- $and: array(RLSConditionSchema).optional(),
16797
- $nor: array(RLSConditionSchema).optional(),
16798
16631
  created_by: FieldConditionSchema.optional(),
16799
- created_by_id: FieldConditionSchema.optional()
16800
- }).catchall(FieldConditionSchema).refine((obj) => {
16801
- const allowedKeys = new Set([
16802
- "user_condition",
16803
- "$or",
16804
- "$and",
16805
- "$nor",
16806
- "created_by",
16807
- "created_by_id"
16808
- ]);
16809
- const dataPattern = /^data\.[a-zA-Z0-9_.]+$/;
16810
- for (const key of Object.keys(obj)) if (!allowedKeys.has(key) && !dataPattern.test(key)) return false;
16811
- return true;
16812
- }, { message: "RLS condition keys must be known fields or match data.* pattern" }));
16813
- /**
16814
- * RLS Rule - either a boolean or a condition object
16815
- */
16816
- const RLSRuleSchema = union([boolean(), RLSConditionSchema]);
16817
- /**
16818
- * Entity-level RLS - controls which records users can access
16819
- * Only allows: create, read, update, delete, write
16820
- */
16632
+ created_by_id: FieldConditionSchema.optional(),
16633
+ get $or() {
16634
+ return array(RefineRLSConditionSchema).optional();
16635
+ },
16636
+ get $and() {
16637
+ return array(RefineRLSConditionSchema).optional();
16638
+ },
16639
+ get $nor() {
16640
+ return array(RefineRLSConditionSchema).optional();
16641
+ }
16642
+ });
16643
+ const fieldConditionOperators = new Set([
16644
+ "$in",
16645
+ "$nin",
16646
+ "$ne",
16647
+ "$all"
16648
+ ]);
16649
+ const isValidFieldCondition = (value) => {
16650
+ if (value === null || typeof value === "string" || typeof value === "number" || typeof value === "boolean") return true;
16651
+ if (typeof value === "object") return Object.keys(value).every((k$2) => fieldConditionOperators.has(k$2));
16652
+ return false;
16653
+ };
16654
+ const RefineRLSConditionSchema = RLSConditionSchema.refine((val) => Object.entries(val).every(([key, value]) => {
16655
+ if (rlsConditionAllowedKeys.has(key)) return true;
16656
+ if (!key.startsWith("data.")) return false;
16657
+ return isValidFieldCondition(value);
16658
+ }), "Keys must be known RLS keys or match data.* pattern with valid value");
16659
+ const RLSRuleSchema = union([boolean(), RefineRLSConditionSchema]);
16821
16660
  const EntityRLSSchema = strictObject({
16822
16661
  create: RLSRuleSchema.optional(),
16823
16662
  read: RLSRuleSchema.optional(),
@@ -16825,10 +16664,6 @@ const EntityRLSSchema = strictObject({
16825
16664
  delete: RLSRuleSchema.optional(),
16826
16665
  write: RLSRuleSchema.optional()
16827
16666
  });
16828
- /**
16829
- * Field-level RLS - controls which fields users can access within records
16830
- * Only allows: read, write, create, update, delete
16831
- */
16832
16667
  const FieldRLSSchema = strictObject({
16833
16668
  read: RLSRuleSchema.optional(),
16834
16669
  write: RLSRuleSchema.optional(),
@@ -16836,9 +16671,6 @@ const FieldRLSSchema = strictObject({
16836
16671
  update: RLSRuleSchema.optional(),
16837
16672
  delete: RLSRuleSchema.optional()
16838
16673
  });
16839
- /**
16840
- * Property types supported by Base44 entities
16841
- */
16842
16674
  const PropertyTypeSchema = _enum([
16843
16675
  "string",
16844
16676
  "number",
@@ -16848,9 +16680,6 @@ const PropertyTypeSchema = _enum([
16848
16680
  "object",
16849
16681
  "binary"
16850
16682
  ]);
16851
- /**
16852
- * String format validation options
16853
- */
16854
16683
  const StringFormatSchema = _enum([
16855
16684
  "date",
16856
16685
  "date-time",
@@ -16864,11 +16693,7 @@ const StringFormatSchema = _enum([
16864
16693
  "file",
16865
16694
  "regex"
16866
16695
  ]);
16867
- /**
16868
- * Entity reference pattern: /entities/{EntityName}/id
16869
- */
16870
- const EntityRefSchema = string().regex(/^\/entities\/[a-zA-Z0-9]+\/id$/, "Reference must match pattern /entities/{EntityName}/id");
16871
- const PropertyDefinitionSchema = lazy(() => object({
16696
+ const PropertyDefinitionSchema = object({
16872
16697
  type: PropertyTypeSchema,
16873
16698
  title: string().optional(),
16874
16699
  description: string().optional(),
@@ -16881,23 +16706,19 @@ const PropertyDefinitionSchema = lazy(() => object({
16881
16706
  enum: array(string()).optional(),
16882
16707
  enumNames: array(string()).optional(),
16883
16708
  default: unknown().optional(),
16884
- $ref: EntityRefSchema.optional(),
16885
- items: PropertyDefinitionSchema.optional(),
16886
- properties: record(string(), PropertyDefinitionSchema).optional(),
16709
+ $ref: string().optional(),
16710
+ rls: FieldRLSSchema.optional(),
16887
16711
  required: array(string()).optional(),
16888
- rls: FieldRLSSchema.optional()
16889
- }));
16890
- /**
16891
- * Entity name pattern: alphanumeric only, no spaces or special characters
16892
- */
16893
- const EntityNameSchema = string().regex(/^[a-zA-Z0-9]+$/, "Entity name must be alphanumeric only");
16894
- /**
16895
- * Full Entity Schema for Base44 entity configuration
16896
- * Defines data structures with validation, security rules, and relationships
16897
- */
16712
+ get items() {
16713
+ return PropertyDefinitionSchema.optional();
16714
+ },
16715
+ get properties() {
16716
+ return record(string(), PropertyDefinitionSchema).optional();
16717
+ }
16718
+ });
16898
16719
  const EntitySchema = object({
16899
16720
  type: literal("object"),
16900
- name: EntityNameSchema,
16721
+ name: string().regex(/^[a-zA-Z0-9]+$/, "Entity name must be alphanumeric only"),
16901
16722
  title: string().optional(),
16902
16723
  description: string().optional(),
16903
16724
  properties: record(string(), PropertyDefinitionSchema),
@@ -16962,14 +16783,23 @@ const entityResource = {
16962
16783
 
16963
16784
  //#endregion
16964
16785
  //#region src/core/resources/function/schema.ts
16786
+ const FunctionNameSchema = string().trim().min(1, "Function name cannot be empty").regex(/^[^.]+$/, "Function name cannot contain dots");
16787
+ const FunctionFileSchema = object({
16788
+ path: string().min(1),
16789
+ content: string()
16790
+ });
16965
16791
  const FunctionConfigSchema = object({
16966
- name: string().min(1, "Function name cannot be empty").refine((name$1) => !name$1.includes("."), "Function name cannot contain dots"),
16967
- entry: string().min(1, "Entry point cannot be empty"),
16968
- triggers: tuple([]).optional()
16792
+ name: FunctionNameSchema,
16793
+ entry: string().min(1, "Entry point cannot be empty")
16969
16794
  });
16970
16795
  const FunctionSchema = FunctionConfigSchema.extend({
16971
16796
  entryPath: string().min(1, "Entry path cannot be empty"),
16972
- files: array(string()).min(1, "Files array cannot be empty")
16797
+ files: array(string()).min(1, "Function must have at least one file")
16798
+ });
16799
+ const FunctionDeploySchema = object({
16800
+ name: FunctionNameSchema,
16801
+ entry: string().min(1),
16802
+ files: array(FunctionFileSchema).min(1, "Function must have at least one file")
16973
16803
  });
16974
16804
  const DeployFunctionsResponseSchema = object({
16975
16805
  deployed: array(string()),
@@ -17073,7 +16903,30 @@ const functionResource = {
17073
16903
 
17074
16904
  //#endregion
17075
16905
  //#region src/core/resources/agent/schema.ts
17076
- const AgentConfigSchema = looseObject({ name: string().regex(/^[a-z0-9_]+$/, "Agent name must be lowercase alphanumeric with underscores").min(1).max(100) });
16906
+ const EntityOperationSchema = _enum([
16907
+ "create",
16908
+ "update",
16909
+ "delete",
16910
+ "read"
16911
+ ]);
16912
+ const EntityToolConfigSchema = object({
16913
+ entity_name: string().min(1),
16914
+ allowed_operations: array(EntityOperationSchema)
16915
+ });
16916
+ const BackendFunctionToolConfigSchema = object({
16917
+ function_name: string().min(1),
16918
+ description: string().default("agent backend function")
16919
+ });
16920
+ const ToolConfigSchema = union([EntityToolConfigSchema, BackendFunctionToolConfigSchema]);
16921
+ const ModelSchema = string().regex(/^(default|(anthropic|gemini|openai|vertex_ai)\/.+)$/, "Model must be \"default\" or start with: anthropic/, gemini/, openai/, vertex_ai/");
16922
+ const AgentConfigSchema = looseObject({
16923
+ name: string().regex(/^[a-z0-9_]+$/, "Agent name must be lowercase alphanumeric with underscores").min(1).max(100),
16924
+ description: string().trim().min(1, "Description is required"),
16925
+ instructions: string().trim().min(1, "Instructions are required"),
16926
+ tool_configs: array(ToolConfigSchema).optional().default([]),
16927
+ whatsapp_greeting: string().nullable().optional().default(null),
16928
+ model: ModelSchema.optional().default("default")
16929
+ });
17077
16930
  const SyncAgentsResponseSchema = object({
17078
16931
  created: array(string()),
17079
16932
  updated: array(string()),
@@ -0,0 +1,11 @@
1
+ {
2
+ "name": "task_manager",
3
+ "description": "An AI agent that helps you manage and change your tasks",
4
+ "instructions": "You are a helpful task management assistant. You can help users create, update, mark as completed, and delete tasks using the entity tool. When a user asks to change a task, help them modify it by updating the appropriate fields. Always be conversational and helpful.",
5
+ "tool_configs": [
6
+ {
7
+ "entity_name": "Task",
8
+ "allowed_operations": ["read", "create", "update", "delete"]
9
+ }
10
+ ]
11
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@base44-preview/cli",
3
- "version": "0.0.25-pr.151.082c391",
3
+ "version": "0.0.25-pr.151.1ef8126",
4
4
  "description": "Base44 CLI - Unified interface for managing Base44 applications",
5
5
  "type": "module",
6
6
  "bin": {
@@ -70,6 +70,5 @@
70
70
  },
71
71
  "optionalDependencies": {
72
72
  "@rollup/rollup-linux-x64-gnu": "^4.56.0"
73
- },
74
- "packageManager": "yarn@4.12.0+sha256.1fe4e1193cbcd13a48d8f436bb17d3c672b049a5e32a758aab9866a073db1702"
73
+ }
75
74
  }