@snailycad/utils
Advanced tools
Comparing version 1.68.7 to 1.74.0
@@ -6,3 +6,3 @@ 'use strict'; | ||
if (process.env.NODE_ENV === "development") { | ||
return "http://localhost:8080/v1"; | ||
return "http://192.168.6.41:8080/v1"; | ||
} | ||
@@ -9,0 +9,0 @@ if (envUrl.endsWith("/v1")) { |
@@ -6,3 +6,2 @@ 'use strict'; | ||
function generateCallsign(unit, template) { | ||
var _a; | ||
const isCombined = !("citizenId" in unit) || "officers" in unit || "deputies" in unit; | ||
@@ -19,6 +18,6 @@ const _template = getTemplateFromUnit({ template, unit }); | ||
const replacers = { | ||
department: (_a = unit.department) == null ? void 0 : _a.callsign, | ||
department: unit.department?.callsign, | ||
callsign1: unit.callsign, | ||
callsign2: unit.callsign2, | ||
division: division == null ? void 0 : division.callsign, | ||
division: division?.callsign, | ||
incremental: unit.incremental | ||
@@ -29,3 +28,2 @@ }; | ||
function getTemplateFromUnit({ unit, template }) { | ||
var _a; | ||
const isCombined = !("citizenId" in unit) || "officers" in unit || "deputies" in unit; | ||
@@ -35,5 +33,5 @@ if (isCombined) { | ||
} | ||
return unit.userDefinedCallsign || ((_a = unit.department) == null ? void 0 : _a.customTemplate) || template; | ||
return unit.userDefinedCallsign || unit.department?.customTemplate || template; | ||
} | ||
exports.generateCallsign = generateCallsign; |
@@ -12,3 +12,2 @@ 'use strict'; | ||
function formatCaseNumber(record, template) { | ||
var _a, _b; | ||
if (!template) { | ||
@@ -20,3 +19,3 @@ return `#${record.caseNumber}`; | ||
const replacers = { | ||
department: (_b = (_a = record.officer) == null ? void 0 : _a.department) == null ? void 0 : _b.callsign, | ||
department: record.officer?.department?.callsign, | ||
month: format__default.default(createdAt, "MM"), | ||
@@ -23,0 +22,0 @@ year: format__default.default(createdAt, "yyyy"), |
@@ -6,3 +6,2 @@ 'use strict'; | ||
function slateDataToString(data) { | ||
var _a, _b; | ||
const string = []; | ||
@@ -15,3 +14,3 @@ if (!data) | ||
if (slate.Element.isElement(item) && item.type === "bulleted-list") { | ||
const children = ((_a = item.children) == null ? void 0 : _a.flatMap((c) => c.children).map((v) => v == null ? void 0 : v.text)) ?? []; | ||
const children = item.children?.flatMap((c) => c.children).map((v) => v?.text) ?? []; | ||
string.push(children.join(" ")); | ||
@@ -21,3 +20,3 @@ continue; | ||
if (slate.Element.isElement(item)) { | ||
(_b = item.children) == null ? void 0 : _b.forEach((child) => { | ||
item.children?.forEach((child) => { | ||
string.push(child.text.trim()); | ||
@@ -24,0 +23,0 @@ }); |
{ | ||
"name": "@snailycad/utils", | ||
"version": "1.68.7", | ||
"version": "1.74.0", | ||
"main": "./dist/index.js", | ||
@@ -71,16 +71,15 @@ "module": "./dist/index.mjs", | ||
"scripts": { | ||
"build": "yarn tsup", | ||
"watch": "yarn tsup --watch --silent=false", | ||
"typecheck": "yarn tsc --noEmit", | ||
"test:watch": "yarn vitest --watch", | ||
"test": "yarn vitest run" | ||
"build": "pnpm tsup", | ||
"watch": "pnpm tsup --watch --silent=false", | ||
"typecheck": "pnpm tsc --noEmit", | ||
"test:watch": "pnpm vitest --watch", | ||
"test": "pnpm vitest run" | ||
}, | ||
"devDependencies": { | ||
"@snailycad/types": "^1.68.7", | ||
"@types/node": "^20.8.0", | ||
"c8": "^8.0.1", | ||
"tslib": "^2.6.1", | ||
"tsup": "6.6.2", | ||
"typescript": "^5.1.6", | ||
"vite": "^4.4.8", | ||
"vitest": "^0.34.0" | ||
"typescript": "^5.2.2", | ||
"vite": "^4.4.9", | ||
"vitest": "^0.34.6" | ||
}, | ||
@@ -94,3 +93,3 @@ "tsup": { | ||
"platform": "node", | ||
"target": "node16", | ||
"target": "node18", | ||
"silent": true, | ||
@@ -104,3 +103,12 @@ "treeshake": true, | ||
"sideEffects": false, | ||
"gitHead": "bf6800923a2800a2fd70de430d428df347f879d8" | ||
"dependencies": { | ||
"@snailycad/types": "^1.74.0", | ||
"date-fns": "^2.30.0", | ||
"slate": "0.94.1", | ||
"slate-history": "^0.93.0", | ||
"slate-react": "^0.99.0", | ||
"tslib": "^2.6.2", | ||
"undici": "5.25.3" | ||
}, | ||
"gitHead": "fab926778dfc44ba319eae2f795af788bfe0f7ad" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6
28437
7
639
+ Added@snailycad/types@^1.74.0
+ Addeddate-fns@^2.30.0
+ Addedslate@0.94.1
+ Addedslate-history@^0.93.0
+ Addedslate-react@^0.99.0
+ Addedtslib@^2.6.2
+ Addedundici@5.25.3
+ Added@babel/runtime@7.25.6(transitive)
+ Added@fastify/busboy@2.1.1(transitive)
+ Added@juggle/resize-observer@3.4.0(transitive)
+ Added@snailycad/permissions@1.74.0(transitive)
+ Added@snailycad/types@1.74.0(transitive)
+ Added@types/is-hotkey@0.1.10(transitive)
+ Added@types/lodash@4.17.7(transitive)
+ Addedcompute-scroll-into-view@1.0.20(transitive)
+ Addeddate-fns@2.30.0(transitive)
+ Addeddirection@1.0.4(transitive)
+ Addeddiscord-api-types@0.37.58(transitive)
+ Addedimmer@9.0.21(transitive)
+ Addedis-hotkey@0.1.8(transitive)
+ Addedis-plain-object@5.0.0(transitive)
+ Addedjs-tokens@4.0.0(transitive)
+ Addedlodash@4.17.21(transitive)
+ Addedloose-envify@1.4.0(transitive)
+ Addedreact@18.3.1(transitive)
+ Addedreact-dom@18.3.1(transitive)
+ Addedregenerator-runtime@0.14.1(transitive)
+ Addedscheduler@0.23.2(transitive)
+ Addedscroll-into-view-if-needed@2.2.31(transitive)
+ Addedslate@0.94.1(transitive)
+ Addedslate-history@0.93.0(transitive)
+ Addedslate-react@0.99.0(transitive)
+ Addedtiny-invariant@1.0.6(transitive)
+ Addedtiny-warning@1.0.3(transitive)
+ Addedtslib@2.7.0(transitive)
+ Addedundici@5.25.3(transitive)