@comapeo/schema
Advanced tools
Comparing version 1.1.1 to 1.2.0
@@ -91,2 +91,11 @@ import { ExhaustivenessError, parseVersionId } from './utils.js'; | ||
export const convertDeviceInfo = (mapeoDoc) => { | ||
const { selfHostedServerDetails } = mapeoDoc; | ||
if (selfHostedServerDetails) { | ||
try { | ||
new URL(selfHostedServerDetails.baseUrl || ''); | ||
} | ||
catch (_err) { | ||
throw new Error('deviceInfo.selfHostedServerDetails.baseUrl is not a valid URL'); | ||
} | ||
} | ||
return { | ||
@@ -93,0 +102,0 @@ common: convertCommon(mapeoDoc), |
@@ -8,2 +8,3 @@ import _m0 from "protobufjs/minimal.js"; | ||
deviceType: DeviceInfo_1_DeviceType; | ||
selfHostedServerDetails?: DeviceInfo_1_SelfHostedServerDetails | undefined; | ||
} | ||
@@ -21,2 +22,5 @@ export declare const DeviceInfo_1_DeviceType: { | ||
export declare function deviceInfo_1_DeviceTypeToNumber(object: DeviceInfo_1_DeviceType): number; | ||
export interface DeviceInfo_1_SelfHostedServerDetails { | ||
baseUrl: string; | ||
} | ||
export declare const DeviceInfo_1: { | ||
@@ -26,1 +30,5 @@ encode(message: DeviceInfo_1, writer?: _m0.Writer): _m0.Writer; | ||
}; | ||
export declare const DeviceInfo_1_SelfHostedServerDetails: { | ||
encode(message: DeviceInfo_1_SelfHostedServerDetails, writer?: _m0.Writer): _m0.Writer; | ||
decode(input: _m0.Reader | Uint8Array, length?: number): DeviceInfo_1_SelfHostedServerDetails; | ||
}; |
@@ -54,3 +54,8 @@ /* eslint-disable */ | ||
function createBaseDeviceInfo_1() { | ||
return { common: undefined, name: "", deviceType: DeviceInfo_1_DeviceType.device_type_unspecified }; | ||
return { | ||
common: undefined, | ||
name: "", | ||
deviceType: DeviceInfo_1_DeviceType.device_type_unspecified, | ||
selfHostedServerDetails: undefined, | ||
}; | ||
} | ||
@@ -68,2 +73,5 @@ export const DeviceInfo_1 = { | ||
} | ||
if (message.selfHostedServerDetails !== undefined) { | ||
DeviceInfo_1_SelfHostedServerDetails.encode(message.selfHostedServerDetails, writer.uint32(58).fork()).ldelim(); | ||
} | ||
return writer; | ||
@@ -96,2 +104,8 @@ }, | ||
continue; | ||
case 7: | ||
if (tag !== 58) { | ||
break; | ||
} | ||
message.selfHostedServerDetails = DeviceInfo_1_SelfHostedServerDetails.decode(reader, reader.uint32()); | ||
continue; | ||
} | ||
@@ -106,1 +120,33 @@ if ((tag & 7) === 4 || tag === 0) { | ||
}; | ||
function createBaseDeviceInfo_1_SelfHostedServerDetails() { | ||
return { baseUrl: "" }; | ||
} | ||
export const DeviceInfo_1_SelfHostedServerDetails = { | ||
encode(message, writer = _m0.Writer.create()) { | ||
if (message.baseUrl !== "") { | ||
writer.uint32(10).string(message.baseUrl); | ||
} | ||
return writer; | ||
}, | ||
decode(input, length) { | ||
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); | ||
let end = length === undefined ? reader.len : reader.pos + length; | ||
const message = createBaseDeviceInfo_1_SelfHostedServerDetails(); | ||
while (reader.pos < end) { | ||
const tag = reader.uint32(); | ||
switch (tag >>> 3) { | ||
case 1: | ||
if (tag !== 10) { | ||
break; | ||
} | ||
message.baseUrl = reader.string(); | ||
continue; | ||
} | ||
if ((tag & 7) === 4 || tag === 0) { | ||
break; | ||
} | ||
reader.skipType(tag & 7); | ||
} | ||
return message; | ||
}, | ||
}; |
@@ -16,2 +16,8 @@ /** | ||
deviceType: "device_type_unspecified" | "mobile" | "tablet" | "desktop" | "selfHostedServer" | "UNRECOGNIZED"; | ||
selfHostedServerDetails?: { | ||
/** | ||
* base URL for the server | ||
*/ | ||
baseUrl: string; | ||
}; | ||
} |
{ | ||
"name": "@comapeo/schema", | ||
"version": "1.1.1", | ||
"version": "1.2.0", | ||
"description": "JSON Schema and TypeScript types for CoMapeo", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
1103950
20726