@devpad/cli 2.5.0 → 2.5.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.
Files changed (2) hide show
  1. package/dist/index.js +313 -3
  2. package/package.json +6 -6
package/dist/index.js CHANGED
@@ -661,6 +661,9 @@ var init_view_common = __esm(() => {
661
661
  });
662
662
 
663
663
  // ../../node_modules/drizzle-orm/table.js
664
+ function isTable(table) {
665
+ return typeof table === "object" && table !== null && IsDrizzleTable in table;
666
+ }
664
667
  function getTableName(table) {
665
668
  return table[TableName];
666
669
  }
@@ -756,6 +759,9 @@ function fillPlaceholders(params, values) {
756
759
  return p;
757
760
  });
758
761
  }
762
+ function isView(view) {
763
+ return typeof view === "object" && view !== null && IsDrizzleView in view;
764
+ }
759
765
  var FakePrimitiveParam, StringChunk, SQL, Name, noopDecoder, noopEncoder, noopMapper, Param, Placeholder, IsDrizzleView, View;
760
766
  var init_sql = __esm(() => {
761
767
  init_entity();
@@ -1381,6 +1387,9 @@ function applyMixins(baseClass, extendedClasses) {
1381
1387
  function getTableColumns(table) {
1382
1388
  return table[Table.Symbol.Columns];
1383
1389
  }
1390
+ function getViewSelectedFields(view) {
1391
+ return view[ViewBaseConfig].selectedFields;
1392
+ }
1384
1393
  function getTableLikeName(table) {
1385
1394
  return is(table, Subquery) ? table._.alias : is(table, View) ? table[ViewBaseConfig].name : is(table, SQL) ? undefined : table[Table.Symbol.IsAlias] ? table[Table.Symbol.Name] : table[Table.Symbol.BaseName];
1386
1395
  }
@@ -15824,9 +15833,264 @@ var require_mime = __commonJS(function(exports, module) {
15824
15833
  module.exports = new Mime(require_standard(), require_other());
15825
15834
  });
15826
15835
 
15827
- // ../api/dist/chunk-T36ENKOA.js
15836
+ // ../api/dist/chunk-HIDAIYV4.js
15828
15837
  init_drizzle_orm();
15829
15838
  init_sqlite_core();
15839
+
15840
+ // ../../node_modules/drizzle-zod/index.mjs
15841
+ init_zod();
15842
+ init_drizzle_orm();
15843
+ var CONSTANTS = {
15844
+ INT8_MIN: -128,
15845
+ INT8_MAX: 127,
15846
+ INT8_UNSIGNED_MAX: 255,
15847
+ INT16_MIN: -32768,
15848
+ INT16_MAX: 32767,
15849
+ INT16_UNSIGNED_MAX: 65535,
15850
+ INT24_MIN: -8388608,
15851
+ INT24_MAX: 8388607,
15852
+ INT24_UNSIGNED_MAX: 16777215,
15853
+ INT32_MIN: -2147483648,
15854
+ INT32_MAX: 2147483647,
15855
+ INT32_UNSIGNED_MAX: 4294967295,
15856
+ INT48_MIN: -140737488355328,
15857
+ INT48_MAX: 140737488355327,
15858
+ INT48_UNSIGNED_MAX: 281474976710655,
15859
+ INT64_MIN: -9223372036854775808n,
15860
+ INT64_MAX: 9223372036854775807n,
15861
+ INT64_UNSIGNED_MAX: 18446744073709551615n
15862
+ };
15863
+ function isColumnType(column2, columnTypes) {
15864
+ return columnTypes.includes(column2.columnType);
15865
+ }
15866
+ function isWithEnum(column2) {
15867
+ return "enumValues" in column2 && Array.isArray(column2.enumValues) && column2.enumValues.length > 0;
15868
+ }
15869
+ var isPgEnum2 = isWithEnum;
15870
+ var literalSchema = exports_external.union([exports_external.string(), exports_external.number(), exports_external.boolean(), exports_external.null()]);
15871
+ var jsonSchema = exports_external.union([literalSchema, exports_external.record(exports_external.any()), exports_external.array(exports_external.any())]);
15872
+ var bufferSchema = exports_external.custom((v) => v instanceof Buffer);
15873
+ function columnToSchema(column2, factory) {
15874
+ const z$1 = factory?.zodInstance ?? exports_external;
15875
+ const coerce2 = factory?.coerce ?? {};
15876
+ let schema;
15877
+ if (isWithEnum(column2)) {
15878
+ schema = column2.enumValues.length ? z$1.enum(column2.enumValues) : z$1.string();
15879
+ }
15880
+ if (!schema) {
15881
+ if (isColumnType(column2, ["PgGeometry", "PgPointTuple"])) {
15882
+ schema = z$1.tuple([z$1.number(), z$1.number()]);
15883
+ } else if (isColumnType(column2, ["PgGeometryObject", "PgPointObject"])) {
15884
+ schema = z$1.object({ x: z$1.number(), y: z$1.number() });
15885
+ } else if (isColumnType(column2, ["PgHalfVector", "PgVector"])) {
15886
+ schema = z$1.array(z$1.number());
15887
+ schema = column2.dimensions ? schema.length(column2.dimensions) : schema;
15888
+ } else if (isColumnType(column2, ["PgLine"])) {
15889
+ schema = z$1.tuple([z$1.number(), z$1.number(), z$1.number()]);
15890
+ } else if (isColumnType(column2, ["PgLineABC"])) {
15891
+ schema = z$1.object({
15892
+ a: z$1.number(),
15893
+ b: z$1.number(),
15894
+ c: z$1.number()
15895
+ });
15896
+ } else if (isColumnType(column2, ["PgArray"])) {
15897
+ schema = z$1.array(columnToSchema(column2.baseColumn, z$1));
15898
+ schema = column2.size ? schema.length(column2.size) : schema;
15899
+ } else if (column2.dataType === "array") {
15900
+ schema = z$1.array(z$1.any());
15901
+ } else if (column2.dataType === "number") {
15902
+ schema = numberColumnToSchema(column2, z$1, coerce2);
15903
+ } else if (column2.dataType === "bigint") {
15904
+ schema = bigintColumnToSchema(column2, z$1, coerce2);
15905
+ } else if (column2.dataType === "boolean") {
15906
+ schema = coerce2 === true || coerce2.boolean ? z$1.coerce.boolean() : z$1.boolean();
15907
+ } else if (column2.dataType === "date") {
15908
+ schema = coerce2 === true || coerce2.date ? z$1.coerce.date() : z$1.date();
15909
+ } else if (column2.dataType === "string") {
15910
+ schema = stringColumnToSchema(column2, z$1, coerce2);
15911
+ } else if (column2.dataType === "json") {
15912
+ schema = jsonSchema;
15913
+ } else if (column2.dataType === "custom") {
15914
+ schema = z$1.any();
15915
+ } else if (column2.dataType === "buffer") {
15916
+ schema = bufferSchema;
15917
+ }
15918
+ }
15919
+ if (!schema) {
15920
+ schema = z$1.any();
15921
+ }
15922
+ return schema;
15923
+ }
15924
+ function numberColumnToSchema(column2, z, coerce2) {
15925
+ let unsigned = column2.getSQLType().includes("unsigned");
15926
+ let min;
15927
+ let max;
15928
+ let integer3 = false;
15929
+ if (isColumnType(column2, ["MySqlTinyInt", "SingleStoreTinyInt"])) {
15930
+ min = unsigned ? 0 : CONSTANTS.INT8_MIN;
15931
+ max = unsigned ? CONSTANTS.INT8_UNSIGNED_MAX : CONSTANTS.INT8_MAX;
15932
+ integer3 = true;
15933
+ } else if (isColumnType(column2, [
15934
+ "PgSmallInt",
15935
+ "PgSmallSerial",
15936
+ "MySqlSmallInt",
15937
+ "SingleStoreSmallInt"
15938
+ ])) {
15939
+ min = unsigned ? 0 : CONSTANTS.INT16_MIN;
15940
+ max = unsigned ? CONSTANTS.INT16_UNSIGNED_MAX : CONSTANTS.INT16_MAX;
15941
+ integer3 = true;
15942
+ } else if (isColumnType(column2, [
15943
+ "PgReal",
15944
+ "MySqlFloat",
15945
+ "MySqlMediumInt",
15946
+ "SingleStoreMediumInt",
15947
+ "SingleStoreFloat"
15948
+ ])) {
15949
+ min = unsigned ? 0 : CONSTANTS.INT24_MIN;
15950
+ max = unsigned ? CONSTANTS.INT24_UNSIGNED_MAX : CONSTANTS.INT24_MAX;
15951
+ integer3 = isColumnType(column2, ["MySqlMediumInt", "SingleStoreMediumInt"]);
15952
+ } else if (isColumnType(column2, [
15953
+ "PgInteger",
15954
+ "PgSerial",
15955
+ "MySqlInt",
15956
+ "SingleStoreInt"
15957
+ ])) {
15958
+ min = unsigned ? 0 : CONSTANTS.INT32_MIN;
15959
+ max = unsigned ? CONSTANTS.INT32_UNSIGNED_MAX : CONSTANTS.INT32_MAX;
15960
+ integer3 = true;
15961
+ } else if (isColumnType(column2, [
15962
+ "PgDoublePrecision",
15963
+ "MySqlReal",
15964
+ "MySqlDouble",
15965
+ "SingleStoreReal",
15966
+ "SingleStoreDouble",
15967
+ "SQLiteReal"
15968
+ ])) {
15969
+ min = unsigned ? 0 : CONSTANTS.INT48_MIN;
15970
+ max = unsigned ? CONSTANTS.INT48_UNSIGNED_MAX : CONSTANTS.INT48_MAX;
15971
+ } else if (isColumnType(column2, [
15972
+ "PgBigInt53",
15973
+ "PgBigSerial53",
15974
+ "MySqlBigInt53",
15975
+ "MySqlSerial",
15976
+ "SingleStoreBigInt53",
15977
+ "SingleStoreSerial",
15978
+ "SQLiteInteger"
15979
+ ])) {
15980
+ unsigned = unsigned || isColumnType(column2, ["MySqlSerial", "SingleStoreSerial"]);
15981
+ min = unsigned ? 0 : Number.MIN_SAFE_INTEGER;
15982
+ max = Number.MAX_SAFE_INTEGER;
15983
+ integer3 = true;
15984
+ } else if (isColumnType(column2, ["MySqlYear", "SingleStoreYear"])) {
15985
+ min = 1901;
15986
+ max = 2155;
15987
+ integer3 = true;
15988
+ } else {
15989
+ min = Number.MIN_SAFE_INTEGER;
15990
+ max = Number.MAX_SAFE_INTEGER;
15991
+ }
15992
+ let schema = coerce2 === true || coerce2?.number ? z.coerce.number() : z.number();
15993
+ schema = schema.min(min).max(max);
15994
+ return integer3 ? schema.int() : schema;
15995
+ }
15996
+ function bigintColumnToSchema(column2, z, coerce2) {
15997
+ const unsigned = column2.getSQLType().includes("unsigned");
15998
+ const min = unsigned ? 0n : CONSTANTS.INT64_MIN;
15999
+ const max = unsigned ? CONSTANTS.INT64_UNSIGNED_MAX : CONSTANTS.INT64_MAX;
16000
+ const schema = coerce2 === true || coerce2?.bigint ? z.coerce.bigint() : z.bigint();
16001
+ return schema.min(min).max(max);
16002
+ }
16003
+ function stringColumnToSchema(column2, z, coerce2) {
16004
+ if (isColumnType(column2, ["PgUUID"])) {
16005
+ return z.string().uuid();
16006
+ }
16007
+ let max;
16008
+ let regex;
16009
+ let fixed = false;
16010
+ if (isColumnType(column2, ["PgVarchar", "SQLiteText"])) {
16011
+ max = column2.length;
16012
+ } else if (isColumnType(column2, ["MySqlVarChar", "SingleStoreVarChar"])) {
16013
+ max = column2.length ?? CONSTANTS.INT16_UNSIGNED_MAX;
16014
+ } else if (isColumnType(column2, ["MySqlText", "SingleStoreText"])) {
16015
+ if (column2.textType === "longtext") {
16016
+ max = CONSTANTS.INT32_UNSIGNED_MAX;
16017
+ } else if (column2.textType === "mediumtext") {
16018
+ max = CONSTANTS.INT24_UNSIGNED_MAX;
16019
+ } else if (column2.textType === "text") {
16020
+ max = CONSTANTS.INT16_UNSIGNED_MAX;
16021
+ } else {
16022
+ max = CONSTANTS.INT8_UNSIGNED_MAX;
16023
+ }
16024
+ }
16025
+ if (isColumnType(column2, [
16026
+ "PgChar",
16027
+ "MySqlChar",
16028
+ "SingleStoreChar"
16029
+ ])) {
16030
+ max = column2.length;
16031
+ fixed = true;
16032
+ }
16033
+ if (isColumnType(column2, ["PgBinaryVector"])) {
16034
+ regex = /^[01]+$/;
16035
+ max = column2.dimensions;
16036
+ }
16037
+ let schema = coerce2 === true || coerce2?.string ? z.coerce.string() : z.string();
16038
+ schema = regex ? schema.regex(regex) : schema;
16039
+ return max && fixed ? schema.length(max) : max ? schema.max(max) : schema;
16040
+ }
16041
+ function getColumns(tableLike) {
16042
+ return isTable(tableLike) ? getTableColumns(tableLike) : getViewSelectedFields(tableLike);
16043
+ }
16044
+ function handleColumns(columns2, refinements, conditions2, factory) {
16045
+ const columnSchemas = {};
16046
+ for (const [key, selected] of Object.entries(columns2)) {
16047
+ if (!is(selected, Column) && !is(selected, SQL) && !is(selected, SQL.Aliased) && typeof selected === "object") {
16048
+ const columns3 = isTable(selected) || isView(selected) ? getColumns(selected) : selected;
16049
+ columnSchemas[key] = handleColumns(columns3, refinements[key] ?? {}, conditions2, factory);
16050
+ continue;
16051
+ }
16052
+ const refinement = refinements[key];
16053
+ if (refinement !== undefined && typeof refinement !== "function") {
16054
+ columnSchemas[key] = refinement;
16055
+ continue;
16056
+ }
16057
+ const column2 = is(selected, Column) ? selected : undefined;
16058
+ const schema = column2 ? columnToSchema(column2, factory) : exports_external.any();
16059
+ const refined = typeof refinement === "function" ? refinement(schema) : schema;
16060
+ if (conditions2.never(column2)) {
16061
+ continue;
16062
+ } else {
16063
+ columnSchemas[key] = refined;
16064
+ }
16065
+ if (column2) {
16066
+ if (conditions2.nullable(column2)) {
16067
+ columnSchemas[key] = columnSchemas[key].nullable();
16068
+ }
16069
+ if (conditions2.optional(column2)) {
16070
+ columnSchemas[key] = columnSchemas[key].optional();
16071
+ }
16072
+ }
16073
+ }
16074
+ return exports_external.object(columnSchemas);
16075
+ }
16076
+ function handleEnum(enum_, factory) {
16077
+ const zod = factory?.zodInstance ?? exports_external;
16078
+ return zod.enum(enum_.enumValues);
16079
+ }
16080
+ var selectConditions = {
16081
+ never: () => false,
16082
+ optional: () => false,
16083
+ nullable: (column2) => !column2.notNull
16084
+ };
16085
+ var createSelectSchema = (entity2, refine) => {
16086
+ if (isPgEnum2(entity2)) {
16087
+ return handleEnum(entity2);
16088
+ }
16089
+ const columns2 = getColumns(entity2);
16090
+ return handleColumns(columns2, refine ?? {}, selectConditions);
16091
+ };
16092
+
16093
+ // ../api/dist/chunk-HIDAIYV4.js
15830
16094
  init_zod();
15831
16095
  var timestamps = () => ({
15832
16096
  created_at: text("created_at").notNull().default(sql`(CURRENT_TIMESTAMP)`),
@@ -15901,6 +16165,11 @@ var project = sqliteTable("project", {
15901
16165
  scan_branch: text("scan_branch"),
15902
16166
  github_autoclose: integer("github_autoclose", { mode: "boolean" }).notNull().default(false)
15903
16167
  });
16168
+ var project_view_state = sqliteTable("project_view_state", {
16169
+ project_id: text("project_id").primaryKey().references(() => project.id),
16170
+ layout: text("layout", { mode: "json" }).notNull().$type(),
16171
+ updated_at: text("updated_at").notNull().default(sql`(CURRENT_TIMESTAMP)`)
16172
+ });
15904
16173
  var ACTIONS = [
15905
16174
  "CREATE_TASK",
15906
16175
  "UPDATE_TASK",
@@ -16863,6 +17132,21 @@ var upsert_hook = exports_external.object({
16863
17132
  action: hook_action_input
16864
17133
  });
16865
17134
  var toggle_hook_enabled = exports_external.object({ enabled: exports_external.boolean() });
17135
+ var project_graph_task = createSelectSchema(task);
17136
+ var project_graph_link = createSelectSchema(task_link);
17137
+ var project_graph_rollup_counts = exports_external.object({
17138
+ direct_done: exports_external.number().int(),
17139
+ direct_total: exports_external.number().int(),
17140
+ subtree_done: exports_external.number().int(),
17141
+ subtree_total: exports_external.number().int()
17142
+ });
17143
+ var project_graph_response = exports_external.object({
17144
+ tasks: exports_external.array(project_graph_task),
17145
+ links: exports_external.array(project_graph_link),
17146
+ rollups: exports_external.record(exports_external.string(), project_graph_rollup_counts)
17147
+ });
17148
+ var project_view_pin = exports_external.object({ x: exports_external.number(), y: exports_external.number() });
17149
+ var project_view_layout = exports_external.object({ pins: exports_external.record(exports_external.string(), project_view_pin) });
16866
17150
 
16867
17151
  // ../api/dist/chunk-5L3AUVMM.js
16868
17152
  init_dist();
@@ -17526,7 +17810,10 @@ var ApiClient2 = class {
17526
17810
  })),
17527
17811
  deleteProject: (project2) => wrap(() => this.clients.projects.patch("/projects", {
17528
17812
  body: { ...project2, deleted: true }
17529
- }))
17813
+ })),
17814
+ graph: (project_id) => wrap(() => this.clients.projects.get(`/projects/${project_id}/graph`)),
17815
+ getViewState: (project_id) => wrap(() => this.clients.projects.get(`/projects/${project_id}/view-state`)),
17816
+ putViewState: (project_id, layout) => wrap(() => this.clients.projects.put(`/projects/${project_id}/view-state`, { body: layout }))
17530
17817
  };
17531
17818
  this.milestones = {
17532
17819
  list: () => wrap(() => this.clients.milestones.get("/milestones")),
@@ -20169,7 +20456,10 @@ var ApiClient22 = class {
20169
20456
  })),
20170
20457
  deleteProject: (project2) => wrap2(() => this.clients.projects.patch("/projects", {
20171
20458
  body: { ...project2, deleted: true }
20172
- }))
20459
+ })),
20460
+ graph: (project_id) => wrap2(() => this.clients.projects.get(`/projects/${project_id}/graph`)),
20461
+ getViewState: (project_id) => wrap2(() => this.clients.projects.get(`/projects/${project_id}/view-state`)),
20462
+ putViewState: (project_id, layout) => wrap2(() => this.clients.projects.put(`/projects/${project_id}/view-state`, { body: layout }))
20173
20463
  };
20174
20464
  this.milestones = {
20175
20465
  list: () => wrap2(() => this.clients.milestones.get("/milestones")),
@@ -25012,6 +25302,11 @@ var project2 = sqliteTable("project", {
25012
25302
  scan_branch: text("scan_branch"),
25013
25303
  github_autoclose: integer("github_autoclose", { mode: "boolean" }).notNull().default(false)
25014
25304
  });
25305
+ var project_view_state2 = sqliteTable("project_view_state", {
25306
+ project_id: text("project_id").primaryKey().references(() => project2.id),
25307
+ layout: text("layout", { mode: "json" }).notNull().$type(),
25308
+ updated_at: text("updated_at").notNull().default(sql`(CURRENT_TIMESTAMP)`)
25309
+ });
25015
25310
  var ACTIONS2 = [
25016
25311
  "CREATE_TASK",
25017
25312
  "UPDATE_TASK",
@@ -25976,6 +26271,21 @@ var upsert_hook2 = exports_external.object({
25976
26271
  action: hook_action_input2
25977
26272
  });
25978
26273
  var toggle_hook_enabled2 = exports_external.object({ enabled: exports_external.boolean() });
26274
+ var project_graph_task2 = createSelectSchema(task2);
26275
+ var project_graph_link2 = createSelectSchema(task_link2);
26276
+ var project_graph_rollup_counts2 = exports_external.object({
26277
+ direct_done: exports_external.number().int(),
26278
+ direct_total: exports_external.number().int(),
26279
+ subtree_done: exports_external.number().int(),
26280
+ subtree_total: exports_external.number().int()
26281
+ });
26282
+ var project_graph_response2 = exports_external.object({
26283
+ tasks: exports_external.array(project_graph_task2),
26284
+ links: exports_external.array(project_graph_link2),
26285
+ rollups: exports_external.record(exports_external.string(), project_graph_rollup_counts2)
26286
+ });
26287
+ var project_view_pin2 = exports_external.object({ x: exports_external.number(), y: exports_external.number() });
26288
+ var project_view_layout2 = exports_external.object({ pins: exports_external.record(exports_external.string(), project_view_pin2) });
25979
26289
 
25980
26290
  // src/graph-commands.ts
25981
26291
  async function print_json2(data) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devpad/cli",
3
- "version": "2.5.0",
3
+ "version": "2.5.1",
4
4
  "description": "Command line interface for devpad project management",
5
5
  "keywords": [
6
6
  "cli",
@@ -50,11 +50,11 @@
50
50
  "mime": "^3.0.0"
51
51
  },
52
52
  "devDependencies": {
53
- "@devpad/api": "^2.5.0",
54
- "@devpad/core": "^2.5.0",
55
- "@devpad/pipeline-fakes": "^2.5.0",
56
- "@devpad/pipeline-templates": "^2.5.0",
57
- "@devpad/schema": "^2.5.0",
53
+ "@devpad/api": "^2.5.1",
54
+ "@devpad/core": "^2.5.1",
55
+ "@devpad/pipeline-fakes": "^2.5.1",
56
+ "@devpad/pipeline-templates": "^2.5.1",
57
+ "@devpad/schema": "^2.5.1",
58
58
  "@types/node": "^20.11.24",
59
59
  "bun-types": "latest",
60
60
  "chalk": "^5.3.0",