@spinajs/intl-orm 2.0.180 → 2.0.182
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/lib/cjs/decorators.d.ts +1 -1
- package/lib/cjs/decorators.js +18 -18
- package/lib/cjs/index.d.ts +61 -61
- package/lib/cjs/index.js +215 -215
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/migrations/IntlOrm_2022_06_28_01_13_00.d.ts +5 -5
- package/lib/cjs/migrations/IntlOrm_2022_06_28_01_13_00.js +37 -37
- package/lib/cjs/migrations/IntlOrm_2022_06_28_01_13_00.js.map +1 -1
- package/lib/cjs/model.d.ts +12 -12
- package/lib/cjs/model.js +70 -70
- package/lib/cjs/models/IntlResource.d.ts +13 -13
- package/lib/cjs/models/IntlResource.js +22 -22
- package/lib/cjs/models/IntlResource.js.map +1 -1
- package/lib/cjs/models/IntlTranslation.d.ts +12 -12
- package/lib/cjs/models/IntlTranslation.js +29 -29
- package/lib/cjs/models/IntlTranslation.js.map +1 -1
- package/lib/mjs/decorators.d.ts +1 -1
- package/lib/mjs/decorators.js +14 -14
- package/lib/mjs/index.d.ts +61 -61
- package/lib/mjs/index.js +194 -194
- package/lib/mjs/index.js.map +1 -1
- package/lib/mjs/migrations/IntlOrm_2022_06_28_01_13_00.d.ts +5 -5
- package/lib/mjs/migrations/IntlOrm_2022_06_28_01_13_00.js +34 -34
- package/lib/mjs/migrations/IntlOrm_2022_06_28_01_13_00.js.map +1 -1
- package/lib/mjs/model.d.ts +12 -12
- package/lib/mjs/model.js +63 -63
- package/lib/mjs/models/IntlResource.d.ts +13 -13
- package/lib/mjs/models/IntlResource.js +19 -19
- package/lib/mjs/models/IntlResource.js.map +1 -1
- package/lib/mjs/models/IntlTranslation.d.ts +12 -12
- package/lib/mjs/models/IntlTranslation.js +26 -26
- package/lib/mjs/models/IntlTranslation.js.map +1 -1
- package/lib/tsconfig.cjs.tsbuildinfo +1 -1
- package/lib/tsconfig.mjs.tsbuildinfo +1 -1
- package/package.json +9 -9
package/lib/cjs/decorators.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare function Translate(): any;
|
|
1
|
+
export declare function Translate(): any;
|
|
2
2
|
//# sourceMappingURL=decorators.d.ts.map
|
package/lib/cjs/decorators.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Translate = void 0;
|
|
4
|
-
const orm_1 = require("@spinajs/orm");
|
|
5
|
-
function Translate() {
|
|
6
|
-
return (0, orm_1.extractDecoratorDescriptor)((model, _target, propertyKey) => {
|
|
7
|
-
const columnDesc = model.Columns.find((c) => c.Name === propertyKey);
|
|
8
|
-
if (!columnDesc) {
|
|
9
|
-
// we dont want to fill all props, they will be loaded from db and mergeg with this
|
|
10
|
-
model.Columns.push({ Name: propertyKey, Translate: true });
|
|
11
|
-
}
|
|
12
|
-
else {
|
|
13
|
-
columnDesc.Translate = true;
|
|
14
|
-
}
|
|
15
|
-
model.Translatable = true;
|
|
16
|
-
}, true);
|
|
17
|
-
}
|
|
18
|
-
exports.Translate = Translate;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Translate = void 0;
|
|
4
|
+
const orm_1 = require("@spinajs/orm");
|
|
5
|
+
function Translate() {
|
|
6
|
+
return (0, orm_1.extractDecoratorDescriptor)((model, _target, propertyKey) => {
|
|
7
|
+
const columnDesc = model.Columns.find((c) => c.Name === propertyKey);
|
|
8
|
+
if (!columnDesc) {
|
|
9
|
+
// we dont want to fill all props, they will be loaded from db and mergeg with this
|
|
10
|
+
model.Columns.push({ Name: propertyKey, Translate: true });
|
|
11
|
+
}
|
|
12
|
+
else {
|
|
13
|
+
columnDesc.Translate = true;
|
|
14
|
+
}
|
|
15
|
+
model.Translatable = true;
|
|
16
|
+
}, true);
|
|
17
|
+
}
|
|
18
|
+
exports.Translate = Translate;
|
|
19
19
|
//# sourceMappingURL=decorators.js.map
|
package/lib/cjs/index.d.ts
CHANGED
|
@@ -1,62 +1,62 @@
|
|
|
1
|
-
import { Container } from '@spinajs/di';
|
|
2
|
-
import { IModelDescriptor, ModelBase, OrmRelation, SelectQueryBuilder, QueryBuilder, QueryMiddleware, IBuilderMiddleware, IOrmRelation, ISelectQueryBuilder } from '@spinajs/orm';
|
|
3
|
-
import { TranslationSource } from '@spinajs/intl';
|
|
4
|
-
export * from './decorators.js';
|
|
5
|
-
export * from './migrations/IntlOrm_2022_06_28_01_13_00.js';
|
|
6
|
-
export * from './models/IntlResource.js';
|
|
7
|
-
export * from './models/IntlTranslation.js';
|
|
8
|
-
export * from './model.js';
|
|
9
|
-
declare module '@spinajs/orm' {
|
|
10
|
-
interface ISelectQueryBuilder<T> {
|
|
11
|
-
/**
|
|
12
|
-
*
|
|
13
|
-
* Translates model to given language.
|
|
14
|
-
* Working only with queries thata are model related ( created by model orm functions )
|
|
15
|
-
* TODO: in future it should work with raw queries, by passing relation information for translation
|
|
16
|
-
* TODO: fallback for translation from normal sources ( like config files )
|
|
17
|
-
*
|
|
18
|
-
* @param lang translate to language
|
|
19
|
-
*/
|
|
20
|
-
translate(lang: string): SelectQueryBuilder<T>;
|
|
21
|
-
translated: boolean;
|
|
22
|
-
AllowTranslate: boolean;
|
|
23
|
-
}
|
|
24
|
-
interface IColumnDescriptor {
|
|
25
|
-
Translate: boolean;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
export declare class IntlModelRelation extends OrmRelation {
|
|
29
|
-
protected _lang: string;
|
|
30
|
-
protected _mDescriptor: IModelDescriptor;
|
|
31
|
-
constructor(_container: Container, _lang: string, _query: ISelectQueryBuilder, _mDescriptor: IModelDescriptor, _parentRelation?: OrmRelation);
|
|
32
|
-
execute(): void;
|
|
33
|
-
translate(_lang: string): void;
|
|
34
|
-
}
|
|
35
|
-
export declare class IntlModelMiddleware implements IBuilderMiddleware {
|
|
36
|
-
protected _lang: string;
|
|
37
|
-
protected _relationQuery: ISelectQueryBuilder;
|
|
38
|
-
protected _description: IModelDescriptor;
|
|
39
|
-
protected _owner: IOrmRelation;
|
|
40
|
-
constructor(_lang: string, _relationQuery: ISelectQueryBuilder, _description: IModelDescriptor, _owner: IOrmRelation);
|
|
41
|
-
afterQueryCreation(_query: QueryBuilder<any>): void;
|
|
42
|
-
afterQuery(data: any[]): any[];
|
|
43
|
-
modelCreation(_: any): ModelBase;
|
|
44
|
-
afterHydration(data: ModelBase[]): Promise<any[]>;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Middleware for automatic query translations
|
|
48
|
-
* for modes. If query is standalone ( not created by model related function )
|
|
49
|
-
* skips translation completely.
|
|
50
|
-
* When AsyncStorage is set & language property is present
|
|
51
|
-
*
|
|
52
|
-
*/
|
|
53
|
-
export declare class IntlQueryMiddleware extends QueryMiddleware {
|
|
54
|
-
beforeQueryExecution(builder: QueryBuilder<any>): void;
|
|
55
|
-
afterQueryCreation(_builder: QueryBuilder): void;
|
|
56
|
-
}
|
|
57
|
-
export declare class DbTranslationSource extends TranslationSource {
|
|
58
|
-
load(): Promise<{
|
|
59
|
-
[x: string]: any;
|
|
60
|
-
}>;
|
|
61
|
-
}
|
|
1
|
+
import { Container } from '@spinajs/di';
|
|
2
|
+
import { IModelDescriptor, ModelBase, OrmRelation, SelectQueryBuilder, QueryBuilder, QueryMiddleware, IBuilderMiddleware, IOrmRelation, ISelectQueryBuilder } from '@spinajs/orm';
|
|
3
|
+
import { TranslationSource } from '@spinajs/intl';
|
|
4
|
+
export * from './decorators.js';
|
|
5
|
+
export * from './migrations/IntlOrm_2022_06_28_01_13_00.js';
|
|
6
|
+
export * from './models/IntlResource.js';
|
|
7
|
+
export * from './models/IntlTranslation.js';
|
|
8
|
+
export * from './model.js';
|
|
9
|
+
declare module '@spinajs/orm' {
|
|
10
|
+
interface ISelectQueryBuilder<T> {
|
|
11
|
+
/**
|
|
12
|
+
*
|
|
13
|
+
* Translates model to given language.
|
|
14
|
+
* Working only with queries thata are model related ( created by model orm functions )
|
|
15
|
+
* TODO: in future it should work with raw queries, by passing relation information for translation
|
|
16
|
+
* TODO: fallback for translation from normal sources ( like config files )
|
|
17
|
+
*
|
|
18
|
+
* @param lang translate to language
|
|
19
|
+
*/
|
|
20
|
+
translate(lang: string): SelectQueryBuilder<T>;
|
|
21
|
+
translated: boolean;
|
|
22
|
+
AllowTranslate: boolean;
|
|
23
|
+
}
|
|
24
|
+
interface IColumnDescriptor {
|
|
25
|
+
Translate: boolean;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
export declare class IntlModelRelation extends OrmRelation {
|
|
29
|
+
protected _lang: string;
|
|
30
|
+
protected _mDescriptor: IModelDescriptor;
|
|
31
|
+
constructor(_container: Container, _lang: string, _query: ISelectQueryBuilder, _mDescriptor: IModelDescriptor, _parentRelation?: OrmRelation);
|
|
32
|
+
execute(): void;
|
|
33
|
+
translate(_lang: string): void;
|
|
34
|
+
}
|
|
35
|
+
export declare class IntlModelMiddleware implements IBuilderMiddleware {
|
|
36
|
+
protected _lang: string;
|
|
37
|
+
protected _relationQuery: ISelectQueryBuilder;
|
|
38
|
+
protected _description: IModelDescriptor;
|
|
39
|
+
protected _owner: IOrmRelation;
|
|
40
|
+
constructor(_lang: string, _relationQuery: ISelectQueryBuilder, _description: IModelDescriptor, _owner: IOrmRelation);
|
|
41
|
+
afterQueryCreation(_query: QueryBuilder<any>): void;
|
|
42
|
+
afterQuery(data: any[]): any[];
|
|
43
|
+
modelCreation(_: any): ModelBase;
|
|
44
|
+
afterHydration(data: ModelBase[]): Promise<any[]>;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Middleware for automatic query translations
|
|
48
|
+
* for modes. If query is standalone ( not created by model related function )
|
|
49
|
+
* skips translation completely.
|
|
50
|
+
* When AsyncStorage is set & language property is present
|
|
51
|
+
*
|
|
52
|
+
*/
|
|
53
|
+
export declare class IntlQueryMiddleware extends QueryMiddleware {
|
|
54
|
+
beforeQueryExecution(builder: QueryBuilder<any>): void;
|
|
55
|
+
afterQueryCreation(_builder: QueryBuilder): void;
|
|
56
|
+
}
|
|
57
|
+
export declare class DbTranslationSource extends TranslationSource {
|
|
58
|
+
load(): Promise<{
|
|
59
|
+
[x: string]: any;
|
|
60
|
+
}>;
|
|
61
|
+
}
|
|
62
62
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/cjs/index.js
CHANGED
|
@@ -1,216 +1,216 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
14
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
15
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
16
|
-
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;
|
|
17
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
18
|
-
};
|
|
19
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
20
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
21
|
-
};
|
|
22
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
23
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
24
|
-
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.DbTranslationSource = exports.IntlQueryMiddleware = exports.IntlModelMiddleware = exports.IntlModelRelation = void 0;
|
|
30
|
-
const di_1 = require("@spinajs/di");
|
|
31
|
-
const orm_1 = require("@spinajs/orm");
|
|
32
|
-
const intl_1 = require("@spinajs/intl");
|
|
33
|
-
const lodash_1 = __importDefault(require("lodash"));
|
|
34
|
-
const IntlTranslation_js_1 = require("./models/IntlTranslation.js");
|
|
35
|
-
const IntlResource_js_1 = require("./models/IntlResource.js");
|
|
36
|
-
const configuration_common_1 = require("@spinajs/configuration-common");
|
|
37
|
-
const async_hooks_1 = require("async_hooks");
|
|
38
|
-
__exportStar(require("./decorators.js"), exports);
|
|
39
|
-
__exportStar(require("./migrations/IntlOrm_2022_06_28_01_13_00.js"), exports);
|
|
40
|
-
__exportStar(require("./models/IntlResource.js"), exports);
|
|
41
|
-
__exportStar(require("./models/IntlTranslation.js"), exports);
|
|
42
|
-
__exportStar(require("./model.js"), exports);
|
|
43
|
-
let IntlModelRelation = class IntlModelRelation extends orm_1.OrmRelation {
|
|
44
|
-
constructor(_container, _lang, _query, _mDescriptor, _parentRelation) {
|
|
45
|
-
super(_container, _query, {
|
|
46
|
-
TargetModel: IntlResource_js_1.IntlResource,
|
|
47
|
-
TargetModelType: IntlResource_js_1.IntlResource,
|
|
48
|
-
Name: 'Translations',
|
|
49
|
-
Type: orm_1.RelationType.Many,
|
|
50
|
-
SourceModel: null,
|
|
51
|
-
ForeignKey: '',
|
|
52
|
-
PrimaryKey: '',
|
|
53
|
-
Recursive: false,
|
|
54
|
-
}, _parentRelation);
|
|
55
|
-
this._lang = _lang;
|
|
56
|
-
this._mDescriptor = _mDescriptor;
|
|
57
|
-
this._relationQuery.from('intl_resources', this.Alias);
|
|
58
|
-
}
|
|
59
|
-
execute() {
|
|
60
|
-
this._query.middleware(new IntlModelMiddleware(this._lang, this._relationQuery, this._mDescriptor, this.parentRelation));
|
|
61
|
-
}
|
|
62
|
-
translate(_lang) {
|
|
63
|
-
// empty, cannot translate translation relation!
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
IntlModelRelation =
|
|
67
|
-
|
|
68
|
-
(0, di_1.
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
class IntlModelMiddleware {
|
|
73
|
-
constructor(_lang, _relationQuery, _description, _owner) {
|
|
74
|
-
this._lang = _lang;
|
|
75
|
-
this._relationQuery = _relationQuery;
|
|
76
|
-
this._description = _description;
|
|
77
|
-
this._owner = _owner;
|
|
78
|
-
}
|
|
79
|
-
afterQueryCreation(_query) { }
|
|
80
|
-
afterQuery(data) {
|
|
81
|
-
return data;
|
|
82
|
-
}
|
|
83
|
-
modelCreation(_) {
|
|
84
|
-
return null;
|
|
85
|
-
}
|
|
86
|
-
async afterHydration(data) {
|
|
87
|
-
const self = this;
|
|
88
|
-
const pks = data.map((d) => {
|
|
89
|
-
// do this as one pass
|
|
90
|
-
return d[this._description.PrimaryKey];
|
|
91
|
-
});
|
|
92
|
-
const hydrateMiddleware = {
|
|
93
|
-
afterQuery(data) {
|
|
94
|
-
return data;
|
|
95
|
-
},
|
|
96
|
-
modelCreation() {
|
|
97
|
-
return null;
|
|
98
|
-
},
|
|
99
|
-
async afterHydration(relationData) {
|
|
100
|
-
data.forEach((d) => {
|
|
101
|
-
let val = d;
|
|
102
|
-
const relData = relationData.filter((rd) => {
|
|
103
|
-
return rd['ResourceId'] === val[self._description.PrimaryKey];
|
|
104
|
-
});
|
|
105
|
-
relData.forEach((rd) => {
|
|
106
|
-
if (self._owner && self._owner instanceof orm_1.BelongsToRelation) {
|
|
107
|
-
val[rd.Column] = rd.Value;
|
|
108
|
-
}
|
|
109
|
-
else {
|
|
110
|
-
d[rd.Column] = rd.Value;
|
|
111
|
-
}
|
|
112
|
-
});
|
|
113
|
-
val.setLanguage(self._lang);
|
|
114
|
-
});
|
|
115
|
-
},
|
|
116
|
-
};
|
|
117
|
-
if (pks.length !== 0) {
|
|
118
|
-
this._relationQuery.whereIn('ResourceId', pks);
|
|
119
|
-
this._relationQuery.where('Resource', this._description.Name);
|
|
120
|
-
this._relationQuery.where('Lang', this._lang);
|
|
121
|
-
this._relationQuery.middleware(hydrateMiddleware);
|
|
122
|
-
return await this._relationQuery;
|
|
123
|
-
}
|
|
124
|
-
return [];
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
exports.IntlModelMiddleware = IntlModelMiddleware;
|
|
128
|
-
orm_1.SelectQueryBuilder.prototype['translate'] = function (lang) {
|
|
129
|
-
/**
|
|
130
|
-
* Cannot translate query that cames from translation middleware !
|
|
131
|
-
*/
|
|
132
|
-
if (this.Owner !== null && this.Owner instanceof IntlModelRelation) {
|
|
133
|
-
return;
|
|
134
|
-
}
|
|
135
|
-
if (!this.Model) {
|
|
136
|
-
return;
|
|
137
|
-
}
|
|
138
|
-
this.translated = true;
|
|
139
|
-
const descriptor = (0, orm_1.extractModelDescriptor)(this._model);
|
|
140
|
-
const relInstance = this._container.resolve(IntlModelRelation, [lang, this._container.get(orm_1.Orm), this, descriptor, this._owner]);
|
|
141
|
-
relInstance.execute();
|
|
142
|
-
// translate all other relations automatically
|
|
143
|
-
this._relations.forEach((r) => {
|
|
144
|
-
r.executeOnQuery(function () {
|
|
145
|
-
this.translate(lang);
|
|
146
|
-
});
|
|
147
|
-
});
|
|
148
|
-
this._relations.push(relInstance);
|
|
149
|
-
return this;
|
|
150
|
-
};
|
|
151
|
-
/**
|
|
152
|
-
* Middleware for automatic query translations
|
|
153
|
-
* for modes. If query is standalone ( not created by model related function )
|
|
154
|
-
* skips translation completely.
|
|
155
|
-
* When AsyncStorage is set & language property is present
|
|
156
|
-
*
|
|
157
|
-
*/
|
|
158
|
-
let IntlQueryMiddleware = class IntlQueryMiddleware extends orm_1.QueryMiddleware {
|
|
159
|
-
beforeQueryExecution(builder) {
|
|
160
|
-
// if we dont have configuration module
|
|
161
|
-
// we cannot guess default language
|
|
162
|
-
// so skip trying to translate
|
|
163
|
-
if (!di_1.DI.has(configuration_common_1.Configuration)) {
|
|
164
|
-
return;
|
|
165
|
-
}
|
|
166
|
-
// if async storage is avaible ( node env)
|
|
167
|
-
// on browser and electron skip this, as we dont have async storage
|
|
168
|
-
if (typeof async_hooks_1.AsyncLocalStorage === 'function') {
|
|
169
|
-
// if something has set to no translate
|
|
170
|
-
// eg route decorator
|
|
171
|
-
const store = di_1.DI.get(async_hooks_1.AsyncLocalStorage);
|
|
172
|
-
if (store && store.noTranslate === false) {
|
|
173
|
-
return;
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
// something has set to not translate manually for query
|
|
177
|
-
if (builder.AllowTranslate === false) {
|
|
178
|
-
return;
|
|
179
|
-
}
|
|
180
|
-
// finaly, if its not query for model
|
|
181
|
-
if (!builder.Model) {
|
|
182
|
-
return;
|
|
183
|
-
}
|
|
184
|
-
// and translate only selects
|
|
185
|
-
if (builder instanceof orm_1.SelectQueryBuilder && !builder.translated) {
|
|
186
|
-
const lang = (0, intl_1.guessLanguage)();
|
|
187
|
-
const dLang = (0, intl_1.defaultLanguage)();
|
|
188
|
-
// if we requested non-default language ?
|
|
189
|
-
// if not we should translate
|
|
190
|
-
if (lang && dLang !== lang) {
|
|
191
|
-
builder.translate(lang);
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
afterQueryCreation(_builder) { }
|
|
196
|
-
};
|
|
197
|
-
IntlQueryMiddleware =
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
let DbTranslationSource = class DbTranslationSource extends intl_1.TranslationSource {
|
|
202
|
-
async load() {
|
|
203
|
-
const translations = await IntlTranslation_js_1.IntlTranslation.all();
|
|
204
|
-
return lodash_1.default.mapValues(lodash_1.default.groupBy(translations, 'Lang'), (t) => {
|
|
205
|
-
const vals = t.map((tt) => {
|
|
206
|
-
return { [tt.Key]: tt.Value };
|
|
207
|
-
});
|
|
208
|
-
return lodash_1.default.assign.apply(lodash_1.default, vals);
|
|
209
|
-
});
|
|
210
|
-
}
|
|
211
|
-
};
|
|
212
|
-
DbTranslationSource =
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
14
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
15
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
16
|
+
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;
|
|
17
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
18
|
+
};
|
|
19
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
20
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
21
|
+
};
|
|
22
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
23
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.DbTranslationSource = exports.IntlQueryMiddleware = exports.IntlModelMiddleware = exports.IntlModelRelation = void 0;
|
|
30
|
+
const di_1 = require("@spinajs/di");
|
|
31
|
+
const orm_1 = require("@spinajs/orm");
|
|
32
|
+
const intl_1 = require("@spinajs/intl");
|
|
33
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
34
|
+
const IntlTranslation_js_1 = require("./models/IntlTranslation.js");
|
|
35
|
+
const IntlResource_js_1 = require("./models/IntlResource.js");
|
|
36
|
+
const configuration_common_1 = require("@spinajs/configuration-common");
|
|
37
|
+
const async_hooks_1 = require("async_hooks");
|
|
38
|
+
__exportStar(require("./decorators.js"), exports);
|
|
39
|
+
__exportStar(require("./migrations/IntlOrm_2022_06_28_01_13_00.js"), exports);
|
|
40
|
+
__exportStar(require("./models/IntlResource.js"), exports);
|
|
41
|
+
__exportStar(require("./models/IntlTranslation.js"), exports);
|
|
42
|
+
__exportStar(require("./model.js"), exports);
|
|
43
|
+
let IntlModelRelation = class IntlModelRelation extends orm_1.OrmRelation {
|
|
44
|
+
constructor(_container, _lang, _query, _mDescriptor, _parentRelation) {
|
|
45
|
+
super(_container, _query, {
|
|
46
|
+
TargetModel: IntlResource_js_1.IntlResource,
|
|
47
|
+
TargetModelType: IntlResource_js_1.IntlResource,
|
|
48
|
+
Name: 'Translations',
|
|
49
|
+
Type: orm_1.RelationType.Many,
|
|
50
|
+
SourceModel: null,
|
|
51
|
+
ForeignKey: '',
|
|
52
|
+
PrimaryKey: '',
|
|
53
|
+
Recursive: false,
|
|
54
|
+
}, _parentRelation);
|
|
55
|
+
this._lang = _lang;
|
|
56
|
+
this._mDescriptor = _mDescriptor;
|
|
57
|
+
this._relationQuery.from('intl_resources', this.Alias);
|
|
58
|
+
}
|
|
59
|
+
execute() {
|
|
60
|
+
this._query.middleware(new IntlModelMiddleware(this._lang, this._relationQuery, this._mDescriptor, this.parentRelation));
|
|
61
|
+
}
|
|
62
|
+
translate(_lang) {
|
|
63
|
+
// empty, cannot translate translation relation!
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
exports.IntlModelRelation = IntlModelRelation;
|
|
67
|
+
exports.IntlModelRelation = IntlModelRelation = __decorate([
|
|
68
|
+
(0, di_1.NewInstance)(),
|
|
69
|
+
(0, di_1.Inject)(di_1.Container),
|
|
70
|
+
__metadata("design:paramtypes", [di_1.Container, String, Object, Object, orm_1.OrmRelation])
|
|
71
|
+
], IntlModelRelation);
|
|
72
|
+
class IntlModelMiddleware {
|
|
73
|
+
constructor(_lang, _relationQuery, _description, _owner) {
|
|
74
|
+
this._lang = _lang;
|
|
75
|
+
this._relationQuery = _relationQuery;
|
|
76
|
+
this._description = _description;
|
|
77
|
+
this._owner = _owner;
|
|
78
|
+
}
|
|
79
|
+
afterQueryCreation(_query) { }
|
|
80
|
+
afterQuery(data) {
|
|
81
|
+
return data;
|
|
82
|
+
}
|
|
83
|
+
modelCreation(_) {
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
async afterHydration(data) {
|
|
87
|
+
const self = this;
|
|
88
|
+
const pks = data.map((d) => {
|
|
89
|
+
// do this as one pass
|
|
90
|
+
return d[this._description.PrimaryKey];
|
|
91
|
+
});
|
|
92
|
+
const hydrateMiddleware = {
|
|
93
|
+
afterQuery(data) {
|
|
94
|
+
return data;
|
|
95
|
+
},
|
|
96
|
+
modelCreation() {
|
|
97
|
+
return null;
|
|
98
|
+
},
|
|
99
|
+
async afterHydration(relationData) {
|
|
100
|
+
data.forEach((d) => {
|
|
101
|
+
let val = d;
|
|
102
|
+
const relData = relationData.filter((rd) => {
|
|
103
|
+
return rd['ResourceId'] === val[self._description.PrimaryKey];
|
|
104
|
+
});
|
|
105
|
+
relData.forEach((rd) => {
|
|
106
|
+
if (self._owner && self._owner instanceof orm_1.BelongsToRelation) {
|
|
107
|
+
val[rd.Column] = rd.Value;
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
d[rd.Column] = rd.Value;
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
val.setLanguage(self._lang);
|
|
114
|
+
});
|
|
115
|
+
},
|
|
116
|
+
};
|
|
117
|
+
if (pks.length !== 0) {
|
|
118
|
+
this._relationQuery.whereIn('ResourceId', pks);
|
|
119
|
+
this._relationQuery.where('Resource', this._description.Name);
|
|
120
|
+
this._relationQuery.where('Lang', this._lang);
|
|
121
|
+
this._relationQuery.middleware(hydrateMiddleware);
|
|
122
|
+
return await this._relationQuery;
|
|
123
|
+
}
|
|
124
|
+
return [];
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
exports.IntlModelMiddleware = IntlModelMiddleware;
|
|
128
|
+
orm_1.SelectQueryBuilder.prototype['translate'] = function (lang) {
|
|
129
|
+
/**
|
|
130
|
+
* Cannot translate query that cames from translation middleware !
|
|
131
|
+
*/
|
|
132
|
+
if (this.Owner !== null && this.Owner instanceof IntlModelRelation) {
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
if (!this.Model) {
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
this.translated = true;
|
|
139
|
+
const descriptor = (0, orm_1.extractModelDescriptor)(this._model);
|
|
140
|
+
const relInstance = this._container.resolve(IntlModelRelation, [lang, this._container.get(orm_1.Orm), this, descriptor, this._owner]);
|
|
141
|
+
relInstance.execute();
|
|
142
|
+
// translate all other relations automatically
|
|
143
|
+
this._relations.forEach((r) => {
|
|
144
|
+
r.executeOnQuery(function () {
|
|
145
|
+
this.translate(lang);
|
|
146
|
+
});
|
|
147
|
+
});
|
|
148
|
+
this._relations.push(relInstance);
|
|
149
|
+
return this;
|
|
150
|
+
};
|
|
151
|
+
/**
|
|
152
|
+
* Middleware for automatic query translations
|
|
153
|
+
* for modes. If query is standalone ( not created by model related function )
|
|
154
|
+
* skips translation completely.
|
|
155
|
+
* When AsyncStorage is set & language property is present
|
|
156
|
+
*
|
|
157
|
+
*/
|
|
158
|
+
let IntlQueryMiddleware = class IntlQueryMiddleware extends orm_1.QueryMiddleware {
|
|
159
|
+
beforeQueryExecution(builder) {
|
|
160
|
+
// if we dont have configuration module
|
|
161
|
+
// we cannot guess default language
|
|
162
|
+
// so skip trying to translate
|
|
163
|
+
if (!di_1.DI.has(configuration_common_1.Configuration)) {
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
// if async storage is avaible ( node env)
|
|
167
|
+
// on browser and electron skip this, as we dont have async storage
|
|
168
|
+
if (typeof async_hooks_1.AsyncLocalStorage === 'function') {
|
|
169
|
+
// if something has set to no translate
|
|
170
|
+
// eg route decorator
|
|
171
|
+
const store = di_1.DI.get(async_hooks_1.AsyncLocalStorage);
|
|
172
|
+
if (store && store.noTranslate === false) {
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
// something has set to not translate manually for query
|
|
177
|
+
if (builder.AllowTranslate === false) {
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
// finaly, if its not query for model
|
|
181
|
+
if (!builder.Model) {
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
// and translate only selects
|
|
185
|
+
if (builder instanceof orm_1.SelectQueryBuilder && !builder.translated) {
|
|
186
|
+
const lang = (0, intl_1.guessLanguage)();
|
|
187
|
+
const dLang = (0, intl_1.defaultLanguage)();
|
|
188
|
+
// if we requested non-default language ?
|
|
189
|
+
// if not we should translate
|
|
190
|
+
if (lang && dLang !== lang) {
|
|
191
|
+
builder.translate(lang);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
afterQueryCreation(_builder) { }
|
|
196
|
+
};
|
|
197
|
+
exports.IntlQueryMiddleware = IntlQueryMiddleware;
|
|
198
|
+
exports.IntlQueryMiddleware = IntlQueryMiddleware = __decorate([
|
|
199
|
+
(0, di_1.Injectable)(orm_1.QueryMiddleware)
|
|
200
|
+
], IntlQueryMiddleware);
|
|
201
|
+
let DbTranslationSource = class DbTranslationSource extends intl_1.TranslationSource {
|
|
202
|
+
async load() {
|
|
203
|
+
const translations = await IntlTranslation_js_1.IntlTranslation.all();
|
|
204
|
+
return lodash_1.default.mapValues(lodash_1.default.groupBy(translations, 'Lang'), (t) => {
|
|
205
|
+
const vals = t.map((tt) => {
|
|
206
|
+
return { [tt.Key]: tt.Value };
|
|
207
|
+
});
|
|
208
|
+
return lodash_1.default.assign.apply(lodash_1.default, vals);
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
};
|
|
212
|
+
exports.DbTranslationSource = DbTranslationSource;
|
|
213
|
+
exports.DbTranslationSource = DbTranslationSource = __decorate([
|
|
214
|
+
(0, di_1.Injectable)(intl_1.TranslationSource)
|
|
215
|
+
], DbTranslationSource);
|
|
216
216
|
//# sourceMappingURL=index.js.map
|
package/lib/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oCAA6E;AAC7E,sCAA2Q;AAC3Q,wCAAqG;AACrG,oDAAuB;AACvB,oEAA8D;AAC9D,8DAAwD;AACxD,wEAA8D;AAC9D,6CAAgD;AAEhD,kDAAgC;AAChC,8EAA4D;AAC5D,2DAAyC;AACzC,8DAA4C;AAC5C,6CAA2B;AAwBpB,IAAM,iBAAiB,GAAvB,MAAM,iBAAkB,SAAQ,iBAAW;IAChD,YAAY,UAAqB,EAAY,KAAa,EAAE,M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mB,CA6C/B;AAGM,IAAM,mBAAmB,GAAzB,MAAM,mBAAoB,SAAQ,wBAAiB;IACjD,KAAK,CAAC,IAAI;QACf,MAAM,YAAY,GAAG,MAAM,oCAAe,CAAC,GAAG,EAAE,CAAC;QAEjD,OAAO,gBAAC,CAAC,SAAS,CAAC,gBAAC,CAAC,OAAO,CAAC,YAAY,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE;YACxD,MAAM,IAAI,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE;gBACxB,OAAO,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,KAAK,EAAE,CAAC;YAChC,CAAC,CAAC,CAAC;YAEH,OAAO,gBAAC,CAAC,MAAM,CAAC,KAAK,CAAC,gBAAC,EAAE,IAAI,CAAC,CAAC;QACjC,CAAC,CAAC,CAAC;IACL,CAAC;CACF,CAAA;AAZY,kDAAmB;8BAAnB,mBAAmB;IAD/B,IAAA,eAAU,EAAC,wBAAiB,CAAC;GACjB,mBAAmB,CAY/B"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { OrmMigration, OrmDriver } from '@spinajs/orm';
|
|
2
|
-
export declare class IntlOrm_2022_06_28_01_13_00 extends OrmMigration {
|
|
3
|
-
up(connection: OrmDriver): Promise<void>;
|
|
4
|
-
down(_connection: OrmDriver): Promise<void>;
|
|
5
|
-
}
|
|
1
|
+
import { OrmMigration, OrmDriver } from '@spinajs/orm';
|
|
2
|
+
export declare class IntlOrm_2022_06_28_01_13_00 extends OrmMigration {
|
|
3
|
+
up(connection: OrmDriver): Promise<void>;
|
|
4
|
+
down(_connection: OrmDriver): Promise<void>;
|
|
5
|
+
}
|
|
6
6
|
//# sourceMappingURL=IntlOrm_2022_06_28_01_13_00.d.ts.map
|