@djangocfg/api 2.1.139 → 2.1.140

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/dist/auth-server.cjs +2 -199
  2. package/dist/auth-server.cjs.map +1 -1
  3. package/dist/auth-server.mjs +2 -199
  4. package/dist/auth-server.mjs.map +1 -1
  5. package/dist/auth.cjs +11 -836
  6. package/dist/auth.cjs.map +1 -1
  7. package/dist/auth.mjs +11 -836
  8. package/dist/auth.mjs.map +1 -1
  9. package/dist/clients.cjs +40 -1077
  10. package/dist/clients.cjs.map +1 -1
  11. package/dist/clients.d.cts +209 -754
  12. package/dist/clients.d.ts +209 -754
  13. package/dist/clients.mjs +40 -1077
  14. package/dist/clients.mjs.map +1 -1
  15. package/dist/index.cjs +0 -1198
  16. package/dist/index.cjs.map +1 -1
  17. package/dist/index.d.cts +229 -1211
  18. package/dist/index.d.ts +229 -1211
  19. package/dist/index.mjs +0 -1198
  20. package/dist/index.mjs.map +1 -1
  21. package/package.json +2 -2
  22. package/src/clients.ts +2 -12
  23. package/src/index.ts +0 -6
  24. package/src/generated/cfg_webpush/CLAUDE.md +0 -63
  25. package/src/generated/cfg_webpush/_utils/fetchers/index.ts +0 -29
  26. package/src/generated/cfg_webpush/_utils/fetchers/webpush__web_push.ts +0 -211
  27. package/src/generated/cfg_webpush/_utils/hooks/index.ts +0 -29
  28. package/src/generated/cfg_webpush/_utils/hooks/webpush__web_push.ts +0 -79
  29. package/src/generated/cfg_webpush/_utils/schemas/SendPushRequestRequest.schema.ts +0 -22
  30. package/src/generated/cfg_webpush/_utils/schemas/SendPushResponse.schema.ts +0 -20
  31. package/src/generated/cfg_webpush/_utils/schemas/SubscribeRequestRequest.schema.ts +0 -20
  32. package/src/generated/cfg_webpush/_utils/schemas/SubscribeResponse.schema.ts +0 -21
  33. package/src/generated/cfg_webpush/_utils/schemas/VapidPublicKeyResponse.schema.ts +0 -19
  34. package/src/generated/cfg_webpush/_utils/schemas/index.ts +0 -24
  35. package/src/generated/cfg_webpush/api-instance.ts +0 -180
  36. package/src/generated/cfg_webpush/client.ts +0 -322
  37. package/src/generated/cfg_webpush/errors.ts +0 -117
  38. package/src/generated/cfg_webpush/http.ts +0 -110
  39. package/src/generated/cfg_webpush/index.ts +0 -275
  40. package/src/generated/cfg_webpush/logger.ts +0 -260
  41. package/src/generated/cfg_webpush/retry.ts +0 -176
  42. package/src/generated/cfg_webpush/schema.json +0 -302
  43. package/src/generated/cfg_webpush/storage.ts +0 -162
  44. package/src/generated/cfg_webpush/validation-events.ts +0 -134
  45. package/src/generated/cfg_webpush/webpush__web_push/client.ts +0 -45
  46. package/src/generated/cfg_webpush/webpush__web_push/index.ts +0 -3
  47. package/src/generated/cfg_webpush/webpush__web_push/models.ts +0 -65
  48. package/src/hooks/webpush.ts +0 -12
@@ -1650,203 +1650,6 @@ import { consola as consola7 } from "consola";
1650
1650
  // src/generated/cfg_centrifugo/_utils/fetchers/centrifugo__centrifugo_testing.ts
1651
1651
  import { consola as consola8 } from "consola";
1652
1652
 
1653
- // src/generated/cfg_webpush/logger.ts
1654
- import { createConsola as createConsola3 } from "consola";
1655
- var DEFAULT_CONFIG3 = {
1656
- enabled: process.env.NODE_ENV !== "production",
1657
- logRequests: true,
1658
- logResponses: true,
1659
- logErrors: true,
1660
- logBodies: true,
1661
- logHeaders: false
1662
- };
1663
- var SENSITIVE_HEADERS3 = [
1664
- "authorization",
1665
- "cookie",
1666
- "set-cookie",
1667
- "x-api-key",
1668
- "x-csrf-token"
1669
- ];
1670
- var APILogger3 = class {
1671
- static {
1672
- __name(this, "APILogger");
1673
- }
1674
- constructor(config = {}) {
1675
- this.config = { ...DEFAULT_CONFIG3, ...config };
1676
- this.consola = config.consola || createConsola3({
1677
- level: this.config.enabled ? 4 : 0
1678
- });
1679
- }
1680
- /**
1681
- * Enable logging
1682
- */
1683
- enable() {
1684
- this.config.enabled = true;
1685
- }
1686
- /**
1687
- * Disable logging
1688
- */
1689
- disable() {
1690
- this.config.enabled = false;
1691
- }
1692
- /**
1693
- * Update configuration
1694
- */
1695
- setConfig(config) {
1696
- this.config = { ...this.config, ...config };
1697
- }
1698
- /**
1699
- * Filter sensitive headers
1700
- */
1701
- filterHeaders(headers) {
1702
- if (!headers) return {};
1703
- const filtered = {};
1704
- Object.keys(headers).forEach((key) => {
1705
- const lowerKey = key.toLowerCase();
1706
- if (SENSITIVE_HEADERS3.includes(lowerKey)) {
1707
- filtered[key] = "***";
1708
- } else {
1709
- filtered[key] = headers[key] || "";
1710
- }
1711
- });
1712
- return filtered;
1713
- }
1714
- /**
1715
- * Log request
1716
- */
1717
- logRequest(request) {
1718
- if (!this.config.enabled || !this.config.logRequests) return;
1719
- const { method, url, headers, body } = request;
1720
- this.consola.start(`${method} ${url}`);
1721
- if (this.config.logHeaders && headers) {
1722
- this.consola.debug("Headers:", this.filterHeaders(headers));
1723
- }
1724
- if (this.config.logBodies && body) {
1725
- this.consola.debug("Body:", body);
1726
- }
1727
- }
1728
- /**
1729
- * Log response
1730
- */
1731
- logResponse(request, response) {
1732
- if (!this.config.enabled || !this.config.logResponses) return;
1733
- const { method, url } = request;
1734
- const { status, statusText, data, duration } = response;
1735
- const statusColor = status >= 500 ? "red" : status >= 400 ? "yellow" : status >= 300 ? "cyan" : "green";
1736
- this.consola.success(
1737
- `${method} ${url} ${status} ${statusText} (${duration}ms)`
1738
- );
1739
- if (this.config.logBodies && data) {
1740
- this.consola.debug("Response:", data);
1741
- }
1742
- }
1743
- /**
1744
- * Log error
1745
- */
1746
- logError(request, error) {
1747
- if (!this.config.enabled || !this.config.logErrors) return;
1748
- const { method, url } = request;
1749
- const { message, statusCode, fieldErrors, duration } = error;
1750
- this.consola.error(
1751
- `${method} ${url} ${statusCode || "Network"} Error (${duration}ms)`
1752
- );
1753
- this.consola.error("Message:", message);
1754
- if (fieldErrors && Object.keys(fieldErrors).length > 0) {
1755
- this.consola.error("Field Errors:");
1756
- Object.entries(fieldErrors).forEach(([field, errors]) => {
1757
- errors.forEach((err) => {
1758
- this.consola.error(` \u2022 ${field}: ${err}`);
1759
- });
1760
- });
1761
- }
1762
- }
1763
- /**
1764
- * Log general info
1765
- */
1766
- info(message, ...args) {
1767
- if (!this.config.enabled) return;
1768
- this.consola.info(message, ...args);
1769
- }
1770
- /**
1771
- * Log warning
1772
- */
1773
- warn(message, ...args) {
1774
- if (!this.config.enabled) return;
1775
- this.consola.warn(message, ...args);
1776
- }
1777
- /**
1778
- * Log error
1779
- */
1780
- error(message, ...args) {
1781
- if (!this.config.enabled) return;
1782
- this.consola.error(message, ...args);
1783
- }
1784
- /**
1785
- * Log debug
1786
- */
1787
- debug(message, ...args) {
1788
- if (!this.config.enabled) return;
1789
- this.consola.debug(message, ...args);
1790
- }
1791
- /**
1792
- * Log success
1793
- */
1794
- success(message, ...args) {
1795
- if (!this.config.enabled) return;
1796
- this.consola.success(message, ...args);
1797
- }
1798
- /**
1799
- * Create a sub-logger with prefix
1800
- */
1801
- withTag(tag) {
1802
- return this.consola.withTag(tag);
1803
- }
1804
- };
1805
- var defaultLogger3 = new APILogger3();
1806
-
1807
- // src/generated/cfg_webpush/retry.ts
1808
- import pRetry3, { AbortError as AbortError3 } from "p-retry";
1809
-
1810
- // src/generated/cfg_webpush/_utils/schemas/SendPushRequestRequest.schema.ts
1811
- import { z as z57 } from "zod";
1812
- var SendPushRequestRequestSchema = z57.object({
1813
- title: z57.string().min(1).max(255),
1814
- body: z57.string().min(1),
1815
- icon: z57.union([z57.url(), z57.literal("")]).nullable().optional(),
1816
- url: z57.union([z57.url(), z57.literal("")]).nullable().optional()
1817
- });
1818
-
1819
- // src/generated/cfg_webpush/_utils/schemas/SendPushResponse.schema.ts
1820
- import { z as z58 } from "zod";
1821
- var SendPushResponseSchema = z58.object({
1822
- success: z58.boolean(),
1823
- sent_to: z58.int()
1824
- });
1825
-
1826
- // src/generated/cfg_webpush/_utils/schemas/SubscribeRequestRequest.schema.ts
1827
- import { z as z59 } from "zod";
1828
- var SubscribeRequestRequestSchema = z59.object({
1829
- endpoint: z59.union([z59.url(), z59.literal("")]),
1830
- keys: z59.record(z59.string(), z59.string().min(1))
1831
- });
1832
-
1833
- // src/generated/cfg_webpush/_utils/schemas/SubscribeResponse.schema.ts
1834
- import { z as z60 } from "zod";
1835
- var SubscribeResponseSchema = z60.object({
1836
- success: z60.boolean(),
1837
- subscription_id: z60.int(),
1838
- created: z60.boolean()
1839
- });
1840
-
1841
- // src/generated/cfg_webpush/_utils/schemas/VapidPublicKeyResponse.schema.ts
1842
- import { z as z61 } from "zod";
1843
- var VapidPublicKeyResponseSchema = z61.object({
1844
- publicKey: z61.string()
1845
- });
1846
-
1847
- // src/generated/cfg_webpush/_utils/fetchers/webpush__web_push.ts
1848
- import { consola as consola9 } from "consola";
1849
-
1850
1653
  // src/index.ts
1851
1654
  var isStaticBuild = process.env.NEXT_PUBLIC_STATIC_BUILD === "true";
1852
1655
  var apiUrl = isStaticBuild ? "" : process.env.NEXT_PUBLIC_API_URL || "";
@@ -1866,11 +1669,11 @@ var BaseClient = class {
1866
1669
  };
1867
1670
 
1868
1671
  // src/auth/utils/logger.ts
1869
- import { createConsola as createConsola4 } from "consola";
1672
+ import { createConsola as createConsola3 } from "consola";
1870
1673
  var isDevelopment = process.env.NODE_ENV === "development";
1871
1674
  var isStaticBuild2 = process.env.NEXT_PUBLIC_STATIC_BUILD === "true";
1872
1675
  var showLogs = isDevelopment || isStaticBuild2;
1873
- var logger = createConsola4({
1676
+ var logger = createConsola3({
1874
1677
  level: showLogs ? 4 : 1
1875
1678
  // dev: debug, production: errors only
1876
1679
  }).withTag("api");