pqb 0.36.5 → 0.36.7

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.d.ts CHANGED
@@ -2634,6 +2634,7 @@ interface ArrayColumnValue {
2634
2634
  }
2635
2635
  interface ArrayData<Item extends ArrayColumnValue> extends ColumnData, ArrayMethodsData {
2636
2636
  item: Item;
2637
+ arrayDims: number;
2637
2638
  }
2638
2639
  declare class ArrayColumn<Schema extends ColumnTypeSchemaArg, Item extends ArrayColumnValue, InputType, OutputType, QueryType> extends ColumnType<Schema, Item['type'][], InputType, OperatorsArray, Item['inputType'][], Item['outputType'][], OutputType, Item['queryType'][], QueryType> {
2639
2640
  dataType: "array";
@@ -5590,7 +5591,9 @@ declare class Union {
5590
5591
  interface UpdateSelf extends PickQueryMetaResultRelationsWithDataReturnTypeShape {
5591
5592
  inputType: RecordUnknown;
5592
5593
  }
5593
- type UpdateData<T extends UpdateSelf> = {
5594
+ type UpdateData<T extends UpdateSelf> = RelationsBase extends T['relations'] ? {
5595
+ [K in keyof T['inputType']]?: UpdateColumn<T, K>;
5596
+ } : {
5594
5597
  [K in keyof T['inputType'] | keyof T['relations']]?: K extends keyof T['inputType'] ? UpdateColumn<T, K> : UpdateRelationData<T, T['relations'][K]['relationConfig']>;
5595
5598
  };
5596
5599
  type UpdateColumn<T extends UpdateSelf, Key extends keyof T['inputType']> = T['inputType'][Key] | QueryOrExpression<T['inputType'][Key]> | ((q: T) => QueryOrExpression<T['inputType'][Key]>);
package/dist/index.js CHANGED
@@ -2933,16 +2933,28 @@ class ArrayColumn extends ColumnType {
2933
2933
  hideFromCode: true
2934
2934
  }
2935
2935
  );
2936
- this.data.item = item;
2936
+ item.data.isNullable = true;
2937
+ this.data.item = item instanceof ArrayColumn ? item.data.item : item;
2937
2938
  this.data.name = item.data.name;
2939
+ this.data.arrayDims = item instanceof ArrayColumn ? item.data.arrayDims + 1 : 1;
2938
2940
  }
2939
2941
  toSQL() {
2940
- return `${this.data.item.toSQL()}[]`;
2942
+ return this.data.item.toSQL() + "[]".repeat(this.data.arrayDims);
2941
2943
  }
2942
2944
  toCode(t, m) {
2943
- const code = ["array("];
2944
- orchidCore.addCode(code, this.data.item.toCode(t));
2945
- orchidCore.addCode(code, `)${orchidCore.arrayDataToCode(this.data, m)}`);
2945
+ let open = "array(";
2946
+ let close = ")";
2947
+ for (let i = 1; i < this.data.arrayDims; i++) {
2948
+ open += `${t}.array(`;
2949
+ close += ")";
2950
+ }
2951
+ const code = [open];
2952
+ const { item } = this.data;
2953
+ const { isNullable } = item.data;
2954
+ delete item.data.isNullable;
2955
+ orchidCore.addCode(code, item.toCode(t));
2956
+ item.data.isNullable = isNullable;
2957
+ orchidCore.addCode(code, `${close}${orchidCore.arrayDataToCode(this.data, m)}`);
2946
2958
  return columnCode(this, t, code, m);
2947
2959
  }
2948
2960
  }