c8y-nitro 0.1.0 → 0.1.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/README.md +19 -43
- package/dist/_virtual/rolldown_runtime.mjs +32 -0
- package/dist/client.d.mts +122 -0
- package/dist/client.mjs +63 -0
- package/dist/index.mjs +5 -2
- package/dist/module/docker.mjs +1 -1
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/esm2015/index.mjs +63 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/esm2015/src/Client.mjs +284 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/esm2015/src/alarm/AlarmService.mjs +198 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/esm2015/src/alarm/AlarmStatus.mjs +16 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/esm2015/src/alarm/index.mjs +4 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/esm2015/src/application/ApplicationAvailability.mjs +12 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/esm2015/src/application/ApplicationBinaryService.mjs +166 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/esm2015/src/application/ApplicationService.mjs +604 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/esm2015/src/application/ApplicationType.mjs +11 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/esm2015/src/application/BillingMode.mjs +9 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/esm2015/src/application/IApplicationInstanceDetails.mjs +11 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/esm2015/src/application/Isolation.mjs +9 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/esm2015/src/application/index.mjs +9 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/esm2015/src/audit/AuditRecordType.mjs +33 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/esm2015/src/audit/AuditService.mjs +95 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/esm2015/src/audit/ChangeType.mjs +15 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/esm2015/src/audit/index.mjs +5 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/esm2015/src/core/BasicAuth.mjs +69 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/esm2015/src/core/BearerAuth.mjs +52 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/esm2015/src/core/BearerAuthFromSessionStorage.mjs +43 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/esm2015/src/core/CookieAuth.mjs +53 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/esm2015/src/core/FetchClient.mjs +82 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/esm2015/src/core/MicroserviceClientRequestAuth.mjs +50 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/esm2015/src/core/NodeJSCookieAuth.mjs +19 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/esm2015/src/core/Paging.mjs +68 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/esm2015/src/core/QueriesUtil.mjs +225 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/esm2015/src/core/Service.mjs +186 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/esm2015/src/core/Severity.mjs +18 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/esm2015/src/core/index.mjs +13 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/esm2015/src/device-registration/DeviceRegistrationBulkService.mjs +67 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/esm2015/src/device-registration/DeviceRegistrationSecurityMode.mjs +13 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/esm2015/src/device-registration/DeviceRegistrationService.mjs +362 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/esm2015/src/device-registration/DeviceRegistrationStatus.mjs +16 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/esm2015/src/device-registration/index.mjs +6 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/esm2015/src/event/EventBinaryService.mjs +102 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/esm2015/src/event/EventService.mjs +147 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/esm2015/src/event/index.mjs +4 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/esm2015/src/feature/FeatureService.mjs +89 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/esm2015/src/feature/index.mjs +3 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/esm2015/src/gettext-typed.mjs +7 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/esm2015/src/gettext.mjs +9 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/esm2015/src/identity/IdentityService.mjs +181 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/esm2015/src/inventory/InventoryBinaryService.mjs +149 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/esm2015/src/inventory/InventoryService.mjs +842 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/esm2015/src/inventory/index.mjs +4 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/esm2015/src/inventory-role/InventoryRoleService.mjs +139 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/esm2015/src/inventory-role/index.mjs +3 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/esm2015/src/measurement/ISeriesFilter.mjs +10 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/esm2015/src/measurement/MeasurementService.mjs +205 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/esm2015/src/measurement/index.mjs +4 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/esm2015/src/operation/OperationBulkGeneralStatus.mjs +20 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/esm2015/src/operation/OperationBulkService.mjs +157 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/esm2015/src/operation/OperationBulkStatus.mjs +16 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/esm2015/src/operation/OperationService.mjs +133 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/esm2015/src/operation/OperationStatus.mjs +16 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/esm2015/src/operation/index.mjs +7 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/esm2015/src/public_api.mjs +84 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/esm2015/src/realtime/MetaChannel.mjs +11 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/esm2015/src/realtime/Realtime.mjs +103 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/esm2015/src/realtime/index.mjs +3 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/esm2015/src/services.mjs +54 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/esm2015/src/smart-groups/SmartGroupsService.mjs +158 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/esm2015/src/smart-rules/SmartRulesService.mjs +158 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/esm2015/src/smart-rules/index.mjs +3 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/esm2015/src/system-options/SystemOptionsService.mjs +82 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/esm2015/src/system-options/index.mjs +3 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/esm2015/src/tenant/TenantService.mjs +373 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/esm2015/src/tenant/TenantStatus.mjs +11 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/esm2015/src/tenant/TfaStrategy.mjs +14 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/esm2015/src/tenant/index.mjs +5 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/esm2015/src/tenant-login-options/ITenantLoginOptions.mjs +29 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/esm2015/src/tenant-login-options/TenantLoginOptionsService.mjs +217 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/esm2015/src/tenant-login-options/index.mjs +4 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/esm2015/src/tenant-options/TenantOptionsService.mjs +183 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/esm2015/src/tenant-options/index.mjs +3 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/esm2015/src/tenant-security-options/TenantSecurityOptionsService.mjs +52 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/esm2015/src/tenant-security-options/index.mjs +3 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/esm2015/src/trusted-certificates/CrlService.mjs +112 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/esm2015/src/trusted-certificates/TrustedCertificateService.mjs +299 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/esm2015/src/trusted-certificates/index.mjs +4 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/esm2015/src/user/PasswordStrength.mjs +10 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/esm2015/src/user/UserInventoryRoleService.mjs +133 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/esm2015/src/user/UserService.mjs +730 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/esm2015/src/user/index.mjs +5 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/esm2015/src/user-group/UserGroupService.mjs +306 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/esm2015/src/user-group/index.mjs +3 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/esm2015/src/user-role/UserRoleService.mjs +70 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/esm2015/src/user-role/index.mjs +3 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/Client.d.mts +218 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/alarm/AlarmService.d.mts +153 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/alarm/AlarmStatus.d.mts +15 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/alarm/IAlarm.d.mts +84 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/alarm/SeverityFilter.d.mts +6 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/application/ApplicationAvailability.d.mts +8 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/application/ApplicationBinaryService.d.mts +46 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/application/ApplicationService.d.mts +339 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/application/ApplicationType.d.mts +9 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/application/BillingMode.d.mts +7 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/application/IApplication.d.mts +30 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/application/IApplicationBinary.d.mts +12 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/application/IApplicationInstanceDetails.d.mts +71 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/application/IApplicationReference.d.mts +19 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/application/IApplicationVersion.d.mts +17 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/application/IDeviceRegistrationProvider.d.mts +9 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/application/IManifest.d.mts +81 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/application/IProvider.d.mts +8 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/application/IUploadParamsOverride.d.mts +9 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/application/Isolation.d.mts +7 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/audit/AuditRecordType.d.mts +32 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/audit/AuditService.d.mts +77 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/audit/ChangeType.d.mts +11 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/audit/IAuditRecord.d.mts +39 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/audit/IChange.d.mts +31 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/core/BasicAuth.d.mts +35 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/core/BearerAuth.d.mts +21 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/core/BearerAuthFromSessionStorage.d.mts +24 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/core/CookieAuth.d.mts +26 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/core/FetchClient.d.mts +24 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/core/IAuthentication.d.mts +27 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/core/ICustomProperties.d.mts +10 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/core/ICustomPropertiesMap.d.mts +8 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/core/IFetchClient.d.mts +13 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/core/IFetchOptions.d.mts +24 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/core/IFetchResponse.d.mts +28 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/core/IIdentified.d.mts +8 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/core/IMicroserviceSubscriptions.d.mts +18 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/core/INamed.d.mts +8 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/core/IResult.d.mts +29 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/core/IResultBase.d.mts +9 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/core/IResultList.d.mts +39 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/core/ISource.d.mts +20 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/core/MicroserviceClientRequestAuth.d.mts +36 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/core/NodeJSCookieAuth.d.mts +14 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/core/Paging.d.mts +70 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/core/QueriesUtil.d.mts +168 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/core/Service.d.mts +48 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/core/Severity.d.mts +17 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/device-registration/DeviceRegistrationBulkService.d.mts +43 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/device-registration/DeviceRegistrationSecurityMode.d.mts +11 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/device-registration/DeviceRegistrationService.d.mts +296 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/device-registration/DeviceRegistrationStatus.d.mts +12 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/device-registration/IDeviceCredentials.d.mts +25 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/device-registration/IDeviceRegistration.d.mts +79 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/device-registration/IDeviceRegistrationBulkResult.d.mts +29 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/event/EventBinaryService.d.mts +67 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/event/EventService.d.mts +120 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/event/IEvent.d.mts +42 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/event/IEventBinary.d.mts +28 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/feature/FeatureService.d.mts +59 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/feature/IFeatureToggle.d.mts +30 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/identity/IExternalIdentity.d.mts +27 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/identity/IdentityService.d.mts +107 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/inventory/IManagedObject.d.mts +95 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/inventory/InventoryBinaryService.d.mts +50 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/inventory/InventoryService.d.mts +594 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/inventory-role/InventoryRoleService.d.mts +111 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/measurement/IMeasurement.d.mts +61 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/measurement/IMeasurementFilter.d.mts +59 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/measurement/ISeries.d.mts +60 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/measurement/ISeriesFilter.d.mts +48 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/measurement/MeasurementService.d.mts +163 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/operation/IOperation.d.mts +27 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/operation/IOperationBulk.d.mts +58 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/operation/IOperationBulkProgress.d.mts +29 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/operation/OperationBulkGeneralStatus.d.mts +16 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/operation/OperationBulkService.d.mts +130 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/operation/OperationBulkStatus.d.mts +12 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/operation/OperationService.d.mts +111 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/operation/OperationStatus.d.mts +12 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/realtime/Realtime.d.mts +69 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/smart-groups/SmartGroupsService.d.mts +126 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/smart-rules/IRule.d.mts +22 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/smart-rules/SmartRulesService.d.mts +90 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/system-options/ISystemOption.d.mts +21 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/system-options/SystemOptionsService.d.mts +57 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/tenant/ICurrentTenant.d.mts +25 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/tenant/ISupportUser.d.mts +8 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/tenant/ITenant.d.mts +28 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/tenant/ITenantReference.d.mts +8 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/tenant/ITfaSettings.d.mts +32 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/tenant/TenantService.d.mts +264 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/tenant/TenantStatus.d.mts +7 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/tenant/TfaStrategy.d.mts +12 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/tenant-login-options/ITenantLoginOptions.d.mts +159 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/tenant-login-options/TenantLoginOptionsService.d.mts +176 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/tenant-options/ITenantOption.d.mts +12 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/tenant-options/ITenantOptionDetailParams.d.mts +13 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/tenant-options/TenantOptionsService.d.mts +150 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/tenant-policy/ITenantPolicy.d.mts +13 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/tenant-security-options/ITenantSecurityOption.d.mts +10 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/tenant-security-options/TenantSecurityOptionsService.d.mts +39 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/trusted-certificates/CrlService.d.mts +75 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/trusted-certificates/ICertificateRevocation.d.mts +14 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/trusted-certificates/ITrustedCertificate.d.mts +75 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/trusted-certificates/TrustedCertificateService.d.mts +181 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/user/ICurrentUser.d.mts +39 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/user/IResetPassword.d.mts +15 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/user/ITotp.d.mts +9 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/user/ITotpStatus.d.mts +7 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/user/IUser.d.mts +77 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/user/IUserInventoryRole.d.mts +16 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/user/PasswordStrength.d.mts +8 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/user/UserInventoryRoleService.d.mts +108 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/user/UserService.d.mts +400 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/user-group/IDevicePermissions.d.mts +8 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/user-group/IUserGroup.d.mts +44 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/user-group/UserGroupService.d.mts +215 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/user-role/IRole.d.mts +12 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/user-role/IRoleReference.d.mts +19 -0
- package/dist/node_modules/.pnpm/@c8y_client@1023.17.8_encoding@0.1.13/node_modules/@c8y/client/lib/src/user-role/UserRoleService.d.mts +57 -0
- package/dist/node_modules/.pnpm/asynckit@0.4.0/node_modules/asynckit/index.mjs +18 -0
- package/dist/node_modules/.pnpm/asynckit@0.4.0/node_modules/asynckit/lib/abort.mjs +29 -0
- package/dist/node_modules/.pnpm/asynckit@0.4.0/node_modules/asynckit/lib/async.mjs +32 -0
- package/dist/node_modules/.pnpm/asynckit@0.4.0/node_modules/asynckit/lib/defer.mjs +21 -0
- package/dist/node_modules/.pnpm/asynckit@0.4.0/node_modules/asynckit/lib/iterate.mjs +47 -0
- package/dist/node_modules/.pnpm/asynckit@0.4.0/node_modules/asynckit/lib/state.mjs +33 -0
- package/dist/node_modules/.pnpm/asynckit@0.4.0/node_modules/asynckit/lib/terminator.mjs +26 -0
- package/dist/node_modules/.pnpm/asynckit@0.4.0/node_modules/asynckit/parallel.mjs +40 -0
- package/dist/node_modules/.pnpm/asynckit@0.4.0/node_modules/asynckit/serial.mjs +24 -0
- package/dist/node_modules/.pnpm/asynckit@0.4.0/node_modules/asynckit/serialOrdered.mjs +62 -0
- package/dist/node_modules/.pnpm/b2a@1.1.2/node_modules/b2a/lib/index.mjs +44 -0
- package/dist/node_modules/.pnpm/call-bind-apply-helpers@1.0.2/node_modules/call-bind-apply-helpers/actualApply.mjs +20 -0
- package/dist/node_modules/.pnpm/call-bind-apply-helpers@1.0.2/node_modules/call-bind-apply-helpers/functionApply.mjs +12 -0
- package/dist/node_modules/.pnpm/call-bind-apply-helpers@1.0.2/node_modules/call-bind-apply-helpers/functionCall.mjs +12 -0
- package/dist/node_modules/.pnpm/call-bind-apply-helpers@1.0.2/node_modules/call-bind-apply-helpers/index.mjs +23 -0
- package/dist/node_modules/.pnpm/call-bind-apply-helpers@1.0.2/node_modules/call-bind-apply-helpers/reflectApply.mjs +12 -0
- package/dist/node_modules/.pnpm/combined-stream@1.0.8/node_modules/combined-stream/lib/combined_stream.mjs +158 -0
- package/dist/node_modules/.pnpm/cometd-nodejs-client@1.0.2/node_modules/cometd-nodejs-client/cometd-nodejs-client.mjs +120 -0
- package/dist/node_modules/.pnpm/cometd@4.0.8/node_modules/cometd/cometd.mjs +2658 -0
- package/dist/node_modules/.pnpm/cross-fetch@4.1.0_encoding@0.1.13/node_modules/cross-fetch/dist/node-ponyfill.mjs +24 -0
- package/dist/node_modules/.pnpm/delayed-stream@1.0.0/node_modules/delayed-stream/lib/delayed_stream.mjs +84 -0
- package/dist/node_modules/.pnpm/dunder-proto@1.0.1/node_modules/dunder-proto/get.mjs +27 -0
- package/dist/node_modules/.pnpm/encoding@0.1.13/node_modules/encoding/lib/encoding.mjs +60 -0
- package/dist/node_modules/.pnpm/es-define-property@1.0.1/node_modules/es-define-property/index.mjs +18 -0
- package/dist/node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/eval.mjs +12 -0
- package/dist/node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/index.mjs +12 -0
- package/dist/node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/range.mjs +12 -0
- package/dist/node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/ref.mjs +12 -0
- package/dist/node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/syntax.mjs +12 -0
- package/dist/node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/type.mjs +12 -0
- package/dist/node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/uri.mjs +12 -0
- package/dist/node_modules/.pnpm/es-object-atoms@1.1.1/node_modules/es-object-atoms/index.mjs +12 -0
- package/dist/node_modules/.pnpm/es-set-tostringtag@2.1.0/node_modules/es-set-tostringtag/index.mjs +32 -0
- package/dist/node_modules/.pnpm/form-data@4.0.4/node_modules/form-data/index.d.mts +50 -0
- package/dist/node_modules/.pnpm/form-data@4.0.4/node_modules/form-data/lib/form_data.mjs +247 -0
- package/dist/node_modules/.pnpm/form-data@4.0.4/node_modules/form-data/lib/populate.mjs +16 -0
- package/dist/node_modules/.pnpm/function-bind@1.1.2/node_modules/function-bind/implementation.mjs +58 -0
- package/dist/node_modules/.pnpm/function-bind@1.1.2/node_modules/function-bind/index.mjs +13 -0
- package/dist/node_modules/.pnpm/get-intrinsic@1.3.0/node_modules/get-intrinsic/index.mjs +357 -0
- package/dist/node_modules/.pnpm/get-proto@1.0.1/node_modules/get-proto/Object.getPrototypeOf.mjs +14 -0
- package/dist/node_modules/.pnpm/get-proto@1.0.1/node_modules/get-proto/Reflect.getPrototypeOf.mjs +12 -0
- package/dist/node_modules/.pnpm/get-proto@1.0.1/node_modules/get-proto/index.mjs +25 -0
- package/dist/node_modules/.pnpm/gopd@1.2.0/node_modules/gopd/gOPD.mjs +12 -0
- package/dist/node_modules/.pnpm/gopd@1.2.0/node_modules/gopd/index.mjs +19 -0
- package/dist/node_modules/.pnpm/has-symbols@1.1.0/node_modules/has-symbols/index.mjs +21 -0
- package/dist/node_modules/.pnpm/has-symbols@1.1.0/node_modules/has-symbols/shams.mjs +35 -0
- package/dist/node_modules/.pnpm/has-tostringtag@1.0.2/node_modules/has-tostringtag/shams.mjs +16 -0
- package/dist/node_modules/.pnpm/hasown@2.0.2/node_modules/hasown/index.mjs +16 -0
- package/dist/node_modules/.pnpm/iconv-lite@0.6.3/node_modules/iconv-lite/encodings/dbcs-codec.mjs +349 -0
- package/dist/node_modules/.pnpm/iconv-lite@0.6.3/node_modules/iconv-lite/encodings/dbcs-data.mjs +194 -0
- package/dist/node_modules/.pnpm/iconv-lite@0.6.3/node_modules/iconv-lite/encodings/index.mjs +34 -0
- package/dist/node_modules/.pnpm/iconv-lite@0.6.3/node_modules/iconv-lite/encodings/internal.mjs +141 -0
- package/dist/node_modules/.pnpm/iconv-lite@0.6.3/node_modules/iconv-lite/encodings/sbcs-codec.mjs +53 -0
- package/dist/node_modules/.pnpm/iconv-lite@0.6.3/node_modules/iconv-lite/encodings/sbcs-data-generated.mjs +458 -0
- package/dist/node_modules/.pnpm/iconv-lite@0.6.3/node_modules/iconv-lite/encodings/sbcs-data.mjs +154 -0
- package/dist/node_modules/.pnpm/iconv-lite@0.6.3/node_modules/iconv-lite/encodings/tables/big5-added.mjs +172 -0
- package/dist/node_modules/.pnpm/iconv-lite@0.6.3/node_modules/iconv-lite/encodings/tables/cp936.mjs +2587 -0
- package/dist/node_modules/.pnpm/iconv-lite@0.6.3/node_modules/iconv-lite/encodings/tables/cp949.mjs +2223 -0
- package/dist/node_modules/.pnpm/iconv-lite@0.6.3/node_modules/iconv-lite/encodings/tables/cp950.mjs +230 -0
- package/dist/node_modules/.pnpm/iconv-lite@0.6.3/node_modules/iconv-lite/encodings/tables/eucjp.mjs +428 -0
- package/dist/node_modules/.pnpm/iconv-lite@0.6.3/node_modules/iconv-lite/encodings/tables/gb18030-ranges.mjs +430 -0
- package/dist/node_modules/.pnpm/iconv-lite@0.6.3/node_modules/iconv-lite/encodings/tables/gbk-added.mjs +233 -0
- package/dist/node_modules/.pnpm/iconv-lite@0.6.3/node_modules/iconv-lite/encodings/tables/shiftjis.mjs +295 -0
- package/dist/node_modules/.pnpm/iconv-lite@0.6.3/node_modules/iconv-lite/encodings/utf16.mjs +126 -0
- package/dist/node_modules/.pnpm/iconv-lite@0.6.3/node_modules/iconv-lite/encodings/utf32.mjs +198 -0
- package/dist/node_modules/.pnpm/iconv-lite@0.6.3/node_modules/iconv-lite/encodings/utf7.mjs +183 -0
- package/dist/node_modules/.pnpm/iconv-lite@0.6.3/node_modules/iconv-lite/lib/bom-handling.mjs +45 -0
- package/dist/node_modules/.pnpm/iconv-lite@0.6.3/node_modules/iconv-lite/lib/index.mjs +110 -0
- package/dist/node_modules/.pnpm/iconv-lite@0.6.3/node_modules/iconv-lite/lib/streams.mjs +93 -0
- package/dist/node_modules/.pnpm/isomorphic-cometd@1.1.0_cometd-nodejs-client@1.0.2_cometd@4.0.8/node_modules/isomorphic-cometd/node.mjs +18 -0
- package/dist/node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/abs.mjs +12 -0
- package/dist/node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/floor.mjs +12 -0
- package/dist/node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/isNaN.mjs +14 -0
- package/dist/node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/max.mjs +12 -0
- package/dist/node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/min.mjs +12 -0
- package/dist/node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/pow.mjs +12 -0
- package/dist/node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/round.mjs +12 -0
- package/dist/node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/sign.mjs +17 -0
- package/dist/node_modules/.pnpm/mime-db@1.52.0/node_modules/mime-db/db.mjs +7051 -0
- package/dist/node_modules/.pnpm/mime-db@1.52.0/node_modules/mime-db/index.mjs +21 -0
- package/dist/node_modules/.pnpm/mime-types@2.1.35/node_modules/mime-types/index.mjs +123 -0
- package/dist/node_modules/.pnpm/node-fetch@2.7.0_encoding@0.1.13/node_modules/node-fetch/lib/index.mjs +1174 -0
- package/dist/node_modules/.pnpm/safer-buffer@2.1.2/node_modules/safer-buffer/safer.mjs +48 -0
- package/dist/node_modules/.pnpm/tr46@0.0.3/node_modules/tr46/index.mjs +145 -0
- package/dist/node_modules/.pnpm/tr46@0.0.3/node_modules/tr46/lib/mappingTable.mjs +35563 -0
- package/dist/node_modules/.pnpm/tslib@2.8.1/node_modules/tslib/tslib.es6.mjs +31 -0
- package/dist/node_modules/.pnpm/webidl-conversions@3.0.1/node_modules/webidl-conversions/lib/index.mjs +122 -0
- package/dist/node_modules/.pnpm/whatwg-url@5.0.0/node_modules/whatwg-url/lib/URL-impl.mjs +145 -0
- package/dist/node_modules/.pnpm/whatwg-url@5.0.0/node_modules/whatwg-url/lib/URL.mjs +174 -0
- package/dist/node_modules/.pnpm/whatwg-url@5.0.0/node_modules/whatwg-url/lib/public-api.mjs +21 -0
- package/dist/node_modules/.pnpm/whatwg-url@5.0.0/node_modules/whatwg-url/lib/url-state-machine.mjs +878 -0
- package/dist/node_modules/.pnpm/whatwg-url@5.0.0/node_modules/whatwg-url/lib/utils.mjs +22 -0
- package/dist/package.mjs +1 -1
- package/dist/utils/client.d.mts +1 -1
- package/dist/utils/client.mjs +4 -1
- package/dist/utils/credentials.d.mts +1 -1
- package/dist/utils/credentials.mjs +2 -1
- package/dist/utils/resources.d.mts +1 -1
- package/package.json +8 -4
|
@@ -0,0 +1,2658 @@
|
|
|
1
|
+
import { __commonJSMin } from "../../../../../_virtual/rolldown_runtime.mjs";
|
|
2
|
+
|
|
3
|
+
//#region node_modules/.pnpm/cometd@4.0.8/node_modules/cometd/cometd.js
|
|
4
|
+
var require_cometd = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
5
|
+
(function(root, factory) {
|
|
6
|
+
if (typeof exports === "object") module.exports = factory();
|
|
7
|
+
else if (typeof define === "function" && define.amd) define([], factory);
|
|
8
|
+
else {
|
|
9
|
+
root.org = root.org || {};
|
|
10
|
+
root.org.cometd = factory();
|
|
11
|
+
}
|
|
12
|
+
})(exports, function() {
|
|
13
|
+
/**
|
|
14
|
+
* Browsers may throttle the Window scheduler,
|
|
15
|
+
* so we may replace it with a Worker scheduler.
|
|
16
|
+
*/
|
|
17
|
+
var Scheduler = function() {
|
|
18
|
+
var _ids = 0;
|
|
19
|
+
var _tasks = {};
|
|
20
|
+
this.register = function(funktion) {
|
|
21
|
+
var id = ++_ids;
|
|
22
|
+
_tasks[id] = funktion;
|
|
23
|
+
return id;
|
|
24
|
+
};
|
|
25
|
+
this.unregister = function(id) {
|
|
26
|
+
var funktion = _tasks[id];
|
|
27
|
+
delete _tasks[id];
|
|
28
|
+
return funktion;
|
|
29
|
+
};
|
|
30
|
+
this.setTimeout = function(funktion, delay) {
|
|
31
|
+
return window.setTimeout(funktion, delay);
|
|
32
|
+
};
|
|
33
|
+
this.clearTimeout = function(id) {
|
|
34
|
+
window.clearTimeout(id);
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* The scheduler code that will run in the Worker.
|
|
39
|
+
* Workers have a built-in `self` variable similar to `window`.
|
|
40
|
+
*/
|
|
41
|
+
function WorkerScheduler() {
|
|
42
|
+
var _tasks = {};
|
|
43
|
+
self.onmessage = function(e) {
|
|
44
|
+
var cmd = e.data;
|
|
45
|
+
var id = _tasks[cmd.id];
|
|
46
|
+
switch (cmd.type) {
|
|
47
|
+
case "setTimeout":
|
|
48
|
+
_tasks[cmd.id] = self.setTimeout(function() {
|
|
49
|
+
delete _tasks[cmd.id];
|
|
50
|
+
self.postMessage({ id: cmd.id });
|
|
51
|
+
}, cmd.delay);
|
|
52
|
+
break;
|
|
53
|
+
case "clearTimeout":
|
|
54
|
+
delete _tasks[cmd.id];
|
|
55
|
+
if (id) self.clearTimeout(id);
|
|
56
|
+
break;
|
|
57
|
+
default: throw "Unknown command " + cmd.type;
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Utility functions.
|
|
63
|
+
*/
|
|
64
|
+
var Utils = {
|
|
65
|
+
isString: function(value) {
|
|
66
|
+
if (value === void 0 || value === null) return false;
|
|
67
|
+
return typeof value === "string" || value instanceof String;
|
|
68
|
+
},
|
|
69
|
+
isArray: function(value) {
|
|
70
|
+
if (value === void 0 || value === null) return false;
|
|
71
|
+
return value instanceof Array;
|
|
72
|
+
},
|
|
73
|
+
inArray: function(element, array) {
|
|
74
|
+
for (var i = 0; i < array.length; ++i) if (element === array[i]) return i;
|
|
75
|
+
return -1;
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* A registry for transports used by the CometD object.
|
|
80
|
+
*/
|
|
81
|
+
var TransportRegistry = function() {
|
|
82
|
+
var _types = [];
|
|
83
|
+
var _transports = {};
|
|
84
|
+
this.getTransportTypes = function() {
|
|
85
|
+
return _types.slice(0);
|
|
86
|
+
};
|
|
87
|
+
this.findTransportTypes = function(version, crossDomain, url) {
|
|
88
|
+
var result = [];
|
|
89
|
+
for (var i = 0; i < _types.length; ++i) {
|
|
90
|
+
var type = _types[i];
|
|
91
|
+
if (_transports[type].accept(version, crossDomain, url) === true) result.push(type);
|
|
92
|
+
}
|
|
93
|
+
return result;
|
|
94
|
+
};
|
|
95
|
+
this.negotiateTransport = function(types, version, crossDomain, url) {
|
|
96
|
+
for (var i = 0; i < _types.length; ++i) {
|
|
97
|
+
var type = _types[i];
|
|
98
|
+
for (var j = 0; j < types.length; ++j) if (type === types[j]) {
|
|
99
|
+
var transport = _transports[type];
|
|
100
|
+
if (transport.accept(version, crossDomain, url) === true) return transport;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
return null;
|
|
104
|
+
};
|
|
105
|
+
this.add = function(type, transport, index) {
|
|
106
|
+
var existing = false;
|
|
107
|
+
for (var i = 0; i < _types.length; ++i) if (_types[i] === type) {
|
|
108
|
+
existing = true;
|
|
109
|
+
break;
|
|
110
|
+
}
|
|
111
|
+
if (!existing) {
|
|
112
|
+
if (typeof index !== "number") _types.push(type);
|
|
113
|
+
else _types.splice(index, 0, type);
|
|
114
|
+
_transports[type] = transport;
|
|
115
|
+
}
|
|
116
|
+
return !existing;
|
|
117
|
+
};
|
|
118
|
+
this.find = function(type) {
|
|
119
|
+
for (var i = 0; i < _types.length; ++i) if (_types[i] === type) return _transports[type];
|
|
120
|
+
return null;
|
|
121
|
+
};
|
|
122
|
+
this.remove = function(type) {
|
|
123
|
+
for (var i = 0; i < _types.length; ++i) if (_types[i] === type) {
|
|
124
|
+
_types.splice(i, 1);
|
|
125
|
+
var transport = _transports[type];
|
|
126
|
+
delete _transports[type];
|
|
127
|
+
return transport;
|
|
128
|
+
}
|
|
129
|
+
return null;
|
|
130
|
+
};
|
|
131
|
+
this.clear = function() {
|
|
132
|
+
_types = [];
|
|
133
|
+
_transports = {};
|
|
134
|
+
};
|
|
135
|
+
this.reset = function(init) {
|
|
136
|
+
for (var i = 0; i < _types.length; ++i) _transports[_types[i]].reset(init);
|
|
137
|
+
};
|
|
138
|
+
};
|
|
139
|
+
/**
|
|
140
|
+
* Base object with the common functionality for transports.
|
|
141
|
+
*/
|
|
142
|
+
var Transport = function() {
|
|
143
|
+
var _type;
|
|
144
|
+
var _cometd;
|
|
145
|
+
var _url;
|
|
146
|
+
/**
|
|
147
|
+
* Function invoked just after a transport has been successfully registered.
|
|
148
|
+
* @param type the type of transport (for example 'long-polling')
|
|
149
|
+
* @param cometd the cometd object this transport has been registered to
|
|
150
|
+
* @see #unregistered()
|
|
151
|
+
*/
|
|
152
|
+
this.registered = function(type, cometd) {
|
|
153
|
+
_type = type;
|
|
154
|
+
_cometd = cometd;
|
|
155
|
+
};
|
|
156
|
+
/**
|
|
157
|
+
* Function invoked just after a transport has been successfully unregistered.
|
|
158
|
+
* @see #registered(type, cometd)
|
|
159
|
+
*/
|
|
160
|
+
this.unregistered = function() {
|
|
161
|
+
_type = null;
|
|
162
|
+
_cometd = null;
|
|
163
|
+
};
|
|
164
|
+
this._debug = function() {
|
|
165
|
+
_cometd._debug.apply(_cometd, arguments);
|
|
166
|
+
};
|
|
167
|
+
this._mixin = function() {
|
|
168
|
+
return _cometd._mixin.apply(_cometd, arguments);
|
|
169
|
+
};
|
|
170
|
+
this.getConfiguration = function() {
|
|
171
|
+
return _cometd.getConfiguration();
|
|
172
|
+
};
|
|
173
|
+
this.getAdvice = function() {
|
|
174
|
+
return _cometd.getAdvice();
|
|
175
|
+
};
|
|
176
|
+
this.setTimeout = function(funktion, delay) {
|
|
177
|
+
return _cometd.setTimeout(funktion, delay);
|
|
178
|
+
};
|
|
179
|
+
this.clearTimeout = function(id) {
|
|
180
|
+
_cometd.clearTimeout(id);
|
|
181
|
+
};
|
|
182
|
+
/**
|
|
183
|
+
* Converts the given response into an array of bayeux messages
|
|
184
|
+
* @param response the response to convert
|
|
185
|
+
* @return an array of bayeux messages obtained by converting the response
|
|
186
|
+
*/
|
|
187
|
+
this.convertToMessages = function(response) {
|
|
188
|
+
if (Utils.isString(response)) try {
|
|
189
|
+
return JSON.parse(response);
|
|
190
|
+
} catch (x) {
|
|
191
|
+
this._debug("Could not convert to JSON the following string", "\"" + response + "\"");
|
|
192
|
+
throw x;
|
|
193
|
+
}
|
|
194
|
+
if (Utils.isArray(response)) return response;
|
|
195
|
+
if (response === void 0 || response === null) return [];
|
|
196
|
+
if (response instanceof Object) return [response];
|
|
197
|
+
throw "Conversion Error " + response + ", typeof " + typeof response;
|
|
198
|
+
};
|
|
199
|
+
/**
|
|
200
|
+
* Returns whether this transport can work for the given version and cross domain communication case.
|
|
201
|
+
* @param version a string indicating the transport version
|
|
202
|
+
* @param crossDomain a boolean indicating whether the communication is cross domain
|
|
203
|
+
* @param url the URL to connect to
|
|
204
|
+
* @return true if this transport can work for the given version and cross domain communication case,
|
|
205
|
+
* false otherwise
|
|
206
|
+
*/
|
|
207
|
+
this.accept = function(version, crossDomain, url) {
|
|
208
|
+
throw "Abstract";
|
|
209
|
+
};
|
|
210
|
+
/**
|
|
211
|
+
* Returns the type of this transport.
|
|
212
|
+
* @see #registered(type, cometd)
|
|
213
|
+
*/
|
|
214
|
+
this.getType = function() {
|
|
215
|
+
return _type;
|
|
216
|
+
};
|
|
217
|
+
this.getURL = function() {
|
|
218
|
+
return _url;
|
|
219
|
+
};
|
|
220
|
+
this.setURL = function(url) {
|
|
221
|
+
_url = url;
|
|
222
|
+
};
|
|
223
|
+
this.send = function(envelope, metaConnect) {
|
|
224
|
+
throw "Abstract";
|
|
225
|
+
};
|
|
226
|
+
this.reset = function(init) {
|
|
227
|
+
this._debug("Transport", _type, "reset", init ? "initial" : "retry");
|
|
228
|
+
};
|
|
229
|
+
this.abort = function() {
|
|
230
|
+
this._debug("Transport", _type, "aborted");
|
|
231
|
+
};
|
|
232
|
+
this.toString = function() {
|
|
233
|
+
return this.getType();
|
|
234
|
+
};
|
|
235
|
+
};
|
|
236
|
+
Transport.derive = function(baseObject) {
|
|
237
|
+
function F() {}
|
|
238
|
+
F.prototype = baseObject;
|
|
239
|
+
return new F();
|
|
240
|
+
};
|
|
241
|
+
/**
|
|
242
|
+
* Base object with the common functionality for transports based on requests.
|
|
243
|
+
* The key responsibility is to allow at most 2 outstanding requests to the server,
|
|
244
|
+
* to avoid that requests are sent behind a long poll.
|
|
245
|
+
* To achieve this, we have one reserved request for the long poll, and all other
|
|
246
|
+
* requests are serialized one after the other.
|
|
247
|
+
*/
|
|
248
|
+
var RequestTransport = function() {
|
|
249
|
+
var _super = new Transport();
|
|
250
|
+
var _self = Transport.derive(_super);
|
|
251
|
+
var _requestIds = 0;
|
|
252
|
+
var _metaConnectRequest = null;
|
|
253
|
+
var _requests = [];
|
|
254
|
+
var _envelopes = [];
|
|
255
|
+
function _coalesceEnvelopes(envelope) {
|
|
256
|
+
while (_envelopes.length > 0) {
|
|
257
|
+
var envelopeAndRequest = _envelopes[0];
|
|
258
|
+
var newEnvelope = envelopeAndRequest[0];
|
|
259
|
+
var newRequest = envelopeAndRequest[1];
|
|
260
|
+
if (newEnvelope.url === envelope.url && newEnvelope.sync === envelope.sync) {
|
|
261
|
+
_envelopes.shift();
|
|
262
|
+
envelope.messages = envelope.messages.concat(newEnvelope.messages);
|
|
263
|
+
this._debug("Coalesced", newEnvelope.messages.length, "messages from request", newRequest.id);
|
|
264
|
+
continue;
|
|
265
|
+
}
|
|
266
|
+
break;
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
function _transportSend(envelope, request) {
|
|
270
|
+
this.transportSend(envelope, request);
|
|
271
|
+
request.expired = false;
|
|
272
|
+
if (!envelope.sync) {
|
|
273
|
+
var maxDelay = this.getConfiguration().maxNetworkDelay;
|
|
274
|
+
var delay = maxDelay;
|
|
275
|
+
if (request.metaConnect === true) delay += this.getAdvice().timeout;
|
|
276
|
+
this._debug("Transport", this.getType(), "waiting at most", delay, "ms for the response, maxNetworkDelay", maxDelay);
|
|
277
|
+
var self = this;
|
|
278
|
+
request.timeout = this.setTimeout(function() {
|
|
279
|
+
request.expired = true;
|
|
280
|
+
var errorMessage = "Request " + request.id + " of transport " + self.getType() + " exceeded " + delay + " ms max network delay";
|
|
281
|
+
var failure = { reason: errorMessage };
|
|
282
|
+
var xhr = request.xhr;
|
|
283
|
+
failure.httpCode = self.xhrStatus(xhr);
|
|
284
|
+
self.abortXHR(xhr);
|
|
285
|
+
self._debug(errorMessage);
|
|
286
|
+
self.complete(request, false, request.metaConnect);
|
|
287
|
+
envelope.onFailure(xhr, envelope.messages, failure);
|
|
288
|
+
}, delay);
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
function _queueSend(envelope) {
|
|
292
|
+
var requestId = ++_requestIds;
|
|
293
|
+
var request = {
|
|
294
|
+
id: requestId,
|
|
295
|
+
metaConnect: false,
|
|
296
|
+
envelope
|
|
297
|
+
};
|
|
298
|
+
if (_requests.length < this.getConfiguration().maxConnections - 1) {
|
|
299
|
+
_requests.push(request);
|
|
300
|
+
_transportSend.call(this, envelope, request);
|
|
301
|
+
} else {
|
|
302
|
+
this._debug("Transport", this.getType(), "queueing request", requestId, "envelope", envelope);
|
|
303
|
+
_envelopes.push([envelope, request]);
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
function _metaConnectComplete(request) {
|
|
307
|
+
var requestId = request.id;
|
|
308
|
+
this._debug("Transport", this.getType(), "/meta/connect complete, request", requestId);
|
|
309
|
+
if (_metaConnectRequest !== null && _metaConnectRequest.id !== requestId) throw "/meta/connect request mismatch, completing request " + requestId;
|
|
310
|
+
_metaConnectRequest = null;
|
|
311
|
+
}
|
|
312
|
+
function _complete(request, success) {
|
|
313
|
+
var index = Utils.inArray(request, _requests);
|
|
314
|
+
if (index >= 0) _requests.splice(index, 1);
|
|
315
|
+
if (_envelopes.length > 0) {
|
|
316
|
+
var envelopeAndRequest = _envelopes.shift();
|
|
317
|
+
var nextEnvelope = envelopeAndRequest[0];
|
|
318
|
+
var nextRequest = envelopeAndRequest[1];
|
|
319
|
+
this._debug("Transport dequeued request", nextRequest.id);
|
|
320
|
+
if (success) {
|
|
321
|
+
if (this.getConfiguration().autoBatch) _coalesceEnvelopes.call(this, nextEnvelope);
|
|
322
|
+
_queueSend.call(this, nextEnvelope);
|
|
323
|
+
this._debug("Transport completed request", request.id, nextEnvelope);
|
|
324
|
+
} else {
|
|
325
|
+
var self = this;
|
|
326
|
+
this.setTimeout(function() {
|
|
327
|
+
self.complete(nextRequest, false, nextRequest.metaConnect);
|
|
328
|
+
var failure = { reason: "Previous request failed" };
|
|
329
|
+
var xhr = nextRequest.xhr;
|
|
330
|
+
failure.httpCode = self.xhrStatus(xhr);
|
|
331
|
+
nextEnvelope.onFailure(xhr, nextEnvelope.messages, failure);
|
|
332
|
+
}, 0);
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
_self.complete = function(request, success, metaConnect) {
|
|
337
|
+
if (metaConnect) _metaConnectComplete.call(this, request);
|
|
338
|
+
else _complete.call(this, request, success);
|
|
339
|
+
};
|
|
340
|
+
/**
|
|
341
|
+
* Performs the actual send depending on the transport type details.
|
|
342
|
+
* @param envelope the envelope to send
|
|
343
|
+
* @param request the request information
|
|
344
|
+
*/
|
|
345
|
+
_self.transportSend = function(envelope, request) {
|
|
346
|
+
throw "Abstract";
|
|
347
|
+
};
|
|
348
|
+
_self.transportSuccess = function(envelope, request, responses) {
|
|
349
|
+
if (!request.expired) {
|
|
350
|
+
this.clearTimeout(request.timeout);
|
|
351
|
+
this.complete(request, true, request.metaConnect);
|
|
352
|
+
if (responses && responses.length > 0) envelope.onSuccess(responses);
|
|
353
|
+
else envelope.onFailure(request.xhr, envelope.messages, { httpCode: 204 });
|
|
354
|
+
}
|
|
355
|
+
};
|
|
356
|
+
_self.transportFailure = function(envelope, request, failure) {
|
|
357
|
+
if (!request.expired) {
|
|
358
|
+
this.clearTimeout(request.timeout);
|
|
359
|
+
this.complete(request, false, request.metaConnect);
|
|
360
|
+
envelope.onFailure(request.xhr, envelope.messages, failure);
|
|
361
|
+
}
|
|
362
|
+
};
|
|
363
|
+
function _metaConnectSend(envelope) {
|
|
364
|
+
if (_metaConnectRequest !== null) throw "Concurrent /meta/connect requests not allowed, request id=" + _metaConnectRequest.id + " not yet completed";
|
|
365
|
+
var requestId = ++_requestIds;
|
|
366
|
+
this._debug("Transport", this.getType(), "/meta/connect send, request", requestId, "envelope", envelope);
|
|
367
|
+
var request = {
|
|
368
|
+
id: requestId,
|
|
369
|
+
metaConnect: true,
|
|
370
|
+
envelope
|
|
371
|
+
};
|
|
372
|
+
_transportSend.call(this, envelope, request);
|
|
373
|
+
_metaConnectRequest = request;
|
|
374
|
+
}
|
|
375
|
+
_self.send = function(envelope, metaConnect) {
|
|
376
|
+
if (metaConnect) _metaConnectSend.call(this, envelope);
|
|
377
|
+
else _queueSend.call(this, envelope);
|
|
378
|
+
};
|
|
379
|
+
_self.abort = function() {
|
|
380
|
+
_super.abort();
|
|
381
|
+
for (var i = 0; i < _requests.length; ++i) {
|
|
382
|
+
var request = _requests[i];
|
|
383
|
+
if (request) {
|
|
384
|
+
this._debug("Aborting request", request);
|
|
385
|
+
if (!this.abortXHR(request.xhr)) this.transportFailure(request.envelope, request, { reason: "abort" });
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
var metaConnectRequest = _metaConnectRequest;
|
|
389
|
+
if (metaConnectRequest) {
|
|
390
|
+
this._debug("Aborting /meta/connect request", metaConnectRequest);
|
|
391
|
+
if (!this.abortXHR(metaConnectRequest.xhr)) this.transportFailure(metaConnectRequest.envelope, metaConnectRequest, { reason: "abort" });
|
|
392
|
+
}
|
|
393
|
+
this.reset(true);
|
|
394
|
+
};
|
|
395
|
+
_self.reset = function(init) {
|
|
396
|
+
_super.reset(init);
|
|
397
|
+
_metaConnectRequest = null;
|
|
398
|
+
_requests = [];
|
|
399
|
+
_envelopes = [];
|
|
400
|
+
};
|
|
401
|
+
_self.abortXHR = function(xhr) {
|
|
402
|
+
if (xhr) try {
|
|
403
|
+
var state = xhr.readyState;
|
|
404
|
+
xhr.abort();
|
|
405
|
+
return state !== window.XMLHttpRequest.UNSENT;
|
|
406
|
+
} catch (x) {
|
|
407
|
+
this._debug(x);
|
|
408
|
+
}
|
|
409
|
+
return false;
|
|
410
|
+
};
|
|
411
|
+
_self.xhrStatus = function(xhr) {
|
|
412
|
+
if (xhr) try {
|
|
413
|
+
return xhr.status;
|
|
414
|
+
} catch (x) {
|
|
415
|
+
this._debug(x);
|
|
416
|
+
}
|
|
417
|
+
return -1;
|
|
418
|
+
};
|
|
419
|
+
return _self;
|
|
420
|
+
};
|
|
421
|
+
var LongPollingTransport = function() {
|
|
422
|
+
var _super = new RequestTransport();
|
|
423
|
+
var _self = Transport.derive(_super);
|
|
424
|
+
var _supportsCrossDomain = true;
|
|
425
|
+
_self.accept = function(version, crossDomain, url) {
|
|
426
|
+
return _supportsCrossDomain || !crossDomain;
|
|
427
|
+
};
|
|
428
|
+
_self.newXMLHttpRequest = function() {
|
|
429
|
+
return new window.XMLHttpRequest();
|
|
430
|
+
};
|
|
431
|
+
function _copyContext(xhr) {
|
|
432
|
+
try {
|
|
433
|
+
xhr.context = _self.context;
|
|
434
|
+
} catch (e) {
|
|
435
|
+
this._debug("Could not copy transport context into XHR", e);
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
_self.xhrSend = function(packet) {
|
|
439
|
+
var xhr = _self.newXMLHttpRequest();
|
|
440
|
+
_copyContext(xhr);
|
|
441
|
+
xhr.withCredentials = true;
|
|
442
|
+
xhr.open("POST", packet.url, packet.sync !== true);
|
|
443
|
+
var headers = packet.headers;
|
|
444
|
+
if (headers) {
|
|
445
|
+
for (var headerName in headers) if (headers.hasOwnProperty(headerName)) xhr.setRequestHeader(headerName, headers[headerName]);
|
|
446
|
+
}
|
|
447
|
+
xhr.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
|
|
448
|
+
xhr.onload = function() {
|
|
449
|
+
if (xhr.status === 200) packet.onSuccess(xhr.responseText);
|
|
450
|
+
else packet.onError(xhr.statusText);
|
|
451
|
+
};
|
|
452
|
+
xhr.onabort = xhr.onerror = function() {
|
|
453
|
+
packet.onError(xhr.statusText);
|
|
454
|
+
};
|
|
455
|
+
xhr.send(packet.body);
|
|
456
|
+
return xhr;
|
|
457
|
+
};
|
|
458
|
+
_self.transportSend = function(envelope, request) {
|
|
459
|
+
this._debug("Transport", this.getType(), "sending request", request.id, "envelope", envelope);
|
|
460
|
+
var self = this;
|
|
461
|
+
try {
|
|
462
|
+
var sameStack = true;
|
|
463
|
+
request.xhr = this.xhrSend({
|
|
464
|
+
transport: this,
|
|
465
|
+
url: envelope.url,
|
|
466
|
+
sync: envelope.sync,
|
|
467
|
+
headers: this.getConfiguration().requestHeaders,
|
|
468
|
+
body: JSON.stringify(envelope.messages),
|
|
469
|
+
onSuccess: function(response) {
|
|
470
|
+
self._debug("Transport", self.getType(), "received response", response);
|
|
471
|
+
var success = false;
|
|
472
|
+
try {
|
|
473
|
+
var received = self.convertToMessages(response);
|
|
474
|
+
if (received.length === 0) {
|
|
475
|
+
_supportsCrossDomain = false;
|
|
476
|
+
self.transportFailure(envelope, request, { httpCode: 204 });
|
|
477
|
+
} else {
|
|
478
|
+
success = true;
|
|
479
|
+
self.transportSuccess(envelope, request, received);
|
|
480
|
+
}
|
|
481
|
+
} catch (x) {
|
|
482
|
+
self._debug(x);
|
|
483
|
+
if (!success) {
|
|
484
|
+
_supportsCrossDomain = false;
|
|
485
|
+
var failure = { exception: x };
|
|
486
|
+
failure.httpCode = self.xhrStatus(request.xhr);
|
|
487
|
+
self.transportFailure(envelope, request, failure);
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
},
|
|
491
|
+
onError: function(reason, exception) {
|
|
492
|
+
self._debug("Transport", self.getType(), "received error", reason, exception);
|
|
493
|
+
_supportsCrossDomain = false;
|
|
494
|
+
var failure = {
|
|
495
|
+
reason,
|
|
496
|
+
exception
|
|
497
|
+
};
|
|
498
|
+
failure.httpCode = self.xhrStatus(request.xhr);
|
|
499
|
+
if (sameStack) self.setTimeout(function() {
|
|
500
|
+
self.transportFailure(envelope, request, failure);
|
|
501
|
+
}, 0);
|
|
502
|
+
else self.transportFailure(envelope, request, failure);
|
|
503
|
+
}
|
|
504
|
+
});
|
|
505
|
+
sameStack = false;
|
|
506
|
+
} catch (x) {
|
|
507
|
+
_supportsCrossDomain = false;
|
|
508
|
+
this.setTimeout(function() {
|
|
509
|
+
self.transportFailure(envelope, request, { exception: x });
|
|
510
|
+
}, 0);
|
|
511
|
+
}
|
|
512
|
+
};
|
|
513
|
+
_self.reset = function(init) {
|
|
514
|
+
_super.reset(init);
|
|
515
|
+
_supportsCrossDomain = true;
|
|
516
|
+
};
|
|
517
|
+
return _self;
|
|
518
|
+
};
|
|
519
|
+
var CallbackPollingTransport = function() {
|
|
520
|
+
var _super = new RequestTransport();
|
|
521
|
+
var _self = Transport.derive(_super);
|
|
522
|
+
var jsonp = 0;
|
|
523
|
+
_self.accept = function(version, crossDomain, url) {
|
|
524
|
+
return true;
|
|
525
|
+
};
|
|
526
|
+
_self.jsonpSend = function(packet) {
|
|
527
|
+
var head = document.getElementsByTagName("head")[0];
|
|
528
|
+
var script = document.createElement("script");
|
|
529
|
+
var callbackName = "_cometd_jsonp_" + jsonp++;
|
|
530
|
+
window[callbackName] = function(responseText) {
|
|
531
|
+
head.removeChild(script);
|
|
532
|
+
delete window[callbackName];
|
|
533
|
+
packet.onSuccess(responseText);
|
|
534
|
+
};
|
|
535
|
+
var url = packet.url;
|
|
536
|
+
url += url.indexOf("?") < 0 ? "?" : "&";
|
|
537
|
+
url += "jsonp=" + callbackName;
|
|
538
|
+
url += "&message=" + encodeURIComponent(packet.body);
|
|
539
|
+
script.src = url;
|
|
540
|
+
script.async = packet.sync !== true;
|
|
541
|
+
script.type = "application/javascript";
|
|
542
|
+
script.onerror = function(e) {
|
|
543
|
+
packet.onError("jsonp " + e.type);
|
|
544
|
+
};
|
|
545
|
+
head.appendChild(script);
|
|
546
|
+
};
|
|
547
|
+
function _failTransportFn(envelope, request, x) {
|
|
548
|
+
var self = this;
|
|
549
|
+
return function() {
|
|
550
|
+
self.transportFailure(envelope, request, "error", x);
|
|
551
|
+
};
|
|
552
|
+
}
|
|
553
|
+
_self.transportSend = function(envelope, request) {
|
|
554
|
+
var self = this;
|
|
555
|
+
var start = 0;
|
|
556
|
+
var length = envelope.messages.length;
|
|
557
|
+
var lengths = [];
|
|
558
|
+
while (length > 0) {
|
|
559
|
+
var json = JSON.stringify(envelope.messages.slice(start, start + length));
|
|
560
|
+
var urlLength = envelope.url.length + encodeURI(json).length;
|
|
561
|
+
var maxLength = this.getConfiguration().maxURILength;
|
|
562
|
+
if (urlLength > maxLength) {
|
|
563
|
+
if (length === 1) {
|
|
564
|
+
var x = "Bayeux message too big (" + urlLength + " bytes, max is " + maxLength + ") for transport " + this.getType();
|
|
565
|
+
this.setTimeout(_failTransportFn.call(this, envelope, request, x), 0);
|
|
566
|
+
return;
|
|
567
|
+
}
|
|
568
|
+
--length;
|
|
569
|
+
continue;
|
|
570
|
+
}
|
|
571
|
+
lengths.push(length);
|
|
572
|
+
start += length;
|
|
573
|
+
length = envelope.messages.length - start;
|
|
574
|
+
}
|
|
575
|
+
var envelopeToSend = envelope;
|
|
576
|
+
if (lengths.length > 1) {
|
|
577
|
+
var begin = 0;
|
|
578
|
+
var end = lengths[0];
|
|
579
|
+
this._debug("Transport", this.getType(), "split", envelope.messages.length, "messages into", lengths.join(" + "));
|
|
580
|
+
envelopeToSend = this._mixin(false, {}, envelope);
|
|
581
|
+
envelopeToSend.messages = envelope.messages.slice(begin, end);
|
|
582
|
+
envelopeToSend.onSuccess = envelope.onSuccess;
|
|
583
|
+
envelopeToSend.onFailure = envelope.onFailure;
|
|
584
|
+
for (var i = 1; i < lengths.length; ++i) {
|
|
585
|
+
var nextEnvelope = this._mixin(false, {}, envelope);
|
|
586
|
+
begin = end;
|
|
587
|
+
end += lengths[i];
|
|
588
|
+
nextEnvelope.messages = envelope.messages.slice(begin, end);
|
|
589
|
+
nextEnvelope.onSuccess = envelope.onSuccess;
|
|
590
|
+
nextEnvelope.onFailure = envelope.onFailure;
|
|
591
|
+
this.send(nextEnvelope, request.metaConnect);
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
this._debug("Transport", this.getType(), "sending request", request.id, "envelope", envelopeToSend);
|
|
595
|
+
try {
|
|
596
|
+
var sameStack = true;
|
|
597
|
+
this.jsonpSend({
|
|
598
|
+
transport: this,
|
|
599
|
+
url: envelopeToSend.url,
|
|
600
|
+
sync: envelopeToSend.sync,
|
|
601
|
+
headers: this.getConfiguration().requestHeaders,
|
|
602
|
+
body: JSON.stringify(envelopeToSend.messages),
|
|
603
|
+
onSuccess: function(responses) {
|
|
604
|
+
var success = false;
|
|
605
|
+
try {
|
|
606
|
+
var received = self.convertToMessages(responses);
|
|
607
|
+
if (received.length === 0) self.transportFailure(envelopeToSend, request, { httpCode: 204 });
|
|
608
|
+
else {
|
|
609
|
+
success = true;
|
|
610
|
+
self.transportSuccess(envelopeToSend, request, received);
|
|
611
|
+
}
|
|
612
|
+
} catch (x) {
|
|
613
|
+
self._debug(x);
|
|
614
|
+
if (!success) self.transportFailure(envelopeToSend, request, { exception: x });
|
|
615
|
+
}
|
|
616
|
+
},
|
|
617
|
+
onError: function(reason, exception) {
|
|
618
|
+
var failure = {
|
|
619
|
+
reason,
|
|
620
|
+
exception
|
|
621
|
+
};
|
|
622
|
+
if (sameStack) self.setTimeout(function() {
|
|
623
|
+
self.transportFailure(envelopeToSend, request, failure);
|
|
624
|
+
}, 0);
|
|
625
|
+
else self.transportFailure(envelopeToSend, request, failure);
|
|
626
|
+
}
|
|
627
|
+
});
|
|
628
|
+
sameStack = false;
|
|
629
|
+
} catch (xx) {
|
|
630
|
+
this.setTimeout(function() {
|
|
631
|
+
self.transportFailure(envelopeToSend, request, { exception: xx });
|
|
632
|
+
}, 0);
|
|
633
|
+
}
|
|
634
|
+
};
|
|
635
|
+
return _self;
|
|
636
|
+
};
|
|
637
|
+
var WebSocketTransport = function() {
|
|
638
|
+
var _super = new Transport();
|
|
639
|
+
var _self = Transport.derive(_super);
|
|
640
|
+
var _cometd;
|
|
641
|
+
var _webSocketSupported = true;
|
|
642
|
+
var _webSocketConnected = false;
|
|
643
|
+
var _stickyReconnect = true;
|
|
644
|
+
var _context = null;
|
|
645
|
+
var _connecting = null;
|
|
646
|
+
var _connected = false;
|
|
647
|
+
var _successCallback = null;
|
|
648
|
+
_self.reset = function(init) {
|
|
649
|
+
_super.reset(init);
|
|
650
|
+
_webSocketSupported = true;
|
|
651
|
+
if (init) _webSocketConnected = false;
|
|
652
|
+
_stickyReconnect = true;
|
|
653
|
+
_context = null;
|
|
654
|
+
_connecting = null;
|
|
655
|
+
_connected = false;
|
|
656
|
+
};
|
|
657
|
+
function _forceClose(context, event) {
|
|
658
|
+
if (context) {
|
|
659
|
+
this.webSocketClose(context, event.code, event.reason);
|
|
660
|
+
this.onClose(context, event);
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
function _sameContext(context) {
|
|
664
|
+
return context === _connecting || context === _context;
|
|
665
|
+
}
|
|
666
|
+
function _storeEnvelope(context, envelope, metaConnect) {
|
|
667
|
+
var messageIds = [];
|
|
668
|
+
for (var i = 0; i < envelope.messages.length; ++i) {
|
|
669
|
+
var message = envelope.messages[i];
|
|
670
|
+
if (message.id) messageIds.push(message.id);
|
|
671
|
+
}
|
|
672
|
+
context.envelopes[messageIds.join(",")] = [envelope, metaConnect];
|
|
673
|
+
this._debug("Transport", this.getType(), "stored envelope, envelopes", context.envelopes);
|
|
674
|
+
}
|
|
675
|
+
function _websocketConnect(context) {
|
|
676
|
+
if (_connecting) return;
|
|
677
|
+
var url = _cometd.getURL().replace(/^http/, "ws");
|
|
678
|
+
this._debug("Transport", this.getType(), "connecting to URL", url);
|
|
679
|
+
try {
|
|
680
|
+
var protocol = _cometd.getConfiguration().protocol;
|
|
681
|
+
context.webSocket = protocol ? new window.WebSocket(url, protocol) : new window.WebSocket(url);
|
|
682
|
+
_connecting = context;
|
|
683
|
+
} catch (x) {
|
|
684
|
+
_webSocketSupported = false;
|
|
685
|
+
this._debug("Exception while creating WebSocket object", x);
|
|
686
|
+
throw x;
|
|
687
|
+
}
|
|
688
|
+
_stickyReconnect = _cometd.getConfiguration().stickyReconnect !== false;
|
|
689
|
+
var self = this;
|
|
690
|
+
var connectTimeout = _cometd.getConfiguration().connectTimeout;
|
|
691
|
+
if (connectTimeout > 0) context.connectTimer = this.setTimeout(function() {
|
|
692
|
+
_cometd._debug("Transport", self.getType(), "timed out while connecting to URL", url, ":", connectTimeout, "ms");
|
|
693
|
+
_forceClose.call(self, context, {
|
|
694
|
+
code: 1e3,
|
|
695
|
+
reason: "Connect Timeout"
|
|
696
|
+
});
|
|
697
|
+
}, connectTimeout);
|
|
698
|
+
var onopen = function() {
|
|
699
|
+
_cometd._debug("WebSocket onopen", context);
|
|
700
|
+
if (context.connectTimer) self.clearTimeout(context.connectTimer);
|
|
701
|
+
if (_sameContext(context)) {
|
|
702
|
+
_connecting = null;
|
|
703
|
+
_context = context;
|
|
704
|
+
_webSocketConnected = true;
|
|
705
|
+
self.onOpen(context);
|
|
706
|
+
} else {
|
|
707
|
+
_cometd._warn("Closing extra WebSocket connection", this, "active connection", _context);
|
|
708
|
+
_forceClose.call(self, context, {
|
|
709
|
+
code: 1e3,
|
|
710
|
+
reason: "Extra Connection"
|
|
711
|
+
});
|
|
712
|
+
}
|
|
713
|
+
};
|
|
714
|
+
var onclose = function(event) {
|
|
715
|
+
event = event || { code: 1e3 };
|
|
716
|
+
_cometd._debug("WebSocket onclose", context, event, "connecting", _connecting, "current", _context);
|
|
717
|
+
if (context.connectTimer) self.clearTimeout(context.connectTimer);
|
|
718
|
+
self.onClose(context, event);
|
|
719
|
+
};
|
|
720
|
+
var onmessage = function(wsMessage) {
|
|
721
|
+
_cometd._debug("WebSocket onmessage", wsMessage, context);
|
|
722
|
+
self.onMessage(context, wsMessage);
|
|
723
|
+
};
|
|
724
|
+
context.webSocket.onopen = onopen;
|
|
725
|
+
context.webSocket.onclose = onclose;
|
|
726
|
+
context.webSocket.onerror = function() {
|
|
727
|
+
onclose({
|
|
728
|
+
code: 1e3,
|
|
729
|
+
reason: "Error"
|
|
730
|
+
});
|
|
731
|
+
};
|
|
732
|
+
context.webSocket.onmessage = onmessage;
|
|
733
|
+
this._debug("Transport", this.getType(), "configured callbacks on", context);
|
|
734
|
+
}
|
|
735
|
+
function _webSocketSend(context, envelope, metaConnect) {
|
|
736
|
+
var json = JSON.stringify(envelope.messages);
|
|
737
|
+
context.webSocket.send(json);
|
|
738
|
+
this._debug("Transport", this.getType(), "sent", envelope, "/meta/connect =", metaConnect);
|
|
739
|
+
var maxDelay = this.getConfiguration().maxNetworkDelay;
|
|
740
|
+
var delay = maxDelay;
|
|
741
|
+
if (metaConnect) {
|
|
742
|
+
delay += this.getAdvice().timeout;
|
|
743
|
+
_connected = true;
|
|
744
|
+
}
|
|
745
|
+
var self = this;
|
|
746
|
+
var messageIds = [];
|
|
747
|
+
for (var i = 0; i < envelope.messages.length; ++i) (function() {
|
|
748
|
+
var message = envelope.messages[i];
|
|
749
|
+
if (message.id) {
|
|
750
|
+
messageIds.push(message.id);
|
|
751
|
+
context.timeouts[message.id] = self.setTimeout(function() {
|
|
752
|
+
_cometd._debug("Transport", self.getType(), "timing out message", message.id, "after", delay, "on", context);
|
|
753
|
+
_forceClose.call(self, context, {
|
|
754
|
+
code: 1e3,
|
|
755
|
+
reason: "Message Timeout"
|
|
756
|
+
});
|
|
757
|
+
}, delay);
|
|
758
|
+
}
|
|
759
|
+
})();
|
|
760
|
+
this._debug("Transport", this.getType(), "waiting at most", delay, "ms for messages", messageIds, "maxNetworkDelay", maxDelay, ", timeouts:", context.timeouts);
|
|
761
|
+
}
|
|
762
|
+
_self._notifySuccess = function(fn, messages) {
|
|
763
|
+
fn.call(this, messages);
|
|
764
|
+
};
|
|
765
|
+
_self._notifyFailure = function(fn, context, messages, failure) {
|
|
766
|
+
fn.call(this, context, messages, failure);
|
|
767
|
+
};
|
|
768
|
+
function _send(context, envelope, metaConnect) {
|
|
769
|
+
try {
|
|
770
|
+
if (context === null) {
|
|
771
|
+
context = _connecting || {
|
|
772
|
+
envelopes: {},
|
|
773
|
+
timeouts: {}
|
|
774
|
+
};
|
|
775
|
+
_storeEnvelope.call(this, context, envelope, metaConnect);
|
|
776
|
+
_websocketConnect.call(this, context);
|
|
777
|
+
} else {
|
|
778
|
+
_storeEnvelope.call(this, context, envelope, metaConnect);
|
|
779
|
+
_webSocketSend.call(this, context, envelope, metaConnect);
|
|
780
|
+
}
|
|
781
|
+
} catch (x) {
|
|
782
|
+
var self = this;
|
|
783
|
+
this.setTimeout(function() {
|
|
784
|
+
_forceClose.call(self, context, {
|
|
785
|
+
code: 1e3,
|
|
786
|
+
reason: "Exception",
|
|
787
|
+
exception: x
|
|
788
|
+
});
|
|
789
|
+
}, 0);
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
_self.onOpen = function(context) {
|
|
793
|
+
var envelopes = context.envelopes;
|
|
794
|
+
this._debug("Transport", this.getType(), "opened", context, "pending messages", envelopes);
|
|
795
|
+
for (var key in envelopes) if (envelopes.hasOwnProperty(key)) {
|
|
796
|
+
var element = envelopes[key];
|
|
797
|
+
var envelope = element[0];
|
|
798
|
+
var metaConnect = element[1];
|
|
799
|
+
_successCallback = envelope.onSuccess;
|
|
800
|
+
_webSocketSend.call(this, context, envelope, metaConnect);
|
|
801
|
+
}
|
|
802
|
+
};
|
|
803
|
+
_self.onMessage = function(context, wsMessage) {
|
|
804
|
+
this._debug("Transport", this.getType(), "received websocket message", wsMessage, context);
|
|
805
|
+
var close = false;
|
|
806
|
+
var messages = this.convertToMessages(wsMessage.data);
|
|
807
|
+
var messageIds = [];
|
|
808
|
+
for (var i = 0; i < messages.length; ++i) {
|
|
809
|
+
var message = messages[i];
|
|
810
|
+
if (/^\/meta\//.test(message.channel) || message.data === void 0) {
|
|
811
|
+
if (message.id) {
|
|
812
|
+
messageIds.push(message.id);
|
|
813
|
+
var timeout = context.timeouts[message.id];
|
|
814
|
+
if (timeout) {
|
|
815
|
+
this.clearTimeout(timeout);
|
|
816
|
+
delete context.timeouts[message.id];
|
|
817
|
+
this._debug("Transport", this.getType(), "removed timeout for message", message.id, ", timeouts", context.timeouts);
|
|
818
|
+
}
|
|
819
|
+
}
|
|
820
|
+
}
|
|
821
|
+
if ("/meta/connect" === message.channel) _connected = false;
|
|
822
|
+
if ("/meta/disconnect" === message.channel && !_connected) close = true;
|
|
823
|
+
}
|
|
824
|
+
var removed = false;
|
|
825
|
+
var envelopes = context.envelopes;
|
|
826
|
+
for (var j = 0; j < messageIds.length; ++j) {
|
|
827
|
+
var id = messageIds[j];
|
|
828
|
+
for (var key in envelopes) if (envelopes.hasOwnProperty(key)) {
|
|
829
|
+
var ids = key.split(",");
|
|
830
|
+
var index = Utils.inArray(id, ids);
|
|
831
|
+
if (index >= 0) {
|
|
832
|
+
removed = true;
|
|
833
|
+
ids.splice(index, 1);
|
|
834
|
+
var envelope = envelopes[key][0];
|
|
835
|
+
var metaConnect = envelopes[key][1];
|
|
836
|
+
delete envelopes[key];
|
|
837
|
+
if (ids.length > 0) envelopes[ids.join(",")] = [envelope, metaConnect];
|
|
838
|
+
break;
|
|
839
|
+
}
|
|
840
|
+
}
|
|
841
|
+
}
|
|
842
|
+
if (removed) this._debug("Transport", this.getType(), "removed envelope, envelopes", envelopes);
|
|
843
|
+
this._notifySuccess(_successCallback, messages);
|
|
844
|
+
if (close) this.webSocketClose(context, 1e3, "Disconnect");
|
|
845
|
+
};
|
|
846
|
+
_self.onClose = function(context, event) {
|
|
847
|
+
this._debug("Transport", this.getType(), "closed", context, event);
|
|
848
|
+
if (_sameContext(context)) {
|
|
849
|
+
_webSocketSupported = _stickyReconnect && _webSocketConnected;
|
|
850
|
+
_connecting = null;
|
|
851
|
+
_context = null;
|
|
852
|
+
}
|
|
853
|
+
var timeouts = context.timeouts;
|
|
854
|
+
context.timeouts = {};
|
|
855
|
+
for (var id in timeouts) if (timeouts.hasOwnProperty(id)) this.clearTimeout(timeouts[id]);
|
|
856
|
+
var envelopes = context.envelopes;
|
|
857
|
+
context.envelopes = {};
|
|
858
|
+
for (var key in envelopes) if (envelopes.hasOwnProperty(key)) {
|
|
859
|
+
var envelope = envelopes[key][0];
|
|
860
|
+
if (envelopes[key][1]) _connected = false;
|
|
861
|
+
var failure = {
|
|
862
|
+
websocketCode: event.code,
|
|
863
|
+
reason: event.reason
|
|
864
|
+
};
|
|
865
|
+
if (event.exception) failure.exception = event.exception;
|
|
866
|
+
this._notifyFailure(envelope.onFailure, context, envelope.messages, failure);
|
|
867
|
+
}
|
|
868
|
+
};
|
|
869
|
+
_self.registered = function(type, cometd) {
|
|
870
|
+
_super.registered(type, cometd);
|
|
871
|
+
_cometd = cometd;
|
|
872
|
+
};
|
|
873
|
+
_self.accept = function(version, crossDomain, url) {
|
|
874
|
+
this._debug("Transport", this.getType(), "accept, supported:", _webSocketSupported);
|
|
875
|
+
return _webSocketSupported && !!window.WebSocket && _cometd.websocketEnabled !== false;
|
|
876
|
+
};
|
|
877
|
+
_self.send = function(envelope, metaConnect) {
|
|
878
|
+
this._debug("Transport", this.getType(), "sending", envelope, "/meta/connect =", metaConnect);
|
|
879
|
+
_send.call(this, _context, envelope, metaConnect);
|
|
880
|
+
};
|
|
881
|
+
_self.webSocketClose = function(context, code, reason) {
|
|
882
|
+
try {
|
|
883
|
+
if (context.webSocket) context.webSocket.close(code, reason);
|
|
884
|
+
} catch (x) {
|
|
885
|
+
this._debug(x);
|
|
886
|
+
}
|
|
887
|
+
};
|
|
888
|
+
_self.abort = function() {
|
|
889
|
+
_super.abort();
|
|
890
|
+
_forceClose.call(this, _context, {
|
|
891
|
+
code: 1e3,
|
|
892
|
+
reason: "Abort"
|
|
893
|
+
});
|
|
894
|
+
this.reset(true);
|
|
895
|
+
};
|
|
896
|
+
return _self;
|
|
897
|
+
};
|
|
898
|
+
/**
|
|
899
|
+
* The constructor for a CometD object, identified by an optional name.
|
|
900
|
+
* The default name is the string 'default'.
|
|
901
|
+
* @param name the optional name of this cometd object
|
|
902
|
+
*/
|
|
903
|
+
var CometD = function(name) {
|
|
904
|
+
var _scheduler = new Scheduler();
|
|
905
|
+
var _cometd = this;
|
|
906
|
+
var _name = name || "default";
|
|
907
|
+
var _crossDomain = false;
|
|
908
|
+
var _transports = new TransportRegistry();
|
|
909
|
+
var _transport;
|
|
910
|
+
var _status = "disconnected";
|
|
911
|
+
var _messageId = 0;
|
|
912
|
+
var _clientId = null;
|
|
913
|
+
var _batch = 0;
|
|
914
|
+
var _messageQueue = [];
|
|
915
|
+
var _internalBatch = false;
|
|
916
|
+
var _listenerId = 0;
|
|
917
|
+
var _listeners = {};
|
|
918
|
+
var _backoff = 0;
|
|
919
|
+
var _scheduledSend = null;
|
|
920
|
+
var _extensions = [];
|
|
921
|
+
var _advice = {};
|
|
922
|
+
var _handshakeProps;
|
|
923
|
+
var _handshakeCallback;
|
|
924
|
+
var _callbacks = {};
|
|
925
|
+
var _remoteCalls = {};
|
|
926
|
+
var _reestablish = false;
|
|
927
|
+
var _connected = false;
|
|
928
|
+
var _unconnectTime = 0;
|
|
929
|
+
var _handshakeMessages = 0;
|
|
930
|
+
var _metaConnect = null;
|
|
931
|
+
var _config = {
|
|
932
|
+
useWorkerScheduler: true,
|
|
933
|
+
protocol: null,
|
|
934
|
+
stickyReconnect: true,
|
|
935
|
+
connectTimeout: 0,
|
|
936
|
+
maxConnections: 2,
|
|
937
|
+
backoffIncrement: 1e3,
|
|
938
|
+
maxBackoff: 6e4,
|
|
939
|
+
logLevel: "info",
|
|
940
|
+
maxNetworkDelay: 1e4,
|
|
941
|
+
requestHeaders: {},
|
|
942
|
+
appendMessageTypeToURL: true,
|
|
943
|
+
autoBatch: false,
|
|
944
|
+
urls: {},
|
|
945
|
+
maxURILength: 2e3,
|
|
946
|
+
advice: {
|
|
947
|
+
timeout: 6e4,
|
|
948
|
+
interval: 0,
|
|
949
|
+
reconnect: void 0,
|
|
950
|
+
maxInterval: 0
|
|
951
|
+
}
|
|
952
|
+
};
|
|
953
|
+
function _fieldValue(object, name) {
|
|
954
|
+
try {
|
|
955
|
+
return object[name];
|
|
956
|
+
} catch (x) {
|
|
957
|
+
return;
|
|
958
|
+
}
|
|
959
|
+
}
|
|
960
|
+
/**
|
|
961
|
+
* Mixes in the given objects into the target object by copying the properties.
|
|
962
|
+
* @param deep if the copy must be deep
|
|
963
|
+
* @param target the target object
|
|
964
|
+
* @param objects the objects whose properties are copied into the target
|
|
965
|
+
*/
|
|
966
|
+
this._mixin = function(deep, target, objects) {
|
|
967
|
+
var result = target || {};
|
|
968
|
+
for (var i = 2; i < arguments.length; ++i) {
|
|
969
|
+
var object = arguments[i];
|
|
970
|
+
if (object === void 0 || object === null) continue;
|
|
971
|
+
for (var propName in object) if (object.hasOwnProperty(propName)) {
|
|
972
|
+
var prop = _fieldValue(object, propName);
|
|
973
|
+
var targ = _fieldValue(result, propName);
|
|
974
|
+
if (prop === target) continue;
|
|
975
|
+
if (prop === void 0) continue;
|
|
976
|
+
if (deep && typeof prop === "object" && prop !== null) if (prop instanceof Array) result[propName] = this._mixin(deep, targ instanceof Array ? targ : [], prop);
|
|
977
|
+
else {
|
|
978
|
+
var source = typeof targ === "object" && !(targ instanceof Array) ? targ : {};
|
|
979
|
+
result[propName] = this._mixin(deep, source, prop);
|
|
980
|
+
}
|
|
981
|
+
else result[propName] = prop;
|
|
982
|
+
}
|
|
983
|
+
}
|
|
984
|
+
return result;
|
|
985
|
+
};
|
|
986
|
+
function _isString(value) {
|
|
987
|
+
return Utils.isString(value);
|
|
988
|
+
}
|
|
989
|
+
function _isFunction(value) {
|
|
990
|
+
if (value === void 0 || value === null) return false;
|
|
991
|
+
return typeof value === "function";
|
|
992
|
+
}
|
|
993
|
+
function _zeroPad(value, length) {
|
|
994
|
+
var result = "";
|
|
995
|
+
while (--length > 0) {
|
|
996
|
+
if (value >= Math.pow(10, length)) break;
|
|
997
|
+
result += "0";
|
|
998
|
+
}
|
|
999
|
+
result += value;
|
|
1000
|
+
return result;
|
|
1001
|
+
}
|
|
1002
|
+
function _log(level, args) {
|
|
1003
|
+
if (window.console) {
|
|
1004
|
+
var logger = window.console[level];
|
|
1005
|
+
if (_isFunction(logger)) {
|
|
1006
|
+
var now = /* @__PURE__ */ new Date();
|
|
1007
|
+
[].splice.call(args, 0, 0, _zeroPad(now.getHours(), 2) + ":" + _zeroPad(now.getMinutes(), 2) + ":" + _zeroPad(now.getSeconds(), 2) + "." + _zeroPad(now.getMilliseconds(), 3));
|
|
1008
|
+
logger.apply(window.console, args);
|
|
1009
|
+
}
|
|
1010
|
+
}
|
|
1011
|
+
}
|
|
1012
|
+
this._warn = function() {
|
|
1013
|
+
_log("warn", arguments);
|
|
1014
|
+
};
|
|
1015
|
+
this._info = function() {
|
|
1016
|
+
if (_config.logLevel !== "warn") _log("info", arguments);
|
|
1017
|
+
};
|
|
1018
|
+
this._debug = function() {
|
|
1019
|
+
if (_config.logLevel === "debug") _log("debug", arguments);
|
|
1020
|
+
};
|
|
1021
|
+
function _splitURL(url) {
|
|
1022
|
+
return (/* @__PURE__ */ new RegExp("(^https?://)?(((\\[[^\\]]+])|([^:/?#]+))(:(\\d+))?)?([^?#]*)(.*)?")).exec(url);
|
|
1023
|
+
}
|
|
1024
|
+
/**
|
|
1025
|
+
* Returns whether the given hostAndPort is cross domain.
|
|
1026
|
+
* The default implementation checks against window.location.host
|
|
1027
|
+
* but this function can be overridden to make it work in non-browser
|
|
1028
|
+
* environments.
|
|
1029
|
+
*
|
|
1030
|
+
* @param hostAndPort the host and port in format host:port
|
|
1031
|
+
* @return whether the given hostAndPort is cross domain
|
|
1032
|
+
*/
|
|
1033
|
+
this._isCrossDomain = function(hostAndPort) {
|
|
1034
|
+
if (window.location && window.location.host) {
|
|
1035
|
+
if (hostAndPort) return hostAndPort !== window.location.host;
|
|
1036
|
+
}
|
|
1037
|
+
return false;
|
|
1038
|
+
};
|
|
1039
|
+
function _configure(configuration) {
|
|
1040
|
+
_cometd._debug("Configuring cometd object with", configuration);
|
|
1041
|
+
if (_isString(configuration)) configuration = { url: configuration };
|
|
1042
|
+
if (!configuration) configuration = {};
|
|
1043
|
+
_config = _cometd._mixin(false, _config, configuration);
|
|
1044
|
+
var url = _cometd.getURL();
|
|
1045
|
+
if (!url) throw "Missing required configuration parameter 'url' specifying the Bayeux server URL";
|
|
1046
|
+
var urlParts = _splitURL(url);
|
|
1047
|
+
var hostAndPort = urlParts[2];
|
|
1048
|
+
var uri = urlParts[8];
|
|
1049
|
+
var afterURI = urlParts[9];
|
|
1050
|
+
_crossDomain = _cometd._isCrossDomain(hostAndPort);
|
|
1051
|
+
if (_config.appendMessageTypeToURL) if (afterURI !== void 0 && afterURI.length > 0) {
|
|
1052
|
+
_cometd._info("Appending message type to URI " + uri + afterURI + " is not supported, disabling 'appendMessageTypeToURL' configuration");
|
|
1053
|
+
_config.appendMessageTypeToURL = false;
|
|
1054
|
+
} else {
|
|
1055
|
+
var uriSegments = uri.split("/");
|
|
1056
|
+
var lastSegmentIndex = uriSegments.length - 1;
|
|
1057
|
+
if (uri.match(/\/$/)) lastSegmentIndex -= 1;
|
|
1058
|
+
if (uriSegments[lastSegmentIndex].indexOf(".") >= 0) {
|
|
1059
|
+
_cometd._info("Appending message type to URI " + uri + " is not supported, disabling 'appendMessageTypeToURL' configuration");
|
|
1060
|
+
_config.appendMessageTypeToURL = false;
|
|
1061
|
+
}
|
|
1062
|
+
}
|
|
1063
|
+
if (window.Worker && window.Blob && window.URL && _config.useWorkerScheduler) {
|
|
1064
|
+
var code = WorkerScheduler.toString();
|
|
1065
|
+
code = code.substring(code.indexOf("{") + 1, code.lastIndexOf("}"));
|
|
1066
|
+
var blob = new window.Blob([code], { type: "application/json" });
|
|
1067
|
+
var blobURL = window.URL.createObjectURL(blob);
|
|
1068
|
+
var worker = new window.Worker(blobURL);
|
|
1069
|
+
_scheduler.setTimeout = function(funktion, delay) {
|
|
1070
|
+
var id = _scheduler.register(funktion);
|
|
1071
|
+
worker.postMessage({
|
|
1072
|
+
id,
|
|
1073
|
+
type: "setTimeout",
|
|
1074
|
+
delay
|
|
1075
|
+
});
|
|
1076
|
+
return id;
|
|
1077
|
+
};
|
|
1078
|
+
_scheduler.clearTimeout = function(id) {
|
|
1079
|
+
_scheduler.unregister(id);
|
|
1080
|
+
worker.postMessage({
|
|
1081
|
+
id,
|
|
1082
|
+
type: "clearTimeout"
|
|
1083
|
+
});
|
|
1084
|
+
};
|
|
1085
|
+
worker.onmessage = function(e) {
|
|
1086
|
+
var id = e.data.id;
|
|
1087
|
+
var funktion = _scheduler.unregister(id);
|
|
1088
|
+
if (funktion) funktion();
|
|
1089
|
+
};
|
|
1090
|
+
}
|
|
1091
|
+
}
|
|
1092
|
+
function _removeListener(subscription) {
|
|
1093
|
+
if (subscription) {
|
|
1094
|
+
var subscriptions = _listeners[subscription.channel];
|
|
1095
|
+
if (subscriptions && subscriptions[subscription.id]) {
|
|
1096
|
+
delete subscriptions[subscription.id];
|
|
1097
|
+
_cometd._debug("Removed", subscription.listener ? "listener" : "subscription", subscription);
|
|
1098
|
+
}
|
|
1099
|
+
}
|
|
1100
|
+
}
|
|
1101
|
+
function _removeSubscription(subscription) {
|
|
1102
|
+
if (subscription && !subscription.listener) _removeListener(subscription);
|
|
1103
|
+
}
|
|
1104
|
+
function _clearSubscriptions() {
|
|
1105
|
+
for (var channel in _listeners) if (_listeners.hasOwnProperty(channel)) {
|
|
1106
|
+
var subscriptions = _listeners[channel];
|
|
1107
|
+
if (subscriptions) {
|
|
1108
|
+
for (var id in subscriptions) if (subscriptions.hasOwnProperty(id)) _removeSubscription(subscriptions[id]);
|
|
1109
|
+
}
|
|
1110
|
+
}
|
|
1111
|
+
}
|
|
1112
|
+
function _setStatus(newStatus) {
|
|
1113
|
+
if (_status !== newStatus) {
|
|
1114
|
+
_cometd._debug("Status", _status, "->", newStatus);
|
|
1115
|
+
_status = newStatus;
|
|
1116
|
+
}
|
|
1117
|
+
}
|
|
1118
|
+
function _isDisconnected() {
|
|
1119
|
+
return _status === "disconnecting" || _status === "disconnected";
|
|
1120
|
+
}
|
|
1121
|
+
function _nextMessageId() {
|
|
1122
|
+
return "" + ++_messageId;
|
|
1123
|
+
}
|
|
1124
|
+
function _applyExtension(scope, callback, name, message, outgoing) {
|
|
1125
|
+
try {
|
|
1126
|
+
return callback.call(scope, message);
|
|
1127
|
+
} catch (x) {
|
|
1128
|
+
var handler = _cometd.onExtensionException;
|
|
1129
|
+
if (_isFunction(handler)) {
|
|
1130
|
+
_cometd._debug("Invoking extension exception handler", name, x);
|
|
1131
|
+
try {
|
|
1132
|
+
handler.call(_cometd, x, name, outgoing, message);
|
|
1133
|
+
} catch (xx) {
|
|
1134
|
+
_cometd._info("Exception during execution of extension exception handler", name, xx);
|
|
1135
|
+
}
|
|
1136
|
+
} else _cometd._info("Exception during execution of extension", name, x);
|
|
1137
|
+
return message;
|
|
1138
|
+
}
|
|
1139
|
+
}
|
|
1140
|
+
function _applyIncomingExtensions(message) {
|
|
1141
|
+
for (var i = 0; i < _extensions.length; ++i) {
|
|
1142
|
+
if (message === void 0 || message === null) break;
|
|
1143
|
+
var extension = _extensions[i];
|
|
1144
|
+
var callback = extension.extension.incoming;
|
|
1145
|
+
if (_isFunction(callback)) {
|
|
1146
|
+
var result = _applyExtension(extension.extension, callback, extension.name, message, false);
|
|
1147
|
+
message = result === void 0 ? message : result;
|
|
1148
|
+
}
|
|
1149
|
+
}
|
|
1150
|
+
return message;
|
|
1151
|
+
}
|
|
1152
|
+
function _applyOutgoingExtensions(message) {
|
|
1153
|
+
for (var i = _extensions.length - 1; i >= 0; --i) {
|
|
1154
|
+
if (message === void 0 || message === null) break;
|
|
1155
|
+
var extension = _extensions[i];
|
|
1156
|
+
var callback = extension.extension.outgoing;
|
|
1157
|
+
if (_isFunction(callback)) {
|
|
1158
|
+
var result = _applyExtension(extension.extension, callback, extension.name, message, true);
|
|
1159
|
+
message = result === void 0 ? message : result;
|
|
1160
|
+
}
|
|
1161
|
+
}
|
|
1162
|
+
return message;
|
|
1163
|
+
}
|
|
1164
|
+
function _notify(channel, message) {
|
|
1165
|
+
var subscriptions = _listeners[channel];
|
|
1166
|
+
if (subscriptions) {
|
|
1167
|
+
for (var id in subscriptions) if (subscriptions.hasOwnProperty(id)) {
|
|
1168
|
+
var subscription = subscriptions[id];
|
|
1169
|
+
if (subscription) try {
|
|
1170
|
+
subscription.callback.call(subscription.scope, message);
|
|
1171
|
+
} catch (x) {
|
|
1172
|
+
var handler = _cometd.onListenerException;
|
|
1173
|
+
if (_isFunction(handler)) {
|
|
1174
|
+
_cometd._debug("Invoking listener exception handler", subscription, x);
|
|
1175
|
+
try {
|
|
1176
|
+
handler.call(_cometd, x, subscription, subscription.listener, message);
|
|
1177
|
+
} catch (xx) {
|
|
1178
|
+
_cometd._info("Exception during execution of listener exception handler", subscription, xx);
|
|
1179
|
+
}
|
|
1180
|
+
} else _cometd._info("Exception during execution of listener", subscription, message, x);
|
|
1181
|
+
}
|
|
1182
|
+
}
|
|
1183
|
+
}
|
|
1184
|
+
}
|
|
1185
|
+
function _notifyListeners(channel, message) {
|
|
1186
|
+
_notify(channel, message);
|
|
1187
|
+
var channelParts = channel.split("/");
|
|
1188
|
+
var last = channelParts.length - 1;
|
|
1189
|
+
for (var i = last; i > 0; --i) {
|
|
1190
|
+
var channelPart = channelParts.slice(0, i).join("/") + "/*";
|
|
1191
|
+
if (i === last) _notify(channelPart, message);
|
|
1192
|
+
channelPart += "*";
|
|
1193
|
+
_notify(channelPart, message);
|
|
1194
|
+
}
|
|
1195
|
+
}
|
|
1196
|
+
function _cancelDelayedSend() {
|
|
1197
|
+
if (_scheduledSend !== null) _cometd.clearTimeout(_scheduledSend);
|
|
1198
|
+
_scheduledSend = null;
|
|
1199
|
+
}
|
|
1200
|
+
function _delayedSend(operation, delay) {
|
|
1201
|
+
_cancelDelayedSend();
|
|
1202
|
+
var time = _advice.interval + delay;
|
|
1203
|
+
_cometd._debug("Function scheduled in", time, "ms, interval =", _advice.interval, "backoff =", _backoff, operation);
|
|
1204
|
+
_scheduledSend = _cometd.setTimeout(operation, time);
|
|
1205
|
+
}
|
|
1206
|
+
var _handleMessages;
|
|
1207
|
+
var _handleFailure;
|
|
1208
|
+
/**
|
|
1209
|
+
* Delivers the messages to the CometD server
|
|
1210
|
+
* @param messages the array of messages to send
|
|
1211
|
+
* @param metaConnect true if this send is on /meta/connect
|
|
1212
|
+
* @param extraPath an extra path to append to the Bayeux server URL
|
|
1213
|
+
*/
|
|
1214
|
+
function _send(messages, metaConnect, extraPath) {
|
|
1215
|
+
for (var i = 0; i < messages.length; ++i) {
|
|
1216
|
+
var message = messages[i];
|
|
1217
|
+
var messageId = message.id;
|
|
1218
|
+
if (_clientId) message.clientId = _clientId;
|
|
1219
|
+
message = _applyOutgoingExtensions(message);
|
|
1220
|
+
if (message !== void 0 && message !== null) {
|
|
1221
|
+
message.id = messageId;
|
|
1222
|
+
messages[i] = message;
|
|
1223
|
+
} else {
|
|
1224
|
+
delete _callbacks[messageId];
|
|
1225
|
+
messages.splice(i--, 1);
|
|
1226
|
+
}
|
|
1227
|
+
}
|
|
1228
|
+
if (messages.length === 0) return;
|
|
1229
|
+
if (metaConnect) _metaConnect = messages[0];
|
|
1230
|
+
var url = _cometd.getURL();
|
|
1231
|
+
if (_config.appendMessageTypeToURL) {
|
|
1232
|
+
if (!url.match(/\/$/)) url = url + "/";
|
|
1233
|
+
if (extraPath) url = url + extraPath;
|
|
1234
|
+
}
|
|
1235
|
+
var envelope = {
|
|
1236
|
+
url,
|
|
1237
|
+
sync: false,
|
|
1238
|
+
messages,
|
|
1239
|
+
onSuccess: function(rcvdMessages) {
|
|
1240
|
+
try {
|
|
1241
|
+
_handleMessages.call(_cometd, rcvdMessages);
|
|
1242
|
+
} catch (x) {
|
|
1243
|
+
_cometd._info("Exception during handling of messages", x);
|
|
1244
|
+
}
|
|
1245
|
+
},
|
|
1246
|
+
onFailure: function(conduit, messages, failure) {
|
|
1247
|
+
try {
|
|
1248
|
+
var transport = _cometd.getTransport();
|
|
1249
|
+
failure.connectionType = transport ? transport.getType() : "unknown";
|
|
1250
|
+
_handleFailure.call(_cometd, conduit, messages, failure);
|
|
1251
|
+
} catch (x) {
|
|
1252
|
+
_cometd._info("Exception during handling of failure", x);
|
|
1253
|
+
}
|
|
1254
|
+
}
|
|
1255
|
+
};
|
|
1256
|
+
_cometd._debug("Send", envelope);
|
|
1257
|
+
_transport.send(envelope, metaConnect);
|
|
1258
|
+
}
|
|
1259
|
+
function _queueSend(message) {
|
|
1260
|
+
if (_batch > 0 || _internalBatch === true) _messageQueue.push(message);
|
|
1261
|
+
else _send([message], false);
|
|
1262
|
+
}
|
|
1263
|
+
/**
|
|
1264
|
+
* Sends a complete bayeux message.
|
|
1265
|
+
* This method is exposed as a public so that extensions may use it
|
|
1266
|
+
* to send bayeux message directly, for example in case of re-sending
|
|
1267
|
+
* messages that have already been sent but that for some reason must
|
|
1268
|
+
* be resent.
|
|
1269
|
+
*/
|
|
1270
|
+
this.send = _queueSend;
|
|
1271
|
+
function _resetBackoff() {
|
|
1272
|
+
_backoff = 0;
|
|
1273
|
+
}
|
|
1274
|
+
function _increaseBackoff() {
|
|
1275
|
+
if (_backoff < _config.maxBackoff) _backoff += _config.backoffIncrement;
|
|
1276
|
+
return _backoff;
|
|
1277
|
+
}
|
|
1278
|
+
/**
|
|
1279
|
+
* Starts a the batch of messages to be sent in a single request.
|
|
1280
|
+
* @see #_endBatch(sendMessages)
|
|
1281
|
+
*/
|
|
1282
|
+
function _startBatch() {
|
|
1283
|
+
++_batch;
|
|
1284
|
+
_cometd._debug("Starting batch, depth", _batch);
|
|
1285
|
+
}
|
|
1286
|
+
function _flushBatch() {
|
|
1287
|
+
var messages = _messageQueue;
|
|
1288
|
+
_messageQueue = [];
|
|
1289
|
+
if (messages.length > 0) _send(messages, false);
|
|
1290
|
+
}
|
|
1291
|
+
/**
|
|
1292
|
+
* Ends the batch of messages to be sent in a single request,
|
|
1293
|
+
* optionally sending messages present in the message queue depending
|
|
1294
|
+
* on the given argument.
|
|
1295
|
+
* @see #_startBatch()
|
|
1296
|
+
*/
|
|
1297
|
+
function _endBatch() {
|
|
1298
|
+
--_batch;
|
|
1299
|
+
_cometd._debug("Ending batch, depth", _batch);
|
|
1300
|
+
if (_batch < 0) throw "Calls to startBatch() and endBatch() are not paired";
|
|
1301
|
+
if (_batch === 0 && !_isDisconnected() && !_internalBatch) _flushBatch();
|
|
1302
|
+
}
|
|
1303
|
+
/**
|
|
1304
|
+
* Sends the connect message
|
|
1305
|
+
*/
|
|
1306
|
+
function _connect() {
|
|
1307
|
+
if (!_isDisconnected()) {
|
|
1308
|
+
var bayeuxMessage = {
|
|
1309
|
+
id: _nextMessageId(),
|
|
1310
|
+
channel: "/meta/connect",
|
|
1311
|
+
connectionType: _transport.getType()
|
|
1312
|
+
};
|
|
1313
|
+
if (!_connected) bayeuxMessage.advice = { timeout: 0 };
|
|
1314
|
+
_setStatus("connecting");
|
|
1315
|
+
_cometd._debug("Connect sent", bayeuxMessage);
|
|
1316
|
+
_send([bayeuxMessage], true, "connect");
|
|
1317
|
+
_setStatus("connected");
|
|
1318
|
+
}
|
|
1319
|
+
}
|
|
1320
|
+
function _delayedConnect(delay) {
|
|
1321
|
+
_setStatus("connecting");
|
|
1322
|
+
_delayedSend(function() {
|
|
1323
|
+
_connect();
|
|
1324
|
+
}, delay);
|
|
1325
|
+
}
|
|
1326
|
+
function _updateAdvice(newAdvice) {
|
|
1327
|
+
if (newAdvice) {
|
|
1328
|
+
_advice = _cometd._mixin(false, {}, _config.advice, newAdvice);
|
|
1329
|
+
_cometd._debug("New advice", _advice);
|
|
1330
|
+
}
|
|
1331
|
+
}
|
|
1332
|
+
function _disconnect(abort) {
|
|
1333
|
+
_cancelDelayedSend();
|
|
1334
|
+
if (abort && _transport) _transport.abort();
|
|
1335
|
+
_crossDomain = false;
|
|
1336
|
+
_transport = null;
|
|
1337
|
+
_setStatus("disconnected");
|
|
1338
|
+
_clientId = null;
|
|
1339
|
+
_batch = 0;
|
|
1340
|
+
_resetBackoff();
|
|
1341
|
+
_reestablish = false;
|
|
1342
|
+
_connected = false;
|
|
1343
|
+
_unconnectTime = 0;
|
|
1344
|
+
_metaConnect = null;
|
|
1345
|
+
if (_messageQueue.length > 0) {
|
|
1346
|
+
var messages = _messageQueue;
|
|
1347
|
+
_messageQueue = [];
|
|
1348
|
+
_handleFailure.call(_cometd, void 0, messages, { reason: "Disconnected" });
|
|
1349
|
+
}
|
|
1350
|
+
}
|
|
1351
|
+
function _notifyTransportException(oldTransport, newTransport, failure) {
|
|
1352
|
+
var handler = _cometd.onTransportException;
|
|
1353
|
+
if (_isFunction(handler)) {
|
|
1354
|
+
_cometd._debug("Invoking transport exception handler", oldTransport, newTransport, failure);
|
|
1355
|
+
try {
|
|
1356
|
+
handler.call(_cometd, failure, oldTransport, newTransport);
|
|
1357
|
+
} catch (x) {
|
|
1358
|
+
_cometd._info("Exception during execution of transport exception handler", x);
|
|
1359
|
+
}
|
|
1360
|
+
}
|
|
1361
|
+
}
|
|
1362
|
+
/**
|
|
1363
|
+
* Sends the initial handshake message
|
|
1364
|
+
*/
|
|
1365
|
+
function _handshake(handshakeProps, handshakeCallback) {
|
|
1366
|
+
if (_isFunction(handshakeProps)) {
|
|
1367
|
+
handshakeCallback = handshakeProps;
|
|
1368
|
+
handshakeProps = void 0;
|
|
1369
|
+
}
|
|
1370
|
+
_clientId = null;
|
|
1371
|
+
_clearSubscriptions();
|
|
1372
|
+
if (_isDisconnected()) _transports.reset(true);
|
|
1373
|
+
_updateAdvice({});
|
|
1374
|
+
_batch = 0;
|
|
1375
|
+
_internalBatch = true;
|
|
1376
|
+
_handshakeProps = handshakeProps;
|
|
1377
|
+
_handshakeCallback = handshakeCallback;
|
|
1378
|
+
var version = "1.0";
|
|
1379
|
+
var url = _cometd.getURL();
|
|
1380
|
+
var transportTypes = _transports.findTransportTypes(version, _crossDomain, url);
|
|
1381
|
+
var bayeuxMessage = {
|
|
1382
|
+
id: _nextMessageId(),
|
|
1383
|
+
version,
|
|
1384
|
+
minimumVersion: version,
|
|
1385
|
+
channel: "/meta/handshake",
|
|
1386
|
+
supportedConnectionTypes: transportTypes,
|
|
1387
|
+
advice: {
|
|
1388
|
+
timeout: _advice.timeout,
|
|
1389
|
+
interval: _advice.interval
|
|
1390
|
+
}
|
|
1391
|
+
};
|
|
1392
|
+
var message = _cometd._mixin(false, {}, _handshakeProps, bayeuxMessage);
|
|
1393
|
+
_cometd._putCallback(message.id, handshakeCallback);
|
|
1394
|
+
if (!_transport) {
|
|
1395
|
+
_transport = _transports.negotiateTransport(transportTypes, version, _crossDomain, url);
|
|
1396
|
+
if (!_transport) {
|
|
1397
|
+
var failure = "Could not find initial transport among: " + _transports.getTransportTypes();
|
|
1398
|
+
_cometd._warn(failure);
|
|
1399
|
+
throw failure;
|
|
1400
|
+
}
|
|
1401
|
+
}
|
|
1402
|
+
_cometd._debug("Initial transport is", _transport.getType());
|
|
1403
|
+
_setStatus("handshaking");
|
|
1404
|
+
_cometd._debug("Handshake sent", message);
|
|
1405
|
+
_send([message], false, "handshake");
|
|
1406
|
+
}
|
|
1407
|
+
function _delayedHandshake(delay) {
|
|
1408
|
+
_setStatus("handshaking");
|
|
1409
|
+
_internalBatch = true;
|
|
1410
|
+
_delayedSend(function() {
|
|
1411
|
+
_handshake(_handshakeProps, _handshakeCallback);
|
|
1412
|
+
}, delay);
|
|
1413
|
+
}
|
|
1414
|
+
function _notifyCallback(callback, message) {
|
|
1415
|
+
try {
|
|
1416
|
+
callback.call(_cometd, message);
|
|
1417
|
+
} catch (x) {
|
|
1418
|
+
var handler = _cometd.onCallbackException;
|
|
1419
|
+
if (_isFunction(handler)) {
|
|
1420
|
+
_cometd._debug("Invoking callback exception handler", x);
|
|
1421
|
+
try {
|
|
1422
|
+
handler.call(_cometd, x, message);
|
|
1423
|
+
} catch (xx) {
|
|
1424
|
+
_cometd._info("Exception during execution of callback exception handler", xx);
|
|
1425
|
+
}
|
|
1426
|
+
} else _cometd._info("Exception during execution of message callback", x);
|
|
1427
|
+
}
|
|
1428
|
+
}
|
|
1429
|
+
this._getCallback = function(messageId) {
|
|
1430
|
+
return _callbacks[messageId];
|
|
1431
|
+
};
|
|
1432
|
+
this._putCallback = function(messageId, callback) {
|
|
1433
|
+
var result = this._getCallback(messageId);
|
|
1434
|
+
if (_isFunction(callback)) _callbacks[messageId] = callback;
|
|
1435
|
+
return result;
|
|
1436
|
+
};
|
|
1437
|
+
function _handleCallback(message) {
|
|
1438
|
+
var callback = _cometd._getCallback([message.id]);
|
|
1439
|
+
if (_isFunction(callback)) {
|
|
1440
|
+
delete _callbacks[message.id];
|
|
1441
|
+
_notifyCallback(callback, message);
|
|
1442
|
+
}
|
|
1443
|
+
}
|
|
1444
|
+
function _handleRemoteCall(message) {
|
|
1445
|
+
var context = _remoteCalls[message.id];
|
|
1446
|
+
delete _remoteCalls[message.id];
|
|
1447
|
+
if (context) {
|
|
1448
|
+
_cometd._debug("Handling remote call response for", message, "with context", context);
|
|
1449
|
+
var timeout = context.timeout;
|
|
1450
|
+
if (timeout) _cometd.clearTimeout(timeout);
|
|
1451
|
+
var callback = context.callback;
|
|
1452
|
+
if (_isFunction(callback)) {
|
|
1453
|
+
_notifyCallback(callback, message);
|
|
1454
|
+
return true;
|
|
1455
|
+
}
|
|
1456
|
+
}
|
|
1457
|
+
return false;
|
|
1458
|
+
}
|
|
1459
|
+
this.onTransportFailure = function(message, failureInfo, failureHandler) {
|
|
1460
|
+
this._debug("Transport failure", failureInfo, "for", message);
|
|
1461
|
+
var transports = this.getTransportRegistry();
|
|
1462
|
+
var url = this.getURL();
|
|
1463
|
+
var crossDomain = this._isCrossDomain(_splitURL(url)[2]);
|
|
1464
|
+
var version = "1.0";
|
|
1465
|
+
var transportTypes = transports.findTransportTypes(version, crossDomain, url);
|
|
1466
|
+
if (failureInfo.action === "none") {
|
|
1467
|
+
if (message.channel === "/meta/handshake") {
|
|
1468
|
+
if (!failureInfo.transport) {
|
|
1469
|
+
var failure = "Could not negotiate transport, client=[" + transportTypes + "], server=[" + message.supportedConnectionTypes + "]";
|
|
1470
|
+
this._warn(failure);
|
|
1471
|
+
_notifyTransportException(_transport.getType(), null, {
|
|
1472
|
+
reason: failure,
|
|
1473
|
+
connectionType: _transport.getType(),
|
|
1474
|
+
transport: _transport
|
|
1475
|
+
});
|
|
1476
|
+
}
|
|
1477
|
+
}
|
|
1478
|
+
} else {
|
|
1479
|
+
failureInfo.delay = this.getBackoffPeriod();
|
|
1480
|
+
if (message.channel === "/meta/handshake") {
|
|
1481
|
+
if (!failureInfo.transport) {
|
|
1482
|
+
var oldTransportType = _transport ? _transport.getType() : null;
|
|
1483
|
+
var newTransport = transports.negotiateTransport(transportTypes, version, crossDomain, url);
|
|
1484
|
+
if (!newTransport) {
|
|
1485
|
+
this._warn("Could not negotiate transport, client=[" + transportTypes + "]");
|
|
1486
|
+
_notifyTransportException(oldTransportType, null, message.failure);
|
|
1487
|
+
failureInfo.action = "none";
|
|
1488
|
+
} else {
|
|
1489
|
+
var newTransportType = newTransport.getType();
|
|
1490
|
+
this._debug("Transport", oldTransportType, "->", newTransportType);
|
|
1491
|
+
_notifyTransportException(oldTransportType, newTransportType, message.failure);
|
|
1492
|
+
failureInfo.action = "handshake";
|
|
1493
|
+
failureInfo.transport = newTransport;
|
|
1494
|
+
}
|
|
1495
|
+
}
|
|
1496
|
+
if (failureInfo.action !== "none") this.increaseBackoffPeriod();
|
|
1497
|
+
} else {
|
|
1498
|
+
var now = (/* @__PURE__ */ new Date()).getTime();
|
|
1499
|
+
if (_unconnectTime === 0) _unconnectTime = now;
|
|
1500
|
+
if (failureInfo.action === "retry") {
|
|
1501
|
+
failureInfo.delay = this.increaseBackoffPeriod();
|
|
1502
|
+
var maxInterval = _advice.maxInterval;
|
|
1503
|
+
if (maxInterval > 0) {
|
|
1504
|
+
var expiration = _advice.timeout + _advice.interval + maxInterval;
|
|
1505
|
+
if (now - _unconnectTime + _backoff > expiration) failureInfo.action = "handshake";
|
|
1506
|
+
}
|
|
1507
|
+
}
|
|
1508
|
+
if (failureInfo.action === "handshake") {
|
|
1509
|
+
failureInfo.delay = 0;
|
|
1510
|
+
transports.reset(false);
|
|
1511
|
+
this.resetBackoffPeriod();
|
|
1512
|
+
}
|
|
1513
|
+
}
|
|
1514
|
+
}
|
|
1515
|
+
failureHandler.call(_cometd, failureInfo);
|
|
1516
|
+
};
|
|
1517
|
+
function _handleTransportFailure(failureInfo) {
|
|
1518
|
+
_cometd._debug("Transport failure handling", failureInfo);
|
|
1519
|
+
if (failureInfo.transport) _transport = failureInfo.transport;
|
|
1520
|
+
if (failureInfo.url) _transport.setURL(failureInfo.url);
|
|
1521
|
+
var action = failureInfo.action;
|
|
1522
|
+
var delay = failureInfo.delay || 0;
|
|
1523
|
+
switch (action) {
|
|
1524
|
+
case "handshake":
|
|
1525
|
+
_delayedHandshake(delay);
|
|
1526
|
+
break;
|
|
1527
|
+
case "retry":
|
|
1528
|
+
_delayedConnect(delay);
|
|
1529
|
+
break;
|
|
1530
|
+
case "none":
|
|
1531
|
+
_disconnect(true);
|
|
1532
|
+
break;
|
|
1533
|
+
default: throw "Unknown action " + action;
|
|
1534
|
+
}
|
|
1535
|
+
}
|
|
1536
|
+
function _failHandshake(message, failureInfo) {
|
|
1537
|
+
_handleCallback(message);
|
|
1538
|
+
_notifyListeners("/meta/handshake", message);
|
|
1539
|
+
_notifyListeners("/meta/unsuccessful", message);
|
|
1540
|
+
if (_isDisconnected()) failureInfo.action = "none";
|
|
1541
|
+
_cometd.onTransportFailure.call(_cometd, message, failureInfo, _handleTransportFailure);
|
|
1542
|
+
}
|
|
1543
|
+
function _handshakeResponse(message) {
|
|
1544
|
+
var url = _cometd.getURL();
|
|
1545
|
+
if (message.successful) {
|
|
1546
|
+
var crossDomain = _cometd._isCrossDomain(_splitURL(url)[2]);
|
|
1547
|
+
var newTransport = _transports.negotiateTransport(message.supportedConnectionTypes, message.version, crossDomain, url);
|
|
1548
|
+
if (newTransport === null) {
|
|
1549
|
+
message.successful = false;
|
|
1550
|
+
_failHandshake(message, {
|
|
1551
|
+
cause: "negotiation",
|
|
1552
|
+
action: "none",
|
|
1553
|
+
transport: null
|
|
1554
|
+
});
|
|
1555
|
+
return;
|
|
1556
|
+
} else if (_transport !== newTransport) {
|
|
1557
|
+
_cometd._debug("Transport", _transport.getType(), "->", newTransport.getType());
|
|
1558
|
+
_transport = newTransport;
|
|
1559
|
+
}
|
|
1560
|
+
_clientId = message.clientId;
|
|
1561
|
+
_internalBatch = false;
|
|
1562
|
+
_flushBatch();
|
|
1563
|
+
message.reestablish = _reestablish;
|
|
1564
|
+
_reestablish = true;
|
|
1565
|
+
_handleCallback(message);
|
|
1566
|
+
_notifyListeners("/meta/handshake", message);
|
|
1567
|
+
_handshakeMessages = message["x-messages"] || 0;
|
|
1568
|
+
var action = _isDisconnected() ? "none" : _advice.reconnect || "retry";
|
|
1569
|
+
switch (action) {
|
|
1570
|
+
case "retry":
|
|
1571
|
+
_resetBackoff();
|
|
1572
|
+
if (_handshakeMessages === 0) _delayedConnect(0);
|
|
1573
|
+
else _cometd._debug("Processing", _handshakeMessages, "handshake-delivered messages");
|
|
1574
|
+
break;
|
|
1575
|
+
case "none":
|
|
1576
|
+
_disconnect(true);
|
|
1577
|
+
break;
|
|
1578
|
+
default: throw "Unrecognized advice action " + action;
|
|
1579
|
+
}
|
|
1580
|
+
} else _failHandshake(message, {
|
|
1581
|
+
cause: "unsuccessful",
|
|
1582
|
+
action: _advice.reconnect || "handshake",
|
|
1583
|
+
transport: _transport
|
|
1584
|
+
});
|
|
1585
|
+
}
|
|
1586
|
+
function _handshakeFailure(message) {
|
|
1587
|
+
_failHandshake(message, {
|
|
1588
|
+
cause: "failure",
|
|
1589
|
+
action: "handshake",
|
|
1590
|
+
transport: null
|
|
1591
|
+
});
|
|
1592
|
+
}
|
|
1593
|
+
function _matchMetaConnect(connect) {
|
|
1594
|
+
if (_status === "disconnected") return true;
|
|
1595
|
+
if (_metaConnect && _metaConnect.id === connect.id) {
|
|
1596
|
+
_metaConnect = null;
|
|
1597
|
+
return true;
|
|
1598
|
+
}
|
|
1599
|
+
return false;
|
|
1600
|
+
}
|
|
1601
|
+
function _failConnect(message, failureInfo) {
|
|
1602
|
+
_notifyListeners("/meta/connect", message);
|
|
1603
|
+
_notifyListeners("/meta/unsuccessful", message);
|
|
1604
|
+
if (_isDisconnected()) failureInfo.action = "none";
|
|
1605
|
+
_cometd.onTransportFailure.call(_cometd, message, failureInfo, _handleTransportFailure);
|
|
1606
|
+
}
|
|
1607
|
+
function _connectResponse(message) {
|
|
1608
|
+
if (_matchMetaConnect(message)) {
|
|
1609
|
+
_connected = message.successful;
|
|
1610
|
+
if (_connected) {
|
|
1611
|
+
_notifyListeners("/meta/connect", message);
|
|
1612
|
+
var action = _isDisconnected() ? "none" : _advice.reconnect || "retry";
|
|
1613
|
+
switch (action) {
|
|
1614
|
+
case "retry":
|
|
1615
|
+
_resetBackoff();
|
|
1616
|
+
_delayedConnect(_backoff);
|
|
1617
|
+
break;
|
|
1618
|
+
case "none":
|
|
1619
|
+
_disconnect(false);
|
|
1620
|
+
break;
|
|
1621
|
+
default: throw "Unrecognized advice action " + action;
|
|
1622
|
+
}
|
|
1623
|
+
} else _failConnect(message, {
|
|
1624
|
+
cause: "unsuccessful",
|
|
1625
|
+
action: _advice.reconnect || "retry",
|
|
1626
|
+
transport: _transport
|
|
1627
|
+
});
|
|
1628
|
+
} else _cometd._debug("Mismatched /meta/connect reply", message);
|
|
1629
|
+
}
|
|
1630
|
+
function _connectFailure(message) {
|
|
1631
|
+
if (_matchMetaConnect(message)) {
|
|
1632
|
+
_connected = false;
|
|
1633
|
+
_failConnect(message, {
|
|
1634
|
+
cause: "failure",
|
|
1635
|
+
action: "retry",
|
|
1636
|
+
transport: null
|
|
1637
|
+
});
|
|
1638
|
+
} else _cometd._debug("Mismatched /meta/connect failure", message);
|
|
1639
|
+
}
|
|
1640
|
+
function _failDisconnect(message) {
|
|
1641
|
+
_disconnect(true);
|
|
1642
|
+
_handleCallback(message);
|
|
1643
|
+
_notifyListeners("/meta/disconnect", message);
|
|
1644
|
+
_notifyListeners("/meta/unsuccessful", message);
|
|
1645
|
+
}
|
|
1646
|
+
function _disconnectResponse(message) {
|
|
1647
|
+
if (message.successful) {
|
|
1648
|
+
_disconnect(false);
|
|
1649
|
+
_handleCallback(message);
|
|
1650
|
+
_notifyListeners("/meta/disconnect", message);
|
|
1651
|
+
} else _failDisconnect(message);
|
|
1652
|
+
}
|
|
1653
|
+
function _disconnectFailure(message) {
|
|
1654
|
+
_failDisconnect(message);
|
|
1655
|
+
}
|
|
1656
|
+
function _failSubscribe(message) {
|
|
1657
|
+
var subscriptions = _listeners[message.subscription];
|
|
1658
|
+
if (subscriptions) {
|
|
1659
|
+
for (var id in subscriptions) if (subscriptions.hasOwnProperty(id)) {
|
|
1660
|
+
var subscription = subscriptions[id];
|
|
1661
|
+
if (subscription && !subscription.listener) {
|
|
1662
|
+
delete subscriptions[id];
|
|
1663
|
+
_cometd._debug("Removed failed subscription", subscription);
|
|
1664
|
+
}
|
|
1665
|
+
}
|
|
1666
|
+
}
|
|
1667
|
+
_handleCallback(message);
|
|
1668
|
+
_notifyListeners("/meta/subscribe", message);
|
|
1669
|
+
_notifyListeners("/meta/unsuccessful", message);
|
|
1670
|
+
}
|
|
1671
|
+
function _subscribeResponse(message) {
|
|
1672
|
+
if (message.successful) {
|
|
1673
|
+
_handleCallback(message);
|
|
1674
|
+
_notifyListeners("/meta/subscribe", message);
|
|
1675
|
+
} else _failSubscribe(message);
|
|
1676
|
+
}
|
|
1677
|
+
function _subscribeFailure(message) {
|
|
1678
|
+
_failSubscribe(message);
|
|
1679
|
+
}
|
|
1680
|
+
function _failUnsubscribe(message) {
|
|
1681
|
+
_handleCallback(message);
|
|
1682
|
+
_notifyListeners("/meta/unsubscribe", message);
|
|
1683
|
+
_notifyListeners("/meta/unsuccessful", message);
|
|
1684
|
+
}
|
|
1685
|
+
function _unsubscribeResponse(message) {
|
|
1686
|
+
if (message.successful) {
|
|
1687
|
+
_handleCallback(message);
|
|
1688
|
+
_notifyListeners("/meta/unsubscribe", message);
|
|
1689
|
+
} else _failUnsubscribe(message);
|
|
1690
|
+
}
|
|
1691
|
+
function _unsubscribeFailure(message) {
|
|
1692
|
+
_failUnsubscribe(message);
|
|
1693
|
+
}
|
|
1694
|
+
function _failMessage(message) {
|
|
1695
|
+
if (!_handleRemoteCall(message)) {
|
|
1696
|
+
_handleCallback(message);
|
|
1697
|
+
_notifyListeners("/meta/publish", message);
|
|
1698
|
+
_notifyListeners("/meta/unsuccessful", message);
|
|
1699
|
+
}
|
|
1700
|
+
}
|
|
1701
|
+
function _messageResponse(message) {
|
|
1702
|
+
if (message.data !== void 0) {
|
|
1703
|
+
if (!_handleRemoteCall(message)) {
|
|
1704
|
+
_notifyListeners(message.channel, message);
|
|
1705
|
+
if (_handshakeMessages > 0) {
|
|
1706
|
+
--_handshakeMessages;
|
|
1707
|
+
if (_handshakeMessages === 0) {
|
|
1708
|
+
_cometd._debug("Processed last handshake-delivered message");
|
|
1709
|
+
_delayedConnect(0);
|
|
1710
|
+
}
|
|
1711
|
+
}
|
|
1712
|
+
}
|
|
1713
|
+
} else if (message.successful === void 0) _cometd._warn("Unknown Bayeux Message", message);
|
|
1714
|
+
else if (message.successful) {
|
|
1715
|
+
_handleCallback(message);
|
|
1716
|
+
_notifyListeners("/meta/publish", message);
|
|
1717
|
+
} else _failMessage(message);
|
|
1718
|
+
}
|
|
1719
|
+
function _messageFailure(failure) {
|
|
1720
|
+
_failMessage(failure);
|
|
1721
|
+
}
|
|
1722
|
+
function _receive(message) {
|
|
1723
|
+
_unconnectTime = 0;
|
|
1724
|
+
message = _applyIncomingExtensions(message);
|
|
1725
|
+
if (message === void 0 || message === null) return;
|
|
1726
|
+
_updateAdvice(message.advice);
|
|
1727
|
+
switch (message.channel) {
|
|
1728
|
+
case "/meta/handshake":
|
|
1729
|
+
_handshakeResponse(message);
|
|
1730
|
+
break;
|
|
1731
|
+
case "/meta/connect":
|
|
1732
|
+
_connectResponse(message);
|
|
1733
|
+
break;
|
|
1734
|
+
case "/meta/disconnect":
|
|
1735
|
+
_disconnectResponse(message);
|
|
1736
|
+
break;
|
|
1737
|
+
case "/meta/subscribe":
|
|
1738
|
+
_subscribeResponse(message);
|
|
1739
|
+
break;
|
|
1740
|
+
case "/meta/unsubscribe":
|
|
1741
|
+
_unsubscribeResponse(message);
|
|
1742
|
+
break;
|
|
1743
|
+
default:
|
|
1744
|
+
_messageResponse(message);
|
|
1745
|
+
break;
|
|
1746
|
+
}
|
|
1747
|
+
}
|
|
1748
|
+
/**
|
|
1749
|
+
* Receives a message.
|
|
1750
|
+
* This method is exposed as a public so that extensions may inject
|
|
1751
|
+
* messages simulating that they had been received.
|
|
1752
|
+
*/
|
|
1753
|
+
this.receive = _receive;
|
|
1754
|
+
_handleMessages = function(rcvdMessages) {
|
|
1755
|
+
_cometd._debug("Received", rcvdMessages);
|
|
1756
|
+
for (var i = 0; i < rcvdMessages.length; ++i) {
|
|
1757
|
+
var message = rcvdMessages[i];
|
|
1758
|
+
_receive(message);
|
|
1759
|
+
}
|
|
1760
|
+
};
|
|
1761
|
+
_handleFailure = function(conduit, messages, failure) {
|
|
1762
|
+
_cometd._debug("handleFailure", conduit, messages, failure);
|
|
1763
|
+
failure.transport = conduit;
|
|
1764
|
+
for (var i = 0; i < messages.length; ++i) {
|
|
1765
|
+
var message = messages[i];
|
|
1766
|
+
var failureMessage = {
|
|
1767
|
+
id: message.id,
|
|
1768
|
+
successful: false,
|
|
1769
|
+
channel: message.channel,
|
|
1770
|
+
failure
|
|
1771
|
+
};
|
|
1772
|
+
failure.message = message;
|
|
1773
|
+
switch (message.channel) {
|
|
1774
|
+
case "/meta/handshake":
|
|
1775
|
+
_handshakeFailure(failureMessage);
|
|
1776
|
+
break;
|
|
1777
|
+
case "/meta/connect":
|
|
1778
|
+
_connectFailure(failureMessage);
|
|
1779
|
+
break;
|
|
1780
|
+
case "/meta/disconnect":
|
|
1781
|
+
_disconnectFailure(failureMessage);
|
|
1782
|
+
break;
|
|
1783
|
+
case "/meta/subscribe":
|
|
1784
|
+
failureMessage.subscription = message.subscription;
|
|
1785
|
+
_subscribeFailure(failureMessage);
|
|
1786
|
+
break;
|
|
1787
|
+
case "/meta/unsubscribe":
|
|
1788
|
+
failureMessage.subscription = message.subscription;
|
|
1789
|
+
_unsubscribeFailure(failureMessage);
|
|
1790
|
+
break;
|
|
1791
|
+
default:
|
|
1792
|
+
_messageFailure(failureMessage);
|
|
1793
|
+
break;
|
|
1794
|
+
}
|
|
1795
|
+
}
|
|
1796
|
+
};
|
|
1797
|
+
function _hasSubscriptions(channel) {
|
|
1798
|
+
var subscriptions = _listeners[channel];
|
|
1799
|
+
if (subscriptions) {
|
|
1800
|
+
for (var id in subscriptions) if (subscriptions.hasOwnProperty(id)) {
|
|
1801
|
+
if (subscriptions[id]) return true;
|
|
1802
|
+
}
|
|
1803
|
+
}
|
|
1804
|
+
return false;
|
|
1805
|
+
}
|
|
1806
|
+
function _resolveScopedCallback(scope, callback) {
|
|
1807
|
+
var delegate = {
|
|
1808
|
+
scope,
|
|
1809
|
+
method: callback
|
|
1810
|
+
};
|
|
1811
|
+
if (_isFunction(scope)) {
|
|
1812
|
+
delegate.scope = void 0;
|
|
1813
|
+
delegate.method = scope;
|
|
1814
|
+
} else if (_isString(callback)) {
|
|
1815
|
+
if (!scope) throw "Invalid scope " + scope;
|
|
1816
|
+
delegate.method = scope[callback];
|
|
1817
|
+
if (!_isFunction(delegate.method)) throw "Invalid callback " + callback + " for scope " + scope;
|
|
1818
|
+
} else if (!_isFunction(callback)) throw "Invalid callback " + callback;
|
|
1819
|
+
return delegate;
|
|
1820
|
+
}
|
|
1821
|
+
function _addListener(channel, scope, callback, isListener) {
|
|
1822
|
+
var delegate = _resolveScopedCallback(scope, callback);
|
|
1823
|
+
_cometd._debug("Adding", isListener ? "listener" : "subscription", "on", channel, "with scope", delegate.scope, "and callback", delegate.method);
|
|
1824
|
+
var id = ++_listenerId;
|
|
1825
|
+
var subscription = {
|
|
1826
|
+
id,
|
|
1827
|
+
channel,
|
|
1828
|
+
scope: delegate.scope,
|
|
1829
|
+
callback: delegate.method,
|
|
1830
|
+
listener: isListener
|
|
1831
|
+
};
|
|
1832
|
+
var subscriptions = _listeners[channel];
|
|
1833
|
+
if (!subscriptions) {
|
|
1834
|
+
subscriptions = {};
|
|
1835
|
+
_listeners[channel] = subscriptions;
|
|
1836
|
+
}
|
|
1837
|
+
subscriptions[id] = subscription;
|
|
1838
|
+
_cometd._debug("Added", isListener ? "listener" : "subscription", subscription);
|
|
1839
|
+
return subscription;
|
|
1840
|
+
}
|
|
1841
|
+
/**
|
|
1842
|
+
* Registers the given transport under the given transport type.
|
|
1843
|
+
* The optional index parameter specifies the "priority" at which the
|
|
1844
|
+
* transport is registered (where 0 is the max priority).
|
|
1845
|
+
* If a transport with the same type is already registered, this function
|
|
1846
|
+
* does nothing and returns false.
|
|
1847
|
+
* @param type the transport type
|
|
1848
|
+
* @param transport the transport object
|
|
1849
|
+
* @param index the index at which this transport is to be registered
|
|
1850
|
+
* @return true if the transport has been registered, false otherwise
|
|
1851
|
+
* @see #unregisterTransport(type)
|
|
1852
|
+
*/
|
|
1853
|
+
this.registerTransport = function(type, transport, index) {
|
|
1854
|
+
var result = _transports.add(type, transport, index);
|
|
1855
|
+
if (result) {
|
|
1856
|
+
this._debug("Registered transport", type);
|
|
1857
|
+
if (_isFunction(transport.registered)) transport.registered(type, this);
|
|
1858
|
+
}
|
|
1859
|
+
return result;
|
|
1860
|
+
};
|
|
1861
|
+
/**
|
|
1862
|
+
* Unregisters the transport with the given transport type.
|
|
1863
|
+
* @param type the transport type to unregister
|
|
1864
|
+
* @return the transport that has been unregistered,
|
|
1865
|
+
* or null if no transport was previously registered under the given transport type
|
|
1866
|
+
*/
|
|
1867
|
+
this.unregisterTransport = function(type) {
|
|
1868
|
+
var transport = _transports.remove(type);
|
|
1869
|
+
if (transport !== null) {
|
|
1870
|
+
this._debug("Unregistered transport", type);
|
|
1871
|
+
if (_isFunction(transport.unregistered)) transport.unregistered();
|
|
1872
|
+
}
|
|
1873
|
+
return transport;
|
|
1874
|
+
};
|
|
1875
|
+
this.unregisterTransports = function() {
|
|
1876
|
+
_transports.clear();
|
|
1877
|
+
};
|
|
1878
|
+
/**
|
|
1879
|
+
* @return an array of all registered transport types
|
|
1880
|
+
*/
|
|
1881
|
+
this.getTransportTypes = function() {
|
|
1882
|
+
return _transports.getTransportTypes();
|
|
1883
|
+
};
|
|
1884
|
+
this.findTransport = function(name) {
|
|
1885
|
+
return _transports.find(name);
|
|
1886
|
+
};
|
|
1887
|
+
/**
|
|
1888
|
+
* @returns the TransportRegistry object
|
|
1889
|
+
*/
|
|
1890
|
+
this.getTransportRegistry = function() {
|
|
1891
|
+
return _transports;
|
|
1892
|
+
};
|
|
1893
|
+
/**
|
|
1894
|
+
* Configures the initial Bayeux communication with the Bayeux server.
|
|
1895
|
+
* Configuration is passed via an object that must contain a mandatory field <code>url</code>
|
|
1896
|
+
* of type string containing the URL of the Bayeux server.
|
|
1897
|
+
* @param configuration the configuration object
|
|
1898
|
+
*/
|
|
1899
|
+
this.configure = function(configuration) {
|
|
1900
|
+
_configure.call(this, configuration);
|
|
1901
|
+
};
|
|
1902
|
+
/**
|
|
1903
|
+
* Configures and establishes the Bayeux communication with the Bayeux server
|
|
1904
|
+
* via a handshake and a subsequent connect.
|
|
1905
|
+
* @param configuration the configuration object
|
|
1906
|
+
* @param handshakeProps an object to be merged with the handshake message
|
|
1907
|
+
* @see #configure(configuration)
|
|
1908
|
+
* @see #handshake(handshakeProps)
|
|
1909
|
+
*/
|
|
1910
|
+
this.init = function(configuration, handshakeProps) {
|
|
1911
|
+
this.configure(configuration);
|
|
1912
|
+
this.handshake(handshakeProps);
|
|
1913
|
+
};
|
|
1914
|
+
/**
|
|
1915
|
+
* Establishes the Bayeux communication with the Bayeux server
|
|
1916
|
+
* via a handshake and a subsequent connect.
|
|
1917
|
+
* @param handshakeProps an object to be merged with the handshake message
|
|
1918
|
+
* @param handshakeCallback a function to be invoked when the handshake is acknowledged
|
|
1919
|
+
*/
|
|
1920
|
+
this.handshake = function(handshakeProps, handshakeCallback) {
|
|
1921
|
+
if (_status !== "disconnected") throw "Illegal state: handshaken";
|
|
1922
|
+
_handshake(handshakeProps, handshakeCallback);
|
|
1923
|
+
};
|
|
1924
|
+
/**
|
|
1925
|
+
* Disconnects from the Bayeux server.
|
|
1926
|
+
* @param disconnectProps an object to be merged with the disconnect message
|
|
1927
|
+
* @param disconnectCallback a function to be invoked when the disconnect is acknowledged
|
|
1928
|
+
*/
|
|
1929
|
+
this.disconnect = function(disconnectProps, disconnectCallback) {
|
|
1930
|
+
if (_isDisconnected()) return;
|
|
1931
|
+
if (_isFunction(disconnectProps)) {
|
|
1932
|
+
disconnectCallback = disconnectProps;
|
|
1933
|
+
disconnectProps = void 0;
|
|
1934
|
+
}
|
|
1935
|
+
var bayeuxMessage = {
|
|
1936
|
+
id: _nextMessageId(),
|
|
1937
|
+
channel: "/meta/disconnect"
|
|
1938
|
+
};
|
|
1939
|
+
var message = this._mixin(false, {}, disconnectProps, bayeuxMessage);
|
|
1940
|
+
_cometd._putCallback(message.id, disconnectCallback);
|
|
1941
|
+
_setStatus("disconnecting");
|
|
1942
|
+
_send([message], false, "disconnect");
|
|
1943
|
+
};
|
|
1944
|
+
/**
|
|
1945
|
+
* Marks the start of a batch of application messages to be sent to the server
|
|
1946
|
+
* in a single request, obtaining a single response containing (possibly) many
|
|
1947
|
+
* application reply messages.
|
|
1948
|
+
* Messages are held in a queue and not sent until {@link #endBatch()} is called.
|
|
1949
|
+
* If startBatch() is called multiple times, then an equal number of endBatch()
|
|
1950
|
+
* calls must be made to close and send the batch of messages.
|
|
1951
|
+
* @see #endBatch()
|
|
1952
|
+
*/
|
|
1953
|
+
this.startBatch = function() {
|
|
1954
|
+
_startBatch();
|
|
1955
|
+
};
|
|
1956
|
+
/**
|
|
1957
|
+
* Marks the end of a batch of application messages to be sent to the server
|
|
1958
|
+
* in a single request.
|
|
1959
|
+
* @see #startBatch()
|
|
1960
|
+
*/
|
|
1961
|
+
this.endBatch = function() {
|
|
1962
|
+
_endBatch();
|
|
1963
|
+
};
|
|
1964
|
+
/**
|
|
1965
|
+
* Executes the given callback in the given scope, surrounded by a {@link #startBatch()}
|
|
1966
|
+
* and {@link #endBatch()} calls.
|
|
1967
|
+
* @param scope the scope of the callback, may be omitted
|
|
1968
|
+
* @param callback the callback to be executed within {@link #startBatch()} and {@link #endBatch()} calls
|
|
1969
|
+
*/
|
|
1970
|
+
this.batch = function(scope, callback) {
|
|
1971
|
+
var delegate = _resolveScopedCallback(scope, callback);
|
|
1972
|
+
this.startBatch();
|
|
1973
|
+
try {
|
|
1974
|
+
delegate.method.call(delegate.scope);
|
|
1975
|
+
this.endBatch();
|
|
1976
|
+
} catch (x) {
|
|
1977
|
+
this._info("Exception during execution of batch", x);
|
|
1978
|
+
this.endBatch();
|
|
1979
|
+
throw x;
|
|
1980
|
+
}
|
|
1981
|
+
};
|
|
1982
|
+
/**
|
|
1983
|
+
* Adds a listener for bayeux messages, performing the given callback in the given scope
|
|
1984
|
+
* when a message for the given channel arrives.
|
|
1985
|
+
* @param channel the channel the listener is interested to
|
|
1986
|
+
* @param scope the scope of the callback, may be omitted
|
|
1987
|
+
* @param callback the callback to call when a message is sent to the channel
|
|
1988
|
+
* @returns the subscription handle to be passed to {@link #removeListener(object)}
|
|
1989
|
+
* @see #removeListener(subscription)
|
|
1990
|
+
*/
|
|
1991
|
+
this.addListener = function(channel, scope, callback) {
|
|
1992
|
+
if (arguments.length < 2) throw "Illegal arguments number: required 2, got " + arguments.length;
|
|
1993
|
+
if (!_isString(channel)) throw "Illegal argument type: channel must be a string";
|
|
1994
|
+
return _addListener(channel, scope, callback, true);
|
|
1995
|
+
};
|
|
1996
|
+
/**
|
|
1997
|
+
* Removes the subscription obtained with a call to {@link #addListener(string, object, function)}.
|
|
1998
|
+
* @param subscription the subscription to unsubscribe.
|
|
1999
|
+
* @see #addListener(channel, scope, callback)
|
|
2000
|
+
*/
|
|
2001
|
+
this.removeListener = function(subscription) {
|
|
2002
|
+
if (!subscription || !subscription.channel || !("id" in subscription)) throw "Invalid argument: expected subscription, not " + subscription;
|
|
2003
|
+
_removeListener(subscription);
|
|
2004
|
+
};
|
|
2005
|
+
/**
|
|
2006
|
+
* Removes all listeners registered with {@link #addListener(channel, scope, callback)} or
|
|
2007
|
+
* {@link #subscribe(channel, scope, callback)}.
|
|
2008
|
+
*/
|
|
2009
|
+
this.clearListeners = function() {
|
|
2010
|
+
_listeners = {};
|
|
2011
|
+
};
|
|
2012
|
+
/**
|
|
2013
|
+
* Subscribes to the given channel, performing the given callback in the given scope
|
|
2014
|
+
* when a message for the channel arrives.
|
|
2015
|
+
* @param channel the channel to subscribe to
|
|
2016
|
+
* @param scope the scope of the callback, may be omitted
|
|
2017
|
+
* @param callback the callback to call when a message is sent to the channel
|
|
2018
|
+
* @param subscribeProps an object to be merged with the subscribe message
|
|
2019
|
+
* @param subscribeCallback a function to be invoked when the subscription is acknowledged
|
|
2020
|
+
* @return the subscription handle to be passed to {@link #unsubscribe(object)}
|
|
2021
|
+
*/
|
|
2022
|
+
this.subscribe = function(channel, scope, callback, subscribeProps, subscribeCallback) {
|
|
2023
|
+
if (arguments.length < 2) throw "Illegal arguments number: required 2, got " + arguments.length;
|
|
2024
|
+
if (!_isString(channel)) throw "Illegal argument type: channel must be a string";
|
|
2025
|
+
if (_isDisconnected()) throw "Illegal state: disconnected";
|
|
2026
|
+
if (_isFunction(scope)) {
|
|
2027
|
+
subscribeCallback = subscribeProps;
|
|
2028
|
+
subscribeProps = callback;
|
|
2029
|
+
callback = scope;
|
|
2030
|
+
scope = void 0;
|
|
2031
|
+
}
|
|
2032
|
+
if (_isFunction(subscribeProps)) {
|
|
2033
|
+
subscribeCallback = subscribeProps;
|
|
2034
|
+
subscribeProps = void 0;
|
|
2035
|
+
}
|
|
2036
|
+
var send = !_hasSubscriptions(channel);
|
|
2037
|
+
var subscription = _addListener(channel, scope, callback, false);
|
|
2038
|
+
if (send) {
|
|
2039
|
+
var bayeuxMessage = {
|
|
2040
|
+
id: _nextMessageId(),
|
|
2041
|
+
channel: "/meta/subscribe",
|
|
2042
|
+
subscription: channel
|
|
2043
|
+
};
|
|
2044
|
+
var message = this._mixin(false, {}, subscribeProps, bayeuxMessage);
|
|
2045
|
+
_cometd._putCallback(message.id, subscribeCallback);
|
|
2046
|
+
_queueSend(message);
|
|
2047
|
+
}
|
|
2048
|
+
return subscription;
|
|
2049
|
+
};
|
|
2050
|
+
/**
|
|
2051
|
+
* Unsubscribes the subscription obtained with a call to {@link #subscribe(string, object, function)}.
|
|
2052
|
+
* @param subscription the subscription to unsubscribe.
|
|
2053
|
+
* @param unsubscribeProps an object to be merged with the unsubscribe message
|
|
2054
|
+
* @param unsubscribeCallback a function to be invoked when the unsubscription is acknowledged
|
|
2055
|
+
*/
|
|
2056
|
+
this.unsubscribe = function(subscription, unsubscribeProps, unsubscribeCallback) {
|
|
2057
|
+
if (arguments.length < 1) throw "Illegal arguments number: required 1, got " + arguments.length;
|
|
2058
|
+
if (_isDisconnected()) throw "Illegal state: disconnected";
|
|
2059
|
+
if (_isFunction(unsubscribeProps)) {
|
|
2060
|
+
unsubscribeCallback = unsubscribeProps;
|
|
2061
|
+
unsubscribeProps = void 0;
|
|
2062
|
+
}
|
|
2063
|
+
this.removeListener(subscription);
|
|
2064
|
+
var channel = subscription.channel;
|
|
2065
|
+
if (!_hasSubscriptions(channel)) {
|
|
2066
|
+
var bayeuxMessage = {
|
|
2067
|
+
id: _nextMessageId(),
|
|
2068
|
+
channel: "/meta/unsubscribe",
|
|
2069
|
+
subscription: channel
|
|
2070
|
+
};
|
|
2071
|
+
var message = this._mixin(false, {}, unsubscribeProps, bayeuxMessage);
|
|
2072
|
+
_cometd._putCallback(message.id, unsubscribeCallback);
|
|
2073
|
+
_queueSend(message);
|
|
2074
|
+
}
|
|
2075
|
+
};
|
|
2076
|
+
this.resubscribe = function(subscription, subscribeProps) {
|
|
2077
|
+
_removeSubscription(subscription);
|
|
2078
|
+
if (subscription) return this.subscribe(subscription.channel, subscription.scope, subscription.callback, subscribeProps);
|
|
2079
|
+
};
|
|
2080
|
+
/**
|
|
2081
|
+
* Removes all subscriptions added via {@link #subscribe(channel, scope, callback, subscribeProps)},
|
|
2082
|
+
* but does not remove the listeners added via {@link addListener(channel, scope, callback)}.
|
|
2083
|
+
*/
|
|
2084
|
+
this.clearSubscriptions = function() {
|
|
2085
|
+
_clearSubscriptions();
|
|
2086
|
+
};
|
|
2087
|
+
/**
|
|
2088
|
+
* Publishes a message on the given channel, containing the given content.
|
|
2089
|
+
* @param channel the channel to publish the message to
|
|
2090
|
+
* @param content the content of the message
|
|
2091
|
+
* @param publishProps an object to be merged with the publish message
|
|
2092
|
+
* @param publishCallback a function to be invoked when the publish is acknowledged by the server
|
|
2093
|
+
*/
|
|
2094
|
+
this.publish = function(channel, content, publishProps, publishCallback) {
|
|
2095
|
+
if (arguments.length < 1) throw "Illegal arguments number: required 1, got " + arguments.length;
|
|
2096
|
+
if (!_isString(channel)) throw "Illegal argument type: channel must be a string";
|
|
2097
|
+
if (/^\/meta\//.test(channel)) throw "Illegal argument: cannot publish to meta channels";
|
|
2098
|
+
if (_isDisconnected()) throw "Illegal state: disconnected";
|
|
2099
|
+
if (_isFunction(content)) {
|
|
2100
|
+
publishCallback = content;
|
|
2101
|
+
content = {};
|
|
2102
|
+
publishProps = void 0;
|
|
2103
|
+
} else if (_isFunction(publishProps)) {
|
|
2104
|
+
publishCallback = publishProps;
|
|
2105
|
+
publishProps = void 0;
|
|
2106
|
+
}
|
|
2107
|
+
var bayeuxMessage = {
|
|
2108
|
+
id: _nextMessageId(),
|
|
2109
|
+
channel,
|
|
2110
|
+
data: content
|
|
2111
|
+
};
|
|
2112
|
+
var message = this._mixin(false, {}, publishProps, bayeuxMessage);
|
|
2113
|
+
_cometd._putCallback(message.id, publishCallback);
|
|
2114
|
+
_queueSend(message);
|
|
2115
|
+
};
|
|
2116
|
+
/**
|
|
2117
|
+
* Publishes a message with binary data on the given channel.
|
|
2118
|
+
* The binary data chunk may be an ArrayBuffer, a DataView, a TypedArray
|
|
2119
|
+
* (such as Uint8Array) or a plain integer array.
|
|
2120
|
+
* The meta data object may contain additional application data such as
|
|
2121
|
+
* a file name, a mime type, etc.
|
|
2122
|
+
* @param channel the channel to publish the message to
|
|
2123
|
+
* @param data the binary data to publish
|
|
2124
|
+
* @param last whether the binary data chunk is the last
|
|
2125
|
+
* @param meta an object containing meta data associated to the binary chunk
|
|
2126
|
+
* @param callback a function to be invoked when the publish is acknowledged by the server
|
|
2127
|
+
*/
|
|
2128
|
+
this.publishBinary = function(channel, data, last, meta, callback) {
|
|
2129
|
+
if (_isFunction(data)) {
|
|
2130
|
+
callback = data;
|
|
2131
|
+
data = /* @__PURE__ */ new ArrayBuffer(0);
|
|
2132
|
+
last = true;
|
|
2133
|
+
meta = void 0;
|
|
2134
|
+
} else if (_isFunction(last)) {
|
|
2135
|
+
callback = last;
|
|
2136
|
+
last = true;
|
|
2137
|
+
meta = void 0;
|
|
2138
|
+
} else if (_isFunction(meta)) {
|
|
2139
|
+
callback = meta;
|
|
2140
|
+
meta = void 0;
|
|
2141
|
+
}
|
|
2142
|
+
var content = {
|
|
2143
|
+
meta,
|
|
2144
|
+
data,
|
|
2145
|
+
last
|
|
2146
|
+
};
|
|
2147
|
+
this.publish(channel, content, { ext: { binary: {} } }, callback);
|
|
2148
|
+
};
|
|
2149
|
+
this.remoteCall = function(target, content, timeout, callProps, callback) {
|
|
2150
|
+
if (arguments.length < 1) throw "Illegal arguments number: required 1, got " + arguments.length;
|
|
2151
|
+
if (!_isString(target)) throw "Illegal argument type: target must be a string";
|
|
2152
|
+
if (_isDisconnected()) throw "Illegal state: disconnected";
|
|
2153
|
+
if (_isFunction(content)) {
|
|
2154
|
+
callback = content;
|
|
2155
|
+
content = {};
|
|
2156
|
+
timeout = _config.maxNetworkDelay;
|
|
2157
|
+
callProps = void 0;
|
|
2158
|
+
} else if (_isFunction(timeout)) {
|
|
2159
|
+
callback = timeout;
|
|
2160
|
+
timeout = _config.maxNetworkDelay;
|
|
2161
|
+
callProps = void 0;
|
|
2162
|
+
} else if (_isFunction(callProps)) {
|
|
2163
|
+
callback = callProps;
|
|
2164
|
+
callProps = void 0;
|
|
2165
|
+
}
|
|
2166
|
+
if (typeof timeout !== "number") throw "Illegal argument type: timeout must be a number";
|
|
2167
|
+
if (!target.match(/^\//)) target = "/" + target;
|
|
2168
|
+
var channel = "/service" + target;
|
|
2169
|
+
var bayeuxMessage = {
|
|
2170
|
+
id: _nextMessageId(),
|
|
2171
|
+
channel,
|
|
2172
|
+
data: content
|
|
2173
|
+
};
|
|
2174
|
+
var message = this._mixin(false, {}, callProps, bayeuxMessage);
|
|
2175
|
+
var context = { callback };
|
|
2176
|
+
if (timeout > 0) {
|
|
2177
|
+
context.timeout = _cometd.setTimeout(function() {
|
|
2178
|
+
_cometd._debug("Timing out remote call", message, "after", timeout, "ms");
|
|
2179
|
+
_failMessage({
|
|
2180
|
+
id: message.id,
|
|
2181
|
+
error: "406::timeout",
|
|
2182
|
+
successful: false,
|
|
2183
|
+
failure: {
|
|
2184
|
+
message,
|
|
2185
|
+
reason: "Remote Call Timeout"
|
|
2186
|
+
}
|
|
2187
|
+
});
|
|
2188
|
+
}, timeout);
|
|
2189
|
+
_cometd._debug("Scheduled remote call timeout", message, "in", timeout, "ms");
|
|
2190
|
+
}
|
|
2191
|
+
_remoteCalls[message.id] = context;
|
|
2192
|
+
_queueSend(message);
|
|
2193
|
+
};
|
|
2194
|
+
this.remoteCallBinary = function(target, data, last, meta, timeout, callback) {
|
|
2195
|
+
if (_isFunction(data)) {
|
|
2196
|
+
callback = data;
|
|
2197
|
+
data = /* @__PURE__ */ new ArrayBuffer(0);
|
|
2198
|
+
last = true;
|
|
2199
|
+
meta = void 0;
|
|
2200
|
+
timeout = _config.maxNetworkDelay;
|
|
2201
|
+
} else if (_isFunction(last)) {
|
|
2202
|
+
callback = last;
|
|
2203
|
+
last = true;
|
|
2204
|
+
meta = void 0;
|
|
2205
|
+
timeout = _config.maxNetworkDelay;
|
|
2206
|
+
} else if (_isFunction(meta)) {
|
|
2207
|
+
callback = meta;
|
|
2208
|
+
meta = void 0;
|
|
2209
|
+
timeout = _config.maxNetworkDelay;
|
|
2210
|
+
} else if (_isFunction(timeout)) {
|
|
2211
|
+
callback = timeout;
|
|
2212
|
+
timeout = _config.maxNetworkDelay;
|
|
2213
|
+
}
|
|
2214
|
+
var content = {
|
|
2215
|
+
meta,
|
|
2216
|
+
data,
|
|
2217
|
+
last
|
|
2218
|
+
};
|
|
2219
|
+
this.remoteCall(target, content, timeout, { ext: { binary: {} } }, callback);
|
|
2220
|
+
};
|
|
2221
|
+
/**
|
|
2222
|
+
* Returns a string representing the status of the bayeux communication with the Bayeux server.
|
|
2223
|
+
*/
|
|
2224
|
+
this.getStatus = function() {
|
|
2225
|
+
return _status;
|
|
2226
|
+
};
|
|
2227
|
+
/**
|
|
2228
|
+
* Returns whether this instance has been disconnected.
|
|
2229
|
+
*/
|
|
2230
|
+
this.isDisconnected = _isDisconnected;
|
|
2231
|
+
/**
|
|
2232
|
+
* Sets the backoff period used to increase the backoff time when retrying an unsuccessful or failed message.
|
|
2233
|
+
* Default value is 1 second, which means if there is a persistent failure the retries will happen
|
|
2234
|
+
* after 1 second, then after 2 seconds, then after 3 seconds, etc. So for example with 15 seconds of
|
|
2235
|
+
* elapsed time, there will be 5 retries (at 1, 3, 6, 10 and 15 seconds elapsed).
|
|
2236
|
+
* @param period the backoff period to set
|
|
2237
|
+
* @see #getBackoffIncrement()
|
|
2238
|
+
*/
|
|
2239
|
+
this.setBackoffIncrement = function(period) {
|
|
2240
|
+
_config.backoffIncrement = period;
|
|
2241
|
+
};
|
|
2242
|
+
/**
|
|
2243
|
+
* Returns the backoff period used to increase the backoff time when retrying an unsuccessful or failed message.
|
|
2244
|
+
* @see #setBackoffIncrement(period)
|
|
2245
|
+
*/
|
|
2246
|
+
this.getBackoffIncrement = function() {
|
|
2247
|
+
return _config.backoffIncrement;
|
|
2248
|
+
};
|
|
2249
|
+
/**
|
|
2250
|
+
* Returns the backoff period to wait before retrying an unsuccessful or failed message.
|
|
2251
|
+
*/
|
|
2252
|
+
this.getBackoffPeriod = function() {
|
|
2253
|
+
return _backoff;
|
|
2254
|
+
};
|
|
2255
|
+
/**
|
|
2256
|
+
* Increases the backoff period up to the maximum value configured.
|
|
2257
|
+
* @returns the backoff period after increment
|
|
2258
|
+
* @see getBackoffIncrement
|
|
2259
|
+
*/
|
|
2260
|
+
this.increaseBackoffPeriod = function() {
|
|
2261
|
+
return _increaseBackoff();
|
|
2262
|
+
};
|
|
2263
|
+
/**
|
|
2264
|
+
* Resets the backoff period to zero.
|
|
2265
|
+
*/
|
|
2266
|
+
this.resetBackoffPeriod = function() {
|
|
2267
|
+
_resetBackoff();
|
|
2268
|
+
};
|
|
2269
|
+
/**
|
|
2270
|
+
* Sets the log level for console logging.
|
|
2271
|
+
* Valid values are the strings 'error', 'warn', 'info' and 'debug', from
|
|
2272
|
+
* less verbose to more verbose.
|
|
2273
|
+
* @param level the log level string
|
|
2274
|
+
*/
|
|
2275
|
+
this.setLogLevel = function(level) {
|
|
2276
|
+
_config.logLevel = level;
|
|
2277
|
+
};
|
|
2278
|
+
/**
|
|
2279
|
+
* Registers an extension whose callbacks are called for every incoming message
|
|
2280
|
+
* (that comes from the server to this client implementation) and for every
|
|
2281
|
+
* outgoing message (that originates from this client implementation for the
|
|
2282
|
+
* server).
|
|
2283
|
+
* The format of the extension object is the following:
|
|
2284
|
+
* <pre>
|
|
2285
|
+
* {
|
|
2286
|
+
* incoming: function(message) { ... },
|
|
2287
|
+
* outgoing: function(message) { ... }
|
|
2288
|
+
* }
|
|
2289
|
+
* </pre>
|
|
2290
|
+
* Both properties are optional, but if they are present they will be called
|
|
2291
|
+
* respectively for each incoming message and for each outgoing message.
|
|
2292
|
+
* @param name the name of the extension
|
|
2293
|
+
* @param extension the extension to register
|
|
2294
|
+
* @return true if the extension was registered, false otherwise
|
|
2295
|
+
* @see #unregisterExtension(name)
|
|
2296
|
+
*/
|
|
2297
|
+
this.registerExtension = function(name, extension) {
|
|
2298
|
+
if (arguments.length < 2) throw "Illegal arguments number: required 2, got " + arguments.length;
|
|
2299
|
+
if (!_isString(name)) throw "Illegal argument type: extension name must be a string";
|
|
2300
|
+
var existing = false;
|
|
2301
|
+
for (var i = 0; i < _extensions.length; ++i) if (_extensions[i].name === name) {
|
|
2302
|
+
existing = true;
|
|
2303
|
+
break;
|
|
2304
|
+
}
|
|
2305
|
+
if (!existing) {
|
|
2306
|
+
_extensions.push({
|
|
2307
|
+
name,
|
|
2308
|
+
extension
|
|
2309
|
+
});
|
|
2310
|
+
this._debug("Registered extension", name);
|
|
2311
|
+
if (_isFunction(extension.registered)) extension.registered(name, this);
|
|
2312
|
+
return true;
|
|
2313
|
+
} else {
|
|
2314
|
+
this._info("Could not register extension with name", name, "since another extension with the same name already exists");
|
|
2315
|
+
return false;
|
|
2316
|
+
}
|
|
2317
|
+
};
|
|
2318
|
+
/**
|
|
2319
|
+
* Unregister an extension previously registered with
|
|
2320
|
+
* {@link #registerExtension(name, extension)}.
|
|
2321
|
+
* @param name the name of the extension to unregister.
|
|
2322
|
+
* @return true if the extension was unregistered, false otherwise
|
|
2323
|
+
*/
|
|
2324
|
+
this.unregisterExtension = function(name) {
|
|
2325
|
+
if (!_isString(name)) throw "Illegal argument type: extension name must be a string";
|
|
2326
|
+
var unregistered = false;
|
|
2327
|
+
for (var i = 0; i < _extensions.length; ++i) {
|
|
2328
|
+
var extension = _extensions[i];
|
|
2329
|
+
if (extension.name === name) {
|
|
2330
|
+
_extensions.splice(i, 1);
|
|
2331
|
+
unregistered = true;
|
|
2332
|
+
this._debug("Unregistered extension", name);
|
|
2333
|
+
var ext = extension.extension;
|
|
2334
|
+
if (_isFunction(ext.unregistered)) ext.unregistered();
|
|
2335
|
+
break;
|
|
2336
|
+
}
|
|
2337
|
+
}
|
|
2338
|
+
return unregistered;
|
|
2339
|
+
};
|
|
2340
|
+
/**
|
|
2341
|
+
* Find the extension registered with the given name.
|
|
2342
|
+
* @param name the name of the extension to find
|
|
2343
|
+
* @return the extension found or null if no extension with the given name has been registered
|
|
2344
|
+
*/
|
|
2345
|
+
this.getExtension = function(name) {
|
|
2346
|
+
for (var i = 0; i < _extensions.length; ++i) {
|
|
2347
|
+
var extension = _extensions[i];
|
|
2348
|
+
if (extension.name === name) return extension.extension;
|
|
2349
|
+
}
|
|
2350
|
+
return null;
|
|
2351
|
+
};
|
|
2352
|
+
/**
|
|
2353
|
+
* Returns the name assigned to this CometD object, or the string 'default'
|
|
2354
|
+
* if no name has been explicitly passed as parameter to the constructor.
|
|
2355
|
+
*/
|
|
2356
|
+
this.getName = function() {
|
|
2357
|
+
return _name;
|
|
2358
|
+
};
|
|
2359
|
+
/**
|
|
2360
|
+
* Returns the clientId assigned by the Bayeux server during handshake.
|
|
2361
|
+
*/
|
|
2362
|
+
this.getClientId = function() {
|
|
2363
|
+
return _clientId;
|
|
2364
|
+
};
|
|
2365
|
+
/**
|
|
2366
|
+
* Returns the URL of the Bayeux server.
|
|
2367
|
+
*/
|
|
2368
|
+
this.getURL = function() {
|
|
2369
|
+
if (_transport) {
|
|
2370
|
+
var url = _transport.getURL();
|
|
2371
|
+
if (url) return url;
|
|
2372
|
+
url = _config.urls[_transport.getType()];
|
|
2373
|
+
if (url) return url;
|
|
2374
|
+
}
|
|
2375
|
+
return _config.url;
|
|
2376
|
+
};
|
|
2377
|
+
this.getTransport = function() {
|
|
2378
|
+
return _transport;
|
|
2379
|
+
};
|
|
2380
|
+
this.getConfiguration = function() {
|
|
2381
|
+
return this._mixin(true, {}, _config);
|
|
2382
|
+
};
|
|
2383
|
+
this.getAdvice = function() {
|
|
2384
|
+
return this._mixin(true, {}, _advice);
|
|
2385
|
+
};
|
|
2386
|
+
this.setTimeout = function(funktion, delay) {
|
|
2387
|
+
return _scheduler.setTimeout(function() {
|
|
2388
|
+
try {
|
|
2389
|
+
_cometd._debug("Invoking timed function", funktion);
|
|
2390
|
+
funktion();
|
|
2391
|
+
} catch (x) {
|
|
2392
|
+
_cometd._debug("Exception invoking timed function", funktion, x);
|
|
2393
|
+
}
|
|
2394
|
+
}, delay);
|
|
2395
|
+
};
|
|
2396
|
+
this.clearTimeout = function(id) {
|
|
2397
|
+
_scheduler.clearTimeout(id);
|
|
2398
|
+
};
|
|
2399
|
+
if (window.WebSocket) this.registerTransport("websocket", new WebSocketTransport());
|
|
2400
|
+
this.registerTransport("long-polling", new LongPollingTransport());
|
|
2401
|
+
this.registerTransport("callback-polling", new CallbackPollingTransport());
|
|
2402
|
+
};
|
|
2403
|
+
var _z85EncodeTable = [
|
|
2404
|
+
"0",
|
|
2405
|
+
"1",
|
|
2406
|
+
"2",
|
|
2407
|
+
"3",
|
|
2408
|
+
"4",
|
|
2409
|
+
"5",
|
|
2410
|
+
"6",
|
|
2411
|
+
"7",
|
|
2412
|
+
"8",
|
|
2413
|
+
"9",
|
|
2414
|
+
"a",
|
|
2415
|
+
"b",
|
|
2416
|
+
"c",
|
|
2417
|
+
"d",
|
|
2418
|
+
"e",
|
|
2419
|
+
"f",
|
|
2420
|
+
"g",
|
|
2421
|
+
"h",
|
|
2422
|
+
"i",
|
|
2423
|
+
"j",
|
|
2424
|
+
"k",
|
|
2425
|
+
"l",
|
|
2426
|
+
"m",
|
|
2427
|
+
"n",
|
|
2428
|
+
"o",
|
|
2429
|
+
"p",
|
|
2430
|
+
"q",
|
|
2431
|
+
"r",
|
|
2432
|
+
"s",
|
|
2433
|
+
"t",
|
|
2434
|
+
"u",
|
|
2435
|
+
"v",
|
|
2436
|
+
"w",
|
|
2437
|
+
"x",
|
|
2438
|
+
"y",
|
|
2439
|
+
"z",
|
|
2440
|
+
"A",
|
|
2441
|
+
"B",
|
|
2442
|
+
"C",
|
|
2443
|
+
"D",
|
|
2444
|
+
"E",
|
|
2445
|
+
"F",
|
|
2446
|
+
"G",
|
|
2447
|
+
"H",
|
|
2448
|
+
"I",
|
|
2449
|
+
"J",
|
|
2450
|
+
"K",
|
|
2451
|
+
"L",
|
|
2452
|
+
"M",
|
|
2453
|
+
"N",
|
|
2454
|
+
"O",
|
|
2455
|
+
"P",
|
|
2456
|
+
"Q",
|
|
2457
|
+
"R",
|
|
2458
|
+
"S",
|
|
2459
|
+
"T",
|
|
2460
|
+
"U",
|
|
2461
|
+
"V",
|
|
2462
|
+
"W",
|
|
2463
|
+
"X",
|
|
2464
|
+
"Y",
|
|
2465
|
+
"Z",
|
|
2466
|
+
".",
|
|
2467
|
+
"-",
|
|
2468
|
+
":",
|
|
2469
|
+
"+",
|
|
2470
|
+
"=",
|
|
2471
|
+
"^",
|
|
2472
|
+
"!",
|
|
2473
|
+
"/",
|
|
2474
|
+
"*",
|
|
2475
|
+
"?",
|
|
2476
|
+
"&",
|
|
2477
|
+
"<",
|
|
2478
|
+
">",
|
|
2479
|
+
"(",
|
|
2480
|
+
")",
|
|
2481
|
+
"[",
|
|
2482
|
+
"]",
|
|
2483
|
+
"{",
|
|
2484
|
+
"}",
|
|
2485
|
+
"@",
|
|
2486
|
+
"%",
|
|
2487
|
+
"$",
|
|
2488
|
+
"#"
|
|
2489
|
+
];
|
|
2490
|
+
var _z85DecodeTable = [
|
|
2491
|
+
0,
|
|
2492
|
+
68,
|
|
2493
|
+
0,
|
|
2494
|
+
84,
|
|
2495
|
+
83,
|
|
2496
|
+
82,
|
|
2497
|
+
72,
|
|
2498
|
+
0,
|
|
2499
|
+
75,
|
|
2500
|
+
76,
|
|
2501
|
+
70,
|
|
2502
|
+
65,
|
|
2503
|
+
0,
|
|
2504
|
+
63,
|
|
2505
|
+
62,
|
|
2506
|
+
69,
|
|
2507
|
+
0,
|
|
2508
|
+
1,
|
|
2509
|
+
2,
|
|
2510
|
+
3,
|
|
2511
|
+
4,
|
|
2512
|
+
5,
|
|
2513
|
+
6,
|
|
2514
|
+
7,
|
|
2515
|
+
8,
|
|
2516
|
+
9,
|
|
2517
|
+
64,
|
|
2518
|
+
0,
|
|
2519
|
+
73,
|
|
2520
|
+
66,
|
|
2521
|
+
74,
|
|
2522
|
+
71,
|
|
2523
|
+
81,
|
|
2524
|
+
36,
|
|
2525
|
+
37,
|
|
2526
|
+
38,
|
|
2527
|
+
39,
|
|
2528
|
+
40,
|
|
2529
|
+
41,
|
|
2530
|
+
42,
|
|
2531
|
+
43,
|
|
2532
|
+
44,
|
|
2533
|
+
45,
|
|
2534
|
+
46,
|
|
2535
|
+
47,
|
|
2536
|
+
48,
|
|
2537
|
+
49,
|
|
2538
|
+
50,
|
|
2539
|
+
51,
|
|
2540
|
+
52,
|
|
2541
|
+
53,
|
|
2542
|
+
54,
|
|
2543
|
+
55,
|
|
2544
|
+
56,
|
|
2545
|
+
57,
|
|
2546
|
+
58,
|
|
2547
|
+
59,
|
|
2548
|
+
60,
|
|
2549
|
+
61,
|
|
2550
|
+
77,
|
|
2551
|
+
0,
|
|
2552
|
+
78,
|
|
2553
|
+
67,
|
|
2554
|
+
0,
|
|
2555
|
+
0,
|
|
2556
|
+
10,
|
|
2557
|
+
11,
|
|
2558
|
+
12,
|
|
2559
|
+
13,
|
|
2560
|
+
14,
|
|
2561
|
+
15,
|
|
2562
|
+
16,
|
|
2563
|
+
17,
|
|
2564
|
+
18,
|
|
2565
|
+
19,
|
|
2566
|
+
20,
|
|
2567
|
+
21,
|
|
2568
|
+
22,
|
|
2569
|
+
23,
|
|
2570
|
+
24,
|
|
2571
|
+
25,
|
|
2572
|
+
26,
|
|
2573
|
+
27,
|
|
2574
|
+
28,
|
|
2575
|
+
29,
|
|
2576
|
+
30,
|
|
2577
|
+
31,
|
|
2578
|
+
32,
|
|
2579
|
+
33,
|
|
2580
|
+
34,
|
|
2581
|
+
35,
|
|
2582
|
+
79,
|
|
2583
|
+
0,
|
|
2584
|
+
80,
|
|
2585
|
+
0,
|
|
2586
|
+
0
|
|
2587
|
+
];
|
|
2588
|
+
return {
|
|
2589
|
+
CometD,
|
|
2590
|
+
Transport,
|
|
2591
|
+
RequestTransport,
|
|
2592
|
+
LongPollingTransport,
|
|
2593
|
+
CallbackPollingTransport,
|
|
2594
|
+
WebSocketTransport,
|
|
2595
|
+
Utils,
|
|
2596
|
+
Z85: {
|
|
2597
|
+
encode: function(bytes) {
|
|
2598
|
+
var buffer = null;
|
|
2599
|
+
if (bytes instanceof ArrayBuffer) buffer = bytes;
|
|
2600
|
+
else if (bytes.buffer instanceof ArrayBuffer) buffer = bytes.buffer;
|
|
2601
|
+
else if (Array.isArray(bytes)) buffer = new Uint8Array(bytes).buffer;
|
|
2602
|
+
if (buffer == null) throw "Cannot Z85 encode " + bytes;
|
|
2603
|
+
var length = buffer.byteLength;
|
|
2604
|
+
var remainder = length % 4;
|
|
2605
|
+
var padding = 4 - (remainder === 0 ? 4 : remainder);
|
|
2606
|
+
var view = new DataView(buffer);
|
|
2607
|
+
var result = "";
|
|
2608
|
+
var value = 0;
|
|
2609
|
+
for (var i = 0; i < length + padding; ++i) {
|
|
2610
|
+
var isPadding = i >= length;
|
|
2611
|
+
value = value * 256 + (isPadding ? 0 : view.getUint8(i));
|
|
2612
|
+
if ((i + 1) % 4 === 0) {
|
|
2613
|
+
var divisor = 7225 * 85 * 85;
|
|
2614
|
+
for (var j = 5; j > 0; --j) {
|
|
2615
|
+
if (!isPadding || j > padding) {
|
|
2616
|
+
var code = Math.floor(value / divisor) % 85;
|
|
2617
|
+
result += _z85EncodeTable[code];
|
|
2618
|
+
}
|
|
2619
|
+
divisor /= 85;
|
|
2620
|
+
}
|
|
2621
|
+
value = 0;
|
|
2622
|
+
}
|
|
2623
|
+
}
|
|
2624
|
+
return result;
|
|
2625
|
+
},
|
|
2626
|
+
decode: function(string) {
|
|
2627
|
+
var remainder = string.length % 5;
|
|
2628
|
+
var padding = 5 - (remainder === 0 ? 5 : remainder);
|
|
2629
|
+
for (var p = 0; p < padding; ++p) string += _z85EncodeTable[_z85EncodeTable.length - 1];
|
|
2630
|
+
var length = string.length;
|
|
2631
|
+
var buffer = /* @__PURE__ */ new ArrayBuffer(length * 4 / 5 - padding);
|
|
2632
|
+
var view = new DataView(buffer);
|
|
2633
|
+
var value = 0;
|
|
2634
|
+
var charIdx = 0;
|
|
2635
|
+
var byteIdx = 0;
|
|
2636
|
+
for (var i = 0; i < length; ++i) {
|
|
2637
|
+
var code = string.charCodeAt(charIdx++) - 32;
|
|
2638
|
+
value = value * 85 + _z85DecodeTable[code];
|
|
2639
|
+
if (charIdx % 5 === 0) {
|
|
2640
|
+
var divisor = 256 * 256 * 256;
|
|
2641
|
+
while (divisor >= 1) {
|
|
2642
|
+
if (byteIdx < view.byteLength) view.setUint8(byteIdx++, Math.floor(value / divisor) % 256);
|
|
2643
|
+
divisor /= 256;
|
|
2644
|
+
}
|
|
2645
|
+
value = 0;
|
|
2646
|
+
}
|
|
2647
|
+
}
|
|
2648
|
+
return buffer;
|
|
2649
|
+
}
|
|
2650
|
+
}
|
|
2651
|
+
};
|
|
2652
|
+
});
|
|
2653
|
+
}));
|
|
2654
|
+
|
|
2655
|
+
//#endregion
|
|
2656
|
+
export default require_cometd();
|
|
2657
|
+
|
|
2658
|
+
export { require_cometd };
|