@crowdin/app-project-module 0.98.0-cf-6 → 0.98.0-cf-7

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/out/storage/d1.js CHANGED
@@ -149,18 +149,20 @@ class D1Storage {
149
149
  });
150
150
  }
151
151
  saveCrowdinCredentials(credentials) {
152
+ var _a, _b, _c;
152
153
  return __awaiter(this, void 0, void 0, function* () {
153
154
  yield this.db
154
155
  .prepare('INSERT INTO crowdin_credentials(id, app_secret, domain, user_id, agent_id, organization_id, base_url, access_token, refresh_token, expire, type) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)')
155
- .bind(...this.sanitizeBindValues(credentials.id, credentials.appSecret, credentials.domain, credentials.userId, credentials.agentId, credentials.organizationId, credentials.baseUrl, credentials.accessToken, credentials.refreshToken, credentials.expire, credentials.type))
156
+ .bind(...this.sanitizeBindValues(credentials.id, credentials.appSecret, credentials.domain, (_a = credentials.userId) === null || _a === void 0 ? void 0 : _a.toString(), (_b = credentials.agentId) === null || _b === void 0 ? void 0 : _b.toString(), (_c = credentials.organizationId) === null || _c === void 0 ? void 0 : _c.toString(), credentials.baseUrl, credentials.accessToken, credentials.refreshToken, credentials.expire, credentials.type))
156
157
  .run();
157
158
  });
158
159
  }
159
160
  updateCrowdinCredentials(credentials) {
161
+ var _a, _b, _c;
160
162
  return __awaiter(this, void 0, void 0, function* () {
161
163
  yield this.db
162
164
  .prepare('UPDATE crowdin_credentials SET app_secret = ?, domain = ?, user_id = ?, agent_id = ?, organization_id = ?, base_url = ?, access_token = ?, refresh_token = ?, expire = ? WHERE id = ?')
163
- .bind(...this.sanitizeBindValues(credentials.appSecret, credentials.domain, credentials.userId, credentials.agentId, credentials.organizationId, credentials.baseUrl, credentials.accessToken, credentials.refreshToken, credentials.expire, credentials.id))
165
+ .bind(...this.sanitizeBindValues(credentials.appSecret, credentials.domain, (_a = credentials.userId) === null || _a === void 0 ? void 0 : _a.toString(), (_b = credentials.agentId) === null || _b === void 0 ? void 0 : _b.toString(), (_c = credentials.organizationId) === null || _c === void 0 ? void 0 : _c.toString(), credentials.baseUrl, credentials.accessToken, credentials.refreshToken, credentials.expire, credentials.id))
164
166
  .run();
165
167
  });
166
168
  }
@@ -171,7 +173,7 @@ class D1Storage {
171
173
  .bind(id)
172
174
  .first();
173
175
  if (row) {
174
- return row;
176
+ return Object.assign(Object.assign({}, row), { userId: row.userId ? parseInt(row.userId, 10) : row.userId, agentId: row.agentId ? parseInt(row.agentId, 10) : row.agentId, organizationId: row.organizationId ? parseInt(row.organizationId, 10) : row.organizationId });
175
177
  }
176
178
  });
177
179
  }
@@ -180,7 +182,7 @@ class D1Storage {
180
182
  const result = yield this.db
181
183
  .prepare('SELECT id, app_secret as appSecret, domain, user_id as userId, agent_id as agentId, organization_id as organizationId, base_url as baseUrl, access_token as accessToken, refresh_token as refreshToken, expire, type FROM crowdin_credentials')
182
184
  .all();
183
- return result.results || [];
185
+ return (result.results || []).map((row) => (Object.assign(Object.assign({}, row), { userId: row.userId ? parseInt(row.userId, 10) : row.userId, agentId: row.agentId ? parseInt(row.agentId, 10) : row.agentId, organizationId: row.organizationId ? parseInt(row.organizationId, 10) : row.organizationId })));
184
186
  });
185
187
  }
186
188
  deleteCrowdinCredentials(id) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crowdin/app-project-module",
3
- "version": "0.98.0-cf-6",
3
+ "version": "0.98.0-cf-7",
4
4
  "description": "Module that generates for you all common endpoints for serving standalone Crowdin App",
5
5
  "main": "out/index.js",
6
6
  "types": "out/index.d.ts",