@djangocfg/api 2.1.138 → 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.
- package/dist/auth-server.cjs +2 -199
- package/dist/auth-server.cjs.map +1 -1
- package/dist/auth-server.mjs +2 -199
- package/dist/auth-server.mjs.map +1 -1
- package/dist/auth.cjs +11 -836
- package/dist/auth.cjs.map +1 -1
- package/dist/auth.mjs +11 -836
- package/dist/auth.mjs.map +1 -1
- package/dist/clients.cjs +40 -1077
- package/dist/clients.cjs.map +1 -1
- package/dist/clients.d.cts +209 -754
- package/dist/clients.d.ts +209 -754
- package/dist/clients.mjs +40 -1077
- package/dist/clients.mjs.map +1 -1
- package/dist/index.cjs +0 -1198
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +229 -1211
- package/dist/index.d.ts +229 -1211
- package/dist/index.mjs +0 -1198
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/clients.ts +2 -12
- package/src/index.ts +0 -6
- package/src/generated/cfg_webpush/CLAUDE.md +0 -63
- package/src/generated/cfg_webpush/_utils/fetchers/index.ts +0 -29
- package/src/generated/cfg_webpush/_utils/fetchers/webpush__web_push.ts +0 -211
- package/src/generated/cfg_webpush/_utils/hooks/index.ts +0 -29
- package/src/generated/cfg_webpush/_utils/hooks/webpush__web_push.ts +0 -79
- package/src/generated/cfg_webpush/_utils/schemas/SendPushRequestRequest.schema.ts +0 -22
- package/src/generated/cfg_webpush/_utils/schemas/SendPushResponse.schema.ts +0 -20
- package/src/generated/cfg_webpush/_utils/schemas/SubscribeRequestRequest.schema.ts +0 -20
- package/src/generated/cfg_webpush/_utils/schemas/SubscribeResponse.schema.ts +0 -21
- package/src/generated/cfg_webpush/_utils/schemas/VapidPublicKeyResponse.schema.ts +0 -19
- package/src/generated/cfg_webpush/_utils/schemas/index.ts +0 -24
- package/src/generated/cfg_webpush/api-instance.ts +0 -180
- package/src/generated/cfg_webpush/client.ts +0 -322
- package/src/generated/cfg_webpush/errors.ts +0 -117
- package/src/generated/cfg_webpush/http.ts +0 -110
- package/src/generated/cfg_webpush/index.ts +0 -275
- package/src/generated/cfg_webpush/logger.ts +0 -260
- package/src/generated/cfg_webpush/retry.ts +0 -176
- package/src/generated/cfg_webpush/schema.json +0 -302
- package/src/generated/cfg_webpush/storage.ts +0 -162
- package/src/generated/cfg_webpush/validation-events.ts +0 -134
- package/src/generated/cfg_webpush/webpush__web_push/client.ts +0 -45
- package/src/generated/cfg_webpush/webpush__web_push/index.ts +0 -3
- package/src/generated/cfg_webpush/webpush__web_push/models.ts +0 -65
- package/src/hooks/webpush.ts +0 -12
package/dist/auth-server.cjs
CHANGED
|
@@ -1689,203 +1689,6 @@ var import_consola9 = require("consola");
|
|
|
1689
1689
|
// src/generated/cfg_centrifugo/_utils/fetchers/centrifugo__centrifugo_testing.ts
|
|
1690
1690
|
var import_consola10 = require("consola");
|
|
1691
1691
|
|
|
1692
|
-
// src/generated/cfg_webpush/logger.ts
|
|
1693
|
-
var import_consola11 = require("consola");
|
|
1694
|
-
var DEFAULT_CONFIG3 = {
|
|
1695
|
-
enabled: process.env.NODE_ENV !== "production",
|
|
1696
|
-
logRequests: true,
|
|
1697
|
-
logResponses: true,
|
|
1698
|
-
logErrors: true,
|
|
1699
|
-
logBodies: true,
|
|
1700
|
-
logHeaders: false
|
|
1701
|
-
};
|
|
1702
|
-
var SENSITIVE_HEADERS3 = [
|
|
1703
|
-
"authorization",
|
|
1704
|
-
"cookie",
|
|
1705
|
-
"set-cookie",
|
|
1706
|
-
"x-api-key",
|
|
1707
|
-
"x-csrf-token"
|
|
1708
|
-
];
|
|
1709
|
-
var APILogger3 = class {
|
|
1710
|
-
static {
|
|
1711
|
-
__name(this, "APILogger");
|
|
1712
|
-
}
|
|
1713
|
-
constructor(config = {}) {
|
|
1714
|
-
this.config = { ...DEFAULT_CONFIG3, ...config };
|
|
1715
|
-
this.consola = config.consola || (0, import_consola11.createConsola)({
|
|
1716
|
-
level: this.config.enabled ? 4 : 0
|
|
1717
|
-
});
|
|
1718
|
-
}
|
|
1719
|
-
/**
|
|
1720
|
-
* Enable logging
|
|
1721
|
-
*/
|
|
1722
|
-
enable() {
|
|
1723
|
-
this.config.enabled = true;
|
|
1724
|
-
}
|
|
1725
|
-
/**
|
|
1726
|
-
* Disable logging
|
|
1727
|
-
*/
|
|
1728
|
-
disable() {
|
|
1729
|
-
this.config.enabled = false;
|
|
1730
|
-
}
|
|
1731
|
-
/**
|
|
1732
|
-
* Update configuration
|
|
1733
|
-
*/
|
|
1734
|
-
setConfig(config) {
|
|
1735
|
-
this.config = { ...this.config, ...config };
|
|
1736
|
-
}
|
|
1737
|
-
/**
|
|
1738
|
-
* Filter sensitive headers
|
|
1739
|
-
*/
|
|
1740
|
-
filterHeaders(headers) {
|
|
1741
|
-
if (!headers) return {};
|
|
1742
|
-
const filtered = {};
|
|
1743
|
-
Object.keys(headers).forEach((key) => {
|
|
1744
|
-
const lowerKey = key.toLowerCase();
|
|
1745
|
-
if (SENSITIVE_HEADERS3.includes(lowerKey)) {
|
|
1746
|
-
filtered[key] = "***";
|
|
1747
|
-
} else {
|
|
1748
|
-
filtered[key] = headers[key] || "";
|
|
1749
|
-
}
|
|
1750
|
-
});
|
|
1751
|
-
return filtered;
|
|
1752
|
-
}
|
|
1753
|
-
/**
|
|
1754
|
-
* Log request
|
|
1755
|
-
*/
|
|
1756
|
-
logRequest(request) {
|
|
1757
|
-
if (!this.config.enabled || !this.config.logRequests) return;
|
|
1758
|
-
const { method, url, headers, body } = request;
|
|
1759
|
-
this.consola.start(`${method} ${url}`);
|
|
1760
|
-
if (this.config.logHeaders && headers) {
|
|
1761
|
-
this.consola.debug("Headers:", this.filterHeaders(headers));
|
|
1762
|
-
}
|
|
1763
|
-
if (this.config.logBodies && body) {
|
|
1764
|
-
this.consola.debug("Body:", body);
|
|
1765
|
-
}
|
|
1766
|
-
}
|
|
1767
|
-
/**
|
|
1768
|
-
* Log response
|
|
1769
|
-
*/
|
|
1770
|
-
logResponse(request, response) {
|
|
1771
|
-
if (!this.config.enabled || !this.config.logResponses) return;
|
|
1772
|
-
const { method, url } = request;
|
|
1773
|
-
const { status, statusText, data, duration } = response;
|
|
1774
|
-
const statusColor = status >= 500 ? "red" : status >= 400 ? "yellow" : status >= 300 ? "cyan" : "green";
|
|
1775
|
-
this.consola.success(
|
|
1776
|
-
`${method} ${url} ${status} ${statusText} (${duration}ms)`
|
|
1777
|
-
);
|
|
1778
|
-
if (this.config.logBodies && data) {
|
|
1779
|
-
this.consola.debug("Response:", data);
|
|
1780
|
-
}
|
|
1781
|
-
}
|
|
1782
|
-
/**
|
|
1783
|
-
* Log error
|
|
1784
|
-
*/
|
|
1785
|
-
logError(request, error) {
|
|
1786
|
-
if (!this.config.enabled || !this.config.logErrors) return;
|
|
1787
|
-
const { method, url } = request;
|
|
1788
|
-
const { message, statusCode, fieldErrors, duration } = error;
|
|
1789
|
-
this.consola.error(
|
|
1790
|
-
`${method} ${url} ${statusCode || "Network"} Error (${duration}ms)`
|
|
1791
|
-
);
|
|
1792
|
-
this.consola.error("Message:", message);
|
|
1793
|
-
if (fieldErrors && Object.keys(fieldErrors).length > 0) {
|
|
1794
|
-
this.consola.error("Field Errors:");
|
|
1795
|
-
Object.entries(fieldErrors).forEach(([field, errors]) => {
|
|
1796
|
-
errors.forEach((err) => {
|
|
1797
|
-
this.consola.error(` \u2022 ${field}: ${err}`);
|
|
1798
|
-
});
|
|
1799
|
-
});
|
|
1800
|
-
}
|
|
1801
|
-
}
|
|
1802
|
-
/**
|
|
1803
|
-
* Log general info
|
|
1804
|
-
*/
|
|
1805
|
-
info(message, ...args) {
|
|
1806
|
-
if (!this.config.enabled) return;
|
|
1807
|
-
this.consola.info(message, ...args);
|
|
1808
|
-
}
|
|
1809
|
-
/**
|
|
1810
|
-
* Log warning
|
|
1811
|
-
*/
|
|
1812
|
-
warn(message, ...args) {
|
|
1813
|
-
if (!this.config.enabled) return;
|
|
1814
|
-
this.consola.warn(message, ...args);
|
|
1815
|
-
}
|
|
1816
|
-
/**
|
|
1817
|
-
* Log error
|
|
1818
|
-
*/
|
|
1819
|
-
error(message, ...args) {
|
|
1820
|
-
if (!this.config.enabled) return;
|
|
1821
|
-
this.consola.error(message, ...args);
|
|
1822
|
-
}
|
|
1823
|
-
/**
|
|
1824
|
-
* Log debug
|
|
1825
|
-
*/
|
|
1826
|
-
debug(message, ...args) {
|
|
1827
|
-
if (!this.config.enabled) return;
|
|
1828
|
-
this.consola.debug(message, ...args);
|
|
1829
|
-
}
|
|
1830
|
-
/**
|
|
1831
|
-
* Log success
|
|
1832
|
-
*/
|
|
1833
|
-
success(message, ...args) {
|
|
1834
|
-
if (!this.config.enabled) return;
|
|
1835
|
-
this.consola.success(message, ...args);
|
|
1836
|
-
}
|
|
1837
|
-
/**
|
|
1838
|
-
* Create a sub-logger with prefix
|
|
1839
|
-
*/
|
|
1840
|
-
withTag(tag) {
|
|
1841
|
-
return this.consola.withTag(tag);
|
|
1842
|
-
}
|
|
1843
|
-
};
|
|
1844
|
-
var defaultLogger3 = new APILogger3();
|
|
1845
|
-
|
|
1846
|
-
// src/generated/cfg_webpush/retry.ts
|
|
1847
|
-
var import_p_retry3 = __toESM(require("p-retry"), 1);
|
|
1848
|
-
|
|
1849
|
-
// src/generated/cfg_webpush/_utils/schemas/SendPushRequestRequest.schema.ts
|
|
1850
|
-
var import_zod57 = require("zod");
|
|
1851
|
-
var SendPushRequestRequestSchema = import_zod57.z.object({
|
|
1852
|
-
title: import_zod57.z.string().min(1).max(255),
|
|
1853
|
-
body: import_zod57.z.string().min(1),
|
|
1854
|
-
icon: import_zod57.z.union([import_zod57.z.url(), import_zod57.z.literal("")]).nullable().optional(),
|
|
1855
|
-
url: import_zod57.z.union([import_zod57.z.url(), import_zod57.z.literal("")]).nullable().optional()
|
|
1856
|
-
});
|
|
1857
|
-
|
|
1858
|
-
// src/generated/cfg_webpush/_utils/schemas/SendPushResponse.schema.ts
|
|
1859
|
-
var import_zod58 = require("zod");
|
|
1860
|
-
var SendPushResponseSchema = import_zod58.z.object({
|
|
1861
|
-
success: import_zod58.z.boolean(),
|
|
1862
|
-
sent_to: import_zod58.z.int()
|
|
1863
|
-
});
|
|
1864
|
-
|
|
1865
|
-
// src/generated/cfg_webpush/_utils/schemas/SubscribeRequestRequest.schema.ts
|
|
1866
|
-
var import_zod59 = require("zod");
|
|
1867
|
-
var SubscribeRequestRequestSchema = import_zod59.z.object({
|
|
1868
|
-
endpoint: import_zod59.z.union([import_zod59.z.url(), import_zod59.z.literal("")]),
|
|
1869
|
-
keys: import_zod59.z.record(import_zod59.z.string(), import_zod59.z.string().min(1))
|
|
1870
|
-
});
|
|
1871
|
-
|
|
1872
|
-
// src/generated/cfg_webpush/_utils/schemas/SubscribeResponse.schema.ts
|
|
1873
|
-
var import_zod60 = require("zod");
|
|
1874
|
-
var SubscribeResponseSchema = import_zod60.z.object({
|
|
1875
|
-
success: import_zod60.z.boolean(),
|
|
1876
|
-
subscription_id: import_zod60.z.int(),
|
|
1877
|
-
created: import_zod60.z.boolean()
|
|
1878
|
-
});
|
|
1879
|
-
|
|
1880
|
-
// src/generated/cfg_webpush/_utils/schemas/VapidPublicKeyResponse.schema.ts
|
|
1881
|
-
var import_zod61 = require("zod");
|
|
1882
|
-
var VapidPublicKeyResponseSchema = import_zod61.z.object({
|
|
1883
|
-
publicKey: import_zod61.z.string()
|
|
1884
|
-
});
|
|
1885
|
-
|
|
1886
|
-
// src/generated/cfg_webpush/_utils/fetchers/webpush__web_push.ts
|
|
1887
|
-
var import_consola12 = require("consola");
|
|
1888
|
-
|
|
1889
1692
|
// src/index.ts
|
|
1890
1693
|
var isStaticBuild = process.env.NEXT_PUBLIC_STATIC_BUILD === "true";
|
|
1891
1694
|
var apiUrl = isStaticBuild ? "" : process.env.NEXT_PUBLIC_API_URL || "";
|
|
@@ -1905,11 +1708,11 @@ var BaseClient = class {
|
|
|
1905
1708
|
};
|
|
1906
1709
|
|
|
1907
1710
|
// src/auth/utils/logger.ts
|
|
1908
|
-
var
|
|
1711
|
+
var import_consola11 = require("consola");
|
|
1909
1712
|
var isDevelopment = process.env.NODE_ENV === "development";
|
|
1910
1713
|
var isStaticBuild2 = process.env.NEXT_PUBLIC_STATIC_BUILD === "true";
|
|
1911
1714
|
var showLogs = isDevelopment || isStaticBuild2;
|
|
1912
|
-
var logger = (0,
|
|
1715
|
+
var logger = (0, import_consola11.createConsola)({
|
|
1913
1716
|
level: showLogs ? 4 : 1
|
|
1914
1717
|
// dev: debug, production: errors only
|
|
1915
1718
|
}).withTag("api");
|