Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@mos-connection/model

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mos-connection/model - npm Package Compare versions

Comparing version 3.0.7 to 4.0.0

46

CHANGELOG.md

@@ -6,21 +6,19 @@ # Change Log

## [3.0.7](https://github.com/nrkno/sofie-mos-connection/compare/v3.0.6...v3.0.7) (2023-12-27)
# [4.0.0](https://github.com/nrkno/sofie-mos-connection/compare/v3.0.7...v4.0.0) (2024-02-02)
**Note:** Version bump only for package @mos-connection/model
### Bug Fixes
- change how data fields is parsed, better handling of missing data. ([bf4a084](https://github.com/nrkno/sofie-mos-connection/commit/bf4a0845a7f836015aa452db45c023debef94480))
- revert mosTime support of empty string. ([cfc036f](https://github.com/nrkno/sofie-mos-connection/commit/cfc036f5c2604ae193bc2d683e02ad2a9d6bb477))
## [3.0.7](https://github.com/nrkno/sofie-mos-connection/compare/v3.0.6...v3.0.7) (2023-12-27)
**Note:** Version bump only for package @mos-connection/model
## [3.0.5](https://github.com/nrkno/sofie-mos-connection/compare/v3.0.4...3.0.5) (2023-12-18)
### Bug Fixes
* Handle empty MOS time string ([85fbc88](https://github.com/nrkno/sofie-mos-connection/commit/85fbc886d7b577db07bece23efc53f6058a92a43))
- Handle empty MOS time string ([85fbc88](https://github.com/nrkno/sofie-mos-connection/commit/85fbc886d7b577db07bece23efc53f6058a92a43))
## [3.0.4](https://github.com/nrkno/sofie-mos-connection/compare/v3.0.1...v3.0.4) (2023-06-09)

@@ -30,6 +28,2 @@

## [3.0.2](https://github.com/nrkno/sofie-mos-connection/compare/v3.0.1...v3.0.2) (2023-03-27)

@@ -39,6 +33,2 @@

# [3.0.0](https://github.com/nrkno/sofie-mos-connection/compare/v3.0.0-alpha.3...v3.0.0) (2023-02-03)

@@ -48,6 +38,2 @@

# [3.0.0-alpha.3](https://github.com/nrkno/sofie-mos-connection/compare/v3.0.0-alpha.2...v3.0.0-alpha.3) (2023-01-27)

@@ -57,28 +43,14 @@

# [3.0.0-alpha.2](https://github.com/nrkno/sofie-mos-connection/compare/v3.0.0-alpha.0...v3.0.0-alpha.2) (2023-01-27)
### Bug Fixes
* add stringifyMosObject, an utility-function used to convert objects containing IMOSString128 etc to strings ([f3806ab](https://github.com/nrkno/sofie-mos-connection/commit/f3806ab4e72a02b450e91ab19fbbfca34c605caa))
- add stringifyMosObject, an utility-function used to convert objects containing IMOSString128 etc to strings ([f3806ab](https://github.com/nrkno/sofie-mos-connection/commit/f3806ab4e72a02b450e91ab19fbbfca34c605caa))
# [3.0.0-alpha.1](https://github.com/nrkno/sofie-mos-connection/compare/v3.0.0-alpha.0...3.0.0-alpha.1) (2023-01-27)
### Bug Fixes
* add stringifyMosObject, an utility-function used to convert objects containing IMOSString128 etc to strings ([f3806ab](https://github.com/nrkno/sofie-mos-connection/commit/f3806ab4e72a02b450e91ab19fbbfca34c605caa))
- add stringifyMosObject, an utility-function used to convert objects containing IMOSString128 etc to strings ([f3806ab](https://github.com/nrkno/sofie-mos-connection/commit/f3806ab4e72a02b450e91ab19fbbfca34c605caa))
# [v3.0.0-alpha.0](https://github.com/nrkno/sofie-mos-connection/compare/2.0.1...v3.0.0-alpha.0) (2022-12-09)

@@ -85,0 +57,0 @@

10

dist/mosTypes.d.ts

@@ -32,3 +32,3 @@ import * as MosString128 from './mosTypes/mosString128';

};
interface MosType<Serialized, Value, CreateValue> {
export interface MosType<Serialized, Value, CreateValue> {
/** Creates a MosType using provided data. The MosType is then used in data sent into MOS-connection */

@@ -39,7 +39,9 @@ create: (anyValue: CreateValue) => Serialized;

/** Returns the value of the MosType */
valueOf(value: Serialized): Value;
valueOf: (value: Serialized) => Value;
/** Returns a stringified representation of the MosType */
stringify(value: Serialized): string;
stringify: (value: Serialized) => string;
/** Returns true if the provided data is of this MosType */
is(value: Serialized | any): value is Serialized;
is: (value: Serialized | any) => value is Serialized;
/** Returns a fallback value, used to replace missing or non-parsable data in non-strict mode */
fallback: () => Serialized;
}

@@ -46,0 +48,0 @@ export interface IMOSExternalMetaData {

@@ -45,2 +45,3 @@ "use strict";

is: (value) => mosType.is(value),
fallback: () => mosType.fallback(),
};

@@ -47,0 +48,0 @@ }

@@ -7,3 +7,3 @@ export interface IMOSDuration {

export declare function create(anyValue: AnyValue, strict: boolean): IMOSDuration;
export type AnyValue = string | number;
export type AnyValue = string | number | any;
export declare function validate(_mosDuration: IMOSDuration, _strict: boolean): void;

@@ -13,2 +13,3 @@ export declare function valueOf(mosDuration: IMOSDuration): number;

export declare function is(mosDuration: IMOSDuration | any): mosDuration is IMOSDuration;
export declare function fallback(): IMOSDuration;
//# sourceMappingURL=mosDuration.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.is = exports.stringify = exports.valueOf = exports.validate = exports.create = void 0;
exports.fallback = exports.is = exports.stringify = exports.valueOf = exports.validate = exports.create = void 0;
const lib_1 = require("./lib");

@@ -59,2 +59,8 @@ function create(anyValue, strict) {

exports.is = is;
function fallback() {
const mosDuration = { _mosDuration: 0 };
validate(mosDuration, true);
return mosDuration;
}
exports.fallback = fallback;
//# sourceMappingURL=mosDuration.js.map

@@ -15,2 +15,3 @@ export interface IMOSString128 {

export declare function is(mosString128: IMOSString128 | any): mosString128 is IMOSString128;
export declare function fallback(): IMOSString128;
//# sourceMappingURL=mosString128.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.is = exports.stringify = exports.valueOf = exports.validate = exports.create = void 0;
exports.fallback = exports.is = exports.stringify = exports.valueOf = exports.validate = exports.create = void 0;
function create(anyValue, strict) {

@@ -21,2 +21,5 @@ let strValue;

}
else if (anyValue === undefined) {
strValue = '';
}
else {

@@ -59,2 +62,8 @@ strValue = anyValue !== `undefined` ? String(anyValue) : '';

exports.is = is;
function fallback() {
const mosString = { _mosString128: '' };
validate(mosString, true);
return mosString;
}
exports.fallback = fallback;
//# sourceMappingURL=mosString128.js.map

@@ -14,2 +14,3 @@ export interface IMOSTime {

export declare function is(mosTime: IMOSTime | any): mosTime is IMOSTime;
export declare function fallback(): IMOSTime;
//# sourceMappingURL=mosTime.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.is = exports.stringify = exports.valueOf = exports.validate = exports.create = void 0;
exports.fallback = exports.is = exports.stringify = exports.valueOf = exports.validate = exports.create = void 0;
const lib_1 = require("./lib");

@@ -16,33 +16,27 @@ function create(timestamp, strict) {

else if (typeof timestamp === 'string') {
if (timestamp.trim()) {
// formats:
// YYYY-MM-DD'T'hh:mm:ss[,ddd]['Z']
// Sun Feb 25 2018 08:59:08 GMT+0100 (CET)
// 2018-02-25T08:00:45.528Z
let _timezoneZuluIndicator = '';
let _timezoneDeclaration = '';
// parse out custom Z indicator (mos-centric)
const customFormatParseResult = parseMosCustomFormat(timestamp);
// parse out custom timezones (mos local-local centric format)
const timezoneParseResult = parseTimeOffset(timestamp);
if (customFormatParseResult !== false) {
_timezone = customFormatParseResult.timezoneIndicator;
_timezoneOffset = customFormatParseResult.timezoneOffset;
_timezoneZuluIndicator = customFormatParseResult.timezoneIndicator;
const r = customFormatParseResult;
const dateStr = `${r.yy}-${r.mm}-${r.dd}T${r.hh}:${r.ii}:${r.ss}${r.ms ? '.' + r.ms : ''}${_timezoneZuluIndicator}${_timezoneDeclaration}`;
time = new Date(dateStr);
}
else if (timezoneParseResult !== false) {
_timezoneDeclaration = timezoneParseResult.timezoneDeclaration;
time = new Date(timestamp);
}
else {
// try to parse the time directly with Date, for Date-supported formats
time = new Date(timestamp);
}
// formats:
// YYYY-MM-DD'T'hh:mm:ss[,ddd]['Z']
// Sun Feb 25 2018 08:59:08 GMT+0100 (CET)
// 2018-02-25T08:00:45.528Z
let _timezoneZuluIndicator = '';
let _timezoneDeclaration = '';
// parse out custom Z indicator (mos-centric)
const customFormatParseResult = parseMosCustomFormat(timestamp);
// parse out custom timezones (mos local-local centric format)
const timezoneParseResult = parseTimeOffset(timestamp);
if (customFormatParseResult !== false) {
_timezone = customFormatParseResult.timezoneIndicator;
_timezoneOffset = customFormatParseResult.timezoneOffset;
_timezoneZuluIndicator = customFormatParseResult.timezoneIndicator;
const r = customFormatParseResult;
const dateStr = `${r.yy}-${r.mm}-${r.dd}T${r.hh}:${r.ii}:${r.ss}${r.ms ? '.' + r.ms : ''}${_timezoneZuluIndicator}${_timezoneDeclaration}`;
time = new Date(dateStr);
}
else if (timezoneParseResult !== false) {
_timezoneDeclaration = timezoneParseResult.timezoneDeclaration;
time = new Date(timestamp);
}
else {
// empty string, create Date now:
time = new Date();
// try to parse the time directly with Date, for Date-supported formats
time = new Date(timestamp);
}

@@ -66,4 +60,3 @@ }

else {
// no timestamp, create Date now:
time = new Date();
throw new Error(`MosTime: Invalid input: "${timestamp}"`);
}

@@ -121,2 +114,12 @@ if (isNaN(time.getTime())) {

exports.is = is;
function fallback() {
const iMosTime = {
_mosTime: 0,
_timezone: '',
_timezoneOffset: 0,
};
validate(iMosTime, true);
return iMosTime;
}
exports.fallback = fallback;
function parseTimeOffset(timestamp) {

@@ -123,0 +126,0 @@ let timeOffsetValue;

{
"name": "@mos-connection/model",
"version": "3.0.7",
"version": "4.0.0",
"description": "Types and enums for the mos-connection library",

@@ -44,3 +44,3 @@ "main": "dist/index.js",

},
"gitHead": "8591c990d4adc8c85bdf29440804073023e7015b"
"gitHead": "b9a544a88d1eae13a0f220b282d61e5d9859f5da"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc