@matter/general
Advanced tools
Comparing version 0.12.0-alpha.0-20250108-7ae2a767d to 0.12.0-alpha.0-20250110-6349da2f0
@@ -13,7 +13,7 @@ /** | ||
export declare const MAX_MDNS_MESSAGE_SIZE = 1232; | ||
export declare const PtrRecord: (name: string, ptr: string, ttl?: number, flushCache?: boolean) => DnsRecord<string>; | ||
export declare const PtrRecord: (name: string, ptr: string, forInstance?: string, ttl?: number, flushCache?: boolean) => DnsRecord<string>; | ||
export declare const ARecord: (name: string, ip: string, ttl?: number, flushCache?: boolean) => DnsRecord<string>; | ||
export declare const AAAARecord: (name: string, ip: string, ttl?: number, flushCache?: boolean) => DnsRecord<string>; | ||
export declare const TxtRecord: (name: string, entries: string[], ttl?: number, flushCache?: boolean) => DnsRecord<string[]>; | ||
export declare const SrvRecord: (name: string, srv: SrvRecordValue, ttl?: number, flushCache?: boolean) => DnsRecord<SrvRecordValue>; | ||
export declare const TxtRecord: (name: string, entries: string[], forInstance?: string, ttl?: number, flushCache?: boolean) => DnsRecord<string[]>; | ||
export declare const SrvRecord: (name: string, srv: SrvRecordValue, forInstance?: string, ttl?: number, flushCache?: boolean) => DnsRecord<SrvRecordValue>; | ||
export type SrvRecordValue = { | ||
@@ -38,2 +38,3 @@ priority: number; | ||
value: T; | ||
forInstance?: string; | ||
}; | ||
@@ -40,0 +41,0 @@ export type DnsMessage = { |
@@ -44,3 +44,3 @@ "use strict"; | ||
const MAX_MDNS_MESSAGE_SIZE = 1232; | ||
const PtrRecord = (name, ptr, ttl = 120, flushCache = false) => ({ | ||
const PtrRecord = (name, ptr, forInstance, ttl = 120, flushCache = false) => ({ | ||
name, | ||
@@ -51,3 +51,4 @@ value: ptr, | ||
recordClass: 1 /* IN */, | ||
flushCache | ||
flushCache, | ||
forInstance | ||
}); | ||
@@ -70,3 +71,3 @@ const ARecord = (name, ip, ttl = 120, flushCache = false) => ({ | ||
}); | ||
const TxtRecord = (name, entries, ttl = 120, flushCache = false) => ({ | ||
const TxtRecord = (name, entries, forInstance, ttl = 120, flushCache = false) => ({ | ||
name, | ||
@@ -77,5 +78,6 @@ value: entries, | ||
recordClass: 1 /* IN */, | ||
flushCache | ||
flushCache, | ||
forInstance | ||
}); | ||
const SrvRecord = (name, srv, ttl = 120, flushCache = false) => ({ | ||
const SrvRecord = (name, srv, forInstance, ttl = 120, flushCache = false) => ({ | ||
name, | ||
@@ -86,3 +88,4 @@ value: srv, | ||
recordClass: 1 /* IN */, | ||
flushCache | ||
flushCache, | ||
forInstance | ||
}); | ||
@@ -89,0 +92,0 @@ var DnsMessageType = /* @__PURE__ */ ((DnsMessageType2) => { |
@@ -6,3 +6,3 @@ /** | ||
*/ | ||
export declare function isDeepEqual(a: any, b: any): boolean; | ||
export declare function isDeepEqual(a: any, b: any, ignoreUndefinedProperties?: boolean): boolean; | ||
//# sourceMappingURL=DeepEqual.d.ts.map |
@@ -29,3 +29,3 @@ "use strict"; | ||
*/ | ||
function isDeepEqual(a, b) { | ||
function isDeepEqual(a, b, ignoreUndefinedProperties = false) { | ||
if (a === null || a === void 0 || b === null || b === void 0 || typeof a !== typeof b || typeof a !== "object" && typeof b !== "object") { | ||
@@ -36,3 +36,3 @@ return a === b; | ||
const bProps = Object.getOwnPropertyNames(b); | ||
if (aProps.length !== bProps.length) { | ||
if (aProps.length !== bProps.length && !ignoreUndefinedProperties) { | ||
return false; | ||
@@ -39,0 +39,0 @@ } |
@@ -13,7 +13,7 @@ /** | ||
export declare const MAX_MDNS_MESSAGE_SIZE = 1232; | ||
export declare const PtrRecord: (name: string, ptr: string, ttl?: number, flushCache?: boolean) => DnsRecord<string>; | ||
export declare const PtrRecord: (name: string, ptr: string, forInstance?: string, ttl?: number, flushCache?: boolean) => DnsRecord<string>; | ||
export declare const ARecord: (name: string, ip: string, ttl?: number, flushCache?: boolean) => DnsRecord<string>; | ||
export declare const AAAARecord: (name: string, ip: string, ttl?: number, flushCache?: boolean) => DnsRecord<string>; | ||
export declare const TxtRecord: (name: string, entries: string[], ttl?: number, flushCache?: boolean) => DnsRecord<string[]>; | ||
export declare const SrvRecord: (name: string, srv: SrvRecordValue, ttl?: number, flushCache?: boolean) => DnsRecord<SrvRecordValue>; | ||
export declare const TxtRecord: (name: string, entries: string[], forInstance?: string, ttl?: number, flushCache?: boolean) => DnsRecord<string[]>; | ||
export declare const SrvRecord: (name: string, srv: SrvRecordValue, forInstance?: string, ttl?: number, flushCache?: boolean) => DnsRecord<SrvRecordValue>; | ||
export type SrvRecordValue = { | ||
@@ -38,2 +38,3 @@ priority: number; | ||
value: T; | ||
forInstance?: string; | ||
}; | ||
@@ -40,0 +41,0 @@ export type DnsMessage = { |
@@ -12,3 +12,3 @@ /** | ||
const MAX_MDNS_MESSAGE_SIZE = 1232; | ||
const PtrRecord = (name, ptr, ttl = 120, flushCache = false) => ({ | ||
const PtrRecord = (name, ptr, forInstance, ttl = 120, flushCache = false) => ({ | ||
name, | ||
@@ -19,3 +19,4 @@ value: ptr, | ||
recordClass: 1 /* IN */, | ||
flushCache | ||
flushCache, | ||
forInstance | ||
}); | ||
@@ -38,3 +39,3 @@ const ARecord = (name, ip, ttl = 120, flushCache = false) => ({ | ||
}); | ||
const TxtRecord = (name, entries, ttl = 120, flushCache = false) => ({ | ||
const TxtRecord = (name, entries, forInstance, ttl = 120, flushCache = false) => ({ | ||
name, | ||
@@ -45,5 +46,6 @@ value: entries, | ||
recordClass: 1 /* IN */, | ||
flushCache | ||
flushCache, | ||
forInstance | ||
}); | ||
const SrvRecord = (name, srv, ttl = 120, flushCache = false) => ({ | ||
const SrvRecord = (name, srv, forInstance, ttl = 120, flushCache = false) => ({ | ||
name, | ||
@@ -54,3 +56,4 @@ value: srv, | ||
recordClass: 1 /* IN */, | ||
flushCache | ||
flushCache, | ||
forInstance | ||
}); | ||
@@ -57,0 +60,0 @@ var DnsMessageType = /* @__PURE__ */ ((DnsMessageType2) => { |
@@ -6,3 +6,3 @@ /** | ||
*/ | ||
export declare function isDeepEqual(a: any, b: any): boolean; | ||
export declare function isDeepEqual(a: any, b: any, ignoreUndefinedProperties?: boolean): boolean; | ||
//# sourceMappingURL=DeepEqual.d.ts.map |
@@ -6,3 +6,3 @@ /** | ||
*/ | ||
function isDeepEqual(a, b) { | ||
function isDeepEqual(a, b, ignoreUndefinedProperties = false) { | ||
if (a === null || a === void 0 || b === null || b === void 0 || typeof a !== typeof b || typeof a !== "object" && typeof b !== "object") { | ||
@@ -13,3 +13,3 @@ return a === b; | ||
const bProps = Object.getOwnPropertyNames(b); | ||
if (aProps.length !== bProps.length) { | ||
if (aProps.length !== bProps.length && !ignoreUndefinedProperties) { | ||
return false; | ||
@@ -16,0 +16,0 @@ } |
{ | ||
"name": "@matter/general", | ||
"version": "0.12.0-alpha.0-20250108-7ae2a767d", | ||
"version": "0.12.0-alpha.0-20250110-6349da2f0", | ||
"description": "Non-Matter support for Matter.js", | ||
@@ -39,3 +39,3 @@ "keywords": [ | ||
"devDependencies": { | ||
"@matter/testing": "0.12.0-alpha.0-20250108-7ae2a767d" | ||
"@matter/testing": "0.12.0-alpha.0-20250110-6349da2f0" | ||
}, | ||
@@ -42,0 +42,0 @@ "files": [ |
@@ -19,3 +19,9 @@ /** | ||
export const PtrRecord = (name: string, ptr: string, ttl = 120, flushCache = false): DnsRecord<string> => ({ | ||
export const PtrRecord = ( | ||
name: string, | ||
ptr: string, | ||
forInstance?: string, | ||
ttl = 120, | ||
flushCache = false, | ||
): DnsRecord<string> => ({ | ||
name, | ||
@@ -27,2 +33,3 @@ value: ptr, | ||
flushCache, | ||
forInstance, | ||
}); | ||
@@ -45,3 +52,9 @@ export const ARecord = (name: string, ip: string, ttl = 120, flushCache = false): DnsRecord<string> => ({ | ||
}); | ||
export const TxtRecord = (name: string, entries: string[], ttl = 120, flushCache = false): DnsRecord<string[]> => ({ | ||
export const TxtRecord = ( | ||
name: string, | ||
entries: string[], | ||
forInstance?: string, | ||
ttl = 120, | ||
flushCache = false, | ||
): DnsRecord<string[]> => ({ | ||
name, | ||
@@ -53,2 +66,3 @@ value: entries, | ||
flushCache, | ||
forInstance, | ||
}); | ||
@@ -58,2 +72,3 @@ export const SrvRecord = ( | ||
srv: SrvRecordValue, | ||
forInstance?: string, | ||
ttl = 120, | ||
@@ -68,2 +83,3 @@ flushCache = false, | ||
flushCache, | ||
forInstance, | ||
}); | ||
@@ -92,2 +108,3 @@ | ||
value: T; | ||
forInstance?: string; | ||
}; | ||
@@ -94,0 +111,0 @@ |
@@ -9,3 +9,3 @@ /** | ||
// TODO - currently will hang on self-referential data structures | ||
export function isDeepEqual(a: any, b: any) { | ||
export function isDeepEqual(a: any, b: any, ignoreUndefinedProperties = false): boolean { | ||
if ( | ||
@@ -26,3 +26,3 @@ a === null || | ||
// If number of properties is different, objects are not equivalent | ||
if (aProps.length !== bProps.length) { | ||
if (aProps.length !== bProps.length && !ignoreUndefinedProperties) { | ||
return false; | ||
@@ -29,0 +29,0 @@ } |
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
1622394
32851