@hebcal/rest-api 5.1.2 → 5.1.4

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.
@@ -0,0 +1,117 @@
1
+ import { CalOptions, Location, Event } from '@hebcal/core';
2
+ export { pad2, pad4 } from '@hebcal/hdate';
3
+
4
+ interface StringMap {
5
+ [key: string]: string;
6
+ }
7
+ type RestApiEventOptions = {
8
+ utmSource?: string;
9
+ utmMedium?: string;
10
+ utmCampaign?: string;
11
+ appendHebrewToSubject?: boolean;
12
+ yahrzeit?: boolean;
13
+ subscribe?: string | boolean;
14
+ heDateParts?: boolean;
15
+ includeEvent?: boolean;
16
+ euro?: boolean;
17
+ title?: string;
18
+ description?: string;
19
+ dayFormat?: Intl.DateTimeFormat;
20
+ mainUrl?: string;
21
+ selfUrl?: string;
22
+ buildDate?: Date;
23
+ lastBuildDate?: string;
24
+ evPubDate?: boolean;
25
+ lang?: string;
26
+ preferAsciiName?: boolean;
27
+ };
28
+ type RestApiOptions = CalOptions & RestApiEventOptions;
29
+ /**
30
+ * Location information
31
+ */
32
+ type LocationPlainObj = {
33
+ title?: string | null;
34
+ city?: string | null;
35
+ tzid?: string;
36
+ latitude?: number;
37
+ longitude?: number;
38
+ cc?: string;
39
+ country?: string;
40
+ admin1?: string;
41
+ asciiname?: string;
42
+ geo?: string;
43
+ zip?: string;
44
+ state?: string;
45
+ stateName?: string;
46
+ geonameid?: number;
47
+ };
48
+ declare const holidayDescription: StringMap;
49
+ declare const countryNames: StringMap;
50
+ /**
51
+ * Converts a @hebcal/core `Location` to a plain JS object.
52
+ */
53
+ declare function locationToPlainObj(location: Location | undefined): LocationPlainObj;
54
+ declare function getDownloadFilename(options: RestApiOptions): string;
55
+ /**
56
+ * Returns just the date portion as YYYY-MM-DD
57
+ */
58
+ declare function toISOString(d: Date): string;
59
+ /**
60
+ * Returns a category and subcategory name
61
+ */
62
+ declare function getEventCategories(ev: Event): string[];
63
+ /**
64
+ * Renders the event title in default locale, but strips off time
65
+ */
66
+ declare function renderTitleWithoutTime(ev: Event): string;
67
+ /**
68
+ * Generates a title like "Hebcal 2020 Israel" or "Hebcal May 1993 Providence"
69
+ */
70
+ declare function getCalendarTitle(events: Event[], options: RestApiOptions): string;
71
+ /**
72
+ * Returns an English language description of the holiday
73
+ */
74
+ declare function getHolidayDescription(ev: Event, firstSentence?: boolean): string;
75
+ /**
76
+ * Makes mulit-line text that summarizes Torah & Haftarah
77
+ */
78
+ declare function makeTorahMemoText(ev: Event, il: boolean): string;
79
+ declare function makeMemo(ev: Event, il: boolean): string;
80
+ /**
81
+ * Appends utm_source and utm_medium parameters to a URL
82
+ */
83
+ declare function appendIsraelAndTracking(url: string, il: boolean, utmSource: string, utmMedium: string, utmCampaign?: string): string;
84
+ declare function shouldRenderBrief(ev: Event): boolean;
85
+
86
+ /**
87
+ * Renders an Event as a string
88
+ */
89
+ declare function eventToCsv(ev: Event, options: RestApiOptions): string;
90
+ declare function eventsToCsv(events: Event[], options: RestApiOptions): string;
91
+
92
+ /**
93
+ * Helper function to transform a string to make it more usable in a URL or filename.
94
+ * Converts to lowercase and replaces non-word characters with hyphen ('-').
95
+ * @example
96
+ * makeAnchor('Rosh Chodesh Adar II') // 'rosh-chodesh-adar-ii'
97
+ */
98
+ declare function makeAnchor(s: string): string;
99
+
100
+ /**
101
+ * Formats a list events for the classic Hebcal.com JSON API response
102
+ */
103
+ declare function eventsToClassicApi(events: Event[], options: RestApiOptions, leyning?: boolean): any;
104
+ /**
105
+ * Converts a Hebcal event to a classic Hebcal.com JSON API object
106
+ */
107
+ declare function eventToClassicApiObject(ev: Event, options: RestApiOptions, leyning?: boolean): any;
108
+
109
+ declare function eventsToRss2(events: Event[], options: RestApiOptions): string;
110
+ declare function eventToRssItem2(ev: Event, options: RestApiOptions): string;
111
+
112
+ /**
113
+ * Converts a Hebcal event to a FullCalendar.io object
114
+ */
115
+ declare function eventToFullCalendar(ev: Event, tzid: string, il: boolean): any;
116
+
117
+ export { type LocationPlainObj, type RestApiEventOptions, type RestApiOptions, type StringMap, appendIsraelAndTracking, countryNames, eventToClassicApiObject, eventToCsv, eventToFullCalendar, eventToRssItem2, eventsToClassicApi, eventsToCsv, eventsToRss2, getCalendarTitle, getDownloadFilename, getEventCategories, getHolidayDescription, holidayDescription, locationToPlainObj, makeAnchor, makeMemo, makeTorahMemoText, renderTitleWithoutTime, shouldRenderBrief, toISOString };
@@ -0,0 +1 @@
1
+ export declare function shortenSedrotUrl(u: URL): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hebcal/rest-api",
3
- "version": "5.1.2",
3
+ "version": "5.1.4",
4
4
  "author": "Michael J. Radwin (https://github.com/mjradwin)",
5
5
  "keywords": [
6
6
  "hebcal"
@@ -15,9 +15,9 @@
15
15
  "exports": {
16
16
  "import": "./dist/index.mjs",
17
17
  "require": "./dist/index.cjs",
18
- "types": "./dist/index.d.ts"
18
+ "types": "./dist/module.d.ts"
19
19
  },
20
- "typings": "dist/index.d.ts",
20
+ "typings": "dist/module.d.ts",
21
21
  "files": [
22
22
  "dist"
23
23
  ],
@@ -29,9 +29,9 @@
29
29
  "url": "https://github.com/hebcal/hebcal-rest-api/issues"
30
30
  },
31
31
  "dependencies": {
32
- "@hebcal/core": "^5.4.9",
33
- "@hebcal/leyning": "^8.2.2",
34
- "@hebcal/triennial": "^5.1.1"
32
+ "@hebcal/core": "^5.5.2",
33
+ "@hebcal/leyning": "^8.2.6",
34
+ "@hebcal/triennial": "^5.1.3"
35
35
  },
36
36
  "scripts": {
37
37
  "build:rollup": "rollup -c",
@@ -44,20 +44,21 @@
44
44
  },
45
45
  "license": "BSD-2-Clause",
46
46
  "devDependencies": {
47
- "@babel/preset-env": "^7.24.8",
48
- "@babel/preset-typescript": "^7.24.7",
47
+ "@babel/preset-env": "^7.25.7",
48
+ "@babel/preset-typescript": "^7.25.7",
49
49
  "@hebcal/learning": "^5.1.1",
50
- "@rollup/plugin-commonjs": "^26.0.1",
50
+ "@rollup/plugin-commonjs": "^28.0.0",
51
51
  "@rollup/plugin-json": "^6.1.0",
52
- "@rollup/plugin-node-resolve": "^15.2.3",
52
+ "@rollup/plugin-node-resolve": "^15.3.0",
53
53
  "@rollup/plugin-terser": "^0.4.4",
54
- "@rollup/plugin-typescript": "^11.1.6",
55
- "@types/jest": "^29.5.12",
54
+ "@rollup/plugin-typescript": "^12.1.0",
55
+ "@types/jest": "^29.5.13",
56
56
  "gts": "^5.3.1",
57
57
  "jest": "^29.7.0",
58
- "rollup": "^4.18.1",
59
- "ts-jest": "^29.2.2",
60
- "typedoc": "^0.26.4",
61
- "typescript": "^5.5.3"
58
+ "rollup": "^4.24.0",
59
+ "rollup-plugin-dts": "^6.1.1",
60
+ "ts-jest": "^29.2.5",
61
+ "typedoc": "^0.26.8",
62
+ "typescript": "^5.6.2"
62
63
  }
63
64
  }