@moltenship/ics 1.0.0-rc.1 → 2.0.0-beta.1
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/dist/index.d.mts +0 -20
- package/dist/index.mjs +30 -60
- package/package.json +16 -4
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/standard-schema.d.ts
|
|
2
1
|
/** The Standard Typed interface. This is a base type extended by other specs. */
|
|
3
2
|
interface StandardTypedV1<Input = unknown, Output = Input> {
|
|
4
3
|
/** The Standard properties. */
|
|
@@ -74,8 +73,6 @@ declare namespace StandardSchemaV1 {
|
|
|
74
73
|
/** Infers the output type of a Standard. */
|
|
75
74
|
type InferOutput<Schema extends StandardTypedV1> = StandardTypedV1.InferOutput<Schema>;
|
|
76
75
|
}
|
|
77
|
-
//#endregion
|
|
78
|
-
//#region src/types.d.ts
|
|
79
76
|
/** One content line after unfolding. */
|
|
80
77
|
interface IcsProperty {
|
|
81
78
|
/** 1-based line of the property's first physical line; absent for properties built in code. */
|
|
@@ -592,8 +589,6 @@ interface IcsParseResult<TExtensions extends IcsExtensionsConfig = {}> {
|
|
|
592
589
|
interface IcsParser<TExtensions extends IcsExtensionsConfig = {}> extends StandardSchemaV1<string, IcsParseResult<TExtensions>> {
|
|
593
590
|
parse(text: string): IcsParseResult<TExtensions>;
|
|
594
591
|
}
|
|
595
|
-
//#endregion
|
|
596
|
-
//#region src/model/event-end.d.ts
|
|
597
592
|
/**
|
|
598
593
|
* The event's effective end: DTEND, else DTSTART + DURATION, else RFC 5545's default (the next day
|
|
599
594
|
* for a date, the start itself for a date-time). Always the same kind as the start: a DTEND of
|
|
@@ -604,8 +599,6 @@ interface IcsParser<TExtensions extends IcsExtensionsConfig = {}> extends Standa
|
|
|
604
599
|
* to whole days, so the end covers it (`PT1H` ends the next day).
|
|
605
600
|
*/
|
|
606
601
|
export declare function getEventEnd(event: Pick<IcsEvent, "duration" | "end" | "start">): IcsDateValue;
|
|
607
|
-
//#endregion
|
|
608
|
-
//#region src/values/result.d.ts
|
|
609
602
|
interface IcsValueContext {
|
|
610
603
|
/**
|
|
611
604
|
* Resolves a TZID to an IANA time zone id, or `undefined`. Without it, a TZID resolves only when
|
|
@@ -630,12 +623,8 @@ type IcsDecodeResult<T> = {
|
|
|
630
623
|
/** Absent when the value decoded cleanly. */
|
|
631
624
|
readonly warnings?: readonly IcsValueWarning[];
|
|
632
625
|
};
|
|
633
|
-
//#endregion
|
|
634
|
-
//#region src/values/registry.d.ts
|
|
635
626
|
/** The property's value type: its VALUE parameter, else its registered default, else TEXT. */
|
|
636
627
|
export declare function icsValueTypeOf(property: IcsProperty): IcsValueType;
|
|
637
|
-
//#endregion
|
|
638
|
-
//#region src/values/index.d.ts
|
|
639
628
|
/**
|
|
640
629
|
* Decodes one raw value as `type`. It doesn't split lists: use `decodeIcsValues` for a property
|
|
641
630
|
* such as CATEGORIES or EXDATE. Never throws: a value that doesn't parse is `{ ok: false }`, and
|
|
@@ -664,8 +653,6 @@ export declare function decodeIcsDateValue(raw: string, declared: "DATE" | "DATE
|
|
|
664
653
|
* time; writing the TZID parameter is the caller's job.
|
|
665
654
|
*/
|
|
666
655
|
export declare function encodeIcsValue<TType extends IcsValueType>(type: TType, value: IcsDecodedValueMap[TType]): string;
|
|
667
|
-
//#endregion
|
|
668
|
-
//#region src/model/extensions.d.ts
|
|
669
656
|
/**
|
|
670
657
|
* Whether a schema whose input type is `TInput` can take `TValue`: an `unknown` input, a wider
|
|
671
658
|
* one, or one that overlaps it, such as a union of string literals for a TEXT value.
|
|
@@ -691,21 +678,15 @@ type IcsExtensionItem<TType extends IcsValueType, TSchema extends StandardSchema
|
|
|
691
678
|
type IcsExtensionOutput<TType extends IcsValueType, TSchema extends StandardSchemaV1 | undefined, TMultiple extends boolean> = TMultiple extends true ? readonly IcsExtensionItem<TType, TSchema>[] : IcsExtensionItem<TType, TSchema> | undefined;
|
|
692
679
|
/** Declares a typed extension property, such as `X-RESOURCE-ID`, for `IcsParseOptions.extensions`. */
|
|
693
680
|
export declare function icsExtension<TType extends IcsValueType = "TEXT", TSchema extends StandardSchemaV1 | undefined = undefined, TMultiple extends boolean = false>(name: string, options?: IcsExtensionOptions<TType, TSchema, TMultiple>): IcsExtension<IcsExtensionOutput<TType, TSchema, TMultiple>>;
|
|
694
|
-
//#endregion
|
|
695
|
-
//#region src/model/parser.d.ts
|
|
696
681
|
/** Builds a reusable parser. The parser is also a Standard Schema for ICS text. */
|
|
697
682
|
export declare function createIcsParser<TExtensions extends IcsExtensionsConfig = {}>(options?: IcsParseOptions<TExtensions>): IcsParser<TExtensions>;
|
|
698
683
|
/** Parses iCalendar text into typed calendars. */
|
|
699
684
|
export declare function parseIcs<TExtensions extends IcsExtensionsConfig = {}>(text: string, options?: IcsParseOptions<TExtensions>): IcsParseResult<TExtensions>;
|
|
700
|
-
//#endregion
|
|
701
|
-
//#region src/issues.d.ts
|
|
702
685
|
/** Thrown by a strict parser when it finds error-severity issues. */
|
|
703
686
|
export declare class IcsParseError extends Error {
|
|
704
687
|
readonly issues: readonly IcsIssue[];
|
|
705
688
|
constructor(issues: readonly IcsIssue[]);
|
|
706
689
|
}
|
|
707
|
-
//#endregion
|
|
708
|
-
//#region src/syntax/index.d.ts
|
|
709
690
|
interface IcsComponentsResult {
|
|
710
691
|
/** Top-level components, normally VCALENDARs. */
|
|
711
692
|
readonly components: readonly IcsComponent[];
|
|
@@ -722,5 +703,4 @@ export declare function parseIcsComponents(text: string): IcsComponentsResult;
|
|
|
722
703
|
* line breaks in TEXT values as `\n` first.
|
|
723
704
|
*/
|
|
724
705
|
export declare function stringifyIcsComponents(components: IcsComponent | readonly IcsComponent[]): string;
|
|
725
|
-
//#endregion
|
|
726
706
|
export type { IcsAlarm, IcsAlarmTrigger, IcsAttachment, IcsAttendee, IcsCalendar, IcsCalendarUser, IcsClassification, IcsComponent, IcsComponentsResult, IcsConference, IcsDate, IcsDateTime, IcsDateValue, IcsDecodeResult, IcsDecodedValueMap, IcsEvent, IcsEventStatus, IcsExtension, IcsExtensionInput, IcsExtensionMap, IcsExtensionOptions, IcsExtensionOutput, IcsExtensionValues, IcsExtensionsConfig, IcsFloatingDateTime, IcsFreeBusy, IcsFreeBusyPeriods, IcsFrequency, IcsGeo, IcsIssue, IcsIssueCode, IcsIssueSeverity, IcsJournal, IcsJournalStatus, IcsOpen, IcsParameters, IcsParseOptions, IcsParseResult, IcsParser, IcsPeriod, IcsProperty, IcsRecurrenceRule, IcsRelation, IcsSchedulingFields, IcsTime, IcsTimeZone, IcsTimeZoneObservance, IcsTimeZoneResolver, IcsTodo, IcsTodoStatus, IcsTransparency, IcsUnresolvedDateTime, IcsUtcDateTime, IcsUtcOffset, IcsValueContext, IcsValueType, IcsValueWarning, IcsWeekday, IcsWeekdayNumber, IcsZonedDateTime, StandardSchemaV1, StandardTypedV1 };
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/model/event-end.ts
|
|
2
2
|
function wallTimeOf(value) {
|
|
3
3
|
switch (value.kind) {
|
|
4
4
|
case "date": return value.date.toPlainDateTime();
|
|
@@ -100,8 +100,7 @@ function getEventEnd(event) {
|
|
|
100
100
|
kind: "date"
|
|
101
101
|
} : start;
|
|
102
102
|
}
|
|
103
|
-
|
|
104
|
-
//#region src/values/result.ts
|
|
103
|
+
// src/values/result.ts
|
|
105
104
|
function success(value, warnings = []) {
|
|
106
105
|
return warnings.length === 0 ? {
|
|
107
106
|
ok: true,
|
|
@@ -136,8 +135,7 @@ function nested(prefix, result) {
|
|
|
136
135
|
function quote(raw) {
|
|
137
136
|
return JSON.stringify(raw.length > 48 ? `${raw.slice(0, 45)}...` : raw);
|
|
138
137
|
}
|
|
139
|
-
|
|
140
|
-
//#region src/values/date-time.ts
|
|
138
|
+
// src/values/date-time.ts
|
|
141
139
|
const DATE = /^(\d{4})(\d{2})(\d{2})$/;
|
|
142
140
|
const DATE_TIME = /^(\d{4})(\d{2})(\d{2})([Tt])(\d{2})(\d{2})(\d{2})?([Zz])?$/;
|
|
143
141
|
const TIME = /^(\d{2})(\d{2})(\d{2})?([Zz])?$/;
|
|
@@ -282,8 +280,7 @@ function encodeDateValue(value) {
|
|
|
282
280
|
default: return encodeWallTime(value.wallTime);
|
|
283
281
|
}
|
|
284
282
|
}
|
|
285
|
-
|
|
286
|
-
//#region src/values/duration.ts
|
|
283
|
+
// src/values/duration.ts
|
|
287
284
|
const DURATION = /^([+-])?P(?:(\d+)W)?(?:(\d+)D)?(?:(T)(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?)?$/;
|
|
288
285
|
/** Keeps the units as written: `P1D` and `PT24H` differ across a DST change. */
|
|
289
286
|
function decodeDuration(raw) {
|
|
@@ -332,8 +329,7 @@ function encodeDuration(duration) {
|
|
|
332
329
|
if (date === "" && clock === "") return "PT0S";
|
|
333
330
|
return `${duration.sign < 0 ? "-" : ""}P${date}${clock}`;
|
|
334
331
|
}
|
|
335
|
-
|
|
336
|
-
//#region src/values/period.ts
|
|
332
|
+
// src/values/period.ts
|
|
337
333
|
function decodePeriod(raw, context) {
|
|
338
334
|
const slash = raw.indexOf("/");
|
|
339
335
|
if (slash === -1) return failure(`${quote(raw)} isn't a PERIOD (start/end or start/duration)`);
|
|
@@ -363,8 +359,7 @@ function encodePeriod(period) {
|
|
|
363
359
|
const end = "duration" in period ? encodeDuration(period.duration) : encodeDateValue(period.end);
|
|
364
360
|
return `${encodeDateValue(period.start)}/${end}`;
|
|
365
361
|
}
|
|
366
|
-
|
|
367
|
-
//#region src/values/recur.ts
|
|
362
|
+
// src/values/recur.ts
|
|
368
363
|
const NUMBER_LIST_PARTS = /* @__PURE__ */ new Map([
|
|
369
364
|
["BYSECOND", {
|
|
370
365
|
field: "bySecond",
|
|
@@ -545,8 +540,7 @@ function encodeRecur(rule) {
|
|
|
545
540
|
["WKST", rule.weekStart]
|
|
546
541
|
].filter(([, value]) => value !== void 0 && value !== "").map(([name, value]) => `${name}=${value}`).join(";");
|
|
547
542
|
}
|
|
548
|
-
|
|
549
|
-
//#region src/values/scalars.ts
|
|
543
|
+
// src/values/scalars.ts
|
|
550
544
|
const INTEGER = /^[+-]?\d+$/;
|
|
551
545
|
const FLOAT = /^[+-]?\d+(?:\.\d+)?$/;
|
|
552
546
|
const BASE64 = /^[A-Za-z0-9+/]*={0,2}$/;
|
|
@@ -581,8 +575,7 @@ function encodeFloat(value) {
|
|
|
581
575
|
if (point <= 0) return `${sign}0.${"0".repeat(-point)}${digits}`;
|
|
582
576
|
return point >= digits.length ? `${sign}${digits}${"0".repeat(point - digits.length)}` : `${sign}${digits.slice(0, point)}.${digits.slice(point)}`;
|
|
583
577
|
}
|
|
584
|
-
|
|
585
|
-
//#region src/values/text.ts
|
|
578
|
+
// src/values/text.ts
|
|
586
579
|
const ESCAPES = /* @__PURE__ */ new Map([
|
|
587
580
|
[",", ","],
|
|
588
581
|
[";", ";"],
|
|
@@ -626,8 +619,7 @@ function splitList(type, raw) {
|
|
|
626
619
|
items.push(raw.slice(start));
|
|
627
620
|
return items;
|
|
628
621
|
}
|
|
629
|
-
|
|
630
|
-
//#region src/values/utc-offset.ts
|
|
622
|
+
// src/values/utc-offset.ts
|
|
631
623
|
const UTC_OFFSET$1 = /^([+-])?(\d{2}):?(\d{2})(?::?(\d{2}))?$/;
|
|
632
624
|
const OFFSET_STRING = /^([+-])(\d{2}):(\d{2})(?::(\d{2}))?$/;
|
|
633
625
|
function decodeUtcOffset(raw) {
|
|
@@ -648,8 +640,7 @@ function encodeUtcOffset(offset) {
|
|
|
648
640
|
const [, sign, hours, minutes, seconds = ""] = match;
|
|
649
641
|
return `${/^0+$/.test(`${hours}${minutes}${seconds}`) ? "+" : sign}${hours}${minutes}${seconds}`;
|
|
650
642
|
}
|
|
651
|
-
|
|
652
|
-
//#region src/values/registry.ts
|
|
643
|
+
// src/values/registry.ts
|
|
653
644
|
const VALUE_TYPES = /* @__PURE__ */ new Set([
|
|
654
645
|
"BINARY",
|
|
655
646
|
"BOOLEAN",
|
|
@@ -711,8 +702,7 @@ function icsValueTypeOf(property) {
|
|
|
711
702
|
const name = property.name.toUpperCase();
|
|
712
703
|
return Object.hasOwn(DEFAULT_VALUE_TYPES, name) ? DEFAULT_VALUE_TYPES[name] : "TEXT";
|
|
713
704
|
}
|
|
714
|
-
|
|
715
|
-
//#region src/values/index.ts
|
|
705
|
+
// src/values/index.ts
|
|
716
706
|
const asWritten = (raw) => success(raw);
|
|
717
707
|
const identity = (value) => value;
|
|
718
708
|
const DECODERS = {
|
|
@@ -786,8 +776,7 @@ function encodeIcsValue(type, value) {
|
|
|
786
776
|
if (!Object.hasOwn(ENCODERS, type)) throw new TypeError(`Unknown value type ${JSON.stringify(type)}`);
|
|
787
777
|
return ENCODERS[type](value);
|
|
788
778
|
}
|
|
789
|
-
|
|
790
|
-
//#region src/model/extensions.ts
|
|
779
|
+
// src/model/extensions.ts
|
|
791
780
|
/** Declares a typed extension property, such as `X-RESOURCE-ID`, for `IcsParseOptions.extensions`. */
|
|
792
781
|
function icsExtension(name, options) {
|
|
793
782
|
return {
|
|
@@ -842,8 +831,7 @@ function readExtensions(read, entries) {
|
|
|
842
831
|
}
|
|
843
832
|
return values;
|
|
844
833
|
}
|
|
845
|
-
|
|
846
|
-
//#region src/issues.ts
|
|
834
|
+
// src/issues.ts
|
|
847
835
|
/** Thrown by a strict parser when it finds error-severity issues. */
|
|
848
836
|
var IcsParseError = class extends Error {
|
|
849
837
|
issues;
|
|
@@ -855,8 +843,7 @@ var IcsParseError = class extends Error {
|
|
|
855
843
|
this.issues = issues;
|
|
856
844
|
}
|
|
857
845
|
};
|
|
858
|
-
|
|
859
|
-
//#region src/syntax/parameters.ts
|
|
846
|
+
// src/syntax/parameters.ts
|
|
860
847
|
/** Decodes RFC 6868 caret escapes. Any other caret sequence stays as written, as §3.2 asks. */
|
|
861
848
|
function decodeParameterValue(raw) {
|
|
862
849
|
let caret = raw.indexOf("^");
|
|
@@ -883,8 +870,7 @@ function encodeParameterValue(value) {
|
|
|
883
870
|
const encoded = /[\n\r"^]/.test(value) ? value.replace(/\r\n|[\n\r"^]/g, (match) => match === "^" ? "^^" : match === "\"" ? "^'" : "^n") : value;
|
|
884
871
|
return /[,:;]/.test(encoded) ? `"${encoded}"` : encoded;
|
|
885
872
|
}
|
|
886
|
-
|
|
887
|
-
//#region src/syntax/content-line.ts
|
|
873
|
+
// src/syntax/content-line.ts
|
|
888
874
|
const COLON = 58;
|
|
889
875
|
const COMMA = 44;
|
|
890
876
|
const EQUALS = 61;
|
|
@@ -965,8 +951,7 @@ function isValueEnd(code) {
|
|
|
965
951
|
function isNameCode(code) {
|
|
966
952
|
return code >= 65 && code <= 90 || code >= 97 && code <= 122 || code >= 48 && code <= 57 || code === 45;
|
|
967
953
|
}
|
|
968
|
-
|
|
969
|
-
//#region src/syntax/lines.ts
|
|
954
|
+
// src/syntax/lines.ts
|
|
970
955
|
const SPACE = 32;
|
|
971
956
|
const TAB = 9;
|
|
972
957
|
const BOM = 65279;
|
|
@@ -1022,8 +1007,7 @@ function isBlank(content) {
|
|
|
1022
1007
|
if (first !== SPACE && first !== TAB) return false;
|
|
1023
1008
|
return content.trim() === "";
|
|
1024
1009
|
}
|
|
1025
|
-
|
|
1026
|
-
//#region src/syntax/parse.ts
|
|
1010
|
+
// src/syntax/parse.ts
|
|
1027
1011
|
function parseComponents(text) {
|
|
1028
1012
|
const roots = [];
|
|
1029
1013
|
const stack = [];
|
|
@@ -1122,8 +1106,7 @@ function parseComponents(text) {
|
|
|
1122
1106
|
issues
|
|
1123
1107
|
};
|
|
1124
1108
|
}
|
|
1125
|
-
|
|
1126
|
-
//#region src/syntax/stringify.ts
|
|
1109
|
+
// src/syntax/stringify.ts
|
|
1127
1110
|
const MAX_OCTETS = 75;
|
|
1128
1111
|
function stringifyComponents(components) {
|
|
1129
1112
|
const lines = [];
|
|
@@ -1191,8 +1174,7 @@ function foldLine(line) {
|
|
|
1191
1174
|
function isLowSurrogate(code) {
|
|
1192
1175
|
return code >= 56320 && code <= 57343;
|
|
1193
1176
|
}
|
|
1194
|
-
|
|
1195
|
-
//#region src/syntax/index.ts
|
|
1177
|
+
// src/syntax/index.ts
|
|
1196
1178
|
/** Splits iCalendar text into a lossless component tree, collecting syntax issues. */
|
|
1197
1179
|
function parseIcsComponents(text) {
|
|
1198
1180
|
return parseComponents(text);
|
|
@@ -1211,8 +1193,7 @@ function stringifyIcsComponents(components) {
|
|
|
1211
1193
|
function isComponentList(components) {
|
|
1212
1194
|
return Array.isArray(components);
|
|
1213
1195
|
}
|
|
1214
|
-
|
|
1215
|
-
//#region src/time-zones/canonical.ts
|
|
1196
|
+
// src/time-zones/canonical.ts
|
|
1216
1197
|
const CACHE_LIMIT = 1024;
|
|
1217
1198
|
const cache = /* @__PURE__ */ new Map();
|
|
1218
1199
|
/** The canonical id Temporal uses for `id`, or `undefined` when Temporal doesn't know it. */
|
|
@@ -1233,8 +1214,7 @@ function offsetTimeZoneId(sign, hours, minutes, seconds = 0) {
|
|
|
1233
1214
|
const pad = (value) => String(value).padStart(2, "0");
|
|
1234
1215
|
return canonicalTimeZoneId(`${sign === "-" ? "-" : "+"}${pad(hours)}:${pad(minutes)}`);
|
|
1235
1216
|
}
|
|
1236
|
-
|
|
1237
|
-
//#region src/time-zones/definition.ts
|
|
1217
|
+
// src/time-zones/definition.ts
|
|
1238
1218
|
const UTC_OFFSET = /^([+-])(\d{2}):?(\d{2})(?::?(\d{2}))?$/;
|
|
1239
1219
|
function propertyValue(component, name) {
|
|
1240
1220
|
return component.properties.find((property) => property.name === name)?.value.trim();
|
|
@@ -1265,8 +1245,7 @@ function definitionTimeZone(definition) {
|
|
|
1265
1245
|
const [first, ...rest] = observances(definition).map(offsetTo);
|
|
1266
1246
|
return first !== void 0 && rest.every((offset) => offset === first) ? first : void 0;
|
|
1267
1247
|
}
|
|
1268
|
-
|
|
1269
|
-
//#region src/time-zones/history.ts
|
|
1248
|
+
// src/time-zones/history.ts
|
|
1270
1249
|
const EARLIEST = -8640000000000000000000n;
|
|
1271
1250
|
const LAST_SAMPLED_YEAR = 2040;
|
|
1272
1251
|
const samples = /* @__PURE__ */ new Map();
|
|
@@ -1297,8 +1276,7 @@ function hadOffset(timeZone, offset, from) {
|
|
|
1297
1276
|
}
|
|
1298
1277
|
return offsets.has(offset);
|
|
1299
1278
|
}
|
|
1300
|
-
|
|
1301
|
-
//#region src/time-zones/windows-zones.ts
|
|
1279
|
+
// src/time-zones/windows-zones.ts
|
|
1302
1280
|
/*!
|
|
1303
1281
|
* UNICODE LICENSE V3
|
|
1304
1282
|
*
|
|
@@ -1481,8 +1459,7 @@ UTC+13|Etc/GMT-13|+1300|coordinated universal time+13
|
|
|
1481
1459
|
Tonga|Pacific/Tongatapu|+1300|nuku'alofa
|
|
1482
1460
|
Samoa|Pacific/Apia|+1300|samoa
|
|
1483
1461
|
Line Islands|Pacific/Kiritimati|+1400|kiritimati island`;
|
|
1484
|
-
|
|
1485
|
-
//#region src/time-zones/windows.ts
|
|
1462
|
+
// src/time-zones/windows.ts
|
|
1486
1463
|
const DISPLAY_NAME = /^\( ?(UTC|GMT)(?: ?([+\-−]) ?(\d{1,2})(?:[:.]?(\d{2}))?)? ?\) ?(.+)$/i;
|
|
1487
1464
|
const DISPLAY_NAME_SEPARATOR = / ?[,;/:] ?| \. /;
|
|
1488
1465
|
const UTC_NAMES_SINCE = 2009;
|
|
@@ -1531,8 +1508,7 @@ function displayNameTimeZone(tzid) {
|
|
|
1531
1508
|
const zone = others.map((place) => places.get(place)).find((candidate) => candidate?.offset === offset);
|
|
1532
1509
|
return zone === void 0 ? void 0 : canonicalTimeZoneId(zone.timeZone);
|
|
1533
1510
|
}
|
|
1534
|
-
|
|
1535
|
-
//#region src/time-zones/index.ts
|
|
1511
|
+
// src/time-zones/index.ts
|
|
1536
1512
|
const MAX_NAME_LENGTH = 256;
|
|
1537
1513
|
const OFFSET_NAME = /^(?:UTC|GMT|Z)$|^(?:UTC|GMT)?\s*([+\-−])\s*(\d{1,2})(?:[:.]?(\d{2}))?$/i;
|
|
1538
1514
|
function unquote(tzid) {
|
|
@@ -1584,8 +1560,7 @@ function createTimeZoneResolver(options = {}) {
|
|
|
1584
1560
|
return timeZone;
|
|
1585
1561
|
};
|
|
1586
1562
|
}
|
|
1587
|
-
|
|
1588
|
-
//#region src/model/reader.ts
|
|
1563
|
+
// src/model/reader.ts
|
|
1589
1564
|
const NO_PROPERTIES = [];
|
|
1590
1565
|
function defined(fields) {
|
|
1591
1566
|
const result = {};
|
|
@@ -1780,8 +1755,7 @@ var ComponentReader = class ComponentReader {
|
|
|
1780
1755
|
return items;
|
|
1781
1756
|
}
|
|
1782
1757
|
};
|
|
1783
|
-
|
|
1784
|
-
//#region src/model/fields.ts
|
|
1758
|
+
// src/model/fields.ts
|
|
1785
1759
|
const USER_PARAMETERS = [
|
|
1786
1760
|
"CN",
|
|
1787
1761
|
"DIR",
|
|
@@ -1901,8 +1875,7 @@ function geo(read) {
|
|
|
1901
1875
|
longitude
|
|
1902
1876
|
};
|
|
1903
1877
|
}
|
|
1904
|
-
|
|
1905
|
-
//#region src/model/components.ts
|
|
1878
|
+
// src/model/components.ts
|
|
1906
1879
|
const DATE_TIME_SHAPE = /^\d{8}T/i;
|
|
1907
1880
|
function schedulingFields(read, uid) {
|
|
1908
1881
|
const recurrenceIdProperty = read.one("RECURRENCE-ID", "recurrenceId");
|
|
@@ -2174,8 +2147,7 @@ function readTimeZone(read) {
|
|
|
2174
2147
|
otherProperties: read.others()
|
|
2175
2148
|
});
|
|
2176
2149
|
}
|
|
2177
|
-
|
|
2178
|
-
//#region src/model/calendar.ts
|
|
2150
|
+
// src/model/calendar.ts
|
|
2179
2151
|
function push(items, item) {
|
|
2180
2152
|
if (item !== void 0) items.push(item);
|
|
2181
2153
|
}
|
|
@@ -2290,8 +2262,7 @@ function parseCalendars(text, config) {
|
|
|
2290
2262
|
issues
|
|
2291
2263
|
};
|
|
2292
2264
|
}
|
|
2293
|
-
|
|
2294
|
-
//#region src/model/parser.ts
|
|
2265
|
+
// src/model/parser.ts
|
|
2295
2266
|
function errorsOf(issues) {
|
|
2296
2267
|
return issues.filter((issue) => issue.severity === "error");
|
|
2297
2268
|
}
|
|
@@ -2335,5 +2306,4 @@ function createIcsParser(options = {}) {
|
|
|
2335
2306
|
function parseIcs(text, options) {
|
|
2336
2307
|
return createIcsParser(options).parse(text);
|
|
2337
2308
|
}
|
|
2338
|
-
//#endregion
|
|
2339
2309
|
export { IcsParseError, createIcsParser, decodeIcsDateValue, decodeIcsValue, decodeIcsValues, encodeIcsValue, getEventEnd, icsExtension, icsValueTypeOf, parseIcs, parseIcsComponents, splitIcsValues, stringifyIcsComponents };
|
package/package.json
CHANGED
|
@@ -1,7 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moltenship/ics",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-beta.1",
|
|
4
4
|
"description": "Typed, Temporal-native iCalendar (RFC 5545) parsing with Standard Schema support.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"ical",
|
|
7
|
+
"icalendar",
|
|
8
|
+
"ics",
|
|
9
|
+
"parser",
|
|
10
|
+
"rfc5545",
|
|
11
|
+
"rrule",
|
|
12
|
+
"standard-schema",
|
|
13
|
+
"temporal",
|
|
14
|
+
"timezone",
|
|
15
|
+
"typescript",
|
|
16
|
+
"vevent"
|
|
17
|
+
],
|
|
5
18
|
"homepage": "https://time.molten.sh/docs/api/ics",
|
|
6
19
|
"bugs": {
|
|
7
20
|
"url": "https://github.com/Moltenship/time/issues"
|
|
@@ -31,12 +44,11 @@
|
|
|
31
44
|
"devDependencies": {
|
|
32
45
|
"fast-check": "^4.10.2",
|
|
33
46
|
"typescript": "^7.0.2",
|
|
34
|
-
"vite": "npm:@voidzero-dev/vite-plus-core@1.
|
|
35
|
-
"vite-plus": "1.
|
|
47
|
+
"vite": "npm:@voidzero-dev/vite-plus-core@1.4.0",
|
|
48
|
+
"vite-plus": "1.4.0"
|
|
36
49
|
},
|
|
37
50
|
"scripts": {
|
|
38
51
|
"build": "vp pack",
|
|
39
|
-
"check": "vp check",
|
|
40
52
|
"dev": "vp pack --watch",
|
|
41
53
|
"generate:windows-zones": "node scripts/generate-windows-zones.mjs",
|
|
42
54
|
"test": "vp test --passWithNoTests"
|