@openmdm/core 0.4.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 +20 -2
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +5 -2
- 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/types.ts +7 -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);
|
|
@@ -2367,13 +2372,20 @@ function createMDM(config) {
|
|
|
2367
2372
|
});
|
|
2368
2373
|
},
|
|
2369
2374
|
async cancel(id) {
|
|
2370
|
-
|
|
2375
|
+
const command = await database.updateCommand(id, { status: "cancelled" });
|
|
2376
|
+
if (!command) {
|
|
2377
|
+
throw new CommandNotFoundError(id);
|
|
2378
|
+
}
|
|
2379
|
+
return command;
|
|
2371
2380
|
},
|
|
2372
2381
|
async acknowledge(id) {
|
|
2373
2382
|
const command = await database.updateCommand(id, {
|
|
2374
2383
|
status: "acknowledged",
|
|
2375
2384
|
acknowledgedAt: /* @__PURE__ */ new Date()
|
|
2376
2385
|
});
|
|
2386
|
+
if (!command) {
|
|
2387
|
+
throw new CommandNotFoundError(id);
|
|
2388
|
+
}
|
|
2377
2389
|
const device = await database.findDevice(command.deviceId);
|
|
2378
2390
|
if (device) {
|
|
2379
2391
|
await emit("command.acknowledged", { device, command });
|
|
@@ -2386,6 +2398,9 @@ function createMDM(config) {
|
|
|
2386
2398
|
result,
|
|
2387
2399
|
completedAt: /* @__PURE__ */ new Date()
|
|
2388
2400
|
});
|
|
2401
|
+
if (!command) {
|
|
2402
|
+
throw new CommandNotFoundError(id);
|
|
2403
|
+
}
|
|
2389
2404
|
const device = await database.findDevice(command.deviceId);
|
|
2390
2405
|
if (device) {
|
|
2391
2406
|
await emit("command.completed", { device, command, result });
|
|
@@ -2398,6 +2413,9 @@ function createMDM(config) {
|
|
|
2398
2413
|
error,
|
|
2399
2414
|
completedAt: /* @__PURE__ */ new Date()
|
|
2400
2415
|
});
|
|
2416
|
+
if (!command) {
|
|
2417
|
+
throw new CommandNotFoundError(id);
|
|
2418
|
+
}
|
|
2401
2419
|
const device = await database.findDevice(command.deviceId);
|
|
2402
2420
|
if (device) {
|
|
2403
2421
|
await emit("command.failed", { device, command, error });
|
|
@@ -2877,6 +2895,6 @@ function generateDeviceToken(deviceId, secret, expirationSeconds) {
|
|
|
2877
2895
|
return `${header}.${payload}.${signature}`;
|
|
2878
2896
|
}
|
|
2879
2897
|
|
|
2880
|
-
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 };
|
|
2881
2899
|
//# sourceMappingURL=index.js.map
|
|
2882
2900
|
//# sourceMappingURL=index.js.map
|