@mastra/libsql 1.22.3-alpha.0 → 1.22.3-alpha.1

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
@@ -12761,6 +12761,9 @@ function parseJson(val, column, rowId) {
12761
12761
  }
12762
12762
  return val;
12763
12763
  }
12764
+ function workflowDefinitionSelectColumns() {
12765
+ return buildSelectColumns(TABLE_WORKFLOW_DEFINITIONS).replace("json(\"schedule\") as \"schedule\"", "\"schedule\"");
12766
+ }
12764
12767
  function rowToDefinition(row) {
12765
12768
  const inputSchema = parseJson(row.inputSchema, "inputSchema", row.id);
12766
12769
  const outputSchema = parseJson(row.outputSchema, "outputSchema", row.id);
@@ -12783,6 +12786,12 @@ function rowToDefinition(row) {
12783
12786
  if (stateSchema !== void 0) def.stateSchema = stateSchema;
12784
12787
  const requestContextSchema = parseJson(row.requestContextSchema, "requestContextSchema", row.id);
12785
12788
  if (requestContextSchema !== void 0) def.requestContextSchema = requestContextSchema;
12789
+ try {
12790
+ const schedule = parseJson(row.schedule, "schedule", row.id);
12791
+ if (schedule != null) def.schedule = schedule;
12792
+ } catch {
12793
+ def.schedule = row.schedule;
12794
+ }
12786
12795
  if (row.authorId != null) def.authorId = String(row.authorId);
12787
12796
  return def;
12788
12797
  }
@@ -12804,6 +12813,11 @@ var WorkflowDefinitionsLibSQL = class extends WorkflowDefinitionsStorage {
12804
12813
  tableName: TABLE_WORKFLOW_DEFINITIONS,
12805
12814
  schema: TABLE_SCHEMAS[TABLE_WORKFLOW_DEFINITIONS]
12806
12815
  });
12816
+ await this.#db.alterTable({
12817
+ tableName: TABLE_WORKFLOW_DEFINITIONS,
12818
+ schema: TABLE_SCHEMAS[TABLE_WORKFLOW_DEFINITIONS],
12819
+ ifNotExists: ["schedule"]
12820
+ });
12807
12821
  await this.#client.execute({
12808
12822
  sql: `CREATE INDEX IF NOT EXISTS idx_workflow_definitions_status ON "${TABLE_WORKFLOW_DEFINITIONS}" ("status")`,
12809
12823
  args: []
@@ -12827,6 +12841,7 @@ var WorkflowDefinitionsLibSQL = class extends WorkflowDefinitionsStorage {
12827
12841
  stateSchema: input.stateSchema ?? null,
12828
12842
  requestContextSchema: input.requestContextSchema ?? null,
12829
12843
  graph: input.graph,
12844
+ schedule: "schedule" in input ? input.schedule ?? null : null,
12830
12845
  status: "active",
12831
12846
  source: "storage",
12832
12847
  authorId: "authorId" in input ? input.authorId ?? null : null,
@@ -12857,6 +12872,7 @@ var WorkflowDefinitionsLibSQL = class extends WorkflowDefinitionsStorage {
12857
12872
  if ("stateSchema" in input && input.stateSchema !== void 0) data.stateSchema = input.stateSchema;
12858
12873
  if ("requestContextSchema" in input && input.requestContextSchema !== void 0) data.requestContextSchema = input.requestContextSchema;
12859
12874
  if ("graph" in input && input.graph !== void 0) data.graph = input.graph;
12875
+ if ("schedule" in input && input.schedule !== void 0) data.schedule = input.schedule;
12860
12876
  if ("status" in input && input.status !== void 0) data.status = input.status;
12861
12877
  if ("authorId" in input && input.authorId !== void 0) data.authorId = input.authorId;
12862
12878
  await this.#db.update({
@@ -12870,7 +12886,7 @@ var WorkflowDefinitionsLibSQL = class extends WorkflowDefinitionsStorage {
12870
12886
  }
12871
12887
  async get(id) {
12872
12888
  const row = (await this.#client.execute({
12873
- sql: `SELECT ${buildSelectColumns(TABLE_WORKFLOW_DEFINITIONS)} FROM "${TABLE_WORKFLOW_DEFINITIONS}" WHERE id = ?`,
12889
+ sql: `SELECT ${workflowDefinitionSelectColumns()} FROM "${TABLE_WORKFLOW_DEFINITIONS}" WHERE id = ?`,
12874
12890
  args: [id]
12875
12891
  })).rows[0];
12876
12892
  return row ? rowToDefinition(row) : null;
@@ -12888,7 +12904,7 @@ var WorkflowDefinitionsLibSQL = class extends WorkflowDefinitionsStorage {
12888
12904
  }
12889
12905
  const where = conditions.length > 0 ? `WHERE ${conditions.join(" AND ")}` : "";
12890
12906
  const definitions = (await this.#client.execute({
12891
- sql: `SELECT ${buildSelectColumns(TABLE_WORKFLOW_DEFINITIONS)} FROM "${TABLE_WORKFLOW_DEFINITIONS}" ${where} ORDER BY updatedAt DESC`,
12907
+ sql: `SELECT ${workflowDefinitionSelectColumns()} FROM "${TABLE_WORKFLOW_DEFINITIONS}" ${where} ORDER BY updatedAt DESC`,
12892
12908
  args: params
12893
12909
  })).rows.map((row) => rowToDefinition(row));
12894
12910
  return {