@alwaysai/device-agent-schemas 2.4.2 → 3.0.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/lib/index.d.ts CHANGED
@@ -10,6 +10,6 @@ import { StatusResponsePayload, ToClientStatusResponseMessage, ToDeviceStatusRes
10
10
  import { SignedUrlsRequestPayload, SignedUrlsRequestMessage } from './signed-urls-request-schema';
11
11
  import { DeviceActionPayload } from './device-action-schema';
12
12
  import { buildAppLogsMessage, buildAppStateMessage, buildAppVersionControlMessage, buildLiveStateUpdatesToggleMessage, buildAppStateControlMessage, buildDeviceActionMessage, buildDeviceStatsMessage, buildSignedUrlsRequestMessage, buildToClientStatusResponseMessage, buildToDeviceStatusResponseMessage } from './message-builders';
13
- import { ProjectShadowUpdate, ShadowProjectsUpdateAll, validateProjectShadowUpdate, validateShadowProjectsUpdateAll, SystemInformationShadowUpdate, SecureTunnelPortInfo, SecureTunnelShadowUpdate, validateSecureTunnelShadowUpdate, validateSystemInformationShadowUpdate, buildBaseShadowMessage, buildUpdateShadowMessage, ShadowTopics, ShadowNames, getShadowTopic, getDesiredFromMessage, getReportedFromMessage, getUpdateDeltaStateFromMessage, ShadowUpdateTypes } from './shadow-schema';
14
- export { getToClientTopic, getToCloudTopic, getToDeviceTopic, getShadowTopic, getDesiredFromMessage, getReportedFromMessage, getUpdateDeltaStateFromMessage, AppDetails, ServiceStatus, AppState, AppStateControlValue, AppStateValue, ProjectShadowUpdate, ShadowProjectsUpdateAll, SystemInformationShadowUpdate, SecureTunnelPortInfo, SecureTunnelShadowUpdate, ToCloudMessageTypeValue, AppStateControlMessageType, AppLogsMessageType, DeviceStatsMessageType, AppStateMessageType, SignedUrlsRequestMessageType, StatusResponseMessageType, ShadowUpdateTypes, ModelInstallPayload, ToClientStatusResponseMessage, ToDeviceStatusResponseMessage, StatusResponseValue, AppStateControlMessage, LiveStateUpdatesTogglePayload, LiveStateUpdatesToggleMessage, DeviceStatsPayload, DeviceStatsMessage, AppStatePayload, AppStateMessage, AppLogsPayload, AppLogsMessage, StatusResponsePayload, AppStateControlPayload, AppVersionControlInstallPayload, AppVersionControlUninstallPayload, AppVersionControlMessage, AppInstallResponsePayload, ModelsInstallResponsePayload, SignedUrlsRequestPayload, SignedUrlsRequestMessage, BaseToDeviceAgentMessage, ToDeviceAgentMessage, ToDeviceAgentMessagePayload, ToDeviceAgentMessageTypeValue, BaseToClientMessage, ToClientMessage, ToClientMessagePayload, ToClientMessageTypeValue, BaseToCloudMessage, ToCloudMessage, ToCloudMessagePayload, DeviceActionPayload, validateToDeviceAgentMessage, validateToClientMessage, validateToCloudMessage, validateShadowProjectsUpdateAll, validateProjectShadowUpdate, validateSystemInformationShadowUpdate, validateSecureTunnelShadowUpdate, buildAppLogsMessage, buildAppStateMessage, buildDeviceStatsMessage, buildSignedUrlsRequestMessage, buildToClientStatusResponseMessage, buildToDeviceStatusResponseMessage, buildAppVersionControlMessage, buildLiveStateUpdatesToggleMessage, buildAppStateControlMessage, buildDeviceActionMessage, buildBaseShadowMessage, buildUpdateShadowMessage, keyMirrors, ShadowTopics, ShadowNames, generateTxId };
13
+ import { ProjectShadowUpdate, ShadowProjectsUpdateAll, validateProjectShadowUpdate, validateShadowProjectsUpdateAll, SystemInformationShadowUpdate, SecureTunnelPortInfo, SecureTunnelShadowUpdate, validateSecureTunnelShadowUpdate, validateSystemInformationShadowUpdate, buildBaseShadowMessage, buildUpdateShadowMessage, ShadowTopics, ShadowNames, getShadowTopic, getDesiredFromMessage, getReportedFromMessage, getUpdateDeltaStateFromMessage, ShadowUpdateTypes, EnvVars, validateEnvVarSchemaShadowUpdate } from './shadow-schema';
14
+ export { getToClientTopic, getToCloudTopic, getToDeviceTopic, getShadowTopic, getDesiredFromMessage, getReportedFromMessage, getUpdateDeltaStateFromMessage, AppDetails, ServiceStatus, AppState, AppStateControlValue, AppStateValue, ProjectShadowUpdate, ShadowProjectsUpdateAll, SystemInformationShadowUpdate, SecureTunnelPortInfo, SecureTunnelShadowUpdate, EnvVars, ToCloudMessageTypeValue, AppStateControlMessageType, AppLogsMessageType, DeviceStatsMessageType, AppStateMessageType, SignedUrlsRequestMessageType, StatusResponseMessageType, ShadowUpdateTypes, ModelInstallPayload, ToClientStatusResponseMessage, ToDeviceStatusResponseMessage, StatusResponseValue, AppStateControlMessage, LiveStateUpdatesTogglePayload, LiveStateUpdatesToggleMessage, DeviceStatsPayload, DeviceStatsMessage, AppStatePayload, AppStateMessage, AppLogsPayload, AppLogsMessage, StatusResponsePayload, AppStateControlPayload, AppVersionControlInstallPayload, AppVersionControlUninstallPayload, AppVersionControlMessage, AppInstallResponsePayload, ModelsInstallResponsePayload, SignedUrlsRequestPayload, SignedUrlsRequestMessage, BaseToDeviceAgentMessage, ToDeviceAgentMessage, ToDeviceAgentMessagePayload, ToDeviceAgentMessageTypeValue, BaseToClientMessage, ToClientMessage, ToClientMessagePayload, ToClientMessageTypeValue, BaseToCloudMessage, ToCloudMessage, ToCloudMessagePayload, DeviceActionPayload, validateToDeviceAgentMessage, validateToClientMessage, validateToCloudMessage, validateShadowProjectsUpdateAll, validateProjectShadowUpdate, validateSystemInformationShadowUpdate, validateSecureTunnelShadowUpdate, validateEnvVarSchemaShadowUpdate, buildAppLogsMessage, buildAppStateMessage, buildDeviceStatsMessage, buildSignedUrlsRequestMessage, buildToClientStatusResponseMessage, buildToDeviceStatusResponseMessage, buildAppVersionControlMessage, buildLiveStateUpdatesToggleMessage, buildAppStateControlMessage, buildDeviceActionMessage, buildBaseShadowMessage, buildUpdateShadowMessage, keyMirrors, ShadowTopics, ShadowNames, generateTxId };
15
15
  //# sourceMappingURL=index.d.ts.map
package/lib/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.generateTxId = exports.ShadowTopics = exports.keyMirrors = exports.buildUpdateShadowMessage = exports.buildBaseShadowMessage = exports.buildDeviceActionMessage = exports.buildAppStateControlMessage = exports.buildLiveStateUpdatesToggleMessage = exports.buildAppVersionControlMessage = exports.buildToDeviceStatusResponseMessage = exports.buildToClientStatusResponseMessage = exports.buildSignedUrlsRequestMessage = exports.buildDeviceStatsMessage = exports.buildAppStateMessage = exports.buildAppLogsMessage = exports.validateSecureTunnelShadowUpdate = exports.validateSystemInformationShadowUpdate = exports.validateProjectShadowUpdate = exports.validateShadowProjectsUpdateAll = exports.validateToCloudMessage = exports.validateToClientMessage = exports.validateToDeviceAgentMessage = exports.getUpdateDeltaStateFromMessage = exports.getReportedFromMessage = exports.getDesiredFromMessage = exports.getShadowTopic = exports.getToDeviceTopic = exports.getToCloudTopic = exports.getToClientTopic = void 0;
3
+ exports.generateTxId = exports.ShadowTopics = exports.keyMirrors = exports.buildUpdateShadowMessage = exports.buildBaseShadowMessage = exports.buildDeviceActionMessage = exports.buildAppStateControlMessage = exports.buildLiveStateUpdatesToggleMessage = exports.buildAppVersionControlMessage = exports.buildToDeviceStatusResponseMessage = exports.buildToClientStatusResponseMessage = exports.buildSignedUrlsRequestMessage = exports.buildDeviceStatsMessage = exports.buildAppStateMessage = exports.buildAppLogsMessage = exports.validateEnvVarSchemaShadowUpdate = exports.validateSecureTunnelShadowUpdate = exports.validateSystemInformationShadowUpdate = exports.validateProjectShadowUpdate = exports.validateShadowProjectsUpdateAll = exports.validateToCloudMessage = exports.validateToClientMessage = exports.validateToDeviceAgentMessage = exports.getUpdateDeltaStateFromMessage = exports.getReportedFromMessage = exports.getDesiredFromMessage = exports.getShadowTopic = exports.getToDeviceTopic = exports.getToCloudTopic = exports.getToClientTopic = void 0;
4
4
  // export types here
5
5
  const types_1 = require("./types");
6
6
  Object.defineProperty(exports, "validateToDeviceAgentMessage", { enumerable: true, get: function () { return types_1.validateToDeviceAgentMessage; } });
@@ -36,4 +36,5 @@ Object.defineProperty(exports, "getShadowTopic", { enumerable: true, get: functi
36
36
  Object.defineProperty(exports, "getDesiredFromMessage", { enumerable: true, get: function () { return shadow_schema_1.getDesiredFromMessage; } });
37
37
  Object.defineProperty(exports, "getReportedFromMessage", { enumerable: true, get: function () { return shadow_schema_1.getReportedFromMessage; } });
38
38
  Object.defineProperty(exports, "getUpdateDeltaStateFromMessage", { enumerable: true, get: function () { return shadow_schema_1.getUpdateDeltaStateFromMessage; } });
39
+ Object.defineProperty(exports, "validateEnvVarSchemaShadowUpdate", { enumerable: true, get: function () { return shadow_schema_1.validateEnvVarSchemaShadowUpdate; } });
39
40
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,18 @@
1
+ {
2
+ "$id": "https://alwaysai.co/env-var-schema.json",
3
+ "$schema": "https://json-schema.org/draft/2019-09/schema",
4
+ "title": "env-var",
5
+ "type": "object",
6
+ "patternProperties": {
7
+ ".*": {
8
+ "type": "object",
9
+ "patternProperties": {
10
+ "^[^\\s]+$": {
11
+ "type": "string"
12
+ }
13
+ },
14
+ "additionalProperties": false
15
+ }
16
+ },
17
+ "additionalProperties": false
18
+ }
@@ -0,0 +1,30 @@
1
+ {
2
+ "$id": "https://alwaysai.co/shadow-project-update-legacy-schema.json",
3
+ "title": "shadow_project_update_legacy_schema",
4
+ "description": "[LEGACY] The messaging payload structure for all properties of a single project shadow update",
5
+ "type": "object",
6
+ "nullable": true,
7
+ "properties": {
8
+ "appConfig": {
9
+ "type": "string"
10
+ },
11
+ "envVars": {
12
+ "type": "object",
13
+ "patternProperties": {
14
+ ".*": {
15
+ "type": "object",
16
+ "patternProperties": {
17
+ ".*": {
18
+ "type": ["string", "null"]
19
+ }
20
+ },
21
+ "required": []
22
+ }
23
+ },
24
+ "required": [],
25
+ "additionalProperties": true
26
+ }
27
+ },
28
+ "required": [],
29
+ "additionalProperties": true
30
+ }
@@ -9,20 +9,7 @@
9
9
  "type": "string"
10
10
  },
11
11
  "envVars": {
12
- "type": "object",
13
- "patternProperties": {
14
- ".*": {
15
- "type": "object",
16
- "patternProperties": {
17
- ".*": {
18
- "type": ["string", "null"]
19
- }
20
- },
21
- "required": []
22
- }
23
- },
24
- "required": [],
25
- "additionalProperties": true
12
+ "type": "string"
26
13
  }
27
14
  },
28
15
  "required": [],
@@ -6,7 +6,10 @@
6
6
  "patternProperties": {
7
7
  ".*": {
8
8
  "type": ["object", "null"],
9
- "$ref": "https://alwaysai.co/shadow-project-update-schema.json"
9
+ "anyOf": [
10
+ { "$ref": "https://alwaysai.co/shadow-project-update-schema.json" },
11
+ { "$ref": "https://alwaysai.co/shadow-project-update-legacy-schema.json" }
12
+ ]
10
13
  }
11
14
  },
12
15
  "propertyNames": {
@@ -44,16 +44,16 @@
44
44
  "type": "string"
45
45
  },
46
46
  "cores": {
47
- "type": "number"
47
+ "type": "string"
48
48
  },
49
49
  "physicalCores": {
50
- "type": "number"
50
+ "type": "string"
51
51
  },
52
52
  "efficiencyCores": {
53
- "type": "number"
53
+ "type": "string"
54
54
  },
55
55
  "processors": {
56
- "type": "number"
56
+ "type": "string"
57
57
  }
58
58
  },
59
59
  "additionalProperties": false
@@ -79,13 +79,15 @@
79
79
  "type": "string"
80
80
  },
81
81
  "size": {
82
- "type": "number"
82
+ "type": "string"
83
83
  }
84
- }
84
+ },
85
+ "additionalProperties": false
85
86
  }
86
87
  }
87
88
  },
88
- "additionalProperties": false
89
+ "additionalProperties": false,
90
+ "required": []
89
91
  },
90
92
  "device": {
91
93
  "type": "object",
@@ -25,6 +25,10 @@ export declare const SHADOW_NAMES: ("secure-tunnel" | "projects" | "system-info"
25
25
  export declare const getShadowTopic: (clientId: string, shadowName: ShadowNames, shadowTopic: ShadowTopics) => string;
26
26
  export declare type ShadowUpdateTypes = ShadowProjectsUpdateAll | SystemInformationShadowUpdate | SecureTunnelShadowUpdate;
27
27
  export interface ProjectShadowUpdate {
28
+ appConfig?: string;
29
+ envVars?: string;
30
+ }
31
+ export interface ProjectShadowUpdateLegacy {
28
32
  appConfig?: string;
29
33
  envVars?: {
30
34
  [service: string]: {
@@ -36,6 +40,7 @@ export interface ShadowProjectsUpdateAll {
36
40
  [projectId: string]: ProjectShadowUpdate | null;
37
41
  }
38
42
  export declare const validateProjectShadowUpdate: import("ajv/dist/types").ValidateFunction<ProjectShadowUpdate>;
43
+ export declare const validateLegacyProjectShadowUpdate: import("ajv/dist/types").ValidateFunction<ProjectShadowUpdateLegacy>;
39
44
  export declare const validateShadowProjectsUpdateAll: import("ajv/dist/types").ValidateFunction<ShadowProjectsUpdateAll>;
40
45
  export interface SystemInformationShadowUpdate {
41
46
  os?: {
@@ -51,9 +56,10 @@ export interface SystemInformationShadowUpdate {
51
56
  brand?: string;
52
57
  vendor?: string;
53
58
  model?: string;
54
- cores?: number;
55
- physicalCores?: number;
56
- efficiencyCores?: number;
59
+ cores?: string;
60
+ physicalCores?: string;
61
+ efficiencyCores?: string;
62
+ processors?: string;
57
63
  };
58
64
  disk?: {
59
65
  drives: {
@@ -61,7 +67,7 @@ export interface SystemInformationShadowUpdate {
61
67
  type?: string;
62
68
  name?: string;
63
69
  vendor?: string;
64
- size?: number;
70
+ size?: string;
65
71
  }[];
66
72
  };
67
73
  device?: {
@@ -87,6 +93,12 @@ export interface SystemInformationShadowUpdate {
87
93
  lastBootTime?: string;
88
94
  }
89
95
  export declare const validateSystemInformationShadowUpdate: import("ajv/dist/types").ValidateFunction<SystemInformationShadowUpdate>;
96
+ export interface EnvVars {
97
+ [service: string]: {
98
+ [name: string]: string | null;
99
+ };
100
+ }
101
+ export declare const validateEnvVarSchemaShadowUpdate: import("ajv/dist/types").ValidateFunction<EnvVars>;
90
102
  export declare type SecureTunnelPortInfo = {
91
103
  enabled: boolean;
92
104
  type: string;
@@ -1,12 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.buildBaseShadowMessage = exports.buildUpdateShadowMessage = exports.validateSecureTunnelShadowUpdate = exports.validateSystemInformationShadowUpdate = exports.validateShadowProjectsUpdateAll = exports.validateProjectShadowUpdate = exports.getShadowTopic = exports.SHADOW_NAMES = exports.SHADOW_TOPICS = exports.ShadowTopics = exports.getUpdateDeltaStateFromMessage = exports.getReportedFromMessage = exports.getDesiredFromMessage = void 0;
3
+ exports.buildBaseShadowMessage = exports.buildUpdateShadowMessage = exports.validateSecureTunnelShadowUpdate = exports.validateEnvVarSchemaShadowUpdate = exports.validateSystemInformationShadowUpdate = exports.validateShadowProjectsUpdateAll = exports.validateLegacyProjectShadowUpdate = exports.validateProjectShadowUpdate = exports.getShadowTopic = exports.SHADOW_NAMES = exports.SHADOW_TOPICS = exports.ShadowTopics = exports.getUpdateDeltaStateFromMessage = exports.getReportedFromMessage = exports.getDesiredFromMessage = void 0;
4
4
  const _2019_1 = require("ajv/dist/2019");
5
5
  const shadowProjectsUpdateAllSchema = require("./schemas/shadow-projects-update-all-schema.json");
6
6
  const shadowProjectUpdateSchema = require("./schemas/shadow-project-update-schema.json");
7
+ const shadowProjectUpdateLegacySchema = require("./schemas/shadow-project-update-legacy-schema.json");
7
8
  const systemInformationSchema = require("./schemas/system-information-schema.json");
8
9
  const secureTunnelSchema = require("./schemas/secure-tunnel-schema.json");
9
10
  const commonSchema = require("./schemas/common-schema.json");
11
+ const envVarSchema = require("./schemas/env-var-schema.json");
10
12
  const utils_1 = require("./utils");
11
13
  const ajv = new _2019_1.default({
12
14
  allErrors: true,
@@ -66,10 +68,14 @@ exports.getShadowTopic = getShadowTopic;
66
68
  // Shadow Message validator functions
67
69
  ajv.addSchema(shadowProjectUpdateSchema, 'shadow-project-update-schema.json');
68
70
  exports.validateProjectShadowUpdate = ajv.compile(shadowProjectUpdateSchema);
71
+ ajv.addSchema(shadowProjectUpdateLegacySchema, 'shadow-project-update-legacy-schema.json');
72
+ exports.validateLegacyProjectShadowUpdate = ajv.compile(shadowProjectUpdateSchema);
69
73
  ajv.addSchema(shadowProjectsUpdateAllSchema, 'shadow-projects-update-all-schema.json');
70
74
  exports.validateShadowProjectsUpdateAll = ajv.compile(shadowProjectsUpdateAllSchema);
71
75
  ajv.addSchema(systemInformationSchema, 'system-information-schema.json');
72
76
  exports.validateSystemInformationShadowUpdate = ajv.compile(systemInformationSchema);
77
+ ajv.addSchema(envVarSchema, 'env-var-schema.json');
78
+ exports.validateEnvVarSchemaShadowUpdate = ajv.compile(envVarSchema);
73
79
  ajv.addSchema(secureTunnelSchema, 'secure-tunnel-schema.json');
74
80
  exports.validateSecureTunnelShadowUpdate = ajv.compile(secureTunnelSchema);
75
81
  /* ============================================================================
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@alwaysai/device-agent-schemas",
3
3
  "description": "alwaysAI schemas",
4
- "version": "2.4.2",
4
+ "version": "3.0.0",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
7
7
  "files": [