@adminiumjs/meta 0.1.2 → 0.2.1
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/connect.d.ts +26 -1
- package/dist/connect.d.ts.map +1 -1
- package/dist/connect.js +32 -1
- package/dist/connect.js.map +1 -1
- package/dist/ids.d.ts +2 -0
- package/dist/ids.d.ts.map +1 -1
- package/dist/ids.js +2 -0
- package/dist/ids.js.map +1 -1
- package/dist/migrations/0011_i18n_runtime.d.ts +42 -0
- package/dist/migrations/0011_i18n_runtime.d.ts.map +1 -0
- package/dist/migrations/0011_i18n_runtime.js +101 -0
- package/dist/migrations/0011_i18n_runtime.js.map +1 -0
- package/dist/migrations/0012_locale_width.d.ts +29 -0
- package/dist/migrations/0012_locale_width.d.ts.map +1 -0
- package/dist/migrations/0012_locale_width.js +42 -0
- package/dist/migrations/0012_locale_width.js.map +1 -0
- package/dist/migrations/index.d.ts.map +1 -1
- package/dist/migrations/index.js +4 -0
- package/dist/migrations/index.js.map +1 -1
- package/dist/repos/i18n-version.d.ts +32 -0
- package/dist/repos/i18n-version.d.ts.map +1 -0
- package/dist/repos/i18n-version.js +56 -0
- package/dist/repos/i18n-version.js.map +1 -0
- package/dist/repos/index.d.ts +3 -0
- package/dist/repos/index.d.ts.map +1 -1
- package/dist/repos/index.js +3 -0
- package/dist/repos/index.js.map +1 -1
- package/dist/repos/locales.d.ts +85 -0
- package/dist/repos/locales.d.ts.map +1 -0
- package/dist/repos/locales.js +189 -0
- package/dist/repos/locales.js.map +1 -0
- package/dist/repos/overrides.d.ts +2 -2
- package/dist/repos/overrides.d.ts.map +1 -1
- package/dist/repos/overrides.js.map +1 -1
- package/dist/repos/translations.d.ts +107 -0
- package/dist/repos/translations.d.ts.map +1 -0
- package/dist/repos/translations.js +231 -0
- package/dist/repos/translations.js.map +1 -0
- package/dist/repos/user-prefs.d.ts +8 -1
- package/dist/repos/user-prefs.d.ts.map +1 -1
- package/dist/repos/user-prefs.js +26 -3
- package/dist/repos/user-prefs.js.map +1 -1
- package/dist/schema/json-payloads.d.ts +30 -1
- package/dist/schema/json-payloads.d.ts.map +1 -1
- package/dist/schema/json-payloads.js +29 -2
- package/dist/schema/json-payloads.js.map +1 -1
- package/dist/schema/settings-registry.d.ts +16 -1
- package/dist/schema/settings-registry.d.ts.map +1 -1
- package/dist/schema/settings-registry.js +15 -0
- package/dist/schema/settings-registry.js.map +1 -1
- package/dist/schema/tables.d.ts +47 -1
- package/dist/schema/tables.d.ts.map +1 -1
- package/dist/schema/tables.js +2 -0
- package/dist/schema/tables.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* localesRepo — adminium_locales (23-runtime-translations.md §3.1).
|
|
3
|
+
*
|
|
4
|
+
* The table is SPARSE by design and this repo is what keeps it that way: a
|
|
5
|
+
* built-in locale has no row until an admin changes something about it, and
|
|
6
|
+
* even then the row carries only `enabled`/`sortOrder`. Callers that need the
|
|
7
|
+
* full presentation record (names, dir, font) merge these rows over the
|
|
8
|
+
* compiled `LOCALES` registry from `@adminium/i18n` — the meta store cannot
|
|
9
|
+
* import that package (01-architecture.md §2.3 import matrix), so the merge
|
|
10
|
+
* lives in the server layer and this repo stays a dumb, typed row store.
|
|
11
|
+
*
|
|
12
|
+
* Every mutating method bumps `settings['i18n.version']` in the SAME
|
|
13
|
+
* transaction (§3.4). The bump belongs here rather than in a route handler
|
|
14
|
+
* because config-bundle import has no HTTP route at all — it writes through
|
|
15
|
+
* repos — and a route-level bump would leave every client serving stale
|
|
16
|
+
* strings after an import, indefinitely.
|
|
17
|
+
*/
|
|
18
|
+
import type { MetaDb } from '../connect.js';
|
|
19
|
+
export type LocaleDir = 'ltr' | 'rtl';
|
|
20
|
+
export type LocaleFontHint = 'latin' | 'arabic' | 'cjk';
|
|
21
|
+
export interface LocaleRow {
|
|
22
|
+
id: string;
|
|
23
|
+
locale: string;
|
|
24
|
+
isBuiltin: boolean;
|
|
25
|
+
enabled: boolean;
|
|
26
|
+
sortOrder: number;
|
|
27
|
+
/** Null on a built-in row — the compiled registry owns these. */
|
|
28
|
+
english: string | null;
|
|
29
|
+
native: string | null;
|
|
30
|
+
dir: LocaleDir | null;
|
|
31
|
+
fontHint: LocaleFontHint | null;
|
|
32
|
+
intlTag: string | null;
|
|
33
|
+
pluralCategories: string[] | null;
|
|
34
|
+
updatedBy: string | null;
|
|
35
|
+
createdAt: number;
|
|
36
|
+
updatedAt: number;
|
|
37
|
+
}
|
|
38
|
+
/** Fields a CUSTOM locale row owns outright. */
|
|
39
|
+
export interface CustomLocaleInput {
|
|
40
|
+
english: string;
|
|
41
|
+
native: string;
|
|
42
|
+
dir: LocaleDir;
|
|
43
|
+
fontHint: LocaleFontHint;
|
|
44
|
+
/** A real BCP-47 tag whose Intl behaviour this locale borrows (§5.6). */
|
|
45
|
+
intlTag: string;
|
|
46
|
+
/** Frozen at create time from `intlTag` so write validation is stable. */
|
|
47
|
+
pluralCategories: string[];
|
|
48
|
+
enabled?: boolean | undefined;
|
|
49
|
+
sortOrder?: number | undefined;
|
|
50
|
+
}
|
|
51
|
+
/** The only fields a BUILT-IN row may carry (§3.1 built-in field lock). */
|
|
52
|
+
export interface BuiltinLocaleInput {
|
|
53
|
+
enabled?: boolean | undefined;
|
|
54
|
+
sortOrder?: number | undefined;
|
|
55
|
+
}
|
|
56
|
+
export declare function localesRepo(meta: MetaDb): {
|
|
57
|
+
/** Every row, in picker order (`sortOrder`, then locale id). */
|
|
58
|
+
list(): Promise<LocaleRow[]>;
|
|
59
|
+
get(locale: string): Promise<LocaleRow | null>;
|
|
60
|
+
/**
|
|
61
|
+
* Create or update the row for a BUILT-IN locale. Only `enabled` and
|
|
62
|
+
* `sortOrder` exist here — direction, fonts and names always come from
|
|
63
|
+
* the compiled registry, so an admin cannot flip `ar_EG` to `ltr` and
|
|
64
|
+
* corrupt a shipped bundle's rendering.
|
|
65
|
+
*/
|
|
66
|
+
upsertBuiltin(locale: string, input: BuiltinLocaleInput, opts?: {
|
|
67
|
+
updatedBy?: string | null;
|
|
68
|
+
at?: number;
|
|
69
|
+
}): Promise<LocaleRow>;
|
|
70
|
+
/** Create or update a CUSTOM locale row (the full record). */
|
|
71
|
+
upsertCustom(locale: string, input: CustomLocaleInput, opts?: {
|
|
72
|
+
updatedBy?: string | null;
|
|
73
|
+
at?: number;
|
|
74
|
+
}): Promise<LocaleRow>;
|
|
75
|
+
/**
|
|
76
|
+
* Delete the registry row. Reassigning the users/settings/templates that
|
|
77
|
+
* referenced the locale is the CALLER's job (23 §5.7) — this repo owns
|
|
78
|
+
* one table and deliberately does not reach across the store.
|
|
79
|
+
*/
|
|
80
|
+
remove(locale: string, opts?: {
|
|
81
|
+
updatedBy?: string | null;
|
|
82
|
+
at?: number;
|
|
83
|
+
}): Promise<boolean>;
|
|
84
|
+
};
|
|
85
|
+
//# sourceMappingURL=locales.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"locales.d.ts","sourceRoot":"","sources":["../../src/repos/locales.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAM5C,MAAM,MAAM,SAAS,GAAG,KAAK,GAAG,KAAK,CAAC;AACtC,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC;AAExD,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,iEAAiE;IACjE,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,GAAG,EAAE,SAAS,GAAG,IAAI,CAAC;IACtB,QAAQ,EAAE,cAAc,GA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OAIG;mBAEO,MAAM,SACR;QAAE,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,EAAE,CAAC,EAAE,MAAM,CAAA;KAAE,GAC/C,OAAO,CAAC,OAAO,CAAC;EActB"}
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* localesRepo — adminium_locales (23-runtime-translations.md §3.1).
|
|
3
|
+
*
|
|
4
|
+
* The table is SPARSE by design and this repo is what keeps it that way: a
|
|
5
|
+
* built-in locale has no row until an admin changes something about it, and
|
|
6
|
+
* even then the row carries only `enabled`/`sortOrder`. Callers that need the
|
|
7
|
+
* full presentation record (names, dir, font) merge these rows over the
|
|
8
|
+
* compiled `LOCALES` registry from `@adminium/i18n` — the meta store cannot
|
|
9
|
+
* import that package (01-architecture.md §2.3 import matrix), so the merge
|
|
10
|
+
* lives in the server layer and this repo stays a dumb, typed row store.
|
|
11
|
+
*
|
|
12
|
+
* Every mutating method bumps `settings['i18n.version']` in the SAME
|
|
13
|
+
* transaction (§3.4). The bump belongs here rather than in a route handler
|
|
14
|
+
* because config-bundle import has no HTTP route at all — it writes through
|
|
15
|
+
* repos — and a route-level bump would leave every client serving stale
|
|
16
|
+
* strings after an import, indefinitely.
|
|
17
|
+
*/
|
|
18
|
+
import { newId } from '../ids.js';
|
|
19
|
+
import { bumpI18nVersion } from './i18n-version.js';
|
|
20
|
+
import { affected, packJson, readBool, readJsonOrNull, writeBool } from './util.js';
|
|
21
|
+
function decode(row) {
|
|
22
|
+
const plural = readJsonOrNull(row.pluralCategories);
|
|
23
|
+
return {
|
|
24
|
+
id: row.id,
|
|
25
|
+
locale: row.locale,
|
|
26
|
+
isBuiltin: readBool(row.isBuiltin),
|
|
27
|
+
enabled: readBool(row.enabled),
|
|
28
|
+
sortOrder: row.sortOrder,
|
|
29
|
+
english: row.english,
|
|
30
|
+
native: row.native,
|
|
31
|
+
dir: row.dir === null ? null : row.dir,
|
|
32
|
+
fontHint: row.fontHint === null ? null : row.fontHint,
|
|
33
|
+
intlTag: row.intlTag,
|
|
34
|
+
pluralCategories: Array.isArray(plural) ? plural : null,
|
|
35
|
+
updatedBy: row.updatedBy,
|
|
36
|
+
createdAt: row.createdAt,
|
|
37
|
+
updatedAt: row.updatedAt,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
export function localesRepo(meta) {
|
|
41
|
+
const { db } = meta;
|
|
42
|
+
return {
|
|
43
|
+
/** Every row, in picker order (`sortOrder`, then locale id). */
|
|
44
|
+
async list() {
|
|
45
|
+
const rows = await db
|
|
46
|
+
.selectFrom('adminium_locales')
|
|
47
|
+
.selectAll()
|
|
48
|
+
.orderBy('sortOrder', 'asc')
|
|
49
|
+
.orderBy('locale', 'asc')
|
|
50
|
+
.execute();
|
|
51
|
+
return rows.map(decode);
|
|
52
|
+
},
|
|
53
|
+
async get(locale) {
|
|
54
|
+
const row = await db
|
|
55
|
+
.selectFrom('adminium_locales')
|
|
56
|
+
.selectAll()
|
|
57
|
+
.where('locale', '=', locale)
|
|
58
|
+
.executeTakeFirst();
|
|
59
|
+
return row === undefined ? null : decode(row);
|
|
60
|
+
},
|
|
61
|
+
/**
|
|
62
|
+
* Create or update the row for a BUILT-IN locale. Only `enabled` and
|
|
63
|
+
* `sortOrder` exist here — direction, fonts and names always come from
|
|
64
|
+
* the compiled registry, so an admin cannot flip `ar_EG` to `ltr` and
|
|
65
|
+
* corrupt a shipped bundle's rendering.
|
|
66
|
+
*/
|
|
67
|
+
async upsertBuiltin(locale, input, opts = {}) {
|
|
68
|
+
const at = opts.at ?? Date.now();
|
|
69
|
+
const updatedBy = opts.updatedBy ?? null;
|
|
70
|
+
await meta.db.transaction().execute(async (trx) => {
|
|
71
|
+
const existing = await trx
|
|
72
|
+
.selectFrom('adminium_locales')
|
|
73
|
+
.select(['id'])
|
|
74
|
+
.where('locale', '=', locale)
|
|
75
|
+
.executeTakeFirst();
|
|
76
|
+
if (existing === undefined) {
|
|
77
|
+
await trx
|
|
78
|
+
.insertInto('adminium_locales')
|
|
79
|
+
.values({
|
|
80
|
+
id: newId('loc'),
|
|
81
|
+
locale,
|
|
82
|
+
isBuiltin: writeBool(meta, true),
|
|
83
|
+
enabled: writeBool(meta, input.enabled ?? true),
|
|
84
|
+
sortOrder: input.sortOrder ?? 0,
|
|
85
|
+
english: null,
|
|
86
|
+
native: null,
|
|
87
|
+
dir: null,
|
|
88
|
+
fontHint: null,
|
|
89
|
+
intlTag: null,
|
|
90
|
+
pluralCategories: null,
|
|
91
|
+
updatedBy,
|
|
92
|
+
createdAt: at,
|
|
93
|
+
updatedAt: at,
|
|
94
|
+
})
|
|
95
|
+
.execute();
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
await trx
|
|
99
|
+
.updateTable('adminium_locales')
|
|
100
|
+
.set({
|
|
101
|
+
...(input.enabled === undefined ? {} : { enabled: writeBool(meta, input.enabled) }),
|
|
102
|
+
...(input.sortOrder === undefined ? {} : { sortOrder: input.sortOrder }),
|
|
103
|
+
updatedBy,
|
|
104
|
+
updatedAt: at,
|
|
105
|
+
})
|
|
106
|
+
.where('locale', '=', locale)
|
|
107
|
+
.execute();
|
|
108
|
+
}
|
|
109
|
+
await bumpI18nVersion(trx, at, updatedBy);
|
|
110
|
+
});
|
|
111
|
+
const row = await this.get(locale);
|
|
112
|
+
if (row === null)
|
|
113
|
+
throw new Error(`locale row vanished after upsert: ${locale}`);
|
|
114
|
+
return row;
|
|
115
|
+
},
|
|
116
|
+
/** Create or update a CUSTOM locale row (the full record). */
|
|
117
|
+
async upsertCustom(locale, input, opts = {}) {
|
|
118
|
+
const at = opts.at ?? Date.now();
|
|
119
|
+
const updatedBy = opts.updatedBy ?? null;
|
|
120
|
+
await meta.db.transaction().execute(async (trx) => {
|
|
121
|
+
const existing = await trx
|
|
122
|
+
.selectFrom('adminium_locales')
|
|
123
|
+
.select(['id'])
|
|
124
|
+
.where('locale', '=', locale)
|
|
125
|
+
.executeTakeFirst();
|
|
126
|
+
const shared = {
|
|
127
|
+
english: input.english,
|
|
128
|
+
native: input.native,
|
|
129
|
+
dir: input.dir,
|
|
130
|
+
fontHint: input.fontHint,
|
|
131
|
+
intlTag: input.intlTag,
|
|
132
|
+
pluralCategories: packJson(input.pluralCategories),
|
|
133
|
+
updatedBy,
|
|
134
|
+
updatedAt: at,
|
|
135
|
+
};
|
|
136
|
+
if (existing === undefined) {
|
|
137
|
+
await trx
|
|
138
|
+
.insertInto('adminium_locales')
|
|
139
|
+
.values({
|
|
140
|
+
id: newId('loc'),
|
|
141
|
+
locale,
|
|
142
|
+
isBuiltin: writeBool(meta, false),
|
|
143
|
+
enabled: writeBool(meta, input.enabled ?? true),
|
|
144
|
+
sortOrder: input.sortOrder ?? 0,
|
|
145
|
+
createdAt: at,
|
|
146
|
+
...shared,
|
|
147
|
+
})
|
|
148
|
+
.execute();
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
await trx
|
|
152
|
+
.updateTable('adminium_locales')
|
|
153
|
+
.set({
|
|
154
|
+
...(input.enabled === undefined ? {} : { enabled: writeBool(meta, input.enabled) }),
|
|
155
|
+
...(input.sortOrder === undefined ? {} : { sortOrder: input.sortOrder }),
|
|
156
|
+
...shared,
|
|
157
|
+
})
|
|
158
|
+
.where('locale', '=', locale)
|
|
159
|
+
.execute();
|
|
160
|
+
}
|
|
161
|
+
await bumpI18nVersion(trx, at, updatedBy);
|
|
162
|
+
});
|
|
163
|
+
const row = await this.get(locale);
|
|
164
|
+
if (row === null)
|
|
165
|
+
throw new Error(`locale row vanished after upsert: ${locale}`);
|
|
166
|
+
return row;
|
|
167
|
+
},
|
|
168
|
+
/**
|
|
169
|
+
* Delete the registry row. Reassigning the users/settings/templates that
|
|
170
|
+
* referenced the locale is the CALLER's job (23 §5.7) — this repo owns
|
|
171
|
+
* one table and deliberately does not reach across the store.
|
|
172
|
+
*/
|
|
173
|
+
async remove(locale, opts = {}) {
|
|
174
|
+
const at = opts.at ?? Date.now();
|
|
175
|
+
let deleted = 0;
|
|
176
|
+
await meta.db.transaction().execute(async (trx) => {
|
|
177
|
+
const res = await trx
|
|
178
|
+
.deleteFrom('adminium_locales')
|
|
179
|
+
.where('locale', '=', locale)
|
|
180
|
+
.executeTakeFirst();
|
|
181
|
+
deleted = affected(res.numDeletedRows);
|
|
182
|
+
if (deleted > 0)
|
|
183
|
+
await bumpI18nVersion(trx, at, opts.updatedBy ?? null);
|
|
184
|
+
});
|
|
185
|
+
return deleted > 0;
|
|
186
|
+
},
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
//# sourceMappingURL=locales.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"locales.js","sourceRoot":"","sources":["../../src/repos/locales.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAKH,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAElC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AA2CpF,SAAS,MAAM,CAAC,GAAqC;IACnD,MAAM,MAAM,GAAG,cAAc,CAAW,GAAG,CAAC,gBAAgB,CAAC,CAAC;IAC9D,OAAO;QACL,EAAE,EAAE,GAAG,CAAC,EAAE;QACV,MAAM,EAAE,GAAG,CAAC,MAAM;QAClB,SAAS,EAAE,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC;QAClC,OAAO,EAAE,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC;QAC9B,SAAS,EAAE,GAAG,CAAC,SAAS;QACxB,OAAO,EAAE,GAAG,CAAC,OAAO;QACpB,MAAM,EAAE,GAAG,CAAC,MAAM;QAClB,GAAG,EAAE,GAAG,CAAC,GAAG,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAE,GAAG,CAAC,GAAiB;QACrD,QAAQ,EAAE,GA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,CAAC,CAAC,CAAC;YACH,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;YACnC,IAAI,GAAG,KAAK,IAAI;gBAAE,MAAM,IAAI,KAAK,CAAC,qCAAqC,MAAM,EAAE,CAAC,CAAC;YACjF,OAAO,GAAG,CAAC;QACb,CAAC;QAED;;;;WAIG;QACH,KAAK,CAAC,MAAM,CACV,MAAc,EACd,OAAmD,EAAE;YAErD,MAAM,EAAE,GAAG,IAAI,CAAC,EAAE,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC;YACjC,IAAI,OAAO,GAAG,CAAC,CAAC;YAChB,MAAM,IAAI,CAAC,EAAE,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;gBAChD,MAAM,GAAG,GAAG,MAAM,GAAG;qBAClB,UAAU,CAAC,kBAAkB,CAAC;qBAC9B,KAAK,CAAC,QAAQ,EAAE,GAAG,EAAE,MAAM,CAAC;qBAC5B,gBAAgB,EAAE,CAAC;gBACtB,OAAO,GAAG,QAAQ,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;gBACvC,IAAI,OAAO,GAAG,CAAC;oBAAE,MAAM,eAAe,CAAC,GAAG,EAAE,EAAE,EAAE,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,CAAC;YAC1E,CAAC,CAAC,CAAC;YACH,OAAO,OAAO,GAAG,CAAC,CAAC;QACrB,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -17,7 +17,7 @@ export interface SchemaOverride {
|
|
|
17
17
|
tableName: string;
|
|
18
18
|
columnName: string | null;
|
|
19
19
|
value: Record<string, unknown>;
|
|
20
|
-
origin: 'user' | 'llm';
|
|
20
|
+
origin: 'user' | 'llm' | 'auto';
|
|
21
21
|
llmRunId: string | null;
|
|
22
22
|
status: 'active' | 'disabled';
|
|
23
23
|
createdBy: string | null;
|
|
@@ -31,7 +31,7 @@ export interface CreateOverrideInput {
|
|
|
31
31
|
tableName: string;
|
|
32
32
|
columnName?: string | null | undefined;
|
|
33
33
|
value: unknown;
|
|
34
|
-
origin?: 'user' | 'llm' | undefined;
|
|
34
|
+
origin?: 'user' | 'llm' | 'auto' | undefined;
|
|
35
35
|
llmRunId?: string | null | undefined;
|
|
36
36
|
status?: 'active' | 'disabled' | undefined;
|
|
37
37
|
createdBy?: string | null | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"overrides.d.ts","sourceRoot":"","sources":["../../src/repos/overrides.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAE5C,OAAO,EAIL,KAAK,UAAU,EACf,KAAK,aAAa,EACnB,MAAM,4BAA4B,CAAC;AAapC,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,YAAY,EAAE,MAAM,CAAC;IACrB,EAAE,EAAE,UAAU,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,MAAM,EAAE,MAAM,GAAG,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"overrides.d.ts","sourceRoot":"","sources":["../../src/repos/overrides.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAE5C,OAAO,EAIL,KAAK,UAAU,EACf,KAAK,aAAa,EACnB,MAAM,4BAA4B,CAAC;AAapC,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,YAAY,EAAE,MAAM,CAAC;IACrB,EAAE,EAAE,UAAU,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,KAAK,EAAE,MAA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MAAM,GACT,OAAO,CAAC,cAAc,EAAE,CAAC;IAW5B,2DAA2D;kBACvC,MAAM,UAAU,QAAQ,GAAG,UAAU,OAAM,MAAM,GAAgB,OAAO,CAAC,OAAO,CAAC;eAWpF,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;EAK7C;AAED,MAAM,MAAM,aAAa,GAAG,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"overrides.js","sourceRoot":"","sources":["../../src/repos/overrides.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAKH,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAClC,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,GAGrB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAE,mBAAmB,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAEpE,mEAAmE;AACnE,MAAM,UAAU,GAAwB,IAAI,GAAG,CAAC;IAC9C,cAAc;IACd,qBAAqB;IACrB,mBAAmB;IACnB,YAAY;IACZ,eAAe;CAChB,CAAC,CAAC;AA8BH,SAAS,MAAM,CAAC,GAA6C;IAC3D,OAAO;QACL,EAAE,EAAE,GAAG,CAAC,EAAE;QACV,YAAY,EAAE,GAAG,CAAC,YAAY;QAC9B,EAAE,EAAE,GAAG,CAAC,EAAgB;QACxB,SAAS,EAAE,GAAG,CAAC,SAAS;QACxB,UAAU,EAAE,GAAG,CAAC,UAAU;QAC1B,KAAK,EAAE,QAAQ,CAA0B,GAAG,CAAC,KAAK,CAAC;QACnD,MAAM,EAAE,GAAG,CAAC,
|
|
1
|
+
{"version":3,"file":"overrides.js","sourceRoot":"","sources":["../../src/repos/overrides.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAKH,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAClC,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACn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C,OAAO,EAAE,CAAC;gBAC1E,CAAC;gBACD,OAAO,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;YAC1B,CAAC,CAAC,CAAC;QACL,CAAC;QAED,2DAA2D;QAC3D,KAAK,CAAC,SAAS,CAAC,EAAU,EAAE,MAA6B,EAAE,KAAa,IAAI,CAAC,GAAG,EAAE;YAChF,MAAM,KAAK,GAAG,oBAAoB,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;YACrD,IAAI,CAAC,KAAK,CAAC,OAAO;gBAAE,MAAM,IAAI,mBAAmB,CAAC,yBAAyB,EAAE,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;YACjG,MAAM,GAAG,GAAG,MAAM,EAAE;iBACjB,WAAW,CAAC,2BAA2B,CAAC;iBACxC,GAAG,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC;iBAC1C,KAAK,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE,CAAC;iBACpB,gBAAgB,EAAE,CAAC;YACtB,OAAO,MAAM,CAAC,GAAG,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;QAC1C,CAAC;QAED,KAAK,CAAC,MAAM,CAAC,EAAU;YACrB,MAAM,GAAG,GAAG,MAAM,EAAE,CAAC,UAAU,CAAC,2BAA2B,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC,gBAAgB,EAAE,CAAC;YACrG,OAAO,MAAM,CAAC,GAAG,CAAC,cAAc,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC;QAChD,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* translationsRepo — adminium_translations (23-runtime-translations.md §3.2).
|
|
3
|
+
*
|
|
4
|
+
* A sparse overlay: one row per OVERRIDDEN message. Three states, and the
|
|
5
|
+
* repo preserves all three faithfully (§3.3):
|
|
6
|
+
*
|
|
7
|
+
* no row → the compiled built-in renders
|
|
8
|
+
* row, value != '' → the override renders
|
|
9
|
+
* row, value == '' → nothing renders (a deliberate blank)
|
|
10
|
+
*
|
|
11
|
+
* So `remove()` is a real DELETE (that is what "reset to built-in" means) and
|
|
12
|
+
* is NOT the same operation as upserting `''`. Callers must not conflate them.
|
|
13
|
+
*
|
|
14
|
+
* ICU validity, placeholder parity against the en-US source and the
|
|
15
|
+
* a11y-critical empty-value rule are the CALLER's job (23 §6.3): they need
|
|
16
|
+
* the compiled bundles and the locale's plural categories, neither of which
|
|
17
|
+
* the meta store may import (01-architecture.md §2.3).
|
|
18
|
+
*
|
|
19
|
+
* Every mutating method bumps `settings['i18n.version']` in the same
|
|
20
|
+
* transaction — see i18n-version.ts for why that lives here and not in the
|
|
21
|
+
* route layer.
|
|
22
|
+
*/
|
|
23
|
+
import type { MetaDb } from '../connect.js';
|
|
24
|
+
/** Reserved scope axis; always this value in v1 (§3.2). */
|
|
25
|
+
export declare const DEFAULT_TRANSLATION_SCOPE = "workspace";
|
|
26
|
+
export interface TranslationRow {
|
|
27
|
+
id: string;
|
|
28
|
+
scope: string;
|
|
29
|
+
locale: string;
|
|
30
|
+
namespace: string;
|
|
31
|
+
key: string;
|
|
32
|
+
value: string;
|
|
33
|
+
sourceText: string | null;
|
|
34
|
+
updatedBy: string | null;
|
|
35
|
+
createdAt: number;
|
|
36
|
+
updatedAt: number;
|
|
37
|
+
}
|
|
38
|
+
export interface TranslationKeyRef {
|
|
39
|
+
locale: string;
|
|
40
|
+
namespace: string;
|
|
41
|
+
key: string;
|
|
42
|
+
scope?: string | undefined;
|
|
43
|
+
}
|
|
44
|
+
export interface UpsertTranslationInput extends TranslationKeyRef {
|
|
45
|
+
value: string;
|
|
46
|
+
/** The en-US text this override was authored against (staleness badge). */
|
|
47
|
+
sourceText?: string | null | undefined;
|
|
48
|
+
}
|
|
49
|
+
export declare function translationsRepo(meta: MetaDb): {
|
|
50
|
+
/**
|
|
51
|
+
* Every override for one (locale, namespace) — the bundle read path.
|
|
52
|
+
* Served by `ix_adminium_translations_scope_locale_ns`.
|
|
53
|
+
*/
|
|
54
|
+
listBundle(locale: string, namespace: string, opts?: {
|
|
55
|
+
scope?: string | undefined;
|
|
56
|
+
}): Promise<TranslationRow[]>;
|
|
57
|
+
/** Every override for one locale, across namespaces. */
|
|
58
|
+
listLocale(locale: string, opts?: {
|
|
59
|
+
scope?: string | undefined;
|
|
60
|
+
}): Promise<TranslationRow[]>;
|
|
61
|
+
/**
|
|
62
|
+
* Rows for an explicit key slice — the editor's page fetch. The key set
|
|
63
|
+
* comes from an in-process search over the compiled bundles (§6.1), so
|
|
64
|
+
* this stays an `IN (…)` lookup and never a portable `LIKE '%q%'` scan
|
|
65
|
+
* over a growing table.
|
|
66
|
+
*/
|
|
67
|
+
listKeys(locale: string, namespace: string, keys: readonly string[], opts?: {
|
|
68
|
+
scope?: string | undefined;
|
|
69
|
+
}): Promise<TranslationRow[]>;
|
|
70
|
+
get(ref: TranslationKeyRef): Promise<TranslationRow | null>;
|
|
71
|
+
/** Total override bytes for one locale over the given namespaces (§6.4 budget). */
|
|
72
|
+
byteSize(locale: string, namespaces: readonly string[], opts?: {
|
|
73
|
+
scope?: string | undefined;
|
|
74
|
+
}): Promise<number>;
|
|
75
|
+
upsert(input: UpsertTranslationInput, opts?: {
|
|
76
|
+
updatedBy?: string | null;
|
|
77
|
+
at?: number;
|
|
78
|
+
}): Promise<TranslationRow>;
|
|
79
|
+
/**
|
|
80
|
+
* Bulk upsert in ONE transaction with ONE version bump. Chunking is the
|
|
81
|
+
* caller's concern (23 §7 uses 100 per transaction for the copy-from job);
|
|
82
|
+
* this method writes whatever it is handed atomically.
|
|
83
|
+
*/
|
|
84
|
+
upsertMany(inputs: readonly UpsertTranslationInput[], opts?: {
|
|
85
|
+
updatedBy?: string | null;
|
|
86
|
+
at?: number;
|
|
87
|
+
}): Promise<TranslationRow[]>;
|
|
88
|
+
/**
|
|
89
|
+
* Reset to built-in — a hard DELETE, never an empty-string write. An
|
|
90
|
+
* empty string is the third state ("render nothing"), which is a
|
|
91
|
+
* different intent entirely.
|
|
92
|
+
*/
|
|
93
|
+
remove(ref: TranslationKeyRef, opts?: {
|
|
94
|
+
updatedBy?: string | null;
|
|
95
|
+
at?: number;
|
|
96
|
+
}): Promise<boolean>;
|
|
97
|
+
/** Drop every override for a locale — used when a locale is deleted (§5.7). */
|
|
98
|
+
removeLocale(locale: string, opts?: {
|
|
99
|
+
updatedBy?: string | null;
|
|
100
|
+
at?: number;
|
|
101
|
+
}): Promise<number>;
|
|
102
|
+
/** Override counts per locale — the manifest's `overrideCount` (§6.1). */
|
|
103
|
+
countsByLocale(opts?: {
|
|
104
|
+
scope?: string | undefined;
|
|
105
|
+
}): Promise<Map<string, number>>;
|
|
106
|
+
};
|
|
107
|
+
//# sourceMappingURL=translations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"translations.d.ts","sourceRoot":"","sources":["../../src/repos/translations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAIH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAM5C,2DAA2D;AAC3D,eAAO,MAAM,yBAAyB,cAAc,CAAC;AAErD,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,M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