@infuro/cms-core 1.0.4 → 1.0.6

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.cjs CHANGED
@@ -140,12 +140,123 @@ This link expires in 1 hour.`
140
140
  }
141
141
  });
142
142
 
143
+ // src/plugins/payment/stripe.ts
144
+ var stripe_exports = {};
145
+ __export(stripe_exports, {
146
+ StripePaymentService: () => StripePaymentService
147
+ });
148
+ var import_stripe, StripePaymentService;
149
+ var init_stripe = __esm({
150
+ "src/plugins/payment/stripe.ts"() {
151
+ "use strict";
152
+ import_stripe = __toESM(require("stripe"), 1);
153
+ StripePaymentService = class {
154
+ stripe;
155
+ webhookSecret;
156
+ constructor(config) {
157
+ this.stripe = new import_stripe.default(config.secretKey, { apiVersion: "2024-06-20" });
158
+ this.webhookSecret = config.webhookSecret;
159
+ }
160
+ async createPaymentIntent(amount, currency, metadata) {
161
+ const intent = await this.stripe.paymentIntents.create({
162
+ amount: Math.round(amount * 100),
163
+ currency: currency.toLowerCase(),
164
+ metadata
165
+ });
166
+ return {
167
+ id: intent.id,
168
+ clientSecret: intent.client_secret || "",
169
+ amount,
170
+ currency,
171
+ status: intent.status
172
+ };
173
+ }
174
+ async capturePayment(paymentId, amount) {
175
+ try {
176
+ await this.stripe.paymentIntents.capture(paymentId, {
177
+ amount_to_capture: amount ? Math.round(amount * 100) : void 0
178
+ });
179
+ return true;
180
+ } catch {
181
+ return false;
182
+ }
183
+ }
184
+ verifyWebhookSignature(payload, signature) {
185
+ if (!this.webhookSecret) return false;
186
+ try {
187
+ this.stripe.webhooks.constructEvent(payload, signature, this.webhookSecret);
188
+ return true;
189
+ } catch {
190
+ return false;
191
+ }
192
+ }
193
+ };
194
+ }
195
+ });
196
+
197
+ // src/plugins/payment/razorpay.ts
198
+ var razorpay_exports = {};
199
+ __export(razorpay_exports, {
200
+ RazorpayPaymentService: () => RazorpayPaymentService
201
+ });
202
+ var import_razorpay, import_crypto, RazorpayPaymentService;
203
+ var init_razorpay = __esm({
204
+ "src/plugins/payment/razorpay.ts"() {
205
+ "use strict";
206
+ import_razorpay = __toESM(require("razorpay"), 1);
207
+ import_crypto = __toESM(require("crypto"), 1);
208
+ RazorpayPaymentService = class {
209
+ razorpay;
210
+ keySecret;
211
+ webhookSecret;
212
+ constructor(config) {
213
+ this.razorpay = new import_razorpay.default({
214
+ key_id: config.keyId,
215
+ key_secret: config.keySecret
216
+ });
217
+ this.keySecret = config.keySecret;
218
+ this.webhookSecret = config.webhookSecret;
219
+ }
220
+ async createPaymentIntent(amount, currency, metadata) {
221
+ const order = await this.razorpay.orders.create({
222
+ amount: Math.round(amount * 100),
223
+ currency: currency.toUpperCase(),
224
+ notes: metadata
225
+ });
226
+ return {
227
+ id: order.id,
228
+ clientSecret: order.id,
229
+ amount,
230
+ currency,
231
+ status: order.status
232
+ };
233
+ }
234
+ async capturePayment(paymentId, amount) {
235
+ try {
236
+ await this.razorpay.payments.capture(paymentId, amount ? Math.round(amount * 100) : 0, "INR");
237
+ return true;
238
+ } catch {
239
+ return false;
240
+ }
241
+ }
242
+ verifyWebhookSignature(payload, signature) {
243
+ const secret = this.webhookSecret || this.keySecret;
244
+ const expectedSignature = import_crypto.default.createHmac("sha256", secret).update(typeof payload === "string" ? payload : payload.toString("utf8")).digest("hex");
245
+ return import_crypto.default.timingSafeEqual(Buffer.from(signature), Buffer.from(expectedSignature));
246
+ }
247
+ };
248
+ }
249
+ });
250
+
143
251
  // src/index.ts
144
252
  var src_exports = {};
145
253
  __export(src_exports, {
254
+ Attribute: () => Attribute,
146
255
  Blog: () => Blog,
256
+ Brand: () => Brand,
147
257
  CMS_ENTITY_MAP: () => CMS_ENTITY_MAP,
148
258
  Category: () => Category,
259
+ Collection: () => Collection,
149
260
  Comment: () => Comment,
150
261
  Config: () => Config,
151
262
  Contact: () => Contact,
@@ -156,12 +267,20 @@ __export(src_exports, {
156
267
  FormSubmission: () => FormSubmission,
157
268
  Media: () => Media,
158
269
  OPEN_ENDPOINTS: () => OPEN_ENDPOINTS,
270
+ Order: () => Order,
271
+ OrderItem: () => OrderItem,
159
272
  PERMISSION_REQUIRED_ENDPOINTS: () => PERMISSION_REQUIRED_ENDPOINTS,
160
273
  Page: () => Page,
161
274
  PasswordResetToken: () => PasswordResetToken,
275
+ Payment: () => Payment,
162
276
  Permission: () => Permission,
277
+ Product: () => Product,
278
+ ProductAttribute: () => ProductAttribute,
279
+ ProductCategory: () => ProductCategory,
280
+ ProductTax: () => ProductTax,
163
281
  Seo: () => Seo,
164
282
  Tag: () => Tag,
283
+ Tax: () => Tax,
165
284
  User: () => User,
166
285
  UserGroup: () => UserGroup,
167
286
  analyticsPlugin: () => analyticsPlugin,
@@ -635,12 +754,39 @@ function smsPlugin(_config = {}) {
635
754
  }
636
755
 
637
756
  // src/plugins/payment/index.ts
638
- function paymentPlugin(_config = {}) {
757
+ function paymentPlugin(config) {
639
758
  return {
640
759
  name: "payment",
641
760
  version: "1.0.0",
642
- async init() {
643
- return null;
761
+ async init(context) {
762
+ if (config.provider === "stripe") {
763
+ const { StripePaymentService: StripePaymentService2 } = await Promise.resolve().then(() => (init_stripe(), stripe_exports));
764
+ const secretKey = config.secretKey || context.config.STRIPE_SECRET_KEY;
765
+ if (!secretKey) {
766
+ context.logger.warn("Payment plugin skipped: Stripe secret key not configured");
767
+ return void 0;
768
+ }
769
+ return new StripePaymentService2({
770
+ secretKey,
771
+ webhookSecret: config.webhookSecret || context.config.STRIPE_WEBHOOK_SECRET
772
+ });
773
+ }
774
+ if (config.provider === "razorpay") {
775
+ const { RazorpayPaymentService: RazorpayPaymentService2 } = await Promise.resolve().then(() => (init_razorpay(), razorpay_exports));
776
+ const keyId = config.keyId || context.config.RAZORPAY_KEY_ID;
777
+ const keySecret = config.keySecret || context.config.RAZORPAY_KEY_SECRET;
778
+ if (!keyId || !keySecret) {
779
+ context.logger.warn("Payment plugin skipped: Razorpay credentials not configured");
780
+ return void 0;
781
+ }
782
+ return new RazorpayPaymentService2({
783
+ keyId,
784
+ keySecret,
785
+ webhookSecret: config.webhookSecret || context.config.RAZORPAY_WEBHOOK_SECRET
786
+ });
787
+ }
788
+ context.logger.warn(`Payment plugin skipped: unknown provider "${config.provider}"`);
789
+ return void 0;
644
790
  }
645
791
  };
646
792
  }
@@ -1006,7 +1152,7 @@ __decorateClass([
1006
1152
  (0, import_typeorm5.PrimaryGeneratedColumn)()
1007
1153
  ], Category.prototype, "id", 2);
1008
1154
  __decorateClass([
1009
- (0, import_typeorm5.Column)("varchar")
1155
+ (0, import_typeorm5.Column)("varchar", { unique: true })
1010
1156
  ], Category.prototype, "name", 2);
1011
1157
  __decorateClass([
1012
1158
  (0, import_typeorm5.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
@@ -1318,7 +1464,7 @@ Blog = __decorateClass([
1318
1464
  ], Blog);
1319
1465
 
1320
1466
  // src/entities/contact.entity.ts
1321
- var import_typeorm13 = require("typeorm");
1467
+ var import_typeorm16 = require("typeorm");
1322
1468
 
1323
1469
  // src/entities/form-submission.entity.ts
1324
1470
  var import_typeorm12 = require("typeorm");
@@ -1527,12 +1673,266 @@ FormSubmission = __decorateClass([
1527
1673
  (0, import_typeorm12.Entity)("form_submissions")
1528
1674
  ], FormSubmission);
1529
1675
 
1676
+ // src/entities/address.entity.ts
1677
+ var import_typeorm13 = require("typeorm");
1678
+ var Address = class {
1679
+ id;
1680
+ contactId;
1681
+ tag;
1682
+ line1;
1683
+ line2;
1684
+ city;
1685
+ state;
1686
+ postalCode;
1687
+ country;
1688
+ createdAt;
1689
+ updatedAt;
1690
+ contact;
1691
+ };
1692
+ __decorateClass([
1693
+ (0, import_typeorm13.PrimaryGeneratedColumn)()
1694
+ ], Address.prototype, "id", 2);
1695
+ __decorateClass([
1696
+ (0, import_typeorm13.Column)("int")
1697
+ ], Address.prototype, "contactId", 2);
1698
+ __decorateClass([
1699
+ (0, import_typeorm13.Column)("varchar", { nullable: true })
1700
+ ], Address.prototype, "tag", 2);
1701
+ __decorateClass([
1702
+ (0, import_typeorm13.Column)("varchar", { nullable: true })
1703
+ ], Address.prototype, "line1", 2);
1704
+ __decorateClass([
1705
+ (0, import_typeorm13.Column)("varchar", { nullable: true })
1706
+ ], Address.prototype, "line2", 2);
1707
+ __decorateClass([
1708
+ (0, import_typeorm13.Column)("varchar", { nullable: true })
1709
+ ], Address.prototype, "city", 2);
1710
+ __decorateClass([
1711
+ (0, import_typeorm13.Column)("varchar", { nullable: true })
1712
+ ], Address.prototype, "state", 2);
1713
+ __decorateClass([
1714
+ (0, import_typeorm13.Column)("varchar", { nullable: true })
1715
+ ], Address.prototype, "postalCode", 2);
1716
+ __decorateClass([
1717
+ (0, import_typeorm13.Column)("varchar", { nullable: true })
1718
+ ], Address.prototype, "country", 2);
1719
+ __decorateClass([
1720
+ (0, import_typeorm13.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
1721
+ ], Address.prototype, "createdAt", 2);
1722
+ __decorateClass([
1723
+ (0, import_typeorm13.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
1724
+ ], Address.prototype, "updatedAt", 2);
1725
+ __decorateClass([
1726
+ (0, import_typeorm13.ManyToOne)(() => Contact, (c) => c.addresses, { onDelete: "CASCADE" }),
1727
+ (0, import_typeorm13.JoinColumn)({ name: "contactId" })
1728
+ ], Address.prototype, "contact", 2);
1729
+ Address = __decorateClass([
1730
+ (0, import_typeorm13.Entity)("addresses")
1731
+ ], Address);
1732
+
1733
+ // src/entities/order.entity.ts
1734
+ var import_typeorm14 = require("typeorm");
1735
+ var Order = class {
1736
+ id;
1737
+ orderNumber;
1738
+ contactId;
1739
+ billingAddressId;
1740
+ shippingAddressId;
1741
+ status;
1742
+ subtotal;
1743
+ tax;
1744
+ discount;
1745
+ total;
1746
+ currency;
1747
+ metadata;
1748
+ createdAt;
1749
+ updatedAt;
1750
+ deletedAt;
1751
+ deleted;
1752
+ createdBy;
1753
+ updatedBy;
1754
+ deletedBy;
1755
+ contact;
1756
+ billingAddress;
1757
+ shippingAddress;
1758
+ items;
1759
+ payments;
1760
+ };
1761
+ __decorateClass([
1762
+ (0, import_typeorm14.PrimaryGeneratedColumn)()
1763
+ ], Order.prototype, "id", 2);
1764
+ __decorateClass([
1765
+ (0, import_typeorm14.Column)("varchar", { unique: true })
1766
+ ], Order.prototype, "orderNumber", 2);
1767
+ __decorateClass([
1768
+ (0, import_typeorm14.Column)("int")
1769
+ ], Order.prototype, "contactId", 2);
1770
+ __decorateClass([
1771
+ (0, import_typeorm14.Column)("int", { nullable: true })
1772
+ ], Order.prototype, "billingAddressId", 2);
1773
+ __decorateClass([
1774
+ (0, import_typeorm14.Column)("int", { nullable: true })
1775
+ ], Order.prototype, "shippingAddressId", 2);
1776
+ __decorateClass([
1777
+ (0, import_typeorm14.Column)("varchar", { default: "pending" })
1778
+ ], Order.prototype, "status", 2);
1779
+ __decorateClass([
1780
+ (0, import_typeorm14.Column)("decimal", { precision: 12, scale: 2, default: 0 })
1781
+ ], Order.prototype, "subtotal", 2);
1782
+ __decorateClass([
1783
+ (0, import_typeorm14.Column)("decimal", { precision: 12, scale: 2, default: 0 })
1784
+ ], Order.prototype, "tax", 2);
1785
+ __decorateClass([
1786
+ (0, import_typeorm14.Column)("decimal", { precision: 12, scale: 2, default: 0 })
1787
+ ], Order.prototype, "discount", 2);
1788
+ __decorateClass([
1789
+ (0, import_typeorm14.Column)("decimal", { precision: 12, scale: 2, default: 0 })
1790
+ ], Order.prototype, "total", 2);
1791
+ __decorateClass([
1792
+ (0, import_typeorm14.Column)("varchar", { default: "INR" })
1793
+ ], Order.prototype, "currency", 2);
1794
+ __decorateClass([
1795
+ (0, import_typeorm14.Column)("jsonb", { nullable: true })
1796
+ ], Order.prototype, "metadata", 2);
1797
+ __decorateClass([
1798
+ (0, import_typeorm14.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
1799
+ ], Order.prototype, "createdAt", 2);
1800
+ __decorateClass([
1801
+ (0, import_typeorm14.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
1802
+ ], Order.prototype, "updatedAt", 2);
1803
+ __decorateClass([
1804
+ (0, import_typeorm14.Column)({ type: "timestamp", nullable: true })
1805
+ ], Order.prototype, "deletedAt", 2);
1806
+ __decorateClass([
1807
+ (0, import_typeorm14.Column)("boolean", { default: false })
1808
+ ], Order.prototype, "deleted", 2);
1809
+ __decorateClass([
1810
+ (0, import_typeorm14.Column)("int", { nullable: true })
1811
+ ], Order.prototype, "createdBy", 2);
1812
+ __decorateClass([
1813
+ (0, import_typeorm14.Column)("int", { nullable: true })
1814
+ ], Order.prototype, "updatedBy", 2);
1815
+ __decorateClass([
1816
+ (0, import_typeorm14.Column)("int", { nullable: true })
1817
+ ], Order.prototype, "deletedBy", 2);
1818
+ __decorateClass([
1819
+ (0, import_typeorm14.ManyToOne)(() => Contact, { onDelete: "CASCADE" }),
1820
+ (0, import_typeorm14.JoinColumn)({ name: "contactId" })
1821
+ ], Order.prototype, "contact", 2);
1822
+ __decorateClass([
1823
+ (0, import_typeorm14.ManyToOne)(() => Address, { onDelete: "SET NULL" }),
1824
+ (0, import_typeorm14.JoinColumn)({ name: "billingAddressId" })
1825
+ ], Order.prototype, "billingAddress", 2);
1826
+ __decorateClass([
1827
+ (0, import_typeorm14.ManyToOne)(() => Address, { onDelete: "SET NULL" }),
1828
+ (0, import_typeorm14.JoinColumn)({ name: "shippingAddressId" })
1829
+ ], Order.prototype, "shippingAddress", 2);
1830
+ __decorateClass([
1831
+ (0, import_typeorm14.OneToMany)("OrderItem", "order")
1832
+ ], Order.prototype, "items", 2);
1833
+ __decorateClass([
1834
+ (0, import_typeorm14.OneToMany)("Payment", "order")
1835
+ ], Order.prototype, "payments", 2);
1836
+ Order = __decorateClass([
1837
+ (0, import_typeorm14.Entity)("orders")
1838
+ ], Order);
1839
+
1840
+ // src/entities/payment.entity.ts
1841
+ var import_typeorm15 = require("typeorm");
1842
+ var Payment = class {
1843
+ id;
1844
+ orderId;
1845
+ contactId;
1846
+ amount;
1847
+ currency;
1848
+ status;
1849
+ method;
1850
+ externalReference;
1851
+ metadata;
1852
+ paidAt;
1853
+ createdAt;
1854
+ updatedAt;
1855
+ deletedAt;
1856
+ deleted;
1857
+ createdBy;
1858
+ updatedBy;
1859
+ deletedBy;
1860
+ order;
1861
+ contact;
1862
+ };
1863
+ __decorateClass([
1864
+ (0, import_typeorm15.PrimaryGeneratedColumn)()
1865
+ ], Payment.prototype, "id", 2);
1866
+ __decorateClass([
1867
+ (0, import_typeorm15.Column)("int")
1868
+ ], Payment.prototype, "orderId", 2);
1869
+ __decorateClass([
1870
+ (0, import_typeorm15.Column)("int", { nullable: true })
1871
+ ], Payment.prototype, "contactId", 2);
1872
+ __decorateClass([
1873
+ (0, import_typeorm15.Column)("decimal", { precision: 12, scale: 2 })
1874
+ ], Payment.prototype, "amount", 2);
1875
+ __decorateClass([
1876
+ (0, import_typeorm15.Column)("varchar", { default: "INR" })
1877
+ ], Payment.prototype, "currency", 2);
1878
+ __decorateClass([
1879
+ (0, import_typeorm15.Column)("varchar", { default: "pending" })
1880
+ ], Payment.prototype, "status", 2);
1881
+ __decorateClass([
1882
+ (0, import_typeorm15.Column)("varchar", { nullable: true })
1883
+ ], Payment.prototype, "method", 2);
1884
+ __decorateClass([
1885
+ (0, import_typeorm15.Column)("varchar", { nullable: true })
1886
+ ], Payment.prototype, "externalReference", 2);
1887
+ __decorateClass([
1888
+ (0, import_typeorm15.Column)("jsonb", { nullable: true })
1889
+ ], Payment.prototype, "metadata", 2);
1890
+ __decorateClass([
1891
+ (0, import_typeorm15.Column)({ type: "timestamp", nullable: true })
1892
+ ], Payment.prototype, "paidAt", 2);
1893
+ __decorateClass([
1894
+ (0, import_typeorm15.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
1895
+ ], Payment.prototype, "createdAt", 2);
1896
+ __decorateClass([
1897
+ (0, import_typeorm15.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
1898
+ ], Payment.prototype, "updatedAt", 2);
1899
+ __decorateClass([
1900
+ (0, import_typeorm15.Column)({ type: "timestamp", nullable: true })
1901
+ ], Payment.prototype, "deletedAt", 2);
1902
+ __decorateClass([
1903
+ (0, import_typeorm15.Column)("boolean", { default: false })
1904
+ ], Payment.prototype, "deleted", 2);
1905
+ __decorateClass([
1906
+ (0, import_typeorm15.Column)("int", { nullable: true })
1907
+ ], Payment.prototype, "createdBy", 2);
1908
+ __decorateClass([
1909
+ (0, import_typeorm15.Column)("int", { nullable: true })
1910
+ ], Payment.prototype, "updatedBy", 2);
1911
+ __decorateClass([
1912
+ (0, import_typeorm15.Column)("int", { nullable: true })
1913
+ ], Payment.prototype, "deletedBy", 2);
1914
+ __decorateClass([
1915
+ (0, import_typeorm15.ManyToOne)(() => Order, (o) => o.payments, { onDelete: "CASCADE" }),
1916
+ (0, import_typeorm15.JoinColumn)({ name: "orderId" })
1917
+ ], Payment.prototype, "order", 2);
1918
+ __decorateClass([
1919
+ (0, import_typeorm15.ManyToOne)(() => Contact, { onDelete: "SET NULL" }),
1920
+ (0, import_typeorm15.JoinColumn)({ name: "contactId" })
1921
+ ], Payment.prototype, "contact", 2);
1922
+ Payment = __decorateClass([
1923
+ (0, import_typeorm15.Entity)("payments")
1924
+ ], Payment);
1925
+
1530
1926
  // src/entities/contact.entity.ts
1531
1927
  var Contact = class {
1532
1928
  id;
1533
1929
  name;
1534
1930
  email;
1535
1931
  phone;
1932
+ type;
1933
+ company;
1934
+ taxId;
1935
+ notes;
1536
1936
  createdAt;
1537
1937
  updatedAt;
1538
1938
  deletedAt;
@@ -1541,49 +1941,73 @@ var Contact = class {
1541
1941
  updatedBy;
1542
1942
  deletedBy;
1543
1943
  form_submissions;
1944
+ addresses;
1945
+ orders;
1946
+ payments;
1544
1947
  };
1545
1948
  __decorateClass([
1546
- (0, import_typeorm13.PrimaryGeneratedColumn)()
1949
+ (0, import_typeorm16.PrimaryGeneratedColumn)()
1547
1950
  ], Contact.prototype, "id", 2);
1548
1951
  __decorateClass([
1549
- (0, import_typeorm13.Column)("varchar")
1952
+ (0, import_typeorm16.Column)("varchar")
1550
1953
  ], Contact.prototype, "name", 2);
1551
1954
  __decorateClass([
1552
- (0, import_typeorm13.Column)("varchar", { unique: true })
1955
+ (0, import_typeorm16.Column)("varchar", { unique: true })
1553
1956
  ], Contact.prototype, "email", 2);
1554
1957
  __decorateClass([
1555
- (0, import_typeorm13.Column)("varchar", { nullable: true })
1958
+ (0, import_typeorm16.Column)("varchar", { nullable: true })
1556
1959
  ], Contact.prototype, "phone", 2);
1557
1960
  __decorateClass([
1558
- (0, import_typeorm13.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
1961
+ (0, import_typeorm16.Column)("varchar", { nullable: true })
1962
+ ], Contact.prototype, "type", 2);
1963
+ __decorateClass([
1964
+ (0, import_typeorm16.Column)("varchar", { nullable: true })
1965
+ ], Contact.prototype, "company", 2);
1966
+ __decorateClass([
1967
+ (0, import_typeorm16.Column)("varchar", { nullable: true })
1968
+ ], Contact.prototype, "taxId", 2);
1969
+ __decorateClass([
1970
+ (0, import_typeorm16.Column)("text", { nullable: true })
1971
+ ], Contact.prototype, "notes", 2);
1972
+ __decorateClass([
1973
+ (0, import_typeorm16.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
1559
1974
  ], Contact.prototype, "createdAt", 2);
1560
1975
  __decorateClass([
1561
- (0, import_typeorm13.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
1976
+ (0, import_typeorm16.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
1562
1977
  ], Contact.prototype, "updatedAt", 2);
1563
1978
  __decorateClass([
1564
- (0, import_typeorm13.Column)({ type: "timestamp", nullable: true })
1979
+ (0, import_typeorm16.Column)({ type: "timestamp", nullable: true })
1565
1980
  ], Contact.prototype, "deletedAt", 2);
1566
1981
  __decorateClass([
1567
- (0, import_typeorm13.Column)("boolean", { default: false })
1982
+ (0, import_typeorm16.Column)("boolean", { default: false })
1568
1983
  ], Contact.prototype, "deleted", 2);
1569
1984
  __decorateClass([
1570
- (0, import_typeorm13.Column)("int", { nullable: true })
1985
+ (0, import_typeorm16.Column)("int", { nullable: true })
1571
1986
  ], Contact.prototype, "createdBy", 2);
1572
1987
  __decorateClass([
1573
- (0, import_typeorm13.Column)("int", { nullable: true })
1988
+ (0, import_typeorm16.Column)("int", { nullable: true })
1574
1989
  ], Contact.prototype, "updatedBy", 2);
1575
1990
  __decorateClass([
1576
- (0, import_typeorm13.Column)("int", { nullable: true })
1991
+ (0, import_typeorm16.Column)("int", { nullable: true })
1577
1992
  ], Contact.prototype, "deletedBy", 2);
1578
1993
  __decorateClass([
1579
- (0, import_typeorm13.OneToMany)(() => FormSubmission, (fs) => fs.contact)
1994
+ (0, import_typeorm16.OneToMany)(() => FormSubmission, (fs) => fs.contact)
1580
1995
  ], Contact.prototype, "form_submissions", 2);
1996
+ __decorateClass([
1997
+ (0, import_typeorm16.OneToMany)(() => Address, (a) => a.contact)
1998
+ ], Contact.prototype, "addresses", 2);
1999
+ __decorateClass([
2000
+ (0, import_typeorm16.OneToMany)(() => Order, (o) => o.contact)
2001
+ ], Contact.prototype, "orders", 2);
2002
+ __decorateClass([
2003
+ (0, import_typeorm16.OneToMany)(() => Payment, (p) => p.contact)
2004
+ ], Contact.prototype, "payments", 2);
1581
2005
  Contact = __decorateClass([
1582
- (0, import_typeorm13.Entity)("contacts")
2006
+ (0, import_typeorm16.Entity)("contacts")
1583
2007
  ], Contact);
1584
2008
 
1585
2009
  // src/entities/config.entity.ts
1586
- var import_typeorm14 = require("typeorm");
2010
+ var import_typeorm17 = require("typeorm");
1587
2011
  var Config = class {
1588
2012
  id;
1589
2013
  settings;
@@ -1600,51 +2024,51 @@ var Config = class {
1600
2024
  deletedBy;
1601
2025
  };
1602
2026
  __decorateClass([
1603
- (0, import_typeorm14.PrimaryGeneratedColumn)()
2027
+ (0, import_typeorm17.PrimaryGeneratedColumn)()
1604
2028
  ], Config.prototype, "id", 2);
1605
2029
  __decorateClass([
1606
- (0, import_typeorm14.Column)("varchar")
2030
+ (0, import_typeorm17.Column)("varchar")
1607
2031
  ], Config.prototype, "settings", 2);
1608
2032
  __decorateClass([
1609
- (0, import_typeorm14.Column)("varchar")
2033
+ (0, import_typeorm17.Column)("varchar")
1610
2034
  ], Config.prototype, "key", 2);
1611
2035
  __decorateClass([
1612
- (0, import_typeorm14.Column)("varchar")
2036
+ (0, import_typeorm17.Column)("varchar")
1613
2037
  ], Config.prototype, "value", 2);
1614
2038
  __decorateClass([
1615
- (0, import_typeorm14.Column)("varchar", { default: "private" })
2039
+ (0, import_typeorm17.Column)("varchar", { default: "private" })
1616
2040
  ], Config.prototype, "type", 2);
1617
2041
  __decorateClass([
1618
- (0, import_typeorm14.Column)("boolean", { default: false })
2042
+ (0, import_typeorm17.Column)("boolean", { default: false })
1619
2043
  ], Config.prototype, "encrypted", 2);
1620
2044
  __decorateClass([
1621
- (0, import_typeorm14.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
2045
+ (0, import_typeorm17.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
1622
2046
  ], Config.prototype, "createdAt", 2);
1623
2047
  __decorateClass([
1624
- (0, import_typeorm14.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
2048
+ (0, import_typeorm17.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
1625
2049
  ], Config.prototype, "updatedAt", 2);
1626
2050
  __decorateClass([
1627
- (0, import_typeorm14.Column)({ type: "timestamp", nullable: true })
2051
+ (0, import_typeorm17.Column)({ type: "timestamp", nullable: true })
1628
2052
  ], Config.prototype, "deletedAt", 2);
1629
2053
  __decorateClass([
1630
- (0, import_typeorm14.Column)("boolean", { default: false })
2054
+ (0, import_typeorm17.Column)("boolean", { default: false })
1631
2055
  ], Config.prototype, "deleted", 2);
1632
2056
  __decorateClass([
1633
- (0, import_typeorm14.Column)("int", { nullable: true })
2057
+ (0, import_typeorm17.Column)("int", { nullable: true })
1634
2058
  ], Config.prototype, "createdBy", 2);
1635
2059
  __decorateClass([
1636
- (0, import_typeorm14.Column)("int", { nullable: true })
2060
+ (0, import_typeorm17.Column)("int", { nullable: true })
1637
2061
  ], Config.prototype, "updatedBy", 2);
1638
2062
  __decorateClass([
1639
- (0, import_typeorm14.Column)("int", { nullable: true })
2063
+ (0, import_typeorm17.Column)("int", { nullable: true })
1640
2064
  ], Config.prototype, "deletedBy", 2);
1641
2065
  Config = __decorateClass([
1642
- (0, import_typeorm14.Entity)("configs"),
1643
- (0, import_typeorm14.Unique)(["settings", "key"])
2066
+ (0, import_typeorm17.Entity)("configs"),
2067
+ (0, import_typeorm17.Unique)(["settings", "key"])
1644
2068
  ], Config);
1645
2069
 
1646
2070
  // src/entities/media.entity.ts
1647
- var import_typeorm15 = require("typeorm");
2071
+ var import_typeorm18 = require("typeorm");
1648
2072
  var Media = class {
1649
2073
  id;
1650
2074
  filename;
@@ -1659,44 +2083,44 @@ var Media = class {
1659
2083
  deleted;
1660
2084
  };
1661
2085
  __decorateClass([
1662
- (0, import_typeorm15.PrimaryGeneratedColumn)()
2086
+ (0, import_typeorm18.PrimaryGeneratedColumn)()
1663
2087
  ], Media.prototype, "id", 2);
1664
2088
  __decorateClass([
1665
- (0, import_typeorm15.Column)("varchar")
2089
+ (0, import_typeorm18.Column)("varchar")
1666
2090
  ], Media.prototype, "filename", 2);
1667
2091
  __decorateClass([
1668
- (0, import_typeorm15.Column)("varchar")
2092
+ (0, import_typeorm18.Column)("varchar")
1669
2093
  ], Media.prototype, "url", 2);
1670
2094
  __decorateClass([
1671
- (0, import_typeorm15.Column)("varchar")
2095
+ (0, import_typeorm18.Column)("varchar")
1672
2096
  ], Media.prototype, "mimeType", 2);
1673
2097
  __decorateClass([
1674
- (0, import_typeorm15.Column)("int", { default: 0 })
2098
+ (0, import_typeorm18.Column)("int", { default: 0 })
1675
2099
  ], Media.prototype, "size", 2);
1676
2100
  __decorateClass([
1677
- (0, import_typeorm15.Column)("varchar", { nullable: true })
2101
+ (0, import_typeorm18.Column)("varchar", { nullable: true })
1678
2102
  ], Media.prototype, "alt", 2);
1679
2103
  __decorateClass([
1680
- (0, import_typeorm15.Column)("boolean", { default: false })
2104
+ (0, import_typeorm18.Column)("boolean", { default: false })
1681
2105
  ], Media.prototype, "isPublic", 2);
1682
2106
  __decorateClass([
1683
- (0, import_typeorm15.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
2107
+ (0, import_typeorm18.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
1684
2108
  ], Media.prototype, "createdAt", 2);
1685
2109
  __decorateClass([
1686
- (0, import_typeorm15.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
2110
+ (0, import_typeorm18.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
1687
2111
  ], Media.prototype, "updatedAt", 2);
1688
2112
  __decorateClass([
1689
- (0, import_typeorm15.Column)({ type: "timestamp", nullable: true })
2113
+ (0, import_typeorm18.Column)({ type: "timestamp", nullable: true })
1690
2114
  ], Media.prototype, "deletedAt", 2);
1691
2115
  __decorateClass([
1692
- (0, import_typeorm15.Column)("boolean", { default: false })
2116
+ (0, import_typeorm18.Column)("boolean", { default: false })
1693
2117
  ], Media.prototype, "deleted", 2);
1694
2118
  Media = __decorateClass([
1695
- (0, import_typeorm15.Entity)("media")
2119
+ (0, import_typeorm18.Entity)("media")
1696
2120
  ], Media);
1697
2121
 
1698
2122
  // src/entities/page.entity.ts
1699
- var import_typeorm16 = require("typeorm");
2123
+ var import_typeorm19 = require("typeorm");
1700
2124
  var Page = class {
1701
2125
  id;
1702
2126
  title;
@@ -1717,86 +2141,775 @@ var Page = class {
1717
2141
  deletedBy;
1718
2142
  };
1719
2143
  __decorateClass([
1720
- (0, import_typeorm16.PrimaryGeneratedColumn)()
2144
+ (0, import_typeorm19.PrimaryGeneratedColumn)()
1721
2145
  ], Page.prototype, "id", 2);
1722
2146
  __decorateClass([
1723
- (0, import_typeorm16.Column)("varchar")
2147
+ (0, import_typeorm19.Column)("varchar")
1724
2148
  ], Page.prototype, "title", 2);
1725
2149
  __decorateClass([
1726
- (0, import_typeorm16.Column)("varchar", { unique: true })
2150
+ (0, import_typeorm19.Column)("varchar", { unique: true })
1727
2151
  ], Page.prototype, "slug", 2);
1728
2152
  __decorateClass([
1729
- (0, import_typeorm16.Column)({ type: "jsonb", default: {} })
2153
+ (0, import_typeorm19.Column)({ type: "jsonb", default: {} })
1730
2154
  ], Page.prototype, "content", 2);
1731
2155
  __decorateClass([
1732
- (0, import_typeorm16.Column)("boolean", { default: false })
2156
+ (0, import_typeorm19.Column)("boolean", { default: false })
1733
2157
  ], Page.prototype, "published", 2);
1734
2158
  __decorateClass([
1735
- (0, import_typeorm16.Column)("varchar", { default: "default" })
2159
+ (0, import_typeorm19.Column)("varchar", { default: "default" })
1736
2160
  ], Page.prototype, "theme", 2);
1737
2161
  __decorateClass([
1738
- (0, import_typeorm16.Column)("int", { nullable: true })
2162
+ (0, import_typeorm19.Column)("int", { nullable: true })
1739
2163
  ], Page.prototype, "parentId", 2);
1740
2164
  __decorateClass([
1741
- (0, import_typeorm16.ManyToOne)(() => Page, { onDelete: "SET NULL" }),
1742
- (0, import_typeorm16.JoinColumn)({ name: "parentId" })
2165
+ (0, import_typeorm19.ManyToOne)(() => Page, { onDelete: "SET NULL" }),
2166
+ (0, import_typeorm19.JoinColumn)({ name: "parentId" })
1743
2167
  ], Page.prototype, "parent", 2);
1744
2168
  __decorateClass([
1745
- (0, import_typeorm16.Column)("int", { nullable: true })
2169
+ (0, import_typeorm19.Column)("int", { nullable: true })
1746
2170
  ], Page.prototype, "seoId", 2);
1747
2171
  __decorateClass([
1748
- (0, import_typeorm16.ManyToOne)(() => Seo, { onDelete: "SET NULL" }),
1749
- (0, import_typeorm16.JoinColumn)({ name: "seoId" })
2172
+ (0, import_typeorm19.ManyToOne)(() => Seo, { onDelete: "SET NULL" }),
2173
+ (0, import_typeorm19.JoinColumn)({ name: "seoId" })
1750
2174
  ], Page.prototype, "seo", 2);
1751
2175
  __decorateClass([
1752
- (0, import_typeorm16.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
2176
+ (0, import_typeorm19.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
1753
2177
  ], Page.prototype, "createdAt", 2);
1754
2178
  __decorateClass([
1755
- (0, import_typeorm16.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
2179
+ (0, import_typeorm19.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
1756
2180
  ], Page.prototype, "updatedAt", 2);
1757
2181
  __decorateClass([
1758
- (0, import_typeorm16.Column)({ type: "timestamp", nullable: true })
2182
+ (0, import_typeorm19.Column)({ type: "timestamp", nullable: true })
1759
2183
  ], Page.prototype, "deletedAt", 2);
1760
2184
  __decorateClass([
1761
- (0, import_typeorm16.Column)("boolean", { default: false })
2185
+ (0, import_typeorm19.Column)("boolean", { default: false })
1762
2186
  ], Page.prototype, "deleted", 2);
1763
2187
  __decorateClass([
1764
- (0, import_typeorm16.Column)("int", { nullable: true })
2188
+ (0, import_typeorm19.Column)("int", { nullable: true })
1765
2189
  ], Page.prototype, "createdBy", 2);
1766
2190
  __decorateClass([
1767
- (0, import_typeorm16.Column)("int", { nullable: true })
2191
+ (0, import_typeorm19.Column)("int", { nullable: true })
1768
2192
  ], Page.prototype, "updatedBy", 2);
1769
2193
  __decorateClass([
1770
- (0, import_typeorm16.Column)("int", { nullable: true })
2194
+ (0, import_typeorm19.Column)("int", { nullable: true })
1771
2195
  ], Page.prototype, "deletedBy", 2);
1772
2196
  Page = __decorateClass([
1773
- (0, import_typeorm16.Entity)("pages")
2197
+ (0, import_typeorm19.Entity)("pages")
1774
2198
  ], Page);
1775
2199
 
1776
- // src/entities/index.ts
1777
- var CMS_ENTITY_MAP = {
1778
- users: User,
1779
- password_reset_tokens: PasswordResetToken,
1780
- user_groups: UserGroup,
1781
- permissions: Permission,
1782
- blogs: Blog,
1783
- tags: Tag,
1784
- categories: Category,
1785
- comments: Comment,
1786
- contacts: Contact,
1787
- forms: Form,
1788
- form_fields: FormField,
1789
- form_submissions: FormSubmission,
1790
- seos: Seo,
1791
- configs: Config,
1792
- media: Media,
1793
- pages: Page
2200
+ // src/entities/product-category.entity.ts
2201
+ var import_typeorm20 = require("typeorm");
2202
+ var ProductCategory = class {
2203
+ id;
2204
+ name;
2205
+ slug;
2206
+ parentId;
2207
+ image;
2208
+ description;
2209
+ metadata;
2210
+ active;
2211
+ sortOrder;
2212
+ createdAt;
2213
+ updatedAt;
2214
+ deletedAt;
2215
+ deleted;
2216
+ createdBy;
2217
+ updatedBy;
2218
+ deletedBy;
2219
+ parent;
2220
+ children;
2221
+ products;
2222
+ collections;
1794
2223
  };
1795
-
1796
- // src/auth/helpers.ts
1797
- var OPEN_ENDPOINTS = [
1798
- { "/api/contacts": ["POST"] },
1799
- { "/api/form-submissions": ["POST"] },
2224
+ __decorateClass([
2225
+ (0, import_typeorm20.PrimaryGeneratedColumn)()
2226
+ ], ProductCategory.prototype, "id", 2);
2227
+ __decorateClass([
2228
+ (0, import_typeorm20.Column)("varchar")
2229
+ ], ProductCategory.prototype, "name", 2);
2230
+ __decorateClass([
2231
+ (0, import_typeorm20.Column)("varchar", { unique: true })
2232
+ ], ProductCategory.prototype, "slug", 2);
2233
+ __decorateClass([
2234
+ (0, import_typeorm20.Column)("int", { nullable: true })
2235
+ ], ProductCategory.prototype, "parentId", 2);
2236
+ __decorateClass([
2237
+ (0, import_typeorm20.Column)("varchar", { nullable: true })
2238
+ ], ProductCategory.prototype, "image", 2);
2239
+ __decorateClass([
2240
+ (0, import_typeorm20.Column)("text", { nullable: true })
2241
+ ], ProductCategory.prototype, "description", 2);
2242
+ __decorateClass([
2243
+ (0, import_typeorm20.Column)("jsonb", { nullable: true })
2244
+ ], ProductCategory.prototype, "metadata", 2);
2245
+ __decorateClass([
2246
+ (0, import_typeorm20.Column)("boolean", { default: true })
2247
+ ], ProductCategory.prototype, "active", 2);
2248
+ __decorateClass([
2249
+ (0, import_typeorm20.Column)("int", { default: 0 })
2250
+ ], ProductCategory.prototype, "sortOrder", 2);
2251
+ __decorateClass([
2252
+ (0, import_typeorm20.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
2253
+ ], ProductCategory.prototype, "createdAt", 2);
2254
+ __decorateClass([
2255
+ (0, import_typeorm20.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
2256
+ ], ProductCategory.prototype, "updatedAt", 2);
2257
+ __decorateClass([
2258
+ (0, import_typeorm20.Column)({ type: "timestamp", nullable: true })
2259
+ ], ProductCategory.prototype, "deletedAt", 2);
2260
+ __decorateClass([
2261
+ (0, import_typeorm20.Column)("boolean", { default: false })
2262
+ ], ProductCategory.prototype, "deleted", 2);
2263
+ __decorateClass([
2264
+ (0, import_typeorm20.Column)("int", { nullable: true })
2265
+ ], ProductCategory.prototype, "createdBy", 2);
2266
+ __decorateClass([
2267
+ (0, import_typeorm20.Column)("int", { nullable: true })
2268
+ ], ProductCategory.prototype, "updatedBy", 2);
2269
+ __decorateClass([
2270
+ (0, import_typeorm20.Column)("int", { nullable: true })
2271
+ ], ProductCategory.prototype, "deletedBy", 2);
2272
+ __decorateClass([
2273
+ (0, import_typeorm20.ManyToOne)(() => ProductCategory, (c) => c.children, { onDelete: "SET NULL" }),
2274
+ (0, import_typeorm20.JoinColumn)({ name: "parentId" })
2275
+ ], ProductCategory.prototype, "parent", 2);
2276
+ __decorateClass([
2277
+ (0, import_typeorm20.OneToMany)(() => ProductCategory, (c) => c.parent)
2278
+ ], ProductCategory.prototype, "children", 2);
2279
+ __decorateClass([
2280
+ (0, import_typeorm20.OneToMany)("Product", "category")
2281
+ ], ProductCategory.prototype, "products", 2);
2282
+ __decorateClass([
2283
+ (0, import_typeorm20.OneToMany)("Collection", "category")
2284
+ ], ProductCategory.prototype, "collections", 2);
2285
+ ProductCategory = __decorateClass([
2286
+ (0, import_typeorm20.Entity)("product_categories")
2287
+ ], ProductCategory);
2288
+
2289
+ // src/entities/collection.entity.ts
2290
+ var import_typeorm22 = require("typeorm");
2291
+
2292
+ // src/entities/brand.entity.ts
2293
+ var import_typeorm21 = require("typeorm");
2294
+ var Brand = class {
2295
+ id;
2296
+ name;
2297
+ slug;
2298
+ logo;
2299
+ metadata;
2300
+ description;
2301
+ active;
2302
+ sortOrder;
2303
+ createdAt;
2304
+ updatedAt;
2305
+ deletedAt;
2306
+ deleted;
2307
+ createdBy;
2308
+ updatedBy;
2309
+ deletedBy;
2310
+ seoId;
2311
+ seo;
2312
+ products;
2313
+ collections;
2314
+ };
2315
+ __decorateClass([
2316
+ (0, import_typeorm21.PrimaryGeneratedColumn)()
2317
+ ], Brand.prototype, "id", 2);
2318
+ __decorateClass([
2319
+ (0, import_typeorm21.Column)("varchar")
2320
+ ], Brand.prototype, "name", 2);
2321
+ __decorateClass([
2322
+ (0, import_typeorm21.Column)("varchar", { unique: true })
2323
+ ], Brand.prototype, "slug", 2);
2324
+ __decorateClass([
2325
+ (0, import_typeorm21.Column)("varchar", { nullable: true })
2326
+ ], Brand.prototype, "logo", 2);
2327
+ __decorateClass([
2328
+ (0, import_typeorm21.Column)("jsonb", { nullable: true })
2329
+ ], Brand.prototype, "metadata", 2);
2330
+ __decorateClass([
2331
+ (0, import_typeorm21.Column)("text", { nullable: true })
2332
+ ], Brand.prototype, "description", 2);
2333
+ __decorateClass([
2334
+ (0, import_typeorm21.Column)("boolean", { default: true })
2335
+ ], Brand.prototype, "active", 2);
2336
+ __decorateClass([
2337
+ (0, import_typeorm21.Column)("int", { default: 0 })
2338
+ ], Brand.prototype, "sortOrder", 2);
2339
+ __decorateClass([
2340
+ (0, import_typeorm21.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
2341
+ ], Brand.prototype, "createdAt", 2);
2342
+ __decorateClass([
2343
+ (0, import_typeorm21.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
2344
+ ], Brand.prototype, "updatedAt", 2);
2345
+ __decorateClass([
2346
+ (0, import_typeorm21.Column)({ type: "timestamp", nullable: true })
2347
+ ], Brand.prototype, "deletedAt", 2);
2348
+ __decorateClass([
2349
+ (0, import_typeorm21.Column)("boolean", { default: false })
2350
+ ], Brand.prototype, "deleted", 2);
2351
+ __decorateClass([
2352
+ (0, import_typeorm21.Column)("int", { nullable: true })
2353
+ ], Brand.prototype, "createdBy", 2);
2354
+ __decorateClass([
2355
+ (0, import_typeorm21.Column)("int", { nullable: true })
2356
+ ], Brand.prototype, "updatedBy", 2);
2357
+ __decorateClass([
2358
+ (0, import_typeorm21.Column)("int", { nullable: true })
2359
+ ], Brand.prototype, "deletedBy", 2);
2360
+ __decorateClass([
2361
+ (0, import_typeorm21.Column)("int", { nullable: true })
2362
+ ], Brand.prototype, "seoId", 2);
2363
+ __decorateClass([
2364
+ (0, import_typeorm21.ManyToOne)(() => Seo, { onDelete: "SET NULL" }),
2365
+ (0, import_typeorm21.JoinColumn)({ name: "seoId" })
2366
+ ], Brand.prototype, "seo", 2);
2367
+ __decorateClass([
2368
+ (0, import_typeorm21.OneToMany)("Product", "brand")
2369
+ ], Brand.prototype, "products", 2);
2370
+ __decorateClass([
2371
+ (0, import_typeorm21.OneToMany)("Collection", "brand")
2372
+ ], Brand.prototype, "collections", 2);
2373
+ Brand = __decorateClass([
2374
+ (0, import_typeorm21.Entity)("brands")
2375
+ ], Brand);
2376
+
2377
+ // src/entities/collection.entity.ts
2378
+ var Collection = class {
2379
+ id;
2380
+ categoryId;
2381
+ brandId;
2382
+ name;
2383
+ slug;
2384
+ description;
2385
+ image;
2386
+ metadata;
2387
+ active;
2388
+ sortOrder;
2389
+ createdAt;
2390
+ updatedAt;
2391
+ deletedAt;
2392
+ deleted;
2393
+ createdBy;
2394
+ updatedBy;
2395
+ deletedBy;
2396
+ seoId;
2397
+ seo;
2398
+ category;
2399
+ brand;
2400
+ products;
2401
+ };
2402
+ __decorateClass([
2403
+ (0, import_typeorm22.PrimaryGeneratedColumn)()
2404
+ ], Collection.prototype, "id", 2);
2405
+ __decorateClass([
2406
+ (0, import_typeorm22.Column)("int", { nullable: true })
2407
+ ], Collection.prototype, "categoryId", 2);
2408
+ __decorateClass([
2409
+ (0, import_typeorm22.Column)("int", { nullable: true })
2410
+ ], Collection.prototype, "brandId", 2);
2411
+ __decorateClass([
2412
+ (0, import_typeorm22.Column)("varchar")
2413
+ ], Collection.prototype, "name", 2);
2414
+ __decorateClass([
2415
+ (0, import_typeorm22.Column)("varchar", { unique: true })
2416
+ ], Collection.prototype, "slug", 2);
2417
+ __decorateClass([
2418
+ (0, import_typeorm22.Column)("text", { nullable: true })
2419
+ ], Collection.prototype, "description", 2);
2420
+ __decorateClass([
2421
+ (0, import_typeorm22.Column)("varchar", { nullable: true })
2422
+ ], Collection.prototype, "image", 2);
2423
+ __decorateClass([
2424
+ (0, import_typeorm22.Column)("jsonb", { nullable: true })
2425
+ ], Collection.prototype, "metadata", 2);
2426
+ __decorateClass([
2427
+ (0, import_typeorm22.Column)("boolean", { default: true })
2428
+ ], Collection.prototype, "active", 2);
2429
+ __decorateClass([
2430
+ (0, import_typeorm22.Column)("int", { default: 0 })
2431
+ ], Collection.prototype, "sortOrder", 2);
2432
+ __decorateClass([
2433
+ (0, import_typeorm22.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
2434
+ ], Collection.prototype, "createdAt", 2);
2435
+ __decorateClass([
2436
+ (0, import_typeorm22.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
2437
+ ], Collection.prototype, "updatedAt", 2);
2438
+ __decorateClass([
2439
+ (0, import_typeorm22.Column)({ type: "timestamp", nullable: true })
2440
+ ], Collection.prototype, "deletedAt", 2);
2441
+ __decorateClass([
2442
+ (0, import_typeorm22.Column)("boolean", { default: false })
2443
+ ], Collection.prototype, "deleted", 2);
2444
+ __decorateClass([
2445
+ (0, import_typeorm22.Column)("int", { nullable: true })
2446
+ ], Collection.prototype, "createdBy", 2);
2447
+ __decorateClass([
2448
+ (0, import_typeorm22.Column)("int", { nullable: true })
2449
+ ], Collection.prototype, "updatedBy", 2);
2450
+ __decorateClass([
2451
+ (0, import_typeorm22.Column)("int", { nullable: true })
2452
+ ], Collection.prototype, "deletedBy", 2);
2453
+ __decorateClass([
2454
+ (0, import_typeorm22.Column)("int", { nullable: true })
2455
+ ], Collection.prototype, "seoId", 2);
2456
+ __decorateClass([
2457
+ (0, import_typeorm22.ManyToOne)(() => Seo, { onDelete: "SET NULL" }),
2458
+ (0, import_typeorm22.JoinColumn)({ name: "seoId" })
2459
+ ], Collection.prototype, "seo", 2);
2460
+ __decorateClass([
2461
+ (0, import_typeorm22.ManyToOne)(() => ProductCategory, (c) => c.collections, { onDelete: "SET NULL" }),
2462
+ (0, import_typeorm22.JoinColumn)({ name: "categoryId" })
2463
+ ], Collection.prototype, "category", 2);
2464
+ __decorateClass([
2465
+ (0, import_typeorm22.ManyToOne)(() => Brand, (b) => b.collections, { onDelete: "SET NULL" }),
2466
+ (0, import_typeorm22.JoinColumn)({ name: "brandId" })
2467
+ ], Collection.prototype, "brand", 2);
2468
+ __decorateClass([
2469
+ (0, import_typeorm22.OneToMany)("Product", "collection")
2470
+ ], Collection.prototype, "products", 2);
2471
+ Collection = __decorateClass([
2472
+ (0, import_typeorm22.Entity)("collections")
2473
+ ], Collection);
2474
+
2475
+ // src/entities/product.entity.ts
2476
+ var import_typeorm23 = require("typeorm");
2477
+ var Product = class {
2478
+ id;
2479
+ collectionId;
2480
+ brandId;
2481
+ categoryId;
2482
+ sku;
2483
+ slug;
2484
+ name;
2485
+ price;
2486
+ compareAtPrice;
2487
+ quantity;
2488
+ status;
2489
+ featured;
2490
+ metadata;
2491
+ createdAt;
2492
+ updatedAt;
2493
+ deletedAt;
2494
+ deleted;
2495
+ createdBy;
2496
+ updatedBy;
2497
+ deletedBy;
2498
+ seoId;
2499
+ seo;
2500
+ collection;
2501
+ brand;
2502
+ category;
2503
+ attributes;
2504
+ taxes;
2505
+ };
2506
+ __decorateClass([
2507
+ (0, import_typeorm23.PrimaryGeneratedColumn)()
2508
+ ], Product.prototype, "id", 2);
2509
+ __decorateClass([
2510
+ (0, import_typeorm23.Column)("int", { nullable: true })
2511
+ ], Product.prototype, "collectionId", 2);
2512
+ __decorateClass([
2513
+ (0, import_typeorm23.Column)("int", { nullable: true })
2514
+ ], Product.prototype, "brandId", 2);
2515
+ __decorateClass([
2516
+ (0, import_typeorm23.Column)("int", { nullable: true })
2517
+ ], Product.prototype, "categoryId", 2);
2518
+ __decorateClass([
2519
+ (0, import_typeorm23.Column)("varchar", { nullable: true })
2520
+ ], Product.prototype, "sku", 2);
2521
+ __decorateClass([
2522
+ (0, import_typeorm23.Column)("varchar", { unique: true, nullable: true })
2523
+ ], Product.prototype, "slug", 2);
2524
+ __decorateClass([
2525
+ (0, import_typeorm23.Column)("varchar", { nullable: true })
2526
+ ], Product.prototype, "name", 2);
2527
+ __decorateClass([
2528
+ (0, import_typeorm23.Column)("decimal", { precision: 12, scale: 2 })
2529
+ ], Product.prototype, "price", 2);
2530
+ __decorateClass([
2531
+ (0, import_typeorm23.Column)("decimal", { precision: 12, scale: 2, nullable: true })
2532
+ ], Product.prototype, "compareAtPrice", 2);
2533
+ __decorateClass([
2534
+ (0, import_typeorm23.Column)("int", { default: 0 })
2535
+ ], Product.prototype, "quantity", 2);
2536
+ __decorateClass([
2537
+ (0, import_typeorm23.Column)("varchar", { default: "draft" })
2538
+ ], Product.prototype, "status", 2);
2539
+ __decorateClass([
2540
+ (0, import_typeorm23.Column)("boolean", { default: false })
2541
+ ], Product.prototype, "featured", 2);
2542
+ __decorateClass([
2543
+ (0, import_typeorm23.Column)("jsonb", { nullable: true })
2544
+ ], Product.prototype, "metadata", 2);
2545
+ __decorateClass([
2546
+ (0, import_typeorm23.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
2547
+ ], Product.prototype, "createdAt", 2);
2548
+ __decorateClass([
2549
+ (0, import_typeorm23.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
2550
+ ], Product.prototype, "updatedAt", 2);
2551
+ __decorateClass([
2552
+ (0, import_typeorm23.Column)({ type: "timestamp", nullable: true })
2553
+ ], Product.prototype, "deletedAt", 2);
2554
+ __decorateClass([
2555
+ (0, import_typeorm23.Column)("boolean", { default: false })
2556
+ ], Product.prototype, "deleted", 2);
2557
+ __decorateClass([
2558
+ (0, import_typeorm23.Column)("int", { nullable: true })
2559
+ ], Product.prototype, "createdBy", 2);
2560
+ __decorateClass([
2561
+ (0, import_typeorm23.Column)("int", { nullable: true })
2562
+ ], Product.prototype, "updatedBy", 2);
2563
+ __decorateClass([
2564
+ (0, import_typeorm23.Column)("int", { nullable: true })
2565
+ ], Product.prototype, "deletedBy", 2);
2566
+ __decorateClass([
2567
+ (0, import_typeorm23.Column)("int", { nullable: true })
2568
+ ], Product.prototype, "seoId", 2);
2569
+ __decorateClass([
2570
+ (0, import_typeorm23.ManyToOne)(() => Seo, { onDelete: "SET NULL" }),
2571
+ (0, import_typeorm23.JoinColumn)({ name: "seoId" })
2572
+ ], Product.prototype, "seo", 2);
2573
+ __decorateClass([
2574
+ (0, import_typeorm23.ManyToOne)(() => Collection, (c) => c.products, { onDelete: "SET NULL" }),
2575
+ (0, import_typeorm23.JoinColumn)({ name: "collectionId" })
2576
+ ], Product.prototype, "collection", 2);
2577
+ __decorateClass([
2578
+ (0, import_typeorm23.ManyToOne)(() => Brand, (b) => b.products, { onDelete: "SET NULL" }),
2579
+ (0, import_typeorm23.JoinColumn)({ name: "brandId" })
2580
+ ], Product.prototype, "brand", 2);
2581
+ __decorateClass([
2582
+ (0, import_typeorm23.ManyToOne)(() => ProductCategory, (c) => c.products, { onDelete: "SET NULL" }),
2583
+ (0, import_typeorm23.JoinColumn)({ name: "categoryId" })
2584
+ ], Product.prototype, "category", 2);
2585
+ __decorateClass([
2586
+ (0, import_typeorm23.OneToMany)("ProductAttribute", "product")
2587
+ ], Product.prototype, "attributes", 2);
2588
+ __decorateClass([
2589
+ (0, import_typeorm23.OneToMany)("ProductTax", "product")
2590
+ ], Product.prototype, "taxes", 2);
2591
+ Product = __decorateClass([
2592
+ (0, import_typeorm23.Entity)("products")
2593
+ ], Product);
2594
+
2595
+ // src/entities/attribute.entity.ts
2596
+ var import_typeorm24 = require("typeorm");
2597
+ var Attribute = class {
2598
+ id;
2599
+ name;
2600
+ slug;
2601
+ type;
2602
+ options;
2603
+ metadata;
2604
+ active;
2605
+ sortOrder;
2606
+ createdAt;
2607
+ updatedAt;
2608
+ deletedAt;
2609
+ deleted;
2610
+ createdBy;
2611
+ updatedBy;
2612
+ deletedBy;
2613
+ };
2614
+ __decorateClass([
2615
+ (0, import_typeorm24.PrimaryGeneratedColumn)()
2616
+ ], Attribute.prototype, "id", 2);
2617
+ __decorateClass([
2618
+ (0, import_typeorm24.Column)("varchar")
2619
+ ], Attribute.prototype, "name", 2);
2620
+ __decorateClass([
2621
+ (0, import_typeorm24.Column)("varchar", { unique: true })
2622
+ ], Attribute.prototype, "slug", 2);
2623
+ __decorateClass([
2624
+ (0, import_typeorm24.Column)("varchar", { default: "text" })
2625
+ ], Attribute.prototype, "type", 2);
2626
+ __decorateClass([
2627
+ (0, import_typeorm24.Column)("jsonb", { nullable: true })
2628
+ ], Attribute.prototype, "options", 2);
2629
+ __decorateClass([
2630
+ (0, import_typeorm24.Column)("jsonb", { nullable: true })
2631
+ ], Attribute.prototype, "metadata", 2);
2632
+ __decorateClass([
2633
+ (0, import_typeorm24.Column)("boolean", { default: true })
2634
+ ], Attribute.prototype, "active", 2);
2635
+ __decorateClass([
2636
+ (0, import_typeorm24.Column)("int", { default: 0 })
2637
+ ], Attribute.prototype, "sortOrder", 2);
2638
+ __decorateClass([
2639
+ (0, import_typeorm24.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
2640
+ ], Attribute.prototype, "createdAt", 2);
2641
+ __decorateClass([
2642
+ (0, import_typeorm24.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
2643
+ ], Attribute.prototype, "updatedAt", 2);
2644
+ __decorateClass([
2645
+ (0, import_typeorm24.Column)({ type: "timestamp", nullable: true })
2646
+ ], Attribute.prototype, "deletedAt", 2);
2647
+ __decorateClass([
2648
+ (0, import_typeorm24.Column)("boolean", { default: false })
2649
+ ], Attribute.prototype, "deleted", 2);
2650
+ __decorateClass([
2651
+ (0, import_typeorm24.Column)("int", { nullable: true })
2652
+ ], Attribute.prototype, "createdBy", 2);
2653
+ __decorateClass([
2654
+ (0, import_typeorm24.Column)("int", { nullable: true })
2655
+ ], Attribute.prototype, "updatedBy", 2);
2656
+ __decorateClass([
2657
+ (0, import_typeorm24.Column)("int", { nullable: true })
2658
+ ], Attribute.prototype, "deletedBy", 2);
2659
+ Attribute = __decorateClass([
2660
+ (0, import_typeorm24.Entity)("attributes")
2661
+ ], Attribute);
2662
+
2663
+ // src/entities/product-attribute.entity.ts
2664
+ var import_typeorm25 = require("typeorm");
2665
+ var ProductAttribute = class {
2666
+ id;
2667
+ productId;
2668
+ attributeId;
2669
+ value;
2670
+ metadata;
2671
+ createdAt;
2672
+ updatedAt;
2673
+ product;
2674
+ attribute;
2675
+ };
2676
+ __decorateClass([
2677
+ (0, import_typeorm25.PrimaryGeneratedColumn)()
2678
+ ], ProductAttribute.prototype, "id", 2);
2679
+ __decorateClass([
2680
+ (0, import_typeorm25.Column)("int")
2681
+ ], ProductAttribute.prototype, "productId", 2);
2682
+ __decorateClass([
2683
+ (0, import_typeorm25.Column)("int")
2684
+ ], ProductAttribute.prototype, "attributeId", 2);
2685
+ __decorateClass([
2686
+ (0, import_typeorm25.Column)("varchar")
2687
+ ], ProductAttribute.prototype, "value", 2);
2688
+ __decorateClass([
2689
+ (0, import_typeorm25.Column)("jsonb", { nullable: true })
2690
+ ], ProductAttribute.prototype, "metadata", 2);
2691
+ __decorateClass([
2692
+ (0, import_typeorm25.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
2693
+ ], ProductAttribute.prototype, "createdAt", 2);
2694
+ __decorateClass([
2695
+ (0, import_typeorm25.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
2696
+ ], ProductAttribute.prototype, "updatedAt", 2);
2697
+ __decorateClass([
2698
+ (0, import_typeorm25.ManyToOne)(() => Product, (p) => p.attributes, { onDelete: "CASCADE" }),
2699
+ (0, import_typeorm25.JoinColumn)({ name: "productId" })
2700
+ ], ProductAttribute.prototype, "product", 2);
2701
+ __decorateClass([
2702
+ (0, import_typeorm25.ManyToOne)(() => Attribute, { onDelete: "CASCADE" }),
2703
+ (0, import_typeorm25.JoinColumn)({ name: "attributeId" })
2704
+ ], ProductAttribute.prototype, "attribute", 2);
2705
+ ProductAttribute = __decorateClass([
2706
+ (0, import_typeorm25.Entity)("product_attributes")
2707
+ ], ProductAttribute);
2708
+
2709
+ // src/entities/tax.entity.ts
2710
+ var import_typeorm26 = require("typeorm");
2711
+ var Tax = class {
2712
+ id;
2713
+ name;
2714
+ slug;
2715
+ rate;
2716
+ isDefault;
2717
+ description;
2718
+ active;
2719
+ metadata;
2720
+ createdAt;
2721
+ updatedAt;
2722
+ deletedAt;
2723
+ deleted;
2724
+ createdBy;
2725
+ updatedBy;
2726
+ deletedBy;
2727
+ };
2728
+ __decorateClass([
2729
+ (0, import_typeorm26.PrimaryGeneratedColumn)()
2730
+ ], Tax.prototype, "id", 2);
2731
+ __decorateClass([
2732
+ (0, import_typeorm26.Column)("varchar")
2733
+ ], Tax.prototype, "name", 2);
2734
+ __decorateClass([
2735
+ (0, import_typeorm26.Column)("varchar", { unique: true })
2736
+ ], Tax.prototype, "slug", 2);
2737
+ __decorateClass([
2738
+ (0, import_typeorm26.Column)("decimal", { precision: 5, scale: 2 })
2739
+ ], Tax.prototype, "rate", 2);
2740
+ __decorateClass([
2741
+ (0, import_typeorm26.Column)("boolean", { default: false })
2742
+ ], Tax.prototype, "isDefault", 2);
2743
+ __decorateClass([
2744
+ (0, import_typeorm26.Column)("text", { nullable: true })
2745
+ ], Tax.prototype, "description", 2);
2746
+ __decorateClass([
2747
+ (0, import_typeorm26.Column)("boolean", { default: true })
2748
+ ], Tax.prototype, "active", 2);
2749
+ __decorateClass([
2750
+ (0, import_typeorm26.Column)("jsonb", { nullable: true })
2751
+ ], Tax.prototype, "metadata", 2);
2752
+ __decorateClass([
2753
+ (0, import_typeorm26.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
2754
+ ], Tax.prototype, "createdAt", 2);
2755
+ __decorateClass([
2756
+ (0, import_typeorm26.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
2757
+ ], Tax.prototype, "updatedAt", 2);
2758
+ __decorateClass([
2759
+ (0, import_typeorm26.Column)({ type: "timestamp", nullable: true })
2760
+ ], Tax.prototype, "deletedAt", 2);
2761
+ __decorateClass([
2762
+ (0, import_typeorm26.Column)("boolean", { default: false })
2763
+ ], Tax.prototype, "deleted", 2);
2764
+ __decorateClass([
2765
+ (0, import_typeorm26.Column)("int", { nullable: true })
2766
+ ], Tax.prototype, "createdBy", 2);
2767
+ __decorateClass([
2768
+ (0, import_typeorm26.Column)("int", { nullable: true })
2769
+ ], Tax.prototype, "updatedBy", 2);
2770
+ __decorateClass([
2771
+ (0, import_typeorm26.Column)("int", { nullable: true })
2772
+ ], Tax.prototype, "deletedBy", 2);
2773
+ Tax = __decorateClass([
2774
+ (0, import_typeorm26.Entity)("taxes")
2775
+ ], Tax);
2776
+
2777
+ // src/entities/product-tax.entity.ts
2778
+ var import_typeorm27 = require("typeorm");
2779
+ var ProductTax = class {
2780
+ id;
2781
+ productId;
2782
+ taxId;
2783
+ rate;
2784
+ createdAt;
2785
+ updatedAt;
2786
+ product;
2787
+ tax;
2788
+ };
2789
+ __decorateClass([
2790
+ (0, import_typeorm27.PrimaryGeneratedColumn)()
2791
+ ], ProductTax.prototype, "id", 2);
2792
+ __decorateClass([
2793
+ (0, import_typeorm27.Column)("int")
2794
+ ], ProductTax.prototype, "productId", 2);
2795
+ __decorateClass([
2796
+ (0, import_typeorm27.Column)("int")
2797
+ ], ProductTax.prototype, "taxId", 2);
2798
+ __decorateClass([
2799
+ (0, import_typeorm27.Column)("decimal", { precision: 5, scale: 2, nullable: true })
2800
+ ], ProductTax.prototype, "rate", 2);
2801
+ __decorateClass([
2802
+ (0, import_typeorm27.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
2803
+ ], ProductTax.prototype, "createdAt", 2);
2804
+ __decorateClass([
2805
+ (0, import_typeorm27.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
2806
+ ], ProductTax.prototype, "updatedAt", 2);
2807
+ __decorateClass([
2808
+ (0, import_typeorm27.ManyToOne)(() => Product, (p) => p.taxes, { onDelete: "CASCADE" }),
2809
+ (0, import_typeorm27.JoinColumn)({ name: "productId" })
2810
+ ], ProductTax.prototype, "product", 2);
2811
+ __decorateClass([
2812
+ (0, import_typeorm27.ManyToOne)(() => Tax, { onDelete: "CASCADE" }),
2813
+ (0, import_typeorm27.JoinColumn)({ name: "taxId" })
2814
+ ], ProductTax.prototype, "tax", 2);
2815
+ ProductTax = __decorateClass([
2816
+ (0, import_typeorm27.Entity)("product_taxes")
2817
+ ], ProductTax);
2818
+
2819
+ // src/entities/order-item.entity.ts
2820
+ var import_typeorm28 = require("typeorm");
2821
+ var OrderItem = class {
2822
+ id;
2823
+ orderId;
2824
+ productId;
2825
+ quantity;
2826
+ unitPrice;
2827
+ tax;
2828
+ total;
2829
+ metadata;
2830
+ createdAt;
2831
+ updatedAt;
2832
+ order;
2833
+ product;
2834
+ };
2835
+ __decorateClass([
2836
+ (0, import_typeorm28.PrimaryGeneratedColumn)()
2837
+ ], OrderItem.prototype, "id", 2);
2838
+ __decorateClass([
2839
+ (0, import_typeorm28.Column)("int")
2840
+ ], OrderItem.prototype, "orderId", 2);
2841
+ __decorateClass([
2842
+ (0, import_typeorm28.Column)("int")
2843
+ ], OrderItem.prototype, "productId", 2);
2844
+ __decorateClass([
2845
+ (0, import_typeorm28.Column)("int", { default: 1 })
2846
+ ], OrderItem.prototype, "quantity", 2);
2847
+ __decorateClass([
2848
+ (0, import_typeorm28.Column)("decimal", { precision: 12, scale: 2 })
2849
+ ], OrderItem.prototype, "unitPrice", 2);
2850
+ __decorateClass([
2851
+ (0, import_typeorm28.Column)("decimal", { precision: 12, scale: 2, default: 0 })
2852
+ ], OrderItem.prototype, "tax", 2);
2853
+ __decorateClass([
2854
+ (0, import_typeorm28.Column)("decimal", { precision: 12, scale: 2 })
2855
+ ], OrderItem.prototype, "total", 2);
2856
+ __decorateClass([
2857
+ (0, import_typeorm28.Column)("jsonb", { nullable: true })
2858
+ ], OrderItem.prototype, "metadata", 2);
2859
+ __decorateClass([
2860
+ (0, import_typeorm28.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
2861
+ ], OrderItem.prototype, "createdAt", 2);
2862
+ __decorateClass([
2863
+ (0, import_typeorm28.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
2864
+ ], OrderItem.prototype, "updatedAt", 2);
2865
+ __decorateClass([
2866
+ (0, import_typeorm28.ManyToOne)(() => Order, (o) => o.items, { onDelete: "CASCADE" }),
2867
+ (0, import_typeorm28.JoinColumn)({ name: "orderId" })
2868
+ ], OrderItem.prototype, "order", 2);
2869
+ __decorateClass([
2870
+ (0, import_typeorm28.ManyToOne)(() => Product, { onDelete: "CASCADE" }),
2871
+ (0, import_typeorm28.JoinColumn)({ name: "productId" })
2872
+ ], OrderItem.prototype, "product", 2);
2873
+ OrderItem = __decorateClass([
2874
+ (0, import_typeorm28.Entity)("order_items")
2875
+ ], OrderItem);
2876
+
2877
+ // src/entities/index.ts
2878
+ var CMS_ENTITY_MAP = {
2879
+ users: User,
2880
+ password_reset_tokens: PasswordResetToken,
2881
+ user_groups: UserGroup,
2882
+ permissions: Permission,
2883
+ blogs: Blog,
2884
+ tags: Tag,
2885
+ categories: Category,
2886
+ comments: Comment,
2887
+ contacts: Contact,
2888
+ addresses: Address,
2889
+ forms: Form,
2890
+ form_fields: FormField,
2891
+ form_submissions: FormSubmission,
2892
+ seos: Seo,
2893
+ configs: Config,
2894
+ media: Media,
2895
+ pages: Page,
2896
+ product_categories: ProductCategory,
2897
+ collections: Collection,
2898
+ products: Product,
2899
+ attributes: Attribute,
2900
+ product_attributes: ProductAttribute,
2901
+ taxes: Tax,
2902
+ product_taxes: ProductTax,
2903
+ orders: Order,
2904
+ order_items: OrderItem,
2905
+ payments: Payment,
2906
+ brands: Brand
2907
+ };
2908
+
2909
+ // src/auth/helpers.ts
2910
+ var OPEN_ENDPOINTS = [
2911
+ { "/api/contacts": ["POST"] },
2912
+ { "/api/form-submissions": ["POST"] },
1800
2913
  { "/api/blogs": ["GET"] }
1801
2914
  ];
1802
2915
  var PERMISSION_REQUIRED_ENDPOINTS = {};
@@ -1959,7 +3072,7 @@ function getNextAuthOptions(config) {
1959
3072
  }
1960
3073
 
1961
3074
  // src/api/crud.ts
1962
- var import_typeorm17 = require("typeorm");
3075
+ var import_typeorm29 = require("typeorm");
1963
3076
  var DATE_COLUMN_TYPES = /* @__PURE__ */ new Set([
1964
3077
  "date",
1965
3078
  "datetime",
@@ -2004,28 +3117,170 @@ function createCrudHandler(dataSource, entityMap, options) {
2004
3117
  if (!resource || !entity) {
2005
3118
  return json({ error: "Invalid resource" }, { status: 400 });
2006
3119
  }
2007
- const repo = dataSource.getRepository(entity);
2008
3120
  const { searchParams } = new URL(req.url);
2009
3121
  const page = Number(searchParams.get("page")) || 1;
2010
- const limit = Number(searchParams.get("limit")) || 10;
3122
+ const limit = Math.min(Number(searchParams.get("limit")) || 10, 100);
2011
3123
  const skip = (page - 1) * limit;
2012
- const sortField = searchParams.get("sortField") || "createdAt";
3124
+ const sortFieldRaw = searchParams.get("sortField") || "createdAt";
2013
3125
  const sortOrder = searchParams.get("sortOrder") === "desc" ? "DESC" : "ASC";
2014
3126
  const search = searchParams.get("search");
3127
+ if (resource === "orders") {
3128
+ const repo2 = dataSource.getRepository(entity);
3129
+ const allowedSort = ["id", "orderNumber", "contactId", "status", "total", "currency", "createdAt", "updatedAt"];
3130
+ const sortField = allowedSort.includes(sortFieldRaw) ? sortFieldRaw : "createdAt";
3131
+ const sortOrderOrders = searchParams.get("sortOrder") === "asc" ? "ASC" : "DESC";
3132
+ const statusFilter = searchParams.get("status")?.trim();
3133
+ const dateFrom = searchParams.get("dateFrom")?.trim();
3134
+ const dateTo = searchParams.get("dateTo")?.trim();
3135
+ const paymentRef = searchParams.get("paymentRef")?.trim();
3136
+ let orderIdsFromPayment = null;
3137
+ if (paymentRef && entityMap["payments"]) {
3138
+ const paymentRepo = dataSource.getRepository(entityMap["payments"]);
3139
+ const payments = await paymentRepo.createQueryBuilder("p").select("p.orderId").where("p.externalReference = :ref", { ref: paymentRef }).orWhere("p.metadata->>'razorpayPaymentId' = :ref", { ref: paymentRef }).getRawMany();
3140
+ orderIdsFromPayment = payments.map((r) => r.orderId);
3141
+ if (orderIdsFromPayment.length === 0) {
3142
+ return json({ total: 0, page, limit, totalPages: 0, data: [] });
3143
+ }
3144
+ }
3145
+ const qb = repo2.createQueryBuilder("order").leftJoinAndSelect("order.contact", "contact").leftJoinAndSelect("order.items", "items").leftJoinAndSelect("items.product", "product").leftJoinAndSelect("product.collection", "collection").orderBy(`order.${sortField}`, sortOrderOrders).skip(skip).take(limit);
3146
+ if (search && typeof search === "string" && search.trim()) {
3147
+ const term = `%${search.trim()}%`;
3148
+ qb.andWhere(
3149
+ "(order.orderNumber ILIKE :term OR contact.name ILIKE :term OR contact.email ILIKE :term)",
3150
+ { term }
3151
+ );
3152
+ }
3153
+ if (statusFilter) qb.andWhere("order.status = :status", { status: statusFilter });
3154
+ if (dateFrom) qb.andWhere("order.createdAt >= :dateFrom", { dateFrom: /* @__PURE__ */ new Date(dateFrom + "T00:00:00.000Z") });
3155
+ if (dateTo) qb.andWhere("order.createdAt <= :dateTo", { dateTo: /* @__PURE__ */ new Date(dateTo + "T23:59:59.999Z") });
3156
+ if (orderIdsFromPayment && orderIdsFromPayment.length) qb.andWhere("order.id IN (:...orderIds)", { orderIds: orderIdsFromPayment });
3157
+ const [rows, total2] = await qb.getManyAndCount();
3158
+ const data2 = rows.map((order) => {
3159
+ const contact = order.contact;
3160
+ const items = order.items ?? [];
3161
+ const itemsSummary = items.map((i) => {
3162
+ const label = i.product?.collection?.name ?? i.product?.name ?? "Product";
3163
+ return `${label} \xD7 ${i.quantity}`;
3164
+ }).join(", ") || "\u2014";
3165
+ return {
3166
+ ...order,
3167
+ contact: contact ? { id: contact.id, name: contact.name, email: contact.email, phone: contact.phone } : null,
3168
+ itemsSummary
3169
+ };
3170
+ });
3171
+ return json({ total: total2, page, limit, totalPages: Math.ceil(total2 / limit), data: data2 });
3172
+ }
3173
+ if (resource === "payments") {
3174
+ const repo2 = dataSource.getRepository(entity);
3175
+ const allowedSort = ["id", "orderId", "amount", "currency", "status", "method", "paidAt", "createdAt", "updatedAt"];
3176
+ const sortField = allowedSort.includes(sortFieldRaw) ? sortFieldRaw : "createdAt";
3177
+ const sortOrderPayments = searchParams.get("sortOrder") === "asc" ? "ASC" : "DESC";
3178
+ const statusFilter = searchParams.get("status")?.trim();
3179
+ const dateFrom = searchParams.get("dateFrom")?.trim();
3180
+ const dateTo = searchParams.get("dateTo")?.trim();
3181
+ const methodFilter = searchParams.get("method")?.trim();
3182
+ const orderNumberParam = searchParams.get("orderNumber")?.trim();
3183
+ const qb = repo2.createQueryBuilder("payment").leftJoinAndSelect("payment.order", "ord").leftJoinAndSelect("ord.contact", "orderContact").leftJoinAndSelect("payment.contact", "contact").orderBy(`payment.${sortField}`, sortOrderPayments).skip(skip).take(limit);
3184
+ if (search && typeof search === "string" && search.trim()) {
3185
+ const term = `%${search.trim()}%`;
3186
+ qb.andWhere(
3187
+ "(orderContact.name ILIKE :term OR orderContact.email ILIKE :term OR contact.name ILIKE :term OR contact.email ILIKE :term)",
3188
+ { term }
3189
+ );
3190
+ }
3191
+ if (statusFilter) qb.andWhere("payment.status = :status", { status: statusFilter });
3192
+ if (dateFrom) qb.andWhere("payment.createdAt >= :dateFrom", { dateFrom: /* @__PURE__ */ new Date(dateFrom + "T00:00:00.000Z") });
3193
+ if (dateTo) qb.andWhere("payment.createdAt <= :dateTo", { dateTo: /* @__PURE__ */ new Date(dateTo + "T23:59:59.999Z") });
3194
+ if (methodFilter) qb.andWhere("payment.method = :method", { method: methodFilter });
3195
+ if (orderNumberParam) qb.andWhere("ord.orderNumber ILIKE :orderNumber", { orderNumber: `%${orderNumberParam}%` });
3196
+ const [rows, total2] = await qb.getManyAndCount();
3197
+ const data2 = rows.map((payment) => {
3198
+ const order = payment.order;
3199
+ const orderContact = order?.contact;
3200
+ const contact = payment.contact;
3201
+ const customer = orderContact ?? contact;
3202
+ return {
3203
+ ...payment,
3204
+ order: order ? { id: order.id, orderNumber: order.orderNumber, contact: orderContact ? { name: orderContact.name, email: orderContact.email } : null } : null,
3205
+ contact: customer ? { id: customer.id, name: customer.name, email: customer.email } : null
3206
+ };
3207
+ });
3208
+ return json({ total: total2, page, limit, totalPages: Math.ceil(total2 / limit), data: data2 });
3209
+ }
3210
+ if (resource === "products") {
3211
+ const repo2 = dataSource.getRepository(entity);
3212
+ const statusFilter = searchParams.get("status")?.trim();
3213
+ const inventory = searchParams.get("inventory")?.trim();
3214
+ const productWhere = {};
3215
+ if (statusFilter) productWhere.status = statusFilter;
3216
+ if (inventory === "in_stock") productWhere.quantity = (0, import_typeorm29.MoreThan)(0);
3217
+ if (inventory === "out_of_stock") productWhere.quantity = 0;
3218
+ if (search && typeof search === "string" && search.trim()) {
3219
+ productWhere.name = (0, import_typeorm29.ILike)(`%${search.trim()}%`);
3220
+ }
3221
+ const [data2, total2] = await repo2.findAndCount({
3222
+ where: Object.keys(productWhere).length ? productWhere : void 0,
3223
+ skip,
3224
+ take: limit,
3225
+ order: { [sortFieldRaw]: sortOrder }
3226
+ });
3227
+ return json({ total: total2, page, limit, totalPages: Math.ceil(total2 / limit), data: data2 });
3228
+ }
3229
+ if (resource === "contacts") {
3230
+ const repo2 = dataSource.getRepository(entity);
3231
+ const allowedSort = ["id", "name", "email", "createdAt", "type"];
3232
+ const sortField = allowedSort.includes(sortFieldRaw) ? sortFieldRaw : "createdAt";
3233
+ const sortOrderContacts = searchParams.get("sortOrder") === "asc" ? "ASC" : "DESC";
3234
+ const typeFilter2 = searchParams.get("type")?.trim();
3235
+ const orderIdParam = searchParams.get("orderId")?.trim();
3236
+ const includeSummary = searchParams.get("includeSummary") === "1";
3237
+ const qb = repo2.createQueryBuilder("contact").orderBy(`contact.${sortField}`, sortOrderContacts).skip(skip).take(limit);
3238
+ if (search && typeof search === "string" && search.trim()) {
3239
+ const term = `%${search.trim()}%`;
3240
+ qb.andWhere("(contact.name ILIKE :term OR contact.email ILIKE :term OR contact.phone ILIKE :term)", { term });
3241
+ }
3242
+ if (typeFilter2) qb.andWhere("contact.type = :type", { type: typeFilter2 });
3243
+ if (orderIdParam) {
3244
+ const orderId = Number(orderIdParam);
3245
+ if (!Number.isNaN(orderId)) {
3246
+ qb.andWhere('contact.id IN (SELECT "contactId" FROM orders WHERE id = :orderId)', { orderId });
3247
+ }
3248
+ }
3249
+ if (includeSummary && entityMap["orders"] && entityMap["payments"]) {
3250
+ qb.loadRelationCountAndMap("contact._orderCount", "contact.orders");
3251
+ const [rows, total3] = await qb.getManyAndCount();
3252
+ const contactIds = rows.map((c) => c.id);
3253
+ const paymentRepo = dataSource.getRepository(entityMap["payments"]);
3254
+ const paidByContact = await paymentRepo.createQueryBuilder("p").select("p.contactId", "contactId").addSelect("COALESCE(SUM(CAST(p.amount AS DECIMAL)), 0)", "total").where("p.contactId IN (:...ids)", { ids: contactIds.length ? contactIds : [0] }).andWhere("p.status = :status", { status: "completed" }).groupBy("p.contactId").getRawMany();
3255
+ const totalPaidMap = new Map(paidByContact.map((r) => [r.contactId, Number(r.total)]));
3256
+ const data3 = rows.map((c) => {
3257
+ const { _orderCount, ...rest } = c;
3258
+ return {
3259
+ ...rest,
3260
+ orderCount: _orderCount ?? 0,
3261
+ totalPaid: totalPaidMap.get(rest.id) ?? 0
3262
+ };
3263
+ });
3264
+ return json({ total: total3, page, limit, totalPages: Math.ceil(total3 / limit), data: data3 });
3265
+ }
3266
+ const [data2, total2] = await qb.getManyAndCount();
3267
+ return json({ total: total2, page, limit, totalPages: Math.ceil(total2 / limit), data: data2 });
3268
+ }
3269
+ const repo = dataSource.getRepository(entity);
2015
3270
  const typeFilter = searchParams.get("type");
2016
3271
  let where = {};
2017
3272
  if (resource === "media") {
2018
3273
  const mediaWhere = {};
2019
- if (search) mediaWhere.filename = (0, import_typeorm17.ILike)(`%${search}%`);
2020
- if (typeFilter) mediaWhere.mimeType = (0, import_typeorm17.Like)(`${typeFilter}/%`);
3274
+ if (search) mediaWhere.filename = (0, import_typeorm29.ILike)(`%${search}%`);
3275
+ if (typeFilter) mediaWhere.mimeType = (0, import_typeorm29.Like)(`${typeFilter}/%`);
2021
3276
  where = Object.keys(mediaWhere).length > 0 ? mediaWhere : {};
2022
3277
  } else if (search) {
2023
- where = [{ name: (0, import_typeorm17.ILike)(`%${search}%`) }, { title: (0, import_typeorm17.ILike)(`%${search}%`) }];
3278
+ where = [{ name: (0, import_typeorm29.ILike)(`%${search}%`) }, { title: (0, import_typeorm29.ILike)(`%${search}%`) }];
2024
3279
  }
2025
3280
  const [data, total] = await repo.findAndCount({
2026
3281
  skip,
2027
3282
  take: limit,
2028
- order: { [sortField]: sortOrder },
3283
+ order: { [sortFieldRaw]: sortOrder },
2029
3284
  where
2030
3285
  });
2031
3286
  return json({ total, page, limit, totalPages: Math.ceil(total / limit), data });
@@ -2045,6 +3300,107 @@ function createCrudHandler(dataSource, entityMap, options) {
2045
3300
  sanitizeBodyForEntity(repo, body);
2046
3301
  const created = await repo.save(repo.create(body));
2047
3302
  return json(created, { status: 201 });
3303
+ },
3304
+ async GET_METADATA(req, resource) {
3305
+ const authError = await requireAuth(req);
3306
+ if (authError) return authError;
3307
+ const entity = entityMap[resource];
3308
+ if (!resource || !entity) {
3309
+ return json({ error: "Invalid resource" }, { status: 400 });
3310
+ }
3311
+ const repo = dataSource.getRepository(entity);
3312
+ const meta = repo.metadata;
3313
+ const uniqueFromIndices = /* @__PURE__ */ new Set();
3314
+ for (const idx of meta.indices) {
3315
+ if (idx.isUnique && idx.columns.length === 1) {
3316
+ uniqueFromIndices.add(idx.columns[0].propertyName);
3317
+ }
3318
+ }
3319
+ for (const uniq of meta.uniques) {
3320
+ if (uniq.columns.length === 1) {
3321
+ uniqueFromIndices.add(uniq.columns[0].propertyName);
3322
+ }
3323
+ }
3324
+ const columns = meta.columns.map((col) => ({
3325
+ name: col.propertyName,
3326
+ type: typeof col.type === "string" ? col.type : col.type?.name ?? "unknown",
3327
+ nullable: col.isNullable,
3328
+ isUnique: uniqueFromIndices.has(col.propertyName),
3329
+ isPrimary: col.isPrimary,
3330
+ default: col.default
3331
+ }));
3332
+ const uniqueColumns = [...uniqueFromIndices];
3333
+ return json({ columns, uniqueColumns });
3334
+ },
3335
+ async BULK_POST(req, resource) {
3336
+ const authError = await requireAuth(req);
3337
+ if (authError) return authError;
3338
+ const entity = entityMap[resource];
3339
+ if (!resource || !entity) {
3340
+ return json({ error: "Invalid resource" }, { status: 400 });
3341
+ }
3342
+ const body = await req.json();
3343
+ const { records, upsertKey = "id" } = body;
3344
+ if (!Array.isArray(records) || records.length === 0) {
3345
+ return json({ error: "Records array is required" }, { status: 400 });
3346
+ }
3347
+ const repo = dataSource.getRepository(entity);
3348
+ for (const record of records) {
3349
+ sanitizeBodyForEntity(repo, record);
3350
+ }
3351
+ try {
3352
+ const result = await repo.upsert(records, {
3353
+ conflictPaths: [upsertKey],
3354
+ skipUpdateIfNoValuesChanged: true
3355
+ });
3356
+ return json({
3357
+ success: true,
3358
+ imported: result.identifiers.length,
3359
+ identifiers: result.identifiers
3360
+ });
3361
+ } catch (error) {
3362
+ const message = error instanceof Error ? error.message : "Bulk import failed";
3363
+ return json({ error: message }, { status: 400 });
3364
+ }
3365
+ },
3366
+ async GET_EXPORT(req, resource) {
3367
+ const authError = await requireAuth(req);
3368
+ if (authError) return authError;
3369
+ const entity = entityMap[resource];
3370
+ if (!resource || !entity) {
3371
+ return json({ error: "Invalid resource" }, { status: 400 });
3372
+ }
3373
+ const { searchParams } = new URL(req.url);
3374
+ const format = searchParams.get("format") || "csv";
3375
+ const repo = dataSource.getRepository(entity);
3376
+ const meta = repo.metadata;
3377
+ const hasDeleted = meta.columns.some((c) => c.propertyName === "deleted");
3378
+ const where = hasDeleted ? { deleted: false } : {};
3379
+ const data = await repo.find({ where });
3380
+ const excludeCols = /* @__PURE__ */ new Set(["deletedAt", "deletedBy", "deleted"]);
3381
+ const columns = meta.columns.filter((c) => !excludeCols.has(c.propertyName)).map((c) => c.propertyName);
3382
+ if (format === "json") {
3383
+ return json(data);
3384
+ }
3385
+ const escapeCSV = (val) => {
3386
+ if (val === null || val === void 0) return "";
3387
+ const str = typeof val === "object" ? JSON.stringify(val) : String(val);
3388
+ if (str.includes(",") || str.includes('"') || str.includes("\n")) {
3389
+ return `"${str.replace(/"/g, '""')}"`;
3390
+ }
3391
+ return str;
3392
+ };
3393
+ const header = columns.join(",");
3394
+ const rows = data.map(
3395
+ (row) => columns.map((col) => escapeCSV(row[col])).join(",")
3396
+ );
3397
+ const csv = [header, ...rows].join("\n");
3398
+ return new Response(csv, {
3399
+ headers: {
3400
+ "Content-Type": "text/csv; charset=utf-8",
3401
+ "Content-Disposition": `attachment; filename="${resource}.csv"`
3402
+ }
3403
+ });
2048
3404
  }
2049
3405
  };
2050
3406
  }
@@ -2057,6 +3413,44 @@ function createCrudByIdHandler(dataSource, entityMap, options) {
2057
3413
  const entity = entityMap[resource];
2058
3414
  if (!entity) return json({ error: "Invalid resource" }, { status: 400 });
2059
3415
  const repo = dataSource.getRepository(entity);
3416
+ if (resource === "orders") {
3417
+ const order = await repo.findOne({
3418
+ where: { id: Number(id) },
3419
+ relations: ["contact", "billingAddress", "shippingAddress", "items", "items.product", "items.product.collection", "payments"]
3420
+ });
3421
+ if (!order) return json({ message: "Not found" }, { status: 404 });
3422
+ return json(order);
3423
+ }
3424
+ if (resource === "contacts") {
3425
+ const contact = await repo.findOne({
3426
+ where: { id: Number(id) },
3427
+ relations: ["form_submissions", "form_submissions.form", "orders", "payments", "addresses"]
3428
+ });
3429
+ if (!contact) return json({ message: "Not found" }, { status: 404 });
3430
+ const orders = contact.orders ?? [];
3431
+ const payments = contact.payments ?? [];
3432
+ const totalPaid = payments.filter((p) => p.status === "completed").reduce((sum, p) => sum + Number(p.amount ?? 0), 0);
3433
+ const lastOrderAt = orders.length > 0 ? orders.reduce((latest, o) => {
3434
+ const t = o.createdAt ? new Date(o.createdAt).getTime() : 0;
3435
+ return t > latest ? t : latest;
3436
+ }, 0) : null;
3437
+ return json({
3438
+ ...contact,
3439
+ summary: {
3440
+ totalOrders: orders.length,
3441
+ totalPaid,
3442
+ lastOrderAt: lastOrderAt ? new Date(lastOrderAt).toISOString() : null
3443
+ }
3444
+ });
3445
+ }
3446
+ if (resource === "payments") {
3447
+ const payment = await repo.findOne({
3448
+ where: { id: Number(id) },
3449
+ relations: ["order", "order.contact", "contact"]
3450
+ });
3451
+ if (!payment) return json({ message: "Not found" }, { status: 404 });
3452
+ return json(payment);
3453
+ }
2060
3454
  const item = await repo.findOne({ where: { id: Number(id) } });
2061
3455
  return item ? json(item) : json({ message: "Not found" }, { status: 404 });
2062
3456
  },
@@ -2097,8 +3491,8 @@ function createForgotPasswordHandler(config) {
2097
3491
  const user = await userRepo.findOne({ where: { email }, select: ["email"] });
2098
3492
  const msg = "If an account exists with this email, you will receive a reset link shortly.";
2099
3493
  if (!user) return json({ message: msg }, { status: 200 });
2100
- const crypto = await import("crypto");
2101
- const token = crypto.randomBytes(32).toString("hex");
3494
+ const crypto2 = await import("crypto");
3495
+ const token = crypto2.randomBytes(32).toString("hex");
2102
3496
  const expiresAt = new Date(Date.now() + resetExpiryHours * 60 * 60 * 1e3);
2103
3497
  const tokenRepo = dataSource.getRepository(entityMap.password_reset_tokens);
2104
3498
  await tokenRepo.save(tokenRepo.create({ email: user.email, token, expiresAt }));
@@ -2212,7 +3606,7 @@ function createUserAuthApiRouter(config) {
2212
3606
  }
2213
3607
 
2214
3608
  // src/api/cms-handlers.ts
2215
- var import_typeorm18 = require("typeorm");
3609
+ var import_typeorm30 = require("typeorm");
2216
3610
  function createDashboardStatsHandler(config) {
2217
3611
  const { dataSource, entityMap, json, requireAuth, requirePermission } = config;
2218
3612
  return async function GET(req) {
@@ -2231,8 +3625,8 @@ function createDashboardStatsHandler(config) {
2231
3625
  repo("form_submissions")?.count() ?? 0,
2232
3626
  repo("users")?.count({ where: { deleted: false } }) ?? 0,
2233
3627
  repo("blogs")?.count({ where: { deleted: false } }) ?? 0,
2234
- repo("contacts")?.count({ where: { createdAt: (0, import_typeorm18.MoreThanOrEqual)(sevenDaysAgo) } }) ?? 0,
2235
- repo("form_submissions")?.count({ where: { createdAt: (0, import_typeorm18.MoreThanOrEqual)(sevenDaysAgo) } }) ?? 0
3628
+ repo("contacts")?.count({ where: { createdAt: (0, import_typeorm30.MoreThanOrEqual)(sevenDaysAgo) } }) ?? 0,
3629
+ repo("form_submissions")?.count({ where: { createdAt: (0, import_typeorm30.MoreThanOrEqual)(sevenDaysAgo) } }) ?? 0
2236
3630
  ]);
2237
3631
  return json({
2238
3632
  contacts: { total: contactsCount, recent: recentContacts },
@@ -2585,7 +3979,7 @@ function createUsersApiHandlers(config) {
2585
3979
  const sortField = url.searchParams.get("sortField") || "createdAt";
2586
3980
  const sortOrder = url.searchParams.get("sortOrder") === "desc" ? "DESC" : "ASC";
2587
3981
  const search = url.searchParams.get("search");
2588
- const where = search ? [{ name: (0, import_typeorm18.ILike)(`%${search}%`) }, { email: (0, import_typeorm18.ILike)(`%${search}%`) }] : {};
3982
+ const where = search ? [{ name: (0, import_typeorm30.ILike)(`%${search}%`) }, { email: (0, import_typeorm30.ILike)(`%${search}%`) }] : {};
2589
3983
  const [data, total] = await userRepo().findAndCount({
2590
3984
  skip,
2591
3985
  take: limit,
@@ -2922,6 +4316,17 @@ function createCmsApiHandler(config) {
2922
4316
  if (path.length === 0) return config.json({ error: "Not found" }, { status: 404 });
2923
4317
  const resource = resolveResource(path[0]);
2924
4318
  if (!crudResources.includes(resource)) return config.json({ error: "Invalid resource" }, { status: 400 });
4319
+ if (path.length === 2) {
4320
+ if (path[1] === "metadata" && method === "GET") {
4321
+ return crud.GET_METADATA(req, resource);
4322
+ }
4323
+ if (path[1] === "bulk" && method === "POST") {
4324
+ return crud.BULK_POST(req, resource);
4325
+ }
4326
+ if (path[1] === "export" && method === "GET") {
4327
+ return crud.GET_EXPORT(req, resource);
4328
+ }
4329
+ }
2925
4330
  if (path.length === 1) {
2926
4331
  if (method === "GET") return crud.GET(req, resource);
2927
4332
  if (method === "POST") return crud.POST(req, resource);
@@ -2951,9 +4356,12 @@ var DEFAULT_ADMIN_NAV = [
2951
4356
  ];
2952
4357
  // Annotate the CommonJS export names for ESM import in node:
2953
4358
  0 && (module.exports = {
4359
+ Attribute,
2954
4360
  Blog,
4361
+ Brand,
2955
4362
  CMS_ENTITY_MAP,
2956
4363
  Category,
4364
+ Collection,
2957
4365
  Comment,
2958
4366
  Config,
2959
4367
  Contact,
@@ -2964,12 +4372,20 @@ var DEFAULT_ADMIN_NAV = [
2964
4372
  FormSubmission,
2965
4373
  Media,
2966
4374
  OPEN_ENDPOINTS,
4375
+ Order,
4376
+ OrderItem,
2967
4377
  PERMISSION_REQUIRED_ENDPOINTS,
2968
4378
  Page,
2969
4379
  PasswordResetToken,
4380
+ Payment,
2970
4381
  Permission,
4382
+ Product,
4383
+ ProductAttribute,
4384
+ ProductCategory,
4385
+ ProductTax,
2971
4386
  Seo,
2972
4387
  Tag,
4388
+ Tax,
2973
4389
  User,
2974
4390
  UserGroup,
2975
4391
  analyticsPlugin,