@spinajs/intl-orm 2.0.46 → 2.0.48

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 CHANGED
@@ -1,17 +1,17 @@
1
- # `intl-orm`
2
-
3
- > TODO: description
4
-
5
- ## Usage
6
-
7
- ```
8
- const intlOrm = require('intl-orm');
9
-
10
- // TODO: DEMONSTRATE API
11
- ```
12
- ## TODO
13
- * Translate many to many relations
14
- * Translate belongsTo relations
15
- * Clear translations
16
- * OnDelete delete translations
1
+ # `intl-orm`
2
+
3
+ > TODO: description
4
+
5
+ ## Usage
6
+
7
+ ```
8
+ const intlOrm = require('intl-orm');
9
+
10
+ // TODO: DEMONSTRATE API
11
+ ```
12
+ ## TODO
13
+ * Translate many to many relations
14
+ * Translate belongsTo relations
15
+ * Clear translations
16
+ * OnDelete delete translations
17
17
  * Check if exists translation
@@ -1 +1,2 @@
1
1
  export declare function Translate(): any;
2
+ //# sourceMappingURL=decorators.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decorators.d.ts","sourceRoot":"","sources":["../src/decorators.ts"],"names":[],"mappings":"AAEA,wBAAgB,SAAS,QAYxB"}
package/lib/decorators.js CHANGED
@@ -1,9 +1,6 @@
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) => {
1
+ import { extractDecoratorDescriptor } from '@spinajs/orm';
2
+ export function Translate() {
3
+ return extractDecoratorDescriptor((model, _target, propertyKey) => {
7
4
  const columnDesc = model.Columns.find((c) => c.Name === propertyKey);
8
5
  if (!columnDesc) {
9
6
  // we dont want to fill all props, they will be loaded from db and mergeg with this
@@ -15,5 +12,4 @@ function Translate() {
15
12
  model.Translatable = true;
16
13
  }, true);
17
14
  }
18
- exports.Translate = Translate;
19
15
  //# sourceMappingURL=decorators.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"decorators.js","sourceRoot":"","sources":["../src/decorators.ts"],"names":[],"mappings":";;;AAAA,sCAA4E;AAE5E,SAAgB,SAAS;IACvB,OAAO,IAAA,gCAA0B,EAAC,CAAC,KAAuB,EAAE,OAAY,EAAE,WAAmB,EAAE,EAAE;QAC/F,MAAM,UAAU,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,WAAW,CAAC,CAAC;QACrE,IAAI,CAAC,UAAU,EAAE;YACf,mFAAmF;YACnF,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,SAAS,EAAE,IAAI,EAAS,CAAC,CAAC;SACnE;aAAM;YACL,UAAU,CAAC,SAAS,GAAG,IAAI,CAAC;SAC7B;QAEA,KAAa,CAAC,YAAY,GAAG,IAAI,CAAC;IACrC,CAAC,EAAE,IAAI,CAAC,CAAC;AACX,CAAC;AAZD,8BAYC"}
1
+ {"version":3,"file":"decorators.js","sourceRoot":"","sources":["../src/decorators.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAoB,MAAM,cAAc,CAAC;AAE5E,MAAM,UAAU,SAAS;IACvB,OAAO,0BAA0B,CAAC,CAAC,KAAuB,EAAE,OAAY,EAAE,WAAmB,EAAE,EAAE;QAC/F,MAAM,UAAU,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,WAAW,CAAC,CAAC;QACrE,IAAI,CAAC,UAAU,EAAE;YACf,mFAAmF;YACnF,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,SAAS,EAAE,IAAI,EAAS,CAAC,CAAC;SACnE;aAAM;YACL,UAAU,CAAC,SAAS,GAAG,IAAI,CAAC;SAC7B;QAEA,KAAa,CAAC,YAAY,GAAG,IAAI,CAAC;IACrC,CAAC,EAAE,IAAI,CAAC,CAAC;AACX,CAAC"}
package/lib/index.d.ts CHANGED
@@ -1,10 +1,9 @@
1
1
  import { IModelDescriptor, ModelBase, Orm, OrmRelation, SelectQueryBuilder, QueryBuilder, QueryMiddleware, IBuilderMiddleware, IOrmRelation } from '@spinajs/orm';
2
2
  import { TranslationSource } from '@spinajs/intl';
3
- export * from './decorators';
4
- export * from './model';
5
- export * from './migrations/IntlOrm_2022_06_28_01_13_00';
6
- export * from './models/IntlResource';
7
- export * from './models/IntlTranslation';
3
+ export * from './decorators.js';
4
+ export * from './migrations/IntlOrm_2022_06_28_01_13_00.js';
5
+ export * from './models/IntlResource.js';
6
+ export * from './models/IntlTranslation.js';
8
7
  declare module '@spinajs/orm' {
9
8
  interface SelectQueryBuilder<T> {
10
9
  translate(lang: string): SelectQueryBuilder<T>;
@@ -40,3 +39,4 @@ export declare class DbTranslationSource extends TranslationSource {
40
39
  [x: string]: any;
41
40
  }>;
42
41
  }
42
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAA0B,gBAAgB,EAAE,SAAS,EAAE,GAAG,EAAE,WAAW,EAAgB,kBAAkB,EAAE,YAAY,EAAE,eAAe,EAAE,kBAAkB,EAAE,YAAY,EAAqB,MAAM,cAAc,CAAC;AAC3N,OAAO,EAAE,iBAAiB,EAAkC,MAAM,eAAe,CAAC;AAKlF,cAAc,iBAAiB,CAAC;AAChC,cAAc,6CAA6C,CAAC;AAC5D,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAI5C,OAAO,QAAQ,cAAc,CAAC;IAC5B,UAAU,kBAAkB,CAAC,CAAC;QAC5B,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,kBAAkB,CAAC,CAAC,CAAC,CAAC;QAC/C,UAAU,EAAE,OAAO,CAAC;KACrB;IACD,UAAU,iBAAiB;QACzB,SAAS,EAAE,OAAO,CAAC;KACpB;CACF;AAED,qBACa,iBAAkB,SAAQ,WAAW;IACpC,SAAS,CAAC,KAAK,EAAE,MAAM;IAA8C,SAAS,CAAC,YAAY,EAAE,gBAAgB;gBAAnG,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,kBAAkB,CAAC,GAAG,CAAC,EAAY,YAAY,EAAE,gBAAgB,EAAE,eAAe,CAAC,EAAE,WAAW;IAoBjJ,OAAO,IAAI,IAAI;IAIf,SAAS,CAAC,KAAK,EAAE,MAAM;CAG/B;AAED,qBAAa,mBAAoB,YAAW,kBAAkB;IAChD,SAAS,CAAC,KAAK,EAAE,MAAM;IAAE,SAAS,CAAC,cAAc,EAAE,kBAAkB;IAAE,SAAS,CAAC,YAAY,EAAE,gBAAgB;IAAE,SAAS,CAAC,MAAM,EAAE,YAAY;gBAArI,KAAK,EAAE,MAAM,EAAY,cAAc,EAAE,kBAAkB,EAAY,YAAY,EAAE,gBAAgB,EAAY,MAAM,EAAE,YAAY;IAEpJ,kBAAkB,CAAC,MAAM,EAAE,YAAY,CAAC,GAAG,CAAC,GAAG,IAAI;IAEnD,UAAU,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,GAAG,EAAE;IAG9B,aAAa,CAAC,CAAC,EAAE,GAAG,GAAG,SAAS;IAG1B,cAAc,CAAC,IAAI,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;CA0D/D;AA0BD,qBACa,mBAAoB,SAAQ,eAAe;IACtD,kBAAkB,CAAC,OAAO,EAAE,YAAY;CAUzC;AAED,qBACa,mBAAoB,SAAQ,iBAAiB;IAC3C,IAAI;;;CAWlB"}
package/lib/index.js CHANGED
@@ -1,51 +1,30 @@
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
1
  var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
14
2
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
15
3
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
16
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;
17
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
18
6
  };
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
7
  var __metadata = (this && this.__metadata) || function (k, v) {
23
8
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
24
9
  };
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_1 = require("./models/IntlTranslation");
35
- const IntlResource_1 = require("./models/IntlResource");
36
- __exportStar(require("./decorators"), exports);
37
- __exportStar(require("./model"), exports);
38
- __exportStar(require("./migrations/IntlOrm_2022_06_28_01_13_00"), exports);
39
- __exportStar(require("./models/IntlResource"), exports);
40
- __exportStar(require("./models/IntlTranslation"), exports);
10
+ import { Injectable, NewInstance } from '@spinajs/di';
11
+ import { extractModelDescriptor, Orm, OrmRelation, RelationType, SelectQueryBuilder, QueryMiddleware, BelongsToRelation } from '@spinajs/orm';
12
+ import { TranslationSource, guessLanguage, defaultLanguage } from '@spinajs/intl';
13
+ import _ from 'lodash';
14
+ import { IntlTranslation } from './models/IntlTranslation.js';
15
+ import { IntlResource } from './models/IntlResource.js';
16
+ export * from './decorators.js';
17
+ export * from './migrations/IntlOrm_2022_06_28_01_13_00.js';
18
+ export * from './models/IntlResource.js';
19
+ export * from './models/IntlTranslation.js';
41
20
  const { SelectQueryBuilder: SQB } = require('@spinajs/orm');
42
- let IntlModelRelation = class IntlModelRelation extends orm_1.OrmRelation {
21
+ let IntlModelRelation = class IntlModelRelation extends OrmRelation {
43
22
  constructor(_lang, _orm, _query, _mDescriptor, _parentRelation) {
44
23
  super(_orm, _query, {
45
- TargetModel: IntlResource_1.IntlResource,
46
- TargetModelType: IntlResource_1.IntlResource,
24
+ TargetModel: IntlResource,
25
+ TargetModelType: IntlResource,
47
26
  Name: 'Translations',
48
- Type: orm_1.RelationType.Many,
27
+ Type: RelationType.Many,
49
28
  SourceModel: null,
50
29
  ForeignKey: '',
51
30
  PrimaryKey: '',
@@ -63,11 +42,11 @@ let IntlModelRelation = class IntlModelRelation extends orm_1.OrmRelation {
63
42
  }
64
43
  };
65
44
  IntlModelRelation = __decorate([
66
- (0, di_1.NewInstance)(),
67
- __metadata("design:paramtypes", [String, orm_1.Orm, Object, Object, orm_1.OrmRelation])
45
+ NewInstance(),
46
+ __metadata("design:paramtypes", [String, Orm, SelectQueryBuilder, Object, OrmRelation])
68
47
  ], IntlModelRelation);
69
- exports.IntlModelRelation = IntlModelRelation;
70
- class IntlModelMiddleware {
48
+ export { IntlModelRelation };
49
+ export class IntlModelMiddleware {
71
50
  constructor(_lang, _relationQuery, _description, _owner) {
72
51
  this._lang = _lang;
73
52
  this._relationQuery = _relationQuery;
@@ -100,7 +79,7 @@ class IntlModelMiddleware {
100
79
  return rd['ResourceId'] === d[self._description.PrimaryKey];
101
80
  });
102
81
  relData.forEach((rd) => {
103
- if (self._owner && self._owner instanceof orm_1.BelongsToRelation) {
82
+ if (self._owner && self._owner instanceof BelongsToRelation) {
104
83
  let val = d;
105
84
  let rel = self._owner;
106
85
  let relArr = [];
@@ -133,7 +112,6 @@ class IntlModelMiddleware {
133
112
  return [];
134
113
  }
135
114
  }
136
- exports.IntlModelMiddleware = IntlModelMiddleware;
137
115
  SQB.prototype['translate'] = function (lang) {
138
116
  /**
139
117
  * Cannot translate query that cames from translation middleware !
@@ -142,8 +120,8 @@ SQB.prototype['translate'] = function (lang) {
142
120
  return;
143
121
  }
144
122
  this.translated = true;
145
- const descriptor = (0, orm_1.extractModelDescriptor)(this._model);
146
- const relInstance = this._container.resolve(IntlModelRelation, [lang, this._container.get(orm_1.Orm), this, descriptor, this._owner]);
123
+ const descriptor = extractModelDescriptor(this._model);
124
+ const relInstance = this._container.resolve(IntlModelRelation, [lang, this._container.get(Orm), this, descriptor, this._owner]);
147
125
  relInstance.execute();
148
126
  // translate all other relations automatically
149
127
  this._relations.forEach((r) => {
@@ -154,11 +132,11 @@ SQB.prototype['translate'] = function (lang) {
154
132
  this._relations.push(relInstance);
155
133
  return this;
156
134
  };
157
- let IntlQueryMiddleware = class IntlQueryMiddleware extends orm_1.QueryMiddleware {
135
+ let IntlQueryMiddleware = class IntlQueryMiddleware extends QueryMiddleware {
158
136
  afterQueryCreation(builder) {
159
137
  if (builder instanceof SQB && !builder.translated) {
160
- const lang = (0, intl_1.guessLanguage)();
161
- const dLang = (0, intl_1.defaultLanguage)();
138
+ const lang = guessLanguage();
139
+ const dLang = defaultLanguage();
162
140
  if (lang && dLang !== lang) {
163
141
  builder.translate(lang);
164
142
  }
@@ -166,22 +144,22 @@ let IntlQueryMiddleware = class IntlQueryMiddleware extends orm_1.QueryMiddlewar
166
144
  }
167
145
  };
168
146
  IntlQueryMiddleware = __decorate([
169
- (0, di_1.Injectable)(orm_1.QueryMiddleware)
147
+ Injectable(QueryMiddleware)
170
148
  ], IntlQueryMiddleware);
171
- exports.IntlQueryMiddleware = IntlQueryMiddleware;
172
- let DbTranslationSource = class DbTranslationSource extends intl_1.TranslationSource {
149
+ export { IntlQueryMiddleware };
150
+ let DbTranslationSource = class DbTranslationSource extends TranslationSource {
173
151
  async load() {
174
- const translations = await IntlTranslation_1.IntlTranslation.all();
175
- return lodash_1.default.mapValues(lodash_1.default.groupBy(translations, 'Lang'), (t) => {
152
+ const translations = await IntlTranslation.all();
153
+ return _.mapValues(_.groupBy(translations, 'Lang'), (t) => {
176
154
  const vals = t.map((tt) => {
177
155
  return { [tt.Key]: tt.Value };
178
156
  });
179
- return lodash_1.default.assign.apply(lodash_1.default, vals);
157
+ return _.assign.apply(_, vals);
180
158
  });
181
159
  }
182
160
  };
183
161
  DbTranslationSource = __decorate([
184
- (0, di_1.Injectable)(intl_1.TranslationSource)
162
+ Injectable(TranslationSource)
185
163
  ], DbTranslationSource);
186
- exports.DbTranslationSource = DbTranslationSource;
164
+ export { DbTranslationSource };
187
165
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oCAAsD;AACtD,sCAA2N;AAC3N,wCAAkF;AAClF,oDAAuB;AACvB,8DAA2D;AAC3D,wDAAqD;AAErD,+CAA6B;AAC7B,0CAAwB;AACxB,2EAAyD;AACzD,wDAAsC;AACtC,2DAAyC;AAEzC,MAAM,EAAE,kBAAkB,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;AAa5D,IAAa,iBAAiB,GAA9B,MAAa,iBAAkB,SAAQ,iBAAW;IAChD,YAAsB,KAAa,EAAE,IAAS,EAAE,MAA+B,EAAY,YAA8B,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CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;QACjC,CAAC,CAAC,CAAC;IACL,CAAC;CACF,CAAA;AAZY,mBAAmB;IAD/B,UAAU,CAAC,iBAAiB,CAAC;GACjB,mBAAmB,CAY/B;SAZY,mBAAmB"}
@@ -3,3 +3,4 @@ export declare class IntlOrm_2022_06_28_01_13_00 extends OrmMigration {
3
3
  up(connection: OrmDriver): Promise<void>;
4
4
  down(_connection: OrmDriver): Promise<void>;
5
5
  }
6
+ //# sourceMappingURL=IntlOrm_2022_06_28_01_13_00.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IntlOrm_2022_06_28_01_13_00.d.ts","sourceRoot":"","sources":["../../src/migrations/IntlOrm_2022_06_28_01_13_00.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,SAAS,EAAa,MAAM,cAAc,CAAC;AAElE,qBACa,2BAA4B,SAAQ,YAAY;IAC9C,EAAE,CAAC,UAAU,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;IAsBxC,IAAI,CAAC,WAAW,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;CACzD"}
@@ -1,15 +1,12 @@
1
- "use strict";
2
1
  var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
2
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
3
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
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;
6
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
7
6
  };
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.IntlOrm_2022_06_28_01_13_00 = void 0;
10
7
  /* eslint-disable @typescript-eslint/no-unused-vars */
11
- const orm_1 = require("@spinajs/orm");
12
- let IntlOrm_2022_06_28_01_13_00 = class IntlOrm_2022_06_28_01_13_00 extends orm_1.OrmMigration {
8
+ import { OrmMigration, Migration } from '@spinajs/orm';
9
+ let IntlOrm_2022_06_28_01_13_00 = class IntlOrm_2022_06_28_01_13_00 extends OrmMigration {
13
10
  async up(connection) {
14
11
  await connection.schema().createTable('intl_resources', (table) => {
15
12
  table.int('ResourceId').notNull();
@@ -32,7 +29,7 @@ let IntlOrm_2022_06_28_01_13_00 = class IntlOrm_2022_06_28_01_13_00 extends orm_
32
29
  async down(_connection) { }
33
30
  };
34
31
  IntlOrm_2022_06_28_01_13_00 = __decorate([
35
- (0, orm_1.Migration)('default')
32
+ Migration('default')
36
33
  ], IntlOrm_2022_06_28_01_13_00);
37
- exports.IntlOrm_2022_06_28_01_13_00 = IntlOrm_2022_06_28_01_13_00;
34
+ export { IntlOrm_2022_06_28_01_13_00 };
38
35
  //# sourceMappingURL=IntlOrm_2022_06_28_01_13_00.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"IntlOrm_2022_06_28_01_13_00.js","sourceRoot":"","sources":["../../src/migrations/IntlOrm_2022_06_28_01_13_00.ts"],"names":[],"mappings":";;;;;;;;;AAAA,sDAAsD;AACtD,sCAAkE;AAGlE,IAAa,2BAA2B,GAAxC,MAAa,2BAA4B,SAAQ,kBAAY;IACpD,KAAK,CAAC,EAAE,CAAC,UAAqB;QACnC,MAAM,UAAU,CAAC,MAAM,EAAE,CAAC,WAAW,CAAC,gBAAgB,EAAE,CAAC,KAAK,EAAE,EAAE;YAChE,KAAK,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,OAAO,EAAE,CAAC;YAClC,KAAK,CAAC,MAAM,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC;YACvC,KAAK,CAAC,MAAM,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC;YACrC,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,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,MAAM,UAAU,CAAC,KAAK,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC;IACtH,CAAC;IAED,qCAAqC;IACrC,gEAAgE;IACzD,KAAK,CAAC,IAAI,CAAC,WAAsB,IAAkB,CAAC;CAC5D,CAAA;AAxBY,2BAA2B;IADvC,SAAS,CAAC,SAAS,CAAC;GACR,2BAA2B,CAwBvC;SAxBY,2BAA2B"}
package/lib/model.d.ts CHANGED
@@ -10,3 +10,4 @@ export declare class Translatable extends ModelBase {
10
10
  setLanguage(lang: string): void;
11
11
  update(): Promise<void>;
12
12
  }
13
+ //# sourceMappingURL=model.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../src/model.ts"],"names":[],"mappings":"AACA,OAAO,EAAmB,SAAS,EAAE,MAAM,cAAc,CAAC;AAK1D,qBAAa,YAAa,SAAQ,SAAS;IACzC,SAAS,CAAC,QAAQ,EAAE,MAAM,CAAC;IAE3B;;;;OAIG;IACU,SAAS,CAAC,IAAI,CAAC,EAAE,MAAM;IAgB7B,WAAW,CAAC,IAAI,EAAE,MAAM;IAIlB,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;CA2CrC"}
package/lib/model.js CHANGED
@@ -1,24 +1,18 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.Translatable = void 0;
7
- const di_1 = require("@spinajs/di");
8
- const orm_1 = require("@spinajs/orm");
9
- const lodash_1 = __importDefault(require("lodash"));
10
- const IntlResource_1 = require("./models/IntlResource");
11
- const configuration_1 = require("@spinajs/configuration");
12
- const intl_1 = require("@spinajs/intl");
13
- class Translatable extends orm_1.ModelBase {
1
+ import { DI } from '@spinajs/di';
2
+ import { InsertBehaviour, ModelBase } from '@spinajs/orm';
3
+ import _ from 'lodash';
4
+ import { IntlResource } from './models/IntlResource.js';
5
+ import { Configuration } from '@spinajs/configuration';
6
+ import { guessLanguage } from '@spinajs/intl';
7
+ export class Translatable extends ModelBase {
14
8
  /**
15
9
  * Reloads entity with proper translation
16
10
  *
17
11
  * @param lang - language to load
18
12
  */
19
13
  async translate(lang) {
20
- const selectedLang = (0, intl_1.guessLanguage)(lang);
21
- const translations = await IntlResource_1.IntlResource.where({
14
+ const selectedLang = guessLanguage(lang);
15
+ const translations = await IntlResource.where({
22
16
  ResourceId: this.PrimaryKeyValue,
23
17
  Resource: this.constructor.name,
24
18
  Lang: selectedLang,
@@ -32,27 +26,27 @@ class Translatable extends orm_1.ModelBase {
32
26
  this.Language = lang;
33
27
  }
34
28
  async update() {
35
- const selectedLang = (0, intl_1.guessLanguage)(this.Language);
36
- const defaultLanguage = di_1.DI.get(configuration_1.Configuration).get('intl.defaultLocale');
29
+ const selectedLang = guessLanguage(this.Language);
30
+ const defaultLanguage = DI.get(Configuration).get('intl.defaultLocale');
37
31
  if (!selectedLang || defaultLanguage === selectedLang) {
38
32
  await super.update();
39
33
  }
40
34
  else {
41
35
  this.Language = selectedLang;
42
36
  // TODO: temporaty use uniqyBy, pls FIX model descriptor proper handling in ORM module
43
- const tColumns = lodash_1.default.uniqBy(this.ModelDescriptor.Columns.filter((c) => c.Translate), 'Name');
37
+ const tColumns = _.uniqBy(this.ModelDescriptor.Columns.filter((c) => c.Translate), 'Name');
44
38
  const { query } = this.createUpdateQuery();
45
39
  if (this.ModelDescriptor.Timestamps.UpdatedAt) {
46
40
  this[this.ModelDescriptor.Timestamps.UpdatedAt] = new Date();
47
41
  }
48
42
  // update only non translated
49
43
  const cToDehydrate = [...tColumns.map((c) => c.Name)];
50
- const dToUpdate = lodash_1.default.omit(this.toSql(), cToDehydrate);
44
+ const dToUpdate = _.omit(this.toSql(), cToDehydrate);
51
45
  if (Object.keys(dToUpdate).length !== 0) {
52
46
  await query.update(dToUpdate).where(this.PrimaryKeyName, this.PrimaryKeyValue);
53
47
  }
54
48
  const translations = tColumns.map((c) => {
55
- return new IntlResource_1.IntlResource({
49
+ return new IntlResource({
56
50
  ResourceId: this.PrimaryKeyValue,
57
51
  Resource: this.constructor.name,
58
52
  Column: c.Name,
@@ -62,10 +56,9 @@ class Translatable extends orm_1.ModelBase {
62
56
  });
63
57
  // update or insert translations to database
64
58
  for (const t of translations) {
65
- await t.insert(orm_1.InsertBehaviour.InsertOrUpdate);
59
+ await t.insert(InsertBehaviour.InsertOrUpdate);
66
60
  }
67
61
  }
68
62
  }
69
63
  }
70
- exports.Translatable = Translatable;
71
64
  //# sourceMappingURL=model.js.map
package/lib/model.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"model.js","sourceRoot":"","sources":["../src/model.ts"],"names":[],"mappings":";;;;;;AAAA,oCAAiC;AACjC,sCAA0D;AAC1D,oDAAuB;AACvB,wDAAqD;AACrD,0DAAuD;AACvD,wCAA8C;AAC9C,MAAa,YAAa,SAAQ,eAAS;IAGzC;;;;OAIG;IACI,KAAK,CAAC,SAAS,CAAC,IAAa;QAClC,MAAM,YAAY,GAAG,IAAA,oBAAa,EAAC,IAAI,CAAC,CAAC;QAEzC,MAAM,YAAY,GAAG,MAAM,2BAAY,CAAC,KAAK,CAAC;YAC5C,UAAU,EAAE,IAAI,CAAC,eAAe;YAChC,QAAQ,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI;YAC/B,IAAI,EAAE,YAAY;SACnB,CAAC,CAAC;QAEH,YAAY,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE;YACzB,IAAY,CAAE,EAAU,CAAC,MAAM,CAAC,GAAI,EAAU,CAAC,KAAK,CAAC;QACxD,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,QAAQ,GAAG,YAAY,CAAC;IAC/B,CAAC;IAEM,WAAW,CAAC,IAAY;QAC7B,IA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M,SAAS,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,EAAE,YAAY,CAAC,CAAC;YAErD,IAAI,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE;gBACvC,MAAM,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC;aAChF;YAED,MAAM,YAAY,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;gBACtC,OAAO,IAAI,YAAY,CAAC;oBACtB,UAAU,EAAE,IAAI,CAAC,eAAe;oBAChC,QAAQ,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI;oBAC/B,MAAM,EAAE,CAAC,CAAC,IAAI;oBACd,IAAI,EAAE,IAAI,CAAC,QAAQ;oBACnB,KAAK,EAAG,IAAY,CAAC,CAAC,CAAC,IAAI,CAAC;iBAC7B,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;YAEH,4CAA4C;YAC5C,KAAK,MAAM,CAAC,IAAI,YAAY,EAAE;gBAC5B,MAAM,CAAC,CAAC,MAAM,CAAC,eAAe,CAAC,cAAc,CAAC,CAAC;aAChD;SACF;IACH,CAAC;CACF"}
@@ -11,3 +11,4 @@ export declare class IntlResource extends ModelBase {
11
11
  Lang: string;
12
12
  Value: string;
13
13
  }
14
+ //# sourceMappingURL=IntlResource.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IntlResource.d.ts","sourceRoot":"","sources":["../../src/models/IntlResource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAqB,MAAM,cAAc,CAAC;AAE5D;;;;GAIG;AACH,qBAEa,YAAa,SAAQ,SAAS;IAClC,UAAU,EAAE,MAAM,CAAC;IAEnB,QAAQ,EAAE,MAAM,CAAC;IAEjB,MAAM,EAAE,MAAM,CAAC;IAEf,IAAI,EAAE,MAAM,CAAC;IAEb,KAAK,EAAE,MAAM,CAAC;CACtB"}
@@ -1,23 +1,20 @@
1
- "use strict";
2
1
  var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
2
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
3
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
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;
6
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
7
6
  };
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.IntlResource = void 0;
10
- const orm_1 = require("@spinajs/orm");
7
+ import { ModelBase, Connection, Model } from '@spinajs/orm';
11
8
  /**
12
9
  * Base modele for users used by ACL
13
10
  *
14
11
  * To add / extend fields simply extend this model and register as default user model in ACL service
15
12
  */
16
- let IntlResource = class IntlResource extends orm_1.ModelBase {
13
+ let IntlResource = class IntlResource extends ModelBase {
17
14
  };
18
15
  IntlResource = __decorate([
19
- (0, orm_1.Connection)('default'),
20
- (0, orm_1.Model)('intl_resources')
16
+ Connection('default'),
17
+ Model('intl_resources')
21
18
  ], IntlResource);
22
- exports.IntlResource = IntlResource;
19
+ export { IntlResource };
23
20
  //# sourceMappingURL=IntlResource.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"IntlResource.js","sourceRoot":"","sources":["../../src/models/IntlResource.ts"],"names":[],"mappings":";;;;;;;;;AAAA,sCAA4D;AAE5D;;;;GAIG;AAGH,IAAa,YAAY,GAAzB,MAAa,YAAa,SAAQ,eAAS;CAU1C,CAAA;AAVY,YAAY;IAFxB,IAAA,gBAAU,EAAC,SAAS,CAAC;IACrB,IAAA,WAAK,EAAC,gBAAgB,CAAC;GACX,YAAY,CAUxB;AAVY,oCAAY"}
1
+ {"version":3,"file":"IntlResource.js","sourceRoot":"","sources":["../../src/models/IntlResource.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAE5D;;;;GAIG;AAGI,IAAM,YAAY,GAAlB,MAAM,YAAa,SAAQ,SAAS;CAU1C,CAAA;AAVY,YAAY;IAFxB,UAAU,CAAC,SAAS,CAAC;IACrB,KAAK,CAAC,gBAAgB,CAAC;GACX,YAAY,CAUxB;SAVY,YAAY"}
@@ -10,3 +10,4 @@ export declare class IntlTranslation extends ModelBase {
10
10
  Value: string;
11
11
  Lang: string;
12
12
  }
13
+ //# sourceMappingURL=IntlTranslation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IntlTranslation.d.ts","sourceRoot":"","sources":["../../src/models/IntlTranslation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAA8B,MAAM,cAAc,CAAC;AAErE;;;;GAIG;AACH,qBAEa,eAAgB,SAAQ,SAAS;IAErC,EAAE,EAAE,MAAM,CAAC;IAEX,GAAG,EAAE,MAAM,CAAC;IAEZ,KAAK,EAAE,MAAM,CAAC;IAEd,IAAI,EAAE,MAAM,CAAC;CACrB"}
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
2
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
3
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -8,23 +7,21 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
8
7
  var __metadata = (this && this.__metadata) || function (k, v) {
9
8
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
9
  };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.IntlTranslation = void 0;
13
- const orm_1 = require("@spinajs/orm");
10
+ import { ModelBase, Connection, Model, Primary } from '@spinajs/orm';
14
11
  /**
15
12
  * Base modele for users used by ACL
16
13
  *
17
14
  * To add / extend fields simply extend this model and register as default user model in ACL service
18
15
  */
19
- let IntlTranslation = class IntlTranslation extends orm_1.ModelBase {
16
+ let IntlTranslation = class IntlTranslation extends ModelBase {
20
17
  };
21
18
  __decorate([
22
- (0, orm_1.Primary)(),
19
+ Primary(),
23
20
  __metadata("design:type", Number)
24
21
  ], IntlTranslation.prototype, "Id", void 0);
25
22
  IntlTranslation = __decorate([
26
- (0, orm_1.Connection)('default'),
27
- (0, orm_1.Model)('intl_translations')
23
+ Connection('default'),
24
+ Model('intl_translations')
28
25
  ], IntlTranslation);
29
- exports.IntlTranslation = IntlTranslation;
26
+ export { IntlTranslation };
30
27
  //# sourceMappingURL=IntlTranslation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"IntlTranslation.js","sourceRoot":"","sources":["../../src/models/IntlTranslation.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,sCAAqE;AAErE;;;;GAIG;AAGH,IAAa,eAAe,GAA5B,MAAa,eAAgB,SAAQ,eAAS;CAS7C,CAAA;AAPC;IADC,IAAA,aAAO,GAAE;;2CACQ;AAFP,eAAe;IAF3B,IAAA,gBAAU,EAAC,SAAS,CAAC;IACrB,IAAA,WAAK,EAAC,mBAAmB,CAAC;GACd,eAAe,CAS3B;AATY,0CAAe"}
1
+ {"version":3,"file":"IntlTranslation.js","sourceRoot":"","sources":["../../src/models/IntlTranslation.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAErE;;;;GAIG;AAGI,IAAM,eAAe,GAArB,MAAM,eAAgB,SAAQ,SAAS;CAS7C,CAAA;AARC;IAAC,OAAO,EAAE;;2CACQ;AAFP,eAAe;IAF3B,UAAU,CAAC,SAAS,CAAC;IACrB,KAAK,CAAC,mBAAmB,CAAC;GACd,eAAe,CAS3B;SATY,eAAe"}
package/package.json CHANGED
@@ -1,55 +1,58 @@
1
- {
2
- "name": "@spinajs/intl-orm",
3
- "version": "2.0.46",
4
- "description": "Internationalization support for ORM module",
5
- "main": "lib/index.js",
6
- "private": false,
7
- "scripts": {
8
- "build": "npm run clean && npm run compile",
9
- "compile": "tsc -p tsconfig.build.json",
10
- "clean": "",
11
- "test": "ts-mocha -p tsconfig.json test/**/*.test.ts",
12
- "coverage": "nyc npm run test",
13
- "build-docs": "rimraf docs && typedoc --options typedoc.json src/",
14
- "prepare": "npm run build",
15
- "format": "prettier --write \"src/**/*.ts\"",
16
- "lint": "eslint -c .eslintrc.js --ext .ts src --fix",
17
- "prepublishOnly": "npm test && npm run lint",
18
- "preversion": "npm run lint",
19
- "version": "npm run format && git add -A src",
20
- "postversion": "git push && git push --tags"
21
- },
22
- "files": [
23
- "lib/**/*"
24
- ],
25
- "types": "lib",
26
- "repository": {
27
- "type": "git",
28
- "url": "git+https://github.com/spinajs/main.git"
29
- },
30
- "keywords": [
31
- "spinajs",
32
- "int orm"
33
- ],
34
- "author": "SpinaJS <spinajs@coderush.pl> (https://github.com/spinajs/main)",
35
- "license": "MIT",
36
- "bugs": {
37
- "url": "https://github.com/spinajs/main/issues"
38
- },
39
- "homepage": "https://github.com/spinajs/main#readme",
40
- "dependencies": {
41
- "@spinajs/configuration": "^2.0.46",
42
- "@spinajs/di": "^2.0.46",
43
- "@spinajs/exceptions": "^2.0.39",
44
- "@spinajs/intl": "^2.0.46",
45
- "@spinajs/log": "^2.0.46",
46
- "@spinajs/orm": "^2.0.46",
47
- "@spinajs/reflection": "^2.0.46",
48
- "luxon": "^2.4.0",
49
- "typescript-mix": "^3.1.3"
50
- },
51
- "devDependencies": {
52
- "@spinajs/orm-sqlite": "^2.0.46"
53
- },
54
- "gitHead": "bd560afd6c9a156071102cc6b4f36115b5498e9d"
55
- }
1
+ {
2
+ "name": "@spinajs/intl-orm",
3
+ "version": "2.0.48",
4
+ "description": "Internationalization support for ORM module",
5
+ "exports": "./lib/index.js",
6
+ "type": "module",
7
+ "private": false,
8
+ "engines": {
9
+ "node": ">=16.11"
10
+ },
11
+ "scripts": {
12
+ "build": "npm run clean && npm run compile",
13
+ "compile": "tsc -b tsconfig.json",
14
+ "rimraf": "./node_modules/rimraf/bin.js",
15
+ "clean": "rimraf lib/ && rimraf tsconfig.tsbuildinfo",
16
+ "test": "ts-mocha -p tsconfig.json test/**/*.test.ts",
17
+ "coverage": "nyc npm run test",
18
+ "build-docs": "rimraf docs && typedoc --options typedoc.json src/",
19
+ "format": "prettier --write \"src/**/*.ts\"",
20
+ "lint": "eslint -c .eslintrc.cjs --ext .ts src --fix",
21
+ "preversion": "npm run lint",
22
+ "version": "npm run format && git add -A src",
23
+ "postinstall": "npm run build"
24
+ },
25
+ "files": [
26
+ "lib/**/*"
27
+ ],
28
+ "types": "lib",
29
+ "repository": {
30
+ "type": "git",
31
+ "url": "git+https://github.com/spinajs/main.git"
32
+ },
33
+ "keywords": [
34
+ "spinajs",
35
+ "int orm"
36
+ ],
37
+ "author": "SpinaJS <spinajs@coderush.pl> (https://github.com/spinajs/main)",
38
+ "license": "MIT",
39
+ "bugs": {
40
+ "url": "https://github.com/spinajs/main/issues"
41
+ },
42
+ "homepage": "https://github.com/spinajs/main#readme",
43
+ "dependencies": {
44
+ "@spinajs/configuration": "^2.0.46",
45
+ "@spinajs/di": "^2.0.46",
46
+ "@spinajs/exceptions": "^2.0.39",
47
+ "@spinajs/intl": "^2.0.46",
48
+ "@spinajs/log": "^2.0.46",
49
+ "@spinajs/orm": "^2.0.46",
50
+ "@spinajs/reflection": "^2.0.46",
51
+ "luxon": "^3.2.1",
52
+ "typescript-mix": "^3.1.3"
53
+ },
54
+ "devDependencies": {
55
+ "@spinajs/orm-sqlite": "^2.0.46"
56
+ },
57
+ "gitHead": "002dc553b0ffffd72193d0121ac425a4083bc9ee"
58
+ }
@@ -1,4 +0,0 @@
1
- import { Bootstrapper } from '@spinajs/di';
2
- export declare class OrmIntlBootstrapper extends Bootstrapper {
3
- bootstrap(): Promise<void>;
4
- }
package/lib/bootstrap.js DELETED
@@ -1,27 +0,0 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- 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;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.OrmIntlBootstrapper = void 0;
10
- /* eslint-disable @typescript-eslint/require-await */
11
- const di_1 = require("@spinajs/di");
12
- const IntlOrm_2022_06_28_01_13_00_1 = require("./migrations/IntlOrm_2022_06_28_01_13_00");
13
- const IntlResource_1 = require("./models/IntlResource");
14
- const IntlTranslation_1 = require("./models/IntlTranslation");
15
- let OrmIntlBootstrapper = class OrmIntlBootstrapper extends di_1.Bootstrapper {
16
- async bootstrap() {
17
- di_1.DI.register(IntlResource_1.IntlResource).asValue('__models__');
18
- di_1.DI.register(IntlTranslation_1.IntlTranslation).asValue('__models__');
19
- di_1.DI.register(IntlOrm_2022_06_28_01_13_00_1.IntlOrm_2022_06_28_01_13_00).asValue('__migrations__');
20
- return;
21
- }
22
- };
23
- OrmIntlBootstrapper = __decorate([
24
- (0, di_1.Injectable)(di_1.Bootstrapper)
25
- ], OrmIntlBootstrapper);
26
- exports.OrmIntlBootstrapper = OrmIntlBootstrapper;
27
- //# sourceMappingURL=bootstrap.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../src/bootstrap.ts"],"names":[],"mappings":";;;;;;;;;AAAA,qDAAqD;AACrD,oCAA2D;AAC3D,0FAAuF;AACvF,wDAAqD;AACrD,8DAA2D;AAG3D,IAAa,mBAAmB,GAAhC,MAAa,mBAAoB,SAAQ,iBAAY;IAC5C,KAAK,CAAC,SAAS;QACpB,OAAE,CAAC,QAAQ,CAAC,2BAAY,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;QAChD,OAAE,CAAC,QAAQ,CAAC,iCAAe,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;QACnD,OAAE,CAAC,QAAQ,CAAC,yDAA2B,CAAC,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC;QACnE,OAAO;IACT,CAAC;CACF,CAAA;AAPY,mBAAmB;IAD/B,IAAA,eAAU,EAAC,iBAAY,CAAC;GACZ,mBAAmB,CAO/B;AAPY,kDAAmB"}
package/lib/language.d.ts DELETED
@@ -1 +0,0 @@
1
- export declare function guessLanguage(lang?: string): string;
package/lib/language.js DELETED
@@ -1,27 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.guessLanguage = void 0;
4
- const configuration_1 = require("@spinajs/configuration");
5
- const di_1 = require("@spinajs/di");
6
- const node_async_hooks_1 = require("node:async_hooks");
7
- function guessLanguage(lang) {
8
- let selectedLang = lang;
9
- if (!selectedLang) {
10
- const store = di_1.DI.get(node_async_hooks_1.AsyncLocalStorage);
11
- if (store) {
12
- const storage = di_1.DI.get(node_async_hooks_1.AsyncLocalStorage).getStore();
13
- if (!storage || !storage.language) {
14
- selectedLang = di_1.DI.get(configuration_1.Configuration).get('intl.defaultLocale');
15
- }
16
- else {
17
- selectedLang = storage.language;
18
- }
19
- }
20
- else {
21
- selectedLang = di_1.DI.get(configuration_1.Configuration).get('intl.defaultLocale');
22
- }
23
- }
24
- return selectedLang;
25
- }
26
- exports.guessLanguage = guessLanguage;
27
- //# sourceMappingURL=language.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"language.js","sourceRoot":"","sources":["../src/language.ts"],"names":[],"mappings":";;;AAAA,0DAAuD;AACvD,oCAAiC;AAEjC,uDAAqD;AAErD,SAAgB,aAAa,CAAC,IAAa;IACzC,IAAI,YAAY,GAAG,IAAI,CAAC;IACxB,IAAI,CAAC,YAAY,EAAE;QACjB,MAAM,KAAK,GAAG,OAAE,CAAC,GAAG,CAAC,oCAAiB,CAAC,CAAC;QACxC,IAAI,KAAK,EAAE;YACT,MAAM,OAAO,GAAG,OAAE,CAAC,GAAG,CAAC,oCAAiB,CAAC,CAAC,QAAQ,EAAuB,CAAC;YAC1E,IAAI,CAAC,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE;gBACjC,YAAY,GAAG,OAAE,CAAC,GAAG,CAAC,6BAAa,CAAC,CAAC,GAAG,CAAS,oBAAoB,CAAC,CAAC;aACxE;iBAAM;gBACL,YAAY,GAAG,OAAO,CAAC,QAAQ,CAAC;aACjC;SACF;aAAM;YACL,YAAY,GAAG,OAAE,CAAC,GAAG,CAAC,6BAAa,CAAC,CAAC,GAAG,CAAS,oBAAoB,CAAC,CAAC;SACxE;KACF;IAED,OAAO,YAAY,CAAC;AACtB,CAAC;AAjBD,sCAiBC"}
File without changes
package/lib/relations.js DELETED
@@ -1,32 +0,0 @@
1
- // import { NewInstance } from '@spinajs/di';
2
- // import { BelongsToRecursiveRelation, BelongsToRelation, ManyToManyRelation, OneToManyRelation } from '@spinajs/orm';
3
- // declare module '@spinajs/orm' {
4
- // export interface IOrmRelation {
5
- // translate(lang: string): void;
6
- // }
7
- // }
8
- // @NewInstance()
9
- // export class IntlBelongsToRelation extends BelongsToRelation {
10
- // public translate(lang: string): void {
11
- // this._relationQuery.translate(lang);
12
- // }
13
- // }
14
- // @NewInstance()
15
- // export class IntlBelongsToRecursiveRelation extends BelongsToRecursiveRelation {
16
- // public translate(lang: string): void {
17
- // this._relationQuery.translate(lang);
18
- // }
19
- // }
20
- // @NewInstance()
21
- // export class IntlOneToManyRelation extends OneToManyRelation {
22
- // public translate(lang: string): void {
23
- // this._relationQuery.translate(lang);
24
- // }
25
- // }
26
- // @NewInstance()
27
- // export class IntlManyToManyRelation extends ManyToManyRelation {
28
- // public translate(lang: string): void {
29
- // this._relationQuery.translate(lang);
30
- // }
31
- // }
32
- //# sourceMappingURL=relations.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"relations.js","sourceRoot":"","sources":["../src/relations.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,uHAAuH;AAEvH,kCAAkC;AAClC,oCAAoC;AACpC,qCAAqC;AACrC,MAAM;AACN,IAAI;AAEJ,iBAAiB;AACjB,iEAAiE;AACjE,2CAA2C;AAC3C,2CAA2C;AAC3C,MAAM;AACN,IAAI;AAEJ,iBAAiB;AACjB,mFAAmF;AACnF,2CAA2C;AAC3C,2CAA2C;AAC3C,MAAM;AACN,IAAI;AAEJ,iBAAiB;AACjB,iEAAiE;AACjE,2CAA2C;AAC3C,2CAA2C;AAC3C,MAAM;AACN,IAAI;AAEJ,iBAAiB;AACjB,mEAAmE;AACnE,2CAA2C;AAC3C,2CAA2C;AAC3C,MAAM;AACN,IAAI"}