terrier-engine 4.72.1 → 4.74.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/package.json +11 -11
- package/terrier/api-subscriber.ts +1 -1
- package/terrier/api.ts +15 -8
- package/terrier/db-client.ts +20 -0
- package/terrier/glyps.ts +1 -1
- package/tsconfig.json +1 -0
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"files": [
|
|
5
5
|
"*"
|
|
6
6
|
],
|
|
7
|
-
"version": "4.
|
|
7
|
+
"version": "4.74.0",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
10
10
|
"url": "https://github.com/Terrier-Tech/terrier-engine"
|
|
@@ -17,22 +17,22 @@
|
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"@types/turbolinks": "^5.2.0",
|
|
19
19
|
"dayjs": "^1.11.7",
|
|
20
|
-
"inflection": "^
|
|
21
|
-
"mime-types": "^
|
|
20
|
+
"inflection": "^3.0.2",
|
|
21
|
+
"mime-types": "^3.0.2",
|
|
22
22
|
"tuff-core": "latest",
|
|
23
23
|
"tuff-plot": "latest",
|
|
24
24
|
"tuff-sortable": "latest",
|
|
25
25
|
"turbolinks": "^5.2.0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@
|
|
29
|
-
"@types/
|
|
30
|
-
"
|
|
31
|
-
"prettier": "^
|
|
32
|
-
"svgo": "^
|
|
33
|
-
"typescript": "^
|
|
34
|
-
"vite": "^
|
|
28
|
+
"@terrier-tech/glyphs2font": "^1.4.0",
|
|
29
|
+
"@types/mime-types": "^3.0.1",
|
|
30
|
+
"@types/node": "^26.1.2",
|
|
31
|
+
"prettier": "^3.9.6",
|
|
32
|
+
"svgo": "^4.0.2",
|
|
33
|
+
"typescript": "^6.0.3",
|
|
34
|
+
"vite": "^8.2.1",
|
|
35
35
|
"vite-plugin-ruby": "^5.1.1",
|
|
36
|
-
"vitest": "^
|
|
36
|
+
"vitest": "^4.1.10"
|
|
37
37
|
}
|
|
38
38
|
}
|
|
@@ -247,7 +247,7 @@ type PollingResponse<TResult> = (ApiResponse & SubscriptionEvent<TResult>) | { e
|
|
|
247
247
|
export class PollingSubscriber<TResult, TParams extends SubscriptionParams> extends ApiSubscriber<TResult, TParams, (SubscriptionOptions & GetSubscriberOptions)> {
|
|
248
248
|
|
|
249
249
|
// used to ensure we only schedule one interval at a time and allows for cancellation.
|
|
250
|
-
private timeoutHandle:
|
|
250
|
+
private timeoutHandle: number | null = null
|
|
251
251
|
|
|
252
252
|
/**
|
|
253
253
|
* @param url the url to make a request to.
|
package/terrier/api.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import Strings from "tuff-core/strings"
|
|
6
|
-
import
|
|
1
|
+
import dayjs from "dayjs"
|
|
2
|
+
import { HtmlParentTag } from "tuff-core/html"
|
|
3
|
+
import { Logger } from "tuff-core/logging"
|
|
4
|
+
import { TuffError } from "tuff-core/parts"
|
|
5
|
+
import Strings from "tuff-core/strings"
|
|
6
|
+
import { QueryParams, RawQueryParams } from "tuff-core/urls"
|
|
7
|
+
import { ErrorEvent } from "./api-subscriber"
|
|
8
|
+
import { LogEntry } from "./logging"
|
|
7
9
|
|
|
8
10
|
const log = new Logger('Api')
|
|
9
11
|
|
|
@@ -22,9 +24,14 @@ export type ApiResponse = {
|
|
|
22
24
|
/**
|
|
23
25
|
* Exception that gets thrown when an API call fails.
|
|
24
26
|
*/
|
|
25
|
-
export class ApiException extends
|
|
27
|
+
export class ApiException extends TuffError {
|
|
26
28
|
constructor(message: string) {
|
|
27
|
-
super(
|
|
29
|
+
super(message)
|
|
30
|
+
this.name = "ApiException"
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
render(parent: HtmlParentTag) {
|
|
34
|
+
parent.p().text(this.message)
|
|
28
35
|
}
|
|
29
36
|
}
|
|
30
37
|
|
package/terrier/db-client.ts
CHANGED
|
@@ -285,6 +285,26 @@ export default class DbClient<PM extends ModelTypeMap, UM extends ModelTypeMap,
|
|
|
285
285
|
}
|
|
286
286
|
}
|
|
287
287
|
|
|
288
|
+
/**
|
|
289
|
+
* Partially update the given record and assume it will succeed.
|
|
290
|
+
* This call should be wrapped in a try/catch.
|
|
291
|
+
* @param modelType the camel_case name of the model
|
|
292
|
+
* @param id the id of the record
|
|
293
|
+
* @param record the record to update
|
|
294
|
+
* @param includes relations to include in the returned record
|
|
295
|
+
*/
|
|
296
|
+
async safePartialUpdate<T extends keyof PM & string>(modelType: T, id: string, record: PartialRecord<UM[T]>, includes: Includes<PM,T,I> = {}): Promise<PM[T]> {
|
|
297
|
+
const res = await this.partialUpdate(modelType, id, record, includes)
|
|
298
|
+
if (res.status == 'success') {
|
|
299
|
+
return res.record
|
|
300
|
+
} else if (res.record) {
|
|
301
|
+
throw new DbSaveException<PM, T>(res.message, res.record as UM[T], res.errors)
|
|
302
|
+
} else {
|
|
303
|
+
throw `Error updating ${modelType}: ${res.message}`
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
|
|
288
308
|
/**
|
|
289
309
|
* Inserts a new record for the given model type.
|
|
290
310
|
* @param modelType the camel_case name of the model
|
package/terrier/glyps.ts
CHANGED