@_linked/translation 0.4.5 → 0.6.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/README.md +4 -2
- package/lib/esm/authorization.d.ts +12 -2
- package/lib/esm/authorization.js +21 -3
- package/lib/esm/authorization.js.map +1 -1
- package/lib/esm/cdn-loader.d.ts +1 -1
- package/lib/esm/cdn-loader.js.map +1 -1
- package/lib/esm/data/translation.json +1 -1
- package/lib/esm/formats/xliff.js +3 -2
- package/lib/esm/formats/xliff.js.map +1 -1
- package/lib/esm/ontologies/translation.d.ts +9 -2
- package/lib/esm/ontologies/translation.js +9 -2
- package/lib/esm/ontologies/translation.js.map +1 -1
- package/lib/esm/shapes/TranslationProvider.d.ts +17 -10
- package/lib/esm/shapes/TranslationProvider.js +278 -58
- package/lib/esm/shapes/TranslationProvider.js.map +1 -1
- package/package.json +10 -10
- package/src/authorization.ts +19 -3
- package/src/cdn-loader.ts +1 -1
- package/src/data/translation.json +1 -1
- package/src/formats/xliff.ts +3 -2
- package/src/ontologies/translation.ts +9 -2
- package/src/shapes/TranslationProvider.ts +166 -54
|
@@ -154,6 +154,8 @@ export declare function advanceTranslationReleaseHotfix(data: {
|
|
|
154
154
|
expectedSequence: number;
|
|
155
155
|
hotfixSequence: number;
|
|
156
156
|
manifestHash: string;
|
|
157
|
+
/** When given, the release must belong to this app. */
|
|
158
|
+
appId?: string;
|
|
157
159
|
}): Promise<TranslationReleaseRecord>;
|
|
158
160
|
/**
|
|
159
161
|
* Convert LINKED revision rows into plain RPC-safe records, newest first.
|
|
@@ -257,15 +259,22 @@ export declare class TranslationProvider extends ShapeProvider {
|
|
|
257
259
|
shape: typeof TranslationKey;
|
|
258
260
|
/**
|
|
259
261
|
* Authoring gate. Reads `linkedAuth` off the request the LINKED server already
|
|
260
|
-
* populates
|
|
261
|
-
*
|
|
262
|
-
*
|
|
263
|
-
*
|
|
264
|
-
*
|
|
265
|
-
*
|
|
266
|
-
*
|
|
262
|
+
* populates, so this stays portable (no Create Now import, AD-G).
|
|
263
|
+
*
|
|
264
|
+
* Every method except `getMessages` resolves the caller once, synchronously,
|
|
265
|
+
* before its first `await`, and uses that value for both the permission check
|
|
266
|
+
* and the recorded author. Reading the request again after an `await` could
|
|
267
|
+
* see a different call's request on this shared provider instance.
|
|
268
|
+
*
|
|
269
|
+
* Whether the caller may act on `appId` is decided by the host's resolver
|
|
270
|
+
* (`configureTranslationAuthorization`); with none configured, every
|
|
271
|
+
* authoring and read action is denied. `getMessages` stays public: it is the
|
|
272
|
+
* app's runtime string fetch, not an authoring surface.
|
|
273
|
+
*
|
|
274
|
+
* `requireActor` and `requireAccess` are `@internal()`: helpers of the
|
|
275
|
+
* methods below, never dispatched over HTTP.
|
|
267
276
|
*/
|
|
268
|
-
private
|
|
277
|
+
private requireActor;
|
|
269
278
|
private requireAccess;
|
|
270
279
|
listKeys(data: {
|
|
271
280
|
appId: string;
|
|
@@ -363,8 +372,6 @@ export declare class TranslationProvider extends ShapeProvider {
|
|
|
363
372
|
upsertKey(data: TranslationKeyInput): Promise<{
|
|
364
373
|
id: string;
|
|
365
374
|
}>;
|
|
366
|
-
/** WebID of the signed-in caller — never trust a client-supplied author. */
|
|
367
|
-
private authorIri;
|
|
368
375
|
upsertUnit(data: TranslationUnitInput): Promise<{
|
|
369
376
|
id: string;
|
|
370
377
|
}>;
|
|
@@ -1,4 +1,14 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
1
10
|
import { ShapeProvider } from '@_linked/server-utils/utils/ShapeProvider';
|
|
11
|
+
import { callable, internal } from '@_linked/server-utils/utils/callable';
|
|
2
12
|
import { TranslationKey } from './TranslationKey.js';
|
|
3
13
|
import { TranslationKeyVersion } from './TranslationKeyVersion.js';
|
|
4
14
|
import { TranslationRelease } from './TranslationRelease.js';
|
|
@@ -474,6 +484,9 @@ export async function advanceTranslationReleaseHotfix(data) {
|
|
|
474
484
|
const record = current ? toReleaseRecord(current) : null;
|
|
475
485
|
if (!record)
|
|
476
486
|
throw new Error(`Translation release "${id}" was not found.`);
|
|
487
|
+
if (data.appId && !sameAppId(record.appId, data.appId)) {
|
|
488
|
+
throw new Error(`Translation release "${id}" was not found.`);
|
|
489
|
+
}
|
|
477
490
|
if (record.hotfixSequence !== data.expectedSequence) {
|
|
478
491
|
throw new Error(`Translation release advanced from sequence ${data.expectedSequence} to ${record.hotfixSequence}.`);
|
|
479
492
|
}
|
|
@@ -487,6 +500,57 @@ export async function advanceTranslationReleaseHotfix(data) {
|
|
|
487
500
|
manifestHash: data.manifestHash,
|
|
488
501
|
};
|
|
489
502
|
}
|
|
503
|
+
/**
|
|
504
|
+
* The app a release IRI belongs to, without a trailing `/`. Release IRIs are
|
|
505
|
+
* minted by `createTranslationRelease` as `<appId>/translation/release/<releaseId>`
|
|
506
|
+
* with one trailing `/` of the app id dropped, so an app id `…/app/` and `…/app`
|
|
507
|
+
* give the same release IRI. Compare with `sameAppId`.
|
|
508
|
+
*/
|
|
509
|
+
function releaseAppId(id) {
|
|
510
|
+
const clean = typeof id === 'string' ? id.trim() : '';
|
|
511
|
+
const marker = '/translation/release/';
|
|
512
|
+
const at = clean.lastIndexOf(marker);
|
|
513
|
+
if (at <= 0 || at + marker.length >= clean.length) {
|
|
514
|
+
throw new Error('Not a translation release id.');
|
|
515
|
+
}
|
|
516
|
+
return clean.slice(0, at);
|
|
517
|
+
}
|
|
518
|
+
/** Whether two app ids name the same app, as release IRIs see them. */
|
|
519
|
+
function sameAppId(left, right) {
|
|
520
|
+
return left.replace(/\/$/, '') === right.replace(/\/$/, '');
|
|
521
|
+
}
|
|
522
|
+
/**
|
|
523
|
+
* The app id a release is stored under (`ofApplication`), when it is the app
|
|
524
|
+
* its IRI names. Falls back to the app id read from the IRI, so a missing
|
|
525
|
+
* release is still checked against that app.
|
|
526
|
+
*/
|
|
527
|
+
async function storedReleaseAppId(id, fromIri) {
|
|
528
|
+
const row = await TranslationRelease.select((release) => [
|
|
529
|
+
release.ofApplication,
|
|
530
|
+
])
|
|
531
|
+
.where((release) => release.equals({ id }))
|
|
532
|
+
.one()
|
|
533
|
+
.catch(() => null);
|
|
534
|
+
const stored = iri(row === null || row === void 0 ? void 0 : row.ofApplication);
|
|
535
|
+
return stored && sameAppId(stored, fromIri) ? stored : fromIri;
|
|
536
|
+
}
|
|
537
|
+
/** WebID of the signed-in caller; never a client-supplied author. */
|
|
538
|
+
function actorWebIdOf(auth) {
|
|
539
|
+
var _a, _b, _c, _d, _e, _f;
|
|
540
|
+
const webId = (_f = (_d = (_c = (_b = (_a = auth === null || auth === void 0 ? void 0 : auth.userAccount) === null || _a === void 0 ? void 0 : _a.accountOf) === null || _b === void 0 ? void 0 : _b.id) !== null && _c !== void 0 ? _c : auth === null || auth === void 0 ? void 0 : auth.webId) !== null && _d !== void 0 ? _d : (_e = auth === null || auth === void 0 ? void 0 : auth.userAccount) === null || _e === void 0 ? void 0 : _e.id) !== null && _f !== void 0 ? _f : auth === null || auth === void 0 ? void 0 : auth.userAccount;
|
|
541
|
+
return typeof webId === 'string' && webId ? webId : undefined;
|
|
542
|
+
}
|
|
543
|
+
/**
|
|
544
|
+
* An error the LINKED server answers with `status` instead of 500. It is
|
|
545
|
+
* matched by shape (`name` + numeric `status`), as `ServerCallError.is` does,
|
|
546
|
+
* so no newer `@_linked/server-utils` is needed to throw one.
|
|
547
|
+
*/
|
|
548
|
+
function translationCallError(status, message) {
|
|
549
|
+
const error = new Error(message);
|
|
550
|
+
error.name = 'ServerCallError';
|
|
551
|
+
error.status = status;
|
|
552
|
+
return error;
|
|
553
|
+
}
|
|
490
554
|
function requireText(value, label) {
|
|
491
555
|
const clean = value === null || value === void 0 ? void 0 : value.trim();
|
|
492
556
|
if (!clean)
|
|
@@ -1151,68 +1215,83 @@ export class TranslationProvider extends ShapeProvider {
|
|
|
1151
1215
|
}
|
|
1152
1216
|
/**
|
|
1153
1217
|
* Authoring gate. Reads `linkedAuth` off the request the LINKED server already
|
|
1154
|
-
* populates
|
|
1155
|
-
*
|
|
1156
|
-
*
|
|
1157
|
-
*
|
|
1158
|
-
*
|
|
1159
|
-
*
|
|
1160
|
-
*
|
|
1218
|
+
* populates, so this stays portable (no Create Now import, AD-G).
|
|
1219
|
+
*
|
|
1220
|
+
* Every method except `getMessages` resolves the caller once, synchronously,
|
|
1221
|
+
* before its first `await`, and uses that value for both the permission check
|
|
1222
|
+
* and the recorded author. Reading the request again after an `await` could
|
|
1223
|
+
* see a different call's request on this shared provider instance.
|
|
1224
|
+
*
|
|
1225
|
+
* Whether the caller may act on `appId` is decided by the host's resolver
|
|
1226
|
+
* (`configureTranslationAuthorization`); with none configured, every
|
|
1227
|
+
* authoring and read action is denied. `getMessages` stays public: it is the
|
|
1228
|
+
* app's runtime string fetch, not an authoring surface.
|
|
1229
|
+
*
|
|
1230
|
+
* `requireActor` and `requireAccess` are `@internal()`: helpers of the
|
|
1231
|
+
* methods below, never dispatched over HTTP.
|
|
1161
1232
|
*/
|
|
1162
|
-
|
|
1163
|
-
var _a
|
|
1164
|
-
const
|
|
1165
|
-
if (!
|
|
1166
|
-
throw
|
|
1233
|
+
requireActor() {
|
|
1234
|
+
var _a;
|
|
1235
|
+
const auth = (_a = this.request) === null || _a === void 0 ? void 0 : _a.linkedAuth;
|
|
1236
|
+
if (!(auth === null || auth === void 0 ? void 0 : auth.userAccount)) {
|
|
1237
|
+
throw translationCallError(401, 'Authentication required to read or edit translations.');
|
|
1167
1238
|
}
|
|
1239
|
+
const webId = actorWebIdOf(auth);
|
|
1240
|
+
if (!webId) {
|
|
1241
|
+
throw new Error('Translation permission required.');
|
|
1242
|
+
}
|
|
1243
|
+
return webId;
|
|
1168
1244
|
}
|
|
1169
|
-
async requireAccess(data, action) {
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1245
|
+
async requireAccess(actorWebId, data, action) {
|
|
1246
|
+
const appId = typeof (data === null || data === void 0 ? void 0 : data.appId) === 'string' ? data.appId.trim() : '';
|
|
1247
|
+
if (!appId)
|
|
1248
|
+
throw new Error('appId is required.');
|
|
1249
|
+
if (!(await canAuthorTranslation({
|
|
1250
|
+
appId,
|
|
1251
|
+
actorWebId,
|
|
1252
|
+
action,
|
|
1253
|
+
language: data === null || data === void 0 ? void 0 : data.language,
|
|
1254
|
+
}))) {
|
|
1179
1255
|
throw new Error(`Translation ${action} permission required.`);
|
|
1180
1256
|
}
|
|
1181
1257
|
}
|
|
1182
1258
|
async listKeys(data) {
|
|
1183
|
-
this.
|
|
1259
|
+
const actor = this.requireActor();
|
|
1260
|
+
await this.requireAccess(actor, { appId: data === null || data === void 0 ? void 0 : data.appId }, 'read');
|
|
1184
1261
|
return listTranslationKeys(data);
|
|
1185
1262
|
}
|
|
1186
1263
|
async listEntries(data) {
|
|
1187
|
-
this.
|
|
1264
|
+
const actor = this.requireActor();
|
|
1265
|
+
await this.requireAccess(actor, { appId: data === null || data === void 0 ? void 0 : data.appId }, 'read');
|
|
1188
1266
|
return listTranslationEntries(data);
|
|
1189
1267
|
}
|
|
1190
1268
|
async listKeyVersions(data) {
|
|
1191
|
-
this.
|
|
1269
|
+
const actor = this.requireActor();
|
|
1270
|
+
await this.requireAccess(actor, { appId: data === null || data === void 0 ? void 0 : data.appId }, 'read');
|
|
1192
1271
|
return listTranslationKeyVersions(data);
|
|
1193
1272
|
}
|
|
1194
1273
|
async listMemoryMatches(data) {
|
|
1195
|
-
this.
|
|
1274
|
+
const actor = this.requireActor();
|
|
1275
|
+
await this.requireAccess(actor, { appId: data === null || data === void 0 ? void 0 : data.appId }, 'read');
|
|
1196
1276
|
return listTranslationMemoryMatches(data);
|
|
1197
1277
|
}
|
|
1198
1278
|
async proposeRevision(data) {
|
|
1199
1279
|
var _a, _b, _c;
|
|
1200
|
-
|
|
1280
|
+
const actor = this.requireActor();
|
|
1281
|
+
await this.requireAccess(actor, data, 'propose');
|
|
1201
1282
|
const currentEntries = await listTranslationEntries({ appId: data.appId });
|
|
1202
1283
|
const basedOnText = (_c = (_b = (_a = currentEntries.find(({ key }) => key === data.key)) === null || _a === void 0 ? void 0 : _a.units[data.language]) === null || _b === void 0 ? void 0 : _b.text) !== null && _c !== void 0 ? _c : '';
|
|
1203
1284
|
return createTranslationRevision({
|
|
1204
1285
|
...data,
|
|
1205
1286
|
basedOnText,
|
|
1206
1287
|
status: 'proposed',
|
|
1207
|
-
author:
|
|
1288
|
+
author: actor,
|
|
1208
1289
|
authorKind: 'human',
|
|
1209
1290
|
});
|
|
1210
1291
|
}
|
|
1211
1292
|
async listProposals(data) {
|
|
1212
|
-
this.
|
|
1213
|
-
|
|
1214
|
-
if (!actorWebId)
|
|
1215
|
-
throw new Error('Translation read permission required.');
|
|
1293
|
+
const actorWebId = this.requireActor();
|
|
1294
|
+
await this.requireAccess(actorWebId, { appId: data === null || data === void 0 ? void 0 : data.appId }, 'read');
|
|
1216
1295
|
const proposals = await listTranslationProposals(data);
|
|
1217
1296
|
const allowed = await Promise.all(proposals.map((proposal) => canAuthorTranslation({
|
|
1218
1297
|
appId: data.appId,
|
|
@@ -1223,6 +1302,8 @@ export class TranslationProvider extends ShapeProvider {
|
|
|
1223
1302
|
return proposals.filter((_, index) => allowed[index]);
|
|
1224
1303
|
}
|
|
1225
1304
|
async decideProposal(data) {
|
|
1305
|
+
const actor = this.requireActor();
|
|
1306
|
+
await this.requireAccess(actor, { appId: data.appId }, 'review');
|
|
1226
1307
|
const proposal = await getTranslationRevision({
|
|
1227
1308
|
appId: data.appId,
|
|
1228
1309
|
revisionId: data.revisionId,
|
|
@@ -1230,47 +1311,50 @@ export class TranslationProvider extends ShapeProvider {
|
|
|
1230
1311
|
if (!proposal) {
|
|
1231
1312
|
throw new Error('This translation proposal is no longer pending.');
|
|
1232
1313
|
}
|
|
1233
|
-
await this.requireAccess({ appId: data.appId, language: proposal.language }, 'review');
|
|
1234
|
-
return decideTranslationProposal(data,
|
|
1314
|
+
await this.requireAccess(actor, { appId: data.appId, language: proposal.language }, 'review');
|
|
1315
|
+
return decideTranslationProposal(data, actor);
|
|
1235
1316
|
}
|
|
1236
1317
|
async listMemory(data) {
|
|
1237
|
-
this.
|
|
1318
|
+
const actor = this.requireActor();
|
|
1319
|
+
await this.requireAccess(actor, { appId: data === null || data === void 0 ? void 0 : data.appId }, 'read');
|
|
1238
1320
|
return listTranslationMemory(data);
|
|
1239
1321
|
}
|
|
1240
1322
|
async pretranslateMemory(data) {
|
|
1241
|
-
|
|
1242
|
-
|
|
1323
|
+
const actor = this.requireActor();
|
|
1324
|
+
await this.requireAccess(actor, data, 'run-mt');
|
|
1325
|
+
return pretranslateFromMemory(data, { author: actor });
|
|
1243
1326
|
}
|
|
1244
1327
|
async applyMemoryMatch(data) {
|
|
1245
|
-
|
|
1246
|
-
|
|
1328
|
+
const actor = this.requireActor();
|
|
1329
|
+
await this.requireAccess(actor, data, 'review');
|
|
1330
|
+
return applyTranslationMemoryMatch(data, { author: actor });
|
|
1247
1331
|
}
|
|
1248
1332
|
async listReleases(data) {
|
|
1249
|
-
this.
|
|
1333
|
+
const actor = this.requireActor();
|
|
1334
|
+
await this.requireAccess(actor, { appId: data === null || data === void 0 ? void 0 : data.appId }, 'read');
|
|
1250
1335
|
return listTranslationReleases(data);
|
|
1251
1336
|
}
|
|
1252
1337
|
async createRelease(data) {
|
|
1253
|
-
this.
|
|
1338
|
+
const actor = this.requireActor();
|
|
1339
|
+
await this.requireAccess(actor, data, 'manage');
|
|
1254
1340
|
return createTranslationRelease(data);
|
|
1255
1341
|
}
|
|
1256
1342
|
async advanceReleaseHotfix(data) {
|
|
1257
|
-
this.
|
|
1258
|
-
|
|
1343
|
+
const actor = this.requireActor();
|
|
1344
|
+
const id = typeof (data === null || data === void 0 ? void 0 : data.id) === 'string' ? data.id.trim() : '';
|
|
1345
|
+
const appId = await storedReleaseAppId(id, releaseAppId(id));
|
|
1346
|
+
await this.requireAccess(actor, { appId }, 'manage');
|
|
1347
|
+
return advanceTranslationReleaseHotfix({ ...data, appId });
|
|
1259
1348
|
}
|
|
1260
1349
|
async upsertKey(data) {
|
|
1261
|
-
this.
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
/** WebID of the signed-in caller — never trust a client-supplied author. */
|
|
1265
|
-
authorIri() {
|
|
1266
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
1267
|
-
const auth = (_a = this.request) === null || _a === void 0 ? void 0 : _a.linkedAuth;
|
|
1268
|
-
const webId = (_g = (_e = (_d = (_c = (_b = auth === null || auth === void 0 ? void 0 : auth.userAccount) === null || _b === void 0 ? void 0 : _b.accountOf) === null || _c === void 0 ? void 0 : _c.id) !== null && _d !== void 0 ? _d : auth === null || auth === void 0 ? void 0 : auth.webId) !== null && _e !== void 0 ? _e : (_f = auth === null || auth === void 0 ? void 0 : auth.userAccount) === null || _f === void 0 ? void 0 : _f.id) !== null && _g !== void 0 ? _g : auth === null || auth === void 0 ? void 0 : auth.userAccount;
|
|
1269
|
-
return typeof webId === 'string' && webId ? webId : undefined;
|
|
1350
|
+
const actor = this.requireActor();
|
|
1351
|
+
await this.requireAccess(actor, data, 'manage');
|
|
1352
|
+
return upsertTranslationKey(data, { createdBy: actor });
|
|
1270
1353
|
}
|
|
1271
1354
|
async upsertUnit(data) {
|
|
1272
|
-
|
|
1273
|
-
|
|
1355
|
+
const actor = this.requireActor();
|
|
1356
|
+
await this.requireAccess(actor, data, 'review');
|
|
1357
|
+
return upsertTranslationUnit({ ...data, updatedBy: undefined }, { author: actor, authorKind: 'human' });
|
|
1274
1358
|
}
|
|
1275
1359
|
/**
|
|
1276
1360
|
* Glossary CRUD (Plan 017 Slice B). App-data is branch-routed per app, so
|
|
@@ -1279,12 +1363,14 @@ export class TranslationProvider extends ShapeProvider {
|
|
|
1279
1363
|
* delete-then-create on that identity.
|
|
1280
1364
|
*/
|
|
1281
1365
|
async listGlossary(data) {
|
|
1282
|
-
this.
|
|
1366
|
+
const actor = this.requireActor();
|
|
1367
|
+
await this.requireAccess(actor, { appId: data === null || data === void 0 ? void 0 : data.appId }, 'read');
|
|
1283
1368
|
return listGlossaryTerms(data);
|
|
1284
1369
|
}
|
|
1285
1370
|
async upsertGlossaryTerm(data) {
|
|
1286
1371
|
var _a, _b, _c, _d, _e;
|
|
1287
|
-
|
|
1372
|
+
const actor = this.requireActor();
|
|
1373
|
+
await this.requireAccess(actor, data, 'manage');
|
|
1288
1374
|
const appId = requireText(data.appId, 'appId');
|
|
1289
1375
|
const term = requireText(data.term, 'term');
|
|
1290
1376
|
const language = ((_a = data.language) === null || _a === void 0 ? void 0 : _a.trim()) || '';
|
|
@@ -1310,7 +1396,8 @@ export class TranslationProvider extends ShapeProvider {
|
|
|
1310
1396
|
return { id };
|
|
1311
1397
|
}
|
|
1312
1398
|
async deleteGlossaryTerm(data) {
|
|
1313
|
-
|
|
1399
|
+
const actor = this.requireActor();
|
|
1400
|
+
await this.requireAccess(actor, data, 'manage');
|
|
1314
1401
|
const appId = requireText(data.appId, 'appId');
|
|
1315
1402
|
const id = requireText(data.id, 'id');
|
|
1316
1403
|
// Only glossary nodes under this app's namespace may be deleted here.
|
|
@@ -1322,7 +1409,8 @@ export class TranslationProvider extends ShapeProvider {
|
|
|
1322
1409
|
}
|
|
1323
1410
|
/** History for one (key, language) cell — newest first (Plan 017 AD-P). */
|
|
1324
1411
|
async listRevisions(data) {
|
|
1325
|
-
this.
|
|
1412
|
+
const actor = this.requireActor();
|
|
1413
|
+
await this.requireAccess(actor, { appId: data === null || data === void 0 ? void 0 : data.appId }, 'read');
|
|
1326
1414
|
const appId = requireText(data.appId, 'appId');
|
|
1327
1415
|
const key = requireText(data.key, 'key');
|
|
1328
1416
|
const language = requireText(data.language, 'language');
|
|
@@ -1373,4 +1461,136 @@ export class TranslationProvider extends ShapeProvider {
|
|
|
1373
1461
|
.filter(([key]) => typeof key === 'string' && key.length > 0));
|
|
1374
1462
|
}
|
|
1375
1463
|
}
|
|
1464
|
+
__decorate([
|
|
1465
|
+
internal(),
|
|
1466
|
+
__metadata("design:type", Function),
|
|
1467
|
+
__metadata("design:paramtypes", []),
|
|
1468
|
+
__metadata("design:returntype", String)
|
|
1469
|
+
], TranslationProvider.prototype, "requireActor", null);
|
|
1470
|
+
__decorate([
|
|
1471
|
+
internal(),
|
|
1472
|
+
__metadata("design:type", Function),
|
|
1473
|
+
__metadata("design:paramtypes", [String, Object, String]),
|
|
1474
|
+
__metadata("design:returntype", Promise)
|
|
1475
|
+
], TranslationProvider.prototype, "requireAccess", null);
|
|
1476
|
+
__decorate([
|
|
1477
|
+
callable('user'),
|
|
1478
|
+
__metadata("design:type", Function),
|
|
1479
|
+
__metadata("design:paramtypes", [Object]),
|
|
1480
|
+
__metadata("design:returntype", Promise)
|
|
1481
|
+
], TranslationProvider.prototype, "listKeys", null);
|
|
1482
|
+
__decorate([
|
|
1483
|
+
callable('user'),
|
|
1484
|
+
__metadata("design:type", Function),
|
|
1485
|
+
__metadata("design:paramtypes", [Object]),
|
|
1486
|
+
__metadata("design:returntype", Promise)
|
|
1487
|
+
], TranslationProvider.prototype, "listEntries", null);
|
|
1488
|
+
__decorate([
|
|
1489
|
+
callable('user'),
|
|
1490
|
+
__metadata("design:type", Function),
|
|
1491
|
+
__metadata("design:paramtypes", [Object]),
|
|
1492
|
+
__metadata("design:returntype", Promise)
|
|
1493
|
+
], TranslationProvider.prototype, "listKeyVersions", null);
|
|
1494
|
+
__decorate([
|
|
1495
|
+
callable('user'),
|
|
1496
|
+
__metadata("design:type", Function),
|
|
1497
|
+
__metadata("design:paramtypes", [Object]),
|
|
1498
|
+
__metadata("design:returntype", Promise)
|
|
1499
|
+
], TranslationProvider.prototype, "listMemoryMatches", null);
|
|
1500
|
+
__decorate([
|
|
1501
|
+
callable('user'),
|
|
1502
|
+
__metadata("design:type", Function),
|
|
1503
|
+
__metadata("design:paramtypes", [Object]),
|
|
1504
|
+
__metadata("design:returntype", Promise)
|
|
1505
|
+
], TranslationProvider.prototype, "proposeRevision", null);
|
|
1506
|
+
__decorate([
|
|
1507
|
+
callable('user'),
|
|
1508
|
+
__metadata("design:type", Function),
|
|
1509
|
+
__metadata("design:paramtypes", [Object]),
|
|
1510
|
+
__metadata("design:returntype", Promise)
|
|
1511
|
+
], TranslationProvider.prototype, "listProposals", null);
|
|
1512
|
+
__decorate([
|
|
1513
|
+
callable('user'),
|
|
1514
|
+
__metadata("design:type", Function),
|
|
1515
|
+
__metadata("design:paramtypes", [Object]),
|
|
1516
|
+
__metadata("design:returntype", Promise)
|
|
1517
|
+
], TranslationProvider.prototype, "decideProposal", null);
|
|
1518
|
+
__decorate([
|
|
1519
|
+
callable('user'),
|
|
1520
|
+
__metadata("design:type", Function),
|
|
1521
|
+
__metadata("design:paramtypes", [Object]),
|
|
1522
|
+
__metadata("design:returntype", Promise)
|
|
1523
|
+
], TranslationProvider.prototype, "listMemory", null);
|
|
1524
|
+
__decorate([
|
|
1525
|
+
callable('user'),
|
|
1526
|
+
__metadata("design:type", Function),
|
|
1527
|
+
__metadata("design:paramtypes", [Object]),
|
|
1528
|
+
__metadata("design:returntype", Promise)
|
|
1529
|
+
], TranslationProvider.prototype, "pretranslateMemory", null);
|
|
1530
|
+
__decorate([
|
|
1531
|
+
callable('user'),
|
|
1532
|
+
__metadata("design:type", Function),
|
|
1533
|
+
__metadata("design:paramtypes", [Object]),
|
|
1534
|
+
__metadata("design:returntype", Promise)
|
|
1535
|
+
], TranslationProvider.prototype, "applyMemoryMatch", null);
|
|
1536
|
+
__decorate([
|
|
1537
|
+
callable('user'),
|
|
1538
|
+
__metadata("design:type", Function),
|
|
1539
|
+
__metadata("design:paramtypes", [Object]),
|
|
1540
|
+
__metadata("design:returntype", Promise)
|
|
1541
|
+
], TranslationProvider.prototype, "listReleases", null);
|
|
1542
|
+
__decorate([
|
|
1543
|
+
callable('user'),
|
|
1544
|
+
__metadata("design:type", Function),
|
|
1545
|
+
__metadata("design:paramtypes", [Object]),
|
|
1546
|
+
__metadata("design:returntype", Promise)
|
|
1547
|
+
], TranslationProvider.prototype, "createRelease", null);
|
|
1548
|
+
__decorate([
|
|
1549
|
+
callable('user'),
|
|
1550
|
+
__metadata("design:type", Function),
|
|
1551
|
+
__metadata("design:paramtypes", [Object]),
|
|
1552
|
+
__metadata("design:returntype", Promise)
|
|
1553
|
+
], TranslationProvider.prototype, "advanceReleaseHotfix", null);
|
|
1554
|
+
__decorate([
|
|
1555
|
+
callable('user'),
|
|
1556
|
+
__metadata("design:type", Function),
|
|
1557
|
+
__metadata("design:paramtypes", [Object]),
|
|
1558
|
+
__metadata("design:returntype", Promise)
|
|
1559
|
+
], TranslationProvider.prototype, "upsertKey", null);
|
|
1560
|
+
__decorate([
|
|
1561
|
+
callable('user'),
|
|
1562
|
+
__metadata("design:type", Function),
|
|
1563
|
+
__metadata("design:paramtypes", [Object]),
|
|
1564
|
+
__metadata("design:returntype", Promise)
|
|
1565
|
+
], TranslationProvider.prototype, "upsertUnit", null);
|
|
1566
|
+
__decorate([
|
|
1567
|
+
callable('user'),
|
|
1568
|
+
__metadata("design:type", Function),
|
|
1569
|
+
__metadata("design:paramtypes", [Object]),
|
|
1570
|
+
__metadata("design:returntype", Promise)
|
|
1571
|
+
], TranslationProvider.prototype, "listGlossary", null);
|
|
1572
|
+
__decorate([
|
|
1573
|
+
callable('user'),
|
|
1574
|
+
__metadata("design:type", Function),
|
|
1575
|
+
__metadata("design:paramtypes", [Object]),
|
|
1576
|
+
__metadata("design:returntype", Promise)
|
|
1577
|
+
], TranslationProvider.prototype, "upsertGlossaryTerm", null);
|
|
1578
|
+
__decorate([
|
|
1579
|
+
callable('user'),
|
|
1580
|
+
__metadata("design:type", Function),
|
|
1581
|
+
__metadata("design:paramtypes", [Object]),
|
|
1582
|
+
__metadata("design:returntype", Promise)
|
|
1583
|
+
], TranslationProvider.prototype, "deleteGlossaryTerm", null);
|
|
1584
|
+
__decorate([
|
|
1585
|
+
callable('user'),
|
|
1586
|
+
__metadata("design:type", Function),
|
|
1587
|
+
__metadata("design:paramtypes", [Object]),
|
|
1588
|
+
__metadata("design:returntype", Promise)
|
|
1589
|
+
], TranslationProvider.prototype, "listRevisions", null);
|
|
1590
|
+
__decorate([
|
|
1591
|
+
callable('public'),
|
|
1592
|
+
__metadata("design:type", Function),
|
|
1593
|
+
__metadata("design:paramtypes", [Object]),
|
|
1594
|
+
__metadata("design:returntype", Promise)
|
|
1595
|
+
], TranslationProvider.prototype, "getMessages", null);
|
|
1376
1596
|
//# sourceMappingURL=TranslationProvider.js.map
|