ical-generator 1.15.0 → 1.15.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.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,20 @@ _The following document documents changes to this library. Changes to the depend
4
4
 
5
5
  <br />
6
6
 
7
+ ## [1.15.4](https://github.com/sebbo2002/ical-generator/releases/tag/1.15.4) - 2021-01-14
8
+ ### Budgfix
9
+ - Fix: Line folding breaks surrogate pairs ([#221](https://github.com/sebbo2002/ical-generator/issues/221))
10
+
11
+ ## [1.15.2](https://github.com/sebbo2002/ical-generator/releases/tag/1.15.2) - 2020-11-12
12
+ ### Bugfix
13
+ - Types: Add rsvp to AttendeeData
14
+ - Types: Specify possible values for status and busystatus
15
+ - Types: Specify possible values for transparency
16
+
17
+ ## [1.15.1](https://github.com/sebbo2002/ical-generator/releases/tag/1.15.1) - 2020-10-03
18
+ ### Bugfix
19
+ - Typings: OPT_PARTICIPANT should be OPT-PARTICIPANT (#192)
20
+
7
21
  ## [1.15.0](https://github.com/sebbo2002/ical-generator/releases/tag/1.15.0) - 2020-08-24
8
22
  ### Feature
9
23
  - Events: Add WKST support
package/README.md CHANGED
@@ -6,6 +6,14 @@
6
6
  ical-generator is a small piece of code which generates ical calendar files. I use this to generate subscriptionable
7
7
  calendar feeds.
8
8
 
9
+ <table><tr><td>
10
+ <b>⚠️ Version 2.0.0</b><br /><br />
11
+ <p>I started working on version 2.0.0, a complete rewrite using typescript. You can find the
12
+ <a href="https://github.com/sebbo2002/ical-generator/blob/master/README.md">old Readme here</a>. You can also have a look at the
13
+ <a href="https://github.com/sebbo2002/ical-generator/issues?q=is%3Aopen+is%3Aissue+milestone%3A%22v2.0.0+%F0%9F%8E%89%22">
14
+ Issues assigned to the 2.0.0 Milestone</a>.</p>
15
+ </td></tr></table>
16
+
9
17
 
10
18
  ## Installation
11
19
 
package/dist/_tools.js CHANGED
@@ -122,7 +122,28 @@ var ICalTools = /*#__PURE__*/function () {
122
122
  key: "foldLines",
123
123
  value: function foldLines(input) {
124
124
  return input.split('\r\n').map(function (line) {
125
- return line.match(/(.{1,74})/g).join('\r\n ');
125
+ var result = '';
126
+ var c = 0;
127
+
128
+ for (var i = 0; i < line.length; i++) {
129
+ var ch = line.charAt(i); // surrogate pair, see https://mathiasbynens.be/notes/javascript-encoding#surrogate-pairs
130
+
131
+ if (ch >= "\uD800" && ch <= "\uDBFF") {
132
+ ch += line.charAt(++i);
133
+ }
134
+
135
+ var charsize = Buffer.from(ch).length;
136
+ c += charsize;
137
+
138
+ if (c > 74) {
139
+ result += '\r\n ';
140
+ c = charsize;
141
+ }
142
+
143
+ result += ch;
144
+ }
145
+
146
+ return result;
126
147
  }).join('\r\n');
127
148
  }
128
149
  }, {
package/index.d.ts CHANGED
@@ -16,8 +16,9 @@ declare module 'ical-generator' {
16
16
  type repeatingFreq = 'SECONDLY' | 'MINUTELY' | 'DAILY' | 'WEEKLY' | 'MONTHLY' | 'YEARLY';
17
17
  type status = 'CONFIRMED' | 'TENTATIVE' | 'CANCELLED';
18
18
  type busystatus = 'FREE' | 'TENTATIVE' | 'BUSY' | 'OOF';
19
+ type transparency = 'OPAQUE' | 'TRANSPARENT';
19
20
  type day = 'SU' | 'MO' | 'TU' | 'WE' | 'TH' | 'FR' | 'SA';
20
- type attendeeRole = 'CHAIR' | 'REQ-PARTICIPANT' | 'OPT_PARTICIPANT' | 'NON-PARTICIPANT';
21
+ type attendeeRole = 'CHAIR' | 'REQ-PARTICIPANT' | 'OPT-PARTICIPANT' | 'NON-PARTICIPANT';
21
22
  type attendeeStatus = 'ACCEPTED' | 'TENTATIVE' | 'DECLINED' | 'DELEGATED' | 'NEEDS-ACTION';
22
23
  type attendeeRsvp = 'true' | 'false' | true | false;
23
24
  type attendeeType = 'INDIVIDUAL' | 'GROUP' | 'RESOURCE' | 'ROOM' | 'UNKNOWN';
@@ -76,11 +77,11 @@ declare module 'ical-generator' {
76
77
  organizer?: string | PersonData;
77
78
  attendees?: AttendeeData[];
78
79
  alarms?: AlarmData[];
79
- status?: string;
80
- busystatus?: string;
80
+ status?: status;
81
+ busystatus?: busystatus;
81
82
  timezone?: string;
82
83
  recurrenceId?: moment.Moment | Date | string;
83
- transparency?: string;
84
+ transparency?: transparency;
84
85
  x?: { key: string, value: string }[];
85
86
  }
86
87
 
@@ -110,6 +111,7 @@ declare module 'ical-generator' {
110
111
  role?: attendeeRole;
111
112
  status?: attendeeStatus;
112
113
  type?: attendeeType;
114
+ rsvp?: attendeeRsvp,
113
115
  delegatedTo?: ICalAttendee;
114
116
  delegatedFrom?: ICalAttendee;
115
117
  delegatesTo?: ICalAttendee;
@@ -244,8 +246,8 @@ declare module 'ical-generator' {
244
246
  lastModified(): moment.Moment;
245
247
  lastModified(lastModified: string | moment.Moment | Date): ICalEvent;
246
248
  toJSON(): EventData;
247
- transparency(): string;
248
- transparency(transparency: string): string;
249
+ transparency(): transparency;
250
+ transparency(transparency: transparency): string;
249
251
  }
250
252
 
251
253
  class ICalAttendee {
package/package.json CHANGED
@@ -11,25 +11,25 @@
11
11
  "node": ">=6.0.0"
12
12
  },
13
13
  "dependencies": {
14
- "moment-timezone": "^0.5.31"
14
+ "moment-timezone": "^0.5.32"
15
15
  },
16
16
  "devDependencies": {
17
- "@babel/cli": "^7.10.5",
18
- "@babel/core": "^7.11.1",
19
- "@babel/preset-env": "^7.11.0",
20
- "babel-loader": "^8.1.0",
21
- "babel-plugin-add-module-exports": "^1.0.2",
22
- "eslint": "^7.7.0",
17
+ "@babel/cli": "^7.12.10",
18
+ "@babel/core": "^7.12.10",
19
+ "@babel/preset-env": "^7.12.10",
20
+ "babel-loader": "^8.2.2",
21
+ "babel-plugin-add-module-exports": "^1.0.4",
22
+ "eslint": "^7.15.0",
23
23
  "jquery": "^3.5.1",
24
24
  "jshint": "^2.12.0",
25
- "mocha": "^8.1.1",
26
- "mochawesome": "^6.1.1",
27
- "moment": "^2.27.0",
25
+ "mocha": "^8.2.1",
26
+ "mochawesome": "^6.2.1",
27
+ "moment": "^2.29.1",
28
28
  "npm-check": "^5.9.2",
29
29
  "nyc": "^15.1.0",
30
30
  "portfinder": "^1.0.28",
31
- "webpack": "^4.44.1",
32
- "webpack-cli": "^3.3.12"
31
+ "webpack": "^5.10.1",
32
+ "webpack-cli": "^4.2.0"
33
33
  },
34
34
  "peerDependencies": {
35
35
  "@types/node": ">= 8.0.0"
@@ -55,5 +55,5 @@
55
55
  },
56
56
  "typings": "index.d.ts",
57
57
  "runkitExampleFilename": "examples/example-runkit.js",
58
- "version": "1.15.0"
58
+ "version": "1.15.4"
59
59
  }
package/src/_tools.js CHANGED
@@ -90,7 +90,26 @@ class ICalTools {
90
90
 
91
91
  static foldLines (input) {
92
92
  return input.split('\r\n').map(function (line) {
93
- return line.match(/(.{1,74})/g).join('\r\n ');
93
+ let result = '';
94
+ let c = 0;
95
+ for (let i = 0; i < line.length; i++) {
96
+ let ch = line.charAt(i);
97
+
98
+ // surrogate pair, see https://mathiasbynens.be/notes/javascript-encoding#surrogate-pairs
99
+ if (ch >= '\ud800' && ch <= '\udbff') {
100
+ ch += line.charAt(++i);
101
+ }
102
+
103
+ const charsize = Buffer.from(ch).length;
104
+ c += charsize;
105
+ if (c > 74) {
106
+ result += '\r\n ';
107
+ c = charsize;
108
+ }
109
+
110
+ result += ch;
111
+ }
112
+ return result;
94
113
  }).join('\r\n');
95
114
  }
96
115
 
@@ -202,5 +202,11 @@ describe('ICalTools', function () {
202
202
  '12345678ikjhgztrde546rf7g8hjiomkjnhgqfcdxerdftgzuinjhgcfvtzvzvuwcbiweciujz\r\n vguhbghbbqwxowidoi21e8981'
203
203
  );
204
204
  });
205
+ it('should not split surrogate pairs', function () {
206
+ assert.strictEqual(
207
+ ICalTools.foldLines('👋🏼12345678ikjhgztrde546rf7g8hjiomkjnhgqfcdxerdftgzuinjhgcfvtzvzvuwcbiweciujvguhbghbbqwxowidoi21e8981'),
208
+ '👋🏼12345678ikjhgztrde546rf7g8hjiomkjnhgqfcdxerdftgzuinjhgcfvtzvzvuwcb\r\n iweciujvguhbghbbqwxowidoi21e8981'
209
+ );
210
+ });
205
211
  });
206
212
  });