arkormx 2.0.0-next.6 → 2.0.0-next.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/cli.mjs +46 -7
- package/dist/index.cjs +84 -23
- package/dist/index.d.cts +19 -1
- package/dist/index.d.mts +19 -1
- package/dist/index.mjs +84 -24
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -1613,7 +1613,7 @@ const normalizePersistedTableMetadata = (table) => {
|
|
|
1613
1613
|
enums: {}
|
|
1614
1614
|
};
|
|
1615
1615
|
const candidate = table;
|
|
1616
|
-
if (!(Object.prototype.hasOwnProperty.call(candidate, "columns") || Object.prototype.hasOwnProperty.call(candidate, "enums"))) return {
|
|
1616
|
+
if (!(Object.prototype.hasOwnProperty.call(candidate, "columns") || Object.prototype.hasOwnProperty.call(candidate, "enums") || Object.prototype.hasOwnProperty.call(candidate, "primaryKeyGeneration") || Object.prototype.hasOwnProperty.call(candidate, "timestampColumns"))) return {
|
|
1617
1617
|
columns: normalizeLegacyTableColumns(candidate),
|
|
1618
1618
|
enums: {}
|
|
1619
1619
|
};
|
|
@@ -1625,7 +1625,8 @@ const normalizePersistedTableMetadata = (table) => {
|
|
|
1625
1625
|
if (normalizedValues.length > 0) all[columnName] = normalizedValues;
|
|
1626
1626
|
return all;
|
|
1627
1627
|
}, {}),
|
|
1628
|
-
primaryKeyGeneration: normalizePersistedPrimaryKeyGeneration(candidate.primaryKeyGeneration)
|
|
1628
|
+
primaryKeyGeneration: normalizePersistedPrimaryKeyGeneration(candidate.primaryKeyGeneration),
|
|
1629
|
+
timestampColumns: normalizePersistedTimestampColumns(candidate.timestampColumns)
|
|
1629
1630
|
};
|
|
1630
1631
|
};
|
|
1631
1632
|
const normalizePersistedPrimaryKeyGeneration = (value) => {
|
|
@@ -1640,13 +1641,28 @@ const normalizePersistedPrimaryKeyGeneration = (value) => {
|
|
|
1640
1641
|
runtimeFactory: candidate.runtimeFactory === "uuid" ? "uuid" : void 0
|
|
1641
1642
|
};
|
|
1642
1643
|
};
|
|
1644
|
+
const normalizePersistedTimestampColumns = (value) => {
|
|
1645
|
+
if (!Array.isArray(value)) return void 0;
|
|
1646
|
+
const columns = value.reduce((all, entry) => {
|
|
1647
|
+
if (!entry || typeof entry !== "object" || Array.isArray(entry)) return all;
|
|
1648
|
+
const candidate = entry;
|
|
1649
|
+
if (typeof candidate.column !== "string" || candidate.column.trim().length === 0) return all;
|
|
1650
|
+
const normalized = { column: candidate.column };
|
|
1651
|
+
if (candidate.default === "now()") normalized.default = "now()";
|
|
1652
|
+
if (candidate.updatedAt === true) normalized.updatedAt = true;
|
|
1653
|
+
if (!normalized.default && !normalized.updatedAt) return all;
|
|
1654
|
+
all.push(normalized);
|
|
1655
|
+
return all;
|
|
1656
|
+
}, []);
|
|
1657
|
+
return columns.length > 0 ? columns : void 0;
|
|
1658
|
+
};
|
|
1643
1659
|
const normalizePersistedColumnMappingsState = (state) => {
|
|
1644
1660
|
return {
|
|
1645
1661
|
version: 1,
|
|
1646
1662
|
tables: Object.entries(state?.tables ?? {}).reduce((all, [tableName, tableMetadata]) => {
|
|
1647
1663
|
if (tableName.trim().length === 0) return all;
|
|
1648
1664
|
const normalized = normalizePersistedTableMetadata(tableMetadata);
|
|
1649
|
-
if (Object.keys(normalized.columns).length > 0 || Object.keys(normalized.enums).length > 0 || normalized.primaryKeyGeneration) all[tableName] = normalized;
|
|
1665
|
+
if (Object.keys(normalized.columns).length > 0 || Object.keys(normalized.enums).length > 0 || normalized.primaryKeyGeneration || normalized.timestampColumns?.length) all[tableName] = normalized;
|
|
1650
1666
|
return all;
|
|
1651
1667
|
}, {})
|
|
1652
1668
|
};
|
|
@@ -1718,7 +1734,8 @@ const getPersistedTableMetadata = (table, options = {}) => {
|
|
|
1718
1734
|
all[columnName] = [...values];
|
|
1719
1735
|
return all;
|
|
1720
1736
|
}, {}),
|
|
1721
|
-
primaryKeyGeneration: metadata.primaryKeyGeneration ? { ...metadata.primaryKeyGeneration } : void 0
|
|
1737
|
+
primaryKeyGeneration: metadata.primaryKeyGeneration ? { ...metadata.primaryKeyGeneration } : void 0,
|
|
1738
|
+
timestampColumns: metadata.timestampColumns?.map((column) => ({ ...column }))
|
|
1722
1739
|
};
|
|
1723
1740
|
};
|
|
1724
1741
|
const applyMappedColumn = (tableColumns, column, features, table) => {
|
|
@@ -1745,6 +1762,10 @@ const removePersistedColumnMetadata = (tableMetadata, columnName) => {
|
|
|
1745
1762
|
if (mappedColumn === columnName) delete tableMetadata.columns[attribute];
|
|
1746
1763
|
});
|
|
1747
1764
|
if (tableMetadata.primaryKeyGeneration?.column === columnName) delete tableMetadata.primaryKeyGeneration;
|
|
1765
|
+
if (tableMetadata.timestampColumns) {
|
|
1766
|
+
tableMetadata.timestampColumns = tableMetadata.timestampColumns.filter((column) => column.column !== columnName);
|
|
1767
|
+
if (tableMetadata.timestampColumns.length === 0) delete tableMetadata.timestampColumns;
|
|
1768
|
+
}
|
|
1748
1769
|
};
|
|
1749
1770
|
const applyPrimaryKeyGeneration = (tableMetadata, column) => {
|
|
1750
1771
|
if (!column.primary || !column.primaryKeyGeneration) {
|
|
@@ -1756,6 +1777,21 @@ const applyPrimaryKeyGeneration = (tableMetadata, column) => {
|
|
|
1756
1777
|
...column.primaryKeyGeneration
|
|
1757
1778
|
};
|
|
1758
1779
|
};
|
|
1780
|
+
const applyTimestampColumn = (tableMetadata, column) => {
|
|
1781
|
+
if (column.type !== "timestamp" || column.default !== "now()" && column.updatedAt !== true) {
|
|
1782
|
+
if (tableMetadata.timestampColumns) {
|
|
1783
|
+
tableMetadata.timestampColumns = tableMetadata.timestampColumns.filter((entry) => entry.column !== column.name);
|
|
1784
|
+
if (tableMetadata.timestampColumns.length === 0) delete tableMetadata.timestampColumns;
|
|
1785
|
+
}
|
|
1786
|
+
return;
|
|
1787
|
+
}
|
|
1788
|
+
const nextColumn = {
|
|
1789
|
+
column: column.name,
|
|
1790
|
+
...column.default === "now()" ? { default: "now()" } : {},
|
|
1791
|
+
...column.updatedAt ? { updatedAt: true } : {}
|
|
1792
|
+
};
|
|
1793
|
+
tableMetadata.timestampColumns = [...(tableMetadata.timestampColumns ?? []).filter((entry) => entry.column !== column.name), nextColumn];
|
|
1794
|
+
};
|
|
1759
1795
|
const applyOperationsToPersistedColumnMappingsState = (state, operations, features = resolvePersistedMetadataFeatures()) => {
|
|
1760
1796
|
const nextTables = Object.entries(state.tables).reduce((all, [table, metadata]) => {
|
|
1761
1797
|
all[table] = {
|
|
@@ -1764,7 +1800,8 @@ const applyOperationsToPersistedColumnMappingsState = (state, operations, featur
|
|
|
1764
1800
|
nextEnums[columnName] = [...values];
|
|
1765
1801
|
return nextEnums;
|
|
1766
1802
|
}, {}),
|
|
1767
|
-
primaryKeyGeneration: metadata.primaryKeyGeneration ? { ...metadata.primaryKeyGeneration } : void 0
|
|
1803
|
+
primaryKeyGeneration: metadata.primaryKeyGeneration ? { ...metadata.primaryKeyGeneration } : void 0,
|
|
1804
|
+
timestampColumns: metadata.timestampColumns?.map((column) => ({ ...column }))
|
|
1768
1805
|
};
|
|
1769
1806
|
return all;
|
|
1770
1807
|
}, {});
|
|
@@ -1778,8 +1815,9 @@ const applyOperationsToPersistedColumnMappingsState = (state, operations, featur
|
|
|
1778
1815
|
applyMappedColumn(tableMetadata.columns, column, features, operation.table);
|
|
1779
1816
|
applyEnumColumn(tableMetadata.enums, column, features, operation.table);
|
|
1780
1817
|
applyPrimaryKeyGeneration(tableMetadata, column);
|
|
1818
|
+
applyTimestampColumn(tableMetadata, column);
|
|
1781
1819
|
});
|
|
1782
|
-
if (Object.keys(tableMetadata.columns).length > 0 || Object.keys(tableMetadata.enums).length > 0 || tableMetadata.primaryKeyGeneration) nextTables[operation.table] = tableMetadata;
|
|
1820
|
+
if (Object.keys(tableMetadata.columns).length > 0 || Object.keys(tableMetadata.enums).length > 0 || tableMetadata.primaryKeyGeneration || tableMetadata.timestampColumns?.length) nextTables[operation.table] = tableMetadata;
|
|
1783
1821
|
else delete nextTables[operation.table];
|
|
1784
1822
|
return;
|
|
1785
1823
|
}
|
|
@@ -1792,11 +1830,12 @@ const applyOperationsToPersistedColumnMappingsState = (state, operations, featur
|
|
|
1792
1830
|
applyMappedColumn(tableMetadata.columns, column, features, operation.table);
|
|
1793
1831
|
applyEnumColumn(tableMetadata.enums, column, features, operation.table);
|
|
1794
1832
|
applyPrimaryKeyGeneration(tableMetadata, column);
|
|
1833
|
+
applyTimestampColumn(tableMetadata, column);
|
|
1795
1834
|
});
|
|
1796
1835
|
operation.dropColumns.forEach((columnName) => {
|
|
1797
1836
|
removePersistedColumnMetadata(tableMetadata, columnName);
|
|
1798
1837
|
});
|
|
1799
|
-
if (Object.keys(tableMetadata.columns).length > 0 || Object.keys(tableMetadata.enums).length > 0 || tableMetadata.primaryKeyGeneration) nextTables[operation.table] = tableMetadata;
|
|
1838
|
+
if (Object.keys(tableMetadata.columns).length > 0 || Object.keys(tableMetadata.enums).length > 0 || tableMetadata.primaryKeyGeneration || tableMetadata.timestampColumns?.length) nextTables[operation.table] = tableMetadata;
|
|
1800
1839
|
else delete nextTables[operation.table];
|
|
1801
1840
|
return;
|
|
1802
1841
|
}
|
package/dist/index.cjs
CHANGED
|
@@ -2618,7 +2618,7 @@ const normalizePersistedTableMetadata = (table) => {
|
|
|
2618
2618
|
enums: {}
|
|
2619
2619
|
};
|
|
2620
2620
|
const candidate = table;
|
|
2621
|
-
if (!(Object.prototype.hasOwnProperty.call(candidate, "columns") || Object.prototype.hasOwnProperty.call(candidate, "enums"))) return {
|
|
2621
|
+
if (!(Object.prototype.hasOwnProperty.call(candidate, "columns") || Object.prototype.hasOwnProperty.call(candidate, "enums") || Object.prototype.hasOwnProperty.call(candidate, "primaryKeyGeneration") || Object.prototype.hasOwnProperty.call(candidate, "timestampColumns"))) return {
|
|
2622
2622
|
columns: normalizeLegacyTableColumns(candidate),
|
|
2623
2623
|
enums: {}
|
|
2624
2624
|
};
|
|
@@ -2630,7 +2630,8 @@ const normalizePersistedTableMetadata = (table) => {
|
|
|
2630
2630
|
if (normalizedValues.length > 0) all[columnName] = normalizedValues;
|
|
2631
2631
|
return all;
|
|
2632
2632
|
}, {}),
|
|
2633
|
-
primaryKeyGeneration: normalizePersistedPrimaryKeyGeneration(candidate.primaryKeyGeneration)
|
|
2633
|
+
primaryKeyGeneration: normalizePersistedPrimaryKeyGeneration(candidate.primaryKeyGeneration),
|
|
2634
|
+
timestampColumns: normalizePersistedTimestampColumns(candidate.timestampColumns)
|
|
2634
2635
|
};
|
|
2635
2636
|
};
|
|
2636
2637
|
const normalizePersistedPrimaryKeyGeneration = (value) => {
|
|
@@ -2645,13 +2646,28 @@ const normalizePersistedPrimaryKeyGeneration = (value) => {
|
|
|
2645
2646
|
runtimeFactory: candidate.runtimeFactory === "uuid" ? "uuid" : void 0
|
|
2646
2647
|
};
|
|
2647
2648
|
};
|
|
2649
|
+
const normalizePersistedTimestampColumns = (value) => {
|
|
2650
|
+
if (!Array.isArray(value)) return void 0;
|
|
2651
|
+
const columns = value.reduce((all, entry) => {
|
|
2652
|
+
if (!entry || typeof entry !== "object" || Array.isArray(entry)) return all;
|
|
2653
|
+
const candidate = entry;
|
|
2654
|
+
if (typeof candidate.column !== "string" || candidate.column.trim().length === 0) return all;
|
|
2655
|
+
const normalized = { column: candidate.column };
|
|
2656
|
+
if (candidate.default === "now()") normalized.default = "now()";
|
|
2657
|
+
if (candidate.updatedAt === true) normalized.updatedAt = true;
|
|
2658
|
+
if (!normalized.default && !normalized.updatedAt) return all;
|
|
2659
|
+
all.push(normalized);
|
|
2660
|
+
return all;
|
|
2661
|
+
}, []);
|
|
2662
|
+
return columns.length > 0 ? columns : void 0;
|
|
2663
|
+
};
|
|
2648
2664
|
const normalizePersistedColumnMappingsState = (state) => {
|
|
2649
2665
|
return {
|
|
2650
2666
|
version: 1,
|
|
2651
2667
|
tables: Object.entries(state?.tables ?? {}).reduce((all, [tableName, tableMetadata]) => {
|
|
2652
2668
|
if (tableName.trim().length === 0) return all;
|
|
2653
2669
|
const normalized = normalizePersistedTableMetadata(tableMetadata);
|
|
2654
|
-
if (Object.keys(normalized.columns).length > 0 || Object.keys(normalized.enums).length > 0 || normalized.primaryKeyGeneration) all[tableName] = normalized;
|
|
2670
|
+
if (Object.keys(normalized.columns).length > 0 || Object.keys(normalized.enums).length > 0 || normalized.primaryKeyGeneration || normalized.timestampColumns?.length) all[tableName] = normalized;
|
|
2655
2671
|
return all;
|
|
2656
2672
|
}, {})
|
|
2657
2673
|
};
|
|
@@ -2723,7 +2739,8 @@ const getPersistedTableMetadata = (table, options = {}) => {
|
|
|
2723
2739
|
all[columnName] = [...values];
|
|
2724
2740
|
return all;
|
|
2725
2741
|
}, {}),
|
|
2726
|
-
primaryKeyGeneration: metadata.primaryKeyGeneration ? { ...metadata.primaryKeyGeneration } : void 0
|
|
2742
|
+
primaryKeyGeneration: metadata.primaryKeyGeneration ? { ...metadata.primaryKeyGeneration } : void 0,
|
|
2743
|
+
timestampColumns: metadata.timestampColumns?.map((column) => ({ ...column }))
|
|
2727
2744
|
};
|
|
2728
2745
|
};
|
|
2729
2746
|
const getPersistedColumnMap = (table, options = {}) => {
|
|
@@ -2735,6 +2752,9 @@ const getPersistedEnumMap = (table, options = {}) => {
|
|
|
2735
2752
|
const getPersistedPrimaryKeyGeneration = (table, options = {}) => {
|
|
2736
2753
|
return getPersistedTableMetadata(table, options).primaryKeyGeneration;
|
|
2737
2754
|
};
|
|
2755
|
+
const getPersistedTimestampColumns = (table, options = {}) => {
|
|
2756
|
+
return getPersistedTableMetadata(table, options).timestampColumns ?? [];
|
|
2757
|
+
};
|
|
2738
2758
|
const applyMappedColumn = (tableColumns, column, features, table) => {
|
|
2739
2759
|
if (typeof column.map === "string" && column.map.trim().length > 0 && column.map !== column.name) {
|
|
2740
2760
|
if (!features.persistedColumnMappings) throw buildPersistedFeatureDisabledError("persistedColumnMappings", table);
|
|
@@ -2759,6 +2779,10 @@ const removePersistedColumnMetadata = (tableMetadata, columnName) => {
|
|
|
2759
2779
|
if (mappedColumn === columnName) delete tableMetadata.columns[attribute];
|
|
2760
2780
|
});
|
|
2761
2781
|
if (tableMetadata.primaryKeyGeneration?.column === columnName) delete tableMetadata.primaryKeyGeneration;
|
|
2782
|
+
if (tableMetadata.timestampColumns) {
|
|
2783
|
+
tableMetadata.timestampColumns = tableMetadata.timestampColumns.filter((column) => column.column !== columnName);
|
|
2784
|
+
if (tableMetadata.timestampColumns.length === 0) delete tableMetadata.timestampColumns;
|
|
2785
|
+
}
|
|
2762
2786
|
};
|
|
2763
2787
|
const applyPrimaryKeyGeneration = (tableMetadata, column) => {
|
|
2764
2788
|
if (!column.primary || !column.primaryKeyGeneration) {
|
|
@@ -2770,6 +2794,21 @@ const applyPrimaryKeyGeneration = (tableMetadata, column) => {
|
|
|
2770
2794
|
...column.primaryKeyGeneration
|
|
2771
2795
|
};
|
|
2772
2796
|
};
|
|
2797
|
+
const applyTimestampColumn = (tableMetadata, column) => {
|
|
2798
|
+
if (column.type !== "timestamp" || column.default !== "now()" && column.updatedAt !== true) {
|
|
2799
|
+
if (tableMetadata.timestampColumns) {
|
|
2800
|
+
tableMetadata.timestampColumns = tableMetadata.timestampColumns.filter((entry) => entry.column !== column.name);
|
|
2801
|
+
if (tableMetadata.timestampColumns.length === 0) delete tableMetadata.timestampColumns;
|
|
2802
|
+
}
|
|
2803
|
+
return;
|
|
2804
|
+
}
|
|
2805
|
+
const nextColumn = {
|
|
2806
|
+
column: column.name,
|
|
2807
|
+
...column.default === "now()" ? { default: "now()" } : {},
|
|
2808
|
+
...column.updatedAt ? { updatedAt: true } : {}
|
|
2809
|
+
};
|
|
2810
|
+
tableMetadata.timestampColumns = [...(tableMetadata.timestampColumns ?? []).filter((entry) => entry.column !== column.name), nextColumn];
|
|
2811
|
+
};
|
|
2773
2812
|
const applyOperationsToPersistedColumnMappingsState = (state, operations, features = resolvePersistedMetadataFeatures()) => {
|
|
2774
2813
|
const nextTables = Object.entries(state.tables).reduce((all, [table, metadata]) => {
|
|
2775
2814
|
all[table] = {
|
|
@@ -2778,7 +2817,8 @@ const applyOperationsToPersistedColumnMappingsState = (state, operations, featur
|
|
|
2778
2817
|
nextEnums[columnName] = [...values];
|
|
2779
2818
|
return nextEnums;
|
|
2780
2819
|
}, {}),
|
|
2781
|
-
primaryKeyGeneration: metadata.primaryKeyGeneration ? { ...metadata.primaryKeyGeneration } : void 0
|
|
2820
|
+
primaryKeyGeneration: metadata.primaryKeyGeneration ? { ...metadata.primaryKeyGeneration } : void 0,
|
|
2821
|
+
timestampColumns: metadata.timestampColumns?.map((column) => ({ ...column }))
|
|
2782
2822
|
};
|
|
2783
2823
|
return all;
|
|
2784
2824
|
}, {});
|
|
@@ -2792,8 +2832,9 @@ const applyOperationsToPersistedColumnMappingsState = (state, operations, featur
|
|
|
2792
2832
|
applyMappedColumn(tableMetadata.columns, column, features, operation.table);
|
|
2793
2833
|
applyEnumColumn(tableMetadata.enums, column, features, operation.table);
|
|
2794
2834
|
applyPrimaryKeyGeneration(tableMetadata, column);
|
|
2835
|
+
applyTimestampColumn(tableMetadata, column);
|
|
2795
2836
|
});
|
|
2796
|
-
if (Object.keys(tableMetadata.columns).length > 0 || Object.keys(tableMetadata.enums).length > 0 || tableMetadata.primaryKeyGeneration) nextTables[operation.table] = tableMetadata;
|
|
2837
|
+
if (Object.keys(tableMetadata.columns).length > 0 || Object.keys(tableMetadata.enums).length > 0 || tableMetadata.primaryKeyGeneration || tableMetadata.timestampColumns?.length) nextTables[operation.table] = tableMetadata;
|
|
2797
2838
|
else delete nextTables[operation.table];
|
|
2798
2839
|
return;
|
|
2799
2840
|
}
|
|
@@ -2806,11 +2847,12 @@ const applyOperationsToPersistedColumnMappingsState = (state, operations, featur
|
|
|
2806
2847
|
applyMappedColumn(tableMetadata.columns, column, features, operation.table);
|
|
2807
2848
|
applyEnumColumn(tableMetadata.enums, column, features, operation.table);
|
|
2808
2849
|
applyPrimaryKeyGeneration(tableMetadata, column);
|
|
2850
|
+
applyTimestampColumn(tableMetadata, column);
|
|
2809
2851
|
});
|
|
2810
2852
|
operation.dropColumns.forEach((columnName) => {
|
|
2811
2853
|
removePersistedColumnMetadata(tableMetadata, columnName);
|
|
2812
2854
|
});
|
|
2813
|
-
if (Object.keys(tableMetadata.columns).length > 0 || Object.keys(tableMetadata.enums).length > 0 || tableMetadata.primaryKeyGeneration) nextTables[operation.table] = tableMetadata;
|
|
2855
|
+
if (Object.keys(tableMetadata.columns).length > 0 || Object.keys(tableMetadata.enums).length > 0 || tableMetadata.primaryKeyGeneration || tableMetadata.timestampColumns?.length) nextTables[operation.table] = tableMetadata;
|
|
2814
2856
|
else delete nextTables[operation.table];
|
|
2815
2857
|
return;
|
|
2816
2858
|
}
|
|
@@ -7719,8 +7761,7 @@ var QueryBuilder = class QueryBuilder {
|
|
|
7719
7761
|
* @returns
|
|
7720
7762
|
*/
|
|
7721
7763
|
async create(data) {
|
|
7722
|
-
const
|
|
7723
|
-
const created = await this.executeInsertRow(payload);
|
|
7764
|
+
const created = await this.executeInsertRow(data);
|
|
7724
7765
|
return this.model.hydrate(created);
|
|
7725
7766
|
}
|
|
7726
7767
|
/**
|
|
@@ -7731,8 +7772,7 @@ var QueryBuilder = class QueryBuilder {
|
|
|
7731
7772
|
*/
|
|
7732
7773
|
async createMany(values) {
|
|
7733
7774
|
if (values.length === 0) return [];
|
|
7734
|
-
|
|
7735
|
-
return await Promise.all(payloads.map(async (value) => await this.create(value)));
|
|
7775
|
+
return await Promise.all(values.map(async (value) => await this.create(value)));
|
|
7736
7776
|
}
|
|
7737
7777
|
/**
|
|
7738
7778
|
* Insert one or more records.
|
|
@@ -8000,14 +8040,26 @@ var QueryBuilder = class QueryBuilder {
|
|
|
8000
8040
|
const metadata = this.model.getModelMetadata();
|
|
8001
8041
|
return payloads.map((payload) => {
|
|
8002
8042
|
const nextPayload = { ...payload };
|
|
8043
|
+
const now = /* @__PURE__ */ new Date();
|
|
8003
8044
|
const primaryKeyValue = nextPayload[metadata.primaryKey];
|
|
8004
|
-
if (primaryKeyValue
|
|
8005
|
-
|
|
8006
|
-
|
|
8007
|
-
|
|
8045
|
+
if (primaryKeyValue === void 0 || primaryKeyValue === null) {
|
|
8046
|
+
const generated = PrimaryKeyGenerationPlanner.generate(metadata.primaryKeyGeneration);
|
|
8047
|
+
if (generated !== void 0) nextPayload[metadata.primaryKey] = generated;
|
|
8048
|
+
}
|
|
8049
|
+
for (const column of metadata.timestampColumns ?? []) {
|
|
8050
|
+
if (nextPayload[column.column] !== void 0 && nextPayload[column.column] !== null) continue;
|
|
8051
|
+
if (column.default === "now()" || column.updatedAt) nextPayload[column.column] = now;
|
|
8052
|
+
}
|
|
8008
8053
|
return nextPayload;
|
|
8009
8054
|
});
|
|
8010
8055
|
}
|
|
8056
|
+
normalizeUpdatePayload(values) {
|
|
8057
|
+
const metadata = this.model.getModelMetadata();
|
|
8058
|
+
const nextPayload = { ...values };
|
|
8059
|
+
const now = /* @__PURE__ */ new Date();
|
|
8060
|
+
for (const column of metadata.timestampColumns ?? []) if (column.updatedAt) nextPayload[column.column] = now;
|
|
8061
|
+
return nextPayload;
|
|
8062
|
+
}
|
|
8011
8063
|
resolveAffectedCount(result, fallback) {
|
|
8012
8064
|
if (typeof result === "number") return result;
|
|
8013
8065
|
if (result && typeof result === "object" && "count" in result) {
|
|
@@ -8250,6 +8302,7 @@ var QueryBuilder = class QueryBuilder {
|
|
|
8250
8302
|
table: metadata.table,
|
|
8251
8303
|
primaryKey: metadata.primaryKey,
|
|
8252
8304
|
primaryKeyGeneration: metadata.primaryKeyGeneration,
|
|
8305
|
+
timestampColumns: metadata.timestampColumns,
|
|
8253
8306
|
columns: metadata.columns,
|
|
8254
8307
|
softDelete: metadata.softDelete
|
|
8255
8308
|
};
|
|
@@ -8614,13 +8667,15 @@ var QueryBuilder = class QueryBuilder {
|
|
|
8614
8667
|
}) != null;
|
|
8615
8668
|
}
|
|
8616
8669
|
async executeInsertRow(values) {
|
|
8617
|
-
|
|
8670
|
+
const [payload] = this.normalizeInsertPayloads(values);
|
|
8671
|
+
return await this.requireAdapter().insert(this.tryBuildInsertSpec(payload));
|
|
8618
8672
|
}
|
|
8619
8673
|
async executeInsertManyRows(values, ignoreDuplicates = false) {
|
|
8620
8674
|
const adapter = this.requireAdapter();
|
|
8621
|
-
|
|
8675
|
+
const payloads = this.normalizeInsertPayloads(values);
|
|
8676
|
+
if (typeof adapter.insertMany === "function") return await adapter.insertMany(ignoreDuplicates ? this.tryBuildInsertOrIgnoreManySpec(payloads) : this.tryBuildInsertManySpec(payloads));
|
|
8622
8677
|
let inserted = 0;
|
|
8623
|
-
for (const value of
|
|
8678
|
+
for (const value of payloads) try {
|
|
8624
8679
|
await adapter.insert(this.tryBuildInsertSpec(value));
|
|
8625
8680
|
inserted += 1;
|
|
8626
8681
|
} catch (error) {
|
|
@@ -8630,15 +8685,18 @@ var QueryBuilder = class QueryBuilder {
|
|
|
8630
8685
|
}
|
|
8631
8686
|
async executeUpsertRows(values, uniqueBy, updateColumns) {
|
|
8632
8687
|
const adapter = this.requireAdapter();
|
|
8688
|
+
const payloads = this.normalizeInsertPayloads(values);
|
|
8689
|
+
const timestampUpdateColumns = (this.model.getModelMetadata().timestampColumns ?? []).filter((column) => column.updatedAt).map((column) => column.column);
|
|
8690
|
+
const normalizedUpdateColumns = updateColumns ? Array.from(new Set([...updateColumns, ...timestampUpdateColumns])) : updateColumns;
|
|
8633
8691
|
if (typeof adapter.upsert !== "function") throw new UnsupportedAdapterFeatureException("Upsert is not supported by the current adapter.", {
|
|
8634
8692
|
operation: "query.upsert",
|
|
8635
8693
|
model: this.model.name
|
|
8636
8694
|
});
|
|
8637
|
-
return await adapter.upsert(this.tryBuildUpsertSpec(
|
|
8695
|
+
return await adapter.upsert(this.tryBuildUpsertSpec(payloads, uniqueBy, normalizedUpdateColumns));
|
|
8638
8696
|
}
|
|
8639
8697
|
async executeUpdateRow(where, values) {
|
|
8640
8698
|
const adapter = this.requireAdapter();
|
|
8641
|
-
const spec = this.tryBuildUpdateSpec(where, values);
|
|
8699
|
+
const spec = this.tryBuildUpdateSpec(where, this.normalizeUpdatePayload(values));
|
|
8642
8700
|
if (!spec) throw new UnsupportedAdapterFeatureException("Update could not be compiled into an Arkorm update specification.", {
|
|
8643
8701
|
operation: "query.update",
|
|
8644
8702
|
model: this.model.name
|
|
@@ -8649,7 +8707,8 @@ var QueryBuilder = class QueryBuilder {
|
|
|
8649
8707
|
}
|
|
8650
8708
|
async executeUpdateManyRows(where, values) {
|
|
8651
8709
|
const adapter = this.requireAdapter();
|
|
8652
|
-
const
|
|
8710
|
+
const normalizedValues = this.normalizeUpdatePayload(values);
|
|
8711
|
+
const spec = this.tryBuildUpdateManySpec(where, normalizedValues);
|
|
8653
8712
|
if (!spec) throw new UnsupportedAdapterFeatureException("Update-many could not be compiled into an Arkorm update specification.", {
|
|
8654
8713
|
operation: "query.updateMany",
|
|
8655
8714
|
model: this.model.name
|
|
@@ -8666,7 +8725,7 @@ var QueryBuilder = class QueryBuilder {
|
|
|
8666
8725
|
if (await adapter.update({
|
|
8667
8726
|
target: spec.target,
|
|
8668
8727
|
where: rowWhere,
|
|
8669
|
-
values:
|
|
8728
|
+
values: normalizedValues
|
|
8670
8729
|
})) updated += 1;
|
|
8671
8730
|
}
|
|
8672
8731
|
return updated;
|
|
@@ -9092,7 +9151,8 @@ var Model = class Model {
|
|
|
9092
9151
|
prismaDefault: persistedMetadata.primaryKeyGeneration.prismaDefault,
|
|
9093
9152
|
databaseDefault: persistedMetadata.primaryKeyGeneration.databaseDefault,
|
|
9094
9153
|
runtimeFactory: persistedMetadata.primaryKeyGeneration.runtimeFactory
|
|
9095
|
-
} : void 0
|
|
9154
|
+
} : void 0,
|
|
9155
|
+
timestampColumns: persistedMetadata.timestampColumns?.map((column) => ({ ...column }))
|
|
9096
9156
|
};
|
|
9097
9157
|
}
|
|
9098
9158
|
static getRelationMetadata(name) {
|
|
@@ -10195,6 +10255,7 @@ exports.getPersistedEnumMap = getPersistedEnumMap;
|
|
|
10195
10255
|
exports.getPersistedEnumTsType = getPersistedEnumTsType;
|
|
10196
10256
|
exports.getPersistedPrimaryKeyGeneration = getPersistedPrimaryKeyGeneration;
|
|
10197
10257
|
exports.getPersistedTableMetadata = getPersistedTableMetadata;
|
|
10258
|
+
exports.getPersistedTimestampColumns = getPersistedTimestampColumns;
|
|
10198
10259
|
exports.getRuntimeAdapter = getRuntimeAdapter;
|
|
10199
10260
|
exports.getRuntimePaginationCurrentPageResolver = getRuntimePaginationCurrentPageResolver;
|
|
10200
10261
|
exports.getRuntimePaginationURLDriverFactory = getRuntimePaginationURLDriverFactory;
|
package/dist/index.d.cts
CHANGED
|
@@ -11,6 +11,11 @@ interface PrimaryKeyGeneration {
|
|
|
11
11
|
databaseDefault?: string;
|
|
12
12
|
runtimeFactory?: 'uuid';
|
|
13
13
|
}
|
|
14
|
+
interface TimestampColumnBehavior {
|
|
15
|
+
column: string;
|
|
16
|
+
default?: 'now()';
|
|
17
|
+
updatedAt?: boolean;
|
|
18
|
+
}
|
|
14
19
|
interface SchemaColumn {
|
|
15
20
|
name: string;
|
|
16
21
|
type: SchemaColumnType;
|
|
@@ -333,6 +338,7 @@ interface ModelMetadata {
|
|
|
333
338
|
columns: ColumnMap;
|
|
334
339
|
softDelete: SoftDeleteConfig;
|
|
335
340
|
primaryKeyGeneration?: PrimaryKeyGeneration;
|
|
341
|
+
timestampColumns?: TimestampColumnBehavior[];
|
|
336
342
|
}
|
|
337
343
|
type RelationMetadataType = 'hasOne' | 'hasMany' | 'belongsTo' | 'belongsToMany' | 'hasOneThrough' | 'hasManyThrough' | 'morphOne' | 'morphMany' | 'morphToMany';
|
|
338
344
|
interface BaseRelationMetadata {
|
|
@@ -2415,6 +2421,7 @@ declare class QueryBuilder<TModel, TDelegate extends PrismaDelegateLike = Prisma
|
|
|
2415
2421
|
*/
|
|
2416
2422
|
doesntExist(): Promise<boolean>;
|
|
2417
2423
|
private normalizeInsertPayloads;
|
|
2424
|
+
private normalizeUpdatePayload;
|
|
2418
2425
|
private resolveAffectedCount;
|
|
2419
2426
|
private resolveInsertUsingRows;
|
|
2420
2427
|
private resolveInsertUsingSource;
|
|
@@ -2637,6 +2644,7 @@ interface QueryTarget<TModel = unknown> {
|
|
|
2637
2644
|
table?: string;
|
|
2638
2645
|
primaryKey?: string;
|
|
2639
2646
|
primaryKeyGeneration?: PrimaryKeyGeneration;
|
|
2647
|
+
timestampColumns?: TimestampColumnBehavior[];
|
|
2640
2648
|
columns?: Record<string, string>;
|
|
2641
2649
|
softDelete?: SoftDeleteConfig;
|
|
2642
2650
|
alias?: string;
|
|
@@ -4185,10 +4193,14 @@ interface PersistedTableMetadata {
|
|
|
4185
4193
|
columns: Record<string, string>;
|
|
4186
4194
|
enums: Record<string, string[]>;
|
|
4187
4195
|
primaryKeyGeneration?: PersistedPrimaryKeyGeneration;
|
|
4196
|
+
timestampColumns?: PersistedTimestampColumn[];
|
|
4188
4197
|
}
|
|
4189
4198
|
interface PersistedPrimaryKeyGeneration extends PrimaryKeyGeneration {
|
|
4190
4199
|
column: string;
|
|
4191
4200
|
}
|
|
4201
|
+
interface PersistedTimestampColumn extends TimestampColumnBehavior {
|
|
4202
|
+
column: string;
|
|
4203
|
+
}
|
|
4192
4204
|
interface PersistedColumnMappingsState {
|
|
4193
4205
|
version: 1;
|
|
4194
4206
|
tables: Record<string, PersistedTableMetadata>;
|
|
@@ -4224,6 +4236,12 @@ declare const getPersistedPrimaryKeyGeneration: (table: string, options?: {
|
|
|
4224
4236
|
features?: PersistedMetadataFeatures;
|
|
4225
4237
|
strict?: boolean;
|
|
4226
4238
|
}) => PersistedPrimaryKeyGeneration | undefined;
|
|
4239
|
+
declare const getPersistedTimestampColumns: (table: string, options?: {
|
|
4240
|
+
cwd?: string;
|
|
4241
|
+
configuredPath?: string;
|
|
4242
|
+
features?: PersistedMetadataFeatures;
|
|
4243
|
+
strict?: boolean;
|
|
4244
|
+
}) => PersistedTimestampColumn[];
|
|
4227
4245
|
declare const applyOperationsToPersistedColumnMappingsState: (state: PersistedColumnMappingsState, operations: SchemaOperation[], features?: PersistedMetadataFeatures) => PersistedColumnMappingsState;
|
|
4228
4246
|
declare const rebuildPersistedColumnMappingsState: (state: AppliedMigrationsState, availableMigrations: [MigrationClass, string][], features?: PersistedMetadataFeatures) => Promise<PersistedColumnMappingsState>;
|
|
4229
4247
|
declare const syncPersistedColumnMappingsFromState: (cwd: string, state: AppliedMigrationsState, availableMigrations: [MigrationClass, string][], features?: PersistedMetadataFeatures) => Promise<void>;
|
|
@@ -4681,4 +4699,4 @@ declare class URLDriver {
|
|
|
4681
4699
|
url(page: number): string;
|
|
4682
4700
|
}
|
|
4683
4701
|
//#endregion
|
|
4684
|
-
export { AdapterBindableModel, AdapterCapabilities, AdapterCapability, AdapterModelFieldStructure, AdapterModelIntrospectionOptions, AdapterModelStructure, AdapterTransactionContext, AggregateOperation, AggregateSelection, AggregateSpec, AppliedMigrationEntry, AppliedMigrationRun, AppliedMigrationsState, ArkormBootContext, ArkormCollection, ArkormConfig, ArkormErrorContext, ArkormException, Attribute, AttributeCreateInput, AttributeOptions, AttributeOrderBy, AttributeSchemaDelegate, AttributeSelect, AttributeUpdateInput, AttributeWhereInput, BelongsToManyRelationMetadata, BelongsToRelationMetadata, CastDefinition, CastHandler, CastMap, CastType, CliApp, ClientResolver, ColumnMap, DatabaseAdapter, DatabasePrimitive, DatabaseRow, DatabaseRows, DatabaseValue, DelegateCreateData, DelegateFindManyArgs, DelegateForModelSchema, DelegateInclude, DelegateOrderBy, DelegateRow, DelegateRows, DelegateSelect, DelegateUniqueWhere, DelegateUpdateArgs, DelegateUpdateData, DelegateWhere, DeleteManySpec, DeleteSpec, EagerLoadConstraint, EagerLoadMap, EnumBuilder, FactoryAttributes, FactoryDefinition, FactoryModelConstructor, FactoryState, ForeignKeyBuilder, GenerateMigrationOptions, GeneratedMigrationFile, GetUserConfig, GlobalScope, HasManyRelationMetadata, HasManyThroughRelationMetadata, HasOneRelationMetadata, HasOneThroughRelationMetadata, InitCommand, InlineFactory, InsertManySpec, InsertSpec, KyselyDatabaseAdapter, LengthAwarePaginator, MIGRATION_BRAND, MakeFactoryCommand, MakeMigrationCommand, MakeModelCommand, MakeSeederCommand, MigrateCommand, MigrateFreshCommand, MigrateRollbackCommand, Migration, MigrationClass, MigrationHistoryCommand, MigrationInstanceLike, MissingDelegateException, Model, ModelAttributes, ModelAttributesOf, ModelCreateData, ModelEventDispatcher, ModelEventHandler, ModelEventHandlerConstructor, ModelEventListener, ModelEventName, ModelFactory, ModelLifecycleState, ModelMetadata, ModelNotFoundException, ModelStatic, ModelUpdateData, ModelsSyncCommand, MorphManyRelationMetadata, MorphOneRelationMetadata, MorphToManyRelationMetadata, PRISMA_ENUM_MEMBER_REGEX, PRISMA_ENUM_REGEX, PRISMA_MODEL_REGEX, PaginationCurrentPageResolver, PaginationMeta, PaginationOptions, PaginationURLDriver, PaginationURLDriverFactory, Paginator, PersistedColumnMappingsState, PersistedMetadataFeatures, PersistedPrimaryKeyGeneration, PersistedTableMetadata, PrimaryKeyGeneration, PrimaryKeyGenerationPlanner, PrismaClientLike, PrismaDatabaseAdapter, PrismaDelegateLike, PrismaDelegateMap, PrismaDelegateNameMapping, PrismaFindManyArgsLike, PrismaLikeInclude, PrismaLikeOrderBy, PrismaLikeScalarFilter, PrismaLikeSelect, PrismaLikeSortOrder, PrismaLikeWhereInput, PrismaMigrationWorkflowOptions, PrismaSchemaSyncOptions, PrismaTransactionCallback, PrismaTransactionCapableClient, PrismaTransactionOptions, QueryBuilder, QueryComparisonCondition, QueryComparisonOperator, QueryCondition, QueryConstraintException, QueryGroupCondition, QueryLogicalOperator, QueryNotCondition, QueryOrderBy, QueryRawCondition, QuerySelectColumn, QueryTarget, RelatedModelClass, RelationAggregateSpec, RelationColumnLookupSpec, RelationConstraint, RelationDefaultResolver, RelationDefaultValue, RelationFilterSpec, RelationLoadPlan, RelationLoadSpec, RelationMetadata, RelationMetadataProvider, RelationMetadataType, RelationResolutionException, RelationTableLookupSpec, RelationshipModelStatic, RuntimeModuleLoader, SEEDER_BRAND, SchemaBuilder, SchemaColumn, SchemaColumnType, SchemaForeignKey, SchemaForeignKeyAction, SchemaIndex, SchemaOperation, SchemaTableAlterOperation, SchemaTableCreateOperation, SchemaTableDropOperation, ScopeNotDefinedException, SeedCommand, Seeder, SeederCallArgument, SeederConstructor, SeederInput, SelectSpec, Serializable, SimplePaginationMeta, SoftDeleteConfig, SoftDeleteQueryMode, SortDirection, TableBuilder, URLDriver, UniqueConstraintResolutionException, UnsupportedAdapterFeatureException, UpdateManySpec, UpdateSpec, UpsertSpec, applyAlterTableOperation, applyCreateTableOperation, applyDropTableOperation, applyMigrationRollbackToDatabase, applyMigrationRollbackToPrismaSchema, applyMigrationToDatabase, applyMigrationToPrismaSchema, applyOperationsToPersistedColumnMappingsState, applyOperationsToPrismaSchema, bindAdapterToModels, buildEnumBlock, buildFieldLine, buildIndexLine, buildInverseRelationLine, buildMigrationIdentity, buildMigrationRunId, buildMigrationSource, buildModelBlock, buildRelationLine, computeMigrationChecksum, configureArkormRuntime, createEmptyAppliedMigrationsState, createEmptyPersistedColumnMappingsState, createKyselyAdapter, createMigrationTimestamp, createPrismaAdapter, createPrismaCompatibilityAdapter, createPrismaDatabaseAdapter, createPrismaDelegateMap, defineConfig, defineFactory, deleteAppliedMigrationsStateFromStore, deletePersistedColumnMappingsState, deriveCollectionFieldName, deriveInverseRelationAlias, deriveRelationAlias, deriveRelationFieldName, deriveSingularFieldName, ensureArkormConfigLoading, escapeRegex, findAppliedMigration, findEnumBlock, findModelBlock, formatDefaultValue, formatEnumDefaultValue, formatRelationAction, generateMigrationFile, getActiveTransactionClient, getDefaultStubsPath, getLastMigrationRun, getLatestAppliedMigrations, getMigrationPlan, getPersistedColumnMap, getPersistedEnumMap, getPersistedEnumTsType, getPersistedPrimaryKeyGeneration, getPersistedTableMetadata, getRuntimeAdapter, getRuntimePaginationCurrentPageResolver, getRuntimePaginationURLDriverFactory, getRuntimePrismaClient, getUserConfig, inferDelegateName, isDelegateLike, isMigrationApplied, isTransactionCapableClient, loadArkormConfig, markMigrationApplied, markMigrationRun, pad, readAppliedMigrationsState, readAppliedMigrationsStateFromStore, readPersistedColumnMappingsState, rebuildPersistedColumnMappingsState, removeAppliedMigration, resetArkormRuntimeForTests, resetPersistedColumnMappingsCache, resolveCast, resolveColumnMappingsFilePath, resolveEnumName, resolveMigrationClassName, resolveMigrationStateFilePath, resolvePersistedMetadataFeatures, resolvePrismaType, runArkormTransaction, runMigrationWithPrisma, runPrismaCommand, stripPrismaSchemaModelsAndEnums, supportsDatabaseMigrationExecution, supportsDatabaseMigrationState, supportsDatabaseReset, syncPersistedColumnMappingsFromState, toMigrationFileSlug, toModelName, validatePersistedMetadataFeaturesForMigrations, writeAppliedMigrationsState, writeAppliedMigrationsStateToStore, writePersistedColumnMappingsState };
|
|
4702
|
+
export { AdapterBindableModel, AdapterCapabilities, AdapterCapability, AdapterModelFieldStructure, AdapterModelIntrospectionOptions, AdapterModelStructure, AdapterTransactionContext, AggregateOperation, AggregateSelection, AggregateSpec, AppliedMigrationEntry, AppliedMigrationRun, AppliedMigrationsState, ArkormBootContext, ArkormCollection, ArkormConfig, ArkormErrorContext, ArkormException, Attribute, AttributeCreateInput, AttributeOptions, AttributeOrderBy, AttributeSchemaDelegate, AttributeSelect, AttributeUpdateInput, AttributeWhereInput, BelongsToManyRelationMetadata, BelongsToRelationMetadata, CastDefinition, CastHandler, CastMap, CastType, CliApp, ClientResolver, ColumnMap, DatabaseAdapter, DatabasePrimitive, DatabaseRow, DatabaseRows, DatabaseValue, DelegateCreateData, DelegateFindManyArgs, DelegateForModelSchema, DelegateInclude, DelegateOrderBy, DelegateRow, DelegateRows, DelegateSelect, DelegateUniqueWhere, DelegateUpdateArgs, DelegateUpdateData, DelegateWhere, DeleteManySpec, DeleteSpec, EagerLoadConstraint, EagerLoadMap, EnumBuilder, FactoryAttributes, FactoryDefinition, FactoryModelConstructor, FactoryState, ForeignKeyBuilder, GenerateMigrationOptions, GeneratedMigrationFile, GetUserConfig, GlobalScope, HasManyRelationMetadata, HasManyThroughRelationMetadata, HasOneRelationMetadata, HasOneThroughRelationMetadata, InitCommand, InlineFactory, InsertManySpec, InsertSpec, KyselyDatabaseAdapter, LengthAwarePaginator, MIGRATION_BRAND, MakeFactoryCommand, MakeMigrationCommand, MakeModelCommand, MakeSeederCommand, MigrateCommand, MigrateFreshCommand, MigrateRollbackCommand, Migration, MigrationClass, MigrationHistoryCommand, MigrationInstanceLike, MissingDelegateException, Model, ModelAttributes, ModelAttributesOf, ModelCreateData, ModelEventDispatcher, ModelEventHandler, ModelEventHandlerConstructor, ModelEventListener, ModelEventName, ModelFactory, ModelLifecycleState, ModelMetadata, ModelNotFoundException, ModelStatic, ModelUpdateData, ModelsSyncCommand, MorphManyRelationMetadata, MorphOneRelationMetadata, MorphToManyRelationMetadata, PRISMA_ENUM_MEMBER_REGEX, PRISMA_ENUM_REGEX, PRISMA_MODEL_REGEX, PaginationCurrentPageResolver, PaginationMeta, PaginationOptions, PaginationURLDriver, PaginationURLDriverFactory, Paginator, PersistedColumnMappingsState, PersistedMetadataFeatures, PersistedPrimaryKeyGeneration, PersistedTableMetadata, PersistedTimestampColumn, PrimaryKeyGeneration, PrimaryKeyGenerationPlanner, PrismaClientLike, PrismaDatabaseAdapter, PrismaDelegateLike, PrismaDelegateMap, PrismaDelegateNameMapping, PrismaFindManyArgsLike, PrismaLikeInclude, PrismaLikeOrderBy, PrismaLikeScalarFilter, PrismaLikeSelect, PrismaLikeSortOrder, PrismaLikeWhereInput, PrismaMigrationWorkflowOptions, PrismaSchemaSyncOptions, PrismaTransactionCallback, PrismaTransactionCapableClient, PrismaTransactionOptions, QueryBuilder, QueryComparisonCondition, QueryComparisonOperator, QueryCondition, QueryConstraintException, QueryGroupCondition, QueryLogicalOperator, QueryNotCondition, QueryOrderBy, QueryRawCondition, QuerySelectColumn, QueryTarget, RelatedModelClass, RelationAggregateSpec, RelationColumnLookupSpec, RelationConstraint, RelationDefaultResolver, RelationDefaultValue, RelationFilterSpec, RelationLoadPlan, RelationLoadSpec, RelationMetadata, RelationMetadataProvider, RelationMetadataType, RelationResolutionException, RelationTableLookupSpec, RelationshipModelStatic, RuntimeModuleLoader, SEEDER_BRAND, SchemaBuilder, SchemaColumn, SchemaColumnType, SchemaForeignKey, SchemaForeignKeyAction, SchemaIndex, SchemaOperation, SchemaTableAlterOperation, SchemaTableCreateOperation, SchemaTableDropOperation, ScopeNotDefinedException, SeedCommand, Seeder, SeederCallArgument, SeederConstructor, SeederInput, SelectSpec, Serializable, SimplePaginationMeta, SoftDeleteConfig, SoftDeleteQueryMode, SortDirection, TableBuilder, TimestampColumnBehavior, URLDriver, UniqueConstraintResolutionException, UnsupportedAdapterFeatureException, UpdateManySpec, UpdateSpec, UpsertSpec, applyAlterTableOperation, applyCreateTableOperation, applyDropTableOperation, applyMigrationRollbackToDatabase, applyMigrationRollbackToPrismaSchema, applyMigrationToDatabase, applyMigrationToPrismaSchema, applyOperationsToPersistedColumnMappingsState, applyOperationsToPrismaSchema, bindAdapterToModels, buildEnumBlock, buildFieldLine, buildIndexLine, buildInverseRelationLine, buildMigrationIdentity, buildMigrationRunId, buildMigrationSource, buildModelBlock, buildRelationLine, computeMigrationChecksum, configureArkormRuntime, createEmptyAppliedMigrationsState, createEmptyPersistedColumnMappingsState, createKyselyAdapter, createMigrationTimestamp, createPrismaAdapter, createPrismaCompatibilityAdapter, createPrismaDatabaseAdapter, createPrismaDelegateMap, defineConfig, defineFactory, deleteAppliedMigrationsStateFromStore, deletePersistedColumnMappingsState, deriveCollectionFieldName, deriveInverseRelationAlias, deriveRelationAlias, deriveRelationFieldName, deriveSingularFieldName, ensureArkormConfigLoading, escapeRegex, findAppliedMigration, findEnumBlock, findModelBlock, formatDefaultValue, formatEnumDefaultValue, formatRelationAction, generateMigrationFile, getActiveTransactionClient, getDefaultStubsPath, getLastMigrationRun, getLatestAppliedMigrations, getMigrationPlan, getPersistedColumnMap, getPersistedEnumMap, getPersistedEnumTsType, getPersistedPrimaryKeyGeneration, getPersistedTableMetadata, getPersistedTimestampColumns, getRuntimeAdapter, getRuntimePaginationCurrentPageResolver, getRuntimePaginationURLDriverFactory, getRuntimePrismaClient, getUserConfig, inferDelegateName, isDelegateLike, isMigrationApplied, isTransactionCapableClient, loadArkormConfig, markMigrationApplied, markMigrationRun, pad, readAppliedMigrationsState, readAppliedMigrationsStateFromStore, readPersistedColumnMappingsState, rebuildPersistedColumnMappingsState, removeAppliedMigration, resetArkormRuntimeForTests, resetPersistedColumnMappingsCache, resolveCast, resolveColumnMappingsFilePath, resolveEnumName, resolveMigrationClassName, resolveMigrationStateFilePath, resolvePersistedMetadataFeatures, resolvePrismaType, runArkormTransaction, runMigrationWithPrisma, runPrismaCommand, stripPrismaSchemaModelsAndEnums, supportsDatabaseMigrationExecution, supportsDatabaseMigrationState, supportsDatabaseReset, syncPersistedColumnMappingsFromState, toMigrationFileSlug, toModelName, validatePersistedMetadataFeaturesForMigrations, writeAppliedMigrationsState, writeAppliedMigrationsStateToStore, writePersistedColumnMappingsState };
|
package/dist/index.d.mts
CHANGED
|
@@ -11,6 +11,11 @@ interface PrimaryKeyGeneration {
|
|
|
11
11
|
databaseDefault?: string;
|
|
12
12
|
runtimeFactory?: 'uuid';
|
|
13
13
|
}
|
|
14
|
+
interface TimestampColumnBehavior {
|
|
15
|
+
column: string;
|
|
16
|
+
default?: 'now()';
|
|
17
|
+
updatedAt?: boolean;
|
|
18
|
+
}
|
|
14
19
|
interface SchemaColumn {
|
|
15
20
|
name: string;
|
|
16
21
|
type: SchemaColumnType;
|
|
@@ -333,6 +338,7 @@ interface ModelMetadata {
|
|
|
333
338
|
columns: ColumnMap;
|
|
334
339
|
softDelete: SoftDeleteConfig;
|
|
335
340
|
primaryKeyGeneration?: PrimaryKeyGeneration;
|
|
341
|
+
timestampColumns?: TimestampColumnBehavior[];
|
|
336
342
|
}
|
|
337
343
|
type RelationMetadataType = 'hasOne' | 'hasMany' | 'belongsTo' | 'belongsToMany' | 'hasOneThrough' | 'hasManyThrough' | 'morphOne' | 'morphMany' | 'morphToMany';
|
|
338
344
|
interface BaseRelationMetadata {
|
|
@@ -2415,6 +2421,7 @@ declare class QueryBuilder<TModel, TDelegate extends PrismaDelegateLike = Prisma
|
|
|
2415
2421
|
*/
|
|
2416
2422
|
doesntExist(): Promise<boolean>;
|
|
2417
2423
|
private normalizeInsertPayloads;
|
|
2424
|
+
private normalizeUpdatePayload;
|
|
2418
2425
|
private resolveAffectedCount;
|
|
2419
2426
|
private resolveInsertUsingRows;
|
|
2420
2427
|
private resolveInsertUsingSource;
|
|
@@ -2637,6 +2644,7 @@ interface QueryTarget<TModel = unknown> {
|
|
|
2637
2644
|
table?: string;
|
|
2638
2645
|
primaryKey?: string;
|
|
2639
2646
|
primaryKeyGeneration?: PrimaryKeyGeneration;
|
|
2647
|
+
timestampColumns?: TimestampColumnBehavior[];
|
|
2640
2648
|
columns?: Record<string, string>;
|
|
2641
2649
|
softDelete?: SoftDeleteConfig;
|
|
2642
2650
|
alias?: string;
|
|
@@ -4185,10 +4193,14 @@ interface PersistedTableMetadata {
|
|
|
4185
4193
|
columns: Record<string, string>;
|
|
4186
4194
|
enums: Record<string, string[]>;
|
|
4187
4195
|
primaryKeyGeneration?: PersistedPrimaryKeyGeneration;
|
|
4196
|
+
timestampColumns?: PersistedTimestampColumn[];
|
|
4188
4197
|
}
|
|
4189
4198
|
interface PersistedPrimaryKeyGeneration extends PrimaryKeyGeneration {
|
|
4190
4199
|
column: string;
|
|
4191
4200
|
}
|
|
4201
|
+
interface PersistedTimestampColumn extends TimestampColumnBehavior {
|
|
4202
|
+
column: string;
|
|
4203
|
+
}
|
|
4192
4204
|
interface PersistedColumnMappingsState {
|
|
4193
4205
|
version: 1;
|
|
4194
4206
|
tables: Record<string, PersistedTableMetadata>;
|
|
@@ -4224,6 +4236,12 @@ declare const getPersistedPrimaryKeyGeneration: (table: string, options?: {
|
|
|
4224
4236
|
features?: PersistedMetadataFeatures;
|
|
4225
4237
|
strict?: boolean;
|
|
4226
4238
|
}) => PersistedPrimaryKeyGeneration | undefined;
|
|
4239
|
+
declare const getPersistedTimestampColumns: (table: string, options?: {
|
|
4240
|
+
cwd?: string;
|
|
4241
|
+
configuredPath?: string;
|
|
4242
|
+
features?: PersistedMetadataFeatures;
|
|
4243
|
+
strict?: boolean;
|
|
4244
|
+
}) => PersistedTimestampColumn[];
|
|
4227
4245
|
declare const applyOperationsToPersistedColumnMappingsState: (state: PersistedColumnMappingsState, operations: SchemaOperation[], features?: PersistedMetadataFeatures) => PersistedColumnMappingsState;
|
|
4228
4246
|
declare const rebuildPersistedColumnMappingsState: (state: AppliedMigrationsState, availableMigrations: [MigrationClass, string][], features?: PersistedMetadataFeatures) => Promise<PersistedColumnMappingsState>;
|
|
4229
4247
|
declare const syncPersistedColumnMappingsFromState: (cwd: string, state: AppliedMigrationsState, availableMigrations: [MigrationClass, string][], features?: PersistedMetadataFeatures) => Promise<void>;
|
|
@@ -4681,4 +4699,4 @@ declare class URLDriver {
|
|
|
4681
4699
|
url(page: number): string;
|
|
4682
4700
|
}
|
|
4683
4701
|
//#endregion
|
|
4684
|
-
export { AdapterBindableModel, AdapterCapabilities, AdapterCapability, AdapterModelFieldStructure, AdapterModelIntrospectionOptions, AdapterModelStructure, AdapterTransactionContext, AggregateOperation, AggregateSelection, AggregateSpec, AppliedMigrationEntry, AppliedMigrationRun, AppliedMigrationsState, ArkormBootContext, ArkormCollection, ArkormConfig, ArkormErrorContext, ArkormException, Attribute, AttributeCreateInput, AttributeOptions, AttributeOrderBy, AttributeSchemaDelegate, AttributeSelect, AttributeUpdateInput, AttributeWhereInput, BelongsToManyRelationMetadata, BelongsToRelationMetadata, CastDefinition, CastHandler, CastMap, CastType, CliApp, ClientResolver, ColumnMap, DatabaseAdapter, DatabasePrimitive, DatabaseRow, DatabaseRows, DatabaseValue, DelegateCreateData, DelegateFindManyArgs, DelegateForModelSchema, DelegateInclude, DelegateOrderBy, DelegateRow, DelegateRows, DelegateSelect, DelegateUniqueWhere, DelegateUpdateArgs, DelegateUpdateData, DelegateWhere, DeleteManySpec, DeleteSpec, EagerLoadConstraint, EagerLoadMap, EnumBuilder, FactoryAttributes, FactoryDefinition, FactoryModelConstructor, FactoryState, ForeignKeyBuilder, GenerateMigrationOptions, GeneratedMigrationFile, GetUserConfig, GlobalScope, HasManyRelationMetadata, HasManyThroughRelationMetadata, HasOneRelationMetadata, HasOneThroughRelationMetadata, InitCommand, InlineFactory, InsertManySpec, InsertSpec, KyselyDatabaseAdapter, LengthAwarePaginator, MIGRATION_BRAND, MakeFactoryCommand, MakeMigrationCommand, MakeModelCommand, MakeSeederCommand, MigrateCommand, MigrateFreshCommand, MigrateRollbackCommand, Migration, MigrationClass, MigrationHistoryCommand, MigrationInstanceLike, MissingDelegateException, Model, ModelAttributes, ModelAttributesOf, ModelCreateData, ModelEventDispatcher, ModelEventHandler, ModelEventHandlerConstructor, ModelEventListener, ModelEventName, ModelFactory, ModelLifecycleState, ModelMetadata, ModelNotFoundException, ModelStatic, ModelUpdateData, ModelsSyncCommand, MorphManyRelationMetadata, MorphOneRelationMetadata, MorphToManyRelationMetadata, PRISMA_ENUM_MEMBER_REGEX, PRISMA_ENUM_REGEX, PRISMA_MODEL_REGEX, PaginationCurrentPageResolver, PaginationMeta, PaginationOptions, PaginationURLDriver, PaginationURLDriverFactory, Paginator, PersistedColumnMappingsState, PersistedMetadataFeatures, PersistedPrimaryKeyGeneration, PersistedTableMetadata, PrimaryKeyGeneration, PrimaryKeyGenerationPlanner, PrismaClientLike, PrismaDatabaseAdapter, PrismaDelegateLike, PrismaDelegateMap, PrismaDelegateNameMapping, PrismaFindManyArgsLike, PrismaLikeInclude, PrismaLikeOrderBy, PrismaLikeScalarFilter, PrismaLikeSelect, PrismaLikeSortOrder, PrismaLikeWhereInput, PrismaMigrationWorkflowOptions, PrismaSchemaSyncOptions, PrismaTransactionCallback, PrismaTransactionCapableClient, PrismaTransactionOptions, QueryBuilder, QueryComparisonCondition, QueryComparisonOperator, QueryCondition, QueryConstraintException, QueryGroupCondition, QueryLogicalOperator, QueryNotCondition, QueryOrderBy, QueryRawCondition, QuerySelectColumn, QueryTarget, RelatedModelClass, RelationAggregateSpec, RelationColumnLookupSpec, RelationConstraint, RelationDefaultResolver, RelationDefaultValue, RelationFilterSpec, RelationLoadPlan, RelationLoadSpec, RelationMetadata, RelationMetadataProvider, RelationMetadataType, RelationResolutionException, RelationTableLookupSpec, RelationshipModelStatic, RuntimeModuleLoader, SEEDER_BRAND, SchemaBuilder, SchemaColumn, SchemaColumnType, SchemaForeignKey, SchemaForeignKeyAction, SchemaIndex, SchemaOperation, SchemaTableAlterOperation, SchemaTableCreateOperation, SchemaTableDropOperation, ScopeNotDefinedException, SeedCommand, Seeder, SeederCallArgument, SeederConstructor, SeederInput, SelectSpec, Serializable, SimplePaginationMeta, SoftDeleteConfig, SoftDeleteQueryMode, SortDirection, TableBuilder, URLDriver, UniqueConstraintResolutionException, UnsupportedAdapterFeatureException, UpdateManySpec, UpdateSpec, UpsertSpec, applyAlterTableOperation, applyCreateTableOperation, applyDropTableOperation, applyMigrationRollbackToDatabase, applyMigrationRollbackToPrismaSchema, applyMigrationToDatabase, applyMigrationToPrismaSchema, applyOperationsToPersistedColumnMappingsState, applyOperationsToPrismaSchema, bindAdapterToModels, buildEnumBlock, buildFieldLine, buildIndexLine, buildInverseRelationLine, buildMigrationIdentity, buildMigrationRunId, buildMigrationSource, buildModelBlock, buildRelationLine, computeMigrationChecksum, configureArkormRuntime, createEmptyAppliedMigrationsState, createEmptyPersistedColumnMappingsState, createKyselyAdapter, createMigrationTimestamp, createPrismaAdapter, createPrismaCompatibilityAdapter, createPrismaDatabaseAdapter, createPrismaDelegateMap, defineConfig, defineFactory, deleteAppliedMigrationsStateFromStore, deletePersistedColumnMappingsState, deriveCollectionFieldName, deriveInverseRelationAlias, deriveRelationAlias, deriveRelationFieldName, deriveSingularFieldName, ensureArkormConfigLoading, escapeRegex, findAppliedMigration, findEnumBlock, findModelBlock, formatDefaultValue, formatEnumDefaultValue, formatRelationAction, generateMigrationFile, getActiveTransactionClient, getDefaultStubsPath, getLastMigrationRun, getLatestAppliedMigrations, getMigrationPlan, getPersistedColumnMap, getPersistedEnumMap, getPersistedEnumTsType, getPersistedPrimaryKeyGeneration, getPersistedTableMetadata, getRuntimeAdapter, getRuntimePaginationCurrentPageResolver, getRuntimePaginationURLDriverFactory, getRuntimePrismaClient, getUserConfig, inferDelegateName, isDelegateLike, isMigrationApplied, isTransactionCapableClient, loadArkormConfig, markMigrationApplied, markMigrationRun, pad, readAppliedMigrationsState, readAppliedMigrationsStateFromStore, readPersistedColumnMappingsState, rebuildPersistedColumnMappingsState, removeAppliedMigration, resetArkormRuntimeForTests, resetPersistedColumnMappingsCache, resolveCast, resolveColumnMappingsFilePath, resolveEnumName, resolveMigrationClassName, resolveMigrationStateFilePath, resolvePersistedMetadataFeatures, resolvePrismaType, runArkormTransaction, runMigrationWithPrisma, runPrismaCommand, stripPrismaSchemaModelsAndEnums, supportsDatabaseMigrationExecution, supportsDatabaseMigrationState, supportsDatabaseReset, syncPersistedColumnMappingsFromState, toMigrationFileSlug, toModelName, validatePersistedMetadataFeaturesForMigrations, writeAppliedMigrationsState, writeAppliedMigrationsStateToStore, writePersistedColumnMappingsState };
|
|
4702
|
+
export { AdapterBindableModel, AdapterCapabilities, AdapterCapability, AdapterModelFieldStructure, AdapterModelIntrospectionOptions, AdapterModelStructure, AdapterTransactionContext, AggregateOperation, AggregateSelection, AggregateSpec, AppliedMigrationEntry, AppliedMigrationRun, AppliedMigrationsState, ArkormBootContext, ArkormCollection, ArkormConfig, ArkormErrorContext, ArkormException, Attribute, AttributeCreateInput, AttributeOptions, AttributeOrderBy, AttributeSchemaDelegate, AttributeSelect, AttributeUpdateInput, AttributeWhereInput, BelongsToManyRelationMetadata, BelongsToRelationMetadata, CastDefinition, CastHandler, CastMap, CastType, CliApp, ClientResolver, ColumnMap, DatabaseAdapter, DatabasePrimitive, DatabaseRow, DatabaseRows, DatabaseValue, DelegateCreateData, DelegateFindManyArgs, DelegateForModelSchema, DelegateInclude, DelegateOrderBy, DelegateRow, DelegateRows, DelegateSelect, DelegateUniqueWhere, DelegateUpdateArgs, DelegateUpdateData, DelegateWhere, DeleteManySpec, DeleteSpec, EagerLoadConstraint, EagerLoadMap, EnumBuilder, FactoryAttributes, FactoryDefinition, FactoryModelConstructor, FactoryState, ForeignKeyBuilder, GenerateMigrationOptions, GeneratedMigrationFile, GetUserConfig, GlobalScope, HasManyRelationMetadata, HasManyThroughRelationMetadata, HasOneRelationMetadata, HasOneThroughRelationMetadata, InitCommand, InlineFactory, InsertManySpec, InsertSpec, KyselyDatabaseAdapter, LengthAwarePaginator, MIGRATION_BRAND, MakeFactoryCommand, MakeMigrationCommand, MakeModelCommand, MakeSeederCommand, MigrateCommand, MigrateFreshCommand, MigrateRollbackCommand, Migration, MigrationClass, MigrationHistoryCommand, MigrationInstanceLike, MissingDelegateException, Model, ModelAttributes, ModelAttributesOf, ModelCreateData, ModelEventDispatcher, ModelEventHandler, ModelEventHandlerConstructor, ModelEventListener, ModelEventName, ModelFactory, ModelLifecycleState, ModelMetadata, ModelNotFoundException, ModelStatic, ModelUpdateData, ModelsSyncCommand, MorphManyRelationMetadata, MorphOneRelationMetadata, MorphToManyRelationMetadata, PRISMA_ENUM_MEMBER_REGEX, PRISMA_ENUM_REGEX, PRISMA_MODEL_REGEX, PaginationCurrentPageResolver, PaginationMeta, PaginationOptions, PaginationURLDriver, PaginationURLDriverFactory, Paginator, PersistedColumnMappingsState, PersistedMetadataFeatures, PersistedPrimaryKeyGeneration, PersistedTableMetadata, PersistedTimestampColumn, PrimaryKeyGeneration, PrimaryKeyGenerationPlanner, PrismaClientLike, PrismaDatabaseAdapter, PrismaDelegateLike, PrismaDelegateMap, PrismaDelegateNameMapping, PrismaFindManyArgsLike, PrismaLikeInclude, PrismaLikeOrderBy, PrismaLikeScalarFilter, PrismaLikeSelect, PrismaLikeSortOrder, PrismaLikeWhereInput, PrismaMigrationWorkflowOptions, PrismaSchemaSyncOptions, PrismaTransactionCallback, PrismaTransactionCapableClient, PrismaTransactionOptions, QueryBuilder, QueryComparisonCondition, QueryComparisonOperator, QueryCondition, QueryConstraintException, QueryGroupCondition, QueryLogicalOperator, QueryNotCondition, QueryOrderBy, QueryRawCondition, QuerySelectColumn, QueryTarget, RelatedModelClass, RelationAggregateSpec, RelationColumnLookupSpec, RelationConstraint, RelationDefaultResolver, RelationDefaultValue, RelationFilterSpec, RelationLoadPlan, RelationLoadSpec, RelationMetadata, RelationMetadataProvider, RelationMetadataType, RelationResolutionException, RelationTableLookupSpec, RelationshipModelStatic, RuntimeModuleLoader, SEEDER_BRAND, SchemaBuilder, SchemaColumn, SchemaColumnType, SchemaForeignKey, SchemaForeignKeyAction, SchemaIndex, SchemaOperation, SchemaTableAlterOperation, SchemaTableCreateOperation, SchemaTableDropOperation, ScopeNotDefinedException, SeedCommand, Seeder, SeederCallArgument, SeederConstructor, SeederInput, SelectSpec, Serializable, SimplePaginationMeta, SoftDeleteConfig, SoftDeleteQueryMode, SortDirection, TableBuilder, TimestampColumnBehavior, URLDriver, UniqueConstraintResolutionException, UnsupportedAdapterFeatureException, UpdateManySpec, UpdateSpec, UpsertSpec, applyAlterTableOperation, applyCreateTableOperation, applyDropTableOperation, applyMigrationRollbackToDatabase, applyMigrationRollbackToPrismaSchema, applyMigrationToDatabase, applyMigrationToPrismaSchema, applyOperationsToPersistedColumnMappingsState, applyOperationsToPrismaSchema, bindAdapterToModels, buildEnumBlock, buildFieldLine, buildIndexLine, buildInverseRelationLine, buildMigrationIdentity, buildMigrationRunId, buildMigrationSource, buildModelBlock, buildRelationLine, computeMigrationChecksum, configureArkormRuntime, createEmptyAppliedMigrationsState, createEmptyPersistedColumnMappingsState, createKyselyAdapter, createMigrationTimestamp, createPrismaAdapter, createPrismaCompatibilityAdapter, createPrismaDatabaseAdapter, createPrismaDelegateMap, defineConfig, defineFactory, deleteAppliedMigrationsStateFromStore, deletePersistedColumnMappingsState, deriveCollectionFieldName, deriveInverseRelationAlias, deriveRelationAlias, deriveRelationFieldName, deriveSingularFieldName, ensureArkormConfigLoading, escapeRegex, findAppliedMigration, findEnumBlock, findModelBlock, formatDefaultValue, formatEnumDefaultValue, formatRelationAction, generateMigrationFile, getActiveTransactionClient, getDefaultStubsPath, getLastMigrationRun, getLatestAppliedMigrations, getMigrationPlan, getPersistedColumnMap, getPersistedEnumMap, getPersistedEnumTsType, getPersistedPrimaryKeyGeneration, getPersistedTableMetadata, getPersistedTimestampColumns, getRuntimeAdapter, getRuntimePaginationCurrentPageResolver, getRuntimePaginationURLDriverFactory, getRuntimePrismaClient, getUserConfig, inferDelegateName, isDelegateLike, isMigrationApplied, isTransactionCapableClient, loadArkormConfig, markMigrationApplied, markMigrationRun, pad, readAppliedMigrationsState, readAppliedMigrationsStateFromStore, readPersistedColumnMappingsState, rebuildPersistedColumnMappingsState, removeAppliedMigration, resetArkormRuntimeForTests, resetPersistedColumnMappingsCache, resolveCast, resolveColumnMappingsFilePath, resolveEnumName, resolveMigrationClassName, resolveMigrationStateFilePath, resolvePersistedMetadataFeatures, resolvePrismaType, runArkormTransaction, runMigrationWithPrisma, runPrismaCommand, stripPrismaSchemaModelsAndEnums, supportsDatabaseMigrationExecution, supportsDatabaseMigrationState, supportsDatabaseReset, syncPersistedColumnMappingsFromState, toMigrationFileSlug, toModelName, validatePersistedMetadataFeaturesForMigrations, writeAppliedMigrationsState, writeAppliedMigrationsStateToStore, writePersistedColumnMappingsState };
|
package/dist/index.mjs
CHANGED
|
@@ -2589,7 +2589,7 @@ const normalizePersistedTableMetadata = (table) => {
|
|
|
2589
2589
|
enums: {}
|
|
2590
2590
|
};
|
|
2591
2591
|
const candidate = table;
|
|
2592
|
-
if (!(Object.prototype.hasOwnProperty.call(candidate, "columns") || Object.prototype.hasOwnProperty.call(candidate, "enums"))) return {
|
|
2592
|
+
if (!(Object.prototype.hasOwnProperty.call(candidate, "columns") || Object.prototype.hasOwnProperty.call(candidate, "enums") || Object.prototype.hasOwnProperty.call(candidate, "primaryKeyGeneration") || Object.prototype.hasOwnProperty.call(candidate, "timestampColumns"))) return {
|
|
2593
2593
|
columns: normalizeLegacyTableColumns(candidate),
|
|
2594
2594
|
enums: {}
|
|
2595
2595
|
};
|
|
@@ -2601,7 +2601,8 @@ const normalizePersistedTableMetadata = (table) => {
|
|
|
2601
2601
|
if (normalizedValues.length > 0) all[columnName] = normalizedValues;
|
|
2602
2602
|
return all;
|
|
2603
2603
|
}, {}),
|
|
2604
|
-
primaryKeyGeneration: normalizePersistedPrimaryKeyGeneration(candidate.primaryKeyGeneration)
|
|
2604
|
+
primaryKeyGeneration: normalizePersistedPrimaryKeyGeneration(candidate.primaryKeyGeneration),
|
|
2605
|
+
timestampColumns: normalizePersistedTimestampColumns(candidate.timestampColumns)
|
|
2605
2606
|
};
|
|
2606
2607
|
};
|
|
2607
2608
|
const normalizePersistedPrimaryKeyGeneration = (value) => {
|
|
@@ -2616,13 +2617,28 @@ const normalizePersistedPrimaryKeyGeneration = (value) => {
|
|
|
2616
2617
|
runtimeFactory: candidate.runtimeFactory === "uuid" ? "uuid" : void 0
|
|
2617
2618
|
};
|
|
2618
2619
|
};
|
|
2620
|
+
const normalizePersistedTimestampColumns = (value) => {
|
|
2621
|
+
if (!Array.isArray(value)) return void 0;
|
|
2622
|
+
const columns = value.reduce((all, entry) => {
|
|
2623
|
+
if (!entry || typeof entry !== "object" || Array.isArray(entry)) return all;
|
|
2624
|
+
const candidate = entry;
|
|
2625
|
+
if (typeof candidate.column !== "string" || candidate.column.trim().length === 0) return all;
|
|
2626
|
+
const normalized = { column: candidate.column };
|
|
2627
|
+
if (candidate.default === "now()") normalized.default = "now()";
|
|
2628
|
+
if (candidate.updatedAt === true) normalized.updatedAt = true;
|
|
2629
|
+
if (!normalized.default && !normalized.updatedAt) return all;
|
|
2630
|
+
all.push(normalized);
|
|
2631
|
+
return all;
|
|
2632
|
+
}, []);
|
|
2633
|
+
return columns.length > 0 ? columns : void 0;
|
|
2634
|
+
};
|
|
2619
2635
|
const normalizePersistedColumnMappingsState = (state) => {
|
|
2620
2636
|
return {
|
|
2621
2637
|
version: 1,
|
|
2622
2638
|
tables: Object.entries(state?.tables ?? {}).reduce((all, [tableName, tableMetadata]) => {
|
|
2623
2639
|
if (tableName.trim().length === 0) return all;
|
|
2624
2640
|
const normalized = normalizePersistedTableMetadata(tableMetadata);
|
|
2625
|
-
if (Object.keys(normalized.columns).length > 0 || Object.keys(normalized.enums).length > 0 || normalized.primaryKeyGeneration) all[tableName] = normalized;
|
|
2641
|
+
if (Object.keys(normalized.columns).length > 0 || Object.keys(normalized.enums).length > 0 || normalized.primaryKeyGeneration || normalized.timestampColumns?.length) all[tableName] = normalized;
|
|
2626
2642
|
return all;
|
|
2627
2643
|
}, {})
|
|
2628
2644
|
};
|
|
@@ -2694,7 +2710,8 @@ const getPersistedTableMetadata = (table, options = {}) => {
|
|
|
2694
2710
|
all[columnName] = [...values];
|
|
2695
2711
|
return all;
|
|
2696
2712
|
}, {}),
|
|
2697
|
-
primaryKeyGeneration: metadata.primaryKeyGeneration ? { ...metadata.primaryKeyGeneration } : void 0
|
|
2713
|
+
primaryKeyGeneration: metadata.primaryKeyGeneration ? { ...metadata.primaryKeyGeneration } : void 0,
|
|
2714
|
+
timestampColumns: metadata.timestampColumns?.map((column) => ({ ...column }))
|
|
2698
2715
|
};
|
|
2699
2716
|
};
|
|
2700
2717
|
const getPersistedColumnMap = (table, options = {}) => {
|
|
@@ -2706,6 +2723,9 @@ const getPersistedEnumMap = (table, options = {}) => {
|
|
|
2706
2723
|
const getPersistedPrimaryKeyGeneration = (table, options = {}) => {
|
|
2707
2724
|
return getPersistedTableMetadata(table, options).primaryKeyGeneration;
|
|
2708
2725
|
};
|
|
2726
|
+
const getPersistedTimestampColumns = (table, options = {}) => {
|
|
2727
|
+
return getPersistedTableMetadata(table, options).timestampColumns ?? [];
|
|
2728
|
+
};
|
|
2709
2729
|
const applyMappedColumn = (tableColumns, column, features, table) => {
|
|
2710
2730
|
if (typeof column.map === "string" && column.map.trim().length > 0 && column.map !== column.name) {
|
|
2711
2731
|
if (!features.persistedColumnMappings) throw buildPersistedFeatureDisabledError("persistedColumnMappings", table);
|
|
@@ -2730,6 +2750,10 @@ const removePersistedColumnMetadata = (tableMetadata, columnName) => {
|
|
|
2730
2750
|
if (mappedColumn === columnName) delete tableMetadata.columns[attribute];
|
|
2731
2751
|
});
|
|
2732
2752
|
if (tableMetadata.primaryKeyGeneration?.column === columnName) delete tableMetadata.primaryKeyGeneration;
|
|
2753
|
+
if (tableMetadata.timestampColumns) {
|
|
2754
|
+
tableMetadata.timestampColumns = tableMetadata.timestampColumns.filter((column) => column.column !== columnName);
|
|
2755
|
+
if (tableMetadata.timestampColumns.length === 0) delete tableMetadata.timestampColumns;
|
|
2756
|
+
}
|
|
2733
2757
|
};
|
|
2734
2758
|
const applyPrimaryKeyGeneration = (tableMetadata, column) => {
|
|
2735
2759
|
if (!column.primary || !column.primaryKeyGeneration) {
|
|
@@ -2741,6 +2765,21 @@ const applyPrimaryKeyGeneration = (tableMetadata, column) => {
|
|
|
2741
2765
|
...column.primaryKeyGeneration
|
|
2742
2766
|
};
|
|
2743
2767
|
};
|
|
2768
|
+
const applyTimestampColumn = (tableMetadata, column) => {
|
|
2769
|
+
if (column.type !== "timestamp" || column.default !== "now()" && column.updatedAt !== true) {
|
|
2770
|
+
if (tableMetadata.timestampColumns) {
|
|
2771
|
+
tableMetadata.timestampColumns = tableMetadata.timestampColumns.filter((entry) => entry.column !== column.name);
|
|
2772
|
+
if (tableMetadata.timestampColumns.length === 0) delete tableMetadata.timestampColumns;
|
|
2773
|
+
}
|
|
2774
|
+
return;
|
|
2775
|
+
}
|
|
2776
|
+
const nextColumn = {
|
|
2777
|
+
column: column.name,
|
|
2778
|
+
...column.default === "now()" ? { default: "now()" } : {},
|
|
2779
|
+
...column.updatedAt ? { updatedAt: true } : {}
|
|
2780
|
+
};
|
|
2781
|
+
tableMetadata.timestampColumns = [...(tableMetadata.timestampColumns ?? []).filter((entry) => entry.column !== column.name), nextColumn];
|
|
2782
|
+
};
|
|
2744
2783
|
const applyOperationsToPersistedColumnMappingsState = (state, operations, features = resolvePersistedMetadataFeatures()) => {
|
|
2745
2784
|
const nextTables = Object.entries(state.tables).reduce((all, [table, metadata]) => {
|
|
2746
2785
|
all[table] = {
|
|
@@ -2749,7 +2788,8 @@ const applyOperationsToPersistedColumnMappingsState = (state, operations, featur
|
|
|
2749
2788
|
nextEnums[columnName] = [...values];
|
|
2750
2789
|
return nextEnums;
|
|
2751
2790
|
}, {}),
|
|
2752
|
-
primaryKeyGeneration: metadata.primaryKeyGeneration ? { ...metadata.primaryKeyGeneration } : void 0
|
|
2791
|
+
primaryKeyGeneration: metadata.primaryKeyGeneration ? { ...metadata.primaryKeyGeneration } : void 0,
|
|
2792
|
+
timestampColumns: metadata.timestampColumns?.map((column) => ({ ...column }))
|
|
2753
2793
|
};
|
|
2754
2794
|
return all;
|
|
2755
2795
|
}, {});
|
|
@@ -2763,8 +2803,9 @@ const applyOperationsToPersistedColumnMappingsState = (state, operations, featur
|
|
|
2763
2803
|
applyMappedColumn(tableMetadata.columns, column, features, operation.table);
|
|
2764
2804
|
applyEnumColumn(tableMetadata.enums, column, features, operation.table);
|
|
2765
2805
|
applyPrimaryKeyGeneration(tableMetadata, column);
|
|
2806
|
+
applyTimestampColumn(tableMetadata, column);
|
|
2766
2807
|
});
|
|
2767
|
-
if (Object.keys(tableMetadata.columns).length > 0 || Object.keys(tableMetadata.enums).length > 0 || tableMetadata.primaryKeyGeneration) nextTables[operation.table] = tableMetadata;
|
|
2808
|
+
if (Object.keys(tableMetadata.columns).length > 0 || Object.keys(tableMetadata.enums).length > 0 || tableMetadata.primaryKeyGeneration || tableMetadata.timestampColumns?.length) nextTables[operation.table] = tableMetadata;
|
|
2768
2809
|
else delete nextTables[operation.table];
|
|
2769
2810
|
return;
|
|
2770
2811
|
}
|
|
@@ -2777,11 +2818,12 @@ const applyOperationsToPersistedColumnMappingsState = (state, operations, featur
|
|
|
2777
2818
|
applyMappedColumn(tableMetadata.columns, column, features, operation.table);
|
|
2778
2819
|
applyEnumColumn(tableMetadata.enums, column, features, operation.table);
|
|
2779
2820
|
applyPrimaryKeyGeneration(tableMetadata, column);
|
|
2821
|
+
applyTimestampColumn(tableMetadata, column);
|
|
2780
2822
|
});
|
|
2781
2823
|
operation.dropColumns.forEach((columnName) => {
|
|
2782
2824
|
removePersistedColumnMetadata(tableMetadata, columnName);
|
|
2783
2825
|
});
|
|
2784
|
-
if (Object.keys(tableMetadata.columns).length > 0 || Object.keys(tableMetadata.enums).length > 0 || tableMetadata.primaryKeyGeneration) nextTables[operation.table] = tableMetadata;
|
|
2826
|
+
if (Object.keys(tableMetadata.columns).length > 0 || Object.keys(tableMetadata.enums).length > 0 || tableMetadata.primaryKeyGeneration || tableMetadata.timestampColumns?.length) nextTables[operation.table] = tableMetadata;
|
|
2785
2827
|
else delete nextTables[operation.table];
|
|
2786
2828
|
return;
|
|
2787
2829
|
}
|
|
@@ -7690,8 +7732,7 @@ var QueryBuilder = class QueryBuilder {
|
|
|
7690
7732
|
* @returns
|
|
7691
7733
|
*/
|
|
7692
7734
|
async create(data) {
|
|
7693
|
-
const
|
|
7694
|
-
const created = await this.executeInsertRow(payload);
|
|
7735
|
+
const created = await this.executeInsertRow(data);
|
|
7695
7736
|
return this.model.hydrate(created);
|
|
7696
7737
|
}
|
|
7697
7738
|
/**
|
|
@@ -7702,8 +7743,7 @@ var QueryBuilder = class QueryBuilder {
|
|
|
7702
7743
|
*/
|
|
7703
7744
|
async createMany(values) {
|
|
7704
7745
|
if (values.length === 0) return [];
|
|
7705
|
-
|
|
7706
|
-
return await Promise.all(payloads.map(async (value) => await this.create(value)));
|
|
7746
|
+
return await Promise.all(values.map(async (value) => await this.create(value)));
|
|
7707
7747
|
}
|
|
7708
7748
|
/**
|
|
7709
7749
|
* Insert one or more records.
|
|
@@ -7971,14 +8011,26 @@ var QueryBuilder = class QueryBuilder {
|
|
|
7971
8011
|
const metadata = this.model.getModelMetadata();
|
|
7972
8012
|
return payloads.map((payload) => {
|
|
7973
8013
|
const nextPayload = { ...payload };
|
|
8014
|
+
const now = /* @__PURE__ */ new Date();
|
|
7974
8015
|
const primaryKeyValue = nextPayload[metadata.primaryKey];
|
|
7975
|
-
if (primaryKeyValue
|
|
7976
|
-
|
|
7977
|
-
|
|
7978
|
-
|
|
8016
|
+
if (primaryKeyValue === void 0 || primaryKeyValue === null) {
|
|
8017
|
+
const generated = PrimaryKeyGenerationPlanner.generate(metadata.primaryKeyGeneration);
|
|
8018
|
+
if (generated !== void 0) nextPayload[metadata.primaryKey] = generated;
|
|
8019
|
+
}
|
|
8020
|
+
for (const column of metadata.timestampColumns ?? []) {
|
|
8021
|
+
if (nextPayload[column.column] !== void 0 && nextPayload[column.column] !== null) continue;
|
|
8022
|
+
if (column.default === "now()" || column.updatedAt) nextPayload[column.column] = now;
|
|
8023
|
+
}
|
|
7979
8024
|
return nextPayload;
|
|
7980
8025
|
});
|
|
7981
8026
|
}
|
|
8027
|
+
normalizeUpdatePayload(values) {
|
|
8028
|
+
const metadata = this.model.getModelMetadata();
|
|
8029
|
+
const nextPayload = { ...values };
|
|
8030
|
+
const now = /* @__PURE__ */ new Date();
|
|
8031
|
+
for (const column of metadata.timestampColumns ?? []) if (column.updatedAt) nextPayload[column.column] = now;
|
|
8032
|
+
return nextPayload;
|
|
8033
|
+
}
|
|
7982
8034
|
resolveAffectedCount(result, fallback) {
|
|
7983
8035
|
if (typeof result === "number") return result;
|
|
7984
8036
|
if (result && typeof result === "object" && "count" in result) {
|
|
@@ -8221,6 +8273,7 @@ var QueryBuilder = class QueryBuilder {
|
|
|
8221
8273
|
table: metadata.table,
|
|
8222
8274
|
primaryKey: metadata.primaryKey,
|
|
8223
8275
|
primaryKeyGeneration: metadata.primaryKeyGeneration,
|
|
8276
|
+
timestampColumns: metadata.timestampColumns,
|
|
8224
8277
|
columns: metadata.columns,
|
|
8225
8278
|
softDelete: metadata.softDelete
|
|
8226
8279
|
};
|
|
@@ -8585,13 +8638,15 @@ var QueryBuilder = class QueryBuilder {
|
|
|
8585
8638
|
}) != null;
|
|
8586
8639
|
}
|
|
8587
8640
|
async executeInsertRow(values) {
|
|
8588
|
-
|
|
8641
|
+
const [payload] = this.normalizeInsertPayloads(values);
|
|
8642
|
+
return await this.requireAdapter().insert(this.tryBuildInsertSpec(payload));
|
|
8589
8643
|
}
|
|
8590
8644
|
async executeInsertManyRows(values, ignoreDuplicates = false) {
|
|
8591
8645
|
const adapter = this.requireAdapter();
|
|
8592
|
-
|
|
8646
|
+
const payloads = this.normalizeInsertPayloads(values);
|
|
8647
|
+
if (typeof adapter.insertMany === "function") return await adapter.insertMany(ignoreDuplicates ? this.tryBuildInsertOrIgnoreManySpec(payloads) : this.tryBuildInsertManySpec(payloads));
|
|
8593
8648
|
let inserted = 0;
|
|
8594
|
-
for (const value of
|
|
8649
|
+
for (const value of payloads) try {
|
|
8595
8650
|
await adapter.insert(this.tryBuildInsertSpec(value));
|
|
8596
8651
|
inserted += 1;
|
|
8597
8652
|
} catch (error) {
|
|
@@ -8601,15 +8656,18 @@ var QueryBuilder = class QueryBuilder {
|
|
|
8601
8656
|
}
|
|
8602
8657
|
async executeUpsertRows(values, uniqueBy, updateColumns) {
|
|
8603
8658
|
const adapter = this.requireAdapter();
|
|
8659
|
+
const payloads = this.normalizeInsertPayloads(values);
|
|
8660
|
+
const timestampUpdateColumns = (this.model.getModelMetadata().timestampColumns ?? []).filter((column) => column.updatedAt).map((column) => column.column);
|
|
8661
|
+
const normalizedUpdateColumns = updateColumns ? Array.from(new Set([...updateColumns, ...timestampUpdateColumns])) : updateColumns;
|
|
8604
8662
|
if (typeof adapter.upsert !== "function") throw new UnsupportedAdapterFeatureException("Upsert is not supported by the current adapter.", {
|
|
8605
8663
|
operation: "query.upsert",
|
|
8606
8664
|
model: this.model.name
|
|
8607
8665
|
});
|
|
8608
|
-
return await adapter.upsert(this.tryBuildUpsertSpec(
|
|
8666
|
+
return await adapter.upsert(this.tryBuildUpsertSpec(payloads, uniqueBy, normalizedUpdateColumns));
|
|
8609
8667
|
}
|
|
8610
8668
|
async executeUpdateRow(where, values) {
|
|
8611
8669
|
const adapter = this.requireAdapter();
|
|
8612
|
-
const spec = this.tryBuildUpdateSpec(where, values);
|
|
8670
|
+
const spec = this.tryBuildUpdateSpec(where, this.normalizeUpdatePayload(values));
|
|
8613
8671
|
if (!spec) throw new UnsupportedAdapterFeatureException("Update could not be compiled into an Arkorm update specification.", {
|
|
8614
8672
|
operation: "query.update",
|
|
8615
8673
|
model: this.model.name
|
|
@@ -8620,7 +8678,8 @@ var QueryBuilder = class QueryBuilder {
|
|
|
8620
8678
|
}
|
|
8621
8679
|
async executeUpdateManyRows(where, values) {
|
|
8622
8680
|
const adapter = this.requireAdapter();
|
|
8623
|
-
const
|
|
8681
|
+
const normalizedValues = this.normalizeUpdatePayload(values);
|
|
8682
|
+
const spec = this.tryBuildUpdateManySpec(where, normalizedValues);
|
|
8624
8683
|
if (!spec) throw new UnsupportedAdapterFeatureException("Update-many could not be compiled into an Arkorm update specification.", {
|
|
8625
8684
|
operation: "query.updateMany",
|
|
8626
8685
|
model: this.model.name
|
|
@@ -8637,7 +8696,7 @@ var QueryBuilder = class QueryBuilder {
|
|
|
8637
8696
|
if (await adapter.update({
|
|
8638
8697
|
target: spec.target,
|
|
8639
8698
|
where: rowWhere,
|
|
8640
|
-
values:
|
|
8699
|
+
values: normalizedValues
|
|
8641
8700
|
})) updated += 1;
|
|
8642
8701
|
}
|
|
8643
8702
|
return updated;
|
|
@@ -9063,7 +9122,8 @@ var Model = class Model {
|
|
|
9063
9122
|
prismaDefault: persistedMetadata.primaryKeyGeneration.prismaDefault,
|
|
9064
9123
|
databaseDefault: persistedMetadata.primaryKeyGeneration.databaseDefault,
|
|
9065
9124
|
runtimeFactory: persistedMetadata.primaryKeyGeneration.runtimeFactory
|
|
9066
|
-
} : void 0
|
|
9125
|
+
} : void 0,
|
|
9126
|
+
timestampColumns: persistedMetadata.timestampColumns?.map((column) => ({ ...column }))
|
|
9067
9127
|
};
|
|
9068
9128
|
}
|
|
9069
9129
|
static getRelationMetadata(name) {
|
|
@@ -10065,4 +10125,4 @@ var Model = class Model {
|
|
|
10065
10125
|
};
|
|
10066
10126
|
|
|
10067
10127
|
//#endregion
|
|
10068
|
-
export { ArkormCollection, ArkormException, Attribute, CliApp, EnumBuilder, ForeignKeyBuilder, InitCommand, InlineFactory, KyselyDatabaseAdapter, LengthAwarePaginator, MIGRATION_BRAND, MakeFactoryCommand, MakeMigrationCommand, MakeModelCommand, MakeSeederCommand, MigrateCommand, MigrateFreshCommand, MigrateRollbackCommand, Migration, MigrationHistoryCommand, MissingDelegateException, Model, ModelFactory, ModelNotFoundException, ModelsSyncCommand, PRISMA_ENUM_MEMBER_REGEX, PRISMA_ENUM_REGEX, PRISMA_MODEL_REGEX, Paginator, PrimaryKeyGenerationPlanner, PrismaDatabaseAdapter, QueryBuilder, QueryConstraintException, RelationResolutionException, RuntimeModuleLoader, SEEDER_BRAND, SchemaBuilder, ScopeNotDefinedException, SeedCommand, Seeder, TableBuilder, URLDriver, UniqueConstraintResolutionException, UnsupportedAdapterFeatureException, applyAlterTableOperation, applyCreateTableOperation, applyDropTableOperation, applyMigrationRollbackToDatabase, applyMigrationRollbackToPrismaSchema, applyMigrationToDatabase, applyMigrationToPrismaSchema, applyOperationsToPersistedColumnMappingsState, applyOperationsToPrismaSchema, bindAdapterToModels, buildEnumBlock, buildFieldLine, buildIndexLine, buildInverseRelationLine, buildMigrationIdentity, buildMigrationRunId, buildMigrationSource, buildModelBlock, buildRelationLine, computeMigrationChecksum, configureArkormRuntime, createEmptyAppliedMigrationsState, createEmptyPersistedColumnMappingsState, createKyselyAdapter, createMigrationTimestamp, createPrismaAdapter, createPrismaCompatibilityAdapter, createPrismaDatabaseAdapter, createPrismaDelegateMap, defineConfig, defineFactory, deleteAppliedMigrationsStateFromStore, deletePersistedColumnMappingsState, deriveCollectionFieldName, deriveInverseRelationAlias, deriveRelationAlias, deriveRelationFieldName, deriveSingularFieldName, ensureArkormConfigLoading, escapeRegex, findAppliedMigration, findEnumBlock, findModelBlock, formatDefaultValue, formatEnumDefaultValue, formatRelationAction, generateMigrationFile, getActiveTransactionClient, getDefaultStubsPath, getLastMigrationRun, getLatestAppliedMigrations, getMigrationPlan, getPersistedColumnMap, getPersistedEnumMap, getPersistedEnumTsType, getPersistedPrimaryKeyGeneration, getPersistedTableMetadata, getRuntimeAdapter, getRuntimePaginationCurrentPageResolver, getRuntimePaginationURLDriverFactory, getRuntimePrismaClient, getUserConfig, inferDelegateName, isDelegateLike, isMigrationApplied, isTransactionCapableClient, loadArkormConfig, markMigrationApplied, markMigrationRun, pad, readAppliedMigrationsState, readAppliedMigrationsStateFromStore, readPersistedColumnMappingsState, rebuildPersistedColumnMappingsState, removeAppliedMigration, resetArkormRuntimeForTests, resetPersistedColumnMappingsCache, resolveCast, resolveColumnMappingsFilePath, resolveEnumName, resolveMigrationClassName, resolveMigrationStateFilePath, resolvePersistedMetadataFeatures, resolvePrismaType, runArkormTransaction, runMigrationWithPrisma, runPrismaCommand, stripPrismaSchemaModelsAndEnums, supportsDatabaseMigrationExecution, supportsDatabaseMigrationState, supportsDatabaseReset, syncPersistedColumnMappingsFromState, toMigrationFileSlug, toModelName, validatePersistedMetadataFeaturesForMigrations, writeAppliedMigrationsState, writeAppliedMigrationsStateToStore, writePersistedColumnMappingsState };
|
|
10128
|
+
export { ArkormCollection, ArkormException, Attribute, CliApp, EnumBuilder, ForeignKeyBuilder, InitCommand, InlineFactory, KyselyDatabaseAdapter, LengthAwarePaginator, MIGRATION_BRAND, MakeFactoryCommand, MakeMigrationCommand, MakeModelCommand, MakeSeederCommand, MigrateCommand, MigrateFreshCommand, MigrateRollbackCommand, Migration, MigrationHistoryCommand, MissingDelegateException, Model, ModelFactory, ModelNotFoundException, ModelsSyncCommand, PRISMA_ENUM_MEMBER_REGEX, PRISMA_ENUM_REGEX, PRISMA_MODEL_REGEX, Paginator, PrimaryKeyGenerationPlanner, PrismaDatabaseAdapter, QueryBuilder, QueryConstraintException, RelationResolutionException, RuntimeModuleLoader, SEEDER_BRAND, SchemaBuilder, ScopeNotDefinedException, SeedCommand, Seeder, TableBuilder, URLDriver, UniqueConstraintResolutionException, UnsupportedAdapterFeatureException, applyAlterTableOperation, applyCreateTableOperation, applyDropTableOperation, applyMigrationRollbackToDatabase, applyMigrationRollbackToPrismaSchema, applyMigrationToDatabase, applyMigrationToPrismaSchema, applyOperationsToPersistedColumnMappingsState, applyOperationsToPrismaSchema, bindAdapterToModels, buildEnumBlock, buildFieldLine, buildIndexLine, buildInverseRelationLine, buildMigrationIdentity, buildMigrationRunId, buildMigrationSource, buildModelBlock, buildRelationLine, computeMigrationChecksum, configureArkormRuntime, createEmptyAppliedMigrationsState, createEmptyPersistedColumnMappingsState, createKyselyAdapter, createMigrationTimestamp, createPrismaAdapter, createPrismaCompatibilityAdapter, createPrismaDatabaseAdapter, createPrismaDelegateMap, defineConfig, defineFactory, deleteAppliedMigrationsStateFromStore, deletePersistedColumnMappingsState, deriveCollectionFieldName, deriveInverseRelationAlias, deriveRelationAlias, deriveRelationFieldName, deriveSingularFieldName, ensureArkormConfigLoading, escapeRegex, findAppliedMigration, findEnumBlock, findModelBlock, formatDefaultValue, formatEnumDefaultValue, formatRelationAction, generateMigrationFile, getActiveTransactionClient, getDefaultStubsPath, getLastMigrationRun, getLatestAppliedMigrations, getMigrationPlan, getPersistedColumnMap, getPersistedEnumMap, getPersistedEnumTsType, getPersistedPrimaryKeyGeneration, getPersistedTableMetadata, getPersistedTimestampColumns, getRuntimeAdapter, getRuntimePaginationCurrentPageResolver, getRuntimePaginationURLDriverFactory, getRuntimePrismaClient, getUserConfig, inferDelegateName, isDelegateLike, isMigrationApplied, isTransactionCapableClient, loadArkormConfig, markMigrationApplied, markMigrationRun, pad, readAppliedMigrationsState, readAppliedMigrationsStateFromStore, readPersistedColumnMappingsState, rebuildPersistedColumnMappingsState, removeAppliedMigration, resetArkormRuntimeForTests, resetPersistedColumnMappingsCache, resolveCast, resolveColumnMappingsFilePath, resolveEnumName, resolveMigrationClassName, resolveMigrationStateFilePath, resolvePersistedMetadataFeatures, resolvePrismaType, runArkormTransaction, runMigrationWithPrisma, runPrismaCommand, stripPrismaSchemaModelsAndEnums, supportsDatabaseMigrationExecution, supportsDatabaseMigrationState, supportsDatabaseReset, syncPersistedColumnMappingsFromState, toMigrationFileSlug, toModelName, validatePersistedMetadataFeaturesForMigrations, writeAppliedMigrationsState, writeAppliedMigrationsStateToStore, writePersistedColumnMappingsState };
|