inferred-types 1.0.0 → 1.1.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.
- package/modules/constants/dist/index.cjs +2 -1
- package/modules/constants/dist/index.cjs.map +1 -1
- package/modules/constants/dist/index.d.cts +1 -1
- package/modules/constants/dist/index.d.cts.map +1 -1
- package/modules/constants/dist/index.d.ts +1 -1
- package/modules/constants/dist/index.d.ts.map +1 -1
- package/modules/constants/dist/index.js +2 -1
- package/modules/constants/dist/index.js.map +1 -1
- package/modules/runtime/dist/index.cjs +49 -41
- package/modules/runtime/dist/index.cjs.map +1 -1
- package/modules/runtime/dist/index.d.cts +8 -29
- package/modules/runtime/dist/index.d.cts.map +1 -1
- package/modules/runtime/dist/index.d.ts +8 -29
- package/modules/runtime/dist/index.d.ts.map +1 -1
- package/modules/runtime/dist/index.js +50 -41
- package/modules/runtime/dist/index.js.map +1 -1
- package/modules/types/dist/{index.mjs → index.cjs} +17 -2
- package/modules/types/dist/{index.mjs.map → index.cjs.map} +1 -1
- package/modules/types/dist/{index.d.mts → index.d.cts} +13030 -12992
- package/modules/types/dist/index.d.cts.map +1 -0
- package/modules/types/dist/index.d.ts +13029 -12991
- package/modules/types/dist/index.d.ts.map +1 -1
- package/modules/types/dist/index.js +1 -16
- package/modules/types/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/modules/types/dist/index.d.mts.map +0 -1
|
@@ -233,7 +233,8 @@ const COMPARISON_OPERATIONS = [
|
|
|
233
233
|
"false",
|
|
234
234
|
"returnEquals",
|
|
235
235
|
"returnExtends",
|
|
236
|
-
"isTemplateLiteral"
|
|
236
|
+
"isTemplateLiteral",
|
|
237
|
+
"hasLength"
|
|
237
238
|
];
|
|
238
239
|
|
|
239
240
|
//#endregion
|
|
@@ -7169,7 +7170,7 @@ function isDateLike(val) {
|
|
|
7169
7170
|
* type guard which validates that `val` is the type `DateMeta`.
|
|
7170
7171
|
*/
|
|
7171
7172
|
function isDateMeta(val) {
|
|
7172
|
-
return isDictionary(val) && "dateType" in val && DATE_TYPE.includes(val);
|
|
7173
|
+
return isDictionary(val) && "dateType" in val && DATE_TYPE.includes(val.dateType);
|
|
7173
7174
|
}
|
|
7174
7175
|
|
|
7175
7176
|
//#endregion
|
|
@@ -8272,28 +8273,6 @@ function createCssSelector(_opt) {
|
|
|
8272
8273
|
};
|
|
8273
8274
|
}
|
|
8274
8275
|
|
|
8275
|
-
//#endregion
|
|
8276
|
-
//#region src/functions/fnMeta.ts
|
|
8277
|
-
/**
|
|
8278
|
-
* **fnMeta**(func)
|
|
8279
|
-
*
|
|
8280
|
-
* Runtime utility which provides a `fn` and `props` property which are
|
|
8281
|
-
* decomposed from the input function.
|
|
8282
|
-
*
|
|
8283
|
-
* - the `fn` is a clone of the underlying function
|
|
8284
|
-
*/
|
|
8285
|
-
function fnMeta(func) {
|
|
8286
|
-
const fn$1 = (...args) => func(...args);
|
|
8287
|
-
const props = Object.keys(fn$1).reduce((acc, key) => ({
|
|
8288
|
-
...acc,
|
|
8289
|
-
[key]: fn$1[key]
|
|
8290
|
-
}), {});
|
|
8291
|
-
return {
|
|
8292
|
-
fn: fn$1,
|
|
8293
|
-
props
|
|
8294
|
-
};
|
|
8295
|
-
}
|
|
8296
|
-
|
|
8297
8276
|
//#endregion
|
|
8298
8277
|
//#region src/functions/fnProps.ts
|
|
8299
8278
|
/**
|
|
@@ -8715,6 +8694,10 @@ function handle_other(val, op, params) {
|
|
|
8715
8694
|
if (!(val instanceof Error)) return false;
|
|
8716
8695
|
if (!params[0]) return err(`invalid-params/errorsOfType`, `The 'errorsOfType' operation requires a type parameter`, { params });
|
|
8717
8696
|
return "type" in val && val.type === params[0];
|
|
8697
|
+
case "hasLength": if (isString(val)) return isNarrowableArray(params) && contains(params, val.length);
|
|
8698
|
+
else if (isNumber(val)) return isNarrowableArray(params) && contains(params, `${val}`.length);
|
|
8699
|
+
else if (isArray(val)) return isNarrowableArray(params) && contains(params, val.length);
|
|
8700
|
+
else return false;
|
|
8718
8701
|
case "returnEquals":
|
|
8719
8702
|
if (!isFunction(val)) return false;
|
|
8720
8703
|
return err(`compare/runtime`, `The comparison type "returnEquals" can not be evaluated in the runtime system!`);
|
|
@@ -13000,30 +12983,47 @@ function offsetMinutesToString(mins) {
|
|
|
13000
12983
|
*/
|
|
13001
12984
|
function asDateTime(input) {
|
|
13002
12985
|
if (isMoment(input)) {
|
|
13003
|
-
const
|
|
13004
|
-
const
|
|
12986
|
+
const parsed = input.parseZone();
|
|
12987
|
+
const d = new Date(parsed.toISOString());
|
|
12988
|
+
const offsetMins = parsed.utcOffset();
|
|
12989
|
+
const tz = isTimezoneOffset(offsetMinutesToString(offsetMins)) ? offsetMinutesToString(offsetMins) : null;
|
|
13005
12990
|
d.offset = tz;
|
|
13006
12991
|
d.tz = isIanaTimezone(input._z?.name) ? input._z.name : null;
|
|
13007
12992
|
d.source = "moment";
|
|
13008
|
-
const sourceIso =
|
|
12993
|
+
const sourceIso = parsed.toISOString(true);
|
|
13009
12994
|
d.sourceIso = sourceIso.endsWith("+00:00") ? sourceIso.replace("+00:00", "Z") : sourceIso;
|
|
13010
12995
|
return d;
|
|
13011
12996
|
}
|
|
13012
12997
|
if (isLuxonDate(input)) {
|
|
13013
12998
|
const d = input.toJSDate();
|
|
13014
|
-
d.offset =
|
|
12999
|
+
d.offset = offsetMinutesToString(input.offset);
|
|
13015
13000
|
d.tz = isIanaTimezone(input.zoneName) ? input.zoneName : null;
|
|
13016
13001
|
d.source = "luxon";
|
|
13017
|
-
d.sourceIso = input.
|
|
13002
|
+
d.sourceIso = input.toISO();
|
|
13018
13003
|
return d;
|
|
13019
13004
|
}
|
|
13020
13005
|
if (isTemporalDate(input)) {
|
|
13021
|
-
|
|
13022
|
-
|
|
13023
|
-
|
|
13024
|
-
|
|
13006
|
+
let d;
|
|
13007
|
+
if ("epochNanoseconds" in input) {
|
|
13008
|
+
const zdt = input.toZonedDateTimeISO(getLocalIanaZone());
|
|
13009
|
+
d = new Date(zdt.epochMilliseconds);
|
|
13010
|
+
d.offset = isTimezoneOffset(zdt.offset) ? zdt.offset : null;
|
|
13011
|
+
d.tz = zdt.timeZone && isIanaTimezone(zdt.timeZone.id) ? zdt.timeZone.id : null;
|
|
13012
|
+
d.sourceIso = zdt.toString();
|
|
13013
|
+
} else if ("timeZone" in input) {
|
|
13014
|
+
const zdt = input;
|
|
13015
|
+
d = new Date(zdt.epochMilliseconds);
|
|
13016
|
+
d.offset = isTimezoneOffset(zdt.offset) ? zdt.offset : null;
|
|
13017
|
+
d.tz = zdt.timeZone && isIanaTimezone(zdt.timeZone.id) ? zdt.timeZone.id : null;
|
|
13018
|
+
d.sourceIso = zdt.toString();
|
|
13019
|
+
} else {
|
|
13020
|
+
const instant = input.toZonedDateTime("UTC").toInstant();
|
|
13021
|
+
d = new Date(instant.epochMilliseconds);
|
|
13022
|
+
d.offset = null;
|
|
13023
|
+
d.tz = null;
|
|
13024
|
+
d.sourceIso = null;
|
|
13025
|
+
}
|
|
13025
13026
|
d.source = "temporal";
|
|
13026
|
-
d.sourceIso = zdt.toString();
|
|
13027
13027
|
return d;
|
|
13028
13028
|
}
|
|
13029
13029
|
if (isDayJs(input)) {
|
|
@@ -13673,17 +13673,26 @@ function parseDate(d) {
|
|
|
13673
13673
|
*/
|
|
13674
13674
|
function parseDateObject(d) {
|
|
13675
13675
|
const date = d instanceof Date ? d : asDateTime(d);
|
|
13676
|
+
if (isError(date)) return date;
|
|
13676
13677
|
const utcIso = date.toISOString();
|
|
13677
13678
|
const utcParsed = parseIsoDate(utcIso);
|
|
13678
|
-
if (isError(utcParsed))
|
|
13679
|
-
const
|
|
13679
|
+
if (isError(utcParsed)) return utcParsed;
|
|
13680
|
+
const datePlus = date;
|
|
13681
|
+
const sourceIso = datePlus.sourceIso;
|
|
13680
13682
|
if (sourceIso) {
|
|
13681
13683
|
const sourceParsed = parseIsoDate(sourceIso);
|
|
13682
|
-
if (
|
|
13683
|
-
|
|
13684
|
-
|
|
13685
|
-
|
|
13684
|
+
if (isDateMeta(sourceParsed) && sourceParsed.timezone) {
|
|
13685
|
+
const timezone = sourceParsed.timezone === "+00:00" ? "Z" : sourceParsed.timezone;
|
|
13686
|
+
return {
|
|
13687
|
+
...utcParsed,
|
|
13688
|
+
timezone
|
|
13689
|
+
};
|
|
13690
|
+
}
|
|
13686
13691
|
}
|
|
13692
|
+
if (datePlus.offset === null && datePlus.source) return {
|
|
13693
|
+
...utcParsed,
|
|
13694
|
+
timezone: null
|
|
13695
|
+
};
|
|
13687
13696
|
return utcParsed;
|
|
13688
13697
|
}
|
|
13689
13698
|
|
|
@@ -16196,5 +16205,5 @@ function asVueRef(value) {
|
|
|
16196
16205
|
}
|
|
16197
16206
|
|
|
16198
16207
|
//#endregion
|
|
16199
|
-
export { NO_MATCH, ShapeApiImplementation, abs, add, addFnToProps, addPropsToFn, addToken, afterFirst, and, append, array, asArray, asChars, asDate, asDateTime, asEpochTimestamp, asFourDigitYear, asFromTo, asInputToken, asIsoDate, asIsoDateTime, asNumber, asOutputFunction, asPhoneFormat, asRecord, asString, asTakeState, asTemplate, asTwoDigitMonth, asType, asTypeSubtype, asTypedError, asUnion, asVueRef, between, boolean, brand, capitalize, cardType, choices, compare, contains, createConstant, createConverter, createCssKeyframe, createCssSelector, createErrorCondition, createFifoQueue, createFixedLengthArray, createFnWithProps, createGrammar, createLifoQueue, createNestingConfig, createStaticTakeFunction, createTakeFunction, createTakeStartEndFunction, createTakeWhileFunction, createTemplateRegExp, createToken, createTokenSyntax, cssColor, cssFromDefinition, csv, dateObjectToIso, daysInMonth, decrement, defineCss, defineObj, defineObject, defineObjectWith, defineTuple, doesExtend, dropFirstStackFrame, eachAsString, endsWith, endsWithTypeguard, ensureLeading, ensureSurround, ensureTrailing, entries, equalsSome, err, errCondition, every, filter, filterEmpty, filterUndefined, find, firstChar, fn,
|
|
16208
|
+
export { NO_MATCH, ShapeApiImplementation, abs, add, addFnToProps, addPropsToFn, addToken, afterFirst, and, append, array, asArray, asChars, asDate, asDateTime, asEpochTimestamp, asFourDigitYear, asFromTo, asInputToken, asIsoDate, asIsoDateTime, asNumber, asOutputFunction, asPhoneFormat, asRecord, asString, asTakeState, asTemplate, asTwoDigitMonth, asType, asTypeSubtype, asTypedError, asUnion, asVueRef, between, boolean, brand, capitalize, cardType, choices, compare, contains, createConstant, createConverter, createCssKeyframe, createCssSelector, createErrorCondition, createFifoQueue, createFixedLengthArray, createFnWithProps, createGrammar, createLifoQueue, createNestingConfig, createStaticTakeFunction, createTakeFunction, createTakeStartEndFunction, createTakeWhileFunction, createTemplateRegExp, createToken, createTokenSyntax, cssColor, cssFromDefinition, csv, dateObjectToIso, daysInMonth, decrement, defineCss, defineObj, defineObject, defineObjectWith, defineTuple, doesExtend, dropFirstStackFrame, eachAsString, endsWith, endsWithTypeguard, ensureLeading, ensureSurround, ensureTrailing, entries, equalsSome, err, errCondition, every, filter, filterEmpty, filterUndefined, find, firstChar, fn, fnProps, fourDigitYear, freeze, fromDefineObject, fromDefineTuple, fromInputToken, fromKeyValue, get, getDaysBetween, getEach, getMonthAbbrev, getMonthName, getMonthNumber, getPhoneCountryCode, getSeason, getTailwindModifiers, getToday, getTokenData, getTokenKind, getTomorrow, getTypeSubtype, getUrlBase, getUrlDefaultPort, getUrlDynamics, getUrlPath, getUrlPort, getUrlProtocol, getUrlQueryParams, getUrlSource, getWeekNumber, getYear, getYesterday, getYouTubePageType, handleDoneFn, hasCountryCode, hasDefaultValue, hasHtml, hasIndexOf, hasKeys, hasNonStringKeys, hasOnlyStringKeys, hasOnlyStringValues, hasOnlySymbolKeys, hasOverlappingKeys, hasProtocol, hasProtocolPrefix, hasSymbolKeys, hasUrlPort, hasUrlQueryParameter, hasValidHtml, hasWhiteSpace, idLiteral, idTypeGuard, identity, ifArray, ifArrayPartial, ifBoolean, ifChar, ifContainer, ifDefined, ifEmpty, ifEqual, ifError, ifFalse, ifFunction, ifHasKey, ifLength, ifLowercaseChar, ifNotNull, ifNull, ifNumber, ifObject, ifSameType, ifScalar, ifString, ifTrue, ifUndefined, ifUppercaseChar, increment, indexOf, infer, integer, intersect, intersection, ip6GroupExpansion, isAccelerationMetric, isAccelerationUom, isAfter, isAlpha, isAmazonUrl, isAmericanExpress, isApi, isApiSurface, isAppleUrl, isAreaMetric, isAreaUom, isArray, isAustralianNewsUrl, isBefore, isBelgiumNewsUrl, isBestBuyUrl, isBitbucketUrl, isBoolean, isBooleanArray, isBooleanLike, isCanadianNewsUrl, isChineseNewsUrl, isCodeCommitUrl, isComparisonOperation, isConstant, isContainer, isCostCoUrl, isCountryAbbrev, isCountryCode2, isCountryCode3, isCountryName, isCreditCard, isCssAspectRatio, isCsv, isCurrentMetric, isCurrentUom, isCvsUrl, isDanishNewsUrl, isDate, isDateLike, isDateMeta, isDayJs, isDefineObject, isDefineTuple, isDefined, isDellUrl, isDeltaReturn, isDictionary, isDistanceMetric, isDistanceUom, isDomainName, isDoneFn, isDoubleLeap, isDutchNewsUrl, isEbayUrl, isEmail, isEmpty, isEnergyMetric, isEnergyUom, isEpochInMilliseconds, isEpochInSeconds, isEqual, isErr, isError, isEscapeFunction, isEtsyUrl, isEven, isFalse, isFalsy, isFnWithParams, isFourDigitYear, isFrenchNewsUrl, isFrequencyMetric, isFrequencyUom, isFunction, isGermanNewsUrl, isGithubIssueUrl, isGithubIssuesListUrl, isGithubOrgUrl, isGithubProjectUrl, isGithubProjectsListUrl, isGithubReleaseTagUrl, isGithubReleasesListUrl, isGithubRepoReleaseTagUrl, isGithubRepoReleasesUrl, isGithubRepoUrl, isGithubUrl, isGreaterThan, isGreaterThanOrEqual, isHexadecimal, isHmUrl, isHomeDepotUrl, isHtml, isHtmlComponentTag, isHtmlElement, isIanaTimezone, isIkeaUrl, isInUnion, isIndexable, isIndianNewsUrl, isInlineSvg, isInputToken, isInputToken__String, isInteger, isIp4Address, isIp6Address, isIp6Subnet, isIpAddress, isIso3166Alpha2, isIso3166Alpha3, isIso3166CountryCode, isIso3166CountryName, isIsoDate, isIsoDateTime, isIsoExplicitDate, isIsoExplicitTime, isIsoImplicitDate, isIsoImplicitTime, isIsoMonthDate, isIsoTime, isIsoYear, isIsoYearMonth, isItalianNewsUrl, isJapaneseNewsUrl, isKrogersUrl, isLeapYear, isLength, isLikeRegExp, isLowesUrl, isLuminosityMetric, isLuminosityUom, isLuxonDate, isMacysUrl, isMap, isMassMetric, isMassUom, isMastercard, isMetric, isMetricCategory, isMexicanNewsUrl, isMinimalDigitDate, isMoment, isMonthAbbrev, isMonthName, isNarrowable, isNarrowableArray, isNarrowableDictionary, isNegativeNumber, isNestingEnd, isNestingEndMatch, isNestingKeyValue, isNestingStart, isNestingTuple, isNever, isNewsUrl, isNikeUrl, isNorwegianNewsUrl, isNotEmpty, isNotError, isNotNull, isNotUnset, isNothing, isNull, isNumber, isNumberLike, isNumericArray, isNumericString, isObject, isObjectKey, isObjectKeyRequiringQuotes, isOdd, isOk, isOptionalParamFunction, isParsedDate, isPhoneNumber, isPowerMetric, isPowerUom, isPressureMetric, isPressureUom, isProtocol, isProtocolPrefix, isReadonlyArray, isRef, isRegExp, isRepoSource, isRepoUrl, isResistanceMetric, isResistanceUom, isRetailUrl, isSameDay, isSameMonth, isSameMonthYear, isSameTypeOf, isSameYear, isScalar, isSemanticVersion, isSet, isSetContainer, isShape, isShapeCallback, isSimpleContainerToken, isSimpleContainerTokenTuple, isSimpleScalarToken, isSimpleScalarTokenTuple, isSimpleToken, isSimpleTokenTuple, isSocialMediaProfileUrl, isSocialMediaUrl, isSouthKoreanNewsUrl, isSpanishNewsUrl, isSpecificConstant, isSpeedMetric, isSpeedUom, isStaticTemplate, isString, isStringArray, isStringLiteral, isStringOrNumericArray, isSwissNewsUrl, isSymbol, isTailwindColor, isTailwindColorClass, isTailwindColorName, isTailwindColorTarget, isTailwindColorWithLuminosity, isTailwindColorWithLuminosityAndOpacity, isTailwindModifier, isTakeState, isTargetUrl, isTemperatureMetric, isTemperatureUom, isTemporalDate, isThenable, isThisMonth, isThisWeek, isThisYear, isThreeDigitMillisecond, isTimeMetric, isTimeUom, isTimezoneOffset, isToday, isTomorrow, isTrimable, isTrue, isTruthy, isTuple, isTurkishNewsUrl, isTwoDigitDate, isTwoDigitHour, isTwoDigitMinute, isTwoDigitMonth, isTwoDigitSecond, isTypeOf, isTypeSubtype, isTypeTuple, isTypedError, isUkNewsUrl, isUndefined, isUnset, isUom, isUomCategory, isUri, isUrl, isUrlPath, isUrlSource, isUsNewsUrl, isUsPhoneNumber, isUsStateAbbreviation, isUsStateName, isValidAtomicTag, isValidBlockTag, isValidComparisonParams, isValidHtml, isValidHtmlTag, isVariable, isVisa, isVisaMastercard, isVoltageMetric, isVoltageUom, isVolumeMetric, isVolumeUom, isWalgreensUrl, isWalmartUrl, isWayfairUrl, isWeakMap, isWholeFoodsUrl, isYesterday, isYouTubeCreatorUrl, isYouTubeFeedHistoryUrl, isYouTubeFeedUrl, isYouTubePlaylistUrl, isYouTubePlaylistsUrl, isYouTubeShareUrl, isYouTubeSubscriptionsUrl, isYouTubeTrendingUrl, isYouTubeUrl, isYouTubeVideoUrl, isYouTubeVideosInPlaylist, isZaraUrl, isZipCode, isZipCode5, isZipPlus4, joinWith, keysOf, keysWithError, kindLiteral, last, lastChar, lessThan, lessThanOrEqual, literal, logicalReturns, lookupCountryAlpha2, lookupCountryAlpha3, lookupCountryCode, lookupCountryName, lowercase, map, maybePhoneNumber, mergeObjects, mergeScalars, mergeTuples, mutable, nameLiteral, narrow, nbsp, nestedSplit, nesting, not, nullType, objectValues, omitKeys, optional, optionalOrNull, or, orNull, parseDate, parseDateObject, parseIsoDate, parseNumericDate, pathJoin, pluralize, pop, record, regexToken, removePhoneCountryCode, removeTailwindModifiers, removeUrlProtocol, replace, replaceAll, replaceAllFromTo, result, retainAfter, retainAfterInclusive, retainChars, retainKeys, retainUntil, retainUntilInclusive, retainUntil__Nested, retainWhile, reverse, reverseLookup, rightWhitespace, setupSafeStringEncoding, shape, sharedKeys, shift, simpleContainerToken, simpleContainerType, simpleScalarToken, simpleScalarType, simpleToken, simpleType, slice, sortByKey, split, startsWith, startsWithTypeguard, stripAfter, stripAfterLast, stripBefore, stripChars, stripLeading, stripParenthesis, stripSurround, stripTrailing, stripUntil, stripWhile, surround, take, takeNumericCharacters, takeStart, takeStringToken, threeDigitMillisecond, toAllCaps, toCamelCase, toInteger, toIsoDateString, toJSON, toKebabCase, toKeyValue, toLowercase, toNumber, toNumericArray, toPascalCase, toSnakeCase, toString, toStringLiteral, toStringLiteral__Tuple, toStringToken, trim, trimEnd, trimStart, truncate, tuple, twColor, twoDigitHour, twoDigitMinute, twoDigitSecond, typedError, unbrand, uncapitalize, undefinedType, unionize, unique, uniqueKeys, unknown, unset, urlMeta, usingLookup, validHtmlAttributes, valuesOf, weakMap, widen, withDefaults, withKeys, withValue, withoutKeys, withoutValue, youtubeEmbed, youtubeMeta };
|
|
16200
16209
|
//# sourceMappingURL=index.js.map
|