@openmdm/core 0.3.0 → 0.4.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/dist/index.d.ts +1 -1
- package/dist/index.js +22 -2
- package/dist/index.js.map +1 -1
- package/dist/schema.js +2 -0
- package/dist/schema.js.map +1 -1
- package/dist/types.d.ts +8 -3
- package/dist/types.js +6 -1
- package/dist/types.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +18 -1
- package/src/schema.ts +1 -0
- package/src/types.ts +10 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { WebhookConfig, MDMEvent, WebhookEndpoint, EventType, DatabaseAdapter, TenantManager, AuthorizationManager, AuditConfig, AuditManager, ScheduleManager, MessageQueueManager, DashboardManager, PluginStorageAdapter, MDMConfig, MDMInstance } from './types.js';
|
|
2
|
-
export { AppInstallationSummary, AppRollback, AppVersion, Application, ApplicationManager, ApplicationNotFoundError, AuditAction, AuditLog, AuditLogFilter, AuditLogListResult, AuditSummary, AuthConfig, AuthenticationError, AuthorizationError, Command, CommandFilter, CommandManager, CommandResult, CommandStatus, CommandSuccessRates, CommandType, CreateAppRollbackInput, CreateApplicationInput, CreateAuditLogInput, CreateDeviceInput, CreateGroupInput, CreatePolicyInput, CreateRoleInput, CreateScheduledTaskInput, CreateTenantInput, CreateUserInput, DashboardStats, DeployTarget, Device, DeviceFilter, DeviceListResult, DeviceLocation, DeviceManager, DeviceNotFoundError, DeviceStatus, DeviceStatusBreakdown, EnqueueMessageInput, EnrollmentConfig, EnrollmentError, EnrollmentMethod, EnrollmentRequest, EnrollmentResponse, EnrollmentTrendPoint, EventFilter, EventHandler, EventPayloadMap, Group, GroupHierarchyStats, GroupManager, GroupNotFoundError, GroupTreeNode, HardwareControl, Heartbeat, InstalledApp, MDMError, MDMPlugin, MaintenanceWindow, PasswordPolicy, Permission, PermissionAction, PermissionResource, PluginMiddleware, PluginRoute, PluginStorageEntry, Policy, PolicyApplication, PolicyManager, PolicyNotFoundError, PolicySettings, PushAdapter, PushBatchResult, PushConfig, PushMessage, PushProviderConfig, PushResult, PushToken, QueueMessageStatus, QueueStats, QueuedMessage, RegisterPushTokenInput, Role, RoleNotFoundError, ScheduledTask, ScheduledTaskFilter, ScheduledTaskListResult, ScheduledTaskStatus, SendCommandInput, StorageConfig, SystemUpdatePolicy, TaskExecution, TaskSchedule, TaskType, Tenant, TenantFilter, TenantListResult, TenantNotFoundError, TenantSettings, TenantStats, TenantStatus, TimeWindow, UpdateApplicationInput, UpdateDeviceInput, UpdateGroupInput, UpdatePolicyInput, UpdateRoleInput, UpdateScheduledTaskInput, UpdateTenantInput, UpdateUserInput, User, UserFilter, UserListResult, UserNotFoundError, UserWithRoles, ValidationError, VpnConfig, WebhookDeliveryResult, WebhookManager, WifiConfig } from './types.js';
|
|
2
|
+
export { AppInstallationSummary, AppRollback, AppVersion, Application, ApplicationManager, ApplicationNotFoundError, AuditAction, AuditLog, AuditLogFilter, AuditLogListResult, AuditSummary, AuthConfig, AuthenticationError, AuthorizationError, Command, CommandFilter, CommandManager, CommandNotFoundError, CommandResult, CommandStatus, CommandSuccessRates, CommandType, CreateAppRollbackInput, CreateApplicationInput, CreateAuditLogInput, CreateDeviceInput, CreateGroupInput, CreatePolicyInput, CreateRoleInput, CreateScheduledTaskInput, CreateTenantInput, CreateUserInput, DashboardStats, DeployTarget, Device, DeviceFilter, DeviceListResult, DeviceLocation, DeviceManager, DeviceNotFoundError, DeviceStatus, DeviceStatusBreakdown, EnqueueMessageInput, EnrollmentConfig, EnrollmentError, EnrollmentMethod, EnrollmentRequest, EnrollmentResponse, EnrollmentTrendPoint, EventFilter, EventHandler, EventPayloadMap, Group, GroupHierarchyStats, GroupManager, GroupNotFoundError, GroupTreeNode, HardwareControl, Heartbeat, InstalledApp, MDMError, MDMPlugin, MaintenanceWindow, PasswordPolicy, Permission, PermissionAction, PermissionResource, PluginMiddleware, PluginRoute, PluginStorageEntry, Policy, PolicyApplication, PolicyManager, PolicyNotFoundError, PolicySettings, PushAdapter, PushBatchResult, PushConfig, PushMessage, PushProviderConfig, PushResult, PushToken, QueueMessageStatus, QueueStats, QueuedMessage, RegisterPushTokenInput, Role, RoleNotFoundError, ScheduledTask, ScheduledTaskFilter, ScheduledTaskListResult, ScheduledTaskStatus, SendCommandInput, StorageConfig, SystemUpdatePolicy, TaskExecution, TaskSchedule, TaskType, Tenant, TenantFilter, TenantListResult, TenantNotFoundError, TenantSettings, TenantStats, TenantStatus, TimeWindow, UpdateApplicationInput, UpdateDeviceInput, UpdateGroupInput, UpdatePolicyInput, UpdateRoleInput, UpdateScheduledTaskInput, UpdateTenantInput, UpdateUserInput, User, UserFilter, UserListResult, UserNotFoundError, UserWithRoles, ValidationError, VpnConfig, WebhookDeliveryResult, WebhookManager, WifiConfig } from './types.js';
|
|
3
3
|
export { ColumnDefinition, ColumnType, IndexDefinition, SchemaDefinition, TableDefinition, camelToSnake, getColumnNames, getPrimaryKey, getTableNames, mdmSchema, snakeToCamel, transformToCamelCase, transformToSnakeCase } from './schema.js';
|
|
4
4
|
|
|
5
5
|
/**
|
package/dist/index.js
CHANGED
|
@@ -27,6 +27,11 @@ var ApplicationNotFoundError = class extends MDMError {
|
|
|
27
27
|
super(`Application not found: ${identifier}`, "APPLICATION_NOT_FOUND", 404);
|
|
28
28
|
}
|
|
29
29
|
};
|
|
30
|
+
var CommandNotFoundError = class extends MDMError {
|
|
31
|
+
constructor(commandId) {
|
|
32
|
+
super(`Command not found: ${commandId}`, "COMMAND_NOT_FOUND", 404);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
30
35
|
var TenantNotFoundError = class extends MDMError {
|
|
31
36
|
constructor(identifier) {
|
|
32
37
|
super(`Tenant not found: ${identifier}`, "TENANT_NOT_FOUND", 404);
|
|
@@ -1378,6 +1383,8 @@ var mdmSchema = {
|
|
|
1378
1383
|
nullable: true,
|
|
1379
1384
|
references: { table: "mdm_policies", column: "id", onDelete: "set null" }
|
|
1380
1385
|
},
|
|
1386
|
+
agent_version: { type: "string", nullable: true },
|
|
1387
|
+
// MDM agent version installed on device
|
|
1381
1388
|
last_heartbeat: { type: "datetime", nullable: true },
|
|
1382
1389
|
last_sync: { type: "datetime", nullable: true },
|
|
1383
1390
|
// Telemetry (denormalized for quick access)
|
|
@@ -2365,13 +2372,20 @@ function createMDM(config) {
|
|
|
2365
2372
|
});
|
|
2366
2373
|
},
|
|
2367
2374
|
async cancel(id) {
|
|
2368
|
-
|
|
2375
|
+
const command = await database.updateCommand(id, { status: "cancelled" });
|
|
2376
|
+
if (!command) {
|
|
2377
|
+
throw new CommandNotFoundError(id);
|
|
2378
|
+
}
|
|
2379
|
+
return command;
|
|
2369
2380
|
},
|
|
2370
2381
|
async acknowledge(id) {
|
|
2371
2382
|
const command = await database.updateCommand(id, {
|
|
2372
2383
|
status: "acknowledged",
|
|
2373
2384
|
acknowledgedAt: /* @__PURE__ */ new Date()
|
|
2374
2385
|
});
|
|
2386
|
+
if (!command) {
|
|
2387
|
+
throw new CommandNotFoundError(id);
|
|
2388
|
+
}
|
|
2375
2389
|
const device = await database.findDevice(command.deviceId);
|
|
2376
2390
|
if (device) {
|
|
2377
2391
|
await emit("command.acknowledged", { device, command });
|
|
@@ -2384,6 +2398,9 @@ function createMDM(config) {
|
|
|
2384
2398
|
result,
|
|
2385
2399
|
completedAt: /* @__PURE__ */ new Date()
|
|
2386
2400
|
});
|
|
2401
|
+
if (!command) {
|
|
2402
|
+
throw new CommandNotFoundError(id);
|
|
2403
|
+
}
|
|
2387
2404
|
const device = await database.findDevice(command.deviceId);
|
|
2388
2405
|
if (device) {
|
|
2389
2406
|
await emit("command.completed", { device, command, result });
|
|
@@ -2396,6 +2413,9 @@ function createMDM(config) {
|
|
|
2396
2413
|
error,
|
|
2397
2414
|
completedAt: /* @__PURE__ */ new Date()
|
|
2398
2415
|
});
|
|
2416
|
+
if (!command) {
|
|
2417
|
+
throw new CommandNotFoundError(id);
|
|
2418
|
+
}
|
|
2399
2419
|
const device = await database.findDevice(command.deviceId);
|
|
2400
2420
|
if (device) {
|
|
2401
2421
|
await emit("command.failed", { device, command, error });
|
|
@@ -2875,6 +2895,6 @@ function generateDeviceToken(deviceId, secret, expirationSeconds) {
|
|
|
2875
2895
|
return `${header}.${payload}.${signature}`;
|
|
2876
2896
|
}
|
|
2877
2897
|
|
|
2878
|
-
export { ApplicationNotFoundError, AuthenticationError, AuthorizationError, DeviceNotFoundError, EnrollmentError, GroupNotFoundError, MDMError, PolicyNotFoundError, RoleNotFoundError, TenantNotFoundError, UserNotFoundError, ValidationError, camelToSnake, createAuditManager, createAuthorizationManager, createDashboardManager, createMDM, createMemoryPluginStorageAdapter, createMessageQueueManager, createPluginKey, createPluginStorageAdapter, createScheduleManager, createTenantManager, createWebhookManager, getColumnNames, getPrimaryKey, getTableNames, mdmSchema, parsePluginKey, snakeToCamel, transformToCamelCase, transformToSnakeCase, verifyWebhookSignature };
|
|
2898
|
+
export { ApplicationNotFoundError, AuthenticationError, AuthorizationError, CommandNotFoundError, DeviceNotFoundError, EnrollmentError, GroupNotFoundError, MDMError, PolicyNotFoundError, RoleNotFoundError, TenantNotFoundError, UserNotFoundError, ValidationError, camelToSnake, createAuditManager, createAuthorizationManager, createDashboardManager, createMDM, createMemoryPluginStorageAdapter, createMessageQueueManager, createPluginKey, createPluginStorageAdapter, createScheduleManager, createTenantManager, createWebhookManager, getColumnNames, getPrimaryKey, getTableNames, mdmSchema, parsePluginKey, snakeToCamel, transformToCamelCase, transformToSnakeCase, verifyWebhookSignature };
|
|
2879
2899
|
//# sourceMappingURL=index.js.map
|
|
2880
2900
|
//# sourceMappingURL=index.js.map
|