appos 0.3.5-0 → 0.3.7-0
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/bin/main.mjs +3 -3
- package/dist/bin/youch-handler-D7REmh8Z.mjs +2 -0
- package/dist/exports/api/adapter-C2mMJKvG.mjs +1504 -0
- package/dist/exports/api/{auth-schema.mjs → auth-schema-CON4yFFY.mjs} +2 -3
- package/dist/exports/api/bun-sqlite-dialect-CPpPZa23.mjs +155 -0
- package/dist/exports/{cli/_virtual/rolldown_runtime.mjs → api/chunk-CyXqrcp_.mjs} +14 -1
- package/dist/exports/api/conditions-DjBAWfiK.mjs +116 -0
- package/dist/exports/api/dialect-CUUD24Ge.mjs +72 -0
- package/dist/exports/api/env-CwT3zhez.mjs +1 -0
- package/dist/exports/api/esm-_hkVMulx.mjs +15816 -0
- package/dist/exports/api/event-BHFSE6hY.mjs +20983 -0
- package/dist/exports/api/extract-blob-metadata-BMgUEPcW.mjs +4 -0
- package/dist/exports/api/extract-blob-metadata-_9RUEwoU.mjs +9818 -0
- package/dist/exports/api/generate-image-variant-DOIzj1wJ.mjs +4 -0
- package/dist/exports/api/generate-image-variant-DxOPoGAk.mjs +118 -0
- package/dist/exports/api/generate-preview-CvTFuq58.mjs +160 -0
- package/dist/exports/api/generate-preview-Dk3coswZ.mjs +4 -0
- package/dist/exports/api/index.d.mts +7347 -20
- package/dist/exports/api/index.mjs +146856 -18
- package/dist/exports/api/kysely-adapter-CmP2TbkS.mjs +296 -0
- package/dist/exports/api/memory-adapter-BzhRhLFK.mjs +212 -0
- package/dist/exports/api/node-sqlite-dialect-Bl5suBxl.mjs +155 -0
- package/dist/exports/api/orm-CMqufD21.mjs +153690 -0
- package/dist/exports/api/orm-DXqYuKvB.d.mts +11 -0
- package/dist/exports/api/orm.d.mts +2 -11
- package/dist/exports/api/orm.mjs +4 -42
- package/dist/exports/api/pdf-YxB2Hm1p.mjs +25822 -0
- package/dist/exports/api/purge-attachment-Cf6KH2Jv.mjs +34 -0
- package/dist/exports/api/purge-attachment-DIuil7ps.mjs +4 -0
- package/dist/exports/{cli/api/workflows/purge-audit-logs.mjs → api/purge-audit-logs-z6j_Pu47.mjs} +3 -3
- package/dist/exports/{cli/api/workflows/purge-unattached-blobs.mjs → api/purge-unattached-blobs-B0TfY5Hk.mjs} +1 -1
- package/dist/exports/api/react-BYhV5bYt.mjs +1131 -0
- package/dist/exports/api/server.node-DyVrQ6cz.mjs +19298 -0
- package/dist/exports/api/table-6bTIEqON.mjs +2636 -0
- package/dist/exports/api/{workflows/track-db-changes.mjs → track-db-changes-BysaV6nN.mjs} +14 -14
- package/dist/exports/api/{workflow.mjs → workflow-BuSWHcX-.mjs} +121 -10
- package/dist/exports/api/workflows/auth-schema-BFve3hgZ.mjs +2813 -0
- package/dist/exports/api/workflows/{_virtual/rolldown_runtime.mjs → chunk-B36mNPO4.mjs} +5 -1
- package/dist/exports/api/workflows/extract-blob-metadata-BcWKvY2K.mjs +9818 -0
- package/dist/exports/{cli/api/workflows/generate-image-variant.mjs → api/workflows/generate-image-variant-BAFvL_zV.mjs} +20 -20
- package/dist/exports/{cli/api/workflows/generate-preview.mjs → api/workflows/generate-preview-BjlIVYYp.mjs} +6 -6
- package/dist/exports/api/workflows/index.d.mts +2011 -1
- package/dist/exports/api/workflows/index.mjs +2 -1
- package/dist/exports/api/workflows/pdf-DUB8zyIc.mjs +25822 -0
- package/dist/exports/{cli/api/workflows/purge-attachment.mjs → api/workflows/purge-attachment-k_sdxTPY.mjs} +3 -3
- package/dist/exports/api/workflows/{purge-audit-logs.mjs → purge-audit-logs-zCyWj4Mw.mjs} +12 -3
- package/dist/exports/api/workflows/{purge-unattached-blobs.mjs → purge-unattached-blobs-CdsuFAeW.mjs} +1 -1
- package/dist/exports/api/workflows/track-db-changes-CiKaI9gT.mjs +20943 -0
- package/dist/exports/api/workflows/track-db-changes-DEWQYryO.mjs +4 -0
- package/dist/exports/{cli/api/workflow.mjs → api/workflows/workflow-BjM2xCa6.mjs} +23 -3
- package/dist/exports/api/workflows/zod-Br0enFWK.mjs +12333 -0
- package/dist/exports/api/zod-CdrJdBtV.mjs +12571 -0
- package/dist/exports/cli/auth-schema-CNuOqPi-.mjs +2813 -0
- package/dist/exports/{api/_virtual/rolldown_runtime.mjs → cli/chunk-B36mNPO4.mjs} +5 -1
- package/dist/exports/cli/extract-blob-metadata-CV1Ke90d.mjs +9818 -0
- package/dist/exports/{api/workflows/generate-image-variant.mjs → cli/generate-image-variant-CM1BrVvZ.mjs} +20 -20
- package/dist/exports/{api/workflows/generate-preview.mjs → cli/generate-preview-DdHQ3ukz.mjs} +6 -6
- package/dist/exports/cli/index.d.mts +2142 -2
- package/dist/exports/cli/index.mjs +41 -1
- package/dist/exports/cli/pdf-CLUPEIdT.mjs +25822 -0
- package/dist/exports/{api/workflows/purge-attachment.mjs → cli/purge-attachment-Dc_J74dG.mjs} +3 -3
- package/dist/exports/cli/purge-audit-logs-DFhWh-Bx.mjs +56 -0
- package/dist/exports/cli/purge-unattached-blobs-C1MRlM_2.mjs +46 -0
- package/dist/exports/cli/track-db-changes-CfneOF2_.mjs +20943 -0
- package/dist/exports/{api/workflows/api/workflow.mjs → cli/workflow-DSbbXBMt.mjs} +23 -3
- package/dist/exports/cli/zod-7q0_Mtnn.mjs +12333 -0
- package/dist/exports/tests/api.d.mts +7354 -5
- package/dist/exports/tests/api.mjs +79 -1
- package/dist/exports/tests/auth-schema-B_qHPoa4.mjs +1 -0
- package/dist/exports/tests/chunk-Cii4FAhs.mjs +1 -0
- package/dist/exports/tests/conditions-BeWxRN_Z.mjs +1 -0
- package/dist/exports/tests/constants-D_m07gCJ.mjs +1 -0
- package/dist/exports/tests/dist-Cx2HEBOB.mjs +296 -0
- package/dist/exports/tests/dist-DnACOvNW.mjs +7 -0
- package/dist/exports/tests/extract-blob-metadata-6xQrarjB.mjs +169 -0
- package/dist/exports/tests/generate-image-variant-KQITLmCx.mjs +1 -0
- package/dist/exports/tests/generate-preview-YnujQo5I.mjs +1 -0
- package/dist/exports/tests/mock-BvoS23fi.mjs +1 -0
- package/dist/exports/tests/mock.mjs +1 -1
- package/dist/exports/tests/pdf-lZ-as2o7.mjs +13 -0
- package/dist/exports/tests/purge-attachment-DTSmCl-z.mjs +1 -0
- package/dist/exports/tests/purge-audit-logs-D0_UUhN2.mjs +1 -0
- package/dist/exports/tests/purge-unattached-blobs-IENmSB8K.mjs +1 -0
- package/dist/exports/tests/react.mjs +6 -1
- package/dist/exports/tests/setup.d.mts +1 -1
- package/dist/exports/tests/setup.mjs +34 -1
- package/dist/exports/tests/table-CmPSf_pE.mjs +1 -0
- package/dist/exports/tests/track-db-changes-Td9Q3DLd.mjs +1 -0
- package/dist/exports/tests/{api/workflow.mjs → workflow-BWRWyC83.mjs} +1 -1
- package/dist/exports/tests/youch-handler-efUxKCCs.mjs +1 -0
- package/dist/exports/tests/zod-CkJO9qpV.mjs +23 -0
- package/dist/exports/vendors/date.js +13236 -1
- package/dist/exports/vendors/toolkit.js +2206 -1
- package/dist/exports/vendors/zod.js +12344 -1
- package/dist/exports/vite/index.d.mts +1 -1
- package/dist/exports/vite/index.mjs +26 -1
- package/dist/exports/vite/lib-B0s0q6aX.mjs +382 -0
- package/dist/exports/vite/lib-BkrbWMaV.mjs +1 -0
- package/dist/exports/web/browser-ponyfill-DxTJMXNq.js +443 -0
- package/dist/exports/web/chunk-DksrlJLg.js +49 -0
- package/dist/exports/web/index.d.ts +2546 -2
- package/dist/exports/web/index.js +9295 -6
- package/dist/exports/web/plugin-DqTFWG7p.js +250 -0
- package/package.json +1 -7
- package/dist/bin/youch-handler-DrYdbUhe.mjs +0 -2
- package/dist/exports/api/app-context.d.mts +0 -115
- package/dist/exports/api/app-context.mjs +0 -24
- package/dist/exports/api/auth-schema.d.mts +0 -4248
- package/dist/exports/api/auth.d.mts +0 -402
- package/dist/exports/api/auth.mjs +0 -188
- package/dist/exports/api/cache.d.mts +0 -44
- package/dist/exports/api/cache.mjs +0 -28
- package/dist/exports/api/config.d.mts +0 -28
- package/dist/exports/api/config.mjs +0 -72
- package/dist/exports/api/constants.mjs +0 -92
- package/dist/exports/api/container.d.mts +0 -210
- package/dist/exports/api/container.mjs +0 -49
- package/dist/exports/api/database.d.mts +0 -101
- package/dist/exports/api/database.mjs +0 -219
- package/dist/exports/api/event.d.mts +0 -235
- package/dist/exports/api/event.mjs +0 -236
- package/dist/exports/api/i18n.d.mts +0 -34
- package/dist/exports/api/i18n.mjs +0 -45
- package/dist/exports/api/instrumentation.d.mts +0 -7
- package/dist/exports/api/instrumentation.mjs +0 -40
- package/dist/exports/api/logger.d.mts +0 -21
- package/dist/exports/api/logger.mjs +0 -26
- package/dist/exports/api/mailer.d.mts +0 -70
- package/dist/exports/api/mailer.mjs +0 -37
- package/dist/exports/api/middleware/request-logger.d.mts +0 -24
- package/dist/exports/api/middleware.d.mts +0 -39
- package/dist/exports/api/middleware.mjs +0 -73
- package/dist/exports/api/openapi.d.mts +0 -271
- package/dist/exports/api/openapi.mjs +0 -507
- package/dist/exports/api/otel.d.mts +0 -40
- package/dist/exports/api/otel.mjs +0 -56
- package/dist/exports/api/redis.d.mts +0 -34
- package/dist/exports/api/redis.mjs +0 -41
- package/dist/exports/api/storage-schema.d.mts +0 -707
- package/dist/exports/api/storage-schema.mjs +0 -72
- package/dist/exports/api/storage.d.mts +0 -506
- package/dist/exports/api/storage.mjs +0 -833
- package/dist/exports/api/web/auth.mjs +0 -17
- package/dist/exports/api/workflow.d.mts +0 -250
- package/dist/exports/api/workflows/api/auth-schema.mjs +0 -373
- package/dist/exports/api/workflows/api/auth.d.mts +0 -379
- package/dist/exports/api/workflows/api/cache.d.mts +0 -44
- package/dist/exports/api/workflows/api/config.d.mts +0 -18
- package/dist/exports/api/workflows/api/container.d.mts +0 -167
- package/dist/exports/api/workflows/api/database.d.mts +0 -47
- package/dist/exports/api/workflows/api/event.d.mts +0 -68
- package/dist/exports/api/workflows/api/event.mjs +0 -126
- package/dist/exports/api/workflows/api/logger.d.mts +0 -21
- package/dist/exports/api/workflows/api/mailer.d.mts +0 -70
- package/dist/exports/api/workflows/api/orm.d.mts +0 -13
- package/dist/exports/api/workflows/api/redis.mjs +0 -3
- package/dist/exports/api/workflows/api/storage-schema.d.mts +0 -699
- package/dist/exports/api/workflows/api/storage.d.mts +0 -396
- package/dist/exports/api/workflows/api/workflow.d.mts +0 -24
- package/dist/exports/api/workflows/constants.mjs +0 -23
- package/dist/exports/api/workflows/extract-blob-metadata.mjs +0 -132
- package/dist/exports/api/workflows/generate-image-variant.d.mts +0 -63
- package/dist/exports/api/workflows/track-db-changes.d.mts +0 -72
- package/dist/exports/cli/api/auth-schema.mjs +0 -373
- package/dist/exports/cli/api/auth.d.mts +0 -379
- package/dist/exports/cli/api/cache.d.mts +0 -44
- package/dist/exports/cli/api/config.d.mts +0 -18
- package/dist/exports/cli/api/container.d.mts +0 -167
- package/dist/exports/cli/api/database.d.mts +0 -47
- package/dist/exports/cli/api/event.d.mts +0 -68
- package/dist/exports/cli/api/event.mjs +0 -126
- package/dist/exports/cli/api/logger.d.mts +0 -21
- package/dist/exports/cli/api/mailer.d.mts +0 -70
- package/dist/exports/cli/api/orm.d.mts +0 -13
- package/dist/exports/cli/api/redis.mjs +0 -3
- package/dist/exports/cli/api/storage-schema.d.mts +0 -699
- package/dist/exports/cli/api/storage.d.mts +0 -396
- package/dist/exports/cli/api/workflow.d.mts +0 -2
- package/dist/exports/cli/api/workflows/extract-blob-metadata.mjs +0 -132
- package/dist/exports/cli/api/workflows/generate-image-variant.d.mts +0 -63
- package/dist/exports/cli/api/workflows/track-db-changes.mjs +0 -110
- package/dist/exports/cli/command.d.mts +0 -56
- package/dist/exports/cli/command.mjs +0 -43
- package/dist/exports/cli/constants.mjs +0 -23
- package/dist/exports/cli/context.d.mts +0 -170
- package/dist/exports/devtools/index.d.ts +0 -3
- package/dist/exports/devtools/index.js +0 -4
- package/dist/exports/tests/_virtual/rolldown_runtime.mjs +0 -1
- package/dist/exports/tests/api/app-context.d.mts +0 -115
- package/dist/exports/tests/api/app-context.mjs +0 -1
- package/dist/exports/tests/api/auth-schema.d.mts +0 -4248
- package/dist/exports/tests/api/auth-schema.mjs +0 -1
- package/dist/exports/tests/api/auth.d.mts +0 -402
- package/dist/exports/tests/api/cache.d.mts +0 -44
- package/dist/exports/tests/api/config.d.mts +0 -28
- package/dist/exports/tests/api/container.d.mts +0 -210
- package/dist/exports/tests/api/database.d.mts +0 -101
- package/dist/exports/tests/api/database.mjs +0 -1
- package/dist/exports/tests/api/event.d.mts +0 -235
- package/dist/exports/tests/api/event.mjs +0 -1
- package/dist/exports/tests/api/i18n.d.mts +0 -34
- package/dist/exports/tests/api/index.d.mts +0 -26
- package/dist/exports/tests/api/logger.d.mts +0 -21
- package/dist/exports/tests/api/mailer.d.mts +0 -70
- package/dist/exports/tests/api/middleware/error-handler.mjs +0 -1
- package/dist/exports/tests/api/middleware/health.mjs +0 -1
- package/dist/exports/tests/api/middleware/i18n.mjs +0 -1
- package/dist/exports/tests/api/middleware/request-logger.d.mts +0 -24
- package/dist/exports/tests/api/middleware/request-logger.mjs +0 -1
- package/dist/exports/tests/api/middleware/shutdown.mjs +0 -1
- package/dist/exports/tests/api/middleware/timeout.mjs +0 -1
- package/dist/exports/tests/api/middleware/youch-handler.mjs +0 -1
- package/dist/exports/tests/api/middleware.d.mts +0 -39
- package/dist/exports/tests/api/middleware.mjs +0 -1
- package/dist/exports/tests/api/openapi.d.mts +0 -271
- package/dist/exports/tests/api/openapi.mjs +0 -1
- package/dist/exports/tests/api/orm.d.mts +0 -13
- package/dist/exports/tests/api/otel.d.mts +0 -40
- package/dist/exports/tests/api/redis.d.mts +0 -34
- package/dist/exports/tests/api/redis.mjs +0 -1
- package/dist/exports/tests/api/server.mjs +0 -1
- package/dist/exports/tests/api/storage-schema.d.mts +0 -707
- package/dist/exports/tests/api/storage.d.mts +0 -506
- package/dist/exports/tests/api/workflow.d.mts +0 -250
- package/dist/exports/tests/api/workflows/extract-blob-metadata.mjs +0 -1
- package/dist/exports/tests/api/workflows/generate-image-variant.d.mts +0 -63
- package/dist/exports/tests/api/workflows/generate-image-variant.mjs +0 -1
- package/dist/exports/tests/api/workflows/generate-preview.mjs +0 -1
- package/dist/exports/tests/api/workflows/purge-attachment.mjs +0 -1
- package/dist/exports/tests/api/workflows/purge-audit-logs.mjs +0 -1
- package/dist/exports/tests/api/workflows/purge-unattached-blobs.mjs +0 -1
- package/dist/exports/tests/api/workflows/track-db-changes.mjs +0 -1
- package/dist/exports/tests/constants.mjs +0 -1
- package/dist/exports/tests/instrumentation.d.mts +0 -7
- package/dist/exports/tests/instrumentation.mjs +0 -1
- package/dist/exports/web/api/auth.d.ts +0 -125
- package/dist/exports/web/api/database.d.ts +0 -4
- package/dist/exports/web/api/logger.d.ts +0 -1
- package/dist/exports/web/auth.d.ts +0 -2388
- package/dist/exports/web/auth.js +0 -75
- package/dist/exports/web/i18n.d.ts +0 -42
- package/dist/exports/web/i18n.js +0 -45
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
import { a as __toCommonJS, i as __require, n as __esmMin, r as __export, t as __commonJSMin } from "./chunk-DksrlJLg.js";
|
|
2
|
+
|
|
3
|
+
//#region ../../node_modules/.bun/i18next-hmr@3.1.5/node_modules/i18next-hmr/lib/utils.js
|
|
4
|
+
var require_utils = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
5
|
+
function extractLangAndNS(changedFile, currentConfig) {
|
|
6
|
+
const changedFileParts = changedFile.replace(/\\/g, "/").split("/");
|
|
7
|
+
const firstLongestNSMatchParts = [].concat(currentConfig.namespaces).map((ns) => ns.split("/")).sort((a, b) => b.length - a.length).find((optionalNS) => optionalNS.every((optionalNSPart) => changedFileParts.includes(optionalNSPart)));
|
|
8
|
+
if (!firstLongestNSMatchParts) return {
|
|
9
|
+
lang: null,
|
|
10
|
+
ns: null
|
|
11
|
+
};
|
|
12
|
+
return {
|
|
13
|
+
lang: changedFileParts.filter((part) => !firstLongestNSMatchParts.includes(part) && currentConfig.languages.includes(part)).join("/"),
|
|
14
|
+
ns: firstLongestNSMatchParts.join("/")
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
function printList(list) {
|
|
18
|
+
return list.map((item) => `${item.lang}/${item.ns}`).join(", ");
|
|
19
|
+
}
|
|
20
|
+
function extractList(changedFiles, i18nInstance) {
|
|
21
|
+
const namespaces = uniqueList([].concat(i18nInstance.options.ns, i18nInstance.options.fallbackNS, i18nInstance.options.defaultNS).filter(Boolean));
|
|
22
|
+
const languages = uniqueList([].concat(i18nInstance.languages, i18nInstance.options.supportedLngs, i18nInstance.options.lng, i18nInstance.options.fallbackLng));
|
|
23
|
+
return changedFiles.map((changedFile) => extractLangAndNS(changedFile, {
|
|
24
|
+
namespaces,
|
|
25
|
+
languages
|
|
26
|
+
})).filter(({ lang, ns }) => Boolean(lang) && Boolean(ns));
|
|
27
|
+
}
|
|
28
|
+
function uniqueList(list) {
|
|
29
|
+
return [...new Set(list)];
|
|
30
|
+
}
|
|
31
|
+
function createLoggerOnce(logger) {
|
|
32
|
+
const msgCount = /* @__PURE__ */ new Map();
|
|
33
|
+
return (msg, type = "log") => {
|
|
34
|
+
const count = msgCount.has(msg) ? msgCount.get(msg) : 0;
|
|
35
|
+
if (count > 0) return;
|
|
36
|
+
logger(msg, type);
|
|
37
|
+
msgCount.set(msg, count + 1);
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
function log(msg, type = "log") {
|
|
41
|
+
console[type](`[%cI18NextHMR%c] ${msg}`, "color:#bc93b6", "");
|
|
42
|
+
}
|
|
43
|
+
const logOnce = createLoggerOnce(log);
|
|
44
|
+
async function reloadTranslations(list, i18nInstance) {
|
|
45
|
+
let backendOptions = { queryStringParams: {} };
|
|
46
|
+
try {
|
|
47
|
+
backendOptions = i18nInstance.services.backendConnector.backend.options;
|
|
48
|
+
backendOptions.queryStringParams = backendOptions.queryStringParams || {};
|
|
49
|
+
backendOptions.queryStringParams._ = (/* @__PURE__ */ new Date()).getTime();
|
|
50
|
+
} catch (e) {
|
|
51
|
+
logOnce("Client i18next-http-backend not found, hmr may not work", "warn");
|
|
52
|
+
}
|
|
53
|
+
const langs = uniqueList(list.map((item) => item.lang));
|
|
54
|
+
const namespaces = uniqueList(list.map((item) => item.ns));
|
|
55
|
+
await i18nInstance.reloadResources(langs, namespaces, (error) => {
|
|
56
|
+
if (error) {
|
|
57
|
+
log(error, "error");
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
const currentLang = i18nInstance.language;
|
|
61
|
+
if (langs.includes(currentLang)) {
|
|
62
|
+
i18nInstance.changeLanguage(currentLang);
|
|
63
|
+
log(`Update applied successfully`);
|
|
64
|
+
} else log(`Resources of '${printList(list)}' were reloaded successfully`);
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
module.exports = {
|
|
68
|
+
printList,
|
|
69
|
+
extractList,
|
|
70
|
+
log,
|
|
71
|
+
createLoggerOnce,
|
|
72
|
+
uniqueList,
|
|
73
|
+
reloadTranslations
|
|
74
|
+
};
|
|
75
|
+
}));
|
|
76
|
+
|
|
77
|
+
//#endregion
|
|
78
|
+
//#region ../../node_modules/.bun/i18next-hmr@3.1.5/node_modules/i18next-hmr/lib/webpack/trigger.js
|
|
79
|
+
var require_trigger = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
80
|
+
module.exports = "__PLACEHOLDER__";
|
|
81
|
+
}));
|
|
82
|
+
|
|
83
|
+
//#endregion
|
|
84
|
+
//#region ../../node_modules/.bun/i18next-hmr@3.1.5/node_modules/i18next-hmr/lib/webpack/client-hmr.js
|
|
85
|
+
var require_client_hmr = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
86
|
+
module.exports = function applyClientHMR(i18nOrGetter) {
|
|
87
|
+
if (module.hot) {
|
|
88
|
+
const { extractList, printList, reloadTranslations, log } = require_utils();
|
|
89
|
+
const { changedFile } = require_trigger();
|
|
90
|
+
if (!changedFile || changedFile) log("Client HMR has started");
|
|
91
|
+
module.hot.accept("./trigger.js", () => {
|
|
92
|
+
const { changedFiles } = require_trigger();
|
|
93
|
+
const i18nInstance = typeof i18nOrGetter === "function" ? i18nOrGetter({ changedFiles }) : i18nOrGetter;
|
|
94
|
+
const list = extractList(changedFiles, i18nInstance);
|
|
95
|
+
if (!list.length) return;
|
|
96
|
+
log(`Got an update with ${printList(list)}`);
|
|
97
|
+
return reloadTranslations(list, i18nInstance);
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
}));
|
|
102
|
+
|
|
103
|
+
//#endregion
|
|
104
|
+
//#region ../../node_modules/.bun/i18next-hmr@3.1.5/node_modules/i18next-hmr/lib/webpack/plugin.js
|
|
105
|
+
var require_plugin$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
106
|
+
const path = __require("path");
|
|
107
|
+
const fs = __require("fs");
|
|
108
|
+
const pluginName = "I18nextHMRPlugin";
|
|
109
|
+
const DEFAULT_OPTIONS = {
|
|
110
|
+
localesDir: "",
|
|
111
|
+
localesDirs: []
|
|
112
|
+
};
|
|
113
|
+
var I18NextHMRPlugin = class I18NextHMRPlugin {
|
|
114
|
+
constructor(options) {
|
|
115
|
+
this.options = {
|
|
116
|
+
...DEFAULT_OPTIONS,
|
|
117
|
+
...options
|
|
118
|
+
};
|
|
119
|
+
this.options.localesDirs = [].concat(this.options.localesDirs, this.options.localesDir).filter(Boolean);
|
|
120
|
+
this.lastUpdate = { changedFiles: [] };
|
|
121
|
+
}
|
|
122
|
+
apply(compiler) {
|
|
123
|
+
const isWebpack5 = compiler.webpack ? +compiler.webpack.version.split(".").reverse().pop() === 5 : false;
|
|
124
|
+
compiler.hooks.beforeCompile.tapAsync(pluginName, (params, callback) => {
|
|
125
|
+
const noneExistsDirs = this.options.localesDirs.filter((dir) => !fs.existsSync(dir));
|
|
126
|
+
if (noneExistsDirs.length === 0) return callback();
|
|
127
|
+
throw new Error(`i18next-hmr: \n'${noneExistsDirs.join(`',\n'`)}'${noneExistsDirs.length > 1 ? "\nare" : ""} not found`);
|
|
128
|
+
});
|
|
129
|
+
compiler.hooks.environment.tap(pluginName, () => {
|
|
130
|
+
compiler.options.module?.rules.push({
|
|
131
|
+
resource: path.resolve(__dirname, "trigger.js"),
|
|
132
|
+
loader: path.resolve(__dirname, "loader.js"),
|
|
133
|
+
options: {
|
|
134
|
+
localesDirs: this.options.localesDirs,
|
|
135
|
+
getChangedLang: () => ({ ...this.lastUpdate })
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
});
|
|
139
|
+
compiler.hooks.watchRun.tap(pluginName, (compiler$1) => {
|
|
140
|
+
const watcher = (compiler$1.watchFileSystem.wfs || compiler$1.watchFileSystem).watcher;
|
|
141
|
+
if (!watcher) return;
|
|
142
|
+
const changedTimes = isWebpack5 ? watcher.getTimes() : watcher.mtimes;
|
|
143
|
+
const { startTime = 0 } = watcher || {};
|
|
144
|
+
const files = Object.keys(changedTimes).filter((file) => {
|
|
145
|
+
const fileExt = path.extname(file);
|
|
146
|
+
return this.options.localesDirs.some((dir) => file.startsWith(dir)) && !!fileExt && changedTimes[file] > startTime;
|
|
147
|
+
});
|
|
148
|
+
if (!files.length) return;
|
|
149
|
+
const changedFiles = files.map((file) => {
|
|
150
|
+
const fileExt = path.extname(file);
|
|
151
|
+
const dir = this.options.localesDirs.find((dir$1) => file.startsWith(dir$1));
|
|
152
|
+
return path.relative(dir, file).slice(0, -1 * fileExt.length || void 0);
|
|
153
|
+
});
|
|
154
|
+
this.lastUpdate = { changedFiles };
|
|
155
|
+
I18NextHMRPlugin.callbacks.forEach((cb) => cb({ changedFiles }));
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
I18NextHMRPlugin.callbacks = [];
|
|
160
|
+
I18NextHMRPlugin.addListener = function(cb) {
|
|
161
|
+
I18NextHMRPlugin.callbacks.length = 0;
|
|
162
|
+
I18NextHMRPlugin.callbacks.push(cb);
|
|
163
|
+
};
|
|
164
|
+
module.exports.I18NextHMRPlugin = I18NextHMRPlugin;
|
|
165
|
+
}));
|
|
166
|
+
|
|
167
|
+
//#endregion
|
|
168
|
+
//#region ../../node_modules/.bun/i18next-hmr@3.1.5/node_modules/i18next-hmr/lib/webpack/server-hmr.js
|
|
169
|
+
var require_server_hmr = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
170
|
+
const { extractList, printList, uniqueList, createLoggerOnce } = require_utils();
|
|
171
|
+
module.exports = function applyServerHMR(i18nOrGetter) {
|
|
172
|
+
const pluginName = `\x1b[35m\x1b[1mI18NextHMR\x1b[0m\x1b[39m`;
|
|
173
|
+
function log(message, type = "log") {
|
|
174
|
+
console[type](`[ ${pluginName} ] ${message}`);
|
|
175
|
+
}
|
|
176
|
+
const logOnce = createLoggerOnce(log);
|
|
177
|
+
function reloadServerTranslation({ changedFiles }) {
|
|
178
|
+
const i18nInstance = typeof i18nOrGetter === "function" ? i18nOrGetter({ changedFiles }) : i18nOrGetter;
|
|
179
|
+
if (!i18nInstance) return;
|
|
180
|
+
const list = extractList(changedFiles, i18nInstance);
|
|
181
|
+
if (list.length === 0) return;
|
|
182
|
+
log(`Got an update with ${printList(list)}`);
|
|
183
|
+
const langs = uniqueList(list.map((item) => item.lang));
|
|
184
|
+
const namespaces = uniqueList(list.map((item) => item.ns));
|
|
185
|
+
i18nInstance.reloadResources(langs, namespaces, (error) => {
|
|
186
|
+
if (error) log(`\x1b[31m\x1b[1m${error}\x1b[0m\x1b[39m`);
|
|
187
|
+
else log(`Server reloaded locale of ${printList(list)} successfully`);
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
if (module.hot) {
|
|
191
|
+
const { changedFile } = require_trigger();
|
|
192
|
+
if (!changedFile || changedFile) logOnce(`Server HMR has started`);
|
|
193
|
+
module.hot.accept("./trigger.js", () => {
|
|
194
|
+
reloadServerTranslation(require_trigger());
|
|
195
|
+
});
|
|
196
|
+
} else {
|
|
197
|
+
logOnce(`Server HMR has started - callback mode`);
|
|
198
|
+
require_plugin$1().I18NextHMRPlugin.addListener(reloadServerTranslation);
|
|
199
|
+
}
|
|
200
|
+
};
|
|
201
|
+
}));
|
|
202
|
+
|
|
203
|
+
//#endregion
|
|
204
|
+
//#region ../../node_modules/.bun/i18next-hmr@3.1.5/node_modules/i18next-hmr/lib/vite/client-hmr.js
|
|
205
|
+
var client_hmr_exports = /* @__PURE__ */ __export({ applyViteClientHMR: () => applyViteClientHMR });
|
|
206
|
+
function applyViteClientHMR(i18nOrGetter) {
|
|
207
|
+
if (import.meta.hot) {
|
|
208
|
+
const { extractList, printList, reloadTranslations, log } = require_utils();
|
|
209
|
+
log("Client HMR has started");
|
|
210
|
+
import.meta.hot.on("i18next-hmr:locale-changed", ({ changedFiles }) => {
|
|
211
|
+
const i18nInstance = typeof i18nOrGetter === "function" ? i18nOrGetter({ changedFiles }) : i18nOrGetter;
|
|
212
|
+
const list = extractList(changedFiles, i18nInstance);
|
|
213
|
+
if (!list.length) return;
|
|
214
|
+
log(`Got an update with ${printList(list)}`);
|
|
215
|
+
return reloadTranslations(list, i18nInstance);
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
var init_client_hmr = __esmMin((() => {}));
|
|
220
|
+
|
|
221
|
+
//#endregion
|
|
222
|
+
//#region ../../node_modules/.bun/i18next-hmr@3.1.5/node_modules/i18next-hmr/lib/plugin.js
|
|
223
|
+
var require_plugin = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
224
|
+
var HMRPlugin = class {
|
|
225
|
+
constructor(hmrOptions = {}) {
|
|
226
|
+
this.type = "3rdParty";
|
|
227
|
+
const webpack = hmrOptions.webpack || {};
|
|
228
|
+
const vite = hmrOptions.vite || {};
|
|
229
|
+
if (webpack.client && typeof window !== "undefined") require_client_hmr()(() => this.i18nInstance);
|
|
230
|
+
else if (webpack.server && typeof window === "undefined") require_server_hmr()(() => this.i18nInstance);
|
|
231
|
+
else if (vite.client && typeof window !== "undefined") {
|
|
232
|
+
const { applyViteClientHMR: applyViteClientHMR$1 } = (init_client_hmr(), __toCommonJS(client_hmr_exports));
|
|
233
|
+
applyViteClientHMR$1(() => this.i18nInstance);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
init(i18nInstance) {
|
|
237
|
+
this.i18nInstance = i18nInstance;
|
|
238
|
+
}
|
|
239
|
+
toJSON() {
|
|
240
|
+
return null;
|
|
241
|
+
}
|
|
242
|
+
toString() {
|
|
243
|
+
return "HMRPlugin";
|
|
244
|
+
}
|
|
245
|
+
};
|
|
246
|
+
module.exports.HMRPlugin = HMRPlugin;
|
|
247
|
+
}));
|
|
248
|
+
|
|
249
|
+
//#endregion
|
|
250
|
+
export default require_plugin();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "appos",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.7-0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"release": "release-it",
|
|
@@ -69,10 +69,6 @@
|
|
|
69
69
|
"import": "./dist/exports/instrumentation.mjs",
|
|
70
70
|
"types": "./dist/exports/instrumentation.d.mts"
|
|
71
71
|
},
|
|
72
|
-
"./devtools": {
|
|
73
|
-
"import": "./dist/exports/devtools/index.js",
|
|
74
|
-
"types": "./dist/exports/devtools/index.d.ts"
|
|
75
|
-
},
|
|
76
72
|
"./tests/api": {
|
|
77
73
|
"import": "./dist/exports/tests/api.mjs",
|
|
78
74
|
"types": "./dist/exports/tests/api.d.mts"
|
|
@@ -165,8 +161,6 @@
|
|
|
165
161
|
"@tailwindcss/typography": "^0.5.19",
|
|
166
162
|
"@tailwindcss/vite": "^4.1.18",
|
|
167
163
|
"@tanstack/react-query": "^5.90.12",
|
|
168
|
-
"@tanstack/react-query-devtools": "^5.91.1",
|
|
169
|
-
"@tanstack/react-router-devtools": "^1.141.6",
|
|
170
164
|
"@testing-library/jest-dom": "^6.9.1",
|
|
171
165
|
"@testing-library/react": "^16.3.1",
|
|
172
166
|
"@testing-library/user-event": "^14.6.1",
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
function e(e){if(e&&typeof e==`object`&&`status`in e){let t=e.status;if(typeof t==`number`)return t}return e instanceof SyntaxError?400:500}function t(t,n={}){return async(r,i,a,o)=>{if(process.env.NODE_ENV===`production`)return o(r);try{let{Youch:t}=await import(`youch`),i=await new t().toHTML(r,{title:n.displayName||`Error`,ide:`vscode`});a.writeHead(e(r),{"content-type":`text/html`}),a.end(i)}catch(n){t.error({error:n instanceof Error?n.message:n,originalError:r instanceof Error?r.message:r},`Failed to render Youch error page`),a.status(e(r)).json({error:{message:r instanceof Error?r.message:`Internal server error`,...process.env.NODE_ENV!==`production`&&{stack:r instanceof Error?r.stack:void 0}}})}}}export{t as defineYouchErrorHandler};
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
import { AppContainer } from "./container.mjs";
|
|
2
|
-
import { RequestMetadata } from "./middleware/request-logger.mjs";
|
|
3
|
-
import { Auth } from "better-auth";
|
|
4
|
-
import { ApiKey } from "better-auth/plugins";
|
|
5
|
-
import { TFunction } from "i18next";
|
|
6
|
-
import { Request } from "ultimate-express";
|
|
7
|
-
|
|
8
|
-
//#region src/api/app-context.d.ts
|
|
9
|
-
declare global {
|
|
10
|
-
namespace Express {
|
|
11
|
-
interface Locals {
|
|
12
|
-
/**
|
|
13
|
-
* The application container with services and dependencies.
|
|
14
|
-
*/
|
|
15
|
-
container: AppContainer;
|
|
16
|
-
}
|
|
17
|
-
interface Request {
|
|
18
|
-
/**
|
|
19
|
-
* The API key, or null if not authenticated via API key.
|
|
20
|
-
*/
|
|
21
|
-
apiKey: ApiKey | null;
|
|
22
|
-
/**
|
|
23
|
-
* The text direction for the detected language (e.g., "ltr" or "rtl").
|
|
24
|
-
*/
|
|
25
|
-
dir: string;
|
|
26
|
-
/**
|
|
27
|
-
* The idempotency key provided in the request headers.
|
|
28
|
-
*/
|
|
29
|
-
idempotencyKey?: string;
|
|
30
|
-
/**
|
|
31
|
-
* The detected language from the request's Accept-Language header.
|
|
32
|
-
*/
|
|
33
|
-
language: string;
|
|
34
|
-
/**
|
|
35
|
-
* The list of supported languages.
|
|
36
|
-
*/
|
|
37
|
-
languages: readonly string[];
|
|
38
|
-
/**
|
|
39
|
-
* Metadata about the request for logging purposes.
|
|
40
|
-
*/
|
|
41
|
-
metadata: RequestMetadata;
|
|
42
|
-
/**
|
|
43
|
-
* Request body in raw bytes
|
|
44
|
-
*/
|
|
45
|
-
rawBody?: Buffer;
|
|
46
|
-
/**
|
|
47
|
-
* The unique request ID for tracing purposes.
|
|
48
|
-
*/
|
|
49
|
-
requestId: string;
|
|
50
|
-
/**
|
|
51
|
-
* The translation function for the detected language.
|
|
52
|
-
*/
|
|
53
|
-
t: TFunction;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Session data from Better Auth's getSession().
|
|
59
|
-
*/
|
|
60
|
-
type SessionData = NonNullable<Awaited<ReturnType<Auth["api"]["getSession"]>>>;
|
|
61
|
-
/**
|
|
62
|
-
* Unified context for tRPC, OpenAPI handlers, and services.
|
|
63
|
-
*/
|
|
64
|
-
interface AppContext {
|
|
65
|
-
/**
|
|
66
|
-
* The API key data, or null if not authenticated via API key.
|
|
67
|
-
*/
|
|
68
|
-
apiKey: ApiKey | null;
|
|
69
|
-
/**
|
|
70
|
-
* Application container with services and dependencies.
|
|
71
|
-
*/
|
|
72
|
-
container: AppContainer;
|
|
73
|
-
/**
|
|
74
|
-
* The incoming request object.
|
|
75
|
-
*/
|
|
76
|
-
request: Request;
|
|
77
|
-
/**
|
|
78
|
-
* The current session, or null if not authenticated.
|
|
79
|
-
*/
|
|
80
|
-
session: SessionData["session"] | null;
|
|
81
|
-
/**
|
|
82
|
-
* The current user, or null if not authenticated.
|
|
83
|
-
*/
|
|
84
|
-
user: SessionData["user"] | null;
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* Options for creating an AppContext.
|
|
88
|
-
*/
|
|
89
|
-
interface DefineAppContextOpts {
|
|
90
|
-
/**
|
|
91
|
-
* The API key data, or null if not authenticated via API key.
|
|
92
|
-
*/
|
|
93
|
-
apiKey: ApiKey | null;
|
|
94
|
-
/**
|
|
95
|
-
* Application container with services and dependencies.
|
|
96
|
-
*/
|
|
97
|
-
container: AppContainer;
|
|
98
|
-
/**
|
|
99
|
-
* Set to true to fetch session (tRPC). False for API key auth (OpenAPI).
|
|
100
|
-
*/
|
|
101
|
-
fetchSession?: boolean;
|
|
102
|
-
/**
|
|
103
|
-
* The incoming request object.
|
|
104
|
-
*/
|
|
105
|
-
request: Request;
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* Creates a unified AppContext for tRPC and OpenAPI handlers.
|
|
109
|
-
*
|
|
110
|
-
* For tRPC (session auth): Pass fetchSession=true to fetch session from Better Auth.
|
|
111
|
-
* For OpenAPI (API key auth): Pass fetchSession=false (default), session will be null.
|
|
112
|
-
*/
|
|
113
|
-
declare function defineAppContext(opts: DefineAppContextOpts): Promise<AppContext>;
|
|
114
|
-
//#endregion
|
|
115
|
-
export { AppContext, DefineAppContextOpts, SessionData, defineAppContext };
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { fromNodeHeaders } from "better-auth/node";
|
|
2
|
-
|
|
3
|
-
//#region src/api/app-context.ts
|
|
4
|
-
/**
|
|
5
|
-
* Creates a unified AppContext for tRPC and OpenAPI handlers.
|
|
6
|
-
*
|
|
7
|
-
* For tRPC (session auth): Pass fetchSession=true to fetch session from Better Auth.
|
|
8
|
-
* For OpenAPI (API key auth): Pass fetchSession=false (default), session will be null.
|
|
9
|
-
*/
|
|
10
|
-
async function defineAppContext(opts) {
|
|
11
|
-
const { apiKey, container, request, fetchSession = false } = opts;
|
|
12
|
-
const headers = fromNodeHeaders(request.headers);
|
|
13
|
-
const sessionData = fetchSession ? await container.auth.api.getSession({ headers }) : null;
|
|
14
|
-
return {
|
|
15
|
-
apiKey,
|
|
16
|
-
container,
|
|
17
|
-
request,
|
|
18
|
-
session: sessionData?.session ?? null,
|
|
19
|
-
user: sessionData?.user ?? null
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
//#endregion
|
|
24
|
-
export { defineAppContext };
|