@updraft-solutions/mcrit-sdk 0.3.1 → 0.5.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.
Files changed (49) hide show
  1. package/dist/chunk-AKLFMP7G.cjs +2525 -0
  2. package/dist/{chunk-MF7G76QS.cjs → chunk-IVMOR5SW.cjs} +26 -1
  3. package/dist/{chunk-D5DUVW34.js → chunk-KIMCBEY7.js} +26 -1
  4. package/dist/chunk-YCIXOVEC.js +2525 -0
  5. package/dist/format/index.cjs +2 -2
  6. package/dist/format/index.d.cts +13 -4
  7. package/dist/format/index.d.ts +13 -4
  8. package/dist/format/index.js +1 -1
  9. package/dist/index.cjs +201 -5
  10. package/dist/index.d.cts +3 -3
  11. package/dist/index.d.ts +3 -3
  12. package/dist/index.js +208 -12
  13. package/dist/schemas/index.cjs +198 -2
  14. package/dist/schemas/index.d.cts +3157 -128
  15. package/dist/schemas/index.d.ts +3157 -128
  16. package/dist/schemas/index.js +201 -5
  17. package/dist/{models-BWmpcfR8.d.cts → training-Der1DPU-.d.cts} +23757 -6528
  18. package/dist/{models-BWmpcfR8.d.ts → training-Der1DPU-.d.ts} +23757 -6528
  19. package/dist/types/index.cjs +1 -1
  20. package/dist/types/index.d.cts +277 -6
  21. package/dist/types/index.d.ts +277 -6
  22. package/dist/types/index.js +1 -1
  23. package/package.json +1 -1
  24. package/src/format/index.ts +51 -5
  25. package/src/index.ts +39 -0
  26. package/src/schemas/common.ts +37 -0
  27. package/src/schemas/course-milestone.ts +78 -0
  28. package/src/schemas/equipment.ts +27 -0
  29. package/src/schemas/form-template.ts +413 -0
  30. package/src/schemas/index.ts +7 -1
  31. package/src/schemas/location-map.ts +175 -0
  32. package/src/schemas/models.ts +110 -28
  33. package/src/schemas/newsletter.ts +362 -0
  34. package/src/schemas/todo.ts +46 -0
  35. package/src/schemas/training.ts +500 -0
  36. package/src/types/ai.ts +85 -0
  37. package/src/types/aircraft-block.ts +23 -0
  38. package/src/types/api.ts +3 -1
  39. package/src/types/background-task.ts +28 -0
  40. package/src/types/compliance.ts +27 -3
  41. package/src/types/index.ts +5 -0
  42. package/src/types/landing-fee.ts +92 -0
  43. package/src/types/models.ts +44 -0
  44. package/src/types/roles.ts +26 -0
  45. package/dist/chunk-7QF3OJ45.cjs +0 -1325
  46. package/dist/chunk-FS5I4MBG.js +0 -1325
  47. package/src/schemas/fee.ts +0 -37
  48. /package/dist/{chunk-LXNCAKJZ.js → chunk-2WJHTRIE.js} +0 -0
  49. /package/dist/{chunk-MOOGM3DW.cjs → chunk-DCEOET63.cjs} +0 -0
@@ -109,11 +109,36 @@ function timeString(date, timezone = DEFAULT_TZ, includeTimezone = false) {
109
109
  }
110
110
  return formatted;
111
111
  }
112
+ var RELATIVE_TIME_UNITS = [
113
+ { unit: "year", ms: 365 * 24 * 60 * 60 * 1e3 },
114
+ { unit: "month", ms: 30 * 24 * 60 * 60 * 1e3 },
115
+ { unit: "day", ms: 24 * 60 * 60 * 1e3 },
116
+ { unit: "hour", ms: 60 * 60 * 1e3 },
117
+ { unit: "minute", ms: 60 * 1e3 }
118
+ ];
112
119
  function timeUntil(dateTime, locale = "de") {
113
120
  if (!dateTime) {
114
121
  return "";
115
122
  }
116
- return _momenttimezone2.default.call(void 0, dateTime).locale(locale).fromNow();
123
+ const target = dateTime instanceof Date ? dateTime.getTime() : Date.parse(dateTime);
124
+ if (Number.isNaN(target)) {
125
+ return "";
126
+ }
127
+ const diff = target - Date.now();
128
+ let resolved = "de";
129
+ try {
130
+ if (Intl.RelativeTimeFormat.supportedLocalesOf(locale).length > 0) {
131
+ resolved = locale;
132
+ }
133
+ } catch (e) {
134
+ }
135
+ const formatter = new Intl.RelativeTimeFormat(resolved, { numeric: "auto" });
136
+ for (const { unit, ms } of RELATIVE_TIME_UNITS) {
137
+ if (Math.abs(diff) >= ms) {
138
+ return formatter.format(Math.round(diff / ms), unit);
139
+ }
140
+ }
141
+ return formatter.format(Math.round(diff / 1e3), "second");
117
142
  }
118
143
  function minutesFormatted(minutes) {
119
144
  if (minutes == null) {
@@ -109,11 +109,36 @@ function timeString(date, timezone = DEFAULT_TZ, includeTimezone = false) {
109
109
  }
110
110
  return formatted;
111
111
  }
112
+ var RELATIVE_TIME_UNITS = [
113
+ { unit: "year", ms: 365 * 24 * 60 * 60 * 1e3 },
114
+ { unit: "month", ms: 30 * 24 * 60 * 60 * 1e3 },
115
+ { unit: "day", ms: 24 * 60 * 60 * 1e3 },
116
+ { unit: "hour", ms: 60 * 60 * 1e3 },
117
+ { unit: "minute", ms: 60 * 1e3 }
118
+ ];
112
119
  function timeUntil(dateTime, locale = "de") {
113
120
  if (!dateTime) {
114
121
  return "";
115
122
  }
116
- return moment(dateTime).locale(locale).fromNow();
123
+ const target = dateTime instanceof Date ? dateTime.getTime() : Date.parse(dateTime);
124
+ if (Number.isNaN(target)) {
125
+ return "";
126
+ }
127
+ const diff = target - Date.now();
128
+ let resolved = "de";
129
+ try {
130
+ if (Intl.RelativeTimeFormat.supportedLocalesOf(locale).length > 0) {
131
+ resolved = locale;
132
+ }
133
+ } catch {
134
+ }
135
+ const formatter = new Intl.RelativeTimeFormat(resolved, { numeric: "auto" });
136
+ for (const { unit, ms } of RELATIVE_TIME_UNITS) {
137
+ if (Math.abs(diff) >= ms) {
138
+ return formatter.format(Math.round(diff / ms), unit);
139
+ }
140
+ }
141
+ return formatter.format(Math.round(diff / 1e3), "second");
117
142
  }
118
143
  function minutesFormatted(minutes) {
119
144
  if (minutes == null) {