base44 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.
Files changed (2) hide show
  1. package/dist/cli/index.js +232 -195
  2. package/package.json +1 -1
package/dist/cli/index.js CHANGED
@@ -4547,7 +4547,6 @@ const string$1 = (params) => {
4547
4547
  };
4548
4548
  const integer = /^-?\d+$/;
4549
4549
  const number$1 = /^-?\d+(?:\.\d+)?$/;
4550
- const boolean$1 = /^(?:true|false)$/i;
4551
4550
  const lowercase = /^[^A-Z]*$/;
4552
4551
  const uppercase = /^[^a-z]*$/;
4553
4552
 
@@ -5326,24 +5325,6 @@ const $ZodNumberFormat = /* @__PURE__ */ $constructor("$ZodNumberFormat", (inst,
5326
5325
  $ZodCheckNumberFormat.init(inst, def);
5327
5326
  $ZodNumber.init(inst, def);
5328
5327
  });
5329
- const $ZodBoolean = /* @__PURE__ */ $constructor("$ZodBoolean", (inst, def) => {
5330
- $ZodType.init(inst, def);
5331
- inst._zod.pattern = boolean$1;
5332
- inst._zod.parse = (payload, _ctx) => {
5333
- if (def.coerce) try {
5334
- payload.value = Boolean(payload.value);
5335
- } catch (_$2) {}
5336
- const input = payload.value;
5337
- if (typeof input === "boolean") return payload;
5338
- payload.issues.push({
5339
- expected: "boolean",
5340
- code: "invalid_type",
5341
- input,
5342
- inst
5343
- });
5344
- return payload;
5345
- };
5346
- });
5347
5328
  const $ZodUnknown = /* @__PURE__ */ $constructor("$ZodUnknown", (inst, def) => {
5348
5329
  $ZodType.init(inst, def);
5349
5330
  inst._zod.parse = (payload) => payload;
@@ -5649,61 +5630,6 @@ const $ZodUnion = /* @__PURE__ */ $constructor("$ZodUnion", (inst, def) => {
5649
5630
  });
5650
5631
  };
5651
5632
  });
5652
- const $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnion", (inst, def) => {
5653
- def.inclusive = false;
5654
- $ZodUnion.init(inst, def);
5655
- const _super = inst._zod.parse;
5656
- defineLazy(inst._zod, "propValues", () => {
5657
- const propValues = {};
5658
- for (const option of def.options) {
5659
- const pv = option._zod.propValues;
5660
- if (!pv || Object.keys(pv).length === 0) throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(option)}"`);
5661
- for (const [k$2, v$1] of Object.entries(pv)) {
5662
- if (!propValues[k$2]) propValues[k$2] = /* @__PURE__ */ new Set();
5663
- for (const val of v$1) propValues[k$2].add(val);
5664
- }
5665
- }
5666
- return propValues;
5667
- });
5668
- const disc = cached(() => {
5669
- const opts = def.options;
5670
- const map = /* @__PURE__ */ new Map();
5671
- for (const o$2 of opts) {
5672
- const values = o$2._zod.propValues?.[def.discriminator];
5673
- if (!values || values.size === 0) throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(o$2)}"`);
5674
- for (const v$1 of values) {
5675
- if (map.has(v$1)) throw new Error(`Duplicate discriminator value "${String(v$1)}"`);
5676
- map.set(v$1, o$2);
5677
- }
5678
- }
5679
- return map;
5680
- });
5681
- inst._zod.parse = (payload, ctx) => {
5682
- const input = payload.value;
5683
- if (!isObject$2(input)) {
5684
- payload.issues.push({
5685
- code: "invalid_type",
5686
- expected: "object",
5687
- input,
5688
- inst
5689
- });
5690
- return payload;
5691
- }
5692
- const opt = disc.value.get(input?.[def.discriminator]);
5693
- if (opt) return opt._zod.run(payload, ctx);
5694
- if (def.unionFallback) return _super(payload, ctx);
5695
- payload.issues.push({
5696
- code: "invalid_union",
5697
- errors: [],
5698
- note: "No matching discriminator",
5699
- discriminator: def.discriminator,
5700
- input,
5701
- path: [def.discriminator],
5702
- inst
5703
- });
5704
- return payload;
5705
- };
5706
- });
5707
5633
  const $ZodIntersection = /* @__PURE__ */ $constructor("$ZodIntersection", (inst, def) => {
5708
5634
  $ZodType.init(inst, def);
5709
5635
  inst._zod.parse = (payload, ctx) => {
@@ -5803,6 +5729,77 @@ function handleIntersectionResults(result, left, right) {
5803
5729
  result.value = merged.data;
5804
5730
  return result;
5805
5731
  }
5732
+ const $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
5733
+ $ZodType.init(inst, def);
5734
+ const items = def.items;
5735
+ inst._zod.parse = (payload, ctx) => {
5736
+ const input = payload.value;
5737
+ if (!Array.isArray(input)) {
5738
+ payload.issues.push({
5739
+ input,
5740
+ inst,
5741
+ expected: "tuple",
5742
+ code: "invalid_type"
5743
+ });
5744
+ return payload;
5745
+ }
5746
+ payload.value = [];
5747
+ const proms = [];
5748
+ const reversedIndex = [...items].reverse().findIndex((item) => item._zod.optin !== "optional");
5749
+ const optStart = reversedIndex === -1 ? 0 : items.length - reversedIndex;
5750
+ if (!def.rest) {
5751
+ const tooBig = input.length > items.length;
5752
+ const tooSmall = input.length < optStart - 1;
5753
+ if (tooBig || tooSmall) {
5754
+ payload.issues.push({
5755
+ ...tooBig ? {
5756
+ code: "too_big",
5757
+ maximum: items.length,
5758
+ inclusive: true
5759
+ } : {
5760
+ code: "too_small",
5761
+ minimum: items.length
5762
+ },
5763
+ input,
5764
+ inst,
5765
+ origin: "array"
5766
+ });
5767
+ return payload;
5768
+ }
5769
+ }
5770
+ let i$1 = -1;
5771
+ for (const item of items) {
5772
+ i$1++;
5773
+ if (i$1 >= input.length) {
5774
+ if (i$1 >= optStart) continue;
5775
+ }
5776
+ const result = item._zod.run({
5777
+ value: input[i$1],
5778
+ issues: []
5779
+ }, ctx);
5780
+ if (result instanceof Promise) proms.push(result.then((result$1) => handleTupleResult(result$1, payload, i$1)));
5781
+ else handleTupleResult(result, payload, i$1);
5782
+ }
5783
+ if (def.rest) {
5784
+ const rest = input.slice(items.length);
5785
+ for (const el of rest) {
5786
+ i$1++;
5787
+ const result = def.rest._zod.run({
5788
+ value: el,
5789
+ issues: []
5790
+ }, ctx);
5791
+ if (result instanceof Promise) proms.push(result.then((result$1) => handleTupleResult(result$1, payload, i$1)));
5792
+ else handleTupleResult(result, payload, i$1);
5793
+ }
5794
+ }
5795
+ if (proms.length) return Promise.all(proms).then(() => payload);
5796
+ return payload;
5797
+ };
5798
+ });
5799
+ function handleTupleResult(result, final, index) {
5800
+ if (result.issues.length) final.issues.push(...prefixIssues(index, result.issues));
5801
+ final.value[index] = result.value;
5802
+ }
5806
5803
  const $ZodEnum = /* @__PURE__ */ $constructor("$ZodEnum", (inst, def) => {
5807
5804
  $ZodType.init(inst, def);
5808
5805
  const values = getEnumValues(def.entries);
@@ -5821,24 +5818,6 @@ const $ZodEnum = /* @__PURE__ */ $constructor("$ZodEnum", (inst, def) => {
5821
5818
  return payload;
5822
5819
  };
5823
5820
  });
5824
- const $ZodLiteral = /* @__PURE__ */ $constructor("$ZodLiteral", (inst, def) => {
5825
- $ZodType.init(inst, def);
5826
- if (def.values.length === 0) throw new Error("Cannot create literal schema with no valid values");
5827
- const values = new Set(def.values);
5828
- inst._zod.values = values;
5829
- inst._zod.pattern = /* @__PURE__ */ new RegExp(`^(${def.values.map((o$2) => typeof o$2 === "string" ? escapeRegex(o$2) : o$2 ? escapeRegex(o$2.toString()) : String(o$2)).join("|")})$`);
5830
- inst._zod.parse = (payload, _ctx) => {
5831
- const input = payload.value;
5832
- if (values.has(input)) return payload;
5833
- payload.issues.push({
5834
- code: "invalid_value",
5835
- values: def.values,
5836
- input,
5837
- inst
5838
- });
5839
- return payload;
5840
- };
5841
- });
5842
5821
  const $ZodTransform = /* @__PURE__ */ $constructor("$ZodTransform", (inst, def) => {
5843
5822
  $ZodType.init(inst, def);
5844
5823
  inst._zod.parse = (payload, ctx) => {
@@ -6400,13 +6379,6 @@ function _int(Class, params) {
6400
6379
  });
6401
6380
  }
6402
6381
  /* @__NO_SIDE_EFFECTS__ */
6403
- function _boolean(Class, params) {
6404
- return new Class({
6405
- type: "boolean",
6406
- ...normalizeParams(params)
6407
- });
6408
- }
6409
- /* @__NO_SIDE_EFFECTS__ */
6410
6382
  function _unknown(Class) {
6411
6383
  return new Class({ type: "unknown" });
6412
6384
  }
@@ -6977,9 +6949,6 @@ const numberProcessor = (schema, ctx, _json, _params) => {
6977
6949
  }
6978
6950
  if (typeof multipleOf === "number") json.multipleOf = multipleOf;
6979
6951
  };
6980
- const booleanProcessor = (_schema, _ctx, json, _params) => {
6981
- json.type = "boolean";
6982
- };
6983
6952
  const neverProcessor = (_schema, _ctx, json, _params) => {
6984
6953
  json.not = {};
6985
6954
  };
@@ -6991,27 +6960,6 @@ const enumProcessor = (schema, _ctx, json, _params) => {
6991
6960
  if (values.every((v$1) => typeof v$1 === "string")) json.type = "string";
6992
6961
  json.enum = values;
6993
6962
  };
6994
- const literalProcessor = (schema, ctx, json, _params) => {
6995
- const def = schema._zod.def;
6996
- const vals = [];
6997
- for (const val of def.values) if (val === void 0) {
6998
- if (ctx.unrepresentable === "throw") throw new Error("Literal `undefined` cannot be represented in JSON Schema");
6999
- } else if (typeof val === "bigint") if (ctx.unrepresentable === "throw") throw new Error("BigInt literals cannot be represented in JSON Schema");
7000
- else vals.push(Number(val));
7001
- else vals.push(val);
7002
- if (vals.length === 0) {} else if (vals.length === 1) {
7003
- const val = vals[0];
7004
- json.type = val === null ? "null" : typeof val;
7005
- if (ctx.target === "draft-04" || ctx.target === "openapi-3.0") json.enum = [val];
7006
- else json.const = val;
7007
- } else {
7008
- if (vals.every((v$1) => typeof v$1 === "number")) json.type = "number";
7009
- if (vals.every((v$1) => typeof v$1 === "string")) json.type = "string";
7010
- if (vals.every((v$1) => typeof v$1 === "boolean")) json.type = "boolean";
7011
- if (vals.every((v$1) => v$1 === null)) json.type = "null";
7012
- json.enum = vals;
7013
- }
7014
- };
7015
6963
  const customProcessor = (_schema, ctx, _json, _params) => {
7016
6964
  if (ctx.unrepresentable === "throw") throw new Error("Custom types cannot be represented in JSON Schema");
7017
6965
  };
@@ -7094,6 +7042,44 @@ const intersectionProcessor = (schema, ctx, json, params) => {
7094
7042
  const isSimpleIntersection = (val) => "allOf" in val && Object.keys(val).length === 1;
7095
7043
  json.allOf = [...isSimpleIntersection(a$1) ? a$1.allOf : [a$1], ...isSimpleIntersection(b$2) ? b$2.allOf : [b$2]];
7096
7044
  };
7045
+ const tupleProcessor = (schema, ctx, _json, params) => {
7046
+ const json = _json;
7047
+ const def = schema._zod.def;
7048
+ json.type = "array";
7049
+ const prefixPath$1 = ctx.target === "draft-2020-12" ? "prefixItems" : "items";
7050
+ const restPath = ctx.target === "draft-2020-12" ? "items" : ctx.target === "openapi-3.0" ? "items" : "additionalItems";
7051
+ const prefixItems = def.items.map((x$2, i$1) => process$2(x$2, ctx, {
7052
+ ...params,
7053
+ path: [
7054
+ ...params.path,
7055
+ prefixPath$1,
7056
+ i$1
7057
+ ]
7058
+ }));
7059
+ const rest = def.rest ? process$2(def.rest, ctx, {
7060
+ ...params,
7061
+ path: [
7062
+ ...params.path,
7063
+ restPath,
7064
+ ...ctx.target === "openapi-3.0" ? [def.items.length] : []
7065
+ ]
7066
+ }) : null;
7067
+ if (ctx.target === "draft-2020-12") {
7068
+ json.prefixItems = prefixItems;
7069
+ if (rest) json.items = rest;
7070
+ } else if (ctx.target === "openapi-3.0") {
7071
+ json.items = { anyOf: prefixItems };
7072
+ if (rest) json.items.anyOf.push(rest);
7073
+ json.minItems = prefixItems.length;
7074
+ if (!rest) json.maxItems = prefixItems.length;
7075
+ } else {
7076
+ json.items = prefixItems;
7077
+ if (rest) json.additionalItems = rest;
7078
+ }
7079
+ const { minimum, maximum } = schema._zod.bag;
7080
+ if (typeof minimum === "number") json.minItems = minimum;
7081
+ if (typeof maximum === "number") json.maxItems = maximum;
7082
+ };
7097
7083
  const nullableProcessor = (schema, ctx, json, params) => {
7098
7084
  const def = schema._zod.def;
7099
7085
  const inner = process$2(def.innerType, ctx, params);
@@ -7486,14 +7472,6 @@ const ZodNumberFormat = /* @__PURE__ */ $constructor("ZodNumberFormat", (inst, d
7486
7472
  function int(params) {
7487
7473
  return _int(ZodNumberFormat, params);
7488
7474
  }
7489
- const ZodBoolean = /* @__PURE__ */ $constructor("ZodBoolean", (inst, def) => {
7490
- $ZodBoolean.init(inst, def);
7491
- ZodType.init(inst, def);
7492
- inst._zod.processJSONSchema = (ctx, json, params) => booleanProcessor(inst, ctx, json, params);
7493
- });
7494
- function boolean(params) {
7495
- return _boolean(ZodBoolean, params);
7496
- }
7497
7475
  const ZodUnknown = /* @__PURE__ */ $constructor("ZodUnknown", (inst, def) => {
7498
7476
  $ZodUnknown.init(inst, def);
7499
7477
  ZodType.init(inst, def);
@@ -7592,18 +7570,6 @@ function union(options, params) {
7592
7570
  ...normalizeParams(params)
7593
7571
  });
7594
7572
  }
7595
- const ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("ZodDiscriminatedUnion", (inst, def) => {
7596
- ZodUnion.init(inst, def);
7597
- $ZodDiscriminatedUnion.init(inst, def);
7598
- });
7599
- function discriminatedUnion(discriminator, options, params) {
7600
- return new ZodDiscriminatedUnion({
7601
- type: "union",
7602
- options,
7603
- discriminator,
7604
- ...normalizeParams(params)
7605
- });
7606
- }
7607
7573
  const ZodIntersection = /* @__PURE__ */ $constructor("ZodIntersection", (inst, def) => {
7608
7574
  $ZodIntersection.init(inst, def);
7609
7575
  ZodType.init(inst, def);
@@ -7616,6 +7582,25 @@ function intersection(left, right) {
7616
7582
  right
7617
7583
  });
7618
7584
  }
7585
+ const ZodTuple = /* @__PURE__ */ $constructor("ZodTuple", (inst, def) => {
7586
+ $ZodTuple.init(inst, def);
7587
+ ZodType.init(inst, def);
7588
+ inst._zod.processJSONSchema = (ctx, json, params) => tupleProcessor(inst, ctx, json, params);
7589
+ inst.rest = (rest) => inst.clone({
7590
+ ...inst._zod.def,
7591
+ rest
7592
+ });
7593
+ });
7594
+ function tuple(items, _paramsOrRest, _params) {
7595
+ const hasRest = _paramsOrRest instanceof $ZodType;
7596
+ const params = hasRest ? _params : _paramsOrRest;
7597
+ return new ZodTuple({
7598
+ type: "tuple",
7599
+ items,
7600
+ rest: hasRest ? _paramsOrRest : null,
7601
+ ...normalizeParams(params)
7602
+ });
7603
+ }
7619
7604
  const ZodEnum = /* @__PURE__ */ $constructor("ZodEnum", (inst, def) => {
7620
7605
  $ZodEnum.init(inst, def);
7621
7606
  ZodType.init(inst, def);
@@ -7653,23 +7638,6 @@ function _enum(values, params) {
7653
7638
  ...normalizeParams(params)
7654
7639
  });
7655
7640
  }
7656
- const ZodLiteral = /* @__PURE__ */ $constructor("ZodLiteral", (inst, def) => {
7657
- $ZodLiteral.init(inst, def);
7658
- ZodType.init(inst, def);
7659
- inst._zod.processJSONSchema = (ctx, json, params) => literalProcessor(inst, ctx, json, params);
7660
- inst.values = new Set(def.values);
7661
- Object.defineProperty(inst, "value", { get() {
7662
- if (def.values.length > 1) throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");
7663
- return def.values[0];
7664
- } });
7665
- });
7666
- function literal(value, params) {
7667
- return new ZodLiteral({
7668
- type: "literal",
7669
- values: Array.isArray(value) ? value : [value],
7670
- ...normalizeParams(params)
7671
- });
7672
- }
7673
7641
  const ZodTransform = /* @__PURE__ */ $constructor("ZodTransform", (inst, def) => {
7674
7642
  $ZodTransform.init(inst, def);
7675
7643
  ZodType.init(inst, def);
@@ -16717,6 +16685,14 @@ async function readFile$1(filePath) {
16717
16685
  throw new Error(`Failed to read file ${filePath}: ${error instanceof Error ? error.message : "Unknown error"}`);
16718
16686
  }
16719
16687
  }
16688
+ async function readTextFile(filePath) {
16689
+ if (!await pathExists(filePath)) throw new Error(`File not found: ${filePath}`);
16690
+ try {
16691
+ return await readFile(filePath, "utf-8");
16692
+ } catch (error) {
16693
+ throw new Error(`Failed to read file ${filePath}: ${error instanceof Error ? error.message : "Unknown error"}`);
16694
+ }
16695
+ }
16720
16696
  async function readJsonFile(filePath) {
16721
16697
  if (!await pathExists(filePath)) throw new Error(`File not found: ${filePath}`);
16722
16698
  try {
@@ -16789,39 +16765,19 @@ const entityResource = {
16789
16765
 
16790
16766
  //#endregion
16791
16767
  //#region src/core/resources/function/schema.ts
16792
- const HttpTriggerSchema = object({
16793
- id: string().optional(),
16794
- name: string().optional(),
16795
- description: string().optional(),
16796
- type: literal("http"),
16797
- path: string().min(1, "Path cannot be empty")
16798
- });
16799
- const ScheduleTriggerSchema = object({
16800
- id: string().optional(),
16801
- name: string().optional(),
16802
- description: string().optional(),
16803
- type: literal("schedule"),
16804
- scheduleMode: _enum(["recurring", "once"]).optional(),
16805
- cron: string().min(1, "Cron expression cannot be empty"),
16806
- isActive: boolean().optional(),
16807
- timezone: string().optional()
16808
- });
16809
- const EventTriggerSchema = object({
16810
- id: string().optional(),
16811
- name: string().optional(),
16812
- description: string().optional(),
16813
- type: literal("event"),
16814
- entity: string().min(1, "Entity name cannot be empty"),
16815
- event: string().min(1, "Event type cannot be empty")
16816
- });
16817
- const TriggerSchema = discriminatedUnion("type", [
16818
- HttpTriggerSchema,
16819
- ScheduleTriggerSchema,
16820
- EventTriggerSchema
16821
- ]);
16822
16768
  const FunctionConfigSchema = object({
16769
+ name: string().min(1, "Function name cannot be empty").refine((name$1) => !name$1.includes("."), "Function name cannot contain dots"),
16823
16770
  entry: string().min(1, "Entry point cannot be empty"),
16824
- triggers: array(TriggerSchema).optional()
16771
+ triggers: tuple([]).optional()
16772
+ });
16773
+ const FunctionSchema = FunctionConfigSchema.extend({ codePath: string().min(1, "Code path cannot be empty") });
16774
+ const DeployFunctionsResponseSchema = object({
16775
+ deployed: array(string()),
16776
+ deleted: array(string()),
16777
+ errors: array(object({
16778
+ name: string(),
16779
+ message: string()
16780
+ })).nullable()
16825
16781
  });
16826
16782
 
16827
16783
  //#endregion
@@ -16829,7 +16785,19 @@ const FunctionConfigSchema = object({
16829
16785
  async function readFunctionConfig(configPath) {
16830
16786
  const parsed = await readJsonFile(configPath);
16831
16787
  const result = FunctionConfigSchema.safeParse(parsed);
16832
- if (!result.success) throw new Error(`Invalid function configuration in ${configPath}: ${result.error.issues.map((e$1) => e$1.message).join(", ")}`);
16788
+ if (!result.success) throw new Error(`Invalid function configuration in ${configPath}: ${result.error.message}`);
16789
+ return result.data;
16790
+ }
16791
+ async function readFunction(configPath) {
16792
+ const config$2 = await readFunctionConfig(configPath);
16793
+ const codePath = join(dirname(configPath), config$2.entry);
16794
+ if (!await pathExists(codePath)) throw new Error(`Function code file not found: ${codePath} (referenced in ${configPath})`);
16795
+ const functionData = {
16796
+ ...config$2,
16797
+ codePath
16798
+ };
16799
+ const result = FunctionSchema.safeParse(functionData);
16800
+ if (!result.success) throw new Error(`Invalid function in ${configPath}: ${result.error.message}`);
16833
16801
  return result.data;
16834
16802
  }
16835
16803
  async function readAllFunctions(functionsDir) {
@@ -16838,12 +16806,56 @@ async function readAllFunctions(functionsDir) {
16838
16806
  cwd: functionsDir,
16839
16807
  absolute: true
16840
16808
  });
16841
- return await Promise.all(configFiles.map((configPath) => readFunctionConfig(configPath)));
16809
+ const functions = await Promise.all(configFiles.map((configPath) => readFunction(configPath)));
16810
+ const names = /* @__PURE__ */ new Set();
16811
+ for (const fn of functions) {
16812
+ if (names.has(fn.name)) throw new Error(`Duplicate function name "${fn.name}"`);
16813
+ names.add(fn.name);
16814
+ }
16815
+ return functions;
16816
+ }
16817
+
16818
+ //#endregion
16819
+ //#region src/core/resources/function/api.ts
16820
+ function toDeployPayloadItem(fn) {
16821
+ return {
16822
+ name: fn.name,
16823
+ entry: fn.entry,
16824
+ files: [{
16825
+ path: fn.entry,
16826
+ content: fn.code
16827
+ }]
16828
+ };
16829
+ }
16830
+ async function deployFunctions(functions) {
16831
+ const appClient = getAppClient();
16832
+ const payload = { functions: functions.map(toDeployPayloadItem) };
16833
+ const response = await appClient.put("backend-functions", {
16834
+ json: payload,
16835
+ timeout: 3e4
16836
+ });
16837
+ return DeployFunctionsResponseSchema.parse(await response.json());
16838
+ }
16839
+
16840
+ //#endregion
16841
+ //#region src/core/resources/function/deploy.ts
16842
+ async function loadFunctionCode(fn) {
16843
+ const code$1 = await readTextFile(fn.codePath);
16844
+ return {
16845
+ ...fn,
16846
+ code: code$1
16847
+ };
16848
+ }
16849
+ async function pushFunctions(functions) {
16850
+ return deployFunctions(await Promise.all(functions.map(loadFunctionCode)));
16842
16851
  }
16843
16852
 
16844
16853
  //#endregion
16845
16854
  //#region src/core/resources/function/resource.ts
16846
- const functionResource = { readAll: readAllFunctions };
16855
+ const functionResource = {
16856
+ readAll: readAllFunctions,
16857
+ push: pushFunctions
16858
+ };
16847
16859
 
16848
16860
  //#endregion
16849
16861
  //#region src/core/project/schema.ts
@@ -31503,6 +31515,30 @@ const entitiesPushCommand = new Command("entities").description("Manage project
31503
31515
  await runCommand(pushEntitiesAction, { requireAuth: true });
31504
31516
  }));
31505
31517
 
31518
+ //#endregion
31519
+ //#region src/cli/commands/functions/deploy.ts
31520
+ async function deployFunctionsAction() {
31521
+ const { functions } = await readProjectConfig();
31522
+ if (functions.length === 0) return { outroMessage: "No functions found. Create functions in the 'functions' directory." };
31523
+ M.info(`Found ${functions.length} ${functions.length === 1 ? "function" : "functions"} to deploy`);
31524
+ const result = await runTask("Deploying functions to Base44", async () => {
31525
+ return await pushFunctions(functions);
31526
+ }, {
31527
+ successMessage: "Functions deployed successfully",
31528
+ errorMessage: "Failed to deploy functions"
31529
+ });
31530
+ if (result.deployed.length > 0) M.success(`Deployed: ${result.deployed.join(", ")}`);
31531
+ if (result.deleted.length > 0) M.warn(`Deleted: ${result.deleted.join(", ")}`);
31532
+ if (result.errors && result.errors.length > 0) {
31533
+ const errorMessages = result.errors.map((e$1) => `'${e$1.name}' function: ${e$1.message}`).join("\n");
31534
+ throw new Error(`Function deployment errors:\n${errorMessages}`);
31535
+ }
31536
+ return {};
31537
+ }
31538
+ const functionsDeployCommand = new Command("functions").description("Manage project functions").addCommand(new Command("deploy").description("Deploy local functions to Base44").action(async () => {
31539
+ await runCommand(deployFunctionsAction, { requireAuth: true });
31540
+ }));
31541
+
31506
31542
  //#endregion
31507
31543
  //#region node_modules/is-plain-obj/index.js
31508
31544
  function isPlainObject(value) {
@@ -38329,7 +38365,7 @@ const siteDeployCommand = new Command("site").description("Manage site deploymen
38329
38365
 
38330
38366
  //#endregion
38331
38367
  //#region package.json
38332
- var version = "0.0.10";
38368
+ var version = "0.0.11";
38333
38369
 
38334
38370
  //#endregion
38335
38371
  //#region src/cli/index.ts
@@ -38340,6 +38376,7 @@ program.addCommand(whoamiCommand);
38340
38376
  program.addCommand(logoutCommand);
38341
38377
  program.addCommand(createCommand);
38342
38378
  program.addCommand(entitiesPushCommand);
38379
+ program.addCommand(functionsDeployCommand);
38343
38380
  program.addCommand(siteDeployCommand);
38344
38381
  program.parse();
38345
38382
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "base44",
3
- "version": "0.0.10",
3
+ "version": "0.0.11",
4
4
  "description": "Base44 CLI - Unified interface for managing Base44 applications",
5
5
  "type": "module",
6
6
  "main": "./dist/cli/index.js",