dsh-deeppilot 0.7.0 → 0.7.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/lib/index.js CHANGED
@@ -4018,6 +4018,35 @@ const scopesSchema = { parse(value) {
4018
4018
  if (!Array.isArray(value) || value.some((scope) => typeof scope !== "string" || !DEVICE_SCOPES.includes(scope))) reject("scopes");
4019
4019
  return normalizeDeviceScopes(value);
4020
4020
  } };
4021
+ const booleanSchema = { parse(value) {
4022
+ if (typeof value !== "boolean") reject("boolean");
4023
+ return value;
4024
+ } };
4025
+ /**
4026
+ * One strict boundary codec carrying both generation shapes of the supported
4027
+ * `0.1.x` host family.
4028
+ *
4029
+ * Through `0.1.6-alpha.1` a descriptor published the schema value itself and
4030
+ * every consumer parsed through `codec.schema.parse(value)`. `0.1.6-alpha.2`
4031
+ * switched to a lazily materialized process-realm factory: `TypertRegistry`
4032
+ * now rejects a strict codec without `create()`, and the Gateway parses
4033
+ * through `codec.create().parse(value)`.
4034
+ *
4035
+ * Publishing both keys — `create()` returning the same hand-written,
4036
+ * dependency-free codec — keeps one package valid across the entire declared
4037
+ * peer range instead of forking the wire contract per host generation. The
4038
+ * cast is required because each generation's `TypertCodec` declares only its
4039
+ * own key, so a fresh object literal carrying both fails excess-property
4040
+ * checking against either one.
4041
+ */
4042
+ function strictCodec(typeSymbol, schema) {
4043
+ return {
4044
+ mode: "strict",
4045
+ typeSymbol,
4046
+ schema,
4047
+ create: () => schema
4048
+ };
4049
+ }
4021
4050
  const REPORT_HOST_CONTRIBUTION = {
4022
4051
  package: REPORT_REMOTE_PACKAGE,
4023
4052
  face: "host",
@@ -4035,11 +4064,7 @@ const REPORT_HOST_CONTRIBUTION = {
4035
4064
  method: "report",
4036
4065
  invocation: { kind: "direct" },
4037
4066
  parameters: [],
4038
- result: {
4039
- mode: "strict",
4040
- typeSymbol: `${REPORT_REMOTE_PACKAGE}#DeepPilotReport`,
4041
- schema: reportSchema
4042
- }
4067
+ result: strictCodec(`${REPORT_REMOTE_PACKAGE}#DeepPilotReport`, reportSchema)
4043
4068
  },
4044
4069
  {
4045
4070
  id: `${REPORT_REMOTE_PACKAGE}#${BEGIN_PAIRING_ENDPOINT}`,
@@ -4048,11 +4073,7 @@ const REPORT_HOST_CONTRIBUTION = {
4048
4073
  method: "beginPairing",
4049
4074
  invocation: { kind: "direct" },
4050
4075
  parameters: [],
4051
- result: {
4052
- mode: "strict",
4053
- typeSymbol: `${REPORT_REMOTE_PACKAGE}#PairingGrantSnapshot`,
4054
- schema: pairingGrantSchema
4055
- }
4076
+ result: strictCodec(`${REPORT_REMOTE_PACKAGE}#PairingGrantSnapshot`, pairingGrantSchema)
4056
4077
  },
4057
4078
  {
4058
4079
  id: `${REPORT_REMOTE_PACKAGE}#${REVOKE_DEVICE_ENDPOINT}`,
@@ -4064,20 +4085,9 @@ const REPORT_HOST_CONTRIBUTION = {
4064
4085
  name: "deviceId",
4065
4086
  wire: "deviceId",
4066
4087
  source: "json",
4067
- codec: {
4068
- mode: "strict",
4069
- typeSymbol: `${REPORT_REMOTE_PACKAGE}#DeviceId`,
4070
- schema: deviceIdSchema
4071
- }
4088
+ codec: strictCodec(`${REPORT_REMOTE_PACKAGE}#DeviceId`, deviceIdSchema)
4072
4089
  }],
4073
- result: {
4074
- mode: "strict",
4075
- typeSymbol: `${REPORT_REMOTE_PACKAGE}#Boolean`,
4076
- schema: { parse(value) {
4077
- if (typeof value !== "boolean") reject("boolean");
4078
- return value;
4079
- } }
4080
- }
4090
+ result: strictCodec(`${REPORT_REMOTE_PACKAGE}#Boolean`, booleanSchema)
4081
4091
  },
4082
4092
  {
4083
4093
  id: `${REPORT_REMOTE_PACKAGE}#${SET_DEVICE_SCOPES_ENDPOINT}`,
@@ -4089,26 +4099,14 @@ const REPORT_HOST_CONTRIBUTION = {
4089
4099
  name: "deviceId",
4090
4100
  wire: "deviceId",
4091
4101
  source: "json",
4092
- codec: {
4093
- mode: "strict",
4094
- typeSymbol: `${REPORT_REMOTE_PACKAGE}#DeviceId`,
4095
- schema: deviceIdSchema
4096
- }
4102
+ codec: strictCodec(`${REPORT_REMOTE_PACKAGE}#DeviceId`, deviceIdSchema)
4097
4103
  }, {
4098
4104
  name: "scopes",
4099
4105
  wire: "scopes",
4100
4106
  source: "json",
4101
- codec: {
4102
- mode: "strict",
4103
- typeSymbol: `${REPORT_REMOTE_PACKAGE}#DeviceScopes`,
4104
- schema: scopesSchema
4105
- }
4107
+ codec: strictCodec(`${REPORT_REMOTE_PACKAGE}#DeviceScopes`, scopesSchema)
4106
4108
  }],
4107
- result: {
4108
- mode: "strict",
4109
- typeSymbol: `${REPORT_REMOTE_PACKAGE}#DeviceScopes`,
4110
- schema: scopesSchema
4111
- }
4109
+ result: strictCodec(`${REPORT_REMOTE_PACKAGE}#DeviceScopes`, scopesSchema)
4112
4110
  },
4113
4111
  {
4114
4112
  id: `${REPORT_REMOTE_PACKAGE}#deeppilot/testRelay`,
@@ -4117,11 +4115,7 @@ const REPORT_HOST_CONTRIBUTION = {
4117
4115
  method: "testRelay",
4118
4116
  invocation: { kind: "direct" },
4119
4117
  parameters: [],
4120
- result: {
4121
- mode: "strict",
4122
- typeSymbol: `${REPORT_REMOTE_PACKAGE}#RelayTestResult`,
4123
- schema: relayTestSchema
4124
- }
4118
+ result: strictCodec(`${REPORT_REMOTE_PACKAGE}#RelayTestResult`, relayTestSchema)
4125
4119
  },
4126
4120
  {
4127
4121
  id: `${REPORT_REMOTE_PACKAGE}#deeppilot/testPush`,
@@ -4130,11 +4124,7 @@ const REPORT_HOST_CONTRIBUTION = {
4130
4124
  method: "testPush",
4131
4125
  invocation: { kind: "direct" },
4132
4126
  parameters: [],
4133
- result: {
4134
- mode: "strict",
4135
- typeSymbol: `${REPORT_REMOTE_PACKAGE}#PushTestResult`,
4136
- schema: pushTestSchema
4137
- }
4127
+ result: strictCodec(`${REPORT_REMOTE_PACKAGE}#PushTestResult`, pushTestSchema)
4138
4128
  }
4139
4129
  ]
4140
4130
  };