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 CHANGED
@@ -4,7 +4,7 @@
4
4
  "files": [
5
5
  "*"
6
6
  ],
7
- "version": "4.72.1",
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": "^2.0.1",
21
- "mime-types": "^2.1.35",
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
- "@types/mime-types": "^2.1.4",
29
- "@types/node": "^22.9.0",
30
- "glyphs2font": "^1.2.4",
31
- "prettier": "^2.8.8",
32
- "svgo": "^3.0.2",
33
- "typescript": "^5.6.3",
34
- "vite": "^5.4.19",
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": "^2.1.9"
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: NodeJS.Timeout | null = null
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 {Logger} from "tuff-core/logging"
2
- import {QueryParams, RawQueryParams} from "tuff-core/urls"
3
- import {LogEntry} from "./logging"
4
- import {ErrorEvent} from "./api-subscriber"
5
- import Strings from "tuff-core/strings";
6
- import dayjs from "dayjs";
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 Error {
27
+ export class ApiException extends TuffError {
26
28
  constructor(message: string) {
27
- super(`ApiException: ${message}`)
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
 
@@ -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
@@ -1,4 +1,4 @@
1
- // This file was automatically generated by glyps:compile on 07/01/26 12:59 PM, DO NOT MANUALLY EDIT!
1
+ // This file was automatically generated by glyps:compile on 08/11/26 10:33 AM, DO NOT MANUALLY EDIT!
2
2
 
3
3
  import Strings from "tuff-core/strings"
4
4
 
package/tsconfig.json CHANGED
@@ -8,6 +8,7 @@
8
8
  "ESNext",
9
9
  "DOM"
10
10
  ],
11
+ "types" : ["vite/client"],
11
12
  "moduleResolution" : "bundler",
12
13
  "strict" : true,
13
14
  "sourceMap" : true,