@cogenta/core 0.4.0 → 0.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/CHANGELOG.md +3532 -0
- package/dist/config/env.d.ts +21 -0
- package/dist/config/env.d.ts.map +1 -1
- package/dist/config/env.js +72 -0
- package/dist/config/env.js.map +1 -1
- package/dist/config/index.d.ts +2 -0
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +1 -0
- package/dist/config/index.js.map +1 -1
- package/dist/config/load-config.d.ts +9 -0
- package/dist/config/load-config.d.ts.map +1 -1
- package/dist/config/load-config.js +39 -15
- package/dist/config/load-config.js.map +1 -1
- package/dist/config/resolve-config.d.ts.map +1 -1
- package/dist/config/resolve-config.js +39 -0
- package/dist/config/resolve-config.js.map +1 -1
- package/dist/config/schema.d.ts +49 -0
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/config/schema.js +149 -1
- package/dist/config/schema.js.map +1 -1
- package/dist/config/secret-hygiene.d.ts +55 -0
- package/dist/config/secret-hygiene.d.ts.map +1 -0
- package/dist/config/secret-hygiene.js +94 -0
- package/dist/config/secret-hygiene.js.map +1 -0
- package/dist/config/types.d.ts +166 -0
- package/dist/config/types.d.ts.map +1 -1
- package/dist/config/types.js +4 -0
- package/dist/config/types.js.map +1 -1
- package/dist/drivers/index.d.ts +1 -1
- package/dist/drivers/index.d.ts.map +1 -1
- package/dist/drivers/index.js.map +1 -1
- package/dist/drivers/registry.d.ts.map +1 -1
- package/dist/drivers/registry.js +15 -8
- package/dist/drivers/registry.js.map +1 -1
- package/dist/drivers/types.d.ts +23 -0
- package/dist/drivers/types.d.ts.map +1 -1
- package/dist/errors/codes.d.ts +1 -1
- package/dist/errors/codes.d.ts.map +1 -1
- package/dist/errors/codes.js +244 -0
- package/dist/errors/codes.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/logger/error-log.d.ts +48 -0
- package/dist/logger/error-log.d.ts.map +1 -0
- package/dist/logger/error-log.js +57 -0
- package/dist/logger/error-log.js.map +1 -0
- package/dist/logger/index.d.ts +2 -0
- package/dist/logger/index.d.ts.map +1 -1
- package/dist/logger/index.js +1 -0
- package/dist/logger/index.js.map +1 -1
- package/dist/media/exif.d.ts +46 -0
- package/dist/media/exif.d.ts.map +1 -0
- package/dist/media/exif.js +291 -0
- package/dist/media/exif.js.map +1 -0
- package/dist/media/folder-path.d.ts +16 -0
- package/dist/media/folder-path.d.ts.map +1 -0
- package/dist/media/folder-path.js +51 -0
- package/dist/media/folder-path.js.map +1 -0
- package/dist/media/folder-store.d.ts +26 -0
- package/dist/media/folder-store.d.ts.map +1 -0
- package/dist/media/folder-store.js +361 -0
- package/dist/media/folder-store.js.map +1 -0
- package/dist/media/index.d.ts +5 -2
- package/dist/media/index.d.ts.map +1 -1
- package/dist/media/index.js +4 -1
- package/dist/media/index.js.map +1 -1
- package/dist/media/sql-fragments.d.ts +19 -0
- package/dist/media/sql-fragments.d.ts.map +1 -0
- package/dist/media/sql-fragments.js +29 -0
- package/dist/media/sql-fragments.js.map +1 -0
- package/dist/media/store.d.ts +1 -0
- package/dist/media/store.d.ts.map +1 -1
- package/dist/media/store.js +175 -20
- package/dist/media/store.js.map +1 -1
- package/dist/media/types.d.ts +148 -0
- package/dist/media/types.d.ts.map +1 -1
- package/dist/queue/bullmq.d.ts +4 -0
- package/dist/queue/bullmq.d.ts.map +1 -1
- package/dist/queue/bullmq.js +53 -10
- package/dist/queue/bullmq.js.map +1 -1
- package/dist/queue/database.d.ts.map +1 -1
- package/dist/queue/database.js +32 -11
- package/dist/queue/database.js.map +1 -1
- package/dist/queue/types.d.ts +19 -0
- package/dist/queue/types.d.ts.map +1 -1
- package/dist/rate-limit/index.d.ts +21 -0
- package/dist/rate-limit/index.d.ts.map +1 -0
- package/dist/rate-limit/index.js +25 -0
- package/dist/rate-limit/index.js.map +1 -0
- package/dist/rate-limit/memory.d.ts +17 -0
- package/dist/rate-limit/memory.d.ts.map +1 -0
- package/dist/rate-limit/memory.js +61 -0
- package/dist/rate-limit/memory.js.map +1 -0
- package/dist/rate-limit/redis.d.ts +55 -0
- package/dist/rate-limit/redis.d.ts.map +1 -0
- package/dist/rate-limit/redis.js +134 -0
- package/dist/rate-limit/redis.js.map +1 -0
- package/dist/rate-limit/types.d.ts +52 -0
- package/dist/rate-limit/types.d.ts.map +1 -0
- package/dist/rate-limit/types.js +2 -0
- package/dist/rate-limit/types.js.map +1 -0
- package/dist/version.d.ts +39 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +84 -0
- package/dist/version.js.map +1 -0
- package/package.json +3 -2
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reads the `version` field of the `package.json` that sits at `packageRoot`
|
|
3
|
+
* — self-describing, not looked up through `node_modules` resolution or
|
|
4
|
+
* copied into a generated constant at build time.
|
|
5
|
+
*
|
|
6
|
+
* `packageRoot` is meant to be computed once, at each caller's own top level,
|
|
7
|
+
* as `new URL('../', import.meta.url)` from a module that sits exactly one
|
|
8
|
+
* directory below its package's root — which is true of `src/version.ts`
|
|
9
|
+
* here, of `src/index.ts` in `@cogenta/cli`, and of any future caller that
|
|
10
|
+
* keeps the same `rootDir: "./src"` / `outDir: "./dist"` layout every
|
|
11
|
+
* `tsconfig.json` in this monorepo already uses (`src/foo.ts` compiles to
|
|
12
|
+
* `dist/foo.js`, one level below the package root either way — in dev, under
|
|
13
|
+
* `vitest`, `import.meta.url` still points at the `.ts` file in `src/`, so
|
|
14
|
+
* the same relative path resolves there too).
|
|
15
|
+
*
|
|
16
|
+
* Deliberately synchronous and local: an installed package always carries
|
|
17
|
+
* its own `package.json` (npm never excludes it, regardless of `"files"`),
|
|
18
|
+
* so reading a package's own version never needs the network the way
|
|
19
|
+
* checking npm for a *newer* one does (`@cogenta/cli`'s `update` module).
|
|
20
|
+
*/
|
|
21
|
+
export declare function readOwnPackageVersion(packageRoot: URL): string;
|
|
22
|
+
/**
|
|
23
|
+
* `@cogenta/core`'s own installed version — see `readOwnPackageVersion`.
|
|
24
|
+
*
|
|
25
|
+
* **Deliberately lazy, never a top-level constant.** `@cogenta/core` is the
|
|
26
|
+
* one package nearly everything in this monorepo imports, including, via
|
|
27
|
+
* `import type` re-exports, packages that end up loaded inside a bundler or
|
|
28
|
+
* a browser-like test environment (`@cogenta/admin`'s Vitest+jsdom suite
|
|
29
|
+
* really does execute this module's top level — confirmed by a real crash
|
|
30
|
+
* while building this: `import.meta.url` there is not a `file://` URL,
|
|
31
|
+
* `fileURLToPath` throws, and merely *importing* `@cogenta/core` broke
|
|
32
|
+
* every admin test that happened to pull it in transitively). A function
|
|
33
|
+
* that only touches the filesystem when actually called — and only ever
|
|
34
|
+
* is, in this codebase, from Node-only call sites (`@cogenta/cli`) — costs
|
|
35
|
+
* nothing at import time in any environment, cached after the first real
|
|
36
|
+
* call.
|
|
37
|
+
*/
|
|
38
|
+
export declare function getCoreVersion(): string;
|
|
39
|
+
//# sourceMappingURL=version.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,qBAAqB,CAAC,WAAW,EAAE,GAAG,GAAG,MAAM,CAsC9D;AAID;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,cAAc,IAAI,MAAM,CAGvC"}
|
package/dist/version.js
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
import { fileURLToPath } from 'node:url';
|
|
3
|
+
import { CogentaError } from './errors/cogenta-error.js';
|
|
4
|
+
/**
|
|
5
|
+
* Reads the `version` field of the `package.json` that sits at `packageRoot`
|
|
6
|
+
* — self-describing, not looked up through `node_modules` resolution or
|
|
7
|
+
* copied into a generated constant at build time.
|
|
8
|
+
*
|
|
9
|
+
* `packageRoot` is meant to be computed once, at each caller's own top level,
|
|
10
|
+
* as `new URL('../', import.meta.url)` from a module that sits exactly one
|
|
11
|
+
* directory below its package's root — which is true of `src/version.ts`
|
|
12
|
+
* here, of `src/index.ts` in `@cogenta/cli`, and of any future caller that
|
|
13
|
+
* keeps the same `rootDir: "./src"` / `outDir: "./dist"` layout every
|
|
14
|
+
* `tsconfig.json` in this monorepo already uses (`src/foo.ts` compiles to
|
|
15
|
+
* `dist/foo.js`, one level below the package root either way — in dev, under
|
|
16
|
+
* `vitest`, `import.meta.url` still points at the `.ts` file in `src/`, so
|
|
17
|
+
* the same relative path resolves there too).
|
|
18
|
+
*
|
|
19
|
+
* Deliberately synchronous and local: an installed package always carries
|
|
20
|
+
* its own `package.json` (npm never excludes it, regardless of `"files"`),
|
|
21
|
+
* so reading a package's own version never needs the network the way
|
|
22
|
+
* checking npm for a *newer* one does (`@cogenta/cli`'s `update` module).
|
|
23
|
+
*/
|
|
24
|
+
export function readOwnPackageVersion(packageRoot) {
|
|
25
|
+
const path = fileURLToPath(new URL('package.json', packageRoot));
|
|
26
|
+
let raw;
|
|
27
|
+
try {
|
|
28
|
+
raw = readFileSync(path, 'utf8');
|
|
29
|
+
}
|
|
30
|
+
catch (error) {
|
|
31
|
+
throw new CogentaError({
|
|
32
|
+
code: 'PACKAGE_VERSION_UNREADABLE',
|
|
33
|
+
message: `Could not read ${path} to determine this package's own version.`,
|
|
34
|
+
hint: 'This indicates a broken install — an installed package always ships its own package.json.',
|
|
35
|
+
cause: error,
|
|
36
|
+
details: { path },
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
let parsed;
|
|
40
|
+
try {
|
|
41
|
+
parsed = JSON.parse(raw);
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
throw new CogentaError({
|
|
45
|
+
code: 'PACKAGE_VERSION_UNREADABLE',
|
|
46
|
+
message: `${path} is not valid JSON.`,
|
|
47
|
+
hint: 'This indicates a corrupted install.',
|
|
48
|
+
cause: error,
|
|
49
|
+
details: { path },
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
const version = parsed.version;
|
|
53
|
+
if (typeof version !== 'string' || version === '') {
|
|
54
|
+
throw new CogentaError({
|
|
55
|
+
code: 'PACKAGE_VERSION_UNREADABLE',
|
|
56
|
+
message: `${path} has no valid "version" field.`,
|
|
57
|
+
hint: 'This indicates a corrupted package.json.',
|
|
58
|
+
details: { path },
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
return version;
|
|
62
|
+
}
|
|
63
|
+
let cachedCoreVersion;
|
|
64
|
+
/**
|
|
65
|
+
* `@cogenta/core`'s own installed version — see `readOwnPackageVersion`.
|
|
66
|
+
*
|
|
67
|
+
* **Deliberately lazy, never a top-level constant.** `@cogenta/core` is the
|
|
68
|
+
* one package nearly everything in this monorepo imports, including, via
|
|
69
|
+
* `import type` re-exports, packages that end up loaded inside a bundler or
|
|
70
|
+
* a browser-like test environment (`@cogenta/admin`'s Vitest+jsdom suite
|
|
71
|
+
* really does execute this module's top level — confirmed by a real crash
|
|
72
|
+
* while building this: `import.meta.url` there is not a `file://` URL,
|
|
73
|
+
* `fileURLToPath` throws, and merely *importing* `@cogenta/core` broke
|
|
74
|
+
* every admin test that happened to pull it in transitively). A function
|
|
75
|
+
* that only touches the filesystem when actually called — and only ever
|
|
76
|
+
* is, in this codebase, from Node-only call sites (`@cogenta/cli`) — costs
|
|
77
|
+
* nothing at import time in any environment, cached after the first real
|
|
78
|
+
* call.
|
|
79
|
+
*/
|
|
80
|
+
export function getCoreVersion() {
|
|
81
|
+
cachedCoreVersion ??= readOwnPackageVersion(new URL('../', import.meta.url));
|
|
82
|
+
return cachedCoreVersion;
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=version.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE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,EAAE,0CAA0C;YAChD,OAAO,EAAE,EAAE,IAAI,EAAE;SAClB,CAAC,CAAA;IACJ,CAAC;IACD,OAAO,OAAO,CAAA;AAChB,CAAC;AAED,IAAI,iBAAqC,CAAA;AAEzC;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,cAAc;IAC5B,iBAAiB,KAAK,qBAAqB,CAAC,IAAI,GAAG,CAAC,KAAK,EAAE,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAA;IAC5E,OAAO,iBAAiB,CAAA;AAC1B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cogenta/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Configuration, typed errors, structured logging and the driver system behind Cogenta.",
|
|
5
5
|
"license": "MPL-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
"files": [
|
|
15
|
-
"dist"
|
|
15
|
+
"dist",
|
|
16
|
+
"CHANGELOG.md"
|
|
16
17
|
],
|
|
17
18
|
"engines": {
|
|
18
19
|
"node": ">=22.11.0"
|